summaryrefslogtreecommitdiffstats
path: root/contrib/binutils/bfd
diff options
context:
space:
mode:
authordim <dim@FreeBSD.org>2011-02-18 20:54:12 +0000
committerdim <dim@FreeBSD.org>2011-02-18 20:54:12 +0000
commit58abb279f50d5ad9fbad30a39da04296664ec6cb (patch)
tree50e46c29de9d928e0d098104d28f1c1e0e628384 /contrib/binutils/bfd
parente1012e9afb73b834c089b15373d264e45a7b03f0 (diff)
parenta3786f65f1e2fa3a4e925fdb4b2b5544b9021bf9 (diff)
downloadFreeBSD-src-58abb279f50d5ad9fbad30a39da04296664ec6cb.zip
FreeBSD-src-58abb279f50d5ad9fbad30a39da04296664ec6cb.tar.gz
Merge binutils 2.17.50 to head. This brings a number of improvements to
x86 CPU support, better support for powerpc64, some new directives, and many other things. Bump __FreeBSD_version, and add a note to UPDATING. Thanks to the many people that have helped to test this. Obtained from: projects/binutils-2.17
Diffstat (limited to 'contrib/binutils/bfd')
-rw-r--r--contrib/binutils/bfd/ChangeLog2863
-rw-r--r--contrib/binutils/bfd/ChangeLog-020314
-rw-r--r--contrib/binutils/bfd/ChangeLog-20063601
-rw-r--r--contrib/binutils/bfd/Makefile.am1511
-rw-r--r--contrib/binutils/bfd/Makefile.in2296
-rw-r--r--contrib/binutils/bfd/acinclude.m494
-rw-r--r--contrib/binutils/bfd/aclocal.m41120
-rw-r--r--contrib/binutils/bfd/aout-arm.c440
-rw-r--r--contrib/binutils/bfd/aout-encap.c239
-rw-r--r--contrib/binutils/bfd/aout-sparcle.c2
-rw-r--r--contrib/binutils/bfd/aout-target.h299
-rw-r--r--contrib/binutils/bfd/aout0.c2
-rw-r--r--contrib/binutils/bfd/aout32.c2
-rw-r--r--contrib/binutils/bfd/aout64.c2
-rw-r--r--contrib/binutils/bfd/aoutf1.h471
-rw-r--r--contrib/binutils/bfd/aoutx.h3801
-rw-r--r--contrib/binutils/bfd/archive.c412
-rw-r--r--contrib/binutils/bfd/archive64.c57
-rw-r--r--contrib/binutils/bfd/archures.c120
-rw-r--r--contrib/binutils/bfd/armnetbsd.c20
-rw-r--r--contrib/binutils/bfd/bfd-in.h205
-rw-r--r--contrib/binutils/bfd/bfd-in2.h1427
-rw-r--r--contrib/binutils/bfd/bfd.c597
-rw-r--r--contrib/binutils/bfd/bfdio.c184
-rw-r--r--contrib/binutils/bfd/bfdwin.c15
-rw-r--r--contrib/binutils/bfd/binary.c154
-rw-r--r--contrib/binutils/bfd/bout.c1050
-rw-r--r--contrib/binutils/bfd/cache.c392
-rw-r--r--contrib/binutils/bfd/coff-alpha.c120
-rw-r--r--contrib/binutils/bfd/coff-arm.c703
-rw-r--r--contrib/binutils/bfd/coff-aux.c6
-rw-r--r--contrib/binutils/bfd/coff-i386.c90
-rw-r--r--contrib/binutils/bfd/coff-ia64.c6
-rw-r--r--contrib/binutils/bfd/coff-mips.c1276
-rw-r--r--contrib/binutils/bfd/coff-ppc.c291
-rw-r--r--contrib/binutils/bfd/coff-rs6000.c148
-rw-r--r--contrib/binutils/bfd/coff-sparc.c43
-rw-r--r--contrib/binutils/bfd/coff-x86_64.c4
-rw-r--r--contrib/binutils/bfd/coff64-rs6000.c91
-rw-r--r--contrib/binutils/bfd/coffcode.h1345
-rw-r--r--contrib/binutils/bfd/coffgen.c749
-rw-r--r--contrib/binutils/bfd/cofflink.c176
-rw-r--r--contrib/binutils/bfd/coffswap.h161
-rwxr-xr-xcontrib/binutils/bfd/config.bfd514
-rw-r--r--contrib/binutils/bfd/config.in378
-rwxr-xr-xcontrib/binutils/bfd/configure25102
-rw-r--r--contrib/binutils/bfd/configure.host8
-rw-r--r--contrib/binutils/bfd/configure.in298
-rw-r--r--contrib/binutils/bfd/corefile.c67
-rw-r--r--contrib/binutils/bfd/cpu-alpha.c7
-rw-r--r--contrib/binutils/bfd/cpu-arc.c7
-rw-r--r--contrib/binutils/bfd/cpu-arm.c128
-rw-r--r--contrib/binutils/bfd/cpu-cr16.c40
-rw-r--r--contrib/binutils/bfd/cpu-i386.c56
-rw-r--r--contrib/binutils/bfd/cpu-ia64-opc.c35
-rw-r--r--contrib/binutils/bfd/cpu-ia64.c6
-rw-r--r--contrib/binutils/bfd/cpu-mep.c28
-rw-r--r--contrib/binutils/bfd/cpu-mips.c4
-rw-r--r--contrib/binutils/bfd/cpu-powerpc.c20
-rw-r--r--contrib/binutils/bfd/cpu-rs6000.c12
-rw-r--r--contrib/binutils/bfd/cpu-s390.c8
-rw-r--r--contrib/binutils/bfd/cpu-score.c51
-rw-r--r--contrib/binutils/bfd/cpu-sparc.c6
-rw-r--r--contrib/binutils/bfd/cpu-spu.c54
-rw-r--r--contrib/binutils/bfd/demo64.c2
-rw-r--r--contrib/binutils/bfd/dep-in.sed1
-rw-r--r--contrib/binutils/bfd/doc/ChangeLog150
-rw-r--r--contrib/binutils/bfd/doc/Makefile.am227
-rw-r--r--contrib/binutils/bfd/doc/Makefile.in837
-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.texinfo67
-rw-r--r--contrib/binutils/bfd/doc/bfdint.texi52
-rw-r--r--contrib/binutils/bfd/doc/bfdio.texi41
-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.c46
-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/elf.texi24
-rw-r--r--contrib/binutils/bfd/doc/elfcode.texi0
-rw-r--r--contrib/binutils/bfd/doc/fdl.texi4
-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/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/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.c176
-rw-r--r--contrib/binutils/bfd/dwarf2.c1552
-rw-r--r--contrib/binutils/bfd/ecoff.c2610
-rw-r--r--contrib/binutils/bfd/ecofflink.c97
-rw-r--r--contrib/binutils/bfd/ecoffswap.h230
-rw-r--r--contrib/binutils/bfd/efi-app-ia32.c6
-rw-r--r--contrib/binutils/bfd/efi-app-ia64.c6
-rw-r--r--contrib/binutils/bfd/elf-attrs.c628
-rw-r--r--contrib/binutils/bfd/elf-bfd.h698
-rw-r--r--contrib/binutils/bfd/elf-eh-frame.c1390
-rw-r--r--contrib/binutils/bfd/elf-strtab.c14
-rw-r--r--contrib/binutils/bfd/elf-vxworks.c227
-rw-r--r--contrib/binutils/bfd/elf-vxworks.h35
-rw-r--r--contrib/binutils/bfd/elf.c4775
-rw-r--r--contrib/binutils/bfd/elf32-arc.c228
-rw-r--r--contrib/binutils/bfd/elf32-arm.c10446
-rw-r--r--contrib/binutils/bfd/elf32-arm.h4108
-rw-r--r--contrib/binutils/bfd/elf32-avr.h38
-rw-r--r--contrib/binutils/bfd/elf32-cr16.c1433
-rw-r--r--contrib/binutils/bfd/elf32-gen.c88
-rw-r--r--contrib/binutils/bfd/elf32-i386.c1251
-rw-r--r--contrib/binutils/bfd/elf32-mep.c959
-rw-r--r--contrib/binutils/bfd/elf32-mips.c785
-rw-r--r--contrib/binutils/bfd/elf32-ppc.c6251
-rw-r--r--contrib/binutils/bfd/elf32-ppc.h14
-rw-r--r--contrib/binutils/bfd/elf32-s390.c556
-rw-r--r--contrib/binutils/bfd/elf32-score.c3883
-rw-r--r--contrib/binutils/bfd/elf32-sh-relocs.h1716
-rw-r--r--contrib/binutils/bfd/elf32-sparc.c3420
-rw-r--r--contrib/binutils/bfd/elf32-spu.c3154
-rw-r--r--contrib/binutils/bfd/elf32-spu.h57
-rw-r--r--contrib/binutils/bfd/elf32.c2
-rw-r--r--contrib/binutils/bfd/elf64-alpha.c3887
-rw-r--r--contrib/binutils/bfd/elf64-gen.c88
-rw-r--r--contrib/binutils/bfd/elf64-mips.c714
-rw-r--r--contrib/binutils/bfd/elf64-ppc.c4822
-rw-r--r--contrib/binutils/bfd/elf64-ppc.h14
-rw-r--r--contrib/binutils/bfd/elf64-s390.c498
-rw-r--r--contrib/binutils/bfd/elf64-sparc.c2636
-rw-r--r--contrib/binutils/bfd/elf64-x86-64.c1487
-rw-r--r--contrib/binutils/bfd/elf64.c2
-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.h319
-rw-r--r--contrib/binutils/bfd/elfcore.h27
-rw-r--r--contrib/binutils/bfd/elflink.c4940
-rw-r--r--contrib/binutils/bfd/elflink.h8532
-rw-r--r--contrib/binutils/bfd/elfn32-mips.c697
-rw-r--r--contrib/binutils/bfd/elfxx-ia64.c1935
-rw-r--r--contrib/binutils/bfd/elfxx-mips.c4867
-rw-r--r--contrib/binutils/bfd/elfxx-mips.h41
-rw-r--r--contrib/binutils/bfd/elfxx-sparc.c4104
-rw-r--r--contrib/binutils/bfd/elfxx-sparc.h146
-rw-r--r--contrib/binutils/bfd/elfxx-target.h210
-rw-r--r--contrib/binutils/bfd/format.c40
-rw-r--r--contrib/binutils/bfd/freebsd.h94
-rw-r--r--contrib/binutils/bfd/gen-aout.c6
-rw-r--r--contrib/binutils/bfd/genlink.h38
-rw-r--r--contrib/binutils/bfd/hash.c358
-rw-r--r--contrib/binutils/bfd/host-aout.c6
-rw-r--r--contrib/binutils/bfd/i386aout.c97
-rw-r--r--contrib/binutils/bfd/i386bsd.c6
-rw-r--r--contrib/binutils/bfd/i386freebsd.c2
-rw-r--r--contrib/binutils/bfd/i386linux.c35
-rw-r--r--contrib/binutils/bfd/i386netbsd.c2
-rw-r--r--contrib/binutils/bfd/ieee.c1486
-rw-r--r--contrib/binutils/bfd/ihex.c280
-rw-r--r--contrib/binutils/bfd/init.c9
-rw-r--r--contrib/binutils/bfd/libaout.h448
-rw-r--r--contrib/binutils/bfd/libbfd-in.h145
-rw-r--r--contrib/binutils/bfd/libbfd.c221
-rw-r--r--contrib/binutils/bfd/libbfd.h577
-rw-r--r--contrib/binutils/bfd/libcoff-in.h228
-rw-r--r--contrib/binutils/bfd/libcoff.h318
-rw-r--r--contrib/binutils/bfd/libecoff.h157
-rw-r--r--contrib/binutils/bfd/libieee.h2
-rw-r--r--contrib/binutils/bfd/libpei.h130
-rw-r--r--contrib/binutils/bfd/libxcoff.h128
-rw-r--r--contrib/binutils/bfd/linker.c439
-rwxr-xr-xcontrib/binutils/bfd/mep-relocs.pl274
-rw-r--r--contrib/binutils/bfd/merge.c210
-rw-r--r--contrib/binutils/bfd/mipsbsd.c37
-rw-r--r--contrib/binutils/bfd/netbsd-core.c249
-rw-r--r--contrib/binutils/bfd/netbsd.h65
-rw-r--r--contrib/binutils/bfd/opncls.c520
-rw-r--r--contrib/binutils/bfd/osf-core.c32
-rw-r--r--contrib/binutils/bfd/pe-arm-wince.c37
-rw-r--r--contrib/binutils/bfd/pe-arm.c47
-rw-r--r--contrib/binutils/bfd/pe-i386.c30
-rw-r--r--contrib/binutils/bfd/pe-mips.c630
-rw-r--r--contrib/binutils/bfd/pe-ppc.c8
-rw-r--r--contrib/binutils/bfd/pe-x86_64.c53
-rw-r--r--contrib/binutils/bfd/peXXigen.c762
-rw-r--r--contrib/binutils/bfd/pei-arm-wince.c30
-rw-r--r--contrib/binutils/bfd/pei-mips.c6
-rw-r--r--contrib/binutils/bfd/pei-x86_64.c54
-rw-r--r--contrib/binutils/bfd/peicode.h440
-rw-r--r--contrib/binutils/bfd/po/BLD-POTFILES.in1
-rw-r--r--contrib/binutils/bfd/po/Make-in9
-rw-r--r--contrib/binutils/bfd/po/POTFILES.in255
-rw-r--r--contrib/binutils/bfd/po/SRC-POTFILES.in43
-rw-r--r--contrib/binutils/bfd/po/bfd.pot2897
-rw-r--r--contrib/binutils/bfd/ppcboot.c40
-rw-r--r--contrib/binutils/bfd/ptrace-core.c41
-rw-r--r--contrib/binutils/bfd/reloc.c1330
-rw-r--r--contrib/binutils/bfd/reloc16.c17
-rw-r--r--contrib/binutils/bfd/rs6000-core.c62
-rw-r--r--contrib/binutils/bfd/sco5-core.c40
-rw-r--r--contrib/binutils/bfd/section.c766
-rw-r--r--contrib/binutils/bfd/simple.c73
-rw-r--r--contrib/binutils/bfd/sparclinux.c63
-rw-r--r--contrib/binutils/bfd/sparcnetbsd.c2
-rw-r--r--contrib/binutils/bfd/srec.c443
-rw-r--r--contrib/binutils/bfd/stab-syms.c2
-rw-r--r--contrib/binutils/bfd/stabs.c339
-rw-r--r--contrib/binutils/bfd/sunos.c1141
-rw-r--r--contrib/binutils/bfd/syms.c57
-rw-r--r--contrib/binutils/bfd/sysdep.h61
-rw-r--r--contrib/binutils/bfd/targets.c196
-rw-r--r--contrib/binutils/bfd/tekhex.c801
-rw-r--r--contrib/binutils/bfd/trad-core.c64
-rw-r--r--contrib/binutils/bfd/version.h5
-rw-r--r--contrib/binutils/bfd/xcoff-target.h160
-rw-r--r--contrib/binutils/bfd/xcofflink.c3507
219 files changed, 107399 insertions, 68267 deletions
diff --git a/contrib/binutils/bfd/ChangeLog b/contrib/binutils/bfd/ChangeLog
index 04a27e1..e006595 100644
--- a/contrib/binutils/bfd/ChangeLog
+++ b/contrib/binutils/bfd/ChangeLog
@@ -1,1233 +1,1788 @@
-2004-05-17 Daniel Jacobowitz <dan@debian.org>
+2007-07-02 Joseph Myers <joseph@codesourcery.com>
- * configure.in: Mark unreleased for post-2.15 snapshots.
- * configure: Regenerate.
+ * elfxx-mips.c (mips_elf_calculate_relocation): Handle
+ R_MIPS_TLS_DTPREL32 and R_MIPS_TLS_DTPREL64.
+ * elf64-mips.c (mips_elf64_howto_table_rela): Support
+ R_MIPS_TLS_DTPREL64.
+
+2007-07-02 Alan Modra <amodra@bigpond.net.au>
+
+ * Makefile.am: Run "make dep-am".
+ * Makefile.in: Regenerate.
+ * aclocal.m4: Regenerate.
+ * config.in: Regenerate.
+ * po/SRC-POTFILES.in: Regenerate.
+ * po/bfd.pot: Regenerate.
+
+2007-07-02 Alan Modra <amodra@bigpond.net.au>
+
+ * elf-eh-frame.c (_bfd_elf_discard_section_eh_frame): Tidy
+ symsec != NULL tests.
+
+2007-07-02 Alan Modra <amodra@bigpond.net.au>
+
+ PR 4712
+ * elf.c (assign_file_positions_for_load_sections): Adjust lma
+ by p_vaddr_offset.
+
+2007-06-30 H.J. Lu <hongjiu.lu@intel.com>
+
+ * aclocal.m4: Regenerated.
+ * Makefile.in: Likewise.
+
+2007-06-29 Joseph Myers <joseph@codesourcery.com>
+
+ * elf32-ppc.c (ppc_elf_merge_obj_attributes): New.
+ (ppc_elf_merge_private_bfd_data): Call it.
+
+2007-06-29 Joseph Myers <joseph@codesourcery.com>
+
+ * elfxx-mips.c (mips_elf_merge_obj_attributes): New.
+ (_bfd_mips_elf_merge_private_bfd_data): Call it.
-2004-05-17 Daniel Jacobowitz <dan@debian.org>
+2007-06-29 Joseph Myers <joseph@codesourcery.com>
- * configure.in: Bump version to 2.15. Mark as released.
+ * elf-attrs.c: New.
+ * Makefile.am (BFD32_BACKENDS): Add elf-attrs.lo.
+ (BFD32_BACKENDS_CFILES): Add elf-attrs.c.
+ (elf-attrs.lo): Generate dependencies.
+ * Makefile.in: Regenerate.
+ * configure.in (elf): Add elf-attrs.lo.
+ * configure: Regenerate.
+ * elf-bfd.h (struct elf_backend_data): Add entries for object
+ attributes.
+ (NUM_KNOWN_OBJ_ATTRIBUTES, obj_attribute, obj_attribute_list,
+ OBJ_ATTR_PROC, OBJ_ATTR_GNU, OBJ_ATTR_FIRST, OBJ_ATTR_LAST,
+ Tag_NULL, Tag_File, Tag_Section, Tag_Symbol, Tag_compatibility):
+ New.
+ (struct elf_obj_tdata): Add entries for object attributes.
+ (elf_known_obj_attributes, elf_other_obj_attributes,
+ elf_known_obj_attributes_proc, elf_other_obj_attributes_proc):
+ New.
+ (bfd_elf_obj_attr_size, bfd_elf_set_obj_attr_contents,
+ bfd_elf_get_obj_attr_int, bfd_elf_add_obj_attr_int,
+ bfd_elf_add_proc_attr_int, bfd_elf_add_obj_attr_string,
+ bfd_elf_add_proc_attr_string, bfd_elf_add_obj_attr_compat,
+ bfd_elf_add_proc_attr_compat, _bfd_elf_attr_strdup,
+ _bfd_elf_copy_obj_attributes, _bfd_elf_obj_attrs_arg_type,
+ _bfd_elf_parse_attributes, _bfd_elf_merge_object_attributes): New.
+ * elf.c (_bfd_elf_copy_private_bfd_data): Copy object attributes.
+ (bfd_section_from_shdr): Handle attributes sections.
+ * elflink.c (bfd_elf_final_link): Handle attributes sections.
+ * elfxx-target.h (elf_backend_obj_attrs_vendor,
+ elf_backend_obj_attrs_section, elf_backend_obj_attrs_arg_type,
+ elf_backend_obj_attrs_section_type): New.
+ (elfNN_bed): Update.
+ * elf32-arm.c (NUM_KNOWN_ATTRIBUTES, aeabi_attribute,
+ aeabi_attribute_list): Remove.
+ (struct elf32_arm_obj_tdata): Remove object attributes fields.
+ (check_use_blx, bfd_elf32_arm_set_vfp11_fix, using_thumb2,
+ elf32_arm_copy_private_bfd_data, elf32_arm_merge_eabi_attributes):
+ Update for new object attributes interfaces.
+ (uleb128_size, is_default_attr, eabi_attr_size,
+ elf32_arm_eabi_attr_size, write_uleb128, write_eabi_attribute,
+ elf32_arm_set_eabi_attr_contents, elf32_arm_bfd_final_link,
+ elf32_arm_new_eabi_attr, elf32_arm_get_eabi_attr_int,
+ elf32_arm_add_eabi_attr_int, attr_strdup,
+ elf32_arm_add_eabi_attr_string, elf32_arm_add_eabi_attr_compat,
+ copy_eabi_attributes, elf32_arm_parse_attributes): Remove. Moved
+ to generic code in elf-attrs.c.
+ (elf32_arm_obj_attrs_arg_type): New.
+ (elf32_arm_fake_sections): Do not handle .ARM.attributes.
+ (elf32_arm_section_from_shdr): Do not handle SHT_ARM_ATTRIBUTES.
+ (bfd_elf32_bfd_final_link): Remove.
+ (elf_backend_obj_attrs_vendor, elf_backend_obj_attrs_section,
+ elf_backend_obj_attrs_arg_type,
+ elf_backend_obj_attrs_section_type): New.
+ * elf32-bfin.c (bfin_elf_copy_private_bfd_data): Copy object
+ attributes.
+ * elf32-frv.c (frv_elf_copy_private_bfd_data): Likewise.
+ * elf32-iq2000.c (iq2000_elf_copy_private_bfd_data): Likewise.
+ * elf32-mep.c (mep_elf_copy_private_bfd_data): Likewise.
+ * elf32-mt.c (mt_elf_copy_private_bfd_data): Likewise.
+ * elf32-sh.c (sh_elf_copy_private_data): Likewise.
+ * elf64-sh64.c (sh_elf64_copy_private_data_internal): Likewise.
+
+2007-06-29 Paul Brook <paul@codesourcery.com>
+
+ * elf32-arm.c (bfd_elf32_arm_process_before_allocation): Suppress
+ call veneers for call relocations against undefined symbols.
+ (elf32_arm_final_link_relocate): Turn call to undefined symbol
+ into a jump to the next instruction.
+
+2007-06-29 Michael Snyder <msnyder@svkmacdonelllnx>
+
+ * bfd.c (bfd_demangle): Plug memory leak (Coverity).
+
+2007-06-29 M R Swami Reddy <MR.Swami.Reddy@nsc.com>
+
+ * Makefile.am: Add cr16 related entry
+ * Makefile.in: Regenerate
+ * archures.c: Add bfd_cr16_arch
+ * bfd-in2.h: Regenerate
+ * config.bfd: Add cr16-elf
+ * configure.in: Add bfd_elf32_cr16_vec
* configure: Regenerate.
+ * targets.c: Added cr16 related information
+ * cpu-cr16.c: New file.
+ * elf32-cr16.c: New file.
+ * reloc.c: Added cr16 relocs.
+
+2007-06-29 Alan Modra <amodra@bigpond.net.au>
+
+ * elflink.c (_bfd_elf_link_assign_sym_version): Improve error
+ message for undefined version nodes.
+ (elf_gc_sweep): Don't warn when zero size sections are
+ removed.
+
+2007-06-29 Nathan Froyd <froydnj@codesourcery.com>
+
+ * elf32-ppc.c (ppc_elf_info_to_howto): Check for invalid relocation
+ types.
+
+2007-06-29 Alan Modra <amodra@bigpond.net.au>
+
+ * elf32-spu.c (spu_elf_fake_sections): New function.
+ (elf_backend_fake_sections): Define.
+
+2007-06-29 Alan Modra <amodra@bigpond.net.au>
+
+ * elf.c (assign_file_positions_for_load_sections): Use elf
+ section header sh_size rather than bfd section size, simplifying
+ .tbss handling.
+
+2007-06-29 Alan Modra <amodra@bigpond.net.au>
+
+ PR ld/4701
+ * elf.c (assign_file_positions_for_load_sections): Ensure bss
+ segments meet gABI alignment requirements. Don't allocate
+ file space for bss sections in a segment also containing file
+ or program headers.
+
+2007-06-27 Alan Modra <amodra@bigpond.net.au>
+
+ * bfd.c (struct bfd): Rename "next" to "archive_next".
+ * archive.c: Rename uses throughout file.
+ * archive64.c: Likewise.
+ * coff-rs6000.c: Likewise.
+ * ecoff.c: Likewise.
+ * som.c: Likewise.
+ * bfd-in2.h: Regenerate.
+
+ * elf32-ppc.c (ppc_elf_select_plt_layout): Properly iterate over
+ input bfds.
+ * elf32-spu.c (spu_elf_create_sections): Likewise.
+
+2007-06-26 H.J. Lu <hongjiu.lu@intel.com>
-2004-05-13 Joel Sherrill <joel@oarcorp.com>
+ * dwarf2.c (find_line): New. Contains the duplicated code from:
+ (_bfd_dwarf2_find_nearest_line): Use it.
+ (_bfd_dwarf2_find_line): Use it.
- * config.bfd (or32-*-rtems*): Switch to elf.
+2007-06-26 Joseph Myers <joseph@codesourcery.com>
-2004-05-13 Nick Clifton <nickc@redhat.com>
+ * elf32-arm.c (copy_eabi_attributes): Copy type of attributes.
- * po/fr.po: Updated French translation.
+2007-06-25 Richard Sandiford <richard@codesourcery.com>
-2004-05-07 Daniel Jacobowitz <dan@debian.org>
+ * elfxx-mips.c (mips_elf_calculate_relocation): Allow local stubs
+ to be used for calls from MIPS16 code.
- * configure.in: Bump version to 2.14.92.
+2007-06-23 Andreas Schwab <schwab@suse.de>
+
+ * configure.in (--with-separate-debug-dir): New option.
* configure: Regenerate.
+ * Makefile.am (dwarf2.lo): Add rule to pass DEBUGDIR.
+ * Makefile.in: Regenerate.
+ * dwarf2.c (_bfd_dwarf2_find_nearest_line): Pass DEBUGDIR to
+ bfd_follow_gnu_debuglink.
+ (_bfd_dwarf2_find_line): Likewise.
+
+2007-06-22 Nick Clifton <nickc@redhat.com>
+
+ * dwarf2.c: Add support for reading in debug information via a
+ .gnu_debuglink section:
+ (struct dwarf2_debug): Add bfd field to record the bfd containing
+ the debug info.
+ (parse_comp_unit): Remove ABFD parameter. Instead use the bfd
+ field in the dwarf2_debug structure.
+ (_bfd_dwarf2_find_nearest_line): If a debug info section could not
+ be found in the current bfd call bfd_follow_gnu_debuglink to see
+ if another file contains the debug information. If it does, open
+ it and continue.
+ (_bfd_dwarf2_find_line): Likewise.
+
+2007-06-19 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR ld/4590
+ * elfxx-ia64.c (sort_dyn_sym_info): Keep the valid got_offset
+ when removing duplicated entries.
+ (get_dyn_sym_info): Initialize the got_offset field to -1.
+ Update call to sort_dyn_sym_info.
+ (elfNN_ia64_relocate_section): Call sort_dyn_sym_info to sort
+ array of addend and remove duplicates.
+
+2007-06-18 H.J. Lu <hongjiu.lu@intel.com>
+
+ * libpei.h (_bfd_XXi_final_link_postscript): Remove
+ duplication.
+ (bfd_target_pei_p): New.
+ (bfd_target_pei_arch): New
+ (bfd_target_efi_p): Likewise.
+ (bfd_target_efi_arch): New
+ (bfd_pe_executable_p): Use bfd_target_pei_p and
+ bfd_target_efi_p.
+
+ * peicode.h (arch_type): New enum.
+ (pe_arch): New function.
+ (pe_bfd_object_p): Don't match PE/EFI target with EFI/PE file
+ if there is an EFI/PE target.
+
+2007-06-14 H.J. Lu <hongjiu.lu@intel.com>
+
+ * Makefile.am (ACLOCAL_AMFLAGS): Add -I . -I ../config.
+
+ * acinclude.m4: Don't include m4 files. Remove libtool
+ kludge.
+
+ * Makefile.in: Regenerated.
+ * aclocal.m4: Likewise.
+ * configure: Likewise.
+
+2007-06-11 Sterling Augustine <sterling@tensilica.com>
+ Bob Wilson <bob.wilson@acm.org>
+
+ * elf32-xtensa.c (extend_ebb_bounds_forward): Use renamed
+ XTENSA_PROP_NO_TRANSFORM flag instead of XTENSA_PROP_INSN_NO_TRANSFORM.
+ (extend_ebb_bounds_backward, compute_text_actions): Likewise.
+ (compute_ebb_proposed_actions, coalesce_shared_literal): Likewise.
+ (xtensa_get_property_predef_flags): Likewise.
+ (compute_removed_literals): Pass new arguments to is_removable_literal.
+ (is_removable_literal): Add sec, prop_table and ptblsize arguments.
+ Do not remove literal if the NO_TRANSFORM property flag is set.
+
+2007-05-31 Richard Sandiford <rsandifo@nildram.co.uk>
+
+ * elfxx-mips.c (mips_elf_initialize_tls_index): When processing a
+ type (3) single-GOT entry, read tls_type from the hash table entry
+ rather than the GOT entry.
+
+2007-06-01 Alan Modra <amodra@bigpond.net.au>
+
+ * simple.c (bfd_simple_get_relocated_section_contents): Init
+ input_bfds_tail.
+
+2007-05-30 Alan Modra <amodra@bigpond.net.au>
+
+ * elf.c (elf_fake_sections): Adjust test for SHT_NOBITS sections
+ created by objcopy --only-keep-debug.
+ (_bfd_elf_init_private_section_data): Only change elf_section_type
+ if it is SHT_NULL.
+
+ * elf.c (assign_file_positions_for_load_sections): Correct sh_type
+ to SHT_NOBITS earlier. Base actions in rest of function on sh_type
+ and sh_flags instead of bfd section flags. Delete voff and code
+ keeping nobits segments aligned.
+
+2007-05-25 Eric Christopher <echristo@apple.com>
+
+ * elf-eh-frame.c (_bfd_elf_discard_section_eh_frame):
+ Check that sym_sec isn't NULL before accessing.
-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.
+2007-05-24 Steve Ellcey <sje@cup.hp.com>
+
+ * Makefile.in: Regnerate.
* configure: Regenerate.
+ * aclocal.m4: Regenerate.
+ * doc/Makefile.in: Regenerate.
+
+2007-05-22 Paul Brook <paul@codesourcery.com>
+
+ * elf32-arm.c (output_arch_syminfo): Replace plt_shndx and plt_offset
+ with sec and sec_shndx.
+ (elf32_arm_ouput_plt_map_sym): Use them.
+ (elf32_arm_output_arch_local_syms): Output mapping symbols for
+ interworking glue.
+
+2007-05-18 Paul Brook <paul@codesourcery.com>
+
+ * elf32-arm.c (ARM2THUMB_V5_STATIC_GLUE_SIZE): Define.
+ (a2t1v5_ldr_insn, a2t1v5_ldr_insn): New.
+ (record_arm_to_thumb_glue): Add v5t non-pic glue.
+ (elf32_arm_create_thumb_stub): Ditto.
+
+2007-05-16 H.J. Lu <hongjiu.lu@intel.com>
+ Alan Modra <amodra@bigpond.net.au>
+
+ * elflink.c (_bfd_elf_adjust_dynamic_copy): Align dynamic bss
+ section to the minimum alignment.
+
+2007-05-15 H.J. Lu <hongjiu.lu@intel.com>
+ Alan Modra <amodra@bigpond.net.au>
+
+ PR ld/4504
+ * elf-bfd.h (_bfd_elf_adjust_dynamic_copy): New.
+ * elflink.c (_bfd_elf_adjust_dynamic_copy): New.
+
+ * elf-m10300.c (_bfd_mn10300_elf_adjust_dynamic_symbol): Call
+ _bfd_elf_adjust_dynamic_copy to adjust for the copy in dynamic
+ bss section.
+ * elf32-arm.c (elf32_arm_adjust_dynamic_symbol): Likewise.
+ * elf32-cris.c (elf_cris_adjust_dynamic_symbol): Likewise.
+ * elf32-hppa.c (elf32_hppa_adjust_dynamic_symbol): Likewise.
+ * elf32-i370.c (i370_elf_adjust_dynamic_symbol): Likewise.
+ * elf32-i386.c (elf_i386_adjust_dynamic_symbol): Likewise.
+ * elf32-m32r.c (m32r_elf_adjust_dynamic_symbol): Likewise.
+ * elf32-m68k.c (elf_m68k_adjust_dynamic_symbol): Likewise.
+ * elf32-ppc.c (ppc_elf_adjust_dynamic_symbol): Likewise.
+ * elf32-s390.c (elf_s390_adjust_dynamic_symbol): Likewise.
+ * elf32-sh.c (sh_elf_adjust_dynamic_symbol): Likewise.
+ * elf32-vax.c (elf_vax_adjust_dynamic_symbol): Likewise.
+ * elf64-ppc.c (ppc64_elf_adjust_dynamic_symbol): Likewise.
+ * elf64-s390.c (elf_s390_adjust_dynamic_symbol): Likewise.
+ * elf64-sh64.c (sh64_elf64_adjust_dynamic_symbol): Likewise.
+ * elf64-x86-64.c (elf64_x86_64_adjust_dynamic_symbol): Likewise.
+ * elfxx-mips.c (_bfd_mips_vxworks_adjust_dynamic_symbol): Likewise.
+ * elfxx-sparc.c (_bfd_sparc_elf_adjust_dynamic_symbol): Likewise.
+
+2007-05-15 Richard Sandiford <richard@codesourcery.com>
+
+ * elfxx-mips.c (mips_elf_create_local_got_entry): Remove
+ input_section argument. Create .rela.dyn relocations against
+ symbol 0 rather than the section symbol.
+ (mips_elf_local_got_index): Remove input_section argument.
+ Update call to mips_elf_create_local_got_entry.
+ (mips_elf_got_page, mips_elf_got16_entry): Likewise.
+ (mips_elf_calculate_relocation): Update calls to
+ mips_elf_local_got_index, mips_elf_got16_entry and mips_elf_got_page.
+
+2007-05-15 Mark Shinwell <shinwell@codesourcery.com>
+
+ * elf32-arm.c (elf32_arm_final_link_relocate): Correctly
+ handle the Thumb-2 JUMP19 relocation.
+
+2007-05-15 Alan Modra <amodra@bigpond.net.au>
+
+ PR 4479
+ * elf.c (elf_fake_sections): Don't allow backend to change
+ SHT_NOBITS if called for strip/objcopy --only-keep-debug.
+ * elfxx-mips.c (_bfd_mips_elf_fake_sections): Remove similar
+ fix from here.
+
+2007-05-14 Alan Modra <amodra@bigpond.net.au>
+
+ * elf.c (bfd_elf_string_from_elf_section): Return NULL on
+ invalid shstrndx.
+ (bfd_elf_get_str_section): Likewise.
+
+2007-05-12 Alan Modra <amodra@bigpond.net.au>
+
+ PR 4497
+ * elf-eh-frame.c (struct cie): Add "local_personality". Make
+ "personality" a union.
+ (cie_eq): Compare local_personality too. Adjust personality
+ comparison.
+ (_bfd_elf_discard_section_eh_frame): Check binding on personality
+ reloc sym to allow for bad symtab. Use stashed local syms rather
+ than reading personality local sym. Handle discarded sections.
+
+2007-05-12 Alan Modra <amodra@bigpond.net.au>
+
+ * elf32-spu.c (elf_howto_table): Add howto for R_SPU_ADDR16X.
+
+2007-05-11 Alan Modra <amodra@bigpond.net.au>
+
+ * elf32-ppc.h (ppc_elf_select_plt_layout): Update prototype.
+ (enum ppc_elf_plt_type): Move from..
+ * elf32-ppc.c: ..here.
+ (struct ppc_elf_obj_tdata): Add makes_plt_call and has_rel16.
+ (struct ppc_elf_link_hash_table): Reorder. Add old_bfd. Delete
+ can_use_new_plt. Make is_vxworks a bitfield.
+ (ppc_elf_link_hash_table_create): Don't clear is_vxworks (again).
+ (ppc_elf_check_relocs): Update setting of reloc flags. Set old_bfd.
+ (ppc_elf_select_plt_layout): Modify parameters. Use bfd reloc
+ flags to better detect object files needing old bss-style plt.
+ Allow secure plt to be used without rel16 relocs being detected.
+ Warn if secure plt request cannot be allowed.
+
+2007-05-11 Alan Modra <amodra@bigpond.net.au>
+
+ * reloc.c (BFD_RELOC_SPU_PPU32, BFD_RELOC_SPU_PPU64): Define.
+ * elf-bfd.h (struct elf_backend_data): Change return type of
+ elf_backend_relocate_section to int.
+ * elf32-spu.c (elf_howto_table): Add howtos for R_SPU_PPU32 and
+ R_SPU_PPU64.
+ (spu_elf_bfd_to_reloc_type): Convert new relocs.
+ (spu_elf_count_relocs): New function.
+ (elf_backend_count_relocs): Define.
+ (spu_elf_relocate_section): Arrange to emit R_SPU_PPU32 and
+ R_SPU_PPU64 relocs.
+ * elflink.c (elf_link_input_bfd): Emit relocs if relocate_section
+ returns 2.
+ * bfd-in2.h: Regenerate.
+ * libbfd.h: Regenerate.
-2004-04-09 Daniel Jacobowitz <drow@mvista.com>
+2007-05-10 Richard Sandiford <richard@codesourcery.com>
- * configure.in: Update version to 2.14.91.
- * configure: Likewise.
+ * elf32-arm.c (elf32_arm_check_relocs): Don't create PLT entries
+ for R_ARM_ABS12 relocs.
+ (elf32_arm_finish_dynamic_symbol): Fix the loop that creates
+ non-shared VxWorks PLT entries.
+
+2007-05-11 Alan Modra <amodra@bigpond.net.au>
+
+ PR 4454
+ * elf-eh-frame.c (struct cie): Make "personality" a bfd_vma.
+ (_bfd_elf_discard_section_eh_frame): Handle local syms on
+ personality relocation.
+
+2007-05-10 Richard Sandiford <richard@codesourcery.com>
+
+ * elf.c (assign_file_positions_for_load_sections): Use p_memsz
+ rather than p_filesz to calculate the LMA of the end of a segment.
+
+2007-05-10 Jakub Jelinek <jakub@redhat.com>
+
+ * elf64-ppc.c (ppc64_elf_adjust_dynamic_symbol): Don't do copyreloc
+ processing if symbol is defined in the executable.
+
+2007-05-10 Alexandre Oliva <aoliva@redhat.com>
+
+ * elf32-frv.c (_frvfdpic_check_discarded_relocs): New.
+ (frvfdpic_elf_discard_info): New.
+ (elf_backend_discard_info): Define for FDPIC.
+
+2007-05-09 Mark Shinwell <shinwell@codesourcery.com>
+
+ * elf32-arm.c (bfd_elf32_arm_vfp11_erratum_scan): Don't
+ attempt to scan if the bfd doesn't correspond to an ELF image.
+ (bfd_elf32_arm_vfp11_fix_veneer_locations): Likewise.
+
+2007-05-08 Alexandre Oliva <aoliva@redhat.com>
+
+ * elf32-frv.c (elf32_frv_relocate_section): Discard dynamic relocs
+ for which _bfd_elf_section_offset returns -1.
-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.
+2007-05-08 Alan Modra <amodra@bigpond.net.au>
+
+ * elf32-spu.c (spu_elf_size_stubs): Use "void *" for psyms.
+ (mark_functions_via_relocs): Likewise.
+
+2007-05-07 Alan Modra <amodra@bigpond.net.au>
+
+ * elflink.c (bfd_elf_final_link): Correct reloc handling for
+ elf_backend_count_relocs.
+ (bfd_elf_discard_info): Print an error if we can't read syms.
+
+2007-05-07 Alan Modra <amodra@bigpond.net.au>
+
+ * elf32-spu.c (spu_elf_reloc_type_lookup): Return NULL on
+ invalid reloc code.
+ (spu_elf_gc_mark_hook, spu_elf_section_processing): Delete functions.
+ (elf_backend_gc_mark_hook, elf_backend_section_processing): Don't
+ define.
+
+2007-05-07 Alan Modra <amodra@bigpond.net.au>
+
+ * elf.c (assign_file_positions_for_load_sections): Don't check
+ core segment.
+
+2007-05-04 H.J. Lu <hongjiu.lu@intel.com>
+
+ * elflink.c (elf_link_sort_relocs): Return if both .rela.dyn
+ and .rel.dyn aren't present.
+
+2007-05-04 Nick Clifton <nickc@redhat.com>
+
+ * elflink.c (elf_link_sort_relocs): If both .rela.dyn and .rel.dyn
+ sections are present examine the indirect sections in an attempt
+ to compute the correct relocation size. If there is any
+ ambiguity, produce an error and refuse to sort.
+
+2007-05-03 Sandra Loosemore <sandra@codesourcery.com>
+
+ * elf32-arm.c (allocate_dynrelocs): Fix typo in comment.
+
+2007-05-03 Vincent Riviere <vincent.riviere@freesbee.fr>
+ Nick Clifton <nickc@redhat.com>
+
+ PR gas/3041
+ * aoutx.h (swap_std_reloc_out): Treat relocs against weak symbols
+ in the same way as relocs against external symbols.
+
+2007-05-02 Alan Modra <amodra@bigpond.net.au>
+
+ * elf.c (assign_file_positions_for_load_sections): Set sh_offset
+ here. Set sh_type to SHT_NOBITS if we won't be allocating
+ file space. Don't bump p_memsz for non-alloc sections. Adjust
+ section-in-segment check.
+ (assign_file_positions_for_non_load_sections): Don't set sh_offset
+ here for sections that have already been handled above.
+
+2007-04-30 Alan Modra <amodra@bigpond.net.au>
+
+ * elf32-spu.c (struct spu_link_hash_table): Add stack_analysis
+ and emit_stack_syms bitfields.
+ (get_sym_h): Read all symbols if stack analysis will be done.
+ (spu_elf_create_sections): Add stack_analysis and emit_stack_syms
+ params, and stash in hash table.
+ (is_hint): Split off from..
+ (is_branch): ..here. Adjust callers.
+ (spu_elf_size_stubs): Add stack_analysis param. Arrange to read
+ and keep all syms.
+ (write_one_stub): Fix mem leak.
+ (find_function_stack_adjust): New function.
+ (sort_syms_syms, sort_syms_psecs): New vars.
+ (sort_syms): New function.
+ (struct call_info, struct function_info): New.
+ (struct spu_elf_stack_info): New.
+ (alloc_stack_info, maybe_insert_function, func_name): New functions.
+ (is_nop, insns_at_end, check_function_ranges): Likewise.
+ (find_function, insert_callee, mark_functions_via_relocs): Likewise.
+ (pasted_function, interesting_section, discover_functions): Likewise.
+ (mark_non_root, call_graph_traverse, build_call_tree): Likewise.
+ (sum_stack, spu_elf_stack_analysis, spu_elf_final_link): Likewise.
+ (bfd_elf32_bfd_final_link): Define.
+ * elf32-spu.h (struct _spu_elf_section_data): Add stack_info field.
+ (spu_elf_create_sections, spu_elf_size_stubs): Update prototypes.
+
+2007-04-28 Sergey Rogozhkin <rogozhkin@niisi.msk.ru>
+
+ * elfxx-mips.c (mips_elf_create_dynamic_relocation): Don't access
+ memory which we might not own.
+
+2007-04-27 Bob Wilson <bob.wilson@acm.org>
+
+ * elf32-xtensa.c (elf_xtensa_make_sym_local): Restore deleted function.
+ (elf_xtensa_hide_symbol, elf_backend_hide_symbol): Likewise.
+ (elf_xtensa_allocate_dynrelocs): Use elf_xtensa_make_sym_local.
+
+2007-04-27 Bob Wilson <bob.wilson@acm.org>
+
+ * elf32-xtensa.c (xtensa_read_table_entries): Step through table
+ contents and relocs in parallel.
+
+2007-04-27 Bob Wilson <bob.wilson@acm.org>
+
+ * elf32-xtensa.c (relax_property_section): Remove extra irel increment.
+
+2007-04-27 Alan Modra <amodra@bigpond.net.au>
+
+ * cpu-rs6000.c: Write Mimi's name in ASCII.
+ * coff-rs6000.c: Likewise.
+ * rs6000-core.c: Likewise.
+
+2007-04-27 Alan Modra <amodra@bigpond.net.au>
+
+ * sysdep.h: Include config.h first.
+ Many files: Include sysdep.h before bfd.h.
+ * Makefile.am: Run "make dep-am".
* Makefile.in: Regenerate.
-2004-04-08 Alan Modra <amodra@bigpond.net.au>
+2007-04-25 Alan Modra <amodra@bigpond.net.au>
+
+ * sysdep.h: Revert last change.
+
+2007-04-24 Nick Clifton <nickc@redhat.com>
+
+ * coffcode.h (coff_slurp_reloc_table): Initialise dst.r_offset.
+ * coff-m68k.c (m68kcoff_rtype_to_howto): Initialize relent.howto.
+
+2007-04-24 Alan Modra <amodra@bigpond.net.au>
+
+ * elf-eh-frame.c (_bfd_elf_discard_section_eh_frame): Warn if
+ eh_frame_hdr table won't be created.
+
+2007-04-24 Alan Modra <amodra@bigpond.net.au>
+
+ * acinclude.m4: Include config/stdint.m4.
+ * configure.in: Invoke GCC_HEADER_STDINT.
+ * sysdep.h: Don't include ansidecl.h here.
+ * configure: Regenerate.
+ * config.in: Regenerate.
+ * Makefile.in: Regenerate.
+
+2007-04-23 Nathan Sidwell <nathan@codesourcery.com>
+
+ * archures.c (bfd_mach_mcf_isa_c, bfd_mach_mcf_isa_c_mac,
+ bfd_mach_mcf_isa_c_emac): New.
+ * elf32-m68k.c (ISAC_PLT_ENTRY_SIZE, elf_isac_plt0_entry,
+ elf_isac_plt_entry, elf_isac_plt_info): New.
+ (elf32_m68k_object_p): Add ISA_C.
+ (elf32_m68k_print_private_bfd_data): Print ISA_C.
+ (elf32_m68k_get_plt_info): Detect ISA_C.
+ * cpu-m68k.c (arch_info): Add ISAC.
+ (m68k_arch_features): Likewise,
+ (bfd_m68k_compatible): ISAs B & C are not compatible.
+
+2007-04-21 Nick Clifton <nickc@redhat.com>
+
+ * ecoff.c (_bfd_ecoff_write_armap): Initialise rehash.
+ (ecoff_link_add_archive_symbols): Likewise.
+ * coff-m68k.c (m68kcoff_common_addend_rtype_to_howto): Initialise
+ relent.howto.
+ * ieee.c (parse_int): Initialise x.
+ (must_parse_int): Initialise result.
+ (ieee_slurp_external_symbols): Initialise value.
+
+2007-04-21 Alan Modra <amodra@bigpond.net.au>
+
+ * config.bfd (spu-*-elf): Delete targ_selvecs.
+
+2007-04-19 Nick Clifton <nickc@redhat.com>
+
+ * coffcode.h (coff_rtype_to_howto): Initialise genrel.howto.
- Apply from mainline.
- 2004-03-30 Jakub Jelinek <jakub@redhat.com>
- * elf.c (map_sections_to_segments): Fix handling of .tbss.
+2007-04-19 Alan Modra <amodra@bigpond.net.au>
- 2004-03-27 Alan Modra <amodra@bigpond.net.au>
- * Makefile.am: Remove all mention of elflink.h.
+ * bfd.c (bfd_demangle): New function.
+ * Makefile.am: Run "make dep-am".
* 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.
+
+2007-04-18 Matthias Klose <doko@ubuntu.com>
+
+ * Makefile.am (libbfd_la_LDFLAGS): Use bfd soversion.
+ (bfdver.h): Use the date in non-release builds for the soversion.
+ * Makefile.in: Regenerate.
+
+2007-04-17 Paul Brook <paul@codesourcery.com>
+
+ * elf.c (_bfd_elf_is_function_type): New function.
+ * elflink.c (_bfd_elf_merge_symbol): Use bed->is_function_type.
+ (_bfd_elf_dynamic_symbol_p, _bfd_elf_symbol_refs_local_p,
+ is_global_data_symbol_definition, elf_link_add_object_symbols): Ditto.
+ * elf-bfd.h (elf_backend_data): Add is_function_type.
+ (_bfd_elf_is_function_type): Add prototype.
+ * elfxx-target.h (elf_backend_is_function_type): Add default
+ definition.
+ (elfNN_bed): Add elf_backend_is_function_type.
+ * elf32-arm.c (elf32_arm_is_function_type): New function.
+ (elf_backend_is_function_type): Define.
+
+2007-04-17 Daniel Jacobowitz <dan@codesourcery.com>
+
+ * elfxx-mips.c (_bfd_mips_elf_size_dynamic_sections): Put
+ DT_MIPS_RLD_MAP before DT_DEBUG again.
+
+2007-04-14 Steve Ellcey <sje@cup.hp.com>
+
+ * Makefile.am: Add ACLOCAL_AMFLAGS.
+ * configure.in: Change macro call order.
+ * Makefile.in: Regnerate.
+ * doc/Makefile.in: Regenerate.
+ * configure: Regenerate.
+
+2007-04-14 Jakub Jelinek <jakub@redhat.com>
+
+ * elflink.c (bfd_elf_final_link): Don't free symbuf for
+ non-elf input bfds.
+ (bfd_elf_size_dynamic_sections): Don't access elf_section_data
+ for non-elf input bfds.
+
+2007-04-12 Richard Sandiford <richard@codesourcery.com>
+
+ * elfxx-mips.c (_bfd_mips_elf_size_dynamic_sections): Don't add
+ DT_MIPS_RTLD_MAP for PIEs.
+
+2007-04-12 Richard Sandiford <richard@codesourcery.com>
+
+ * elfxx-mips.c (mips_elf_calculate_relocation): Set DT_TEXTREL
+ when creating a __GOTT_BASE__ or __GOTT_INDEX__ relocation
+ in a read-only section.
+ (_bfd_mips_elf_check_relocs): Likewise.
+
+2007-04-12 Bob Wilson <bob.wilson@acm.org>
+
+ * elf32-xtensa.c (xtensa_is_insntable_section): New.
+ (xtensa_is_proptable_section): New.
+ (elf_xtensa_discard_info_for_section): Handle "full" .xt.prop property
+ tables with 12-byte entries, as well as tables with 8-byte entries.
+ Sort the relocations before examining them.
+ (relax_property_section): Use xtensa_is_proptable_section and
+ xtensa_is_littable_section. Rewrite code for combining table entries
+ to be more robust in case of unexpected relocations. Do not set offset
+ of unused relocations to less than zero.
+ (xtensa_is_property_section): Use other functions instead of
+ duplicating section name comparisons.
+ (xtensa_is_littable_section): Use CONST_STRNEQ for ".gnu.linkonce.p.".
+ (xtensa_get_property_predef_flags): Use xtensa_is_insntable_section.
+
+2007-04-12 Bob Wilson <bob.wilson@acm.org>
+
+ * elf32-xtensa.c (elf_xtensa_gc_mark_hook): Don't follow references
+ from Xtensa property sections.
+
+2007-04-12 Alan Modra <amodra@bigpond.net.au>
+
+ * elf32-spu.c (needs_ovl_stub): Test that spu_elf_section_data
+ is non-NULL before dereferencing.
+
+2007-04-11 Nathan Sidwell <nathan@codesourcery.com>
+
+ * elf-vxworks.c (elf_vxworks_emit_relocs): Remap weakdef PLT slot
+ relocs too.
+
+2007-04-10 Richard Henderson <rth@redhat.com>
+
+ * elf64-alpha.c (struct alpha_elf_link_hash_table): Add relax_trip.
+ (elf64_alpha_size_got_sections): Remove unused something_changed local.
+ (elf64_alpha_size_plt_section): Return void.
+ (elf64_alpha_size_rela_got_section): Likewise.
+ (elf64_alpha_relax_section): Only regenerate got+plt if the
+ relax_trip counter has changed.
+
+2007-04-09 Daniel Jacobowitz <dan@codesourcery.com>
+
+ * Makefile.am (bfdver.h): Do not generate doc/bfdver.texi.
+ * doc/Makefile.am (DOCFILES): Add bfdver.texi.
+ (bfdver.texi): New rule.
+ * Makefile.in, doc/Makefile.in: Regenerated.
+
+2007-04-03 Matt Thomas <matt@netbsd.org>
+
+ * elf32-vax.c (elf_vax_relocate_section): Do not emit a PCREL reloc
+ in a shared object if it is not in a CODE section or if it is against
+ a section symbol. This allows DWARF2 to use pcrel format.
+
+2007-04-05 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR ld/4304
+ * elflink.c (bfd_elf_final_link): Call einfo callback in
+ bfd_link_info instead of _bfd_error_handler for DT_TEXTREL
+ warning.
+
+2007-04-05 Alan Modra <amodra@bigpond.net.au>
+
+ * elf32-spu.c (spu_elf_output_symbol_hook): New function.
+ (elf_backend_link_output_symbol_hook): Define.
+
+2007-04-02 Nick Clifton <nickc@redhat.com>
+
+ PR binutils/4292
+ * bfd.c (bfd_fprintf_vma): Do not print addresses of 32-bit
+ targets as 64-bit values, even if running on a 64-bit host.
+ * coffgen.c (coff_print_symbol): Likewise.
+
+2007-03-29 Nick Clifton <nickc@redhat.com>
+
+ PR binutils/4110
+ * elf.c (IS_VALID_GROUP_SECTION_HEADER): New macro.
+ (setup_group): Use it. Report corrupt group section headers.
+ (bfd_section_from_shdr): Use new macro. Replace constant 4 with
+ GRP_ENTRY_SIZE. Cope with NULLs in the group section table.
+ (elf_fake_section): Replace constant 4 with GRP_ENTRY_SIZE.
+
+2007-03-29 Alan Modra <amodra@bigpond.net.au>
+
+ PR ld/4267
+ * elflink.c (evaluate_complex_relocation_symbols): Use bfd_vma
+ for rel->r_info values.
+ (bfd_elf_perform_complex_relocation): Likewise.
+ * elf32-ppc.c (allocate_dynrelocs): Set plt.offset to -1 for
+ unused entries. Don't clear plt.plist in loop.
+
+2007-03-28 Richard Sandiford <richard@codesourcery.com>
+
+ * elfxx-sparc.h (_bfd_sparc_elf_link_hash_table): Remove append_rela.
+ * elfxx-sparc.c (sparc_elf_append_rela_64, sparc_elf_append_rela_32):
+ Merge into...
+ (sparc_elf_append_rela): ...this new function.
+ (SPARC_ELF_APPEND_RELA): Delete.
+ (_bfd_sparc_elf_link_hash_table_create): Don't initialize
+ the deleted append_rela field.
+ (_bfd_sparc_elf_relocate_section): Use sparc_elf_append_rela
+ instead of SPARC_ELF_APPEND_RELA.
+ (_bfd_sparc_elf_finish_dynamic_symbol): Likewise. Use the
+ elf_size_info structure to find the size of a RELA entry and
+ the associated swap-out function.
+ (sparc64_finish_dyn, sparc64_finish_dyn): Merge into...
+ (sparc_finish_dyn): ...this new function.
+ (_bfd_sparc_elf_finish_dynamic_sections): Update calls accordingly.
+
+2007-03-28 Richard Sandiford <richard@codesourcery.com>
+ Phil Edwards <phil@codesourcery.com>
+
+ * doc/bfd.texinfo: Put the contents after the title page rather
+ than at the end of the document.
+
+2007-03-27 Andreas Schwab <schwab@suse.de>
+
+ * elfxx-ia64.c (elf_backend_default_execstack): Define to 0.
+
+2007-03-26 H.J. Lu <hongjiu.lu@intel.com>
+
+ * configure: Regenerated.
+
+2007-03-26 Alan Modra <amodra@bigpond.net.au>
+
+ * elf32-spu.c (struct stubarr): Add stub_hash_table and err fields.
+ (allocate_spuear_stubs): New function.
+ (spu_elf_size_stubs): Call allocate_spuear_stubs.
+
+2007-03-26 Alan Modra <amodra@bigpond.net.au>
+
+ * aout-adobe.c (aout_32_bfd_reloc_name_lookup): Define.
+ * aout-arm.c (MY_bfd_reloc_name_lookup): Define.
+ (MY (bfd_reloc_name_lookup)): New function.
+ * aout-ns32k.c (MY (bfd_reloc_name_lookup)): New function.
+ * aout-target.h (NAME (aout, reloc_name_lookup)): Declare.
+ (MY_bfd_reloc_name_lookup): Define.
+ * aout-tic30.c (tic30_aout_reloc_name_lookup): New function.
+ (MY_bfd_reloc_name_lookup): Define.
+ * aoutx.h (NAME (aout, reloc_type_lookup)): Don't declare.
+ (NAME (aout, reloc_name_lookup)): New function.
+ * bout.c (b_out_bfd_reloc_name_lookup): New function.
+ * coff-alpha.c (alpha_bfd_reloc_name_lookup): New function.
+ (_bfd_ecoff_bfd_reloc_name_lookup): Define.
+ * coff-arm.c (coff_arm_reloc_name_lookup): New function.
+ (coff_bfd_reloc_name_lookup): Define.
+ * coff-i386.c (coff_bfd_reloc_name_lookup): Define.
+ (coff_i386_reloc_name_lookup): New function.
+ * coff-i860.c (coff_i860_reloc_name_lookup): New function.
+ (coff_bfd_reloc_name_lookup): Define.
+ * coff-i960.c (coff_i960_reloc_name_lookup): New function.
+ (coff_bfd_reloc_name_lookup): Define.
+ * coff-m68k.c (m68k_reloc_name_lookup): New function.
+ (coff_bfd_reloc_name_lookup): Define.
+ * coff-maxq.c (maxq_reloc_name_lookup): New function.
+ (coff_bfd_reloc_name_lookup): Define.
+ * coff-mcore.c (mcore_coff_reloc_name_lookup): New function.
+ (coff_bfd_reloc_name_lookup): Define.
+ * coff-mips.c (mips_bfd_reloc_name_lookup): New function.
+ (_bfd_ecoff_bfd_reloc_name_lookup): Define.
+ * coff-ppc.c (ppc_coff_reloc_name_lookup): New function.
+ (coff_bfd_reloc_name_lookup): Define.
+ * coff-rs6000.c (coff_bfd_reloc_name_lookup): Define.
+ (_bfd_xcoff_reloc_name_lookup): New function.
+ (rs6000coff_vec, pmac_xcoff_vec): Init new field.
+ * coff-sh.c (coff_bfd_reloc_name_lookup): Define.
+ (sh_coff_reloc_name_lookup): New function.
+ * coff-sparc.c (coff_sparc_reloc_name_lookup): New function.
+ (coff_bfd_reloc_name_lookup): Define.
+ * coff-tic30.c (coff_bfd_reloc_name_lookup): Define.
+ (tic30_coff_reloc_name_lookup): New function.
+ * coff-tic4x.c (coff_bfd_reloc_name_lookup): Define.
+ (tic4x_coff_reloc_name_lookup): New function.
+ * coff-tic54x.c (coff_bfd_reloc_name_lookup): Define.
+ (tic54x_coff_reloc_name_lookup): New function.
+ * coff-x86_64.c (coff_bfd_reloc_name_lookup): Define.
+ (coff_amd64_reloc_name_lookup): New function.
+ * coff-z80.c (coff_z80_reloc_name_lookup): New function.
+ (coff_bfd_reloc_name_lookup): Define.
+ * coff-z8k.c (coff_z8k_reloc_name_lookup): New function.
+ (coff_bfd_reloc_name_lookup): Define.
+ * coff64-rs6000.c (coff_bfd_reloc_name_lookup): Define.
+ (xcoff64_reloc_name_lookup): New function.
+ (rs6000coff64_vec, aix5coff64_vec): Init new field.
+ * coffcode.h (coff_bfd_reloc_name_lookup): Define.
+ * elf-hppa.h (elf_hppa_reloc_name_lookup): New function.
+ * elf-m10200.c (bfd_elf32_bfd_reloc_name_lookup): New function.
+ * elf-m10300.c (bfd_elf32_bfd_reloc_name_lookup): New function.
+ * elf32-arc.c (bfd_elf32_bfd_reloc_name_lookup): New function.
+ * elf32-arm.c (elf32_arm_reloc_name_lookup): New function.
+ (bfd_elf32_bfd_reloc_name_lookup): Define.
+ * elf32-avr.c (bfd_elf32_bfd_reloc_name_lookup): New function.
+ * elf32-bfin.c (bfin_bfd_reloc_name_lookup): New function.
+ (bfd_elf32_bfd_reloc_name_lookup): Define.
+ * elf32-cr16c.c (elf_cr16c_reloc_name_lookup): New function.
+ (bfd_elf32_bfd_reloc_name_lookup): Define.
+ * elf32-cris.c (cris_reloc_name_lookup): New function.
+ (bfd_elf32_bfd_reloc_name_lookup): Define.
+ * elf32-crx.c (elf_crx_reloc_name_lookup): New function.
+ (bfd_elf32_bfd_reloc_name_lookup): Define.
+ * elf32-d10v.c (bfd_elf32_bfd_reloc_name_lookup): New function.
+ * elf32-d30v.c (bfd_elf32_bfd_reloc_name_lookup): New function.
+ * elf32-dlx.c (elf32_dlx_reloc_name_lookup): New function.
+ (bfd_elf32_bfd_reloc_name_lookup): Define.
+ * elf32-fr30.c (fr30_reloc_name_lookup): New function.
+ (bfd_elf32_bfd_reloc_name_lookup): Define.
+ * elf32-frv.c (frv_reloc_name_lookup): New function.
+ (bfd_elf32_bfd_reloc_name_lookup): Define.
+ * elf32-gen.c (bfd_elf32_bfd_reloc_name_lookup): Define.
+ * elf32-h8300.c (elf32_h8_reloc_name_lookup): New function.
+ (bfd_elf32_bfd_reloc_name_lookup): Define.
+ * elf32-hppa.c (bfd_elf32_bfd_reloc_name_lookup): Define.
+ * elf32-i370.c (i370_elf_reloc_name_lookup): New function.
+ (bfd_elf32_bfd_reloc_name_lookup): Define.
+ * elf32-i386.c (elf_i386_reloc_name_lookup): New function.
+ (bfd_elf32_bfd_reloc_name_lookup): Define.
+ * elf32-i860.c (elf32_i860_reloc_name_lookup): New function.
+ (bfd_elf32_bfd_reloc_name_lookup): Define.
+ * elf32-i960.c (elf32_i960_reloc_name_lookup): New function.
+ (bfd_elf32_bfd_reloc_name_lookup): Define.
+ * elf32-ip2k.c (ip2k_reloc_name_lookup): New function.
+ (bfd_elf32_bfd_reloc_name_lookup): Define.
+ * elf32-iq2000.c (iq2000_reloc_name_lookup): New function.
+ (bfd_elf32_bfd_reloc_name_lookup): Define.
+ * elf32-m32c.c (m32c_reloc_name_lookup): New function.
+ (bfd_elf32_bfd_reloc_name_lookup): Define.
+ * elf32-m32r.c (bfd_elf32_bfd_reloc_name_lookup): New function.
+ * elf32-m68hc11.c (bfd_elf32_bfd_reloc_name_lookup): New function.
+ * elf32-m68hc12.c (bfd_elf32_bfd_reloc_name_lookup): New function.
+ * elf32-m68k.c (reloc_name_lookup): New function.
+ (bfd_elf32_bfd_reloc_name_lookup): Define.
+ * elf32-m88k.c (bfd_elf32_bfd_reloc_name_lookup): Define.
+ * elf32-mcore.c (mcore_elf_reloc_name_lookup): New function.
+ (bfd_elf32_bfd_reloc_name_lookup): Define.
+ * elf32-mep.c (mep_reloc_name_lookup): New function.
+ (bfd_elf32_bfd_reloc_name_lookup): Define.
+ * elf32-mips.c (bfd_elf32_bfd_reloc_name_lookup): New function.
+ (mips_vxworks_bfd_reloc_name_lookup): Likewise.
+ (bfd_elf32_bfd_reloc_name_lookup): Define.
+ * elf32-msp430.c (bfd_elf32_bfd_reloc_name_lookup): New function.
+ * elf32-mt.c (mt_reloc_name_lookup): New function.
+ (bfd_elf32_bfd_reloc_name_lookup): Define.
+ * elf32-openrisc.c (openrisc_reloc_name_lookup): New function.
+ (bfd_elf32_bfd_reloc_name_lookup): Define.
+ * elf32-or32.c (bfd_elf32_bfd_reloc_name_lookup): New function.
+ * elf32-pj.c (pj_elf_reloc_name_lookup): New function.
+ (bfd_elf32_bfd_reloc_name_lookup): Define.
+ * elf32-ppc.c (ppc_elf_reloc_name_lookup): New function.
+ (bfd_elf32_bfd_reloc_name_lookup): Define.
+ * elf32-s390.c (elf_s390_reloc_name_lookup): New function.
+ (bfd_elf32_bfd_reloc_name_lookup): Define.
+ * elf32-score.c (elf32_score_reloc_name_lookup): New function.
+ (bfd_elf32_bfd_reloc_name_lookup): Define.
+ * elf32-sh.c (sh_elf_reloc_name_lookup): New function.
+ (bfd_elf32_bfd_reloc_name_lookup): Define.
+ * elf32-sparc.c (bfd_elf32_bfd_reloc_name_lookup): Define.
+ * elf32-spu.c (spu_elf_reloc_name_lookup): New function.
+ (bfd_elf32_bfd_reloc_name_lookup): Define.
+ * elf32-v850.c (v850_elf_reloc_name_lookup): New function.
+ (bfd_elf32_bfd_reloc_name_lookup): Define.
+ * elf32-vax.c (reloc_name_lookup): New function.
+ (bfd_elf32_bfd_reloc_name_lookup): Define.
+ * elf32-xc16x.c (xc16x_reloc_name_lookup): New function.
+ (bfd_elf32_bfd_reloc_name_lookup): Define.
+ * elf32-xstormy16.c (xstormy16_reloc_name_lookup): New function.
+ (bfd_elf32_bfd_reloc_name_lookup): Define.
+ * elf32-xtensa.c (elf_xtensa_reloc_name_lookup): New function.
+ (bfd_elf32_bfd_reloc_name_lookup): Define.
+ * elf64-alpha.c (elf64_alpha_bfd_reloc_name_lookup): New function.
+ (bfd_elf64_bfd_reloc_name_lookup): Define.
+ * elf64-gen.c (bfd_elf64_bfd_reloc_name_lookup): Define.
+ * elf64-hppa.c (bfd_elf64_bfd_reloc_name_lookup): Define.
+ * elf64-mips.c (bfd_elf64_bfd_reloc_name_lookup): New function.
+ * elf64-mmix.c (bfd_elf64_bfd_reloc_name_lookup): New function.
+ * elf64-ppc.c (ppc64_elf_reloc_name_lookup): New function.
+ (bfd_elf64_bfd_reloc_name_lookup): Define.
+ * elf64-s390.c (elf_s390_reloc_name_lookup): New function.
+ (bfd_elf64_bfd_reloc_name_lookup): Define.
+ * elf64-sh64.c (sh_elf64_reloc_name_lookup): New function.
+ (bfd_elf64_bfd_reloc_name_lookup): Define.
+ * elf64-sparc.c (bfd_elf64_bfd_reloc_name_lookup): Define.
+ * elf64-x86-64.c (elf64_x86_64_reloc_name_lookup): New function.
+ (bfd_elf64_bfd_reloc_name_lookup): Define.
+ * elfn32-mips.c (bfd_elf32_bfd_reloc_name_lookup): New function.
+ * elfxx-ia64.c (elfNN_ia64_reloc_name_lookup): New function.
+ (bfd_elfNN_bfd_reloc_name_lookup): Define.
+ * elfxx-sparc.c (_bfd_sparc_elf_reloc_name_lookup): New function.
+ * elfxx-sparc.h (_bfd_sparc_elf_reloc_name_lookup): Declare.
+ * i386msdos.c (msdos_bfd_reloc_name_lookup): Define.
+ * i386os9k.c (aout_32_bfd_reloc_name_lookup): Define.
+ * ieee.c (ieee_bfd_reloc_name_lookup): Define.
+ * libaout.h (NAME (aout, reloc_name_lookup)): Declare.
+ * libbfd-in.h (_bfd_norelocs_bfd_reloc_name_lookup): Declare.
+ * mipsbsd.c (MY_bfd_reloc_name_lookup): Define.
+ (MY(reloc_type_lookup)): Rename from MY(reloc_howto_type_lookup).
+ (MY(reloc_name_lookup)): New function.
+ * nlm-target.h (nlm_bfd_reloc_name_lookup): Define.
+ * oasys.c (oasys_bfd_reloc_name_lookup): Define.
+ * pdp11.c (NAME (aout, reloc_name_lookup)): New function.
+ * pe-mips.c (coff_mips_reloc_name_lookup): New function.
+ (coff_bfd_reloc_name_lookup): Define.
+ * reloc.c (bfd_reloc_name_lookup): New function.
+ * riscix.c (riscix_reloc_name_lookup): New function.
+ (MY_bfd_reloc_name_lookup): Define.
+ * som.c (som_bfd_reloc_name_lookup): New function.
+ * targets.c (struct bfd_target): Add reloc_name_lookup.
+ (BFD_JUMP_TABLE_RELOCS): Add NAME##_bfd_reloc_name_lookup.
+ * versados.c (versados_bfd_reloc_name_lookup): Define.
+ * vms.c (vms_bfd_reloc_name_lookup): New function.
+ * bfd-in2.h: Regenerate.
+ * libbfd.h: Regenerate.
+
+2007-03-26 Thiemo Seufer <ths@mips.com>
+
+ PR ld/4208
+ * elfxx-mips.c (mips_elf_next_relocation): Don't signal an error if no
+ matching relocation is found.
+ (_bfd_mips_elf_relocate_section): Only warn about missing relocations.
+
+2007-03-23 H.J. Lu <hongjiu.lu@intel.com>
+
+ * configure: Regenerated.
+
+2007-03-23 Joseph Myers <joseph@codesourcery.com>
+
+ * configure.in: Use ACX_PKGVERSION and ACX_BUGURL.
+ * configure: Regenerate.
+
+2007-03-23 Alan Modra <amodra@bigpond.net.au>
+
+ * elf32-spu.c (spu_stub_name): Don't put input section in stub name.
+ Remove input_sec param. Adjust all calls.
+ (write_one_stub): Adjust stub symbol.
+ (needs_ovl_stub): New function, extracted from..
+ (spu_elf_size_stubs): ..here.
+ (spu_elf_relocate_section): Use needs_ovl_stub.
+
+2007-03-22 Joseph Myers <joseph@codesourcery.com>
+
+ * Makefile.am (bfdver.h): Only set VERSION_PACKAGE in bfdver.texi
+ if nonempty.
+ * configure.in (REPORT_BUGS_TO): Do not use "URL:" prefix.
+ * Makefile.in, configure, doc/Makefile.in: Regenerate.
+
+2007-03-22 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR ld/4210
+ * peXXigen.c (_bfd_XXi_swap_aouthdr_out): Use the virtual
+ address and virtual size of the last section for the image
+ size.
+
+2007-03-22 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR ld/4007
+ * elf.c (assign_file_positions_for_load_sections): Check if
+ all sections are in the segment.
+
+2007-03-20 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR ld/4208
+ * elfxx-mips.c (_bfd_mips_elf_relocate_section): Report missing
+ matching LO16 relocation for HI16 relocation.
+
+2007-03-20 Paul Brook <paul@codesourcery.com>
+
+ * bfd-in.h (bfd_elf32_arm_set_target_relocs): Update prototype.
+ * bfd-in2.h: Regenerate.
+ * elf32-arm.c (elf32_arm_link_hash_table): Add pic_veneer.
+ (record_arm_to_thumb_glue): Use globals->pic_veneer.
+ (elf32_arm_create_thumb_stub): Ditto.
+ (bfd_elf32_arm_set_target_relocs): Set globals->pic_veneer.
+
+2007-03-18 Mark Shinwell <shinwell@codesourcery.com>
+
+ * bfd-in.h (bfd_elf32_arm_set_target_relocs): Add "bfd *"
+ argument and extra last argument.
+ * bfd-in2.h: Regenerate.
+ * elf32-arm.c (elf32_arm_obj_tdata): Add no_enum_size_warning
+ member.
+ (bfd_elf32_arm_set_target_relocs): Add "bfd *" argument and
+ extra last argument. Set no_enum_size_warning appropriately.
+ (elf32_arm_merge_eabi_attributes): Improve enum sizes
+ diagnostic, suppressing it when no_enum_size_warning dictates.
+
+2007-03-20 Nick Clifton <nickc@redhat.com>
+
+ PR binutils/3535
+ * elf.c (copy_private_bfd_data): Widen the scope of Solaris
+ specific conditions that need the program headers to be
+ rewritten.
+
+2007-03-19 H.J. Lu <hongjiu.lu@intel.com>
+
+ * peXXigen.c (_bfd_XXi_swap_aouthdr_in): Store Magic,
+ MajorLinkerVersion, MinorLinkerVersion, SizeOfCode,
+ SizeOfInitializedData, SizeOfUninitializedData,
+ AddressOfEntryPoint, BaseOfCode and BaseOfData in internal
+ extra PE a.out header.
+ (IMAGE_NT_OPTIONAL_HDR_MAGIC): Defined as 0x10b if not defined.
+ (IMAGE_NT_OPTIONAL_HDR64_MAGIC): Defined as 0x20b if not
+ defined.
+ (IMAGE_NT_OPTIONAL_HDRROM_MAGIC): Defined as 0x107 if not
+ defined.
+ (_bfd_XX_print_private_bfd_data_common): Also print Magic,
+ MajorLinkerVersion, MinorLinkerVersion, SizeOfCode,
+ SizeOfInitializedData, SizeOfUninitializedData,
+ AddressOfEntryPoint, BaseOfCode and BaseOfData from internal
+ extra PE a.out header.
+
+2007-03-18 H.J. Lu <hongjiu.lu@intel.com>
+
+ * targets.c (_bfd_target_vector): Add bfd_efi_app_x86_64_vec
+ only if BFD64 is defined.
+
+2007-03-17 Alan Modra <amodra@bigpond.net.au>
+
+ * elf32-spu.c (spu_elf_size_stubs): Always use an overlay stub
+ on setjmp calls.
+
+2007-03-15 H.J. Lu <hongjiu.lu@intel.com>
+
+ * doc/Makefile.in: Regenerated.
+
+2007-03-15 H.J. Lu <hongjiu.lu@intel.com>
+
+ * Makefile.am (bfdver.h): Substitute report_bugs_to. Also
+ create doc/bfdver.texi.
+ * Makefile.in: Regenerated.
+
+ * configure.in (--with-bugurl): New option.
+ * configure: Regenerated.
+
+ * version.h (REPORT_BUGS_TO): New.
+
+2007-03-13 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR binutils/3826
+ * elf-bfd.h (elf_backend_data): Add elf_osabi.
+ (_bfd_elf_set_osabi): New.
+
+ * elf.c (_bfd_elf_set_osabi): New.
+
+ * elf32-hppa.c (elf32_hppa_post_process_headers): Removed.
+ (elf_backend_post_process_headers): Defined with
+ _bfd_elf_set_osabi.
+ (ELF_OSABI): Properly defined for each target.
+
+ * elf32-i370.c (i370_elf_post_process_headers): Removed.
+ (ELF_OSABI): Defined.
+ (elf_backend_post_process_headers): Defined with
+ _bfd_elf_set_osabi.
+
+ * elf32-i386.c (ELF_OSABI): Defined to ELFOSABI_FREEBSD for
+ freebsd.
+ (elf_i386_post_process_headers): Set EI_OSABI with elf_osabi.
+
+ * elf32-msp430.c (elf32_msp430_post_process_headers): Removed.
+ (ELF_OSABI): Defined.
+ (elf_backend_post_process_headers): Defined with
+ _bfd_elf_set_osabi.
+
+ * elf64-alpha.c (ELF_OSABI): Defined to ELFOSABI_FREEBSD for
+ freebsd.
+ (elf64_alpha_fbsd_post_process_headers): Set EI_OSABI with
+ elf_osabi.
+
+ * elf64-hppa.c (elf64_hppa_post_process_headers): Set EI_OSABI
+ with elf_osabi.
+ (ELF_OSABI): Properly defined for each target.
+ (elf_backend_post_process_headers): Defined with
+ _bfd_elf_set_osabi for Linux.
+
+ * elf64-sparc.c (elf64_sparc_fbsd_post_process_headers): Removed.
+ (ELF_OSABI): Defined to ELFOSABI_FREEBSD for freebsd.
+ (elf_backend_post_process_headers): Defined with
+ _bfd_elf_set_osabi.
+
+ * elf64-x86-64.c (elf64_x86_64_fbsd_post_process_headers): Removed.
+ (ELF_OSABI): Defined to ELFOSABI_FREEBSD for freebsd.
+ (elf_backend_post_process_headers): Defined with
+ _bfd_elf_set_osabi.
+
+ * elfcode.h (elf_object_p): Match the ELFOSABI_NONE ELF target
+ with any ELF target of the compatible machine for which we do not
+ have a specific backend.
+
+ * elfxx-ia64.c (elfNN_hpux_post_process_headers): Set EI_OSABI
+ with elf_osabi.
+
+ * elfxx-target.h (ELF_OSABI): Default to ELFOSABI_NONE.
+ (elfNN_bed): Initialize elf_osabi with ELF_OSABI.
+
+2007-03-08 Alan Modra <amodra@bigpond.net.au>
+
+ * elf32-v850.c (v850_elf_link_output_symbol_hook): Clean out
+ V850_OTHER_* bits.
+
+2007-03-08 Alan Modra <amodra@bigpond.net.au>
+
+ * Makefile.am (BFD64_BACKENDS): Add efi-app-x86_64.lo.
+ (BFD64_BACKENDS_CFILES): Add efi-app-x86_64.c.
+ Run "make dep-am".
+ * Makefile.in: Regenerate.
* 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.
+2007-03-07 H.J. Lu <hongjiu.lu@intel.com>
+
+ * config.bfd (x86_64-*-freebsd*): Add bfd_efi_app_x86_64_vec.
+ (x86_64-*-kfreebsd*-gnu): Likewise.
+ (x86_64-*-netbsd*): Likewise.
+ (x86_64-*-openbsd*): Likewise.
+ (x86_64-*-linux-*): Likewise.
+
+ * configure.in: Support bfd_efi_app_x86_64_vec.
+ * configure: Regenerated.
+
+ * efi-app-x86_64.c: New file.
+
+ * targets.c (bfd_efi_app_x86_64_vec): New.
+ (_bfd_target_vector): Add bfd_efi_app_x86_64_vec.
+
+2007-03-07 Kai Tietz <kai.tietz@onevision.com>
+
+ * reloc.c (bfd_generic_get_relocated_section_contents): Remove
+ const for type reloc_howto_type.
+
+2007-03-07 Alan Modra <amodra@bigpond.net.au>
+
+ PR 3958
+ * elf-bfd.h (RELOC_FOR_GLOBAL_SYMBOL): No error on relocatable link.
+ (elf_discarded_section): Move..
+ * bfd-in.h: ..to here.
+ * bfd-in2.h: Regenerate.
+ * elflink.c (elf_link_input_bfd): Don't zap relocs against symbols
+ from discarded sections before relocate_section has done its job.
+ * reloc.c (bfd_generic_get_relocated_section_contents): Handle
+ relocs against symbols from discarded sections.
+ * elf-hppa.h (elf_hppa_howto_table): Set size. Set dst_mask on
+ SECREL32.
+ (elf_hppa_relocate_section): Handle relocatable link after setting
+ sec, sym, h etc. for final link. Squash error messages for
+ relocatable link. Clear section contents for relocs against
+ symbols in discarded sections, and zero reloc. Remove existing
+ zero r_symndx code.
+ * elf-m10200.c (mn10200_elf_relocate_section): Likewise.
+ * elf-m10300.c (mn10300_elf_relocate_section): Likewise.
+ * elf32-arm.c (elf32_arm_relocate_section): Likewise.
* elf32-avr.c (elf32_avr_relocate_section): Likewise.
+ * elf32-bfin.c (bfinfdpic_relocate_section): Likewise.
+ (bfin_relocate_section): Likewise.
+ * elf32-cr16c.c (elf32_cr16c_relocate_section): Likewise.
+ * elf32-cris.c (cris_elf_relocate_section): Likewise.
+ * elf32-crx.c (elf32_crx_relocate_section): Likewise.
* elf32-d10v.c (elf32_d10v_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-i386.c (elf_i386_relocate_section): Likewise.
* elf32-i860.c (elf32_i860_relocate_section): Likewise.
- * elf32-m68hc1x.c (m68hc11_get_relocation_value): Likewise.
+ * elf32-ip2k.c (ip2k_elf_relocate_section): Likewise.
+ * elf32-iq2000.c (iq2000_elf_relocate_section): Likewise.
+ * elf32-m32c.c (m32c_elf_relocate_section): Likewise.
+ * elf32-m32r.c (m32r_elf_relocate_section): Likewise.
+ * elf32-m68hc1x.c (elf32_m68hc11_check_relocs): Likewise.
+ * elf32-m68k.c (elf_m68k_relocate_section): Likewise.
* elf32-mcore.c (mcore_elf_relocate_section): Likewise.
+ * elf32-mep.c (mep_elf_relocate_section): Likewise.
* elf32-msp430.c (elf32_msp430_relocate_section): Likewise.
+ * elf32-mt.c (mt_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-score.c (_bfd_score_elf_relocate_section): Likewise.
+ * elf32-sh.c (sh_elf_relocate_section): Likewise.
+ * elf32-spu.c (spu_elf_relocate_section): Likewise.
* elf32-v850.c (v850_elf_relocate_section): Likewise.
+ * elf32-vax.c (elf_vax_relocate_section): Likewise.
+ * elf32-xc16x.c (elf32_xc16x_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_r): Likewise.
+ (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-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.
+ * elfxx-sparc.c (_bfd_sparc_elf_relocate_section): Likewise.
+
+ * elf32-arm.c (elf32_arm_relocate_section): Always adjust section
+ symbols for relocatable link. Don't use always-zero st_value.
+ (elf_backend_rela_normal): Don't define.
+ * elf32-bfin.c (bfinfdpic_relocate_section): Use
+ RELOC_FOR_GLOBAL_SYMBOL.
+ * elf32-frv.c (elf32_frv_relocate_section): Likewise.
+ * elf32-d10v.c (elf32_d10v_relocate_section): Combine SEC_MERGE
+ section symbol adjustments with same for relocatable link.
+ * elf32-i386.c (elf_i386_relocate_section): Likewise.
+ * elf32-m68hc1x.c (m68hc11_get_relocation_value): Move..
+ (elf32_m68hc11_check_relocs): ..to here.
+ * elf32-score.c (score_elf_final_link_relocate): Remove zero
+ r_symndx code.
+ * elfxx-mips.c (mips_elf_calculate_relocation): 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.
+2007-03-07 Alan Modra <amodra@bigpond.net.au>
-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.
+ PR 4144
+ * elf.c (assign_file_positions_for_load_sections): Don't
+ adjust p_memsz for !SEC_LOAD section vma modulo page size.
+ Instead, use the same lma based adjustment for SEC_LOAD
+ sections.
+
+2007-03-01 Bob Wilson <bob.wilson@acm.org>
+
+ * elf32-xtensa.c (analyze_relocations): Zero src_count if not relaxing.
+ (find_relaxable_sections): Do not increment src_count for unknown
+ opcodes. Decode only once instead of calling is_l32r_relocation.
+ (compute_text_actions): Remove unused no_insn_move flag. Assert that
+ src_next matches src_count in relax_info.
+
+2007-03-01 Joseph Myers <joseph@codesourcery.com>
+
+ * Makefile.am (bfdver.h): Use "." not " " between version number
+ and date.
+ * Makefile.in: Regenerate.
+ * configure.in (PKGVERSION): Default to "(GNU Binutils) ".
* 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.
+2007-02-28 Nathan Sidwell <nathan@codesourcery.com>
-2004-03-15 Matt Thomas <matt@3am-software.com>
+ * config.bfd (sh-*-uclinux, sh[12]-*-uclinux): New stanza.
- * config.bfd: Add x86-64 vector to NetBSD/i386 if 64bit BFD is
- selected.
+2007-02-27 Alan Modra <amodra@bigpond.net.au>
-2004-03-13 Mark Kettenis <kettenis@gnu.org>
+ * elf32-spu.h (struct _ovl_stream): Make "start" and "end" const.
+ * elf32-spu.c (ovl_mgr_pread): Add const to casts.
- * config.bfd: Add x86_64-*-openbsd*.
- * configure.in (x86_64-*-openbsd*): Set COREFILE to
- netbsd-core.lo.
- * configure: Regenerate.
+2007-02-23 Carlos O'Donell <carlos@codesourcery.com>
-2004-03-09 Steve Ellcey <sje@cup.hp.com>
+ * dwarf2.c (_bfd_dwarf2_find_nearest_line): Assume 32-bit
+ DWARF even with 64-bit addresses.
+ (_bfd_dwarf2_find_nearest_line): Likewise.
- * elfxx-ia64.c (plt_full_entry): Change ld8 to ld8.acq.
+2007-02-23 Nick Clifton <nickc@redhat.com>
-2004-03-05 Nathan Sidwell <nathan@codesourcery.com>
+ PR binutils/3535
+ * elf.c (copy_private_bfd_data): Always rewrite the program
+ headers when a Solaris interpreter segment is involved.
- * elf.c (map_sections_to_segments): Ignore .tbss sections for
- layout purposes.
+2007-02-22 Paul Brook <paul@codesourcery.com>
-2004-02-17 Daniel Jacobowitz <drow@mvista.com>
- Richard Sandiford <rsandifo@redhat.com>
+ * elflink.c (gc_mark_hook_fn): Remove.
+ (_bfd_elf_gc_mark): Rename gc_mark_hook_fn to elf_gc_mark_hook_fn.
+ (bfd_elf_gc_sections): Ditto. Call gc_mark_extra_sections.
+ * elf-bfd.h (elf_gc_mark_hook_fn): Define.
+ (elf_backend_data): Add gc_mark_extra_sections.
+ * elfxx-target.h (elf_backend_gc_mark_extra_sections): Provide default
+ definition.
+ (elfNN_bed): Add elf_backend_gc_mark_extra_sections.
+ * elf32-arm.c (elf32_arm_gc_mark_extra_sections): New function.
+ (elf_backend_gc_mark_extra_sections): Define.
- * 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>
+2007-02-21 Nick Clifton <nickc@redhat.com>
- * elf64-alpha.c (elf64_alpha_calc_got_offsets_for_symbol): Catch
- GOT entries with no associated GOT subsection.
+ * elf.c (_bfd_elf_map_sections_to_segments): If the
+ override_segment_assignment callback is defined then call it.
-2004-02-09 Richard Sandiford <rsandifo@redhat.com>
+2007-02-21 Alan Modra <amodra@bigpond.net.au>
- * 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.
+ * elf32-spu.c (spu_elf_size_stubs): Correct order of warning args.
-2004-01-30 H.J. Lu <hongjiu.lu@intel.com>
+2007-02-19 Thiemo Seufer <ths@mips.com>
- * elfxx-ia64.c (elfNN_ia64_relax_brl): New function.
- (elfNN_ia64_relax_section): Optimize brl to br during the relax
- finalize pass.
+ * elfxx-mips.c (_bfd_mips_elf_print_private_bfd_data): Remove
+ translation marker from untranslatable strings.
-2004-01-30 Alexandre Oliva <aoliva@redhat.com>
+2007-02-19 Alan Modra <amodra@bigpond.net.au>
- * 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.
+ * elf-bfd.h (struct elf_backend_data): Add default_execstack.
+ * elflink.c (bfd_elf_size_dynamic_sections): Heed default_execstack.
+ * elfxx-target.h (elf_backend_default_execstack): Define to 1.
+ (elfNN_bed): Init new field.
+ * elf64-ppc.c (elf_backend_default_execstack): Define to 0.
-2004-01-25 H.J. Lu <hongjiu.lu@intel.com>
+2007-02-17 Mark Mitchell <mark@codesourcery.com>
+ Nathan Sidwell <nathan@codesourcery.com>
+ Vladimir Prus <vladimir@codesourcery.com
+ Joseph Myers <joseph@codesourcery.com>
- * elfxx-ia64.c (elfNN_ia64_relocate_section): Disallow imm
- relocations against dynamic symbols.
+ * configure.in (--with-pkgversion): New option.
+ * configure: Regenerate.
+ * Makefile.am (bfdver.h): Substitute for @bfd_version_package@.
+ * Makefile.in: Regenerate.
+ * version.h (BFD_VERSION_STRING): Define using
+ @bfd_version_package@.
-2004-01-23 Daniel Jacobowitz <drow@mvista.com>
+2007-02-16 Carlos O'Donell <carlos@codesourcery.com>
- * elf32-arm.h (elf32_arm_check_relocs): Revert part of 2004-01-13
- change.
+ * elfxx-mips.c (_bfd_mips_elf_print_private_bfd_data):
+ Print EF_MIPS_NOREORDER, EF_MIPS_PIC, EF_MIPS_CPIC, EF_MIPS_XGOT
+ and EF_MIPS_UCODE.
-2004-01-21 Tom Rix <tcrix@worldnet.att.net>
+2007-02-15 Alan Modra <amodra@bigpond.net.au>
- * reloc.c: New 5 bit reloc, BFD_RELOC_M68HC12_5B, for m68hc12 movb/movw.
- * bfd-in2.h, libbfd.h: Rebuilt.
+ * libbfd-in.h (_bfd_norelocs_get_reloc_upper_bound): Don't define,
+ declare.
+ (_bfd_norelocs_canonicalize_reloc): Likewise.
+ * libbfd.h: Regenerate.
+ * libbfd.c (_bfd_norelocs_get_reloc_upper_bound): New function.
+ (_bfd_norelocs_canonicalize_reloc): Likewise.
+ * binary.c (binary_bfd_reloc_type_lookup): Don't define.
+ (binary_get_reloc_upper_bound, binary_canonicalize_reloc): Likewise.
+ (binary_vec): Use _bfd_norelocs in BFD_JUMP_TABLE_RELOCS.
+ * ihex.c: Similarly.
+ * mach-o-target.c: Similarly.
+ * mach-o.c: Similarly.
+ * mmo.c: Similarly.
+ * pef.c: Similarly.
+ * ppcboot.c: Similarly.
+ * srec.c: Similarly.
+ * xsym.c: Similarly.
-2004-01-20 Danny Smith <dannysmith@users.sourceforge.net>
+2007-02-14 H.J. Lu <hongjiu.lu@intel.com>
- * 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.
+ PR ld/3953
+ * elflink.c (_bfd_elf_add_default_symbol): Check warning symbol
+ when adding default symbol.
-2004-01-19 Kazu Hirata <kazu@cs.umass.edu>
+2007-02-13 Alan Modra <amodra@bigpond.net.au>
- * coff-h8300.c: Add and adjust comments about relaxation.
- * elf32-h8300.c: Likewise.
+ * elf64-ppc.c (create_linkage_sections): Use section ".branch_lt"
+ for branch lookup table.
-2004-01-16 Kazu Hirata <kazu@cs.umass.edu>
+2007-02-12 Alan Modra <amodra@bigpond.net.au>
- * coff-h8300.c: Fix comment typos.
- * elf32-h8300.c: Likewise.
+ * elf64-ppc.c (create_linkage_sections): Don't create
+ .rela.rodata.brlt for --emit-relocs.
+ (ppc_build_one_stub): Create relocs for brlt --emit-relocs here.
+ (ppc_size_one_stub): Count them. Simplify test of stub type
+ when counting stub relocs. Set SEC_RELOC too.
+ (ppc64_elf_size_stubs): Clear reloc_count and SEC_RELOC.
+ (ppc64_elf_finish_dynamic_sections): Output brlt relocs.
-2004-01-16 Kazu Hirata <kazu@cs.umass.edu>
+2007-02-12 Alan Modra <amodra@bigpond.net.au>
- * coff-h8300.c: Add comments about relaxation.
- * elf32-h8300.c: Likewise.
+ * elflink.c (evaluate_complex_relocation_symbols): Ignore relocs
+ with a zero symbol index.
-2004-01-14 Maciej W. Rozycki <macro@ds2.pg.gda.pl>
+2007-02-12 Alan Modra <amodra@bigpond.net.au>
- * acinclude.m4: Quote names of macros to be defined by AC_DEFUN
- throughout.
- * aclocal.m4: Regenerate.
- * configure: Regenerate.
+ * elflink.c (bfd_elf_discard_info): Tidy setting of "eh".
-2004-01-13 Ian Lance Taylor <ian@wasabisystems.com>
+2007-02-05 Dave Brolley <brolley@redhat.com>
+ Stan Cox <scox@redhat.com>
- * elf64-mips.c (mips_elf64_slurp_one_reloc_table): Call
- mips_elf64_rtype_to_howto instead of using howto_table.
+ PR ld/3972
+ * elflink.c (elf_link_input_bfd): Always setup finfo->internal_syms.
-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.
+2007-02-05 Dave Brolley <brolley@redhat.com>
+ Richard Sandiford <rsandifo@redhat.com>
+ Stan Cox <scox@redhat.com>
+ Nick Clifton <nickc@redhat.com>
+ DJ Delorie <dj@redhat.com>
+ Frank Ch. Eigler <fche@redhat.com>
+ Ben Elliston <bje@redhat.com>
+ Richard Henderson <rth@redhat.com>
+
+ * Makefile.am (ALL_MACHINES): Add cpu-mep.lo.
+ (ALL_MACHINES_CFILES): Add CPU_MEP.c.
+ (BFD32_BACKENDS): Add elf32-mep.lo.
+ (BFD32_BACKENDS_CFILES): Add elf32-mep.c.
+ (cpu-mep.lo,elf32-mep.lo): New targets.
+ * archures.c (bfd_arch_mep): New enumerator.
+ (bfd_mach_mep, bfd_mach_mep_h1): New macros.
+ (bfd_mep_arch): New external variable.
+ (bfd_archures_list): Add bfd_mep_arch.
+ * config.bfd: Support mep-*-elf.
+ * configure.in: Support bfd_elf32_mep_vec and bfd_elf32_mep_little_vec.
+ * reloc.c (BFD_RELOC_MEP_*): New relocation numbers.
+ * targets.c (bfd_elf32_mep_vec,bfd_elf32_mep_little_vec): New extern
+ declarations.
+ (_bfd_target_vector): Add bfd_elf32_mep_vec and
+ bfd_elf32_mep_little_vec.
+ * mep-relocs.pl: New file.
+ * cpu-mep.c: New file.
+ * elf32-mep.c: New file.
+ * bfd-in2.h: Regenerate.
+ * po/POTFILES.in: Regenerate.
+ * libbfd.h: Regenerate.
+ * Makefile.in: Regenerate.
+ * configure: Regenerate.
+
+2007-02-05 Dave Brolley <brolley@redhat.com>
+
+ * elflink.c (evaluate_complex_relocation_symbols): Check for
+ STT_SRELC for global symbols.
+ (perform_complex_relocations): Renamed to
+ perform_complex_relocation and now examines only one relocation.
+ (elf_link_input_bfd): Don't call perform_complex_relocations.
+ * elf-bfd.h (bfd_elf_perform_complex_relocation_: New prototype.
+ * elf32-mep.c (mep_elf_howto_table): Add R_RELC.
+ (OD,OS,OU): #undefs corrected to N, S and U repectively.
+ (mep_reloc_type_lookup): Handle BFD_RELOC_RELC.
+ (complex_reloc_installation_howto): Removed.
+ (mep_info_to_howto_rela): Remove special case for r_type==0xff.
+ (mep_elf_relocate_section): Call bfd_elf_perform_complex_relocation.
+
+2007-02-05 Dave Brolley <brolley@redhat.com>
+ Richard Sandiford <rsandifo@redhat.com>
+ DJ Delorie <dj@redhat.com>
+ Graydon Hoare <graydon@redhat.com>
+ Nick Clifton <nickc@cambridge.redhat.com>
+ Jeff Holcomb <jeffh@redhat.com>
+ Frank Ch. Eigler <fche@redhat.com>
+
+ * elf-bfd.h (bfd_elf_perform_complex_relocations): New prototype.
+ * elf.c (swap_out_syms): Handle BSF_RELC and BSF_SRELC.
+ * elfcode.h (elf_slurp_symbol_table): Handle STT_RELC and STT_SRELC.
+ * elflink.c (set_symbolValue): New static function.
+ (resolve_symbol): Likewise.
+ (resolve_section): Likewise.
+ (undefined_reference): Likewise.
+ (eval_symbol): Likewise.
+ (evaluate_complex_relocation_symbols): Likewise.
+ (put_value): Likewise.
+ (get_value): Likewise.
+ (decode_complex_addend):
+ (bfd_elf_perform_complex_relocation): New function.
+ (elf_link_input_bfd): Call evaluate_complex_relocation_symbols.
+ * reloc.c (BFD_RELOC_RELC): New relocation number.
+ * syms.c (BSF_RELC,BSF_SRELC): New macros.
+
+2007-02-05 Bob Wilson <bob.wilson@acm.org>
+
+ * elf32-xtensa.c (elf_xtensa_make_sym_local): Delete.
+ (elf_xtensa_hide_symbol, elf_backend_hide_symbol): Delete.
+ (elf_xtensa_fix_refcounts, elf_xtensa_allocate_plt_size)
+ (elf_xtensa_allocate_got_size): Replace these with...
+ (elf_xtensa_allocate_dynrelocs): ...this new function.
+ (elf_xtensa_size_dynamic_sections): Use it.
+
+2007-02-05 Bob Wilson <bob.wilson@acm.org>
+
+ * elf32-xtensa.c (elf_howto_table) <R_XTENSA_GLOB_DAT>
+ <R_XTENSA_JMP_SLOT, R_XTENSA_RELATIVE, R_XTENSA_PLT, R_XTENSA_DIFF32>:
+ Set src_mask to zero.
+ <R_XTENSA_DIFF8, R_XTENSA_DIFF16>: Likewise. Also fix dst_mask.
+ <R_XTENSA_ASM_EXPAND>: Set pcrel_offset to TRUE.
+
+2007-02-02 Bob Wilson <bob.wilson@acm.org>
+
+ * elf32-xtensa.c (xtensa_elf_dynamic_symbol_p): Renamed to...
+ (elf_xtensa_dynamic_symbol_p): ...this.
+
+2007-02-02 Bob Wilson <bob.wilson@acm.org>
+
+ * elf32-xtensa.c (plt_reloc_count): Move into link hash table.
+ (struct elf_xtensa_link_hash_table): New.
+ (elf_xtensa_hash_table): New.
+ (elf_xtensa_link_hash_table_create): New.
+ (elf_xtensa_check_relocs): Update plt_reloc_count references.
+ Update arguments to add_extra_plt_sections.
+ (elf_xtensa_create_dynamic_sections): Record new sections in the hash
+ table. Update for plt_reloc_count and add_extra_plt_sections.
+ (add_extra_plt_sections, elf_xtensa_create_plt_entry): Replace dynobj
+ argument with link info. Update calls to elf_xtensa_get_plt_section
+ and elf_xtensa_get_gotplt_section.
+ (elf_xtensa_allocate_local_got_size, elf_xtensa_size_dynamic_sections)
+ (elf_xtensa_relocate_section, elf_xtensa_finish_dynamic_sections)
+ (elf_xtensa_discard_info_for_section, shrink_dynamic_reloc_sections)
+ (relax_property_section): Get sections from the hash table and update
+ function calls.
+ (elf_xtensa_get_plt_section, elf_xtensa_get_gotplt_section): Replace
+ dynobj argument with link info. Get sections for first plt chunk from
+ the hash table.
(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
+
+2007-02-02 Jakub Jelinek <jakub@redhat.com>
+
+ * elf-bfd.h (struct elf_obj_tdata): Change symbuf type to void *.
+ * elf.c (struct elf_symbuf_symbol, struct elf_symbuf_head): New types.
+ (struct elf_symbol): Change first member into union.
+ (elf_sort_elf_symbol): Compare pointers to internal syms rather than
+ internal syms. Only compare st_shndx fields.
+ (elf_create_symbuf): New function.
+ (bfd_elf_match_symbols_in_sections): Use it. If symbufs are available
+ for bfds, use a binary search, otherwise don't qsort symbols
+ unnecessarily only to select which symbols are for the particular
+ shndx.
+
+2007-02-01 Nick Clifton <nickc@redhat.com>
+
+ PR ld/3852
+ * elf.c (_bfd_elf_link_hash_table_init): Initialize all the fields
+ in the elf_link_hash_table structure.
+
+2007-02-01 Alan Modra <amodra@bigpond.net.au>
+
+ * elf-bfd.h (struct elf_backend_data): Add elf_backend_write_core_note.
+ * elfxx-target.h (elf_backend_write_core_note): Define and use.
+ * elf.c (elfcore_write_prpsinfo): Call the above. Add support for
+ 32-bit core note on 64-bit target.
+ (elfcore_write_prstatus): Likewise.
+ (elfcore_write_lwpstatus): Make note_name const.
+ (elfcore_write_prfpreg): Likewise.
+ (elfcore_write_pstatus): Add support for 32-bit core note on 64-bit
+ target.
+ * elf32-ppc.c (ppc_elf_write_core_note): New function.
+ (elf_backend_write_core_note): Define.
+ * elf64-ppc.c (ppc64_elf_write_core_note): New function.
+ (elf_backend_write_core_note): Define.
+
+2007-01-31 H.J. Lu <hongjiu.lu@intel.com>
+
+ * elf32-cris.c (INCLUDED_TARGET_FILE): Removed.
+ (elf32_bed): Defined for elf32-us-cris.
+
+ * elf64-sh64.c (elf64_bed): Defined for Linux.
+ (INCLUDED_TARGET_FILE): Removed.
+
+ * elfxx-target.h (elfNN_bed): Always define. Don't check
+ INCLUDED_TARGET_FILE.
+
+2007-01-31 DJ Delorie <dj@redhat.com>
+
+ * elf-m10300.c (mn10300_elf_relocate_section): Clarify the warning
+ message for dangerous relocs, special case the common user error.
+
+2007-01-30 H.J. Lu <hongjiu.lu@intel.com>
+
+ * elf.c (copy_elf_program_header): Start from the first section
+ in a segment and stop when all sections in a segment are
+ accounted for.
+
+2007-01-29 Julian Brown <julian@codesourcery.com>
+
+ * bfd-in2.h: Regenerate.
+ * bfd-in.h (bfd_arm_vfp11_fix): New enum. Specify how VFP11
+ instruction scanning should be done.
+ (bfd_elf32_arm_init_maps, bfd_elf32_arm_vfp11_erratum_scan)
+ (bfd_elf32_arm_vfp11_fix_veneer_locations): Add prototypes.
+ (bfd_elf32_arm_set_target_relocs): Add vfp11 fix type argument to
+ prototype.
+ * elf-bfd.h (elf_backend_write_section): Add struct bfd_link_info
+ argument.
+ * elf32-arm.c (VFP11_ERRATUM_VENEER_SECTION_NAME)
+ (VFP11_ERRATUM_VENEER_ENTRY_NAME): Define macros.
+ (elf32_vfp11_erratum_type): New enum.
+ (elf32_vfp11_erratum_list): New struct. List of veneers or jumps to
+ veneers.
+ (_arm_elf_section_data): Add mapsize, erratumcount, erratumlist.
+ (elf32_arm_link_hash_table): Add vfp11_erratum_glue_size,
+ vfp11_fix and num_vfp11_fixes fields.
+ (elf32_arm_link_hash_table_create): Initialise vfp11_fix,
+ vfp11_erratum_glue_size, num_vfp11_fixes fields.
+ (VFP11_ERRATUM_VENEER_SIZE): Define. Size of an (ARM) veneer.
+ (bfd_elf32_arm_allocate_interworking_sections): Initialise erratum
+ glue section.
+ (elf32_arm_section_map_add): Add an code/data mapping symbol entry
+ to a section's map.
+ (record_vfp11_erratum_veneer): Create a single veneer, and its
+ associated symbols.
+ (bfd_elf32_arm_add_glue_sections_to_bfd): Add vfp11 erratum glue.
+ (bfd_elf32_arm_init_maps): Initialise mapping symbol table for input
+ BFDs.
+ (bfd_elf32_arm_set_vfp11_fix): Set the type of erratum workaround
+ required.
+ (bfd_arm_vfp11_pipe): Define VFP11 instruction pipes.
+ (bfd_arm_vfp11_regno): Recode a register number from a VFP11 insn.
+ (bfd_arm_vfp11_write_mask): Update write mask according to coded
+ register number.
+ (bfd_arm_vfp11_antidependency): New function.
+ (bfd_arm_vfp11_insn_decode): Decode a VFP11 insn.
+ (elf32_arm_compare_mapping): Declare.
+ (bfd_elf32_arm_vfp11_erratum_scan): Scan the sections of an input
+ BFD for potential erratum-triggering insns. Record results.
+ (bfd_elf32_arm_vfp11_fix_veneer_locations): Find out where veneers
+ and branches to veneers have been placed in virtual memory after
+ layout.
+ (bfd_elf32_arm_set_target_relocs): Set vfp11_fix field in global
+ hash table.
+ (elf32_arm_output_symbol_hook): Remove.
+ (elf32_arm_write_section): Output veneers, and branches to veneers.
+ Use maps from input sections, not output sections, for code
+ byte-swapping.
+ * elf32-ppc.c (ppc_elf_write_section): Add dummy link_info argument.
+ * elf32-score.c (_bfd_score_elf_write_section): Likewise.
+ * elfxx-mips.c (_bfd_mips_elf_write_section): Likewise.
+ * elfxx-mips.h (_bfd_mips_elf_write_section): Likewise.
+
+2007-01-27 H.J. Lu <hongjiu.lu@intel.com>
+
+ * elf64-hppa.c (elf64_bed): Defined for HPUX and Linux.
+ (INCLUDED_TARGET_FILE): Removed.
+
+2007-01-27 Mike Frysinger <vapier@gentoo.org>
+
+ * elf32-hppa.c (elf32_bed): Define for hpux, linux and netbsd.
+ (INCLUDED_TARGET_FILE): Remove.
+
+2007-01-25 DJ Delorie <dj@redhat.com>
+
+ * elf32-m32c.c (m32c_elf_howto_table): Don't complain about
+ R_M32C_16 or R_M32C_24 relocs.
+
+2007-01-25 Nick Clifton <nickc@redhat.com>
+
+ PR binutils/3874
+ * elf32-avr.c (avr_link_hash_table): Check to make sure that the
+ hash table was created by elf32_avr_link_hash_table_create before
+ using it.
+ (elf32_avr_link_hash_newfunc): New function. Just pass the call
+ through to _bfd_elf_link_hash_newfunc.
+ (elf32_avr_link_hash_table_create): Use
+ elf32_avr_link_hash_newfunc instead of
+ _bfd_elf_link_hash_newfunc.
+ (elf32_avr_relocate_section): Check for the hash table pointer
+ being NULL.
+ (elf32_avr_relax_section, avr_build_one_stub,
+ elf32_avr_setup_params, get_local_syms, elf32_avr_size_stubs,
+ elf32_avr_build_stubs): Likewise.
+
+2007-01-16 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR ld/3831
+ * elf-bfd.h (bfd_elf_link_mark_dynamic_symbol): Add an
+ argument, Elf_Internal_Sym *.
+
+ * elflink.c (bfd_elf_link_mark_dynamic_symbol): Mark a data
+ symbol dynamic if info->dynamic_data is TRUE.
+ (bfd_elf_record_link_assignment): Updated call to
+ bfd_elf_record_link_assignment.
+ (_bfd_elf_merge_symbol): Likewise. Always call
+ bfd_elf_link_mark_dynamic_symbol.
+
+2007-01-12 H.J. Lu <hongjiu.lu@intel.com>
+
+ * Makefile.am (BFD_LIBS): Removed.
+ * Makefile.in: Regenerated.
+
+2007-01-11 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR binutils/3631
+ * Makefile.am (OFILES): Add @bfd64_libs@.
+ (libbfd_la_SOURCES): Remove $(BFD64_LIBS_CFILES).
+ * Makefile.in: Regenerated.
+
+ * configure.in (bfd_libs): Replaced by ...
+ (bfd64_libs): This.
+ * configure: Regenerated.
+
+2007-01-11 Nathan Sidwell <nathan@codesourcery.com>
+
+ * elf.c (assign_file_positions_for_load_sections): We can
+ require fewer phdrs than expected.
+
+2007-01-08 Kazu Hirata <kazu@codesourcery.com>
+
+ * archures.c (bfd_mach_cpu32_fido): Rename to bfd_mach_fido.
+ * bfd-in2.h: Regenerate.
+ * cpu-m68k.c (arch_info_struct): Use bfd_mach_fido instead of
+ bfd_mach_cpu32_fido.
+ (m68k_arch_features): Use fido_a instead of cpu32.
+ (bfd_m68k_compatible): Reject the combination of Fido and
+ ColdFire. Accept the combination of CPU32 and Fido with a
+ warning.
+ * elf32-m68k.c (elf32_m68k_object_p,
+ elf32_m68k_merge_private_bfd_data,
+ elf32_m68k_print_private_bfd_data): Treat Fido as an
+ architecture by itself.
+
+2007-01-08 Kai Tietz <kai.tietz@onevision.com>
+
+ * config.bfd: Renamed target x86_64-*-mingw64 to x86_64-*-mingw*.
+
+2007-01-05 Jakub Jelinek <jakub@redhat.com>
+
+ * texhex.c (first_phase): Don't fall through into the default
+ case.
+ (pass_over): Replace abort () calls with return FALSE. Fix
+ buffer overflow.
+
+2007-01-04 Jie Zhang <jie.zhang@analog.com>
+
+ * elf-eh-frame.c (_bfd_elf_discard_section_eh_frame): Don't set
+ SEC_EXCLUDE on zero size .eh_frame.
+
+For older changes see ChangeLog-2006
Local Variables:
mode: change-log
diff --git a/contrib/binutils/bfd/ChangeLog-0203 b/contrib/binutils/bfd/ChangeLog-0203
index f99029a..1b1abb1 100644
--- a/contrib/binutils/bfd/ChangeLog-0203
+++ b/contrib/binutils/bfd/ChangeLog-0203
@@ -858,7 +858,7 @@
Bernardo Innocenti <bernie@develer.com>
* archures.c: Add MCF528x (MCFv4) support.
- * bfd/cpu-m68k.c (arch_info_struct): Likewise.
+ * cpu-m68k.c (arch_info_struct): Likewise.
* bfd-in2.h: Regenerate.
2003-10-20 Andrew Cagney <cagney@redhat.com>
@@ -1953,10 +1953,10 @@
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.
+ * config.bfd (__QNXTARGET__): Define for Neutrino architectures.
+ * elf32-arm.h (ELF_MAXPAGESIZE): Set to 4k for Neutrino.
+ * elf32-sh.c (ELF_MAXPAGESIZE): Set to 4k for Neutrino.
+ * elf32-ppc.c (ELF_MAXPAGESIZE): Set to 4k for Neutrino.
2003-07-12 Jeff Muizelaar <muizelaar@rogers.com>
@@ -2196,13 +2196,13 @@
2003-07-09 Richard Sandiford <rsandifo@redhat.com>
- * bfd/elfxx-mips.c (mips_elf_create_dynamic_relocation): Treat
+ * 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-
+ * elfxx-mips.c (mips_elf_create_dynamic_relocation): In SGI-
compatible objects, add the values of defined external symbols
to the addend.
diff --git a/contrib/binutils/bfd/ChangeLog-2006 b/contrib/binutils/bfd/ChangeLog-2006
new file mode 100644
index 0000000..82216d6
--- /dev/null
+++ b/contrib/binutils/bfd/ChangeLog-2006
@@ -0,0 +1,3601 @@
+2006-12-31 H.J. Lu <hongjiu.lu@intel.com>
+
+ * bfd.c (bfd_record_phdr): Call bfd_zalloc instead of bfd_alloc
+ to allocate elf_segment_map.
+
+2006-12-29 H.J. Lu <hongjiu.lu@intel.com>
+
+ * elflink.c (elf_link_add_object_symbols): Remember the symbol
+ size only if it is defined.
+
+2006-12-25 Kazu Hirata <kazu@codesourcery.com>
+
+ * archures.c (bfd_mach_cpu32_fido): New.
+ (bfd_mach_mcf_isa_a_nodiv, bfd_mach_mcf_isa_a,
+ bfd_mach_mcf_isa_a_mac, bfd_mach_mcf_isa_a_emac,
+ bfd_mach_mcf_isa_aplus, bfd_mach_mcf_isa_aplus_mac,
+ bfd_mach_mcf_isa_aplus_emac, bfd_mach_mcf_isa_b_nousp,
+ bfd_mach_mcf_isa_b_nousp_mac, bfd_mach_mcf_isa_b_nousp_emac,
+ bfd_mach_mcf_isa_b, bfd_mach_mcf_isa_b_mac,
+ bfd_mach_mcf_isa_b_emac, bfd_mach_mcf_isa_b_float,
+ bfd_mach_mcf_isa_b_float_mac, bfd_mach_mcf_isa_b_float_emac):
+ Increment the defined values.
+ * bfd-in2.h: Regenerate.
+ * cpu-m68k.c (arch_info_struct): Add en entry for
+ bfd_mach_cpu32_fido.
+ * elf32-m68k.c (elf32_m68k_object_p): Handle
+ EF_M68K_CPU32_FIDO_A.
+ (elf32_m68k_merge_private_bfd_data): Use EF_M68K_CPU32_MASK.
+ (elf32_m68k_print_private_bfd_data): Handle
+ EF_M68K_CPU32_FIDO_A.
+
+2006-12-25 Mei Ligang <ligang@sunnorth.com.cn>
+
+ * elf32-score.c (score_elf_got_lo16_reloc): Change some variables
+ type from unsigned to signed.
+ (score_elf_final_link_relocate): Fix bugs of handling relocation
+ type R_SCORE_GOT15, R_SCORE_GOT_LO16, and R_SCORE_REL32.
+ (_bfd_score_elf_relocate_section): Handle R_SCORE_GOT_LO16
+ specially.
+
+2006-12-23 Jakub Jelinek <jakub@redhat.com>
+
+ * elf-bfd.h (struct elf_backend_data): Add as_needed_cleanup hook.
+ * elfxx-target.h (elf_backend_as_needed_cleanup): Define.
+ (elfNN_bed): Add as_needed_cleanup hook.
+ * elflink.c (elf_link_add_object_symbols): Call it when reverting
+ hash table changes for unneeded --as-needed input.
+ * elf64-ppc64.c (elf_backend_as_needed_cleanup): Define.
+ (ppc64_elf_as_needed_cleanup): New function.
+
+2006-12-19 Kazu Hirata <kazu@codesourcery.com>
+
+ * elf32-m68k.c (elf32_m68k_object_p,
+ elf32_m68k_print_private_bfd_data): Use EF_M68K_ARCH_MASK to
+ extract architecture mask.
+
+2006-12-19 Nathan Sidwell <nathan@codesourcery.com>
+
+ * elf.c (assign_file_positions_for_load_sections): Adjust p_vaddr
+ by p_vaddr_offset. Copy alignment & use if it is valid.
+ (rewrite_elf_program_headers): Cope with leading padding in a
+ segment that does not contain file or program headers.
+ (copy_elf_program_header): Likewise.
+
+2006-12-15 Mark Kettenis <kettenis@gnu.org>
+
+ * config.bfd: (sh*-*-openbsd*): Add target.
+ * configure.in (sh*-*-openbsd*): Set COREFILE to netbsd-core.lo.
+ * configure: Regenerate.
+
+2006-12-15 Alan Modra <amodra@bigpond.net.au>
+
+ * opncls.c (bfd_openr_iovec): Add "stat" parameter.
+ (struct opncls): Add "stat" field.
+ (opncls_bstat): Call vec->stat.
+ * bfd-in2.h: Regenerate.
+ * elf32-spu.c (spu_elf_open_builtin_lib): Adjust.
+
+2006-12-14 Alan Modra <amodra@bigpond.net.au>
+
+ * elf-bfd.h (struct bfd_elf_section_data): Clarify sec_group
+ and next_in_group usage.
+
+2006-12-14 Alan Modra <amodra@bigpond.net.au>
+
+ PR 3704
+ * bfdio.c (bfd_bread): Don't read past end of archive elements.
+
+2006-12-12 Daniel Jacobowitz <dan@codesourcery.com>
+
+ * doc/Makefile.am (bfd_TEXINFOS): Set.
+ (bfd.info bfd.dvi bfd.html): Delete rule.
+ * doc/Makefile.in: Regenerated.
+
+2006-12-11 Daniel Jacobowitz <dan@codesourcery.com>
+
+ * configure.in: Define GENINSRC_NEVER.
+ * doc/Makefile.am (bfd.info): Remove srcdir prefix.
+ (MAINTAINERCLEANFILES): Add info file.
+ (DISTCLEANFILES): Pretend to add info file.
+ * po/Make-in (.po.gmo): Put gmo files in objdir.
+ * configure, Makefile.in, doc/Makefile.in: Regenerated.
+
+2006-12-11 Eric Botcazou <ebotcazou@adacore.com>
+
+ * elflink.c (bfd_elf_gc_sections): Also search for corresponding
+ sections with .gnu.linkonce.t. prefix.
+
+2006-12-07 Kazu Hirata <kazu@codesourcery.com>
+
+ * elf32-m68k.c: Update uses of EF_M68K_*.
+
+2006-12-07 H.J. Lu <hjl@gnu.org>
+
+ PR ld/3666
+ * elflink.c (elf_link_add_object_symbols): Keep symbol
+ visibility for symbols from discarded section.
+
+2006-12-06 Alan Modra <amodra@bigpond.net.au>
+
+ * elf64-alpha.c (elf64_alpha_merge_symbol_attribute): New function.
+ (elf_backend_merge_symbol_attribute): Define.
+
+2006-12-04 Jan Beulich <jbeulich@novell.com>
+
+ * elflink.c (_bfd_elf_link_create_dynamic_sections): Don't create
+ .eh_frame_hdr section from here anymore.
+ (bfd_elf_size_dynamic_sections): Call _bfd_elf_maybe_strip_eh_frame_hdr
+ a little earlier.
+
+2006-12-01 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR binutils/3609
+ * elf.c (rewrite_elf_program_header): Preserve segment physical
+ address in the output segment if the first section in the
+ corresponding input segment is null.
+
+2006-12-01 Nick Clifton <nickc@redhat.com>
+
+ PR 3609
+ * elf.c (rewrite_elf_program_header): Do not use the first_section
+ pointer if it is null.
+
+2006-11-29 Paul Brook <paul@codesourcery.com>
+
+ * elf32-arm.c (elf32_arm_to_thumb_export_stub): Assert that output
+ section is present.
+ (allocate_dynrelocs): Only add export stub for symbols defined in
+ this object.
+
+2006-11-29 Paul Brook <paul@codesourcery.com>
+
+ * elf32-arm.c (elf32_arm_to_thumb_export_stub): Assert that output
+ section is present.
+ (allocate_dynrelocs): Only add export stub for symbols defined in
+ this object.
+
+2006-11-29 Paul Brook <paul@codesourcery.com>
+ Julian Brown <julian@codesourcery.com>
+
+ * elf32-arm.c (copy_eabi_attributes): Correct starting offset.
+ (elf32_arm_merge_eabi_attributes): Mark output as initialized.
+ Only set Tag_CPU_name and Tag_ABI_PCS_R9_use if input attribute
+ is present.
+
+2006-11-27 Bob Wilson <bob.wilson@acm.org>
+
+ * elf32-xtensa.c (elf_xtensa_special_sections): Add .xtensa.info.
+
+2006-11-24 H.J. Lu <hongjiu.lu@intel.com>
+
+ * elf.c (IS_SECTION_IN_INPUT_SEGMENT): New.
+ (INCLUDE_SECTION_IN_SEGMENT): Use IS_SECTION_IN_INPUT_SEGMENT.
+ (rewrite_elf_program_header): Don't preserve segment physical
+ address in the output segment if the first section in the
+ corresponding input segment is removed.
+
+2006-11-22 Alan Modra <amodra@bigpond.net.au>
+
+ * pef.c (bfd_pef_make_empty_symbol): Delete function. Define instead.
+ * xsym.c (bfd_sym_make_empty_symbol): Likewise.
+ * xsym.h (bfd_sym_make_empty_symbol): Delete.
+
+2006-11-21 Greg McGary <greg@mcgary.org>
+
+ * elf32-ppc.c (ppc_elf_relocate_section): Fixup D field
+ at proper offset in little-endian mode.
+ * elf64-ppc.c (ppc_elf_relocate_section): Likewise.
+
+2006-11-21 Jakub Jelinek <jakub@redhat.com>
+
+ * elf-eh-frame.c (struct cie): New type.
+ (cie_compare): Removed.
+ (cie_eq, cie_hash, cie_compute_hash): New functions.
+ (_bfd_elf_discard_section_eh_frame): Rewrite not to rely on FDEs
+ pointing only to last CIE and allow merging of any duplicate CIEs,
+ not just duplicate consecutive CIEs.
+ (_bfd_elf_discard_section_eh_frame_hdr): Delete cies hash table.
+ * elf-bfd.h (struct cie_header, struct cie): Removed.
+ (struct eh_frame_sec_info): Remove alloced field.
+ (struct eh_frame_hdr_info): Remove last_cie, last_cie_sec
+ and last_cie_inf fields. Add cies field.
+
+2006-11-20 Alan Modra <amodra@bigpond.net.au>
+
+ * bfd-in.h (struct stat): Don't typedef.
+ * bfdio.c (bfd_get_size): Return a file_ptr.
+ * cisco-core.c (cisco_core_file_validate): Use bfd_size_type for nread.
+ * mmo.c (mmo_scan): Use file_ptr for curpos.
+ * trad-core.c (trad_unix_core): Don't cast statbuf.st_size to
+ unsigned long.
+ * bfd-in2.h: Regenerate.
+
+2006-11-20 Alan Modra <amodra@bigpond.net.au>
+
+ PR 3532
+ * bfd-in.h (struct bfd_hash_table): Reorganize. Add "frozen".
+ * hash.c (bfd_hash_table_init_n): Init frozen.
+ (bfd_hash_lookup): Don't grow if frozen.
+ (bfd_hash_traverse): Freeze hash table during traversal.
+ * bfd-in2.h: Regenerate.
+
+2006-11-18 Alan Modra <amodra@bigpond.net.au>
+
+ * elflink.c (_bfd_elf_check_kept_section): Test for kept group
+ section. Save result of checks in kept_section.
+ (_bfd_elf_section_already_linked): Tidy. Correct comments.
+ Ignore all group member sections. Handle special matching of
+ single-member groups against linkonce sections via their group
+ section. When such a match is found, set kept_section to the
+ group member section rather than to the group.
+
+2006-11-14 Phil Lello <phil.lello@homecall.co.uk>
+
+ * peXXigen.c: Updates for PE/COFF V8.0, and clarification
+ (dir_names): Added CLR Runtime Header to dir_names[].
+ (_bfd_XX_print_private_bfd_data_common): Added EFI_ROM and XBOX
+ subsystem names
+ (_bfd_XXi_swap_aouthdr_in, _bfd_XXi_swap_aouthdr_out)
+ (pe_print_idata, pe_print_edata)
+ (_bfd_XX_bfd_copy_private_bfd_data_common)
+ (_bfd_XXi_final_link_postscript): Use #DEFINEs for index into
+ DataDirectory.
+
+2006-11-13 Daniel Jacobowitz <dan@codesourcery.com>
+
+ * bfd-in.h (bfd_elf32_arm_process_before_allocation): Update
+ prototype.
+ (bfd_elf32_arm_set_byteswap_code): New prototype.
+ * bfd-in2.h: Regenerate.
+ * elf32-arm.c (bfd_elf32_arm_process_before_allocation): Don't take
+ byteswap_code as an argument. Revert 2006-11-01 change.
+ (bfd_elf32_arm_set_byteswap_code): New.
+ (elf32_arm_size_dynamic_sections): Call
+ bfd_elf32_arm_process_before_allocation.
+
+2006-11-10 Thiemo Seufer <ths@mips.com>
+
+ * config.bfd (mips*el-sde-elf*, mips*-sde-elf*): Drop ECOFF support
+ for SDE configs.
+
+2006-11-10 Nick Clifton <nickc@redhat.com>
+
+ * config.bfd: Move previously obsoleted targets to the REMOVED
+ list.
+ Add maxq-*-coff to the obsolete list.
+
+2006-11-10 Pedro Alves <pedro_alves@portugalmail.pt>
+
+ * pe-arm-wince.c (LOCAL_LABEL_PREFIX): Define as ".".
+ * pei-arm-wince.c (LOCAL_LABEL_PREFIX): Likewise.
+ * coff-arm.c (LOCAL_LABEL_PREFIX): Only define if not defined before.
+
+2006-11-07 Daniel Jacobowitz <dan@codesourcery.com>
+
+ * elf32-arm.c (find_thumb_glue): Add ERROR_MESSAGE argument; set it
+ on error.
+ (find_arm_glue): Likewise.
+ (elf32_thumb_to_arm_stub, elf32_arm_create_thumb_stub)
+ (elf32_arm_to_thumb_stub, elf32_arm_final_link_relocate): Add
+ ERROR_MESSAGE argument and pass it through.
+ (elf32_arm_to_thumb_export_stub): Update.
+ (elf32_arm_relocate_section): Use ERROR_MESSAGE and reloc_dangerous.
+
+2006-11-07 Alan Modra <amodra@bigpond.net.au>
+
+ * elf64-ppc.c (enum _ppc64_sec_type): New.
+ (struct _ppc64_elf_section_data): Move "t_symndx" into opd union,
+ and rename fields. Add sec_type and has_14bit_branch.
+ (struct ppc_link_hash_table): Remove has_14bit_branch.
+ (get_opd_info, get_tls_mask, ppc64_elf_edit_opd): Adjust.
+ (ppc64_elf_relocate_section): Likewise.
+ (ppc64_elf_check_relocs): Likewise. Set per-section has_14bit_branch.
+ (ppc64_elf_size_stubs): Don't set default group size here.
+ (group_sections): Instead do so here, and group sections using
+ their individual requirements.
+
+2006-11-07 Alan Modra <amodra@bigpond.net.au>
+
+ * elf64-ppc.c (struct ppc64_elf_obj_tdata): Remove "has_dotsym"
+ and union.
+ (struct ppc_link_hash_entry): Add "next_dot_sym".
+ (struct ppc_link_hash_table): Add "dot_syms".
+ (link_hash_newfunc): Make list of syms starting with a dot.
+ (ppc_get_stub_entry, adjust_opd_syms): Adjust.
+ (ppc64_elf_add_symbol_hook): Don't set has_dotsym.
+ (struct add_symbol_adjust_data): Delete.
+ (add_symbol_adjust): Simplify params and return.
+ (ppc64_elf_check_directives): Just process the "dot_syms" lists,
+ not all syms.
+
+2006-11-02 Daniel Jacobowitz <dan@codesourcery.com>
+
+ * libbfd-in.h (_bfd_clear_contents): New prototype.
+ * reloc.c (_bfd_clear_contents): New.
+ * libbfd.h: Regenerated.
+
+ * elf32-arm.c (elf32_arm_final_link_relocate): Use
+ _bfd_clear_contents.
+ * elf32-d10v.c (elf32_d10v_relocate_section): Likewise.
+ * elf32-hppa.c (elf32_hppa_relocate_section): Likewise.
+ * elf32-i386.c (elf_i386_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-xtensa.c (elf_xtensa_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-sparc.c (_bfd_sparc_elf_relocate_section): Likewise.
+
+ * elfxx-ia64.c (elfNN_ia64_relocate_section): Set value to
+ zero for discarded symbols.
+ * elfxx-mips.c (mips_elf_calculate_relocation): Likewise.
+
+2006-11-01 Thiemo Seufer <ths@mips.com>
+ David Ung <davidu@mips.com>
+
+ * elf-bfd.h (local_call_stubs): New member.
+ * elfxx-mips.c (FN_STUB_P, CALL_STUB_P, CALL_FP_STUB_P): New macros.
+ (mips_elf_calculate_relocation): Handle local mips16 call stubs.
+ (mips16_stub_section_p): Rename from mips_elf_stub_section_p, use
+ the new stub macros.
+ (_bfd_mips_elf_check_relocs): Handle call stubs for code which
+ mixes mips16 and mips32 functions. Use mips16_stub_section_p. Mark
+ used stubs with SEC_KEEP. Use the new stub macros.
+
+2006-11-01 Alan Modra <amodra@bigpond.net.au>
+
+ * elf32-arm.c (bfd_elf32_arm_process_before_allocation): Correct
+ check for PLT usage.
+
+2006-11-01 Daniel Jacobowitz <dan@codesourcery.com>
+
+ * elfxx-mips.c (mips_elf_merge_gots): Always use maxcnt.
+
+2006-10-31 Alan Modra <amodra@bigpond.net.au>
+
+ * elf.c (elfcore_write_note): Pad note descriptor to 4-byte
+ boundary. Tidy. Comment.
+
+2006-10-30 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR ld/3111
+ * elf-bfd.h (elf_obj_tdata): Add symbuf.
+ (_bfd_elf_section_already_linked): Add struct bfd_link_info *.
+ (_bfd_elf_check_kept_section): Likewise.
+ (bfd_elf_match_symbols_in_sections): Likewise.
+
+ * elf.c (assign_section_numbers): Updated to add
+ struct bfd_link_info *.
+ (bfd_elf_match_symbols_in_sections): Updated. Cache symbol
+ buffer if info->reduce_memory_overheads is false.
+
+ * elflink.c (match_group_member): Updated to add
+ struct bfd_link_info *.
+ (_bfd_elf_check_kept_section): Likewise.
+ (elf_link_input_bfd): Likewise.
+ (_bfd_elf_section_already_linked): Likewise.
+ (bfd_elf_final_link): Free symbol buffer if
+ info->reduce_memory_overheads is false.
+
+ * libbfd-in.h (_bfd_nolink_section_already_linked): Add
+ struct bfd_link_info *.
+ (_bfd_generic_section_already_linked): Likewise.
+ * libbfd.h: Regenerated.
+
+ * linker.c (bfd_section_already_linked): Add
+ struct bfd_link_info *.
+ (_bfd_generic_section_already_linked): Likewise.
+ * targets.c (bfd_target): Add struct bfd_link_info * to
+ _section_already_linked.
+ * bfd-in2.h: Regenerated.
+
+2006-10-30 Alan Modra <amodra@bigpond.net.au>
+
+ * bfd.c (bfd_error_type): Add bfd_error_on_input.
+ (input_bfd, input_error): New static vars.
+ (bfd_set_error): Handle bfd_error_on_input.
+ (bfd_errmsg): Likewise.
+ (bfd_perror): Simplify.
+ * archive.c (_bfd_write_archive_contents): Report errors on input.
+ * bfd-in2.h: Regenerate.
+
+2006-10-30 Alan Modra <amodra@bigpond.net.au>
+
+ * elf.c (elfcore_write_note): Pad to 4-byte boundary.
+
+2006-10-28 Richard Sandiford <richard@codesourcery.com>
+
+ * elf32-mips.c (elf_mips_howto_table_rel): Add R_MIPS_GLOB_DAT.
+ * elfn32-mips.c (elf_mips_howto_table_rel): Likewise.
+ (elf_mips_howto_table_rela): Likewise.
+ * elf64-mips.c (mips_elf64_howto_table_rel): Likewise.
+ (mips_elf64_howto_table_rela): Likewise.
+
+2006-10-26 H.J. Lu <hongjiu.lu@intel.com>
+
+ * elf.c (_bfd_elf_init_private_section_data): Assert output
+ section ELF type instead of check if it is SHT_NULL. Copy
+ OS/PROC specific flags from input section to output section.
+
+2006-10-27 Alan Modra <amodra@bigpond.net.au>
+
+ * section.c (SEC_KEEP): Update comment.
+ * bfd-in2.h: Regenerate.
+ * elflink.c (bfd_elf_gc_sections): Ignore SEC_EXCLUDE sections.
+ * merge.c (_bfd_merge_sections): Set SEC_KEEP on excluded sections.
+ * stabs.c (_bfd_discard_section_stabs): Likewise.
+ (_bfd_link_section_stabs): Likewise. Simplify abs_section check.
+
+2006-10-26 Ben Elliston <bje@au.ibm.com>
+
+ * reloc.c (_bfd_relocate_contents): Remove explicit case 0.
+
+ * elf.c (bfd_section_from_shdr): Remove extraneous breaks.
+ * targets.c (find_target): Remove extraneous break.
+
+2006-10-26 Ben Elliston <bje@au.ibm.com>
+
+ * coff-maxq.c (coff_maxq20_reloc): Remove unused variable `howto'.
+ (struct maxq_reloc_map): Unused; remove.
+ (maxq_reloc_map): Likewise.
+ (maxq_reloc_type_lookup): Remove loop over maxq_reloc_map.
+
+2006-10-26 Ben Elliston <bje@au.ibm.com>
+
+ * elf.c (bfd_elf_set_dyn_lib_class): Change second argument type
+ from int to enum dynamic_lib_link_class lib_class.
+ * bfd-in.h (bfd_elf_set_dyn_lib_class): Likewise.
+ * bfd-in2.h: Regenerate.
+
+2006-10-25 Alan Modra <amodra@bigpond.net.au>
+ Trevor Smigiel <Trevor_Smigiel@playstation.sony.com>
+ Yukishige Shibata <shibata@rd.scei.sony.co.jp>
+ Nobuhisa Fujinami <fnami@rd.scei.sony.co.jp>
+ Takeaki Fukuoka <fukuoka@rd.scei.sony.co.jp>
+
+ * cpu-spu.c: New file.
+ * elf32-spu.c: New file.
+ * elf32-spu.h: New file.
+ * archures.c: Add SPU support.
+ * config.bfd: Likewise.
+ * configure.in: Likewise.
+ * reloc.c: Likewise.
+ * targets.c: Likewise.
+ * Makefile.am: Likewise. Run "make dep-am".
+ * libbfd.h: Regenerate.
+ * bfd-in2.h: Regenerate.
+ * Makefile.in: Regenerate.
+ * configure: Regenerate.
+ * po/SRC-POTFILES.in: Regenerate.
+
+2006-10-23 Alan Modra <amodra@bigpond.net.au>
+
+ * elf64-ppc.c (ppc64_elf_edit_opd): Clarify comment.
+
+2006-10-23 Alan Modra <amodra@bigpond.net.au>
+
+ * elf32-score.c: Formatting.
+ (elf_backend_omit_section_dynsym): Define.
+ (score_elf_create_dynamic_relocation): Remove code copied from mips.
+ Don't use section syms in dynamic relocs. Remove unused param.
+ (score_elf_final_link_relocate): Remove unused param.
+
+2006-10-23 Alan Modra <amodra@bigpond.net.au>
+
+ * linker.c (fix_syms): Choose best of previous and next
+ section based on section flags and vma.
+
+2006-10-21 Kaz Kojima <kkojima@rr.iij4u.or.jp>
+
+ * elf32-sh64.c (sh64_elf_merge_symbol_attribute): Do merging
+ only when the non visibility part of st_other is non-zero.
+ * elf64-sh64.c (sh64_elf64_merge_symbol_attribute): Likewise.
+
+2006-10-20 Richard Sandiford <richard@codesourcery.com>
+
+ * elfxx-mips.c (_bfd_mips_elf_modify_segment_map): Don't extend
+ PT_DYNAMIC on GNU/Linux targets.
+
+2006-10-20 Richard Sandiford <richard@codesourcery.com>
+
+ * elfxx-mips.c (_bfd_mips_elf_finish_dynamic_sections): Make the
+ size of .rel.dyn reflect the value of DT_RELSZ.
+
+2006-10-20 Richard Sandiford <richard@codesourcery.com>
+
+ * elfxx-mips.c (_bfd_mips_elf_additional_program_headers): Allocate
+ a PT_NULL header for dynamic objects.
+ (_bfd_mips_elf_modify_segment_map): Add it.
+
+2006-10-19 Mei Ligang <ligang@sunnorth.com.cn>
+
+ * elf32-score.c (score_elf_rel_dyn_section): Replace
+ bfd_make_section with bfd_make_section_with_flags.
+ (_bfd_score_elf_create_dynamic_sections): Ditto.
+ (score_elf_create_got_section): Ditto.
+ (score_elf_final_link_relocate): Delete referrence to
+ EF_SCORE_HASENTRY.
+
+2006-10-19 Richard Sandiford <richard@codesourcery.com>
+
+ * elfxx-mips.c (sort_dynamic_relocs): Sort relocations against the
+ same symbol by increasing r_offset.
+ (sort_dynamic_relocs_64): Likewise. Fix comparisons between very
+ large and very small symbol indexes.
+
+2006-10-19 Richard Sandiford <richard@codesourcery.com>
+
+ * elfxx-mips.c (_bfd_mips_elf_size_dynamic_sections): Add DT_DEBUG
+ and DT_MIPS_RLD_MAP tags for position-independent executables.
+ Do not add DT_DEBUG to shared libraries for any MIPS target.
+
+2006-10-18 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR ld/3290
+ * elflink.c (elf_link_add_object_symbols): Hide definitions in
+ debug sections.
+
+2006-10-19 Alan Modra <amodra@bigpond.net.au>
+
+ * elf32-arm.c (bfd_elf32_arm_allocate_interworking_sect): Check,
+ don't set, glue section size.
+ (record_arm_to_thumb_glue): Set glue section size here.
+ (record_thumb_to_arm_glue): Likewise.
+ (bfd_elf32_arm_add_glue_sections_to_bfd): Formatting.
+ (bfd_elf32_arm_process_before_allocation): Ignore exluded sections.
+
+2006-10-18 Roy Marples <uberlord@gentoo.org>
+
+ * elf64-sparc.c: Add FreeBSD support.
+ (elf64_sparc_fbsd_post_process_headers): New function.
+ * targets.c (_bfd_target_vector): Add bfd_elf64_sparc_freebsd_vec.
+ * config.bfd (sparc64-*-freebsd*): Set targ_defvec to bfd_elf64_sparc_freebsd_vec.
+ * configure.in: Add entry for bfd_elf64_sparc_freebsd_vec.
+ * configure: Regenerate.
+
+2006-10-17 Mark Shinwell <shinwell@codesourcery.com>
+
+ * elf32-arm.c (elf32_arm_final_link_relocate): Add support for
+ R_ARM_MOVW_BREL_NC, R_ARM_MOVW_BREL, R_ARM_MOVT_BREL,
+ R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVW_BREL and
+ R_ARM_THM_MOVT_BREL relocations.
+
+2006-10-17 Mark Shinwell <shinwell@codesourcery.com>
+
+ * elf32-arm.c (elf32_arm_howto_table_1): Change offset for
+ R_THM_CALL to 25 and remove FIXME comment.
+ (using_thumb2): New function.
+ (elf32_arm_final_link_relocate): Cope with Thumb-2 BL encoding.
+
+2006-10-17 Mark Shinwell <shinwell@codesourcery.com>
+
+ * elf32-arm.c (elf32_arm_final_link_relocate): Add cases
+ for R_ARM_ABS32_NOI and R_ARM_REL32_NOI.
+ (elf32_arm_gc_sweep_hook): Likewise.
+ (elf32_arm_check_relocs): Likewise.
+ (allocate_dynrelocs): Likewise.
+
+2006-10-17 Alan Modra <amodra@bigpond.net.au>
+
+ * elf-bfd.h (struct elf_link_hash_table): Reorder. Add
+ text_index_section and data_index_section.
+ (struct elf_backend_data): Add elf_backend_init_index_section.
+ (_bfd_elf_init_1_index_section): Declare.
+ (_bfd_elf_init_2_index_sections): Declare.
+ * elfxx-target.h (elf_backend_init_index_section): Define.
+ (elfNN_bed): Init new field.
+ * elflink.c (_bfd_elf_link_omit_section_dynsym): Keep first tls
+ section and text_index_section plus data_index_section.
+ (_bfd_elf_link_renumber_dynsyms): Clear dynindx on omitted sections.
+ (_bfd_elf_init_1_index_section): New function.
+ (_bfd_elf_init_2_index_sections): New function.
+ (bfd_elf_size_dynsym_hash_dynstr): Call elf_backend_init_index_section.
+ (elf_link_input_bfd): When emitting relocs, use text_index_section
+ and data_index_section for removed sections.
+ * elf-m10300.c (elf_backend_omit_section_dynsym): Define.
+ * elf32-i386.c: Likewise.
+ * elf32-m32r.c: Likewise.
+ * elf32-sh.c: Likewise.
+ * elf32-xstormy16.c: Likewise.
+ * elf32-xtensa.c: Likewise.
+ * elf64-alpha.c: Likewise.
+ * elf64-hppa.c: Likewise.
+ * elf64-mmix.c: Likewise.
+ * elf64-sh64.c: Likewise.
+ * elfxx-ia64.c: Likewise.
+ * elf32-arm.c (elf32_arm_final_link_relocate): Use text_index_section
+ and data_index_section sym for relocs against sections with no dynamic
+ section sym.
+ (elf_backend_init_index_section): Define.
+ * elf32-cris.c: Similarly.
+ * elf32-hppa.c: Similarly.
+ * elf32-i370.c: Similarly.
+ * elf32-m68k.c: Similarly.
+ * elf32-mips.c: Similarly.
+ * elf32-ppc.c: Similarly.
+ * elf32-s390.c: Similarly.
+ * elf32-sparc.c: Similarly.
+ * elf32-vax.c: Similarly.
+ * elf64-mips.c: Similarly.
+ * elf64-ppc.c: Similarly.
+ * elf64-s390.c: Similarly.
+ * elf64-sparc.c: Similarly.
+ * elf64-x86-64.c: Similarly.
+ * elfn32-mips.c: Similarly.
+ * elfxx-mips.c: Similarly.
+ * elfxx-sparc.c: Similarly.
+ * linker.c (fix_syms): Base symbols in removed sections on
+ previous section in preference to using absolute section.
+
+2006-10-16 Andreas Schwab <schwab@suse.de>
+
+ * elfxx-ia64.c (addend_compare): Properly compute return value.
+
+2006-10-15 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR ld/3314
+ * elf.c (assign_file_positions_for_non_load_sections): Don't
+ page align empty SHF_ALLOC sections.
+
+2006-10-13 Jakub Jelinek <jakub@redhat.com>
+
+ * elfxx-sparc.c (_bfd_sparc_elf_finish_dynamic_sections): Set
+ .plt sh_entsize to 0 if plt header size isn't multiple of
+ plt entry size or for 32-bit which adds a nop insn at the
+ end of the .plt section.
+
+2006-10-12 Bob Wilson <bob.wilson@acm.org>
+
+ * elf32-xtensa.c (elf_xtensa_action_discarded): New.
+ (elf_backend_action_discarded): Define.
+
+2006-10-11 Bob Wilson <bob.wilson@acm.org>
+
+ * elf32-xtensa.c (elf_xtensa_relocate_section): Return after
+ unresolvable relocation error.
+ (elf_xtensa_finish_dynamic_symbol): Set value of undefined, weak
+ symbols to zero.
+
+2006-10-10 Bob Wilson <bob.wilson@acm.org>
+
+ * elf32-xtensa.c (elf_xtensa_size_dynamic_sections): Add DT_DEBUG
+ for PIE executables.
+
+2006-10-03 Jakub Jelinek <jakub@redhat.com>
+
+ * elf-bfd.h (struct eh_cie_fde): Add set_loc pointer.
+ * elf-eh-frame.c (skip_cfa_op): Fix handling of DW_CFA_advance_loc.
+ Handle DW_CFA_{remember,restore}_state, DW_CFA_GNU_window_save,
+ DW_CFA_val_{offset{,_sf},expression}.
+ (skip_non_nops): Record number of DW_CFA_set_loc ops.
+ (_bfd_elf_discard_section_eh_frame): Require skip_non_nops recognizes
+ all ops. If there are any DW_CFA_set_loc ops and they are pcrel
+ or going to be pcrel, compute set_loc array.
+ (_bfd_elf_eh_frame_section_offset): If make_relative, kill relocations
+ against DW_CFA_set_loc operands.
+ (_bfd_elf_write_section_eh_frame): Handle DW_CFA_set_loc adjusting.
+
+2006-10-02 Daniel Jacobowitz <dan@codesourcery.com>
+
+ * elflink.c (_bfd_elf_merge_symbol): Discard references to TLS
+ symbols from the --just-syms file.
+
+2006-10-01 Alan Modra <amodra@bigpond.net.au>
+
+ * elf64-ppc.c (ppc64_elf_build_stubs): Test glink size for
+ existence of PLT.
+
+2006-09-29 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR ld/3283
+ * elf64-x86-64.c (elf64_x86_64_relocate_section): Don't ignore
+ relocation overflow on branches to undefweaks.
+
+2006-09-29 Alan Modra <amodra@bigpond.net.au>
+
+ * po/BLD-POTFILES.in: Regenerate.
+ * po/SRC-POTFILES.in: Regenerate.
+
+2006-09-29 Danny Smith <dannysmith@users.sourceforge.net>
+
+ PR 3276
+ * pei-i386.c (COFF_SECTION_ALIGNMENT_ENTRIES): Enable 16 byte
+ alignment for .data$, .rdata$ and .text$ sections so that sse
+ and sse2 code will work for linkonce sections too.
+ * pe-i386.c (COFF_SECTION_ALIGNMENT_ENTRIES): Likewise.
+
+2006-09-28 Alan Modra <amodra@bigpond.net.au>
+
+ * elflink.c (_bfd_elf_gc_mark_hook): New function.
+ * elf-bfd.h (_bfd_elf_gc_mark_hook): Declare.
+ * elfxx-target.h (elf_backend_gc_mark_hook): Default to above.
+ * elf-m10300.c (mn10300_elf_gc_mark_hook): Use _bfd_elf_gc_mark_hook.
+ * elf32-arm.c (elf32_arm_gc_mark_hook): Likewise.
+ * elf32-cris.c (cris_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-ppc.c (ppc_elf_gc_mark_hook): Likewise.
+ * elf32-s390.c (elf_s390_gc_mark_hook): Likewise.
+ * elf32-score.c (_bfd_score_elf_gc_mark_hook): Likewise.
+ * elf32-sh.c (sh_elf_gc_mark_hook): Likewise.
+ * elf32-vax.c (elf_vax_gc_mark_hook): Likewise.
+ * elf32-xtensa.c (elf_xtensa_gc_mark_hook): Likewise.
+ * elf64-mmix.c (mmix_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.
+ * elfxx-mips.c (_bfd_mips_elf_gc_mark_hook): Likewise.
+ * elfxx-sparc.c (_bfd_sparc_elf_gc_mark_hook): Likewise.
+ * elf32-bfin.c (bfin_gc_mark_hook): Likewise.
+ (bfinfdpic_gc_sweep_hook): Delete.
+ (elf_backend_gc_sweep_hook): Don't define for elf32-bfinfdpic.
+ * elf32-d10v.c (elf32_d10v_gc_mark_hook): Use _bfd_elf_gc_mark_hook.
+ (elf32_d10v_gc_sweep_hook): Delete.
+ (elf_backend_gc_sweep_hook): Don't define.
+ * elf32-fr30.c (fr30_elf_gc_mark_hook): Use _bfd_elf_gc_mark_hook.
+ (fr30_elf_gc_sweep_hook): Delete.
+ (elf_backend_gc_sweep_hook): Don't define.
+ * elf32-frv.c (elf32_frv_gc_mark_hook): Use _bfd_elf_gc_mark_hook.
+ (elf32_frv_gc_sweep_hook): Delete.
+ (elf_backend_gc_sweep_hook): Don't define.
+ * elf32-iq2000.c (iq2000_elf_gc_mark_hook): Use _bfd_elf_gc_mark_hook.
+ (iq2000_elf_gc_sweep_hook): Delete.
+ (elf_backend_gc_sweep_hook): Don't define.
+ * elf32-openrisc.c (openrisc_elf_gc_mark_hook): Use
+ _bfd_elf_gc_mark_hook.
+ (openrisc_elf_gc_sweep_hook): Delete.
+ (elf_backend_gc_sweep_hook): Don't define.
+ * elf32-v850.c (v850_elf_gc_mark_hook): Use _bfd_elf_gc_mark_hook.
+ (v850_elf_gc_sweep_hook): Delete.
+ (elf_backend_gc_sweep_hook): Don't define.
+ * elf32-xstormy16.c (xstormy16_elf_gc_mark_hook): Use
+ _bfd_elf_gc_mark_hook.
+ (xstormy16_elf_gc_sweep_hook): Delete.
+ (elf_backend_gc_sweep_hook): Don't define.
+ * elf64-sh64.c (sh_elf64_gc_mark_hook): Use _bfd_elf_gc_mark_hook.
+ (sh_elf64_gc_sweep_hook): Delete.
+ (elf_backend_gc_sweep_hook): Don't define.
+ * elf32-avr.c (elf32_avr_gc_mark_hook): Delete.
+ (elf32_avr_gc_sweep_hook): Delete.
+ (elf_backend_gc_mark_hook, elf_backend_gc_mark_hook): Don't define.
+ * elf32-cr16c.c (elf32_cr16c_gc_mark_hook): Delete.
+ (elf32_cr16c_gc_sweep_hook): Delete.
+ (elf_backend_gc_mark_hook, elf_backend_gc_mark_hook): Don't define.
+ * elf32-crx.c (elf32_crx_gc_mark_hook): Delete.
+ (elf32_crx_gc_sweep_hook): Delete.
+ (elf_backend_gc_mark_hook, elf_backend_gc_mark_hook): Don't define.
+ * elf32-h8300.c (elf32_h8_gc_mark_hook): Delete.
+ (elf32_h8_gc_sweep_hook): Delete.
+ (elf_backend_gc_mark_hook, elf_backend_gc_mark_hook): Don't define.
+ * elf32-ip2k.c (ip2k_elf_gc_mark_hook): Delete.
+ (ip2k_elf_gc_sweep_hook): Delete.
+ (elf_backend_gc_mark_hook, elf_backend_gc_mark_hook): Don't define.
+ * elf32-m32c.c (m32c_elf_gc_mark_hook, m32c_elf_gc_sweep_hook): Delete.
+ (elf_backend_gc_mark_hook, elf_backend_gc_mark_hook): Don't define.
+ * elf32-m68hc11.c (elf_backend_gc_mark_hook): Don't define.
+ (elf_backend_gc_sweep_hook): Don't define.
+ * elf32-m68hc12.c (elf_backend_gc_mark_hook): Don't define.
+ (elf_backend_gc_sweep_hook): Don't define.
+ * elf32-m68hc1x.c (elf32_m68hc11_gc_mark_hook): Delete.
+ (elf32_m68hc11_gc_sweep_hook): Delete.
+ * elf32-m68hc1x.h (elf32_m68hc11_gc_mark_hook): Delete.
+ (elf32_m68hc11_gc_sweep_hook): Delete.
+ * elf32-msp430.c (elf32_msp430_gc_mark_hook): Delete.
+ (elf32_msp430_gc_sweep_hook): Delete.
+ (elf_backend_gc_mark_hook, elf_backend_gc_mark_hook): Don't define.
+ * elf32-mt.c (mt_elf_gc_mark_hook, mt_elf_gc_sweep_hook): Delete.
+ (elf_backend_gc_mark_hook, elf_backend_gc_mark_hook): Don't define.
+
+2006-09-25 Pedro Alves <pedro_alves@portugalmail.pt>
+
+ * bfd-in.h (CONST_STRNCPY) : Delete.
+ (LITSTRCPY) : New.
+ (LITMEMCPY) : New.
+ * bfd-in2.h : Regenerate.
+ * elflink.c (bfd_elf_gc_sections) : Use LITMEMCPY. Don't manually
+ calculate string lengths.
+ * nlmcode.h (nlm_swap_auxiliary_headers_in) : Use LITMEMCPY.
+
+2006-09-26 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR ld/3223
+ PR ld/3267
+ * elf.c (assign_file_positions_for_non_load_sections): Don't
+ warn zero size allocated sections.
+
+2006-09-27 Alan Modra <amodra@bigpond.net.au>
+
+ * elf32-score.c (_bfd_score_elf_relocate_section): Move assignment
+ to "name" so that compiler realizes it is never uninitialized.
+ Use bfd_elf_sym_name.
+
+2006-09-26 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR binutils/3262
+ * elf.c (rewrite_elf_program_header): Use bfd_zalloc instead of
+ bfd_alloc to allocate segment map.
+ (copy_elf_program_header): Likewise.
+
+2006-09-26 Mark Shinwell <shinwell@codesourcery.com>
+ Joseph Myers <joseph@codesourcery.com>
+ Ian Lance Taylor <ian@wasabisystems.com>
+ Ben Elliston <bje@wasabisystems.com>
+
+ * archures.c: Add definition for bfd_mach_arm_iWMMXt2.
+ * cpu-arm.c (processors): Add bfd_mach_arm_iWMMXt2.
+ (arch_info_struct, bfd_arm_update_notes): Likewise.
+ (architectures): Likewise.
+ (bfd_arm_merge_machines): Check for iWMMXt2.
+ * bfd-in2.h: Rebuild.
+
+2006-09-24 H.J. Lu <hongjiu.lu@intel.com>
+
+ * configure: Regenerated.
+
+2006-09-22 Alan Modra <amodra@bigpond.net.au>
+
+ * elfcode.h (elf_swap_symbol_in): Return bfd_boolean. Don't abort
+ on error.
+ * elf-bfd.h (elf_size_info <swap_symbol_in>): Adjust decl.
+ (bfd_elf32_swap_symbol_in, bfd_elf64_swap_symbol_in): Likewise.
+ * elf.c (bfd_elf_get_elf_syms): Test return of swap_symbol_in,
+ and report error.
+ * elf32-arm.c (elf32_arm_swap_symbol_in): Return bfd_boolean.
+
+2006-09-20 Martin Schwidefsky <schwidefsky@de.ibm.com>
+
+ * elf32-s390.c (elf_s390_relocate_section): Remove check for code
+ section in LD to LE linker relaxation for R_390_TLS_LDO32.
+ * elf64-s390.c (elf_s390_relocate_section): Likewise for
+ R_390_TLS_LDO64.
+
+2006-09-20 Kai Tietz <Kai.Tietz@onevision.com>
+
+ * configure.in: Added new target-vectors x86_64coff_vec,
+ x86_64pe_vec, and x86_64pei_vec.
+ * configure: Regenerate.
+ * config.bfd: Adjusted x86_64 target architecture detection.
+ * bfd.c: Add for new target "coff-x86-64"
+ (bfd_get_sign_extend): Add target vector idents for pe-x86-64. and pei-x86-64.
+ * coff-x86_64.c: Add new file for x86_64 (AMD64) coff support.
+ * libpei.h: Adjustments for COFF_WITH_pex64.
+ * coffcode.h: Add for new target machine, architecture, signature, and internal
+ signature handler.
+ * Makefile.am: Add new files to target-all and define make-rule for pex64igen.c
+ * Makefile.in: Regenerate.
+ * pe-x86_64.c: Add for new target "pe-x86-64".
+ * pei-x86_64.c: Add for new target "pei-x86-64".
+ * peicode.h: Adjusts for new targets.
+ (coff_swap_filehdr_out): Set for this target to
+ _bfd_pex64_only_swap_filehdr_out.
+ (SIZEOF_IDATA4): Define it as 8 byte size for this target.
+ (SIZEOF_IDATA5): Define it as 8 byte size for this target.
+ (jump_table jtab): Add for AMD64MAGIC.
+ (pe_ILF_build_a_bfd): Adjusts for new size of SIZEOF_IDATA4 and SIZE_IDATA5.
+ (pe_ILF_object_p): Add coff image-file signature to internal
+ signature translation.
+ * peXXigen.c: Adjust proper include of target coff-header and
+ introduced target specific code
+ (COFF_WITH_pex64): New macro for this target.
+ (pe_print_idata): New dumping method for import section of PE+ files.
+ * targets.c: Add new target vectors declarations for x86_64 coff targets.
+ * coffcode.h: Support code to support the x86_64 PE magic number.
+ * coff-x86_64.c: New file.
+
+2006-09-17 Hans-Peter Nilsson <hp@axis.com>
+
+ * elf.c (special_sections_s): Revert last STRING_COMMA_LEN change
+ for .stabstr entry, explain why.
+
+2006-09-17 Anton Blanchard <anton@samba.org>
+ Alan Modra <amodra@bigpond.net.au>
+
+ * dwarf2.c (concat_filename): Apply DW_AT_comp_dir if dir table
+ entry isn't absolute.
+
+2006-09-17 Mei Ligang <ligang@sunnorth.com.cn>
+
+ * cpu-score.c: New file.
+ * elf32-score.c: New file.
+ * config.bfd: Add Score target.
+ * Makefile.am: Add Score files.
+ * Makefile.in: Regenerate.
+ * archures.c: Add Score architecture.
+ * reloc.c: Add Score relocs.
+ * targets.c: Add Score target vectors.
+ * bfd-in2.h: Regenerate.
+ * libbfd.h: Regenerate.
+ * configure.in: Add Score target.
+ * configure: Regenerate.
+
+2006-09-16 Nick Clifton <nickc@redhat.com>
+ Pedro Alves <pedro_alves@portugalmail.pt>
+
+ * bfd-in.h (STRING_COMMA_LEN): New macro. Takes one constant
+ string as its argument and emits the string followed by a comma
+ and then the length of the string.
+ (CONST_STRNEQ): New macro. Checks to see if a variable string
+ has a constant string as its initial characters.
+ (CONST_STRNCPY): New macro. Copies a constant string to the start
+ of a variable string.
+ * bfd-in2.h: Regenerate.
+ * archive.c: Make use of the new macros.
+ * archive64.c: Likewise.
+ * bfd.c: Likewise.
+ * coff-ppc.c: Likewise.
+ * coff-stgo32.c: Likewise.
+ * coffcode.h: Likewise.
+ * cofflink.c: Likewise.
+ * cpu-i960.c: Likewise.
+ * dwarf2.c: Likewise.
+ * ecoff.c: Likewise.
+ * elf-m10300.c: Likewise.
+ * elf.c: Likewise.
+ * elf32-arm.c: Likewise.
+ * elf32-bfin.c: Likewise.
+ * elf32-cris.c: Likewise.
+ * elf32-hppa.c: Likewise.
+ * elf32-i370.c: Likewise.
+ * elf32-i386.c: Likewise.
+ * elf32-iq2000.c: Likewise.
+ * elf32-m32r.c: Likewise.
+ * elf32-m68hc11.c: Likewise.
+ * elf32-m68hc12.c: Likewise.
+ * elf32-m68k.c: Likewise.
+ * elf32-mcore.c: Likewise.
+ * elf32-ppc.c: Likewise.
+ * elf32-s390.c: Likewise.
+ * elf32-sh-symbian.c: Likewise.
+ * elf32-sh.c: Likewise.
+ * elf32-sh64.c: Likewise.
+ * elf32-v850.c: Likewise.
+ * elf32-vax.c: Likewise.
+ * elf32-xtensa.c: Likewise.
+ * elf64-alpha.c: Likewise.
+ * elf64-hppa.c: Likewise.
+ * elf64-mmix.c: Likewise.
+ * elf64-ppc.c: Likewise.
+ * elf64-s390.c: Likewise.
+ * elf64-sh64.c: Likewise.
+ * elf64-x86-64.c: Likewise.
+ * elflink.c: Likewise.
+ * elfxx-ia64.c: Likewise.
+ * elfxx-mips.c: Likewise.
+ * elfxx-sparc.c: Likewise.
+ * hpux-core.c: Likewise.
+ * i386linux.c: Likewise.
+ * ieee.c: Likewise.
+ * libpei.h: Likewise.
+ * linker.c: Likewise.
+ * m68klinux.c: Likewise.
+ * mmo.c: Likewise.
+ * nlmcode.h: Likewise.
+ * osf-core.c: Likewise.
+ * pef.c: Likewise.
+ * som.c: Likewise.
+ * sparclinux.c: Likewise.
+ * vms-hdr.c: Likewise.
+
+2006-09-14 Alan Modra <amodra@bigpond.net.au>
+
+ PR 3181
+ * elf.c (_bfd_elf_copy_private_header_data): Fix group members
+ that have had their SHT_GROUP section removed.
+
+2006-09-12 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR ld/3197
+ * elflink.c (elf_link_output_extsym): Compute bucket only if
+ needed.
+
+2006-09-10 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR binutils/3186
+ * elf.c (_bfd_elf_make_section_from_shdr): Correct length of
+ "gnu.linkonce.wi.".
+
+2006-09-08 Vladimir Prus <vladimir@codesourcery.com>
+
+ * elf32-arm.c (elf32_arm_swap_symbol_out): Remove
+ unconditional setting of low bit for Thumb symbol
+ mistakenly left behind after check for external
+ symbols was added. Fix comment typo.
+
+2006-09-07 H.J. Lu <hongjiu.lu@intel.com>
+
+ * elf-bfd.h (elf_link_hash_entry): Add a dynamic field.
+ (bfd_elf_link_mark_dynamic_symbol): New.
+ (SYMBOLIC_BIND): New.
+
+ * elf32-i386.c (elf_i386_check_relocs): Replace info->symbolic
+ with SYMBOLIC_BIND (info, h).
+ (elf_i386_relocate_section): Likewise.
+ * elf64-x86-64.c (elf64_x86_64_check_relocs): Likewise.
+ (elf64_x86_64_relocate_section): Likewise.
+ * elfxx-ia64.c (elfNN_ia64_check_relocs): Likewise.
+
+ * elflink.c (bfd_elf_link_mark_dynamic_symbol): New.
+ (bfd_elf_record_link_assignment): Call
+ bfd_elf_link_mark_dynamic_symbol on new entry.
+ (_bfd_elf_merge_symbol): Likewise.
+ (_bfd_elf_export_symbol): Return if the symbol isn't exported.
+ (_bfd_elf_fix_symbol_flags): Replace info->symbolic with
+ SYMBOLIC_BIND (info, h).
+ (_bfd_elf_dynamic_symbol_p): Likewise.
+ (_bfd_elf_symbol_refs_local_p): Likewise.
+ (bfd_elf_size_dynamic_sections): Updated.
+
+2006-09-05 Bibo Mao <bibo.mao@intel.com>
+
+ PR binutils/3171
+ * coffcode.h (coff_write_object_contents): Set the optional
+ header magic number to PE32PMAGIC instead of ZMAGIC for ia64.
+
+2006-09-04 Mark Shinwell <shinwell@codesourcery.com>
+
+ * elf32-arm.c (elf32_arm_howto_table_1): Adjust entries for
+ R_ARM_THM_ALU_PREL_11_0 and R_ARM_THM_PC12 relocations.
+ (elf32_arm_final_link_relocate): Handle R_ARM_THM_ALU_PREL_11_0
+ and R_ARM_THM_PC12 relocations.
+
+2006-08-24 Bob Wilson <bob.wilson@acm.org>
+
+ * elf32-xtensa.c (xtensa_get_property_section_name): Delete.
+ (xtensa_get_property_section): New.
+ (xtensa_read_table_entries): Use xtensa_get_property_section.
+ (relax_property_section, xtensa_get_property_predef_flags): Handle
+ group name suffixes in property section names.
+ (match_section_group): New.
+
+2006-08-23 Frediano Ziglio <Frediano.Ziglio@vodafone.com>
+
+ * archive.c (hpux_uid_gid_encode): Fix thinko decrementing "cnt"
+ variable.
+
+2006-08-22 Daniel Jacobowitz <dan@codesourcery.com>
+
+ * elf32-arm.c (elf32_arm_copy_indirect_symbol): Only copy
+ plt_thumb_refcount from indirect symbols.
+
+2006-08-22 Alan Modra <amodra@bigpond.net.au>
+
+ * elf32-ppc.c (ppc_elf_relocate_section): Correct GOT and PLT HA
+ reloc handling.
+ * elf64-ppc.c (ppc64_elf_relocate_section): Likewise.
+
+2006-08-21 Mark Shinwell <shinwell@codesourcery.com>
+
+ * elf32-arm.c (elf32_arm_link_hash_table): Correct typo in
+ comment for target1_is_rel.
+
+2006-08-21 Pedro Alves <pedro_alves@portugalmail.pt>
+
+ * Makefile.am: Add rules to build pe-arm-wince.lo
+ and pei-arm-wince.lo objects.
+ * Makefile.in: Regenerate.
+ * pe-arm-wince.c: New file.
+ * pei-arm-wince.c: New file.
+ * pei-arm.c: Remove ARM_WINCE block.
+ * pe-arm.c: Remove ARM_WINCE block. Rename
+ bfd_arm_pe_allocate_interworking_sections,
+ bfd_arm_pe_get_bfd_for_interworking, and
+ bfd_arm_pe_process_before_allocation to
+ bfd_armpe_allocate_interworking_sections,
+ bfd_armpe_get_bfd_for_interworking, and
+ bfd_armpe_process_before_allocation. Move them before
+ including bfd.h.
+ * bfd.c: ARM wince bfd format names were renamed. Adjust.
+ * coff-arm.c [ARM_WINCE]: Adjust so Windows CE doesn't end up
+ with unexpected/conflicting relocs.
+ * targets.c: The arm-wince-pe target got its own new vector.
+ Adjust.
+ * config.bfd: Likewise.
+ * configure.in: Likewise.
+ * configure: Regenerate.
+
+2006-08-18 Paul Brook <paul@codesourcery.com>
+
+ * elf32-arm.c (elf32_arm_link_hash_entry): Add export_glue.
+ (elf32_arm_link_hash_newfunc): Initialize export_glue.
+ (record_arm_to_thumb_glue): Return stub symbol.
+ (elf32_arm_create_thumb_stub): New function.
+ (elf32_arm_to_thumb_stub): Use it.
+ (elf32_arm_to_thumb_export_stub): New function.
+ (elf32_arm_begin_write_processing): New function.
+ (allocate_dynrelocs): Allocate Arm stubs.
+ (elf_backend_begin_write_processing): Define.
+ (elf32_arm_symbian_begin_write_processing): Remove ATTRIBUTE_UNUSED.
+ Call elf32_arm_begin_write_processing.
+
+2006-08-17 Alan Modra <amodra@bigpond.net.au>
+
+ * elf64-ppc.c (create_linkage_sections): Align .glink to 8 bytes.
+ (ppc64_elf_build_stubs): Use new lazy linking stub.
+
+2006-08-17 Alan Modra <amodra@bigpond.net.au>
+
+ * elf64-ppc.c (ppc64_elf_size_stubs): Ignore non-code sections.
+
+2006-08-16 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR ld/3015
+ * elf.c (get_program_header_size): Add a PT_GNU_RELRO segment
+ only if there is a PT_DYNAMIC segment.
+ (_bfd_elf_map_sections_to_segments): Likewise.
+ (assign_file_positions_for_load_sections): Set PT_GNU_RELRO
+ segment alignment to 1.
+
+2006-08-15 Thiemo Seufer <ths@mips.com>
+ Nigel Stephens <nigel@mips.com>
+
+ * elf32-mips.c, elf64-mips.c, elfn32-mips.c
+ (elf_backend_merge_symbol_attribute): Define.
+ * elflink.c (elf_link_add_object_symbols): Merge only the ELF
+ visibility flags.
+ * elfxx-mips.c (_bfd_mips_elf_merge_symbol_attribute): New function.
+
+2006-08-15 Thiemo Seufer <ths@mips.com>
+ Nigel Stephens <nigel@mips.com>
+ David Ung <davidu@mips.com>
+
+ * config.bfd: Add configurations for mips*el-sde-elf* and
+ mips*-sde-elf*.
+
+2006-08-14 DJ Delorie <dj@redhat.com>
+
+ * elf-m10300.c (elf32_mn10300_link_hash_entry): Add value.
+ (elf32_mn10300_count_hash_table_entries): New.
+ (elf32_mn10300_list_hash_table_entries): New.
+ (sort_by_value): New.
+ (mn10300_elf_relax_section): Don't skip data sections; restrict
+ code-specific tests to code-specific areas so that potential
+ indirect calls can be detected. Check for multiple local symbols
+ at the same address and merge their flags.
+ (elf32_mn10300_link_hash_newfunc): Initialize value.
+
+2006-08-14 Thiemo Seufer <ths@mips.com>
+
+ * elfxx-mips.c (_bfd_mips_elf_symbol_processing,
+ _bfd_mips_elf_add_symbol_hook): Don't try to place small common TLS
+ symbols in .scommon.
+
+2006-08-11 Thiemo Seufer <ths@mips.com>
+
+ * elfxx-mips.c (_bfd_mips_elf_finish_dynamic_sections): Set
+ sh_entsize only when sgot was already initialized.
+
+2006-08-08 DJ Delorie <dj@redhat.com>
+
+ * elf32-sh.c (sh_elf_relax_section): Allow for branches across
+ non-moving .align directives. Preserve any DIR32 offset when
+ converting bsr's to jsr's.
+
+2006-08-08 Alan Modra <amodra@bigpond.net.au>
+
+ * elf64-ppc.c (ppc64_elf_build_stubs): Clear relbrlt reloc_count
+ after stubs have been built.
+
+2006-08-07 Nick Clifton <nickc@redhat.com>
+
+ * elf32-sh.c (vxworks_object_p): Only check for vxworks target
+ vectors if they are going to be created.
+
+2006-08-07 Nick Clifton <nickc@redhat.com>
+
+ * configure.in (bfd_elf32_shnbsd_vec): Fix typo.
+ * configure: Regenerate.
+
+2006-08-07 Nick Clifton <nickc@redhat.com>
+
+ * coff-arm.c (coff_arm_rtype_to_howto): Only check for ARM_SECREL
+ relocation types if the target is ARM_WINCE.
+
+2006-08-05 Pedro Alves <pedro_alves@portugalmail.pt>
+
+ * bfd.c (bfd_get_sign_extend_vma): Add cases for pe-arm-little
+ and pei-arm-little.
+ * coff-arm.c (coff_arm_rtype_to_howto) [COFF_WITH_PE]: Handle
+ ARM_SECREL.
+ (coff_arm_reloc_type_lookup): Map BFD_RELOC_32_SECREL to
+ ARM_SECREL.
+ * pe-arm.c [COFF_SECTION_ALIGNMENT_ENTRIES]: Define.
+ * pei-arm.c [TARGET_UNDERSCORE]: Define for ARM_WINCE like in
+ pe-arm.c.
+ [COFF_SECTION_ALIGNMENT_ENTRIES]: Define.
+
+2006-08-04 Marcelo Tosatti <marcelo@kvack.org>
+
+ * elflink.c (elf_gc_sweep): If info.print_gc_sections is true,
+ list removed sections to stderr.
+
+2006-08-04 Richard Sandiford <richard@codesourcery.com>
+ Kazu Hirata <kazu@codesourcery.com>
+ Phil Edwards <phil@codesourcery.com>
+ Nathan Sidwell <nathan@codesourcery.com>
+
+ * config.bfd (sh-*-vxworks): Use bfd_elf32_shvxworks_vec and
+ bfd_elf32_shlvxworks_vec.
+ * configure.in (bfd_elf32_sh64_vec): Add elf-vxworks.lo.
+ (bfd_elf32_sh64l_vec, bfd_elf32_sh64lin_vec): Likewise.
+ (bfd_elf32_sh64blin_vec, bfd_elf32_sh64lnbsd_vec): Likewise.
+ (bfd_elf32_sh64nbsd_vec, bfd_elf32_sh_vec): Likewise.
+ (bfd_elf32_shblin_vec, bfd_elf32_shl_vec): Likewise.
+ (bfd_elf32_shl_symbian_vec, bfd_elf32_shlin_vec): Likewise.
+ (bfd_elf32_shlnbsd_vec, bfd_elf32_shnbsd_vec): Likewise.
+ (bfd_elf32_shlvxworks_vec, bfd_elf32_shvxworks_vec): New stanzas.
+ * configure: Regenerate.
+ * Makefile.am: Regenerate dependencies.
+ * Makefile.in: Regenerate.
+ * elf-vxworks.c (elf_vxworks_gott_symbol_p): New function.
+ (elf_vxworks_add_symbol_hook): Use it.
+ (elf_vxworks_link_output_symbol_hook): Likewise. Use the hash
+ table entry to check for weak undefined symbols and to obtain
+ the original bfd.
+ (elf_vxworks_emit_relocs): Use target_index instead of this_idx.
+ * elf32-sh-relocs.h: New file, split from elf32-sh.c.
+ (R_SH_DIR32): Use SH_PARTIAL32 for the partial_inplace field,
+ SH_SRC_MASK32 for the src_mask field, and SH_ELF_RELOC for the
+ special_function field.
+ (R_SH_REL32): Use SH_PARTIAL32 and SH_SRC_MASK32 here too.
+ (R_SH_REL32, R_SH_TLS_GD_32, R_SH_TLS_LD_32): Likewise.
+ (R_SH_TLS_LDO_32, R_SH_TLS_IE_32, R_SH_TLS_LE_32): Likewise.
+ (R_SH_TLS_DTPMOD32, R_SH_TLS_DTPOFF32, R_SH_TLS_TPOFF32): Likewise.
+ (R_SH_GOT32, R_SH_PLT32, R_SH_COPY, R_SH_GLOB_DAT): Likewise.
+ (R_SH_JMP_SLOT, R_SH_RELATIVE, R_SH_GOTOFF, R_SH_GOTPC): Likewise.
+ (SH_PARTIAL32, SH_SRC_MASK32, SH_ELF_RELOC): Undefine at end of file.
+ * elf32-sh.c: Include elf32-vxworks.h.
+ (MINUS_ONE): Define.
+ (sh_elf_howto_table): Include elf32-sh-relocs.h with SH_PARTIAL32
+ set to TRUE, SH_SRC_MASK32 set to 0xffffffff, and SH_ELF_RELOC set
+ to sh_elf_reloc.
+ (sh_vxworks_howto_table): New variable. Include elf32-sh-relocs.h
+ with SH_PARTIAL32 set to FALSE, SH_SRC_MASK32 set to 0, and
+ SH_ELF_RELOC set to bfd_elf_generic_reloc.
+ (vxworks_object_p, get_howto_table): New functions.
+ (sh_elf_reloc_type_lookup): Fix typo. Use get_howto_table.
+ (sh_elf_info_to_howto): Use get_howto_table.
+ (sh_elf_relax_section): Honor the partial_inplace field of the
+ R_SH_DIR32 howto.
+ (sh_elf_relax_delete_bytes): Likewise.
+ (elf_sh_plt_info): New structure.
+ (PLT_ENTRY_SIZE): Replace both definitions with...
+ (ELF_PLT_ENTRY_SIZE): ...this new macro, with separate definitions for
+ INCLUDE_SHMEDIA and !INCLUDE_SHMEDIA.
+ (elf_sh_plt0_entry_be): Update sizes of both definitions accordingly.
+ (elf_sh_plt0_entry_le): Likewise.
+ (elf_sh_plt_entry_be, elf_sh_plt_entry_le): Likewise.
+ (elf_sh_pic_plt_entry_be, elf_sh_pic_plt_entry_le): Likewise.
+ (elf_sh_plts): New structure, with separate definitions for
+ INCLUDE_SHMEDIA and !INCLUDE_SHMEDIA.
+ (elf_sh_plt0_entry): Delete both definitions.
+ (elf_sh_plt_entry, elf_sh_pic_plt_entry): Likewise.
+ (elf_sh_sizeof_plt, elf_sh_plt_plt0_offset): Likewise.
+ (elf_sh_plt_temp_offset, elf_sh_plt_symbol_offset): Likewise.
+ (elf_sh_plt_reloc_offset): Likewise.
+ (movi_shori_putval): Delete in favor of...
+ (install_plt_field): ...this new function, with separate definitions
+ for INCLUDE_SHMEDIA and !INCLUDE_SHMEDIA.
+ (get_plt_info): New function, with separate definitions
+ for INCLUDE_SHMEDIA and !INCLUDE_SHMEDIA.
+ (elf_sh_plt0_linker_offset, elf_sh_plt0_gotid_offset): Delete.
+ (VXWORKS_PLT_HEADER_SIZE, VXWORKS_PLT_ENTRY_SIZE): New macros.
+ (vxworks_sh_plt0_entry_be, vxworks_sh_plt0_entry_le): New constants.
+ (vxworks_sh_plt_entry_be, vxworks_sh_plt_entry_le): Likewise.
+ (vxworks_sh_pic_plt_entry_be, vxworks_sh_pic_plt_entry_le): Likewise.
+ (get_plt_index, get_plt_offset): New functions.
+ (elf_sh_link_hash_table): Add srelplt2, plt_info and vxworks_p fields.
+ (sh_elf_link_hash_table_create): Initialize them.
+ (sh_elf_create_dynamic_sections): Call
+ elf_vxworks_create_dynamic_sections for VxWorks.
+ (allocate_dynrelocs): Use htab->plt_info to get the size of PLT
+ entries. Allocate relocation entries in .rela.plt.unloaded if
+ generating a VxWorks executable.
+ (sh_elf_always_size_sections): New function.
+ (sh_elf_size_dynamic_sections): Extend .rela.plt handling to
+ .rela.plt.unloaded.
+ (sh_elf_relocate_section): Use get_howto_table. Honor
+ partial_inplace when calculating the addend for dynamic
+ relocations. Use get_plt_index.
+ (sh_elf_finish_dynamic_symbol): Use get_plt_index, install_plt_field
+ and htab->plt_info. Fill in the bra .plt offset for VxWorks
+ executables. Populate .rela.plt.unloaded. Do not make
+ _GLOBAL_OFFSET_TABLE_ absolute on VxWorks.
+ (sh_elf_finish_dynamic_sections): Use install_plt_field and
+ htab->plt_info. Handle cases where there is no special PLT header.
+ Populate the first relocation in .rela.plt.unloaded and fix up
+ the remaining entries.
+ (sh_elf_plt_sym_val): Use get_plt_info.
+ (elf_backend_always_size_sections): Define.
+ (TARGET_BIG_SYM, TARGET_BIG_NAME): Override for VxWorks.
+ (TARGET_LITTLE_SYM, TARGET_BIG_SYM): Likewise.
+ (elf32_bed, elf_backend_want_plt_sym): Likewise.
+ (elf_symbol_leading_char, elf_backend_want_got_underscore): Likewise.
+ (elf_backend_grok_prstatus, elf_backend_grok_psinfo): Likewise.
+ (elf_backend_add_symbol_hook): Likewise.
+ (elf_backend_link_output_symbol_hook): Likewise.
+ (elf_backend_emit_relocs): Likewise.
+ (elf_backend_final_write_processing): Likewise.
+ (ELF_MAXPAGESIZE, ELF_COMMONPAGESIZE): Likewise.
+ * targets.c (bfd_elf32_shlvxworks_vec): Declare.
+ (bfd_elf32_shvxworks_vec): Likewise.
+ (_bfd_target_vector): Include bfd_elf32_shlvxworks_vec and
+ bfd_elf32_shvxworks_vec.
+
+2006-08-02 Mark Kettenis <kettenis@gnu.org>
+
+ * configure.in (arm-*-openbsd*): Set COREFILE to netbsd-core.lo.
+ * configure: Regenerate.
+
+2006-08-02 Petr Salinger <Petr.Salinger@seznam.cz>
+
+ PR binutils/2983
+ * elf64-x86-64.c: Add FreeBSD support.
+ (elf64_x86_64_fbsd_post_process_headers): New function.
+ * targets.c (_bfd_target_vector): Add bfd_elf64_x86_64_freebsd_vec.
+ * config.bfd (x64_64-*-freebsd*): Add bfd_elf64_x86_64_freebsd_vec
+ to the targ_selvecs.
+ * configure.in: Add entry for bfd_elf64_x86_64_freebsd_vec.
+ * configure: Regenerate.
+
+2006-07-26 Andreas Schwab <schwab@suse.de>
+
+ * elfxx-ia64.c (elfNN_ia64_choose_gp): Use rawsize if set.
+
+2006-07-26 Alan Modra <amodra@bigpond.net.au>
+
+ * elf.c (elf_modify_segment_map): Delete empty PT_LOAD segments.
+ * elf32-xtensa.c (elf_xtensa_modify_segment_map): Delete.
+ (define elf_backend_modify_segment_map): Don't define.
+
+2006-07-25 Thiemo Seufer <ths@networkno.de>
+
+ * elfxx-mips.c (_bfd_mips_elf_merge_private_bfd_data): Allow
+ linking of objects for compatible machine types.
+
+2006-07-25 Thiemo Seufer <ths@networkno.de>
+
+ * elfxx-mips.c (mips_elf_next_relocation): Tighten check to test
+ also for same symbol.
+
+2006-07-25 Thiemo Seufer <ths@mips.com>
+
+ * elfxx-mips.c (mips_elf_calculate_relocation): Remove magic constant.
+
+2006-07-24 Michael Wetherell <mike.wetherell@ntlworld.com>
+
+ * elf.c (bfd_section_from_shdr): Reject unrecognised OS-specific
+ sections only if the SHF_OS_NONCONFORMING flag is present.
+
+2006-07-24 Nick Clifton <nickc@redhat.com>
+
+ PR ld/2729
+ * peXXigen.c (_bfd_XXi_final_link_postscript): Check for the
+ existance of output sections before putting their entries into the
+ DataDictionary.
+
+2006-07-20 Thiemo Seufer <ths@mips.com>
+
+ * elf32-mips.c (mips16_jump_reloc): Remove function.
+ (elf_mips16_howto_table_rel): Use _bfd_mips_elf_generic_reloc
+ instead of mips16_jump_reloc.
+ * elf64_mips.c, wlfn32-mips.c (mips16_jump_reloc): Remove function.
+ (elf_mips16_howto_table_rel, elf_mips16_howto_table_rela): Use
+ _bfd_mips_elf_generic_reloc instead of mips16_jump_reloc.
+
+2006-07-19 Alan Modra <amodra@bigpond.net.au>
+
+ * bfd-in.h (enum notice_asneeded_action): Define.
+ * bfd-in2.h: Regenerate.
+ * elflink.c (elf_link_add_object_symbols): Call linker "notice"
+ function with NULL name for as-needed handling.
+
+2006-07-18 Paul Brook <paul@codesourcery.com>
+
+ * bfd-in2.h: Regenerate.
+ * libbfd.h: Regenerate.
+ * reloc.c: Add BFD_RELOC_ARM_T32_ADD_IMM.
+
+2006-07-18 Nick Clifton <nickc@redhat.com>
+
+ * elfxx-mips.c (_bfd_mips_elf_common_definition): New function.
+ Consider SHN_MIPS_ACOMMON and SHN_MIPS_SCOMMON as being common
+ sections.
+ * elfxx-mips.h (_bfd_mips_elf_common_definition): Prototype.
+
+2006-07-14 Jakub Jelinek <jakub@redhat.com>
+
+ * elflink.c (bfd_elf_size_dynsym_hash_dynstr): Fix cinfo.shift2 value.
+
+2006-07-14 Mark Kettenis <kettenis@gnu.org>
+
+ * elflink.c (bfd_elf_size_dynsym_hash_dynstr): Move declarations
+ to the start of a block.
+
+2006-07-13 Nick Clifton <nickc@redhat.com>
+
+ * coff-sh.c (_bfd_sh_align_load_span): Catch sh_insn_info()
+ returning a NULL value.
+
+2006-07-12 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR ld/2884
+ * elflink.c (_bfd_elf_merge_symbol): Copy the symbol info from
+ the old versioned dynamic definition to the new one with
+ non-default visibility. Hide the symbol if it is hidden or
+ internal.
+
+2006-07-12 Matthew R. Dempsky <mrd@alkemio.org>
+
+ * cpu-m68k.c (bfd_m68k_compatible): Handle CPU32.
+
+2006-07-10 Jakub Jelinek <jakub@redhat.com>
+
+ * elf.c (_bfd_elf_print_private_bfd_data): Handle DT_GNU_HASH.
+ (bfd_section_from_shdr, elf_fake_sections, assign_section_numbers):
+ Handle SHT_GNU_HASH.
+ (special_sections_g): Include .gnu.hash section.
+ (bfd_elf_gnu_hash): New function.
+ * elf-bfd.h (bfd_elf_gnu_hash, _bfd_elf_hash_symbol): New prototypes.
+ (struct elf_backend_data): Add elf_hash_symbol method.
+ * elflink.c (_bfd_elf_link_create_dynamic_sections): Create .hash
+ only if info->emit_hash, create .gnu.hash section if
+ info->emit_gnu_hash.
+ (struct collect_gnu_hash_codes): New type.
+ (elf_collect_gnu_hash_codes, elf_renumber_gnu_hash_syms,
+ _bfd_elf_hash_symbol): New functions.
+ (compute_bucket_count): Don't compute HASHCODES array, instead add
+ that and NSYMS as arguments. Use bed->s->sizeof_hash_entry
+ instead of bed->s->arch_size / 8. Fix .hash size estimation.
+ When not optimizing, use the number of hashed symbols rather than
+ dynsymcount.
+ (bfd_elf_size_dynamic_sections): Only add DT_HASH if info->emit_hash,
+ and ADD DT_GNU_HASH if info->emit_gnu_hash.
+ (bfd_elf_size_dynsym_hash_dynstr): Size .hash only if info->emit_hash,
+ adjust compute_bucket_count caller. Create and populate .gnu.hash
+ section if info->emit_gnu_hash.
+ (elf_link_output_extsym): Only populate .hash section if
+ finfo->hash_sec != NULL.
+ (bfd_elf_final_link): Adjust assertion. Handle DT_GNU_HASH.
+ * elfxx-target.h (elf_backend_hash_symbol): Define if not yet defined.
+ (elfNN_bed): Add elf_backend_hash_symbol.
+ * elf64-x86-64.c (elf64_x86_64_hash_symbol): New function.
+ (elf_backend_hash_symbol): Define.
+ * elf32-i386.c (elf_i386_hash_symbol): New function.
+ (elf_backend_hash_symbol): Define.
+
+2006-07-05 Nick Clifton <nickc@redhat.com>
+
+ PR ld/2659
+ * cofflink.c (_bfd_coff_link_input_bfd): Fix selection of aux
+ entry when multiple definitions of a symbol are encountered.
+
+2006-06-30 H.J. Lu <hongjiu.lu@intel.com>
+
+ * elf32-i386.c (elf_i386_relocate_section): Use xchg %ax,%ax
+ instead of 2 nops.
+ * elf64-x86-64.c (elf64_x86_64_relocate_section): Likewise.
+ (elf64_x86_64_plt0_entry): Use nopl 0(%rax) instead of 4 nops.
+
+2006-06-29 Jakub Jelinek <jakub@redhat.com>
+
+ PR ld/2513
+ * elf32-i386.c (GOT_TLS_MASK, GOT_TLS_IE_IE, GOT_TLS_IE_GD,
+ GOT_TLS_IE_MASK, elf_i386_check_relocs, allocate_dynrelocs): Revert
+ 2006-04-08 changes.
+ (elf_i386_relocate_section): Likewise. For GD->IE transition
+ change subl into addl whenever tls_type is GOT_TLS_IE_POS.
+
+2006-06-23 Alan Modra <amodra@bigpond.net.au>
+
+ PR ld/2754
+ * elf.c (bfd_elf_mkobject): Don't alloc if already done. Set
+ program_header_size to -1.
+ (_bfd_elf_map_sections_to_segments): Adjust program_header_size check.
+ (assign_file_positions_for_load_sections ): Likewise.
+ (_bfd_elf_sizeof_headers): Use saved program_header_size if
+ available.
+ * elf32-arm.c (elf32_arm_mkobject): Call bfd_elf_mkobject, don't
+ alloc if already done.
+ * elf32-i386.c (elf_i386_mkobject): Likewise.
+ * elf32-ppc.c (ppc_elf_mkobject): Likewise.
+ * elf32-s390.c (elf_s390_mkobject): Likewise.
+ * elf32-sh.c (sh_elf_mkobject): Likewise.
+ * elf64-alpha.c (elf64_alpha_mkobject): Likewise.
+ * elf64-ppc.c (ppc64_elf_mkobject): Likewise.
+ * elf64-s390.c (elf_s390_mkobject): Likewise.
+ * elf64-x86-64.c (elf64_x86_64_mkobject): Likewise.
+ * elfxx-sparc.c (_bfd_sparc_elf_mkobject): Likewise.
+
+2006-06-20 Jakub Jelinek <jakub@redhat.com>
+
+ * elflink.c (elf_link_add_object_symbols): Don't create .tcommon
+ section for relocatable link.
+
+2006-06-21 Alan Modra <amodra@bigpond.net.au>
+
+ * elf-bfd.h (struct elf_backend_data): Add
+ elf_backend_modify_program_headers.
+ * elfxx-target.h (elf_backend_modify_program_headers): Define.
+ (elfNN_bed): Init new field.
+ * elf.c (elf_modify_segment_map): Remove comment.
+ (assign_file_positions_for_load_sections): Only call
+ elf_modify_segment_map for objcopy/strip.
+ (assign_file_positions_except_relocs): Call
+ elf_backend_modify_program_headers.
+ * elf32-frv.c (elf32_frvfdpic_always_size_sections): Don't make
+ .stack section.
+ (elf32_frvfdpic_modify_segment_map): Delete.
+ (elf32_frvfdpic_modify_program_headers): New.
+ (elf_backend_modify_segment_map): Don't define.
+ (elf_backend_modify_program_headers): Define.
+ * elf32-bfin.c (elf32_bfinfdpic_always_size_sections): Don't make
+ .stack section.
+ (elf32_bfinfdpic_modify_segment_map): Delete.
+ (elf32_bfinfdpic_modify_program_headers): New.
+ (elf_backend_modify_segment_map): Don't define.
+ (elf_backend_modify_program_headers): Define.
+ * elfxx-ia64.c (elfNN_ia64_modify_program_headers): New function.
+ Split out from..
+ (elfNN_ia64_modify_segment_map): ..here.
+ (elf_backend_modify_program_headers): Define.
+
+2006-06-20 Jakub Jelinek <jakub@redhat.com>
+
+ * bfd.c (bfd_record_phdr): Clear p_align and p_align_valid fields.
+ * elf.c (_bfd_elf_link_hash_table_init): Clear hplt field.
+
+2006-06-20 Alan Modra <amodra@bigpond.net.au>
+
+ * elf-bfd.h: Formatting.
+ (_bfd_elf_map_sections_to_segments): Declare.
+ * elf-eh-frame.c (_bfd_elf_discard_section_eh_frame_hdr): Don't
+ clear program_header_size.
+ * elf.c (get_program_header_size): Move. Don't use or set saved
+ program_header_size here.
+ (elf_modify_segment_map): New function. Split out from..
+ (assign_file_positions_for_load_sections): ..here. Assert
+ header size is correct. Remove dead code.
+ (_bfd_elf_map_sections_to_segments): Rename from
+ map_sections_to_segments. Make global. Use get_program_header_size
+ when we need estimate of header size. Call elf_modify_segment_map.
+ Set program_header_size.
+ (print_segment_map): Delete.
+ (_bfd_elf_sizeof_headers): If segment_map available, get the
+ actual size.
+ * elf32-arm.c (elf32_arm_symbian_modify_segment_map): Make safe
+ for calling more than once.
+ * elf32-bfin.c (elf32_bfinfdpic_modify_segment_map): Likewise.
+ * elf32-frv.c (elf32_frvfdpic_modify_segment_map): Likewise.
+ * elfxx-mips.c (_bfd_mips_elf_modify_segment_map): Likewise.
+ * elf32-i370.c (elf_backend_add_symbol_hook): Delete.
+ (elf_backend_additional_program_headers): Delete.
+ (elf_backend_modify_segment_map): Delete.
+ * elf64-hppa.c (elf64_hppa_modify_segment_map): Convert to ISO C.
+ * elfxx-ia64.c (elfNN_ia64_modify_segment_map): Likewise.
+ * doc/bfdint.texi: Delete SIZEOF_HEADERS difficulties.
+
+2006-06-19 Vladimir Prus <vladimir@codesourcery.com>
+
+ * elf32-arm.c (elf32_arm_swap_symbol_out): Don't set low
+ bit for undefined symbols.
+
+2006-06-19 Alan Modra <amodra@bigpond.net.au>
+
+ * elf-bfd.h (struct elf_backend_data): Add bfd_link_info pointer
+ parameter.
+ (_bfd_elf_sizeof_headers): Replace bfd_boolean param with
+ bfd_link_info pointer.
+ * targets.c (struct bfd_target <_bfd_sizeof_headers>): Likewise.
+ * bfd.c (bfd_sizeof_headers): Tweak param name.
+ * aout-adobe.c (aout_adobe_sizeof_headers): Adjust.
+ * aoutx.h (NAME (aout, sizeof_headers)): Adjust.
+ * binary.c (binary_sizeof_headers): Adjust.
+ * bout.c (b_out_sizeof_headers): Adjust.
+ * coff-rs6000.c (_bfd_xcoff_sizeof_headers): Adjust.
+ * coff64-rs6000.c (xcoff64_sizeof_headers): Adjust.
+ * coffgen.c (coff_sizeof_headers): Adjust.
+ * ecoff.c (_bfd_ecoff_sizeof_headers): Adjust.
+ (ecoff_compute_section_file_positions): Adjust.
+ (_bfd_ecoff_write_object_contents): Adjust.
+ * elf.c (get_program_header_size, _bfd_elf_sizeof_headers): Adjust.
+ * elf32-arm.c (elf32_arm_additional_program_headers): Adjust.
+ * elf32-i370.c (elf_backend_additional_program_headers): Adjust.
+ * elf32-ppc.c (ppc_elf_additional_program_headers): Adjust.
+ * elf64-hppa.c (elf64_hppa_additional_program_headers): Adjust.
+ * elf64-x86-64.c (elf64_x86_64_additional_program_headers): Adjust.
+ * elfxx-ia64.c (elfNN_ia64_additional_program_headers): Adjust.
+ * elfxx-mips.c (_bfd_mips_elf_additional_program_headers): Adjust.
+ * elfxx-mips.h (_bfd_mips_elf_additional_program_headers): Adjust.
+ * i386msdos.c: Convert to ISO C.
+ (msdos_sizeof_headers): Adjust.
+ * i386os9k.c: Convert to ISO C.
+ (os9k_sizeof_headers): Adjust.
+ * ieee.c (ieee_sizeof_headers): Adjust.
+ * ihex.c (ihex_sizeof_headers): Adjust.
+ * libaout.h (NAME (aout, sizeof_headers)): Adjust.
+ * libbfd-in.h (_bfd_nolink_sizeof_headers): Adjust.
+ * libcoff-in.h (coff_sizeof_headers): Adjust.
+ * libecoff.h (_bfd_ecoff_sizeof_headers): Adjust.
+ * mach-o.c (bfd_mach_o_sizeof_headers): Adjust.
+ * mmo.c (mmo_sizeof_headers): Adjust.
+ * oasys.c (oasys_sizeof_headers): Adjust.
+ * pdp11.c (NAME (aout, sizeof_headers)): Adjust.
+ * pef.c (bfd_pef_sizeof_headers): Adjust.
+ * ppcboot.c (ppcboot_sizeof_headers): Adjust.
+ * som.c (som_sizeof_headers): Adjust.
+ * srec.c (srec_sizeof_headers): Adjust.
+ * tekhex.c (tekhex_sizeof_headers): Adjust.
+ * versados.c (versados_sizeof_headers): Adjust.
+ * vms.c (vms_sizeof_headers): Adjust.
+ * xcoff-target.h (_bfd_xcoff_sizeof_headers): Adjust.
+ * xsym.c (bfd_sym_sizeof_headers): Adjust.
+ * xsym.h (bfd_sym_sizeof_headers): Adjust.
+ * bfd-in2.h: Regenerate.
+ * libbfd.h: Regenerate.
+ * libcoff.h: Regenerate.
+
+2006-06-15 Mark Shinwell <shinwell@codesourcery.com>
+
+ * bfd-in2.h: Regenerate.
+ * elf32-arm.c (R_ARM_ALU_PC_G0_NC, R_ARM_ALU_PC_G0,
+ R_ARM_ALU_PC_G1_NC, R_ARM_ALU_PC_G1, R_ARM_ALU_PC_G2,
+ R_ARM_LDR_PC_G1, R_ARM_LDR_PC_G2, R_ARM_LDRS_PC_G0,
+ R_ARM_LDRS_PC_G1, R_ARM_LDRS_PC_G2, R_ARM_LDC_PC_G0,
+ R_ARM_LDC_PC_G1, R_ARM_LDC_PC_G2, R_ARM_ALU_SB_G0_NC,
+ R_ARM_ALU_SB_G0, R_ARM_ALU_SB_G1_NC, R_ARM_ALU_SB_G1,
+ R_ARM_ALU_SB_G2, R_ARM_LDR_SB_G0, R_ARM_LDR_SB_G1,
+ R_ARM_LDR_SB_G2, R_ARM_LDRS_SB_G0, R_ARM_LDRS_SB_G1,
+ R_ARM_LDRS_SB_G2, R_ARM_LDC_SB_G0, R_ARM_LDC_SB_G1,
+ R_ARM_LDC_SB_G2): New relocation types.
+ (R_ARM_PC13): Rename to AAELF name R_ARM_LDR_PC_G0 and
+ adjust HOWTO entry to be consistent with R_ARM_LDR_PC_G1
+ and friends.
+ (elf32_arm_howto_table_3): Delete; contents merged into
+ elf32_arm_howto_table_2.
+ (elf32_arm_howto_from_type): Adjust correspondingly.
+ (elf32_arm_reloc_map): Extend with the above relocations.
+ (calculate_group_reloc_mask): New function.
+ (identify_add_or_sub): New function.
+ (elf32_arm_final_link_relocate): Support for the above
+ relocations.
+ * reloc.c: Add enumeration entries for BFD_RELOC_ARM_...
+ codes to correspond to the above relocations.
+
+2006-06-14 Richard Sandiford <richard@codesourcery.com>
+
+ * elf32-m68k.c (elf_m68k_plt_info): New structure.
+ (elf_m68k_plt0_entry): Add R_68K_PC32-style in-place addends.
+ (elf_m68k_plt_entry): Likewise.
+ (elf_m68k_plt_info): New table.
+ (CFV4E_PLT_ENTRY_SIZE): Rename to...
+ (ISAB_PLT_ENTRY_SIZE): ...this.
+ (CFV4E_FLAG): Delete.
+ (elf_cfv4e_plt0_entry): Rename to...
+ (elf_isab_plt0_entry): ...this. Adjust comments. Use (-6,%pc,%d0)
+ for the second instruction too.
+ (elf_cfv4e_plt_entry): Rename to...
+ (elf_isab_plt_entry): ...this. Adjust comments and use (-6,%pc,%d0).
+ (elf_isab_plt_info): New table.
+ (CPU32_FLAG): Delete.
+ (PLT_CPU32_ENTRY_SIZE): Rename to...
+ (CPU32_PLT_ENTRY_SIZE): ...this.
+ (elf_cpu32_plt0_entry): Update bounds accordingly. Add R_68K_PC32-
+ style in-place addends.
+ (elf_cpu32_plt_entry): Likewise.
+ (elf_cpu32_plt_info): New table.
+ (elf_m68k_link_hash_table): Add a plt_info field.
+ (elf_m68k_link_hash_table_create): Initialize it.
+ (elf_m68k_get_plt_info): New function.
+ (elf_m68k_always_size_sections): Likewise.
+ (elf_m68k_adjust_dynamic_symbol): Use the plt_info hash table field.
+ (elf_m68k_install_pc32): New function.
+ (elf_m68k_finish_dynamic_symbol): Factor code using plt_info and
+ elf_m68k_install_pc32.
+ (elf_m68k_finish_dynamic_sections): Likewise.
+ (elf_m68k_plt_sym_val): Use elf_m68k_get_plt_info.
+ (elf_backend_always_size_sections): Define.
+
+2006-06-14 Alan Modra <amodra@bigpond.net.au>
+
+ * elflink.c (elf_link_add_object_symbols): Save and restore
+ struct bfd_hash_table table, size and count fields for
+ as-needed libs.
+
+2006-06-12 Thiemo Seufer <ths@mips.com>
+
+ * elf32-mips.c: Expand comment about ABI-mandated pagesize values.
+ (ELF_MAXPAGESIZE, ELF_COMMONPAGESIZE): define in a more obvious way.
+ * elf64-mips.c, elfn32-mips.c (ELF_MAXPAGESIZE): Fix value for IRIX6.
+ Delete old comments.
+ (ELF_COMMONPAGESIZE): Define in a more obvious way.
+
+2006-06-12 Nick Clifton <nickc@redhat.com>
+
+ PR binutils/2735
+ * elflink.c (elf_link_add_object_symbols): Fix the warning message
+ about mismatched alignments to allow for the case where the common
+ alignment has been deduced from the section alignment.
+ * bfd.c (_bfd_default_error_handler): Update comment to explain
+ why bfd and asection varargs are out of order. Explicitly catch
+ and abort on NULL bfd and asection arguments.
+
+2006-06-11 Richard Sandiford <richard@codesourcery.com>
+ Thiemo Seufer <ths@mips.com>
+
+ * elfxx-mips.c (mips_elf_link_hash_table): Add function_stub_size.
+ (STUB_ORI): New macro.
+ (STUB_LI16U): Fix formatting.
+ (MIPS_FUNCTION_STUB_SIZE): Delete.
+ (MIPS_FUNCTION_STUB_MAX_SIZE): Likewise.
+ (MIPS_FUNCTION_STUB_NORMAL_SIZE): New macro.
+ (MIPS_FUNCTION_STUB_BIG_SIZE): Likewise.
+ (_bfd_mips_elf_adjust_dynamic_symbol): Use htab->function_stub_size
+ instead of MIPS_FUNCTION_STUB_SIZE.
+ (count_section_dynsyms): New function, split out from
+ _bfd_mips_elf_final_link.
+ (_bfd_mips_elf_always_size_sections): Get a worst-case estimate
+ of the number of dynamic symbols needed and use it to set up
+ function_stub_size. Use function_stub_size rather than
+ MIPS_FUNCTION_STUB_SIZE to determine the size of the stub section.
+ Use 16-byte stubs for 0x10000 dynamic symbols.
+ (_bfd_mips_elf_size_dynamic_sections): Use htab->function_stub_size
+ instead of MIPS_FUNCTION_STUB_SIZE. Fix formatting.
+ (_bfd_mips_elf_finish_dynamic_symbol): Likewise. Change the
+ size of the stub buffer from MIPS_FUNCTION_STUB_MAX_SIZE to
+ MIPS_FUNCTION_STUB_BIG_SIZE. Tweak the check for unhandled dynindxes.
+ Use MIPS_FUNCTION_STUB_BIG_SIZE rather than a hard-coded 20.
+ Use STUB_ORI rather than STUB_LI16U for big stubs.
+ (_bfd_mips_elf_link_hash_table_create): Initialize function_stub_size.
+ (_bfd_mips_elf_final_link): Use count_section_dynsyms.
+
+2006-06-09 David Ung <davidu@mips.com>
+
+ * bfd/elfxx-mips.c (mips_elf_calculate_relocation): Fix mode for stub
+ calling relocations.
+
+2006-06-08 David Daney <ddaney@avtrex.com>
+
+ * elfxx-mips.c (STUB_LI16): Removed.
+ (STUB_LUI): New macro.
+ (STUB_LI16U): Ditto.
+ (STUB_LI16S): Ditto.
+ (MIPS_FUNCTION_STUB_SIZE): Rewrote to take info parameter.
+ (_bfd_mips_elf_adjust_dynamic_symbol): Pass info parameter to
+ MIPS_FUNCTION_STUB_SIZE.
+ (_bfd_mips_elf_always_size_sections): Ditto.
+ (_bfd_mips_elf_size_dynamic_sections): Ditto.
+ (_bfd_mips_elf_finish_dynamic_sections): Ditto.
+ (_bfd_mips_elf_finish_dynamic_symbol): Rewrote stub generation
+ to allow larger symbol table indexes.
+
+2006-06-07 Joseph S. Myers <joseph@codesourcery.com>
+
+ * po/Make-in (pdf, ps): New dummy targets.
+
+2006-06-06 Alan Modra <amodra@bigpond.net.au>
+
+ * hash.c (bfd_hash_lookup): Correct stray line.
+
+ * elf.c (_bfd_elf_init_private_section_data): Comment typo.
+ (elfcore_grok_nto_status): Use long instead of pid_t.
+ (elfcore_grok_nto_regs, elfcore_grok_nto_note): Likewise.
+
+2006-06-05 Daniel Jacobowitz <dan@codesourcery.com>
+
+ * po/Make-in (top_builddir): Define.
+
+2006-06-05 Alan Modra <amodra@bigpond.net.au>
+
+ * Makefile.am: Run "make dep-am".
+ * Makefile.in: Regenerate.
+ * config.in: Regenerate.
+
+2006-06-02 Alan Modra <amodra@bigpond.net.au>
+ H.J. Lu <hongjiu.lu@intel.com>
+
+ PR ld/2723
+ * elflink.c (bfd_elf_final_link): Don't output section symbols
+ for special ELF sections.
+
+2006-06-01 Alan Modra <amodra@bigpond.net.au>
+
+ * stabs.c (_bfd_link_section_stabs): Use bfd_make_section*_with_flags
+ instead of bfd_make_section*.
+ * aix386-core.c: Likewise.
+ * aix5ppc-core.c: Likewise.
+ * aout-adobe.c: Likewise.
+ * aoutf1.h: Likewise.
+ * binary.c: Likewise.
+ * cisco-core.c: Likewise.
+ * coff-arm.c: Likewise.
+ * coff-h8300.c: Likewise.
+ * elf.c: Likewise.
+ * elf32-bfin.c: Likewise.
+ * elf32-m32c.c: Likewise.
+ * hppabsd-core.c: Likewise.
+ * hpux-core.c: Likewise.
+ * i386linux.c: Likewise.
+ * ieee.c: Likewise.
+ * ihex.c: Likewise.
+ * irix-core.c: Likewise.
+ * lynx-core.c: Likewise.
+ * m68klinux.c: Likewise.
+ * mach-o.c: Likewise.
+ * netbsd-core.c: Likewise.
+ * nlmcode.h: Likewise.
+ * opncls.c: Likewise.
+ * osf-core.c: Likewise.
+ * peXXigen.c: Likewise.
+ * ppcboot.c: Likewise.
+ * ptrace-core.c: Likewise.
+ * rs6000-core.c: Likewise.
+ * sco5-core.c: Likewise.
+ * sparclinux.c: Likewise.
+ * srec.c: Likewise.
+ * sunos.c: Likewise.
+ * trad-core.c: Likewise.
+ * xcofflink.c: Likewise.
+ * xsym.c: Likewise.
+
+2006-05-31 Daniel Jacobowitz <dan@codesourcery.com>
+
+ * Makefile.am (INCLUDES): Use @INCINTL@.
+ * acinclude.m4: Include new gettext macros.
+ * configure.in: Use ZW_GNU_GETTEXT_SISTER_DIR and AM_PO_SUBDIRS.
+ Manually substitute POFILES and GMOFILES.
+ * Makefile.in, aclocal.m4, configure, doc/Makefile.in: Regenerated.
+
+2006-05-30 H.J. Lu <hongjiu.lu@intel.com>
+
+ * bfd.c (bfd_emul_get_maxpagesize): New.
+ (bfd_elf_set_pagesize): Likewise.
+ (bfd_emul_set_maxpagesize): Likewise.
+ (bfd_emul_get_commonpagesize): Likewise.
+ (bfd_emul_set_commonpagesize): Likewise.
+ * bfd-in2.h: Regenerated.
+
+ * elf-bfd.h (elf_backend_data): Add commonpagesize.
+ (xvec_get_elf_backend_data): New.
+ (get_elf_backend_data): Use xvec_get_elf_backend_data.
+
+ * elf32-arm.c (elf32_arm_vxworks_bed): Remove const.
+ * elfxx-target.h (elfNN_bed): Likewise.
+
+ * elf32-arm.c (ELF_COMMONPAGESIZE): Defined.
+ * elf32-mips.c (ELF_COMMONPAGESIZE): Likewise.
+ * elf32-ppc.c (ELF_COMMONPAGESIZE): Likewise.
+ * elf32-sh.c (ELF_COMMONPAGESIZE): Likewise.
+ * elf32-sh64.c (ELF_COMMONPAGESIZE): Likewise.
+ * elf32-sparc.c (ELF_COMMONPAGESIZE): Likewise.
+ * elf64-alpha.c (ELF_COMMONPAGESIZE): Likewise.
+ * elf64-ppc.c (ELF_COMMONPAGESIZE): Likewise.
+ * elf64-sparc.c (ELF_COMMONPAGESIZE): Likewise.
+ * elf64-x86-64.c (ELF_COMMONPAGESIZE): Likewise.
+ * elfn32-mips.c (ELF_COMMONPAGESIZE): Likewise.
+ * elfxx-ia64.c (ELF_COMMONPAGESIZE): Likewise.
+
+ * elfxx-target.h (ELF_COMMONPAGESIZE): Define if not defined.
+ (elfNN_bed): Initialize commonpagesize with ELF_COMMONPAGESIZE.
+
+ * targets.c (bfd_find_target): Support NULL abfd.
+
+2006-05-30 Nick Clifton <nickc@redhat.com>
+
+ * po/es.po: Updated Spanish translation.
+
+2006-05-27 Alan Modra <amodra@bigpond.net.au>
+ H.J. Lu <hongjiu.lu@intel.com>
+
+ * elf.c (assign_file_positions_for_load_sections): Retrieve
+ maxpagesize from m->p_align if it is valid. Set p_vaddr,
+ p_paddr and p_align earlier. Revert 2006-05-19 change to p_align.
+ (copy_elf_program_header): Copy p_align. Set p_align_valid.
+
+2006-05-26 H.J. Lu <hongjiu.lu@intel.com>
+
+ * elf64-x86-64.c (ELF_MINPAGESIZE): Changed to 0x1000.
+
+2006-05-25 H.J. Lu <hongjiu.lu@intel.com>
+
+ * elf64-x86-64.c (ELF_MINPAGESIZE): Set to 0x100000.
+
+2006-05-25 H.J. Lu <hongjiu.lu@intel.com>
+
+ * elf64-x86-64.c (ELF_MAXPAGESIZE): Updated to 0x200000.
+
+2006-05-26 Alan Modra <amodra@bigpond.net.au>
+
+ * elf.c (sym_is_global): Return a bfd_boolean.
+ (ignore_section_sym): New function.
+ (elf_map_symbols): Use ignore_section_sym to discard some syms.
+ (_bfd_elf_symbol_from_bfd_symbol): Ensure section belongs to
+ bfd before using elf_section_syms.
+
+2006-05-25 H.J. Lu <hongjiu.lu@intel.com>
+
+ * config.bfd: (sh-*-linux*): Treat as 64bit target.
+ (sh*l*-*-netbsdelf*): Likewise.
+ (sh-*-netbsdelf*): Likewise.
+ (shl*-*-elf*): Likewise.
+ (sh[1234]l*-*-elf*): Likewise.
+ (sh3el*-*-elf*): Likewise.
+ (shl*-*-kaos*): Likewise.
+ (sh-*-elf*): Likewise.
+ (sh[1234]*-elf*): Likewise.
+ (sh-*-rtems*): Likewise.
+ (sh-*-kaos*): Likewise.
+
+2006-05-24 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR ld/1485
+ * config.bfd: Set want64 to true if 64bit bfd is used.
+ (sh-*-linux*): Use targ64_selvecs for 64bit targets.
+ (sh*l*-*-netbsdelf*): Likewise.
+ (sh-*-netbsdelf*): Likewise.
+ (shl*-*-elf*): Likewise.
+ (sh[1234]l*-*-elf*): Likewise.
+ (sh3el*-*-elf*): Likewise.
+ (shl*-*-kaos*): Likewise.
+ (sh-*-elf*): Likewise.
+ (sh[1234]*-elf*): Likewise.
+ (sh-*-rtems*): Likewise.
+ (sh-*-kaos*): Likewise.
+
+2006-05-24 Paul Brook <paul@codesourcery.com>
+
+ * elf-bfd.h (elf_backend_data): Add elf_backend_output_arch_local_syms
+ * elf32-arm.c (output_arch_syminfo): Define.
+ (elf32_arm_ouput_plt_map_sym, elf32_arm_output_plt_map,
+ elf32_arm_output_arch_local_syms): New functions.
+ (elf_backend_output_arch_local_syms): Define.
+ * elflink.c (bfd_elf_final_link): Call
+ elf_backend_output_arch_local_syms.
+ * elfxx-target.h (elf_backend_output_arch_local_syms): Provide default
+ definition.
+ (elfNN_bed): Add elf_backend_output_arch_local_syms.
+
+2006-05-24 Paul Brook <paul@codesourcery.com>
+
+ * elf32-arm.c (put_arm_insn, put_thumb_insn): New functions.
+ (elf32_thumb_to_arm_stub, elf32_arm_to_thumb_stub,
+ elf32_arm_finish_dynamic_symbol): Use them.
+
+2006-05-24 Carlos O'Donell <carlos@systemhalted.org>
+ Randolph Chung <tausq@debian.org>
+
+ * elf-hppa.h (reloc_hppa_howto_table): Check bitfield for
+ TPREL21L/TPREL14R relocations. Handle LTOFF_TP14R relocations.
+ Add handling for TLS relocations.
+ (elf_hpp_reloc_final_type): Handle TLS relocs.
+ * elf32-hppa.c: Add authors for cleanup and TLS support.
+ (hppa_elf_local_got_tls_type, hh_name, eh_name): Define.
+ (elf32_hppa_link_hash_entry): Add tls_type.
+ (elf32_hppa_link_hash_table): Add tld_ldm_got.
+ (hppa_link_has_newfunc): Set tls_type.
+ (elf32_hppa_link_hash_table_create): Set tls_ldm_got refcount.
+ (hppa_stub_name): Use hh_name macro.
+ (elf32_hppa_copy_indirect_symbol): Copy TLS information.
+ (elf32_hppa_check_relocs): Call elf32_hppa_optimized_tls_reloc.
+ Handle TLS relocs.
+ (elf32_hppa_gc_sweep_hook): Likewise.
+ (allocate_dynrelocs): Handle TLS relocs.
+ (elf32_hppa_size_dynamic_sections): Count space required by TLS
+ relocs. Use hh_name macro.
+ (dtpoff_base): New function.
+ (tpoff): Likewise.
+ (elf32_hppa_optimized_tls_reloc): Likewise.
+ (final_link_relocate): Handle TLS relocs.
+ (elf32_hppa_relocate_section): Handle TLS relocs. Use eh_name
+ and hh_name macros.
+ (elf32_hppa_finish_dynamic_symbol): Setup TLS got entries. Use
+ hh_name and eh_name macros.
+ (elf32_hppa_reloc_type_clas): Handle TLS relocs.
+
+2006-05-24 Bjoern Haase <bjoern.m.haase@web.de>
+
+ * archures.c: Add bfd_mach_avr6.
+ * cpu-avr.c: Likewise.
+ * reloc.c (BFD_RELOC_AVR_LO8_LDI_GS, BFD_RELOC_AVR_HI8_LDI_GS):
+ New relocations.
+ * libbfd.h: Regenerate.
+ * bfd-in2.h:Regenerate.
+ * elf32-avr.h: New file. Protoypes for functions accessed from ld.
+ * elf32-avr.c: Add elf32-avr.h to include list.
+ (elf32_avr_stub_hash_entry): New function.
+ (elf32_avr_link_hash_table): New struct.
+ (avr_link_hash_table): Likewise.
+ (avr_stub_hash_entry): Likewise.
+ (avr_stub_hash_lookup): New function.
+ (stub_hash_newfunc): New function.
+ (elf32_avr_link_hash_table_create): New function.
+ (elf32_avr_link_hash_table_free): New function.
+ (avr_get_stub_addr): New function.
+ (debug_relax, debug_stubs): Add new global variables controlling
+ debugging printout to stdout.
+ (avr_pc_wrap_around): Change the type to bfd_vma.
+ (avr_replace_call_ret_sequences): Add a new variable controling
+ linkrelax optimizations.
+ (avr_stub_is_required_for_16_bit_reloc): New function.
+ (avr_final_link_relocate):
+ Add linker hash table to parameter list. Use stub addr. if necessary.
+ (elf32_avr_relocate_section):
+ Add linker hashtable to parameter list of avr_final_link_relocate.
+ (bfd_elf_avr_final_write_processing): Add support for bfd_mach_avr6.
+ (elf32_avr_object_p): Add support for E_AVR_MACH_AVR6.
+ (elf32_avr_relax_delete_bytes):
+ Iterate over all sections of a bfd when adjusting relocs addends.
+ (elf32_avr_relax_section):
+ Evaluate avr_replace_call_ret_sequences and recalculate the size of
+ stub section.
+ (avr_stub_name): New function.
+ (avr_get_stub_entry): New function.
+ (avr_add_stub): New function.
+ (avr_build_one_stub): New function.
+ (avr_size_one_stub): New function.
+ (elf32_avr_setup_params): New function.
+ (elf32_avr_setup_section_lists): New function.
+ (get_local_syms): New function.
+ (elf32_avr_size_stubs): New function.
+ (bfd_elf32_bfd_link_hash_table_create): New function.
+ (bfd_elf32_bfd_link_hash_table_free): New function.
+
+2006-05-23 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR ld/2655
+ PR ld/2657
+ * elf-eh-frame.c (_bfd_elf_write_section_eh_frame): Properly
+ update CIE/FDE length. Don't pad to the section alignment.
+
+2006-05-23 Jie Zhang <jie.zhang@analog.com>
+
+ * elf32-bfin.c (bfinfdpic_relocate_section): Clear reloc for
+ deteted entries in .eh_frame section.
+
+2006-05-23 Jie Zhang <jie.zhang@analog.com>
+
+ * elf32-bfin.c (bfin_check_relocs): Use __GLOBAL_OFFSET_TABLE_
+ instead of _GLOBAL_OFFSET_TABLE_.
+ (bfin_relocate_section): Ditto.
+ (_bfin_create_got_section): Ditto.
+ (elf32_bfinfdpic_create_dynamic_sections): Use
+ __PROCEDURE_LINKAGE_TABLE_ instead of _PROCEDURE_LINKAGE_TABLE_.
+ (bfin_finish_dynamic_symbol): Use __DYNAMIC instead of _DYNAMIC.
+
+2006-05-23 Alan Modra <amodra@bigpond.net.au>
+
+ * elf64-ppc.c (compare_symbols): Prefer strong dynamic global
+ function syms over other syms.
+
+2006-05-22 Daniel Jacobowitz <dan@codesourcery.com>
+
+ * elflink.c (_bfd_elf_add_dynamic_entry): Remove DT_TEXTREL
+ check.
+ (bfd_elf_final_link): Add a late DT_TEXTREL check.
+ * elfxx-mips.c (MIPS_ELF_READONLY_SECTION): Define.
+ (mips_elf_create_dynamic_relocation): Set DF_TEXTREL.
+ (_bfd_mips_elf_check_relocs): Delete MIPS_READONLY_SECTION.
+ Use MIPS_ELF_READONLY_SECTION.
+ (_bfd_mips_elf_size_dynamic_sections): Clear DF_TEXTREL after
+ creating DT_TEXTREL.
+ (_bfd_mips_elf_finish_dynamic_sections): Clear textrel markers
+ if no text relocations were generated.
+
+2006-05-19 H.J. Lu <hongjiu.lu@intel.com>
+
+ * elfxx-ia64.c (ELF_MAXPAGESIZE): Fix a typo in comment.
+
+2006-05-19 Alan Modra <amodra@bigpond.net.au>
+
+ * elf.c (elf_fake_sections): Formatting.
+ (assign_file_positions_for_load_sections): Only add SEC_ALLOC
+ sections to p_memsz. Remove hack for PT_NOTE sections. Allow
+ section alignment to increase p_align for PT_LOAD.
+ (assign_file_positions_for_non_load_sections): Remove ARM BPABI
+ hack for PT_DYNAMIC. Instead, set p_filesz for all segments
+ other than PT_LOAD, and PT_NOTE in core.
+
+2006-05-17 Alan Modra <amodra@bigpond.net.au>
+
+ * elf.c (assign_file_positions_for_segments): Split into..
+ (assign_file_positions_for_load_sections): ..this, and..
+ (assign_file_positions_for_non_load_sections): ..this new function,..
+ (assign_file_positions_except_relocs): ..writing program headers here.
+
+2006-05-17 Alan Modra <amodra@bigpond.net.au>
+
+ * elflink.c (elf_gc_sweep): Don't specially keep non-alloc,
+ non-load sections if they have relocs.
+
+2006-05-15 Paul Brook <paul@codesourcery.com>
+
+ * cpu-arm.c (bfd_is_arm_mapping_symbol_name): Rename ...
+ (bfd_is_arm_special_symbol_name): ... to this. Add type argument.
+ Check symbol name is of specified type.
+ * elf32-arm.c (elf32_arm_is_target_special_symbol,
+ arm_elf_find_function, elf32_arm_output_symbol_hook): Use
+ bfd_is_arm_special_symbol_name.
+ * bfd-in.h (BFD_ARM_SPECIAL_SYM_TYPE_MAP,
+ BFD_ARM_SPECIAL_SYM_TYPE_TAG, BFD_ARM_SPECIAL_SYM_TYPE_OTHER,
+ BFD_ARM_SPECIAL_SYM_TYPE_ANY): Define.
+ (bfd_is_arm_mapping_symbol_name): Remove prototype.
+ (bfd_is_arm_special_symbol_name): Add prototype.
+ * bfd-in2.h: Regenerate.
+
+2006-05-15 David Heine <dlheine@tensilica.com>
+ Bob Wilson <bob.wilson@acm.org>
+
+ * elf32-xtensa.c (check_loop_aligned): Fix reversed check for
+ undefined opcode. Clean up assertions.
+ (narrow_instruction, widen_instruction): Remove "do_it" parameters.
+ Factor most of the code into separate functions....
+ (can_narrow_instruction, can_widen_instruction): New.
+ (prev_instr_is_a_loop): New.
+ (compute_ebb_proposed_actions): Combine error handling code for
+ decode errors. Replace call to insn_decode_len with inline code.
+ Use can_narrow_instruction and can_widen_instruction. Handle errors
+ from call to xtensa_opcode_is_loop.
+ (relax_section): Adjust calls to narrow_instruction and
+ widen_instruction.
+
+2006-05-15 Alan Modra <amodra@bigpond.net.au>
+
+ PR 2658
+ * elf32-ppc.c (ppc_elf_relax_section): Don't segfault on non-pic
+ -shared link.
+
+2006-05-11 Michael Matz <matz@suse.de>
+
+ * elflink.c (match_group_member): Correctly iterate group
+ members.
+
+2006-05-11 Paul Brook <paul@codesourcery.com>
+
+ * elf32-arm.c (elf32_arm_reloc_map): Add MOVW and MOVT relocs.
+ (elf32_arm_final_link_relocate): Handle MOVW and MOVT relocs.
+ (elf32_arm_gc_sweep_hook, elf32_arm_check_relocs): Ditto.
+ * reloc.c: Ditto.
+ * bfd-in2.h: Regenerate.
+ * libbfd.h: Regenerate.
+ * libcoff.h: Regenerate.
+
+2006-05-11 Mike Bland <mbland@google.com>
+
+ * elf.c (_bfd_elf_init_private_section_data): Don't change
+ section type if already set.
+
+2006-05-10 Nick Clifton <nickc@redhat.com>
+
+ PR ld/2607
+ * elfcode.h (valid_section_index_p): New function: Checks for a
+ valid section index. Allows indicies in the range SHN_LOPROC to
+ SHN_HIOS.
+ (elf_object_p): Use valid_section_index_p.
+
+2006-05-11 Pedro Alves <pedro_alves@portugalmail.pt>
+
+ * coff-arm.c (ARM_26D, ARM_32, ARM_RVA_32, ARM_SECTION,
+ ARM_SECREL): Mark WinCE versions of these relocs as partial
+ inplace.
+ (coff_arm_relocate_section): Adjust addend for WinCE.
+
+2006-05-10 Alan Modra <amodra@bigpond.net.au>
+
+ PR 2342
+ * elflink.c (_bfd_elf_default_action_discarded): Revert 2006-02-16.
+
+2006-05-09 Nick Clifton <nickc@redhat.com>
+
+ * coffcode.h (coff_write_relocs): Produce an error message if a an
+ out-of-range symbol index is detected in a reloc.
+
+2006-05-09 Ben Elliston <bje@au.ibm.com>
+
+ * elf64-ppc.c (ppc64_elf_finish_dynamic_symbol): Remove unused
+ local variable `dynobj'.
+
+2006-05-05 Bjoern Haase <bjoern.m.haase@web.de>
+
+ * elf32-avr.c (elf32_avr_relax_delete_bytes): Iterate over all
+ of the bfd's sections for the reloc-addend adjustments.
+
+2006-05-05 Martin Schwidefsky <schwidefsky@de.ibm.com>
+
+ * elf32-s390.c (invalid_tls_insn): Call bfd_set_error.
+ (elf_s390_relocate_section): Add code to do the GD->LE and
+ LD->LE TLS linker optimizations if a brasl instruction is used
+ for the __tls_get_offset function call.
+ * elf64-s390.c (invalid_tls_insn): Call bfd_set_error.
+
+2006-05-05 Alan Modra <amodra@bigpond.net.au>
+
+ * elf64-ppc.c (ppc64_elf_tls_optimize): Only optimize
+ R_PPC64_TPREL64 and R_PPC64_DTPMOD64 relocs when they are in
+ the .toc and referenced by a TLS code sequence.
+ (ppc64_elf_edit_toc): Cater for the unlikely situation that
+ .toc is the first section in a file.
+
+2006-05-04 Andreas Schwab <schwab@suse.de>
+
+ * aoutf1.h (struct external_sparc_core): Declare c_regs as struct
+ regs instead of an array of int.
+ (struct external_solaris_bcp_core): Likewise.
+ (swapcore_sun3): Use offsetof instead of computing the offset
+ manually.
+ (swapcore_sparc): Likewise. Simplify reference to c_regs.
+ (swapcore_solaris_bcp): Likewise.
+
+2006-05-04 Daniel Jacobowitz <dan@codesourcery.com>
+
+ * elfxx-mips.c (_bfd_mips_elf_hide_symbol): Adjust handling
+ for missing GOTs.
+
+2006-05-04 Daniel Jacobowitz <dan@codesourcery.com>
+
+ * cpu-arm.c (bfd_is_arm_mapping_symbol_name): Accept more
+ mapping symbols.
+
+2006-05-04 Ben Elliston <bje@au.ibm.com>
+
+ * coff-or32.c (bfd_section_from_shdr): Remove unused local
+ variable `ptr'.
+ * cofflink.c (process_embedded_commands): Remove unused local
+ variables `had_read' and `had_shared'.
+ * ecofflink.c (bfd_ecoff_debug_accumulate): Remove unused local
+ variable `fdr_adr'.
+ * ihex.c (ihex_read_section): Remove unused local variable `addr'.
+
+2006-05-03 Alan Modra <amodra@bigpond.net.au>
+
+ * libbfd-in.h (_bfd_generic_new_section_hook): Declare.
+ * section.c (bfd_abs_symbol, bfd_com_symbol): Delete.
+ (bfd_und_symbol, bfd_ind_symbol): Delete.
+ (BFD_FAKE_SECTION): Remove SYM_PTR param, set symbol_ptr_ptr to
+ &SEC.symbol.
+ (STD_SECTION): Adjust.
+ (_bfd_generic_new_section_hook): New function, extracted from..
+ (bfd_section_init): ..here.
+ (bfd_make_section_old_way): Call new_section_hook for abs, com,
+ und and ind sections.
+ * elf.c (_bfd_elf_large_com_section): Adjust.
+ * aoutx.h (new_section_hook): Call _bfd_generic_new_section_hook.
+ * pdp11.c (new_section_hook): Likewise.
+ * coffcode.h (coff_new_section_hook): Likewise.
+ * ecoff.c (_bfd_ecoff_new_section_hook): Likewise.
+ * elf.c (_bfd_elf_new_section_hook): Likewise.
+ * vms.c (vms_new_section_hook): Likwise.
+ * elf32-arm.c (elf32_arm_new_section_hook): Check used_by_bfd isn't
+ already set.
+ * elf32-sh64.c (sh64_elf_new_section_hook): Likewise.
+ * elf32-xtensa.c (elf_xtensa_new_section_hook): Likewise.
+ * elf64-mmix.c (mmix_elf_new_section_hook): Likewise.
+ * elf64-ppc.c (ppc64_elf_new_section_hook): Likewise.
+ * elfxx-mips.c (_bfd_mips_elf_new_section_hook): Likewise.
+ * elfxx-sparc.c (_bfd_sparc_elf_new_section_hook): Likewise.
+ * ieee.c (ieee_new_section_hook): Likewise. Call
+ _bfd_generic_new_section_hook too.
+ * mmo.c (mmo_new_section_hook): Likewise.
+ * oasys.c (oasys_new_section_hook): Likewise.
+ * som.c (som_new_section_hook): Likewise.
+ * coff-w65.c (reloc_processing): Don't use bfd_abs_symbol.
+ * bfd-in2.h: Regenerate.
+ * libbfd.h: Regenerate.
+
+2006-05-03 Alan Modra <amodra@bigpond.net.au>
+
+ * hash.c (DEFAULT_SIZE): Revert last change.
+ (higher_prime_number): Correct test for no larger prime. Don't
+ abort on error, instead return 0. Depopulate primes[].
+ (bfd_hash_lookup): If we overflow size, refuse to grow table.
+
+2006-05-02 Paul Brook <paul@codesourcery.com>
+
+ * elf32-arm.c (elf32_arm_final_link_relocate): Set thumb funciton bit
+ for R_ARM_REL32.
+
+2006-05-02 Ben Elliston <bje@au.ibm.com>
+
+ * archive.c (bfd_generic_archive_p): Remove unused local variable
+ `fail'.
+ * dwarf2.c (decode_line_info): Remove unused local variable
+ `basic_block'.
+ * elfcode.h (elf_slurp_reloc_table_from_section): Remove unused
+ local variable `s'.
+ * tekhex.c (tekhex_write_object_contents): Remove unused local
+ variable `bytes_written'.
+ * aout-ns32k.c (MY_swap_std_reloc_out): Remove unused local
+ variable `r_addend'.
+ * elf32-dlx.c (dlx_rtype_to_howto): Remove breaks after returns.
+ * elfxx-mips.c (_bfd_elf_mips_mach): Remove breaks after returns.
+ (_bfd_ns32k_relocate_contents): Remove break after return.
+ * elf.c (bfd_section_from_shdr): Remove breaks after returns.
+
+2006-05-02 Nick Clifton <nickc@redhat.com>
+
+ * elf32-sh-symbian.c: Rename local define DEBUG to SYMBIAN_DEBUG
+ in order to avoid conflicts with the global DEBUG define.
+
+2006-05-02 Alan Modra <amodra@bigpond.net.au>
+
+ * dwarf2.c: Formatting.
+ * elf-eh-frame.c (_bfd_elf_discard_section_eh_frame): Simplify
+ output section check.
+ * elf32-i370.c: Warning fixes inside #ifdef DEBUG.
+ * elf32-m32c.c: Similarly.
+ * elf32-ppc.c: Similarly.
+ * elf32-v850.c: Similarly.
+ * nlm32-sparc.c: Similarly.
+ * elfcode.h: Similarly.
+ (elf_symbol_flags): Delete.
+ * elflink.c (elf_link_input_bfd): Comment typo.
+
+2006-05-01 DJ Delorie <dj@redhat.com>
+
+ * bfd-in.h (bfd_hash_table): Add count field.
+ * bfd-in2.h: Regenerate.
+ * hash.c (higher_prime_number): New.
+ (bfd_hash_table_inint_n): Init count field.
+ (bfd_hash_lookup): Grow table as needed.
+
+2006-04-27 Kaz Kojima <kkojima@rr.iij4u.or.jp>
+
+ PR binutils/2584
+ * tekhex.c (getvalue): Change return type to bfd_boolean and
+ add the new parameter. Return false if the unexpected character
+ is found.
+ (getsym): Likewise.
+ (first_phase): Change return type to bfd_boolean and return
+ false if the unexpected character is found. Replace abort
+ with returning false.
+ (pass_over): Change return type to bfd_boolean and the type of
+ the second argument to bfd_boolean (*) (bfd *, int, char *).
+ Return false if FUNC returns false.
+ (tekhex_object_p): Return NULL if pass_over fails.
+
+2006-04-27 Alan Modra <amodra@bigpond.net.au>
+
+ * coff-rs6000.c (xcoff_write_archive_contents_old): Warning fix.
+
+2006-04-26 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR binutils/2593
+ * elf.c (_bfd_elf_new_section_hook): Don't set section ELF type
+ and flags if its BFD flags have been set.
+ (_bfd_elf_init_private_section_data): Don't copy the output ELF
+ section type from input if it has been set to something
+ different.
+
+2006-04-25 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR binutils/2467
+ * elf.c (_bfd_elf_close_and_cleanup): Check elf_tdata (abfd)
+ is NULL first.
+
+ * elf32-arm.c (elf32_arm_close_and_cleanup): Check if
+ abfd->sections is NULL.
+ (elf32_arm_bfd_free_cached_info): New.
+ (bfd_elf32_bfd_free_cached_info): Defined.
+
+ * elfxx-target.h (bfd_elfNN_bfd_free_cached_info): Default it
+ to _bfd_free_cached_info.
+
+ * libbfd-in.h (_bfd_free_cached_info): New.
+ * libbfd: Regenerated.
+
+ * opncls.c (_bfd_delete_bfd): Check if abfd->memory is NULL.
+ (_bfd_free_cached_info): New.
+
+2006-04-21 Alan Modra <amodra@bigpond.net.au>
+
+ * elf.c (assign_file_positions_except_relocs): Move code setting
+ file position of non-loaded sections..
+ (assign_file_positions_for_segments): ..to here.
+
+2006-04-20 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR ld/2537
+ * elf.c (bfd_section_from_shdr): Allow sections reserved for
+ applications. Issue an error on sections we don't know how
+ to handle.
+
+2006-04-19 Alan Modra <amodra@bigpond.net.au>
+
+ * Makefile.am: Run "make dep-am".
+ * Makefile.in: Regenerate.
+
+2006-04-19 Alan Modra <amodra@bigpond.net.au>
+
+ * warning.m4 (--enable-werror): Format help message.
+ (--enable-build-warnings): Likewise.
+ * configure: Regenerate.
+
+2006-04-18 Nick Clifton <nickc@redhat.com>
+
+ PR 2257
+ * elfcode.h (elf_object_p): Allow files with corrupt e_shstrndx
+ fields to still be handled as ELF files.
+
+2006-04-16 Daniel Jacobowitz <dan@codesourcery.com>
+
+ * po/SRC-POTFILES.in: Regenerated.
+
+2006-04-16 Daniel Jacobowitz <dan@codesourcery.com>
+
+ * configure.in: Update version to 2.17.50.
+ * configure: Regenerated.
+
+2006-04-14 David Heine <dlheine@tensilica.com>
+
+ * elf32-xtensa.c (build_reloc_opcodes): New.
+ (compute_text_actions): Use it to decode opcodes outside inner loop.
+ (check_section_ebb_pcrels_fit): Add "reloc_opcodes" argument, and if
+ it is set, use it to get the opcodes for relocations.
+ (move_shared_literal): Adjust call to check_section_ebb_pcrels_fit.
+
+2006-04-08 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR ld/2513
+ * elf32-i386.c (GOT_TLS_MASK): New macro for tls_type.
+ (GOT_TLS_IE_IE): Likewise.
+ (GOT_TLS_IE_GD): Likewise.
+ (GOT_TLS_IE_MASK): Likewise.
+ (elf_i386_check_relocs): For global symbols, set GOT_TLS_IE_GD
+ and GOT_TLS_IE_IE for R_386_TLS_GD and R_386_TLS_IE
+ respectively.
+ (allocate_dynrelocs): If both GOT_TLS_IE_IE and GOT_TLS_IE_GD
+ are set, treat tls_type as GOT_TLS_IE_BOTH.
+ (elf_i386_relocate_section): Likewise.
+
+2006-04-07 Randolph Chung <tausq@debian.org>
+
+ * elf64-hppa.c (elf64_hppa_grok_prstatus): New function.
+ (elf64_hppa_grok_psinfo): Likewise.
+ (elf_backend_grok_pstatus, elf_backend_grok_psinfo): Define.
+
+2006-04-06 DJ Delorie <dj@redhat.com>
+
+ * elf32-m32c.c (m32c_elf_relocate_section): Generate a symbol for
+ each plt entry we create.
+
+2006-04-06 Carlos O'Donell <carlos@codesourcery.com>
+
+ * po/Make-in: Add install-html target.
+ * Makefile.am: Rename docdir to bfddocdir. Add datarootdir, docdir
+ htmldir. Add install-html and install-html-recursive targets.
+ * Makefile.in: Regenerate.
+ * configure.in: AC_SUBST for datarootdir, docdir and htmldir.
+ * configure: Regenerate.
+
+2006-04-06 H.J. Lu <hongjiu.lu@intel.com>
+
+ * elfxx-ia64.c (elfNN_ia64_relax_section): Skip unneeded passes
+ with the skip_relax_pass_0 and skip_relax_pass_1 bits in the
+ section structure.
+
+2006-04-05 Bernd Schmidt <bernd.schmidt@analog.com>
+
+ * elf32-bfin.c (bfinfdpic_relocs_info_hash): Sprinkle casts to
+ eliminate warnings.
+
+2006-04-05 H.J. Lu <hongjiu.lu@intel.com>
+ James E Wilson <wilson@specifixinc.com>
+
+ PR ld/2442
+ * elfxx-ia64.c (elfNN_ia64_dyn_sym_info): Remove next.
+ (elfNN_ia64_local_hash_entry): Add count, sorted_count and
+ size.
+ (elfNN_ia64_link_hash_entry): Likewise.
+ (elfNN_ia64_new_elf_hash_entry): Initialize count, sorted_count
+ and size.
+ (elfNN_ia64_hash_copy_indirect): Updated elfNN_ia64_dyn_sym_info
+ processing.
+ (elfNN_ia64_hash_hide_symbol): Likewise.
+ (elfNN_ia64_global_dyn_sym_thunk): Likewise.
+ (elfNN_ia64_local_dyn_sym_thunk): Likewise.
+ (elfNN_ia64_global_dyn_info_free): New function.
+ (elfNN_ia64_local_dyn_info_free): Likewise.
+ (elfNN_ia64_hash_table_free): Free local and global
+ elfNN_ia64_dyn_sym_info.
+ (addend_compare): New function.
+ (sort_dyn_sym_info): Likewise.
+ (get_dyn_sym_info): Updated to use binary search for addend.
+ (elfNN_ia64_check_relocs): Scan relocations to create dynamic
+ relocation arrays first.
+
+2006-04-05 Bernd Schmidt <bernd.schmidt@analog.com>
+
+ * elf32-bfin.c (_bfin_create_got_section): Don't generate a _gp
+ symbol.
+
+2006-04-05 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR ld/2411
+ * elflink.c (check_dynsym): New.
+ (elf_link_output_extsym): Use it.
+ (bfd_elf_final_link): Likewise.
+
+2006-04-05 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR ld/2404
+ * elflink.c (_bfd_elf_merge_symbol): Skip the default indirect
+ symbol from the dynamic definition with the default version if
+ its type and the type of existing regular definition mismatch.
+
+2006-04-05 Richard Sandiford <richard@codesourcery.com>
+ Daniel Jacobowitz <dan@codesourcery.com>
+
+ * config.bfd (sparc-*-vxworks*): New stanza.
+ * configure.in (bfd_elf32_sparc_vxworks_vec): New stanza.
+ (bfd_elf32_sparc_vec, bfd_elf64_sparc_vec): Add elf-vxworks.lo.
+ * configure: Regenerate.
+ * elf32-sparc.c: Include elf-vxworks.h.
+ (elf32_sparc_vxworks_link_hash_table_create: New.
+ (elf32_sparc_vxworks_final_write_processing): New.
+ (TARGET_BIG_SYM): Override for VxWorks.
+ (TARGET_BIG_NAME, ELF_MINPAGESIZE): Likewise.
+ (bfd_elf32_bfd_link_hash_table_create): Likewise.
+ (elf_backend_want_got_plt, elf_backend_plt_readonly): Likewise.
+ (elf_backend_got_header_size, elf_backend_add_symbol_hook): Likewise.
+ (elf_backend_link_output_symbol_hook): Likewise.
+ (elf_backend_emit_relocs): Likewise.
+ (elf_backend_final_write_processing, elf32_bed): Likewise.
+ * elfxx-sparc.c: Include libiberty.h and elf-vxworks.h.
+ (sparc_vxworks_exec_plt0_entry, sparc_vxworks_exec_plt_entry): New.
+ (sparc_vxworks_shared_plt0_entry, sparc_vxworks_shared_plt_entry): New.
+ (_bfd_sparc_elf_link_hash_table_create): Don't initialize
+ build_plt_entry here.
+ (create_got_section): Initialize sgotplt for VxWorks.
+ (_bfd_sparc_elf_create_dynamic_sections): Initialize build_plt_entry,
+ plt_header_size and plt_entry_size, with new VxWorks-specific settings.
+ Call elf_vxworks_create_dynamic_sections for VxWorks.
+ (allocate_dynrelocs): Use plt_header_size and plt_entry_size.
+ Allocate room for .got.plt and .rela.plt.unloaded entries on VxWorks.
+ (_bfd_sparc_elf_size_dynamic_sections): Don't allocate a nop in .plt
+ for VxWorks. Check for the .got.plt section.
+ (sparc_vxworks_build_plt_entry): New function.
+ (_bfd_sparc_elf_finish_dynamic_symbol): Add handling of VxWorks PLTs.
+ Don't make _GLOBAL_OFFSET_TABLE_ and _PROCEDURE_LINKAGE_TABLE_
+ absolute on VxWorks.
+ (sparc32_finish_dyn): Add special handling for DT_RELASZ
+ and DT_PLTGOT on VxWorks.
+ (sparc_vxworks_finish_exec_plt): New.
+ (sparc_vxworks_finish_shared_plt): New.
+ (_bfd_sparc_elf_finish_dynamic_sections): Call them.
+ Use plt_header_size and plt_entry_size.
+ * elfxx-sparc.h (_bfd_sparc_elf_link_hash_table): Add is_vxworks,
+ srelplt2, sgotplt, plt_header_size and plt_entry_size fields.
+ * Makefile.am (elfxx-sparc.lo): Depend on elf-vxworks.h.
+ (elf32-sparc.lo): Likewise.
+ * Makefile.in: Regenerate.
+ * targets.c (bfd_elf32_sparc_vxworks_vec): Declare.
+ (_bfd_target_vector): Add a pointer to it.
+
+2006-03-30 Ben Elliston <bje@au.ibm.com>
+
+ PR ld/2267
+ * elflink.c (elf_fixup_link_order): Ensure `elfsec' is not a
+ special section number that exceeds the number of ELF sections
+ (eg. SHN_MIPS_SCOMMON).
+
+2006-03-27 Richard Sandiford <richard@codesourcery.com>
+
+ * elfxx-mips.c (mips_got_entry): Add more commentary.
+ (mips_elf_local_got_index): Use the hash table entry to record
+ the GOT index of forced-local symbols.
+ (mips_elf_initialize_tls_index): Rearrange code. Store the index
+ in either the hash table entry or the mips_got_entry, not both.
+ Add more commentary.
+ (mips_elf_multi_got): Make sure the g->next is nonnull when calling
+ mips_elf_initialize_tls_index.
+
+2006-03-25 Bernd Schmidt <bernd.schmidt@analog.com>
+
+ * elf32-bfin.c (bfd_const_reloc, bfd_oper_reloc, bfin_push_reloc,
+ RELOC_STACK_SIZE, reloc_stack, reloc_stack_tos, is_reloc_stack_empty,
+ reloc_stack_push, reloc_stack_pop, reloc_stack_operate,
+ bfin_areloc_howto_table): Delete. All
+ uses deleted as well.
+ (bfin_reloc_map): Delete all stack relocs.
+ (bfin_info_to_howto, bfin_bfd_reloc_type_lookup,
+ bfin_reloc_type_lookup): Don't support them.
+ (bfin_relocate_section): Don't try to handle them.
+
+ * config.bfd (bfin-*-*): Add bfd_elf32_bfinfdpic_vec.
+ * configure.in: Likewise.
+ * configure: Regenerate.
+ * elf32-bfin.c: Include "elf/dwarf2.h" and "hashtab.h".
+ (BFIN_RELOC_MAX): Now 0x21.
+ (bfin_howto_table, bfin_reloc_map): Add FD-PIC relocs.
+ (bfd_elf32_bfinfdpic_vec): Declare.
+ (IS_FDPIC): New macro.
+ (struct bfinfdpic_elf_link_hash_table): New struct.
+ (bfinfdpic_hash_table, bfinfdpic_got_section,
+ bfinfdpic_gotrel_section, bfinfdpic_gotfixup_section,
+ bfinfdpic_plt_setion, bfinfdpic_pltrel_section,
+ bfinfdpic_relocs_info, bfinfdpic_got_initial_offset,
+ bfinfdpic_plt_initial_offset): Accessor macros for it.
+ (BFINFDPIC_SYM_LOCAL, BFINFDPIC_FUNCDESC_LOCAL): New macros.
+ (struct bfinfdpic_relocs_info): New struct.
+ (LZPLT_RESOLVER_EXTRA, LZPLT_NORMAL_SIZE, LZPLT_ENTRIES,
+ BFINFDPIC_LZPLT_BLOCK_SIZE, BFINFDPIC_LZPLT_RESOLV_LOC,
+ DEFAULT_STACK_SIZE): New macros.
+ (bfinfdpic_elf_link_hash_table_create, bfinfdpic_relocs_info_hash,
+ bfinfdpic_relocs_info_eq, bfinfdpics_relocs_info_find,
+ bfinfdpic_relocs_info_for_global, bfinfdpic_relocs_info_for_local,
+ bfinfdpic_pic_merge_early_relocs_info, _bfinfdpic_add_dyn_reloc,
+ _bfinfdpic_add_rofixup, _bfinfdpic_osec_to_segment,
+ _bfinfdpic_osec_readonly_p, bfinfdpic_relocate_section,
+ bfinfdpic_check_relocs, bfinfdpic_gc_sweep_hook,
+ _bfinfdpic_link_omit_section_dynsym, _bfin_create_got_section,
+ elf32_bfinfdpic_create_dynamic_sections, _bfinfdpic_get_fd_entry,
+ _bfinfdpic_compute_got_alloc_data, _bfinfdpic_get_got_entry,
+ _bfinfdpic_assign_got_entries, _bfinfdpic_assign_plt_entries,
+ _bfinfdpic_resolve_final_relocs_info,
+ elf32_bfinfdpic_size_dynamic_sections,
+ elf32_bfinfdpic_always_size_sections,
+ elf32_bfinfdpic_modify_segment_map,
+ _bfinfdpic_count_got_plt_entries,
+ elf32_bfinfdpic_finish_dynamic_sections,
+ elf32_bfinfdpic_adjust_dynamic_symbol,
+ elf32_bfinfdpic_finish_dynamic_symbol,
+ elf32_bfinfdpic_elf_use_relative_eh_frame,
+ elf32_bfinfdpic_elf_encode_eh_address,
+ elf32_bfin_object_p, bfin_elf_copy_private_bfd_data,
+ elf32_bfinfdpic_copy_private_bfd_data,
+ (struct _bfinfdpic_dynamic_got_info,
+ struct _bfinfdpic_dynamic_got_plt_info): New structs.
+ (elf32_bfin_print_private_bfd_data): Print PIC flags.
+ (elf32_bfin_merge_private_bfd_data): Extend to support FD-PIC.
+ (TARGET_LITTLE_SYM, TARGET_LITTLE_NAME, elf32_bed,
+ elf_backend_got_header_size, bfd_elf32_bfd_link_hash_table_create,
+ elf_backend_always_size_sectinos, elf_backend_modify_segment_map,
+ bfd_elf32_bfd_copy_private_bfd_data,
+ 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, elf_backend_relocate_section,
+ elf_backend_can_make_relative_eh_frame, elf_backend_check_relocs,
+ elf_backend_can_make_ldsa_relative_eh_frame, elf_backend_may_use_rel_p,
+ elf_backend_may_use_rela_p, elf_backend_default_use_rela_p,
+ elf_backend_omit_section_dynsym): Redefine these macros and include
+ "elf32-target.h" again to create the elf32-bfinfdpic target.
+ * reloc.c (BFD_RELOC_BFIN_GOT17M4, BFD_RELOC_BFIN_GOTHI,
+ BFD_RELOC_BFIN_GOTLO, BFD_RELOC_BFIN_FUNCDESC,
+ BFD_RELOC_BFIN_FUNCDESC_GOT17M4, BFD_RELOC_BFIN_FUNCDESC_GOTHI,
+ BFD_RELOC_BFIN_FUNCDESC_GOTLO, BFD_RELOC_BFIN_FUNCDESC_VALUE,
+ BFD_RELOC_BFIN_FUNCDESC_GOTOFF17M4, BFD_RELOC_BFIN_FUNCDESC_GOTOFFHI,
+ BFD_RELOC_BFIN_FUNCDESC_GOTOFFLO, BFD_RELOC_BFIN_GOTOFFHI,
+ BFD_RELOC_BFIN_GOTOFFLO): New.
+ * targets.c (bfd_elf32_bfinfdpic_vec): New bfd_target.
+ (_bfd_target_vector): Add it.
+ * bfd-in2.h: Regenerate.
+ * libbfd.h: Regenerate.
+
+2006-03-25 Richard Sandiford <richard@codesourcery.com>
+
+ * cpu-m68k.c (bfd_m68k_compatible): Treat ISA A+ and ISA B code as
+ incompatible. Likewise MAC and EMAC code.
+ * elf32-m68k.c (elf32_m68k_merge_private_bfd_data): Use
+ bfd_get_compatible to set the new bfd architecture. Rely on it
+ to detect incompatibilities.
+
+2006-03-23 Michael Matz <matz@suse.de>
+
+ * reloc.c: Add BFD_RELOC_X86_64_GOT64, BFD_RELOC_X86_64_GOTPCREL64,
+ BFD_RELOC_X86_64_GOTPC64, BFD_RELOC_X86_64_GOTPLT64,
+ BFD_RELOC_X86_64_PLTOFF64.
+ * bfd-in2.h: Regenerated.
+ * libbfd.h: Regenerated.
+ * elf64-x86-64.c (x86_64_elf_howto_table): Correct comment.
+ Add howtos for above relocs.
+ (x86_64_reloc_map): Add mappings for new relocs.
+ (elf64_x86_64_check_relocs): R_X86_64_GOT64, R_X86_64_GOTPCREL64,
+ R_X86_64_GOTPLT64 need a got entry. R_X86_64_GOTPLT64 also a PLT
+ entry. R_X86_64_GOTPC64 needs a .got section. R_X86_64_PLTOFF64
+ needs a PLT entry.
+ (elf64_x86_64_gc_sweep_hook): Reflect changes from
+ elf64_x86_64_check_relocs for the new relocs.
+ (elf64_x86_64_relocate_section): Handle new relocs.
+
+2006-03-22 Bob Wilson <bob.wilson@acm.org>
+
+ * elf32-xtensa.c (xtensa_read_table_entries): Remove assertion that
+ rel->r_addend is zero.
+
+2006-03-22 Richard Sandiford <richard@codesourcery.com>
+
+ * elfxx-mips.c (_bfd_mips_vxworks_finish_dynamic_symbol): Fix type
+ of "loc".
+
+2006-03-22 Richard Sandiford <richard@codesourcery.com>
+ Daniel Jacobowitz <dan@codesourcery.com>
+ Phil Edwards <phil@codesourcery.com>
+ Zack Weinberg <zack@codesourcery.com>
+ Mark Mitchell <mark@codesourcery.com>
+ Nathan Sidwell <nathan@codesourcery.com>
+
+ * bfd-in2.h: Regenerate.
+ * config.bfd (mips*-*-vxworks*, mips*el-*-vxworks*): New stanzas.
+ * configure.in (bfd_elf32_bigmips_vxworks_vec): New stanza.
+ (bfd_elf32_littlemips_vxworks_vec): Likewise.
+ (bfd_elf32_bigmips_vec): Add elf-vxworks.lo.
+ (bfd_elf32_littlemips_vec): Likewise.
+ (bfd_elf32_nbigmips_vec): Likewise.
+ (bfd_elf32_nlittlemips_vec): Likewise.
+ (bfd_elf32_ntradbigmips_vec): Likewise.
+ (bfd_elf32_ntradlittlemips_vec): Likewise.
+ (bfd_elf32_tradbigmips_vec): Likewise.
+ (bfd_elf32_tradlittlemips_vec): Likewise.
+ (bfd_elf64_bigmips_vec): Likewise.
+ (bfd_elf64_littlemips_vec): Likewise.
+ (bfd_elf64_tradbigmips_vec): Likewise.
+ (bfd_elf64_tradlittlemips_vec): Likewise.
+ * elf32-mips.c: Include elf-vxworks.h.
+ (mips_info_to_howto_rel): Use elf_backend_mips_rtype_to_howto
+ instead of calling mips_elf32_rtype_to_howto directly.
+ (mips_vxworks_copy_howto_rela): New reloc howto.
+ (mips_vxworks_jump_slot_howto_rela): Likewise.
+ (mips_vxworks_bfd_reloc_type_lookup): New function.
+ (mips_vxworks_rtype_to_howto): Likewise.
+ (mips_vxworks_final_write_processing): Likewise.
+ (TARGET_LITTLE_SYM, TARGET_LITTLE_NAME): Override for VxWorks.
+ (TARGET_BIG_SYM, TARGET_BIG_NAME, elf_bed, ELF_MAXPAGESIZE): Likewise.
+ (elf_backend_want_got_plt): Likewise.
+ (elf_backend_want_plt_sym): Likewise.
+ (elf_backend_got_symbol_offset): Likewise.
+ (elf_backend_want_dynbss): Likewise.
+ (elf_backend_may_use_rel_p): Likewise.
+ (elf_backend_may_use_rela_p): Likewise.
+ (elf_backend_default_use_rela_p): Likewise.
+ (elf_backend_got_header_size: Likewise.
+ (elf_backend_plt_readonly): Likewise.
+ (bfd_elf32_bfd_reloc_type_lookup): Likewise.
+ (elf_backend_mips_rtype_to_howto): Likewise.
+ (elf_backend_adjust_dynamic_symbol): Likewise.
+ (elf_backend_finish_dynamic_symbol): Likewise.
+ (bfd_elf32_bfd_link_hash_table_create): Likewise.
+ (elf_backend_add_symbol_hook): Likewise.
+ (elf_backend_link_output_symbol_hook): Likewise.
+ (elf_backend_emit_relocs): Likewise.
+ (elf_backend_final_write_processing: Likewise.
+ (elf_backend_additional_program_headers): Likewise.
+ (elf_backend_modify_segment_map): Likewise.
+ (elf_backend_symbol_processing): Likewise.
+ * elfxx-mips.c: Include elf-vxworks.h.
+ (mips_elf_link_hash_entry): Add is_relocation_target and
+ is_branch_target fields.
+ (mips_elf_link_hash_table): Add is_vxworks, srelbss, sdynbss, srelplt,
+ srelplt2, sgotplt, splt, plt_header_size and plt_entry_size fields.
+ (MIPS_ELF_RELA_SIZE, MIPS_ELF_REL_DYN_NAME): New macros.
+ (MIPS_RESERVED_GOTNO): Take a mips_elf_link_hash_table argument.
+ Return 3 for VxWorks.
+ (ELF_MIPS_GP_OFFSET): Change the argument from a bfd to a
+ mips_elf_link_hash_table. Return 0 for VxWorks.
+ (MIPS_ELF_GOT_MAX_SIZE): Change the argument from a bfd to a
+ mips_elf_link_hash_table. Update the call to ELF_MIPS_GP_OFFSET.
+ (mips_vxworks_exec_plt0_entry): New variable.
+ (mips_vxworks_exec_plt_entry): Likewise.
+ (mips_vxworks_shared_plt0_entry): Likewise.
+ (mips_vxworks_shared_plt_entry): Likewise.
+ (mips_elf_link_hash_newfunc): Initialize the new hash_entry fields.
+ (mips_elf_rel_dyn_section): Change the bfd argument to a
+ mips_elf_link_hash_table. Use MIPS_ELF_REL_DYN_NAME to get
+ the name of the section.
+ (mips_elf_initialize_tls_slots): Update the call to
+ mips_elf_rel_dyn_section.
+ (mips_elf_gotplt_index): New function.
+ (mips_elf_local_got_index): Add an input_section argument.
+ Update the call to mips_elf_create_local_got_entry.
+ (mips_elf_got_page): Likewise.
+ (mips_elf_got16_entry): Likewise.
+ (mips_elf_create_local_got_entry): Add bfd_link_info and input_section
+ arguments. Create dynamic relocations for each entry on VxWorks.
+ (mips_elf_merge_gots): Update the use of MIPS_ELF_GOT_MAX_SIZE.
+ (mips_elf_multi_got): Update the uses of MIPS_ELF_GOT_MAX_SIZE
+ and MIPS_RESERVED_GOTNO.
+ (mips_elf_create_got_section): Update the uses of
+ MIPS_ELF_GOT_MAX_SIZE. Create .got.plt on VxWorks.
+ (is_gott_symbol): New function.
+ (mips_elf_calculate_relocation): Use a dynobj local variable.
+ Update the calls to mips_elf_local_got_index, mips_elf_got16_entry and
+ mips_elf_got_page_entry. Set G to the .got.plt entry when calculating
+ VxWorks R_MIPS_CALL* relocations. Calculate and use G for all GOT
+ relocations on VxWorks. Add dynamic relocations for references
+ to the VxWorks __GOTT_BASE__ and __GOTT_INDEX__ symbols. Don't
+ create dynamic relocations for R_MIPS_32, R_MIPS_REL32 or R_MIPS_64
+ in VxWorks executables.
+ (mips_elf_allocate_dynamic_relocations): Add a bfd_link_info argument.
+ Use MIPS_ELF_RELA_SIZE to calculate the size of a VxWorks entry.
+ Don't allocate a null entry on VxWorks.
+ (mips_elf_create_dynamic_relocation): Update the call to
+ mips_elf_rel_dyn_section. Use absolute rather than relative
+ relocations for VxWorks, and make them RELA rather than REL.
+ (_bfd_mips_elf_create_dynamic_sections): Don't make .dynamic
+ read-only on VxWorks. Update the call to mips_elf_rel_dyn_section.
+ Create the .plt, .rela.plt, .dynbss and .rela.bss sections on
+ VxWorks. Likewise create the _PROCEDURE_LINKAGE_TABLE symbol.
+ Call elf_vxworks_create_dynamic_sections for VxWorks and
+ initialize the plt_header_size and plt_entry_size fields.
+ (_bfd_mips_elf_check_relocs): Don't allow GOT relocations to be
+ used in VxWorks executables. Don't allocate dynamic relocations
+ for R_MIPS_32, R_MIPS_REL32 or R_MIPS_64 in VxWorks executables.
+ Set is_relocation_target for each symbol referenced by a relocation.
+ Allocate .rela.dyn entries for relocations against the special
+ VxWorks __GOTT_BASE__ and __GOTT_INDEX__ symbols. Create GOT
+ entries for all VxWorks R_MIPS_GOT16 relocations. Don't allocate
+ a global GOT entry for symbols mentioned in VxWorks R_MIPS_CALL*,
+ R_MIPS_32, R_MIPS_REL32 or R_MIPS_64 relocations. Update the calls
+ to mips_elf_rel_dyn_section and mips_elf_allocate_dynamic_relocations.
+ Set is_branch_target for symbols mentioned in R_MIPS_PC16 or R_MIPS_26
+ relocations. Don't set no_fn_stub on VxWorks.
+ (_bfd_mips_elf_adjust_dynamic_symbol): Update the call to
+ mips_elf_allocate_dynamic_relocations.
+ (_bfd_mips_vxworks_adjust_dynamic_symbol): New function.
+ (_bfd_mips_elf_always_size_sections): Do not allocate GOT page
+ entries for VxWorks, and do not create multiple GOTs.
+ (_bfd_mips_elf_size_dynamic_sections): Use MIPS_ELF_REL_DYN_NAME.
+ Handle .got specially for VxWorks. Update the uses of
+ MIPS_RESERVED_GOTNO and mips_elf_allocate_dynamic_relocations.
+ Check for sgotplt and splt. Allocate the .rel(a).dyn contents last,
+ once its final size is known. Set DF_TEXTREL for VxWorks. Add
+ DT_RELA, DT_RELASZ, DT_RELAENT, DT_PLTREL, DT_PLTRELSZ and DT_JMPREL
+ tags on VxWorks. Do not add the MIPS-specific tags for VxWorks.
+ (_bfd_mips_vxworks_finish_dynamic_symbol): New function.
+ (mips_vxworks_finish_exec_plt): Likewise.
+ (mips_vxworks_finish_shared_plt): Likewise.
+ (_bfd_mips_elf_finish_dynamic_sections): Remove an unncessary call
+ to mips_elf_rel_dyn_section. Use a VxWorks-specific value of
+ DT_PLTGOT. Handle DT_RELA, DT_RELASZ, DT_RELAENT, DT_PLTREL,
+ DT_PLTRELSZ and DT_JMPREL. Update the uses of MIPS_RESERVED_GOTNO
+ and mips_elf_rel_dyn_section. Use a different GOT header for
+ VxWorks. Don't sort .rela.dyn on VxWorks. Finish the PLT on VxWorks.
+ (_bfd_mips_elf_link_hash_table_create): Initialize the new
+ mips_elf_link_hash_table fields.
+ (_bfd_mips_vxworks_link_hash_table_create): New function.
+ (_bfd_mips_elf_final_link): Set the GP value to _GLOBAL_OFFSET_TABLE_
+ on VxWorks. Update the call to ELF_MIPS_GP_OFFSET.
+ * elfxx-mips.h (_bfd_mips_vxworks_adjust_dynamic_symbol): Declare.
+ (_bfd_mips_vxworks_finish_dynamic_symbol): Likewise.
+ (_bfd_mips_vxworks_link_hash_table_create): Likewise.
+ * libbfd.h: Regenerate.
+ * Makefile.am (elfxx-mips.lo): Depend on elf-vxworks.h.
+ (elf32-mips.lo): Likewise.
+ * Makefile.in: Regenerate.
+ * reloc.c (BFD_RELOC_MIPS_COPY, BFD_RELOC_MIPS_JUMP_SLOT): Declare.
+ * targets.c (bfd_elf32_bigmips_vxworks_vec): Declare.
+ (bfd_elf32_littlemips_vxworks_vec): Likewise.
+ (_bfd_target_vector): Add entries for them.
+
+2006-03-19 John David Anglin <dave.anglin@nrc-cnrc.gc.ca>
+
+ * elf64-hppa.c (elf64_hppa_special_sections): Change flags for .tbss
+ section from SHF_PARISC_WEAKORDER to SHF_HP_TLS.
+ (elf_backend_special_sections): Remove #undef.
+
+2006-03-18 John David Anglin <dave.anglin@nrc-cnrc.gc.ca>
+
+ * elf64-hppa.c (allocate_global_data_opd): Don't create an OPD entry
+ for undefined weak symbols.
+
+2006-03-17 Daniel Jacobowitz <dan@codesourcery.com>
+
+ PR ld/2462
+ * elflink.c (bfd_elf_final_link): Remove
+ bed->elf_backend_emit_relocs from emit_relocs.
+
+2006-03-17 Alexandre Oliva <aoliva@redhat.com>
+
+ * elf32-ppc.c (ppc_elf_relocate_section): Copy addend from
+ first relocation to the second when relaxing TLS GD to LE;
+ zero it out when relaxing to IE.
+
+2006-03-17 Alan Modra <amodra@bigpond.net.au>
+
+ PR 2434
+ * elflink.c (elf_link_add_object_symbols): Save and restore
+ warning sym's linked sym.
+
+2006-03-16 Alan Modra <amodra@bigpond.net.au>
+
+ PR 2434
+ * elflink.c (struct elf_smash_syms_data, elf_smash_syms): Delete.
+ (elf_link_add_object_symbols): Delete unnecessary locals. Rename
+ hash_table -> htab. Formatting. Save entire symbol table
+ before loading as-needed syms, and restore afterwards if lib not
+ needed. Use bfd_hash_allocate rather than bfd_alloc for sym
+ name. Free some buffers earlier.
+ * bfd-in.h (struct bfd_hash_table): Add entsize.
+ (bfd_hash_table_init, bfd_hash_table_init_n): Adjust prototype.
+ * elf-bfd.h (_bfd_elf_link_hash_table_init): Likewise
+ * hash.c (bfd_hash_table_init_n): Add entsize param, save to
+ hash table.
+ (bfd_hash_table_init): Add param, adjust calls.
+ * aoutx.h: Adjust all hash_table_init functions and calls.
+ * bfd.c: Likewise.
+ * coff-arm.c: Likewise.
+ * coff-h8300.c: Likewise.
+ * coff-ppc.c: Likewise.
+ * cofflink.c: Likewise.
+ * ecoff.c: Likewise.
+ * ecofflink.c: Likewise.
+ * elf-m10300.c: Likewise.
+ * elf-strtab.c: Likewise.
+ * elf.c: Likewise.
+ * elf32-arm.c: Likewise.
+ * elf32-bfin.c: Likewise.
+ * elf32-cris.c: Likewise.
+ * elf32-frv.c: Likewise.
+ * elf32-hppa.c: Likewise.
+ * elf32-i386.c: Likewise.
+ * elf32-m32r.c: Likewise.
+ * elf32-m68hc1x.c: Likewise.
+ * elf32-m68k.c: Likewise.
+ * elf32-ppc.c: Likewise.
+ * elf32-s390.c: Likewise.
+ * elf32-sh.c: Likewise.
+ * elf32-vax.c: Likewise.
+ * elf64-alpha.c: Likewise.
+ * elf64-hppa.c: Likewise.
+ * elf64-ppc.c: Likewise.
+ * elf64-s390.c: Likewise.
+ * elf64-sh64.c: Likewise.
+ * elf64-x86-64.c: Likewise.
+ * elfxx-ia64.c: Likewise.
+ * elfxx-mips.c: Likewise.
+ * elfxx-sparc.c: Likewise.
+ * i386linux.c: Likewise.
+ * libaout.h: Likewise.
+ * libbfd-in.h: Likewise.
+ * libcoff-in.h: Likewise.
+ * linker.c: Likewise.
+ * m68klinux.c: Likewise.
+ * merge.c: Likewise.
+ * opncls.c: Likewise.
+ * pdp11.c: Likewise.
+ * sparclinux.c: Likewise.
+ * stabs.c: Likewise.
+ * sunos.c: Likewise.
+ * vms.c: Likewise.
+ * xcofflink.c: Likewise.
+ * section.c (struct section_hash_entry): Move to..
+ * libbfd-in.h: ..here.
+ * Makefile.am: Run "make dep-am"
+ * Makefile.in: Regenerate.
+ * bfd-in2.h: Regenerate.
+ * libbfd.h: Regenerate.
+ * libcoff.h: Regenerate.
+
+2006-03-16 Alan Modra <amodra@bigpond.net.au>
+
+ * elf32-ppc.c (ppc_elf_check_relocs): REL24 and REL14 relocs
+ against __GLOBAL_OFFSET_TABLE__ need never be dynamic. Tweak
+ last change to REL32 relocs so that they are counted as
+ possibly dynamic as per REL24 and REL14.
+
+2006-03-16 Alan Modra <amodra@bigpond.net.au>
+
+ * elf32-ppc.c (ppc_elf_check_relocs): Don't fall into REL24
+ checks from REL32.
+
+2006-03-15 Ben Elliston <bje@au.ibm.com>
+
+ * elf32-arm.c (elf32_arm_merge_eabi_attributes): Iterate over all
+ in_list elements, not just the first.
+
+2006-03-14 Richard Sandiford <richard@codesourcery.com>
+
+ * elf32-mips.c (mips_elf_adjust_addend): New function, mostly split
+ out from...
+ (_bfd_mips_elf_relocate_section): ...here. Use it to adjust r_addend
+ for final links too.
+
+2006-03-13 Richard Sandiford <richard@codesourcery.com>
+
+ * elfxx-mips.c (mips_elf_create_got_section): Initialize hgot.
+
+2006-03-11 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR ld/2443
+ * dwarf2.c (concat_filename): Don't issue an error if file is 0.
+
+2006-03-10 Paul Brook <paul@codesourcery.com>
+
+ * elf32-arm.c (INTERWORK_FLAG): Handle EABIv5.
+ (elf32_arm_print_private_bfd_data): Ditto.
+
+2006-03-09 Paul Brook <paul@codesourcery.com>
+
+ * cpu-arm.c (bfd_is_arm_mapping_symbol_name): Recognise additional
+ mapping symbols.
+
+2006-03-09 Khem Raj <khem@mvista.com>
+
+ * elf32-arm.c(elf32_arm_finish_dynamic_sections): Use unsigned
+ char type.
+
+2006-03-08 H.J. Lu <hongjiu.lu@intel.com>
+
+ * elfxx-ia64.c (elfNN_ia64_choose_gp): Properly choose gp.
+
+2006-03-07 Richard Sandiford <richard@codesourcery.com>
+ Daniel Jacobowitz <dan@codesourcery.com>
+ Zack Weinberg <zack@codesourcery.com>
+ Nathan Sidwell <nathan@codesourcery.com>
+ Paul Brook <paul@codesourcery.com>
+ Ricardo Anguiano <anguiano@codesourcery.com>
+ Phil Edwards <phil@codesourcery.com>
+
+ * configure.in (bfd_elf32_bigarm_vec): Include elf-vxworks.lo.
+ (bfd_elf32_bigarm_symbian_vec): Likewise.
+ (bfd_elf32_bigarm_vxworks_vec): Likewise.
+ (bfd_elf32_littlearm_vec): Likewise.
+ (bfd_elf32_littlearm_symbian_vec): Likewise.
+ (bfd_elf32_littlearm_vxworks_vec): Likewise.
+ * configure: Regenerate.
+ * elf32-arm.c: Include libiberty.h and elf-vxworks.h.
+ (RELOC_SECTION, RELOC_SIZE, SWAP_RELOC_IN, SWAP_RELOC_OUT): New macros.
+ (elf32_arm_vxworks_bed): Add forward declaration.
+ (elf32_arm_howto_table_1): Fix the masks for R_ASM_ABS12.
+ (elf32_arm_vxworks_exec_plt0_entry): New table.
+ (elf32_arm_vxworks_exec_plt_entry): Likewise.
+ (elf32_arm_vxworks_shared_plt_entry): Likewise.
+ (elf32_arm_link_hash_table): Add vxworks_p and srelplt2 fields.
+ (reloc_section_p): New function.
+ (create_got_section): Use RELOC_SECTION.
+ (elf32_arm_create_dynamic_sections): Likewise. Call
+ elf_vxworks_create_dynamic_sections for VxWorks targets.
+ Choose between the two possible values of plt_header_size
+ and plt_entry_size.
+ (elf32_arm_link_hash_table_create): Initialize vxworks_p and srelplt2.
+ (elf32_arm_abs12_reloc): New function.
+ (elf32_arm_final_link_relocate): Call it. Allow the creation of
+ dynamic R_ARM_ABS12 relocs on VxWorks. Use reloc_section_p,
+ RELOC_SIZE, SWAP_RELOC_OUT and RELOC_SECTION. Initialize the
+ r_addend fields of relocs. On rela targets, skip any code that
+ adjusts in-place addends. When using _bfd_link_final_relocate
+ to perform a final relocation, pass rel->r_addend as the addend
+ argument.
+ (elf32_arm_merge_private_bfd_data): If one of the bfds is a VxWorks
+ object, ignore flags that are not standard on VxWorks.
+ (elf32_arm_check_relocs): Allow the creation of dynamic R_ARM_ABS12
+ relocs on VxWorks. Use reloc_section_p.
+ (elf32_arm_adjust_dynamic_symbol): Use RELOC_SECTION and RELOC_SIZE.
+ (allocate_dynrelocs): Use RELOC_SIZE. Account for the size of
+ .rela.plt.unloaded relocs on VxWorks targets.
+ (elf32_arm_size_dynamic_sections): Use RELOC_SIZE. Check for
+ .rela.plt.unloaded as well as .rel(a).plt. Add DT_RELA* tags
+ instead of DT_REL* tags on RELA targets.
+ (elf32_arm_finish_dynamic_symbol): Use RELOC_SECTION, RELOC_SIZE
+ and SWAP_RELOC_OUT. Initialize r_addend fields. Handle VxWorks
+ PLT entries. Do not make _GLOBAL_OFFSET_TABLE_ absolute on VxWorks.
+ (elf32_arm_finish_dynamic_sections): Use RELOC_SECTION, RELOC_SIZE
+ and SWAP_RELOC_OUT. Initialize r_addend fields. Handle DT_RELASZ
+ like DT_RELSZ. Handle the VxWorks form of initial PLT entry.
+ Correct the .rela.plt.unreloaded symbol indexes.
+ (elf32_arm_output_symbol_hook): Call the VxWorks version of this
+ hook on VxWorks targets.
+ (elf32_arm_vxworks_link_hash_table_create): Set vxworks_p to true.
+ Minor formatting tweak.
+ (elf32_arm_vxworks_final_write_processing): New function.
+ (elf_backend_add_symbol_hook): Override for VxWorks and reset
+ for Symbian.
+ (elf_backend_final_write_processing): Likewise.
+ (elf_backend_emit_relocs): Likewise.
+ (elf_backend_want_plt_sym): Likewise.
+ (ELF_MAXPAGESIZE): Likewise.
+ (elf_backend_may_use_rel_p): Minor formatting tweak.
+ (elf_backend_may_use_rela_p): Likewise.
+ (elf_backend_default_use_rela_p): Likewise.
+ (elf_backend_rela_normal): Likewise.
+ * Makefile.in (elf32-arm.lo): Depend on elf-vxworks.h.
+
+2006-03-06 Nathan Sidwell <nathan@codesourcery.com>
+
+ * archures.c (bfd_mach_mcf_isa_a_nodiv, bfd_mach_mcf_isa_b_nousp):
+ New. Adjust other variants.
+ (bfd_default_scan): Update.
+ * bfd-in2.h: Rebuilt.
+ * cpu-m68k.c: Adjust.
+ (bfd_m68k_compatible): New. Use it for architectures.
+ * elf32-m68k.c (elf32_m68k_object_p): Adjust.
+ (elf32_m68k_merge_private_bfd_data): Adjust. Correct isa-a/b
+ mismatch.
+ (elf32_m68k_print_private_bfd_data): Adjust.
+ * ieee.c (ieee_write_processor): Adjust.
+
+2006-03-06 Alan Modra <amodra@bigpond.net.au>
+
+ * dwarf2.c: Formatting.
+ (add_line_info): Remove outer loop.
+
+2006-03-05 H.J. Lu <hongjiu.lu@intel.com>
+ Alan Modra <amodra@bigpond.net.au>
+
+ PR binutils/2338
+ * dwarf2.c (loadable_section): New struct.
+ (dwarf2_debug): Add loadable_section_count and
+ loadable_sections.
+ (new_line_sorts_after): New.
+ (add_line_info): Use new_line_sorts_after to compare line
+ addresses.
+ (check_function_name): Removed.
+ (unset_sections): New.
+ (place_sections): New.
+ (_bfd_dwarf2_find_nearest_line): Updated. Call place_sections
+ and unset_sections on relocatable files.
+ (_bfd_dwarf2_find_line): Likewise.
+
+2006-03-03 Nick Clifton <nickc@redhat.com>
+
+ * cpu-avr.c: Update to ISO-C90 formatting.
+ * elf32-avr.c: Likewise.
+
+2006-03-03 Bjoern Haase <bjoern.m.haase@web.de>
+
+ * elf32-avr.c (avr_reloc_map): Insert BFD_RELOC_AVR_MS8_LDI
+ and R_AVR_MS8_LDI
+ (bfd_elf_avr_final_write_processing): Set
+ EF_AVR_LINKRELAX_PREPARED in e_flags field.
+ (elf32_avr_relax_section): New function.
+ (elf32_avr_relax_delete_bytes): New function.
+ (elf32_avr_get_relocated_section_contents): New function.
+ (avr_pc_wrap_around): New function.
+ (avr_relative_distance_considering_wrap_around): New function.
+ (avr_final_link_relocate): Handle negative int8t_t immediate for R_AVR_LDI.
+ * reloc.c: Add BFD_RELOC_AVR_MS8_LDI and BFD_RELOC_AVR_LDI_NEG
+ * libbfd.h: Regenerate.
+ * bfd-in2.h: Regenerate.
+
+2006-03-02 DJ Delorie <dj@redhat.com>
+
+ * elf32-m32c.c (m32c_offset_for_reloc): Fix local symbol
+ calculations.
+
+2006-03-02 Richard Sandiford <richard@codesourcery.com>
+
+ * elf32-ppc.c (is_ppc_elf_target): Return true if the target is
+ bfd_elf32_powerpc_vxworks_vec.
+
+2006-03-02 Nick Clifton <nickc@redhat.com>
+
+ * elf32-m32c.c (m32c_elf_relax_section): Initialise 'gap'.
+
+2006-03-02 Richard Sandiford <richard@codesourcery.com>
+
+ * elf32-i386.c (elf_i386_create_dynamic_sections): Use
+ elf_vxworks_create_dynamic_sections.
+ (elf_i386_size_dynamic_sections): Remove VxWorks GOT and PLT
+ symbol handling.
+ * elf32-ppc.c (ppc_elf_create_dynamic_sections): Use
+ elf_vxworks_create_dynamic_sections.
+ (ppc_elf_size_dynamic_sections): Remove VxWorks GOT and PLT
+ symbol handling.
+ * elf-vxworks.c (elf_vxworks_create_dynamic_sections): New function.
+ * elf-vxworks.h (elf_vxworks_create_dynamic_sections): Declare.
+
+2006-03-02 Richard Sandiford <richard@codesourcery.com>
+
+ * elf32-i386.c (elf_i386_vxworks_link_output_symbol_hook): Delete.
+ (elf_backend_link_output_symbol_hook): Use
+ elf_vxworks_link_output_symbol_hook instead.
+ * elf32-ppc.c (elf_i386_vxworks_link_output_symbol_hook): Delete.
+ (elf_backend_link_output_symbol_hook): Use
+ elf_vxworks_link_output_symbol_hook instead.
+ * elf-vxworks.c (elf_vxworks_link_output_symbol_hook): Provide the
+ same interface as elf_backend_link_output_symbol_hook.
+ * elf-vxworks.h (elf_vxworks_link_output_symbol_hook): Update
+ prototype accordingly.
+
+2006-03-02 Richard Sandiford <richard@codesourcery.com>
+
+ * elf32-ppc.c (ppc_elf_plt_type): New enumeration.
+ (ppc_elf_link_hash_table): Replace old_got and new_got with
+ plt_type and can_use_new_plt.
+ (ppc_elf_create_dynamic_sections): Add SEC_HAS_CONTENTS,
+ SEC_LOAD and SEC_READONLY to the VxWorks .plt flags.
+ (ppc_elf_check_relocs): Set can_use_new_plt instead of new_plt.
+ Move from plt_type == PLT_UNSET to PLT_OLD instead of setting old_plt.
+ (ppc_elf_select_plt_layout): Move from plt_type == PLT_UNSET to
+ either plt_type == PLT_OLD or plt_type == PLT_NEW. Assert that
+ this function should not be called for VxWorks targets.
+ (ppc_elf_tls_setup): Use plt_type instead of old_got.
+ (allocate_got): Likewise. Rearrange so that max_before_header
+ is only used for PLT_OLD and PLT_NEW.
+ (allocate_dynrelocs): Use plt_type instead of old_got and is_vxworks.
+ (ppc_elf_size_dynamic_sections): Likewise.
+ (ppc_elf_relax_section): Likewise.
+ (ppc_elf_relocate_section): Likewise.
+ (ppc_elf_finish_dynamic_symbol): Likewise.
+ (ppc_elf_vxworks_link_hash_table_create): Initialize plt_type.
+
+2006-02-28 Richard Sandiford <richard@codesourcery.com>
+
+ * elf32-i386.c (elf_i386_link_hash_table): Add next_tls_desc_index.
+ (elf_i386_link_hash_table_create): Initialize it.
+ (elf_i386_compute_jump_table_size): Use it instead of
+ srelplt->reloc_count.
+ (allocate_dynrelocs): Likewise.
+ (elf_i386_size_dynamic_sections): Likewise.
+ (elf_i386_relocate_section): Likewise.
+
+2006-02-27 Jakub Jelinek <jakub@redhat.com>
+
+ * elf-eh-frame.c (_bfd_elf_discard_section_eh_frame): Handle S flag.
+ (_bfd_elf_write_section_eh_frame): Likewise.
+
+2006-02-27 Carlos O'Donell <carlos@codesourcery.com>
+
+ * po/Make-in: Add html target.
+
+2006-02-27 Richard Sandiford <richard@codesourcery.com>
+
+ * elf-m10300.c (_bfd_mn10300_elf_finish_dynamic_symbol): Use the
+ cached hgot entry to check for _GLOBAL_OFFSET_TABLE_.
+ * elf32-arm.c (elf32_arm_finish_dynamic_symbol): Likewise.
+ * elf32-bfin.c (bfin_finish_dynamic_symbol): Likewise.
+ * elf32-cris.c (elf_cris_finish_dynamic_symbol): Likewise.
+ * elf32-hppa.c (elf32_hppa_finish_dynamic_symbol): Likewise.
+ * elf32-i386.c (elf_i386_finish_dynamic_symbol): Likewise.
+ * elf32-m32r.c (m32r_elf_finish_dynamic_symbol): Likewise.
+ * elf32-m68k.c (elf_m68k_finish_dynamic_symbol): Likewise.
+ * elf32-sh.c (sh_elf_finish_dynamic_symbol): Likewise.
+ * elf32-vax.c (elf_vax_finish_dynamic_symbol): Likewise.
+ * elf32-xtensa.c (elf_xtensa_finish_dynamic_symbol): Likewise.
+ * elf64-sh64.c (sh64_elf64_finish_dynamic_symbol): Likewise.
+ * elf64-x86-64.c (elf64_x86_64_finish_dynamic_symbol): Likewise.
+ * elfxx-mips.c (_bfd_mips_elf_finish_dynamic_symbol): Likewise.
+ * elf32-s390.c (elf_s390_finish_dynamic_symbol): Likewise. Also use
+ the cached hplt entry to check for _PROCEDURE_LINKAGE_TABLE_.
+ * elf64-alpha.c (elf64_alpha_finish_dynamic_symbol): Likewise.
+ * elf64-s390.c (elf_s390_finish_dynamic_symbol): Likewise.
+ * elfxx-ia64.c (elfNN_ia64_finish_dynamic_symbol): Likewise.
+ * elfxx-sparc.c (_bfd_sparc_elf_finish_dynamic_symbol): Likewise.
+
+2006-02-25 Richard Sandiford <richard@codesourcery.com>
+
+ * elf-bfd.h (elf_link_hash_table): Add hplt field.
+ * elflink.c (_bfd_elf_create_dynamic_sections): Initialize it.
+ * elf-m10300.c (_bfd_mn10300_elf_create_got_section): Likewise.
+ * elf32-frv.c (_frv_create_got_section): Likewise.
+ * elf32-m32r.c (m32r_elf_create_dynamic_sections): Likewise.
+ * elf32-sh.c (sh_elf_create_dynamic_sections): Likewise.
+ * elf64-alpha.c (elf64_alpha_create_dynamic_sections): Likewise.
+ * elf64-sh64.c (sh64_elf64_create_dynamic_sections): Likewise.
+ * elf32-i386.c (elf_i386_link_hash_table): Remove hgot and hplt.
+ (elf_i386_link_hash_table_create): Don't initialize them.
+ (elf_i386_size_dynamic_sections): Use the generic ELF hplt and
+ hgot fields.
+ (elf_i386_finish_dynamic_symbol): Likewise.
+ * elf32-ppc.c (ppc_elf_link_hash_table): Remove hplt.
+ (ppc_elf_size_dynamic_sections): Use the generic ELF hplt fields.
+ (ppc_elf_finish_dynamic_symbol): Likewise.
+
+2006-02-24 DJ Delorie <dj@redhat.com>
+
+ * elf32-m32c.c (m32c_elf_howto_table): Add relaxation relocs.
+ (m32c_elf_relocate_section): Don't relocate them.
+ (compare_reloc): New.
+ (relax_reloc): Remove.
+ (m32c_offset_for_reloc): New.
+ (m16c_addr_encodings): New.
+ (m16c_jmpaddr_encodings): New.
+ (m32c_addr_encodings): New.
+ (m32c_elf_relax_section): Relax jumps and address displacements.
+ (m32c_elf_relax_delete_bytes): Adjust for internal syms. Fix up
+ short jumps.
+
+ * reloc.c: Add m32c relax relocs.
+ * libbfd.h: Regenerate.
+ * bfd-in2.h: Regenerate.
+
+2006-02-24 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR ld/2218
+ * elf-bfd.h (elf_backend_data): Add elf_backend_fixup_symbol.
+ (_bfd_elf_link_hash_fixup_symbol): New.
+
+ * elflink.c (_bfd_elf_link_hash_fixup_symbol): New.
+ (_bfd_elf_fix_symbol_flags): Call elf_backend_fixup_symbol if
+ it isn't NULL.
+
+ * elfxx-ia64.c (elf_backend_fixup_symbol): Defined.
+
+ * elfxx-target.h (elf_backend_fixup_symbol): New.
+ (elfNN_bed): Initialize elf_backend_fixup_symbol.
+
+2006-02-23 H.J. Lu <hongjiu.lu@intel.com>
+
+ * cpu-ia64-opc.c (ins_immu5b): New.
+ (ext_immu5b): Likewise.
+ (elf64_ia64_operands): Add IMMU5b.
+
+2006-02-21 Alan Modra <amodra@bigpond.net.au>
+
+ PR ld/2218
+ * elf32-arm.c (allocate_dynrelocs): Ensure undef weak sym in pie
+ is dynamic.
+ * elf32-hppa.c (allocate_dynrelocs): Likewise.
+ * elf32-i386.c (allocate_dynrelocs): Likewise.
+ * elf32-s390.c (allocate_dynrelocs): Likewise.
+ * elf32-sh.c (allocate_dynrelocs): Likewise.
+ * elf64-s390.c (allocate_dynrelocs): Likewise.
+ * elf64-x86-64.c (allocate_dynrelocs): Likewise.
+ * elf32-m32r.c (allocate_dynrelocs): Likewise. Discard relocs
+ on undef weak with non-default visibility too.
+ * elfxx-sparc.c (allocate_dynrelocs): Ditto.
+
+2006-02-21 Alan Modra <amodra@bigpond.net.au>
+
+ * bfd.c: (_bfd_default_error_handler): Don't call abort on
+ error, instead call _exit.
+ (_bfd_abort): Call _exit not xexit.
+
+2006-02-17 Kevin Buettner <kevinb@redhat.com>
+
+ * elf32-frv.c (elf32_frv_grok_prstatus, elf32_frv_grok_psinfo):
+ New functions.
+ * elf_backend_grok_prstatus, elf_backend_grok_psinfo): Define.
+
+2006-02-17 Shrirang Khisti <shrirangk@kpitcummins.com>
+ Anil Paranjape <anilp1@kpitcummins.com>
+ Shilin Shakti <shilins@kpitcummins.com>
+
+ * Makefile.am: Add xc16x related entry
+ * Makefile.in: Regenerate
+ * archures.c: Add bfd_xc16x_arch
+ * bfd-in2.h: Regenerate
+ * config.bfd: Add xc16x-*-elf
+ * configure.in: Add bfd_elf32_xc16x_vec
+ * configure: Regenerate.
+ * targets.c: Added xc16x related information
+ * cpu-xc16x.c: New file
+ * reloc.c: Add new relocations specific to xc16x:
+ BFD_RELOC_XC16X_PAG, BFD_RELOC_XC16X_POF, BFD_RELOC_XC16X_SEG,
+ BFD_RELOC_XC16X_SOF
+ * elf32-xc16x.c: New file.
+
+2006-02-17 Alan Modra <amodra@bigpond.net.au>
+
+ * elf32-ppc.c (allocate_dynrelocs): Tweak undef weak handling.
+ * elf64-ppc.c (allocate_dynrelocs): Likewise.
+
+2006-02-17 Alan Modra <amodra@bigpond.net.au>
+
+ PR ld/2218
+ * elf64-ppc.c (allocate_dynrelocs): Ensure undef weak sym is
+ dynamic.
+ (ppc64_elf_relocate_section): Check output reloc section size.
+ * elf32-ppc.c (allocate_dynrelocs): Simplify undef weak test.
+
+2006-02-16 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR ld/2322
+ * elf.c (get_segment_type): New function.
+ (_bfd_elf_print_private_bfd_data): Use it.
+ (print_segment_map): New function.
+ (assign_file_positions_for_segments): Call print_segment_map
+ when there are not enough room for program headers.
+
+2006-02-16 Nick Hudson <nick.hudson@dsl.pipex.com>
+
+ * config.bfd (mips*el-*-netbsd*, mips*-*-netbsd*): Use
+ traditional MIPS ELF targets.
+
+2006-02-15 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR binutils/2338
+ * dwarf2.c (check_function_name): New function.
+ (_bfd_dwarf2_find_nearest_line): Use check_function_name to
+ check if function is correct.
+
+2006-02-16 Alan Modra <amodra@bigpond.net.au>
+
+ * elflink.c (_bfd_elf_default_action_discarded): Return 0 for
+ debug sections.
+ (elf_link_input_bfd): Adjust comments.
+
+2006-02-10 H.J. Lu <hongjiu.lu@intel.com>
+
+ * elf.c (copy_private_bfd_data): Minor update.
+
+2006-02-10 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR binutils/2258
+ * elf.c (copy_private_bfd_data): Renamed to ...
+ (rewrite_elf_program_header): This.
+ (copy_elf_program_header): New function.
+ (copy_private_bfd_data): Likewise.
+
+2006-02-07 Nathan Sidwell <nathan@codesourcery.com>
+
+ * archures.c (bfd_mach_mcf5200, bfd_mach_mcf5206e,
+ bfd_mach_mcf5307, bfd_mach_mcf5407, bfd_mach_mcf528x,
+ bfd_mach_mcfv4e, bfd_mach_mcf521x, bfd_mach_mcf5249,
+ bfd_mach_mcf547x, bfd_mach_mcf548x): Remove.
+ (bfd_mach_mcf_isa_a, bfd_mach_mcf_isa_a_div,
+ bfd_mach_mcf_isa_a_div_mac, bfd_mach_mcf_isa_a_div_emac,
+ bfd_mach_mcf_isa_aplus, bfd_mach_mcf_isa_aplus_mac,
+ bfd_mach_mcf_isa_aplus_emac, bfd_mach_mcf_isa_aplus_usp,
+ bfd_mach_mcf_isa_aplus_usp_mac, bfd_mach_mcf_isa_aplus_usp_emac,
+ bfd_mach_mcf_isa_b, bfd_mach_mcf_isa_b_mac, bfd_mach_mcf_isa_b_emac,
+ bfd_mach_mcf_isa_b_usp_float, bfd_mach_mcf_isa_b_usp_float_mac,
+ bfd_mach_mcf_isa_b_usp_float_emac): New.
+ (bfd_default_scan): Update coldfire mapping.
+ * bfd-in.h (bfd_m68k_mach_to_features,
+ bfd_m68k_features_to_mach): Declare.
+ * bfd-in2.h: Rebuilt.
+ * cpu-m68k.c (arch_info_struct): Add new coldfire machines,
+ adjust legacy names.
+ (m68k_arch_features): New.
+ (bfd_m68k_mach_to_features,
+ bfd_m68k_features_to_mach): Define.
+ * elf32-m68k.c (elf32_m68k_object_p): New.
+ (elf32_m68k_merge_private_bfd_data): Merge the CF EF flags.
+ (elf32_m68k_print_private_bfd_data): Print the CF EF flags.
+ (elf_backend_object_p): Define.
+ * ieee.c (ieee_write_processor): Update coldfire machines.
+ * libbfd.h: Rebuilt.
+
+2006-02-06 Steve Ellcey <sje@cup.hp.com>
+
+ * elfxx-ia64.c (elfNN_ia64_fake_sections): Set SHF_IA_64_HP_TLS
+ if SHF_TLS is set.
+
+2006-02-05 Arnold Metselaar <arnold.metselaar@planet.nl>
+
+ * coff-z80.c (r_imm24): New howto.
+ (rtype2howto): New case R_IMM24.
+ (coff_z80_reloc_type_lookup): New case BFD_RELOC_24.
+ (extra_case): Use bfd_get_8 for R_IMM8, new case R_IMM24.
+
+2006-02-04 Richard Sandiford <richard@codesourcery.com>
+
+ * elfxx-mips.c (mips_elf_initialize_tls_index): If a TLS symbol
+ has already been assigned a GOT index, copy that index to the
+ current hash table entry.
+
+2006-02-01 Eric Botcazou <ebotcazou@libertysurf.fr>
+
+ * elfxx-sparc.c (_bfd_sparc_elf_relocate_section): Reinstate bypass
+ for call-to-undefweak reloc overflow.
+
+2006-01-31 Eric Botcazou <ebotcazou@libertysurf.fr>
+
+ * elfxx-sparc.c (_bfd_sparc_elf_relocate_section): Reinstate bypass
+ for 32-bit relocs overflow.
+
+2006-01-27 Paul Brook <paul@codesourcery.com>
+
+ * elf32-arm.c (elf32_arm_get_symbol_type): Allow STT_TLS thumb
+ objects.
+
+2006-01-18 Alexandre Oliva <aoliva@redhat.com>
+
+ Introduce TLS descriptors for i386 and x86_64.
+ * reloc.c (BFD_RELOC_386_TLS_GOTDESC, BFD_RELOC_386_TLS_DESC,
+ BFD_RELOC_386_TLS_DESC_CALL, BFD_RELOC_X86_64_GOTPC32_TLSDESC,
+ BFD_RELOC_X86_64_TLSDESC, BFD_RELOC_X86_64_TLSDESC_CALL): New.
+ * libbfd.h, bfd-in2.h: Rebuilt.
+ * elf32-i386.c (elf_howto_table): New relocations.
+ (R_386_tls): Adjust.
+ (elf_i386_reloc_type_lookup): Map new relocations.
+ (GOT_TLS_GDESC, GOT_TLS_GD_BOTH_P): New macros.
+ (GOT_TLS_GD_P, GOT_TLS_GDESC_P, GOT_TLS_GD_ANY_P): New macros.
+ (struct elf_i386_link_hash_entry): Add tlsdesc_got field.
+ (struct elf_i386_obj_tdata): Add local_tlsdesc_gotent field.
+ (elf_i386_local_tlsdesc_gotent): New macro.
+ (struct elf_i386_link_hash_table): Add sgotplt_jump_table_size.
+ (elf_i386_compute_jump_table_size): New macro.
+ (link_hash_newfunc): Initialize tlsdesc_got.
+ (elf_i386_link_hash_table_create): Set sgotplt_jump_table_size.
+ (elf_i386_tls_transition): Handle R_386_TLS_GOTDESC and
+ R_386_TLS_DESC_CALL.
+ (elf_i386_check_relocs): Likewise. Allocate space for
+ local_tlsdesc_gotent.
+ (elf_i386_gc_sweep_hook): Handle R_386_TLS_GOTDESC and
+ R_386_TLS_DESC_CALL.
+ (allocate_dynrelocs): Count function PLT relocations. Reserve
+ space for TLS descriptors and relocations.
+ (elf_i386_size_dynamic_sections): Reserve space for TLS
+ descriptors and relocations. Set up sgotplt_jump_table_size.
+ Don't zero reloc_count in srelplt.
+ (elf_i386_always_size_sections): New. Set up _TLS_MODULE_BASE_.
+ (elf_i386_relocate_section): Handle R_386_TLS_GOTDESC and
+ R_386_TLS_DESC_CALL.
+ (elf_i386_finish_dynamic_symbol): Use GOT_TLS_GD_ANY_P.
+ (elf_backend_always_size_sections): Define.
+ * elf64-x86-64.c (x86_64_elf_howto): Add R_X86_64_GOTPC32_TLSDESC,
+ R_X86_64_TLSDESC, R_X86_64_TLSDESC_CALL.
+ (R_X86_64_standard): Adjust.
+ (x86_64_reloc_map): Map new relocs.
+ (elf64_x86_64_rtype_to_howto): New, split out of...
+ (elf64_x86_64_info_to_howto): ... this function, and...
+ (elf64_x86_64_reloc_type_lookup): ... use it to map elf_reloc_val.
+ (GOT_TLS_GDESC, GOT_TLS_GD_BOTH_P): New macros.
+ (GOT_TLS_GD_P, GOT_TLS_GDESC_P, GOT_TLS_GD_ANY_P): New macros.
+ (struct elf64_x86_64_link_hash_entry): Add tlsdesc_got field.
+ (struct elf64_x86_64_obj_tdata): Add local_tlsdesc_gotent field.
+ (elf64_x86_64_local_tlsdesc_gotent): New macro.
+ (struct elf64_x86_64_link_hash_table): Add tlsdesc_plt,
+ tlsdesc_got and sgotplt_jump_table_size fields.
+ (elf64_x86_64_compute_jump_table_size): New macro.
+ (link_hash_newfunc): Initialize tlsdesc_got.
+ (elf64_x86_64_link_hash_table_create): Initialize new fields.
+ (elf64_x86_64_tls_transition): Handle R_X86_64_GOTPC32_TLSDESC and
+ R_X86_64_TLSDESC_CALL.
+ (elf64_x86_64_check_relocs): Likewise. Allocate space for
+ local_tlsdesc_gotent.
+ (elf64_x86_64_gc_sweep_hook): Handle R_X86_64_GOTPC32_TLSDESC and
+ R_X86_64_TLSDESC_CALL.
+ (allocate_dynrelocs): Count function PLT relocations. Reserve
+ space for TLS descriptors and relocations.
+ (elf64_x86_64_size_dynamic_sections): Reserve space for TLS
+ descriptors and relocations. Set up sgotplt_jump_table_size,
+ tlsdesc_plt and tlsdesc_got. Make room for them. Don't zero
+ reloc_count in srelplt. Add dynamic entries for DT_TLSDESC_PLT
+ and DT_TLSDESC_GOT.
+ (elf64_x86_64_always_size_sections): New. Set up
+ _TLS_MODULE_BASE_.
+ (elf64_x86_64_relocate_section): Handle R_386_TLS_GOTDESC and
+ R_386_TLS_DESC_CALL.
+ (elf64_x86_64_finish_dynamic_symbol): Use GOT_TLS_GD_ANY_P.
+ (elf64_x86_64_finish_dynamic_sections): Set DT_TLSDESC_PLT and
+ DT_TLSDESC_GOT. Set up TLS descriptor lazy resolver PLT entry.
+ (elf_backend_always_size_sections): Define.
+
+2006-01-17 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR binutils/2096
+ * dwarf2.c (comp_unit_contains_address): Update comment.
+ (_bfd_dwarf2_find_nearest_line): Use section's vma, instead of
+ lma. Return TRUE only if both comp_unit_contains_address and
+ comp_unit_find_nearest_line return TRUE.
+ (_bfd_dwarf2_find_line): Use section's vma, instead of lma.
+
+2006-01-18 Alan Modra <amodra@bigpond.net.au>
+
+ * elf-bfd.h (struct elf_backend_data): Add gc_mark_dynamic_ref.
+ (bfd_elf_gc_mark_dynamic_ref_symbol): Declare.
+ * elflink.c (bfd_elf_gc_mark_dynamic_ref_symbol): Rename from
+ elf_gc_mark_dynamic_ref_symbol. Make global.
+ (bfd_elf_gc_sections): Call bed->gc_mark_dynamic_ref.
+ * elfxx-target.h (elf_backend_gc_mark_dynamic_ref): Define.
+ (elfNN_bed): Init new field.
+ * elf64-ppc.c (elf_backend_gc_mark_dynamic_ref): Define.
+ (ppc64_elf_gc_mark_dynamic_ref): New function.
+
+2006-01-17 Alan Modra <amodra@bigpond.net.au>
+
+ * elf64-ppc.c (ppc64_elf_gc_mark_hook): Don't hang forever in loop.
+
+2006-01-17 Nick Clifton <nickc@redhat.com>
+
+ PR binutils/2159
+ * elf.c (elfcore_write_pstatus): Add ATTRIBUTE_UNUSED to unused
+ parameters.
+
+2006-01-11 Nick Clifton <nickc@redhat.com>
+
+ * elf32-arm.c (elf32_arm_output_symbol_hook): Install new entry
+ into the newly (re)allocated map array.
+
+2006-01-09 Alexis Wilke <alexis_wilke@yahoo.com>
+
+ * peXXigen.c (tbl): Add comma after "HIGH3ADJ".
+
+2006-01-01 Jakub Jelinek <jakub@redhat.com>
+
+ * elf64-ppc.c (ppc64_elf_action_discarded): Return 0
+ for .toc1 section.
+
+For older changes see ChangeLog-2005
+
+Local Variables:
+mode: change-log
+left-margin: 8
+fill-column: 74
+version-control: never
+End:
diff --git a/contrib/binutils/bfd/Makefile.am b/contrib/binutils/bfd/Makefile.am
index de811af..48919af 100644
--- a/contrib/binutils/bfd/Makefile.am
+++ b/contrib/binutils/bfd/Makefile.am
@@ -1,6 +1,10 @@
## Process this file with automake to generate Makefile.in
-AUTOMAKE_OPTIONS = cygnus
+AUTOMAKE_OPTIONS = 1.9 cygnus
+ACLOCAL_AMFLAGS = -I . -I .. -I ../config
+
+# Uncomment the following line when doing a release.
+# RELEASE=y
INCDIR = $(srcdir)/../include
CSEARCH = -I. -I$(srcdir) -I$(INCDIR)
@@ -8,13 +12,18 @@ MKDEP = gcc -MM
SUBDIRS = doc po
-docdir = doc
+bfddocdir = doc
bfdlibdir = @bfdlibdir@
bfdincludedir = @bfdincludedir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+htmldir = @htmldir@
+
bfdlib_LTLIBRARIES = libbfd.la
WARN_CFLAGS = @WARN_CFLAGS@
+NO_WERROR = @NO_WERROR@
AM_CFLAGS = $(WARN_CFLAGS)
# bfd.h goes here, for now
@@ -50,12 +59,15 @@ 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-bfin.lo \
+ cpu-cr16.lo \
+ cpu-cr16c.lo \
cpu-cris.lo \
+ cpu-crx.lo \
cpu-d10v.lo \
cpu-d30v.lo \
cpu-dlx.lo \
@@ -71,6 +83,7 @@ ALL_MACHINES = \
cpu-i960.lo \
cpu-ip2k.lo \
cpu-iq2000.lo \
+ cpu-m32c.lo \
cpu-m32r.lo \
cpu-m68hc11.lo \
cpu-m68hc12.lo \
@@ -78,9 +91,12 @@ ALL_MACHINES = \
cpu-m88k.lo \
cpu-m10200.lo \
cpu-m10300.lo \
+ cpu-maxq.lo \
cpu-mcore.lo \
+ cpu-mep.lo \
cpu-mips.lo \
cpu-mmix.lo \
+ cpu-mt.lo \
cpu-msp430.lo \
cpu-or32.lo \
cpu-ns32k.lo \
@@ -90,8 +106,10 @@ ALL_MACHINES = \
cpu-powerpc.lo \
cpu-rs6000.lo \
cpu-s390.lo \
+ cpu-score.lo \
cpu-sh.lo \
cpu-sparc.lo \
+ cpu-spu.lo \
cpu-tic30.lo \
cpu-tic4x.lo \
cpu-tic54x.lo \
@@ -102,15 +120,20 @@ ALL_MACHINES = \
cpu-w65.lo \
cpu-xstormy16.lo \
cpu-xtensa.lo \
+ cpu-xc16x.lo \
+ cpu-z80.lo \
cpu-z8k.lo
ALL_MACHINES_CFILES = \
- cpu-a29k.c \
cpu-alpha.c \
cpu-arc.c \
cpu-arm.c \
cpu-avr.c \
+ cpu-bfin.c \
+ cpu-cr16.c \
cpu-cris.c \
+ cpu-cr16c.c \
+ cpu-crx.c \
cpu-d10v.c \
cpu-d30v.c \
cpu-dlx.c \
@@ -126,6 +149,7 @@ ALL_MACHINES_CFILES = \
cpu-i960.c \
cpu-ip2k.c \
cpu-iq2000.c \
+ cpu-m32c.c \
cpu-m32r.c \
cpu-m68hc11.c \
cpu-m68hc12.c \
@@ -133,9 +157,12 @@ ALL_MACHINES_CFILES = \
cpu-m88k.c \
cpu-m10200.c \
cpu-m10300.c \
+ cpu-maxq.c \
cpu-mcore.c \
+ cpu-mep.c \
cpu-mips.c \
cpu-mmix.c \
+ cpu-mt.c \
cpu-msp430.c \
cpu-or32.c \
cpu-ns32k.c \
@@ -145,8 +172,10 @@ ALL_MACHINES_CFILES = \
cpu-powerpc.c \
cpu-rs6000.c \
cpu-s390.c \
+ cpu-score.c \
cpu-sh.c \
cpu-sparc.c \
+ cpu-spu.c \
cpu-tic30.c \
cpu-tic4x.c \
cpu-tic54x.c \
@@ -157,6 +186,8 @@ ALL_MACHINES_CFILES = \
cpu-w65.c \
cpu-xstormy16.c \
cpu-xtensa.c \
+ cpu-xc16x.c \
+ cpu-z80.c \
cpu-z8k.c
# The .o files needed by all of the 32 bit vectors that are configured into
@@ -173,9 +204,7 @@ BFD32_BACKENDS = \
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 \
@@ -187,6 +216,7 @@ BFD32_BACKENDS = \
coff-i960.lo \
coff-m68k.lo \
coff-m88k.lo \
+ coff-maxq.lo \
coff-mips.lo \
coff-or32.lo \
coff-rs6000.lo \
@@ -201,6 +231,7 @@ BFD32_BACKENDS = \
coff-u68k.lo \
coff-we32k.lo \
coff-w65.lo \
+ coff-z80.lo \
coff-z8k.lo \
cofflink.lo \
dwarf1.lo \
@@ -210,10 +241,13 @@ BFD32_BACKENDS = \
elf.lo \
elf32-am33lin.lo \
elf32-arc.lo \
- elfarm-oabi.lo \
- elfarm-nabi.lo \
+ elf32-arm.lo \
elf32-avr.lo \
+ elf32-bfin.lo \
+ elf32-cr16.lo \
+ elf32-cr16c.lo \
elf32-cris.lo \
+ elf32-crx.lo \
elf32-d10v.lo \
elf32-d30v.lo \
elf32-dlx.lo \
@@ -226,9 +260,9 @@ BFD32_BACKENDS = \
elf32-i386.lo \
elf32-i860.lo \
elf32-i960.lo \
- elf32-ia64.lo \
elf32-ip2k.lo \
elf32-iq2000.lo \
+ elf32-m32c.lo \
elf32-m32r.lo \
elf32-m68hc11.lo \
elf32-m68hc12.lo \
@@ -238,26 +272,35 @@ BFD32_BACKENDS = \
elf-m10200.lo \
elf-m10300.lo \
elf32-mcore.lo \
+ elf32-mep.lo \
elfxx-mips.lo \
elf32-mips.lo \
+ elf32-mt.lo \
elf32-msp430.lo \
elf32-openrisc.lo \
elf32-or32.lo \
elf32-pj.lo \
elf32-ppc.lo \
elf32-s390.lo \
+ elf32-score.lo \
elf32-sh.lo \
+ elf32-sh-symbian.lo \
elf32-sh64.lo \
elf32-sh64-com.lo \
+ elfxx-sparc.lo \
elf32-sparc.lo \
+ elf32-spu.lo \
elf32-v850.lo \
elf32-vax.lo \
elf32-xstormy16.lo \
elf32-xtensa.lo \
+ elf32-xc16x.lo \
elf32.lo \
elflink.lo \
+ elf-attrs.lo \
elf-strtab.lo \
elf-eh-frame.lo \
+ elf-vxworks.lo \
epoc-pe-arm.lo \
epoc-pei-arm.lo \
hp300bsd.lo \
@@ -276,9 +319,9 @@ BFD32_BACKENDS = \
ieee.lo \
m68k4knetbsd.lo \
m68klinux.lo \
- m68klynx.lo \
m68knetbsd.lo \
m88kmach3.lo \
+ m88kopenbsd.lo \
mach-o.lo \
mipsbsd.lo \
newsos3.lo \
@@ -294,6 +337,8 @@ BFD32_BACKENDS = \
pef.lo \
pe-arm.lo \
pei-arm.lo \
+ pe-arm-wince.lo \
+ pei-arm-wince.lo \
pe-i386.lo \
pei-i386.lo \
pe-mcore.lo \
@@ -338,9 +383,7 @@ BFD32_BACKENDS_CFILES = \
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 \
@@ -352,6 +395,7 @@ BFD32_BACKENDS_CFILES = \
coff-i960.c \
coff-m68k.c \
coff-m88k.c \
+ coff-maxq.c \
coff-mips.c \
coff-or32.c \
coff-rs6000.c \
@@ -366,6 +410,7 @@ BFD32_BACKENDS_CFILES = \
coff-u68k.c \
coff-we32k.c \
coff-w65.c \
+ coff-z80.c \
coff-z8k.c \
cofflink.c \
dwarf1.c \
@@ -375,10 +420,13 @@ BFD32_BACKENDS_CFILES = \
elf.c \
elf32-am33lin.c \
elf32-arc.c \
- elfarm-oabi.c \
- elfarm-nabi.c \
+ elf32-arm.c \
elf32-avr.c \
+ elf32-bfin.c \
+ elf32-cr16.c \
+ elf32-cr16c.c \
elf32-cris.c \
+ elf32-crx.c \
elf32-d10v.c \
elf32-d30v.c \
elf32-dlx.c \
@@ -393,6 +441,7 @@ BFD32_BACKENDS_CFILES = \
elf32-i960.c \
elf32-ip2k.c \
elf32-iq2000.c \
+ elf32-m32c.c \
elf32-m32r.c \
elf32-m68k.c \
elf32-m68hc11.c \
@@ -402,8 +451,10 @@ BFD32_BACKENDS_CFILES = \
elf-m10200.c \
elf-m10300.c \
elf32-mcore.c \
+ elf32-mep.c \
elfxx-mips.c \
elf32-mips.c \
+ elf32-mt.c \
elf32-msp430.c \
elf32-openrisc.c \
elf32-or32.c \
@@ -412,16 +463,23 @@ BFD32_BACKENDS_CFILES = \
elf32-sh64.c \
elf32-sh64-com.c \
elf32-s390.c \
+ elf32-score.c \
elf32-sh.c \
+ elf32-sh-symbian.c \
+ elfxx-sparc.c \
elf32-sparc.c \
+ elf32-spu.c \
elf32-v850.c \
elf32-vax.c \
elf32-xstormy16.c \
elf32-xtensa.c \
+ elf32-xc16x.c \
elf32.c \
elflink.c \
+ elf-attrs.c \
elf-strtab.c \
elf-eh-frame.c \
+ elf-vxworks.c \
epoc-pe-arm.c \
epoc-pei-arm.c \
hp300bsd.c \
@@ -440,9 +498,9 @@ BFD32_BACKENDS_CFILES = \
ieee.c \
m68k4knetbsd.c \
m68klinux.c \
- m68klynx.c \
m68knetbsd.c \
m88kmach3.c \
+ m88kopenbsd.c \
mach-o.c \
mipsbsd.c \
newsos3.c \
@@ -458,6 +516,8 @@ BFD32_BACKENDS_CFILES = \
pef.c \
pe-arm.c \
pei-arm.c \
+ pe-arm-wince.c \
+ pei-arm-wince.c \
pe-i386.c \
pei-i386.c \
pe-mcore.c \
@@ -492,6 +552,8 @@ BFD32_BACKENDS_CFILES = \
# 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.
+# elf32-ia64.c requires a 64-bit bfd_vma, and hence can not be put in
+# BFD32_BACKENDS.
BFD64_BACKENDS = \
aix5ppc-core.lo \
aout64.lo \
@@ -499,9 +561,11 @@ BFD64_BACKENDS = \
coff64-rs6000.lo \
demo64.lo \
efi-app-ia64.lo \
+ efi-app-x86_64.lo \
elf64-x86-64.lo \
elf64-alpha.lo \
elf64-hppa.lo \
+ elf32-ia64.lo \
elf64-ia64.lo \
elf64-gen.lo \
elfn32-mips.lo \
@@ -515,7 +579,11 @@ BFD64_BACKENDS = \
mmo.lo \
nlm32-alpha.lo \
nlm64.lo \
- pepigen.lo
+ coff-x86_64.lo \
+ pe-x86_64.lo \
+ pei-x86_64.lo \
+ pepigen.lo \
+ pex64igen.lo
BFD64_BACKENDS_CFILES = \
aix5ppc-core.c \
@@ -524,6 +592,7 @@ BFD64_BACKENDS_CFILES = \
coff64-rs6000.c \
demo64.c \
efi-app-ia64.c \
+ efi-app-x86_64.c \
elf64-x86-64.c \
elf64-alpha.c \
elf64-hppa.c \
@@ -538,7 +607,10 @@ BFD64_BACKENDS_CFILES = \
elf64.c \
mmo.c \
nlm32-alpha.c \
- nlm64.c
+ nlm64.c \
+ coff-x86_64.c \
+ pe-x86_64.c \
+ pei-x86_64.c
OPTIONAL_BACKENDS = \
aix386-core.lo \
@@ -560,15 +632,22 @@ OPTIONAL_BACKENDS_CFILES = \
trad-core.c \
cisco-core.c
+# We want to rerun configure if configure.in, config.bfd or
+# configure.host change. configure.in is needed since the version
+# number in Makefile comes from configure.in.
+CONFIG_STATUS_DEPENDENCIES = \
+ $(srcdir)/configure.in \
+ $(srcdir)/config.bfd \
+ $(srcdir)/configure.host
+
# 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
+INCLUDES = @HDEFINES@ @COREFLAG@ @TDEFINES@ $(CSEARCH) $(CSWITCHES) @INCINTL@
# C source files that correspond to .o's.
SOURCE_CFILES = \
@@ -580,14 +659,14 @@ SOURCE_CFILES = \
$(OPTIONAL_BACKENDS_CFILES)
BUILD_CFILES = \
- elf32-ia64.c elf64-ia64.c peigen.c pepigen.c
+ elf32-ia64.c elf64-ia64.c peigen.c pepigen.c pex64igen.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 \
+ elf-bfd.h elf-hppa.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 \
@@ -615,13 +694,43 @@ po/BLD-POTFILES.in: @MAINT@ Makefile $(BLD_POTFILES)
| LC_COLLATE= sort > tmp.bld \
&& mv tmp.bld $(srcdir)/po/BLD-POTFILES.in
-diststuff: info
+all diststuff: info
+
+.PHONY: install-html install-html-am install-html-recursive
+
+install-html: install-html-recursive
+
+install-html-recursive:
+ @failcom='exit 1'; \
+ for f in x $$MAKEFLAGS; do \
+ case $$f in \
+ *=* | --[!k]*);; \
+ *k*) failcom='fail=yes';; \
+ esac; \
+ done; \
+ 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) \
+ || eval $$failcom; \
+ done; \
+ if test "$$dot_seen" = "no"; then \
+ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
+ fi; test -z "$$fail"
# 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@
+# bfd64_libs Routines for 64bit support
+OFILES = $(BFD_BACKENDS) $(BFD_MACHINES) @COREFILE@ @bfd64_libs@
stamp-ofiles: Makefile
rm -f tofiles
@@ -638,10 +747,12 @@ stamp-ofiles: Makefile
ofiles: stamp-ofiles ; @true
-libbfd_la_SOURCES = $(BFD32_LIBS_CFILES) $(BFD64_LIBS_CFILES)
+# Since BFD64_LIBS is optional and we can't have substitution in
+# libbfd_la_SOURCES, we put BFD64_LIBS in OFILES instead.
+libbfd_la_SOURCES = $(BFD32_LIBS_CFILES)
libbfd_la_DEPENDENCIES = $(OFILES) ofiles
libbfd_la_LIBADD = `cat ofiles` @WIN32LIBADD@
-libbfd_la_LDFLAGS = -release $(VERSION) @WIN32LDFLAGS@
+libbfd_la_LDFLAGS = -release `cat libtool-soversion` @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
@@ -679,6 +790,9 @@ targets.lo: targets.c Makefile
archures.lo: archures.c Makefile
$(LIBTOOL) --mode=compile $(COMPILE) -c $(TDEFAULTS) $(srcdir)/archures.c
+dwarf2.lo: dwarf2.c Makefile
+ $(LIBTOOL) --mode=compile $(COMPILE) -c -DDEBUGDIR=\"$(DEBUGDIR)\" $(srcdir)/dwarf2.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
@@ -709,6 +823,11 @@ pepigen.c : peXXigen.c
sed -e s/XX/pep/g < $(srcdir)/peXXigen.c > pepigen.new
mv -f pepigen.new pepigen.c
+pex64igen.c: peXXigen.c
+ rm -f pex64igen.c
+ sed -e s/XX/pex64/g < $(srcdir)/peXXigen.c > pex64igen.new
+ mv -f pex64igen.new pex64igen.c
+
BFD_H_DEPS= $(INCDIR)/ansidecl.h $(INCDIR)/symcat.h
LOCAL_H_DEPS= libbfd.h sysdep.h config.h
$(BFD32_LIBS) \
@@ -748,8 +867,6 @@ uninstall_libbfd:
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
@@ -817,12 +934,12 @@ 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
+ (cd $(bfddocdir); $(MAKE) protos $(FLAGS_TO_PASS))
+ cp $(bfddocdir)/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
+ cp $(bfddocdir)/libbfd.h libbfd.h-new
$(SHELL) $(srcdir)/../move-if-change libbfd.h-new $(srcdir)/libbfd.h
- cp $(docdir)/libcoff.h libcoff.h-new
+ cp $(bfddocdir)/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
@@ -830,22 +947,22 @@ headers:
$(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
+ (cd $(bfddocdir); $(MAKE) $(FLAGS_TO_PASS) bfd.h)
+ cp $(bfddocdir)/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
+ (cd $(bfddocdir); $(MAKE) $(FLAGS_TO_PASS) libbfd.h)
+ cp $(bfddocdir)/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
+ (cd $(bfddocdir); $(MAKE) $(FLAGS_TO_PASS) libcoff.h)
+ cp $(bfddocdir)/libcoff.h libcoff.h-new
$(SHELL) $(srcdir)/../move-if-change libcoff.h-new $(srcdir)/libcoff.h
touch stmp-lcoff-h
@@ -854,779 +971,981 @@ 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
+DISTCLEANFILES = $(BUILD_CFILES) $(BUILD_HFILES) libtool-soversion
+
+bfdver.h: $(srcdir)/version.h $(srcdir)/Makefile.in
+ @echo "creating $@"
+ @bfd_version=`echo "$(VERSION)" | sed -e 's/\([^\.]*\)\.*\([^\.]*\)\.*\([^\.]*\)\.*\([^\.]*\)\.*\([^\.]*\).*/\1.00\2.00\3.00\4.00\5/' -e 's/\([^\.]*\)\..*\(..\)\..*\(..\)\..*\(..\)\..*\(..\)$$/\1\2\3\4\5/'` ;\
+ bfd_version_string="\"$(VERSION)\"" ;\
+ bfd_soversion="$(VERSION)" ;\
+ bfd_version_package="\"$(PKGVERSION)\"" ;\
+ report_bugs_to="\"$(REPORT_BUGS_TO)\"" ;\
+ if test "x$(RELEASE)" = x ; then \
+ bfd_version_date=`sed -n -e 's/.*DATE //p' < $(srcdir)/version.h` ;\
+ bfd_version_string="\"$(VERSION).$${bfd_version_date}\"" ;\
+ bfd_soversion="$(VERSION).$${bfd_version_date}" ;\
+ fi ;\
+ sed -e "s,@bfd_version@,$$bfd_version," \
+ -e "s,@bfd_version_string@,$$bfd_version_string," \
+ -e "s,@bfd_version_package@,$$bfd_version_package," \
+ -e "s,@report_bugs_to@,$$report_bugs_to," \
+ < $(srcdir)/version.h > $@; \
+ echo "$${bfd_soversion}" > libtool-soversion
# 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 \
+archive.lo: archive.c $(INCDIR)/filenames.h $(INCDIR)/libiberty.h \
+ $(INCDIR)/hashtab.h $(INCDIR)/aout/ar.h $(INCDIR)/aout/ranlib.h \
+ $(INCDIR)/safe-ctype.h
+archures.lo: archures.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \
+ $(INCDIR)/safe-ctype.h
+bfd.lo: bfd.c $(INCDIR)/filenames.h bfdver.h $(INCDIR)/libiberty.h \
+ $(INCDIR)/demangle.h $(INCDIR)/libiberty.h $(INCDIR)/safe-ctype.h \
+ $(INCDIR)/bfdlink.h $(INCDIR)/hashtab.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
+bfdio.lo: bfdio.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h
+bfdwin.lo: bfdwin.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h
+cache.lo: cache.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \
+ $(INCDIR)/libiberty.h
+coffgen.lo: coffgen.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \
+ $(INCDIR)/coff/internal.h libcoff.h $(INCDIR)/bfdlink.h
+corefile.lo: corefile.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h
+format.lo: format.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h
+init.lo: init.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h
+libbfd.lo: libbfd.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h
opncls.lo: opncls.c $(INCDIR)/filenames.h $(INCDIR)/objalloc.h \
+ $(INCDIR)/hashtab.h $(INCDIR)/libiberty.h
+reloc.lo: reloc.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
+ $(INCDIR)/hashtab.h
+section.lo: section.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \
+ $(INCDIR)/bfdlink.h
+syms.lo: syms.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.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)/hashtab.h \
+ $(INCDIR)/fnmatch.h targmatch.h
+hash.lo: hash.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \
+ $(INCDIR)/objalloc.h $(INCDIR)/libiberty.h
+linker.lo: linker.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \
+ $(INCDIR)/bfdlink.h genlink.h
+srec.lo: srec.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \
+ $(INCDIR)/libiberty.h $(INCDIR)/safe-ctype.h
+binary.lo: binary.c $(INCDIR)/filenames.h $(INCDIR)/safe-ctype.h \
+ $(INCDIR)/hashtab.h
+tekhex.lo: tekhex.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.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
+ihex.lo: ihex.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \
+ $(INCDIR)/libiberty.h $(INCDIR)/safe-ctype.h
+stabs.lo: stabs.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.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)/hashtab.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)/hashtab.h \
$(INCDIR)/bfdlink.h
+archive64.lo: archive64.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \
+ $(INCDIR)/aout/ar.h
+cpu-alpha.lo: cpu-alpha.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h
+cpu-arc.lo: cpu-arc.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h
+cpu-arm.lo: cpu-arm.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \
+ $(INCDIR)/libiberty.h
+cpu-avr.lo: cpu-avr.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h
+cpu-bfin.lo: cpu-bfin.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h
+cpu-cr16.lo: cpu-cr16.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h
+cpu-cris.lo: cpu-cris.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h
+cpu-cr16c.lo: cpu-cr16c.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h
+cpu-crx.lo: cpu-crx.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h
+cpu-d10v.lo: cpu-d10v.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h
+cpu-d30v.lo: cpu-d30v.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h
+cpu-dlx.lo: cpu-dlx.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h
+cpu-fr30.lo: cpu-fr30.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h
+cpu-frv.lo: cpu-frv.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h
+cpu-h8300.lo: cpu-h8300.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h
+cpu-h8500.lo: cpu-h8500.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h
+cpu-hppa.lo: cpu-hppa.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h
+cpu-ia64.lo: cpu-ia64.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \
+ cpu-ia64-opc.c $(srcdir)/../opcodes/ia64-opc.h $(INCDIR)/opcode/ia64.h
+cpu-i370.lo: cpu-i370.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h
+cpu-i386.lo: cpu-i386.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h
+cpu-i860.lo: cpu-i860.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h
+cpu-i960.lo: cpu-i960.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h
+cpu-ip2k.lo: cpu-ip2k.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h
+cpu-iq2000.lo: cpu-iq2000.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h
+cpu-m32c.lo: cpu-m32c.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h
+cpu-m32r.lo: cpu-m32r.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h
+cpu-m68hc11.lo: cpu-m68hc11.c $(INCDIR)/filenames.h \
+ $(INCDIR)/hashtab.h
+cpu-m68hc12.lo: cpu-m68hc12.c $(INCDIR)/filenames.h \
+ $(INCDIR)/hashtab.h
+cpu-m68k.lo: cpu-m68k.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \
+ $(INCDIR)/opcode/m68k.h
+cpu-m88k.lo: cpu-m88k.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h
+cpu-m10200.lo: cpu-m10200.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h
+cpu-m10300.lo: cpu-m10300.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h
+cpu-maxq.lo: cpu-maxq.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h
+cpu-mcore.lo: cpu-mcore.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h
+cpu-mep.lo: cpu-mep.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h
+cpu-mips.lo: cpu-mips.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h
+cpu-mmix.lo: cpu-mmix.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h
+cpu-mt.lo: cpu-mt.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h
+cpu-msp430.lo: cpu-msp430.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h
+cpu-or32.lo: cpu-or32.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h
+cpu-ns32k.lo: cpu-ns32k.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \
+ ns32k.h
+cpu-openrisc.lo: cpu-openrisc.c $(INCDIR)/filenames.h \
+ $(INCDIR)/hashtab.h
+cpu-pdp11.lo: cpu-pdp11.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h
+cpu-pj.lo: cpu-pj.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h
+cpu-powerpc.lo: cpu-powerpc.c $(INCDIR)/filenames.h \
+ $(INCDIR)/hashtab.h
+cpu-rs6000.lo: cpu-rs6000.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h
+cpu-s390.lo: cpu-s390.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h
+cpu-score.lo: cpu-score.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h
+cpu-sh.lo: cpu-sh.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \
+ $(srcdir)/../opcodes/sh-opc.h
+cpu-sparc.lo: cpu-sparc.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h
+cpu-spu.lo: cpu-spu.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h
+cpu-tic30.lo: cpu-tic30.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h
+cpu-tic4x.lo: cpu-tic4x.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h
+cpu-tic54x.lo: cpu-tic54x.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h
+cpu-tic80.lo: cpu-tic80.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h
+cpu-v850.lo: cpu-v850.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \
+ $(INCDIR)/safe-ctype.h
+cpu-vax.lo: cpu-vax.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h
+cpu-we32k.lo: cpu-we32k.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h
+cpu-w65.lo: cpu-w65.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h
+cpu-xstormy16.lo: cpu-xstormy16.c $(INCDIR)/filenames.h \
+ $(INCDIR)/hashtab.h
+cpu-xtensa.lo: cpu-xtensa.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h
+cpu-xc16x.lo: cpu-xc16x.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h
+cpu-z80.lo: cpu-z80.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h
+cpu-z8k.lo: cpu-z8k.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h
+aout-adobe.lo: aout-adobe.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.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
+ $(INCDIR)/safe-ctype.h $(INCDIR)/hashtab.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
+ $(INCDIR)/hashtab.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
+ $(INCDIR)/safe-ctype.h $(INCDIR)/hashtab.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
+ libaout.h aoutf1.h $(INCDIR)/filenames.h $(INCDIR)/hashtab.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
+ $(INCDIR)/safe-ctype.h $(INCDIR)/hashtab.h
+aout0.lo: aout0.c aoutf1.h $(INCDIR)/filenames.h $(INCDIR)/hashtab.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)/bfdlink.h libaout.h $(INCDIR)/hashtab.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
+ $(INCDIR)/hashtab.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)/hashtab.h \
+ $(INCDIR)/bfdlink.h genlink.h $(INCDIR)/bout.h $(INCDIR)/libiberty.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 \
+ coff-i386.c $(INCDIR)/hashtab.h $(INCDIR)/coff/i386.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)/hashtab.h $(INCDIR)/coff/sparc.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 \
+ $(INCDIR)/hashtab.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)/hashtab.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 \
+ coff-m68k.c $(INCDIR)/hashtab.h $(INCDIR)/coff/m68k.h \
+ $(INCDIR)/coff/internal.h libcoff.h $(INCDIR)/bfdlink.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 \
+coff-h8300.lo: coff-h8300.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.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)/hashtab.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)/hashtab.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 \
+coff-i860.lo: coff-i860.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.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)/hashtab.h $(INCDIR)/coff/i386.h $(INCDIR)/coff/external.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 \
+coff-i960.lo: coff-i960.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.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)/hashtab.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 \
+coff-m88k.lo: coff-m88k.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.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 \
+coff-maxq.lo: coff-maxq.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \
+ $(INCDIR)/coff/maxq.h $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \
+ libcoff.h $(INCDIR)/bfdlink.h $(INCDIR)/libiberty.h \
coffcode.h coffswap.h
+coff-mips.lo: coff-mips.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
+ $(INCDIR)/hashtab.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)/hashtab.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
+ $(INCDIR)/bfdlink.h $(INCDIR)/hashtab.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)/hashtab.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)/hashtab.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
+ $(INCDIR)/hashtab.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
+ $(INCDIR)/hashtab.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)/hashtab.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)/hashtab.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)/hashtab.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)/filenames.h $(INCDIR)/bfdlink.h \
+ $(INCDIR)/hashtab.h $(INCDIR)/coff/tic80.h $(INCDIR)/coff/external.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 \
+ $(INCDIR)/hashtab.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)/hashtab.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
+coff-w65.lo: coff-w65.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \
+ $(INCDIR)/bfdlink.h $(INCDIR)/coff/w65.h $(INCDIR)/coff/external.h \
+ $(INCDIR)/coff/internal.h libcoff.h coffcode.h coffswap.h
+coff-z80.lo: coff-z80.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \
+ $(INCDIR)/bfdlink.h $(INCDIR)/coff/z80.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)/hashtab.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
+ $(INCDIR)/hashtab.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
+ $(INCDIR)/hashtab.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
+ $(INCDIR)/hashtab.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 $(INCDIR)/libiberty.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
+ $(INCDIR)/hashtab.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
+ coff-i386.c $(INCDIR)/hashtab.h $(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 \
+ $(INCDIR)/hashtab.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 $(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 \
+ $(INCDIR)/elf/reloc-macros.h elf-m10300.c $(INCDIR)/hashtab.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-arc.lo: elf32-arc.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.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
-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-arm.lo: elf32-arm.c $(INCDIR)/filenames.h $(INCDIR)/libiberty.h \
+ $(INCDIR)/hashtab.h elf-bfd.h $(INCDIR)/elf/common.h \
+ $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h \
+ elf-vxworks.h $(INCDIR)/elf/arm.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-avr.lo: elf32-avr.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.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-avr.h elf32-target.h
+elf32-bfin.lo: elf32-bfin.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \
+ elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
+ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/bfin.h \
+ $(INCDIR)/elf/reloc-macros.h $(INCDIR)/elf/dwarf2.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 \
+elf32-cr16.lo: elf32-cr16.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
+ $(INCDIR)/hashtab.h $(INCDIR)/libiberty.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 \
+ $(INCDIR)/elf/cr16.h $(INCDIR)/elf/reloc-macros.h elf32-target.h
+elf32-cr16c.lo: elf32-cr16c.c $(INCDIR)/filenames.h \
+ $(INCDIR)/hashtab.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/cr16c.h \
+ $(INCDIR)/elf/reloc-macros.h elf-bfd.h $(INCDIR)/elf/common.h \
+ $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h elf32-target.h
+elf32-cris.lo: elf32-cris.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.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/external.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/cris.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 \
+elf32-crx.lo: elf32-crx.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
+ $(INCDIR)/hashtab.h elf-bfd.h $(INCDIR)/elf/common.h \
+ $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/elf/crx.h \
+ $(INCDIR)/elf/reloc-macros.h elf32-target.h
+elf32-d10v.lo: elf32-d10v.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.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 $(INCDIR)/hashtab.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 $(INCDIR)/hashtab.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 $(INCDIR)/hashtab.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 $(INCDIR)/hashtab.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 \
+ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/frv.h \
+ $(INCDIR)/elf/reloc-macros.h $(INCDIR)/elf/dwarf2.h \
elf32-target.h
+elf32-gen.lo: elf32-gen.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.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 \
+ $(INCDIR)/hashtab.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 $(INCDIR)/hashtab.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 \
+ $(INCDIR)/hashtab.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 \
+ $(INCDIR)/hashtab.h elf-bfd.h $(INCDIR)/elf/common.h \
+ $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h elf-vxworks.h \
+ $(INCDIR)/elf/i386.h $(INCDIR)/elf/reloc-macros.h elf32-target.h
+elf32-i860.lo: elf32-i860.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.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 \
+ $(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 $(INCDIR)/hashtab.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 $(INCDIR)/hashtab.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 \
+ $(INCDIR)/hashtab.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-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-m32c.lo: elf32-m32c.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \
+ elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
+ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/m32c.h \
+ $(INCDIR)/elf/reloc-macros.h $(INCDIR)/libiberty.h \
elf32-target.h
-elf32-iq2000.lo: elf32-iq2000.c $(INCDIR)/filenames.h \
+elf32-m32r.lo: elf32-m32r.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.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/external.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/m32r.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 \
+ $(INCDIR)/hashtab.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 $(INCDIR)/opcode/m68k.h \
elf32-target.h
elf32-m68hc11.lo: elf32-m68hc11.c $(INCDIR)/filenames.h \
- $(INCDIR)/bfdlink.h elf-bfd.h $(INCDIR)/elf/common.h \
+ $(INCDIR)/bfdlink.h $(INCDIR)/hashtab.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)/bfdlink.h $(INCDIR)/hashtab.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)/bfdlink.h $(INCDIR)/hashtab.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-m88k.lo: elf32-m88k.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.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 $(INCDIR)/hashtab.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 $(INCDIR)/hashtab.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)/bfdlink.h $(INCDIR)/hashtab.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 \
+elf32-mep.lo: elf32-mep.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.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)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/mep.h \
+ $(INCDIR)/elf/reloc-macros.h $(INCDIR)/libiberty.h \
+ elf32-target.h
+elfxx-mips.lo: elfxx-mips.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.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 \
+ elfxx-mips.h $(INCDIR)/elf/mips.h $(INCDIR)/elf/reloc-macros.h \
+ elf-vxworks.h $(INCDIR)/coff/sym.h $(INCDIR)/coff/symconst.h \
+ $(INCDIR)/coff/ecoff.h $(INCDIR)/coff/mips.h $(INCDIR)/coff/external.h
+elf32-mips.lo: elf32-mips.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.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 elf-vxworks.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-mt.lo: elf32-mt.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \
+ elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
+ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/mt.h \
+ $(INCDIR)/elf/reloc-macros.h elf32-target.h
+elf32-msp430.lo: elf32-msp430.c $(INCDIR)/filenames.h \
+ $(INCDIR)/libiberty.h $(INCDIR)/hashtab.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 \
+ $(INCDIR)/hashtab.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 $(INCDIR)/hashtab.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/external.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/or32.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
+ $(INCDIR)/hashtab.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
+ $(INCDIR)/hashtab.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 elf-vxworks.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.h elf32-sh.c $(INCDIR)/hashtab.h elf-vxworks.h \
+ $(INCDIR)/elf/sh.h $(INCDIR)/elf/reloc-macros.h $(INCDIR)/libiberty.h \
+ $(srcdir)/../opcodes/sh-opc.h elf32-sh-relocs.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
+ $(INCDIR)/hashtab.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 \
+ $(INCDIR)/hashtab.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-score.lo: elf32-score.c $(INCDIR)/filenames.h \
+ $(INCDIR)/hashtab.h $(INCDIR)/libiberty.h elf-bfd.h \
+ $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
+ $(INCDIR)/bfdlink.h $(INCDIR)/elf/score.h $(INCDIR)/elf/reloc-macros.h \
elf32-target.h
elf32-sh.lo: elf32-sh.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
+ $(INCDIR)/hashtab.h elf-bfd.h $(INCDIR)/elf/common.h \
+ $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h elf-vxworks.h \
+ $(INCDIR)/elf/sh.h $(INCDIR)/elf/reloc-macros.h $(INCDIR)/libiberty.h \
+ $(srcdir)/../opcodes/sh-opc.h elf32-sh-relocs.h elf32-target.h
+elf32-sh-symbian.lo: elf32-sh-symbian.c elf32-sh.c \
+ $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h $(INCDIR)/hashtab.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
+ $(INCDIR)/elf/external.h elf-vxworks.h $(INCDIR)/elf/sh.h \
+ $(INCDIR)/elf/reloc-macros.h $(INCDIR)/libiberty.h \
+ $(srcdir)/../opcodes/sh-opc.h elf32-sh-relocs.h elf32-target.h
+elfxx-sparc.lo: elfxx-sparc.c $(INCDIR)/filenames.h \
+ $(INCDIR)/bfdlink.h $(INCDIR)/hashtab.h $(INCDIR)/libiberty.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 elfxx-sparc.h elf-vxworks.h
elf32-sparc.lo: elf32-sparc.c $(INCDIR)/filenames.h \
- $(INCDIR)/bfdlink.h elf-bfd.h $(INCDIR)/elf/common.h \
+ $(INCDIR)/bfdlink.h $(INCDIR)/hashtab.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
+ elfxx-sparc.h elf-vxworks.h elf32-target.h
+elf32-spu.lo: elf32-spu.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
+ $(INCDIR)/hashtab.h elf-bfd.h $(INCDIR)/elf/common.h \
+ $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/elf/spu.h \
+ $(INCDIR)/elf/reloc-macros.h elf32-spu.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)/hashtab.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 \
+ $(INCDIR)/hashtab.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 \
+ $(INCDIR)/hashtab.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)/bfdlink.h $(INCDIR)/hashtab.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-xc16x.lo: elf32-xc16x.c $(INCDIR)/filenames.h \
+ $(INCDIR)/hashtab.h elf-bfd.h $(INCDIR)/elf/common.h \
+ $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h \
+ $(INCDIR)/elf/xc16x.h $(INCDIR)/elf/reloc-macros.h \
+ $(INCDIR)/elf/dwarf2.h $(INCDIR)/libiberty.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
+ $(INCDIR)/bfdlink.h $(INCDIR)/hashtab.h elf-bfd.h $(INCDIR)/elf/common.h \
+ $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h elfcore.h
elflink.lo: elflink.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
+ $(INCDIR)/hashtab.h elf-bfd.h $(INCDIR)/elf/common.h \
+ $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/safe-ctype.h \
+ $(INCDIR)/libiberty.h $(INCDIR)/objalloc.h
+elf-attrs.lo: elf-attrs.c $(INCDIR)/filenames.h $(INCDIR)/libiberty.h \
+ $(INCDIR)/hashtab.h elf-bfd.h $(INCDIR)/elf/common.h \
+ $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h
+elf-strtab.lo: elf-strtab.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.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
+ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.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
+ $(INCDIR)/hashtab.h elf-bfd.h $(INCDIR)/elf/common.h \
+ $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h \
+ $(INCDIR)/elf/dwarf2.h
+elf-vxworks.lo: elf-vxworks.c $(INCDIR)/filenames.h \
+ $(INCDIR)/hashtab.h elf-bfd.h $(INCDIR)/elf/common.h \
+ $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h \
+ elf-vxworks.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
+ coff-arm.c $(INCDIR)/hashtab.h $(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 \
+ coff-arm.c $(INCDIR)/hashtab.h $(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 $(INCDIR)/hashtab.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)/bfdlink.h libaout.h $(INCDIR)/hashtab.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 \
+i386aout.lo: i386aout.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.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 $(INCDIR)/hashtab.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 \
+ libaout.h $(INCDIR)/hashtab.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
+ aout-target.h
+i386freebsd.lo: i386freebsd.c freebsd.h $(INCDIR)/filenames.h \
+ $(INCDIR)/hashtab.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)/hashtab.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 $(INCDIR)/hashtab.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 $(INCDIR)/hashtab.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
+ $(INCDIR)/hashtab.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)/hashtab.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)/hashtab.h \
+ $(INCDIR)/bfdlink.h libaout.h $(INCDIR)/os9k.h
+ieee.lo: ieee.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.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
+ $(INCDIR)/hashtab.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)/hashtab.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
m68knetbsd.lo: m68knetbsd.c netbsd.h $(INCDIR)/filenames.h \
+ $(INCDIR)/hashtab.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 $(INCDIR)/hashtab.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 \
+m88kopenbsd.lo: m88kopenbsd.c netbsd.h $(INCDIR)/filenames.h \
+ $(INCDIR)/hashtab.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 $(INCDIR)/filenames.h mach-o.h \
+ $(INCDIR)/hashtab.h $(INCDIR)/libiberty.h mach-o-target.c
+mipsbsd.lo: mipsbsd.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.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 \
+newsos3.lo: newsos3.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.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 $(INCDIR)/hashtab.h \
libnlm.h $(INCDIR)/nlm/common.h $(INCDIR)/nlm/internal.h \
- $(INCDIR)/nlm/external.h nlmswap.h nlm-target.h
+ $(INCDIR)/nlm/external.h
+nlm32-i386.lo: nlm32-i386.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.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)/hashtab.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)/hashtab.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-ppc.lo: nlm32-ppc.c $(INCDIR)/filenames.h $(INCDIR)/nlm/ppc-ext.h \
+nlm32.lo: nlm32.c nlmcode.h $(INCDIR)/filenames.h $(INCDIR)/hashtab.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
+ $(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
+ $(INCDIR)/hashtab.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
+ $(INCDIR)/hashtab.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
+ $(INCDIR)/bfdlink.h $(INCDIR)/hashtab.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 $(INCDIR)/hashtab.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)/filenames.h $(INCDIR)/safe-ctype.h \
+ pef.h pef-traceback.h $(INCDIR)/hashtab.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
+ $(INCDIR)/hashtab.h $(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)/hashtab.h $(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-arm-wince.lo: pe-arm-wince.c pe-arm.c $(INCDIR)/filenames.h \
+ coff-arm.c $(INCDIR)/hashtab.h $(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 \
+pei-arm-wince.lo: pei-arm-wince.c pei-arm.c $(INCDIR)/filenames.h \
+ coff-arm.c $(INCDIR)/hashtab.h $(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)/hashtab.h $(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
+ $(INCDIR)/hashtab.h $(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
+ $(INCDIR)/hashtab.h $(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
+ $(INCDIR)/hashtab.h $(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)/hashtab.h $(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)/hashtab.h $(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)/hashtab.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 \
+pei-sh.lo: pei-sh.c $(INCDIR)/filenames.h coff-sh.c \
+ $(INCDIR)/libiberty.h $(INCDIR)/hashtab.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)/hashtab.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
-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 \
+pei-mips.lo: pei-mips.c $(INCDIR)/filenames.h pe-mips.c \
+ $(INCDIR)/hashtab.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
+ppcboot.lo: ppcboot.c $(INCDIR)/filenames.h $(INCDIR)/safe-ctype.h \
+ $(INCDIR)/hashtab.h
+reloc16.lo: reloc16.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \
+ $(INCDIR)/bfdlink.h genlink.h $(INCDIR)/coff/internal.h \
+ libcoff.h
+riscix.lo: riscix.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.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
+ aout-target.h $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def \
+ $(INCDIR)/aout/ar.h
+sparclinux.lo: sparclinux.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.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)/hashtab.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
+ $(INCDIR)/hashtab.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
+ $(INCDIR)/filenames.h $(INCDIR)/hashtab.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
+ $(INCDIR)/hashtab.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 \
+ $(INCDIR)/hashtab.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 $(INCDIR)/hashtab.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
+versados.lo: versados.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \
+ $(INCDIR)/libiberty.h
vms.lo: vms.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
- vms.h
+ $(INCDIR)/hashtab.h vms.h
vms-gsd.lo: vms-gsd.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
+ $(INCDIR)/hashtab.h vms.h
+vms-hdr.lo: vms-hdr.c $(INCDIR)/filenames.h bfdver.h \
+ $(INCDIR)/bfdlink.h $(INCDIR)/safe-ctype.h $(INCDIR)/hashtab.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
+ $(INCDIR)/hashtab.h vms.h
vms-tir.lo: vms-tir.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
- vms.h
+ $(INCDIR)/hashtab.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
+ $(INCDIR)/hashtab.h $(INCDIR)/coff/internal.h $(INCDIR)/coff/xcoff.h \
+ libcoff.h libxcoff.h
+xsym.lo: xsym.c $(INCDIR)/filenames.h xsym.h $(INCDIR)/hashtab.h
+xtensa-isa.lo: xtensa-isa.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \
+ $(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
+aix5ppc-core.lo: aix5ppc-core.c $(INCDIR)/filenames.h
aout64.lo: aout64.c aoutx.h $(INCDIR)/filenames.h $(INCDIR)/safe-ctype.h \
- $(INCDIR)/bfdlink.h libaout.h $(INCDIR)/aout/aout64.h \
+ $(INCDIR)/bfdlink.h libaout.h $(INCDIR)/hashtab.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
+ $(INCDIR)/hashtab.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
+ $(INCDIR)/bfdlink.h $(INCDIR)/hashtab.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
+ $(INCDIR)/hashtab.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
+ coff-ia64.c $(INCDIR)/hashtab.h $(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
+efi-app-x86_64.lo: efi-app-x86_64.c $(INCDIR)/filenames.h \
+ coff-x86_64.c $(INCDIR)/hashtab.h $(INCDIR)/coff/x86_64.h \
+ $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \
+ $(INCDIR)/coff/pe.h libcoff.h $(INCDIR)/bfdlink.h $(INCDIR)/libiberty.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)/bfdlink.h $(INCDIR)/hashtab.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)/hashtab.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/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 $(INCDIR)/hashtab.h elf-bfd.h \
$(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
- $(INCDIR)/bfdlink.h elf64-target.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 $(INCDIR)/hashtab.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)/hashtab.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 \
+elf64-mips.lo: elf64-mips.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.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 \
+elf64-mmix.lo: elf64-mmix.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.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 \
+ $(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 \
+ $(INCDIR)/hashtab.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 \
+ $(INCDIR)/hashtab.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
+ $(INCDIR)/hashtab.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)/hashtab.h elf-bfd.h $(INCDIR)/elf/common.h \
+ $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h \
$(INCDIR)/elf/sparc.h $(INCDIR)/elf/reloc-macros.h \
- elf64-target.h
+ $(INCDIR)/opcode/sparc.h elfxx-sparc.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
+ $(INCDIR)/bfdlink.h $(INCDIR)/hashtab.h elf-bfd.h $(INCDIR)/elf/common.h \
+ $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h elfcore.h
+mmo.lo: mmo.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.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
+ $(INCDIR)/hashtab.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 $(INCDIR)/hashtab.h \
+ libnlm.h $(INCDIR)/nlm/common.h $(INCDIR)/nlm/internal.h \
+ $(INCDIR)/nlm/external.h
+coff-x86_64.lo: coff-x86_64.c $(INCDIR)/filenames.h \
+ $(INCDIR)/hashtab.h $(INCDIR)/coff/x86_64.h $(INCDIR)/coff/external.h \
+ $(INCDIR)/coff/internal.h $(INCDIR)/coff/pe.h libcoff.h \
+ $(INCDIR)/bfdlink.h $(INCDIR)/libiberty.h coffcode.h \
+ coffswap.h
+pe-x86_64.lo: pe-x86_64.c $(INCDIR)/filenames.h coff-x86_64.c \
+ $(INCDIR)/hashtab.h $(INCDIR)/coff/x86_64.h $(INCDIR)/coff/external.h \
+ $(INCDIR)/coff/internal.h $(INCDIR)/coff/pe.h libcoff.h \
+ $(INCDIR)/bfdlink.h $(INCDIR)/libiberty.h coffcode.h \
+ peicode.h libpei.h
+pei-x86_64.lo: pei-x86_64.c $(INCDIR)/filenames.h coff-x86_64.c \
+ $(INCDIR)/hashtab.h $(INCDIR)/coff/x86_64.h $(INCDIR)/coff/external.h \
+ $(INCDIR)/coff/internal.h $(INCDIR)/coff/pe.h libcoff.h \
+ $(INCDIR)/bfdlink.h $(INCDIR)/libiberty.h coffcode.h \
+ peicode.h libpei.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
+ $(INCDIR)/hashtab.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 $(INCDIR)/hashtab.h
+irix-core.lo: irix-core.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h
+lynx-core.lo: lynx-core.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h
+osf-core.lo: osf-core.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h
+sco5-core.lo: sco5-core.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \
+ libaout.h $(INCDIR)/bfdlink.h
+trad-core.lo: trad-core.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \
+ libaout.h $(INCDIR)/bfdlink.h
+cisco-core.lo: cisco-core.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h
+elf32-ia64.lo: elf32-ia64.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.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 $(INCDIR)/hashtab.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)/hashtab.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)/hashtab.h \
+ $(INCDIR)/coff/internal.h $(INCDIR)/coff/ia64.h $(INCDIR)/coff/external.h \
+ $(INCDIR)/coff/pe.h libcoff.h $(INCDIR)/bfdlink.h libpei.h
+pex64igen.lo: pex64igen.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \
+ $(INCDIR)/coff/internal.h $(INCDIR)/coff/x86_64.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
index a6685f2..8f4580e 100644
--- a/contrib/binutils/bfd/Makefile.in
+++ b/contrib/binutils/bfd/Makefile.in
@@ -1,6 +1,8 @@
-# Makefile.in generated automatically by automake 1.4-p6 from Makefile.am
+# Makefile.in generated by automake 1.9.6 from Makefile.am.
+# @configure_input@
-# Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc.
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005 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.
@@ -10,61 +12,111 @@
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
+@SET_MAKE@
-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@
-
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
INSTALL = @INSTALL@
-INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS)
-INSTALL_DATA = @INSTALL_DATA@
-INSTALL_SCRIPT = @INSTALL_SCRIPT@
-transform = @program_transform_name@
-
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+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@
+DIST_COMMON = $(srcdir)/../config.guess $(srcdir)/../config.sub README \
+ ChangeLog $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
+ $(top_srcdir)/configure $(am__configure_deps) \
+ $(srcdir)/config.in $(srcdir)/../mkinstalldirs \
+ $(srcdir)/bfd-in2.h $(top_srcdir)/po/Make-in \
+ $(srcdir)/../ltmain.sh $(srcdir)/../config.guess \
+ $(srcdir)/../config.sub
+subdir = .
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \
+ $(top_srcdir)/../config/depstand.m4 \
+ $(top_srcdir)/../config/gettext-sister.m4 \
+ $(top_srcdir)/../config/lead-dot.m4 \
+ $(top_srcdir)/../config/nls.m4 $(top_srcdir)/../config/po.m4 \
+ $(top_srcdir)/../config/progtest.m4 \
+ $(top_srcdir)/../config/stdint.m4 $(top_srcdir)/../libtool.m4 \
+ $(top_srcdir)/../ltoptions.m4 $(top_srcdir)/../ltsugar.m4 \
+ $(top_srcdir)/../ltversion.m4 $(top_srcdir)/bfd.m4 \
+ $(top_srcdir)/warning.m4 $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.in
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
+ configure.lineno configure.status.lineno
+mkinstalldirs = $(SHELL) $(top_srcdir)/../mkinstalldirs
+CONFIG_HEADER = config.h
+CONFIG_CLEAN_FILES = bfd-in3.h po/Makefile.in
+LIBRARIES = $(noinst_LIBRARIES)
+ARFLAGS = cru
+libbfd_a_AR = $(AR) $(ARFLAGS)
+libbfd_a_LIBADD =
+am_libbfd_a_OBJECTS =
+libbfd_a_OBJECTS = $(am_libbfd_a_OBJECTS)
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+ *) f=$$p;; \
+ esac;
+am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
+am__installdirs = "$(DESTDIR)$(bfdlibdir)"
+bfdlibLTLIBRARIES_INSTALL = $(INSTALL)
+LTLIBRARIES = $(bfdlib_LTLIBRARIES)
+am__objects_1 = 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
+am_libbfd_la_OBJECTS = $(am__objects_1)
+libbfd_la_OBJECTS = $(am_libbfd_la_OBJECTS)
+DEFAULT_INCLUDES = -I. -I$(srcdir) -I.
+depcomp =
+am__depfiles_maybe =
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \
+ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+ $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(AM_LDFLAGS) $(LDFLAGS) -o $@
+SOURCES = $(libbfd_a_SOURCES) $(libbfd_la_SOURCES)
+RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
+ html-recursive info-recursive install-data-recursive \
+ install-exec-recursive install-info-recursive \
+ install-recursive installcheck-recursive installdirs-recursive \
+ pdf-recursive ps-recursive uninstall-info-recursive \
+ uninstall-recursive
+ETAGS = etags
+CTAGS = ctags
+DIST_SUBDIRS = $(SUBDIRS)
+ACLOCAL = @ACLOCAL@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
AR = @AR@
-AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
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@
@@ -73,74 +125,154 @@ BFD_HOST_U_64_BIT = @BFD_HOST_U_64_BIT@
CATALOGS = @CATALOGS@
CATOBJEXT = @CATOBJEXT@
CC = @CC@
+CCDEPMODE = @CCDEPMODE@
CC_FOR_BUILD = @CC_FOR_BUILD@
+CFLAGS = @CFLAGS@
COREFILE = @COREFILE@
COREFLAG = @COREFLAG@
-CXX = @CXX@
-CXXCPP = @CXXCPP@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CYGPATH_W = @CYGPATH_W@
DATADIRNAME = @DATADIRNAME@
-DLLTOOL = @DLLTOOL@
+DEBUGDIR = @DEBUGDIR@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DUMPBIN = @DUMPBIN@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
EXEEXT = @EXEEXT@
EXEEXT_FOR_BUILD = @EXEEXT_FOR_BUILD@
-GCJ = @GCJ@
-GCJFLAGS = @GCJFLAGS@
-GMOFILES = @GMOFILES@
+FGREP = @FGREP@
+GENCAT = @GENCAT@
+GENINSRC_NEVER_FALSE = @GENINSRC_NEVER_FALSE@
+GENINSRC_NEVER_TRUE = @GENINSRC_NEVER_TRUE@
GMSGFMT = @GMSGFMT@
-GT_NO = @GT_NO@
-GT_YES = @GT_YES@
+GREP = @GREP@
HDEFINES = @HDEFINES@
-INCLUDE_LOCALE_H = @INCLUDE_LOCALE_H@
+INCINTL = @INCINTL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_LIBBFD_FALSE = @INSTALL_LIBBFD_FALSE@
+INSTALL_LIBBFD_TRUE = @INSTALL_LIBBFD_TRUE@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
INSTOBJEXT = @INSTOBJEXT@
-INTLDEPS = @INTLDEPS@
-INTLLIBS = @INTLLIBS@
-INTLOBJS = @INTLOBJS@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LIBINTL = @LIBINTL@
+LIBINTL_DEP = @LIBINTL_DEP@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
MAINT = @MAINT@
+MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
+MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
MAKEINFO = @MAKEINFO@
MKINSTALLDIRS = @MKINSTALLDIRS@
MSGFMT = @MSGFMT@
-OBJDUMP = @OBJDUMP@
+MSGMERGE = @MSGMERGE@
+NM = @NM@
+NO_WERROR = @NO_WERROR@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
-POFILES = @POFILES@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PKGVERSION = @PKGVERSION@
POSUB = @POSUB@
RANLIB = @RANLIB@
+REPORT_BUGS_TEXI = @REPORT_BUGS_TEXI@
+REPORT_BUGS_TO = @REPORT_BUGS_TO@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
STRIP = @STRIP@
TDEFINES = @TDEFINES@
-USE_INCLUDED_LIBINTL = @USE_INCLUDED_LIBINTL@
USE_NLS = @USE_NLS@
VERSION = @VERSION@
+WARN_CFLAGS = @WARN_CFLAGS@
WIN32LDFLAGS = @WIN32LDFLAGS@
WIN32LIBADD = @WIN32LIBADD@
+XGETTEXT = @XGETTEXT@
+ac_ct_AR = @ac_ct_AR@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+ac_ct_RANLIB = @ac_ct_RANLIB@
+ac_ct_STRIP = @ac_ct_STRIP@
all_backends = @all_backends@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bfd64_libs = @bfd64_libs@
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@
+bfdincludedir = @bfdincludedir@
+bfdlibdir = @bfdlibdir@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_noncanonical = @host_noncanonical@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localstatedir = @localstatedir@
+lt_ECHO = @lt_ECHO@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+sysconfdir = @sysconfdir@
+target = @target@
+target_alias = @target_alias@
+target_cpu = @target_cpu@
+target_noncanonical = @target_noncanonical@
+target_os = @target_os@
+target_vendor = @target_vendor@
tdefaults = @tdefaults@
wordsize = @wordsize@
+AUTOMAKE_OPTIONS = 1.9 cygnus
+ACLOCAL_AMFLAGS = -I . -I .. -I ../config
-AUTOMAKE_OPTIONS = cygnus
-
+# Uncomment the following line when doing a release.
+# RELEASE=y
INCDIR = $(srcdir)/../include
CSEARCH = -I. -I$(srcdir) -I$(INCDIR)
MKDEP = gcc -MM
-
SUBDIRS = doc po
-
-docdir = doc
-bfdlibdir = @bfdlibdir@
-bfdincludedir = @bfdincludedir@
-
+bfddocdir = doc
bfdlib_LTLIBRARIES = libbfd.la
-
-WARN_CFLAGS = @WARN_CFLAGS@
AM_CFLAGS = $(WARN_CFLAGS)
# bfd.h goes here, for now
@@ -161,9 +293,7 @@ BFD32_LIBS = \
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 \
@@ -172,18 +302,20 @@ BFD32_LIBS_CFILES = \
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-bfin.lo \
+ cpu-cr16.lo \
+ cpu-cr16c.lo \
cpu-cris.lo \
+ cpu-crx.lo \
cpu-d10v.lo \
cpu-d30v.lo \
cpu-dlx.lo \
@@ -199,6 +331,7 @@ ALL_MACHINES = \
cpu-i960.lo \
cpu-ip2k.lo \
cpu-iq2000.lo \
+ cpu-m32c.lo \
cpu-m32r.lo \
cpu-m68hc11.lo \
cpu-m68hc12.lo \
@@ -206,9 +339,12 @@ ALL_MACHINES = \
cpu-m88k.lo \
cpu-m10200.lo \
cpu-m10300.lo \
+ cpu-maxq.lo \
cpu-mcore.lo \
+ cpu-mep.lo \
cpu-mips.lo \
cpu-mmix.lo \
+ cpu-mt.lo \
cpu-msp430.lo \
cpu-or32.lo \
cpu-ns32k.lo \
@@ -218,8 +354,10 @@ ALL_MACHINES = \
cpu-powerpc.lo \
cpu-rs6000.lo \
cpu-s390.lo \
+ cpu-score.lo \
cpu-sh.lo \
cpu-sparc.lo \
+ cpu-spu.lo \
cpu-tic30.lo \
cpu-tic4x.lo \
cpu-tic54x.lo \
@@ -230,16 +368,20 @@ ALL_MACHINES = \
cpu-w65.lo \
cpu-xstormy16.lo \
cpu-xtensa.lo \
+ cpu-xc16x.lo \
+ cpu-z80.lo \
cpu-z8k.lo
-
ALL_MACHINES_CFILES = \
- cpu-a29k.c \
cpu-alpha.c \
cpu-arc.c \
cpu-arm.c \
cpu-avr.c \
+ cpu-bfin.c \
+ cpu-cr16.c \
cpu-cris.c \
+ cpu-cr16c.c \
+ cpu-crx.c \
cpu-d10v.c \
cpu-d30v.c \
cpu-dlx.c \
@@ -255,6 +397,7 @@ ALL_MACHINES_CFILES = \
cpu-i960.c \
cpu-ip2k.c \
cpu-iq2000.c \
+ cpu-m32c.c \
cpu-m32r.c \
cpu-m68hc11.c \
cpu-m68hc12.c \
@@ -262,9 +405,12 @@ ALL_MACHINES_CFILES = \
cpu-m88k.c \
cpu-m10200.c \
cpu-m10300.c \
+ cpu-maxq.c \
cpu-mcore.c \
+ cpu-mep.c \
cpu-mips.c \
cpu-mmix.c \
+ cpu-mt.c \
cpu-msp430.c \
cpu-or32.c \
cpu-ns32k.c \
@@ -274,8 +420,10 @@ ALL_MACHINES_CFILES = \
cpu-powerpc.c \
cpu-rs6000.c \
cpu-s390.c \
+ cpu-score.c \
cpu-sh.c \
cpu-sparc.c \
+ cpu-spu.c \
cpu-tic30.c \
cpu-tic4x.c \
cpu-tic54x.c \
@@ -286,6 +434,8 @@ ALL_MACHINES_CFILES = \
cpu-w65.c \
cpu-xstormy16.c \
cpu-xtensa.c \
+ cpu-xc16x.c \
+ cpu-z80.c \
cpu-z8k.c
@@ -303,9 +453,7 @@ BFD32_BACKENDS = \
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 \
@@ -317,6 +465,7 @@ BFD32_BACKENDS = \
coff-i960.lo \
coff-m68k.lo \
coff-m88k.lo \
+ coff-maxq.lo \
coff-mips.lo \
coff-or32.lo \
coff-rs6000.lo \
@@ -331,6 +480,7 @@ BFD32_BACKENDS = \
coff-u68k.lo \
coff-we32k.lo \
coff-w65.lo \
+ coff-z80.lo \
coff-z8k.lo \
cofflink.lo \
dwarf1.lo \
@@ -340,10 +490,13 @@ BFD32_BACKENDS = \
elf.lo \
elf32-am33lin.lo \
elf32-arc.lo \
- elfarm-oabi.lo \
- elfarm-nabi.lo \
+ elf32-arm.lo \
elf32-avr.lo \
+ elf32-bfin.lo \
+ elf32-cr16.lo \
+ elf32-cr16c.lo \
elf32-cris.lo \
+ elf32-crx.lo \
elf32-d10v.lo \
elf32-d30v.lo \
elf32-dlx.lo \
@@ -356,9 +509,9 @@ BFD32_BACKENDS = \
elf32-i386.lo \
elf32-i860.lo \
elf32-i960.lo \
- elf32-ia64.lo \
elf32-ip2k.lo \
elf32-iq2000.lo \
+ elf32-m32c.lo \
elf32-m32r.lo \
elf32-m68hc11.lo \
elf32-m68hc12.lo \
@@ -368,26 +521,35 @@ BFD32_BACKENDS = \
elf-m10200.lo \
elf-m10300.lo \
elf32-mcore.lo \
+ elf32-mep.lo \
elfxx-mips.lo \
elf32-mips.lo \
+ elf32-mt.lo \
elf32-msp430.lo \
elf32-openrisc.lo \
elf32-or32.lo \
elf32-pj.lo \
elf32-ppc.lo \
elf32-s390.lo \
+ elf32-score.lo \
elf32-sh.lo \
+ elf32-sh-symbian.lo \
elf32-sh64.lo \
elf32-sh64-com.lo \
+ elfxx-sparc.lo \
elf32-sparc.lo \
+ elf32-spu.lo \
elf32-v850.lo \
elf32-vax.lo \
elf32-xstormy16.lo \
elf32-xtensa.lo \
+ elf32-xc16x.lo \
elf32.lo \
elflink.lo \
+ elf-attrs.lo \
elf-strtab.lo \
elf-eh-frame.lo \
+ elf-vxworks.lo \
epoc-pe-arm.lo \
epoc-pei-arm.lo \
hp300bsd.lo \
@@ -406,9 +568,9 @@ BFD32_BACKENDS = \
ieee.lo \
m68k4knetbsd.lo \
m68klinux.lo \
- m68klynx.lo \
m68knetbsd.lo \
m88kmach3.lo \
+ m88kopenbsd.lo \
mach-o.lo \
mipsbsd.lo \
newsos3.lo \
@@ -424,6 +586,8 @@ BFD32_BACKENDS = \
pef.lo \
pe-arm.lo \
pei-arm.lo \
+ pe-arm-wince.lo \
+ pei-arm-wince.lo \
pe-i386.lo \
pei-i386.lo \
pe-mcore.lo \
@@ -456,7 +620,6 @@ BFD32_BACKENDS = \
xtensa-isa.lo \
xtensa-modules.lo
-
BFD32_BACKENDS_CFILES = \
aout-adobe.c \
aout-arm.c \
@@ -469,9 +632,7 @@ BFD32_BACKENDS_CFILES = \
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 \
@@ -483,6 +644,7 @@ BFD32_BACKENDS_CFILES = \
coff-i960.c \
coff-m68k.c \
coff-m88k.c \
+ coff-maxq.c \
coff-mips.c \
coff-or32.c \
coff-rs6000.c \
@@ -497,6 +659,7 @@ BFD32_BACKENDS_CFILES = \
coff-u68k.c \
coff-we32k.c \
coff-w65.c \
+ coff-z80.c \
coff-z8k.c \
cofflink.c \
dwarf1.c \
@@ -506,10 +669,13 @@ BFD32_BACKENDS_CFILES = \
elf.c \
elf32-am33lin.c \
elf32-arc.c \
- elfarm-oabi.c \
- elfarm-nabi.c \
+ elf32-arm.c \
elf32-avr.c \
+ elf32-bfin.c \
+ elf32-cr16.c \
+ elf32-cr16c.c \
elf32-cris.c \
+ elf32-crx.c \
elf32-d10v.c \
elf32-d30v.c \
elf32-dlx.c \
@@ -524,6 +690,7 @@ BFD32_BACKENDS_CFILES = \
elf32-i960.c \
elf32-ip2k.c \
elf32-iq2000.c \
+ elf32-m32c.c \
elf32-m32r.c \
elf32-m68k.c \
elf32-m68hc11.c \
@@ -533,8 +700,10 @@ BFD32_BACKENDS_CFILES = \
elf-m10200.c \
elf-m10300.c \
elf32-mcore.c \
+ elf32-mep.c \
elfxx-mips.c \
elf32-mips.c \
+ elf32-mt.c \
elf32-msp430.c \
elf32-openrisc.c \
elf32-or32.c \
@@ -543,16 +712,23 @@ BFD32_BACKENDS_CFILES = \
elf32-sh64.c \
elf32-sh64-com.c \
elf32-s390.c \
+ elf32-score.c \
elf32-sh.c \
+ elf32-sh-symbian.c \
+ elfxx-sparc.c \
elf32-sparc.c \
+ elf32-spu.c \
elf32-v850.c \
elf32-vax.c \
elf32-xstormy16.c \
elf32-xtensa.c \
+ elf32-xc16x.c \
elf32.c \
elflink.c \
+ elf-attrs.c \
elf-strtab.c \
elf-eh-frame.c \
+ elf-vxworks.c \
epoc-pe-arm.c \
epoc-pei-arm.c \
hp300bsd.c \
@@ -571,9 +747,9 @@ BFD32_BACKENDS_CFILES = \
ieee.c \
m68k4knetbsd.c \
m68klinux.c \
- m68klynx.c \
m68knetbsd.c \
m88kmach3.c \
+ m88kopenbsd.c \
mach-o.c \
mipsbsd.c \
newsos3.c \
@@ -589,6 +765,8 @@ BFD32_BACKENDS_CFILES = \
pef.c \
pe-arm.c \
pei-arm.c \
+ pe-arm-wince.c \
+ pei-arm-wince.c \
pe-i386.c \
pei-i386.c \
pe-mcore.c \
@@ -624,6 +802,8 @@ BFD32_BACKENDS_CFILES = \
# 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.
+# elf32-ia64.c requires a 64-bit bfd_vma, and hence can not be put in
+# BFD32_BACKENDS.
BFD64_BACKENDS = \
aix5ppc-core.lo \
aout64.lo \
@@ -631,9 +811,11 @@ BFD64_BACKENDS = \
coff64-rs6000.lo \
demo64.lo \
efi-app-ia64.lo \
+ efi-app-x86_64.lo \
elf64-x86-64.lo \
elf64-alpha.lo \
elf64-hppa.lo \
+ elf32-ia64.lo \
elf64-ia64.lo \
elf64-gen.lo \
elfn32-mips.lo \
@@ -647,8 +829,11 @@ BFD64_BACKENDS = \
mmo.lo \
nlm32-alpha.lo \
nlm64.lo \
- pepigen.lo
-
+ coff-x86_64.lo \
+ pe-x86_64.lo \
+ pei-x86_64.lo \
+ pepigen.lo \
+ pex64igen.lo
BFD64_BACKENDS_CFILES = \
aix5ppc-core.c \
@@ -657,6 +842,7 @@ BFD64_BACKENDS_CFILES = \
coff64-rs6000.c \
demo64.c \
efi-app-ia64.c \
+ efi-app-x86_64.c \
elf64-x86-64.c \
elf64-alpha.c \
elf64-hppa.c \
@@ -671,8 +857,10 @@ BFD64_BACKENDS_CFILES = \
elf64.c \
mmo.c \
nlm32-alpha.c \
- nlm64.c
-
+ nlm64.c \
+ coff-x86_64.c \
+ pe-x86_64.c \
+ pei-x86_64.c
OPTIONAL_BACKENDS = \
aix386-core.lo \
@@ -684,7 +872,6 @@ OPTIONAL_BACKENDS = \
trad-core.lo \
cisco-core.lo
-
OPTIONAL_BACKENDS_CFILES = \
aix386-core.c \
hpux-core.c \
@@ -696,15 +883,22 @@ OPTIONAL_BACKENDS_CFILES = \
cisco-core.c
+# We want to rerun configure if configure.in, config.bfd or
+# configure.host change. configure.in is needed since the version
+# number in Makefile comes from configure.in.
+CONFIG_STATUS_DEPENDENCIES = \
+ $(srcdir)/configure.in \
+ $(srcdir)/config.bfd \
+ $(srcdir)/configure.host
+
+
# 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
+INCLUDES = @HDEFINES@ @COREFLAG@ @TDEFINES@ $(CSEARCH) $(CSWITCHES) @INCINTL@
# C source files that correspond to .o's.
SOURCE_CFILES = \
@@ -715,16 +909,13 @@ SOURCE_CFILES = \
$(BFD64_BACKENDS_CFILES) \
$(OPTIONAL_BACKENDS_CFILES)
-
BUILD_CFILES = \
- elf32-ia64.c elf64-ia64.c peigen.c pepigen.c
-
+ elf32-ia64.c elf64-ia64.c peigen.c pepigen.c pex64igen.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 \
+ elf-bfd.h elf-hppa.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 \
@@ -733,13 +924,10 @@ SOURCE_HFILES = \
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)
@@ -747,24 +935,24 @@ BLD_POTFILES = $(BUILD_CFILES) $(BUILD_HFILES)
# 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@
+# bfd64_libs Routines for 64bit support
+OFILES = $(BFD_BACKENDS) $(BFD_MACHINES) @COREFILE@ @bfd64_libs@
-libbfd_la_SOURCES = $(BFD32_LIBS_CFILES) $(BFD64_LIBS_CFILES)
+# Since BFD64_LIBS is optional and we can't have substitution in
+# libbfd_la_SOURCES, we put BFD64_LIBS in OFILES instead.
+libbfd_la_SOURCES = $(BFD32_LIBS_CFILES)
libbfd_la_DEPENDENCIES = $(OFILES) ofiles
libbfd_la_LIBADD = `cat ofiles` @WIN32LIBADD@
-libbfd_la_LDFLAGS = -release $(VERSION) @WIN32LDFLAGS@
+libbfd_la_LDFLAGS = -release `cat libtool-soversion` @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
@@ -774,140 +962,99 @@ 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) libtool-soversion
+all: config.h
+ $(MAKE) $(AM_MAKEFLAGS) all-recursive
-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
+.SUFFIXES: .c .lo .o .obj
+am--refresh:
+ @:
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ echo ' cd $(srcdir) && $(AUTOMAKE) --cygnus '; \
+ cd $(srcdir) && $(AUTOMAKE) --cygnus \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --cygnus Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --cygnus Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ echo ' $(SHELL) ./config.status'; \
+ $(SHELL) ./config.status;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ $(SHELL) ./config.status --recheck
-$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ configure.in acinclude.m4
- cd $(srcdir) && $(ACLOCAL)
-$(srcdir)/configure: @MAINTAINER_MODE_TRUE@$(srcdir)/configure.in $(ACLOCAL_M4) $(CONFIGURE_DEPENDENCIES)
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
cd $(srcdir) && $(AUTOCONF)
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
-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
+config.h: stamp-h1
@if test ! -f $@; then \
- rm -f $(srcdir)/stamp-h.in; \
- $(MAKE) $(srcdir)/stamp-h.in; \
+ rm -f stamp-h1; \
+ $(MAKE) stamp-h1; \
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:
+stamp-h1: $(srcdir)/config.in $(top_builddir)/config.status
+ @rm -f stamp-h1
+ cd $(top_builddir) && $(SHELL) ./config.status config.h
+$(srcdir)/config.in: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_srcdir) && $(AUTOHEADER)
+ rm -f stamp-h1
+ touch $@
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:
+ -rm -f config.h stamp-h1
+bfd-in3.h: $(top_builddir)/config.status $(srcdir)/bfd-in2.h
+ cd $(top_builddir) && $(SHELL) ./config.status $@
+po/Makefile.in: $(top_builddir)/config.status $(top_srcdir)/po/Make-in
+ cd $(top_builddir) && $(SHELL) ./config.status $@
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 $<
+clean-bfdlibLTLIBRARIES:
+ -test -z "$(bfdlib_LTLIBRARIES)" || rm -f $(bfdlib_LTLIBRARIES)
+ @list='$(bfdlib_LTLIBRARIES)'; for p in $$list; do \
+ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
+ test "$$dir" != "$$p" || dir=.; \
+ echo "rm -f \"$${dir}/so_locations\""; \
+ rm -f "$${dir}/so_locations"; \
+ done
+libbfd.la: $(libbfd_la_OBJECTS) $(libbfd_la_DEPENDENCIES)
+ $(LINK) -rpath $(bfdlibdir) $(libbfd_la_LDFLAGS) $(libbfd_la_OBJECTS) $(libbfd_la_LIBADD) $(LIBS)
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 $<
+.c.o:
+ $(COMPILE) -c $<
-.s.lo:
- $(LIBTOOL) --mode=compile $(COMPILE) -c $<
+.c.obj:
+ $(COMPILE) -c `$(CYGPATH_W) '$<'`
-.S.lo:
- $(LIBTOOL) --mode=compile $(COMPILE) -c $<
+.c.lo:
+ $(LTCOMPILE) -c -o $@ $<
mostlyclean-libtool:
-rm -f *.lo
@@ -916,20 +1063,8 @@ 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)
+ -rm -f libtool
+uninstall-info-am:
# This directory's subdirectories are mostly independent; you can cd
# into them and run `make' without going through this Makefile.
@@ -937,13 +1072,14 @@ libbfd.la: $(libbfd_la_OBJECTS) $(libbfd_la_DEPENDENCIES)
# (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; \
+$(RECURSIVE_TARGETS):
+ @failcom='exit 1'; \
+ for f in x $$MAKEFLAGS; do \
+ case $$f in \
+ *=* | --[!k]*);; \
+ *k*) failcom='fail=yes';; \
+ esac; \
+ done; \
dot_seen=no; \
target=`echo $@ | sed s/-recursive//`; \
list='$(SUBDIRS)'; for subdir in $$list; do \
@@ -955,7 +1091,7 @@ check-recursive installcheck-recursive info-recursive dvi-recursive:
local_target="$$target"; \
fi; \
(cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
- || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
+ || eval $$failcom; \
done; \
if test "$$dot_seen" = "no"; then \
$(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
@@ -963,13 +1099,24 @@ check-recursive installcheck-recursive info-recursive dvi-recursive:
mostlyclean-recursive clean-recursive distclean-recursive \
maintainer-clean-recursive:
- @set fnord $(MAKEFLAGS); amf=$$2; \
+ @failcom='exit 1'; \
+ for f in x $$MAKEFLAGS; do \
+ case $$f in \
+ *=* | --[!k]*);; \
+ *k*) failcom='fail=yes';; \
+ esac; \
+ done; \
dot_seen=no; \
- rev=''; list='$(SUBDIRS)'; for subdir in $$list; do \
- rev="$$subdir $$rev"; \
- test "$$subdir" != "." || dot_seen=yes; \
+ case "$@" in \
+ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
+ *) list='$(SUBDIRS)' ;; \
+ esac; \
+ rev=''; for subdir in $$list; do \
+ if test "$$subdir" = "."; then :; else \
+ rev="$$subdir $$rev"; \
+ fi; \
done; \
- test "$$dot_seen" = "no" && rev=". $$rev"; \
+ rev="$$rev ."; \
target=`echo $@ | sed s/-recursive//`; \
for subdir in $$rev; do \
echo "Making $$target in $$subdir"; \
@@ -979,138 +1126,99 @@ maintainer-clean-recursive:
local_target="$$target"; \
fi; \
(cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
- || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
+ || eval $$failcom; \
done && test -z "$$fail"
tags-recursive:
list='$(SUBDIRS)'; for subdir in $$list; do \
test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
done
+ctags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
+ done
-tags: TAGS
-
-ID: $(HEADERS) $(SOURCES) $(LISP)
- list='$(SOURCES) $(HEADERS)'; \
- unique=`for i in $$list; do echo $$i; done | \
- awk ' { files[$$0] = 1; } \
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
- here=`pwd` && cd $(srcdir) \
- && mkid -f$$here/ID $$unique $(LISP)
+ mkid -fID $$unique
+tags: TAGS
-TAGS: tags-recursive $(HEADERS) $(SOURCES) config.in $(TAGS_DEPENDENCIES) $(LISP)
+TAGS: tags-recursive $(HEADERS) $(SOURCES) config.in $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
+ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
+ include_option=--etags-include; \
+ empty_fix=.; \
+ else \
+ include_option=--include; \
+ empty_fix=; \
+ fi; \
list='$(SUBDIRS)'; for subdir in $$list; do \
- if test "$$subdir" = .; then :; else \
- test -f $$subdir/TAGS && tags="$$tags -i $$here/$$subdir/TAGS"; \
- fi; \
+ if test "$$subdir" = .; then :; else \
+ test ! -f $$subdir/TAGS || \
+ tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
+ fi; \
done; \
- list='$(SOURCES) $(HEADERS)'; \
- unique=`for i in $$list; do echo $$i; done | \
- awk ' { files[$$0] = 1; } \
+ list='$(SOURCES) $(HEADERS) config.in $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ 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:
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: ctags-recursive $(HEADERS) $(SOURCES) config.in $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) config.in $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
-clean-tags:
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
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
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
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:
+all-am: Makefile $(LIBRARIES) $(LTLIBRARIES) config.h
+installdirs: installdirs-recursive
+installdirs-am:
+ for dir in "$(DESTDIR)$(bfdlibdir)"; do \
+ test -z "$$dir" || $(mkdir_p) "$$dir"; \
+ done
+install: install-recursive
install-exec: install-exec-recursive
-
-install-data-am: install-bfdlibLTLIBRARIES
install-data: install-data-recursive
+uninstall: uninstall-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)
-
+installcheck: installcheck-recursive
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
mostlyclean-generic:
-test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES)
@@ -1118,65 +1226,81 @@ 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 "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
-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
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-recursive
-mostlyclean: mostlyclean-recursive
+clean-am: clean-bfdlibLTLIBRARIES clean-generic clean-libtool \
+ clean-noinstLIBRARIES mostlyclean-am
-clean-am: clean-hdr clean-noinstLIBRARIES clean-compile clean-libtool \
- clean-bfdlibLTLIBRARIES clean-tags clean-generic \
- mostlyclean-am
+distclean: distclean-recursive
+ -rm -f $(am__CONFIG_DISTCLEAN_FILES)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-hdr distclean-libtool distclean-tags
-clean: clean-recursive
+dvi: dvi-recursive
-distclean-am: distclean-hdr distclean-noinstLIBRARIES distclean-compile \
- distclean-libtool distclean-bfdlibLTLIBRARIES \
- distclean-tags distclean-generic clean-am
- -rm -f libtool
+dvi-am:
-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."
+html: html-recursive
+
+info: info-recursive
+
+info-am:
+
+install-data-am: install-bfdlibLTLIBRARIES
+
+install-exec-am:
+
+install-info: install-info-recursive
+
+install-man:
+
+installcheck-am:
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
+ -rm -f $(am__CONFIG_DISTCLEAN_FILES)
+ -rm -rf $(top_srcdir)/autom4te.cache
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-recursive
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-recursive
+
+pdf-am:
+
+ps: ps-recursive
+
+ps-am:
+
+uninstall-am: uninstall-bfdlibLTLIBRARIES
+
+uninstall-info: uninstall-info-recursive
+
+.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am am--refresh check \
+ check-am clean clean-bfdlibLTLIBRARIES clean-generic \
+ clean-libtool clean-noinstLIBRARIES clean-recursive ctags \
+ ctags-recursive distclean distclean-compile distclean-generic \
+ distclean-hdr distclean-libtool distclean-recursive \
+ distclean-tags dvi dvi-am html html-am info info-am install \
+ install-am install-bfdlibLTLIBRARIES install-data \
+ install-data-am install-exec install-exec-am install-info \
+ install-info-am install-man install-strip installcheck \
+ installcheck-am installdirs installdirs-am maintainer-clean \
+ maintainer-clean-generic maintainer-clean-recursive \
+ mostlyclean mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool mostlyclean-recursive pdf pdf-am ps ps-am \
+ tags tags-recursive uninstall uninstall-am \
+ uninstall-bfdlibLTLIBRARIES uninstall-info-am
po/SRC-POTFILES.in: @MAINT@ Makefile $(SRC_POTFILES)
@@ -1189,7 +1313,36 @@ po/BLD-POTFILES.in: @MAINT@ Makefile $(BLD_POTFILES)
| LC_COLLATE= sort > tmp.bld \
&& mv tmp.bld $(srcdir)/po/BLD-POTFILES.in
-diststuff: info
+all diststuff: info
+
+.PHONY: install-html install-html-am install-html-recursive
+
+install-html: install-html-recursive
+
+install-html-recursive:
+ @failcom='exit 1'; \
+ for f in x $$MAKEFLAGS; do \
+ case $$f in \
+ *=* | --[!k]*);; \
+ *k*) failcom='fail=yes';; \
+ esac; \
+ done; \
+ 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) \
+ || eval $$failcom; \
+ done; \
+ if test "$$dot_seen" = "no"; then \
+ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
+ fi; test -z "$$fail"
stamp-ofiles: Makefile
rm -f tofiles
@@ -1234,6 +1387,9 @@ targets.lo: targets.c Makefile
archures.lo: archures.c Makefile
$(LIBTOOL) --mode=compile $(COMPILE) -c $(TDEFAULTS) $(srcdir)/archures.c
+dwarf2.lo: dwarf2.c Makefile
+ $(LIBTOOL) --mode=compile $(COMPILE) -c -DDEBUGDIR=\"$(DEBUGDIR)\" $(srcdir)/dwarf2.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
@@ -1263,6 +1419,11 @@ pepigen.c : peXXigen.c
rm -f pepigen.c
sed -e s/XX/pep/g < $(srcdir)/peXXigen.c > pepigen.new
mv -f pepigen.new pepigen.c
+
+pex64igen.c: peXXigen.c
+ rm -f pex64igen.c
+ sed -e s/XX/pex64/g < $(srcdir)/peXXigen.c > pex64igen.new
+ mv -f pex64igen.new pex64igen.c
$(BFD32_LIBS) \
$(BFD64_LIBS) \
$(ALL_MACHINES) \
@@ -1300,8 +1461,6 @@ uninstall_libbfd:
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
@@ -1361,12 +1520,12 @@ stmp-bfd-h: bfd-in3.h
# Could really use a "copy-if-change"...
headers:
- (cd $(docdir); $(MAKE) protos $(FLAGS_TO_PASS))
- cp $(docdir)/bfd.h bfd-in2.h-new
+ (cd $(bfddocdir); $(MAKE) protos $(FLAGS_TO_PASS))
+ cp $(bfddocdir)/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
+ cp $(bfddocdir)/libbfd.h libbfd.h-new
$(SHELL) $(srcdir)/../move-if-change libbfd.h-new $(srcdir)/libbfd.h
- cp $(docdir)/libcoff.h libcoff.h-new
+ cp $(bfddocdir)/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
@@ -1374,800 +1533,1001 @@ headers:
$(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
+ (cd $(bfddocdir); $(MAKE) $(FLAGS_TO_PASS) bfd.h)
+ cp $(bfddocdir)/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
+ (cd $(bfddocdir); $(MAKE) $(FLAGS_TO_PASS) libbfd.h)
+ cp $(bfddocdir)/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
+ (cd $(bfddocdir); $(MAKE) $(FLAGS_TO_PASS) libcoff.h)
+ cp $(bfddocdir)/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
+bfdver.h: $(srcdir)/version.h $(srcdir)/Makefile.in
+ @echo "creating $@"
+ @bfd_version=`echo "$(VERSION)" | sed -e 's/\([^\.]*\)\.*\([^\.]*\)\.*\([^\.]*\)\.*\([^\.]*\)\.*\([^\.]*\).*/\1.00\2.00\3.00\4.00\5/' -e 's/\([^\.]*\)\..*\(..\)\..*\(..\)\..*\(..\)\..*\(..\)$$/\1\2\3\4\5/'` ;\
+ bfd_version_string="\"$(VERSION)\"" ;\
+ bfd_soversion="$(VERSION)" ;\
+ bfd_version_package="\"$(PKGVERSION)\"" ;\
+ report_bugs_to="\"$(REPORT_BUGS_TO)\"" ;\
+ if test "x$(RELEASE)" = x ; then \
+ bfd_version_date=`sed -n -e 's/.*DATE //p' < $(srcdir)/version.h` ;\
+ bfd_version_string="\"$(VERSION).$${bfd_version_date}\"" ;\
+ bfd_soversion="$(VERSION).$${bfd_version_date}" ;\
+ fi ;\
+ sed -e "s,@bfd_version@,$$bfd_version," \
+ -e "s,@bfd_version_string@,$$bfd_version_string," \
+ -e "s,@bfd_version_package@,$$bfd_version_package," \
+ -e "s,@report_bugs_to@,$$report_bugs_to," \
+ < $(srcdir)/version.h > $@; \
+ echo "$${bfd_soversion}" > libtool-soversion
# 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 \
+archive.lo: archive.c $(INCDIR)/filenames.h $(INCDIR)/libiberty.h \
+ $(INCDIR)/hashtab.h $(INCDIR)/aout/ar.h $(INCDIR)/aout/ranlib.h \
+ $(INCDIR)/safe-ctype.h
+archures.lo: archures.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \
+ $(INCDIR)/safe-ctype.h
+bfd.lo: bfd.c $(INCDIR)/filenames.h bfdver.h $(INCDIR)/libiberty.h \
+ $(INCDIR)/demangle.h $(INCDIR)/libiberty.h $(INCDIR)/safe-ctype.h \
+ $(INCDIR)/bfdlink.h $(INCDIR)/hashtab.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
+bfdio.lo: bfdio.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h
+bfdwin.lo: bfdwin.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h
+cache.lo: cache.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \
+ $(INCDIR)/libiberty.h
+coffgen.lo: coffgen.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \
+ $(INCDIR)/coff/internal.h libcoff.h $(INCDIR)/bfdlink.h
+corefile.lo: corefile.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h
+format.lo: format.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h
+init.lo: init.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h
+libbfd.lo: libbfd.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h
opncls.lo: opncls.c $(INCDIR)/filenames.h $(INCDIR)/objalloc.h \
+ $(INCDIR)/hashtab.h $(INCDIR)/libiberty.h
+reloc.lo: reloc.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
+ $(INCDIR)/hashtab.h
+section.lo: section.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \
+ $(INCDIR)/bfdlink.h
+syms.lo: syms.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.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)/hashtab.h \
+ $(INCDIR)/fnmatch.h targmatch.h
+hash.lo: hash.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \
+ $(INCDIR)/objalloc.h $(INCDIR)/libiberty.h
+linker.lo: linker.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \
+ $(INCDIR)/bfdlink.h genlink.h
+srec.lo: srec.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \
+ $(INCDIR)/libiberty.h $(INCDIR)/safe-ctype.h
+binary.lo: binary.c $(INCDIR)/filenames.h $(INCDIR)/safe-ctype.h \
+ $(INCDIR)/hashtab.h
+tekhex.lo: tekhex.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.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
+ihex.lo: ihex.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \
+ $(INCDIR)/libiberty.h $(INCDIR)/safe-ctype.h
+stabs.lo: stabs.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.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)/hashtab.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)/hashtab.h \
$(INCDIR)/bfdlink.h
+archive64.lo: archive64.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \
+ $(INCDIR)/aout/ar.h
+cpu-alpha.lo: cpu-alpha.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h
+cpu-arc.lo: cpu-arc.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h
+cpu-arm.lo: cpu-arm.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \
+ $(INCDIR)/libiberty.h
+cpu-avr.lo: cpu-avr.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h
+cpu-bfin.lo: cpu-bfin.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h
+cpu-cr16.lo: cpu-cr16.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h
+cpu-cris.lo: cpu-cris.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h
+cpu-cr16c.lo: cpu-cr16c.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h
+cpu-crx.lo: cpu-crx.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h
+cpu-d10v.lo: cpu-d10v.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h
+cpu-d30v.lo: cpu-d30v.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h
+cpu-dlx.lo: cpu-dlx.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h
+cpu-fr30.lo: cpu-fr30.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h
+cpu-frv.lo: cpu-frv.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h
+cpu-h8300.lo: cpu-h8300.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h
+cpu-h8500.lo: cpu-h8500.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h
+cpu-hppa.lo: cpu-hppa.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h
+cpu-ia64.lo: cpu-ia64.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \
+ cpu-ia64-opc.c $(srcdir)/../opcodes/ia64-opc.h $(INCDIR)/opcode/ia64.h
+cpu-i370.lo: cpu-i370.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h
+cpu-i386.lo: cpu-i386.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h
+cpu-i860.lo: cpu-i860.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h
+cpu-i960.lo: cpu-i960.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h
+cpu-ip2k.lo: cpu-ip2k.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h
+cpu-iq2000.lo: cpu-iq2000.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h
+cpu-m32c.lo: cpu-m32c.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h
+cpu-m32r.lo: cpu-m32r.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h
+cpu-m68hc11.lo: cpu-m68hc11.c $(INCDIR)/filenames.h \
+ $(INCDIR)/hashtab.h
+cpu-m68hc12.lo: cpu-m68hc12.c $(INCDIR)/filenames.h \
+ $(INCDIR)/hashtab.h
+cpu-m68k.lo: cpu-m68k.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \
+ $(INCDIR)/opcode/m68k.h
+cpu-m88k.lo: cpu-m88k.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h
+cpu-m10200.lo: cpu-m10200.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h
+cpu-m10300.lo: cpu-m10300.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h
+cpu-maxq.lo: cpu-maxq.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h
+cpu-mcore.lo: cpu-mcore.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h
+cpu-mep.lo: cpu-mep.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h
+cpu-mips.lo: cpu-mips.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h
+cpu-mmix.lo: cpu-mmix.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h
+cpu-mt.lo: cpu-mt.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h
+cpu-msp430.lo: cpu-msp430.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h
+cpu-or32.lo: cpu-or32.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h
+cpu-ns32k.lo: cpu-ns32k.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \
+ ns32k.h
+cpu-openrisc.lo: cpu-openrisc.c $(INCDIR)/filenames.h \
+ $(INCDIR)/hashtab.h
+cpu-pdp11.lo: cpu-pdp11.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h
+cpu-pj.lo: cpu-pj.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h
+cpu-powerpc.lo: cpu-powerpc.c $(INCDIR)/filenames.h \
+ $(INCDIR)/hashtab.h
+cpu-rs6000.lo: cpu-rs6000.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h
+cpu-s390.lo: cpu-s390.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h
+cpu-score.lo: cpu-score.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h
+cpu-sh.lo: cpu-sh.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \
+ $(srcdir)/../opcodes/sh-opc.h
+cpu-sparc.lo: cpu-sparc.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h
+cpu-spu.lo: cpu-spu.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h
+cpu-tic30.lo: cpu-tic30.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h
+cpu-tic4x.lo: cpu-tic4x.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h
+cpu-tic54x.lo: cpu-tic54x.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h
+cpu-tic80.lo: cpu-tic80.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h
+cpu-v850.lo: cpu-v850.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \
+ $(INCDIR)/safe-ctype.h
+cpu-vax.lo: cpu-vax.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h
+cpu-we32k.lo: cpu-we32k.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h
+cpu-w65.lo: cpu-w65.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h
+cpu-xstormy16.lo: cpu-xstormy16.c $(INCDIR)/filenames.h \
+ $(INCDIR)/hashtab.h
+cpu-xtensa.lo: cpu-xtensa.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h
+cpu-xc16x.lo: cpu-xc16x.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h
+cpu-z80.lo: cpu-z80.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h
+cpu-z8k.lo: cpu-z8k.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h
+aout-adobe.lo: aout-adobe.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.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
+ $(INCDIR)/safe-ctype.h $(INCDIR)/hashtab.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
+ $(INCDIR)/hashtab.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
+ $(INCDIR)/safe-ctype.h $(INCDIR)/hashtab.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
+ libaout.h aoutf1.h $(INCDIR)/filenames.h $(INCDIR)/hashtab.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
+ $(INCDIR)/safe-ctype.h $(INCDIR)/hashtab.h
+aout0.lo: aout0.c aoutf1.h $(INCDIR)/filenames.h $(INCDIR)/hashtab.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)/bfdlink.h libaout.h $(INCDIR)/hashtab.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
+ $(INCDIR)/hashtab.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)/hashtab.h \
+ $(INCDIR)/bfdlink.h genlink.h $(INCDIR)/bout.h $(INCDIR)/libiberty.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 \
+ coff-i386.c $(INCDIR)/hashtab.h $(INCDIR)/coff/i386.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)/hashtab.h $(INCDIR)/coff/sparc.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 \
+ $(INCDIR)/hashtab.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)/hashtab.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 \
+ coff-m68k.c $(INCDIR)/hashtab.h $(INCDIR)/coff/m68k.h \
+ $(INCDIR)/coff/internal.h libcoff.h $(INCDIR)/bfdlink.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 \
+coff-h8300.lo: coff-h8300.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.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)/hashtab.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)/hashtab.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 \
+coff-i860.lo: coff-i860.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.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)/hashtab.h $(INCDIR)/coff/i386.h $(INCDIR)/coff/external.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 \
+coff-i960.lo: coff-i960.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.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)/hashtab.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 \
+coff-m88k.lo: coff-m88k.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.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 \
+coff-maxq.lo: coff-maxq.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \
+ $(INCDIR)/coff/maxq.h $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \
+ libcoff.h $(INCDIR)/bfdlink.h $(INCDIR)/libiberty.h \
coffcode.h coffswap.h
+coff-mips.lo: coff-mips.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
+ $(INCDIR)/hashtab.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)/hashtab.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
+ $(INCDIR)/bfdlink.h $(INCDIR)/hashtab.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)/hashtab.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)/hashtab.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
+ $(INCDIR)/hashtab.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
+ $(INCDIR)/hashtab.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)/hashtab.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)/hashtab.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)/hashtab.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)/filenames.h $(INCDIR)/bfdlink.h \
+ $(INCDIR)/hashtab.h $(INCDIR)/coff/tic80.h $(INCDIR)/coff/external.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 \
+ $(INCDIR)/hashtab.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)/hashtab.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
+coff-w65.lo: coff-w65.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \
+ $(INCDIR)/bfdlink.h $(INCDIR)/coff/w65.h $(INCDIR)/coff/external.h \
+ $(INCDIR)/coff/internal.h libcoff.h coffcode.h coffswap.h
+coff-z80.lo: coff-z80.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \
+ $(INCDIR)/bfdlink.h $(INCDIR)/coff/z80.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)/hashtab.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
+ $(INCDIR)/hashtab.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
+ $(INCDIR)/hashtab.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
+ $(INCDIR)/hashtab.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 $(INCDIR)/libiberty.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
+ $(INCDIR)/hashtab.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
+ coff-i386.c $(INCDIR)/hashtab.h $(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 \
+ $(INCDIR)/hashtab.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 $(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 \
+ $(INCDIR)/elf/reloc-macros.h elf-m10300.c $(INCDIR)/hashtab.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-arc.lo: elf32-arc.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.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
-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-arm.lo: elf32-arm.c $(INCDIR)/filenames.h $(INCDIR)/libiberty.h \
+ $(INCDIR)/hashtab.h elf-bfd.h $(INCDIR)/elf/common.h \
+ $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h \
+ elf-vxworks.h $(INCDIR)/elf/arm.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-avr.lo: elf32-avr.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.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-avr.h elf32-target.h
+elf32-bfin.lo: elf32-bfin.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \
+ elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
+ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/bfin.h \
+ $(INCDIR)/elf/reloc-macros.h $(INCDIR)/elf/dwarf2.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 \
+elf32-cr16.lo: elf32-cr16.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
+ $(INCDIR)/hashtab.h $(INCDIR)/libiberty.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 \
+ $(INCDIR)/elf/cr16.h $(INCDIR)/elf/reloc-macros.h elf32-target.h
+elf32-cr16c.lo: elf32-cr16c.c $(INCDIR)/filenames.h \
+ $(INCDIR)/hashtab.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/cr16c.h \
+ $(INCDIR)/elf/reloc-macros.h elf-bfd.h $(INCDIR)/elf/common.h \
+ $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h elf32-target.h
+elf32-cris.lo: elf32-cris.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.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/external.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/cris.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 \
+elf32-crx.lo: elf32-crx.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
+ $(INCDIR)/hashtab.h elf-bfd.h $(INCDIR)/elf/common.h \
+ $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/elf/crx.h \
+ $(INCDIR)/elf/reloc-macros.h elf32-target.h
+elf32-d10v.lo: elf32-d10v.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.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 $(INCDIR)/hashtab.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 $(INCDIR)/hashtab.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 $(INCDIR)/hashtab.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 $(INCDIR)/hashtab.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 \
+ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/frv.h \
+ $(INCDIR)/elf/reloc-macros.h $(INCDIR)/elf/dwarf2.h \
elf32-target.h
+elf32-gen.lo: elf32-gen.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.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 \
+ $(INCDIR)/hashtab.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 $(INCDIR)/hashtab.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 \
+ $(INCDIR)/hashtab.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 \
+ $(INCDIR)/hashtab.h elf-bfd.h $(INCDIR)/elf/common.h \
+ $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h elf-vxworks.h \
+ $(INCDIR)/elf/i386.h $(INCDIR)/elf/reloc-macros.h elf32-target.h
+elf32-i860.lo: elf32-i860.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.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 \
+ $(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 $(INCDIR)/hashtab.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 $(INCDIR)/hashtab.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 \
+ $(INCDIR)/hashtab.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-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-m32c.lo: elf32-m32c.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \
+ elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
+ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/m32c.h \
+ $(INCDIR)/elf/reloc-macros.h $(INCDIR)/libiberty.h \
elf32-target.h
-elf32-iq2000.lo: elf32-iq2000.c $(INCDIR)/filenames.h \
+elf32-m32r.lo: elf32-m32r.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.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/external.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/m32r.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 \
+ $(INCDIR)/hashtab.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 $(INCDIR)/opcode/m68k.h \
elf32-target.h
elf32-m68hc11.lo: elf32-m68hc11.c $(INCDIR)/filenames.h \
- $(INCDIR)/bfdlink.h elf-bfd.h $(INCDIR)/elf/common.h \
+ $(INCDIR)/bfdlink.h $(INCDIR)/hashtab.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)/bfdlink.h $(INCDIR)/hashtab.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)/bfdlink.h $(INCDIR)/hashtab.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-m88k.lo: elf32-m88k.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.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 $(INCDIR)/hashtab.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 $(INCDIR)/hashtab.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)/bfdlink.h $(INCDIR)/hashtab.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 \
+elf32-mep.lo: elf32-mep.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.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)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/mep.h \
+ $(INCDIR)/elf/reloc-macros.h $(INCDIR)/libiberty.h \
+ elf32-target.h
+elfxx-mips.lo: elfxx-mips.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.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 \
+ elfxx-mips.h $(INCDIR)/elf/mips.h $(INCDIR)/elf/reloc-macros.h \
+ elf-vxworks.h $(INCDIR)/coff/sym.h $(INCDIR)/coff/symconst.h \
+ $(INCDIR)/coff/ecoff.h $(INCDIR)/coff/mips.h $(INCDIR)/coff/external.h
+elf32-mips.lo: elf32-mips.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.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 elf-vxworks.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-mt.lo: elf32-mt.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \
+ elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
+ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/mt.h \
+ $(INCDIR)/elf/reloc-macros.h elf32-target.h
+elf32-msp430.lo: elf32-msp430.c $(INCDIR)/filenames.h \
+ $(INCDIR)/libiberty.h $(INCDIR)/hashtab.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 \
+ $(INCDIR)/hashtab.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 $(INCDIR)/hashtab.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/external.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/or32.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
+ $(INCDIR)/hashtab.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
+ $(INCDIR)/hashtab.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 elf-vxworks.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.h elf32-sh.c $(INCDIR)/hashtab.h elf-vxworks.h \
+ $(INCDIR)/elf/sh.h $(INCDIR)/elf/reloc-macros.h $(INCDIR)/libiberty.h \
+ $(srcdir)/../opcodes/sh-opc.h elf32-sh-relocs.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
+ $(INCDIR)/hashtab.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 \
+ $(INCDIR)/hashtab.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-score.lo: elf32-score.c $(INCDIR)/filenames.h \
+ $(INCDIR)/hashtab.h $(INCDIR)/libiberty.h elf-bfd.h \
+ $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
+ $(INCDIR)/bfdlink.h $(INCDIR)/elf/score.h $(INCDIR)/elf/reloc-macros.h \
elf32-target.h
elf32-sh.lo: elf32-sh.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
+ $(INCDIR)/hashtab.h elf-bfd.h $(INCDIR)/elf/common.h \
+ $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h elf-vxworks.h \
+ $(INCDIR)/elf/sh.h $(INCDIR)/elf/reloc-macros.h $(INCDIR)/libiberty.h \
+ $(srcdir)/../opcodes/sh-opc.h elf32-sh-relocs.h elf32-target.h
+elf32-sh-symbian.lo: elf32-sh-symbian.c elf32-sh.c \
+ $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h $(INCDIR)/hashtab.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
+ $(INCDIR)/elf/external.h elf-vxworks.h $(INCDIR)/elf/sh.h \
+ $(INCDIR)/elf/reloc-macros.h $(INCDIR)/libiberty.h \
+ $(srcdir)/../opcodes/sh-opc.h elf32-sh-relocs.h elf32-target.h
+elfxx-sparc.lo: elfxx-sparc.c $(INCDIR)/filenames.h \
+ $(INCDIR)/bfdlink.h $(INCDIR)/hashtab.h $(INCDIR)/libiberty.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 elfxx-sparc.h elf-vxworks.h
elf32-sparc.lo: elf32-sparc.c $(INCDIR)/filenames.h \
- $(INCDIR)/bfdlink.h elf-bfd.h $(INCDIR)/elf/common.h \
+ $(INCDIR)/bfdlink.h $(INCDIR)/hashtab.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
+ elfxx-sparc.h elf-vxworks.h elf32-target.h
+elf32-spu.lo: elf32-spu.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
+ $(INCDIR)/hashtab.h elf-bfd.h $(INCDIR)/elf/common.h \
+ $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/elf/spu.h \
+ $(INCDIR)/elf/reloc-macros.h elf32-spu.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)/hashtab.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 \
+ $(INCDIR)/hashtab.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 \
+ $(INCDIR)/hashtab.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)/bfdlink.h $(INCDIR)/hashtab.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-xc16x.lo: elf32-xc16x.c $(INCDIR)/filenames.h \
+ $(INCDIR)/hashtab.h elf-bfd.h $(INCDIR)/elf/common.h \
+ $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h \
+ $(INCDIR)/elf/xc16x.h $(INCDIR)/elf/reloc-macros.h \
+ $(INCDIR)/elf/dwarf2.h $(INCDIR)/libiberty.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
+ $(INCDIR)/bfdlink.h $(INCDIR)/hashtab.h elf-bfd.h $(INCDIR)/elf/common.h \
+ $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h elfcore.h
elflink.lo: elflink.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
+ $(INCDIR)/hashtab.h elf-bfd.h $(INCDIR)/elf/common.h \
+ $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/safe-ctype.h \
+ $(INCDIR)/libiberty.h $(INCDIR)/objalloc.h
+elf-attrs.lo: elf-attrs.c $(INCDIR)/filenames.h $(INCDIR)/libiberty.h \
+ $(INCDIR)/hashtab.h elf-bfd.h $(INCDIR)/elf/common.h \
+ $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h
+elf-strtab.lo: elf-strtab.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.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
+ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.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
+ $(INCDIR)/hashtab.h elf-bfd.h $(INCDIR)/elf/common.h \
+ $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h \
+ $(INCDIR)/elf/dwarf2.h
+elf-vxworks.lo: elf-vxworks.c $(INCDIR)/filenames.h \
+ $(INCDIR)/hashtab.h elf-bfd.h $(INCDIR)/elf/common.h \
+ $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h \
+ elf-vxworks.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
+ coff-arm.c $(INCDIR)/hashtab.h $(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 \
+ coff-arm.c $(INCDIR)/hashtab.h $(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 $(INCDIR)/hashtab.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)/bfdlink.h libaout.h $(INCDIR)/hashtab.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 \
+i386aout.lo: i386aout.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.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 $(INCDIR)/hashtab.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 \
+ libaout.h $(INCDIR)/hashtab.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
+ aout-target.h
+i386freebsd.lo: i386freebsd.c freebsd.h $(INCDIR)/filenames.h \
+ $(INCDIR)/hashtab.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)/hashtab.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 $(INCDIR)/hashtab.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 $(INCDIR)/hashtab.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
+ $(INCDIR)/hashtab.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)/hashtab.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)/hashtab.h \
+ $(INCDIR)/bfdlink.h libaout.h $(INCDIR)/os9k.h
+ieee.lo: ieee.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.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
+ $(INCDIR)/hashtab.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)/hashtab.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
m68knetbsd.lo: m68knetbsd.c netbsd.h $(INCDIR)/filenames.h \
+ $(INCDIR)/hashtab.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 $(INCDIR)/hashtab.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 \
+m88kopenbsd.lo: m88kopenbsd.c netbsd.h $(INCDIR)/filenames.h \
+ $(INCDIR)/hashtab.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 $(INCDIR)/filenames.h mach-o.h \
+ $(INCDIR)/hashtab.h $(INCDIR)/libiberty.h mach-o-target.c
+mipsbsd.lo: mipsbsd.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.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 \
+newsos3.lo: newsos3.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.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 $(INCDIR)/hashtab.h \
libnlm.h $(INCDIR)/nlm/common.h $(INCDIR)/nlm/internal.h \
- $(INCDIR)/nlm/external.h nlmswap.h nlm-target.h
+ $(INCDIR)/nlm/external.h
+nlm32-i386.lo: nlm32-i386.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.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)/hashtab.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)/hashtab.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-ppc.lo: nlm32-ppc.c $(INCDIR)/filenames.h $(INCDIR)/nlm/ppc-ext.h \
+nlm32.lo: nlm32.c nlmcode.h $(INCDIR)/filenames.h $(INCDIR)/hashtab.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
+ $(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
+ $(INCDIR)/hashtab.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
+ $(INCDIR)/hashtab.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
+ $(INCDIR)/bfdlink.h $(INCDIR)/hashtab.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 $(INCDIR)/hashtab.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)/filenames.h $(INCDIR)/safe-ctype.h \
+ pef.h pef-traceback.h $(INCDIR)/hashtab.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
+ $(INCDIR)/hashtab.h $(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)/hashtab.h $(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-arm-wince.lo: pe-arm-wince.c pe-arm.c $(INCDIR)/filenames.h \
+ coff-arm.c $(INCDIR)/hashtab.h $(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 \
+pei-arm-wince.lo: pei-arm-wince.c pei-arm.c $(INCDIR)/filenames.h \
+ coff-arm.c $(INCDIR)/hashtab.h $(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)/hashtab.h $(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
+ $(INCDIR)/hashtab.h $(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
+ $(INCDIR)/hashtab.h $(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
+ $(INCDIR)/hashtab.h $(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)/hashtab.h $(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)/hashtab.h $(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)/hashtab.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 \
+pei-sh.lo: pei-sh.c $(INCDIR)/filenames.h coff-sh.c \
+ $(INCDIR)/libiberty.h $(INCDIR)/hashtab.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)/hashtab.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
-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 \
+pei-mips.lo: pei-mips.c $(INCDIR)/filenames.h pe-mips.c \
+ $(INCDIR)/hashtab.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
+ppcboot.lo: ppcboot.c $(INCDIR)/filenames.h $(INCDIR)/safe-ctype.h \
+ $(INCDIR)/hashtab.h
+reloc16.lo: reloc16.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \
+ $(INCDIR)/bfdlink.h genlink.h $(INCDIR)/coff/internal.h \
+ libcoff.h
+riscix.lo: riscix.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.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
+ aout-target.h $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def \
+ $(INCDIR)/aout/ar.h
+sparclinux.lo: sparclinux.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.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)/hashtab.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
+ $(INCDIR)/hashtab.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
+ $(INCDIR)/filenames.h $(INCDIR)/hashtab.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
+ $(INCDIR)/hashtab.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 \
+ $(INCDIR)/hashtab.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 $(INCDIR)/hashtab.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
+versados.lo: versados.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \
+ $(INCDIR)/libiberty.h
vms.lo: vms.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
- vms.h
+ $(INCDIR)/hashtab.h vms.h
vms-gsd.lo: vms-gsd.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
+ $(INCDIR)/hashtab.h vms.h
+vms-hdr.lo: vms-hdr.c $(INCDIR)/filenames.h bfdver.h \
+ $(INCDIR)/bfdlink.h $(INCDIR)/safe-ctype.h $(INCDIR)/hashtab.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
+ $(INCDIR)/hashtab.h vms.h
vms-tir.lo: vms-tir.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
- vms.h
+ $(INCDIR)/hashtab.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
+ $(INCDIR)/hashtab.h $(INCDIR)/coff/internal.h $(INCDIR)/coff/xcoff.h \
+ libcoff.h libxcoff.h
+xsym.lo: xsym.c $(INCDIR)/filenames.h xsym.h $(INCDIR)/hashtab.h
+xtensa-isa.lo: xtensa-isa.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \
+ $(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
+aix5ppc-core.lo: aix5ppc-core.c $(INCDIR)/filenames.h
aout64.lo: aout64.c aoutx.h $(INCDIR)/filenames.h $(INCDIR)/safe-ctype.h \
- $(INCDIR)/bfdlink.h libaout.h $(INCDIR)/aout/aout64.h \
+ $(INCDIR)/bfdlink.h libaout.h $(INCDIR)/hashtab.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
+ $(INCDIR)/hashtab.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
+ $(INCDIR)/bfdlink.h $(INCDIR)/hashtab.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
+ $(INCDIR)/hashtab.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
+ coff-ia64.c $(INCDIR)/hashtab.h $(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
+efi-app-x86_64.lo: efi-app-x86_64.c $(INCDIR)/filenames.h \
+ coff-x86_64.c $(INCDIR)/hashtab.h $(INCDIR)/coff/x86_64.h \
+ $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \
+ $(INCDIR)/coff/pe.h libcoff.h $(INCDIR)/bfdlink.h $(INCDIR)/libiberty.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)/bfdlink.h $(INCDIR)/hashtab.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)/hashtab.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/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 $(INCDIR)/hashtab.h elf-bfd.h \
$(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
- $(INCDIR)/bfdlink.h elf64-target.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 $(INCDIR)/hashtab.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)/hashtab.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 \
+elf64-mips.lo: elf64-mips.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.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 \
+elf64-mmix.lo: elf64-mmix.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.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 \
+ $(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 \
+ $(INCDIR)/hashtab.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 \
+ $(INCDIR)/hashtab.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
+ $(INCDIR)/hashtab.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)/hashtab.h elf-bfd.h $(INCDIR)/elf/common.h \
+ $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h \
$(INCDIR)/elf/sparc.h $(INCDIR)/elf/reloc-macros.h \
- elf64-target.h
+ $(INCDIR)/opcode/sparc.h elfxx-sparc.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
+ $(INCDIR)/bfdlink.h $(INCDIR)/hashtab.h elf-bfd.h $(INCDIR)/elf/common.h \
+ $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h elfcore.h
+mmo.lo: mmo.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.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
+ $(INCDIR)/hashtab.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 $(INCDIR)/hashtab.h \
+ libnlm.h $(INCDIR)/nlm/common.h $(INCDIR)/nlm/internal.h \
+ $(INCDIR)/nlm/external.h
+coff-x86_64.lo: coff-x86_64.c $(INCDIR)/filenames.h \
+ $(INCDIR)/hashtab.h $(INCDIR)/coff/x86_64.h $(INCDIR)/coff/external.h \
+ $(INCDIR)/coff/internal.h $(INCDIR)/coff/pe.h libcoff.h \
+ $(INCDIR)/bfdlink.h $(INCDIR)/libiberty.h coffcode.h \
+ coffswap.h
+pe-x86_64.lo: pe-x86_64.c $(INCDIR)/filenames.h coff-x86_64.c \
+ $(INCDIR)/hashtab.h $(INCDIR)/coff/x86_64.h $(INCDIR)/coff/external.h \
+ $(INCDIR)/coff/internal.h $(INCDIR)/coff/pe.h libcoff.h \
+ $(INCDIR)/bfdlink.h $(INCDIR)/libiberty.h coffcode.h \
+ peicode.h libpei.h
+pei-x86_64.lo: pei-x86_64.c $(INCDIR)/filenames.h coff-x86_64.c \
+ $(INCDIR)/hashtab.h $(INCDIR)/coff/x86_64.h $(INCDIR)/coff/external.h \
+ $(INCDIR)/coff/internal.h $(INCDIR)/coff/pe.h libcoff.h \
+ $(INCDIR)/bfdlink.h $(INCDIR)/libiberty.h coffcode.h \
+ peicode.h libpei.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
+ $(INCDIR)/hashtab.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 $(INCDIR)/hashtab.h
+irix-core.lo: irix-core.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h
+lynx-core.lo: lynx-core.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h
+osf-core.lo: osf-core.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h
+sco5-core.lo: sco5-core.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \
+ libaout.h $(INCDIR)/bfdlink.h
+trad-core.lo: trad-core.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \
+ libaout.h $(INCDIR)/bfdlink.h
+cisco-core.lo: cisco-core.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h
+elf32-ia64.lo: elf32-ia64.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.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 $(INCDIR)/hashtab.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)/hashtab.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)/hashtab.h \
+ $(INCDIR)/coff/internal.h $(INCDIR)/coff/ia64.h $(INCDIR)/coff/external.h \
+ $(INCDIR)/coff/pe.h libcoff.h $(INCDIR)/bfdlink.h libpei.h
+pex64igen.lo: pex64igen.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \
+ $(INCDIR)/coff/internal.h $(INCDIR)/coff/x86_64.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/acinclude.m4 b/contrib/binutils/bfd/acinclude.m4
index 63b4bf9..cd4fd55 100644
--- a/contrib/binutils/bfd/acinclude.m4
+++ b/contrib/binutils/bfd/acinclude.m4
@@ -1,8 +1,6 @@
-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])
+[AC_REQUIRE([AC_CANONICAL_TARGET])
case "${host}" in
changequote(,)dnl
*-*-msdos* | *-*-go32* | *-*-mingw32* | *-*-cygwin* | *-*-windows*)
@@ -43,89 +41,6 @@ else
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,
@@ -138,12 +53,15 @@ AC_DEFUN([AM_INSTALL_LIBBFD],
fi)
AC_MSG_RESULT($install_libbfd_p)
AM_CONDITIONAL(INSTALL_LIBBFD, test $install_libbfd_p = yes)
+ # Need _noncanonical variables for this.
+ ACX_NONCANONICAL_HOST
+ ACX_NONCANONICAL_TARGET
# 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'
+ bfdlibdir='$(exec_prefix)/$(host_noncanonical)/$(target_noncanonical)/lib'
+ bfdincludedir='$(exec_prefix)/$(host_noncanonical)/$(target_noncanonical)/include'
fi
AC_SUBST(bfdlibdir)
AC_SUBST(bfdincludedir)
diff --git a/contrib/binutils/bfd/aclocal.m4 b/contrib/binutils/bfd/aclocal.m4
index 9d27670..9dfea06 100644
--- a/contrib/binutils/bfd/aclocal.m4
+++ b/contrib/binutils/bfd/aclocal.m4
@@ -1,292 +1,729 @@
-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)
-])
+# generated automatically by aclocal 1.9.6 -*- Autoconf -*-
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
+# 2005 Free Software Foundation, Inc.
+# This file 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.
-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)
-])
+# 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.
-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)
-])
+# Copyright (C) 2002, 2003, 2005 Free Software Foundation, Inc.
+#
+# This file 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.
-sinclude(../gettext.m4)
-ifelse(yes,no,[
-AC_DEFUN([CY_WITH_NLS],)
-AC_SUBST(INTLLIBS)
+# 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.9"])
+
+# 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.9.6])])
+
+# AM_AUX_DIR_EXPAND -*- Autoconf -*-
+
+# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc.
+#
+# This file 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.
+
+# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
+# $ac_aux_dir to `$srcdir/foo'. In other projects, it is set to
+# `$srcdir', `$srcdir/..', or `$srcdir/../..'.
+#
+# Of course, Automake must honor this variable whenever it calls a
+# tool from the auxiliary directory. The problem is that $srcdir (and
+# therefore $ac_aux_dir as well) can be either absolute or relative,
+# depending on how configure is run. This is pretty annoying, since
+# it makes $ac_aux_dir quite unusable in subdirectories: in the top
+# source directory, any form will work fine, but in subdirectories a
+# relative path needs to be adjusted first.
+#
+# $ac_aux_dir/missing
+# fails when called from a subdirectory if $ac_aux_dir is relative
+# $top_srcdir/$ac_aux_dir/missing
+# fails if $ac_aux_dir is absolute,
+# fails when called from a subdirectory in a VPATH build with
+# a relative $ac_aux_dir
+#
+# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
+# are both prefixed by $srcdir. In an in-source build this is usually
+# harmless because $srcdir is `.', but things will broke when you
+# start a VPATH build or use an absolute $srcdir.
+#
+# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
+# iff we strip the leading $srcdir from $ac_aux_dir. That would be:
+# am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
+# and then we would define $MISSING as
+# MISSING="\${SHELL} $am_aux_dir/missing"
+# This will work as long as MISSING is not called from configure, because
+# unfortunately $(top_srcdir) has no meaning in configure.
+# However there are other variables, like CC, which are often used in
+# configure, and could therefore not use this "fixed" $ac_aux_dir.
+#
+# Another solution, used here, is to always expand $ac_aux_dir to an
+# absolute PATH. The drawback is that using absolute paths prevent a
+# configured tree to be moved without reconfiguration.
+
+AC_DEFUN([AM_AUX_DIR_EXPAND],
+[dnl Rely on autoconf to set up CDPATH properly.
+AC_PREREQ([2.50])dnl
+# expand $ac_aux_dir to an absolute path
+am_aux_dir=`cd $ac_aux_dir && pwd`
])
-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)
-]
-)
+# AM_CONDITIONAL -*- Autoconf -*-
-# Define a conditional.
+# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005
+# Free Software Foundation, Inc.
+#
+# This file 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.
+# serial 7
+
+# AM_CONDITIONAL(NAME, SHELL-CONDITION)
+# -------------------------------------
+# Define a conditional.
AC_DEFUN([AM_CONDITIONAL],
-[AC_SUBST($1_TRUE)
-AC_SUBST($1_FALSE)
+[AC_PREREQ(2.52)dnl
+ ifelse([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])],
+ [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
+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"])
- ]
-)
+fi
+AC_CONFIG_COMMANDS_PRE(
+[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
+ AC_MSG_ERROR([[conditional "$1" was never defined.
+Usually this means the macro was only invoked conditionally.]])
+fi])])
-# 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
+# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005
+# Free Software Foundation, Inc.
+#
+# This file 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.
-dnl Usage:
-dnl AM_INIT_AUTOMAKE(package,version, [no-define])
+# serial 8
+# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be
+# written in clear, in which case automake, when reading aclocal.m4,
+# will think it sees a *use*, and therefore will trigger all it's
+# C support machinery. Also note that it means that autoscan, seeing
+# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
+
+
+# _AM_DEPENDENCIES(NAME)
+# ----------------------
+# See how the compiler implements dependency checking.
+# NAME is "CC", "CXX", "GCJ", or "OBJC".
+# We try a few techniques and use that to set a single cache variable.
+#
+# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
+# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
+# dependency, and given that the user is not expected to run this macro,
+# just rely on AC_PROG_CC.
+AC_DEFUN([_AM_DEPENDENCIES],
+[AC_REQUIRE([AM_SET_DEPDIR])dnl
+AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
+AC_REQUIRE([AM_MAKE_INCLUDE])dnl
+AC_REQUIRE([AM_DEP_TRACK])dnl
+
+ifelse([$1], CC, [depcc="$CC" am_compiler_list=],
+ [$1], CXX, [depcc="$CXX" am_compiler_list=],
+ [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
+ [$1], GCJ, [depcc="$GCJ" am_compiler_list='gcc3 gcc'],
+ [depcc="$$1" am_compiler_list=])
+
+AC_CACHE_CHECK([dependency style of $depcc],
+ [am_cv_$1_dependencies_compiler_type],
+[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
+ # We make a subdir and do the tests there. Otherwise we can end up
+ # making bogus files that we don't know about and never remove. For
+ # instance it was reported that on HP-UX the gcc test will end up
+ # making a dummy file named `D' -- because `-MD' means `put the output
+ # in D'.
+ mkdir conftest.dir
+ # Copy depcomp to subdir because otherwise we won't find it if we're
+ # using a relative directory.
+ cp "$am_depcomp" conftest.dir
+ cd conftest.dir
+ # We will build objects and dependencies in a subdirectory because
+ # it helps to detect inapplicable dependency modes. For instance
+ # both Tru64's cc and ICC support -MD to output dependencies as a
+ # side effect of compilation, but ICC will put the dependencies in
+ # the current directory while Tru64 will put them in the object
+ # directory.
+ mkdir sub
+
+ am_cv_$1_dependencies_compiler_type=none
+ if test "$am_compiler_list" = ""; then
+ am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
+ fi
+ for depmode in $am_compiler_list; do
+ # Setup a source with many dependencies, because some compilers
+ # like to wrap large dependency lists on column 80 (with \), and
+ # we should not choose a depcomp mode which is confused by this.
+ #
+ # We need to recreate these files for each test, as the compiler may
+ # overwrite some of them when testing with obscure command lines.
+ # This happens at least with the AIX C compiler.
+ : > sub/conftest.c
+ for i in 1 2 3 4 5 6; do
+ echo '#include "conftst'$i'.h"' >> sub/conftest.c
+ # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
+ # Solaris 8's {/usr,}/bin/sh.
+ touch sub/conftst$i.h
+ done
+ echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
+
+ case $depmode in
+ nosideeffect)
+ # after this tag, mechanisms are not by side-effect, so they'll
+ # only be used when explicitly requested
+ if test "x$enable_dependency_tracking" = xyes; then
+ continue
+ else
+ break
+ fi
+ ;;
+ none) break ;;
+ esac
+ # We check with `-c' and `-o' for the sake of the "dashmstdout"
+ # mode. It turns out that the SunPro C++ compiler does not properly
+ # handle `-M -o', and we need to detect this.
+ if depmode=$depmode \
+ source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \
+ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
+ $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \
+ >/dev/null 2>conftest.err &&
+ grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
+ grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 &&
+ ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
+ # icc doesn't choke on unknown options, it will just issue warnings
+ # or remarks (even with -Werror). So we grep stderr for any message
+ # that says an option was ignored or not supported.
+ # When given -MP, icc 7.0 and 7.1 complain thusly:
+ # icc: Command line warning: ignoring option '-M'; no argument required
+ # The diagnosis changed in icc 8.0:
+ # icc: Command line remark: option '-MP' not supported
+ if (grep 'ignoring option' conftest.err ||
+ grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
+ am_cv_$1_dependencies_compiler_type=$depmode
+ break
+ fi
+ fi
+ done
+
+ cd ..
+ rm -rf conftest.dir
+else
+ am_cv_$1_dependencies_compiler_type=none
+fi
+])
+AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
+AM_CONDITIONAL([am__fastdep$1], [
+ test "x$enable_dependency_tracking" != xno \
+ && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
+])
+
+
+# AM_SET_DEPDIR
+# -------------
+# Choose a directory name for dependency files.
+# This macro is AC_REQUIREd in _AM_DEPENDENCIES
+AC_DEFUN([AM_SET_DEPDIR],
+[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
+AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
+])
+
+
+# AM_DEP_TRACK
+# ------------
+AC_DEFUN([AM_DEP_TRACK],
+[AC_ARG_ENABLE(dependency-tracking,
+[ --disable-dependency-tracking speeds up one-time build
+ --enable-dependency-tracking do not reject slow dependency extractors])
+if test "x$enable_dependency_tracking" != xno; then
+ am_depcomp="$ac_aux_dir/depcomp"
+ AMDEPBACKSLASH='\'
+fi
+AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
+AC_SUBST([AMDEPBACKSLASH])
+])
+
+# Generate code to set up dependency tracking. -*- Autoconf -*-
+
+# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005
+# Free Software Foundation, Inc.
+#
+# This file 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.
+
+#serial 3
+
+# _AM_OUTPUT_DEPENDENCY_COMMANDS
+# ------------------------------
+AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
+[for mf in $CONFIG_FILES; do
+ # Strip MF so we end up with the name of the file.
+ mf=`echo "$mf" | sed -e 's/:.*$//'`
+ # Check whether this is an Automake generated Makefile or not.
+ # We used to match only the files named `Makefile.in', but
+ # some people rename them; so instead we look at the file content.
+ # Grep'ing the first line is not enough: some people post-process
+ # each Makefile.in and add a new line on top of each file to say so.
+ # So let's grep whole file.
+ if grep '^#.*generated by automake' $mf > /dev/null 2>&1; then
+ dirpart=`AS_DIRNAME("$mf")`
+ else
+ continue
+ fi
+ # Extract the definition of DEPDIR, am__include, and am__quote
+ # from the Makefile without running `make'.
+ DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
+ test -z "$DEPDIR" && continue
+ am__include=`sed -n 's/^am__include = //p' < "$mf"`
+ test -z "am__include" && continue
+ am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
+ # When using ansi2knr, U may be empty or an underscore; expand it
+ U=`sed -n 's/^U = //p' < "$mf"`
+ # Find all dependency output files, they are included files with
+ # $(DEPDIR) in their names. We invoke sed twice because it is the
+ # simplest approach to changing $(DEPDIR) to its actual value in the
+ # expansion.
+ for file in `sed -n "
+ s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
+ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
+ # Make sure the directory exists.
+ test -f "$dirpart/$file" && continue
+ fdir=`AS_DIRNAME(["$file"])`
+ AS_MKDIR_P([$dirpart/$fdir])
+ # echo "creating $dirpart/$file"
+ echo '# dummy' > "$dirpart/$file"
+ done
+done
+])# _AM_OUTPUT_DEPENDENCY_COMMANDS
+
+
+# AM_OUTPUT_DEPENDENCY_COMMANDS
+# -----------------------------
+# This macro should only be invoked once -- use via AC_REQUIRE.
+#
+# This code is only required when automatic dependency tracking
+# is enabled. FIXME. This creates each `.P' file that we will
+# need in order to bootstrap the dependency handling code.
+AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
+[AC_CONFIG_COMMANDS([depfiles],
+ [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
+ [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
+])
+
+# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005
+# Free Software Foundation, Inc.
+#
+# This file 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.
+
+# serial 8
+
+# AM_CONFIG_HEADER is obsolete. It has been replaced by AC_CONFIG_HEADERS.
+AU_DEFUN([AM_CONFIG_HEADER], [AC_CONFIG_HEADERS($@)])
+
+# Do all the work for Automake. -*- Autoconf -*-
+
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
+# Free Software Foundation, Inc.
+#
+# This file 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.
+
+# serial 12
+
+# 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.
+
+# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
+# AM_INIT_AUTOMAKE([OPTIONS])
+# -----------------------------------------------
+# The call with PACKAGE and VERSION arguments is the old style
+# call (pre autoconf-2.50), which is being phased out. PACKAGE
+# and VERSION should now be passed to AC_INIT and removed from
+# the call to AM_INIT_AUTOMAKE.
+# We support both call styles for the transition. After
+# the next Automake release, Autoconf can make the AC_INIT
+# arguments mandatory, and then we can depend on a new Autoconf
+# release and drop the old call support.
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_PREREQ([2.58])dnl
+dnl Autoconf wants to disallow AM_ names. We explicitly allow
+dnl the ones we care about.
+m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
+AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
+AC_REQUIRE([AC_PROG_INSTALL])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.
+# test whether we have cygpath
+if test -z "$CYGPATH_W"; then
+ if (cygpath --version) >/dev/null 2>/dev/null; then
+ CYGPATH_W='cygpath -w'
+ else
+ CYGPATH_W=echo
+ fi
+fi
+AC_SUBST([CYGPATH_W])
+
+# Define the identity of the package.
+dnl Distinguish between old-style and new-style calls.
+m4_ifval([$2],
+[m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
+ AC_SUBST([PACKAGE], [$1])dnl
+ AC_SUBST([VERSION], [$2])],
+[_AM_SET_OPTIONS([$1])dnl
+ AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
+ AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
+
+_AM_IF_OPTION([no-define],,
+[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
+ AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl
+
+# Some tools Automake needs.
+AC_REQUIRE([AM_SANITY_CHECK])dnl
+AC_REQUIRE([AC_ARG_PROGRAM])dnl
+AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version})
+AM_MISSING_PROG(AUTOCONF, autoconf)
+AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version})
+AM_MISSING_PROG(AUTOHEADER, autoheader)
+AM_MISSING_PROG(MAKEINFO, makeinfo)
+AM_PROG_INSTALL_SH
+AM_PROG_INSTALL_STRIP
+AC_REQUIRE([AM_PROG_MKDIR_P])dnl
+# We need awk for the "check" target. The system "awk" is bad on
+# some platforms.
+AC_REQUIRE([AC_PROG_AWK])dnl
+AC_REQUIRE([AC_PROG_MAKE_SET])dnl
+AC_REQUIRE([AM_SET_LEADING_DOT])dnl
+_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
+ [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
+ [_AM_PROG_TAR([v7])])])
+_AM_IF_OPTION([no-dependencies],,
+[AC_PROVIDE_IFELSE([AC_PROG_CC],
+ [_AM_DEPENDENCIES(CC)],
+ [define([AC_PROG_CC],
+ defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl
+AC_PROVIDE_IFELSE([AC_PROG_CXX],
+ [_AM_DEPENDENCIES(CXX)],
+ [define([AC_PROG_CXX],
+ defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl
+])
+])
-# 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"])
+# When config.status generates a header, we must update the stamp-h file.
+# This file resides in the same directory as the config header
+# that is generated. The stamp files are numbered to have different names.
+
+# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
+# loop where config.status creates the headers, so we can generate
+# our stamp files there.
+AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
+[# Compute $1's index in $config_headers.
+_am_stamp_count=1
+for _am_header in $config_headers :; do
+ case $_am_header in
+ $1 | $1:* )
+ break ;;
+ * )
+ _am_stamp_count=`expr $_am_stamp_count + 1` ;;
+ esac
+done
+echo "timestamp for $1" >`AS_DIRNAME([$1])`/stamp-h[]$_am_stamp_count])
-# 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])])
+# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc.
+#
+# This file 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.
+
+# AM_PROG_INSTALL_SH
+# ------------------
+# Define $install_sh.
+AC_DEFUN([AM_PROG_INSTALL_SH],
+[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
+install_sh=${install_sh-"$am_aux_dir/install-sh"}
+AC_SUBST(install_sh)])
+
+# Add --enable-maintainer-mode option to configure. -*- Autoconf -*-
+# From Jim Meyering
+# Copyright (C) 1996, 1998, 2000, 2001, 2002, 2003, 2004, 2005
+# Free Software Foundation, Inc.
#
-# Check to make sure that the build environment is sane.
+# This file 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.
+
+# serial 4
+
+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
+]
+)
+
+AU_DEFUN([jm_MAINTAINER_MODE], [AM_MAINTAINER_MODE])
+
+# Check to see how 'make' treats includes. -*- Autoconf -*-
+
+# Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation, Inc.
+#
+# This file 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.
+
+# serial 3
+
+# AM_MAKE_INCLUDE()
+# -----------------
+# Check to see how make treats includes.
+AC_DEFUN([AM_MAKE_INCLUDE],
+[am_make=${MAKE-make}
+cat > confinc << 'END'
+am__doit:
+ @echo done
+.PHONY: am__doit
+END
+# If we don't find an include directive, just comment out the code.
+AC_MSG_CHECKING([for style of include used by $am_make])
+am__include="#"
+am__quote=
+_am_result=none
+# First try GNU make style include.
+echo "include confinc" > confmf
+# We grep out `Entering directory' and `Leaving directory'
+# messages which can occur if `w' ends up in MAKEFLAGS.
+# In particular we don't look at `^make:' because GNU make might
+# be invoked under some other name (usually "gmake"), in which
+# case it prints its new name instead of `make'.
+if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then
+ am__include=include
+ am__quote=
+ _am_result=GNU
+fi
+# Now try BSD make style include.
+if test "$am__include" = "#"; then
+ echo '.include "confinc"' > confmf
+ if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then
+ am__include=.include
+ am__quote="\""
+ _am_result=BSD
+ fi
+fi
+AC_SUBST([am__include])
+AC_SUBST([am__quote])
+AC_MSG_RESULT([$_am_result])
+rm -f confinc confmf
+])
+
+# Fake the existence of programs that GNU maintainers use. -*- Autoconf -*-
+
+# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2005
+# Free Software Foundation, Inc.
+#
+# This file 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.
+
+# serial 4
+
+# AM_MISSING_PROG(NAME, PROGRAM)
+# ------------------------------
+AC_DEFUN([AM_MISSING_PROG],
+[AC_REQUIRE([AM_MISSING_HAS_RUN])
+$1=${$1-"${am_missing_run}$2"}
+AC_SUBST($1)])
+
+
+# AM_MISSING_HAS_RUN
+# ------------------
+# Define MISSING if not defined so far and test if it supports --run.
+# If it does, set am_missing_run to use it, otherwise, to nothing.
+AC_DEFUN([AM_MISSING_HAS_RUN],
+[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
+test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing"
+# Use eval to expand $SHELL
+if eval "$MISSING --run true"; then
+ am_missing_run="$MISSING --run "
+else
+ am_missing_run=
+ AC_MSG_WARN([`missing' script is too old or missing])
+fi
+])
+
+# Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc.
#
+# This file 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.
+# AM_PROG_MKDIR_P
+# ---------------
+# Check whether `mkdir -p' is supported, fallback to mkinstalldirs otherwise.
+#
+# Automake 1.8 used `mkdir -m 0755 -p --' to ensure that directories
+# created by `make install' are always world readable, even if the
+# installer happens to have an overly restrictive umask (e.g. 077).
+# This was a mistake. There are at least two reasons why we must not
+# use `-m 0755':
+# - it causes special bits like SGID to be ignored,
+# - it may be too restrictive (some setups expect 775 directories).
+#
+# Do not use -m 0755 and let people choose whatever they expect by
+# setting umask.
+#
+# We cannot accept any implementation of `mkdir' that recognizes `-p'.
+# Some implementations (such as Solaris 8's) are not thread-safe: if a
+# parallel make tries to run `mkdir -p a/b' and `mkdir -p a/c'
+# concurrently, both version can detect that a/ is missing, but only
+# one can create it and the other will error out. Consequently we
+# restrict ourselves to GNU make (using the --version option ensures
+# this.)
+AC_DEFUN([AM_PROG_MKDIR_P],
+[if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then
+ # We used to keeping the `.' as first argument, in order to
+ # allow $(mkdir_p) to be used without argument. As in
+ # $(mkdir_p) $(somedir)
+ # where $(somedir) is conditionally defined. However this is wrong
+ # for two reasons:
+ # 1. if the package is installed by a user who cannot write `.'
+ # make install will fail,
+ # 2. the above comment should most certainly read
+ # $(mkdir_p) $(DESTDIR)$(somedir)
+ # so it does not work when $(somedir) is undefined and
+ # $(DESTDIR) is not.
+ # To support the latter case, we have to write
+ # test -z "$(somedir)" || $(mkdir_p) $(DESTDIR)$(somedir),
+ # so the `.' trick is pointless.
+ mkdir_p='mkdir -p --'
+else
+ # On NextStep and OpenStep, the `mkdir' command does not
+ # recognize any option. It will interpret all options as
+ # directories to create, and then abort because `.' already
+ # exists.
+ for d in ./-p ./--version;
+ do
+ test -d $d && rmdir $d
+ done
+ # $(mkinstalldirs) is defined by Automake if mkinstalldirs exists.
+ if test -f "$ac_aux_dir/mkinstalldirs"; then
+ mkdir_p='$(mkinstalldirs)'
+ else
+ mkdir_p='$(install_sh) -d'
+ fi
+fi
+AC_SUBST([mkdir_p])])
+
+# Helper functions for option handling. -*- Autoconf -*-
+
+# Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation, Inc.
+#
+# This file 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.
+
+# serial 3
+
+# _AM_MANGLE_OPTION(NAME)
+# -----------------------
+AC_DEFUN([_AM_MANGLE_OPTION],
+[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
+
+# _AM_SET_OPTION(NAME)
+# ------------------------------
+# Set option NAME. Presently that only means defining a flag for this option.
+AC_DEFUN([_AM_SET_OPTION],
+[m4_define(_AM_MANGLE_OPTION([$1]), 1)])
+
+# _AM_SET_OPTIONS(OPTIONS)
+# ----------------------------------
+# OPTIONS is a space-separated list of Automake options.
+AC_DEFUN([_AM_SET_OPTIONS],
+[AC_FOREACH([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
+
+# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
+# -------------------------------------------
+# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
+AC_DEFUN([_AM_IF_OPTION],
+[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
+
+# Check to make sure that the build environment is sane. -*- Autoconf -*-
+
+# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005
+# Free Software Foundation, Inc.
+#
+# This file 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.
+
+# serial 4
+
+# AM_SANITY_CHECK
+# ---------------
AC_DEFUN([AM_SANITY_CHECK],
[AC_MSG_CHECKING([whether build environment is sane])
# Just in case
sleep 1
-echo timestamp > conftestfile
+echo timestamp > conftest.file
# 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
+ set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null`
+ if test "$[*]" = "X"; then
# -L didn't work.
- set X `ls -t $srcdir/configure conftestfile`
+ set X `ls -t $srcdir/configure conftest.file`
fi
- if test "[$]*" != "X $srcdir/configure conftestfile" \
- && test "[$]*" != "X conftestfile $srcdir/configure"; then
+ rm -f conftest.file
+ if test "$[*]" != "X $srcdir/configure conftest.file" \
+ && test "$[*]" != "X conftest.file $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
@@ -296,7 +733,7 @@ if (
alias in your environment])
fi
- test "[$]2" = conftestfile
+ test "$[2]" = conftest.file
)
then
# Ok.
@@ -305,65 +742,144 @@ 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)
+# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc.
+#
+# This file 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.
+
+# AM_PROG_INSTALL_STRIP
+# ---------------------
+# One issue with vendor `install' (even GNU) is that you can't
+# specify the program used to strip binaries. This is especially
+# annoying in cross-compiling environments, where the build's strip
+# is unlikely to handle the host's binaries.
+# Fortunately install-sh will honor a STRIPPROG variable, so we
+# always use install-sh in `make install-strip', and initialize
+# STRIPPROG with the value of the STRIP variable (set by the user).
+AC_DEFUN([AM_PROG_INSTALL_STRIP],
+[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
+# Installed binaries are usually stripped using `strip' when the user
+# run `make install-strip'. However `strip' might not be the right
+# tool to use in cross-compilation environments, therefore Automake
+# will honor the `STRIP' environment variable to overrule this program.
+dnl Don't test for $cross_compiling = yes, because it might be `maybe'.
+if test "$cross_compiling" != no; then
+ AC_CHECK_TOOL([STRIP], [strip], :)
fi
-AC_SUBST($1)])
+INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s"
+AC_SUBST([INSTALL_STRIP_PROGRAM])])
-# 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([,]))])
+# Check how to create a tarball. -*- Autoconf -*-
-# Add --enable-maintainer-mode option to configure.
-# From Jim Meyering
+# Copyright (C) 2004, 2005 Free Software Foundation, Inc.
+#
+# This file 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.
-# serial 1
+# serial 2
-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
-]
-)
+# _AM_PROG_TAR(FORMAT)
+# --------------------
+# Check how to create a tarball in format FORMAT.
+# FORMAT should be one of `v7', `ustar', or `pax'.
+#
+# Substitute a variable $(am__tar) that is a command
+# writing to stdout a FORMAT-tarball containing the directory
+# $tardir.
+# tardir=directory && $(am__tar) > result.tar
+#
+# Substitute a variable $(am__untar) that extract such
+# a tarball read from stdin.
+# $(am__untar) < result.tar
+AC_DEFUN([_AM_PROG_TAR],
+[# Always define AMTAR for backward compatibility.
+AM_MISSING_PROG([AMTAR], [tar])
+m4_if([$1], [v7],
+ [am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'],
+ [m4_case([$1], [ustar],, [pax],,
+ [m4_fatal([Unknown tar format])])
+AC_MSG_CHECKING([how to create a $1 tar archive])
+# Loop over all known methods to create a tar archive until one works.
+_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
+_am_tools=${am_cv_prog_tar_$1-$_am_tools}
+# Do not fold the above two line into one, because Tru64 sh and
+# Solaris sh will not grok spaces in the rhs of `-'.
+for _am_tool in $_am_tools
+do
+ case $_am_tool in
+ gnutar)
+ for _am_tar in tar gnutar gtar;
+ do
+ AM_RUN_LOG([$_am_tar --version]) && break
+ done
+ am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
+ am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
+ am__untar="$_am_tar -xf -"
+ ;;
+ plaintar)
+ # Must skip GNU tar: if it does not support --format= it doesn't create
+ # ustar tarball either.
+ (tar --version) >/dev/null 2>&1 && continue
+ am__tar='tar chf - "$$tardir"'
+ am__tar_='tar chf - "$tardir"'
+ am__untar='tar xf -'
+ ;;
+ pax)
+ am__tar='pax -L -x $1 -w "$$tardir"'
+ am__tar_='pax -L -x $1 -w "$tardir"'
+ am__untar='pax -r'
+ ;;
+ cpio)
+ am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
+ am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
+ am__untar='cpio -i -H $1 -d'
+ ;;
+ none)
+ am__tar=false
+ am__tar_=false
+ am__untar=false
+ ;;
+ esac
+ # If the value was cached, stop now. We just wanted to have am__tar
+ # and am__untar set.
+ test -n "${am_cv_prog_tar_$1}" && break
+
+ # tar/untar a dummy directory, and stop if the command works
+ rm -rf conftest.dir
+ mkdir conftest.dir
+ echo GrepMe > conftest.dir/file
+ AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
+ rm -rf conftest.dir
+ if test -s conftest.tar; then
+ AM_RUN_LOG([$am__untar <conftest.tar])
+ grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
+ fi
+done
+rm -rf conftest.dir
+
+AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
+AC_MSG_RESULT([$am_cv_prog_tar_$1])])
+AC_SUBST([am__tar])
+AC_SUBST([am__untar])
+]) # _AM_PROG_TAR
+
+m4_include([../config/acx.m4])
+m4_include([../config/depstand.m4])
+m4_include([../config/gettext-sister.m4])
+m4_include([../config/lead-dot.m4])
+m4_include([../config/nls.m4])
+m4_include([../config/po.m4])
+m4_include([../config/progtest.m4])
+m4_include([../config/stdint.m4])
+m4_include([../libtool.m4])
+m4_include([../ltoptions.m4])
+m4_include([../ltsugar.m4])
+m4_include([../ltversion.m4])
+m4_include([bfd.m4])
+m4_include([warning.m4])
+m4_include([acinclude.m4])
diff --git a/contrib/binutils/bfd/aout-arm.c b/contrib/binutils/bfd/aout-arm.c
index 38ecfab..4b0d42c 100644
--- a/contrib/binutils/bfd/aout-arm.c
+++ b/contrib/binutils/bfd/aout-arm.c
@@ -1,26 +1,26 @@
/* BFD back-end for raw ARM a.out binaries.
- Copyright 1994, 1995, 1997, 1998, 1999, 2000, 2001, 2002
- Free Software Foundation, Inc.
+ Copyright 1994, 1995, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2005,
+ 2007 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 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 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.
+ 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. */
+ 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., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
/* Avoid multiple definitions from aoutx if supporting standard a.out
as well as our own. */
@@ -50,70 +50,54 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#define N_MAGIC(x) ((x).a_info & ~07200)
#define MY_bfd_reloc_type_lookup aoutarm_bfd_reloc_type_lookup
+#define MY_bfd_reloc_name_lookup aoutarm_bfd_reloc_name_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)
- };
+static bfd_reloc_status_type
+ MY (fix_pcrel_26) (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **);
+static bfd_reloc_status_type
+ MY (fix_pcrel_26_done) (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **);
+
+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;
+static reloc_howto_type *
+MY (reloc_howto) (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;
@@ -147,20 +131,19 @@ MY(reloc_howto) (abfd, rel, r_index, r_extern, r_pcrel)
if (index == 3)
*r_pcrel = 1;
- return MY(howto_table) + index;
+ return MY (howto_table) + index;
}
#define MY_reloc_howto(BFD, REL, IN, EX, PC) \
- 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;
+static void
+MY (put_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;
@@ -202,25 +185,22 @@ MY(put_reloc) (abfd, r_extern, r_index, value, howto, reloc)
}
#define MY_put_reloc(BFD, EXT, IDX, VAL, HOWTO, RELOC) \
- 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;
+static void
+MY (relocatable_reloc) (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;
- }
+ /* The reloc is still external, so don't modify anything. */
+ *amount = 0;
else
{
*amount -= r_addr;
@@ -237,33 +217,29 @@ MY(relocatable_reloc) (howto, abfd, reloc, amount, r_addr)
}
#define MY_relocatable_reloc(HOW, BFD, REL, AMOUNT, ADDR) \
- 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;
+MY (fix_pcrel_26_done) (bfd *abfd ATTRIBUTE_UNUSED,
+ arelent *reloc_entry ATTRIBUTE_UNUSED,
+ asymbol *symbol ATTRIBUTE_UNUSED,
+ void * 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;
+MY (fix_pcrel_26) (bfd *abfd,
+ arelent *reloc_entry,
+ asymbol *symbol,
+ void * data,
+ asection *input_section,
+ bfd *output_bfd,
+ char **error_message ATTRIBUTE_UNUSED)
{
bfd_vma relocation;
bfd_size_type addr = reloc_entry->address;
@@ -278,7 +254,7 @@ MY(fix_pcrel_26) (abfd, reloc_entry, symbol, data, input_section,
/* 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)
+ && output_bfd != NULL)
return bfd_reloc_ok;
relocation = (target & 0x00ffffff) << 2;
@@ -308,17 +284,17 @@ MY(fix_pcrel_26) (abfd, reloc_entry, symbol, data, input_section,
/* 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];
+ 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;
+static reloc_howto_type *
+MY (bfd_reloc_type_lookup) (bfd *abfd,
+ bfd_reloc_code_real_type code)
{
-#define ASTD(i,j) case i: return &MY(howto_table)[j]
+#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)
{
@@ -326,7 +302,7 @@ MY(bfd_reloc_type_lookup) (abfd,code)
code = BFD_RELOC_32;
break;
default:
- return (const struct reloc_howto_struct *) 0;
+ return NULL;
}
switch (code)
@@ -338,26 +314,41 @@ MY(bfd_reloc_type_lookup) (abfd,code)
ASTD (BFD_RELOC_16_PCREL, 5);
ASTD (BFD_RELOC_32_PCREL, 6);
default:
- return (const struct reloc_howto_struct *) 0;
+ return NULL;
}
}
-#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 */
+static reloc_howto_type *
+MY (bfd_reloc_name_lookup) (bfd *abfd ATTRIBUTE_UNUSED,
+ const char *r_name)
+{
+ unsigned int i;
+
+ for (i = 0;
+ i < sizeof (MY (howto_table)) / sizeof (MY (howto_table)[0]);
+ i++)
+ if (MY (howto_table)[i].name != NULL
+ && strcasecmp (MY (howto_table)[i].name, r_name) == 0)
+ return &MY (howto_table)[i];
+
+ return NULL;
+}
+
+#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
+
+void MY_swap_std_reloc_in (bfd *, struct reloc_std_external *, arelent *, asymbol **, bfd_size_type);
+void MY_swap_std_reloc_out (bfd *, arelent *, struct reloc_std_external *);
#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;
+void
+MY_swap_std_reloc_in (bfd *abfd,
+ struct reloc_std_external *bytes,
+ arelent *cache_ptr,
+ asymbol **symbols,
+ bfd_size_type symcount ATTRIBUTE_UNUSED)
{
int r_index;
int r_extern;
@@ -372,10 +363,9 @@ MY_swap_std_reloc_in (abfd, bytes, cache_ptr, symbols, symcount)
}
void
-MY_swap_std_reloc_out (abfd, g, natptr)
- bfd *abfd;
- arelent *g;
- struct reloc_std_external *natptr;
+MY_swap_std_reloc_out (bfd *abfd,
+ arelent *g,
+ struct reloc_std_external *natptr)
{
int r_index;
asymbol *sym = *(g->sym_ptr_ptr);
@@ -385,21 +375,19 @@ MY_swap_std_reloc_out (abfd, g, natptr)
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);
+ PUT_WORD (abfd, g->address, natptr->r_address);
- r_length = g->howto->size ; /* Size as a power of two */
+ 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? */
+ 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)???!!!
- */
-
+ relocation has been done already (Only for the 26-bit one I think). */
if (g->howto->type == 3)
{
r_length = 3;
@@ -411,20 +399,14 @@ MY_swap_std_reloc_out (abfd, g, natptr)
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 */
+ /* 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
- */
+ check for that here. */
if (bfd_is_com_section (output_section)
|| output_section == &bfd_abs_section
@@ -483,83 +465,83 @@ MY_swap_std_reloc_out (abfd, g, natptr)
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,
- };
+{
+ "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, /* Headers. */
+ {_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,
+
+ (void *) 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,
- };
+{
+ "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, /* Headers. */
+ {_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,
+
+ (void *) 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
index 7772c29..2334731 100644
--- a/contrib/binutils/bfd/aout-sparcle.c
+++ b/contrib/binutils/bfd/aout-sparcle.c
@@ -16,7 +16,7 @@ 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. */
+Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
#define TARGETNAME "a.out-sparc-little"
diff --git a/contrib/binutils/bfd/aout-target.h b/contrib/binutils/bfd/aout-target.h
index d8cad54..3e5fa91 100644
--- a/contrib/binutils/bfd/aout-target.h
+++ b/contrib/binutils/bfd/aout-target.h
@@ -1,23 +1,23 @@
/* 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
+ 2000, 2001, 2002, 2003, 2004, 2005, 2007
Free Software Foundation, Inc.
-This file is part of BFD, the Binary File Descriptor library.
+ 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 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.
+ 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. */
+ 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., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
#include "aout/aout64.h"
#include "aout/stab_gnu.h"
@@ -28,30 +28,27 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#define SEGMENT_SIZE TARGET_PAGE_SIZE
#endif
-extern reloc_howto_type * NAME(aout,reloc_type_lookup)
- PARAMS ((bfd *, bfd_reloc_code_real_type));
+extern reloc_howto_type * NAME (aout, reloc_type_lookup) (bfd *, bfd_reloc_code_real_type);
+extern reloc_howto_type * NAME (aout, reloc_name_lookup) (bfd *, const char *);
/* 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;
+MY (callback) (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);
+ /* Calculate the file positions of the parts of a newly read aout header. */
+ obj_textsec (abfd)->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);
+ /* 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.
@@ -74,13 +71,13 @@ MY(callback) (abfd)
obj_datasec (abfd)->lma = obj_datasec (abfd)->vma;
obj_bsssec (abfd)->lma = obj_bsssec (abfd)->vma;
- /* The file offsets of the sections */
+ /* 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 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);
@@ -103,19 +100,19 @@ MY(callback) (abfd)
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),
+ 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))
+ if ((BFD_ALIGN (obj_textsec (abfd)->size, arch_align)
+ == obj_textsec (abfd)->size)
+ && (BFD_ALIGN (obj_datasec (abfd)->size, arch_align)
+ == obj_datasec (abfd)->size)
+ && (BFD_ALIGN (obj_bsssec (abfd)->size, arch_align)
+ == obj_bsssec (abfd)->size))
{
obj_textsec (abfd)->alignment_power = arch_align_power;
obj_datasec (abfd)->alignment_power = arch_align_power;
@@ -124,31 +121,23 @@ MY(callback) (abfd)
/* 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 *));
+/* Finish up the reading of an a.out file header. */
static const bfd_target *
-MY(object_p) (abfd)
- bfd *abfd;
+MY (object_p) (bfd *abfd)
{
- struct external_exec exec_bytes; /* Raw exec header from file */
- struct internal_exec exec; /* Cleaned-up exec header */
+ 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_bread ((void *) &exec_bytes, amt, abfd) != amt)
{
if (bfd_get_error () != bfd_error_system_call)
bfd_set_error (bfd_error_wrong_format);
@@ -159,28 +148,31 @@ MY(object_p) (abfd)
exec.a_info = SWAP_MAGIC (exec_bytes.e_info);
#else
exec.a_info = GET_MAGIC (abfd, exec_bytes.e_info);
-#endif /* SWAP_MAGIC */
+#endif
+
+ if (N_BADMAG (exec))
+ return 0;
- if (N_BADMAG (exec)) return 0;
#ifdef MACHTYPE_OK
- if (!(MACHTYPE_OK (N_MACHTYPE (exec)))) return 0;
+ if (!(MACHTYPE_OK (N_MACHTYPE (exec))))
+ return 0;
#endif
- NAME(aout,swap_exec_header_in) (abfd, &exec_bytes, &exec);
+ 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 */
+ /* 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 */
+#endif
- target = NAME(aout,some_aout_object_p) (abfd, &exec, MY(callback));
+ 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. */
+ 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)
@@ -196,28 +188,18 @@ MY(object_p) (abfd)
return target;
}
-#define MY_object_p MY(object_p)
+#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;
+MY (mkobject) (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;
+ return NAME (aout, mkobject (abfd));
}
-#define MY_mkobject MY(mkobject)
+
+#define MY_mkobject MY (mkobject)
#endif
#ifndef MY_bfd_copy_private_section_data
@@ -228,15 +210,11 @@ MY(mkobject) (abfd)
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;
+MY_bfd_copy_private_section_data (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)
@@ -251,31 +229,26 @@ MY_bfd_copy_private_section_data (ibfd, isec, obfd, osec)
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;
+MY (write_object_contents) (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);
+ WRITE_HEADERS (abfd, execp);
return TRUE;
}
-#define MY_write_object_contents MY(write_object_contents)
+#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;
+MY (set_sizes) (bfd *abfd)
{
adata(abfd).page_size = TARGET_PAGE_SIZE;
adata(abfd).segment_size = SEGMENT_SIZE;
@@ -289,7 +262,7 @@ MY(set_sizes) (abfd)
adata(abfd).exec_bytes_size = EXEC_BYTES_SIZE;
return TRUE;
}
-#define MY_set_sizes MY(set_sizes)
+#define MY_set_sizes MY (set_sizes)
#endif
#ifndef MY_exec_hdr_flags
@@ -329,12 +302,13 @@ MY(set_sizes) (abfd)
#define MY_finish_dynamic_link 0
#endif
-static const struct aout_backend_data MY(backend_data) = {
+static const struct aout_backend_data MY (backend_data) =
+{
MY_zmagic_contiguous,
MY_text_includes_header,
MY_entry_is_text_address,
MY_exec_hdr_flags,
- 0, /* text vma? */
+ 0, /* Text vma? */
MY_set_sizes,
MY_exec_header_not_counted,
MY_add_dynamic_symbols,
@@ -344,22 +318,18 @@ static const struct aout_backend_data MY(backend_data) = {
MY_check_dynamic_reloc,
MY_finish_dynamic_link
};
-#define MY_backend_data &MY(backend_data)
+#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;
+MY_final_link_callback (bfd *abfd,
+ file_ptr *ptreloff,
+ file_ptr *pdreloff,
+ file_ptr *psymoff)
{
struct internal_exec *execp = exec_hdr (abfd);
@@ -375,14 +345,10 @@ MY_final_link_callback (abfd, ptreloff, pdreloff, psymoff)
/* 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;
+MY_bfd_final_link (bfd *abfd, struct bfd_link_info *info)
{
- return NAME(aout,final_link) (abfd, info, MY_final_link_callback);
+ return NAME (aout, final_link) (abfd, info, MY_final_link_callback);
}
#endif
@@ -443,62 +409,65 @@ MY_bfd_final_link (abfd, info)
#endif
#ifndef MY_bfd_debug_info_accumulate
#define MY_bfd_debug_info_accumulate \
- (void (*) PARAMS ((bfd*, struct bfd_section *))) bfd_void
+ (void (*) (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)
+#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)
+#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)
+#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)
+#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)
+#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)
+#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)
+#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)
+#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)
+#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)
+#define MY_canonicalize_reloc NAME (aout, canonicalize_reloc)
#endif
#ifndef MY_make_empty_symbol
-#define MY_make_empty_symbol NAME(aout,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)
+#define MY_print_symbol NAME (aout, print_symbol)
#endif
#ifndef MY_get_symbol_info
-#define MY_get_symbol_info NAME(aout,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)
+#define MY_get_lineno NAME (aout, get_lineno)
#endif
#ifndef MY_set_arch_mach
-#define MY_set_arch_mach NAME(aout,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)
+#define MY_find_nearest_line NAME (aout, find_nearest_line)
+#endif
+#ifndef MY_find_inliner_info
+#define MY_find_inliner_info _bfd_nosymbols_find_inliner_info
#endif
#ifndef MY_sizeof_headers
-#define MY_sizeof_headers NAME(aout,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 \
@@ -513,29 +482,39 @@ MY_bfd_final_link (abfd, info)
#ifndef MY_bfd_merge_sections
#define MY_bfd_merge_sections bfd_generic_merge_sections
#endif
+#ifndef MY_bfd_is_group_section
+#define MY_bfd_is_group_section bfd_generic_is_group_section
+#endif
#ifndef MY_bfd_discard_group
#define MY_bfd_discard_group bfd_generic_discard_group
#endif
+#ifndef MY_section_already_linked
+#define MY_section_already_linked \
+ _bfd_generic_section_already_linked
+#endif
#ifndef MY_bfd_reloc_type_lookup
-#define MY_bfd_reloc_type_lookup NAME(aout,reloc_type_lookup)
+#define MY_bfd_reloc_type_lookup NAME (aout, reloc_type_lookup)
+#endif
+#ifndef MY_bfd_reloc_name_lookup
+#define MY_bfd_reloc_name_lookup NAME (aout, reloc_name_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)
+#define MY_read_minisymbols NAME (aout, read_minisymbols)
#endif
#ifndef MY_minisymbol_to_symbol
-#define MY_minisymbol_to_symbol NAME(aout,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)
+#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)
+#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
@@ -556,6 +535,10 @@ MY_bfd_final_link (abfd, info)
#define MY_bfd_copy_private_symbol_data _bfd_generic_bfd_copy_private_symbol_data
#endif
+#ifndef MY_bfd_copy_private_header_data
+#define MY_bfd_copy_private_header_data _bfd_generic_bfd_copy_private_header_data
+#endif
+
#ifndef MY_bfd_print_private_bfd_data
#define MY_bfd_print_private_bfd_data _bfd_generic_bfd_print_private_bfd_data
#endif
@@ -568,8 +551,12 @@ MY_bfd_final_link (abfd, info)
#define MY_bfd_is_local_label_name bfd_generic_is_local_label_name
#endif
+#ifndef MY_bfd_is_target_special_symbol
+#define MY_bfd_is_target_special_symbol ((bfd_boolean (*) (bfd *, asymbol *)) bfd_false)
+#endif
+
#ifndef MY_bfd_free_cached_info
-#define MY_bfd_free_cached_info NAME(aout,bfd_free_cached_info)
+#define MY_bfd_free_cached_info NAME (aout, bfd_free_cached_info)
#endif
#ifndef MY_close_and_cleanup
@@ -584,6 +571,10 @@ MY_bfd_final_link (abfd, info)
#define MY_canonicalize_dynamic_symtab \
_bfd_nodynamic_canonicalize_dynamic_symtab
#endif
+#ifndef MY_get_synthetic_symtab
+#define MY_get_synthetic_symtab \
+ _bfd_nodynamic_get_synthetic_symtab
+#endif
#ifndef MY_get_dynamic_reloc_upper_bound
#define MY_get_dynamic_reloc_upper_bound \
_bfd_nodynamic_get_dynamic_reloc_upper_bound
@@ -593,55 +584,55 @@ MY_bfd_final_link (abfd, info)
_bfd_nodynamic_canonicalize_dynamic_reloc
#endif
-/* Aout symbols normally have leading underscores */
+/* Aout symbols normally have leading underscores. */
#ifndef MY_symbol_leading_char
#define MY_symbol_leading_char '_'
#endif
-/* Aout archives normally use spaces for padding */
+/* 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) =
+const bfd_target MY (vec) =
{
- TARGETNAME, /* name */
+ 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) */
+ 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) */
+ BFD_ENDIAN_LITTLE, /* Target byte order (little). */
+ BFD_ENDIAN_LITTLE, /* Target headers byte order (little). */
#endif
- (HAS_RELOC | EXEC_P | /* object flags */
+ (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 */
+ 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_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_getb16, bfd_getb_signed_16, bfd_putb16, /* Headers. */
#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_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_getl16, bfd_getl_signed_16, bfd_putl16, /* Headers. */
#endif
- {_bfd_dummy_target, MY_object_p, /* bfd_check_format */
+ {_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_false, MY_mkobject, /* bfd_set_format. */
_bfd_generic_mkarchive, bfd_false},
- {bfd_false, MY_write_object_contents, /* bfd_write_contents */
+ {bfd_false, MY_write_object_contents, /* bfd_write_contents. */
_bfd_write_archive_contents, bfd_false},
BFD_JUMP_TABLE_GENERIC (MY),
@@ -654,9 +645,9 @@ const bfd_target MY(vec) =
BFD_JUMP_TABLE_LINK (MY),
BFD_JUMP_TABLE_DYNAMIC (MY),
- /* Alternative_target */
+ /* Alternative_target. */
NULL,
- (PTR) MY_backend_data
+ MY_backend_data
};
#endif /* MY_BFD_TARGET */
diff --git a/contrib/binutils/bfd/aout0.c b/contrib/binutils/bfd/aout0.c
index 731d476..382fa8e 100644
--- a/contrib/binutils/bfd/aout0.c
+++ b/contrib/binutils/bfd/aout0.c
@@ -17,7 +17,7 @@ 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. */
+Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
#define TARGETNAME "a.out-zero-big"
diff --git a/contrib/binutils/bfd/aout32.c b/contrib/binutils/bfd/aout32.c
index afe7fa2..dca338e 100644
--- a/contrib/binutils/bfd/aout32.c
+++ b/contrib/binutils/bfd/aout32.c
@@ -16,7 +16,7 @@ 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. */
+Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
#define ARCH_SIZE 32
diff --git a/contrib/binutils/bfd/aout64.c b/contrib/binutils/bfd/aout64.c
index 0f31dab..a188823 100644
--- a/contrib/binutils/bfd/aout64.c
+++ b/contrib/binutils/bfd/aout64.c
@@ -16,7 +16,7 @@ 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. */
+Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
#define ARCH_SIZE 64
diff --git a/contrib/binutils/bfd/aoutf1.h b/contrib/binutils/bfd/aoutf1.h
index 352dadf..0353bfd 100644
--- a/contrib/binutils/bfd/aoutf1.h
+++ b/contrib/binutils/bfd/aoutf1.h
@@ -1,31 +1,31 @@
/* A.out "format 1" file handling code for BFD.
Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 2000,
- 2001, 2002, 2003
+ 2001, 2002, 2003, 2004, 2005, 2006, 2007
Free Software Foundation, Inc.
Written by Cygnus Support.
-This file is part of BFD, the Binary File Descriptor library.
+ 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 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.
+ 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. */
+ 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., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
#include "aout/sun4.h"
-#include "libaout.h" /* BFD a.out internal data structures */
+#include "libaout.h" /* BFD a.out internal data structures. */
#include "aout/aout64.h"
#include "aout/stab_gnu.h"
@@ -42,30 +42,24 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
&& 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*/
+/* 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. */
#if ARCH_SIZE == 64
#define sunos_set_arch_mach sunos_64_set_arch_mach
@@ -75,25 +69,6 @@ The name put into the target vector.
#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. */
@@ -101,8 +76,7 @@ static bfd_boolean sunos4_set_sizes
#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;
+sunos_merge_private_bfd_data (bfd *ibfd, bfd *obfd)
{
if (bfd_get_flavour (ibfd) != bfd_target_aout_flavour
|| bfd_get_flavour (obfd) != bfd_target_aout_flavour)
@@ -121,16 +95,14 @@ sunos_merge_private_bfd_data (ibfd, obfd)
depending upon ARCH_SIZE. */
static void
-sunos_set_arch_mach (abfd, machtype)
- bfd *abfd;
- enum machine_type machtype;
+sunos_set_arch_mach (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. */
@@ -171,11 +143,6 @@ sunos_set_arch_mach (abfd, machtype)
machine = 0;
break;
- case M_29K:
- arch = bfd_arch_a29k;
- machine = 0;
- break;
-
case M_HPUX:
arch = bfd_arch_m68k;
machine = 0;
@@ -193,15 +160,14 @@ sunos_set_arch_mach (abfd, machtype)
NAME(sunos,set_arch_mach) (ABFD, N_MACHTYPE (EXEC)); \
choose_reloc_size(ABFD);
-/* Determine the size of a relocation entry, based on the architecture */
+/* Determine the size of a relocation entry, based on the architecture. */
+
static void
-choose_reloc_size (abfd)
- bfd *abfd;
+choose_reloc_size (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:
@@ -217,8 +183,7 @@ choose_reloc_size (abfd)
aout_32_sunos4_write_object_contents, depending upon ARCH_SIZE. */
static bfd_boolean
-sunos_write_object_contents (abfd)
- bfd *abfd;
+sunos_write_object_contents (bfd *abfd)
{
struct external_exec exec_bytes;
struct internal_exec *execp = exec_hdr (abfd);
@@ -258,9 +223,6 @@ sunos_write_object_contents (abfd)
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);
}
@@ -276,9 +238,9 @@ sunos_write_object_contents (abfd)
return TRUE;
}
-/* core files */
+/* Core files. */
-#define CORE_MAGIC 0x080456
+#define CORE_MAGIC 0x080456
#define CORE_NAMELEN 16
/* The core structure is taken from the Sun documentation.
@@ -320,121 +282,112 @@ struct regs
even portably access the stuff in between! */
struct external_sparc_core
- {
- int c_magic; /* Corefile magic number */
- int c_len; /* Sizeof (struct 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.) */
- };
+ struct regs c_regs; /* 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) */
+{
+ 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 regs c_regs; /* 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.) */
- };
+{
+ 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 */
+{
+ 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. */
+};
+
+/* Byte-swap in the Sun-3 core structure. */
+
static void
-swapcore_sun3 (abfd, ext, intcore)
- bfd *abfd;
- char *ext;
- struct internal_sunos_core *intcore;
+swapcore_sun3 (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_pos = offsetof (struct external_sun3_core, c_regs);
intcore->c_regs_size = sizeof (extcore->c_regs);
#if ARCH_SIZE == 64
aout_64_swap_exec_header_in
@@ -448,30 +401,28 @@ swapcore_sun3 (abfd, ext, intcore)
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);
+ intcore->fp_stuff_pos = offsetof (struct external_sun3_core, 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 */
+ offsetof (struct external_sun3_core, 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 */
+ intcore->c_stacktop = 0x0E000000; /* By experimentation. */
}
-/* byte-swap in the Sparc core structure */
+/* Byte-swap in the Sparc core structure. */
+
static void
-swapcore_sparc (abfd, ext, intcore)
- bfd *abfd;
- char *ext;
- struct internal_sunos_core *intcore;
+swapcore_sparc (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_pos = offsetof (struct external_sparc_core, c_regs);
intcore->c_regs_size = sizeof (extcore->c_regs);
#if ARCH_SIZE == 64
aout_64_swap_exec_header_in
@@ -485,11 +436,11 @@ swapcore_sparc (abfd, ext, intcore)
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);
+ intcore->fp_stuff_pos = offsetof (struct external_sparc_core, 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 */
+ offsetof (struct external_sparc_core, 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)
@@ -511,7 +462,7 @@ swapcore_sparc (abfd, ext, intcore)
#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);
+ bfd_vma sp = H_GET_32 (abfd, &extcore->c_regs.r_o6);
if (sp < SPARC_USRSTACK_SPARC10)
intcore->c_stacktop = SPARC_USRSTACK_SPARC10;
else
@@ -519,19 +470,17 @@ swapcore_sparc (abfd, ext, intcore)
}
}
-/* byte-swap in the Solaris BCP core structure */
+/* 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;
+swapcore_solaris_bcp (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_pos = offsetof (struct external_solaris_bcp_core, c_regs);
intcore->c_regs_size = sizeof (extcore->c_regs);
/* The Solaris BCP exdata structure does not contain an a_syms field,
@@ -544,7 +493,7 @@ swapcore_solaris_bcp (abfd, ext, intcore)
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));
+ memset ((void *) &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);
@@ -552,10 +501,10 @@ swapcore_solaris_bcp (abfd, ext, intcore)
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);
+ offsetof (struct external_solaris_bcp_core, 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);
+ offsetof (struct external_solaris_bcp_core, fp_stuff);
/* Ucode is the last thing in the struct -- just before the end */
intcore->c_ucode = H_GET_32 (abfd,
(intcore->c_len
@@ -578,7 +527,7 @@ swapcore_solaris_bcp (abfd, ext, intcore)
#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);
+ bfd_vma sp = H_GET_32 (abfd, &extcore->c_regs.r_o6);
if (sp < SPARC_USRSTACK_SPARC10)
intcore->c_stacktop = SPARC_USRSTACK_SPARC10;
else
@@ -586,17 +535,17 @@ swapcore_solaris_bcp (abfd, ext, intcore)
}
}
-/* 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)
+/* 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 */
+/* These are stored in the bfd's tdata. */
struct sun_core_struct
{
- struct internal_sunos_core *hdr; /* core file header */
+ struct internal_sunos_core *hdr; /* Core file header. */
asection *data_section;
asection *stack_section;
asection *reg_section;
@@ -604,10 +553,9 @@ struct sun_core_struct
};
static const bfd_target *
-sunos4_core_file_p (abfd)
- bfd *abfd;
+sunos4_core_file_p (bfd *abfd)
{
- unsigned char longbuf[4]; /* Raw bytes of various header fields */
+ 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;
@@ -618,41 +566,42 @@ sunos4_core_file_p (abfd)
struct internal_sunos_core internal_sunos_core;
char external_core[1];
} *mergem;
+ flagword flags;
- if (bfd_bread ((PTR) longbuf, (bfd_size_type) sizeof (longbuf), abfd)
+ if (bfd_bread ((void *) longbuf, (bfd_size_type) sizeof (longbuf), abfd)
!= sizeof (longbuf))
- return 0;
+ return NULL;
core_mag = H_GET_32 (abfd, longbuf);
if (core_mag != CORE_MAGIC)
- return 0;
+ return NULL;
/* SunOS core headers can vary in length; second word is size; */
- if (bfd_bread ((PTR) longbuf, (bfd_size_type) sizeof (longbuf), abfd)
+ if (bfd_bread ((void *) longbuf, (bfd_size_type) sizeof (longbuf), abfd)
!= sizeof (longbuf))
- return 0;
+ return NULL;
core_size = H_GET_32 (abfd, longbuf);
- /* Sanity check */
+ /* Sanity check. */
if (core_size > 20000)
- return 0;
+ return NULL;
if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0)
- return 0;
+ return NULL;
amt = core_size + sizeof (struct mergem);
- mergem = (struct mergem *) bfd_zalloc (abfd, amt);
+ mergem = bfd_zalloc (abfd, amt);
if (mergem == NULL)
- return 0;
+ return NULL;
extcore = mergem->external_core;
- if ((bfd_bread ((PTR) extcore, core_size, abfd)) != core_size)
+ if ((bfd_bread ((void *) extcore, core_size, abfd)) != core_size)
{
loser:
bfd_release (abfd, (char *) mergem);
abfd->tdata.any = NULL;
bfd_section_list_clear (abfd);
- return 0;
+ return NULL;
}
/* Validate that it's a core file we know how to handle, due to sun
@@ -671,7 +620,7 @@ sunos4_core_file_p (abfd)
swapcore_solaris_bcp (abfd, extcore, core);
break;
default:
- bfd_set_error (bfd_error_system_call); /* FIXME */
+ bfd_set_error (bfd_error_system_call); /* FIXME. */
goto loser;
}
@@ -679,32 +628,35 @@ sunos4_core_file_p (abfd)
abfd->tdata.sun_core_data->hdr = core;
/* Create the sections. */
- core_stacksec (abfd) = bfd_make_section_anyway (abfd, ".stack");
+ flags = SEC_ALLOC + SEC_LOAD + SEC_HAS_CONTENTS;
+ core_stacksec (abfd) = bfd_make_section_anyway_with_flags (abfd, ".stack",
+ flags);
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");
+ flags = SEC_ALLOC + SEC_LOAD + SEC_HAS_CONTENTS;
+ core_datasec (abfd) = bfd_make_section_anyway_with_flags (abfd, ".data",
+ flags);
if (core_datasec (abfd) == NULL)
goto loser;
- core_regsec (abfd) = bfd_make_section_anyway (abfd, ".reg");
+ flags = SEC_HAS_CONTENTS;
+ core_regsec (abfd) = bfd_make_section_anyway_with_flags (abfd, ".reg",
+ flags);
if (core_regsec (abfd) == NULL)
goto loser;
- core_reg2sec (abfd) = bfd_make_section_anyway (abfd, ".reg2");
+ flags = SEC_HAS_CONTENTS;
+ core_reg2sec (abfd) = bfd_make_section_anyway_with_flags (abfd, ".reg2",
+ flags);
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)->size = core->c_ssize;
+ core_datasec (abfd)->size = core->c_dsize;
+ core_regsec (abfd)->size = core->c_regs_size;
+ core_reg2sec (abfd)->size = core->fp_stuff_size;
core_stacksec (abfd)->vma = (core->c_stacktop - core->c_ssize);
core_datasec (abfd)->vma = core->c_data_addr;
@@ -713,11 +665,11 @@ sunos4_core_file_p (abfd)
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: */
+ /* 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 */
+ /* Align to word at least. */
core_stacksec (abfd)->alignment_power = 2;
core_datasec (abfd)->alignment_power = 2;
core_regsec (abfd)->alignment_power = 2;
@@ -727,23 +679,19 @@ sunos4_core_file_p (abfd)
}
static char *
-sunos4_core_file_failing_command (abfd)
- bfd *abfd;
+sunos4_core_file_failing_command (bfd *abfd)
{
return core_hdr (abfd)->hdr->c_cmdname;
}
static int
-sunos4_core_file_failing_signal (abfd)
- bfd *abfd;
+sunos4_core_file_failing_signal (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;
+sunos4_core_file_matches_executable_p (bfd *core_bfd, bfd *exec_bfd)
{
if (core_bfd->xvec != exec_bfd->xvec)
{
@@ -755,15 +703,15 @@ sunos4_core_file_matches_executable_p (core_bfd, exec_bfd)
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);
+ 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;
+sunos4_set_sizes (bfd *abfd)
{
switch (bfd_get_arch (abfd))
{
@@ -812,13 +760,13 @@ sunos4_set_sizes (abfd)
static const struct aout_backend_data sunos4_aout_backend =
{
- 0, /* zmagic files are not contiguous */
- 1, /* text includes header */
+ 0, /* Zmagic files are not contiguous. */
+ 1, /* Text includes header. */
MY_entry_is_text_address,
MY_exec_hdr_flags,
- 0, /* default text vma */
+ 0, /* Default text vma. */
sunos4_set_sizes,
- 0, /* header is counted in zmagic text */
+ 0, /* Header is counted in zmagic text. */
MY_add_dynamic_symbols,
MY_add_one_symbol,
MY_link_dynamic_object,
@@ -833,11 +781,10 @@ static const struct aout_backend_data sunos4_aout_backend =
#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_bfd_debug_info_accumulate (void (*) (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
+#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
diff --git a/contrib/binutils/bfd/aoutx.h b/contrib/binutils/bfd/aoutx.h
index 3282f87..09331aa 100644
--- a/contrib/binutils/bfd/aoutx.h
+++ b/contrib/binutils/bfd/aoutx.h
@@ -1,6 +1,6 @@
/* BFD semi-generic back-end for a.out binaries.
- Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 2000,
- 2001, 2002, 2003
+ Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
+ 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
Free Software Foundation, Inc.
Written by Cygnus Support.
@@ -18,7 +18,7 @@
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. */
+ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
/*
SECTION
@@ -118,8 +118,8 @@ DESCRIPTION
#define KEEPIT udata.i
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "safe-ctype.h"
#include "bfdlink.h"
@@ -129,21 +129,6 @@ DESCRIPTION
#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
@@ -166,19 +151,19 @@ DESCRIPTION
#endif
#ifndef MY_swap_std_reloc_in
-#define MY_swap_std_reloc_in NAME(aout,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)
+#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)
+#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)
+#define MY_swap_ext_reloc_out NAME (aout, swap_ext_reloc_out)
#endif
#ifndef MY_final_link_relocate
@@ -189,40 +174,40 @@ DESCRIPTION
#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)
+#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),
+ /* 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),
+ 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). */
@@ -276,12 +261,10 @@ EMPTY_HOWTO (-1),
#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;
+NAME (aout, reloc_type_lookup) (bfd *abfd, bfd_reloc_code_real_type code)
{
-#define EXT(i, j) case i: return &howto_table_ext[j]
-#define STD(i, j) case i: return &howto_table_std[j]
+#define EXT(i, j) case i: return & howto_table_ext [j]
+#define STD(i, j) case i: return & howto_table_std [j]
int ext = obj_reloc_entry_size (abfd) == RELOC_EXT_SIZE;
if (code == BFD_RELOC_CTOR)
@@ -314,7 +297,8 @@ NAME(aout,reloc_type_lookup) (abfd,code)
EXT (BFD_RELOC_SPARC_PC22, 18);
EXT (BFD_RELOC_SPARC_WPLT30, 19);
EXT (BFD_RELOC_SPARC_REV32, 26);
- default: return (reloc_howto_type *) NULL;
+ default:
+ return NULL;
}
else
/* std relocs. */
@@ -328,10 +312,36 @@ NAME(aout,reloc_type_lookup) (abfd,code)
STD (BFD_RELOC_32_PCREL, 6);
STD (BFD_RELOC_16_BASEREL, 9);
STD (BFD_RELOC_32_BASEREL, 10);
- default: return (reloc_howto_type *) NULL;
+ default:
+ return NULL;
}
}
+reloc_howto_type *
+NAME (aout, reloc_name_lookup) (bfd *abfd, const char *r_name)
+{
+ unsigned int i, size;
+ reloc_howto_type *howto_table;
+
+ if (obj_reloc_entry_size (abfd) == RELOC_EXT_SIZE)
+ {
+ howto_table = howto_table_ext;
+ size = sizeof (howto_table_ext) / sizeof (howto_table_ext[0]);
+ }
+ else
+ {
+ howto_table = howto_table_std;
+ size = sizeof (howto_table_std) / sizeof (howto_table_std[0]);
+ }
+
+ for (i = 0; i < size; i++)
+ if (howto_table[i].name != NULL
+ && strcasecmp (howto_table[i].name, r_name) == 0)
+ return &howto_table[i];
+
+ return NULL;
+}
+
/*
SUBSECTION
Internal entry points
@@ -340,7 +350,6 @@ 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).
-
*/
/*
@@ -350,7 +359,7 @@ FUNCTION
SYNOPSIS
void aout_@var{size}_swap_exec_header_in,
(bfd *abfd,
- struct external_exec *raw_bytes,
+ struct external_exec *bytes,
struct internal_exec *execp);
DESCRIPTION
@@ -361,18 +370,15 @@ DESCRIPTION
#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;
+NAME (aout, swap_exec_header_in) (bfd *abfd,
+ struct external_exec *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));
+ memset ((void *) 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);
@@ -383,7 +389,7 @@ NAME(aout,swap_exec_header_in) (abfd, raw_bytes, execp)
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)
+#define NAME_swap_exec_header_in NAME (aout, swap_exec_header_in)
#endif
/*
@@ -401,13 +407,10 @@ DESCRIPTION
@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;
+NAME (aout, swap_exec_header_out) (bfd *abfd,
+ struct internal_exec *execp,
+ struct external_exec *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);
@@ -422,17 +425,13 @@ NAME(aout,swap_exec_header_out) (abfd, execp, raw_bytes)
/* Make all the section for an a.out file. */
bfd_boolean
-NAME(aout,make_sections) (abfd)
- bfd *abfd;
+NAME (aout, make_sections) (bfd *abfd)
{
- if (obj_textsec (abfd) == (asection *) NULL
- && bfd_make_section (abfd, ".text") == (asection *) NULL)
+ if (obj_textsec (abfd) == NULL && bfd_make_section (abfd, ".text") == NULL)
return FALSE;
- if (obj_datasec (abfd) == (asection *) NULL
- && bfd_make_section (abfd, ".data") == (asection *) NULL)
+ if (obj_datasec (abfd) == NULL && bfd_make_section (abfd, ".data") == NULL)
return FALSE;
- if (obj_bsssec (abfd) == (asection *) NULL
- && bfd_make_section (abfd, ".bss") == (asection *) NULL)
+ if (obj_bsssec (abfd) == NULL && bfd_make_section (abfd, ".bss") == NULL)
return FALSE;
return TRUE;
}
@@ -444,7 +443,8 @@ FUNCTION
SYNOPSIS
const bfd_target *aout_@var{size}_some_aout_object_p
(bfd *abfd,
- const bfd_target *(*callback_to_real_object_p) ());
+ struct internal_exec *execp,
+ const bfd_target *(*callback_to_real_object_p) (bfd *));
DESCRIPTION
Some a.out variant thinks that the file open in @var{abfd}
@@ -455,18 +455,17 @@ DESCRIPTION
*/
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 *));
+NAME (aout, some_aout_object_p) (bfd *abfd,
+ struct internal_exec *execp,
+ const bfd_target *(*callback_to_real_object_p) (bfd *))
{
struct aout_data_struct *rawptr, *oldrawptr;
const bfd_target *result;
- bfd_size_type amt = sizeof (struct aout_data_struct);
+ bfd_size_type amt = sizeof (* rawptr);
- rawptr = (struct aout_data_struct *) bfd_zalloc (abfd, amt);
+ rawptr = bfd_zalloc (abfd, amt);
if (rawptr == NULL)
- return 0;
+ return NULL;
oldrawptr = abfd->tdata.aout_data;
abfd->tdata.aout_data = rawptr;
@@ -513,15 +512,13 @@ NAME(aout,some_aout_object_p) (abfd, execp, callback_to_real_object_p)
|| N_MAGIC (*execp) == BMAGIC)
adata (abfd).magic = o_magic;
else
- {
- /* Should have been checked with N_BADMAG before this routine
- was called. */
- abort ();
- }
+ /* 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;
+ obj_aout_symbols (abfd) = NULL;
bfd_get_symcount (abfd) = execp->a_syms / sizeof (struct external_nlist);
/* The default relocation entry size is that of traditional V7 Unix. */
@@ -538,11 +535,11 @@ NAME(aout,some_aout_object_p) (abfd, execp, callback_to_real_object_p)
obj_aout_external_strings (abfd) = NULL;
obj_aout_sym_hashes (abfd) = NULL;
- if (! NAME(aout,make_sections) (abfd))
+ 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_datasec (abfd)->size = execp->a_data;
+ obj_bsssec (abfd)->size = execp->a_bss;
obj_textsec (abfd)->flags =
(execp->a_trsize != 0
@@ -568,7 +565,6 @@ NAME(aout,some_aout_object_p) (abfd, execp, callback_to_real_object_p)
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. */
@@ -632,7 +628,7 @@ NAME(aout,some_aout_object_p) (abfd, execp, callback_to_real_object_p)
if (execp->a_entry != 0
|| (execp->a_entry >= obj_textsec (abfd)->vma
&& execp->a_entry < (obj_textsec (abfd)->vma
- + obj_textsec (abfd)->_raw_size)))
+ + obj_textsec (abfd)->size)))
abfd->flags |= EXEC_P;
#ifdef STAT_FOR_EXEC
else
@@ -655,14 +651,7 @@ NAME(aout,some_aout_object_p) (abfd, execp, callback_to_real_object_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;
- }
+ return result;
error_ret:
bfd_release (abfd, rawptr);
@@ -682,24 +671,23 @@ DESCRIPTION
*/
bfd_boolean
-NAME(aout,mkobject) (abfd)
- bfd *abfd;
+NAME (aout, mkobject) (bfd *abfd)
{
struct aout_data_struct *rawptr;
- bfd_size_type amt = sizeof (struct aout_data_struct);
+ bfd_size_type amt = sizeof (* rawptr);
bfd_set_error (bfd_error_system_call);
- rawptr = (struct aout_data_struct *) bfd_zalloc (abfd, amt);
+ rawptr = bfd_zalloc (abfd, amt);
if (rawptr == NULL)
return FALSE;
abfd->tdata.aout_data = rawptr;
exec_hdr (abfd) = &(rawptr->e);
- obj_textsec (abfd) = (asection *) NULL;
- obj_datasec (abfd) = (asection *) NULL;
- obj_bsssec (abfd) = (asection *) NULL;
+ obj_textsec (abfd) = NULL;
+ obj_datasec (abfd) = NULL;
+ obj_bsssec (abfd) = NULL;
return TRUE;
}
@@ -711,7 +699,8 @@ FUNCTION
SYNOPSIS
enum machine_type aout_@var{size}_machine_type
(enum bfd_architecture arch,
- unsigned long machine));
+ unsigned long machine,
+ bfd_boolean *unknown);
DESCRIPTION
Keep track of machine architecture and machine type for
@@ -724,10 +713,9 @@ DESCRIPTION
*/
enum machine_type
-NAME(aout,machine_type) (arch, machine, unknown)
- enum bfd_architecture arch;
- unsigned long machine;
- bfd_boolean *unknown;
+NAME (aout, machine_type) (enum bfd_architecture arch,
+ unsigned long machine,
+ bfd_boolean *unknown)
{
enum machine_type arch_flags;
@@ -741,7 +729,12 @@ NAME(aout,machine_type) (arch, machine, unknown)
|| machine == bfd_mach_sparc
|| machine == bfd_mach_sparc_sparclite
|| machine == bfd_mach_sparc_sparclite_le
- || machine == bfd_mach_sparc_v9)
+ || machine == bfd_mach_sparc_v8plus
+ || machine == bfd_mach_sparc_v8plusa
+ || machine == bfd_mach_sparc_v8plusb
+ || machine == bfd_mach_sparc_v9
+ || machine == bfd_mach_sparc_v9a
+ || machine == bfd_mach_sparc_v9b)
arch_flags = M_SPARC;
else if (machine == bfd_mach_sparc_sparclet)
arch_flags = M_SPARCLET;
@@ -765,11 +758,6 @@ NAME(aout,machine_type) (arch, machine, unknown)
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;
@@ -794,6 +782,7 @@ NAME(aout,machine_type) (arch, machine, unknown)
case bfd_mach_mips4600:
case bfd_mach_mips4650:
case bfd_mach_mips8000:
+ case bfd_mach_mips9000:
case bfd_mach_mips10000:
case bfd_mach_mips12000:
case bfd_mach_mips16:
@@ -831,6 +820,10 @@ NAME(aout,machine_type) (arch, machine, unknown)
arch_flags = M_CRIS;
break;
+ case bfd_arch_m88k:
+ *unknown = FALSE;
+ break;
+
default:
arch_flags = M_UNKNOWN;
}
@@ -849,7 +842,7 @@ SYNOPSIS
bfd_boolean aout_@var{size}_set_arch_mach,
(bfd *,
enum bfd_architecture arch,
- unsigned long machine));
+ unsigned long machine);
DESCRIPTION
Set the architecture and the machine of the BFD @var{abfd} to the
@@ -858,10 +851,9 @@ DESCRIPTION
*/
bfd_boolean
-NAME(aout,set_arch_mach) (abfd, arch, machine)
- bfd *abfd;
- enum bfd_architecture arch;
- unsigned long machine;
+NAME (aout, set_arch_mach) (bfd *abfd,
+ enum bfd_architecture arch,
+ unsigned long machine)
{
if (! bfd_default_set_arch_mach (abfd, arch, machine))
return FALSE;
@@ -870,7 +862,7 @@ NAME(aout,set_arch_mach) (abfd, arch, machine)
{
bfd_boolean unknown;
- NAME(aout,machine_type) (arch, machine, &unknown);
+ NAME (aout, machine_type) (arch, machine, &unknown);
if (unknown)
return FALSE;
}
@@ -879,7 +871,6 @@ NAME(aout,set_arch_mach) (abfd, arch, machine)
switch (arch)
{
case bfd_arch_sparc:
- case bfd_arch_a29k:
case bfd_arch_mips:
obj_reloc_entry_size (abfd) = RELOC_EXT_SIZE;
break;
@@ -892,9 +883,7 @@ NAME(aout,set_arch_mach) (abfd, arch, machine)
}
static void
-adjust_o_magic (abfd, execp)
- bfd *abfd;
- struct internal_exec *execp;
+adjust_o_magic (bfd *abfd, struct internal_exec *execp)
{
file_ptr pos = adata (abfd).exec_bytes_size;
bfd_vma vma = 0;
@@ -907,16 +896,13 @@ adjust_o_magic (abfd, execp)
else
vma = obj_textsec (abfd)->vma;
- pos += obj_textsec (abfd)->_raw_size;
- vma += obj_textsec (abfd)->_raw_size;
+ pos += obj_textsec (abfd)->size;
+ vma += obj_textsec (abfd)->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;
+ obj_textsec (abfd)->size += pad;
pos += pad;
vma += pad;
obj_datasec (abfd)->vma = vma;
@@ -924,16 +910,13 @@ adjust_o_magic (abfd, execp)
else
vma = obj_datasec (abfd)->vma;
obj_datasec (abfd)->filepos = pos;
- pos += obj_datasec (abfd)->_raw_size;
- vma += obj_datasec (abfd)->_raw_size;
+ pos += obj_datasec (abfd)->size;
+ vma += obj_datasec (abfd)->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;
+ obj_datasec (abfd)->size += pad;
pos += pad;
vma += pad;
obj_bsssec (abfd)->vma = vma;
@@ -946,28 +929,27 @@ adjust_o_magic (abfd, execp)
pad = obj_bsssec (abfd)->vma - vma;
if (pad > 0)
{
- obj_datasec (abfd)->_raw_size += pad;
+ obj_datasec (abfd)->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;
+ execp->a_text = obj_textsec (abfd)->size;
+ execp->a_data = obj_datasec (abfd)->size;
+ execp->a_bss = obj_bsssec (abfd)->size;
N_SET_MAGIC (*execp, OMAGIC);
}
static void
-adjust_z_magic (abfd, execp)
- bfd *abfd;
- struct internal_exec *execp;
+adjust_z_magic (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. */
+ /* TRUE if text includes exec header. */
+ bfd_boolean ztih;
abdp = aout_backend_info (abfd);
@@ -1005,7 +987,7 @@ adjust_z_magic (abfd, execp)
/* Find start of data. */
if (ztih)
{
- text_end = obj_textsec (abfd)->filepos + obj_textsec (abfd)->_raw_size;
+ text_end = obj_textsec (abfd)->filepos + obj_textsec (abfd)->size;
text_pad += BFD_ALIGN (text_end, adata (abfd).page_size) - text_end;
}
else
@@ -1013,18 +995,18 @@ adjust_z_magic (abfd, execp)
/* 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_end = obj_textsec (abfd)->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;
+ obj_textsec (abfd)->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;
+ vma = obj_textsec (abfd)->vma + obj_textsec (abfd)->size;
obj_datasec (abfd)->vma = BFD_ALIGN (vma, adata (abfd).segment_size);
}
if (abdp && abdp->zmagic_mapped_contiguous)
@@ -1032,17 +1014,17 @@ adjust_z_magic (abfd, execp)
asection * text = obj_textsec (abfd);
asection * data = obj_datasec (abfd);
- text_pad = data->vma - (text->vma + text->_raw_size);
+ text_pad = data->vma - (text->vma + text->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;
+ text->size += text_pad;
}
obj_datasec (abfd)->filepos = (obj_textsec (abfd)->filepos
- + obj_textsec (abfd)->_raw_size);
+ + obj_textsec (abfd)->size);
/* Fix up exec header while we're at it. */
- execp->a_text = obj_textsec (abfd)->_raw_size;
+ execp->a_text = obj_textsec (abfd)->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)
@@ -1051,17 +1033,17 @@ adjust_z_magic (abfd, execp)
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_datasec (abfd)->size
+ = align_power (obj_datasec (abfd)->size,
obj_bsssec (abfd)->alignment_power);
- execp->a_data = BFD_ALIGN (obj_datasec (abfd)->_raw_size,
+ execp->a_data = BFD_ALIGN (obj_datasec (abfd)->size,
adata (abfd).page_size);
- data_pad = execp->a_data - obj_datasec (abfd)->_raw_size;
+ data_pad = execp->a_data - obj_datasec (abfd)->size;
/* BSS. */
if (!obj_bsssec (abfd)->user_set_vma)
obj_bsssec (abfd)->vma = (obj_datasec (abfd)->vma
- + obj_datasec (abfd)->_raw_size);
+ + obj_datasec (abfd)->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
@@ -1070,17 +1052,15 @@ adjust_z_magic (abfd, execp)
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);
+ == obj_datasec (abfd)->vma + obj_datasec (abfd)->size)
+ execp->a_bss = (data_pad > obj_bsssec (abfd)->size
+ ? 0 : obj_bsssec (abfd)->size - data_pad);
else
- execp->a_bss = obj_bsssec (abfd)->_raw_size;
+ execp->a_bss = obj_bsssec (abfd)->size;
}
static void
-adjust_n_magic (abfd, execp)
- bfd *abfd;
- struct internal_exec *execp;
+adjust_n_magic (bfd *abfd, struct internal_exec *execp)
{
file_ptr pos = adata (abfd).exec_bytes_size;
bfd_vma vma = 0;
@@ -1092,8 +1072,8 @@ adjust_n_magic (abfd, execp)
obj_textsec (abfd)->vma = vma;
else
vma = obj_textsec (abfd)->vma;
- pos += obj_textsec (abfd)->_raw_size;
- vma += obj_textsec (abfd)->_raw_size;
+ pos += obj_textsec (abfd)->size;
+ vma += obj_textsec (abfd)->size;
/* Data. */
obj_datasec (abfd)->filepos = pos;
@@ -1102,10 +1082,10 @@ adjust_n_magic (abfd, execp)
vma = obj_datasec (abfd)->vma;
/* Since BSS follows data immediately, see if it needs alignment. */
- vma += obj_datasec (abfd)->_raw_size;
+ vma += obj_datasec (abfd)->size;
pad = align_power (vma, obj_bsssec (abfd)->alignment_power) - vma;
- obj_datasec (abfd)->_raw_size += pad;
- pos += obj_datasec (abfd)->_raw_size;
+ obj_datasec (abfd)->size += pad;
+ pos += obj_datasec (abfd)->size;
/* BSS. */
if (!obj_bsssec (abfd)->user_set_vma)
@@ -1114,31 +1094,30 @@ adjust_n_magic (abfd, execp)
vma = obj_bsssec (abfd)->vma;
/* Fix up exec header. */
- execp->a_text = obj_textsec (abfd)->_raw_size;
- execp->a_data = obj_datasec (abfd)->_raw_size;
- execp->a_bss = obj_bsssec (abfd)->_raw_size;
+ execp->a_text = obj_textsec (abfd)->size;
+ execp->a_data = obj_datasec (abfd)->size;
+ execp->a_bss = obj_bsssec (abfd)->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;
+NAME (aout, adjust_sizes_and_vmas) (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))
+ 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)->size =
+ align_power (obj_textsec (abfd)->size,
obj_textsec (abfd)->alignment_power);
- *text_size = obj_textsec (abfd)->_raw_size;
+ *text_size = obj_textsec (abfd)->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
@@ -1176,11 +1155,11 @@ NAME(aout,adjust_sizes_and_vmas) (abfd, text_size, text_end)
}
str;
}),
- obj_textsec (abfd)->vma, obj_textsec (abfd)->_raw_size,
+ obj_textsec (abfd)->vma, obj_textsec (abfd)->size,
obj_textsec (abfd)->alignment_power,
- obj_datasec (abfd)->vma, obj_datasec (abfd)->_raw_size,
+ obj_datasec (abfd)->vma, obj_datasec (abfd)->size,
obj_datasec (abfd)->alignment_power,
- obj_bsssec (abfd)->vma, obj_bsssec (abfd)->_raw_size,
+ obj_bsssec (abfd)->vma, obj_bsssec (abfd)->size,
obj_bsssec (abfd)->alignment_power);
#endif
#endif
@@ -1202,11 +1181,11 @@ NAME(aout,adjust_sizes_and_vmas) (abfd, text_size, text_end)
#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)->vma, obj_textsec (abfd)->size,
obj_textsec (abfd)->filepos,
- obj_datasec (abfd)->vma, obj_datasec (abfd)->_raw_size,
+ obj_datasec (abfd)->vma, obj_datasec (abfd)->size,
obj_datasec (abfd)->filepos,
- obj_bsssec (abfd)->vma, obj_bsssec (abfd)->_raw_size);
+ obj_bsssec (abfd)->vma, obj_bsssec (abfd)->size);
#endif
return TRUE;
@@ -1219,16 +1198,14 @@ FUNCTION
SYNOPSIS
bfd_boolean aout_@var{size}_new_section_hook,
(bfd *abfd,
- asection *newsect));
+ 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;
+NAME (aout, new_section_hook) (bfd *abfd, asection *newsect)
{
/* Align to double at least. */
newsect->alignment_power = bfd_get_arch_info (abfd)->section_align_power;
@@ -1239,42 +1216,36 @@ NAME(aout,new_section_hook) (abfd, newsect)
{
obj_textsec (abfd)= newsect;
newsect->target_index = N_TEXT;
- return TRUE;
}
-
- if (obj_datasec (abfd) == NULL && !strcmp (newsect->name, ".data"))
+ else 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"))
+ else 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;
+ return _bfd_generic_new_section_hook (abfd, newsect);
}
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;
+NAME (aout, set_section_contents) (bfd *abfd,
+ sec_ptr section,
+ const void * 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))
+ if (! NAME (aout, adjust_sizes_and_vmas) (abfd, &text_size, &text_end))
return FALSE;
}
@@ -1313,10 +1284,9 @@ NAME(aout,set_section_contents) (abfd, section, location, offset, count)
/* Read the external symbols from an a.out file. */
static bfd_boolean
-aout_get_external_symbols (abfd)
- bfd *abfd;
+aout_get_external_symbols (bfd *abfd)
{
- if (obj_aout_external_syms (abfd) == (struct external_nlist *) NULL)
+ if (obj_aout_external_syms (abfd) == NULL)
{
bfd_size_type count;
struct external_nlist *syms;
@@ -1334,9 +1304,8 @@ aout_get_external_symbols (abfd)
/* We allocate using malloc to make the values easy to free
later on. If we put them on the objalloc it might not be
possible to free them. */
- syms = ((struct external_nlist *)
- bfd_malloc (count * EXTERNAL_NLIST_SIZE));
- if (syms == (struct external_nlist *) NULL && count != 0)
+ syms = bfd_malloc (count * EXTERNAL_NLIST_SIZE);
+ if (syms == NULL && count != 0)
return FALSE;
amt = exec_hdr (abfd)->a_syms;
@@ -1362,7 +1331,7 @@ aout_get_external_symbols (abfd)
/* 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)
+ || bfd_bread ((void *) string_chars, amt, abfd) != amt)
return FALSE;
stringsize = GET_WORD (abfd, string_chars);
@@ -1372,7 +1341,7 @@ aout_get_external_symbols (abfd)
return FALSE;
strings = (char *) obj_aout_string_window (abfd).data;
#else
- strings = (char *) bfd_malloc (stringsize + 1);
+ strings = bfd_malloc (stringsize + 1);
if (strings == NULL)
return FALSE;
@@ -1404,9 +1373,7 @@ aout_get_external_symbols (abfd)
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;
+translate_from_native_sym_flags (bfd *abfd, aout_symbol_type *cache_ptr)
{
flagword visible;
@@ -1505,88 +1472,6 @@ translate_from_native_sym_flags (abfd, cache_ptr)
/* 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:
@@ -1659,10 +1544,9 @@ translate_from_native_sym_flags (abfd, cache_ptr)
/* 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;
+translate_to_native_sym_flags (bfd *abfd,
+ asymbol *cache_ptr,
+ struct external_nlist *sym_pointer)
{
bfd_vma value = cache_ptr->value;
asection *sec;
@@ -1772,11 +1656,11 @@ translate_to_native_sym_flags (abfd, cache_ptr, sym_pointer)
/* Native-level interface to symbols. */
asymbol *
-NAME(aout,make_empty_symbol) (abfd)
- bfd *abfd;
+NAME (aout, make_empty_symbol) (bfd *abfd)
{
bfd_size_type amt = sizeof (aout_symbol_type);
- aout_symbol_type *new = (aout_symbol_type *) bfd_zalloc (abfd, amt);
+
+ aout_symbol_type *new = bfd_zalloc (abfd, amt);
if (!new)
return NULL;
new->symbol.the_bfd = abfd;
@@ -1787,14 +1671,13 @@ NAME(aout,make_empty_symbol) (abfd)
/* 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;
+NAME (aout, translate_symbol_table) (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;
@@ -1839,15 +1722,14 @@ NAME(aout,translate_symbol_table) (abfd, in, ext, count, str, strsize, dynamic)
hold them all plus all the cached symbol entries. */
bfd_boolean
-NAME(aout,slurp_symbol_table) (abfd)
- bfd *abfd;
+NAME (aout, slurp_symbol_table) (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)
+ if (obj_aout_symbols (abfd) != NULL)
return TRUE;
old_external_syms = obj_aout_external_syms (abfd);
@@ -1857,12 +1739,12 @@ NAME(aout,slurp_symbol_table) (abfd)
cached_size = obj_aout_external_sym_count (abfd);
cached_size *= sizeof (aout_symbol_type);
- cached = (aout_symbol_type *) bfd_zmalloc (cached_size);
+ cached = 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)
+ if (! (NAME (aout, translate_symbol_table)
(abfd, cached,
obj_aout_external_syms (abfd),
obj_aout_external_sym_count (abfd),
@@ -1882,8 +1764,8 @@ NAME(aout,slurp_symbol_table) (abfd)
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)
+ if (old_external_syms == NULL
+ && obj_aout_external_syms (abfd) != NULL)
{
#ifdef USE_MMAP
bfd_free_window (&obj_aout_sym_window (abfd));
@@ -1905,20 +1787,14 @@ NAME(aout,slurp_symbol_table) (abfd)
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;
+static inline bfd_size_type
+add_to_stringtab (bfd *abfd,
+ struct bfd_strtab_hash *tab,
+ const char *str,
+ bfd_boolean copy)
{
bfd_boolean hash;
bfd_size_type index;
@@ -1936,11 +1812,9 @@ add_to_stringtab (abfd, tab, str, copy)
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;
- }
+ /* 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;
}
@@ -1949,24 +1823,21 @@ add_to_stringtab (abfd, tab, str, copy)
file. */
static bfd_boolean
-emit_stringtab (abfd, tab)
- register bfd *abfd;
- struct bfd_strtab_hash *tab;
+emit_stringtab (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)
+ if (bfd_bwrite ((void *) buffer, amt, abfd) != amt)
return FALSE;
return _bfd_stringtab_emit (abfd, tab);
}
bfd_boolean
-NAME(aout,write_syms) (abfd)
- bfd *abfd;
+NAME (aout, write_syms) (bfd *abfd)
{
unsigned int count ;
asymbol **generic = bfd_get_outsymbols (abfd);
@@ -2005,7 +1876,7 @@ NAME(aout,write_syms) (abfd)
goto error_return;
amt = EXTERNAL_NLIST_SIZE;
- if (bfd_bwrite ((PTR) &nsp, amt, abfd) != amt)
+ if (bfd_bwrite ((void *) &nsp, amt, abfd) != amt)
goto error_return;
/* NB: `KEEPIT' currently overlays `udata.p', so set this only
@@ -2026,35 +1897,32 @@ error_return:
}
long
-NAME(aout,canonicalize_symtab) (abfd, location)
- bfd *abfd;
- asymbol **location;
+NAME (aout, canonicalize_symtab) (bfd *abfd, asymbol **location)
{
- unsigned int counter = 0;
- aout_symbol_type *symbase;
+ unsigned int counter = 0;
+ aout_symbol_type *symbase;
- if (!NAME(aout,slurp_symbol_table) (abfd))
- return -1;
+ 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);
+ 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 *));
+extern void NAME (aout, swap_std_reloc_out)
+ (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;
+NAME (aout, swap_std_reloc_out) (bfd *abfd,
+ arelent *g,
+ struct reloc_std_external *natptr)
{
int r_index;
asymbol *sym = *(g->sym_ptr_ptr);
@@ -2073,11 +1941,6 @@ NAME(aout,swap_std_reloc_out) (abfd, g, natptr)
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
@@ -2089,7 +1952,10 @@ NAME(aout,swap_std_reloc_out) (abfd, g, natptr)
if (bfd_is_com_section (output_section)
|| bfd_is_abs_section (output_section)
- || bfd_is_und_section (output_section))
+ || bfd_is_und_section (output_section)
+ /* PR gas/3041 a.out relocs against weak symbols
+ must be treated as if they were against externs. */
+ || (sym->flags & BSF_WEAK))
{
if (bfd_abs_section_ptr->symbol == sym)
{
@@ -2142,14 +2008,13 @@ NAME(aout,swap_std_reloc_out) (abfd, g, natptr)
/* 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 *));
+extern void NAME (aout, swap_ext_reloc_out)
+ (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;
+NAME (aout, swap_ext_reloc_out) (bfd *abfd,
+ arelent *g,
+ struct reloc_ext_external *natptr)
{
int r_index;
int r_extern;
@@ -2260,12 +2125,11 @@ NAME(aout,swap_ext_reloc_out) (abfd, g, natptr)
}
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;
+NAME (aout, swap_ext_reloc_in) (bfd *abfd,
+ struct reloc_ext_external *bytes,
+ arelent *cache_ptr,
+ asymbol **symbols,
+ bfd_size_type symcount)
{
unsigned int r_index;
int r_extern;
@@ -2316,12 +2180,11 @@ NAME(aout,swap_ext_reloc_in) (abfd, bytes, cache_ptr, symbols, symcount)
}
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;
+NAME (aout, swap_std_reloc_in) (bfd *abfd,
+ struct reloc_std_external *bytes,
+ arelent *cache_ptr,
+ asymbol **symbols,
+ bfd_size_type symcount)
{
unsigned int r_index;
int r_extern;
@@ -2387,14 +2250,11 @@ NAME(aout,swap_std_reloc_in) (abfd, bytes, cache_ptr, symbols, symcount)
/* 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;
+NAME (aout, slurp_reloc_table) (bfd *abfd, sec_ptr asect, asymbol **symbols)
{
bfd_size_type count;
bfd_size_type reloc_size;
- PTR relocs;
+ void * relocs;
arelent *reloc_cache;
size_t each_size;
unsigned int counter = 0;
@@ -2427,7 +2287,7 @@ NAME(aout,slurp_reloc_table) (abfd, asect, symbols)
count = reloc_size / each_size;
amt = count * sizeof (arelent);
- reloc_cache = (arelent *) bfd_zmalloc (amt);
+ reloc_cache = bfd_zmalloc (amt);
if (reloc_cache == NULL && count != 0)
return FALSE;
@@ -2474,9 +2334,7 @@ NAME(aout,slurp_reloc_table) (abfd, asect, symbols)
/* Write out a relocation section into an object file. */
bfd_boolean
-NAME(aout,squirt_out_relocs) (abfd, section)
- bfd *abfd;
- asection *section;
+NAME (aout, squirt_out_relocs) (bfd *abfd, asection *section)
{
arelent **generic;
unsigned char *native, *natptr;
@@ -2490,7 +2348,7 @@ NAME(aout,squirt_out_relocs) (abfd, section)
each_size = obj_reloc_entry_size (abfd);
natsize = (bfd_size_type) each_size * count;
- native = (unsigned char *) bfd_zalloc (abfd, natsize);
+ native = bfd_zalloc (abfd, natsize);
if (!native)
return FALSE;
@@ -2513,7 +2371,7 @@ NAME(aout,squirt_out_relocs) (abfd, section)
(struct reloc_std_external *) natptr);
}
- if (bfd_bwrite ((PTR) native, natsize, abfd) != natsize)
+ if (bfd_bwrite ((void *) native, natsize, abfd) != natsize)
{
bfd_release (abfd, native);
return FALSE;
@@ -2526,11 +2384,10 @@ NAME(aout,squirt_out_relocs) (abfd, section)
/* 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;
+NAME (aout, canonicalize_reloc) (bfd *abfd,
+ sec_ptr section,
+ arelent **relptr,
+ asymbol **symbols)
{
arelent *tblptr = section->relocation;
unsigned int count;
@@ -2541,7 +2398,7 @@ NAME(aout,canonicalize_reloc) (abfd, section, relptr, symbols)
return 0;
}
- if (!(tblptr || NAME(aout,slurp_reloc_table) (abfd, section, symbols)))
+ if (!(tblptr || NAME (aout, slurp_reloc_table) (abfd, section, symbols)))
return -1;
if (section->flags & SEC_CONSTRUCTOR)
@@ -2568,9 +2425,7 @@ NAME(aout,canonicalize_reloc) (abfd, section, relptr, symbols)
}
long
-NAME(aout,get_reloc_upper_bound) (abfd, asect)
- bfd *abfd;
- sec_ptr asect;
+NAME (aout, get_reloc_upper_bound) (bfd *abfd, sec_ptr asect)
{
if (bfd_get_format (abfd) != bfd_object)
{
@@ -2579,17 +2434,17 @@ NAME(aout,get_reloc_upper_bound) (abfd, asect)
}
if (asect->flags & SEC_CONSTRUCTOR)
- return (sizeof (arelent *) * (asect->reloc_count+1));
+ 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));
+ 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));
+ return sizeof (arelent *)
+ * ((exec_hdr (abfd)->a_trsize / obj_reloc_entry_size (abfd))
+ + 1);
if (asect == obj_bsssec (abfd))
return sizeof (arelent *);
@@ -2602,28 +2457,25 @@ NAME(aout,get_reloc_upper_bound) (abfd, asect)
}
long
-NAME(aout,get_symtab_upper_bound) (abfd)
- bfd *abfd;
+NAME (aout, get_symtab_upper_bound) (bfd *abfd)
{
- if (!NAME(aout,slurp_symbol_table) (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;
+NAME (aout, get_lineno) (bfd *ignore_abfd ATTRIBUTE_UNUSED,
+ asymbol *ignore_symbol ATTRIBUTE_UNUSED)
{
- return (alent *)NULL;
+ return NULL;
}
void
-NAME(aout,get_symbol_info) (ignore_abfd, symbol, ret)
- bfd *ignore_abfd ATTRIBUTE_UNUSED;
- asymbol *symbol;
- symbol_info *ret;
+NAME (aout, get_symbol_info) (bfd *ignore_abfd ATTRIBUTE_UNUSED,
+ asymbol *symbol,
+ symbol_info *ret)
{
bfd_symbol_info (symbol, ret);
@@ -2647,11 +2499,10 @@ NAME(aout,get_symbol_info) (ignore_abfd, symbol, ret)
}
void
-NAME(aout,print_symbol) (abfd, afile, symbol, how)
- bfd *abfd;
- PTR afile;
- asymbol *symbol;
- bfd_print_symbol_type how;
+NAME (aout, print_symbol) (bfd *abfd,
+ void * afile,
+ asymbol *symbol,
+ bfd_print_symbol_type how)
{
FILE *file = (FILE *)afile;
@@ -2671,7 +2522,7 @@ NAME(aout,print_symbol) (abfd, afile, symbol, how)
{
const char *section_name = symbol->section->name;
- bfd_print_symbol_vandf (abfd, (PTR)file, symbol);
+ bfd_print_symbol_vandf (abfd, (void *)file, symbol);
fprintf (file," %-5s %04x %02x %02x",
section_name,
@@ -2695,18 +2546,15 @@ NAME(aout,print_symbol) (abfd, afile, symbol, how)
BFD asymbol structures. */
long
-NAME(aout,read_minisymbols) (abfd, dynamic, minisymsp, sizep)
- bfd *abfd;
- bfd_boolean dynamic;
- PTR *minisymsp;
- unsigned int *sizep;
+NAME (aout, read_minisymbols) (bfd *abfd,
+ bfd_boolean dynamic,
+ void * *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);
- }
+ /* 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;
@@ -2714,7 +2562,7 @@ NAME(aout,read_minisymbols) (abfd, dynamic, minisymsp, sizep)
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);
+ *minisymsp = (void *) obj_aout_external_syms (abfd);
/* By passing the external symbols back from this routine, we are
giving up control over the memory block. Clear
@@ -2731,11 +2579,10 @@ NAME(aout,read_minisymbols) (abfd, dynamic, minisymsp, sizep)
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;
+NAME (aout, minisymbol_to_symbol) (bfd *abfd,
+ bfd_boolean dynamic,
+ const void * minisym,
+ asymbol *sym)
{
if (dynamic
|| obj_aout_external_sym_count (abfd) < MINISYM_THRESHOLD)
@@ -2744,7 +2591,7 @@ NAME(aout,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)
+ if (! (NAME (aout, translate_symbol_table)
(abfd,
(aout_symbol_type *) sym,
(struct external_nlist *) minisym,
@@ -2762,22 +2609,20 @@ NAME(aout,minisymbol_to_symbol) (abfd, dynamic, minisym, sym)
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;
+NAME (aout, find_nearest_line) (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_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;
@@ -2789,7 +2634,7 @@ NAME(aout,find_nearest_line)
*functionname_ptr = 0;
*line_ptr = 0;
- if (symbols != (asymbol **)NULL)
+ if (symbols != NULL)
{
for (p = symbols; *p; p++)
{
@@ -2844,7 +2689,7 @@ NAME(aout,find_nearest_line)
/* Look ahead to next symbol to check if that too is an N_SO. */
p++;
if (*p == NULL)
- break;
+ goto done;
q = (aout_symbol_type *) (*p);
if (q->type != (int)N_SO)
goto next;
@@ -2917,7 +2762,7 @@ NAME(aout,find_nearest_line)
adata (abfd).line_buf = buf = NULL;
else
{
- buf = (char *) bfd_malloc (filelen + funclen + 3);
+ buf = bfd_malloc (filelen + funclen + 3);
adata (abfd).line_buf = buf;
if (buf == NULL)
return FALSE;
@@ -2961,9 +2806,8 @@ NAME(aout,find_nearest_line)
}
int
-NAME(aout,sizeof_headers) (abfd, execable)
- bfd *abfd;
- bfd_boolean execable ATTRIBUTE_UNUSED;
+NAME (aout, sizeof_headers) (bfd *abfd,
+ struct bfd_link_info *info ATTRIBUTE_UNUSED)
{
return adata (abfd).exec_bytes_size;
}
@@ -2972,8 +2816,7 @@ NAME(aout,sizeof_headers) (abfd, execable)
read it again later if we need it. */
bfd_boolean
-NAME(aout,bfd_free_cached_info) (abfd)
- bfd *abfd;
+NAME (aout, bfd_free_cached_info) (bfd *abfd)
{
asection *o;
@@ -2992,7 +2835,7 @@ NAME(aout,bfd_free_cached_info) (abfd)
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)
+ for (o = abfd->sections; o != NULL; o = o->next)
BFCI_FREE (o->relocation);
#undef BFCI_FREE
@@ -3001,34 +2844,21 @@ NAME(aout,bfd_free_cached_info) (abfd)
/* 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;
+NAME (aout, link_hash_newfunc) (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;
+ if (ret == NULL)
+ ret = bfd_hash_allocate (table, sizeof (* ret));
+ if (ret == NULL)
+ return NULL;
/* Call the allocation method of the superclass. */
ret = ((struct aout_link_hash_entry *)
@@ -3047,105 +2877,251 @@ NAME(aout,link_hash_newfunc) (entry, table, string)
/* 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 *));
+NAME (aout, link_hash_table_init) (struct aout_link_hash_table *table,
+ bfd *abfd,
+ struct bfd_hash_entry *(*newfunc)
+ (struct bfd_hash_entry *, struct bfd_hash_table *,
+ const char *),
+ unsigned int entsize)
{
- return _bfd_link_hash_table_init (&table->root, abfd, newfunc);
+ return _bfd_link_hash_table_init (&table->root, abfd, newfunc, entsize);
}
/* Create an a.out link hash table. */
struct bfd_link_hash_table *
-NAME(aout,link_hash_table_create) (abfd)
- bfd *abfd;
+NAME (aout, link_hash_table_create) (bfd *abfd)
{
struct aout_link_hash_table *ret;
- bfd_size_type amt = sizeof (struct aout_link_hash_table);
+ bfd_size_type amt = sizeof (* ret);
- ret = (struct aout_link_hash_table *) bfd_malloc (amt);
+ ret = bfd_malloc (amt);
if (ret == NULL)
- return (struct bfd_link_hash_table *) NULL;
+ return NULL;
- if (! NAME(aout,link_hash_table_init) (ret, abfd,
- NAME(aout,link_hash_newfunc)))
+ if (!NAME (aout, link_hash_table_init) (ret, abfd,
+ NAME (aout, link_hash_newfunc),
+ sizeof (struct aout_link_hash_entry)))
{
free (ret);
- return (struct bfd_link_hash_table *) NULL;
+ return NULL;
}
return &ret->root;
}
-/* Given an a.out BFD, add symbols to the global hash table as
- appropriate. */
+/* Add all symbols from an object file to the hash table. */
-bfd_boolean
-NAME(aout,link_add_symbols) (abfd, info)
- bfd *abfd;
- struct bfd_link_info *info;
+static bfd_boolean
+aout_link_add_symbols (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;
- }
-}
+ bfd_boolean (*add_one_symbol)
+ (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;
+ struct external_nlist *p;
+ struct external_nlist *pend;
+ bfd_size_type amt;
-/* Add symbols from an a.out object file. */
+ 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;
-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_backend_info (abfd)->add_dynamic_symbols != NULL)
{
- if (! aout_link_free_symbols (abfd))
+ if (! ((*aout_backend_info (abfd)->add_dynamic_symbols)
+ (abfd, info, &syms, &sym_count, &strings)))
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))
+ /* 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 = bfd_alloc (abfd, amt);
+ if (sym_hash == NULL && sym_count != 0)
return FALSE;
+ obj_aout_sym_hashes (abfd) = sym_hash;
- if (! aout_link_check_ar_symbols (abfd, info, pneeded))
- return FALSE;
+ add_one_symbol = aout_backend_info (abfd)->add_one_symbol;
+ if (add_one_symbol == NULL)
+ add_one_symbol = _bfd_generic_link_add_one_symbol;
- if (*pneeded)
+ p = syms;
+ pend = p + sym_count;
+ for (; p < pend; p++, sym_hash++)
{
- if (! aout_link_add_symbols (abfd, info))
- return FALSE;
- }
+ int type;
+ const char *name;
+ bfd_vma value;
+ asection *section;
+ flagword flags;
+ const char *string;
- if (! info->keep_memory || ! *pneeded)
- {
- if (! aout_link_free_symbols (abfd))
+ *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. If there is no next symbol, just look away. */
+ if (p + 1 >= pend)
+ return TRUE;
+ ++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;
@@ -3154,26 +3130,42 @@ aout_link_check_archive_element (abfd, info, pneeded)
/* Free up the internal symbols read from an a.out file. */
static bfd_boolean
-aout_link_free_symbols (abfd)
- bfd *abfd;
+aout_link_free_symbols (bfd *abfd)
{
- if (obj_aout_external_syms (abfd) != (struct external_nlist *) NULL)
+ if (obj_aout_external_syms (abfd) != NULL)
{
#ifdef USE_MMAP
bfd_free_window (&obj_aout_sym_window (abfd));
#else
- free ((PTR) obj_aout_external_syms (abfd));
+ free ((void *) obj_aout_external_syms (abfd));
#endif
- obj_aout_external_syms (abfd) = (struct external_nlist *) NULL;
+ obj_aout_external_syms (abfd) = NULL;
}
- if (obj_aout_external_strings (abfd) != (char *) NULL)
+ if (obj_aout_external_strings (abfd) != NULL)
{
#ifdef USE_MMAP
bfd_free_window (&obj_aout_string_window (abfd));
#else
- free ((PTR) obj_aout_external_strings (abfd));
+ free ((void *) obj_aout_external_strings (abfd));
#endif
- obj_aout_external_strings (abfd) = (char *) NULL;
+ obj_aout_external_strings (abfd) = NULL;
+ }
+ return TRUE;
+}
+
+/* Add symbols from an a.out object file. */
+
+static bfd_boolean
+aout_link_add_object_symbols (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;
}
@@ -3186,12 +3178,11 @@ aout_link_free_symbols (abfd)
(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;
+aout_link_check_ar_symbols (bfd *abfd,
+ struct bfd_link_info *info,
+ bfd_boolean *pneeded)
{
- register struct external_nlist *p;
+ struct external_nlist *p;
struct external_nlist *pend;
char *strings;
@@ -3229,7 +3220,7 @@ aout_link_check_ar_symbols (abfd, info, pneeded)
/* We are only interested in symbols that are currently
undefined or common. */
- if (h == (struct bfd_link_hash_entry *) NULL
+ if (h == NULL
|| (h->type != bfd_link_hash_undefined
&& h->type != bfd_link_hash_common))
{
@@ -3304,7 +3295,7 @@ aout_link_check_ar_symbols (abfd, info, pneeded)
unsigned int power;
symbfd = h->u.undef.abfd;
- if (symbfd == (bfd *) NULL)
+ if (symbfd == NULL)
{
/* This symbol was created as undefined from
outside BFD. We assume that we should link
@@ -3320,9 +3311,8 @@ aout_link_check_ar_symbols (abfd, info, pneeded)
/* 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)));
+ 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;
@@ -3371,224 +3361,54 @@ aout_link_check_ar_symbols (abfd, info, pneeded)
/* We do not need this object file. */
return TRUE;
}
-
-/* Add all symbols from an object file to the hash table. */
+/* 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_add_symbols (abfd, info)
- bfd *abfd;
- struct bfd_link_info *info;
+aout_link_check_archive_element (bfd *abfd,
+ struct bfd_link_info *info,
+ bfd_boolean *pneeded)
{
- 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;
+ if (! aout_get_external_symbols (abfd))
+ return FALSE;
- 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_link_check_ar_symbols (abfd, info, pneeded))
+ return FALSE;
- if (aout_backend_info (abfd)->add_dynamic_symbols != NULL)
+ if (*pneeded)
{
- if (! ((*aout_backend_info (abfd)->add_dynamic_symbols)
- (abfd, info, &syms, &sym_count, &strings)))
+ if (! aout_link_add_symbols (abfd, info))
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++)
+ if (! info->keep_memory || ! *pneeded)
{
- 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)))
+ if (! aout_link_free_symbols (abfd))
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;
+ return TRUE;
+}
- /* 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;
- }
+/* Given an a.out BFD, add symbols to the global hash table as
+ appropriate. */
- if (type == (N_INDR | N_EXT) || type == N_WARNING)
- ++sym_hash;
+bfd_boolean
+NAME (aout, link_add_symbols) (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;
}
-
- return TRUE;
}
/* A hash table used for header files with N_BINCL entries. */
@@ -3642,58 +3462,29 @@ struct aout_final_link_info
/* 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;
+ void * 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;
+aout_link_includes_newfunc (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;
+ if (ret == NULL)
+ ret = bfd_hash_allocate (table, sizeof (* ret));
+ if (ret == NULL)
+ return NULL;
/* Call the allocation method of the superclass. */
ret = ((struct aout_link_includes_entry *)
@@ -3707,907 +3498,11 @@ aout_link_includes_newfunc (entry, table, string)
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;
+aout_link_write_other_symbol (struct aout_link_hash_entry *h, void * data)
{
struct aout_final_link_info *finfo = (struct aout_final_link_info *) data;
bfd *output_bfd;
@@ -4705,20 +3600,17 @@ aout_link_write_other_symbol (h, data)
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 ();
- }
+ /* 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 ();
- }
+ || bfd_bwrite ((void *) &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);
@@ -4727,129 +3619,260 @@ aout_link_write_other_symbol (h, data)
return TRUE;
}
-/* Link an a.out section into the output file. */
+/* Handle a link order which is supposed to generate a reloc. */
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;
+aout_link_reloc_link_order (struct aout_final_link_info *finfo,
+ asection *o,
+ struct bfd_link_order *p)
{
- bfd_size_type input_size;
- PTR relocs;
+ 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;
+ void * rel_ptr;
+ bfd_size_type amt;
- /* 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;
+ pr = p->u.reloc.p;
- /* 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;
+ 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
{
- relocs = finfo->relocs;
- if (rel_size > 0)
+ 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 != NULL
+ && h->indx >= 0)
+ r_index = h->indx;
+ else if (h != NULL)
{
- if (bfd_seek (input_bfd, input_section->rel_filepos, SEEK_SET) != 0
- || bfd_bread (relocs, rel_size, input_bfd) != rel_size)
+ /* 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, (void *) finfo))
return FALSE;
+ r_index = h->indx;
+ }
+ else
+ {
+ if (! ((*finfo->info->callbacks->unattached_reloc)
+ (finfo->info, pr->u.name, NULL, NULL, (bfd_vma) 0)))
+ return FALSE;
+ r_index = 0;
}
}
- /* Relocate the section contents. */
- if (obj_reloc_entry_size (input_bfd) == RELOC_STD_SIZE)
+ howto = bfd_reloc_type_lookup (finfo->output_bfd, pr->reloc);
+ if (howto == 0)
{
- if (! aout_link_input_section_std (finfo, input_bfd, input_section,
- (struct reloc_std_external *) relocs,
- rel_size, finfo->contents))
- return FALSE;
+ 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)
{
- if (! aout_link_input_section_ext (finfo, input_bfd, input_section,
- (struct reloc_ext_external *) relocs,
- rel_size, finfo->contents))
- return FALSE;
- }
+#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;
- /* 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;
+ 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;
- /* If we are producing relocatable output, the relocs were
- modified, and we now write them out. */
- if (finfo->info->relocatable && rel_size > 0)
+ 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 = (void *) &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_zmalloc (size);
+ if (buf == 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, NULL,
+ (p->type == bfd_section_reloc_link_order
+ ? bfd_section_name (finfo->output_bfd,
+ pr->u.section)
+ : pr->u.name),
+ howto->name, pr->addend, NULL, NULL, (bfd_vma) 0)))
+ {
+ free (buf);
+ return FALSE;
+ }
+ break;
+ }
+ ok = bfd_set_section_contents (finfo->output_bfd, o, (void *) buf,
+ (file_ptr) p->offset, size);
+ free (buf);
+ if (! ok)
+ return FALSE;
+ }
+ }
+ else
{
- 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;
+#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);
- /* 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)));
+ 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 = (void *) &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;
}
/* Get the section corresponding to a reloc index. */
static INLINE asection *
-aout_reloc_index_to_section (abfd, indx)
- bfd *abfd;
- int indx;
+aout_reloc_index_to_section (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_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 ();
+ 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;
+aout_link_input_section_std (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 *));
+ (struct bfd_link_info *, bfd *, asection *,
+ struct aout_link_hash_entry *, void *, bfd_byte *, bfd_boolean *,
+ bfd_vma *);
bfd *output_bfd;
bfd_boolean relocatable;
struct external_nlist *syms;
@@ -4857,7 +3880,7 @@ aout_link_input_section_std (finfo, input_bfd, input_section, relocs,
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;
struct reloc_std_external *rel_end;
output_bfd = finfo->output_bfd;
@@ -4946,7 +3969,7 @@ aout_link_input_section_std (finfo, input_bfd, input_section, relocs,
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
+ if (h != NULL
&& (h->root.type == bfd_link_hash_defined
|| h->root.type == bfd_link_hash_defweak))
{
@@ -4995,7 +4018,7 @@ aout_link_input_section_std (finfo, input_bfd, input_section, relocs,
h->indx = -2;
h->written = FALSE;
if (! aout_link_write_other_symbol (h,
- (PTR) finfo))
+ (void *) finfo))
return FALSE;
}
r_index = h->indx;
@@ -5079,7 +4102,7 @@ aout_link_input_section_std (finfo, input_bfd, input_section, relocs,
{
h = sym_hashes[r_index];
- if (h != (struct aout_link_hash_entry *) NULL
+ if (h != NULL
&& (h->root.type == bfd_link_hash_defined
|| h->root.type == bfd_link_hash_defweak))
{
@@ -5087,7 +4110,7 @@ aout_link_input_section_std (finfo, input_bfd, input_section, relocs,
+ h->root.u.def.section->output_section->vma
+ h->root.u.def.section->output_offset);
}
- else if (h != (struct aout_link_hash_entry *) NULL
+ else if (h != NULL
&& h->root.type == bfd_link_hash_undefweak)
relocation = 0;
else
@@ -5114,7 +4137,7 @@ aout_link_input_section_std (finfo, input_bfd, input_section, relocs,
if (! ((*check_dynamic_reloc)
(finfo->info, input_bfd, input_section, h,
- (PTR) rel, contents, &skip, &relocation)))
+ (void *) rel, contents, &skip, &relocation)))
return FALSE;
if (skip)
continue;
@@ -5155,7 +4178,7 @@ aout_link_input_section_std (finfo, input_bfd, input_section, relocs,
const char *name;
if (h != NULL)
- name = h->root.root.string;
+ name = NULL;
else if (r_extern)
name = strings + GET_WORD (input_bfd,
syms[r_index].e_strx);
@@ -5167,8 +4190,9 @@ aout_link_input_section_std (finfo, input_bfd, input_section, relocs,
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)))
+ (finfo->info, (h ? &h->root : NULL), name,
+ howto->name, (bfd_vma) 0, input_bfd,
+ input_section, r_addr)))
return FALSE;
}
break;
@@ -5182,19 +4206,17 @@ aout_link_input_section_std (finfo, input_bfd, input_section, relocs,
/* 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;
+aout_link_input_section_ext (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 *));
+ (struct bfd_link_info *, bfd *, asection *,
+ struct aout_link_hash_entry *, void *, bfd_byte *, bfd_boolean *,
+ bfd_vma *);
bfd *output_bfd;
bfd_boolean relocatable;
struct external_nlist *syms;
@@ -5202,7 +4224,7 @@ aout_link_input_section_ext (finfo, input_bfd, input_section, relocs,
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;
struct reloc_ext_external *rel_end;
output_bfd = finfo->output_bfd;
@@ -5275,7 +4297,7 @@ aout_link_input_section_ext (finfo, input_bfd, input_section, relocs,
h = NULL;
else
h = sym_hashes[r_index];
- if (h != (struct aout_link_hash_entry *) NULL
+ if (h != NULL
&& (h->root.type == bfd_link_hash_defined
|| h->root.type == bfd_link_hash_defweak))
{
@@ -5332,7 +4354,7 @@ aout_link_input_section_ext (finfo, input_bfd, input_section, relocs,
h->indx = -2;
h->written = FALSE;
if (! aout_link_write_other_symbol (h,
- (PTR) finfo))
+ (void *) finfo))
return FALSE;
}
r_index = h->indx;
@@ -5422,7 +4444,7 @@ aout_link_input_section_ext (finfo, input_bfd, input_section, relocs,
{
h = sym_hashes[r_index];
- if (h != (struct aout_link_hash_entry *) NULL
+ if (h != NULL
&& (h->root.type == bfd_link_hash_defined
|| h->root.type == bfd_link_hash_defweak))
{
@@ -5430,7 +4452,7 @@ aout_link_input_section_ext (finfo, input_bfd, input_section, relocs,
+ h->root.u.def.section->output_section->vma
+ h->root.u.def.section->output_offset);
}
- else if (h != (struct aout_link_hash_entry *) NULL
+ else if (h != NULL
&& h->root.type == bfd_link_hash_undefweak)
relocation = 0;
else
@@ -5512,7 +4534,7 @@ aout_link_input_section_ext (finfo, input_bfd, input_section, relocs,
if (! ((*check_dynamic_reloc)
(finfo->info, input_bfd, input_section, h,
- (PTR) rel, contents, &skip, &relocation)))
+ (void *) rel, contents, &skip, &relocation)))
return FALSE;
if (skip)
continue;
@@ -5566,7 +4588,7 @@ aout_link_input_section_ext (finfo, input_bfd, input_section, relocs,
const char *name;
if (h != NULL)
- name = h->root.root.string;
+ name = NULL;
else if (r_extern
|| r_type == (unsigned int) RELOC_BASE10
|| r_type == (unsigned int) RELOC_BASE13
@@ -5581,7 +4603,8 @@ aout_link_input_section_ext (finfo, input_bfd, input_section, relocs,
name = bfd_section_name (input_bfd, s);
}
if (! ((*finfo->info->callbacks->reloc_overflow)
- (finfo->info, name, howto_table_ext[r_type].name,
+ (finfo->info, (h ? &h->root : NULL), name,
+ howto_table_ext[r_type].name,
r_addend, input_bfd, input_section, r_addr)))
return FALSE;
}
@@ -5594,228 +4617,968 @@ aout_link_input_section_ext (finfo, input_bfd, input_section, relocs,
return TRUE;
}
-/* Handle a link order which is supposed to generate a reloc. */
+/* Link an a.out section into the output file. */
static bfd_boolean
-aout_link_reloc_link_order (finfo, o, p)
- struct aout_final_link_info *finfo;
- asection *o;
- struct bfd_link_order *p;
+aout_link_input_section (struct aout_final_link_info *finfo,
+ bfd *input_bfd,
+ asection *input_section,
+ file_ptr *reloff_ptr,
+ bfd_size_type rel_size)
{
- 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;
+ bfd_size_type input_size;
+ void * relocs;
- pr = p->u.reloc.p;
+ /* Get the section contents. */
+ input_size = input_section->size;
+ if (! bfd_get_section_contents (input_bfd, input_section,
+ (void *) finfo->contents,
+ (file_ptr) 0, input_size))
+ return FALSE;
- if (p->type == bfd_section_reloc_link_order)
+ /* 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
{
- r_extern = 0;
- if (bfd_is_abs_section (pr->u.section))
- r_index = N_ABS | N_EXT;
- else
+ relocs = finfo->relocs;
+ if (rel_size > 0)
{
- BFD_ASSERT (pr->u.section->owner == finfo->output_bfd);
- r_index = pr->u.section->target_index;
+ 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,
+ (void *) 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;
+}
+
+/* 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 (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;
+ 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;
- 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 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)
{
- /* 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
+ /* 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. */
- h->indx = -2;
- h->written = FALSE;
- if (! aout_link_write_other_symbol (h, (PTR) finfo))
- return FALSE;
- r_index = h->indx;
+ skip_next = FALSE;
+ continue;
}
else
{
- if (! ((*finfo->info->callbacks->unattached_reloc)
- (finfo->info, pr->u.name, (bfd *) NULL,
- (asection *) NULL, (bfd_vma) 0)))
- return FALSE;
- r_index = 0;
+ 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 != 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 != 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 == 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 == 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 != 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 != 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 = 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 != 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;
}
- howto = bfd_reloc_type_lookup (finfo->output_bfd, pr->reloc);
- if (howto == 0)
+ /* Write out the output symbols we have just constructed. */
+ if (outsym > finfo->output_syms)
{
- bfd_set_error (bfd_error_bad_value);
- return FALSE;
+ 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 ((void *) finfo->output_syms, outsym_size, output_bfd)
+ != outsym_size)
+ return FALSE;
+ finfo->symoff += outsym_size;
}
- 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 ();
+ return TRUE;
+}
- if (obj_reloc_entry_size (finfo->output_bfd) == RELOC_STD_SIZE)
+/* Link an a.out input BFD into the output file. */
+
+static bfd_boolean
+aout_link_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)
{
-#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;
+ 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;
+ }
- 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;
+ /* 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;
+ }
- 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;
+ return TRUE;
+}
- /* 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;
+/* 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. */
- 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)
+bfd_boolean
+NAME (aout, final_link) (bfd *abfd,
+ struct bfd_link_info *info,
+ void (*callback) (bfd *, file_ptr *, file_ptr *, file_ptr *))
+{
+ struct aout_final_link_info aout_info;
+ bfd_boolean includes_hash_initialized = FALSE;
+ 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;
+ 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,
+ sizeof (struct aout_link_includes_entry),
+ 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)
{
- 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;
+ 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;
}
- ok = bfd_set_section_contents (finfo->output_bfd, o, (PTR) buf,
- (file_ptr) p->offset, size);
- free (buf);
- if (! ok)
- return FALSE;
+ }
+
+ if (bfd_get_flavour (sub) == bfd_target_aout_flavour)
+ {
+ sz = obj_textsec (sub)->size;
+ if (sz > max_contents_size)
+ max_contents_size = sz;
+ sz = obj_datasec (sub)->size;
+ 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;
}
}
- else
+
+ if (info->relocatable)
{
-#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 (obj_textsec (abfd) != NULL)
+ trsize += (_bfd_count_link_order_relocs (obj_textsec (abfd)
+ ->map_head.link_order)
+ * obj_reloc_entry_size (abfd));
+ if (obj_datasec (abfd) != NULL)
+ drsize += (_bfd_count_link_order_relocs (obj_datasec (abfd)
+ ->map_head.link_order)
+ * obj_reloc_entry_size (abfd));
+ }
- if (bfd_header_big_endian (finfo->output_bfd))
+ 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_malloc (max_contents_size);
+ aout_info.relocs = bfd_malloc (max_relocs_size);
+ aout_info.symbol_map = bfd_malloc (max_sym_count * sizeof (int *));
+ aout_info.output_syms = 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 != 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->map_head.link_order; 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 != NULL; o = o->next)
+ {
+ for (p = o->map_head.link_order;
+ p != NULL;
+ p = p->next)
{
- 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));
+ 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;
+ }
}
- else
+ }
+
+ /* Write out any symbols that we have not already written out. */
+ aout_link_hash_traverse (aout_hash_table (info),
+ aout_link_write_other_symbol,
+ (void *) &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 != NULL; o = o->next)
{
- 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);
+ for (p = o->map_head.link_order;
+ p != 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;
+ }
+ }
}
+ }
- PUT_WORD (finfo->output_bfd, (bfd_vma) pr->addend, erel.r_addend);
-#endif /* MY_put_ext_reloc */
+ 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;
+ }
- rel_ptr = (PTR) &erel;
+ /* 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;
}
- 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;
+ /* 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);
- *reloff_ptr += obj_reloc_entry_size (finfo->output_bfd);
+ /* 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;
- /* 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)));
+ 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;
}
diff --git a/contrib/binutils/bfd/archive.c b/contrib/binutils/bfd/archive.c
index ba6e684..053ad47 100644
--- a/contrib/binutils/bfd/archive.c
+++ b/contrib/binutils/bfd/archive.c
@@ -1,24 +1,24 @@
/* BFD back-end for archive files (libraries).
Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
- 2000, 2001, 2002, 2003
+ 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
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 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 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.
+ 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. */
+ 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., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
/*
@setfilename archive-info
@@ -74,6 +74,8 @@ DESCRIPTION
Archives are supported in BFD in <<archive.c>>.
+SUBSECTION
+ Archive functions
*/
/* Assumes:
@@ -121,27 +123,25 @@ DESCRIPTION
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,
+ "#1/23 " - Long name (or embedded spaces) 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 "bfd.h"
+#include "libiberty.h"
#include "libbfd.h"
#include "aout/ar.h"
#include "aout/ranlib.h"
#include "safe-ctype.h"
+#include "hashtab.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;
@@ -150,8 +150,7 @@ extern int errno;
to the front of the contents! */
struct ar_cache {
file_ptr ptr;
- bfd *arelt;
- struct ar_cache *next;
+ bfd *arbfd;
};
#define ar_padchar(abfd) ((abfd)->xvec->ar_pad_char)
@@ -159,7 +158,22 @@ struct ar_cache {
#define arch_eltdata(bfd) ((struct areltdata *) ((bfd)->arelt_data))
#define arch_hdr(bfd) ((struct ar_hdr *) arch_eltdata(bfd)->arch_header)
-
+
+void
+_bfd_ar_spacepad (char *p, size_t n, const char *fmt, long val)
+{
+ static char buf[20];
+ size_t len;
+ snprintf (buf, sizeof (buf), fmt, val);
+ len = strlen (buf);
+ if (len < n)
+ {
+ memcpy (p, buf, len);
+ memset (p + len, ' ', n - len);
+ }
+ else
+ memcpy (p, buf, n);
+}
bfd_boolean
_bfd_generic_mkarchive (bfd *abfd)
@@ -170,11 +184,13 @@ _bfd_generic_mkarchive (bfd *abfd)
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;
+ /* Already cleared by bfd_zalloc above.
+ 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)->extended_names_size = 0;
+ bfd_ardata (abfd)->tdata = NULL; */
return TRUE;
}
@@ -221,7 +237,7 @@ bfd_get_next_mapent (bfd *abfd, symindex prev, carsym **entry)
return prev;
}
-/* To be called by backends only */
+/* To be called by backends only. */
bfd *
_bfd_create_empty_archive_element_shell (bfd *obfd)
@@ -251,40 +267,62 @@ bfd_set_archive_head (bfd *output_archive, bfd *new_head)
bfd *
_bfd_look_for_bfd_in_cache (bfd *arch_bfd, file_ptr filepos)
{
- struct ar_cache *current;
+ htab_t hash_table = bfd_ardata (arch_bfd)->cache;
+ struct ar_cache m;
+ m.ptr = filepos;
- for (current = bfd_ardata (arch_bfd)->cache; current != NULL;
- current = current->next)
- if (current->ptr == filepos)
- return current->arelt;
+ if (hash_table)
+ {
+ struct ar_cache *entry = (struct ar_cache *) htab_find (hash_table, &m);
+ if (!entry)
+ return NULL;
+ else
+ return entry->arbfd;
+ }
+ else
+ return NULL;
+}
- return NULL;
+static hashval_t
+hash_file_ptr (const PTR p)
+{
+ return (hashval_t) (((struct ar_cache *) p)->ptr);
}
-/* Kind of stupid to call cons for each one, but we don't do too many */
+/* Returns non-zero if P1 and P2 are equal. */
+
+static int
+eq_file_ptr (const PTR p1, const PTR p2)
+{
+ struct ar_cache *arc1 = (struct ar_cache *) p1;
+ struct ar_cache *arc2 = (struct ar_cache *) p2;
+ return arc1->ptr == arc2->ptr;
+}
+
+/* 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 *cache;
+ htab_t hash_table = bfd_ardata (arch_bfd)->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
+ /* If the hash table hasn't been created, create it. */
+ if (hash_table == NULL)
{
- struct ar_cache *current = bfd_ardata (arch_bfd)->cache;
-
- while (current->next != NULL)
- current = current->next;
- current->next = new_cache;
+ hash_table = htab_create_alloc (16, hash_file_ptr, eq_file_ptr,
+ NULL, calloc, free);
+ if (hash_table == NULL)
+ return FALSE;
+ bfd_ardata (arch_bfd)->cache = hash_table;
}
+ /* Insert new_elt into the hash table by filepos. */
+ cache = bfd_zalloc (arch_bfd, sizeof (struct ar_cache));
+ cache->ptr = filepos;
+ cache->arbfd = new_elt;
+ *htab_find_slot (hash_table, (const void *) cache, INSERT) = cache;
+
return TRUE;
}
@@ -301,7 +339,7 @@ get_extended_arelt_filename (bfd *arch, const char *name)
errno = 0;
/* Skip first char, which is '/' in SVR4 or ' ' in some other variants. */
index = strtol (name + 1, NULL, 10);
- if (errno != 0)
+ if (errno != 0 || index >= bfd_ardata (arch)->extended_names_size)
{
bfd_set_error (bfd_error_malformed_archive);
return NULL;
@@ -316,8 +354,7 @@ get_extended_arelt_filename (bfd *arch, const char *name)
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.
-*/
+ could have been moved arbitrarily. */
void *
_bfd_generic_read_ar_hdr (bfd *abfd)
@@ -372,10 +409,7 @@ _bfd_generic_read_ar_hdr_mag (bfd *abfd, const char *mag)
{
filename = get_extended_arelt_filename (abfd, hdr.ar_name);
if (filename == NULL)
- {
- bfd_set_error (bfd_error_malformed_archive);
- return NULL;
- }
+ return NULL;
}
/* BSD4.4-style long filename.
Only implemented for reading, so far! */
@@ -467,6 +501,12 @@ _bfd_get_elt_at_filepos (bfd *archive, file_ptr filepos)
struct areltdata *new_areldata;
bfd *n_nfd;
+ if (archive->my_archive)
+ {
+ filepos += archive->origin;
+ archive = archive->my_archive;
+ }
+
n_nfd = _bfd_look_for_bfd_in_cache (archive, filepos);
if (n_nfd)
return n_nfd;
@@ -549,10 +589,12 @@ bfd_generic_openr_next_archived_file (bfd *archive, bfd *last_file)
else
{
unsigned int size = arelt_size (last_file);
+ filestart = last_file->origin + size;
+ if (archive->my_archive)
+ filestart -= archive->origin;
/* 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;
}
@@ -573,14 +615,9 @@ bfd_generic_archive_p (bfd *abfd)
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);
@@ -593,11 +630,13 @@ bfd_generic_archive_p (bfd *abfd)
}
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;
+ /* Cleared by bfd_zalloc above.
+ 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)->extended_names_size = 0;
+ bfd_ardata (abfd)->tdata = NULL; */
if (!BFD_SEND (abfd, _bfd_slurp_armap, (abfd))
|| !BFD_SEND (abfd, _bfd_slurp_extended_name_table, (abfd)))
@@ -627,21 +666,10 @@ bfd_generic_archive_p (bfd *abfd)
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;
@@ -670,7 +698,7 @@ bfd_generic_archive_p (bfd *abfd)
/* The size of the string count. */
#define BSD_STRING_COUNT_SIZE 4
-/* Returns FALSE on error, TRUE otherwise */
+/* Returns FALSE on error, TRUE otherwise. */
static bfd_boolean
do_slurp_bsd_armap (bfd *abfd)
@@ -776,7 +804,6 @@ do_slurp_coff_armap (bfd *abfd)
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
@@ -791,14 +818,19 @@ do_slurp_coff_armap (bfd *abfd)
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. */
+ if (nsymz > ~ (bfd_size_type) 0 / sizeof (carsym))
+ return FALSE;
+
carsym_size = (nsymz * sizeof (carsym));
ptrsize = (4 * nsymz);
+ if (carsym_size + stringsize + 1 <= carsym_size)
+ return FALSE;
+
ardata->symdefs = bfd_zalloc (abfd, carsym_size + stringsize + 1);
if (ardata->symdefs == NULL)
return FALSE;
@@ -880,12 +912,12 @@ bfd_slurp_armap (bfd *abfd)
if (bfd_seek (abfd, (file_ptr) -16, SEEK_CUR) != 0)
return FALSE;
- if (!strncmp (nextname, "__.SYMDEF ", 16)
- || !strncmp (nextname, "__.SYMDEF/ ", 16)) /* old Linux archives */
+ if (CONST_STRNEQ (nextname, "__.SYMDEF ")
+ || CONST_STRNEQ (nextname, "__.SYMDEF/ ")) /* Old Linux archives. */
return do_slurp_bsd_armap (abfd);
- else if (!strncmp (nextname, "/ ", 16))
+ else if (CONST_STRNEQ (nextname, "/ "))
return do_slurp_coff_armap (abfd);
- else if (!strncmp (nextname, "/SYM64/ ", 16))
+ else if (CONST_STRNEQ (nextname, "/SYM64/ "))
{
/* 64bit ELF (Irix 6) archive. */
#ifdef BFD64
@@ -901,8 +933,8 @@ bfd_slurp_armap (bfd *abfd)
return TRUE;
}
-/* Returns FALSE on error, TRUE otherwise */
-/* flavor 2 of a bsd armap, similar to bfd_slurp_bsd_armap except the
+/* 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. */
@@ -931,11 +963,11 @@ bfd_slurp_bsd_armap_f2 (bfd *abfd)
if (bfd_seek (abfd, (file_ptr) -16, SEEK_CUR) != 0)
return FALSE;
- if (!strncmp (nextname, "__.SYMDEF ", 16)
- || !strncmp (nextname, "__.SYMDEF/ ", 16)) /* old Linux archives */
+ if (CONST_STRNEQ (nextname, "__.SYMDEF ")
+ || CONST_STRNEQ (nextname, "__.SYMDEF/ ")) /* Old Linux archives. */
return do_slurp_bsd_armap (abfd);
- if (strncmp (nextname, "/ ", 16))
+ if (! CONST_STRNEQ (nextname, "/ "))
{
bfd_has_map (abfd) = FALSE;
return TRUE;
@@ -1031,10 +1063,11 @@ _bfd_slurp_extended_name_table (bfd *abfd)
if (bfd_seek (abfd, (file_ptr) -16, SEEK_CUR) != 0)
return FALSE;
- if (strncmp (nextname, "ARFILENAMES/ ", 16) != 0 &&
- strncmp (nextname, "// ", 16) != 0)
+ if (! CONST_STRNEQ (nextname, "ARFILENAMES/ ")
+ && ! CONST_STRNEQ (nextname, "// "))
{
bfd_ardata (abfd)->extended_names = NULL;
+ bfd_ardata (abfd)->extended_names_size = 0;
return TRUE;
}
@@ -1043,7 +1076,11 @@ _bfd_slurp_extended_name_table (bfd *abfd)
return FALSE;
amt = namedata->parsed_size;
- bfd_ardata (abfd)->extended_names = bfd_zalloc (abfd, amt);
+ if (amt + 1 == 0)
+ goto byebye;
+
+ bfd_ardata (abfd)->extended_names_size = amt;
+ bfd_ardata (abfd)->extended_names = bfd_zalloc (abfd, amt + 1);
if (bfd_ardata (abfd)->extended_names == NULL)
{
byebye:
@@ -1066,15 +1103,17 @@ _bfd_slurp_extended_name_table (bfd *abfd)
trailing '/'. DOS/NT created archive often have \ in them
We'll fix all problems here.. */
{
- char *temp = bfd_ardata (abfd)->extended_names;
+ char *ext_names = bfd_ardata (abfd)->extended_names;
+ char *temp = ext_names;
char *limit = temp + namedata->parsed_size;
for (; temp < limit; ++temp)
{
if (*temp == '\012')
- temp[temp[-1] == '/' ? -1 : 0] = '\0';
+ temp[temp > ext_names && temp[-1] == '/' ? -1 : 0] = '\0';
if (*temp == '\\')
*temp = '/';
}
+ *limit = '\0';
}
/* Pad to an even boundary if you have to. */
@@ -1084,9 +1123,6 @@ _bfd_slurp_extended_name_table (bfd *abfd)
/* 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;
}
@@ -1198,7 +1234,9 @@ _bfd_construct_extended_name_table (bfd *abfd,
*tablen = 0;
/* Figure out how long the table should be. */
- for (current = abfd->archive_head; current != NULL; current = current->next)
+ for (current = abfd->archive_head;
+ current != NULL;
+ current = current->archive_next)
{
const char *normal;
unsigned int thislen;
@@ -1250,8 +1288,9 @@ _bfd_construct_extended_name_table (bfd *abfd,
*tablen = total_namelen;
strptr = *tabloc;
- for (current = abfd->archive_head; current != NULL; current =
- current->next)
+ for (current = abfd->archive_head;
+ current != NULL;
+ current = current->archive_next)
{
const char *normal;
unsigned int thislen;
@@ -1276,17 +1315,8 @@ _bfd_construct_extended_name_table (bfd *abfd,
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 = ' ';
- }
+ _bfd_ar_spacepad (hdr->ar_name + 1, maxname - 1, "%-ld",
+ strptr - *tabloc);
strptr += thislen + 1;
if (trailing_slash)
++strptr;
@@ -1296,7 +1326,7 @@ _bfd_construct_extended_name_table (bfd *abfd,
return TRUE;
}
-/** A couple of functions for creating ar_hdrs */
+/* A couple of functions for creating ar_hdrs. */
#ifdef HPUX_LARGE_AR_IDS
/* Function to encode large UID/GID values according to HP. */
@@ -1309,7 +1339,7 @@ hpux_uid_gid_encode (char str[6], long int id)
str[5] = '@' + (id & 3);
id >>= 2;
- for (cnt = 4; cnt >= 0; ++cnt, id >>= 6)
+ for (cnt = 4; cnt >= 0; --cnt, id >>= 6)
str[cnt] = ' ' + (id & 0x3f);
}
#endif /* HPUX_LARGE_AR_IDS */
@@ -1333,7 +1363,6 @@ 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)
@@ -1361,39 +1390,31 @@ bfd_ar_hdr_from_filesystem (bfd *abfd, const char *filename, bfd *member)
/* 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);
+ _bfd_ar_spacepad (hdr->ar_date, sizeof (hdr->ar_date), "%-12ld",
+ 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);
+ hpux_uid_gid_encode (hdr->ar_uid, (long) status.st_uid);
else
#endif
- sprintf ((hdr->ar_uid), "%ld", (long) status.st_uid);
+ _bfd_ar_spacepad (hdr->ar_uid, sizeof (hdr->ar_uid), "%ld",
+ 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);
+ hpux_uid_gid_encode (hdr->ar_gid, (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);
+ _bfd_ar_spacepad (hdr->ar_gid, sizeof (hdr->ar_gid), "%ld",
+ status.st_gid);
+ _bfd_ar_spacepad (hdr->ar_mode, sizeof (hdr->ar_mode), "%-8lo",
+ status.st_mode);
+ _bfd_ar_spacepad (hdr->ar_size, sizeof (hdr->ar_size), "%-10ld",
+ status.st_size);
+ memcpy (hdr->ar_fmag, ARFMAG, 2);
ared->parsed_size = status.st_size;
ared->arch_header = (char *) hdr;
@@ -1614,13 +1635,14 @@ _bfd_write_archive_contents (bfd *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)
+ for (current = arch->archive_head;
+ current != NULL;
+ current = current->archive_next)
{
/* This check is checking the bfds for the objects we're reading
from (which are usually either an object file or archive on
@@ -1630,14 +1652,14 @@ _bfd_write_archive_contents (bfd *arch)
if (bfd_write_p (current))
{
bfd_set_error (bfd_error_invalid_operation);
- return FALSE;
+ goto input_err;
}
if (!current->arelt_data)
{
current->arelt_data =
bfd_ar_hdr_from_filesystem (arch, current->filename, current);
if (!current->arelt_data)
- return FALSE;
+ goto input_err;
/* Put in the file name. */
BFD_SEND (arch, _bfd_truncate_arname,
@@ -1646,11 +1668,7 @@ _bfd_write_archive_contents (bfd *arch)
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
- )
+ if ((bfd_check_format (current, bfd_object)))
hasobjects = TRUE;
}
}
@@ -1661,11 +1679,7 @@ _bfd_write_archive_contents (bfd *arch)
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;
@@ -1679,15 +1693,12 @@ _bfd_write_archive_contents (bfd *arch)
{
struct ar_hdr hdr;
- memset (&hdr, 0, sizeof (struct ar_hdr));
- strcpy (hdr.ar_name, ename);
+ memset (&hdr, ' ', sizeof (struct ar_hdr));
+ memcpy (hdr.ar_name, ename, strlen (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]) = ' ';
+ _bfd_ar_spacepad (hdr.ar_size, sizeof (hdr.ar_size), "%-10ld",
+ (elength + 1) & ~(bfd_size_type) 1);
+ memcpy (hdr.ar_fmag, ARFMAG, 2);
if ((bfd_bwrite (&hdr, sizeof (struct ar_hdr), arch)
!= sizeof (struct ar_hdr))
|| bfd_bwrite (etable, elength, arch) != elength)
@@ -1699,7 +1710,9 @@ _bfd_write_archive_contents (bfd *arch)
}
}
- for (current = arch->archive_head; current; current = current->next)
+ for (current = arch->archive_head;
+ current != NULL;
+ current = current->archive_next)
{
char buffer[DEFAULT_BUFFERSIZE];
unsigned int remaining = arelt_size (current);
@@ -1710,7 +1723,7 @@ _bfd_write_archive_contents (bfd *arch)
!= sizeof (*hdr))
return FALSE;
if (bfd_seek (current, (file_ptr) 0, SEEK_SET) != 0)
- return FALSE;
+ goto input_err;
while (remaining)
{
unsigned int amt = DEFAULT_BUFFERSIZE;
@@ -1720,8 +1733,8 @@ _bfd_write_archive_contents (bfd *arch)
if (bfd_bread (buffer, amt, current) != amt)
{
if (bfd_get_error () != bfd_error_system_call)
- bfd_set_error (bfd_error_malformed_archive);
- return FALSE;
+ bfd_set_error (bfd_error_file_truncated);
+ goto input_err;
}
if (bfd_bwrite (buffer, amt, arch) != amt)
return FALSE;
@@ -1754,6 +1767,10 @@ _bfd_write_archive_contents (bfd *arch)
}
return TRUE;
+
+ input_err:
+ bfd_set_error (bfd_error_on_input, current, bfd_get_error ());
+ return FALSE;
}
/* Note that the namidx for the first symbol is 0. */
@@ -1765,9 +1782,9 @@ _bfd_compute_and_write_armap (bfd *arch, unsigned int elength)
bfd *current;
file_ptr elt_no = 0;
struct orl *map = NULL;
- unsigned int orl_max = 1024; /* fine initial default */
+ unsigned int orl_max = 1024; /* Fine initial default. */
unsigned int orl_count = 0;
- int stridx = 0; /* string index */
+ int stridx = 0;
asymbol **syms = NULL;
long syms_max = 0;
bfd_boolean ret;
@@ -1792,12 +1809,12 @@ _bfd_compute_and_write_armap (bfd *arch, unsigned int elength)
/* 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;
+ arch->archive_head = arch->archive_head->archive_next;
/* Map over each element. */
for (current = arch->archive_head;
current != NULL;
- current = current->next, elt_no++)
+ current = current->archive_next, elt_no++)
{
if (bfd_check_format (current, bfd_object)
&& (bfd_get_file_flags (current) & HAS_SYMS) != 0)
@@ -1916,30 +1933,27 @@ bsd_write_armap (bfd *arch,
unsigned int mapsize = ranlibsize + stringsize + 8;
file_ptr firstreal;
bfd *current = arch->archive_head;
- bfd *last_elt = current; /* last element arch seen */
+ 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);
+ memset (&hdr, ' ', sizeof (struct ar_hdr));
+ memcpy (hdr.ar_name, RANLIBMAG, strlen (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]) = ' ';
+ _bfd_ar_spacepad (hdr.ar_date, sizeof (hdr.ar_date), "%ld",
+ bfd_ardata (arch)->armap_timestamp);
+ _bfd_ar_spacepad (hdr.ar_uid, sizeof (hdr.ar_uid), "%ld", getuid ());
+ _bfd_ar_spacepad (hdr.ar_gid, sizeof (hdr.ar_gid), "%ld", getgid ());
+ _bfd_ar_spacepad (hdr.ar_size, sizeof (hdr.ar_size), "%-10ld", mapsize);
+ memcpy (hdr.ar_fmag, ARFMAG, 2);
if (bfd_bwrite (&hdr, sizeof (struct ar_hdr), arch)
!= sizeof (struct ar_hdr))
return FALSE;
@@ -1957,10 +1971,10 @@ bsd_write_armap (bfd *arch,
{
firstreal += arelt_size (current) + sizeof (struct ar_hdr);
firstreal += firstreal % 2;
- current = current->next;
+ current = current->archive_next;
}
while (current != map[count].u.abfd);
- } /* if new archive element */
+ }
last_elt = current;
H_PUT_32 (arch, map[count].namidx, buf);
@@ -2004,7 +2018,6 @@ _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. */
@@ -2024,11 +2037,9 @@ _bfd_archive_bsd_update_armap_timestamp (bfd *arch)
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] = ' ';
+ memset (hdr.ar_date, ' ', sizeof (hdr.ar_date));
+ _bfd_ar_spacepad (hdr.ar_date, sizeof (hdr.ar_date), "%ld",
+ bfd_ardata (arch)->armap_timestamp);
/* Write it into the file. */
bfd_ardata (arch)->armap_datepos = (SARMAG
@@ -2058,8 +2069,7 @@ _bfd_archive_bsd_update_armap_timestamp (bfd *arch)
symbol name 0
symbol name 1
- symbol name n-1
-*/
+ symbol name n-1 */
bfd_boolean
coff_write_armap (bfd *arch,
@@ -2077,7 +2087,6 @@ coff_write_armap (bfd *arch,
bfd *current = arch->archive_head;
unsigned int count;
struct ar_hdr hdr;
- unsigned int i;
int padit = mapsize & 1;
if (padit)
@@ -2089,22 +2098,19 @@ coff_write_armap (bfd *arch,
+ sizeof (struct ar_hdr)
+ SARMAG);
- memset (&hdr, 0, sizeof (struct ar_hdr));
+ memset (&hdr, ' ', sizeof (struct ar_hdr));
hdr.ar_name[0] = '/';
- sprintf (hdr.ar_size, "%-10d", (int) mapsize);
- sprintf (hdr.ar_date, "%ld", (long) time (NULL));
+ _bfd_ar_spacepad (hdr.ar_size, sizeof (hdr.ar_size), "%-10ld",
+ mapsize);
+ _bfd_ar_spacepad (hdr.ar_date, sizeof (hdr.ar_date), "%ld",
+ 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]) = ' ';
+ _bfd_ar_spacepad (hdr.ar_uid, sizeof (hdr.ar_uid), "%ld", 0);
+ _bfd_ar_spacepad (hdr.ar_gid, sizeof (hdr.ar_gid), "%ld", 0);
+ _bfd_ar_spacepad (hdr.ar_mode, sizeof (hdr.ar_mode), "%-7lo", 0);
+ memcpy (hdr.ar_fmag, ARFMAG, 2);
/* 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;
@@ -2135,7 +2141,7 @@ coff_write_armap (bfd *arch,
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;
+ current = current->archive_next;
}
/* Now write the strings themselves. */
diff --git a/contrib/binutils/bfd/archive64.c b/contrib/binutils/bfd/archive64.c
index 1b9f5f3..5e2bf11 100644
--- a/contrib/binutils/bfd/archive64.c
+++ b/contrib/binutils/bfd/archive64.c
@@ -1,30 +1,30 @@
/* MIPS-specific support for 64-bit ELF
- Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
+ Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2006, 2007
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 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 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.
+ 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. */
+ 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., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
/* This file supports the 64-bit (MIPS) ELF archives. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
#include "aout/ar.h"
@@ -65,10 +65,10 @@ bfd_elf64_archive_slurp_armap (bfd *abfd)
return FALSE;
/* Archives with traditional armaps are still permitted. */
- if (strncmp (nextname, "/ ", 16) == 0)
+ if (CONST_STRNEQ (nextname, "/ "))
return bfd_slurp_armap (abfd);
- if (strncmp (nextname, "/SYM64/ ", 16) != 0)
+ if (! CONST_STRNEQ (nextname, "/SYM64/ "))
{
bfd_has_map (abfd) = FALSE;
return TRUE;
@@ -156,7 +156,6 @@ bfd_elf64_archive_write_armap (bfd *arch,
bfd *current = arch->archive_head;
unsigned int count;
struct ar_hdr hdr;
- unsigned int i;
int padding;
bfd_byte buf[8];
@@ -169,19 +168,17 @@ bfd_elf64_archive_write_armap (bfd *arch,
+ 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));
+ memset (&hdr, ' ', sizeof (struct ar_hdr));
+ memcpy (hdr.ar_name, "/SYM64/", strlen ("/SYM64/"));
+ _bfd_ar_spacepad (hdr.ar_size, sizeof (hdr.ar_size), "%-10ld",
+ mapsize);
+ _bfd_ar_spacepad (hdr.ar_date, sizeof (hdr.ar_date), "%ld",
+ 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]) = ' ';
+ _bfd_ar_spacepad (hdr.ar_uid, sizeof (hdr.ar_uid), "%ld", 0);
+ _bfd_ar_spacepad (hdr.ar_gid, sizeof (hdr.ar_gid), "%ld", 0);
+ _bfd_ar_spacepad (hdr.ar_mode, sizeof (hdr.ar_mode), "%-7lo", 0);
+ memcpy (hdr.ar_fmag, ARFMAG, 2);
/* Write the ar header for this item and the number of symbols */
@@ -218,7 +215,7 @@ bfd_elf64_archive_write_armap (bfd *arch,
+ sizeof (struct ar_hdr));
/* remember about the even alignment */
archive_member_file_ptr += archive_member_file_ptr % 2;
- current = current->next;
+ current = current->archive_next;
}
/* now write the strings themselves */
diff --git a/contrib/binutils/bfd/archures.c b/contrib/binutils/bfd/archures.c
index 58893b0..d14ac38 100644
--- a/contrib/binutils/bfd/archures.c
+++ b/contrib/binutils/bfd/archures.c
@@ -1,6 +1,6 @@
/* BFD library support routines for architectures.
Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
- 2000, 2001, 2002, 2003, 2004, 2005, 2006
+ 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
Free Software Foundation, Inc.
Hacked by John Gilmore and Steve Chamberlain of Cygnus Support.
@@ -20,8 +20,8 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
#include "safe-ctype.h"
@@ -80,11 +80,26 @@ DESCRIPTION
.#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
+.#define bfd_mach_fido 9
+.#define bfd_mach_mcf_isa_a_nodiv 10
+.#define bfd_mach_mcf_isa_a 11
+.#define bfd_mach_mcf_isa_a_mac 12
+.#define bfd_mach_mcf_isa_a_emac 13
+.#define bfd_mach_mcf_isa_aplus 14
+.#define bfd_mach_mcf_isa_aplus_mac 15
+.#define bfd_mach_mcf_isa_aplus_emac 16
+.#define bfd_mach_mcf_isa_b_nousp 17
+.#define bfd_mach_mcf_isa_b_nousp_mac 18
+.#define bfd_mach_mcf_isa_b_nousp_emac 19
+.#define bfd_mach_mcf_isa_b 20
+.#define bfd_mach_mcf_isa_b_mac 21
+.#define bfd_mach_mcf_isa_b_emac 22
+.#define bfd_mach_mcf_isa_b_float 23
+.#define bfd_mach_mcf_isa_b_float_mac 24
+.#define bfd_mach_mcf_isa_b_float_emac 25
+.#define bfd_mach_mcf_isa_c 26
+.#define bfd_mach_mcf_isa_c_mac 27
+.#define bfd_mach_mcf_isa_c_emac 28
. bfd_arch_vax, {* DEC Vax *}
. bfd_arch_i960, {* Intel 960 *}
. {* The order of the following is important.
@@ -106,7 +121,6 @@ DESCRIPTION
.
. 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. *}
@@ -123,6 +137,11 @@ DESCRIPTION
.#define bfd_mach_sparc_v9_p(mach) \
. ((mach) >= bfd_mach_sparc_v8plus && (mach) <= bfd_mach_sparc_v9b \
. && (mach) != bfd_mach_sparc_sparclite_le)
+.{* Nonzero if MACH is a 64 bit sparc architecture. *}
+.#define bfd_mach_sparc_64bit_p(mach) \
+. ((mach) >= bfd_mach_sparc_v9 && (mach) != bfd_mach_sparc_v8plusb)
+. bfd_arch_spu, {* PowerPC SPU *}
+.#define bfd_mach_spu 256
. bfd_arch_mips, {* MIPS Rxxxx *}
.#define bfd_mach_mips3000 3000
.#define bfd_mach_mips3900 3900
@@ -163,7 +182,6 @@ DESCRIPTION
. 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 *}
@@ -226,12 +244,20 @@ DESCRIPTION
.#define bfd_mach_sh 1
.#define bfd_mach_sh2 0x20
.#define bfd_mach_sh_dsp 0x2d
+.#define bfd_mach_sh2a 0x2a
+.#define bfd_mach_sh2a_nofpu 0x2b
+.#define bfd_mach_sh2a_nofpu_or_sh4_nommu_nofpu 0x2a1
+.#define bfd_mach_sh2a_nofpu_or_sh3_nommu 0x2a2
+.#define bfd_mach_sh2a_or_sh4 0x2a3
+.#define bfd_mach_sh2a_or_sh3e 0x2a4
.#define bfd_mach_sh2e 0x2e
.#define bfd_mach_sh3 0x30
+.#define bfd_mach_sh3_nommu 0x31
.#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_sh4_nommu_nofpu 0x42
.#define bfd_mach_sh4a 0x4a
.#define bfd_mach_sh4a_nofpu 0x4b
.#define bfd_mach_sh4al_dsp 0x4d
@@ -254,6 +280,7 @@ DESCRIPTION
.#define bfd_mach_arm_XScale 10
.#define bfd_mach_arm_ep9312 11
.#define bfd_mach_arm_iWMMXt 12
+.#define bfd_mach_arm_iWMMXt2 13
. bfd_arch_ns32k, {* National Semiconductors ns32000 *}
. bfd_arch_w65, {* WDC 65816 *}
. bfd_arch_tic30, {* Texas Instruments TMS320C30 *}
@@ -271,6 +298,9 @@ DESCRIPTION
.#define bfd_mach_arc_6 6
.#define bfd_mach_arc_7 7
.#define bfd_mach_arc_8 8
+. bfd_arch_m32c, {* Renesas M16C/M32C. *}
+.#define bfd_mach_m16c 0x75
+.#define bfd_mach_m32c 0x78
. bfd_arch_m32r, {* Renesas M32R (formerly Mitsubishi M32R/D) *}
.#define bfd_mach_m32r 1 {* For backwards compatibility. *}
.#define bfd_mach_m32rx 'x'
@@ -287,10 +317,14 @@ DESCRIPTION
.#define bfd_mach_frvsimple 2
.#define bfd_mach_fr300 300
.#define bfd_mach_fr400 400
+.#define bfd_mach_fr450 450
.#define bfd_mach_frvtomcat 499 {* fr500 prototype *}
.#define bfd_mach_fr500 500
.#define bfd_mach_fr550 550
. bfd_arch_mcore,
+. bfd_arch_mep,
+.#define bfd_mach_mep 1
+.#define bfd_mach_mep_h1 0x6831
. bfd_arch_ia64, {* HP/Intel ia64 *}
.#define bfd_mach_ia64_elf64 64
.#define bfd_mach_ia64_elf32 32
@@ -300,6 +334,10 @@ DESCRIPTION
. bfd_arch_iq2000, {* Vitesse IQ2000. *}
.#define bfd_mach_iq2000 1
.#define bfd_mach_iq10 2
+. bfd_arch_mt,
+.#define bfd_mach_ms1 1
+.#define bfd_mach_mrisc2 2
+.#define bfd_mach_ms2 3
. bfd_arch_pj,
. bfd_arch_avr, {* Atmel AVR microcontrollers. *}
.#define bfd_mach_avr1 1
@@ -307,10 +345,23 @@ DESCRIPTION
.#define bfd_mach_avr3 3
.#define bfd_mach_avr4 4
.#define bfd_mach_avr5 5
+.#define bfd_mach_avr6 6
+. bfd_arch_bfin, {* ADI Blackfin *}
+.#define bfd_mach_bfin 1
+. bfd_arch_cr16, {* National Semiconductor CompactRISC (ie CR16). *}
+.#define bfd_mach_cr16 1
+. bfd_arch_cr16c, {* National Semiconductor CompactRISC. *}
+.#define bfd_mach_cr16c 1
+. bfd_arch_crx, {* National Semiconductor CRX. *}
+.#define bfd_mach_crx 1
. bfd_arch_cris, {* Axis CRIS *}
+.#define bfd_mach_cris_v0_v10 255
+.#define bfd_mach_cris_v32 32
+.#define bfd_mach_cris_v10_v32 1032
. bfd_arch_s390, {* IBM s390 *}
.#define bfd_mach_s390_31 31
.#define bfd_mach_s390_64 64
+. bfd_arch_score, {* Sunplus score *}
. bfd_arch_openrisc, {* OpenRISC *}
. bfd_arch_mmix, {* Donald Knuth's educational processor. *}
. bfd_arch_xstormy16,
@@ -322,7 +373,8 @@ DESCRIPTION
.#define bfd_mach_msp13 13
.#define bfd_mach_msp14 14
.#define bfd_mach_msp15 15
-.#define bfd_mach_msp16 16
+.#define bfd_mach_msp16 16
+.#define bfd_mach_msp21 21
.#define bfd_mach_msp31 31
.#define bfd_mach_msp32 32
.#define bfd_mach_msp33 33
@@ -330,8 +382,20 @@ DESCRIPTION
.#define bfd_mach_msp42 42
.#define bfd_mach_msp43 43
.#define bfd_mach_msp44 44
+. bfd_arch_xc16x, {* Infineon's XC16X Series. *}
+.#define bfd_mach_xc16x 1
+.#define bfd_mach_xc16xl 2
+.#define bfd_mach_xc16xs 3
. bfd_arch_xtensa, {* Tensilica's Xtensa cores. *}
.#define bfd_mach_xtensa 1
+. bfd_arch_maxq, {* Dallas MAXQ 10/20 *}
+.#define bfd_mach_maxq10 10
+.#define bfd_mach_maxq20 20
+. bfd_arch_z80,
+.#define bfd_mach_z80strict 1 {* No undocumented opcodes. *}
+.#define bfd_mach_z80 3 {* With ixl, ixh, iyl, and iyh. *}
+.#define bfd_mach_z80full 7 {* All undocumented instructions. *}
+.#define bfd_mach_r800 11 {* R800: successor with multiplication. *}
. bfd_arch_last
. };
*/
@@ -370,12 +434,15 @@ DESCRIPTION
.
*/
-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_bfin_arch;
+extern const bfd_arch_info_type bfd_cr16_arch;
+extern const bfd_arch_info_type bfd_cr16c_arch;
extern const bfd_arch_info_type bfd_cris_arch;
+extern const bfd_arch_info_type bfd_crx_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;
@@ -391,17 +458,21 @@ 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_m32c_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_maxq_arch;
extern const bfd_arch_info_type bfd_mcore_arch;
+extern const bfd_arch_info_type bfd_mep_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_mt_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;
@@ -411,8 +482,10 @@ 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_score_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_spu_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;
@@ -423,6 +496,8 @@ 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_xc16x_arch;
+extern const bfd_arch_info_type bfd_z80_arch;
extern const bfd_arch_info_type bfd_z8k_arch;
static const bfd_arch_info_type * const bfd_archures_list[] =
@@ -430,12 +505,15 @@ 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_bfin_arch,
+ &bfd_cr16_arch,
+ &bfd_cr16c_arch,
&bfd_cris_arch,
+ &bfd_crx_arch,
&bfd_d10v_arch,
&bfd_d30v_arch,
&bfd_dlx_arch,
@@ -451,16 +529,20 @@ static const bfd_arch_info_type * const bfd_archures_list[] =
&bfd_ia64_arch,
&bfd_ip2k_arch,
&bfd_iq2000_arch,
+ &bfd_m32c_arch,
&bfd_m32r_arch,
&bfd_m68hc11_arch,
&bfd_m68hc12_arch,
&bfd_m68k_arch,
&bfd_m88k_arch,
+ &bfd_maxq_arch,
&bfd_mcore_arch,
+ &bfd_mep_arch,
&bfd_mips_arch,
&bfd_mmix_arch,
&bfd_mn10200_arch,
&bfd_mn10300_arch,
+ &bfd_mt_arch,
&bfd_msp430_arch,
&bfd_ns32k_arch,
&bfd_openrisc_arch,
@@ -469,8 +551,10 @@ static const bfd_arch_info_type * const bfd_archures_list[] =
&bfd_powerpc_arch,
&bfd_rs6000_arch,
&bfd_s390_arch,
+ &bfd_score_arch,
&bfd_sh_arch,
&bfd_sparc_arch,
+ &bfd_spu_arch,
&bfd_tic30_arch,
&bfd_tic4x_arch,
&bfd_tic54x_arch,
@@ -481,6 +565,8 @@ static const bfd_arch_info_type * const bfd_archures_list[] =
&bfd_we32k_arch,
&bfd_xstormy16_arch,
&bfd_xtensa_arch,
+ &bfd_xc16x_arch,
+ &bfd_z80_arch,
&bfd_z8k_arch,
#endif
0
@@ -953,23 +1039,23 @@ bfd_default_scan (const bfd_arch_info_type *info, const char *string)
break;
case 5200:
arch = bfd_arch_m68k;
- number = bfd_mach_mcf5200;
+ number = bfd_mach_mcf_isa_a_nodiv;
break;
case 5206:
arch = bfd_arch_m68k;
- number = bfd_mach_mcf5206e;
+ number = bfd_mach_mcf_isa_a_mac;
break;
case 5307:
arch = bfd_arch_m68k;
- number = bfd_mach_mcf5307;
+ number = bfd_mach_mcf_isa_a_mac;
break;
case 5407:
arch = bfd_arch_m68k;
- number = bfd_mach_mcf5407;
+ number = bfd_mach_mcf_isa_b_nousp_mac;
break;
case 5282:
arch = bfd_arch_m68k;
- number = bfd_mach_mcf528x;
+ number = bfd_mach_mcf_isa_aplus_emac;
break;
case 32000:
diff --git a/contrib/binutils/bfd/armnetbsd.c b/contrib/binutils/bfd/armnetbsd.c
index d82e98f..602c1e0 100644
--- a/contrib/binutils/bfd/armnetbsd.c
+++ b/contrib/binutils/bfd/armnetbsd.c
@@ -1,5 +1,6 @@
/* BFD back-end for NetBSD/ARM a.out-ish binaries.
- Copyright 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
+ Copyright 1999, 2000, 2001, 2002, 2005
+ Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@@ -15,7 +16,7 @@ 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. */
+Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
#define BYTES_IN_WORD 4
#undef TARGET_IS_BIG_ENDIAN_P
@@ -35,19 +36,4 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
/* 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
index 1a5d1ea..617aa07 100644
--- a/contrib/binutils/bfd/bfd-in.h
+++ b/contrib/binutils/bfd/bfd-in.h
@@ -1,7 +1,8 @@
/* 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.
+ 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
+ Free Software Foundation, Inc.
Contributed by Cygnus Support.
@@ -19,7 +20,7 @@
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. */
+ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
#ifndef __BFD_H_SEEN__
#define __BFD_H_SEEN__
@@ -42,6 +43,30 @@ extern "C" {
#endif
#endif
+/* This is a utility macro to handle the situation where the code
+ wants to place a constant string into the code, followed by a
+ comma and then the length of the string. Doing this by hand
+ is error prone, so using this macro is safer. The macro will
+ also safely handle the case where a NULL is passed as the arg. */
+#define STRING_COMMA_LEN(STR) (STR), ((STR) ? sizeof (STR) - 1 : 0)
+/* Unfortunately it is not possible to use the STRING_COMMA_LEN macro
+ to create the arguments to another macro, since the preprocessor
+ will mis-count the number of arguments to the outer macro (by not
+ evaluating STRING_COMMA_LEN and so missing the comma). This is a
+ problem for example when trying to use STRING_COMMA_LEN to build
+ the arguments to the strncmp() macro. Hence this alternative
+ definition of strncmp is provided here.
+
+ Note - these macros do NOT work if STR2 is not a constant string. */
+#define CONST_STRNEQ(STR1,STR2) (strncmp ((STR1), (STR2), sizeof (STR2) - 1) == 0)
+ /* strcpy() can have a similar problem, but since we know we are
+ copying a constant string, we can use memcpy which will be faster
+ since there is no need to check for a NUL byte inside STR. We
+ can also save time if we do not need to copy the terminating NUL. */
+#define LITMEMCPY(DEST,STR2) memcpy ((DEST), (STR2), sizeof (STR2) - 1)
+#define LITSTRCPY(DEST,STR2) memcpy ((DEST), (STR2), sizeof (STR2))
+
+
/* 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. */
@@ -89,14 +114,6 @@ typedef int bfd_boolean;
#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
@@ -144,6 +161,9 @@ typedef unsigned long bfd_size_type;
#endif /* not BFD64 */
+#define HALF_BFD_SIZE_TYPE \
+ (((bfd_size_type) 1) << (8 * sizeof (bfd_size_type) / 2))
+
#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
@@ -238,6 +258,10 @@ bfd_format;
/* The sections in this BFD specify a memory page. */
#define HAS_LOAD_PAGE 0x1000
+
+/* This BFD has been created by the linker and doesn't correspond
+ to any input file. */
+#define BFD_LINKER_CREATED 0x2000
/* Symbols and relocation. */
@@ -308,7 +332,8 @@ typedef struct bfd_section *sec_ptr;
#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_size(bfd, ptr) ((ptr)->size)
+#define bfd_get_section_size(ptr) ((ptr)->size)
#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)
@@ -320,8 +345,20 @@ typedef struct bfd_section *sec_ptr;
#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;
+/* Find the address one past the end of SEC. */
+#define bfd_get_section_limit(bfd, sec) \
+ (((sec)->rawsize ? (sec)->rawsize : (sec)->size) \
+ / bfd_octets_per_byte (bfd))
+
+/* 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)
+
+/* Forward define. */
+struct stat;
typedef enum bfd_print_symbol
{
@@ -369,8 +406,6 @@ 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,
@@ -383,6 +418,14 @@ struct bfd_hash_table
/* 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;
+ /* The number of slots in the hash table. */
+ unsigned int size;
+ /* The number of entries in the hash table. */
+ unsigned int count;
+ /* The size of elements. */
+ unsigned int entsize;
+ /* If non-zero, don't grow the hash table. */
+ unsigned int frozen:1;
};
/* Initialize a hash table. */
@@ -390,7 +433,8 @@ 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 *));
+ const char *),
+ unsigned int);
/* Initialize a hash table specifying a size. */
extern bfd_boolean bfd_hash_table_init_n
@@ -398,7 +442,7 @@ extern bfd_boolean bfd_hash_table_init_n
struct bfd_hash_entry *(*) (struct bfd_hash_entry *,
struct bfd_hash_table *,
const char *),
- unsigned int size);
+ unsigned int, unsigned int);
/* Free up a hash table. */
extern void bfd_hash_table_free
@@ -433,6 +477,24 @@ extern void bfd_hash_traverse
bfd_boolean (*) (struct bfd_hash_entry *, void *),
void *info);
+/* Allows the default size of a hash table to be configured. New hash
+ tables allocated using bfd_hash_table_init will be created with
+ this size. */
+extern void bfd_hash_set_default_size (bfd_size_type);
+
+/* 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 bfd_hash_table includes;
+ /* The first .stabstr section. */
+ struct bfd_section *stabstr;
+};
+
#define COFF_SWAP_TABLE (void *) &bfd_coff_std_swap_table
/* User program access to BFD facilities. */
@@ -505,6 +567,8 @@ extern bfd_boolean bfd_cache_close
(bfd *abfd);
/* NB: This declaration should match the autogenerated one in libbfd.h. */
+extern bfd_boolean bfd_cache_close_all (void);
+
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 **);
@@ -534,6 +598,9 @@ void bfd_putl16 (bfd_vma, void *);
bfd_uint64_t bfd_get_bits (const void *, int, bfd_boolean);
void bfd_put_bits (bfd_uint64_t, void *, int, bfd_boolean);
+
+extern bfd_boolean bfd_section_already_linked_table_init (void);
+extern void bfd_section_already_linked_table_free (void);
/* Externally visible ECOFF routines. */
@@ -587,8 +654,6 @@ 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. */
@@ -602,28 +667,44 @@ struct bfd_link_needed_list
enum dynamic_lib_link_class {
DYN_NORMAL = 0,
DYN_AS_NEEDED = 1,
- DYN_DT_NEEDED = 2
+ DYN_DT_NEEDED = 2,
+ DYN_NO_ADD_NEEDED = 4,
+ DYN_NO_NEEDED = 8
+};
+
+enum notice_asneeded_action {
+ notice_as_needed,
+ notice_not_needed,
+ notice_needed
};
extern bfd_boolean bfd_elf_record_link_assignment
- (bfd *, struct bfd_link_info *, const char *, bfd_boolean);
+ (bfd *, struct bfd_link_info *, const char *, bfd_boolean,
+ 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 *);
+ struct bfd_link_info *, struct bfd_section **,
+ struct bfd_elf_version_tree *);
+extern bfd_boolean bfd_elf_size_dynsym_hash_dynstr
+ (bfd *, struct bfd_link_info *);
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);
+ (bfd *, enum dynamic_lib_link_class);
+extern int bfd_elf_get_dyn_lib_class
+ (bfd *);
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 *);
+extern unsigned int _bfd_elf_default_action_discarded
+ (struct bfd_section *);
/* 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
@@ -655,7 +736,7 @@ extern int bfd_get_elf_phdrs
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));
+ int (*target_read_memory) (bfd_vma vma, bfd_byte *myaddr, int len));
/* Return the arch_size field of an elf bfd, or -1 if not elf. */
extern int bfd_get_arch_size
@@ -668,10 +749,20 @@ extern int bfd_get_sign_extend_vma
extern struct bfd_section *_bfd_elf_tls_setup
(bfd *, struct bfd_link_info *);
+extern void _bfd_fix_excluded_sec_syms
+ (bfd *, struct bfd_link_info *);
+
+extern unsigned bfd_m68k_mach_to_features (int);
+
+extern int bfd_m68k_features_to_mach (unsigned);
+
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 **);
+ (bfd *, struct bfd_link_info *, struct bfd_section *, struct bfd_section *,
+ char **);
+
+extern bfd_boolean bfd_bfin_elf32_create_embedded_relocs
+ (bfd *, struct bfd_link_info *, struct bfd_section *, struct bfd_section *,
+ char **);
/* SunOS shared library support routines for the linker. */
@@ -680,7 +771,8 @@ extern struct bfd_link_needed_list *bfd_sunos_get_needed_list
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 **);
+ (bfd *, struct bfd_link_info *, struct bfd_section **,
+ struct bfd_section **, struct bfd_section **);
/* Linux shared library support routines for the linker. */
@@ -761,6 +853,27 @@ extern bfd_boolean bfd_coff_set_symbol_class
extern bfd_boolean bfd_m68k_coff_create_embedded_relocs
(bfd *, struct bfd_link_info *, struct bfd_section *, struct bfd_section *, char **);
+/* ARM VFP11 erratum workaround support. */
+typedef enum
+{
+ BFD_ARM_VFP11_FIX_DEFAULT,
+ BFD_ARM_VFP11_FIX_NONE,
+ BFD_ARM_VFP11_FIX_SCALAR,
+ BFD_ARM_VFP11_FIX_VECTOR
+} bfd_arm_vfp11_fix;
+
+extern void bfd_elf32_arm_init_maps
+ (bfd *);
+
+extern void bfd_elf32_arm_set_vfp11_fix
+ (bfd *, struct bfd_link_info *);
+
+extern bfd_boolean bfd_elf32_arm_vfp11_erratum_scan
+ (bfd *, struct bfd_link_info *);
+
+extern void bfd_elf32_arm_vfp11_fix_veneer_locations
+ (bfd *, struct bfd_link_info *);
+
/* ARM Interworking support. Called from linker. */
extern bfd_boolean bfd_arm_allocate_interworking_sections
(struct bfd_link_info *);
@@ -786,7 +899,11 @@ 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);
+ (bfd *, struct bfd_link_info *);
+
+void bfd_elf32_arm_set_target_relocs
+ (bfd *, struct bfd_link_info *, int, char *, int, int, bfd_arm_vfp11_fix,
+ int, int);
extern bfd_boolean bfd_elf32_arm_get_bfd_for_interworking
(bfd *, struct bfd_link_info *);
@@ -794,6 +911,16 @@ extern bfd_boolean bfd_elf32_arm_get_bfd_for_interworking
extern bfd_boolean bfd_elf32_arm_add_glue_sections_to_bfd
(bfd *, struct bfd_link_info *);
+/* ELF ARM mapping symbol support */
+#define BFD_ARM_SPECIAL_SYM_TYPE_MAP (1 << 0)
+#define BFD_ARM_SPECIAL_SYM_TYPE_TAG (1 << 1)
+#define BFD_ARM_SPECIAL_SYM_TYPE_OTHER (1 << 2)
+#define BFD_ARM_SPECIAL_SYM_TYPE_ANY (~0)
+extern bfd_boolean bfd_is_arm_special_symbol_name
+ (const char * name, int type);
+
+extern void bfd_elf32_arm_set_byteswap_code (struct bfd_link_info *, int);
+
/* ARM Note section processing. */
extern bfd_boolean bfd_arm_merge_machines
(bfd *, bfd *);
@@ -822,3 +949,23 @@ extern void bfd_elf32_ia64_after_parse
extern void bfd_elf64_ia64_after_parse
(int);
+/* 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 coff_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;
+};
+
+extern struct coff_comdat_info *bfd_coff_get_comdat_section
+ (bfd *, struct bfd_section *);
+
diff --git a/contrib/binutils/bfd/bfd-in2.h b/contrib/binutils/bfd/bfd-in2.h
index 91447a1..8ea1cdd 100644
--- a/contrib/binutils/bfd/bfd-in2.h
+++ b/contrib/binutils/bfd/bfd-in2.h
@@ -8,7 +8,7 @@
/* 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, 2005, 2006
+ 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
Free Software Foundation, Inc.
Contributed by Cygnus Support.
@@ -50,6 +50,30 @@ extern "C" {
#endif
#endif
+/* This is a utility macro to handle the situation where the code
+ wants to place a constant string into the code, followed by a
+ comma and then the length of the string. Doing this by hand
+ is error prone, so using this macro is safer. The macro will
+ also safely handle the case where a NULL is passed as the arg. */
+#define STRING_COMMA_LEN(STR) (STR), ((STR) ? sizeof (STR) - 1 : 0)
+/* Unfortunately it is not possible to use the STRING_COMMA_LEN macro
+ to create the arguments to another macro, since the preprocessor
+ will mis-count the number of arguments to the outer macro (by not
+ evaluating STRING_COMMA_LEN and so missing the comma). This is a
+ problem for example when trying to use STRING_COMMA_LEN to build
+ the arguments to the strncmp() macro. Hence this alternative
+ definition of strncmp is provided here.
+
+ Note - these macros do NOT work if STR2 is not a constant string. */
+#define CONST_STRNEQ(STR1,STR2) (strncmp ((STR1), (STR2), sizeof (STR2) - 1) == 0)
+ /* strcpy() can have a similar problem, but since we know we are
+ copying a constant string, we can use memcpy which will be faster
+ since there is no need to check for a NUL byte inside STR. We
+ can also save time if we do not need to copy the terminating NUL. */
+#define LITMEMCPY(DEST,STR2) memcpy ((DEST), (STR2), sizeof (STR2) - 1)
+#define LITSTRCPY(DEST,STR2) memcpy ((DEST), (STR2), sizeof (STR2))
+
+
/* 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. */
@@ -97,14 +121,6 @@ typedef int bfd_boolean;
#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
@@ -152,6 +168,9 @@ typedef unsigned long bfd_size_type;
#endif /* not BFD64 */
+#define HALF_BFD_SIZE_TYPE \
+ (((bfd_size_type) 1) << (8 * sizeof (bfd_size_type) / 2))
+
#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
@@ -246,6 +265,10 @@ bfd_format;
/* The sections in this BFD specify a memory page. */
#define HAS_LOAD_PAGE 0x1000
+
+/* This BFD has been created by the linker and doesn't correspond
+ to any input file. */
+#define BFD_LINKER_CREATED 0x2000
/* Symbols and relocation. */
@@ -316,7 +339,8 @@ typedef struct bfd_section *sec_ptr;
#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_size(bfd, ptr) ((ptr)->size)
+#define bfd_get_section_size(ptr) ((ptr)->size)
#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)
@@ -328,8 +352,20 @@ typedef struct bfd_section *sec_ptr;
#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;
+/* Find the address one past the end of SEC. */
+#define bfd_get_section_limit(bfd, sec) \
+ (((sec)->rawsize ? (sec)->rawsize : (sec)->size) \
+ / bfd_octets_per_byte (bfd))
+
+/* 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)
+
+/* Forward define. */
+struct stat;
typedef enum bfd_print_symbol
{
@@ -377,8 +413,6 @@ 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,
@@ -391,6 +425,14 @@ struct bfd_hash_table
/* 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;
+ /* The number of slots in the hash table. */
+ unsigned int size;
+ /* The number of entries in the hash table. */
+ unsigned int count;
+ /* The size of elements. */
+ unsigned int entsize;
+ /* If non-zero, don't grow the hash table. */
+ unsigned int frozen:1;
};
/* Initialize a hash table. */
@@ -398,7 +440,8 @@ 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 *));
+ const char *),
+ unsigned int);
/* Initialize a hash table specifying a size. */
extern bfd_boolean bfd_hash_table_init_n
@@ -406,7 +449,7 @@ extern bfd_boolean bfd_hash_table_init_n
struct bfd_hash_entry *(*) (struct bfd_hash_entry *,
struct bfd_hash_table *,
const char *),
- unsigned int size);
+ unsigned int, unsigned int);
/* Free up a hash table. */
extern void bfd_hash_table_free
@@ -441,6 +484,24 @@ extern void bfd_hash_traverse
bfd_boolean (*) (struct bfd_hash_entry *, void *),
void *info);
+/* Allows the default size of a hash table to be configured. New hash
+ tables allocated using bfd_hash_table_init will be created with
+ this size. */
+extern void bfd_hash_set_default_size (bfd_size_type);
+
+/* 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 bfd_hash_table includes;
+ /* The first .stabstr section. */
+ struct bfd_section *stabstr;
+};
+
#define COFF_SWAP_TABLE (void *) &bfd_coff_std_swap_table
/* User program access to BFD facilities. */
@@ -513,6 +574,8 @@ extern bfd_boolean bfd_cache_close
(bfd *abfd);
/* NB: This declaration should match the autogenerated one in libbfd.h. */
+extern bfd_boolean bfd_cache_close_all (void);
+
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 **);
@@ -542,6 +605,9 @@ void bfd_putl16 (bfd_vma, void *);
bfd_uint64_t bfd_get_bits (const void *, int, bfd_boolean);
void bfd_put_bits (bfd_uint64_t, void *, int, bfd_boolean);
+
+extern bfd_boolean bfd_section_already_linked_table_init (void);
+extern void bfd_section_already_linked_table_free (void);
/* Externally visible ECOFF routines. */
@@ -595,8 +661,6 @@ 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. */
@@ -610,28 +674,44 @@ struct bfd_link_needed_list
enum dynamic_lib_link_class {
DYN_NORMAL = 0,
DYN_AS_NEEDED = 1,
- DYN_DT_NEEDED = 2
+ DYN_DT_NEEDED = 2,
+ DYN_NO_ADD_NEEDED = 4,
+ DYN_NO_NEEDED = 8
+};
+
+enum notice_asneeded_action {
+ notice_as_needed,
+ notice_not_needed,
+ notice_needed
};
extern bfd_boolean bfd_elf_record_link_assignment
- (bfd *, struct bfd_link_info *, const char *, bfd_boolean);
+ (bfd *, struct bfd_link_info *, const char *, bfd_boolean,
+ 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 *);
+ struct bfd_link_info *, struct bfd_section **,
+ struct bfd_elf_version_tree *);
+extern bfd_boolean bfd_elf_size_dynsym_hash_dynstr
+ (bfd *, struct bfd_link_info *);
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);
+ (bfd *, enum dynamic_lib_link_class);
+extern int bfd_elf_get_dyn_lib_class
+ (bfd *);
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 *);
+extern unsigned int _bfd_elf_default_action_discarded
+ (struct bfd_section *);
/* 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
@@ -663,7 +743,7 @@ extern int bfd_get_elf_phdrs
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));
+ int (*target_read_memory) (bfd_vma vma, bfd_byte *myaddr, int len));
/* Return the arch_size field of an elf bfd, or -1 if not elf. */
extern int bfd_get_arch_size
@@ -676,10 +756,20 @@ extern int bfd_get_sign_extend_vma
extern struct bfd_section *_bfd_elf_tls_setup
(bfd *, struct bfd_link_info *);
+extern void _bfd_fix_excluded_sec_syms
+ (bfd *, struct bfd_link_info *);
+
+extern unsigned bfd_m68k_mach_to_features (int);
+
+extern int bfd_m68k_features_to_mach (unsigned);
+
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 **);
+ (bfd *, struct bfd_link_info *, struct bfd_section *, struct bfd_section *,
+ char **);
+
+extern bfd_boolean bfd_bfin_elf32_create_embedded_relocs
+ (bfd *, struct bfd_link_info *, struct bfd_section *, struct bfd_section *,
+ char **);
/* SunOS shared library support routines for the linker. */
@@ -688,7 +778,8 @@ extern struct bfd_link_needed_list *bfd_sunos_get_needed_list
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 **);
+ (bfd *, struct bfd_link_info *, struct bfd_section **,
+ struct bfd_section **, struct bfd_section **);
/* Linux shared library support routines for the linker. */
@@ -769,6 +860,27 @@ extern bfd_boolean bfd_coff_set_symbol_class
extern bfd_boolean bfd_m68k_coff_create_embedded_relocs
(bfd *, struct bfd_link_info *, struct bfd_section *, struct bfd_section *, char **);
+/* ARM VFP11 erratum workaround support. */
+typedef enum
+{
+ BFD_ARM_VFP11_FIX_DEFAULT,
+ BFD_ARM_VFP11_FIX_NONE,
+ BFD_ARM_VFP11_FIX_SCALAR,
+ BFD_ARM_VFP11_FIX_VECTOR
+} bfd_arm_vfp11_fix;
+
+extern void bfd_elf32_arm_init_maps
+ (bfd *);
+
+extern void bfd_elf32_arm_set_vfp11_fix
+ (bfd *, struct bfd_link_info *);
+
+extern bfd_boolean bfd_elf32_arm_vfp11_erratum_scan
+ (bfd *, struct bfd_link_info *);
+
+extern void bfd_elf32_arm_vfp11_fix_veneer_locations
+ (bfd *, struct bfd_link_info *);
+
/* ARM Interworking support. Called from linker. */
extern bfd_boolean bfd_arm_allocate_interworking_sections
(struct bfd_link_info *);
@@ -794,7 +906,11 @@ 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);
+ (bfd *, struct bfd_link_info *);
+
+void bfd_elf32_arm_set_target_relocs
+ (bfd *, struct bfd_link_info *, int, char *, int, int, bfd_arm_vfp11_fix,
+ int, int);
extern bfd_boolean bfd_elf32_arm_get_bfd_for_interworking
(bfd *, struct bfd_link_info *);
@@ -802,6 +918,16 @@ extern bfd_boolean bfd_elf32_arm_get_bfd_for_interworking
extern bfd_boolean bfd_elf32_arm_add_glue_sections_to_bfd
(bfd *, struct bfd_link_info *);
+/* ELF ARM mapping symbol support */
+#define BFD_ARM_SPECIAL_SYM_TYPE_MAP (1 << 0)
+#define BFD_ARM_SPECIAL_SYM_TYPE_TAG (1 << 1)
+#define BFD_ARM_SPECIAL_SYM_TYPE_OTHER (1 << 2)
+#define BFD_ARM_SPECIAL_SYM_TYPE_ANY (~0)
+extern bfd_boolean bfd_is_arm_special_symbol_name
+ (const char * name, int type);
+
+extern void bfd_elf32_arm_set_byteswap_code (struct bfd_link_info *, int);
+
/* ARM Note section processing. */
extern bfd_boolean bfd_arm_merge_machines
(bfd *, bfd *);
@@ -830,16 +956,54 @@ extern void bfd_elf32_ia64_after_parse
extern void bfd_elf64_ia64_after_parse
(int);
+/* 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 coff_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;
+};
+
+extern struct coff_comdat_info *bfd_coff_get_comdat_section
+ (bfd *, struct bfd_section *);
+
/* Extracted from init.c. */
void bfd_init (void);
/* Extracted from opncls.c. */
+bfd *bfd_fopen (const char *filename, const char *target,
+ const char *mode, int fd);
+
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_openr_iovec (const char *filename, const char *target,
+ void *(*open) (struct bfd *nbfd,
+ void *open_closure),
+ void *open_closure,
+ file_ptr (*pread) (struct bfd *nbfd,
+ void *stream,
+ void *buf,
+ file_ptr nbytes,
+ file_ptr offset),
+ int (*close) (struct bfd *nbfd,
+ void *stream),
+ int (*stat) (struct bfd *abfd,
+ void *stream,
+ struct stat *sb));
+
bfd *bfd_openw (const char *filename, const char *target);
bfd_boolean bfd_close (bfd *abfd);
@@ -979,27 +1143,10 @@ bfd_boolean bfd_fill_in_gnu_debuglink_section
/* Extracted from bfdio.c. */
long bfd_get_mtime (bfd *abfd);
-long bfd_get_size (bfd *abfd);
+file_ptr 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
@@ -1015,6 +1162,9 @@ typedef struct bfd_section
/* The next section in the list belonging to the BFD, or NULL. */
struct bfd_section *next;
+ /* The previous section in the list belonging to the BFD, or NULL. */
+ struct bfd_section *prev;
+
/* The field flags contains attributes of the section. Some
flags are read in from the object file, and some are
synthesized from other information. */
@@ -1034,23 +1184,17 @@ typedef struct bfd_section
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
+#define SEC_READONLY 0x008
/* The section contains code only. */
-#define SEC_CODE 0x020
+#define SEC_CODE 0x010
/* The section contains data only. */
-#define SEC_DATA 0x040
+#define SEC_DATA 0x020
/* The section will reside in ROM. */
-#define SEC_ROM 0x080
+#define SEC_ROM 0x040
/* The section contains constructor information. This section
type is used by the linker to create lists of constructors and
@@ -1062,30 +1206,19 @@ typedef struct bfd_section
sections called <<__CTOR_LIST__>> and relocate the data
contained within - exactly the operations it would peform on
standard data. */
-#define SEC_CONSTRUCTOR 0x100
+#define SEC_CONSTRUCTOR 0x080
/* 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
+#define SEC_HAS_CONTENTS 0x100
/* 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
+#define SEC_NEVER_LOAD 0x200
/* The section contains thread local data. */
-#define SEC_THREAD_LOCAL 0x1000
+#define SEC_THREAD_LOCAL 0x400
/* The section has GOT references. This flag is only for the
linker, and is currently only used by the elf32-hppa back end.
@@ -1093,46 +1226,46 @@ typedef struct bfd_section
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
+#define SEC_HAS_GOT_REF 0x800
/* 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
+#define SEC_IS_COMMON 0x1000
/* 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
+#define SEC_DEBUGGING 0x2000
/* 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
+#define SEC_IN_MEMORY 0x4000
/* 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
+#define SEC_EXCLUDE 0x8000
/* 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
+#define SEC_SORT_ENTRIES 0x10000
/* 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
+#define SEC_LINK_ONCE 0x20000
/* If SEC_LINK_ONCE is set, this bitfield describes how the linker
should handle duplicate sections. */
-#define SEC_LINK_DUPLICATES 0x600000
+#define SEC_LINK_DUPLICATES 0x40000
/* This value for SEC_LINK_DUPLICATES means that duplicate
sections with the same name should simply be discarded. */
@@ -1141,55 +1274,71 @@ typedef struct bfd_section
/* 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
+#define SEC_LINK_DUPLICATES_ONE_ONLY 0x80000
/* 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
+#define SEC_LINK_DUPLICATES_SAME_SIZE 0x100000
/* 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
+#define SEC_LINK_DUPLICATES_SAME_CONTENTS \
+ (SEC_LINK_DUPLICATES_ONE_ONLY | SEC_LINK_DUPLICATES_SAME_SIZE)
/* 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
+#define SEC_LINKER_CREATED 0x200000
- /* This section should not be subject to garbage collection. */
-#define SEC_KEEP 0x1000000
+ /* This section should not be subject to garbage collection.
+ Also set to inform the linker that this section should not be
+ listed in the link map as discarded. */
+#define SEC_KEEP 0x400000
/* 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
+#define SEC_SMALL_DATA 0x800000
/* Attempt to merge identical entities in the section.
Entity size is given in the entsize field. */
-#define SEC_MERGE 0x20000000
+#define SEC_MERGE 0x1000000
/* 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
+#define SEC_STRINGS 0x2000000
/* This section contains data about section groups. */
-#define SEC_GROUP 0x80000000
+#define SEC_GROUP 0x4000000
+
+ /* 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 0x10000000
+
+ /* This section contains data which may be shared with other
+ executables or shared objects. This is for COFF only. */
+#define SEC_COFF_SHARED 0x20000000
+
+ /* 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. This is for TI
+ TMS320C54X only. */
+#define SEC_TIC54X_BLOCK 0x40000000
+
+ /* Conditionally link this section; do not link if there are no
+ references found to any symbol in the section. This is for TI
+ TMS320C54X only. */
+#define SEC_TIC54X_CLINK 0x80000000
/* End of section flags. */
@@ -1198,9 +1347,6 @@ typedef struct bfd_section
/* 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;
@@ -1208,8 +1354,9 @@ typedef struct bfd_section
output sections that have an input section. */
unsigned int linker_has_input : 1;
- /* A mark flag used by some linker backends for garbage collection. */
+ /* Mark flags used by some linker backends for garbage collection. */
unsigned int gc_mark : 1;
+ unsigned int gc_mark_from_eh : 1;
/* The following flags are used by the ELF linker. */
@@ -1227,22 +1374,20 @@ typedef struct bfd_section
/* 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;
+ /* Bits used by various backends. The generic code doesn't touch
+ these fields. */
- /* Nonzero if this section needs the relax finalize pass. */
- unsigned int need_finalize_relax:1;
+ /* Nonzero if this section has TLS related relocations. */
+ unsigned int has_tls_reloc: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;
+ /* Nonzero if this section needs the relax finalize pass. */
+ unsigned int need_finalize_relax:1;
+
+ /* Whether relocations have been processed. */
+ unsigned int reloc_done : 1;
/* End of internal packed boolean fields. */
@@ -1261,13 +1406,18 @@ typedef struct bfd_section
/* 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;
+ size of <<.bss>>). */
+ bfd_size_type 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;
+ /* For input sections, the original size on disk of the section, in
+ octets. This field is used by the linker relaxation code. It is
+ currently only set for sections where the linker relaxation scheme
+ doesn't cache altered section and reloc contents (stabs, eh_frame,
+ SEC_MERGE, some coff relaxing targets), and thus the original size
+ needs to be kept to read the section multiple times.
+ For output sections, rawsize holds the section size calculated on
+ a previous linker relaxation pass. */
+ bfd_size_type rawsize;
/* 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
@@ -1324,9 +1474,6 @@ typedef struct bfd_section
/* 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;
@@ -1351,8 +1498,14 @@ typedef struct bfd_section
struct bfd_symbol *symbol;
struct bfd_symbol **symbol_ptr_ptr;
- struct bfd_link_order *link_order_head;
- struct bfd_link_order *link_order_tail;
+ /* Early in the link process, map_head and map_tail are used to build
+ a list of input sections attached to an output section. Later,
+ output sections use these fields for a list of bfd_link_order
+ structs. */
+ union {
+ struct bfd_link_order *link_order;
+ struct bfd_section *s;
+ } map_head, map_tail;
} asection;
/* These sections are global, and are managed by BFD. The application
@@ -1387,52 +1540,157 @@ extern asection bfd_ind_section;
|| ((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) \
+#define bfd_section_list_remove(ABFD, S) \
+ do \
+ { \
+ asection *_s = S; \
+ asection *_next = _s->next; \
+ asection *_prev = _s->prev; \
+ if (_prev) \
+ _prev->next = _next; \
+ else \
+ (ABFD)->sections = _next; \
+ if (_next) \
+ _next->prev = _prev; \
+ else \
+ (ABFD)->section_last = _prev; \
+ } \
+ while (0)
+#define bfd_section_list_append(ABFD, S) \
do \
{ \
- asection **_ps = PS; \
- asection *_s = *_ps; \
- *_ps = _s->next; \
- if (_s->next == NULL) \
- (ABFD)->section_tail = _ps; \
+ asection *_s = S; \
+ bfd *_abfd = ABFD; \
+ _s->next = NULL; \
+ if (_abfd->section_last) \
+ { \
+ _s->prev = _abfd->section_last; \
+ _abfd->section_last->next = _s; \
+ } \
+ else \
+ { \
+ _s->prev = NULL; \
+ _abfd->sections = _s; \
+ } \
+ _abfd->section_last = _s; \
} \
while (0)
-#define bfd_section_list_insert(ABFD, PS, S) \
+#define bfd_section_list_prepend(ABFD, S) \
do \
{ \
- asection **_ps = PS; \
asection *_s = S; \
- _s->next = *_ps; \
- *_ps = _s; \
- if (_s->next == NULL) \
- (ABFD)->section_tail = &_s->next; \
+ bfd *_abfd = ABFD; \
+ _s->prev = NULL; \
+ if (_abfd->sections) \
+ { \
+ _s->next = _abfd->sections; \
+ _abfd->sections->prev = _s; \
+ } \
+ else \
+ { \
+ _s->next = NULL; \
+ _abfd->section_last = _s; \
+ } \
+ _abfd->sections = _s; \
} \
while (0)
+#define bfd_section_list_insert_after(ABFD, A, S) \
+ do \
+ { \
+ asection *_a = A; \
+ asection *_s = S; \
+ asection *_next = _a->next; \
+ _s->next = _next; \
+ _s->prev = _a; \
+ _a->next = _s; \
+ if (_next) \
+ _next->prev = _s; \
+ else \
+ (ABFD)->section_last = _s; \
+ } \
+ while (0)
+#define bfd_section_list_insert_before(ABFD, B, S) \
+ do \
+ { \
+ asection *_b = B; \
+ asection *_s = S; \
+ asection *_prev = _b->prev; \
+ _s->prev = _prev; \
+ _s->next = _b; \
+ _b->prev = _s; \
+ if (_prev) \
+ _prev->next = _s; \
+ else \
+ (ABFD)->sections = _s; \
+ } \
+ while (0)
+#define bfd_section_removed_from_list(ABFD, S) \
+ ((S)->next == NULL ? (ABFD)->section_last != (S) : (S)->next->prev != (S))
+
+#define BFD_FAKE_SECTION(SEC, FLAGS, SYM, NAME, IDX) \
+ /* name, id, index, next, prev, flags, user_set_vma, */ \
+ { NAME, IDX, 0, NULL, NULL, FLAGS, 0, \
+ \
+ /* linker_mark, linker_has_input, gc_mark, gc_mark_from_eh, */ \
+ 0, 0, 1, 0, \
+ \
+ /* segment_mark, sec_info_type, use_rela_p, has_tls_reloc, */ \
+ 0, 0, 0, 0, \
+ \
+ /* has_gp_reloc, need_finalize_relax, reloc_done, */ \
+ 0, 0, 0, \
+ \
+ /* vma, lma, size, rawsize */ \
+ 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, kept_section, moving_line_filepos, */ \
+ 0, NULL, 0, \
+ \
+ /* target_index, used_by_bfd, constructor_chain, owner, */ \
+ 0, NULL, NULL, NULL, \
+ \
+ /* symbol, symbol_ptr_ptr, */ \
+ (struct bfd_symbol *) SYM, &SEC.symbol, \
+ \
+ /* map_head, map_tail */ \
+ { NULL }, { NULL } \
+ }
void bfd_section_list_clear (bfd *);
asection *bfd_get_section_by_name (bfd *abfd, const char *name);
+asection *bfd_get_section_by_name_if
+ (bfd *abfd,
+ const char *name,
+ bfd_boolean (*func) (bfd *abfd, asection *sect, void *obj),
+ void *obj);
+
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_with_flags
+ (bfd *abfd, const char *name, flagword flags);
+
asection *bfd_make_section_anyway (bfd *abfd, const char *name);
+asection *bfd_make_section_with_flags
+ (bfd *, const char *name, flagword flags);
+
asection *bfd_make_section (bfd *, const char *name);
bfd_boolean bfd_set_section_flags
@@ -1443,6 +1701,11 @@ void bfd_map_over_sections
void (*func) (bfd *abfd, asection *sect, void *obj),
void *obj);
+asection *bfd_sections_find_if
+ (bfd *abfd,
+ bfd_boolean (*operation) (bfd *abfd, asection *sect, void *obj),
+ void *obj);
+
bfd_boolean bfd_set_section_size
(bfd *abfd, asection *sec, bfd_size_type val);
@@ -1454,14 +1717,16 @@ bfd_boolean bfd_get_section_contents
(bfd *abfd, asection *section, void *location, file_ptr offset,
bfd_size_type count);
+bfd_boolean bfd_malloc_and_get_section
+ (bfd *abfd, asection *section, bfd_byte **buf);
+
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_is_group_section (bfd *, const asection *sec);
bfd_boolean bfd_generic_discard_group (bfd *abfd, asection *group);
@@ -1479,11 +1744,26 @@ enum bfd_architecture
#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
+#define bfd_mach_fido 9
+#define bfd_mach_mcf_isa_a_nodiv 10
+#define bfd_mach_mcf_isa_a 11
+#define bfd_mach_mcf_isa_a_mac 12
+#define bfd_mach_mcf_isa_a_emac 13
+#define bfd_mach_mcf_isa_aplus 14
+#define bfd_mach_mcf_isa_aplus_mac 15
+#define bfd_mach_mcf_isa_aplus_emac 16
+#define bfd_mach_mcf_isa_b_nousp 17
+#define bfd_mach_mcf_isa_b_nousp_mac 18
+#define bfd_mach_mcf_isa_b_nousp_emac 19
+#define bfd_mach_mcf_isa_b 20
+#define bfd_mach_mcf_isa_b_mac 21
+#define bfd_mach_mcf_isa_b_emac 22
+#define bfd_mach_mcf_isa_b_float 23
+#define bfd_mach_mcf_isa_b_float_mac 24
+#define bfd_mach_mcf_isa_b_float_emac 25
+#define bfd_mach_mcf_isa_c 26
+#define bfd_mach_mcf_isa_c_mac 27
+#define bfd_mach_mcf_isa_c_emac 28
bfd_arch_vax, /* DEC Vax */
bfd_arch_i960, /* Intel 960 */
/* The order of the following is important.
@@ -1505,7 +1785,6 @@ enum bfd_architecture
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. */
@@ -1522,6 +1801,11 @@ enum bfd_architecture
#define bfd_mach_sparc_v9_p(mach) \
((mach) >= bfd_mach_sparc_v8plus && (mach) <= bfd_mach_sparc_v9b \
&& (mach) != bfd_mach_sparc_sparclite_le)
+/* Nonzero if MACH is a 64 bit sparc architecture. */
+#define bfd_mach_sparc_64bit_p(mach) \
+ ((mach) >= bfd_mach_sparc_v9 && (mach) != bfd_mach_sparc_v8plusb)
+ bfd_arch_spu, /* PowerPC SPU */
+#define bfd_mach_spu 256
bfd_arch_mips, /* MIPS Rxxxx */
#define bfd_mach_mips3000 3000
#define bfd_mach_mips3900 3900
@@ -1540,6 +1824,7 @@ enum bfd_architecture
#define bfd_mach_mips6000 6000
#define bfd_mach_mips7000 7000
#define bfd_mach_mips8000 8000
+#define bfd_mach_mips9000 9000
#define bfd_mach_mips10000 10000
#define bfd_mach_mips12000 12000
#define bfd_mach_mips16 16
@@ -1560,7 +1845,6 @@ enum bfd_architecture
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 */
@@ -1623,12 +1907,20 @@ enum bfd_architecture
#define bfd_mach_sh 1
#define bfd_mach_sh2 0x20
#define bfd_mach_sh_dsp 0x2d
+#define bfd_mach_sh2a 0x2a
+#define bfd_mach_sh2a_nofpu 0x2b
+#define bfd_mach_sh2a_nofpu_or_sh4_nommu_nofpu 0x2a1
+#define bfd_mach_sh2a_nofpu_or_sh3_nommu 0x2a2
+#define bfd_mach_sh2a_or_sh4 0x2a3
+#define bfd_mach_sh2a_or_sh3e 0x2a4
#define bfd_mach_sh2e 0x2e
#define bfd_mach_sh3 0x30
+#define bfd_mach_sh3_nommu 0x31
#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_sh4_nommu_nofpu 0x42
#define bfd_mach_sh4a 0x4a
#define bfd_mach_sh4a_nofpu 0x4b
#define bfd_mach_sh4al_dsp 0x4d
@@ -1651,6 +1943,7 @@ enum bfd_architecture
#define bfd_mach_arm_XScale 10
#define bfd_mach_arm_ep9312 11
#define bfd_mach_arm_iWMMXt 12
+#define bfd_mach_arm_iWMMXt2 13
bfd_arch_ns32k, /* National Semiconductors ns32000 */
bfd_arch_w65, /* WDC 65816 */
bfd_arch_tic30, /* Texas Instruments TMS320C30 */
@@ -1668,6 +1961,9 @@ enum bfd_architecture
#define bfd_mach_arc_6 6
#define bfd_mach_arc_7 7
#define bfd_mach_arc_8 8
+ bfd_arch_m32c, /* Renesas M16C/M32C. */
+#define bfd_mach_m16c 0x75
+#define bfd_mach_m32c 0x78
bfd_arch_m32r, /* Renesas M32R (formerly Mitsubishi M32R/D) */
#define bfd_mach_m32r 1 /* For backwards compatibility. */
#define bfd_mach_m32rx 'x'
@@ -1684,10 +1980,14 @@ enum bfd_architecture
#define bfd_mach_frvsimple 2
#define bfd_mach_fr300 300
#define bfd_mach_fr400 400
+#define bfd_mach_fr450 450
#define bfd_mach_frvtomcat 499 /* fr500 prototype */
#define bfd_mach_fr500 500
#define bfd_mach_fr550 550
bfd_arch_mcore,
+ bfd_arch_mep,
+#define bfd_mach_mep 1
+#define bfd_mach_mep_h1 0x6831
bfd_arch_ia64, /* HP/Intel ia64 */
#define bfd_mach_ia64_elf64 64
#define bfd_mach_ia64_elf32 32
@@ -1697,6 +1997,10 @@ enum bfd_architecture
bfd_arch_iq2000, /* Vitesse IQ2000. */
#define bfd_mach_iq2000 1
#define bfd_mach_iq10 2
+ bfd_arch_mt,
+#define bfd_mach_ms1 1
+#define bfd_mach_mrisc2 2
+#define bfd_mach_ms2 3
bfd_arch_pj,
bfd_arch_avr, /* Atmel AVR microcontrollers. */
#define bfd_mach_avr1 1
@@ -1704,10 +2008,23 @@ enum bfd_architecture
#define bfd_mach_avr3 3
#define bfd_mach_avr4 4
#define bfd_mach_avr5 5
+#define bfd_mach_avr6 6
+ bfd_arch_bfin, /* ADI Blackfin */
+#define bfd_mach_bfin 1
+ bfd_arch_cr16, /* National Semiconductor CompactRISC (ie CR16). */
+#define bfd_mach_cr16 1
+ bfd_arch_cr16c, /* National Semiconductor CompactRISC. */
+#define bfd_mach_cr16c 1
+ bfd_arch_crx, /* National Semiconductor CRX. */
+#define bfd_mach_crx 1
bfd_arch_cris, /* Axis CRIS */
+#define bfd_mach_cris_v0_v10 255
+#define bfd_mach_cris_v32 32
+#define bfd_mach_cris_v10_v32 1032
bfd_arch_s390, /* IBM s390 */
#define bfd_mach_s390_31 31
#define bfd_mach_s390_64 64
+ bfd_arch_score, /* Sunplus score */
bfd_arch_openrisc, /* OpenRISC */
bfd_arch_mmix, /* Donald Knuth's educational processor. */
bfd_arch_xstormy16,
@@ -1719,7 +2036,8 @@ enum bfd_architecture
#define bfd_mach_msp13 13
#define bfd_mach_msp14 14
#define bfd_mach_msp15 15
-#define bfd_mach_msp16 16
+#define bfd_mach_msp16 16
+#define bfd_mach_msp21 21
#define bfd_mach_msp31 31
#define bfd_mach_msp32 32
#define bfd_mach_msp33 33
@@ -1727,8 +2045,20 @@ enum bfd_architecture
#define bfd_mach_msp42 42
#define bfd_mach_msp43 43
#define bfd_mach_msp44 44
+ bfd_arch_xc16x, /* Infineon's XC16X Series. */
+#define bfd_mach_xc16x 1
+#define bfd_mach_xc16xl 2
+#define bfd_mach_xc16xs 3
bfd_arch_xtensa, /* Tensilica's Xtensa cores. */
#define bfd_mach_xtensa 1
+ bfd_arch_maxq, /* Dallas MAXQ 10/20 */
+#define bfd_mach_maxq10 10
+#define bfd_mach_maxq20 20
+ bfd_arch_z80,
+#define bfd_mach_z80strict 1 /* No undocumented opcodes. */
+#define bfd_mach_z80 3 /* With ixl, ixh, iyl, and iyh. */
+#define bfd_mach_z80full 7 /* All undocumented instructions. */
+#define bfd_mach_r800 11 /* R800: successor with multiplication. */
bfd_arch_last
};
@@ -1842,11 +2172,12 @@ 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 if the value overflows when considered as a signed
+ number one bit larger than the field. ie. A bitfield of N bits
+ is allowed to represent -2**n to 2**n-1. */
complain_overflow_bitfield,
- /* Complain if the value overflows when considered as signed
+ /* Complain if the value overflows when considered as a signed
number. */
complain_overflow_signed,
@@ -2024,6 +2355,9 @@ The 24-bit relocation is used in some Intel 960 configurations. */
BFD_RELOC_12_PCREL,
BFD_RELOC_8_PCREL,
+/* Section relative relocations. Some targets need this for DWARF2. */
+ BFD_RELOC_32_SECREL,
+
/* For ELF. */
BFD_RELOC_32_GOT_PCREL,
BFD_RELOC_16_GOT_PCREL,
@@ -2168,6 +2502,22 @@ relocation types already defined. */
BFD_RELOC_SPARC_TLS_TPOFF32,
BFD_RELOC_SPARC_TLS_TPOFF64,
+/* SPU Relocations. */
+ BFD_RELOC_SPU_IMM7,
+ BFD_RELOC_SPU_IMM8,
+ BFD_RELOC_SPU_IMM10,
+ BFD_RELOC_SPU_IMM10W,
+ BFD_RELOC_SPU_IMM16,
+ BFD_RELOC_SPU_IMM16W,
+ BFD_RELOC_SPU_IMM18,
+ BFD_RELOC_SPU_PCREL9a,
+ BFD_RELOC_SPU_PCREL9b,
+ BFD_RELOC_SPU_PCREL16,
+ BFD_RELOC_SPU_LO16,
+ BFD_RELOC_SPU_HI16,
+ BFD_RELOC_SPU_PPU32,
+ BFD_RELOC_SPU_PPU64,
+
/* 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
@@ -2274,11 +2624,26 @@ to compensate for the borrow when the low bits are added. */
/* Low 16 bits. */
BFD_RELOC_LO16,
-/* Like BFD_RELOC_HI16_S, but PC relative. */
- BFD_RELOC_PCREL_HI16_S,
+/* High 16 bits of 32-bit pc-relative value */
+ BFD_RELOC_HI16_PCREL,
-/* Like BFD_RELOC_LO16, but PC relative. */
- BFD_RELOC_PCREL_LO16,
+/* High 16 bits of 32-bit pc-relative value, adjusted */
+ BFD_RELOC_HI16_S_PCREL,
+
+/* Low 16 bits of pc-relative value */
+ BFD_RELOC_LO16_PCREL,
+
+/* MIPS16 high 16 bits of 32-bit value. */
+ BFD_RELOC_MIPS16_HI16,
+
+/* MIPS16 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_MIPS16_HI16_S,
+
+/* MIPS16 low 16 bits. */
+ BFD_RELOC_MIPS16_LO16,
/* Relocation against a MIPS literal section. */
BFD_RELOC_MIPS_LITERAL,
@@ -2305,6 +2670,24 @@ to compensate for the borrow when the low bits are added. */
BFD_RELOC_MIPS_REL16,
BFD_RELOC_MIPS_RELGOT,
BFD_RELOC_MIPS_JALR,
+ BFD_RELOC_MIPS_TLS_DTPMOD32,
+ BFD_RELOC_MIPS_TLS_DTPREL32,
+ BFD_RELOC_MIPS_TLS_DTPMOD64,
+ BFD_RELOC_MIPS_TLS_DTPREL64,
+ BFD_RELOC_MIPS_TLS_GD,
+ BFD_RELOC_MIPS_TLS_LDM,
+ BFD_RELOC_MIPS_TLS_DTPREL_HI16,
+ BFD_RELOC_MIPS_TLS_DTPREL_LO16,
+ BFD_RELOC_MIPS_TLS_GOTTPREL,
+ BFD_RELOC_MIPS_TLS_TPREL32,
+ BFD_RELOC_MIPS_TLS_TPREL64,
+ BFD_RELOC_MIPS_TLS_TPREL_HI16,
+ BFD_RELOC_MIPS_TLS_TPREL_LO16,
+
+
+/* MIPS ELF relocations (VxWorks extensions). */
+ BFD_RELOC_MIPS_COPY,
+ BFD_RELOC_MIPS_JUMP_SLOT,
/* Fujitsu Frv Relocations. */
@@ -2331,6 +2714,22 @@ to compensate for the borrow when the low bits are added. */
BFD_RELOC_FRV_GOTOFF12,
BFD_RELOC_FRV_GOTOFFHI,
BFD_RELOC_FRV_GOTOFFLO,
+ BFD_RELOC_FRV_GETTLSOFF,
+ BFD_RELOC_FRV_TLSDESC_VALUE,
+ BFD_RELOC_FRV_GOTTLSDESC12,
+ BFD_RELOC_FRV_GOTTLSDESCHI,
+ BFD_RELOC_FRV_GOTTLSDESCLO,
+ BFD_RELOC_FRV_TLSMOFF12,
+ BFD_RELOC_FRV_TLSMOFFHI,
+ BFD_RELOC_FRV_TLSMOFFLO,
+ BFD_RELOC_FRV_GOTTLSOFF12,
+ BFD_RELOC_FRV_GOTTLSOFFHI,
+ BFD_RELOC_FRV_GOTTLSOFFLO,
+ BFD_RELOC_FRV_TLSOFF,
+ BFD_RELOC_FRV_TLSDESC_RELAX,
+ BFD_RELOC_FRV_GETTLSOFF_RELAX,
+ BFD_RELOC_FRV_TLSOFF_RELAX,
+ BFD_RELOC_FRV_TLSMOFF,
/* This is a 24bit GOT-relative reloc for the mn10300. */
@@ -2382,6 +2781,9 @@ in the instruction. */
BFD_RELOC_386_TLS_DTPMOD32,
BFD_RELOC_386_TLS_DTPOFF32,
BFD_RELOC_386_TLS_TPOFF32,
+ BFD_RELOC_386_TLS_GOTDESC,
+ BFD_RELOC_386_TLS_DESC_CALL,
+ BFD_RELOC_386_TLS_DESC,
/* x86-64/elf relocations */
BFD_RELOC_X86_64_GOT32,
@@ -2400,6 +2802,16 @@ in the instruction. */
BFD_RELOC_X86_64_DTPOFF32,
BFD_RELOC_X86_64_GOTTPOFF,
BFD_RELOC_X86_64_TPOFF32,
+ BFD_RELOC_X86_64_GOTOFF64,
+ BFD_RELOC_X86_64_GOTPC32,
+ BFD_RELOC_X86_64_GOT64,
+ BFD_RELOC_X86_64_GOTPCREL64,
+ BFD_RELOC_X86_64_GOTPC64,
+ BFD_RELOC_X86_64_GOTPLT64,
+ BFD_RELOC_X86_64_PLTOFF64,
+ BFD_RELOC_X86_64_GOTPC32_TLSDESC,
+ BFD_RELOC_X86_64_TLSDESC_CALL,
+ BFD_RELOC_X86_64_TLSDESC,
/* ns32k relocations */
BFD_RELOC_NS32K_IMM_8,
@@ -2546,39 +2958,146 @@ not stored in the instruction. The 2nd lowest bit comes from a 1 bit
field in the instruction. */
BFD_RELOC_THUMB_PCREL_BLX,
+/* ARM 26-bit pc-relative branch for an unconditional BL or BLX instruction. */
+ BFD_RELOC_ARM_PCREL_CALL,
+
+/* ARM 26-bit pc-relative branch for B or conditional BL instruction. */
+ BFD_RELOC_ARM_PCREL_JUMP,
+
+/* Thumb 7-, 9-, 12-, 20-, 23-, and 25-bit pc-relative branches.
+The lowest bit must be zero and is not stored in the instruction.
+Note that the corresponding ELF R_ARM_THM_JUMPnn constant has an
+"nn" one smaller in all cases. Note further that BRANCH23
+corresponds to R_ARM_THM_CALL. */
+ BFD_RELOC_THUMB_PCREL_BRANCH7,
+ BFD_RELOC_THUMB_PCREL_BRANCH9,
+ BFD_RELOC_THUMB_PCREL_BRANCH12,
+ BFD_RELOC_THUMB_PCREL_BRANCH20,
+ BFD_RELOC_THUMB_PCREL_BRANCH23,
+ BFD_RELOC_THUMB_PCREL_BRANCH25,
+
+/* 12-bit immediate offset, used in ARM-format ldr and str instructions. */
+ BFD_RELOC_ARM_OFFSET_IMM,
+
+/* 5-bit immediate offset, used in Thumb-format ldr and str instructions. */
+ BFD_RELOC_ARM_THUMB_OFFSET,
+
+/* Pc-relative or absolute relocation depending on target. Used for
+entries in .init_array sections. */
+ BFD_RELOC_ARM_TARGET1,
+
+/* Read-only segment base relative address. */
+ BFD_RELOC_ARM_ROSEGREL32,
+
+/* Data segment base relative address. */
+ BFD_RELOC_ARM_SBREL32,
+
+/* This reloc is used for references to RTTI data from exception handling
+tables. The actual definition depends on the target. It may be a
+pc-relative or some form of GOT-indirect relocation. */
+ BFD_RELOC_ARM_TARGET2,
+
+/* 31-bit PC relative address. */
+ BFD_RELOC_ARM_PREL31,
+
+/* Low and High halfword relocations for MOVW and MOVT instructions. */
+ BFD_RELOC_ARM_MOVW,
+ BFD_RELOC_ARM_MOVT,
+ BFD_RELOC_ARM_MOVW_PCREL,
+ BFD_RELOC_ARM_MOVT_PCREL,
+ BFD_RELOC_ARM_THUMB_MOVW,
+ BFD_RELOC_ARM_THUMB_MOVT,
+ BFD_RELOC_ARM_THUMB_MOVW_PCREL,
+ BFD_RELOC_ARM_THUMB_MOVT_PCREL,
+
+/* Relocations for setting up GOTs and PLTs for shared libraries. */
+ BFD_RELOC_ARM_JUMP_SLOT,
+ BFD_RELOC_ARM_GLOB_DAT,
+ BFD_RELOC_ARM_GOT32,
+ BFD_RELOC_ARM_PLT32,
+ BFD_RELOC_ARM_RELATIVE,
+ BFD_RELOC_ARM_GOTOFF,
+ BFD_RELOC_ARM_GOTPC,
+
+/* ARM thread-local storage relocations. */
+ BFD_RELOC_ARM_TLS_GD32,
+ BFD_RELOC_ARM_TLS_LDO32,
+ BFD_RELOC_ARM_TLS_LDM32,
+ BFD_RELOC_ARM_TLS_DTPOFF32,
+ BFD_RELOC_ARM_TLS_DTPMOD32,
+ BFD_RELOC_ARM_TLS_TPOFF32,
+ BFD_RELOC_ARM_TLS_IE32,
+ BFD_RELOC_ARM_TLS_LE32,
+
+/* ARM group relocations. */
+ BFD_RELOC_ARM_ALU_PC_G0_NC,
+ BFD_RELOC_ARM_ALU_PC_G0,
+ BFD_RELOC_ARM_ALU_PC_G1_NC,
+ BFD_RELOC_ARM_ALU_PC_G1,
+ BFD_RELOC_ARM_ALU_PC_G2,
+ BFD_RELOC_ARM_LDR_PC_G0,
+ BFD_RELOC_ARM_LDR_PC_G1,
+ BFD_RELOC_ARM_LDR_PC_G2,
+ BFD_RELOC_ARM_LDRS_PC_G0,
+ BFD_RELOC_ARM_LDRS_PC_G1,
+ BFD_RELOC_ARM_LDRS_PC_G2,
+ BFD_RELOC_ARM_LDC_PC_G0,
+ BFD_RELOC_ARM_LDC_PC_G1,
+ BFD_RELOC_ARM_LDC_PC_G2,
+ BFD_RELOC_ARM_ALU_SB_G0_NC,
+ BFD_RELOC_ARM_ALU_SB_G0,
+ BFD_RELOC_ARM_ALU_SB_G1_NC,
+ BFD_RELOC_ARM_ALU_SB_G1,
+ BFD_RELOC_ARM_ALU_SB_G2,
+ BFD_RELOC_ARM_LDR_SB_G0,
+ BFD_RELOC_ARM_LDR_SB_G1,
+ BFD_RELOC_ARM_LDR_SB_G2,
+ BFD_RELOC_ARM_LDRS_SB_G0,
+ BFD_RELOC_ARM_LDRS_SB_G1,
+ BFD_RELOC_ARM_LDRS_SB_G2,
+ BFD_RELOC_ARM_LDC_SB_G0,
+ BFD_RELOC_ARM_LDC_SB_G1,
+ BFD_RELOC_ARM_LDC_SB_G2,
+
/* 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_T32_IMMEDIATE,
+ BFD_RELOC_ARM_T32_ADD_IMM,
+ BFD_RELOC_ARM_T32_IMM12,
+ BFD_RELOC_ARM_T32_ADD_PC12,
BFD_RELOC_ARM_SHIFT_IMM,
+ BFD_RELOC_ARM_SMC,
BFD_RELOC_ARM_SWI,
BFD_RELOC_ARM_MULTI,
BFD_RELOC_ARM_CP_OFF_IMM,
BFD_RELOC_ARM_CP_OFF_IMM_S2,
+ BFD_RELOC_ARM_T32_CP_OFF_IMM,
+ BFD_RELOC_ARM_T32_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_T32_OFFSET_U8,
+ BFD_RELOC_ARM_T32_OFFSET_IMM,
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_IMM3,
+ BFD_RELOC_SH_IMM3U,
+ BFD_RELOC_SH_DISP12,
+ BFD_RELOC_SH_DISP12BY2,
+ BFD_RELOC_SH_DISP12BY4,
+ BFD_RELOC_SH_DISP12BY8,
+ BFD_RELOC_SH_DISP20,
+ BFD_RELOC_SH_DISP20BY8,
BFD_RELOC_SH_IMM4,
BFD_RELOC_SH_IMM4BY2,
BFD_RELOC_SH_IMM4BY4,
@@ -2660,12 +3179,6 @@ field in the instruction. */
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
@@ -2677,6 +3190,121 @@ stored in the instruction. The high 24 bits are installed in bits 23
through 0. */
BFD_RELOC_ARC_B26,
+/* ADI Blackfin 16 bit immediate absolute reloc. */
+ BFD_RELOC_BFIN_16_IMM,
+
+/* ADI Blackfin 16 bit immediate absolute reloc higher 16 bits. */
+ BFD_RELOC_BFIN_16_HIGH,
+
+/* ADI Blackfin 'a' part of LSETUP. */
+ BFD_RELOC_BFIN_4_PCREL,
+
+/* ADI Blackfin. */
+ BFD_RELOC_BFIN_5_PCREL,
+
+/* ADI Blackfin 16 bit immediate absolute reloc lower 16 bits. */
+ BFD_RELOC_BFIN_16_LOW,
+
+/* ADI Blackfin. */
+ BFD_RELOC_BFIN_10_PCREL,
+
+/* ADI Blackfin 'b' part of LSETUP. */
+ BFD_RELOC_BFIN_11_PCREL,
+
+/* ADI Blackfin. */
+ BFD_RELOC_BFIN_12_PCREL_JUMP,
+
+/* ADI Blackfin Short jump, pcrel. */
+ BFD_RELOC_BFIN_12_PCREL_JUMP_S,
+
+/* ADI Blackfin Call.x not implemented. */
+ BFD_RELOC_BFIN_24_PCREL_CALL_X,
+
+/* ADI Blackfin Long Jump pcrel. */
+ BFD_RELOC_BFIN_24_PCREL_JUMP_L,
+
+/* ADI Blackfin FD-PIC relocations. */
+ BFD_RELOC_BFIN_GOT17M4,
+ BFD_RELOC_BFIN_GOTHI,
+ BFD_RELOC_BFIN_GOTLO,
+ BFD_RELOC_BFIN_FUNCDESC,
+ BFD_RELOC_BFIN_FUNCDESC_GOT17M4,
+ BFD_RELOC_BFIN_FUNCDESC_GOTHI,
+ BFD_RELOC_BFIN_FUNCDESC_GOTLO,
+ BFD_RELOC_BFIN_FUNCDESC_VALUE,
+ BFD_RELOC_BFIN_FUNCDESC_GOTOFF17M4,
+ BFD_RELOC_BFIN_FUNCDESC_GOTOFFHI,
+ BFD_RELOC_BFIN_FUNCDESC_GOTOFFLO,
+ BFD_RELOC_BFIN_GOTOFF17M4,
+ BFD_RELOC_BFIN_GOTOFFHI,
+ BFD_RELOC_BFIN_GOTOFFLO,
+
+/* ADI Blackfin GOT relocation. */
+ BFD_RELOC_BFIN_GOT,
+
+/* ADI Blackfin PLTPC relocation. */
+ BFD_RELOC_BFIN_PLTPC,
+
+/* ADI Blackfin arithmetic relocation. */
+ BFD_ARELOC_BFIN_PUSH,
+
+/* ADI Blackfin arithmetic relocation. */
+ BFD_ARELOC_BFIN_CONST,
+
+/* ADI Blackfin arithmetic relocation. */
+ BFD_ARELOC_BFIN_ADD,
+
+/* ADI Blackfin arithmetic relocation. */
+ BFD_ARELOC_BFIN_SUB,
+
+/* ADI Blackfin arithmetic relocation. */
+ BFD_ARELOC_BFIN_MULT,
+
+/* ADI Blackfin arithmetic relocation. */
+ BFD_ARELOC_BFIN_DIV,
+
+/* ADI Blackfin arithmetic relocation. */
+ BFD_ARELOC_BFIN_MOD,
+
+/* ADI Blackfin arithmetic relocation. */
+ BFD_ARELOC_BFIN_LSHIFT,
+
+/* ADI Blackfin arithmetic relocation. */
+ BFD_ARELOC_BFIN_RSHIFT,
+
+/* ADI Blackfin arithmetic relocation. */
+ BFD_ARELOC_BFIN_AND,
+
+/* ADI Blackfin arithmetic relocation. */
+ BFD_ARELOC_BFIN_OR,
+
+/* ADI Blackfin arithmetic relocation. */
+ BFD_ARELOC_BFIN_XOR,
+
+/* ADI Blackfin arithmetic relocation. */
+ BFD_ARELOC_BFIN_LAND,
+
+/* ADI Blackfin arithmetic relocation. */
+ BFD_ARELOC_BFIN_LOR,
+
+/* ADI Blackfin arithmetic relocation. */
+ BFD_ARELOC_BFIN_LEN,
+
+/* ADI Blackfin arithmetic relocation. */
+ BFD_ARELOC_BFIN_NEG,
+
+/* ADI Blackfin arithmetic relocation. */
+ BFD_ARELOC_BFIN_COMP,
+
+/* ADI Blackfin arithmetic relocation. */
+ BFD_ARELOC_BFIN_PAGE,
+
+/* ADI Blackfin arithmetic relocation. */
+ BFD_ARELOC_BFIN_HWPAGE,
+
+/* ADI Blackfin arithmetic relocation. */
+ BFD_ARELOC_BFIN_ADDR,
+
/* Mitsubishi D10V relocs.
This is a 10-bit reloc with the right 2 bits
assumed to be 0. */
@@ -2754,6 +3382,12 @@ of the container. */
/* DLX relocs */
BFD_RELOC_DLX_JMP26,
+/* Renesas M16C/M32C Relocations. */
+ BFD_RELOC_M32C_HI8,
+ BFD_RELOC_M32C_RL_JUMP,
+ BFD_RELOC_M32C_RL_1ADDR,
+ BFD_RELOC_M32C_RL_2ADDR,
+
/* Renesas M32R (formerly Mitsubishi M32R) relocs.
This is a 24 bit absolute address. */
BFD_RELOC_M32R_24,
@@ -2790,6 +3424,9 @@ add3, load, and store instructions. */
BFD_RELOC_M32R_JMP_SLOT,
BFD_RELOC_M32R_RELATIVE,
BFD_RELOC_M32R_GOTOFF,
+ BFD_RELOC_M32R_GOTOFF_HI_ULO,
+ BFD_RELOC_M32R_GOTOFF_HI_SLO,
+ BFD_RELOC_M32R_GOTOFF_LO,
BFD_RELOC_M32R_GOTPC24,
BFD_RELOC_M32R_GOT16_HI_ULO,
BFD_RELOC_M32R_GOT16_HI_SLO,
@@ -2862,6 +3499,10 @@ bits placed non-contiguously in the instruction. */
/* Used to maintain alignment whilst relaxing. */
BFD_RELOC_V850_ALIGN,
+/* This is a variation of BFD_RELOC_LO16 that can be used in v850e ld.bu
+instructions. */
+ BFD_RELOC_V850_LO16_SPLIT_OFFSET,
+
/* This is a 32bit pcrel reloc for the mn10300, offset by two bytes in the
instruction. */
BFD_RELOC_MN10300_32_PCREL,
@@ -2937,6 +3578,29 @@ short offset into 11 bits. */
BFD_RELOC_MCORE_PCREL_JSR_IMM11BY2,
BFD_RELOC_MCORE_RVA,
+/* Toshiba Media Processor Relocations. */
+ BFD_RELOC_MEP_8,
+ BFD_RELOC_MEP_16,
+ BFD_RELOC_MEP_32,
+ BFD_RELOC_MEP_PCREL8A2,
+ BFD_RELOC_MEP_PCREL12A2,
+ BFD_RELOC_MEP_PCREL17A2,
+ BFD_RELOC_MEP_PCREL24A2,
+ BFD_RELOC_MEP_PCABS24A2,
+ BFD_RELOC_MEP_LOW16,
+ BFD_RELOC_MEP_HI16U,
+ BFD_RELOC_MEP_HI16S,
+ BFD_RELOC_MEP_GPREL,
+ BFD_RELOC_MEP_TPREL,
+ BFD_RELOC_MEP_TPREL7,
+ BFD_RELOC_MEP_TPREL7A2,
+ BFD_RELOC_MEP_TPREL7A4,
+ BFD_RELOC_MEP_UIMM24,
+ BFD_RELOC_MEP_ADDR24A4,
+ BFD_RELOC_MEP_GNU_VTINHERIT,
+ BFD_RELOC_MEP_GNU_VTENTRY,
+
+
/* These are relocations for the GETA instruction. */
BFD_RELOC_MMIX_GETA,
BFD_RELOC_MMIX_GETA_1,
@@ -3010,6 +3674,10 @@ of data memory address) into 8 bit immediate value of LDI insn. */
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 8 bit value (most high 8 bit
+of 32 bit value) into 8 bit immediate value of LDI insn. */
+ BFD_RELOC_AVR_MS8_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,
@@ -3024,14 +3692,30 @@ SUBI insn. */
of LDI or SUBI insn. */
BFD_RELOC_AVR_HH8_LDI_NEG,
+/* This is a 16 bit reloc for the AVR that stores negated 8 bit value (msb
+of 32 bit value) into 8 bit immediate value of LDI insn. */
+ BFD_RELOC_AVR_MS8_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
+(command address) into 8 bit immediate value of LDI insn. If the address
+is beyond the 128k boundary, the linker inserts a jump stub for this reloc
+in the lower 128k. */
+ BFD_RELOC_AVR_LO8_LDI_GS,
+
/* 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 (high 8 bit
+of command address) into 8 bit immediate value of LDI insn. If the address
+is beyond the 128k boundary, the linker inserts a jump stub for this reloc
+below 128k. */
+ BFD_RELOC_AVR_HI8_LDI_GS,
+
/* 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,
@@ -3054,6 +3738,18 @@ value of SUBI insn. */
into 22 bits. */
BFD_RELOC_AVR_CALL,
+/* This is a 16 bit reloc for the AVR that stores all needed bits
+for absolute addressing with ldi with overflow check to linktime */
+ BFD_RELOC_AVR_LDI,
+
+/* This is a 6 bit reloc for the AVR that stores offset for ldd/std
+instructions */
+ BFD_RELOC_AVR_6,
+
+/* This is a 6 bit reloc for the AVR that stores offset for adiw/sbiw
+instructions */
+ BFD_RELOC_AVR_6_ADIW,
+
/* Direct 12 bit. */
BFD_RELOC_390_12,
@@ -3160,6 +3856,31 @@ into 22 bits. */
BFD_RELOC_390_GOTPLT20,
BFD_RELOC_390_TLS_GOTIE20,
+/* Score relocations */
+ BFD_RELOC_SCORE_DUMMY1,
+
+/* Low 16 bit for load/store */
+ BFD_RELOC_SCORE_GPREL15,
+
+/* This is a 24-bit reloc with the right 1 bit assumed to be 0 */
+ BFD_RELOC_SCORE_DUMMY2,
+ BFD_RELOC_SCORE_JMP,
+
+/* This is a 19-bit reloc with the right 1 bit assumed to be 0 */
+ BFD_RELOC_SCORE_BRANCH,
+
+/* This is a 11-bit reloc with the right 1 bit assumed to be 0 */
+ BFD_RELOC_SCORE16_JMP,
+
+/* This is a 8-bit reloc with the right 1 bit assumed to be 0 */
+ BFD_RELOC_SCORE16_BRANCH,
+
+/* Undocumented Score relocs */
+ BFD_RELOC_SCORE_GOT15,
+ BFD_RELOC_SCORE_GOT_LO16,
+ BFD_RELOC_SCORE_CALL15,
+ BFD_RELOC_SCORE_DUMMY_HI16,
+
/* Scenix IP2K - 9-bit register number / data address */
BFD_RELOC_IP2K_FR9,
@@ -3342,12 +4063,110 @@ to follow the 16K memory bank of 68HC12 (seen as mapped in the window). */
This is the 5 bits of a value. */
BFD_RELOC_M68HC12_5B,
+/* NS CR16C Relocations. */
+ BFD_RELOC_16C_NUM08,
+ BFD_RELOC_16C_NUM08_C,
+ BFD_RELOC_16C_NUM16,
+ BFD_RELOC_16C_NUM16_C,
+ BFD_RELOC_16C_NUM32,
+ BFD_RELOC_16C_NUM32_C,
+ BFD_RELOC_16C_DISP04,
+ BFD_RELOC_16C_DISP04_C,
+ BFD_RELOC_16C_DISP08,
+ BFD_RELOC_16C_DISP08_C,
+ BFD_RELOC_16C_DISP16,
+ BFD_RELOC_16C_DISP16_C,
+ BFD_RELOC_16C_DISP24,
+ BFD_RELOC_16C_DISP24_C,
+ BFD_RELOC_16C_DISP24a,
+ BFD_RELOC_16C_DISP24a_C,
+ BFD_RELOC_16C_REG04,
+ BFD_RELOC_16C_REG04_C,
+ BFD_RELOC_16C_REG04a,
+ BFD_RELOC_16C_REG04a_C,
+ BFD_RELOC_16C_REG14,
+ BFD_RELOC_16C_REG14_C,
+ BFD_RELOC_16C_REG16,
+ BFD_RELOC_16C_REG16_C,
+ BFD_RELOC_16C_REG20,
+ BFD_RELOC_16C_REG20_C,
+ BFD_RELOC_16C_ABS20,
+ BFD_RELOC_16C_ABS20_C,
+ BFD_RELOC_16C_ABS24,
+ BFD_RELOC_16C_ABS24_C,
+ BFD_RELOC_16C_IMM04,
+ BFD_RELOC_16C_IMM04_C,
+ BFD_RELOC_16C_IMM16,
+ BFD_RELOC_16C_IMM16_C,
+ BFD_RELOC_16C_IMM20,
+ BFD_RELOC_16C_IMM20_C,
+ BFD_RELOC_16C_IMM24,
+ BFD_RELOC_16C_IMM24_C,
+ BFD_RELOC_16C_IMM32,
+ BFD_RELOC_16C_IMM32_C,
+
+/* NS CR16 Relocations. */
+ BFD_RELOC_CR16_NUM8,
+ BFD_RELOC_CR16_NUM16,
+ BFD_RELOC_CR16_NUM32,
+ BFD_RELOC_CR16_NUM32a,
+ BFD_RELOC_CR16_REGREL0,
+ BFD_RELOC_CR16_REGREL4,
+ BFD_RELOC_CR16_REGREL4a,
+ BFD_RELOC_CR16_REGREL14,
+ BFD_RELOC_CR16_REGREL14a,
+ BFD_RELOC_CR16_REGREL16,
+ BFD_RELOC_CR16_REGREL20,
+ BFD_RELOC_CR16_REGREL20a,
+ BFD_RELOC_CR16_ABS20,
+ BFD_RELOC_CR16_ABS24,
+ BFD_RELOC_CR16_IMM4,
+ BFD_RELOC_CR16_IMM8,
+ BFD_RELOC_CR16_IMM16,
+ BFD_RELOC_CR16_IMM20,
+ BFD_RELOC_CR16_IMM24,
+ BFD_RELOC_CR16_IMM32,
+ BFD_RELOC_CR16_IMM32a,
+ BFD_RELOC_CR16_DISP4,
+ BFD_RELOC_CR16_DISP8,
+ BFD_RELOC_CR16_DISP16,
+ BFD_RELOC_CR16_DISP20,
+ BFD_RELOC_CR16_DISP24,
+ BFD_RELOC_CR16_DISP24a,
+
+/* NS CRX Relocations. */
+ BFD_RELOC_CRX_REL4,
+ BFD_RELOC_CRX_REL8,
+ BFD_RELOC_CRX_REL8_CMP,
+ BFD_RELOC_CRX_REL16,
+ BFD_RELOC_CRX_REL24,
+ BFD_RELOC_CRX_REL32,
+ BFD_RELOC_CRX_REGREL12,
+ BFD_RELOC_CRX_REGREL22,
+ BFD_RELOC_CRX_REGREL28,
+ BFD_RELOC_CRX_REGREL32,
+ BFD_RELOC_CRX_ABS16,
+ BFD_RELOC_CRX_ABS32,
+ BFD_RELOC_CRX_NUM8,
+ BFD_RELOC_CRX_NUM16,
+ BFD_RELOC_CRX_NUM32,
+ BFD_RELOC_CRX_IMM16,
+ BFD_RELOC_CRX_IMM32,
+ BFD_RELOC_CRX_SWITCH8,
+ BFD_RELOC_CRX_SWITCH16,
+ BFD_RELOC_CRX_SWITCH32,
+
/* 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_SIGNED_8,
+ BFD_RELOC_CRIS_UNSIGNED_8,
+ BFD_RELOC_CRIS_SIGNED_16,
+ BFD_RELOC_CRIS_UNSIGNED_16,
+ BFD_RELOC_CRIS_LAPCQ_OFFSET,
BFD_RELOC_CRIS_UNSIGNED_4,
/* Relocs used in ELF shared libraries for CRIS. */
@@ -3428,17 +4247,47 @@ This is the 5 bits of a value. */
BFD_RELOC_XSTORMY16_24,
BFD_RELOC_XSTORMY16_FPTR16,
+/* Self-describing complex relocations. */
+ BFD_RELOC_RELC,
+
+
+/* Infineon Relocations. */
+ BFD_RELOC_XC16X_PAG,
+ BFD_RELOC_XC16X_POF,
+ BFD_RELOC_XC16X_SEG,
+ BFD_RELOC_XC16X_SOF,
+
/* Relocations used by VAX ELF. */
BFD_RELOC_VAX_GLOB_DAT,
BFD_RELOC_VAX_JMP_SLOT,
BFD_RELOC_VAX_RELATIVE,
+/* Morpho MT - 16 bit immediate relocation. */
+ BFD_RELOC_MT_PC16,
+
+/* Morpho MT - Hi 16 bits of an address. */
+ BFD_RELOC_MT_HI16,
+
+/* Morpho MT - Low 16 bits of an address. */
+ BFD_RELOC_MT_LO16,
+
+/* Morpho MT - Used to tell the linker which vtable entries are used. */
+ BFD_RELOC_MT_GNU_VTINHERIT,
+
+/* Morpho MT - Used to tell the linker which vtable entries are used. */
+ BFD_RELOC_MT_GNU_VTENTRY,
+
+/* Morpho MT - 8 bit immediate relocation. */
+ BFD_RELOC_MT_PCINSN8,
+
/* 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,
+ BFD_RELOC_MSP430_2X_PCREL,
+ BFD_RELOC_MSP430_RL_PCREL,
/* IQ2000 Relocations. */
BFD_RELOC_IQ2000_OFFSET_16,
@@ -3459,27 +4308,88 @@ to one of its own internal functions or data structures. */
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. */
+/* Xtensa relocations to mark the difference of two local symbols.
+These are only needed to support linker relaxation and can be ignored
+when not relaxing. The field is set to the value of the difference
+assuming no relaxation. The relocation encodes the position of the
+first symbol so the linker can determine whether to adjust the field
+value. */
+ BFD_RELOC_XTENSA_DIFF8,
+ BFD_RELOC_XTENSA_DIFF16,
+ BFD_RELOC_XTENSA_DIFF32,
+
+/* Generic Xtensa relocations for instruction operands. Only the slot
+number is encoded in the relocation. The relocation applies to the
+last PC-relative immediate operand, or if there are no PC-relative
+immediates, to the last immediate operand. */
+ BFD_RELOC_XTENSA_SLOT0_OP,
+ BFD_RELOC_XTENSA_SLOT1_OP,
+ BFD_RELOC_XTENSA_SLOT2_OP,
+ BFD_RELOC_XTENSA_SLOT3_OP,
+ BFD_RELOC_XTENSA_SLOT4_OP,
+ BFD_RELOC_XTENSA_SLOT5_OP,
+ BFD_RELOC_XTENSA_SLOT6_OP,
+ BFD_RELOC_XTENSA_SLOT7_OP,
+ BFD_RELOC_XTENSA_SLOT8_OP,
+ BFD_RELOC_XTENSA_SLOT9_OP,
+ BFD_RELOC_XTENSA_SLOT10_OP,
+ BFD_RELOC_XTENSA_SLOT11_OP,
+ BFD_RELOC_XTENSA_SLOT12_OP,
+ BFD_RELOC_XTENSA_SLOT13_OP,
+ BFD_RELOC_XTENSA_SLOT14_OP,
+
+/* Alternate Xtensa relocations. Only the slot is encoded in the
+relocation. The meaning of these relocations is opcode-specific. */
+ BFD_RELOC_XTENSA_SLOT0_ALT,
+ BFD_RELOC_XTENSA_SLOT1_ALT,
+ BFD_RELOC_XTENSA_SLOT2_ALT,
+ BFD_RELOC_XTENSA_SLOT3_ALT,
+ BFD_RELOC_XTENSA_SLOT4_ALT,
+ BFD_RELOC_XTENSA_SLOT5_ALT,
+ BFD_RELOC_XTENSA_SLOT6_ALT,
+ BFD_RELOC_XTENSA_SLOT7_ALT,
+ BFD_RELOC_XTENSA_SLOT8_ALT,
+ BFD_RELOC_XTENSA_SLOT9_ALT,
+ BFD_RELOC_XTENSA_SLOT10_ALT,
+ BFD_RELOC_XTENSA_SLOT11_ALT,
+ BFD_RELOC_XTENSA_SLOT12_ALT,
+ BFD_RELOC_XTENSA_SLOT13_ALT,
+ BFD_RELOC_XTENSA_SLOT14_ALT,
+
+/* Xtensa relocations for backward compatibility. These have all been
+replaced by BFD_RELOC_XTENSA_SLOT0_OP. */
BFD_RELOC_XTENSA_OP0,
BFD_RELOC_XTENSA_OP1,
BFD_RELOC_XTENSA_OP2,
-/* Xtensa relocation to mark that the assembler expanded the
+/* 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
+/* 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,
+
+/* 8 bit signed offset in (ix+d) or (iy+d). */
+ BFD_RELOC_Z80_DISP8,
+
+/* DJNZ offset. */
+ BFD_RELOC_Z8K_DISP7,
+
+/* CALR offset. */
+ BFD_RELOC_Z8K_CALLR,
+
+/* 4 bit value. */
+ BFD_RELOC_Z8K_IMM4L,
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);
+reloc_howto_type *bfd_reloc_name_lookup
+ (bfd *abfd, const char *reloc_name);
const char *bfd_get_reloc_code_name (bfd_reloc_code_real_type code);
@@ -3592,6 +4502,14 @@ typedef struct bfd_symbol
/* This symbol is thread local. Used in ELF. */
#define BSF_THREAD_LOCAL 0x40000
+ /* This symbol represents a complex relocation expression,
+ with the expression tree serialized in the symbol name. */
+#define BSF_RELC 0x80000
+
+ /* This symbol represents a signed complex relocation expression,
+ with the expression tree serialized in the symbol name. */
+#define BSF_SRELC 0x100000
+
flagword flags;
/* A pointer to the section to which this symbol is
@@ -3619,6 +4537,11 @@ 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))
+bfd_boolean bfd_is_target_special_symbol (bfd *abfd, asymbol *sym);
+
+#define bfd_is_target_special_symbol(abfd, sym) \
+ BFD_SEND (abfd, _bfd_is_target_special_symbol, (abfd, sym))
+
#define bfd_canonicalize_symtab(abfd, location) \
BFD_SEND (abfd, _bfd_canonicalize_symtab, (abfd, location))
@@ -3660,14 +4583,10 @@ struct bfd
/* 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. */
+ /* The IOSTREAM, and corresponding IO vector that provide access
+ to the file backing the BFD. */
void *iostream;
+ const struct bfd_iovec *iovec;
/* Is the file descriptor being cached? That is, can it be closed as
needed, and re-opened when accessed later? */
@@ -3730,8 +4649,8 @@ struct bfd
/* 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 last section on the section list. */
+ struct bfd_section *section_last;
/* The number of sections. */
unsigned int section_count;
@@ -3752,10 +4671,13 @@ struct bfd
/* Pointer to structure which contains architecture information. */
const struct bfd_arch_info *arch_info;
+ /* Flag set if symbols from this BFD should not be exported. */
+ bfd_boolean no_export;
+
/* 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_next; /* The next BFD in the archive. */
struct bfd *archive_head; /* The first BFD in the archive. */
bfd_boolean has_armap;
@@ -3837,13 +4759,14 @@ typedef enum bfd_error
bfd_error_bad_value,
bfd_error_file_truncated,
bfd_error_file_too_big,
+ bfd_error_on_input,
bfd_error_invalid_error_code
}
bfd_error_type;
bfd_error_type bfd_get_error (void);
-void bfd_set_error (bfd_error_type error_tag);
+void bfd_set_error (bfd_error_type error_tag, ...);
const char *bfd_errmsg (bfd_error_type error_tag);
@@ -3857,8 +4780,6 @@ 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
@@ -3881,6 +4802,11 @@ 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_header_data (bfd *ibfd, bfd *obfd);
+
+#define bfd_copy_private_header_data(ibfd, obfd) \
+ BFD_SEND (obfd, _bfd_copy_private_header_data, \
+ (ibfd, obfd))
bfd_boolean bfd_copy_private_bfd_data (bfd *ibfd, bfd *obfd);
#define bfd_copy_private_bfd_data(ibfd, obfd) \
@@ -3895,13 +4821,21 @@ 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_sizeof_headers(abfd, info) \
+ BFD_SEND (abfd, _bfd_sizeof_headers, (abfd, info))
#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_find_line(abfd, syms, sym, file, line) \
+ BFD_SEND (abfd, _bfd_find_line, \
+ (abfd, syms, sym, file, line))
+
+#define bfd_find_inliner_info(abfd, file, func, line) \
+ BFD_SEND (abfd, _bfd_find_inliner_info, \
+ (abfd, file, func, line))
+
#define bfd_debug_info_start(abfd) \
BFD_SEND (abfd, _bfd_debug_info_start, (abfd))
@@ -3929,6 +4863,9 @@ bfd_boolean bfd_set_private_flags (bfd *abfd, flagword flags);
#define bfd_merge_sections(abfd, link_info) \
BFD_SEND (abfd, _bfd_merge_sections, (abfd, link_info))
+#define bfd_is_group_section(abfd, sec) \
+ BFD_SEND (abfd, _bfd_is_group_section, (abfd, sec))
+
#define bfd_discard_group(abfd, sec) \
BFD_SEND (abfd, _bfd_discard_group, (abfd, sec))
@@ -3941,7 +4878,7 @@ bfd_boolean bfd_set_private_flags (bfd *abfd, flagword flags);
#define bfd_link_add_symbols(abfd, info) \
BFD_SEND (abfd, _bfd_link_add_symbols, (abfd, info))
-#define bfd_link_just_syms(sec, info) \
+#define bfd_link_just_syms(abfd, sec, info) \
BFD_SEND (abfd, _bfd_link_just_syms, (sec, info))
#define bfd_final_link(abfd, info) \
@@ -3959,6 +4896,10 @@ bfd_boolean bfd_set_private_flags (bfd *abfd, flagword flags);
#define bfd_canonicalize_dynamic_symtab(abfd, asymbols) \
BFD_SEND (abfd, _bfd_canonicalize_dynamic_symtab, (abfd, asymbols))
+#define bfd_get_synthetic_symtab(abfd, count, syms, dyncount, dynsyms, ret) \
+ BFD_SEND (abfd, _bfd_get_synthetic_symtab, (abfd, count, syms, \
+ dyncount, dynsyms, ret))
+
#define bfd_get_dynamic_reloc_upper_bound(abfd) \
BFD_SEND (abfd, _bfd_get_dynamic_reloc_upper_bound, (abfd))
@@ -3978,7 +4919,7 @@ struct bfd_preserve
flagword flags;
const struct bfd_arch_info *arch_info;
struct bfd_section *sections;
- struct bfd_section **section_tail;
+ struct bfd_section *section_last;
unsigned int section_count;
struct bfd_hash_table section_htab;
};
@@ -3989,6 +4930,16 @@ void bfd_preserve_restore (bfd *, struct bfd_preserve *);
void bfd_preserve_finish (bfd *, struct bfd_preserve *);
+bfd_vma bfd_emul_get_maxpagesize (const char *);
+
+void bfd_emul_set_maxpagesize (const char *, bfd_vma);
+
+bfd_vma bfd_emul_get_commonpagesize (const char *);
+
+void bfd_emul_set_commonpagesize (const char *, bfd_vma);
+
+char *bfd_demangle (bfd *, const char *, int);
+
/* Extracted from archive.c. */
symindex bfd_get_next_mapent
(bfd *abfd, symindex previous, carsym **sym);
@@ -4005,6 +4956,9 @@ int bfd_core_file_failing_signal (bfd *abfd);
bfd_boolean core_file_matches_executable_p
(bfd *core_bfd, bfd *exec_bfd);
+bfd_boolean generic_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)
@@ -4093,7 +5047,7 @@ typedef struct bfd_target
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.
+ other entry points, since they don't take a BFD as the 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 *);
@@ -4153,8 +5107,10 @@ typedef struct bfd_target
#define BFD_JUMP_TABLE_COPY(NAME) \
NAME##_bfd_copy_private_bfd_data, \
NAME##_bfd_merge_private_bfd_data, \
+ _bfd_generic_init_private_section_data, \
NAME##_bfd_copy_private_section_data, \
NAME##_bfd_copy_private_symbol_data, \
+ NAME##_bfd_copy_private_header_data, \
NAME##_bfd_set_private_flags, \
NAME##_bfd_print_private_bfd_data
@@ -4164,6 +5120,12 @@ typedef struct bfd_target
/* 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 initialize BFD private section data from one object file
+ to another. */
+#define bfd_init_private_section_data(ibfd, isec, obfd, osec, link_info) \
+ BFD_SEND (obfd, _bfd_init_private_section_data, (ibfd, isec, obfd, osec, link_info))
+ bfd_boolean (*_bfd_init_private_section_data)
+ (bfd *, sec_ptr, bfd *, sec_ptr, struct bfd_link_info *);
/* Called to copy BFD private section data from one object file
to another. */
bfd_boolean (*_bfd_copy_private_section_data)
@@ -4172,6 +5134,10 @@ typedef struct bfd_target
to another. */
bfd_boolean (*_bfd_copy_private_symbol_data)
(bfd *, asymbol *, bfd *, asymbol *);
+ /* Called to copy BFD private header data from one object file
+ to another. */
+ bfd_boolean (*_bfd_copy_private_header_data)
+ (bfd *, bfd *);
/* Called to set private backend flags. */
bfd_boolean (*_bfd_set_private_flags) (bfd *, flagword);
@@ -4223,8 +5189,11 @@ typedef struct bfd_target
NAME##_print_symbol, \
NAME##_get_symbol_info, \
NAME##_bfd_is_local_label_name, \
+ NAME##_bfd_is_target_special_symbol, \
NAME##_get_lineno, \
NAME##_find_nearest_line, \
+ _bfd_generic_find_line, \
+ NAME##_find_inliner_info, \
NAME##_bfd_make_debug_symbol, \
NAME##_read_minisymbols, \
NAME##_minisymbol_to_symbol
@@ -4241,11 +5210,16 @@ typedef struct bfd_target
(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 *);
-
+ bfd_boolean (*_bfd_is_target_special_symbol) (bfd *, asymbol *);
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 *);
+ bfd_boolean (*_bfd_find_line)
+ (bfd *, struct bfd_symbol **, struct bfd_symbol *,
+ const char **, unsigned int *);
+ bfd_boolean (*_bfd_find_inliner_info)
+ (bfd *, 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. */
@@ -4264,7 +5238,8 @@ typedef struct bfd_target
#define BFD_JUMP_TABLE_RELOCS(NAME) \
NAME##_get_reloc_upper_bound, \
NAME##_canonicalize_reloc, \
- NAME##_bfd_reloc_type_lookup
+ NAME##_bfd_reloc_type_lookup, \
+ NAME##_bfd_reloc_name_lookup
long (*_get_reloc_upper_bound) (bfd *, sec_ptr);
long (*_bfd_canonicalize_reloc)
@@ -4272,6 +5247,9 @@ typedef struct bfd_target
/* See documentation on reloc types. */
reloc_howto_type *
(*reloc_type_lookup) (bfd *, bfd_reloc_code_real_type);
+ reloc_howto_type *
+ (*reloc_name_lookup) (bfd *, const char *);
+
/* Routines used when writing an object file. */
#define BFD_JUMP_TABLE_WRITE(NAME) \
@@ -4296,9 +5274,11 @@ typedef struct bfd_target
NAME##_bfd_link_split_section, \
NAME##_bfd_gc_sections, \
NAME##_bfd_merge_sections, \
- NAME##_bfd_discard_group
+ NAME##_bfd_is_group_section, \
+ NAME##_bfd_discard_group, \
+ NAME##_section_already_linked \
- int (*_bfd_sizeof_headers) (bfd *, bfd_boolean);
+ int (*_bfd_sizeof_headers) (bfd *, struct bfd_link_info *);
bfd_byte * (*_bfd_get_relocated_section_contents)
(bfd *, struct bfd_link_info *, struct bfd_link_order *,
bfd_byte *, bfd_boolean, struct bfd_symbol **);
@@ -4333,13 +5313,22 @@ typedef struct bfd_target
/* Attempt to merge SEC_MERGE sections. */
bfd_boolean (*_bfd_merge_sections) (bfd *, struct bfd_link_info *);
+ /* Is this section a member of a group? */
+ bfd_boolean (*_bfd_is_group_section) (bfd *, const struct bfd_section *);
+
/* Discard members of a group. */
bfd_boolean (*_bfd_discard_group) (bfd *, struct bfd_section *);
+ /* Check if SEC has been already linked during a reloceatable or
+ final link. */
+ void (*_section_already_linked) (bfd *, struct bfd_section *,
+ struct bfd_link_info *);
+
/* 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_synthetic_symtab, \
NAME##_get_dynamic_reloc_upper_bound, \
NAME##_canonicalize_dynamic_reloc
@@ -4348,6 +5337,10 @@ typedef struct bfd_target
/* Read in the dynamic symbols. */
long (*_bfd_canonicalize_dynamic_symtab)
(bfd *, struct bfd_symbol **);
+ /* Create synthetized symbols. */
+ long (*_bfd_get_synthetic_symtab)
+ (bfd *, long, struct bfd_symbol **, long, struct bfd_symbol **,
+ 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. */
@@ -4389,6 +5382,12 @@ 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))
+void bfd_section_already_linked (bfd *abfd, asection *sec,
+ struct bfd_link_info *info);
+
+#define bfd_section_already_linked(abfd, sec, info) \
+ BFD_SEND (abfd, _section_already_linked, (abfd, sec, info))
+
/* Extracted from simple.c. */
bfd_byte *bfd_simple_get_relocated_section_contents
(bfd *abfd, asection *sec, bfd_byte *outbuf, asymbol **symbol_table);
diff --git a/contrib/binutils/bfd/bfd.c b/contrib/binutils/bfd/bfd.c
index 59e22aa..510df0a 100644
--- a/contrib/binutils/bfd/bfd.c
+++ b/contrib/binutils/bfd/bfd.c
@@ -1,6 +1,6 @@
/* Generic BFD library interface and support routines.
Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
- 2000, 2001, 2002, 2003
+ 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
Free Software Foundation, Inc.
Written by Cygnus Support.
@@ -18,7 +18,7 @@
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. */
+ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
/*
SECTION
@@ -45,14 +45,10 @@ CODE_FRAGMENT
. {* 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. *}
+. {* The IOSTREAM, and corresponding IO vector that provide access
+. to the file backing the BFD. *}
. void *iostream;
+. const struct bfd_iovec *iovec;
.
. {* Is the file descriptor being cached? That is, can it be closed as
. needed, and re-opened when accessed later? *}
@@ -115,8 +111,8 @@ CODE_FRAGMENT
. {* 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 last section on the section list. *}
+. struct bfd_section *section_last;
.
. {* The number of sections. *}
. unsigned int section_count;
@@ -137,10 +133,13 @@ CODE_FRAGMENT
. {* Pointer to structure which contains architecture information. *}
. const struct bfd_arch_info *arch_info;
.
+. {* Flag set if symbols from this BFD should not be exported. *}
+. bfd_boolean no_export;
+.
. {* 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_next; {* The next BFD in the archive. *}
. struct bfd *archive_head; {* The first BFD in the archive. *}
. bfd_boolean has_armap;
.
@@ -203,11 +202,12 @@ CODE_FRAGMENT
.
*/
-#include "bfd.h"
-#include "bfdver.h"
#include "sysdep.h"
#include <stdarg.h>
+#include "bfd.h"
+#include "bfdver.h"
#include "libiberty.h"
+#include "demangle.h"
#include "safe-ctype.h"
#include "bfdlink.h"
#include "libbfd.h"
@@ -217,6 +217,11 @@ CODE_FRAGMENT
#include "libecoff.h"
#undef obj_symbols
#include "elf-bfd.h"
+
+#ifndef EXIT_FAILURE
+#define EXIT_FAILURE 1
+#endif
+
/* 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
@@ -267,6 +272,7 @@ CODE_FRAGMENT
. bfd_error_bad_value,
. bfd_error_file_truncated,
. bfd_error_file_too_big,
+. bfd_error_on_input,
. bfd_error_invalid_error_code
.}
.bfd_error_type;
@@ -274,6 +280,8 @@ CODE_FRAGMENT
*/
static bfd_error_type bfd_error = bfd_error_no_error;
+static bfd *input_bfd = NULL;
+static bfd_error_type input_error = bfd_error_no_error;
const char *const bfd_errmsgs[] =
{
@@ -296,6 +304,7 @@ const char *const bfd_errmsgs[] =
N_("Bad value"),
N_("File truncated"),
N_("File too big"),
+ N_("Error reading %s: %s"),
N_("#<Invalid error code>")
};
@@ -321,16 +330,32 @@ FUNCTION
bfd_set_error
SYNOPSIS
- void bfd_set_error (bfd_error_type error_tag);
+ void bfd_set_error (bfd_error_type error_tag, ...);
DESCRIPTION
Set the BFD error condition to be @var{error_tag}.
+ If @var{error_tag} is bfd_error_on_input, then this function
+ takes two more parameters, the input bfd where the error
+ occurred, and the bfd_error_type error.
*/
void
-bfd_set_error (bfd_error_type error_tag)
+bfd_set_error (bfd_error_type error_tag, ...)
{
bfd_error = error_tag;
+ if (error_tag == bfd_error_on_input)
+ {
+ /* This is an error that occurred during bfd_close when
+ writing an archive, but on one of the input files. */
+ va_list ap;
+
+ va_start (ap, error_tag);
+ input_bfd = va_arg (ap, bfd *);
+ input_error = va_arg (ap, int);
+ if (input_error >= bfd_error_on_input)
+ abort ();
+ va_end (ap);
+ }
}
/*
@@ -351,6 +376,19 @@ bfd_errmsg (bfd_error_type error_tag)
#ifndef errno
extern int errno;
#endif
+ if (error_tag == bfd_error_on_input)
+ {
+ char *buf;
+ const char *msg = bfd_errmsg (input_error);
+
+ if (asprintf (&buf, _(bfd_errmsgs [error_tag]), input_bfd->filename, msg)
+ != -1)
+ return buf;
+
+ /* Ick, what to do on out of memory? */
+ return msg;
+ }
+
if (error_tag == bfd_error_system_call)
return xstrerror (errno);
@@ -378,16 +416,10 @@ DESCRIPTION
void
bfd_perror (const char *message)
{
- if (bfd_get_error () == bfd_error_system_call)
- /* Must be a system error then. */
- perror ((char *) message);
+ if (message == NULL || *message == '\0')
+ fprintf (stderr, "%s\n", bfd_errmsg (bfd_get_error ()));
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 ()));
- }
+ fprintf (stderr, "%s: %s\n", message, bfd_errmsg (bfd_get_error ()));
}
/*
@@ -410,23 +442,177 @@ CODE_FRAGMENT
static const char *_bfd_error_program_name;
-/* This is the default routine to handle BFD error messages. */
+/* This is the default routine to handle BFD error messages.
+ Like fprintf (stderr, ...), but also handles some extra format specifiers.
-static void
-_bfd_default_error_handler (const char *s, ...)
+ %A section name from section. For group components, print group name too.
+ %B file name from bfd. For archive components, prints archive too.
+
+ Note - because these two extra format specifiers require special handling
+ they are scanned for and processed in this function, before calling
+ vfprintf. This means that the *arguments* for these format specifiers
+ must be the first ones in the variable argument list, regardless of where
+ the specifiers appear in the format string. Thus for example calling
+ this function with a format string of:
+
+ "blah %s blah %A blah %d blah %B"
+
+ would involve passing the arguments as:
+
+ "blah %s blah %A blah %d blah %B",
+ asection_for_the_%A,
+ bfd_for_the_%B,
+ string_for_the_%s,
+ integer_for_the_%d);
+ */
+
+void
+_bfd_default_error_handler (const char *fmt, ...)
{
- va_list p;
+ va_list ap;
+ char *bufp;
+ const char *new_fmt, *p;
+ size_t avail = 1000;
+ char buf[1000];
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);
+ va_start (ap, fmt);
+ new_fmt = fmt;
+ bufp = buf;
+
+ /* Reserve enough space for the existing format string. */
+ avail -= strlen (fmt) + 1;
+ if (avail > 1000)
+ _exit (EXIT_FAILURE);
+
+ p = fmt;
+ while (1)
+ {
+ char *q;
+ size_t len, extra, trim;
+
+ p = strchr (p, '%');
+ if (p == NULL || p[1] == '\0')
+ {
+ if (new_fmt == buf)
+ {
+ len = strlen (fmt);
+ memcpy (bufp, fmt, len + 1);
+ }
+ break;
+ }
+
+ if (p[1] == 'A' || p[1] == 'B')
+ {
+ len = p - fmt;
+ memcpy (bufp, fmt, len);
+ bufp += len;
+ fmt = p + 2;
+ new_fmt = buf;
+
+ /* If we run out of space, tough, you lose your ridiculously
+ long file or section name. It's not safe to try to alloc
+ memory here; We might be printing an out of memory message. */
+ if (avail == 0)
+ {
+ *bufp++ = '*';
+ *bufp++ = '*';
+ *bufp = '\0';
+ }
+ else
+ {
+ if (p[1] == 'B')
+ {
+ bfd *abfd = va_arg (ap, bfd *);
+
+ if (abfd == NULL)
+ /* Invoking %B with a null bfd pointer is an internal error. */
+ abort ();
+ else if (abfd->my_archive)
+ snprintf (bufp, avail, "%s(%s)",
+ abfd->my_archive->filename, abfd->filename);
+ else
+ snprintf (bufp, avail, "%s", abfd->filename);
+ }
+ else
+ {
+ asection *sec = va_arg (ap, asection *);
+ bfd *abfd;
+ const char *group = NULL;
+ struct coff_comdat_info *ci;
+
+ if (sec == NULL)
+ /* Invoking %A with a null section pointer is an internal error. */
+ abort ();
+ abfd = sec->owner;
+ if (abfd != NULL
+ && bfd_get_flavour (abfd) == bfd_target_elf_flavour
+ && elf_next_in_group (sec) != NULL
+ && (sec->flags & SEC_GROUP) == 0)
+ group = elf_group_name (sec);
+ else if (abfd != NULL
+ && bfd_get_flavour (abfd) == bfd_target_coff_flavour
+ && (ci = bfd_coff_get_comdat_section (sec->owner,
+ sec)) != NULL)
+ group = ci->name;
+ if (group != NULL)
+ snprintf (bufp, avail, "%s[%s]", sec->name, group);
+ else
+ snprintf (bufp, avail, "%s", sec->name);
+ }
+ len = strlen (bufp);
+ avail = avail - len + 2;
+
+ /* We need to replace any '%' we printed by "%%".
+ First count how many. */
+ q = bufp;
+ bufp += len;
+ extra = 0;
+ while ((q = strchr (q, '%')) != NULL)
+ {
+ ++q;
+ ++extra;
+ }
+
+ /* If there isn't room, trim off the end of the string. */
+ q = bufp;
+ bufp += extra;
+ if (extra > avail)
+ {
+ trim = extra - avail;
+ bufp -= trim;
+ do
+ {
+ if (*--q == '%')
+ --extra;
+ }
+ while (--trim != 0);
+ *q = '\0';
+ avail = extra;
+ }
+ avail -= extra;
+
+ /* Now double all '%' chars, shuffling the string as we go. */
+ while (extra != 0)
+ {
+ while ((q[extra] = *q) != '%')
+ --q;
+ q[--extra] = '%';
+ --q;
+ }
+ }
+ }
+ p = p + 2;
+ }
+
+ vfprintf (stderr, new_fmt, ap);
+ va_end (ap);
- fprintf (stderr, "\n");
+ putc ('\n', stderr);
}
/* This is a function pointer to the routine which should handle BFD
@@ -495,60 +681,13 @@ 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
+ Miscellaneous
+
+SUBSECTION
+ Miscellaneous functions
*/
/*
@@ -694,10 +833,6 @@ bfd_assert (const char *file, int 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)
{
@@ -710,7 +845,7 @@ _bfd_abort (const char *file, int line, const char *fn)
(_("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);
+ _exit (EXIT_FAILURE);
}
/*
@@ -769,12 +904,16 @@ bfd_get_sign_extend_vma (bfd *abfd)
name = bfd_get_target (abfd);
- /* Return a proper value for DJGPP COFF (an x86 COFF variant).
+ /* Return a proper value for DJGPP & PE COFF.
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)
+ if (CONST_STRNEQ (name, "coff-go32")
+ || strcmp (name, "pe-i386") == 0
+ || strcmp (name, "pei-i386") == 0
+ || strcmp (name, "pe-arm-wince-little") == 0
+ || strcmp (name, "pei-arm-wince-little") == 0)
return 1;
bfd_set_error (bfd_error_wrong_format);
@@ -984,6 +1123,29 @@ bfd_scan_vma (const char *string, const char **end, int base)
/*
FUNCTION
+ bfd_copy_private_header_data
+
+SYNOPSIS
+ bfd_boolean bfd_copy_private_header_data (bfd *ibfd, bfd *obfd);
+
+DESCRIPTION
+ Copy private BFD header information from the BFD @var{ibfd} to the
+ the BFD @var{obfd}. This copies information that may require
+ sections to exist, but does not require symbol tables. 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_header_data(ibfd, obfd) \
+. BFD_SEND (obfd, _bfd_copy_private_header_data, \
+. (ibfd, obfd))
+
+*/
+
+/*
+FUNCTION
bfd_copy_private_bfd_data
SYNOPSIS
@@ -1051,13 +1213,21 @@ FUNCTION
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_sizeof_headers(abfd, info) \
+. BFD_SEND (abfd, _bfd_sizeof_headers, (abfd, info))
.
.#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_find_line(abfd, syms, sym, file, line) \
+. BFD_SEND (abfd, _bfd_find_line, \
+. (abfd, syms, sym, file, line))
+.
+.#define bfd_find_inliner_info(abfd, file, func, line) \
+. BFD_SEND (abfd, _bfd_find_inliner_info, \
+. (abfd, file, func, line))
+.
.#define bfd_debug_info_start(abfd) \
. BFD_SEND (abfd, _bfd_debug_info_start, (abfd))
.
@@ -1085,6 +1255,9 @@ DESCRIPTION
.#define bfd_merge_sections(abfd, link_info) \
. BFD_SEND (abfd, _bfd_merge_sections, (abfd, link_info))
.
+.#define bfd_is_group_section(abfd, sec) \
+. BFD_SEND (abfd, _bfd_is_group_section, (abfd, sec))
+.
.#define bfd_discard_group(abfd, sec) \
. BFD_SEND (abfd, _bfd_discard_group, (abfd, sec))
.
@@ -1097,7 +1270,7 @@ DESCRIPTION
.#define bfd_link_add_symbols(abfd, info) \
. BFD_SEND (abfd, _bfd_link_add_symbols, (abfd, info))
.
-.#define bfd_link_just_syms(sec, info) \
+.#define bfd_link_just_syms(abfd, sec, info) \
. BFD_SEND (abfd, _bfd_link_just_syms, (sec, info))
.
.#define bfd_final_link(abfd, info) \
@@ -1115,6 +1288,10 @@ DESCRIPTION
.#define bfd_canonicalize_dynamic_symtab(abfd, asymbols) \
. BFD_SEND (abfd, _bfd_canonicalize_dynamic_symtab, (abfd, asymbols))
.
+.#define bfd_get_synthetic_symtab(abfd, count, syms, dyncount, dynsyms, ret) \
+. BFD_SEND (abfd, _bfd_get_synthetic_symtab, (abfd, count, syms, \
+. dyncount, dynsyms, ret))
+.
.#define bfd_get_dynamic_reloc_upper_bound(abfd) \
. BFD_SEND (abfd, _bfd_get_dynamic_reloc_upper_bound, (abfd))
.
@@ -1176,11 +1353,10 @@ bfd_record_phdr (bfd *abfd,
amt = sizeof (struct elf_segment_map);
amt += ((bfd_size_type) count - 1) * sizeof (asection *);
- m = bfd_alloc (abfd, amt);
+ m = bfd_zalloc (abfd, amt);
if (m == NULL)
return FALSE;
- m->next = NULL;
m->p_type = type;
m->p_flags = flags;
m->p_paddr = at;
@@ -1213,6 +1389,15 @@ 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);
+#ifdef BFD64
+ /* fprintf_vma() on a 64-bit enabled host will always print a 64-bit
+ value, but really we want to display the address in the target's
+ address size. Since we do not have a field in the bfd structure
+ to tell us this, we take a guess, based on the target's name. */
+ else if (strstr (bfd_get_target (abfd), "64") == NULL
+ && strcmp (bfd_get_target (abfd), "mmo") != 0)
+ fprintf ((FILE *) stream, "%08lx", (unsigned long) (value & 0xffffffff));
+#endif
else
fprintf_vma ((FILE *) stream, value);
}
@@ -1280,7 +1465,7 @@ CODE_FRAGMENT
. flagword flags;
. const struct bfd_arch_info *arch_info;
. struct bfd_section *sections;
-. struct bfd_section **section_tail;
+. struct bfd_section *section_last;
. unsigned int section_count;
. struct bfd_hash_table section_htab;
.};
@@ -1314,18 +1499,19 @@ bfd_preserve_save (bfd *abfd, struct bfd_preserve *preserve)
preserve->arch_info = abfd->arch_info;
preserve->flags = abfd->flags;
preserve->sections = abfd->sections;
- preserve->section_tail = abfd->section_tail;
+ preserve->section_last = abfd->section_last;
preserve->section_count = abfd->section_count;
preserve->section_htab = abfd->section_htab;
- if (! bfd_hash_table_init (&abfd->section_htab, bfd_section_hash_newfunc))
+ if (! bfd_hash_table_init (&abfd->section_htab, bfd_section_hash_newfunc,
+ sizeof (struct section_hash_entry)))
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_last = NULL;
abfd->section_count = 0;
return TRUE;
@@ -1355,7 +1541,7 @@ bfd_preserve_restore (bfd *abfd, struct bfd_preserve *preserve)
abfd->flags = preserve->flags;
abfd->section_htab = preserve->section_htab;
abfd->sections = preserve->sections;
- abfd->section_tail = preserve->section_tail;
+ abfd->section_last = preserve->section_last;
abfd->section_count = preserve->section_count;
/* bfd_release frees all memory more recently bfd_alloc'd than
@@ -1390,3 +1576,212 @@ bfd_preserve_finish (bfd *abfd ATTRIBUTE_UNUSED, struct bfd_preserve *preserve)
objalloc. */
bfd_hash_table_free (&preserve->section_htab);
}
+
+/*
+FUNCTION
+ bfd_emul_get_maxpagesize
+
+SYNOPSIS
+ bfd_vma bfd_emul_get_maxpagesize (const char *);
+
+DESCRIPTION
+ Returns the maximum page size, in bytes, as determined by
+ emulation.
+
+RETURNS
+ Returns the maximum page size in bytes for ELF, abort
+ otherwise.
+*/
+
+bfd_vma
+bfd_emul_get_maxpagesize (const char *emul)
+{
+ const bfd_target *target;
+
+ target = bfd_find_target (emul, NULL);
+ if (target != NULL
+ && target->flavour == bfd_target_elf_flavour)
+ return xvec_get_elf_backend_data (target)->maxpagesize;
+
+ abort ();
+ return 0;
+}
+
+static void
+bfd_elf_set_pagesize (const bfd_target *target, bfd_vma size,
+ int offset, const bfd_target *orig_target)
+{
+ if (target->flavour == bfd_target_elf_flavour)
+ {
+ const struct elf_backend_data *bed;
+
+ bed = xvec_get_elf_backend_data (target);
+ *((bfd_vma *) ((char *) bed + offset)) = size;
+ }
+
+ if (target->alternative_target
+ && target->alternative_target != orig_target)
+ bfd_elf_set_pagesize (target->alternative_target, size, offset,
+ orig_target);
+}
+
+/*
+FUNCTION
+ bfd_emul_set_maxpagesize
+
+SYNOPSIS
+ void bfd_emul_set_maxpagesize (const char *, bfd_vma);
+
+DESCRIPTION
+ For ELF, set the maximum page size for the emulation. It is
+ a no-op for other formats.
+
+*/
+
+void
+bfd_emul_set_maxpagesize (const char *emul, bfd_vma size)
+{
+ const bfd_target *target;
+
+ target = bfd_find_target (emul, NULL);
+ if (target)
+ bfd_elf_set_pagesize (target, size,
+ offsetof (struct elf_backend_data,
+ maxpagesize), target);
+}
+
+/*
+FUNCTION
+ bfd_emul_get_commonpagesize
+
+SYNOPSIS
+ bfd_vma bfd_emul_get_commonpagesize (const char *);
+
+DESCRIPTION
+ Returns the common page size, in bytes, as determined by
+ emulation.
+
+RETURNS
+ Returns the common page size in bytes for ELF, abort otherwise.
+*/
+
+bfd_vma
+bfd_emul_get_commonpagesize (const char *emul)
+{
+ const bfd_target *target;
+
+ target = bfd_find_target (emul, NULL);
+ if (target != NULL
+ && target->flavour == bfd_target_elf_flavour)
+ return xvec_get_elf_backend_data (target)->commonpagesize;
+
+ abort ();
+ return 0;
+}
+
+/*
+FUNCTION
+ bfd_emul_set_commonpagesize
+
+SYNOPSIS
+ void bfd_emul_set_commonpagesize (const char *, bfd_vma);
+
+DESCRIPTION
+ For ELF, set the common page size for the emulation. It is
+ a no-op for other formats.
+
+*/
+
+void
+bfd_emul_set_commonpagesize (const char *emul, bfd_vma size)
+{
+ const bfd_target *target;
+
+ target = bfd_find_target (emul, NULL);
+ if (target)
+ bfd_elf_set_pagesize (target, size,
+ offsetof (struct elf_backend_data,
+ commonpagesize), target);
+}
+
+/*
+FUNCTION
+ bfd_demangle
+
+SYNOPSIS
+ char *bfd_demangle (bfd *, const char *, int);
+
+DESCRIPTION
+ Wrapper around cplus_demangle. Strips leading underscores and
+ other such chars that would otherwise confuse the demangler.
+ If passed a g++ v3 ABI mangled name, returns a buffer allocated
+ with malloc holding the demangled name. Returns NULL otherwise
+ and on memory alloc failure.
+*/
+
+char *
+bfd_demangle (bfd *abfd, const char *name, int options)
+{
+ char *res, *alloc;
+ const char *pre, *suf;
+ size_t pre_len;
+
+ if (abfd != NULL
+ && *name != '\0'
+ && bfd_get_symbol_leading_char (abfd) == *name)
+ ++name;
+
+ /* This is a hack for better error reporting on XCOFF, PowerPC64-ELF
+ or the MS PE format. These formats have a number of leading '.'s
+ on at least some symbols, so we remove all dots to avoid
+ confusing the demangler. */
+ pre = name;
+ while (*name == '.' || *name == '$')
+ ++name;
+ pre_len = name - pre;
+
+ /* Strip off @plt and suchlike too. */
+ alloc = NULL;
+ suf = strchr (name, '@');
+ if (suf != NULL)
+ {
+ alloc = bfd_malloc (suf - name + 1);
+ if (alloc == NULL)
+ return NULL;
+ memcpy (alloc, name, suf - name);
+ alloc[suf - name] = '\0';
+ name = alloc;
+ }
+
+ res = cplus_demangle (name, options);
+
+ if (alloc != NULL)
+ free (alloc);
+
+ if (res == NULL)
+ return NULL;
+
+ /* Put back any prefix or suffix. */
+ if (pre_len != 0 || suf != NULL)
+ {
+ size_t len;
+ size_t suf_len;
+ char *final;
+
+ len = strlen (res);
+ if (suf == NULL)
+ suf = res + len;
+ suf_len = strlen (suf) + 1;
+ final = bfd_malloc (pre_len + len + suf_len);
+ if (final != NULL)
+ {
+ memcpy (final, pre, pre_len);
+ memcpy (final + pre_len, res, len);
+ memcpy (final + pre_len + len, suf, suf_len);
+ }
+ free (res);
+ res = final;
+ }
+
+ return res;
+}
diff --git a/contrib/binutils/bfd/bfdio.c b/contrib/binutils/bfd/bfdio.c
index a90cb33..0df25c3 100644
--- a/contrib/binutils/bfd/bfdio.c
+++ b/contrib/binutils/bfd/bfdio.c
@@ -1,7 +1,8 @@
/* 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.
+ 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
+ Free Software Foundation, Inc.
Written by Cygnus Support.
@@ -19,15 +20,13 @@ 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. */
+Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
#include "sysdep.h"
-
+#include <limits.h>
#include "bfd.h"
#include "libbfd.h"
-#include <limits.h>
-
#ifndef S_IXUSR
#define S_IXUSR 0100 /* Execute by owner. */
#endif
@@ -62,38 +61,52 @@ real_fseek (FILE *file, file_ptr offset, int 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)
+FILE *
+real_fopen (const char *filename, const char *modes)
{
- /* 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);
+#if defined (HAVE_FOPEN64)
+ return fopen64 (filename, modes);
#else
- return fread (where, a, b, file);
+ return fopen (filename, modes);
#endif
}
+/*
+INTERNAL_DEFINITION
+ struct bfd_iovec
+
+DESCRIPTION
+
+ The <<struct bfd_iovec>> contains the internal file I/O class.
+ Each <<BFD>> has an instance of this class and all file I/O is
+ routed through it (it is assumed that the instance implements
+ all methods listed below).
+
+.struct bfd_iovec
+.{
+. {* To avoid problems with macros, a "b" rather than "f"
+. prefix is prepended to each method name. *}
+. {* Attempt to read/write NBYTES on ABFD's IOSTREAM storing/fetching
+. bytes starting at PTR. Return the number of bytes actually
+. transfered (a read past end-of-file returns less than NBYTES),
+. or -1 (setting <<bfd_error>>) if an error occurs. *}
+. file_ptr (*bread) (struct bfd *abfd, void *ptr, file_ptr nbytes);
+. file_ptr (*bwrite) (struct bfd *abfd, const void *ptr,
+. file_ptr nbytes);
+. {* Return the current IOSTREAM file offset, or -1 (setting <<bfd_error>>
+. if an error occurs. *}
+. file_ptr (*btell) (struct bfd *abfd);
+. {* For the following, on successful completion a value of 0 is returned.
+. Otherwise, a value of -1 is returned (and <<bfd_error>> is set). *}
+. int (*bseek) (struct bfd *abfd, file_ptr offset, int whence);
+. int (*bclose) (struct bfd *abfd);
+. int (*bflush) (struct bfd *abfd);
+. int (*bstat) (struct bfd *abfd, struct stat *sb);
+.};
+
+*/
+
+
/* Return value is amount read. */
bfd_size_type
@@ -101,6 +114,15 @@ bfd_bread (void *ptr, bfd_size_type size, bfd *abfd)
{
size_t nread;
+ /* If this is an archive element, don't read past the end of
+ this element. */
+ if (abfd->arelt_data != NULL)
+ {
+ size_t maxbytes = ((struct areltdata *) abfd->arelt_data)->parsed_size;
+ if (size > maxbytes)
+ size = maxbytes;
+ }
+
if ((abfd->flags & BFD_IN_MEMORY) != 0)
{
struct bfd_in_memory *bim;
@@ -121,25 +143,13 @@ bfd_bread (void *ptr, bfd_size_type size, bfd *abfd)
return get;
}
- nread = real_read (ptr, 1, (size_t) size, bfd_cache_lookup (abfd));
+ if (abfd->iovec)
+ nread = abfd->iovec->bread (abfd, ptr, size);
+ else
+ nread = 0;
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;
}
@@ -151,6 +161,7 @@ bfd_bwrite (const void *ptr, bfd_size_type size, bfd *abfd)
if ((abfd->flags & BFD_IN_MEMORY) != 0)
{
struct bfd_in_memory *bim = abfd->iostream;
+
size = (size_t) size;
if (abfd->where + size > bim->size)
{
@@ -175,7 +186,11 @@ bfd_bwrite (const void *ptr, bfd_size_type size, bfd *abfd)
return size;
}
- nwrote = fwrite (ptr, 1, (size_t) size, bfd_cache_lookup (abfd));
+ if (abfd->iovec)
+ nwrote = abfd->iovec->bwrite (abfd, ptr, size);
+ else
+ nwrote = 0;
+
if (nwrote != (size_t) -1)
abfd->where += nwrote;
if (nwrote != size)
@@ -196,10 +211,16 @@ bfd_tell (bfd *abfd)
if ((abfd->flags & BFD_IN_MEMORY) != 0)
return abfd->where;
- ptr = real_ftell (bfd_cache_lookup (abfd));
+ if (abfd->iovec)
+ {
+ ptr = abfd->iovec->btell (abfd);
+
+ if (abfd->my_archive)
+ ptr -= abfd->origin;
+ }
+ else
+ ptr = 0;
- if (abfd->my_archive)
- ptr -= abfd->origin;
abfd->where = ptr;
return ptr;
}
@@ -209,7 +230,10 @@ bfd_flush (bfd *abfd)
{
if ((abfd->flags & BFD_IN_MEMORY) != 0)
return 0;
- return fflush (bfd_cache_lookup(abfd));
+
+ if (abfd->iovec)
+ return abfd->iovec->bflush (abfd);
+ return 0;
}
/* Returns 0 for success, negative value for failure (in which case
@@ -217,19 +241,16 @@ bfd_flush (bfd *abfd)
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 (abfd->iovec)
+ result = abfd->iovec->bstat (abfd, statbuf);
+ else
+ result = -1;
+
if (result < 0)
bfd_set_error (bfd_error_system_call);
return result;
@@ -242,7 +263,6 @@ 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
@@ -270,6 +290,7 @@ bfd_seek (bfd *abfd, file_ptr position, int 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 */
@@ -296,20 +317,6 @@ bfd_seek (bfd *abfd, file_ptr position, int direction)
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;
}
@@ -328,12 +335,15 @@ bfd_seek (bfd *abfd, file_ptr position, int direction)
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 (abfd->iovec)
+ result = abfd->iovec->bseek (abfd, file_position, direction);
+ else
+ result = -1;
+
if (result != 0)
{
int hold_errno = errno;
@@ -378,14 +388,15 @@ DESCRIPTION
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))
+ if (abfd->iovec == NULL)
+ return 0;
+
+ if (abfd->iovec->bstat (abfd, &buf) != 0)
return 0;
abfd->mtime = buf.st_mtime; /* Save value in case anyone wants it */
@@ -397,7 +408,7 @@ FUNCTION
bfd_get_size
SYNOPSIS
- long bfd_get_size (bfd *abfd);
+ file_ptr bfd_get_size (bfd *abfd);
DESCRIPTION
Return the file size (as read from file system) for the file
@@ -425,17 +436,18 @@ DESCRIPTION
size reasonable?".
*/
-long
+file_ptr
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))
+ if (abfd->iovec == NULL)
+ return 0;
+
+ if (abfd->iovec->bstat (abfd, &buf) != 0)
return 0;
return buf.st_size;
diff --git a/contrib/binutils/bfd/bfdwin.c b/contrib/binutils/bfd/bfdwin.c
index fb7c967..7236906 100644
--- a/contrib/binutils/bfd/bfdwin.c
+++ b/contrib/binutils/bfd/bfdwin.c
@@ -1,5 +1,6 @@
/* Support for memory-mapped windows into a BFD.
- Copyright 1995, 1996, 2001, 2002, 2003 Free Software Foundation, Inc.
+ Copyright 1995, 1996, 2001, 2002, 2003, 2005
+ Free Software Foundation, Inc.
Written by Cygnus Support.
This file is part of BFD, the Binary File Descriptor library.
@@ -16,7 +17,7 @@ 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. */
+Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
#include "sysdep.h"
@@ -144,7 +145,6 @@ bfd_get_file_window (bfd *abfd,
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)
@@ -152,8 +152,13 @@ bfd_get_file_window (bfd *abfd,
offset += abfd->origin;
abfd = abfd->my_archive;
}
- f = bfd_cache_lookup (abfd);
- fd = fileno (f);
+
+ /* Seek into the file, to ensure it is open if cacheable. */
+ if (abfd->iostream == NULL
+ && (abfd->iovec == NULL
+ || abfd->iovec->bseek (abfd, offset, SEEK_SET) != 0))
+ return FALSE;
+ fd = fileno ((FILE *) abfd->iostream);
/* Compute offsets and size for mmap and for the user's data. */
offset2 = offset % pagesize;
diff --git a/contrib/binutils/bfd/binary.c b/contrib/binutils/bfd/binary.c
index 65f46af..b5347dd 100644
--- a/contrib/binutils/bfd/binary.c
+++ b/contrib/binutils/bfd/binary.c
@@ -1,6 +1,6 @@
/* BFD back-end for binary objects.
- Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
- Free Software Foundation, Inc.
+ Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
+ 2004, 2005, 2006, 2007 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.
@@ -17,7 +17,7 @@
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. */
+ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, 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
@@ -32,8 +32,8 @@
the file. objcopy cooperates by specially setting the start
address to zero by default. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "safe-ctype.h"
#include "libbfd.h"
@@ -41,18 +41,6 @@
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;
@@ -61,8 +49,7 @@ 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;
+binary_mkobject (bfd *abfd ATTRIBUTE_UNUSED)
{
return TRUE;
}
@@ -72,11 +59,11 @@ binary_mkobject (abfd)
being binary. */
static const bfd_target *
-binary_object_p (abfd)
- bfd *abfd;
+binary_object_p (bfd *abfd)
{
struct stat statbuf;
asection *sec;
+ flagword flags;
if (abfd->target_defaulted)
{
@@ -94,15 +81,15 @@ binary_object_p (abfd)
}
/* One data section. */
- sec = bfd_make_section (abfd, ".data");
+ flags = SEC_ALLOC | SEC_LOAD | SEC_DATA | SEC_HAS_CONTENTS;
+ sec = bfd_make_section_with_flags (abfd, ".data", flags);
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->size = statbuf.st_size;
sec->filepos = 0;
- abfd->tdata.any = (PTR) sec;
+ abfd->tdata.any = (void *) sec;
if (bfd_get_arch_info (abfd) != NULL)
{
@@ -115,19 +102,18 @@ binary_object_p (abfd)
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
+#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;
+binary_get_section_contents (bfd *abfd,
+ asection *section ATTRIBUTE_UNUSED,
+ void * location,
+ file_ptr offset,
+ bfd_size_type count)
{
if (bfd_seek (abfd, offset, SEEK_SET) != 0
|| bfd_bread (location, count, abfd) != count)
@@ -138,8 +124,7 @@ binary_get_section_contents (abfd, section, location, offset, count)
/* Return the amount of memory needed to read the symbol table. */
static long
-binary_get_symtab_upper_bound (abfd)
- bfd *abfd ATTRIBUTE_UNUSED;
+binary_get_symtab_upper_bound (bfd *abfd ATTRIBUTE_UNUSED)
{
return (BIN_SYMS + 1) * sizeof (asymbol *);
}
@@ -147,9 +132,7 @@ binary_get_symtab_upper_bound (abfd)
/* Create a symbol name based on the bfd's filename. */
static char *
-mangle_name (abfd, suffix)
- bfd *abfd;
- char *suffix;
+mangle_name (bfd *abfd, char *suffix)
{
bfd_size_type size;
char *buf;
@@ -159,7 +142,7 @@ mangle_name (abfd, suffix)
+ strlen (suffix)
+ sizeof "_binary__");
- buf = (char *) bfd_alloc (abfd, size);
+ buf = bfd_alloc (abfd, size);
if (buf == NULL)
return "";
@@ -176,16 +159,14 @@ mangle_name (abfd, suffix)
/* Return the symbol table. */
static long
-binary_canonicalize_symtab (abfd, alocation)
- bfd *abfd;
- asymbol **alocation;
+binary_canonicalize_symtab (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);
+ syms = bfd_alloc (abfd, amt);
if (syms == NULL)
return 0;
@@ -200,7 +181,7 @@ binary_canonicalize_symtab (abfd, alocation)
/* End symbol. */
syms[1].the_bfd = abfd;
syms[1].name = mangle_name (abfd, "end");
- syms[1].value = sec->_raw_size;
+ syms[1].value = sec->size;
syms[1].flags = BSF_GLOBAL;
syms[1].section = sec;
syms[1].udata.p = NULL;
@@ -208,7 +189,7 @@ binary_canonicalize_symtab (abfd, alocation)
/* Size symbol. */
syms[2].the_bfd = abfd;
syms[2].name = mangle_name (abfd, "size");
- syms[2].value = sec->_raw_size;
+ syms[2].value = sec->size;
syms[2].flags = BSF_GLOBAL;
syms[2].section = bfd_abs_section_ptr;
syms[2].udata.p = NULL;
@@ -220,32 +201,27 @@ binary_canonicalize_symtab (abfd, alocation)
return BIN_SYMS;
}
-#define binary_make_empty_symbol _bfd_generic_make_empty_symbol
-#define binary_print_symbol _bfd_nosymbols_print_symbol
+#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;
+binary_get_symbol_info (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
+#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_find_inliner_info _bfd_nosymbols_find_inliner_info
+#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_bfd_is_target_special_symbol ((bfd_boolean (*) (bfd *, asymbol *)) bfd_false)
/* Set the architecture of a binary file. */
#define binary_set_arch_mach _bfd_generic_set_arch_mach
@@ -253,12 +229,11 @@ binary_get_symbol_info (ignore_abfd, symbol, ret)
/* 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;
+binary_set_section_contents (bfd *abfd,
+ asection *sec,
+ const void * data,
+ file_ptr offset,
+ bfd_size_type size)
{
if (size == 0)
return TRUE;
@@ -278,7 +253,7 @@ binary_set_section_contents (abfd, sec, data, offset, size)
if (((s->flags
& (SEC_HAS_CONTENTS | SEC_LOAD | SEC_ALLOC | SEC_NEVER_LOAD))
== (SEC_HAS_CONTENTS | SEC_LOAD | SEC_ALLOC))
- && (s->_raw_size > 0)
+ && (s->size > 0)
&& (! found_low || s->lma < low))
{
low = s->lma;
@@ -294,7 +269,7 @@ binary_set_section_contents (abfd, sec, data, offset, size)
if ((s->flags
& (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_NEVER_LOAD))
!= (SEC_HAS_CONTENTS | SEC_ALLOC)
- || (s->_raw_size == 0))
+ || (s->size == 0))
continue;
/* If attempting to generate a binary file from a bfd with
@@ -327,27 +302,26 @@ binary_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;
+binary_sizeof_headers (bfd *abfd ATTRIBUTE_UNUSED,
+ struct bfd_link_info *info 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
+#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_is_group_section bfd_generic_is_group_section
+#define binary_bfd_discard_group bfd_generic_discard_group
+#define binary_section_already_linked _bfd_generic_section_already_linked
+#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 =
{
@@ -369,7 +343,7 @@ const bfd_target binary_vec =
bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* hdrs */
{ /* bfd_check_format */
_bfd_dummy_target,
- binary_object_p, /* bfd_check_format */
+ binary_object_p,
_bfd_dummy_target,
_bfd_dummy_target,
},
@@ -391,7 +365,7 @@ const bfd_target binary_vec =
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_RELOCS (_bfd_norelocs),
BFD_JUMP_TABLE_WRITE (binary),
BFD_JUMP_TABLE_LINK (binary),
BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
diff --git a/contrib/binutils/bfd/bout.c b/contrib/binutils/bfd/bout.c
index a39a9a3..fe13212 100644
--- a/contrib/binutils/bfd/bout.c
+++ b/contrib/binutils/bfd/bout.c
@@ -1,128 +1,110 @@
/* BFD back-end for Intel 960 b.out binaries.
Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
- 2000, 2001, 2002, 2003
+ 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
Free Software Foundation, Inc.
Written by Cygnus Support.
-This file is part of BFD, the Binary File Descriptor library.
+ 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 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.
+ 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. */
+ 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., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
#include "bfdlink.h"
#include "genlink.h"
#include "bout.h"
+#include "libiberty.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 *));
+#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),
+};
/* 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;
+static void
+bout_swap_exec_header_in (bfd *abfd,
+ struct external_exec *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_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;
+static void
+bout_swap_exec_header_out (bfd *abfd,
+ struct internal_exec *execp,
+ struct external_exec *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);
@@ -134,54 +116,26 @@ bout_swap_exec_header_out (abfd, execp, raw_bytes)
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_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;
+b_out_callback (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 */
- );
+ 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);
@@ -200,30 +154,56 @@ b_out_callback (abfd)
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;
+ obj_textsec (abfd)->size = execp->a_text;
- bss_start = execp->a_dload + execp->a_data; /* BSS = end of data section */
+ 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);
+ 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);
+ 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;
+ 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;
}
+static const bfd_target *
+b_out_object_p (bfd *abfd)
+{
+ struct internal_exec anexec;
+ struct external_exec exec_bytes;
+ bfd_size_type amt = EXEC_BYTES_SIZE;
+
+ if (bfd_bread ((void *) &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);
+}
+
struct bout_data_struct
{
struct aoutdata a;
@@ -231,30 +211,27 @@ struct bout_data_struct
};
static bfd_boolean
-b_out_mkobject (abfd)
- bfd *abfd;
+b_out_mkobject (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);
+ rawptr = bfd_zalloc (abfd, amt);
if (rawptr == NULL)
return FALSE;
abfd->tdata.bout_data = rawptr;
exec_hdr (abfd) = &rawptr->e;
- obj_textsec (abfd) = (asection *) NULL;
- obj_datasec (abfd) = (asection *) NULL;
- obj_bsssec (abfd) = (asection *) NULL;
+ obj_textsec (abfd) = NULL;
+ obj_datasec (abfd) = NULL;
+ obj_bsssec (abfd) = NULL;
return TRUE;
}
static int
-b_out_symbol_cmp (a_ptr, b_ptr)
- const void * a_ptr;
- const void * b_ptr;
+b_out_symbol_cmp (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;
@@ -272,8 +249,8 @@ b_out_symbol_cmp (a_ptr, b_ptr)
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. */
+ /* 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))
@@ -283,8 +260,138 @@ b_out_symbol_cmp (a_ptr, b_ptr)
}
static bfd_boolean
-b_out_write_object_contents (abfd)
- bfd *abfd;
+b_out_squirt_out_relocs (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 = 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 + ARRAY_SIZE (howto_align_table) - 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 ((void *) native, natsize, abfd) != natsize)
+ {
+ free (native);
+ return FALSE;
+ }
+
+ free (native);
+
+ return TRUE;
+}
+
+static bfd_boolean
+b_out_write_object_contents (bfd *abfd)
{
struct external_exec swapped_hdr;
bfd_size_type amt;
@@ -294,15 +401,13 @@ b_out_write_object_contents (abfd)
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_text = obj_textsec (abfd)->size;
+ exec_hdr (abfd)->a_data = obj_datasec (abfd)->size;
+ exec_hdr (abfd)->a_bss = obj_bsssec (abfd)->size;
+ exec_hdr (abfd)->a_syms = bfd_get_symcount (abfd) * 12;
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_trsize = (obj_textsec (abfd)->reloc_count) * 8;
+ exec_hdr (abfd)->a_drsize = (obj_datasec (abfd)->reloc_count) * 8;
exec_hdr (abfd)->a_talign = obj_textsec (abfd)->alignment_power;
exec_hdr (abfd)->a_dalign = obj_datasec (abfd)->alignment_power;
@@ -315,7 +420,7 @@ b_out_write_object_contents (abfd)
amt = EXEC_BYTES_SIZE;
if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0
- || bfd_bwrite ((PTR) &swapped_hdr, amt, abfd) != amt)
+ || bfd_bwrite ((void *) &swapped_hdr, amt, abfd) != amt)
return FALSE;
/* Now write out reloc info, followed by syms and strings */
@@ -346,20 +451,20 @@ b_out_write_object_contents (abfd)
b_out_symbol_cmp);
/* Back to your regularly scheduled program. */
- if (bfd_seek (abfd, (file_ptr) (N_SYMOFF(*exec_hdr(abfd))), SEEK_SET)
+ 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)
+ 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)
+ if (bfd_seek (abfd, (file_ptr) (N_DROFF (*exec_hdr (abfd))), SEEK_SET)
!= 0)
return FALSE;
@@ -381,16 +486,64 @@ b_out_write_object_contents (abfd)
#define output_addr(sec) ((sec)->output_offset+(sec)->output_section->vma)
+static bfd_vma
+get_value (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;
+}
+
/* 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;
+calljx_callback (bfd *abfd,
+ struct bfd_link_info *link_info,
+ arelent *reloc_entry,
+ void * src,
+ void * dst,
+ asection *input_section)
{
int word = bfd_get_32 (abfd, src);
asymbol *symbol_in = *(reloc_entry->sym_ptr_ptr);
@@ -403,6 +556,7 @@ calljx_callback (abfd, link_info, reloc_entry, src, dst, input_section)
{
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;
@@ -422,16 +576,14 @@ calljx_callback (abfd, link_info, reloc_entry, src, dst, input_section)
/* 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;
+callj_callback (bfd *abfd,
+ struct bfd_link_info *link_info,
+ arelent *reloc_entry,
+ void * 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);
@@ -440,18 +592,17 @@ callj_callback (abfd, link_info, reloc_entry, data, srcidx, dstidx,
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))
+ 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));
+ BFD_ASSERT (IS_BALNAME (balsym->other));
/* We are calling a leaf, so replace the call instruction with a
bal. */
@@ -472,65 +623,20 @@ callj_callback (abfd, link_info, reloc_entry, data, srcidx, dstidx,
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);
- }
+ 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;
+b_out_bfd_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED,
+ bfd_reloc_code_real_type code)
{
switch (code)
{
@@ -546,15 +652,26 @@ b_out_bfd_reloc_type_lookup (abfd, code)
}
}
+static reloc_howto_type *
+b_out_bfd_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED,
+ const char *r_name)
+{
+ if (strcasecmp (howto_reloc_callj.name, r_name) == 0)
+ return &howto_reloc_callj;
+ if (strcasecmp (howto_reloc_abs32.name, r_name) == 0)
+ return &howto_reloc_abs32;
+ if (strcasecmp (howto_reloc_pcrel24.name, r_name) == 0)
+ return &howto_reloc_pcrel24;
+
+ return NULL;
+}
+
/* 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;
+b_out_slurp_reloc_table (bfd *abfd, sec_ptr asect, asymbol **symbols)
{
- register struct relocation_info *rptr;
+ struct relocation_info *rptr;
unsigned int counter;
arelent *cache_ptr;
int extern_mask, pcrel_mask, callj_mask, length_shift;
@@ -573,37 +690,27 @@ b_out_slurp_reloc_table (abfd, asect, symbols)
return FALSE;
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
{
- 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;
}
- 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);
+ relocs = 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);
+ reloc_cache = bfd_malloc (amt);
if (!reloc_cache)
{
if (relocs != NULL)
@@ -611,7 +718,7 @@ b_out_slurp_reloc_table (abfd, asect, symbols)
return FALSE;
}
- if (bfd_bread ((PTR) relocs, reloc_size, abfd) != reloc_size)
+ if (bfd_bread ((void *) relocs, reloc_size, abfd) != reloc_size)
{
free (reloc_cache);
if (relocs != NULL)
@@ -716,7 +823,7 @@ b_out_slurp_reloc_table (abfd, asect, symbols)
cache_ptr->addend = 0;
break;
default:
- BFD_ASSERT(0);
+ BFD_ASSERT (FALSE);
break;
}
}
@@ -761,9 +868,7 @@ b_out_slurp_reloc_table (abfd, asect, symbols)
cursor[1] = tmp;
}
else
- {
- prev_addr = cache_ptr->address;
- }
+ prev_addr = cache_ptr->address;
}
if (relocs != NULL)
@@ -774,149 +879,13 @@ b_out_slurp_reloc_table (abfd, asect, symbols)
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;
+b_out_canonicalize_reloc (bfd *abfd,
+ sec_ptr section,
+ arelent **relptr,
+ asymbol **symbols)
{
arelent *tblptr;
unsigned int count;
@@ -948,9 +917,7 @@ b_out_canonicalize_reloc (abfd, section, relptr, symbols)
}
static long
-b_out_get_reloc_upper_bound (abfd, asect)
- bfd *abfd;
- sec_ptr asect;
+b_out_get_reloc_upper_bound (bfd *abfd, sec_ptr asect)
{
if (bfd_get_format (abfd) != bfd_object)
{
@@ -963,13 +930,13 @@ b_out_get_reloc_upper_bound (abfd, asect)
if (asect == obj_datasec (abfd))
return (sizeof (arelent *) *
- ((exec_hdr(abfd)->a_drsize / sizeof (struct relocation_info))
- +1));
+ ((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));
+ ((exec_hdr (abfd)->a_trsize / sizeof (struct relocation_info))
+ + 1));
if (asect == obj_bsssec (abfd))
return 0;
@@ -980,12 +947,11 @@ b_out_get_reloc_upper_bound (abfd, asect)
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;
+b_out_set_section_contents (bfd *abfd,
+ asection *section,
+ const void * location,
+ file_ptr offset,
+ bfd_size_type count)
{
if (! abfd->output_has_begun)
{
@@ -993,9 +959,9 @@ b_out_set_section_contents (abfd, section, location, offset, count)
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;
+ obj_textsec (abfd)->filepos = sizeof (struct external_exec);
+ obj_datasec (abfd)->filepos = obj_textsec (abfd)->filepos
+ + obj_textsec (abfd)->size;
}
/* Regardless, once we know what we're doing, we might as well get going. */
@@ -1005,16 +971,15 @@ b_out_set_section_contents (abfd, section, location, offset, count)
if (count == 0)
return TRUE;
- return bfd_bwrite ((PTR) location, count, abfd) == count;
+ return bfd_bwrite ((void *) location, count, abfd) == count;
}
static bfd_boolean
-b_out_set_arch_mach (abfd, arch, machine)
- bfd *abfd;
- enum bfd_architecture arch;
- unsigned long machine;
+b_out_set_arch_mach (bfd *abfd,
+ enum bfd_architecture arch,
+ unsigned long machine)
{
- bfd_default_set_arch_mach(abfd, arch, machine);
+ bfd_default_set_arch_mach (abfd, arch, machine);
if (arch == bfd_arch_unknown) /* Unknown machine arch is OK. */
return TRUE;
@@ -1040,72 +1005,17 @@ b_out_set_arch_mach (abfd, arch, machine)
}
static int
-b_out_sizeof_headers (ignore_abfd, ignore)
- bfd *ignore_abfd ATTRIBUTE_UNUSED;
- bfd_boolean ignore ATTRIBUTE_UNUSED;
+b_out_sizeof_headers (bfd *ignore_abfd ATTRIBUTE_UNUSED,
+ struct bfd_link_info *info ATTRIBUTE_UNUSED)
{
- return sizeof (struct internal_exec);
+ return sizeof (struct external_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;
+perform_slip (bfd *abfd,
+ unsigned int slip,
+ asection *input_section,
+ bfd_vma value)
{
asymbol **s;
@@ -1145,12 +1055,11 @@ perform_slip (abfd, slip, input_section, value)
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;
+abs32code (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;
@@ -1178,11 +1087,10 @@ abs32code (abfd, input_section, r, shrink, link_info)
}
static int
-aligncode (abfd, input_section, r, shrink)
- bfd *abfd;
- asection *input_section;
- arelent *r;
- unsigned int shrink;
+aligncode (bfd *abfd,
+ asection *input_section,
+ arelent *r,
+ unsigned int shrink)
{
bfd_vma dot = output_addr (input_section) + r->address;
bfd_vma gap;
@@ -1224,19 +1132,17 @@ aligncode (abfd, input_section, r, 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;
+b_out_bfd_relax_section (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);
+ long reloc_size = bfd_get_reloc_upper_bound (input_bfd, input_section);
if (reloc_size < 0)
return FALSE;
@@ -1249,7 +1155,7 @@ b_out_bfd_relax_section (abfd, i, link_info, again)
{
long reloc_count;
- reloc_vector = (arelent **) bfd_malloc ((bfd_size_type) reloc_size);
+ reloc_vector = bfd_malloc ((bfd_size_type) reloc_size);
if (reloc_vector == NULL && reloc_size != 0)
goto error_return;
@@ -1285,7 +1191,7 @@ b_out_bfd_relax_section (abfd, i, link_info, again)
}
}
}
- input_section->_cooked_size = input_section->_raw_size - shrink;
+ input_section->size -= shrink;
if (reloc_vector != NULL)
free (reloc_vector);
@@ -1297,20 +1203,17 @@ b_out_bfd_relax_section (abfd, i, link_info, again)
}
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;
+b_out_bfd_get_relocated_section_contents (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);
+ long reloc_size = bfd_get_reloc_upper_bound (input_bfd, input_section);
arelent **reloc_vector = NULL;
long reloc_count;
@@ -1324,18 +1227,16 @@ b_out_bfd_get_relocated_section_contents (output_bfd, link_info, link_order,
data, relocatable,
symbols);
- reloc_vector = (arelent **) bfd_malloc ((bfd_size_type) reloc_size);
+ reloc_vector = 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));
+ input_section->size));
reloc_count = bfd_canonicalize_reloc (input_bfd,
input_section,
@@ -1366,9 +1267,7 @@ b_out_bfd_get_relocated_section_contents (output_bfd, link_info, link_order,
parent++;
}
else
- {
- run = link_order->size - dst_address;
- }
+ run = link_order->size - dst_address;
/* Copy the bytes. */
for (idx = 0; idx < run; idx++)
@@ -1404,7 +1303,7 @@ b_out_bfd_get_relocated_section_contents (output_bfd, link_info, link_order,
case ALIGNDONE:
BFD_ASSERT (reloc->addend >= src_address);
BFD_ASSERT ((bfd_vma) reloc->addend
- <= input_section->_raw_size);
+ <= input_section->size);
src_address = reloc->addend;
dst_address = ((dst_address + reloc->howto->size)
& ~reloc->howto->size);
@@ -1476,49 +1375,48 @@ b_out_bfd_get_relocated_section_contents (output_bfd, link_info, link_order,
/* 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
+#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_is_group_section bfd_generic_is_group_section
+#define b_out_bfd_discard_group bfd_generic_discard_group
+#define b_out_section_already_linked _bfd_generic_section_already_linked
+#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 */
+ "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 */
+ BFD_ENDIAN_LITTLE, /* Data byte order. */
+ BFD_ENDIAN_BIG, /* Header byte order. */
+ (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 */
+ '_', /* 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_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_getb16, bfd_getb_signed_16, bfd_putb16, /* Headers. */
+ {_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_false, b_out_mkobject, /* bfd_set_format. */
_bfd_generic_mkarchive, bfd_false},
- {bfd_false, b_out_write_object_contents, /* bfd_write_contents */
+ {bfd_false, b_out_write_object_contents, /* bfd_write_contents. */
_bfd_write_archive_contents, bfd_false},
BFD_JUMP_TABLE_GENERIC (aout_32),
@@ -1533,34 +1431,34 @@ const bfd_target b_out_vec_big_host =
& b_out_vec_little_host,
- (PTR) 0,
+ NULL
};
const bfd_target b_out_vec_little_host =
{
- "b.out.little", /* name */
+ "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 */
+ BFD_ENDIAN_LITTLE, /* Data byte order. */
+ BFD_ENDIAN_LITTLE, /* Header byte order. */
+ (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 */
+ '_', /* 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_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_getl16, bfd_getl_signed_16, bfd_putl16, /* Headers. */
- {_bfd_dummy_target, b_out_object_p, /* bfd_check_format */
+ {_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_false, b_out_mkobject, /* bfd_set_format. */
_bfd_generic_mkarchive, bfd_false},
- {bfd_false, b_out_write_object_contents, /* bfd_write_contents */
+ {bfd_false, b_out_write_object_contents, /* bfd_write_contents. */
_bfd_write_archive_contents, bfd_false},
BFD_JUMP_TABLE_GENERIC (aout_32),
@@ -1575,5 +1473,5 @@ const bfd_target b_out_vec_little_host =
& b_out_vec_big_host,
- (PTR) 0
+ NULL
};
diff --git a/contrib/binutils/bfd/cache.c b/contrib/binutils/bfd/cache.c
index 7d056ea..5252cc9 100644
--- a/contrib/binutils/bfd/cache.c
+++ b/contrib/binutils/bfd/cache.c
@@ -1,7 +1,7 @@
/* BFD library -- caching of file descriptors.
Copyright 1990, 1991, 1992, 1993, 1994, 1996, 2000, 2001, 2002,
- 2003, 2004 Free Software Foundation, Inc.
+ 2003, 2004, 2005, 2007 Free Software Foundation, Inc.
Hacked by Steve Chamberlain of Cygnus Support (steve@cygnus.com).
@@ -19,7 +19,7 @@ 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. */
+Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
/*
SECTION
@@ -36,61 +36,44 @@ SECTION
close, closes it and opens the one wanted, returning its file
handle.
+SUBSECTION
+ Caching functions
*/
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.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
-
-*/
+#include "libiberty.h"
+
+/* In some cases we can optimize cache operation when reopening files.
+ For instance, a flush is entirely unnecessary if the file is already
+ closed, so a flush would use CACHE_NO_OPEN. Similarly, a seek using
+ SEEK_SET or SEEK_END need not first seek to the current position.
+ For stat we ignore seek errors, just in case the file has changed
+ while we weren't looking. If it has, then it's possible that the
+ file is shorter and we don't want a seek error to prevent us doing
+ the stat. */
+enum cache_flag {
+ CACHE_NORMAL = 0,
+ CACHE_NO_OPEN = 1,
+ CACHE_NO_SEEK = 2,
+ CACHE_NO_SEEK_ERROR = 4
+};
+
+/* 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
+/* 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. */
- 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))
-
- */
+static bfd *bfd_last_cache = NULL;
/* Insert a BFD into the cache. */
@@ -127,6 +110,29 @@ snip (bfd *abfd)
}
}
+/* 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;
+}
+
/* We need to open a new file, and the cache is full. Find the least
recently used cacheable BFD and close it. */
@@ -159,32 +165,205 @@ close_one (void)
kill->where = real_ftell ((FILE *) kill->iostream);
+ /* Save the file st_mtime. This is a hack so that gdb can detect when
+ an executable has been deleted and recreated. The only thing that
+ makes this reasonable is that st_mtime doesn't change when a file
+ is unlinked, so saving st_mtime makes BFD's file cache operation
+ a little more transparent for this particular usage pattern. If we
+ hadn't closed the file then we would not have lost the original
+ contents, st_mtime etc. Of course, if something is writing to an
+ existing file, then this is the wrong thing to do.
+ FIXME: gdb should save these times itself on first opening a file,
+ and this hack be removed. */
+ if (kill->direction == no_direction || kill->direction == read_direction)
+ {
+ bfd_get_mtime (kill);
+ kill->mtime_set = TRUE;
+ }
+
return bfd_cache_delete (kill);
}
-/* Close a BFD and remove it from the cache. */
-
-static bfd_boolean
-bfd_cache_delete (bfd *abfd)
+/* 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, flag) \
+ ((x) == bfd_last_cache \
+ ? (FILE *) (bfd_last_cache->iostream) \
+ : bfd_cache_lookup_worker (x, flag))
+
+/* 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. It will return NULL
+ if it is unable to (re)open the @var{abfd}. */
+
+static FILE *
+bfd_cache_lookup_worker (bfd *abfd, enum cache_flag flag)
{
- bfd_boolean ret;
+ bfd *orig_bfd = abfd;
+ if ((abfd->flags & BFD_IN_MEMORY) != 0)
+ abort ();
- if (fclose ((FILE *) abfd->iostream) == 0)
- ret = TRUE;
+ 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);
+ }
+ return (FILE *) abfd->iostream;
+ }
+
+ if (flag & CACHE_NO_OPEN)
+ return NULL;
+
+ if (bfd_open_file (abfd) == NULL)
+ ;
+ else if (!(flag & CACHE_NO_SEEK)
+ && real_fseek ((FILE *) abfd->iostream, abfd->where, SEEK_SET) != 0
+ && !(flag & CACHE_NO_SEEK_ERROR))
+ bfd_set_error (bfd_error_system_call);
else
+ return (FILE *) abfd->iostream;
+
+ (*_bfd_error_handler) (_("reopening %B: %s\n"),
+ orig_bfd, bfd_errmsg (bfd_get_error ()));
+ return NULL;
+}
+
+static file_ptr
+cache_btell (struct bfd *abfd)
+{
+ FILE *f = bfd_cache_lookup (abfd, CACHE_NO_OPEN);
+ if (f == NULL)
+ return abfd->where;
+ return real_ftell (f);
+}
+
+static int
+cache_bseek (struct bfd *abfd, file_ptr offset, int whence)
+{
+ FILE *f = bfd_cache_lookup (abfd, whence != SEEK_CUR ? CACHE_NO_SEEK : 0);
+ if (f == NULL)
+ return -1;
+ return real_fseek (f, offset, whence);
+}
+
+/* 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 file_ptr
+cache_bread (struct bfd *abfd, void *buf, file_ptr nbytes)
+{
+ FILE *f;
+ file_ptr nread;
+ /* 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 (nbytes == 0)
+ return 0;
+
+ f = bfd_cache_lookup (abfd, 0);
+ if (f == NULL)
+ return 0;
+
+#if defined (__VAX) && defined (VMS)
+ /* Apparently fread on Vax VMS does not keep the record length
+ information. */
+ nread = read (fileno (f), buf, nbytes);
+ /* 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. */
+ if (nread == (file_ptr)-1)
+ {
+ bfd_set_error (bfd_error_system_call);
+ return -1;
+ }
+#else
+ nread = fread (buf, 1, nbytes, f);
+ /* 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. */
+ if (nread < nbytes && ferror (f))
{
- ret = FALSE;
bfd_set_error (bfd_error_system_call);
+ return -1;
}
+#endif
+ return nread;
+}
- snip (abfd);
+static file_ptr
+cache_bwrite (struct bfd *abfd, const void *where, file_ptr nbytes)
+{
+ file_ptr nwrite;
+ FILE *f = bfd_cache_lookup (abfd, 0);
+ if (f == NULL)
+ return 0;
+ nwrite = fwrite (where, 1, nbytes, f);
+ if (nwrite < nbytes && ferror (f))
+ {
+ bfd_set_error (bfd_error_system_call);
+ return -1;
+ }
+ return nwrite;
+}
- abfd->iostream = NULL;
- --open_files;
+static int
+cache_bclose (struct bfd *abfd)
+{
+ return bfd_cache_close (abfd);
+}
- return ret;
+static int
+cache_bflush (struct bfd *abfd)
+{
+ int sts;
+ FILE *f = bfd_cache_lookup (abfd, CACHE_NO_OPEN);
+ if (f == NULL)
+ return 0;
+ sts = fflush (f);
+ if (sts < 0)
+ bfd_set_error (bfd_error_system_call);
+ return sts;
}
+static int
+cache_bstat (struct bfd *abfd, struct stat *sb)
+{
+ int sts;
+ FILE *f = bfd_cache_lookup (abfd, CACHE_NO_SEEK_ERROR);
+ if (f == NULL)
+ return -1;
+ sts = fstat (fileno (f), sb);
+ if (sts < 0)
+ bfd_set_error (bfd_error_system_call);
+ return sts;
+}
+
+static const struct bfd_iovec cache_iovec = {
+ &cache_bread, &cache_bwrite, &cache_btell, &cache_bseek,
+ &cache_bclose, &cache_bflush, &cache_bstat
+};
+
/*
INTERNAL_FUNCTION
bfd_cache_init
@@ -205,6 +384,7 @@ bfd_cache_init (bfd *abfd)
if (! close_one ())
return FALSE;
}
+ abfd->iovec = &cache_iovec;
insert (abfd);
++open_files;
return TRUE;
@@ -229,14 +409,44 @@ RETURNS
bfd_boolean
bfd_cache_close (bfd *abfd)
{
- if (abfd->iostream == NULL
- || (abfd->flags & BFD_IN_MEMORY) != 0)
+ if (abfd->iovec != &cache_iovec)
+ return TRUE;
+
+ if (abfd->iostream == NULL)
+ /* Previously closed. */
return TRUE;
return bfd_cache_delete (abfd);
}
/*
+FUNCTION
+ bfd_cache_close_all
+
+SYNOPSIS
+ bfd_boolean bfd_cache_close_all (void);
+
+DESCRIPTION
+ Remove all BFDs from the cache. If the attached file is open,
+ then close it too.
+
+RETURNS
+ <<FALSE>> is returned if closing one of the file fails, <<TRUE>> is
+ returned if all is well.
+*/
+
+bfd_boolean
+bfd_cache_close_all ()
+{
+ bfd_boolean ret = TRUE;
+
+ while (bfd_last_cache != NULL)
+ ret &= bfd_cache_close (bfd_last_cache);
+
+ return ret;
+}
+
+/*
INTERNAL_FUNCTION
bfd_open_file
@@ -266,15 +476,15 @@ bfd_open_file (bfd *abfd)
{
case read_direction:
case no_direction:
- abfd->iostream = (PTR) fopen (abfd->filename, FOPEN_RB);
+ abfd->iostream = (PTR) real_fopen (abfd->filename, FOPEN_RB);
break;
case both_direction:
case write_direction:
if (abfd->opened_once)
{
- abfd->iostream = (PTR) fopen (abfd->filename, FOPEN_RUB);
+ abfd->iostream = (PTR) real_fopen (abfd->filename, FOPEN_RUB);
if (abfd->iostream == NULL)
- abfd->iostream = (PTR) fopen (abfd->filename, FOPEN_WUB);
+ abfd->iostream = (PTR) real_fopen (abfd->filename, FOPEN_WUB);
}
else
{
@@ -302,63 +512,19 @@ bfd_open_file (bfd *abfd)
struct stat s;
if (stat (abfd->filename, &s) == 0 && s.st_size != 0)
- unlink (abfd->filename);
+ unlink_if_ordinary (abfd->filename);
#endif
- abfd->iostream = (PTR) fopen (abfd->filename, FOPEN_WUB);
+ abfd->iostream = (PTR) real_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);
- }
- }
+ if (abfd->iostream == NULL)
+ bfd_set_error (bfd_error_system_call);
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)
+ if (! bfd_cache_init (abfd))
return NULL;
}
diff --git a/contrib/binutils/bfd/coff-alpha.c b/contrib/binutils/bfd/coff-alpha.c
index e9dd416..dcb182b 100644
--- a/contrib/binutils/bfd/coff-alpha.c
+++ b/contrib/binutils/bfd/coff-alpha.c
@@ -1,6 +1,6 @@
/* BFD back-end for ALPHA Extended-Coff files.
- Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
- Free Software Foundation, Inc.
+ Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+ 2003, 2004, 2005, 2007 Free Software Foundation, Inc.
Modified from coff-mips.c by Steve Chamberlain <sac@cygnus.com> and
Ian Lance Taylor <ian@cygnus.com>.
@@ -18,10 +18,10 @@ 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. */
+Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "bfdlink.h"
#include "libbfd.h"
#include "coff/internal.h"
@@ -462,8 +462,8 @@ alpha_ecoff_object_p (abfd)
bfd_size_type size;
size = sec->line_filepos * 8;
- BFD_ASSERT (size == bfd_section_size (abfd, sec)
- || size + 8 == bfd_section_size (abfd, sec));
+ BFD_ASSERT (size == sec->size
+ || size + 8 == sec->size);
if (! bfd_set_section_size (abfd, sec, size))
return NULL;
}
@@ -481,10 +481,16 @@ alpha_ecoff_bad_format_hook (abfd, filehdr)
{
struct internal_filehdr *internal_f = (struct internal_filehdr *) filehdr;
- if (ALPHA_ECOFF_BADMAG (*internal_f))
- return FALSE;
+ if (! ALPHA_ECOFF_BADMAG (*internal_f))
+ return TRUE;
- return TRUE;
+ if (ALPHA_ECOFF_COMPRESSEDMAG (*internal_f))
+ (*_bfd_error_handler)
+ (_("%B: Cannot handle compressed Alpha binaries.\n"
+ " Use compiler flags, or objZ, to generate uncompressed binaries."),
+ abfd);
+
+ return FALSE;
}
/* This is a hook called by coff_real_object_p to create any backend
@@ -603,8 +609,11 @@ alpha_ecoff_swap_reloc_out (abfd, intern, dst)
size = intern->r_size;
}
+ /* XXX FIXME: The maximum symndx value used to be 14 but this
+ fails with object files produced by DEC's C++ compiler.
+ Where does the value 14 (or 15) come from anyway ? */
BFD_ASSERT (intern->r_extern
- || (intern->r_symndx >= 0 && intern->r_symndx <= 14));
+ || (intern->r_symndx >= 0 && intern->r_symndx <= 15));
H_PUT_64 (abfd, intern->r_vaddr, ext->r_vaddr);
H_PUT_32 (abfd, symndx, ext->r_symndx);
@@ -632,7 +641,15 @@ alpha_adjust_reloc_in (abfd, intern, rptr)
arelent *rptr;
{
if (intern->r_type > ALPHA_R_GPVALUE)
- abort ();
+ {
+ (*_bfd_error_handler)
+ (_("%B: unknown/unsupported relocation type %d"),
+ abfd, intern->r_type);
+ bfd_set_error (bfd_error_bad_value);
+ rptr->addend = 0;
+ rptr->howto = NULL;
+ return;
+ }
switch (intern->r_type)
{
@@ -668,7 +685,7 @@ alpha_adjust_reloc_in (abfd, intern, rptr)
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);
+ BFD_ASSERT (intern->r_offset <= 256);
rptr->addend = (intern->r_offset << 8) + intern->r_size;
break;
@@ -768,6 +785,7 @@ alpha_ecoff_get_relocated_section_contents (abfd, link_info, link_order,
long reloc_count;
bfd *output_bfd = relocatable ? abfd : (bfd *) NULL;
bfd_vma gp;
+ bfd_size_type sz;
bfd_boolean gp_undefined;
bfd_vma stack[RELOC_STACKSIZE];
int tos = 0;
@@ -778,14 +796,10 @@ alpha_ecoff_get_relocated_section_contents (abfd, link_info, link_order,
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))
+ sz = input_section->rawsize ? input_section->rawsize : input_section->size;
+ if (! bfd_get_section_contents (input_bfd, input_section, data, 0, sz))
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)
@@ -1148,7 +1162,8 @@ alpha_ecoff_get_relocated_section_contents (abfd, link_info, link_order,
break;
case bfd_reloc_overflow:
if (! ((*link_info->callbacks->reloc_overflow)
- (link_info, bfd_asymbol_name (*rel->sym_ptr_ptr),
+ (link_info, NULL,
+ bfd_asymbol_name (*rel->sym_ptr_ptr),
rel->howto->name, rel->addend, input_bfd,
input_section, rel->address)))
goto error_return;
@@ -1223,29 +1238,28 @@ alpha_bfd_reloc_type_lookup (abfd, code)
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];
}
+
+static reloc_howto_type *
+alpha_bfd_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED,
+ const char *r_name)
+{
+ unsigned int i;
+
+ for (i = 0;
+ i < sizeof (alpha_howto_table) / sizeof (alpha_howto_table[0]);
+ i++)
+ if (alpha_howto_table[i].name != NULL
+ && strcasecmp (alpha_howto_table[i].name, r_name) == 0)
+ return &alpha_howto_table[i];
+
+ return NULL;
+}
/* A helper routine for alpha_relocate_section which converts an
external reloc when generating relocatable output. Returns the
@@ -1455,7 +1469,7 @@ alpha_relocate_section (output_bfd, info, input_bfd, input_section,
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;
+ lita_sec->used_by_bfd = lita_sec_data;
}
if (lita_sec_data->gp != 0)
@@ -1470,9 +1484,7 @@ alpha_relocate_section (output_bfd, info, input_bfd, input_section,
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;
+ lita_size = lita_sec->size;
if (gp == 0
|| lita_vma < gp - 0x8000
@@ -1542,8 +1554,26 @@ alpha_relocate_section (output_bfd, info, input_bfd, input_section,
switch (r_type)
{
+ case ALPHA_R_GPRELHIGH:
+ (*_bfd_error_handler)
+ (_("%B: unsupported relocation: ALPHA_R_GPRELHIGH"),
+ input_bfd);
+ bfd_set_error (bfd_error_bad_value);
+ continue;
+
+ case ALPHA_R_GPRELLOW:
+ (*_bfd_error_handler)
+ (_("%B: unsupported relocation: ALPHA_R_GPRELLOW"),
+ input_bfd);
+ bfd_set_error (bfd_error_bad_value);
+ continue;
+
default:
- abort ();
+ (*_bfd_error_handler)
+ (_("%B: unknown relocation type %d"),
+ input_bfd, (int) r_type);
+ bfd_set_error (bfd_error_bad_value);
+ continue;
case ALPHA_R_IGNORE:
/* This reloc appears after a GPDISP reloc. On earlier
@@ -1965,7 +1995,8 @@ alpha_relocate_section (output_bfd, info, input_bfd, input_section,
name = bfd_section_name (input_bfd,
symndx_to_section[r_symndx]);
if (! ((*info->callbacks->reloc_overflow)
- (info, name, alpha_howto_table[r_type].name,
+ (info, NULL, name,
+ alpha_howto_table[r_type].name,
(bfd_vma) 0, input_bfd, input_section,
r_vaddr - input_section->vma)))
return FALSE;
@@ -2346,6 +2377,8 @@ static const struct ecoff_backend_data alpha_ecoff_backend_data =
/* Looking up a reloc type is Alpha specific. */
#define _bfd_ecoff_bfd_reloc_type_lookup alpha_bfd_reloc_type_lookup
+#define _bfd_ecoff_bfd_reloc_name_lookup \
+ alpha_bfd_reloc_name_lookup
/* So is getting relocated section contents. */
#define _bfd_ecoff_bfd_get_relocated_section_contents \
@@ -2359,7 +2392,10 @@ static const struct ecoff_backend_data alpha_ecoff_backend_data =
#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_is_group_section bfd_generic_is_group_section
#define _bfd_ecoff_bfd_discard_group bfd_generic_discard_group
+#define _bfd_ecoff_section_already_linked \
+ _bfd_generic_section_already_linked
const bfd_target ecoffalpha_little_vec =
{
diff --git a/contrib/binutils/bfd/coff-arm.c b/contrib/binutils/bfd/coff-arm.c
index e51d07d..28cd4e7 100644
--- a/contrib/binutils/bfd/coff-arm.c
+++ b/contrib/binutils/bfd/coff-arm.c
@@ -1,6 +1,6 @@
/* BFD back-end for ARM COFF files.
Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
- 2000, 2001, 2002, 2003
+ 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
Free Software Foundation, Inc.
Written by Cygnus Support.
@@ -18,14 +18,12 @@
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. */
+ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
-
#include "coff/arm.h"
-
#include "coff/internal.h"
#ifdef COFF_WITH_PE
@@ -75,73 +73,10 @@
#endif
typedef enum {bunknown, b9, b12, b23} thumb_pcrel_branchtype;
-/* some typedefs for holding instructions */
+/* 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
@@ -156,18 +91,17 @@ static void arm_emit_base_file_entry
/* 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;
+coff_arm_reloc (bfd *abfd,
+ arelent *reloc_entry,
+ asymbol *symbol ATTRIBUTE_UNUSED,
+ void * data,
+ asection *input_section ATTRIBUTE_UNUSED,
+ bfd *output_bfd,
+ char **error_message ATTRIBUTE_UNUSED)
{
symvalue diff;
- if (output_bfd == (bfd *) NULL)
+
+ if (output_bfd == NULL)
return bfd_reloc_continue;
diff = reloc_entry->addend;
@@ -229,6 +163,19 @@ coff_arm_reloc (abfd, reloc_entry, symbol, data, input_section, output_bfd,
/* These most certainly belong somewhere else. Just had to get rid of
the manifest constants in the code. */
+
+#ifdef ARM_WINCE
+
+#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
+
+#else
+
#define ARM_8 0
#define ARM_16 1
#define ARM_32 2
@@ -237,7 +184,7 @@ coff_arm_reloc (abfd, reloc_entry, symbol, data, input_section, output_bfd,
#define ARM_DISP16 5
#define ARM_DISP32 6
#define ARM_26D 7
-/* 8 is unused */
+/* 8 is unused. */
#define ARM_NEG16 9
#define ARM_NEG32 10
#define ARM_RVA32 11
@@ -245,20 +192,19 @@ coff_arm_reloc (abfd, reloc_entry, symbol, data, input_section, output_bfd,
#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
+#endif
-#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
+static bfd_reloc_status_type aoutarm_fix_pcrel_26_done
+ (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **);
+static bfd_reloc_status_type aoutarm_fix_pcrel_26
+ (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **);
+static bfd_reloc_status_type coff_thumb_pcrel_12
+ (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **);
+#ifndef ARM_WINCE
+static bfd_reloc_status_type coff_thumb_pcrel_9
+ (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **);
+static bfd_reloc_status_type coff_thumb_pcrel_23
+ (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **);
#endif
static reloc_howto_type aoutarm_std_reloc_howto[] =
@@ -273,7 +219,7 @@ static reloc_howto_type aoutarm_std_reloc_howto[] =
complain_overflow_dont,
aoutarm_fix_pcrel_26_done,
"ARM_26D",
- FALSE,
+ TRUE, /* partial_inplace. */
0x00ffffff,
0x0,
PCRELOFFSET),
@@ -286,7 +232,7 @@ static reloc_howto_type aoutarm_std_reloc_howto[] =
complain_overflow_bitfield,
coff_arm_reloc,
"ARM_32",
- FALSE,
+ TRUE, /* partial_inplace. */
0xffffffff,
0xffffffff,
PCRELOFFSET),
@@ -299,7 +245,7 @@ static reloc_howto_type aoutarm_std_reloc_howto[] =
complain_overflow_bitfield,
coff_arm_reloc,
"ARM_RVA32",
- FALSE,
+ TRUE, /* partial_inplace. */
0xffffffff,
0xffffffff,
PCRELOFFSET),
@@ -347,7 +293,7 @@ static reloc_howto_type aoutarm_std_reloc_howto[] =
complain_overflow_bitfield,
coff_arm_reloc,
"ARM_SECTION",
- FALSE,
+ TRUE, /* partial_inplace. */
0x0000ffff,
0x0000ffff,
PCRELOFFSET),
@@ -360,24 +306,24 @@ static reloc_howto_type aoutarm_std_reloc_howto[] =
complain_overflow_bitfield,
coff_arm_reloc,
"ARM_SECREL",
- FALSE,
+ TRUE, /* partial_inplace. */
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_8,
+ 0,
+ 0,
+ 8,
+ FALSE,
+ 0,
+ complain_overflow_bitfield,
+ coff_arm_reloc,
+ "ARM_8",
+ TRUE,
+ 0x000000ff,
+ 0x000000ff,
+ PCRELOFFSET),
HOWTO (ARM_16,
0,
1,
@@ -555,14 +501,12 @@ static reloc_howto_type aoutarm_std_reloc_howto[] =
#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;
+in_reloc_p (bfd * abfd ATTRIBUTE_UNUSED,
+ reloc_howto_type * howto)
{
return !howto->pc_relative && howto->type != ARM_RVA32;
}
@@ -577,13 +521,12 @@ in_reloc_p (abfd, howto)
#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;
+coff_arm_rtype_to_howto (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;
@@ -595,21 +538,45 @@ coff_arm_rtype_to_howto (abfd, sec, rel, h, sym, addendp)
if (rel->r_type == ARM_RVA32)
*addendp -= pe_data (sec->output_section->owner)->pe_opthdr.ImageBase;
+#if defined COFF_WITH_PE && defined ARM_WINCE
+ if (rel->r_type == ARM_SECREL)
+ {
+ bfd_vma osect_vma;
+
+ if (h && (h->type == bfd_link_hash_defined
+ || h->type == bfd_link_hash_defweak))
+ osect_vma = h->root.u.def.section->output_section->vma;
+ else
+ {
+ asection *sec;
+ int i;
+
+ /* Sigh, the only way to get the section to offset against
+ is to find it the hard way. */
+
+ for (sec = abfd->sections, i = 1; i < sym->n_scnum; i++)
+ sec = sec->next;
+
+ osect_vma = sec->output_section->vma;
+ }
+
+ *addendp -= osect_vma;
+ }
+#endif
+
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;
+aoutarm_fix_pcrel_26_done (bfd *abfd ATTRIBUTE_UNUSED,
+ arelent *reloc_entry ATTRIBUTE_UNUSED,
+ asymbol *symbol ATTRIBUTE_UNUSED,
+ void * 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;
@@ -618,15 +585,13 @@ aoutarm_fix_pcrel_26_done (abfd, reloc_entry, symbol, data, input_section,
/* 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;
+aoutarm_fix_pcrel_26 (bfd *abfd,
+ arelent *reloc_entry,
+ asymbol *symbol,
+ void * data,
+ asection *input_section,
+ bfd *output_bfd,
+ char **error_message ATTRIBUTE_UNUSED)
{
bfd_vma relocation;
bfd_size_type addr = reloc_entry->address;
@@ -678,16 +643,14 @@ aoutarm_fix_pcrel_26 (abfd, reloc_entry, symbol, data, input_section,
}
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;
+coff_thumb_pcrel_common (bfd *abfd,
+ arelent *reloc_entry,
+ asymbol *symbol,
+ void * 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;
@@ -699,7 +662,6 @@ coff_thumb_pcrel_common (abfd, reloc_entry, symbol, data, input_section,
/* NOTE: This routine is currently used by GAS, but not by the link
phase. */
-
switch (btype)
{
case b9:
@@ -807,15 +769,13 @@ coff_thumb_pcrel_common (abfd, reloc_entry, symbol, data, input_section,
#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;
+coff_thumb_pcrel_23 (bfd *abfd,
+ arelent *reloc_entry,
+ asymbol *symbol,
+ void * 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,
@@ -823,15 +783,13 @@ coff_thumb_pcrel_23 (abfd, reloc_entry, symbol, data, input_section,
}
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;
+coff_thumb_pcrel_9 (bfd *abfd,
+ arelent *reloc_entry,
+ asymbol *symbol,
+ void * 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,
@@ -840,15 +798,13 @@ coff_thumb_pcrel_9 (abfd, reloc_entry, symbol, data, input_section,
#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;
+coff_thumb_pcrel_12 (bfd *abfd,
+ arelent *reloc_entry,
+ asymbol *symbol,
+ void * 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,
@@ -856,9 +812,7 @@ coff_thumb_pcrel_12 (abfd, reloc_entry, symbol, data, input_section,
}
static const struct reloc_howto_struct *
-coff_arm_reloc_type_lookup (abfd, code)
- bfd * abfd;
- bfd_reloc_code_real_type code;
+coff_arm_reloc_type_lookup (bfd * abfd, bfd_reloc_code_real_type code)
{
#define ASTD(i,j) case i: return aoutarm_std_reloc_howto + j
@@ -869,7 +823,7 @@ coff_arm_reloc_type_lookup (abfd, code)
code = BFD_RELOC_32;
break;
default:
- return (const struct reloc_howto_struct *) 0;
+ return NULL;
}
switch (code)
@@ -879,6 +833,7 @@ coff_arm_reloc_type_lookup (abfd, code)
ASTD (BFD_RELOC_RVA, ARM_RVA32);
ASTD (BFD_RELOC_ARM_PCREL_BRANCH, ARM_26);
ASTD (BFD_RELOC_THUMB_PCREL_BRANCH12, ARM_THUMB12);
+ ASTD (BFD_RELOC_32_SECREL, ARM_SECREL);
#else
ASTD (BFD_RELOC_8, ARM_8);
ASTD (BFD_RELOC_16, ARM_16);
@@ -894,17 +849,34 @@ coff_arm_reloc_type_lookup (abfd, code)
ASTD (BFD_RELOC_THUMB_PCREL_BRANCH23, ARM_THUMB23);
ASTD (BFD_RELOC_THUMB_PCREL_BLX, ARM_THUMB23);
#endif
- default: return (const struct reloc_howto_struct *) 0;
+ default: return NULL;
}
}
-#define COFF_DEFAULT_SECTION_ALIGNMENT_POWER (2)
-#define COFF_PAGE_SIZE 0x1000
-/* Turn a howto into a reloc nunmber */
+static reloc_howto_type *
+coff_arm_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED,
+ const char *r_name)
+{
+ unsigned int i;
+
+ for (i = 0;
+ i < (sizeof (aoutarm_std_reloc_howto)
+ / sizeof (aoutarm_std_reloc_howto[0]));
+ i++)
+ if (aoutarm_std_reloc_howto[i].name != NULL
+ && strcasecmp (aoutarm_std_reloc_howto[i].name, r_name) == 0)
+ return &aoutarm_std_reloc_howto[i];
+
+ return NULL;
+}
+
+#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 */
+#define BADMAG(x) ARMBADMAG(x)
+#define ARM 1 /* Customize coffcode.h. */
#ifndef ARM_WINCE
/* Make sure that the 'r_offset' field is copied properly
@@ -941,21 +913,22 @@ struct coff_arm_link_hash_table
/* Create an ARM coff linker hash table. */
static struct bfd_link_hash_table *
-coff_arm_link_hash_table_create (abfd)
- bfd * abfd;
+coff_arm_link_hash_table_create (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)
+ ret = bfd_malloc (amt);
+ if (ret == NULL)
return NULL;
- if (! _bfd_coff_link_hash_table_init
- (& ret->root, abfd, _bfd_coff_link_hash_newfunc))
+ if (!_bfd_coff_link_hash_table_init (&ret->root,
+ abfd,
+ _bfd_coff_link_hash_newfunc,
+ sizeof (struct coff_link_hash_entry)))
{
free (ret);
- return (struct bfd_link_hash_table *) NULL;
+ return NULL;
}
ret->thumb_glue_size = 0;
@@ -966,11 +939,10 @@ coff_arm_link_hash_table_create (abfd)
}
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;
+arm_emit_base_file_entry (struct bfd_link_info *info,
+ bfd *output_bfd,
+ asection *input_section,
+ bfd_vma reloc_offset)
{
bfd_vma addr = reloc_offset
- input_section->vma
@@ -1016,18 +988,16 @@ arm_emit_base_file_entry (info, output_bfd, input_section, reloc_offset)
#define HI_LOW_ORDER 0xF000F800
static insn32
-insert_thumb_branch (br_insn, rel_off)
- insn32 br_insn;
- int rel_off;
+insert_thumb_branch (insn32 br_insn, int rel_off)
{
unsigned int low_bits;
unsigned int high_bits;
- BFD_ASSERT((rel_off & 1) != 1);
+ 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 */
+ 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;
@@ -1043,16 +1013,15 @@ insert_thumb_branch (br_insn, rel_off)
static struct coff_link_hash_entry *
-find_thumb_glue (info, name, input_bfd)
- struct bfd_link_info *info;
- const char *name;
- bfd *input_bfd;
+find_thumb_glue (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);
+ tmp_name = bfd_malloc (amt);
BFD_ASSERT (tmp_name);
@@ -1063,8 +1032,8 @@ find_thumb_glue (info, name, input_bfd)
if (myh == NULL)
/* xgettext:c-format */
- _bfd_error_handler (_("%s: unable to find THUMB glue '%s' for `%s'"),
- bfd_archive_filename (input_bfd), tmp_name, name);
+ _bfd_error_handler (_("%B: unable to find THUMB glue '%s' for `%s'"),
+ input_bfd, tmp_name, name);
free (tmp_name);
@@ -1073,16 +1042,15 @@ find_thumb_glue (info, name, input_bfd)
#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;
+find_arm_glue (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);
+ tmp_name = bfd_malloc (amt);
BFD_ASSERT (tmp_name);
@@ -1093,8 +1061,8 @@ find_arm_glue (info, name, input_bfd)
if (myh == NULL)
/* xgettext:c-format */
- _bfd_error_handler (_("%s: unable to find ARM glue '%s' for `%s'"),
- bfd_archive_filename (input_bfd), tmp_name, name);
+ _bfd_error_handler (_("%B: unable to find ARM glue '%s' for `%s'"),
+ input_bfd, tmp_name, name);
free (tmp_name);
@@ -1136,6 +1104,7 @@ static const insn32 a2t3_func_addr_insn = 0x00000001;
*/
#define THUMB2ARM_GLUE_SIZE (globals->support_old_code ? 20 : 8)
+#ifndef ARM_WINCE
static const insn16 t2a1_bx_pc_insn = 0x4778;
static const insn16 t2a2_noop_insn = 0x46c0;
static const insn32 t2a3_b_insn = 0xea000000;
@@ -1146,6 +1115,7 @@ 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;
+#endif
/* TODO:
We should really create new local (static) symbols in destination
@@ -1189,19 +1159,20 @@ static const insn32 t2a6_bx_insn = 0xe12fff1e;
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;
+coff_arm_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;
+#ifndef ARM_WINCE
+ bfd_vma high_address = bfd_get_section_limit (input_bfd, input_section);
+#endif
rel = relocs;
relend = rel + input_section->reloc_count;
@@ -1278,21 +1249,18 @@ coff_arm_relocate_section (output_bfd, info, input_bfd, input_section,
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. */
+ generation of bl's instruction offset. */
addend -= 8;
#endif
- howto = &fake_arm26_reloc;
+ 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
@@ -1341,7 +1309,6 @@ coff_arm_relocate_section (output_bfd, info, input_bfd, input_section,
}
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
@@ -1394,16 +1361,11 @@ coff_arm_relocate_section (output_bfd, info, input_bfd, input_section,
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));
- }
+ _bfd_error_handler
+ /* xgettext:c-format */
+ (_("%B(%s): warning: interworking not enabled.\n"
+ " first occurrence: %B: arm call to thumb"),
+ h_sec->owner, input_bfd, name);
--my_offset;
myh->root.u.def.value = my_offset;
@@ -1457,7 +1419,7 @@ coff_arm_relocate_section (output_bfd, info, input_bfd, input_section,
|| h->class == C_STAT
|| h->class == C_LABEL)
{
- /* Thumb code calling an ARM function */
+ /* Thumb code calling an ARM function. */
asection * s = 0;
bfd_vma my_offset;
unsigned long int tmp;
@@ -1489,18 +1451,12 @@ coff_arm_relocate_section (output_bfd, info, input_bfd, input_section,
&& 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"));
- }
+ _bfd_error_handler
+ /* xgettext:c-format */
+ (_("%B(%s): warning: interworking not enabled.\n"
+ " first occurrence: %B: thumb call to arm\n"
+ " consider relinking with --support-old-code enabled"),
+ h_sec->owner, input_bfd, name);
-- my_offset;
myh->root.u.def.value = my_offset;
@@ -1542,13 +1498,19 @@ coff_arm_relocate_section (output_bfd, info, input_bfd, input_section,
s->contents + my_offset + 2);
ret_offset =
- ((bfd_signed_vma) h_val) /* Address of destination of the stub. */
+ /* Address of destination of the stub. */
+ ((bfd_signed_vma) h_val)
- ((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. */
+ /* 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),
@@ -1589,7 +1551,6 @@ coff_arm_relocate_section (output_bfd, info, input_bfd, input_section,
if (done)
rstat = bfd_reloc_ok;
else
-#endif /* THUMBEXTENSION */
if ( h->root.type == bfd_link_hash_defined
|| h->root.type == bfd_link_hash_defweak)
{
@@ -1618,11 +1579,10 @@ coff_arm_relocate_section (output_bfd, info, input_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 */
+ /* Only perform this fix during the final link, not a relocatable link. */
else if (! info->relocatable
&& howto->type == ARM_THUMB23)
{
@@ -1636,7 +1596,7 @@ coff_arm_relocate_section (output_bfd, info, input_bfd, input_section,
bfd_vma address = rel->r_vaddr - input_section->vma;
- if (address > input_section->_raw_size)
+ if (address > high_address)
rstat = bfd_reloc_outofrange;
else
{
@@ -1739,7 +1699,6 @@ coff_arm_relocate_section (output_bfd, info, input_bfd, input_section,
}
#endif
else
-#endif /* THUMBEXTENSION */
if (info->relocatable && ! howto->partial_inplace)
rstat = bfd_reloc_ok;
else
@@ -1747,17 +1706,12 @@ coff_arm_relocate_section (output_bfd, info, 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 */
+ /* Only perform this fix during the final link, not a relocatable link. */
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
@@ -1770,7 +1724,6 @@ coff_arm_relocate_section (output_bfd, info, input_bfd, input_section,
&& 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;
@@ -1784,7 +1737,6 @@ coff_arm_relocate_section (output_bfd, info, input_bfd, input_section,
bfd_put_32 (input_bfd, x | 1, location);
}
}
-#endif /* THUMBEXTENSION */
switch (rstat)
{
@@ -1794,10 +1746,8 @@ coff_arm_relocate_section (output_bfd, info, input_bfd, input_section,
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));
+ (_("%B: bad reloc address 0x%lx in section `%A'"),
+ input_bfd, input_section, (unsigned long) rel->r_vaddr);
return FALSE;
case bfd_reloc_overflow:
{
@@ -1807,7 +1757,7 @@ coff_arm_relocate_section (output_bfd, info, input_bfd, input_section,
if (symndx == -1)
name = "*ABS*";
else if (h != NULL)
- name = h->root.root.string;
+ name = NULL;
else
{
name = _bfd_coff_internal_syment_name (input_bfd, sym, buf);
@@ -1816,8 +1766,9 @@ coff_arm_relocate_section (output_bfd, info, input_bfd, input_section,
}
if (! ((*info->callbacks->reloc_overflow)
- (info, name, howto->name, (bfd_vma) 0, input_bfd,
- input_section, rel->r_vaddr - input_section->vma)))
+ (info, (h ? &h->root : NULL), name, howto->name,
+ (bfd_vma) 0, input_bfd, input_section,
+ rel->r_vaddr - input_section->vma)))
return FALSE;
}
}
@@ -1829,15 +1780,11 @@ coff_arm_relocate_section (output_bfd, info, input_bfd, input_section,
#ifndef COFF_IMAGE_WITH_PE
bfd_boolean
-bfd_arm_allocate_interworking_sections (info)
- struct bfd_link_info * info;
+bfd_arm_allocate_interworking_sections (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);
@@ -1852,13 +1799,9 @@ bfd_arm_allocate_interworking_sections (info)
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
+ foo = bfd_alloc (globals->bfd_of_glue_owner, globals->arm_glue_size);
- s->_raw_size = s->_cooked_size = globals->arm_glue_size;
+ s->size = globals->arm_glue_size;
s->contents = foo;
}
@@ -1871,13 +1814,9 @@ bfd_arm_allocate_interworking_sections (info)
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
+ foo = bfd_alloc (globals->bfd_of_glue_owner, globals->thumb_glue_size);
- s->_raw_size = s->_cooked_size = globals->thumb_glue_size;
+ s->size = globals->thumb_glue_size;
s->contents = foo;
}
@@ -1885,9 +1824,8 @@ bfd_arm_allocate_interworking_sections (info)
}
static void
-record_arm_to_thumb_glue (info, h)
- struct bfd_link_info * info;
- struct coff_link_hash_entry * h;
+record_arm_to_thumb_glue (struct bfd_link_info * info,
+ struct coff_link_hash_entry * h)
{
const char * name = h->root.root.string;
register asection * s;
@@ -1909,7 +1847,7 @@ record_arm_to_thumb_glue (info, h)
BFD_ASSERT (s != NULL);
amt = strlen (name) + strlen (ARM2THUMB_GLUE_ENTRY_NAME) + 1;
- tmp_name = (char *) bfd_malloc (amt);
+ tmp_name = bfd_malloc (amt);
BFD_ASSERT (tmp_name);
@@ -1921,13 +1859,13 @@ record_arm_to_thumb_glue (info, h)
if (myh != NULL)
{
free (tmp_name);
- return; /* we've already seen this guy */
+ /* We've already seen this guy. */
+ return;
}
/* 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,
@@ -1942,12 +1880,11 @@ record_arm_to_thumb_glue (info, h)
#ifndef ARM_WINCE
static void
-record_thumb_to_arm_glue (info, h)
- struct bfd_link_info * info;
- struct coff_link_hash_entry * h;
+record_thumb_to_arm_glue (struct bfd_link_info * info,
+ struct coff_link_hash_entry * h)
{
const char * name = h->root.root.string;
- register asection * s;
+ asection * s;
char * tmp_name;
struct coff_link_hash_entry * myh;
struct bfd_link_hash_entry * bh;
@@ -1966,7 +1903,7 @@ record_thumb_to_arm_glue (info, h)
BFD_ASSERT (s != NULL);
amt = strlen (name) + strlen (THUMB2ARM_GLUE_ENTRY_NAME) + 1;
- tmp_name = (char *) bfd_malloc (amt);
+ tmp_name = bfd_malloc (amt);
BFD_ASSERT (tmp_name);
@@ -1978,7 +1915,8 @@ record_thumb_to_arm_glue (info, h)
if (myh != NULL)
{
free (tmp_name);
- return; /* we've already seen this guy */
+ /* We've already seen this guy. */
+ return;
}
bh = NULL;
@@ -1998,7 +1936,7 @@ record_thumb_to_arm_glue (info, h)
#define BACK_FROM_ARM "__%s_back_from_arm"
amt = strlen (name) + strlen (CHANGE_TO_ARM) + 1;
- tmp_name = (char *) bfd_malloc (amt);
+ tmp_name = bfd_malloc (amt);
BFD_ASSERT (tmp_name);
@@ -2022,9 +1960,8 @@ record_thumb_to_arm_glue (info, h)
{armcoff/pe}.em */
bfd_boolean
-bfd_arm_get_bfd_for_interworking (abfd, info)
- bfd * abfd;
- struct bfd_link_info * info;
+bfd_arm_get_bfd_for_interworking (bfd * abfd,
+ struct bfd_link_info * info)
{
struct coff_arm_link_hash_table * globals;
flagword flags;
@@ -2046,12 +1983,11 @@ bfd_arm_get_bfd_for_interworking (abfd, info)
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);
-
+ flags = (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS | SEC_IN_MEMORY
+ | SEC_CODE | SEC_READONLY);
+ sec = bfd_make_section_with_flags (abfd, ARM2THUMB_GLUE_SECTION_NAME,
+ flags);
if (sec == NULL
- || ! bfd_set_section_flags (abfd, sec, flags)
|| ! bfd_set_section_alignment (abfd, sec, 2))
return FALSE;
}
@@ -2060,12 +1996,12 @@ bfd_arm_get_bfd_for_interworking (abfd, info)
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);
+ flags = (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS | SEC_IN_MEMORY
+ | SEC_CODE | SEC_READONLY);
+ sec = bfd_make_section_with_flags (abfd, THUMB2ARM_GLUE_SECTION_NAME,
+ flags);
if (sec == NULL
- || ! bfd_set_section_flags (abfd, sec, flags)
|| ! bfd_set_section_alignment (abfd, sec, 2))
return FALSE;
}
@@ -2077,10 +2013,9 @@ bfd_arm_get_bfd_for_interworking (abfd, info)
}
bfd_boolean
-bfd_arm_process_before_allocation (abfd, info, support_old_code)
- bfd * abfd;
- struct bfd_link_info * info;
- int support_old_code;
+bfd_arm_process_before_allocation (bfd * abfd,
+ struct bfd_link_info * info,
+ int support_old_code)
{
asection * sec;
struct coff_arm_link_hash_table * globals;
@@ -2092,7 +2027,6 @@ bfd_arm_process_before_allocation (abfd, info, support_old_code)
/* 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);
@@ -2118,7 +2052,6 @@ bfd_arm_process_before_allocation (abfd, info, support_old_code)
/* 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);
@@ -2138,8 +2071,8 @@ bfd_arm_process_before_allocation (abfd, info, support_old_code)
/* 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);
+ _bfd_error_handler (_("%B: illegal symbol index in reloc: %d"),
+ abfd, symndx);
continue;
}
@@ -2196,6 +2129,7 @@ bfd_arm_process_before_allocation (abfd, info, support_old_code)
#endif /* ! defined (COFF_IMAGE_WITH_PE) */
#define coff_bfd_reloc_type_lookup coff_arm_reloc_type_lookup
+#define coff_bfd_reloc_name_lookup coff_arm_reloc_name_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
@@ -2211,13 +2145,12 @@ bfd_arm_process_before_allocation (abfd, info, support_old_code)
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;
+coff_arm_adjust_symndx (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)
{
@@ -2240,9 +2173,7 @@ coff_arm_adjust_symndx (obfd, info, ibfd, sec, irel, adjustedp)
targets, eg different CPUs or different APCS's. */
static bfd_boolean
-coff_arm_merge_private_bfd_data (ibfd, obfd)
- bfd * ibfd;
- bfd * obfd;
+coff_arm_merge_private_bfd_data (bfd * ibfd, bfd * obfd)
{
BFD_ASSERT (ibfd != NULL && obfd != NULL);
@@ -2271,9 +2202,10 @@ coff_arm_merge_private_bfd_data (ibfd, obfd)
{
_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
+ (_("ERROR: %B is compiled for APCS-%d, whereas %B is compiled for APCS-%d"),
+ ibfd, obfd,
+ APCS_26_FLAG (ibfd) ? 26 : 32,
+ APCS_26_FLAG (obfd) ? 26 : 32
);
bfd_set_error (bfd_error_wrong_format);
@@ -2286,13 +2218,12 @@ coff_arm_merge_private_bfd_data (ibfd, obfd)
if (APCS_FLOAT_FLAG (ibfd))
/* xgettext: c-format */
- msg = _("ERROR: %s passes floats in float registers, whereas %s passes them in integer registers");
+ msg = _("ERROR: %B passes floats in float registers, whereas %B passes them in integer registers");
else
/* xgettext: c-format */
- msg = _("ERROR: %s passes floats in integer registers, whereas %s passes them in float registers");
+ msg = _("ERROR: %B passes floats in integer registers, whereas %B passes them in float registers");
- _bfd_error_handler (msg, bfd_archive_filename (ibfd),
- bfd_get_filename (obfd));
+ _bfd_error_handler (msg, ibfd, obfd);
bfd_set_error (bfd_error_wrong_format);
return FALSE;
@@ -2304,12 +2235,11 @@ coff_arm_merge_private_bfd_data (ibfd, obfd)
if (PIC_FLAG (ibfd))
/* xgettext: c-format */
- msg = _("ERROR: %s is compiled as position independent code, whereas target %s is absolute position");
+ msg = _("ERROR: %B is compiled as position independent code, whereas target %B 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));
+ msg = _("ERROR: %B is compiled as absolute position code, whereas target %B is position independent");
+ _bfd_error_handler (msg, ibfd, obfd);
bfd_set_error (bfd_error_wrong_format);
return FALSE;
@@ -2336,13 +2266,12 @@ coff_arm_merge_private_bfd_data (ibfd, obfd)
if (INTERWORK_FLAG (ibfd))
/* xgettext: c-format */
- msg = _("Warning: %s supports interworking, whereas %s does not");
+ msg = _("Warning: %B supports interworking, whereas %B does not");
else
/* xgettext: c-format */
- msg = _("Warning: %s does not support interworking, whereas %s does");
+ msg = _("Warning: %B does not support interworking, whereas %B does");
- _bfd_error_handler (msg, bfd_archive_filename (ibfd),
- bfd_get_filename (obfd));
+ _bfd_error_handler (msg, ibfd, obfd);
}
}
else
@@ -2357,9 +2286,7 @@ coff_arm_merge_private_bfd_data (ibfd, obfd)
/* Display the flags field. */
static bfd_boolean
-coff_arm_print_private_bfd_data (abfd, ptr)
- bfd * abfd;
- PTR ptr;
+coff_arm_print_private_bfd_data (bfd * abfd, void * ptr)
{
FILE * file = (FILE *) ptr;
@@ -2404,9 +2331,7 @@ coff_arm_print_private_bfd_data (abfd, ptr)
called from both coffcode.h and peicode.h. */
static bfd_boolean
-_bfd_coff_arm_set_private_flags (abfd, flags)
- bfd * abfd;
- flagword flags;
+_bfd_coff_arm_set_private_flags (bfd * abfd, flagword flags)
{
flagword flag;
@@ -2437,12 +2362,12 @@ _bfd_coff_arm_set_private_flags (abfd, flags)
{
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));
+ _bfd_error_handler (_("Warning: Not setting interworking flag of %B since it has already been specified as non-interworking"),
+ abfd);
else
/* xgettext: c-format */
- _bfd_error_handler (_("Warning: Clearing the interworking flag of %s due to outside request"),
- bfd_archive_filename (abfd));
+ _bfd_error_handler (_("Warning: Clearing the interworking flag of %B due to outside request"),
+ abfd);
flag = 0;
}
@@ -2455,9 +2380,7 @@ _bfd_coff_arm_set_private_flags (abfd, flags)
from one instance of a BFD to another. */
static bfd_boolean
-coff_arm_copy_private_bfd_data (src, dest)
- bfd * src;
- bfd * dest;
+coff_arm_copy_private_bfd_data (bfd * src, bfd * dest)
{
BFD_ASSERT (src != NULL && dest != NULL);
@@ -2469,7 +2392,7 @@ coff_arm_copy_private_bfd_data (src, dest)
if (src->xvec != dest->xvec)
return TRUE;
- /* copy the flags field */
+ /* Copy the flags field. */
if (APCS_SET (src))
{
if (APCS_SET (dest))
@@ -2501,9 +2424,8 @@ coff_arm_copy_private_bfd_data (src, 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));
+Warning: Clearing the interworking flag of %B because non-interworking code in %B has been linked with it"),
+ dest, src);
}
SET_INTERWORK_FLAG (dest, 0);
@@ -2520,7 +2442,9 @@ Warning: Clearing the interworking flag of %s because non-interworking code in %
/* Note: the definitions here of LOCAL_LABEL_PREFIX and USER_LABEL_PREIFX
*must* match the definitions in gcc/config/arm/{coff|semi|aout}.h. */
+#ifndef LOCAL_LABEL_PREFIX
#define LOCAL_LABEL_PREFIX ""
+#endif
#ifndef USER_LABEL_PREFIX
#define USER_LABEL_PREFIX "_"
#endif
@@ -2530,15 +2454,17 @@ Warning: Clearing the interworking flag of %s because non-interworking code in %
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;
+coff_arm_is_local_label_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)
+ size_t len = strlen (USER_LABEL_PREFIX);
+
+ if (strncmp (name, USER_LABEL_PREFIX, len) == 0)
return FALSE;
}
#endif
@@ -2566,23 +2492,18 @@ coff_arm_is_local_label_name (abfd, name)
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 */
+ end of the section list for the bfd. */
static bfd_boolean
-coff_arm_link_output_has_begun (sub, info)
- bfd * sub;
- struct coff_final_link_info * info;
+coff_arm_link_output_has_begun (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;
+coff_arm_final_link_postscript (bfd * abfd ATTRIBUTE_UNUSED,
+ struct coff_final_link_info * pfinfo)
{
struct coff_arm_link_hash_table * globals;
diff --git a/contrib/binutils/bfd/coff-aux.c b/contrib/binutils/bfd/coff-aux.c
index 4d7cde5..f28a948 100644
--- a/contrib/binutils/bfd/coff-aux.c
+++ b/contrib/binutils/bfd/coff-aux.c
@@ -1,5 +1,5 @@
/* BFD back-end for Apple M68K COFF A/UX 3.x files.
- Copyright 1996, 1997, 2000, 2002 Free Software Foundation, Inc.
+ Copyright 1996, 1997, 2000, 2002, 2007 Free Software Foundation, Inc.
Written by Richard Henderson <rth@tamu.edu>.
This file is part of BFD, the Binary File Descriptor library.
@@ -16,7 +16,7 @@ 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. */
+Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
#define TARGET_SYM m68kaux_coff_vec
#define TARGET_NAME "coff-m68k-aux"
@@ -37,8 +37,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#define COFF_COMMON_ADDEND
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
static bfd_boolean coff_m68k_aux_link_add_one_symbol
PARAMS ((struct bfd_link_info *, bfd *, const char *, flagword,
diff --git a/contrib/binutils/bfd/coff-i386.c b/contrib/binutils/bfd/coff-i386.c
index a24344a..81d3800 100644
--- a/contrib/binutils/bfd/coff-i386.c
+++ b/contrib/binutils/bfd/coff-i386.c
@@ -1,27 +1,27 @@
/* BFD back-end for Intel 386 COFF files.
Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
- 2000, 2001, 2002, 2003
+ 2000, 2001, 2002, 2003, 2004, 2007
Free Software Foundation, Inc.
Written by Cygnus Support.
-This file is part of BFD, the Binary File Descriptor library.
+ 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 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.
+ 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. */
+ 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., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
#include "coff/i386.h"
@@ -119,6 +119,8 @@ coff_i386_reloc (abfd, reloc_entry, symbol, data, input_section, output_bfd,
here. */
if (howto->pc_relative && howto->pcrel_offset)
diff = -(1 << howto->size);
+ else if (symbol->flags & BSF_WEAK)
+ diff = reloc_entry->addend - symbol->value;
else
diff = -reloc_entry->addend;
}
@@ -234,7 +236,24 @@ static reloc_howto_type howto_table[] =
EMPTY_HOWTO (010),
EMPTY_HOWTO (011),
EMPTY_HOWTO (012),
+#ifdef COFF_WITH_PE
+ /* 32-bit longword section relative relocation (013). */
+ HOWTO (R_SECREL32, /* 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 */
+ "secrel32", /* name */
+ TRUE, /* partial_inplace */
+ 0xffffffff, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ TRUE), /* pcrel_offset */
+#else
EMPTY_HOWTO (013),
+#endif
EMPTY_HOWTO (014),
EMPTY_HOWTO (015),
EMPTY_HOWTO (016),
@@ -497,12 +516,37 @@ coff_i386_rtype_to_howto (abfd, sec, rel, h, sym, addendp)
{
*addendp -= pe_data(sec->output_section->owner)->pe_opthdr.ImageBase;
}
+
+ if (rel->r_type == R_SECREL32)
+ {
+ bfd_vma osect_vma;
+
+ if (h && (h->type == bfd_link_hash_defined
+ || h->type == bfd_link_hash_defweak))
+ osect_vma = h->root.u.def.section->output_section->vma;
+ else
+ {
+ asection *sec;
+ int i;
+
+ /* Sigh, the only way to get the section to offset against
+ is to find it the hard way. */
+
+ for (sec = abfd->sections, i = 1; i < sym->n_scnum; i++)
+ sec = sec->next;
+
+ osect_vma = sec->output_section->vma;
+ }
+
+ *addendp -= osect_vma;
+ }
#endif
return howto;
}
#define coff_bfd_reloc_type_lookup coff_i386_reloc_type_lookup
+#define coff_bfd_reloc_name_lookup coff_i386_reloc_name_lookup
static reloc_howto_type *
coff_i386_reloc_type_lookup (abfd, code)
@@ -525,12 +569,30 @@ coff_i386_reloc_type_lookup (abfd, code)
return howto_table + R_RELBYTE;
case BFD_RELOC_8_PCREL:
return howto_table + R_PCRBYTE;
+#ifdef COFF_WITH_PE
+ case BFD_RELOC_32_SECREL:
+ return howto_table + R_SECREL32;
+#endif
default:
BFD_FAIL ();
return 0;
}
}
+static reloc_howto_type *
+coff_i386_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED,
+ const char *r_name)
+{
+ unsigned int i;
+
+ for (i = 0; i < sizeof (howto_table) / sizeof (howto_table[0]); i++)
+ if (howto_table[i].name != NULL
+ && strcasecmp (howto_table[i].name, r_name) == 0)
+ return &howto_table[i];
+
+ return NULL;
+}
+
#define coff_rtype_to_howto coff_i386_rtype_to_howto
#ifdef TARGET_UNDERSCORE
diff --git a/contrib/binutils/bfd/coff-ia64.c b/contrib/binutils/bfd/coff-ia64.c
index 2b5b557..32702a8 100644
--- a/contrib/binutils/bfd/coff-ia64.c
+++ b/contrib/binutils/bfd/coff-ia64.c
@@ -1,5 +1,5 @@
/* BFD back-end for HP/Intel IA-64 COFF files.
- Copyright 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
+ Copyright 1999, 2000, 2001, 2002, 2007 Free Software Foundation, Inc.
Contributed by David Mosberger <davidm@hpl.hp.com>
This file is part of BFD, the Binary File Descriptor library.
@@ -16,10 +16,10 @@ 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. */
+Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
#include "coff/ia64.h"
#include "coff/internal.h"
diff --git a/contrib/binutils/bfd/coff-mips.c b/contrib/binutils/bfd/coff-mips.c
index d6d8218..d5dafc7 100644
--- a/contrib/binutils/bfd/coff-mips.c
+++ b/contrib/binutils/bfd/coff-mips.c
@@ -1,6 +1,6 @@
/* BFD back-end for MIPS Extended-Coff files.
Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
- 2000, 2001, 2002, 2003
+ 2000, 2001, 2002, 2003, 2004, 2007
Free Software Foundation, Inc.
Original version by Per Bothner.
Full support added by Ian Lance Taylor, ian@cygnus.com.
@@ -19,10 +19,10 @@ 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. */
+Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "bfdlink.h"
#include "libbfd.h"
#include "coff/internal.h"
@@ -57,28 +57,12 @@ static bfd_reloc_status_type mips_reflo_reloc
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));
+ bfd_vma relocation));
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));
@@ -243,10 +227,9 @@ static reloc_howto_type mips_howto_table[] =
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. */
+ /* FIXME: This relocation is used (internally only) to represent branches
+ when assembling. It should never appear in output files, and
+ be removed. (It used to be used for embedded-PIC support.) */
HOWTO (MIPS_R_PCREL16, /* type */
2, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
@@ -260,92 +243,10 @@ static reloc_howto_type mips_howto_table[] =
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. */
@@ -418,25 +319,6 @@ mips_ecoff_swap_reloc_in (abfd, ext_ptr, intern)
<< 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. */
@@ -453,20 +335,7 @@ mips_ecoff_swap_reloc_out (abfd, intern, dst)
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;
- }
+ r_symndx = intern->r_symndx;
H_PUT_32 (abfd, intern->r_vaddr, ext->r_vaddr);
if (bfd_header_big_endian (abfd))
@@ -501,7 +370,7 @@ mips_adjust_reloc_in (abfd, intern, rptr)
const struct internal_reloc *intern;
arelent *rptr;
{
- if (intern->r_type > MIPS_R_SWITCH)
+ if (intern->r_type > MIPS_R_PCREL16)
abort ();
if (! intern->r_extern
@@ -514,18 +383,6 @@ mips_adjust_reloc_in (abfd, intern, rptr)
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];
}
@@ -535,19 +392,9 @@ mips_adjust_reloc_in (abfd, intern, rptr)
static void
mips_adjust_reloc_out (abfd, rel, intern)
bfd *abfd ATTRIBUTE_UNUSED;
- const arelent *rel;
- struct internal_reloc *intern;
+ const arelent *rel ATTRIBUTE_UNUSED;
+ struct internal_reloc *intern ATTRIBUTE_UNUSED;
{
- /* 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
@@ -652,7 +499,7 @@ mips_refhi_reloc (abfd,
relocation += symbol->section->output_offset;
relocation += reloc_entry->addend;
- if (reloc_entry->address > input_section->_cooked_size)
+ if (reloc_entry->address > bfd_get_section_limit (abfd, input_section))
return bfd_reloc_outofrange;
/* Save the information, and let REFLO do the actual relocation. */
@@ -850,7 +697,7 @@ mips_gprel_reloc (abfd,
relocation += symbol->section->output_section->vma;
relocation += symbol->section->output_offset;
- if (reloc_entry->address > input_section->_cooked_size)
+ if (reloc_entry->address > bfd_get_section_limit (abfd, input_section))
return bfd_reloc_outofrange;
insn = bfd_get_32 (abfd, (bfd_byte *) data + reloc_entry->address);
@@ -880,209 +727,6 @@ mips_gprel_reloc (abfd,
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 *
@@ -1119,38 +763,43 @@ mips_bfd_reloc_type_lookup (abfd, code)
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];
}
+
+static reloc_howto_type *
+mips_bfd_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED,
+ const char *r_name)
+{
+ unsigned int i;
+
+ for (i = 0;
+ i < sizeof (mips_howto_table) / sizeof (mips_howto_table[0]);
+ i++)
+ if (mips_howto_table[i].name != NULL
+ && strcasecmp (mips_howto_table[i].name, r_name) == 0)
+ return &mips_howto_table[i];
+
+ return NULL;
+}
/* 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. */
+ relocations. The REFHI relocation must be followed by a REFLO
+ relocation, 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)
+mips_relocate_hi (refhi, reflo, input_bfd, input_section, contents,
+ relocation)
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;
@@ -1160,12 +809,12 @@ mips_relocate_hi (refhi, reflo, input_bfd, input_section, contents, adjust,
return;
insn = bfd_get_32 (input_bfd,
- contents + adjust + refhi->r_vaddr - input_section->vma);
+ contents + 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)
+ contents + reflo->r_vaddr - input_section->vma)
& 0xffff);
val = ((insn & 0xffff) << 16) + vallo;
@@ -1179,17 +828,12 @@ mips_relocate_hi (refhi, reflo, input_bfd, input_section, contents, adjust,
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);
+ contents + refhi->r_vaddr - input_section->vma);
}
/* Relocate a section while linking a MIPS ECOFF file. */
@@ -1208,8 +852,6 @@ mips_relocate_section (output_bfd, info, input_bfd, input_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;
@@ -1270,13 +912,6 @@ mips_relocate_section (output_bfd, info, input_bfd, input_section,
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++)
@@ -1301,17 +936,15 @@ mips_relocate_section (output_bfd, info, input_bfd, input_section,
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)
+ /* The REFHI reloc requires special handling. It must be followed
+ by a REFLO reloc, and the addend is formed from both relocs. */
+ if (int_rel.r_type == MIPS_R_REFHI)
{
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. */
+ relocs before the REFLO 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++)
@@ -1323,10 +956,7 @@ mips_relocate_section (output_bfd, info, input_bfd, input_section,
}
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))
+ && lo_int_rel.r_type == MIPS_R_REFLO
&& int_rel.r_extern == lo_int_rel.r_extern
&& int_rel.r_symndx == lo_int_rel.r_symndx)
{
@@ -1338,32 +968,6 @@ mips_relocate_section (output_bfd, info, input_bfd, input_section,
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];
@@ -1439,91 +1043,6 @@ mips_relocate_section (output_bfd, info, input_bfd, input_section,
}
}
- /* 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
@@ -1601,49 +1120,7 @@ mips_relocate_section (output_bfd, info, input_bfd, input_section,
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;
- }
- }
+ relocation -= int_rel.r_vaddr - input_section->vma;
h = NULL;
}
@@ -1679,14 +1156,8 @@ mips_relocate_section (output_bfd, info, input_bfd, input_section,
/* 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)))
+ reference to the new address. */
+ if (howto->pc_relative)
relocation -= (input_section->output_section->vma
+ input_section->output_offset
- input_section->vma);
@@ -1696,11 +1167,9 @@ mips_relocate_section (output_bfd, info, input_bfd, input_section,
r = bfd_reloc_ok;
else
{
- if (int_rel.r_type != MIPS_R_REFHI
- && int_rel.r_type != MIPS_R_RELHI)
+ if (int_rel.r_type != MIPS_R_REFHI)
r = _bfd_relocate_contents (howto, input_bfd, relocation,
(contents
- + adjust
+ int_rel.r_vaddr
- input_section->vma));
else
@@ -1708,8 +1177,7 @@ mips_relocate_section (output_bfd, info, input_bfd, input_section,
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);
+ relocation);
r = bfd_reloc_ok;
}
}
@@ -1759,32 +1227,24 @@ mips_relocate_section (output_bfd, info, input_bfd, input_section,
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;
- }
+ relocation += int_rel.r_vaddr;
}
- if (int_rel.r_type != MIPS_R_REFHI
- && int_rel.r_type != MIPS_R_RELHI)
+ if (int_rel.r_type != MIPS_R_REFHI)
r = _bfd_final_link_relocate (howto,
input_bfd,
input_section,
contents,
(int_rel.r_vaddr
- - input_section->vma
- + adjust),
+ - input_section->vma),
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);
+ input_bfd, input_section, contents,
+ relocation);
r = bfd_reloc_ok;
}
}
@@ -1801,8 +1261,7 @@ mips_relocate_section (output_bfd, info, input_bfd, input_section,
& 0xf0000000)
!= ((input_section->output_section->vma
+ input_section->output_offset
- + (int_rel.r_vaddr - input_section->vma)
- + adjust)
+ + (int_rel.r_vaddr - input_section->vma))
& 0xf0000000)))
r = bfd_reloc_overflow;
@@ -1818,12 +1277,12 @@ mips_relocate_section (output_bfd, info, input_bfd, input_section,
const char *name;
if (int_rel.r_extern)
- name = h->root.root.string;
+ name = NULL;
else
name = bfd_section_name (input_bfd, s);
if (! ((*info->callbacks->reloc_overflow)
- (info, name, howto->name, (bfd_vma) 0,
- input_bfd, input_section,
+ (info, (h ? &h->root : NULL), name, howto->name,
+ (bfd_vma) 0, input_bfd, input_section,
int_rel.r_vaddr - input_section->vma)))
return FALSE;
}
@@ -1835,621 +1294,6 @@ mips_relocate_section (output_bfd, info, input_bfd, input_section,
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. */
@@ -2547,6 +1391,7 @@ static const struct ecoff_backend_data mips_ecoff_backend_data =
/* Looking up a reloc type is MIPS specific. */
#define _bfd_ecoff_bfd_reloc_type_lookup mips_bfd_reloc_type_lookup
+#define _bfd_ecoff_bfd_reloc_name_lookup mips_bfd_reloc_name_lookup
/* Getting relocated section contents is generic. */
#define _bfd_ecoff_bfd_get_relocated_section_contents \
@@ -2557,7 +1402,7 @@ static const struct ecoff_backend_data mips_ecoff_backend_data =
_bfd_generic_get_section_contents_in_window
/* Relaxing sections is MIPS specific. */
-#define _bfd_ecoff_bfd_relax_section mips_relax_section
+#define _bfd_ecoff_bfd_relax_section bfd_generic_relax_section
/* GC of sections is not done. */
#define _bfd_ecoff_bfd_gc_sections bfd_generic_gc_sections
@@ -2565,7 +1410,10 @@ static const struct ecoff_backend_data mips_ecoff_backend_data =
/* Merging of sections is not done. */
#define _bfd_ecoff_bfd_merge_sections bfd_generic_merge_sections
+#define _bfd_ecoff_bfd_is_group_section bfd_generic_is_group_section
#define _bfd_ecoff_bfd_discard_group bfd_generic_discard_group
+#define _bfd_ecoff_section_already_linked \
+ _bfd_generic_section_already_linked
extern const bfd_target ecoff_big_vec;
diff --git a/contrib/binutils/bfd/coff-ppc.c b/contrib/binutils/bfd/coff-ppc.c
index c1c2c32..72ade4e 100644
--- a/contrib/binutils/bfd/coff-ppc.c
+++ b/contrib/binutils/bfd/coff-ppc.c
@@ -1,6 +1,6 @@
/* BFD back-end for PowerPC Microsoft Portable Executable files.
Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
- 2000, 2001, 2002, 2003
+ 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
Free Software Foundation, Inc.
Original version pieced together by Kim Knuttila (krk@cygnus.com)
@@ -23,8 +23,8 @@
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. */
+ Foundation, 51 Franklin Street - Fifth Floor,
+ Boston, MA 02110-1301, USA. */
/* Current State:
- objdump works
@@ -33,9 +33,8 @@
- 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 "bfd.h"
#include "libbfd.h"
#include "coff/powerpc.h"
@@ -127,11 +126,6 @@ struct ppc_coff_link_hash_table
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
@@ -184,14 +178,14 @@ ppc_coff_link_hash_newfunc (entry, table, string)
/* 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 *));
+ppc_coff_link_hash_table_init (struct ppc_coff_link_hash_table *table,
+ bfd *abfd,
+ struct bfd_hash_entry *(*newfunc) (struct bfd_hash_entry *,
+ struct bfd_hash_table *,
+ const char *),
+ unsigned int entsize)
{
- return _bfd_coff_link_hash_table_init (&table->root, abfd, newfunc);
+ return _bfd_coff_link_hash_table_init (&table->root, abfd, newfunc, entsize);
}
/* Create a PE linker hash table. */
@@ -206,8 +200,9 @@ ppc_coff_link_hash_table_create (abfd)
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))
+ if (!ppc_coff_link_hash_table_init (ret, abfd,
+ ppc_coff_link_hash_newfunc,
+ sizeof (struct ppc_coff_link_hash_entry)))
{
free (ret);
return (struct bfd_link_hash_table *) NULL;
@@ -326,15 +321,6 @@ static bfd_reloc_status_type ppc_refhi_reloc PARAMS ((bfd *abfd,
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,
@@ -351,15 +337,6 @@ static bfd_reloc_status_type ppc_toc16_reloc PARAMS ((bfd *abfd,
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,
@@ -1005,67 +982,6 @@ static bfd_boolean in_reloc_p(abfd, howto)
&& (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
@@ -1188,8 +1104,7 @@ coff_ppc_relocate_section (output_bfd, info, input_bfd, input_section,
{
default:
(*_bfd_error_handler)
- (_("%s: unsupported relocation type 0x%02x"),
- bfd_archive_filename (input_bfd), r_type);
+ (_("%B: unsupported relocation type 0x%02x"), input_bfd, r_type);
bfd_set_error (bfd_error_bad_value);
return FALSE;
case IMAGE_REL_PPC_TOCREL16:
@@ -1278,8 +1193,8 @@ coff_ppc_relocate_section (output_bfd, info, input_bfd, input_section,
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,
+ (_("%B: Relocation for %s of %lx exceeds Toc size limit"),
+ input_bfd, name,
(unsigned long) our_toc_offset);
bfd_set_error (bfd_error_bad_value);
return FALSE;
@@ -1330,12 +1245,11 @@ coff_ppc_relocate_section (output_bfd, info, input_bfd, input_section,
/* FIXME: this test is conservative. */
if ((r_flags & IMAGE_REL_PPC_TOCDEFN) != IMAGE_REL_PPC_TOCDEFN
- && (bfd_vma) our_toc_offset > toc_section->_raw_size)
+ && (bfd_vma) our_toc_offset > toc_section->size)
{
(*_bfd_error_handler)
- (_("%s: Relocation exceeds allocated TOC (%lx)"),
- bfd_archive_filename (input_bfd),
- (unsigned long) toc_section->_raw_size);
+ (_("%B: Relocation exceeds allocated TOC (%lx)"),
+ input_bfd, (unsigned long) toc_section->size);
bfd_set_error (bfd_error_bad_value);
return FALSE;
}
@@ -1387,15 +1301,12 @@ coff_ppc_relocate_section (output_bfd, info, input_bfd, input_section,
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);
+ (*_bfd_error_handler)
+ (_("Warning: unsupported reloc %s <file %B, section %A>\n"
+ "sym %ld (%s), r_vaddr %ld (%lx)"),
+ input_bfd, input_section, howto->name,
+ rel->r_symndx, my_name, (long) rel->r_vaddr,
+ (unsigned long) rel->r_vaddr);
}
break;
case IMAGE_REL_PPC_IMGLUE:
@@ -1409,8 +1320,7 @@ coff_ppc_relocate_section (output_bfd, info, input_bfd, input_section,
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);
+ (_("%B: Out of order IMGLUE reloc for %s"), input_bfd, my_name);
bfd_set_error (bfd_error_bad_value);
return FALSE;
}
@@ -1421,7 +1331,7 @@ coff_ppc_relocate_section (output_bfd, info, input_bfd, input_section,
DUMP_RELOC2 (howto->name, rel);
- if (strncmp(".idata$2",input_section->name,8) == 0 && first_thunk_address == 0)
+ if (CONST_STRNEQ (input_section->name, ".idata$2") && first_thunk_address == 0)
{
/* Set magic values. */
int idata5offset;
@@ -1569,7 +1479,7 @@ coff_ppc_relocate_section (output_bfd, info, input_bfd, input_section,
if (symndx == -1)
name = "*ABS*";
else if (h != NULL)
- name = h->root.root.root.string;
+ name = NULL;
else if (sym == NULL)
name = "*unknown*";
else if (sym->_n._n_n._n_zeroes == 0
@@ -1583,7 +1493,7 @@ coff_ppc_relocate_section (output_bfd, info, input_bfd, input_section,
}
if (! ((*info->callbacks->reloc_overflow)
- (info, name, howto->name,
+ (info, (h ? &h->root.root : NULL), name, howto->name,
(bfd_vma) 0, input_bfd,
input_section, rel->r_vaddr - input_section->vma)))
return FALSE;
@@ -1690,7 +1600,7 @@ ppc_allocate_toc_section (info)
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->size = global_toc_size;
s->contents = foo;
return TRUE;
@@ -1779,30 +1689,6 @@ ppc_refhi_reloc (abfd, reloc_entry, symbol, data,
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)
@@ -1843,31 +1729,6 @@ ppc_toc16_reloc (abfd, reloc_entry, symbol, data,
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)
@@ -2099,8 +1960,23 @@ ppc_coff_reloc_type_lookup (abfd, code)
return NULL;
}
}
-
#undef HOW2MAP
+
+static reloc_howto_type *
+ppc_coff_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED,
+ const char *r_name)
+{
+ unsigned int i;
+
+ for (i = 0;
+ i < sizeof (ppc_coff_howto_table) / sizeof (ppc_coff_howto_table[0]);
+ i++)
+ if (ppc_coff_howto_table[i].name != NULL
+ && strcasecmp (ppc_coff_howto_table[i].name, r_name) == 0)
+ return &ppc_coff_howto_table[i];
+
+ return NULL;
+}
/* Tailor coffcode.h -- macro heaven. */
@@ -2109,15 +1985,12 @@ ppc_coff_reloc_type_lookup (abfd, code)
/* 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_bfd_reloc_name_lookup ppc_coff_reloc_name_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;}
@@ -2146,62 +2019,6 @@ ppc_coff_reloc_type_lookup (abfd, code)
#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));
@@ -2307,7 +2124,7 @@ ppc_bfd_coff_final_link (abfd, info)
o->reloc_count = 0;
o->lineno_count = 0;
- for (p = o->link_order_head; p != NULL; p = p->next)
+ for (p = o->map_head.link_order; p != NULL; p = p->next)
{
if (p->type == bfd_indirect_link_order)
{
@@ -2328,8 +2145,10 @@ ppc_bfd_coff_final_link (abfd, info)
if (info->relocatable)
o->reloc_count += sec->reloc_count;
- if (sec->_raw_size > max_contents_size)
- max_contents_size = sec->_raw_size;
+ if (sec->rawsize > max_contents_size)
+ max_contents_size = sec->rawsize;
+ if (sec->size > max_contents_size)
+ max_contents_size = sec->size;
if (sec->lineno_count > max_lineno_count)
max_lineno_count = sec->lineno_count;
if (sec->reloc_count > max_reloc_count)
@@ -2487,7 +2306,7 @@ ppc_bfd_coff_final_link (abfd, info)
for (o = abfd->sections; o != NULL; o = o->next)
{
- for (p = o->link_order_head; p != NULL; p = p->next)
+ for (p = o->map_head.link_order; p != NULL; p = p->next)
{
if (p->type == bfd_indirect_link_order
&& (bfd_get_flavour (p->u.indirect.section->owner)
@@ -2663,7 +2482,7 @@ ppc_bfd_coff_final_link (abfd, info)
}
/* If we have optimized stabs strings, output them. */
- if (coff_hash_table (info)->stab_info != NULL)
+ if (coff_hash_table (info)->stab_info.stabstr != NULL)
{
if (! _bfd_write_stab_strings (abfd, &coff_hash_table (info)->stab_info))
return FALSE;
diff --git a/contrib/binutils/bfd/coff-rs6000.c b/contrib/binutils/bfd/coff-rs6000.c
index 56e34e2..f446f49 100644
--- a/contrib/binutils/bfd/coff-rs6000.c
+++ b/contrib/binutils/bfd/coff-rs6000.c
@@ -1,12 +1,7 @@
/* BFD back-end for IBM RS/6000 "XCOFF" files.
- Copyright 1990-1999, 2000, 2001, 2002, 2003
+ Copyright 1990-1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
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.
+ Written by Metin G. Ozisik, Mimi Phuong-Thao Vo, and John Gilmore.
Archive support from Damon A. Permezel.
Contributed by IBM Corporation and Cygnus Support.
@@ -24,10 +19,10 @@ 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. */
+Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "bfdlink.h"
#include "libbfd.h"
#include "coff/internal.h"
@@ -59,7 +54,7 @@ extern bfd_boolean _bfd_xcoff_write_armap
extern bfd_boolean _bfd_xcoff_write_archive_contents
PARAMS ((bfd *));
extern int _bfd_xcoff_sizeof_headers
- PARAMS ((bfd *, bfd_boolean));
+ PARAMS ((bfd *, struct bfd_link_info *));
extern void _bfd_xcoff_swap_sym_in
PARAMS ((bfd *, PTR, PTR));
extern unsigned int _bfd_xcoff_swap_sym_out
@@ -98,6 +93,7 @@ void xcoff_rtype2howto
#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_bfd_reloc_name_lookup _bfd_xcoff_reloc_name_lookup
#ifdef AIX_CORE
extern const bfd_target * rs6000coff_core_p
PARAMS ((bfd *abfd));
@@ -180,7 +176,7 @@ static bfd_boolean do_pad
static bfd_boolean do_copy
PARAMS ((bfd *, bfd *));
static bfd_boolean do_shared_object_padding
- PARAMS ((bfd *, bfd *, ufile_ptr *, int));
+ PARAMS ((bfd *, bfd *, file_ptr *, int));
/* Relocation functions */
static bfd_boolean xcoff_reloc_type_br
@@ -1051,6 +1047,21 @@ _bfd_xcoff_reloc_type_lookup (abfd, code)
}
}
+static reloc_howto_type *
+_bfd_xcoff_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED,
+ const char *r_name)
+{
+ unsigned int i;
+
+ for (i = 0;
+ i < sizeof (xcoff_howto_table) / sizeof (xcoff_howto_table[0]);
+ i++)
+ if (xcoff_howto_table[i].name != NULL
+ && strcasecmp (xcoff_howto_table[i].name, r_name) == 0)
+ return &xcoff_howto_table[i];
+
+ return NULL;
+}
/* XCOFF archive support. The original version of this code was by
Damon A. Permezel. It was enhanced to permit cross support, and
@@ -1294,10 +1305,12 @@ _bfd_xcoff_archive_p (abfd)
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;
+ /* Cleared by bfd_zalloc above.
+ 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)->extended_names_size = 0; */
/* Now handle the two formats. */
if (magic[1] != 'b')
@@ -1636,7 +1649,7 @@ xcoff_write_armap_old (abfd, elength, map, orl_count, stridx)
+ SXCOFFARFMAG
+ arelt_size (sub));
fileoff = (fileoff + 1) &~ 1;
- sub = sub->next;
+ sub = sub->archive_next;
}
for (i = 0; i < orl_count; i++)
@@ -1742,7 +1755,7 @@ static bfd_boolean
do_shared_object_padding (out_bfd, in_bfd, offset, ar_header_size)
bfd *out_bfd;
bfd *in_bfd;
- ufile_ptr *offset;
+ file_ptr *offset;
int ar_header_size;
{
if (bfd_check_format (in_bfd, bfd_object)
@@ -1779,7 +1792,7 @@ xcoff_write_armap_big (abfd, elength, map, orl_count, stridx)
const bfd_arch_info_type *arch_info = NULL;
bfd *current_bfd;
size_t string_length;
- ufile_ptr nextoff, prevoff;
+ file_ptr nextoff, prevoff;
/* First, we look through the symbols and work out which are
from 32-bit objects and which from 64-bit ones. */
@@ -1807,7 +1820,7 @@ xcoff_write_armap_big (abfd, elength, map, orl_count, stridx)
}
i++;
}
- current_bfd = current_bfd->next;
+ current_bfd = current_bfd->archive_next;
if (current_bfd != NULL)
arch_info = bfd_get_arch_info (current_bfd);
}
@@ -1849,8 +1862,8 @@ xcoff_write_armap_big (abfd, elength, map, orl_count, stridx)
if (sym_32)
{
struct xcoff_ar_hdr_big *hdr;
- bfd_byte *symbol_table;
- bfd_byte *st;
+ char *symbol_table;
+ char *st;
file_ptr fileoff;
bfd_vma symbol_table_size =
@@ -1860,8 +1873,7 @@ xcoff_write_armap_big (abfd, elength, map, orl_count, stridx)
+ 8 * sym_32
+ str_32 + (str_32 & 1);
- symbol_table = NULL;
- symbol_table = (bfd_byte *) bfd_zmalloc (symbol_table_size);
+ symbol_table = bfd_zmalloc (symbol_table_size);
if (symbol_table == NULL)
return FALSE;
@@ -1912,7 +1924,7 @@ xcoff_write_armap_big (abfd, elength, map, orl_count, stridx)
+ SXCOFFARFMAG
+ arelt_size (current_bfd));
fileoff += fileoff & 1;
- current_bfd = current_bfd->next;
+ current_bfd = current_bfd->archive_next;
if (current_bfd != NULL)
arch_info = bfd_get_arch_info (current_bfd);
}
@@ -1933,7 +1945,7 @@ xcoff_write_armap_big (abfd, elength, map, orl_count, stridx)
}
i++;
}
- current_bfd = current_bfd->next;
+ current_bfd = current_bfd->archive_next;
if (current_bfd != NULL)
arch_info = bfd_get_arch_info (current_bfd);
}
@@ -1941,7 +1953,6 @@ xcoff_write_armap_big (abfd, elength, map, orl_count, stridx)
bfd_bwrite (symbol_table, symbol_table_size, abfd);
free (symbol_table);
- symbol_table = NULL;
prevoff = nextoff;
nextoff = nextoff + symbol_table_size;
@@ -1952,8 +1963,8 @@ xcoff_write_armap_big (abfd, elength, map, orl_count, stridx)
if (sym_64)
{
struct xcoff_ar_hdr_big *hdr;
- bfd_byte *symbol_table;
- bfd_byte *st;
+ char *symbol_table;
+ char *st;
file_ptr fileoff;
bfd_vma symbol_table_size =
@@ -1963,8 +1974,7 @@ xcoff_write_armap_big (abfd, elength, map, orl_count, stridx)
+ 8 * sym_64
+ str_64 + (str_64 & 1);
- symbol_table = NULL;
- symbol_table = (bfd_byte *) bfd_zmalloc (symbol_table_size);
+ symbol_table = bfd_zmalloc (symbol_table_size);
if (symbol_table == NULL)
return FALSE;
@@ -2010,7 +2020,7 @@ xcoff_write_armap_big (abfd, elength, map, orl_count, stridx)
+ SXCOFFARFMAG
+ arelt_size (current_bfd));
fileoff += fileoff & 1;
- current_bfd = current_bfd->next;
+ current_bfd = current_bfd->archive_next;
if (current_bfd != NULL)
arch_info = bfd_get_arch_info (current_bfd);
}
@@ -2031,7 +2041,7 @@ xcoff_write_armap_big (abfd, elength, map, orl_count, stridx)
}
i++;
}
- current_bfd = current_bfd->next;
+ current_bfd = current_bfd->archive_next;
if (current_bfd != NULL)
arch_info = bfd_get_arch_info (current_bfd);
}
@@ -2039,7 +2049,6 @@ xcoff_write_armap_big (abfd, elength, map, orl_count, stridx)
bfd_bwrite (symbol_table, symbol_table_size, abfd);
free (symbol_table);
- symbol_table = NULL;
PRINT20 (fhdr->symoff64, nextoff);
}
@@ -2076,7 +2085,7 @@ xcoff_write_archive_contents_old (abfd)
file_ptr *offsets;
bfd_boolean makemap;
bfd_boolean hasobjects;
- ufile_ptr prevoff, nextoff;
+ file_ptr prevoff, nextoff;
bfd *sub;
size_t i;
struct xcoff_ar_hdr ahdr;
@@ -2085,13 +2094,13 @@ xcoff_write_archive_contents_old (abfd)
char decbuf[XCOFFARMAG_ELEMENT_SIZE + 1];
memset (&fhdr, 0, sizeof fhdr);
- strncpy (fhdr.magic, XCOFFARMAG, SXCOFFARMAG);
+ (void) 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)
+ for (sub = abfd->archive_head; sub != NULL; sub = sub->archive_next)
{
++count;
total_namlen += strlen (normalize_filename (sub)) + 1;
@@ -2107,7 +2116,9 @@ xcoff_write_archive_contents_old (abfd)
hasobjects = FALSE;
prevoff = 0;
nextoff = SIZEOF_AR_FILE_HDR;
- for (sub = abfd->archive_head, i = 0; sub != NULL; sub = sub->next, i++)
+ for (sub = abfd->archive_head, i = 0;
+ sub != NULL;
+ sub = sub->archive_next, i++)
{
const char *name;
bfd_size_type namlen;
@@ -2255,7 +2266,7 @@ xcoff_write_archive_contents_old (abfd)
abfd) != XCOFFARMAG_ELEMENT_SIZE)
return FALSE;
}
- for (sub = abfd->archive_head; sub != NULL; sub = sub->next)
+ for (sub = abfd->archive_head; sub != NULL; sub = sub->archive_next)
{
const char *name;
bfd_size_type namlen;
@@ -2306,12 +2317,12 @@ xcoff_write_archive_contents_big (abfd)
file_ptr *offsets;
bfd_boolean makemap;
bfd_boolean hasobjects;
- ufile_ptr prevoff, nextoff;
+ file_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;
+ char *member_table, *mt;
bfd_vma member_table_size;
memset (&fhdr, 0, SIZEOF_AR_FILE_HDR_BIG);
@@ -2325,7 +2336,7 @@ xcoff_write_archive_contents_big (abfd)
hasobjects = FALSE;
for (current_bfd = abfd->archive_head, count = 0, total_namlen = 0;
current_bfd != NULL;
- current_bfd = current_bfd->next, count++)
+ current_bfd = current_bfd->archive_next, count++)
{
total_namlen += strlen (normalize_filename (current_bfd)) + 1;
@@ -2347,7 +2358,7 @@ xcoff_write_archive_contents_big (abfd)
nextoff = SIZEOF_AR_FILE_HDR_BIG;
for (current_bfd = abfd->archive_head, i = 0;
current_bfd != NULL;
- current_bfd = current_bfd->next, i++)
+ current_bfd = current_bfd->archive_next, i++)
{
const char *name;
bfd_size_type namlen;
@@ -2476,8 +2487,7 @@ xcoff_write_archive_contents_big (abfd)
+ total_namlen);
member_table_size += member_table_size & 1;
- member_table = NULL;
- member_table = (bfd_byte *) bfd_zmalloc (member_table_size);
+ member_table = bfd_zmalloc (member_table_size);
if (member_table == NULL)
return FALSE;
@@ -2515,8 +2525,9 @@ xcoff_write_archive_contents_big (abfd)
offsets = NULL;
}
- for (current_bfd = abfd->archive_head; current_bfd != NULL;
- current_bfd = current_bfd->next)
+ for (current_bfd = abfd->archive_head;
+ current_bfd != NULL;
+ current_bfd = current_bfd->archive_next)
{
const char *name;
size_t namlen;
@@ -2530,7 +2541,6 @@ xcoff_write_archive_contents_big (abfd)
return FALSE;
free (member_table);
- member_table = NULL;
PRINT20 (fhdr.memoff, nextoff);
@@ -2577,9 +2587,8 @@ _bfd_xcoff_write_archive_contents (abfd)
always uses an a.out header. */
int
-_bfd_xcoff_sizeof_headers (abfd, reloc)
- bfd *abfd;
- bfd_boolean reloc ATTRIBUTE_UNUSED;
+_bfd_xcoff_sizeof_headers (bfd *abfd,
+ struct bfd_link_info *info ATTRIBUTE_UNUSED)
{
int size;
@@ -2948,8 +2957,7 @@ xcoff_reloc_type_br (input_bfd, input_section, output_bfd, rel, sym, howto,
cror. */
if (NULL != h
&& bfd_link_hash_defined == h->root.type
- && (rel->r_vaddr - input_section->vma + 8
- <= input_section->_cooked_size))
+ && rel->r_vaddr - input_section->vma + 8 <= input_section->size)
{
bfd_byte *pnext;
unsigned long next;
@@ -3449,7 +3457,7 @@ xcoff_ppc_relocate_section (output_bfd, info, input_bfd,
address = rel->r_vaddr - input_section->vma;
location = contents + address;
- if (address > input_section->_raw_size)
+ if (address > input_section->size)
abort ();
/* Get the value we are going to relocate. */
@@ -3482,7 +3490,7 @@ xcoff_ppc_relocate_section (output_bfd, info, input_bfd,
}
else if (h != NULL)
{
- name = h->root.root.string;
+ name = NULL;
}
else
{
@@ -3493,8 +3501,9 @@ xcoff_ppc_relocate_section (output_bfd, info, input_bfd,
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)))
+ (info, (h ? &h->root : NULL), name, reloc_type_name,
+ (bfd_vma) 0, input_bfd, input_section,
+ rel->r_vaddr - input_section->vma)))
return FALSE;
}
@@ -3530,7 +3539,7 @@ _bfd_xcoff_put_ldsymbol_name (abfd, ldinfo, ldsym, name)
if (ldinfo->string_size + len + 3 > ldinfo->string_alc)
{
bfd_size_type newalc;
- bfd_byte *newstrings;
+ char *newstrings;
newalc = ldinfo->string_alc * 2;
if (newalc == 0)
@@ -3538,8 +3547,7 @@ _bfd_xcoff_put_ldsymbol_name (abfd, ldinfo, ldsym, name)
while (ldinfo->string_size + len + 3 > newalc)
newalc *= 2;
- newstrings = ((bfd_byte *)
- bfd_realloc ((PTR) ldinfo->strings, newalc));
+ newstrings = bfd_realloc (ldinfo->strings, newalc);
if (newstrings == NULL)
{
ldinfo->failed = TRUE;
@@ -3612,8 +3620,8 @@ xcoff_create_csect_from_smclas (abfd, aux, symbol_name)
else
{
(*_bfd_error_handler)
- (_("%s: symbol `%s' has unrecognized smclas %d"),
- bfd_archive_filename (abfd), symbol_name, aux->x_csect.x_smclas);
+ (_("%B: symbol `%s' has unrecognized smclas %d"),
+ abfd, symbol_name, aux->x_csect.x_smclas);
bfd_set_error (bfd_error_bad_value);
}
@@ -4140,8 +4148,10 @@ const bfd_target rs6000coff_vec =
/* Copy */
_bfd_xcoff_copy_private_bfd_data,
((bfd_boolean (*) (bfd *, bfd *)) bfd_true),
+ _bfd_generic_init_private_section_data,
((bfd_boolean (*) (bfd *, asection *, bfd *, asection *)) bfd_true),
((bfd_boolean (*) (bfd *, asymbol *, bfd *, asymbol *)) bfd_true),
+ ((bfd_boolean (*) (bfd *, bfd *)) bfd_true),
((bfd_boolean (*) (bfd *, flagword)) bfd_true),
((bfd_boolean (*) (bfd *, void * )) bfd_true),
@@ -4169,8 +4179,11 @@ const bfd_target rs6000coff_vec =
coff_print_symbol,
coff_get_symbol_info,
_bfd_xcoff_is_local_label_name,
+ coff_bfd_is_target_special_symbol,
coff_get_lineno,
coff_find_nearest_line,
+ _bfd_generic_find_line,
+ coff_find_inliner_info,
coff_bfd_make_debug_symbol,
_bfd_generic_read_minisymbols,
_bfd_generic_minisymbol_to_symbol,
@@ -4179,6 +4192,7 @@ const bfd_target rs6000coff_vec =
coff_get_reloc_upper_bound,
coff_canonicalize_reloc,
_bfd_xcoff_reloc_type_lookup,
+ _bfd_xcoff_reloc_name_lookup,
/* Write */
coff_set_arch_mach,
@@ -4196,11 +4210,14 @@ const bfd_target rs6000coff_vec =
_bfd_generic_link_split_section,
bfd_generic_gc_sections,
bfd_generic_merge_sections,
+ bfd_generic_is_group_section,
bfd_generic_discard_group,
+ _bfd_generic_section_already_linked,
/* Dynamic */
_bfd_xcoff_get_dynamic_symtab_upper_bound,
_bfd_xcoff_canonicalize_dynamic_symtab,
+ _bfd_nodynamic_get_synthetic_symtab,
_bfd_xcoff_get_dynamic_reloc_upper_bound,
_bfd_xcoff_canonicalize_dynamic_reloc,
@@ -4382,8 +4399,10 @@ const bfd_target pmac_xcoff_vec =
/* Copy */
_bfd_xcoff_copy_private_bfd_data,
((bfd_boolean (*) (bfd *, bfd *)) bfd_true),
+ _bfd_generic_init_private_section_data,
((bfd_boolean (*) (bfd *, asection *, bfd *, asection *)) bfd_true),
((bfd_boolean (*) (bfd *, asymbol *, bfd *, asymbol *)) bfd_true),
+ ((bfd_boolean (*) (bfd *, bfd *)) bfd_true),
((bfd_boolean (*) (bfd *, flagword)) bfd_true),
((bfd_boolean (*) (bfd *, void * )) bfd_true),
@@ -4411,8 +4430,11 @@ const bfd_target pmac_xcoff_vec =
coff_print_symbol,
coff_get_symbol_info,
_bfd_xcoff_is_local_label_name,
+ coff_bfd_is_target_special_symbol,
coff_get_lineno,
coff_find_nearest_line,
+ _bfd_generic_find_line,
+ coff_find_inliner_info,
coff_bfd_make_debug_symbol,
_bfd_generic_read_minisymbols,
_bfd_generic_minisymbol_to_symbol,
@@ -4421,6 +4443,7 @@ const bfd_target pmac_xcoff_vec =
coff_get_reloc_upper_bound,
coff_canonicalize_reloc,
_bfd_xcoff_reloc_type_lookup,
+ _bfd_xcoff_reloc_name_lookup,
/* Write */
coff_set_arch_mach,
@@ -4438,11 +4461,14 @@ const bfd_target pmac_xcoff_vec =
_bfd_generic_link_split_section,
bfd_generic_gc_sections,
bfd_generic_merge_sections,
+ bfd_generic_is_group_section,
bfd_generic_discard_group,
+ _bfd_generic_section_already_linked,
/* Dynamic */
_bfd_xcoff_get_dynamic_symtab_upper_bound,
_bfd_xcoff_canonicalize_dynamic_symtab,
+ _bfd_nodynamic_get_synthetic_symtab,
_bfd_xcoff_get_dynamic_reloc_upper_bound,
_bfd_xcoff_canonicalize_dynamic_reloc,
diff --git a/contrib/binutils/bfd/coff-sparc.c b/contrib/binutils/bfd/coff-sparc.c
index 372b1a7..236c7bf 100644
--- a/contrib/binutils/bfd/coff-sparc.c
+++ b/contrib/binutils/bfd/coff-sparc.c
@@ -1,6 +1,6 @@
/* BFD back-end for Sparc COFF files.
Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1999, 2000, 2001,
- 2002, 2003 Free Software Foundation, Inc.
+ 2002, 2003, 2005, 2007 Free Software Foundation, Inc.
Written by Cygnus Support.
This file is part of BFD, the Binary File Descriptor library.
@@ -17,10 +17,10 @@ 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. */
+Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
#include "coff/sparc.h"
#include "coff/internal.h"
@@ -56,25 +56,6 @@ enum reloc_type
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,
@@ -177,6 +158,24 @@ coff_sparc_reloc_type_lookup (abfd, code)
}
#define coff_bfd_reloc_type_lookup coff_sparc_reloc_type_lookup
+static reloc_howto_type *
+coff_sparc_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED,
+ const char *r_name)
+{
+ unsigned int i;
+
+ for (i = 0;
+ i < (sizeof (coff_sparc_howto_table)
+ / sizeof (coff_sparc_howto_table[0]));
+ i++)
+ if (coff_sparc_howto_table[i].name != NULL
+ && strcasecmp (coff_sparc_howto_table[i].name, r_name) == 0)
+ return &coff_sparc_howto_table[i];
+
+ return NULL;
+}
+#define coff_bfd_reloc_name_lookup coff_sparc_reloc_name_lookup
+
static void
rtype2howto (cache_ptr, dst)
arelent *cache_ptr;
diff --git a/contrib/binutils/bfd/coff-x86_64.c b/contrib/binutils/bfd/coff-x86_64.c
index 84d5c6e..7f75123 100644
--- a/contrib/binutils/bfd/coff-x86_64.c
+++ b/contrib/binutils/bfd/coff-x86_64.c
@@ -634,7 +634,9 @@ coff_amd64_rtype_to_howto (bfd *abfd ATTRIBUTE_UNUSED,
}
#define coff_bfd_reloc_type_lookup coff_amd64_reloc_type_lookup
+#ifdef notyet
#define coff_bfd_reloc_name_lookup coff_amd64_reloc_name_lookup
+#endif
static reloc_howto_type *
coff_amd64_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED, bfd_reloc_code_real_type code)
@@ -677,6 +679,7 @@ coff_amd64_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED, bfd_reloc_code_real_ty
}
}
+#ifdef notyet
static reloc_howto_type *
coff_amd64_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED,
const char *r_name)
@@ -690,6 +693,7 @@ coff_amd64_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED,
return NULL;
}
+#endif
#define coff_rtype_to_howto coff_amd64_rtype_to_howto
diff --git a/contrib/binutils/bfd/coff64-rs6000.c b/contrib/binutils/bfd/coff64-rs6000.c
index ec9c695..5e0804f 100644
--- a/contrib/binutils/bfd/coff64-rs6000.c
+++ b/contrib/binutils/bfd/coff64-rs6000.c
@@ -1,5 +1,5 @@
/* BFD back-end for IBM RS/6000 "XCOFF64" files.
- Copyright 2000, 2001, 2002, 2003
+ Copyright 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
Free Software Foundation, Inc.
Written Clinton Popetz.
Contributed by Cygnus Support.
@@ -18,10 +18,10 @@
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. */
+ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "bfdlink.h"
#include "libbfd.h"
#include "coff/internal.h"
@@ -127,7 +127,7 @@ extern bfd_boolean _bfd_xcoff_write_armap
extern bfd_boolean _bfd_xcoff_write_archive_contents
PARAMS ((bfd *));
extern int _bfd_xcoff_sizeof_headers
- PARAMS ((bfd *, bfd_boolean));
+ PARAMS ((bfd *, struct bfd_link_info *));
extern void _bfd_xcoff_swap_sym_in
PARAMS ((bfd *, PTR, PTR));
extern unsigned int _bfd_xcoff_swap_sym_out
@@ -161,7 +161,7 @@ static const bfd_target *xcoff64_archive_p
static bfd *xcoff64_openr_next_archived_file
PARAMS ((bfd *, bfd *));
static int xcoff64_sizeof_headers
- PARAMS ((bfd *, bfd_boolean));
+ PARAMS ((bfd *, struct bfd_link_info *));
static asection *xcoff64_create_csect_from_smclas
PARAMS ((bfd *, union internal_auxent *, const char *));
static bfd_boolean xcoff64_is_lineno_count_overflow
@@ -237,6 +237,7 @@ bfd_boolean (*xcoff64_calculate_relocation[XCOFF_MAX_CALCULATE_RELOCATION])
#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
+#define coff_bfd_reloc_name_lookup xcoff64_reloc_name_lookup
#ifdef AIX_CORE
extern const bfd_target * rs6000coff_core_p
PARAMS ((bfd *abfd));
@@ -564,7 +565,7 @@ _bfd_xcoff64_put_ldsymbol_name (abfd, ldinfo, ldsym, name)
if (ldinfo->string_size + len + 3 > ldinfo->string_alc)
{
bfd_size_type newalc;
- bfd_byte *newstrings;
+ char *newstrings;
newalc = ldinfo->string_alc * 2;
if (newalc == 0)
@@ -572,8 +573,7 @@ _bfd_xcoff64_put_ldsymbol_name (abfd, ldinfo, ldsym, name)
while (ldinfo->string_size + len + 3 > newalc)
newalc *= 2;
- newstrings = ((bfd_byte *)
- bfd_realloc ((PTR) ldinfo->strings, newalc));
+ newstrings = bfd_realloc (ldinfo->strings, newalc);
if (newstrings == NULL)
{
ldinfo->failed = TRUE;
@@ -845,11 +845,11 @@ xcoff64_write_object_contents (abfd)
section.s_vaddr = current->vma;
section.s_paddr = current->lma;
- section.s_size = current->_raw_size;
+ section.s_size = current->size;
/* If this section has no size or is unloadable then the scnptr
will be 0 too. */
- if (current->_raw_size == 0
+ if (current->size == 0
|| (current->flags & (SEC_LOAD | SEC_HAS_CONTENTS)) == 0)
{
section.s_scnptr = 0;
@@ -965,19 +965,19 @@ xcoff64_write_object_contents (abfd)
if (text_sec)
{
- internal_a.tsize = bfd_get_section_size_before_reloc (text_sec);
+ internal_a.tsize = text_sec->size;
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.dsize = data_sec->size;
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);
+ internal_a.bsize = bss_sec->size;
if (internal_a.bsize && bss_sec->vma < internal_a.data_start)
internal_a.data_start = bss_sec->vma;
}
@@ -1127,8 +1127,7 @@ xcoff64_reloc_type_br (input_bfd, input_section, output_bfd, rel, sym, howto,
cror. */
if (NULL != h
&& bfd_link_hash_defined == h->root.type
- && (rel->r_vaddr - input_section->vma + 8
- <= input_section->_cooked_size))
+ && rel->r_vaddr - input_section->vma + 8 <= input_section->size)
{
bfd_byte *pnext;
unsigned long next;
@@ -1301,7 +1300,7 @@ xcoff64_ppc_relocate_section (output_bfd, info, input_bfd,
address = rel->r_vaddr - input_section->vma;
location = contents + address;
- if (address > input_section->_raw_size)
+ if (address > input_section->size)
abort ();
/* Get the value we are going to relocate. */
@@ -1336,7 +1335,7 @@ xcoff64_ppc_relocate_section (output_bfd, info, input_bfd,
}
else if (h != NULL)
{
- name = h->root.root.string;
+ name = NULL;
}
else
{
@@ -1347,8 +1346,9 @@ xcoff64_ppc_relocate_section (output_bfd, info, input_bfd,
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)))
+ (info, (h ? &h->root : NULL), name, reloc_type_name,
+ (bfd_vma) 0, input_bfd, input_section,
+ rel->r_vaddr - input_section->vma)))
return FALSE;
}
@@ -1844,6 +1844,22 @@ xcoff64_reloc_type_lookup (abfd, code)
}
}
+static reloc_howto_type *
+xcoff64_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED,
+ const char *r_name)
+{
+ unsigned int i;
+
+ for (i = 0;
+ i < sizeof (xcoff64_howto_table) / sizeof (xcoff64_howto_table[0]);
+ i++)
+ if (xcoff64_howto_table[i].name != NULL
+ && strcasecmp (xcoff64_howto_table[i].name, r_name) == 0)
+ return &xcoff64_howto_table[i];
+
+ return NULL;
+}
+
/* Read in the armap of an XCOFF archive. */
static bfd_boolean
@@ -1984,10 +2000,12 @@ xcoff64_archive_p (abfd)
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;
+ /* Already cleared by bfd_zalloc above.
+ 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)->extended_names_size = 0; */
bfd_ardata (abfd)->first_file_filepos = bfd_scan_vma (hdr.firstmemoff,
(const char **) NULL,
10);
@@ -2055,9 +2073,8 @@ xcoff64_openr_next_archived_file (archive, last_file)
always uses an a.out header. */
static int
-xcoff64_sizeof_headers (abfd, reloc)
- bfd *abfd;
- bfd_boolean reloc ATTRIBUTE_UNUSED;
+xcoff64_sizeof_headers (bfd *abfd,
+ struct bfd_link_info *info ATTRIBUTE_UNUSED)
{
int size;
@@ -2105,8 +2122,8 @@ xcoff64_create_csect_from_smclas (abfd, aux, symbol_name)
else
{
(*_bfd_error_handler)
- (_("%s: symbol `%s' has unrecognized smclas %d"),
- bfd_archive_filename (abfd), symbol_name, aux->x_csect.x_smclas);
+ (_("%B: symbol `%s' has unrecognized smclas %d"),
+ abfd, symbol_name, aux->x_csect.x_smclas);
bfd_set_error (bfd_error_bad_value);
}
@@ -2681,8 +2698,10 @@ const bfd_target rs6000coff64_vec =
/* Copy */
_bfd_xcoff_copy_private_bfd_data,
((bfd_boolean (*) (bfd *, bfd *)) bfd_true),
+ _bfd_generic_init_private_section_data,
((bfd_boolean (*) (bfd *, asection *, bfd *, asection *)) bfd_true),
((bfd_boolean (*) (bfd *, asymbol *, bfd *, asymbol *)) bfd_true),
+ ((bfd_boolean (*) (bfd *, bfd *)) bfd_true),
((bfd_boolean (*) (bfd *, flagword)) bfd_true),
((bfd_boolean (*) (bfd *, void * )) bfd_true),
@@ -2710,8 +2729,11 @@ const bfd_target rs6000coff64_vec =
coff_print_symbol,
coff_get_symbol_info,
_bfd_xcoff_is_local_label_name,
+ coff_bfd_is_target_special_symbol,
coff_get_lineno,
coff_find_nearest_line,
+ _bfd_generic_find_line,
+ coff_find_inliner_info,
coff_bfd_make_debug_symbol,
_bfd_generic_read_minisymbols,
_bfd_generic_minisymbol_to_symbol,
@@ -2720,6 +2742,7 @@ const bfd_target rs6000coff64_vec =
coff_get_reloc_upper_bound,
coff_canonicalize_reloc,
xcoff64_reloc_type_lookup,
+ xcoff64_reloc_name_lookup,
/* Write */
coff_set_arch_mach,
@@ -2737,11 +2760,14 @@ const bfd_target rs6000coff64_vec =
_bfd_generic_link_split_section,
bfd_generic_gc_sections,
bfd_generic_merge_sections,
+ bfd_generic_is_group_section,
bfd_generic_discard_group,
+ _bfd_generic_section_already_linked,
/* Dynamic */
_bfd_xcoff_get_dynamic_symtab_upper_bound,
_bfd_xcoff_canonicalize_dynamic_symtab,
+ _bfd_nodynamic_get_synthetic_symtab,
_bfd_xcoff_get_dynamic_reloc_upper_bound,
_bfd_xcoff_canonicalize_dynamic_reloc,
@@ -2924,8 +2950,10 @@ const bfd_target aix5coff64_vec =
/* Copy */
_bfd_xcoff_copy_private_bfd_data,
((bfd_boolean (*) (bfd *, bfd *)) bfd_true),
+ _bfd_generic_init_private_section_data,
((bfd_boolean (*) (bfd *, asection *, bfd *, asection *)) bfd_true),
((bfd_boolean (*) (bfd *, asymbol *, bfd *, asymbol *)) bfd_true),
+ ((bfd_boolean (*) (bfd *, bfd *)) bfd_true),
((bfd_boolean (*) (bfd *, flagword)) bfd_true),
((bfd_boolean (*) (bfd *, void * )) bfd_true),
@@ -2953,8 +2981,11 @@ const bfd_target aix5coff64_vec =
coff_print_symbol,
coff_get_symbol_info,
_bfd_xcoff_is_local_label_name,
+ coff_bfd_is_target_special_symbol,
coff_get_lineno,
coff_find_nearest_line,
+ _bfd_generic_find_line,
+ coff_find_inliner_info,
coff_bfd_make_debug_symbol,
_bfd_generic_read_minisymbols,
_bfd_generic_minisymbol_to_symbol,
@@ -2963,6 +2994,7 @@ const bfd_target aix5coff64_vec =
coff_get_reloc_upper_bound,
coff_canonicalize_reloc,
xcoff64_reloc_type_lookup,
+ xcoff64_reloc_name_lookup,
/* Write */
coff_set_arch_mach,
@@ -2980,11 +3012,14 @@ const bfd_target aix5coff64_vec =
_bfd_generic_link_split_section,
bfd_generic_gc_sections,
bfd_generic_merge_sections,
+ bfd_generic_is_group_section,
bfd_generic_discard_group,
+ _bfd_generic_section_already_linked,
/* Dynamic */
_bfd_xcoff_get_dynamic_symtab_upper_bound,
_bfd_xcoff_canonicalize_dynamic_symtab,
+ _bfd_nodynamic_get_synthetic_symtab,
_bfd_xcoff_get_dynamic_reloc_upper_bound,
_bfd_xcoff_canonicalize_dynamic_reloc,
diff --git a/contrib/binutils/bfd/coffcode.h b/contrib/binutils/bfd/coffcode.h
index 15d9709..a2aac5f 100644
--- a/contrib/binutils/bfd/coffcode.h
+++ b/contrib/binutils/bfd/coffcode.h
@@ -1,6 +1,6 @@
/* 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
+ 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
Free Software Foundation, Inc.
Written by Cygnus Support.
@@ -18,14 +18,11 @@
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. */
+ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
+/* Most of this hacked by Steve Chamberlain,
+ sac@cygnus.com. */
/*
-Most of this hacked by Steve Chamberlain,
- sac@cygnus.com
-*/
-/*
-
SECTION
coff backends
@@ -307,66 +304,69 @@ CODE_FRAGMENT
#include "coffswap.h"
#endif
-#define STRING_SIZE_SIZE (4)
+#define STRING_SIZE_SIZE 4
+
+#define DOT_DEBUG ".debug"
+#define GNU_LINKONCE_WI ".gnu.linkonce.wi."
static long sec_to_styp_flags
- PARAMS ((const char *, flagword));
+ (const char *, flagword);
static bfd_boolean styp_to_sec_flags
- PARAMS ((bfd *, PTR, const char *, asection *, flagword *));
+ (bfd *, void *, const char *, asection *, flagword *);
static bfd_boolean coff_bad_format_hook
- PARAMS ((bfd *, PTR));
+ (bfd *, void *);
static void coff_set_custom_section_alignment
- PARAMS ((bfd *, asection *, const struct coff_section_alignment_entry *,
- const unsigned int));
+ (bfd *, asection *, const struct coff_section_alignment_entry *,
+ const unsigned int);
static bfd_boolean coff_new_section_hook
- PARAMS ((bfd *, asection *));
+ (bfd *, asection *);
static bfd_boolean coff_set_arch_mach_hook
- PARAMS ((bfd *, PTR));
+ (bfd *, void *);
static bfd_boolean coff_write_relocs
- PARAMS ((bfd *, int));
+ (bfd *, int);
static bfd_boolean coff_set_flags
- PARAMS ((bfd *, unsigned int *, unsigned short *));
+ (bfd *, unsigned int *, unsigned short *);
static bfd_boolean coff_set_arch_mach
- PARAMS ((bfd *, enum bfd_architecture, unsigned long)) ATTRIBUTE_UNUSED;
+ (bfd *, enum bfd_architecture, unsigned long) ATTRIBUTE_UNUSED;
static bfd_boolean coff_compute_section_file_positions
- PARAMS ((bfd *));
+ (bfd *);
static bfd_boolean coff_write_object_contents
- PARAMS ((bfd *)) ATTRIBUTE_UNUSED;
+ (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));
+ (bfd *, asection *, const void *, file_ptr, bfd_size_type);
+static void * buy_and_read
+ (bfd *, file_ptr, bfd_size_type);
static bfd_boolean coff_slurp_line_table
- PARAMS ((bfd *, asection *));
+ (bfd *, asection *);
static bfd_boolean coff_slurp_symbol_table
- PARAMS ((bfd *));
+ (bfd *);
static enum coff_symbol_classification coff_classify_symbol
- PARAMS ((bfd *, struct internal_syment *));
+ (bfd *, struct internal_syment *);
static bfd_boolean coff_slurp_reloc_table
- PARAMS ((bfd *, asection *, asymbol **));
+ (bfd *, asection *, asymbol **);
static long coff_canonicalize_reloc
- PARAMS ((bfd *, asection *, arelent **, asymbol **));
+ (bfd *, asection *, arelent **, asymbol **);
#ifndef coff_mkobject_hook
-static PTR coff_mkobject_hook
- PARAMS ((bfd *, PTR, PTR));
+static void * coff_mkobject_hook
+ (bfd *, void *, void *);
#endif
#ifdef COFF_WITH_PE
static flagword handle_COMDAT
- PARAMS ((bfd *, flagword, PTR, const char *, asection *));
+ (bfd *, flagword, void *, const char *, asection *);
#endif
#ifdef COFF_IMAGE_WITH_PE
static bfd_boolean coff_read_word
- PARAMS ((bfd *, unsigned int *));
+ (bfd *, unsigned int *);
static unsigned int coff_compute_checksum
- PARAMS ((bfd *));
+ (bfd *);
static bfd_boolean coff_apply_checksum
- PARAMS ((bfd *));
+ (bfd *);
#endif
#ifdef TICOFF
static bfd_boolean ticoff0_bad_format_hook
- PARAMS ((bfd *, PTR ));
+ (bfd *, void * );
static bfd_boolean ticoff1_bad_format_hook
- PARAMS ((bfd *, PTR ));
+ (bfd *, void * );
#endif
/* void warning(); */
@@ -379,6 +379,7 @@ static bfd_boolean ticoff1_bad_format_hook
#ifndef COFF_WITH_PE
/* Macros for setting debugging flags. */
+
#ifdef STYP_DEBUG
#define STYP_XCOFF_DEBUG STYP_DEBUG
#else
@@ -392,9 +393,7 @@ static bfd_boolean ticoff1_bad_format_hook
#endif
static long
-sec_to_styp_flags (sec_name, sec_flags)
- const char *sec_name;
- flagword sec_flags;
+sec_to_styp_flags (const char *sec_name, flagword sec_flags)
{
long styp_flags = 0;
@@ -428,7 +427,7 @@ sec_to_styp_flags (sec_name, sec_flags)
styp_flags = STYP_LIT;
#endif /* _LIT */
}
- else if (!strncmp (sec_name, ".debug", 6))
+ else if (CONST_STRNEQ (sec_name, DOT_DEBUG))
{
/* Handle the XCOFF debug section and DWARF2 debug sections. */
if (!sec_name[6])
@@ -436,12 +435,12 @@ sec_to_styp_flags (sec_name, sec_flags)
else
styp_flags = STYP_DEBUG_INFO;
}
- else if (!strncmp (sec_name, ".stab", 5))
+ else if (CONST_STRNEQ (sec_name, ".stab"))
{
styp_flags = STYP_DEBUG_INFO;
}
#ifdef COFF_LONG_SECTION_NAMES
- else if (!strncmp (sec_name, ".gnu.linkonce.wi.", 17))
+ else if (CONST_STRNEQ (sec_name, GNU_LINKONCE_WI))
{
styp_flags = STYP_DEBUG_INFO;
}
@@ -491,12 +490,12 @@ sec_to_styp_flags (sec_name, sec_flags)
}
#ifdef STYP_CLINK
- if (sec_flags & SEC_CLINK)
+ if (sec_flags & SEC_TIC54X_CLINK)
styp_flags |= STYP_CLINK;
#endif
#ifdef STYP_BLOCK
- if (sec_flags & SEC_BLOCK)
+ if (sec_flags & SEC_TIC54X_BLOCK)
styp_flags |= STYP_BLOCK;
#endif
@@ -517,9 +516,7 @@ sec_to_styp_flags (sec_name, sec_flags)
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;
+sec_to_styp_flags (const char *sec_name, flagword sec_flags)
{
long styp_flags = 0;
@@ -531,6 +528,11 @@ sec_to_styp_flags (sec_name, sec_flags)
PE files. The STYP_* flags and the IMAGE_SCN_* flags overlap,
but there are more IMAGE_SCN_* flags. */
+ /* FIXME: There is no gas syntax to specify the debug section flag. */
+ if (CONST_STRNEQ (sec_name, DOT_DEBUG)
+ || CONST_STRNEQ (sec_name, GNU_LINKONCE_WI))
+ sec_flags = SEC_DEBUGGING;
+
/* skip LOAD */
/* READONLY later */
/* skip RELOC */
@@ -543,10 +545,6 @@ sec_to_styp_flags (sec_name, sec_flags)
/* 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)
@@ -562,17 +560,19 @@ sec_to_styp_flags (sec_name, sec_flags)
/* 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. */
+ if (sec_flags & (SEC_ALLOC | SEC_LOAD))
+ {
+ /* 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_COFF_SHARED)
+ styp_flags |= IMAGE_SCN_MEM_SHARED; /* Shared remains meaningful. */
+ }
return styp_flags;
}
@@ -587,12 +587,11 @@ sec_to_styp_flags (sec_name, sec_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;
+styp_to_sec_flags (bfd *abfd ATTRIBUTE_UNUSED,
+ void * 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;
@@ -600,12 +599,12 @@ styp_to_sec_flags (abfd, hdr, name, section, flags_ptr)
#ifdef STYP_BLOCK
if (styp_flags & STYP_BLOCK)
- sec_flags |= SEC_BLOCK;
+ sec_flags |= SEC_TIC54X_BLOCK;
#endif
#ifdef STYP_CLINK
if (styp_flags & STYP_CLINK)
- sec_flags |= SEC_CLINK;
+ sec_flags |= SEC_TIC54X_CLINK;
#endif
#ifdef STYP_NOLOAD
@@ -675,14 +674,14 @@ styp_to_sec_flags (abfd, hdr, name, section, flags_ptr)
#endif
sec_flags |= SEC_ALLOC;
}
- else if (strncmp (name, ".debug", 6) == 0
+ else if (CONST_STRNEQ (name, DOT_DEBUG)
#ifdef _COMMENT
|| strcmp (name, _COMMENT) == 0
#endif
#ifdef COFF_LONG_SECTION_NAMES
- || strncmp (name, ".gnu.linkonce.wi.", 17) == 0
+ || CONST_STRNEQ (name, GNU_LINKONCE_WI)
#endif
- || strncmp (name, ".stab", 5) == 0)
+ || CONST_STRNEQ (name, ".stab"))
{
#ifdef COFF_PAGE_SIZE
sec_flags |= SEC_DEBUGGING;
@@ -716,7 +715,7 @@ styp_to_sec_flags (abfd, hdr, name, section, flags_ptr)
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)
+ if (CONST_STRNEQ (name, ".gnu.linkonce"))
sec_flags |= SEC_LINK_ONCE | SEC_LINK_DUPLICATES_DISCARD;
#endif
@@ -730,12 +729,11 @@ styp_to_sec_flags (abfd, hdr, name, section, flags_ptr)
#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;
+handle_COMDAT (bfd * abfd,
+ flagword sec_flags,
+ void * hdr,
+ const char *name,
+ asection *section)
{
struct internal_scnhdr *internal_s = (struct internal_scnhdr *) hdr;
bfd_byte *esymstart, *esym, *esymend;
@@ -773,7 +771,7 @@ handle_COMDAT (abfd, sec_flags, hdr, name, section)
char buf[SYMNMLEN + 1];
const char *symname;
- bfd_coff_swap_sym_in (abfd, (PTR) esym, (PTR) &isym);
+ bfd_coff_swap_sym_in (abfd, esym, & isym);
if (sizeof (internal_s->s_name) > SYMNMLEN)
{
@@ -821,8 +819,6 @@ handle_COMDAT (abfd, sec_flags, hdr, name, section)
/* 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
@@ -850,12 +846,15 @@ handle_COMDAT (abfd, sec_flags, hdr, name, section)
function). See comment above for more. */
if (strcmp (name, symname) != 0)
- abort ();
+ _bfd_error_handler (_("%B: warning: COMDAT symbol '%s' does not match section name '%s'"),
+ abfd, symname, name);
+
+ seen_state = 1;
/* This is the section symbol. */
- bfd_coff_swap_aux_in (abfd, (PTR) (esym + bfd_coff_symesz (abfd)),
+ bfd_coff_swap_aux_in (abfd, (esym + bfd_coff_symesz (abfd)),
isym.n_type, isym.n_sclass,
- 0, isym.n_numaux, (PTR) &aux);
+ 0, isym.n_numaux, & aux);
target_name = strchr (name, '$');
if (target_name != NULL)
@@ -957,12 +956,13 @@ handle_COMDAT (abfd, sec_flags, hdr, name, section)
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)
+ amt = sizeof (struct coff_comdat_info);
+ coff_section_data (abfd, section)->comdat
+ = bfd_alloc (abfd, amt);
+ if (coff_section_data (abfd, section)->comdat == NULL)
abort ();
- section->comdat->symbol =
+ coff_section_data (abfd, section)->comdat->symbol =
(esym - esymstart) / bfd_coff_symesz (abfd);
amt = strlen (symname) + 1;
@@ -971,7 +971,8 @@ handle_COMDAT (abfd, sec_flags, hdr, name, section)
abort ();
strcpy (newname, symname);
- section->comdat->name = newname;
+ coff_section_data (abfd, section)->comdat->name
+ = newname;
}
goto breakloop;
@@ -996,12 +997,11 @@ handle_COMDAT (abfd, sec_flags, hdr, name, section)
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;
+styp_to_sec_flags (bfd *abfd,
+ void * 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;
@@ -1055,7 +1055,11 @@ styp_to_sec_flags (abfd, hdr, name, section, flags_ptr)
unhandled = "IMAGE_SCN_MEM_NOT_CACHED";
break;
case IMAGE_SCN_MEM_NOT_PAGED:
- unhandled = "IMAGE_SCN_MEM_NOT_PAGED";
+ /* Generate a warning message rather using the 'unhandled'
+ variable as this will allow some .sys files generate by
+ other toolchains to be processed. See bugzilla issue 196. */
+ _bfd_error_handler (_("%B: Warning: Ignoring section flag IMAGE_SCN_MEM_NOT_PAGED in section %s"),
+ abfd, name);
break;
case IMAGE_SCN_MEM_EXECUTE:
sec_flags |= SEC_CODE;
@@ -1067,11 +1071,11 @@ styp_to_sec_flags (abfd, hdr, name, section, flags_ptr)
/* 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)
+ if (! CONST_STRNEQ (name, ".reloc"))
sec_flags |= SEC_DEBUGGING;
break;
case IMAGE_SCN_MEM_SHARED:
- sec_flags |= SEC_SHARED;
+ sec_flags |= SEC_COFF_SHARED;
break;
case IMAGE_SCN_LNK_REMOVE:
sec_flags |= SEC_EXCLUDE;
@@ -1109,8 +1113,8 @@ styp_to_sec_flags (abfd, hdr, name, section, flags_ptr)
if (unhandled != NULL)
{
(*_bfd_error_handler)
- (_("%s (%s): Section flag %s (0x%x) ignored"),
- bfd_archive_filename (abfd), name, unhandled, flag);
+ (_("%B (%s): Section flag %s (0x%x) ignored"),
+ abfd, name, unhandled, flag);
result = FALSE;
}
}
@@ -1122,7 +1126,7 @@ styp_to_sec_flags (abfd, hdr, name, section, flags_ptr)
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)
+ if (CONST_STRNEQ (name, ".gnu.linkonce"))
sec_flags |= SEC_LINK_ONCE | SEC_LINK_DUPLICATES_DISCARD;
#endif
@@ -1162,34 +1166,34 @@ 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));
+. (bfd *, void *, int, int, int, int, void *);
.
. void (*_bfd_coff_swap_sym_in)
-. PARAMS ((bfd *, PTR, PTR));
+. (bfd *, void *, void *);
.
. void (*_bfd_coff_swap_lineno_in)
-. PARAMS ((bfd *, PTR, PTR));
+. (bfd *, void *, void *);
.
. unsigned int (*_bfd_coff_swap_aux_out)
-. PARAMS ((bfd *, PTR, int, int, int, int, PTR));
+. (bfd *, void *, int, int, int, int, void *);
.
. unsigned int (*_bfd_coff_swap_sym_out)
-. PARAMS ((bfd *, PTR, PTR));
+. (bfd *, void *, void *);
.
. unsigned int (*_bfd_coff_swap_lineno_out)
-. PARAMS ((bfd *, PTR, PTR));
+. (bfd *, void *, void *);
.
. unsigned int (*_bfd_coff_swap_reloc_out)
-. PARAMS ((bfd *, PTR, PTR));
+. (bfd *, void *, void *);
.
. unsigned int (*_bfd_coff_swap_filehdr_out)
-. PARAMS ((bfd *, PTR, PTR));
+. (bfd *, void *, void *);
.
. unsigned int (*_bfd_coff_swap_aouthdr_out)
-. PARAMS ((bfd *, PTR, PTR));
+. (bfd *, void *, void *);
.
. unsigned int (*_bfd_coff_swap_scnhdr_out)
-. PARAMS ((bfd *, PTR, PTR));
+. (bfd *, void *, void *);
.
. unsigned int _bfd_filhsz;
. unsigned int _bfd_aoutsz;
@@ -1206,86 +1210,86 @@ Special entry points for gdb to swap in coff symbol table parts:
. unsigned int _bfd_coff_debug_string_prefix_length;
.
. void (*_bfd_coff_swap_filehdr_in)
-. PARAMS ((bfd *, PTR, PTR));
+. (bfd *, void *, void *);
.
. void (*_bfd_coff_swap_aouthdr_in)
-. PARAMS ((bfd *, PTR, PTR));
+. (bfd *, void *, void *);
.
. void (*_bfd_coff_swap_scnhdr_in)
-. PARAMS ((bfd *, PTR, PTR));
+. (bfd *, void *, void *);
.
. void (*_bfd_coff_swap_reloc_in)
-. PARAMS ((bfd *abfd, PTR, PTR));
+. (bfd *abfd, void *, void *);
.
. bfd_boolean (*_bfd_coff_bad_format_hook)
-. PARAMS ((bfd *, PTR));
+. (bfd *, void *);
.
. bfd_boolean (*_bfd_coff_set_arch_mach_hook)
-. PARAMS ((bfd *, PTR));
+. (bfd *, void *);
.
-. PTR (*_bfd_coff_mkobject_hook)
-. PARAMS ((bfd *, PTR, PTR));
+. void * (*_bfd_coff_mkobject_hook)
+. (bfd *, void *, void *);
.
. bfd_boolean (*_bfd_styp_to_sec_flags_hook)
-. PARAMS ((bfd *, PTR, const char *, asection *, flagword *));
+. (bfd *, void *, const char *, asection *, flagword *);
.
. void (*_bfd_set_alignment_hook)
-. PARAMS ((bfd *, asection *, PTR));
+. (bfd *, asection *, void *);
.
. bfd_boolean (*_bfd_coff_slurp_symbol_table)
-. PARAMS ((bfd *));
+. (bfd *);
.
. bfd_boolean (*_bfd_coff_symname_in_debug)
-. PARAMS ((bfd *, struct internal_syment *));
+. (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 *, 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));
+. (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 *));
+. (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 *));
+. (bfd *, asection *, arelent *, unsigned int,
+. struct bfd_link_info *);
.
. enum coff_symbol_classification (*_bfd_coff_classify_symbol)
-. PARAMS ((bfd *, struct internal_syment *));
+. (bfd *, struct internal_syment *);
.
. bfd_boolean (*_bfd_coff_compute_section_file_positions)
-. PARAMS ((bfd *));
+. (bfd *);
.
. bfd_boolean (*_bfd_coff_start_final_link)
-. PARAMS ((bfd *, struct bfd_link_info *));
+. (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 **));
+. (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 *,
+. (bfd *, asection *, struct internal_reloc *,
. struct coff_link_hash_entry *, struct internal_syment *,
-. bfd_vma *));
+. bfd_vma *);
.
. bfd_boolean (*_bfd_coff_adjust_symndx)
-. PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *,
-. struct internal_reloc *, bfd_boolean *));
+. (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,
+. (struct bfd_link_info *, bfd *, const char *, flagword,
. asection *, bfd_vma, const char *, bfd_boolean, bfd_boolean,
-. struct bfd_link_hash_entry **));
+. struct bfd_link_hash_entry **);
.
. bfd_boolean (*_bfd_coff_link_output_has_begun)
-. PARAMS ((bfd *, struct coff_final_link_info *));
+. (bfd *, struct coff_final_link_info *);
.
. bfd_boolean (*_bfd_coff_final_link_postscript)
-. PARAMS ((bfd *, struct coff_final_link_info *));
+. (bfd *, struct coff_final_link_info *);
.
.} bfd_coff_backend_data;
.
@@ -1415,18 +1419,16 @@ Special entry points for gdb to swap in coff symbol table parts:
. (info, abfd, name, flags, section, value, string, cp, coll, hashp))
.
.#define bfd_coff_link_output_has_begun(a,p) \
-. ((coff_backend_info (a)->_bfd_coff_link_output_has_begun) (a,p))
+. ((coff_backend_info (a)->_bfd_coff_link_output_has_begun) (a, p))
.#define bfd_coff_final_link_postscript(a,p) \
-. ((coff_backend_info (a)->_bfd_coff_final_link_postscript) (a,p))
+. ((coff_backend_info (a)->_bfd_coff_final_link_postscript) (a, p))
.
*/
/* See whether the magic number matches. */
static bfd_boolean
-coff_bad_format_hook (abfd, filehdr)
- bfd * abfd ATTRIBUTE_UNUSED;
- PTR filehdr;
+coff_bad_format_hook (bfd * abfd ATTRIBUTE_UNUSED, void * filehdr)
{
struct internal_filehdr *internal_f = (struct internal_filehdr *) filehdr;
@@ -1451,9 +1453,7 @@ coff_bad_format_hook (abfd, filehdr)
#ifdef TICOFF
static bfd_boolean
-ticoff0_bad_format_hook (abfd, filehdr)
- bfd *abfd ATTRIBUTE_UNUSED;
- PTR filehdr;
+ticoff0_bad_format_hook (bfd *abfd ATTRIBUTE_UNUSED, void * filehdr)
{
struct internal_filehdr *internal_f = (struct internal_filehdr *) filehdr;
@@ -1466,9 +1466,7 @@ ticoff0_bad_format_hook (abfd, filehdr)
#ifdef TICOFF
static bfd_boolean
-ticoff1_bad_format_hook (abfd, filehdr)
- bfd *abfd ATTRIBUTE_UNUSED;
- PTR filehdr;
+ticoff1_bad_format_hook (bfd *abfd ATTRIBUTE_UNUSED, void * filehdr)
{
struct internal_filehdr *internal_f = (struct internal_filehdr *) filehdr;
@@ -1483,11 +1481,10 @@ ticoff1_bad_format_hook (abfd, filehdr)
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;
+coff_set_custom_section_alignment (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;
@@ -1547,9 +1544,7 @@ static const unsigned int coff_section_alignment_table_size =
particular implementation of COFF. */
static bfd_boolean
-coff_new_section_hook (abfd, section)
- bfd * abfd;
- asection * section;
+coff_new_section_hook (bfd * abfd, asection * section)
{
combined_entry_type *native;
bfd_size_type amt;
@@ -1565,13 +1560,17 @@ coff_new_section_hook (abfd, section)
section->alignment_power = bfd_xcoff_data_align_power (abfd);
#endif
+ /* Set up the section symbol. */
+ if (!_bfd_generic_new_section_hook (abfd, section))
+ return FALSE;
+
/* 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);
+ native = bfd_zalloc (abfd, amt);
if (native == NULL)
return FALSE;
@@ -1597,13 +1596,10 @@ coff_new_section_hook (abfd, section)
/* 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;
+coff_set_alignment_hook (bfd * abfd ATTRIBUTE_UNUSED,
+ asection * section,
+ void * scnhdr)
{
struct internal_scnhdr *hdr = (struct internal_scnhdr *) scnhdr;
unsigned int i;
@@ -1632,25 +1628,22 @@ coff_set_alignment_hook (abfd, section, scnhdr)
#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;\
- }
+#define ALIGN_SET(field, x, y) \
+ if (((field) & IMAGE_SCN_ALIGN_64BYTES) == x)\
+ {\
+ section->alignment_power = y;\
+ }
-static void coff_set_alignment_hook PARAMS ((bfd *, asection *, PTR));
+#define ELIFALIGN_SET(field, x, y) \
+ else if (((field) & IMAGE_SCN_ALIGN_64BYTES) == x) \
+ {\
+ section->alignment_power = y;\
+ }
static void
-coff_set_alignment_hook (abfd, section, scnhdr)
- bfd * abfd ATTRIBUTE_UNUSED;
- asection * section;
- PTR scnhdr;
+coff_set_alignment_hook (bfd * abfd ATTRIBUTE_UNUSED,
+ asection * section,
+ void * scnhdr)
{
struct internal_scnhdr *hdr = (struct internal_scnhdr *) scnhdr;
bfd_size_type amt;
@@ -1670,22 +1663,19 @@ coff_set_alignment_hook (abfd, section, scnhdr)
if (coff_section_data (abfd, section) == NULL)
{
amt = sizeof (struct coff_section_tdata);
- section->used_by_bfd = (PTR) bfd_zalloc (abfd, amt);
+ section->used_by_bfd = bfd_zalloc (abfd, amt);
if (section->used_by_bfd == NULL)
- {
- /* FIXME: Return error. */
- abort ();
- }
+ /* 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);
+ coff_section_data (abfd, section)->tdata = bfd_zalloc (abfd, amt);
if (coff_section_data (abfd, section)->tdata == NULL)
- {
- /* FIXME: Return error. */
- abort ();
- }
+ /* FIXME: Return error. */
+ abort ();
}
pei_section_data (abfd, section)->virt_size = hdr->s_paddr;
pei_section_data (abfd, section)->pe_flags = hdr->s_flags;
@@ -1701,7 +1691,7 @@ coff_set_alignment_hook (abfd, section, scnhdr)
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)
+ if (bfd_bread (& dst, relsz, abfd) != relsz)
return;
coff_swap_reloc_in (abfd, &dst, &n);
@@ -1724,17 +1714,11 @@ coff_set_alignment_hook (abfd, section, scnhdr)
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;
+coff_set_alignment_hook (bfd *abfd, asection *section, void * scnhdr)
{
struct internal_scnhdr *hdr = (struct internal_scnhdr *) scnhdr;
asection *real_sec;
- asection **ps;
if ((hdr->s_flags & STYP_OVRFLO) == 0)
return;
@@ -1746,21 +1730,17 @@ coff_set_alignment_hook (abfd, section, scnhdr)
real_sec->reloc_count = hdr->s_paddr;
real_sec->lineno_count = hdr->s_vaddr;
- for (ps = &abfd->sections; *ps != NULL; ps = &(*ps)->next)
+ if (!bfd_section_removed_from_list (abfd, section))
{
- if (*ps == section)
- {
- bfd_section_list_remove (abfd, ps);
- --abfd->section_count;
- break;
- }
+ bfd_section_list_remove (abfd, section);
+ --abfd->section_count;
}
}
#else /* ! RS6000COFF_C */
#define coff_set_alignment_hook \
- ((void (*) PARAMS ((bfd *, asection *, PTR))) bfd_void)
+ ((void (*) (bfd *, asection *, void *)) bfd_void)
#endif /* ! RS6000COFF_C */
#endif /* ! COFF_WITH_PE */
@@ -1768,22 +1748,19 @@ coff_set_alignment_hook (abfd, section, scnhdr)
#ifndef coff_mkobject
-static bfd_boolean coff_mkobject PARAMS ((bfd *));
-
static bfd_boolean
-coff_mkobject (abfd)
- bfd * abfd;
+coff_mkobject (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)
+ abfd->tdata.coff_obj_data = bfd_zalloc (abfd, amt);
+ if (abfd->tdata.coff_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->symbols = NULL;
+ coff->conversion_table = NULL;
+ coff->raw_syments = NULL;
coff->relocbase = 0;
coff->local_toc_sym_map = 0;
@@ -1796,11 +1773,10 @@ coff_mkobject (abfd)
/* 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;
+static void *
+coff_mkobject_hook (bfd * abfd,
+ void * filehdr,
+ void * aouthdr ATTRIBUTE_UNUSED)
{
struct internal_filehdr *internal_f = (struct internal_filehdr *) filehdr;
coff_data_type *coff;
@@ -1870,7 +1846,7 @@ coff_mkobject_hook (abfd, filehdr, aouthdr)
abfd->flags |= HAS_DEBUG;
#endif
- return (PTR) coff;
+ return coff;
}
#endif
@@ -1882,9 +1858,7 @@ coff_mkobject_hook (abfd, filehdr, aouthdr)
at linking together COFF files for different architectures. */
static bfd_boolean
-coff_set_arch_mach_hook (abfd, filehdr)
- bfd *abfd;
- PTR filehdr;
+coff_set_arch_mach_hook (bfd *abfd, void * filehdr)
{
unsigned long machine;
enum bfd_architecture arch;
@@ -1908,22 +1882,22 @@ coff_set_arch_mach_hook (abfd, filehdr)
#ifdef I386MAGIC
case I386MAGIC:
case I386PTXMAGIC:
- case I386AIXMAGIC: /* Danbury PS/2 AIX C Compiler */
- case LYNXCOFFMAGIC: /* shadows the m68k Lynx number below, sigh */
+ case I386AIXMAGIC: /* Danbury PS/2 AIX C Compiler. */
+ case LYNXCOFFMAGIC: /* Shadows the m68k Lynx number below, sigh. */
arch = bfd_arch_i386;
break;
#endif
+#ifdef AMD64MAGIC
+ case AMD64MAGIC:
+ arch = bfd_arch_i386;
+ machine = bfd_mach_x86_64;
+ 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:
@@ -1967,6 +1941,22 @@ coff_set_arch_mach_hook (abfd, filehdr)
machine = bfd_mach_m68020;
break;
#endif
+#ifdef MAXQ20MAGIC
+ case MAXQ20MAGIC:
+ arch = bfd_arch_maxq;
+ switch (internal_f->f_flags & F_MACHMASK)
+ {
+ case F_MAXQ10:
+ machine = bfd_mach_maxq10;
+ break;
+ case F_MAXQ20:
+ machine = bfd_mach_maxq20;
+ break;
+ default:
+ return FALSE;
+ }
+ break;
+#endif
#ifdef MC88MAGIC
case MC88MAGIC:
case MC88DMAGIC:
@@ -1975,6 +1965,23 @@ coff_set_arch_mach_hook (abfd, filehdr)
machine = 88100;
break;
#endif
+#ifdef Z80MAGIC
+ case Z80MAGIC:
+ arch = bfd_arch_z80;
+ switch (internal_f->f_flags & F_MACHMASK)
+ {
+ case 0:
+ case bfd_mach_z80strict << 12:
+ case bfd_mach_z80 << 12:
+ case bfd_mach_z80full << 12:
+ case bfd_mach_r800 << 12:
+ machine = ((unsigned)internal_f->f_flags & F_MACHMASK) >> 12;
+ break;
+ default:
+ return FALSE;
+ }
+ break;
+#endif
#ifdef Z8KMAGIC
case Z8KMAGIC:
arch = bfd_arch_z8k;
@@ -2061,14 +2068,14 @@ coff_set_arch_mach_hook (abfd, filehdr)
struct internal_syment sym;
bfd_size_type amt = bfd_coff_symesz (abfd);
- buf = (bfd_byte *) bfd_malloc (amt);
+ buf = 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);
+ bfd_coff_swap_sym_in (abfd, buf, & sym);
if (sym.n_sclass == C_FILE)
cputype = sym.n_type & 0xff;
else
@@ -2257,13 +2264,8 @@ coff_set_arch_mach_hook (abfd, filehdr)
#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;
+symname_in_debug_hook (bfd * abfd ATTRIBUTE_UNUSED, struct internal_syment *sym)
{
return SYMNAME_IN_DEBUG (sym) != 0;
}
@@ -2271,7 +2273,7 @@ symname_in_debug_hook (abfd, sym)
#else
#define symname_in_debug_hook \
- (bfd_boolean (*) PARAMS ((bfd *, struct internal_syment *))) bfd_false
+ (bfd_boolean (*) (bfd *, struct internal_syment *)) bfd_false
#endif
@@ -2283,17 +2285,12 @@ symname_in_debug_hook (abfd, sym)
/* 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;
+coff_pointerize_aux_hook (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;
@@ -2322,17 +2319,12 @@ coff_pointerize_aux_hook (abfd, table_base, symbol, indaux, aux)
/* 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;
+coff_pointerize_aux_hook (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. */
@@ -2351,18 +2343,13 @@ coff_pointerize_aux_hook (abfd, table_base, symbol, indaux, aux)
/* 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;
+coff_print_aux (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
@@ -2375,7 +2362,8 @@ coff_print_aux (abfd, file, table_base, symbol, aux, indaux)
{
BFD_ASSERT (! aux->fix_scnlen);
#ifdef XCOFF64
- fprintf (file, "val %5lld", aux->u.auxent.x_csect.x_scnlen.l);
+ fprintf (file, "val %5lld",
+ (long long) aux->u.auxent.x_csect.x_scnlen.l);
#else
fprintf (file, "val %5ld", (long) aux->u.auxent.x_csect.x_scnlen.l);
#endif
@@ -2385,7 +2373,8 @@ coff_print_aux (abfd, file, table_base, symbol, aux, indaux)
fprintf (file, "indx ");
if (! aux->fix_scnlen)
#ifdef XCOFF64
- fprintf (file, "%4lld", aux->u.auxent.x_csect.x_scnlen.l);
+ fprintf (file, "%4lld",
+ (long long) aux->u.auxent.x_csect.x_scnlen.l);
#else
fprintf (file, "%4ld", (long) aux->u.auxent.x_csect.x_scnlen.l);
#endif
@@ -2428,13 +2417,10 @@ SUBSUBSECTION
#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;
+compare_arelent_ptr (const void * x, const void * y)
{
const arelent **a = (const arelent **) x;
const arelent **b = (const arelent **) y;
@@ -2447,13 +2433,11 @@ compare_arelent_ptr (x, y)
#endif /* TARG_AUX */
static bfd_boolean
-coff_write_relocs (abfd, first_undef)
- bfd * abfd;
- int first_undef;
+coff_write_relocs (bfd * abfd, int first_undef)
{
asection *s;
- for (s = abfd->sections; s != (asection *) NULL; s = s->next)
+ for (s = abfd->sections; s != NULL; s = s->next)
{
unsigned int i;
struct external_reloc dst;
@@ -2468,7 +2452,7 @@ coff_write_relocs (abfd, first_undef)
amt = s->reloc_count;
amt *= sizeof (arelent *);
- p = (arelent **) bfd_malloc (amt);
+ p = bfd_malloc (amt);
if (p == NULL && s->reloc_count > 0)
return FALSE;
memcpy (p, s->orelocation, (size_t) amt);
@@ -2485,12 +2469,12 @@ coff_write_relocs (abfd, first_undef)
/* Encode real count here as first reloc. */
struct internal_reloc n;
- memset ((PTR) & n, 0, sizeof (n));
+ memset (& 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))
+ if (bfd_bwrite (& dst, (bfd_size_type) bfd_coff_relsz (abfd),
+ abfd) != bfd_coff_relsz (abfd))
return FALSE;
}
#endif
@@ -2500,7 +2484,7 @@ coff_write_relocs (abfd, first_undef)
struct internal_reloc n;
arelent *q = p[i];
- memset ((PTR) & n, 0, sizeof (n));
+ memset (& n, 0, sizeof (n));
/* Now we've renumbered the symbols we know where the
undefined symbols live in the table. Check the reloc
@@ -2522,11 +2506,12 @@ coff_write_relocs (abfd, first_undef)
{
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;
- }
+ if (strcmp (intable, sname) == 0)
+ {
+ /* Got a hit, so repoint the reloc. */
+ q->sym_ptr_ptr = outsyms + j;
+ break;
+ }
}
}
@@ -2543,7 +2528,7 @@ coff_write_relocs (abfd, first_undef)
if (q->sym_ptr_ptr)
{
#ifdef SECTION_RELATIVE_ABSOLUTE_SYMBOL_P
- if (SECTION_RELATIVE_ABSOLUTE_SYMBOL_P (q,s))
+ 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)
@@ -2553,11 +2538,15 @@ coff_write_relocs (abfd, first_undef)
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?? */
+ /* Check to see if the symbol reloc points to a symbol
+ we don't have in our symbol table. */
if (n.r_symndx > obj_conv_table_size (abfd))
- abort ();
+ {
+ bfd_set_error (bfd_error_bad_value);
+ _bfd_error_handler (_("%B: reloc against a non-existant symbol index: %ld"),
+ abfd, n.r_symndx);
+ return FALSE;
+ }
}
}
@@ -2573,7 +2562,7 @@ coff_write_relocs (abfd, first_undef)
#endif
coff_swap_reloc_out (abfd, &n, &dst);
- if (bfd_bwrite ((PTR) & dst, (bfd_size_type) bfd_coff_relsz (abfd),
+ if (bfd_bwrite (& dst, (bfd_size_type) bfd_coff_relsz (abfd),
abfd) != bfd_coff_relsz (abfd))
return FALSE;
}
@@ -2591,68 +2580,62 @@ coff_write_relocs (abfd, first_undef)
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;
+coff_set_flags (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;
+#ifdef Z80MAGIC
+ case bfd_arch_z80:
+ *magicp = Z80MAGIC;
switch (bfd_get_mach (abfd))
{
- case bfd_mach_z8001:
- *flagsp = F_Z8001;
- break;
- case bfd_mach_z8002:
- *flagsp = F_Z8002;
+ case 0:
+ case bfd_mach_z80strict:
+ case bfd_mach_z80:
+ case bfd_mach_z80full:
+ case bfd_mach_r800:
+ *flagsp = bfd_get_mach (abfd) << 12;
break;
default:
return FALSE;
}
return TRUE;
#endif
-#ifdef I960ROMAGIC
+#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;
+ 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;
@@ -2698,6 +2681,7 @@ coff_set_flags (abfd, magicp, flagsp)
*magicp = TIC80_ARCH_MAGIC;
return TRUE;
#endif
+
#ifdef ARMMAGIC
case bfd_arch_arm:
#ifdef ARM_WINCE
@@ -2736,34 +2720,40 @@ coff_set_flags (abfd, magicp, flagsp)
}
return TRUE;
#endif
+
#ifdef PPCMAGIC
case bfd_arch_powerpc:
*magicp = PPCMAGIC;
return TRUE;
- break;
#endif
-#ifdef I386MAGIC
+
+#if defined(I386MAGIC) || defined(AMD64MAGIC)
case bfd_arch_i386:
+#if defined(I386MAGIC)
*magicp = I386MAGIC;
-#ifdef LYNXOS
+#endif
+#if defined LYNXOS
/* Just overwrite the usual value if we're doing Lynx. */
*magicp = LYNXCOFFMAGIC;
#endif
+#if defined AMD64MAGIC
+ *magicp = AMD64MAGIC;
+#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
@@ -2781,34 +2771,24 @@ coff_set_flags (abfd, magicp, flagsp)
*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;
+ 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;
+ default: break;
}
break;
#endif
@@ -2824,14 +2804,12 @@ coff_set_flags (abfd, magicp, flagsp)
*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
@@ -2842,7 +2820,6 @@ coff_set_flags (abfd, magicp, flagsp)
*magicp = LYNXCOFFMAGIC;
#endif
return TRUE;
- break;
#endif
#ifdef H8500MAGIC
@@ -2851,21 +2828,11 @@ coff_set_flags (abfd, magicp, flagsp)
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
@@ -2876,7 +2843,6 @@ coff_set_flags (abfd, magicp, flagsp)
BFD_ASSERT (bfd_get_flavour (abfd) == bfd_target_xcoff_flavour);
*magicp = bfd_xcoff_magic_number (abfd);
return TRUE;
- break;
#endif
#ifdef MCOREMAGIC
@@ -2900,6 +2866,17 @@ coff_set_flags (abfd, magicp, flagsp)
return TRUE;
#endif
+#ifdef MAXQ20MAGIC
+ case bfd_arch_maxq:
+ * magicp = MAXQ20MAGIC;
+ switch (bfd_get_mach (abfd))
+ {
+ case bfd_mach_maxq10: * flagsp = F_MAXQ10; return TRUE;
+ case bfd_mach_maxq20: * flagsp = F_MAXQ20; return TRUE;
+ default: return FALSE;
+ }
+#endif
+
default: /* Unknown architecture. */
/* Fall through to "return FALSE" below, to avoid
"statement never reached" errors on the one below. */
@@ -2910,10 +2887,9 @@ coff_set_flags (abfd, magicp, flagsp)
}
static bfd_boolean
-coff_set_arch_mach (abfd, arch, machine)
- bfd * abfd;
- enum bfd_architecture arch;
- unsigned long machine;
+coff_set_arch_mach (bfd * abfd,
+ enum bfd_architecture arch,
+ unsigned long machine)
{
unsigned dummy1;
unsigned short dummy2;
@@ -2923,9 +2899,9 @@ coff_set_arch_mach (abfd, arch, machine)
if (arch != bfd_arch_unknown
&& ! coff_set_flags (abfd, &dummy1, &dummy2))
- return FALSE; /* We can't represent this type */
+ return FALSE; /* We can't represent this type. */
- return TRUE; /* We're easy ... */
+ return TRUE; /* We're easy... */
}
#ifdef COFF_IMAGE_WITH_PE
@@ -2933,12 +2909,8 @@ coff_set_arch_mach (abfd, arch, machine)
/* 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;
+sort_by_secaddr (const void * arg1, const void * arg2)
{
const asection *a = *(const asection **) arg1;
const asection *b = *(const asection **) arg2;
@@ -2947,8 +2919,8 @@ sort_by_secaddr (arg1, arg2)
return -1;
else if (a->vma > b->vma)
return 1;
- else
- return 0;
+
+ return 0;
}
#endif /* COFF_IMAGE_WITH_PE */
@@ -2963,11 +2935,10 @@ sort_by_secaddr (arg1, arg2)
#endif
static bfd_boolean
-coff_compute_section_file_positions (abfd)
- bfd * abfd;
+coff_compute_section_file_positions (bfd * abfd)
{
asection *current;
- asection *previous = (asection *) NULL;
+ asection *previous = NULL;
file_ptr sofar = bfd_coff_filhsz (abfd);
bfd_boolean align_adjust;
#ifdef ALIGN_SECTIONS_IN_FILE
@@ -3004,10 +2975,10 @@ coff_compute_section_file_positions (abfd)
{
asection *dsec;
- dsec = bfd_make_section_old_way (abfd, ".debug");
+ dsec = bfd_make_section_old_way (abfd, DOT_DEBUG);
if (dsec == NULL)
abort ();
- dsec->_raw_size = sz;
+ dsec->size = sz;
dsec->flags |= SEC_HAS_CONTENTS;
}
}
@@ -3015,6 +2986,7 @@ coff_compute_section_file_positions (abfd)
#ifdef COFF_IMAGE_WITH_PE
int page_size;
+
if (coff_data (abfd)->link_info)
{
page_size = pe_data (abfd)->pe_opthdr.FileAlignment;
@@ -3033,11 +3005,9 @@ coff_compute_section_file_positions (abfd)
#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;
- }
+ /* 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);
@@ -3095,18 +3065,19 @@ coff_compute_section_file_positions (abfd)
/* Rethread the linked list into sorted order; at the same time,
assign target_index values. */
target_index = 1;
- abfd->sections = section_list[0];
+ abfd->sections = NULL;
+ abfd->section_last = NULL;
for (i = 0; i < count; i++)
{
current = section_list[i];
- current->next = section_list[i + 1];
+ bfd_section_list_append (abfd, current);
/* 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)
+ if (current->size == 0)
{
/* Discard. However, it still might have (valid) symbols
in it, so arbitrarily set it to section 1 (indexing is
@@ -3118,7 +3089,6 @@ coff_compute_section_file_positions (abfd)
else
current->target_index = target_index++;
}
- abfd->section_tail = &current->next;
free (section_list);
}
@@ -3135,7 +3105,7 @@ coff_compute_section_file_positions (abfd)
align_adjust = FALSE;
for (current = abfd->sections;
- current != (asection *) NULL;
+ current != NULL;
current = current->next)
{
#ifdef COFF_IMAGE_WITH_PE
@@ -3144,20 +3114,21 @@ coff_compute_section_file_positions (abfd)
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);
+
+ current->used_by_bfd = 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);
+
+ coff_section_data (abfd, current)->tdata = 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;
+ pei_section_data (abfd, current)->virt_size = current->size;
#endif
/* Only deal with sections which have contents. */
@@ -3166,7 +3137,7 @@ coff_compute_section_file_positions (abfd)
#ifdef COFF_IMAGE_WITH_PE
/* Make sure we skip empty sections in a PE image. */
- if (current->_raw_size == 0)
+ if (current->size == 0)
continue;
#endif
@@ -3179,8 +3150,8 @@ coff_compute_section_file_positions (abfd)
{
/* 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
@@ -3213,8 +3184,8 @@ coff_compute_section_file_positions (abfd)
sofar = BFD_ALIGN (sofar, 1 << current->alignment_power);
}
#endif
- if (previous != (asection *) NULL)
- previous->_raw_size += sofar - old_sofar;
+ if (previous != NULL)
+ previous->size += sofar - old_sofar;
}
#endif
@@ -3224,16 +3195,16 @@ coff_compute_section_file_positions (abfd)
#ifdef COFF_PAGE_SIZE
if ((abfd->flags & D_PAGED) != 0
&& (current->flags & SEC_ALLOC) != 0)
- sofar += (current->vma - sofar) % page_size;
+ sofar += (current->vma - (bfd_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;
+ current->size = (current->size + page_size -1) & -page_size;
#endif
- sofar += current->_raw_size;
+ sofar += current->size;
#ifdef ALIGN_SECTIONS_IN_FILE
/* Make sure that this section is of the right size too. */
@@ -3241,26 +3212,26 @@ coff_compute_section_file_positions (abfd)
{
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;
+ old_size = current->size;
+ current->size = BFD_ALIGN (current->size,
+ 1 << current->alignment_power);
+ align_adjust = current->size != old_size;
+ sofar += current->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;
+ current->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)
+ size, in case the caller only writes out data to the
+ unaligned size. */
+ if (pei_section_data (abfd, current)->virt_size < current->size)
align_adjust = TRUE;
#endif
@@ -3301,95 +3272,13 @@ coff_compute_section_file_positions (abfd)
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;
+coff_read_word (bfd *abfd, unsigned int *value)
{
unsigned char b[2];
int status;
@@ -3412,8 +3301,7 @@ coff_read_word (abfd, value)
}
static unsigned int
-coff_compute_checksum (abfd)
- bfd *abfd;
+coff_compute_checksum (bfd *abfd)
{
bfd_boolean more_data;
file_ptr filepos;
@@ -3440,8 +3328,7 @@ coff_compute_checksum (abfd)
}
static bfd_boolean
-coff_apply_checksum (abfd)
- bfd *abfd;
+coff_apply_checksum (bfd *abfd)
{
unsigned int computed;
unsigned int checksum = 0;
@@ -3475,11 +3362,8 @@ coff_apply_checksum (abfd)
#endif /* COFF_IMAGE_WITH_PE */
-/* SUPPRESS 558 */
-/* SUPPRESS 529 */
static bfd_boolean
-coff_write_object_contents (abfd)
- bfd * abfd;
+coff_write_object_contents (bfd * abfd)
{
asection *current;
bfd_boolean hasrelocs = FALSE;
@@ -3505,7 +3389,6 @@ coff_write_object_contents (abfd)
/* 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)
@@ -3545,9 +3428,8 @@ coff_write_object_contents (abfd)
lineno_base += current->lineno_count * bfd_coff_linesz (abfd);
}
else
- {
- current->line_filepos = 0;
- }
+ current->line_filepos = 0;
+
if (current->reloc_count)
{
current->rel_filepos = reloc_base;
@@ -3559,9 +3441,7 @@ coff_write_object_contents (abfd)
#endif
}
else
- {
- current->rel_filepos = 0;
- }
+ current->rel_filepos = 0;
}
/* Write section headers to the file. */
@@ -3632,7 +3512,7 @@ coff_write_object_contents (abfd)
#endif
section.s_vaddr = current->vma;
section.s_paddr = current->lma;
- section.s_size = current->_raw_size;
+ section.s_size = current->size;
#ifdef coff_get_section_load_page
section.s_page = coff_get_section_load_page (current);
#endif
@@ -3651,8 +3531,8 @@ coff_write_object_contents (abfd)
/* 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)
+ if (current->size == 0
+ || (current->flags & (SEC_LOAD | SEC_HAS_CONTENTS)) == 0)
section.s_scnptr = 0;
else
section.s_scnptr = current->filepos;
@@ -3720,7 +3600,7 @@ coff_write_object_contents (abfd)
bfd_size_type amt = bfd_coff_scnhsz (abfd);
if (coff_swap_scnhdr_out (abfd, &section, &buff) == 0
- || bfd_bwrite ((PTR) &buff, amt, abfd) != amt)
+ || bfd_bwrite (& buff, amt, abfd) != amt)
return FALSE;
}
@@ -3844,7 +3724,7 @@ coff_write_object_contents (abfd)
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)
+ || bfd_bwrite (& buff, amt, abfd) != amt)
return FALSE;
}
}
@@ -3886,8 +3766,11 @@ coff_write_object_contents (abfd)
#ifdef COFF_IMAGE_WITH_PE
if (! hasdebug)
internal_f.f_flags |= IMAGE_FILE_DEBUG_STRIPPED;
+ if (pe_data (abfd)->real_flags & IMAGE_FILE_LARGE_ADDRESS_AWARE)
+ internal_f.f_flags |= IMAGE_FILE_LARGE_ADDRESS_AWARE;
#endif
+#ifndef COFF_WITH_pex64
#ifdef COFF_WITH_PE
internal_f.f_flags |= IMAGE_FILE_32BIT_MACHINE;
#else
@@ -3896,6 +3779,7 @@ coff_write_object_contents (abfd)
else
internal_f.f_flags |= F_AR32W;
#endif
+#endif
#ifdef TI_TARGET_ID
/* Target id is used in TI COFF v1 and later; COFF0 won't use this field,
@@ -3928,18 +3812,6 @@ coff_write_object_contents (abfd)
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__
@@ -4001,16 +3873,18 @@ coff_write_object_contents (abfd)
#if defined(I386)
#define __A_MAGIC_SET__
-#if defined(LYNXOS)
+#if defined LYNXOS
internal_a.magic = LYNXCOFFMAGIC;
-#else /* LYNXOS */
+#elif defined AMD64
+ internal_a.magic = IMAGE_NT_OPTIONAL_HDR64_MAGIC;
+#else
internal_a.magic = ZMAGIC;
-#endif /* LYNXOS */
+#endif
#endif /* I386 */
#if defined(IA64)
#define __A_MAGIC_SET__
- internal_a.magic = ZMAGIC;
+ internal_a.magic = PE32PMAGIC;
#endif /* IA64 */
#if defined(SPARC)
@@ -4042,6 +3916,11 @@ coff_write_object_contents (abfd)
internal_a.magic = NMAGIC; /* Assume separate i/d. */
#endif
+#ifdef MAXQ20MAGIC
+#define __A_MAGIC_SET__
+ internal_a.magic = MAXQ20MAGIC;
+#endif
+
#ifndef __A_MAGIC_SET__
#include "Your aouthdr magic number is not being set!"
#else
@@ -4058,10 +3937,7 @@ coff_write_object_contents (abfd)
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);
@@ -4122,17 +3998,17 @@ coff_write_object_contents (abfd)
if (text_sec)
{
- internal_a.tsize = bfd_get_section_size_before_reloc (text_sec);
+ internal_a.tsize = text_sec->size;
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.dsize = data_sec->size;
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);
+ internal_a.bsize = bss_sec->size;
if (internal_a.bsize && bss_sec->vma < internal_a.data_start)
internal_a.data_start = bss_sec->vma;
}
@@ -4211,7 +4087,7 @@ coff_write_object_contents (abfd)
}
#endif
- /* now write them */
+ /* Now write them. */
if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0)
return FALSE;
@@ -4223,8 +4099,8 @@ coff_write_object_contents (abfd)
if (buff == NULL)
return FALSE;
- bfd_coff_swap_filehdr_out (abfd, (PTR) &internal_f, (PTR) buff);
- amount = bfd_bwrite ((PTR) buff, amount, abfd);
+ bfd_coff_swap_filehdr_out (abfd, & internal_f, buff);
+ amount = bfd_bwrite (buff, amount, abfd);
free (buff);
@@ -4243,8 +4119,8 @@ coff_write_object_contents (abfd)
if (buff == NULL)
return FALSE;
- coff_swap_aouthdr_out (abfd, (PTR) &internal_a, (PTR) buff);
- amount = bfd_bwrite ((PTR) buff, amount, abfd);
+ coff_swap_aouthdr_out (abfd, & internal_a, buff);
+ amount = bfd_bwrite (buff, amount, abfd);
free (buff);
@@ -4263,12 +4139,12 @@ coff_write_object_contents (abfd)
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);
+ coff_swap_aouthdr_out (abfd, & internal_a, & 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)
+ if (bfd_bwrite (& buff, (bfd_size_type) size, abfd) != size)
return FALSE;
}
#endif
@@ -4277,12 +4153,11 @@ coff_write_object_contents (abfd)
}
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;
+coff_set_section_contents (bfd * abfd,
+ sec_ptr section,
+ const void * location,
+ file_ptr offset,
+ bfd_size_type count)
{
if (! abfd->output_has_begun) /* Set by bfd.c handler. */
{
@@ -4291,7 +4166,6 @@ coff_set_section_contents (abfd, section, location, offset, count)
}
#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
@@ -4312,7 +4186,6 @@ coff_set_section_contents (abfd, section, location, offset, count)
<robertl@arnet.com> (Thanks!).
Gvran Uddeborg <gvran@uddeborg.pp.se>. */
-
if (strcmp (section->name, _LIB) == 0)
{
bfd_byte *rec, *recend;
@@ -4327,7 +4200,6 @@ coff_set_section_contents (abfd, section, location, offset, count)
BFD_ASSERT (rec == recend);
}
-
#endif
/* Don't write out bss sections - one way to do this is to
@@ -4343,47 +4215,19 @@ coff_set_section_contents (abfd, section, location, offset, count)
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;
+static void *
+buy_and_read (bfd *abfd, file_ptr where, bfd_size_type size)
{
- PTR area = (PTR) bfd_alloc (abfd, size);
+ void * area = 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
@@ -4406,31 +4250,27 @@ SUBSUBSECTION
pointing its...
How does this work ?
-
*/
static bfd_boolean
-coff_slurp_line_table (abfd, asect)
- bfd *abfd;
- asection *asect;
+coff_slurp_line_table (bfd *abfd, asection *asect)
{
LINENO *native_lineno;
alent *lineno_cache;
bfd_size_type amt;
- BFD_ASSERT (asect->lineno == (alent *) NULL);
+ BFD_ASSERT (asect->lineno == 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));
+ (_("%B: warning: line number table read failed"), abfd);
return FALSE;
}
amt = ((bfd_size_type) asect->lineno_count + 1) * sizeof (alent);
- lineno_cache = (alent *) bfd_alloc (abfd, amt);
+ lineno_cache = bfd_alloc (abfd, amt);
if (lineno_cache == NULL)
return FALSE;
else
@@ -4458,8 +4298,8 @@ coff_slurp_line_table (abfd, asect)
|| (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);
+ (_("%B: warning: illegal symbol index %ld in line numbers"),
+ abfd, dst.l_addr.l_symndx);
symndx = 0;
warned = TRUE;
}
@@ -4472,17 +4312,14 @@ coff_slurp_line_table (abfd, asect)
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));
+ (_("%B: warning: duplicate line number information for `%s'"),
+ 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->u.offset = dst.l_addr.l_paddr
+ - bfd_section_vma (abfd, asect);
cache_ptr++;
src++;
@@ -4501,8 +4338,7 @@ coff_slurp_line_table (abfd, asect)
symbols via coff_link_add_symbols, rather than via this routine. */
static bfd_boolean
-coff_slurp_symbol_table (abfd)
- bfd * abfd;
+coff_slurp_symbol_table (bfd * abfd)
{
combined_entry_type *native_symbols;
coff_symbol_type *cached_area;
@@ -4520,13 +4356,13 @@ coff_slurp_symbol_table (abfd)
/* 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);
+ cached_area = 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);
+ table_ptr = bfd_alloc (abfd, amt);
if (table_ptr == NULL)
return FALSE;
@@ -4554,11 +4390,6 @@ coff_slurp_symbol_table (abfd)
{
#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
@@ -4593,11 +4424,9 @@ coff_slurp_symbol_table (abfd)
- 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;
- }
+ /* 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:
@@ -4683,11 +4512,6 @@ coff_slurp_symbol_table (abfd)
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. */
@@ -4828,20 +4652,18 @@ coff_slurp_symbol_table (abfd)
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,
+ (_("%B: Unrecognized storage class %d for %s symbol `%s'"),
+ 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;
+ dst->lineno = NULL;
this_index += (src->u.syment.n_numaux) + 1;
dst++;
number_of_symbols++;
@@ -4866,16 +4688,15 @@ coff_slurp_symbol_table (abfd)
}
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;
+coff_classify_symbol (bfd *abfd,
+ struct internal_syment *syment)
{
/* FIXME: This partially duplicates the switch in
coff_slurp_symbol_table. */
@@ -4913,18 +4734,15 @@ coff_classify_symbol (abfd, syment)
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;
- }
+ /* 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;
@@ -4955,15 +4773,13 @@ coff_classify_symbol (abfd, syment)
#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));
+ (_("warning: %B: local symbol `%s' has no section"),
+ abfd, _bfd_coff_internal_syment_name (abfd, syment, buf));
}
return COFF_SYMBOL_LOCAL;
@@ -4994,23 +4810,23 @@ SUBSUBSECTION
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; \
+ coff_symbol_type *coffsym = 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 \
+ if (coffsym != NULL \
&& coffsym->native->u.syment.n_scnum == 0) \
cache_ptr->addend = 0; \
else if (ptr && bfd_asymbol_bfd (ptr) == abfd \
- && ptr->section != (asection *) NULL) \
+ && ptr->section != NULL) \
cache_ptr->addend = - (ptr->section->vma + ptr->value); \
else \
cache_ptr->addend = 0; \
@@ -5018,10 +4834,7 @@ SUBSUBSECTION
#endif
static bfd_boolean
-coff_slurp_reloc_table (abfd, asect, symbols)
- bfd * abfd;
- sec_ptr asect;
- asymbol ** symbols;
+coff_slurp_reloc_table (bfd * abfd, sec_ptr asect, asymbol ** symbols)
{
RELOC *native_relocs;
arelent *reloc_cache;
@@ -5037,12 +4850,13 @@ coff_slurp_reloc_table (abfd, asect, symbols)
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);
+ reloc_cache = bfd_alloc (abfd, amt);
- if (reloc_cache == NULL)
+ if (reloc_cache == NULL || native_relocs == NULL)
return FALSE;
for (idx = 0; idx < asect->reloc_count; idx++)
@@ -5056,6 +4870,7 @@ coff_slurp_reloc_table (abfd, asect, symbols)
cache_ptr = reloc_cache + idx;
src = native_relocs + idx;
+ dst.r_offset = 0;
coff_swap_reloc_in (abfd, src, &dst);
#ifdef RELOC_PROCESSING
@@ -5068,8 +4883,8 @@ coff_slurp_reloc_table (abfd, asect, symbols)
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);
+ (_("%B: warning: illegal symbol index %ld in relocs"),
+ abfd, dst.r_symndx);
cache_ptr->sym_ptr_ptr = bfd_abs_section_ptr->symbol_ptr_ptr;
ptr = NULL;
}
@@ -5097,7 +4912,7 @@ coff_slurp_reloc_table (abfd, asect, symbols)
CALC_ADDEND (abfd, ptr, dst, cache_ptr);
cache_ptr->address -= asect->vma;
-/* !! cache_ptr->section = (asection *) NULL;*/
+ /* !! cache_ptr->section = NULL;*/
/* Fill in the cache_ptr->howto field from dst.r_type. */
RTYPE2HOWTO (cache_ptr, &dst);
@@ -5106,8 +4921,8 @@ coff_slurp_reloc_table (abfd, asect, symbols)
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);
+ (_("%B: illegal relocation type %d at address 0x%lx"),
+ abfd, dst.r_type, (long) dst.r_vaddr);
bfd_set_error (bfd_error_bad_value);
return FALSE;
}
@@ -5126,22 +4941,17 @@ coff_slurp_reloc_table (abfd, asect, symbols)
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;
+coff_rtype_to_howto (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;
+ genrel.howto = NULL;
RTYPE2HOWTO (&genrel, rel);
return genrel.howto;
}
@@ -5154,12 +4964,12 @@ coff_rtype_to_howto (abfd, sec, rel, h, sym, addendp)
#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;
+coff_canonicalize_reloc (bfd * abfd,
+ sec_ptr section,
+ arelent ** relptr,
+ asymbol ** symbols)
{
arelent *tblptr = section->relocation;
unsigned int count = 0;
@@ -5191,29 +5001,15 @@ coff_canonicalize_reloc (abfd, section, relptr, symbols)
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;
+dummy_reloc16_estimate (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;
@@ -5227,20 +5023,14 @@ dummy_reloc16_estimate (abfd, input_section, reloc, shrink, link_info)
/* 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;
+dummy_reloc16_extra_cases (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 ();
}
@@ -5252,7 +5042,9 @@ dummy_reloc16_extra_cases (abfd, link_info, link_order, reloc, data, src_ptr,
/* 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
@@ -5262,7 +5054,9 @@ dummy_reloc16_extra_cases (abfd, link_info, link_order, reloc, data, src_ptr,
#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
@@ -5271,9 +5065,10 @@ dummy_reloc16_extra_cases (abfd, link_info, link_order, reloc, data, src_ptr,
#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_just_syms _bfd_generic_link_just_syms
#define coff_bfd_link_split_section _bfd_generic_link_split_section
#ifndef coff_start_final_link
@@ -5290,13 +5085,9 @@ dummy_reloc16_extra_cases (abfd, link_info, link_order, reloc, data, src_ptr,
#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;
+coff_link_output_has_begun (bfd * abfd,
+ struct coff_final_link_info * info ATTRIBUTE_UNUSED)
{
return abfd->output_has_begun;
}
@@ -5304,13 +5095,9 @@ coff_link_output_has_begun (abfd, info)
#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;
+coff_final_link_postscript (bfd * abfd ATTRIBUTE_UNUSED,
+ struct coff_final_link_info * pfinfo ATTRIBUTE_UNUSED)
{
return TRUE;
}
@@ -5359,7 +5146,7 @@ coff_final_link_postscript (abfd, pfinfo)
#define coff_SWAP_scnhdr_in coff_swap_scnhdr_in
#endif
-static const bfd_coff_backend_data bfd_coff_std_swap_table =
+static const bfd_coff_backend_data bfd_coff_std_swap_table ATTRIBUTE_UNUSED =
{
coff_SWAP_aux_in, coff_SWAP_sym_in, coff_SWAP_lineno_in,
coff_SWAP_aux_out, coff_SWAP_sym_out,
@@ -5401,6 +5188,7 @@ static const bfd_coff_backend_data bfd_coff_std_swap_table =
#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,
@@ -5444,6 +5232,7 @@ static const bfd_coff_backend_data ticoff0_swap_table =
#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,
@@ -5501,6 +5290,10 @@ static const bfd_coff_backend_data ticoff1_swap_table =
#define coff_bfd_copy_private_symbol_data _bfd_generic_bfd_copy_private_symbol_data
#endif
+#ifndef coff_bfd_copy_private_header_data
+#define coff_bfd_copy_private_header_data _bfd_generic_bfd_copy_private_header_data
+#endif
+
#ifndef coff_bfd_copy_private_section_data
#define coff_bfd_copy_private_section_data _bfd_generic_bfd_copy_private_section_data
#endif
@@ -5525,6 +5318,10 @@ static const bfd_coff_backend_data ticoff1_swap_table =
#define coff_bfd_is_local_label_name _bfd_coff_is_local_label_name
#endif
+#ifndef coff_bfd_is_target_special_symbol
+#define coff_bfd_is_target_special_symbol ((bfd_boolean (*) (bfd *, asymbol *)) bfd_false)
+#endif
+
#ifndef coff_read_minisymbols
#define coff_read_minisymbols _bfd_generic_read_minisymbols
#endif
@@ -5538,6 +5335,9 @@ static const bfd_coff_backend_data ticoff1_swap_table =
#ifndef coff_bfd_reloc_type_lookup
#define coff_bfd_reloc_type_lookup _bfd_norelocs_bfd_reloc_type_lookup
#endif
+#ifndef coff_bfd_reloc_name_lookup
+#define coff_bfd_reloc_name_lookup _bfd_norelocs_bfd_reloc_name_lookup
+#endif
#ifndef coff_bfd_get_relocated_section_contents
#define coff_bfd_get_relocated_section_contents \
@@ -5556,25 +5356,34 @@ static const bfd_coff_backend_data ticoff1_swap_table =
#define coff_bfd_merge_sections bfd_generic_merge_sections
#endif
+#ifndef coff_bfd_is_group_section
+#define coff_bfd_is_group_section bfd_generic_is_group_section
+#endif
+
#ifndef coff_bfd_discard_group
#define coff_bfd_discard_group bfd_generic_discard_group
#endif
+#ifndef coff_section_already_linked
+#define coff_section_already_linked \
+ _bfd_generic_section_already_linked
+#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 */ \
+ 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 */ \
+ UNDER, /* Leading symbol underscore. */ \
+ '/', /* AR_pad_char. */ \
+ 15, /* AR_max_namelen. */ \
\
/* Data conversion functions. */ \
bfd_getb64, bfd_getb_signed_64, bfd_putb64, \
@@ -5586,12 +5395,12 @@ const bfd_target VAR = \
bfd_getb32, bfd_getb_signed_32, bfd_putb32, \
bfd_getb16, bfd_getb_signed_16, bfd_putb16, \
\
- /* bfd_check_format */ \
+ /* bfd_check_format. */ \
{ _bfd_dummy_target, coff_object_p, bfd_generic_archive_p, \
_bfd_dummy_target }, \
- /* bfd_set_format */ \
+ /* bfd_set_format. */ \
{ bfd_false, coff_mkobject, _bfd_generic_mkarchive, bfd_false }, \
- /* bfd_write_contents */ \
+ /* bfd_write_contents. */ \
{ bfd_false, coff_write_object_contents, _bfd_write_archive_contents, \
bfd_false }, \
\
@@ -5615,16 +5424,16 @@ 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 */ \
+ 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 */ \
+ UNDER, /* Leading symbol underscore. */ \
+ '/', /* AR_pad_char. */ \
+ 15, /* AR_max_namelen. */ \
\
/* Data conversion functions. */ \
bfd_getb64, bfd_getb_signed_64, bfd_putb64, \
@@ -5636,12 +5445,12 @@ const bfd_target VAR = \
bfd_getb32, bfd_getb_signed_32, bfd_putb32, \
bfd_getb16, bfd_getb_signed_16, bfd_putb16, \
\
- /* bfd_check_format */ \
+ /* bfd_check_format. */ \
{ _bfd_dummy_target, coff_object_p, bfd_generic_archive_p, \
_bfd_dummy_target }, \
- /* bfd_set_format */ \
+ /* bfd_set_format. */ \
{ bfd_false, coff_mkobject, _bfd_generic_mkarchive, bfd_false }, \
- /* bfd_write_contents */ \
+ /* bfd_write_contents. */ \
{ bfd_false, coff_write_object_contents, _bfd_write_archive_contents, \
bfd_false }, \
\
@@ -5665,16 +5474,16 @@ 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 */ \
+ 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 */ \
+ UNDER, /* Leading symbol underscore. */ \
+ '/', /* AR_pad_char. */ \
+ 15, /* AR_max_namelen. */ \
\
/* Data conversion functions. */ \
bfd_getl64, bfd_getl_signed_64, bfd_putl64, \
@@ -5684,12 +5493,12 @@ const bfd_target VAR = \
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_check_format. */ \
{ _bfd_dummy_target, coff_object_p, bfd_generic_archive_p, \
_bfd_dummy_target }, \
- /* bfd_set_format */ \
+ /* bfd_set_format. */ \
{ bfd_false, coff_mkobject, _bfd_generic_mkarchive, bfd_false }, \
- /* bfd_write_contents */ \
+ /* bfd_write_contents. */ \
{ bfd_false, coff_write_object_contents, _bfd_write_archive_contents, \
bfd_false }, \
\
diff --git a/contrib/binutils/bfd/coffgen.c b/contrib/binutils/bfd/coffgen.c
index a712b4b..8884a7f 100644
--- a/contrib/binutils/bfd/coffgen.c
+++ b/contrib/binutils/bfd/coffgen.c
@@ -1,24 +1,24 @@
/* Support for the generic parts of COFF, for BFD.
Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
- 2000, 2001, 2002, 2003
+ 2000, 2001, 2002, 2003, 2004, 2005, 2007
Free Software Foundation, Inc.
Written by Cygnus Support.
-This file is part of BFD, the Binary File Descriptor library.
+ 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 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.
+ 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. */
+ 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., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
/* Most of this hacked by Steve Chamberlain, sac@cygnus.com.
Split out of coffcode.h by Ian Taylor, ian@cygnus.com. */
@@ -37,48 +37,19 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
Those functions may not use any COFF specific information, such as
coff_data (abfd). */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.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;
+make_a_section_from_file (bfd *abfd,
+ struct internal_scnhdr *hdr,
+ unsigned int target_index)
{
asection *return_section;
char *name;
@@ -131,7 +102,7 @@ make_a_section_from_file (abfd, hdr, target_index)
return_section->vma = hdr->s_vaddr;
return_section->lma = hdr->s_paddr;
- return_section->_raw_size = hdr->s_size;
+ return_section->size = hdr->s_size;
return_section->filepos = hdr->s_scnptr;
return_section->rel_filepos = hdr->s_relptr;
return_section->reloc_count = hdr->s_nreloc;
@@ -142,7 +113,7 @@ make_a_section_from_file (abfd, hdr, target_index)
return_section->lineno_count = hdr->s_nlnno;
return_section->userdata = NULL;
- return_section->next = (asection *) NULL;
+ return_section->next = NULL;
return_section->target_index = target_index;
if (! bfd_coff_styp_to_sec_flags_hook (abfd, hdr, name, return_section,
@@ -158,7 +129,7 @@ make_a_section_from_file (abfd, hdr, target_index)
if (hdr->s_nreloc != 0)
return_section->flags |= SEC_RELOC;
- /* FIXME: should this check 'hdr->s_size > 0' */
+ /* FIXME: should this check 'hdr->s_size > 0'. */
if (hdr->s_scnptr != 0)
return_section->flags |= SEC_HAS_CONTENTS;
@@ -169,17 +140,16 @@ make_a_section_from_file (abfd, hdr, target_index)
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;
+coff_real_object_p (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 */
+ void * tdata;
+ void * tdata_save;
+ bfd_size_type readsize; /* Length of file_info. */
unsigned int scnhsz;
char *external_sections;
@@ -208,22 +178,22 @@ coff_real_object_p (abfd, nscns, internal_f, internal_a)
/* 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);
+ tdata = bfd_coff_mkobject_hook (abfd, (void *) internal_f, (void *) 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);
+ external_sections = bfd_alloc (abfd, readsize);
if (!external_sections)
goto fail;
- if (bfd_bread ((PTR) external_sections, readsize, abfd) != readsize)
+ if (bfd_bread ((void *) 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))
+ if (! bfd_coff_set_arch_mach_hook (abfd, (void *) internal_f))
goto fail;
/* Now copy data as required; construct all asections etc. */
@@ -234,8 +204,8 @@ coff_real_object_p (abfd, nscns, internal_f, internal_a)
{
struct internal_scnhdr tmp;
bfd_coff_swap_scnhdr_in (abfd,
- (PTR) (external_sections + i * scnhsz),
- (PTR) & tmp);
+ (void *) (external_sections + i * scnhsz),
+ (void *) & tmp);
if (! make_a_section_from_file (abfd, &tmp, i + 1))
goto fail;
}
@@ -256,17 +226,16 @@ coff_real_object_p (abfd, nscns, internal_f, internal_a)
not a COFF file. This is also used by ECOFF. */
const bfd_target *
-coff_object_p (abfd)
- bfd *abfd;
+coff_object_p (bfd *abfd)
{
bfd_size_type filhsz;
bfd_size_type aoutsz;
unsigned int nscns;
- PTR filehdr;
+ void * filehdr;
struct internal_filehdr internal_f;
struct internal_aouthdr internal_a;
- /* figure out how much to read */
+ /* Figure out how much to read. */
filhsz = bfd_coff_filhsz (abfd);
aoutsz = bfd_coff_aoutsz (abfd);
@@ -301,7 +270,7 @@ coff_object_p (abfd)
if (internal_f.f_opthdr)
{
- PTR opthdr;
+ void * opthdr;
opthdr = bfd_alloc (abfd, aoutsz);
if (opthdr == NULL)
@@ -312,7 +281,7 @@ coff_object_p (abfd)
bfd_release (abfd, opthdr);
return NULL;
}
- bfd_coff_swap_aouthdr_in (abfd, opthdr, (PTR) &internal_a);
+ bfd_coff_swap_aouthdr_in (abfd, opthdr, (void *) &internal_a);
bfd_release (abfd, opthdr);
}
@@ -325,9 +294,7 @@ coff_object_p (abfd)
/* Get the BFD section from a COFF symbol section number. */
asection *
-coff_section_from_bfd_index (abfd, index)
- bfd *abfd;
- int index;
+coff_section_from_bfd_index (bfd *abfd, int index)
{
struct bfd_section *answer = abfd->sections;
@@ -353,8 +320,7 @@ coff_section_from_bfd_index (abfd, index)
/* Get the upper bound of a COFF symbol table. */
long
-coff_get_symtab_upper_bound (abfd)
- bfd *abfd;
+coff_get_symtab_upper_bound (bfd *abfd)
{
if (!bfd_coff_slurp_symbol_table (abfd))
return -1;
@@ -365,9 +331,7 @@ coff_get_symtab_upper_bound (abfd)
/* Canonicalize a COFF symbol table. */
long
-coff_canonicalize_symtab (abfd, alocation)
- bfd *abfd;
- asymbol **alocation;
+coff_canonicalize_symtab (bfd *abfd, asymbol **alocation)
{
unsigned int counter;
coff_symbol_type *symbase;
@@ -390,10 +354,9 @@ coff_canonicalize_symtab (abfd, alocation)
>= SYMNMLEN + 1. */
const char *
-_bfd_coff_internal_syment_name (abfd, sym, buf)
- bfd *abfd;
- const struct internal_syment *sym;
- char *buf;
+_bfd_coff_internal_syment_name (bfd *abfd,
+ const struct internal_syment *sym,
+ char *buf)
{
/* FIXME: It's not clear this will work correctly if sizeof
(_n_zeroes) != 4. */
@@ -430,14 +393,12 @@ _bfd_coff_internal_syment_name (abfd, sym, buf)
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_coff_read_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;
@@ -462,7 +423,7 @@ _bfd_coff_read_internal_relocs (abfd, sec, cache, external_relocs,
amt = sec->reloc_count * relsz;
if (external_relocs == NULL)
{
- free_external = (bfd_byte *) bfd_malloc (amt);
+ free_external = bfd_malloc (amt);
if (free_external == NULL && sec->reloc_count > 0)
goto error_return;
external_relocs = free_external;
@@ -476,7 +437,7 @@ _bfd_coff_read_internal_relocs (abfd, sec, cache, external_relocs,
{
amt = sec->reloc_count;
amt *= sizeof (struct internal_reloc);
- free_internal = (struct internal_reloc *) bfd_malloc (amt);
+ free_internal = bfd_malloc (amt);
if (free_internal == NULL && sec->reloc_count > 0)
goto error_return;
internal_relocs = free_internal;
@@ -487,7 +448,7 @@ _bfd_coff_read_internal_relocs (abfd, sec, cache, 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);
+ bfd_coff_swap_reloc_in (abfd, (void *) erel, (void *) irel);
if (free_external != NULL)
{
@@ -500,7 +461,7 @@ _bfd_coff_read_internal_relocs (abfd, sec, cache, external_relocs,
if (coff_section_data (abfd, sec) == NULL)
{
amt = sizeof (struct coff_section_tdata);
- sec->used_by_bfd = (PTR) bfd_zalloc (abfd, amt);
+ sec->used_by_bfd = bfd_zalloc (abfd, amt);
if (sec->used_by_bfd == NULL)
goto error_return;
coff_section_data (abfd, sec)->contents = NULL;
@@ -521,8 +482,7 @@ _bfd_coff_read_internal_relocs (abfd, sec, cache, external_relocs,
/* Set lineno_count for the output sections of a COFF file. */
int
-coff_count_linenumbers (abfd)
- bfd *abfd;
+coff_count_linenumbers (bfd *abfd)
{
unsigned int limit = bfd_get_symcount (abfd);
unsigned int i;
@@ -583,9 +543,8 @@ coff_count_linenumbers (abfd)
area of the symbol if there is one. */
coff_symbol_type *
-coff_symbol_from (ignore_abfd, symbol)
- bfd *ignore_abfd ATTRIBUTE_UNUSED;
- asymbol *symbol;
+coff_symbol_from (bfd *ignore_abfd ATTRIBUTE_UNUSED,
+ asymbol *symbol)
{
if (!bfd_family_coff (bfd_asymbol_bfd (symbol)))
return (coff_symbol_type *) NULL;
@@ -597,16 +556,14 @@ coff_symbol_from (ignore_abfd, symbol)
}
static void
-fixup_symbol_value (abfd, coff_symbol_ptr, syment)
- bfd *abfd;
- coff_symbol_type *coff_symbol_ptr;
- struct internal_syment *syment;
+fixup_symbol_value (bfd *abfd,
+ coff_symbol_type *coff_symbol_ptr,
+ struct internal_syment *syment)
{
-
- /* Normalize the symbol flags */
+ /* Normalize the symbol flags. */
if (bfd_is_com_section (coff_symbol_ptr->symbol.section))
{
- /* a common symbol is undefined with a value */
+ /* A common symbol is undefined with a value. */
syment->n_scnum = N_UNDEF;
syment->n_value = coff_symbol_ptr->symbol.value;
}
@@ -655,14 +612,12 @@ fixup_symbol_value (abfd, coff_symbol_ptr, syment)
do that here too. */
bfd_boolean
-coff_renumber_symbols (bfd_ptr, first_undef)
- bfd *bfd_ptr;
- int *first_undef;
+coff_renumber_symbols (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;
+ struct internal_syment *last_file = NULL;
unsigned int symbol_index;
/* COFF demands that undefined symbols come after all other symbols.
@@ -681,7 +636,7 @@ coff_renumber_symbols (bfd_ptr, first_undef)
bfd_size_type amt;
amt = sizeof (asymbol *) * ((bfd_size_type) symbol_count + 1);
- newsyms = (asymbol **) bfd_alloc (bfd_ptr, amt);
+ newsyms = bfd_alloc (bfd_ptr, amt);
if (!newsyms)
return FALSE;
bfd_ptr->outsymbols = newsyms;
@@ -724,26 +679,22 @@ coff_renumber_symbols (bfd_ptr, first_undef)
if (s->u.syment.n_sclass == C_FILE)
{
- if (last_file != (struct internal_syment *) NULL)
+ if (last_file != NULL)
last_file->n_value = native_index;
last_file = &(s->u.syment);
}
else
- {
-
- /* Modify the symbol values according to their section and
- type */
+ /* Modify the symbol values according to their section and
+ type. */
+ fixup_symbol_value (bfd_ptr, coff_symbol_ptr, &(s->u.syment));
- 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++;
- }
+ native_index++;
}
+
obj_conv_table_size (bfd_ptr) = native_index;
return TRUE;
@@ -754,8 +705,7 @@ coff_renumber_symbols (bfd_ptr, first_undef)
symbol table. */
void
-coff_mangle_symbols (bfd_ptr)
- bfd *bfd_ptr;
+coff_mangle_symbols (bfd *bfd_ptr)
{
unsigned int symbol_count = bfd_get_symcount (bfd_ptr);
asymbol **symbol_ptr_ptr = bfd_ptr->outsymbols;
@@ -818,22 +768,20 @@ coff_mangle_symbols (bfd_ptr)
}
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;
+coff_fix_symbol_name (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)
+ if (name == NULL)
{
- /* coff symbols always have names, so we'll make one up */
+ /* COFF symbols always have names, so we'll make one up. */
symbol->name = "strange";
name = (char *) symbol->name;
}
@@ -861,9 +809,7 @@ coff_fix_symbol_name (abfd, symbol, native, string_size_p,
if (bfd_coff_long_filenames (abfd))
{
if (name_length <= filnmlen)
- {
- strncpy (auxent->x_file.x_fname, name, filnmlen);
- }
+ strncpy (auxent->x_file.x_fname, name, filnmlen);
else
{
auxent->x_file.x_n.x_offset = *string_size_p + STRING_SIZE_SIZE;
@@ -881,10 +827,9 @@ coff_fix_symbol_name (abfd, symbol, native, string_size_p,
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);
- }
+ /* 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
@@ -913,12 +858,12 @@ coff_fix_symbol_name (abfd, symbol, native, string_size_p,
if (!bfd_set_section_contents (abfd,
*debug_string_section_p,
- (PTR) buf,
+ (void *) buf,
(file_ptr) *debug_string_size_p,
(bfd_size_type) prefix_len)
|| !bfd_set_section_contents (abfd,
*debug_string_section_p,
- (PTR) symbol->name,
+ (void *) symbol->name,
(file_ptr) (*debug_string_size_p
+ prefix_len),
(bfd_size_type) name_length + 1))
@@ -942,20 +887,18 @@ coff_fix_symbol_name (abfd, symbol, native, string_size_p,
/* 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;
+coff_write_symbol (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;
+ void * buf;
bfd_size_type symesz;
if (native->u.syment.n_sclass == C_FILE)
@@ -963,22 +906,17 @@ coff_write_symbol (abfd, symbol, native, written, string_size_p,
if (symbol->flags & BSF_DEBUGGING
&& bfd_is_abs_section (symbol->section))
- {
- native->u.syment.n_scnum = N_DEBUG;
- }
+ native->u.syment.n_scnum = N_DEBUG;
+
else if (bfd_is_abs_section (symbol->section))
- {
- native->u.syment.n_scnum = N_ABS;
- }
+ native->u.syment.n_scnum = N_ABS;
+
else if (bfd_is_und_section (symbol->section))
- {
- native->u.syment.n_scnum = N_UNDEF;
- }
+ native->u.syment.n_scnum = N_UNDEF;
+
else
- {
- native->u.syment.n_scnum =
- symbol->section->output_section->target_index;
- }
+ 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);
@@ -1005,9 +943,7 @@ coff_write_symbol (abfd, symbol, native, written, string_size_p,
{
bfd_coff_swap_aux_out (abfd,
&((native + j + 1)->u.auxent),
- type,
- class,
- (int) j,
+ type, class, (int) j,
native->u.syment.n_numaux,
buf);
if (bfd_bwrite (buf, auxesz, abfd) != auxesz)
@@ -1028,14 +964,12 @@ coff_write_symbol (abfd, symbol, native, written, string_size_p,
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;
+coff_write_alien_symbol (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;
@@ -1096,14 +1030,12 @@ coff_write_alien_symbol (abfd, symbol, written, 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;
+coff_write_native_symbol (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;
@@ -1114,6 +1046,7 @@ coff_write_native_symbol (abfd, symbol, written, string_size_p,
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)
{
@@ -1127,28 +1060,9 @@ coff_write_native_symbol (abfd, symbol, written, string_size_p,
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;
@@ -1166,15 +1080,14 @@ coff_write_native_symbol (abfd, symbol, written, string_size_p,
/* Write out the COFF symbols. */
bfd_boolean
-coff_write_symbols (abfd)
- bfd *abfd;
+coff_write_symbols (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;
+ bfd_vma written = 0;
asymbol **p;
string_size = 0;
@@ -1199,12 +1112,11 @@ coff_write_symbols (abfd)
}
}
- /* Seek to the right place */
+ /* Seek to the right place. */
if (bfd_seek (abfd, obj_sym_filepos (abfd), SEEK_SET) != 0)
return FALSE;
- /* Output all the symbols we have */
-
+ /* Output all the symbols we have. */
written = 0;
for (p = abfd->outsymbols, i = 0; i < limit; i++, p++)
{
@@ -1230,8 +1142,7 @@ coff_write_symbols (abfd)
obj_raw_syment_count (abfd) = written;
- /* Now write out strings */
-
+ /* Now write out strings. */
if (string_size != 0)
{
unsigned int size = string_size + STRING_SIZE_SIZE;
@@ -1242,7 +1153,7 @@ coff_write_symbols (abfd)
#else
#error Change H_PUT_32
#endif
- if (bfd_bwrite ((PTR) buffer, (bfd_size_type) sizeof (buffer), abfd)
+ if (bfd_bwrite ((void *) buffer, (bfd_size_type) sizeof (buffer), abfd)
!= sizeof (buffer))
return FALSE;
@@ -1284,18 +1195,16 @@ coff_write_symbols (abfd)
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;
- }
+ /* 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;
- }
+ /* 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)
{
@@ -1311,7 +1220,7 @@ coff_write_symbols (abfd)
if (name_length > maxlen)
{
- if (bfd_bwrite ((PTR) (q->name), (bfd_size_type) name_length + 1,
+ if (bfd_bwrite ((void *) (q->name), (bfd_size_type) name_length + 1,
abfd) != name_length + 1)
return FALSE;
}
@@ -1330,7 +1239,7 @@ coff_write_symbols (abfd)
#else
#error Change H_PUT_32
#endif
- if (bfd_bwrite ((PTR) buffer, (bfd_size_type) STRING_SIZE_SIZE, abfd)
+ if (bfd_bwrite ((void *) buffer, (bfd_size_type) STRING_SIZE_SIZE, abfd)
!= STRING_SIZE_SIZE)
return FALSE;
}
@@ -1344,18 +1253,17 @@ coff_write_symbols (abfd)
|| (debug_string_section != (asection *) NULL
&& (BFD_ALIGN (debug_string_size,
1 << debug_string_section->alignment_power)
- == bfd_section_size (abfd, debug_string_section))));
+ == debug_string_section->size)));
return TRUE;
}
bfd_boolean
-coff_write_linenumbers (abfd)
- bfd *abfd;
+coff_write_linenumbers (bfd *abfd)
{
asection *s;
bfd_size_type linesz;
- PTR buff;
+ void * buff;
linesz = bfd_coff_linesz (abfd);
buff = bfd_alloc (abfd, linesz);
@@ -1368,7 +1276,7 @@ coff_write_linenumbers (abfd)
asymbol **q = abfd->outsymbols;
if (bfd_seek (abfd, s->line_filepos, SEEK_SET) != 0)
return FALSE;
- /* Find all the linenumbers in this section */
+ /* Find all the linenumbers in this section. */
while (*q)
{
asymbol *p = *q;
@@ -1379,9 +1287,9 @@ coff_write_linenumbers (abfd)
(bfd_asymbol_bfd (p), p));
if (l)
{
- /* Found a linenumber entry, output */
+ /* Found a linenumber entry, output. */
struct internal_lineno out;
- memset ((PTR) & out, 0, sizeof (out));
+ memset ((void *) & out, 0, sizeof (out));
out.l_lnno = 0;
out.l_addr.l_symndx = l->u.offset;
bfd_coff_swap_lineno_out (abfd, &out, buff);
@@ -1410,76 +1318,20 @@ coff_write_linenumbers (abfd)
}
alent *
-coff_get_lineno (ignore_abfd, symbol)
- bfd *ignore_abfd ATTRIBUTE_UNUSED;
- asymbol *symbol;
+coff_get_lineno (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;
+coff_pointerize_aux (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;
@@ -1491,15 +1343,16 @@ coff_pointerize_aux (abfd, table_base, symbol, indaux, auxent)
return;
}
- /* Don't bother if this is a file or a section */
+ /* 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
+ /* 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)
{
@@ -1522,8 +1375,7 @@ coff_pointerize_aux (abfd, table_base, symbol, indaux, auxent)
we didn't want to go to the trouble until someone needed it. */
static char *
-build_debug_section (abfd)
- bfd *abfd;
+build_debug_section (bfd *abfd)
{
char *debug_section;
file_ptr position;
@@ -1537,8 +1389,8 @@ build_debug_section (abfd)
return NULL;
}
- sec_size = bfd_get_section_size_before_reloc (sect);
- debug_section = (PTR) bfd_alloc (abfd, sec_size);
+ sec_size = sect->size;
+ debug_section = bfd_alloc (abfd, sec_size);
if (debug_section == NULL)
return NULL;
@@ -1557,25 +1409,20 @@ build_debug_section (abfd)
/* 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;
+copy_name (bfd *abfd, char *name, size_t maxlen)
{
size_t len;
char *newname;
for (len = 0; len < maxlen; ++len)
- {
- if (name[len] == '\0')
- {
- break;
- }
- }
+ if (name[len] == '\0')
+ break;
+
+ if ((newname = bfd_alloc (abfd, (bfd_size_type) len + 1)) == NULL)
+ return NULL;
- if ((newname = (PTR) bfd_alloc (abfd, (bfd_size_type) len + 1)) == NULL)
- return (NULL);
strncpy (newname, name, len);
newname[len] = '\0';
return newname;
@@ -1584,12 +1431,11 @@ copy_name (abfd, name, maxlen)
/* Read in the external symbols. */
bfd_boolean
-_bfd_coff_get_external_symbols (abfd)
- bfd *abfd;
+_bfd_coff_get_external_symbols (bfd *abfd)
{
bfd_size_type symesz;
bfd_size_type size;
- PTR syms;
+ void * syms;
if (obj_coff_external_syms (abfd) != NULL)
return TRUE;
@@ -1598,7 +1444,7 @@ _bfd_coff_get_external_symbols (abfd)
size = obj_raw_syment_count (abfd) * symesz;
- syms = (PTR) bfd_malloc (size);
+ syms = bfd_malloc (size);
if (syms == NULL && size != 0)
return FALSE;
@@ -1620,8 +1466,7 @@ _bfd_coff_get_external_symbols (abfd)
detecting a missing string table in an archive. */
const char *
-_bfd_coff_read_string_table (abfd)
- bfd *abfd;
+_bfd_coff_read_string_table (bfd *abfd)
{
char extstrsize[STRING_SIZE_SIZE];
bfd_size_type strsize;
@@ -1663,13 +1508,12 @@ _bfd_coff_read_string_table (abfd)
if (strsize < STRING_SIZE_SIZE)
{
(*_bfd_error_handler)
- (_("%s: bad string table size %lu"), bfd_archive_filename (abfd),
- (unsigned long) strsize);
+ (_("%B: bad string table size %lu"), abfd, (unsigned long) strsize);
bfd_set_error (bfd_error_bad_value);
return NULL;
}
- strings = (char *) bfd_malloc (strsize);
+ strings = bfd_malloc (strsize);
if (strings == NULL)
return NULL;
@@ -1688,8 +1532,7 @@ _bfd_coff_read_string_table (abfd)
/* Free up the external symbols and strings read from a COFF file. */
bfd_boolean
-_bfd_coff_free_symbols (abfd)
- bfd *abfd;
+_bfd_coff_free_symbols (bfd *abfd)
{
if (obj_coff_external_syms (abfd) != NULL
&& ! obj_coff_keep_syms (abfd))
@@ -1712,8 +1555,7 @@ _bfd_coff_free_symbols (abfd)
terminated string. */
combined_entry_type *
-coff_get_normalized_symtab (abfd)
- bfd *abfd;
+coff_get_normalized_symtab (bfd *abfd)
{
combined_entry_type *internal;
combined_entry_type *internal_ptr;
@@ -1730,7 +1572,7 @@ coff_get_normalized_symtab (abfd)
return obj_raw_syments (abfd);
size = obj_raw_syment_count (abfd) * sizeof (combined_entry_type);
- internal = (combined_entry_type *) bfd_zalloc (abfd, size);
+ internal = bfd_zalloc (abfd, size);
if (internal == NULL && size != 0)
return NULL;
internal_end = internal + obj_raw_syment_count (abfd);
@@ -1740,22 +1582,22 @@ coff_get_normalized_symtab (abfd)
raw_src = (char *) obj_coff_external_syms (abfd);
- /* mark the end of the symbols */
+ /* 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 */
+ /* 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);
+ bfd_coff_swap_sym_in (abfd, (void *) raw_src,
+ (void *) & internal_ptr->u.syment);
symbol_ptr = internal_ptr;
for (i = 0;
@@ -1764,7 +1606,7 @@ coff_get_normalized_symtab (abfd)
{
internal_ptr++;
raw_src += symesz;
- bfd_coff_swap_aux_in (abfd, (PTR) raw_src,
+ bfd_coff_swap_aux_in (abfd, (void *) raw_src,
symbol_ptr->u.syment.n_type,
symbol_ptr->u.syment.n_sclass,
(int) i, symbol_ptr->u.syment.n_numaux,
@@ -1785,11 +1627,11 @@ coff_get_normalized_symtab (abfd)
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 */
+ /* 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 */
+ /* The filename is a long one, point into the string table. */
if (string_table == NULL)
{
string_table = _bfd_coff_read_string_table (abfd);
@@ -1809,21 +1651,17 @@ coff_get_normalized_symtab (abfd)
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));
- }
+ 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)));
- }
+ 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
@@ -1834,15 +1672,15 @@ coff_get_normalized_symtab (abfd)
size_t i;
char *newstring;
- /* find the length of this string without walking into memory
+ /* 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));
+ newstring = bfd_zalloc (abfd, (bfd_size_type) (i + 1));
if (newstring == NULL)
- return (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;
@@ -1880,13 +1718,11 @@ coff_get_normalized_symtab (abfd)
BFD_ASSERT (obj_raw_syment_count (abfd)
== (unsigned int) (internal_ptr - internal));
- return (internal);
-} /* coff_get_normalized_symtab() */
+ return internal;
+}
long
-coff_get_reloc_upper_bound (abfd, asect)
- bfd *abfd;
- sec_ptr asect;
+coff_get_reloc_upper_bound (bfd *abfd, sec_ptr asect)
{
if (bfd_get_format (abfd) != bfd_object)
{
@@ -1897,69 +1733,66 @@ coff_get_reloc_upper_bound (abfd, asect)
}
asymbol *
-coff_make_empty_symbol (abfd)
- bfd *abfd;
+coff_make_empty_symbol (bfd *abfd)
{
bfd_size_type amt = sizeof (coff_symbol_type);
- coff_symbol_type *new = (coff_symbol_type *) bfd_zalloc (abfd, amt);
+ coff_symbol_type *new = bfd_zalloc (abfd, amt);
+
if (new == NULL)
- return (NULL);
+ return NULL;
new->symbol.section = 0;
new->native = 0;
- new->lineno = (alent *) NULL;
+ new->lineno = NULL;
new->done_lineno = FALSE;
new->symbol.the_bfd = abfd;
- return &new->symbol;
+
+ 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;
+coff_bfd_make_debug_symbol (bfd *abfd,
+ void * 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);
+ coff_symbol_type *new = bfd_alloc (abfd, amt);
+
if (new == NULL)
- return (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);
+ new->native = bfd_zalloc (abfd, amt);
if (!new->native)
- return (NULL);
+ return NULL;
new->symbol.section = bfd_abs_section_ptr;
new->symbol.flags = BSF_DEBUGGING;
- new->lineno = (alent *) NULL;
+ new->lineno = NULL;
new->done_lineno = FALSE;
new->symbol.the_bfd = abfd;
- return &new->symbol;
+
+ return & new->symbol;
}
void
-coff_get_symbol_info (abfd, symbol, ret)
- bfd *abfd;
- asymbol *symbol;
- symbol_info *ret;
+coff_get_symbol_info (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);
- }
+ 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;
+bfd_coff_get_syment (bfd *abfd,
+ asymbol *symbol,
+ struct internal_syment *psyment)
{
coff_symbol_type *csym;
@@ -1984,11 +1817,10 @@ bfd_coff_get_syment (abfd, symbol, psyment)
/* 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;
+bfd_coff_get_auxent (bfd *abfd,
+ asymbol *symbol,
+ int indx,
+ union internal_auxent *pauxent)
{
coff_symbol_type *csym;
combined_entry_type *ent;
@@ -2028,13 +1860,12 @@ bfd_coff_get_auxent (abfd, symbol, indx, pauxent)
/* 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;
+coff_print_symbol (bfd *abfd,
+ void * filep,
+ asymbol *symbol,
+ bfd_print_symbol_type how)
{
- FILE *file = (FILE *) filep;
+ FILE * file = (FILE *) filep;
switch (how)
{
@@ -2064,28 +1895,23 @@ coff_print_symbol (abfd, filep, symbol, how)
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",
+ fprintf (file, "(sec %2d)(fl 0x%02x)(ty %3x)(scl %3d) (nx %d) 0x",
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);
+ combined->u.syment.n_numaux);
+#ifdef BFD64
+ /* fprintf_vma() on a 64-bit enabled host will always print a 64-bit
+ value, but really we want to display the address in the target's
+ address size. Since we do not have a field in the bfd structure
+ to tell us this, we take a guess, based on the target's name. */
+ if (strstr (bfd_get_target (abfd), "64") == NULL)
+ fprintf (file, "%08lx", (unsigned long) (val & 0xffffffff));
+ else
#endif
+ fprintf_vma (file, val);
+ fprintf (file, " %s", symbol->name);
for (aux = 0; aux < combined->u.syment.n_numaux; aux++)
{
@@ -2110,7 +1936,7 @@ coff_print_symbol (abfd, filep, symbol, how)
case C_STAT:
if (combined->u.syment.n_type == T_NULL)
- /* probably a section symbol? */
+ /* Probably a section symbol ? */
{
fprintf (file, "AUX scnlen 0x%lx nreloc %d nlnno %d",
(long) auxp->u.auxent.x_scn.x_scnlen,
@@ -2125,7 +1951,7 @@ coff_print_symbol (abfd, filep, symbol, how)
auxp->u.auxent.x_scn.x_comdat);
break;
}
- /* else fall through */
+ /* Otherwise fall through. */
case C_EXT:
if (ISFCN (combined->u.syment.n_type))
{
@@ -2143,7 +1969,7 @@ coff_print_symbol (abfd, filep, symbol, how)
llnos, next);
break;
}
- /* else fall through */
+ /* Otherwise fall through. */
default:
fprintf (file, "AUX lnno %d size 0x%x tagndx %ld",
auxp->u.auxent.x_sym.x_misc.x_lnsz.x_lnno,
@@ -2164,17 +1990,15 @@ coff_print_symbol (abfd, filep, symbol, how)
l++;
while (l->line_number)
{
- fprintf (file, "\n%4d : 0x%lx",
- l->line_number,
- ((unsigned long)
- (l->u.offset + symbol->section->vma)));
+ fprintf (file, "\n%4d : ", l->line_number);
+ fprintf_vma (file, l->u.offset + symbol->section->vma);
l++;
}
}
}
else
{
- bfd_print_symbol_vandf (abfd, (PTR) file, symbol);
+ bfd_print_symbol_vandf (abfd, (void *) file, symbol);
fprintf (file, " %-5s %s %s %s",
symbol->section->name,
coffsymbol (symbol)->native ? "n" : "g",
@@ -2190,9 +2014,8 @@ coff_print_symbol (abfd, filep, symbol, how)
override it. */
bfd_boolean
-_bfd_coff_is_local_label_name (abfd, name)
- bfd *abfd ATTRIBUTE_UNUSED;
- const char *name;
+_bfd_coff_is_local_label_name (bfd *abfd ATTRIBUTE_UNUSED,
+ const char *name)
{
return name[0] == '.' && name[1] == 'L';
}
@@ -2202,21 +2025,19 @@ _bfd_coff_is_local_label_name (abfd, name)
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;
+coff_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;
unsigned int i;
unsigned int line_base;
coff_data_type *cof = coff_data (abfd);
- /* Run through the raw syments if available */
+ /* Run through the raw syments if available. */
combined_entry_type *p;
combined_entry_type *pend;
alent *l;
@@ -2245,7 +2066,7 @@ coff_find_nearest_line (abfd, section, symbols, offset, filename_ptr,
*functionname_ptr = 0;
*line_ptr = 0;
- /* Don't try and find line numbers in a non coff file */
+ /* Don't try and find line numbers in a non coff file. */
if (!bfd_family_coff (abfd))
return FALSE;
@@ -2315,8 +2136,8 @@ coff_find_nearest_line (abfd, section, symbols, offset, filename_ptr,
}
}
- /* Now wander though the raw linenumbers of the section */
- /* If we have been called on this section before, and the offset we
+ /* Now wander though the raw linenumbers of the section. */
+ /* If we have been called on this section before, and th. e offset we
want is further down then we can prime the lookup loop. */
sec_data = coff_section_data (abfd, section);
if (sec_data != NULL
@@ -2343,7 +2164,7 @@ coff_find_nearest_line (abfd, section, symbols, offset, filename_ptr,
{
if (l->line_number == 0)
{
- /* Get the symbol this line number points at */
+ /* Get the symbol this line number points at. */
coff_symbol_type *coff = (coff_symbol_type *) (l->u.sym);
if (coff->symbol.value > offset)
break;
@@ -2397,7 +2218,7 @@ coff_find_nearest_line (abfd, section, symbols, offset, filename_ptr,
if (sec_data == NULL && section->owner == abfd)
{
amt = sizeof (struct coff_section_tdata);
- section->used_by_bfd = (PTR) bfd_zalloc (abfd, amt);
+ section->used_by_bfd = bfd_zalloc (abfd, amt);
sec_data = (struct coff_section_tdata *) section->used_by_bfd;
}
if (sec_data != NULL)
@@ -2411,32 +2232,40 @@ coff_find_nearest_line (abfd, section, symbols, offset, filename_ptr,
return TRUE;
}
+bfd_boolean
+coff_find_inliner_info (bfd *abfd,
+ const char **filename_ptr,
+ const char **functionname_ptr,
+ unsigned int *line_ptr)
+{
+ bfd_boolean found;
+
+ found = _bfd_dwarf2_find_inliner_info (abfd, filename_ptr,
+ functionname_ptr, line_ptr,
+ &coff_data(abfd)->dwarf2_find_line_info);
+ return (found);
+}
+
int
-coff_sizeof_headers (abfd, reloc)
- bfd *abfd;
- bfd_boolean reloc;
+coff_sizeof_headers (bfd *abfd, struct bfd_link_info *info)
{
size_t size;
- if (! reloc)
- {
- size = bfd_coff_filhsz (abfd) + bfd_coff_aoutsz (abfd);
- }
+ if (!info->relocatable)
+ size = bfd_coff_filhsz (abfd) + bfd_coff_aoutsz (abfd);
else
- {
- size = bfd_coff_filhsz (abfd);
- }
+ 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;
+bfd_coff_set_symbol_class (bfd * abfd,
+ asymbol * symbol,
+ unsigned int class)
{
coff_symbol_type * csym;
@@ -2456,7 +2285,7 @@ bfd_coff_set_symbol_class (abfd, symbol, class)
combined_entry_type * native;
bfd_size_type amt = sizeof (* native);
- native = (combined_entry_type *) bfd_zalloc (abfd, amt);
+ native = bfd_zalloc (abfd, amt);
if (native == NULL)
return FALSE;
@@ -2490,9 +2319,17 @@ bfd_coff_set_symbol_class (abfd, symbol, class)
csym->native = native;
}
else
- {
- csym->native->u.syment.n_sclass = class;
- }
+ csym->native->u.syment.n_sclass = class;
return TRUE;
}
+
+struct coff_comdat_info *
+bfd_coff_get_comdat_section (bfd *abfd, struct bfd_section *sec)
+{
+ if (bfd_get_flavour (abfd) == bfd_target_coff_flavour
+ && coff_section_data (abfd, sec) != NULL)
+ return coff_section_data (abfd, sec)->comdat;
+ else
+ return NULL;
+}
diff --git a/contrib/binutils/bfd/cofflink.c b/contrib/binutils/bfd/cofflink.c
index 4ad566c..1ed7107 100644
--- a/contrib/binutils/bfd/cofflink.c
+++ b/contrib/binutils/bfd/cofflink.c
@@ -1,6 +1,6 @@
/* COFF specific linker code.
- Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
- Free Software Foundation, Inc.
+ Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
+ 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
Written by Ian Lance Taylor, Cygnus Support.
This file is part of BFD, the Binary File Descriptor library.
@@ -17,12 +17,12 @@
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. */
+ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
/* This file contains the COFF backend linker code. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "bfdlink.h"
#include "libbfd.h"
#include "coff/internal.h"
@@ -94,10 +94,11 @@ _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 *))
+ const char *),
+ unsigned int entsize)
{
- table->stab_info = NULL;
- return _bfd_link_hash_table_init (&table->root, abfd, newfunc);
+ memset (&table->stab_info, 0, sizeof (table->stab_info));
+ return _bfd_link_hash_table_init (&table->root, abfd, newfunc, entsize);
}
/* Create a COFF linker hash table. */
@@ -113,7 +114,8 @@ _bfd_coff_link_hash_table_create (bfd *abfd)
return NULL;
if (! _bfd_coff_link_hash_table_init (ret, abfd,
- _bfd_coff_link_hash_newfunc))
+ _bfd_coff_link_hash_newfunc,
+ sizeof (struct coff_link_hash_entry)))
{
free (ret);
return (struct bfd_link_hash_table *) NULL;
@@ -230,7 +232,7 @@ coff_link_check_ar_symbols (bfd *abfd,
/* Auto import. */
if (!h
&& info->pei386_auto_import
- && !strncmp (name,"__imp_", 6))
+ && CONST_STRNEQ (name, "__imp_"))
h = bfd_link_hash_lookup (info->hash, name + 6, FALSE, FALSE, TRUE);
/* We are only interested in symbols that are currently
@@ -435,18 +437,19 @@ coff_link_add_symbols (bfd *abfd,
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)
+ && coff_section_data (abfd, section) != NULL
+ && coff_section_data (abfd, section)->comdat != NULL
+ && CONST_STRNEQ (name, "??_")
+ && strcmp (name, coff_section_data (abfd, 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)
+ && coff_section_data (abfd, (*sym_hash)->root.u.def.section)->comdat != NULL
+ && strcmp (coff_section_data (abfd, (*sym_hash)->root.u.def.section)->comdat->name,
+ coff_section_data (abfd, section)->comdat->name) == 0)
addit = FALSE;
}
@@ -503,9 +506,8 @@ coff_link_add_symbols (bfd *abfd,
&& (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));
+ (_("Warning: type of symbol `%s' changed from %d to %d in %B"),
+ abfd, name, (*sym_hash)->type, sym.n_type);
/* We don't want to change from a meaningful
base type to a null one, but if we know
@@ -551,8 +553,8 @@ coff_link_add_symbols (bfd *abfd,
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;
+ if (section->size == 0)
+ section->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
@@ -581,7 +583,7 @@ coff_link_add_symbols (bfd *abfd,
asection *stab;
for (stab = abfd->sections; stab; stab = stab->next)
- if (strncmp (".stab", stab->name, 5) == 0
+ if (CONST_STRNEQ (stab->name, ".stab")
&& (!stab->name[5]
|| (stab->name[5] == '.' && ISDIGIT (stab->name[6]))))
{
@@ -693,7 +695,7 @@ _bfd_coff_final_link (bfd *abfd,
{
o->reloc_count = 0;
o->lineno_count = 0;
- for (p = o->link_order_head; p != NULL; p = p->next)
+ for (p = o->map_head.link_order; p != NULL; p = p->next)
{
if (p->type == bfd_indirect_link_order)
{
@@ -714,8 +716,10 @@ _bfd_coff_final_link (bfd *abfd,
if (info->relocatable)
o->reloc_count += sec->reloc_count;
- if (sec->_raw_size > max_contents_size)
- max_contents_size = sec->_raw_size;
+ if (sec->rawsize > max_contents_size)
+ max_contents_size = sec->rawsize;
+ if (sec->size > max_contents_size)
+ max_contents_size = sec->size;
if (sec->lineno_count > max_lineno_count)
max_lineno_count = sec->lineno_count;
if (sec->reloc_count > max_reloc_count)
@@ -886,7 +890,7 @@ _bfd_coff_final_link (bfd *abfd,
for (o = abfd->sections; o != NULL; o = o->next)
{
- for (p = o->link_order_head; p != NULL; p = p->next)
+ for (p = o->map_head.link_order; p != NULL; p = p->next)
{
if (p->type == bfd_indirect_link_order
&& bfd_family_coff (p->u.indirect.section->owner))
@@ -1080,7 +1084,7 @@ _bfd_coff_final_link (bfd *abfd,
}
/* If we have optimized stabs strings, output them. */
- if (coff_hash_table (info)->stab_info != NULL)
+ if (coff_hash_table (info)->stab_info.stabstr != NULL)
{
if (! _bfd_write_stab_strings (abfd, &coff_hash_table (info)->stab_info))
return FALSE;
@@ -1208,39 +1212,34 @@ process_embedded_commands (bfd *output_bfd,
asection *sec = bfd_get_section_by_name (abfd, ".drectve");
char *s;
char *e;
- char *copy;
+ bfd_byte *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))
+ if (!bfd_malloc_and_get_section (abfd, sec, &copy))
{
- free (copy);
+ if (copy != NULL)
+ free (copy);
return 0;
}
- e = copy + sec->_raw_size;
+ e = (char *) copy + sec->size;
- for (s = copy; s < e ; )
+ for (s = (char *) copy; s < e ; )
{
- if (s[0]!= '-')
+ if (s[0] != '-')
{
s++;
continue;
}
- if (strncmp (s,"-attr", 5) == 0)
+ if (CONST_STRNEQ (s, "-attr"))
{
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);
@@ -1254,10 +1253,8 @@ process_embedded_commands (bfd *output_bfd,
had_write = 1;
break;
case 'R':
- had_read = 1;
break;
case 'S':
- had_shared = 1;
break;
case 'X':
had_exec = 1;
@@ -1275,11 +1272,11 @@ process_embedded_commands (bfd *output_bfd,
asec->flags |= SEC_READONLY;
}
}
- else if (strncmp (s,"-heap", 5) == 0)
- s = dores_com (s+5, output_bfd, 1);
+ else if (CONST_STRNEQ (s, "-heap"))
+ s = dores_com (s + 5, output_bfd, 1);
- else if (strncmp (s,"-stack", 6) == 0)
- s = dores_com (s+6, output_bfd, 0);
+ else if (CONST_STRNEQ (s, "-stack"))
+ s = dores_com (s + 6, output_bfd, 0);
else
s++;
@@ -1346,9 +1343,6 @@ _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 *);
@@ -1927,6 +1921,7 @@ _bfd_coff_link_input_bfd (struct coff_final_link_info *finfo, bfd *input_bfd)
generate two symbols with the same name, but only one
will have aux entries. */
BFD_ASSERT (isymp->n_numaux == 0
+ || h->numaux == 0
|| h->numaux == isymp->n_numaux);
}
@@ -1942,7 +1937,7 @@ _bfd_coff_link_input_bfd (struct coff_final_link_info *finfo, bfd *input_bfd)
union internal_auxent aux;
union internal_auxent *auxp;
- if (h != NULL)
+ if (h != NULL && h->aux != NULL && (h->numaux > i))
auxp = h->aux + i;
else
{
@@ -1977,7 +1972,8 @@ _bfd_coff_link_input_bfd (struct coff_final_link_info *finfo, bfd *input_bfd)
auxp->x_file.x_n.x_offset = STRING_SIZE_SIZE + indx;
}
}
- else if (isymp->n_sclass != C_STAT || isymp->n_type != T_NULL)
+ else if ((isymp->n_sclass != C_STAT || isymp->n_type != T_NULL)
+ && isymp->n_sclass != C_NT_WEAK)
{
unsigned long indx;
@@ -2283,16 +2279,18 @@ _bfd_coff_link_input_bfd (struct coff_final_link_info *finfo, bfd *input_bfd)
/* This section was omitted from the link. */
continue;
+ if ((o->flags & SEC_LINKER_CREATED) != 0)
+ continue;
+
if ((o->flags & SEC_HAS_CONTENTS) == 0
- || (o->_raw_size == 0 && (o->flags & SEC_RELOC) == 0))
+ || (o->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_error_handler)
+ (_("%B: relocs in section `%A', but it has no contents"),
+ input_bfd, o);
bfd_set_error (bfd_error_no_contents);
return FALSE;
}
@@ -2305,8 +2303,8 @@ _bfd_coff_link_input_bfd (struct coff_final_link_info *finfo, bfd *input_bfd)
contents = secdata->contents;
else
{
- if (! bfd_get_section_contents (input_bfd, o, finfo->contents,
- (file_ptr) 0, o->_raw_size))
+ bfd_size_type x = o->rawsize ? o->rawsize : o->size;
+ if (! bfd_get_section_contents (input_bfd, o, finfo->contents, 0, x))
return FALSE;
contents = finfo->contents;
}
@@ -2431,10 +2429,8 @@ _bfd_coff_link_input_bfd (struct coff_final_link_info *finfo, bfd *input_bfd)
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))
+ contents, loc, o->size))
return FALSE;
}
else
@@ -2616,9 +2612,7 @@ _bfd_coff_write_global_sym (struct coff_link_hash_entry *h, void *data)
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);
+ auxp->x_scn.x_scnlen = sec->size;
/* For PE, an overflow on the final link reportedly does
not matter. FIXME: Why not? */
@@ -2738,7 +2732,7 @@ _bfd_coff_reloc_link_order (bfd *output_bfd,
abort ();
case bfd_reloc_overflow:
if (! ((*finfo->info->callbacks->reloc_overflow)
- (finfo->info,
+ (finfo->info, NULL,
(link_order->type == bfd_section_reloc_link_order
? bfd_section_name (output_bfd,
link_order->u.reloc.p->u.section)
@@ -2863,8 +2857,7 @@ _bfd_coff_generic_relocate_section (bfd *output_bfd,
|| (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);
+ ("%B: illegal symbol index %ld in relocs", input_bfd, symndx);
return FALSE;
}
else
@@ -2925,16 +2918,50 @@ _bfd_coff_generic_relocate_section (bfd *output_bfd,
if (h->root.type == bfd_link_hash_defined
|| h->root.type == bfd_link_hash_defweak)
{
+ /* Defined weak symbols are a GNU extension. */
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;
+ {
+ if (h->class == C_NT_WEAK && h->numaux == 1)
+ {
+ /* See _Microsoft Portable Executable and Common Object
+ File Format Specification_, section 5.5.3.
+ Note that weak symbols without aux records are a GNU
+ extension.
+ FIXME: All weak externals are treated as having
+ characteristic IMAGE_WEAK_EXTERN_SEARCH_NOLIBRARY (1).
+ These behave as per SVR4 ABI: A library member
+ will resolve a weak external only if a normal
+ external causes the library member to be linked.
+ See also linker.c: generic_link_check_archive_element. */
+ asection *sec;
+ struct coff_link_hash_entry *h2 =
+ input_bfd->tdata.coff_obj_data->sym_hashes[
+ h->aux->x_sym.x_tagndx.l];
+
+ if (!h2 || h2->root.type == bfd_link_hash_undefined)
+ {
+ sec = bfd_abs_section_ptr;
+ val = 0;
+ }
+ else
+ {
+ sec = h2->root.u.def.section;
+ val = h2->root.u.def.value
+ + sec->output_section->vma + sec->output_offset;
+ }
+ }
+ else
+ /* This is a GNU extension. */
+ val = 0;
+ }
else if (! info->relocatable)
{
@@ -2984,10 +3011,8 @@ _bfd_coff_generic_relocate_section (bfd *output_bfd,
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));
+ (_("%B: bad reloc address 0x%lx in section `%A'"),
+ input_bfd, input_section, (unsigned long) rel->r_vaddr);
return FALSE;
case bfd_reloc_overflow:
{
@@ -2997,7 +3022,7 @@ _bfd_coff_generic_relocate_section (bfd *output_bfd,
if (symndx == -1)
name = "*ABS*";
else if (h != NULL)
- name = h->root.root.string;
+ name = NULL;
else
{
name = _bfd_coff_internal_syment_name (input_bfd, sym, buf);
@@ -3006,8 +3031,9 @@ _bfd_coff_generic_relocate_section (bfd *output_bfd,
}
if (! ((*info->callbacks->reloc_overflow)
- (info, name, howto->name, (bfd_vma) 0, input_bfd,
- input_section, rel->r_vaddr - input_section->vma)))
+ (info, (h ? &h->root : NULL), name, howto->name,
+ (bfd_vma) 0, input_bfd, input_section,
+ rel->r_vaddr - input_section->vma)))
return FALSE;
}
}
diff --git a/contrib/binutils/bfd/coffswap.h b/contrib/binutils/bfd/coffswap.h
index 5f23ecc..f0af329 100644
--- a/contrib/binutils/bfd/coffswap.h
+++ b/contrib/binutils/bfd/coffswap.h
@@ -1,6 +1,6 @@
/* Generic COFF swapping routines, for BFD.
Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1999, 2000,
- 2001, 2002
+ 2001, 2002, 2005
Free Software Foundation, Inc.
Written by Cygnus Support.
@@ -18,7 +18,7 @@
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. */
+ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, 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
@@ -210,41 +210,17 @@
#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;
+coff_swap_reloc_in (bfd * abfd, void * src, void * 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_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);
+ 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);
@@ -252,13 +228,11 @@ coff_swap_reloc_in (abfd, src, dst)
}
static unsigned int
-coff_swap_reloc_out (abfd, src, dst)
- bfd *abfd;
- PTR src;
- PTR dst;
+coff_swap_reloc_out (bfd * abfd, void * src, void * 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);
@@ -276,10 +250,7 @@ coff_swap_reloc_out (abfd, src, dst)
#endif /* NO_COFF_RELOCS */
static void
-coff_swap_filehdr_in (abfd, src, dst)
- bfd *abfd;
- PTR src;
- PTR dst;
+coff_swap_filehdr_in (bfd * abfd, void * src, void * dst)
{
FILHDR *filehdr_src = (FILHDR *) src;
struct internal_filehdr *filehdr_dst = (struct internal_filehdr *) dst;
@@ -287,13 +258,13 @@ coff_swap_filehdr_in (abfd, src, dst)
#ifdef COFF_ADJUST_FILEHDR_IN_PRE
COFF_ADJUST_FILEHDR_IN_PRE (abfd, src, dst);
#endif
- filehdr_dst->f_magic = H_GET_16 (abfd, filehdr_src->f_magic);
- filehdr_dst->f_nscns = H_GET_16 (abfd, filehdr_src->f_nscns);
+ 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_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);
+ 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
@@ -304,10 +275,7 @@ coff_swap_filehdr_in (abfd, src, dst)
}
static unsigned int
-coff_swap_filehdr_out (abfd, in, out)
- bfd *abfd;
- PTR in;
- PTR out;
+coff_swap_filehdr_out (bfd *abfd, void * in, void * out)
{
struct internal_filehdr *filehdr_in = (struct internal_filehdr *) in;
FILHDR *filehdr_out = (FILHDR *) out;
@@ -335,10 +303,7 @@ coff_swap_filehdr_out (abfd, in, out)
#ifndef NO_COFF_SYMBOLS
static void
-coff_swap_sym_in (abfd, ext1, in1)
- bfd *abfd;
- PTR ext1;
- PTR in1;
+coff_swap_sym_in (bfd * abfd, void * ext1, void * in1)
{
SYMENT *ext = (SYMENT *) ext1;
struct internal_syment *in = (struct internal_syment *) in1;
@@ -351,21 +316,18 @@ coff_swap_sym_in (abfd, ext1, in1)
else
{
#if SYMNMLEN != E_SYMNMLEN
- -> Error, we need to cope with truncating or extending SYMNMLEN!;
+#error we need to cope with truncating or extending SYMNMLEN
#else
memcpy (in->_n._n_name, ext->e.e_name, SYMNMLEN);
#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);
- }
+ in->n_type = H_GET_16 (abfd, ext->e_type);
else
- {
- in->n_type = H_GET_32 (abfd, ext->e_type);
- }
+ 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
@@ -374,10 +336,7 @@ coff_swap_sym_in (abfd, ext1, in1)
}
static unsigned int
-coff_swap_sym_out (abfd, inp, extp)
- bfd *abfd;
- PTR inp;
- PTR extp;
+coff_swap_sym_out (bfd * abfd, void * inp, void * extp)
{
struct internal_syment *in = (struct internal_syment *) inp;
SYMENT *ext =(SYMENT *) extp;
@@ -394,7 +353,7 @@ coff_swap_sym_out (abfd, inp, extp)
else
{
#if SYMNMLEN != E_SYMNMLEN
- -> Error, we need to cope with truncating or extending SYMNMLEN!;
+#error we need to cope with truncating or extending SYMNMLEN
#else
memcpy (ext->e.e_name, in->_n._n_name, SYMNMLEN);
#endif
@@ -404,13 +363,9 @@ coff_swap_sym_out (abfd, inp, extp)
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);
- }
+ H_PUT_16 (abfd, in->n_type, ext->e_type);
else
- {
- H_PUT_32 (abfd, in->n_type, ext->e_type);
- }
+ 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);
@@ -423,14 +378,13 @@ coff_swap_sym_out (abfd, inp, extp)
}
static void
-coff_swap_aux_in (abfd, ext1, type, class, indx, numaux, in1)
- bfd *abfd;
- PTR ext1;
- int type;
- int class;
- int indx;
- int numaux;
- PTR in1;
+coff_swap_aux_in (bfd *abfd,
+ void * ext1,
+ int type,
+ int class,
+ int indx,
+ int numaux,
+ void * in1)
{
AUXENT *ext = (AUXENT *) ext1;
union internal_auxent *in = (union internal_auxent *) in1;
@@ -450,7 +404,7 @@ coff_swap_aux_in (abfd, ext1, type, class, indx, numaux, in1)
else
{
#if FILNMLEN != E_FILNMLEN
- -> Error, we need to cope with truncating or extending FILNMLEN!;
+#error we need to cope with truncating or extending FILNMLEN
#else
if (numaux > 1)
{
@@ -512,9 +466,7 @@ coff_swap_aux_in (abfd, ext1, type, class, indx, numaux, in1)
}
if (ISFCN (type))
- {
- in->x_sym.x_misc.x_fsize = H_GET_32 (abfd, ext->x_sym.x_misc.x_fsize);
- }
+ in->x_sym.x_misc.x_fsize = H_GET_32 (abfd, ext->x_sym.x_misc.x_fsize);
else
{
in->x_sym.x_misc.x_lnsz.x_lnno = GET_LNSZ_LNNO (abfd, ext);
@@ -529,23 +481,22 @@ coff_swap_aux_in (abfd, ext1, type, class, indx, numaux, in1)
}
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;
+coff_swap_aux_out (bfd * abfd,
+ void * inp,
+ int type,
+ int class,
+ int indx ATTRIBUTE_UNUSED,
+ int numaux ATTRIBUTE_UNUSED,
+ void * extp)
{
- union internal_auxent *in = (union internal_auxent *) inp;
+ 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);
+ memset (ext, 0, AUXESZ);
switch (class)
{
@@ -558,7 +509,7 @@ coff_swap_aux_out (abfd, inp, type, class, indx, numaux, extp)
else
{
#if FILNMLEN != E_FILNMLEN
- -> Error, we need to cope with truncating or extending FILNMLEN!;
+#error we need to cope with truncating or extending FILNMLEN
#else
memcpy (ext->x_file.x_fname, in->x_file.x_fname, FILNMLEN);
#endif
@@ -625,10 +576,7 @@ coff_swap_aux_out (abfd, inp, type, class, indx, numaux, extp)
#ifndef NO_COFF_LINENOS
static void
-coff_swap_lineno_in (abfd, ext1, in1)
- bfd *abfd;
- PTR ext1;
- PTR in1;
+coff_swap_lineno_in (bfd * abfd, void * ext1, void * in1)
{
LINENO *ext = (LINENO *) ext1;
struct internal_lineno *in = (struct internal_lineno *) in1;
@@ -638,10 +586,7 @@ coff_swap_lineno_in (abfd, ext1, in1)
}
static unsigned int
-coff_swap_lineno_out (abfd, inp, outp)
- bfd *abfd;
- PTR inp;
- PTR outp;
+coff_swap_lineno_out (bfd * abfd, void * inp, void * outp)
{
struct internal_lineno *in = (struct internal_lineno *) inp;
struct external_lineno *ext = (struct external_lineno *) outp;
@@ -654,10 +599,7 @@ coff_swap_lineno_out (abfd, inp, outp)
#endif /* NO_COFF_LINENOS */
static void
-coff_swap_aouthdr_in (abfd, aouthdr_ext1, aouthdr_int1)
- bfd *abfd;
- PTR aouthdr_ext1;
- PTR aouthdr_int1;
+coff_swap_aouthdr_in (bfd * abfd, void * aouthdr_ext1, void * aouthdr_int1)
{
AOUTHDR *aouthdr_ext;
struct internal_aouthdr *aouthdr_int;
@@ -730,10 +672,7 @@ coff_swap_aouthdr_in (abfd, aouthdr_ext1, aouthdr_int1)
}
static unsigned int
-coff_swap_aouthdr_out (abfd, in, out)
- bfd *abfd;
- PTR in;
- PTR out;
+coff_swap_aouthdr_out (bfd * abfd, void * in, void * out)
{
struct internal_aouthdr *aouthdr_in = (struct internal_aouthdr *) in;
AOUTHDR *aouthdr_out = (AOUTHDR *) out;
@@ -807,10 +746,7 @@ coff_swap_aouthdr_out (abfd, in, out)
}
static void
-coff_swap_scnhdr_in (abfd, ext, in)
- bfd *abfd;
- PTR ext;
- PTR in;
+coff_swap_scnhdr_in (bfd * abfd, void * ext, void * in)
{
SCNHDR *scnhdr_ext = (SCNHDR *) ext;
struct internal_scnhdr *scnhdr_int = (struct internal_scnhdr *) in;
@@ -839,10 +775,7 @@ coff_swap_scnhdr_in (abfd, ext, in)
}
static unsigned int
-coff_swap_scnhdr_out (abfd, in, out)
- bfd *abfd;
- PTR in;
- PTR out;
+coff_swap_scnhdr_out (bfd * abfd, void * in, void * out)
{
struct internal_scnhdr *scnhdr_int = (struct internal_scnhdr *) in;
SCNHDR *scnhdr_ext = (SCNHDR *) out;
diff --git a/contrib/binutils/bfd/config.bfd b/contrib/binutils/bfd/config.bfd
index 06b346d..2b790b7a 100755
--- a/contrib/binutils/bfd/config.bfd
+++ b/contrib/binutils/bfd/config.bfd
@@ -31,8 +31,8 @@ targ_underscore=no
# Catch obsolete configurations.
case $targ in
- vax-*-vms* \
- )
+ maxq-*-coff | \
+ null)
if test "x$enable_obsolete" != xyes; then
echo "*** Configuration $targ is obsolete." >&2
echo "*** Specify --enable-obsolete to build it anyway." >&2
@@ -42,40 +42,73 @@ case $targ in
fi;;
esac
+case $targ in
+ m68*-apple-aux* | \
+ m68*-apollo-* | \
+ m68*-bull-sysv* | \
+ m68*-*-rtemscoff* | \
+ i960-*-rtems* | \
+ or32-*-rtems* | \
+ m68*-*-lynxos* | \
+ sparc-*-lynxos* | \
+ vax-*-vms* | \
+ arm-*-oabi | \
+ thumb-*-oabi | \
+ a29k-* | \
+ hppa*-*-rtems* | \
+ *-go32-rtems* | \
+ i[3-7]86*-*-rtemscoff* | \
+ mips*el-*-rtems* | \
+ powerpcle-*-rtems* | \
+ sparc*-*-rtemsaout* | \
+ null)
+ echo "*** Configuration $targ is obsolete." >&2
+ echo "*** Support has been REMOVED." >&2
+ exit 1
+ ;;
+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 ;;
+alpha*) targ_archs=bfd_alpha_arch ;;
+arm*) targ_archs=bfd_arm_arch ;;
+bfin*) targ_archs=bfd_bfin_arch ;;
+c30*) targ_archs=bfd_tic30_arch ;;
+c4x*) targ_archs=bfd_tic4x_arch ;;
+c54x*) targ_archs=bfd_tic54x_arch ;;
+cr16*) targ_archs=bfd_cr16_arch ;;
+crisv32) targ_archs=bfd_cris_arch ;;
+crx*) targ_archs=bfd_crx_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 ;;
+fido*) targ_archs=bfd_m68k_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 ;;
+m68*) targ_archs=bfd_m68k_arch ;;
+m88*) targ_archs=bfd_m88k_arch ;;
+maxq*) targ_archs=bfd_maxq_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 ;;
+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 ;;
+spu*) targ_archs=bfd_spu_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 ;;
+z80|r800) targ_archs=bfd_z80_arch ;;
+z8k*) targ_archs=bfd_z8k_arch ;;
+am33_2.0) targ_archs=bfd_mn10300_arch ;;
+*) targ_archs=bfd_${targ_cpu}_arch ;;
esac
@@ -107,7 +140,8 @@ case "${targ}" in
#ifdef BFD64
alpha*-*-freebsd* | alpha*-*-kfreebsd*-gnu)
targ_defvec=bfd_elf64_alpha_freebsd_vec
- targ_selvecs=ecoffalpha_little_vec
+ targ_selvecs="bfd_elf64_alpha_vec ecoffalpha_little_vec"
+ want64=true
# FreeBSD <= 4.0 supports only the old nonstandard way of ABI labelling.
case "${targ}" in
alpha*-*-freebsd3* | alpha*-*-freebsd4 | alpha*-*-freebsd4.0*)
@@ -117,36 +151,54 @@ case "${targ}" in
alpha*-*-netbsd* | alpha*-*-openbsd*)
targ_defvec=bfd_elf64_alpha_vec
targ_selvecs=ecoffalpha_little_vec
+ want64=true
;;
alpha*-*-netware*)
targ_defvec=ecoffalpha_little_vec
targ_selvecs=nlm32_alpha_vec
+ want64=true
;;
alpha*-*-linuxecoff*)
targ_defvec=ecoffalpha_little_vec
targ_selvecs=bfd_elf64_alpha_vec
+ want64=true
;;
- alpha*-*-linux-gnu* | alpha*-*-elf*)
+ alpha*-*-linux-* | alpha*-*-elf*)
targ_defvec=bfd_elf64_alpha_vec
targ_selvecs=ecoffalpha_little_vec
+ want64=true
;;
alpha*-*-*vms*)
targ_defvec=vms_alpha_vec
+ want64=true
;;
alpha*-*-*)
targ_defvec=ecoffalpha_little_vec
+ want64=true
+ ;;
+ ia64*-*-freebsd* | ia64*-*-kfreebsd*-gnu)
+ targ_defvec=bfd_elf64_ia64_freebsd_vec
+ targ_selvecs="bfd_elf64_ia64_little_vec bfd_elf64_ia64_big_vec bfd_efi_app_ia64_vec"
+ want64=true
;;
- ia64*-*-freebsd* | ia64*-*-netbsd* | ia64*-*-linux-gnu* | ia64*-*-elf* | ia64*-*-kfreebsd*-gnu)
+ ia64*-*-netbsd* | ia64*-*-linux-* | ia64*-*-elf*)
targ_defvec=bfd_elf64_ia64_little_vec
targ_selvecs="bfd_elf64_ia64_big_vec bfd_efi_app_ia64_vec"
+ want64=true
;;
ia64*-*-hpux*)
targ_defvec=bfd_elf32_ia64_hpux_big_vec
targ_selvecs="bfd_elf64_ia64_hpux_big_vec"
+ want64=true
+ ;;
+ sparc64-*-freebsd* | sparc64-*-kfreebsd*-gnu)
+ targ_defvec=bfd_elf64_sparc_freebsd_vec
+ targ_selvecs="bfd_elf64_sparc_vec bfd_elf32_sparc_vec sunos_big_vec"
;;
- sparc64-*-freebsd* | sparc64-*-netbsd* | sparc64-*-openbsd* | sparc64-*-kfreebsd*-gnu)
+ sparc64-*-netbsd* | sparc64-*-openbsd*)
targ_defvec=bfd_elf64_sparc_vec
targ_selvecs="bfd_elf32_sparc_vec sunos_big_vec"
+ want64=true
;;
#endif /* BFD64 */
@@ -186,8 +238,8 @@ case "${targ}" in
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_defvec=arm_wince_pe_little_vec
+ targ_selvecs="arm_wince_pe_little_vec arm_wince_pe_big_vec arm_wince_pei_little_vec arm_wince_pei_big_vec"
targ_underscore=no
targ_cflags="-DARM_WINCE -DARM_COFF_BUGFIX"
;;
@@ -213,7 +265,7 @@ case "${targ}" in
targ_defvec=bfd_elf32_littlearm_vec
targ_selvecs=bfd_elf32_bigarm_vec
;;
- armeb-*-elf | arm*b-*-linux-gnu*)
+ armeb-*-elf | arm*b-*-linux-*)
targ_defvec=bfd_elf32_bigarm_vec
targ_selvecs=bfd_elf32_littlearm_vec
;;
@@ -225,29 +277,30 @@ case "${targ}" in
targ_defvec=bfd_elf32_bigarm_vec
targ_selvecs=bfd_elf32_littlearm_vec
;;
- arm-*-elf | arm-*-freebsd* | arm*-*-linux-gnu* | arm*-*-conix* | \
- arm*-*-uclinux* | arm-*-kfreebsd*-gnu | arm-*-vxworks)
+ arm-*-elf | arm-*-freebsd* | arm*-*-linux-* | arm*-*-conix* | \
+ arm*-*-uclinux* | arm-*-kfreebsd*-gnu | \
+ arm*-*-eabi* )
targ_defvec=bfd_elf32_littlearm_vec
targ_selvecs=bfd_elf32_bigarm_vec
;;
+ arm*-*-vxworks | arm*-*-windiss)
+ targ_defvec=bfd_elf32_littlearm_vxworks_vec
+ targ_selvecs=bfd_elf32_bigarm_vxworks_vec
+ ;;
+ arm*-*-symbianelf*)
+ targ_defvec=bfd_elf32_littlearm_symbian_vec
+ targ_selvecs=bfd_elf32_bigarm_symbian_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
@@ -281,21 +334,16 @@ case "${targ}" in
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
;;
+ bfin-*-*)
+ targ_defvec=bfd_elf32_bfin_vec
+ targ_selvecs=bfd_elf32_bfinfdpic_vec
+ targ_underscore=yes
+ ;;
+
c30-*-*aout* | tic30-*-*aout*)
targ_defvec=tic30_aout_vec
;;
@@ -315,12 +363,27 @@ case "${targ}" in
targ_underscore=yes
;;
- cris-*-*)
+ cr16-*-elf*)
+ targ_defvec=bfd_elf32_cr16_vec
+ targ_underscore=yes
+ ;;
+
+ cr16c-*-elf*)
+ targ_defvec=bfd_elf32_cr16c_vec
+ targ_underscore=yes
+ ;;
+
+ cris-*-* | crisv32-*-*)
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.
;;
+ crx-*-elf*)
+ targ_defvec=bfd_elf32_crx_vec
+ targ_underscore=yes
+ ;;
+
d10v-*-*)
targ_defvec=bfd_elf32_d10v_vec
;;
@@ -334,6 +397,11 @@ case "${targ}" in
targ_defvec=bfd_elf32_d30v_vec
;;
+ fido-*-elf* )
+ targ_defvec=bfd_elf32_m68k_vec
+ targ_selvecs="m68kcoff_vec ieee_vec"
+ ;;
+
fr30-*-elf)
targ_defvec=bfd_elf32_fr30_vec
;;
@@ -348,7 +416,12 @@ case "${targ}" in
targ_selvecs=bfd_elf32_frv_vec
;;
- h8300*-*-elf)
+ h8300*-*-rtemscoff*)
+ targ_defvec=h8300coff_vec
+ targ_underscore=yes
+ ;;
+
+ h8300*-*-elf | h8300*-*-rtems*)
targ_defvec=bfd_elf32_h8300_vec
targ_underscore=yes
;;
@@ -364,22 +437,28 @@ case "${targ}" in
;;
#ifdef BFD64
- hppa*64*-*-linux-gnu*)
+ hppa*64*-*-linux-*)
targ_defvec=bfd_elf64_hppa_linux_vec
targ_selvecs=bfd_elf64_hppa_vec
+ want64=true
;;
hppa*64*-*-hpux11*)
targ_defvec=bfd_elf64_hppa_vec
targ_selvecs=bfd_elf64_hppa_linux_vec
targ_cflags=-DHPUX_LARGE_AR_IDS
+ want64=true
;;
#endif
- hppa*-*-linux-gnu* | hppa*-*-netbsd*)
+ hppa*-*-linux-*)
targ_defvec=bfd_elf32_hppa_linux_vec
targ_selvecs=bfd_elf32_hppa_vec
;;
- hppa*-*-*elf* | hppa*-*-lites* | hppa*-*-sysv4* | hppa*-*-rtems* | hppa*-*-openbsd*)
+ hppa*-*-netbsd*)
+ targ_defvec=bfd_elf32_hppa_nbsd_vec
+ targ_selvecs="bfd_elf32_hppa_vec bfd_elf32_hppa_linux_vec"
+ ;;
+ hppa*-*-*elf* | hppa*-*-lites* | hppa*-*-sysv4* | hppa*-*-openbsd*)
targ_defvec=bfd_elf32_hppa_vec
targ_selvecs=bfd_elf32_hppa_linux_vec
;;
@@ -398,7 +477,7 @@ case "${targ}" in
;;
#endif /* defined (HOST_HPPAHPUX) || defined (HOST_HPPABSD) || defined (HOST_HPPAOSF) */
- i370-*-*)
+ i370-*-*)
targ_defvec=bfd_elf32_i370_vec
targ_selvecs="bfd_elf32_i370_vec"
;;
@@ -406,12 +485,18 @@ case "${targ}" in
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-*-sysv4* | i[3-7]86-*-unixware* | \
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-*-solaris2*)
+ targ_defvec=bfd_elf32_i386_vec
+ targ_selvecs=i386coff_vec
+ targ64_selvecs=bfd_elf64_x86_64_vec
+ want64=true
+ ;;
i[3-7]86-*-kaos*)
targ_defvec=bfd_elf32_i386_vec
targ_selvecs=bfd_elf32_i386_vec
@@ -426,7 +511,7 @@ case "${targ}" in
i[3-7]86-*-chorus*)
targ_defvec=bfd_elf32_i386_vec
;;
- *-*-msdosdjgpp* | *-*-go32* | *-go32-rtems* )
+ *-*-msdosdjgpp* | *-*-go32* )
targ_defvec=go32coff_vec
targ_selvecs="go32stubbedcoff_vec i386aout_vec"
;;
@@ -434,11 +519,7 @@ case "${targ}" in
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*)
+ i[3-7]86-*-rtems*)
targ_defvec=bfd_elf32_i386_vec
targ_selvecs="i386coff_vec i386aout_vec"
;;
@@ -463,7 +544,8 @@ case "${targ}" in
;;
i[3-7]86-*-freebsd* | i[3-7]86-*-kfreebsd*-gnu)
targ_defvec=bfd_elf32_i386_freebsd_vec
- targ_selvecs=i386coff_vec
+ targ_selvecs="bfd_elf32_i386_vec bfd_efi_app_ia32_vec i386coff_vec"
+ targ64_selvecs="bfd_elf64_x86_64_freebsd_vec bfd_elf64_x86_64_vec bfd_efi_app_x86_64_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*)
@@ -485,7 +567,7 @@ case "${targ}" in
targ_selvecs="bfd_elf32_i386_vec i386bsd_vec"
targ_underscore=yes
;;
- i[3-7]86-*-openbsd*)
+ i[3-7]86-*-openbsd*)
targ_defvec=bfd_elf32_i386_vec
targ_selvecs=i386netbsd_vec
;;
@@ -498,28 +580,42 @@ case "${targ}" in
targ_selvecs=bfd_elf32_i386_vec
targ_underscore=yes
;;
- i[3-7]86-*-linux-gnu*)
+ i[3-7]86-*-linux-*)
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)
+ x86_64-*-elf*)
targ_defvec=bfd_elf64_x86_64_vec
- targ_selvecs="bfd_elf32_i386_vec i386coff_vec bfd_efi_app_ia32_vec"
+ targ_selvecs="bfd_elf32_i386_vec i386coff_vec"
+ want64=true
+ ;;
+ x86_64-*-freebsd* | x86_64-*-kfreebsd*-gnu)
+ targ_defvec=bfd_elf64_x86_64_freebsd_vec
+ targ_selvecs="bfd_elf32_i386_freebsd_vec i386coff_vec bfd_efi_app_ia32_vec bfd_efi_app_x86_64_vec bfd_elf32_i386_vec bfd_elf64_x86_64_vec"
+ want64=true
;;
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"
+ targ_selvecs="bfd_elf32_i386_vec i386netbsd_vec i386coff_vec bfd_efi_app_ia32_vec bfd_efi_app_x86_64_vec"
+ want64=true
;;
- x86_64-*-linux-gnu*)
+ x86_64-*-linux-*)
targ_defvec=bfd_elf64_x86_64_vec
- targ_selvecs="bfd_elf32_i386_vec i386linux_vec bfd_efi_app_ia32_vec"
+ targ_selvecs="bfd_elf32_i386_vec i386linux_vec bfd_efi_app_ia32_vec bfd_efi_app_x86_64_vec"
+ want64=true
+ ;;
+ x86_64-*-mingw*)
+ targ_defvec=x86_64pe_vec
+ targ_selvecs="x86_64pe_vec x86_64pei_vec x86_64coff_vec bfd_elf64_x86_64_vec"
+ want64=true
+ targ_underscore=yes
;;
#endif
i[3-7]86-*-lynxos*)
- targ_defvec=i386lynx_coff_vec
- targ_selvecs=i386lynx_aout_vec
+ targ_defvec=bfd_elf32_i386_vec
+ targ_selvecs="i386lynx_coff_vec i386lynx_aout_vec"
;;
i[3-7]86-*-gnu*)
targ_defvec=bfd_elf32_i386_vec
@@ -554,9 +650,14 @@ case "${targ}" in
# FIXME: This should eventually be checked at runtime.
targ_cflags=-DSTRICT_PE_FORMAT
;;
+ i[3-7]86-*-rdos*)
+ targ_defvec=bfd_elf32_i386_vec
+ targ_selvecs=i386coff_vec
+ ;;
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"
+ targ_underscore=yes
;;
i[3-7]86-none-*)
targ_defvec=i386coff_vec
@@ -564,8 +665,8 @@ case "${targ}" in
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
+ i[3-7]86-*-vxworks*)
+ targ_defvec=bfd_elf32_i386_vxworks_vec
targ_underscore=yes
;;
i[3-7]86-*-chaos)
@@ -589,7 +690,7 @@ case "${targ}" in
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*)
+ i960-*-vxworks5.* | i960-*-coff* | i960-*-sysv*)
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
@@ -612,21 +713,22 @@ case "${targ}" in
targ_defvec=bfd_elf32_iq2000_vec
;;
+ m32c-*-elf)
+ targ_defvec=bfd_elf32_m32c_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
;;
@@ -640,13 +742,6 @@ case "${targ}" in
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
;;
@@ -662,10 +757,6 @@ case "${targ}" in
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"
@@ -687,7 +778,7 @@ case "${targ}" in
targ_selvecs=bfd_elf32_m68k_vec
targ_underscore=yes
;;
- m68*-*-linux-gnu*)
+ m68*-*-linux-*)
targ_defvec=bfd_elf32_m68k_vec
targ_selvecs=m68klinux_vec
;;
@@ -696,16 +787,12 @@ case "${targ}" in
# 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*)
+ m68*-*-netbsdelf*)
targ_defvec=bfd_elf32_m68k_vec
targ_selvecs="m68knetbsd_vec m68k4knetbsd_vec hp300bsd_vec sunos_big_vec"
;;
@@ -733,9 +820,6 @@ case "${targ}" in
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
@@ -750,11 +834,19 @@ case "${targ}" in
targ_defvec=m88kmach3_vec
targ_cflags=-DSTAT_FOR_EXEC
;;
+ m88*-*-openbsd*)
+ targ_defvec=m88kopenbsd_vec
+ targ_underscore=yes
+ ;;
m88*-*-*)
targ_defvec=m88kbcs_vec
targ_underscore=yes
;;
+ maxq-*-coff)
+ targ_defvec=maxqcoff_vec
+ ;;
+
mcore-*-elf)
targ_defvec=bfd_elf32_mcore_big_vec
targ_selvecs="bfd_elf32_mcore_big_vec bfd_elf32_mcore_little_vec"
@@ -764,17 +856,22 @@ case "${targ}" in
targ_selvecs="mcore_pe_big_vec mcore_pe_little_vec mcore_pei_big_vec mcore_pei_little_vec"
;;
+ mep-*-elf)
+ targ_defvec=bfd_elf32_mep_vec
+ targ_selvecs=bfd_elf32_mep_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"
+ targ_defvec=bfd_elf32_tradlittlemips_vec
+ targ_selvecs="bfd_elf32_tradbigmips_vec bfd_elf64_tradbigmips_vec bfd_elf64_tradlittlemips_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"
+ targ_defvec=bfd_elf32_tradbigmips_vec
+ targ_selvecs="bfd_elf32_tradlittlemips_vec bfd_elf64_tradbigmips_vec bfd_elf64_tradlittlemips_vec ecoff_big_vec ecoff_little_vec"
;;
mips*el-*-freebsd*)
targ_defvec=bfd_elf32_tradlittlemips_vec
@@ -796,6 +893,7 @@ case "${targ}" in
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"
+ want64=true
;;
#endif
mips*-*-irix5*)
@@ -818,7 +916,29 @@ case "${targ}" in
targ_defvec=ecoff_big_vec
targ_selvecs=ecoff_little_vec
;;
- mips*el-*-elf* | mips*el-*-rtems* | mips*el-*-vxworks* | mips*-*-chorus*)
+#ifdef BFD64
+ mips*el-*-vxworks*)
+ targ_defvec=bfd_elf32_littlemips_vxworks_vec
+ targ_selvecs="bfd_elf32_littlemips_vec bfd_elf32_bigmips_vxworks_vec bfd_elf32_bigmips_vec bfd_elf64_bigmips_vec bfd_elf64_littlemips_vec"
+ want64=true
+ ;;
+ mips*-*-vxworks*)
+ targ_defvec=bfd_elf32_bigmips_vxworks_vec
+ targ_selvecs="bfd_elf32_bigmips_vec bfd_elf32_littlemips_vxworks_vec bfd_elf32_bigmips_vec bfd_elf64_bigmips_vec bfd_elf64_littlemips_vec"
+ want64=true
+ ;;
+#endif
+ mips*el-sde-elf*)
+ targ_defvec=bfd_elf32_tradlittlemips_vec
+ targ_selvecs="bfd_elf32_tradbigmips_vec bfd_elf32_ntradbigmips_vec bfd_elf32_ntradlittlemips_vec bfd_elf64_tradbigmips_vec bfd_elf64_tradlittlemips_vec"
+ want64=true
+ ;;
+ mips*-sde-elf*)
+ targ_defvec=bfd_elf32_tradbigmips_vec
+ targ_selvecs="bfd_elf32_tradlittlemips_vec bfd_elf32_ntradbigmips_vec bfd_elf32_ntradlittlemips_vec bfd_elf64_tradbigmips_vec bfd_elf64_tradlittlemips_vec"
+ want64=true
+ ;;
+ mips*el-*-elf* | 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"
;;
@@ -830,6 +950,13 @@ case "${targ}" in
targ_defvec=bfd_elf32_bigmips_vec
targ_selvecs="bfd_elf32_littlemips_vec bfd_elf64_bigmips_vec bfd_elf64_littlemips_vec"
;;
+#ifdef BFD64
+ mips64*-*-openbsd*)
+ targ_defvec=bfd_elf64_tradbigmips_vec
+ targ_selvecs="bfd_elf32_ntradlittlemips_vec bfd_elf32_ntradbigmips_vec bfd_elf32_tradlittlemips_vec bfd_elf32_tradbigmips_vec bfd_elf64_tradlittlemips_vec"
+ want64=true
+ ;;
+#endif
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"
@@ -842,10 +969,12 @@ case "${targ}" in
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"
+ want64=true
;;
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"
+ want64=true
;;
#endif
mips*el-*-linux*)
@@ -862,6 +991,7 @@ case "${targ}" in
mmix-*-*)
targ_defvec=bfd_elf64_mmix_vec
targ_selvecs=bfd_mmo_vec
+ want64=true
;;
#endif
mn10200-*-*)
@@ -873,6 +1003,10 @@ case "${targ}" in
targ_underscore=yes
;;
+ mt-*-elf)
+ targ_defvec=bfd_elf32_mt_vec
+ ;;
+
msp430-*-*)
targ_defvec=bfd_elf32_msp430_vec
;;
@@ -895,7 +1029,7 @@ case "${targ}" in
targ_underscore=yes
;;
- or32-*-elf | or32-*-rtems*)
+ or32-*-elf)
targ_defvec=bfd_elf32_or32_big_vec
;;
@@ -945,7 +1079,7 @@ case "${targ}" in
targ_defvec=rs6000coff_vec
targ64_selvecs=rs6000coff64_vec
case "${targ}" in
- *-*-aix4.[3456789]* | *-*-aix[56789]*)
+ *-*-aix4.[3456789]* | *-*-aix[56789]*)
want64=true;;
*)
targ_cflags=-DSMALL_ARCHIVE;;
@@ -955,20 +1089,23 @@ case "${targ}" in
powerpc64-*-aix*)
targ_defvec=rs6000coff64_vec
targ_selvecs=rs6000coff_vec
+ want64=true
;;
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"
+ want64=true
;;
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"
+ want64=true
;;
#endif
powerpc-*-*bsd* | powerpc-*-elf* | powerpc-*-sysv4* | powerpc-*-eabi* | \
- powerpc-*-solaris2* | powerpc-*-linux-gnu* | powerpc-*-rtems* | \
- powerpc-*-chorus* | powerpc-*-vxworks* | powerpc-*-windiss*)
+ powerpc-*-solaris2* | powerpc-*-linux-* | powerpc-*-rtems* | \
+ powerpc-*-chorus*)
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"
@@ -983,9 +1120,14 @@ case "${targ}" in
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*)
+ powerpc-*-macos*)
targ_defvec=pmac_xcoff_vec
;;
+ powerpc-*-lynxos*)
+ targ_defvec=bfd_elf32_powerpc_vec
+ targ_selvecs="rs6000coff_vec"
+ targ_cflags=-DSMALL_ARCHIVE
+ ;;
powerpc-*-netware*)
targ_defvec=bfd_elf32_powerpc_vec
targ_selvecs="nlm32_powerpc_vec rs6000coff_vec"
@@ -994,13 +1136,17 @@ case "${targ}" in
targ_defvec=bfd_elf32_powerpc_vec
targ_selvecs="rs6000coff_vec bfd_elf32_powerpcle_vec ppcboot_vec"
;;
+ powerpc-*-vxworks* | powerpc-*-windiss*)
+ targ_defvec=bfd_elf32_powerpc_vxworks_vec
+ targ_selvecs="rs6000coff_vec bfd_elf32_powerpc_vec bfd_elf32_powerpcle_vec ppcboot_vec"
+ targ64_selvecs="bfd_elf64_powerpc_vec bfd_elf64_powerpcle_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*)
+ powerpcle-*-solaris2* | powerpcle-*-linux-* | powerpcle-*-vxworks*)
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"
@@ -1013,42 +1159,55 @@ case "${targ}" in
s390-*-linux*)
targ_defvec=bfd_elf32_s390_vec
targ64_selvecs=bfd_elf64_s390_vec
+ want64=true
;;
#ifdef BFD64
s390x-*-linux*)
targ_defvec=bfd_elf64_s390_vec
targ_selvecs=bfd_elf32_s390_vec
+ want64=true
+ ;;
+ s390x-*-tpf*)
+ targ_defvec=bfd_elf64_s390_vec
+ want64=true
;;
#endif
+ score*-*-elf*)
+ targ_defvec=bfd_elf32_bigscore_vec
+ targ_selvecs=bfd_elf32_littlescore_vec
+ ;;
+
#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
+ want64=true
;;
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
+ want64=true
;;
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"
+ want64=true
;;
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"
+ want64=true
;;
-#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
+ targ_selvecs="bfd_elf32_shlin_vec bfd_elf32_sh64lin_vec bfd_elf32_sh64blin_vec bfd_elf64_sh64lin_vec bfd_elf64_sh64blin_vec"
+ want64=true
;;
+#endif /* BFD64 */
+
sh*eb-*-linux*)
targ_defvec=bfd_elf32_shblin_vec
targ_selvecs=bfd_elf32_shlin_vec
@@ -1058,78 +1217,100 @@ case "${targ}" in
targ_selvecs=bfd_elf32_shblin_vec
;;
+ sh-*-uclinux* | sh[12]-*-uclinux*)
+ targ_defvec=bfd_elf32_sh_vec
+ targ_selvecs="bfd_elf32_shblin_vec 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
+ ;;
+
#ifdef BFD64
sh5le-*-netbsd*)
targ_defvec=bfd_elf32_sh64lnbsd_vec
- targ_selvecs="bfd_elf32_sh64nbsd_vec bfd_elf64_sh64lnbsd_vec bfd_elf64_sh64nbsd_vec"
+ targ_selvecs="bfd_elf32_sh64nbsd_vec bfd_elf64_sh64lnbsd_vec bfd_elf64_sh64nbsd_vec bfd_elf32_shnbsd_vec bfd_elf32_shlnbsd_vec"
+ want64=true
;;
sh5-*-netbsd*)
targ_defvec=bfd_elf32_sh64nbsd_vec
- targ_selvecs="bfd_elf32_sh64lnbsd_vec bfd_elf64_sh64lnbsd_vec bfd_elf64_sh64nbsd_vec"
+ targ_selvecs="bfd_elf32_sh64lnbsd_vec bfd_elf64_sh64lnbsd_vec bfd_elf64_sh64nbsd_vec bfd_elf32_shnbsd_vec bfd_elf32_shlnbsd_vec"
+ want64=true
;;
sh64le-*-netbsd*)
targ_defvec=bfd_elf64_sh64lnbsd_vec
- targ_selvecs="bfd_elf64_sh64nbsd_vec bfd_elf32_sh64lnbsd_vec bfd_elf32_sh64nbsd_vec"
+ targ_selvecs="bfd_elf64_sh64nbsd_vec bfd_elf32_sh64lnbsd_vec bfd_elf32_sh64nbsd_vec bfd_elf32_shnbsd_vec bfd_elf32_shlnbsd_vec"
+ want64=true
;;
sh64-*-netbsd*)
targ_defvec=bfd_elf64_sh64nbsd_vec
- targ_selvecs="bfd_elf64_sh64lnbsd_vec bfd_elf32_sh64lnbsd_vec bfd_elf32_sh64nbsd_vec"
+ targ_selvecs="bfd_elf64_sh64lnbsd_vec bfd_elf32_sh64lnbsd_vec bfd_elf32_sh64nbsd_vec bfd_elf32_shnbsd_vec bfd_elf32_shlnbsd_vec"
+ want64=true
;;
-#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
+ targ_selvecs="bfd_elf32_shnbsd_vec shcoff_vec shlcoff_vec bfd_elf32_sh64lnbsd_vec bfd_elf32_sh64nbsd_vec bfd_elf64_sh64lnbsd_vec bfd_elf64_sh64nbsd_vec"
+ want64=true
;;
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
+ targ_selvecs="bfd_elf32_shlnbsd_vec shcoff_vec shlcoff_vec bfd_elf32_sh64lnbsd_vec bfd_elf32_sh64nbsd_vec bfd_elf64_sh64lnbsd_vec bfd_elf64_sh64nbsd_vec"
+ want64=true
;;
+#endif
+
sh*-*-netbsdelf*)
targ_defvec=bfd_elf32_shnbsd_vec
targ_selvecs="bfd_elf32_shlnbsd_vec shcoff_vec shlcoff_vec"
;;
+ sh*-*-symbianelf*)
+ targ_defvec=bfd_elf32_shl_symbian_vec
+ targ_selvecs="shlcoff_vec shlcoff_small_vec"
+ targ_underscore=yes
+ ;;
+
+#ifdef BFD64
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_selvecs="bfd_elf32_sh_vec shlcoff_vec shcoff_vec shlcoff_small_vec shcoff_small_vec bfd_elf32_sh64_vec bfd_elf32_sh64l_vec bfd_elf64_sh64_vec bfd_elf64_sh64l_vec"
targ_underscore=yes
+ want64=true
;;
+#endif
+
sh-*-rtemscoff*)
targ_defvec=shcoff_vec
targ_selvecs="shcoff_vec shlcoff_vec shcoff_small_vec shlcoff_small_vec"
targ_underscore=yes
;;
+
+#ifdef BFD64
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_selvecs="bfd_elf32_shl_vec shcoff_vec shlcoff_vec shcoff_small_vec shlcoff_small_vec bfd_elf32_sh64_vec bfd_elf32_sh64l_vec bfd_elf64_sh64_vec bfd_elf64_sh64l_vec"
targ_underscore=yes
+ want64=true
;;
+#endif
+
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*-*-openbsd*)
+ targ_defvec=bfd_elf32_shlnbsd_vec
+ targ_selvecs="bfd_elf32_shnbsd_vec shcoff_vec shlcoff_vec"
+ ;;
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"
+ targ_defvec=bfd_elf32_shvxworks_vec
+ targ_selvecs="bfd_elf32_shlvxworks_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.
@@ -1161,14 +1342,10 @@ case "${targ}" in
targ_selvecs="bfd_elf32_sparc_vec sunos_big_vec"
targ_underscore=yes
;;
- sparc-*-linux-gnu*)
+ sparc-*-linux-*)
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
@@ -1194,11 +1371,16 @@ case "${targ}" in
sparc-*-solaris2* | sparcv9-*-solaris2* | sparc64-*-solaris2*)
targ_defvec=bfd_elf32_sparc_vec
targ_selvecs="bfd_elf64_sparc_vec sunos_big_vec"
+ want64=true
;;
#endif
sparc-*-sysv4*)
targ_defvec=bfd_elf32_sparc_vec
;;
+ sparc-*-vxworks*)
+ targ_defvec=bfd_elf32_sparc_vxworks_vec
+ targ_selvecs="bfd_elf32_sparc_vec sunos_big_vec"
+ ;;
sparc-*-netware*)
targ_defvec=bfd_elf32_sparc_vec
targ_selvecs="nlm32_sparc_vec sunos_big_vec"
@@ -1207,33 +1389,35 @@ case "${targ}" in
sparc64-*-aout*)
targ_defvec=sunos_big_vec
targ_underscore=yes
+ want64=true
;;
- sparc64-*-linux-gnu*)
+ sparc64-*-linux-*)
targ_defvec=bfd_elf64_sparc_vec
targ_selvecs="bfd_elf32_sparc_vec sparclinux_vec sunos_big_vec"
+ want64=true
;;
sparc64-*-elf*)
targ_defvec=bfd_elf64_sparc_vec
targ_selvecs=bfd_elf32_sparc_vec
+ want64=true
;;
#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*)
+ sparc*-*-rtems*)
targ_defvec=bfd_elf32_sparc_vec
targ_selvecs="sunos_big_vec sparccoff_vec"
;;
- sparc*-*-* | sparc*-*-rtems*)
+ sparc*-*-*)
targ_defvec=sunos_big_vec
targ_underscore=yes
;;
+ spu-*-elf)
+ targ_defvec=bfd_elf32_spu_vec
+ ;;
+
#if HAVE_host_aout_vec
tahoe-*-*)
targ_defvec=host_aout_vec
@@ -1277,7 +1461,7 @@ case "${targ}" in
targ_underscore=yes
;;
- vax-*-linux-gnu*)
+ vax-*-linux-*)
targ_defvec=bfd_elf32_vax_vec
;;
@@ -1301,6 +1485,14 @@ case "${targ}" in
targ_defvec=bfd_elf32_xtensa_le_vec
targ_selvecs=bfd_elf32_xtensa_be_vec
;;
+ xc16x-*-elf)
+ targ_defvec=bfd_elf32_xc16x_vec
+ ;;
+
+ z80-*-*)
+ targ_defvec=z80coff_vec
+ targ_underscore=no
+ ;;
z8k*-*-*)
targ_defvec=z8kcoff_vec
diff --git a/contrib/binutils/bfd/config.in b/contrib/binutils/bfd/config.in
index ef9eca4..aa91dd6 100644
--- a/contrib/binutils/bfd/config.in
+++ b/contrib/binutils/bfd/config.in
@@ -1,288 +1,294 @@
-/* config.in. Generated automatically from configure.in by autoheader. */
+/* config.in. Generated from configure.in by autoheader. */
-/* Define if using alloca.c. */
-#undef C_ALLOCA
+/* Define to 1 if translation of program messages to the user's native
+ language is requested. */
+#undef ENABLE_NLS
-/* Define to empty if the keyword does not work. */
-#undef const
+/* Define to 1 if you have the declaration of `basename', and to 0 if you
+ don't. */
+#undef HAVE_DECL_BASENAME
-/* 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 to 1 if you have the declaration of `ffs', and to 0 if you don't. */
+#undef HAVE_DECL_FFS
-/* Define if you have alloca, as a function or macro. */
-#undef HAVE_ALLOCA
+/* Define to 1 if you have the declaration of `free', and to 0 if you don't.
+ */
+#undef HAVE_DECL_FREE
-/* Define if you have <alloca.h> and it should be used (not on Ultrix). */
-#undef HAVE_ALLOCA_H
+/* Define to 1 if you have the declaration of `fseeko', and to 0 if you don't.
+ */
+#undef HAVE_DECL_FSEEKO
-/* Define if you have a working `mmap' system call. */
-#undef HAVE_MMAP
+/* Define to 1 if you have the declaration of `fseeko64', and to 0 if you
+ don't. */
+#undef HAVE_DECL_FSEEKO64
-/* Define as __inline if that's what the C compiler calls it. */
-#undef inline
+/* Define to 1 if you have the declaration of `ftello', and to 0 if you don't.
+ */
+#undef HAVE_DECL_FTELLO
-/* Define to `long' if <sys/types.h> doesn't define. */
-#undef off_t
+/* Define to 1 if you have the declaration of `ftello64', and to 0 if you
+ don't. */
+#undef HAVE_DECL_FTELLO64
-/* Define to `unsigned' if <sys/types.h> doesn't define. */
-#undef size_t
+/* Define to 1 if you have the declaration of `getenv', and to 0 if you don't.
+ */
+#undef HAVE_DECL_GETENV
-/* 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 to 1 if you have the declaration of `malloc', and to 0 if you don't.
+ */
+#undef HAVE_DECL_MALLOC
-/* Define if you have the ANSI C header files. */
-#undef STDC_HEADERS
+/* Define to 1 if you have the declaration of `realloc', and to 0 if you
+ don't. */
+#undef HAVE_DECL_REALLOC
-/* Define if you can safely include both <sys/time.h> and <time.h>. */
-#undef TIME_WITH_SYS_TIME
+/* Define to 1 if you have the declaration of `snprintf', and to 0 if you
+ don't. */
+#undef HAVE_DECL_SNPRINTF
-/* Define if you have the __argz_count function. */
-#undef HAVE___ARGZ_COUNT
+/* Define to 1 if you have the declaration of `stpcpy', and to 0 if you don't.
+ */
+#undef HAVE_DECL_STPCPY
-/* Define if you have the __argz_next function. */
-#undef HAVE___ARGZ_NEXT
+/* Define to 1 if you have the declaration of `strstr', and to 0 if you don't.
+ */
+#undef HAVE_DECL_STRSTR
-/* Define if you have the __argz_stringify function. */
-#undef HAVE___ARGZ_STRINGIFY
+/* Define to 1 if you have the declaration of `vsnprintf', and to 0 if you
+ don't. */
+#undef HAVE_DECL_VSNPRINTF
-/* Define if you have the dcgettext function. */
-#undef HAVE_DCGETTEXT
+/* Define to 1 if you have the <dirent.h> header file, and it defines `DIR'.
+ */
+#undef HAVE_DIRENT_H
-/* Define if you have the fcntl function. */
+/* Define to 1 if you have the <dlfcn.h> header file. */
+#undef HAVE_DLFCN_H
+
+/* Define to 1 if you have the `fcntl' function. */
#undef HAVE_FCNTL
-/* Define if you have the fdopen function. */
+/* Define to 1 if you have the <fcntl.h> header file. */
+#undef HAVE_FCNTL_H
+
+/* Define to 1 if you have the `fdopen' function. */
#undef HAVE_FDOPEN
-/* Define if you have the fseeko function. */
+/* Define to 1 if you have the `fopen64' function. */
+#undef HAVE_FOPEN64
+
+/* Define to 1 if you have the `fseeko' function. */
#undef HAVE_FSEEKO
-/* Define if you have the fseeko64 function. */
+/* Define to 1 if you have the `fseeko64' function. */
#undef HAVE_FSEEKO64
-/* Define if you have the ftello function. */
+/* Define to 1 if you have the `ftello' function. */
#undef HAVE_FTELLO
-/* Define if you have the ftello64 function. */
+/* Define to 1 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. */
+/* Define to 1 if you have the `getgid' function. */
#undef HAVE_GETGID
-/* Define if you have the getpagesize function. */
+/* Define to 1 if you have the `getpagesize' function. */
#undef HAVE_GETPAGESIZE
-/* Define if you have the getuid function. */
+/* Define to 1 if you have the `getuid' function. */
#undef HAVE_GETUID
-/* Define if you have the madvise function. */
-#undef HAVE_MADVISE
+/* Define to 1 if you have the <inttypes.h> header file. */
+#undef HAVE_INTTYPES_H
-/* Define if you have the mprotect function. */
-#undef HAVE_MPROTECT
+/* Define if <sys/procfs.h> has lwpstatus_t. */
+#undef HAVE_LWPSTATUS_T
-/* Define if you have the munmap function. */
-#undef HAVE_MUNMAP
+/* Define if <sys/procfs.h> has lwpstatus_t.pr_context. */
+#undef HAVE_LWPSTATUS_T_PR_CONTEXT
-/* Define if you have the putenv function. */
-#undef HAVE_PUTENV
+/* Define if <sys/procfs.h> has lwpstatus_t.pr_reg. */
+#undef HAVE_LWPSTATUS_T_PR_REG
-/* Define if you have the setenv function. */
-#undef HAVE_SETENV
+/* Define if <sys/procfs.h> has lwpxstatus_t. */
+#undef HAVE_LWPXSTATUS_T
-/* Define if you have the setitimer function. */
-#undef HAVE_SETITIMER
+/* Define to 1 if you have the `madvise' function. */
+#undef HAVE_MADVISE
-/* Define if you have the setlocale function. */
-#undef HAVE_SETLOCALE
+/* Define to 1 if you have the <memory.h> header file. */
+#undef HAVE_MEMORY_H
-/* Define if you have the stpcpy function. */
-#undef HAVE_STPCPY
+/* Define to 1 if you have a working `mmap' system call. */
+#undef HAVE_MMAP
-/* Define if you have the strcasecmp function. */
-#undef HAVE_STRCASECMP
+/* Define to 1 if you have the `mprotect' function. */
+#undef HAVE_MPROTECT
-/* Define if you have the strchr function. */
-#undef HAVE_STRCHR
+/* Define to 1 if you have the <ndir.h> header file, and it defines `DIR'. */
+#undef HAVE_NDIR_H
-/* Define if you have the strtoull function. */
-#undef HAVE_STRTOULL
+/* Define if <sys/procfs.h> has prpsinfo32_t. */
+#undef HAVE_PRPSINFO32_T
-/* Define if you have the sysconf function. */
-#undef HAVE_SYSCONF
+/* Define if <sys/procfs.h> has prpsinfo_t. */
+#undef HAVE_PRPSINFO_T
-/* Define if you have the <argz.h> header file. */
-#undef HAVE_ARGZ_H
+/* Define if <sys/procfs.h> has prstatus32_t. */
+#undef HAVE_PRSTATUS32_T
-/* Define if you have the <dirent.h> header file. */
-#undef HAVE_DIRENT_H
+/* Define if <sys/procfs.h> has prstatus32_t.pr_who. */
+#undef HAVE_PRSTATUS32_T_PR_WHO
-/* Define if you have the <fcntl.h> header file. */
-#undef HAVE_FCNTL_H
+/* Define if <sys/procfs.h> has prstatus_t. */
+#undef HAVE_PRSTATUS_T
-/* Define if you have the <limits.h> header file. */
-#undef HAVE_LIMITS_H
+/* Define if <sys/procfs.h> has prstatus_t.pr_who. */
+#undef HAVE_PRSTATUS_T_PR_WHO
+
+/* Define if <sys/procfs.h> has psinfo32_t. */
+#undef HAVE_PSINFO32_T
-/* Define if you have the <locale.h> header file. */
-#undef HAVE_LOCALE_H
+/* Define if <sys/procfs.h> has psinfo_t. */
+#undef HAVE_PSINFO_T
-/* Define if you have the <malloc.h> header file. */
-#undef HAVE_MALLOC_H
+/* Define if <sys/procfs.h> has pstatus32_t. */
+#undef HAVE_PSTATUS32_T
-/* Define if you have the <ndir.h> header file. */
-#undef HAVE_NDIR_H
+/* Define if <sys/procfs.h> has pstatus_t. */
+#undef HAVE_PSTATUS_T
-/* Define if you have the <nl_types.h> header file. */
-#undef HAVE_NL_TYPES_H
+/* Define if <sys/procfs.h> has pxstatus_t. */
+#undef HAVE_PXSTATUS_T
-/* Define if you have the <stddef.h> header file. */
+/* Define to 1 if you have the `setitimer' function. */
+#undef HAVE_SETITIMER
+
+/* Define to 1 if you have the <stddef.h> header file. */
#undef HAVE_STDDEF_H
-/* Define if you have the <stdlib.h> header file. */
+/* Define to 1 if you have the <stdint.h> header file. */
+#undef HAVE_STDINT_H
+
+/* Define to 1 if you have the <stdlib.h> header file. */
#undef HAVE_STDLIB_H
-/* Define if you have the <string.h> header file. */
+/* Define to 1 if you have the <strings.h> header file. */
+#undef HAVE_STRINGS_H
+
+/* Define to 1 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 to 1 if you have the `strtoull' function. */
+#undef HAVE_STRTOULL
-/* Define if you have the <sys/dir.h> header file. */
+/* Define if struct core_dumpx has member c_impl */
+#undef HAVE_ST_C_IMPL
+
+/* Define to 1 if you have the `sysconf' function. */
+#undef HAVE_SYSCONF
+
+/* Define to 1 if you have the <sys/dir.h> header file, and it defines `DIR'.
+ */
#undef HAVE_SYS_DIR_H
-/* Define if you have the <sys/file.h> header file. */
+/* Define to 1 if you have the <sys/file.h> header file. */
#undef HAVE_SYS_FILE_H
-/* Define if you have the <sys/ndir.h> header file. */
+/* Define to 1 if you have the <sys/ndir.h> header file, and it defines `DIR'.
+ */
#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. */
+/* Define to 1 if you have the <sys/procfs.h> header file. */
#undef HAVE_SYS_PROCFS_H
-/* Define if you have the <sys/time.h> header file. */
+/* Define to 1 if you have the <sys/stat.h> header file. */
+#undef HAVE_SYS_STAT_H
+
+/* Define to 1 if you have the <sys/time.h> header file. */
#undef HAVE_SYS_TIME_H
-/* Define if you have the <time.h> header file. */
+/* Define to 1 if you have the <sys/types.h> header file. */
+#undef HAVE_SYS_TYPES_H
+
+/* Define to 1 if you have the <time.h> header file. */
#undef HAVE_TIME_H
-/* Define if you have the <unistd.h> header file. */
+/* Define to 1 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
+/* Define if <sys/procfs.h> has win32_pstatus_t. */
+#undef HAVE_WIN32_PSTATUS_T
+
+/* Define to the sub-directory in which libtool stores uninstalled libraries.
+ */
+#undef LT_OBJDIR
/* 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
+/* Define to the address where bug reports for this package should be sent. */
+#undef PACKAGE_BUGREPORT
-/* Use b modifier when opening binary files? */
-#undef USE_BINARY_FOPEN
+/* Define to the full name of this package. */
+#undef PACKAGE_NAME
-/* Define if strstr is not declared in system header files. */
-#undef NEED_DECLARATION_STRSTR
+/* Define to the full name and version of this package. */
+#undef PACKAGE_STRING
-/* Define if malloc is not declared in system header files. */
-#undef NEED_DECLARATION_MALLOC
+/* Define to the one symbol short name of this package. */
+#undef PACKAGE_TARNAME
-/* Define if realloc is not declared in system header files. */
-#undef NEED_DECLARATION_REALLOC
+/* Define to the version of this package. */
+#undef PACKAGE_VERSION
-/* 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
+/* The size of a `char', as computed by sizeof. */
+#undef SIZEOF_CHAR
-/* 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
+/* The size of a `int', as computed by sizeof. */
+#undef SIZEOF_INT
-/* 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
+/* The size of a `long', as computed by sizeof. */
+#undef SIZEOF_LONG
-/* Define if <sys/procfs.h> has psinfo_t. */
-#undef HAVE_PSINFO_T
+/* The size of a `long long', as computed by sizeof. */
+#undef SIZEOF_LONG_LONG
-/* Define if <sys/procfs.h> has psinfo32_t. */
-#undef HAVE_PSINFO32_T
+/* The size of a `off_t', as computed by sizeof. */
+#undef SIZEOF_OFF_T
-/* Define if <sys/procfs.h> has lwpstatus_t. */
-#undef HAVE_LWPSTATUS_T
+/* The size of a `short', as computed by sizeof. */
+#undef SIZEOF_SHORT
-/* Define if <sys/procfs.h> has lwpxstatus_t. */
-#undef HAVE_LWPXSTATUS_T
+/* The size of a `void *', as computed by sizeof. */
+#undef SIZEOF_VOID_P
-/* Define if <sys/procfs.h> has lwpstatus_t.pr_context. */
-#undef HAVE_LWPSTATUS_T_PR_CONTEXT
+/* Define to 1 if you have the ANSI C header files. */
+#undef STDC_HEADERS
-/* Define if <sys/procfs.h> has lwpstatus_t.pr_reg. */
-#undef HAVE_LWPSTATUS_T_PR_REG
+/* Define if you can safely include both <string.h> and <strings.h>. */
+#undef STRING_WITH_STRINGS
-/* Define if <sys/procfs.h> has win32_pstatus_t. */
-#undef HAVE_WIN32_PSTATUS_T
+/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
+#undef TIME_WITH_SYS_TIME
/* 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 b modifier when opening binary files? */
+#undef USE_BINARY_FOPEN
/* Use mmap if it's available? */
#undef USE_MMAP
+/* Define if we should default to creating read-only plt entries */
+#undef USE_SECUREPLT
+
+/* Version number of package */
+#undef VERSION
+
+/* Enable GNU extensions on systems that have them. */
+#ifndef _GNU_SOURCE
+# undef _GNU_SOURCE
+#endif
diff --git a/contrib/binutils/bfd/configure b/contrib/binutils/bfd/configure
index 49516021..3cff895 100755
--- a/contrib/binutils/bfd/configure
+++ b/contrib/binutils/bfd/configure
@@ -1,57 +1,474 @@
#! /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.
+# Generated by GNU Autoconf 2.59.
#
+# Copyright (C) 2003 Free Software Foundation, Inc.
# This configure script is free software; the Free Software Foundation
# gives unlimited permission to copy, distribute and modify it.
+## --------------------- ##
+## M4sh Initialization. ##
+## --------------------- ##
+
+# Be Bourne compatible
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
+ emulate sh
+ NULLCMD=:
+ # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
+ # is contrary to our usage. Disable this feature.
+ alias -g '${1+"$@"}'='"$@"'
+elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then
+ set -o posix
+fi
+DUALCASE=1; export DUALCASE # for MKS sh
+
+# Support unset when possible.
+if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
+ as_unset=unset
+else
+ as_unset=false
+fi
+
+
+# Work around bugs in pre-3.0 UWIN ksh.
+$as_unset ENV MAIL MAILPATH
+PS1='$ '
+PS2='> '
+PS4='+ '
+
+# NLS nuisances.
+for as_var in \
+ LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \
+ LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \
+ LC_TELEPHONE LC_TIME
+do
+ if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then
+ eval $as_var=C; export $as_var
+ else
+ $as_unset $as_var
+ fi
+done
+
+# Required to use basename.
+if expr a : '\(a\)' >/dev/null 2>&1; then
+ as_expr=expr
+else
+ as_expr=false
+fi
+
+if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then
+ as_basename=basename
+else
+ as_basename=false
+fi
+
+
+# Name of the executable.
+as_me=`$as_basename "$0" ||
+$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
+ X"$0" : 'X\(//\)$' \| \
+ X"$0" : 'X\(/\)$' \| \
+ . : '\(.\)' 2>/dev/null ||
+echo X/"$0" |
+ sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; }
+ /^X\/\(\/\/\)$/{ s//\1/; q; }
+ /^X\/\(\/\).*/{ s//\1/; q; }
+ s/.*/./; q'`
+
+
+# PATH needs CR, and LINENO needs CR and PATH.
+# Avoid depending upon Character Ranges.
+as_cr_letters='abcdefghijklmnopqrstuvwxyz'
+as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
+as_cr_Letters=$as_cr_letters$as_cr_LETTERS
+as_cr_digits='0123456789'
+as_cr_alnum=$as_cr_Letters$as_cr_digits
+
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+ echo "#! /bin/sh" >conf$$.sh
+ echo "exit 0" >>conf$$.sh
+ chmod +x conf$$.sh
+ if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
+ PATH_SEPARATOR=';'
+ else
+ PATH_SEPARATOR=:
+ fi
+ rm -f conf$$.sh
+fi
+
+
+ as_lineno_1=$LINENO
+ as_lineno_2=$LINENO
+ as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
+ test "x$as_lineno_1" != "x$as_lineno_2" &&
+ test "x$as_lineno_3" = "x$as_lineno_2" || {
+ # Find who we are. Look in the path if we contain no path at all
+ # relative or not.
+ case $0 in
+ *[\\/]* ) as_myself=$0 ;;
+ *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
+done
+
+ ;;
+ esac
+ # We did not find ourselves, most probably we were run as `sh COMMAND'
+ # in which case we are not to be found in the path.
+ if test "x$as_myself" = x; then
+ as_myself=$0
+ fi
+ if test ! -f "$as_myself"; then
+ { echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2
+ { (exit 1); exit 1; }; }
+ fi
+ case $CONFIG_SHELL in
+ '')
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for as_base in sh bash ksh sh5; do
+ case $as_dir in
+ /*)
+ if ("$as_dir/$as_base" -c '
+ as_lineno_1=$LINENO
+ as_lineno_2=$LINENO
+ as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
+ test "x$as_lineno_1" != "x$as_lineno_2" &&
+ test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then
+ $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; }
+ $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; }
+ CONFIG_SHELL=$as_dir/$as_base
+ export CONFIG_SHELL
+ exec "$CONFIG_SHELL" "$0" ${1+"$@"}
+ fi;;
+ esac
+ done
+done
+;;
+ esac
+
+ # Create $as_me.lineno as a copy of $as_myself, but with $LINENO
+ # uniformly replaced by the line number. The first 'sed' inserts a
+ # line-number line before each line; the second 'sed' does the real
+ # work. The second script uses 'N' to pair each line-number line
+ # with the numbered line, and appends trailing '-' during
+ # substitution so that $LINENO is not a special case at line end.
+ # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the
+ # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-)
+ sed '=' <$as_myself |
+ sed '
+ N
+ s,$,-,
+ : loop
+ s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3,
+ t loop
+ s,-$,,
+ s,^['$as_cr_digits']*\n,,
+ ' >$as_me.lineno &&
+ chmod +x $as_me.lineno ||
+ { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2
+ { (exit 1); exit 1; }; }
+
+ # Don't try to exec as it changes $[0], causing all sort of problems
+ # (the dirname of $[0] is not the place where we might find the
+ # original and so on. Autoconf is especially sensible to this).
+ . ./$as_me.lineno
+ # Exit status is that of the last command.
+ exit
+}
+
+
+case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in
+ *c*,-n*) ECHO_N= ECHO_C='
+' ECHO_T=' ' ;;
+ *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;;
+ *) ECHO_N= ECHO_C='\c' ECHO_T= ;;
+esac
+
+if expr a : '\(a\)' >/dev/null 2>&1; then
+ as_expr=expr
+else
+ as_expr=false
+fi
+
+rm -f conf$$ conf$$.exe conf$$.file
+echo >conf$$.file
+if ln -s conf$$.file conf$$ 2>/dev/null; then
+ # We could just check for DJGPP; but this test a) works b) is more generic
+ # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04).
+ if test -f conf$$.exe; then
+ # Don't use ln at all; we don't have any links
+ as_ln_s='cp -p'
+ else
+ as_ln_s='ln -s'
+ fi
+elif ln conf$$.file conf$$ 2>/dev/null; then
+ as_ln_s=ln
+else
+ as_ln_s='cp -p'
+fi
+rm -f conf$$ conf$$.exe conf$$.file
+
+if mkdir -p . 2>/dev/null; then
+ as_mkdir_p=:
+else
+ test -d ./-p && rmdir ./-p
+ as_mkdir_p=false
+fi
+
+as_executable_p="test -f"
+
+# Sed expression to map a string onto a valid CPP name.
+as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
+
+# Sed expression to map a string onto a valid variable name.
+as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
+
+
+# IFS
+# We need space, tab and new line, in precisely that order.
+as_nl='
+'
+IFS=" $as_nl"
+
+# CDPATH.
+$as_unset CDPATH
+
+
+
+# Check that we are running under the correct shell.
+SHELL=${CONFIG_SHELL-/bin/sh}
+
+case X$lt_ECHO in
+X*--fallback-echo)
+ # Remove one level of quotation (which was required for Make).
+ ECHO=`echo "$lt_ECHO" | sed 's,\\\\\$\\$0,'$0','`
+ ;;
+esac
-# Defaults:
-ac_help=
+ECHO=${lt_ECHO-echo}
+if test "X$1" = X--no-reexec; then
+ # Discard the --no-reexec flag, and continue.
+ shift
+elif test "X$1" = X--fallback-echo; then
+ # Avoid inline document here, it may be left over
+ :
+elif test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t' ; then
+ # Yippee, $ECHO works!
+ :
+else
+ # Restart under the correct shell.
+ exec $SHELL "$0" --no-reexec ${1+"$@"}
+fi
+
+if test "X$1" = X--fallback-echo; then
+ # used as fallback echo
+ shift
+ cat <<_LT_EOF
+$*
+_LT_EOF
+ exit 0
+fi
+
+# The HP-UX ksh and POSIX shell print the target directory to stdout
+# if CDPATH is set.
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+
+if test -z "$lt_ECHO"; then
+ if test "X${echo_test_string+set}" != Xset; then
+ # find a string as large as possible, as long as the shell can cope with it
+ for cmd in 'sed 50q "$0"' 'sed 20q "$0"' 'sed 10q "$0"' 'sed 2q "$0"' 'echo test'; do
+ # expected sizes: less than 2Kb, 1Kb, 512 bytes, 16 bytes, ...
+ if { echo_test_string=`eval $cmd`; } 2>/dev/null &&
+ { test "X$echo_test_string" = "X$echo_test_string"; } 2>/dev/null
+ then
+ break
+ fi
+ done
+ fi
+
+ if test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t' &&
+ echo_testing_string=`{ $ECHO "$echo_test_string"; } 2>/dev/null` &&
+ test "X$echo_testing_string" = "X$echo_test_string"; then
+ :
+ else
+ # The Solaris, AIX, and Digital Unix default echo programs unquote
+ # backslashes. This makes it impossible to quote backslashes using
+ # echo "$something" | sed 's/\\/\\\\/g'
+ #
+ # So, first we look for a working echo in the user's PATH.
+
+ lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+ for dir in $PATH /usr/ucb; do
+ IFS="$lt_save_ifs"
+ if (test -f $dir/echo || test -f $dir/echo$ac_exeext) &&
+ test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' &&
+ echo_testing_string=`($dir/echo "$echo_test_string") 2>/dev/null` &&
+ test "X$echo_testing_string" = "X$echo_test_string"; then
+ ECHO="$dir/echo"
+ break
+ fi
+ done
+ IFS="$lt_save_ifs"
+
+ if test "X$ECHO" = Xecho; then
+ # We didn't find a better echo, so look for alternatives.
+ if test "X`{ print -r '\t'; } 2>/dev/null`" = 'X\t' &&
+ echo_testing_string=`{ print -r "$echo_test_string"; } 2>/dev/null` &&
+ test "X$echo_testing_string" = "X$echo_test_string"; then
+ # This shell has a builtin print -r that does the trick.
+ ECHO='print -r'
+ elif { test -f /bin/ksh || test -f /bin/ksh$ac_exeext; } &&
+ test "X$CONFIG_SHELL" != X/bin/ksh; then
+ # If we have ksh, try running configure again with it.
+ ORIGINAL_CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
+ export ORIGINAL_CONFIG_SHELL
+ CONFIG_SHELL=/bin/ksh
+ export CONFIG_SHELL
+ exec $CONFIG_SHELL "$0" --no-reexec ${1+"$@"}
+ else
+ # Try using printf.
+ ECHO='printf %s\n'
+ if test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t' &&
+ echo_testing_string=`{ $ECHO "$echo_test_string"; } 2>/dev/null` &&
+ test "X$echo_testing_string" = "X$echo_test_string"; then
+ # Cool, printf works
+ :
+ elif echo_testing_string=`($ORIGINAL_CONFIG_SHELL "$0" --fallback-echo '\t') 2>/dev/null` &&
+ test "X$echo_testing_string" = 'X\t' &&
+ echo_testing_string=`($ORIGINAL_CONFIG_SHELL "$0" --fallback-echo "$echo_test_string") 2>/dev/null` &&
+ test "X$echo_testing_string" = "X$echo_test_string"; then
+ CONFIG_SHELL=$ORIGINAL_CONFIG_SHELL
+ export CONFIG_SHELL
+ SHELL="$CONFIG_SHELL"
+ export SHELL
+ ECHO="$CONFIG_SHELL $0 --fallback-echo"
+ elif echo_testing_string=`($CONFIG_SHELL "$0" --fallback-echo '\t') 2>/dev/null` &&
+ test "X$echo_testing_string" = 'X\t' &&
+ echo_testing_string=`($CONFIG_SHELL "$0" --fallback-echo "$echo_test_string") 2>/dev/null` &&
+ test "X$echo_testing_string" = "X$echo_test_string"; then
+ ECHO="$CONFIG_SHELL $0 --fallback-echo"
+ else
+ # maybe with a smaller string...
+ prev=:
+
+ for cmd in 'echo test' 'sed 2q "$0"' 'sed 10q "$0"' 'sed 20q "$0"' 'sed 50q "$0"'; do
+ if { test "X$echo_test_string" = "X`eval $cmd`"; } 2>/dev/null
+ then
+ break
+ fi
+ prev="$cmd"
+ done
+
+ if test "$prev" != 'sed 50q "$0"'; then
+ echo_test_string=`eval $prev`
+ export echo_test_string
+ exec ${ORIGINAL_CONFIG_SHELL-${CONFIG_SHELL-/bin/sh}} "$0" ${1+"$@"}
+ else
+ # Oops. We lost completely, so just stick with echo.
+ ECHO=echo
+ fi
+ fi
+ fi
+ fi
+ fi
+fi
+
+# Copy echo and quote the copy suitably for passing to libtool from
+# the Makefile, instead of quoting the original, which is used later.
+lt_ECHO=$ECHO
+if test "X$lt_ECHO" = "X$CONFIG_SHELL $0 --fallback-echo"; then
+ lt_ECHO="$CONFIG_SHELL \\\$\$0 --fallback-echo"
+fi
+
+
+
+
+# Name of the host.
+# hostname on some systems (SVR3.2, Linux) returns a bogus exit status,
+# so uname gets run too.
+ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q`
+
+exec 6>&1
+
+#
+# Initializations.
+#
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"
+ac_config_libobj_dir=.
+cross_compiling=no
+subdirs=
+MFLAGS=
+MAKEFLAGS=
+SHELL=${CONFIG_SHELL-/bin/sh}
+
+# Maximum number of lines to put in a shell here document.
+# This variable seems obsolete. It should probably be removed, and
+# only ac_max_sed_lines should be used.
+: ${ac_max_here_lines=38}
+
+# Identity of this package.
+PACKAGE_NAME=
+PACKAGE_TARNAME=
+PACKAGE_VERSION=
+PACKAGE_STRING=
+PACKAGE_BUGREPORT=
+
+ac_unique_file="libbfd.c"
+# Factoring default headers for most tests.
+ac_includes_default="\
+#include <stdio.h>
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+#if STDC_HEADERS
+# include <stdlib.h>
+# include <stddef.h>
+#else
+# if HAVE_STDLIB_H
+# include <stdlib.h>
+# endif
+#endif
+#if HAVE_STRING_H
+# if !STDC_HEADERS && HAVE_MEMORY_H
+# include <memory.h>
+# endif
+# include <string.h>
+#endif
+#if HAVE_STRINGS_H
+# include <strings.h>
+#endif
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+# include <stdint.h>
+# endif
+#endif
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif"
+
+ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE AR ac_ct_AR RANLIB ac_ct_RANLIB LIBTOOL SED EGREP FGREP GREP LD DUMPBIN ac_ct_DUMPBIN NM LN_S lt_ECHO CPP DEBUGDIR PKGVERSION REPORT_BUGS_TO REPORT_BUGS_TEXI WARN_CFLAGS NO_WERROR MAINTAINER_MODE_TRUE MAINTAINER_MODE_FALSE MAINT GENINSRC_NEVER_TRUE GENINSRC_NEVER_FALSE INSTALL_LIBBFD_TRUE INSTALL_LIBBFD_FALSE host_noncanonical target_noncanonical bfdlibdir bfdincludedir USE_NLS LIBINTL LIBINTL_DEP INCINTL XGETTEXT GMSGFMT POSUB CATALOGS DATADIRNAME INSTOBJEXT GENCAT CATOBJEXT MKINSTALLDIRS MSGFMT MSGMERGE HDEFINES BFD_HOST_64BIT_LONG BFD_HOST_LONG_LONG BFD_HOST_64_BIT_DEFINED BFD_HOST_64_BIT BFD_HOST_U_64_BIT CC_FOR_BUILD EXEEXT_FOR_BUILD COREFILE COREFLAG WIN32LDFLAGS WIN32LIBADD TDEFINES wordsize bfd64_libs all_backends bfd_backends bfd_machines bfd_default_target_size bfd_file_ptr bfd_ufile_ptr tdefaults datarootdir docdir htmldir LIBOBJS LTLIBOBJS'
+ac_subst_files=''
# Initialize some variables set by options.
+ac_init_help=
+ac_init_version=false
# The variables have the same names as the options, with
# dashes changed to underlines.
-build=NONE
-cache_file=./config.cache
+cache_file=/dev/null
exec_prefix=NONE
-host=NONE
no_create=
-nonopt=NONE
no_recursion=
prefix=NONE
program_prefix=NONE
@@ -60,10 +477,15 @@ program_transform_name=s,x,x,
silent=
site=
srcdir=
-target=NONE
verbose=
x_includes=NONE
x_libraries=NONE
+
+# Installation directory options.
+# These are left unexpanded so users can "make install exec_prefix=/foo"
+# and all the variables that are supposed to be based on exec_prefix
+# by default will actually change.
+# Use braces instead of parens because sh, perl, etc. also accept them.
bindir='${exec_prefix}/bin'
sbindir='${exec_prefix}/sbin'
libexecdir='${exec_prefix}/libexec'
@@ -77,17 +499,9 @@ 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"
@@ -95,59 +509,59 @@ do
continue
fi
- case "$ac_option" in
- -*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
- *) ac_optarg= ;;
- esac
+ ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'`
# Accept the important Cygnus configure options, so we can diagnose typos.
- case "$ac_option" in
+ case $ac_option in
-bindir | --bindir | --bindi | --bind | --bin | --bi)
ac_prev=bindir ;;
-bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*)
- bindir="$ac_optarg" ;;
+ bindir=$ac_optarg ;;
-build | --build | --buil | --bui | --bu)
- ac_prev=build ;;
+ ac_prev=build_alias ;;
-build=* | --build=* | --buil=* | --bui=* | --bu=*)
- build="$ac_optarg" ;;
+ build_alias=$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" ;;
+ cache_file=$ac_optarg ;;
+
+ --config-cache | -C)
+ cache_file=config.cache ;;
-datadir | --datadir | --datadi | --datad | --data | --dat | --da)
ac_prev=datadir ;;
-datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \
| --da=*)
- datadir="$ac_optarg" ;;
+ datadir=$ac_optarg ;;
-disable-* | --disable-*)
- ac_feature=`echo $ac_option|sed -e 's/-*disable-//'`
+ ac_feature=`expr "x$ac_option" : 'x-*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" ;;
+ expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null &&
+ { echo "$as_me: error: invalid feature name: $ac_feature" >&2
+ { (exit 1); exit 1; }; }
+ 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/=.*//'`
+ ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'`
# 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
- *=*) ;;
+ expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null &&
+ { echo "$as_me: error: invalid feature name: $ac_feature" >&2
+ { (exit 1); exit 1; }; }
+ ac_feature=`echo $ac_feature | sed 's/-/_/g'`
+ case $ac_option in
+ *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;;
*) ac_optarg=yes ;;
esac
- eval "enable_${ac_feature}='$ac_optarg'" ;;
+ eval "enable_$ac_feature='$ac_optarg'" ;;
-exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
| --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \
@@ -156,95 +570,47 @@ do
-exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \
| --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \
| --exec=* | --exe=* | --ex=*)
- exec_prefix="$ac_optarg" ;;
+ 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 ;;
+ -help | --help | --hel | --he | -h)
+ ac_init_help=long ;;
+ -help=r* | --help=r* | --hel=r* | --he=r* | -hr*)
+ ac_init_help=recursive ;;
+ -help=s* | --help=s* | --hel=s* | --he=s* | -hs*)
+ ac_init_help=short ;;
-host | --host | --hos | --ho)
- ac_prev=host ;;
+ ac_prev=host_alias ;;
-host=* | --host=* | --hos=* | --ho=*)
- host="$ac_optarg" ;;
+ host_alias=$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" ;;
+ includedir=$ac_optarg ;;
-infodir | --infodir | --infodi | --infod | --info | --inf)
ac_prev=infodir ;;
-infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*)
- infodir="$ac_optarg" ;;
+ infodir=$ac_optarg ;;
-libdir | --libdir | --libdi | --libd)
ac_prev=libdir ;;
-libdir=* | --libdir=* | --libdi=* | --libd=*)
- libdir="$ac_optarg" ;;
+ 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" ;;
+ libexecdir=$ac_optarg ;;
-localstatedir | --localstatedir | --localstatedi | --localstated \
| --localstate | --localstat | --localsta | --localst \
@@ -253,19 +619,19 @@ EOF
-localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \
| --localstate=* | --localstat=* | --localsta=* | --localst=* \
| --locals=* | --local=* | --loca=* | --loc=* | --lo=*)
- localstatedir="$ac_optarg" ;;
+ localstatedir=$ac_optarg ;;
-mandir | --mandir | --mandi | --mand | --man | --ma | --m)
ac_prev=mandir ;;
-mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*)
- mandir="$ac_optarg" ;;
+ 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-cr | --no-c | -n)
no_create=yes ;;
-no-recursion | --no-recursion | --no-recursio | --no-recursi \
@@ -279,26 +645,26 @@ EOF
-oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \
| --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \
| --oldin=* | --oldi=* | --old=* | --ol=* | --o=*)
- oldincludedir="$ac_optarg" ;;
+ oldincludedir=$ac_optarg ;;
-prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
ac_prev=prefix ;;
-prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
- prefix="$ac_optarg" ;;
+ 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_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_suffix=$ac_optarg ;;
-program-transform-name | --program-transform-name \
| --program-transform-nam | --program-transform-na \
@@ -315,7 +681,7 @@ EOF
| --program-transfo=* | --program-transf=* \
| --program-trans=* | --program-tran=* \
| --progr-tra=* | --program-tr=* | --program-t=*)
- program_transform_name="$ac_optarg" ;;
+ program_transform_name=$ac_optarg ;;
-q | -quiet | --quiet | --quie | --qui | --qu | --q \
| -silent | --silent | --silen | --sile | --sil)
@@ -325,7 +691,7 @@ EOF
ac_prev=sbindir ;;
-sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
| --sbi=* | --sb=*)
- sbindir="$ac_optarg" ;;
+ sbindir=$ac_optarg ;;
-sharedstatedir | --sharedstatedir | --sharedstatedi \
| --sharedstated | --sharedstate | --sharedstat | --sharedsta \
@@ -336,58 +702,57 @@ EOF
| --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \
| --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \
| --sha=* | --sh=*)
- sharedstatedir="$ac_optarg" ;;
+ sharedstatedir=$ac_optarg ;;
-site | --site | --sit)
ac_prev=site ;;
-site=* | --site=* | --sit=*)
- site="$ac_optarg" ;;
+ site=$ac_optarg ;;
-srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
ac_prev=srcdir ;;
-srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
- srcdir="$ac_optarg" ;;
+ 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" ;;
+ sysconfdir=$ac_optarg ;;
-target | --target | --targe | --targ | --tar | --ta | --t)
- ac_prev=target ;;
+ ac_prev=target_alias ;;
-target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
- target="$ac_optarg" ;;
+ target_alias=$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 ;;
+ -version | --version | --versio | --versi | --vers | -V)
+ ac_init_version=: ;;
-with-* | --with-*)
- ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'`
+ ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'`
# 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
+ expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null &&
+ { echo "$as_me: error: invalid package name: $ac_package" >&2
+ { (exit 1); exit 1; }; }
ac_package=`echo $ac_package| sed 's/-/_/g'`
- case "$ac_option" in
- *=*) ;;
+ case $ac_option in
+ *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;;
*) ac_optarg=yes ;;
esac
- eval "with_${ac_package}='$ac_optarg'" ;;
+ eval "with_$ac_package='$ac_optarg'" ;;
-without-* | --without-*)
- ac_package=`echo $ac_option|sed -e 's/-*without-//'`
+ ac_package=`expr "x$ac_option" : 'x-*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" ;;
+ expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null &&
+ { echo "$as_me: error: invalid package name: $ac_package" >&2
+ { (exit 1); exit 1; }; }
+ ac_package=`echo $ac_package | sed 's/-/_/g'`
+ eval "with_$ac_package=no" ;;
--x)
# Obsolete; use --with-x.
@@ -398,99 +763,110 @@ EOF
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_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" ;;
+ x_libraries=$ac_optarg ;;
- -*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; }
+ -*) { echo "$as_me: error: unrecognized option: $ac_option
+Try \`$0 --help' for more information." >&2
+ { (exit 1); exit 1; }; }
;;
+ *=*)
+ ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='`
+ # Reject names that are not valid shell variable names.
+ expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null &&
+ { echo "$as_me: error: invalid variable name: $ac_envvar" >&2
+ { (exit 1); exit 1; }; }
+ ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`
+ eval "$ac_envvar='$ac_optarg'"
+ export $ac_envvar ;;
+
*)
- 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"
+ # FIXME: should be removed in autoconf 3.0.
+ echo "$as_me: WARNING: you should use --build, --host, --target" >&2
+ expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null &&
+ echo "$as_me: WARNING: invalid host type: $ac_option" >&2
+ : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$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; }
+ ac_option=--`echo $ac_prev | sed 's/_/-/g'`
+ { echo "$as_me: error: missing argument to $ac_option" >&2
+ { (exit 1); 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
+# Be sure to have absolute paths.
+for ac_var in exec_prefix prefix
+do
+ eval ac_val=$`echo $ac_var`
+ case $ac_val in
+ [\\/$]* | ?:[\\/]* | NONE | '' ) ;;
+ *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2
+ { (exit 1); exit 1; }; };;
+ esac
+done
-# 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
+# Be sure to have absolute paths.
+for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \
+ localstatedir libdir includedir oldincludedir infodir mandir
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" ;;
+ eval ac_val=$`echo $ac_var`
+ case $ac_val in
+ [\\/$]* | ?:[\\/]* ) ;;
+ *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2
+ { (exit 1); exit 1; }; };;
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
+# There might be people who depend on the old broken behavior: `$host'
+# used to hold the argument of --host etc.
+# FIXME: To remove some day.
+build=$build_alias
+host=$host_alias
+target=$target_alias
+
+# FIXME: To remove some day.
+if test "x$host_alias" != x; then
+ if test "x$build_alias" = x; then
+ cross_compiling=maybe
+ echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host.
+ If a cross compiler is detected then cross compile mode will be used." >&2
+ elif test "x$build_alias" != "x$host_alias"; then
+ cross_compiling=yes
+ fi
+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
+ac_tool_prefix=
+test -n "$host_alias" && ac_tool_prefix=$host_alias-
+
+test "$silent" = yes && exec 6>/dev/null
-# 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=.
+ ac_confdir=`(dirname "$0") 2>/dev/null ||
+$as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$0" : 'X\(//\)[^/]' \| \
+ X"$0" : 'X\(//\)$' \| \
+ X"$0" : 'X\(/\)' \| \
+ . : '\(.\)' 2>/dev/null ||
+echo X"$0" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+ /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+ /^X\(\/\/\)$/{ s//\1/; q; }
+ /^X\(\/\).*/{ s//\1/; q; }
+ s/.*/./; q'`
srcdir=$ac_confdir
if test ! -r $srcdir/$ac_unique_file; then
srcdir=..
@@ -500,13 +876,501 @@ else
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; }
+ { echo "$as_me: error: cannot find sources ($ac_unique_file) in $ac_confdir or .." >&2
+ { (exit 1); exit 1; }; }
else
- { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; }
+ { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2
+ { (exit 1); exit 1; }; }
fi
fi
-srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'`
+(cd $srcdir && test -r ./$ac_unique_file) 2>/dev/null ||
+ { echo "$as_me: error: sources are in $srcdir, but \`cd $srcdir' does not work" >&2
+ { (exit 1); exit 1; }; }
+srcdir=`echo "$srcdir" | sed 's%\([^\\/]\)[\\/]*$%\1%'`
+ac_env_build_alias_set=${build_alias+set}
+ac_env_build_alias_value=$build_alias
+ac_cv_env_build_alias_set=${build_alias+set}
+ac_cv_env_build_alias_value=$build_alias
+ac_env_host_alias_set=${host_alias+set}
+ac_env_host_alias_value=$host_alias
+ac_cv_env_host_alias_set=${host_alias+set}
+ac_cv_env_host_alias_value=$host_alias
+ac_env_target_alias_set=${target_alias+set}
+ac_env_target_alias_value=$target_alias
+ac_cv_env_target_alias_set=${target_alias+set}
+ac_cv_env_target_alias_value=$target_alias
+ac_env_CC_set=${CC+set}
+ac_env_CC_value=$CC
+ac_cv_env_CC_set=${CC+set}
+ac_cv_env_CC_value=$CC
+ac_env_CFLAGS_set=${CFLAGS+set}
+ac_env_CFLAGS_value=$CFLAGS
+ac_cv_env_CFLAGS_set=${CFLAGS+set}
+ac_cv_env_CFLAGS_value=$CFLAGS
+ac_env_LDFLAGS_set=${LDFLAGS+set}
+ac_env_LDFLAGS_value=$LDFLAGS
+ac_cv_env_LDFLAGS_set=${LDFLAGS+set}
+ac_cv_env_LDFLAGS_value=$LDFLAGS
+ac_env_CPPFLAGS_set=${CPPFLAGS+set}
+ac_env_CPPFLAGS_value=$CPPFLAGS
+ac_cv_env_CPPFLAGS_set=${CPPFLAGS+set}
+ac_cv_env_CPPFLAGS_value=$CPPFLAGS
+ac_env_CPP_set=${CPP+set}
+ac_env_CPP_value=$CPP
+ac_cv_env_CPP_set=${CPP+set}
+ac_cv_env_CPP_value=$CPP
+
+#
+# Report the --help message.
+#
+if test "$ac_init_help" = "long"; then
+ # 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 <<_ACEOF
+\`configure' configures this package to adapt to many kinds of systems.
+
+Usage: $0 [OPTION]... [VAR=VALUE]...
+
+To assign environment variables (e.g., CC, CFLAGS...), specify them as
+VAR=VALUE. See below for descriptions of some of the useful variables.
+
+Defaults for the options are specified in brackets.
+
+Configuration:
+ -h, --help display this help and exit
+ --help=short display options specific to this package
+ --help=recursive display the short help of all the included packages
+ -V, --version display version information and exit
+ -q, --quiet, --silent do not print \`checking...' messages
+ --cache-file=FILE cache test results in FILE [disabled]
+ -C, --config-cache alias for \`--cache-file=config.cache'
+ -n, --no-create do not create output files
+ --srcdir=DIR find the sources in DIR [configure dir or \`..']
+
+_ACEOF
+
+ cat <<_ACEOF
+Installation directories:
+ --prefix=PREFIX install architecture-independent files in PREFIX
+ [$ac_default_prefix]
+ --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX
+ [PREFIX]
+
+By default, \`make install' will install all the files in
+\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify
+an installation prefix other than \`$ac_default_prefix' using \`--prefix',
+for instance \`--prefix=\$HOME'.
+
+For better control, use the options below.
+
+Fine tuning of the installation directories:
+ --bindir=DIR user executables [EPREFIX/bin]
+ --sbindir=DIR system admin executables [EPREFIX/sbin]
+ --libexecdir=DIR program executables [EPREFIX/libexec]
+ --datadir=DIR read-only architecture-independent data [PREFIX/share]
+ --sysconfdir=DIR read-only single-machine data [PREFIX/etc]
+ --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]
+ --localstatedir=DIR modifiable single-machine data [PREFIX/var]
+ --libdir=DIR object code libraries [EPREFIX/lib]
+ --includedir=DIR C header files [PREFIX/include]
+ --oldincludedir=DIR C header files for non-gcc [/usr/include]
+ --infodir=DIR info documentation [PREFIX/info]
+ --mandir=DIR man documentation [PREFIX/man]
+_ACEOF
+
+ cat <<\_ACEOF
+
+Program names:
+ --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
+
+System types:
+ --build=BUILD configure for building on BUILD [guessed]
+ --host=HOST cross-compile to build programs to run on HOST [BUILD]
+ --target=TARGET configure for building compilers for TARGET [HOST]
+_ACEOF
+fi
+
+if test -n "$ac_init_help"; then
+
+ cat <<\_ACEOF
+
+Optional Features:
+ --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
+ --enable-FEATURE[=ARG] include FEATURE [ARG=yes]
+ --disable-dependency-tracking speeds up one-time build
+ --enable-dependency-tracking do not reject slow dependency extractors
+ --enable-shared[=PKGS]
+ build shared libraries [default=no]
+ --enable-static[=PKGS]
+ build static libraries [default=yes]
+ --enable-fast-install[=PKGS]
+ optimize for fast installation [default=yes]
+ --disable-libtool-lock avoid locking (might break parallel builds)
+ --enable-64-bit-bfd 64-bit support (on hosts with narrower word sizes)
+ --enable-targets alternative target configurations
+ --enable-commonbfdlib build shared BFD/opcodes/libiberty library
+ --enable-secureplt Default to creating read-only plt entries
+ --enable-werror treat compile warnings as errors
+ --enable-build-warnings enable build-time compiler warnings
+ --enable-maintainer-mode enable make rules and dependencies not useful
+ (and sometimes confusing) to the casual installer
+ --enable-install-libbfd controls installation of libbfd and related headers
+ --disable-nls do not use Native Language Support
+
+Optional Packages:
+ --with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
+ --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
+ --with-pic try to use only PIC/non-PIC objects [default=use
+ both]
+ --with-gnu-ld assume the C compiler uses GNU ld [default=no]
+ --with-mmap try using mmap for BFD input files if available
+ --with-separate-debug-dir=DIR
+ Look for global separate debug info in DIR
+ [default=LIBDIR/debug]
+ --with-pkgversion=PKG Use PKG in the version string in place of "GNU
+ Binutils"
+ --with-bugurl=URL Direct users to URL to report a bug
+
+Some influential environment variables:
+ CC C compiler command
+ CFLAGS C compiler flags
+ LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a
+ nonstandard directory <lib dir>
+ CPPFLAGS C/C++ preprocessor flags, e.g. -I<include dir> if you have
+ headers in a nonstandard directory <include dir>
+ CPP C preprocessor
+
+Use these variables to override the choices made by `configure' or to help
+it to find libraries and programs with nonstandard names/locations.
+
+_ACEOF
+fi
+
+if test "$ac_init_help" = "recursive"; then
+ # If there are subdirs, report their specific --help.
+ ac_popdir=`pwd`
+ for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue
+ test -d $ac_dir || continue
+ ac_builddir=.
+
+if test "$ac_dir" != .; then
+ ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'`
+ # A "../" for each directory in $ac_dir_suffix.
+ ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'`
+else
+ ac_dir_suffix= ac_top_builddir=
+fi
+
+case $srcdir in
+ .) # No --srcdir option. We are building in place.
+ ac_srcdir=.
+ if test -z "$ac_top_builddir"; then
+ ac_top_srcdir=.
+ else
+ ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'`
+ fi ;;
+ [\\/]* | ?:[\\/]* ) # Absolute path.
+ ac_srcdir=$srcdir$ac_dir_suffix;
+ ac_top_srcdir=$srcdir ;;
+ *) # Relative path.
+ ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix
+ ac_top_srcdir=$ac_top_builddir$srcdir ;;
+esac
+
+# Do not use `cd foo && pwd` to compute absolute paths, because
+# the directories may not exist.
+case `pwd` in
+.) ac_abs_builddir="$ac_dir";;
+*)
+ case "$ac_dir" in
+ .) ac_abs_builddir=`pwd`;;
+ [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";;
+ *) ac_abs_builddir=`pwd`/"$ac_dir";;
+ esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_top_builddir=${ac_top_builddir}.;;
+*)
+ case ${ac_top_builddir}. in
+ .) ac_abs_top_builddir=$ac_abs_builddir;;
+ [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;;
+ *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;;
+ esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_srcdir=$ac_srcdir;;
+*)
+ case $ac_srcdir in
+ .) ac_abs_srcdir=$ac_abs_builddir;;
+ [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;;
+ *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;;
+ esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_top_srcdir=$ac_top_srcdir;;
+*)
+ case $ac_top_srcdir in
+ .) ac_abs_top_srcdir=$ac_abs_builddir;;
+ [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;;
+ *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;;
+ esac;;
+esac
+
+ cd $ac_dir
+ # Check for guested configure; otherwise get Cygnus style configure.
+ if test -f $ac_srcdir/configure.gnu; then
+ echo
+ $SHELL $ac_srcdir/configure.gnu --help=recursive
+ elif test -f $ac_srcdir/configure; then
+ echo
+ $SHELL $ac_srcdir/configure --help=recursive
+ elif test -f $ac_srcdir/configure.ac ||
+ test -f $ac_srcdir/configure.in; then
+ echo
+ $ac_configure --help
+ else
+ echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2
+ fi
+ cd $ac_popdir
+ done
+fi
+
+test -n "$ac_init_help" && exit 0
+if $ac_init_version; then
+ cat <<\_ACEOF
+
+Copyright (C) 2003 Free Software Foundation, Inc.
+This configure script is free software; the Free Software Foundation
+gives unlimited permission to copy, distribute and modify it.
+_ACEOF
+ exit 0
+fi
+exec 5>config.log
+cat >&5 <<_ACEOF
+This file contains any messages produced by compilers while
+running configure, to aid debugging if configure makes a mistake.
+
+It was created by $as_me, which was
+generated by GNU Autoconf 2.59. Invocation command line was
+
+ $ $0 $@
+
+_ACEOF
+{
+cat <<_ASUNAME
+## --------- ##
+## Platform. ##
+## --------- ##
+
+hostname = `(hostname || uname -n) 2>/dev/null | sed 1q`
+uname -m = `(uname -m) 2>/dev/null || echo unknown`
+uname -r = `(uname -r) 2>/dev/null || echo unknown`
+uname -s = `(uname -s) 2>/dev/null || echo unknown`
+uname -v = `(uname -v) 2>/dev/null || echo unknown`
+
+/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown`
+/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown`
+
+/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown`
+/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown`
+/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown`
+hostinfo = `(hostinfo) 2>/dev/null || echo unknown`
+/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown`
+/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown`
+/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown`
+
+_ASUNAME
+
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ echo "PATH: $as_dir"
+done
+} >&5
+
+cat >&5 <<_ACEOF
+
+
+## ----------- ##
+## Core tests. ##
+## ----------- ##
+
+_ACEOF
+
+
+# Keep a trace of the command line.
+# Strip out --no-create and --no-recursion so they do not pile up.
+# Strip out --silent because we don't want to record it for future runs.
+# Also quote any args containing shell meta-characters.
+# Make two passes to allow for proper duplicate-argument suppression.
+ac_configure_args=
+ac_configure_args0=
+ac_configure_args1=
+ac_sep=
+ac_must_keep_next=false
+for ac_pass in 1 2
+do
+ for ac_arg
+ do
+ case $ac_arg in
+ -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;;
+ -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+ | -silent | --silent | --silen | --sile | --sil)
+ continue ;;
+ *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*)
+ ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
+ esac
+ case $ac_pass in
+ 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;;
+ 2)
+ ac_configure_args1="$ac_configure_args1 '$ac_arg'"
+ if test $ac_must_keep_next = true; then
+ ac_must_keep_next=false # Got value, back to normal.
+ else
+ case $ac_arg in
+ *=* | --config-cache | -C | -disable-* | --disable-* \
+ | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \
+ | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \
+ | -with-* | --with-* | -without-* | --without-* | --x)
+ case "$ac_configure_args0 " in
+ "$ac_configure_args1"*" '$ac_arg' "* ) continue ;;
+ esac
+ ;;
+ -* ) ac_must_keep_next=true ;;
+ esac
+ fi
+ ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'"
+ # Get rid of the leading space.
+ ac_sep=" "
+ ;;
+ esac
+ done
+done
+$as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; }
+$as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; }
+
+# When interrupted or exit'd, cleanup temporary files, and complete
+# config.log. We remove comments because anyway the quotes in there
+# would cause problems or look ugly.
+# WARNING: Be sure not to use single quotes in there, as some shells,
+# such as our DU 5.0 friend, will then `close' the trap.
+trap 'exit_status=$?
+ # Save into config.log some information that might help in debugging.
+ {
+ echo
+
+ cat <<\_ASBOX
+## ---------------- ##
+## Cache variables. ##
+## ---------------- ##
+_ASBOX
+ echo
+ # The following way of writing the cache mishandles newlines in values,
+{
+ (set) 2>&1 |
+ case `(ac_space='"'"' '"'"'; set | grep ac_space) 2>&1` in
+ *ac_space=\ *)
+ sed -n \
+ "s/'"'"'/'"'"'\\\\'"'"''"'"'/g;
+ s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p"
+ ;;
+ *)
+ sed -n \
+ "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p"
+ ;;
+ esac;
+}
+ echo
+
+ cat <<\_ASBOX
+## ----------------- ##
+## Output variables. ##
+## ----------------- ##
+_ASBOX
+ echo
+ for ac_var in $ac_subst_vars
+ do
+ eval ac_val=$`echo $ac_var`
+ echo "$ac_var='"'"'$ac_val'"'"'"
+ done | sort
+ echo
+
+ if test -n "$ac_subst_files"; then
+ cat <<\_ASBOX
+## ------------- ##
+## Output files. ##
+## ------------- ##
+_ASBOX
+ echo
+ for ac_var in $ac_subst_files
+ do
+ eval ac_val=$`echo $ac_var`
+ echo "$ac_var='"'"'$ac_val'"'"'"
+ done | sort
+ echo
+ fi
+
+ if test -s confdefs.h; then
+ cat <<\_ASBOX
+## ----------- ##
+## confdefs.h. ##
+## ----------- ##
+_ASBOX
+ echo
+ sed "/^$/d" confdefs.h | sort
+ echo
+ fi
+ test "$ac_signal" != 0 &&
+ echo "$as_me: caught signal $ac_signal"
+ echo "$as_me: exit $exit_status"
+ } >&5
+ rm -f core *.core &&
+ rm -rf conftest* confdefs* conf$$* $ac_clean_files &&
+ exit $exit_status
+ ' 0
+for ac_signal in 1 2 13 15; do
+ trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal
+done
+ac_signal=0
+
+# 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
+
+# Predefined preprocessor variables.
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_NAME "$PACKAGE_NAME"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_TARNAME "$PACKAGE_TARNAME"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_VERSION "$PACKAGE_VERSION"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_STRING "$PACKAGE_STRING"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT"
+_ACEOF
+
+
+# Let the site file select an alternate cache file if it wants to.
# Prefer explicitly selected file to automatically selected ones.
if test -z "$CONFIG_SITE"; then
if test "x$prefix" != xNONE; then
@@ -517,102 +1381,105 @@ if test -z "$CONFIG_SITE"; then
fi
for ac_site_file in $CONFIG_SITE; do
if test -r "$ac_site_file"; then
- echo "loading site script $ac_site_file"
+ { echo "$as_me:$LINENO: loading site script $ac_site_file" >&5
+echo "$as_me: loading site script $ac_site_file" >&6;}
+ sed 's/^/| /' "$ac_site_file" >&5
. "$ac_site_file"
fi
done
if test -r "$cache_file"; then
- echo "loading cache $cache_file"
- . $cache_file
+ # Some versions of bash will fail to source /dev/null (special
+ # files actually), so we avoid doing that.
+ if test -f "$cache_file"; then
+ { echo "$as_me:$LINENO: loading cache $cache_file" >&5
+echo "$as_me: loading cache $cache_file" >&6;}
+ case $cache_file in
+ [\\/]* | ?:[\\/]* ) . $cache_file;;
+ *) . ./$cache_file;;
+ esac
+ fi
else
- echo "creating cache $cache_file"
- > $cache_file
+ { echo "$as_me:$LINENO: creating cache $cache_file" >&5
+echo "$as_me: creating cache $cache_file" >&6;}
+ >$cache_file
+fi
+
+# Check that the precious variables saved in the cache have kept the same
+# value.
+ac_cache_corrupted=false
+for ac_var in `(set) 2>&1 |
+ sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; do
+ eval ac_old_set=\$ac_cv_env_${ac_var}_set
+ eval ac_new_set=\$ac_env_${ac_var}_set
+ eval ac_old_val="\$ac_cv_env_${ac_var}_value"
+ eval ac_new_val="\$ac_env_${ac_var}_value"
+ case $ac_old_set,$ac_new_set in
+ set,)
+ { echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5
+echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;}
+ ac_cache_corrupted=: ;;
+ ,set)
+ { echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5
+echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;}
+ ac_cache_corrupted=: ;;
+ ,);;
+ *)
+ if test "x$ac_old_val" != "x$ac_new_val"; then
+ { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5
+echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;}
+ { echo "$as_me:$LINENO: former value: $ac_old_val" >&5
+echo "$as_me: former value: $ac_old_val" >&2;}
+ { echo "$as_me:$LINENO: current value: $ac_new_val" >&5
+echo "$as_me: current value: $ac_new_val" >&2;}
+ ac_cache_corrupted=:
+ fi;;
+ esac
+ # Pass precious variables to config.status.
+ if test "$ac_new_set" = set; then
+ case $ac_new_val in
+ *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*)
+ ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;;
+ *) ac_arg=$ac_var=$ac_new_val ;;
+ esac
+ case " $ac_configure_args " in
+ *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy.
+ *) ac_configure_args="$ac_configure_args '$ac_arg'" ;;
+ esac
+ fi
+done
+if $ac_cache_corrupted; then
+ { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5
+echo "$as_me: error: changes in the environment can compromise the build" >&2;}
+ { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5
+echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;}
+ { (exit 1); exit 1; }; }
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
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+
+
+
+
+
+
+
+
+
+
+
-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=
@@ -625,149 +1492,1162 @@ for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do
ac_aux_dir=$ac_dir
ac_install_sh="$ac_aux_dir/install.sh -c"
break
+ elif test -f $ac_dir/shtool; then
+ ac_aux_dir=$ac_dir
+ ac_install_sh="$ac_aux_dir/shtool install -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; }
+ { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&5
+echo "$as_me: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&2;}
+ { (exit 1); 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.
+ac_config_guess="$SHELL $ac_aux_dir/config.guess"
+ac_config_sub="$SHELL $ac_aux_dir/config.sub"
+ac_configure="$SHELL $ac_aux_dir/configure" # This should be Cygnus configure.
+# Make sure we can run config.sub.
+$ac_config_sub sun4 >/dev/null 2>&1 ||
+ { { echo "$as_me:$LINENO: error: cannot run $ac_config_sub" >&5
+echo "$as_me: error: cannot run $ac_config_sub" >&2;}
+ { (exit 1); exit 1; }; }
+
+echo "$as_me:$LINENO: checking build system type" >&5
+echo $ECHO_N "checking build system type... $ECHO_C" >&6
+if test "${ac_cv_build+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_cv_build_alias=$build_alias
+test -z "$ac_cv_build_alias" &&
+ ac_cv_build_alias=`$ac_config_guess`
+test -z "$ac_cv_build_alias" &&
+ { { echo "$as_me:$LINENO: error: cannot guess build type; you must specify one" >&5
+echo "$as_me: error: cannot guess build type; you must specify one" >&2;}
+ { (exit 1); exit 1; }; }
+ac_cv_build=`$ac_config_sub $ac_cv_build_alias` ||
+ { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_build_alias failed" >&5
+echo "$as_me: error: $ac_config_sub $ac_cv_build_alias failed" >&2;}
+ { (exit 1); exit 1; }; }
+
+fi
+echo "$as_me:$LINENO: result: $ac_cv_build" >&5
+echo "${ECHO_T}$ac_cv_build" >&6
+build=$ac_cv_build
+build_cpu=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
+build_vendor=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
+build_os=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
+
+
+echo "$as_me:$LINENO: checking host system type" >&5
+echo $ECHO_N "checking host system type... $ECHO_C" >&6
+if test "${ac_cv_host+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_cv_host_alias=$host_alias
+test -z "$ac_cv_host_alias" &&
+ ac_cv_host_alias=$ac_cv_build_alias
+ac_cv_host=`$ac_config_sub $ac_cv_host_alias` ||
+ { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_host_alias failed" >&5
+echo "$as_me: error: $ac_config_sub $ac_cv_host_alias failed" >&2;}
+ { (exit 1); exit 1; }; }
+
+fi
+echo "$as_me:$LINENO: result: $ac_cv_host" >&5
+echo "${ECHO_T}$ac_cv_host" >&6
+host=$ac_cv_host
+host_cpu=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
+host_vendor=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
+host_os=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
+
+
+echo "$as_me:$LINENO: checking target system type" >&5
+echo $ECHO_N "checking target system type... $ECHO_C" >&6
+if test "${ac_cv_target+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_cv_target_alias=$target_alias
+test "x$ac_cv_target_alias" = "x" &&
+ ac_cv_target_alias=$ac_cv_host_alias
+ac_cv_target=`$ac_config_sub $ac_cv_target_alias` ||
+ { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_target_alias failed" >&5
+echo "$as_me: error: $ac_config_sub $ac_cv_target_alias failed" >&2;}
+ { (exit 1); exit 1; }; }
+
+fi
+echo "$as_me:$LINENO: result: $ac_cv_target" >&5
+echo "${ECHO_T}$ac_cv_target" >&6
+target=$ac_cv_target
+target_cpu=`echo $ac_cv_target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
+target_vendor=`echo $ac_cv_target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
+target_os=`echo $ac_cv_target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
-# 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
+test -n "$target_alias" &&
+ test "$program_prefix$program_suffix$program_transform_name" = \
+ NONENONEs,x,x, &&
+ program_prefix=${target_alias}-
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args.
+set dummy ${ac_tool_prefix}gcc; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_CC+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_CC="${ac_tool_prefix}gcc"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+ echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
-# Make sure we can run config.sub.
-if ${CONFIG_SHELL-/bin/sh} $ac_config_sub sun4 >/dev/null 2>&1; then :
-else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; }
fi
+if test -z "$ac_cv_prog_CC"; then
+ ac_ct_CC=$CC
+ # Extract the first word of "gcc", so it can be a program name with args.
+set dummy gcc; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$ac_ct_CC"; then
+ ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_CC="gcc"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
-echo $ac_n "checking host system type""... $ac_c" 1>&6
-echo "configure:666: checking host system type" >&5
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+ echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
+echo "${ECHO_T}$ac_ct_CC" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
-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
+ CC=$ac_ct_CC
+else
+ CC="$ac_cv_prog_CC"
+fi
-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
+if test -z "$CC"; then
+ if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args.
+set dummy ${ac_tool_prefix}cc; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_CC+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_CC="${ac_tool_prefix}cc"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
-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
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+ echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
-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
+fi
+if test -z "$ac_cv_prog_CC"; then
+ ac_ct_CC=$CC
+ # Extract the first word of "cc", so it can be a program name with args.
+set dummy cc; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$ac_ct_CC"; then
+ ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_CC="cc"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
-test "$host_alias" != "$target_alias" &&
- test "$program_prefix$program_suffix$program_transform_name" = \
- NONENONEs,x,x, &&
- program_prefix=${target_alias}-
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+ echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
+echo "${ECHO_T}$ac_ct_CC" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+ CC=$ac_ct_CC
+else
+ CC="$ac_cv_prog_CC"
+fi
- 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
+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 "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_CC+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&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();
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+ ac_prog_rejected=no
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then
+ ac_prog_rejected=yes
+ continue
+ fi
+ ac_cv_prog_CC="cc"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
-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"
+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 $# != 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
+ ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@"
+ fi
+fi
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+ echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6
else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "ac_cv_lib_$ac_lib_var=no"
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+fi
+if test -z "$CC"; then
+ if test -n "$ac_tool_prefix"; then
+ for ac_prog in cl
+ do
+ # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
+set dummy $ac_tool_prefix$ac_prog; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_CC+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_CC="$ac_tool_prefix$ac_prog"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+ echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+ test -n "$CC" && break
+ done
+fi
+if test -z "$CC"; then
+ ac_ct_CC=$CC
+ for ac_prog in cl
+do
+ # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$ac_ct_CC"; then
+ ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_CC="$ac_prog"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+ echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
+echo "${ECHO_T}$ac_ct_CC" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+ test -n "$ac_ct_CC" && break
+done
+
+ CC=$ac_ct_CC
+fi
+
+fi
+
+
+test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH
+See \`config.log' for more details." >&5
+echo "$as_me: error: no acceptable C compiler found in \$PATH
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; }
+
+# Provide some information about the compiler.
+echo "$as_me:$LINENO:" \
+ "checking for C compiler version" >&5
+ac_compiler=`set X $ac_compile; echo $2`
+{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version </dev/null >&5\"") >&5
+ (eval $ac_compiler --version </dev/null >&5) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }
+{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v </dev/null >&5\"") >&5
+ (eval $ac_compiler -v </dev/null >&5) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }
+{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V </dev/null >&5\"") >&5
+ (eval $ac_compiler -V </dev/null >&5) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }
+
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+ac_clean_files_save=$ac_clean_files
+ac_clean_files="$ac_clean_files a.out a.exe b.out"
+# Try to create an executable without -o first, disregard a.out.
+# It will help us diagnose broken compilers, and finding out an intuition
+# of exeext.
+echo "$as_me:$LINENO: checking for C compiler default output file name" >&5
+echo $ECHO_N "checking for C compiler default output file name... $ECHO_C" >&6
+ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'`
+if { (eval echo "$as_me:$LINENO: \"$ac_link_default\"") >&5
+ (eval $ac_link_default) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
+ # Find the output, starting from the most likely. This scheme is
+# not robust to junk in `.', hence go to wildcards (a.*) only as a last
+# resort.
+
+# Be careful to initialize this variable, since it used to be cached.
+# Otherwise an old cache value of `no' led to `EXEEXT = no' in a Makefile.
+ac_cv_exeext=
+# b.out is created by i960 compilers.
+for ac_file in a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out
+do
+ test -f "$ac_file" || continue
+ case $ac_file in
+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj )
+ ;;
+ conftest.$ac_ext )
+ # This is the source file.
+ ;;
+ [ab].out )
+ # We found the default executable, but exeext='' is most
+ # certainly right.
+ break;;
+ *.* )
+ ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
+ # FIXME: I believe we export ac_cv_exeext for Libtool,
+ # but it would be cool to find out if it's true. Does anybody
+ # maintain Libtool? --akim.
+ export ac_cv_exeext
+ break;;
+ * )
+ break;;
+ esac
+done
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+{ { echo "$as_me:$LINENO: error: C compiler cannot create executables
+See \`config.log' for more details." >&5
+echo "$as_me: error: C compiler cannot create executables
+See \`config.log' for more details." >&2;}
+ { (exit 77); exit 77; }; }
+fi
+
+ac_exeext=$ac_cv_exeext
+echo "$as_me:$LINENO: result: $ac_file" >&5
+echo "${ECHO_T}$ac_file" >&6
+
+# Check the compiler produces executables we can run. If not, either
+# the compiler is broken, or we cross compile.
+echo "$as_me:$LINENO: checking whether the C compiler works" >&5
+echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6
+# FIXME: These cross compiler hacks should be removed for Autoconf 3.0
+# If not cross compiling, check that we can run a simple program.
+if test "$cross_compiling" != yes; then
+ if { ac_try='./$ac_file'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ cross_compiling=no
+ else
+ if test "$cross_compiling" = maybe; then
+ cross_compiling=yes
+ else
+ { { echo "$as_me:$LINENO: error: cannot run C compiled programs.
+If you meant to cross compile, use \`--host'.
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot run C compiled programs.
+If you meant to cross compile, use \`--host'.
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; }
+ fi
+ fi
+fi
+echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
+
+rm -f a.out a.exe conftest$ac_cv_exeext b.out
+ac_clean_files=$ac_clean_files_save
+# Check the compiler produces executables we can run. If not, either
+# the compiler is broken, or we cross compile.
+echo "$as_me:$LINENO: checking whether we are cross compiling" >&5
+echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6
+echo "$as_me:$LINENO: result: $cross_compiling" >&5
+echo "${ECHO_T}$cross_compiling" >&6
+
+echo "$as_me:$LINENO: checking for suffix of executables" >&5
+echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
+ # If both `conftest.exe' and `conftest' are `present' (well, observable)
+# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will
+# work properly (i.e., refer to `conftest.exe'), while it won't with
+# `rm'.
+for ac_file in conftest.exe conftest conftest.*; do
+ test -f "$ac_file" || continue
+ case $ac_file in
+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) ;;
+ *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
+ export ac_cv_exeext
+ break;;
+ * ) break;;
+ esac
+done
+else
+ { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot compute suffix of executables: cannot compile and link
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+
+rm -f conftest$ac_cv_exeext
+echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5
+echo "${ECHO_T}$ac_cv_exeext" >&6
+
+rm -f conftest.$ac_ext
+EXEEXT=$ac_cv_exeext
+ac_exeext=$EXEEXT
+echo "$as_me:$LINENO: checking for suffix of object files" >&5
+echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6
+if test "${ac_cv_objext+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.o conftest.obj
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
+ for ac_file in `(ls conftest.o conftest.obj; ls conftest.*) 2>/dev/null`; do
+ case $ac_file in
+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg ) ;;
+ *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'`
+ break;;
+ esac
+done
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+{ { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot compute suffix of object files: cannot compile
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+
+rm -f conftest.$ac_cv_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_objext" >&5
+echo "${ECHO_T}$ac_cv_objext" >&6
+OBJEXT=$ac_cv_objext
+ac_objext=$OBJEXT
+echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5
+echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6
+if test "${ac_cv_c_compiler_gnu+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+#ifndef __GNUC__
+ choke me
+#endif
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_compiler_gnu=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_compiler_gnu=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+ac_cv_c_compiler_gnu=$ac_compiler_gnu
+
+fi
+echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5
+echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6
+GCC=`test $ac_compiler_gnu = yes && echo yes`
+ac_test_CFLAGS=${CFLAGS+set}
+ac_save_CFLAGS=$CFLAGS
+CFLAGS="-g"
+echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5
+echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6
+if test "${ac_cv_prog_cc_g+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_prog_cc_g=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_prog_cc_g=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5
+echo "${ECHO_T}$ac_cv_prog_cc_g" >&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
+echo "$as_me:$LINENO: checking for $CC option to accept ANSI C" >&5
+echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6
+if test "${ac_cv_prog_cc_stdc+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_cv_prog_cc_stdc=no
+ac_save_CC=$CC
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <stdarg.h>
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */
+struct buf { int x; };
+FILE * (*rcsopen) (struct buf *, struct stat *, int);
+static char *e (p, i)
+ char **p;
+ int i;
+{
+ return p[i];
+}
+static char *f (char * (*g) (char **, int), char **p, ...)
+{
+ char *s;
+ va_list v;
+ va_start (v,p);
+ s = g (p, va_arg (v,int));
+ va_end (v);
+ return s;
+}
+
+/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has
+ function prototypes and stuff, but not '\xHH' hex character constants.
+ These don't provoke an error unfortunately, instead are silently treated
+ as 'x'. The following induces an error, until -std1 is added to get
+ proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an
+ array size at least. It's necessary to write '\x00'==0 to get something
+ that's true only with -std1. */
+int osf4_cc_array ['\x00' == 0 ? 1 : -1];
+
+int test (int i, double x);
+struct s1 {int (*f) (int a);};
+struct s2 {int (*f) (double a);};
+int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
+int argc;
+char **argv;
+int
+main ()
+{
+return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1];
+ ;
+ return 0;
+}
+_ACEOF
+# Don't try gcc -ansi; that turns off useful extensions and
+# breaks some systems' header files.
+# AIX -qlanglvl=ansi
+# Ultrix and OSF/1 -std1
+# HP-UX 10.20 and later -Ae
+# HP-UX older versions -Aa -D_HPUX_SOURCE
+# SVR4 -Xc -D__EXTENSIONS__
+for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
+do
+ CC="$ac_save_CC $ac_arg"
+ rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_prog_cc_stdc=$ac_arg
+break
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext
+done
+rm -f conftest.$ac_ext conftest.$ac_objext
+CC=$ac_save_CC
+
+fi
+
+case "x$ac_cv_prog_cc_stdc" in
+ x|xno)
+ echo "$as_me:$LINENO: result: none needed" >&5
+echo "${ECHO_T}none needed" >&6 ;;
+ *)
+ echo "$as_me:$LINENO: result: $ac_cv_prog_cc_stdc" >&5
+echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6
+ CC="$CC $ac_cv_prog_cc_stdc" ;;
+esac
+
+# Some people use a C++ compiler to compile C. Since we use `exit',
+# in C++ we need to declare it. In case someone uses the same compiler
+# for both compiling C and C++ we need to have the C++ compiler decide
+# the declaration of exit, since it's the most demanding environment.
+cat >conftest.$ac_ext <<_ACEOF
+#ifndef __cplusplus
+ choke me
+#endif
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ for ac_declaration in \
+ '' \
+ 'extern "C" void std::exit (int) throw (); using std::exit;' \
+ 'extern "C" void std::exit (int); using std::exit;' \
+ 'extern "C" void exit (int) throw ();' \
+ 'extern "C" void exit (int);' \
+ 'void exit (int);'
+do
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_declaration
+#include <stdlib.h>
+int
+main ()
+{
+exit (42);
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ :
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+continue
fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_declaration
+int
+main ()
+{
+exit (42);
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ break
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+done
rm -f conftest*
-LIBS="$ac_save_LIBS"
+if test -n "$ac_declaration"; then
+ echo '#ifdef __cplusplus' >>confdefs.h
+ echo $ac_declaration >>confdefs.h
+ echo '#endif' >>confdefs.h
+fi
+
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
fi
-if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
- echo "$ac_t""yes" 1>&6
- LIBS="$LIBS -lcposix"
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+echo "$as_me:$LINENO: checking for library containing strerror" >&5
+echo $ECHO_N "checking for library containing strerror... $ECHO_C" >&6
+if test "${ac_cv_search_strerror+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
- echo "$ac_t""no" 1>&6
+ ac_func_search_save_LIBS=$LIBS
+ac_cv_search_strerror=no
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+/* Override any gcc2 internal prototype to avoid an error. */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* 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;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_search_strerror="none required"
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+if test "$ac_cv_search_strerror" = no; then
+ for ac_lib in cposix; do
+ LIBS="-l$ac_lib $ac_func_search_save_LIBS"
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+/* Override any gcc2 internal prototype to avoid an error. */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* 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;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_search_strerror="-l$ac_lib"
+break
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+ done
+fi
+LIBS=$ac_func_search_save_LIBS
fi
+echo "$as_me:$LINENO: result: $ac_cv_search_strerror" >&5
+echo "${ECHO_T}$ac_cv_search_strerror" >&6
+if test "$ac_cv_search_strerror" != no; then
+ test "$ac_cv_search_strerror" = "none required" || LIBS="$ac_cv_search_strerror $LIBS"
-
+fi
-am__api_version="1.4"
+am__api_version="1.9"
# 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:
@@ -775,348 +2655,742 @@ am__api_version="1.4"
# SunOS /usr/etc/install
# IRIX /sbin/install
# AIX /bin/install
+# AmigaOS /C/install, which installs bootblocks on floppy discs
# 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"
+# OS/2's system install, which has a completely different semantic
# ./install, which can be erroneously created by make from ./install.sh.
-echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6
-echo "configure:784: checking for a BSD compatible install" >&5
+echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5
+echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6
if test -z "$INSTALL"; then
-if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
+if test "${ac_cv_path_install+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&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
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ # Account for people who put trailing slashes in PATH elements.
+case $as_dir/ in
+ ./ | .// | /cC/* | \
+ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \
+ ?:\\/os2\\/install\\/* | ?:\\/OS2\\/INSTALL\\/* | \
+ /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
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then
if test $ac_prog = install &&
- grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then
+ grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
# AIX install. It has an incompatible calling convention.
:
+ elif test $ac_prog = install &&
+ grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
+ # program-specific install script used by HP pwplus--don't use.
+ :
else
- ac_cv_path_install="$ac_dir/$ac_prog -c"
- break 2
+ ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c"
+ break 3
fi
fi
done
- ;;
- esac
- done
- IFS="$ac_save_IFS"
+ done
+ ;;
+esac
+done
+
fi
if test "${ac_cv_path_install+set}" = set; then
- INSTALL="$ac_cv_path_install"
+ 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"
+ INSTALL=$ac_install_sh
fi
fi
-echo "$ac_t""$INSTALL" 1>&6
+echo "$as_me:$LINENO: result: $INSTALL" >&5
+echo "${ECHO_T}$INSTALL" >&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_SCRIPT" && INSTALL_SCRIPT='${INSTALL}'
test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
-echo $ac_n "checking whether build environment is sane""... $ac_c" 1>&6
-echo "configure:837: checking whether build environment is sane" >&5
+echo "$as_me:$LINENO: checking whether build environment is sane" >&5
+echo $ECHO_N "checking whether build environment is sane... $ECHO_C" >&6
# Just in case
sleep 1
-echo timestamp > conftestfile
+echo timestamp > conftest.file
# 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`
+ set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null`
if test "$*" = "X"; then
# -L didn't work.
- set X `ls -t $srcdir/configure conftestfile`
+ set X `ls -t $srcdir/configure conftest.file`
fi
- if test "$*" != "X $srcdir/configure conftestfile" \
- && test "$*" != "X conftestfile $srcdir/configure"; then
+ rm -f conftest.file
+ if test "$*" != "X $srcdir/configure conftest.file" \
+ && test "$*" != "X conftest.file $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; }
+ { { echo "$as_me:$LINENO: error: ls -t appears to fail. Make sure there is not a broken
+alias in your environment" >&5
+echo "$as_me: error: ls -t appears to fail. Make sure there is not a broken
+alias in your environment" >&2;}
+ { (exit 1); exit 1; }; }
fi
- test "$2" = conftestfile
+ test "$2" = conftest.file
)
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
+ { { echo "$as_me:$LINENO: error: newly created file is older than distributed files!
+Check your system clock" >&5
+echo "$as_me: error: newly created file is older than distributed files!
+Check your system clock" >&2;}
+ { (exit 1); exit 1; }; }
fi
+echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
test "$program_prefix" != NONE &&
- program_transform_name="s,^,${program_prefix},; $program_transform_name"
+ 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"
+ program_transform_name="s,\$,$program_suffix,;$program_transform_name"
+# Double any \ or $. echo might interpret backslashes.
+# By default was `s,x,x', remove it if useless.
+cat <<\_ACEOF >conftest.sed
+s/[\\$]/&&/g;s/;s,x,x,$//
+_ACEOF
+program_transform_name=`echo $program_transform_name | sed -f conftest.sed`
+rm conftest.sed
+
+# expand $ac_aux_dir to an absolute path
+am_aux_dir=`cd $ac_aux_dir && pwd`
+
+test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing"
+# Use eval to expand $SHELL
+if eval "$MISSING --run true"; then
+ am_missing_run="$MISSING --run "
+else
+ am_missing_run=
+ { echo "$as_me:$LINENO: WARNING: \`missing' script is too old or missing" >&5
+echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;}
+fi
+
+if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then
+ # We used to keeping the `.' as first argument, in order to
+ # allow $(mkdir_p) to be used without argument. As in
+ # $(mkdir_p) $(somedir)
+ # where $(somedir) is conditionally defined. However this is wrong
+ # for two reasons:
+ # 1. if the package is installed by a user who cannot write `.'
+ # make install will fail,
+ # 2. the above comment should most certainly read
+ # $(mkdir_p) $(DESTDIR)$(somedir)
+ # so it does not work when $(somedir) is undefined and
+ # $(DESTDIR) is not.
+ # To support the latter case, we have to write
+ # test -z "$(somedir)" || $(mkdir_p) $(DESTDIR)$(somedir),
+ # so the `.' trick is pointless.
+ mkdir_p='mkdir -p --'
+else
+ # On NextStep and OpenStep, the `mkdir' command does not
+ # recognize any option. It will interpret all options as
+ # directories to create, and then abort because `.' already
+ # exists.
+ for d in ./-p ./--version;
+ do
+ test -d $d && rmdir $d
+ done
+ # $(mkinstalldirs) is defined by Automake if mkinstalldirs exists.
+ if test -f "$ac_aux_dir/mkinstalldirs"; then
+ mkdir_p='$(mkinstalldirs)'
+ else
+ mkdir_p='$(install_sh) -d'
+ fi
+fi
-# sed with no file args requires a program.
-test "$program_transform_name" = "" && program_transform_name="s,x,x,"
+for ac_prog in gawk mawk nawk awk
+do
+ # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_AWK+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$AWK"; then
+ ac_cv_prog_AWK="$AWK" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_AWK="$ac_prog"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+
+fi
+fi
+AWK=$ac_cv_prog_AWK
+if test -n "$AWK"; then
+ echo "$as_me:$LINENO: result: $AWK" >&5
+echo "${ECHO_T}$AWK" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+ test -n "$AWK" && break
+done
-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
+echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \$(MAKE)" >&5
+echo $ECHO_N "checking whether ${MAKE-make} sets \$(MAKE)... $ECHO_C" >&6
+set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y,:./+-,___p_,'`
+if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\" = set"; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
- cat > conftestmake <<\EOF
+ cat >conftest.make <<\_ACEOF
all:
- @echo 'ac_maketemp="${MAKE}"'
-EOF
+ @echo 'ac_maketemp="$(MAKE)"'
+_ACEOF
# GNU make sometimes prints "make[1]: Entering...", which would confuse us.
-eval `${MAKE-make} -f conftestmake 2>/dev/null | grep temp=`
+eval `${MAKE-make} -f conftest.make 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
+rm -f conftest.make
fi
if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then
- echo "$ac_t""yes" 1>&6
+ echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
SET_MAKE=
else
- echo "$ac_t""no" 1>&6
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
SET_MAKE="MAKE=${MAKE-make}"
fi
+rm -rf .tst 2>/dev/null
+mkdir .tst 2>/dev/null
+if test -d .tst; then
+ am__leading_dot=.
+else
+ am__leading_dot=_
+fi
+rmdir .tst 2>/dev/null
+
+DEPDIR="${am__leading_dot}deps"
+
+ ac_config_commands="$ac_config_commands depfiles"
+
+
+am_make=${MAKE-make}
+cat > confinc << 'END'
+am__doit:
+ @echo done
+.PHONY: am__doit
+END
+# If we don't find an include directive, just comment out the code.
+echo "$as_me:$LINENO: checking for style of include used by $am_make" >&5
+echo $ECHO_N "checking for style of include used by $am_make... $ECHO_C" >&6
+am__include="#"
+am__quote=
+_am_result=none
+# First try GNU make style include.
+echo "include confinc" > confmf
+# We grep out `Entering directory' and `Leaving directory'
+# messages which can occur if `w' ends up in MAKEFLAGS.
+# In particular we don't look at `^make:' because GNU make might
+# be invoked under some other name (usually "gmake"), in which
+# case it prints its new name instead of `make'.
+if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then
+ am__include=include
+ am__quote=
+ _am_result=GNU
+fi
+# Now try BSD make style include.
+if test "$am__include" = "#"; then
+ echo '.include "confinc"' > confmf
+ if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then
+ am__include=.include
+ am__quote="\""
+ _am_result=BSD
+ fi
+fi
+
-PACKAGE=bfd
+echo "$as_me:$LINENO: result: $_am_result" >&5
+echo "${ECHO_T}$_am_result" >&6
+rm -f confinc confmf
-VERSION=2.15
+# Check whether --enable-dependency-tracking or --disable-dependency-tracking was given.
+if test "${enable_dependency_tracking+set}" = set; then
+ enableval="$enable_dependency_tracking"
-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;
+if test "x$enable_dependency_tracking" != xno; then
+ am_depcomp="$ac_aux_dir/depcomp"
+ AMDEPBACKSLASH='\'
fi
-cat >> confdefs.h <<EOF
+
+
+if test "x$enable_dependency_tracking" != xno; then
+ AMDEP_TRUE=
+ AMDEP_FALSE='#'
+else
+ AMDEP_TRUE='#'
+ AMDEP_FALSE=
+fi
+
+
+
+# test to see if srcdir already configured
+if test "`cd $srcdir && pwd`" != "`pwd`" &&
+ test -f $srcdir/config.status; then
+ { { echo "$as_me:$LINENO: error: source directory already configured; run \"make distclean\" there first" >&5
+echo "$as_me: error: source directory already configured; run \"make distclean\" there first" >&2;}
+ { (exit 1); exit 1; }; }
+fi
+
+# test whether we have cygpath
+if test -z "$CYGPATH_W"; then
+ if (cygpath --version) >/dev/null 2>/dev/null; then
+ CYGPATH_W='cygpath -w'
+ else
+ CYGPATH_W=echo
+ fi
+fi
+
+
+# Define the identity of the package.
+ PACKAGE=bfd
+ VERSION=2.17.50
+
+
+cat >>confdefs.h <<_ACEOF
#define PACKAGE "$PACKAGE"
-EOF
+_ACEOF
+
-cat >> confdefs.h <<EOF
+cat >>confdefs.h <<_ACEOF
#define VERSION "$VERSION"
-EOF
+_ACEOF
+# Some tools Automake needs.
+ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"}
-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
+
+AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"}
+
+
+AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"}
+
+
+AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"}
+
+
+MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"}
+
+install_sh=${install_sh-"$am_aux_dir/install-sh"}
+
+# Installed binaries are usually stripped using `strip' when the user
+# run `make install-strip'. However `strip' might not be the right
+# tool to use in cross-compilation environments, therefore Automake
+# will honor the `STRIP' environment variable to overrule this program.
+if test "$cross_compiling" != no; then
+ if test -n "$ac_tool_prefix"; then
+ # 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 "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_STRIP+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
- ACLOCAL="$missing_dir/missing aclocal-${am__api_version}"
- echo "$ac_t""missing" 1>&6
-fi
+ if test -n "$STRIP"; then
+ ac_cv_prog_STRIP="$STRIP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_STRIP="${ac_tool_prefix}strip"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
-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
+fi
+fi
+STRIP=$ac_cv_prog_STRIP
+if test -n "$STRIP"; then
+ echo "$as_me:$LINENO: result: $STRIP" >&5
+echo "${ECHO_T}$STRIP" >&6
else
- AUTOCONF="$missing_dir/missing autoconf"
- echo "$ac_t""missing" 1>&6
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&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
+if test -z "$ac_cv_prog_STRIP"; then
+ ac_ct_STRIP=$STRIP
+ # Extract the first word of "strip", so it can be a program name with args.
+set dummy strip; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$ac_ct_STRIP"; then
+ ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_STRIP="strip"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
-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
+ test -z "$ac_cv_prog_ac_ct_STRIP" && ac_cv_prog_ac_ct_STRIP=":"
+fi
+fi
+ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP
+if test -n "$ac_ct_STRIP"; then
+ echo "$as_me:$LINENO: result: $ac_ct_STRIP" >&5
+echo "${ECHO_T}$ac_ct_STRIP" >&6
else
- AUTOHEADER="$missing_dir/missing autoheader"
- echo "$ac_t""missing" 1>&6
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&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
+ STRIP=$ac_ct_STRIP
else
- MAKEINFO="$missing_dir/missing makeinfo"
- echo "$ac_t""missing" 1>&6
+ STRIP="$ac_cv_prog_STRIP"
fi
+fi
+INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s"
+
+# We need awk for the "check" target. The system "awk" is bad on
+# some platforms.
+# Always define AMTAR for backward compatibility.
+
+AMTAR=${AMTAR-"${am_missing_run}tar"}
+
+am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'
+
+
-# 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/'`
+depcc="$CC" am_compiler_list=
-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}\""
+echo "$as_me:$LINENO: checking dependency style of $depcc" >&5
+echo $ECHO_N "checking dependency style of $depcc... $ECHO_C" >&6
+if test "${am_cv_CC_dependencies_compiler_type+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
+ # We make a subdir and do the tests there. Otherwise we can end up
+ # making bogus files that we don't know about and never remove. For
+ # instance it was reported that on HP-UX the gcc test will end up
+ # making a dummy file named `D' -- because `-MD' means `put the output
+ # in D'.
+ mkdir conftest.dir
+ # Copy depcomp to subdir because otherwise we won't find it if we're
+ # using a relative directory.
+ cp "$am_depcomp" conftest.dir
+ cd conftest.dir
+ # We will build objects and dependencies in a subdirectory because
+ # it helps to detect inapplicable dependency modes. For instance
+ # both Tru64's cc and ICC support -MD to output dependencies as a
+ # side effect of compilation, but ICC will put the dependencies in
+ # the current directory while Tru64 will put them in the object
+ # directory.
+ mkdir sub
+
+ am_cv_CC_dependencies_compiler_type=none
+ if test "$am_compiler_list" = ""; then
+ am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp`
+ fi
+ for depmode in $am_compiler_list; do
+ # Setup a source with many dependencies, because some compilers
+ # like to wrap large dependency lists on column 80 (with \), and
+ # we should not choose a depcomp mode which is confused by this.
+ #
+ # We need to recreate these files for each test, as the compiler may
+ # overwrite some of them when testing with obscure command lines.
+ # This happens at least with the AIX C compiler.
+ : > sub/conftest.c
+ for i in 1 2 3 4 5 6; do
+ echo '#include "conftst'$i'.h"' >> sub/conftest.c
+ # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
+ # Solaris 8's {/usr,}/bin/sh.
+ touch sub/conftst$i.h
+ done
+ echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
+
+ case $depmode in
+ nosideeffect)
+ # after this tag, mechanisms are not by side-effect, so they'll
+ # only be used when explicitly requested
+ if test "x$enable_dependency_tracking" = xyes; then
+ continue
+ else
+ break
+ fi
+ ;;
+ none) break ;;
+ esac
+ # We check with `-c' and `-o' for the sake of the "dashmstdout"
+ # mode. It turns out that the SunPro C++ compiler does not properly
+ # handle `-M -o', and we need to detect this.
+ if depmode=$depmode \
+ source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \
+ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
+ $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \
+ >/dev/null 2>conftest.err &&
+ grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
+ grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 &&
+ ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
+ # icc doesn't choke on unknown options, it will just issue warnings
+ # or remarks (even with -Werror). So we grep stderr for any message
+ # that says an option was ignored or not supported.
+ # When given -MP, icc 7.0 and 7.1 complain thusly:
+ # icc: Command line warning: ignoring option '-M'; no argument required
+ # The diagnosis changed in icc 8.0:
+ # icc: Command line remark: option '-MP' not supported
+ if (grep 'ignoring option' conftest.err ||
+ grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
+ am_cv_CC_dependencies_compiler_type=$depmode
+ break
+ fi
+ fi
+ done
+
+ cd ..
+ rm -rf conftest.dir
+else
+ am_cv_CC_dependencies_compiler_type=none
fi
+fi
+echo "$as_me:$LINENO: result: $am_cv_CC_dependencies_compiler_type" >&5
+echo "${ECHO_T}$am_cv_CC_dependencies_compiler_type" >&6
+CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type
-if test $host != $build; then
- ac_tool_prefix=${host_alias}-
+
+if
+ test "x$enable_dependency_tracking" != xno \
+ && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then
+ am__fastdepCC_TRUE=
+ am__fastdepCC_FALSE='#'
else
- ac_tool_prefix=
+ am__fastdepCC_TRUE='#'
+ am__fastdepCC_FALSE=
fi
-# Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args.
+
+
+
+if test -n "$ac_tool_prefix"; then
+ # 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
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_AR+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&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"
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_AR="${ac_tool_prefix}ar"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+
fi
fi
-AR="$ac_cv_prog_AR"
+AR=$ac_cv_prog_AR
if test -n "$AR"; then
- echo "$ac_t""$AR" 1>&6
+ echo "$as_me:$LINENO: result: $AR" >&5
+echo "${ECHO_T}$AR" >&6
else
- echo "$ac_t""no" 1>&6
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
fi
+fi
+if test -z "$ac_cv_prog_AR"; then
+ ac_ct_AR=$AR
+ # Extract the first word of "ar", so it can be a program name with args.
+set dummy ar; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_ac_ct_AR+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$ac_ct_AR"; then
+ ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_AR="ar"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+fi
+fi
+ac_ct_AR=$ac_cv_prog_ac_ct_AR
+if test -n "$ac_ct_AR"; then
+ echo "$as_me:$LINENO: result: $ac_ct_AR" >&5
+echo "${ECHO_T}$ac_ct_AR" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+ AR=$ac_ct_AR
+else
+ AR="$ac_cv_prog_AR"
+fi
-# Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args.
+if test -n "$ac_tool_prefix"; then
+ # 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
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_RANLIB+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&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"
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+
fi
fi
-RANLIB="$ac_cv_prog_RANLIB"
+RANLIB=$ac_cv_prog_RANLIB
if test -n "$RANLIB"; then
- echo "$ac_t""$RANLIB" 1>&6
+ echo "$as_me:$LINENO: result: $RANLIB" >&5
+echo "${ECHO_T}$RANLIB" >&6
else
- echo "$ac_t""no" 1>&6
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
fi
-
+fi
if test -z "$ac_cv_prog_RANLIB"; then
-if test -n "$ac_tool_prefix"; then
+ ac_ct_RANLIB=$RANLIB
# 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
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
- if test -n "$RANLIB"; then
- ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test.
+ if test -n "$ac_ct_RANLIB"; then
+ ac_cv_prog_ac_ct_RANLIB="$ac_ct_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=":"
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_RANLIB="ranlib"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+
+ test -z "$ac_cv_prog_ac_ct_RANLIB" && ac_cv_prog_ac_ct_RANLIB=":"
fi
fi
-RANLIB="$ac_cv_prog_RANLIB"
-if test -n "$RANLIB"; then
- echo "$ac_t""$RANLIB" 1>&6
+ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB
+if test -n "$ac_ct_RANLIB"; then
+ echo "$as_me:$LINENO: result: $ac_ct_RANLIB" >&5
+echo "${ECHO_T}$ac_ct_RANLIB" >&6
else
- echo "$ac_t""no" 1>&6
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
fi
+ RANLIB=$ac_ct_RANLIB
else
- RANLIB=":"
-fi
+ RANLIB="$ac_cv_prog_RANLIB"
fi
@@ -1124,280 +3398,486 @@ fi
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
+ 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.
+ lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+ for pkg in $enableval; do
+ IFS="$lt_save_ifs"
+ if test "X$pkg" = "X$p"; then
+ enable_shared=yes
+ fi
+ done
+ IFS="$lt_save_ifs"
+ ;;
+ esac
else
enable_shared=no
+fi;
+
+
+
+
+
+
+
+
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args.
+set dummy ${ac_tool_prefix}gcc; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_CC+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_CC="${ac_tool_prefix}gcc"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+ echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
fi
+fi
+if test -z "$ac_cv_prog_CC"; then
+ ac_ct_CC=$CC
+ # Extract the first word of "gcc", so it can be a program name with args.
+set dummy gcc; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$ac_ct_CC"; then
+ ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_CC="gcc"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
-# 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
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+ echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
+echo "${ECHO_T}$ac_ct_CC" >&6
else
- enable_static=yes
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
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
+ CC=$ac_ct_CC
else
- enable_fast_install=yes
+ CC="$ac_cv_prog_CC"
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
+if test -z "$CC"; then
+ if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args.
+set dummy ${ac_tool_prefix}cc; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_CC+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&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"
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_CC="${ac_tool_prefix}cc"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+
fi
fi
-CC="$ac_cv_prog_CC"
+CC=$ac_cv_prog_CC
if test -n "$CC"; then
- echo "$ac_t""$CC" 1>&6
+ echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6
else
- echo "$ac_t""no" 1>&6
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
fi
+fi
+if test -z "$ac_cv_prog_CC"; then
+ ac_ct_CC=$CC
+ # Extract the first word of "cc", so it can be a program name with args.
+set dummy cc; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$ac_ct_CC"; then
+ ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_CC="cc"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+ echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
+echo "${ECHO_T}$ac_ct_CC" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+ CC=$ac_ct_CC
+else
+ CC="$ac_cv_prog_CC"
+fi
+
+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
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_CC+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&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"
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then
+ ac_prog_rejected=yes
+ continue
+ fi
+ ac_cv_prog_CC="cc"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+
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
+ if test $# != 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="$@"
+ ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@"
fi
fi
fi
fi
-CC="$ac_cv_prog_CC"
+CC=$ac_cv_prog_CC
if test -n "$CC"; then
- echo "$ac_t""$CC" 1>&6
+ echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6
else
- echo "$ac_t""no" 1>&6
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&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
+fi
+if test -z "$CC"; then
+ if test -n "$ac_tool_prefix"; then
+ for ac_prog in cl
+ do
+ # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
+set dummy $ac_tool_prefix$ac_prog; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_CC+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&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"
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_CC="$ac_tool_prefix$ac_prog"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+
fi
fi
-CC="$ac_cv_prog_CC"
+CC=$ac_cv_prog_CC
if test -n "$CC"; then
- echo "$ac_t""$CC" 1>&6
+ echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&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; }
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
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
+ test -n "$CC" && break
+ done
+fi
+if test -z "$CC"; then
+ ac_ct_CC=$CC
+ for ac_prog in cl
+do
+ # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$ac_ct_CC"; then
+ ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_CC="$ac_prog"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
-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
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+ echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
+echo "${ECHO_T}$ac_ct_CC" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
-cat > conftest.$ac_ext << EOF
+ test -n "$ac_ct_CC" && break
+done
-#line 1321 "configure"
-#include "confdefs.h"
+ CC=$ac_ct_CC
+fi
+
+fi
+
+
+test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH
+See \`config.log' for more details." >&5
+echo "$as_me: error: no acceptable C compiler found in \$PATH
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; }
+
+# Provide some information about the compiler.
+echo "$as_me:$LINENO:" \
+ "checking for C compiler version" >&5
+ac_compiler=`set X $ac_compile; echo $2`
+{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version </dev/null >&5\"") >&5
+ (eval $ac_compiler --version </dev/null >&5) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }
+{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v </dev/null >&5\"") >&5
+ (eval $ac_compiler -v </dev/null >&5) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }
+{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V </dev/null >&5\"") >&5
+ (eval $ac_compiler -V </dev/null >&5) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }
+
+echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5
+echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6
+if test "${ac_cv_c_compiler_gnu+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end 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;
+int
+main ()
+{
+#ifndef __GNUC__
+ choke me
#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
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_compiler_gnu=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_compiler_gnu=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+ac_cv_c_compiler_gnu=$ac_compiler_gnu
+
+fi
+echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5
+echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6
+GCC=`test $ac_compiler_gnu = yes && echo yes`
+ac_test_CFLAGS=${CFLAGS+set}
+ac_save_CFLAGS=$CFLAGS
+CFLAGS="-g"
+echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5
+echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6
+if test "${ac_cv_prog_cc_g+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
-if test $ac_cv_prog_gcc = yes; then
- GCC=yes
-else
- GCC=
-fi
+int
+main ()
+{
-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
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
ac_cv_prog_cc_g=yes
else
- ac_cv_prog_cc_g=no
-fi
-rm -f conftest*
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+ac_cv_prog_cc_g=no
fi
-
-echo "$ac_t""$ac_cv_prog_cc_g" 1>&6
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5
+echo "${ECHO_T}$ac_cv_prog_cc_g" >&6
if test "$ac_test_CFLAGS" = set; then
- CFLAGS="$ac_save_CFLAGS"
+ CFLAGS=$ac_save_CFLAGS
elif test $ac_cv_prog_cc_g = yes; then
if test "$GCC" = yes; then
CFLAGS="-g -O2"
@@ -1411,6 +3891,504 @@ else
CFLAGS=
fi
fi
+echo "$as_me:$LINENO: checking for $CC option to accept ANSI C" >&5
+echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6
+if test "${ac_cv_prog_cc_stdc+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_cv_prog_cc_stdc=no
+ac_save_CC=$CC
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <stdarg.h>
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */
+struct buf { int x; };
+FILE * (*rcsopen) (struct buf *, struct stat *, int);
+static char *e (p, i)
+ char **p;
+ int i;
+{
+ return p[i];
+}
+static char *f (char * (*g) (char **, int), char **p, ...)
+{
+ char *s;
+ va_list v;
+ va_start (v,p);
+ s = g (p, va_arg (v,int));
+ va_end (v);
+ return s;
+}
+
+/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has
+ function prototypes and stuff, but not '\xHH' hex character constants.
+ These don't provoke an error unfortunately, instead are silently treated
+ as 'x'. The following induces an error, until -std1 is added to get
+ proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an
+ array size at least. It's necessary to write '\x00'==0 to get something
+ that's true only with -std1. */
+int osf4_cc_array ['\x00' == 0 ? 1 : -1];
+
+int test (int i, double x);
+struct s1 {int (*f) (int a);};
+struct s2 {int (*f) (double a);};
+int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
+int argc;
+char **argv;
+int
+main ()
+{
+return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1];
+ ;
+ return 0;
+}
+_ACEOF
+# Don't try gcc -ansi; that turns off useful extensions and
+# breaks some systems' header files.
+# AIX -qlanglvl=ansi
+# Ultrix and OSF/1 -std1
+# HP-UX 10.20 and later -Ae
+# HP-UX older versions -Aa -D_HPUX_SOURCE
+# SVR4 -Xc -D__EXTENSIONS__
+for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
+do
+ CC="$ac_save_CC $ac_arg"
+ rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_prog_cc_stdc=$ac_arg
+break
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext
+done
+rm -f conftest.$ac_ext conftest.$ac_objext
+CC=$ac_save_CC
+
+fi
+
+case "x$ac_cv_prog_cc_stdc" in
+ x|xno)
+ echo "$as_me:$LINENO: result: none needed" >&5
+echo "${ECHO_T}none needed" >&6 ;;
+ *)
+ echo "$as_me:$LINENO: result: $ac_cv_prog_cc_stdc" >&5
+echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6
+ CC="$CC $ac_cv_prog_cc_stdc" ;;
+esac
+
+# Some people use a C++ compiler to compile C. Since we use `exit',
+# in C++ we need to declare it. In case someone uses the same compiler
+# for both compiling C and C++ we need to have the C++ compiler decide
+# the declaration of exit, since it's the most demanding environment.
+cat >conftest.$ac_ext <<_ACEOF
+#ifndef __cplusplus
+ choke me
+#endif
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ for ac_declaration in \
+ '' \
+ 'extern "C" void std::exit (int) throw (); using std::exit;' \
+ 'extern "C" void std::exit (int); using std::exit;' \
+ 'extern "C" void exit (int) throw ();' \
+ 'extern "C" void exit (int);' \
+ 'void exit (int);'
+do
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_declaration
+#include <stdlib.h>
+int
+main ()
+{
+exit (42);
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ :
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+continue
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_declaration
+int
+main ()
+{
+exit (42);
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ break
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+done
+rm -f conftest*
+if test -n "$ac_declaration"; then
+ echo '#ifdef __cplusplus' >>confdefs.h
+ echo $ac_declaration >>confdefs.h
+ echo '#endif' >>confdefs.h
+fi
+
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+cat >>confdefs.h <<\_ACEOF
+#define _GNU_SOURCE 1
+_ACEOF
+
+
+
+
+
+macro_version='2.1a'
+macro_revision='1.2435'
+
+
+
+
+
+
+
+
+
+
+
+
+ltmain="$ac_aux_dir/ltmain.sh"
+
+# Set options
+
+enable_dlopen=no
+
+
+enable_win32_dll=no
+
+
+
+# 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.
+ lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+ for pkg in $enableval; do
+ IFS="$lt_save_ifs"
+ if test "X$pkg" = "X$p"; then
+ enable_static=yes
+ fi
+ done
+ IFS="$lt_save_ifs"
+ ;;
+ esac
+else
+ enable_static=yes
+fi;
+
+
+
+
+
+
+
+
+
+# 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 -z "$pic_mode" && pic_mode=default
+
+
+
+
+
+
+
+# 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.
+ lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+ for pkg in $enableval; do
+ IFS="$lt_save_ifs"
+ if test "X$pkg" = "X$p"; then
+ enable_fast_install=yes
+ fi
+ done
+ IFS="$lt_save_ifs"
+ ;;
+ esac
+else
+ enable_fast_install=yes
+fi;
+
+
+
+
+
+
+
+
+echo "$as_me:$LINENO: checking for a sed that does not truncate output" >&5
+echo $ECHO_N "checking for a sed that does not truncate output... $ECHO_C" >&6
+if test "${lt_cv_path_SED+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ # Loop through the user's path and test for sed and gsed.
+# Then use that list of sed's as ones to test for truncation.
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for lt_ac_prog in sed gsed; do
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$lt_ac_prog$ac_exec_ext"; then
+ lt_ac_sed_list="$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext"
+ fi
+ done
+ done
+done
+IFS=$as_save_IFS
+lt_ac_max=0
+lt_ac_count=0
+# Add /usr/xpg4/bin/sed as it is typically found on Solaris
+# along with /bin/sed that truncates output.
+for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do
+ test ! -f $lt_ac_sed && continue
+ cat /dev/null > conftest.in
+ lt_ac_count=0
+ echo $ECHO_N "0123456789$ECHO_C" >conftest.in
+ # Check for GNU sed and select it if it is found.
+ if "$lt_ac_sed" --version 2>&1 < /dev/null | grep 'GNU' > /dev/null; then
+ lt_cv_path_SED=$lt_ac_sed
+ break
+ fi
+ while true; do
+ cat conftest.in conftest.in >conftest.tmp
+ mv conftest.tmp conftest.in
+ cp conftest.in conftest.nl
+ echo >>conftest.nl
+ $lt_ac_sed -e 's/a$//' < conftest.nl >conftest.out || break
+ cmp -s conftest.out conftest.nl || break
+ # 10000 chars as input seems more than enough
+ test $lt_ac_count -gt 10 && break
+ lt_ac_count=`expr $lt_ac_count + 1`
+ if test $lt_ac_count -gt $lt_ac_max; then
+ lt_ac_max=$lt_ac_count
+ lt_cv_path_SED=$lt_ac_sed
+ fi
+ done
+done
+
+fi
+
+SED=$lt_cv_path_SED
+
+echo "$as_me:$LINENO: result: $SED" >&5
+echo "${ECHO_T}$SED" >&6
+
+test -z "$SED" && SED=sed
+Xsed="$SED -e 1s/^X//"
+
+
+
+
+
+
+
+
+
+
+
+echo "$as_me:$LINENO: checking for egrep" >&5
+echo $ECHO_N "checking for egrep... $ECHO_C" >&6
+if test "${ac_cv_prog_egrep+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if echo a | (grep -E '(a|b)') >/dev/null 2>&1
+ then ac_cv_prog_egrep='grep -E'
+ else ac_cv_prog_egrep='egrep'
+ fi
+fi
+echo "$as_me:$LINENO: result: $ac_cv_prog_egrep" >&5
+echo "${ECHO_T}$ac_cv_prog_egrep" >&6
+ EGREP=$ac_cv_prog_egrep
+
+
+echo "$as_me:$LINENO: checking for fgrep" >&5
+echo $ECHO_N "checking for fgrep... $ECHO_C" >&6
+if test "${ac_cv_prog_fgrep+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if echo 'ab*c' | (grep -F 'ab*c') >/dev/null 2>&1
+ then ac_cv_prog_fgrep='grep -F'
+ else ac_cv_prog_fgrep='fgrep'
+ fi
+fi
+echo "$as_me:$LINENO: result: $ac_cv_prog_fgrep" >&5
+echo "${ECHO_T}$ac_cv_prog_fgrep" >&6
+ FGREP=$ac_cv_prog_fgrep
+
+
+test -z "$GREP" && GREP=grep
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
# Check whether --with-gnu-ld or --without-gnu-ld was given.
if test "${with_gnu_ld+set}" = set; then
@@ -1418,13 +4396,12 @@ if test "${with_gnu_ld+set}" = set; then
test "$withval" = no || with_gnu_ld=yes
else
with_gnu_ld=no
-fi
-
+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
+ echo "$as_me:$LINENO: checking for ld used by $CC" >&5
+echo $ECHO_N "checking for ld used by $CC... $ECHO_C" >&6
case $host in
*-*-mingw*)
# gcc leaves a trailing carriage return which upsets mingw
@@ -1434,12 +4411,12 @@ echo "configure:1428: checking for ld used by GCC" >&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%/%"`
+ # Canonicalize the pathname 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"
;;
@@ -1453,32 +4430,36 @@ echo "configure:1428: checking for ld used by GCC" >&5
;;
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
+ echo "$as_me:$LINENO: checking for GNU ld" >&5
+echo $ECHO_N "checking for GNU ld... $ECHO_C" >&6
else
- echo $ac_n "checking for non-GNU ld""... $ac_c" 1>&6
-echo "configure:1461: checking for non-GNU ld" >&5
+ echo "$as_me:$LINENO: checking for non-GNU ld" >&5
+echo $ECHO_N "checking for non-GNU ld... $ECHO_C" >&6
fi
-if eval "test \"`echo '$''{'lt_cv_path_LD'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
+if test "${lt_cv_path_LD+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
if test -z "$LD"; then
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
+ lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
for ac_dir in $PATH; do
+ IFS="$lt_save_ifs"
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.
+ # but apparently some variants of GNU ld 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
+ case `"$lt_cv_path_LD" -v 2>&1 </dev/null` in
+ *GNU* | *'with BFD'*)
test "$with_gnu_ld" != no && break
- else
+ ;;
+ *)
test "$with_gnu_ld" != yes && break
- fi
+ ;;
+ esac
fi
done
- IFS="$ac_save_ifs"
+ IFS="$lt_save_ifs"
else
lt_cv_path_LD="$LD" # Let the user override the test with a path.
fi
@@ -1486,103 +4467,461 @@ 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
+ echo "$as_me:$LINENO: result: $LD" >&5
+echo "${ECHO_T}$LD" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+test -z "$LD" && { { echo "$as_me:$LINENO: error: no acceptable ld found in \$PATH" >&5
+echo "$as_me: error: no acceptable ld found in \$PATH" >&2;}
+ { (exit 1); exit 1; }; }
+echo "$as_me:$LINENO: checking if the linker ($LD) is GNU ld" >&5
+echo $ECHO_N "checking if the linker ($LD) is GNU ld... $ECHO_C" >&6
+if test "${lt_cv_prog_gnu_ld+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ # I'd rather use --version here, but apparently some GNU lds only accept -v.
+case `$LD -v 2>&1 </dev/null` in
+*GNU* | *'with BFD'*)
lt_cv_prog_gnu_ld=yes
-else
+ ;;
+*)
lt_cv_prog_gnu_ld=no
+ ;;
+esac
fi
-fi
-
-echo "$ac_t""$lt_cv_prog_gnu_ld" 1>&6
+echo "$as_me:$LINENO: result: $lt_cv_prog_gnu_ld" >&5
+echo "${ECHO_T}$lt_cv_prog_gnu_ld" >&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
+
+
+
+
+
+
+echo "$as_me:$LINENO: checking for BSD- or MS-compatible name lister (nm)" >&5
+echo $ECHO_N "checking for BSD- or MS-compatible name lister (nm)... $ECHO_C" >&6
+if test "${lt_cv_path_NM+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&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
+ lt_nm_to_check="${ac_tool_prefix}nm"
+ if test -n "$ac_tool_prefix" && test "$build" = "$host"; then
+ lt_nm_to_check="$lt_nm_to_check nm"
+ fi
+ for lt_tmp_nm in $lt_nm_to_check; do
+ lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+ for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do
+ IFS="$lt_save_ifs"
+ test -z "$ac_dir" && ac_dir=.
+ tmp_nm="$ac_dir/$lt_tmp_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
+ case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in
+ */dev/null* | *'Invalid file or object type'*)
+ lt_cv_path_NM="$tmp_nm -B"
+ break
+ ;;
+ *)
+ case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in
+ */dev/null*)
+ lt_cv_path_NM="$tmp_nm -p"
+ break
+ ;;
+ *)
+ 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
+ ;;
+ esac
+ ;;
+ esac
fi
- fi
+ done
+ IFS="$lt_save_ifs"
done
- IFS="$ac_save_ifs"
- test -z "$lt_cv_path_NM" && lt_cv_path_NM=nm
+ : ${lt_cv_path_NM=no}
+fi
+fi
+echo "$as_me:$LINENO: result: $lt_cv_path_NM" >&5
+echo "${ECHO_T}$lt_cv_path_NM" >&6
+if test "$lt_cv_path_NM" != "no"; then
+ NM="$lt_cv_path_NM"
+else
+ # Didn't find any BSD compatible name lister, look for dumpbin.
+ if test -n "$ac_tool_prefix"; then
+ for ac_prog in "dumpbin -symbols" "link -dump -symbols"
+ do
+ # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
+set dummy $ac_tool_prefix$ac_prog; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_DUMPBIN+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$DUMPBIN"; then
+ ac_cv_prog_DUMPBIN="$DUMPBIN" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_DUMPBIN="$ac_tool_prefix$ac_prog"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+
+fi
fi
+DUMPBIN=$ac_cv_prog_DUMPBIN
+if test -n "$DUMPBIN"; then
+ echo "$as_me:$LINENO: result: $DUMPBIN" >&5
+echo "${ECHO_T}$DUMPBIN" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
fi
-NM="$lt_cv_path_NM"
-echo "$ac_t""$NM" 1>&6
+ test -n "$DUMPBIN" && break
+ done
+fi
+if test -z "$DUMPBIN"; then
+ ac_ct_DUMPBIN=$DUMPBIN
+ for ac_prog in "dumpbin -symbols" "link -dump -symbols"
+do
+ # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_ac_ct_DUMPBIN+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$ac_ct_DUMPBIN"; then
+ ac_cv_prog_ac_ct_DUMPBIN="$ac_ct_DUMPBIN" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_DUMPBIN="$ac_prog"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
-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
+fi
+fi
+ac_ct_DUMPBIN=$ac_cv_prog_ac_ct_DUMPBIN
+if test -n "$ac_ct_DUMPBIN"; then
+ echo "$as_me:$LINENO: result: $ac_ct_DUMPBIN" >&5
+echo "${ECHO_T}$ac_ct_DUMPBIN" >&6
else
- rm -f conftestdata
-if ln -s X conftestdata 2>/dev/null
-then
- rm -f conftestdata
- ac_cv_prog_LN_S="ln -s"
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+ test -n "$ac_ct_DUMPBIN" && break
+done
+test -n "$ac_ct_DUMPBIN" || ac_ct_DUMPBIN=":"
+
+ DUMPBIN=$ac_ct_DUMPBIN
+fi
+
+
+ if test "$DUMPBIN" != ":"; then
+ NM="$DUMPBIN"
+ fi
+fi
+test -z "$NM" && NM=nm
+
+
+
+
+
+
+echo "$as_me:$LINENO: checking the name lister ($NM) interface" >&5
+echo $ECHO_N "checking the name lister ($NM) interface... $ECHO_C" >&6
+if test "${lt_cv_nm_interface+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ lt_cv_nm_interface="BSD nm"
+ echo "int some_variable = 0;" > conftest.$ac_ext
+ (eval echo "\"\$as_me:4668: $ac_compile\"" >&5)
+ (eval "$ac_compile" 2>conftest.err)
+ cat conftest.err >&5
+ (eval echo "\"\$as_me:4671: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
+ (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out)
+ cat conftest.err >&5
+ (eval echo "\"\$as_me:4674: output\"" >&5)
+ cat conftest.out >&5
+ if $GREP 'External.*some_variable' conftest.out > /dev/null; then
+ lt_cv_nm_interface="MS dumpbin"
+ fi
+ rm -f conftest*
+fi
+echo "$as_me:$LINENO: result: $lt_cv_nm_interface" >&5
+echo "${ECHO_T}$lt_cv_nm_interface" >&6
+
+echo "$as_me:$LINENO: checking whether ln -s works" >&5
+echo $ECHO_N "checking whether ln -s works... $ECHO_C" >&6
+LN_S=$as_ln_s
+if test "$LN_S" = "ln -s"; then
+ echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
else
- ac_cv_prog_LN_S=ln
+ echo "$as_me:$LINENO: result: no, using $LN_S" >&5
+echo "${ECHO_T}no, using $LN_S" >&6
fi
+
+# find the maximum length of command line arguments
+echo "$as_me:$LINENO: checking the maximum length of command line arguments" >&5
+echo $ECHO_N "checking the maximum length of command line arguments... $ECHO_C" >&6
+if test "${lt_cv_sys_max_cmd_len+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ i=0
+ teststring="ABCD"
+
+ case $build_os in
+ msdosdjgpp*)
+ # On DJGPP, this test can blow up pretty badly due to problems in libc
+ # (any single argument exceeding 2000 bytes causes a buffer overrun
+ # during glob expansion). Even if it were fixed, the result of this
+ # check would be larger than it should be.
+ lt_cv_sys_max_cmd_len=12288; # 12K is about right
+ ;;
+
+ gnu*)
+ # Under GNU Hurd, this test is not required because there is
+ # no limit to the length of command line arguments.
+ # Libtool will interpret -1 as no limit whatsoever
+ lt_cv_sys_max_cmd_len=-1;
+ ;;
+
+ cygwin* | mingw*)
+ # On Win9x/ME, this test blows up -- it succeeds, but takes
+ # about 5 minutes as the teststring grows exponentially.
+ # Worse, since 9x/ME are not pre-emptively multitasking,
+ # you end up with a "frozen" computer, even though with patience
+ # the test eventually succeeds (with a max line length of 256k).
+ # Instead, let's just punt: use the minimum linelength reported by
+ # all of the supported platforms: 8192 (on NT/2K/XP).
+ lt_cv_sys_max_cmd_len=8192;
+ ;;
+
+ amigaos*)
+ # On AmigaOS with pdksh, this test takes hours, literally.
+ # So we just punt and use a minimum line length of 8192.
+ lt_cv_sys_max_cmd_len=8192;
+ ;;
+
+ netbsd* | freebsd* | openbsd* | darwin* | dragonfly*)
+ # This has been around since 386BSD, at least. Likely further.
+ if test -x /sbin/sysctl; then
+ lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax`
+ elif test -x /usr/sbin/sysctl; then
+ lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax`
+ else
+ lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs
+ fi
+ # And add a safety zone
+ lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4`
+ lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3`
+ ;;
+
+ interix*)
+ # We know the value 262144 and hardcode it with a safety zone (like BSD)
+ lt_cv_sys_max_cmd_len=196608
+ ;;
+
+ osf*)
+ # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure
+ # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not
+ # nice to cause kernel panics so lets avoid the loop below.
+ # First set a reasonable default.
+ lt_cv_sys_max_cmd_len=16384
+ #
+ if test -x /sbin/sysconfig; then
+ case `/sbin/sysconfig -q proc exec_disable_arg_limit` in
+ *1*) lt_cv_sys_max_cmd_len=-1 ;;
+ esac
+ fi
+ ;;
+ sco3.2v5*)
+ lt_cv_sys_max_cmd_len=102400
+ ;;
+ sysv5* | sco5v6* | sysv4.2uw2*)
+ kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null`
+ if test -n "$kargmax"; then
+ lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[ ]//'`
+ else
+ lt_cv_sys_max_cmd_len=32768
+ fi
+ ;;
+ *)
+ lt_cv_sys_max_cmd_len=`getconf ARG_MAX 2> /dev/null`
+ if test -n $lt_cv_sys_max_cmd_len; then
+ lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4`
+ lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3`
+ else
+ # Make teststring a little bigger before we do anything with it.
+ # a 1K string should be a reasonable start.
+ for i in 1 2 3 4 5 6 7 8 ; do
+ teststring=$teststring$teststring
+ done
+ SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}}
+ # If test is not a shell built-in, we'll probably end up computing a
+ # maximum length that is only half of the actual maximum length, but
+ # we can't tell.
+ while { test "X"`$SHELL $0 --fallback-echo "X$teststring$teststring" 2>/dev/null` \
+ = "XX$teststring$teststring"; } >/dev/null 2>&1 &&
+ test $i != 17 # 1/2 MB should be enough
+ do
+ i=`expr $i + 1`
+ teststring=$teststring$teststring
+ done
+ # Only check the string length outside the loop.
+ lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1`
+ teststring=
+ # Add a significant safety factor because C++ compilers can tack on
+ # massive amounts of additional arguments before passing them to the
+ # linker. It appears as though 1/2 is a usable value.
+ lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2`
+ fi
+ ;;
+ esac
+
fi
-LN_S="$ac_cv_prog_LN_S"
-if test "$ac_cv_prog_LN_S" = "ln -s"; then
- echo "$ac_t""yes" 1>&6
+
+if test -n $lt_cv_sys_max_cmd_len ; then
+ echo "$as_me:$LINENO: result: $lt_cv_sys_max_cmd_len" >&5
+echo "${ECHO_T}$lt_cv_sys_max_cmd_len" >&6
else
- echo "$ac_t""no" 1>&6
+ echo "$as_me:$LINENO: result: none" >&5
+echo "${ECHO_T}none" >&6
fi
+max_cmd_len=$lt_cv_sys_max_cmd_len
+
+
+
+
+
+
+
+: ${CP="cp -f"}
+: ${MV="mv -f"}
+: ${RM="rm -f"}
+
+echo "$as_me:$LINENO: checking whether the shell understands some XSI constructs" >&5
+echo $ECHO_N "checking whether the shell understands some XSI constructs... $ECHO_C" >&6
+# Try some XSI features
+xsi_shell=no
+( _lt_dummy="a/b/c"
+ test "${_lt_dummy##*/},${_lt_dummy%/*},"${_lt_dummy%"$_lt_dummy"}, \
+ = c,a/b,, ) >/dev/null 2>&1 \
+ && xsi_shell=yes
+echo "$as_me:$LINENO: result: $xsi_shell" >&5
+echo "${ECHO_T}$xsi_shell" >&6
+
+
+echo "$as_me:$LINENO: checking whether the shell understands \"+=\"" >&5
+echo $ECHO_N "checking whether the shell understands \"+=\"... $ECHO_C" >&6
+lt_shell_append=no
+( foo=bar; set foo baz; eval "$1+=\$2" && test "$foo" = barbaz ) \
+ >/dev/null 2>&1 \
+ && lt_shell_append=yes
+echo "$as_me:$LINENO: result: $lt_shell_append" >&5
+echo "${ECHO_T}$lt_shell_append" >&6
+
+
+if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
+ lt_unset=unset
+else
+ lt_unset=false
+fi
+
+
+
+
+
+# test EBCDIC or ASCII
+case `echo X|tr X '\101'` in
+ A) # ASCII based system
+ # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr
+ lt_SP2NL='tr \040 \012'
+ lt_NL2SP='tr \015\012 \040\040'
+ ;;
+ *) # EBCDIC based system
+ lt_SP2NL='tr \100 \n'
+ lt_NL2SP='tr \r\n \100\100'
+ ;;
+esac
+
+
+
+
+
+
+
+
+
+echo "$as_me:$LINENO: checking for $LD option to reload object files" >&5
+echo $ECHO_N "checking for $LD option to reload object files... $ECHO_C" >&6
+if test "${lt_cv_ld_reload_flag+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ lt_cv_ld_reload_flag='-r'
+fi
+echo "$as_me:$LINENO: result: $lt_cv_ld_reload_flag" >&5
+echo "${ECHO_T}$lt_cv_ld_reload_flag" >&6
+reload_flag=$lt_cv_ld_reload_flag
+case $reload_flag in
+"" | " "*) ;;
+*) reload_flag=" $reload_flag" ;;
+esac
+reload_cmds='$LD$reload_flag -o $output$reload_objs'
+case $host_os in
+ darwin*)
+ if test "$GCC" = yes; then
+ reload_cmds='$LTCC $LTCFLAGS -nostdlib ${wl}-r -o $output$reload_objs'
+ else
+ reload_cmds='$LD$reload_flag -o $output$reload_objs'
+ fi
+ ;;
+esac
+
+
+
+
+
+
+
+
+
-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
+echo "$as_me:$LINENO: checking how to recognize dependent libraries" >&5
+echo $ECHO_N "checking how to recognize dependent libraries... $ECHO_C" >&6
+if test "${lt_cv_deplibs_check_method+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
lt_cv_file_magic_cmd='$MAGIC_CMD'
lt_cv_file_magic_test_file=
@@ -1593,13 +4932,13 @@ lt_cv_deplibs_check_method='unknown'
# `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.
+# 'file_magic [[regex]]' -- check by looking for files in library path
+# which responds to the $file_magic_cmd with a given extended 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*)
+aix4* | aix5*)
lt_cv_deplibs_check_method=pass_all
;;
@@ -1607,37 +4946,42 @@ beos*)
lt_cv_deplibs_check_method=pass_all
;;
-bsdi4*)
+bsdi[45]*)
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'
+cygwin*)
+ # func_win32_libid is a shell function defined in ltmain.sh
+ lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL'
+ lt_cv_file_magic_cmd='func_win32_libid'
+ ;;
+
+mingw* | pw32*)
+ # Base MSYS/MinGW do not provide the 'file' command needed by
+ # func_win32_libid shell function, so use a weaker test based on 'objdump',
+ # unless we find 'file', for example because we are cross-compiling.
+ if ( file / ) >/dev/null 2>&1; then
+ lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL'
+ lt_cv_file_magic_cmd='func_win32_libid'
+ else
+ lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?'
+ lt_cv_file_magic_cmd='$OBJDUMP -f'
+ fi
;;
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
+ lt_cv_deplibs_check_method=pass_all
;;
-freebsd* )
- if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
+freebsd* | dragonfly*)
+ 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_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/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.*`
;;
@@ -1651,200 +4995,1644 @@ gnu*)
lt_cv_deplibs_check_method=pass_all
;;
-hpux10.20*|hpux11*)
+hpux10.20* | hpux11*)
+ lt_cv_file_magic_cmd=/usr/bin/file
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"
+ hppa*64*)
+ lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - PA-RISC [0-9].[0-9]'
+ lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl
;;
*)
- 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"
+ 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_test_file=/usr/lib/libc.sl
;;
esac
- lt_cv_file_magic_test_file=`echo /lib${libsuff}/libc.so*`
+ ;;
+
+interix[3-9]*)
+ # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here
+ lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|\.a)$'
+ ;;
+
+irix5* | irix6* | nonstopux*)
+ case $LD in
+ *-32|*"-32 ") libmagic=32-bit;;
+ *-n32|*"-n32 ") libmagic=N32;;
+ *-64|*"-64 ") libmagic=64-bit;;
+ *) libmagic=never-match;;
+ esac
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`
+linux* | k*bsd*-gnu)
+ lt_cv_deplibs_check_method=pass_all
;;
netbsd*)
- if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
- lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$'
+ if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then
+ lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$'
else
- lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so$'
+ lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|_pic\.a)$'
fi
;;
-newsos6)
+newos6*)
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
;;
+*nto* | *qnx*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+openbsd*)
+ if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+ lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|\.so|_pic\.a)$'
+ else
+ lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$'
+ fi
+ ;;
+
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*)
+rdos*)
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*)
+sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
lt_cv_deplibs_check_method=pass_all
;;
-sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
+sysv4 | sysv4.3*)
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*`
;;
+ ncr)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+ sequent)
+ lt_cv_file_magic_cmd='/bin/file'
+ lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )'
+ ;;
+ sni)
+ lt_cv_file_magic_cmd='/bin/file'
+ lt_cv_deplibs_check_method="file_magic ELF [0-9][0-9]*-bit [LM]SB dynamic lib"
+ lt_cv_file_magic_test_file=/lib/libc.so
+ ;;
+ siemens)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+ pc)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
esac
;;
+
+tpf*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
esac
fi
-
-echo "$ac_t""$lt_cv_deplibs_check_method" 1>&6
+echo "$as_me:$LINENO: result: $lt_cv_deplibs_check_method" >&5
+echo "${ECHO_T}$lt_cv_deplibs_check_method" >&6
file_magic_cmd=$lt_cv_file_magic_cmd
deplibs_check_method=$lt_cv_deplibs_check_method
+test -z "$deplibs_check_method" && deplibs_check_method=unknown
+
+
-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
+
+
+
+
+
+
+
+
+
+if test -n "$ac_tool_prefix"; then
+ # 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 "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_AR+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&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
+ if test -n "$AR"; then
+ ac_cv_prog_AR="$AR" # Let the user override the test.
else
- { echo "configure: error: installation or configuration problem; compiler does not work" 1>&2; exit 1; }
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_AR="${ac_tool_prefix}ar"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+
fi
-rm -f conftest*
+fi
+AR=$ac_cv_prog_AR
+if test -n "$AR"; then
+ echo "$as_me:$LINENO: result: $AR" >&5
+echo "${ECHO_T}$AR" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
fi
-echo "$ac_t""$ac_cv_objext" 1>&6
-OBJEXT=$ac_cv_objext
-ac_objext=$ac_cv_objext
+fi
+if test -z "$ac_cv_prog_AR"; then
+ ac_ct_AR=$AR
+ # Extract the first word of "ar", so it can be a program name with args.
+set dummy ar; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_ac_ct_AR+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$ac_ct_AR"; then
+ ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_AR="ar"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+ test -z "$ac_cv_prog_ac_ct_AR" && ac_cv_prog_ac_ct_AR="false"
+fi
+fi
+ac_ct_AR=$ac_cv_prog_ac_ct_AR
+if test -n "$ac_ct_AR"; then
+ echo "$as_me:$LINENO: result: $ac_ct_AR" >&5
+echo "${ECHO_T}$ac_ct_AR" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+ AR=$ac_ct_AR
+else
+ AR="$ac_cv_prog_AR"
+fi
+
+test -z "$AR" && AR=ar
+test -z "$AR_FLAGS" && AR_FLAGS=cru
+
+
+
+
+
+
+
+
+
+
+
+if test -n "$ac_tool_prefix"; then
+ # 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 "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_STRIP+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$STRIP"; then
+ ac_cv_prog_STRIP="$STRIP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_STRIP="${ac_tool_prefix}strip"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+
+fi
+fi
+STRIP=$ac_cv_prog_STRIP
+if test -n "$STRIP"; then
+ echo "$as_me:$LINENO: result: $STRIP" >&5
+echo "${ECHO_T}$STRIP" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+fi
+if test -z "$ac_cv_prog_STRIP"; then
+ ac_ct_STRIP=$STRIP
+ # Extract the first word of "strip", so it can be a program name with args.
+set dummy strip; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$ac_ct_STRIP"; then
+ ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_STRIP="strip"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+ test -z "$ac_cv_prog_ac_ct_STRIP" && ac_cv_prog_ac_ct_STRIP=":"
+fi
+fi
+ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP
+if test -n "$ac_ct_STRIP"; then
+ echo "$as_me:$LINENO: result: $ac_ct_STRIP" >&5
+echo "${ECHO_T}$ac_ct_STRIP" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+ STRIP=$ac_ct_STRIP
+else
+ STRIP="$ac_cv_prog_STRIP"
+fi
+
+test -z "$STRIP" && STRIP=:
+
+
+
+
+
+
+if test -n "$ac_tool_prefix"; then
+ # 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 "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_RANLIB+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$RANLIB"; then
+ ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+
+fi
+fi
+RANLIB=$ac_cv_prog_RANLIB
+if test -n "$RANLIB"; then
+ echo "$as_me:$LINENO: result: $RANLIB" >&5
+echo "${ECHO_T}$RANLIB" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+fi
+if test -z "$ac_cv_prog_RANLIB"; then
+ ac_ct_RANLIB=$RANLIB
+ # Extract the first word of "ranlib", so it can be a program name with args.
+set dummy ranlib; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$ac_ct_RANLIB"; then
+ ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_RANLIB="ranlib"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+
+ test -z "$ac_cv_prog_ac_ct_RANLIB" && ac_cv_prog_ac_ct_RANLIB=":"
+fi
+fi
+ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB
+if test -n "$ac_ct_RANLIB"; then
+ echo "$as_me:$LINENO: result: $ac_ct_RANLIB" >&5
+echo "${ECHO_T}$ac_ct_RANLIB" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
-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
+ RANLIB=$ac_ct_RANLIB
else
- if test "$CYGWIN" = yes || test "$MINGW32" = yes; then
- ac_cv_exeext=.exe
+ RANLIB="$ac_cv_prog_RANLIB"
+fi
+
+test -z "$RANLIB" && RANLIB=:
+
+
+
+
+
+
+# Determine commands to create old-style static archives.
+old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs$old_deplibs'
+old_postinstall_cmds='chmod 644 $oldlib'
+old_postuninstall_cmds=
+
+if test -n "$RANLIB"; then
+ case $host_os in
+ openbsd*)
+ old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$oldlib"
+ ;;
+ *)
+ old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$oldlib"
+ ;;
+ esac
+ old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib"
+fi
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+# If no C compiler was specified, use CC.
+LTCC=${LTCC-"$CC"}
+
+# If no C compiler flags were specified, use CFLAGS.
+LTCFLAGS=${LTCFLAGS-"$CFLAGS"}
+
+# Allow CC to be a program name with arguments.
+compiler=$CC
+
+
+# Check for command to grab the raw symbol name followed by C symbol from nm.
+echo "$as_me:$LINENO: checking command to parse $NM output from $compiler object" >&5
+echo $ECHO_N "checking command to parse $NM output from $compiler object... $ECHO_C" >&6
+if test "${lt_cv_sys_global_symbol_pipe+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
+
+# These are sane defaults that work on at least a few old systems.
+# [They come from Ultrix. What could be older than Ultrix?!! ;)]
+
+# Character class describing NM global symbol codes.
+symcode='[BCDEGRST]'
+
+# Regexp to match symbols that can be accessed directly from C.
+sympat='\([_A-Za-z][_A-Za-z0-9]*\)'
+
+# Define system-specific variables.
+case $host_os in
+aix*)
+ symcode='[BCDT]'
+ ;;
+cygwin* | mingw* | pw32*)
+ symcode='[ABCDGISTW]'
+ ;;
+hpux*)
+ if test "$host_cpu" = ia64; then
+ symcode='[ABCDEGRST]'
+ fi
+ ;;
+irix* | nonstopux*)
+ symcode='[BCDEGRST]'
+ ;;
+osf*)
+ symcode='[BCDEGQRST]'
+ ;;
+solaris*)
+ symcode='[BDRT]'
+ ;;
+sco3.2v5*)
+ symcode='[DT]'
+ ;;
+sysv4.2uw2*)
+ symcode='[DT]'
+ ;;
+sysv5* | sco5v6* | unixware* | OpenUNIX*)
+ symcode='[ABDT]'
+ ;;
+sysv4)
+ symcode='[DFNSTU]'
+ ;;
+esac
+
+# If we're using GNU nm, then use its standard symbol codes.
+case `$NM -V 2>&1` in
+*GNU* | *'with BFD'*)
+ symcode='[ABCDGIRSTW]' ;;
+esac
+
+# Transform an extracted symbol line into a proper C declaration.
+# Some systems (esp. on ia64) link data and code symbols differently,
+# so use this general approach.
+lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'"
+
+# Transform an extracted symbol line into symbol name and symbol address
+lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"\2\", (void *) \&\2},/p'"
+
+# Handle CRLF in mingw tool chain
+opt_cr=
+case $build_os in
+mingw*)
+ opt_cr=`$ECHO 'x\{0,1\}' | tr x '\015'` # option cr in regexp
+ ;;
+esac
+
+# Try without a prefix underscore, then with it.
+for ac_symprfx in "" "_"; do
+
+ # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol.
+ symxfrm="\\1 $ac_symprfx\\2 \\2"
+
+ # Write the raw and C identifiers.
+ if test "$lt_cv_nm_interface" = "MS dumpbin"; then
+ # Fake it for dumpbin and say T for any non-static function
+ # and D for any global variable.
+ # Also find C++ and __fastcall symbols from MSVC++,
+ # which start with @ or ?.
+ lt_cv_sys_global_symbol_pipe="$AWK '"\
+" {last_section=section; section=\$ 3};"\
+" /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\
+" \$ 0!~/External *\|/{next};"\
+" / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\
+" {if(hide[section]) next};"\
+" {f=0}; \$ 0~/\(\).*\|/{f=1}; {printf f ? \"T \" : \"D \"};"\
+" {split(\$ 0, a, /\||\r/); split(a[2], s)};"\
+" s[1]~/^[@?]/{print s[1], s[1]; next};"\
+" s[1]~prfx {split(s[1],t,\"@\"); print t[1], substr(t[1],length(prfx))}"\
+" ' prfx=^$ac_symprfx"
+ else
+ lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[ ]\($symcode$symcode*\)[ ][ ]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'"
+ fi
+
+ # Check to see that the pipe works correctly.
+ pipe_works=no
+
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//` ;;
+ cat > conftest.$ac_ext <<_LT_EOF
+#ifdef __cplusplus
+extern "C" {
+#endif
+char nm_test_var;
+void nm_test_func(void);
+void nm_test_func(void){}
+#ifdef __cplusplus
+}
+#endif
+int main(){nm_test_var='a';nm_test_func();return(0);}
+_LT_EOF
+
+ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
+ # Now try to grab the symbols.
+ nlist=conftest.nm
+ if { (eval echo "$as_me:$LINENO: \"$NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist\"") >&5
+ (eval $NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && test -s "$nlist"; then
+ # Try sorting and uniquifying the output.
+ if sort "$nlist" | uniq > "$nlist"T; then
+ mv -f "$nlist"T "$nlist"
+ else
+ rm -f "$nlist"T
+ fi
+
+ # Make sure that we snagged all the symbols we need.
+ if $GREP ' nm_test_var$' "$nlist" >/dev/null; then
+ if $GREP ' nm_test_func$' "$nlist" >/dev/null; then
+ cat <<_LT_EOF > conftest.$ac_ext
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+_LT_EOF
+ # Now generate the symbol file.
+ eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | $GREP -v main >> conftest.$ac_ext'
+
+ cat <<_LT_EOF >> conftest.$ac_ext
+
+/* The mapping between symbol names and symbols. */
+const struct {
+ const char *name;
+ void *address;
+}
+lt__PROGRAM__LTX_preloaded_symbols[] =
+{
+ { "@PROGRAM@", (void *) 0 },
+_LT_EOF
+ $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (void *) \&\2},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext
+ cat <<\_LT_EOF >> conftest.$ac_ext
+ {0, (void *) 0}
+};
+
+/* This works around a problem in FreeBSD linker */
+#ifdef FREEBSD_WORKAROUND
+static const void *lt_preloaded_setup() {
+ return lt__PROGRAM__LTX_preloaded_symbols;
+}
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+_LT_EOF
+ # Now try linking the two files.
+ mv conftest.$ac_objext conftstm.$ac_objext
+ lt_save_LIBS="$LIBS"
+ lt_save_CFLAGS="$CFLAGS"
+ LIBS="conftstm.$ac_objext"
+ CFLAGS="$CFLAGS$lt_prog_compiler_no_builtin_flag"
+ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && test -s conftest${ac_exeext}; then
+ pipe_works=yes
+ fi
+ LIBS="$lt_save_LIBS"
+ CFLAGS="$lt_save_CFLAGS"
+ else
+ echo "cannot find nm_test_func in $nlist" >&5
+ fi
+ else
+ echo "cannot find nm_test_var in $nlist" >&5
+ fi
+ else
+ echo "cannot run $lt_cv_sys_global_symbol_pipe" >&5
+ fi
+ else
+ echo "$progname: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ fi
+ rm -f conftest* conftst*
+
+ # Do not use the global_symbol_pipe unless it works.
+ if test "$pipe_works" = yes; then
+ break
+ else
+ lt_cv_sys_global_symbol_pipe=
+ fi
+done
+
+fi
+
+if test -z "$lt_cv_sys_global_symbol_pipe"; then
+ lt_cv_sys_global_symbol_to_cdecl=
+fi
+if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then
+ echo "$as_me:$LINENO: result: failed" >&5
+echo "${ECHO_T}failed" >&6
+else
+ echo "$as_me:$LINENO: result: ok" >&5
+echo "${ECHO_T}ok" >&6
+fi
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+# 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 && enable_libtool_lock=yes
+
+# Some flags need to be propagated to the compiler or linker for good
+# libtool support.
+case $host in
+ia64-*-hpux*)
+ # Find out which ABI we are using.
+ echo 'int i;' > conftest.$ac_ext
+ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
+ case `/usr/bin/file conftest.$ac_objext` in
+ *ELF-32*)
+ HPUX_IA64_MODE="32"
+ ;;
+ *ELF-64*)
+ HPUX_IA64_MODE="64"
+ ;;
+ esac
+ fi
+ rm -rf conftest*
+ ;;
+*-*-irix6*)
+ # Find out which ABI we are using.
+ echo '#line 5729 "configure"' > conftest.$ac_ext
+ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; 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*
+ ;;
+
+x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \
+s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
+ # Find out which ABI we are using.
+ echo 'int i;' > conftest.$ac_ext
+ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
+ case `/usr/bin/file conftest.o` in
+ *32-bit*)
+ case $host in
+ x86_64-*kfreebsd*-gnu)
+ LD="${LD-ld} -m elf_i386_fbsd"
+ ;;
+ x86_64-*linux*)
+ LD="${LD-ld} -m elf_i386"
+ ;;
+ ppc64-*linux*|powerpc64-*linux*)
+ LD="${LD-ld} -m elf32ppclinux"
+ ;;
+ s390x-*linux*)
+ LD="${LD-ld} -m elf_s390"
+ ;;
+ sparc64-*linux*)
+ LD="${LD-ld} -m elf32_sparc"
+ ;;
+ esac
+ ;;
+ *64-bit*)
+ case $host in
+ x86_64-*kfreebsd*-gnu)
+ LD="${LD-ld} -m elf_x86_64_fbsd"
+ ;;
+ x86_64-*linux*)
+ LD="${LD-ld} -m elf_x86_64"
+ ;;
+ ppc*-*linux*|powerpc*-*linux*)
+ LD="${LD-ld} -m elf64ppc"
+ ;;
+ s390*-*linux*|s390*-*tpf*)
+ LD="${LD-ld} -m elf64_s390"
+ ;;
+ sparc*-*linux*)
+ LD="${LD-ld} -m elf64_sparc"
+ ;;
+ esac
+ ;;
+ 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 "$as_me:$LINENO: checking whether the C compiler needs -belf" >&5
+echo $ECHO_N "checking whether the C compiler needs -belf... $ECHO_C" >&6
+if test "${lt_cv_cc_needs_belf+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ lt_cv_cc_needs_belf=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+lt_cv_cc_needs_belf=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+ ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+fi
+echo "$as_me:$LINENO: result: $lt_cv_cc_needs_belf" >&5
+echo "${ECHO_T}$lt_cv_cc_needs_belf" >&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
+ ;;
+sparc*-*solaris*)
+ # Find out which ABI we are using.
+ echo 'int i;' > conftest.$ac_ext
+ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
+ case `/usr/bin/file conftest.o` in
+ *64-bit*)
+ case $lt_cv_prog_gnu_ld in
+ yes*) LD="${LD-ld} -m elf64_sparc" ;;
+ *) LD="${LD-ld} -64" ;;
esac
+ ;;
+ esac
+ fi
+ rm -rf conftest*
+ ;;
+esac
+
+need_locks="$enable_libtool_lock"
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5
+echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6
+# On Suns, sometimes $CPP names a directory.
+if test -n "$CPP" && test -d "$CPP"; then
+ CPP=
+fi
+if test -z "$CPP"; then
+ if test "${ac_cv_prog_CPP+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ # Double quotes because CPP needs to be expanded
+ for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp"
+ do
+ ac_preproc_ok=false
+for ac_c_preproc_warn_flag in '' yes
+do
+ # Use a header file that comes with gcc, so configuring glibc
+ # with a fresh cross-compiler works.
+ # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ # <limits.h> exists even on freestanding compilers.
+ # On the NeXT, cc -E runs the code through the compiler's parser,
+ # not just through cpp. "Syntax error" is here to catch this case.
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+ Syntax error
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+ else
+ ac_cpp_err=
+ fi
+else
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+ :
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ # Broken: fails on valid input.
+continue
+fi
+rm -f conftest.err conftest.$ac_ext
+
+ # OK, works on sane cases. Now check whether non-existent headers
+ # can be detected and how.
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <ac_nonexistent.h>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+ else
+ ac_cpp_err=
+ fi
+else
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+ # Broken: success on invalid input.
+continue
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ # Passes both tests.
+ac_preproc_ok=:
+break
+fi
+rm -f conftest.err conftest.$ac_ext
+
+done
+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+rm -f conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then
+ break
+fi
+
done
+ ac_cv_prog_CPP=$CPP
+
+fi
+ CPP=$ac_cv_prog_CPP
+else
+ ac_cv_prog_CPP=$CPP
+fi
+echo "$as_me:$LINENO: result: $CPP" >&5
+echo "${ECHO_T}$CPP" >&6
+ac_preproc_ok=false
+for ac_c_preproc_warn_flag in '' yes
+do
+ # Use a header file that comes with gcc, so configuring glibc
+ # with a fresh cross-compiler works.
+ # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ # <limits.h> exists even on freestanding compilers.
+ # On the NeXT, cc -E runs the code through the compiler's parser,
+ # not just through cpp. "Syntax error" is here to catch this case.
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+ Syntax error
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
else
- { echo "configure: error: installation or configuration problem: compiler cannot create executables." 1>&2; exit 1; }
+ ac_cpp_err=
fi
- rm -f conftest*
- test x"${ac_cv_exeext}" = x && ac_cv_exeext=no
+else
+ ac_cpp_err=yes
fi
+if test -z "$ac_cpp_err"; then
+ :
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ # Broken: fails on valid input.
+continue
+fi
+rm -f conftest.err conftest.$ac_ext
+
+ # OK, works on sane cases. Now check whether non-existent headers
+ # can be detected and how.
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <ac_nonexistent.h>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+ else
+ ac_cpp_err=
+ fi
+else
+ ac_cpp_err=yes
fi
+if test -z "$ac_cpp_err"; then
+ # Broken: success on invalid input.
+continue
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ # Passes both tests.
+ac_preproc_ok=:
+break
+fi
+rm -f conftest.err conftest.$ac_ext
+
+done
+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+rm -f conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then
+ :
+else
+ { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check
+See \`config.log' for more details." >&5
+echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+echo "$as_me:$LINENO: checking for ANSI C header files" >&5
+echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6
+if test "${ac_cv_header_stdc+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <stdlib.h>
+#include <stdarg.h>
+#include <string.h>
+#include <float.h>
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_header_stdc=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_header_stdc=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+
+if test $ac_cv_header_stdc = yes; then
+ # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <string.h>
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ $EGREP "memchr" >/dev/null 2>&1; then
+ :
+else
+ 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 <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <stdlib.h>
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ $EGREP "free" >/dev/null 2>&1; then
+ :
+else
+ 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 <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <ctype.h>
+#if ((' ' & 0x0FF) == 0x020)
+# define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
+# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
+#else
+# define ISLOWER(c) \
+ (('a' <= (c) && (c) <= 'i') \
+ || ('j' <= (c) && (c) <= 'r') \
+ || ('s' <= (c) && (c) <= 'z'))
+# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c))
+#endif
+
+#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);
+}
+_ACEOF
+rm -f conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ :
+else
+ echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+( exit $ac_status )
+ac_cv_header_stdc=no
+fi
+rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+fi
+fi
+echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5
+echo "${ECHO_T}$ac_cv_header_stdc" >&6
+if test $ac_cv_header_stdc = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define STDC_HEADERS 1
+_ACEOF
+
+fi
+
+# On IRIX 5.3, sys/types and inttypes.h are conflicting.
+
+
+
+
+
+
+
+
+
+for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \
+ inttypes.h stdint.h unistd.h
+do
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ eval "$as_ac_Header=yes"
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+eval "$as_ac_Header=no"
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+
+
+for ac_header in dlfcn.h
+do
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ eval "$as_ac_Header=yes"
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+eval "$as_ac_Header=no"
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+
+
+# This can be used to rebuild libtool when needed
+LIBTOOL_DEPS="$ltmain"
+
+# Always use our own libtool.
+LIBTOOL='$(SHELL) $(top_builddir)/libtool'
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+test -z "$LN_S" && LN_S="ln -s"
+
+
+
+
+
+
+
+
+
+
-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!
+
+
+if test -n "${ZSH_VERSION+set}" ; then
+ setopt NO_GLOB_SUBST
+fi
+
+echo "$as_me:$LINENO: checking for objdir" >&5
+echo $ECHO_N "checking for objdir... $ECHO_C" >&6
+if test "${lt_cv_objdir+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ rm -f .libs 2>/dev/null
+mkdir .libs 2>/dev/null
+if test -d .libs; then
+ lt_cv_objdir=.libs
+else
+ # MS-DOS does not allow filenames that begin with a dot.
+ lt_cv_objdir=_libs
+fi
+rmdir .libs 2>/dev/null
+fi
+echo "$as_me:$LINENO: result: $lt_cv_objdir" >&5
+echo "${ECHO_T}$lt_cv_objdir" >&6
+objdir=$lt_cv_objdir
+
+
+
+
+
+cat >>confdefs.h <<_ACEOF
+#define LT_OBJDIR "$lt_cv_objdir/"
+_ACEOF
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+case $host_os in
+aix3*)
+ # AIX sometimes has problems with the GCC collect2 program. For some
+ # reason, if we set the COLLECT_NAMES environment variable, the problems
+ # vanish in a puff of smoke.
+ if test "X${COLLECT_NAMES+set}" != Xset; then
+ COLLECT_NAMES=
+ export COLLECT_NAMES
+ fi
+ ;;
+esac
+
+# Sed substitution that helps us do robust quoting. It backslashifies
+# metacharacters that are still active within double-quoted strings.
+sed_quote_subst='s/\(["`$\\]\)/\\\1/g'
+
+# Same as above, but do not quote variable references.
+double_quote_subst='s/\(["`\\]\)/\\\1/g'
+
+# Sed substitution to delay expansion of an escaped shell variable in a
+# double_quote_subst'ed string.
+delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g'
+
+# Sed substitution to delay expansion of an escaped single quote.
+delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g'
+
+# Sed substitution to avoid accidental globbing in evaled expressions
+no_glob_subst='s/\*/\\\*/g'
+
+# Global variables:
+ofile=libtool
+can_build_shared=yes
+
+# All known linkers require a `.a' archive for static linking (except MSVC,
+# which needs '.lib').
+libext=a
+
+with_gnu_ld="$lt_cv_prog_gnu_ld"
+
+old_CC="$CC"
+old_CFLAGS="$CFLAGS"
+
+# Set sane defaults for various variables
+test -z "$CC" && CC=cc
+test -z "$LTCC" && LTCC=$CC
+test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS
+test -z "$LD" && LD=ld
+test -z "$ac_objext" && ac_objext=o
+
+for cc_temp in $compiler""; do
+ case $cc_temp in
+ compile | *[\\/]compile | ccache | *[\\/]ccache ) ;;
+ distcc | *[\\/]distcc | purify | *[\\/]purify ) ;;
+ \-*) ;;
+ *) break;;
+ esac
+done
+cc_basename=`$ECHO "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"`
+
# Only perform the check for file, if the check method requires it
+test -z "$MAGIC_CMD" && MAGIC_CMD=file
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
+ echo "$as_me:$LINENO: checking for ${ac_tool_prefix}file" >&5
+echo $ECHO_N "checking for ${ac_tool_prefix}file... $ECHO_C" >&6
+if test "${lt_cv_path_MAGIC_CMD+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&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"
+*)
+ lt_save_MAGIC_CMD="$MAGIC_CMD"
+ lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+ ac_dummy="/usr/bin$PATH_SEPARATOR$PATH"
for ac_dir in $ac_dummy; do
+ IFS="$lt_save_ifs"
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 \(.*\)\"`"
+ 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
+ $EGREP "$file_magic_regex" > /dev/null; then
:
else
- cat <<EOF 1>&2
+ cat <<_LT_EOF 1>&2
*** Warning: the command libtool uses to detect shared libraries,
*** $file_magic_cmd, produces output that libtool cannot recognize.
@@ -1855,58 +6643,62 @@ else
*** may want to report the problem to your system manager and/or to
*** bug-libtool@gnu.org
-EOF
+_LT_EOF
fi ;;
esac
fi
break
fi
done
- IFS="$ac_save_ifs"
- MAGIC_CMD="$ac_save_MAGIC_CMD"
+ IFS="$lt_save_ifs"
+ MAGIC_CMD="$lt_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
+ echo "$as_me:$LINENO: result: $MAGIC_CMD" >&5
+echo "${ECHO_T}$MAGIC_CMD" >&6
else
- echo "$ac_t""no" 1>&6
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&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
+ echo "$as_me:$LINENO: checking for file" >&5
+echo $ECHO_N "checking for file... $ECHO_C" >&6
+if test "${lt_cv_path_MAGIC_CMD+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&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"
+*)
+ lt_save_MAGIC_CMD="$MAGIC_CMD"
+ lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+ ac_dummy="/usr/bin$PATH_SEPARATOR$PATH"
for ac_dir in $ac_dummy; do
+ IFS="$lt_save_ifs"
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 \(.*\)\"`"
+ 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
+ $EGREP "$file_magic_regex" > /dev/null; then
:
else
- cat <<EOF 1>&2
+ cat <<_LT_EOF 1>&2
*** Warning: the command libtool uses to detect shared libraries,
*** $file_magic_cmd, produces output that libtool cannot recognize.
@@ -1917,26 +6709,29 @@ else
*** may want to report the problem to your system manager and/or to
*** bug-libtool@gnu.org
-EOF
+_LT_EOF
fi ;;
esac
fi
break
fi
done
- IFS="$ac_save_ifs"
- MAGIC_CMD="$ac_save_MAGIC_CMD"
+ IFS="$lt_save_ifs"
+ MAGIC_CMD="$lt_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
+ echo "$as_me:$LINENO: result: $MAGIC_CMD" >&5
+echo "${ECHO_T}$MAGIC_CMD" >&6
else
- echo "$ac_t""no" 1>&6
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
fi
+
else
MAGIC_CMD=:
fi
@@ -1946,2489 +6741,4370 @@ 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
+# Use C for the default configuration in the libtool script
+lt_save_CC="$CC"
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
-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
+# Source file extension for C test sources.
+ac_ext=c
-# 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
+# Object file extension for compiled C test sources.
+objext=o
+objext=$objext
+# Code to be used in simple compile tests
+lt_simple_compile_test_code="int some_variable = 0;"
+
+# Code to be used in simple link tests
+lt_simple_link_test_code='int main(){return(0);}'
+
+
+
+
+
+
+
+# If no C compiler was specified, use CC.
+LTCC=${LTCC-"$CC"}
+
+# If no C compiler flags were specified, use CFLAGS.
+LTCFLAGS=${LTCFLAGS-"$CFLAGS"}
+
+# Allow CC to be a program name with arguments.
+compiler=$CC
+
+# Save the default compiler, since it gets overwritten when the other
+# tags are being tested, and _LT_TAGVAR(compiler, []) is a NOP.
+compiler_DEFAULT=$CC
+
+# save warnings/boilerplate of simple test code
+ac_outfile=conftest.$ac_objext
+echo "$lt_simple_compile_test_code" >conftest.$ac_ext
+eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
+_lt_compiler_boilerplate=`cat conftest.err`
+$RM conftest*
+
+ac_outfile=conftest.$ac_objext
+echo "$lt_simple_link_test_code" >conftest.$ac_ext
+eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
+_lt_linker_boilerplate=`cat conftest.err`
+$RM conftest*
+
+
+## CAVEAT EMPTOR:
+## There is no encapsulation within the following macros, do not change
+## the running order or otherwise move them around unless you know exactly
+## what you are doing...
+if test -n "$compiler"; then
+
+lt_prog_compiler_no_builtin_flag=
+
+if test "$GCC" = yes; then
+ lt_prog_compiler_no_builtin_flag=' -fno-builtin'
+
+ echo "$as_me:$LINENO: checking if $compiler supports -fno-rtti -fno-exceptions" >&5
+echo $ECHO_N "checking if $compiler supports -fno-rtti -fno-exceptions... $ECHO_C" >&6
+if test "${lt_cv_prog_compiler_rtti_exceptions+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ lt_cv_prog_compiler_rtti_exceptions=no
+ ac_outfile=conftest.$ac_objext
+ echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+ lt_compiler_flag="-fno-rtti -fno-exceptions"
+ # Insert the option either (1) after the last *FLAGS variable, or
+ # (2) before a word containing "conftest.", or (3) at the end.
+ # Note that $ac_compile itself does not contain backslashes and begins
+ # with a dollar sign (not a hyphen), so the echo should work correctly.
+ # The option is referenced via a variable to avoid confusing sed.
+ lt_compile=`echo "$ac_compile" | $SED \
+ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
+ -e 's:$: $lt_compiler_flag:'`
+ (eval echo "\"\$as_me:6829: $lt_compile\"" >&5)
+ (eval "$lt_compile" 2>conftest.err)
+ ac_status=$?
+ cat conftest.err >&5
+ echo "$as_me:6833: \$? = $ac_status" >&5
+ if (exit $ac_status) && test -s "$ac_outfile"; then
+ # The compiler can only warn and ignore the option if not recognized
+ # So say no if there are warnings other than the usual output.
+ $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp
+ $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+ if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then
+ lt_cv_prog_compiler_rtti_exceptions=yes
+ fi
+ fi
+ $RM conftest*
-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
+echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_rtti_exceptions" >&5
+echo "${ECHO_T}$lt_cv_prog_compiler_rtti_exceptions" >&6
+if test x"$lt_cv_prog_compiler_rtti_exceptions" = xyes; then
+ lt_prog_compiler_no_builtin_flag="$lt_prog_compiler_no_builtin_flag -fno-rtti -fno-exceptions"
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
+ lt_prog_compiler_wl=
+lt_prog_compiler_pic=
+lt_prog_compiler_static=
-test x"$pic_mode" = xyes && libtool_flags="$libtool_flags --prefer-pic"
-test x"$pic_mode" = xno && libtool_flags="$libtool_flags --prefer-non-pic"
+echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5
+echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6
-# 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"
+ if test "$GCC" = yes; then
+ lt_prog_compiler_wl='-Wl,'
+ lt_prog_compiler_static='-static'
+
+ case $host_os in
+ aix*)
+ # All AIX code is PIC.
+ if test "$host_cpu" = ia64; then
+ # AIX 5 now supports IA64 processor
+ lt_prog_compiler_static='-Bstatic'
+ fi
;;
- *N32*)
- LD="${LD-ld} -melf32bmipn32"
+
+ amigaos*)
+ if test "$host_cpu" = m68k; then
+ # FIXME: we need at least 68020 code to build shared libraries, but
+ # adding the `-m68020' flag to GCC prevents building anything better,
+ # like `-m68040'.
+ lt_prog_compiler_pic='-m68020 -resident32 -malways-restore-a4'
+ fi
;;
- *64-bit*)
- LD="${LD-ld} -melf64bmip"
+
+ beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
+ # PIC is the default for these OSes.
;;
- esac
- else
- case `/usr/bin/file conftest.$ac_objext` in
- *32-bit*)
- LD="${LD-ld} -32"
+
+ mingw* | cygwin* | pw32* | os2*)
+ # This hack is so that the source file can tell whether it is being
+ # built for inclusion in a dll (and should export symbols for example).
+ # Although the cygwin gcc ignores -fPIC, still need this for old-style
+ # (--disable-auto-import) libraries
+ lt_prog_compiler_pic='-DDLL_EXPORT'
;;
- *N32*)
- LD="${LD-ld} -n32"
+
+ darwin* | rhapsody*)
+ # PIC is the default on this platform
+ # Common symbols not allowed in MH_DYLIB files
+ lt_prog_compiler_pic='-fno-common'
;;
- *64-bit*)
- LD="${LD-ld} -64"
+
+ hpux*)
+ # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but
+ # not for PA HP-UX.
+ case $host_cpu in
+ hppa*64*|ia64*)
+ # +Z the default
+ ;;
+ *)
+ lt_prog_compiler_pic='-fPIC'
+ ;;
+ esac
+ ;;
+
+ interix[3-9]*)
+ # Interix 3.x gcc -fpic/-fPIC options generate broken code.
+ # Instead, we relocate shared libraries at runtime.
+ ;;
+
+ msdosdjgpp*)
+ # Just because we use GCC doesn't mean we suddenly get shared libraries
+ # on systems that don't support them.
+ lt_prog_compiler_can_build_shared=no
+ enable_shared=no
+ ;;
+
+ *nto* | *qnx*)
+ # QNX uses GNU C++, but need to define -shared option too, otherwise
+ # it will coredump.
+ lt_prog_compiler_pic='-fPIC -shared'
+ ;;
+
+ sysv4*MP*)
+ if test -d /usr/nec; then
+ lt_prog_compiler_pic=-Kconform_pic
+ fi
+ ;;
+
+ *)
+ lt_prog_compiler_pic='-fPIC'
;;
esac
- fi
- fi
- rm -rf conftest*
- ;;
+ else
+ # PORTME Check for flag to pass linker flags through the system compiler.
+ case $host_os in
+ aix*)
+ lt_prog_compiler_wl='-Wl,'
+ if test "$host_cpu" = ia64; then
+ # AIX 5 now supports IA64 processor
+ lt_prog_compiler_static='-Bstatic'
+ else
+ lt_prog_compiler_static='-bnso -bI:/lib/syscalls.exp'
+ fi
+ ;;
+ darwin*)
+ # PIC is the default on this platform
+ # Common symbols not allowed in MH_DYLIB files
+ case $cc_basename in
+ xlc*)
+ lt_prog_compiler_pic='-qnocommon'
+ lt_prog_compiler_wl='-Wl,'
+ ;;
+ esac
+ ;;
-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"
+ mingw* | cygwin* | pw32* | os2*)
+ # This hack is so that the source file can tell whether it is being
+ # built for inclusion in a dll (and should export symbols for example).
+ lt_prog_compiler_pic='-DDLL_EXPORT'
+ ;;
+
+ hpux9* | hpux10* | hpux11*)
+ lt_prog_compiler_wl='-Wl,'
+ # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but
+ # not for PA HP-UX.
+ case $host_cpu in
+ hppa*64*|ia64*)
+ # +Z the default
+ ;;
+ *)
+ lt_prog_compiler_pic='+Z'
+ ;;
+ esac
+ # Is there a better lt_prog_compiler_static that works with the bundled CC?
+ lt_prog_compiler_static='${wl}-a ${wl}archive'
;;
- *ELF-64*)
- HPUX_IA64_MODE="64"
+
+ irix5* | irix6* | nonstopux*)
+ lt_prog_compiler_wl='-Wl,'
+ # PIC (with -KPIC) is the default.
+ lt_prog_compiler_static='-non_shared'
+ ;;
+
+ linux* | k*bsd*-gnu)
+ case $cc_basename in
+ icc* | ecc*)
+ lt_prog_compiler_wl='-Wl,'
+ lt_prog_compiler_pic='-KPIC'
+ lt_prog_compiler_static='-static'
+ ;;
+ pgcc* | pgf77* | pgf90* | pgf95*)
+ # Portland Group compilers (*not* the Pentium gcc compiler,
+ # which looks to be a dead project)
+ lt_prog_compiler_wl='-Wl,'
+ lt_prog_compiler_pic='-fpic'
+ lt_prog_compiler_static='-Bstatic'
+ ;;
+ ccc*)
+ lt_prog_compiler_wl='-Wl,'
+ # All Alpha code is PIC.
+ lt_prog_compiler_static='-non_shared'
+ ;;
+ *)
+ case `$CC -V 2>&1 | sed 5q` in
+ *Sun\ C*)
+ # Sun C 5.9
+ lt_prog_compiler_pic='-KPIC'
+ lt_prog_compiler_static='-Bstatic'
+ lt_prog_compiler_wl='-Wl,'
+ ;;
+ *Sun\ F*)
+ # Sun Fortran 8.3 passes all unrecognized flags to the linker
+ lt_prog_compiler_pic='-KPIC'
+ lt_prog_compiler_static='-Bstatic'
+ lt_prog_compiler_wl=''
+ ;;
+ esac
+ ;;
+ esac
+ ;;
+
+ newsos6)
+ lt_prog_compiler_pic='-KPIC'
+ lt_prog_compiler_static='-Bstatic'
+ ;;
+
+ *nto* | *qnx*)
+ # QNX uses GNU C++, but need to define -shared option too, otherwise
+ # it will coredump.
+ lt_prog_compiler_pic='-fPIC -shared'
+ ;;
+
+ osf3* | osf4* | osf5*)
+ lt_prog_compiler_wl='-Wl,'
+ # All OSF/1 code is PIC.
+ lt_prog_compiler_static='-non_shared'
+ ;;
+
+ rdos*)
+ lt_prog_compiler_static='-non_shared'
+ ;;
+
+ solaris*)
+ lt_prog_compiler_pic='-KPIC'
+ lt_prog_compiler_static='-Bstatic'
+ case $cc_basename in
+ f77* | f90* | f95*)
+ lt_prog_compiler_wl='-Qoption ld ';;
+ *)
+ lt_prog_compiler_wl='-Wl,';;
+ esac
+ ;;
+
+ sunos4*)
+ lt_prog_compiler_wl='-Qoption ld '
+ lt_prog_compiler_pic='-PIC'
+ lt_prog_compiler_static='-Bstatic'
+ ;;
+
+ sysv4 | sysv4.2uw2* | sysv4.3*)
+ lt_prog_compiler_wl='-Wl,'
+ lt_prog_compiler_pic='-KPIC'
+ lt_prog_compiler_static='-Bstatic'
+ ;;
+
+ sysv4*MP*)
+ if test -d /usr/nec ;then
+ lt_prog_compiler_pic='-Kconform_pic'
+ lt_prog_compiler_static='-Bstatic'
+ fi
+ ;;
+
+ sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*)
+ lt_prog_compiler_wl='-Wl,'
+ lt_prog_compiler_pic='-KPIC'
+ lt_prog_compiler_static='-Bstatic'
+ ;;
+
+ unicos*)
+ lt_prog_compiler_wl='-Wl,'
+ lt_prog_compiler_can_build_shared=no
+ ;;
+
+ uts4*)
+ lt_prog_compiler_pic='-pic'
+ lt_prog_compiler_static='-Bstatic'
+ ;;
+
+ *)
+ lt_prog_compiler_can_build_shared=no
;;
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
+case $host_os in
+ # For platforms which do not support PIC, -DPIC is meaningless:
+ *djgpp*)
+ lt_prog_compiler_pic=
+ ;;
+ *)
+ lt_prog_compiler_pic="$lt_prog_compiler_pic -DPIC"
+ ;;
+esac
+echo "$as_me:$LINENO: result: $lt_prog_compiler_pic" >&5
+echo "${ECHO_T}$lt_prog_compiler_pic" >&6
- 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
+
+
+
+#
+# Check to make sure the PIC flag actually works.
+#
+if test -n "$lt_prog_compiler_pic"; then
+ echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic works" >&5
+echo $ECHO_N "checking if $compiler PIC flag $lt_prog_compiler_pic works... $ECHO_C" >&6
+if test "${lt_prog_compiler_pic_works+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ lt_prog_compiler_pic_works=no
+ ac_outfile=conftest.$ac_objext
+ echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+ lt_compiler_flag="$lt_prog_compiler_pic -DPIC"
+ # Insert the option either (1) after the last *FLAGS variable, or
+ # (2) before a word containing "conftest.", or (3) at the end.
+ # Note that $ac_compile itself does not contain backslashes and begins
+ # with a dollar sign (not a hyphen), so the echo should work correctly.
+ # The option is referenced via a variable to avoid confusing sed.
+ lt_compile=`echo "$ac_compile" | $SED \
+ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
+ -e 's:$: $lt_compiler_flag:'`
+ (eval echo "\"\$as_me:7151: $lt_compile\"" >&5)
+ (eval "$lt_compile" 2>conftest.err)
+ ac_status=$?
+ cat conftest.err >&5
+ echo "$as_me:7155: \$? = $ac_status" >&5
+ if (exit $ac_status) && test -s "$ac_outfile"; then
+ # The compiler can only warn and ignore the option if not recognized
+ # So say no if there are warnings other than the usual output.
+ $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp
+ $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+ if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then
+ lt_prog_compiler_pic_works=yes
+ fi
+ fi
+ $RM conftest*
+
+fi
+echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_works" >&5
+echo "${ECHO_T}$lt_prog_compiler_pic_works" >&6
+
+if test x"$lt_prog_compiler_pic_works" = xyes; then
+ case $lt_prog_compiler_pic in
+ "" | " "*) ;;
+ *) lt_prog_compiler_pic=" $lt_prog_compiler_pic" ;;
+ esac
else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- lt_cv_cc_needs_belf=no
+ lt_prog_compiler_pic=
+ lt_prog_compiler_can_build_shared=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.
+# Check to make sure the static flag actually works.
#
-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
-
+wl=$lt_prog_compiler_wl eval lt_tmp_static_flag=\"$lt_prog_compiler_static\"
+echo "$as_me:$LINENO: checking if $compiler static flag $lt_tmp_static_flag works" >&5
+echo $ECHO_N "checking if $compiler static flag $lt_tmp_static_flag works... $ECHO_C" >&6
+if test "${lt_prog_compiler_static_works+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ lt_prog_compiler_static_works=no
+ save_LDFLAGS="$LDFLAGS"
+ LDFLAGS="$LDFLAGS $lt_tmp_static_flag"
+ echo "$lt_simple_link_test_code" > conftest.$ac_ext
+ if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then
+ # The linker can only warn and ignore the option if not recognized
+ # So say no if there are warnings
+ if test -s conftest.err; then
+ # Append any errors to the config.log.
+ cat conftest.err 1>&5
+ $ECHO "X$_lt_linker_boilerplate" | $Xsed -e '/^$/d' > conftest.exp
+ $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+ if diff conftest.exp conftest.er2 >/dev/null; then
+ lt_prog_compiler_static_works=yes
+ fi
+ else
+ lt_prog_compiler_static_works=yes
+ fi
+ fi
+ $RM conftest*
+ LDFLAGS="$save_LDFLAGS"
-# 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; }
+fi
+echo "$as_me:$LINENO: result: $lt_prog_compiler_static_works" >&5
+echo "${ECHO_T}$lt_prog_compiler_static_works" >&6
-# Reload cache, that may have been modified by ltconfig
-if test -r "$cache_file"; then
- echo "loading cache $cache_file"
- . $cache_file
+if test x"$lt_prog_compiler_static_works" = xyes; then
+ :
else
- echo "creating cache $cache_file"
- > $cache_file
+ lt_prog_compiler_static=
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
+ echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5
+echo $ECHO_N "checking if $compiler supports -c -o file.$ac_objext... $ECHO_C" >&6
+if test "${lt_cv_prog_compiler_c_o+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
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
+ lt_cv_prog_compiler_c_o=no
+ $RM -r conftest 2>/dev/null
+ mkdir conftest
+ cd conftest
+ mkdir out
+ echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+ lt_compiler_flag="-o out/conftest2.$ac_objext"
+ # Insert the option either (1) after the last *FLAGS variable, or
+ # (2) before a word containing "conftest.", or (3) at the end.
+ # Note that $ac_compile itself does not contain backslashes and begins
+ # with a dollar sign (not a hyphen), so the echo should work correctly.
+ lt_compile=`echo "$ac_compile" | $SED \
+ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
+ -e 's:$: $lt_compiler_flag:'`
+ (eval echo "\"\$as_me:7256: $lt_compile\"" >&5)
+ (eval "$lt_compile" 2>out/conftest.err)
+ ac_status=$?
+ cat out/conftest.err >&5
+ echo "$as_me:7260: \$? = $ac_status" >&5
+ if (exit $ac_status) && test -s out/conftest2.$ac_objext
+ then
+ # The compiler can only warn and ignore the option if not recognized
+ # So say no if there are warnings
+ $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp
+ $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2
+ if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then
+ lt_cv_prog_compiler_c_o=yes
+ fi
+ fi
+ chmod u+w . 2>&5
+ $RM conftest*
+ # SGI C++ compiler will create directory out/ii_files/ for
+ # template instantiation
+ test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files
+ $RM out/* && rmdir out
+ cd ..
+ $RM -r conftest
+ $RM conftest*
+
+fi
+echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o" >&5
+echo "${ECHO_T}$lt_cv_prog_compiler_c_o" >&6
+
+
+
+
+
+
+ echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5
+echo $ECHO_N "checking if $compiler supports -c -o file.$ac_objext... $ECHO_C" >&6
+if test "${lt_cv_prog_compiler_c_o+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ lt_cv_prog_compiler_c_o=no
+ $RM -r conftest 2>/dev/null
+ mkdir conftest
+ cd conftest
+ mkdir out
+ echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+ lt_compiler_flag="-o out/conftest2.$ac_objext"
+ # Insert the option either (1) after the last *FLAGS variable, or
+ # (2) before a word containing "conftest.", or (3) at the end.
+ # Note that $ac_compile itself does not contain backslashes and begins
+ # with a dollar sign (not a hyphen), so the echo should work correctly.
+ lt_compile=`echo "$ac_compile" | $SED \
+ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
+ -e 's:$: $lt_compiler_flag:'`
+ (eval echo "\"\$as_me:7311: $lt_compile\"" >&5)
+ (eval "$lt_compile" 2>out/conftest.err)
+ ac_status=$?
+ cat out/conftest.err >&5
+ echo "$as_me:7315: \$? = $ac_status" >&5
+ if (exit $ac_status) && test -s out/conftest2.$ac_objext
+ then
+ # The compiler can only warn and ignore the option if not recognized
+ # So say no if there are warnings
+ $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp
+ $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2
+ if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then
+ lt_cv_prog_compiler_c_o=yes
+ fi
+ fi
+ chmod u+w . 2>&5
+ $RM conftest*
+ # SGI C++ compiler will create directory out/ii_files/ for
+ # template instantiation
+ test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files
+ $RM out/* && rmdir out
+ cd ..
+ $RM -r conftest
+ $RM conftest*
+
+fi
+echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o" >&5
+echo "${ECHO_T}$lt_cv_prog_compiler_c_o" >&6
+
+
+
+
+hard_links="nottested"
+if test "$lt_cv_prog_compiler_c_o" = no && test "$need_locks" != no; then
+ # do not overwrite the value of need_locks provided by the user
+ echo "$as_me:$LINENO: checking if we can lock with hard links" >&5
+echo $ECHO_N "checking if we can lock with hard links... $ECHO_C" >&6
+ hard_links=yes
+ $RM conftest*
+ ln conftest.a conftest.b 2>/dev/null && hard_links=no
+ touch conftest.a
+ ln conftest.a conftest.b 2>&5 || hard_links=no
+ ln conftest.a conftest.b 2>/dev/null && hard_links=no
+ echo "$as_me:$LINENO: result: $hard_links" >&5
+echo "${ECHO_T}$hard_links" >&6
+ if test "$hard_links" = no; then
+ { echo "$as_me:$LINENO: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5
+echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;}
+ need_locks=warn
+ fi
else
- want_mmap=false
-fi
+ need_locks=no
+fi
+
+
+
+
+
+
+ echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5
+echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6
+
+ runpath_var=
+ allow_undefined_flag=
+ always_export_symbols=no
+ archive_cmds=
+ archive_expsym_cmds=
+ compiler_needs_object=no
+ enable_shared_with_static_runtimes=no
+ export_dynamic_flag_spec=
+ export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
+ hardcode_automatic=no
+ hardcode_direct=no
+ hardcode_direct_absolute=no
+ hardcode_libdir_flag_spec=
+ hardcode_libdir_flag_spec_ld=
+ hardcode_libdir_separator=
+ hardcode_minus_L=no
+ hardcode_shlibpath_var=unsupported
+ inherit_rpath=no
+ link_all_deplibs=unknown
+ module_cmds=
+ module_expsym_cmds=
+ old_archive_from_new_cmds=
+ old_archive_from_expsyms_cmds=
+ thread_safe_flag_spec=
+ whole_archive_flag_spec=
+ # include_expsyms should be a list of space-separated symbols to be *always*
+ # included in the symbol list
+ include_expsyms=
+ # exclude_expsyms can be an extended regexp of symbols to exclude
+ # it will be wrapped by ` (' and `)$', so one must not match beginning or
+ # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc',
+ # as well as any symbol that contains `d'.
+ exclude_expsyms="_GLOBAL_OFFSET_TABLE_"
+ # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out
+ # platforms (ab)use it in PIC code, but their linkers get confused if
+ # the symbol is explicitly referenced. Since portable code cannot
+ # rely on this symbol name, it's probably fine to never include it in
+ # preloaded symbol tables.
+ extract_expsyms_cmds=
-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
+ case $host_os in
+ cygwin* | mingw* | pw32*)
+ # FIXME: the MSVC++ port hasn't been tested in a loooong time
+ # When not using gcc, we currently assume that we are using
+ # Microsoft Visual C++.
+ if test "$GCC" != yes; then
+ with_gnu_ld=no
+ fi
+ ;;
+ interix*)
+ # we just hope/assume this is gcc and not c89 (= MSVC++)
+ with_gnu_ld=yes
+ ;;
+ openbsd*)
+ with_gnu_ld=no
+ ;;
+ esac
+ ld_shlibs=yes
+ if test "$with_gnu_ld" = yes; then
+ # If archive_cmds runs LD, not CC, wlarc should be empty
+ wlarc='${wl}'
+
+ # Set some defaults for GNU ld with shared library support. These
+ # are reset later if shared libraries are not supported. Putting them
+ # here allows them to be overridden if necessary.
+ runpath_var=LD_RUN_PATH
+ hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+ export_dynamic_flag_spec='${wl}--export-dynamic'
+ # ancient GNU ld didn't support --whole-archive et. al.
+ if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then
+ whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+ else
+ whole_archive_flag_spec=
+ fi
+ supports_anon_versioning=no
+ case `$LD -v 2>&1` in
+ *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11
+ *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ...
+ *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ...
+ *\ 2.11.*) ;; # other 2.11 versions
+ *) supports_anon_versioning=yes ;;
+ esac
+ # See if GNU ld supports shared libraries.
+ case $host_os in
+ aix3* | aix4* | aix5*)
+ # On AIX/PPC, the GNU linker is very broken
+ if test "$host_cpu" != ia64; then
+ ld_shlibs=no
+ cat <<_LT_EOF 1>&2
+
+*** Warning: the GNU linker, at least up to release 2.9.1, is reported
+*** to be unable to reliably create shared libraries on AIX.
+*** Therefore, libtool is disabling shared libraries support. If you
+*** really care for shared libraries, you may want to modify your PATH
+*** so that a non-GNU linker is found, and then restart.
+
+_LT_EOF
+ fi
+ ;;
+ amigaos*)
+ if test "$host_cpu" = m68k; then
+ archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
+ hardcode_libdir_flag_spec='-L$libdir'
+ hardcode_minus_L=yes
+ fi
+ # Samuel A. Falvo II <kc5tja@dolphin.openprojects.net> reports
+ # that the semantics of dynamic libraries on AmigaOS, at least up
+ # to version 4, is to share data among multiple programs linked
+ # with the same dynamic library. Since this doesn't match the
+ # behavior of shared libraries on other platforms, we can't use
+ # them.
+ ld_shlibs=no
+ ;;
+ beos*)
+ if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
+ allow_undefined_flag=unsupported
+ # Joseph Beckenbach <jrb3@best.com> says some releases of gcc
+ # support --undefined. This deserves some investigation. FIXME
+ archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ else
+ ld_shlibs=no
+ fi
+ ;;
-if test -z "$target" ; then
- { echo "configure: error: Unrecognized target system type; please check config.sub." 1>&2; exit 1; }
-fi
+ cygwin* | mingw* | pw32*)
+ # _LT_TAGVAR(hardcode_libdir_flag_spec, ) is actually meaningless,
+ # as there is no search path for DLLs.
+ hardcode_libdir_flag_spec='-L$libdir'
+ allow_undefined_flag=unsupported
+ always_export_symbols=no
+ enable_shared_with_static_runtimes=yes
+ export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/'\'' | $SED -e '\''/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols'
+
+ if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then
+ archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+ # If the export-symbols file already is a .def file (1st line
+ # is EXPORTS), use it as is; otherwise, prepend...
+ archive_expsym_cmds='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
+ cp $export_symbols $output_objdir/$soname.def;
+ else
+ echo EXPORTS > $output_objdir/$soname.def;
+ cat $export_symbols >> $output_objdir/$soname.def;
+ fi~
+ $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+ else
+ ld_shlibs=no
+ 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
+ interix[3-9]*)
+ hardcode_direct=no
+ hardcode_shlibpath_var=no
+ hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
+ export_dynamic_flag_spec='${wl}-E'
+ # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc.
+ # Instead, shared libraries are loaded at an image base (0x10000000 by
+ # default) and relocated if they conflict, which is a slow very memory
+ # consuming and fragmenting process. To avoid this, we pick a random,
+ # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link
+ # time. Moving up from 0x10000000 also allows more sbrk(2) space.
+ archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+ archive_expsym_cmds='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+ ;;
- echo "$ac_t""$USE_MAINTAINER_MODE" 1>&6
-
+ gnu* | linux* | tpf* | k*bsd*-gnu)
+ tmp_diet=no
+ if test "$host_os" = linux-dietlibc; then
+ case $cc_basename in
+ diet\ *) tmp_diet=yes;; # linux-dietlibc with static linking (!diet-dyn)
+ esac
+ fi
+ if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \
+ && test "$tmp_diet" = no
+ then
+ tmp_addflag=
+ case $cc_basename,$host_cpu in
+ pgcc*) # Portland Group C compiler
+ whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive'
+ tmp_addflag=' $pic_flag'
+ ;;
+ pgf77* | pgf90* | pgf95*) # Portland Group f77 and f90 compilers
+ whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive'
+ tmp_addflag=' $pic_flag -Mnomain' ;;
+ ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64
+ tmp_addflag=' -i_dynamic' ;;
+ efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64
+ tmp_addflag=' -i_dynamic -nofor_main' ;;
+ ifc* | ifort*) # Intel Fortran compiler
+ tmp_addflag=' -nofor_main' ;;
+ esac
+ case `$CC -V 2>&1 | sed 5q` in
+ *Sun\ C*) # Sun C 5.9
+ whole_archive_flag_spec='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive'
+ compiler_needs_object=yes
+ tmp_sharedflag='-G' ;;
+ *Sun\ F*) # Sun Fortran 8.3
+ tmp_sharedflag='-G' ;;
+ *)
+ tmp_sharedflag='-shared' ;;
+ esac
+ archive_cmds='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
-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
-
+ if test "x$supports_anon_versioning" = xyes; then
+ archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~
+ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
+ echo "local: *; };" >> $output_objdir/$libname.ver~
+ $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib'
+ fi
+ else
+ ld_shlibs=no
+ fi
+ ;;
-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
+ netbsd*)
+ if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
+ archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib'
+ wlarc=
else
- install_libbfd_p=no
+ archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
fi
-fi
+ ;;
- echo "$ac_t""$install_libbfd_p" 1>&6
-
+ solaris*)
+ if $LD -v 2>&1 | $GREP 'BFD 2\.8' > /dev/null; then
+ ld_shlibs=no
+ cat <<_LT_EOF 1>&2
+
+*** Warning: The releases 2.8.* of the GNU linker cannot reliably
+*** create shared libraries on Solaris systems. Therefore, libtool
+*** is disabling shared libraries support. We urge you to upgrade GNU
+*** binutils to release 2.9.1 or newer. Another option is to modify
+*** your PATH or compiler configuration so that the native linker is
+*** used, and then restart.
+
+_LT_EOF
+ elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
+ archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+ else
+ ld_shlibs=no
+ fi
+ ;;
-if test $install_libbfd_p = yes; then
- INSTALL_LIBBFD_TRUE=
- INSTALL_LIBBFD_FALSE='#'
-else
- INSTALL_LIBBFD_TRUE='#'
- INSTALL_LIBBFD_FALSE=
+ sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*)
+ case `$LD -v 2>&1` in
+ *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*)
+ ld_shlibs=no
+ cat <<_LT_EOF 1>&2
+
+*** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not
+*** reliably create shared libraries on SCO systems. Therefore, libtool
+*** is disabling shared libraries support. We urge you to upgrade GNU
+*** binutils to release 2.16.91.0.3 or newer. Another option is to modify
+*** your PATH or compiler configuration so that the native linker is
+*** used, and then restart.
+
+_LT_EOF
+ ;;
+ *)
+ # For security reasons, it is highly recommended that you always
+ # use absolute paths for naming shared libraries, and exclude the
+ # DT_RUNPATH tag from executables and libraries. But doing so
+ # requires that you compile everything twice, which is a pain.
+ if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
+ hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+ archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+ else
+ ld_shlibs=no
+ fi
+ ;;
+ esac
+ ;;
+
+ sunos4*)
+ archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+ wlarc=
+ hardcode_direct=yes
+ hardcode_shlibpath_var=no
+ ;;
+
+ *)
+ if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
+ archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+ else
+ ld_shlibs=no
+ fi
+ ;;
+ esac
+
+ if test "$ld_shlibs" = no; then
+ runpath_var=
+ hardcode_libdir_flag_spec=
+ export_dynamic_flag_spec=
+ whole_archive_flag_spec=
+ fi
+ else
+ # PORTME fill in a description of your system's linker (not GNU ld)
+ case $host_os in
+ aix3*)
+ allow_undefined_flag=unsupported
+ always_export_symbols=yes
+ archive_expsym_cmds='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname'
+ # Note: this linker hardcodes the directories in LIBPATH if there
+ # are no directories specified by -L.
+ hardcode_minus_L=yes
+ if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then
+ # Neither direct hardcoding nor static linking is supported with a
+ # broken collect2.
+ hardcode_direct=unsupported
+ fi
+ ;;
+
+ aix4* | aix5*)
+ if test "$host_cpu" = ia64; then
+ # On IA64, the linker does run time linking by default, so we don't
+ # have to do anything special.
+ aix_use_runtimelinking=no
+ exp_sym_flag='-Bexport'
+ no_entry_flag=""
+ else
+ # If we're using GNU nm, then we don't want the "-C" option.
+ # -C means demangle to AIX nm, but means don't demangle with GNU nm
+ if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then
+ export_symbols_cmds='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
+ else
+ export_symbols_cmds='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
+ fi
+ aix_use_runtimelinking=no
+
+ # Test if we are trying to use run time linking or normal
+ # AIX style linking. If -brtl is somewhere in LDFLAGS, we
+ # need to do runtime linking.
+ case $host_os in aix4.[23]|aix4.[23].*|aix5*)
+ for ld_flag in $LDFLAGS; do
+ if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then
+ aix_use_runtimelinking=yes
+ break
+ fi
+ done
+ ;;
+ esac
+
+ exp_sym_flag='-bexport'
+ no_entry_flag='-bnoentry'
+ fi
+
+ # When large executables or shared objects are built, AIX ld can
+ # have problems creating the table of contents. If linking a library
+ # or program results in "error TOC overflow" add -mminimal-toc to
+ # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not
+ # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS.
+
+ archive_cmds=''
+ hardcode_direct=yes
+ hardcode_direct_absolute=yes
+ hardcode_libdir_separator=':'
+ link_all_deplibs=yes
+ file_list_spec='${wl}-f,'
+
+ if test "$GCC" = yes; then
+ case $host_os in aix4.[012]|aix4.[012].*)
+ # We only want to do this on AIX 4.2 and lower, the check
+ # below for broken collect2 doesn't work under 4.3+
+ collect2name=`${CC} -print-prog-name=collect2`
+ if test -f "$collect2name" &&
+ strings "$collect2name" | $GREP resolve_lib_name >/dev/null
+ then
+ # We have reworked collect2
+ :
+ else
+ # We have old collect2
+ hardcode_direct=unsupported
+ # It fails to find uninstalled libraries when the uninstalled
+ # path is not listed in the libpath. Setting hardcode_minus_L
+ # to unsupported forces relinking
+ hardcode_minus_L=yes
+ hardcode_libdir_flag_spec='-L$libdir'
+ hardcode_libdir_separator=
+ fi
+ ;;
+ esac
+ shared_flag='-shared'
+ if test "$aix_use_runtimelinking" = yes; then
+ shared_flag="$shared_flag "'${wl}-G'
+ fi
+ else
+ # not using gcc
+ if test "$host_cpu" = ia64; then
+ # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release
+ # chokes on -Wl,-G. The following line is correct:
+ shared_flag='-G'
+ else
+ if test "$aix_use_runtimelinking" = yes; then
+ shared_flag='${wl}-G'
+ else
+ shared_flag='${wl}-bM:SRE'
+ fi
+ fi
+ fi
+
+ # It seems that -bexpall does not export symbols beginning with
+ # underscore (_), so it is better to generate a list of symbols to export.
+ always_export_symbols=yes
+ if test "$aix_use_runtimelinking" = yes; then
+ # Warning - without using the other runtime loading flags (-brtl),
+ # -berok will link without error, but may produce a broken library.
+ allow_undefined_flag='-berok'
+ # Determine the default libpath from the value encoded in an
+ # empty executable.
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+
+lt_aix_libpath_sed='
+ /Import File Strings/,/^$/ {
+ /^0/ {
+ s/^0 *\(.*\)$/\1/
+ p
+ }
+ }'
+aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+# Check for a 64-bit object if we didn't find anything.
+if test -z "$aix_libpath"; then
+ aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+fi
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
+
+ hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
+ archive_expsym_cmds='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then $ECHO "X${wl}${allow_undefined_flag}" | $Xsed; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
+ else
+ if test "$host_cpu" = ia64; then
+ hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib'
+ allow_undefined_flag="-z nodefs"
+ archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols"
+ else
+ # Determine the default libpath from the value encoded in an
+ # empty executable.
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+
+lt_aix_libpath_sed='
+ /Import File Strings/,/^$/ {
+ /^0/ {
+ s/^0 *\(.*\)$/\1/
+ p
+ }
+ }'
+aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+# Check for a 64-bit object if we didn't find anything.
+if test -z "$aix_libpath"; then
+ aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+fi
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
+
+ hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
+ # Warning - without using the other run time loading flags,
+ # -berok will link without error, but may produce a broken library.
+ no_undefined_flag=' ${wl}-bernotok'
+ allow_undefined_flag=' ${wl}-berok'
+ # Exported symbols can be pulled into shared objects from archives
+ whole_archive_flag_spec='$convenience'
+ archive_cmds_need_lc=yes
+ # This is similar to how AIX traditionally builds its shared libraries.
+ archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname'
+ fi
+ fi
+ ;;
+
+ amigaos*)
+ if test "$host_cpu" = m68k; then
+ archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
+ hardcode_libdir_flag_spec='-L$libdir'
+ hardcode_minus_L=yes
+ fi
+ # see comment about different semantics on the GNU ld section
+ ld_shlibs=no
+ ;;
+
+ bsdi[45]*)
+ export_dynamic_flag_spec=-rdynamic
+ ;;
+
+ cygwin* | mingw* | pw32*)
+ # When not using gcc, we currently assume that we are using
+ # Microsoft Visual C++.
+ # hardcode_libdir_flag_spec is actually meaningless, as there is
+ # no search path for DLLs.
+ hardcode_libdir_flag_spec=' '
+ allow_undefined_flag=unsupported
+ # Tell ltmain to make .lib files, not .a files.
+ libext=lib
+ # Tell ltmain to make .dll files, not .so files.
+ shrext_cmds=".dll"
+ # FIXME: Setting linknames here is a bad hack.
+ archive_cmds='$CC -o $lib $libobjs $compiler_flags `$ECHO "X$deplibs" | $Xsed -e '\''s/ -lc$//'\''` -link -dll~linknames='
+ # The linker will automatically build a .lib file if we build a DLL.
+ old_archive_from_new_cmds='true'
+ # FIXME: Should let the user specify the lib program.
+ old_archive_cmds='lib -OUT:$oldlib$oldobjs$old_deplibs'
+ fix_srcfile_path='`cygpath -w "$srcfile"`'
+ enable_shared_with_static_runtimes=yes
+ ;;
+
+ darwin* | rhapsody*)
+ case $host_os in
+ rhapsody* | darwin1.[012])
+ allow_undefined_flag='${wl}-undefined ${wl}suppress'
+ ;;
+ *) # Darwin 1.3 on
+ case ${MACOSX_DEPLOYMENT_TARGET-10.0} in
+ 10.[012])
+ allow_undefined_flag='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
+ ;;
+ 10.*)
+ allow_undefined_flag='${wl}-undefined ${wl}dynamic_lookup'
+ ;;
+ esac
+ ;;
+ esac
+ archive_cmds_need_lc=no
+ hardcode_direct=no
+ hardcode_automatic=yes
+ hardcode_shlibpath_var=unsupported
+ whole_archive_flag_spec=''
+ link_all_deplibs=yes
+ if test "$GCC" = yes ; then
+ if test "${lt_cv_apple_cc_single_mod+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ lt_cv_apple_cc_single_mod=no
+ if test -z "${LT_MULTI_MODULE}"; then
+ # By default we will add the -single_module flag. You can override
+ # by either setting the environment variable LT_MULTI_MODULE
+ # non-empty at configure time, or by adding -multi-module to the
+ # link flags.
+ echo "int foo(void){return 1;}" > conftest.c
+ $LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \
+ -dynamiclib ${wl}-single_module conftest.c
+ if test -f libconftest.dylib; then
+ lt_cv_apple_cc_single_mod=yes
+ rm libconftest.dylib
+ fi
+ rm conftest.$ac_ext
+ fi
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
-
-
+ output_verbose_link_cmd=echo
+ if test "X$lt_cv_apple_cc_single_mod" = Xyes ; then
+ archive_cmds='$CC -dynamiclib $single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring'
+ archive_expsym_cmds='sed "s,^,_," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $single_module -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+ else
+ archive_cmds='$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring'
+ archive_expsym_cmds='sed "s,^,_," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+ fi
+ module_cmds='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags'
+ module_expsym_cmds='sed -e "s,^,_," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+ else
+ case $cc_basename in
+ xlc*)
+ output_verbose_link_cmd=echo
+ archive_cmds='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`$ECHO $rpath/$soname` $verstring'
+ module_cmds='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags'
+ # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds
+ archive_expsym_cmds='sed "s,^,_," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+ module_expsym_cmds='sed "s,^,_," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+ ;;
+ *)
+ ld_shlibs=no
+ ;;
+ esac
+ fi
+ ;;
+ dgux*)
+ archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ hardcode_libdir_flag_spec='-L$libdir'
+ hardcode_shlibpath_var=no
+ ;;
+ freebsd1*)
+ ld_shlibs=no
+ ;;
-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//` ;;
+ # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor
+ # support. Future versions do this automatically, but an explicit c++rt0.o
+ # does not break anything, and helps significantly (at the cost of a little
+ # extra space).
+ freebsd2.2*)
+ archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o'
+ hardcode_libdir_flag_spec='-R$libdir'
+ hardcode_direct=yes
+ hardcode_shlibpath_var=no
+ ;;
+
+ # Unfortunately, older versions of FreeBSD 2 do not have this feature.
+ freebsd2*)
+ archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+ hardcode_direct=yes
+ hardcode_minus_L=yes
+ hardcode_shlibpath_var=no
+ ;;
+
+ # FreeBSD 3 and greater uses gcc -shared to do shared libraries.
+ freebsd* | dragonfly*)
+ archive_cmds='$CC -shared -o $lib $libobjs $deplibs $compiler_flags'
+ hardcode_libdir_flag_spec='-R$libdir'
+ hardcode_direct=yes
+ hardcode_shlibpath_var=no
+ ;;
+
+ hpux9*)
+ if test "$GCC" = yes; then
+ archive_cmds='$RM $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+ else
+ archive_cmds='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+ fi
+ hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
+ hardcode_libdir_separator=:
+ hardcode_direct=yes
+
+ # hardcode_minus_L: Not really in the search PATH,
+ # but as the default location of the library.
+ hardcode_minus_L=yes
+ export_dynamic_flag_spec='${wl}-E'
+ ;;
+
+ hpux10*)
+ if test "$GCC" = yes -a "$with_gnu_ld" = no; then
+ archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+ else
+ archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'
+ fi
+ if test "$with_gnu_ld" = no; then
+ hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
+ hardcode_libdir_flag_spec_ld='+b $libdir'
+ hardcode_libdir_separator=:
+ hardcode_direct=yes
+ hardcode_direct_absolute=yes
+ export_dynamic_flag_spec='${wl}-E'
+ # hardcode_minus_L: Not really in the search PATH,
+ # but as the default location of the library.
+ hardcode_minus_L=yes
+ fi
+ ;;
+
+ hpux11*)
+ if test "$GCC" = yes -a "$with_gnu_ld" = no; then
+ case $host_cpu in
+ hppa*64*)
+ archive_cmds='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+ ;;
+ ia64*)
+ archive_cmds='$CC -shared ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
+ ;;
+ *)
+ archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+ ;;
+ esac
+ else
+ case $host_cpu in
+ hppa*64*)
+ archive_cmds='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+ ;;
+ ia64*)
+ archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
+ ;;
+ *)
+ archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+ ;;
+ esac
+ fi
+ if test "$with_gnu_ld" = no; then
+ hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
+ hardcode_libdir_separator=:
+
+ case $host_cpu in
+ hppa*64*|ia64*)
+ hardcode_direct=no
+ hardcode_shlibpath_var=no
+ ;;
+ *)
+ hardcode_direct=yes
+ hardcode_direct_absolute=yes
+ export_dynamic_flag_spec='${wl}-E'
+
+ # hardcode_minus_L: Not really in the search PATH,
+ # but as the default location of the library.
+ hardcode_minus_L=yes
+ ;;
+ esac
+ fi
+ ;;
+
+ irix5* | irix6* | nonstopux*)
+ if test "$GCC" = yes; then
+ archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+ # Try to use the -exported_symbol ld option, if it does not
+ # work, assume that -exports_file does not work either and
+ # implicitly export all symbols.
+ save_LDFLAGS="$LDFLAGS"
+ LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null"
+ cat >conftest.$ac_ext <<_ACEOF
+int foo(void) {}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib'
+
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+ LDFLAGS="$save_LDFLAGS"
+ else
+ archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib'
+ archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib'
+ fi
+ archive_cmds_need_lc='no'
+ hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+ hardcode_libdir_separator=:
+ inherit_rpath=yes
+ link_all_deplibs=yes
+ ;;
+
+ netbsd*)
+ if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
+ archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out
+ else
+ archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF
+ fi
+ hardcode_libdir_flag_spec='-R$libdir'
+ hardcode_direct=yes
+ hardcode_shlibpath_var=no
+ ;;
+
+ newsos6)
+ archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ hardcode_direct=yes
+ hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+ hardcode_libdir_separator=:
+ hardcode_shlibpath_var=no
+ ;;
+
+ *nto* | *qnx*)
+ ;;
+
+ openbsd*)
+ hardcode_direct=yes
+ hardcode_shlibpath_var=no
+ hardcode_direct_absolute=yes
+ if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+ archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+ archive_expsym_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols'
+ hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
+ export_dynamic_flag_spec='${wl}-E'
+ else
+ case $host_os in
+ openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*)
+ archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+ hardcode_libdir_flag_spec='-R$libdir'
+ ;;
+ *)
+ archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+ hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
+ ;;
+ esac
+ fi
+ ;;
+
+ os2*)
+ hardcode_libdir_flag_spec='-L$libdir'
+ hardcode_minus_L=yes
+ allow_undefined_flag=unsupported
+ archive_cmds='$ECHO "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$ECHO DATA >> $output_objdir/$libname.def~$ECHO " SINGLE NONSHARED" >> $output_objdir/$libname.def~$ECHO EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def'
+ old_archive_from_new_cmds='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def'
+ ;;
+
+ osf3*)
+ if test "$GCC" = yes; then
+ allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
+ archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+ else
+ allow_undefined_flag=' -expect_unresolved \*'
+ archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib'
+ fi
+ archive_cmds_need_lc='no'
+ hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+ hardcode_libdir_separator=:
+ ;;
+
+ osf4* | osf5*) # as osf3* with the addition of -msym flag
+ if test "$GCC" = yes; then
+ allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
+ archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+ hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+ else
+ allow_undefined_flag=' -expect_unresolved \*'
+ archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib'
+ archive_expsym_cmds='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~
+ $CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp'
+
+ # Both c and cxx compiler support -rpath directly
+ hardcode_libdir_flag_spec='-rpath $libdir'
+ fi
+ archive_cmds_need_lc='no'
+ hardcode_libdir_separator=:
+ ;;
+
+ solaris*)
+ no_undefined_flag=' -z defs'
+ if test "$GCC" = yes; then
+ wlarc='${wl}'
+ archive_cmds='$CC -shared ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+ archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
+ $CC -shared ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp'
+ else
+ case `$CC -V 2>&1` in
+ *"Compilers 5.0"*)
+ wlarc=''
+ archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
+ $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp'
+ ;;
+ *)
+ wlarc='${wl}'
+ archive_cmds='$CC -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $compiler_flags'
+ archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
+ $CC -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp'
+ ;;
+ esac
+ fi
+ hardcode_libdir_flag_spec='-R$libdir'
+ hardcode_shlibpath_var=no
+ case $host_os in
+ solaris2.[0-5] | solaris2.[0-5].*) ;;
+ *)
+ # The compiler driver will combine and reorder linker options,
+ # but understands `-z linker_flag'. GCC discards it without `$wl',
+ # but is careful enough not to reorder.
+ # Supported since Solaris 2.6 (maybe 2.5.1?)
+ if test "$GCC" = yes; then
+ whole_archive_flag_spec='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract'
+ else
+ whole_archive_flag_spec='-z allextract$convenience -z defaultextract'
+ fi
+ ;;
esac
- done
- else
- { echo "configure: error: installation or configuration problem: compiler cannot create executables." 1>&2; exit 1; }
+ link_all_deplibs=yes
+ ;;
+
+ sunos4*)
+ if test "x$host_vendor" = xsequent; then
+ # Use $CC to link under sequent, because it throws in some extra .o
+ # files that make .init and .fini sections work.
+ archive_cmds='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags'
+ else
+ archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags'
+ fi
+ hardcode_libdir_flag_spec='-L$libdir'
+ hardcode_direct=yes
+ hardcode_minus_L=yes
+ hardcode_shlibpath_var=no
+ ;;
+
+ sysv4)
+ case $host_vendor in
+ sni)
+ archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ hardcode_direct=yes # is this really true???
+ ;;
+ siemens)
+ ## LD is ld it makes a PLAMLIB
+ ## CC just makes a GrossModule.
+ archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags'
+ reload_cmds='$CC -r -o $output$reload_objs'
+ hardcode_direct=no
+ ;;
+ motorola)
+ archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ hardcode_direct=no #Motorola manual says yes, but my tests say they lie
+ ;;
+ esac
+ runpath_var='LD_RUN_PATH'
+ hardcode_shlibpath_var=no
+ ;;
+
+ sysv4.3*)
+ archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ hardcode_shlibpath_var=no
+ export_dynamic_flag_spec='-Bexport'
+ ;;
+
+ sysv4*MP*)
+ if test -d /usr/nec; then
+ archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ hardcode_shlibpath_var=no
+ runpath_var=LD_RUN_PATH
+ hardcode_runpath_var=yes
+ ld_shlibs=yes
+ fi
+ ;;
+
+ sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*)
+ no_undefined_flag='${wl}-z,text'
+ archive_cmds_need_lc=no
+ hardcode_shlibpath_var=no
+ runpath_var='LD_RUN_PATH'
+
+ if test "$GCC" = yes; then
+ archive_cmds='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ archive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ else
+ archive_cmds='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ archive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ fi
+ ;;
+
+ sysv5* | sco3.2v5* | sco5v6*)
+ # Note: We can NOT use -z defs as we might desire, because we do not
+ # link with -lc, and that would cause any symbols used from libc to
+ # always be unresolved, which means just about no library would
+ # ever link correctly. If we're not using GNU ld we use -z text
+ # though, which does catch some bad symbols but isn't as heavy-handed
+ # as -z defs.
+ no_undefined_flag='${wl}-z,text'
+ allow_undefined_flag='${wl}-z,nodefs'
+ archive_cmds_need_lc=no
+ hardcode_shlibpath_var=no
+ hardcode_libdir_flag_spec='${wl}-R,$libdir'
+ hardcode_libdir_separator=':'
+ link_all_deplibs=yes
+ export_dynamic_flag_spec='${wl}-Bexport'
+ runpath_var='LD_RUN_PATH'
+
+ if test "$GCC" = yes; then
+ archive_cmds='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ archive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ else
+ archive_cmds='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ archive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ fi
+ ;;
+
+ uts4*)
+ archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ hardcode_libdir_flag_spec='-L$libdir'
+ hardcode_shlibpath_var=no
+ ;;
+
+ *)
+ ld_shlibs=no
+ ;;
+ esac
+
+ if test x$host_vendor = xsni; then
+ case $host in
+ sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
+ export_dynamic_flag_spec='${wl}-Blargedynsym'
+ ;;
+ esac
+ fi
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
+echo "$as_me:$LINENO: result: $ld_shlibs" >&5
+echo "${ECHO_T}$ld_shlibs" >&6
+test "$ld_shlibs" = no && can_build_shared=no
+with_gnu_ld=$with_gnu_ld
-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
+
+
+
+
+
+
+
+
+
+
+
+
+#
+# Do we need to explicitly link libc?
+#
+case "x$archive_cmds_need_lc" in
+x|xyes)
+ # Assume -lc should be added
+ archive_cmds_need_lc=yes
+
+ if test "$enable_shared" = yes && test "$GCC" = yes; then
+ case $archive_cmds in
+ *'~'*)
+ # FIXME: we may have to deal with multi-command sequences.
+ ;;
+ '$CC '*)
+ # Test whether the compiler implicitly links with -lc since on some
+ # systems, -lgcc has to come before -lc. If gcc already passes -lc
+ # to ld, don't add -lc before -lgcc.
+ echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5
+echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6
+ $RM conftest*
+ echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } 2>conftest.err; then
+ soname=conftest
+ lib=conftest
+ libobjs=conftest.$ac_objext
+ deplibs=
+ wl=$lt_prog_compiler_wl
+ pic_flag=$lt_prog_compiler_pic
+ compiler_flags=-v
+ linker_flags=-v
+ verstring=
+ output_objdir=.
+ libname=conftest
+ lt_save_allow_undefined_flag=$allow_undefined_flag
+ allow_undefined_flag=
+ if { (eval echo "$as_me:$LINENO: \"$archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1\"") >&5
+ (eval $archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }
+ then
+ archive_cmds_need_lc=no
+ else
+ archive_cmds_need_lc=yes
+ fi
+ allow_undefined_flag=$lt_save_allow_undefined_flag
+ else
+ cat conftest.err 1>&5
+ fi
+ $RM conftest*
+ echo "$as_me:$LINENO: result: $archive_cmds_need_lc" >&5
+echo "${ECHO_T}$archive_cmds_need_lc" >&6
+ ;;
+ esac
+ fi
+ ;;
+esac
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5
+echo $ECHO_N "checking dynamic linker characteristics... $ECHO_C" >&6
+withGCC=$GCC
+if test "$withGCC" = yes; then
+ case $host_os in
+ darwin*) lt_awk_arg="/^libraries:/,/LR/" ;;
+ *) lt_awk_arg="/^libraries:/" ;;
+ esac
+ lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e "s,=/,/,g"`
+ if $ECHO "$lt_search_path_spec" | $GREP ';' >/dev/null ; then
+ # if the path contains ";" then we assume it to be the separator
+ # otherwise default to the standard path separator (i.e. ":") - it is
+ # assumed that no part of a normal pathname contains ";" but that should
+ # okay in the real world where ";" in dirpaths is itself problematic.
+ lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED -e 's/;/ /g'`
+ else
+ lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"`
+ fi
+ # Ok, now we have the path, separated by spaces, we can step through it
+ # and add multilib dir if necessary.
+ lt_tmp_lt_search_path_spec=
+ lt_multi_os_dir=`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null`
+ for lt_sys_path in $lt_search_path_spec; do
+ if test -d "$lt_sys_path/$lt_multi_os_dir"; then
+ lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path/$lt_multi_os_dir"
+ else
+ test -d "$lt_sys_path" && \
+ lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path"
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
+ lt_search_path_spec=`$ECHO $lt_tmp_lt_search_path_spec | awk '
+BEGIN {RS=" "; FS="/|\n";} {
+ lt_foo="";
+ lt_count=0;
+ for (lt_i = NF; lt_i > 0; lt_i--) {
+ if ($lt_i != "" && $lt_i != ".") {
+ if ($lt_i == "..") {
+ lt_count++;
+ } else {
+ if (lt_count == 0) {
+ lt_foo="/" $lt_i lt_foo;
+ } else {
+ lt_count--;
+ }
+ }
+ }
+ }
+ if (lt_foo != "") { lt_freq[lt_foo]++; }
+ if (lt_freq[lt_foo] == 1) { print lt_foo; }
+}'`
+ sys_lib_search_path_spec=`$ECHO $lt_search_path_spec`
+else
+ sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib"
+fi
+library_names_spec=
+libname_spec='lib$name'
+soname_spec=
+shrext_cmds=".so"
+postinstall_cmds=
+postuninstall_cmds=
+finish_cmds=
+finish_eval=
+shlibpath_var=
+shlibpath_overrides_runpath=unknown
+version_type=none
+dynamic_linker="$host_os ld.so"
+sys_lib_dlsearch_path_spec="/lib /usr/lib"
+need_lib_prefix=unknown
+hardcode_into_libs=no
+
+# when you set need_version to no, make sure it does not cause -set_version
+# flags to be left without arguments
+need_version=unknown
-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
+case $host_os in
+aix3*)
+ version_type=linux
+ library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a'
+ shlibpath_var=LIBPATH
+
+ # AIX 3 has no versioning support, so we append a major version to the name.
+ soname_spec='${libname}${release}${shared_ext}$major'
+ ;;
+
+aix4* | aix5*)
+ version_type=linux
+ need_lib_prefix=no
+ need_version=no
+ hardcode_into_libs=yes
+ if test "$host_cpu" = ia64; then
+ # AIX 5 supports IA64
+ library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}'
+ shlibpath_var=LD_LIBRARY_PATH
+ else
+ # With GCC up to 2.95.x, collect2 would create an import file
+ # for dependence libraries. The import file would start with
+ # the line `#! .'. This would cause the generated library to
+ # depend on `.', always an invalid library. This was fixed in
+ # development snapshots of GCC prior to 3.0.
+ case $host_os in
+ aix4 | aix4.[01] | aix4.[01].*)
+ if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)'
+ echo ' yes '
+ echo '#endif'; } | ${CC} -E - | $GREP yes > /dev/null; then
+ :
+ else
+ can_build_shared=no
fi
- ac_cv_prog_CC="cc"
- break
+ ;;
+ esac
+ # AIX (on Power*) has no versioning support, so currently we can not hardcode correct
+ # soname into executable. Probably we can add versioning support to
+ # collect2, so additional links can be useful in future.
+ if test "$aix_use_runtimelinking" = yes; then
+ # If using run time linking (on AIX 4.2 or later) use lib<name>.so
+ # instead of lib<name>.a to let people know that these are not
+ # typical AIX shared libraries.
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ else
+ # We preserve .a as extension for shared libraries through AIX4.2
+ # and later when we are not doing run time linking.
+ library_names_spec='${libname}${release}.a $libname.a'
+ soname_spec='${libname}${release}${shared_ext}$major'
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="$@"
+ shlibpath_var=LIBPATH
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
+amigaos*)
+ if test "$host_cpu" = m68k; then
+ library_names_spec='$libname.ixlibrary $libname.a'
+ # Create ${libname}_ixlibrary.a entries in /sys/libs.
+ finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$ECHO "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done'
+ else
+ dynamic_linker=no
+ fi
+ ;;
+
+beos*)
+ library_names_spec='${libname}${shared_ext}'
+ dynamic_linker="$host_os ld.so"
+ shlibpath_var=LIBRARY_PATH
+ ;;
+
+bsdi[45]*)
+ version_type=linux
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir'
+ shlibpath_var=LD_LIBRARY_PATH
+ sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib"
+ sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib"
+ # the default ld.so.conf also contains /usr/contrib/lib and
+ # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow
+ # libtool to hard-code these into programs
+ ;;
+
+cygwin* | mingw* | pw32*)
+ version_type=windows
+ shrext_cmds=".dll"
+ need_version=no
+ need_lib_prefix=no
+
+ case $withGCC,$host_os in
+ yes,cygwin* | yes,mingw* | yes,pw32*)
+ library_names_spec='$libname.dll.a'
+ # DLL is installed to $(libdir)/../bin by postinstall_cmds
+ postinstall_cmds='base_file=`basename \${file}`~
+ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
+ dldir=$destdir/`dirname \$dlpath`~
+ test -d \$dldir || mkdir -p \$dldir~
+ $install_prog $dir/$dlname \$dldir/$dlname~
+ chmod a+x \$dldir/$dlname~
+ if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
+ eval '\''$striplib \$dldir/$dlname'\'' || exit \$?;
+ fi'
+ postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
+ dlpath=$dir/\$dldll~
+ $RM \$dlpath'
+ shlibpath_overrides_runpath=yes
+
+ case $host_os in
+ cygwin*)
+ # Cygwin DLLs use 'cyg' prefix rather than 'lib'
+ soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+ sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib"
+ ;;
+ mingw*)
+ # MinGW DLLs use traditional 'lib' prefix
+ soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+ sys_lib_search_path_spec=`$CC -print-search-dirs | $GREP "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"`
+ if $ECHO "$sys_lib_search_path_spec" | $GREP ';[c-zC-Z]:/' >/dev/null; then
+ # It is most probably a Windows format PATH printed by
+ # mingw gcc, but we are running on Cygwin. Gcc prints its search
+ # path with ; separators, and with drive letters. We can handle the
+ # drive letters (cygwin fileutils understands them), so leave them,
+ # especially as we might pass files found there to a mingw objdump,
+ # which wouldn't understand a cygwinified path. Ahh.
+ sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'`
+ else
+ sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"`
+ fi
+ ;;
+ pw32*)
+ # pw32 DLLs use 'pw' prefix rather than 'lib'
+ library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+ ;;
+ esac
+ ;;
+
+ *)
+ library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib'
+ ;;
+ esac
+ dynamic_linker='Win32 ld.exe'
+ # FIXME: first we should search . and the directory the executable is in
+ shlibpath_var=PATH
+ ;;
+
+darwin* | rhapsody*)
+ dynamic_linker="$host_os dyld"
+ version_type=darwin
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${major}$shared_ext ${libname}$shared_ext'
+ soname_spec='${libname}${release}${major}$shared_ext'
+ shlibpath_overrides_runpath=yes
+ shlibpath_var=DYLD_LIBRARY_PATH
+ shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`'
+
+ sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib"
+ sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib'
+ ;;
+
+dgux*)
+ version_type=linux
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ ;;
+
+freebsd1*)
+ dynamic_linker=no
+ ;;
+
+freebsd* | dragonfly*)
+ # DragonFly does not have aout. When/if they implement a new
+ # versioning mechanism, adjust this.
+ if test -x /usr/bin/objformat; then
+ objformat=`/usr/bin/objformat`
+ else
+ case $host_os in
+ freebsd[123]*) objformat=aout ;;
+ *) objformat=elf ;;
+ esac
+ fi
+ version_type=freebsd-$objformat
+ case $version_type in
+ freebsd-elf*)
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
+ need_version=no
+ need_lib_prefix=no
+ ;;
+ freebsd-*)
+ library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix'
+ need_version=yes
+ ;;
+ esac
+ shlibpath_var=LD_LIBRARY_PATH
+ case $host_os in
+ freebsd2*)
+ shlibpath_overrides_runpath=yes
+ ;;
+ freebsd3.[01]* | freebsdelf3.[01]*)
+ shlibpath_overrides_runpath=yes
+ hardcode_into_libs=yes
+ ;;
+ freebsd3.[2-9]* | freebsdelf3.[2-9]* | \
+ freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1)
+ shlibpath_overrides_runpath=no
+ hardcode_into_libs=yes
+ ;;
+ *) # from 4.6 on, and DragonFly
+ shlibpath_overrides_runpath=yes
+ hardcode_into_libs=yes
+ ;;
+ esac
+ ;;
+
+gnu*)
+ version_type=linux
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ hardcode_into_libs=yes
+ ;;
+
+hpux9* | hpux10* | hpux11*)
+ # Give a soname corresponding to the major version so that dld.sl refuses to
+ # link against other versions.
+ version_type=sunos
+ need_lib_prefix=no
+ need_version=no
+ case $host_cpu in
+ ia64*)
+ shrext_cmds='.so'
+ hardcode_into_libs=yes
+ dynamic_linker="$host_os dld.so"
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ if test "X$HPUX_IA64_MODE" = X32; then
+ sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib"
+ else
+ sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64"
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
- ;;
+ sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
+ ;;
+ hppa*64*)
+ shrext_cmds='.sl'
+ hardcode_into_libs=yes
+ dynamic_linker="$host_os dld.sl"
+ shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH
+ shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64"
+ sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
+ ;;
+ *)
+ shrext_cmds='.sl'
+ dynamic_linker="$host_os dld.sl"
+ shlibpath_var=SHLIB_PATH
+ shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ ;;
+ esac
+ # HP-UX runs *really* slowly unless shared libraries are mode 555.
+ postinstall_cmds='chmod 555 $lib'
+ ;;
+
+interix[3-9]*)
+ version_type=linux
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=no
+ hardcode_into_libs=yes
+ ;;
+
+irix5* | irix6* | nonstopux*)
+ case $host_os in
+ nonstopux*) version_type=nonstopux ;;
+ *)
+ if test "$lt_cv_prog_gnu_ld" = yes; then
+ version_type=linux
+ else
+ version_type=irix
+ fi ;;
+ esac
+ need_lib_prefix=no
+ need_version=no
+ soname_spec='${libname}${release}${shared_ext}$major'
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}'
+ case $host_os in
+ irix5* | nonstopux*)
+ libsuff= shlibsuff=
+ ;;
+ *)
+ case $LD in # libtool.m4 will add one of these switches to LD
+ *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ")
+ libsuff= shlibsuff= libmagic=32-bit;;
+ *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ")
+ libsuff=32 shlibsuff=N32 libmagic=N32;;
+ *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ")
+ libsuff=64 shlibsuff=64 libmagic=64-bit;;
+ *) libsuff= shlibsuff= libmagic=never-match;;
esac
+ ;;
+ esac
+ shlibpath_var=LD_LIBRARY${shlibsuff}_PATH
+ shlibpath_overrides_runpath=no
+ sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}"
+ sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}"
+ hardcode_into_libs=yes
+ ;;
+
+# No shared lib support for Linux oldld, aout, or coff.
+linux*oldld* | linux*aout* | linux*coff*)
+ dynamic_linker=no
+ ;;
+
+# This must be Linux ELF.
+linux* | k*bsd*-gnu)
+ version_type=linux
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=no
+ # Some binutils ld are patched to set DT_RUNPATH
+ save_LDFLAGS=$LDFLAGS
+ save_libdir=$libdir
+ eval "libdir=/foo; wl=\"$lt_prog_compiler_wl\"; \
+ LDFLAGS=\"\$LDFLAGS $hardcode_libdir_flag_spec\""
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ if ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir"; then
+ shlibpath_overrides_runpath=yes
+fi
+
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+ LDFLAGS=$save_LDFLAGS
+ libdir=$save_libdir
+
+ # This implies no fast_install, which is unacceptable.
+ # Some rework will be needed to allow for fast_install
+ # before this can be enabled.
+ hardcode_into_libs=yes
+
+ # Append ld.so.conf contents to the search path
+ if test -f /etc/ld.so.conf; then
+ lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '`
+ sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra"
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
+ # We used to test for /lib/ld.so.1 and disable shared libraries on
+ # powerpc, because MkLinux only supported shared libraries with the
+ # GNU dynamic linker. Since this was broken with cross compilers,
+ # most powerpc-linux boxes support dynamic linking these days and
+ # people can always --disable-shared, the test was removed, and we
+ # assume the GNU/Linux dynamic linker is in use.
+ dynamic_linker='GNU/Linux ld.so'
+ ;;
-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
+netbsd*)
+ version_type=sunos
+ need_lib_prefix=no
+ need_version=no
+ if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+ finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+ dynamic_linker='NetBSD (a.out) ld.so'
+ else
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ dynamic_linker='NetBSD ld.elf_so'
+ fi
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=yes
+ hardcode_into_libs=yes
+ ;;
-cat > conftest.$ac_ext << EOF
+newsos6)
+ version_type=linux
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=yes
+ ;;
-#line 2605 "configure"
-#include "confdefs.h"
+*nto* | *qnx*)
+ version_type=qnx
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=no
+ hardcode_into_libs=yes
+ dynamic_linker='ldqnx.so'
+ ;;
-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
+openbsd*)
+ version_type=sunos
+ sys_lib_dlsearch_path_spec="/usr/lib"
+ need_lib_prefix=no
+ # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs.
+ case $host_os in
+ openbsd3.3 | openbsd3.3.*) need_version=yes ;;
+ *) need_version=no ;;
+ esac
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+ finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+ shlibpath_var=LD_LIBRARY_PATH
+ if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+ case $host_os in
+ openbsd2.[89] | openbsd2.[89].*)
+ shlibpath_overrides_runpath=no
+ ;;
+ *)
+ shlibpath_overrides_runpath=yes
+ ;;
+ esac
else
- ac_cv_prog_cc_cross=yes
+ shlibpath_overrides_runpath=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
+os2*)
+ libname_spec='$name'
+ shrext_cmds=".dll"
+ need_lib_prefix=no
+ library_names_spec='$libname${shared_ext} $libname.a'
+ dynamic_linker='OS/2 ld.exe'
+ shlibpath_var=LIBPATH
+ ;;
-if test $ac_cv_prog_gcc = yes; then
- GCC=yes
-else
- GCC=
-fi
+osf3* | osf4* | osf5*)
+ version_type=osf
+ need_lib_prefix=no
+ need_version=no
+ soname_spec='${libname}${release}${shared_ext}$major'
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ shlibpath_var=LD_LIBRARY_PATH
+ sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib"
+ sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec"
+ ;;
-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*
+rdos*)
+ dynamic_linker=no
+ ;;
-fi
+solaris*)
+ version_type=linux
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=yes
+ hardcode_into_libs=yes
+ # ldd complains unless libraries are executable
+ postinstall_cmds='chmod +x $lib'
+ ;;
-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"
+sunos4*)
+ version_type=sunos
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+ finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=yes
+ if test "$with_gnu_ld" = yes; then
+ need_lib_prefix=no
fi
-else
- if test "$GCC" = yes; then
- CFLAGS="-O2"
+ need_version=yes
+ ;;
+
+sysv4 | sysv4.3*)
+ version_type=linux
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ case $host_vendor in
+ sni)
+ shlibpath_overrides_runpath=no
+ need_lib_prefix=no
+ runpath_var=LD_RUN_PATH
+ ;;
+ siemens)
+ need_lib_prefix=no
+ ;;
+ motorola)
+ need_lib_prefix=no
+ need_version=no
+ shlibpath_overrides_runpath=no
+ sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib'
+ ;;
+ esac
+ ;;
+
+sysv4*MP*)
+ if test -d /usr/nec ;then
+ version_type=linux
+ library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}'
+ soname_spec='$libname${shared_ext}.$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ fi
+ ;;
+
+sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
+ version_type=freebsd-elf
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=yes
+ hardcode_into_libs=yes
+ if test "$with_gnu_ld" = yes; then
+ sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib'
else
- CFLAGS=
+ sys_lib_search_path_spec='/usr/ccs/lib /usr/lib'
+ case $host_os in
+ sco3.2v5*)
+ sys_lib_search_path_spec="$sys_lib_search_path_spec /lib"
+ ;;
+ esac
fi
-fi
+ sys_lib_dlsearch_path_spec='/usr/lib'
+ ;;
+tpf*)
+ # TPF is a cross-target only. Preferred cross-host = GNU/Linux.
+ version_type=linux
+ need_lib_prefix=no
+ need_version=no
+ library_name_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=no
+ hardcode_into_libs=yes
+ ;;
-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
+uts4*)
+ version_type=linux
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ ;;
-# 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
+*)
+ dynamic_linker=no
+ ;;
+esac
+echo "$as_me:$LINENO: result: $dynamic_linker" >&5
+echo "${ECHO_T}$dynamic_linker" >&6
+test "$dynamic_linker" = no && can_build_shared=no
-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
+variables_saved_for_relink="PATH $shlibpath_var $runpath_var"
+if test "$GCC" = yes; then
+ variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
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
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5
+echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6
+hardcode_action=
+if test -n "$hardcode_libdir_flag_spec" ||
+ test -n "$runpath_var" ||
+ test "X$hardcode_automatic" = "Xyes" ; then
+
+ # We can hardcode non-existent directories.
+ if test "$hardcode_direct" != no &&
+ # If the only mechanism to avoid hardcoding is shlibpath_var, we
+ # have to relink, otherwise we might link with an installed library
+ # when we should be linking with a yet-to-be-installed one
+ ## test "$_LT_TAGVAR(hardcode_shlibpath_var, )" != no &&
+ test "$hardcode_minus_L" != no; then
+ # Linking always hardcodes the temporary library directory.
+ hardcode_action=relink
+ else
+ # We can link without hardcoding, and we can hardcode nonexisting dirs.
+ hardcode_action=immediate
+ fi
else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- ac_cv_func_alloca_works=no
+ # We cannot hardcode anything, or else we can only hardcode existing
+ # directories.
+ hardcode_action=unsupported
fi
-rm -f conftest*
+echo "$as_me:$LINENO: result: $hardcode_action" >&5
+echo "${ECHO_T}$hardcode_action" >&6
+
+if test "$hardcode_action" = relink ||
+ test "$inherit_rpath" = yes; then
+ # Fast installation is not supported
+ enable_fast_install=no
+elif test "$shlibpath_overrides_runpath" = yes ||
+ test "$enable_shared" = no; then
+ # Fast installation is not necessary
+ enable_fast_install=needless
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
+
+ if test "x$enable_dlopen" != xyes; then
+ enable_dlopen=unknown
+ enable_dlopen_self=unknown
+ enable_dlopen_self_static=unknown
else
- cat > conftest.$ac_ext <<EOF
-#line 3203 "configure"
-#include "confdefs.h"
-#if defined(CRAY) && ! defined(CRAY2)
-webecray
-#else
-wenotbecray
+ lt_cv_dlopen=no
+ lt_cv_dlopen_libs=
+
+ case $host_os in
+ beos*)
+ lt_cv_dlopen="load_add_on"
+ lt_cv_dlopen_libs=
+ lt_cv_dlopen_self=yes
+ ;;
+
+ mingw* | pw32*)
+ lt_cv_dlopen="LoadLibrary"
+ lt_cv_dlopen_libs=
+ ;;
+
+ cygwin*)
+ lt_cv_dlopen="dlopen"
+ lt_cv_dlopen_libs=
+ ;;
+
+ darwin*)
+ # if libdl is installed we need to link against it
+ echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5
+echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6
+if test "${ac_cv_lib_dl_dlopen+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-ldl $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+/* Override any gcc2 internal prototype to avoid an error. */
+#ifdef __cplusplus
+extern "C"
#endif
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char dlopen ();
+int
+main ()
+{
+dlopen ();
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_lib_dl_dlopen=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_lib_dl_dlopen=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5
+echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6
+if test $ac_cv_lib_dl_dlopen = yes; then
+ lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"
+else
+
+ lt_cv_dlopen="dyld"
+ lt_cv_dlopen_libs=
+ lt_cv_dlopen_self=yes
-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 "$as_me:$LINENO: checking for shl_load" >&5
+echo $ECHO_N "checking for shl_load... $ECHO_C" >&6
+if test "${ac_cv_func_shl_load+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+/* Define shl_load to an innocuous variant, in case <limits.h> declares shl_load.
+ For example, HP-UX 11i <limits.h> declares gettimeofday. */
+#define shl_load innocuous_shl_load
-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();
+ which can conflict with char shl_load (); below.
+ Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ <limits.h> exists even on freestanding compilers. */
-int main() {
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+
+#undef shl_load
+/* Override any gcc2 internal prototype to avoid an error. */
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char shl_load ();
/* 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)
+#if defined (__stub_shl_load) || defined (__stub___shl_load)
choke me
#else
-$ac_func();
+char (*f) () = shl_load;
+#endif
+#ifdef __cplusplus
+}
#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
+int
+main ()
+{
+return f != shl_load;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_func_shl_load=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_func_shl_load=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_func_shl_load" >&5
+echo "${ECHO_T}$ac_cv_func_shl_load" >&6
+if test $ac_cv_func_shl_load = yes; then
+ lt_cv_dlopen="shl_load"
+else
+ echo "$as_me:$LINENO: checking for shl_load in -ldld" >&5
+echo $ECHO_N "checking for shl_load in -ldld... $ECHO_C" >&6
+if test "${ac_cv_lib_dld_shl_load+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-ldld $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
-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
+/* Override any gcc2 internal prototype to avoid an error. */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char shl_load ();
+int
+main ()
+{
+shl_load ();
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_lib_dld_shl_load=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_lib_dld_shl_load=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_lib_dld_shl_load" >&5
+echo "${ECHO_T}$ac_cv_lib_dld_shl_load" >&6
+if test $ac_cv_lib_dld_shl_load = yes; then
+ lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-dld"
+else
+ echo "$as_me:$LINENO: checking for dlopen" >&5
+echo $ECHO_N "checking for dlopen... $ECHO_C" >&6
+if test "${ac_cv_func_dlopen+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+/* Define dlopen to an innocuous variant, in case <limits.h> declares dlopen.
+ For example, HP-UX 11i <limits.h> declares gettimeofday. */
+#define dlopen innocuous_dlopen
- break
-else
- echo "$ac_t""no" 1>&6
-fi
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char dlopen (); below.
+ Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ <limits.h> exists even on freestanding compilers. */
-done
-fi
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
-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 ()
+#undef dlopen
+
+/* Override any gcc2 internal prototype to avoid an error. */
+#ifdef __cplusplus
+extern "C"
{
- static char *addr = 0;
- auto char dummy;
- if (addr == 0)
- {
- addr = &dummy;
- return find_stack_direction ();
- }
- else
- return (&dummy > addr) ? 1 : -1;
+#endif
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char dlopen ();
+/* 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_dlopen) || defined (__stub___dlopen)
+choke me
+#else
+char (*f) () = dlopen;
+#endif
+#ifdef __cplusplus
}
+#endif
+
+int
main ()
{
- exit (find_stack_direction() < 0);
+return f != dlopen;
+ ;
+ return 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
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_func_dlopen=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_func_dlopen=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_func_dlopen" >&5
+echo "${ECHO_T}$ac_cv_func_dlopen" >&6
+if test $ac_cv_func_dlopen = yes; then
+ lt_cv_dlopen="dlopen"
+else
+ echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5
+echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6
+if test "${ac_cv_lib_dl_dlopen+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-ldl $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+/* Override any gcc2 internal prototype to avoid an error. */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char dlopen ();
+int
+main ()
+{
+dlopen ();
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_lib_dl_dlopen=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_lib_dl_dlopen=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5
+echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6
+if test $ac_cv_lib_dl_dlopen = yes; then
+ lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"
+else
+ echo "$as_me:$LINENO: checking for dlopen in -lsvld" >&5
+echo $ECHO_N "checking for dlopen in -lsvld... $ECHO_C" >&6
+if test "${ac_cv_lib_svld_dlopen+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lsvld $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+/* Override any gcc2 internal prototype to avoid an error. */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char dlopen ();
+int
+main ()
+{
+dlopen ();
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_lib_svld_dlopen=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_lib_svld_dlopen=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_lib_svld_dlopen" >&5
+echo "${ECHO_T}$ac_cv_lib_svld_dlopen" >&6
+if test $ac_cv_lib_svld_dlopen = yes; then
+ lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"
+else
+ echo "$as_me:$LINENO: checking for dld_link in -ldld" >&5
+echo $ECHO_N "checking for dld_link in -ldld... $ECHO_C" >&6
+if test "${ac_cv_lib_dld_dld_link+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-ldld $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+/* Override any gcc2 internal prototype to avoid an error. */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char dld_link ();
+int
+main ()
+{
+dld_link ();
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_lib_dld_dld_link=yes
else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -fr conftest*
- ac_cv_c_stack_direction=-1
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_lib_dld_dld_link=no
fi
-rm -fr conftest*
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_lib_dld_dld_link" >&5
+echo "${ECHO_T}$ac_cv_lib_dld_dld_link" >&6
+if test $ac_cv_lib_dld_dld_link = yes; then
+ lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-dld"
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
+ ;;
+ esac
+
+ if test "x$lt_cv_dlopen" != xno; then
+ enable_dlopen=yes
+ else
+ enable_dlopen=no
+ fi
+
+ case $lt_cv_dlopen in
+ dlopen)
+ save_CPPFLAGS="$CPPFLAGS"
+ test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H"
+
+ save_LDFLAGS="$LDFLAGS"
+ wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\"
+
+ save_LIBS="$LIBS"
+ LIBS="$lt_cv_dlopen_libs $LIBS"
+
+ echo "$as_me:$LINENO: checking whether a program can dlopen itself" >&5
+echo $ECHO_N "checking whether a program can dlopen itself... $ECHO_C" >&6
+if test "${lt_cv_dlopen_self+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
- cat > conftest.$ac_ext <<EOF
-#line 3379 "configure"
+ if test "$cross_compiling" = yes; then :
+ lt_cv_dlopen_self=cross
+else
+ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
+ lt_status=$lt_dlunknown
+ cat > conftest.$ac_ext <<_LT_EOF
+#line 10108 "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() {
+#if HAVE_DLFCN_H
+#include <dlfcn.h>
+#endif
-/* 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
+#include <stdio.h>
+
+#ifdef RTLD_GLOBAL
+# define LT_DLGLOBAL RTLD_GLOBAL
#else
-$ac_func();
+# ifdef DL_GLOBAL
+# define LT_DLGLOBAL DL_GLOBAL
+# else
+# define LT_DLGLOBAL 0
+# endif
#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*
+/* We may have to define LT_DLLAZY_OR_NOW in the command line if we
+ find out it does not work in some platform. */
+#ifndef LT_DLLAZY_OR_NOW
+# ifdef RTLD_LAZY
+# define LT_DLLAZY_OR_NOW RTLD_LAZY
+# else
+# ifdef DL_LAZY
+# define LT_DLLAZY_OR_NOW DL_LAZY
+# else
+# ifdef RTLD_NOW
+# define LT_DLLAZY_OR_NOW RTLD_NOW
+# else
+# ifdef DL_NOW
+# define LT_DLLAZY_OR_NOW DL_NOW
+# else
+# define LT_DLLAZY_OR_NOW 0
+# endif
+# endif
+# endif
+# endif
+#endif
+
+#ifdef __cplusplus
+extern "C" void exit (int);
+#endif
+
+void fnord() { int i=42;}
+int main ()
+{
+ void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW);
+ int status = $lt_dlunknown;
+
+ if (self)
+ {
+ if (dlsym (self,"fnord")) status = $lt_dlno_uscore;
+ else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore;
+ /* dlclose (self); */
+ }
+ else
+ puts (dlerror ());
+
+ exit (status);
+}
+_LT_EOF
+ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && test -s conftest${ac_exeext} 2>/dev/null; then
+ (./conftest; exit; ) >&5 2>/dev/null
+ lt_status=$?
+ case x$lt_status in
+ x$lt_dlno_uscore) lt_cv_dlopen_self=yes ;;
+ x$lt_dlneed_uscore) lt_cv_dlopen_self=yes ;;
+ x$lt_dlunknown|x*) lt_cv_dlopen_self=no ;;
+ esac
+ else :
+ # compilation failed
+ lt_cv_dlopen_self=no
+ fi
fi
+rm -fr conftest*
+
-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 "$as_me:$LINENO: result: $lt_cv_dlopen_self" >&5
+echo "${ECHO_T}$lt_cv_dlopen_self" >&6
-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
+ if test "x$lt_cv_dlopen_self" = xyes; then
+ wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\"
+ echo "$as_me:$LINENO: checking whether a statically linked program can dlopen itself" >&5
+echo $ECHO_N "checking whether a statically linked program can dlopen itself... $ECHO_C" >&6
+if test "${lt_cv_dlopen_self_static+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
- if test "$cross_compiling" = yes; then
- ac_cv_func_mmap_fixed_mapped=no
+ if test "$cross_compiling" = yes; then :
+ lt_cv_dlopen_self_static=cross
else
- cat > conftest.$ac_ext <<EOF
-#line 3435 "configure"
+ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
+ lt_status=$lt_dlunknown
+ cat > conftest.$ac_ext <<_LT_EOF
+#line 10208 "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.
+#if HAVE_DLFCN_H
+#include <dlfcn.h>
+#endif
- 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>
+#include <stdio.h>
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
+#ifdef RTLD_GLOBAL
+# define LT_DLGLOBAL RTLD_GLOBAL
+#else
+# ifdef DL_GLOBAL
+# define LT_DLGLOBAL DL_GLOBAL
+# else
+# define LT_DLGLOBAL 0
+# endif
#endif
-#if HAVE_STDLIB_H
-# include <stdlib.h>
+/* We may have to define LT_DLLAZY_OR_NOW in the command line if we
+ find out it does not work in some platform. */
+#ifndef LT_DLLAZY_OR_NOW
+# ifdef RTLD_LAZY
+# define LT_DLLAZY_OR_NOW RTLD_LAZY
+# else
+# ifdef DL_LAZY
+# define LT_DLLAZY_OR_NOW DL_LAZY
+# else
+# ifdef RTLD_NOW
+# define LT_DLLAZY_OR_NOW RTLD_NOW
+# else
+# ifdef DL_NOW
+# define LT_DLLAZY_OR_NOW DL_NOW
+# else
+# define LT_DLLAZY_OR_NOW 0
+# endif
+# endif
+# endif
+# endif
#endif
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
+#ifdef __cplusplus
+extern "C" void exit (int);
#endif
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
+void fnord() { int i=42;}
+int main ()
+{
+ void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW);
+ int status = $lt_dlunknown;
-/* This mess was copied from the GNU getpagesize.h. */
-#ifndef HAVE_GETPAGESIZE
+ if (self)
+ {
+ if (dlsym (self,"fnord")) status = $lt_dlno_uscore;
+ else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore;
+ /* dlclose (self); */
+ }
+ else
+ puts (dlerror ());
-/* Assume that all systems that can run configure have sys/param.h. */
-# ifndef HAVE_SYS_PARAM_H
-# define HAVE_SYS_PARAM_H 1
-# endif
+ exit (status);
+}
+_LT_EOF
+ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && test -s conftest${ac_exeext} 2>/dev/null; then
+ (./conftest; exit; ) >&5 2>/dev/null
+ lt_status=$?
+ case x$lt_status in
+ x$lt_dlno_uscore) lt_cv_dlopen_self_static=yes ;;
+ x$lt_dlneed_uscore) lt_cv_dlopen_self_static=yes ;;
+ x$lt_dlunknown|x*) lt_cv_dlopen_self_static=no ;;
+ esac
+ else :
+ # compilation failed
+ lt_cv_dlopen_self_static=no
+ fi
+fi
+rm -fr conftest*
-# 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 */
+fi
+echo "$as_me:$LINENO: result: $lt_cv_dlopen_self_static" >&5
+echo "${ECHO_T}$lt_cv_dlopen_self_static" >&6
+ fi
-#ifdef __cplusplus
-extern "C" { void *malloc(unsigned); }
-#else
-char *malloc();
-#endif
+ CPPFLAGS="$save_CPPFLAGS"
+ LDFLAGS="$save_LDFLAGS"
+ LIBS="$save_LIBS"
+ ;;
+ esac
-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);
-}
+ case $lt_cv_dlopen_self in
+ yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;;
+ *) enable_dlopen_self=unknown ;;
+ esac
-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*
+ case $lt_cv_dlopen_self_static in
+ yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;;
+ *) enable_dlopen_self_static=unknown ;;
+ esac
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
-
+
+
+striplib=
+old_striplib=
+echo "$as_me:$LINENO: checking whether stripping libraries is possible" >&5
+echo $ECHO_N "checking whether stripping libraries is possible... $ECHO_C" >&6
+if test -n "$STRIP" && $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then
+ test -z "$old_striplib" && old_striplib="$STRIP --strip-debug"
+ test -z "$striplib" && striplib="$STRIP --strip-unneeded"
+ echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
else
- echo "$ac_t""no" 1>&6
+# FIXME - insert some real tests, host_os isn't really good enough
+ case $host_os in
+ darwin*)
+ if test -n "$STRIP" ; then
+ striplib="$STRIP -x"
+ old_striplib="$STRIP -S"
+ echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
+ else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+ fi
+ ;;
+ *)
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+ ;;
+ esac
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
+
+
+
+
+
+
+
+ # Report which library types will actually be built
+ echo "$as_me:$LINENO: checking if libtool supports shared libraries" >&5
+echo $ECHO_N "checking if libtool supports shared libraries... $ECHO_C" >&6
+ echo "$as_me:$LINENO: result: $can_build_shared" >&5
+echo "${ECHO_T}$can_build_shared" >&6
+
+ echo "$as_me:$LINENO: checking whether to build shared libraries" >&5
+echo $ECHO_N "checking whether to build shared libraries... $ECHO_C" >&6
+ test "$can_build_shared" = "no" && enable_shared=no
+
+ # On AIX, shared libraries and static libraries use the same namespace, and
+ # are all built from PIC.
+ case $host_os in
+ aix3*)
+ test "$enable_shared" = yes && enable_static=no
+ if test -n "$RANLIB"; then
+ archive_cmds="$archive_cmds~\$RANLIB \$lib"
+ postinstall_cmds='$RANLIB $lib'
+ fi
+ ;;
+
+ aix4* | aix5*)
+ if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then
+ test "$enable_shared" = yes && enable_static=no
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
+ ;;
+ esac
+ echo "$as_me:$LINENO: result: $enable_shared" >&5
+echo "${ECHO_T}$enable_shared" >&6
+
+ echo "$as_me:$LINENO: checking whether to build static libraries" >&5
+echo $ECHO_N "checking whether to build static libraries... $ECHO_C" >&6
+ # Make sure either enable_shared or enable_static is yes.
+ test "$enable_shared" = yes || enable_static=yes
+ echo "$as_me:$LINENO: result: $enable_static" >&5
+echo "${ECHO_T}$enable_static" >&6
- 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
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
- echo "$ac_t""$nls_cv_force_use_gnu_gettext" 1>&6
+CC="$lt_save_CC"
- 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"
+
+
+
+
+
+
+
+
+
+
+
+ ac_config_commands="$ac_config_commands libtool"
+
+
+
+
+# Only expand once:
+
+
+
+# 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 "$as_me:$LINENO: error: bad value ${enableval} for 64-bit-bfd option" >&5
+echo "$as_me: error: bad value ${enableval} for 64-bit-bfd option" >&2;}
+ { (exit 1); exit 1; }; } ;;
+esac
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
+ 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 "$as_me:$LINENO: error: enable-targets option must specify target names or 'all'" >&5
+echo "$as_me: error: enable-targets option must specify target names or 'all'" >&2;}
+ { (exit 1); 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 "$as_me:$LINENO: error: bad value ${enableval} for BFD commonbfdlib option" >&5
+echo "$as_me: error: bad value ${enableval} for BFD commonbfdlib option" >&2;}
+ { (exit 1); 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 "$as_me:$LINENO: error: bad value ${withval} for BFD with-mmap option" >&5
+echo "$as_me: error: bad value ${withval} for BFD with-mmap option" >&2;}
+ { (exit 1); exit 1; }; } ;;
+esac
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
+ want_mmap=false
+fi;
+# Check whether --enable-secureplt or --disable-secureplt was given.
+if test "${enable_secureplt+set}" = set; then
+ enableval="$enable_secureplt"
+ case "${enableval}" in
+ yes) use_secureplt=true ;;
+ no) use_secureplt=false ;;
+ *) { { echo "$as_me:$LINENO: error: bad value ${enableval} for secureplt option" >&5
+echo "$as_me: error: bad value ${enableval} for secureplt option" >&2;}
+ { (exit 1); exit 1; }; } ;;
+esac
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*
+ use_secureplt=false
+fi; if test $use_secureplt = true; then
+
+cat >>confdefs.h <<\_ACEOF
+#define USE_SECUREPLT 1
+_ACEOF
+
fi
-echo "$ac_t""$gt_cv_func_gettext_libc" 1>&6
+DEBUGDIR=${libdir}/debug
- 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"
+# Check whether --with-separate-debug-dir or --without-separate-debug-dir was given.
+if test "${with_separate_debug_dir+set}" = set; then
+ withval="$with_separate_debug_dir"
+ DEBUGDIR="${withval}"
+fi;
-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
+
+# Check whether --with-pkgversion or --without-pkgversion was given.
+if test "${with_pkgversion+set}" = set; then
+ withval="$with_pkgversion"
+ case "$withval" in
+ yes) { { echo "$as_me:$LINENO: error: package version not specified" >&5
+echo "$as_me: error: package version not specified" >&2;}
+ { (exit 1); exit 1; }; } ;;
+ no) PKGVERSION= ;;
+ *) PKGVERSION="($withval) " ;;
+ esac
else
- echo "$ac_t""no" 1>&6
-fi
+ PKGVERSION="(GNU Binutils) "
- 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
+
+
+# Check whether --with-bugurl or --without-bugurl was given.
+if test "${with_bugurl+set}" = set; then
+ withval="$with_bugurl"
+ case "$withval" in
+ yes) { { echo "$as_me:$LINENO: error: bug URL not specified" >&5
+echo "$as_me: error: bug URL not specified" >&2;}
+ { (exit 1); exit 1; }; } ;;
+ no) BUGURL=
+ ;;
+ *) BUGURL="$withval"
+ ;;
+ esac
else
- case "$MSGFMT" in
- /*)
- ac_cv_path_MSGFMT="$MSGFMT" # Let the user override the test with a path.
- ;;
+ BUGURL="http://www.sourceware.org/bugzilla/"
+
+fi;
+ case ${BUGURL} in
+ "")
+ REPORT_BUGS_TO=
+ REPORT_BUGS_TEXI=
+ ;;
*)
- 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
+ REPORT_BUGS_TO="<$BUGURL>"
+ REPORT_BUGS_TEXI=@uref{`echo "$BUGURL" | sed 's/@/@@/g'`}
+ ;;
+ esac;
+
+
+
+
+
+GCC_WARN_CFLAGS="-W -Wall -Wstrict-prototypes -Wmissing-prototypes"
+
+# Check whether --enable-werror or --disable-werror was given.
+if test "${enable_werror+set}" = set; then
+ enableval="$enable_werror"
+ case "${enableval}" in
+ yes | y) ERROR_ON_WARNING="yes" ;;
+ no | n) ERROR_ON_WARNING="no" ;;
+ *) { { echo "$as_me:$LINENO: error: bad value ${enableval} for --enable-werror" >&5
+echo "$as_me: error: bad value ${enableval} for --enable-werror" >&2;}
+ { (exit 1); exit 1; }; } ;;
+ esac
+fi;
+
+# Enable -Werror by default when using gcc
+if test "${GCC}" = yes -a -z "${ERROR_ON_WARNING}" ; then
+ ERROR_ON_WARNING=yes
fi
-MSGFMT="$ac_cv_path_MSGFMT"
-if test -n "$MSGFMT"; then
- echo "$ac_t""$MSGFMT" 1>&6
-else
- echo "$ac_t""no" 1>&6
+
+NO_WERROR=
+if test "${ERROR_ON_WARNING}" = yes ; then
+ GCC_WARN_CFLAGS="$GCC_WARN_CFLAGS -Werror"
+ NO_WERROR="-Wno-error"
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() {
+if test "${GCC}" = yes ; then
+ WARN_CFLAGS="${GCC_WARN_CFLAGS}"
+fi
-/* 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
+# 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) WARN_CFLAGS="${GCC_WARN_CFLAGS}";;
+ no) if test "${GCC}" = yes ; then
+ WARN_CFLAGS="-w"
+ fi;;
+ ,*) t=`echo "${enableval}" | sed -e "s/,/ /g"`
+ WARN_CFLAGS="${GCC_WARN_CFLAGS} ${t}";;
+ *,) t=`echo "${enableval}" | sed -e "s/,/ /g"`
+ WARN_CFLAGS="${t} ${GCC_WARN_CFLAGS}";;
+ *) WARN_CFLAGS=`echo "${enableval}" | sed -e "s/,/ /g"`;;
+esac
+fi;
-; 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"
+if test x"$silent" != x"yes" && test x"$WARN_CFLAGS" != x""; then
+ echo "Setting warning flags = $WARN_CFLAGS" 6>&1
fi
-rm -f conftest*
+
+
+
+
+
+ ac_config_headers="$ac_config_headers config.h:config.in"
+
+
+if test -z "$target" ; then
+ { { echo "$as_me:$LINENO: error: Unrecognized target system type; please check config.sub." >&5
+echo "$as_me: error: Unrecognized target system type; please check config.sub." >&2;}
+ { (exit 1); exit 1; }; }
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
-
+echo "$as_me:$LINENO: checking whether to enable maintainer-specific portions of Makefiles" >&5
+echo $ECHO_N "checking whether to enable maintainer-specific portions of Makefiles... $ECHO_C" >&6
+ # 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
- echo "$ac_t""no" 1>&6
-fi
-done
+ USE_MAINTAINER_MODE=no
+fi;
+ echo "$as_me:$LINENO: result: $USE_MAINTAINER_MODE" >&5
+echo "${ECHO_T}$USE_MAINTAINER_MODE" >&6
- # 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
+
+if test $USE_MAINTAINER_MODE = yes; then
+ MAINTAINER_MODE_TRUE=
+ MAINTAINER_MODE_FALSE='#'
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
+ MAINTAINER_MODE_TRUE='#'
+ MAINTAINER_MODE_FALSE=
fi
-GMSGFMT="$ac_cv_path_GMSGFMT"
-if test -n "$GMSGFMT"; then
- echo "$ac_t""$GMSGFMT" 1>&6
+
+ MAINT=$MAINTAINER_MODE_TRUE
+
+
+
+
+if false; then
+ GENINSRC_NEVER_TRUE=
+ GENINSRC_NEVER_FALSE='#'
else
- echo "$ac_t""no" 1>&6
+ GENINSRC_NEVER_TRUE='#'
+ GENINSRC_NEVER_FALSE=
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
+ case ${build_alias} in
+ "") build_noncanonical=${build} ;;
+ *) build_noncanonical=${build_alias} ;;
+esac
+
+ case ${host_alias} in
+ "") host_noncanonical=${build_noncanonical} ;;
+ *) host_noncanonical=${host_alias} ;;
+esac
+
+ case ${target_alias} in
+ "") target_noncanonical=${host_noncanonical} ;;
+ *) target_noncanonical=${target_alias} ;;
+esac
+
+echo "$as_me:$LINENO: checking whether to install libbfd" >&5
+echo $ECHO_N "checking whether to install libbfd... $ECHO_C" >&6
+ # 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
- 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
+ if test "${host}" = "${target}" || test "$enable_shared" = "yes"; then
+ install_libbfd_p=yes
+ else
+ install_libbfd_p=no
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
+fi;
+ echo "$as_me:$LINENO: result: $install_libbfd_p" >&5
+echo "${ECHO_T}$install_libbfd_p" >&6
+
+
+if test $install_libbfd_p = yes; then
+ INSTALL_LIBBFD_TRUE=
+ INSTALL_LIBBFD_FALSE='#'
else
- echo "$ac_t""no" 1>&6
+ INSTALL_LIBBFD_TRUE='#'
+ INSTALL_LIBBFD_FALSE=
fi
- cat > conftest.$ac_ext <<EOF
-#line 4134 "configure"
-#include "confdefs.h"
+ # Need _noncanonical variables for this.
+
+
+
+
+ # libbfd.a is a host library containing target dependent code
+ bfdlibdir='$(libdir)'
+ bfdincludedir='$(includedir)'
+ if test "${host}" != "${target}"; then
+ bfdlibdir='$(exec_prefix)/$(host_noncanonical)/$(target_noncanonical)/lib'
+ bfdincludedir='$(exec_prefix)/$(host_noncanonical)/$(target_noncanonical)/include'
+ fi
+
+
+
+
+
+
+host64=false
+target64=false
+bfd_default_target_size=32
+
+# host stuff:
+
+ALL_LINGUAS="fr tr ja es sv da zh_CN ro rw vi"
+# If we haven't got the data from the intl directory,
+# assume NLS is disabled.
+USE_NLS=no
+LIBINTL=
+LIBINTL_DEP=
+INCINTL=
+XGETTEXT=
+GMSGFMT=
+POSUB=
+
+if test -f ../intl/config.intl; then
+ . ../intl/config.intl
+fi
+echo "$as_me:$LINENO: checking whether NLS is requested" >&5
+echo $ECHO_N "checking whether NLS is requested... $ECHO_C" >&6
+if test x"$USE_NLS" != xyes; then
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+else
+ echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
+
+cat >>confdefs.h <<\_ACEOF
+#define ENABLE_NLS 1
+_ACEOF
+
+
+ echo "$as_me:$LINENO: checking for catalogs to be installed" >&5
+echo $ECHO_N "checking for catalogs to be installed... $ECHO_C" >&6
+ # Look for .po and .gmo files in the source directory.
+ CATALOGS=
+ XLINGUAS=
+ for cat in $srcdir/po/*.gmo $srcdir/po/*.po; do
+ # If there aren't any .gmo files the shell will give us the
+ # literal string "../path/to/srcdir/po/*.gmo" which has to be
+ # weeded out.
+ case "$cat" in *\**)
+ continue;;
+ esac
+ # The quadruple backslash is collapsed to a double backslash
+ # by the backticks, then collapsed again by the double quotes,
+ # leaving us with one backslash in the sed expression (right
+ # before the dot that mustn't act as a wildcard).
+ cat=`echo $cat | sed -e "s!$srcdir/po/!!" -e "s!\\\\.po!.gmo!"`
+ lang=`echo $cat | sed -e "s!\\\\.gmo!!"`
+ # The user is allowed to set LINGUAS to a list of languages to
+ # install catalogs for. If it's empty that means "all of them."
+ if test "x$LINGUAS" = x; then
+ CATALOGS="$CATALOGS $cat"
+ XLINGUAS="$XLINGUAS $lang"
+ else
+ case "$LINGUAS" in *$lang*)
+ CATALOGS="$CATALOGS $cat"
+ XLINGUAS="$XLINGUAS $lang"
+ ;;
+ esac
+ fi
+ done
+ LINGUAS="$XLINGUAS"
+ echo "$as_me:$LINENO: result: $LINGUAS" >&5
+echo "${ECHO_T}$LINGUAS" >&6
+
+
+ DATADIRNAME=share
+
+ INSTOBJEXT=.mo
+
+ GENCAT=gencat
-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
-
+
+ MKINSTALLDIRS=
+ if test -n "$ac_aux_dir"; then
+ case "$ac_aux_dir" in
+ /*) MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs" ;;
+ *) MKINSTALLDIRS="\$(top_builddir)/$ac_aux_dir/mkinstalldirs" ;;
+ esac
+ fi
+ if test -z "$MKINSTALLDIRS"; then
+ MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs"
+ fi
+
+
+
+ echo "$as_me:$LINENO: checking whether NLS is requested" >&5
+echo $ECHO_N "checking whether NLS is requested... $ECHO_C" >&6
+ # Check whether --enable-nls or --disable-nls was given.
+if test "${enable_nls+set}" = set; then
+ enableval="$enable_nls"
+ USE_NLS=$enableval
else
- echo "$ac_t""no" 1>&6
-fi
+ USE_NLS=yes
+fi;
+ echo "$as_me:$LINENO: result: $USE_NLS" >&5
+echo "${ECHO_T}$USE_NLS" >&6
-
- 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.
+
+
+
+# Prepare PATH_SEPARATOR.
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+ echo "#! /bin/sh" >conf$$.sh
+ echo "exit 0" >>conf$$.sh
+ chmod +x conf$$.sh
+ if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
+ PATH_SEPARATOR=';'
+ else
+ PATH_SEPARATOR=:
+ fi
+ rm -f conf$$.sh
+fi
+
+# Find out how to test for executable files. Don't use a zero-byte file,
+# as systems may use methods other than mode bits to determine executability.
+cat >conf$$.file <<_ASEOF
+#! /bin/sh
+exit 0
+_ASEOF
+chmod +x conf$$.file
+if test -x conf$$.file >/dev/null 2>&1; then
+ ac_executable_p="test -x"
+else
+ ac_executable_p="test -f"
+fi
+rm -f conf$$.file
+
+# 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
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_path_MSGFMT+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
case "$MSGFMT" in
- /*)
- ac_cv_path_MSGFMT="$MSGFMT" # Let the user override the test with a path.
- ;;
+ [\\/]* | ?:[\\/]*)
+ 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"
- ;;
+ ac_save_IFS="$IFS"; IFS=$PATH_SEPARATOR
+ for ac_dir in $PATH; do
+ IFS="$ac_save_IFS"
+ test -z "$ac_dir" && ac_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $ac_executable_p "$ac_dir/$ac_word$ac_exec_ext"; then
+ if $ac_dir/$ac_word --statistics /dev/null >/dev/null 2>&1 &&
+ (if $ac_dir/$ac_word --statistics /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi); then
+ ac_cv_path_MSGFMT="$ac_dir/$ac_word$ac_exec_ext"
+ break 2
+ fi
+ fi
+ done
+ done
+ IFS="$ac_save_IFS"
+ test -z "$ac_cv_path_MSGFMT" && ac_cv_path_MSGFMT=":"
+ ;;
esac
fi
MSGFMT="$ac_cv_path_MSGFMT"
-if test -n "$MSGFMT"; then
- echo "$ac_t""$MSGFMT" 1>&6
+if test "$MSGFMT" != ":"; then
+ echo "$as_me:$LINENO: result: $MSGFMT" >&5
+echo "${ECHO_T}$MSGFMT" >&6
else
- echo "$ac_t""no" 1>&6
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
fi
- # Extract the first word of "gmsgfmt", so it can be a program name with args.
+ # 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
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_path_GMSGFMT+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
- case "$GMSGFMT" in
- /*)
+ 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"
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_path_GMSGFMT="$as_dir/$ac_word$ac_exec_ext"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+
test -z "$ac_cv_path_GMSGFMT" && ac_cv_path_GMSGFMT="$MSGFMT"
;;
esac
fi
-GMSGFMT="$ac_cv_path_GMSGFMT"
+GMSGFMT=$ac_cv_path_GMSGFMT
+
if test -n "$GMSGFMT"; then
- echo "$ac_t""$GMSGFMT" 1>&6
+ echo "$as_me:$LINENO: result: $GMSGFMT" >&5
+echo "${ECHO_T}$GMSGFMT" >&6
else
- echo "$ac_t""no" 1>&6
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+
+
+# Prepare PATH_SEPARATOR.
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+ echo "#! /bin/sh" >conf$$.sh
+ echo "exit 0" >>conf$$.sh
+ chmod +x conf$$.sh
+ if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
+ PATH_SEPARATOR=';'
+ else
+ PATH_SEPARATOR=:
+ fi
+ rm -f conf$$.sh
fi
- # Extract the first word of "xgettext", so it can be a program name with args.
+# Find out how to test for executable files. Don't use a zero-byte file,
+# as systems may use methods other than mode bits to determine executability.
+cat >conf$$.file <<_ASEOF
+#! /bin/sh
+exit 0
+_ASEOF
+chmod +x conf$$.file
+if test -x conf$$.file >/dev/null 2>&1; then
+ ac_executable_p="test -x"
+else
+ ac_executable_p="test -f"
+fi
+rm -f conf$$.file
+
+# 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
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_path_XGETTEXT+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
case "$XGETTEXT" in
- /*)
- ac_cv_path_XGETTEXT="$XGETTEXT" # Let the user override the test with a path.
- ;;
+ [\\/]* | ?:[\\/]*)
+ 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"
+ ac_save_IFS="$IFS"; IFS=$PATH_SEPARATOR
+ for ac_dir in $PATH; do
+ IFS="$ac_save_IFS"
+ test -z "$ac_dir" && ac_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $ac_executable_p "$ac_dir/$ac_word$ac_exec_ext"; then
+ if $ac_dir/$ac_word --omit-header --copyright-holder= --msgid-bugs-address= /dev/null >/dev/null 2>&1 &&
+ (if $ac_dir/$ac_word --omit-header --copyright-holder= --msgid-bugs-address= /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi); then
+ ac_cv_path_XGETTEXT="$ac_dir/$ac_word$ac_exec_ext"
+ break 2
+ fi
+ fi
+ done
+ 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 test "$XGETTEXT" != ":"; then
+ echo "$as_me:$LINENO: result: $XGETTEXT" >&5
+echo "${ECHO_T}$XGETTEXT" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+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
+ rm -f messages.po
- 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
+# Prepare PATH_SEPARATOR.
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+ echo "#! /bin/sh" >conf$$.sh
+ echo "exit 0" >>conf$$.sh
+ chmod +x conf$$.sh
+ if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
+ PATH_SEPARATOR=';'
+ else
+ PATH_SEPARATOR=:
+ fi
+ rm -f conf$$.sh
+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"
+# Find out how to test for executable files. Don't use a zero-byte file,
+# as systems may use methods other than mode bits to determine executability.
+cat >conf$$.file <<_ASEOF
+#! /bin/sh
+exit 0
+_ASEOF
+chmod +x conf$$.file
+if test -x conf$$.file >/dev/null 2>&1; then
+ ac_executable_p="test -x"
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"
+ ac_executable_p="test -f"
fi
-rm -f conftest*
+rm -f conf$$.file
+
+# Extract the first word of "msgmerge", so it can be a program name with args.
+set dummy msgmerge; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_path_MSGMERGE+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ case "$MSGMERGE" in
+ [\\/]* | ?:[\\/]*)
+ ac_cv_path_MSGMERGE="$MSGMERGE" # Let the user override the test with a path.
+ ;;
+ *)
+ ac_save_IFS="$IFS"; IFS=$PATH_SEPARATOR
+ for ac_dir in $PATH; do
+ IFS="$ac_save_IFS"
+ test -z "$ac_dir" && ac_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $ac_executable_p "$ac_dir/$ac_word$ac_exec_ext"; then
+ if $ac_dir/$ac_word --update -q /dev/null /dev/null >/dev/null 2>&1; then
+ ac_cv_path_MSGMERGE="$ac_dir/$ac_word$ac_exec_ext"
+ break 2
+ fi
+ fi
+ done
+ done
+ IFS="$ac_save_IFS"
+ test -z "$ac_cv_path_MSGMERGE" && ac_cv_path_MSGMERGE=":"
+ ;;
+esac
fi
-if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
- echo "$ac_t""yes" 1>&6
- msgformat=linux
+MSGMERGE="$ac_cv_path_MSGMERGE"
+if test "$MSGMERGE" != ":"; then
+ echo "$as_me:$LINENO: result: $MSGMERGE" >&5
+echo "${ECHO_T}$MSGMERGE" >&6
else
- echo "$ac_t""no" 1>&6
-msgformat=xopen
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
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 "$GMSGFMT" != ":"; then
+ if $GMSGFMT --statistics /dev/null >/dev/null 2>&1 &&
+ (if $GMSGFMT --statistics /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi); then
+ : ;
+ else
+ GMSGFMT=`echo "$GMSGFMT" | sed -e 's,^.*/,,'`
+ echo "$as_me:$LINENO: result: found $GMSGFMT program is not GNU msgfmt; ignore it" >&5
+echo "${ECHO_T}found $GMSGFMT program is not GNU msgfmt; ignore it" >&6
+ GMSGFMT=":"
+ fi
+ fi
- if test "$PACKAGE" = "gettext"; then
- GT_NO="#NO#"
- GT_YES=
- else
- GT_NO=
- GT_YES="#YES#"
- fi
-
-
+ if test "$XGETTEXT" != ":"; then
+ if $XGETTEXT --omit-header --copyright-holder= --msgid-bugs-address= /dev/null >/dev/null 2>&1 &&
+ (if $XGETTEXT --omit-header --copyright-holder= --msgid-bugs-address= /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi); then
+ : ;
+ else
+ echo "$as_me:$LINENO: result: found xgettext program is not GNU xgettext; ignore it" >&5
+echo "${ECHO_T}found xgettext program is not GNU xgettext; ignore it" >&6
+ XGETTEXT=":"
+ fi
+ rm -f messages.po
+ fi
- MKINSTALLDIRS="\$(srcdir)/../../mkinstalldirs"
-
+ ac_config_commands="$ac_config_commands default-1"
- 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
@@ -4441,60 +11117,75 @@ fi
# SunOS /usr/etc/install
# IRIX /sbin/install
# AIX /bin/install
+# AmigaOS /C/install, which installs bootblocks on floppy discs
# 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"
+# OS/2's system install, which has a completely different semantic
# ./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
+echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5
+echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6
if test -z "$INSTALL"; then
-if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
+if test "${ac_cv_path_install+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&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
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ # Account for people who put trailing slashes in PATH elements.
+case $as_dir/ in
+ ./ | .// | /cC/* | \
+ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \
+ ?:\\/os2\\/install\\/* | ?:\\/OS2\\/INSTALL\\/* | \
+ /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
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then
if test $ac_prog = install &&
- grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then
+ grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
# AIX install. It has an incompatible calling convention.
:
+ elif test $ac_prog = install &&
+ grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
+ # program-specific install script used by HP pwplus--don't use.
+ :
else
- ac_cv_path_install="$ac_dir/$ac_prog -c"
- break 2
+ ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c"
+ break 3
fi
fi
done
- ;;
- esac
- done
- IFS="$ac_save_IFS"
+ done
+ ;;
+esac
+done
+
fi
if test "${ac_cv_path_install+set}" = set; then
- INSTALL="$ac_cv_path_install"
+ 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"
+ INSTALL=$ac_install_sh
fi
fi
-echo "$ac_t""$INSTALL" 1>&6
+echo "$as_me:$LINENO: result: $INSTALL" >&5
+echo "${ECHO_T}$INSTALL" >&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_SCRIPT" && INSTALL_SCRIPT='${INSTALL}'
test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
@@ -4505,112 +11196,890 @@ 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
+echo "$as_me:$LINENO: checking for long long" >&5
+echo $ECHO_N "checking for long long... $ECHO_C" >&6
+if test "${bfd_cv_has_long_long+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
- cat > conftest.$ac_ext <<EOF
-#line 4515 "configure"
-#include "confdefs.h"
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
-int main() {
+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*
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
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
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+bfd_cv_has_long_long=no
fi
-rm -f conftest*
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
fi
-echo "$ac_t""$bfd_cv_has_long_long" 1>&6
+echo "$as_me:$LINENO: result: $bfd_cv_has_long_long" >&5
+echo "${ECHO_T}$bfd_cv_has_long_long" >&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>
+ echo "$as_me:$LINENO: checking for long long" >&5
+echo $ECHO_N "checking for long long... $ECHO_C" >&6
+if test "${ac_cv_type_long_long+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+if ((long long *) 0)
+ return 0;
+if (sizeof (long long))
+ return 0;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_type_long_long=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_type_long_long=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_type_long_long" >&5
+echo "${ECHO_T}$ac_cv_type_long_long" >&6
+
+echo "$as_me:$LINENO: checking size of long long" >&5
+echo $ECHO_N "checking size of long long... $ECHO_C" >&6
+if test "${ac_cv_sizeof_long_long+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test "$ac_cv_type_long_long" = yes; then
+ # The cast to unsigned long works around a bug in the HP C Compiler
+ # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
+ # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
+ # This bug is HP SR number 8606223364.
+ if test "$cross_compiling" = yes; then
+ # Depending upon the size, compute the lo and hi bounds.
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long) (sizeof (long long))) >= 0)];
+test_array [0] = 0
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_lo=0 ac_mid=0
+ while :; do
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long) (sizeof (long long))) <= $ac_mid)];
+test_array [0] = 0
-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
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_hi=$ac_mid; break
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_lo=`expr $ac_mid + 1`
+ if test $ac_lo -le $ac_mid; then
+ ac_lo= ac_hi=
+ break
+ fi
+ ac_mid=`expr 2 '*' $ac_mid + 1`
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+ done
else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long) (sizeof (long long))) < 0)];
+test_array [0] = 0
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_hi=-1 ac_mid=-1
+ while :; do
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long) (sizeof (long long))) >= $ac_mid)];
+test_array [0] = 0
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_lo=$ac_mid; break
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_hi=`expr '(' $ac_mid ')' - 1`
+ if test $ac_mid -le $ac_hi; then
+ ac_lo= ac_hi=
+ break
+ fi
+ ac_mid=`expr 2 '*' $ac_mid`
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+ done
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_lo= ac_hi=
fi
-rm -f conftest*
- if test x$ac_cv_sizeof_long_long != x ; then break; fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+# Binary search between lo and hi bounds.
+while test "x$ac_lo" != "x$ac_hi"; do
+ ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo`
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long) (sizeof (long long))) <= $ac_mid)];
+test_array [0] = 0
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_hi=$ac_mid
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_lo=`expr '(' $ac_mid ')' + 1`
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
done
+case $ac_lo in
+?*) ac_cv_sizeof_long_long=$ac_lo;;
+'') { { echo "$as_me:$LINENO: error: cannot compute sizeof (long long), 77
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot compute sizeof (long long), 77
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; } ;;
+esac
+else
+ if test "$cross_compiling" = yes; then
+ { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot run test program while cross compiling
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; }
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+long longval () { return (long) (sizeof (long long)); }
+unsigned long ulongval () { return (long) (sizeof (long long)); }
+#include <stdio.h>
+#include <stdlib.h>
+int
+main ()
+{
-fi
+ FILE *f = fopen ("conftest.val", "w");
+ if (! f)
+ exit (1);
+ if (((long) (sizeof (long long))) < 0)
+ {
+ long i = longval ();
+ if (i != ((long) (sizeof (long long))))
+ exit (1);
+ fprintf (f, "%ld\n", i);
+ }
+ else
+ {
+ unsigned long i = ulongval ();
+ if (i != ((long) (sizeof (long long))))
+ exit (1);
+ fprintf (f, "%lu\n", i);
+ }
+ exit (ferror (f) || fclose (f) != 0);
-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
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_sizeof_long_long=`cat conftest.val`
+else
+ echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+( exit $ac_status )
+{ { echo "$as_me:$LINENO: error: cannot compute sizeof (long long), 77
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot compute sizeof (long long), 77
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+fi
+rm -f conftest.val
+else
+ ac_cv_sizeof_long_long=0
+fi
+fi
+echo "$as_me:$LINENO: result: $ac_cv_sizeof_long_long" >&5
+echo "${ECHO_T}$ac_cv_sizeof_long_long" >&6
+cat >>confdefs.h <<_ACEOF
#define SIZEOF_LONG_LONG $ac_cv_sizeof_long_long
-EOF
+_ACEOF
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
+echo "$as_me:$LINENO: checking for long" >&5
+echo $ECHO_N "checking for long... $ECHO_C" >&6
+if test "${ac_cv_type_long+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&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>
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+if ((long *) 0)
+ return 0;
+if (sizeof (long))
+ return 0;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_type_long=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_type_long=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_type_long" >&5
+echo "${ECHO_T}$ac_cv_type_long" >&6
+
+echo "$as_me:$LINENO: checking size of long" >&5
+echo $ECHO_N "checking size of long... $ECHO_C" >&6
+if test "${ac_cv_sizeof_long+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test "$ac_cv_type_long" = yes; then
+ # The cast to unsigned long works around a bug in the HP C Compiler
+ # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
+ # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
+ # This bug is HP SR number 8606223364.
+ if test "$cross_compiling" = yes; then
+ # Depending upon the size, compute the lo and hi bounds.
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long) (sizeof (long))) >= 0)];
+test_array [0] = 0
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_lo=0 ac_mid=0
+ while :; do
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long) (sizeof (long))) <= $ac_mid)];
+test_array [0] = 0
-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
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_hi=$ac_mid; break
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_lo=`expr $ac_mid + 1`
+ if test $ac_lo -le $ac_mid; then
+ ac_lo= ac_hi=
+ break
+ fi
+ ac_mid=`expr 2 '*' $ac_mid + 1`
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+ done
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long) (sizeof (long))) < 0)];
+test_array [0] = 0
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_hi=-1 ac_mid=-1
+ while :; do
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long) (sizeof (long))) >= $ac_mid)];
+test_array [0] = 0
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_lo=$ac_mid; break
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_hi=`expr '(' $ac_mid ')' - 1`
+ if test $ac_mid -le $ac_hi; then
+ ac_lo= ac_hi=
+ break
+ fi
+ ac_mid=`expr 2 '*' $ac_mid`
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+ done
else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_lo= ac_hi=
fi
-rm -f conftest*
- if test x$ac_cv_sizeof_long != x ; then break; fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+# Binary search between lo and hi bounds.
+while test "x$ac_lo" != "x$ac_hi"; do
+ ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo`
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long) (sizeof (long))) <= $ac_mid)];
+test_array [0] = 0
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_hi=$ac_mid
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_lo=`expr '(' $ac_mid ')' + 1`
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
done
+case $ac_lo in
+?*) ac_cv_sizeof_long=$ac_lo;;
+'') { { echo "$as_me:$LINENO: error: cannot compute sizeof (long), 77
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot compute sizeof (long), 77
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; } ;;
+esac
+else
+ if test "$cross_compiling" = yes; then
+ { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot run test program while cross compiling
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; }
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+long longval () { return (long) (sizeof (long)); }
+unsigned long ulongval () { return (long) (sizeof (long)); }
+#include <stdio.h>
+#include <stdlib.h>
+int
+main ()
+{
-fi
+ FILE *f = fopen ("conftest.val", "w");
+ if (! f)
+ exit (1);
+ if (((long) (sizeof (long))) < 0)
+ {
+ long i = longval ();
+ if (i != ((long) (sizeof (long))))
+ exit (1);
+ fprintf (f, "%ld\n", i);
+ }
+ else
+ {
+ unsigned long i = ulongval ();
+ if (i != ((long) (sizeof (long))))
+ exit (1);
+ fprintf (f, "%lu\n", i);
+ }
+ exit (ferror (f) || fclose (f) != 0);
-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
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_sizeof_long=`cat conftest.val`
+else
+ echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+( exit $ac_status )
+{ { echo "$as_me:$LINENO: error: cannot compute sizeof (long), 77
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot compute sizeof (long), 77
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+fi
+rm -f conftest.val
+else
+ ac_cv_sizeof_long=0
+fi
+fi
+echo "$as_me:$LINENO: result: $ac_cv_sizeof_long" >&5
+echo "${ECHO_T}$ac_cv_sizeof_long" >&6
+cat >>confdefs.h <<_ACEOF
#define SIZEOF_LONG $ac_cv_sizeof_long
-EOF
+_ACEOF
if test "x${ac_cv_sizeof_long}" = "x8"; then
@@ -4648,10 +12117,10 @@ fi
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
+ echo "$as_me:$LINENO: checking for build system executable suffix" >&5
+echo $ECHO_N "checking for build system executable suffix... $ECHO_C" >&6
+if test "${bfd_cv_build_exeext+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
rm -f conftest*
echo 'int main () { return 0; }' > conftest.c
@@ -4666,609 +12135,4855 @@ else
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
+echo "$as_me:$LINENO: result: $bfd_cv_build_exeext" >&5
+echo "${ECHO_T}$bfd_cv_build_exeext" >&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
+
+
+
+
+
+
+for ac_header 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"
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+ echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+else
+ # Is the header compilable?
+echo "$as_me:$LINENO: checking $ac_header usability" >&5
+echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_header_compiler=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_header_compiler=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6
+
+# Is the header present?
+echo "$as_me:$LINENO: checking $ac_header presence" >&5
+echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <$ac_header>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+ else
+ ac_cpp_err=
+ fi
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"
+ ac_cpp_err=yes
fi
-rm -f conftest*
+if test -z "$ac_cpp_err"; then
+ ac_header_preproc=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_header_preproc=no
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
-
+rm -f conftest.err conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6
+
+# So? What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+ yes:no: )
+ { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
+ ac_header_preproc=yes
+ ;;
+ no:yes:* )
+ { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
+echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
+ (
+ cat <<\_ASBOX
+## ------------------------------------------ ##
+## Report this to the AC_PACKAGE_NAME lists. ##
+## ------------------------------------------ ##
+_ASBOX
+ ) |
+ sed "s/^/$as_me: WARNING: /" >&2
+ ;;
+esac
+echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
- echo "$ac_t""no" 1>&6
+ eval "$as_ac_Header=\$ac_header_preproc"
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+
fi
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
done
-for ac_hdr in fcntl.h sys/file.h sys/time.h
+
+
+
+for ac_header 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"
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+ echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+else
+ # Is the header compilable?
+echo "$as_me:$LINENO: checking $ac_header usability" >&5
+echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_header_compiler=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_header_compiler=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6
+
+# Is the header present?
+echo "$as_me:$LINENO: checking $ac_header presence" >&5
+echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <$ac_header>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+ else
+ ac_cpp_err=
+ fi
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"
+ ac_cpp_err=yes
fi
-rm -f conftest*
+if test -z "$ac_cpp_err"; then
+ ac_header_preproc=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_header_preproc=no
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
-
+rm -f conftest.err conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6
+
+# So? What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+ yes:no: )
+ { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
+ ac_header_preproc=yes
+ ;;
+ no:yes:* )
+ { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
+echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
+ (
+ cat <<\_ASBOX
+## ------------------------------------------ ##
+## Report this to the AC_PACKAGE_NAME lists. ##
+## ------------------------------------------ ##
+_ASBOX
+ ) |
+ sed "s/^/$as_me: WARNING: /" >&2
+ ;;
+esac
+echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
- echo "$ac_t""no" 1>&6
+ eval "$as_ac_Header=\$ac_header_preproc"
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+
fi
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+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
+
+
+inttype_headers=`echo inttypes.h sys/inttypes.h | sed -e 's/,/ /g'`
+
+acx_cv_header_stdint=stddef.h
+acx_cv_header_stdint_kind="(already complete)"
+for i in stdint.h $inttype_headers; do
+ unset ac_cv_type_uintptr_t
+ unset ac_cv_type_uintmax_t
+ unset ac_cv_type_int_least32_t
+ unset ac_cv_type_int_fast32_t
+ unset ac_cv_type_uint64_t
+ echo $ECHO_N "looking for a compliant stdint.h in $i, $ECHO_C" >&6
+ echo "$as_me:$LINENO: checking for uintmax_t" >&5
+echo $ECHO_N "checking for uintmax_t... $ECHO_C" >&6
+if test "${ac_cv_type_uintmax_t+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <sys/types.h>
+#include <$i>
+
+int
+main ()
+{
+if ((uintmax_t *) 0)
+ return 0;
+if (sizeof (uintmax_t))
+ return 0;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_type_uintmax_t=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_type_uintmax_t=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_type_uintmax_t" >&5
+echo "${ECHO_T}$ac_cv_type_uintmax_t" >&6
+if test $ac_cv_type_uintmax_t = yes; then
+ acx_cv_header_stdint=$i
+else
+ continue
+fi
+
+ echo "$as_me:$LINENO: checking for uintptr_t" >&5
+echo $ECHO_N "checking for uintptr_t... $ECHO_C" >&6
+if test "${ac_cv_type_uintptr_t+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <sys/types.h>
+#include <$i>
+
+int
+main ()
+{
+if ((uintptr_t *) 0)
+ return 0;
+if (sizeof (uintptr_t))
+ return 0;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_type_uintptr_t=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_type_uintptr_t=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_type_uintptr_t" >&5
+echo "${ECHO_T}$ac_cv_type_uintptr_t" >&6
+if test $ac_cv_type_uintptr_t = yes; then
+ :
+else
+ acx_cv_header_stdint_kind="(mostly complete)"
+fi
+
+ echo "$as_me:$LINENO: checking for int_least32_t" >&5
+echo $ECHO_N "checking for int_least32_t... $ECHO_C" >&6
+if test "${ac_cv_type_int_least32_t+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
- cat > conftest.$ac_ext <<EOF
-#line 4763 "configure"
-#include "confdefs.h"
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <sys/types.h>
+#include <$i>
+
+int
+main ()
+{
+if ((int_least32_t *) 0)
+ return 0;
+if (sizeof (int_least32_t))
+ return 0;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_type_int_least32_t=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_type_int_least32_t=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_type_int_least32_t" >&5
+echo "${ECHO_T}$ac_cv_type_int_least32_t" >&6
+if test $ac_cv_type_int_least32_t = yes; then
+ :
+else
+ acx_cv_header_stdint_kind="(mostly complete)"
+fi
+
+ echo "$as_me:$LINENO: checking for int_fast32_t" >&5
+echo $ECHO_N "checking for int_fast32_t... $ECHO_C" >&6
+if test "${ac_cv_type_int_fast32_t+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <sys/types.h>
+#include <$i>
+
+int
+main ()
+{
+if ((int_fast32_t *) 0)
+ return 0;
+if (sizeof (int_fast32_t))
+ return 0;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_type_int_fast32_t=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_type_int_fast32_t=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_type_int_fast32_t" >&5
+echo "${ECHO_T}$ac_cv_type_int_fast32_t" >&6
+if test $ac_cv_type_int_fast32_t = yes; then
+ :
+else
+ acx_cv_header_stdint_kind="(mostly complete)"
+fi
+
+ echo "$as_me:$LINENO: checking for uint64_t" >&5
+echo $ECHO_N "checking for uint64_t... $ECHO_C" >&6
+if test "${ac_cv_type_uint64_t+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <sys/types.h>
+#include <$i>
+
+int
+main ()
+{
+if ((uint64_t *) 0)
+ return 0;
+if (sizeof (uint64_t))
+ return 0;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_type_uint64_t=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_type_uint64_t=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_type_uint64_t" >&5
+echo "${ECHO_T}$ac_cv_type_uint64_t" >&6
+if test $ac_cv_type_uint64_t = yes; then
+ :
+else
+ acx_cv_header_stdint_kind="(lacks uint64_t)"
+fi
+
+ break
+done
+if test "$acx_cv_header_stdint" = stddef.h; then
+ acx_cv_header_stdint_kind="(lacks uintmax_t)"
+ for i in stdint.h $inttype_headers; do
+ unset ac_cv_type_uintptr_t
+ unset ac_cv_type_uint32_t
+ unset ac_cv_type_uint64_t
+ echo $ECHO_N "looking for an incomplete stdint.h in $i, $ECHO_C" >&6
+ echo "$as_me:$LINENO: checking for uint32_t" >&5
+echo $ECHO_N "checking for uint32_t... $ECHO_C" >&6
+if test "${ac_cv_type_uint32_t+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <sys/types.h>
+#include <$i>
+
+int
+main ()
+{
+if ((uint32_t *) 0)
+ return 0;
+if (sizeof (uint32_t))
+ return 0;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_type_uint32_t=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_type_uint32_t=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_type_uint32_t" >&5
+echo "${ECHO_T}$ac_cv_type_uint32_t" >&6
+if test $ac_cv_type_uint32_t = yes; then
+ acx_cv_header_stdint=$i
+else
+ continue
+fi
+
+ echo "$as_me:$LINENO: checking for uint64_t" >&5
+echo $ECHO_N "checking for uint64_t... $ECHO_C" >&6
+if test "${ac_cv_type_uint64_t+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <sys/types.h>
+#include <$i>
+
+int
+main ()
+{
+if ((uint64_t *) 0)
+ return 0;
+if (sizeof (uint64_t))
+ return 0;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_type_uint64_t=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_type_uint64_t=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_type_uint64_t" >&5
+echo "${ECHO_T}$ac_cv_type_uint64_t" >&6
+
+ echo "$as_me:$LINENO: checking for uintptr_t" >&5
+echo $ECHO_N "checking for uintptr_t... $ECHO_C" >&6
+if test "${ac_cv_type_uintptr_t+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <sys/types.h>
+#include <$i>
+
+int
+main ()
+{
+if ((uintptr_t *) 0)
+ return 0;
+if (sizeof (uintptr_t))
+ return 0;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_type_uintptr_t=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_type_uintptr_t=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_type_uintptr_t" >&5
+echo "${ECHO_T}$ac_cv_type_uintptr_t" >&6
+
+ break
+ done
+fi
+if test "$acx_cv_header_stdint" = stddef.h; then
+ acx_cv_header_stdint_kind="(u_intXX_t style)"
+ for i in sys/types.h $inttype_headers; do
+ unset ac_cv_type_u_int32_t
+ unset ac_cv_type_u_int64_t
+ echo $ECHO_N "looking for u_intXX_t types in $i, $ECHO_C" >&6
+ echo "$as_me:$LINENO: checking for u_int32_t" >&5
+echo $ECHO_N "checking for u_int32_t... $ECHO_C" >&6
+if test "${ac_cv_type_u_int32_t+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <sys/types.h>
+#include <$i>
+
+int
+main ()
+{
+if ((u_int32_t *) 0)
+ return 0;
+if (sizeof (u_int32_t))
+ return 0;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_type_u_int32_t=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_type_u_int32_t=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_type_u_int32_t" >&5
+echo "${ECHO_T}$ac_cv_type_u_int32_t" >&6
+if test $ac_cv_type_u_int32_t = yes; then
+ acx_cv_header_stdint=$i
+else
+ continue
+fi
+
+ echo "$as_me:$LINENO: checking for u_int64_t" >&5
+echo $ECHO_N "checking for u_int64_t... $ECHO_C" >&6
+if test "${ac_cv_type_u_int64_t+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <sys/types.h>
+#include <$i>
+
+int
+main ()
+{
+if ((u_int64_t *) 0)
+ return 0;
+if (sizeof (u_int64_t))
+ return 0;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_type_u_int64_t=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_type_u_int64_t=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_type_u_int64_t" >&5
+echo "${ECHO_T}$ac_cv_type_u_int64_t" >&6
+
+ break
+ done
+fi
+if test "$acx_cv_header_stdint" = stddef.h; then
+ acx_cv_header_stdint_kind="(using manual detection)"
+fi
+
+test -z "$ac_cv_type_uintptr_t" && ac_cv_type_uintptr_t=no
+test -z "$ac_cv_type_uint64_t" && ac_cv_type_uint64_t=no
+test -z "$ac_cv_type_u_int64_t" && ac_cv_type_u_int64_t=no
+test -z "$ac_cv_type_int_least32_t" && ac_cv_type_int_least32_t=no
+test -z "$ac_cv_type_int_fast32_t" && ac_cv_type_int_fast32_t=no
+
+# ----------------- Summarize what we found so far
+
+echo "$as_me:$LINENO: checking what to include in bfd_stdint.h" >&5
+echo $ECHO_N "checking what to include in bfd_stdint.h... $ECHO_C" >&6
+
+case `$as_basename bfd_stdint.h ||
+$as_expr X/bfd_stdint.h : '.*/\([^/][^/]*\)/*$' \| \
+ Xbfd_stdint.h : 'X\(//\)$' \| \
+ Xbfd_stdint.h : 'X\(/\)$' \| \
+ . : '\(.\)' 2>/dev/null ||
+echo X/bfd_stdint.h |
+ sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; }
+ /^X\/\(\/\/\)$/{ s//\1/; q; }
+ /^X\/\(\/\).*/{ s//\1/; q; }
+ s/.*/./; q'` in
+ stdint.h) { echo "$as_me:$LINENO: WARNING: are you sure you want it there?" >&5
+echo "$as_me: WARNING: are you sure you want it there?" >&2;} ;;
+ inttypes.h) { echo "$as_me:$LINENO: WARNING: are you sure you want it there?" >&5
+echo "$as_me: WARNING: are you sure you want it there?" >&2;} ;;
+ *) ;;
+esac
+
+echo "$as_me:$LINENO: result: $acx_cv_header_stdint $acx_cv_header_stdint_kind" >&5
+echo "${ECHO_T}$acx_cv_header_stdint $acx_cv_header_stdint_kind" >&6
+
+# ----------------- done included file, check C basic types --------
+
+# Lacking an uintptr_t? Test size of void *
+case "$acx_cv_header_stdint:$ac_cv_type_uintptr_t" in
+ stddef.h:* | *:no) echo "$as_me:$LINENO: checking for void *" >&5
+echo $ECHO_N "checking for void *... $ECHO_C" >&6
+if test "${ac_cv_type_void_p+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+if ((void * *) 0)
+ return 0;
+if (sizeof (void *))
+ return 0;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_type_void_p=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_type_void_p=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_type_void_p" >&5
+echo "${ECHO_T}$ac_cv_type_void_p" >&6
+
+echo "$as_me:$LINENO: checking size of void *" >&5
+echo $ECHO_N "checking size of void *... $ECHO_C" >&6
+if test "${ac_cv_sizeof_void_p+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test "$ac_cv_type_void_p" = yes; then
+ # The cast to unsigned long works around a bug in the HP C Compiler
+ # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
+ # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
+ # This bug is HP SR number 8606223364.
+ if test "$cross_compiling" = yes; then
+ # Depending upon the size, compute the lo and hi bounds.
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long) (sizeof (void *))) >= 0)];
+test_array [0] = 0
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_lo=0 ac_mid=0
+ while :; do
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long) (sizeof (void *))) <= $ac_mid)];
+test_array [0] = 0
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_hi=$ac_mid; break
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_lo=`expr $ac_mid + 1`
+ if test $ac_lo -le $ac_mid; then
+ ac_lo= ac_hi=
+ break
+ fi
+ ac_mid=`expr 2 '*' $ac_mid + 1`
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+ done
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long) (sizeof (void *))) < 0)];
+test_array [0] = 0
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_hi=-1 ac_mid=-1
+ while :; do
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long) (sizeof (void *))) >= $ac_mid)];
+test_array [0] = 0
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_lo=$ac_mid; break
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_hi=`expr '(' $ac_mid ')' - 1`
+ if test $ac_mid -le $ac_hi; then
+ ac_lo= ac_hi=
+ break
+ fi
+ ac_mid=`expr 2 '*' $ac_mid`
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+ done
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_lo= ac_hi=
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+# Binary search between lo and hi bounds.
+while test "x$ac_lo" != "x$ac_hi"; do
+ ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo`
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long) (sizeof (void *))) <= $ac_mid)];
+test_array [0] = 0
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_hi=$ac_mid
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_lo=`expr '(' $ac_mid ')' + 1`
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+done
+case $ac_lo in
+?*) ac_cv_sizeof_void_p=$ac_lo;;
+'') { { echo "$as_me:$LINENO: error: cannot compute sizeof (void *), 77
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot compute sizeof (void *), 77
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; } ;;
+esac
+else
+ if test "$cross_compiling" = yes; then
+ { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot run test program while cross compiling
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; }
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+long longval () { return (long) (sizeof (void *)); }
+unsigned long ulongval () { return (long) (sizeof (void *)); }
+#include <stdio.h>
+#include <stdlib.h>
+int
+main ()
+{
+
+ FILE *f = fopen ("conftest.val", "w");
+ if (! f)
+ exit (1);
+ if (((long) (sizeof (void *))) < 0)
+ {
+ long i = longval ();
+ if (i != ((long) (sizeof (void *))))
+ exit (1);
+ fprintf (f, "%ld\n", i);
+ }
+ else
+ {
+ unsigned long i = ulongval ();
+ if (i != ((long) (sizeof (void *))))
+ exit (1);
+ fprintf (f, "%lu\n", i);
+ }
+ exit (ferror (f) || fclose (f) != 0);
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_sizeof_void_p=`cat conftest.val`
+else
+ echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+( exit $ac_status )
+{ { echo "$as_me:$LINENO: error: cannot compute sizeof (void *), 77
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot compute sizeof (void *), 77
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+fi
+rm -f conftest.val
+else
+ ac_cv_sizeof_void_p=0
+fi
+fi
+echo "$as_me:$LINENO: result: $ac_cv_sizeof_void_p" >&5
+echo "${ECHO_T}$ac_cv_sizeof_void_p" >&6
+cat >>confdefs.h <<_ACEOF
+#define SIZEOF_VOID_P $ac_cv_sizeof_void_p
+_ACEOF
+
+ ;;
+esac
+
+# Lacking an uint64_t? Test size of long
+case "$acx_cv_header_stdint:$ac_cv_type_uint64_t:$ac_cv_type_u_int64_t" in
+ stddef.h:*:* | *:no:no) echo "$as_me:$LINENO: checking for long" >&5
+echo $ECHO_N "checking for long... $ECHO_C" >&6
+if test "${ac_cv_type_long+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+if ((long *) 0)
+ return 0;
+if (sizeof (long))
+ return 0;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_type_long=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_type_long=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_type_long" >&5
+echo "${ECHO_T}$ac_cv_type_long" >&6
+
+echo "$as_me:$LINENO: checking size of long" >&5
+echo $ECHO_N "checking size of long... $ECHO_C" >&6
+if test "${ac_cv_sizeof_long+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test "$ac_cv_type_long" = yes; then
+ # The cast to unsigned long works around a bug in the HP C Compiler
+ # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
+ # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
+ # This bug is HP SR number 8606223364.
+ if test "$cross_compiling" = yes; then
+ # Depending upon the size, compute the lo and hi bounds.
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long) (sizeof (long))) >= 0)];
+test_array [0] = 0
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_lo=0 ac_mid=0
+ while :; do
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long) (sizeof (long))) <= $ac_mid)];
+test_array [0] = 0
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_hi=$ac_mid; break
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_lo=`expr $ac_mid + 1`
+ if test $ac_lo -le $ac_mid; then
+ ac_lo= ac_hi=
+ break
+ fi
+ ac_mid=`expr 2 '*' $ac_mid + 1`
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+ done
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long) (sizeof (long))) < 0)];
+test_array [0] = 0
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_hi=-1 ac_mid=-1
+ while :; do
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long) (sizeof (long))) >= $ac_mid)];
+test_array [0] = 0
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_lo=$ac_mid; break
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_hi=`expr '(' $ac_mid ')' - 1`
+ if test $ac_mid -le $ac_hi; then
+ ac_lo= ac_hi=
+ break
+ fi
+ ac_mid=`expr 2 '*' $ac_mid`
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+ done
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_lo= ac_hi=
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+# Binary search between lo and hi bounds.
+while test "x$ac_lo" != "x$ac_hi"; do
+ ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo`
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long) (sizeof (long))) <= $ac_mid)];
+test_array [0] = 0
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_hi=$ac_mid
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_lo=`expr '(' $ac_mid ')' + 1`
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+done
+case $ac_lo in
+?*) ac_cv_sizeof_long=$ac_lo;;
+'') { { echo "$as_me:$LINENO: error: cannot compute sizeof (long), 77
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot compute sizeof (long), 77
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; } ;;
+esac
+else
+ if test "$cross_compiling" = yes; then
+ { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot run test program while cross compiling
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; }
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+long longval () { return (long) (sizeof (long)); }
+unsigned long ulongval () { return (long) (sizeof (long)); }
+#include <stdio.h>
+#include <stdlib.h>
+int
+main ()
+{
+
+ FILE *f = fopen ("conftest.val", "w");
+ if (! f)
+ exit (1);
+ if (((long) (sizeof (long))) < 0)
+ {
+ long i = longval ();
+ if (i != ((long) (sizeof (long))))
+ exit (1);
+ fprintf (f, "%ld\n", i);
+ }
+ else
+ {
+ unsigned long i = ulongval ();
+ if (i != ((long) (sizeof (long))))
+ exit (1);
+ fprintf (f, "%lu\n", i);
+ }
+ exit (ferror (f) || fclose (f) != 0);
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_sizeof_long=`cat conftest.val`
+else
+ echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+( exit $ac_status )
+{ { echo "$as_me:$LINENO: error: cannot compute sizeof (long), 77
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot compute sizeof (long), 77
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+fi
+rm -f conftest.val
+else
+ ac_cv_sizeof_long=0
+fi
+fi
+echo "$as_me:$LINENO: result: $ac_cv_sizeof_long" >&5
+echo "${ECHO_T}$ac_cv_sizeof_long" >&6
+cat >>confdefs.h <<_ACEOF
+#define SIZEOF_LONG $ac_cv_sizeof_long
+_ACEOF
+
+ ;;
+esac
+
+if test $acx_cv_header_stdint = stddef.h; then
+ # Lacking a good header? Test size of everything and deduce all types.
+ echo "$as_me:$LINENO: checking for int" >&5
+echo $ECHO_N "checking for int... $ECHO_C" >&6
+if test "${ac_cv_type_int+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+if ((int *) 0)
+ return 0;
+if (sizeof (int))
+ return 0;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_type_int=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_type_int=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_type_int" >&5
+echo "${ECHO_T}$ac_cv_type_int" >&6
+
+echo "$as_me:$LINENO: checking size of int" >&5
+echo $ECHO_N "checking size of int... $ECHO_C" >&6
+if test "${ac_cv_sizeof_int+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test "$ac_cv_type_int" = yes; then
+ # The cast to unsigned long works around a bug in the HP C Compiler
+ # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
+ # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
+ # This bug is HP SR number 8606223364.
+ if test "$cross_compiling" = yes; then
+ # Depending upon the size, compute the lo and hi bounds.
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long) (sizeof (int))) >= 0)];
+test_array [0] = 0
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_lo=0 ac_mid=0
+ while :; do
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long) (sizeof (int))) <= $ac_mid)];
+test_array [0] = 0
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_hi=$ac_mid; break
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_lo=`expr $ac_mid + 1`
+ if test $ac_lo -le $ac_mid; then
+ ac_lo= ac_hi=
+ break
+ fi
+ ac_mid=`expr 2 '*' $ac_mid + 1`
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+ done
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long) (sizeof (int))) < 0)];
+test_array [0] = 0
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_hi=-1 ac_mid=-1
+ while :; do
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long) (sizeof (int))) >= $ac_mid)];
+test_array [0] = 0
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_lo=$ac_mid; break
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_hi=`expr '(' $ac_mid ')' - 1`
+ if test $ac_mid -le $ac_hi; then
+ ac_lo= ac_hi=
+ break
+ fi
+ ac_mid=`expr 2 '*' $ac_mid`
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+ done
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_lo= ac_hi=
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+# Binary search between lo and hi bounds.
+while test "x$ac_lo" != "x$ac_hi"; do
+ ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo`
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long) (sizeof (int))) <= $ac_mid)];
+test_array [0] = 0
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_hi=$ac_mid
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_lo=`expr '(' $ac_mid ')' + 1`
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+done
+case $ac_lo in
+?*) ac_cv_sizeof_int=$ac_lo;;
+'') { { echo "$as_me:$LINENO: error: cannot compute sizeof (int), 77
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot compute sizeof (int), 77
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; } ;;
+esac
+else
+ if test "$cross_compiling" = yes; then
+ { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot run test program while cross compiling
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; }
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+long longval () { return (long) (sizeof (int)); }
+unsigned long ulongval () { return (long) (sizeof (int)); }
+#include <stdio.h>
+#include <stdlib.h>
+int
+main ()
+{
+
+ FILE *f = fopen ("conftest.val", "w");
+ if (! f)
+ exit (1);
+ if (((long) (sizeof (int))) < 0)
+ {
+ long i = longval ();
+ if (i != ((long) (sizeof (int))))
+ exit (1);
+ fprintf (f, "%ld\n", i);
+ }
+ else
+ {
+ unsigned long i = ulongval ();
+ if (i != ((long) (sizeof (int))))
+ exit (1);
+ fprintf (f, "%lu\n", i);
+ }
+ exit (ferror (f) || fclose (f) != 0);
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_sizeof_int=`cat conftest.val`
+else
+ echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+( exit $ac_status )
+{ { echo "$as_me:$LINENO: error: cannot compute sizeof (int), 77
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot compute sizeof (int), 77
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+fi
+rm -f conftest.val
+else
+ ac_cv_sizeof_int=0
+fi
+fi
+echo "$as_me:$LINENO: result: $ac_cv_sizeof_int" >&5
+echo "${ECHO_T}$ac_cv_sizeof_int" >&6
+cat >>confdefs.h <<_ACEOF
+#define SIZEOF_INT $ac_cv_sizeof_int
+_ACEOF
+
+
+ echo "$as_me:$LINENO: checking for short" >&5
+echo $ECHO_N "checking for short... $ECHO_C" >&6
+if test "${ac_cv_type_short+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+if ((short *) 0)
+ return 0;
+if (sizeof (short))
+ return 0;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_type_short=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_type_short=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_type_short" >&5
+echo "${ECHO_T}$ac_cv_type_short" >&6
+
+echo "$as_me:$LINENO: checking size of short" >&5
+echo $ECHO_N "checking size of short... $ECHO_C" >&6
+if test "${ac_cv_sizeof_short+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test "$ac_cv_type_short" = yes; then
+ # The cast to unsigned long works around a bug in the HP C Compiler
+ # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
+ # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
+ # This bug is HP SR number 8606223364.
+ if test "$cross_compiling" = yes; then
+ # Depending upon the size, compute the lo and hi bounds.
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long) (sizeof (short))) >= 0)];
+test_array [0] = 0
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_lo=0 ac_mid=0
+ while :; do
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long) (sizeof (short))) <= $ac_mid)];
+test_array [0] = 0
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_hi=$ac_mid; break
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_lo=`expr $ac_mid + 1`
+ if test $ac_lo -le $ac_mid; then
+ ac_lo= ac_hi=
+ break
+ fi
+ ac_mid=`expr 2 '*' $ac_mid + 1`
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+ done
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long) (sizeof (short))) < 0)];
+test_array [0] = 0
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_hi=-1 ac_mid=-1
+ while :; do
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long) (sizeof (short))) >= $ac_mid)];
+test_array [0] = 0
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_lo=$ac_mid; break
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_hi=`expr '(' $ac_mid ')' - 1`
+ if test $ac_mid -le $ac_hi; then
+ ac_lo= ac_hi=
+ break
+ fi
+ ac_mid=`expr 2 '*' $ac_mid`
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+ done
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_lo= ac_hi=
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+# Binary search between lo and hi bounds.
+while test "x$ac_lo" != "x$ac_hi"; do
+ ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo`
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long) (sizeof (short))) <= $ac_mid)];
+test_array [0] = 0
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_hi=$ac_mid
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_lo=`expr '(' $ac_mid ')' + 1`
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+done
+case $ac_lo in
+?*) ac_cv_sizeof_short=$ac_lo;;
+'') { { echo "$as_me:$LINENO: error: cannot compute sizeof (short), 77
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot compute sizeof (short), 77
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; } ;;
+esac
+else
+ if test "$cross_compiling" = yes; then
+ { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot run test program while cross compiling
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; }
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+long longval () { return (long) (sizeof (short)); }
+unsigned long ulongval () { return (long) (sizeof (short)); }
+#include <stdio.h>
+#include <stdlib.h>
+int
+main ()
+{
+
+ FILE *f = fopen ("conftest.val", "w");
+ if (! f)
+ exit (1);
+ if (((long) (sizeof (short))) < 0)
+ {
+ long i = longval ();
+ if (i != ((long) (sizeof (short))))
+ exit (1);
+ fprintf (f, "%ld\n", i);
+ }
+ else
+ {
+ unsigned long i = ulongval ();
+ if (i != ((long) (sizeof (short))))
+ exit (1);
+ fprintf (f, "%lu\n", i);
+ }
+ exit (ferror (f) || fclose (f) != 0);
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_sizeof_short=`cat conftest.val`
+else
+ echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+( exit $ac_status )
+{ { echo "$as_me:$LINENO: error: cannot compute sizeof (short), 77
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot compute sizeof (short), 77
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+fi
+rm -f conftest.val
+else
+ ac_cv_sizeof_short=0
+fi
+fi
+echo "$as_me:$LINENO: result: $ac_cv_sizeof_short" >&5
+echo "${ECHO_T}$ac_cv_sizeof_short" >&6
+cat >>confdefs.h <<_ACEOF
+#define SIZEOF_SHORT $ac_cv_sizeof_short
+_ACEOF
+
+
+ echo "$as_me:$LINENO: checking for char" >&5
+echo $ECHO_N "checking for char... $ECHO_C" >&6
+if test "${ac_cv_type_char+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+if ((char *) 0)
+ return 0;
+if (sizeof (char))
+ return 0;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_type_char=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_type_char=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_type_char" >&5
+echo "${ECHO_T}$ac_cv_type_char" >&6
+
+echo "$as_me:$LINENO: checking size of char" >&5
+echo $ECHO_N "checking size of char... $ECHO_C" >&6
+if test "${ac_cv_sizeof_char+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test "$ac_cv_type_char" = yes; then
+ # The cast to unsigned long works around a bug in the HP C Compiler
+ # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
+ # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
+ # This bug is HP SR number 8606223364.
+ if test "$cross_compiling" = yes; then
+ # Depending upon the size, compute the lo and hi bounds.
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long) (sizeof (char))) >= 0)];
+test_array [0] = 0
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_lo=0 ac_mid=0
+ while :; do
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long) (sizeof (char))) <= $ac_mid)];
+test_array [0] = 0
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_hi=$ac_mid; break
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_lo=`expr $ac_mid + 1`
+ if test $ac_lo -le $ac_mid; then
+ ac_lo= ac_hi=
+ break
+ fi
+ ac_mid=`expr 2 '*' $ac_mid + 1`
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+ done
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long) (sizeof (char))) < 0)];
+test_array [0] = 0
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_hi=-1 ac_mid=-1
+ while :; do
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long) (sizeof (char))) >= $ac_mid)];
+test_array [0] = 0
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_lo=$ac_mid; break
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_hi=`expr '(' $ac_mid ')' - 1`
+ if test $ac_mid -le $ac_hi; then
+ ac_lo= ac_hi=
+ break
+ fi
+ ac_mid=`expr 2 '*' $ac_mid`
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+ done
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_lo= ac_hi=
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+# Binary search between lo and hi bounds.
+while test "x$ac_lo" != "x$ac_hi"; do
+ ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo`
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long) (sizeof (char))) <= $ac_mid)];
+test_array [0] = 0
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_hi=$ac_mid
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_lo=`expr '(' $ac_mid ')' + 1`
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+done
+case $ac_lo in
+?*) ac_cv_sizeof_char=$ac_lo;;
+'') { { echo "$as_me:$LINENO: error: cannot compute sizeof (char), 77
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot compute sizeof (char), 77
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; } ;;
+esac
+else
+ if test "$cross_compiling" = yes; then
+ { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot run test program while cross compiling
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; }
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+long longval () { return (long) (sizeof (char)); }
+unsigned long ulongval () { return (long) (sizeof (char)); }
+#include <stdio.h>
+#include <stdlib.h>
+int
+main ()
+{
+
+ FILE *f = fopen ("conftest.val", "w");
+ if (! f)
+ exit (1);
+ if (((long) (sizeof (char))) < 0)
+ {
+ long i = longval ();
+ if (i != ((long) (sizeof (char))))
+ exit (1);
+ fprintf (f, "%ld\n", i);
+ }
+ else
+ {
+ unsigned long i = ulongval ();
+ if (i != ((long) (sizeof (char))))
+ exit (1);
+ fprintf (f, "%lu\n", i);
+ }
+ exit (ferror (f) || fclose (f) != 0);
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_sizeof_char=`cat conftest.val`
+else
+ echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+( exit $ac_status )
+{ { echo "$as_me:$LINENO: error: cannot compute sizeof (char), 77
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot compute sizeof (char), 77
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+fi
+rm -f conftest.val
+else
+ ac_cv_sizeof_char=0
+fi
+fi
+echo "$as_me:$LINENO: result: $ac_cv_sizeof_char" >&5
+echo "${ECHO_T}$ac_cv_sizeof_char" >&6
+cat >>confdefs.h <<_ACEOF
+#define SIZEOF_CHAR $ac_cv_sizeof_char
+_ACEOF
+
+
+
+ echo "$as_me:$LINENO: checking for type equivalent to int8_t" >&5
+echo $ECHO_N "checking for type equivalent to int8_t... $ECHO_C" >&6
+ case "$ac_cv_sizeof_char" in
+ 1) acx_cv_type_int8_t=char ;;
+ *) { { echo "$as_me:$LINENO: error: no 8-bit type" >&5
+echo "$as_me: error: no 8-bit type" >&2;}
+ { (exit please report a bug); exit please report a bug; }; }
+ esac
+ echo "$as_me:$LINENO: result: $acx_cv_type_int8_t" >&5
+echo "${ECHO_T}$acx_cv_type_int8_t" >&6
+
+ echo "$as_me:$LINENO: checking for type equivalent to int16_t" >&5
+echo $ECHO_N "checking for type equivalent to int16_t... $ECHO_C" >&6
+ case "$ac_cv_sizeof_int:$ac_cv_sizeof_short" in
+ 2:*) acx_cv_type_int16_t=int ;;
+ *:2) acx_cv_type_int16_t=short ;;
+ *) { { echo "$as_me:$LINENO: error: no 16-bit type" >&5
+echo "$as_me: error: no 16-bit type" >&2;}
+ { (exit please report a bug); exit please report a bug; }; }
+ esac
+ echo "$as_me:$LINENO: result: $acx_cv_type_int16_t" >&5
+echo "${ECHO_T}$acx_cv_type_int16_t" >&6
+
+ echo "$as_me:$LINENO: checking for type equivalent to int32_t" >&5
+echo $ECHO_N "checking for type equivalent to int32_t... $ECHO_C" >&6
+ case "$ac_cv_sizeof_int:$ac_cv_sizeof_long" in
+ 4:*) acx_cv_type_int32_t=int ;;
+ *:4) acx_cv_type_int32_t=long ;;
+ *) { { echo "$as_me:$LINENO: error: no 32-bit type" >&5
+echo "$as_me: error: no 32-bit type" >&2;}
+ { (exit please report a bug); exit please report a bug; }; }
+ esac
+ echo "$as_me:$LINENO: result: $acx_cv_type_int32_t" >&5
+echo "${ECHO_T}$acx_cv_type_int32_t" >&6
+fi
+
+# These tests are here to make the output prettier
+
+if test "$ac_cv_type_uint64_t" != yes && test "$ac_cv_type_u_int64_t" != yes; then
+ case "$ac_cv_sizeof_long" in
+ 8) acx_cv_type_int64_t=long ;;
+ esac
+ echo "$as_me:$LINENO: checking for type equivalent to int64_t" >&5
+echo $ECHO_N "checking for type equivalent to int64_t... $ECHO_C" >&6
+ echo "$as_me:$LINENO: result: ${acx_cv_type_int64_t-'using preprocessor symbols'}" >&5
+echo "${ECHO_T}${acx_cv_type_int64_t-'using preprocessor symbols'}" >&6
+fi
+
+# Now we can use the above types
+
+if test "$ac_cv_type_uintptr_t" != yes; then
+ echo "$as_me:$LINENO: checking for type equivalent to intptr_t" >&5
+echo $ECHO_N "checking for type equivalent to intptr_t... $ECHO_C" >&6
+ case $ac_cv_sizeof_void_p in
+ 2) acx_cv_type_intptr_t=int16_t ;;
+ 4) acx_cv_type_intptr_t=int32_t ;;
+ 8) acx_cv_type_intptr_t=int64_t ;;
+ *) { { echo "$as_me:$LINENO: error: no equivalent for intptr_t" >&5
+echo "$as_me: error: no equivalent for intptr_t" >&2;}
+ { (exit please report a bug); exit please report a bug; }; }
+ esac
+ echo "$as_me:$LINENO: result: $acx_cv_type_intptr_t" >&5
+echo "${ECHO_T}$acx_cv_type_intptr_t" >&6
+fi
+
+# ----------------- done all checks, emit header -------------
+ ac_config_commands="$ac_config_commands bfd_stdint.h"
+
+
+
+echo "$as_me:$LINENO: checking whether time.h and sys/time.h may both be included" >&5
+echo $ECHO_N "checking whether time.h and sys/time.h may both be included... $ECHO_C" >&6
+if test "${ac_cv_header_time+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end 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*
+
+int
+main ()
+{
+if ((struct tm *) 0)
+return 0;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
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
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_header_time=no
fi
-rm -f conftest*
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
fi
-
-echo "$ac_t""$ac_cv_header_time" 1>&6
+echo "$as_me:$LINENO: result: $ac_cv_header_time" >&5
+echo "${ECHO_T}$ac_cv_header_time" >&6
if test $ac_cv_header_time = yes; then
- cat >> confdefs.h <<\EOF
+
+cat >>confdefs.h <<\_ACEOF
#define TIME_WITH_SYS_TIME 1
-EOF
+_ACEOF
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"
+for ac_hdr in dirent.h sys/ndir.h sys/dir.h ndir.h; do
+ as_ac_Header=`echo "ac_cv_header_dirent_$ac_hdr" | $as_tr_sh`
+echo "$as_me:$LINENO: checking for $ac_hdr that defines DIR" >&5
+echo $ECHO_N "checking for $ac_hdr that defines DIR... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end 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
+
+int
+main ()
+{
+if ((DIR *) 0)
+return 0;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ eval "$as_ac_Header=yes"
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+eval "$as_ac_Header=no"
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_hdr" | $as_tr_cpp` 1
+_ACEOF
+
+ac_header_dirent=$ac_hdr; break
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"
+ echo "$as_me:$LINENO: checking for library containing opendir" >&5
+echo $ECHO_N "checking for library containing opendir... $ECHO_C" >&6
+if test "${ac_cv_search_opendir+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_func_search_save_LIBS=$LIBS
+ac_cv_search_opendir=no
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
/* Override any gcc2 internal prototype to avoid an error. */
+#ifdef __cplusplus
+extern "C"
+#endif
/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
-char opendir();
+ builtin and then its argument prototype would still apply. */
+char opendir ();
+int
+main ()
+{
+opendir ();
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_search_opendir="none required"
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+if test "$ac_cv_search_opendir" = no; then
+ for ac_lib in dir; do
+ LIBS="-l$ac_lib $ac_func_search_save_LIBS"
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
-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"
+/* Override any gcc2 internal prototype to avoid an error. */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* 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;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_search_opendir="-l$ac_lib"
+break
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+ done
fi
-rm -f conftest*
-LIBS="$ac_save_LIBS"
-
+LIBS=$ac_func_search_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
+echo "$as_me:$LINENO: result: $ac_cv_search_opendir" >&5
+echo "${ECHO_T}$ac_cv_search_opendir" >&6
+if test "$ac_cv_search_opendir" != no; then
+ test "$ac_cv_search_opendir" = "none required" || LIBS="$ac_cv_search_opendir $LIBS"
+
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
+ echo "$as_me:$LINENO: checking for library containing opendir" >&5
+echo $ECHO_N "checking for library containing opendir... $ECHO_C" >&6
+if test "${ac_cv_search_opendir+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
- ac_save_LIBS="$LIBS"
-LIBS="-lx $LIBS"
-cat > conftest.$ac_ext <<EOF
-#line 4884 "configure"
-#include "confdefs.h"
+ ac_func_search_save_LIBS=$LIBS
+ac_cv_search_opendir=no
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+/* Override any gcc2 internal prototype to avoid an error. */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* 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;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_search_opendir="none required"
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+if test "$ac_cv_search_opendir" = no; then
+ for ac_lib in x; do
+ LIBS="-l$ac_lib $ac_func_search_save_LIBS"
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
/* Override any gcc2 internal prototype to avoid an error. */
+#ifdef __cplusplus
+extern "C"
+#endif
/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
-char opendir();
+ builtin and then its argument prototype would still apply. */
+char opendir ();
+int
+main ()
+{
+opendir ();
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_search_opendir="-l$ac_lib"
+break
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+ done
+fi
+LIBS=$ac_func_search_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_search_opendir" >&5
+echo "${ECHO_T}$ac_cv_search_opendir" >&6
+if test "$ac_cv_search_opendir" != no; then
+ test "$ac_cv_search_opendir" = "none required" || LIBS="$ac_cv_search_opendir $LIBS"
-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"
+
+echo "$as_me:$LINENO: checking whether string.h and strings.h may both be included" >&5
+echo $ECHO_N "checking whether string.h and strings.h may both be included... $ECHO_C" >&6
+if test "${gcc_cv_header_string+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <string.h>
+#include <strings.h>
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ gcc_cv_header_string=yes
else
- echo "$ac_t""no" 1>&6
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+gcc_cv_header_string=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
fi
+echo "$as_me:$LINENO: result: $gcc_cv_header_string" >&5
+echo "${ECHO_T}$gcc_cv_header_string" >&6
+if test $gcc_cv_header_string = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define STRING_WITH_STRINGS 1
+_ACEOF
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"
+as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
+echo "$as_me:$LINENO: checking for $ac_func" >&5
+echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6
+if eval "test \"\${$as_ac_var+set}\" = set"; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
+ For example, HP-UX 11i <limits.h> declares gettimeofday. */
+#define $ac_func innocuous_$ac_func
+
/* 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();
+ which can conflict with char $ac_func (); below.
+ Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ <limits.h> exists even on freestanding compilers. */
+
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
-int main() {
+#undef $ac_func
+/* Override any gcc2 internal prototype to avoid an error. */
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+/* 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 ();
/* 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();
+char (*f) () = $ac_func;
+#endif
+#ifdef __cplusplus
+}
#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
+int
+main ()
+{
+return f != $ac_func;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ eval "$as_ac_var=yes"
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+eval "$as_ac_var=no"
+fi
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6
+if test `eval echo '${'$as_ac_var'}'` = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
-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"
+as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
+echo "$as_me:$LINENO: checking for $ac_func" >&5
+echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6
+if eval "test \"\${$as_ac_var+set}\" = set"; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
+ For example, HP-UX 11i <limits.h> declares gettimeofday. */
+#define $ac_func innocuous_$ac_func
+
/* 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();
+ which can conflict with char $ac_func (); below.
+ Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ <limits.h> exists even on freestanding compilers. */
+
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
-int main() {
+#undef $ac_func
+/* Override any gcc2 internal prototype to avoid an error. */
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+/* 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 ();
/* 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();
+char (*f) () = $ac_func;
+#endif
+#ifdef __cplusplus
+}
#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
+int
+main ()
+{
+return f != $ac_func;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ eval "$as_ac_var=yes"
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+eval "$as_ac_var=no"
+fi
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6
+if test `eval echo '${'$as_ac_var'}'` = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
-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
+echo "$as_me:$LINENO: checking whether basename is declared" >&5
+echo $ECHO_N "checking whether basename is declared... $ECHO_C" >&6
+if test "${ac_cv_have_decl_basename+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
- cat > conftest.$ac_ext <<EOF
-#line 5043 "configure"
-#include "confdefs.h"
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+#ifndef basename
+ char *p = (char *) basename;
+#endif
-#include <stdio.h>
-#ifdef HAVE_STRING_H
-#include <string.h>
-#else
-#ifdef HAVE_STRINGS_H
-#include <strings.h>
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_have_decl_basename=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_have_decl_basename=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_have_decl_basename" >&5
+echo "${ECHO_T}$ac_cv_have_decl_basename" >&6
+if test $ac_cv_have_decl_basename = yes; then
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_BASENAME 1
+_ACEOF
+
+
+else
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_BASENAME 0
+_ACEOF
+
+
+fi
+
+
+echo "$as_me:$LINENO: checking whether ftello is declared" >&5
+echo $ECHO_N "checking whether ftello is declared... $ECHO_C" >&6
+if test "${ac_cv_have_decl_ftello+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+#ifndef ftello
+ char *p = (char *) ftello;
#endif
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_have_decl_ftello=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_have_decl_ftello=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_have_decl_ftello" >&5
+echo "${ECHO_T}$ac_cv_have_decl_ftello" >&6
+if test $ac_cv_have_decl_ftello = yes; then
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_FTELLO 1
+_ACEOF
+
+
+else
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_FTELLO 0
+_ACEOF
+
+
+fi
+
+
+echo "$as_me:$LINENO: checking whether ftello64 is declared" >&5
+echo $ECHO_N "checking whether ftello64 is declared... $ECHO_C" >&6
+if test "${ac_cv_have_decl_ftello64+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+#ifndef ftello64
+ char *p = (char *) ftello64;
#endif
-#ifdef HAVE_STDLIB_H
-#include <stdlib.h>
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_have_decl_ftello64=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_have_decl_ftello64=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_have_decl_ftello64" >&5
+echo "${ECHO_T}$ac_cv_have_decl_ftello64" >&6
+if test $ac_cv_have_decl_ftello64 = yes; then
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_FTELLO64 1
+_ACEOF
+
+
+else
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_FTELLO64 0
+_ACEOF
+
+
+fi
+
+
+echo "$as_me:$LINENO: checking whether fseeko is declared" >&5
+echo $ECHO_N "checking whether fseeko is declared... $ECHO_C" >&6
+if test "${ac_cv_have_decl_fseeko+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+#ifndef fseeko
+ char *p = (char *) fseeko;
#endif
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_have_decl_fseeko=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_have_decl_fseeko=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_have_decl_fseeko" >&5
+echo "${ECHO_T}$ac_cv_have_decl_fseeko" >&6
+if test $ac_cv_have_decl_fseeko = yes; then
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_FSEEKO 1
+_ACEOF
+
+
+else
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_FSEEKO 0
+_ACEOF
+
+
+fi
+
+
+echo "$as_me:$LINENO: checking whether fseeko64 is declared" >&5
+echo $ECHO_N "checking whether fseeko64 is declared... $ECHO_C" >&6
+if test "${ac_cv_have_decl_fseeko64+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+#ifndef fseeko64
+ char *p = (char *) fseeko64;
#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
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_have_decl_fseeko64=yes
else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- bfd_cv_decl_needed_strstr=yes
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_have_decl_fseeko64=no
fi
-rm -f conftest*
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
fi
+echo "$as_me:$LINENO: result: $ac_cv_have_decl_fseeko64" >&5
+echo "${ECHO_T}$ac_cv_have_decl_fseeko64" >&6
+if test $ac_cv_have_decl_fseeko64 = yes; then
-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
+cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_FSEEKO64 1
+_ACEOF
-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"
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_FSEEKO64 0
+_ACEOF
+
-#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>
+case "${host}" in
+*-*-msdos* | *-*-go32* | *-*-mingw32* | *-*-cygwin* | *-*-windows*)
+
+cat >>confdefs.h <<\_ACEOF
+#define USE_BINARY_FOPEN 1
+_ACEOF
+ ;;
+esac
+
+echo "$as_me:$LINENO: checking whether ffs is declared" >&5
+echo $ECHO_N "checking whether ffs is declared... $ECHO_C" >&6
+if test "${ac_cv_have_decl_ffs+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+#ifndef ffs
+ char *p = (char *) ffs;
#endif
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_have_decl_ffs=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_have_decl_ffs=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_have_decl_ffs" >&5
+echo "${ECHO_T}$ac_cv_have_decl_ffs" >&6
+if test $ac_cv_have_decl_ffs = yes; then
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_FFS 1
+_ACEOF
+
+
+else
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_FFS 0
+_ACEOF
+
+
+fi
+
+
+echo "$as_me:$LINENO: checking whether free is declared" >&5
+echo $ECHO_N "checking whether free is declared... $ECHO_C" >&6
+if test "${ac_cv_have_decl_free+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+#ifndef free
+ char *p = (char *) free;
#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
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_have_decl_free=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_have_decl_free=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_have_decl_free" >&5
+echo "${ECHO_T}$ac_cv_have_decl_free" >&6
+if test $ac_cv_have_decl_free = yes; then
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_FREE 1
+_ACEOF
+
+
+else
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_FREE 0
+_ACEOF
+
+
+fi
+
+
+echo "$as_me:$LINENO: checking whether getenv is declared" >&5
+echo $ECHO_N "checking whether getenv is declared... $ECHO_C" >&6
+if test "${ac_cv_have_decl_getenv+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+#ifndef getenv
+ char *p = (char *) getenv;
+#endif
-fi
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_have_decl_getenv=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_have_decl_getenv=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_have_decl_getenv" >&5
+echo "${ECHO_T}$ac_cv_have_decl_getenv" >&6
+if test $ac_cv_have_decl_getenv = yes; then
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_GETENV 1
+_ACEOF
+
+
+else
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_GETENV 0
+_ACEOF
+
+
+fi
+
+
+echo "$as_me:$LINENO: checking whether malloc is declared" >&5
+echo $ECHO_N "checking whether malloc is declared... $ECHO_C" >&6
+if test "${ac_cv_have_decl_malloc+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+#ifndef malloc
+ char *p = (char *) malloc;
+#endif
-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"
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_have_decl_malloc=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_have_decl_malloc=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_have_decl_malloc" >&5
+echo "${ECHO_T}$ac_cv_have_decl_malloc" >&6
+if test $ac_cv_have_decl_malloc = yes; then
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_MALLOC 1
+_ACEOF
+
+
+else
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_MALLOC 0
+_ACEOF
+
+
+fi
+
+
+echo "$as_me:$LINENO: checking whether realloc is declared" >&5
+echo $ECHO_N "checking whether realloc is declared... $ECHO_C" >&6
+if test "${ac_cv_have_decl_realloc+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+#ifndef realloc
+ char *p = (char *) realloc;
+#endif
-#include <stdio.h>
-#ifdef HAVE_STRING_H
-#include <string.h>
-#else
-#ifdef HAVE_STRINGS_H
-#include <strings.h>
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_have_decl_realloc=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_have_decl_realloc=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_have_decl_realloc" >&5
+echo "${ECHO_T}$ac_cv_have_decl_realloc" >&6
+if test $ac_cv_have_decl_realloc = yes; then
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_REALLOC 1
+_ACEOF
+
+
+else
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_REALLOC 0
+_ACEOF
+
+
+fi
+
+
+echo "$as_me:$LINENO: checking whether stpcpy is declared" >&5
+echo $ECHO_N "checking whether stpcpy is declared... $ECHO_C" >&6
+if test "${ac_cv_have_decl_stpcpy+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+#ifndef stpcpy
+ char *p = (char *) stpcpy;
#endif
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_have_decl_stpcpy=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_have_decl_stpcpy=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_have_decl_stpcpy" >&5
+echo "${ECHO_T}$ac_cv_have_decl_stpcpy" >&6
+if test $ac_cv_have_decl_stpcpy = yes; then
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_STPCPY 1
+_ACEOF
+
+
+else
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_STPCPY 0
+_ACEOF
+
+
+fi
+
+
+echo "$as_me:$LINENO: checking whether strstr is declared" >&5
+echo $ECHO_N "checking whether strstr is declared... $ECHO_C" >&6
+if test "${ac_cv_have_decl_strstr+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+#ifndef strstr
+ char *p = (char *) strstr;
#endif
-#ifdef HAVE_STDLIB_H
-#include <stdlib.h>
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_have_decl_strstr=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_have_decl_strstr=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_have_decl_strstr" >&5
+echo "${ECHO_T}$ac_cv_have_decl_strstr" >&6
+if test $ac_cv_have_decl_strstr = yes; then
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_STRSTR 1
+_ACEOF
+
+
+else
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_STRSTR 0
+_ACEOF
+
+
+fi
+
+
+echo "$as_me:$LINENO: checking whether snprintf is declared" >&5
+echo $ECHO_N "checking whether snprintf is declared... $ECHO_C" >&6
+if test "${ac_cv_have_decl_snprintf+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+#ifndef snprintf
+ char *p = (char *) snprintf;
#endif
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_have_decl_snprintf=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_have_decl_snprintf=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_have_decl_snprintf" >&5
+echo "${ECHO_T}$ac_cv_have_decl_snprintf" >&6
+if test $ac_cv_have_decl_snprintf = yes; then
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_SNPRINTF 1
+_ACEOF
+
+
+else
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_SNPRINTF 0
+_ACEOF
+
+
+fi
+
+
+echo "$as_me:$LINENO: checking whether vsnprintf is declared" >&5
+echo $ECHO_N "checking whether vsnprintf is declared... $ECHO_C" >&6
+if test "${ac_cv_have_decl_vsnprintf+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+#ifndef vsnprintf
+ char *p = (char *) vsnprintf;
#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
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_have_decl_vsnprintf=yes
else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- bfd_cv_decl_needed_free=yes
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_have_decl_vsnprintf=no
fi
-rm -f conftest*
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
fi
+echo "$as_me:$LINENO: result: $ac_cv_have_decl_vsnprintf" >&5
+echo "${ECHO_T}$ac_cv_have_decl_vsnprintf" >&6
+if test $ac_cv_have_decl_vsnprintf = yes; then
-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
+cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_VSNPRINTF 1
+_ACEOF
-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"
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_VSNPRINTF 0
+_ACEOF
-#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=
@@ -5278,7 +16993,7 @@ if test "${target}" = "${host}"; then
alpha*-*-freebsd* | alpha*-*-kfreebsd*-gnu)
COREFILE=''
;;
- alpha*-*-linux-gnu*)
+ alpha*-*-linux-*)
COREFILE=trad-core.lo
TRAD_HEADER='"hosts/alphalinux.h"'
;;
@@ -5288,13 +17003,19 @@ if test "${target}" = "${host}"; then
alpha*-*-*) COREFILE=osf-core.lo ;;
arm-*-freebsd* | arm-*-kfreebsd*-gnu)
COREFILE='' ;;
- arm-*-netbsd*) COREFILE=netbsd-core.lo ;;
+ arm-*-netbsd* | arm-*-openbsd*)
+ 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" ;;
+ hppa*-*-netbsd* | hppa*-*-openbsd*)
+ COREFILE=netbsd-core.lo
+ ;;
+
i370-*-*)
COREFILE=trad-core.lo
TRAD_HEADER='"hosts/i370linux.h"'
@@ -5312,7 +17033,7 @@ if test "${target}" = "${host}"; then
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*)
+ 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-*-freebsd4\.[01234]\.* | i[3-7]86-*-freebsd*aout*)
COREFILE=trad-core.lo
TRAD_HEADER='"hosts/i386bsd.h"'
;;
@@ -5338,7 +17059,7 @@ if test "${target}" = "${host}"; then
COREFILE=trad-core.lo
TRAD_HEADER='"hosts/i386mach3.h"'
;;
- i[3-7]86-*-linux-gnu*)
+ i[3-7]86-*-linux-*)
COREFILE=trad-core.lo
TRAD_HEADER='"hosts/i386linux.h"'
;;
@@ -5376,7 +17097,7 @@ if test "${target}" = "${host}"; then
COREFILE=trad-core.lo
TRAD_HEADER='"hosts/hp300bsd.h"'
;;
- m68*-*-linux-gnu*)
+ m68*-*-linux-*)
COREFILE=trad-core.lo
TRAD_HEADER='"hosts/m68klinux.h"'
;;
@@ -5404,6 +17125,9 @@ if test "${target}" = "${host}"; then
COREFILE=trad-core.lo
TRAD_HEADER='"hosts/m88kmach3.h"'
;;
+ m88*-*-openbsd*)
+ COREFILE=netbsd-core.lo
+ ;;
ns32k-pc532-mach)
COREFILE=trad-core.lo
TRAD_HEADER='"hosts/pc532mach.h"'
@@ -5423,30 +17147,60 @@ if test "${target}" = "${host}"; then
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"
+ echo "$as_me:$LINENO: checking for c_impl in struct core_dumpx" >&5
+echo $ECHO_N "checking for c_impl in struct core_dumpx... $ECHO_C" >&6
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
#include <core.h>
-int main() {
+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
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+
+cat >>confdefs.h <<\_ACEOF
#define HAVE_ST_C_IMPL 1
-EOF
+_ACEOF
- echo "$ac_t""yes" 1>&6
+ echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- echo "$ac_t""no" 1>&6
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
fi
-rm -f conftest*
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
;;
rs6000-*-aix4*) COREFILE=rs6000-core.lo ;;
rs6000-*-*) COREFILE=rs6000-core.lo ;;
@@ -5458,7 +17212,9 @@ rm -f conftest*
powerpc-*-netbsd*) COREFILE=netbsd-core.lo ;;
powerpc-*-*bsd*) COREFILE=netbsd-core.lo ;;
s390*-*-*) COREFILE=trad-core.lo ;;
- sh*-*-netbsd*) COREFILE=netbsd-core.lo ;;
+ sh*-*-netbsd* | sh*-*-openbsd*)
+ COREFILE=netbsd-core.lo
+ ;;
sparc-*-netbsd* | sparc*-*-openbsd*)
COREFILE=netbsd-core.lo
;;
@@ -5477,7 +17233,7 @@ rm -f conftest*
COREFILE=trad-core.lo
TRAD_HEADER='"hosts/vaxult2.h"'
;;
- vax-*-linux-gnu*)
+ vax-*-linux-*)
COREFILE=trad-core.lo
TRAD_HEADER='"hosts/vaxlinux.h"'
;;
@@ -5506,631 +17262,1206 @@ rm -f conftest*
# ELF corefile support has several flavors, but all of
# them use something called <sys/procfs.h>
- for ac_hdr in sys/procfs.h
+
+for ac_header 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"
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+ echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+else
+ # Is the header compilable?
+echo "$as_me:$LINENO: checking $ac_header usability" >&5
+echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_header_compiler=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_header_compiler=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6
+
+# Is the header present?
+echo "$as_me:$LINENO: checking $ac_header presence" >&5
+echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <$ac_header>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+ else
+ ac_cpp_err=
+ fi
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"
+ ac_cpp_err=yes
fi
-rm -f conftest*
+if test -z "$ac_cpp_err"; then
+ ac_header_preproc=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_header_preproc=no
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
-
+rm -f conftest.err conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6
+
+# So? What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+ yes:no: )
+ { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
+ ac_header_preproc=yes
+ ;;
+ no:yes:* )
+ { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
+echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
+ (
+ cat <<\_ASBOX
+## ------------------------------------------ ##
+## Report this to the AC_PACKAGE_NAME lists. ##
+## ------------------------------------------ ##
+_ASBOX
+ ) |
+ sed "s/^/$as_me: WARNING: /" >&2
+ ;;
+esac
+echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
- echo "$ac_t""no" 1>&6
+ eval "$as_ac_Header=\$ac_header_preproc"
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+
fi
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+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"
+ echo "$as_me:$LINENO: checking for prstatus_t in sys/procfs.h" >&5
+echo $ECHO_N "checking for prstatus_t in sys/procfs.h... $ECHO_C" >&6
+ if test "${bfd_cv_have_sys_procfs_type_prstatus_t+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
#define _SYSCALL32
#include <sys/procfs.h>
-int main() {
+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*
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
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
-
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+bfd_cv_have_sys_procfs_type_prstatus_t=no
+
fi
-rm -f conftest*
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
fi
if test $bfd_cv_have_sys_procfs_type_prstatus_t = yes; then
- cat >> confdefs.h <<\EOF
+
+cat >>confdefs.h <<\_ACEOF
#define HAVE_PRSTATUS_T 1
-EOF
+_ACEOF
fi
- echo "$ac_t""$bfd_cv_have_sys_procfs_type_prstatus_t" 1>&6
+ echo "$as_me:$LINENO: result: $bfd_cv_have_sys_procfs_type_prstatus_t" >&5
+echo "${ECHO_T}$bfd_cv_have_sys_procfs_type_prstatus_t" >&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
+ echo "$as_me:$LINENO: checking for prstatus32_t in sys/procfs.h" >&5
+echo $ECHO_N "checking for prstatus32_t in sys/procfs.h... $ECHO_C" >&6
+ if test "${bfd_cv_have_sys_procfs_type_prstatus32_t+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
- cat > conftest.$ac_ext <<EOF
-#line 5593 "configure"
-#include "confdefs.h"
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
#define _SYSCALL32
#include <sys/procfs.h>
-int main() {
+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*
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
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
-
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+bfd_cv_have_sys_procfs_type_prstatus32_t=no
+
fi
-rm -f conftest*
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
fi
if test $bfd_cv_have_sys_procfs_type_prstatus32_t = yes; then
- cat >> confdefs.h <<\EOF
+
+cat >>confdefs.h <<\_ACEOF
#define HAVE_PRSTATUS32_T 1
-EOF
+_ACEOF
fi
- echo "$ac_t""$bfd_cv_have_sys_procfs_type_prstatus32_t" 1>&6
+ echo "$as_me:$LINENO: result: $bfd_cv_have_sys_procfs_type_prstatus32_t" >&5
+echo "${ECHO_T}$bfd_cv_have_sys_procfs_type_prstatus32_t" >&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
+ echo "$as_me:$LINENO: checking for prstatus_t.pr_who in sys/procfs.h" >&5
+echo $ECHO_N "checking for prstatus_t.pr_who in sys/procfs.h... $ECHO_C" >&6
+ if test "${bfd_cv_have_sys_procfs_type_member_prstatus_t_pr_who+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
- cat > conftest.$ac_ext <<EOF
-#line 5629 "configure"
-#include "confdefs.h"
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
#define _SYSCALL32
#include <sys/procfs.h>
-int main() {
+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*
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
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
-
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+bfd_cv_have_sys_procfs_type_member_prstatus_t_pr_who=no
+
fi
-rm -f conftest*
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
fi
if test $bfd_cv_have_sys_procfs_type_member_prstatus_t_pr_who = yes; then
- cat >> confdefs.h <<\EOF
+
+cat >>confdefs.h <<\_ACEOF
#define HAVE_PRSTATUS_T_PR_WHO 1
-EOF
+_ACEOF
fi
- echo "$ac_t""$bfd_cv_have_sys_procfs_type_member_prstatus_t_pr_who" 1>&6
+ echo "$as_me:$LINENO: result: $bfd_cv_have_sys_procfs_type_member_prstatus_t_pr_who" >&5
+echo "${ECHO_T}$bfd_cv_have_sys_procfs_type_member_prstatus_t_pr_who" >&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
+ echo "$as_me:$LINENO: checking for prstatus32_t.pr_who in sys/procfs.h" >&5
+echo $ECHO_N "checking for prstatus32_t.pr_who in sys/procfs.h... $ECHO_C" >&6
+ if test "${bfd_cv_have_sys_procfs_type_member_prstatus32_t_pr_who+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
- cat > conftest.$ac_ext <<EOF
-#line 5665 "configure"
-#include "confdefs.h"
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
#define _SYSCALL32
#include <sys/procfs.h>
-int main() {
+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*
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
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
-
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+bfd_cv_have_sys_procfs_type_member_prstatus32_t_pr_who=no
+
fi
-rm -f conftest*
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
fi
if test $bfd_cv_have_sys_procfs_type_member_prstatus32_t_pr_who = yes; then
- cat >> confdefs.h <<\EOF
+
+cat >>confdefs.h <<\_ACEOF
#define HAVE_PRSTATUS32_T_PR_WHO 1
-EOF
+_ACEOF
fi
- echo "$ac_t""$bfd_cv_have_sys_procfs_type_member_prstatus32_t_pr_who" 1>&6
+ echo "$as_me:$LINENO: result: $bfd_cv_have_sys_procfs_type_member_prstatus32_t_pr_who" >&5
+echo "${ECHO_T}$bfd_cv_have_sys_procfs_type_member_prstatus32_t_pr_who" >&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
+ echo "$as_me:$LINENO: checking for pstatus_t in sys/procfs.h" >&5
+echo $ECHO_N "checking for pstatus_t in sys/procfs.h... $ECHO_C" >&6
+ if test "${bfd_cv_have_sys_procfs_type_pstatus_t+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
- cat > conftest.$ac_ext <<EOF
-#line 5701 "configure"
-#include "confdefs.h"
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
#define _SYSCALL32
#include <sys/procfs.h>
-int main() {
+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*
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
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
-
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+bfd_cv_have_sys_procfs_type_pstatus_t=no
+
fi
-rm -f conftest*
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
fi
if test $bfd_cv_have_sys_procfs_type_pstatus_t = yes; then
- cat >> confdefs.h <<\EOF
+
+cat >>confdefs.h <<\_ACEOF
#define HAVE_PSTATUS_T 1
-EOF
+_ACEOF
fi
- echo "$ac_t""$bfd_cv_have_sys_procfs_type_pstatus_t" 1>&6
+ echo "$as_me:$LINENO: result: $bfd_cv_have_sys_procfs_type_pstatus_t" >&5
+echo "${ECHO_T}$bfd_cv_have_sys_procfs_type_pstatus_t" >&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
+ echo "$as_me:$LINENO: checking for pxstatus_t in sys/procfs.h" >&5
+echo $ECHO_N "checking for pxstatus_t in sys/procfs.h... $ECHO_C" >&6
+ if test "${bfd_cv_have_sys_procfs_type_pxstatus_t+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
- cat > conftest.$ac_ext <<EOF
-#line 5737 "configure"
-#include "confdefs.h"
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
#define _SYSCALL32
#include <sys/procfs.h>
-int main() {
+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*
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
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
-
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+bfd_cv_have_sys_procfs_type_pxstatus_t=no
+
fi
-rm -f conftest*
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
fi
if test $bfd_cv_have_sys_procfs_type_pxstatus_t = yes; then
- cat >> confdefs.h <<\EOF
+
+cat >>confdefs.h <<\_ACEOF
#define HAVE_PXSTATUS_T 1
-EOF
+_ACEOF
fi
- echo "$ac_t""$bfd_cv_have_sys_procfs_type_pxstatus_t" 1>&6
+ echo "$as_me:$LINENO: result: $bfd_cv_have_sys_procfs_type_pxstatus_t" >&5
+echo "${ECHO_T}$bfd_cv_have_sys_procfs_type_pxstatus_t" >&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
+ echo "$as_me:$LINENO: checking for pstatus32_t in sys/procfs.h" >&5
+echo $ECHO_N "checking for pstatus32_t in sys/procfs.h... $ECHO_C" >&6
+ if test "${bfd_cv_have_sys_procfs_type_pstatus32_t+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
- cat > conftest.$ac_ext <<EOF
-#line 5773 "configure"
-#include "confdefs.h"
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
#define _SYSCALL32
#include <sys/procfs.h>
-int main() {
+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*
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
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
-
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+bfd_cv_have_sys_procfs_type_pstatus32_t=no
+
fi
-rm -f conftest*
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
fi
if test $bfd_cv_have_sys_procfs_type_pstatus32_t = yes; then
- cat >> confdefs.h <<\EOF
+
+cat >>confdefs.h <<\_ACEOF
#define HAVE_PSTATUS32_T 1
-EOF
+_ACEOF
fi
- echo "$ac_t""$bfd_cv_have_sys_procfs_type_pstatus32_t" 1>&6
+ echo "$as_me:$LINENO: result: $bfd_cv_have_sys_procfs_type_pstatus32_t" >&5
+echo "${ECHO_T}$bfd_cv_have_sys_procfs_type_pstatus32_t" >&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
+ echo "$as_me:$LINENO: checking for prpsinfo_t in sys/procfs.h" >&5
+echo $ECHO_N "checking for prpsinfo_t in sys/procfs.h... $ECHO_C" >&6
+ if test "${bfd_cv_have_sys_procfs_type_prpsinfo_t+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
- cat > conftest.$ac_ext <<EOF
-#line 5809 "configure"
-#include "confdefs.h"
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
#define _SYSCALL32
#include <sys/procfs.h>
-int main() {
+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*
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
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
-
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+bfd_cv_have_sys_procfs_type_prpsinfo_t=no
+
fi
-rm -f conftest*
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
fi
if test $bfd_cv_have_sys_procfs_type_prpsinfo_t = yes; then
- cat >> confdefs.h <<\EOF
+
+cat >>confdefs.h <<\_ACEOF
#define HAVE_PRPSINFO_T 1
-EOF
+_ACEOF
fi
- echo "$ac_t""$bfd_cv_have_sys_procfs_type_prpsinfo_t" 1>&6
+ echo "$as_me:$LINENO: result: $bfd_cv_have_sys_procfs_type_prpsinfo_t" >&5
+echo "${ECHO_T}$bfd_cv_have_sys_procfs_type_prpsinfo_t" >&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
+ echo "$as_me:$LINENO: checking for prpsinfo32_t in sys/procfs.h" >&5
+echo $ECHO_N "checking for prpsinfo32_t in sys/procfs.h... $ECHO_C" >&6
+ if test "${bfd_cv_have_sys_procfs_type_prpsinfo32_t+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
- cat > conftest.$ac_ext <<EOF
-#line 5845 "configure"
-#include "confdefs.h"
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
#define _SYSCALL32
#include <sys/procfs.h>
-int main() {
+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*
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
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
-
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+bfd_cv_have_sys_procfs_type_prpsinfo32_t=no
+
fi
-rm -f conftest*
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
fi
if test $bfd_cv_have_sys_procfs_type_prpsinfo32_t = yes; then
- cat >> confdefs.h <<\EOF
+
+cat >>confdefs.h <<\_ACEOF
#define HAVE_PRPSINFO32_T 1
-EOF
+_ACEOF
fi
- echo "$ac_t""$bfd_cv_have_sys_procfs_type_prpsinfo32_t" 1>&6
+ echo "$as_me:$LINENO: result: $bfd_cv_have_sys_procfs_type_prpsinfo32_t" >&5
+echo "${ECHO_T}$bfd_cv_have_sys_procfs_type_prpsinfo32_t" >&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
+ echo "$as_me:$LINENO: checking for psinfo_t in sys/procfs.h" >&5
+echo $ECHO_N "checking for psinfo_t in sys/procfs.h... $ECHO_C" >&6
+ if test "${bfd_cv_have_sys_procfs_type_psinfo_t+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
- cat > conftest.$ac_ext <<EOF
-#line 5881 "configure"
-#include "confdefs.h"
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
#define _SYSCALL32
#include <sys/procfs.h>
-int main() {
+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*
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
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
-
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+bfd_cv_have_sys_procfs_type_psinfo_t=no
+
fi
-rm -f conftest*
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
fi
if test $bfd_cv_have_sys_procfs_type_psinfo_t = yes; then
- cat >> confdefs.h <<\EOF
+
+cat >>confdefs.h <<\_ACEOF
#define HAVE_PSINFO_T 1
-EOF
+_ACEOF
fi
- echo "$ac_t""$bfd_cv_have_sys_procfs_type_psinfo_t" 1>&6
+ echo "$as_me:$LINENO: result: $bfd_cv_have_sys_procfs_type_psinfo_t" >&5
+echo "${ECHO_T}$bfd_cv_have_sys_procfs_type_psinfo_t" >&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
+ echo "$as_me:$LINENO: checking for psinfo32_t in sys/procfs.h" >&5
+echo $ECHO_N "checking for psinfo32_t in sys/procfs.h... $ECHO_C" >&6
+ if test "${bfd_cv_have_sys_procfs_type_psinfo32_t+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
- cat > conftest.$ac_ext <<EOF
-#line 5917 "configure"
-#include "confdefs.h"
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
#define _SYSCALL32
#include <sys/procfs.h>
-int main() {
+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*
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
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
-
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+bfd_cv_have_sys_procfs_type_psinfo32_t=no
+
fi
-rm -f conftest*
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
fi
if test $bfd_cv_have_sys_procfs_type_psinfo32_t = yes; then
- cat >> confdefs.h <<\EOF
+
+cat >>confdefs.h <<\_ACEOF
#define HAVE_PSINFO32_T 1
-EOF
+_ACEOF
fi
- echo "$ac_t""$bfd_cv_have_sys_procfs_type_psinfo32_t" 1>&6
+ echo "$as_me:$LINENO: result: $bfd_cv_have_sys_procfs_type_psinfo32_t" >&5
+echo "${ECHO_T}$bfd_cv_have_sys_procfs_type_psinfo32_t" >&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
+ echo "$as_me:$LINENO: checking for lwpstatus_t in sys/procfs.h" >&5
+echo $ECHO_N "checking for lwpstatus_t in sys/procfs.h... $ECHO_C" >&6
+ if test "${bfd_cv_have_sys_procfs_type_lwpstatus_t+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
- cat > conftest.$ac_ext <<EOF
-#line 5953 "configure"
-#include "confdefs.h"
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
#define _SYSCALL32
#include <sys/procfs.h>
-int main() {
+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*
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
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
-
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+bfd_cv_have_sys_procfs_type_lwpstatus_t=no
+
fi
-rm -f conftest*
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
fi
if test $bfd_cv_have_sys_procfs_type_lwpstatus_t = yes; then
- cat >> confdefs.h <<\EOF
+
+cat >>confdefs.h <<\_ACEOF
#define HAVE_LWPSTATUS_T 1
-EOF
+_ACEOF
fi
- echo "$ac_t""$bfd_cv_have_sys_procfs_type_lwpstatus_t" 1>&6
+ echo "$as_me:$LINENO: result: $bfd_cv_have_sys_procfs_type_lwpstatus_t" >&5
+echo "${ECHO_T}$bfd_cv_have_sys_procfs_type_lwpstatus_t" >&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
+ echo "$as_me:$LINENO: checking for lwpxstatus_t in sys/procfs.h" >&5
+echo $ECHO_N "checking for lwpxstatus_t in sys/procfs.h... $ECHO_C" >&6
+ if test "${bfd_cv_have_sys_procfs_type_lwpxstatus_t+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
- cat > conftest.$ac_ext <<EOF
-#line 5989 "configure"
-#include "confdefs.h"
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
#define _SYSCALL32
#include <sys/procfs.h>
-int main() {
+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*
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
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
-
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+bfd_cv_have_sys_procfs_type_lwpxstatus_t=no
+
fi
-rm -f conftest*
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
fi
if test $bfd_cv_have_sys_procfs_type_lwpxstatus_t = yes; then
- cat >> confdefs.h <<\EOF
+
+cat >>confdefs.h <<\_ACEOF
#define HAVE_LWPXSTATUS_T 1
-EOF
+_ACEOF
fi
- echo "$ac_t""$bfd_cv_have_sys_procfs_type_lwpxstatus_t" 1>&6
+ echo "$as_me:$LINENO: result: $bfd_cv_have_sys_procfs_type_lwpxstatus_t" >&5
+echo "${ECHO_T}$bfd_cv_have_sys_procfs_type_lwpxstatus_t" >&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
+ echo "$as_me:$LINENO: checking for lwpstatus_t.pr_context in sys/procfs.h" >&5
+echo $ECHO_N "checking for lwpstatus_t.pr_context in sys/procfs.h... $ECHO_C" >&6
+ if test "${bfd_cv_have_sys_procfs_type_member_lwpstatus_t_pr_context+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
- cat > conftest.$ac_ext <<EOF
-#line 6025 "configure"
-#include "confdefs.h"
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
#define _SYSCALL32
#include <sys/procfs.h>
-int main() {
+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*
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
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
-
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+bfd_cv_have_sys_procfs_type_member_lwpstatus_t_pr_context=no
+
fi
-rm -f conftest*
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
fi
if test $bfd_cv_have_sys_procfs_type_member_lwpstatus_t_pr_context = yes; then
- cat >> confdefs.h <<\EOF
+
+cat >>confdefs.h <<\_ACEOF
#define HAVE_LWPSTATUS_T_PR_CONTEXT 1
-EOF
+_ACEOF
fi
- echo "$ac_t""$bfd_cv_have_sys_procfs_type_member_lwpstatus_t_pr_context" 1>&6
+ echo "$as_me:$LINENO: result: $bfd_cv_have_sys_procfs_type_member_lwpstatus_t_pr_context" >&5
+echo "${ECHO_T}$bfd_cv_have_sys_procfs_type_member_lwpstatus_t_pr_context" >&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
+ echo "$as_me:$LINENO: checking for lwpstatus_t.pr_reg in sys/procfs.h" >&5
+echo $ECHO_N "checking for lwpstatus_t.pr_reg in sys/procfs.h... $ECHO_C" >&6
+ if test "${bfd_cv_have_sys_procfs_type_member_lwpstatus_t_pr_reg+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
- cat > conftest.$ac_ext <<EOF
-#line 6061 "configure"
-#include "confdefs.h"
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
#define _SYSCALL32
#include <sys/procfs.h>
-int main() {
+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*
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
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
-
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+bfd_cv_have_sys_procfs_type_member_lwpstatus_t_pr_reg=no
+
fi
-rm -f conftest*
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
fi
if test $bfd_cv_have_sys_procfs_type_member_lwpstatus_t_pr_reg = yes; then
- cat >> confdefs.h <<\EOF
+
+cat >>confdefs.h <<\_ACEOF
#define HAVE_LWPSTATUS_T_PR_REG 1
-EOF
+_ACEOF
fi
- echo "$ac_t""$bfd_cv_have_sys_procfs_type_member_lwpstatus_t_pr_reg" 1>&6
+ echo "$as_me:$LINENO: result: $bfd_cv_have_sys_procfs_type_member_lwpstatus_t_pr_reg" >&5
+echo "${ECHO_T}$bfd_cv_have_sys_procfs_type_member_lwpstatus_t_pr_reg" >&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
+ echo "$as_me:$LINENO: checking for win32_pstatus_t in sys/procfs.h" >&5
+echo $ECHO_N "checking for win32_pstatus_t in sys/procfs.h... $ECHO_C" >&6
+ if test "${bfd_cv_have_sys_procfs_type_win32_pstatus_t+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
- cat > conftest.$ac_ext <<EOF
-#line 6097 "configure"
-#include "confdefs.h"
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
#define _SYSCALL32
#include <sys/procfs.h>
-int main() {
+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*
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
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
-
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+bfd_cv_have_sys_procfs_type_win32_pstatus_t=no
+
fi
-rm -f conftest*
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
fi
if test $bfd_cv_have_sys_procfs_type_win32_pstatus_t = yes; then
- cat >> confdefs.h <<\EOF
+
+cat >>confdefs.h <<\_ACEOF
#define HAVE_WIN32_PSTATUS_T 1
-EOF
+_ACEOF
fi
- echo "$ac_t""$bfd_cv_have_sys_procfs_type_win32_pstatus_t" 1>&6
+ echo "$as_me:$LINENO: result: $bfd_cv_have_sys_procfs_type_win32_pstatus_t" >&5
+echo "${ECHO_T}$bfd_cv_have_sys_procfs_type_win32_pstatus_t" >&6
fi
fi
if test -n "$TRAD_HEADER"; then
- cat >> confdefs.h <<EOF
+
+cat >>confdefs.h <<_ACEOF
#define TRAD_HEADER $TRAD_HEADER
-EOF
+_ACEOF
fi
@@ -6247,7 +18578,7 @@ selarchs="$f"
# Target backend .o files.
tb=
-elf="elf.lo elflink.lo elf-strtab.lo elf-eh-frame.lo dwarf1.lo"
+elf="elf.lo elflink.lo elf-attrs.lo elf-strtab.lo elf-eh-frame.lo dwarf1.lo"
for vec in $selvecs
do
@@ -6256,7 +18587,6 @@ do
# 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" ;;
@@ -6267,6 +18597,10 @@ do
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 " ;;
+ arm_wince_pe_big_vec) tb="$tb pe-arm-wince.lo pe-arm.lo peigen.lo cofflink.lo " ;;
+ arm_wince_pe_little_vec) tb="$tb pe-arm-wince.lo pe-arm.lo peigen.lo cofflink.lo " ;;
+ arm_wince_pei_big_vec) tb="$tb pei-arm-wince.lo pei-arm.lo peigen.lo cofflink.lo " ;;
+ arm_wince_pei_little_vec) tb="$tb pei-arm-wince.lo 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" ;;
@@ -6277,15 +18611,26 @@ do
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_x86_64_vec) tb="$tb efi-app-x86_64.lo pex64igen.lo cofflink.lo" ;target_size=64;;
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_bfin_vec) tb="$tb elf32-bfin.lo elf32.lo $elf" ;;
+ bfd_elf32_bfinfdpic_vec) tb="$tb elf32-bfin.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_bigarm_vec) tb="$tb elf32-arm.lo elf32.lo elf-vxworks.lo $elf" ;;
+ bfd_elf32_bigarm_symbian_vec)
+ tb="$tb elf32-arm.lo elf32.lo elf-vxworks.lo $elf" ;;
+ bfd_elf32_bigarm_vxworks_vec)
+ tb="$tb elf32-arm.lo elf32.lo elf-vxworks.lo $elf" ;;
+ bfd_elf32_bigmips_vec) tb="$tb elf32-mips.lo elfxx-mips.lo elf-vxworks.lo elf32.lo $elf ecofflink.lo" ;;
+ bfd_elf32_bigmips_vxworks_vec)
+ tb="$tb elf32-mips.lo elfxx-mips.lo elf-vxworks.lo elf32.lo $elf ecofflink.lo" ;;
+ bfd_elf32_cr16_vec) tb="$tb elf32-cr16.lo elf32.lo $elf" ;;
+ bfd_elf32_cr16c_vec) tb="$tb elf32-cr16c.lo elf32.lo $elf" ;;
bfd_elf32_cris_vec) tb="$tb elf32-cris.lo elf32.lo $elf" ;;
+ bfd_elf32_crx_vec) tb="$tb elf32-crx.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" ;;
@@ -6294,10 +18639,12 @@ do
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_nbsd_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_i386_freebsd_vec) tb="$tb elf32-i386.lo elf-vxworks.lo elf32.lo $elf" ;;
+ bfd_elf32_i386_vxworks_vec) tb="$tb elf32-i386.lo elf-vxworks.lo elf32.lo $elf" ;;
+ bfd_elf32_i386_vec) tb="$tb elf32-i386.lo elf-vxworks.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" ;;
@@ -6307,9 +18654,15 @@ do
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_littlearm_symbian_vec)
+ tb="$tb elf32-arm.lo elf32.lo elf-vxworks.lo $elf" ;;
+ bfd_elf32_littlearm_vxworks_vec)
+ tb="$tb elf32-arm.lo elf32.lo elf-vxworks.lo $elf" ;;
+ bfd_elf32_littlearm_vec) tb="$tb elf32-arm.lo elf32.lo elf-vxworks.lo $elf" ;;
+ bfd_elf32_littlemips_vec) tb="$tb elf32-mips.lo elfxx-mips.lo elf-vxworks.lo elf32.lo $elf ecofflink.lo" ;;
+ bfd_elf32_littlemips_vxworks_vec)
+ tb="$tb elf32-mips.lo elfxx-mips.lo elf-vxworks.lo elf32.lo $elf ecofflink.lo" ;;
+ bfd_elf32_m32c_vec) tb="$tb elf32-m32c.lo elf32.lo $elf" ;;
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" ;;
@@ -6320,55 +18673,67 @@ do
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_mep_vec) tb="$tb elf32-mep.lo elf32.lo $elf" ;;
+ bfd_elf32_mep_little_vec) tb="$tb elf32-mep.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_mt_vec) tb="$tb elf32-mt.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_nbigmips_vec) tb="$tb elfn32-mips.lo elfxx-mips.lo elf-vxworks.lo elf32.lo $elf ecofflink.lo"; target_size=64 ;;
+ bfd_elf32_nlittlemips_vec) tb="$tb elfn32-mips.lo elfxx-mips.lo elf-vxworks.lo elf32.lo $elf ecofflink.lo"; target_size=64 ;;
+ bfd_elf32_ntradbigmips_vec) tb="$tb elfn32-mips.lo elfxx-mips.lo elf-vxworks.lo elf32.lo $elf ecofflink.lo"; target_size=64 ;;
+ bfd_elf32_ntradlittlemips_vec) tb="$tb elfn32-mips.lo elfxx-mips.lo elf-vxworks.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_powerpc_vec) tb="$tb elf32-ppc.lo elf-vxworks.lo elf32.lo $elf" ;;
+ bfd_elf32_powerpcle_vec) tb="$tb elf32-ppc.lo elf-vxworks.lo elf32.lo $elf" ;;
+ bfd_elf32_powerpc_vxworks_vec) tb="$tb elf32-ppc.lo elf-vxworks.lo elf32.lo $elf" ;;
bfd_elf32_s390_vec) tb="$tb elf32-s390.lo elf32.lo $elf" ;;
+ bfd_elf32_bigscore_vec) tb="$tb elf32-score.lo elf32.lo $elf" ;;
+ bfd_elf32_littlescore_vec) tb="$tb elf32-score.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_sh64_vec) tb="$tb elf32-sh64.lo elf32-sh64-com.lo elf-vxworks.lo elf32.lo $elf cofflink.lo" target_size=64 ;;
+ bfd_elf32_sh64l_vec) tb="$tb elf32-sh64.lo elf32-sh64-com.lo elf-vxworks.lo elf32.lo $elf cofflink.lo" target_size=64 ;;
+ bfd_elf32_sh64lin_vec) tb="$tb elf32-sh64.lo elf32-sh64-com.lo elf-vxworks.lo elf32.lo $elf cofflink.lo" target_size=64 ;;
+ bfd_elf32_sh64blin_vec) tb="$tb elf32-sh64.lo elf32-sh64-com.lo elf-vxworks.lo elf32.lo $elf cofflink.lo" target_size=64 ;;
+ bfd_elf32_sh64lnbsd_vec) tb="$tb elf32-sh64.lo elf32-sh64-com.lo elf-vxworks.lo elf32.lo $elf cofflink.lo" ;;
+ bfd_elf32_sh64nbsd_vec) tb="$tb elf32-sh64.lo elf32-sh64-com.lo elf-vxworks.lo elf32.lo $elf cofflink.lo" ;;
+ bfd_elf32_sh_vec) tb="$tb elf32-sh.lo elf-vxworks.lo elf32.lo $elf coff-sh.lo" ;;
+ bfd_elf32_shblin_vec) tb="$tb elf32-sh.lo elf-vxworks.lo elf32.lo $elf coff-sh.lo cofflink.lo" ;;
+ bfd_elf32_shl_vec) tb="$tb elf32-sh.lo elf-vxworks.lo elf32.lo $elf coff-sh.lo" ;;
+ bfd_elf32_shl_symbian_vec) tb="$tb elf32-sh-symbian.lo elf32-sh64-com.lo elf-vxworks.lo elf32.lo $elf coff-sh.lo" ;;
+ bfd_elf32_shlin_vec) tb="$tb elf32-sh.lo elf-vxworks.lo elf32.lo $elf coff-sh.lo cofflink.lo" ;;
+ bfd_elf32_shlnbsd_vec) tb="$tb elf32-sh.lo elf-vxworks.lo elf32.lo $elf coff-sh.lo cofflink.lo" ;;
+ bfd_elf32_shlvxworks_vec) tb="$tb elf32-sh.lo elf-vxworks.lo elf32.lo $elf coff-sh.lo" ;;
+ bfd_elf32_shnbsd_vec) tb="$tb elf32-sh.lo elf-vxworks.lo elf32.lo $elf coff-sh.lo cofflink.lo" ;;
+ bfd_elf32_shvxworks_vec) tb="$tb elf32-sh.lo elf-vxworks.lo elf32.lo $elf coff-sh.lo" ;;
+ bfd_elf32_sparc_vec) tb="$tb elf32-sparc.lo elfxx-sparc.lo elf-vxworks.lo elf32.lo $elf" ;;
+ bfd_elf32_sparc_vxworks_vec) tb="$tb elf32-sparc.lo elfxx-sparc.lo elf-vxworks.lo elf32.lo $elf" ;;
+ bfd_elf32_spu_vec) tb="$tb elf32-spu.lo elf32.lo $elf" ;;
+ bfd_elf32_tradbigmips_vec) tb="$tb elf32-mips.lo elfxx-mips.lo elf-vxworks.lo elf32.lo $elf ecofflink.lo" ;;
+ bfd_elf32_tradlittlemips_vec) tb="$tb elf32-mips.lo elfxx-mips.lo elf-vxworks.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_xc16x_vec) tb="$tb elf32-xc16x.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_bigmips_vec) tb="$tb elf64-mips.lo elf64.lo elfxx-mips.lo elf-vxworks.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_littlemips_vec) tb="$tb elf64-mips.lo elf64.lo elfxx-mips.lo elf-vxworks.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 ;;
@@ -6379,9 +18744,11 @@ do
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_sparc_vec) tb="$tb elf64-sparc.lo elfxx-sparc.lo elf-vxworks.lo elf64.lo $elf"; target_size=64 ;;
+ bfd_elf64_sparc_freebsd_vec) tb="$tb elf64-sparc.lo elfxx-sparc.lo elf-vxworks.lo elf64.lo $elf"; target_size=64 ;;
+ bfd_elf64_tradbigmips_vec) tb="$tb elf64-mips.lo elf64.lo elfxx-mips.lo elf-vxworks.lo elf32.lo $elf ecofflink.lo"; target_size=64 ;;
+ bfd_elf64_tradlittlemips_vec) tb="$tb elf64-mips.lo elf64.lo elfxx-mips.lo elf-vxworks.lo elf32.lo $elf ecofflink.lo"; target_size=64 ;;
+ bfd_elf64_x86_64_freebsd_vec) tb="$tb elf64-x86-64.lo elf64.lo $elf"; 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" ;;
@@ -6404,6 +18771,7 @@ do
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" ;;
+ x86_64coff_vec) tb="$tb coff-x86_64.lo cofflink.lo"; target_size=64 ;;
i386dynix_vec) tb="$tb i386dynix.lo aout32.lo" ;;
i386freebsd_vec) tb="$tb i386freebsd.lo aout32.lo" ;;
i386linux_vec) tb="$tb i386linux.lo aout32.lo" ;;
@@ -6415,6 +18783,8 @@ do
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" ;;
+ x86_64pe_vec) tb="$tb pe-x86_64.lo pex64igen.lo cofflink.lo"; target_size=64 ;;
+ x86_64pei_vec) tb="$tb pei-x86_64.lo pex64igen.lo cofflink.lo"; target_size=64 ;;
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" ;;
@@ -6424,12 +18794,12 @@ do
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" ;;
+ m88kopenbsd_vec) tb="$tb m88kopenbsd.lo aout32.lo" ;;
+ maxqcoff_vec) tb="$tb coff-maxq.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" ;;
@@ -6493,7 +18863,8 @@ do
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" ;;
+ z80coff_vec) tb="$tb coff-z80.lo reloc16.lo" ;;
+ z8kcoff_vec) tb="$tb coff-z8k.lo reloc16.lo cofflink.lo" ;;
# These appear out of order in targets.c
srec_vec) tb="$tb srec.lo" ;;
@@ -6503,7 +18874,9 @@ do
cisco_core_little_vec) tb="$tb cisco-core.lo" ;;
"") ;;
- *) { echo "configure: error: *** unknown target vector $vec" 1>&2; exit 1; } ;;
+ *) { { echo "$as_me:$LINENO: error: *** unknown target vector $vec" >&5
+echo "$as_me: error: *** unknown target vector $vec" >&2;}
+ { (exit 1); exit 1; }; } ;;
esac
if test ${target_size} = 64; then
@@ -6564,41 +18937,47 @@ fi # all_targets is true
case ${host64}-${target64}-${want64} in
*true*)
wordsize=64
- bfd_libs='$(BFD64_LIBS) $(BFD32_LIBS)'
+ bfd64_libs='$(BFD64_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
+ { echo "$as_me:$LINENO: WARNING: You have requested a 64 bit BFD configuration, but" >&5
+echo "$as_me: WARNING: You have requested a 64 bit BFD configuration, but" >&2;}
+ { echo "$as_me:$LINENO: WARNING: your compiler may not have a 64 bit integral type" >&5
+echo "$as_me: WARNING: your compiler may not have a 64 bit integral type" >&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
+ echo "$as_me:$LINENO: checking for gcc version with buggy 64-bit support" >&5
+echo $ECHO_N "checking for gcc version with buggy 64-bit support... $ECHO_C" >&6
# Add more tests for gcc versions with non-working 64-bit support here.
- cat > conftest.$ac_ext <<EOF
-#line 6580 "configure"
-#include "confdefs.h"
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
:__GNUC__:__GNUC_MINOR__:__i386__:
-EOF
+_ACEOF
if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
- egrep ": 2 : 91 : 1 :" >/dev/null 2>&1; then
- rm -rf conftest*
+ $EGREP ": 2 : 91 : 1 :" >/dev/null 2>&1; then
bad_64bit_gcc=yes;
- echo "$ac_t""yes: egcs-1.1.2 on ix86 spotted" 1>&6
+ echo "$as_me:$LINENO: result: yes: egcs-1.1.2 on ix86 spotted" >&5
+echo "${ECHO_T}yes: egcs-1.1.2 on ix86 spotted" >&6
else
- rm -rf conftest*
- echo "$ac_t""no" 1>&6
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&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; }
+ { { echo "$as_me:$LINENO: error: A newer version of gcc is needed for the requested 64-bit BFD configuration" >&5
+echo "$as_me: error: A newer version of gcc is needed for the requested 64-bit BFD configuration" >&2;}
+ { (exit 1); exit 1; }; }
fi
fi
;;
false-false-false)
wordsize=32
- bfd_libs='$(BFD32_LIBS)'
all_backends='$(BFD32_BACKENDS)'
;;
esac
@@ -6615,104 +18994,530 @@ esac
# 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
+
+
+
+
+
+for ac_func in ftello ftello64 fseeko fseeko64 fopen64
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"
+as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
+echo "$as_me:$LINENO: checking for $ac_func" >&5
+echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6
+if eval "test \"\${$as_ac_var+set}\" = set"; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
+ For example, HP-UX 11i <limits.h> declares gettimeofday. */
+#define $ac_func innocuous_$ac_func
+
/* 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();
+ which can conflict with char $ac_func (); below.
+ Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ <limits.h> exists even on freestanding compilers. */
-int main() {
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+
+#undef $ac_func
+/* Override any gcc2 internal prototype to avoid an error. */
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+/* 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 ();
/* 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();
+char (*f) () = $ac_func;
+#endif
+#ifdef __cplusplus
+}
#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"
+int
+main ()
+{
+return f != $ac_func;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ eval "$as_ac_var=yes"
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+eval "$as_ac_var=no"
+fi
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6
+if test `eval echo '${'$as_ac_var'}'` = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+done
+
+if test x"$ac_cv_func_ftello" = xyes -a x"$ac_cv_func_fseeko" = xyes; then
+ echo "$as_me:$LINENO: checking for off_t" >&5
+echo $ECHO_N "checking for off_t... $ECHO_C" >&6
+if test "${ac_cv_type_off_t+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+if ((off_t *) 0)
+ return 0;
+if (sizeof (off_t))
+ return 0;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_type_off_t=yes
else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "ac_cv_func_$ac_func=no"
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_type_off_t=no
fi
-rm -f conftest*
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
fi
+echo "$as_me:$LINENO: result: $ac_cv_type_off_t" >&5
+echo "${ECHO_T}$ac_cv_type_off_t" >&6
-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
-
+echo "$as_me:$LINENO: checking size of off_t" >&5
+echo $ECHO_N "checking size of off_t... $ECHO_C" >&6
+if test "${ac_cv_sizeof_off_t+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
- echo "$ac_t""no" 1>&6
-fi
-done
+ if test "$ac_cv_type_off_t" = yes; then
+ # The cast to unsigned long works around a bug in the HP C Compiler
+ # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
+ # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
+ # This bug is HP SR number 8606223364.
+ if test "$cross_compiling" = yes; then
+ # Depending upon the size, compute the lo and hi bounds.
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long) (sizeof (off_t))) >= 0)];
+test_array [0] = 0
-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>
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_lo=0 ac_mid=0
+ while :; do
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long) (sizeof (off_t))) <= $ac_mid)];
+test_array [0] = 0
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_hi=$ac_mid; break
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_lo=`expr $ac_mid + 1`
+ if test $ac_lo -le $ac_mid; then
+ ac_lo= ac_hi=
+ break
+ fi
+ ac_mid=`expr 2 '*' $ac_mid + 1`
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+ done
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
-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
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long) (sizeof (off_t))) < 0)];
+test_array [0] = 0
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_hi=-1 ac_mid=-1
+ while :; do
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long) (sizeof (off_t))) >= $ac_mid)];
+test_array [0] = 0
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_lo=$ac_mid; break
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_hi=`expr '(' $ac_mid ')' - 1`
+ if test $ac_mid -le $ac_hi; then
+ ac_lo= ac_hi=
+ break
+ fi
+ ac_mid=`expr 2 '*' $ac_mid`
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+ done
else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_lo= ac_hi=
fi
-rm -f conftest*
- if test x$ac_cv_sizeof_off_t != x ; then break; fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+# Binary search between lo and hi bounds.
+while test "x$ac_lo" != "x$ac_hi"; do
+ ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo`
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long) (sizeof (off_t))) <= $ac_mid)];
+test_array [0] = 0
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_hi=$ac_mid
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_lo=`expr '(' $ac_mid ')' + 1`
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
done
+case $ac_lo in
+?*) ac_cv_sizeof_off_t=$ac_lo;;
+'') { { echo "$as_me:$LINENO: error: cannot compute sizeof (off_t), 77
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot compute sizeof (off_t), 77
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; } ;;
+esac
+else
+ if test "$cross_compiling" = yes; then
+ { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot run test program while cross compiling
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; }
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+long longval () { return (long) (sizeof (off_t)); }
+unsigned long ulongval () { return (long) (sizeof (off_t)); }
+#include <stdio.h>
+#include <stdlib.h>
+int
+main ()
+{
-fi
+ FILE *f = fopen ("conftest.val", "w");
+ if (! f)
+ exit (1);
+ if (((long) (sizeof (off_t))) < 0)
+ {
+ long i = longval ();
+ if (i != ((long) (sizeof (off_t))))
+ exit (1);
+ fprintf (f, "%ld\n", i);
+ }
+ else
+ {
+ unsigned long i = ulongval ();
+ if (i != ((long) (sizeof (off_t))))
+ exit (1);
+ fprintf (f, "%lu\n", i);
+ }
+ exit (ferror (f) || fclose (f) != 0);
-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
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_sizeof_off_t=`cat conftest.val`
+else
+ echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+( exit $ac_status )
+{ { echo "$as_me:$LINENO: error: cannot compute sizeof (off_t), 77
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot compute sizeof (off_t), 77
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+fi
+rm -f conftest.val
+else
+ ac_cv_sizeof_off_t=0
+fi
+fi
+echo "$as_me:$LINENO: result: $ac_cv_sizeof_off_t" >&5
+echo "${ECHO_T}$ac_cv_sizeof_off_t" >&6
+cat >>confdefs.h <<_ACEOF
#define SIZEOF_OFF_T $ac_cv_sizeof_off_t
-EOF
+_ACEOF
fi
-echo $ac_n "checking file_ptr type""... $ac_c" 1>&6
-echo "configure:6716: checking file_ptr type" >&5
+echo "$as_me:$LINENO: checking file_ptr type" >&5
+echo $ECHO_N "checking file_ptr type... $ECHO_C" >&6
bfd_file_ptr="long"
bfd_ufile_ptr="unsigned long"
if test x"$ac_cv_func_ftello64" = xyes -a x"$ac_cv_func_fseeko64" = xyes \
@@ -6720,7 +19525,8 @@ if test x"$ac_cv_func_ftello64" = xyes -a x"$ac_cv_func_fseeko64" = xyes \
bfd_file_ptr=BFD_HOST_64_BIT
bfd_ufile_ptr=BFD_HOST_U_64_BIT
fi
-echo "$ac_t""$bfd_file_ptr" 1>&6
+echo "$as_me:$LINENO: result: $bfd_file_ptr" >&5
+echo "${ECHO_T}$bfd_file_ptr" >&6
@@ -6733,112 +19539,276 @@ test -n "${selarchs}" && tdefaults="${tdefaults} -DSELECT_ARCHITECTURES='${selar
test -n "${havevecs}" && tdefaults="${tdefaults} ${havevecs}"
-for ac_hdr in stdlib.h unistd.h sys/stat.h sys/types.h
+
+
+for ac_header in stdlib.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: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"
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+ echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+else
+ # Is the header compilable?
+echo "$as_me:$LINENO: checking $ac_header usability" >&5
+echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_header_compiler=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_header_compiler=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6
+
+# Is the header present?
+echo "$as_me:$LINENO: checking $ac_header presence" >&5
+echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <$ac_header>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+ else
+ ac_cpp_err=
+ fi
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"
+ ac_cpp_err=yes
fi
-rm -f conftest*
+if test -z "$ac_cpp_err"; then
+ ac_header_preproc=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_header_preproc=no
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
-
+rm -f conftest.err conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6
+
+# So? What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+ yes:no: )
+ { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
+ ac_header_preproc=yes
+ ;;
+ no:yes:* )
+ { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
+echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
+ (
+ cat <<\_ASBOX
+## ------------------------------------------ ##
+## Report this to the AC_PACKAGE_NAME lists. ##
+## ------------------------------------------ ##
+_ASBOX
+ ) |
+ sed "s/^/$as_me: WARNING: /" >&2
+ ;;
+esac
+echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
- echo "$ac_t""no" 1>&6
+ eval "$as_ac_Header=\$ac_header_preproc"
fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+
+fi
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+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"
+as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
+echo "$as_me:$LINENO: checking for $ac_func" >&5
+echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6
+if eval "test \"\${$as_ac_var+set}\" = set"; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
+ For example, HP-UX 11i <limits.h> declares gettimeofday. */
+#define $ac_func innocuous_$ac_func
+
/* 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();
+ which can conflict with char $ac_func (); below.
+ Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ <limits.h> exists even on freestanding compilers. */
+
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
-int main() {
+#undef $ac_func
+/* Override any gcc2 internal prototype to avoid an error. */
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+/* 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 ();
/* 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();
+char (*f) () = $ac_func;
+#endif
+#ifdef __cplusplus
+}
#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
+int
+main ()
+{
+return f != $ac_func;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ eval "$as_ac_var=yes"
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+eval "$as_ac_var=no"
+fi
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6
+if test `eval echo '${'$as_ac_var'}'` = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
-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
+echo "$as_me:$LINENO: checking for working mmap" >&5
+echo $ECHO_N "checking for working mmap... $ECHO_C" >&6
+if test "${ac_cv_func_mmap_fixed_mapped+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&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"
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+/* malloc might have been renamed as rpl_malloc. */
+#undef malloc
/* Thanks to Mike Haertel and Jim Avera for this test.
Here is a matrix of mmap possibilities:
@@ -6852,47 +19822,34 @@ else
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
+ VM page cache was not coherent with the file system 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.
+ propagated 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>
+#if !STDC_HEADERS && !HAVE_STDLIB_H
+char *malloc ();
#endif
/* This mess was copied from the GNU getpagesize.h. */
-#ifndef HAVE_GETPAGESIZE
-
+#if !HAVE_GETPAGESIZE
/* Assume that all systems that can run configure have sys/param.h. */
-# ifndef HAVE_SYS_PARAM_H
+# if !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
+# if HAVE_SYS_PARAM_H
# include <sys/param.h>
# ifdef EXEC_PAGESIZE
# define getpagesize() EXEC_PAGESIZE
@@ -6919,602 +19876,2985 @@ else
#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);
+main ()
+{
+ char *data, *data2, *data3;
+ int i, pagesize;
+ int fd;
+
+ pagesize = getpagesize ();
+
+ /* First, make a file with some known garbage in it. */
+ data = (char *) malloc (pagesize);
+ if (!data)
+ exit (1);
+ for (i = 0; i < pagesize; ++i)
+ *(data + i) = rand ();
+ umask (0);
+ fd = creat ("conftest.mmap", 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 ("conftest.mmap", O_RDWR);
+ if (fd < 0)
+ exit (1);
+ data2 = (char *) malloc (2 * pagesize);
+ if (!data2)
+ exit (1);
+ data2 += (pagesize - ((long) 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 = (char *) 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);
+ 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
+_ACEOF
+rm -f conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; 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
+ echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+( exit $ac_status )
+ac_cv_func_mmap_fixed_mapped=no
fi
-rm -fr conftest*
+rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
fi
-
fi
-
-echo "$ac_t""$ac_cv_func_mmap_fixed_mapped" 1>&6
+echo "$as_me:$LINENO: result: $ac_cv_func_mmap_fixed_mapped" >&5
+echo "${ECHO_T}$ac_cv_func_mmap_fixed_mapped" >&6
if test $ac_cv_func_mmap_fixed_mapped = yes; then
- cat >> confdefs.h <<\EOF
+
+cat >>confdefs.h <<\_ACEOF
#define HAVE_MMAP 1
-EOF
+_ACEOF
fi
+rm -f conftest.mmap
+
+
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"
+as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
+echo "$as_me:$LINENO: checking for $ac_func" >&5
+echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6
+if eval "test \"\${$as_ac_var+set}\" = set"; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
+ For example, HP-UX 11i <limits.h> declares gettimeofday. */
+#define $ac_func innocuous_$ac_func
+
/* 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();
+ which can conflict with char $ac_func (); below.
+ Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ <limits.h> exists even on freestanding compilers. */
+
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
-int main() {
+#undef $ac_func
+/* Override any gcc2 internal prototype to avoid an error. */
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+/* 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 ();
/* 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();
+char (*f) () = $ac_func;
+#endif
+#ifdef __cplusplus
+}
#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
+int
+main ()
+{
+return f != $ac_func;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ eval "$as_ac_var=yes"
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+eval "$as_ac_var=no"
+fi
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6
+if test `eval echo '${'$as_ac_var'}'` = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
-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
+ true+yes )
+cat >>confdefs.h <<\_ACEOF
#define USE_MMAP 1
-EOF
+_ACEOF
;;
esac
rm -f doc/config.status
-trap '' 1 2 15
-cat > confcache <<\EOF
+ ac_config_files="$ac_config_files Makefile doc/Makefile bfd-in3.h:bfd-in2.h po/Makefile.in:po/Make-in"
+
+
+ ac_config_commands="$ac_config_commands default"
+
+
+
+
+
+
+cat >confcache <<\_ACEOF
# 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.
+# scripts and configure runs, see configure's option --config-cache.
+# 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.
+# config.status only pays attention to the cache file if you give it
+# the --recheck option to rerun configure.
#
-EOF
+# `ac_cv_env_foo' variables (set or unset) will be overridden when
+# loading this file, other *unset* `ac_cv_foo' will be assigned the
+# following values.
+
+_ACEOF
+
# 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
+{
+ (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 \
+ "s/'/'\\\\''/g;
+ s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p"
+ ;;
+ *)
+ # `set' quotes correctly as required by POSIX, so do not add quotes.
+ sed -n \
+ "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p"
+ ;;
+ esac;
+} |
+ sed '
+ t clear
+ : clear
+ s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/
+ t end
+ /^ac_cv_env/!s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/
+ : end' >>confcache
+if diff $cache_file confcache >/dev/null 2>&1; then :; else
if test -w $cache_file; then
- echo "updating cache $cache_file"
- cat confcache > $cache_file
+ test "x$cache_file" != "x/dev/null" && 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.
+# VPATH may cause trouble with some makes, so we remove $(srcdir),
+# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and
+# trailing colons and then remove the whole line if VPATH becomes empty
+# (actually we leave an empty line to preserve line numbers).
if test "x$srcdir" = x.; then
- ac_vpsub='/^[ ]*VPATH[ ]*=[^:]*$/d'
+ ac_vpsub='/^[ ]*VPATH[ ]*=/{
+s/:*\$(srcdir):*/:/;
+s/:*\${srcdir}:*/:/;
+s/:*@srcdir@:*/:/;
+s/^\([^=]*=[ ]*\):*/\1/;
+s/:*$//;
+s/^[^=]*=[ ]*$//;
+}'
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}
+ac_libobjs=
+ac_ltlibobjs=
+for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue
+ # 1. Remove the extension, and $U if already installed.
+ ac_i=`echo "$ac_i" |
+ sed 's/\$U\././;s/\.o$//;s/\.obj$//'`
+ # 2. Add them.
+ ac_libobjs="$ac_libobjs $ac_i\$U.$ac_objext"
+ ac_ltlibobjs="$ac_ltlibobjs $ac_i"'$U.lo'
+done
+LIBOBJS=$ac_libobjs
+
+LTLIBOBJS=$ac_ltlibobjs
+
+
+if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then
+ { { echo "$as_me:$LINENO: error: conditional \"AMDEP\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"AMDEP\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then
+ { { echo "$as_me:$LINENO: error: conditional \"am__fastdepCC\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"am__fastdepCC\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+if test -z "${MAINTAINER_MODE_TRUE}" && test -z "${MAINTAINER_MODE_FALSE}"; then
+ { { echo "$as_me:$LINENO: error: conditional \"MAINTAINER_MODE\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"MAINTAINER_MODE\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+if test -z "${GENINSRC_NEVER_TRUE}" && test -z "${GENINSRC_NEVER_FALSE}"; then
+ { { echo "$as_me:$LINENO: error: conditional \"GENINSRC_NEVER\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"GENINSRC_NEVER\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+if test -z "${INSTALL_LIBBFD_TRUE}" && test -z "${INSTALL_LIBBFD_FALSE}"; then
+ { { echo "$as_me:$LINENO: error: conditional \"INSTALL_LIBBFD\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"INSTALL_LIBBFD\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+ { (exit 1); exit 1; }; }
+fi
-echo creating $CONFIG_STATUS
-rm -f $CONFIG_STATUS
-cat > $CONFIG_STATUS <<EOF
-#! /bin/sh
-# Generated automatically by configure.
+: ${CONFIG_STATUS=./config.status}
+ac_clean_files_save=$ac_clean_files
+ac_clean_files="$ac_clean_files $CONFIG_STATUS"
+{ echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5
+echo "$as_me: creating $CONFIG_STATUS" >&6;}
+cat >$CONFIG_STATUS <<_ACEOF
+#! $SHELL
+# Generated by $as_me.
# 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.
+# configure, is in config.log if it exists.
-ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]"
-for ac_option
+debug=false
+ac_cs_recheck=false
+ac_cs_silent=false
+SHELL=\${CONFIG_SHELL-$SHELL}
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+## --------------------- ##
+## M4sh Initialization. ##
+## --------------------- ##
+
+# Be Bourne compatible
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
+ emulate sh
+ NULLCMD=:
+ # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
+ # is contrary to our usage. Disable this feature.
+ alias -g '${1+"$@"}'='"$@"'
+elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then
+ set -o posix
+fi
+DUALCASE=1; export DUALCASE # for MKS sh
+
+# Support unset when possible.
+if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
+ as_unset=unset
+else
+ as_unset=false
+fi
+
+
+# Work around bugs in pre-3.0 UWIN ksh.
+$as_unset ENV MAIL MAILPATH
+PS1='$ '
+PS2='> '
+PS4='+ '
+
+# NLS nuisances.
+for as_var in \
+ LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \
+ LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \
+ LC_TELEPHONE LC_TIME
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
+ if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then
+ eval $as_var=C; export $as_var
+ else
+ $as_unset $as_var
+ fi
done
-ac_given_srcdir=$srcdir
-ac_given_INSTALL="$INSTALL"
+# Required to use basename.
+if expr a : '\(a\)' >/dev/null 2>&1; then
+ as_expr=expr
+else
+ as_expr=false
+fi
-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
+if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then
+ as_basename=basename
+else
+ as_basename=false
+fi
-# 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
+# Name of the executable.
+as_me=`$as_basename "$0" ||
+$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
+ X"$0" : 'X\(//\)$' \| \
+ X"$0" : 'X\(/\)$' \| \
+ . : '\(.\)' 2>/dev/null ||
+echo X/"$0" |
+ sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; }
+ /^X\/\(\/\/\)$/{ s//\1/; q; }
+ /^X\/\(\/\).*/{ s//\1/; q; }
+ s/.*/./; q'`
-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
+
+# PATH needs CR, and LINENO needs CR and PATH.
+# Avoid depending upon Character Ranges.
+as_cr_letters='abcdefghijklmnopqrstuvwxyz'
+as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
+as_cr_Letters=$as_cr_letters$as_cr_LETTERS
+as_cr_digits='0123456789'
+as_cr_alnum=$as_cr_Letters$as_cr_digits
+
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+ echo "#! /bin/sh" >conf$$.sh
+ echo "exit 0" >>conf$$.sh
+ chmod +x conf$$.sh
+ if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
+ PATH_SEPARATOR=';'
else
- sed "${ac_end}q" conftest.subs > conftest.s$ac_file
+ PATH_SEPARATOR=:
fi
- if test ! -s conftest.s$ac_file; then
- ac_more_lines=false
- rm -f conftest.s$ac_file
+ rm -f conf$$.sh
+fi
+
+
+ as_lineno_1=$LINENO
+ as_lineno_2=$LINENO
+ as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
+ test "x$as_lineno_1" != "x$as_lineno_2" &&
+ test "x$as_lineno_3" = "x$as_lineno_2" || {
+ # Find who we are. Look in the path if we contain no path at all
+ # relative or not.
+ case $0 in
+ *[\\/]* ) as_myself=$0 ;;
+ *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
+done
+
+ ;;
+ esac
+ # We did not find ourselves, most probably we were run as `sh COMMAND'
+ # in which case we are not to be found in the path.
+ if test "x$as_myself" = x; then
+ as_myself=$0
+ fi
+ if test ! -f "$as_myself"; then
+ { { echo "$as_me:$LINENO: error: cannot find myself; rerun with an absolute path" >&5
+echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2;}
+ { (exit 1); exit 1; }; }
+ fi
+ case $CONFIG_SHELL in
+ '')
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for as_base in sh bash ksh sh5; do
+ case $as_dir in
+ /*)
+ if ("$as_dir/$as_base" -c '
+ as_lineno_1=$LINENO
+ as_lineno_2=$LINENO
+ as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
+ test "x$as_lineno_1" != "x$as_lineno_2" &&
+ test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then
+ $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; }
+ $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; }
+ CONFIG_SHELL=$as_dir/$as_base
+ export CONFIG_SHELL
+ exec "$CONFIG_SHELL" "$0" ${1+"$@"}
+ fi;;
+ esac
+ done
+done
+;;
+ esac
+
+ # Create $as_me.lineno as a copy of $as_myself, but with $LINENO
+ # uniformly replaced by the line number. The first 'sed' inserts a
+ # line-number line before each line; the second 'sed' does the real
+ # work. The second script uses 'N' to pair each line-number line
+ # with the numbered line, and appends trailing '-' during
+ # substitution so that $LINENO is not a special case at line end.
+ # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the
+ # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-)
+ sed '=' <$as_myself |
+ sed '
+ N
+ s,$,-,
+ : loop
+ s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3,
+ t loop
+ s,-$,,
+ s,^['$as_cr_digits']*\n,,
+ ' >$as_me.lineno &&
+ chmod +x $as_me.lineno ||
+ { { echo "$as_me:$LINENO: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&5
+echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2;}
+ { (exit 1); exit 1; }; }
+
+ # Don't try to exec as it changes $[0], causing all sort of problems
+ # (the dirname of $[0] is not the place where we might find the
+ # original and so on. Autoconf is especially sensible to this).
+ . ./$as_me.lineno
+ # Exit status is that of the last command.
+ exit
+}
+
+
+case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in
+ *c*,-n*) ECHO_N= ECHO_C='
+' ECHO_T=' ' ;;
+ *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;;
+ *) ECHO_N= ECHO_C='\c' ECHO_T= ;;
+esac
+
+if expr a : '\(a\)' >/dev/null 2>&1; then
+ as_expr=expr
+else
+ as_expr=false
+fi
+
+rm -f conf$$ conf$$.exe conf$$.file
+echo >conf$$.file
+if ln -s conf$$.file conf$$ 2>/dev/null; then
+ # We could just check for DJGPP; but this test a) works b) is more generic
+ # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04).
+ if test -f conf$$.exe; then
+ # Don't use ln at all; we don't have any links
+ as_ln_s='cp -p'
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`
+ as_ln_s='ln -s'
fi
+elif ln conf$$.file conf$$ 2>/dev/null; then
+ as_ln_s=ln
+else
+ as_ln_s='cp -p'
+fi
+rm -f conf$$ conf$$.exe conf$$.file
+
+if mkdir -p . 2>/dev/null; then
+ as_mkdir_p=:
+else
+ test -d ./-p && rmdir ./-p
+ as_mkdir_p=false
+fi
+
+as_executable_p="test -f"
+
+# Sed expression to map a string onto a valid CPP name.
+as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
+
+# Sed expression to map a string onto a valid variable name.
+as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
+
+
+# IFS
+# We need space, tab and new line, in precisely that order.
+as_nl='
+'
+IFS=" $as_nl"
+
+# CDPATH.
+$as_unset CDPATH
+
+exec 6>&1
+
+# Open the log real soon, to keep \$[0] and so on meaningful, and to
+# report actual input values of CONFIG_FILES etc. instead of their
+# values after options handling. Logging --version etc. is OK.
+exec 5>>config.log
+{
+ echo
+ sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX
+## Running $as_me. ##
+_ASBOX
+} >&5
+cat >&5 <<_CSEOF
+
+This file was extended by $as_me, which was
+generated by GNU Autoconf 2.59. Invocation command line was
+
+ CONFIG_FILES = $CONFIG_FILES
+ CONFIG_HEADERS = $CONFIG_HEADERS
+ CONFIG_LINKS = $CONFIG_LINKS
+ CONFIG_COMMANDS = $CONFIG_COMMANDS
+ $ $0 $@
+
+_CSEOF
+echo "on `(hostname || uname -n) 2>/dev/null | sed 1q`" >&5
+echo >&5
+_ACEOF
+
+# Files that config.status was made for.
+if test -n "$ac_config_files"; then
+ echo "config_files=\"$ac_config_files\"" >>$CONFIG_STATUS
+fi
+
+if test -n "$ac_config_headers"; then
+ echo "config_headers=\"$ac_config_headers\"" >>$CONFIG_STATUS
+fi
+
+if test -n "$ac_config_links"; then
+ echo "config_links=\"$ac_config_links\"" >>$CONFIG_STATUS
+fi
+
+if test -n "$ac_config_commands"; then
+ echo "config_commands=\"$ac_config_commands\"" >>$CONFIG_STATUS
+fi
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+
+ac_cs_usage="\
+\`$as_me' instantiates files from templates according to the
+current configuration.
+
+Usage: $0 [OPTIONS] [FILE]...
+
+ -h, --help print this help, then exit
+ -V, --version print version number, then exit
+ -q, --quiet do not print progress messages
+ -d, --debug don't remove temporary files
+ --recheck update $as_me by reconfiguring in the same conditions
+ --file=FILE[:TEMPLATE]
+ instantiate the configuration file FILE
+ --header=FILE[:TEMPLATE]
+ instantiate the configuration header FILE
+
+Configuration files:
+$config_files
+
+Configuration headers:
+$config_headers
+
+Configuration commands:
+$config_commands
+
+Report bugs to <bug-autoconf@gnu.org>."
+_ACEOF
+
+cat >>$CONFIG_STATUS <<_ACEOF
+ac_cs_version="\\
+config.status
+configured by $0, generated by GNU Autoconf 2.59,
+ with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\"
+
+Copyright (C) 2003 Free Software Foundation, Inc.
+This config.status script is free software; the Free Software Foundation
+gives unlimited permission to copy, distribute and modify it."
+srcdir=$srcdir
+INSTALL="$INSTALL"
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+# If no file are specified by the user, then we need to provide default
+# value. By we need to know if files were specified by the user.
+ac_need_defaults=:
+while test $# != 0
+do
+ case $1 in
+ --*=*)
+ ac_option=`expr "x$1" : 'x\([^=]*\)='`
+ ac_optarg=`expr "x$1" : 'x[^=]*=\(.*\)'`
+ ac_shift=:
+ ;;
+ -*)
+ ac_option=$1
+ ac_optarg=$2
+ ac_shift=shift
+ ;;
+ *) # This is not an option, so the user has probably given explicit
+ # arguments.
+ ac_option=$1
+ ac_need_defaults=false;;
+ esac
+
+ case $ac_option in
+ # Handling of the options.
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF
+ -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
+ ac_cs_recheck=: ;;
+ --version | --vers* | -V )
+ echo "$ac_cs_version"; exit 0 ;;
+ --he | --h)
+ # Conflict between --help and --header
+ { { echo "$as_me:$LINENO: error: ambiguous option: $1
+Try \`$0 --help' for more information." >&5
+echo "$as_me: error: ambiguous option: $1
+Try \`$0 --help' for more information." >&2;}
+ { (exit 1); exit 1; }; };;
+ --help | --hel | -h )
+ echo "$ac_cs_usage"; exit 0 ;;
+ --debug | --d* | -d )
+ debug=: ;;
+ --file | --fil | --fi | --f )
+ $ac_shift
+ CONFIG_FILES="$CONFIG_FILES $ac_optarg"
+ ac_need_defaults=false;;
+ --header | --heade | --head | --hea )
+ $ac_shift
+ CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg"
+ ac_need_defaults=false;;
+ -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+ | -silent | --silent | --silen | --sile | --sil | --si | --s)
+ ac_cs_silent=: ;;
+
+ # This is an error.
+ -*) { { echo "$as_me:$LINENO: error: unrecognized option: $1
+Try \`$0 --help' for more information." >&5
+echo "$as_me: error: unrecognized option: $1
+Try \`$0 --help' for more information." >&2;}
+ { (exit 1); exit 1; }; } ;;
+
+ *) ac_config_targets="$ac_config_targets $1" ;;
+
+ esac
+ shift
done
-if test -z "$ac_sed_cmds"; then
- ac_sed_cmds=cat
+
+ac_configure_extra_args=
+
+if $ac_cs_silent; then
+ exec 6>/dev/null
+ ac_configure_extra_args="$ac_configure_extra_args --silent"
fi
-EOF
-cat >> $CONFIG_STATUS <<EOF
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF
+if \$ac_cs_recheck; then
+ echo "running $SHELL $0 " $ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6
+ exec $SHELL $0 $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion
+fi
-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" ;;
+_ACEOF
+
+cat >>$CONFIG_STATUS <<_ACEOF
+#
+# INIT-COMMANDS section.
+#
+
+AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"
+
+
+# The HP-UX ksh and POSIX shell print the target directory to stdout
+# if CDPATH is set.
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+
+sed_quote_subst='$sed_quote_subst'
+double_quote_subst='$double_quote_subst'
+delay_variable_subst='$delay_variable_subst'
+enable_shared='`$ECHO "X$enable_shared" | $Xsed -e "$delay_single_quote_subst"`'
+macro_version='`$ECHO "X$macro_version" | $Xsed -e "$delay_single_quote_subst"`'
+macro_revision='`$ECHO "X$macro_revision" | $Xsed -e "$delay_single_quote_subst"`'
+enable_static='`$ECHO "X$enable_static" | $Xsed -e "$delay_single_quote_subst"`'
+pic_mode='`$ECHO "X$pic_mode" | $Xsed -e "$delay_single_quote_subst"`'
+enable_fast_install='`$ECHO "X$enable_fast_install" | $Xsed -e "$delay_single_quote_subst"`'
+host_alias='`$ECHO "X$host_alias" | $Xsed -e "$delay_single_quote_subst"`'
+host='`$ECHO "X$host" | $Xsed -e "$delay_single_quote_subst"`'
+host_os='`$ECHO "X$host_os" | $Xsed -e "$delay_single_quote_subst"`'
+build_alias='`$ECHO "X$build_alias" | $Xsed -e "$delay_single_quote_subst"`'
+build='`$ECHO "X$build" | $Xsed -e "$delay_single_quote_subst"`'
+build_os='`$ECHO "X$build_os" | $Xsed -e "$delay_single_quote_subst"`'
+SED='`$ECHO "X$SED" | $Xsed -e "$delay_single_quote_subst"`'
+Xsed='`$ECHO "X$Xsed" | $Xsed -e "$delay_single_quote_subst"`'
+GREP='`$ECHO "X$GREP" | $Xsed -e "$delay_single_quote_subst"`'
+EGREP='`$ECHO "X$EGREP" | $Xsed -e "$delay_single_quote_subst"`'
+FGREP='`$ECHO "X$FGREP" | $Xsed -e "$delay_single_quote_subst"`'
+LD='`$ECHO "X$LD" | $Xsed -e "$delay_single_quote_subst"`'
+NM='`$ECHO "X$NM" | $Xsed -e "$delay_single_quote_subst"`'
+LN_S='`$ECHO "X$LN_S" | $Xsed -e "$delay_single_quote_subst"`'
+max_cmd_len='`$ECHO "X$max_cmd_len" | $Xsed -e "$delay_single_quote_subst"`'
+ac_objext='`$ECHO "X$ac_objext" | $Xsed -e "$delay_single_quote_subst"`'
+exeext='`$ECHO "X$exeext" | $Xsed -e "$delay_single_quote_subst"`'
+lt_unset='`$ECHO "X$lt_unset" | $Xsed -e "$delay_single_quote_subst"`'
+lt_SP2NL='`$ECHO "X$lt_SP2NL" | $Xsed -e "$delay_single_quote_subst"`'
+lt_NL2SP='`$ECHO "X$lt_NL2SP" | $Xsed -e "$delay_single_quote_subst"`'
+reload_flag='`$ECHO "X$reload_flag" | $Xsed -e "$delay_single_quote_subst"`'
+reload_cmds='`$ECHO "X$reload_cmds" | $Xsed -e "$delay_single_quote_subst"`'
+deplibs_check_method='`$ECHO "X$deplibs_check_method" | $Xsed -e "$delay_single_quote_subst"`'
+file_magic_cmd='`$ECHO "X$file_magic_cmd" | $Xsed -e "$delay_single_quote_subst"`'
+AR='`$ECHO "X$AR" | $Xsed -e "$delay_single_quote_subst"`'
+AR_FLAGS='`$ECHO "X$AR_FLAGS" | $Xsed -e "$delay_single_quote_subst"`'
+STRIP='`$ECHO "X$STRIP" | $Xsed -e "$delay_single_quote_subst"`'
+RANLIB='`$ECHO "X$RANLIB" | $Xsed -e "$delay_single_quote_subst"`'
+old_postinstall_cmds='`$ECHO "X$old_postinstall_cmds" | $Xsed -e "$delay_single_quote_subst"`'
+old_postuninstall_cmds='`$ECHO "X$old_postuninstall_cmds" | $Xsed -e "$delay_single_quote_subst"`'
+old_archive_cmds='`$ECHO "X$old_archive_cmds" | $Xsed -e "$delay_single_quote_subst"`'
+CC='`$ECHO "X$CC" | $Xsed -e "$delay_single_quote_subst"`'
+CFLAGS='`$ECHO "X$CFLAGS" | $Xsed -e "$delay_single_quote_subst"`'
+compiler='`$ECHO "X$compiler" | $Xsed -e "$delay_single_quote_subst"`'
+GCC='`$ECHO "X$GCC" | $Xsed -e "$delay_single_quote_subst"`'
+lt_cv_sys_global_symbol_pipe='`$ECHO "X$lt_cv_sys_global_symbol_pipe" | $Xsed -e "$delay_single_quote_subst"`'
+lt_cv_sys_global_symbol_to_cdecl='`$ECHO "X$lt_cv_sys_global_symbol_to_cdecl" | $Xsed -e "$delay_single_quote_subst"`'
+lt_cv_sys_global_symbol_to_c_name_address='`$ECHO "X$lt_cv_sys_global_symbol_to_c_name_address" | $Xsed -e "$delay_single_quote_subst"`'
+objdir='`$ECHO "X$objdir" | $Xsed -e "$delay_single_quote_subst"`'
+SHELL='`$ECHO "X$SHELL" | $Xsed -e "$delay_single_quote_subst"`'
+ECHO='`$ECHO "X$ECHO" | $Xsed -e "$delay_single_quote_subst"`'
+MAGIC_CMD='`$ECHO "X$MAGIC_CMD" | $Xsed -e "$delay_single_quote_subst"`'
+lt_prog_compiler_no_builtin_flag='`$ECHO "X$lt_prog_compiler_no_builtin_flag" | $Xsed -e "$delay_single_quote_subst"`'
+lt_prog_compiler_wl='`$ECHO "X$lt_prog_compiler_wl" | $Xsed -e "$delay_single_quote_subst"`'
+lt_prog_compiler_pic='`$ECHO "X$lt_prog_compiler_pic" | $Xsed -e "$delay_single_quote_subst"`'
+lt_prog_compiler_static='`$ECHO "X$lt_prog_compiler_static" | $Xsed -e "$delay_single_quote_subst"`'
+lt_cv_prog_compiler_c_o='`$ECHO "X$lt_cv_prog_compiler_c_o" | $Xsed -e "$delay_single_quote_subst"`'
+need_locks='`$ECHO "X$need_locks" | $Xsed -e "$delay_single_quote_subst"`'
+libext='`$ECHO "X$libext" | $Xsed -e "$delay_single_quote_subst"`'
+shrext_cmds='`$ECHO "X$shrext_cmds" | $Xsed -e "$delay_single_quote_subst"`'
+extract_expsyms_cmds='`$ECHO "X$extract_expsyms_cmds" | $Xsed -e "$delay_single_quote_subst"`'
+archive_cmds_need_lc='`$ECHO "X$archive_cmds_need_lc" | $Xsed -e "$delay_single_quote_subst"`'
+enable_shared_with_static_runtimes='`$ECHO "X$enable_shared_with_static_runtimes" | $Xsed -e "$delay_single_quote_subst"`'
+export_dynamic_flag_spec='`$ECHO "X$export_dynamic_flag_spec" | $Xsed -e "$delay_single_quote_subst"`'
+whole_archive_flag_spec='`$ECHO "X$whole_archive_flag_spec" | $Xsed -e "$delay_single_quote_subst"`'
+compiler_needs_object='`$ECHO "X$compiler_needs_object" | $Xsed -e "$delay_single_quote_subst"`'
+old_archive_from_new_cmds='`$ECHO "X$old_archive_from_new_cmds" | $Xsed -e "$delay_single_quote_subst"`'
+old_archive_from_expsyms_cmds='`$ECHO "X$old_archive_from_expsyms_cmds" | $Xsed -e "$delay_single_quote_subst"`'
+archive_cmds='`$ECHO "X$archive_cmds" | $Xsed -e "$delay_single_quote_subst"`'
+archive_expsym_cmds='`$ECHO "X$archive_expsym_cmds" | $Xsed -e "$delay_single_quote_subst"`'
+module_cmds='`$ECHO "X$module_cmds" | $Xsed -e "$delay_single_quote_subst"`'
+module_expsym_cmds='`$ECHO "X$module_expsym_cmds" | $Xsed -e "$delay_single_quote_subst"`'
+with_gnu_ld='`$ECHO "X$with_gnu_ld" | $Xsed -e "$delay_single_quote_subst"`'
+allow_undefined_flag='`$ECHO "X$allow_undefined_flag" | $Xsed -e "$delay_single_quote_subst"`'
+no_undefined_flag='`$ECHO "X$no_undefined_flag" | $Xsed -e "$delay_single_quote_subst"`'
+hardcode_libdir_flag_spec='`$ECHO "X$hardcode_libdir_flag_spec" | $Xsed -e "$delay_single_quote_subst"`'
+hardcode_libdir_flag_spec_ld='`$ECHO "X$hardcode_libdir_flag_spec_ld" | $Xsed -e "$delay_single_quote_subst"`'
+hardcode_libdir_separator='`$ECHO "X$hardcode_libdir_separator" | $Xsed -e "$delay_single_quote_subst"`'
+hardcode_direct='`$ECHO "X$hardcode_direct" | $Xsed -e "$delay_single_quote_subst"`'
+hardcode_direct_absolute='`$ECHO "X$hardcode_direct_absolute" | $Xsed -e "$delay_single_quote_subst"`'
+hardcode_minus_L='`$ECHO "X$hardcode_minus_L" | $Xsed -e "$delay_single_quote_subst"`'
+hardcode_shlibpath_var='`$ECHO "X$hardcode_shlibpath_var" | $Xsed -e "$delay_single_quote_subst"`'
+hardcode_automatic='`$ECHO "X$hardcode_automatic" | $Xsed -e "$delay_single_quote_subst"`'
+inherit_rpath='`$ECHO "X$inherit_rpath" | $Xsed -e "$delay_single_quote_subst"`'
+link_all_deplibs='`$ECHO "X$link_all_deplibs" | $Xsed -e "$delay_single_quote_subst"`'
+fix_srcfile_path='`$ECHO "X$fix_srcfile_path" | $Xsed -e "$delay_single_quote_subst"`'
+always_export_symbols='`$ECHO "X$always_export_symbols" | $Xsed -e "$delay_single_quote_subst"`'
+export_symbols_cmds='`$ECHO "X$export_symbols_cmds" | $Xsed -e "$delay_single_quote_subst"`'
+exclude_expsyms='`$ECHO "X$exclude_expsyms" | $Xsed -e "$delay_single_quote_subst"`'
+include_expsyms='`$ECHO "X$include_expsyms" | $Xsed -e "$delay_single_quote_subst"`'
+prelink_cmds='`$ECHO "X$prelink_cmds" | $Xsed -e "$delay_single_quote_subst"`'
+file_list_spec='`$ECHO "X$file_list_spec" | $Xsed -e "$delay_single_quote_subst"`'
+variables_saved_for_relink='`$ECHO "X$variables_saved_for_relink" | $Xsed -e "$delay_single_quote_subst"`'
+need_lib_prefix='`$ECHO "X$need_lib_prefix" | $Xsed -e "$delay_single_quote_subst"`'
+need_version='`$ECHO "X$need_version" | $Xsed -e "$delay_single_quote_subst"`'
+version_type='`$ECHO "X$version_type" | $Xsed -e "$delay_single_quote_subst"`'
+runpath_var='`$ECHO "X$runpath_var" | $Xsed -e "$delay_single_quote_subst"`'
+shlibpath_var='`$ECHO "X$shlibpath_var" | $Xsed -e "$delay_single_quote_subst"`'
+shlibpath_overrides_runpath='`$ECHO "X$shlibpath_overrides_runpath" | $Xsed -e "$delay_single_quote_subst"`'
+libname_spec='`$ECHO "X$libname_spec" | $Xsed -e "$delay_single_quote_subst"`'
+library_names_spec='`$ECHO "X$library_names_spec" | $Xsed -e "$delay_single_quote_subst"`'
+soname_spec='`$ECHO "X$soname_spec" | $Xsed -e "$delay_single_quote_subst"`'
+postinstall_cmds='`$ECHO "X$postinstall_cmds" | $Xsed -e "$delay_single_quote_subst"`'
+postuninstall_cmds='`$ECHO "X$postuninstall_cmds" | $Xsed -e "$delay_single_quote_subst"`'
+finish_cmds='`$ECHO "X$finish_cmds" | $Xsed -e "$delay_single_quote_subst"`'
+finish_eval='`$ECHO "X$finish_eval" | $Xsed -e "$delay_single_quote_subst"`'
+hardcode_into_libs='`$ECHO "X$hardcode_into_libs" | $Xsed -e "$delay_single_quote_subst"`'
+sys_lib_search_path_spec='`$ECHO "X$sys_lib_search_path_spec" | $Xsed -e "$delay_single_quote_subst"`'
+sys_lib_dlsearch_path_spec='`$ECHO "X$sys_lib_dlsearch_path_spec" | $Xsed -e "$delay_single_quote_subst"`'
+hardcode_action='`$ECHO "X$hardcode_action" | $Xsed -e "$delay_single_quote_subst"`'
+enable_dlopen='`$ECHO "X$enable_dlopen" | $Xsed -e "$delay_single_quote_subst"`'
+enable_dlopen_self='`$ECHO "X$enable_dlopen_self" | $Xsed -e "$delay_single_quote_subst"`'
+enable_dlopen_self_static='`$ECHO "X$enable_dlopen_self_static" | $Xsed -e "$delay_single_quote_subst"`'
+old_striplib='`$ECHO "X$old_striplib" | $Xsed -e "$delay_single_quote_subst"`'
+striplib='`$ECHO "X$striplib" | $Xsed -e "$delay_single_quote_subst"`'
+
+LTCC='$LTCC'
+LTCFLAGS='$LTCFLAGS'
+compiler='$compiler_DEFAULT'
+
+# Quote evaled strings.
+for var in SED \
+GREP \
+EGREP \
+FGREP \
+LD \
+NM \
+LN_S \
+lt_SP2NL \
+lt_NL2SP \
+reload_flag \
+deplibs_check_method \
+file_magic_cmd \
+AR \
+AR_FLAGS \
+STRIP \
+RANLIB \
+CC \
+CFLAGS \
+compiler \
+lt_cv_sys_global_symbol_pipe \
+lt_cv_sys_global_symbol_to_cdecl \
+lt_cv_sys_global_symbol_to_c_name_address \
+SHELL \
+ECHO \
+lt_prog_compiler_no_builtin_flag \
+lt_prog_compiler_wl \
+lt_prog_compiler_pic \
+lt_prog_compiler_static \
+lt_cv_prog_compiler_c_o \
+need_locks \
+shrext_cmds \
+export_dynamic_flag_spec \
+whole_archive_flag_spec \
+compiler_needs_object \
+with_gnu_ld \
+allow_undefined_flag \
+no_undefined_flag \
+hardcode_libdir_flag_spec \
+hardcode_libdir_flag_spec_ld \
+hardcode_libdir_separator \
+fix_srcfile_path \
+exclude_expsyms \
+include_expsyms \
+file_list_spec \
+variables_saved_for_relink \
+libname_spec \
+library_names_spec \
+soname_spec \
+finish_eval \
+old_striplib \
+striplib; do
+ case \`eval \\\\\$ECHO "X\\\\\$\$var"\` in
+ *[\\\\\\\`\\"\\\$]*)
+ eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"X\\\$\$var\\" | \\\$Xsed -e \\"\\\$sed_quote_subst\\"\\\`\\\\\\""
+ ;;
+ *)
+ eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\""
+ ;;
+ esac
+done
+
+# Double-quote double-evaled strings.
+for var in reload_cmds \
+old_postinstall_cmds \
+old_postuninstall_cmds \
+old_archive_cmds \
+extract_expsyms_cmds \
+old_archive_from_new_cmds \
+old_archive_from_expsyms_cmds \
+archive_cmds \
+archive_expsym_cmds \
+module_cmds \
+module_expsym_cmds \
+export_symbols_cmds \
+prelink_cmds \
+postinstall_cmds \
+postuninstall_cmds \
+finish_cmds \
+sys_lib_search_path_spec \
+sys_lib_dlsearch_path_spec; do
+ case \`eval \\\\\$ECHO "X\\\\\$\$var"\` in
+ *[\\\\\\\`\\"\\\$]*)
+ eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"X\\\$\$var\\" | \\\$Xsed -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\""
+ ;;
+ *)
+ eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\""
+ ;;
+ esac
+done
+
+# Fix-up fallback echo if it was mangled by the above quoting rules.
+case \$lt_ECHO in
+*'\\\$0 --fallback-echo"') lt_ECHO=\`\$ECHO "X\$lt_ECHO" | \$Xsed -e 's/\\\\\\\\\\\\\\\$0 --fallback-echo"\$/\$0 --fallback-echo"/'\`
+ ;;
+esac
+
+ac_aux_dir='$ac_aux_dir'
+xsi_shell='$xsi_shell'
+lt_shell_append='$lt_shell_append'
+
+# See if we are running on zsh, and set the options which allow our
+# commands through without removal of \ escapes INIT.
+if test -n "\${ZSH_VERSION+set}" ; then
+ setopt NO_GLOB_SUBST
+fi
+
+
+ PACKAGE='$PACKAGE'
+ VERSION='$VERSION'
+ TIMESTAMP='$TIMESTAMP'
+ RM='$RM'
+ ofile='$ofile'
+
+
+
+# Capture the value of obsolete ALL_LINGUAS because we need it to compute
+ # POFILES, GMOFILES, UPDATEPOFILES, DUMMYPOFILES, CATALOGS. But hide it
+ # from automake.
+ eval 'OBSOLETE_ALL_LINGUAS''="$ALL_LINGUAS"'
+ # Capture the value of LINGUAS because we need it to compute CATALOGS.
+ LINGUAS="${LINGUAS-%UNSET%}"
+
+
+GCC="$GCC"
+CC="$CC"
+acx_cv_header_stdint="$acx_cv_header_stdint"
+acx_cv_type_int8_t="$acx_cv_type_int8_t"
+acx_cv_type_int16_t="$acx_cv_type_int16_t"
+acx_cv_type_int32_t="$acx_cv_type_int32_t"
+acx_cv_type_int64_t="$acx_cv_type_int64_t"
+acx_cv_type_intptr_t="$acx_cv_type_intptr_t"
+ac_cv_type_uintmax_t="$ac_cv_type_uintmax_t"
+ac_cv_type_uintptr_t="$ac_cv_type_uintptr_t"
+ac_cv_type_uint64_t="$ac_cv_type_uint64_t"
+ac_cv_type_u_int64_t="$ac_cv_type_u_int64_t"
+ac_cv_type_u_int32_t="$ac_cv_type_u_int32_t"
+ac_cv_type_int_least32_t="$ac_cv_type_int_least32_t"
+ac_cv_type_int_fast32_t="$ac_cv_type_int_fast32_t"
+ac_cv_sizeof_void_p="$ac_cv_sizeof_void_p"
+
+
+
+_ACEOF
+
+
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+for ac_config_target in $ac_config_targets
+do
+ case "$ac_config_target" in
+ # Handling of arguments.
+ "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;;
+ "doc/Makefile" ) CONFIG_FILES="$CONFIG_FILES doc/Makefile" ;;
+ "bfd-in3.h" ) CONFIG_FILES="$CONFIG_FILES bfd-in3.h:bfd-in2.h" ;;
+ "po/Makefile.in" ) CONFIG_FILES="$CONFIG_FILES po/Makefile.in:po/Make-in" ;;
+ "depfiles" ) CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;;
+ "libtool" ) CONFIG_COMMANDS="$CONFIG_COMMANDS libtool" ;;
+ "default-1" ) CONFIG_COMMANDS="$CONFIG_COMMANDS default-1" ;;
+ "bfd_stdint.h" ) CONFIG_COMMANDS="$CONFIG_COMMANDS bfd_stdint.h" ;;
+ "default" ) CONFIG_COMMANDS="$CONFIG_COMMANDS default" ;;
+ "config.h" ) CONFIG_HEADERS="$CONFIG_HEADERS config.h:config.in" ;;
+ *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5
+echo "$as_me: error: invalid argument: $ac_config_target" >&2;}
+ { (exit 1); exit 1; }; };;
esac
+done
- # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories.
+# If the user did not use the arguments to specify the items to instantiate,
+# then the envvar interface is used. Set only those that are not.
+# We use the long form for the default assignment because of an extremely
+# bizarre bug on SunOS 4.1.3.
+if $ac_need_defaults; then
+ test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files
+ test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers
+ test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands
+fi
+
+# Have a temporary directory for convenience. Make it in the build tree
+# simply because there is no reason to put it here, and in addition,
+# creating and moving files from /tmp can sometimes cause problems.
+# Create a temporary directory, and hook for its removal unless debugging.
+$debug ||
+{
+ trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0
+ trap '{ (exit 1); exit 1; }' 1 2 13 15
+}
- # 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=
+# Create a (secure) tmp directory for tmp files.
+
+{
+ tmp=`(umask 077 && mktemp -d -q "./confstatXXXXXX") 2>/dev/null` &&
+ test -n "$tmp" && test -d "$tmp"
+} ||
+{
+ tmp=./confstat$$-$RANDOM
+ (umask 077 && mkdir $tmp)
+} ||
+{
+ echo "$me: cannot create a temporary directory in ." >&2
+ { (exit 1); exit 1; }
+}
+
+_ACEOF
+
+cat >>$CONFIG_STATUS <<_ACEOF
+
+#
+# CONFIG_FILES section.
+#
+
+# No need to generate the scripts if there are no CONFIG_FILES.
+# This happens for instance when ./config.status config.h
+if test -n "\$CONFIG_FILES"; then
+ # Protect against being on the right side of a sed subst in config.status.
+ sed 's/,@/@@/; s/@,/@@/; s/,;t t\$/@;t t/; /@;t t\$/s/[\\\\&,]/\\\\&/g;
+ s/@@/,@/; s/@@/@,/; s/@;t t\$/,;t t/' >\$tmp/subs.sed <<\\CEOF
+s,@SHELL@,$SHELL,;t t
+s,@PATH_SEPARATOR@,$PATH_SEPARATOR,;t t
+s,@PACKAGE_NAME@,$PACKAGE_NAME,;t t
+s,@PACKAGE_TARNAME@,$PACKAGE_TARNAME,;t t
+s,@PACKAGE_VERSION@,$PACKAGE_VERSION,;t t
+s,@PACKAGE_STRING@,$PACKAGE_STRING,;t t
+s,@PACKAGE_BUGREPORT@,$PACKAGE_BUGREPORT,;t t
+s,@exec_prefix@,$exec_prefix,;t t
+s,@prefix@,$prefix,;t t
+s,@program_transform_name@,$program_transform_name,;t t
+s,@bindir@,$bindir,;t t
+s,@sbindir@,$sbindir,;t t
+s,@libexecdir@,$libexecdir,;t t
+s,@datadir@,$datadir,;t t
+s,@sysconfdir@,$sysconfdir,;t t
+s,@sharedstatedir@,$sharedstatedir,;t t
+s,@localstatedir@,$localstatedir,;t t
+s,@libdir@,$libdir,;t t
+s,@includedir@,$includedir,;t t
+s,@oldincludedir@,$oldincludedir,;t t
+s,@infodir@,$infodir,;t t
+s,@mandir@,$mandir,;t t
+s,@build_alias@,$build_alias,;t t
+s,@host_alias@,$host_alias,;t t
+s,@target_alias@,$target_alias,;t t
+s,@DEFS@,$DEFS,;t t
+s,@ECHO_C@,$ECHO_C,;t t
+s,@ECHO_N@,$ECHO_N,;t t
+s,@ECHO_T@,$ECHO_T,;t t
+s,@LIBS@,$LIBS,;t t
+s,@build@,$build,;t t
+s,@build_cpu@,$build_cpu,;t t
+s,@build_vendor@,$build_vendor,;t t
+s,@build_os@,$build_os,;t t
+s,@host@,$host,;t t
+s,@host_cpu@,$host_cpu,;t t
+s,@host_vendor@,$host_vendor,;t t
+s,@host_os@,$host_os,;t t
+s,@target@,$target,;t t
+s,@target_cpu@,$target_cpu,;t t
+s,@target_vendor@,$target_vendor,;t t
+s,@target_os@,$target_os,;t t
+s,@CC@,$CC,;t t
+s,@CFLAGS@,$CFLAGS,;t t
+s,@LDFLAGS@,$LDFLAGS,;t t
+s,@CPPFLAGS@,$CPPFLAGS,;t t
+s,@ac_ct_CC@,$ac_ct_CC,;t t
+s,@EXEEXT@,$EXEEXT,;t t
+s,@OBJEXT@,$OBJEXT,;t t
+s,@INSTALL_PROGRAM@,$INSTALL_PROGRAM,;t t
+s,@INSTALL_SCRIPT@,$INSTALL_SCRIPT,;t t
+s,@INSTALL_DATA@,$INSTALL_DATA,;t t
+s,@CYGPATH_W@,$CYGPATH_W,;t t
+s,@PACKAGE@,$PACKAGE,;t t
+s,@VERSION@,$VERSION,;t t
+s,@ACLOCAL@,$ACLOCAL,;t t
+s,@AUTOCONF@,$AUTOCONF,;t t
+s,@AUTOMAKE@,$AUTOMAKE,;t t
+s,@AUTOHEADER@,$AUTOHEADER,;t t
+s,@MAKEINFO@,$MAKEINFO,;t t
+s,@install_sh@,$install_sh,;t t
+s,@STRIP@,$STRIP,;t t
+s,@ac_ct_STRIP@,$ac_ct_STRIP,;t t
+s,@INSTALL_STRIP_PROGRAM@,$INSTALL_STRIP_PROGRAM,;t t
+s,@mkdir_p@,$mkdir_p,;t t
+s,@AWK@,$AWK,;t t
+s,@SET_MAKE@,$SET_MAKE,;t t
+s,@am__leading_dot@,$am__leading_dot,;t t
+s,@AMTAR@,$AMTAR,;t t
+s,@am__tar@,$am__tar,;t t
+s,@am__untar@,$am__untar,;t t
+s,@DEPDIR@,$DEPDIR,;t t
+s,@am__include@,$am__include,;t t
+s,@am__quote@,$am__quote,;t t
+s,@AMDEP_TRUE@,$AMDEP_TRUE,;t t
+s,@AMDEP_FALSE@,$AMDEP_FALSE,;t t
+s,@AMDEPBACKSLASH@,$AMDEPBACKSLASH,;t t
+s,@CCDEPMODE@,$CCDEPMODE,;t t
+s,@am__fastdepCC_TRUE@,$am__fastdepCC_TRUE,;t t
+s,@am__fastdepCC_FALSE@,$am__fastdepCC_FALSE,;t t
+s,@AR@,$AR,;t t
+s,@ac_ct_AR@,$ac_ct_AR,;t t
+s,@RANLIB@,$RANLIB,;t t
+s,@ac_ct_RANLIB@,$ac_ct_RANLIB,;t t
+s,@LIBTOOL@,$LIBTOOL,;t t
+s,@SED@,$SED,;t t
+s,@EGREP@,$EGREP,;t t
+s,@FGREP@,$FGREP,;t t
+s,@GREP@,$GREP,;t t
+s,@LD@,$LD,;t t
+s,@DUMPBIN@,$DUMPBIN,;t t
+s,@ac_ct_DUMPBIN@,$ac_ct_DUMPBIN,;t t
+s,@NM@,$NM,;t t
+s,@LN_S@,$LN_S,;t t
+s,@lt_ECHO@,$lt_ECHO,;t t
+s,@CPP@,$CPP,;t t
+s,@DEBUGDIR@,$DEBUGDIR,;t t
+s,@PKGVERSION@,$PKGVERSION,;t t
+s,@REPORT_BUGS_TO@,$REPORT_BUGS_TO,;t t
+s,@REPORT_BUGS_TEXI@,$REPORT_BUGS_TEXI,;t t
+s,@WARN_CFLAGS@,$WARN_CFLAGS,;t t
+s,@NO_WERROR@,$NO_WERROR,;t t
+s,@MAINTAINER_MODE_TRUE@,$MAINTAINER_MODE_TRUE,;t t
+s,@MAINTAINER_MODE_FALSE@,$MAINTAINER_MODE_FALSE,;t t
+s,@MAINT@,$MAINT,;t t
+s,@GENINSRC_NEVER_TRUE@,$GENINSRC_NEVER_TRUE,;t t
+s,@GENINSRC_NEVER_FALSE@,$GENINSRC_NEVER_FALSE,;t t
+s,@INSTALL_LIBBFD_TRUE@,$INSTALL_LIBBFD_TRUE,;t t
+s,@INSTALL_LIBBFD_FALSE@,$INSTALL_LIBBFD_FALSE,;t t
+s,@host_noncanonical@,$host_noncanonical,;t t
+s,@target_noncanonical@,$target_noncanonical,;t t
+s,@bfdlibdir@,$bfdlibdir,;t t
+s,@bfdincludedir@,$bfdincludedir,;t t
+s,@USE_NLS@,$USE_NLS,;t t
+s,@LIBINTL@,$LIBINTL,;t t
+s,@LIBINTL_DEP@,$LIBINTL_DEP,;t t
+s,@INCINTL@,$INCINTL,;t t
+s,@XGETTEXT@,$XGETTEXT,;t t
+s,@GMSGFMT@,$GMSGFMT,;t t
+s,@POSUB@,$POSUB,;t t
+s,@CATALOGS@,$CATALOGS,;t t
+s,@DATADIRNAME@,$DATADIRNAME,;t t
+s,@INSTOBJEXT@,$INSTOBJEXT,;t t
+s,@GENCAT@,$GENCAT,;t t
+s,@CATOBJEXT@,$CATOBJEXT,;t t
+s,@MKINSTALLDIRS@,$MKINSTALLDIRS,;t t
+s,@MSGFMT@,$MSGFMT,;t t
+s,@MSGMERGE@,$MSGMERGE,;t t
+s,@HDEFINES@,$HDEFINES,;t t
+s,@BFD_HOST_64BIT_LONG@,$BFD_HOST_64BIT_LONG,;t t
+s,@BFD_HOST_LONG_LONG@,$BFD_HOST_LONG_LONG,;t t
+s,@BFD_HOST_64_BIT_DEFINED@,$BFD_HOST_64_BIT_DEFINED,;t t
+s,@BFD_HOST_64_BIT@,$BFD_HOST_64_BIT,;t t
+s,@BFD_HOST_U_64_BIT@,$BFD_HOST_U_64_BIT,;t t
+s,@CC_FOR_BUILD@,$CC_FOR_BUILD,;t t
+s,@EXEEXT_FOR_BUILD@,$EXEEXT_FOR_BUILD,;t t
+s,@COREFILE@,$COREFILE,;t t
+s,@COREFLAG@,$COREFLAG,;t t
+s,@WIN32LDFLAGS@,$WIN32LDFLAGS,;t t
+s,@WIN32LIBADD@,$WIN32LIBADD,;t t
+s,@TDEFINES@,$TDEFINES,;t t
+s,@wordsize@,$wordsize,;t t
+s,@bfd64_libs@,$bfd64_libs,;t t
+s,@all_backends@,$all_backends,;t t
+s,@bfd_backends@,$bfd_backends,;t t
+s,@bfd_machines@,$bfd_machines,;t t
+s,@bfd_default_target_size@,$bfd_default_target_size,;t t
+s,@bfd_file_ptr@,$bfd_file_ptr,;t t
+s,@bfd_ufile_ptr@,$bfd_ufile_ptr,;t t
+s,@tdefaults@,$tdefaults,;t t
+s,@datarootdir@,$datarootdir,;t t
+s,@docdir@,$docdir,;t t
+s,@htmldir@,$htmldir,;t t
+s,@LIBOBJS@,$LIBOBJS,;t t
+s,@LTLIBOBJS@,$LTLIBOBJS,;t t
+CEOF
+
+_ACEOF
+
+ cat >>$CONFIG_STATUS <<\_ACEOF
+ # 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_lines=48
+ ac_sed_frag=1 # Number of current file.
+ ac_beg=1 # First line for current file.
+ ac_end=$ac_max_sed_lines # 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" $tmp/subs.sed >$tmp/subs.frag
+ else
+ sed "${ac_end}q" $tmp/subs.sed >$tmp/subs.frag
+ fi
+ if test ! -s $tmp/subs.frag; then
+ ac_more_lines=false
+ else
+ # The purpose of the label and of the branching condition is to
+ # speed up the sed processing (if there are no `@' at all, there
+ # is no need to browse any of the substitutions).
+ # These are the two extra sed commands mentioned above.
+ (echo ':t
+ /@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed
+ if test -z "$ac_sed_cmds"; then
+ ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed"
+ else
+ ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed"
+ fi
+ ac_sed_frag=`expr $ac_sed_frag + 1`
+ ac_beg=$ac_end
+ ac_end=`expr $ac_end + $ac_max_sed_lines`
+ fi
+ done
+ if test -z "$ac_sed_cmds"; then
+ ac_sed_cmds=cat
fi
+fi # test -n "$CONFIG_FILES"
- 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" ;;
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF
+for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue
+ # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
+ case $ac_file in
+ - | *:- | *:-:* ) # input from stdin
+ cat >$tmp/stdin
+ ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`
+ ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
+ *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`
+ ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
+ * ) ac_file_in=$ac_file.in ;;
esac
- case "$ac_given_INSTALL" in
- [/$]*) INSTALL="$ac_given_INSTALL" ;;
- *) INSTALL="$ac_dots$ac_given_INSTALL" ;;
- esac
+ # Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories.
+ ac_dir=`(dirname "$ac_file") 2>/dev/null ||
+$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$ac_file" : 'X\(//\)[^/]' \| \
+ X"$ac_file" : 'X\(//\)$' \| \
+ X"$ac_file" : 'X\(/\)' \| \
+ . : '\(.\)' 2>/dev/null ||
+echo X"$ac_file" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+ /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+ /^X\(\/\/\)$/{ s//\1/; q; }
+ /^X\(\/\).*/{ s//\1/; q; }
+ s/.*/./; q'`
+ { if $as_mkdir_p; then
+ mkdir -p "$ac_dir"
+ else
+ as_dir="$ac_dir"
+ as_dirs=
+ while test ! -d "$as_dir"; do
+ as_dirs="$as_dir $as_dirs"
+ as_dir=`(dirname "$as_dir") 2>/dev/null ||
+$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$as_dir" : 'X\(//\)[^/]' \| \
+ X"$as_dir" : 'X\(//\)$' \| \
+ X"$as_dir" : 'X\(/\)' \| \
+ . : '\(.\)' 2>/dev/null ||
+echo X"$as_dir" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+ /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+ /^X\(\/\/\)$/{ s//\1/; q; }
+ /^X\(\/\).*/{ s//\1/; q; }
+ s/.*/./; q'`
+ done
+ test ! -n "$as_dirs" || mkdir $as_dirs
+ fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5
+echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;}
+ { (exit 1); exit 1; }; }; }
+
+ ac_builddir=.
+
+if test "$ac_dir" != .; then
+ ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'`
+ # A "../" for each directory in $ac_dir_suffix.
+ ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'`
+else
+ ac_dir_suffix= ac_top_builddir=
+fi
+
+case $srcdir in
+ .) # No --srcdir option. We are building in place.
+ ac_srcdir=.
+ if test -z "$ac_top_builddir"; then
+ ac_top_srcdir=.
+ else
+ ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'`
+ fi ;;
+ [\\/]* | ?:[\\/]* ) # Absolute path.
+ ac_srcdir=$srcdir$ac_dir_suffix;
+ ac_top_srcdir=$srcdir ;;
+ *) # Relative path.
+ ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix
+ ac_top_srcdir=$ac_top_builddir$srcdir ;;
+esac
+
+# Do not use `cd foo && pwd` to compute absolute paths, because
+# the directories may not exist.
+case `pwd` in
+.) ac_abs_builddir="$ac_dir";;
+*)
+ case "$ac_dir" in
+ .) ac_abs_builddir=`pwd`;;
+ [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";;
+ *) ac_abs_builddir=`pwd`/"$ac_dir";;
+ esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_top_builddir=${ac_top_builddir}.;;
+*)
+ case ${ac_top_builddir}. in
+ .) ac_abs_top_builddir=$ac_abs_builddir;;
+ [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;;
+ *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;;
+ esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_srcdir=$ac_srcdir;;
+*)
+ case $ac_srcdir in
+ .) ac_abs_srcdir=$ac_abs_builddir;;
+ [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;;
+ *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;;
+ esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_top_srcdir=$ac_top_srcdir;;
+*)
+ case $ac_top_srcdir in
+ .) ac_abs_top_srcdir=$ac_abs_builddir;;
+ [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;;
+ *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;;
+ esac;;
+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= ;;
+
+ case $INSTALL in
+ [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;;
+ *) ac_INSTALL=$ac_top_builddir$INSTALL ;;
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*
+ if test x"$ac_file" != x-; then
+ { echo "$as_me:$LINENO: creating $ac_file" >&5
+echo "$as_me: creating $ac_file" >&6;}
+ rm -f "$ac_file"
+ fi
+ # Let's still pretend it is `configure' which instantiates (i.e., don't
+ # use $as_me), people would be surprised to read:
+ # /* config.h. Generated by config.status. */
+ if test x"$ac_file" = x-; then
+ configure_input=
+ else
+ configure_input="$ac_file. "
+ fi
+ configure_input=$configure_input"Generated from `echo $ac_file_in |
+ sed 's,.*/,,'` by configure."
+
+ # First look for the input files in the build tree, otherwise in the
+ # src tree.
+ ac_file_inputs=`IFS=:
+ for f in $ac_file_in; do
+ case $f in
+ -) echo $tmp/stdin ;;
+ [\\/$]*)
+ # Absolute (can't be DOS-style, as IFS=:)
+ test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
+echo "$as_me: error: cannot find input file: $f" >&2;}
+ { (exit 1); exit 1; }; }
+ echo "$f";;
+ *) # Relative
+ if test -f "$f"; then
+ # Build tree
+ echo "$f"
+ elif test -f "$srcdir/$f"; then
+ # Source tree
+ echo "$srcdir/$f"
+ else
+ # /dev/null tree
+ { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
+echo "$as_me: error: cannot find input file: $f" >&2;}
+ { (exit 1); exit 1; }; }
+ fi;;
+ esac
+ done` || { (exit 1); exit 1; }
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF
+ sed "$ac_vpsub
+$extrasub
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF
+:t
+/@[a-zA-Z_][a-zA-Z_0-9]*@/!b
+s,@configure_input@,$configure_input,;t t
+s,@srcdir@,$ac_srcdir,;t t
+s,@abs_srcdir@,$ac_abs_srcdir,;t t
+s,@top_srcdir@,$ac_top_srcdir,;t t
+s,@abs_top_srcdir@,$ac_abs_top_srcdir,;t t
+s,@builddir@,$ac_builddir,;t t
+s,@abs_builddir@,$ac_abs_builddir,;t t
+s,@top_builddir@,$ac_top_builddir,;t t
+s,@abs_top_builddir@,$ac_abs_top_builddir,;t t
+s,@INSTALL@,$ac_INSTALL,;t t
+" $ac_file_inputs | (eval "$ac_sed_cmds") >$tmp/out
+ rm -f $tmp/stdin
+ if test x"$ac_file" != x-; then
+ mv $tmp/out $ac_file
+ else
+ cat $tmp/out
+ rm -f $tmp/out
+ fi
+
+done
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF
+
+#
+# CONFIG_HEADER section.
+#
# 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_dA='s,^\([ ]*\)#\([ ]*define[ ][ ]*\)'
+ac_dB='[ ].*$,\1#\2'
+ac_dC=' '
+ac_dD=',;t'
+# ac_u turns "#undef NAME" without 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
+ac_uD=',;t'
+
+for ac_file in : $CONFIG_HEADERS; do test "x$ac_file" = x: && continue
# 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" ;;
+ case $ac_file in
+ - | *:- | *:-:* ) # input from stdin
+ cat >$tmp/stdin
+ ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`
+ ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
+ *:* ) 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
+ test x"$ac_file" != x- && { echo "$as_me:$LINENO: creating $ac_file" >&5
+echo "$as_me: creating $ac_file" >&6;}
+
+ # First look for the input files in the build tree, otherwise in the
+ # src tree.
+ ac_file_inputs=`IFS=:
+ for f in $ac_file_in; do
+ case $f in
+ -) echo $tmp/stdin ;;
+ [\\/$]*)
+ # Absolute (can't be DOS-style, as IFS=:)
+ test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
+echo "$as_me: error: cannot find input file: $f" >&2;}
+ { (exit 1); exit 1; }; }
+ # Do quote $f, to prevent DOS paths from being IFS'd.
+ echo "$f";;
+ *) # Relative
+ if test -f "$f"; then
+ # Build tree
+ echo "$f"
+ elif test -f "$srcdir/$f"; then
+ # Source tree
+ echo "$srcdir/$f"
+ else
+ # /dev/null tree
+ { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
+echo "$as_me: error: cannot find input file: $f" >&2;}
+ { (exit 1); exit 1; }; }
+ fi;;
+ esac
+ done` || { (exit 1); exit 1; }
+ # Remove the trailing spaces.
+ sed 's/[ ]*$//' $ac_file_inputs >$tmp/in
+
+_ACEOF
+
+# Transform confdefs.h into two sed scripts, `conftest.defines' and
+# `conftest.undefs', that substitutes the proper values into
+# config.h.in to produce config.h. The first handles `#define'
+# templates, and the second `#undef' templates.
+# 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.defines conftest.undefs
+# Using a here document instead of a string reduces the quoting nightmare.
+# Putting comments in sed scripts is not portable.
+#
+# `end' is used to avoid that the second main sed command (meant for
+# 0-ary CPP macros) applies to n-ary macro definitions.
+# See the Autoconf documentation for `clear'.
+cat >confdef2sed.sed <<\_ACEOF
+s/[\\&,]/\\&/g
+s,[\\$`],\\&,g
+t clear
+: clear
+s,^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*\)\(([^)]*)\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1\2${ac_dC}\3${ac_dD},gp
+t end
+s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD},gp
+: end
+_ACEOF
+# If some macros were called several times there might be several times
+# the same #defines, which is useless. Nevertheless, we may not want to
+# sort them, since we want the *last* AC-DEFINE to be honored.
+uniq confdefs.h | sed -n -f confdef2sed.sed >conftest.defines
+sed 's/ac_d/ac_u/g' conftest.defines >conftest.undefs
+rm -f confdef2sed.sed
# 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.
+cat >>conftest.undefs <<\_ACEOF
+s,^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*,/* & */,
+_ACEOF
+
+# Break up conftest.defines because some shells have a limit on the size
+# of here documents, and old seds have small limits too (100 cmds).
+echo ' # Handle all the #define templates only if necessary.' >>$CONFIG_STATUS
+echo ' if grep "^[ ]*#[ ]*define" $tmp/in >/dev/null; then' >>$CONFIG_STATUS
+echo ' # If there are no defines, we may have an empty if/fi' >>$CONFIG_STATUS
+echo ' :' >>$CONFIG_STATUS
+rm -f conftest.tail
+while grep . conftest.defines >/dev/null
+do
+ # Write a limited-size here document to $tmp/defines.sed.
+ echo ' cat >$tmp/defines.sed <<CEOF' >>$CONFIG_STATUS
+ # Speed up: don't consider the non `#define' lines.
+ echo '/^[ ]*#[ ]*define/!b' >>$CONFIG_STATUS
+ # Work around the forget-to-reset-the-flag bug.
+ echo 't clr' >>$CONFIG_STATUS
+ echo ': clr' >>$CONFIG_STATUS
+ sed ${ac_max_here_lines}q conftest.defines >>$CONFIG_STATUS
+ echo 'CEOF
+ sed -f $tmp/defines.sed $tmp/in >$tmp/out
+ rm -f $tmp/in
+ mv $tmp/out $tmp/in
+' >>$CONFIG_STATUS
+ sed 1,${ac_max_here_lines}d conftest.defines >conftest.tail
+ rm -f conftest.defines
+ mv conftest.tail conftest.defines
+done
+rm -f conftest.defines
+echo ' fi # grep' >>$CONFIG_STATUS
+echo >>$CONFIG_STATUS
+# Break up conftest.undefs because some shells have a limit on the size
+# of here documents, and old seds have small limits too (100 cmds).
+echo ' # Handle all the #undef templates' >>$CONFIG_STATUS
rm -f conftest.tail
-while :
+while grep . conftest.undefs >/dev/null
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
+ # Write a limited-size here document to $tmp/undefs.sed.
+ echo ' cat >$tmp/undefs.sed <<CEOF' >>$CONFIG_STATUS
+ # Speed up: don't consider the non `#undef'
+ echo '/^[ ]*#[ ]*undef/!b' >>$CONFIG_STATUS
+ # Work around the forget-to-reset-the-flag bug.
+ echo 't clr' >>$CONFIG_STATUS
+ echo ': clr' >>$CONFIG_STATUS
+ sed ${ac_max_here_lines}q conftest.undefs >>$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
+ sed -f $tmp/undefs.sed $tmp/in >$tmp/out
+ rm -f $tmp/in
+ mv $tmp/out $tmp/in
+' >>$CONFIG_STATUS
+ sed 1,${ac_max_here_lines}d conftest.undefs >conftest.tail
+ rm -f conftest.undefs
+ mv conftest.tail conftest.undefs
+done
+rm -f conftest.undefs
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+ # Let's still pretend it is `configure' which instantiates (i.e., don't
+ # use $as_me), people would be surprised to read:
+ # /* config.h. Generated by config.status. */
+ if test x"$ac_file" = x-; then
+ echo "/* Generated by configure. */" >$tmp/config.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"
+ echo "/* $ac_file. Generated by configure. */" >$tmp/config.h
+ fi
+ cat $tmp/in >>$tmp/config.h
+ rm -f $tmp/in
+ if test x"$ac_file" != x-; then
+ if diff $ac_file $tmp/config.h >/dev/null 2>&1; then
+ { echo "$as_me:$LINENO: $ac_file is unchanged" >&5
+echo "$as_me: $ac_file is unchanged" >&6;}
+ else
+ ac_dir=`(dirname "$ac_file") 2>/dev/null ||
+$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$ac_file" : 'X\(//\)[^/]' \| \
+ X"$ac_file" : 'X\(//\)$' \| \
+ X"$ac_file" : 'X\(/\)' \| \
+ . : '\(.\)' 2>/dev/null ||
+echo X"$ac_file" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+ /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+ /^X\(\/\/\)$/{ s//\1/; q; }
+ /^X\(\/\).*/{ s//\1/; q; }
+ s/.*/./; q'`
+ { if $as_mkdir_p; then
+ mkdir -p "$ac_dir"
+ else
+ as_dir="$ac_dir"
+ as_dirs=
+ while test ! -d "$as_dir"; do
+ as_dirs="$as_dir $as_dirs"
+ as_dir=`(dirname "$as_dir") 2>/dev/null ||
+$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$as_dir" : 'X\(//\)[^/]' \| \
+ X"$as_dir" : 'X\(//\)$' \| \
+ X"$as_dir" : 'X\(/\)' \| \
+ . : '\(.\)' 2>/dev/null ||
+echo X"$as_dir" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+ /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+ /^X\(\/\/\)$/{ s//\1/; q; }
+ /^X\(\/\).*/{ s//\1/; q; }
+ s/.*/./; q'`
+ done
+ test ! -n "$as_dirs" || mkdir $as_dirs
+ fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5
+echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;}
+ { (exit 1); exit 1; }; }; }
+
+ rm -f $ac_file
+ mv $tmp/config.h $ac_file
fi
- rm -f $ac_file
- mv conftest.h $ac_file
+ else
+ cat $tmp/config.h
+ rm -f $tmp/config.h
+ fi
+# Compute $ac_file's index in $config_headers.
+_am_stamp_count=1
+for _am_header in $config_headers :; do
+ case $_am_header in
+ $ac_file | $ac_file:* )
+ break ;;
+ * )
+ _am_stamp_count=`expr $_am_stamp_count + 1` ;;
+ esac
+done
+echo "timestamp for $ac_file" >`(dirname $ac_file) 2>/dev/null ||
+$as_expr X$ac_file : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X$ac_file : 'X\(//\)[^/]' \| \
+ X$ac_file : 'X\(//\)$' \| \
+ X$ac_file : 'X\(/\)' \| \
+ . : '\(.\)' 2>/dev/null ||
+echo X$ac_file |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+ /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+ /^X\(\/\/\)$/{ s//\1/; q; }
+ /^X\(\/\).*/{ s//\1/; q; }
+ s/.*/./; q'`/stamp-h$_am_stamp_count
+done
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF
+
+#
+# CONFIG_COMMANDS section.
+#
+for ac_file in : $CONFIG_COMMANDS; do test "x$ac_file" = x: && continue
+ ac_dest=`echo "$ac_file" | sed 's,:.*,,'`
+ ac_source=`echo "$ac_file" | sed 's,[^:]*:,,'`
+ ac_dir=`(dirname "$ac_dest") 2>/dev/null ||
+$as_expr X"$ac_dest" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$ac_dest" : 'X\(//\)[^/]' \| \
+ X"$ac_dest" : 'X\(//\)$' \| \
+ X"$ac_dest" : 'X\(/\)' \| \
+ . : '\(.\)' 2>/dev/null ||
+echo X"$ac_dest" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+ /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+ /^X\(\/\/\)$/{ s//\1/; q; }
+ /^X\(\/\).*/{ s//\1/; q; }
+ s/.*/./; q'`
+ { if $as_mkdir_p; then
+ mkdir -p "$ac_dir"
+ else
+ as_dir="$ac_dir"
+ as_dirs=
+ while test ! -d "$as_dir"; do
+ as_dirs="$as_dir $as_dirs"
+ as_dir=`(dirname "$as_dir") 2>/dev/null ||
+$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$as_dir" : 'X\(//\)[^/]' \| \
+ X"$as_dir" : 'X\(//\)$' \| \
+ X"$as_dir" : 'X\(/\)' \| \
+ . : '\(.\)' 2>/dev/null ||
+echo X"$as_dir" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+ /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+ /^X\(\/\/\)$/{ s//\1/; q; }
+ /^X\(\/\).*/{ s//\1/; q; }
+ s/.*/./; q'`
+ done
+ test ! -n "$as_dirs" || mkdir $as_dirs
+ fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5
+echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;}
+ { (exit 1); exit 1; }; }; }
+
+ ac_builddir=.
+
+if test "$ac_dir" != .; then
+ ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'`
+ # A "../" for each directory in $ac_dir_suffix.
+ ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'`
+else
+ ac_dir_suffix= ac_top_builddir=
+fi
+
+case $srcdir in
+ .) # No --srcdir option. We are building in place.
+ ac_srcdir=.
+ if test -z "$ac_top_builddir"; then
+ ac_top_srcdir=.
+ else
+ ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'`
+ fi ;;
+ [\\/]* | ?:[\\/]* ) # Absolute path.
+ ac_srcdir=$srcdir$ac_dir_suffix;
+ ac_top_srcdir=$srcdir ;;
+ *) # Relative path.
+ ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix
+ ac_top_srcdir=$ac_top_builddir$srcdir ;;
+esac
+
+# Do not use `cd foo && pwd` to compute absolute paths, because
+# the directories may not exist.
+case `pwd` in
+.) ac_abs_builddir="$ac_dir";;
+*)
+ case "$ac_dir" in
+ .) ac_abs_builddir=`pwd`;;
+ [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";;
+ *) ac_abs_builddir=`pwd`/"$ac_dir";;
+ esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_top_builddir=${ac_top_builddir}.;;
+*)
+ case ${ac_top_builddir}. in
+ .) ac_abs_top_builddir=$ac_abs_builddir;;
+ [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;;
+ *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;;
+ esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_srcdir=$ac_srcdir;;
+*)
+ case $ac_srcdir in
+ .) ac_abs_srcdir=$ac_abs_builddir;;
+ [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;;
+ *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;;
+ esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_top_srcdir=$ac_top_srcdir;;
+*)
+ case $ac_top_srcdir in
+ .) ac_abs_top_srcdir=$ac_abs_builddir;;
+ [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;;
+ *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;;
+ esac;;
+esac
+
+
+ { echo "$as_me:$LINENO: executing $ac_dest commands" >&5
+echo "$as_me: executing $ac_dest commands" >&6;}
+ case $ac_dest in
+ depfiles ) test x"$AMDEP_TRUE" != x"" || for mf in $CONFIG_FILES; do
+ # Strip MF so we end up with the name of the file.
+ mf=`echo "$mf" | sed -e 's/:.*$//'`
+ # Check whether this is an Automake generated Makefile or not.
+ # We used to match only the files named `Makefile.in', but
+ # some people rename them; so instead we look at the file content.
+ # Grep'ing the first line is not enough: some people post-process
+ # each Makefile.in and add a new line on top of each file to say so.
+ # So let's grep whole file.
+ if grep '^#.*generated by automake' $mf > /dev/null 2>&1; then
+ dirpart=`(dirname "$mf") 2>/dev/null ||
+$as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$mf" : 'X\(//\)[^/]' \| \
+ X"$mf" : 'X\(//\)$' \| \
+ X"$mf" : 'X\(/\)' \| \
+ . : '\(.\)' 2>/dev/null ||
+echo X"$mf" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+ /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+ /^X\(\/\/\)$/{ s//\1/; q; }
+ /^X\(\/\).*/{ s//\1/; q; }
+ s/.*/./; q'`
+ else
+ continue
fi
-fi; done
+ # Extract the definition of DEPDIR, am__include, and am__quote
+ # from the Makefile without running `make'.
+ DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
+ test -z "$DEPDIR" && continue
+ am__include=`sed -n 's/^am__include = //p' < "$mf"`
+ test -z "am__include" && continue
+ am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
+ # When using ansi2knr, U may be empty or an underscore; expand it
+ U=`sed -n 's/^U = //p' < "$mf"`
+ # Find all dependency output files, they are included files with
+ # $(DEPDIR) in their names. We invoke sed twice because it is the
+ # simplest approach to changing $(DEPDIR) to its actual value in the
+ # expansion.
+ for file in `sed -n "
+ s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
+ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
+ # Make sure the directory exists.
+ test -f "$dirpart/$file" && continue
+ fdir=`(dirname "$file") 2>/dev/null ||
+$as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$file" : 'X\(//\)[^/]' \| \
+ X"$file" : 'X\(//\)$' \| \
+ X"$file" : 'X\(/\)' \| \
+ . : '\(.\)' 2>/dev/null ||
+echo X"$file" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+ /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+ /^X\(\/\/\)$/{ s//\1/; q; }
+ /^X\(\/\).*/{ s//\1/; q; }
+ s/.*/./; q'`
+ { if $as_mkdir_p; then
+ mkdir -p $dirpart/$fdir
+ else
+ as_dir=$dirpart/$fdir
+ as_dirs=
+ while test ! -d "$as_dir"; do
+ as_dirs="$as_dir $as_dirs"
+ as_dir=`(dirname "$as_dir") 2>/dev/null ||
+$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$as_dir" : 'X\(//\)[^/]' \| \
+ X"$as_dir" : 'X\(//\)$' \| \
+ X"$as_dir" : 'X\(/\)' \| \
+ . : '\(.\)' 2>/dev/null ||
+echo X"$as_dir" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+ /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+ /^X\(\/\/\)$/{ s//\1/; q; }
+ /^X\(\/\).*/{ s//\1/; q; }
+ s/.*/./; q'`
+ done
+ test ! -n "$as_dirs" || mkdir $as_dirs
+ fi || { { echo "$as_me:$LINENO: error: cannot create directory $dirpart/$fdir" >&5
+echo "$as_me: error: cannot create directory $dirpart/$fdir" >&2;}
+ { (exit 1); exit 1; }; }; }
+
+ # echo "creating $dirpart/$file"
+ echo '# dummy' > "$dirpart/$file"
+ done
+done
+ ;;
+ libtool )
+
+ # See if we are running on zsh, and set the options which allow our
+ # commands through without removal of \ escapes.
+ if test -n "${ZSH_VERSION+set}" ; then
+ setopt NO_GLOB_SUBST
+ fi
+
+ cfgfile="${ofile}T"
+ trap "$RM \"$cfgfile\"; exit 1" 1 2 15
+ $RM "$cfgfile"
+
+ cat <<_LT_EOF >> "$cfgfile"
+#! $SHELL
+
+# `$ECHO "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services.
+# Generated automatically by $as_me (GNU $PACKAGE$TIMESTAMP) $VERSION
+# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
+# NOTE: Changes made to this file will be lost: look at ltmain.sh.
+#
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005,
+# 2006, 2007 Free Software Foundation, Inc.
+#
+# This file is part of GNU Libtool:
+# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
+#
+# 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, a copy can be downloaded from
+# http://www.gnu.org/copyleft/gpl.html, or by writing to the Free
+# Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+# MA 02110-1301, USA.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+
+# The names of the tagged configurations supported by this script.
+available_tags=""
+
+# ### BEGIN LIBTOOL CONFIG
+
+# Whether or not to build shared libraries.
+build_libtool_libs=$enable_shared
+
+# Which release of libtool.m4 was used?
+macro_version=$macro_version
+macro_revision=$macro_revision
+
+# Whether or not to build static libraries.
+build_old_libs=$enable_static
+
+# What type of objects to build.
+pic_mode=$pic_mode
+
+# Whether or not to optimize for fast installation.
+fast_install=$enable_fast_install
+
+# The host system.
+host_alias=$host_alias
+host=$host
+host_os=$host_os
+
+# The build system.
+build_alias=$build_alias
+build=$build
+build_os=$build_os
+
+# A sed program that does not truncate output.
+SED=$lt_SED
+
+# Sed that helps us avoid accidentally triggering echo(1) options like -n.
+Xsed="\$SED -e 1s/^X//"
+
+# A grep program that handles long lines.
+GREP=$lt_GREP
+
+# An ERE matcher.
+EGREP=$lt_EGREP
+
+# A literal string matcher.
+FGREP=$lt_FGREP
+
+# A BSD- or MS-compatible name lister.
+NM=$lt_NM
+
+# Whether we need soft or hard links.
+LN_S=$lt_LN_S
+
+# What is the maximum length of a command?
+max_cmd_len=$max_cmd_len
+
+# Object file suffix (normally "o").
+objext=$ac_objext
+
+# Executable file suffix (normally "").
+exeext=$exeext
+
+# whether the shell understands "unset".
+lt_unset=$lt_unset
+
+# turn spaces into newlines.
+SP2NL=$lt_lt_SP2NL
+
+# turn newlines into spaces.
+NL2SP=$lt_lt_NL2SP
+
+# How to create reloadable object files.
+reload_flag=$lt_reload_flag
+reload_cmds=$lt_reload_cmds
+
+# Method to check whether dependent libraries are shared objects.
+deplibs_check_method=$lt_deplibs_check_method
+
+# Command to use when deplibs_check_method == "file_magic".
+file_magic_cmd=$lt_file_magic_cmd
+
+# The archiver.
+AR=$lt_AR
+AR_FLAGS=$lt_AR_FLAGS
+
+# A symbol stripping program.
+STRIP=$lt_STRIP
+
+# Commands used to install an old-style archive.
+RANLIB=$lt_RANLIB
+old_postinstall_cmds=$lt_old_postinstall_cmds
+old_postuninstall_cmds=$lt_old_postuninstall_cmds
+
+# A C compiler.
+LTCC=$lt_CC
+
+# LTCC compiler flags.
+LTCFLAGS=$lt_CFLAGS
+
+# Take the output of nm and produce a listing of raw symbols and C names.
+global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe
+
+# Transform the output of nm in a proper C declaration.
+global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl
+
+# Transform the output of nm in a C name address pair.
+global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address
+
+# The name of the directory that contains temporary libtool files.
+objdir=$objdir
+
+# Shell to use when invoking shell scripts.
+SHELL=$lt_SHELL
+
+# An echo program that does not interpret backslashes.
+ECHO=$lt_ECHO
+
+# Used to examine libraries when file_magic_cmd begins with "file".
+MAGIC_CMD=$MAGIC_CMD
+# Must we lock files when doing compilation?
+need_locks=$lt_need_locks
+
+# Old archive suffix (normally "a").
+libext=$libext
+
+# Shared library suffix (normally ".so").
+shrext_cmds=$lt_shrext_cmds
+
+# The commands to extract the exported symbol list from a shared archive.
+extract_expsyms_cmds=$lt_extract_expsyms_cmds
+
+# Variables whose values should be saved in libtool wrapper scripts and
+# restored at link time.
+variables_saved_for_relink=$lt_variables_saved_for_relink
+
+# Do we need the "lib" prefix for modules?
+need_lib_prefix=$need_lib_prefix
+
+# Do we need a version for libraries?
+need_version=$need_version
+
+# Library versioning type.
+version_type=$version_type
+
+# Shared library runtime path variable.
+runpath_var=$runpath_var
+
+# Shared library path variable.
+shlibpath_var=$shlibpath_var
+
+# Is shlibpath searched before the hard-coded library search path?
+shlibpath_overrides_runpath=$shlibpath_overrides_runpath
+
+# Format of library name prefix.
+libname_spec=$lt_libname_spec
+
+# List of archive names. First name is the real one, the rest are links.
+# The last name is the one that the linker finds with -lNAME
+library_names_spec=$lt_library_names_spec
+
+# The coded name of the library, if different from the real name.
+soname_spec=$lt_soname_spec
+
+# Command to use after installation of a shared archive.
+postinstall_cmds=$lt_postinstall_cmds
+
+# Command to use after uninstallation of a shared archive.
+postuninstall_cmds=$lt_postuninstall_cmds
+
+# Commands used to finish a libtool library installation in a directory.
+finish_cmds=$lt_finish_cmds
+
+# As "finish_cmds", except a single script fragment to be evaled but
+# not shown.
+finish_eval=$lt_finish_eval
+
+# Whether we should hardcode library paths into libraries.
+hardcode_into_libs=$hardcode_into_libs
+
+# Compile-time system search path for libraries.
+sys_lib_search_path_spec=$lt_sys_lib_search_path_spec
+
+# Run-time system search path for libraries.
+sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec
+
+# Whether dlopen is supported.
+dlopen_support=$enable_dlopen
+
+# Whether dlopen of programs is supported.
+dlopen_self=$enable_dlopen_self
+
+# Whether dlopen of statically linked programs is supported.
+dlopen_self_static=$enable_dlopen_self_static
+
+# Commands to strip libraries.
+old_striplib=$lt_old_striplib
+striplib=$lt_striplib
+
+
+# The linker used to build libraries.
+LD=$lt_LD
+
+# Commands used to build an old-style archive.
+old_archive_cmds=$lt_old_archive_cmds
+
+# A language specific compiler.
+CC=$lt_compiler
+
+# Is the compiler the GNU compiler?
+with_gcc=$GCC
+
+# Compiler flag to turn off builtin functions.
+no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag
+
+# How to pass a linker flag through the compiler.
+wl=$lt_lt_prog_compiler_wl
+
+# Additional compiler flags for building library objects.
+pic_flag=$lt_lt_prog_compiler_pic
+
+# Compiler flag to prevent dynamic linking.
+link_static_flag=$lt_lt_prog_compiler_static
+
+# Does compiler simultaneously support -c and -o options?
+compiler_c_o=$lt_lt_cv_prog_compiler_c_o
+
+# Whether or not to add -lc for building shared libraries.
+build_libtool_need_lc=$archive_cmds_need_lc
+
+# Whether or not to disallow shared libs when runtime libs are static.
+allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes
+
+# Compiler flag to allow reflexive dlopens.
+export_dynamic_flag_spec=$lt_export_dynamic_flag_spec
+
+# Compiler flag to generate shared objects directly from archives.
+whole_archive_flag_spec=$lt_whole_archive_flag_spec
+
+# Whether the compiler copes with passing no objects directly.
+compiler_needs_object=$lt_compiler_needs_object
+
+# Create an old-style archive from a shared archive.
+old_archive_from_new_cmds=$lt_old_archive_from_new_cmds
+
+# Create a temporary old-style archive to link instead of a shared archive.
+old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds
+
+# Commands used to build a shared archive.
+archive_cmds=$lt_archive_cmds
+archive_expsym_cmds=$lt_archive_expsym_cmds
+
+# Commands used to build a loadable module if different from building
+# a shared archive.
+module_cmds=$lt_module_cmds
+module_expsym_cmds=$lt_module_expsym_cmds
+
+# Whether we are building with GNU ld or not.
+with_gnu_ld=$lt_with_gnu_ld
+
+# Flag that allows shared libraries with undefined symbols to be built.
+allow_undefined_flag=$lt_allow_undefined_flag
+
+# Flag that enforces no undefined symbols.
+no_undefined_flag=$lt_no_undefined_flag
+
+# Flag to hardcode \$libdir into a binary during linking.
+# This must work even if \$libdir does not exist
+hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec
+
+# If ld is used when linking, flag to hardcode \$libdir into a binary
+# during linking. This must work even if \$libdir does not exist.
+hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld
+
+# Whether we need a single "-rpath" flag with a separated argument.
+hardcode_libdir_separator=$lt_hardcode_libdir_separator
+
+# Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes
+# DIR into the resulting binary.
+hardcode_direct=$hardcode_direct
+
+# Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes
+# DIR into the resulting binary and the resulting library dependency is
+# "absolute",i.e impossible to change by setting \${shlibpath_var} if the
+# library is relocated.
+hardcode_direct_absolute=$hardcode_direct_absolute
+
+# Set to "yes" if using the -LDIR flag during linking hardcodes DIR
+# into the resulting binary.
+hardcode_minus_L=$hardcode_minus_L
+
+# Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR
+# into the resulting binary.
+hardcode_shlibpath_var=$hardcode_shlibpath_var
+
+# Set to "yes" if building a shared library automatically hardcodes DIR
+# into the library and all subsequent libraries and executables linked
+# against it.
+hardcode_automatic=$hardcode_automatic
+
+# Set to yes if linker adds runtime paths of dependent libraries
+# to runtime path list.
+inherit_rpath=$inherit_rpath
+
+# Whether libtool must link a program against all its dependency libraries.
+link_all_deplibs=$link_all_deplibs
+
+# Fix the shell variable \$srcfile for the compiler.
+fix_srcfile_path=$lt_fix_srcfile_path
+
+# Set to "yes" if exported symbols are required.
+always_export_symbols=$always_export_symbols
+
+# The commands to list exported symbols.
+export_symbols_cmds=$lt_export_symbols_cmds
+
+# Symbols that should not be listed in the preloaded symbols.
+exclude_expsyms=$lt_exclude_expsyms
+
+# Symbols that must always be exported.
+include_expsyms=$lt_include_expsyms
+
+# Commands necessary for linking programs (against libraries) with templates.
+prelink_cmds=$lt_prelink_cmds
+
+# Specify filename containing input files.
+file_list_spec=$lt_file_list_spec
+
+# How to hardcode a shared library path into an executable.
+hardcode_action=$hardcode_action
+
+# ### END LIBTOOL CONFIG
+
+_LT_EOF
+
+ case $host_os in
+ aix3*)
+ cat <<\_LT_EOF >> "$cfgfile"
+# AIX sometimes has problems with the GCC collect2 program. For some
+# reason, if we set the COLLECT_NAMES environment variable, the problems
+# vanish in a puff of smoke.
+if test "X${COLLECT_NAMES+set}" != Xset; then
+ COLLECT_NAMES=
+ export COLLECT_NAMES
+fi
+_LT_EOF
+ ;;
+ esac
+
+
+ltmain="$ac_aux_dir/ltmain.sh"
+
+
+ # We use sed instead of cat because bash on DJGPP gets confused if
+ # if finds mixed CR/LF and LF-only lines. Since sed operates in
+ # text mode, it properly converts lines to CR/LF. This bash problem
+ # is reportedly fixed, but why not run on old versions too?
+ sed '/^# Generated shell functions inserted here/q' "$ltmain" >> "$cfgfile" \
+ || (rm -f "$cfgfile"; exit 1)
+
+ case $xsi_shell in
+ yes)
+ cat << \_LT_EOF >> "$cfgfile"
+# func_dirname file append nondir_replacement
+# Compute the dirname of FILE. If nonempty, add APPEND to the result,
+# otherwise set result to NONDIR_REPLACEMENT.
+func_dirname ()
+{
+ case ${1} in
+ */*) func_dirname_result="${1%/*}${2}" ;;
+ * ) func_dirname_result="${3}" ;;
+ esac
+}
+
+# func_basename file
+func_basename ()
+{
+ func_basename_result="${1##*/}"
+}
+
+# func_stripname prefix suffix name
+# strip PREFIX and SUFFIX off of NAME.
+# PREFIX and SUFFIX must not contain globbing or regex special
+# characters, hashes, percent signs, but SUFFIX may contain a leading
+# dot (in which case that matches only a dot).
+func_stripname ()
+{
+ # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are
+ # positional parameters, so assign one to ordinary parameter first.
+ func_stripname_result=${3}
+ func_stripname_result=${func_stripname_result#"${1}"}
+ func_stripname_result=${func_stripname_result%"${2}"}
+}
+
+# func_opt_split
+func_opt_split ()
+{
+ func_opt_split_opt=${1%%=*}
+ func_opt_split_arg=${1#*=}
+}
+
+# func_lo2o object
+func_lo2o ()
+{
+ case ${1} in
+ *.lo) func_lo2o_result=${1%.lo}.${objext} ;;
+ *) func_lo2o_result=${1} ;;
+ esac
+}
+_LT_EOF
+ ;;
+ *) # Bourne compatible functions.
+ cat << \_LT_EOF >> "$cfgfile"
+# func_dirname file append nondir_replacement
+# Compute the dirname of FILE. If nonempty, add APPEND to the result,
+# otherwise set result to NONDIR_REPLACEMENT.
+func_dirname ()
+{
+ # Extract subdirectory from the argument.
+ func_dirname_result=`$ECHO "X${1}" | $Xsed -e "$dirname"`
+ if test "X$func_dirname_result" = "X${1}"; then
+ func_dirname_result="${3}"
+ else
+ func_dirname_result="$func_dirname_result${2}"
+ fi
+}
+
+# func_basename file
+func_basename ()
+{
+ func_basename_result=`$ECHO "X${1}" | $Xsed -e "$basename"`
+}
+
+# func_stripname prefix suffix name
+# strip PREFIX and SUFFIX off of NAME.
+# PREFIX and SUFFIX must not contain globbing or regex special
+# characters, hashes, percent signs, but SUFFIX may contain a leading
+# dot (in which case that matches only a dot).
+# func_strip_suffix prefix name
+func_stripname ()
+{
+ case ${2} in
+ .*) func_stripname_result=`$ECHO "X${3}" \
+ | $Xsed -e "s%^${1}%%" -e "s%\\\\${2}\$%%"`;;
+ *) func_stripname_result=`$ECHO "X${3}" \
+ | $Xsed -e "s%^${1}%%" -e "s%${2}\$%%"`;;
+ esac
+}
+
+# sed scripts:
+my_sed_long_opt='1s/^\(-[^=]*\)=.*/\1/;q'
+my_sed_long_arg='1s/^-[^=]*=//'
+
+# func_opt_split
+func_opt_split ()
+{
+ func_opt_split_opt=`$ECHO "X${1}" | $Xsed -e "$my_sed_long_opt"`
+ func_opt_split_arg=`$ECHO "X${1}" | $Xsed -e "$my_sed_long_arg"`
+}
+
+# func_lo2o object
+func_lo2o ()
+{
+ func_lo2o_result=`$ECHO "X${1}" | $Xsed -e "$lo2o"`
+}
+_LT_EOF
+esac
+
+case $lt_shell_append in
+ yes)
+ cat << \_LT_EOF >> "$cfgfile"
+
+# func_append var value
+# Append VALUE to the end of shell variable VAR.
+func_append ()
+{
+ eval "$1+=\$2"
+}
+_LT_EOF
+ ;;
+ *)
+ cat << \_LT_EOF >> "$cfgfile"
+
+# func_append var value
+# Append VALUE to the end of shell variable VAR.
+func_append ()
+{
+ eval "$1=\$$1\$2"
+}
+_LT_EOF
+ ;;
+ esac
+
+
+ sed -n '/^# Generated shell functions inserted here/,$p' "$ltmain" >> "$cfgfile" \
+ || (rm -f "$cfgfile"; exit 1)
+
+ mv -f "$cfgfile" "$ofile" ||
+ (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile")
+ chmod +x "$ofile"
+
+ ;;
+ default-1 )
+ for ac_file in $CONFIG_FILES; do
+ # Support "outfile[:infile[:infile...]]"
+ case "$ac_file" in
+ *:*) ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
+ esac
+ # PO directories have a Makefile.in generated from Makefile.in.in.
+ case "$ac_file" in */Makefile.in)
+ # Adjust a relative srcdir.
+ ac_dir=`echo "$ac_file"|sed 's%/[^/][^/]*$%%'`
+ ac_dir_suffix="/`echo "$ac_dir"|sed 's%^\./%%'`"
+ ac_dots=`echo "$ac_dir_suffix"|sed 's%/[^/]*%../%g'`
+ # In autoconf-2.13 it is called $ac_given_srcdir.
+ # In autoconf-2.50 it is called $srcdir.
+ test -n "$ac_given_srcdir" || ac_given_srcdir="$srcdir"
+ case "$ac_given_srcdir" in
+ .) top_srcdir=`echo $ac_dots|sed 's%/$%%'` ;;
+ /*) top_srcdir="$ac_given_srcdir" ;;
+ *) top_srcdir="$ac_dots$ac_given_srcdir" ;;
+ esac
+ if test -f "$ac_given_srcdir/$ac_dir/POTFILES.in"; then
+ rm -f "$ac_dir/POTFILES"
+ test -n "$as_me" && echo "$as_me: creating $ac_dir/POTFILES" || echo "creating $ac_dir/POTFILES"
+ cat "$ac_given_srcdir/$ac_dir/POTFILES.in" | sed -e "/^#/d" -e "/^[ ]*\$/d" -e "s,.*, $top_srcdir/& \\\\," | sed -e "\$s/\(.*\) \\\\/\1/" > "$ac_dir/POTFILES"
+ POMAKEFILEDEPS="POTFILES.in"
+ # ALL_LINGUAS, POFILES, GMOFILES, UPDATEPOFILES, DUMMYPOFILES depend
+ # on $ac_dir but don't depend on user-specified configuration
+ # parameters.
+ if test -f "$ac_given_srcdir/$ac_dir/LINGUAS"; then
+ # The LINGUAS file contains the set of available languages.
+ if test -n "$OBSOLETE_ALL_LINGUAS"; then
+ test -n "$as_me" && echo "$as_me: setting ALL_LINGUAS in configure.in is obsolete" || echo "setting ALL_LINGUAS in configure.in is obsolete"
+ fi
+ ALL_LINGUAS_=`sed -e "/^#/d" "$ac_given_srcdir/$ac_dir/LINGUAS"`
+ # Hide the ALL_LINGUAS assigment from automake.
+ eval 'ALL_LINGUAS''=$ALL_LINGUAS_'
+ POMAKEFILEDEPS="$POMAKEFILEDEPS LINGUAS"
+ else
+ # The set of available languages was given in configure.in.
+ eval 'ALL_LINGUAS''=$OBSOLETE_ALL_LINGUAS'
+ fi
+ case "$ac_given_srcdir" in
+ .) srcdirpre= ;;
+ *) srcdirpre='$(srcdir)/' ;;
+ esac
+ POFILES=
+ GMOFILES=
+ UPDATEPOFILES=
+ DUMMYPOFILES=
+ for lang in $ALL_LINGUAS; do
+ POFILES="$POFILES $srcdirpre$lang.po"
+ GMOFILES="$GMOFILES $srcdirpre$lang.gmo"
+ UPDATEPOFILES="$UPDATEPOFILES $lang.po-update"
+ DUMMYPOFILES="$DUMMYPOFILES $lang.nop"
+ done
+ # CATALOGS depends on both $ac_dir and the user's LINGUAS
+ # environment variable.
+ INST_LINGUAS=
+ if test -n "$ALL_LINGUAS"; then
+ for presentlang in $ALL_LINGUAS; do
+ useit=no
+ if test "%UNSET%" != "$LINGUAS"; then
+ desiredlanguages="$LINGUAS"
+ else
+ desiredlanguages="$ALL_LINGUAS"
+ fi
+ for desiredlang in $desiredlanguages; do
+ # Use the presentlang catalog if desiredlang is
+ # a. equal to presentlang, or
+ # b. a variant of presentlang (because in this case,
+ # presentlang can be used as a fallback for messages
+ # which are not translated in the desiredlang catalog).
+ case "$desiredlang" in
+ "$presentlang"*) useit=yes;;
+ esac
+ done
+ if test $useit = yes; then
+ INST_LINGUAS="$INST_LINGUAS $presentlang"
+ fi
+ done
+ fi
+ CATALOGS=
+ if test -n "$INST_LINGUAS"; then
+ for lang in $INST_LINGUAS; do
+ CATALOGS="$CATALOGS $lang.gmo"
+ done
+ fi
+ test -n "$as_me" && echo "$as_me: creating $ac_dir/Makefile" || echo "creating $ac_dir/Makefile"
+ sed -e "/^POTFILES =/r $ac_dir/POTFILES" -e "/^# Makevars/r $ac_given_srcdir/$ac_dir/Makevars" -e "s|@POFILES@|$POFILES|g" -e "s|@GMOFILES@|$GMOFILES|g" -e "s|@UPDATEPOFILES@|$UPDATEPOFILES|g" -e "s|@DUMMYPOFILES@|$DUMMYPOFILES|g" -e "s|@CATALOGS@|$CATALOGS|g" -e "s|@POMAKEFILEDEPS@|$POMAKEFILEDEPS|g" "$ac_dir/Makefile.in" > "$ac_dir/Makefile"
+ for f in "$ac_given_srcdir/$ac_dir"/Rules-*; do
+ if test -f "$f"; then
+ case "$f" in
+ *.orig | *.bak | *~) ;;
+ *) cat "$f" >> "$ac_dir/Makefile" ;;
+ esac
+ fi
+ done
+ fi
+ ;;
+ esac
+ done ;;
+ bfd_stdint.h )
+if test "$GCC" = yes; then
+ echo "/* generated for " `$CC --version | sed 1q` "*/" > tmp-stdint.h
+else
+ echo "/* generated for $CC */" > tmp-stdint.h
+fi
+
+sed 's/^ *//' >> tmp-stdint.h <<EOF
+
+ #ifndef GCC_GENERATED_STDINT_H
+ #define GCC_GENERATED_STDINT_H 1
+
+ #include <sys/types.h>
EOF
-cat >> $CONFIG_STATUS <<EOF
+if test "$acx_cv_header_stdint" != stdint.h; then
+ echo "#include <stddef.h>" >> tmp-stdint.h
+fi
+if test "$acx_cv_header_stdint" != stddef.h; then
+ echo "#include <$acx_cv_header_stdint>" >> tmp-stdint.h
+fi
+
+sed 's/^ *//' >> tmp-stdint.h <<EOF
+ /* glibc uses these symbols as guards to prevent redefinitions. */
+ #ifdef __int8_t_defined
+ #define _INT8_T
+ #define _INT16_T
+ #define _INT32_T
+ #endif
+ #ifdef __uint32_t_defined
+ #define _UINT32_T
+ #endif
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
+
+# ----------------- done header, emit basic int types -------------
+if test "$acx_cv_header_stdint" = stddef.h; then
+ sed 's/^ *//' >> tmp-stdint.h <<EOF
+
+ #ifndef _UINT8_T
+ #define _UINT8_T
+ #ifndef __uint8_t_defined
+ #define __uint8_t_defined
+ typedef unsigned $acx_cv_type_int8_t uint8_t;
+ #endif
+ #endif
+
+ #ifndef _UINT16_T
+ #define _UINT16_T
+ #ifndef __uint16_t_defined
+ #define __uint16_t_defined
+ typedef unsigned $acx_cv_type_int16_t uint16_t;
+ #endif
+ #endif
+
+ #ifndef _UINT32_T
+ #define _UINT32_T
+ #ifndef __uint32_t_defined
+ #define __uint32_t_defined
+ typedef unsigned $acx_cv_type_int32_t uint32_t;
+ #endif
+ #endif
+
+ #ifndef _INT8_T
+ #define _INT8_T
+ #ifndef __int8_t_defined
+ #define __int8_t_defined
+ typedef $acx_cv_type_int8_t int8_t;
+ #endif
+ #endif
+
+ #ifndef _INT16_T
+ #define _INT16_T
+ #ifndef __int16_t_defined
+ #define __int16_t_defined
+ typedef $acx_cv_type_int16_t int16_t;
+ #endif
+ #endif
+
+ #ifndef _INT32_T
+ #define _INT32_T
+ #ifndef __int32_t_defined
+ #define __int32_t_defined
+ typedef $acx_cv_type_int32_t int32_t;
+ #endif
+ #endif
+EOF
+elif test "$ac_cv_type_u_int32_t" = yes; then
+ sed 's/^ *//' >> tmp-stdint.h <<EOF
+
+ /* int8_t int16_t int32_t defined by inet code, we do the u_intXX types */
+ #ifndef _INT8_T
+ #define _INT8_T
+ #endif
+ #ifndef _INT16_T
+ #define _INT16_T
+ #endif
+ #ifndef _INT32_T
+ #define _INT32_T
+ #endif
+
+ #ifndef _UINT8_T
+ #define _UINT8_T
+ #ifndef __uint8_t_defined
+ #define __uint8_t_defined
+ typedef u_int8_t uint8_t;
+ #endif
+ #endif
+
+ #ifndef _UINT16_T
+ #define _UINT16_T
+ #ifndef __uint16_t_defined
+ #define __uint16_t_defined
+ typedef u_int16_t uint16_t;
+ #endif
+ #endif
+
+ #ifndef _UINT32_T
+ #define _UINT32_T
+ #ifndef __uint32_t_defined
+ #define __uint32_t_defined
+ typedef u_int32_t uint32_t;
+ #endif
+ #endif
+EOF
+else
+ sed 's/^ *//' >> tmp-stdint.h <<EOF
+
+ /* Some systems have guard macros to prevent redefinitions, define them. */
+ #ifndef _INT8_T
+ #define _INT8_T
+ #endif
+ #ifndef _INT16_T
+ #define _INT16_T
+ #endif
+ #ifndef _INT32_T
+ #define _INT32_T
+ #endif
+ #ifndef _UINT8_T
+ #define _UINT8_T
+ #endif
+ #ifndef _UINT16_T
+ #define _UINT16_T
+ #endif
+ #ifndef _UINT32_T
+ #define _UINT32_T
+ #endif
+EOF
+fi
+
+# ------------- done basic int types, emit int64_t types ------------
+if test "$ac_cv_type_uint64_t" = yes; then
+ sed 's/^ *//' >> tmp-stdint.h <<EOF
+
+ /* system headers have good uint64_t and int64_t */
+ #ifndef _INT64_T
+ #define _INT64_T
+ #endif
+ #ifndef _UINT64_T
+ #define _UINT64_T
+ #endif
+EOF
+elif test "$ac_cv_type_u_int64_t" = yes; then
+ sed 's/^ *//' >> tmp-stdint.h <<EOF
+
+ /* system headers have an u_int64_t (and int64_t) */
+ #ifndef _INT64_T
+ #define _INT64_T
+ #endif
+ #ifndef _UINT64_T
+ #define _UINT64_T
+ #ifndef __uint64_t_defined
+ #define __uint64_t_defined
+ typedef u_int64_t uint64_t;
+ #endif
+ #endif
EOF
+elif test -n "$acx_cv_type_int64_t"; then
+ sed 's/^ *//' >> tmp-stdint.h <<EOF
+
+ /* architecture has a 64-bit type, $acx_cv_type_int64_t */
+ #ifndef _INT64_T
+ #define _INT64_T
+ typedef $acx_cv_type_int64_t int64_t;
+ #endif
+ #ifndef _UINT64_T
+ #define _UINT64_T
+ #ifndef __uint64_t_defined
+ #define __uint64_t_defined
+ typedef unsigned $acx_cv_type_int64_t uint64_t;
+ #endif
+ #endif
+EOF
+else
+ sed 's/^ *//' >> tmp-stdint.h <<EOF
+
+ /* some common heuristics for int64_t, using compiler-specific tests */
+ #if defined __STDC_VERSION__ && (__STDC_VERSION__-0) >= 199901L
+ #ifndef _INT64_T
+ #define _INT64_T
+ #ifndef __int64_t_defined
+ typedef long long int64_t;
+ #endif
+ #endif
+ #ifndef _UINT64_T
+ #define _UINT64_T
+ typedef unsigned long long uint64_t;
+ #endif
+
+ #elif defined __GNUC__ && defined (__STDC__) && __STDC__-0
+ /* NextStep 2.0 cc is really gcc 1.93 but it defines __GNUC__ = 2 and
+ does not implement __extension__. But that compiler doesn't define
+ __GNUC_MINOR__. */
+ # if __GNUC__ < 2 || (__NeXT__ && !__GNUC_MINOR__)
+ # define __extension__
+ # endif
+
+ # ifndef _INT64_T
+ # define _INT64_T
+ __extension__ typedef long long int64_t;
+ # endif
+ # ifndef _UINT64_T
+ # define _UINT64_T
+ __extension__ typedef unsigned long long uint64_t;
+ # endif
+
+ #elif !defined __STRICT_ANSI__
+ # if defined _MSC_VER || defined __WATCOMC__ || defined __BORLANDC__
+
+ # ifndef _INT64_T
+ # define _INT64_T
+ typedef __int64 int64_t;
+ # endif
+ # ifndef _UINT64_T
+ # define _UINT64_T
+ typedef unsigned __int64 uint64_t;
+ # endif
+ # endif /* compiler */
+
+ #endif /* ANSI version */
+EOF
+fi
+
+# ------------- done int64_t types, emit intptr types ------------
+if test "$ac_cv_type_uintptr_t" != yes; then
+ sed 's/^ *//' >> tmp-stdint.h <<EOF
+
+ /* Define intptr_t based on sizeof(void*) = $ac_cv_sizeof_void_p */
+ #ifndef __uintptr_t_defined
+ typedef u$acx_cv_type_intptr_t uintptr_t;
+ #endif
+ #ifndef __intptr_t_defined
+ typedef $acx_cv_type_intptr_t intptr_t;
+ #endif
+EOF
+fi
+
+# ------------- done intptr types, emit int_least types ------------
+if test "$ac_cv_type_int_least32_t" != yes; then
+ sed 's/^ *//' >> tmp-stdint.h <<EOF
+
+ /* Define int_least types */
+ typedef int8_t int_least8_t;
+ typedef int16_t int_least16_t;
+ typedef int32_t int_least32_t;
+ #ifdef _INT64_T
+ typedef int64_t int_least64_t;
+ #endif
+
+ typedef uint8_t uint_least8_t;
+ typedef uint16_t uint_least16_t;
+ typedef uint32_t uint_least32_t;
+ #ifdef _UINT64_T
+ typedef uint64_t uint_least64_t;
+ #endif
+EOF
+fi
+
+# ------------- done intptr types, emit int_fast types ------------
+if test "$ac_cv_type_int_fast32_t" != yes; then
+ sed 's/^ *//' >> tmp-stdint.h <<EOF
+
+ /* Define int_fast types. short is often slow */
+ typedef int8_t int_fast8_t;
+ typedef int int_fast16_t;
+ typedef int32_t int_fast32_t;
+ #ifdef _INT64_T
+ typedef int64_t int_fast64_t;
+ #endif
+
+ typedef uint8_t uint_fast8_t;
+ typedef unsigned int uint_fast16_t;
+ typedef uint32_t uint_fast32_t;
+ #ifdef _UINT64_T
+ typedef uint64_t uint_fast64_t;
+ #endif
+EOF
+fi
+
+if test "$ac_cv_type_uintmax_t" != yes; then
+ sed 's/^ *//' >> tmp-stdint.h <<EOF
+
+ /* Define intmax based on what we found */
+ #ifdef _INT64_T
+ typedef int64_t intmax_t;
+ #else
+ typedef long intmax_t;
+ #endif
+ #ifdef _UINT64_T
+ typedef uint64_t uintmax_t;
+ #else
+ typedef unsigned long uintmax_t;
+ #endif
+EOF
+fi
+
+sed 's/^ *//' >> tmp-stdint.h <<EOF
+
+ #endif /* GCC_GENERATED_STDINT_H */
+EOF
+
+if test -r bfd_stdint.h && cmp -s tmp-stdint.h bfd_stdint.h; then
+ rm -f tmp-stdint.h
+else
+ mv -f tmp-stdint.h bfd_stdint.h
+fi
+
+ ;;
+ default )
+case "$srcdir" in
+ .) srcdirpre= ;;
+ *) srcdirpre='$(srcdir)/' ;;
+esac
+POFILES=
+GMOFILES=
+for lang in dummy $OBSOLETE_ALL_LINGUAS; do
+ if test $lang != dummy; then
+ POFILES="$POFILES $srcdirpre$lang.po"
+ GMOFILES="$GMOFILES $srcdirpre$lang.gmo"
+ fi
+done
+sed -e '/SRC-POTFILES =/r po/SRC-POTFILES' \
+ -e '/BLD-POTFILES =/r po/BLD-POTFILES' \
+ -e "s,@POFILES@,$POFILES," \
+ -e "s,@GMOFILES@,$GMOFILES," \
+ po/Makefile.in > po/Makefile ;;
+ esac
+done
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+
+{ (exit 0); exit 0; }
+_ACEOF
chmod +x $CONFIG_STATUS
-rm -fr confdefs* $ac_clean_files
-test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1
+ac_clean_files=$ac_clean_files_save
+
+
+# configure is writing to config.log, and then calls config.status.
+# config.status does its own redirection, appending to config.log.
+# Unfortunately, on DOS this fails, as config.log is still kept open
+# by configure, so config.status won't be able to write to it; its
+# output is simply discarded. So we exec the FD to /dev/null,
+# effectively closing config.log, so it can be properly (re)opened and
+# appended to by config.status. When coming back to configure, we
+# need to make the FD available again.
+if test "$no_create" != yes; then
+ ac_cs_success=:
+ ac_config_status_args=
+ test "$silent" = yes &&
+ ac_config_status_args="$ac_config_status_args --quiet"
+ exec 5>/dev/null
+ $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false
+ exec 5>>config.log
+ # Use ||, not &&, to avoid exiting from the if with $? = 1, which
+ # would make configure fail if this is the last instruction.
+ $ac_cs_success || { (exit 1); exit 1; }
+fi
diff --git a/contrib/binutils/bfd/configure.host b/contrib/binutils/bfd/configure.host
index 024ed62..11b42e0 100644
--- a/contrib/binutils/bfd/configure.host
+++ b/contrib/binutils/bfd/configure.host
@@ -19,16 +19,20 @@ HOST_U_64BIT_TYPE=
case "${host}" in
-hppa*-*-hpux*) # HP/UX's ftello64 et.al. declarations are only
+hppa*64*-*-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" ;;
+ HDEFINES="-DHOST_HPPAHPUX -D_LARGEFILE64_SOURCE"
+ host64=true;;
+hppa*-*-hpux*) 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-*-hpux*) HDEFINES=-D_LARGEFILE64_SOURCE
+ host64=true;;
ia64-*-*) host64=true;;
# Workaround for limitations on win9x where file contents are
diff --git a/contrib/binutils/bfd/configure.in b/contrib/binutils/bfd/configure.in
index 837b753..1ea98ae 100644
--- a/contrib/binutils/bfd/configure.in
+++ b/contrib/binutils/bfd/configure.in
@@ -1,27 +1,14 @@
dnl Process this file with autoconf to produce a configure script.
dnl
-AC_PREREQ(2.13)
-AC_INIT(libbfd.c)
+AC_PREREQ(2.59)
+AC_INIT
+AC_CONFIG_SRCDIR([libbfd.c])
-AC_CANONICAL_SYSTEM
+AC_CANONICAL_TARGET
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)
+AM_INIT_AUTOMAKE(bfd, 2.17.50)
dnl These must be called before AM_PROG_LIBTOOL, because it may want
dnl to call AC_CHECK_PROG.
@@ -32,7 +19,10 @@ 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_PROG_CC
+AC_GNU_SOURCE
+
+AC_PROG_LIBTOOL
AC_ARG_ENABLE(64-bit-bfd,
[ --enable-64-bit-bfd 64-bit support (on hosts with narrower word sizes)],
@@ -44,7 +34,7 @@ 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')
+ yes | "") AC_MSG_ERROR([enable-targets option must specify target names or 'all'])
;;
no) enable_targets= ;;
*) enable_targets=$enableval ;;
@@ -64,26 +54,30 @@ AC_ARG_WITH(mmap,
*) 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],
+AC_ARG_ENABLE(secureplt,
+[ --enable-secureplt Default to creating read-only plt entries],
[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}"
+ yes) use_secureplt=true ;;
+ no) use_secureplt=false ;;
+ *) AC_MSG_ERROR(bad value ${enableval} for secureplt option) ;;
+esac],[use_secureplt=false])dnl
+if test $use_secureplt = true; then
+ AC_DEFINE(USE_SECUREPLT, 1,
+ [Define if we should default to creating read-only plt entries])
fi
-AC_SUBST(WARN_CFLAGS)
+
+DEBUGDIR=${libdir}/debug
+
+AC_ARG_WITH(separate-debug-dir,
+ AS_HELP_STRING([--with-separate-debug-dir=DIR],
+ [Look for global separate debug info in DIR [[default=LIBDIR/debug]]]),
+[DEBUGDIR="${withval}"])
+AC_SUBST(DEBUGDIR)
+
+ACX_PKGVERSION([GNU Binutils])
+ACX_BUGURL([http://www.sourceware.org/bugzilla/])
+
+AM_BINUTILS_WARNINGS
AM_CONFIG_HEADER(config.h:config.in)
@@ -92,6 +86,7 @@ if test -z "$target" ; then
fi
AM_MAINTAINER_MODE
+AM_CONDITIONAL(GENINSRC_NEVER, false)
AM_INSTALL_LIBBFD
AC_EXEEXT
@@ -101,10 +96,9 @@ bfd_default_target_size=32
# host stuff:
-AC_PROG_CC
-
-ALL_LINGUAS="fr tr ja es sv da zh_CN ro"
-CY_GNU_GETTEXT
+ALL_LINGUAS="fr tr ja es sv da zh_CN ro rw vi"
+ZW_GNU_GETTEXT_SISTER_DIR
+AM_PO_SUBDIRS
# Permit host specific settings.
. ${srcdir}/configure.host
@@ -120,16 +114,14 @@ 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_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[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)
+ AC_CHECK_SIZEOF(long long)
fi
-AC_COMPILE_CHECK_SIZEOF(long)
+AC_CHECK_SIZEOF(long)
if test "x${ac_cv_sizeof_long}" = "x8"; then
host64=true
BFD_HOST_64BIT_LONG=1
@@ -156,18 +148,30 @@ 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)
+GCC_HEADER_STDINT(bfd_stdint.h)
AC_HEADER_TIME
AC_HEADER_DIRENT
+ACX_HEADER_STRING
AC_CHECK_FUNCS(fcntl getpagesize setitimer sysconf fdopen getuid getgid)
AC_CHECK_FUNCS(strtoull)
+AC_CHECK_DECLS(basename)
+AC_CHECK_DECLS(ftello)
+AC_CHECK_DECLS(ftello64)
+AC_CHECK_DECLS(fseeko)
+AC_CHECK_DECLS(fseeko64)
+
BFD_BINARY_FOPEN
-BFD_NEED_DECLARATION(strstr)
-BFD_NEED_DECLARATION(malloc)
-BFD_NEED_DECLARATION(realloc)
-BFD_NEED_DECLARATION(free)
-BFD_NEED_DECLARATION(getenv)
+AC_CHECK_DECLS(ffs)
+AC_CHECK_DECLS(free)
+AC_CHECK_DECLS(getenv)
+AC_CHECK_DECLS(malloc)
+AC_CHECK_DECLS(realloc)
+AC_CHECK_DECLS(stpcpy)
+AC_CHECK_DECLS(strstr)
+AC_CHECK_DECLS(snprintf)
+AC_CHECK_DECLS(vsnprintf)
# If we are configured native, pick a core file support file.
COREFILE=
@@ -178,7 +182,7 @@ if test "${target}" = "${host}"; then
alpha*-*-freebsd* | alpha*-*-kfreebsd*-gnu)
COREFILE=''
;;
- alpha*-*-linux-gnu*)
+ alpha*-*-linux-*)
COREFILE=trad-core.lo
TRAD_HEADER='"hosts/alphalinux.h"'
;;
@@ -188,13 +192,19 @@ if test "${target}" = "${host}"; then
alpha*-*-*) COREFILE=osf-core.lo ;;
arm-*-freebsd* | arm-*-kfreebsd*-gnu)
COREFILE='' ;;
- arm-*-netbsd*) COREFILE=netbsd-core.lo ;;
+ arm-*-netbsd* | arm-*-openbsd*)
+ 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" ;;
+ hppa*-*-netbsd* | hppa*-*-openbsd*)
+ COREFILE=netbsd-core.lo
+ ;;
+
i370-*-*)
COREFILE=trad-core.lo
TRAD_HEADER='"hosts/i370linux.h"'
@@ -219,7 +229,7 @@ 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*)
+ 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-*-freebsd4\.[01234]\.* | i[3-7]86-*-freebsd*aout*)
changequote([,])dnl
COREFILE=trad-core.lo
TRAD_HEADER='"hosts/i386bsd.h"'
@@ -259,7 +269,7 @@ changequote([,])dnl
TRAD_HEADER='"hosts/i386mach3.h"'
;;
changequote(,)dnl
- i[3-7]86-*-linux-gnu*)
+ i[3-7]86-*-linux-*)
changequote([,])dnl
COREFILE=trad-core.lo
TRAD_HEADER='"hosts/i386linux.h"'
@@ -300,7 +310,7 @@ changequote([,])dnl
COREFILE=trad-core.lo
TRAD_HEADER='"hosts/hp300bsd.h"'
;;
- m68*-*-linux-gnu*)
+ m68*-*-linux-*)
COREFILE=trad-core.lo
TRAD_HEADER='"hosts/m68klinux.h"'
;;
@@ -328,6 +338,9 @@ changequote([,])dnl
COREFILE=trad-core.lo
TRAD_HEADER='"hosts/m88kmach3.h"'
;;
+ m88*-*-openbsd*)
+ COREFILE=netbsd-core.lo
+ ;;
ns32k-pc532-mach)
COREFILE=trad-core.lo
TRAD_HEADER='"hosts/pc532mach.h"'
@@ -350,9 +363,7 @@ changequote([,])dnl
# 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,
+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#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)])
;;
@@ -366,7 +377,9 @@ changequote([,])dnl
powerpc-*-netbsd*) COREFILE=netbsd-core.lo ;;
powerpc-*-*bsd*) COREFILE=netbsd-core.lo ;;
s390*-*-*) COREFILE=trad-core.lo ;;
- sh*-*-netbsd*) COREFILE=netbsd-core.lo ;;
+ sh*-*-netbsd* | sh*-*-openbsd*)
+ COREFILE=netbsd-core.lo
+ ;;
sparc-*-netbsd* | sparc*-*-openbsd*)
COREFILE=netbsd-core.lo
;;
@@ -385,7 +398,7 @@ changequote([,])dnl
COREFILE=trad-core.lo
TRAD_HEADER='"hosts/vaxult2.h"'
;;
- vax-*-linux-gnu*)
+ vax-*-linux-*)
COREFILE=trad-core.lo
TRAD_HEADER='"hosts/vaxlinux.h"'
;;
@@ -556,7 +569,7 @@ selarchs="$f"
# Target backend .o files.
tb=
-elf="elf.lo elflink.lo elf-strtab.lo elf-eh-frame.lo dwarf1.lo"
+elf="elf.lo elflink.lo elf-attrs.lo elf-strtab.lo elf-eh-frame.lo dwarf1.lo"
for vec in $selvecs
do
@@ -565,7 +578,6 @@ do
# 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" ;;
@@ -576,6 +588,10 @@ do
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 " ;;
+ arm_wince_pe_big_vec) tb="$tb pe-arm-wince.lo pe-arm.lo peigen.lo cofflink.lo " ;;
+ arm_wince_pe_little_vec) tb="$tb pe-arm-wince.lo pe-arm.lo peigen.lo cofflink.lo " ;;
+ arm_wince_pei_big_vec) tb="$tb pei-arm-wince.lo pei-arm.lo peigen.lo cofflink.lo " ;;
+ arm_wince_pei_little_vec) tb="$tb pei-arm-wince.lo 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" ;;
@@ -586,15 +602,26 @@ do
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_x86_64_vec) tb="$tb efi-app-x86_64.lo pex64igen.lo cofflink.lo" ;target_size=64;;
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_bfin_vec) tb="$tb elf32-bfin.lo elf32.lo $elf" ;;
+ bfd_elf32_bfinfdpic_vec) tb="$tb elf32-bfin.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_bigarm_vec) tb="$tb elf32-arm.lo elf32.lo elf-vxworks.lo $elf" ;;
+ bfd_elf32_bigarm_symbian_vec)
+ tb="$tb elf32-arm.lo elf32.lo elf-vxworks.lo $elf" ;;
+ bfd_elf32_bigarm_vxworks_vec)
+ tb="$tb elf32-arm.lo elf32.lo elf-vxworks.lo $elf" ;;
+ bfd_elf32_bigmips_vec) tb="$tb elf32-mips.lo elfxx-mips.lo elf-vxworks.lo elf32.lo $elf ecofflink.lo" ;;
+ bfd_elf32_bigmips_vxworks_vec)
+ tb="$tb elf32-mips.lo elfxx-mips.lo elf-vxworks.lo elf32.lo $elf ecofflink.lo" ;;
+ bfd_elf32_cr16_vec) tb="$tb elf32-cr16.lo elf32.lo $elf" ;;
+ bfd_elf32_cr16c_vec) tb="$tb elf32-cr16c.lo elf32.lo $elf" ;;
bfd_elf32_cris_vec) tb="$tb elf32-cris.lo elf32.lo $elf" ;;
+ bfd_elf32_crx_vec) tb="$tb elf32-crx.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" ;;
@@ -603,10 +630,12 @@ do
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_nbsd_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_i386_freebsd_vec) tb="$tb elf32-i386.lo elf-vxworks.lo elf32.lo $elf" ;;
+ bfd_elf32_i386_vxworks_vec) tb="$tb elf32-i386.lo elf-vxworks.lo elf32.lo $elf" ;;
+ bfd_elf32_i386_vec) tb="$tb elf32-i386.lo elf-vxworks.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" ;;
@@ -616,9 +645,15 @@ do
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_littlearm_symbian_vec)
+ tb="$tb elf32-arm.lo elf32.lo elf-vxworks.lo $elf" ;;
+ bfd_elf32_littlearm_vxworks_vec)
+ tb="$tb elf32-arm.lo elf32.lo elf-vxworks.lo $elf" ;;
+ bfd_elf32_littlearm_vec) tb="$tb elf32-arm.lo elf32.lo elf-vxworks.lo $elf" ;;
+ bfd_elf32_littlemips_vec) tb="$tb elf32-mips.lo elfxx-mips.lo elf-vxworks.lo elf32.lo $elf ecofflink.lo" ;;
+ bfd_elf32_littlemips_vxworks_vec)
+ tb="$tb elf32-mips.lo elfxx-mips.lo elf-vxworks.lo elf32.lo $elf ecofflink.lo" ;;
+ bfd_elf32_m32c_vec) tb="$tb elf32-m32c.lo elf32.lo $elf" ;;
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" ;;
@@ -629,55 +664,67 @@ do
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_mep_vec) tb="$tb elf32-mep.lo elf32.lo $elf" ;;
+ bfd_elf32_mep_little_vec) tb="$tb elf32-mep.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_mt_vec) tb="$tb elf32-mt.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_nbigmips_vec) tb="$tb elfn32-mips.lo elfxx-mips.lo elf-vxworks.lo elf32.lo $elf ecofflink.lo"; target_size=64 ;;
+ bfd_elf32_nlittlemips_vec) tb="$tb elfn32-mips.lo elfxx-mips.lo elf-vxworks.lo elf32.lo $elf ecofflink.lo"; target_size=64 ;;
+ bfd_elf32_ntradbigmips_vec) tb="$tb elfn32-mips.lo elfxx-mips.lo elf-vxworks.lo elf32.lo $elf ecofflink.lo"; target_size=64 ;;
+ bfd_elf32_ntradlittlemips_vec) tb="$tb elfn32-mips.lo elfxx-mips.lo elf-vxworks.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_powerpc_vec) tb="$tb elf32-ppc.lo elf-vxworks.lo elf32.lo $elf" ;;
+ bfd_elf32_powerpcle_vec) tb="$tb elf32-ppc.lo elf-vxworks.lo elf32.lo $elf" ;;
+ bfd_elf32_powerpc_vxworks_vec) tb="$tb elf32-ppc.lo elf-vxworks.lo elf32.lo $elf" ;;
bfd_elf32_s390_vec) tb="$tb elf32-s390.lo elf32.lo $elf" ;;
+ bfd_elf32_bigscore_vec) tb="$tb elf32-score.lo elf32.lo $elf" ;;
+ bfd_elf32_littlescore_vec) tb="$tb elf32-score.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_sh64_vec) tb="$tb elf32-sh64.lo elf32-sh64-com.lo elf-vxworks.lo elf32.lo $elf cofflink.lo" target_size=64 ;;
+ bfd_elf32_sh64l_vec) tb="$tb elf32-sh64.lo elf32-sh64-com.lo elf-vxworks.lo elf32.lo $elf cofflink.lo" target_size=64 ;;
+ bfd_elf32_sh64lin_vec) tb="$tb elf32-sh64.lo elf32-sh64-com.lo elf-vxworks.lo elf32.lo $elf cofflink.lo" target_size=64 ;;
+ bfd_elf32_sh64blin_vec) tb="$tb elf32-sh64.lo elf32-sh64-com.lo elf-vxworks.lo elf32.lo $elf cofflink.lo" target_size=64 ;;
+ bfd_elf32_sh64lnbsd_vec) tb="$tb elf32-sh64.lo elf32-sh64-com.lo elf-vxworks.lo elf32.lo $elf cofflink.lo" ;;
+ bfd_elf32_sh64nbsd_vec) tb="$tb elf32-sh64.lo elf32-sh64-com.lo elf-vxworks.lo elf32.lo $elf cofflink.lo" ;;
+ bfd_elf32_sh_vec) tb="$tb elf32-sh.lo elf-vxworks.lo elf32.lo $elf coff-sh.lo" ;;
+ bfd_elf32_shblin_vec) tb="$tb elf32-sh.lo elf-vxworks.lo elf32.lo $elf coff-sh.lo cofflink.lo" ;;
+ bfd_elf32_shl_vec) tb="$tb elf32-sh.lo elf-vxworks.lo elf32.lo $elf coff-sh.lo" ;;
+ bfd_elf32_shl_symbian_vec) tb="$tb elf32-sh-symbian.lo elf32-sh64-com.lo elf-vxworks.lo elf32.lo $elf coff-sh.lo" ;;
+ bfd_elf32_shlin_vec) tb="$tb elf32-sh.lo elf-vxworks.lo elf32.lo $elf coff-sh.lo cofflink.lo" ;;
+ bfd_elf32_shlnbsd_vec) tb="$tb elf32-sh.lo elf-vxworks.lo elf32.lo $elf coff-sh.lo cofflink.lo" ;;
+ bfd_elf32_shlvxworks_vec) tb="$tb elf32-sh.lo elf-vxworks.lo elf32.lo $elf coff-sh.lo" ;;
+ bfd_elf32_shnbsd_vec) tb="$tb elf32-sh.lo elf-vxworks.lo elf32.lo $elf coff-sh.lo cofflink.lo" ;;
+ bfd_elf32_shvxworks_vec) tb="$tb elf32-sh.lo elf-vxworks.lo elf32.lo $elf coff-sh.lo" ;;
+ bfd_elf32_sparc_vec) tb="$tb elf32-sparc.lo elfxx-sparc.lo elf-vxworks.lo elf32.lo $elf" ;;
+ bfd_elf32_sparc_vxworks_vec) tb="$tb elf32-sparc.lo elfxx-sparc.lo elf-vxworks.lo elf32.lo $elf" ;;
+ bfd_elf32_spu_vec) tb="$tb elf32-spu.lo elf32.lo $elf" ;;
+ bfd_elf32_tradbigmips_vec) tb="$tb elf32-mips.lo elfxx-mips.lo elf-vxworks.lo elf32.lo $elf ecofflink.lo" ;;
+ bfd_elf32_tradlittlemips_vec) tb="$tb elf32-mips.lo elfxx-mips.lo elf-vxworks.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_xc16x_vec) tb="$tb elf32-xc16x.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_bigmips_vec) tb="$tb elf64-mips.lo elf64.lo elfxx-mips.lo elf-vxworks.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_littlemips_vec) tb="$tb elf64-mips.lo elf64.lo elfxx-mips.lo elf-vxworks.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 ;;
@@ -688,9 +735,11 @@ do
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_sparc_vec) tb="$tb elf64-sparc.lo elfxx-sparc.lo elf-vxworks.lo elf64.lo $elf"; target_size=64 ;;
+ bfd_elf64_sparc_freebsd_vec) tb="$tb elf64-sparc.lo elfxx-sparc.lo elf-vxworks.lo elf64.lo $elf"; target_size=64 ;;
+ bfd_elf64_tradbigmips_vec) tb="$tb elf64-mips.lo elf64.lo elfxx-mips.lo elf-vxworks.lo elf32.lo $elf ecofflink.lo"; target_size=64 ;;
+ bfd_elf64_tradlittlemips_vec) tb="$tb elf64-mips.lo elf64.lo elfxx-mips.lo elf-vxworks.lo elf32.lo $elf ecofflink.lo"; target_size=64 ;;
+ bfd_elf64_x86_64_freebsd_vec) tb="$tb elf64-x86-64.lo elf64.lo $elf"; 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" ;;
@@ -713,6 +762,7 @@ do
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" ;;
+ x86_64coff_vec) tb="$tb coff-x86_64.lo cofflink.lo"; target_size=64 ;;
i386dynix_vec) tb="$tb i386dynix.lo aout32.lo" ;;
i386freebsd_vec) tb="$tb i386freebsd.lo aout32.lo" ;;
i386linux_vec) tb="$tb i386linux.lo aout32.lo" ;;
@@ -724,6 +774,8 @@ do
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" ;;
+ x86_64pe_vec) tb="$tb pe-x86_64.lo pex64igen.lo cofflink.lo"; target_size=64 ;;
+ x86_64pei_vec) tb="$tb pei-x86_64.lo pex64igen.lo cofflink.lo"; target_size=64 ;;
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" ;;
@@ -733,12 +785,12 @@ do
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" ;;
+ m88kopenbsd_vec) tb="$tb m88kopenbsd.lo aout32.lo" ;;
+ maxqcoff_vec) tb="$tb coff-maxq.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" ;;
@@ -802,7 +854,8 @@ do
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" ;;
+ z80coff_vec) tb="$tb coff-z80.lo reloc16.lo" ;;
+ z8kcoff_vec) tb="$tb coff-z8k.lo reloc16.lo cofflink.lo" ;;
# These appear out of order in targets.c
srec_vec) tb="$tb srec.lo" ;;
@@ -873,7 +926,7 @@ fi # all_targets is true
case ${host64}-${target64}-${want64} in
*true*)
wordsize=64
- bfd_libs='$(BFD64_LIBS) $(BFD32_LIBS)'
+ bfd64_libs='$(BFD64_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])
@@ -888,19 +941,18 @@ case ${host64}-${target64}-${want64} in
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])
+ AC_MSG_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(bfd64_libs)
AC_SUBST(all_backends)
AC_SUBST(bfd_backends)
AC_SUBST(bfd_machines)
@@ -911,9 +963,9 @@ AC_SUBST(bfd_default_target_size)
# 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)
+AC_CHECK_FUNCS(ftello ftello64 fseeko fseeko64 fopen64)
if test x"$ac_cv_func_ftello" = xyes -a x"$ac_cv_func_fseeko" = xyes; then
- AC_COMPILE_CHECK_SIZEOF(off_t)
+ AC_CHECK_SIZEOF(off_t)
fi
AC_MSG_CHECKING([file_ptr type])
bfd_file_ptr="long"
@@ -944,6 +996,34 @@ case ${want_mmap}+${ac_cv_func_mmap_fixed_mapped} in
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])
+AC_CONFIG_FILES([Makefile doc/Makefile bfd-in3.h:bfd-in2.h po/Makefile.in:po/Make-in])
+
+dnl We need this duplication, even though we use AM_PO_SUBDIRS, because of
+dnl our two separate POTFILES. Yuck.
+AC_CONFIG_COMMANDS([default],
+[[
+case "$srcdir" in
+ .) srcdirpre= ;;
+ *) srcdirpre='$(srcdir)/' ;;
+esac
+POFILES=
+GMOFILES=
+for lang in dummy $OBSOLETE_ALL_LINGUAS; do
+ if test $lang != dummy; then
+ POFILES="$POFILES $srcdirpre$lang.po"
+ GMOFILES="$GMOFILES $srcdirpre$lang.gmo"
+ fi
+done
+sed -e '/SRC-POTFILES =/r po/SRC-POTFILES' \
+ -e '/BLD-POTFILES =/r po/BLD-POTFILES' \
+ -e "s,@POFILES@,$POFILES," \
+ -e "s,@GMOFILES@,$GMOFILES," \
+ po/Makefile.in > po/Makefile]],[[]])
+
+dnl Required by html and install-html
+AC_SUBST(datarootdir)
+AC_SUBST(docdir)
+AC_SUBST(htmldir)
+
+AC_OUTPUT
diff --git a/contrib/binutils/bfd/corefile.c b/contrib/binutils/bfd/corefile.c
index 8af4f45..58cd7f6 100644
--- a/contrib/binutils/bfd/corefile.c
+++ b/contrib/binutils/bfd/corefile.c
@@ -1,6 +1,6 @@
/* Core file generic interface routines for BFD.
- Copyright 1990, 1991, 1992, 1993, 1994, 2000, 2001, 2002, 2003
- Free Software Foundation, Inc.
+ Copyright 1990, 1991, 1992, 1993, 1994, 2000, 2001, 2002, 2003, 2005,
+ 2007 Free Software Foundation, Inc.
Written by Cygnus Support.
This file is part of BFD, the Binary File Descriptor library.
@@ -17,18 +17,21 @@ 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. */
+Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
/*
SECTION
Core files
+SUBSECTION
+ Core file functions
+
DESCRIPTION
These are functions pertaining to core files.
*/
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
/*
@@ -104,3 +107,59 @@ core_file_matches_executable_p (bfd *core_bfd, bfd *exec_bfd)
return BFD_SEND (core_bfd, _core_file_matches_executable_p,
(core_bfd, exec_bfd));
}
+
+/*
+FUNCTION
+ generic_core_file_matches_executable_p
+
+SYNOPSIS
+ bfd_boolean generic_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}. The match is based on executable
+ basenames only.
+
+ Note: When not able to determine the core file failing
+ command or the executable name, we still return TRUE even
+ though we're not sure that core file and executable match.
+ This is to avoid generating a false warning in situations
+ where we really don't know whether they match or not.
+*/
+
+bfd_boolean
+generic_core_file_matches_executable_p (bfd *core_bfd, bfd *exec_bfd)
+{
+ char *exec;
+ char *core;
+ char *last_slash;
+
+ if (exec_bfd == NULL || core_bfd == NULL)
+ return TRUE;
+
+ /* The cast below is to avoid a compiler warning due to the assignment
+ of the const char * returned by bfd_core_file_failing_command to a
+ non-const char *. In this case, the assignement does not lead to
+ breaking the const, as we're only reading the string. */
+
+ core = (char *) bfd_core_file_failing_command (core_bfd);
+ if (core == NULL)
+ return TRUE;
+
+ exec = bfd_get_filename (exec_bfd);
+ if (exec == NULL)
+ return TRUE;
+
+ last_slash = strrchr (core, '/');
+ if (last_slash != NULL)
+ core = last_slash + 1;
+
+ last_slash = strrchr (exec, '/');
+ if (last_slash != NULL)
+ exec = last_slash + 1;
+
+ return strcmp (exec, core) == 0;
+}
+
diff --git a/contrib/binutils/bfd/cpu-alpha.c b/contrib/binutils/bfd/cpu-alpha.c
index c593fc3..db7abfb 100644
--- a/contrib/binutils/bfd/cpu-alpha.c
+++ b/contrib/binutils/bfd/cpu-alpha.c
@@ -1,5 +1,6 @@
/* BFD support for the Alpha architecture.
- Copyright 1992, 1993, 1998, 2000, 2002 Free Software Foundation, Inc.
+ Copyright 1992, 1993, 1998, 2000, 2002, 2003, 2007
+ Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@@ -15,10 +16,10 @@ 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. */
+Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
#define N(BITS_WORD, BITS_ADDR, NUMBER, PRINT, DEFAULT, NEXT) \
diff --git a/contrib/binutils/bfd/cpu-arc.c b/contrib/binutils/bfd/cpu-arc.c
index c69df0e..bf9a739 100644
--- a/contrib/binutils/bfd/cpu-arc.c
+++ b/contrib/binutils/bfd/cpu-arc.c
@@ -1,5 +1,6 @@
/* BFD support for the ARC processor
- Copyright 1994, 1995, 1997, 2001, 2002 Free Software Foundation, Inc.
+ Copyright 1994, 1995, 1997, 2001, 2002, 2007
+ Free Software Foundation, Inc.
Contributed by Doug Evans (dje@cygnus.com).
This file is part of BFD, the Binary File Descriptor library.
@@ -16,10 +17,10 @@ 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. */
+Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
#define ARC(mach, print_name, default_p, next) \
diff --git a/contrib/binutils/bfd/cpu-arm.c b/contrib/binutils/bfd/cpu-arm.c
index 17889f3..a44b983 100644
--- a/contrib/binutils/bfd/cpu-arm.c
+++ b/contrib/binutils/bfd/cpu-arm.c
@@ -1,5 +1,6 @@
/* BFD support for the ARM processor
- Copyright 1994, 1997, 1999, 2000, 2002, 2003 Free Software Foundation, Inc.
+ Copyright 1994, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2007
+ Free Software Foundation, Inc.
Contributed by Richard Earnshaw (rwe@pegasus.esprit.ec.org)
This file is part of BFD, the Binary File Descriptor library.
@@ -16,28 +17,19 @@
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. */
+ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.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;
+compatible (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)
@@ -100,13 +92,12 @@ processors[] =
{ bfd_mach_arm_4, "strongarm1100" },
{ bfd_mach_arm_XScale, "xscale" },
{ bfd_mach_arm_ep9312, "ep9312" },
- { bfd_mach_arm_iWMMXt, "iwmmxt" }
+ { bfd_mach_arm_iWMMXt, "iwmmxt" },
+ { bfd_mach_arm_iWMMXt2, "iwmmxt2" }
};
static bfd_boolean
-scan (info, string)
- const struct bfd_arch_info * info;
- const char * string;
+scan (const struct bfd_arch_info *info, const char *string)
{
int i;
@@ -147,7 +138,8 @@ static const bfd_arch_info_type arch_info_struct[] =
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)
+ N (bfd_mach_arm_iWMMXt, "iwmmxt", FALSE, & arch_info_struct[12]),
+ N (bfd_mach_arm_iWMMXt2, "iwmmxt2", FALSE, NULL)
};
const bfd_arch_info_type bfd_arm_arch =
@@ -161,9 +153,7 @@ const bfd_arch_info_type bfd_arm_arch =
Returns TRUE if they were merged successfully or FALSE otherwise. */
bfd_boolean
-bfd_arm_merge_machines (ibfd, obfd)
- bfd * ibfd;
- bfd * obfd;
+bfd_arm_merge_machines (bfd *ibfd, bfd *obfd)
{
unsigned int in = bfd_get_mach (ibfd);
unsigned int out = bfd_get_mach (obfd);
@@ -191,22 +181,24 @@ bfd_arm_merge_machines (ibfd, obfd)
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))
+ && (out == bfd_mach_arm_XScale
+ || out == bfd_mach_arm_iWMMXt
+ || out == bfd_mach_arm_iWMMXt2))
{
_bfd_error_handler (_("\
-ERROR: %s is compiled for the EP9312, whereas %s is compiled for XScale"),
- bfd_archive_filename (ibfd),
- bfd_get_filename (obfd));
+ERROR: %B is compiled for the EP9312, whereas %B is compiled for XScale"),
+ ibfd, 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))
+ && (in == bfd_mach_arm_XScale
+ || in == bfd_mach_arm_iWMMXt
+ || in == bfd_mach_arm_iWMMXt2))
{
_bfd_error_handler (_("\
-ERROR: %s is compiled for the EP9312, whereas %s is compiled for XScale"),
- bfd_archive_filename (obfd),
- bfd_get_filename (ibfd));
+ERROR: %B is compiled for the EP9312, whereas %B is compiled for XScale"),
+ obfd, ibfd);
bfd_set_error (bfd_error_wrong_format);
return FALSE;
}
@@ -227,12 +219,11 @@ typedef struct
} 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;
+arm_check_note (bfd *abfd,
+ bfd_byte *buffer,
+ bfd_size_type buffer_size,
+ const char *expected_name,
+ char **description_return)
{
unsigned long namesz;
unsigned long descsz;
@@ -247,7 +238,7 @@ arm_check_note (abfd, buffer, buffer_size, expected_name, description_return)
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);
+ descr = (char *) buffer + offsetof (arm_Note, name);
/* Check for buffer overflow. */
if (namesz + descsz + offsetof (arm_Note, name) > buffer_size)
@@ -280,13 +271,11 @@ arm_check_note (abfd, buffer, buffer_size, expected_name, description_return)
#define NOTE_ARCH_STRING "arch: "
bfd_boolean
-bfd_arm_update_notes (abfd, note_section)
- bfd * abfd;
- const char * note_section;
+bfd_arm_update_notes (bfd *abfd, const char *note_section)
{
asection * arm_arch_section;
bfd_size_type buffer_size;
- char * buffer;
+ bfd_byte * buffer;
char * arch_string;
char * expected;
@@ -298,16 +287,11 @@ bfd_arm_update_notes (abfd, note_section)
if (arm_arch_section == NULL)
return TRUE;
- buffer_size = arm_arch_section->_raw_size;
+ buffer_size = arm_arch_section->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))
+ if (!bfd_malloc_and_get_section (abfd, arm_arch_section, &buffer))
goto FAIL;
/* Parse the note. */
@@ -331,11 +315,14 @@ bfd_arm_update_notes (abfd, note_section)
case bfd_mach_arm_XScale: expected = "XScale"; break;
case bfd_mach_arm_ep9312: expected = "ep9312"; break;
case bfd_mach_arm_iWMMXt: expected = "iWMMXt"; break;
+ case bfd_mach_arm_iWMMXt2: expected = "iWMMXt2"; break;
}
if (strcmp (arch_string, expected) != 0)
{
- strcpy (buffer + offsetof (arm_Note, name) + ((strlen (NOTE_ARCH_STRING) + 3) & ~3), expected);
+ strcpy ((char *) 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))
@@ -351,7 +338,8 @@ bfd_arm_update_notes (abfd, note_section)
return TRUE;
FAIL:
- free (buffer);
+ if (buffer != NULL)
+ free (buffer);
return FALSE;
}
@@ -374,18 +362,17 @@ architectures[] =
{ "armv5te", bfd_mach_arm_5TE },
{ "XScale", bfd_mach_arm_XScale },
{ "ep9312", bfd_mach_arm_ep9312 },
- { "iWMMXt", bfd_mach_arm_iWMMXt }
+ { "iWMMXt", bfd_mach_arm_iWMMXt },
+ { "iWMMXt2", bfd_mach_arm_iWMMXt2 }
};
/* 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;
+bfd_arm_get_mach_from_notes (bfd *abfd, const char *note_section)
{
asection * arm_arch_section;
bfd_size_type buffer_size;
- char * buffer;
+ bfd_byte * buffer;
char * arch_string;
int i;
@@ -397,16 +384,11 @@ bfd_arm_get_mach_from_notes (abfd, note_section)
if (arm_arch_section == NULL)
return bfd_mach_arm_unknown;
- buffer_size = arm_arch_section->_raw_size;
+ buffer_size = arm_arch_section->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))
+ if (!bfd_malloc_and_get_section (abfd, arm_arch_section, &buffer))
goto FAIL;
/* Parse the note. */
@@ -422,6 +404,28 @@ bfd_arm_get_mach_from_notes (abfd, note_section)
}
FAIL:
- free (buffer);
+ if (buffer != NULL)
+ free (buffer);
return bfd_mach_arm_unknown;
}
+
+bfd_boolean
+bfd_is_arm_special_symbol_name (const char * name, int type)
+{
+ /* The ARM compiler outputs several obsolete forms. Recognize them
+ in addition to the standard $a, $t and $d. We are somewhat loose
+ in what we accept here, since the full set is not documented. */
+ if (!name || name[0] != '$')
+ return FALSE;
+ if (name[1] == 'a' || name[1] == 't' || name[1] == 'd')
+ type &= BFD_ARM_SPECIAL_SYM_TYPE_MAP;
+ else if (name[1] == 'm' || name[1] == 'f' || name[1] == 'p')
+ type &= BFD_ARM_SPECIAL_SYM_TYPE_TAG;
+ else if (name[1] >= 'a' && name[1] <= 'z')
+ type &= BFD_ARM_SPECIAL_SYM_TYPE_OTHER;
+ else
+ return FALSE;
+
+ return (type != 0 && (name[2] == 0 || name[2] == '.'));
+}
+
diff --git a/contrib/binutils/bfd/cpu-cr16.c b/contrib/binutils/bfd/cpu-cr16.c
new file mode 100644
index 0000000..5695f0e
--- /dev/null
+++ b/contrib/binutils/bfd/cpu-cr16.c
@@ -0,0 +1,40 @@
+/* BFD support for the CR16 processor.
+ Copyright 2007 Free Software Foundation, Inc.
+ Written by M R Swami Reddy
+
+ 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., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include "sysdep.h"
+#include "bfd.h"
+#include "libbfd.h"
+
+
+const bfd_arch_info_type bfd_cr16_arch =
+ {
+ 16, /* 16 bits in a word. */
+ 32, /* 32 bits in an address. */
+ 8, /* 8 bits in a byte. */
+ bfd_arch_cr16, /* enum bfd_architecture arch. */
+ bfd_mach_cr16,
+ "cr16", /* Arch name. */
+ "cr16", /* Printable name. */
+ 1, /* Unsigned int section alignment power. */
+ TRUE, /* The one and only. */
+ bfd_default_compatible,
+ bfd_default_scan ,
+ 0,
+ };
diff --git a/contrib/binutils/bfd/cpu-i386.c b/contrib/binutils/bfd/cpu-i386.c
index 272c719..339c7d9 100644
--- a/contrib/binutils/bfd/cpu-i386.c
+++ b/contrib/binutils/bfd/cpu-i386.c
@@ -1,5 +1,5 @@
/* BFD support for the Intel 386 architecture.
- Copyright 1992, 1994, 1995, 1996, 1998, 2000, 2001, 2002
+ Copyright 1992, 1994, 1995, 1996, 1998, 2000, 2001, 2002, 2004, 2007
Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@@ -16,27 +16,12 @@ 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. */
+Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.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 */
@@ -47,12 +32,29 @@ const bfd_arch_info_type bfd_x86_64_arch_intel_syntax =
"i386:intel",
"i386:x86-64:intel",
3,
+ FALSE,
+ bfd_default_compatible,
+ bfd_default_scan,
+ 0
+};
+
+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 ,
- &bfd_i386_arch_intel_syntax,
+ bfd_default_scan,
+ &bfd_x86_64_arch_intel_syntax
};
-static const bfd_arch_info_type i8086_arch =
+
+const bfd_arch_info_type i8086_arch =
{
32, /* 32 bits in a word */
32, /* 32 bits in an address (well, not really) */
@@ -64,8 +66,8 @@ static const bfd_arch_info_type i8086_arch =
3,
FALSE,
bfd_default_compatible,
- bfd_default_scan ,
- &bfd_x86_64_arch_intel_syntax,
+ bfd_default_scan,
+ &bfd_i386_arch_intel_syntax
};
const bfd_arch_info_type bfd_x86_64_arch =
@@ -78,10 +80,10 @@ const bfd_arch_info_type bfd_x86_64_arch =
"i386",
"i386:x86-64",
3,
- TRUE,
+ FALSE,
bfd_default_compatible,
- bfd_default_scan ,
- &i8086_arch,
+ bfd_default_scan,
+ &i8086_arch
};
const bfd_arch_info_type bfd_i386_arch =
@@ -96,6 +98,6 @@ const bfd_arch_info_type bfd_i386_arch =
3,
TRUE,
bfd_default_compatible,
- bfd_default_scan ,
+ 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
index 740c2ee..a3adc47 100644
--- a/contrib/binutils/bfd/cpu-ia64-opc.c
+++ b/contrib/binutils/bfd/cpu-ia64-opc.c
@@ -1,4 +1,4 @@
-/* Copyright 1998, 1999, 2000, 2001, 2002, 2003
+/* Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2005, 2006
Free Software Foundation, Inc.
Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
@@ -16,7 +16,7 @@ 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. */
+Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
/* Logically, this code should be part of libopcode but since some of
the operand insertion/extraction functions help bfd to implement
@@ -114,6 +114,29 @@ ext_immu (const struct ia64_operand *self, ia64_insn code, ia64_insn *valuep)
}
static const char*
+ins_immu5b (const struct ia64_operand *self, ia64_insn value,
+ ia64_insn *code)
+{
+ if (value < 32 || value > 63)
+ return "value must be between 32 and 63";
+ return ins_immu (self, value - 32, code);
+}
+
+static const char*
+ext_immu5b (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 + 32;
+ return 0;
+}
+
+static const char*
ins_immus8 (const struct ia64_operand *self, ia64_insn value, ia64_insn *code)
{
if (value & 0x7)
@@ -457,6 +480,10 @@ const struct ia64_operand elf64_ia64_operands[IA64_OPND_COUNT] =
{ REG, ins_reg, ext_reg, "r", {{ 2, 20}}, 0, /* R3_2 */
"a general register r0-r3" },
+ /* memory operands: */
+ { IND, ins_reg, ext_reg, "", {{7, 20}}, 0, /* MR3 */
+ "a memory address" },
+
/* indirect operands: */
{ IND, ins_reg, ext_reg, "cpuid", {{7, 20}}, 0, /* CPUID_R3 */
"a cpuid register" },
@@ -468,8 +495,6 @@ const struct ia64_operand elf64_ia64_operands[IA64_OPND_COUNT] =
"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 */
@@ -504,6 +529,8 @@ const struct ia64_operand elf64_ia64_operands[IA64_OPND_COUNT] =
"a 1-bit integer (-1, 0)" },
{ ABS, ins_immu, ext_immu, 0, {{ 2, 13}}, UDEC, /* IMMU2 */
"a 2-bit unsigned (0-3)" },
+ { ABS, ins_immu5b, ext_immu5b, 0, {{ 5, 14}}, UDEC, /* IMMU5b */
+ "a 5-bit unsigned (32 + (0-31))" },
{ 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 */
diff --git a/contrib/binutils/bfd/cpu-ia64.c b/contrib/binutils/bfd/cpu-ia64.c
index 2185241..a38d24d 100644
--- a/contrib/binutils/bfd/cpu-ia64.c
+++ b/contrib/binutils/bfd/cpu-ia64.c
@@ -1,5 +1,5 @@
/* BFD support for the ia64 architecture.
- Copyright 1998, 1999, 2000, 2002 Free Software Foundation, Inc.
+ Copyright 1998, 1999, 2000, 2002, 2007 Free Software Foundation, Inc.
Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
This file is part of BFD, the Binary File Descriptor library.
@@ -16,10 +16,10 @@ 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. */
+Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
const bfd_arch_info_type bfd_ia64_elf32_arch =
diff --git a/contrib/binutils/bfd/cpu-mep.c b/contrib/binutils/bfd/cpu-mep.c
new file mode 100644
index 0000000..d5ee1d6
--- /dev/null
+++ b/contrib/binutils/bfd/cpu-mep.c
@@ -0,0 +1,28 @@
+/* BFD support for the Toshiba Media Engine Processor.
+ Copyright (C) 2001, 2002, 2004, 2007 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include "sysdep.h"
+#include "bfd.h"
+#include "libbfd.h"
+
+#define MA(x, n, def, y) { 32, 32, 8, bfd_arch_mep, x, "mep", n, \
+ 2, def, bfd_default_compatible, bfd_default_scan, y }
+
+static const bfd_arch_info_type bfd_h1_arch = MA (bfd_mach_mep_h1, "h1", FALSE, NULL);
+const bfd_arch_info_type bfd_mep_arch = MA (bfd_mach_mep, "mep", TRUE, & bfd_h1_arch);
diff --git a/contrib/binutils/bfd/cpu-mips.c b/contrib/binutils/bfd/cpu-mips.c
index c232f85..54bc0cf 100644
--- a/contrib/binutils/bfd/cpu-mips.c
+++ b/contrib/binutils/bfd/cpu-mips.c
@@ -1,6 +1,6 @@
/* bfd back-end for mips support
Copyright 1990, 1991, 1993, 1994, 1995, 1996, 1997, 1998, 2000, 2001,
- 2002, 2003, 2004 Free Software Foundation, Inc.
+ 2002, 2003, 2004, 2007 Free Software Foundation, Inc.
Written by Steve Chamberlain of Cygnus Support.
This file is part of BFD, the Binary File Descriptor library.
@@ -19,8 +19,8 @@ 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., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
static const bfd_arch_info_type *mips_compatible
diff --git a/contrib/binutils/bfd/cpu-powerpc.c b/contrib/binutils/bfd/cpu-powerpc.c
index a4e72d5..e358330 100644
--- a/contrib/binutils/bfd/cpu-powerpc.c
+++ b/contrib/binutils/bfd/cpu-powerpc.c
@@ -1,5 +1,5 @@
/* BFD PowerPC CPU definition
- Copyright 1994, 1995, 1996, 2000, 2001, 2002
+ Copyright 1994, 1995, 1996, 2000, 2001, 2002, 2003, 2007
Free Software Foundation, Inc.
Contributed by Ian Lance Taylor, Cygnus Support.
@@ -17,10 +17,10 @@ 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. */
+Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
/* The common PowerPC architecture is compatible with the RS/6000. */
@@ -295,6 +295,20 @@ const bfd_arch_info_type bfd_powerpc_archs[] =
FALSE, /* not the default */
powerpc_compatible,
bfd_default_scan,
+ &bfd_powerpc_archs[15]
+ },
+ {
+ 32, /* 32 bits in a word */
+ 32, /* 32 bits in an address */
+ 8, /* 8 bits in a byte */
+ bfd_arch_powerpc,
+ bfd_mach_ppc_750,
+ "powerpc",
+ "powerpc:750",
+ 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
index d94921f..4ed1d71 100644
--- a/contrib/binutils/bfd/cpu-rs6000.c
+++ b/contrib/binutils/bfd/cpu-rs6000.c
@@ -1,11 +1,7 @@
/* BFD back-end for rs6000 support
- Copyright 1990, 1991, 1993, 1995, 2000, 2002, 2003
+ Copyright 1990, 1991, 1993, 1995, 2000, 2002, 2003, 2007
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
+ Written by Mimi Phuong-Thao Vo of IBM
and John Gilmore of Cygnus Support.
This file is part of BFD, the Binary File Descriptor library.
@@ -22,10 +18,10 @@ 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. */
+Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
/* The RS/6000 architecture is compatible with the PowerPC common
diff --git a/contrib/binutils/bfd/cpu-s390.c b/contrib/binutils/bfd/cpu-s390.c
index 66fd246..b385a9c 100644
--- a/contrib/binutils/bfd/cpu-s390.c
+++ b/contrib/binutils/bfd/cpu-s390.c
@@ -1,5 +1,5 @@
/* BFD support for the s390 processor.
- Copyright 2000, 2001, 2002 Free Software Foundation, Inc.
+ Copyright 2000, 2001, 2002, 2007 Free Software Foundation, Inc.
Contributed by Carl B. Pedersen and Martin Schwidefsky.
This file is part of BFD, the Binary File Descriptor library.
@@ -16,11 +16,11 @@
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. */
+ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
+ 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
const bfd_arch_info_type bfd_s390_64_arch =
diff --git a/contrib/binutils/bfd/cpu-score.c b/contrib/binutils/bfd/cpu-score.c
new file mode 100644
index 0000000..90d3113
--- /dev/null
+++ b/contrib/binutils/bfd/cpu-score.c
@@ -0,0 +1,51 @@
+/* BFD support for the score processor
+ Copyright 2006, 2007 Free Software Foundation, Inc.
+ Contributed by
+ Mei Ligang (ligang@sunnorth.com.cn)
+ Pei-Lin Tsai (pltsai@sunplus.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., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include "sysdep.h"
+#include "bfd.h"
+#include "libbfd.h"
+
+const bfd_arch_info_type
+bfd_score_arch =
+{
+ 32, /* There's 32 bits_per_word. */
+ 32, /* There's 32 bits_per_address. */
+ 8, /* There's 8 bits_per_byte. */
+ bfd_arch_score, /* One of enum bfd_architecture, defined
+ in archures.c and provided in
+ generated header files. */
+ 0, /* Only 1 machine, but #255 for
+ historical reasons. */
+ "score", /* The arch_name. */
+ "score", /* The printable name is the same. */
+ 4, /* Section alignment power; each section
+ is aligned to (only) 2^4 bytes. */
+ TRUE, /* This is the default "machine", since
+ there's only one. */
+ bfd_default_compatible, /* A default function for testing
+ "machine" compatibility of two
+ bfd_arch_info_type. */
+ bfd_default_scan, /* Check if an bfd_arch_info_type is a
+ match. */
+ NULL /* Pointer to next bfd_arch_info_type in
+ the same family. */
+};
diff --git a/contrib/binutils/bfd/cpu-sparc.c b/contrib/binutils/bfd/cpu-sparc.c
index 3c0eae5..35a109e 100644
--- a/contrib/binutils/bfd/cpu-sparc.c
+++ b/contrib/binutils/bfd/cpu-sparc.c
@@ -1,5 +1,5 @@
/* BFD support for the SPARC architecture.
- Copyright 1992, 1995, 1996, 1998, 2000, 2002
+ Copyright 1992, 1995, 1996, 1998, 2000, 2002, 2007
Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@@ -16,10 +16,10 @@ 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. */
+Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
static const bfd_arch_info_type arch_info_struct[] =
diff --git a/contrib/binutils/bfd/cpu-spu.c b/contrib/binutils/bfd/cpu-spu.c
new file mode 100644
index 0000000..540a19f
--- /dev/null
+++ b/contrib/binutils/bfd/cpu-spu.c
@@ -0,0 +1,54 @@
+/* Copyright 2006, 2007 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.,
+ 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include "sysdep.h"
+#include "bfd.h"
+#include "libbfd.h"
+
+
+static const bfd_arch_info_type *
+spu_compatible (const bfd_arch_info_type *a, const bfd_arch_info_type *b)
+{
+ BFD_ASSERT (a->arch == bfd_arch_spu);
+ switch (b->arch)
+ {
+ default:
+ return NULL;
+ case bfd_arch_spu:
+ return bfd_default_compatible (a, b);
+ }
+ /*NOTREACHED*/
+}
+
+const bfd_arch_info_type bfd_spu_arch[] =
+{
+ {
+ 32, /* 32 bits in a word */
+ 32, /* 32 bits in an address */
+ 8, /* 8 bits in a byte */
+ bfd_arch_spu, /* architecture */
+ bfd_mach_spu, /* machine */
+ "spu", /* architecture name */
+ "spu:256K", /* printable name */
+ 3, /* aligned power */
+ TRUE, /* the default machine for the architecture */
+ spu_compatible, /* the spu is only compatible with itself, see above */
+ bfd_default_scan,
+ 0, /* next -- there are none! */
+ }
+};
diff --git a/contrib/binutils/bfd/demo64.c b/contrib/binutils/bfd/demo64.c
index a8c0b32..d284850 100644
--- a/contrib/binutils/bfd/demo64.c
+++ b/contrib/binutils/bfd/demo64.c
@@ -17,7 +17,7 @@ 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. */
+Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
#define ARCH_SIZE 64
diff --git a/contrib/binutils/bfd/dep-in.sed b/contrib/binutils/bfd/dep-in.sed
index 90a2e6a..2732d6b 100644
--- a/contrib/binutils/bfd/dep-in.sed
+++ b/contrib/binutils/bfd/dep-in.sed
@@ -4,6 +4,7 @@ s/\\\n */ /g
t loop
s!\.o:!.lo:!
+s! \./! !g
s! @BFD_H@!!g
s!@SRCDIR@/../include!$(INCDIR)!g
s!@TOPDIR@/include!$(INCDIR)!g
diff --git a/contrib/binutils/bfd/doc/ChangeLog b/contrib/binutils/bfd/doc/ChangeLog
index fc06933..6b96b61 100644
--- a/contrib/binutils/bfd/doc/ChangeLog
+++ b/contrib/binutils/bfd/doc/ChangeLog
@@ -1,9 +1,153 @@
-2004-04-08 Alan Modra <amodra@bigpond.net.au>
+2007-07-02 Alan Modra <amodra@bigpond.net.au>
+
+ * Makefile.in: Regenerate.
+
+2007-06-30 H.J. Lu <hongjiu.lu@intel.com>
+
+ * Makefile.in: Likewise.
+
+2007-06-14 H.J. Lu <hongjiu.lu@intel.com>
+
+ * Makefile.in: Regenerated.
+
+2007-05-22 Nick Clifton <nickc@redhat.com>
+
+ * bfd.texinfo: Use @copying around the copyright notice.
+ * bfdint.texi: Likewise.
+
+2007-05-21 Nick Clifton <nickc@redhat.com>
+
+ * bfdint.texi: Add GNU Free Documentation License notice.
+
+2007-04-24 Alan Modra <amodra@bigpond.net.au>
+
+ * Makefile.in: Regenerate.
+
+2007-02-17 Mark Mitchell <mark@codesourcery.com>
+ Nathan Sidwell <nathan@codesourcery.com>
+ Vladimir Prus <vladimir@codesourcery.com
+ Joseph Myers <joseph@codesourcery.com>
+
+ * Makefile.in: Regenerate.
+
+2006-07-24 Ralk Wildenhues <Ralf.Wildenhues@gmx.de>
+
+ * bfd..texinfo: Fix spelling mistakes.
+ * bfdint.texinfo: Likewise.
+
+2006-07-18 Nigel Stephens <nigel@mips.com>
+
+ * bfd.texinfo: Add @section for "What to Put Where".
+
+2006-06-07 Joseph S. Myers <joseph@codesourcery.com>
+
+ * bfd.texinfo: Remove local @tex code.
+
+2006-06-05 Alan Modra <amodra@bigpond.net.au>
+
+ * Makefile.in: Regenerate.
+
+2006-05-11 Carlos O'Donell <carlos@codesourcery.com>
+
+ * bfd.texinfo: Rename "Index" to "BFD Index"
+
+2006-04-06 Carlos O'Donell <carlos@codesourcery.com>
+
+ * Makefile.am: Add install-html and install-html-am targets.
+ Define datarootdir, docdir and htmldir.
+ * Makefile.in: Regenerate.
+
+2006-02-27 Carlos O'Donell <carlos@codesourcery.com>
+
+ * Makefile.am: Add html target.
+ * Makefile.in: Regenerate.
+
+2005-07-24 Daniel Jacobowitz <dan@codesourcery.com>
+
+ * chew.c: Include <string.h>.
+
+2005-07-22 DJ Delorie <dj@redhat.com>
+
+ * chew.c: Include stdlib.h.
+
+2005-07-22 Kazu Hirata <kazu@codesourcery.com>
+
+ * chew.c: Don't include sysdep.h.
+
+2005-05-09 Daniel Jacobowitz <dan@codesourcery.com>
+
+ * Makefile.am: Use a temporary file to build chew.
+ * Makefile.in: Regenerated.
+
+2005-05-04 Nick Clifton <nickc@redhat.com>
+
+ * chew.c: Update the address and phone number of the FSF
+ organization in the GPL notice.
+
+2005-05-05 H.J. Lu <hongjiu.lu@intel.com>
+
+ * Makefile.am (INCLUDES): Remove -D_GNU_SOURCE.
+ * Makefile.in: Regenerate.
+
+2005-04-29 Daniel Jacobowitz <dan@codesourcery.com>
+
+ * Makefile.am: Remove stamp rules. Depend on chew.c
+ instead of $(MKDOC).
+ * Makefile.in: Regnerated.
+
+2005-04-21 H.J. Lu <hongjiu.lu@intel.com>
+
+ * Makefile.am (INCLUDES): New. Add -D_GNU_SOURCE.
+ (chew.o): Use it.
+ * Makefile.in: Regenerate.
+
+2005-04-14 Alan Modra <amodra@bigpond.net.au>
+
+ * Makefile.in: Regenerate.
+
+2005-04-12 Alan Modra <amodra@bigpond.net.au>
+
+ * Makefile.in: Regenerate.
+
+2005-02-21 Alan Modra <amodra@bigpond.net.au>
+
+ * Makefile.in: Regenerate.
+
+2005-02-13 Maciej W. Rozycki <macro@linux-mips.org>
+
+ * Makefile.am: Use CFLAGS_FOR_BUILD and LDFLAGS_FOR_BUILD for
+ building chew.
+ * Makefile.in: Regenerate.
+
+2005-02-01 Ben Elliston <bje@au.ibm.com>
+
+ * chew.c: Remove #if 0'd code throughout. Similarly, collapse #if
+ 1'd code.
+
+2004-12-20 Ian Lance Taylor <ian@c2microsystems.com>
+
+ * Makefile.am: Use $(SHELL) whenever we run move-if-change.
+ * Makefile.in: Rebuild.
+
+2004-09-19 H.J. Lu <hongjiu.lu@intel.com>
+
+ * Makefile.am (AUTOMAKE_OPTIONS): Require 1.9.
+ (bfd.info): Rename the target to ...
+ ($(srcdir)/bfd.info): This.
+ * Makefile.in: Regenerated.
+
+2004-09-17 Alan Modra <amodra@bigpond.net.au>
+
+ * Makefile.in: Regenerate.
+
+2004-03-27 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.
+2004-03-19 Alan Modra <amodra@bigpond.net.au>
+
+ * Makefile.in: Regenerate.
+
For older changes see ChangeLog-9103
Local Variables:
diff --git a/contrib/binutils/bfd/doc/Makefile.am b/contrib/binutils/bfd/doc/Makefile.am
index 4aaa341..6ff434a 100644
--- a/contrib/binutils/bfd/doc/Makefile.am
+++ b/contrib/binutils/bfd/doc/Makefile.am
@@ -1,6 +1,6 @@
## Process this file with automake to generate Makefile.in
-AUTOMAKE_OPTIONS = cygnus
+AUTOMAKE_OPTIONS = 1.9 cygnus
DOCFILES = aoutx.texi archive.texi archures.texi \
bfdt.texi cache.texi coffcode.texi \
@@ -8,7 +8,8 @@ DOCFILES = aoutx.texi archive.texi archures.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
+ mmo.texi \
+ bfdver.texi
PROTOS = archive.p archures.p bfd.p \
core.p format.p \
@@ -51,162 +52,143 @@ SRCIPROT = $(srcdir)/../cache.c $(srcdir)/../libbfd.c \
TEXIDIR = $(srcdir)/../../texinfo/fsf
info_TEXINFOS = bfd.texinfo
+bfd_TEXINFOS = $(DOCFILES) bfdsumm.texi
MKDOC = chew$(EXEEXT_FOR_BUILD)
-$(MKDOC): chew.o
- $(CC_FOR_BUILD) -o $(MKDOC) chew.o $(CFLAGS) $(LOADLIBES) $(LDFLAGS)
+INCLUDES = -I.. -I$(srcdir)/.. -I$(srcdir)/../../include \
+ -I$(srcdir)/../../intl -I../../intl
+
+$(MKDOC): $(srcdir)/chew.c
+ $(CC_FOR_BUILD) -o chew.$$$$ $(srcdir)/chew.c \
+ $(CFLAGS_FOR_BUILD) $(LDFLAGS_FOR_BUILD) $(H_CFLAGS) \
+ $(INCLUDES); \
+ $(SHELL) $(srcdir)/../../move-if-change chew.$$$$ $(MKDOC)
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
+ $(CC_FOR_BUILD) -c $(INCLUDES) $(H_CFLAGS) $(CFLAGS_FOR_BUILD) $(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.
+# We do not depend on chew directly 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 nothing will be rebuilt.
-s-aoutx: $(MKDOC) $(srcdir)/../aoutx.h $(srcdir)/doc.str
+aoutx.texi: chew.c $(srcdir)/../aoutx.h $(srcdir)/doc.str
+ $(MAKE) $(MKDOC)
./$(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
+ $(SHELL) $(srcdir)/../../move-if-change aoutx.tmp aoutx.texi
-s-archive: $(MKDOC) $(srcdir)/../archive.c $(srcdir)/doc.str
+archive.texi: chew.c $(srcdir)/../archive.c $(srcdir)/doc.str
+ $(MAKE) $(MKDOC)
./$(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
+ $(SHELL) $(srcdir)/../../move-if-change archive.tmp archive.texi
-s-archures: $(MKDOC) $(srcdir)/../archures.c $(srcdir)/doc.str
+archures.texi: chew.c $(srcdir)/../archures.c $(srcdir)/doc.str
+ $(MAKE) $(MKDOC)
./$(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
+ $(SHELL) $(srcdir)/../../move-if-change archures.tmp archures.texi
# 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
+bfdt.texi: chew.c $(srcdir)/../bfd.c $(srcdir)/doc.str
+ $(MAKE) $(MKDOC)
./$(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
+ $(SHELL) $(srcdir)/../../move-if-change bfd.tmp bfdt.texi
-s-cache: $(MKDOC) $(srcdir)/../cache.c $(srcdir)/doc.str
+cache.texi: chew.c $(srcdir)/../cache.c $(srcdir)/doc.str
+ $(MAKE) $(MKDOC)
./$(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
+ $(SHELL) $(srcdir)/../../move-if-change cache.tmp cache.texi
-s-coffcode: $(MKDOC) $(srcdir)/../coffcode.h $(srcdir)/doc.str
+coffcode.texi: chew.c $(srcdir)/../coffcode.h $(srcdir)/doc.str
+ $(MAKE) $(MKDOC)
./$(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
+ $(SHELL) $(srcdir)/../../move-if-change coffcode.tmp coffcode.texi
-s-core: $(MKDOC) $(srcdir)/../corefile.c $(srcdir)/doc.str
+core.texi: chew.c $(srcdir)/../corefile.c $(srcdir)/doc.str
+ $(MAKE) $(MKDOC)
./$(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
+ $(SHELL) $(srcdir)/../../move-if-change core.tmp core.texi
-s-elf: $(MKDOC) $(srcdir)/../elf.c $(srcdir)/doc.str
+elf.texi: chew.c $(srcdir)/../elf.c $(srcdir)/doc.str
+ $(MAKE) $(MKDOC)
./$(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
+ $(SHELL) $(srcdir)/../../move-if-change elf.tmp elf.texi
-s-elfcode: $(MKDOC) $(srcdir)/../elfcode.h $(srcdir)/doc.str
+elfcode.texi: chew.c $(srcdir)/../elfcode.h $(srcdir)/doc.str
+ $(MAKE) $(MKDOC)
./$(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
+ $(SHELL) $(srcdir)/../../move-if-change elfcode.tmp elfcode.texi
-s-mmo: $(MKDOC) $(srcdir)/../mmo.c $(srcdir)/doc.str
+mmo.texi: chew.c $(srcdir)/../mmo.c $(srcdir)/doc.str
+ $(MAKE) $(MKDOC)
./$(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
+ $(SHELL) $(srcdir)/../../move-if-change mmo.tmp mmo.texi
-s-format: $(MKDOC) $(srcdir)/../format.c $(srcdir)/doc.str
+format.texi: chew.c $(srcdir)/../format.c $(srcdir)/doc.str
+ $(MAKE) $(MKDOC)
./$(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
+ $(SHELL) $(srcdir)/../../move-if-change format.tmp format.texi
-s-libbfd: $(MKDOC) $(srcdir)/../libbfd.c $(srcdir)/doc.str
+libbfd.texi: chew.c $(srcdir)/../libbfd.c $(srcdir)/doc.str
+ $(MAKE) $(MKDOC)
./$(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
+ $(SHELL) $(srcdir)/../../move-if-change libbfd.tmp libbfd.texi
-s-bfdio: $(MKDOC) $(srcdir)/../bfdio.c $(srcdir)/doc.str
+bfdio.texi: chew.c $(srcdir)/../bfdio.c $(srcdir)/doc.str
+ $(MAKE) $(MKDOC)
./$(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
+ $(SHELL) $(srcdir)/../../move-if-change bfdio.tmp bfdio.texi
-s-bfdwin: $(MKDOC) $(srcdir)/../bfdwin.c $(srcdir)/doc.str
+bfdwin.texi: chew.c $(srcdir)/../bfdwin.c $(srcdir)/doc.str
+ $(MAKE) $(MKDOC)
./$(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
+ $(SHELL) $(srcdir)/../../move-if-change bfdwin.tmp bfdwin.texi
-s-opncls: $(MKDOC) $(srcdir)/../opncls.c $(srcdir)/doc.str
+opncls.texi: chew.c $(srcdir)/../opncls.c $(srcdir)/doc.str
+ $(MAKE) $(MKDOC)
./$(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
+ $(SHELL) $(srcdir)/../../move-if-change opncls.tmp opncls.texi
-s-reloc: $(MKDOC) $(srcdir)/../reloc.c $(srcdir)/doc.str
+reloc.texi: chew.c $(srcdir)/../reloc.c $(srcdir)/doc.str
+ $(MAKE) $(MKDOC)
./$(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
+ $(SHELL) $(srcdir)/../../move-if-change reloc.tmp reloc.texi
-s-section: $(MKDOC) $(srcdir)/../section.c $(srcdir)/doc.str
+section.texi: chew.c $(srcdir)/../section.c $(srcdir)/doc.str
+ $(MAKE) $(MKDOC)
./$(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
+ $(SHELL) $(srcdir)/../../move-if-change section.tmp section.texi
-s-syms: $(MKDOC) $(srcdir)/../syms.c $(srcdir)/doc.str
+syms.texi: chew.c $(srcdir)/../syms.c $(srcdir)/doc.str
+ $(MAKE) $(MKDOC)
./$(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
+ $(SHELL) $(srcdir)/../../move-if-change syms.tmp syms.texi
-s-targets: $(MKDOC) $(srcdir)/../targets.c $(srcdir)/doc.str
+targets.texi: chew.c $(srcdir)/../targets.c $(srcdir)/doc.str
+ $(MAKE) $(MKDOC)
./$(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
+ $(SHELL) $(srcdir)/../../move-if-change targets.tmp targets.texi
-s-init: $(MKDOC) $(srcdir)/../init.c $(srcdir)/doc.str
+init.texi: chew.c $(srcdir)/../init.c $(srcdir)/doc.str
+ $(MAKE) $(MKDOC)
./$(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
+ $(SHELL) $(srcdir)/../../move-if-change init.tmp init.texi
-s-hash: $(MKDOC) $(srcdir)/../hash.c $(srcdir)/doc.str
+hash.texi: chew.c $(srcdir)/../hash.c $(srcdir)/doc.str
+ $(MAKE) $(MKDOC)
./$(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
+ $(SHELL) $(srcdir)/../../move-if-change hash.tmp hash.texi
-s-linker: $(MKDOC) $(srcdir)/../linker.c $(srcdir)/doc.str
+linker.texi: chew.c $(srcdir)/../linker.c $(srcdir)/doc.str
+ $(MAKE) $(MKDOC)
./$(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
+ $(SHELL) $(srcdir)/../../move-if-change linker.tmp linker.texi
LIBBFD_H_DEP = \
$(srcdir)/../libbfd-in.h \
@@ -292,11 +274,22 @@ bfd.h: $(BFD_H_DEP)
echo "#endif" >> $@
echo "#endif" >> $@
+bfdver.texi: $(srcdir)/Makefile.in
+ @echo "creating $@"; \
+ echo "@set VERSION $(VERSION)" > bfdver.texi; \
+ if [ -n "$(PKGVERSION)" ]; then \
+ echo "@set VERSION_PACKAGE $(PKGVERSION)" >> bfdver.texi; \
+ fi; \
+ echo "@set UPDATED `date '+%B %Y'`" >> bfdver.texi; \
+ if [ -n "$(REPORT_BUGS_TEXI)" ]; then \
+ echo "@set BUGURL $(REPORT_BUGS_TEXI)" >> bfdver.texi; \
+ fi
+
noinst_TEXINFOS = bfdint.texi
MOSTLYCLEANFILES = $(MKDOC) *.o
-CLEANFILES = s-* *.p *.ip
+CLEANFILES = *.p *.ip
DISTCLEANFILES = bfd.?? bfd.??? bfd.h libbfd.h libcoff.h texput.log
@@ -305,3 +298,33 @@ MAINTAINERCLEANFILES = $(DOCFILES)
# We want install to imply install-info as per GNU standards, despite the
# cygnus option.
install: install-info
+
+html__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
+
+install-html: install-html-am
+
+install-html-am: $(HTMLS)
+ @$(NORMAL_INSTALL)
+ test -z "$(htmldir)" || $(mkdir_p) "$(DESTDIR)$(htmldir)"
+ @list='$(HTMLS)'; for p in $$list; do \
+ if test -f "$$p" || test -d "$$p"; then d=""; else d="$(srcdir)/"; fi; \
+ f=$(html__strip_dir) \
+ if test -d "$$d$$p"; then \
+ echo " $(mkdir_p) '$(DESTDIR)$(htmldir)/$$f'"; \
+ $(mkdir_p) "$(DESTDIR)$(htmldir)/$$f" || exit 1; \
+ echo " $(INSTALL_DATA) '$$d$$p'/* '$(DESTDIR)$(htmldir)/$$f'"; \
+ $(INSTALL_DATA) "$$d$$p"/* "$(DESTDIR)$(htmldir)/$$f"; \
+ else \
+ echo " $(INSTALL_DATA) '$$d$$p' '$(DESTDIR)$(htmldir)/$$f'"; \
+ $(INSTALL_DATA) "$$d$$p" "$(DESTDIR)$(htmldir)/$$f"; \
+ fi; \
+ done
+
+MAINTAINERCLEANFILES += bfd.info
+
+# Automake 1.9 will only build info files in the objdir if they are
+# mentioned in DISTCLEANFILES. It doesn't have to be unconditional,
+# though, so we use a bogus condition.
+if GENINSRC_NEVER
+DISTCLEANFILES += bfd.info
+endif
diff --git a/contrib/binutils/bfd/doc/Makefile.in b/contrib/binutils/bfd/doc/Makefile.in
index 85d6427..02b15d0 100644
--- a/contrib/binutils/bfd/doc/Makefile.in
+++ b/contrib/binutils/bfd/doc/Makefile.in
@@ -1,6 +1,8 @@
-# Makefile.in generated automatically by automake 1.4-p6 from Makefile.am
+# Makefile.in generated by automake 1.9.6 from Makefile.am.
+# @configure_input@
-# Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc.
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005 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.
@@ -10,61 +12,84 @@
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
-
-SHELL = @SHELL@
-
+@SET_MAKE@
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@
-
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
INSTALL = @INSTALL@
-INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS)
-INSTALL_DATA = @INSTALL_DATA@
-INSTALL_SCRIPT = @INSTALL_SCRIPT@
-transform = @program_transform_name@
-
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+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@
+
+# Automake 1.9 will only build info files in the objdir if they are
+# mentioned in DISTCLEANFILES. It doesn't have to be unconditional,
+# though, so we use a bogus condition.
+@GENINSRC_NEVER_TRUE@am__append_1 = bfd.info
+subdir = doc
+DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
+ $(bfd_TEXINFOS)
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \
+ $(top_srcdir)/../config/depstand.m4 \
+ $(top_srcdir)/../config/gettext-sister.m4 \
+ $(top_srcdir)/../config/lead-dot.m4 \
+ $(top_srcdir)/../config/nls.m4 $(top_srcdir)/../config/po.m4 \
+ $(top_srcdir)/../config/progtest.m4 \
+ $(top_srcdir)/../config/stdint.m4 $(top_srcdir)/../libtool.m4 \
+ $(top_srcdir)/../ltoptions.m4 $(top_srcdir)/../ltsugar.m4 \
+ $(top_srcdir)/../ltversion.m4 $(top_srcdir)/bfd.m4 \
+ $(top_srcdir)/warning.m4 $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.in
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(SHELL) $(top_srcdir)/../mkinstalldirs
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+depcomp =
+am__depfiles_maybe =
+SOURCES =
+INFO_DEPS = bfd.info
+TEXINFO_TEX = $(top_srcdir)/../texinfo/texinfo.tex
+am__TEXINFO_TEX_DIR = $(top_srcdir)/../texinfo
+DVIS = bfd.dvi
+PDFS = bfd.pdf
+PSS = bfd.ps
+HTMLS = bfd.html
+TEXINFOS = bfd.texinfo
+TEXI2DVI = `if test -f $(top_srcdir)/../texinfo/util/texi2dvi; then \
+ echo $(top_srcdir)/../texinfo/util/texi2dvi; \
+ else \
+ echo texi2dvi; \
+ fi`
+TEXI2PDF = $(TEXI2DVI) --pdf --batch
+MAKEINFOHTML = $(MAKEINFO) --html
+AM_MAKEINFOHTMLFLAGS = $(AM_MAKEINFOFLAGS)
+DVIPS = dvips
+ACLOCAL = @ACLOCAL@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
AR = @AR@
-AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
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@
@@ -73,72 +98,152 @@ BFD_HOST_U_64_BIT = @BFD_HOST_U_64_BIT@
CATALOGS = @CATALOGS@
CATOBJEXT = @CATOBJEXT@
CC = @CC@
+CCDEPMODE = @CCDEPMODE@
CC_FOR_BUILD = @CC_FOR_BUILD@
+CFLAGS = @CFLAGS@
COREFILE = @COREFILE@
COREFLAG = @COREFLAG@
-CXX = @CXX@
-CXXCPP = @CXXCPP@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CYGPATH_W = @CYGPATH_W@
DATADIRNAME = @DATADIRNAME@
-DLLTOOL = @DLLTOOL@
+DEBUGDIR = @DEBUGDIR@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DUMPBIN = @DUMPBIN@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
EXEEXT = @EXEEXT@
EXEEXT_FOR_BUILD = @EXEEXT_FOR_BUILD@
-GCJ = @GCJ@
-GCJFLAGS = @GCJFLAGS@
-GMOFILES = @GMOFILES@
+FGREP = @FGREP@
+GENCAT = @GENCAT@
+GENINSRC_NEVER_FALSE = @GENINSRC_NEVER_FALSE@
+GENINSRC_NEVER_TRUE = @GENINSRC_NEVER_TRUE@
GMSGFMT = @GMSGFMT@
-GT_NO = @GT_NO@
-GT_YES = @GT_YES@
+GREP = @GREP@
HDEFINES = @HDEFINES@
-INCLUDE_LOCALE_H = @INCLUDE_LOCALE_H@
+INCINTL = @INCINTL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_LIBBFD_FALSE = @INSTALL_LIBBFD_FALSE@
+INSTALL_LIBBFD_TRUE = @INSTALL_LIBBFD_TRUE@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
INSTOBJEXT = @INSTOBJEXT@
-INTLDEPS = @INTLDEPS@
-INTLLIBS = @INTLLIBS@
-INTLOBJS = @INTLOBJS@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LIBINTL = @LIBINTL@
+LIBINTL_DEP = @LIBINTL_DEP@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
MAINT = @MAINT@
+MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
+MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
MAKEINFO = @MAKEINFO@
MKINSTALLDIRS = @MKINSTALLDIRS@
MSGFMT = @MSGFMT@
-OBJDUMP = @OBJDUMP@
+MSGMERGE = @MSGMERGE@
+NM = @NM@
+NO_WERROR = @NO_WERROR@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
-POFILES = @POFILES@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PKGVERSION = @PKGVERSION@
POSUB = @POSUB@
RANLIB = @RANLIB@
+REPORT_BUGS_TEXI = @REPORT_BUGS_TEXI@
+REPORT_BUGS_TO = @REPORT_BUGS_TO@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
STRIP = @STRIP@
TDEFINES = @TDEFINES@
-USE_INCLUDED_LIBINTL = @USE_INCLUDED_LIBINTL@
USE_NLS = @USE_NLS@
VERSION = @VERSION@
WARN_CFLAGS = @WARN_CFLAGS@
WIN32LDFLAGS = @WIN32LDFLAGS@
WIN32LIBADD = @WIN32LIBADD@
+XGETTEXT = @XGETTEXT@
+ac_ct_AR = @ac_ct_AR@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+ac_ct_RANLIB = @ac_ct_RANLIB@
+ac_ct_STRIP = @ac_ct_STRIP@
all_backends = @all_backends@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bfd64_libs = @bfd64_libs@
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@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_noncanonical = @host_noncanonical@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localstatedir = @localstatedir@
+lt_ECHO = @lt_ECHO@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+sysconfdir = @sysconfdir@
+target = @target@
+target_alias = @target_alias@
+target_cpu = @target_cpu@
+target_noncanonical = @target_noncanonical@
+target_os = @target_os@
+target_vendor = @target_vendor@
tdefaults = @tdefaults@
wordsize = @wordsize@
-
-AUTOMAKE_OPTIONS = cygnus
-
+AUTOMAKE_OPTIONS = 1.9 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
-
+ mmo.texi \
+ bfdver.texi
PROTOS = archive.p archures.p bfd.p \
core.p format.p \
@@ -147,7 +252,6 @@ PROTOS = archive.p archures.p bfd.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
@@ -165,7 +269,6 @@ SRCDOC = $(srcdir)/../aoutx.h $(srcdir)/../archive.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 \
@@ -174,19 +277,18 @@ SRCPROT = $(srcdir)/../archive.c $(srcdir)/../archures.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
-
+bfd_TEXINFOS = $(DOCFILES) bfdsumm.texi
MKDOC = chew$(EXEEXT_FOR_BUILD)
+INCLUDES = -I.. -I$(srcdir)/.. -I$(srcdir)/../../include \
+ -I$(srcdir)/../../intl -I../../intl
LIBBFD_H_DEP = \
$(srcdir)/../libbfd-in.h \
@@ -202,7 +304,6 @@ LIBBFD_H_DEP = \
$(srcdir)/proto.str \
$(MKDOC)
-
LIBCOFF_H_DEP = \
$(srcdir)/../libcoff-in.h \
$(srcdir)/../coffcode.h \
@@ -210,7 +311,6 @@ LIBCOFF_H_DEP = \
$(srcdir)/proto.str \
$(MKDOC)
-
BFD_H_DEP = \
$(srcdir)/../bfd-in.h \
$(srcdir)/../init.c \
@@ -234,200 +334,174 @@ BFD_H_DEP = \
$(srcdir)/../version.h \
$(MKDOC)
-
noinst_TEXINFOS = bfdint.texi
-
MOSTLYCLEANFILES = $(MKDOC) *.o
+CLEANFILES = *.p *.ip
+DISTCLEANFILES = bfd.?? bfd.??? bfd.h libbfd.h libcoff.h texput.log \
+ $(am__append_1)
+MAINTAINERCLEANFILES = $(DOCFILES) bfd.info
+html__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
+all: all-am
-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) $<
+.SUFFIXES: .dvi .ps
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --cygnus doc/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --cygnus doc/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+distclean-libtool:
+ -rm -f libtool
-.txi:
- @rm -f $@ $@-[0-9] $@-[0-9][0-9]
- $(MAKEINFO) -I $(srcdir) $<
+bfd.info: bfd.texinfo $(bfd_TEXINFOS)
+ restore=: && backupdir="$(am__leading_dot)am$$$$" && \
+ rm -rf $$backupdir && mkdir $$backupdir && \
+ if ($(MAKEINFO) --version) >/dev/null 2>&1; then \
+ for f in $@ $@-[0-9] $@-[0-9][0-9] $(@:.info=).i[0-9] $(@:.info=).i[0-9][0-9]; do \
+ if test -f $$f; then mv $$f $$backupdir; restore=mv; else :; fi; \
+ done; \
+ else :; fi && \
+ if $(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS) -I $(srcdir) \
+ -o $@ `test -f 'bfd.texinfo' || echo '$(srcdir)/'`bfd.texinfo; \
+ then \
+ rc=0; \
+ else \
+ rc=$$?; \
+ $$restore $$backupdir/* `echo "./$@" | sed 's|[^/]*$$||'`; \
+ fi; \
+ rm -rf $$backupdir; exit $$rc
+
+bfd.dvi: bfd.texinfo $(bfd_TEXINFOS)
+ TEXINPUTS="$(am__TEXINFO_TEX_DIR)$(PATH_SEPARATOR)$$TEXINPUTS" \
+ MAKEINFO='$(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS) -I $(srcdir)' \
+ $(TEXI2DVI) -o $@ `test -f 'bfd.texinfo' || echo '$(srcdir)/'`bfd.texinfo
+
+bfd.pdf: bfd.texinfo $(bfd_TEXINFOS)
+ TEXINPUTS="$(am__TEXINFO_TEX_DIR)$(PATH_SEPARATOR)$$TEXINPUTS" \
+ MAKEINFO='$(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS) -I $(srcdir)' \
+ $(TEXI2PDF) -o $@ `test -f 'bfd.texinfo' || echo '$(srcdir)/'`bfd.texinfo
+
+bfd.html: bfd.texinfo $(bfd_TEXINFOS)
+ rm -rf $(@:.html=.htp)
+ if $(MAKEINFOHTML) $(AM_MAKEINFOHTMLFLAGS) $(MAKEINFOFLAGS) -I $(srcdir) \
+ -o $(@:.html=.htp) `test -f 'bfd.texinfo' || echo '$(srcdir)/'`bfd.texinfo; \
+ then \
+ rm -rf $@; \
+ if test ! -d $(@:.html=.htp) && test -d $(@:.html=); then \
+ mv $(@:.html=) $@; else mv $(@:.html=.htp) $@; fi; \
+ else \
+ if test ! -d $(@:.html=.htp) && test -d $(@:.html=); then \
+ rm -rf $(@:.html=); else rm -Rf $(@:.html=.htp) $@; fi; \
+ exit 1; \
+ fi
.dvi.ps:
- $(DVIPS) $< -o $@
+ TEXINPUTS="$(am__TEXINFO_TEX_DIR)$(PATH_SEPARATOR)$$TEXINPUTS" \
+ $(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 \
+uninstall-info-am:
+ @$(PRE_UNINSTALL)
+ @if (install-info --version && \
+ install-info --version 2>&1 | sed 1q | grep -i -v 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 || :;\
+ relfile=`echo "$$file" | sed 's|^.*/||'`; \
+ echo " install-info --info-dir='$(DESTDIR)$(infodir)' --remove '$(DESTDIR)$(infodir)/$$relfile'"; \
+ install-info --info-dir="$(DESTDIR)$(infodir)" --remove "$(DESTDIR)$(infodir)/$$relfile"; \
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
+ else :; fi
@$(NORMAL_UNINSTALL)
- list='$(INFO_DEPS)'; \
+ @list='$(INFO_DEPS)'; \
for file in $$list; do \
- (cd $(DESTDIR)$(infodir) && rm -f $$file $$file-[0-9] $$file-[0-9][0-9]); \
+ relfile=`echo "$$file" | sed 's|^.*/||'`; \
+ relfile_i=`echo "$$relfile" | sed 's|\.info$$||;s|$$|.i|'`; \
+ (if cd "$(DESTDIR)$(infodir)"; then \
+ echo " cd '$(DESTDIR)$(infodir)' && rm -f $$relfile $$relfile-[0-9] $$relfile-[0-9][0-9] $$relfile_i[0-9] $$relfile_i[0-9][0-9]"; \
+ rm -f $$relfile $$relfile-[0-9] $$relfile-[0-9][0-9] $$relfile_i[0-9] $$relfile_i[0-9][0-9]; \
+ else :; fi); \
done
dist-info: $(INFO_DEPS)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
list='$(INFO_DEPS)'; \
for base in $$list; do \
+ case $$base in \
+ $(srcdir)/*) base=`echo "$$base" | sed "s|^$$srcdirstrip/||"`;; \
+ esac; \
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; \
+ for file in $$d/$$base*; do \
+ relfile=`expr "$$file" : "$$d/\(.*\)"`; \
+ test -f $(distdir)/$$relfile || \
+ cp -p $$file $(distdir)/$$relfile; \
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:
+ -rm -rf bfd.aux bfd.cp bfd.cps bfd.fn bfd.ky bfd.kys bfd.log bfd.pg bfd.pgs \
+ bfd.tmp bfd.toc bfd.tp bfd.tps bfd.vr bfd.vrs bfd.dvi \
+ bfd.pdf bfd.ps bfd.html
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; \
+ @list='$(INFO_DEPS)'; for i in $$list; do \
+ i_i=`echo "$$i" | sed 's|\.info$$||;s|$$|.i|'`; \
+ echo " rm -f $$i $$i-[0-9] $$i-[0-9][0-9] $$i_i[0-9] $$i_i[0-9][0-9]"; \
+ rm -f $$i $$i-[0-9] $$i-[0-9][0-9] $$i_i[0-9] $$i_i[0-9][0-9]; \
done
+
clean-info: mostlyclean-aminfo
tags: TAGS
TAGS:
+ctags: CTAGS
+CTAGS:
-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:
+all-am: Makefile
+installdirs:
install-exec: install-exec-am
-
-install-data-am:
install-data: install-data-am
+uninstall: uninstall-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:
-
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
mostlyclean-generic:
-test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES)
@@ -435,195 +509,235 @@ 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 "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
-test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES)
maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
-test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
-mostlyclean-am: mostlyclean-aminfo mostlyclean-generic
+clean: clean-am
-mostlyclean: mostlyclean-am
+clean-am: clean-generic clean-libtool mostlyclean-am
-clean-am: clean-aminfo clean-generic mostlyclean-am
+distclean: distclean-am
+ -rm -f Makefile
+distclean-am: clean-am distclean-generic distclean-libtool
-clean: clean-am
+dvi: dvi-am
-distclean-am: distclean-aminfo distclean-generic clean-am
- -rm -f libtool
+dvi-am: $(DVIS)
-distclean: distclean-am
+html: html-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."
+html-am: $(HTMLS)
+
+info: info-am
+
+info-am: $(INFO_DEPS)
+
+install-data-am:
+
+install-exec-am:
+
+install-info: install-info-am
+
+install-info-am: $(INFO_DEPS)
+ @$(NORMAL_INSTALL)
+ test -z "$(infodir)" || $(mkdir_p) "$(DESTDIR)$(infodir)"
+ @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+ list='$(INFO_DEPS)'; \
+ for file in $$list; do \
+ case $$file in \
+ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+ esac; \
+ if test -f $$file; then d=.; else d=$(srcdir); fi; \
+ file_i=`echo "$$file" | sed 's|\.info$$||;s|$$|.i|'`; \
+ for ifile in $$d/$$file $$d/$$file-[0-9] $$d/$$file-[0-9][0-9] \
+ $$d/$$file_i[0-9] $$d/$$file_i[0-9][0-9] ; do \
+ if test -f $$ifile; then \
+ relfile=`echo "$$ifile" | sed 's|^.*/||'`; \
+ echo " $(INSTALL_DATA) '$$ifile' '$(DESTDIR)$(infodir)/$$relfile'"; \
+ $(INSTALL_DATA) "$$ifile" "$(DESTDIR)$(infodir)/$$relfile"; \
+ else : ; fi; \
+ done; \
+ done
+ @$(POST_INSTALL)
+ @if (install-info --version && \
+ install-info --version 2>&1 | sed 1q | grep -i -v debian) >/dev/null 2>&1; then \
+ list='$(INFO_DEPS)'; \
+ for file in $$list; do \
+ relfile=`echo "$$file" | sed 's|^.*/||'`; \
+ echo " install-info --info-dir='$(DESTDIR)$(infodir)' '$(DESTDIR)$(infodir)/$$relfile'";\
+ install-info --info-dir="$(DESTDIR)$(infodir)" "$(DESTDIR)$(infodir)/$$relfile" || :;\
+ done; \
+ else : ; fi
+install-man:
+
+installcheck-am:
maintainer-clean: maintainer-clean-am
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-aminfo \
+ maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-aminfo mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-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
+pdf-am: $(PDFS)
+ps: ps-am
-$(MKDOC): chew.o
- $(CC_FOR_BUILD) -o $(MKDOC) chew.o $(CFLAGS) $(LOADLIBES) $(LDFLAGS)
+ps-am: $(PSS)
+
+uninstall-am:
+
+.PHONY: all all-am check check-am clean clean-generic clean-info \
+ clean-libtool dist-info distclean distclean-generic \
+ distclean-libtool dvi dvi-am html html-am info info-am install \
+ install-am install-data install-data-am install-exec \
+ install-exec-am install-info install-info-am install-man \
+ install-strip installcheck installcheck-am installdirs \
+ maintainer-clean maintainer-clean-aminfo \
+ maintainer-clean-generic mostlyclean mostlyclean-aminfo \
+ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+ uninstall uninstall-am uninstall-info-am
+
+
+$(MKDOC): $(srcdir)/chew.c
+ $(CC_FOR_BUILD) -o chew.$$$$ $(srcdir)/chew.c \
+ $(CFLAGS_FOR_BUILD) $(LDFLAGS_FOR_BUILD) $(H_CFLAGS) \
+ $(INCLUDES); \
+ $(SHELL) $(srcdir)/../../move-if-change chew.$$$$ $(MKDOC)
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
+ $(CC_FOR_BUILD) -c $(INCLUDES) $(H_CFLAGS) $(CFLAGS_FOR_BUILD) $(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.
+# We do not depend on chew directly 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 nothing will be rebuilt.
-s-aoutx: $(MKDOC) $(srcdir)/../aoutx.h $(srcdir)/doc.str
+aoutx.texi: chew.c $(srcdir)/../aoutx.h $(srcdir)/doc.str
+ $(MAKE) $(MKDOC)
./$(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
+ $(SHELL) $(srcdir)/../../move-if-change aoutx.tmp aoutx.texi
-s-archive: $(MKDOC) $(srcdir)/../archive.c $(srcdir)/doc.str
+archive.texi: chew.c $(srcdir)/../archive.c $(srcdir)/doc.str
+ $(MAKE) $(MKDOC)
./$(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
+ $(SHELL) $(srcdir)/../../move-if-change archive.tmp archive.texi
-s-archures: $(MKDOC) $(srcdir)/../archures.c $(srcdir)/doc.str
+archures.texi: chew.c $(srcdir)/../archures.c $(srcdir)/doc.str
+ $(MAKE) $(MKDOC)
./$(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
+ $(SHELL) $(srcdir)/../../move-if-change archures.tmp archures.texi
# 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
+bfdt.texi: chew.c $(srcdir)/../bfd.c $(srcdir)/doc.str
+ $(MAKE) $(MKDOC)
./$(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
+ $(SHELL) $(srcdir)/../../move-if-change bfd.tmp bfdt.texi
-s-cache: $(MKDOC) $(srcdir)/../cache.c $(srcdir)/doc.str
+cache.texi: chew.c $(srcdir)/../cache.c $(srcdir)/doc.str
+ $(MAKE) $(MKDOC)
./$(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
+ $(SHELL) $(srcdir)/../../move-if-change cache.tmp cache.texi
-s-coffcode: $(MKDOC) $(srcdir)/../coffcode.h $(srcdir)/doc.str
+coffcode.texi: chew.c $(srcdir)/../coffcode.h $(srcdir)/doc.str
+ $(MAKE) $(MKDOC)
./$(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
+ $(SHELL) $(srcdir)/../../move-if-change coffcode.tmp coffcode.texi
-s-core: $(MKDOC) $(srcdir)/../corefile.c $(srcdir)/doc.str
+core.texi: chew.c $(srcdir)/../corefile.c $(srcdir)/doc.str
+ $(MAKE) $(MKDOC)
./$(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
+ $(SHELL) $(srcdir)/../../move-if-change core.tmp core.texi
-s-elf: $(MKDOC) $(srcdir)/../elf.c $(srcdir)/doc.str
+elf.texi: chew.c $(srcdir)/../elf.c $(srcdir)/doc.str
+ $(MAKE) $(MKDOC)
./$(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
+ $(SHELL) $(srcdir)/../../move-if-change elf.tmp elf.texi
-s-elfcode: $(MKDOC) $(srcdir)/../elfcode.h $(srcdir)/doc.str
+elfcode.texi: chew.c $(srcdir)/../elfcode.h $(srcdir)/doc.str
+ $(MAKE) $(MKDOC)
./$(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
+ $(SHELL) $(srcdir)/../../move-if-change elfcode.tmp elfcode.texi
-s-mmo: $(MKDOC) $(srcdir)/../mmo.c $(srcdir)/doc.str
+mmo.texi: chew.c $(srcdir)/../mmo.c $(srcdir)/doc.str
+ $(MAKE) $(MKDOC)
./$(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
+ $(SHELL) $(srcdir)/../../move-if-change mmo.tmp mmo.texi
-s-format: $(MKDOC) $(srcdir)/../format.c $(srcdir)/doc.str
+format.texi: chew.c $(srcdir)/../format.c $(srcdir)/doc.str
+ $(MAKE) $(MKDOC)
./$(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
+ $(SHELL) $(srcdir)/../../move-if-change format.tmp format.texi
-s-libbfd: $(MKDOC) $(srcdir)/../libbfd.c $(srcdir)/doc.str
+libbfd.texi: chew.c $(srcdir)/../libbfd.c $(srcdir)/doc.str
+ $(MAKE) $(MKDOC)
./$(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
+ $(SHELL) $(srcdir)/../../move-if-change libbfd.tmp libbfd.texi
-s-bfdio: $(MKDOC) $(srcdir)/../bfdio.c $(srcdir)/doc.str
+bfdio.texi: chew.c $(srcdir)/../bfdio.c $(srcdir)/doc.str
+ $(MAKE) $(MKDOC)
./$(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
+ $(SHELL) $(srcdir)/../../move-if-change bfdio.tmp bfdio.texi
-s-bfdwin: $(MKDOC) $(srcdir)/../bfdwin.c $(srcdir)/doc.str
+bfdwin.texi: chew.c $(srcdir)/../bfdwin.c $(srcdir)/doc.str
+ $(MAKE) $(MKDOC)
./$(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
+ $(SHELL) $(srcdir)/../../move-if-change bfdwin.tmp bfdwin.texi
-s-opncls: $(MKDOC) $(srcdir)/../opncls.c $(srcdir)/doc.str
+opncls.texi: chew.c $(srcdir)/../opncls.c $(srcdir)/doc.str
+ $(MAKE) $(MKDOC)
./$(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
+ $(SHELL) $(srcdir)/../../move-if-change opncls.tmp opncls.texi
-s-reloc: $(MKDOC) $(srcdir)/../reloc.c $(srcdir)/doc.str
+reloc.texi: chew.c $(srcdir)/../reloc.c $(srcdir)/doc.str
+ $(MAKE) $(MKDOC)
./$(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
+ $(SHELL) $(srcdir)/../../move-if-change reloc.tmp reloc.texi
-s-section: $(MKDOC) $(srcdir)/../section.c $(srcdir)/doc.str
+section.texi: chew.c $(srcdir)/../section.c $(srcdir)/doc.str
+ $(MAKE) $(MKDOC)
./$(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
+ $(SHELL) $(srcdir)/../../move-if-change section.tmp section.texi
-s-syms: $(MKDOC) $(srcdir)/../syms.c $(srcdir)/doc.str
+syms.texi: chew.c $(srcdir)/../syms.c $(srcdir)/doc.str
+ $(MAKE) $(MKDOC)
./$(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
+ $(SHELL) $(srcdir)/../../move-if-change syms.tmp syms.texi
-s-targets: $(MKDOC) $(srcdir)/../targets.c $(srcdir)/doc.str
+targets.texi: chew.c $(srcdir)/../targets.c $(srcdir)/doc.str
+ $(MAKE) $(MKDOC)
./$(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
+ $(SHELL) $(srcdir)/../../move-if-change targets.tmp targets.texi
-s-init: $(MKDOC) $(srcdir)/../init.c $(srcdir)/doc.str
+init.texi: chew.c $(srcdir)/../init.c $(srcdir)/doc.str
+ $(MAKE) $(MKDOC)
./$(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
+ $(SHELL) $(srcdir)/../../move-if-change init.tmp init.texi
-s-hash: $(MKDOC) $(srcdir)/../hash.c $(srcdir)/doc.str
+hash.texi: chew.c $(srcdir)/../hash.c $(srcdir)/doc.str
+ $(MAKE) $(MKDOC)
./$(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
+ $(SHELL) $(srcdir)/../../move-if-change hash.tmp hash.texi
-s-linker: $(MKDOC) $(srcdir)/../linker.c $(srcdir)/doc.str
+linker.texi: chew.c $(srcdir)/../linker.c $(srcdir)/doc.str
+ $(MAKE) $(MKDOC)
./$(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
+ $(SHELL) $(srcdir)/../../move-if-change linker.tmp linker.texi
libbfd.h: $(LIBBFD_H_DEP)
echo "$(LIBBFD_H_DEP)" | sed -f $(srcdir)/header.sed > $@
@@ -665,10 +779,39 @@ bfd.h: $(BFD_H_DEP)
echo "#endif" >> $@
echo "#endif" >> $@
+bfdver.texi: $(srcdir)/Makefile.in
+ @echo "creating $@"; \
+ echo "@set VERSION $(VERSION)" > bfdver.texi; \
+ if [ -n "$(PKGVERSION)" ]; then \
+ echo "@set VERSION_PACKAGE $(PKGVERSION)" >> bfdver.texi; \
+ fi; \
+ echo "@set UPDATED `date '+%B %Y'`" >> bfdver.texi; \
+ if [ -n "$(REPORT_BUGS_TEXI)" ]; then \
+ echo "@set BUGURL $(REPORT_BUGS_TEXI)" >> bfdver.texi; \
+ fi
+
# We want install to imply install-info as per GNU standards, despite the
# cygnus option.
install: install-info
+install-html: install-html-am
+
+install-html-am: $(HTMLS)
+ @$(NORMAL_INSTALL)
+ test -z "$(htmldir)" || $(mkdir_p) "$(DESTDIR)$(htmldir)"
+ @list='$(HTMLS)'; for p in $$list; do \
+ if test -f "$$p" || test -d "$$p"; then d=""; else d="$(srcdir)/"; fi; \
+ f=$(html__strip_dir) \
+ if test -d "$$d$$p"; then \
+ echo " $(mkdir_p) '$(DESTDIR)$(htmldir)/$$f'"; \
+ $(mkdir_p) "$(DESTDIR)$(htmldir)/$$f" || exit 1; \
+ echo " $(INSTALL_DATA) '$$d$$p'/* '$(DESTDIR)$(htmldir)/$$f'"; \
+ $(INSTALL_DATA) "$$d$$p"/* "$(DESTDIR)$(htmldir)/$$f"; \
+ else \
+ echo " $(INSTALL_DATA) '$$d$$p' '$(DESTDIR)$(htmldir)/$$f'"; \
+ $(INSTALL_DATA) "$$d$$p" "$(DESTDIR)$(htmldir)/$$f"; \
+ fi; \
+ done
# 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.texinfo b/contrib/binutils/bfd/doc/bfd.texinfo
index 3ed4194..04b4266 100644
--- a/contrib/binutils/bfd/doc/bfd.texinfo
+++ b/contrib/binutils/bfd/doc/bfd.texinfo
@@ -1,22 +1,9 @@
\input texinfo.tex
@setfilename bfd.info
-@c Copyright 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1997, 2000, 2003
+@c Copyright 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1997, 2000,
+@c 2001, 2002, 2003, 2006, 2007
@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
@@ -27,26 +14,29 @@ END-INFO-DIR-ENTRY
@end format
@end ifinfo
-@ifinfo
+@copying
This file documents the BFD library.
-Copyright (C) 1991, 2000, 2001, 2003 Free Software Foundation, Inc.
+Copyright @copyright{} 1991, 2000, 2001, 2003, 2006, 2007 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''.
+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 ``GNU General Public License'' and ``Funding
+Free Software'', the Front-Cover texts being (a) (see below), and with
+the Back-Cover Texts being (b) (see below). 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).
+(a) The FSF's Front-Cover Text is:
-@end ignore
-@end ifinfo
+ A GNU Manual
+
+(b) The FSF's Back-Cover Text is:
+
+ You have freedom to copy and modify this GNU Manual, like GNU
+ software. Copies published by the Free Software Foundation raise
+ funds for GNU development.
+@end copying
@iftex
@c@finalout
@setchapternewpage on
@@ -56,7 +46,7 @@ notice identical to this one except for the removal of this paragraph
@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 First Edition---BFD version < 3.0 % Since no product is stable before version 3.0 :-)
@subtitle Original Document Created: April 1991
@author {Steve Chamberlain}
@author {Cygnus Support}
@@ -75,7 +65,7 @@ notice identical to this one except for the removal of this paragraph
@end tex
@vskip 0pt plus 1filll
-Copyright @copyright{} 1991, 2001, 2003 Free Software Foundation, Inc.
+Copyright @copyright{} 1991, 2001, 2003, 2006 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
@@ -86,6 +76,7 @@ Copyright @copyright{} 1991, 2001, 2003 Free Software Foundation, Inc.
@end titlepage
@end iftex
+@contents
@node Top, Overview, (dir), (dir)
@ifinfo
@@ -97,7 +88,7 @@ This file documents the binary file descriptor library libbfd.
* BFD front end:: BFD front end
* BFD back ends:: BFD back ends
* GNU Free Documentation License:: GNU Free Documentation License
-* Index:: Index
+* BFD Index:: BFD Index
@end menu
@node Overview, BFD front end, Top, Top
@@ -157,7 +148,7 @@ 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
+When an application successfully 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
@@ -307,6 +298,7 @@ structures.
@end ignore
@end menu
@node What to Put Where, aout, BFD back ends, BFD back ends
+@section What to Put Where
All of BFD lives in one directory.
@node aout, coff, What to Put Where, BFD back ends
@@ -323,11 +315,11 @@ All of BFD lives in one directory.
@node mmo, , elf, BFD back ends
@include mmo.texi
-@node GNU Free Documentation License, Index, BFD back ends, Top
+@node GNU Free Documentation License, BFD Index, BFD back ends, Top
@include fdl.texi
-@node Index, , GNU Free Documentation License, Top
-@unnumbered Index
+@node BFD Index, , GNU Free Documentation License, Top
+@unnumbered BFD Index
@printindex cp
@tex
@@ -345,5 +337,4 @@ All of BFD lives in one directory.
% 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
index 95c0096..b7e7c54 100644
--- a/contrib/binutils/bfd/doc/bfdint.texi
+++ b/contrib/binutils/bfd/doc/bfdint.texi
@@ -1,6 +1,6 @@
\input texinfo
@c Copyright 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1998,
-@c 2000, 2001, 2002, 2003
+@c 2000, 2001, 2002, 2003, 2004, 2006, 2007
@c Free Software Foundation, Inc.
@setfilename bfdint.info
@@ -13,6 +13,33 @@
@page
@end iftex
+@copying
+This file documents the internals of the BFD library.
+
+Copyright @copyright{} 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995,
+1996, 1998, 2000, 2001, 2002, 2003, 2004, 2006, 2007
+Free Software Foundation, Inc.
+Contributed by Cygnus Support.
+
+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 ``GNU General Public License'' and ``Funding
+Free Software'', the Front-Cover texts being (a) (see below), and with
+the Back-Cover Texts being (b) (see below). A copy of the license is
+included in the section entitled ``GNU Free Documentation License''.
+
+(a) The FSF's Front-Cover Text is:
+
+ A GNU Manual
+
+(b) The FSF's Back-Cover Text is:
+
+ You have freedom to copy and modify this GNU Manual, like GNU
+ software. Copies published by the Free Software Foundation raise
+ funds for GNU development.
+@end copying
+
@node Top
@top BFD Internals
@raisesections
@@ -189,7 +216,7 @@ 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
+large symbols, and requires that all small symbols 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
@@ -230,7 +257,7 @@ Follow the GNU coding standards.
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
+and they should be explicitly marked with @samp{const}. Instead of global
variables, use data attached to a BFD or to a linker hash table.
@item
@@ -1391,7 +1418,7 @@ constants used by the generic support.
@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.
+Relocatable object files conventionally have only sections.
Executables conventionally have both. Core files conventionally have
only program segments.
@@ -1744,23 +1771,6 @@ 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
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/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
index 7c060da..542fc2f 100644
--- a/contrib/binutils/bfd/doc/chew.c
+++ b/contrib/binutils/bfd/doc/chew.c
@@ -1,6 +1,6 @@
/* chew
Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1998, 2000, 2001,
- 2002, 2003
+ 2002, 2003, 2005
Free Software Foundation, Inc.
Contributed by steve chamberlain @cygnus
@@ -18,7 +18,7 @@ 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. */
+Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
/* Yet another way of extracting documentation from source.
No, I haven't finished it yet, but I hope you people like it better
@@ -83,10 +83,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
Foo. */
#include "ansidecl.h"
-#include "sysdep.h"
#include <assert.h>
#include <stdio.h>
#include <ctype.h>
+#include <stdlib.h>
+#include <string.h>
#define DEF_SIZE 5000
#define STACK 50
@@ -588,45 +589,6 @@ translatecomments ()
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 ()
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/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
index 176233c..a83ecf7 100644
--- a/contrib/binutils/bfd/doc/fdl.texi
+++ b/contrib/binutils/bfd/doc/fdl.texi
@@ -3,8 +3,8 @@
@center Version 1.1, March 2000
@display
-Copyright (C) 2000, Free Software Foundation, Inc.
-59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+Copyright (C) 2000, 2003 Free Software Foundation, Inc.
+51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
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/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/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
index 1047ebf..d722df3 100644
--- a/contrib/binutils/bfd/dwarf1.c
+++ b/contrib/binutils/bfd/dwarf1.c
@@ -1,26 +1,27 @@
/* DWARF 1 find nearest line (_bfd_dwarf1_find_nearest_line).
- Copyright 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
+ Copyright 1998, 1999, 2000, 2001, 2002, 2004, 2005, 2007
+ Free Software Foundation, Inc.
-Written by Gavin Romig-Koch of Cygnus Solutions (gavin@cygnus.com).
+ Written by Gavin Romig-Koch of Cygnus Solutions (gavin@cygnus.com).
-This file is part of BFD.
+ 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 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.
+ 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. */
+ 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., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libiberty.h"
#include "libbfd.h"
#include "elf-bfd.h"
@@ -28,8 +29,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
/* dwarf1_debug is the starting point for all dwarf1 info. */
-struct dwarf1_debug {
-
+struct dwarf1_debug
+{
/* The bfd we are working with. */
bfd* abfd;
@@ -55,7 +56,8 @@ struct dwarf1_debug {
/* One dwarf1_unit for each parsed compilation unit die. */
-struct dwarf1_unit {
+struct dwarf1_unit
+{
/* Linked starting from stash->lastUnit. */
struct dwarf1_unit* prev;
@@ -66,7 +68,7 @@ struct dwarf1_unit {
unsigned long low_pc;
unsigned long high_pc;
- /* Does this unit have a statement list? */
+ /* Does this unit have a statement list? */
int has_stmt_list;
/* If any, the offset of the line number table in the .line section. */
@@ -75,7 +77,7 @@ struct dwarf1_unit {
/* If non-zero, a pointer to the first child of this unit. */
char* first_child;
- /* How many line entries? */
+ /* How many line entries? */
unsigned long line_count;
/* The decoded line number table (line_count entries). */
@@ -87,7 +89,8 @@ struct dwarf1_unit {
/* One dwarf1_func for each parsed function die. */
-struct dwarf1_func {
+struct dwarf1_func
+{
/* Linked starting from aUnit->func_list. */
struct dwarf1_func* prev;
@@ -100,7 +103,8 @@ struct dwarf1_func {
};
/* Used to return info about a parsed die. */
-struct die_info {
+struct die_info
+{
unsigned long length;
unsigned long sibling;
unsigned long low_pc;
@@ -115,7 +119,8 @@ struct die_info {
};
/* Parsed line number information. */
-struct linenumber {
+struct linenumber
+{
/* First address in the line. */
unsigned long addr;
@@ -124,32 +129,17 @@ struct 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 *));
+#define FORM_FROM_ATTR(attr) ((attr) & 0xF) /* Implicitly specified. */
/* 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;
+alloc_dwarf1_unit (struct dwarf1_debug* stash)
{
bfd_size_type amt = sizeof (struct dwarf1_unit);
- struct dwarf1_unit* x = (struct dwarf1_unit*) bfd_zalloc (stash->abfd, amt);
+ struct dwarf1_unit* x = bfd_zalloc (stash->abfd, amt);
x->prev = stash->lastUnit;
stash->lastUnit = x;
@@ -159,14 +149,12 @@ alloc_dwarf1_unit (stash)
/* 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;
+static struct dwarf1_func *
+alloc_dwarf1_func (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);
+ struct dwarf1_func* x = bfd_zalloc (stash->abfd, amt);
x->prev = aUnit->func_list;
aUnit->func_list = x;
@@ -181,16 +169,15 @@ alloc_dwarf1_func (stash, aUnit)
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;
+parse_die (bfd * abfd,
+ struct die_info * aDieInfo,
+ char * aDiePtr,
+ char * aDiePtrEnd)
{
char* this_die = aDiePtr;
char* xptr = this_die;
- memset (aDieInfo,0,sizeof (*aDieInfo));
+ memset (aDieInfo, 0, sizeof (* aDieInfo));
/* First comes the length. */
aDieInfo->length = bfd_get_32 (abfd, (bfd_byte *) xptr);
@@ -217,7 +204,6 @@ parse_die (abfd, aDieInfo, aDiePtr, aDiePtrEnd)
/* 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;
@@ -269,9 +255,7 @@ parse_die (abfd, aDieInfo, aDiePtr, aDiePtrEnd)
occurs; TRUE otherwise. */
static bfd_boolean
-parse_line_table (stash, aUnit)
- struct dwarf1_debug* stash;
- struct dwarf1_unit* aUnit;
+parse_line_table (struct dwarf1_debug* stash, struct dwarf1_unit* aUnit)
{
char* xptr;
@@ -285,14 +269,14 @@ parse_line_table (stash, aUnit)
if (! msec)
return FALSE;
- size = bfd_get_section_size_before_reloc (msec);
- stash->line_section = (char *) bfd_alloc (stash->abfd, size);
+ size = msec->rawsize ? msec->rawsize : msec->size;
+ stash->line_section = 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))
+ 0, size))
{
stash->line_section = 0;
return FALSE;
@@ -318,13 +302,12 @@ parse_line_table (stash, aUnit)
xptr += 4;
/* How many line entrys?
- 10 = 4 (line number) + 2 (pos in line) + 4 (address in line) */
+ 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));
+ aUnit->linenumber_table = bfd_alloc (stash->abfd, amt);
for (eachLine = 0; eachLine < aUnit->line_count; eachLine++)
{
@@ -352,15 +335,13 @@ parse_line_table (stash, aUnit)
Return FALSE if error; TRUE otherwise. */
static bfd_boolean
-parse_functions_in_unit (stash, aUnit)
- struct dwarf1_debug* stash;
- struct dwarf1_unit* aUnit;
+parse_functions_in_unit (struct dwarf1_debug* stash, struct dwarf1_unit* aUnit)
{
char* eachDie;
if (aUnit->first_child)
for (eachDie = aUnit->first_child;
- eachDie < stash->debug_section_end;
+ eachDie < stash->debug_section_end;
)
{
struct die_info eachDieInfo;
@@ -395,15 +376,12 @@ parse_functions_in_unit (stash, 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;
+dwarf1_unit_find_nearest_line (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;
@@ -461,15 +439,13 @@ dwarf1_unit_find_nearest_line (stash, aUnit, addr,
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;
+_bfd_dwarf1_find_nearest_line (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;
@@ -488,28 +464,26 @@ _bfd_dwarf1_find_nearest_line (abfd, section, symbols, offset,
bfd_size_type size = sizeof (struct dwarf1_debug);
stash = elf_tdata (abfd)->dwarf1_find_line_info
- = (struct dwarf1_debug *) bfd_zalloc (abfd, size);
+ = 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;
- }
+ /* 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);
+ size = msec->rawsize ? msec->rawsize : msec->size;
+ stash->debug_section = bfd_alloc (abfd, size);
if (! stash->debug_section)
return FALSE;
if (! bfd_get_section_contents (abfd, msec, stash->debug_section,
- (bfd_vma) 0, size))
+ 0, size))
{
stash->debug_section = 0;
return FALSE;
@@ -529,13 +503,11 @@ _bfd_dwarf1_find_nearest_line (abfd, section, symbols, offset,
/* 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);
- }
+ 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)
{
@@ -582,5 +554,3 @@ _bfd_dwarf1_find_nearest_line (abfd, section, symbols, offset,
return FALSE;
}
-
-/* EOF */
diff --git a/contrib/binutils/bfd/dwarf2.c b/contrib/binutils/bfd/dwarf2.c
index 6182ea9..411a715 100644
--- a/contrib/binutils/bfd/dwarf2.c
+++ b/contrib/binutils/bfd/dwarf2.c
@@ -1,6 +1,6 @@
/* DWARF 2 support.
Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
- 2004 Free Software Foundation, Inc.
+ 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
Adapted from gdb/dwarf2read.c by Gavin Koch of Cygnus Solutions
(gavin@cygnus.com).
@@ -27,10 +27,10 @@
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. */
+ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libiberty.h"
#include "libbfd.h"
#include "elf-bfd.h"
@@ -71,47 +71,73 @@ struct attribute
struct dwarf_block
{
unsigned int size;
- char *data;
+ bfd_byte *data;
+};
+
+struct loadable_section
+{
+ asection *section;
+ bfd_vma adj_vma;
};
struct dwarf2_debug
{
/* A list of all previously read comp_units. */
- struct comp_unit* all_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;
+ bfd_byte *info_ptr;
/* Pointer to the end of the .debug_info section memory buffer. */
- char* info_ptr_end;
+ bfd_byte *info_ptr_end;
- /* Pointer to the section and address of the beginning of the
- section. */
- asection* sec;
- char* sec_info_ptr;
+ /* Pointer to the bfd, section and address of the beginning of the
+ section. The bfd might be different than expected because of
+ gnu_debuglink sections. */
+ bfd * bfd;
+ asection *sec;
+ bfd_byte *sec_info_ptr;
/* Pointer to the symbol table. */
- asymbol** syms;
+ asymbol **syms;
/* Pointer to the .debug_abbrev section loaded into memory. */
- char* dwarf_abbrev_buffer;
+ bfd_byte *dwarf_abbrev_buffer;
/* Length of the loaded .debug_abbrev section. */
unsigned long dwarf_abbrev_size;
/* Buffer for decode_line_info. */
- char *dwarf_line_buffer;
+ bfd_byte *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;
+ bfd_byte *dwarf_str_buffer;
/* Length of the loaded .debug_str section. */
unsigned long dwarf_str_size;
+
+ /* Pointer to the .debug_ranges section loaded into memory. */
+ bfd_byte *dwarf_ranges_buffer;
+
+ /* Length of the loaded .debug_ranges section. */
+ unsigned long dwarf_ranges_size;
+
+ /* If the most recent call to bfd_find_nearest_line was given an
+ address in an inlined function, preserve a pointer into the
+ calling chain for subsequent calls to bfd_find_inliner_info to
+ use. */
+ struct funcinfo *inliner_chain;
+
+ /* Number of loadable sections. */
+ unsigned int loadable_section_count;
+
+ /* Array of loadable sections. */
+ struct loadable_section *loadable_sections;
};
struct arange
@@ -127,44 +153,51 @@ struct arange
struct comp_unit
{
/* Chain the previously read compilation units. */
- struct comp_unit* next_unit;
+ struct comp_unit *next_unit;
- /* Keep the bdf convenient (for memory allocation). */
- bfd* abfd;
+ /* Keep the bfd convenient (for memory allocation). */
+ bfd *abfd;
- /* The lowest and higest addresses contained in this compilation
+ /* The lowest and highest 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;
+ char *name;
/* The abbrev hash table. */
- struct abbrev_info** abbrevs;
+ 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;
+ char *comp_dir;
/* TRUE if there is a line number table associated with this comp. unit. */
int stmtlist;
+ /* Pointer to the current comp_unit so that we can find a given entry
+ by its reference. */
+ bfd_byte *info_ptr_unit;
+
/* 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;
+ bfd_byte *first_child_die_ptr;
/* The end of the comp unit. */
- char *end_ptr;
+ bfd_byte *end_ptr;
/* The decoded line number, NULL if not yet decoded. */
- struct line_info_table* line_table;
+ struct line_info_table *line_table;
/* A list of the functions found in this comp. unit. */
- struct funcinfo* function_table;
+ struct funcinfo *function_table;
+
+ /* A list of the variables found in this comp. unit. */
+ struct varinfo *variable_table;
/* Pointer to dwarf2_debug structure. */
struct dwarf2_debug *stash;
@@ -174,6 +207,10 @@ struct comp_unit
/* Offset size for this unit - from unit header. */
unsigned char offset_size;
+
+ /* Base address for this unit - from DW_AT_low_pc attribute of
+ DW_TAG_compile_unit DIE */
+ bfd_vma base_address;
};
/* This data structure holds the information of an abbrev. */
@@ -207,38 +244,38 @@ struct attr_abbrev
/* Read dwarf information from a buffer. */
static unsigned int
-read_1_byte (bfd *abfd ATTRIBUTE_UNUSED, char *buf)
+read_1_byte (bfd *abfd ATTRIBUTE_UNUSED, bfd_byte *buf)
{
return bfd_get_8 (abfd, buf);
}
static int
-read_1_signed_byte (bfd *abfd ATTRIBUTE_UNUSED, char *buf)
+read_1_signed_byte (bfd *abfd ATTRIBUTE_UNUSED, bfd_byte *buf)
{
return bfd_get_signed_8 (abfd, buf);
}
static unsigned int
-read_2_bytes (bfd *abfd, char *buf)
+read_2_bytes (bfd *abfd, bfd_byte *buf)
{
return bfd_get_16 (abfd, buf);
}
static unsigned int
-read_4_bytes (bfd *abfd, char *buf)
+read_4_bytes (bfd *abfd, bfd_byte *buf)
{
return bfd_get_32 (abfd, buf);
}
static bfd_uint64_t
-read_8_bytes (bfd *abfd, char *buf)
+read_8_bytes (bfd *abfd, bfd_byte *buf)
{
return bfd_get_64 (abfd, buf);
}
-static char *
+static bfd_byte *
read_n_bytes (bfd *abfd ATTRIBUTE_UNUSED,
- char *buf,
+ bfd_byte *buf,
unsigned int size ATTRIBUTE_UNUSED)
{
/* If the size of a host char is 8 bits, we can return a pointer
@@ -249,27 +286,29 @@ read_n_bytes (bfd *abfd ATTRIBUTE_UNUSED,
static char *
read_string (bfd *abfd ATTRIBUTE_UNUSED,
- char *buf,
+ bfd_byte *buf,
unsigned int *bytes_read_ptr)
{
/* Return a pointer to the embedded string. */
- if (*buf == '\0')
+ char *str = (char *) buf;
+ if (*str == '\0')
{
*bytes_read_ptr = 1;
return NULL;
}
- *bytes_read_ptr = strlen (buf) + 1;
- return buf;
+ *bytes_read_ptr = strlen (str) + 1;
+ return str;
}
static char *
read_indirect_string (struct comp_unit* unit,
- char *buf,
+ bfd_byte *buf,
unsigned int *bytes_read_ptr)
{
bfd_uint64_t offset;
struct dwarf2_debug *stash = unit->stash;
+ char *str;
if (unit->offset_size == 4)
offset = read_4_bytes (unit->abfd, buf);
@@ -281,6 +320,7 @@ read_indirect_string (struct comp_unit* unit,
{
asection *msec;
bfd *abfd = unit->abfd;
+ bfd_size_type sz;
msec = bfd_get_section_by_name (abfd, ".debug_str");
if (! msec)
@@ -291,13 +331,14 @@ read_indirect_string (struct comp_unit* unit,
return NULL;
}
- stash->dwarf_str_size = msec->_raw_size;
- stash->dwarf_str_buffer = bfd_alloc (abfd, msec->_raw_size);
- if (! stash->dwarf_abbrev_buffer)
+ sz = msec->rawsize ? msec->rawsize : msec->size;
+ stash->dwarf_str_size = sz;
+ stash->dwarf_str_buffer = bfd_alloc (abfd, sz);
+ if (! stash->dwarf_str_buffer)
return NULL;
if (! bfd_get_section_contents (abfd, msec, stash->dwarf_str_buffer,
- 0, msec->_raw_size))
+ 0, sz))
return NULL;
}
@@ -309,88 +350,46 @@ read_indirect_string (struct comp_unit* unit,
return NULL;
}
- buf = stash->dwarf_str_buffer + offset;
- if (*buf == '\0')
+ str = (char *) stash->dwarf_str_buffer + offset;
+ if (*str == '\0')
return NULL;
- return buf;
+ return str;
}
-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;
-}
+/* END VERBATIM */
-static int
-read_signed_leb128 (bfd *abfd ATTRIBUTE_UNUSED,
- char *buf,
- unsigned int * bytes_read_ptr)
+static bfd_uint64_t
+read_address (struct comp_unit *unit, bfd_byte *buf)
{
- int result;
- int shift;
- int num_read;
- unsigned char byte;
-
- result = 0;
- shift = 0;
- num_read = 0;
+ int signed_vma = get_elf_backend_data (unit->abfd)->sign_extend_vma;
- do
+ if (signed_vma)
{
- byte = bfd_get_8 (abfd, buf);
- buf ++;
- num_read ++;
- result |= ((byte & 0x7f) << shift);
- shift += 7;
+ switch (unit->addr_size)
+ {
+ case 8:
+ return bfd_get_signed_64 (unit->abfd, buf);
+ case 4:
+ return bfd_get_signed_32 (unit->abfd, buf);
+ case 2:
+ return bfd_get_signed_16 (unit->abfd, buf);
+ default:
+ abort ();
+ }
}
- 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)
+ else
{
- 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 ();
+ 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 ();
+ }
}
}
@@ -425,7 +424,7 @@ static struct abbrev_info**
read_abbrevs (bfd *abfd, bfd_uint64_t offset, struct dwarf2_debug *stash)
{
struct abbrev_info **abbrevs;
- char *abbrev_ptr;
+ bfd_byte *abbrev_ptr;
struct abbrev_info *cur_abbrev;
unsigned int abbrev_number, bytes_read, abbrev_name;
unsigned int abbrev_form, hash_number;
@@ -443,7 +442,7 @@ read_abbrevs (bfd *abfd, bfd_uint64_t offset, struct dwarf2_debug *stash)
return 0;
}
- stash->dwarf_abbrev_size = msec->_raw_size;
+ stash->dwarf_abbrev_size = msec->size;
stash->dwarf_abbrev_buffer
= bfd_simple_get_relocated_section_contents (abfd, msec, NULL,
stash->syms);
@@ -490,11 +489,28 @@ read_abbrevs (bfd *abfd, bfd_uint64_t offset, struct dwarf2_debug *stash)
{
if ((cur_abbrev->num_attrs % ATTR_ALLOC_CHUNK) == 0)
{
+ struct attr_abbrev *tmp;
+
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;
+ tmp = bfd_realloc (cur_abbrev->attrs, amt);
+ if (tmp == NULL)
+ {
+ size_t i;
+
+ for (i = 0; i < ABBREV_HASH_SIZE; i++)
+ {
+ struct abbrev_info *abbrev = abbrevs[i];
+
+ while (abbrev)
+ {
+ free (abbrev->attrs);
+ abbrev = abbrev->next;
+ }
+ }
+ return NULL;
+ }
+ cur_abbrev->attrs = tmp;
}
cur_abbrev->attrs[cur_abbrev->num_attrs].name
@@ -519,7 +535,7 @@ read_abbrevs (bfd *abfd, bfd_uint64_t offset, struct dwarf2_debug *stash)
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)
+ >= stash->dwarf_abbrev_size)
break;
abbrev_number = read_unsigned_leb128 (abfd, abbrev_ptr, &bytes_read);
abbrev_ptr += bytes_read;
@@ -532,11 +548,11 @@ read_abbrevs (bfd *abfd, bfd_uint64_t offset, struct dwarf2_debug *stash)
/* Read an attribute value described by an attribute form. */
-static char *
+static bfd_byte *
read_attribute_value (struct attribute *attr,
unsigned form,
struct comp_unit *unit,
- char *info_ptr)
+ bfd_byte *info_ptr)
{
bfd *abfd = unit->abfd;
unsigned int bytes_read;
@@ -660,11 +676,11 @@ read_attribute_value (struct attribute *attr,
/* Read an attribute described by an abbreviated attribute. */
-static char *
+static bfd_byte *
read_attribute (struct attribute *attr,
struct attr_abbrev *abbrev,
struct comp_unit *unit,
- char *info_ptr)
+ bfd_byte *info_ptr)
{
attr->name = abbrev->name;
info_ptr = read_attribute_value (attr, abbrev->form, unit, info_ptr);
@@ -680,7 +696,7 @@ struct line_info
{
struct line_info* prev_line;
bfd_vma address;
- char* filename;
+ char *filename;
unsigned int line;
unsigned int column;
int end_sequence; /* End of (sequential) code sequence. */
@@ -699,21 +715,60 @@ struct line_info_table
bfd* abfd;
unsigned int num_files;
unsigned int num_dirs;
- char* comp_dir;
- char** 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' */
};
+/* Remember some information about each function. If the function is
+ inlined (DW_TAG_inlined_subroutine) it may have two additional
+ attributes, DW_AT_call_file and DW_AT_call_line, which specify the
+ source code location where this function was inlined. */
+
struct funcinfo
{
- struct funcinfo *prev_func;
- char* name;
- bfd_vma low;
- bfd_vma high;
+ struct funcinfo *prev_func; /* Pointer to previous function in list of all functions */
+ struct funcinfo *caller_func; /* Pointer to function one scope higher */
+ char *caller_file; /* Source location file name where caller_func inlines this func */
+ int caller_line; /* Source location line number where caller_func inlines this func */
+ char *file; /* Source location file name */
+ int line; /* Source location line number */
+ int tag;
+ char *name;
+ struct arange arange;
+ asection *sec; /* Where the symbol is defined */
+};
+
+struct varinfo
+{
+ /* Pointer to previous variable in list of all variables */
+ struct varinfo *prev_var;
+ /* Source location file name */
+ char *file;
+ /* Source location line number */
+ int line;
+ int tag;
+ char *name;
+ bfd_vma addr;
+ /* Where the symbol is defined */
+ asection *sec;
+ /* Is this a stack variable? */
+ unsigned int stack: 1;
};
+/* Return TRUE if NEW_LINE should sort after LINE. */
+
+static inline bfd_boolean
+new_line_sorts_after (struct line_info *new_line, struct line_info *line)
+{
+ return (new_line->address > line->address
+ || (new_line->address == line->address
+ && new_line->end_sequence < line->end_sequence));
+}
+
+
/* 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,
@@ -730,6 +785,21 @@ add_line_info (struct line_info_table *table,
bfd_size_type amt = sizeof (struct line_info);
struct line_info* info = bfd_alloc (table->abfd, amt);
+ /* 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;
+
/* 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
@@ -745,70 +815,45 @@ add_line_info (struct line_info_table *table,
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 (!table->last_line
+ || new_line_sorts_after (info, table->last_line))
+ {
+ /* Normal case: add 'info' to the beginning of the list */
+ info->prev_line = table->last_line;
+ table->last_line = info;
- if (filename && filename[0])
+ /* lcl_head: initialize to head a *possible* sequence at the end. */
+ if (!table->lcl_head)
+ table->lcl_head = info;
+ }
+ else if (!new_line_sorts_after (info, table->lcl_head)
+ && (!table->lcl_head->prev_line
+ || new_line_sorts_after (info, table->lcl_head->prev_line)))
{
- info->filename = bfd_alloc (table->abfd, strlen (filename) + 1);
- if (info->filename)
- strcpy (info->filename, filename);
+ /* Abnormal but easy: lcl_head is the head of 'info'. */
+ info->prev_line = table->lcl_head->prev_line;
+ table->lcl_head->prev_line = info;
}
else
- info->filename = NULL;
+ {
+ /* Abnormal and hard: Neither 'last_line' nor 'lcl_head' are valid
+ heads for 'info'. Reset 'lcl_head'. */
+ struct line_info* li2 = table->last_line; /* always non-NULL */
+ struct line_info* li1 = li2->prev_line;
+
+ while (li1)
+ {
+ if (!new_line_sorts_after (info, li2)
+ && new_line_sorts_after (info, li1))
+ break;
+
+ li2 = li1; /* always non-NULL */
+ li1 = li1->prev_line;
+ }
+ table->lcl_head = li2;
+ info->prev_line = table->lcl_head->prev_line;
+ table->lcl_head->prev_line = info;
+ }
}
/* Extract a fully qualified filename from a line info table.
@@ -818,48 +863,78 @@ add_line_info (struct line_info_table *table,
static char *
concat_filename (struct line_info_table *table, unsigned int file)
{
- char* filename;
+ char *filename;
if (file - 1 >= table->num_files)
{
- (*_bfd_error_handler)
- (_("Dwarf Error: mangled line number section (bad file number)."));
+ /* FILE == 0 means unknown. */
+ if (file)
+ (*_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))
+ if (!IS_ABSOLUTE_PATH (filename))
{
- char* dirname = (table->files[file - 1].dir
- ? table->dirs[table->files[file - 1].dir - 1]
- : table->comp_dir);
+ char *dirname = NULL;
+ char *subdirname = NULL;
+ char *name;
+ size_t len;
+
+ if (table->files[file - 1].dir)
+ subdirname = table->dirs[table->files[file - 1].dir - 1];
+
+ if (!subdirname || !IS_ABSOLUTE_PATH (subdirname))
+ dirname = 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)
+ if (!dirname)
{
- unsigned int len = strlen (dirname) + strlen (filename) + 2;
- char * name;
+ dirname = subdirname;
+ subdirname = NULL;
+ }
+
+ if (!dirname)
+ return strdup (filename);
+ len = strlen (dirname) + strlen (filename) + 2;
+
+ if (subdirname)
+ {
+ len += strlen (subdirname) + 1;
+ name = bfd_malloc (len);
+ if (name)
+ sprintf (name, "%s/%s/%s", dirname, subdirname, filename);
+ }
+ else
+ {
name = bfd_malloc (len);
if (name)
sprintf (name, "%s/%s", dirname, filename);
- return name;
}
+
+ return name;
}
return strdup (filename);
}
static void
-arange_add (struct comp_unit *unit, bfd_vma low_pc, bfd_vma high_pc)
+arange_add (bfd *abfd, struct arange *first_arange, bfd_vma low_pc, bfd_vma high_pc)
{
struct arange *arange;
- /* First see if we can cheaply extend an existing range. */
- arange = &unit->arange;
+ /* If the first arange is empty, use it. */
+ if (first_arange->high == 0)
+ {
+ first_arange->low = low_pc;
+ first_arange->high = high_pc;
+ return;
+ }
+ /* Next see if we can cheaply extend an existing range. */
+ arange = first_arange;
do
{
if (low_pc == arange->high)
@@ -876,22 +951,13 @@ arange_add (struct comp_unit *unit, bfd_vma low_pc, bfd_vma high_pc)
}
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));
+ /* Need to allocate a new arange and insert it into the arange list.
+ Order isn't significant, so just insert after the first arange. */
+ arange = bfd_zalloc (abfd, sizeof (*arange));
arange->low = low_pc;
arange->high = high_pc;
-
- arange->next = unit->arange.next;
- unit->arange.next = arange;
+ arange->next = first_arange->next;
+ first_arange->next = arange;
}
/* Decode the line number information for UNIT. */
@@ -901,8 +967,8 @@ 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;
+ bfd_byte *line_ptr;
+ bfd_byte *line_end;
struct line_head lh;
unsigned int i, bytes_read, offset_size;
char *cur_file, *cur_dir;
@@ -921,7 +987,7 @@ decode_line_info (struct comp_unit *unit, struct dwarf2_debug *stash)
return 0;
}
- stash->dwarf_line_size = msec->_raw_size;
+ stash->dwarf_line_size = msec->size;
stash->dwarf_line_buffer
= bfd_simple_get_relocated_section_contents (abfd, msec, NULL,
stash->syms);
@@ -1009,11 +1075,18 @@ decode_line_info (struct comp_unit *unit, struct dwarf2_debug *stash)
if ((table->num_dirs % DIR_ALLOC_CHUNK) == 0)
{
+ char **tmp;
+
amt = table->num_dirs + DIR_ALLOC_CHUNK;
amt *= sizeof (char *);
- table->dirs = bfd_realloc (table->dirs, amt);
- if (! table->dirs)
- return 0;
+
+ tmp = bfd_realloc (table->dirs, amt);
+ if (tmp == NULL)
+ {
+ free (table->dirs);
+ return NULL;
+ }
+ table->dirs = tmp;
}
table->dirs[table->num_dirs++] = cur_dir;
@@ -1028,11 +1101,19 @@ decode_line_info (struct comp_unit *unit, struct dwarf2_debug *stash)
if ((table->num_files % FILE_ALLOC_CHUNK) == 0)
{
+ struct fileinfo *tmp;
+
amt = table->num_files + FILE_ALLOC_CHUNK;
amt *= sizeof (struct fileinfo);
- table->files = bfd_realloc (table->files, amt);
- if (! table->files)
- return 0;
+
+ tmp = bfd_realloc (table->files, amt);
+ if (tmp == NULL)
+ {
+ free (table->files);
+ free (table->dirs);
+ return NULL;
+ }
+ table->files = tmp;
}
table->files[table->num_files].name = cur_file;
@@ -1059,14 +1140,13 @@ decode_line_info (struct comp_unit *unit, struct dwarf2_debug *stash)
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 low_pc = (bfd_vma) -1;
bfd_vma high_pc = 0;
/* Decode the table. */
@@ -1084,8 +1164,7 @@ decode_line_info (struct comp_unit *unit, struct dwarf2_debug *stash)
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)
+ if (address < low_pc)
low_pc = address;
if (address > high_pc)
high_pc = address;
@@ -1104,11 +1183,11 @@ decode_line_info (struct comp_unit *unit, struct dwarf2_debug *stash)
end_sequence = 1;
add_line_info (table, address, filename, line, column,
end_sequence);
- if (low_pc == 0 || address < low_pc)
+ if (address < low_pc)
low_pc = address;
if (address > high_pc)
high_pc = address;
- arange_add (unit, low_pc, high_pc);
+ arange_add (unit->abfd, &unit->arange, low_pc, high_pc);
break;
case DW_LNE_set_address:
address = read_address (unit, line_ptr);
@@ -1119,11 +1198,19 @@ decode_line_info (struct comp_unit *unit, struct dwarf2_debug *stash)
line_ptr += bytes_read;
if ((table->num_files % FILE_ALLOC_CHUNK) == 0)
{
+ struct fileinfo *tmp;
+
amt = table->num_files + FILE_ALLOC_CHUNK;
amt *= sizeof (struct fileinfo);
- table->files = bfd_realloc (table->files, amt);
- if (! table->files)
- return 0;
+ tmp = bfd_realloc (table->files, amt);
+ if (tmp == NULL)
+ {
+ free (table->files);
+ free (table->dirs);
+ free (filename);
+ return NULL;
+ }
+ table->files = tmp;
}
table->files[table->num_files].name = cur_file;
table->files[table->num_files].dir =
@@ -1140,13 +1227,15 @@ decode_line_info (struct comp_unit *unit, struct dwarf2_debug *stash)
default:
(*_bfd_error_handler) (_("Dwarf Error: mangled line number section."));
bfd_set_error (bfd_error_bad_value);
- return 0;
+ free (filename);
+ free (table->files);
+ free (table->dirs);
+ return NULL;
}
break;
case DW_LNS_copy:
add_line_info (table, address, filename, line, column, 0);
- basic_block = 0;
- if (low_pc == 0 || address < low_pc)
+ if (address < low_pc)
low_pc = address;
if (address > high_pc)
high_pc = address;
@@ -1181,7 +1270,6 @@ decode_line_info (struct comp_unit *unit, struct dwarf2_debug *stash)
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
@@ -1244,7 +1332,7 @@ lookup_address_in_line_info_table (struct line_info_table *table,
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)
+ if (each_line->address <= addr && addr < next_line->address)
{
addr_match = TRUE;
@@ -1252,12 +1340,34 @@ lookup_address_in_line_info_table (struct line_info_table *table,
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)
+
+ if (function != NULL)
{
- *filename_ptr = next_line->filename;
- *linenumber_ptr = next_line->line;
+ bfd_vma lowest_pc;
+ struct arange *arange;
+
+ /* Find the lowest address in the function's range list */
+ lowest_pc = function->arange.low;
+ for (arange = &function->arange;
+ arange;
+ arange = arange->next)
+ {
+ if (function->arange.low < lowest_pc)
+ lowest_pc = function->arange.low;
+ }
+ /* Check for spanning function and set outgoing line info */
+ if (addr >= lowest_pc
+ && each_line->address < lowest_pc
+ && next_line->address > lowest_pc)
+ {
+ *filename_ptr = next_line->filename;
+ *linenumber_ptr = next_line->line;
+ }
+ else
+ {
+ *filename_ptr = each_line->filename;
+ *linenumber_ptr = each_line->line;
+ }
}
else
{
@@ -1289,44 +1399,276 @@ lookup_address_in_line_info_table (struct line_info_table *table,
return FALSE;
}
+/* Read in the .debug_ranges section for future reference */
+
+static bfd_boolean
+read_debug_ranges (struct comp_unit *unit)
+{
+ struct dwarf2_debug *stash = unit->stash;
+ if (! stash->dwarf_ranges_buffer)
+ {
+ bfd *abfd = unit->abfd;
+ asection *msec;
+
+ msec = bfd_get_section_by_name (abfd, ".debug_ranges");
+ if (! msec)
+ {
+ (*_bfd_error_handler) (_("Dwarf Error: Can't find .debug_ranges section."));
+ bfd_set_error (bfd_error_bad_value);
+ return FALSE;
+ }
+
+ stash->dwarf_ranges_size = msec->size;
+ stash->dwarf_ranges_buffer
+ = bfd_simple_get_relocated_section_contents (abfd, msec, NULL,
+ stash->syms);
+ if (! stash->dwarf_ranges_buffer)
+ return FALSE;
+ }
+ return TRUE;
+}
+
/* Function table functions. */
-/* If ADDR is within TABLE, set FUNCTIONNAME_PTR, and return TRUE. */
+/* If ADDR is within TABLE, set FUNCTIONNAME_PTR, and return TRUE.
+ Note that we need to find the function that has the smallest
+ range that contains ADDR, to handle inlined functions without
+ depending upon them being ordered in TABLE by increasing range. */
static bfd_boolean
-lookup_address_in_function_table (struct funcinfo *table,
+lookup_address_in_function_table (struct comp_unit *unit,
bfd_vma addr,
struct funcinfo **function_ptr,
const char **functionname_ptr)
{
struct funcinfo* each_func;
+ struct funcinfo* best_fit = NULL;
+ struct arange *arange;
- for (each_func = table;
+ for (each_func = unit->function_table;
each_func;
each_func = each_func->prev_func)
{
- if (addr >= each_func->low && addr < each_func->high)
+ for (arange = &each_func->arange;
+ arange;
+ arange = arange->next)
{
- *functionname_ptr = each_func->name;
- *function_ptr = each_func;
- return TRUE;
+ if (addr >= arange->low && addr < arange->high)
+ {
+ if (!best_fit ||
+ ((arange->high - arange->low) < (best_fit->arange.high - best_fit->arange.low)))
+ best_fit = each_func;
+ }
}
}
- return FALSE;
+ if (best_fit)
+ {
+ *functionname_ptr = best_fit->name;
+ *function_ptr = best_fit;
+ return TRUE;
+ }
+ else
+ {
+ return FALSE;
+ }
+}
+
+/* If SYM at ADDR is within function table of UNIT, set FILENAME_PTR
+ and LINENUMBER_PTR, and return TRUE. */
+
+static bfd_boolean
+lookup_symbol_in_function_table (struct comp_unit *unit,
+ asymbol *sym,
+ bfd_vma addr,
+ const char **filename_ptr,
+ unsigned int *linenumber_ptr)
+{
+ struct funcinfo* each_func;
+ struct funcinfo* best_fit = NULL;
+ struct arange *arange;
+ const char *name = bfd_asymbol_name (sym);
+ asection *sec = bfd_get_section (sym);
+
+ for (each_func = unit->function_table;
+ each_func;
+ each_func = each_func->prev_func)
+ {
+ for (arange = &each_func->arange;
+ arange;
+ arange = arange->next)
+ {
+ if ((!each_func->sec || each_func->sec == sec)
+ && addr >= arange->low
+ && addr < arange->high
+ && each_func->name
+ && strcmp (name, each_func->name) == 0
+ && (!best_fit
+ || ((arange->high - arange->low)
+ < (best_fit->arange.high - best_fit->arange.low))))
+ best_fit = each_func;
+ }
+ }
+
+ if (best_fit)
+ {
+ best_fit->sec = sec;
+ *filename_ptr = best_fit->file;
+ *linenumber_ptr = best_fit->line;
+ return TRUE;
+ }
+ else
+ return FALSE;
+}
+
+/* Variable table functions. */
+
+/* If SYM is within variable table of UNIT, set FILENAME_PTR and
+ LINENUMBER_PTR, and return TRUE. */
+
+static bfd_boolean
+lookup_symbol_in_variable_table (struct comp_unit *unit,
+ asymbol *sym,
+ bfd_vma addr,
+ const char **filename_ptr,
+ unsigned int *linenumber_ptr)
+{
+ const char *name = bfd_asymbol_name (sym);
+ asection *sec = bfd_get_section (sym);
+ struct varinfo* each;
+
+ for (each = unit->variable_table; each; each = each->prev_var)
+ if (each->stack == 0
+ && each->file != NULL
+ && each->name != NULL
+ && each->addr == addr
+ && (!each->sec || each->sec == sec)
+ && strcmp (name, each->name) == 0)
+ break;
+
+ if (each)
+ {
+ each->sec = sec;
+ *filename_ptr = each->file;
+ *linenumber_ptr = each->line;
+ return TRUE;
+ }
+ else
+ return FALSE;
+}
+
+static char *
+find_abstract_instance_name (struct comp_unit *unit, bfd_uint64_t die_ref)
+{
+ bfd *abfd = unit->abfd;
+ bfd_byte *info_ptr;
+ unsigned int abbrev_number, bytes_read, i;
+ struct abbrev_info *abbrev;
+ struct attribute attr;
+ char *name = 0;
+
+ info_ptr = unit->info_ptr_unit + die_ref;
+ abbrev_number = read_unsigned_leb128 (abfd, info_ptr, &bytes_read);
+ info_ptr += bytes_read;
+
+ if (abbrev_number)
+ {
+ 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);
+ }
+ else
+ {
+ for (i = 0; i < abbrev->num_attrs; ++i)
+ {
+ info_ptr = read_attribute (&attr, &abbrev->attrs[i], unit, info_ptr);
+ switch (attr.name)
+ {
+ case DW_AT_name:
+ /* Prefer DW_AT_MIPS_linkage_name over DW_AT_name. */
+ if (name == NULL)
+ name = attr.u.str;
+ break;
+ case DW_AT_specification:
+ name = find_abstract_instance_name (unit, attr.u.val);
+ break;
+ case DW_AT_MIPS_linkage_name:
+ name = attr.u.str;
+ break;
+ default:
+ break;
+ }
+ }
+ }
+ }
+ return (name);
+}
+
+static void
+read_rangelist (struct comp_unit *unit, struct arange *arange, bfd_uint64_t offset)
+{
+ bfd_byte *ranges_ptr;
+ bfd_vma base_address = unit->base_address;
+
+ if (! unit->stash->dwarf_ranges_buffer)
+ {
+ if (! read_debug_ranges (unit))
+ return;
+ }
+ ranges_ptr = unit->stash->dwarf_ranges_buffer + offset;
+
+ for (;;)
+ {
+ bfd_vma low_pc;
+ bfd_vma high_pc;
+
+ if (unit->addr_size == 4)
+ {
+ low_pc = read_4_bytes (unit->abfd, ranges_ptr);
+ ranges_ptr += 4;
+ high_pc = read_4_bytes (unit->abfd, ranges_ptr);
+ ranges_ptr += 4;
+ }
+ else
+ {
+ low_pc = read_8_bytes (unit->abfd, ranges_ptr);
+ ranges_ptr += 8;
+ high_pc = read_8_bytes (unit->abfd, ranges_ptr);
+ ranges_ptr += 8;
+ }
+ if (low_pc == 0 && high_pc == 0)
+ break;
+ if (low_pc == -1UL && high_pc != -1UL)
+ base_address = high_pc;
+ else
+ arange_add (unit->abfd, arange, base_address + low_pc, base_address + high_pc);
+ }
}
/* DWARF2 Compilation unit functions. */
/* Scan over each die in a comp. unit looking for functions to add
- to the function table. */
+ to the function table and variables to the variable table. */
static bfd_boolean
-scan_unit_for_functions (struct comp_unit *unit)
+scan_unit_for_symbols (struct comp_unit *unit)
{
bfd *abfd = unit->abfd;
- char *info_ptr = unit->first_child_die_ptr;
+ bfd_byte *info_ptr = unit->first_child_die_ptr;
int nesting_level = 1;
+ struct funcinfo **nested_funcs;
+ int nested_funcs_size;
+
+ /* Maintain a stack of in-scope functions and inlined functions, which we
+ can use to set the caller_func field. */
+ nested_funcs_size = 32;
+ nested_funcs = bfd_malloc (nested_funcs_size * sizeof (struct funcinfo *));
+ if (nested_funcs == NULL)
+ return FALSE;
+ nested_funcs[nesting_level] = 0;
while (nesting_level)
{
@@ -1334,7 +1676,9 @@ scan_unit_for_functions (struct comp_unit *unit)
struct abbrev_info *abbrev;
struct attribute attr;
struct funcinfo *func;
- char* name = 0;
+ struct varinfo *var;
+ bfd_vma low_pc = 0;
+ bfd_vma high_pc = 0;
abbrev_number = read_unsigned_leb128 (abfd, info_ptr, &bytes_read);
info_ptr += bytes_read;
@@ -1351,18 +1695,46 @@ scan_unit_for_functions (struct comp_unit *unit)
(*_bfd_error_handler) (_("Dwarf Error: Could not find abbrev number %u."),
abbrev_number);
bfd_set_error (bfd_error_bad_value);
+ free (nested_funcs);
return FALSE;
}
- if (abbrev->tag == DW_TAG_subprogram)
+ var = NULL;
+ if (abbrev->tag == DW_TAG_subprogram
+ || abbrev->tag == DW_TAG_entry_point
+ || abbrev->tag == DW_TAG_inlined_subroutine)
{
bfd_size_type amt = sizeof (struct funcinfo);
func = bfd_zalloc (abfd, amt);
+ func->tag = abbrev->tag;
func->prev_func = unit->function_table;
unit->function_table = func;
+
+ if (func->tag == DW_TAG_inlined_subroutine)
+ for (i = nesting_level - 1; i >= 1; i--)
+ if (nested_funcs[i])
+ {
+ func->caller_func = nested_funcs[i];
+ break;
+ }
+ nested_funcs[nesting_level] = func;
}
else
- func = NULL;
+ {
+ func = NULL;
+ if (abbrev->tag == DW_TAG_variable)
+ {
+ bfd_size_type amt = sizeof (struct varinfo);
+ var = bfd_zalloc (abfd, amt);
+ var->tag = abbrev->tag;
+ var->stack = 1;
+ var->prev_var = unit->variable_table;
+ unit->variable_table = var;
+ }
+
+ /* No inline function in scope at this nesting level. */
+ nested_funcs[nesting_level] = 0;
+ }
for (i = 0; i < abbrev->num_attrs; ++i)
{
@@ -1372,10 +1744,19 @@ scan_unit_for_functions (struct comp_unit *unit)
{
switch (attr.name)
{
- case DW_AT_name:
+ case DW_AT_call_file:
+ func->caller_file = concat_filename (unit->line_table, attr.u.val);
+ break;
- name = attr.u.str;
+ case DW_AT_call_line:
+ func->caller_line = attr.u.val;
+ break;
+
+ case DW_AT_abstract_origin:
+ func->name = find_abstract_instance_name (unit, attr.u.val);
+ break;
+ case DW_AT_name:
/* Prefer DW_AT_MIPS_linkage_name over DW_AT_name. */
if (func->name == NULL)
func->name = attr.u.str;
@@ -1386,23 +1767,79 @@ scan_unit_for_functions (struct comp_unit *unit)
break;
case DW_AT_low_pc:
- func->low = attr.u.val;
+ low_pc = attr.u.val;
break;
case DW_AT_high_pc:
- func->high = attr.u.val;
+ high_pc = attr.u.val;
+ break;
+
+ case DW_AT_ranges:
+ read_rangelist (unit, &func->arange, attr.u.val);
+ break;
+
+ case DW_AT_decl_file:
+ func->file = concat_filename (unit->line_table,
+ attr.u.val);
+ break;
+
+ case DW_AT_decl_line:
+ func->line = attr.u.val;
break;
default:
break;
}
}
- else
+ else if (var)
{
switch (attr.name)
{
case DW_AT_name:
- name = attr.u.str;
+ var->name = attr.u.str;
+ break;
+
+ case DW_AT_decl_file:
+ var->file = concat_filename (unit->line_table,
+ attr.u.val);
+ break;
+
+ case DW_AT_decl_line:
+ var->line = attr.u.val;
+ break;
+
+ case DW_AT_external:
+ if (attr.u.val != 0)
+ var->stack = 0;
+ break;
+
+ case DW_AT_location:
+ switch (attr.form)
+ {
+ case DW_FORM_block:
+ case DW_FORM_block1:
+ case DW_FORM_block2:
+ case DW_FORM_block4:
+ if (*attr.u.blk->data == DW_OP_addr)
+ {
+ var->stack = 0;
+
+ /* Verify that DW_OP_addr is the only opcode in the
+ location, in which case the block size will be 1
+ plus the address size. */
+ /* ??? For TLS variables, gcc can emit
+ DW_OP_addr <addr> DW_OP_GNU_push_tls_address
+ which we don't handle here yet. */
+ if (attr.u.blk->size == unit->addr_size + 1U)
+ var->addr = bfd_get (unit->addr_size * 8,
+ unit->abfd,
+ attr.u.blk->data + 1);
+ }
+ break;
+
+ default:
+ break;
+ }
break;
default:
@@ -1411,10 +1848,35 @@ scan_unit_for_functions (struct comp_unit *unit)
}
}
+ if (func && high_pc != 0)
+ {
+ arange_add (unit->abfd, &func->arange, low_pc, high_pc);
+ }
+
if (abbrev->has_children)
- nesting_level++;
+ {
+ nesting_level++;
+
+ if (nesting_level >= nested_funcs_size)
+ {
+ struct funcinfo **tmp;
+
+ nested_funcs_size *= 2;
+ tmp = bfd_realloc (nested_funcs,
+ (nested_funcs_size
+ * sizeof (struct funcinfo *)));
+ if (tmp == NULL)
+ {
+ free (nested_funcs);
+ return FALSE;
+ }
+ nested_funcs = tmp;
+ }
+ nested_funcs[nesting_level] = 0;
+ }
}
+ free (nested_funcs);
return TRUE;
}
@@ -1428,9 +1890,9 @@ scan_unit_for_functions (struct comp_unit *unit)
to get to the line number information for the compilation unit. */
static struct comp_unit *
-parse_comp_unit (bfd *abfd,
- struct dwarf2_debug *stash,
+parse_comp_unit (struct dwarf2_debug *stash,
bfd_vma unit_length,
+ bfd_byte *info_ptr_unit,
unsigned int offset_size)
{
struct comp_unit* unit;
@@ -1441,9 +1903,12 @@ parse_comp_unit (bfd *abfd,
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_byte *info_ptr = stash->info_ptr;
+ bfd_byte *end_ptr = info_ptr + unit_length;
bfd_size_type amt;
+ bfd_vma low_pc = 0;
+ bfd_vma high_pc = 0;
+ bfd *abfd = stash->bfd;
version = read_2_bytes (abfd, info_ptr);
info_ptr += 2;
@@ -1511,6 +1976,7 @@ parse_comp_unit (bfd *abfd,
unit->abbrevs = abbrevs;
unit->end_ptr = end_ptr;
unit->stash = stash;
+ unit->info_ptr_unit = info_ptr_unit;
for (i = 0; i < abbrev->num_attrs; ++i)
{
@@ -1530,16 +1996,24 @@ parse_comp_unit (bfd *abfd,
break;
case DW_AT_low_pc:
- unit->arange.low = attr.u.val;
+ low_pc = attr.u.val;
+ /* If the compilation unit DIE has a DW_AT_low_pc attribute,
+ this is the base address to use when reading location
+ lists or range lists. */
+ unit->base_address = low_pc;
break;
case DW_AT_high_pc:
- unit->arange.high = attr.u.val;
+ high_pc = attr.u.val;
+ break;
+
+ case DW_AT_ranges:
+ read_rangelist (unit, &unit->arange, attr.u.val);
break;
case DW_AT_comp_dir:
{
- char* comp_dir = attr.u.str;
+ char *comp_dir = attr.u.str;
if (comp_dir)
{
/* Irix 6.2 native cc prepends <machine>.: to the compilation
@@ -1557,12 +2031,20 @@ parse_comp_unit (bfd *abfd,
break;
}
}
+ if (high_pc != 0)
+ {
+ arange_add (unit->abfd, &unit->arange, low_pc, high_pc);
+ }
unit->first_child_die_ptr = info_ptr;
return unit;
}
-/* Return TRUE if UNIT contains the address given by ADDR. */
+/* Return TRUE if UNIT may contain the address given by ADDR. When
+ there are functions written entirely with inline asm statements, the
+ range info in the compilation unit header may not be correct. We
+ need to consult the line info table to see if a compilation unit
+ really contains the given address. */
static bfd_boolean
comp_unit_contains_address (struct comp_unit *unit, bfd_vma addr)
@@ -1624,7 +2106,7 @@ comp_unit_find_nearest_line (struct comp_unit *unit,
}
if (unit->first_child_die_ptr < unit->end_ptr
- && ! scan_unit_for_functions (unit))
+ && ! scan_unit_for_symbols (unit))
{
unit->error = 1;
return FALSE;
@@ -1632,14 +2114,69 @@ comp_unit_find_nearest_line (struct comp_unit *unit,
}
function = NULL;
- func_p = lookup_address_in_function_table (unit->function_table, addr,
+ func_p = lookup_address_in_function_table (unit, addr,
&function, functionname_ptr);
+ if (func_p && (function->tag == DW_TAG_inlined_subroutine))
+ stash->inliner_chain = function;
line_p = lookup_address_in_line_info_table (unit->line_table, addr,
function, filename_ptr,
linenumber_ptr);
return line_p || func_p;
}
+/* If UNIT contains SYM at ADDR, set the output parameters to the
+ values for the line containing SYM. The output parameters,
+ FILENAME_PTR, and LINENUMBER_PTR, are pointers to the objects to be
+ filled in.
+
+ Return TRUE if UNIT contains SYM, and no errors were encountered;
+ FALSE otherwise. */
+
+static bfd_boolean
+comp_unit_find_line (struct comp_unit *unit,
+ asymbol *sym,
+ bfd_vma addr,
+ const char **filename_ptr,
+ unsigned int *linenumber_ptr,
+ struct dwarf2_debug *stash)
+{
+ 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_symbols (unit))
+ {
+ unit->error = 1;
+ return FALSE;
+ }
+ }
+
+ if (sym->flags & BSF_FUNCTION)
+ return lookup_symbol_in_function_table (unit, sym, addr,
+ filename_ptr,
+ linenumber_ptr);
+ else
+ return lookup_symbol_in_variable_table (unit, sym, addr,
+ filename_ptr,
+ linenumber_ptr);
+}
+
/* 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
@@ -1657,17 +2194,14 @@ find_debug_info (bfd *abfd, asection *after_sec)
{
asection * msec;
- if (after_sec)
- msec = after_sec->next;
- else
- msec = abfd->sections;
+ msec = after_sec != NULL ? after_sec->next : 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)
+ if (CONST_STRNEQ (msec->name, GNU_LINKONCE_INFO))
return msec;
msec = msec->next;
@@ -1676,22 +2210,119 @@ find_debug_info (bfd *abfd, asection *after_sec)
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. */
+/* Unset vmas for loadable sections in STASH. */
-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)
+static void
+unset_sections (struct dwarf2_debug *stash)
+{
+ unsigned int i;
+ struct loadable_section *p;
+
+ i = stash->loadable_section_count;
+ p = stash->loadable_sections;
+ for (; i > 0; i--, p++)
+ p->section->vma = 0;
+}
+
+/* Set unique vmas for loadable sections in ABFD and save vmas in
+ STASH for unset_sections. */
+
+static bfd_boolean
+place_sections (bfd *abfd, struct dwarf2_debug *stash)
+{
+ struct loadable_section *p;
+ unsigned int i;
+
+ if (stash->loadable_section_count != 0)
+ {
+ i = stash->loadable_section_count;
+ p = stash->loadable_sections;
+ for (; i > 0; i--, p++)
+ p->section->vma = p->adj_vma;
+ }
+ else
+ {
+ asection *sect;
+ bfd_vma last_vma = 0;
+ bfd_size_type amt;
+ struct loadable_section *p;
+
+ i = 0;
+ for (sect = abfd->sections; sect != NULL; sect = sect->next)
+ {
+ bfd_size_type sz;
+
+ if (sect->vma != 0 || (sect->flags & SEC_LOAD) == 0)
+ continue;
+
+ sz = sect->rawsize ? sect->rawsize : sect->size;
+ if (sz == 0)
+ continue;
+
+ i++;
+ }
+
+ amt = i * sizeof (struct loadable_section);
+ p = (struct loadable_section *) bfd_zalloc (abfd, amt);
+ if (! p)
+ return FALSE;
+
+ stash->loadable_sections = p;
+ stash->loadable_section_count = i;
+
+ for (sect = abfd->sections; sect != NULL; sect = sect->next)
+ {
+ bfd_size_type sz;
+
+ if (sect->vma != 0 || (sect->flags & SEC_LOAD) == 0)
+ continue;
+
+ sz = sect->rawsize ? sect->rawsize : sect->size;
+ if (sz == 0)
+ continue;
+
+ p->section = sect;
+ if (last_vma != 0)
+ {
+ /* Align the new address to the current section
+ alignment. */
+ last_vma = ((last_vma
+ + ~((bfd_vma) -1 << sect->alignment_power))
+ & ((bfd_vma) -1 << sect->alignment_power));
+ sect->vma = last_vma;
+ }
+ p->adj_vma = sect->vma;
+ last_vma += sect->vma + sz;
+
+ p++;
+ }
+ }
+
+ return TRUE;
+}
+
+/* Find the source code location of SYMBOL. If SYMBOL is NULL
+ then find the nearest source code location corresponding to
+ the address SECTION + OFFSET.
+ Returns TRUE if the line is found without error and fills in
+ FILENAME_PTR and LINENUMBER_PTR. In the case where SYMBOL was
+ NULL the FUNCTIONNAME_PTR is also filled in.
+ SYMBOLS contains the symbol table for ABFD.
+ ADDR_SIZE is the number of bytes in the initial .debug_info length
+ field and in the abbreviation offset, or zero to indicate that the
+ default value should be used. */
+
+static bfd_boolean
+find_line (bfd *abfd,
+ asection *section,
+ bfd_vma offset,
+ asymbol *symbol,
+ asymbol **symbols,
+ 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,
@@ -1701,72 +2332,119 @@ _bfd_dwarf2_find_nearest_line (bfd *abfd,
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;
-
+ struct dwarf2_debug *stash;
/* What address are we looking for? */
- bfd_vma addr = offset + section->vma;
-
+ bfd_vma addr;
struct comp_unit* each;
+ bfd_vma found = FALSE;
+ bfd_boolean do_line;
- *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);
+ stash = *pinfo;
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;
+ }
+
+ /* In a relocatable file, 2 functions may have the same address.
+ We change the section vma so that they won't overlap. */
+ if ((abfd->flags & (EXEC_P | DYNAMIC)) == 0)
+ {
+ if (! place_sections (abfd, stash))
+ return FALSE;
+ }
+
+ do_line = (section == NULL
+ && offset == 0
+ && functionname_ptr == NULL
+ && symbol != NULL);
+ if (do_line)
+ {
+ addr = symbol->value;
+ section = bfd_get_section (symbol);
+ }
+ else if (section != NULL
+ && functionname_ptr != NULL
+ && symbol == NULL)
+ addr = offset;
+ else
+ abort ();
+
+ if (section->output_section)
+ addr += section->output_section->vma + section->output_offset;
+ else
+ addr += section->vma;
+ *filename_ptr = NULL;
+ *functionname_ptr = NULL;
+ *linenumber_ptr = 0;
+
+ if (! *pinfo)
+ {
+ bfd *debug_bfd;
+ bfd_size_type total_size;
+ asection *msec;
*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;
+ if (msec == NULL)
+ {
+ char * debug_filename = bfd_follow_gnu_debuglink (abfd, DEBUGDIR);
+
+ if (debug_filename == NULL)
+ /* No dwarf2 info, and no gnu_debuglink to follow.
+ Note that at this point the stash has been allocated, but
+ contains zeros. This lets future calls to this function
+ fail more quickly. */
+ goto done;
+
+ if ((debug_bfd = bfd_openr (debug_filename, NULL)) == NULL
+ || ! bfd_check_format (debug_bfd, bfd_object)
+ || (msec = find_debug_info (debug_bfd, NULL)) == NULL)
+ {
+ if (debug_bfd)
+ bfd_close (debug_bfd);
+ /* FIXME: Should we report our failure to follow the debuglink ? */
+ free (debug_filename);
+ goto done;
+ }
+ }
+ else
+ debug_bfd = abfd;
/* 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;
+ for (total_size = 0; msec; msec = find_debug_info (debug_bfd, msec))
+ total_size += msec->size;
- stash->info_ptr = bfd_alloc (abfd, total_size);
+ stash->info_ptr = bfd_alloc (debug_bfd, total_size);
if (stash->info_ptr == NULL)
- return FALSE;
+ goto done;
stash->info_ptr_end = stash->info_ptr;
- for (msec = find_debug_info (abfd, NULL);
+ for (msec = find_debug_info (debug_bfd, NULL);
msec;
- msec = find_debug_info (abfd, msec))
+ msec = find_debug_info (debug_bfd, msec))
{
bfd_size_type size;
bfd_size_type start;
- size = msec->_raw_size;
+ size = msec->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)
+ (debug_bfd, msec, stash->info_ptr + start, symbols)) == NULL)
continue;
stash->info_ptr_end = stash->info_ptr + start + size;
@@ -1774,37 +2452,60 @@ _bfd_dwarf2_find_nearest_line (bfd *abfd,
BFD_ASSERT (stash->info_ptr_end == stash->info_ptr + total_size);
- stash->sec = find_debug_info (abfd, NULL);
+ stash->sec = find_debug_info (debug_bfd, NULL);
stash->sec_info_ptr = stash->info_ptr;
stash->syms = symbols;
+ stash->bfd = debug_bfd;
}
/* 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;
+ goto done;
+
+ stash->inliner_chain = NULL;
/* 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);
+ {
+ if (do_line)
+ found = (((symbol->flags & BSF_FUNCTION) == 0
+ || comp_unit_contains_address (each, addr))
+ && comp_unit_find_line (each, symbol, addr,
+ filename_ptr, linenumber_ptr,
+ stash));
+ else
+ found = (comp_unit_contains_address (each, addr)
+ && comp_unit_find_nearest_line (each, addr,
+ filename_ptr,
+ functionname_ptr,
+ linenumber_ptr,
+ stash));
+ if (found)
+ goto done;
+ }
+
+ /* 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);
/* 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;
+ bfd_byte *info_ptr_unit = stash->info_ptr;
- 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. */
+ length = read_4_bytes (stash->bfd, 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);
+ length = read_8_bytes (stash->bfd, stash->info_ptr + 4);
stash->info_ptr += 12;
}
/* A zero length is the IRIX way of indicating 64-bit offsets,
@@ -1813,29 +2514,36 @@ _bfd_dwarf2_find_nearest_line (bfd *abfd,
else if (length == 0)
{
offset_size = 8;
- length = read_4_bytes (abfd, stash->info_ptr + 4);
+ length = read_4_bytes (stash->bfd, 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. */
+ /* In the absence of the hints above, we assume 32-bit DWARF2
+ offsets even for targets with 64-bit addresses, because:
+ a) most of the time these targets will not have generated
+ more than 2Gb of debug info and so will not need 64-bit
+ offsets,
+ and
+ b) if they do use 64-bit offsets but they are not using
+ the size hints that are tested for above then they are
+ not conforming to the DWARF3 standard anyway. */
else if (addr_size == 8)
{
- length = read_8_bytes (abfd, stash->info_ptr);
- stash->info_ptr += 8;
+ offset_size = 4;
+ stash->info_ptr += 4;
}
else
stash->info_ptr += 4;
if (length > 0)
{
- each = parse_comp_unit (abfd, stash, length, offset_size);
+ each = parse_comp_unit (stash, length, info_ptr_unit,
+ offset_size);
stash->info_ptr += length;
if ((bfd_vma) (stash->info_ptr - stash->sec_info_ptr)
- == stash->sec->_raw_size)
+ == stash->sec->size)
{
- stash->sec = find_debug_info (abfd, stash->sec);
+ stash->sec = find_debug_info (stash->bfd, stash->sec);
stash->sec_info_ptr = stash->info_ptr;
}
@@ -1849,28 +2557,136 @@ _bfd_dwarf2_find_nearest_line (bfd *abfd,
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);
- }
+ if (do_line)
+ found = (((symbol->flags & BSF_FUNCTION) == 0
+ || each->arange.high == 0
+ || comp_unit_contains_address (each, addr))
+ && comp_unit_find_line (each, symbol, addr,
+ filename_ptr,
+ linenumber_ptr,
+ stash));
else
- {
- found = comp_unit_find_nearest_line (each, addr,
- filename_ptr,
- functionname_ptr,
- linenumber_ptr,
- stash);
- if (found)
- return TRUE;
- }
+ found = ((each->arange.high == 0
+ || comp_unit_contains_address (each, addr))
+ && comp_unit_find_nearest_line (each, addr,
+ filename_ptr,
+ functionname_ptr,
+ linenumber_ptr,
+ stash));
+ if (found)
+ goto done;
}
}
}
+done:
+ if ((abfd->flags & (EXEC_P | DYNAMIC)) == 0)
+ unset_sections (stash);
+
+ return found;
+}
+
+/* The DWARF2 version of find_nearest_line.
+ Return TRUE if the line is found without error. */
+
+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)
+{
+ return find_line (abfd, section, offset, NULL, symbols, filename_ptr,
+ functionname_ptr, linenumber_ptr, addr_size,
+ pinfo);
+}
+
+/* The DWARF2 version of find_line.
+ Return TRUE if the line is found without error. */
+
+bfd_boolean
+_bfd_dwarf2_find_line (bfd *abfd,
+ asymbol **symbols,
+ asymbol *symbol,
+ const char **filename_ptr,
+ unsigned int *linenumber_ptr,
+ unsigned int addr_size,
+ void **pinfo)
+{
+ return find_line (abfd, NULL, 0, symbol, symbols, filename_ptr,
+ NULL, linenumber_ptr, addr_size,
+ pinfo);
+}
+
+bfd_boolean
+_bfd_dwarf2_find_inliner_info (bfd *abfd ATTRIBUTE_UNUSED,
+ const char **filename_ptr,
+ const char **functionname_ptr,
+ unsigned int *linenumber_ptr,
+ void **pinfo)
+{
+ struct dwarf2_debug *stash;
+
+ stash = *pinfo;
+ if (stash)
+ {
+ struct funcinfo *func = stash->inliner_chain;
+
+ if (func && func->caller_func)
+ {
+ *filename_ptr = func->caller_file;
+ *functionname_ptr = func->caller_func->name;
+ *linenumber_ptr = func->caller_line;
+ stash->inliner_chain = func->caller_func;
+ return TRUE;
+ }
+ }
+
return FALSE;
}
+
+void
+_bfd_dwarf2_cleanup_debug_info (bfd *abfd)
+{
+ struct comp_unit *each;
+ struct dwarf2_debug *stash;
+
+ if (abfd == NULL || elf_tdata (abfd) == NULL)
+ return;
+
+ stash = elf_tdata (abfd)->dwarf2_find_line_info;
+
+ if (stash == NULL)
+ return;
+
+ for (each = stash->all_comp_units; each; each = each->next_unit)
+ {
+ struct abbrev_info **abbrevs = each->abbrevs;
+ size_t i;
+
+ for (i = 0; i < ABBREV_HASH_SIZE; i++)
+ {
+ struct abbrev_info *abbrev = abbrevs[i];
+
+ while (abbrev)
+ {
+ free (abbrev->attrs);
+ abbrev = abbrev->next;
+ }
+ }
+
+ if (each->line_table)
+ {
+ free (each->line_table->dirs);
+ free (each->line_table->files);
+ }
+ }
+
+ free (stash->dwarf_abbrev_buffer);
+ free (stash->dwarf_line_buffer);
+ free (stash->dwarf_ranges_buffer);
+}
diff --git a/contrib/binutils/bfd/ecoff.c b/contrib/binutils/bfd/ecoff.c
index cfc5ae1..45cdb1d 100644
--- a/contrib/binutils/bfd/ecoff.c
+++ b/contrib/binutils/bfd/ecoff.c
@@ -1,6 +1,6 @@
/* Generic ECOFF (Extended-COFF) routines.
Copyright 1990, 1991, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
- 2002, 2003 Free Software Foundation, Inc.
+ 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
Original version by Per Bothner.
Full support added by Ian Lance Taylor, ian@cygnus.com.
@@ -18,10 +18,10 @@
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. */
+ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "bfdlink.h"
#include "libbfd.h"
#include "aout/ar.h"
@@ -43,79 +43,51 @@
#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));
+#include "libiberty.h"
+
+#define streq(a, b) (strcmp ((a), (b)) == 0)
+#define strneq(a, b, n) (strncmp ((a), (b), (n)) == 0)
+
/* 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,
+ /* name, id, index, next, prev, flags, user_set_vma, */
+ "*DEBUG*", 0, 0, NULL, NULL, 0, 0,
+ /* linker_mark, linker_has_input, gc_mark, gc_mark_from_eh, */
+ 0, 0, 1, 0,
+ /* segment_mark, sec_info_type, use_rela_p, has_tls_reloc, */
+ 0, 0, 0, 0,
+ /* has_gp_reloc, need_finalize_relax, reloc_done, */
+ 0, 0, 0,
+ /* vma, lma, size, rawsize, */
+ 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,
+ /* entsize, kept_section, moving_line_filepos, */
+ 0, NULL, 0,
/* target_index, used_by_bfd, constructor_chain, owner, */
0, NULL, NULL, NULL,
/* symbol, */
- (struct bfd_symbol *) NULL,
+ NULL,
/* symbol_ptr_ptr, */
- (struct bfd_symbol **) NULL,
- /* link_order_head, link_order_tail */
- NULL, NULL
+ NULL,
+ /* map_head, map_tail */
+ { NULL }, { NULL }
};
/* Create an ECOFF object. */
bfd_boolean
-_bfd_ecoff_mkobject (abfd)
- bfd *abfd;
+_bfd_ecoff_mkobject (bfd *abfd)
{
bfd_size_type amt = sizeof (ecoff_data_type);
- abfd->tdata.ecoff_obj_data = (struct ecoff_tdata *) bfd_zalloc (abfd, amt);
+ abfd->tdata.ecoff_obj_data = bfd_zalloc (abfd, amt);
if (abfd->tdata.ecoff_obj_data == NULL)
return FALSE;
@@ -125,11 +97,8 @@ _bfd_ecoff_mkobject (abfd)
/* 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;
+void *
+_bfd_ecoff_mkobject_hook (bfd *abfd, void * filehdr, void * aouthdr)
{
struct internal_filehdr *internal_f = (struct internal_filehdr *) filehdr;
struct internal_aouthdr *internal_a = (struct internal_aouthdr *) aouthdr;
@@ -142,7 +111,7 @@ _bfd_ecoff_mkobject_hook (abfd, filehdr, aouthdr)
ecoff->gp_size = 8;
ecoff->sym_filepos = internal_f->f_symptr;
- if (internal_a != (struct internal_aouthdr *) NULL)
+ if (internal_a != NULL)
{
int i;
@@ -165,43 +134,53 @@ _bfd_ecoff_mkobject_hook (abfd, filehdr, aouthdr)
fprmask) and let the swapping routines ensure that only relevant
information is written out. */
- return (PTR) ecoff;
+ return (void *) ecoff;
}
/* Initialize a new section. */
bfd_boolean
-_bfd_ecoff_new_section_hook (abfd, section)
- bfd *abfd ATTRIBUTE_UNUSED;
- asection *section;
+_bfd_ecoff_new_section_hook (bfd *abfd, asection *section)
{
+ unsigned int i;
+ static struct
+ {
+ const char * name;
+ flagword flags;
+ }
+ section_flags [] =
+ {
+ { _TEXT, SEC_ALLOC | SEC_CODE | SEC_LOAD },
+ { _INIT, SEC_ALLOC | SEC_CODE | SEC_LOAD },
+ { _FINI, SEC_ALLOC | SEC_CODE | SEC_LOAD },
+ { _DATA, SEC_ALLOC | SEC_DATA | SEC_LOAD },
+ { _SDATA, SEC_ALLOC | SEC_DATA | SEC_LOAD },
+ { _RDATA, SEC_ALLOC | SEC_DATA | SEC_LOAD | SEC_READONLY},
+ { _LIT8, SEC_ALLOC | SEC_DATA | SEC_LOAD | SEC_READONLY},
+ { _LIT4, SEC_ALLOC | SEC_DATA | SEC_LOAD | SEC_READONLY},
+ { _RCONST, SEC_ALLOC | SEC_DATA | SEC_LOAD | SEC_READONLY},
+ { _PDATA, SEC_ALLOC | SEC_DATA | SEC_LOAD | SEC_READONLY},
+ { _BSS, SEC_ALLOC},
+ { _SBSS, SEC_ALLOC},
+ /* An Irix 4 shared libary. */
+ { _LIB, SEC_COFF_SHARED_LIBRARY}
+ };
+
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;
+ for (i = 0; i < ARRAY_SIZE (section_flags); i++)
+ if (streq (section->name, section_flags[i].name))
+ {
+ section->flags |= section_flags[i].flags;
+ break;
+ }
+
/* 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;
+ return _bfd_generic_new_section_hook (abfd, section);
}
/* Determine the machine architecture and type. This is called from
@@ -210,11 +189,9 @@ _bfd_ecoff_new_section_hook (abfd, section)
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;
+_bfd_ecoff_set_arch_mach_hook (bfd *abfd, void * filehdr)
{
- struct internal_filehdr *internal_f = (struct internal_filehdr *) filehdr;
+ struct internal_filehdr *internal_f = filehdr;
enum bfd_architecture arch;
unsigned long mach;
@@ -259,8 +236,7 @@ _bfd_ecoff_set_arch_mach_hook (abfd, filehdr)
This is the inverse of _bfd_ecoff_set_arch_mach_hook, above. */
static int
-ecoff_get_magic (abfd)
- bfd *abfd;
+ecoff_get_magic (bfd *abfd)
{
int big, little;
@@ -301,75 +277,67 @@ ecoff_get_magic (abfd)
/* Get the section s_flags to use for a section. */
static long
-ecoff_sec_to_styp_flags (name, flags)
- const char *name;
- flagword flags;
+ecoff_sec_to_styp_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)
+ unsigned int i;
+ static struct
+ {
+ const char * name;
+ long flags;
+ }
+ styp_flags [] =
+ {
+ { _TEXT, STYP_TEXT },
+ { _DATA, STYP_DATA },
+ { _SDATA, STYP_SDATA },
+ { _RDATA, STYP_RDATA },
+ { _LITA, STYP_LITA },
+ { _LIT8, STYP_LIT8 },
+ { _LIT4, STYP_LIT4 },
+ { _BSS, STYP_BSS },
+ { _SBSS, STYP_SBSS },
+ { _INIT, STYP_ECOFF_INIT },
+ { _FINI, STYP_ECOFF_FINI },
+ { _PDATA, STYP_PDATA },
+ { _XDATA, STYP_XDATA },
+ { _LIB, STYP_ECOFF_LIB },
+ { _GOT, STYP_GOT },
+ { _HASH, STYP_HASH },
+ { _DYNAMIC, STYP_DYNAMIC },
+ { _LIBLIST, STYP_LIBLIST },
+ { _RELDYN, STYP_RELDYN },
+ { _CONFLIC, STYP_CONFLIC },
+ { _DYNSTR, STYP_DYNSTR },
+ { _DYNSYM, STYP_DYNSYM },
+ { _RCONST, STYP_RCONST }
+ };
+ long styp = 0;
+
+ for (i = 0; i < ARRAY_SIZE (styp_flags); i++)
+ if (streq (name, styp_flags[i].name))
+ {
+ styp = styp_flags[i].flags;
+ break;
+ }
+
+ if (styp == 0)
{
- styp = STYP_COMMENT;
- flags &=~ SEC_NEVER_LOAD;
+ if (streq (name, _COMMENT))
+ {
+ styp = STYP_COMMENT;
+ flags &=~ SEC_NEVER_LOAD;
+ }
+ 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;
}
- 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;
@@ -380,14 +348,13 @@ ecoff_sec_to_styp_flags (name, flags)
/* 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;
+_bfd_ecoff_styp_to_sec_flags (bfd *abfd ATTRIBUTE_UNUSED,
+ void * hdr,
+ const char *name ATTRIBUTE_UNUSED,
+ asection *section ATTRIBUTE_UNUSED,
+ flagword * flags_ptr)
{
- struct internal_scnhdr *internal_s = (struct internal_scnhdr *) hdr;
+ struct internal_scnhdr *internal_s = hdr;
long styp_flags = internal_s->s_flags;
flagword sec_flags = 0;
@@ -450,12 +417,11 @@ _bfd_ecoff_styp_to_sec_flags (abfd, hdr, name, section, flags_ptr)
/* Read in the symbolic header for an ECOFF object file. */
static bfd_boolean
-ecoff_slurp_symbolic_header (abfd)
- bfd *abfd;
+ecoff_slurp_symbolic_header (bfd *abfd)
{
const struct ecoff_backend_data * const backend = ecoff_backend (abfd);
bfd_size_type external_hdr_size;
- PTR raw = NULL;
+ void * raw = NULL;
HDRR *internal_symhdr;
/* See if we've already read it in. */
@@ -482,7 +448,7 @@ ecoff_slurp_symbolic_header (abfd)
}
/* Read the symbolic information header. */
- raw = (PTR) bfd_malloc (external_hdr_size);
+ raw = bfd_malloc (external_hdr_size);
if (raw == NULL)
goto error_return;
@@ -516,16 +482,15 @@ ecoff_slurp_symbolic_header (abfd)
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;
+_bfd_ecoff_slurp_symbolic_info (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;
+ void * raw;
bfd_size_type external_fdr_size;
char *fraw_src;
char *fraw_end;
@@ -539,7 +504,7 @@ _bfd_ecoff_slurp_symbolic_info (abfd, ignore, debug)
/* Check whether we've already gotten it, and whether there's any to
get. */
- if (ecoff_data (abfd)->raw_syments != (PTR) NULL)
+ if (ecoff_data (abfd)->raw_syments != NULL)
return TRUE;
if (ecoff_data (abfd)->sym_filepos == 0)
{
@@ -573,7 +538,7 @@ _bfd_ecoff_slurp_symbolic_info (abfd, ignore, debug)
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 */
+ 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));
@@ -590,7 +555,7 @@ _bfd_ecoff_slurp_symbolic_info (abfd, ignore, debug)
ecoff_data (abfd)->sym_filepos = 0;
return TRUE;
}
- raw = (PTR) bfd_alloc (abfd, raw_size);
+ raw = bfd_alloc (abfd, raw_size);
if (raw == NULL)
return FALSE;
@@ -606,25 +571,25 @@ _bfd_ecoff_slurp_symbolic_info (abfd, ignore, debug)
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 \
+#define FIX(off1, off2, type) \
+ if (internal_symhdr->off1 == 0) \
+ debug->off2 = 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 (cbDnOffset, external_dnr, void *);
+ FIX (cbPdOffset, external_pdr, void *);
+ FIX (cbSymOffset, external_sym, void *);
+ FIX (cbOptOffset, external_opt, void *);
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);
+ FIX (cbFdOffset, external_fdr, void *);
+ FIX (cbRfdOffset, external_rfd, void *);
+ FIX (cbExtOffset, external_ext, void *);
#undef FIX
/* I don't want to always swap all the data, because it will just
@@ -637,7 +602,7 @@ _bfd_ecoff_slurp_symbolic_info (abfd, ignore, debug)
the symbols, so we swap them here. */
amt = internal_symhdr->ifdMax;
amt *= sizeof (struct fdr);
- debug->fdr = (struct fdr *) bfd_alloc (abfd, amt);
+ debug->fdr = bfd_alloc (abfd, amt);
if (debug->fdr == NULL)
return FALSE;
external_fdr_size = backend->debug_swap.external_fdr_size;
@@ -645,7 +610,7 @@ _bfd_ecoff_slurp_symbolic_info (abfd, ignore, debug)
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);
+ (*backend->debug_swap.swap_fdr_in) (abfd, (void *) fraw_src, fdr_ptr);
return TRUE;
}
@@ -665,17 +630,16 @@ static asymbol *ecoff_scom_symbol_ptr;
/* Create an empty symbol. */
asymbol *
-_bfd_ecoff_make_empty_symbol (abfd)
- bfd *abfd;
+_bfd_ecoff_make_empty_symbol (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 = bfd_zalloc (abfd, amt);
+ if (new == NULL)
+ return NULL;
+ new->symbol.section = NULL;
+ new->fdr = NULL;
new->local = FALSE;
new->native = NULL;
new->symbol.the_bfd = abfd;
@@ -685,12 +649,11 @@ _bfd_ecoff_make_empty_symbol (abfd)
/* 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;
+ecoff_set_symbol_info (bfd *abfd,
+ SYMR *ecoff_sym,
+ asymbol *asym,
+ int ext,
+ int weak)
{
asym->the_bfd = abfd;
asym->value = ecoff_sym->value;
@@ -750,15 +713,15 @@ ecoff_set_symbol_info (abfd, ecoff_sym, asym, ext, weak)
asym->flags = BSF_LOCAL;
break;
case scText:
- asym->section = bfd_make_section_old_way (abfd, ".text");
+ 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->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->section = bfd_make_section_old_way (abfd, _BSS);
asym->value -= asym->section->vma;
break;
case scRegister:
@@ -864,77 +827,8 @@ ecoff_set_symbol_info (abfd, ecoff_sym, asym, ext, weak)
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;
- }
+ /* Mark the symbol as a constructor. */
+ asym->flags |= BSF_CONSTRUCTOR;
break;
}
}
@@ -944,17 +838,16 @@ ecoff_set_symbol_info (abfd, ecoff_sym, asym, ext, weak)
/* Read an ECOFF symbol table. */
bfd_boolean
-_bfd_ecoff_slurp_symbol_table (abfd)
- bfd *abfd;
+_bfd_ecoff_slurp_symbol_table (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 *))
+ void (* const swap_ext_in) (bfd *, void *, EXTR *)
= backend->debug_swap.swap_ext_in;
- void (* const swap_sym_in) PARAMS ((bfd *, PTR, SYMR *))
+ void (* const swap_sym_in) (bfd *, void *, SYMR *)
= backend->debug_swap.swap_sym_in;
bfd_size_type internal_size;
ecoff_symbol_type *internal;
@@ -969,7 +862,7 @@ _bfd_ecoff_slurp_symbol_table (abfd)
return TRUE;
/* Get the symbolic information. */
- if (! _bfd_ecoff_slurp_symbolic_info (abfd, (asection *) NULL,
+ if (! _bfd_ecoff_slurp_symbolic_info (abfd, NULL,
&ecoff_data (abfd)->debug_info))
return FALSE;
if (bfd_get_symcount (abfd) == 0)
@@ -977,7 +870,7 @@ _bfd_ecoff_slurp_symbol_table (abfd)
internal_size = bfd_get_symcount (abfd);
internal_size *= sizeof (ecoff_symbol_type);
- internal = (ecoff_symbol_type *) bfd_alloc (abfd, internal_size);
+ internal = bfd_alloc (abfd, internal_size);
if (internal == NULL)
return FALSE;
@@ -990,7 +883,7 @@ _bfd_ecoff_slurp_symbol_table (abfd)
{
EXTR internal_esym;
- (*swap_ext_in) (abfd, (PTR) eraw_src, &internal_esym);
+ (*swap_ext_in) (abfd, (void *) 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,
@@ -1004,7 +897,7 @@ _bfd_ecoff_slurp_symbol_table (abfd)
else
internal_ptr->fdr = NULL;
internal_ptr->local = FALSE;
- internal_ptr->native = (PTR) eraw_src;
+ internal_ptr->native = (void *) eraw_src;
}
/* The local symbols must be accessed via the fdr's, because the
@@ -1025,7 +918,7 @@ _bfd_ecoff_slurp_symbol_table (abfd)
{
SYMR internal_sym;
- (*swap_sym_in) (abfd, (PTR) lraw_src, &internal_sym);
+ (*swap_sym_in) (abfd, (void *) lraw_src, &internal_sym);
internal_ptr->symbol.name = (ecoff_data (abfd)->debug_info.ss
+ fdr_ptr->issBase
+ internal_sym.iss);
@@ -1034,7 +927,7 @@ _bfd_ecoff_slurp_symbol_table (abfd)
return FALSE;
internal_ptr->fdr = fdr_ptr;
internal_ptr->local = TRUE;
- internal_ptr->native = (PTR) lraw_src;
+ internal_ptr->native = (void *) lraw_src;
}
}
@@ -1046,10 +939,9 @@ _bfd_ecoff_slurp_symbol_table (abfd)
/* Return the amount of space needed for the canonical symbols. */
long
-_bfd_ecoff_get_symtab_upper_bound (abfd)
- bfd *abfd;
+_bfd_ecoff_get_symtab_upper_bound (bfd *abfd)
{
- if (! _bfd_ecoff_slurp_symbolic_info (abfd, (asection *) NULL,
+ if (! _bfd_ecoff_slurp_symbolic_info (abfd, NULL,
&ecoff_data (abfd)->debug_info))
return -1;
@@ -1062,9 +954,7 @@ _bfd_ecoff_get_symtab_upper_bound (abfd)
/* Get the canonical symbols. */
long
-_bfd_ecoff_canonicalize_symtab (abfd, alocation)
- bfd *abfd;
- asymbol **alocation;
+_bfd_ecoff_canonicalize_symtab (bfd *abfd, asymbol **alocation)
{
unsigned int counter = 0;
ecoff_symbol_type *symbase;
@@ -1081,7 +971,7 @@ _bfd_ecoff_canonicalize_symtab (abfd, alocation)
*(location++) = symbase++;
counter++;
}
- *location++ = (ecoff_symbol_type *) NULL;
+ *location++ = NULL;
return bfd_get_symcount (abfd);
}
@@ -1092,13 +982,12 @@ _bfd_ecoff_canonicalize_symtab (abfd, alocation)
/* 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;
+ecoff_emit_aggregate (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;
@@ -1155,15 +1044,13 @@ ecoff_emit_aggregate (abfd, fdr, string, rndx, isym, which)
/* Convert the type information to string format. */
static char *
-ecoff_type_to_string (abfd, fdr, indx)
- bfd *abfd;
- FDR *fdr;
- unsigned int indx;
+ecoff_type_to_string (bfd *abfd, FDR *fdr, unsigned int indx)
{
union aux_ext *aux_ptr;
int bigendian;
AUXU u;
- struct qual {
+ struct qual
+ {
unsigned int type;
int low_bound;
int high_bound;
@@ -1452,10 +1339,9 @@ ecoff_type_to_string (abfd, fdr, indx)
/* 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_ecoff_get_symbol_info (bfd *abfd ATTRIBUTE_UNUSED,
+ asymbol *symbol,
+ symbol_info *ret)
{
bfd_symbol_info (symbol, ret);
}
@@ -1463,9 +1349,8 @@ _bfd_ecoff_get_symbol_info (abfd, 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;
+_bfd_ecoff_bfd_is_local_label_name (bfd *abfd ATTRIBUTE_UNUSED,
+ const char *name)
{
return name[0] == '$';
}
@@ -1473,11 +1358,10 @@ _bfd_ecoff_bfd_is_local_label_name (abfd, name)
/* 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;
+_bfd_ecoff_print_symbol (bfd *abfd,
+ void * filep,
+ asymbol *symbol,
+ bfd_print_symbol_type how)
{
const struct ecoff_debug_swap * const debug_swap
= &ecoff_backend (abfd)->debug_swap;
@@ -1662,10 +1546,9 @@ _bfd_ecoff_print_symbol (abfd, filep, symbol, how)
/* Read in the relocs for a section. */
static bfd_boolean
-ecoff_slurp_reloc_table (abfd, section, symbols)
- bfd *abfd;
- asection *section;
- asymbol **symbols;
+ecoff_slurp_reloc_table (bfd *abfd,
+ asection *section,
+ asymbol **symbols)
{
const struct ecoff_backend_data * const backend = ecoff_backend (abfd);
arelent *internal_relocs;
@@ -1675,7 +1558,7 @@ ecoff_slurp_reloc_table (abfd, section, symbols)
arelent *rptr;
unsigned int i;
- if (section->relocation != (arelent *) NULL
+ if (section->relocation != NULL
|| section->reloc_count == 0
|| (section->flags & SEC_CONSTRUCTOR) != 0)
return TRUE;
@@ -1685,13 +1568,12 @@ ecoff_slurp_reloc_table (abfd, section, symbols)
amt = section->reloc_count;
amt *= sizeof (arelent);
- internal_relocs = (arelent *) bfd_alloc (abfd, amt);
+ internal_relocs = 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)
+ external_relocs = bfd_alloc (abfd, amt);
+ if (internal_relocs == NULL || external_relocs == NULL)
return FALSE;
if (bfd_seek (abfd, section->rel_filepos, SEEK_SET) != 0)
return FALSE;
@@ -1730,25 +1612,25 @@ ecoff_slurp_reloc_table (abfd, section, symbols)
/* 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;
+ 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)
+ if (sec == NULL)
abort ();
rptr->sym_ptr_ptr = sec->symbol_ptr_ptr;
@@ -1772,11 +1654,10 @@ ecoff_slurp_reloc_table (abfd, section, symbols)
/* Get a canonical list of relocs. */
long
-_bfd_ecoff_canonicalize_reloc (abfd, section, relptr, symbols)
- bfd *abfd;
- asection *section;
- arelent **relptr;
- asymbol **symbols;
+_bfd_ecoff_canonicalize_reloc (bfd *abfd,
+ asection *section,
+ arelent **relptr,
+ asymbol **symbols)
{
unsigned int count;
@@ -1805,7 +1686,7 @@ _bfd_ecoff_canonicalize_reloc (abfd, section, relptr, symbols)
*relptr++ = tblptr++;
}
- *relptr = (arelent *) NULL;
+ *relptr = NULL;
return section->reloc_count;
}
@@ -1815,15 +1696,13 @@ _bfd_ecoff_canonicalize_reloc (abfd, section, relptr, symbols)
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;
+_bfd_ecoff_find_nearest_line (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;
@@ -1831,15 +1710,15 @@ _bfd_ecoff_find_nearest_line (abfd, section, ignore_symbols, offset,
struct ecoff_find_line *line_info;
/* Make sure we have the FDR's. */
- if (! _bfd_ecoff_slurp_symbolic_info (abfd, (asection *) NULL, debug_info)
+ if (! _bfd_ecoff_slurp_symbolic_info (abfd, 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);
+
+ ecoff_data (abfd)->find_line_info = bfd_zalloc (abfd, amt);
if (ecoff_data (abfd)->find_line_info == NULL)
return FALSE;
}
@@ -1864,13 +1743,11 @@ _bfd_ecoff_find_nearest_line (abfd, section, ignore_symbols, offset,
information. */
bfd_boolean
-_bfd_ecoff_bfd_copy_private_bfd_data (ibfd, obfd)
- bfd *ibfd;
- bfd *obfd;
+_bfd_ecoff_bfd_copy_private_bfd_data (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;
+ int i;
asymbol **sym_ptr_ptr;
size_t c;
bfd_boolean local;
@@ -1894,7 +1771,7 @@ _bfd_ecoff_bfd_copy_private_bfd_data (ibfd, obfd)
/* 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)
+ if (c == 0 || sym_ptr_ptr == NULL)
return TRUE;
/* See if there are any local symbols. */
@@ -1974,10 +1851,9 @@ _bfd_ecoff_bfd_copy_private_bfd_data (ibfd, obfd)
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_ecoff_set_arch_mach (bfd *abfd,
+ enum bfd_architecture arch,
+ unsigned long machine)
{
bfd_default_set_arch_mach (abfd, arch, machine);
return arch == ecoff_backend (abfd)->arch;
@@ -1986,9 +1862,8 @@ _bfd_ecoff_set_arch_mach (abfd, arch, machine)
/* Get the size of the section headers. */
int
-_bfd_ecoff_sizeof_headers (abfd, reloc)
- bfd *abfd;
- bfd_boolean reloc ATTRIBUTE_UNUSED;
+_bfd_ecoff_sizeof_headers (bfd *abfd,
+ struct bfd_link_info *info ATTRIBUTE_UNUSED)
{
asection *current;
int c;
@@ -1996,7 +1871,7 @@ _bfd_ecoff_sizeof_headers (abfd, reloc)
c = 0;
for (current = abfd->sections;
- current != (asection *)NULL;
+ current != NULL;
current = current->next)
++c;
@@ -2009,12 +1884,11 @@ _bfd_ecoff_sizeof_headers (abfd, reloc)
/* 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;
+_bfd_ecoff_get_section_contents (bfd *abfd,
+ asection *section,
+ void * location,
+ file_ptr offset,
+ bfd_size_type count)
{
return _bfd_generic_get_section_contents (abfd, section, location,
offset, count);
@@ -2024,9 +1898,7 @@ _bfd_ecoff_get_section_contents (abfd, section, location, offset, count)
called via qsort. */
static int
-ecoff_sort_hdrs (arg1, arg2)
- const PTR arg1;
- const PTR arg2;
+ecoff_sort_hdrs (const void * arg1, const void * arg2)
{
const asection *hdr1 = *(const asection **) arg1;
const asection *hdr2 = *(const asection **) arg2;
@@ -2053,8 +1925,7 @@ ecoff_sort_hdrs (arg1, arg2)
reloc_filepos. */
static bfd_boolean
-ecoff_compute_section_file_positions (abfd)
- bfd *abfd;
+ecoff_compute_section_file_positions (bfd *abfd)
{
file_ptr sofar, file_sofar;
asection **sorted_hdrs;
@@ -2066,13 +1937,13 @@ ecoff_compute_section_file_positions (abfd)
const bfd_vma round = ecoff_backend (abfd)->round;
bfd_size_type amt;
- sofar = _bfd_ecoff_sizeof_headers (abfd, FALSE);
+ sofar = _bfd_ecoff_sizeof_headers (abfd, NULL);
file_sofar = sofar;
/* Sort the sections by VMA. */
amt = abfd->section_count;
amt *= sizeof (asection *);
- sorted_hdrs = (asection **) bfd_malloc (amt);
+ sorted_hdrs = bfd_malloc (amt);
if (sorted_hdrs == NULL)
return FALSE;
for (current = abfd->sections, i = 0;
@@ -2092,11 +1963,11 @@ ecoff_compute_section_file_positions (abfd)
for (i = 0; i < abfd->section_count; i++)
{
current = sorted_hdrs[i];
- if (strcmp (current->name, _RDATA) == 0)
+ if (streq (current->name, _RDATA))
break;
if ((current->flags & SEC_CODE) == 0
- && strcmp (current->name, _PDATA) != 0
- && strcmp (current->name, _RCONST) != 0)
+ && ! streq (current->name, _PDATA)
+ && ! streq (current->name, _RCONST))
{
rdata_in_text = FALSE;
break;
@@ -2117,8 +1988,8 @@ ecoff_compute_section_file_positions (abfd)
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;
+ if (streq (current->name, _PDATA))
+ current->line_filepos = current->size / 8;
alignment_power = current->alignment_power;
@@ -2133,15 +2004,15 @@ ecoff_compute_section_file_positions (abfd)
&& ! 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)
+ || ! streq (current->name, _RDATA))
+ && ! streq (current->name, _PDATA)
+ && ! streq (current->name, _RCONST))
{
sofar = (sofar + round - 1) &~ (round - 1);
file_sofar = (file_sofar + round - 1) &~ (round - 1);
first_data = FALSE;
}
- else if (strcmp (current->name, _LIB) == 0)
+ else if (streq (current->name, _LIB))
{
/* On Irix 4, the location of contents of the .lib section
from a shared library section is also rounded up to a
@@ -2179,16 +2050,16 @@ ecoff_compute_section_file_positions (abfd)
if ((current->flags & (SEC_HAS_CONTENTS | SEC_LOAD)) != 0)
current->filepos = file_sofar;
- sofar += current->_raw_size;
+ sofar += current->size;
if ((current->flags & SEC_HAS_CONTENTS) != 0)
- file_sofar += current->_raw_size;
+ file_sofar += current->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;
+ current->size += sofar - old_sofar;
}
free (sorted_hdrs);
@@ -2204,8 +2075,7 @@ ecoff_compute_section_file_positions (abfd)
information. */
static bfd_size_type
-ecoff_compute_reloc_file_positions (abfd)
- bfd *abfd;
+ecoff_compute_reloc_file_positions (bfd *abfd)
{
const bfd_size_type external_reloc_size =
ecoff_backend (abfd)->external_reloc_size;
@@ -2225,7 +2095,7 @@ ecoff_compute_reloc_file_positions (abfd)
reloc_size = 0;
for (current = abfd->sections;
- current != (asection *)NULL;
+ current != NULL;
current = current->next)
{
if (current->reloc_count == 0)
@@ -2259,26 +2129,23 @@ ecoff_compute_reloc_file_positions (abfd)
/* 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;
+_bfd_ecoff_set_section_contents (bfd *abfd,
+ asection *section,
+ const void * 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;
- }
+ if (! abfd->output_has_begun
+ && ! 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)
+ if (streq (section->name, _LIB))
{
bfd_byte *rec, *recend;
@@ -2308,8 +2175,7 @@ _bfd_ecoff_set_section_contents (abfd, section, location, offset, count)
nlmconv. */
bfd_vma
-bfd_ecoff_get_gp_value (abfd)
- bfd *abfd;
+bfd_ecoff_get_gp_value (bfd *abfd)
{
if (bfd_get_flavour (abfd) != bfd_target_ecoff_flavour
|| bfd_get_format (abfd) != bfd_object)
@@ -2325,9 +2191,7 @@ bfd_ecoff_get_gp_value (abfd)
assembler. */
bfd_boolean
-bfd_ecoff_set_gp_value (abfd, gp_value)
- bfd *abfd;
- bfd_vma gp_value;
+bfd_ecoff_set_gp_value (bfd *abfd, bfd_vma gp_value)
{
if (bfd_get_flavour (abfd) != bfd_target_ecoff_flavour
|| bfd_get_format (abfd) != bfd_object)
@@ -2345,11 +2209,10 @@ bfd_ecoff_set_gp_value (abfd, gp_value)
the assembler. */
bfd_boolean
-bfd_ecoff_set_regmasks (abfd, gprmask, fprmask, cprmask)
- bfd *abfd;
- unsigned long gprmask;
- unsigned long fprmask;
- unsigned long *cprmask;
+bfd_ecoff_set_regmasks (bfd *abfd,
+ unsigned long gprmask,
+ unsigned long fprmask,
+ unsigned long *cprmask)
{
ecoff_data_type *tdata;
@@ -2363,7 +2226,7 @@ bfd_ecoff_set_regmasks (abfd, gprmask, fprmask, cprmask)
tdata = ecoff_data (abfd);
tdata->gprmask = gprmask;
tdata->fprmask = fprmask;
- if (cprmask != (unsigned long *) NULL)
+ if (cprmask != NULL)
{
int i;
@@ -2378,9 +2241,7 @@ bfd_ecoff_set_regmasks (abfd, gprmask, fprmask, cprmask)
is passed to bfd_ecoff_debug_externals. */
static bfd_boolean
-ecoff_get_extr (sym, esym)
- asymbol *sym;
- EXTR *esym;
+ecoff_get_extr (asymbol *sym, EXTR *esym)
{
ecoff_symbol_type *ecoff_sym_ptr;
bfd *input_bfd;
@@ -2432,7 +2293,7 @@ ecoff_get_extr (sym, esym)
input_debug = &ecoff_data (input_bfd)->debug_info;
BFD_ASSERT (esym->ifd < input_debug->symbolic_header.ifdMax);
- if (input_debug->ifdmap != (RFDT *) NULL)
+ if (input_debug->ifdmap != NULL)
esym->ifd = input_debug->ifdmap[esym->ifd];
}
@@ -2443,9 +2304,7 @@ ecoff_get_extr (sym, esym)
bfd_ecoff_debug_externals. */
static void
-ecoff_set_index (sym, indx)
- asymbol *sym;
- bfd_size_type indx;
+ecoff_set_index (asymbol *sym, bfd_size_type indx)
{
ecoff_set_sym_index (sym, indx);
}
@@ -2453,8 +2312,7 @@ ecoff_set_index (sym, indx)
/* Write out an ECOFF file. */
bfd_boolean
-_bfd_ecoff_write_object_contents (abfd)
- bfd *abfd;
+_bfd_ecoff_write_object_contents (bfd *abfd)
{
const struct ecoff_backend_data * const backend = ecoff_backend (abfd);
const bfd_vma round = backend->round;
@@ -2464,11 +2322,9 @@ _bfd_ecoff_write_object_contents (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 *))
+ void (* const adjust_reloc_out) (bfd *, const arelent *, struct internal_reloc *)
= backend->adjust_reloc_out;
- void (* const swap_reloc_out)
- PARAMS ((bfd *, const struct internal_reloc *, PTR))
+ void (* const swap_reloc_out) (bfd *, const struct internal_reloc *, void *)
= backend->swap_reloc_out;
struct ecoff_debug_info * const debug = &ecoff_data (abfd)->debug_info;
HDRR * const symhdr = &debug->symbolic_header;
@@ -2482,8 +2338,8 @@ _bfd_ecoff_write_object_contents (abfd)
bfd_vma data_start;
bfd_boolean set_data_start;
bfd_size_type bss_size;
- PTR buff = NULL;
- PTR reloc_buff = NULL;
+ void * buff = NULL;
+ void * reloc_buff = NULL;
struct internal_filehdr internal_f;
struct internal_aouthdr internal_a;
int i;
@@ -2494,7 +2350,7 @@ _bfd_ecoff_write_object_contents (abfd)
count = 1;
for (current = abfd->sections;
- current != (asection *)NULL;
+ current != NULL;
current = current->next)
{
current->target_index = count;
@@ -2502,7 +2358,7 @@ _bfd_ecoff_write_object_contents (abfd)
}
if ((abfd->flags & D_PAGED) != 0)
- text_size = _bfd_ecoff_sizeof_headers (abfd, FALSE);
+ text_size = _bfd_ecoff_sizeof_headers (abfd, NULL);
else
text_size = 0;
text_start = 0;
@@ -2518,12 +2374,13 @@ _bfd_ecoff_write_object_contents (abfd)
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);
+ buff = bfd_malloc (siz);
if (buff == NULL)
goto error_return;
}
@@ -2531,8 +2388,9 @@ _bfd_ecoff_write_object_contents (abfd)
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 != NULL;
current = current->next)
{
struct internal_scnhdr section;
@@ -2544,13 +2402,13 @@ _bfd_ecoff_write_object_contents (abfd)
/* This seems to be correct for Irix 4 shared libraries. */
vma = bfd_get_section_vma (abfd, current);
- if (strcmp (current->name, _LIB) == 0)
+ if (streq (current->name, _LIB))
section.s_vaddr = 0;
else
section.s_vaddr = vma;
section.s_paddr = current->lma;
- section.s_size = bfd_get_section_size_before_reloc (current);
+ section.s_size = current->size;
/* If this section is unloadable then the scnptr will be 0. */
if ((current->flags & (SEC_LOAD | SEC_HAS_CONTENTS)) == 0)
@@ -2566,7 +2424,7 @@ _bfd_ecoff_write_object_contents (abfd)
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)
+ if (! streq (current->name, _PDATA))
section.s_lnnoptr = 0;
else
{
@@ -2582,7 +2440,7 @@ _bfd_ecoff_write_object_contents (abfd)
section.s_flags = ecoff_sec_to_styp_flags (current->name,
current->flags);
- if (bfd_coff_swap_scnhdr_out (abfd, (PTR) &section, buff) == 0
+ if (bfd_coff_swap_scnhdr_out (abfd, (void *) &section, buff) == 0
|| bfd_bwrite (buff, scnhsz, abfd) != scnhsz)
goto error_return;
@@ -2601,7 +2459,7 @@ _bfd_ecoff_write_object_contents (abfd)
|| (section.s_flags & STYP_ECOFF_FINI) != 0
|| section.s_flags == STYP_RCONST)
{
- text_size += bfd_get_section_size_before_reloc (current);
+ text_size += current->size;
if (! set_text_start || text_start > vma)
{
text_start = vma;
@@ -2617,7 +2475,7 @@ _bfd_ecoff_write_object_contents (abfd)
|| section.s_flags == STYP_XDATA
|| (section.s_flags & STYP_GOT) != 0)
{
- data_size += bfd_get_section_size_before_reloc (current);
+ data_size += current->size;
if (! set_data_start || data_start > vma)
{
data_start = vma;
@@ -2626,7 +2484,7 @@ _bfd_ecoff_write_object_contents (abfd)
}
else if ((section.s_flags & STYP_BSS) != 0
|| (section.s_flags & STYP_SBSS) != 0)
- bss_size += bfd_get_section_size_before_reloc (current);
+ bss_size += current->size;
else if (section.s_flags == 0
|| (section.s_flags & STYP_ECOFF_LIB) != 0
|| section.s_flags == STYP_COMMENT)
@@ -2731,11 +2589,11 @@ _bfd_ecoff_write_object_contents (abfd)
if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0)
goto error_return;
- bfd_coff_swap_filehdr_out (abfd, (PTR) &internal_f, buff);
+ bfd_coff_swap_filehdr_out (abfd, (void *) &internal_f, buff);
if (bfd_bwrite (buff, filhsz, abfd) != filhsz)
goto error_return;
- bfd_coff_swap_aouthdr_out (abfd, (PTR) &internal_a, buff);
+ bfd_coff_swap_aouthdr_out (abfd, (void *) &internal_a, buff);
if (bfd_bwrite (buff, aoutsz, abfd) != aoutsz)
goto error_return;
@@ -2756,7 +2614,7 @@ _bfd_ecoff_write_object_contents (abfd)
/* Write out the relocs. */
for (current = abfd->sections;
- current != (asection *) NULL;
+ current != NULL;
current = current->next)
{
arelent **reloc_ptr_ptr;
@@ -2775,6 +2633,7 @@ _bfd_ecoff_write_object_contents (abfd)
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)
@@ -2783,11 +2642,16 @@ _bfd_ecoff_write_object_contents (abfd)
asymbol *sym;
struct internal_reloc in;
- memset ((PTR) &in, 0, sizeof in);
+ memset ((void *) &in, 0, sizeof in);
reloc = *reloc_ptr_ptr;
sym = *reloc->sym_ptr_ptr;
+ /* If the howto field has not been initialised then skip this reloc.
+ This assumes that an error message has been issued elsewhere. */
+ if (reloc->howto == NULL)
+ continue;
+
in.r_vaddr = (reloc->address
+ bfd_get_section_vma (abfd, current));
in.r_type = reloc->howto->type;
@@ -2800,46 +2664,48 @@ _bfd_ecoff_write_object_contents (abfd)
else
{
const char *name;
+ unsigned int i;
+ static struct
+ {
+ const char * name;
+ long r_symndx;
+ }
+ section_symndx [] =
+ {
+ { _TEXT, RELOC_SECTION_TEXT },
+ { _RDATA, RELOC_SECTION_RDATA },
+ { _DATA, RELOC_SECTION_DATA },
+ { _SDATA, RELOC_SECTION_SDATA },
+ { _SBSS, RELOC_SECTION_SBSS },
+ { _BSS, RELOC_SECTION_BSS },
+ { _INIT, RELOC_SECTION_INIT },
+ { _LIT8, RELOC_SECTION_LIT8 },
+ { _LIT4, RELOC_SECTION_LIT4 },
+ { _XDATA, RELOC_SECTION_XDATA },
+ { _PDATA, RELOC_SECTION_PDATA },
+ { _FINI, RELOC_SECTION_FINI },
+ { _LITA, RELOC_SECTION_LITA },
+ { "*ABS*", RELOC_SECTION_ABS },
+ { _RCONST, RELOC_SECTION_RCONST }
+ };
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
+
+ for (i = 0; i < ARRAY_SIZE (section_symndx); i++)
+ if (streq (name, section_symndx[i].name))
+ {
+ in.r_symndx = section_symndx[i].r_symndx;
+ break;
+ }
+
+ if (i == ARRAY_SIZE (section_symndx))
abort ();
in.r_extern = 0;
}
(*adjust_reloc_out) (abfd, reloc, &in);
- (*swap_reloc_out) (abfd, &in, (PTR) out_ptr);
+ (*swap_reloc_out) (abfd, &in, (void *) out_ptr);
}
if (bfd_seek (abfd, current->rel_filepos, SEEK_SET) != 0)
@@ -2926,19 +2792,19 @@ _bfd_ecoff_write_object_contents (abfd)
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 "_ "
+#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
+#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
@@ -2946,11 +2812,10 @@ _bfd_ecoff_write_object_contents (abfd)
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;
+ecoff_armap_hash (const char *s,
+ unsigned int *rehash,
+ unsigned int size,
+ unsigned int hlog)
{
unsigned int hash;
@@ -2967,8 +2832,7 @@ ecoff_armap_hash (s, rehash, size, hlog)
/* Read in the armap. */
bfd_boolean
-_bfd_ecoff_slurp_armap (abfd)
- bfd *abfd;
+_bfd_ecoff_slurp_armap (bfd *abfd)
{
char nextname[17];
unsigned int i;
@@ -2983,7 +2847,7 @@ _bfd_ecoff_slurp_armap (abfd)
bfd_size_type amt;
/* Get the name of the first element. */
- i = bfd_bread ((PTR) nextname, (bfd_size_type) 16, abfd);
+ i = bfd_bread ((void *) nextname, (bfd_size_type) 16, abfd);
if (i == 0)
return TRUE;
if (i != 16)
@@ -2997,20 +2861,18 @@ _bfd_ecoff_slurp_armap (abfd)
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)
+ if (CONST_STRNEQ (nextname, "/ "))
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
+ if (! strneq (nextname, ecoff_backend (abfd)->armap_start, ARMAP_START_LENGTH)
|| 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)
+ || ! strneq (nextname + ARMAP_END_INDEX, ARMAP_END, sizeof ARMAP_END - 1))
{
bfd_has_map (abfd) = FALSE;
return TRUE;
@@ -3029,29 +2891,29 @@ _bfd_ecoff_slurp_armap (abfd)
/* Read in the armap. */
ardata = bfd_ardata (abfd);
mapdata = (struct areltdata *) _bfd_read_ar_hdr (abfd);
- if (mapdata == (struct areltdata *) NULL)
+ if (mapdata == NULL)
return FALSE;
parsed_size = mapdata->parsed_size;
- bfd_release (abfd, (PTR) mapdata);
+ bfd_release (abfd, (void *) mapdata);
- raw_armap = (char *) bfd_alloc (abfd, parsed_size);
- if (raw_armap == (char *) NULL)
+ raw_armap = bfd_alloc (abfd, parsed_size);
+ if (raw_armap == NULL)
return FALSE;
- if (bfd_bread ((PTR) raw_armap, parsed_size, abfd) != parsed_size)
+ if (bfd_bread ((void *) 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);
+ bfd_release (abfd, (void *) raw_armap);
return FALSE;
}
- ardata->tdata = (PTR) raw_armap;
+ ardata->tdata = (void *) raw_armap;
count = H_GET_32 (abfd, raw_armap);
ardata->symdef_count = 0;
- ardata->cache = (struct ar_cache *) NULL;
+ ardata->cache = NULL;
/* This code used to overlay the symdefs over the raw archive data,
but that doesn't work on a 64 bit host. */
@@ -3101,7 +2963,7 @@ _bfd_ecoff_slurp_armap (abfd)
amt = ardata->symdef_count;
amt *= sizeof (struct symdef);
- symdef_ptr = (struct symdef *) bfd_alloc (abfd, amt);
+ symdef_ptr = bfd_alloc (abfd, amt);
if (!symdef_ptr)
return FALSE;
@@ -3133,12 +2995,11 @@ _bfd_ecoff_slurp_armap (abfd)
/* 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;
+_bfd_ecoff_write_armap (bfd *abfd,
+ unsigned int elength,
+ struct orl *map,
+ unsigned int orl_count,
+ int stridx)
{
unsigned int hashsize, hashlog;
bfd_size_type symdefsize;
@@ -3169,7 +3030,7 @@ _bfd_ecoff_write_armap (abfd, elength, map, orl_count, stridx)
firstreal = SARMAG + sizeof (struct ar_hdr) + mapsize + elength;
- memset ((PTR) &hdr, 0, sizeof hdr);
+ memset ((void *) &hdr, 0, sizeof hdr);
/* Work out the ECOFF armap name. */
strcpy (hdr.ar_name, ecoff_backend (abfd)->armap_start);
@@ -3195,14 +3056,10 @@ _bfd_ecoff_write_armap (abfd, elength, map, orl_count, stridx)
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);
@@ -3214,15 +3071,15 @@ _bfd_ecoff_write_armap (abfd, elength, map, orl_count, stridx)
if (((char *) (&hdr))[i] == '\0')
(((char *) (&hdr))[i]) = ' ';
- if (bfd_bwrite ((PTR) &hdr, (bfd_size_type) sizeof (struct ar_hdr), abfd)
+ if (bfd_bwrite ((void *) &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)
+ if (bfd_bwrite ((void *) temp, (bfd_size_type) 4, abfd) != 4)
return FALSE;
- hashtable = (bfd_byte *) bfd_zalloc (abfd, symdefsize);
+ hashtable = bfd_zalloc (abfd, symdefsize);
if (!hashtable)
return FALSE;
@@ -3230,7 +3087,7 @@ _bfd_ecoff_write_armap (abfd, elength, map, orl_count, stridx)
last_elt = current;
for (i = 0; i < orl_count; i++)
{
- unsigned int hash, rehash;
+ unsigned int hash, rehash = 0;
/* Advance firstreal to the file position of this archive
element. */
@@ -3240,7 +3097,7 @@ _bfd_ecoff_write_armap (abfd, elength, map, orl_count, stridx)
{
firstreal += arelt_size (current) + sizeof (struct ar_hdr);
firstreal += firstreal % 2;
- current = current->next;
+ current = current->archive_next;
}
while (current != map[i].u.abfd);
}
@@ -3268,21 +3125,21 @@ _bfd_ecoff_write_armap (abfd, elength, map, orl_count, stridx)
H_PUT_32 (abfd, firstreal, (hashtable + hash * 8 + 4));
}
- if (bfd_bwrite ((PTR) hashtable, symdefsize, abfd) != symdefsize)
+ if (bfd_bwrite ((void *) 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)
+ if (bfd_bwrite ((void *) 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)
+ if (bfd_bwrite ((void *) (*map[i].name), len, abfd) != len)
return FALSE;
}
@@ -3301,21 +3158,20 @@ _bfd_ecoff_write_armap (abfd, elength, map, orl_count, stridx)
and the extended name table. */
const bfd_target *
-_bfd_ecoff_archive_p (abfd)
- bfd *abfd;
+_bfd_ecoff_archive_p (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_bread ((void *) 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;
+ return NULL;
}
- if (strncmp (armag, ARMAG, SARMAG) != 0)
+ if (! strneq (armag, ARMAG, SARMAG))
{
bfd_set_error (bfd_error_wrong_format);
return NULL;
@@ -3324,26 +3180,28 @@ _bfd_ecoff_archive_p (abfd)
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) = bfd_zalloc (abfd, amt);
+ if (bfd_ardata (abfd) == NULL)
{
bfd_ardata (abfd) = tdata_hold;
- return (const bfd_target *) NULL;
+ 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;
+ /* Already cleared by bfd_zalloc above.
+ 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)->extended_names_size = 0;
+ 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;
+ return NULL;
}
if (bfd_has_map (abfd))
@@ -3357,21 +3215,17 @@ _bfd_ecoff_archive_p (abfd)
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);
+ first = bfd_openr_next_archived_file (abfd, 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
+ It's almost 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;
@@ -3385,35 +3239,21 @@ _bfd_ecoff_archive_p (abfd)
/* 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;
+ecoff_link_hash_newfunc (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)
+ if (ret == 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)
+ if (ret == NULL)
return NULL;
/* Call the allocation method of the superclass. */
@@ -3429,7 +3269,7 @@ ecoff_link_hash_newfunc (entry, table, string)
ret->written = 0;
ret->small = 0;
}
- memset ((PTR) &ret->esym, 0, sizeof ret->esym);
+ memset ((void *) &ret->esym, 0, sizeof ret->esym);
return (struct bfd_hash_entry *) ret;
}
@@ -3437,20 +3277,20 @@ ecoff_link_hash_newfunc (entry, table, string)
/* Create an ECOFF link hash table. */
struct bfd_link_hash_table *
-_bfd_ecoff_bfd_link_hash_table_create (abfd)
- bfd *abfd;
+_bfd_ecoff_bfd_link_hash_table_create (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);
+ ret = bfd_malloc (amt);
if (ret == NULL)
return NULL;
- if (! _bfd_link_hash_table_init (&ret->root, abfd,
- ecoff_link_hash_newfunc))
+ if (!_bfd_link_hash_table_init (&ret->root, abfd,
+ ecoff_link_hash_newfunc,
+ sizeof (struct ecoff_link_hash_entry)))
{
free (ret);
- return (struct bfd_link_hash_table *) NULL;
+ return NULL;
}
return &ret->root;
}
@@ -3466,7 +3306,7 @@ _bfd_ecoff_bfd_link_hash_table_create (abfd)
#define ecoff_link_hash_traverse(table, func, info) \
(bfd_link_hash_traverse \
(&(table)->root, \
- (bfd_boolean (*) PARAMS ((struct bfd_link_hash_entry *, PTR))) (func), \
+ (bfd_boolean (*) (struct bfd_link_hash_entry *, void *)) (func), \
(info)))
/* Get the ECOFF link hash table from the info structure. This is
@@ -3474,368 +3314,6 @@ _bfd_ecoff_bfd_link_hash_table_create (abfd)
#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
@@ -3843,14 +3321,13 @@ ecoff_link_add_object_symbols (abfd, info)
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;
+ecoff_link_add_externals (bfd *abfd,
+ struct bfd_link_info *info,
+ void * external_ext,
+ char *ssext)
{
const struct ecoff_backend_data * const backend = ecoff_backend (abfd);
- void (* const swap_ext_in) PARAMS ((bfd *, PTR, EXTR *))
+ void (* const swap_ext_in) (bfd *, void *, EXTR *)
= backend->debug_swap.swap_ext_in;
bfd_size_type external_ext_size = backend->debug_swap.external_ext_size;
unsigned long ext_count;
@@ -3863,7 +3340,7 @@ ecoff_link_add_externals (abfd, info, external_ext, ssext)
amt = ext_count;
amt *= sizeof (struct bfd_link_hash_entry *);
- sym_hash = (struct bfd_link_hash_entry **) bfd_alloc (abfd, amt);
+ sym_hash = bfd_alloc (abfd, amt);
if (!sym_hash)
return FALSE;
ecoff_data (abfd)->sym_hashes = (struct ecoff_link_hash_entry **) sym_hash;
@@ -3881,7 +3358,7 @@ ecoff_link_add_externals (abfd, info, external_ext, ssext)
*sym_hash = NULL;
- (*swap_ext_in) (abfd, (PTR) ext_ptr, &esym);
+ (*swap_ext_in) (abfd, (void *) ext_ptr, &esym);
/* Skip debugging symbols. */
skip = FALSE;
@@ -3923,15 +3400,15 @@ ecoff_link_add_externals (abfd, info, external_ext, ssext)
section = NULL;
break;
case scText:
- section = bfd_make_section_old_way (abfd, ".text");
+ section = bfd_make_section_old_way (abfd, _TEXT);
value -= section->vma;
break;
case scData:
- section = bfd_make_section_old_way (abfd, ".data");
+ section = bfd_make_section_old_way (abfd, _DATA);
value -= section->vma;
break;
case scBss:
- section = bfd_make_section_old_way (abfd, ".bss");
+ section = bfd_make_section_old_way (abfd, _BSS);
value -= section->vma;
break;
case scAbs:
@@ -3941,15 +3418,15 @@ ecoff_link_add_externals (abfd, info, external_ext, ssext)
section = bfd_und_section_ptr;
break;
case scSData:
- section = bfd_make_section_old_way (abfd, ".sdata");
+ section = bfd_make_section_old_way (abfd, _SDATA);
value -= section->vma;
break;
case scSBss:
- section = bfd_make_section_old_way (abfd, ".sbss");
+ section = bfd_make_section_old_way (abfd, _SBSS);
value -= section->vma;
break;
case scRData:
- section = bfd_make_section_old_way (abfd, ".rdata");
+ section = bfd_make_section_old_way (abfd, _RDATA);
value -= section->vma;
break;
case scCommon:
@@ -3979,20 +3456,20 @@ ecoff_link_add_externals (abfd, info, external_ext, ssext)
section = bfd_und_section_ptr;
break;
case scInit:
- section = bfd_make_section_old_way (abfd, ".init");
+ section = bfd_make_section_old_way (abfd, _INIT);
value -= section->vma;
break;
case scFini:
- section = bfd_make_section_old_way (abfd, ".fini");
+ section = bfd_make_section_old_way (abfd, _FINI);
value -= section->vma;
break;
case scRConst:
- section = bfd_make_section_old_way (abfd, ".rconst");
+ section = bfd_make_section_old_way (abfd, _RCONST);
value -= section->vma;
break;
}
- if (section == (asection *) NULL)
+ if (section == NULL)
continue;
name = ssext + esym.asym.iss;
@@ -4000,7 +3477,7 @@ ecoff_link_add_externals (abfd, info, external_ext, ssext)
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)))
+ section, value, NULL, TRUE, TRUE, sym_hash)))
return FALSE;
h = (struct ecoff_link_hash_entry *) *sym_hash;
@@ -4009,7 +3486,7 @@ ecoff_link_add_externals (abfd, info, external_ext, ssext)
symbol information. */
if (info->hash->creator->flavour == bfd_get_flavour (abfd))
{
- if (h->abfd == (bfd *) NULL
+ if (h->abfd == NULL
|| (! bfd_is_und_section (section)
&& (! bfd_is_com_section (section)
|| (h->root.type != bfd_link_hash_defined
@@ -4030,7 +3507,7 @@ ecoff_link_add_externals (abfd, info, external_ext, ssext)
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)
+ && streq (h->root.u.c.p->section->name, SCOMMON))
{
h->root.u.c.p->section = bfd_make_section_old_way (abfd,
SCOMMON);
@@ -4043,243 +3520,382 @@ ecoff_link_add_externals (abfd, info, external_ext, ssext)
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. */
+/* Add symbols from an ECOFF object file to the global linker hash
+ table. */
-struct extsym_info
+static bfd_boolean
+ecoff_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info)
{
- bfd *abfd;
- struct bfd_link_info *info;
-};
+ HDRR *symhdr;
+ bfd_size_type external_ext_size;
+ void * external_ext = NULL;
+ bfd_size_type esize;
+ char *ssext = NULL;
+ bfd_boolean result;
-/* 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. */
+ if (! ecoff_slurp_symbolic_header (abfd))
+ return FALSE;
-bfd_boolean
-_bfd_ecoff_bfd_final_link (abfd, info)
- bfd *abfd;
- struct bfd_link_info *info;
+ /* 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 = 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 = 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;
+}
+
+/* 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 (bfd *abfd,
+ struct bfd_link_info *info,
+ bfd_boolean *pneeded)
{
const struct ecoff_backend_data * const backend = ecoff_backend (abfd);
- struct ecoff_debug_info * const debug = &ecoff_data (abfd)->debug_info;
+ void (* const swap_ext_in) (bfd *, void *, EXTR *)
+ = backend->debug_swap.swap_ext_in;
HDRR *symhdr;
- PTR handle;
- register bfd *input_bfd;
- asection *o;
- struct bfd_link_order *p;
- struct extsym_info einfo;
+ bfd_size_type external_ext_size;
+ void * external_ext = NULL;
+ bfd_size_type esize;
+ char *ssext = NULL;
+ char *ext_ptr;
+ char *ext_end;
- /* 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;
+ *pneeded = FALSE;
- /* 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;
+ if (! ecoff_slurp_symbolic_header (abfd))
+ goto error_return;
- handle = bfd_ecoff_debug_init (abfd, debug, &backend->debug_swap, info);
- if (handle == (PTR) NULL)
- return FALSE;
+ /* If there are no symbols, we don't want it. */
+ if (bfd_get_symcount (abfd) == 0)
+ goto successful_return;
- /* 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;
+ symhdr = &ecoff_data (abfd)->debug_info.symbolic_header;
- 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;
+ /* 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 = bfd_malloc (esize);
+ if (external_ext == NULL && esize != 0)
+ goto error_return;
- /* 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];
- }
+ if (bfd_seek (abfd, (file_ptr) symhdr->cbExtOffset, SEEK_SET) != 0
+ || bfd_bread (external_ext, esize, abfd) != esize)
+ goto error_return;
- /* 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);
+ ssext = bfd_malloc ((bfd_size_type) symhdr->issExtMax);
+ if (ssext == NULL && symhdr->issExtMax != 0)
+ goto error_return;
- if (info->relocatable)
+ 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)
{
- /* 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)
+ EXTR esym;
+ bfd_boolean def;
+ const char *name;
+ struct bfd_link_hash_entry *h;
+
+ (*swap_ext_in) (abfd, (void *) 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)
{
- 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;
+ 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 == 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;
}
- /* Compute the reloc and symbol file positions. */
- ecoff_compute_reloc_file_positions (abfd);
+ 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;
+}
- /* 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;
+/* 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. */
- bfd_ecoff_debug_free (handle, abfd, debug, &backend->debug_swap, info);
+static bfd_boolean
+ecoff_link_add_archive_symbols (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 (info->relocatable)
+ if (! bfd_has_map (abfd))
{
- /* 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;
+ /* 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;
}
- /* Get a value for the GP register. */
- if (ecoff_data (abfd)->gp == 0)
+ /* 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 == 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 != NULL)
{
struct bfd_link_hash_entry *h;
+ unsigned int hash, rehash = 0;
+ unsigned int file_offset;
+ const char *name;
+ bfd *element;
- 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)
+ 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)
{
- bfd_vma lo;
+ /* 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)->u.undef.next;
+ else
+ pundef = &(*pundef)->u.undef.next;
+ continue;
+ }
- /* 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;
+ /* 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)->u.undef.next;
+ continue;
}
- else
+
+ /* 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)
{
- /* 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. */
+ /* Nothing in this slot. */
+ pundef = &(*pundef)->u.undef.next;
+ continue;
}
- }
- 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)
+ name = stringbase + H_GET_32 (abfd, hashtable + (hash * 8));
+ if (name[0] != h->root.string[0]
+ || ! streq (name, h->root.string))
{
- 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)
+ 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))
{
- if (! ecoff_reloc_link_order (abfd, info, o, p))
- return FALSE;
+ 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]
+ && streq (name, h->root.string))
+ {
+ found = TRUE;
+ break;
+ }
}
- else
+
+ if (! found)
{
- if (! _bfd_default_link_order (abfd, info, o, p))
- return FALSE;
+ pundef = &(*pundef)->u.undef.next;
+ continue;
}
+
+ hash = srch;
}
- }
- bfd_get_symcount (abfd) = symhdr->iextMax + symhdr->isymMax;
+ element = (*backend->get_elt_at_filepos) (abfd, (file_ptr) file_offset);
+ if (element == NULL)
+ return FALSE;
- ecoff_data (abfd)->linker = TRUE;
+ 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)->u.undef.next;
+ }
return TRUE;
}
+/* Given an ECOFF BFD, add symbols to the global hash table as
+ appropriate. */
+
+bfd_boolean
+_bfd_ecoff_bfd_link_add_symbols (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;
+ }
+}
+
+
+/* ECOFF final link routines. */
+
+/* Structure used to pass information to ecoff_link_write_external. */
+
+struct extsym_info
+{
+ bfd *abfd;
+ struct bfd_link_info *info;
+};
+
/* 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;
+ecoff_final_link_debug_accumulate (bfd *output_bfd,
+ bfd *input_bfd,
+ struct bfd_link_info *info,
+ void * handle)
{
struct ecoff_debug_info * const debug = &ecoff_data (input_bfd)->debug_info;
const struct ecoff_debug_swap * const swap =
@@ -4293,7 +3909,7 @@ ecoff_final_link_debug_accumulate (output_bfd, input_bfd, info, handle)
else \
{ \
bfd_size_type amt = (bfd_size_type) size * symhdr->count; \
- debug->ptr = (type) bfd_malloc (amt); \
+ debug->ptr = bfd_malloc (amt); \
if (debug->ptr == NULL) \
{ \
ret = FALSE; \
@@ -4313,15 +3929,15 @@ ecoff_final_link_debug_accumulate (output_bfd, input_bfd, info, handle)
{
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_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 (external_fdr, cbFdOffset, ifdMax, swap->external_fdr_size, PTR);
- READ (external_rfd, cbRfdOffset, crfd, swap->external_rfd_size, PTR);
+ READ (external_fdr, cbFdOffset, ifdMax, swap->external_fdr_size, void *);
+ READ (external_rfd, cbRfdOffset, crfd, swap->external_rfd_size, void *);
}
#undef READ
@@ -4370,229 +3986,49 @@ ecoff_final_link_debug_accumulate (output_bfd, input_bfd, info, handle)
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;
+ecoff_indirect_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;
+ void * external_relocs = NULL;
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;
+ if (input_section->size == 0)
+ return TRUE;
BFD_ASSERT (input_section->output_section == output_section);
BFD_ASSERT (input_section->output_offset == link_order->offset);
- BFD_ASSERT (cooked_size == link_order->size);
+ BFD_ASSERT (input_section->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)
+ /* Get the section contents. */
+ if (!bfd_malloc_and_get_section (input_bfd, input_section, &contents))
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;
+ external_relocs = 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;
- }
+ 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)
@@ -4603,9 +4039,9 @@ ecoff_indirect_link_order (output_bfd, info, output_section, link_order)
/* Write out the relocated section. */
if (! bfd_set_section_contents (output_bfd,
output_section,
- (PTR) contents,
- (file_ptr) input_section->output_offset,
- cooked_size))
+ contents,
+ input_section->output_offset,
+ input_section->size))
goto error_return;
/* If we are producing relocatable output, the relocs were
@@ -4625,14 +4061,14 @@ ecoff_indirect_link_order (output_bfd, info, output_section, link_order)
if (contents != NULL)
free (contents);
- if (external_relocs != NULL && section_tdata == NULL)
+ if (external_relocs != NULL)
free (external_relocs);
return TRUE;
error_return:
if (contents != NULL)
free (contents);
- if (external_relocs != NULL && section_tdata == NULL)
+ if (external_relocs != NULL)
free (external_relocs);
return FALSE;
}
@@ -4643,11 +4079,10 @@ ecoff_indirect_link_order (output_bfd, info, output_section, link_order)
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;
+ecoff_reloc_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;
@@ -4704,7 +4139,7 @@ ecoff_reloc_link_order (output_bfd, info, output_section, link_order)
/* 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;
+ rel.sym_ptr_ptr = NULL;
}
}
@@ -4719,8 +4154,8 @@ ecoff_reloc_link_order (output_bfd, info, output_section, link_order)
bfd_byte *buf;
size = bfd_get_reloc_size (rel.howto);
- buf = (bfd_byte *) bfd_zmalloc (size);
- if (buf == (bfd_byte *) NULL)
+ buf = bfd_zmalloc (size);
+ if (buf == NULL)
return FALSE;
rstat = _bfd_relocate_contents (rel.howto, output_bfd,
(bfd_vma) addend, buf);
@@ -4733,19 +4168,19 @@ ecoff_reloc_link_order (output_bfd, info, output_section, link_order)
abort ();
case bfd_reloc_overflow:
if (! ((*info->callbacks->reloc_overflow)
- (info,
+ (info, NULL,
(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)))
+ rel.howto->name, addend, NULL,
+ NULL, (bfd_vma) 0)))
{
free (buf);
return FALSE;
}
break;
}
- ok = bfd_set_section_contents (output_bfd, output_section, (PTR) buf,
+ ok = bfd_set_section_contents (output_bfd, output_section, (void *) buf,
(file_ptr) link_order->offset, size);
free (buf);
if (! ok)
@@ -4767,14 +4202,14 @@ ecoff_reloc_link_order (output_bfd, info, output_section, link_order)
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
+ if (h != 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)))
+ (info, link_order->u.reloc.p->u.name, NULL,
+ NULL, (bfd_vma) 0)))
return FALSE;
in.r_symndx = 0;
}
@@ -4783,40 +4218,43 @@ ecoff_reloc_link_order (output_bfd, info, output_section, link_order)
else
{
const char *name;
+ unsigned int i;
+ static struct
+ {
+ const char * name;
+ long r_symndx;
+ }
+ section_symndx [] =
+ {
+ { _TEXT, RELOC_SECTION_TEXT },
+ { _RDATA, RELOC_SECTION_RDATA },
+ { _DATA, RELOC_SECTION_DATA },
+ { _SDATA, RELOC_SECTION_SDATA },
+ { _SBSS, RELOC_SECTION_SBSS },
+ { _BSS, RELOC_SECTION_BSS },
+ { _INIT, RELOC_SECTION_INIT },
+ { _LIT8, RELOC_SECTION_LIT8 },
+ { _LIT4, RELOC_SECTION_LIT4 },
+ { _XDATA, RELOC_SECTION_XDATA },
+ { _PDATA, RELOC_SECTION_PDATA },
+ { _FINI, RELOC_SECTION_FINI },
+ { _LITA, RELOC_SECTION_LITA },
+ { "*ABS*", RELOC_SECTION_ABS },
+ { _RCONST, RELOC_SECTION_RCONST }
+ };
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
+
+ for (i = 0; i < ARRAY_SIZE (section_symndx); i++)
+ if (streq (name, section_symndx[i].name))
+ {
+ in.r_symndx = section_symndx[i].r_symndx;
+ break;
+ }
+
+ if (i == ARRAY_SIZE (section_symndx))
abort ();
+
in.r_extern = 0;
}
@@ -4825,16 +4263,16 @@ ecoff_reloc_link_order (output_bfd, info, output_section, link_order)
/* Get some memory and swap out the reloc. */
external_reloc_size = ecoff_backend (output_bfd)->external_reloc_size;
- rbuf = (bfd_byte *) bfd_malloc (external_reloc_size);
- if (rbuf == (bfd_byte *) NULL)
+ rbuf = bfd_malloc (external_reloc_size);
+ if (rbuf == NULL)
return FALSE;
- (*ecoff_backend (output_bfd)->swap_reloc_out) (output_bfd, &in, (PTR) rbuf);
+ (*ecoff_backend (output_bfd)->swap_reloc_out) (output_bfd, &in, (void *) 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)
+ && (bfd_bwrite ((void *) rbuf, external_reloc_size, output_bfd)
== external_reloc_size));
if (ok)
@@ -4844,3 +4282,353 @@ ecoff_reloc_link_order (output_bfd, info, output_section, link_order)
return ok;
}
+
+/* Put out information for an external symbol. These come only from
+ the hash table. */
+
+static bfd_boolean
+ecoff_link_write_external (struct ecoff_link_hash_entry *h, void * 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 == 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;
+ unsigned int i;
+ static struct
+ {
+ const char * name;
+ int sc;
+ }
+ section_storage_classes [] =
+ {
+ { _TEXT, scText },
+ { _DATA, scData },
+ { _SDATA, scSData },
+ { _RDATA, scRData },
+ { _BSS, scBss },
+ { _SBSS, scSBss },
+ { _INIT, scInit },
+ { _FINI, scFini },
+ { _PDATA, scPData },
+ { _XDATA, scXData },
+ { _RCONST, scRConst }
+ };
+
+ output_section = h->root.u.def.section->output_section;
+ name = bfd_section_name (output_section->owner, output_section);
+
+ for (i = 0; i < ARRAY_SIZE (section_storage_classes); i++)
+ if (streq (name, section_storage_classes[i].name))
+ {
+ h->esym.asym.sc = section_storage_classes[i].sc;
+ break;
+ }
+
+ if (i == ARRAY_SIZE (section_storage_classes))
+ 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));
+}
+
+/* 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 (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;
+ void * handle;
+ 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 == NULL)
+ return FALSE;
+
+ /* Accumulate the debugging symbols from each input BFD. */
+ for (input_bfd = info->input_bfds;
+ input_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,
+ (void *) &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 != NULL; o = o->next)
+ {
+ o->reloc_count = 0;
+ for (p = o->map_head.link_order;
+ p != 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 != 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 != 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 != NULL; o = o->next)
+ {
+ if (o->vma < lo
+ && (streq (o->name, _SBSS)
+ || streq (o->name, _SDATA)
+ || streq (o->name, _LIT4)
+ || streq (o->name, _LIT8)
+ || streq (o->name, _LITA)))
+ 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 != NULL; o = o->next)
+ {
+ for (p = o->map_head.link_order;
+ p != 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;
+}
diff --git a/contrib/binutils/bfd/ecofflink.c b/contrib/binutils/bfd/ecofflink.c
index 9e23848..8ee68e0 100644
--- a/contrib/binutils/bfd/ecofflink.c
+++ b/contrib/binutils/bfd/ecofflink.c
@@ -1,6 +1,6 @@
/* Routines to link ECOFF debugging information.
- Copyright 1993, 1994, 1995, 1996, 1997, 2000, 2001, 2002, 2003
- Free Software Foundation, Inc.
+ Copyright 1993, 1994, 1995, 1996, 1997, 1999, 2000, 2001, 2002, 2003,
+ 2004, 2005, 2006, 2007 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.
@@ -17,10 +17,10 @@
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. */
+ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "bfdlink.h"
#include "libbfd.h"
#include "objalloc.h"
@@ -501,8 +501,8 @@ bfd_ecoff_debug_init (output_bfd, output_debug, output_swap, info)
ainfo = (struct accumulate *) bfd_malloc (amt);
if (!ainfo)
return NULL;
- if (! bfd_hash_table_init_n (&ainfo->fdr_hash.table, string_hash_newfunc,
- 1021))
+ if (!bfd_hash_table_init_n (&ainfo->fdr_hash.table, string_hash_newfunc,
+ sizeof (struct string_hash_entry), 1021))
return NULL;
ainfo->line = NULL;
@@ -528,7 +528,8 @@ bfd_ecoff_debug_init (output_bfd, output_debug, output_swap, info)
if (! info->relocatable)
{
- if (! bfd_hash_table_init (&ainfo->str_hash.table, string_hash_newfunc))
+ if (!bfd_hash_table_init (&ainfo->str_hash.table, string_hash_newfunc,
+ sizeof (struct string_hash_entry)))
return NULL;
/* The first entry in the string table is the empty string. */
@@ -781,7 +782,6 @@ bfd_ecoff_debug_accumulate (handle, output_bfd, output_debug, output_swap,
fdr_ptr += fdr_add, i++)
{
FDR fdr;
- bfd_vma fdr_adr;
bfd_byte *sym_out;
bfd_byte *lraw_src;
bfd_byte *lraw_end;
@@ -798,22 +798,6 @@ bfd_ecoff_debug_accumulate (handle, output_bfd, output_debug, output_swap,
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. */
@@ -856,19 +840,6 @@ bfd_ecoff_debug_accumulate (handle, output_bfd, output_debug, output_swap,
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;
@@ -978,9 +949,8 @@ bfd_ecoff_debug_accumulate (handle, output_bfd, output_debug, output_swap,
output_symhdr->issMax += fdr.cbSs;
}
- if ((output_bfd->xvec->header_byteorder
- == input_bfd->xvec->header_byteorder)
- && input_debug->adjust == (struct ecoff_value_adjust *) NULL)
+ if (output_bfd->xvec->header_byteorder
+ == input_bfd->xvec->header_byteorder)
{
/* The two BFD's have the same endianness, and we don't have
to adjust the PDR addresses, so simply copying the
@@ -1036,23 +1006,6 @@ bfd_ecoff_debug_accumulate (handle, output_bfd, output_debug, output_swap,
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);
}
@@ -1199,7 +1152,7 @@ bfd_ecoff_debug_accumulate_other (handle, output_bfd, output_debug,
fdr.issBase = output_symhdr->issMax;
fdr.cbSs = 0;
fdr.rss = ecoff_add_string (ainfo, info, output_debug, &fdr,
- bfd_archive_filename (input_bfd));
+ input_bfd->filename);
if (fdr.rss == -1)
return FALSE;
fdr.isymBase = output_symhdr->isymMax;
@@ -1383,10 +1336,14 @@ bfd_ecoff_debug_one_external (abfd, debug, swap, name, esym)
- (char *) debug->external_ext)
< (symhdr->iextMax + 1) * external_ext_size)
{
- if (! ecoff_add_bytes ((char **) &debug->external_ext,
- (char **) &debug->external_ext_end,
+ char *external_ext = debug->external_ext;
+ char *external_ext_end = debug->external_ext_end;
+ if (! ecoff_add_bytes ((char **) &external_ext,
+ (char **) &external_ext_end,
(symhdr->iextMax + 1) * (size_t) external_ext_size))
return FALSE;
+ debug->external_ext = external_ext;
+ debug->external_ext_end = external_ext_end;
}
esym->asym.iss = symhdr->issExtMax;
@@ -1884,24 +1841,9 @@ mk_fdrtab (abfd, debug_info, debug_swap, line_info)
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
{
@@ -2160,11 +2102,6 @@ lookup_line (abfd, debug_info, debug_swap, line_info)
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.
diff --git a/contrib/binutils/bfd/ecoffswap.h b/contrib/binutils/bfd/ecoffswap.h
index 7ea0394..4d93d9d 100644
--- a/contrib/binutils/bfd/ecoffswap.h
+++ b/contrib/binutils/bfd/ecoffswap.h
@@ -1,5 +1,5 @@
/* Generic ECOFF swapping routines, for BFD.
- Copyright 1992, 1993, 1994, 1995, 1996, 2000, 2001, 2002
+ Copyright 1992, 1993, 1994, 1995, 1996, 2000, 2001, 2002, 2004, 2005
Free Software Foundation, Inc.
Written by Cygnus Support.
@@ -17,7 +17,7 @@
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. */
+ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
/* NOTE: This is a header file, but it contains executable routines.
This is done this way because these routines are substantially
@@ -65,40 +65,37 @@
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 *));
+ (int, const struct tir_ext *, TIR *);
extern void _bfd_ecoff_swap_tir_out
- PARAMS ((int, const TIR *, struct tir_ext *));
+ (int, const TIR *, struct tir_ext *);
extern void _bfd_ecoff_swap_rndx_in
- PARAMS ((int, const struct rndx_ext *, RNDXR *));
+ (int, const struct rndx_ext *, RNDXR *);
extern void _bfd_ecoff_swap_rndx_out
- PARAMS ((int, const RNDXR *, struct rndx_ext *));
+ (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));
+static void ecoff_swap_hdr_in (bfd *, void *, HDRR *);
+static void ecoff_swap_hdr_out (bfd *, const HDRR *, void *);
+static void ecoff_swap_fdr_in (bfd *, void *, FDR *);
+static void ecoff_swap_fdr_out (bfd *, const FDR *, void *);
+static void ecoff_swap_pdr_in (bfd *, void *, PDR *);
+static void ecoff_swap_pdr_out (bfd *, const PDR *, void *);
+static void ecoff_swap_sym_in (bfd *, void *, SYMR *);
+static void ecoff_swap_sym_out (bfd *, const SYMR *, void *);
+static void ecoff_swap_ext_in (bfd *, void *, EXTR *);
+static void ecoff_swap_ext_out (bfd *, const EXTR *, void *);
+static void ecoff_swap_rfd_in (bfd *, void *, RFDT *);
+static void ecoff_swap_rfd_out (bfd *, const RFDT *, void *);
+static void ecoff_swap_opt_in (bfd *, void *, OPTR *);
+static void ecoff_swap_opt_out (bfd *, const OPTR *, void *);
+static void ecoff_swap_dnr_in (bfd *, void *, DNR *);
+static void ecoff_swap_dnr_out (bfd *, const DNR *, void *);
/* Swap in the symbolic header. */
static void
-ecoff_swap_hdr_in (abfd, ext_copy, intern)
- bfd *abfd;
- PTR ext_copy;
- HDRR *intern;
+ecoff_swap_hdr_in (bfd *abfd, void * ext_copy, HDRR *intern)
{
struct hdr_ext ext[1];
@@ -131,7 +128,7 @@ ecoff_swap_hdr_in (abfd, ext_copy, intern)
intern->cbExtOffset = ECOFF_GET_OFF (abfd, ext->h_cbExtOffset);
#ifdef TEST
- if (memcmp ((char *)ext, (char *)intern, sizeof (*intern)) != 0)
+ if (memcmp ((char *) ext, (char *) intern, sizeof (*intern)) != 0)
abort ();
#endif
}
@@ -139,10 +136,7 @@ ecoff_swap_hdr_in (abfd, ext_copy, intern)
/* 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;
+ecoff_swap_hdr_out (bfd *abfd, const HDRR *intern_copy, void * ext_ptr)
{
struct hdr_ext *ext = (struct hdr_ext *) ext_ptr;
HDRR intern[1];
@@ -184,10 +178,7 @@ ecoff_swap_hdr_out (abfd, intern_copy, ext_ptr)
/* Swap in the file descriptor record. */
static void
-ecoff_swap_fdr_in (abfd, ext_copy, intern)
- bfd *abfd;
- PTR ext_copy;
- FDR *intern;
+ecoff_swap_fdr_in (bfd *abfd, void * ext_copy, FDR *intern)
{
struct fdr_ext ext[1];
@@ -247,7 +238,7 @@ ecoff_swap_fdr_in (abfd, ext_copy, intern)
intern->cbLine = ECOFF_GET_OFF (abfd, ext->f_cbLine);
#ifdef TEST
- if (memcmp ((char *)ext, (char *)intern, sizeof (*intern)) != 0)
+ if (memcmp ((char *) ext, (char *) intern, sizeof (*intern)) != 0)
abort ();
#endif
}
@@ -255,10 +246,7 @@ ecoff_swap_fdr_in (abfd, ext_copy, intern)
/* 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;
+ecoff_swap_fdr_out (bfd *abfd, const FDR *intern_copy, void * ext_ptr)
{
struct fdr_ext *ext = (struct fdr_ext *) ext_ptr;
FDR intern[1];
@@ -319,26 +307,21 @@ ecoff_swap_fdr_out (abfd, intern_copy, ext_ptr)
ECOFF_PUT_OFF (abfd, intern->cbLine, ext->f_cbLine);
#ifdef TEST
- if (memcmp ((char *)ext, (char *)intern, sizeof (*intern)) != 0)
+ 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;
+ecoff_swap_pdr_in (bfd *abfd, void * ext_copy, PDR *intern)
{
struct pdr_ext ext[1];
*ext = *(struct pdr_ext *) ext_copy;
- memset ((PTR) intern, 0, sizeof (*intern));
+ memset ((void *) intern, 0, sizeof (*intern));
intern->adr = ECOFF_GET_OFF (abfd, ext->p_adr);
intern->isym = H_GET_32 (abfd, ext->p_isym);
@@ -386,7 +369,7 @@ ecoff_swap_pdr_in (abfd, ext_copy, intern)
#endif
#ifdef TEST
- if (memcmp ((char *)ext, (char *)intern, sizeof (*intern)) != 0)
+ if (memcmp ((char *) ext, (char *) intern, sizeof (*intern)) != 0)
abort ();
#endif
}
@@ -394,10 +377,7 @@ ecoff_swap_pdr_in (abfd, ext_copy, intern)
/* 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;
+ecoff_swap_pdr_out (bfd *abfd, const PDR *intern_copy, void * ext_ptr)
{
struct pdr_ext *ext = (struct pdr_ext *) ext_ptr;
PDR intern[1];
@@ -449,90 +429,15 @@ ecoff_swap_pdr_out (abfd, intern_copy, ext_ptr)
#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)
+ 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;
+ecoff_swap_sym_in (bfd *abfd, void * ext_copy, SYMR *intern)
{
struct sym_ext ext[1];
@@ -578,7 +483,7 @@ ecoff_swap_sym_in (abfd, ext_copy, intern)
}
#ifdef TEST
- if (memcmp ((char *)ext, (char *)intern, sizeof (*intern)) != 0)
+ if (memcmp ((char *) ext, (char *) intern, sizeof (*intern)) != 0)
abort ();
#endif
}
@@ -586,10 +491,7 @@ ecoff_swap_sym_in (abfd, ext_copy, intern)
/* 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;
+ecoff_swap_sym_out (bfd *abfd, const SYMR *intern_copy, void * ext_ptr)
{
struct sym_ext *ext = (struct sym_ext *) ext_ptr;
SYMR intern[1];
@@ -631,7 +533,7 @@ ecoff_swap_sym_out (abfd, intern_copy, ext_ptr)
}
#ifdef TEST
- if (memcmp ((char *)ext, (char *)intern, sizeof (*intern)) != 0)
+ if (memcmp ((char *) ext, (char *) intern, sizeof (*intern)) != 0)
abort ();
#endif
}
@@ -639,10 +541,7 @@ ecoff_swap_sym_out (abfd, intern_copy, ext_ptr)
/* Swap in an external symbol record. */
static void
-ecoff_swap_ext_in (abfd, ext_copy, intern)
- bfd *abfd;
- PTR ext_copy;
- EXTR *intern;
+ecoff_swap_ext_in (bfd *abfd, void * ext_copy, EXTR *intern)
{
struct ext_ext ext[1];
@@ -673,7 +572,7 @@ ecoff_swap_ext_in (abfd, ext_copy, intern)
ecoff_swap_sym_in (abfd, &ext->es_asym, &intern->asym);
#ifdef TEST
- if (memcmp ((char *)ext, (char *)intern, sizeof (*intern)) != 0)
+ if (memcmp ((char *) ext, (char *) intern, sizeof (*intern)) != 0)
abort ();
#endif
}
@@ -681,10 +580,7 @@ ecoff_swap_ext_in (abfd, ext_copy, intern)
/* 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;
+ecoff_swap_ext_out (bfd *abfd, const EXTR *intern_copy, void * ext_ptr)
{
struct ext_ext *ext = (struct ext_ext *) ext_ptr;
EXTR intern[1];
@@ -726,7 +622,7 @@ ecoff_swap_ext_out (abfd, intern_copy, ext_ptr)
ecoff_swap_sym_out (abfd, &intern->asym, &ext->es_asym);
#ifdef TEST
- if (memcmp ((char *)ext, (char *)intern, sizeof (*intern)) != 0)
+ if (memcmp ((char *) ext, (char *) intern, sizeof (*intern)) != 0)
abort ();
#endif
}
@@ -734,17 +630,14 @@ ecoff_swap_ext_out (abfd, intern_copy, ext_ptr)
/* Swap in a relative file descriptor. */
static void
-ecoff_swap_rfd_in (abfd, ext_ptr, intern)
- bfd *abfd;
- PTR ext_ptr;
- RFDT *intern;
+ecoff_swap_rfd_in (bfd *abfd, void * 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)
+ if (memcmp ((char *) ext, (char *) intern, sizeof (*intern)) != 0)
abort ();
#endif
}
@@ -752,17 +645,14 @@ ecoff_swap_rfd_in (abfd, ext_ptr, intern)
/* Swap out a relative file descriptor. */
static void
-ecoff_swap_rfd_out (abfd, intern, ext_ptr)
- bfd *abfd;
- const RFDT *intern;
- PTR ext_ptr;
+ecoff_swap_rfd_out (bfd *abfd, const RFDT *intern, void * 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)
+ if (memcmp ((char *) ext, (char *) intern, sizeof (*intern)) != 0)
abort ();
#endif
}
@@ -770,10 +660,7 @@ ecoff_swap_rfd_out (abfd, intern, ext_ptr)
/* Swap in an optimization symbol. */
static void
-ecoff_swap_opt_in (abfd, ext_copy, intern)
- bfd *abfd;
- PTR ext_copy;
- OPTR *intern;
+ecoff_swap_opt_in (bfd *abfd, void * ext_copy, OPTR * intern)
{
struct opt_ext ext[1];
@@ -803,7 +690,7 @@ ecoff_swap_opt_in (abfd, ext_copy, intern)
intern->offset = H_GET_32 (abfd, ext->o_offset);
#ifdef TEST
- if (memcmp ((char *)ext, (char *)intern, sizeof (*intern)) != 0)
+ if (memcmp ((char *) ext, (char *) intern, sizeof (*intern)) != 0)
abort ();
#endif
}
@@ -811,10 +698,7 @@ ecoff_swap_opt_in (abfd, ext_copy, intern)
/* 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;
+ecoff_swap_opt_out (bfd *abfd, const OPTR *intern_copy, void * ext_ptr)
{
struct opt_ext *ext = (struct opt_ext *) ext_ptr;
OPTR intern[1];
@@ -843,7 +727,7 @@ ecoff_swap_opt_out (abfd, intern_copy, ext_ptr)
H_PUT_32 (abfd, intern->value, ext->o_offset);
#ifdef TEST
- if (memcmp ((char *)ext, (char *)intern, sizeof (*intern)) != 0)
+ if (memcmp ((char *) ext, (char *) intern, sizeof (*intern)) != 0)
abort ();
#endif
}
@@ -851,10 +735,7 @@ ecoff_swap_opt_out (abfd, intern_copy, ext_ptr)
/* Swap in a dense number. */
static void
-ecoff_swap_dnr_in (abfd, ext_copy, intern)
- bfd *abfd;
- PTR ext_copy;
- DNR *intern;
+ecoff_swap_dnr_in (bfd *abfd, void * ext_copy, DNR *intern)
{
struct dnr_ext ext[1];
@@ -864,7 +745,7 @@ ecoff_swap_dnr_in (abfd, ext_copy, intern)
intern->index = H_GET_32 (abfd, ext->d_index);
#ifdef TEST
- if (memcmp ((char *)ext, (char *)intern, sizeof (*intern)) != 0)
+ if (memcmp ((char *) ext, (char *) intern, sizeof (*intern)) != 0)
abort ();
#endif
}
@@ -872,10 +753,7 @@ ecoff_swap_dnr_in (abfd, ext_copy, intern)
/* 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;
+ecoff_swap_dnr_out (bfd *abfd, const DNR *intern_copy, void * ext_ptr)
{
struct dnr_ext *ext = (struct dnr_ext *) ext_ptr;
DNR intern[1];
@@ -887,7 +765,7 @@ ecoff_swap_dnr_out (abfd, intern_copy, ext_ptr)
H_PUT_32 (abfd, intern->index, ext->d_index);
#ifdef TEST
- if (memcmp ((char *)ext, (char *)intern, sizeof (*intern)) != 0)
+ 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
index 92a17ef..06ed805 100644
--- a/contrib/binutils/bfd/efi-app-ia32.c
+++ b/contrib/binutils/bfd/efi-app-ia32.c
@@ -1,5 +1,5 @@
/* BFD back-end for Intel IA-32 EFI application files.
- Copyright 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
+ Copyright 1999, 2000, 2001, 2002, 2007 Free Software Foundation, Inc.
Contributed by David Mosberger <davidm@hpl.hp.com>
This file is part of BFD, the Binary File Descriptor library.
@@ -16,10 +16,10 @@ 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. */
+Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#define TARGET_SYM bfd_efi_app_ia32_vec
#define TARGET_NAME "efi-app-ia32"
diff --git a/contrib/binutils/bfd/efi-app-ia64.c b/contrib/binutils/bfd/efi-app-ia64.c
index c7e9bcf..b60ca73 100644
--- a/contrib/binutils/bfd/efi-app-ia64.c
+++ b/contrib/binutils/bfd/efi-app-ia64.c
@@ -1,5 +1,5 @@
/* BFD back-end for HP/Intel IA-64 EFI application files.
- Copyright 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
+ Copyright 1999, 2000, 2001, 2002, 2007 Free Software Foundation, Inc.
Contributed by David Mosberger <davidm@hpl.hp.com>
This file is part of BFD, the Binary File Descriptor library.
@@ -16,10 +16,10 @@ 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. */
+Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#define TARGET_SYM bfd_efi_app_ia64_vec
#define TARGET_NAME "efi-app-ia64"
diff --git a/contrib/binutils/bfd/elf-attrs.c b/contrib/binutils/bfd/elf-attrs.c
new file mode 100644
index 0000000..d1a64f4
--- /dev/null
+++ b/contrib/binutils/bfd/elf-attrs.c
@@ -0,0 +1,628 @@
+/* ELF attributes support (based on ARM EABI attributes).
+ Copyright 2005, 2006, 2007
+ 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., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include "sysdep.h"
+#include "bfd.h"
+#include "libiberty.h"
+#include "libbfd.h"
+#include "elf-bfd.h"
+
+/* Return the number of bytes needed by I in uleb128 format. */
+static int
+uleb128_size (unsigned int i)
+{
+ int size;
+ size = 1;
+ while (i >= 0x80)
+ {
+ i >>= 7;
+ size++;
+ }
+ return size;
+}
+
+/* Return TRUE if the attribute has the default value (0/""). */
+static bfd_boolean
+is_default_attr (obj_attribute *attr)
+{
+ if ((attr->type & 1) && attr->i != 0)
+ return FALSE;
+ if ((attr->type & 2) && attr->s && *attr->s)
+ return FALSE;
+
+ return TRUE;
+}
+
+/* Return the size of a single attribute. */
+static bfd_vma
+obj_attr_size (int tag, obj_attribute *attr)
+{
+ bfd_vma size;
+
+ if (is_default_attr (attr))
+ return 0;
+
+ size = uleb128_size (tag);
+ if (attr->type & 1)
+ size += uleb128_size (attr->i);
+ if (attr->type & 2)
+ size += strlen ((char *)attr->s) + 1;
+ return size;
+}
+
+/* Return the vendor name for a given object attributes section. */
+static const char *
+vendor_obj_attr_name (bfd *abfd, int vendor)
+{
+ return (vendor == OBJ_ATTR_PROC
+ ? get_elf_backend_data (abfd)->obj_attrs_vendor
+ : "gnu");
+}
+
+/* Return the size of the object attributes section for VENDOR
+ (OBJ_ATTR_PROC or OBJ_ATTR_GNU), or 0 if there are no attributes
+ for that vendor to record and the vendor is OBJ_ATTR_GNU. */
+static bfd_vma
+vendor_obj_attr_size (bfd *abfd, int vendor)
+{
+ bfd_vma size;
+ obj_attribute *attr;
+ obj_attribute_list *list;
+ int i;
+ const char *vendor_name = vendor_obj_attr_name (abfd, vendor);
+
+ if (!vendor_name)
+ return 0;
+
+ attr = elf_known_obj_attributes (abfd)[vendor];
+ size = 0;
+ for (i = 4; i < NUM_KNOWN_OBJ_ATTRIBUTES; i++)
+ size += obj_attr_size (i, &attr[i]);
+
+ for (list = elf_other_obj_attributes (abfd)[vendor];
+ list;
+ list = list->next)
+ size += obj_attr_size (list->tag, &list->attr);
+
+ /* <size> <vendor_name> NUL 0x1 <size> */
+ return ((size || vendor == OBJ_ATTR_PROC)
+ ? size + 10 + strlen (vendor_name)
+ : 0);
+}
+
+/* Return the size of the object attributes section. */
+bfd_vma
+bfd_elf_obj_attr_size (bfd *abfd)
+{
+ bfd_vma size;
+
+ size = vendor_obj_attr_size (abfd, OBJ_ATTR_PROC);
+ size += vendor_obj_attr_size (abfd, OBJ_ATTR_GNU);
+
+ /* 'A' <sections for each vendor> */
+ return (size ? size + 1 : 0);
+}
+
+/* Write VAL in uleb128 format to P, returning a pointer to the
+ following byte. */
+static bfd_byte *
+write_uleb128 (bfd_byte *p, unsigned int val)
+{
+ bfd_byte c;
+ do
+ {
+ c = val & 0x7f;
+ val >>= 7;
+ if (val)
+ c |= 0x80;
+ *(p++) = c;
+ }
+ while (val);
+ return p;
+}
+
+/* Write attribute ATTR to butter P, and return a pointer to the following
+ byte. */
+static bfd_byte *
+write_obj_attribute (bfd_byte *p, int tag, obj_attribute *attr)
+{
+ /* Suppress default entries. */
+ if (is_default_attr (attr))
+ return p;
+
+ p = write_uleb128 (p, tag);
+ if (attr->type & 1)
+ p = write_uleb128 (p, attr->i);
+ if (attr->type & 2)
+ {
+ int len;
+
+ len = strlen (attr->s) + 1;
+ memcpy (p, attr->s, len);
+ p += len;
+ }
+
+ return p;
+}
+
+/* Write the contents of the object attributes section (length SIZE)
+ for VENDOR to CONTENTS. */
+static void
+vendor_set_obj_attr_contents (bfd *abfd, bfd_byte *contents, bfd_vma size,
+ int vendor)
+{
+ bfd_byte *p;
+ obj_attribute *attr;
+ obj_attribute_list *list;
+ int i;
+ const char *vendor_name = vendor_obj_attr_name (abfd, vendor);
+ size_t vendor_length = strlen (vendor_name) + 1;
+
+ p = contents;
+ bfd_put_32 (abfd, size, p);
+ p += 4;
+ memcpy (p, vendor_name, vendor_length);
+ p += vendor_length;
+ *(p++) = Tag_File;
+ bfd_put_32 (abfd, size - 4 - vendor_length, p);
+ p += 4;
+
+ attr = elf_known_obj_attributes (abfd)[vendor];
+ for (i = 4; i < NUM_KNOWN_OBJ_ATTRIBUTES; i++)
+ p = write_obj_attribute (p, i, &attr[i]);
+
+ for (list = elf_other_obj_attributes (abfd)[vendor];
+ list;
+ list = list->next)
+ p = write_obj_attribute (p, list->tag, &list->attr);
+}
+
+/* Write the contents of the object attributes section to CONTENTS. */
+void
+bfd_elf_set_obj_attr_contents (bfd *abfd, bfd_byte *contents, bfd_vma size)
+{
+ bfd_byte *p;
+ int vendor;
+ bfd_vma my_size;
+
+ p = contents;
+ *(p++) = 'A';
+ my_size = 1;
+ for (vendor = OBJ_ATTR_FIRST; vendor <= OBJ_ATTR_LAST; vendor++)
+ {
+ bfd_vma vendor_size = vendor_obj_attr_size (abfd, vendor);
+ if (vendor_size)
+ vendor_set_obj_attr_contents (abfd, p, vendor_size, vendor);
+ p += vendor_size;
+ my_size += vendor_size;
+ }
+
+ if (size != my_size)
+ abort ();
+}
+
+/* Allocate/find an object attribute. */
+static obj_attribute *
+elf_new_obj_attr (bfd *abfd, int vendor, int tag)
+{
+ obj_attribute *attr;
+ obj_attribute_list *list;
+ obj_attribute_list *p;
+ obj_attribute_list **lastp;
+
+
+ if (tag < NUM_KNOWN_OBJ_ATTRIBUTES)
+ {
+ /* Knwon tags are preallocated. */
+ attr = &elf_known_obj_attributes (abfd)[vendor][tag];
+ }
+ else
+ {
+ /* Create a new tag. */
+ list = (obj_attribute_list *)
+ bfd_alloc (abfd, sizeof (obj_attribute_list));
+ memset (list, 0, sizeof (obj_attribute_list));
+ list->tag = tag;
+ /* Keep the tag list in order. */
+ lastp = &elf_other_obj_attributes (abfd)[vendor];
+ for (p = *lastp; p; p = p->next)
+ {
+ if (tag < p->tag)
+ break;
+ lastp = &p->next;
+ }
+ list->next = *lastp;
+ *lastp = list;
+ attr = &list->attr;
+ }
+
+ return attr;
+}
+
+/* Return the value of an integer object attribute. */
+int
+bfd_elf_get_obj_attr_int (bfd *abfd, int vendor, int tag)
+{
+ obj_attribute_list *p;
+
+ if (tag < NUM_KNOWN_OBJ_ATTRIBUTES)
+ {
+ /* Knwon tags are preallocated. */
+ return elf_known_obj_attributes (abfd)[vendor][tag].i;
+ }
+ else
+ {
+ for (p = elf_other_obj_attributes (abfd)[vendor];
+ p;
+ p = p->next)
+ {
+ if (tag == p->tag)
+ return p->attr.i;
+ if (tag < p->tag)
+ break;
+ }
+ return 0;
+ }
+}
+
+/* Add an integer object attribute. */
+void
+bfd_elf_add_obj_attr_int (bfd *abfd, int vendor, int tag, unsigned int i)
+{
+ obj_attribute *attr;
+
+ attr = elf_new_obj_attr (abfd, vendor, tag);
+ attr->type = 1;
+ attr->i = i;
+}
+
+/* Duplicate an object attribute string value. */
+char *
+_bfd_elf_attr_strdup (bfd *abfd, const char * s)
+{
+ char * p;
+ int len;
+
+ len = strlen (s) + 1;
+ p = (char *) bfd_alloc (abfd, len);
+ return memcpy (p, s, len);
+}
+
+/* Add a string object attribute. */
+void
+bfd_elf_add_obj_attr_string (bfd *abfd, int vendor, int tag, const char *s)
+{
+ obj_attribute *attr;
+
+ attr = elf_new_obj_attr (abfd, vendor, tag);
+ attr->type = 2;
+ attr->s = _bfd_elf_attr_strdup (abfd, s);
+}
+
+/* Add a Tag_compatibility object attribute. */
+void
+bfd_elf_add_obj_attr_compat (bfd *abfd, int vendor, unsigned int i,
+ const char *s)
+{
+ obj_attribute_list *list;
+ obj_attribute_list *p;
+ obj_attribute_list **lastp;
+
+ list = (obj_attribute_list *)
+ bfd_alloc (abfd, sizeof (obj_attribute_list));
+ memset (list, 0, sizeof (obj_attribute_list));
+ list->tag = Tag_compatibility;
+ list->attr.type = 3;
+ list->attr.i = i;
+ list->attr.s = _bfd_elf_attr_strdup (abfd, s);
+
+ lastp = &elf_other_obj_attributes (abfd)[vendor];
+ for (p = *lastp; p; p = p->next)
+ {
+ int cmp;
+ if (p->tag != Tag_compatibility)
+ break;
+ cmp = strcmp(s, p->attr.s);
+ if (cmp < 0 || (cmp == 0 && i < p->attr.i))
+ break;
+ lastp = &p->next;
+ }
+ list->next = *lastp;
+ *lastp = list;
+}
+
+/* Copy the object attributes from IBFD to OBFD. */
+void
+_bfd_elf_copy_obj_attributes (bfd *ibfd, bfd *obfd)
+{
+ obj_attribute *in_attr;
+ obj_attribute *out_attr;
+ obj_attribute_list *list;
+ int i;
+ int vendor;
+
+ for (vendor = OBJ_ATTR_FIRST; vendor <= OBJ_ATTR_LAST; vendor++)
+ {
+ in_attr = &elf_known_obj_attributes (ibfd)[vendor][4];
+ out_attr = &elf_known_obj_attributes (obfd)[vendor][4];
+ for (i = 4; i < NUM_KNOWN_OBJ_ATTRIBUTES; i++)
+ {
+ out_attr->type = in_attr->type;
+ out_attr->i = in_attr->i;
+ if (in_attr->s && *in_attr->s)
+ out_attr->s = _bfd_elf_attr_strdup (obfd, in_attr->s);
+ in_attr++;
+ out_attr++;
+ }
+
+ for (list = elf_other_obj_attributes (ibfd)[vendor];
+ list;
+ list = list->next)
+ {
+ in_attr = &list->attr;
+ switch (in_attr->type)
+ {
+ case 1:
+ bfd_elf_add_obj_attr_int (obfd, vendor, list->tag, in_attr->i);
+ break;
+ case 2:
+ bfd_elf_add_obj_attr_string (obfd, vendor, list->tag,
+ in_attr->s);
+ break;
+ case 3:
+ bfd_elf_add_obj_attr_compat (obfd, vendor, in_attr->i,
+ in_attr->s);
+ break;
+ default:
+ abort ();
+ }
+ }
+ }
+}
+
+/* Determine whether a GNU object attribute tag takes an integer, a
+ string or both. */
+static int
+gnu_obj_attrs_arg_type (int tag)
+{
+ /* Except for Tag_compatibility, for GNU attributes we follow the
+ same rule ARM ones > 32 follow: odd-numbered tags take strings
+ and even-numbered tags take integers. In addition, tag & 2 is
+ nonzero for architecture-independent tags and zero for
+ architecture-dependent ones. */
+ if (tag == Tag_compatibility)
+ return 3;
+ else
+ return (tag & 1) != 0 ? 2 : 1;
+}
+
+/* Determine what arguments an attribute tag takes. */
+int
+_bfd_elf_obj_attrs_arg_type (bfd *abfd, int vendor, int tag)
+{
+ switch (vendor)
+ {
+ case OBJ_ATTR_PROC:
+ return get_elf_backend_data (abfd)->obj_attrs_arg_type (tag);
+ break;
+ case OBJ_ATTR_GNU:
+ return gnu_obj_attrs_arg_type (tag);
+ break;
+ default:
+ abort ();
+ }
+}
+
+/* Parse an object attributes section. */
+void
+_bfd_elf_parse_attributes (bfd *abfd, Elf_Internal_Shdr * hdr)
+{
+ bfd_byte *contents;
+ bfd_byte *p;
+ bfd_vma len;
+ const char *std_section;
+
+ contents = bfd_malloc (hdr->sh_size);
+ if (!contents)
+ return;
+ if (!bfd_get_section_contents (abfd, hdr->bfd_section, contents, 0,
+ hdr->sh_size))
+ {
+ free (contents);
+ return;
+ }
+ p = contents;
+ std_section = get_elf_backend_data (abfd)->obj_attrs_vendor;
+ if (*(p++) == 'A')
+ {
+ len = hdr->sh_size - 1;
+ while (len > 0)
+ {
+ int namelen;
+ bfd_vma section_len;
+ int vendor;
+
+ section_len = bfd_get_32 (abfd, p);
+ p += 4;
+ if (section_len > len)
+ section_len = len;
+ len -= section_len;
+ namelen = strlen ((char *)p) + 1;
+ section_len -= namelen + 4;
+ if (std_section && strcmp ((char *)p, std_section) == 0)
+ vendor = OBJ_ATTR_PROC;
+ else if (strcmp ((char *)p, "gnu") == 0)
+ vendor = OBJ_ATTR_GNU;
+ else
+ {
+ /* Other vendor section. Ignore it. */
+ p += namelen + section_len;
+ continue;
+ }
+
+ p += namelen;
+ while (section_len > 0)
+ {
+ int tag;
+ unsigned int n;
+ unsigned int val;
+ bfd_vma subsection_len;
+ bfd_byte *end;
+
+ tag = read_unsigned_leb128 (abfd, p, &n);
+ p += n;
+ subsection_len = bfd_get_32 (abfd, p);
+ p += 4;
+ if (subsection_len > section_len)
+ subsection_len = section_len;
+ section_len -= subsection_len;
+ subsection_len -= n + 4;
+ end = p + subsection_len;
+ switch (tag)
+ {
+ case Tag_File:
+ while (p < end)
+ {
+ int type;
+
+ tag = read_unsigned_leb128 (abfd, p, &n);
+ p += n;
+ type = _bfd_elf_obj_attrs_arg_type (abfd, vendor, tag);
+ switch (type)
+ {
+ case 3:
+ val = read_unsigned_leb128 (abfd, p, &n);
+ p += n;
+ bfd_elf_add_obj_attr_compat (abfd, vendor, val,
+ (char *)p);
+ p += strlen ((char *)p) + 1;
+ break;
+ case 2:
+ bfd_elf_add_obj_attr_string (abfd, vendor, tag,
+ (char *)p);
+ p += strlen ((char *)p) + 1;
+ break;
+ case 1:
+ val = read_unsigned_leb128 (abfd, p, &n);
+ p += n;
+ bfd_elf_add_obj_attr_int (abfd, vendor, tag, val);
+ break;
+ default:
+ abort ();
+ }
+ }
+ break;
+ case Tag_Section:
+ case Tag_Symbol:
+ /* Don't have anywhere convenient to attach these.
+ Fall through for now. */
+ default:
+ /* Ignore things we don't kow about. */
+ p += subsection_len;
+ subsection_len = 0;
+ break;
+ }
+ }
+ }
+ }
+ free (contents);
+}
+
+/* Merge common object attributes from IBFD into OBFD. Raise an error
+ if there are conflicting attributes. Any processor-specific
+ attributes have already been merged. This must be called from the
+ bfd_elfNN_bfd_merge_private_bfd_data hook for each individual
+ target, along with any target-specific merging. Because there are
+ no common attributes other than Tag_compatibility at present, and
+ non-"gnu" Tag_compatibility is not expected in "gnu" sections, this
+ is not presently called for targets without their own
+ attributes. */
+
+bfd_boolean
+_bfd_elf_merge_object_attributes (bfd *ibfd, bfd *obfd)
+{
+ obj_attribute *in_attr;
+ obj_attribute *out_attr;
+ obj_attribute_list *in_list;
+ obj_attribute_list *out_list;
+ int vendor;
+
+ /* The only common attribute is currently Tag_compatibility,
+ accepted in both processor and "gnu" sections. */
+ for (vendor = OBJ_ATTR_FIRST; vendor <= OBJ_ATTR_LAST; vendor++)
+ {
+ in_list = elf_other_obj_attributes (ibfd)[vendor];
+ out_list = elf_other_obj_attributes (ibfd)[vendor];
+ while (in_list && in_list->tag == Tag_compatibility)
+ {
+ in_attr = &in_list->attr;
+ if (in_attr->i == 0)
+ continue;
+ if (in_attr->i == 1 && strcmp (in_attr->s, "gnu") != 0)
+ {
+ _bfd_error_handler
+ (_("ERROR: %B: Must be processed by '%s' toolchain"),
+ ibfd, in_attr->s);
+ return FALSE;
+ }
+ if (!out_list || out_list->tag != Tag_compatibility
+ || strcmp (in_attr->s, out_list->attr.s) != 0)
+ {
+ /* Add this compatibility tag to the output. */
+ bfd_elf_add_proc_attr_compat (obfd, in_attr->i, in_attr->s);
+ continue;
+ }
+ out_attr = &out_list->attr;
+ /* Check all the input tags with the same identifier. */
+ for (;;)
+ {
+ if (out_list->tag != Tag_compatibility
+ || in_attr->i != out_attr->i
+ || strcmp (in_attr->s, out_attr->s) != 0)
+ {
+ _bfd_error_handler
+ (_("ERROR: %B: Incompatible object tag '%s':%d"),
+ ibfd, in_attr->s, in_attr->i);
+ return FALSE;
+ }
+ in_list = in_list->next;
+ if (in_list->tag != Tag_compatibility
+ || strcmp (in_attr->s, in_list->attr.s) != 0)
+ break;
+ in_attr = &in_list->attr;
+ out_list = out_list->next;
+ if (out_list)
+ out_attr = &out_list->attr;
+ }
+
+ /* Check the output doesn't have extra tags with this identifier. */
+ if (out_list && out_list->tag == Tag_compatibility
+ && strcmp (in_attr->s, out_list->attr.s) == 0)
+ {
+ _bfd_error_handler
+ (_("ERROR: %B: Incompatible object tag '%s':%d"),
+ ibfd, in_attr->s, out_list->attr.i);
+ return FALSE;
+ }
+ }
+ }
+
+ return TRUE;
+}
diff --git a/contrib/binutils/bfd/elf-bfd.h b/contrib/binutils/bfd/elf-bfd.h
index 0a01867..c80bc76 100644
--- a/contrib/binutils/bfd/elf-bfd.h
+++ b/contrib/binutils/bfd/elf-bfd.h
@@ -1,6 +1,6 @@
/* 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.
+ 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
Written by Cygnus Support.
This file is part of BFD, the Binary File Descriptor library.
@@ -17,7 +17,7 @@
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. */
+ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
#ifndef _LIBELF_H_
#define _LIBELF_H_ 1
@@ -104,40 +104,6 @@ struct elf_link_hash_entry
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
@@ -162,47 +128,91 @@ struct elf_link_hash_entry
bfd_size_type size;
/* Symbol type (STT_NOTYPE, STT_OBJECT, etc.). */
- char type;
+ unsigned int type : 8;
/* Symbol st_other value, symbol visibility. */
- unsigned char other;
+ unsigned int other : 8;
- /* 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
+ unsigned int ref_regular : 1;
/* Symbol is defined by a non-shared object. */
-#define ELF_LINK_HASH_DEF_REGULAR 02
+ unsigned int def_regular : 1;
/* Symbol is referenced by a shared object. */
-#define ELF_LINK_HASH_REF_DYNAMIC 04
+ unsigned int ref_dynamic : 1;
/* Symbol is defined by a shared object. */
-#define ELF_LINK_HASH_DEF_DYNAMIC 010
+ unsigned int def_dynamic : 1;
/* Symbol has a non-weak reference from a non-shared object. */
-#define ELF_LINK_HASH_REF_REGULAR_NONWEAK 020
+ unsigned int ref_regular_nonweak : 1;
/* Dynamic symbol has been adjustd. */
-#define ELF_LINK_HASH_DYNAMIC_ADJUSTED 040
+ unsigned int dynamic_adjusted : 1;
/* Symbol needs a copy reloc. */
-#define ELF_LINK_HASH_NEEDS_COPY 0100
+ unsigned int needs_copy : 1;
/* Symbol needs a procedure linkage table entry. */
-#define ELF_LINK_HASH_NEEDS_PLT 0200
+ unsigned int needs_plt : 1;
/* Symbol appears in a non-ELF input file. */
-#define ELF_LINK_NON_ELF 0400
+ unsigned int non_elf : 1;
/* Symbol should be marked as hidden in the version information. */
-#define ELF_LINK_HIDDEN 01000
+ unsigned int hidden : 1;
/* Symbol was forced to local scope due to a version script file. */
-#define ELF_LINK_FORCED_LOCAL 02000
+ unsigned int forced_local : 1;
+ /* Symbol was forced to be dynamic due to a version script file. */
+ unsigned int dynamic : 1;
/* Symbol was marked during garbage collection. */
-#define ELF_LINK_HASH_MARK 04000
+ unsigned int mark : 1;
/* 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
+ unsigned int non_got_ref : 1;
+ /* Symbol has a definition in a shared object.
+ FIXME: There is no real need for this field if def_dynamic is never
+ cleared and all places that test def_dynamic also test def_regular. */
+ unsigned int dynamic_def : 1;
/* Symbol is weak in all shared objects. */
-#define ELF_LINK_DYNAMIC_WEAK 040000
+ unsigned int dynamic_weak : 1;
/* Symbol is referenced with a relocation where C/C++ pointer equality
matters. */
-#define ELF_LINK_POINTER_EQUALITY_NEEDED 0100000
+ unsigned int pointer_equality_needed : 1;
+
+ /* String table index in .dynstr if this is a dynamic symbol. */
+ unsigned long dynstr_index;
+
+ union
+ {
+ /* 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;
+
+ /* Hash value of the name computed using the ELF hash function.
+ Used part way through size_dynamic_sections, after we've finished
+ with weakdefs. */
+ unsigned long elf_hash_value;
+ } u;
+
+ /* 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;
+
+ struct
+ {
+ /* 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 size;
+ bfd_boolean *used;
+
+ /* Virtual table derivation info. */
+ struct elf_link_hash_entry *parent;
+ } *vtable;
};
/* Will references to this symbol always reference the symbol
@@ -218,6 +228,13 @@ struct elf_link_hash_entry
#define SYMBOL_CALLS_LOCAL(INFO, H) \
_bfd_elf_symbol_refs_local_p (H, INFO, 1)
+/* Common symbols that are turned into definitions don't have the
+ DEF_REGULAR flag set, so they might appear to be undefined. */
+#define ELF_COMMON_DEF_P(H) \
+ (!(H)->def_regular \
+ && !(H)->def_dynamic \
+ && (H)->root.type == bfd_link_hash_defined)
+
/* Records local symbols to be emitted in the dynamic symbol table. */
struct elf_link_local_dynamic_entry
@@ -244,51 +261,30 @@ struct elf_link_loaded_list
};
/* 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;
+ /* For FDEs, this points to the CIE used. */
+ struct eh_cie_fde *cie_inf;
unsigned int size;
- asection *sec;
+ unsigned int offset;
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;
+ unsigned int cie : 1;
+ unsigned int removed : 1;
+ unsigned int add_augmentation_size : 1;
+ unsigned int add_fde_encoding : 1;
+ unsigned int make_relative : 1;
+ unsigned int make_lsda_relative : 1;
+ unsigned int need_lsda_relative : 1;
+ unsigned int per_encoding_relative : 1;
+ unsigned int *set_loc;
};
struct eh_frame_sec_info
{
unsigned int count;
- unsigned int alloced;
struct eh_cie_fde entry[1];
};
@@ -298,18 +294,19 @@ struct eh_frame_array_ent
bfd_vma fde;
};
+struct htab;
+
struct eh_frame_hdr_info
{
- struct cie last_cie;
- asection *last_cie_sec;
+ struct htab *cies;
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;
+ bfd_boolean offsets_adjusted;
};
/* ELF linker hash table. */
@@ -322,6 +319,10 @@ struct elf_link_hash_table
when linking against or generating a shared object. */
bfd_boolean dynamic_sections_created;
+ /* True if this target has relocatable executables, so needs dynamic
+ section symbols. */
+ bfd_boolean is_relocatable_executable;
+
/* 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. */
@@ -329,13 +330,15 @@ struct elf_link_hash_table
/* 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 values are refcounts. Set to init_got_offset/init_plt_offset
+ in size_dynamic_sections when the values may be offsets. */
+ union gotplt_union init_got_refcount;
+ union gotplt_union init_plt_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;
+ union gotplt_union init_got_offset;
+ union gotplt_union init_plt_offset;
/* The number of symbols found in the link which must be put into
the .dynsym section. */
@@ -353,15 +356,24 @@ struct elf_link_hash_table
included in the link. */
struct bfd_link_needed_list *needed;
+ /* Sections in the output bfd that provides a section symbol
+ to be used by relocations emitted against local symbols.
+ Most targets will not use data_index_section. */
+ asection *text_index_section;
+ asection *data_index_section;
+
/* The _GLOBAL_OFFSET_TABLE_ symbol. */
struct elf_link_hash_entry *hgot;
- /* A pointer to information used to link stabs in sections. */
- void *stab_info;
+ /* The _PROCEDURE_LINKAGE_TABLE_ symbol. */
+ struct elf_link_hash_entry *hplt;
/* A pointer to information used to merge SEC_MERGE sections. */
void *merge_info;
+ /* Used to link stabs in sections. */
+ struct stab_info stab_info;
+
/* Used by eh_frame code when editing .eh_frame. */
struct eh_frame_hdr_info eh_info;
@@ -437,7 +449,7 @@ struct elf_size_info {
(*write_shdrs_and_ehdr) (bfd *);
void (*write_relocs)
(bfd *, asection *, void *);
- void (*swap_symbol_in)
+ bfd_boolean (*swap_symbol_in)
(bfd *, const void *, const void *, Elf_Internal_Sym *);
void (*swap_symbol_out)
(bfd *, const Elf_Internal_Sym *, void *, void *);
@@ -520,6 +532,16 @@ struct bfd_elf_special_section
int attr;
};
+enum action_discarded
+ {
+ COMPLAIN = 1,
+ PRETEND = 2
+ };
+
+typedef asection * (*elf_gc_mark_hook_fn)
+ (asection *, struct bfd_link_info *, Elf_Internal_Rela *,
+ struct elf_link_hash_entry *, Elf_Internal_Sym *);
+
struct elf_backend_data
{
/* The architecture for this backend. */
@@ -528,9 +550,23 @@ struct elf_backend_data
/* The ELF machine code (EM_xxxx) for this backend. */
int elf_machine_code;
+ /* EI_OSABI. */
+ int elf_osabi;
+
/* The maximum page size for this backend. */
bfd_vma maxpagesize;
+ /* The minimum page size for this backend. An input object will not be
+ considered page aligned unless its sections are correctly aligned for
+ pages at least this large. May be smaller than maxpagesize. */
+ bfd_vma minpagesize;
+
+ /* The common page size for this backend. */
+ bfd_vma commonpagesize;
+
+ /* The BFD flags applied to sections created for dynamic linking. */
+ flagword dynamic_sec_flags;
+
/* A function to translate an ELF RELA relocation to a BFD arelent
structure. */
void (*elf_info_to_howto)
@@ -572,11 +608,16 @@ struct elf_backend_data
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
+ /* 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);
+ /* A function to return the linker hash table entry of a symbol that
+ might be satisfied by an archive symbol. */
+ struct elf_link_hash_entry * (*elf_backend_archive_symbol_lookup)
+ (bfd *, struct bfd_link_info *, const char *);
+
/* Return true if local section symbols should have a non-null st_name.
NULL implies false. */
bfd_boolean (*elf_backend_name_local_section_symbols)
@@ -592,17 +633,22 @@ struct elf_backend_data
/* 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 *);
+ (bfd *, Elf_Internal_Shdr *, const char *, int);
- /* A function to convert machine dependent section header flags to
+ /* A function to convert machine dependent ELF section header flags to
BFD internal section header flags. */
bfd_boolean (*elf_backend_section_flags)
- (flagword *, Elf_Internal_Shdr *);
+ (flagword *, const Elf_Internal_Shdr *);
+
+ /* A function that returns a struct containing ELF section flags and
+ type for the given BFD section. */
+ const struct bfd_elf_special_section * (*get_sec_type_attr)
+ (bfd *, asection *);
/* 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);
+ (bfd *, Elf_Internal_Phdr *, int, const char *);
/* 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
@@ -646,6 +692,15 @@ struct elf_backend_data
bfd_boolean (*elf_backend_create_dynamic_sections)
(bfd *abfd, struct bfd_link_info *info);
+ /* When creating a shared library, determine whether to omit the
+ dynamic symbol for the section. */
+ bfd_boolean (*elf_backend_omit_section_dynsym)
+ (bfd *output_bfd, struct bfd_link_info *info, asection *osec);
+
+ /* Return TRUE if relocations of targets are compatible to the extent
+ that CHECK_RELOCS will properly process them. PR 4424. */
+ bfd_boolean (*relocs_compatible) (const bfd_target *, const bfd_target *);
+
/* 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
@@ -660,6 +715,20 @@ struct elf_backend_data
(bfd *abfd, struct bfd_link_info *info, asection *o,
const Elf_Internal_Rela *relocs);
+ /* The CHECK_DIRECTIVES function is called once per input file by
+ the add_symbols phase of the ELF backend linker. The function
+ must inspect the bfd and create any additional symbols according
+ to any custom directives in the bfd. */
+ bfd_boolean (*check_directives)
+ (bfd *abfd, struct bfd_link_info *info);
+
+ /* The AS_NEEDED_CLEANUP function is called once per --as-needed
+ input file that was not needed by the add_symbols phase of the
+ ELF backend linker. The function must undo any target specific
+ changes in the symbol hash table. */
+ bfd_boolean (*as_needed_cleanup)
+ (bfd *abfd, struct bfd_link_info *info);
+
/* 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
@@ -695,6 +764,11 @@ struct elf_backend_data
bfd_boolean (*elf_backend_size_dynamic_sections)
(bfd *output_bfd, struct bfd_link_info *info);
+ /* Set TEXT_INDEX_SECTION and DATA_INDEX_SECTION, the output sections
+ we keep to use as a base for relocs and symbols. */
+ void (*elf_backend_init_index_section)
+ (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.
@@ -722,8 +796,11 @@ struct elf_backend_data
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)
+ accordingly.
+
+ Returns FALSE on error, TRUE on success, 2 if successful and
+ relocations should be written for this section. */
+ int (*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);
@@ -761,18 +838,31 @@ struct elf_backend_data
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 *);
+ (bfd *, struct bfd_link_info *);
/* 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 to modify program headers just before
+ they are written. */
+ bfd_boolean (*elf_backend_modify_program_headers)
+ (bfd *, struct bfd_link_info *);
+
+ /* This function is called during section garbage collection to
+ mark sections that define global symbols. */
+ bfd_boolean (*gc_mark_dynamic_ref)
+ (struct elf_link_hash_entry *h, void *inf);
+
/* 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 *);
+ elf_gc_mark_hook_fn gc_mark_hook;
+
+ /* This function, if defined, is called after the first gc marking pass
+ to allow the backend to mark additional sections. */
+ bfd_boolean (*gc_mark_extra_sections)
+ (struct bfd_link_info *info, elf_gc_mark_hook_fn gc_mark_hook);
/* This function, if defined, is called during the sweep phase of gc
in order that a backend might update any data structures it might
@@ -795,8 +885,16 @@ struct elf_backend_data
/* 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
+ section. It allows the backend to emit special local symbols
not handled in the hash table. */
+ bfd_boolean (*elf_backend_output_arch_local_syms)
+ (bfd *, struct bfd_link_info *, void *,
+ bfd_boolean (*) (void *, const char *, Elf_Internal_Sym *, asection *,
+ struct elf_link_hash_entry *));
+
+ /* This function, if defined, is called after all symbols 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 *,
@@ -808,7 +906,7 @@ struct elf_backend_data
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 bfd_link_info *, struct elf_link_hash_entry *,
struct elf_link_hash_entry *);
/* Modify any information related to dynamic linking such that the
@@ -816,15 +914,26 @@ struct elf_backend_data
void (*elf_backend_hide_symbol)
(struct bfd_link_info *, struct elf_link_hash_entry *, bfd_boolean);
+ /* A function to do additional symbol fixup, called by
+ _bfd_elf_fix_symbol_flags. */
+ bfd_boolean (*elf_backend_fixup_symbol)
+ (struct bfd_link_info *, struct elf_link_hash_entry *);
+
/* 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);
+ /* Decide whether an undefined symbol is special and can be ignored.
+ This is the case for OPTIONAL symbols on IRIX. */
+ bfd_boolean (*elf_backend_ignore_undef_symbol)
+ (struct elf_link_hash_entry *);
+
/* 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 *);
+ (bfd *, asection *, Elf_Internal_Shdr *, Elf_Internal_Rela *,
+ struct elf_link_hash_entry **);
/* Count relocations. Not called for relocatable links
or if all relocs are being preserved in the output. */
@@ -832,15 +941,19 @@ struct elf_backend_data
(asection *, Elf_Internal_Rela *);
/* This function, if defined, is called when an NT_PRSTATUS note is found
- in a core file. */
+ 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. */
+ note is found in a core file. */
bfd_boolean (*elf_backend_grok_psinfo)
(bfd *, Elf_Internal_Note *);
+ /* This function, if defined, is called to write a note to a corefile. */
+ char *(*elf_backend_write_core_note)
+ (bfd *abfd, char *buf, int *bufsiz, int note_type, ...);
+
/* Functions to print VMAs. Special code to handle 64 bit ELF files. */
void (* elf_backend_sprintf_vma)
(bfd *, char *, bfd_vma);
@@ -861,6 +974,17 @@ struct elf_backend_data
bfd_boolean (*elf_backend_ignore_discarded_relocs)
(asection *);
+ /* What to do when ld finds relocations against symbols defined in
+ discarded sections. */
+ unsigned int (*action_discarded)
+ (asection *);
+
+ /* This function returns the width of FDE pointers in bytes, or 0 if
+ that can't be determined for some reason. The default definition
+ goes by the bfd's EI_CLASS. */
+ unsigned int (*elf_backend_eh_frame_address_size)
+ (bfd *, 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. */
@@ -882,7 +1006,7 @@ struct elf_backend_data
/* 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 *);
+ (bfd *, struct bfd_link_info *, asection *, bfd_byte *);
/* The level of IRIX compatibility we're striving for.
MIPS ELF specific function. */
@@ -900,7 +1024,47 @@ struct elf_backend_data
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));
+ int (*target_read_memory) (bfd_vma vma, bfd_byte *myaddr, int len));
+
+ /* This function is used by `_bfd_elf_get_synthetic_symtab';
+ see elf.c. */
+ bfd_vma (*plt_sym_val) (bfd_vma, const asection *, const arelent *);
+
+ /* Is symbol defined in common section? */
+ bfd_boolean (*common_definition) (Elf_Internal_Sym *);
+
+ /* Return a common section index for section. */
+ unsigned int (*common_section_index) (asection *);
+
+ /* Return a common section for section. */
+ asection *(*common_section) (asection *);
+
+ /* Return TRUE if we can merge 2 definitions. */
+ bfd_boolean (*merge_symbol) (struct bfd_link_info *,
+ struct elf_link_hash_entry **,
+ struct elf_link_hash_entry *,
+ Elf_Internal_Sym *, asection **,
+ bfd_vma *, unsigned int *,
+ bfd_boolean *, bfd_boolean *,
+ bfd_boolean *, bfd_boolean *,
+ bfd_boolean *, bfd_boolean *,
+ bfd_boolean *, bfd_boolean *,
+ bfd *, asection **,
+ bfd_boolean *, bfd_boolean *,
+ bfd_boolean *, bfd_boolean *,
+ bfd *, asection **);
+
+ /* Return TRUE if symbol should be hashed in the `.gnu.hash' section. */
+ bfd_boolean (*elf_hash_symbol) (struct elf_link_hash_entry *);
+
+ /* Return TRUE if type is a function symbol type. */
+ bfd_boolean (*is_function_type) (unsigned int type);
+
+ /* Used to handle bad SHF_LINK_ORDER input. */
+ bfd_error_handler_type link_order_error_handler;
+
+ /* Name of the PLT relocation section. */
+ const char *relplt_name;
/* Alternate EM_xxxx machine codes for this backend. */
int elf_machine_alt1;
@@ -908,17 +1072,26 @@ struct elf_backend_data
const struct elf_size_info *s;
- /* An array of target specific special section map. */
+ /* An array of target specific special sections. */
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;
+ /* The vendor name to use for a processor-standard attributes section. */
+ const char *obj_attrs_vendor;
+
+ /* The section name to use for a processor-standard attributes section. */
+ const char *obj_attrs_section;
+
+ /* Return 1, 2 or 3 to indicate what type of arguments a
+ processor-specific tag takes. */
+ int (*obj_attrs_arg_type) (int);
+
+ /* The section type to use for an attributes section. */
+ unsigned int obj_attrs_section_type;
+
/* 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
@@ -966,10 +1139,17 @@ struct elf_backend_data
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. */
+
+ /* 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;
+
+ /* True if an object file lacking a .note.GNU-stack section
+ should be assumed to be requesting exec stack. At least one
+ other file in the link needs to have a .note.GNU-stack section
+ for a PT_GNU_STACK segment to be created. */
+ unsigned default_execstack : 1;
};
/* Information stored for each BFD section in an ELF file. This
@@ -994,8 +1174,7 @@ struct bfd_elf_section_data
/* 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. */
+ /* The ELF section number of this section. */
int this_idx;
/* The ELF section number of the reloc section indicated by
@@ -1012,6 +1191,9 @@ struct bfd_elf_section_data
no dynamic symbol for this section. */
int dynindx;
+ /* A pointer to the linked-to section for SHF_LINK_ORDER. */
+ asection *linked_to;
+
/* 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;
@@ -1036,30 +1218,32 @@ struct bfd_elf_section_data
struct bfd_symbol *id;
} group;
- /* A linked list of sections in the group. Circular when used by
- the linker. */
+ /* For a member of a group, points to the SHT_GROUP section.
+ NULL for the SHT_GROUP section itself and non-group sections. */
+ asection *sec_group;
+
+ /* A linked list of member sections in the group. Circular when used by
+ the linker. For the SHT_GROUP section, points at first member. */
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_data(sec) ((struct bfd_elf_section_data*)(sec)->used_by_bfd)
+#define elf_linked_to_section(sec) (elf_section_data(sec)->linked_to)
#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)
+#define elf_sec_group(sec) (elf_section_data(sec)->sec_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 xvec_get_elf_backend_data(xvec) \
+ ((struct elf_backend_data *) (xvec)->backend_data)
#define get_elf_backend_data(abfd) \
- ((const struct elf_backend_data *) (abfd)->xvec->backend_data)
+ xvec_get_elf_backend_data ((abfd)->xvec)
/* This struct is used to pass information to routines called via
elf_link_hash_traverse which must return failure. */
@@ -1101,6 +1285,46 @@ struct elf_find_verdep_info
bfd_boolean failed;
};
+/* The maximum number of known object attributes for any target. */
+#define NUM_KNOWN_OBJ_ATTRIBUTES 32
+
+/* The value of an object attribute. type & 1 indicates whether there
+ is an integer value; type & 2 indicates whether there is a string
+ value. */
+
+typedef struct obj_attribute
+{
+ int type;
+ unsigned int i;
+ char *s;
+} obj_attribute;
+
+typedef struct obj_attribute_list
+{
+ struct obj_attribute_list *next;
+ int tag;
+ obj_attribute attr;
+} obj_attribute_list;
+
+/* Object attributes may either be defined by the processor ABI, index
+ OBJ_ATTR_PROC in the *_obj_attributes arrays, or be GNU-specific
+ (and possibly also processor-specific), index OBJ_ATTR_GNU. */
+#define OBJ_ATTR_PROC 0
+#define OBJ_ATTR_GNU 1
+#define OBJ_ATTR_FIRST OBJ_ATTR_PROC
+#define OBJ_ATTR_LAST OBJ_ATTR_GNU
+
+/* The following object attribute tags are taken as generic, for all
+ targets and for "gnu" where there is no target standard. */
+enum
+{
+ Tag_NULL = 0,
+ Tag_File = 1,
+ Tag_Section = 2,
+ Tag_Symbol = 3,
+ Tag_compatibility = 32
+};
+
/* Some private data is stashed away for future use using the tdata pointer
in the bfd structure. */
@@ -1187,6 +1411,7 @@ struct elf_obj_tdata
MIPS ELF linker. FIXME: We should figure out some way to only
include this field for a MIPS ELF target. */
asection **local_stubs;
+ asection **local_call_stubs;
/* Used to determine if PT_GNU_EH_FRAME segment header should be
created. */
@@ -1202,7 +1427,10 @@ struct elf_obj_tdata
unsigned int cverrefs;
/* Segment flags for the PT_GNU_STACK segment. */
- unsigned int stack_flags;
+ unsigned int stack_flags;
+
+ /* Should the PT_GNU_RELRO segment be emitted? */
+ bfd_boolean relro;
/* Symbol version definitions in external objects. */
Elf_Internal_Verdef *verdef;
@@ -1235,6 +1463,12 @@ struct elf_obj_tdata
/* Used to determine if the e_flags field has been initialized */
bfd_boolean flags_init;
+
+ /* Symbol buffer. */
+ void *symbuf;
+
+ obj_attribute known_obj_attributes[2][NUM_KNOWN_OBJ_ATTRIBUTES];
+ obj_attribute_list *other_obj_attributes[2];
};
#define elf_tdata(bfd) ((bfd) -> tdata.elf_obj_data)
@@ -1264,6 +1498,12 @@ struct elf_obj_tdata
#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)
+#define elf_known_obj_attributes(bfd) (elf_tdata (bfd) -> known_obj_attributes)
+#define elf_other_obj_attributes(bfd) (elf_tdata (bfd) -> other_obj_attributes)
+#define elf_known_obj_attributes_proc(bfd) \
+ (elf_known_obj_attributes (bfd) [OBJ_ATTR_PROC])
+#define elf_other_obj_attributes_proc(bfd) \
+ (elf_other_obj_attributes (bfd) [OBJ_ATTR_PROC])
extern void _bfd_elf_swap_verdef_in
(bfd *, const Elf_External_Verdef *, Elf_Internal_Verdef *);
@@ -1295,8 +1535,8 @@ extern char *bfd_elf_get_str_section
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 const char *bfd_elf_sym_name
+ (bfd *, Elf_Internal_Shdr *, Elf_Internal_Sym *, asection *);
extern bfd_boolean _bfd_elf_copy_private_bfd_data
(bfd *, bfd *);
@@ -1305,15 +1545,13 @@ extern bfd_boolean _bfd_elf_print_private_bfd_data
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 unsigned int _bfd_elf_eh_frame_address_size
+ (bfd *, asection *);
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);
@@ -1331,6 +1569,8 @@ extern bfd_vma _bfd_elf_section_offset
extern unsigned long bfd_elf_hash
(const char *);
+extern unsigned long bfd_elf_gnu_hash
+ (const char *);
extern bfd_reloc_status_type bfd_elf_generic_reloc
(bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **);
@@ -1341,7 +1581,7 @@ extern bfd_boolean bfd_elf_mkcorefile
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 *);
+ (bfd *, Elf_Internal_Shdr *, const char *, int);
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
@@ -1349,26 +1589,41 @@ extern struct bfd_hash_entry *_bfd_elf_link_hash_newfunc
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 bfd_link_info *, 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_fixup_symbol
+ (struct bfd_link_info *, struct elf_link_hash_entry *);
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 *));
+ (struct bfd_hash_entry *, struct bfd_hash_table *, const char *),
+ unsigned int);
extern bfd_boolean _bfd_elf_slurp_version_tables
- (bfd *);
+ (bfd *, bfd_boolean);
extern bfd_boolean _bfd_elf_merge_sections
(bfd *, struct bfd_link_info *);
-extern bfd_boolean bfd_elf_discard_group
- (bfd *, struct bfd_section *);
+extern bfd_boolean _bfd_elf_match_sections_by_type
+ (bfd *, const asection *, bfd *, const asection *);
+extern bfd_boolean bfd_elf_is_group_section
+ (bfd *, const struct bfd_section *);
+extern void _bfd_elf_section_already_linked
+ (bfd *, struct bfd_section *, struct bfd_link_info *);
extern void bfd_elf_set_group_contents
(bfd *, asection *, void *);
+extern asection *_bfd_elf_check_kept_section
+ (asection *, struct bfd_link_info *);
extern void _bfd_elf_link_just_syms
(asection *, struct bfd_link_info *);
+extern bfd_boolean _bfd_elf_copy_private_header_data
+ (bfd *, bfd *);
extern bfd_boolean _bfd_elf_copy_private_symbol_data
(bfd *, asymbol *, bfd *, asymbol *);
+#define _bfd_generic_init_private_section_data \
+ _bfd_elf_init_private_section_data
+extern bfd_boolean _bfd_elf_init_private_section_data
+ (bfd *, asection *, bfd *, asection *, struct bfd_link_info *);
extern bfd_boolean _bfd_elf_copy_private_section_data
(bfd *, asection *, bfd *, asection *);
extern bfd_boolean _bfd_elf_write_object_contents
@@ -1385,6 +1640,8 @@ extern long _bfd_elf_get_dynamic_symtab_upper_bound
(bfd *);
extern long _bfd_elf_canonicalize_dynamic_symtab
(bfd *, asymbol **);
+extern long _bfd_elf_get_synthetic_symtab
+ (bfd *, long, asymbol **, long, asymbol **, asymbol **);
extern long _bfd_elf_get_reloc_upper_bound
(bfd *, sec_ptr);
extern long _bfd_elf_canonicalize_reloc
@@ -1406,16 +1663,23 @@ extern bfd_boolean _bfd_elf_set_arch_mach
extern bfd_boolean _bfd_elf_find_nearest_line
(bfd *, asection *, asymbol **, bfd_vma, const char **, const char **,
unsigned int *);
+extern bfd_boolean _bfd_elf_find_line
+ (bfd *, asymbol **, asymbol *, const char **, unsigned int *);
+#define _bfd_generic_find_line _bfd_elf_find_line
+extern bfd_boolean _bfd_elf_find_inliner_info
+ (bfd *, 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);
+ (bfd *, struct bfd_link_info *);
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_special_section
+ (const char *, const struct bfd_elf_special_section *, unsigned int);
extern const struct bfd_elf_special_section *_bfd_elf_get_sec_type_attr
- (bfd *, const char *);
+ (bfd *, asection *);
/* If the target doesn't have reloc handling written yet: */
extern void _bfd_elf_no_info_to_howto
@@ -1463,7 +1727,7 @@ extern bfd_boolean _bfd_elf_discard_section_eh_frame
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);
+ (bfd *, struct bfd_link_info *, 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
@@ -1473,9 +1737,12 @@ extern bfd_boolean _bfd_elf_maybe_strip_eh_frame_hdr
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 *,
+ asection **, bfd_vma *, unsigned int *,
+ struct elf_link_hash_entry **, bfd_boolean *,
bfd_boolean *, bfd_boolean *, bfd_boolean *);
+extern bfd_boolean _bfd_elf_hash_symbol (struct elf_link_hash_entry *);
+
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 *,
@@ -1504,11 +1771,17 @@ extern bfd_boolean _bfd_elf_validate_reloc
extern bfd_boolean _bfd_elf_link_create_dynamic_sections
(bfd *, struct bfd_link_info *);
+extern bfd_boolean _bfd_elf_link_omit_section_dynsym
+ (bfd *, struct bfd_link_info *, asection *);
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
+extern struct elf_link_hash_entry *_bfd_elf_define_linkage_sym
+ (bfd *, struct bfd_link_info *, asection *, const char *);
+extern void _bfd_elf_init_1_index_section
+ (bfd *, struct bfd_link_info *);
+extern void _bfd_elf_init_2_index_sections
(bfd *, struct bfd_link_info *);
extern bfd_boolean _bfd_elfcore_make_pseudosection
@@ -1523,7 +1796,8 @@ 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 *);
+ (bfd *, asection *, Elf_Internal_Shdr *, Elf_Internal_Rela *,
+ struct elf_link_hash_entry **);
extern bfd_boolean _bfd_elf_fix_symbol_flags
(struct elf_link_hash_entry *, struct elf_info_failed *);
@@ -1531,6 +1805,9 @@ extern bfd_boolean _bfd_elf_fix_symbol_flags
extern bfd_boolean _bfd_elf_adjust_dynamic_symbol
(struct elf_link_hash_entry *, void *);
+extern bfd_boolean _bfd_elf_adjust_dynamic_copy
+ (struct elf_link_hash_entry *, asection *);
+
extern bfd_boolean _bfd_elf_link_sec_merge_syms
(struct elf_link_hash_entry *, void *);
@@ -1540,6 +1817,24 @@ extern bfd_boolean _bfd_elf_dynamic_symbol_p
extern bfd_boolean _bfd_elf_symbol_refs_local_p
(struct elf_link_hash_entry *, struct bfd_link_info *, bfd_boolean);
+extern bfd_boolean bfd_elf_match_symbols_in_sections
+ (asection *, asection *, struct bfd_link_info *);
+
+extern void bfd_elf_perform_complex_relocation
+ (bfd * output_bfd ATTRIBUTE_UNUSED,
+ struct bfd_link_info * info,
+ bfd * input_bfd,
+ asection * input_section,
+ bfd_byte * contents,
+ Elf_Internal_Rela * rel,
+ Elf_Internal_Sym * local_syms,
+ asection ** local_sections);
+
+extern bfd_boolean _bfd_elf_setup_sections
+ (bfd *);
+
+extern void _bfd_elf_set_osabi (bfd * , struct bfd_link_info *);
+
extern const bfd_target *bfd_elf32_object_p
(bfd *);
extern const bfd_target *bfd_elf32_core_file_p
@@ -1551,7 +1846,7 @@ extern int bfd_elf32_core_file_failing_signal
extern bfd_boolean bfd_elf32_core_file_matches_executable_p
(bfd *, bfd *);
-extern void bfd_elf32_swap_symbol_in
+extern bfd_boolean 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 *);
@@ -1593,7 +1888,7 @@ extern int bfd_elf64_core_file_failing_signal
extern bfd_boolean bfd_elf64_core_file_matches_executable_p
(bfd *, bfd *);
-extern void bfd_elf64_swap_symbol_in
+extern bfd_boolean 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 *);
@@ -1624,6 +1919,14 @@ extern void bfd_elf64_write_relocs
extern bfd_boolean bfd_elf64_slurp_reloc_table
(bfd *, asection *, asymbol **, bfd_boolean);
+extern bfd_boolean _bfd_elf_default_relocs_compatible
+ (const bfd_target *, const bfd_target *);
+
+extern bfd_boolean _bfd_elf_relocs_compatible
+ (const bfd_target *, const bfd_target *);
+
+extern struct elf_link_hash_entry *_bfd_elf_archive_symbol_lookup
+ (bfd *, struct bfd_link_info *, const char *);
extern bfd_boolean bfd_elf_link_add_symbols
(bfd *, struct bfd_link_info *);
extern bfd_boolean _bfd_elf_add_dynamic_entry
@@ -1635,8 +1938,25 @@ extern bfd_boolean bfd_elf_link_record_dynamic_symbol
extern int bfd_elf_link_record_local_dynamic_symbol
(struct bfd_link_info *, bfd *, long);
+extern void bfd_elf_link_mark_dynamic_symbol
+ (struct bfd_link_info *, struct elf_link_hash_entry *,
+ Elf_Internal_Sym *);
+
extern bfd_boolean _bfd_elf_close_and_cleanup
(bfd *);
+
+extern bfd_boolean _bfd_elf_common_definition
+ (Elf_Internal_Sym *);
+
+extern unsigned int _bfd_elf_common_section_index
+ (asection *);
+
+extern asection *_bfd_elf_common_section
+ (asection *);
+
+extern void _bfd_dwarf2_cleanup_debug_info
+ (bfd *);
+
extern bfd_reloc_status_type _bfd_elf_rel_vtable_reloc_fn
(bfd *, arelent *, struct bfd_symbol *, void *,
asection *, bfd *, char **);
@@ -1644,6 +1964,9 @@ extern bfd_reloc_status_type _bfd_elf_rel_vtable_reloc_fn
extern bfd_boolean bfd_elf_final_link
(bfd *, struct bfd_link_info *);
+extern bfd_boolean bfd_elf_gc_mark_dynamic_ref_symbol
+ (struct elf_link_hash_entry *h, void *inf);
+
extern bfd_boolean bfd_elf_gc_sections
(bfd *, struct bfd_link_info *);
@@ -1653,6 +1976,15 @@ extern bfd_boolean bfd_elf_gc_record_vtinherit
extern bfd_boolean bfd_elf_gc_record_vtentry
(bfd *, asection *, struct elf_link_hash_entry *, bfd_vma);
+extern asection *_bfd_elf_gc_mark_hook
+ (asection *, struct bfd_link_info *, Elf_Internal_Rela *,
+ struct elf_link_hash_entry *, Elf_Internal_Sym *);
+
+extern bfd_boolean _bfd_elf_gc_mark
+ (struct bfd_link_info *, asection *,
+ asection * (*) (asection *, struct bfd_link_info *, Elf_Internal_Rela *,
+ struct elf_link_hash_entry *, Elf_Internal_Sym *));
+
extern bfd_boolean bfd_elf_gc_common_finalize_got_offsets
(bfd *, struct bfd_link_info *);
@@ -1662,6 +1994,14 @@ extern bfd_boolean bfd_elf_gc_common_final_link
extern bfd_boolean bfd_elf_reloc_symbol_deleted_p
(bfd_vma, void *);
+extern struct elf_segment_map * _bfd_elf_make_dynamic_segment
+ (bfd *, asection *);
+
+extern bfd_boolean _bfd_elf_map_sections_to_segments
+ (bfd *, struct bfd_link_info *);
+
+extern bfd_boolean _bfd_elf_is_function_type (unsigned int);
+
/* Exported interface for writing elf corefile notes. */
extern char *elfcore_write_note
(bfd *, char *, int *, const char *, int, const void *, int);
@@ -1682,10 +2022,33 @@ extern char *elfcore_write_lwpstatus
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));
+ int (*target_read_memory) (bfd_vma, bfd_byte *, 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));
+ int (*target_read_memory) (bfd_vma, bfd_byte *, int));
+
+extern bfd_vma bfd_elf_obj_attr_size (bfd *);
+extern void bfd_elf_set_obj_attr_contents (bfd *, bfd_byte *, bfd_vma);
+extern int bfd_elf_get_obj_attr_int (bfd *, int, int);
+extern void bfd_elf_add_obj_attr_int (bfd *, int, int, unsigned int);
+#define bfd_elf_add_proc_attr_int(BFD, TAG, VALUE) \
+ bfd_elf_add_obj_attr_int ((BFD), OBJ_ATTR_PROC, (TAG), (VALUE))
+extern void bfd_elf_add_obj_attr_string (bfd *, int, int, const char *);
+#define bfd_elf_add_proc_attr_string(BFD, TAG, VALUE) \
+ bfd_elf_add_obj_attr_string ((BFD), OBJ_ATTR_PROC, (TAG), (VALUE))
+extern void bfd_elf_add_obj_attr_compat (bfd *, int, unsigned int,
+ const char *);
+#define bfd_elf_add_proc_attr_compat(BFD, INTVAL, STRVAL) \
+ bfd_elf_add_obj_attr_compat ((BFD), OBJ_ATTR_PROC, (INTVAL), (STRVAL))
+
+extern char *_bfd_elf_attr_strdup (bfd *, const char *);
+extern void _bfd_elf_copy_obj_attributes (bfd *, bfd *);
+extern int _bfd_elf_obj_attrs_arg_type (bfd *, int, int);
+extern void _bfd_elf_parse_attributes (bfd *, Elf_Internal_Shdr *);
+extern bfd_boolean _bfd_elf_merge_object_attributes (bfd *, bfd *);
+
+/* Large common section. */
+extern asection _bfd_elf_large_com_section;
/* SH ELF specific routine. */
@@ -1697,10 +2060,8 @@ extern bfd_boolean _sh_elf_set_mach_from_flags
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))
+ && ((SHARED) || !(H)->forced_local) \
+ && ((H)->dynindx != -1 || (H)->forced_local))
/* This macro is to avoid lots of duplicated code in the body
of xxx_relocate_section() in the various elfxx-xxxx.c files. */
@@ -1745,7 +2106,7 @@ extern bfd_boolean _sh_elf_set_mach_from_flags
else if (info->unresolved_syms_in_objects == RM_IGNORE \
&& ELF_ST_VISIBILITY (h->other) == STV_DEFAULT) \
; \
- else \
+ else if (!info->relocatable) \
{ \
bfd_boolean err; \
err = (info->unresolved_syms_in_objects == RM_GENERATE_ERROR \
@@ -1761,4 +2122,9 @@ extern bfd_boolean _sh_elf_set_mach_from_flags
} \
while (0)
+/* Will a symbol be bound to the the definition within the shared
+ library, if any. */
+#define SYMBOLIC_BIND(INFO, H) \
+ ((INFO)->symbolic || ((INFO)->dynamic && !(H)->dynamic))
+
#endif /* _LIBELF_H_ */
diff --git a/contrib/binutils/bfd/elf-eh-frame.c b/contrib/binutils/bfd/elf-eh-frame.c
index d3777b4..092c2c5 100644
--- a/contrib/binutils/bfd/elf-eh-frame.c
+++ b/contrib/binutils/bfd/elf-eh-frame.c
@@ -1,5 +1,6 @@
/* .eh_frame section optimization.
- Copyright 2001, 2002, 2003 Free Software Foundation, Inc.
+ Copyright 2001, 2002, 2003, 2004, 2005, 2006, 2007
+ Free Software Foundation, Inc.
Written by Jakub Jelinek <jakub@redhat.com>.
This file is part of BFD, the Binary File Descriptor library.
@@ -16,89 +17,123 @@
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. */
+ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.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)
+struct cie
{
- bfd_vma result;
- unsigned int num_read;
- int shift;
- unsigned char byte;
+ unsigned int length;
+ unsigned int hash;
+ unsigned char version;
+ unsigned char local_personality;
+ char augmentation[20];
+ bfd_vma code_align;
+ bfd_signed_vma data_align;
+ bfd_vma ra_column;
+ bfd_vma augmentation_size;
+ union {
+ struct elf_link_hash_entry *h;
+ bfd_vma val;
+ } personality;
+ asection *output_sec;
+ struct eh_cie_fde *cie_inf;
+ 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];
+};
+
+
+
+/* If *ITER hasn't reached END yet, read the next byte into *RESULT and
+ move onto the next byte. Return true on success. */
+
+static inline bfd_boolean
+read_byte (bfd_byte **iter, bfd_byte *end, unsigned char *result)
+{
+ if (*iter >= end)
+ return FALSE;
+ *result = *((*iter)++);
+ return TRUE;
+}
- result = 0;
- shift = 0;
- num_read = 0;
- do
+/* Move *ITER over LENGTH bytes, or up to END, whichever is closer.
+ Return true it was possible to move LENGTH bytes. */
+
+static inline bfd_boolean
+skip_bytes (bfd_byte **iter, bfd_byte *end, bfd_size_type length)
+{
+ if ((bfd_size_type) (end - *iter) < length)
{
- byte = bfd_get_8 (abfd, (bfd_byte *) buf);
- buf++;
- num_read++;
- result |= (((bfd_vma) byte & 0x7f) << shift);
- shift += 7;
+ *iter = end;
+ return FALSE;
}
- while (byte & 0x80);
- *bytes_read_ptr = num_read;
- return result;
+ *iter += length;
+ return TRUE;
}
-/* Helper function for reading sleb128 encoded data. */
+/* Move *ITER over an leb128, stopping at END. Return true if the end
+ of the leb128 was found. */
-static bfd_signed_vma
-read_signed_leb128 (bfd *abfd ATTRIBUTE_UNUSED,
- char *buf,
- unsigned int * bytes_read_ptr)
+static bfd_boolean
+skip_leb128 (bfd_byte **iter, bfd_byte *end)
{
- 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;
- }
+ if (!read_byte (iter, end, &byte))
+ return FALSE;
while (byte & 0x80);
- if (byte & 0x40)
- result |= (((bfd_vma) -1) << (shift - 7)) << 7;
- *bytes_read_ptr = num_read;
- return result;
+ return TRUE;
+}
+
+/* Like skip_leb128, but treat the leb128 as an unsigned value and
+ store it in *VALUE. */
+
+static bfd_boolean
+read_uleb128 (bfd_byte **iter, bfd_byte *end, bfd_vma *value)
+{
+ bfd_byte *start, *p;
+
+ start = *iter;
+ if (!skip_leb128 (iter, end))
+ return FALSE;
+
+ p = *iter;
+ *value = *--p;
+ while (p > start)
+ *value = (*value << 7) | (*--p & 0x7f);
+
+ return TRUE;
}
-#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)
+/* Like read_uleb128, but for signed values. */
+
+static bfd_boolean
+read_sleb128 (bfd_byte **iter, bfd_byte *end, bfd_signed_vma *value)
+{
+ bfd_byte *start, *p;
+
+ start = *iter;
+ if (!skip_leb128 (iter, end))
+ return FALSE;
+
+ p = *iter;
+ *value = ((*--p & 0x7f) ^ 0x40) - 0x40;
+ while (p > start)
+ *value = (*value << 7) | (*--p & 0x7f);
+
+ return TRUE;
+}
/* Return 0 if either encoding is variable width, or not yet known to bfd. */
@@ -174,20 +209,27 @@ write_value (bfd *abfd, bfd_byte *buf, bfd_vma value, int width)
}
}
-/* Return zero if C1 and C2 CIEs can be merged. */
+/* Return one if C1 and C2 CIEs can be merged. */
-static
-int cie_compare (struct cie *c1, struct cie *c2)
+static int
+cie_eq (const void *e1, const void *e2)
{
- if (c1->hdr.length == c2->hdr.length
+ const struct cie *c1 = e1;
+ const struct cie *c2 = e2;
+
+ if (c1->hash == c2->hash
+ && c1->length == c2->length
&& c1->version == c2->version
+ && c1->local_personality == c2->local_personality
&& 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
+ && memcmp (&c1->personality, &c2->personality,
+ sizeof (c1->personality)) == 0
+ && c1->output_sec == c2->output_sec
&& c1->per_encoding == c2->per_encoding
&& c1->lsda_encoding == c2->lsda_encoding
&& c1->fde_encoding == c2->fde_encoding
@@ -195,9 +237,197 @@ int cie_compare (struct cie *c1, struct cie *c2)
&& memcmp (c1->initial_instructions,
c2->initial_instructions,
c1->initial_insn_length) == 0)
+ return 1;
+
+ return 0;
+}
+
+static hashval_t
+cie_hash (const void *e)
+{
+ const struct cie *c = e;
+ return c->hash;
+}
+
+static hashval_t
+cie_compute_hash (struct cie *c)
+{
+ hashval_t h = 0;
+ h = iterative_hash_object (c->length, h);
+ h = iterative_hash_object (c->version, h);
+ h = iterative_hash (c->augmentation, strlen (c->augmentation) + 1, h);
+ h = iterative_hash_object (c->code_align, h);
+ h = iterative_hash_object (c->data_align, h);
+ h = iterative_hash_object (c->ra_column, h);
+ h = iterative_hash_object (c->augmentation_size, h);
+ h = iterative_hash_object (c->personality, h);
+ h = iterative_hash_object (c->output_sec, h);
+ h = iterative_hash_object (c->per_encoding, h);
+ h = iterative_hash_object (c->lsda_encoding, h);
+ h = iterative_hash_object (c->fde_encoding, h);
+ h = iterative_hash_object (c->initial_insn_length, h);
+ h = iterative_hash (c->initial_instructions, c->initial_insn_length, h);
+ c->hash = h;
+ return h;
+}
+
+/* Return the number of extra bytes that we'll be inserting into
+ ENTRY's augmentation string. */
+
+static INLINE unsigned int
+extra_augmentation_string_bytes (struct eh_cie_fde *entry)
+{
+ unsigned int size = 0;
+ if (entry->cie)
+ {
+ if (entry->add_augmentation_size)
+ size++;
+ if (entry->add_fde_encoding)
+ size++;
+ }
+ return size;
+}
+
+/* Likewise ENTRY's augmentation data. */
+
+static INLINE unsigned int
+extra_augmentation_data_bytes (struct eh_cie_fde *entry)
+{
+ unsigned int size = 0;
+ if (entry->cie)
+ {
+ if (entry->add_augmentation_size)
+ size++;
+ if (entry->add_fde_encoding)
+ size++;
+ }
+ else
+ {
+ if (entry->cie_inf->add_augmentation_size)
+ size++;
+ }
+ return size;
+}
+
+/* Return the size that ENTRY will have in the output. ALIGNMENT is the
+ required alignment of ENTRY in bytes. */
+
+static unsigned int
+size_of_output_cie_fde (struct eh_cie_fde *entry, unsigned int alignment)
+{
+ if (entry->removed)
return 0;
+ if (entry->size == 4)
+ return 4;
+ return (entry->size
+ + extra_augmentation_string_bytes (entry)
+ + extra_augmentation_data_bytes (entry)
+ + alignment - 1) & -alignment;
+}
+
+/* Assume that the bytes between *ITER and END are CFA instructions.
+ Try to move *ITER past the first instruction and return true on
+ success. ENCODED_PTR_WIDTH gives the width of pointer entries. */
+
+static bfd_boolean
+skip_cfa_op (bfd_byte **iter, bfd_byte *end, unsigned int encoded_ptr_width)
+{
+ bfd_byte op;
+ bfd_vma length;
+
+ if (!read_byte (iter, end, &op))
+ return FALSE;
+
+ switch (op & 0xc0 ? op & 0xc0 : op)
+ {
+ case DW_CFA_nop:
+ case DW_CFA_advance_loc:
+ case DW_CFA_restore:
+ case DW_CFA_remember_state:
+ case DW_CFA_restore_state:
+ case DW_CFA_GNU_window_save:
+ /* No arguments. */
+ return TRUE;
+
+ case DW_CFA_offset:
+ case DW_CFA_restore_extended:
+ case DW_CFA_undefined:
+ case DW_CFA_same_value:
+ case DW_CFA_def_cfa_register:
+ case DW_CFA_def_cfa_offset:
+ case DW_CFA_def_cfa_offset_sf:
+ case DW_CFA_GNU_args_size:
+ /* One leb128 argument. */
+ return skip_leb128 (iter, end);
+
+ case DW_CFA_val_offset:
+ case DW_CFA_val_offset_sf:
+ case DW_CFA_offset_extended:
+ case DW_CFA_register:
+ case DW_CFA_def_cfa:
+ case DW_CFA_offset_extended_sf:
+ case DW_CFA_GNU_negative_offset_extended:
+ case DW_CFA_def_cfa_sf:
+ /* Two leb128 arguments. */
+ return (skip_leb128 (iter, end)
+ && skip_leb128 (iter, end));
+
+ case DW_CFA_def_cfa_expression:
+ /* A variable-length argument. */
+ return (read_uleb128 (iter, end, &length)
+ && skip_bytes (iter, end, length));
+
+ case DW_CFA_expression:
+ case DW_CFA_val_expression:
+ /* A leb128 followed by a variable-length argument. */
+ return (skip_leb128 (iter, end)
+ && read_uleb128 (iter, end, &length)
+ && skip_bytes (iter, end, length));
+
+ case DW_CFA_set_loc:
+ return skip_bytes (iter, end, encoded_ptr_width);
+
+ case DW_CFA_advance_loc1:
+ return skip_bytes (iter, end, 1);
+
+ case DW_CFA_advance_loc2:
+ return skip_bytes (iter, end, 2);
+
+ case DW_CFA_advance_loc4:
+ return skip_bytes (iter, end, 4);
+
+ case DW_CFA_MIPS_advance_loc8:
+ return skip_bytes (iter, end, 8);
+
+ default:
+ return FALSE;
+ }
+}
- return 1;
+/* Try to interpret the bytes between BUF and END as CFA instructions.
+ If every byte makes sense, return a pointer to the first DW_CFA_nop
+ padding byte, or END if there is no padding. Return null otherwise.
+ ENCODED_PTR_WIDTH is as for skip_cfa_op. */
+
+static bfd_byte *
+skip_non_nops (bfd_byte *buf, bfd_byte *end, unsigned int encoded_ptr_width,
+ unsigned int *set_loc_count)
+{
+ bfd_byte *last;
+
+ last = buf;
+ while (buf < end)
+ if (*buf == DW_CFA_nop)
+ buf++;
+ else
+ {
+ if (*buf == DW_CFA_set_loc)
+ ++*set_loc_count;
+ if (!skip_cfa_op (&buf, end, encoded_ptr_width))
+ return 0;
+ last = buf;
+ }
+ return last;
}
/* This function is called for each input file before the .eh_frame
@@ -211,46 +441,56 @@ _bfd_elf_discard_section_eh_frame
bfd_boolean (*reloc_symbol_deleted_p) (bfd_vma, void *),
struct elf_reloc_cookie *cookie)
{
+#define REQUIRE(COND) \
+ do \
+ if (!(COND)) \
+ goto free_no_table; \
+ while (0)
+
bfd_byte *ehbuf = NULL, *buf;
- bfd_byte *last_cie, *last_fde;
- struct cie_header hdr;
- struct cie cie;
+ bfd_byte *last_fde;
+ struct eh_cie_fde *ent, *this_inf;
+ unsigned int hdr_length, hdr_id;
+ struct extended_cie
+ {
+ struct cie cie;
+ unsigned int offset;
+ unsigned int usage_count;
+ unsigned int entry;
+ } *ecies = NULL, *ecie;
+ unsigned int ecie_count = 0, ecie_alloced = 0;
+ 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 offset;
unsigned int ptr_size;
+ unsigned int entry_alloced;
- if (sec->_raw_size == 0)
+ if (sec->size == 0)
{
/* This file does not contain .eh_frame information. */
return FALSE;
}
- if ((sec->output_section != NULL
- && bfd_is_abs_section (sec->output_section)))
+ if (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. */
+ 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. */
+ if (hdr_info->cies == NULL && !info->relocatable)
+ hdr_info->cies = htab_try_create (1, cie_hash, cie_eq, free);
- ehbuf = bfd_malloc (sec->_raw_size);
- if (ehbuf == NULL)
- goto free_no_table;
+ /* Read the frame unwind information from abfd. */
- if (! bfd_get_section_contents (abfd, sec, ehbuf, 0, sec->_raw_size))
- goto free_no_table;
+ REQUIRE (bfd_malloc_and_get_section (abfd, sec, &ehbuf));
- if (sec->_raw_size >= 4
+ if (sec->size >= 4
&& bfd_get_32 (abfd, ehbuf) == 0
&& cookie->rel == cookie->relend)
{
@@ -261,162 +501,119 @@ _bfd_elf_discard_section_eh_frame
/* 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;
+ REQUIRE (sec->size == (unsigned int) sec->size);
+
+ ptr_size = (get_elf_backend_data (abfd)
+ ->elf_backend_eh_frame_address_size (abfd, sec));
+ REQUIRE (ptr_size != 0);
- 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;
+ REQUIRE (sec_info);
+
+ entry_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
+ REQUIRE (!(cookie->rel < cookie->relend \
+ && (cookie->rel->r_offset \
+ < (bfd_size_type) ((buf) - ehbuf)) \
+ && cookie->rel->r_info != 0))
#define SKIP_RELOCS(buf) \
while (cookie->rel < cookie->relend \
- && (cookie->rel->r_offset \
+ && (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))) \
+ == (bfd_size_type) ((buf) - ehbuf))) \
? cookie->rel : NULL)
for (;;)
{
- unsigned char *aug;
+ char *aug;
+ bfd_byte *start, *end, *insns, *insns_end;
+ bfd_size_type length;
+ unsigned int set_loc_count;
- if (sec_info->count == sec_info->alloced)
+ if (sec_info->count == entry_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;
+ + ((entry_alloced + 99)
+ * sizeof (struct eh_cie_fde)));
+ REQUIRE (sec_info);
- memset (&sec_info->entry[sec_info->alloced], 0,
+ memset (&sec_info->entry[entry_alloced], 0,
100 * sizeof (struct eh_cie_fde));
- sec_info->alloced += 100;
+ entry_alloced += 100;
}
+ this_inf = sec_info->entry + sec_info->count;
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 ((bfd_size_type) (buf - ehbuf) == sec->size)
+ break;
- 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;
- }
+ /* Read the length of the entry. */
+ REQUIRE (skip_bytes (&buf, ehbuf + sec->size, 4));
+ hdr_length = bfd_get_32 (abfd, buf - 4);
+
+ /* 64-bit .eh_frame is not supported. */
+ REQUIRE (hdr_length != 0xffffffff);
+
+ /* The CIE/FDE must be fully contained in this input section. */
+ REQUIRE ((bfd_size_type) (buf - ehbuf) + hdr_length <= sec->size);
+ end = buf + hdr_length;
+
+ this_inf->offset = last_fde - ehbuf;
+ this_inf->size = 4 + hdr_length;
+
+ if (hdr_length == 0)
+ {
+ /* A zero-length CIE should only be found at the end of
+ the section. */
+ REQUIRE ((bfd_size_type) (buf - ehbuf) == sec->size);
+ ENSURE_NO_RELOCS (buf);
+ sec_info->count++;
+ break;
}
- if (hdr.id == 0 || hdr.id == (unsigned int) -1)
+ REQUIRE (skip_bytes (&buf, end, 4));
+ hdr_id = bfd_get_32 (abfd, buf - 4);
+
+ if (hdr_id == 0)
{
unsigned int initial_insn_length;
/* CIE */
- if (last_cie != NULL)
+ this_inf->cie = 1;
+
+ if (ecie_count == ecie_alloced)
{
- /* 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;
- }
+ ecies = bfd_realloc (ecies,
+ (ecie_alloced + 20) * sizeof (*ecies));
+ REQUIRE (ecies);
+ memset (&ecies[ecie_alloced], 0, 20 * sizeof (*ecies));
+ ecie_alloced += 20;
}
- 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++;
+ cie = &ecies[ecie_count].cie;
+ ecies[ecie_count].offset = this_inf->offset;
+ ecies[ecie_count++].entry = sec_info->count;
+ cie->length = hdr_length;
+ start = buf;
+ REQUIRE (read_byte (&buf, end, &cie->version));
/* Cannot handle unknown versions. */
- if (cie.version != 1)
- goto free_no_table;
- if (strlen (buf) > sizeof (cie.augmentation) - 1)
- goto free_no_table;
+ REQUIRE (cie->version == 1 || cie->version == 3);
+ REQUIRE (strlen ((char *) buf) < sizeof (cie->augmentation));
- strcpy (cie.augmentation, buf);
- buf = strchr (buf, '\0') + 1;
+ strcpy (cie->augmentation, (char *) buf);
+ buf = (bfd_byte *) strchr ((char *) buf, '\0') + 1;
ENSURE_NO_RELOCS (buf);
if (buf[0] == 'e' && buf[1] == 'h')
{
@@ -424,28 +621,29 @@ _bfd_elf_discard_section_eh_frame
/* 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;
+ REQUIRE (skip_bytes (&buf, end, 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);
+ REQUIRE (read_uleb128 (&buf, end, &cie->code_align));
+ REQUIRE (read_sleb128 (&buf, end, &cie->data_align));
+ if (cie->version == 1)
+ {
+ REQUIRE (buf < end);
+ cie->ra_column = *buf++;
+ }
+ else
+ REQUIRE (read_uleb128 (&buf, end, &cie->ra_column));
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;
+ 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);
+ REQUIRE (read_uleb128 (&buf, end, &cie->augmentation_size));
ENSURE_NO_RELOCS (buf);
}
@@ -453,33 +651,32 @@ _bfd_elf_discard_section_eh_frame
switch (*aug++)
{
case 'L':
- cie.lsda_encoding = *buf++;
+ REQUIRE (read_byte (&buf, end, &cie->lsda_encoding));
ENSURE_NO_RELOCS (buf);
- if (get_DW_EH_PE_width (cie.lsda_encoding, ptr_size) == 0)
- goto free_no_table;
+ REQUIRE (get_DW_EH_PE_width (cie->lsda_encoding, ptr_size));
break;
case 'R':
- cie.fde_encoding = *buf++;
+ REQUIRE (read_byte (&buf, end, &cie->fde_encoding));
ENSURE_NO_RELOCS (buf);
- if (get_DW_EH_PE_width (cie.fde_encoding, ptr_size) == 0)
- goto free_no_table;
+ REQUIRE (get_DW_EH_PE_width (cie->fde_encoding, ptr_size));
+ break;
+ case 'S':
break;
case 'P':
{
int per_width;
- cie.per_encoding = *buf++;
- per_width = get_DW_EH_PE_width (cie.per_encoding,
+ REQUIRE (read_byte (&buf, end, &cie->per_encoding));
+ 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)));
+ REQUIRE (per_width);
+ if ((cie->per_encoding & 0xf0) == DW_EH_PE_aligned)
+ {
+ length = -(buf - ehbuf) & (per_width - 1);
+ REQUIRE (skip_bytes (&buf, end, length));
+ }
ENSURE_NO_RELOCS (buf);
- /* Ensure we have a reloc here, against
- a global symbol. */
+ /* Ensure we have a reloc here. */
if (GET_RELOC (buf) != NULL)
{
unsigned long r_symndx;
@@ -490,7 +687,9 @@ _bfd_elf_discard_section_eh_frame
else
#endif
r_symndx = ELF32_R_SYM (cookie->rel->r_info);
- if (r_symndx >= cookie->locsymcount)
+ if (r_symndx >= cookie->locsymcount
+ || ELF_ST_BIND (cookie->locsyms[r_symndx]
+ .st_info) != STB_LOCAL)
{
struct elf_link_hash_entry *h;
@@ -502,11 +701,39 @@ _bfd_elf_discard_section_eh_frame
h = (struct elf_link_hash_entry *)
h->root.u.i.link;
- cie.personality = h;
+ cie->personality.h = h;
}
- cookie->rel++;
+ else
+ {
+ Elf_Internal_Sym *sym;
+ asection *sym_sec;
+ bfd_vma val;
+
+ sym = &cookie->locsyms[r_symndx];
+ sym_sec = (bfd_section_from_elf_index
+ (abfd, sym->st_shndx));
+ if (sym_sec != NULL)
+ {
+ if (sym_sec->kept_section != NULL)
+ sym_sec = sym_sec->kept_section;
+ if (sym_sec->output_section != NULL)
+ {
+ val = (sym->st_value
+ + sym_sec->output_offset
+ + sym_sec->output_section->vma);
+ cie->personality.val = val;
+ cie->local_personality = 1;
+ }
+ }
+ }
+
+ /* Cope with MIPS-style composite relocations. */
+ do
+ cookie->rel++;
+ while (GET_RELOC (buf) != NULL);
}
- buf += per_width;
+ REQUIRE (skip_bytes (&buf, end, per_width));
+ REQUIRE (cie->local_personality || cie->personality.h);
}
break;
default:
@@ -517,152 +744,244 @@ _bfd_elf_discard_section_eh_frame
/* For shared libraries, try to get rid of as many RELATIVE relocs
as possible. */
- if (info->shared
+ 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;
+ (abfd, info, sec)))
+ {
+ if ((cie->fde_encoding & 0xf0) == DW_EH_PE_absptr)
+ cie->make_relative = 1;
+ /* If the CIE doesn't already have an 'R' entry, it's fairly
+ easy to add one, provided that there's no aligned data
+ after the augmentation string. */
+ else if (cie->fde_encoding == DW_EH_PE_omit
+ && (cie->per_encoding & 0xf0) != DW_EH_PE_aligned)
+ {
+ if (*cie->augmentation == 0)
+ this_inf->add_augmentation_size = 1;
+ this_inf->add_fde_encoding = 1;
+ 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;
+ && (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;
+ 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)
+ initial_insn_length = end - buf;
+ if (initial_insn_length <= sizeof (cie->initial_instructions))
{
- cie.initial_insn_length = initial_insn_length;
- memcpy (cie.initial_instructions, buf, initial_insn_length);
+ cie->initial_insn_length = initial_insn_length;
+ memcpy (cie->initial_instructions, buf, initial_insn_length);
}
+ insns = buf;
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;
+ /* Find the corresponding CIE. */
+ unsigned int cie_offset = this_inf->offset + 4 - hdr_id;
+ for (ecie = ecies; ecie < ecies + ecie_count; ++ecie)
+ if (cie_offset == ecie->offset)
+ break;
+
+ /* Ensure this FDE references one of the CIEs in this input
+ section. */
+ REQUIRE (ecie != ecies + ecie_count);
+ cie = &ecie->cie;
ENSURE_NO_RELOCS (buf);
- if (GET_RELOC (buf) == NULL)
- /* This should not happen. */
- goto free_no_table;
+ REQUIRE (GET_RELOC (buf));
+
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;
- }
+ /* This is a FDE against a discarded section. It should
+ be deleted. */
+ this_inf->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))
+ && (((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;
+ (*info->callbacks->einfo)
+ (_("%P: fde encoding in %B(%A) prevents .eh_frame_hdr"
+ " table being created.\n"), abfd, sec);
}
- cie_usage_count++;
+ ecie->usage_count++;
hdr_info->fde_count++;
+ this_inf->cie_inf = (void *) (ecie - ecies);
}
- if (cie.lsda_encoding != DW_EH_PE_omit)
+
+ /* Skip the initial location and address range. */
+ start = buf;
+ length = get_DW_EH_PE_width (cie->fde_encoding, ptr_size);
+ REQUIRE (skip_bytes (&buf, end, 2 * length));
+
+ /* Skip the augmentation size, if present. */
+ if (cie->augmentation[0] == 'z')
+ REQUIRE (read_uleb128 (&buf, end, &length));
+ else
+ length = 0;
+
+ /* Of the supported augmentation characters above, only 'L'
+ adds augmentation data to the FDE. This code would need to
+ be adjusted if any future augmentations do the same thing. */
+ 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);
+ this_inf->lsda_offset = buf - start;
+ /* If there's no 'z' augmentation, we don't know where the
+ CFA insns begin. Assume no padding. */
+ if (cie->augmentation[0] != 'z')
+ length = end - buf;
}
- buf = last_fde + 4 + hdr.length;
+
+ /* Skip over the augmentation data. */
+ REQUIRE (skip_bytes (&buf, end, length));
+ insns = buf;
+
+ 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;
+ /* Try to interpret the CFA instructions and find the first
+ padding nop. Shrink this_inf's size so that it doesn't
+ include the padding. */
+ length = get_DW_EH_PE_width (cie->fde_encoding, ptr_size);
+ set_loc_count = 0;
+ insns_end = skip_non_nops (insns, end, length, &set_loc_count);
+ /* If we don't understand the CFA instructions, we can't know
+ what needs to be adjusted there. */
+ if (insns_end == NULL
+ /* For the time being we don't support DW_CFA_set_loc in
+ CIE instructions. */
+ || (set_loc_count && this_inf->cie))
+ goto free_no_table;
+ this_inf->size -= end - insns_end;
+ if (insns_end != end && this_inf->cie)
+ {
+ cie->initial_insn_length -= end - insns_end;
+ cie->length -= end - insns_end;
+ }
+ if (set_loc_count
+ && ((cie->fde_encoding & 0xf0) == DW_EH_PE_pcrel
+ || cie->make_relative))
+ {
+ unsigned int cnt;
+ bfd_byte *p;
+
+ this_inf->set_loc = bfd_malloc ((set_loc_count + 1)
+ * sizeof (unsigned int));
+ REQUIRE (this_inf->set_loc);
+ this_inf->set_loc[0] = set_loc_count;
+ p = insns;
+ cnt = 0;
+ while (p < end)
+ {
+ if (*p == DW_CFA_set_loc)
+ this_inf->set_loc[++cnt] = p + 1 - start;
+ REQUIRE (skip_cfa_op (&p, end, length));
+ }
+ }
+
+ this_inf->fde_encoding = cie->fde_encoding;
+ this_inf->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++)
+ /* Look at all CIEs in this section and determine which can be
+ removed as unused, which can be merged with previous duplicate
+ CIEs and which need to be kept. */
+ for (ecie = ecies; ecie < ecies + ecie_count; ++ecie)
{
- if (! sec_info->entry[i].removed)
+ if (ecie->usage_count == 0)
{
- 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;
- }
+ sec_info->entry[ecie->entry].removed = 1;
+ continue;
}
- else if (sec_info->entry[i].cie && sec_info->entry[i].sec == sec)
+ ecie->cie.output_sec = sec->output_section;
+ ecie->cie.cie_inf = sec_info->entry + ecie->entry;
+ cie_compute_hash (&ecie->cie);
+ if (hdr_info->cies != NULL)
{
- /* 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;
+ void **loc = htab_find_slot_with_hash (hdr_info->cies, &ecie->cie,
+ ecie->cie.hash, INSERT);
+ if (loc != NULL)
+ {
+ if (*loc != HTAB_EMPTY_ENTRY)
+ {
+ sec_info->entry[ecie->entry].removed = 1;
+ ecie->cie.cie_inf = ((struct cie *) *loc)->cie_inf;
+ continue;
+ }
+
+ *loc = malloc (sizeof (struct cie));
+ if (*loc == NULL)
+ *loc = HTAB_DELETED_ENTRY;
+ else
+ memcpy (*loc, &ecie->cie, sizeof (struct cie));
+ }
}
- }
- 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;
+ ecie->cie.cie_inf->make_relative = ecie->cie.make_relative;
+ ecie->cie.cie_inf->make_lsda_relative = ecie->cie.make_lsda_relative;
+ ecie->cie.cie_inf->per_encoding_relative
+ = (ecie->cie.per_encoding & 0x70) == DW_EH_PE_pcrel;
}
- /* 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;
+ /* Ok, now we can assign new offsets. */
+ offset = 0;
+ for (ent = sec_info->entry; ent < sec_info->entry + sec_info->count; ++ent)
+ if (!ent->removed)
+ {
+ if (!ent->cie)
+ {
+ ecie = ecies + (unsigned long) ent->cie_inf;
+ ent->cie_inf = ecie->cie.cie_inf;
+ }
+ ent->new_offset = offset;
+ offset += size_of_output_cie_fde (ent, ptr_size);
+ }
- /* Shrink the sec as needed. */
- sec->_cooked_size = new_size;
- if (sec->_cooked_size == 0)
- sec->flags |= SEC_EXCLUDE;
+ /* Resize the sec as needed. */
+ sec->rawsize = sec->size;
+ sec->size = offset;
free (ehbuf);
- return new_size != sec->_raw_size;
+ if (ecies)
+ free (ecies);
+ return offset != sec->rawsize;
free_no_table:
+ (*info->callbacks->einfo)
+ (_("%P: error in %B(%A); no .eh_frame_hdr table will be created.\n"),
+ abfd, sec);
if (ehbuf)
free (ehbuf);
if (sec_info)
free (sec_info);
+ if (ecies)
+ free (ecies);
hdr_info->table = FALSE;
- hdr_info->last_cie.hdr.length = 0;
return FALSE;
+
+#undef REQUIRE
}
/* This function is called for .eh_frame_hdr section after
@@ -678,24 +997,29 @@ _bfd_elf_discard_section_eh_frame_hdr (bfd *abfd, struct bfd_link_info *info)
htab = elf_hash_table (info);
hdr_info = &htab->eh_info;
+
+ if (hdr_info->cies != NULL)
+ {
+ htab_delete (hdr_info->cies);
+ hdr_info->cies = NULL;
+ }
+
sec = hdr_info->hdr_sec;
if (sec == NULL)
return FALSE;
- sec->_cooked_size = EH_FRAME_HDR_SIZE;
+ sec->size = EH_FRAME_HDR_SIZE;
if (hdr_info->table)
- sec->_cooked_size += 4 + hdr_info->fde_count * 8;
+ sec->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. */
+ because when the dynamic symbol table has been sized it is too late
+ to strip sections. */
bfd_boolean
_bfd_elf_maybe_strip_eh_frame_hdr (struct bfd_link_info *info)
@@ -723,13 +1047,13 @@ _bfd_elf_maybe_strip_eh_frame_hdr (struct bfd_link_info *info)
/* 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))
+ if (o && o->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->flags |= SEC_EXCLUDE;
hdr_info->hdr_sec = NULL;
return TRUE;
}
@@ -745,18 +1069,26 @@ _bfd_elf_maybe_strip_eh_frame_hdr (struct bfd_link_info *info)
bfd_vma
_bfd_elf_eh_frame_section_offset (bfd *output_bfd ATTRIBUTE_UNUSED,
+ struct bfd_link_info *info,
asection *sec,
bfd_vma offset)
{
struct eh_frame_sec_info *sec_info;
+ struct elf_link_hash_table *htab;
+ struct eh_frame_hdr_info *hdr_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);
+ if (offset >= sec->rawsize)
+ return offset - sec->rawsize + sec->size;
+
+ htab = elf_hash_table (info);
+ hdr_info = &htab->eh_info;
+ if (hdr_info->offsets_adjusted)
+ offset += sec->output_offset;
lo = 0;
hi = sec_info->count;
@@ -781,21 +1113,48 @@ _bfd_elf_eh_frame_section_offset (bfd *output_bfd ATTRIBUTE_UNUSED,
/* 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
+ if (!sec_info->entry[mid].cie
+ && sec_info->entry[mid].cie_inf->make_relative
&& 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
+ if (!sec_info->entry[mid].cie
+ && sec_info->entry[mid].cie_inf->make_lsda_relative
&& (offset == (sec_info->entry[mid].offset + 8
- + sec_info->entry[mid].lsda_offset)))
- return (bfd_vma) -2;
+ + sec_info->entry[mid].lsda_offset))
+ && (sec_info->entry[mid].cie_inf->need_lsda_relative
+ || !hdr_info->offsets_adjusted))
+ {
+ sec_info->entry[mid].cie_inf->need_lsda_relative = 1;
+ return (bfd_vma) -2;
+ }
+
+ /* If converting to DW_EH_PE_pcrel, there will be no need for run-time
+ relocation against DW_CFA_set_loc's arguments. */
+ if (sec_info->entry[mid].set_loc
+ && (sec_info->entry[mid].cie
+ ? sec_info->entry[mid].make_relative
+ : sec_info->entry[mid].cie_inf->make_relative)
+ && (offset >= sec_info->entry[mid].offset + 8
+ + sec_info->entry[mid].set_loc[1]))
+ {
+ unsigned int cnt;
+ for (cnt = 1; cnt <= sec_info->entry[mid].set_loc[0]; cnt++)
+ if (offset == sec_info->entry[mid].offset + 8
+ + sec_info->entry[mid].set_loc[cnt])
+ return (bfd_vma) -2;
+ }
+
+ if (hdr_info->offsets_adjusted)
+ offset -= sec->output_offset;
+ /* Any new augmentation bytes go before the first relocation. */
return (offset + sec_info->entry[mid].new_offset
- - sec_info->entry[mid].offset);
+ - sec_info->entry[mid].offset
+ + extra_augmentation_string_bytes (sec_info->entry + mid)
+ + extra_augmentation_data_bytes (sec_info->entry + mid));
}
/* Write out .eh_frame section. This is called with the relocated
@@ -810,89 +1169,160 @@ _bfd_elf_write_section_eh_frame (bfd *abfd,
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;
+ struct eh_cie_fde *ent;
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->output_offset, sec->size);
+
+ ptr_size = (get_elf_backend_data (abfd)
+ ->elf_backend_eh_frame_address_size (abfd, sec));
+ BFD_ASSERT (ptr_size != 0);
+
sec_info = elf_section_data (sec)->sec_info;
htab = elf_hash_table (info);
hdr_info = &htab->eh_info;
+
+ /* First convert all offsets to output section offsets, so that a
+ CIE offset is valid if the CIE is used by a FDE from some other
+ section. This can happen when duplicate CIEs are deleted in
+ _bfd_elf_discard_section_eh_frame. We do all sections here because
+ this function might not be called on sections in the same order as
+ _bfd_elf_discard_section_eh_frame. */
+ if (!hdr_info->offsets_adjusted)
+ {
+ bfd *ibfd;
+ asection *eh;
+ struct eh_frame_sec_info *eh_inf;
+
+ for (ibfd = info->input_bfds; ibfd != NULL; ibfd = ibfd->link_next)
+ {
+ if (bfd_get_flavour (ibfd) != bfd_target_elf_flavour
+ || (ibfd->flags & DYNAMIC) != 0)
+ continue;
+
+ eh = bfd_get_section_by_name (ibfd, ".eh_frame");
+ if (eh == NULL || eh->sec_info_type != ELF_INFO_TYPE_EH_FRAME)
+ continue;
+
+ eh_inf = elf_section_data (eh)->sec_info;
+ for (ent = eh_inf->entry; ent < eh_inf->entry + eh_inf->count; ++ent)
+ {
+ ent->offset += eh->output_offset;
+ ent->new_offset += eh->output_offset;
+ }
+ }
+ hdr_info->offsets_adjusted = TRUE;
+ }
+
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)
+ /* The new offsets can be bigger or smaller than the original offsets.
+ We therefore need to make two passes over the section: one backward
+ pass to move entries up and one forward pass to move entries down.
+ The two passes won't interfere with each other because entries are
+ not reordered */
+ for (ent = sec_info->entry + sec_info->count; ent-- != sec_info->entry;)
+ if (!ent->removed && ent->new_offset > ent->offset)
+ memmove (contents + ent->new_offset - sec->output_offset,
+ contents + ent->offset - sec->output_offset, ent->size);
+
+ for (ent = sec_info->entry; ent < sec_info->entry + sec_info->count; ++ent)
+ if (!ent->removed && ent->new_offset < ent->offset)
+ memmove (contents + ent->new_offset - sec->output_offset,
+ contents + ent->offset - sec->output_offset, ent->size);
+
+ for (ent = sec_info->entry; ent < sec_info->entry + sec_info->count; ++ent)
{
- if (sec_info->entry[i].removed)
+ unsigned char *buf, *end;
+ unsigned int new_size;
+
+ if (ent->removed)
+ continue;
+
+ if (ent->size == 4)
{
- 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);
- }
- }
+ /* Any terminating FDE must be at the end of the section. */
+ BFD_ASSERT (ent == sec_info->entry + sec_info->count - 1);
continue;
}
- if (sec_info->entry[i].cie)
+ buf = contents + ent->new_offset - sec->output_offset;
+ end = buf + ent->size;
+ new_size = size_of_output_cie_fde (ent, ptr_size);
+
+ /* Update the size. It may be shrinked. */
+ bfd_put_32 (abfd, new_size - 4, buf);
+
+ /* Filling the extra bytes with DW_CFA_nops. */
+ if (new_size != ent->size)
+ memset (end, 0, new_size - ent->size);
+
+ if (ent->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)
+ if (ent->make_relative
+ || ent->need_lsda_relative
+ || ent->per_encoding_relative)
{
- unsigned char *aug;
- unsigned int action;
- unsigned int dummy, per_width, per_encoding;
+ char *aug;
+ unsigned int action, extra_string, extra_data;
+ unsigned int 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;
+ action = ((ent->make_relative ? 1 : 0)
+ | (ent->need_lsda_relative ? 2 : 0)
+ | (ent->per_encoding_relative ? 4 : 0));
+ extra_string = extra_augmentation_string_bytes (ent);
+ extra_data = extra_augmentation_data_bytes (ent);
+
/* 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);
+ aug = (char *) buf;
+ buf += strlen (aug) + 1;
+ skip_leb128 (&buf, end);
+ skip_leb128 (&buf, end);
+ skip_leb128 (&buf, end);
if (*aug == 'z')
{
- read_uleb128 (dummy, buf);
+ /* The uleb128 will always be a single byte for the kind
+ of augmentation strings that we're prepared to handle. */
+ *buf++ += extra_data;
aug++;
}
+ /* Make room for the new augmentation string and data bytes. */
+ memmove (buf + extra_string + extra_data, buf, end - buf);
+ memmove (aug + extra_string, aug, buf - (bfd_byte *) aug);
+ buf += extra_string;
+ end += extra_string + extra_data;
+
+ if (ent->add_augmentation_size)
+ {
+ *aug++ = 'z';
+ *buf++ = extra_data - 1;
+ }
+ if (ent->add_fde_encoding)
+ {
+ BFD_ASSERT (action & 1);
+ *aug++ = 'R';
+ *buf++ = DW_EH_PE_pcrel;
+ action &= ~1;
+ }
+
while (action)
switch (*aug++)
{
case 'L':
if (action & 2)
{
- BFD_ASSERT (*buf == sec_info->entry[i].lsda_encoding);
+ BFD_ASSERT (*buf == ent->lsda_encoding);
*buf |= DW_EH_PE_pcrel;
action &= ~2;
}
@@ -900,25 +1330,23 @@ _bfd_elf_write_section_eh_frame (bfd *abfd,
break;
case 'P':
per_encoding = *buf++;
- per_width = get_DW_EH_PE_width (per_encoding,
- ptr_size);
+ 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);
+ == ent->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);
+ bfd_vma val;
+
+ val = read_value (abfd, buf, per_width,
+ get_DW_EH_PE_signed (per_encoding));
+ val += ent->offset - ent->new_offset;
+ val -= extra_string + extra_data;
+ write_value (abfd, buf, val, per_width);
action &= ~4;
}
buf += per_width;
@@ -926,37 +1354,38 @@ _bfd_elf_write_section_eh_frame (bfd *abfd,
case 'R':
if (action & 1)
{
- BFD_ASSERT (*buf == sec_info->entry[i].fde_encoding);
+ BFD_ASSERT (*buf == ent->fde_encoding);
*buf |= DW_EH_PE_pcrel;
action &= ~1;
}
buf++;
break;
+ case 'S':
+ break;
default:
BFD_FAIL ();
}
}
}
- else if (sec_info->entry[i].size > 4)
+ else
{
/* FDE */
- bfd_vma value = 0, address;
+ bfd_vma value, address;
unsigned int width;
+ bfd_byte *start;
- 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);
+ value = ent->new_offset + 4 - ent->cie_inf->new_offset;
+ bfd_put_32 (abfd, value, 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));
+ width = get_DW_EH_PE_width (ent->fde_encoding, ptr_size);
+ value = read_value (abfd, buf, width,
+ get_DW_EH_PE_signed (ent->fde_encoding));
+ address = value;
if (value)
{
- switch (sec_info->entry[i].fde_encoding & 0xf0)
+ switch (ent->fde_encoding & 0xf0)
{
case DW_EH_PE_indirect:
case DW_EH_PE_textrel:
@@ -971,112 +1400,93 @@ _bfd_elf_write_section_eh_frame (bfd *abfd,
}
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);
+ value += ent->offset - ent->new_offset;
+ address += sec->output_section->vma + ent->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);
+ if (ent->cie_inf->make_relative)
+ value -= sec->output_section->vma + ent->new_offset + 8;
write_value (abfd, buf, value, width);
}
+ start = buf;
+
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);
+ = sec->output_section->vma + ent->new_offset;
}
- if ((sec_info->entry[i].lsda_encoding & 0xf0) == DW_EH_PE_pcrel
- || sec_info->entry[i].make_lsda_relative)
+ if ((ent->lsda_encoding & 0xf0) == DW_EH_PE_pcrel
+ || ent->cie_inf->need_lsda_relative)
{
- buf += sec_info->entry[i].lsda_offset;
- width = get_DW_EH_PE_width (sec_info->entry[i].lsda_encoding,
- ptr_size);
+ buf += ent->lsda_offset;
+ width = get_DW_EH_PE_width (ent->lsda_encoding, ptr_size);
value = read_value (abfd, buf, width,
- get_DW_EH_PE_signed
- (sec_info->entry[i].lsda_encoding));
+ get_DW_EH_PE_signed (ent->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);
+ if ((ent->lsda_encoding & 0xf0) == DW_EH_PE_pcrel)
+ value += ent->offset - ent->new_offset;
+ else if (ent->cie_inf->need_lsda_relative)
+ value -= (sec->output_section->vma + ent->new_offset + 8
+ + ent->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;
+ else if (ent->cie_inf->add_augmentation_size)
+ {
+ /* Skip the PC and length and insert a zero byte for the
+ augmentation size. */
+ buf += width * 2;
+ memmove (buf + 1, buf, end - buf);
+ *buf = 0;
+ }
- /* Update length. */
- sec_info->entry[i].size += pad;
- bfd_put_32 (abfd, sec_info->entry[i].size - 4, buf);
+ if (ent->set_loc)
+ {
+ /* Adjust DW_CFA_set_loc. */
+ unsigned int cnt, width;
+ bfd_vma new_offset;
- /* Pad it with DW_CFA_nop */
- memset (p, 0, pad);
- p += pad;
+ width = get_DW_EH_PE_width (ent->fde_encoding, ptr_size);
+ new_offset = ent->new_offset + 8
+ + extra_augmentation_string_bytes (ent)
+ + extra_augmentation_data_bytes (ent);
- sec->_cooked_size += pad;
+ for (cnt = 1; cnt <= ent->set_loc[0]; cnt++)
+ {
+ bfd_vma value;
+ buf = start + ent->set_loc[cnt];
+
+ value = read_value (abfd, buf, width,
+ get_DW_EH_PE_signed (ent->fde_encoding));
+ if (!value)
+ continue;
+
+ if ((ent->fde_encoding & 0xf0) == DW_EH_PE_pcrel)
+ value += ent->offset + 8 - new_offset;
+ if (ent->cie_inf->make_relative)
+ value -= sec->output_section->vma + new_offset
+ + ent->set_loc[cnt];
+ write_value (abfd, buf, value, width);
+ }
+ }
}
}
- BFD_ASSERT ((bfd_size_type) (p - contents) == sec->_cooked_size);
+ /* We don't align the section to its section alignment since the
+ runtime library only expects all CIE/FDE records aligned at
+ the pointer size. _bfd_elf_discard_section_eh_frame should
+ have padded CIE/FDE records to multiple of pointer size with
+ size_of_output_cie_fde. */
+ if ((sec->size % ptr_size) != 0)
+ abort ();
return bfd_set_section_contents (abfd, sec->output_section,
- contents, (file_ptr) sec->output_offset,
- sec->_cooked_size);
+ contents, (file_ptr) sec->output_offset,
+ sec->size);
}
/* Helper function used to sort .eh_frame_hdr search table by increasing
@@ -1187,11 +1597,19 @@ _bfd_elf_write_section_eh_frame_hdr (bfd *abfd, struct bfd_link_info *info)
retval = bfd_set_section_contents (abfd, sec->output_section,
contents, (file_ptr) sec->output_offset,
- sec->_cooked_size);
+ sec->size);
free (contents);
return retval;
}
+/* Return the width of FDE addresses. This is the default implementation. */
+
+unsigned int
+_bfd_elf_eh_frame_address_size (bfd *abfd, asection *sec ATTRIBUTE_UNUSED)
+{
+ return elf_elfheader (abfd)->e_ident[EI_CLASS] == ELFCLASS64 ? 8 : 4;
+}
+
/* Decide whether we can use a PC-relative encoding within the given
EH frame section. This is the default implementation. */
diff --git a/contrib/binutils/bfd/elf-strtab.c b/contrib/binutils/bfd/elf-strtab.c
index 673b9d7..f5d6db1 100644
--- a/contrib/binutils/bfd/elf-strtab.c
+++ b/contrib/binutils/bfd/elf-strtab.c
@@ -1,5 +1,6 @@
/* ELF strtab with GC and suffix merging support.
- Copyright 2001, 2002, 2003 Free Software Foundation, Inc.
+ Copyright 2001, 2002, 2003, 2005, 2006, 2007
+ Free Software Foundation, Inc.
Written by Jakub Jelinek <jakub@redhat.com>.
This file is part of BFD, the Binary File Descriptor library.
@@ -16,10 +17,10 @@
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. */
+ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
#include "elf-bfd.h"
#include "hashtab.h"
@@ -99,7 +100,8 @@ _bfd_elf_strtab_init (void)
if (table == NULL)
return NULL;
- if (! bfd_hash_table_init (&table->table, elf_strtab_hash_newfunc))
+ if (!bfd_hash_table_init (&table->table, elf_strtab_hash_newfunc,
+ sizeof (struct elf_strtab_hash_entry)))
{
free (table);
return NULL;
@@ -263,8 +265,8 @@ strrevcmp (const void *a, const void *b)
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;
+ const unsigned char *s = (const unsigned char *) A->root.string + lenA - 1;
+ const unsigned char *t = (const unsigned char *) B->root.string + lenB - 1;
int l = lenA < lenB ? lenA : lenB;
while (l)
diff --git a/contrib/binutils/bfd/elf-vxworks.c b/contrib/binutils/bfd/elf-vxworks.c
new file mode 100644
index 0000000..7b0d590
--- /dev/null
+++ b/contrib/binutils/bfd/elf-vxworks.c
@@ -0,0 +1,227 @@
+/* VxWorks support for ELF
+ Copyright 2005, 2007 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 provides routines used by all VxWorks targets. */
+
+#include "sysdep.h"
+#include "bfd.h"
+#include "libbfd.h"
+#include "elf-bfd.h"
+#include "elf-vxworks.h"
+
+/* Return true if symbol NAME, as defined by ABFD, is one of the special
+ __GOTT_BASE__ or __GOTT_INDEX__ symbols. */
+
+static bfd_boolean
+elf_vxworks_gott_symbol_p (bfd *abfd, const char *name)
+{
+ char leading;
+
+ leading = bfd_get_symbol_leading_char (abfd);
+ if (leading)
+ {
+ if (*name != leading)
+ return FALSE;
+ name++;
+ }
+ return (strcmp (name, "__GOTT_BASE__") == 0
+ || strcmp (name, "__GOTT_INDEX__") == 0);
+}
+
+/* Tweak magic VxWorks symbols as they are loaded. */
+bfd_boolean
+elf_vxworks_add_symbol_hook (bfd *abfd,
+ struct bfd_link_info *info,
+ Elf_Internal_Sym *sym,
+ const char **namep,
+ flagword *flagsp,
+ asection **secp ATTRIBUTE_UNUSED,
+ bfd_vma *valp ATTRIBUTE_UNUSED)
+{
+ /* Ideally these "magic" symbols would be exported by libc.so.1
+ which would be found via a DT_NEEDED tag, and then handled
+ specially by the linker at runtime. Except shared libraries
+ don't even link to libc.so.1 by default...
+ If the symbol is imported from, or will be put in a shared library,
+ give the symbol weak binding to get the desired samantics.
+ This transformation will be undone in
+ elf_i386_vxworks_link_output_symbol_hook. */
+ if ((info->shared || abfd->flags & DYNAMIC)
+ && elf_vxworks_gott_symbol_p (abfd, *namep))
+ {
+ sym->st_info = ELF_ST_INFO (STB_WEAK, ELF_ST_TYPE (sym->st_info));
+ *flagsp |= BSF_WEAK;
+ }
+
+ return TRUE;
+}
+
+/* Perform VxWorks-specific handling of the create_dynamic_sections hook.
+ When creating an executable, set *SRELPLT2_OUT to the .rel(a).plt.unloaded
+ section. */
+
+bfd_boolean
+elf_vxworks_create_dynamic_sections (bfd *dynobj, struct bfd_link_info *info,
+ asection **srelplt2_out)
+{
+ struct elf_link_hash_table *htab;
+ const struct elf_backend_data *bed;
+ asection *s;
+
+ htab = elf_hash_table (info);
+ bed = get_elf_backend_data (dynobj);
+
+ if (!info->shared)
+ {
+ s = bfd_make_section_with_flags (dynobj,
+ bed->default_use_rela_p
+ ? ".rela.plt.unloaded"
+ : ".rel.plt.unloaded",
+ SEC_HAS_CONTENTS | SEC_IN_MEMORY
+ | SEC_READONLY | SEC_LINKER_CREATED);
+ if (s == NULL
+ || !bfd_set_section_alignment (dynobj, s, bed->s->log_file_align))
+ return FALSE;
+
+ *srelplt2_out = s;
+ }
+
+ /* Mark the GOT and PLT symbols as having relocations; they might
+ not, but we won't know for sure until we build the GOT in
+ finish_dynamic_symbol. Also make sure that the GOT symbol
+ is entered into the dynamic symbol table; the loader uses it
+ to initialize __GOTT_BASE__[__GOTT_INDEX__]. */
+ if (htab->hgot)
+ {
+ htab->hgot->indx = -2;
+ htab->hgot->other &= ~ELF_ST_VISIBILITY (-1);
+ htab->hgot->forced_local = 0;
+ if (!bfd_elf_link_record_dynamic_symbol (info, htab->hgot))
+ return FALSE;
+ }
+ if (htab->hplt)
+ {
+ htab->hplt->indx = -2;
+ htab->hplt->type = STT_FUNC;
+ }
+
+ return TRUE;
+}
+
+/* Tweak magic VxWorks symbols as they are written to the output file. */
+bfd_boolean
+elf_vxworks_link_output_symbol_hook (struct bfd_link_info *info
+ ATTRIBUTE_UNUSED,
+ const char *name,
+ Elf_Internal_Sym *sym,
+ asection *input_sec ATTRIBUTE_UNUSED,
+ struct elf_link_hash_entry *h)
+{
+ /* Reverse the effects of the hack in elf_vxworks_add_symbol_hook. */
+ if (h
+ && h->root.type == bfd_link_hash_undefweak
+ && elf_vxworks_gott_symbol_p (h->root.u.undef.abfd, name))
+ sym->st_info = ELF_ST_INFO (STB_GLOBAL, ELF_ST_TYPE (sym->st_info));
+
+ return TRUE;
+}
+
+
+/* Copy relocations into the output file. Fixes up relocations againt PLT
+ entries, then calls the generic routine. */
+
+bfd_boolean
+elf_vxworks_emit_relocs (bfd *output_bfd,
+ asection *input_section,
+ Elf_Internal_Shdr *input_rel_hdr,
+ Elf_Internal_Rela *internal_relocs,
+ struct elf_link_hash_entry **rel_hash)
+{
+ const struct elf_backend_data *bed;
+ Elf_Internal_Rela *irela;
+ Elf_Internal_Rela *irelaend;
+ int j;
+
+ 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);
+ while (irela < irelaend)
+ {
+ if ((output_bfd->flags & (DYNAMIC|EXEC_P))
+ && *rel_hash
+ && (*rel_hash)->def_dynamic
+ && !(*rel_hash)->def_regular
+ && ((*rel_hash)->root.type == bfd_link_hash_defined
+ || (*rel_hash)->root.type == bfd_link_hash_defweak)
+ && (*rel_hash)->root.u.def.section->output_section != NULL)
+ {
+ /* This is a relocation from an executable or shared library
+ against a symbol in a different shared library. We are
+ creating a definition in the output file but it does not come
+ from any of our normal (.o) files. ie. a PLT stub.
+ Normally this would be a relocation against against SHN_UNDEF
+ with the VMA of the PLT stub. This upsets the VxWorks loader.
+ Convert it to a section-relative relocation.
+ This gets some other symbols (for instance .dynbss),
+ but is conservatively correct. */
+ for (j = 0; j < bed->s->int_rels_per_ext_rel; j++)
+ {
+ asection *sec = (*rel_hash)->root.u.def.section;
+ int this_idx = sec->output_section->target_index;
+
+ irela[j].r_info = ELF32_R_INFO (this_idx,
+ ELF32_R_TYPE (irela[j].r_info));
+ irela[j].r_addend += (*rel_hash)->root.u.def.value;
+ irela[j].r_addend += sec->output_offset;
+ }
+ /* Stop the generic routine adjusting this entry. */
+ *rel_hash = NULL;
+ }
+ irela += bed->s->int_rels_per_ext_rel;
+ rel_hash++;
+ }
+ return _bfd_elf_link_output_relocs (output_bfd, input_section,
+ input_rel_hdr, internal_relocs,
+ rel_hash);
+}
+
+
+/* Set the sh_link and sh_info fields on the static plt relocation secton. */
+
+void
+elf_vxworks_final_write_processing (bfd *abfd,
+ bfd_boolean linker ATTRIBUTE_UNUSED)
+{
+ asection * sec;
+ struct bfd_elf_section_data *d;
+
+ sec = bfd_get_section_by_name (abfd, ".rel.plt.unloaded");
+ if (!sec)
+ sec = bfd_get_section_by_name (abfd, ".rela.plt.unloaded");
+ if (!sec)
+ return;
+ d = elf_section_data (sec);
+ d->this_hdr.sh_link = elf_tdata (abfd)->symtab_section;
+ sec = bfd_get_section_by_name (abfd, ".plt");
+ if (sec)
+ d->this_hdr.sh_info = elf_section_data (sec)->this_idx;
+}
diff --git a/contrib/binutils/bfd/elf-vxworks.h b/contrib/binutils/bfd/elf-vxworks.h
new file mode 100644
index 0000000..c8ea009
--- /dev/null
+++ b/contrib/binutils/bfd/elf-vxworks.h
@@ -0,0 +1,35 @@
+/* VxWorks support for ELF
+ Copyright 2005 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"
+
+bfd_boolean elf_vxworks_add_symbol_hook
+ (bfd *, struct bfd_link_info *, Elf_Internal_Sym *, const char **,
+ flagword *, asection **, bfd_vma *);
+bfd_boolean elf_vxworks_link_output_symbol_hook
+ (struct bfd_link_info *, const char *name, Elf_Internal_Sym *,
+ asection *, struct elf_link_hash_entry *);
+bfd_boolean elf_vxworks_emit_relocs
+ (bfd *, asection *, Elf_Internal_Shdr *, Elf_Internal_Rela *,
+ struct elf_link_hash_entry **);
+void elf_vxworks_final_write_processing (bfd *, bfd_boolean);
+bfd_boolean elf_vxworks_create_dynamic_sections
+ (bfd *, struct bfd_link_info *, asection **);
diff --git a/contrib/binutils/bfd/elf.c b/contrib/binutils/bfd/elf.c
index 2f4728f..bbf1617 100644
--- a/contrib/binutils/bfd/elf.c
+++ b/contrib/binutils/bfd/elf.c
@@ -1,7 +1,7 @@
/* ELF executable support for BFD.
Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
- 2002, 2003, 2004 Free Software Foundation, Inc.
+ 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@@ -17,14 +17,14 @@
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. */
+ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
/* $FreeBSD$ */
-/* SECTION
-
+/*
+SECTION
ELF backends
BFD support for ELF formats is being worked on.
@@ -37,8 +37,8 @@
/* For sparc64-cross-sparc32. */
#define _SYSCALL32
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "bfdlink.h"
#include "libbfd.h"
#define ARCH_SIZE 0
@@ -210,38 +210,32 @@ bfd_elf_hash (const char *namearg)
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. */
+/* DT_GNU_HASH hash function. Do not change this function; you will
+ cause invalid hash tables to be generated. */
-static char *
-elf_read (bfd *abfd, file_ptr offset, bfd_size_type size)
+unsigned long
+bfd_elf_gnu_hash (const char *namearg)
{
- char *buf;
+ const unsigned char *name = (const unsigned char *) namearg;
+ unsigned long h = 5381;
+ unsigned char ch;
- 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;
+ while ((ch = *name++) != '\0')
+ h = (h << 5) + h + ch;
+ return h & 0xffffffff;
}
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? */
+ if (abfd->tdata.any == NULL)
+ {
+ abfd->tdata.any = bfd_zalloc (abfd, sizeof (struct elf_obj_tdata));
+ if (abfd->tdata.any == NULL)
+ return FALSE;
+ }
+
+ elf_tdata (abfd)->program_header_size = (bfd_size_type) -1;
return TRUE;
}
@@ -257,24 +251,40 @@ char *
bfd_elf_get_str_section (bfd *abfd, unsigned int shindex)
{
Elf_Internal_Shdr **i_shdrp;
- char *shstrtab = NULL;
+ bfd_byte *shstrtab = NULL;
file_ptr offset;
bfd_size_type shstrtabsize;
i_shdrp = elf_elfsections (abfd);
- if (i_shdrp == 0 || i_shdrp[shindex] == 0)
- return 0;
+ if (i_shdrp == 0
+ || shindex >= elf_numsections (abfd)
+ || i_shdrp[shindex] == 0)
+ return NULL;
- shstrtab = (char *) i_shdrp[shindex]->contents;
+ shstrtab = 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);
+
+ /* Allocate and clear an extra byte at the end, to prevent crashes
+ in case the string table is not terminated. */
+ if (shstrtabsize + 1 == 0
+ || (shstrtab = bfd_alloc (abfd, shstrtabsize + 1)) == NULL
+ || bfd_seek (abfd, offset, SEEK_SET) != 0)
+ shstrtab = NULL;
+ else if (bfd_bread (shstrtab, shstrtabsize, abfd) != shstrtabsize)
+ {
+ if (bfd_get_error () != bfd_error_system_call)
+ bfd_set_error (bfd_error_file_truncated);
+ shstrtab = NULL;
+ }
+ else
+ shstrtab[shstrtabsize] = '\0';
i_shdrp[shindex]->contents = shstrtab;
}
- return shstrtab;
+ return (char *) shstrtab;
}
char *
@@ -287,6 +297,9 @@ bfd_elf_string_from_elf_section (bfd *abfd,
if (strindex == 0)
return "";
+ if (elf_elfsections (abfd) == NULL || shindex >= elf_numsections (abfd))
+ return NULL;
+
hdr = elf_elfsections (abfd)[shindex];
if (hdr->contents == NULL
@@ -295,13 +308,13 @@ bfd_elf_string_from_elf_section (bfd *abfd,
if (strindex >= hdr->sh_size)
{
+ unsigned int shstrndx = elf_elfheader(abfd)->e_shstrndx;
(*_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)
+ (_("%B: invalid string offset %u >= %lu for section `%s'"),
+ abfd, strindex, (unsigned long) hdr->sh_size,
+ (shindex == shstrndx && strindex == hdr->sh_name
? ".shstrtab"
- : elf_string_from_elf_strtab (abfd, hdr->sh_name)));
+ : bfd_elf_string_from_elf_section (abfd, shstrndx, hdr->sh_name)));
return "";
}
@@ -352,7 +365,7 @@ bfd_elf_get_elf_syms (bfd *ibfd,
pos = symtab_hdr->sh_offset + symoffset * extsym_size;
if (extsym_buf == NULL)
{
- alloc_ext = bfd_malloc (amt);
+ alloc_ext = bfd_malloc2 (symcount, extsym_size);
extsym_buf = alloc_ext;
}
if (extsym_buf == NULL
@@ -371,7 +384,8 @@ bfd_elf_get_elf_syms (bfd *ibfd,
pos = shndx_hdr->sh_offset + symoffset * sizeof (Elf_External_Sym_Shndx);
if (extshndx_buf == NULL)
{
- alloc_extshndx = bfd_malloc (amt);
+ alloc_extshndx = bfd_malloc2 (symcount,
+ sizeof (Elf_External_Sym_Shndx));
extshndx_buf = alloc_extshndx;
}
if (extshndx_buf == NULL
@@ -385,8 +399,7 @@ bfd_elf_get_elf_syms (bfd *ibfd,
if (intsym_buf == NULL)
{
- bfd_size_type amt = symcount * sizeof (Elf_Internal_Sym);
- intsym_buf = bfd_malloc (amt);
+ intsym_buf = bfd_malloc2 (symcount, sizeof (Elf_Internal_Sym));
if (intsym_buf == NULL)
goto out;
}
@@ -396,7 +409,15 @@ bfd_elf_get_elf_syms (bfd *ibfd,
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);
+ if (!(*bed->s->swap_symbol_in) (ibfd, esym, shndx, isym))
+ {
+ symoffset += (esym - (bfd_byte *) extsym_buf) / extsym_size;
+ (*_bfd_error_handler) (_("%B symbol number %lu references "
+ "nonexistent SHT_SYMTAB_SHNDX section"),
+ ibfd, (unsigned long) symoffset);
+ intsym_buf = NULL;
+ goto out;
+ }
out:
if (alloc_ext != NULL)
@@ -409,17 +430,31 @@ bfd_elf_get_elf_syms (bfd *ibfd,
/* Look up a symbol name. */
const char *
-bfd_elf_local_sym_name (bfd *abfd, Elf_Internal_Sym *isym)
+bfd_elf_sym_name (bfd *abfd,
+ Elf_Internal_Shdr *symtab_hdr,
+ Elf_Internal_Sym *isym,
+ asection *sym_sec)
{
+ const char *name;
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)
+ unsigned int shindex = symtab_hdr->sh_link;
+
+ if (iname == 0 && ELF_ST_TYPE (isym->st_info) == STT_SECTION
+ /* Check for a bogus st_shndx to avoid crashing. */
+ && isym->st_shndx < elf_numsections (abfd)
+ && !(isym->st_shndx >= SHN_LORESERVE && isym->st_shndx <= SHN_HIRESERVE))
{
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);
+ name = bfd_elf_string_from_elf_section (abfd, shindex, iname);
+ if (name == NULL)
+ name = "(null)";
+ else if (sym_sec && *name == '\0')
+ name = bfd_section_name (abfd, sym_sec);
+
+ return name;
}
/* Elf_Internal_Shdr->contents is an array of these for SHT_GROUP
@@ -442,8 +477,11 @@ group_signature (bfd *abfd, Elf_Internal_Shdr *ghdr)
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))
+ /* First we need to ensure the symbol table is available. Make sure
+ that it is a symbol table section. */
+ hdr = elf_elfsections (abfd) [ghdr->sh_link];
+ if (hdr->sh_type != SHT_SYMTAB
+ || ! bfd_section_from_shdr (abfd, ghdr->sh_link))
return NULL;
/* Go read the symbol. */
@@ -452,7 +490,7 @@ group_signature (bfd *abfd, Elf_Internal_Shdr *ghdr)
&isym, esym, &eshndx) == NULL)
return NULL;
- return bfd_elf_local_sym_name (abfd, &isym);
+ return bfd_elf_sym_name (abfd, hdr, &isym, NULL);
}
/* Set next_in_group list pointer, and group name for NEWSECT. */
@@ -472,23 +510,35 @@ setup_group (bfd *abfd, Elf_Internal_Shdr *hdr, asection *newsect)
section with just a flag word (ie. sh_size is 4), ignore it. */
shnum = elf_numsections (abfd);
num_group = 0;
+
+#define IS_VALID_GROUP_SECTION_HEADER(shdr) \
+ ( (shdr)->sh_type == SHT_GROUP \
+ && (shdr)->sh_size >= (2 * GRP_ENTRY_SIZE) \
+ && (shdr)->sh_entsize == GRP_ENTRY_SIZE \
+ && ((shdr)->sh_size % GRP_ENTRY_SIZE) == 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)
+
+ if (IS_VALID_GROUP_SECTION_HEADER (shdr))
num_group += 1;
}
if (num_group == 0)
- num_group = (unsigned) -1;
- elf_tdata (abfd)->num_group = num_group;
-
- if (num_group > 0)
+ {
+ num_group = (unsigned) -1;
+ elf_tdata (abfd)->num_group = num_group;
+ }
+ else
{
/* 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);
+ bfd_size_type amt;
+
+ elf_tdata (abfd)->num_group = num_group;
+ elf_tdata (abfd)->group_sect_ptr
+ = bfd_alloc2 (abfd, num_group, sizeof (Elf_Internal_Shdr *));
if (elf_tdata (abfd)->group_sect_ptr == NULL)
return FALSE;
@@ -496,7 +546,8 @@ setup_group (bfd *abfd, Elf_Internal_Shdr *hdr, asection *newsect)
for (i = 0; i < shnum; i++)
{
Elf_Internal_Shdr *shdr = elf_elfsections (abfd)[i];
- if (shdr->sh_type == SHT_GROUP && shdr->sh_size >= 8)
+
+ if (IS_VALID_GROUP_SECTION_HEADER (shdr))
{
unsigned char *src;
Elf_Internal_Group *dest;
@@ -508,9 +559,20 @@ setup_group (bfd *abfd, Elf_Internal_Shdr *hdr, asection *newsect)
/* 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
+ shdr->contents = bfd_alloc2 (abfd, shdr->sh_size,
+ sizeof (*dest) / 4);
+ /* PR binutils/4110: Handle corrupt group headers. */
+ if (shdr->contents == NULL)
+ {
+ _bfd_error_handler
+ (_("%B: Corrupt size field in group section header: 0x%lx"), abfd, shdr->sh_size);
+ bfd_set_error (bfd_error_bad_value);
+ return FALSE;
+ }
+
+ memset (shdr->contents, 0, amt);
+
+ if (bfd_seek (abfd, shdr->sh_offset, SEEK_SET) != 0
|| (bfd_bread (shdr->contents, shdr->sh_size, abfd)
!= shdr->sh_size))
return FALSE;
@@ -539,8 +601,7 @@ setup_group (bfd *abfd, Elf_Internal_Shdr *hdr, asection *newsect)
if (idx >= shnum)
{
((*_bfd_error_handler)
- (_("%s: invalid SHT_GROUP entry"),
- bfd_archive_filename (abfd)));
+ (_("%B: invalid SHT_GROUP entry"), abfd));
idx = 0;
}
dest->shdr = elf_elfsections (abfd)[idx];
@@ -610,27 +671,105 @@ setup_group (bfd *abfd, Elf_Internal_Shdr *hdr, asection *newsect)
if (elf_group_name (newsect) == NULL)
{
- (*_bfd_error_handler) (_("%s: no group info for section %s"),
- bfd_archive_filename (abfd), newsect->name);
+ (*_bfd_error_handler) (_("%B: no group info for section %A"),
+ abfd, newsect);
}
return TRUE;
}
bfd_boolean
-bfd_elf_discard_group (bfd *abfd ATTRIBUTE_UNUSED, asection *group)
+_bfd_elf_setup_sections (bfd *abfd)
{
- asection *first = elf_next_in_group (group);
- asection *s = first;
+ unsigned int i;
+ unsigned int num_group = elf_tdata (abfd)->num_group;
+ bfd_boolean result = TRUE;
+ asection *s;
- while (s != NULL)
+ /* Process SHF_LINK_ORDER. */
+ for (s = abfd->sections; s != NULL; s = s->next)
{
- s->output_section = bfd_abs_section_ptr;
- s = elf_next_in_group (s);
- /* These lists are circular. */
- if (s == first)
- break;
+ Elf_Internal_Shdr *this_hdr = &elf_section_data (s)->this_hdr;
+ if ((this_hdr->sh_flags & SHF_LINK_ORDER) != 0)
+ {
+ unsigned int elfsec = this_hdr->sh_link;
+ /* FIXME: The old Intel compiler and old strip/objcopy may
+ not set the sh_link or sh_info fields. Hence we could
+ get the situation where elfsec is 0. */
+ if (elfsec == 0)
+ {
+ const struct elf_backend_data *bed
+ = get_elf_backend_data (abfd);
+ if (bed->link_order_error_handler)
+ bed->link_order_error_handler
+ (_("%B: warning: sh_link not set for section `%A'"),
+ abfd, s);
+ }
+ else
+ {
+ asection *link;
+
+ this_hdr = elf_elfsections (abfd)[elfsec];
+
+ /* PR 1991, 2008:
+ Some strip/objcopy may leave an incorrect value in
+ sh_link. We don't want to proceed. */
+ link = this_hdr->bfd_section;
+ if (link == NULL)
+ {
+ (*_bfd_error_handler)
+ (_("%B: sh_link [%d] in section `%A' is incorrect"),
+ s->owner, s, elfsec);
+ result = FALSE;
+ }
+
+ elf_linked_to_section (s) = link;
+ }
+ }
}
- return TRUE;
+
+ /* Process section groups. */
+ if (num_group == (unsigned) -1)
+ return result;
+
+ 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;
+
+ while (--n_elt != 0)
+ if ((++idx)->shdr->bfd_section)
+ elf_sec_group (idx->shdr->bfd_section) = shdr->bfd_section;
+ else if (idx->shdr->sh_type == SHT_RELA
+ || idx->shdr->sh_type == SHT_REL)
+ /* We won't include relocation sections in section groups in
+ output object files. We adjust the group section size here
+ so that relocatable link will work correctly when
+ relocation sections are in section group in input object
+ files. */
+ shdr->bfd_section->size -= 4;
+ else
+ {
+ /* There are some unknown sections in the group. */
+ (*_bfd_error_handler)
+ (_("%B: unknown [%d] section `%s' in group [%s]"),
+ abfd,
+ (unsigned int) idx->shdr->sh_type,
+ bfd_elf_string_from_elf_section (abfd,
+ (elf_elfheader (abfd)
+ ->e_shstrndx),
+ idx->shdr->sh_name),
+ shdr->bfd_section->name);
+ result = FALSE;
+ }
+ }
+ return result;
+}
+
+bfd_boolean
+bfd_elf_is_group_section (bfd *abfd ATTRIBUTE_UNUSED, const asection *sec)
+{
+ return elf_next_in_group (sec) != NULL;
}
/* Make a BFD section from an ELF section. We store a pointer to the
@@ -639,7 +778,8 @@ bfd_elf_discard_group (bfd *abfd ATTRIBUTE_UNUSED, asection *group)
bfd_boolean
_bfd_elf_make_section_from_shdr (bfd *abfd,
Elf_Internal_Shdr *hdr,
- const char *name)
+ const char *name,
+ int shindex)
{
asection *newsect;
flagword flags;
@@ -656,6 +796,10 @@ _bfd_elf_make_section_from_shdr (bfd *abfd,
if (newsect == NULL)
return FALSE;
+ hdr->bfd_section = newsect;
+ elf_section_data (newsect)->this_hdr = *hdr;
+ elf_section_data (newsect)->this_idx = shindex;
+
/* Always use the real type/flags. */
elf_section_type (newsect) = hdr->sh_type;
elf_section_flags (newsect) = hdr->sh_flags;
@@ -698,25 +842,45 @@ _bfd_elf_make_section_from_shdr (bfd *abfd,
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 [] =
+ if ((flags & SEC_ALLOC) == 0)
{
- ".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;
- }
+ /* The debugging sections appear to be recognized only by name,
+ not any sort of flag. Their SEC_ALLOC bits are cleared. */
+ static const struct
+ {
+ const char *name;
+ int len;
+ } debug_sections [] =
+ {
+ { STRING_COMMA_LEN ("debug") }, /* 'd' */
+ { NULL, 0 }, /* 'e' */
+ { NULL, 0 }, /* 'f' */
+ { STRING_COMMA_LEN ("gnu.linkonce.wi.") }, /* 'g' */
+ { NULL, 0 }, /* 'h' */
+ { NULL, 0 }, /* 'i' */
+ { NULL, 0 }, /* 'j' */
+ { NULL, 0 }, /* 'k' */
+ { STRING_COMMA_LEN ("line") }, /* 'l' */
+ { NULL, 0 }, /* 'm' */
+ { NULL, 0 }, /* 'n' */
+ { NULL, 0 }, /* 'o' */
+ { NULL, 0 }, /* 'p' */
+ { NULL, 0 }, /* 'q' */
+ { NULL, 0 }, /* 'r' */
+ { STRING_COMMA_LEN ("stab") } /* 's' */
+ };
+
+ if (name [0] == '.')
+ {
+ int i = name [1] - 'd';
+ if (i >= 0
+ && i < (int) ARRAY_SIZE (debug_sections)
+ && debug_sections [i].name != NULL
+ && strncmp (&name [1], debug_sections [i].name,
+ debug_sections [i].len) == 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
@@ -724,7 +888,7 @@ _bfd_elf_make_section_from_shdr (bfd *abfd,
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
+ if (CONST_STRNEQ (name, ".gnu.linkonce")
&& elf_next_in_group (newsect) == NULL)
flags |= SEC_LINK_ONCE | SEC_LINK_DUPLICATES_DISCARD;
@@ -742,8 +906,8 @@ _bfd_elf_make_section_from_shdr (bfd *abfd,
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. */
+ 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++)
{
@@ -764,9 +928,9 @@ _bfd_elf_make_section_from_shdr (bfd *abfd,
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. */
+ 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
@@ -802,9 +966,6 @@ _bfd_elf_make_section_from_shdr (bfd *abfd,
}
}
- hdr->bfd_section = newsect;
- elf_section_data (newsect)->this_hdr = *hdr;
-
return TRUE;
}
@@ -899,10 +1060,31 @@ merge_sections_remove_hook (bfd *abfd ATTRIBUTE_UNUSED,
bfd_boolean
_bfd_elf_merge_sections (bfd *abfd, struct bfd_link_info *info)
{
+ bfd *ibfd;
+ asection *sec;
+
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,
+
+ for (ibfd = info->input_bfds; ibfd != NULL; ibfd = ibfd->link_next)
+ if ((ibfd->flags & DYNAMIC) == 0)
+ for (sec = ibfd->sections; sec != NULL; sec = sec->next)
+ if ((sec->flags & SEC_MERGE) != 0
+ && !bfd_is_abs_section (sec->output_section))
+ {
+ struct bfd_elf_section_data *secdata;
+
+ secdata = elf_section_data (sec);
+ if (! _bfd_add_merge_section (abfd,
+ &elf_hash_table (info)->merge_info,
+ sec, &secdata->sec_info))
+ return FALSE;
+ else if (secdata->sec_info)
+ sec->sec_info_type = ELF_INFO_TYPE_MERGE;
+ }
+
+ if (elf_hash_table (info)->merge_info != NULL)
+ _bfd_merge_sections (abfd, info, elf_hash_table (info)->merge_info,
merge_sections_remove_hook);
return TRUE;
}
@@ -935,9 +1117,35 @@ _bfd_elf_copy_private_bfd_data (bfd *ibfd, bfd *obfd)
elf_gp (obfd) = elf_gp (ibfd);
elf_elfheader (obfd)->e_flags = elf_elfheader (ibfd)->e_flags;
elf_flags_init (obfd) = TRUE;
+
+ /* Copy object attributes. */
+ _bfd_elf_copy_obj_attributes (ibfd, obfd);
+
return TRUE;
}
+static const char *
+get_segment_type (unsigned int p_type)
+{
+ const char *pt;
+ switch (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;
+ case PT_GNU_RELRO: pt = "RELRO"; break;
+ default: pt = NULL; break;
+ }
+ return pt;
+}
+
/* Print out the program headers. */
bfd_boolean
@@ -957,22 +1165,13 @@ _bfd_elf_print_private_bfd_data (bfd *abfd, void *farg)
c = elf_elfheader (abfd)->e_phnum;
for (i = 0; i < c; i++, p++)
{
- const char *pt;
+ const char *pt = get_segment_type (p->p_type);
char buf[20];
- switch (p->p_type)
+ if (pt == NULL)
{
- 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;
+ sprintf (buf, "0x%lx", p->p_type);
+ pt = buf;
}
fprintf (f, "%8s off 0x", pt);
bfd_fprintf_vma (abfd, f, p->p_offset);
@@ -1006,10 +1205,7 @@ _bfd_elf_print_private_bfd_data (bfd *abfd, void *farg)
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))
+ if (!bfd_malloc_and_get_section (abfd, s, &dynbuf))
goto error_return;
elfsec = _bfd_elf_section_from_bfd_section (abfd, s);
@@ -1021,7 +1217,7 @@ _bfd_elf_print_private_bfd_data (bfd *abfd, void *farg)
swap_dyn_in = get_elf_backend_data (abfd)->s->swap_dyn_in;
extdyn = dynbuf;
- extdynend = extdyn + s->_raw_size;
+ extdynend = extdyn + s->size;
for (; extdyn < extdynend; extdyn += extdynsize)
{
Elf_Internal_Dyn dyn;
@@ -1099,6 +1295,7 @@ _bfd_elf_print_private_bfd_data (bfd *abfd, void *farg)
case DT_AUXILIARY: name = "AUXILIARY"; stringp = TRUE; break;
case DT_USED: name = "USED"; break;
case DT_FILTER: name = "FILTER"; stringp = TRUE; break;
+ case DT_GNU_HASH: name = "GNU_HASH"; break;
}
fprintf (f, " %-11s ", name);
@@ -1124,7 +1321,7 @@ _bfd_elf_print_private_bfd_data (bfd *abfd, void *farg)
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))
+ if (! _bfd_elf_slurp_version_tables (abfd, FALSE))
return FALSE;
}
@@ -1136,8 +1333,9 @@ _bfd_elf_print_private_bfd_data (bfd *abfd, void *farg)
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)
+ t->vd_flags, t->vd_hash,
+ t->vd_nodename ? t->vd_nodename : "<corrupt>");
+ if (t->vd_auxptr != NULL && t->vd_auxptr->vda_nextptr != NULL)
{
Elf_Internal_Verdaux *a;
@@ -1145,7 +1343,8 @@ _bfd_elf_print_private_bfd_data (bfd *abfd, void *farg)
for (a = t->vd_auxptr->vda_nextptr;
a != NULL;
a = a->vda_nextptr)
- fprintf (f, "%s ", a->vda_nodename);
+ fprintf (f, "%s ",
+ a->vda_nodename ? a->vda_nodename : "<corrupt>");
fprintf (f, "\n");
}
}
@@ -1160,10 +1359,12 @@ _bfd_elf_print_private_bfd_data (bfd *abfd, void *farg)
{
Elf_Internal_Vernaux *a;
- fprintf (f, _(" required from %s:\n"), t->vn_filename);
+ fprintf (f, _(" required from %s:\n"),
+ t->vn_filename ? t->vn_filename : "<corrupt>");
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);
+ a->vna_flags, a->vna_other,
+ a->vna_nodename ? a->vna_nodename : "<corrupt>");
}
}
@@ -1323,23 +1524,15 @@ _bfd_elf_link_hash_newfunc (struct bfd_hash_entry *entry,
/* 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;
+ ret->got = htab->init_got_refcount;
+ ret->plt = htab->init_plt_refcount;
+ memset (&ret->size, 0, (sizeof (struct elf_link_hash_entry)
+ - offsetof (struct elf_link_hash_entry, size)));
/* 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;
+ 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->non_elf = 1;
}
return entry;
@@ -1349,56 +1542,53 @@ _bfd_elf_link_hash_newfunc (struct bfd_hash_entry *entry,
old indirect symbol. Also used for copying flags to a weakdef. */
void
-_bfd_elf_link_hash_copy_indirect (const struct elf_backend_data *bed,
+_bfd_elf_link_hash_copy_indirect (struct bfd_link_info *info,
struct elf_link_hash_entry *dir,
struct elf_link_hash_entry *ind)
{
- bfd_signed_vma tmp;
- bfd_signed_vma lowest_valid = bed->can_refcount;
+ struct elf_link_hash_table *htab;
/* 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);
+ dir->ref_dynamic |= ind->ref_dynamic;
+ dir->ref_regular |= ind->ref_regular;
+ dir->ref_regular_nonweak |= ind->ref_regular_nonweak;
+ dir->non_got_ref |= ind->non_got_ref;
+ dir->needs_plt |= ind->needs_plt;
+ dir->pointer_equality_needed |= ind->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)
+ htab = elf_hash_table (info);
+ if (ind->got.refcount > htab->init_got_refcount.refcount)
{
- dir->got.refcount = ind->got.refcount;
- ind->got.refcount = tmp;
+ if (dir->got.refcount < 0)
+ dir->got.refcount = 0;
+ dir->got.refcount += ind->got.refcount;
+ ind->got.refcount = htab->init_got_refcount.refcount;
}
- else
- BFD_ASSERT (ind->got.refcount < lowest_valid);
- tmp = dir->plt.refcount;
- if (tmp < lowest_valid)
+ if (ind->plt.refcount > htab->init_plt_refcount.refcount)
{
- dir->plt.refcount = ind->plt.refcount;
- ind->plt.refcount = tmp;
+ if (dir->plt.refcount < 0)
+ dir->plt.refcount = 0;
+ dir->plt.refcount += ind->plt.refcount;
+ ind->plt.refcount = htab->init_plt_refcount.refcount;
}
- else
- BFD_ASSERT (ind->plt.refcount < lowest_valid);
- if (dir->dynindx == -1)
+ if (ind->dynindx != -1)
{
+ if (dir->dynindx != -1)
+ _bfd_elf_strtab_delref (htab->dynstr, dir->dynstr_index);
dir->dynindx = ind->dynindx;
dir->dynstr_index = ind->dynstr_index;
ind->dynindx = -1;
ind->dynstr_index = 0;
}
- else
- BFD_ASSERT (ind->dynindx == -1);
}
void
@@ -1406,11 +1596,11 @@ _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;
+ h->plt = elf_hash_table (info)->init_plt_offset;
+ h->needs_plt = 0;
if (force_local)
{
- h->elf_link_hash_flags |= ELF_LINK_FORCED_LOCAL;
+ h->forced_local = 1;
if (h->dynindx != -1)
{
h->dynindx = -1;
@@ -1428,33 +1618,21 @@ _bfd_elf_link_hash_table_init
bfd *abfd,
struct bfd_hash_entry *(*newfunc) (struct bfd_hash_entry *,
struct bfd_hash_table *,
- const char *))
+ const char *),
+ unsigned int entsize)
{
bfd_boolean ret;
+ int can_refcount = get_elf_backend_data (abfd)->can_refcount;
- 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;
+ memset (table, 0, sizeof * table);
+ table->init_got_refcount.refcount = can_refcount - 1;
+ table->init_plt_refcount.refcount = can_refcount - 1;
+ table->init_got_offset.offset = -(bfd_vma) 1;
+ table->init_plt_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);
+
+ ret = _bfd_link_hash_table_init (&table->root, abfd, newfunc, entsize);
table->root.type = bfd_link_elf_hash_table;
return ret;
@@ -1472,7 +1650,8 @@ _bfd_elf_link_hash_table_create (bfd *abfd)
if (ret == NULL)
return NULL;
- if (! _bfd_elf_link_hash_table_init (ret, abfd, _bfd_elf_link_hash_newfunc))
+ if (! _bfd_elf_link_hash_table_init (ret, abfd, _bfd_elf_link_hash_newfunc,
+ sizeof (struct elf_link_hash_entry)))
{
free (ret);
return NULL;
@@ -1493,8 +1672,20 @@ bfd_elf_set_dt_needed_name (bfd *abfd, const char *name)
elf_dt_name (abfd) = name;
}
+int
+bfd_elf_get_dyn_lib_class (bfd *abfd)
+{
+ int lib_class;
+ if (bfd_get_flavour (abfd) == bfd_target_elf_flavour
+ && bfd_get_format (abfd) == bfd_object)
+ lib_class = elf_dyn_lib_class (abfd);
+ else
+ lib_class = 0;
+ return lib_class;
+}
+
void
-bfd_elf_set_dyn_lib_class (bfd *abfd, int lib_class)
+bfd_elf_set_dyn_lib_class (bfd *abfd, enum dynamic_lib_link_class lib_class)
{
if (bfd_get_flavour (abfd) == bfd_target_elf_flavour
&& bfd_get_format (abfd) == bfd_object)
@@ -1560,14 +1751,10 @@ bfd_elf_get_bfd_needed_list (bfd *abfd,
return TRUE;
s = bfd_get_section_by_name (abfd, ".dynamic");
- if (s == NULL || s->_raw_size == 0)
+ if (s == NULL || s->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))
+ if (!bfd_malloc_and_get_section (abfd, s, &dynbuf))
goto error_return;
elfsec = _bfd_elf_section_from_bfd_section (abfd, s);
@@ -1580,7 +1767,7 @@ bfd_elf_get_bfd_needed_list (bfd *abfd,
swap_dyn_in = get_elf_backend_data (abfd)->s->swap_dyn_in;
extdyn = dynbuf;
- extdynend = extdyn + s->_raw_size;
+ extdynend = extdyn + s->size;
for (; extdyn < extdynend; extdyn += extdynsize)
{
Elf_Internal_Dyn dyn;
@@ -1658,7 +1845,11 @@ bfd_section_from_shdr (bfd *abfd, unsigned int shindex)
const struct elf_backend_data *bed = get_elf_backend_data (abfd);
const char *name;
- name = elf_string_from_elf_strtab (abfd, hdr->sh_name);
+ name = bfd_elf_string_from_elf_section (abfd,
+ elf_elfheader (abfd)->e_shstrndx,
+ hdr->sh_name);
+ if (name == NULL)
+ return FALSE;
switch (hdr->sh_type)
{
@@ -1673,10 +1864,15 @@ bfd_section_from_shdr (bfd *abfd, unsigned int shindex)
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_GNU_LIBLIST: /* .gnu.liblist section. */
+ case SHT_GNU_HASH: /* .gnu.hash section. */
+ return _bfd_elf_make_section_from_shdr (abfd, hdr, name, shindex);
case SHT_DYNAMIC: /* Dynamic linking information. */
- if (! _bfd_elf_make_section_from_shdr (abfd, hdr, name))
+ if (! _bfd_elf_make_section_from_shdr (abfd, hdr, name, shindex))
+ return FALSE;
+ if (hdr->sh_link > elf_numsections (abfd)
+ || elf_elfsections (abfd)[hdr->sh_link] == NULL)
return FALSE;
if (elf_elfsections (abfd)[hdr->sh_link]->sh_type != SHT_STRTAB)
{
@@ -1712,7 +1908,8 @@ bfd_section_from_shdr (bfd *abfd, unsigned int shindex)
if (elf_onesymtab (abfd) == shindex)
return TRUE;
- BFD_ASSERT (hdr->sh_entsize == bed->s->sizeof_sym);
+ if (hdr->sh_entsize != bed->s->sizeof_sym)
+ return FALSE;
BFD_ASSERT (elf_onesymtab (abfd) == 0);
elf_onesymtab (abfd) = shindex;
elf_tdata (abfd)->symtab_hdr = *hdr;
@@ -1720,23 +1917,51 @@ bfd_section_from_shdr (bfd *abfd, unsigned int shindex)
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. */
+ 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))
+ && ! _bfd_elf_make_section_from_shdr (abfd, hdr, name,
+ shindex))
return FALSE;
+ /* Go looking for SHT_SYMTAB_SHNDX too, since if there is one we
+ can't read symbols without that section loaded as well. It
+ is most likely specified by the next section header. */
+ if (elf_elfsections (abfd)[elf_symtab_shndx (abfd)]->sh_link != shindex)
+ {
+ unsigned int i, num_sec;
+
+ num_sec = elf_numsections (abfd);
+ for (i = shindex + 1; i < num_sec; i++)
+ {
+ Elf_Internal_Shdr *hdr2 = elf_elfsections (abfd)[i];
+ if (hdr2->sh_type == SHT_SYMTAB_SHNDX
+ && hdr2->sh_link == shindex)
+ break;
+ }
+ if (i == num_sec)
+ for (i = 1; i < shindex; i++)
+ {
+ Elf_Internal_Shdr *hdr2 = elf_elfsections (abfd)[i];
+ if (hdr2->sh_type == SHT_SYMTAB_SHNDX
+ && hdr2->sh_link == shindex)
+ break;
+ }
+ if (i != shindex)
+ return bfd_section_from_shdr (abfd, i);
+ }
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);
+ if (hdr->sh_entsize != bed->s->sizeof_sym)
+ return FALSE;
BFD_ASSERT (elf_dynsymtab (abfd) == 0);
elf_dynsymtab (abfd) = shindex;
elf_tdata (abfd)->dynsymtab_hdr = *hdr;
@@ -1745,17 +1970,13 @@ bfd_section_from_shdr (bfd *abfd, unsigned int shindex)
/* 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);
+ return _bfd_elf_make_section_from_shdr (abfd, hdr, name, shindex);
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;
-
+ BFD_ASSERT (elf_symtab_shndx (abfd) == 0);
elf_symtab_shndx (abfd) = shindex;
elf_tdata (abfd)->symtab_shndx_hdr = *hdr;
elf_elfsections (abfd)[shindex] = &elf_tdata (abfd)->symtab_shndx_hdr;
@@ -1770,49 +1991,51 @@ bfd_section_from_shdr (bfd *abfd, unsigned int shindex)
elf_elfsections (abfd)[shindex] = &elf_tdata (abfd)->shstrtab_hdr;
return TRUE;
}
- {
- unsigned int i, num_sec;
+ if (elf_elfsections (abfd)[elf_onesymtab (abfd)]->sh_link == shindex)
+ {
+ symtab_strtab:
+ elf_tdata (abfd)->strtab_hdr = *hdr;
+ elf_elfsections (abfd)[shindex] = &elf_tdata (abfd)->strtab_hdr;
+ return TRUE;
+ }
+ if (elf_elfsections (abfd)[elf_dynsymtab (abfd)]->sh_link == shindex)
+ {
+ dynsymtab_strtab:
+ elf_tdata (abfd)->dynstrtab_hdr = *hdr;
+ hdr = &elf_tdata (abfd)->dynstrtab_hdr;
+ elf_elfsections (abfd)[shindex] = hdr;
+ /* We also treat this as a regular section, so that objcopy
+ can handle it. */
+ return _bfd_elf_make_section_from_shdr (abfd, hdr, name,
+ shindex);
+ }
- 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
- }
- }
- }
+ /* If the string table isn't one of the above, then treat it as a
+ regular section. We need to scan all the headers to be sure,
+ just in case this strtab section appeared before the above. */
+ if (elf_onesymtab (abfd) == 0 || elf_dynsymtab (abfd) == 0)
+ {
+ unsigned int i, num_sec;
- return _bfd_elf_make_section_from_shdr (abfd, hdr, name);
+ 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)
+ {
+ /* Prevent endless recursion on broken objects. */
+ if (i == shindex)
+ return FALSE;
+ if (! bfd_section_from_shdr (abfd, i))
+ return FALSE;
+ if (elf_onesymtab (abfd) == i)
+ goto symtab_strtab;
+ if (elf_dynsymtab (abfd) == i)
+ goto dynsymtab_strtab;
+ }
+ }
+ }
+ return _bfd_elf_make_section_from_shdr (abfd, hdr, name, shindex);
case SHT_REL:
case SHT_RELA:
@@ -1822,14 +2045,20 @@ bfd_section_from_shdr (bfd *abfd, unsigned int shindex)
Elf_Internal_Shdr *hdr2;
unsigned int num_sec = elf_numsections (abfd);
+ if (hdr->sh_entsize
+ != (bfd_size_type) (hdr->sh_type == SHT_REL
+ ? bed->s->sizeof_rel : bed->s->sizeof_rela))
+ return FALSE;
+
/* 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);
+ (_("%B: invalid link %lu for reloc section %s (index %u)"),
+ abfd, hdr->sh_link, name, shindex));
+ return _bfd_elf_make_section_from_shdr (abfd, hdr, name,
+ shindex);
}
/* For some incomprehensible reason Oracle distributes
@@ -1864,7 +2093,8 @@ bfd_section_from_shdr (bfd *abfd, unsigned int shindex)
}
/* Get the symbol table. */
- if (elf_elfsections (abfd)[hdr->sh_link]->sh_type == SHT_SYMTAB
+ if ((elf_elfsections (abfd)[hdr->sh_link]->sh_type == SHT_SYMTAB
+ || elf_elfsections (abfd)[hdr->sh_link]->sh_type == SHT_DYNSYM)
&& ! bfd_section_from_shdr (abfd, hdr->sh_link))
return FALSE;
@@ -1873,9 +2103,15 @@ bfd_section_from_shdr (bfd *abfd, unsigned int shindex)
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);
+ section, an invalid section, or another reloc section. */
+ if (hdr->sh_link != elf_onesymtab (abfd)
+ || hdr->sh_info == SHN_UNDEF
+ || (hdr->sh_info >= SHN_LORESERVE && hdr->sh_info <= SHN_HIRESERVE)
+ || hdr->sh_info >= num_sec
+ || elf_elfsections (abfd)[hdr->sh_info]->sh_type == SHT_REL
+ || elf_elfsections (abfd)[hdr->sh_info]->sh_type == SHT_RELA)
+ return _bfd_elf_make_section_from_shdr (abfd, hdr, name,
+ shindex);
if (! bfd_section_from_shdr (abfd, hdr->sh_info))
return FALSE;
@@ -1907,25 +2143,23 @@ bfd_section_from_shdr (bfd *abfd, unsigned int shindex)
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;
+ return _bfd_elf_make_section_from_shdr (abfd, hdr, name, shindex);
case SHT_GNU_versym:
+ if (hdr->sh_entsize != sizeof (Elf_External_Versym))
+ return FALSE;
elf_dynversym (abfd) = shindex;
elf_tdata (abfd)->dynversym_hdr = *hdr;
- return _bfd_elf_make_section_from_shdr (abfd, hdr, name);
- break;
+ return _bfd_elf_make_section_from_shdr (abfd, hdr, name, shindex);
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;
+ return _bfd_elf_make_section_from_shdr (abfd, hdr, name, shindex);
case SHT_SHLIB:
return TRUE;
@@ -1934,38 +2168,98 @@ bfd_section_from_shdr (bfd *abfd, unsigned int shindex)
/* We need a BFD section for objcopy and relocatable linking,
and it's handy to have the signature available as the section
name. */
+ if (! IS_VALID_GROUP_SECTION_HEADER (hdr))
+ return FALSE;
name = group_signature (abfd, hdr);
if (name == NULL)
return FALSE;
- if (!_bfd_elf_make_section_from_shdr (abfd, hdr, name))
+ if (!_bfd_elf_make_section_from_shdr (abfd, hdr, name, shindex))
return FALSE;
if (hdr->contents != NULL)
{
Elf_Internal_Group *idx = (Elf_Internal_Group *) hdr->contents;
- unsigned int n_elt = hdr->sh_size / 4;
+ unsigned int n_elt = hdr->sh_size / GRP_ENTRY_SIZE;
asection *s;
if (idx->flags & GRP_COMDAT)
hdr->bfd_section->flags
|= SEC_LINK_ONCE | SEC_LINK_DUPLICATES_DISCARD;
+ /* We try to keep the same section order as it comes in. */
+ idx += n_elt;
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;
- }
+ {
+ --idx;
+
+ if (idx->shdr != NULL
+ && (s = idx->shdr->bfd_section) != NULL
+ && elf_next_in_group (s) != NULL)
+ {
+ elf_next_in_group (hdr->bfd_section) = s;
+ break;
+ }
+ }
}
break;
default:
+ /* Possibly an attributes section. */
+ if (hdr->sh_type == SHT_GNU_ATTRIBUTES
+ || hdr->sh_type == bed->obj_attrs_section_type)
+ {
+ if (! _bfd_elf_make_section_from_shdr (abfd, hdr, name, shindex))
+ return FALSE;
+ _bfd_elf_parse_attributes (abfd, hdr);
+ return TRUE;
+ }
+
/* Check for any processor-specific section types. */
- {
- if (bed->elf_backend_section_from_shdr)
- (*bed->elf_backend_section_from_shdr) (abfd, hdr, name);
- }
- break;
+ if (bed->elf_backend_section_from_shdr (abfd, hdr, name, shindex))
+ return TRUE;
+
+ if (hdr->sh_type >= SHT_LOUSER && hdr->sh_type <= SHT_HIUSER)
+ {
+ if ((hdr->sh_flags & SHF_ALLOC) != 0)
+ /* FIXME: How to properly handle allocated section reserved
+ for applications? */
+ (*_bfd_error_handler)
+ (_("%B: don't know how to handle allocated, application "
+ "specific section `%s' [0x%8x]"),
+ abfd, name, hdr->sh_type);
+ else
+ /* Allow sections reserved for applications. */
+ return _bfd_elf_make_section_from_shdr (abfd, hdr, name,
+ shindex);
+ }
+ else if (hdr->sh_type >= SHT_LOPROC
+ && hdr->sh_type <= SHT_HIPROC)
+ /* FIXME: We should handle this section. */
+ (*_bfd_error_handler)
+ (_("%B: don't know how to handle processor specific section "
+ "`%s' [0x%8x]"),
+ abfd, name, hdr->sh_type);
+ else if (hdr->sh_type >= SHT_LOOS && hdr->sh_type <= SHT_HIOS)
+ {
+ /* Unrecognised OS-specific sections. */
+ if ((hdr->sh_flags & SHF_OS_NONCONFORMING) != 0)
+ /* SHF_OS_NONCONFORMING indicates that special knowledge is
+ required to correctly process the section and the file should
+ be rejected with an error message. */
+ (*_bfd_error_handler)
+ (_("%B: don't know how to handle OS specific section "
+ "`%s' [0x%8x]"),
+ abfd, name, hdr->sh_type);
+ else
+ /* Otherwise it should be processed. */
+ return _bfd_elf_make_section_from_shdr (abfd, hdr, name, shindex);
+ }
+ else
+ /* FIXME: We should handle this section. */
+ (*_bfd_error_handler)
+ (_("%B: don't know how to handle section `%s' [0x%8x]"),
+ abfd, name, hdr->sh_type);
+
+ return FALSE;
}
return TRUE;
@@ -2023,67 +2317,159 @@ bfd_section_from_elf_index (bfd *abfd, unsigned int index)
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 special_sections_b[] =
+{
+ { STRING_COMMA_LEN (".bss"), -2, SHT_NOBITS, SHF_ALLOC + SHF_WRITE },
+ { NULL, 0, 0, 0, 0 }
+};
+
+static const struct bfd_elf_special_section special_sections_c[] =
+{
+ { STRING_COMMA_LEN (".comment"), 0, SHT_PROGBITS, 0 },
+ { NULL, 0, 0, 0, 0 }
+};
+
+static const struct bfd_elf_special_section special_sections_d[] =
+{
+ { STRING_COMMA_LEN (".data"), -2, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE },
+ { STRING_COMMA_LEN (".data1"), 0, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE },
+ { STRING_COMMA_LEN (".debug"), 0, SHT_PROGBITS, 0 },
+ { STRING_COMMA_LEN (".debug_line"), 0, SHT_PROGBITS, 0 },
+ { STRING_COMMA_LEN (".debug_info"), 0, SHT_PROGBITS, 0 },
+ { STRING_COMMA_LEN (".debug_abbrev"), 0, SHT_PROGBITS, 0 },
+ { STRING_COMMA_LEN (".debug_aranges"), 0, SHT_PROGBITS, 0 },
+ { STRING_COMMA_LEN (".dynamic"), 0, SHT_DYNAMIC, SHF_ALLOC },
+ { STRING_COMMA_LEN (".dynstr"), 0, SHT_STRTAB, SHF_ALLOC },
+ { STRING_COMMA_LEN (".dynsym"), 0, SHT_DYNSYM, SHF_ALLOC },
+ { NULL, 0, 0, 0, 0 }
+};
+
+static const struct bfd_elf_special_section special_sections_f[] =
+{
+ { STRING_COMMA_LEN (".fini"), 0, SHT_PROGBITS, SHF_ALLOC + SHF_EXECINSTR },
+ { STRING_COMMA_LEN (".fini_array"), 0, SHT_FINI_ARRAY, SHF_ALLOC + SHF_WRITE },
+ { NULL, 0, 0, 0, 0 }
+};
+
+static const struct bfd_elf_special_section special_sections_g[] =
+{
+ { STRING_COMMA_LEN (".gnu.linkonce.b"), -2, SHT_NOBITS, SHF_ALLOC + SHF_WRITE },
+ { STRING_COMMA_LEN (".got"), 0, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE },
+ { STRING_COMMA_LEN (".gnu.version"), 0, SHT_GNU_versym, 0 },
+ { STRING_COMMA_LEN (".gnu.version_d"), 0, SHT_GNU_verdef, 0 },
+ { STRING_COMMA_LEN (".gnu.version_r"), 0, SHT_GNU_verneed, 0 },
+ { STRING_COMMA_LEN (".gnu.liblist"), 0, SHT_GNU_LIBLIST, SHF_ALLOC },
+ { STRING_COMMA_LEN (".gnu.conflict"), 0, SHT_RELA, SHF_ALLOC },
+ { STRING_COMMA_LEN (".gnu.hash"), 0, SHT_GNU_HASH, SHF_ALLOC },
+ { 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)
+static const struct bfd_elf_special_section special_sections_h[] =
+{
+ { STRING_COMMA_LEN (".hash"), 0, SHT_HASH, SHF_ALLOC },
+ { NULL, 0, 0, 0, 0 }
+};
+
+static const struct bfd_elf_special_section special_sections_i[] =
+{
+ { STRING_COMMA_LEN (".init"), 0, SHT_PROGBITS, SHF_ALLOC + SHF_EXECINSTR },
+ { STRING_COMMA_LEN (".init_array"), 0, SHT_INIT_ARRAY, SHF_ALLOC + SHF_WRITE },
+ { STRING_COMMA_LEN (".interp"), 0, SHT_PROGBITS, 0 },
+ { NULL, 0, 0, 0, 0 }
+};
+
+static const struct bfd_elf_special_section special_sections_l[] =
+{
+ { STRING_COMMA_LEN (".line"), 0, SHT_PROGBITS, 0 },
+ { NULL, 0, 0, 0, 0 }
+};
+
+static const struct bfd_elf_special_section special_sections_n[] =
+{
+ { STRING_COMMA_LEN (".note.GNU-stack"), 0, SHT_PROGBITS, 0 },
+ { STRING_COMMA_LEN (".note"), -1, SHT_NOTE, 0 },
+ { NULL, 0, 0, 0, 0 }
+};
+
+static const struct bfd_elf_special_section special_sections_p[] =
+{
+ { STRING_COMMA_LEN (".preinit_array"), 0, SHT_PREINIT_ARRAY, SHF_ALLOC + SHF_WRITE },
+ { STRING_COMMA_LEN (".plt"), 0, SHT_PROGBITS, SHF_ALLOC + SHF_EXECINSTR },
+ { NULL, 0, 0, 0, 0 }
+};
+
+static const struct bfd_elf_special_section special_sections_r[] =
+{
+ { STRING_COMMA_LEN (".rodata"), -2, SHT_PROGBITS, SHF_ALLOC },
+ { STRING_COMMA_LEN (".rodata1"), 0, SHT_PROGBITS, SHF_ALLOC },
+ { STRING_COMMA_LEN (".rela"), -1, SHT_RELA, 0 },
+ { STRING_COMMA_LEN (".rel"), -1, SHT_REL, 0 },
+ { NULL, 0, 0, 0, 0 }
+};
+
+static const struct bfd_elf_special_section special_sections_s[] =
+{
+ { STRING_COMMA_LEN (".shstrtab"), 0, SHT_STRTAB, 0 },
+ { STRING_COMMA_LEN (".strtab"), 0, SHT_STRTAB, 0 },
+ { STRING_COMMA_LEN (".symtab"), 0, SHT_SYMTAB, 0 },
+ /* See struct bfd_elf_special_section declaration for the semantics of
+ this special case where .prefix_length != strlen (.prefix). */
+ { ".stabstr", 5, 3, SHT_STRTAB, 0 },
+ { NULL, 0, 0, 0, 0 }
+};
+
+static const struct bfd_elf_special_section special_sections_t[] =
+{
+ { STRING_COMMA_LEN (".text"), -2, SHT_PROGBITS, SHF_ALLOC + SHF_EXECINSTR },
+ { STRING_COMMA_LEN (".tbss"), -2, SHT_NOBITS, SHF_ALLOC + SHF_WRITE + SHF_TLS },
+ { STRING_COMMA_LEN (".tdata"), -2, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE + SHF_TLS },
+ { NULL, 0, 0, 0, 0 }
+};
+
+static const struct bfd_elf_special_section *special_sections[] =
+{
+ special_sections_b, /* 'b' */
+ special_sections_c, /* 'b' */
+ special_sections_d, /* 'd' */
+ NULL, /* 'e' */
+ special_sections_f, /* 'f' */
+ special_sections_g, /* 'g' */
+ special_sections_h, /* 'h' */
+ special_sections_i, /* 'i' */
+ NULL, /* 'j' */
+ NULL, /* 'k' */
+ special_sections_l, /* 'l' */
+ NULL, /* 'm' */
+ special_sections_n, /* 'n' */
+ NULL, /* 'o' */
+ special_sections_p, /* 'p' */
+ NULL, /* 'q' */
+ special_sections_r, /* 'r' */
+ special_sections_s, /* 's' */
+ special_sections_t, /* 't' */
+};
+
+const struct bfd_elf_special_section *
+_bfd_elf_get_special_section (const char *name,
+ const struct bfd_elf_special_section *spec,
+ unsigned int rela)
{
int i;
- int len = strlen (name);
+ int len;
- for (i = 0; special_sections[i].prefix != NULL; i++)
+ len = strlen (name);
+
+ for (i = 0; spec[i].prefix != NULL; i++)
{
int suffix_len;
- int prefix_len = special_sections[i].prefix_length;
+ int prefix_len = spec[i].prefix_length;
if (len < prefix_len)
continue;
- if (memcmp (name, special_sections[i].prefix, prefix_len) != 0)
+ if (memcmp (name, spec[i].prefix, prefix_len) != 0)
continue;
- suffix_len = special_sections[i].suffix_length;
+ suffix_len = spec[i].suffix_length;
if (suffix_len <= 0)
{
if (name[prefix_len] != 0)
@@ -2092,7 +2478,7 @@ get_special_section (const char *name,
continue;
if (name[prefix_len] != '.'
&& (suffix_len == -2
- || (rela && special_sections[i].type == SHT_REL)))
+ || (rela && spec[i].type == SHT_REL)))
continue;
}
}
@@ -2101,41 +2487,58 @@ get_special_section (const char *name,
if (len < prefix_len + suffix_len)
continue;
if (memcmp (name + len - suffix_len,
- special_sections[i].prefix + prefix_len,
+ spec[i].prefix + prefix_len,
suffix_len) != 0)
continue;
}
- return &special_sections[i];
+ return &spec[i];
}
return NULL;
}
const struct bfd_elf_special_section *
-_bfd_elf_get_sec_type_attr (bfd *abfd, const char *name)
+_bfd_elf_get_sec_type_attr (bfd *abfd, asection *sec)
{
- const struct elf_backend_data *bed = get_elf_backend_data (abfd);
- const struct bfd_elf_special_section *ssect = NULL;
+ int i;
+ const struct bfd_elf_special_section *spec;
+ const struct elf_backend_data *bed;
/* See if this is one of the special sections. */
- if (name)
+ if (sec->name == NULL)
+ return NULL;
+
+ bed = get_elf_backend_data (abfd);
+ spec = bed->special_sections;
+ if (spec)
{
- unsigned int rela = bed->default_use_rela_p;
+ spec = _bfd_elf_get_special_section (sec->name,
+ bed->special_sections,
+ sec->use_rela_p);
+ if (spec != NULL)
+ return spec;
+ }
- if (bed->special_sections)
- ssect = get_special_section (name, bed->special_sections, rela);
+ if (sec->name[0] != '.')
+ return NULL;
- if (! ssect)
- ssect = get_special_section (name, special_sections, rela);
- }
+ i = sec->name[1] - 'b';
+ if (i < 0 || i > 't' - 'b')
+ return NULL;
- return ssect;
+ spec = special_sections[i];
+
+ if (spec == NULL)
+ return NULL;
+
+ return _bfd_elf_get_special_section (sec->name, spec, sec->use_rela_p);
}
bfd_boolean
_bfd_elf_new_section_hook (bfd *abfd, asection *sec)
{
struct bfd_elf_section_data *sdata;
+ const struct elf_backend_data *bed;
const struct bfd_elf_special_section *ssect;
sdata = (struct bfd_elf_section_data *) sec->used_by_bfd;
@@ -2147,18 +2550,28 @@ _bfd_elf_new_section_hook (bfd *abfd, asection *sec)
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;
+ bed = get_elf_backend_data (abfd);
+ sec->use_rela_p = bed->default_use_rela_p;
+
+ /* When we read a file, we don't need to set ELF section type and
+ flags. They will be overridden in _bfd_elf_make_section_from_shdr
+ anyway. We will set ELF section type and flags for all linker
+ created sections. If user specifies BFD section flags, we will
+ set ELF section type and flags based on BFD section flags in
+ elf_fake_sections. */
+ if ((!sec->flags && abfd->direction != read_direction)
+ || (sec->flags & SEC_LINKER_CREATED) != 0)
+ {
+ ssect = (*bed->get_sec_type_attr) (abfd, sec);
+ if (ssect != NULL)
+ {
+ elf_section_type (sec) = ssect->type;
+ elf_section_flags (sec) = ssect->attr;
+ }
+ }
- return TRUE;
+ return _bfd_generic_new_section_hook (abfd, sec);
}
/* Create a new bfd section from an ELF program header.
@@ -2209,7 +2622,7 @@ _bfd_elf_make_section_from_phdr (bfd *abfd,
return FALSE;
newsect->vma = hdr->p_vaddr;
newsect->lma = hdr->p_paddr;
- newsect->_raw_size = hdr->p_filesz;
+ newsect->size = hdr->p_filesz;
newsect->filepos = hdr->p_offset;
newsect->flags |= SEC_HAS_CONTENTS;
newsect->alignment_power = bfd_log2 (hdr->p_align);
@@ -2242,7 +2655,7 @@ _bfd_elf_make_section_from_phdr (bfd *abfd,
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;
+ newsect->size = hdr->p_memsz - hdr->p_filesz;
if (hdr->p_type == PT_LOAD)
{
newsect->flags |= SEC_ALLOC;
@@ -2295,14 +2708,13 @@ bfd_section_from_phdr (bfd *abfd, Elf_Internal_Phdr *hdr, int index)
case PT_GNU_STACK:
return _bfd_elf_make_section_from_phdr (abfd, hdr, index, "stack");
+ case PT_GNU_RELRO:
+ return _bfd_elf_make_section_from_phdr (abfd, hdr, index, "relro");
+
default:
- /* Check for any processor-specific program segment types.
- If no handler for them, default to making "segment" sections. */
+ /* Check for any processor-specific program segment types. */
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");
+ return bed->elf_backend_section_from_phdr (abfd, hdr, index, "proc");
}
}
@@ -2350,11 +2762,12 @@ 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;
+ unsigned int sh_type;
if (*failedptr)
{
/* We already failed; just get out of the bfd_map_over_sections
- loop. */
+ loop. */
return;
}
@@ -2368,7 +2781,7 @@ elf_fake_sections (bfd *abfd, asection *asect, void *failedptrarg)
return;
}
- this_hdr->sh_flags = 0;
+ /* Don't clear sh_flags. Assembler may set additional bits. */
if ((asect->flags & SEC_ALLOC) != 0
|| asect->user_set_vma)
@@ -2377,7 +2790,7 @@ elf_fake_sections (bfd *abfd, asection *asect, void *failedptrarg)
this_hdr->sh_addr = 0;
this_hdr->sh_offset = 0;
- this_hdr->sh_size = asect->_raw_size;
+ this_hdr->sh_size = asect->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
@@ -2390,9 +2803,11 @@ elf_fake_sections (bfd *abfd, asection *asect, void *failedptrarg)
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))
+ if ((asect->flags & SEC_GROUP) != 0)
+ this_hdr->sh_type = SHT_GROUP;
+ else 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;
@@ -2441,8 +2856,8 @@ elf_fake_sections (bfd *abfd, asection *asect, void *failedptrarg)
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. */
+ 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
@@ -2453,8 +2868,8 @@ elf_fake_sections (bfd *abfd, asection *asect, void *failedptrarg)
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. */
+ 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
@@ -2463,7 +2878,11 @@ elf_fake_sections (bfd *abfd, asection *asect, void *failedptrarg)
break;
case SHT_GROUP:
- this_hdr->sh_entsize = 4;
+ this_hdr->sh_entsize = GRP_ENTRY_SIZE;
+ break;
+
+ case SHT_GNU_HASH:
+ this_hdr->sh_entsize = bed->s->arch_size == 64 ? 0 : 4;
break;
}
@@ -2485,24 +2904,34 @@ elf_fake_sections (bfd *abfd, asection *asect, void *failedptrarg)
if ((asect->flags & SEC_THREAD_LOCAL) != 0)
{
this_hdr->sh_flags |= SHF_TLS;
- if (asect->_raw_size == 0 && (asect->flags & SEC_HAS_CONTENTS) == 0)
+ if (asect->size == 0
+ && (asect->flags & SEC_HAS_CONTENTS) == 0)
{
- struct bfd_link_order *o;
+ struct bfd_link_order *o = asect->map_tail.link_order;
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)
+ if (o != NULL)
+ {
this_hdr->sh_size = o->offset + o->size;
- if (this_hdr->sh_size)
- this_hdr->sh_type = SHT_NOBITS;
+ if (this_hdr->sh_size != 0)
+ this_hdr->sh_type = SHT_NOBITS;
+ }
}
}
/* Check for processor-specific section types. */
+ sh_type = this_hdr->sh_type;
if (bed->elf_backend_fake_sections
&& !(*bed->elf_backend_fake_sections) (abfd, this_hdr, asect))
*failedptr = TRUE;
+ if (sh_type == SHT_NOBITS && asect->size != 0)
+ {
+ /* Don't change the header type from NOBITS if we are being
+ called for objcopy --only-keep-debug. */
+ this_hdr->sh_type = sh_type;
+ }
+
/* 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
@@ -2524,10 +2953,11 @@ bfd_elf_set_group_contents (bfd *abfd, asection *sec, void *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
+ /* Ignore linker created group section. See elfNN_ia64_object_p in
+ elfxx-ia64.c. */
+ if (((sec->flags & (SEC_GROUP | SEC_LINKER_CREATED)) != SEC_GROUP)
|| *failedptr)
return;
@@ -2551,7 +2981,7 @@ bfd_elf_set_group_contents (bfd *abfd, asection *sec, void *failedptrarg)
if (sec->contents == NULL)
{
gas = FALSE;
- sec->contents = bfd_alloc (abfd, sec->_raw_size);
+ sec->contents = bfd_alloc (abfd, sec->size);
/* Arrange for the section to be written out. */
elf_section_data (sec)->this_hdr.contents = sec->contents;
@@ -2562,7 +2992,7 @@ bfd_elf_set_group_contents (bfd *abfd, asection *sec, void *failedptrarg)
}
}
- loc = sec->contents + sec->_raw_size;
+ loc = sec->contents + sec->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
@@ -2591,29 +3021,7 @@ bfd_elf_set_group_contents (bfd *abfd, asection *sec, void *failedptrarg)
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)
+ if ((loc -= 4) != sec->contents)
abort ();
H_PUT_32 (abfd, sec->flags & SEC_LINK_ONCE ? GRP_COMDAT : 0, loc);
@@ -2624,25 +3032,54 @@ bfd_elf_set_group_contents (bfd *abfd, asection *sec, void *failedptrarg)
in here too, while we're at it. */
static bfd_boolean
-assign_section_numbers (bfd *abfd)
+assign_section_numbers (bfd *abfd, struct bfd_link_info *link_info)
{
struct elf_obj_tdata *t = elf_tdata (abfd);
asection *sec;
unsigned int section_number, secn;
Elf_Internal_Shdr **i_shdrp;
- bfd_size_type amt;
+ struct bfd_elf_section_data *d;
section_number = 1;
_bfd_elf_strtab_clear_all_refs (elf_shstrtab (abfd));
+ /* SHT_GROUP sections are in relocatable files only. */
+ if (link_info == NULL || link_info->relocatable)
+ {
+ /* Put SHT_GROUP sections first. */
+ for (sec = abfd->sections; sec != NULL; sec = sec->next)
+ {
+ d = elf_section_data (sec);
+
+ if (d->this_hdr.sh_type == SHT_GROUP)
+ {
+ if (sec->flags & SEC_LINKER_CREATED)
+ {
+ /* Remove the linker created SHT_GROUP sections. */
+ bfd_section_list_remove (abfd, sec);
+ abfd->section_count--;
+ }
+ else
+ {
+ if (section_number == SHN_LORESERVE)
+ section_number += SHN_HIRESERVE + 1 - SHN_LORESERVE;
+ d->this_idx = section_number++;
+ }
+ }
+ }
+ }
+
for (sec = abfd->sections; sec; sec = sec->next)
{
- struct bfd_elf_section_data *d = elf_section_data (sec);
+ d = elf_section_data (sec);
- if (section_number == SHN_LORESERVE)
- section_number += SHN_HIRESERVE + 1 - SHN_LORESERVE;
- d->this_idx = section_number++;
+ if (d->this_hdr.sh_type != SHT_GROUP)
+ {
+ 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;
@@ -2704,13 +3141,11 @@ assign_section_numbers (bfd *abfd)
/* 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);
+ i_shdrp = bfd_zalloc2 (abfd, section_number, sizeof (Elf_Internal_Shdr *));
if (i_shdrp == NULL)
return FALSE;
- amt = sizeof (Elf_Internal_Shdr);
- i_shdrp[0] = bfd_zalloc (abfd, amt);
+ i_shdrp[0] = bfd_zalloc (abfd, sizeof (Elf_Internal_Shdr));
if (i_shdrp[0] == NULL)
{
bfd_release (abfd, i_shdrp);
@@ -2731,6 +3166,7 @@ assign_section_numbers (bfd *abfd)
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);
@@ -2759,6 +3195,68 @@ assign_section_numbers (bfd *abfd)
d->rel_hdr2->sh_info = d->this_idx;
}
+ /* We need to set up sh_link for SHF_LINK_ORDER. */
+ if ((d->this_hdr.sh_flags & SHF_LINK_ORDER) != 0)
+ {
+ s = elf_linked_to_section (sec);
+ if (s)
+ {
+ /* elf_linked_to_section points to the input section. */
+ if (link_info != NULL)
+ {
+ /* Check discarded linkonce section. */
+ if (elf_discarded_section (s))
+ {
+ asection *kept;
+ (*_bfd_error_handler)
+ (_("%B: sh_link of section `%A' points to discarded section `%A' of `%B'"),
+ abfd, d->this_hdr.bfd_section,
+ s, s->owner);
+ /* Point to the kept section if it has the same
+ size as the discarded one. */
+ kept = _bfd_elf_check_kept_section (s, link_info);
+ if (kept == NULL)
+ {
+ bfd_set_error (bfd_error_bad_value);
+ return FALSE;
+ }
+ s = kept;
+ }
+
+ s = s->output_section;
+ BFD_ASSERT (s != NULL);
+ }
+ else
+ {
+ /* Handle objcopy. */
+ if (s->output_section == NULL)
+ {
+ (*_bfd_error_handler)
+ (_("%B: sh_link of section `%A' points to removed section `%A' of `%B'"),
+ abfd, d->this_hdr.bfd_section, s, s->owner);
+ bfd_set_error (bfd_error_bad_value);
+ return FALSE;
+ }
+ s = s->output_section;
+ }
+ d->this_hdr.sh_link = elf_section_data (s)->this_idx;
+ }
+ else
+ {
+ /* PR 290:
+ The Intel C compiler generates SHT_IA_64_UNWIND with
+ SHF_LINK_ORDER. But it doesn't set the sh_link or
+ sh_info fields. Hence we could get the situation
+ where s is NULL. */
+ const struct elf_backend_data *bed
+ = get_elf_backend_data (abfd);
+ if (bed->link_order_error_handler)
+ bed->link_order_error_handler
+ (_("%B: warning: sh_link not set for section `%A'"),
+ abfd, sec);
+ }
+ }
+
switch (d->this_hdr.sh_type)
{
case SHT_REL:
@@ -2789,7 +3287,7 @@ assign_section_numbers (bfd *abfd)
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
+ if (CONST_STRNEQ (sec->name, ".stab")
&& strcmp (sec->name + strlen (sec->name) - 3, "str") == 0)
{
size_t len;
@@ -2827,7 +3325,18 @@ assign_section_numbers (bfd *abfd)
d->this_hdr.sh_link = elf_section_data (s)->this_idx;
break;
+ case SHT_GNU_LIBLIST:
+ /* sh_link is the section header index of the prelink library
+ list used for the dynamic entries, or the symbol table, or
+ the version strings. */
+ s = bfd_get_section_by_name (abfd, (sec->flags & SEC_ALLOC)
+ ? ".dynstr" : ".gnu.libstr");
+ if (s != NULL)
+ d->this_hdr.sh_link = elf_section_data (s)->this_idx;
+ break;
+
case SHT_HASH:
+ case SHT_GNU_HASH:
case SHT_GNU_versym:
/* sh_link is the section header index of the symbol table
this hash table or version table is for. */
@@ -2853,7 +3362,7 @@ assign_section_numbers (bfd *abfd)
/* 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
+static bfd_boolean
sym_is_global (bfd *abfd, asymbol *sym)
{
/* If the backend has a special mapping, use it. */
@@ -2866,6 +3375,20 @@ sym_is_global (bfd *abfd, asymbol *sym)
|| bfd_is_com_section (bfd_get_section (sym)));
}
+/* Don't output section symbols for sections that are not going to be
+ output. Also, don't output section symbols for reloc and other
+ special sections. */
+
+static bfd_boolean
+ignore_section_sym (bfd *abfd, asymbol *sym)
+{
+ return ((sym->flags & BSF_SECTION_SYM) != 0
+ && (sym->value != 0
+ || (sym->section->owner != abfd
+ && (sym->section->output_section->owner != abfd
+ || sym->section->output_offset != 0))));
+}
+
static bfd_boolean
elf_map_symbols (bfd *abfd)
{
@@ -2880,7 +3403,6 @@ elf_map_symbols (bfd *abfd)
unsigned int idx;
asection *asect;
asymbol **new_syms;
- bfd_size_type amt;
#ifdef DEBUG
fprintf (stderr, "elf_map_symbols\n");
@@ -2894,8 +3416,7 @@ elf_map_symbols (bfd *abfd)
}
max_index++;
- amt = max_index * sizeof (asymbol *);
- sect_syms = bfd_zalloc (abfd, amt);
+ sect_syms = bfd_zalloc2 (abfd, max_index, sizeof (asymbol *));
if (sect_syms == NULL)
return FALSE;
elf_section_syms (abfd) = sect_syms;
@@ -2908,51 +3429,29 @@ elf_map_symbols (bfd *abfd)
asymbol *sym = syms[idx];
if ((sym->flags & BSF_SECTION_SYM) != 0
- && sym->value == 0)
+ && !ignore_section_sym (abfd, sym))
{
- asection *sec;
+ asection *sec = sym->section;
- sec = sym->section;
+ if (sec->owner != abfd)
+ sec = sec->output_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];
- }
+ sect_syms[sec->index] = syms[idx];
}
}
/* Classify all of the symbols. */
for (idx = 0; idx < symcount; idx++)
{
+ if (ignore_section_sym (abfd, syms[idx]))
+ continue;
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
+ /* We will be adding a section symbol for each normal BFD section. Most
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. */
@@ -2968,8 +3467,7 @@ elf_map_symbols (bfd *abfd)
}
/* Now sort the symbols so the local symbols are first. */
- amt = (num_locals + num_globals) * sizeof (asymbol *);
- new_syms = bfd_alloc (abfd, amt);
+ new_syms = bfd_alloc2 (abfd, num_locals + num_globals, sizeof (asymbol *));
if (new_syms == NULL)
return FALSE;
@@ -2979,6 +3477,8 @@ elf_map_symbols (bfd *abfd)
asymbol *sym = syms[idx];
unsigned int i;
+ if (ignore_section_sym (abfd, sym))
+ continue;
if (!sym_is_global (abfd, sym))
i = num_locals2++;
else
@@ -3053,7 +3553,7 @@ _bfd_elf_compute_section_file_positions (bfd *abfd,
{
const struct elf_backend_data *bed = get_elf_backend_data (abfd);
bfd_boolean failed;
- struct bfd_strtab_hash *strtab;
+ struct bfd_strtab_hash *strtab = NULL;
Elf_Internal_Shdr *shstrtab_hdr;
if (abfd->output_has_begun)
@@ -3075,7 +3575,7 @@ _bfd_elf_compute_section_file_positions (bfd *abfd,
if (failed)
return FALSE;
- if (!assign_section_numbers (abfd))
+ if (!assign_section_numbers (abfd, link_info))
return FALSE;
/* The backend linker builds symbol table information itself. */
@@ -3130,7 +3630,7 @@ _bfd_elf_compute_section_file_positions (bfd *abfd,
elf_tdata (abfd)->next_file_pos = off;
/* Now that we know where the .strtab section goes, write it
- out. */
+ out. */
if (bfd_seek (abfd, hdr->sh_offset, SEEK_SET) != 0
|| ! _bfd_stringtab_emit (abfd, strtab))
return FALSE;
@@ -3142,6 +3642,90 @@ _bfd_elf_compute_section_file_positions (bfd *abfd,
return TRUE;
}
+/* Make an initial estimate of the size of the program header. If we
+ get the number wrong here, we'll redo section placement. */
+
+static bfd_size_type
+get_program_header_size (bfd *abfd, struct bfd_link_info *info)
+{
+ size_t segs;
+ asection *s;
+ const struct elf_backend_data *bed;
+
+ /* 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)->relro)
+ {
+ /* We need a PT_GNU_RELRO segment only when there is 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
+ && CONST_STRNEQ (s->name, ".note"))
+ {
+ /* 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. */
+ bed = get_elf_backend_data (abfd);
+ if (bed->elf_backend_additional_program_headers)
+ {
+ int a;
+
+ a = (*bed->elf_backend_additional_program_headers) (abfd, info);
+ if (a == -1)
+ abort ();
+ segs += a;
+ }
+
+ return segs * bed->s->sizeof_phdr;
+}
+
/* Create a mapping from a set of sections to a program segment. */
static struct elf_segment_map *
@@ -3177,351 +3761,436 @@ make_mapping (bfd *abfd,
return m;
}
-/* Set up a mapping from BFD sections to program segments. */
+/* Create the PT_DYNAMIC segment, which includes DYNSEC. Returns NULL
+ on failure. */
-static bfd_boolean
-map_sections_to_segments (bfd *abfd)
+struct elf_segment_map *
+_bfd_elf_make_dynamic_segment (bfd *abfd, asection *dynsec)
{
- 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;
+ m = bfd_zalloc (abfd, sizeof (struct elf_segment_map));
+ if (m == NULL)
+ return NULL;
+ m->next = NULL;
+ m->p_type = PT_DYNAMIC;
+ m->count = 1;
+ m->sections[0] = dynsec;
- if (bfd_count_sections (abfd) == 0)
- return TRUE;
+ return m;
+}
- /* Select the allocated sections, and sort them. */
+/* Possibly add or remove segments from the segment map. */
- amt = bfd_count_sections (abfd) * sizeof (asection *);
- sections = bfd_malloc (amt);
- if (sections == NULL)
- goto error_return;
+static bfd_boolean
+elf_modify_segment_map (bfd *abfd, struct bfd_link_info *info)
+{
+ struct elf_segment_map **m;
+ const struct elf_backend_data *bed;
- i = 0;
- for (s = abfd->sections; s != NULL; s = s->next)
+ /* 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. We also remove excluded
+ sections. Finally, any PT_LOAD segment without sections is
+ removed. */
+ m = &elf_tdata (abfd)->segment_map;
+ while (*m)
{
- if ((s->flags & SEC_ALLOC) != 0)
+ unsigned int i, new_count;
+
+ for (new_count = 0, i = 0; i < (*m)->count; i++)
{
- sections[i] = s;
- ++i;
+ if (((*m)->sections[i]->flags & SEC_EXCLUDE) == 0
+ && (((*m)->sections[i]->flags & SEC_ALLOC) != 0
+ || (*m)->p_type != PT_LOAD))
+ {
+ (*m)->sections[new_count] = (*m)->sections[i];
+ new_count++;
+ }
}
+ (*m)->count = new_count;
+
+ if ((*m)->p_type == PT_LOAD && (*m)->count == 0)
+ *m = (*m)->next;
+ else
+ m = &(*m)->next;
}
- BFD_ASSERT (i <= bfd_count_sections (abfd));
- count = i;
- qsort (sections, (size_t) count, sizeof (asection *), elf_sort_sections);
+ bed = get_elf_backend_data (abfd);
+ if (bed->elf_backend_modify_segment_map != NULL)
+ {
+ if (!(*bed->elf_backend_modify_segment_map) (abfd, info))
+ return FALSE;
+ }
- /* Build the mapping. */
+ return TRUE;
+}
- mfirst = NULL;
- pm = &mfirst;
+/* Set up a mapping from BFD sections to program segments. */
- /* 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)
+bfd_boolean
+_bfd_elf_map_sections_to_segments (bfd *abfd, struct bfd_link_info *info)
+{
+ unsigned int count;
+ struct elf_segment_map *m;
+ asection **sections = NULL;
+ const struct elf_backend_data *bed = get_elf_backend_data (abfd);
+
+ if (elf_tdata (abfd)->segment_map == NULL
+ && bfd_count_sections (abfd) != 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;
+ asection *s;
+ unsigned int i;
+ struct elf_segment_map *mfirst;
+ struct elf_segment_map **pm;
+ 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;
- *pm = m;
- pm = &m->next;
+ /* Select the allocated sections, and sort them. */
- amt = sizeof (struct elf_segment_map);
- m = bfd_zalloc (abfd, amt);
- if (m == NULL)
+ sections = bfd_malloc2 (bfd_count_sections (abfd), sizeof (asection *));
+ if (sections == 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)
+ i = 0;
+ for (s = abfd->sections; s != NULL; s = s->next)
{
- /* 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;
+ if ((s->flags & SEC_ALLOC) != 0)
+ {
+ sections[i] = s;
+ ++i;
+ }
}
- else if (! writable
- && (hdr->flags & SEC_READONLY) == 0
- && (((last_hdr->lma + last_size - 1)
- & ~(maxpagesize - 1))
- != (hdr->lma & ~(maxpagesize - 1))))
+ 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)
{
- /* 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;
+ 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;
}
- else
+
+ /* 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 = bed->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)
{
- /* Otherwise, we can use the same segment. */
- new_segment = FALSE;
+ bfd_size_type phdr_size = elf_tdata (abfd)->program_header_size;
+
+ if (phdr_size == (bfd_size_type) -1)
+ phdr_size = get_program_header_size (abfd, info);
+ if ((abfd->flags & D_PAGED) == 0
+ || sections[0]->lma < phdr_size
+ || sections[0]->lma % maxpagesize < phdr_size % maxpagesize)
+ phdr_in_segment = FALSE;
}
- if (! new_segment)
+ 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;
+ }
+
+ /* Allow interested parties a chance to override our decision. */
+ if (last_hdr && info->callbacks->override_segment_assignment)
+ new_segment = info->callbacks->override_segment_assignment (info, abfd, hdr, last_hdr, new_segment);
+
+ 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->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;
+ last_size = hdr->size;
else
last_size = 0;
- continue;
+ phdr_index = i;
+ phdr_in_segment = FALSE;
}
- /* 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;
+ /* 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;
+ *pm = m;
+ pm = &m->next;
+ }
- if ((hdr->flags & SEC_READONLY) == 0)
- writable = TRUE;
- else
- writable = FALSE;
+ /* If there is a .dynamic section, throw in a PT_DYNAMIC segment. */
+ if (dynsec != NULL)
+ {
+ m = _bfd_elf_make_dynamic_segment (abfd, dynsec);
+ if (m == NULL)
+ goto error_return;
+ *pm = m;
+ pm = &m->next;
+ }
- 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;
- }
+ /* 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
+ && CONST_STRNEQ (s->name, ".note"))
+ {
+ 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;
- /* 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 (s->flags & SEC_THREAD_LOCAL)
+ {
+ if (! tls_count)
+ first_tls = s;
+ tls_count++;
+ }
+ }
- *pm = m;
- pm = &m->next;
- }
+ /* If there are any SHF_TLS output sections, add PT_TLS segment. */
+ if (tls_count > 0)
+ {
+ int i;
- /* 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;
+ 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;
- }
+ *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)
+ /* 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_NOTE;
+ m->p_type = PT_GNU_EH_FRAME;
m->count = 1;
- m->sections[0] = s;
+ m->sections[0] = eh_frame_hdr->output_section;
*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)
+ if (elf_tdata (abfd)->stack_flags)
{
- BFD_ASSERT (first_tls->flags & SEC_THREAD_LOCAL);
- m->sections[i] = first_tls;
- first_tls = first_tls->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_GNU_STACK;
+ m->p_flags = elf_tdata (abfd)->stack_flags;
+ m->p_flags_valid = 1;
+
+ *pm = m;
+ pm = &m->next;
}
- *pm = m;
- pm = &m->next;
- }
+ if (dynsec != NULL && elf_tdata (abfd)->relro)
+ {
+ /* We make a PT_GNU_RELRO segment only when there is a
+ PT_DYNAMIC segment. */
+ 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_RELRO;
+ m->p_flags = PF_R;
+ m->p_flags_valid = 1;
- /* 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;
+ }
- *pm = m;
- pm = &m->next;
+ free (sections);
+ elf_tdata (abfd)->segment_map = mfirst;
}
- 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;
- }
+ if (!elf_modify_segment_map (abfd, info))
+ return FALSE;
- free (sections);
- sections = NULL;
+ for (count = 0, m = elf_tdata (abfd)->segment_map; m != NULL; m = m->next)
+ ++count;
+ elf_tdata (abfd)->program_header_size = count * bed->s->sizeof_phdr;
- elf_tdata (abfd)->segment_map = mfirst;
return TRUE;
error_return:
@@ -3577,8 +4246,8 @@ elf_sort_sections (const void *arg1, const void *arg2)
/* 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;
+ size1 = (sec1->flags & SEC_LOAD) ? sec1->size : 0;
+ size2 = (sec2->flags & SEC_LOAD) ? sec2->size : 0;
if (size1 < size2)
return -1;
@@ -3608,7 +4277,7 @@ elf_sort_sections (const void *arg1, const void *arg2)
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
@@ -3619,114 +4288,67 @@ vma_page_aligned_bias (bfd_vma vma, ufile_ptr off, bfd_vma 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. */
+ the file header. */
static bfd_boolean
-assign_file_positions_for_segments (bfd *abfd, struct bfd_link_info *link_info)
+assign_file_positions_for_load_sections (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;
- }
- }
+ file_ptr off;
+ bfd_size_type maxpagesize;
+ unsigned int alloc;
+ unsigned int i, j;
- if (bed->elf_backend_modify_segment_map)
- {
- if (! (*bed->elf_backend_modify_segment_map) (abfd, link_info))
- return FALSE;
- }
+ if (link_info == NULL
+ && !elf_modify_segment_map (abfd, link_info))
+ return FALSE;
- count = 0;
+ alloc = 0;
for (m = elf_tdata (abfd)->segment_map; m != NULL; m = m->next)
- ++count;
+ ++alloc;
elf_elfheader (abfd)->e_phoff = bed->s->sizeof_ehdr;
elf_elfheader (abfd)->e_phentsize = bed->s->sizeof_phdr;
- elf_elfheader (abfd)->e_phnum = count;
+ elf_elfheader (abfd)->e_phnum = alloc;
- if (count == 0)
- return TRUE;
+ if (elf_tdata (abfd)->program_header_size == (bfd_size_type) -1)
+ elf_tdata (abfd)->program_header_size = alloc * bed->s->sizeof_phdr;
+ else
+ BFD_ASSERT (elf_tdata (abfd)->program_header_size
+ >= alloc * bed->s->sizeof_phdr);
- /* 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)
+ if (alloc == 0)
{
- ((*_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;
+ elf_tdata (abfd)->next_file_pos = bed->s->sizeof_ehdr;
+ return TRUE;
}
- if (alloc == 0)
- alloc = count;
-
- amt = alloc * sizeof (Elf_Internal_Phdr);
- phdrs = bfd_alloc (abfd, amt);
+ phdrs = bfd_alloc2 (abfd, alloc, sizeof (Elf_Internal_Phdr));
+ elf_tdata (abfd)->phdr = phdrs;
if (phdrs == NULL)
return FALSE;
+ maxpagesize = 1;
+ if ((abfd->flags & D_PAGED) != 0)
+ maxpagesize = bed->maxpagesize;
+
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;
+ for (m = elf_tdata (abfd)->segment_map, p = phdrs, j = 0;
m != NULL;
- m = m->next, p++)
+ m = m->next, p++, j++)
{
- unsigned int i;
asection **secpp;
+ bfd_vma off_adjust;
+ bfd_boolean no_contents;
/* If elf_segment_map is not from map_sections_to_segments, the
- sections may not be correctly ordered. NOTE: sorting should
+ 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. */
@@ -3736,64 +4358,140 @@ assign_file_positions_for_segments (bfd *abfd, struct bfd_link_info *link_info)
qsort (m->sections, (size_t) m->count, sizeof (asection *),
elf_sort_sections);
+ /* An ELF segment (described by Elf_Internal_Phdr) may contain a
+ number of sections with contents contributing to both p_filesz
+ and p_memsz, followed by a number of sections with no contents
+ that just contribute to p_memsz. In this loop, OFF tracks next
+ available file offset for PT_LOAD and PT_NOTE segments. */
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;
+ p->p_vaddr = m->sections[0]->vma - m->p_vaddr_offset;
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;
+ p->p_paddr = m->sections[0]->lma - m->p_vaddr_offset;
if (p->p_type == PT_LOAD
&& (abfd->flags & D_PAGED) != 0)
- p->p_align = bed->maxpagesize;
+ {
+ /* p_align in demand paged PT_LOAD segments effectively stores
+ the maximum page size. When copying an executable with
+ objcopy, we set m->p_align from the input file. Use this
+ value for maxpagesize rather than bed->maxpagesize, which
+ may be different. Note that we use maxpagesize for PT_TLS
+ segment alignment later in this function, so we are relying
+ on at least one PT_LOAD segment appearing before a PT_TLS
+ segment. */
+ if (m->p_align_valid)
+ maxpagesize = m->p_align;
+
+ p->p_align = maxpagesize;
+ }
else if (m->count == 0)
p->p_align = 1 << bed->s->log_file_align;
+ else if (m->p_align_valid)
+ p->p_align = m->p_align;
else
p->p_align = 0;
+ no_contents = FALSE;
+ off_adjust = 0;
+ if (p->p_type == PT_NOTE)
+ {
+ for (i = 0; i < m->count; i++)
+ elf_section_type (m->sections[i]) = SHT_NOTE;
+ }
+ else if (p->p_type == PT_LOAD
+ && m->count > 0)
+ {
+ bfd_size_type align;
+ unsigned int align_power = 0;
+
+ if (m->p_align_valid)
+ align = p->p_align;
+ else
+ {
+ for (i = 0, secpp = m->sections; i < m->count; i++, secpp++)
+ {
+ unsigned int secalign;
+
+ secalign = bfd_get_section_alignment (abfd, *secpp);
+ if (secalign > align_power)
+ align_power = secalign;
+ }
+ align = (bfd_size_type) 1 << align_power;
+ if (align < maxpagesize)
+ align = maxpagesize;
+ }
+
+ for (i = 0; i < m->count; i++)
+ if ((m->sections[i]->flags & (SEC_LOAD | SEC_HAS_CONTENTS)) == 0)
+ /* If we aren't making room for this section, then
+ it must be SHT_NOBITS regardless of what we've
+ set via struct bfd_elf_special_section. */
+ elf_section_type (m->sections[i]) = SHT_NOBITS;
+
+ /* Find out whether this segment contains any loadable
+ sections. If the first section isn't loadable, the same
+ holds for any other sections. */
+ i = 0;
+ while (elf_section_type (m->sections[i]) == SHT_NOBITS)
+ {
+ /* If a segment starts with .tbss, we need to look
+ at the next section to decide whether the segment
+ has any loadable sections. */
+ if ((elf_section_flags (m->sections[i]) & SHF_TLS) == 0
+ || ++i >= m->count)
+ {
+ no_contents = TRUE;
+ break;
+ }
+ }
+
+ off_adjust = vma_page_aligned_bias (m->sections[0]->vma, off, align);
+ off += off_adjust;
+ if (no_contents)
+ {
+ /* We shouldn't need to align the segment on disk since
+ the segment doesn't need file space, but the gABI
+ arguably requires the alignment and glibc ld.so
+ checks it. So to comply with the alignment
+ requirement but not waste file space, we adjust
+ p_offset for just this segment. (OFF_ADJUST is
+ subtracted from OFF later.) This may put p_offset
+ past the end of file, but that shouldn't matter. */
+ }
+ else
+ off_adjust = 0;
+ }
+ /* Make sure the .dynamic section is the first section in the
+ PT_DYNAMIC segment. */
+ else if (p->p_type == PT_DYNAMIC
+ && m->count > 1
+ && strcmp (m->sections[0]->name, ".dynamic") != 0)
+ {
+ _bfd_error_handler
+ (_("%B: The first section in the PT_DYNAMIC segment is not the .dynamic section"),
+ abfd);
+ bfd_set_error (bfd_error_bad_value);
+ return FALSE;
+ }
+
p->p_offset = 0;
p->p_filesz = 0;
p->p_memsz = 0;
if (m->includes_filehdr)
{
- if (! m->p_flags_valid)
+ 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)
@@ -3803,37 +4501,24 @@ assign_file_positions_for_segments (bfd *abfd, struct bfd_link_info *link_info)
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));
+ (_("%B: Not enough room for program headers, try linking with -N"),
+ abfd);
bfd_set_error (bfd_error_bad_value);
return FALSE;
}
p->p_vaddr -= off;
- if (! m->p_paddr_valid)
+ 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)
+ 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
+ if (!m->includes_filehdr)
{
p->p_offset = bed->s->sizeof_ehdr;
@@ -3841,17 +4526,9 @@ assign_file_positions_for_segments (bfd *abfd, struct bfd_link_info *link_info)
{
BFD_ASSERT (p->p_type == PT_LOAD);
p->p_vaddr -= off - p->p_offset;
- if (! m->p_paddr_valid)
+ 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;
@@ -3861,327 +4538,343 @@ assign_file_positions_for_segments (bfd *abfd, struct bfd_link_info *link_info)
if (p->p_type == PT_LOAD
|| (p->p_type == PT_NOTE && bfd_get_format (abfd) == bfd_core))
{
- if (! m->includes_filehdr && ! m->includes_phdrs)
+ 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;
+ if (!no_contents)
+ p->p_filesz += adjust;
p->p_memsz += adjust;
}
}
- voff = off;
-
+ /* Set up p_filesz, p_memsz, p_align and p_flags from the section
+ maps. Set filepos for sections in PT_LOAD segments, and in
+ core files, for sections in PT_NOTE segments.
+ assign_file_positions_for_non_load_sections will set filepos
+ for other sections and update p_filesz for other segments. */
for (i = 0, secpp = m->sections; i < m->count; i++, secpp++)
{
asection *sec;
- flagword flags;
bfd_size_type align;
+ Elf_Internal_Shdr *this_hdr;
sec = *secpp;
- flags = sec->flags;
- align = 1 << bfd_get_section_alignment (abfd, sec);
+ this_hdr = &elf_section_data (sec)->this_hdr;
+ align = (bfd_size_type) 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)
+ if (p->p_type == PT_LOAD
+ || p->p_type == PT_TLS)
{
- bfd_vma adjust = sec->lma - (p->p_paddr + p->p_memsz);
+ bfd_signed_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))
+ if (this_hdr->sh_type != SHT_NOBITS
+ || ((this_hdr->sh_flags & SHF_ALLOC) != 0
+ && ((this_hdr->sh_flags & SHF_TLS) == 0
+ || p->p_type == PT_TLS)))
{
- 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;
+ (*_bfd_error_handler)
+ (_("%B: section %A lma 0x%lx overlaps previous sections"),
+ abfd, sec, (unsigned long) sec->lma);
+ adjust = 0;
}
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 (this_hdr->sh_type != SHT_NOBITS)
+ {
+ off += adjust;
+ p->p_filesz += adjust;
+ }
+ }
}
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. */
+ /* The section at i == 0 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;
+ this_hdr->sh_offset = sec->filepos = off;
+ off += this_hdr->sh_size;
+ p->p_filesz = this_hdr->sh_size;
+ p->p_memsz = 0;
+ p->p_align = 1;
}
else
{
- /* Fake sections -- don't need to be written. */
+ /* The rest are fake sections that shouldn't be written. */
sec->filepos = 0;
- sec->_raw_size = 0;
- flags = sec->flags = 0;
+ sec->size = 0;
+ sec->flags = 0;
+ continue;
}
- 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)
+ if (p->p_type == PT_LOAD)
{
- struct bfd_link_order *o;
- bfd_vma tbss_size = 0;
+ this_hdr->sh_offset = sec->filepos = off;
+ if (this_hdr->sh_type != SHT_NOBITS)
+ off += this_hdr->sh_size;
+ }
- for (o = sec->link_order_head; o != NULL; o = o->next)
- if (tbss_size < o->offset + o->size)
- tbss_size = o->offset + o->size;
+ if (this_hdr->sh_type != SHT_NOBITS)
+ {
+ p->p_filesz += this_hdr->sh_size;
+ /* A load section without SHF_ALLOC is something like
+ a note section in a PT_NOTE segment. These take
+ file space but are not loaded into memory. */
+ if ((this_hdr->sh_flags & SHF_ALLOC) != 0)
+ p->p_memsz += this_hdr->sh_size;
+ }
+ else if ((this_hdr->sh_flags & SHF_ALLOC) != 0)
+ {
+ if (p->p_type == PT_TLS)
+ p->p_memsz += this_hdr->sh_size;
- p->p_memsz += tbss_size;
+ /* .tbss is special. It doesn't contribute to p_memsz of
+ normal segments. */
+ else if ((this_hdr->sh_flags & SHF_TLS) == 0)
+ p->p_memsz += this_hdr->sh_size;
}
- if (align > p->p_align
- && (p->p_type != PT_LOAD || (abfd->flags & D_PAGED) == 0))
+ if (p->p_type == PT_GNU_RELRO)
+ p->p_align = 1;
+ else if (align > p->p_align
+ && !m->p_align_valid
+ && (p->p_type != PT_LOAD
+ || (abfd->flags & D_PAGED) == 0))
p->p_align = align;
}
- if (! m->p_flags_valid)
+ if (!m->p_flags_valid)
{
p->p_flags |= PF_R;
- if ((flags & SEC_CODE) != 0)
+ if ((this_hdr->sh_flags & SHF_EXECINSTR) != 0)
p->p_flags |= PF_X;
- if ((flags & SEC_READONLY) == 0)
+ if ((this_hdr->sh_flags & SHF_WRITE) != 0)
p->p_flags |= PF_W;
}
}
- }
+ off -= off_adjust;
- /* 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;
- }
- }
- }
+ /* Check that all sections are in a PT_LOAD segment.
+ Don't check funky gdb generated core files. */
+ if (p->p_type == PT_LOAD && bfd_get_format (abfd) != bfd_core)
+ for (i = 0, secpp = m->sections; i < m->count; i++, secpp++)
+ {
+ Elf_Internal_Shdr *this_hdr;
+ asection *sec;
- /* 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;
+ sec = *secpp;
+ this_hdr = &(elf_section_data(sec)->this_hdr);
+ if (this_hdr->sh_size != 0
+ && !ELF_IS_SECTION_IN_SEGMENT_FILE (this_hdr, p))
+ {
+ (*_bfd_error_handler)
+ (_("%B: section `%A' can't be allocated in segment %d"),
+ abfd, sec, j);
+ bfd_set_error (bfd_error_bad_value);
+ return FALSE;
+ }
+ }
}
- 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).
+/* Assign file positions for the other sections. */
- ??? 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)
+static bfd_boolean
+assign_file_positions_for_non_load_sections (bfd *abfd,
+ struct bfd_link_info *link_info)
{
- size_t segs;
- asection *s;
const struct elf_backend_data *bed = get_elf_backend_data (abfd);
+ Elf_Internal_Shdr **i_shdrpp;
+ Elf_Internal_Shdr **hdrpp;
+ Elf_Internal_Phdr *phdrs;
+ Elf_Internal_Phdr *p;
+ struct elf_segment_map *m;
+ bfd_vma filehdr_vaddr, filehdr_paddr;
+ bfd_vma phdrs_vaddr, phdrs_paddr;
+ file_ptr off;
+ unsigned int num_sec;
+ unsigned int i;
+ unsigned int count;
- /* 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)
+ i_shdrpp = elf_elfsections (abfd);
+ num_sec = elf_numsections (abfd);
+ off = elf_tdata (abfd)->next_file_pos;
+ for (i = 1, hdrpp = i_shdrpp + 1; i < num_sec; i++, hdrpp++)
{
- /* 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;
- }
+ struct elf_obj_tdata *tdata = elf_tdata (abfd);
+ Elf_Internal_Shdr *hdr;
- if (bfd_get_section_by_name (abfd, ".dynamic") != NULL)
- {
- /* We need a PT_DYNAMIC segment. */
- ++segs;
- }
+ hdr = *hdrpp;
+ if (hdr->bfd_section != NULL
+ && (hdr->bfd_section->filepos != 0
+ || (hdr->sh_type == SHT_NOBITS
+ && hdr->contents == NULL)))
+ BFD_ASSERT (hdr->sh_offset == hdr->bfd_section->filepos);
+ else if ((hdr->sh_flags & SHF_ALLOC) != 0)
+ {
+ if (hdr->sh_size != 0)
+ ((*_bfd_error_handler)
+ (_("%B: warning: allocated section `%s' not in segment"),
+ abfd,
+ (hdr->bfd_section == NULL
+ ? "*unknown*"
+ : hdr->bfd_section->name)));
+ /* We don't need to page align empty sections. */
+ if ((abfd->flags & D_PAGED) != 0 && hdr->sh_size != 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->sh_type == SHT_REL || hdr->sh_type == SHT_RELA)
+ && hdr->bfd_section == NULL)
+ || 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 (elf_tdata (abfd)->eh_frame_hdr)
- {
- /* We need a PT_GNU_EH_FRAME segment. */
- ++segs;
+ if (i == SHN_LORESERVE - 1)
+ {
+ i += SHN_HIRESERVE + 1 - SHN_LORESERVE;
+ hdrpp += SHN_HIRESERVE + 1 - SHN_LORESERVE;
+ }
}
- if (elf_tdata (abfd)->stack_flags)
+ /* Now that we have set the section file positions, we can set up
+ the file positions for the non PT_LOAD segments. */
+ count = 0;
+ filehdr_vaddr = 0;
+ filehdr_paddr = 0;
+ phdrs_vaddr = bed->maxpagesize + bed->s->sizeof_ehdr;
+ phdrs_paddr = 0;
+ phdrs = elf_tdata (abfd)->phdr;
+ for (m = elf_tdata (abfd)->segment_map, p = phdrs;
+ m != NULL;
+ m = m->next, p++)
{
- /* We need a PT_GNU_STACK segment. */
- ++segs;
- }
+ ++count;
+ if (p->p_type != PT_LOAD)
+ continue;
- for (s = abfd->sections; s != NULL; s = s->next)
- {
- if ((s->flags & SEC_LOAD) != 0
- && strncmp (s->name, ".note", 5) == 0)
+ if (m->includes_filehdr)
{
- /* We need a PT_NOTE segment. */
- ++segs;
+ filehdr_vaddr = p->p_vaddr;
+ filehdr_paddr = p->p_paddr;
+ }
+ if (m->includes_phdrs)
+ {
+ phdrs_vaddr = p->p_vaddr;
+ phdrs_paddr = p->p_paddr;
+ if (m->includes_filehdr)
+ {
+ phdrs_vaddr += bed->s->sizeof_ehdr;
+ phdrs_paddr += bed->s->sizeof_ehdr;
+ }
}
}
- for (s = abfd->sections; s != NULL; s = s->next)
+ for (m = elf_tdata (abfd)->segment_map, p = phdrs;
+ m != NULL;
+ m = m->next, p++)
{
- if (s->flags & SEC_THREAD_LOCAL)
+ if (m->count != 0)
{
- /* We need a PT_TLS segment. */
- ++segs;
- break;
+ if (p->p_type != PT_LOAD
+ && (p->p_type != PT_NOTE || bfd_get_format (abfd) != bfd_core))
+ {
+ Elf_Internal_Shdr *hdr;
+ BFD_ASSERT (!m->includes_filehdr && !m->includes_phdrs);
+
+ hdr = &elf_section_data (m->sections[m->count - 1])->this_hdr;
+ p->p_filesz = (m->sections[m->count - 1]->filepos
+ - m->sections[0]->filepos);
+ if (hdr->sh_type != SHT_NOBITS)
+ p->p_filesz += hdr->sh_size;
+
+ p->p_offset = m->sections[0]->filepos;
+ }
}
- }
+ else
+ {
+ 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;
+ }
+ else if (p->p_type == PT_GNU_RELRO)
+ {
+ Elf_Internal_Phdr *lp;
- /* Let the backend count up any program headers it might need. */
- if (bed->elf_backend_additional_program_headers)
- {
- int a;
+ for (lp = phdrs; lp < phdrs + count; ++lp)
+ {
+ if (lp->p_type == PT_LOAD
+ && lp->p_vaddr <= link_info->relro_end
+ && lp->p_vaddr >= link_info->relro_start
+ && (lp->p_vaddr + lp->p_filesz
+ >= link_info->relro_end))
+ break;
+ }
- a = (*bed->elf_backend_additional_program_headers) (abfd);
- if (a == -1)
- abort ();
- segs += a;
+ if (lp < phdrs + count
+ && link_info->relro_end > lp->p_vaddr)
+ {
+ p->p_vaddr = lp->p_vaddr;
+ p->p_paddr = lp->p_paddr;
+ p->p_offset = lp->p_offset;
+ p->p_filesz = link_info->relro_end - lp->p_vaddr;
+ p->p_memsz = p->p_filesz;
+ p->p_align = 1;
+ p->p_flags = (lp->p_flags & ~PF_W);
+ }
+ else
+ {
+ memset (p, 0, sizeof *p);
+ p->p_type = PT_NULL;
+ }
+ }
+ }
}
- elf_tdata (abfd)->program_header_size = segs * bed->s->sizeof_phdr;
- return elf_tdata (abfd)->program_header_size;
+ elf_tdata (abfd)->next_file_pos = off;
+
+ return TRUE;
}
/* 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.
+ Reloc sections come in two flavours: Those processed specially as
+ "side-channel" data attached to a section to which they apply, and
+ those that bfd doesn't process as relocations. The latter sort are
+ stored in a normal bfd section by bfd_section_from_shdr. We don't
+ consider the former sort here, unless they form part of the loadable
+ image. Reloc sections not assigned here will be handled later by
+ assign_file_positions_for_relocs.
We also don't set the positions of the .symtab and .strtab here. */
@@ -4189,16 +4882,16 @@ 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);
+ struct elf_obj_tdata *tdata = elf_tdata (abfd);
+ Elf_Internal_Ehdr *i_ehdrp = elf_elfheader (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 ** const i_shdrpp = elf_elfsections (abfd);
+ unsigned int num_sec = elf_numsections (abfd);
Elf_Internal_Shdr **hdrpp;
unsigned int i;
@@ -4213,8 +4906,8 @@ assign_file_positions_except_relocs (bfd *abfd,
Elf_Internal_Shdr *hdr;
hdr = *hdrpp;
- if (hdr->sh_type == SHT_REL
- || hdr->sh_type == SHT_RELA
+ if (((hdr->sh_type == SHT_REL || hdr->sh_type == SHT_RELA)
+ && hdr->bfd_section == NULL)
|| i == tdata->symtab_section
|| i == tdata->symtab_shndx_section
|| i == tdata->strtab_section)
@@ -4233,55 +4926,30 @@ assign_file_positions_except_relocs (bfd *abfd,
}
else
{
- unsigned int i;
- Elf_Internal_Shdr **hdrpp;
+ unsigned int alloc;
/* Assign file positions for the loaded sections based on the
- assignment of sections to segments. */
- if (! assign_file_positions_for_segments (abfd, link_info))
+ assignment of sections to segments. */
+ if (!assign_file_positions_for_load_sections (abfd, link_info))
return FALSE;
- /* Assign file positions for the other sections. */
+ /* And for non-load sections. */
+ if (!assign_file_positions_for_non_load_sections (abfd, link_info))
+ return FALSE;
- off = elf_tdata (abfd)->next_file_pos;
- for (i = 1, hdrpp = i_shdrpp + 1; i < num_sec; i++, hdrpp++)
+ if (bed->elf_backend_modify_program_headers != NULL)
{
- Elf_Internal_Shdr *hdr;
+ if (!(*bed->elf_backend_modify_program_headers) (abfd, link_info))
+ return FALSE;
+ }
- 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);
+ /* Write out the program headers. */
+ alloc = tdata->program_header_size / bed->s->sizeof_phdr;
+ if (bfd_seek (abfd, (bfd_signed_vma) bed->s->sizeof_ehdr, SEEK_SET) != 0
+ || bed->s->write_out_phdrs (abfd, tdata->phdr, alloc) != 0)
+ return FALSE;
- if (i == SHN_LORESERVE - 1)
- {
- i += SHN_HIRESERVE + 1 - SHN_LORESERVE;
- hdrpp += SHN_HIRESERVE + 1 - SHN_LORESERVE;
- }
- }
+ off = tdata->next_file_pos;
}
/* Place the section headers. */
@@ -4289,7 +4957,7 @@ assign_file_positions_except_relocs (bfd *abfd,
i_ehdrp->e_shoff = off;
off += i_ehdrp->e_shnum * i_ehdrp->e_shentsize;
- elf_tdata (abfd)->next_file_pos = off;
+ tdata->next_file_pos = off;
return TRUE;
}
@@ -4365,18 +5033,8 @@ prep_headers (bfd *abfd)
/* 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
- }
+ /* It all happens later. */
+ ;
else
{
i_ehdrp->e_phentsize = 0;
@@ -4466,8 +5124,9 @@ _bfd_elf_write_object_contents (bfd *abfd)
}
/* 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)))
+ if (elf_shstrtab (abfd) != NULL
+ && (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)
@@ -4503,19 +5162,7 @@ _bfd_elf_section_from_bfd_section (bfd *abfd, struct bfd_section *asect)
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;
- }
+ index = -1;
bed = get_elf_backend_data (abfd);
if (bed->elf_backend_section_from_bfd_section)
@@ -4551,13 +5198,14 @@ _bfd_elf_symbol_from_bfd_symbol (bfd *abfd, asymbol **asym_ptr_ptr)
&& (flags & BSF_SECTION_SYM)
&& asym_ptr->section)
{
+ asection *sec;
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)
+ sec = asym_ptr->section;
+ if (sec->owner != abfd && sec->output_section != NULL)
+ sec = sec->output_section;
+ if (sec->owner == abfd
+ && (indx = sec->index) < elf_num_section_syms (abfd)
&& elf_section_syms (abfd)[indx] != NULL)
asym_ptr->udata.i = elf_section_syms (abfd)[indx]->udata.i;
}
@@ -4567,10 +5215,10 @@ _bfd_elf_symbol_from_bfd_symbol (bfd *abfd, asymbol **asym_ptr_ptr)
if (idx == 0)
{
/* This case can occur when using --strip-symbol on a symbol
- which is used in a relocation entry. */
+ 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));
+ (_("%B: symbol `%s' required but not present"),
+ abfd, bfd_asymbol_name (asym_ptr));
bfd_set_error (bfd_error_no_symbols);
return -1;
}
@@ -4588,10 +5236,10 @@ _bfd_elf_symbol_from_bfd_symbol (bfd *abfd, asymbol **asym_ptr_ptr)
return idx;
}
-/* Copy private BFD data. This copies any program header information. */
+/* Rewrite program header information. */
static bfd_boolean
-copy_private_bfd_data (bfd *ibfd, bfd *obfd)
+rewrite_elf_program_header (bfd *ibfd, bfd *obfd)
{
Elf_Internal_Ehdr *iehdr;
struct elf_segment_map *map;
@@ -4607,13 +5255,6 @@ copy_private_bfd_data (bfd *ibfd, bfd *obfd)
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);
@@ -4631,7 +5272,7 @@ copy_private_bfd_data (bfd *ibfd, bfd *obfd)
#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)
+ ? section->size : 0)
/* Returns TRUE if the given section is contained within
the given segment. VMA addresses are compared. */
@@ -4653,7 +5294,7 @@ copy_private_bfd_data (bfd *ibfd, bfd *obfd)
&& 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 \
+ && ((bfd_vma) s->filepos + s->size \
<= p->p_offset + p->p_filesz))
/* The complicated case when p_vaddr is 0 is to handle the Solaris
@@ -4665,36 +5306,50 @@ copy_private_bfd_data (bfd *ibfd, bfd *obfd)
&& p->p_memsz == 0 \
&& p->p_filesz > 0 \
&& (s->flags & SEC_HAS_CONTENTS) != 0 \
- && s->_raw_size > 0 \
+ && s->size > 0 \
&& (bfd_vma) s->filepos >= p->p_offset \
- && ((bfd_vma) s->filepos + s->_raw_size \
+ && ((bfd_vma) s->filepos + s->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,
+ 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) \
+ 7. SHF_TLS sections are only in PT_TLS or PT_LOAD segments.
+ 8. PT_DYNAMIC should not contain empty sections at the beginning
+ (with the possible exception of .dynamic). */
+#define IS_SECTION_IN_INPUT_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) \
+ && (segment->p_type != PT_DYNAMIC \
+ || SECTION_SIZE (section, segment) > 0 \
+ || (segment->p_paddr \
+ ? segment->p_paddr != section->lma \
+ : segment->p_vaddr != section->vma) \
+ || (strcmp (bfd_get_section_name (ibfd, section), ".dynamic") \
+ == 0)) \
&& ! section->segment_mark)
+/* If the output section of a section in the input segment is NULL,
+ it is removed from the corresponding output segment. */
+#define INCLUDE_SECTION_IN_SEGMENT(section, segment, bed) \
+ (IS_SECTION_IN_INPUT_SEGMENT (section, segment, bed) \
+ && section->output_section != NULL)
+
/* Returns TRUE iff seg1 starts after the end of seg2. */
#define SEGMENT_AFTER_SEGMENT(seg1, seg2, field) \
(seg1->field >= SEGMENT_END (seg2, seg2->field))
@@ -4707,9 +5362,9 @@ copy_private_bfd_data (bfd *ibfd, bfd *obfd)
LMA. */
#define SEGMENT_OVERLAPS(seg1, seg2) \
( !(SEGMENT_AFTER_SEGMENT (seg1, seg2, p_vaddr) \
- || SEGMENT_AFTER_SEGMENT (seg2, seg1, p_vaddr)) \
+ || SEGMENT_AFTER_SEGMENT (seg2, seg1, p_vaddr)) \
&& !(SEGMENT_AFTER_SEGMENT (seg1, seg2, p_paddr) \
- || SEGMENT_AFTER_SEGMENT (seg2, seg1, p_paddr)))
+ || SEGMENT_AFTER_SEGMENT (seg2, seg1, p_paddr)))
/* Initialise the segment mark field. */
for (section = ibfd->sections; section != NULL; section = section->next)
@@ -4752,7 +5407,7 @@ copy_private_bfd_data (bfd *ibfd, bfd *obfd)
if (segment2->p_vaddr < segment->p_vaddr)
{
/* Extend SEGMENT2 to include SEGMENT and then delete
- SEGMENT. */
+ SEGMENT. */
extra_length =
SEGMENT_END (segment, segment->p_vaddr)
- SEGMENT_END (segment2, segment2->p_vaddr);
@@ -4773,7 +5428,7 @@ copy_private_bfd_data (bfd *ibfd, bfd *obfd)
else
{
/* Extend SEGMENT to include SEGMENT2 and then delete
- SEGMENT2. */
+ SEGMENT2. */
extra_length =
SEGMENT_END (segment2, segment2->p_vaddr)
- SEGMENT_END (segment, segment->p_vaddr);
@@ -4802,22 +5457,33 @@ copy_private_bfd_data (bfd *ibfd, bfd *obfd)
bfd_vma suggested_lma;
unsigned int j;
bfd_size_type amt;
+ asection * first_section;
if (segment->p_type == PT_NULL)
continue;
+ first_section = NULL;
/* 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;
+ {
+ /* Find the first section in the input segment, which may be
+ removed from the corresponding output segment. */
+ if (IS_SECTION_IN_INPUT_SEGMENT (section, segment, bed))
+ {
+ if (first_section == NULL)
+ first_section = section;
+ if (section->output_section != NULL)
+ ++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);
+ map = bfd_zalloc (obfd, amt);
if (map == NULL)
return FALSE;
@@ -4827,8 +5493,15 @@ copy_private_bfd_data (bfd *ibfd, bfd *obfd)
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;
+
+ /* If the first section in the input segment is removed, there is
+ no need to preserve segment physical address in the corresponding
+ output segment. */
+ if (!first_section || first_section->output_section != NULL)
+ {
+ 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. */
@@ -4857,8 +5530,8 @@ copy_private_bfd_data (bfd *ibfd, bfd *obfd)
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));
+ (_("%B: warning: Empty loadable segment detected, is this intentional ?\n"),
+ ibfd);
map->count = 0;
*pointer_to_map = map;
@@ -4897,8 +5570,7 @@ copy_private_bfd_data (bfd *ibfd, bfd *obfd)
/* 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);
+ sections = bfd_malloc2 (section_count, sizeof (asection *));
if (sections == NULL)
return FALSE;
@@ -4946,8 +5618,7 @@ copy_private_bfd_data (bfd *ibfd, bfd *obfd)
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))
- )
+ IS_CONTAINED_BY_VMA (output_section, segment)))
{
if (matching_lma == 0)
matching_lma = output_section->lma;
@@ -4976,6 +5647,13 @@ copy_private_bfd_data (bfd *ibfd, bfd *obfd)
*pointer_to_map = map;
pointer_to_map = &map->next;
+ if (matching_lma != map->p_paddr
+ && !map->includes_filehdr && !map->includes_phdrs)
+ /* There is some padding before the first section in the
+ segment. So, we must account for that in the output
+ segment's vma. */
+ map->p_vaddr_offset = matching_lma - map->p_paddr;
+
free (sections);
continue;
}
@@ -5065,10 +5743,10 @@ copy_private_bfd_data (bfd *ibfd, bfd *obfd)
/* 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,
+ if ((BFD_ALIGN (prev_sec->lma + prev_sec->size,
maxpagesize)
< BFD_ALIGN (output_section->lma, maxpagesize))
- || ((prev_sec->lma + prev_sec->_raw_size)
+ || ((prev_sec->lma + prev_sec->size)
> output_section->lma))
{
if (suggested_lma == 0)
@@ -5153,43 +5831,286 @@ copy_private_bfd_data (bfd *ibfd, bfd *obfd)
-= (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 IS_SECTION_IN_INPUT_SEGMENT
#undef INCLUDE_SECTION_IN_SEGMENT
#undef SEGMENT_AFTER_SEGMENT
#undef SEGMENT_OVERLAPS
return TRUE;
}
+/* Copy ELF program header information. */
+
+static bfd_boolean
+copy_elf_program_header (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;
+ unsigned int i;
+ unsigned int num_segments;
+ bfd_boolean phdr_included = FALSE;
+
+ iehdr = elf_elfheader (ibfd);
+
+ map_first = NULL;
+ pointer_to_map = &map_first;
+
+ num_segments = elf_elfheader (ibfd)->e_phnum;
+ for (i = 0, segment = elf_tdata (ibfd)->phdr;
+ i < num_segments;
+ i++, segment++)
+ {
+ asection *section;
+ unsigned int section_count;
+ bfd_size_type amt;
+ Elf_Internal_Shdr *this_hdr;
+ asection *first_section = NULL;
+
+ /* FIXME: Do we need to copy PT_NULL segment? */
+ if (segment->p_type == PT_NULL)
+ continue;
+
+ /* Compute how many sections are in this segment. */
+ for (section = ibfd->sections, section_count = 0;
+ section != NULL;
+ section = section->next)
+ {
+ this_hdr = &(elf_section_data(section)->this_hdr);
+ if (ELF_IS_SECTION_IN_SEGMENT_FILE (this_hdr, segment))
+ {
+ if (!first_section)
+ first_section = section;
+ section_count++;
+ }
+ }
+
+ /* Allocate a segment map big enough to contain
+ all of the sections we have selected. */
+ amt = sizeof (struct elf_segment_map);
+ if (section_count != 0)
+ amt += ((bfd_size_type) section_count - 1) * sizeof (asection *);
+ map = bfd_zalloc (obfd, amt);
+ if (map == NULL)
+ return FALSE;
+
+ /* Initialize the fields of the output segment map with the
+ input segment. */
+ 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;
+ map->p_align = segment->p_align;
+ map->p_align_valid = 1;
+ map->p_vaddr_offset = 0;
+
+ /* 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 (!map->includes_phdrs && !map->includes_filehdr)
+ /* There is some other padding before the first section. */
+ map->p_vaddr_offset = ((first_section ? first_section->lma : 0)
+ - segment->p_paddr);
+
+ if (section_count != 0)
+ {
+ unsigned int isec = 0;
+
+ for (section = first_section;
+ section != NULL;
+ section = section->next)
+ {
+ this_hdr = &(elf_section_data(section)->this_hdr);
+ if (ELF_IS_SECTION_IN_SEGMENT_FILE (this_hdr, segment))
+ {
+ map->sections[isec++] = section->output_section;
+ if (isec == section_count)
+ break;
+ }
+ }
+ }
+
+ map->count = section_count;
+ *pointer_to_map = map;
+ pointer_to_map = &map->next;
+ }
+
+ elf_tdata (obfd)->segment_map = map_first;
+ return TRUE;
+}
+
+/* Copy private BFD data. This copies or rewrites ELF program header
+ information. */
+
+static bfd_boolean
+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;
+
+ if (elf_tdata (ibfd)->phdr == NULL)
+ return TRUE;
+
+ if (ibfd->xvec == obfd->xvec)
+ {
+ /* Check to see if any sections in the input BFD
+ covered by ELF program header have changed. */
+ Elf_Internal_Phdr *segment;
+ asection *section, *osec;
+ unsigned int i, num_segments;
+ Elf_Internal_Shdr *this_hdr;
+
+ /* Initialize the segment mark field. */
+ for (section = obfd->sections; section != NULL;
+ section = section->next)
+ section->segment_mark = FALSE;
+
+ num_segments = elf_elfheader (ibfd)->e_phnum;
+ for (i = 0, segment = elf_tdata (ibfd)->phdr;
+ i < num_segments;
+ i++, segment++)
+ {
+ /* PR binutils/3535. The Solaris linker always sets the p_paddr
+ and p_memsz fields of special segments (DYNAMIC, INTERP) to 0
+ which severly confuses things, so always regenerate the segment
+ map in this case. */
+ if (segment->p_paddr == 0
+ && segment->p_memsz == 0
+ && (segment->p_type == PT_INTERP || segment->p_type == PT_DYNAMIC))
+ goto rewrite;
+
+ for (section = ibfd->sections;
+ section != NULL; section = section->next)
+ {
+ /* We mark the output section so that we know it comes
+ from the input BFD. */
+ osec = section->output_section;
+ if (osec)
+ osec->segment_mark = TRUE;
+
+ /* Check if this section is covered by the segment. */
+ this_hdr = &(elf_section_data(section)->this_hdr);
+ if (ELF_IS_SECTION_IN_SEGMENT_FILE (this_hdr, segment))
+ {
+ /* FIXME: Check if its output section is changed or
+ removed. What else do we need to check? */
+ if (osec == NULL
+ || section->flags != osec->flags
+ || section->lma != osec->lma
+ || section->vma != osec->vma
+ || section->size != osec->size
+ || section->rawsize != osec->rawsize
+ || section->alignment_power != osec->alignment_power)
+ goto rewrite;
+ }
+ }
+ }
+
+ /* Check to see if any output section do not come from the
+ input BFD. */
+ for (section = obfd->sections; section != NULL;
+ section = section->next)
+ {
+ if (section->segment_mark == FALSE)
+ goto rewrite;
+ else
+ section->segment_mark = FALSE;
+ }
+
+ return copy_elf_program_header (ibfd, obfd);
+ }
+
+rewrite:
+ return rewrite_elf_program_header (ibfd, obfd);
+}
+
+/* Initialize private output section information from input section. */
+
+bfd_boolean
+_bfd_elf_init_private_section_data (bfd *ibfd,
+ asection *isec,
+ bfd *obfd,
+ asection *osec,
+ struct bfd_link_info *link_info)
+
+{
+ Elf_Internal_Shdr *ihdr, *ohdr;
+ bfd_boolean need_group = link_info == NULL || link_info->relocatable;
+
+ if (ibfd->xvec->flavour != bfd_target_elf_flavour
+ || obfd->xvec->flavour != bfd_target_elf_flavour)
+ return TRUE;
+
+ /* Don't copy the output ELF section type from input if the
+ output BFD section flags have been set to something different.
+ elf_fake_sections will set ELF section type based on BFD
+ section flags. */
+ if (elf_section_type (osec) == SHT_NULL
+ && (osec->flags == isec->flags || !osec->flags))
+ elf_section_type (osec) = elf_section_type (isec);
+
+ /* FIXME: Is this correct for all OS/PROC specific flags? */
+ elf_section_flags (osec) |= (elf_section_flags (isec)
+ & (SHF_MASKOS | SHF_MASKPROC));
+
+ /* Set things up for objcopy and relocatable link. The output
+ SHT_GROUP section will have its elf_next_in_group pointing back
+ to the input group members. Ignore linker created group section.
+ See elfNN_ia64_object_p in elfxx-ia64.c. */
+ if (need_group)
+ {
+ if (elf_sec_group (isec) == NULL
+ || (elf_sec_group (isec)->flags & SEC_LINKER_CREATED) == 0)
+ {
+ if (elf_section_flags (isec) & SHF_GROUP)
+ elf_section_flags (osec) |= SHF_GROUP;
+ elf_next_in_group (osec) = elf_next_in_group (isec);
+ elf_group_name (osec) = elf_group_name (isec);
+ }
+ }
+
+ ihdr = &elf_section_data (isec)->this_hdr;
+
+ /* We need to handle elf_linked_to_section for SHF_LINK_ORDER. We
+ don't use the output section of the linked-to section since it
+ may be NULL at this point. */
+ if ((ihdr->sh_flags & SHF_LINK_ORDER) != 0)
+ {
+ ohdr = &elf_section_data (osec)->this_hdr;
+ ohdr->sh_flags |= SHF_LINK_ORDER;
+ elf_linked_to_section (osec) = elf_linked_to_section (isec);
+ }
+
+ osec->use_rela_p = isec->use_rela_p;
+
+ return TRUE;
+}
+
/* Copy private section information. This copies over the entsize
field, and sometimes the info field. */
@@ -5205,24 +6126,6 @@ _bfd_elf_copy_private_section_data (bfd *ibfd,
|| 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;
@@ -5234,13 +6137,52 @@ _bfd_elf_copy_private_section_data (bfd *ibfd,
|| 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);
+ return _bfd_elf_init_private_section_data (ibfd, isec, obfd, osec,
+ NULL);
+}
- osec->use_rela_p = isec->use_rela_p;
+/* Copy private header information. */
+
+bfd_boolean
+_bfd_elf_copy_private_header_data (bfd *ibfd, bfd *obfd)
+{
+ asection *isec;
+
+ if (bfd_get_flavour (ibfd) != bfd_target_elf_flavour
+ || bfd_get_flavour (obfd) != bfd_target_elf_flavour)
+ return TRUE;
+
+ /* Copy over private BFD data if it has not already been copied.
+ This must be done here, rather than in the copy_private_bfd_data
+ entry point, because the latter is called after the section
+ contents have been set, which means that the program headers have
+ already been worked out. */
+ if (elf_tdata (obfd)->segment_map == NULL && elf_tdata (ibfd)->phdr != NULL)
+ {
+ if (! copy_private_bfd_data (ibfd, obfd))
+ return FALSE;
+ }
+
+ /* _bfd_elf_copy_private_section_data copied over the SHF_GROUP flag
+ but this might be wrong if we deleted the group section. */
+ for (isec = ibfd->sections; isec != NULL; isec = isec->next)
+ if (elf_section_type (isec) == SHT_GROUP
+ && isec->output_section == NULL)
+ {
+ asection *first = elf_next_in_group (isec);
+ asection *s = first;
+ while (s != NULL)
+ {
+ if (s->output_section != NULL)
+ {
+ elf_section_flags (s->output_section) &= ~SHF_GROUP;
+ elf_group_name (s->output_section) = NULL;
+ }
+ s = elf_next_in_group (s);
+ if (s == first)
+ break;
+ }
+ }
return TRUE;
}
@@ -5309,8 +6251,8 @@ swap_out_syms (bfd *abfd,
Elf_Internal_Shdr *symtab_hdr;
Elf_Internal_Shdr *symtab_shndx_hdr;
Elf_Internal_Shdr *symstrtab_hdr;
- char *outbound_syms;
- char *outbound_shndx;
+ bfd_byte *outbound_syms;
+ bfd_byte *outbound_shndx;
int idx;
bfd_size_type amt;
bfd_boolean name_local_sections;
@@ -5335,8 +6277,7 @@ swap_out_syms (bfd *abfd,
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);
+ outbound_syms = bfd_alloc2 (abfd, 1 + symcount, bed->s->sizeof_sym);
if (outbound_syms == NULL)
{
_bfd_stringtab_free (stt);
@@ -5349,7 +6290,8 @@ swap_out_syms (bfd *abfd,
if (symtab_shndx_hdr->sh_name != 0)
{
amt = (bfd_size_type) (1 + symcount) * sizeof (Elf_External_Sym_Shndx);
- outbound_shndx = bfd_zalloc (abfd, amt);
+ outbound_shndx = bfd_zalloc2 (abfd, 1 + symcount,
+ sizeof (Elf_External_Sym_Shndx));
if (outbound_shndx == NULL)
{
_bfd_stringtab_free (stt);
@@ -5514,6 +6456,10 @@ Unable to find equivalent output section for symbol '%s' from section '%s'"),
type = STT_FUNC;
else if ((flags & BSF_OBJECT) != 0)
type = STT_OBJECT;
+ else if ((flags & BSF_RELC) != 0)
+ type = STT_RELC;
+ else if ((flags & BSF_SRELC) != 0)
+ type = STT_SRELC;
else
type = STT_NOTYPE;
@@ -5677,10 +6623,10 @@ _bfd_elf_canonicalize_dynamic_symtab (bfd *abfd,
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. */
+/* Return the size required for the dynamic reloc entries. Any loadable
+ 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)
@@ -5696,23 +6642,23 @@ _bfd_elf_get_dynamic_reloc_upper_bound (bfd *abfd)
ret = sizeof (arelent *);
for (s = abfd->sections; s != NULL; s = s->next)
- if (elf_section_data (s)->this_hdr.sh_link == elf_dynsymtab (abfd)
+ if ((s->flags & SEC_LOAD) != 0
+ && 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)
+ ret += ((s->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. */
+/* 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 loadable 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,
@@ -5733,7 +6679,8 @@ _bfd_elf_canonicalize_dynamic_reloc (bfd *abfd,
ret = 0;
for (s = abfd->sections; s != NULL; s = s->next)
{
- if (elf_section_data (s)->this_hdr.sh_link == elf_dynsymtab (abfd)
+ if ((s->flags & SEC_LOAD) != 0
+ && 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))
{
@@ -5742,7 +6689,7 @@ _bfd_elf_canonicalize_dynamic_reloc (bfd *abfd,
if (! (*slurp_relocs) (abfd, s, syms, TRUE))
return -1;
- count = s->_raw_size / elf_section_data (s)->this_hdr.sh_entsize;
+ count = s->size / elf_section_data (s)->this_hdr.sh_entsize;
p = s->relocation;
for (i = 0; i < count; i++)
*storage++ = p++;
@@ -5758,10 +6705,123 @@ _bfd_elf_canonicalize_dynamic_reloc (bfd *abfd,
/* Read in the version information. */
bfd_boolean
-_bfd_elf_slurp_version_tables (bfd *abfd)
+_bfd_elf_slurp_version_tables (bfd *abfd, bfd_boolean default_imported_symver)
{
bfd_byte *contents = NULL;
- bfd_size_type amt;
+ unsigned int freeidx = 0;
+
+ if (elf_dynverref (abfd) != 0)
+ {
+ Elf_Internal_Shdr *hdr;
+ Elf_External_Verneed *everneed;
+ Elf_Internal_Verneed *iverneed;
+ unsigned int i;
+ bfd_byte *contents_end;
+
+ hdr = &elf_tdata (abfd)->dynverref_hdr;
+
+ elf_tdata (abfd)->verref = bfd_zalloc2 (abfd, hdr->sh_info,
+ sizeof (Elf_Internal_Verneed));
+ 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)
+ {
+error_return_verref:
+ elf_tdata (abfd)->verref = NULL;
+ elf_tdata (abfd)->cverrefs = 0;
+ 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_verref;
+
+ if (hdr->sh_info && hdr->sh_size < sizeof (Elf_External_Verneed))
+ goto error_return_verref;
+
+ BFD_ASSERT (sizeof (Elf_External_Verneed)
+ == sizeof (Elf_External_Vernaux));
+ contents_end = contents + hdr->sh_size - sizeof (Elf_External_Verneed);
+ 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_verref;
+
+ if (iverneed->vn_cnt == 0)
+ iverneed->vn_auxptr = NULL;
+ else
+ {
+ iverneed->vn_auxptr = bfd_alloc2 (abfd, iverneed->vn_cnt,
+ sizeof (Elf_Internal_Vernaux));
+ if (iverneed->vn_auxptr == NULL)
+ goto error_return_verref;
+ }
+
+ if (iverneed->vn_aux
+ > (size_t) (contents_end - (bfd_byte *) everneed))
+ goto error_return_verref;
+
+ 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_verref;
+
+ if (j + 1 < iverneed->vn_cnt)
+ ivernaux->vna_nextptr = ivernaux + 1;
+ else
+ ivernaux->vna_nextptr = NULL;
+
+ if (ivernaux->vna_next
+ > (size_t) (contents_end - (bfd_byte *) evernaux))
+ goto error_return_verref;
+
+ evernaux = ((Elf_External_Vernaux *)
+ ((bfd_byte *) evernaux + ivernaux->vna_next));
+
+ if (ivernaux->vna_other > freeidx)
+ freeidx = ivernaux->vna_other;
+ }
+
+ if (i + 1 < hdr->sh_info)
+ iverneed->vn_nextref = iverneed + 1;
+ else
+ iverneed->vn_nextref = NULL;
+
+ if (iverneed->vn_next
+ > (size_t) (contents_end - (bfd_byte *) everneed))
+ goto error_return_verref;
+
+ everneed = ((Elf_External_Verneed *)
+ ((bfd_byte *) everneed + iverneed->vn_next));
+ }
+
+ free (contents);
+ contents = NULL;
+ }
if (elf_dynverdef (abfd) != 0)
{
@@ -5772,6 +6832,7 @@ _bfd_elf_slurp_version_tables (bfd *abfd)
Elf_Internal_Verdef iverdefmem;
unsigned int i;
unsigned int maxidx;
+ bfd_byte *contents_end_def, *contents_end_aux;
hdr = &elf_tdata (abfd)->dynverdef_hdr;
@@ -5782,6 +6843,16 @@ _bfd_elf_slurp_version_tables (bfd *abfd)
|| bfd_bread (contents, hdr->sh_size, abfd) != hdr->sh_size)
goto error_return;
+ if (hdr->sh_info && hdr->sh_size < sizeof (Elf_External_Verdef))
+ goto error_return;
+
+ BFD_ASSERT (sizeof (Elf_External_Verdef)
+ >= sizeof (Elf_External_Verdaux));
+ contents_end_def = contents + hdr->sh_size
+ - sizeof (Elf_External_Verdef);
+ contents_end_aux = contents + hdr->sh_size
+ - sizeof (Elf_External_Verdaux);
+
/* 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. */
@@ -5794,12 +6865,23 @@ _bfd_elf_slurp_version_tables (bfd *abfd)
if ((iverdefmem.vd_ndx & ((unsigned) VERSYM_VERSION)) > maxidx)
maxidx = iverdefmem.vd_ndx & ((unsigned) VERSYM_VERSION);
+ if (iverdefmem.vd_next
+ > (size_t) (contents_end_def - (bfd_byte *) everdef))
+ goto error_return;
+
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 (default_imported_symver)
+ {
+ if (freeidx > maxidx)
+ maxidx = ++freeidx;
+ else
+ freeidx = ++maxidx;
+ }
+ elf_tdata (abfd)->verdef = bfd_zalloc2 (abfd, maxidx,
+ sizeof (Elf_Internal_Verdef));
if (elf_tdata (abfd)->verdef == NULL)
goto error_return;
@@ -5815,15 +6897,32 @@ _bfd_elf_slurp_version_tables (bfd *abfd)
_bfd_elf_swap_verdef_in (abfd, everdef, &iverdefmem);
+ if ((iverdefmem.vd_ndx & VERSYM_VERSION) == 0)
+ {
+error_return_verdef:
+ elf_tdata (abfd)->verdef = NULL;
+ elf_tdata (abfd)->cverdefs = 0;
+ goto error_return;
+ }
+
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;
+ if (iverdef->vd_cnt == 0)
+ iverdef->vd_auxptr = NULL;
+ else
+ {
+ iverdef->vd_auxptr = bfd_alloc2 (abfd, iverdef->vd_cnt,
+ sizeof (Elf_Internal_Verdaux));
+ if (iverdef->vd_auxptr == NULL)
+ goto error_return_verdef;
+ }
+
+ if (iverdef->vd_aux
+ > (size_t) (contents_end_aux - (bfd_byte *) everdef))
+ goto error_return_verdef;
everdaux = ((Elf_External_Verdaux *)
((bfd_byte *) everdef + iverdef->vd_aux));
@@ -5836,20 +6935,25 @@ _bfd_elf_slurp_version_tables (bfd *abfd)
bfd_elf_string_from_elf_section (abfd, hdr->sh_link,
iverdaux->vda_name);
if (iverdaux->vda_nodename == NULL)
- goto error_return;
+ goto error_return_verdef;
if (j + 1 < iverdef->vd_cnt)
iverdaux->vda_nextptr = iverdaux + 1;
else
iverdaux->vda_nextptr = NULL;
+ if (iverdaux->vda_next
+ > (size_t) (contents_end_aux - (bfd_byte *) everdaux))
+ goto error_return_verdef;
+
everdaux = ((Elf_External_Verdaux *)
((bfd_byte *) everdaux + iverdaux->vda_next));
}
- iverdef->vd_nodename = iverdef->vd_auxptr->vda_nodename;
+ if (iverdef->vd_cnt)
+ iverdef->vd_nodename = iverdef->vd_auxptr->vda_nodename;
- if (i + 1 < hdr->sh_info)
+ if ((size_t) (iverdef - iverdefarr) + 1 < maxidx)
iverdef->vd_nextdef = iverdef + 1;
else
iverdef->vd_nextdef = NULL;
@@ -5861,85 +6965,47 @@ _bfd_elf_slurp_version_tables (bfd *abfd)
free (contents);
contents = NULL;
}
-
- if (elf_dynverref (abfd) != 0)
+ else if (default_imported_symver)
{
- 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;
+ if (freeidx < 3)
+ freeidx = 3;
+ else
+ freeidx++;
- 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)
+ elf_tdata (abfd)->verdef = bfd_zalloc2 (abfd, freeidx,
+ sizeof (Elf_Internal_Verdef));
+ if (elf_tdata (abfd)->verdef == NULL)
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);
+ elf_tdata (abfd)->cverdefs = freeidx;
+ }
- ivernaux->vna_nodename =
- bfd_elf_string_from_elf_section (abfd, hdr->sh_link,
- ivernaux->vna_name);
- if (ivernaux->vna_nodename == NULL)
- goto error_return;
+ /* Create a default version based on the soname. */
+ if (default_imported_symver)
+ {
+ Elf_Internal_Verdef *iverdef;
+ Elf_Internal_Verdaux *iverdaux;
- if (j + 1 < iverneed->vn_cnt)
- ivernaux->vna_nextptr = ivernaux + 1;
- else
- ivernaux->vna_nextptr = NULL;
+ iverdef = &elf_tdata (abfd)->verdef[freeidx - 1];;
- evernaux = ((Elf_External_Vernaux *)
- ((bfd_byte *) evernaux + ivernaux->vna_next));
- }
+ iverdef->vd_version = VER_DEF_CURRENT;
+ iverdef->vd_flags = 0;
+ iverdef->vd_ndx = freeidx;
+ iverdef->vd_cnt = 1;
- if (i + 1 < hdr->sh_info)
- iverneed->vn_nextref = iverneed + 1;
- else
- iverneed->vn_nextref = NULL;
+ iverdef->vd_bfd = abfd;
- everneed = ((Elf_External_Verneed *)
- ((bfd_byte *) everneed + iverneed->vn_next));
- }
+ iverdef->vd_nodename = bfd_elf_get_dt_soname (abfd);
+ if (iverdef->vd_nodename == NULL)
+ goto error_return_verdef;
+ iverdef->vd_nextdef = NULL;
+ iverdef->vd_auxptr = bfd_alloc (abfd, sizeof (Elf_Internal_Verdaux));
+ if (iverdef->vd_auxptr == NULL)
+ goto error_return_verdef;
- free (contents);
- contents = NULL;
+ iverdaux = iverdef->vd_auxptr;
+ iverdaux->vda_nodename = iverdef->vd_nodename;
+ iverdaux->vda_nextptr = NULL;
}
return TRUE;
@@ -6038,13 +7104,24 @@ elf_find_function (bfd *abfd ATTRIBUTE_UNUSED,
const char **functionname_ptr)
{
const char *filename;
- asymbol *func;
+ asymbol *func, *file;
bfd_vma low_func;
asymbol **p;
+ /* ??? Given multiple file symbols, it is impossible to reliably
+ choose the right file name for global symbols. File symbols are
+ local symbols, and thus all file symbols must sort before any
+ global symbols. The ELF spec may be interpreted to say that a
+ file symbol must sort before other local symbols, but currently
+ ld -r doesn't do this. So, for ld -r output, it is possible to
+ make a better choice of file name for local symbols by ignoring
+ file symbols appearing after a given local symbol. */
+ enum { nothing_seen, symbol_seen, file_after_symbol_seen } state;
filename = NULL;
func = NULL;
+ file = NULL;
low_func = 0;
+ state = nothing_seen;
for (p = symbols; *p != NULL; p++)
{
@@ -6052,27 +7129,33 @@ elf_find_function (bfd *abfd ATTRIBUTE_UNUSED,
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;
+ file = &q->symbol;
+ if (state == symbol_seen)
+ state = file_after_symbol_seen;
+ continue;
case STT_NOTYPE:
case STT_FUNC:
- if (q->symbol.section == section
+ if (bfd_get_section (&q->symbol) == section
&& q->symbol.value >= low_func
&& q->symbol.value <= offset)
{
func = (asymbol *) q;
low_func = q->symbol.value;
+ filename = NULL;
+ if (file != NULL
+ && (ELF_ST_BIND (q->internal_elf_sym.st_info) == STB_LOCAL
+ || state != file_after_symbol_seen))
+ filename = bfd_asymbol_name (file);
}
break;
}
+ if (state == nothing_seen)
+ state = symbol_seen;
}
if (func == NULL)
@@ -6144,14 +7227,62 @@ _bfd_elf_find_nearest_line (bfd *abfd,
return TRUE;
}
+/* Find the line for a symbol. */
+
+bfd_boolean
+_bfd_elf_find_line (bfd *abfd, asymbol **symbols, asymbol *symbol,
+ const char **filename_ptr, unsigned int *line_ptr)
+{
+ return _bfd_dwarf2_find_line (abfd, symbols, symbol,
+ filename_ptr, line_ptr, 0,
+ &elf_tdata (abfd)->dwarf2_find_line_info);
+}
+
+/* After a call to bfd_find_nearest_line, successive calls to
+ bfd_find_inliner_info can be used to get source information about
+ each level of function inlining that terminated at the address
+ passed to bfd_find_nearest_line. Currently this is only supported
+ for DWARF2 with appropriate DWARF3 extensions. */
+
+bfd_boolean
+_bfd_elf_find_inliner_info (bfd *abfd,
+ const char **filename_ptr,
+ const char **functionname_ptr,
+ unsigned int *line_ptr)
+{
+ bfd_boolean found;
+ found = _bfd_dwarf2_find_inliner_info (abfd, filename_ptr,
+ functionname_ptr, line_ptr,
+ & elf_tdata (abfd)->dwarf2_find_line_info);
+ return found;
+}
+
int
-_bfd_elf_sizeof_headers (bfd *abfd, bfd_boolean reloc)
+_bfd_elf_sizeof_headers (bfd *abfd, struct bfd_link_info *info)
{
- int ret;
+ const struct elf_backend_data *bed = get_elf_backend_data (abfd);
+ int ret = bed->s->sizeof_ehdr;
+
+ if (!info->relocatable)
+ {
+ bfd_size_type phdr_size = elf_tdata (abfd)->program_header_size;
+
+ if (phdr_size == (bfd_size_type) -1)
+ {
+ struct elf_segment_map *m;
+
+ phdr_size = 0;
+ for (m = elf_tdata (abfd)->segment_map; m != NULL; m = m->next)
+ phdr_size += bed->s->sizeof_phdr;
+
+ if (phdr_size == 0)
+ phdr_size = get_program_header_size (abfd, info);
+ }
+
+ elf_tdata (abfd)->program_header_size = phdr_size;
+ ret += phdr_size;
+ }
- ret = get_elf_backend_data (abfd)->s->sizeof_ehdr;
- if (! reloc)
- ret += get_program_header_size (abfd);
return ret;
}
@@ -6276,8 +7407,8 @@ _bfd_elf_validate_reloc (bfd *abfd, arelent *areloc)
fail:
(*_bfd_error_handler)
- (_("%s: unsupported relocation type %s"),
- bfd_archive_filename (abfd), areloc->howto->name);
+ (_("%B: unsupported relocation type %s"),
+ abfd, areloc->howto->name);
bfd_set_error (bfd_error_bad_value);
return FALSE;
}
@@ -6287,8 +7418,9 @@ _bfd_elf_close_and_cleanup (bfd *abfd)
{
if (bfd_get_format (abfd) == bfd_object)
{
- if (elf_shstrtab (abfd) != NULL)
+ if (elf_tdata (abfd) != NULL && elf_shstrtab (abfd) != NULL)
_bfd_elf_strtab_free (elf_shstrtab (abfd));
+ _bfd_dwarf2_cleanup_debug_info (abfd);
}
return _bfd_generic_close_and_cleanup (abfd);
@@ -6346,13 +7478,12 @@ elfcore_maybe_make_sect (bfd *abfd, char *name, asection *sect)
if (bfd_get_section_by_name (abfd, name) != NULL)
return TRUE;
- sect2 = bfd_make_section (abfd, name);
+ sect2 = bfd_make_section_with_flags (abfd, name, sect->flags);
if (sect2 == NULL)
return FALSE;
- sect2->_raw_size = sect->_raw_size;
+ sect2->size = sect->size;
sect2->filepos = sect->filepos;
- sect2->flags = sect->flags;
sect2->alignment_power = sect->alignment_power;
return TRUE;
}
@@ -6384,12 +7515,12 @@ _bfd_elfcore_make_pseudosection (bfd *abfd,
return FALSE;
memcpy (threaded_name, buf, len);
- sect = bfd_make_section_anyway (abfd, threaded_name);
+ sect = bfd_make_section_anyway_with_flags (abfd, threaded_name,
+ SEC_HAS_CONTENTS);
if (sect == NULL)
return FALSE;
- sect->_raw_size = size;
+ sect->size = size;
sect->filepos = filepos;
- sect->flags = SEC_HAS_CONTENTS;
sect->alignment_power = 2;
return elfcore_maybe_make_sect (abfd, name, sect);
@@ -6406,14 +7537,14 @@ _bfd_elfcore_make_pseudosection (bfd *abfd,
static bfd_boolean
elfcore_grok_prstatus (bfd *abfd, Elf_Internal_Note *note)
{
- size_t raw_size;
+ size_t size;
int offset;
if (note->descsz == sizeof (prstatus_t))
{
prstatus_t prstat;
- raw_size = sizeof (prstat.pr_reg);
+ size = sizeof (prstat.pr_reg);
offset = offsetof (prstatus_t, pr_reg);
memcpy (&prstat, note->descdata, sizeof (prstat));
@@ -6439,7 +7570,7 @@ elfcore_grok_prstatus (bfd *abfd, Elf_Internal_Note *note)
/* 64-bit host, 32-bit corefile */
prstatus32_t prstat;
- raw_size = sizeof (prstat.pr_reg);
+ size = sizeof (prstat.pr_reg);
offset = offsetof (prstatus32_t, pr_reg);
memcpy (&prstat, note->descdata, sizeof (prstat));
@@ -6469,7 +7600,7 @@ elfcore_grok_prstatus (bfd *abfd, Elf_Internal_Note *note)
/* Make a ".reg/999" section and a ".reg" section. */
return _bfd_elfcore_make_pseudosection (abfd, ".reg",
- raw_size, note->descpos + offset);
+ size, note->descpos + offset);
}
#endif /* defined (HAVE_PRSTATUS_T) */
@@ -6678,22 +7809,21 @@ elfcore_grok_lwpstatus (bfd *abfd, Elf_Internal_Note *note)
return FALSE;
memcpy (name, buf, len);
- sect = bfd_make_section_anyway (abfd, name);
+ sect = bfd_make_section_anyway_with_flags (abfd, name, SEC_HAS_CONTENTS);
if (sect == NULL)
return FALSE;
#if defined (HAVE_LWPSTATUS_T_PR_CONTEXT)
- sect->_raw_size = sizeof (lwpstat.pr_context.uc_mcontext.gregs);
+ sect->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->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))
@@ -6708,22 +7838,21 @@ elfcore_grok_lwpstatus (bfd *abfd, Elf_Internal_Note *note)
return FALSE;
memcpy (name, buf, len);
- sect = bfd_make_section_anyway (abfd, name);
+ sect = bfd_make_section_anyway_with_flags (abfd, name, SEC_HAS_CONTENTS);
if (sect == NULL)
return FALSE;
#if defined (HAVE_LWPSTATUS_T_PR_CONTEXT)
- sect->_raw_size = sizeof (lwpstat.pr_context.uc_mcontext.fpregs);
+ sect->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->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);
@@ -6755,7 +7884,7 @@ elfcore_grok_win32pstatus (bfd *abfd, Elf_Internal_Note *note)
case NOTE_INFO_THREAD:
/* Make a ".reg/999" section. */
- sprintf (buf, ".reg/%d", pstatus.data.thread_info.tid);
+ sprintf (buf, ".reg/%ld", (long) pstatus.data.thread_info.tid);
len = strlen (buf) + 1;
name = bfd_alloc (abfd, len);
@@ -6764,15 +7893,14 @@ elfcore_grok_win32pstatus (bfd *abfd, Elf_Internal_Note *note)
memcpy (name, buf, len);
- sect = bfd_make_section_anyway (abfd, name);
+ sect = bfd_make_section_anyway_with_flags (abfd, name, SEC_HAS_CONTENTS);
if (sect == NULL)
return FALSE;
- sect->_raw_size = sizeof (pstatus.data.thread_info.thread_context);
+ sect->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)
@@ -6782,7 +7910,8 @@ elfcore_grok_win32pstatus (bfd *abfd, Elf_Internal_Note *note)
case NOTE_INFO_MODULE:
/* Make a ".module/xxxxxxxx" section. */
- sprintf (buf, ".module/%08x", pstatus.data.module_info.base_address);
+ sprintf (buf, ".module/%08lx",
+ (long) pstatus.data.module_info.base_address);
len = strlen (buf) + 1;
name = bfd_alloc (abfd, len);
@@ -6791,14 +7920,13 @@ elfcore_grok_win32pstatus (bfd *abfd, Elf_Internal_Note *note)
memcpy (name, buf, len);
- sect = bfd_make_section_anyway (abfd, name);
+ sect = bfd_make_section_anyway_with_flags (abfd, name, SEC_HAS_CONTENTS);
if (sect == NULL)
return FALSE;
- sect->_raw_size = note->descsz;
+ sect->size = note->descsz;
sect->filepos = note->descpos;
- sect->flags = SEC_HAS_CONTENTS;
sect->alignment_power = 2;
break;
@@ -6868,13 +7996,13 @@ elfcore_grok_note (bfd *abfd, Elf_Internal_Note *note)
case NT_AUXV:
{
- asection *sect = bfd_make_section_anyway (abfd, ".auxv");
+ asection *sect = bfd_make_section_anyway_with_flags (abfd, ".auxv",
+ SEC_HAS_CONTENTS);
if (sect == NULL)
return FALSE;
- sect->_raw_size = note->descsz;
+ sect->size = note->descsz;
sect->filepos = note->descpos;
- sect->flags = SEC_HAS_CONTENTS;
sect->alignment_power = 1 + bfd_get_arch_size (abfd) / 32;
return TRUE;
@@ -6905,7 +8033,6 @@ elfcore_netbsd_get_lwpid (Elf_Internal_Note *note, int *lwpidp)
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);
@@ -6933,9 +8060,9 @@ elfcore_grok_netbsd_note (bfd *abfd, Elf_Internal_Note *note)
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. */
+ 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);
}
@@ -6951,44 +8078,44 @@ elfcore_grok_netbsd_note (bfd *abfd, Elf_Internal_Note *note)
switch (bfd_get_arch (abfd))
{
- /* On the Alpha, SPARC (32-bit and 64-bit), PT_GETREGS == mach+0 and
- PT_GETFPREGS == mach+2. */
+ /* 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+0:
+ return elfcore_make_note_pseudosection (abfd, ".reg", note);
- case NT_NETBSDCORE_FIRSTMACH+2:
- return elfcore_make_note_pseudosection (abfd, ".reg2", note);
+ case NT_NETBSDCORE_FIRSTMACH+2:
+ return elfcore_make_note_pseudosection (abfd, ".reg2", note);
- default:
- return TRUE;
- }
+ default:
+ return TRUE;
+ }
- /* On all other arch's, PT_GETREGS == mach+1 and
- PT_GETFPREGS == mach+3. */
+ /* 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+1:
+ return elfcore_make_note_pseudosection (abfd, ".reg", note);
- case NT_NETBSDCORE_FIRSTMACH+3:
- return elfcore_make_note_pseudosection (abfd, ".reg2", note);
+ case NT_NETBSDCORE_FIRSTMACH+3:
+ return elfcore_make_note_pseudosection (abfd, ".reg2", note);
- default:
- return TRUE;
- }
+ default:
+ return TRUE;
+ }
}
/* NOTREACHED */
}
static bfd_boolean
-elfcore_grok_nto_status (bfd *abfd, Elf_Internal_Note *note, pid_t *tid)
+elfcore_grok_nto_status (bfd *abfd, Elf_Internal_Note *note, long *tid)
{
void *ddata = note->descdata;
char buf[100];
@@ -7020,52 +8147,53 @@ elfcore_grok_nto_status (bfd *abfd, Elf_Internal_Note *note, pid_t *tid)
elf_tdata (abfd)->core_lwpid = *tid;
/* Make a ".qnx_core_status/%d" section. */
- sprintf (buf, ".qnx_core_status/%d", *tid);
+ sprintf (buf, ".qnx_core_status/%ld", *tid);
name = bfd_alloc (abfd, strlen (buf) + 1);
if (name == NULL)
return FALSE;
strcpy (name, buf);
- sect = bfd_make_section_anyway (abfd, name);
+ sect = bfd_make_section_anyway_with_flags (abfd, name, SEC_HAS_CONTENTS);
if (sect == NULL)
return FALSE;
- sect->_raw_size = note->descsz;
+ sect->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)
+elfcore_grok_nto_regs (bfd *abfd,
+ Elf_Internal_Note *note,
+ long tid,
+ char *base)
{
char buf[100];
char *name;
asection *sect;
- /* Make a ".reg/%d" section. */
- sprintf (buf, ".reg/%d", tid);
+ /* Make a "(base)/%d" section. */
+ sprintf (buf, "%s/%ld", base, tid);
name = bfd_alloc (abfd, strlen (buf) + 1);
if (name == NULL)
return FALSE;
strcpy (name, buf);
- sect = bfd_make_section_anyway (abfd, name);
+ sect = bfd_make_section_anyway_with_flags (abfd, name, SEC_HAS_CONTENTS);
if (sect == NULL)
return FALSE;
- sect->_raw_size = note->descsz;
+ sect->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 elfcore_maybe_make_sect (abfd, base, sect);
return TRUE;
}
@@ -7081,60 +8209,62 @@ 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;
+ static long 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;
+ 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_regs (abfd, note, tid, ".reg");
+ case BFD_QNT_CORE_FPREG:
+ return elfcore_grok_nto_regs (abfd, note, tid, ".reg2");
+ default:
+ return TRUE;
}
}
/* Function: elfcore_write_note
Inputs:
- buffer to hold note
+ buffer to hold note, and current size of buffer
name of note
type of note
data for note
size of data for note
+ Writes note to end of buffer. ELF64 notes are written exactly as
+ for ELF32, despite the current (as of 2006) ELF gabi specifying
+ that they ought to have 8-byte namesz and descsz field, and have
+ 8-byte alignment. Other writers, eg. Linux kernel, do the same.
+
Return:
- End of buffer containing note. */
+ Pointer to realloc'd buffer, *BUFSIZ updated. */
char *
-elfcore_write_note (bfd *abfd,
+elfcore_write_note (bfd *abfd,
char *buf,
- int *bufsiz,
+ int *bufsiz,
const char *name,
- int type,
+ int type,
const void *input,
- int size)
+ int size)
{
Elf_External_Note *xnp;
size_t namesz;
- size_t pad;
size_t newspace;
- char *p, *dest;
+ char *dest;
namesz = 0;
- pad = 0;
if (name != NULL)
- {
- const struct elf_backend_data *bed;
+ namesz = strlen (name) + 1;
- namesz = strlen (name) + 1;
- bed = get_elf_backend_data (abfd);
- pad = -namesz & ((1 << bed->s->log_file_align) - 1);
- }
-
- newspace = 12 + namesz + pad + size;
+ newspace = 12 + ((namesz + 3) & -4) + ((size + 3) & -4);
- p = realloc (buf, *bufsiz + newspace);
- dest = p + *bufsiz;
+ buf = realloc (buf, *bufsiz + newspace);
+ dest = buf + *bufsiz;
*bufsiz += newspace;
xnp = (Elf_External_Note *) dest;
H_PUT_32 (abfd, namesz, xnp->namesz);
@@ -7145,14 +8275,20 @@ elfcore_write_note (bfd *abfd,
{
memcpy (dest, name, namesz);
dest += namesz;
- while (pad != 0)
+ while (namesz & 3)
{
*dest++ = '\0';
- --pad;
+ ++namesz;
}
}
memcpy (dest, input, size);
- return p;
+ dest += size;
+ while (size & 3)
+ {
+ *dest++ = '\0';
+ ++size;
+ }
+ return buf;
}
#if defined (HAVE_PRPSINFO_T) || defined (HAVE_PSINFO_T)
@@ -7163,22 +8299,52 @@ elfcore_write_prpsinfo (bfd *abfd,
const char *fname,
const char *psargs)
{
- int note_type;
- char *note_name = "CORE";
+ const char *note_name = "CORE";
+ const struct elf_backend_data *bed = get_elf_backend_data (abfd);
+ if (bed->elf_backend_write_core_note != NULL)
+ {
+ char *ret;
+ ret = (*bed->elf_backend_write_core_note) (abfd, buf, bufsiz,
+ NT_PRPSINFO, fname, psargs);
+ if (ret != NULL)
+ return ret;
+ }
+
+#if defined (HAVE_PRPSINFO32_T) || defined (HAVE_PSINFO32_T)
+ if (bed->s->elfclass == ELFCLASS32)
+ {
+#if defined (HAVE_PSINFO32_T)
+ psinfo32_t data;
+ int note_type = NT_PSINFO;
+#else
+ prpsinfo32_t data;
+ int 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));
+ }
+ else
+#endif
+ {
#if defined (HAVE_PSINFO_T)
- psinfo_t data;
- note_type = NT_PSINFO;
+ psinfo_t data;
+ int note_type = NT_PSINFO;
#else
- prpsinfo_t data;
- note_type = NT_PRPSINFO;
+ prpsinfo_t data;
+ int 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));
+ 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 */
@@ -7191,15 +8357,43 @@ elfcore_write_prstatus (bfd *abfd,
int cursig,
const void *gregs)
{
- prstatus_t prstat;
- char *note_name = "CORE";
+ const char *note_name = "CORE";
+ const struct elf_backend_data *bed = get_elf_backend_data (abfd);
- 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));
+ if (bed->elf_backend_write_core_note != NULL)
+ {
+ char *ret;
+ ret = (*bed->elf_backend_write_core_note) (abfd, buf, bufsiz,
+ NT_PRSTATUS,
+ pid, cursig, gregs);
+ if (ret != NULL)
+ return ret;
+ }
+
+#if defined (HAVE_PRSTATUS32_T)
+ if (bed->s->elfclass == ELFCLASS32)
+ {
+ prstatus32_t prstat;
+
+ 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));
+ }
+ else
+#endif
+ {
+ prstatus_t prstat;
+
+ 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 */
@@ -7213,7 +8407,7 @@ elfcore_write_lwpstatus (bfd *abfd,
const void *gregs)
{
lwpstatus_t lwpstat;
- char *note_name = "CORE";
+ const char *note_name = "CORE";
memset (&lwpstat, 0, sizeof (lwpstat));
lwpstat.pr_lwpid = pid >> 16;
@@ -7240,17 +8434,34 @@ elfcore_write_pstatus (bfd *abfd,
char *buf,
int *bufsiz,
long pid,
- int cursig,
- const void *gregs)
+ int cursig ATTRIBUTE_UNUSED,
+ const void *gregs ATTRIBUTE_UNUSED)
{
- pstatus_t pstat;
- char *note_name = "CORE";
+ const char *note_name = "CORE";
+#if defined (HAVE_PSTATUS32_T)
+ const struct elf_backend_data *bed = get_elf_backend_data (abfd);
- 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;
+ if (bed->s->elfclass == ELFCLASS32)
+ {
+ pstatus32_t pstat;
+
+ 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;
+ }
+ else
+#endif
+ {
+ pstatus_t pstat;
+
+ 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 */
@@ -7261,7 +8472,7 @@ elfcore_write_prfpreg (bfd *abfd,
const void *fpregs,
int size)
{
- char *note_name = "CORE";
+ const char *note_name = "CORE";
return elfcore_write_note (abfd, buf, bufsiz,
note_name, NT_FPREGSET, fpregs, size);
}
@@ -7333,21 +8544,21 @@ elfcore_read_notes (bfd *abfd, file_ptr offset, bfd_size_type size)
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 (CONST_STRNEQ (in.namedata, "NetBSD-CORE"))
+ {
+ if (! elfcore_grok_netbsd_note (abfd, &in))
+ goto error;
+ }
+ else if (CONST_STRNEQ (in.namedata, "QNX"))
{
if (! elfcore_grok_nto_note (abfd, &in))
goto error;
}
else
- {
- if (! elfcore_grok_note (abfd, &in))
- goto error;
- }
+ {
+ if (! elfcore_grok_note (abfd, &in))
+ goto error;
+ }
p = in.descdata + BFD_ALIGN (in.descsz, 4);
}
@@ -7485,9 +8696,18 @@ _bfd_elf_rela_local_sym (bfd *abfd,
rel->r_addend =
_bfd_merged_section_offset (abfd, psec,
elf_section_data (sec)->sec_info,
- sym->st_value + rel->r_addend,
- 0);
- sec = *psec;
+ sym->st_value + rel->r_addend);
+ if (sec != *psec)
+ {
+ /* If we have changed the section, and our original section is
+ marked with SEC_EXCLUDE, it means that the original
+ SEC_MERGE section has been completely subsumed in some
+ other SEC_MERGE section. In this case, we need to leave
+ some info around for --emit-relocs. */
+ if ((sec->flags & SEC_EXCLUDE) != 0)
+ sec->kept_section = *psec;
+ sec = *psec;
+ }
rel->r_addend -= relocation;
rel->r_addend += sec->output_section->vma + sec->output_offset;
}
@@ -7507,7 +8727,7 @@ _bfd_elf_rel_local_sym (bfd *abfd,
return _bfd_merged_section_offset (abfd, psec,
elf_section_data (sec)->sec_info,
- sym->st_value + addend, 0);
+ sym->st_value + addend);
}
bfd_vma
@@ -7516,17 +8736,13 @@ _bfd_elf_section_offset (bfd *abfd,
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);
+ return _bfd_stab_section_offset (sec, elf_section_data (sec)->sec_info,
+ offset);
case ELF_INFO_TYPE_EH_FRAME:
- return _bfd_elf_eh_frame_section_offset (abfd, sec, offset);
+ return _bfd_elf_eh_frame_section_offset (abfd, info, sec, offset);
default:
return offset;
}
@@ -7550,8 +8766,481 @@ bfd_elf_bfd_from_remote_memory
(bfd *templ,
bfd_vma ehdr_vma,
bfd_vma *loadbasep,
- int (*target_read_memory) (bfd_vma, char *, int))
+ int (*target_read_memory) (bfd_vma, bfd_byte *, int))
{
return (*get_elf_backend_data (templ)->elf_backend_bfd_from_remote_memory)
(templ, ehdr_vma, loadbasep, target_read_memory);
}
+
+long
+_bfd_elf_get_synthetic_symtab (bfd *abfd,
+ long symcount ATTRIBUTE_UNUSED,
+ asymbol **syms ATTRIBUTE_UNUSED,
+ long dynsymcount,
+ asymbol **dynsyms,
+ asymbol **ret)
+{
+ const struct elf_backend_data *bed = get_elf_backend_data (abfd);
+ asection *relplt;
+ asymbol *s;
+ const char *relplt_name;
+ bfd_boolean (*slurp_relocs) (bfd *, asection *, asymbol **, bfd_boolean);
+ arelent *p;
+ long count, i, n;
+ size_t size;
+ Elf_Internal_Shdr *hdr;
+ char *names;
+ asection *plt;
+
+ *ret = NULL;
+
+ if ((abfd->flags & (DYNAMIC | EXEC_P)) == 0)
+ return 0;
+
+ if (dynsymcount <= 0)
+ return 0;
+
+ if (!bed->plt_sym_val)
+ return 0;
+
+ relplt_name = bed->relplt_name;
+ if (relplt_name == NULL)
+ relplt_name = bed->default_use_rela_p ? ".rela.plt" : ".rel.plt";
+ relplt = bfd_get_section_by_name (abfd, relplt_name);
+ if (relplt == NULL)
+ return 0;
+
+ hdr = &elf_section_data (relplt)->this_hdr;
+ if (hdr->sh_link != elf_dynsymtab (abfd)
+ || (hdr->sh_type != SHT_REL && hdr->sh_type != SHT_RELA))
+ return 0;
+
+ plt = bfd_get_section_by_name (abfd, ".plt");
+ if (plt == NULL)
+ return 0;
+
+ slurp_relocs = get_elf_backend_data (abfd)->s->slurp_reloc_table;
+ if (! (*slurp_relocs) (abfd, relplt, dynsyms, TRUE))
+ return -1;
+
+ count = relplt->size / hdr->sh_entsize;
+ size = count * sizeof (asymbol);
+ p = relplt->relocation;
+ for (i = 0; i < count; i++, s++, p++)
+ size += strlen ((*p->sym_ptr_ptr)->name) + sizeof ("@plt");
+
+ s = *ret = bfd_malloc (size);
+ if (s == NULL)
+ return -1;
+
+ names = (char *) (s + count);
+ p = relplt->relocation;
+ n = 0;
+ for (i = 0; i < count; i++, s++, p++)
+ {
+ size_t len;
+ bfd_vma addr;
+
+ addr = bed->plt_sym_val (i, plt, p);
+ if (addr == (bfd_vma) -1)
+ continue;
+
+ *s = **p->sym_ptr_ptr;
+ /* Undefined syms won't have BSF_LOCAL or BSF_GLOBAL set. Since
+ we are defining a symbol, ensure one of them is set. */
+ if ((s->flags & BSF_LOCAL) == 0)
+ s->flags |= BSF_GLOBAL;
+ s->section = plt;
+ s->value = addr - plt->vma;
+ s->name = names;
+ len = strlen ((*p->sym_ptr_ptr)->name);
+ memcpy (names, (*p->sym_ptr_ptr)->name, len);
+ names += len;
+ memcpy (names, "@plt", sizeof ("@plt"));
+ names += sizeof ("@plt");
+ ++n;
+ }
+
+ return n;
+}
+
+struct elf_symbuf_symbol
+{
+ unsigned long st_name; /* Symbol name, index in string tbl */
+ unsigned char st_info; /* Type and binding attributes */
+ unsigned char st_other; /* Visibilty, and target specific */
+};
+
+struct elf_symbuf_head
+{
+ struct elf_symbuf_symbol *ssym;
+ bfd_size_type count;
+ unsigned int st_shndx;
+};
+
+struct elf_symbol
+{
+ union
+ {
+ Elf_Internal_Sym *isym;
+ struct elf_symbuf_symbol *ssym;
+ } u;
+ const char *name;
+};
+
+/* Sort references to symbols by ascending section number. */
+
+static int
+elf_sort_elf_symbol (const void *arg1, const void *arg2)
+{
+ const Elf_Internal_Sym *s1 = *(const Elf_Internal_Sym **) arg1;
+ const Elf_Internal_Sym *s2 = *(const Elf_Internal_Sym **) arg2;
+
+ return s1->st_shndx - s2->st_shndx;
+}
+
+static int
+elf_sym_name_compare (const void *arg1, const void *arg2)
+{
+ const struct elf_symbol *s1 = (const struct elf_symbol *) arg1;
+ const struct elf_symbol *s2 = (const struct elf_symbol *) arg2;
+ return strcmp (s1->name, s2->name);
+}
+
+static struct elf_symbuf_head *
+elf_create_symbuf (bfd_size_type symcount, Elf_Internal_Sym *isymbuf)
+{
+ Elf_Internal_Sym **ind, **indbufend, **indbuf
+ = bfd_malloc2 (symcount, sizeof (*indbuf));
+ struct elf_symbuf_symbol *ssym;
+ struct elf_symbuf_head *ssymbuf, *ssymhead;
+ bfd_size_type i, shndx_count;
+
+ if (indbuf == NULL)
+ return NULL;
+
+ for (ind = indbuf, i = 0; i < symcount; i++)
+ if (isymbuf[i].st_shndx != SHN_UNDEF)
+ *ind++ = &isymbuf[i];
+ indbufend = ind;
+
+ qsort (indbuf, indbufend - indbuf, sizeof (Elf_Internal_Sym *),
+ elf_sort_elf_symbol);
+
+ shndx_count = 0;
+ if (indbufend > indbuf)
+ for (ind = indbuf, shndx_count++; ind < indbufend - 1; ind++)
+ if (ind[0]->st_shndx != ind[1]->st_shndx)
+ shndx_count++;
+
+ ssymbuf = bfd_malloc ((shndx_count + 1) * sizeof (*ssymbuf)
+ + (indbufend - indbuf) * sizeof (*ssymbuf));
+ if (ssymbuf == NULL)
+ {
+ free (indbuf);
+ return NULL;
+ }
+
+ ssym = (struct elf_symbuf_symbol *) (ssymbuf + shndx_count);
+ ssymbuf->ssym = NULL;
+ ssymbuf->count = shndx_count;
+ ssymbuf->st_shndx = 0;
+ for (ssymhead = ssymbuf, ind = indbuf; ind < indbufend; ssym++, ind++)
+ {
+ if (ind == indbuf || ssymhead->st_shndx != (*ind)->st_shndx)
+ {
+ ssymhead++;
+ ssymhead->ssym = ssym;
+ ssymhead->count = 0;
+ ssymhead->st_shndx = (*ind)->st_shndx;
+ }
+ ssym->st_name = (*ind)->st_name;
+ ssym->st_info = (*ind)->st_info;
+ ssym->st_other = (*ind)->st_other;
+ ssymhead->count++;
+ }
+ BFD_ASSERT ((bfd_size_type) (ssymhead - ssymbuf) == shndx_count);
+
+ free (indbuf);
+ return ssymbuf;
+}
+
+/* Check if 2 sections define the same set of local and global
+ symbols. */
+
+bfd_boolean
+bfd_elf_match_symbols_in_sections (asection *sec1, asection *sec2,
+ struct bfd_link_info *info)
+{
+ bfd *bfd1, *bfd2;
+ const struct elf_backend_data *bed1, *bed2;
+ Elf_Internal_Shdr *hdr1, *hdr2;
+ bfd_size_type symcount1, symcount2;
+ Elf_Internal_Sym *isymbuf1, *isymbuf2;
+ struct elf_symbuf_head *ssymbuf1, *ssymbuf2;
+ Elf_Internal_Sym *isym, *isymend;
+ struct elf_symbol *symtable1 = NULL, *symtable2 = NULL;
+ bfd_size_type count1, count2, i;
+ int shndx1, shndx2;
+ bfd_boolean result;
+
+ bfd1 = sec1->owner;
+ bfd2 = sec2->owner;
+
+ /* If both are .gnu.linkonce sections, they have to have the same
+ section name. */
+ if (CONST_STRNEQ (sec1->name, ".gnu.linkonce")
+ && CONST_STRNEQ (sec2->name, ".gnu.linkonce"))
+ return strcmp (sec1->name + sizeof ".gnu.linkonce",
+ sec2->name + sizeof ".gnu.linkonce") == 0;
+
+ /* Both sections have to be in ELF. */
+ if (bfd_get_flavour (bfd1) != bfd_target_elf_flavour
+ || bfd_get_flavour (bfd2) != bfd_target_elf_flavour)
+ return FALSE;
+
+ if (elf_section_type (sec1) != elf_section_type (sec2))
+ return FALSE;
+
+ if ((elf_section_flags (sec1) & SHF_GROUP) != 0
+ && (elf_section_flags (sec2) & SHF_GROUP) != 0)
+ {
+ /* If both are members of section groups, they have to have the
+ same group name. */
+ if (strcmp (elf_group_name (sec1), elf_group_name (sec2)) != 0)
+ return FALSE;
+ }
+
+ shndx1 = _bfd_elf_section_from_bfd_section (bfd1, sec1);
+ shndx2 = _bfd_elf_section_from_bfd_section (bfd2, sec2);
+ if (shndx1 == -1 || shndx2 == -1)
+ return FALSE;
+
+ bed1 = get_elf_backend_data (bfd1);
+ bed2 = get_elf_backend_data (bfd2);
+ hdr1 = &elf_tdata (bfd1)->symtab_hdr;
+ symcount1 = hdr1->sh_size / bed1->s->sizeof_sym;
+ hdr2 = &elf_tdata (bfd2)->symtab_hdr;
+ symcount2 = hdr2->sh_size / bed2->s->sizeof_sym;
+
+ if (symcount1 == 0 || symcount2 == 0)
+ return FALSE;
+
+ result = FALSE;
+ isymbuf1 = NULL;
+ isymbuf2 = NULL;
+ ssymbuf1 = elf_tdata (bfd1)->symbuf;
+ ssymbuf2 = elf_tdata (bfd2)->symbuf;
+
+ if (ssymbuf1 == NULL)
+ {
+ isymbuf1 = bfd_elf_get_elf_syms (bfd1, hdr1, symcount1, 0,
+ NULL, NULL, NULL);
+ if (isymbuf1 == NULL)
+ goto done;
+
+ if (!info->reduce_memory_overheads)
+ elf_tdata (bfd1)->symbuf = ssymbuf1
+ = elf_create_symbuf (symcount1, isymbuf1);
+ }
+
+ if (ssymbuf1 == NULL || ssymbuf2 == NULL)
+ {
+ isymbuf2 = bfd_elf_get_elf_syms (bfd2, hdr2, symcount2, 0,
+ NULL, NULL, NULL);
+ if (isymbuf2 == NULL)
+ goto done;
+
+ if (ssymbuf1 != NULL && !info->reduce_memory_overheads)
+ elf_tdata (bfd2)->symbuf = ssymbuf2
+ = elf_create_symbuf (symcount2, isymbuf2);
+ }
+
+ if (ssymbuf1 != NULL && ssymbuf2 != NULL)
+ {
+ /* Optimized faster version. */
+ bfd_size_type lo, hi, mid;
+ struct elf_symbol *symp;
+ struct elf_symbuf_symbol *ssym, *ssymend;
+
+ lo = 0;
+ hi = ssymbuf1->count;
+ ssymbuf1++;
+ count1 = 0;
+ while (lo < hi)
+ {
+ mid = (lo + hi) / 2;
+ if ((unsigned int) shndx1 < ssymbuf1[mid].st_shndx)
+ hi = mid;
+ else if ((unsigned int) shndx1 > ssymbuf1[mid].st_shndx)
+ lo = mid + 1;
+ else
+ {
+ count1 = ssymbuf1[mid].count;
+ ssymbuf1 += mid;
+ break;
+ }
+ }
+
+ lo = 0;
+ hi = ssymbuf2->count;
+ ssymbuf2++;
+ count2 = 0;
+ while (lo < hi)
+ {
+ mid = (lo + hi) / 2;
+ if ((unsigned int) shndx2 < ssymbuf2[mid].st_shndx)
+ hi = mid;
+ else if ((unsigned int) shndx2 > ssymbuf2[mid].st_shndx)
+ lo = mid + 1;
+ else
+ {
+ count2 = ssymbuf2[mid].count;
+ ssymbuf2 += mid;
+ break;
+ }
+ }
+
+ if (count1 == 0 || count2 == 0 || count1 != count2)
+ goto done;
+
+ symtable1 = bfd_malloc (count1 * sizeof (struct elf_symbol));
+ symtable2 = bfd_malloc (count2 * sizeof (struct elf_symbol));
+ if (symtable1 == NULL || symtable2 == NULL)
+ goto done;
+
+ symp = symtable1;
+ for (ssym = ssymbuf1->ssym, ssymend = ssym + count1;
+ ssym < ssymend; ssym++, symp++)
+ {
+ symp->u.ssym = ssym;
+ symp->name = bfd_elf_string_from_elf_section (bfd1,
+ hdr1->sh_link,
+ ssym->st_name);
+ }
+
+ symp = symtable2;
+ for (ssym = ssymbuf2->ssym, ssymend = ssym + count2;
+ ssym < ssymend; ssym++, symp++)
+ {
+ symp->u.ssym = ssym;
+ symp->name = bfd_elf_string_from_elf_section (bfd2,
+ hdr2->sh_link,
+ ssym->st_name);
+ }
+
+ /* Sort symbol by name. */
+ qsort (symtable1, count1, sizeof (struct elf_symbol),
+ elf_sym_name_compare);
+ qsort (symtable2, count1, sizeof (struct elf_symbol),
+ elf_sym_name_compare);
+
+ for (i = 0; i < count1; i++)
+ /* Two symbols must have the same binding, type and name. */
+ if (symtable1 [i].u.ssym->st_info != symtable2 [i].u.ssym->st_info
+ || symtable1 [i].u.ssym->st_other != symtable2 [i].u.ssym->st_other
+ || strcmp (symtable1 [i].name, symtable2 [i].name) != 0)
+ goto done;
+
+ result = TRUE;
+ goto done;
+ }
+
+ symtable1 = bfd_malloc (symcount1 * sizeof (struct elf_symbol));
+ symtable2 = bfd_malloc (symcount2 * sizeof (struct elf_symbol));
+ if (symtable1 == NULL || symtable2 == NULL)
+ goto done;
+
+ /* Count definitions in the section. */
+ count1 = 0;
+ for (isym = isymbuf1, isymend = isym + symcount1; isym < isymend; isym++)
+ if (isym->st_shndx == (unsigned int) shndx1)
+ symtable1[count1++].u.isym = isym;
+
+ count2 = 0;
+ for (isym = isymbuf2, isymend = isym + symcount2; isym < isymend; isym++)
+ if (isym->st_shndx == (unsigned int) shndx2)
+ symtable2[count2++].u.isym = isym;
+
+ if (count1 == 0 || count2 == 0 || count1 != count2)
+ goto done;
+
+ for (i = 0; i < count1; i++)
+ symtable1[i].name
+ = bfd_elf_string_from_elf_section (bfd1, hdr1->sh_link,
+ symtable1[i].u.isym->st_name);
+
+ for (i = 0; i < count2; i++)
+ symtable2[i].name
+ = bfd_elf_string_from_elf_section (bfd2, hdr2->sh_link,
+ symtable2[i].u.isym->st_name);
+
+ /* Sort symbol by name. */
+ qsort (symtable1, count1, sizeof (struct elf_symbol),
+ elf_sym_name_compare);
+ qsort (symtable2, count1, sizeof (struct elf_symbol),
+ elf_sym_name_compare);
+
+ for (i = 0; i < count1; i++)
+ /* Two symbols must have the same binding, type and name. */
+ if (symtable1 [i].u.isym->st_info != symtable2 [i].u.isym->st_info
+ || symtable1 [i].u.isym->st_other != symtable2 [i].u.isym->st_other
+ || strcmp (symtable1 [i].name, symtable2 [i].name) != 0)
+ goto done;
+
+ result = TRUE;
+
+done:
+ if (symtable1)
+ free (symtable1);
+ if (symtable2)
+ free (symtable2);
+ if (isymbuf1)
+ free (isymbuf1);
+ if (isymbuf2)
+ free (isymbuf2);
+
+ return result;
+}
+
+/* It is only used by x86-64 so far. */
+asection _bfd_elf_large_com_section
+ = BFD_FAKE_SECTION (_bfd_elf_large_com_section,
+ SEC_IS_COMMON, NULL, "LARGE_COMMON", 0);
+
+/* Return TRUE if 2 section types are compatible. */
+
+bfd_boolean
+_bfd_elf_match_sections_by_type (bfd *abfd, const asection *asec,
+ bfd *bbfd, const asection *bsec)
+{
+ if (asec == NULL
+ || bsec == NULL
+ || abfd->xvec->flavour != bfd_target_elf_flavour
+ || bbfd->xvec->flavour != bfd_target_elf_flavour)
+ return TRUE;
+
+ return elf_section_type (asec) == elf_section_type (bsec);
+}
+
+void
+_bfd_elf_set_osabi (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] = get_elf_backend_data (abfd)->elf_osabi;
+}
+
+
+/* Return TRUE for ELF symbol types that represent functions.
+ This is the default version of this function, which is sufficient for
+ most targets. It returns true if TYPE is STT_FUNC. */
+
+bfd_boolean
+_bfd_elf_is_function_type (unsigned int type)
+{
+ return (type == STT_FUNC);
+}
diff --git a/contrib/binutils/bfd/elf32-arc.c b/contrib/binutils/bfd/elf32-arc.c
index 27c1639..58d6301 100644
--- a/contrib/binutils/bfd/elf32-arc.c
+++ b/contrib/binutils/bfd/elf32-arc.c
@@ -1,5 +1,5 @@
/* ARC-specific support for 32-bit ELF
- Copyright 1994, 1995, 1997, 1999, 2001, 2002
+ Copyright 1994, 1995, 1997, 1999, 2001, 2002, 2005, 2007
Free Software Foundation, Inc.
Contributed by Doug Evans (dje@cygnus.com).
@@ -17,92 +17,104 @@
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. */
+ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
+ MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.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 bfd_reloc_status_type
+arc_elf_b22_pcrel (bfd * abfd,
+ arelent * reloc_entry,
+ asymbol * symbol,
+ void * 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 == 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);
+}
+
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 */
+ 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 */
+ 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 */
+ 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 */
+ 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. */
@@ -123,9 +135,8 @@ static const struct arc_reloc_map arc_reloc_map[] =
};
static reloc_howto_type *
-bfd_elf32_bfd_reloc_type_lookup (abfd, code)
- bfd *abfd ATTRIBUTE_UNUSED;
- bfd_reloc_code_real_type code;
+bfd_elf32_bfd_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED,
+ bfd_reloc_code_real_type code)
{
unsigned int i;
@@ -136,13 +147,28 @@ bfd_elf32_bfd_reloc_type_lookup (abfd, code)
return NULL;
}
+static reloc_howto_type *
+bfd_elf32_bfd_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED,
+ const char *r_name)
+{
+ unsigned int i;
+
+ for (i = 0;
+ i < sizeof (elf_arc_howto_table) / sizeof (elf_arc_howto_table[0]);
+ i++)
+ if (elf_arc_howto_table[i].name != NULL
+ && strcasecmp (elf_arc_howto_table[i].name, r_name) == 0)
+ return &elf_arc_howto_table[i];
+
+ 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;
+arc_info_to_howto_rel (bfd *abfd ATTRIBUTE_UNUSED,
+ arelent *cache_ptr,
+ Elf_Internal_Rela *dst)
{
unsigned int r_type;
@@ -154,8 +180,7 @@ arc_info_to_howto_rel (abfd, cache_ptr, dst)
/* Set the right machine number for an ARC ELF file. */
static bfd_boolean
-arc_elf_object_p (abfd)
- bfd *abfd;
+arc_elf_object_p (bfd *abfd)
{
unsigned int mach = bfd_mach_arc_6;
@@ -187,9 +212,8 @@ arc_elf_object_p (abfd)
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;
+arc_elf_final_write_processing (bfd *abfd,
+ bfd_boolean linker ATTRIBUTE_UNUSED)
{
unsigned long val;
@@ -213,41 +237,17 @@ arc_elf_final_write_processing (abfd, linker)
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
+#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.c b/contrib/binutils/bfd/elf32-arm.c
new file mode 100644
index 0000000..02dd21b
--- /dev/null
+++ b/contrib/binutils/bfd/elf32-arm.c
@@ -0,0 +1,10446 @@
+/* 32-bit ELF support for ARM
+ Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
+ 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., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include "sysdep.h"
+#include "bfd.h"
+#include "libiberty.h"
+#include "libbfd.h"
+#include "elf-bfd.h"
+#include "elf-vxworks.h"
+#include "elf/arm.h"
+
+#ifndef NUM_ELEM
+#define NUM_ELEM(a) (sizeof (a) / (sizeof (a)[0]))
+#endif
+
+/* Return the relocation section associated with NAME. HTAB is the
+ bfd's elf32_arm_link_hash_entry. */
+#define RELOC_SECTION(HTAB, NAME) \
+ ((HTAB)->use_rel ? ".rel" NAME : ".rela" NAME)
+
+/* Return size of a relocation entry. HTAB is the bfd's
+ elf32_arm_link_hash_entry. */
+#define RELOC_SIZE(HTAB) \
+ ((HTAB)->use_rel \
+ ? sizeof (Elf32_External_Rel) \
+ : sizeof (Elf32_External_Rela))
+
+/* Return function to swap relocations in. HTAB is the bfd's
+ elf32_arm_link_hash_entry. */
+#define SWAP_RELOC_IN(HTAB) \
+ ((HTAB)->use_rel \
+ ? bfd_elf32_swap_reloc_in \
+ : bfd_elf32_swap_reloca_in)
+
+/* Return function to swap relocations out. HTAB is the bfd's
+ elf32_arm_link_hash_entry. */
+#define SWAP_RELOC_OUT(HTAB) \
+ ((HTAB)->use_rel \
+ ? bfd_elf32_swap_reloc_out \
+ : bfd_elf32_swap_reloca_out)
+
+#define elf_info_to_howto 0
+#define elf_info_to_howto_rel elf32_arm_info_to_howto
+
+#define ARM_ELF_ABI_VERSION 0
+#ifdef __FreeBSD__
+#define ARM_ELF_OS_ABI_VERSION ELFOSABI_FREEBSD
+#else
+#define ARM_ELF_OS_ABI_VERSION ELFOSABI_ARM
+#endif
+
+static struct elf_backend_data elf32_arm_vxworks_bed;
+
+/* 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_1[] =
+{
+ /* 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 - R_ARM_LDR_PC_G0 in AAELF */
+ HOWTO (R_ARM_LDR_PC_G0, /* type */
+ 0, /* rightshift */
+ 0, /* size (0 = byte, 1 = short, 2 = long) */
+ 32, /* bitsize */
+ TRUE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont,/* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_ARM_LDR_PC_G0", /* name */
+ FALSE, /* partial_inplace */
+ 0xffffffff, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ TRUE), /* 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 */
+ 0x00000fff, /* src_mask */
+ 0x00000fff, /* 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 */
+ 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_ARM_SBREL32", /* name */
+ FALSE, /* partial_inplace */
+ 0xffffffff, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ HOWTO (R_ARM_THM_CALL, /* type */
+ 1, /* 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_THM_CALL", /* 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_BREL_ADJ, /* type */
+ 1, /* rightshift */
+ 1, /* size (0 = byte, 1 = short, 2 = long) */
+ 32, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_signed,/* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_ARM_BREL_ADJ", /* name */
+ FALSE, /* partial_inplace */
+ 0xffffffff, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ FALSE), /* 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 */
+
+ /* Dynamic TLS relocations. */
+
+ HOWTO (R_ARM_TLS_DTPMOD32, /* 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_TLS_DTPMOD32", /* name */
+ TRUE, /* partial_inplace */
+ 0xffffffff, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ HOWTO (R_ARM_TLS_DTPOFF32, /* 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_TLS_DTPOFF32", /* name */
+ TRUE, /* partial_inplace */
+ 0xffffffff, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ HOWTO (R_ARM_TLS_TPOFF32, /* 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_TLS_TPOFF32", /* name */
+ TRUE, /* partial_inplace */
+ 0xffffffff, /* src_mask */
+ 0xffffffff, /* 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_GOTOFF32, /* 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_GOTOFF32", /* 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) */
+ 24, /* bitsize */
+ TRUE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_bitfield,/* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_ARM_PLT32", /* name */
+ FALSE, /* partial_inplace */
+ 0x00ffffff, /* src_mask */
+ 0x00ffffff, /* dst_mask */
+ TRUE), /* pcrel_offset */
+
+ HOWTO (R_ARM_CALL, /* 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_CALL", /* name */
+ FALSE, /* partial_inplace */
+ 0x00ffffff, /* src_mask */
+ 0x00ffffff, /* dst_mask */
+ TRUE), /* pcrel_offset */
+
+ HOWTO (R_ARM_JUMP24, /* 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_JUMP24", /* name */
+ FALSE, /* partial_inplace */
+ 0x00ffffff, /* src_mask */
+ 0x00ffffff, /* dst_mask */
+ TRUE), /* pcrel_offset */
+
+ HOWTO (R_ARM_THM_JUMP24, /* type */
+ 1, /* 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_THM_JUMP24", /* name */
+ FALSE, /* partial_inplace */
+ 0x07ff2fff, /* src_mask */
+ 0x07ff2fff, /* dst_mask */
+ TRUE), /* pcrel_offset */
+
+ HOWTO (R_ARM_BASE_ABS, /* 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_ARM_BASE_ABS", /* name */
+ FALSE, /* partial_inplace */
+ 0xffffffff, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ HOWTO (R_ARM_ALU_PCREL7_0, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 12, /* bitsize */
+ TRUE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont,/* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_ARM_ALU_PCREL_7_0", /* name */
+ FALSE, /* partial_inplace */
+ 0x00000fff, /* src_mask */
+ 0x00000fff, /* dst_mask */
+ TRUE), /* pcrel_offset */
+
+ HOWTO (R_ARM_ALU_PCREL15_8, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 12, /* bitsize */
+ TRUE, /* pc_relative */
+ 8, /* bitpos */
+ complain_overflow_dont,/* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_ARM_ALU_PCREL_15_8",/* name */
+ FALSE, /* partial_inplace */
+ 0x00000fff, /* src_mask */
+ 0x00000fff, /* dst_mask */
+ TRUE), /* pcrel_offset */
+
+ HOWTO (R_ARM_ALU_PCREL23_15, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 12, /* bitsize */
+ TRUE, /* pc_relative */
+ 16, /* bitpos */
+ complain_overflow_dont,/* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_ARM_ALU_PCREL_23_15",/* name */
+ FALSE, /* partial_inplace */
+ 0x00000fff, /* src_mask */
+ 0x00000fff, /* dst_mask */
+ TRUE), /* pcrel_offset */
+
+ HOWTO (R_ARM_LDR_SBREL_11_0, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 12, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont,/* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_ARM_LDR_SBREL_11_0",/* name */
+ FALSE, /* partial_inplace */
+ 0x00000fff, /* src_mask */
+ 0x00000fff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ HOWTO (R_ARM_ALU_SBREL_19_12, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 8, /* bitsize */
+ FALSE, /* pc_relative */
+ 12, /* bitpos */
+ complain_overflow_dont,/* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_ARM_ALU_SBREL_19_12",/* name */
+ FALSE, /* partial_inplace */
+ 0x000ff000, /* src_mask */
+ 0x000ff000, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ HOWTO (R_ARM_ALU_SBREL_27_20, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 8, /* bitsize */
+ FALSE, /* pc_relative */
+ 20, /* bitpos */
+ complain_overflow_dont,/* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_ARM_ALU_SBREL_27_20",/* name */
+ FALSE, /* partial_inplace */
+ 0x0ff00000, /* src_mask */
+ 0x0ff00000, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ HOWTO (R_ARM_TARGET1, /* 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_ARM_TARGET1", /* name */
+ FALSE, /* partial_inplace */
+ 0xffffffff, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ HOWTO (R_ARM_ROSEGREL32, /* 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_ARM_ROSEGREL32", /* name */
+ FALSE, /* partial_inplace */
+ 0xffffffff, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ HOWTO (R_ARM_V4BX, /* 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_ARM_V4BX", /* name */
+ FALSE, /* partial_inplace */
+ 0xffffffff, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ HOWTO (R_ARM_TARGET2, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 32, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_signed,/* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_ARM_TARGET2", /* name */
+ FALSE, /* partial_inplace */
+ 0xffffffff, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ TRUE), /* pcrel_offset */
+
+ HOWTO (R_ARM_PREL31, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 31, /* bitsize */
+ TRUE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_signed,/* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_ARM_PREL31", /* name */
+ FALSE, /* partial_inplace */
+ 0x7fffffff, /* src_mask */
+ 0x7fffffff, /* dst_mask */
+ TRUE), /* pcrel_offset */
+
+ HOWTO (R_ARM_MOVW_ABS_NC, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont,/* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_ARM_MOVW_ABS_NC", /* name */
+ FALSE, /* partial_inplace */
+ 0x0000ffff, /* src_mask */
+ 0x0000ffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ HOWTO (R_ARM_MOVT_ABS, /* 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_ARM_MOVT_ABS", /* name */
+ FALSE, /* partial_inplace */
+ 0x0000ffff, /* src_mask */
+ 0x0000ffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ HOWTO (R_ARM_MOVW_PREL_NC, /* 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_elf_generic_reloc, /* special_function */
+ "R_ARM_MOVW_PREL_NC", /* name */
+ FALSE, /* partial_inplace */
+ 0x0000ffff, /* src_mask */
+ 0x0000ffff, /* dst_mask */
+ TRUE), /* pcrel_offset */
+
+ HOWTO (R_ARM_MOVT_PREL, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ TRUE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_bitfield,/* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_ARM_MOVT_PREL", /* name */
+ FALSE, /* partial_inplace */
+ 0x0000ffff, /* src_mask */
+ 0x0000ffff, /* dst_mask */
+ TRUE), /* pcrel_offset */
+
+ HOWTO (R_ARM_THM_MOVW_ABS_NC, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont,/* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_ARM_THM_MOVW_ABS_NC",/* name */
+ FALSE, /* partial_inplace */
+ 0x040f70ff, /* src_mask */
+ 0x040f70ff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ HOWTO (R_ARM_THM_MOVT_ABS, /* 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_ARM_THM_MOVT_ABS", /* name */
+ FALSE, /* partial_inplace */
+ 0x040f70ff, /* src_mask */
+ 0x040f70ff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ HOWTO (R_ARM_THM_MOVW_PREL_NC,/* 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_elf_generic_reloc, /* special_function */
+ "R_ARM_THM_MOVW_PREL_NC",/* name */
+ FALSE, /* partial_inplace */
+ 0x040f70ff, /* src_mask */
+ 0x040f70ff, /* dst_mask */
+ TRUE), /* pcrel_offset */
+
+ HOWTO (R_ARM_THM_MOVT_PREL, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ TRUE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_bitfield,/* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_ARM_THM_MOVT_PREL", /* name */
+ FALSE, /* partial_inplace */
+ 0x040f70ff, /* src_mask */
+ 0x040f70ff, /* dst_mask */
+ TRUE), /* pcrel_offset */
+
+ HOWTO (R_ARM_THM_JUMP19, /* type */
+ 1, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 19, /* bitsize */
+ TRUE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_signed,/* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_ARM_THM_JUMP19", /* name */
+ FALSE, /* partial_inplace */
+ 0x043f2fff, /* src_mask */
+ 0x043f2fff, /* dst_mask */
+ TRUE), /* pcrel_offset */
+
+ HOWTO (R_ARM_THM_JUMP6, /* type */
+ 1, /* rightshift */
+ 1, /* size (0 = byte, 1 = short, 2 = long) */
+ 6, /* bitsize */
+ TRUE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_unsigned,/* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_ARM_THM_JUMP6", /* name */
+ FALSE, /* partial_inplace */
+ 0x02f8, /* src_mask */
+ 0x02f8, /* dst_mask */
+ TRUE), /* pcrel_offset */
+
+ /* These are declared as 13-bit signed relocations because we can
+ address -4095 .. 4095(base) by altering ADDW to SUBW or vice
+ versa. */
+ HOWTO (R_ARM_THM_ALU_PREL_11_0,/* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 13, /* bitsize */
+ TRUE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont,/* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_ARM_THM_ALU_PREL_11_0",/* name */
+ FALSE, /* partial_inplace */
+ 0xffffffff, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ TRUE), /* pcrel_offset */
+
+ HOWTO (R_ARM_THM_PC12, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 13, /* bitsize */
+ TRUE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont,/* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_ARM_THM_PC12", /* name */
+ FALSE, /* partial_inplace */
+ 0xffffffff, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ TRUE), /* pcrel_offset */
+
+ HOWTO (R_ARM_ABS32_NOI, /* 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_ARM_ABS32_NOI", /* name */
+ FALSE, /* partial_inplace */
+ 0xffffffff, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ HOWTO (R_ARM_REL32_NOI, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 32, /* bitsize */
+ TRUE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont,/* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_ARM_REL32_NOI", /* name */
+ FALSE, /* partial_inplace */
+ 0xffffffff, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* Group relocations. */
+
+ HOWTO (R_ARM_ALU_PC_G0_NC, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 32, /* bitsize */
+ TRUE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont,/* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_ARM_ALU_PC_G0_NC", /* name */
+ FALSE, /* partial_inplace */
+ 0xffffffff, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ TRUE), /* pcrel_offset */
+
+ HOWTO (R_ARM_ALU_PC_G0, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 32, /* bitsize */
+ TRUE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont,/* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_ARM_ALU_PC_G0", /* name */
+ FALSE, /* partial_inplace */
+ 0xffffffff, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ TRUE), /* pcrel_offset */
+
+ HOWTO (R_ARM_ALU_PC_G1_NC, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 32, /* bitsize */
+ TRUE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont,/* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_ARM_ALU_PC_G1_NC", /* name */
+ FALSE, /* partial_inplace */
+ 0xffffffff, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ TRUE), /* pcrel_offset */
+
+ HOWTO (R_ARM_ALU_PC_G1, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 32, /* bitsize */
+ TRUE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont,/* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_ARM_ALU_PC_G1", /* name */
+ FALSE, /* partial_inplace */
+ 0xffffffff, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ TRUE), /* pcrel_offset */
+
+ HOWTO (R_ARM_ALU_PC_G2, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 32, /* bitsize */
+ TRUE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont,/* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_ARM_ALU_PC_G2", /* name */
+ FALSE, /* partial_inplace */
+ 0xffffffff, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ TRUE), /* pcrel_offset */
+
+ HOWTO (R_ARM_LDR_PC_G1, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 32, /* bitsize */
+ TRUE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont,/* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_ARM_LDR_PC_G1", /* name */
+ FALSE, /* partial_inplace */
+ 0xffffffff, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ TRUE), /* pcrel_offset */
+
+ HOWTO (R_ARM_LDR_PC_G2, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 32, /* bitsize */
+ TRUE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont,/* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_ARM_LDR_PC_G2", /* name */
+ FALSE, /* partial_inplace */
+ 0xffffffff, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ TRUE), /* pcrel_offset */
+
+ HOWTO (R_ARM_LDRS_PC_G0, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 32, /* bitsize */
+ TRUE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont,/* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_ARM_LDRS_PC_G0", /* name */
+ FALSE, /* partial_inplace */
+ 0xffffffff, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ TRUE), /* pcrel_offset */
+
+ HOWTO (R_ARM_LDRS_PC_G1, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 32, /* bitsize */
+ TRUE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont,/* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_ARM_LDRS_PC_G1", /* name */
+ FALSE, /* partial_inplace */
+ 0xffffffff, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ TRUE), /* pcrel_offset */
+
+ HOWTO (R_ARM_LDRS_PC_G2, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 32, /* bitsize */
+ TRUE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont,/* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_ARM_LDRS_PC_G2", /* name */
+ FALSE, /* partial_inplace */
+ 0xffffffff, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ TRUE), /* pcrel_offset */
+
+ HOWTO (R_ARM_LDC_PC_G0, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 32, /* bitsize */
+ TRUE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont,/* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_ARM_LDC_PC_G0", /* name */
+ FALSE, /* partial_inplace */
+ 0xffffffff, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ TRUE), /* pcrel_offset */
+
+ HOWTO (R_ARM_LDC_PC_G1, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 32, /* bitsize */
+ TRUE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont,/* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_ARM_LDC_PC_G1", /* name */
+ FALSE, /* partial_inplace */
+ 0xffffffff, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ TRUE), /* pcrel_offset */
+
+ HOWTO (R_ARM_LDC_PC_G2, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 32, /* bitsize */
+ TRUE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont,/* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_ARM_LDC_PC_G2", /* name */
+ FALSE, /* partial_inplace */
+ 0xffffffff, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ TRUE), /* pcrel_offset */
+
+ HOWTO (R_ARM_ALU_SB_G0_NC, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 32, /* bitsize */
+ TRUE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont,/* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_ARM_ALU_SB_G0_NC", /* name */
+ FALSE, /* partial_inplace */
+ 0xffffffff, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ TRUE), /* pcrel_offset */
+
+ HOWTO (R_ARM_ALU_SB_G0, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 32, /* bitsize */
+ TRUE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont,/* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_ARM_ALU_SB_G0", /* name */
+ FALSE, /* partial_inplace */
+ 0xffffffff, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ TRUE), /* pcrel_offset */
+
+ HOWTO (R_ARM_ALU_SB_G1_NC, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 32, /* bitsize */
+ TRUE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont,/* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_ARM_ALU_SB_G1_NC", /* name */
+ FALSE, /* partial_inplace */
+ 0xffffffff, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ TRUE), /* pcrel_offset */
+
+ HOWTO (R_ARM_ALU_SB_G1, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 32, /* bitsize */
+ TRUE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont,/* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_ARM_ALU_SB_G1", /* name */
+ FALSE, /* partial_inplace */
+ 0xffffffff, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ TRUE), /* pcrel_offset */
+
+ HOWTO (R_ARM_ALU_SB_G2, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 32, /* bitsize */
+ TRUE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont,/* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_ARM_ALU_SB_G2", /* name */
+ FALSE, /* partial_inplace */
+ 0xffffffff, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ TRUE), /* pcrel_offset */
+
+ HOWTO (R_ARM_LDR_SB_G0, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 32, /* bitsize */
+ TRUE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont,/* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_ARM_LDR_SB_G0", /* name */
+ FALSE, /* partial_inplace */
+ 0xffffffff, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ TRUE), /* pcrel_offset */
+
+ HOWTO (R_ARM_LDR_SB_G1, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 32, /* bitsize */
+ TRUE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont,/* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_ARM_LDR_SB_G1", /* name */
+ FALSE, /* partial_inplace */
+ 0xffffffff, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ TRUE), /* pcrel_offset */
+
+ HOWTO (R_ARM_LDR_SB_G2, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 32, /* bitsize */
+ TRUE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont,/* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_ARM_LDR_SB_G2", /* name */
+ FALSE, /* partial_inplace */
+ 0xffffffff, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ TRUE), /* pcrel_offset */
+
+ HOWTO (R_ARM_LDRS_SB_G0, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 32, /* bitsize */
+ TRUE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont,/* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_ARM_LDRS_SB_G0", /* name */
+ FALSE, /* partial_inplace */
+ 0xffffffff, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ TRUE), /* pcrel_offset */
+
+ HOWTO (R_ARM_LDRS_SB_G1, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 32, /* bitsize */
+ TRUE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont,/* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_ARM_LDRS_SB_G1", /* name */
+ FALSE, /* partial_inplace */
+ 0xffffffff, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ TRUE), /* pcrel_offset */
+
+ HOWTO (R_ARM_LDRS_SB_G2, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 32, /* bitsize */
+ TRUE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont,/* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_ARM_LDRS_SB_G2", /* name */
+ FALSE, /* partial_inplace */
+ 0xffffffff, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ TRUE), /* pcrel_offset */
+
+ HOWTO (R_ARM_LDC_SB_G0, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 32, /* bitsize */
+ TRUE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont,/* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_ARM_LDC_SB_G0", /* name */
+ FALSE, /* partial_inplace */
+ 0xffffffff, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ TRUE), /* pcrel_offset */
+
+ HOWTO (R_ARM_LDC_SB_G1, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 32, /* bitsize */
+ TRUE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont,/* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_ARM_LDC_SB_G1", /* name */
+ FALSE, /* partial_inplace */
+ 0xffffffff, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ TRUE), /* pcrel_offset */
+
+ HOWTO (R_ARM_LDC_SB_G2, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 32, /* bitsize */
+ TRUE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont,/* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_ARM_LDC_SB_G2", /* name */
+ FALSE, /* partial_inplace */
+ 0xffffffff, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ TRUE), /* pcrel_offset */
+
+ /* End of group relocations. */
+
+ HOWTO (R_ARM_MOVW_BREL_NC, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont,/* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_ARM_MOVW_BREL_NC", /* name */
+ FALSE, /* partial_inplace */
+ 0x0000ffff, /* src_mask */
+ 0x0000ffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ HOWTO (R_ARM_MOVT_BREL, /* 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_ARM_MOVT_BREL", /* name */
+ FALSE, /* partial_inplace */
+ 0x0000ffff, /* src_mask */
+ 0x0000ffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ HOWTO (R_ARM_MOVW_BREL, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont,/* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_ARM_MOVW_BREL", /* name */
+ FALSE, /* partial_inplace */
+ 0x0000ffff, /* src_mask */
+ 0x0000ffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ HOWTO (R_ARM_THM_MOVW_BREL_NC,/* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont,/* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_ARM_THM_MOVW_BREL_NC",/* name */
+ FALSE, /* partial_inplace */
+ 0x040f70ff, /* src_mask */
+ 0x040f70ff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ HOWTO (R_ARM_THM_MOVT_BREL, /* 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_ARM_THM_MOVT_BREL", /* name */
+ FALSE, /* partial_inplace */
+ 0x040f70ff, /* src_mask */
+ 0x040f70ff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ HOWTO (R_ARM_THM_MOVW_BREL, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont,/* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_ARM_THM_MOVW_BREL", /* name */
+ FALSE, /* partial_inplace */
+ 0x040f70ff, /* src_mask */
+ 0x040f70ff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ EMPTY_HOWTO (90), /* unallocated */
+ EMPTY_HOWTO (91),
+ EMPTY_HOWTO (92),
+ EMPTY_HOWTO (93),
+
+ HOWTO (R_ARM_PLT32_ABS, /* 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_ARM_PLT32_ABS", /* name */
+ FALSE, /* partial_inplace */
+ 0xffffffff, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ HOWTO (R_ARM_GOT_ABS, /* 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_ARM_GOT_ABS", /* name */
+ FALSE, /* partial_inplace */
+ 0xffffffff, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ HOWTO (R_ARM_GOT_PREL, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 32, /* bitsize */
+ TRUE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_ARM_GOT_PREL", /* name */
+ FALSE, /* partial_inplace */
+ 0xffffffff, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ TRUE), /* pcrel_offset */
+
+ HOWTO (R_ARM_GOT_BREL12, /* 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_GOT_BREL12", /* name */
+ FALSE, /* partial_inplace */
+ 0x00000fff, /* src_mask */
+ 0x00000fff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ HOWTO (R_ARM_GOTOFF12, /* 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_GOTOFF12", /* name */
+ FALSE, /* partial_inplace */
+ 0x00000fff, /* src_mask */
+ 0x00000fff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ EMPTY_HOWTO (R_ARM_GOTRELAX), /* reserved for future GOT-load optimizations */
+
+ /* 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 */
+
+ /* 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 */
+
+ HOWTO (R_ARM_THM_JUMP11, /* 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_JUMP11", /* name */
+ FALSE, /* partial_inplace */
+ 0x000007ff, /* src_mask */
+ 0x000007ff, /* dst_mask */
+ TRUE), /* pcrel_offset */
+
+ HOWTO (R_ARM_THM_JUMP8, /* 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_JUMP8", /* name */
+ FALSE, /* partial_inplace */
+ 0x000000ff, /* src_mask */
+ 0x000000ff, /* dst_mask */
+ TRUE), /* pcrel_offset */
+
+ /* TLS relocations */
+ HOWTO (R_ARM_TLS_GD32, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 32, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_bitfield,/* complain_on_overflow */
+ NULL, /* special_function */
+ "R_ARM_TLS_GD32", /* name */
+ TRUE, /* partial_inplace */
+ 0xffffffff, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ HOWTO (R_ARM_TLS_LDM32, /* 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_TLS_LDM32", /* name */
+ TRUE, /* partial_inplace */
+ 0xffffffff, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ HOWTO (R_ARM_TLS_LDO32, /* 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_TLS_LDO32", /* name */
+ TRUE, /* partial_inplace */
+ 0xffffffff, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ HOWTO (R_ARM_TLS_IE32, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 32, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_bitfield,/* complain_on_overflow */
+ NULL, /* special_function */
+ "R_ARM_TLS_IE32", /* name */
+ TRUE, /* partial_inplace */
+ 0xffffffff, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ HOWTO (R_ARM_TLS_LE32, /* 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_TLS_LE32", /* name */
+ TRUE, /* partial_inplace */
+ 0xffffffff, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ HOWTO (R_ARM_TLS_LDO12, /* 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_TLS_LDO12", /* name */
+ FALSE, /* partial_inplace */
+ 0x00000fff, /* src_mask */
+ 0x00000fff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ HOWTO (R_ARM_TLS_LE12, /* 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_TLS_LE12", /* name */
+ FALSE, /* partial_inplace */
+ 0x00000fff, /* src_mask */
+ 0x00000fff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ HOWTO (R_ARM_TLS_IE12GP, /* 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_TLS_IE12GP", /* name */
+ FALSE, /* partial_inplace */
+ 0x00000fff, /* src_mask */
+ 0x00000fff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+};
+
+/* 112-127 private relocations
+ 128 R_ARM_ME_TOO, obsolete
+ 129-255 unallocated in AAELF.
+
+ 249-255 extended, currently unused, relocations: */
+
+static reloc_howto_type elf32_arm_howto_table_2[4] =
+{
+ 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 */
+};
+
+static reloc_howto_type *
+elf32_arm_howto_from_type (unsigned int r_type)
+{
+ if (r_type < NUM_ELEM (elf32_arm_howto_table_1))
+ return &elf32_arm_howto_table_1[r_type];
+
+ if (r_type >= R_ARM_RREL32
+ && r_type < R_ARM_RREL32 + NUM_ELEM (elf32_arm_howto_table_2))
+ return &elf32_arm_howto_table_2[r_type - R_ARM_RREL32];
+
+ return NULL;
+}
+
+static void
+elf32_arm_info_to_howto (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);
+ bfd_reloc->howto = elf32_arm_howto_from_type (r_type);
+}
+
+struct elf32_arm_reloc_map
+ {
+ bfd_reloc_code_real_type bfd_reloc_val;
+ unsigned char elf_reloc_val;
+ };
+
+/* All entries in this list must also be present in elf32_arm_howto_table. */
+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_CALL, R_ARM_CALL},
+ {BFD_RELOC_ARM_PCREL_JUMP, R_ARM_JUMP24},
+ {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_BRANCH25, R_ARM_THM_JUMP24},
+ {BFD_RELOC_THUMB_PCREL_BRANCH23, R_ARM_THM_CALL},
+ {BFD_RELOC_THUMB_PCREL_BRANCH12, R_ARM_THM_JUMP11},
+ {BFD_RELOC_THUMB_PCREL_BRANCH20, R_ARM_THM_JUMP19},
+ {BFD_RELOC_THUMB_PCREL_BRANCH9, R_ARM_THM_JUMP8},
+ {BFD_RELOC_THUMB_PCREL_BRANCH7, R_ARM_THM_JUMP6},
+ {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_GOTOFF32},
+ {BFD_RELOC_ARM_GOTPC, R_ARM_GOTPC},
+ {BFD_RELOC_ARM_GOT32, R_ARM_GOT32},
+ {BFD_RELOC_ARM_PLT32, R_ARM_PLT32},
+ {BFD_RELOC_ARM_TARGET1, R_ARM_TARGET1},
+ {BFD_RELOC_ARM_ROSEGREL32, R_ARM_ROSEGREL32},
+ {BFD_RELOC_ARM_SBREL32, R_ARM_SBREL32},
+ {BFD_RELOC_ARM_PREL31, R_ARM_PREL31},
+ {BFD_RELOC_ARM_TARGET2, R_ARM_TARGET2},
+ {BFD_RELOC_ARM_PLT32, R_ARM_PLT32},
+ {BFD_RELOC_ARM_TLS_GD32, R_ARM_TLS_GD32},
+ {BFD_RELOC_ARM_TLS_LDO32, R_ARM_TLS_LDO32},
+ {BFD_RELOC_ARM_TLS_LDM32, R_ARM_TLS_LDM32},
+ {BFD_RELOC_ARM_TLS_DTPMOD32, R_ARM_TLS_DTPMOD32},
+ {BFD_RELOC_ARM_TLS_DTPOFF32, R_ARM_TLS_DTPOFF32},
+ {BFD_RELOC_ARM_TLS_TPOFF32, R_ARM_TLS_TPOFF32},
+ {BFD_RELOC_ARM_TLS_IE32, R_ARM_TLS_IE32},
+ {BFD_RELOC_ARM_TLS_LE32, R_ARM_TLS_LE32},
+ {BFD_RELOC_VTABLE_INHERIT, R_ARM_GNU_VTINHERIT},
+ {BFD_RELOC_VTABLE_ENTRY, R_ARM_GNU_VTENTRY},
+ {BFD_RELOC_ARM_MOVW, R_ARM_MOVW_ABS_NC},
+ {BFD_RELOC_ARM_MOVT, R_ARM_MOVT_ABS},
+ {BFD_RELOC_ARM_MOVW_PCREL, R_ARM_MOVW_PREL_NC},
+ {BFD_RELOC_ARM_MOVT_PCREL, R_ARM_MOVT_PREL},
+ {BFD_RELOC_ARM_THUMB_MOVW, R_ARM_THM_MOVW_ABS_NC},
+ {BFD_RELOC_ARM_THUMB_MOVT, R_ARM_THM_MOVT_ABS},
+ {BFD_RELOC_ARM_THUMB_MOVW_PCREL, R_ARM_THM_MOVW_PREL_NC},
+ {BFD_RELOC_ARM_THUMB_MOVT_PCREL, R_ARM_THM_MOVT_PREL},
+ {BFD_RELOC_ARM_ALU_PC_G0_NC, R_ARM_ALU_PC_G0_NC},
+ {BFD_RELOC_ARM_ALU_PC_G0, R_ARM_ALU_PC_G0},
+ {BFD_RELOC_ARM_ALU_PC_G1_NC, R_ARM_ALU_PC_G1_NC},
+ {BFD_RELOC_ARM_ALU_PC_G1, R_ARM_ALU_PC_G1},
+ {BFD_RELOC_ARM_ALU_PC_G2, R_ARM_ALU_PC_G2},
+ {BFD_RELOC_ARM_LDR_PC_G0, R_ARM_LDR_PC_G0},
+ {BFD_RELOC_ARM_LDR_PC_G1, R_ARM_LDR_PC_G1},
+ {BFD_RELOC_ARM_LDR_PC_G2, R_ARM_LDR_PC_G2},
+ {BFD_RELOC_ARM_LDRS_PC_G0, R_ARM_LDRS_PC_G0},
+ {BFD_RELOC_ARM_LDRS_PC_G1, R_ARM_LDRS_PC_G1},
+ {BFD_RELOC_ARM_LDRS_PC_G2, R_ARM_LDRS_PC_G2},
+ {BFD_RELOC_ARM_LDC_PC_G0, R_ARM_LDC_PC_G0},
+ {BFD_RELOC_ARM_LDC_PC_G1, R_ARM_LDC_PC_G1},
+ {BFD_RELOC_ARM_LDC_PC_G2, R_ARM_LDC_PC_G2},
+ {BFD_RELOC_ARM_ALU_SB_G0_NC, R_ARM_ALU_SB_G0_NC},
+ {BFD_RELOC_ARM_ALU_SB_G0, R_ARM_ALU_SB_G0},
+ {BFD_RELOC_ARM_ALU_SB_G1_NC, R_ARM_ALU_SB_G1_NC},
+ {BFD_RELOC_ARM_ALU_SB_G1, R_ARM_ALU_SB_G1},
+ {BFD_RELOC_ARM_ALU_SB_G2, R_ARM_ALU_SB_G2},
+ {BFD_RELOC_ARM_LDR_SB_G0, R_ARM_LDR_SB_G0},
+ {BFD_RELOC_ARM_LDR_SB_G1, R_ARM_LDR_SB_G1},
+ {BFD_RELOC_ARM_LDR_SB_G2, R_ARM_LDR_SB_G2},
+ {BFD_RELOC_ARM_LDRS_SB_G0, R_ARM_LDRS_SB_G0},
+ {BFD_RELOC_ARM_LDRS_SB_G1, R_ARM_LDRS_SB_G1},
+ {BFD_RELOC_ARM_LDRS_SB_G2, R_ARM_LDRS_SB_G2},
+ {BFD_RELOC_ARM_LDC_SB_G0, R_ARM_LDC_SB_G0},
+ {BFD_RELOC_ARM_LDC_SB_G1, R_ARM_LDC_SB_G1},
+ {BFD_RELOC_ARM_LDC_SB_G2, R_ARM_LDC_SB_G2}
+ };
+
+static reloc_howto_type *
+elf32_arm_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED,
+ bfd_reloc_code_real_type code)
+{
+ unsigned int i;
+ 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_from_type (elf32_arm_reloc_map[i].elf_reloc_val);
+
+ return NULL;
+}
+
+static reloc_howto_type *
+elf32_arm_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED,
+ const char *r_name)
+{
+ unsigned int i;
+
+ for (i = 0;
+ i < (sizeof (elf32_arm_howto_table_1)
+ / sizeof (elf32_arm_howto_table_1[0]));
+ i++)
+ if (elf32_arm_howto_table_1[i].name != NULL
+ && strcasecmp (elf32_arm_howto_table_1[i].name, r_name) == 0)
+ return &elf32_arm_howto_table_1[i];
+
+ for (i = 0;
+ i < (sizeof (elf32_arm_howto_table_2)
+ / sizeof (elf32_arm_howto_table_2[0]));
+ i++)
+ if (elf32_arm_howto_table_2[i].name != NULL
+ && strcasecmp (elf32_arm_howto_table_2[i].name, r_name) == 0)
+ return &elf32_arm_howto_table_2[i];
+
+ return NULL;
+}
+
+/* Support for core dump NOTE sections */
+static bfd_boolean
+elf32_arm_nabi_grok_prstatus (bfd *abfd, Elf_Internal_Note *note)
+{
+ int offset;
+ size_t 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;
+ size = 72;
+
+ break;
+
+ case 96: /* FreeBSD/ARM */
+ /* pr_cursig */
+ if (elf_tdata(abfd)->core_signal == 0)
+ elf_tdata (abfd)->core_signal = ((int *)(note->descdata))[5];
+
+ /* pr_pid */
+ elf_tdata (abfd)->core_pid = ((int *)(note->descdata))[6];
+
+ /* pr_reg */
+ offset = 28;
+ size = 68;
+ break;
+ }
+
+ /* Make a ".reg/999" section. */
+ return _bfd_elfcore_make_pseudosection (abfd, ".reg",
+ size, note->descpos + offset);
+}
+
+static bfd_boolean
+elf32_arm_nabi_grok_psinfo (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 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_backend_grok_prstatus elf32_arm_nabi_grok_prstatus
+#define elf_backend_grok_psinfo elf32_arm_nabi_grok_psinfo
+
+typedef unsigned long int insn32;
+typedef unsigned short int insn16;
+
+/* In lieu of proper flags, assume all EABIv4 or later objects are
+ interworkable. */
+#define INTERWORK_FLAG(abfd) \
+ (EF_ARM_EABI_VERSION (elf_elfheader (abfd)->e_flags) >= EF_ARM_EABI_VER4 \
+ || (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"
+
+#define VFP11_ERRATUM_VENEER_SECTION_NAME ".vfp11_veneer"
+#define VFP11_ERRATUM_VENEER_ENTRY_NAME "__vfp11_veneer_%x"
+
+/* 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 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 [] =
+ {
+ 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 [] =
+ {
+ 0xe28fc600, /* add ip, pc, #NN */
+ 0xe28cca00, /* add ip, ip, #NN */
+ 0xe5bcf000, /* ldr pc, [ip, #NN]! */
+ 0x00000000, /* unused */
+ };
+
+#else
+
+/* 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 [] =
+ {
+ 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 [] =
+ {
+ 0xe28fc600, /* add ip, pc, #0xNN00000 */
+ 0xe28cca00, /* add ip, ip, #0xNN000 */
+ 0xe5bcf000, /* ldr pc, [ip, #0xNNN]! */
+ };
+
+#endif
+
+/* The format of the first entry in the procedure linkage table
+ for a VxWorks executable. */
+static const bfd_vma elf32_arm_vxworks_exec_plt0_entry[] =
+ {
+ 0xe52dc008, /* str ip,[sp,#-8]! */
+ 0xe59fc000, /* ldr ip,[pc] */
+ 0xe59cf008, /* ldr pc,[ip,#8] */
+ 0x00000000, /* .long _GLOBAL_OFFSET_TABLE_ */
+ };
+
+/* The format of subsequent entries in a VxWorks executable. */
+static const bfd_vma elf32_arm_vxworks_exec_plt_entry[] =
+ {
+ 0xe59fc000, /* ldr ip,[pc] */
+ 0xe59cf000, /* ldr pc,[ip] */
+ 0x00000000, /* .long @got */
+ 0xe59fc000, /* ldr ip,[pc] */
+ 0xea000000, /* b _PLT */
+ 0x00000000, /* .long @pltindex*sizeof(Elf32_Rela) */
+ };
+
+/* The format of entries in a VxWorks shared library. */
+static const bfd_vma elf32_arm_vxworks_shared_plt_entry[] =
+ {
+ 0xe59fc000, /* ldr ip,[pc] */
+ 0xe79cf009, /* ldr pc,[ip,r9] */
+ 0x00000000, /* .long @got */
+ 0xe59fc000, /* ldr ip,[pc] */
+ 0xe599f008, /* ldr pc,[r9,#8] */
+ 0x00000000, /* .long @pltindex*sizeof(Elf32_Rela) */
+ };
+
+/* An initial stub used if the PLT entry is referenced from Thumb code. */
+#define PLT_THUMB_STUB_SIZE 4
+static const bfd_vma elf32_arm_plt_thumb_stub [] =
+ {
+ 0x4778, /* bx pc */
+ 0x46c0 /* nop */
+ };
+
+/* The entries in a PLT when using a DLL-based target with multiple
+ address spaces. */
+static const bfd_vma elf32_arm_symbian_plt_entry [] =
+ {
+ 0xe51ff004, /* ldr pc, [pc, #-4] */
+ 0x00000000, /* dcd R_ARM_GLOB_DAT(X) */
+ };
+
+/* Used to build a map of a section. This is required for mixed-endian
+ code/data. */
+
+typedef struct elf32_elf_section_map
+{
+ bfd_vma vma;
+ char type;
+}
+elf32_arm_section_map;
+
+/* Information about a VFP11 erratum veneer, or a branch to such a veneer. */
+
+typedef enum
+{
+ VFP11_ERRATUM_BRANCH_TO_ARM_VENEER,
+ VFP11_ERRATUM_BRANCH_TO_THUMB_VENEER,
+ VFP11_ERRATUM_ARM_VENEER,
+ VFP11_ERRATUM_THUMB_VENEER
+}
+elf32_vfp11_erratum_type;
+
+typedef struct elf32_vfp11_erratum_list
+{
+ struct elf32_vfp11_erratum_list *next;
+ bfd_vma vma;
+ union
+ {
+ struct
+ {
+ struct elf32_vfp11_erratum_list *veneer;
+ unsigned int vfp_insn;
+ } b;
+ struct
+ {
+ struct elf32_vfp11_erratum_list *branch;
+ unsigned int id;
+ } v;
+ } u;
+ elf32_vfp11_erratum_type type;
+}
+elf32_vfp11_erratum_list;
+
+typedef struct _arm_elf_section_data
+{
+ struct bfd_elf_section_data elf;
+ unsigned int mapcount;
+ unsigned int mapsize;
+ elf32_arm_section_map *map;
+ unsigned int erratumcount;
+ elf32_vfp11_erratum_list *erratumlist;
+}
+_arm_elf_section_data;
+
+#define elf32_arm_section_data(sec) \
+ ((_arm_elf_section_data *) elf_section_data (sec))
+
+/* The size of the thread control block. */
+#define TCB_SIZE 8
+
+struct elf32_arm_obj_tdata
+{
+ struct elf_obj_tdata root;
+
+ /* tls_type for each local got entry. */
+ char *local_got_tls_type;
+
+ /* Zero to warn when linking objects with incompatible enum sizes. */
+ int no_enum_size_warning;
+};
+
+#define elf32_arm_tdata(abfd) \
+ ((struct elf32_arm_obj_tdata *) (abfd)->tdata.any)
+
+#define elf32_arm_local_got_tls_type(abfd) \
+ (elf32_arm_tdata (abfd)->local_got_tls_type)
+
+static bfd_boolean
+elf32_arm_mkobject (bfd *abfd)
+{
+ if (abfd->tdata.any == NULL)
+ {
+ bfd_size_type amt = sizeof (struct elf32_arm_obj_tdata);
+ abfd->tdata.any = bfd_zalloc (abfd, amt);
+ if (abfd->tdata.any == NULL)
+ return FALSE;
+ }
+ return bfd_elf_mkobject (abfd);
+}
+
+/* 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 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;
+ /* Number of PC-relative relocs copied in this section. */
+ bfd_size_type pc_count;
+ };
+
+#define elf32_arm_hash_entry(ent) ((struct elf32_arm_link_hash_entry *)(ent))
+
+/* 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;
+
+ /* We reference count Thumb references to a PLT entry separately,
+ so that we can emit the Thumb trampoline only if needed. */
+ bfd_signed_vma plt_thumb_refcount;
+
+ /* Since PLT entries have variable size if the Thumb prologue is
+ used, we need to record the index into .got.plt instead of
+ recomputing it from the PLT offset. */
+ bfd_signed_vma plt_got_offset;
+
+#define GOT_UNKNOWN 0
+#define GOT_NORMAL 1
+#define GOT_TLS_GD 2
+#define GOT_TLS_IE 4
+ unsigned char tls_type;
+
+ /* The symbol marking the real symbol location for exported thumb
+ symbols with Arm stubs. */
+ struct elf_link_hash_entry *export_glue;
+ };
+
+/* Traverse an arm ELF linker hash table. */
+#define elf32_arm_link_hash_traverse(table, func, info) \
+ (elf_link_hash_traverse \
+ (&(table)->root, \
+ (bfd_boolean (*) (struct elf_link_hash_entry *, void *)) (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;
+
+ /* The size in bytes of the section containing glue for VFP11 erratum
+ veneers. */
+ bfd_size_type vfp11_erratum_glue_size;
+
+ /* An arbitrary input BFD chosen to hold the glue sections. */
+ bfd * bfd_of_glue_owner;
+
+ /* Nonzero to output a BE8 image. */
+ int byteswap_code;
+
+ /* Zero if R_ARM_TARGET1 means R_ARM_ABS32.
+ Nonzero if R_ARM_TARGET1 means R_ARM_REL32. */
+ int target1_is_rel;
+
+ /* The relocation to use for R_ARM_TARGET2 relocations. */
+ int target2_reloc;
+
+ /* Nonzero to fix BX instructions for ARMv4 targets. */
+ int fix_v4bx;
+
+ /* Nonzero if the ARM/Thumb BLX instructions are available for use. */
+ int use_blx;
+
+ /* What sort of code sequences we should look for which may trigger the
+ VFP11 denorm erratum. */
+ bfd_arm_vfp11_fix vfp11_fix;
+
+ /* Global counter for the number of fixes we have emitted. */
+ int num_vfp11_fixes;
+
+ /* Nonzero to force PIC branch veneers. */
+ int pic_veneer;
+
+ /* The number of bytes in the initial entry in the PLT. */
+ bfd_size_type plt_header_size;
+
+ /* The number of bytes in the subsequent PLT etries. */
+ bfd_size_type plt_entry_size;
+
+ /* True if the target system is VxWorks. */
+ int vxworks_p;
+
+ /* True if the target system is Symbian OS. */
+ int symbian_p;
+
+ /* True if the target uses REL relocations. */
+ int use_rel;
+
+ /* Short-cuts to get to dynamic linker sections. */
+ asection *sgot;
+ asection *sgotplt;
+ asection *srelgot;
+ asection *splt;
+ asection *srelplt;
+ asection *sdynbss;
+ asection *srelbss;
+
+ /* The (unloaded but important) VxWorks .rela.plt.unloaded section. */
+ asection *srelplt2;
+
+ /* Data for R_ARM_TLS_LDM32 relocations. */
+ union {
+ bfd_signed_vma refcount;
+ bfd_vma offset;
+ } tls_ldm_got;
+
+ /* Small local sym to section mapping cache. */
+ struct sym_sec_cache sym_sec;
+
+ /* For convenience in allocate_dynrelocs. */
+ bfd * obfd;
+ };
+
+/* Create an entry in an ARM ELF linker hash table. */
+
+static struct bfd_hash_entry *
+elf32_arm_link_hash_newfunc (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 = bfd_hash_allocate (table, sizeof (struct elf32_arm_link_hash_entry));
+ if (ret == 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 != NULL)
+ {
+ ret->relocs_copied = NULL;
+ ret->tls_type = GOT_UNKNOWN;
+ ret->plt_thumb_refcount = 0;
+ ret->plt_got_offset = -1;
+ ret->export_glue = NULL;
+ }
+
+ return (struct bfd_hash_entry *) ret;
+}
+
+/* Return true if NAME is the name of the relocation section associated
+ with S. */
+
+static bfd_boolean
+reloc_section_p (struct elf32_arm_link_hash_table *htab,
+ const char *name, asection *s)
+{
+ if (htab->use_rel)
+ return CONST_STRNEQ (name, ".rel") && strcmp (s->name, name + 4) == 0;
+ else
+ return CONST_STRNEQ (name, ".rela") && strcmp (s->name, name + 5) == 0;
+}
+
+/* Create .got, .gotplt, and .rel(a).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 elf32_arm_link_hash_table *htab;
+
+ htab = elf32_arm_hash_table (info);
+ /* BPABI objects never have a GOT, or associated sections. */
+ if (htab->symbian_p)
+ return TRUE;
+
+ if (! _bfd_elf_create_got_section (dynobj, info))
+ return FALSE;
+
+ 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_with_flags (dynobj,
+ RELOC_SECTION (htab, ".got"),
+ (SEC_ALLOC | SEC_LOAD
+ | SEC_HAS_CONTENTS
+ | SEC_IN_MEMORY
+ | SEC_LINKER_CREATED
+ | SEC_READONLY));
+ if (htab->srelgot == NULL
+ || ! bfd_set_section_alignment (dynobj, htab->srelgot, 2))
+ return FALSE;
+ return TRUE;
+}
+
+/* Create .plt, .rel(a).plt, .got, .got.plt, .rel(a).got, .dynbss, and
+ .rel(a).bss sections in DYNOBJ, and set up shortcuts to them in our
+ hash table. */
+
+static bfd_boolean
+elf32_arm_create_dynamic_sections (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,
+ RELOC_SECTION (htab, ".plt"));
+ htab->sdynbss = bfd_get_section_by_name (dynobj, ".dynbss");
+ if (!info->shared)
+ htab->srelbss = bfd_get_section_by_name (dynobj,
+ RELOC_SECTION (htab, ".bss"));
+
+ if (htab->vxworks_p)
+ {
+ if (!elf_vxworks_create_dynamic_sections (dynobj, info, &htab->srelplt2))
+ return FALSE;
+
+ if (info->shared)
+ {
+ htab->plt_header_size = 0;
+ htab->plt_entry_size
+ = 4 * ARRAY_SIZE (elf32_arm_vxworks_shared_plt_entry);
+ }
+ else
+ {
+ htab->plt_header_size
+ = 4 * ARRAY_SIZE (elf32_arm_vxworks_exec_plt0_entry);
+ htab->plt_entry_size
+ = 4 * ARRAY_SIZE (elf32_arm_vxworks_exec_plt_entry);
+ }
+ }
+
+ 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 (struct bfd_link_info *info,
+ 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;
+
+ /* Add reloc counts against the indirect sym to the direct 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->pc_count += p->pc_count;
+ 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;
+ }
+
+ if (ind->root.type == bfd_link_hash_indirect)
+ {
+ /* Copy over PLT info. */
+ edir->plt_thumb_refcount += eind->plt_thumb_refcount;
+ eind->plt_thumb_refcount = 0;
+
+ if (dir->got.refcount <= 0)
+ {
+ edir->tls_type = eind->tls_type;
+ eind->tls_type = GOT_UNKNOWN;
+ }
+ }
+
+ _bfd_elf_link_hash_copy_indirect (info, dir, ind);
+}
+
+/* Create an ARM elf linker hash table. */
+
+static struct bfd_link_hash_table *
+elf32_arm_link_hash_table_create (bfd *abfd)
+{
+ struct elf32_arm_link_hash_table *ret;
+ bfd_size_type amt = sizeof (struct elf32_arm_link_hash_table);
+
+ ret = bfd_malloc (amt);
+ if (ret == NULL)
+ return NULL;
+
+ if (!_bfd_elf_link_hash_table_init (& ret->root, abfd,
+ elf32_arm_link_hash_newfunc,
+ sizeof (struct elf32_arm_link_hash_entry)))
+ {
+ 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->srelplt2 = NULL;
+ ret->thumb_glue_size = 0;
+ ret->arm_glue_size = 0;
+ ret->vfp11_fix = BFD_ARM_VFP11_FIX_NONE;
+ ret->vfp11_erratum_glue_size = 0;
+ ret->num_vfp11_fixes = 0;
+ ret->bfd_of_glue_owner = NULL;
+ ret->byteswap_code = 0;
+ ret->target1_is_rel = 0;
+ ret->target2_reloc = R_ARM_NONE;
+#ifdef FOUR_WORD_PLT
+ ret->plt_header_size = 16;
+ ret->plt_entry_size = 16;
+#else
+ ret->plt_header_size = 20;
+ ret->plt_entry_size = 12;
+#endif
+ ret->fix_v4bx = 0;
+ ret->use_blx = 0;
+ ret->vxworks_p = 0;
+ ret->symbian_p = 0;
+ ret->use_rel = 1;
+ ret->sym_sec.abfd = NULL;
+ ret->obfd = abfd;
+ ret->tls_ldm_got.refcount = 0;
+
+ return &ret->root.root;
+}
+
+/* Locate the Thumb encoded calling stub for NAME. */
+
+static struct elf_link_hash_entry *
+find_thumb_glue (struct bfd_link_info *link_info,
+ const char *name,
+ char **error_message)
+{
+ 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 = 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)
+ asprintf (error_message, _("unable to find THUMB glue '%s' for '%s'"),
+ 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 (struct bfd_link_info *link_info,
+ const char *name,
+ char **error_message)
+{
+ 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 = 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)
+ asprintf (error_message, _("unable to find ARM glue '%s' for '%s'"),
+ tmp_name, name);
+
+ free (tmp_name);
+
+ return myh;
+}
+
+/* ARM->Thumb glue (static images):
+
+ .arm
+ __func_from_arm:
+ ldr r12, __func_addr
+ bx r12
+ __func_addr:
+ .word func @ behave as if you saw a ARM_32 reloc.
+
+ (v5t static images)
+ .arm
+ __func_from_arm:
+ ldr pc, __func_addr
+ __func_addr:
+ .word func @ behave as if you saw a ARM_32 reloc.
+
+ (relocatable images)
+ .arm
+ __func_from_arm:
+ ldr r12, __func_offset
+ add r12, r12, pc
+ bx r12
+ __func_offset:
+ .word func - .
+ */
+
+#define ARM2THUMB_STATIC_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;
+
+#define ARM2THUMB_V5_STATIC_GLUE_SIZE 8
+static const insn32 a2t1v5_ldr_insn = 0xe51ff004;
+static const insn32 a2t2v5_func_addr_insn = 0x00000001;
+
+#define ARM2THUMB_PIC_GLUE_SIZE 16
+static const insn32 a2t1p_ldr_insn = 0xe59fc004;
+static const insn32 a2t2p_add_pc_insn = 0xe08cc00f;
+static const insn32 a2t3p_bx_r12_insn = 0xe12fff1c;
+
+/* 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;
+
+#define VFP11_ERRATUM_VENEER_SIZE 8
+
+#ifndef ELFARM_NABI_C_INCLUDED
+bfd_boolean
+bfd_elf32_arm_allocate_interworking_sections (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_alloc (globals->bfd_of_glue_owner, globals->arm_glue_size);
+
+ BFD_ASSERT (s->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_alloc (globals->bfd_of_glue_owner, globals->thumb_glue_size);
+
+ BFD_ASSERT (s->size == globals->thumb_glue_size);
+ s->contents = foo;
+ }
+
+ if (globals->vfp11_erratum_glue_size != 0)
+ {
+ BFD_ASSERT (globals->bfd_of_glue_owner != NULL);
+
+ s = bfd_get_section_by_name
+ (globals->bfd_of_glue_owner, VFP11_ERRATUM_VENEER_SECTION_NAME);
+
+ BFD_ASSERT (s != NULL);
+
+ foo = bfd_alloc (globals->bfd_of_glue_owner,
+ globals->vfp11_erratum_glue_size);
+
+ BFD_ASSERT (s->size == globals->vfp11_erratum_glue_size);
+ s->contents = foo;
+ }
+
+ return TRUE;
+}
+
+/* Allocate space and symbols for calling a Thumb function from Arm mode.
+ returns the symbol identifying teh stub. */
+static struct elf_link_hash_entry *
+record_arm_to_thumb_glue (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;
+ bfd_size_type size;
+
+ 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 = 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 myh;
+ }
+
+ /* 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);
+
+ myh = (struct elf_link_hash_entry *) bh;
+ myh->type = ELF_ST_INFO (STB_LOCAL, STT_FUNC);
+ myh->forced_local = 1;
+
+ free (tmp_name);
+
+ if (link_info->shared || globals->root.is_relocatable_executable
+ || globals->pic_veneer)
+ size = ARM2THUMB_PIC_GLUE_SIZE;
+ else if (globals->use_blx)
+ size = ARM2THUMB_V5_STATIC_GLUE_SIZE;
+ else
+ size = ARM2THUMB_STATIC_GLUE_SIZE;
+
+ s->size += size;
+ globals->arm_glue_size += size;
+
+ return myh;
+}
+
+static void
+record_thumb_to_arm_glue (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;
+ 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 = 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;
+ myh->type = ELF_ST_INFO (STB_LOCAL, STT_ARM_TFUNC);
+ myh->forced_local = 1;
+
+ 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 = 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);
+
+ s->size += THUMB2ARM_GLUE_SIZE;
+ hash_table->thumb_glue_size += THUMB2ARM_GLUE_SIZE;
+
+ return;
+}
+
+
+/* Add an entry to the code/data map for section SEC. */
+
+static void
+elf32_arm_section_map_add (asection *sec, char type, bfd_vma vma)
+{
+ struct _arm_elf_section_data *sec_data = elf32_arm_section_data (sec);
+ unsigned int newidx;
+
+ if (sec_data->map == NULL)
+ {
+ sec_data->map = bfd_malloc (sizeof (elf32_arm_section_map));
+ sec_data->mapcount = 0;
+ sec_data->mapsize = 1;
+ }
+
+ newidx = sec_data->mapcount++;
+
+ if (sec_data->mapcount > sec_data->mapsize)
+ {
+ sec_data->mapsize *= 2;
+ sec_data->map = bfd_realloc (sec_data->map, sec_data->mapsize
+ * sizeof (elf32_arm_section_map));
+ }
+
+ sec_data->map[newidx].vma = vma;
+ sec_data->map[newidx].type = type;
+}
+
+
+/* Record information about a VFP11 denorm-erratum veneer. Only ARM-mode
+ veneers are handled for now. */
+
+static bfd_vma
+record_vfp11_erratum_veneer (struct bfd_link_info *link_info,
+ elf32_vfp11_erratum_list *branch,
+ bfd *branch_bfd,
+ asection *branch_sec,
+ unsigned int offset)
+{
+ asection *s;
+ struct elf32_arm_link_hash_table *hash_table;
+ char *tmp_name;
+ struct elf_link_hash_entry *myh;
+ struct bfd_link_hash_entry *bh;
+ bfd_vma val;
+ struct _arm_elf_section_data *sec_data;
+ int errcount;
+ elf32_vfp11_erratum_list *newerr;
+
+ 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, VFP11_ERRATUM_VENEER_SECTION_NAME);
+
+ sec_data = elf32_arm_section_data (s);
+
+ BFD_ASSERT (s != NULL);
+
+ tmp_name = bfd_malloc ((bfd_size_type) strlen
+ (VFP11_ERRATUM_VENEER_ENTRY_NAME) + 10);
+
+ BFD_ASSERT (tmp_name);
+
+ sprintf (tmp_name, VFP11_ERRATUM_VENEER_ENTRY_NAME,
+ hash_table->num_vfp11_fixes);
+
+ myh = elf_link_hash_lookup
+ (&(hash_table)->root, tmp_name, FALSE, FALSE, FALSE);
+
+ BFD_ASSERT (myh == NULL);
+
+ bh = NULL;
+ val = hash_table->vfp11_erratum_glue_size;
+ _bfd_generic_link_add_one_symbol (link_info, hash_table->bfd_of_glue_owner,
+ tmp_name, BSF_FUNCTION | BSF_LOCAL, s, val,
+ NULL, TRUE, FALSE, &bh);
+
+ myh = (struct elf_link_hash_entry *) bh;
+ myh->type = ELF_ST_INFO (STB_LOCAL, STT_FUNC);
+ myh->forced_local = 1;
+
+ /* Link veneer back to calling location. */
+ errcount = ++(sec_data->erratumcount);
+ newerr = bfd_zmalloc (sizeof (elf32_vfp11_erratum_list));
+
+ newerr->type = VFP11_ERRATUM_ARM_VENEER;
+ newerr->vma = -1;
+ newerr->u.v.branch = branch;
+ newerr->u.v.id = hash_table->num_vfp11_fixes;
+ branch->u.b.veneer = newerr;
+
+ newerr->next = sec_data->erratumlist;
+ sec_data->erratumlist = newerr;
+
+ /* A symbol for the return from the veneer. */
+ sprintf (tmp_name, VFP11_ERRATUM_VENEER_ENTRY_NAME "_r",
+ hash_table->num_vfp11_fixes);
+
+ myh = elf_link_hash_lookup
+ (&(hash_table)->root, tmp_name, FALSE, FALSE, FALSE);
+
+ if (myh != NULL)
+ abort ();
+
+ bh = NULL;
+ val = offset + 4;
+ _bfd_generic_link_add_one_symbol (link_info, branch_bfd, tmp_name, BSF_LOCAL,
+ branch_sec, val, NULL, TRUE, FALSE, &bh);
+
+ myh = (struct elf_link_hash_entry *) bh;
+ myh->type = ELF_ST_INFO (STB_LOCAL, STT_FUNC);
+ myh->forced_local = 1;
+
+ free (tmp_name);
+
+ /* Generate a mapping symbol for the veneer section, and explicitly add an
+ entry for that symbol to the code/data map for the section. */
+ if (hash_table->vfp11_erratum_glue_size == 0)
+ {
+ bh = NULL;
+ /* FIXME: Creates an ARM symbol. Thumb mode will need attention if it
+ ever requires this erratum fix. */
+ _bfd_generic_link_add_one_symbol (link_info,
+ hash_table->bfd_of_glue_owner, "$a",
+ BSF_LOCAL, s, 0, NULL,
+ TRUE, FALSE, &bh);
+
+ myh = (struct elf_link_hash_entry *) bh;
+ myh->type = ELF_ST_INFO (STB_LOCAL, STT_NOTYPE);
+ myh->forced_local = 1;
+
+ /* The elf32_arm_init_maps function only cares about symbols from input
+ BFDs. We must make a note of this generated mapping symbol
+ ourselves so that code byteswapping works properly in
+ elf32_arm_write_section. */
+ elf32_arm_section_map_add (s, 'a', 0);
+ }
+
+ s->size += VFP11_ERRATUM_VENEER_SIZE;
+ hash_table->vfp11_erratum_glue_size += VFP11_ERRATUM_VENEER_SIZE;
+ hash_table->num_vfp11_fixes++;
+
+ /* The offset of the veneer. */
+ return val;
+}
+
+/* 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 (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_with_flags (abfd,
+ ARM2THUMB_GLUE_SECTION_NAME,
+ flags);
+
+ if (sec == NULL
+ || !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_with_flags (abfd,
+ THUMB2ARM_GLUE_SECTION_NAME,
+ flags);
+
+ if (sec == NULL
+ || !bfd_set_section_alignment (abfd, sec, 2))
+ return FALSE;
+
+ sec->gc_mark = 1;
+ }
+
+ sec = bfd_get_section_by_name (abfd, VFP11_ERRATUM_VENEER_SECTION_NAME);
+
+ if (sec == NULL)
+ {
+ flags = (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS | SEC_IN_MEMORY
+ | SEC_CODE | SEC_READONLY);
+
+ sec = bfd_make_section_with_flags (abfd,
+ VFP11_ERRATUM_VENEER_SECTION_NAME,
+ flags);
+
+ if (sec == NULL
+ || !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 (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;
+
+ /* Make sure we don't attach the glue sections to a dynamic object. */
+ BFD_ASSERT (!(abfd->flags & DYNAMIC));
+
+ 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;
+}
+
+static void check_use_blx(struct elf32_arm_link_hash_table *globals)
+{
+ if (bfd_elf_get_obj_attr_int (globals->obfd, OBJ_ATTR_PROC,
+ Tag_CPU_arch) > 2)
+ globals->use_blx = 1;
+}
+
+bfd_boolean
+bfd_elf32_arm_process_before_allocation (bfd *abfd,
+ struct bfd_link_info *link_info)
+{
+ 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);
+ check_use_blx (globals);
+
+ BFD_ASSERT (globals != NULL);
+ BFD_ASSERT (globals->bfd_of_glue_owner != NULL);
+
+ if (globals->byteswap_code && !bfd_big_endian (abfd))
+ {
+ _bfd_error_handler (_("%B: BE8 images only valid in big-endian mode."),
+ abfd);
+ return FALSE;
+ }
+
+ /* 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;
+
+ if ((sec->flags & SEC_EXCLUDE) != 0)
+ continue;
+
+ symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
+
+ /* Load the relocs. */
+ internal_relocs
+ = _bfd_elf_link_read_relocs (abfd, sec, (void *) 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_PLT32
+ && r_type != R_ARM_CALL
+ && r_type != R_ARM_JUMP24
+ && r_type != R_ARM_THM_CALL)
+ 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. */
+ if (! bfd_malloc_and_get_section (abfd, sec, &contents))
+ 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;
+
+ /* If the call will go through a PLT entry then we do not need
+ glue. */
+ if (globals->splt != NULL && h->plt.offset != (bfd_vma) -1)
+ continue;
+
+ switch (r_type)
+ {
+ case R_ARM_PC24:
+ case R_ARM_PLT32:
+ case R_ARM_CALL:
+ case R_ARM_JUMP24:
+ /* 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
+ && !(r_type == R_ARM_CALL && globals->use_blx))
+ record_arm_to_thumb_glue (link_info, h);
+ break;
+
+ case R_ARM_THM_CALL:
+ /* 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 && !globals->use_blx
+ && h->root.type != bfd_link_hash_undefweak)
+ record_thumb_to_arm_glue (link_info, h);
+ break;
+
+ default:
+ abort ();
+ }
+ }
+
+ 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
+
+
+/* Initialise maps of ARM/Thumb/data for input BFDs. */
+
+void
+bfd_elf32_arm_init_maps (bfd *abfd)
+{
+ Elf_Internal_Sym *isymbuf;
+ Elf_Internal_Shdr *hdr;
+ unsigned int i, localsyms;
+
+ if (bfd_get_flavour (abfd) != bfd_target_elf_flavour || elf_tdata (abfd) == NULL)
+ return;
+
+ if ((abfd->flags & DYNAMIC) != 0)
+ return;
+
+ hdr = &elf_tdata (abfd)->symtab_hdr;
+ localsyms = hdr->sh_info;
+
+ /* Obtain a buffer full of symbols for this BFD. The hdr->sh_info field
+ should contain the number of local symbols, which should come before any
+ global symbols. Mapping symbols are always local. */
+ isymbuf = bfd_elf_get_elf_syms (abfd, hdr, localsyms, 0, NULL, NULL,
+ NULL);
+
+ /* No internal symbols read? Skip this BFD. */
+ if (isymbuf == NULL)
+ return;
+
+ for (i = 0; i < localsyms; i++)
+ {
+ Elf_Internal_Sym *isym = &isymbuf[i];
+ asection *sec = bfd_section_from_elf_index (abfd, isym->st_shndx);
+ const char *name;
+
+ if (sec != NULL
+ && ELF_ST_BIND (isym->st_info) == STB_LOCAL)
+ {
+ name = bfd_elf_string_from_elf_section (abfd,
+ hdr->sh_link, isym->st_name);
+
+ if (bfd_is_arm_special_symbol_name (name,
+ BFD_ARM_SPECIAL_SYM_TYPE_MAP))
+ elf32_arm_section_map_add (sec, name[1], isym->st_value);
+ }
+ }
+}
+
+
+void
+bfd_elf32_arm_set_vfp11_fix (bfd *obfd, struct bfd_link_info *link_info)
+{
+ struct elf32_arm_link_hash_table *globals = elf32_arm_hash_table (link_info);
+ obj_attribute *out_attr = elf_known_obj_attributes_proc (obfd);
+
+ /* We assume that ARMv7+ does not need the VFP11 denorm erratum fix. */
+ if (out_attr[Tag_CPU_arch].i >= TAG_CPU_ARCH_V7)
+ {
+ switch (globals->vfp11_fix)
+ {
+ case BFD_ARM_VFP11_FIX_DEFAULT:
+ case BFD_ARM_VFP11_FIX_NONE:
+ globals->vfp11_fix = BFD_ARM_VFP11_FIX_NONE;
+ break;
+
+ default:
+ /* Give a warning, but do as the user requests anyway. */
+ (*_bfd_error_handler) (_("%B: warning: selected VFP11 erratum "
+ "workaround is not necessary for target architecture"), obfd);
+ }
+ }
+ else if (globals->vfp11_fix == BFD_ARM_VFP11_FIX_DEFAULT)
+ /* For earlier architectures, we might need the workaround, but do not
+ enable it by default. If users is running with broken hardware, they
+ must enable the erratum fix explicitly. */
+ globals->vfp11_fix = BFD_ARM_VFP11_FIX_NONE;
+}
+
+
+enum bfd_arm_vfp11_pipe {
+ VFP11_FMAC,
+ VFP11_LS,
+ VFP11_DS,
+ VFP11_BAD
+};
+
+/* Return a VFP register number. This is encoded as RX:X for single-precision
+ registers, or X:RX for double-precision registers, where RX is the group of
+ four bits in the instruction encoding and X is the single extension bit.
+ RX and X fields are specified using their lowest (starting) bit. The return
+ value is:
+
+ 0...31: single-precision registers s0...s31
+ 32...63: double-precision registers d0...d31.
+
+ Although X should be zero for VFP11 (encoding d0...d15 only), we might
+ encounter VFP3 instructions, so we allow the full range for DP registers. */
+
+static unsigned int
+bfd_arm_vfp11_regno (unsigned int insn, bfd_boolean is_double, unsigned int rx,
+ unsigned int x)
+{
+ if (is_double)
+ return (((insn >> rx) & 0xf) | (((insn >> x) & 1) << 4)) + 32;
+ else
+ return (((insn >> rx) & 0xf) << 1) | ((insn >> x) & 1);
+}
+
+/* Set bits in *WMASK according to a register number REG as encoded by
+ bfd_arm_vfp11_regno(). Ignore d16-d31. */
+
+static void
+bfd_arm_vfp11_write_mask (unsigned int *wmask, unsigned int reg)
+{
+ if (reg < 32)
+ *wmask |= 1 << reg;
+ else if (reg < 48)
+ *wmask |= 3 << ((reg - 32) * 2);
+}
+
+/* Return TRUE if WMASK overwrites anything in REGS. */
+
+static bfd_boolean
+bfd_arm_vfp11_antidependency (unsigned int wmask, int *regs, int numregs)
+{
+ int i;
+
+ for (i = 0; i < numregs; i++)
+ {
+ unsigned int reg = regs[i];
+
+ if (reg < 32 && (wmask & (1 << reg)) != 0)
+ return TRUE;
+
+ reg -= 32;
+
+ if (reg >= 16)
+ continue;
+
+ if ((wmask & (3 << (reg * 2))) != 0)
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+/* In this function, we're interested in two things: finding input registers
+ for VFP data-processing instructions, and finding the set of registers which
+ arbitrary VFP instructions may write to. We use a 32-bit unsigned int to
+ hold the written set, so FLDM etc. are easy to deal with (we're only
+ interested in 32 SP registers or 16 dp registers, due to the VFP version
+ implemented by the chip in question). DP registers are marked by setting
+ both SP registers in the write mask). */
+
+static enum bfd_arm_vfp11_pipe
+bfd_arm_vfp11_insn_decode (unsigned int insn, unsigned int *destmask, int *regs,
+ int *numregs)
+{
+ enum bfd_arm_vfp11_pipe pipe = VFP11_BAD;
+ bfd_boolean is_double = ((insn & 0xf00) == 0xb00) ? 1 : 0;
+
+ if ((insn & 0x0f000e10) == 0x0e000a00) /* A data-processing insn. */
+ {
+ unsigned int pqrs;
+ unsigned int fd = bfd_arm_vfp11_regno (insn, is_double, 12, 22);
+ unsigned int fm = bfd_arm_vfp11_regno (insn, is_double, 0, 5);
+
+ pqrs = ((insn & 0x00800000) >> 20)
+ | ((insn & 0x00300000) >> 19)
+ | ((insn & 0x00000040) >> 6);
+
+ switch (pqrs)
+ {
+ case 0: /* fmac[sd]. */
+ case 1: /* fnmac[sd]. */
+ case 2: /* fmsc[sd]. */
+ case 3: /* fnmsc[sd]. */
+ pipe = VFP11_FMAC;
+ bfd_arm_vfp11_write_mask (destmask, fd);
+ regs[0] = fd;
+ regs[1] = bfd_arm_vfp11_regno (insn, is_double, 16, 7); /* Fn. */
+ regs[2] = fm;
+ *numregs = 3;
+ break;
+
+ case 4: /* fmul[sd]. */
+ case 5: /* fnmul[sd]. */
+ case 6: /* fadd[sd]. */
+ case 7: /* fsub[sd]. */
+ pipe = VFP11_FMAC;
+ goto vfp_binop;
+
+ case 8: /* fdiv[sd]. */
+ pipe = VFP11_DS;
+ vfp_binop:
+ bfd_arm_vfp11_write_mask (destmask, fd);
+ regs[0] = bfd_arm_vfp11_regno (insn, is_double, 16, 7); /* Fn. */
+ regs[1] = fm;
+ *numregs = 2;
+ break;
+
+ case 15: /* extended opcode. */
+ {
+ unsigned int extn = ((insn >> 15) & 0x1e)
+ | ((insn >> 7) & 1);
+
+ switch (extn)
+ {
+ case 0: /* fcpy[sd]. */
+ case 1: /* fabs[sd]. */
+ case 2: /* fneg[sd]. */
+ case 8: /* fcmp[sd]. */
+ case 9: /* fcmpe[sd]. */
+ case 10: /* fcmpz[sd]. */
+ case 11: /* fcmpez[sd]. */
+ case 16: /* fuito[sd]. */
+ case 17: /* fsito[sd]. */
+ case 24: /* ftoui[sd]. */
+ case 25: /* ftouiz[sd]. */
+ case 26: /* ftosi[sd]. */
+ case 27: /* ftosiz[sd]. */
+ /* These instructions will not bounce due to underflow. */
+ *numregs = 0;
+ pipe = VFP11_FMAC;
+ break;
+
+ case 3: /* fsqrt[sd]. */
+ /* fsqrt cannot underflow, but it can (perhaps) overwrite
+ registers to cause the erratum in previous instructions. */
+ bfd_arm_vfp11_write_mask (destmask, fd);
+ pipe = VFP11_DS;
+ break;
+
+ case 15: /* fcvt{ds,sd}. */
+ {
+ int rnum = 0;
+
+ bfd_arm_vfp11_write_mask (destmask, fd);
+
+ /* Only FCVTSD can underflow. */
+ if ((insn & 0x100) != 0)
+ regs[rnum++] = fm;
+
+ *numregs = rnum;
+
+ pipe = VFP11_FMAC;
+ }
+ break;
+
+ default:
+ return VFP11_BAD;
+ }
+ }
+ break;
+
+ default:
+ return VFP11_BAD;
+ }
+ }
+ /* Two-register transfer. */
+ else if ((insn & 0x0fe00ed0) == 0x0c400a10)
+ {
+ unsigned int fm = bfd_arm_vfp11_regno (insn, is_double, 0, 5);
+
+ if ((insn & 0x100000) == 0)
+ {
+ if (is_double)
+ bfd_arm_vfp11_write_mask (destmask, fm);
+ else
+ {
+ bfd_arm_vfp11_write_mask (destmask, fm);
+ bfd_arm_vfp11_write_mask (destmask, fm + 1);
+ }
+ }
+
+ pipe = VFP11_LS;
+ }
+ else if ((insn & 0x0e100e00) == 0x0c100a00) /* A load insn. */
+ {
+ int fd = bfd_arm_vfp11_regno (insn, is_double, 12, 22);
+ unsigned int puw = ((insn >> 21) & 0x1) | (((insn >> 23) & 3) << 1);
+
+ switch (puw)
+ {
+ case 0: /* Two-reg transfer. We should catch these above. */
+ abort ();
+
+ case 2: /* fldm[sdx]. */
+ case 3:
+ case 5:
+ {
+ unsigned int i, offset = insn & 0xff;
+
+ if (is_double)
+ offset >>= 1;
+
+ for (i = fd; i < fd + offset; i++)
+ bfd_arm_vfp11_write_mask (destmask, i);
+ }
+ break;
+
+ case 4: /* fld[sd]. */
+ case 6:
+ bfd_arm_vfp11_write_mask (destmask, fd);
+ break;
+
+ default:
+ return VFP11_BAD;
+ }
+
+ pipe = VFP11_LS;
+ }
+ /* Single-register transfer. Note L==0. */
+ else if ((insn & 0x0f100e10) == 0x0e000a10)
+ {
+ unsigned int opcode = (insn >> 21) & 7;
+ unsigned int fn = bfd_arm_vfp11_regno (insn, is_double, 16, 7);
+
+ switch (opcode)
+ {
+ case 0: /* fmsr/fmdlr. */
+ case 1: /* fmdhr. */
+ /* Mark fmdhr and fmdlr as writing to the whole of the DP
+ destination register. I don't know if this is exactly right,
+ but it is the conservative choice. */
+ bfd_arm_vfp11_write_mask (destmask, fn);
+ break;
+
+ case 7: /* fmxr. */
+ break;
+ }
+
+ pipe = VFP11_LS;
+ }
+
+ return pipe;
+}
+
+
+static int elf32_arm_compare_mapping (const void * a, const void * b);
+
+
+/* Look for potentially-troublesome code sequences which might trigger the
+ VFP11 denormal/antidependency erratum. See, e.g., the ARM1136 errata sheet
+ (available from ARM) for details of the erratum. A short version is
+ described in ld.texinfo. */
+
+bfd_boolean
+bfd_elf32_arm_vfp11_erratum_scan (bfd *abfd, struct bfd_link_info *link_info)
+{
+ asection *sec;
+ bfd_byte *contents = NULL;
+ int state = 0;
+ int regs[3], numregs = 0;
+ struct elf32_arm_link_hash_table *globals = elf32_arm_hash_table (link_info);
+ int use_vector = (globals->vfp11_fix == BFD_ARM_VFP11_FIX_VECTOR);
+
+ /* We use a simple FSM to match troublesome VFP11 instruction sequences.
+ The states transition as follows:
+
+ 0 -> 1 (vector) or 0 -> 2 (scalar)
+ A VFP FMAC-pipeline instruction has been seen. Fill
+ regs[0]..regs[numregs-1] with its input operands. Remember this
+ instruction in 'first_fmac'.
+
+ 1 -> 2
+ Any instruction, except for a VFP instruction which overwrites
+ regs[*].
+
+ 1 -> 3 [ -> 0 ] or
+ 2 -> 3 [ -> 0 ]
+ A VFP instruction has been seen which overwrites any of regs[*].
+ We must make a veneer! Reset state to 0 before examining next
+ instruction.
+
+ 2 -> 0
+ If we fail to match anything in state 2, reset to state 0 and reset
+ the instruction pointer to the instruction after 'first_fmac'.
+
+ If the VFP11 vector mode is in use, there must be at least two unrelated
+ instructions between anti-dependent VFP11 instructions to properly avoid
+ triggering the erratum, hence the use of the extra state 1.
+ */
+
+ /* If we are only performing a partial link do not bother
+ to construct any glue. */
+ if (link_info->relocatable)
+ return TRUE;
+
+ /* We should have chosen a fix type by the time we get here. */
+ BFD_ASSERT (globals->vfp11_fix != BFD_ARM_VFP11_FIX_DEFAULT);
+
+ if (globals->vfp11_fix == BFD_ARM_VFP11_FIX_NONE)
+ return TRUE;
+
+ /* Skip if this bfd does not correspond to an ELF image. */
+ if (bfd_get_flavour (abfd) != bfd_target_elf_flavour)
+ return TRUE;
+
+ for (sec = abfd->sections; sec != NULL; sec = sec->next)
+ {
+ unsigned int i, span, first_fmac = 0, veneer_of_insn = 0;
+ struct _arm_elf_section_data *sec_data;
+
+ /* If we don't have executable progbits, we're not interested in this
+ section. Also skip if section is to be excluded. */
+ if (elf_section_type (sec) != SHT_PROGBITS
+ || (elf_section_flags (sec) & SHF_EXECINSTR) == 0
+ || (sec->flags & SEC_EXCLUDE) != 0
+ || strcmp (sec->name, VFP11_ERRATUM_VENEER_SECTION_NAME) == 0)
+ continue;
+
+ sec_data = elf32_arm_section_data (sec);
+
+ if (sec_data->mapcount == 0)
+ continue;
+
+ if (elf_section_data (sec)->this_hdr.contents != NULL)
+ contents = elf_section_data (sec)->this_hdr.contents;
+ else if (! bfd_malloc_and_get_section (abfd, sec, &contents))
+ goto error_return;
+
+ qsort (sec_data->map, sec_data->mapcount, sizeof (elf32_arm_section_map),
+ elf32_arm_compare_mapping);
+
+ for (span = 0; span < sec_data->mapcount; span++)
+ {
+ unsigned int span_start = sec_data->map[span].vma;
+ unsigned int span_end = (span == sec_data->mapcount - 1)
+ ? sec->size : sec_data->map[span + 1].vma;
+ char span_type = sec_data->map[span].type;
+
+ /* FIXME: Only ARM mode is supported at present. We may need to
+ support Thumb-2 mode also at some point. */
+ if (span_type != 'a')
+ continue;
+
+ for (i = span_start; i < span_end;)
+ {
+ unsigned int next_i = i + 4;
+ unsigned int insn = bfd_big_endian (abfd)
+ ? (contents[i] << 24)
+ | (contents[i + 1] << 16)
+ | (contents[i + 2] << 8)
+ | contents[i + 3]
+ : (contents[i + 3] << 24)
+ | (contents[i + 2] << 16)
+ | (contents[i + 1] << 8)
+ | contents[i];
+ unsigned int writemask = 0;
+ enum bfd_arm_vfp11_pipe pipe;
+
+ switch (state)
+ {
+ case 0:
+ pipe = bfd_arm_vfp11_insn_decode (insn, &writemask, regs,
+ &numregs);
+ /* I'm assuming the VFP11 erratum can trigger with denorm
+ operands on either the FMAC or the DS pipeline. This might
+ lead to slightly overenthusiastic veneer insertion. */
+ if (pipe == VFP11_FMAC || pipe == VFP11_DS)
+ {
+ state = use_vector ? 1 : 2;
+ first_fmac = i;
+ veneer_of_insn = insn;
+ }
+ break;
+
+ case 1:
+ {
+ int other_regs[3], other_numregs;
+ pipe = bfd_arm_vfp11_insn_decode (insn, &writemask,
+ other_regs,
+ &other_numregs);
+ if (pipe != VFP11_BAD
+ && bfd_arm_vfp11_antidependency (writemask, regs,
+ numregs))
+ state = 3;
+ else
+ state = 2;
+ }
+ break;
+
+ case 2:
+ {
+ int other_regs[3], other_numregs;
+ pipe = bfd_arm_vfp11_insn_decode (insn, &writemask,
+ other_regs,
+ &other_numregs);
+ if (pipe != VFP11_BAD
+ && bfd_arm_vfp11_antidependency (writemask, regs,
+ numregs))
+ state = 3;
+ else
+ {
+ state = 0;
+ next_i = first_fmac + 4;
+ }
+ }
+ break;
+
+ case 3:
+ abort (); /* Should be unreachable. */
+ }
+
+ if (state == 3)
+ {
+ elf32_vfp11_erratum_list *newerr
+ = bfd_zmalloc (sizeof (elf32_vfp11_erratum_list));
+ int errcount;
+
+ errcount = ++(elf32_arm_section_data (sec)->erratumcount);
+
+ newerr->u.b.vfp_insn = veneer_of_insn;
+
+ switch (span_type)
+ {
+ case 'a':
+ newerr->type = VFP11_ERRATUM_BRANCH_TO_ARM_VENEER;
+ break;
+
+ default:
+ abort ();
+ }
+
+ record_vfp11_erratum_veneer (link_info, newerr, abfd, sec,
+ first_fmac);
+
+ newerr->vma = -1;
+
+ newerr->next = sec_data->erratumlist;
+ sec_data->erratumlist = newerr;
+
+ state = 0;
+ }
+
+ i = next_i;
+ }
+ }
+
+ if (contents != NULL
+ && elf_section_data (sec)->this_hdr.contents != contents)
+ free (contents);
+ contents = NULL;
+ }
+
+ return TRUE;
+
+error_return:
+ if (contents != NULL
+ && elf_section_data (sec)->this_hdr.contents != contents)
+ free (contents);
+
+ return FALSE;
+}
+
+/* Find virtual-memory addresses for VFP11 erratum veneers and return locations
+ after sections have been laid out, using specially-named symbols. */
+
+void
+bfd_elf32_arm_vfp11_fix_veneer_locations (bfd *abfd,
+ struct bfd_link_info *link_info)
+{
+ asection *sec;
+ struct elf32_arm_link_hash_table *globals;
+ char *tmp_name;
+
+ if (link_info->relocatable)
+ return;
+
+ /* Skip if this bfd does not correspond to an ELF image. */
+ if (bfd_get_flavour (abfd) != bfd_target_elf_flavour)
+ return;
+
+ globals = elf32_arm_hash_table (link_info);
+
+ tmp_name = bfd_malloc ((bfd_size_type) strlen
+ (VFP11_ERRATUM_VENEER_ENTRY_NAME) + 10);
+
+ for (sec = abfd->sections; sec != NULL; sec = sec->next)
+ {
+ struct _arm_elf_section_data *sec_data = elf32_arm_section_data (sec);
+ elf32_vfp11_erratum_list *errnode = sec_data->erratumlist;
+
+ for (; errnode != NULL; errnode = errnode->next)
+ {
+ struct elf_link_hash_entry *myh;
+ bfd_vma vma;
+
+ switch (errnode->type)
+ {
+ case VFP11_ERRATUM_BRANCH_TO_ARM_VENEER:
+ case VFP11_ERRATUM_BRANCH_TO_THUMB_VENEER:
+ /* Find veneer symbol. */
+ sprintf (tmp_name, VFP11_ERRATUM_VENEER_ENTRY_NAME,
+ errnode->u.b.veneer->u.v.id);
+
+ myh = elf_link_hash_lookup
+ (&(globals)->root, tmp_name, FALSE, FALSE, TRUE);
+
+ if (myh == NULL)
+ (*_bfd_error_handler) (_("%B: unable to find VFP11 veneer "
+ "`%s'"), abfd, tmp_name);
+
+ vma = myh->root.u.def.section->output_section->vma
+ + myh->root.u.def.section->output_offset
+ + myh->root.u.def.value;
+
+ errnode->u.b.veneer->vma = vma;
+ break;
+
+ case VFP11_ERRATUM_ARM_VENEER:
+ case VFP11_ERRATUM_THUMB_VENEER:
+ /* Find return location. */
+ sprintf (tmp_name, VFP11_ERRATUM_VENEER_ENTRY_NAME "_r",
+ errnode->u.v.id);
+
+ myh = elf_link_hash_lookup
+ (&(globals)->root, tmp_name, FALSE, FALSE, TRUE);
+
+ if (myh == NULL)
+ (*_bfd_error_handler) (_("%B: unable to find VFP11 veneer "
+ "`%s'"), abfd, tmp_name);
+
+ vma = myh->root.u.def.section->output_section->vma
+ + myh->root.u.def.section->output_offset
+ + myh->root.u.def.value;
+
+ errnode->u.v.branch->vma = vma;
+ break;
+
+ default:
+ abort ();
+ }
+ }
+ }
+
+ free (tmp_name);
+}
+
+
+/* Set target relocation values needed during linking. */
+
+void
+bfd_elf32_arm_set_target_relocs (struct bfd *output_bfd,
+ struct bfd_link_info *link_info,
+ int target1_is_rel,
+ char * target2_type,
+ int fix_v4bx,
+ int use_blx,
+ bfd_arm_vfp11_fix vfp11_fix,
+ int no_enum_warn, int pic_veneer)
+{
+ struct elf32_arm_link_hash_table *globals;
+
+ globals = elf32_arm_hash_table (link_info);
+
+ globals->target1_is_rel = target1_is_rel;
+ if (strcmp (target2_type, "rel") == 0)
+ globals->target2_reloc = R_ARM_REL32;
+ else if (strcmp (target2_type, "abs") == 0)
+ globals->target2_reloc = R_ARM_ABS32;
+ else if (strcmp (target2_type, "got-rel") == 0)
+ globals->target2_reloc = R_ARM_GOT_PREL;
+ else
+ {
+ _bfd_error_handler (_("Invalid TARGET2 relocation type '%s'."),
+ target2_type);
+ }
+ globals->fix_v4bx = fix_v4bx;
+ globals->use_blx |= use_blx;
+ globals->vfp11_fix = vfp11_fix;
+ globals->pic_veneer = pic_veneer;
+
+ elf32_arm_tdata (output_bfd)->no_enum_size_warning = no_enum_warn;
+}
+
+/* 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 (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;
+}
+
+
+/* Store an Arm insn into an output section not processed by
+ elf32_arm_write_section. */
+
+static void
+put_arm_insn (struct elf32_arm_link_hash_table *htab,
+ bfd * output_bfd, bfd_vma val, void * ptr)
+{
+ if (htab->byteswap_code != bfd_little_endian (output_bfd))
+ bfd_putl32 (val, ptr);
+ else
+ bfd_putb32 (val, ptr);
+}
+
+
+/* Store a 16-bit Thumb insn into an output section not processed by
+ elf32_arm_write_section. */
+
+static void
+put_thumb_insn (struct elf32_arm_link_hash_table *htab,
+ bfd * output_bfd, bfd_vma val, void * ptr)
+{
+ if (htab->byteswap_code != bfd_little_endian (output_bfd))
+ bfd_putl16 (val, ptr);
+ else
+ bfd_putb16 (val, ptr);
+}
+
+
+/* Thumb code calling an ARM function. */
+
+static int
+elf32_thumb_to_arm_stub (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,
+ char **error_message)
+{
+ 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, error_message);
+ 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)
+ (_("%B(%s): warning: interworking not enabled.\n"
+ " first occurrence: %B: thumb call to arm"),
+ sym_sec->owner, input_bfd, name);
+
+ return FALSE;
+ }
+
+ --my_offset;
+ myh->root.u.def.value = my_offset;
+
+ put_thumb_insn (globals, output_bfd, (bfd_vma) t2a1_bx_pc_insn,
+ s->contents + my_offset);
+
+ put_thumb_insn (globals, 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);
+
+ put_arm_insn (globals, 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;
+}
+
+/* Populate an Arm to Thumb stub. Returns the stub symbol. */
+
+static struct elf_link_hash_entry *
+elf32_arm_create_thumb_stub (struct bfd_link_info * info,
+ const char * name,
+ bfd * input_bfd,
+ bfd * output_bfd,
+ asection * sym_sec,
+ bfd_vma val,
+ asection *s,
+ char **error_message)
+{
+ bfd_vma my_offset;
+ long int ret_offset;
+ struct elf_link_hash_entry * myh;
+ struct elf32_arm_link_hash_table * globals;
+
+ myh = find_arm_glue (info, name, error_message);
+ if (myh == NULL)
+ return NULL;
+
+ 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;
+
+ if ((my_offset & 0x01) == 0x01)
+ {
+ if (sym_sec != NULL
+ && sym_sec->owner != NULL
+ && !INTERWORK_FLAG (sym_sec->owner))
+ {
+ (*_bfd_error_handler)
+ (_("%B(%s): warning: interworking not enabled.\n"
+ " first occurrence: %B: arm call to thumb"),
+ sym_sec->owner, input_bfd, name);
+ }
+
+ --my_offset;
+ myh->root.u.def.value = my_offset;
+
+ if (info->shared || globals->root.is_relocatable_executable
+ || globals->pic_veneer)
+ {
+ /* For relocatable objects we can't use absolute addresses,
+ so construct the address from a relative offset. */
+ /* TODO: If the offset is small it's probably worth
+ constructing the address with adds. */
+ put_arm_insn (globals, output_bfd, (bfd_vma) a2t1p_ldr_insn,
+ s->contents + my_offset);
+ put_arm_insn (globals, output_bfd, (bfd_vma) a2t2p_add_pc_insn,
+ s->contents + my_offset + 4);
+ put_arm_insn (globals, output_bfd, (bfd_vma) a2t3p_bx_r12_insn,
+ s->contents + my_offset + 8);
+ /* Adjust the offset by 4 for the position of the add,
+ and 8 for the pipeline offset. */
+ ret_offset = (val - (s->output_offset
+ + s->output_section->vma
+ + my_offset + 12))
+ | 1;
+ bfd_put_32 (output_bfd, ret_offset,
+ s->contents + my_offset + 12);
+ }
+ else if (globals->use_blx)
+ {
+ put_arm_insn (globals, output_bfd, (bfd_vma) a2t1v5_ldr_insn,
+ s->contents + my_offset);
+
+ /* It's a thumb address. Add the low order bit. */
+ bfd_put_32 (output_bfd, val | a2t2v5_func_addr_insn,
+ s->contents + my_offset + 4);
+ }
+ else
+ {
+ put_arm_insn (globals, output_bfd, (bfd_vma) a2t1_ldr_insn,
+ s->contents + my_offset);
+
+ put_arm_insn (globals, 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);
+
+ return myh;
+}
+
+/* Arm code calling a Thumb function. */
+
+static int
+elf32_arm_to_thumb_stub (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,
+ char **error_message)
+{
+ 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;
+
+ globals = elf32_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);
+ BFD_ASSERT (s->contents != NULL);
+ BFD_ASSERT (s->output_section != NULL);
+
+ myh = elf32_arm_create_thumb_stub (info, name, input_bfd, output_bfd,
+ sym_sec, val, s, error_message);
+ if (!myh)
+ return FALSE;
+
+ my_offset = myh->root.u.def.value;
+ 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;
+}
+
+/* Populate Arm stub for an exported Thumb function. */
+
+static bfd_boolean
+elf32_arm_to_thumb_export_stub (struct elf_link_hash_entry *h, void * inf)
+{
+ struct bfd_link_info * info = (struct bfd_link_info *) inf;
+ asection * s;
+ struct elf_link_hash_entry * myh;
+ struct elf32_arm_link_hash_entry *eh;
+ struct elf32_arm_link_hash_table * globals;
+ asection *sec;
+ bfd_vma val;
+ char *error_message;
+
+ eh = elf32_arm_hash_entry(h);
+ /* Allocate stubs for exported Thumb functions on v4t. */
+ if (eh->export_glue == NULL)
+ return TRUE;
+
+ globals = elf32_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);
+ BFD_ASSERT (s->contents != NULL);
+ BFD_ASSERT (s->output_section != NULL);
+
+ sec = eh->export_glue->root.u.def.section;
+
+ BFD_ASSERT (sec->output_section != NULL);
+
+ val = eh->export_glue->root.u.def.value + sec->output_offset
+ + sec->output_section->vma;
+ myh = elf32_arm_create_thumb_stub (info, h->root.root.string,
+ h->root.u.def.section->owner,
+ globals->obfd, sec, val, s,
+ &error_message);
+ BFD_ASSERT (myh);
+ return TRUE;
+}
+
+/* Generate Arm stubs for exported Thumb symbols. */
+static void
+elf32_arm_begin_write_processing (bfd *abfd ATTRIBUTE_UNUSED,
+ struct bfd_link_info *link_info)
+{
+ struct elf32_arm_link_hash_table * globals;
+
+ if (!link_info)
+ return;
+
+ globals = elf32_arm_hash_table (link_info);
+ /* If blx is available then exported Thumb symbols are OK and there is
+ nothing to do. */
+ if (globals->use_blx)
+ return;
+
+ elf_link_hash_traverse (&globals->root, elf32_arm_to_thumb_export_stub,
+ link_info);
+}
+
+/* Some relocations map to different relocations depending on the
+ target. Return the real relocation. */
+static int
+arm_real_reloc_type (struct elf32_arm_link_hash_table * globals,
+ int r_type)
+{
+ switch (r_type)
+ {
+ case R_ARM_TARGET1:
+ if (globals->target1_is_rel)
+ return R_ARM_REL32;
+ else
+ return R_ARM_ABS32;
+
+ case R_ARM_TARGET2:
+ return globals->target2_reloc;
+
+ default:
+ return r_type;
+ }
+}
+
+/* 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);
+ bfd_vma base;
+
+ /* If tls_sec is NULL, we should have signalled an error already. */
+ if (htab->tls_sec == NULL)
+ return 0;
+ base = align_power ((bfd_vma) TCB_SIZE, htab->tls_sec->alignment_power);
+ return address - htab->tls_sec->vma + base;
+}
+
+/* Perform an R_ARM_ABS12 relocation on the field pointed to by DATA.
+ VALUE is the relocation value. */
+
+static bfd_reloc_status_type
+elf32_arm_abs12_reloc (bfd *abfd, void *data, bfd_vma value)
+{
+ if (value > 0xfff)
+ return bfd_reloc_overflow;
+
+ value |= bfd_get_32 (abfd, data) & 0xfffff000;
+ bfd_put_32 (abfd, value, data);
+ return bfd_reloc_ok;
+}
+
+/* For a given value of n, calculate the value of G_n as required to
+ deal with group relocations. We return it in the form of an
+ encoded constant-and-rotation, together with the final residual. If n is
+ specified as less than zero, then final_residual is filled with the
+ input value and no further action is performed. */
+
+static bfd_vma
+calculate_group_reloc_mask (bfd_vma value, int n, bfd_vma *final_residual)
+{
+ int current_n;
+ bfd_vma g_n;
+ bfd_vma encoded_g_n = 0;
+ bfd_vma residual = value; /* Also known as Y_n. */
+
+ for (current_n = 0; current_n <= n; current_n++)
+ {
+ int shift;
+
+ /* Calculate which part of the value to mask. */
+ if (residual == 0)
+ shift = 0;
+ else
+ {
+ int msb;
+
+ /* Determine the most significant bit in the residual and
+ align the resulting value to a 2-bit boundary. */
+ for (msb = 30; msb >= 0; msb -= 2)
+ if (residual & (3 << msb))
+ break;
+
+ /* The desired shift is now (msb - 6), or zero, whichever
+ is the greater. */
+ shift = msb - 6;
+ if (shift < 0)
+ shift = 0;
+ }
+
+ /* Calculate g_n in 32-bit as well as encoded constant+rotation form. */
+ g_n = residual & (0xff << shift);
+ encoded_g_n = (g_n >> shift)
+ | ((g_n <= 0xff ? 0 : (32 - shift) / 2) << 8);
+
+ /* Calculate the residual for the next time around. */
+ residual &= ~g_n;
+ }
+
+ *final_residual = residual;
+
+ return encoded_g_n;
+}
+
+/* Given an ARM instruction, determine whether it is an ADD or a SUB.
+ Returns 1 if it is an ADD, -1 if it is a SUB, and 0 otherwise. */
+static int
+identify_add_or_sub(bfd_vma insn)
+{
+ int opcode = insn & 0x1e00000;
+
+ if (opcode == 1 << 23) /* ADD */
+ return 1;
+
+ if (opcode == 1 << 22) /* SUB */
+ return -1;
+
+ return 0;
+}
+
+/* Determine if we're dealing with a Thumb-2 object. */
+
+static int using_thumb2 (struct elf32_arm_link_hash_table *globals)
+{
+ int arch = bfd_elf_get_obj_attr_int (globals->obfd, OBJ_ATTR_PROC,
+ Tag_CPU_arch);
+ return arch == TAG_CPU_ARCH_V6T2 || arch >= TAG_CPU_ARCH_V7;
+}
+
+/* Perform a relocation as part of a final link. */
+
+static bfd_reloc_status_type
+elf32_arm_final_link_relocate (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,
+ bfd_boolean * unresolved_reloc_p,
+ char **error_message)
+{
+ 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;
+
+ globals = elf32_arm_hash_table (info);
+
+ /* Some relocation type map to different relocations depending on the
+ target. We pick the right one here. */
+ r_type = arm_real_reloc_type (globals, r_type);
+ if (r_type != howto->type)
+ howto = elf32_arm_howto_from_type (r_type);
+
+ /* 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;
+
+ 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 (globals->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;
+
+ switch (r_type)
+ {
+ case R_ARM_NONE:
+ /* We don't need to find a value for this symbol. It's just a
+ marker. */
+ *unresolved_reloc_p = FALSE;
+ return bfd_reloc_ok;
+
+ case R_ARM_ABS12:
+ if (!globals->vxworks_p)
+ return elf32_arm_abs12_reloc (input_bfd, hit_data, value + addend);
+
+ case R_ARM_PC24:
+ case R_ARM_ABS32:
+ case R_ARM_ABS32_NOI:
+ case R_ARM_REL32:
+ case R_ARM_REL32_NOI:
+ case R_ARM_CALL:
+ case R_ARM_JUMP24:
+ case R_ARM_XPC25:
+ case R_ARM_PREL31:
+ case R_ARM_PLT32:
+ /* 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
+ && r_type != R_ARM_ABS32_NOI && r_type != R_ARM_REL32_NOI)
+ && 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);
+ *unresolved_reloc_p = FALSE;
+ return _bfd_final_link_relocate (howto, input_bfd, input_section,
+ contents, rel->r_offset, value,
+ rel->r_addend);
+ }
+
+ /* When generating a shared object or relocatable executable, these
+ relocations are copied into the output file to be resolved at
+ run time. */
+ if ((info->shared || globals->root.is_relocatable_executable)
+ && (input_section->flags & SEC_ALLOC)
+ && ((r_type != R_ARM_REL32 && r_type != R_ARM_REL32_NOI)
+ || !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_CALL
+ && r_type != R_ARM_JUMP24
+ && r_type != R_ARM_PREL31
+ && r_type != R_ARM_PLT32)
+ {
+ Elf_Internal_Rela outrel;
+ bfd_byte *loc;
+ bfd_boolean skip, relocate;
+
+ *unresolved_reloc_p = FALSE;
+
+ 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 (reloc_section_p (globals, name, input_section));
+
+ sreloc = bfd_get_section_by_name (dynobj, name);
+ BFD_ASSERT (sreloc != NULL);
+ }
+
+ skip = FALSE;
+ relocate = FALSE;
+
+ outrel.r_addend = addend;
+ 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->def_regular))
+ outrel.r_info = ELF32_R_INFO (h->dynindx, r_type);
+ else
+ {
+ int symbol;
+
+ /* This symbol is local, or marked to become local. */
+ if (sym_flags == STT_ARM_TFUNC)
+ value |= 1;
+ if (globals->symbian_p)
+ {
+ asection *osec;
+
+ /* On Symbian OS, the data segment and text segement
+ can be relocated independently. Therefore, we
+ must indicate the segment to which this
+ relocation is relative. The BPABI allows us to
+ use any symbol in the right segment; we just use
+ the section symbol as it is convenient. (We
+ cannot use the symbol given by "h" directly as it
+ will not appear in the dynamic symbol table.)
+
+ Note that the dynamic linker ignores the section
+ symbol value, so we don't subtract osec->vma
+ from the emitted reloc addend. */
+ if (sym_sec)
+ osec = sym_sec->output_section;
+ else
+ osec = input_section->output_section;
+ symbol = elf_section_data (osec)->dynindx;
+ if (symbol == 0)
+ {
+ struct elf_link_hash_table *htab = elf_hash_table (info);
+
+ if ((osec->flags & SEC_READONLY) == 0
+ && htab->data_index_section != NULL)
+ osec = htab->data_index_section;
+ else
+ osec = htab->text_index_section;
+ symbol = elf_section_data (osec)->dynindx;
+ }
+ BFD_ASSERT (symbol != 0);
+ }
+ else
+ /* On SVR4-ish systems, the dynamic loader cannot
+ relocate the text and data segments independently,
+ so the symbol does not matter. */
+ symbol = 0;
+ outrel.r_info = ELF32_R_INFO (symbol, R_ARM_RELATIVE);
+ if (globals->use_rel)
+ relocate = TRUE;
+ else
+ outrel.r_addend += value;
+ }
+
+ loc = sreloc->contents;
+ loc += sreloc->reloc_count++ * RELOC_SIZE (globals);
+ SWAP_RELOC_OUT (globals) (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)
+ {
+ case R_ARM_ABS12:
+ return elf32_arm_abs12_reloc (input_bfd, hit_data, value + addend);
+
+ case R_ARM_XPC25: /* Arm BLX instruction. */
+ case R_ARM_CALL:
+ case R_ARM_JUMP24:
+ case R_ARM_PC24: /* Arm B/BL instruction */
+ case R_ARM_PLT32:
+ 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)
+ (_("\%B: Warning: Arm BLX instruction targets Arm function '%s'."),
+ input_bfd,
+ h ? h->root.root.string : "(local)");
+ }
+ else if (r_type != R_ARM_CALL || !globals->use_blx)
+ {
+ /* Check for Arm calling Thumb function. */
+ if (sym_flags == STT_ARM_TFUNC)
+ {
+ if (elf32_arm_to_thumb_stub (info, sym_name, input_bfd,
+ output_bfd, input_section,
+ hit_data, sym_sec, rel->r_offset,
+ signed_addend, value,
+ error_message))
+ return bfd_reloc_ok;
+ else
+ return bfd_reloc_dangerous;
+ }
+ }
+
+ /* 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;
+ if (globals->use_rel)
+ value += (signed_addend << howto->size);
+ else
+ /* RELA addends do not have to be adjusted by howto->size. */
+ value += signed_addend;
+
+ signed_addend = value;
+ signed_addend >>= howto->rightshift;
+
+ /* A branch to an undefined weak symbol is turned into a jump to
+ the next instruction. */
+ if (h && h->root.type == bfd_link_hash_undefweak)
+ {
+ value = (bfd_get_32 (input_bfd, hit_data) & 0xf0000000)
+ | 0x0affffff;
+ }
+ else
+ {
+ /* 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;
+
+ addend = (value & 2);
+
+ value = (signed_addend & howto->dst_mask)
+ | (bfd_get_32 (input_bfd, hit_data) & (~ howto->dst_mask));
+
+ /* Set the H bit in the BLX instruction. */
+ if (sym_flags == STT_ARM_TFUNC)
+ {
+ if (addend)
+ value |= (1 << 24);
+ else
+ value &= ~(bfd_vma)(1 << 24);
+ }
+ if (r_type == R_ARM_CALL)
+ {
+ /* Select the correct instruction (BL or BLX). */
+ if (sym_flags == STT_ARM_TFUNC)
+ value |= (1 << 28);
+ else
+ {
+ value &= ~(bfd_vma)(1 << 28);
+ value |= (1 << 24);
+ }
+ }
+ }
+ break;
+
+ case R_ARM_ABS32:
+ value += addend;
+ if (sym_flags == STT_ARM_TFUNC)
+ value |= 1;
+ break;
+
+ case R_ARM_ABS32_NOI:
+ value += addend;
+ break;
+
+ case R_ARM_REL32:
+ value += addend;
+ if (sym_flags == STT_ARM_TFUNC)
+ value |= 1;
+ value -= (input_section->output_section->vma
+ + input_section->output_offset + rel->r_offset);
+ break;
+
+ case R_ARM_REL32_NOI:
+ value += addend;
+ value -= (input_section->output_section->vma
+ + input_section->output_offset + rel->r_offset);
+ break;
+
+ case R_ARM_PREL31:
+ value -= (input_section->output_section->vma
+ + input_section->output_offset + rel->r_offset);
+ value += signed_addend;
+ if (! h || h->root.type != bfd_link_hash_undefweak)
+ {
+ /* Check for overflow */
+ if ((value ^ (value >> 1)) & (1 << 30))
+ return bfd_reloc_overflow;
+ }
+ value &= 0x7fffffff;
+ value |= (bfd_get_32 (input_bfd, hit_data) & 0x80000000);
+ if (sym_flags == STT_ARM_TFUNC)
+ value |= 1;
+ 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_THM_ABS5:
+ /* Support ldr and str instructions for the thumb. */
+ if (globals->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;
+ }
+ 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;
+
+ case R_ARM_THM_ALU_PREL_11_0:
+ /* Corresponds to: addw.w reg, pc, #offset (and similarly for subw). */
+ {
+ bfd_vma insn;
+ bfd_signed_vma relocation;
+
+ insn = (bfd_get_16 (input_bfd, hit_data) << 16)
+ | bfd_get_16 (input_bfd, hit_data + 2);
+
+ if (globals->use_rel)
+ {
+ signed_addend = (insn & 0xff) | ((insn & 0x7000) >> 4)
+ | ((insn & (1 << 26)) >> 15);
+ if (insn & 0xf00000)
+ signed_addend = -signed_addend;
+ }
+
+ relocation = value + signed_addend;
+ relocation -= (input_section->output_section->vma
+ + input_section->output_offset
+ + rel->r_offset);
+
+ value = abs (relocation);
+
+ if (value >= 0x1000)
+ return bfd_reloc_overflow;
+
+ insn = (insn & 0xfb0f8f00) | (value & 0xff)
+ | ((value & 0x700) << 4)
+ | ((value & 0x800) << 15);
+ if (relocation < 0)
+ insn |= 0xa00000;
+
+ bfd_put_16 (input_bfd, insn >> 16, hit_data);
+ bfd_put_16 (input_bfd, insn & 0xffff, hit_data + 2);
+
+ return bfd_reloc_ok;
+ }
+
+ case R_ARM_THM_PC12:
+ /* Corresponds to: ldr.w reg, [pc, #offset]. */
+ {
+ bfd_vma insn;
+ bfd_signed_vma relocation;
+
+ insn = (bfd_get_16 (input_bfd, hit_data) << 16)
+ | bfd_get_16 (input_bfd, hit_data + 2);
+
+ if (globals->use_rel)
+ {
+ signed_addend = insn & 0xfff;
+ if (!(insn & (1 << 23)))
+ signed_addend = -signed_addend;
+ }
+
+ relocation = value + signed_addend;
+ relocation -= (input_section->output_section->vma
+ + input_section->output_offset
+ + rel->r_offset);
+
+ value = abs (relocation);
+
+ if (value >= 0x1000)
+ return bfd_reloc_overflow;
+
+ insn = (insn & 0xff7ff000) | value;
+ if (relocation >= 0)
+ insn |= (1 << 23);
+
+ bfd_put_16 (input_bfd, insn >> 16, hit_data);
+ bfd_put_16 (input_bfd, insn & 0xffff, hit_data + 2);
+
+ return bfd_reloc_ok;
+ }
+
+ case R_ARM_THM_XPC22:
+ case R_ARM_THM_CALL:
+ /* Thumb BL (branch long instruction). */
+ {
+ bfd_vma relocation;
+ bfd_vma reloc_sign;
+ 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;
+ bfd_signed_vma reloc_signed_min;
+ bfd_vma check;
+ bfd_signed_vma signed_check;
+ int bitsize;
+ int thumb2 = using_thumb2 (globals);
+
+ /* A branch to an undefined weak symbol is turned into a jump to
+ the next instruction. */
+ if (h && h->root.type == bfd_link_hash_undefweak)
+ {
+ bfd_put_16 (input_bfd, 0xe000, hit_data);
+ bfd_put_16 (input_bfd, 0xbf00, hit_data + 2);
+ return bfd_reloc_ok;
+ }
+
+ /* Fetch the addend. We use the Thumb-2 encoding (backwards compatible
+ with Thumb-1) involving the J1 and J2 bits. */
+ if (globals->use_rel)
+ {
+ bfd_vma s = (upper_insn & (1 << 10)) >> 10;
+ bfd_vma upper = upper_insn & 0x3ff;
+ bfd_vma lower = lower_insn & 0x7ff;
+ bfd_vma j1 = (lower_insn & (1 << 13)) >> 13;
+ bfd_vma j2 = (lower_insn & (1 << 11)) >> 11;
+ bfd_vma i1 = j1 ^ s ? 0 : 1;
+ bfd_vma i2 = j2 ^ s ? 0 : 1;
+
+ addend = (i1 << 23) | (i2 << 22) | (upper << 12) | (lower << 1);
+ /* Sign extend. */
+ addend = (addend | ((s ? 0 : 1) << 24)) - (1 << 24);
+
+ signed_addend = addend;
+ }
+
+ 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)
+ (_("%B: Warning: Thumb BLX instruction targets thumb function '%s'."),
+ input_bfd,
+ h ? h->root.root.string : "(local)");
+ }
+ else
+ {
+ /* 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. Calls through
+ the PLT do not require stubs. */
+ if (sym_flags != STT_ARM_TFUNC && sym_flags != STT_SECTION
+ && (h == NULL || splt == NULL
+ || h->plt.offset == (bfd_vma) -1))
+ {
+ if (globals->use_blx)
+ {
+ /* Convert BL to BLX. */
+ lower_insn = (lower_insn & ~0x1000) | 0x0800;
+ }
+ else 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,
+ error_message))
+ return bfd_reloc_ok;
+ else
+ return bfd_reloc_dangerous;
+ }
+ else if (sym_flags == STT_ARM_TFUNC && globals->use_blx)
+ {
+ /* Make sure this is a BL. */
+ lower_insn |= 0x1800;
+ }
+ }
+
+ /* Handle calls via the PLT. */
+ if (h != NULL && splt != NULL && h->plt.offset != (bfd_vma) -1)
+ {
+ value = (splt->output_section->vma
+ + splt->output_offset
+ + h->plt.offset);
+ if (globals->use_blx)
+ {
+ /* If the Thumb BLX instruction is available, convert the
+ BL to a BLX instruction to call the ARM-mode PLT entry. */
+ lower_insn = (lower_insn & ~0x1000) | 0x0800;
+ }
+ else
+ /* Target the Thumb stub before the ARM PLT entry. */
+ value -= PLT_THUMB_STUB_SIZE;
+ *unresolved_reloc_p = FALSE;
+ }
+
+ relocation = value + signed_addend;
+
+ relocation -= (input_section->output_section->vma
+ + input_section->output_offset
+ + rel->r_offset);
+
+ 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);
+
+ /* Calculate the permissable maximum and minimum values for
+ this relocation according to whether we're relocating for
+ Thumb-2 or not. */
+ bitsize = howto->bitsize;
+ if (!thumb2)
+ bitsize -= 2;
+ reloc_signed_max = ((1 << (bitsize - 1)) - 1) >> howto->rightshift;
+ reloc_signed_min = ~reloc_signed_max;
+
+ /* Assumes two's complement. */
+ if (signed_check > reloc_signed_max || signed_check < reloc_signed_min)
+ overflow = TRUE;
+
+ if ((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;
+
+ /* Put RELOCATION back into the insn. Assumes two's complement.
+ We use the Thumb-2 encoding, which is safe even if dealing with
+ a Thumb-1 instruction by virtue of our overflow check above. */
+ reloc_sign = (signed_check < 0) ? 1 : 0;
+ upper_insn = (upper_insn & ~(bfd_vma) 0x7ff)
+ | ((relocation >> 12) & 0x3ff)
+ | (reloc_sign << 10);
+ lower_insn = (lower_insn & ~(bfd_vma) 0x2fff)
+ | (((!((relocation >> 23) & 1)) ^ reloc_sign) << 13)
+ | (((!((relocation >> 22) & 1)) ^ reloc_sign) << 11)
+ | ((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_JUMP24:
+ /* Thumb32 unconditional branch 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;
+
+ /* Need to refetch the addend, reconstruct the top three bits, and glue the
+ two pieces together. */
+ if (globals->use_rel)
+ {
+ bfd_vma S = (upper_insn & 0x0400) >> 10;
+ bfd_vma hi = (upper_insn & 0x03ff);
+ bfd_vma I1 = (lower_insn & 0x2000) >> 13;
+ bfd_vma I2 = (lower_insn & 0x0800) >> 11;
+ bfd_vma lo = (lower_insn & 0x07ff);
+
+ I1 = !(I1 ^ S);
+ I2 = !(I2 ^ S);
+ S = !S;
+
+ signed_addend = (S << 24) | (I1 << 23) | (I2 << 22) | (hi << 12) | (lo << 1);
+ signed_addend -= (1 << 24); /* Sign extend. */
+ }
+
+ /* ??? Should handle interworking? GCC might someday try to
+ use this for tail calls. */
+
+ relocation = value + signed_addend;
+ relocation -= (input_section->output_section->vma
+ + input_section->output_offset
+ + rel->r_offset);
+
+ 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;
+
+ /* Put RELOCATION back into the insn. */
+ {
+ bfd_vma S = (relocation & 0x01000000) >> 24;
+ bfd_vma I1 = (relocation & 0x00800000) >> 23;
+ bfd_vma I2 = (relocation & 0x00400000) >> 22;
+ bfd_vma hi = (relocation & 0x003ff000) >> 12;
+ bfd_vma lo = (relocation & 0x00000ffe) >> 1;
+
+ I1 = !(I1 ^ S);
+ I2 = !(I2 ^ S);
+
+ upper_insn = (upper_insn & (bfd_vma) 0xf800) | (S << 10) | hi;
+ lower_insn = (lower_insn & (bfd_vma) 0xd000) | (I1 << 13) | (I2 << 11) | lo;
+ }
+
+ /* 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);
+ }
+
+ case R_ARM_THM_JUMP19:
+ /* Thumb32 conditional branch 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 = 0xffffe;
+ bfd_signed_vma reloc_signed_min = -0x100000;
+ bfd_signed_vma signed_check;
+
+ /* Need to refetch the addend, reconstruct the top three bits,
+ and squish the two 11 bit pieces together. */
+ if (globals->use_rel)
+ {
+ bfd_vma S = (upper_insn & 0x0400) >> 10;
+ bfd_vma upper = (upper_insn & 0x003f);
+ bfd_vma J1 = (lower_insn & 0x2000) >> 13;
+ bfd_vma J2 = (lower_insn & 0x0800) >> 11;
+ bfd_vma lower = (lower_insn & 0x07ff);
+
+ upper |= J1 << 6;
+ upper |= J2 << 7;
+ upper |= (!S) << 8;
+ upper -= 0x0100; /* Sign extend. */
+
+ addend = (upper << 12) | (lower << 1);
+ signed_addend = addend;
+ }
+
+ /* ??? Should handle interworking? GCC might someday try to
+ use this for tail calls. */
+
+ relocation = value + signed_addend;
+ relocation -= (input_section->output_section->vma
+ + input_section->output_offset
+ + rel->r_offset);
+ signed_check = (bfd_signed_vma) relocation;
+
+ if (signed_check > reloc_signed_max || signed_check < reloc_signed_min)
+ overflow = TRUE;
+
+ /* Put RELOCATION back into the insn. */
+ {
+ bfd_vma S = (relocation & 0x00100000) >> 20;
+ bfd_vma J2 = (relocation & 0x00080000) >> 19;
+ bfd_vma J1 = (relocation & 0x00040000) >> 18;
+ bfd_vma hi = (relocation & 0x0003f000) >> 12;
+ bfd_vma lo = (relocation & 0x00000ffe) >> 1;
+
+ upper_insn = (upper_insn & 0xfbc0) | (S << 10) | hi;
+ lower_insn = (lower_insn & 0xd000) | (J1 << 13) | (J2 << 11) | lo;
+ }
+
+ /* 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);
+ }
+
+ case R_ARM_THM_JUMP11:
+ case R_ARM_THM_JUMP8:
+ case R_ARM_THM_JUMP6:
+ /* 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;
+
+ /* CZB cannot jump backward. */
+ if (r_type == R_ARM_THM_JUMP6)
+ reloc_signed_min = 0;
+
+ if (globals->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;
+ }
+ relocation = value + signed_addend;
+
+ relocation -= (input_section->output_section->vma
+ + input_section->output_offset
+ + rel->r_offset);
+
+ relocation >>= howto->rightshift;
+ signed_check = relocation;
+
+ if (r_type == R_ARM_THM_JUMP6)
+ relocation = ((relocation & 0x0020) << 4) | ((relocation & 0x001f) << 3);
+ else
+ 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_ALU_PCREL7_0:
+ case R_ARM_ALU_PCREL15_8:
+ case R_ARM_ALU_PCREL23_15:
+ {
+ bfd_vma insn;
+ bfd_vma relocation;
+
+ insn = bfd_get_32 (input_bfd, hit_data);
+ if (globals->use_rel)
+ {
+ /* Extract the addend. */
+ addend = (insn & 0xff) << ((insn & 0xf00) >> 7);
+ signed_addend = addend;
+ }
+ relocation = value + signed_addend;
+
+ relocation -= (input_section->output_section->vma
+ + input_section->output_offset
+ + rel->r_offset);
+ insn = (insn & ~0xfff)
+ | ((howto->bitpos << 7) & 0xf00)
+ | ((relocation >> howto->bitpos) & 0xff);
+ bfd_put_32 (input_bfd, value, hit_data);
+ }
+ return bfd_reloc_ok;
+
+ case R_ARM_GNU_VTINHERIT:
+ case R_ARM_GNU_VTENTRY:
+ return bfd_reloc_ok;
+
+ case R_ARM_GOTOFF32:
+ /* 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,
+ rel->r_addend);
+
+ case R_ARM_GOTPC:
+ /* Use global offset table as symbol value. */
+ BFD_ASSERT (sgot != NULL);
+
+ if (sgot == NULL)
+ return bfd_reloc_notsupported;
+
+ *unresolved_reloc_p = FALSE;
+ value = sgot->output_section->vma;
+ return _bfd_final_link_relocate (howto, input_bfd, input_section,
+ contents, rel->r_offset, value,
+ rel->r_addend);
+
+ case R_ARM_GOT32:
+ case R_ARM_GOT_PREL:
+ /* 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(a).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;
+ }
+ }
+ else
+ *unresolved_reloc_p = FALSE;
+
+ 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
+ {
+ /* 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;
+
+ if (globals->use_rel)
+ 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, RELOC_SECTION (globals, ".got")));
+ BFD_ASSERT (srelgot != NULL);
+
+ outrel.r_addend = addend + value;
+ 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++ * RELOC_SIZE (globals);
+ SWAP_RELOC_OUT (globals) (output_bfd, &outrel, loc);
+ }
+
+ local_got_offsets[r_symndx] |= 1;
+ }
+
+ value = sgot->output_offset + off;
+ }
+ if (r_type != R_ARM_GOT32)
+ value += sgot->output_section->vma;
+
+ return _bfd_final_link_relocate (howto, input_bfd, input_section,
+ contents, rel->r_offset, value,
+ rel->r_addend);
+
+ case R_ARM_TLS_LDO32:
+ value = value - dtpoff_base (info);
+
+ return _bfd_final_link_relocate (howto, input_bfd, input_section,
+ contents, rel->r_offset, value,
+ rel->r_addend);
+
+ case R_ARM_TLS_LDM32:
+ {
+ bfd_vma off;
+
+ if (globals->sgot == NULL)
+ abort ();
+
+ off = globals->tls_ldm_got.offset;
+
+ if ((off & 1) != 0)
+ off &= ~1;
+ else
+ {
+ /* If we don't know the module number, create a relocation
+ for it. */
+ if (info->shared)
+ {
+ Elf_Internal_Rela outrel;
+ bfd_byte *loc;
+
+ if (globals->srelgot == NULL)
+ abort ();
+
+ outrel.r_addend = 0;
+ outrel.r_offset = (globals->sgot->output_section->vma
+ + globals->sgot->output_offset + off);
+ outrel.r_info = ELF32_R_INFO (0, R_ARM_TLS_DTPMOD32);
+
+ if (globals->use_rel)
+ bfd_put_32 (output_bfd, outrel.r_addend,
+ globals->sgot->contents + off);
+
+ loc = globals->srelgot->contents;
+ loc += globals->srelgot->reloc_count++ * RELOC_SIZE (globals);
+ SWAP_RELOC_OUT (globals) (output_bfd, &outrel, loc);
+ }
+ else
+ bfd_put_32 (output_bfd, 1, globals->sgot->contents + off);
+
+ globals->tls_ldm_got.offset |= 1;
+ }
+
+ value = globals->sgot->output_section->vma + globals->sgot->output_offset + off
+ - (input_section->output_section->vma + input_section->output_offset + rel->r_offset);
+
+ return _bfd_final_link_relocate (howto, input_bfd, input_section,
+ contents, rel->r_offset, value,
+ rel->r_addend);
+ }
+
+ case R_ARM_TLS_GD32:
+ case R_ARM_TLS_IE32:
+ {
+ bfd_vma off;
+ int indx;
+ char tls_type;
+
+ if (globals->sgot == NULL)
+ abort ();
+
+ indx = 0;
+ if (h != NULL)
+ {
+ bfd_boolean dyn;
+ dyn = globals->root.dynamic_sections_created;
+ if (WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, info->shared, h)
+ && (!info->shared
+ || !SYMBOL_REFERENCES_LOCAL (info, h)))
+ {
+ *unresolved_reloc_p = FALSE;
+ indx = h->dynindx;
+ }
+ off = h->got.offset;
+ tls_type = ((struct elf32_arm_link_hash_entry *) h)->tls_type;
+ }
+ else
+ {
+ if (local_got_offsets == NULL)
+ abort ();
+ off = local_got_offsets[r_symndx];
+ tls_type = elf32_arm_local_got_tls_type (input_bfd)[r_symndx];
+ }
+
+ if (tls_type == GOT_UNKNOWN)
+ abort ();
+
+ if ((off & 1) != 0)
+ off &= ~1;
+ else
+ {
+ bfd_boolean need_relocs = FALSE;
+ Elf_Internal_Rela outrel;
+ bfd_byte *loc = NULL;
+ int cur_off = off;
+
+ /* The GOT entries have not been initialized yet. Do it
+ now, and emit any relocations. If both an IE GOT and a
+ GD GOT are necessary, we emit the GD first. */
+
+ if ((info->shared || indx != 0)
+ && (h == NULL
+ || ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
+ || h->root.type != bfd_link_hash_undefweak))
+ {
+ need_relocs = TRUE;
+ if (globals->srelgot == NULL)
+ abort ();
+ loc = globals->srelgot->contents;
+ loc += globals->srelgot->reloc_count * RELOC_SIZE (globals);
+ }
+
+ if (tls_type & GOT_TLS_GD)
+ {
+ if (need_relocs)
+ {
+ outrel.r_addend = 0;
+ outrel.r_offset = (globals->sgot->output_section->vma
+ + globals->sgot->output_offset
+ + cur_off);
+ outrel.r_info = ELF32_R_INFO (indx, R_ARM_TLS_DTPMOD32);
+
+ if (globals->use_rel)
+ bfd_put_32 (output_bfd, outrel.r_addend,
+ globals->sgot->contents + cur_off);
+
+ SWAP_RELOC_OUT (globals) (output_bfd, &outrel, loc);
+ globals->srelgot->reloc_count++;
+ loc += RELOC_SIZE (globals);
+
+ if (indx == 0)
+ bfd_put_32 (output_bfd, value - dtpoff_base (info),
+ globals->sgot->contents + cur_off + 4);
+ else
+ {
+ outrel.r_addend = 0;
+ outrel.r_info = ELF32_R_INFO (indx,
+ R_ARM_TLS_DTPOFF32);
+ outrel.r_offset += 4;
+
+ if (globals->use_rel)
+ bfd_put_32 (output_bfd, outrel.r_addend,
+ globals->sgot->contents + cur_off + 4);
+
+
+ SWAP_RELOC_OUT (globals) (output_bfd, &outrel, loc);
+ globals->srelgot->reloc_count++;
+ loc += RELOC_SIZE (globals);
+ }
+ }
+ else
+ {
+ /* If we are not emitting relocations for a
+ general dynamic reference, then we must be in a
+ static link or an executable link with the
+ symbol binding locally. Mark it as belonging
+ to module 1, the executable. */
+ bfd_put_32 (output_bfd, 1,
+ globals->sgot->contents + cur_off);
+ bfd_put_32 (output_bfd, value - dtpoff_base (info),
+ globals->sgot->contents + cur_off + 4);
+ }
+
+ cur_off += 8;
+ }
+
+ if (tls_type & GOT_TLS_IE)
+ {
+ if (need_relocs)
+ {
+ if (indx == 0)
+ outrel.r_addend = value - dtpoff_base (info);
+ else
+ outrel.r_addend = 0;
+ outrel.r_offset = (globals->sgot->output_section->vma
+ + globals->sgot->output_offset
+ + cur_off);
+ outrel.r_info = ELF32_R_INFO (indx, R_ARM_TLS_TPOFF32);
+
+ if (globals->use_rel)
+ bfd_put_32 (output_bfd, outrel.r_addend,
+ globals->sgot->contents + cur_off);
+
+ SWAP_RELOC_OUT (globals) (output_bfd, &outrel, loc);
+ globals->srelgot->reloc_count++;
+ loc += RELOC_SIZE (globals);
+ }
+ else
+ bfd_put_32 (output_bfd, tpoff (info, value),
+ globals->sgot->contents + cur_off);
+ cur_off += 4;
+ }
+
+ if (h != NULL)
+ h->got.offset |= 1;
+ else
+ local_got_offsets[r_symndx] |= 1;
+ }
+
+ if ((tls_type & GOT_TLS_GD) && r_type != R_ARM_TLS_GD32)
+ off += 8;
+ value = globals->sgot->output_section->vma + globals->sgot->output_offset + off
+ - (input_section->output_section->vma + input_section->output_offset + rel->r_offset);
+
+ return _bfd_final_link_relocate (howto, input_bfd, input_section,
+ contents, rel->r_offset, value,
+ rel->r_addend);
+ }
+
+ case R_ARM_TLS_LE32:
+ if (info->shared)
+ {
+ (*_bfd_error_handler)
+ (_("%B(%A+0x%lx): R_ARM_TLS_LE32 relocation not permitted in shared object"),
+ input_bfd, input_section,
+ (long) rel->r_offset, howto->name);
+ return FALSE;
+ }
+ else
+ value = tpoff (info, value);
+
+ return _bfd_final_link_relocate (howto, input_bfd, input_section,
+ contents, rel->r_offset, value,
+ rel->r_addend);
+
+ case R_ARM_V4BX:
+ if (globals->fix_v4bx)
+ {
+ bfd_vma insn = bfd_get_32 (input_bfd, hit_data);
+
+ /* Ensure that we have a BX instruction. */
+ BFD_ASSERT ((insn & 0x0ffffff0) == 0x012fff10);
+
+ /* Preserve Rm (lowest four bits) and the condition code
+ (highest four bits). Other bits encode MOV PC,Rm. */
+ insn = (insn & 0xf000000f) | 0x01a0f000;
+
+ bfd_put_32 (input_bfd, insn, hit_data);
+ }
+ return bfd_reloc_ok;
+
+ case R_ARM_MOVW_ABS_NC:
+ case R_ARM_MOVT_ABS:
+ case R_ARM_MOVW_PREL_NC:
+ case R_ARM_MOVT_PREL:
+ /* Until we properly support segment-base-relative addressing then
+ we assume the segment base to be zero, as for the group relocations.
+ Thus R_ARM_MOVW_BREL_NC has the same semantics as R_ARM_MOVW_ABS_NC
+ and R_ARM_MOVT_BREL has the same semantics as R_ARM_MOVT_ABS. */
+ case R_ARM_MOVW_BREL_NC:
+ case R_ARM_MOVW_BREL:
+ case R_ARM_MOVT_BREL:
+ {
+ bfd_vma insn = bfd_get_32 (input_bfd, hit_data);
+
+ if (globals->use_rel)
+ {
+ addend = ((insn >> 4) & 0xf000) | (insn & 0xfff);
+ signed_addend = (addend ^ 0x10000) - 0x10000;
+ }
+
+ value += signed_addend;
+
+ if (r_type == R_ARM_MOVW_PREL_NC || r_type == R_ARM_MOVT_PREL)
+ value -= (input_section->output_section->vma
+ + input_section->output_offset + rel->r_offset);
+
+ if (r_type == R_ARM_MOVW_BREL && value >= 0x10000)
+ return bfd_reloc_overflow;
+
+ if (sym_flags == STT_ARM_TFUNC)
+ value |= 1;
+
+ if (r_type == R_ARM_MOVT_ABS || r_type == R_ARM_MOVT_PREL
+ || r_type == R_ARM_MOVT_BREL)
+ value >>= 16;
+
+ insn &= 0xfff0f000;
+ insn |= value & 0xfff;
+ insn |= (value & 0xf000) << 4;
+ bfd_put_32 (input_bfd, insn, hit_data);
+ }
+ return bfd_reloc_ok;
+
+ case R_ARM_THM_MOVW_ABS_NC:
+ case R_ARM_THM_MOVT_ABS:
+ case R_ARM_THM_MOVW_PREL_NC:
+ case R_ARM_THM_MOVT_PREL:
+ /* Until we properly support segment-base-relative addressing then
+ we assume the segment base to be zero, as for the above relocations.
+ Thus R_ARM_THM_MOVW_BREL_NC has the same semantics as
+ R_ARM_THM_MOVW_ABS_NC and R_ARM_THM_MOVT_BREL has the same semantics
+ as R_ARM_THM_MOVT_ABS. */
+ case R_ARM_THM_MOVW_BREL_NC:
+ case R_ARM_THM_MOVW_BREL:
+ case R_ARM_THM_MOVT_BREL:
+ {
+ bfd_vma insn;
+
+ insn = bfd_get_16 (input_bfd, hit_data) << 16;
+ insn |= bfd_get_16 (input_bfd, hit_data + 2);
+
+ if (globals->use_rel)
+ {
+ addend = ((insn >> 4) & 0xf000)
+ | ((insn >> 15) & 0x0800)
+ | ((insn >> 4) & 0x0700)
+ | (insn & 0x00ff);
+ signed_addend = (addend ^ 0x10000) - 0x10000;
+ }
+
+ value += signed_addend;
+
+ if (r_type == R_ARM_THM_MOVW_PREL_NC || r_type == R_ARM_THM_MOVT_PREL)
+ value -= (input_section->output_section->vma
+ + input_section->output_offset + rel->r_offset);
+
+ if (r_type == R_ARM_THM_MOVW_BREL && value >= 0x10000)
+ return bfd_reloc_overflow;
+
+ if (sym_flags == STT_ARM_TFUNC)
+ value |= 1;
+
+ if (r_type == R_ARM_THM_MOVT_ABS || r_type == R_ARM_THM_MOVT_PREL
+ || r_type == R_ARM_THM_MOVT_BREL)
+ value >>= 16;
+
+ insn &= 0xfbf08f00;
+ insn |= (value & 0xf000) << 4;
+ insn |= (value & 0x0800) << 15;
+ insn |= (value & 0x0700) << 4;
+ insn |= (value & 0x00ff);
+
+ bfd_put_16 (input_bfd, insn >> 16, hit_data);
+ bfd_put_16 (input_bfd, insn & 0xffff, hit_data + 2);
+ }
+ return bfd_reloc_ok;
+
+ case R_ARM_ALU_PC_G0_NC:
+ case R_ARM_ALU_PC_G1_NC:
+ case R_ARM_ALU_PC_G0:
+ case R_ARM_ALU_PC_G1:
+ case R_ARM_ALU_PC_G2:
+ case R_ARM_ALU_SB_G0_NC:
+ case R_ARM_ALU_SB_G1_NC:
+ case R_ARM_ALU_SB_G0:
+ case R_ARM_ALU_SB_G1:
+ case R_ARM_ALU_SB_G2:
+ {
+ bfd_vma insn = bfd_get_32 (input_bfd, hit_data);
+ bfd_vma pc = input_section->output_section->vma
+ + input_section->output_offset + rel->r_offset;
+ /* sb should be the origin of the *segment* containing the symbol.
+ It is not clear how to obtain this OS-dependent value, so we
+ make an arbitrary choice of zero. */
+ bfd_vma sb = 0;
+ bfd_vma residual;
+ bfd_vma g_n;
+ bfd_signed_vma signed_value;
+ int group = 0;
+
+ /* Determine which group of bits to select. */
+ switch (r_type)
+ {
+ case R_ARM_ALU_PC_G0_NC:
+ case R_ARM_ALU_PC_G0:
+ case R_ARM_ALU_SB_G0_NC:
+ case R_ARM_ALU_SB_G0:
+ group = 0;
+ break;
+
+ case R_ARM_ALU_PC_G1_NC:
+ case R_ARM_ALU_PC_G1:
+ case R_ARM_ALU_SB_G1_NC:
+ case R_ARM_ALU_SB_G1:
+ group = 1;
+ break;
+
+ case R_ARM_ALU_PC_G2:
+ case R_ARM_ALU_SB_G2:
+ group = 2;
+ break;
+
+ default:
+ abort();
+ }
+
+ /* If REL, extract the addend from the insn. If RELA, it will
+ have already been fetched for us. */
+ if (globals->use_rel)
+ {
+ int negative;
+ bfd_vma constant = insn & 0xff;
+ bfd_vma rotation = (insn & 0xf00) >> 8;
+
+ if (rotation == 0)
+ signed_addend = constant;
+ else
+ {
+ /* Compensate for the fact that in the instruction, the
+ rotation is stored in multiples of 2 bits. */
+ rotation *= 2;
+
+ /* Rotate "constant" right by "rotation" bits. */
+ signed_addend = (constant >> rotation) |
+ (constant << (8 * sizeof (bfd_vma) - rotation));
+ }
+
+ /* Determine if the instruction is an ADD or a SUB.
+ (For REL, this determines the sign of the addend.) */
+ negative = identify_add_or_sub (insn);
+ if (negative == 0)
+ {
+ (*_bfd_error_handler)
+ (_("%B(%A+0x%lx): Only ADD or SUB instructions are allowed for ALU group relocations"),
+ input_bfd, input_section,
+ (long) rel->r_offset, howto->name);
+ return bfd_reloc_overflow;
+ }
+
+ signed_addend *= negative;
+ }
+
+ /* Compute the value (X) to go in the place. */
+ if (r_type == R_ARM_ALU_PC_G0_NC
+ || r_type == R_ARM_ALU_PC_G1_NC
+ || r_type == R_ARM_ALU_PC_G0
+ || r_type == R_ARM_ALU_PC_G1
+ || r_type == R_ARM_ALU_PC_G2)
+ /* PC relative. */
+ signed_value = value - pc + signed_addend;
+ else
+ /* Section base relative. */
+ signed_value = value - sb + signed_addend;
+
+ /* If the target symbol is a Thumb function, then set the
+ Thumb bit in the address. */
+ if (sym_flags == STT_ARM_TFUNC)
+ signed_value |= 1;
+
+ /* Calculate the value of the relevant G_n, in encoded
+ constant-with-rotation format. */
+ g_n = calculate_group_reloc_mask (abs (signed_value), group,
+ &residual);
+
+ /* Check for overflow if required. */
+ if ((r_type == R_ARM_ALU_PC_G0
+ || r_type == R_ARM_ALU_PC_G1
+ || r_type == R_ARM_ALU_PC_G2
+ || r_type == R_ARM_ALU_SB_G0
+ || r_type == R_ARM_ALU_SB_G1
+ || r_type == R_ARM_ALU_SB_G2) && residual != 0)
+ {
+ (*_bfd_error_handler)
+ (_("%B(%A+0x%lx): Overflow whilst splitting 0x%lx for group relocation %s"),
+ input_bfd, input_section,
+ (long) rel->r_offset, abs (signed_value), howto->name);
+ return bfd_reloc_overflow;
+ }
+
+ /* Mask out the value and the ADD/SUB part of the opcode; take care
+ not to destroy the S bit. */
+ insn &= 0xff1ff000;
+
+ /* Set the opcode according to whether the value to go in the
+ place is negative. */
+ if (signed_value < 0)
+ insn |= 1 << 22;
+ else
+ insn |= 1 << 23;
+
+ /* Encode the offset. */
+ insn |= g_n;
+
+ bfd_put_32 (input_bfd, insn, hit_data);
+ }
+ return bfd_reloc_ok;
+
+ case R_ARM_LDR_PC_G0:
+ case R_ARM_LDR_PC_G1:
+ case R_ARM_LDR_PC_G2:
+ case R_ARM_LDR_SB_G0:
+ case R_ARM_LDR_SB_G1:
+ case R_ARM_LDR_SB_G2:
+ {
+ bfd_vma insn = bfd_get_32 (input_bfd, hit_data);
+ bfd_vma pc = input_section->output_section->vma
+ + input_section->output_offset + rel->r_offset;
+ bfd_vma sb = 0; /* See note above. */
+ bfd_vma residual;
+ bfd_signed_vma signed_value;
+ int group = 0;
+
+ /* Determine which groups of bits to calculate. */
+ switch (r_type)
+ {
+ case R_ARM_LDR_PC_G0:
+ case R_ARM_LDR_SB_G0:
+ group = 0;
+ break;
+
+ case R_ARM_LDR_PC_G1:
+ case R_ARM_LDR_SB_G1:
+ group = 1;
+ break;
+
+ case R_ARM_LDR_PC_G2:
+ case R_ARM_LDR_SB_G2:
+ group = 2;
+ break;
+
+ default:
+ abort();
+ }
+
+ /* If REL, extract the addend from the insn. If RELA, it will
+ have already been fetched for us. */
+ if (globals->use_rel)
+ {
+ int negative = (insn & (1 << 23)) ? 1 : -1;
+ signed_addend = negative * (insn & 0xfff);
+ }
+
+ /* Compute the value (X) to go in the place. */
+ if (r_type == R_ARM_LDR_PC_G0
+ || r_type == R_ARM_LDR_PC_G1
+ || r_type == R_ARM_LDR_PC_G2)
+ /* PC relative. */
+ signed_value = value - pc + signed_addend;
+ else
+ /* Section base relative. */
+ signed_value = value - sb + signed_addend;
+
+ /* Calculate the value of the relevant G_{n-1} to obtain
+ the residual at that stage. */
+ calculate_group_reloc_mask (abs (signed_value), group - 1, &residual);
+
+ /* Check for overflow. */
+ if (residual >= 0x1000)
+ {
+ (*_bfd_error_handler)
+ (_("%B(%A+0x%lx): Overflow whilst splitting 0x%lx for group relocation %s"),
+ input_bfd, input_section,
+ (long) rel->r_offset, abs (signed_value), howto->name);
+ return bfd_reloc_overflow;
+ }
+
+ /* Mask out the value and U bit. */
+ insn &= 0xff7ff000;
+
+ /* Set the U bit if the value to go in the place is non-negative. */
+ if (signed_value >= 0)
+ insn |= 1 << 23;
+
+ /* Encode the offset. */
+ insn |= residual;
+
+ bfd_put_32 (input_bfd, insn, hit_data);
+ }
+ return bfd_reloc_ok;
+
+ case R_ARM_LDRS_PC_G0:
+ case R_ARM_LDRS_PC_G1:
+ case R_ARM_LDRS_PC_G2:
+ case R_ARM_LDRS_SB_G0:
+ case R_ARM_LDRS_SB_G1:
+ case R_ARM_LDRS_SB_G2:
+ {
+ bfd_vma insn = bfd_get_32 (input_bfd, hit_data);
+ bfd_vma pc = input_section->output_section->vma
+ + input_section->output_offset + rel->r_offset;
+ bfd_vma sb = 0; /* See note above. */
+ bfd_vma residual;
+ bfd_signed_vma signed_value;
+ int group = 0;
+
+ /* Determine which groups of bits to calculate. */
+ switch (r_type)
+ {
+ case R_ARM_LDRS_PC_G0:
+ case R_ARM_LDRS_SB_G0:
+ group = 0;
+ break;
+
+ case R_ARM_LDRS_PC_G1:
+ case R_ARM_LDRS_SB_G1:
+ group = 1;
+ break;
+
+ case R_ARM_LDRS_PC_G2:
+ case R_ARM_LDRS_SB_G2:
+ group = 2;
+ break;
+
+ default:
+ abort();
+ }
+
+ /* If REL, extract the addend from the insn. If RELA, it will
+ have already been fetched for us. */
+ if (globals->use_rel)
+ {
+ int negative = (insn & (1 << 23)) ? 1 : -1;
+ signed_addend = negative * (((insn & 0xf00) >> 4) + (insn & 0xf));
+ }
+
+ /* Compute the value (X) to go in the place. */
+ if (r_type == R_ARM_LDRS_PC_G0
+ || r_type == R_ARM_LDRS_PC_G1
+ || r_type == R_ARM_LDRS_PC_G2)
+ /* PC relative. */
+ signed_value = value - pc + signed_addend;
+ else
+ /* Section base relative. */
+ signed_value = value - sb + signed_addend;
+
+ /* Calculate the value of the relevant G_{n-1} to obtain
+ the residual at that stage. */
+ calculate_group_reloc_mask (abs (signed_value), group - 1, &residual);
+
+ /* Check for overflow. */
+ if (residual >= 0x100)
+ {
+ (*_bfd_error_handler)
+ (_("%B(%A+0x%lx): Overflow whilst splitting 0x%lx for group relocation %s"),
+ input_bfd, input_section,
+ (long) rel->r_offset, abs (signed_value), howto->name);
+ return bfd_reloc_overflow;
+ }
+
+ /* Mask out the value and U bit. */
+ insn &= 0xff7ff0f0;
+
+ /* Set the U bit if the value to go in the place is non-negative. */
+ if (signed_value >= 0)
+ insn |= 1 << 23;
+
+ /* Encode the offset. */
+ insn |= ((residual & 0xf0) << 4) | (residual & 0xf);
+
+ bfd_put_32 (input_bfd, insn, hit_data);
+ }
+ return bfd_reloc_ok;
+
+ case R_ARM_LDC_PC_G0:
+ case R_ARM_LDC_PC_G1:
+ case R_ARM_LDC_PC_G2:
+ case R_ARM_LDC_SB_G0:
+ case R_ARM_LDC_SB_G1:
+ case R_ARM_LDC_SB_G2:
+ {
+ bfd_vma insn = bfd_get_32 (input_bfd, hit_data);
+ bfd_vma pc = input_section->output_section->vma
+ + input_section->output_offset + rel->r_offset;
+ bfd_vma sb = 0; /* See note above. */
+ bfd_vma residual;
+ bfd_signed_vma signed_value;
+ int group = 0;
+
+ /* Determine which groups of bits to calculate. */
+ switch (r_type)
+ {
+ case R_ARM_LDC_PC_G0:
+ case R_ARM_LDC_SB_G0:
+ group = 0;
+ break;
+
+ case R_ARM_LDC_PC_G1:
+ case R_ARM_LDC_SB_G1:
+ group = 1;
+ break;
+
+ case R_ARM_LDC_PC_G2:
+ case R_ARM_LDC_SB_G2:
+ group = 2;
+ break;
+
+ default:
+ abort();
+ }
+
+ /* If REL, extract the addend from the insn. If RELA, it will
+ have already been fetched for us. */
+ if (globals->use_rel)
+ {
+ int negative = (insn & (1 << 23)) ? 1 : -1;
+ signed_addend = negative * ((insn & 0xff) << 2);
+ }
+
+ /* Compute the value (X) to go in the place. */
+ if (r_type == R_ARM_LDC_PC_G0
+ || r_type == R_ARM_LDC_PC_G1
+ || r_type == R_ARM_LDC_PC_G2)
+ /* PC relative. */
+ signed_value = value - pc + signed_addend;
+ else
+ /* Section base relative. */
+ signed_value = value - sb + signed_addend;
+
+ /* Calculate the value of the relevant G_{n-1} to obtain
+ the residual at that stage. */
+ calculate_group_reloc_mask (abs (signed_value), group - 1, &residual);
+
+ /* Check for overflow. (The absolute value to go in the place must be
+ divisible by four and, after having been divided by four, must
+ fit in eight bits.) */
+ if ((residual & 0x3) != 0 || residual >= 0x400)
+ {
+ (*_bfd_error_handler)
+ (_("%B(%A+0x%lx): Overflow whilst splitting 0x%lx for group relocation %s"),
+ input_bfd, input_section,
+ (long) rel->r_offset, abs (signed_value), howto->name);
+ return bfd_reloc_overflow;
+ }
+
+ /* Mask out the value and U bit. */
+ insn &= 0xff7fff00;
+
+ /* Set the U bit if the value to go in the place is non-negative. */
+ if (signed_value >= 0)
+ insn |= 1 << 23;
+
+ /* Encode the offset. */
+ insn |= residual >> 2;
+
+ bfd_put_32 (input_bfd, insn, hit_data);
+ }
+ return bfd_reloc_ok;
+
+ default:
+ return bfd_reloc_notsupported;
+ }
+}
+
+/* Add INCREMENT to the reloc (of type HOWTO) at ADDRESS. */
+static void
+arm_add_to_rel (bfd * abfd,
+ bfd_byte * address,
+ reloc_howto_type * howto,
+ bfd_signed_vma increment)
+{
+ bfd_signed_vma addend;
+
+ if (howto->type == R_ARM_THM_CALL)
+ {
+ 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:
+ case R_ARM_PLT32:
+ case R_ARM_CALL:
+ case R_ARM_JUMP24:
+ 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);
+ }
+}
+
+#define IS_ARM_TLS_RELOC(R_TYPE) \
+ ((R_TYPE) == R_ARM_TLS_GD32 \
+ || (R_TYPE) == R_ARM_TLS_LDO32 \
+ || (R_TYPE) == R_ARM_TLS_LDM32 \
+ || (R_TYPE) == R_ARM_TLS_DTPOFF32 \
+ || (R_TYPE) == R_ARM_TLS_DTPMOD32 \
+ || (R_TYPE) == R_ARM_TLS_TPOFF32 \
+ || (R_TYPE) == R_ARM_TLS_LE32 \
+ || (R_TYPE) == R_ARM_TLS_IE32)
+
+/* Relocate an ARM ELF section. */
+static bfd_boolean
+elf32_arm_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;
+ Elf_Internal_Rela *rel;
+ Elf_Internal_Rela *relend;
+ const char *name;
+ struct elf32_arm_link_hash_table * globals;
+
+ globals = elf32_arm_hash_table (info);
+
+ 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;
+ char sym_type;
+ bfd_boolean unresolved_reloc = FALSE;
+ char *error_message = NULL;
+
+ r_symndx = ELF32_R_SYM (rel->r_info);
+ r_type = ELF32_R_TYPE (rel->r_info);
+ r_type = arm_real_reloc_type (globals, r_type);
+
+ if ( r_type == R_ARM_GNU_VTENTRY
+ || r_type == R_ARM_GNU_VTINHERIT)
+ continue;
+
+ bfd_reloc.howto = elf32_arm_howto_from_type (r_type);
+ howto = bfd_reloc.howto;
+
+ h = NULL;
+ sym = NULL;
+ sec = NULL;
+
+ if (r_symndx < symtab_hdr->sh_info)
+ {
+ sym = local_syms + r_symndx;
+ sym_type = ELF32_ST_TYPE (sym->st_info);
+ sec = local_sections[r_symndx];
+ if (globals->use_rel)
+ {
+ relocation = (sec->output_section->vma
+ + sec->output_offset
+ + sym->st_value);
+ if (!info->relocatable
+ && (sec->flags & SEC_MERGE)
+ && ELF_ST_TYPE (sym->st_info) == STT_SECTION)
+ {
+ asection *msec;
+ bfd_vma addend, value;
+
+ if (howto->rightshift)
+ {
+ (*_bfd_error_handler)
+ (_("%B(%A+0x%lx): %s relocation against SEC_MERGE section"),
+ 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);
+ }
+ 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);
+
+ sym_type = h->type;
+ }
+
+ if (sec != NULL && elf_discarded_section (sec))
+ {
+ /* For relocs against symbols from removed linkonce sections,
+ or sections discarded by a linker script, we just want the
+ section contents zeroed. Avoid any special processing. */
+ _bfd_clear_contents (howto, input_bfd, contents + rel->r_offset);
+ rel->r_info = 0;
+ rel->r_addend = 0;
+ continue;
+ }
+
+ 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 (sym != NULL && ELF_ST_TYPE (sym->st_info) == STT_SECTION)
+ {
+ if (globals->use_rel)
+ arm_add_to_rel (input_bfd, contents + rel->r_offset,
+ howto, (bfd_signed_vma) sec->output_offset);
+ else
+ rel->r_addend += sec->output_offset;
+ }
+ continue;
+ }
+
+ 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);
+ }
+
+ if (r_symndx != 0
+ && r_type != R_ARM_NONE
+ && (h == NULL
+ || h->root.type == bfd_link_hash_defined
+ || h->root.type == bfd_link_hash_defweak)
+ && IS_ARM_TLS_RELOC (r_type) != (sym_type == STT_TLS))
+ {
+ (*_bfd_error_handler)
+ ((sym_type == STT_TLS
+ ? _("%B(%A+0x%lx): %s used with TLS symbol %s")
+ : _("%B(%A+0x%lx): %s used with non-TLS symbol %s")),
+ input_bfd,
+ input_section,
+ (long) rel->r_offset,
+ howto->name,
+ name);
+ }
+
+ 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,
+ &unresolved_reloc, &error_message);
+
+ /* 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->def_dynamic))
+ {
+ (*_bfd_error_handler)
+ (_("%B(%A+0x%lx): unresolvable %s relocation against symbol `%s'"),
+ input_bfd,
+ input_section,
+ (long) rel->r_offset,
+ howto->name,
+ h->root.root.string);
+ return FALSE;
+ }
+
+ if (r != bfd_reloc_ok)
+ {
+ 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, (h ? &h->root : NULL), 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:
+ error_message = _("out of range");
+ goto common_error;
+
+ case bfd_reloc_notsupported:
+ error_message = _("unsupported relocation");
+ goto common_error;
+
+ case bfd_reloc_dangerous:
+ /* error_message should already be set. */
+ goto common_error;
+
+ default:
+ error_message = _("unknown error");
+ /* fall through */
+
+ common_error:
+ BFD_ASSERT (error_message != NULL);
+ if (!((*info->callbacks->reloc_dangerous)
+ (info, error_message, input_bfd, input_section,
+ rel->r_offset)))
+ return FALSE;
+ break;
+ }
+ }
+ }
+
+ return TRUE;
+}
+
+/* Set the right machine number. */
+
+static bfd_boolean
+elf32_arm_object_p (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 (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 %B since it has already been specified as non-interworking"),
+ abfd);
+ else
+ _bfd_error_handler
+ (_("Warning: Clearing the interworking flag of %B due to outside request"),
+ 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 (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 %B because non-interworking code in %B has been linked with it"),
+ obfd, 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;
+
+ /* Also copy the EI_OSABI field. */
+ elf_elfheader (obfd)->e_ident[EI_OSABI] =
+ elf_elfheader (ibfd)->e_ident[EI_OSABI];
+
+ /* Copy object attributes. */
+ _bfd_elf_copy_obj_attributes (ibfd, obfd);
+
+ return TRUE;
+}
+
+/* Values for Tag_ABI_PCS_R9_use. */
+enum
+{
+ AEABI_R9_V6,
+ AEABI_R9_SB,
+ AEABI_R9_TLS,
+ AEABI_R9_unused
+};
+
+/* Values for Tag_ABI_PCS_RW_data. */
+enum
+{
+ AEABI_PCS_RW_data_absolute,
+ AEABI_PCS_RW_data_PCrel,
+ AEABI_PCS_RW_data_SBrel,
+ AEABI_PCS_RW_data_unused
+};
+
+/* Values for Tag_ABI_enum_size. */
+enum
+{
+ AEABI_enum_unused,
+ AEABI_enum_short,
+ AEABI_enum_wide,
+ AEABI_enum_forced_wide
+};
+
+/* Determine whether an object attribute tag takes an integer, a
+ string or both. */
+static int
+elf32_arm_obj_attrs_arg_type (int tag)
+{
+ if (tag == Tag_compatibility)
+ return 3;
+ else if (tag == 4 || tag == 5)
+ return 2;
+ else if (tag < 32)
+ return 1;
+ else
+ return (tag & 1) != 0 ? 2 : 1;
+}
+
+/* Merge EABI object attributes from IBFD into OBFD. Raise an error if there
+ are conflicting attributes. */
+static bfd_boolean
+elf32_arm_merge_eabi_attributes (bfd *ibfd, bfd *obfd)
+{
+ obj_attribute *in_attr;
+ obj_attribute *out_attr;
+ obj_attribute_list *in_list;
+ /* Some tags have 0 = don't care, 1 = strong requirement,
+ 2 = weak requirement. */
+ static const int order_312[3] = {3, 1, 2};
+ int i;
+
+ if (!elf_known_obj_attributes_proc (obfd)[0].i)
+ {
+ /* This is the first object. Copy the attributes. */
+ _bfd_elf_copy_obj_attributes (ibfd, obfd);
+
+ /* Use the Tag_null value to indicate the attributes have been
+ initialized. */
+ elf_known_obj_attributes_proc (obfd)[0].i = 1;
+
+ return TRUE;
+ }
+
+ in_attr = elf_known_obj_attributes_proc (ibfd);
+ out_attr = elf_known_obj_attributes_proc (obfd);
+ /* This needs to happen before Tag_ABI_FP_number_model is merged. */
+ if (in_attr[Tag_ABI_VFP_args].i != out_attr[Tag_ABI_VFP_args].i)
+ {
+ /* Ignore mismatches if teh object doesn't use floating point. */
+ if (out_attr[Tag_ABI_FP_number_model].i == 0)
+ out_attr[Tag_ABI_VFP_args].i = in_attr[Tag_ABI_VFP_args].i;
+ else if (in_attr[Tag_ABI_FP_number_model].i != 0)
+ {
+ _bfd_error_handler
+ (_("ERROR: %B uses VFP register arguments, %B does not"),
+ ibfd, obfd);
+ return FALSE;
+ }
+ }
+
+ for (i = 4; i < NUM_KNOWN_OBJ_ATTRIBUTES; i++)
+ {
+ /* Merge this attribute with existing attributes. */
+ switch (i)
+ {
+ case Tag_CPU_raw_name:
+ case Tag_CPU_name:
+ /* Use whichever has the greatest architecture requirements. We
+ won't necessarily have both the above tags, so make sure input
+ name is non-NULL. */
+ if (in_attr[Tag_CPU_arch].i > out_attr[Tag_CPU_arch].i
+ && in_attr[i].s)
+ out_attr[i].s = _bfd_elf_attr_strdup (obfd, in_attr[i].s);
+ break;
+
+ case Tag_ABI_optimization_goals:
+ case Tag_ABI_FP_optimization_goals:
+ /* Use the first value seen. */
+ break;
+
+ case Tag_CPU_arch:
+ case Tag_ARM_ISA_use:
+ case Tag_THUMB_ISA_use:
+ case Tag_VFP_arch:
+ case Tag_WMMX_arch:
+ case Tag_NEON_arch:
+ /* ??? Do NEON and WMMX conflict? */
+ case Tag_ABI_FP_rounding:
+ case Tag_ABI_FP_denormal:
+ case Tag_ABI_FP_exceptions:
+ case Tag_ABI_FP_user_exceptions:
+ case Tag_ABI_FP_number_model:
+ case Tag_ABI_align8_preserved:
+ case Tag_ABI_HardFP_use:
+ /* Use the largest value specified. */
+ if (in_attr[i].i > out_attr[i].i)
+ out_attr[i].i = in_attr[i].i;
+ break;
+
+ case Tag_CPU_arch_profile:
+ /* Warn if conflicting architecture profiles used. */
+ if (out_attr[i].i && in_attr[i].i && in_attr[i].i != out_attr[i].i)
+ {
+ _bfd_error_handler
+ (_("ERROR: %B: Conflicting architecture profiles %c/%c"),
+ ibfd, in_attr[i].i, out_attr[i].i);
+ return FALSE;
+ }
+ if (in_attr[i].i)
+ out_attr[i].i = in_attr[i].i;
+ break;
+ case Tag_PCS_config:
+ if (out_attr[i].i == 0)
+ out_attr[i].i = in_attr[i].i;
+ else if (in_attr[i].i != 0 && out_attr[i].i != 0)
+ {
+ /* It's sometimes ok to mix different configs, so this is only
+ a warning. */
+ _bfd_error_handler
+ (_("Warning: %B: Conflicting platform configuration"), ibfd);
+ }
+ break;
+ case Tag_ABI_PCS_R9_use:
+ if (in_attr[i].i != out_attr[i].i
+ && out_attr[i].i != AEABI_R9_unused
+ && in_attr[i].i != AEABI_R9_unused)
+ {
+ _bfd_error_handler
+ (_("ERROR: %B: Conflicting use of R9"), ibfd);
+ return FALSE;
+ }
+ if (out_attr[i].i == AEABI_R9_unused)
+ out_attr[i].i = in_attr[i].i;
+ break;
+ case Tag_ABI_PCS_RW_data:
+ if (in_attr[i].i == AEABI_PCS_RW_data_SBrel
+ && out_attr[Tag_ABI_PCS_R9_use].i != AEABI_R9_SB
+ && out_attr[Tag_ABI_PCS_R9_use].i != AEABI_R9_unused)
+ {
+ _bfd_error_handler
+ (_("ERROR: %B: SB relative addressing conflicts with use of R9"),
+ ibfd);
+ return FALSE;
+ }
+ /* Use the smallest value specified. */
+ if (in_attr[i].i < out_attr[i].i)
+ out_attr[i].i = in_attr[i].i;
+ break;
+ case Tag_ABI_PCS_RO_data:
+ /* Use the smallest value specified. */
+ if (in_attr[i].i < out_attr[i].i)
+ out_attr[i].i = in_attr[i].i;
+ break;
+ case Tag_ABI_PCS_GOT_use:
+ if (in_attr[i].i > 2 || out_attr[i].i > 2
+ || order_312[in_attr[i].i] < order_312[out_attr[i].i])
+ out_attr[i].i = in_attr[i].i;
+ break;
+ case Tag_ABI_PCS_wchar_t:
+ if (out_attr[i].i && in_attr[i].i && out_attr[i].i != in_attr[i].i)
+ {
+ _bfd_error_handler
+ (_("ERROR: %B: Conflicting definitions of wchar_t"), ibfd);
+ return FALSE;
+ }
+ if (in_attr[i].i)
+ out_attr[i].i = in_attr[i].i;
+ break;
+ case Tag_ABI_align8_needed:
+ /* ??? Check against Tag_ABI_align8_preserved. */
+ if (in_attr[i].i > 2 || out_attr[i].i > 2
+ || order_312[in_attr[i].i] < order_312[out_attr[i].i])
+ out_attr[i].i = in_attr[i].i;
+ break;
+ case Tag_ABI_enum_size:
+ if (in_attr[i].i != AEABI_enum_unused)
+ {
+ if (out_attr[i].i == AEABI_enum_unused
+ || out_attr[i].i == AEABI_enum_forced_wide)
+ {
+ /* The existing object is compatible with anything.
+ Use whatever requirements the new object has. */
+ out_attr[i].i = in_attr[i].i;
+ }
+ else if (in_attr[i].i != AEABI_enum_forced_wide
+ && out_attr[i].i != in_attr[i].i
+ && !elf32_arm_tdata (obfd)->no_enum_size_warning)
+ {
+ const char *aeabi_enum_names[] =
+ { "", "variable-size", "32-bit", "" };
+ _bfd_error_handler
+ (_("warning: %B uses %s enums yet the output is to use %s enums; use of enum values across objects may fail"),
+ ibfd, aeabi_enum_names[in_attr[i].i],
+ aeabi_enum_names[out_attr[i].i]);
+ }
+ }
+ break;
+ case Tag_ABI_VFP_args:
+ /* Aready done. */
+ break;
+ case Tag_ABI_WMMX_args:
+ if (in_attr[i].i != out_attr[i].i)
+ {
+ _bfd_error_handler
+ (_("ERROR: %B uses iWMMXt register arguments, %B does not"),
+ ibfd, obfd);
+ return FALSE;
+ }
+ break;
+ default: /* All known attributes should be explicitly covered. */
+ abort ();
+ }
+ }
+
+ /* Merge Tag_compatibility attributes and any common GNU ones. */
+ _bfd_elf_merge_object_attributes (ibfd, obfd);
+
+ /* Check for any attributes not known on ARM. */
+ in_list = elf_other_obj_attributes_proc (ibfd);
+ while (in_list && in_list->tag == Tag_compatibility)
+ in_list = in_list->next;
+
+ for (; in_list; in_list = in_list->next)
+ {
+ if ((in_list->tag & 128) < 64)
+ {
+ _bfd_error_handler
+ (_("Warning: %B: Unknown EABI object attribute %d"),
+ ibfd, in_list->tag);
+ break;
+ }
+ }
+ return TRUE;
+}
+
+
+/* Return TRUE if the two EABI versions are incompatible. */
+
+static bfd_boolean
+elf32_arm_versions_compatible (unsigned iver, unsigned over)
+{
+ /* v4 and v5 are the same spec before and after it was released,
+ so allow mixing them. */
+ if ((iver == EF_ARM_EABI_VER4 && over == EF_ARM_EABI_VER5)
+ || (iver == EF_ARM_EABI_VER5 && over == EF_ARM_EABI_VER4))
+ return TRUE;
+
+ return (iver == over);
+}
+
+/* Merge backend specific data from an object file to the output
+ object file when linking. */
+
+static bfd_boolean
+elf32_arm_merge_private_bfd_data (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;
+
+ if (!elf32_arm_merge_eabi_attributes (ibfd, obfd))
+ return FALSE;
+
+ /* 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 incompatiblity. 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 (!elf32_arm_versions_compatible (EF_ARM_EABI_VERSION (in_flags),
+ EF_ARM_EABI_VERSION (out_flags)))
+ {
+ _bfd_error_handler
+ (_("ERROR: Source object %B has EABI version %d, but target %B has EABI version %d"),
+ ibfd, obfd,
+ (in_flags & EF_ARM_EABIMASK) >> 24,
+ (out_flags & EF_ARM_EABIMASK) >> 24);
+ return FALSE;
+ }
+
+ /* Not sure what needs to be checked for EABI versions >= 1. */
+ /* VxWorks libraries do not use these flags. */
+ if (get_elf_backend_data (obfd) != &elf32_arm_vxworks_bed
+ && get_elf_backend_data (ibfd) != &elf32_arm_vxworks_bed
+ && 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: %B is compiled for APCS-%d, whereas target %B uses APCS-%d"),
+ ibfd, obfd,
+ in_flags & EF_ARM_APCS_26 ? 26 : 32,
+ 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: %B passes floats in float registers, whereas %B passes them in integer registers"),
+ ibfd, obfd);
+ else
+ _bfd_error_handler
+ (_("ERROR: %B passes floats in integer registers, whereas %B passes them in float registers"),
+ ibfd, 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: %B uses VFP instructions, whereas %B does not"),
+ ibfd, obfd);
+ else
+ _bfd_error_handler
+ (_("ERROR: %B uses FPA instructions, whereas %B does not"),
+ ibfd, 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: %B uses Maverick instructions, whereas %B does not"),
+ ibfd, obfd);
+ else
+ _bfd_error_handler
+ (_("ERROR: %B does not use Maverick instructions, whereas %B does"),
+ ibfd, 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: %B uses software FP, whereas %B uses hardware FP"),
+ ibfd, obfd);
+ else
+ _bfd_error_handler
+ (_("ERROR: %B uses hardware FP, whereas %B uses software FP"),
+ ibfd, 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: %B supports interworking, whereas %B does not"),
+ ibfd, obfd);
+ }
+ else
+ {
+ _bfd_error_handler
+ (_("Warning: %B does not support interworking, whereas %B does"),
+ ibfd, obfd);
+ }
+ }
+ }
+
+ return flags_compatible;
+}
+
+/* Display the flags field. */
+
+static bfd_boolean
+elf32_arm_print_private_bfd_data (bfd *abfd, void * 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;
+
+ case EF_ARM_EABI_VER3:
+ fprintf (file, _(" [Version3 EABI]"));
+ break;
+
+ case EF_ARM_EABI_VER4:
+ fprintf (file, _(" [Version4 EABI]"));
+ goto eabi;
+
+ case EF_ARM_EABI_VER5:
+ fprintf (file, _(" [Version5 EABI]"));
+ eabi:
+ if (flags & EF_ARM_BE8)
+ fprintf (file, _(" [BE8]"));
+
+ if (flags & EF_ARM_LE8)
+ fprintf (file, _(" [LE8]"));
+
+ flags &= ~(EF_ARM_LE8 | EF_ARM_BE8);
+ 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_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 && type != STT_TLS)
+ return ELF_ST_TYPE (elf_sym->st_info);
+ break;
+
+ default:
+ break;
+ }
+
+ return type;
+}
+
+static asection *
+elf32_arm_gc_mark_hook (asection *sec,
+ struct bfd_link_info *info,
+ 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:
+ return NULL;
+ }
+
+ return _bfd_elf_gc_mark_hook (sec, info, rel, h, sym);
+}
+
+/* Update the got entry reference counts for the section being removed. */
+
+static bfd_boolean
+elf32_arm_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;
+ struct elf32_arm_link_hash_table * globals;
+
+ globals = elf32_arm_hash_table (info);
+
+ 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;
+ struct elf_link_hash_entry *h = NULL;
+ int r_type;
+
+ r_symndx = ELF32_R_SYM (rel->r_info);
+ if (r_symndx >= symtab_hdr->sh_info)
+ {
+ 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;
+ }
+
+ r_type = ELF32_R_TYPE (rel->r_info);
+ r_type = arm_real_reloc_type (globals, r_type);
+ switch (r_type)
+ {
+ case R_ARM_GOT32:
+ case R_ARM_GOT_PREL:
+ case R_ARM_TLS_GD32:
+ case R_ARM_TLS_IE32:
+ 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_ARM_TLS_LDM32:
+ elf32_arm_hash_table (info)->tls_ldm_got.refcount -= 1;
+ break;
+
+ case R_ARM_ABS32:
+ case R_ARM_ABS32_NOI:
+ case R_ARM_REL32:
+ case R_ARM_REL32_NOI:
+ case R_ARM_PC24:
+ case R_ARM_PLT32:
+ case R_ARM_CALL:
+ case R_ARM_JUMP24:
+ case R_ARM_PREL31:
+ case R_ARM_THM_CALL:
+ case R_ARM_MOVW_ABS_NC:
+ case R_ARM_MOVT_ABS:
+ case R_ARM_MOVW_PREL_NC:
+ case R_ARM_MOVT_PREL:
+ case R_ARM_THM_MOVW_ABS_NC:
+ case R_ARM_THM_MOVT_ABS:
+ case R_ARM_THM_MOVW_PREL_NC:
+ case R_ARM_THM_MOVT_PREL:
+ /* Should the interworking branches be here also? */
+
+ if (h != NULL)
+ {
+ struct elf32_arm_link_hash_entry *eh;
+ struct elf32_arm_relocs_copied **pp;
+ struct elf32_arm_relocs_copied *p;
+
+ eh = (struct elf32_arm_link_hash_entry *) h;
+
+ if (h->plt.refcount > 0)
+ {
+ h->plt.refcount -= 1;
+ if (ELF32_R_TYPE (rel->r_info) == R_ARM_THM_CALL)
+ eh->plt_thumb_refcount--;
+ }
+
+ if (r_type == R_ARM_ABS32
+ || r_type == R_ARM_REL32
+ || r_type == R_ARM_ABS32_NOI
+ || r_type == R_ARM_REL32_NOI)
+ {
+ for (pp = &eh->relocs_copied; (p = *pp) != NULL;
+ pp = &p->next)
+ if (p->section == sec)
+ {
+ p->count -= 1;
+ if (ELF32_R_TYPE (rel->r_info) == R_ARM_REL32
+ || ELF32_R_TYPE (rel->r_info) == R_ARM_REL32_NOI)
+ p->pc_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 (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;
+
+ /* Create dynamic sections for relocatable executables so that we can
+ copy relocations. */
+ if (htab->root.is_relocatable_executable
+ && ! htab->root.dynamic_sections_created)
+ {
+ if (! _bfd_elf_link_create_dynamic_sections (abfd, info))
+ return FALSE;
+ }
+
+ 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;
+ struct elf32_arm_link_hash_entry *eh;
+ unsigned long r_symndx;
+ int r_type;
+
+ r_symndx = ELF32_R_SYM (rel->r_info);
+ r_type = ELF32_R_TYPE (rel->r_info);
+ r_type = arm_real_reloc_type (htab, r_type);
+
+ if (r_symndx >= NUM_SHDR_ENTRIES (symtab_hdr))
+ {
+ (*_bfd_error_handler) (_("%B: bad symbol index: %d"), abfd,
+ r_symndx);
+ return FALSE;
+ }
+
+ if (r_symndx < symtab_hdr->sh_info)
+ h = NULL;
+ else
+ {
+ 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;
+ }
+
+ eh = (struct elf32_arm_link_hash_entry *) h;
+
+ switch (r_type)
+ {
+ case R_ARM_GOT32:
+ case R_ARM_GOT_PREL:
+ case R_ARM_TLS_GD32:
+ case R_ARM_TLS_IE32:
+ /* This symbol requires a global offset table entry. */
+ {
+ int tls_type, old_tls_type;
+
+ switch (r_type)
+ {
+ case R_ARM_TLS_GD32: tls_type = GOT_TLS_GD; break;
+ case R_ARM_TLS_IE32: tls_type = GOT_TLS_IE; break;
+ default: tls_type = GOT_NORMAL; break;
+ }
+
+ if (h != NULL)
+ {
+ h->got.refcount++;
+ old_tls_type = elf32_arm_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;
+ elf32_arm_local_got_tls_type (abfd)
+ = (char *) (local_got_refcounts + symtab_hdr->sh_info);
+ }
+ local_got_refcounts[r_symndx] += 1;
+ old_tls_type = elf32_arm_local_got_tls_type (abfd) [r_symndx];
+ }
+
+ /* We will already have issued an error message if there is a
+ TLS / non-TLS mismatch, based on the symbol type. We don't
+ support any linker relaxations. So just combine any TLS
+ types needed. */
+ if (old_tls_type != GOT_UNKNOWN && old_tls_type != GOT_NORMAL
+ && tls_type != GOT_NORMAL)
+ tls_type |= old_tls_type;
+
+ if (old_tls_type != tls_type)
+ {
+ if (h != NULL)
+ elf32_arm_hash_entry (h)->tls_type = tls_type;
+ else
+ elf32_arm_local_got_tls_type (abfd) [r_symndx] = tls_type;
+ }
+ }
+ /* Fall through */
+
+ case R_ARM_TLS_LDM32:
+ if (r_type == R_ARM_TLS_LDM32)
+ htab->tls_ldm_got.refcount++;
+ /* Fall through */
+
+ case R_ARM_GOTOFF32:
+ 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_ABS12:
+ /* VxWorks uses dynamic R_ARM_ABS12 relocations for
+ ldr __GOTT_INDEX__ offsets. */
+ if (!htab->vxworks_p)
+ break;
+ /* Fall through */
+
+ case R_ARM_ABS32:
+ case R_ARM_ABS32_NOI:
+ case R_ARM_REL32:
+ case R_ARM_REL32_NOI:
+ case R_ARM_PC24:
+ case R_ARM_PLT32:
+ case R_ARM_CALL:
+ case R_ARM_JUMP24:
+ case R_ARM_PREL31:
+ case R_ARM_THM_CALL:
+ case R_ARM_MOVW_ABS_NC:
+ case R_ARM_MOVT_ABS:
+ case R_ARM_MOVW_PREL_NC:
+ case R_ARM_MOVT_PREL:
+ case R_ARM_THM_MOVW_ABS_NC:
+ case R_ARM_THM_MOVT_ABS:
+ case R_ARM_THM_MOVW_PREL_NC:
+ case R_ARM_THM_MOVT_PREL:
+ /* Should the interworking branches be listed here? */
+ 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->non_got_ref = 1;
+
+ /* 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 (r_type != R_ARM_ABS32
+ && r_type != R_ARM_REL32
+ && r_type != R_ARM_ABS32_NOI
+ && r_type != R_ARM_REL32_NOI
+ && r_type != R_ARM_ABS12)
+ h->needs_plt = 1;
+
+ /* If we create a PLT entry, this relocation will reference
+ it, even if it's an ABS32 relocation. */
+ h->plt.refcount += 1;
+
+ if (r_type == R_ARM_THM_CALL)
+ eh->plt_thumb_refcount += 1;
+ }
+
+ /* If we are creating a shared library or relocatable executable,
+ 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 || htab->root.is_relocatable_executable)
+ && (sec->flags & SEC_ALLOC) != 0
+ && ((r_type == R_ARM_ABS32 || r_type == R_ARM_ABS32_NOI)
+ || (h != NULL && ! h->needs_plt
+ && (! info->symbolic || ! h->def_regular))))
+ {
+ 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 (reloc_section_p (htab, name, sec));
+
+ sreloc = bfd_get_section_by_name (dynobj, name);
+ if (sreloc == NULL)
+ {
+ flagword flags;
+
+ flags = (SEC_HAS_CONTENTS | SEC_READONLY
+ | SEC_IN_MEMORY | SEC_LINKER_CREATED);
+ if ((sec->flags & SEC_ALLOC) != 0
+ /* BPABI objects never have dynamic
+ relocations mapped. */
+ && !htab->symbian_p)
+ flags |= SEC_ALLOC | SEC_LOAD;
+ sreloc = bfd_make_section_with_flags (dynobj,
+ name,
+ flags);
+ if (sreloc == NULL
+ || ! 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;
+ void *vpp;
+
+ s = bfd_section_from_r_symndx (abfd, &htab->sym_sec,
+ sec, r_symndx);
+ if (s == NULL)
+ return FALSE;
+
+ vpp = &elf_section_data (s)->local_dynrel;
+ head = (struct elf32_arm_relocs_copied **) vpp;
+ }
+
+ 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;
+ p->pc_count = 0;
+ }
+
+ if (r_type == R_ARM_REL32 || r_type == R_ARM_REL32_NOI)
+ p->pc_count += 1;
+ 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;
+}
+
+/* Unwinding tables are not referenced directly. This pass marks them as
+ required if the corresponding code section is marked. */
+
+static bfd_boolean
+elf32_arm_gc_mark_extra_sections(struct bfd_link_info *info,
+ elf_gc_mark_hook_fn gc_mark_hook)
+{
+ bfd *sub;
+ Elf_Internal_Shdr **elf_shdrp;
+ bfd_boolean again;
+
+ /* Marking EH data may cause additional code sections to be marked,
+ requiring multiple passes. */
+ again = TRUE;
+ while (again)
+ {
+ again = FALSE;
+ for (sub = info->input_bfds; sub != NULL; sub = sub->link_next)
+ {
+ asection *o;
+
+ if (bfd_get_flavour (sub) != bfd_target_elf_flavour)
+ continue;
+
+ elf_shdrp = elf_elfsections (sub);
+ for (o = sub->sections; o != NULL; o = o->next)
+ {
+ Elf_Internal_Shdr *hdr;
+ hdr = &elf_section_data (o)->this_hdr;
+ if (hdr->sh_type == SHT_ARM_EXIDX && hdr->sh_link
+ && !o->gc_mark
+ && elf_shdrp[hdr->sh_link]->bfd_section->gc_mark)
+ {
+ again = TRUE;
+ if (!_bfd_elf_gc_mark (info, o, gc_mark_hook))
+ return FALSE;
+ }
+ }
+ }
+ }
+
+ return TRUE;
+}
+
+/* Treat mapping symbols as special target symbols. */
+
+static bfd_boolean
+elf32_arm_is_target_special_symbol (bfd * abfd ATTRIBUTE_UNUSED, asymbol * sym)
+{
+ return bfd_is_arm_special_symbol_name (sym->name,
+ BFD_ARM_SPECIAL_SYM_TYPE_ANY);
+}
+
+/* This is a copy of elf_find_function() from elf.c except that
+ ARM mapping symbols are ignored when looking for function names
+ and STT_ARM_TFUNC is considered to a function type. */
+
+static bfd_boolean
+arm_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 = NULL;
+ asymbol * func = NULL;
+ bfd_vma low_func = 0;
+ asymbol ** p;
+
+ for (p = symbols; *p != NULL; p++)
+ {
+ elf_symbol_type *q;
+
+ q = (elf_symbol_type *) *p;
+
+ switch (ELF_ST_TYPE (q->internal_elf_sym.st_info))
+ {
+ default:
+ break;
+ case STT_FILE:
+ filename = bfd_asymbol_name (&q->symbol);
+ break;
+ case STT_FUNC:
+ case STT_ARM_TFUNC:
+ case STT_NOTYPE:
+ /* Skip mapping symbols. */
+ if ((q->symbol.flags & BSF_LOCAL)
+ && bfd_is_arm_special_symbol_name (q->symbol.name,
+ BFD_ARM_SPECIAL_SYM_TYPE_ANY))
+ continue;
+ /* Fall through. */
+ if (bfd_get_section (&q->symbol) == 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. This code is a duplicate of the code in elf.c, except
+ that it uses arm_elf_find_function. */
+
+static bfd_boolean
+elf32_arm_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 = FALSE;
+
+ /* We skip _bfd_dwarf1_find_nearest_line since no known ARM toolchain uses it. */
+
+ 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)
+ arm_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 (! arm_elf_find_function (abfd, section, symbols, offset,
+ filename_ptr, functionname_ptr))
+ return FALSE;
+
+ *line_ptr = 0;
+ return TRUE;
+}
+
+static bfd_boolean
+elf32_arm_find_inliner_info (bfd * abfd,
+ const char ** filename_ptr,
+ const char ** functionname_ptr,
+ unsigned int * line_ptr)
+{
+ bfd_boolean found;
+ found = _bfd_dwarf2_find_inliner_info (abfd, filename_ptr,
+ functionname_ptr, line_ptr,
+ & elf_tdata (abfd)->dwarf2_find_line_info);
+ return found;
+}
+
+/* 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 (struct bfd_link_info * info,
+ struct elf_link_hash_entry * h)
+{
+ bfd * dynobj;
+ asection * s;
+ struct elf32_arm_link_hash_entry * eh;
+ struct elf32_arm_link_hash_table *globals;
+
+ globals = elf32_arm_hash_table (info);
+ dynobj = elf_hash_table (info)->dynobj;
+
+ /* Make sure we know what is going on here. */
+ BFD_ASSERT (dynobj != NULL
+ && (h->needs_plt
+ || h->u.weakdef != NULL
+ || (h->def_dynamic
+ && h->ref_regular
+ && !h->def_regular)));
+
+ eh = (struct elf32_arm_link_hash_entry *) h;
+
+ /* 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->type == STT_ARM_TFUNC
+ || h->needs_plt)
+ {
+ 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;
+ eh->plt_thumb_refcount = 0;
+ h->needs_plt = 0;
+ }
+
+ return TRUE;
+ }
+ else
+ {
+ /* It's possible that we incorrectly decided a .plt reloc was
+ needed for an R_ARM_PC24 or similar 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;
+ eh->plt_thumb_refcount = 0;
+ }
+
+ /* 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->u.weakdef != NULL)
+ {
+ BFD_ASSERT (h->u.weakdef->root.type == bfd_link_hash_defined
+ || h->u.weakdef->root.type == bfd_link_hash_defweak);
+ h->root.u.def.section = h->u.weakdef->root.u.def.section;
+ h->root.u.def.value = h->u.weakdef->root.u.def.value;
+ return TRUE;
+ }
+
+ /* If there are no non-GOT references, we do not need a copy
+ relocation. */
+ if (!h->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. Relocatable executables
+ can reference data in shared objects directly, so we don't need to
+ do anything here. */
+ if (info->shared || globals->root.is_relocatable_executable)
+ return TRUE;
+
+ if (h->size == 0)
+ {
+ (*_bfd_error_handler) (_("dynamic variable `%s' is zero size"),
+ h->root.root.string);
+ 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(a).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, RELOC_SECTION (globals, ".bss"));
+ BFD_ASSERT (srel != NULL);
+ srel->size += RELOC_SIZE (globals);
+ h->needs_copy = 1;
+ }
+
+ return _bfd_elf_adjust_dynamic_copy (h, s);
+}
+
+/* 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 elf32_arm_link_hash_table *htab;
+ struct elf32_arm_link_hash_entry *eh;
+ struct elf32_arm_relocs_copied *p;
+
+ eh = (struct elf32_arm_link_hash_entry *) h;
+
+ 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->forced_local)
+ {
+ 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->size == 0)
+ s->size += htab->plt_header_size;
+
+ h->plt.offset = s->size;
+
+ /* If we will insert a Thumb trampoline before this PLT, leave room
+ for it. */
+ if (!htab->use_blx && eh->plt_thumb_refcount > 0)
+ {
+ h->plt.offset += PLT_THUMB_STUB_SIZE;
+ s->size += PLT_THUMB_STUB_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->def_regular)
+ {
+ h->root.u.def.section = s;
+ h->root.u.def.value = h->plt.offset;
+
+ /* Make sure the function is not marked as Thumb, in case
+ it is the target of an ABS32 relocation, which will
+ point to the PLT entry. */
+ if (ELF_ST_TYPE (h->type) == STT_ARM_TFUNC)
+ h->type = ELF_ST_INFO (ELF_ST_BIND (h->type), STT_FUNC);
+ }
+
+ /* Make room for this entry. */
+ s->size += htab->plt_entry_size;
+
+ if (!htab->symbian_p)
+ {
+ /* We also need to make an entry in the .got.plt section, which
+ will be placed in the .got section by the linker script. */
+ eh->plt_got_offset = htab->sgotplt->size;
+ htab->sgotplt->size += 4;
+ }
+
+ /* We also need to make an entry in the .rel(a).plt section. */
+ htab->srelplt->size += RELOC_SIZE (htab);
+
+ /* VxWorks executables have a second set of relocations for
+ each PLT entry. They go in a separate relocation section,
+ which is processed by the kernel loader. */
+ if (htab->vxworks_p && !info->shared)
+ {
+ /* There is a relocation for the initial PLT entry:
+ an R_ARM_32 relocation for _GLOBAL_OFFSET_TABLE_. */
+ if (h->plt.offset == htab->plt_header_size)
+ htab->srelplt2->size += RELOC_SIZE (htab);
+
+ /* There are two extra relocations for each subsequent
+ PLT entry: an R_ARM_32 relocation for the GOT entry,
+ and an R_ARM_32 relocation for the PLT entry. */
+ htab->srelplt2->size += RELOC_SIZE (htab) * 2;
+ }
+ }
+ else
+ {
+ h->plt.offset = (bfd_vma) -1;
+ h->needs_plt = 0;
+ }
+ }
+ else
+ {
+ h->plt.offset = (bfd_vma) -1;
+ h->needs_plt = 0;
+ }
+
+ if (h->got.refcount > 0)
+ {
+ asection *s;
+ bfd_boolean dyn;
+ int tls_type = elf32_arm_hash_entry (h)->tls_type;
+ int indx;
+
+ /* 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->forced_local)
+ {
+ if (! bfd_elf_link_record_dynamic_symbol (info, h))
+ return FALSE;
+ }
+
+ if (!htab->symbian_p)
+ {
+ s = htab->sgot;
+ h->got.offset = s->size;
+
+ if (tls_type == GOT_UNKNOWN)
+ abort ();
+
+ if (tls_type == GOT_NORMAL)
+ /* Non-TLS symbols need one GOT slot. */
+ s->size += 4;
+ else
+ {
+ if (tls_type & GOT_TLS_GD)
+ /* R_ARM_TLS_GD32 needs 2 consecutive GOT slots. */
+ s->size += 8;
+ if (tls_type & GOT_TLS_IE)
+ /* R_ARM_TLS_IE32 needs one GOT slot. */
+ s->size += 4;
+ }
+
+ dyn = htab->root.dynamic_sections_created;
+
+ indx = 0;
+ if (WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, info->shared, h)
+ && (!info->shared
+ || !SYMBOL_REFERENCES_LOCAL (info, h)))
+ indx = h->dynindx;
+
+ if (tls_type != GOT_NORMAL
+ && (info->shared || indx != 0)
+ && (ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
+ || h->root.type != bfd_link_hash_undefweak))
+ {
+ if (tls_type & GOT_TLS_IE)
+ htab->srelgot->size += RELOC_SIZE (htab);
+
+ if (tls_type & GOT_TLS_GD)
+ htab->srelgot->size += RELOC_SIZE (htab);
+
+ if ((tls_type & GOT_TLS_GD) && indx != 0)
+ htab->srelgot->size += RELOC_SIZE (htab);
+ }
+ 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->size += RELOC_SIZE (htab);
+ }
+ }
+ else
+ h->got.offset = (bfd_vma) -1;
+
+ /* Allocate stubs for exported Thumb functions on v4t. */
+ if (!htab->use_blx && h->dynindx != -1
+ && h->def_regular
+ && ELF_ST_TYPE (h->type) == STT_ARM_TFUNC
+ && ELF_ST_VISIBILITY (h->other) == STV_DEFAULT)
+ {
+ struct elf_link_hash_entry * th;
+ struct bfd_link_hash_entry * bh;
+ struct elf_link_hash_entry * myh;
+ char name[1024];
+ asection *s;
+ bh = NULL;
+ /* Create a new symbol to regist the real location of the function. */
+ s = h->root.u.def.section;
+ sprintf(name, "__real_%s", h->root.root.string);
+ _bfd_generic_link_add_one_symbol (info, s->owner,
+ name, BSF_GLOBAL, s,
+ h->root.u.def.value,
+ NULL, TRUE, FALSE, &bh);
+
+ myh = (struct elf_link_hash_entry *) bh;
+ myh->type = ELF_ST_INFO (STB_LOCAL, STT_ARM_TFUNC);
+ myh->forced_local = 1;
+ eh->export_glue = myh;
+ th = record_arm_to_thumb_glue (info, h);
+ /* Point the symbol at the stub. */
+ h->type = ELF_ST_INFO (ELF_ST_BIND (h->type), STT_FUNC);
+ h->root.u.def.section = th->root.u.def.section;
+ h->root.u.def.value = th->root.u.def.value & ~1;
+ }
+
+ 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 || htab->root.is_relocatable_executable)
+ {
+ /* The only relocs that use pc_count are R_ARM_REL32 and
+ R_ARM_REL32_NOI, which will appear 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 elf32_arm_relocs_copied **pp;
+
+ for (pp = &eh->relocs_copied; (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 (eh->relocs_copied != NULL
+ && h->root.type == bfd_link_hash_undefweak)
+ {
+ if (ELF_ST_VISIBILITY (h->other) != STV_DEFAULT)
+ eh->relocs_copied = NULL;
+
+ /* Make sure undefined weak symbols are output as a dynamic
+ symbol in PIEs. */
+ else if (h->dynindx == -1
+ && !h->forced_local)
+ {
+ if (! bfd_elf_link_record_dynamic_symbol (info, h))
+ return FALSE;
+ }
+ }
+
+ else if (htab->root.is_relocatable_executable && h->dynindx == -1
+ && h->root.type == bfd_link_hash_new)
+ {
+ /* Output absolute symbols so that we can create relocations
+ against them. For normal symbols we output a relocation
+ against the section that contains them. */
+ if (! bfd_elf_link_record_dynamic_symbol (info, h))
+ return FALSE;
+ }
+
+ }
+ 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->non_got_ref
+ && ((h->def_dynamic
+ && !h->def_regular)
+ || (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->forced_local)
+ {
+ 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->size += p->count * RELOC_SIZE (htab);
+ }
+
+ return TRUE;
+}
+
+/* Find any dynamic relocs that apply to read-only sections. */
+
+static bfd_boolean
+elf32_arm_readonly_dynrelocs (struct elf_link_hash_entry *h, PTR inf)
+{
+ struct elf32_arm_link_hash_entry *eh;
+ struct elf32_arm_relocs_copied *p;
+
+ if (h->root.type == bfd_link_hash_warning)
+ h = (struct elf_link_hash_entry *) h->root.u.i.link;
+
+ eh = (struct elf32_arm_link_hash_entry *) h;
+ for (p = eh->relocs_copied; p != NULL; p = p->next)
+ {
+ asection *s = p->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;
+}
+
+void
+bfd_elf32_arm_set_byteswap_code (struct bfd_link_info *info,
+ int byteswap_code)
+{
+ struct elf32_arm_link_hash_table *globals;
+
+ globals = elf32_arm_hash_table (info);
+ globals->byteswap_code = byteswap_code;
+}
+
+/* Set the sizes of the dynamic sections. */
+
+static bfd_boolean
+elf32_arm_size_dynamic_sections (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);
+ check_use_blx (htab);
+
+ 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->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 = 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->size += p->count * RELOC_SIZE (htab);
+ 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;
+ local_tls_type = elf32_arm_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->size;
+ if (*local_tls_type & GOT_TLS_GD)
+ /* TLS_GD relocs need an 8-byte structure in the GOT. */
+ s->size += 8;
+ if (*local_tls_type & GOT_TLS_IE)
+ s->size += 4;
+ if (*local_tls_type == GOT_NORMAL)
+ s->size += 4;
+
+ if (info->shared || *local_tls_type == GOT_TLS_GD)
+ srel->size += RELOC_SIZE (htab);
+ }
+ else
+ *local_got = (bfd_vma) -1;
+ }
+ }
+
+ if (htab->tls_ldm_got.refcount > 0)
+ {
+ /* Allocate two GOT entries and one dynamic relocation (if necessary)
+ for R_ARM_TLS_LDM32 relocations. */
+ htab->tls_ldm_got.offset = htab->sgot->size;
+ htab->sgot->size += 8;
+ if (info->shared)
+ htab->srelgot->size += RELOC_SIZE (htab);
+ }
+ 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->root, allocate_dynrelocs, info);
+
+ /* Here we rummage through the found bfds to collect glue information. */
+ for (ibfd = info->input_bfds; ibfd != NULL; ibfd = ibfd->link_next)
+ {
+ /* Initialise mapping tables for code/data. */
+ bfd_elf32_arm_init_maps (ibfd);
+
+ if (!bfd_elf32_arm_process_before_allocation (ibfd, info)
+ || !bfd_elf32_arm_vfp11_erratum_scan (ibfd, info))
+ /* xgettext:c-format */
+ _bfd_error_handler (_("Errors encountered processing file %s"),
+ ibfd->filename);
+ }
+
+ /* 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;
+
+ 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 (strcmp (name, ".plt") == 0)
+ {
+ /* Remember whether there is a PLT. */
+ plt = s->size != 0;
+ }
+ else if (CONST_STRNEQ (name, ".rel"))
+ {
+ if (s->size != 0)
+ {
+ /* Remember whether there are any reloc sections other
+ than .rel(a).plt and .rela.plt.unloaded. */
+ if (s != htab->srelplt && s != htab->srelplt2)
+ 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 (! CONST_STRNEQ (name, ".got")
+ && strcmp (name, ".dynbss") != 0)
+ {
+ /* It's not one of our sections, so don't allocate space. */
+ continue;
+ }
+
+ if (s->size == 0)
+ {
+ /* If we don't need this section, strip it from the
+ output file. This is mostly to handle .rel(a).bss and
+ .rel(a).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. */
+ s->flags |= SEC_EXCLUDE;
+ continue;
+ }
+
+ if ((s->flags & SEC_HAS_CONTENTS) == 0)
+ continue;
+
+ /* Allocate memory for the section contents. */
+ s->contents = (bfd_byte *) bfd_zalloc (dynobj, s->size);
+ if (s->contents == NULL)
+ 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->executable)
+ {
+ 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,
+ htab->use_rel ? DT_REL : DT_RELA)
+ || !add_dynamic_entry (DT_JMPREL, 0))
+ return FALSE;
+ }
+
+ if (relocs)
+ {
+ if (htab->use_rel)
+ {
+ if (!add_dynamic_entry (DT_REL, 0)
+ || !add_dynamic_entry (DT_RELSZ, 0)
+ || !add_dynamic_entry (DT_RELENT, RELOC_SIZE (htab)))
+ return FALSE;
+ }
+ else
+ {
+ if (!add_dynamic_entry (DT_RELA, 0)
+ || !add_dynamic_entry (DT_RELASZ, 0)
+ || !add_dynamic_entry (DT_RELAENT, RELOC_SIZE (htab)))
+ 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->root, elf32_arm_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;
+}
+
+/* Finish up dynamic symbol handling. We set the contents of various
+ dynamic sections here. */
+
+static bfd_boolean
+elf32_arm_finish_dynamic_symbol (bfd * output_bfd, struct bfd_link_info * info,
+ struct elf_link_hash_entry * h, Elf_Internal_Sym * sym)
+{
+ bfd * dynobj;
+ struct elf32_arm_link_hash_table *htab;
+ struct elf32_arm_link_hash_entry *eh;
+
+ dynobj = elf_hash_table (info)->dynobj;
+ htab = elf32_arm_hash_table (info);
+ eh = (struct elf32_arm_link_hash_entry *) h;
+
+ if (h->plt.offset != (bfd_vma) -1)
+ {
+ asection * splt;
+ asection * srel;
+ bfd_byte *loc;
+ bfd_vma plt_index;
+ Elf_Internal_Rela rel;
+
+ /* 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");
+ srel = bfd_get_section_by_name (dynobj, RELOC_SECTION (htab, ".plt"));
+ BFD_ASSERT (splt != NULL && srel != NULL);
+
+ /* Fill in the entry in the procedure linkage table. */
+ if (htab->symbian_p)
+ {
+ put_arm_insn (htab, output_bfd,
+ elf32_arm_symbian_plt_entry[0],
+ splt->contents + h->plt.offset);
+ bfd_put_32 (output_bfd,
+ elf32_arm_symbian_plt_entry[1],
+ splt->contents + h->plt.offset + 4);
+
+ /* Fill in the entry in the .rel.plt section. */
+ rel.r_offset = (splt->output_section->vma
+ + splt->output_offset
+ + h->plt.offset + 4);
+ rel.r_info = ELF32_R_INFO (h->dynindx, R_ARM_GLOB_DAT);
+
+ /* 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 - htab->plt_header_size)
+ / htab->plt_entry_size);
+ }
+ else
+ {
+ bfd_vma got_offset, got_address, plt_address;
+ bfd_vma got_displacement;
+ asection * sgot;
+ bfd_byte * ptr;
+
+ sgot = bfd_get_section_by_name (dynobj, ".got.plt");
+ BFD_ASSERT (sgot != NULL);
+
+ /* Get the offset into the .got.plt table of the entry that
+ corresponds to this function. */
+ got_offset = eh->plt_got_offset;
+
+ /* 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 three entries in .got.plt are reserved; after that
+ symbols appear in the same order as in .plt. */
+ plt_index = (got_offset - 12) / 4;
+
+ /* Calculate the address of the GOT entry. */
+ got_address = (sgot->output_section->vma
+ + sgot->output_offset
+ + got_offset);
+
+ /* ...and the address of the PLT entry. */
+ plt_address = (splt->output_section->vma
+ + splt->output_offset
+ + h->plt.offset);
+
+ ptr = htab->splt->contents + h->plt.offset;
+ if (htab->vxworks_p && info->shared)
+ {
+ unsigned int i;
+ bfd_vma val;
+
+ for (i = 0; i != htab->plt_entry_size / 4; i++, ptr += 4)
+ {
+ val = elf32_arm_vxworks_shared_plt_entry[i];
+ if (i == 2)
+ val |= got_address - sgot->output_section->vma;
+ if (i == 5)
+ val |= plt_index * RELOC_SIZE (htab);
+ if (i == 2 || i == 5)
+ bfd_put_32 (output_bfd, val, ptr);
+ else
+ put_arm_insn (htab, output_bfd, val, ptr);
+ }
+ }
+ else if (htab->vxworks_p)
+ {
+ unsigned int i;
+ bfd_vma val;
+
+ for (i = 0; i != htab->plt_entry_size / 4; i++, ptr += 4)
+ {
+ val = elf32_arm_vxworks_exec_plt_entry[i];
+ if (i == 2)
+ val |= got_address;
+ if (i == 4)
+ val |= 0xffffff & -((h->plt.offset + i * 4 + 8) >> 2);
+ if (i == 5)
+ val |= plt_index * RELOC_SIZE (htab);
+ if (i == 2 || i == 5)
+ bfd_put_32 (output_bfd, val, ptr);
+ else
+ put_arm_insn (htab, output_bfd, val, ptr);
+ }
+
+ loc = (htab->srelplt2->contents
+ + (plt_index * 2 + 1) * RELOC_SIZE (htab));
+
+ /* Create the .rela.plt.unloaded R_ARM_ABS32 relocation
+ referencing the GOT for this PLT entry. */
+ rel.r_offset = plt_address + 8;
+ rel.r_info = ELF32_R_INFO (htab->root.hgot->indx, R_ARM_ABS32);
+ rel.r_addend = got_offset;
+ SWAP_RELOC_OUT (htab) (output_bfd, &rel, loc);
+ loc += RELOC_SIZE (htab);
+
+ /* Create the R_ARM_ABS32 relocation referencing the
+ beginning of the PLT for this GOT entry. */
+ rel.r_offset = got_address;
+ rel.r_info = ELF32_R_INFO (htab->root.hplt->indx, R_ARM_ABS32);
+ rel.r_addend = 0;
+ SWAP_RELOC_OUT (htab) (output_bfd, &rel, loc);
+ }
+ else
+ {
+ /* Calculate the displacement between the PLT slot and the
+ entry in the GOT. The eight-byte offset accounts for the
+ value produced by adding to pc in the first instruction
+ of the PLT stub. */
+ got_displacement = got_address - (plt_address + 8);
+
+ BFD_ASSERT ((got_displacement & 0xf0000000) == 0);
+
+ if (!htab->use_blx && eh->plt_thumb_refcount > 0)
+ {
+ put_thumb_insn (htab, output_bfd,
+ elf32_arm_plt_thumb_stub[0], ptr - 4);
+ put_thumb_insn (htab, output_bfd,
+ elf32_arm_plt_thumb_stub[1], ptr - 2);
+ }
+
+ put_arm_insn (htab, output_bfd,
+ elf32_arm_plt_entry[0]
+ | ((got_displacement & 0x0ff00000) >> 20),
+ ptr + 0);
+ put_arm_insn (htab, output_bfd,
+ elf32_arm_plt_entry[1]
+ | ((got_displacement & 0x000ff000) >> 12),
+ ptr+ 4);
+ put_arm_insn (htab, output_bfd,
+ elf32_arm_plt_entry[2]
+ | (got_displacement & 0x00000fff),
+ ptr + 8);
+#ifdef FOUR_WORD_PLT
+ bfd_put_32 (output_bfd, elf32_arm_plt_entry[3], ptr + 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(a).plt section. */
+ rel.r_addend = 0;
+ rel.r_offset = got_address;
+ rel.r_info = ELF32_R_INFO (h->dynindx, R_ARM_JUMP_SLOT);
+ }
+
+ loc = srel->contents + plt_index * RELOC_SIZE (htab);
+ SWAP_RELOC_OUT (htab) (output_bfd, &rel, loc);
+
+ if (!h->def_regular)
+ {
+ /* 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->ref_regular_nonweak)
+ sym->st_value = 0;
+ }
+ }
+
+ if (h->got.offset != (bfd_vma) -1
+ && (elf32_arm_hash_entry (h)->tls_type & GOT_TLS_GD) == 0
+ && (elf32_arm_hash_entry (h)->tls_type & GOT_TLS_IE) == 0)
+ {
+ asection * sgot;
+ asection * srel;
+ Elf_Internal_Rela rel;
+ bfd_byte *loc;
+ bfd_vma offset;
+
+ /* 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, RELOC_SECTION (htab, ".got"));
+ BFD_ASSERT (sgot != NULL && srel != NULL);
+
+ offset = (h->got.offset & ~(bfd_vma) 1);
+ rel.r_addend = 0;
+ rel.r_offset = (sgot->output_section->vma
+ + sgot->output_offset
+ + offset);
+
+ /* 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);
+ if (!htab->use_rel)
+ {
+ rel.r_addend = bfd_get_32 (output_bfd, sgot->contents + offset);
+ bfd_put_32 (output_bfd, (bfd_vma) 0, sgot->contents + offset);
+ }
+ }
+ else
+ {
+ BFD_ASSERT((h->got.offset & 1) == 0);
+ bfd_put_32 (output_bfd, (bfd_vma) 0, sgot->contents + offset);
+ rel.r_info = ELF32_R_INFO (h->dynindx, R_ARM_GLOB_DAT);
+ }
+
+ loc = srel->contents + srel->reloc_count++ * RELOC_SIZE (htab);
+ SWAP_RELOC_OUT (htab) (output_bfd, &rel, loc);
+ }
+
+ if (h->needs_copy)
+ {
+ 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,
+ RELOC_SECTION (htab, ".bss"));
+ BFD_ASSERT (s != NULL);
+
+ rel.r_addend = 0;
+ 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++ * RELOC_SIZE (htab);
+ SWAP_RELOC_OUT (htab) (output_bfd, &rel, loc);
+ }
+
+ /* Mark _DYNAMIC and _GLOBAL_OFFSET_TABLE_ as absolute. On VxWorks,
+ the _GLOBAL_OFFSET_TABLE_ symbol is not absolute: it is relative
+ to the ".got" section. */
+ if (strcmp (h->root.root.string, "_DYNAMIC") == 0
+ || (!htab->vxworks_p && h == htab->root.hgot))
+ sym->st_shndx = SHN_ABS;
+
+ return TRUE;
+}
+
+/* Finish up the dynamic sections. */
+
+static bfd_boolean
+elf32_arm_finish_dynamic_sections (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 (elf32_arm_hash_table (info)->symbian_p || 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;
+ struct elf32_arm_link_hash_table *htab;
+
+ htab = elf32_arm_hash_table (info);
+ 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->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)
+ {
+ unsigned int type;
+
+ default:
+ break;
+
+ case DT_HASH:
+ name = ".hash";
+ goto get_vma_if_bpabi;
+ case DT_STRTAB:
+ name = ".dynstr";
+ goto get_vma_if_bpabi;
+ case DT_SYMTAB:
+ name = ".dynsym";
+ goto get_vma_if_bpabi;
+ case DT_VERSYM:
+ name = ".gnu.version";
+ goto get_vma_if_bpabi;
+ case DT_VERDEF:
+ name = ".gnu.version_d";
+ goto get_vma_if_bpabi;
+ case DT_VERNEED:
+ name = ".gnu.version_r";
+ goto get_vma_if_bpabi;
+
+ case DT_PLTGOT:
+ name = ".got";
+ goto get_vma;
+ case DT_JMPREL:
+ name = RELOC_SECTION (htab, ".plt");
+ get_vma:
+ s = bfd_get_section_by_name (output_bfd, name);
+ BFD_ASSERT (s != NULL);
+ if (!htab->symbian_p)
+ dyn.d_un.d_ptr = s->vma;
+ else
+ /* In the BPABI, tags in the PT_DYNAMIC section point
+ at the file offset, not the memory address, for the
+ convenience of the post linker. */
+ dyn.d_un.d_ptr = s->filepos;
+ bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon);
+ break;
+
+ get_vma_if_bpabi:
+ if (htab->symbian_p)
+ goto get_vma;
+ break;
+
+ case DT_PLTRELSZ:
+ s = bfd_get_section_by_name (output_bfd,
+ RELOC_SECTION (htab, ".plt"));
+ BFD_ASSERT (s != NULL);
+ dyn.d_un.d_val = s->size;
+ bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon);
+ break;
+
+ case DT_RELSZ:
+ case DT_RELASZ:
+ if (!htab->symbian_p)
+ {
+ /* 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(a).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,
+ RELOC_SECTION (htab, ".plt"));
+ if (s != NULL)
+ dyn.d_un.d_val -= s->size;
+ bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon);
+ break;
+ }
+ /* Fall through */
+
+ case DT_REL:
+ case DT_RELA:
+ /* In the BPABI, the DT_REL tag must point at the file
+ offset, not the VMA, of the first relocation
+ section. So, we use code similar to that in
+ elflink.c, but do not check for SHF_ALLOC on the
+ relcoation section, since relocations sections are
+ never allocated under the BPABI. The comments above
+ about Unixware notwithstanding, we include all of the
+ relocations here. */
+ if (htab->symbian_p)
+ {
+ unsigned int i;
+ type = ((dyn.d_tag == DT_REL || dyn.d_tag == DT_RELSZ)
+ ? SHT_REL : SHT_RELA);
+ dyn.d_un.d_val = 0;
+ for (i = 1; i < elf_numsections (output_bfd); i++)
+ {
+ Elf_Internal_Shdr *hdr
+ = elf_elfsections (output_bfd)[i];
+ if (hdr->sh_type == type)
+ {
+ if (dyn.d_tag == DT_RELSZ
+ || dyn.d_tag == DT_RELASZ)
+ dyn.d_un.d_val += hdr->sh_size;
+ else if ((ufile_ptr) hdr->sh_offset
+ <= dyn.d_un.d_val - 1)
+ dyn.d_un.d_val = hdr->sh_offset;
+ }
+ }
+ 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->size > 0 && elf32_arm_hash_table (info)->plt_header_size)
+ {
+ const bfd_vma *plt0_entry;
+ bfd_vma got_address, plt_address, got_displacement;
+
+ /* Calculate the addresses of the GOT and PLT. */
+ got_address = sgot->output_section->vma + sgot->output_offset;
+ plt_address = splt->output_section->vma + splt->output_offset;
+
+ if (htab->vxworks_p)
+ {
+ /* The VxWorks GOT is relocated by the dynamic linker.
+ Therefore, we must emit relocations rather than simply
+ computing the values now. */
+ Elf_Internal_Rela rel;
+
+ plt0_entry = elf32_arm_vxworks_exec_plt0_entry;
+ put_arm_insn (htab, output_bfd, plt0_entry[0],
+ splt->contents + 0);
+ put_arm_insn (htab, output_bfd, plt0_entry[1],
+ splt->contents + 4);
+ put_arm_insn (htab, output_bfd, plt0_entry[2],
+ splt->contents + 8);
+ bfd_put_32 (output_bfd, got_address, splt->contents + 12);
+
+ /* Generate a relocation for _GLOBAL_OFFSET_TABLE_. */
+ rel.r_offset = plt_address + 12;
+ rel.r_info = ELF32_R_INFO (htab->root.hgot->indx, R_ARM_ABS32);
+ rel.r_addend = 0;
+ SWAP_RELOC_OUT (htab) (output_bfd, &rel,
+ htab->srelplt2->contents);
+ }
+ else
+ {
+ got_displacement = got_address - (plt_address + 16);
+
+ plt0_entry = elf32_arm_plt0_entry;
+ put_arm_insn (htab, output_bfd, plt0_entry[0],
+ splt->contents + 0);
+ put_arm_insn (htab, output_bfd, plt0_entry[1],
+ splt->contents + 4);
+ put_arm_insn (htab, output_bfd, plt0_entry[2],
+ splt->contents + 8);
+ put_arm_insn (htab, output_bfd, 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. */
+ if (splt->output_section->owner == output_bfd)
+ elf_section_data (splt->output_section)->this_hdr.sh_entsize = 4;
+
+ if (htab->vxworks_p && !info->shared && htab->splt->size > 0)
+ {
+ /* Correct the .rel(a).plt.unloaded relocations. They will have
+ incorrect symbol indexes. */
+ int num_plts;
+ unsigned char *p;
+
+ num_plts = ((htab->splt->size - htab->plt_header_size)
+ / htab->plt_entry_size);
+ p = htab->srelplt2->contents + RELOC_SIZE (htab);
+
+ for (; num_plts; num_plts--)
+ {
+ Elf_Internal_Rela rel;
+
+ SWAP_RELOC_IN (htab) (output_bfd, p, &rel);
+ rel.r_info = ELF32_R_INFO (htab->root.hgot->indx, R_ARM_ABS32);
+ SWAP_RELOC_OUT (htab) (output_bfd, &rel, p);
+ p += RELOC_SIZE (htab);
+
+ SWAP_RELOC_IN (htab) (output_bfd, p, &rel);
+ rel.r_info = ELF32_R_INFO (htab->root.hplt->indx, R_ARM_ABS32);
+ SWAP_RELOC_OUT (htab) (output_bfd, &rel, p);
+ p += RELOC_SIZE (htab);
+ }
+ }
+ }
+
+ /* Fill in the first three entries in the global offset table. */
+ if (sgot)
+ {
+ if (sgot->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 (bfd * abfd, struct bfd_link_info * link_info ATTRIBUTE_UNUSED)
+{
+ Elf_Internal_Ehdr * i_ehdrp; /* ELF file header, internal form. */
+ struct elf32_arm_link_hash_table *globals;
+
+ i_ehdrp = elf_elfheader (abfd);
+
+ if (EF_ARM_EABI_VERSION (i_ehdrp->e_flags) == EF_ARM_EABI_UNKNOWN)
+ i_ehdrp->e_ident[EI_OSABI] = ARM_ELF_OS_ABI_VERSION;
+ else
+ i_ehdrp->e_ident[EI_OSABI] = 0;
+ i_ehdrp->e_ident[EI_ABIVERSION] = ARM_ELF_ABI_VERSION;
+
+ if (link_info)
+ {
+ globals = elf32_arm_hash_table (link_info);
+ if (globals->byteswap_code)
+ i_ehdrp->e_flags |= EF_ARM_BE8;
+ }
+}
+
+static enum elf_reloc_type_class
+elf32_arm_reloc_type_class (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;
+ }
+}
+
+/* Set the right machine number for an Arm ELF file. */
+
+static bfd_boolean
+elf32_arm_section_flags (flagword *flags, const Elf_Internal_Shdr *hdr)
+{
+ if (hdr->sh_type == SHT_NOTE)
+ *flags |= SEC_LINK_ONCE | SEC_LINK_DUPLICATES_SAME_CONTENTS;
+
+ return TRUE;
+}
+
+static void
+elf32_arm_final_write_processing (bfd *abfd, bfd_boolean linker ATTRIBUTE_UNUSED)
+{
+ bfd_arm_update_notes (abfd, ARM_NOTE_SECTION);
+}
+
+/* Return TRUE if this is an unwinding table entry. */
+
+static bfd_boolean
+is_arm_elf_unwind_section_name (bfd * abfd ATTRIBUTE_UNUSED, const char * name)
+{
+ return (CONST_STRNEQ (name, ELF_STRING_ARM_unwind)
+ || CONST_STRNEQ (name, ELF_STRING_ARM_unwind_once));
+}
+
+
+/* Set the type and flags for an ARM section. We do this by
+ the section name, which is a hack, but ought to work. */
+
+static bfd_boolean
+elf32_arm_fake_sections (bfd * abfd, Elf_Internal_Shdr * hdr, asection * sec)
+{
+ const char * name;
+
+ name = bfd_get_section_name (abfd, sec);
+
+ if (is_arm_elf_unwind_section_name (abfd, name))
+ {
+ hdr->sh_type = SHT_ARM_EXIDX;
+ hdr->sh_flags |= SHF_LINK_ORDER;
+ }
+ return TRUE;
+}
+
+/* Handle an ARM specific section when reading an object file. This is
+ called when bfd_section_from_shdr finds a section with an unknown
+ type. */
+
+static bfd_boolean
+elf32_arm_section_from_shdr (bfd *abfd,
+ Elf_Internal_Shdr * hdr,
+ const char *name,
+ int shindex)
+{
+ /* 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
+ names for all the ARM specific sections, so we will probably get
+ away with this. */
+ switch (hdr->sh_type)
+ {
+ case SHT_ARM_EXIDX:
+ case SHT_ARM_PREEMPTMAP:
+ case SHT_ARM_ATTRIBUTES:
+ break;
+
+ default:
+ return FALSE;
+ }
+
+ if (! _bfd_elf_make_section_from_shdr (abfd, hdr, name, shindex))
+ return FALSE;
+
+ return TRUE;
+}
+
+/* A structure used to record a list of sections, independently
+ of the next and prev fields in the asection structure. */
+typedef struct section_list
+{
+ asection * sec;
+ struct section_list * next;
+ struct section_list * prev;
+}
+section_list;
+
+/* Unfortunately we need to keep a list of sections for which
+ an _arm_elf_section_data structure has been allocated. This
+ is because it is possible for functions like elf32_arm_write_section
+ to be called on a section which has had an elf_data_structure
+ allocated for it (and so the used_by_bfd field is valid) but
+ for which the ARM extended version of this structure - the
+ _arm_elf_section_data structure - has not been allocated. */
+static section_list * sections_with_arm_elf_section_data = NULL;
+
+static void
+record_section_with_arm_elf_section_data (asection * sec)
+{
+ struct section_list * entry;
+
+ entry = bfd_malloc (sizeof (* entry));
+ if (entry == NULL)
+ return;
+ entry->sec = sec;
+ entry->next = sections_with_arm_elf_section_data;
+ entry->prev = NULL;
+ if (entry->next != NULL)
+ entry->next->prev = entry;
+ sections_with_arm_elf_section_data = entry;
+}
+
+static struct section_list *
+find_arm_elf_section_entry (asection * sec)
+{
+ struct section_list * entry;
+ static struct section_list * last_entry = NULL;
+
+ /* This is a short cut for the typical case where the sections are added
+ to the sections_with_arm_elf_section_data list in forward order and
+ then looked up here in backwards order. This makes a real difference
+ to the ld-srec/sec64k.exp linker test. */
+ entry = sections_with_arm_elf_section_data;
+ if (last_entry != NULL)
+ {
+ if (last_entry->sec == sec)
+ entry = last_entry;
+ else if (last_entry->next != NULL
+ && last_entry->next->sec == sec)
+ entry = last_entry->next;
+ }
+
+ for (; entry; entry = entry->next)
+ if (entry->sec == sec)
+ break;
+
+ if (entry)
+ /* Record the entry prior to this one - it is the entry we are most
+ likely to want to locate next time. Also this way if we have been
+ called from unrecord_section_with_arm_elf_section_data() we will not
+ be caching a pointer that is about to be freed. */
+ last_entry = entry->prev;
+
+ return entry;
+}
+
+static _arm_elf_section_data *
+get_arm_elf_section_data (asection * sec)
+{
+ struct section_list * entry;
+
+ entry = find_arm_elf_section_entry (sec);
+
+ if (entry)
+ return elf32_arm_section_data (entry->sec);
+ else
+ return NULL;
+}
+
+static void
+unrecord_section_with_arm_elf_section_data (asection * sec)
+{
+ struct section_list * entry;
+
+ entry = find_arm_elf_section_entry (sec);
+
+ if (entry)
+ {
+ if (entry->prev != NULL)
+ entry->prev->next = entry->next;
+ if (entry->next != NULL)
+ entry->next->prev = entry->prev;
+ if (entry == sections_with_arm_elf_section_data)
+ sections_with_arm_elf_section_data = entry->next;
+ free (entry);
+ }
+}
+
+
+typedef struct
+{
+ void *finfo;
+ struct bfd_link_info *info;
+ asection *sec;
+ int sec_shndx;
+ bfd_boolean (*func) (void *, const char *, Elf_Internal_Sym *,
+ asection *, struct elf_link_hash_entry *);
+} output_arch_syminfo;
+
+enum map_symbol_type
+{
+ ARM_MAP_ARM,
+ ARM_MAP_THUMB,
+ ARM_MAP_DATA
+};
+
+
+/* Output a single PLT mapping symbol. */
+
+static bfd_boolean
+elf32_arm_ouput_plt_map_sym (output_arch_syminfo *osi,
+ enum map_symbol_type type,
+ bfd_vma offset)
+{
+ static const char *names[3] = {"$a", "$t", "$d"};
+ struct elf32_arm_link_hash_table *htab;
+ Elf_Internal_Sym sym;
+
+ htab = elf32_arm_hash_table (osi->info);
+ sym.st_value = osi->sec->output_section->vma
+ + osi->sec->output_offset
+ + offset;
+ sym.st_size = 0;
+ sym.st_other = 0;
+ sym.st_info = ELF_ST_INFO (STB_LOCAL, STT_NOTYPE);
+ sym.st_shndx = osi->sec_shndx;
+ if (!osi->func (osi->finfo, names[type], &sym, osi->sec, NULL))
+ return FALSE;
+ return TRUE;
+}
+
+
+/* Output mapping symbols for PLT entries associated with H. */
+
+static bfd_boolean
+elf32_arm_output_plt_map (struct elf_link_hash_entry *h, void *inf)
+{
+ output_arch_syminfo *osi = (output_arch_syminfo *) inf;
+ struct elf32_arm_link_hash_table *htab;
+ struct elf32_arm_link_hash_entry *eh;
+ bfd_vma addr;
+
+ htab = elf32_arm_hash_table (osi->info);
+
+ 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;
+
+ if (h->plt.offset == (bfd_vma) -1)
+ return TRUE;
+
+ eh = (struct elf32_arm_link_hash_entry *) h;
+ addr = h->plt.offset;
+ if (htab->symbian_p)
+ {
+ if (!elf32_arm_ouput_plt_map_sym (osi, ARM_MAP_ARM, addr))
+ return FALSE;
+ if (!elf32_arm_ouput_plt_map_sym (osi, ARM_MAP_DATA, addr + 4))
+ return FALSE;
+ }
+ else if (htab->vxworks_p)
+ {
+ if (!elf32_arm_ouput_plt_map_sym (osi, ARM_MAP_ARM, addr))
+ return FALSE;
+ if (!elf32_arm_ouput_plt_map_sym (osi, ARM_MAP_DATA, addr + 8))
+ return FALSE;
+ if (!elf32_arm_ouput_plt_map_sym (osi, ARM_MAP_ARM, addr + 12))
+ return FALSE;
+ if (!elf32_arm_ouput_plt_map_sym (osi, ARM_MAP_DATA, addr + 20))
+ return FALSE;
+ }
+ else
+ {
+ bfd_boolean thumb_stub;
+
+ thumb_stub = eh->plt_thumb_refcount > 0 && !htab->use_blx;
+ if (thumb_stub)
+ {
+ if (!elf32_arm_ouput_plt_map_sym (osi, ARM_MAP_THUMB, addr - 4))
+ return FALSE;
+ }
+#ifdef FOUR_WORD_PLT
+ if (!elf32_arm_ouput_plt_map_sym (osi, ARM_MAP_ARM, addr))
+ return FALSE;
+ if (!elf32_arm_ouput_plt_map_sym (osi, ARM_MAP_DATA, addr + 12))
+ return FALSE;
+#else
+ /* A three-word PLT with no Thumb thunk contains only Arm code,
+ so only need to output a mapping symbol for the first PLT entry and
+ entries with thumb thunks. */
+ if (thumb_stub || addr == 20)
+ {
+ if (!elf32_arm_ouput_plt_map_sym (osi, ARM_MAP_ARM, addr))
+ return FALSE;
+ }
+#endif
+ }
+
+ return TRUE;
+}
+
+
+/* Output mapping symbols for linker generated sections. */
+
+static bfd_boolean
+elf32_arm_output_arch_local_syms (bfd *output_bfd,
+ struct bfd_link_info *info,
+ void *finfo, bfd_boolean (*func) (void *, const char *,
+ Elf_Internal_Sym *,
+ asection *,
+ struct elf_link_hash_entry *))
+{
+ output_arch_syminfo osi;
+ struct elf32_arm_link_hash_table *htab;
+ bfd_vma offset;
+ bfd_size_type size;
+
+ htab = elf32_arm_hash_table (info);
+ check_use_blx(htab);
+
+ osi.finfo = finfo;
+ osi.info = info;
+ osi.func = func;
+
+ /* ARM->Thumb glue. */
+ if (htab->arm_glue_size > 0)
+ {
+ osi.sec = bfd_get_section_by_name (htab->bfd_of_glue_owner,
+ ARM2THUMB_GLUE_SECTION_NAME);
+
+ osi.sec_shndx = _bfd_elf_section_from_bfd_section
+ (output_bfd, osi.sec->output_section);
+ if (info->shared || htab->root.is_relocatable_executable
+ || htab->pic_veneer)
+ size = ARM2THUMB_PIC_GLUE_SIZE;
+ else if (htab->use_blx)
+ size = ARM2THUMB_V5_STATIC_GLUE_SIZE;
+ else
+ size = ARM2THUMB_STATIC_GLUE_SIZE;
+
+ for (offset = 0; offset < htab->arm_glue_size; offset += size)
+ {
+ elf32_arm_ouput_plt_map_sym (&osi, ARM_MAP_ARM, offset);
+ elf32_arm_ouput_plt_map_sym (&osi, ARM_MAP_DATA, offset + size - 4);
+ }
+ }
+
+ /* Thumb->ARM glue. */
+ if (htab->thumb_glue_size > 0)
+ {
+ osi.sec = bfd_get_section_by_name (htab->bfd_of_glue_owner,
+ THUMB2ARM_GLUE_SECTION_NAME);
+
+ osi.sec_shndx = _bfd_elf_section_from_bfd_section
+ (output_bfd, osi.sec->output_section);
+ size = THUMB2ARM_GLUE_SIZE;
+
+ for (offset = 0; offset < htab->thumb_glue_size; offset += size)
+ {
+ elf32_arm_ouput_plt_map_sym (&osi, ARM_MAP_THUMB, offset);
+ elf32_arm_ouput_plt_map_sym (&osi, ARM_MAP_ARM, offset + 4);
+ }
+ }
+
+ /* Finally, output mapping symbols for the PLT. */
+ if (!htab->splt || htab->splt->size == 0)
+ return TRUE;
+
+ osi.sec_shndx = _bfd_elf_section_from_bfd_section (output_bfd,
+ htab->splt->output_section);
+ osi.sec = htab->splt;
+ /* Output mapping symbols for the plt header. SymbianOS does not have a
+ plt header. */
+ if (htab->vxworks_p)
+ {
+ /* VxWorks shared libraries have no PLT header. */
+ if (!info->shared)
+ {
+ if (!elf32_arm_ouput_plt_map_sym (&osi, ARM_MAP_ARM, 0))
+ return FALSE;
+ if (!elf32_arm_ouput_plt_map_sym (&osi, ARM_MAP_DATA, 12))
+ return FALSE;
+ }
+ }
+ else if (!htab->symbian_p)
+ {
+ if (!elf32_arm_ouput_plt_map_sym (&osi, ARM_MAP_ARM, 0))
+ return FALSE;
+#ifndef FOUR_WORD_PLT
+ if (!elf32_arm_ouput_plt_map_sym (&osi, ARM_MAP_DATA, 16))
+ return FALSE;
+#endif
+ }
+
+ elf_link_hash_traverse (&htab->root, elf32_arm_output_plt_map, (void *) &osi);
+ return TRUE;
+}
+
+/* Allocate target specific section data. */
+
+static bfd_boolean
+elf32_arm_new_section_hook (bfd *abfd, asection *sec)
+{
+ if (!sec->used_by_bfd)
+ {
+ _arm_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;
+ }
+
+ record_section_with_arm_elf_section_data (sec);
+
+ return _bfd_elf_new_section_hook (abfd, sec);
+}
+
+
+/* Used to order a list of mapping symbols by address. */
+
+static int
+elf32_arm_compare_mapping (const void * a, const void * b)
+{
+ return ((const elf32_arm_section_map *) a)->vma
+ > ((const elf32_arm_section_map *) b)->vma;
+}
+
+
+/* Do code byteswapping. Return FALSE afterwards so that the section is
+ written out as normal. */
+
+static bfd_boolean
+elf32_arm_write_section (bfd *output_bfd,
+ struct bfd_link_info *link_info, asection *sec,
+ bfd_byte *contents)
+{
+ int mapcount, errcount;
+ _arm_elf_section_data *arm_data;
+ struct elf32_arm_link_hash_table *globals = elf32_arm_hash_table (link_info);
+ elf32_arm_section_map *map;
+ elf32_vfp11_erratum_list *errnode;
+ bfd_vma ptr;
+ bfd_vma end;
+ bfd_vma offset = sec->output_section->vma + sec->output_offset;
+ bfd_byte tmp;
+ int i;
+
+ /* If this section has not been allocated an _arm_elf_section_data
+ structure then we cannot record anything. */
+ arm_data = get_arm_elf_section_data (sec);
+ if (arm_data == NULL)
+ return FALSE;
+
+ mapcount = arm_data->mapcount;
+ map = arm_data->map;
+ errcount = arm_data->erratumcount;
+
+ if (errcount != 0)
+ {
+ unsigned int endianflip = bfd_big_endian (output_bfd) ? 3 : 0;
+
+ for (errnode = arm_data->erratumlist; errnode != 0;
+ errnode = errnode->next)
+ {
+ bfd_vma index = errnode->vma - offset;
+
+ switch (errnode->type)
+ {
+ case VFP11_ERRATUM_BRANCH_TO_ARM_VENEER:
+ {
+ bfd_vma branch_to_veneer;
+ /* Original condition code of instruction, plus bit mask for
+ ARM B instruction. */
+ unsigned int insn = (errnode->u.b.vfp_insn & 0xf0000000)
+ | 0x0a000000;
+
+ /* The instruction is before the label. */
+ index -= 4;
+
+ /* Above offset included in -4 below. */
+ branch_to_veneer = errnode->u.b.veneer->vma
+ - errnode->vma - 4;
+
+ if ((signed) branch_to_veneer < -(1 << 25)
+ || (signed) branch_to_veneer >= (1 << 25))
+ (*_bfd_error_handler) (_("%B: error: VFP11 veneer out of "
+ "range"), output_bfd);
+
+ insn |= (branch_to_veneer >> 2) & 0xffffff;
+ contents[endianflip ^ index] = insn & 0xff;
+ contents[endianflip ^ (index + 1)] = (insn >> 8) & 0xff;
+ contents[endianflip ^ (index + 2)] = (insn >> 16) & 0xff;
+ contents[endianflip ^ (index + 3)] = (insn >> 24) & 0xff;
+ }
+ break;
+
+ case VFP11_ERRATUM_ARM_VENEER:
+ {
+ bfd_vma branch_from_veneer;
+ unsigned int insn;
+
+ /* Take size of veneer into account. */
+ branch_from_veneer = errnode->u.v.branch->vma
+ - errnode->vma - 12;
+
+ if ((signed) branch_from_veneer < -(1 << 25)
+ || (signed) branch_from_veneer >= (1 << 25))
+ (*_bfd_error_handler) (_("%B: error: VFP11 veneer out of "
+ "range"), output_bfd);
+
+ /* Original instruction. */
+ insn = errnode->u.v.branch->u.b.vfp_insn;
+ contents[endianflip ^ index] = insn & 0xff;
+ contents[endianflip ^ (index + 1)] = (insn >> 8) & 0xff;
+ contents[endianflip ^ (index + 2)] = (insn >> 16) & 0xff;
+ contents[endianflip ^ (index + 3)] = (insn >> 24) & 0xff;
+
+ /* Branch back to insn after original insn. */
+ insn = 0xea000000 | ((branch_from_veneer >> 2) & 0xffffff);
+ contents[endianflip ^ (index + 4)] = insn & 0xff;
+ contents[endianflip ^ (index + 5)] = (insn >> 8) & 0xff;
+ contents[endianflip ^ (index + 6)] = (insn >> 16) & 0xff;
+ contents[endianflip ^ (index + 7)] = (insn >> 24) & 0xff;
+ }
+ break;
+
+ default:
+ abort ();
+ }
+ }
+ }
+
+ if (mapcount == 0)
+ return FALSE;
+
+ if (globals->byteswap_code)
+ {
+ qsort (map, mapcount, sizeof (* map), elf32_arm_compare_mapping);
+
+ ptr = map[0].vma;
+ for (i = 0; i < mapcount; i++)
+ {
+ if (i == mapcount - 1)
+ end = sec->size;
+ else
+ end = map[i + 1].vma;
+
+ switch (map[i].type)
+ {
+ case 'a':
+ /* Byte swap code words. */
+ while (ptr + 3 < end)
+ {
+ tmp = contents[ptr];
+ contents[ptr] = contents[ptr + 3];
+ contents[ptr + 3] = tmp;
+ tmp = contents[ptr + 1];
+ contents[ptr + 1] = contents[ptr + 2];
+ contents[ptr + 2] = tmp;
+ ptr += 4;
+ }
+ break;
+
+ case 't':
+ /* Byte swap code halfwords. */
+ while (ptr + 1 < end)
+ {
+ tmp = contents[ptr];
+ contents[ptr] = contents[ptr + 1];
+ contents[ptr + 1] = tmp;
+ ptr += 2;
+ }
+ break;
+
+ case 'd':
+ /* Leave data alone. */
+ break;
+ }
+ ptr = end;
+ }
+ }
+
+ free (map);
+ arm_data->mapcount = 0;
+ arm_data->mapsize = 0;
+ arm_data->map = NULL;
+ unrecord_section_with_arm_elf_section_data (sec);
+
+ return FALSE;
+}
+
+static void
+unrecord_section_via_map_over_sections (bfd * abfd ATTRIBUTE_UNUSED,
+ asection * sec,
+ void * ignore ATTRIBUTE_UNUSED)
+{
+ unrecord_section_with_arm_elf_section_data (sec);
+}
+
+static bfd_boolean
+elf32_arm_close_and_cleanup (bfd * abfd)
+{
+ if (abfd->sections)
+ bfd_map_over_sections (abfd,
+ unrecord_section_via_map_over_sections,
+ NULL);
+
+ return _bfd_elf_close_and_cleanup (abfd);
+}
+
+static bfd_boolean
+elf32_arm_bfd_free_cached_info (bfd * abfd)
+{
+ if (abfd->sections)
+ bfd_map_over_sections (abfd,
+ unrecord_section_via_map_over_sections,
+ NULL);
+
+ return _bfd_free_cached_info (abfd);
+}
+
+/* Display STT_ARM_TFUNC symbols as functions. */
+
+static void
+elf32_arm_symbol_processing (bfd *abfd ATTRIBUTE_UNUSED,
+ asymbol *asym)
+{
+ elf_symbol_type *elfsym = (elf_symbol_type *) asym;
+
+ if (ELF_ST_TYPE (elfsym->internal_elf_sym.st_info) == STT_ARM_TFUNC)
+ elfsym->symbol.flags |= BSF_FUNCTION;
+}
+
+
+/* Mangle thumb function symbols as we read them in. */
+
+static bfd_boolean
+elf32_arm_swap_symbol_in (bfd * abfd,
+ const void *psrc,
+ const void *pshn,
+ Elf_Internal_Sym *dst)
+{
+ if (!bfd_elf32_swap_symbol_in (abfd, psrc, pshn, dst))
+ return FALSE;
+
+ /* New EABI objects mark thumb function symbols by setting the low bit of
+ the address. Turn these into STT_ARM_TFUNC. */
+ if (ELF_ST_TYPE (dst->st_info) == STT_FUNC
+ && (dst->st_value & 1))
+ {
+ dst->st_info = ELF_ST_INFO (ELF_ST_BIND (dst->st_info), STT_ARM_TFUNC);
+ dst->st_value &= ~(bfd_vma) 1;
+ }
+ return TRUE;
+}
+
+
+/* Mangle thumb function symbols as we write them out. */
+
+static void
+elf32_arm_swap_symbol_out (bfd *abfd,
+ const Elf_Internal_Sym *src,
+ void *cdst,
+ void *shndx)
+{
+ Elf_Internal_Sym newsym;
+
+ /* We convert STT_ARM_TFUNC symbols into STT_FUNC with the low bit
+ of the address set, as per the new EABI. We do this unconditionally
+ because objcopy does not set the elf header flags until after
+ it writes out the symbol table. */
+ if (ELF_ST_TYPE (src->st_info) == STT_ARM_TFUNC)
+ {
+ newsym = *src;
+ newsym.st_info = ELF_ST_INFO (ELF_ST_BIND (src->st_info), STT_FUNC);
+ if (newsym.st_shndx != SHN_UNDEF)
+ {
+ /* Do this only for defined symbols. At link type, the static
+ linker will simulate the work of dynamic linker of resolving
+ symbols and will carry over the thumbness of found symbols to
+ the output symbol table. It's not clear how it happens, but
+ the thumbness of undefined symbols can well be different at
+ runtime, and writing '1' for them will be confusing for users
+ and possibly for dynamic linker itself.
+ */
+ newsym.st_value |= 1;
+ }
+
+ src = &newsym;
+ }
+ bfd_elf32_swap_symbol_out (abfd, src, cdst, shndx);
+}
+
+/* Add the PT_ARM_EXIDX program header. */
+
+static bfd_boolean
+elf32_arm_modify_segment_map (bfd *abfd,
+ struct bfd_link_info *info ATTRIBUTE_UNUSED)
+{
+ struct elf_segment_map *m;
+ asection *sec;
+
+ sec = bfd_get_section_by_name (abfd, ".ARM.exidx");
+ if (sec != NULL && (sec->flags & SEC_LOAD) != 0)
+ {
+ /* If there is already a PT_ARM_EXIDX header, then we do not
+ want to add another one. This situation arises when running
+ "strip"; the input binary already has the header. */
+ m = elf_tdata (abfd)->segment_map;
+ while (m && m->p_type != PT_ARM_EXIDX)
+ m = m->next;
+ if (!m)
+ {
+ m = bfd_zalloc (abfd, sizeof (struct elf_segment_map));
+ if (m == NULL)
+ return FALSE;
+ m->p_type = PT_ARM_EXIDX;
+ m->count = 1;
+ m->sections[0] = sec;
+
+ m->next = elf_tdata (abfd)->segment_map;
+ elf_tdata (abfd)->segment_map = m;
+ }
+ }
+
+ return TRUE;
+}
+
+/* We may add a PT_ARM_EXIDX program header. */
+
+static int
+elf32_arm_additional_program_headers (bfd *abfd,
+ struct bfd_link_info *info ATTRIBUTE_UNUSED)
+{
+ asection *sec;
+
+ sec = bfd_get_section_by_name (abfd, ".ARM.exidx");
+ if (sec != NULL && (sec->flags & SEC_LOAD) != 0)
+ return 1;
+ else
+ return 0;
+}
+
+/* We have two function types: STT_FUNC and STT_ARM_TFUNC. */
+static bfd_boolean
+elf32_arm_is_function_type (unsigned int type)
+{
+ return (type == STT_FUNC) || (type == STT_ARM_TFUNC);
+}
+
+/* We use this to override swap_symbol_in and swap_symbol_out. */
+const struct elf_size_info elf32_arm_size_info = {
+ sizeof (Elf32_External_Ehdr),
+ sizeof (Elf32_External_Phdr),
+ sizeof (Elf32_External_Shdr),
+ sizeof (Elf32_External_Rel),
+ sizeof (Elf32_External_Rela),
+ sizeof (Elf32_External_Sym),
+ sizeof (Elf32_External_Dyn),
+ sizeof (Elf_External_Note),
+ 4,
+ 1,
+ 32, 2,
+ ELFCLASS32, EV_CURRENT,
+ bfd_elf32_write_out_phdrs,
+ bfd_elf32_write_shdrs_and_ehdr,
+ bfd_elf32_write_relocs,
+ elf32_arm_swap_symbol_in,
+ elf32_arm_swap_symbol_out,
+ bfd_elf32_slurp_reloc_table,
+ bfd_elf32_slurp_symbol_table,
+ bfd_elf32_swap_dyn_in,
+ bfd_elf32_swap_dyn_out,
+ bfd_elf32_swap_reloc_in,
+ bfd_elf32_swap_reloc_out,
+ bfd_elf32_swap_reloca_in,
+ bfd_elf32_swap_reloca_out
+};
+
+#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 ELF_MINPAGESIZE 0x1000
+#define ELF_COMMONPAGESIZE 0x1000
+
+#define bfd_elf32_mkobject elf32_arm_mkobject
+
+#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_bfd_reloc_name_lookup elf32_arm_reloc_name_lookup
+#define bfd_elf32_find_nearest_line elf32_arm_find_nearest_line
+#define bfd_elf32_find_inliner_info elf32_arm_find_inliner_info
+#define bfd_elf32_new_section_hook elf32_arm_new_section_hook
+#define bfd_elf32_bfd_is_target_special_symbol elf32_arm_is_target_special_symbol
+#define bfd_elf32_close_and_cleanup elf32_arm_close_and_cleanup
+#define bfd_elf32_bfd_free_cached_info elf32_arm_bfd_free_cached_info
+
+#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_mark_extra_sections elf32_arm_gc_mark_extra_sections
+#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_write_section elf32_arm_write_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_init_index_section _bfd_elf_init_2_index_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_fake_sections elf32_arm_fake_sections
+#define elf_backend_section_from_shdr elf32_arm_section_from_shdr
+#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_symbol_processing elf32_arm_symbol_processing
+#define elf_backend_size_info elf32_arm_size_info
+#define elf_backend_modify_segment_map elf32_arm_modify_segment_map
+#define elf_backend_additional_program_headers \
+ elf32_arm_additional_program_headers
+#define elf_backend_output_arch_local_syms \
+ elf32_arm_output_arch_local_syms
+#define elf_backend_begin_write_processing \
+ elf32_arm_begin_write_processing
+#define elf_backend_is_function_type elf32_arm_is_function_type
+
+#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
+#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_got_header_size 12
+
+#undef elf_backend_obj_attrs_vendor
+#define elf_backend_obj_attrs_vendor "aeabi"
+#undef elf_backend_obj_attrs_section
+#define elf_backend_obj_attrs_section ".ARM.attributes"
+#undef elf_backend_obj_attrs_arg_type
+#define elf_backend_obj_attrs_arg_type elf32_arm_obj_attrs_arg_type
+#undef elf_backend_obj_attrs_section_type
+#define elf_backend_obj_attrs_section_type SHT_ARM_ATTRIBUTES
+
+#include "elf32-target.h"
+
+/* VxWorks Targets */
+
+#undef TARGET_LITTLE_SYM
+#define TARGET_LITTLE_SYM bfd_elf32_littlearm_vxworks_vec
+#undef TARGET_LITTLE_NAME
+#define TARGET_LITTLE_NAME "elf32-littlearm-vxworks"
+#undef TARGET_BIG_SYM
+#define TARGET_BIG_SYM bfd_elf32_bigarm_vxworks_vec
+#undef TARGET_BIG_NAME
+#define TARGET_BIG_NAME "elf32-bigarm-vxworks"
+
+/* Like elf32_arm_link_hash_table_create -- but overrides
+ appropriately for VxWorks. */
+static struct bfd_link_hash_table *
+elf32_arm_vxworks_link_hash_table_create (bfd *abfd)
+{
+ struct bfd_link_hash_table *ret;
+
+ ret = elf32_arm_link_hash_table_create (abfd);
+ if (ret)
+ {
+ struct elf32_arm_link_hash_table *htab
+ = (struct elf32_arm_link_hash_table *) ret;
+ htab->use_rel = 0;
+ htab->vxworks_p = 1;
+ }
+ return ret;
+}
+
+static void
+elf32_arm_vxworks_final_write_processing (bfd *abfd, bfd_boolean linker)
+{
+ elf32_arm_final_write_processing (abfd, linker);
+ elf_vxworks_final_write_processing (abfd, linker);
+}
+
+#undef elf32_bed
+#define elf32_bed elf32_arm_vxworks_bed
+
+#undef bfd_elf32_bfd_link_hash_table_create
+#define bfd_elf32_bfd_link_hash_table_create \
+ elf32_arm_vxworks_link_hash_table_create
+#undef elf_backend_add_symbol_hook
+#define elf_backend_add_symbol_hook \
+ elf_vxworks_add_symbol_hook
+#undef elf_backend_final_write_processing
+#define elf_backend_final_write_processing \
+ elf32_arm_vxworks_final_write_processing
+#undef elf_backend_emit_relocs
+#define elf_backend_emit_relocs \
+ elf_vxworks_emit_relocs
+
+#undef elf_backend_may_use_rel_p
+#define elf_backend_may_use_rel_p 0
+#undef elf_backend_may_use_rela_p
+#define elf_backend_may_use_rela_p 1
+#undef elf_backend_default_use_rela_p
+#define elf_backend_default_use_rela_p 1
+#undef elf_backend_want_plt_sym
+#define elf_backend_want_plt_sym 1
+#undef ELF_MAXPAGESIZE
+#define ELF_MAXPAGESIZE 0x1000
+
+#include "elf32-target.h"
+
+
+/* Symbian OS Targets */
+
+#undef TARGET_LITTLE_SYM
+#define TARGET_LITTLE_SYM bfd_elf32_littlearm_symbian_vec
+#undef TARGET_LITTLE_NAME
+#define TARGET_LITTLE_NAME "elf32-littlearm-symbian"
+#undef TARGET_BIG_SYM
+#define TARGET_BIG_SYM bfd_elf32_bigarm_symbian_vec
+#undef TARGET_BIG_NAME
+#define TARGET_BIG_NAME "elf32-bigarm-symbian"
+
+/* Like elf32_arm_link_hash_table_create -- but overrides
+ appropriately for Symbian OS. */
+static struct bfd_link_hash_table *
+elf32_arm_symbian_link_hash_table_create (bfd *abfd)
+{
+ struct bfd_link_hash_table *ret;
+
+ ret = elf32_arm_link_hash_table_create (abfd);
+ if (ret)
+ {
+ struct elf32_arm_link_hash_table *htab
+ = (struct elf32_arm_link_hash_table *)ret;
+ /* There is no PLT header for Symbian OS. */
+ htab->plt_header_size = 0;
+ /* The PLT entries are each three instructions. */
+ htab->plt_entry_size = 4 * NUM_ELEM (elf32_arm_symbian_plt_entry);
+ htab->symbian_p = 1;
+ /* Symbian uses armv5t or above, so use_blx is always true. */
+ htab->use_blx = 1;
+ htab->root.is_relocatable_executable = 1;
+ }
+ return ret;
+}
+
+static const struct bfd_elf_special_section
+elf32_arm_symbian_special_sections[] =
+{
+ /* In a BPABI executable, the dynamic linking sections do not go in
+ the loadable read-only segment. The post-linker may wish to
+ refer to these sections, but they are not part of the final
+ program image. */
+ { STRING_COMMA_LEN (".dynamic"), 0, SHT_DYNAMIC, 0 },
+ { STRING_COMMA_LEN (".dynstr"), 0, SHT_STRTAB, 0 },
+ { STRING_COMMA_LEN (".dynsym"), 0, SHT_DYNSYM, 0 },
+ { STRING_COMMA_LEN (".got"), 0, SHT_PROGBITS, 0 },
+ { STRING_COMMA_LEN (".hash"), 0, SHT_HASH, 0 },
+ /* These sections do not need to be writable as the SymbianOS
+ postlinker will arrange things so that no dynamic relocation is
+ required. */
+ { STRING_COMMA_LEN (".init_array"), 0, SHT_INIT_ARRAY, SHF_ALLOC },
+ { STRING_COMMA_LEN (".fini_array"), 0, SHT_FINI_ARRAY, SHF_ALLOC },
+ { STRING_COMMA_LEN (".preinit_array"), 0, SHT_PREINIT_ARRAY, SHF_ALLOC },
+ { NULL, 0, 0, 0, 0 }
+};
+
+static void
+elf32_arm_symbian_begin_write_processing (bfd *abfd,
+ struct bfd_link_info *link_info)
+{
+ /* BPABI objects are never loaded directly by an OS kernel; they are
+ processed by a postlinker first, into an OS-specific format. If
+ the D_PAGED bit is set on the file, BFD will align segments on
+ page boundaries, so that an OS can directly map the file. With
+ BPABI objects, that just results in wasted space. In addition,
+ because we clear the D_PAGED bit, map_sections_to_segments will
+ recognize that the program headers should not be mapped into any
+ loadable segment. */
+ abfd->flags &= ~D_PAGED;
+ elf32_arm_begin_write_processing(abfd, link_info);
+}
+
+static bfd_boolean
+elf32_arm_symbian_modify_segment_map (bfd *abfd,
+ struct bfd_link_info *info)
+{
+ struct elf_segment_map *m;
+ asection *dynsec;
+
+ /* BPABI shared libraries and executables should have a PT_DYNAMIC
+ segment. However, because the .dynamic section is not marked
+ with SEC_LOAD, the generic ELF code will not create such a
+ segment. */
+ dynsec = bfd_get_section_by_name (abfd, ".dynamic");
+ if (dynsec)
+ {
+ for (m = elf_tdata (abfd)->segment_map; m != NULL; m = m->next)
+ if (m->p_type == PT_DYNAMIC)
+ break;
+
+ if (m == NULL)
+ {
+ m = _bfd_elf_make_dynamic_segment (abfd, dynsec);
+ m->next = elf_tdata (abfd)->segment_map;
+ elf_tdata (abfd)->segment_map = m;
+ }
+ }
+
+ /* Also call the generic arm routine. */
+ return elf32_arm_modify_segment_map (abfd, info);
+}
+
+#undef elf32_bed
+#define elf32_bed elf32_arm_symbian_bed
+
+/* The dynamic sections are not allocated on SymbianOS; the postlinker
+ will process them and then discard them. */
+#undef ELF_DYNAMIC_SEC_FLAGS
+#define ELF_DYNAMIC_SEC_FLAGS \
+ (SEC_HAS_CONTENTS | SEC_IN_MEMORY | SEC_LINKER_CREATED)
+
+#undef bfd_elf32_bfd_link_hash_table_create
+#define bfd_elf32_bfd_link_hash_table_create \
+ elf32_arm_symbian_link_hash_table_create
+#undef elf_backend_add_symbol_hook
+
+#undef elf_backend_special_sections
+#define elf_backend_special_sections elf32_arm_symbian_special_sections
+
+#undef elf_backend_begin_write_processing
+#define elf_backend_begin_write_processing \
+ elf32_arm_symbian_begin_write_processing
+#undef elf_backend_final_write_processing
+#define elf_backend_final_write_processing \
+ elf32_arm_final_write_processing
+#undef elf_backend_emit_relocs
+
+#undef elf_backend_modify_segment_map
+#define elf_backend_modify_segment_map elf32_arm_symbian_modify_segment_map
+
+/* There is no .got section for BPABI objects, and hence no header. */
+#undef elf_backend_got_header_size
+#define elf_backend_got_header_size 0
+
+/* Similarly, there is no .got.plt section. */
+#undef elf_backend_want_got_plt
+#define elf_backend_want_got_plt 0
+
+#undef elf_backend_may_use_rel_p
+#define elf_backend_may_use_rel_p 1
+#undef elf_backend_may_use_rela_p
+#define elf_backend_may_use_rela_p 0
+#undef elf_backend_default_use_rela_p
+#define elf_backend_default_use_rela_p 0
+#undef elf_backend_want_plt_sym
+#define elf_backend_want_plt_sym 0
+#undef ELF_MAXPAGESIZE
+#define ELF_MAXPAGESIZE 0x8000
+
+#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-avr.h b/contrib/binutils/bfd/elf32-avr.h
new file mode 100644
index 0000000..4b9035f
--- /dev/null
+++ b/contrib/binutils/bfd/elf32-avr.h
@@ -0,0 +1,38 @@
+/* AVR-specific support for 32-bit ELF.
+ Copyright 2006 Free Software Foundation, Inc.
+
+ Written by Bjoern Haase <bjoern.m.haase@web.de>
+
+ 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., 51 Franklin Street - Fifth Floor,
+ Boston, MA 02110-1301, USA. */
+
+
+/* These four functions will be called from the ld back-end. */
+
+extern void
+elf32_avr_setup_params (struct bfd_link_info *, bfd *, asection *,
+ bfd_boolean, bfd_boolean, bfd_boolean,
+ bfd_vma, bfd_boolean);
+
+extern int
+elf32_avr_setup_section_lists (bfd *, struct bfd_link_info *);
+
+extern bfd_boolean
+elf32_avr_size_stubs (bfd *, struct bfd_link_info *, bfd_boolean);
+
+extern bfd_boolean
+elf32_avr_build_stubs (struct bfd_link_info *);
diff --git a/contrib/binutils/bfd/elf32-cr16.c b/contrib/binutils/bfd/elf32-cr16.c
new file mode 100644
index 0000000..197bff7
--- /dev/null
+++ b/contrib/binutils/bfd/elf32-cr16.c
@@ -0,0 +1,1433 @@
+/* BFD back-end for National Semiconductor's CR16 ELF
+ Copyright 2007 Free Software Foundation, Inc.
+ Written by M R Swami Reddy.
+
+ 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., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include "sysdep.h"
+#include "bfd.h"
+#include "bfdlink.h"
+#include "libbfd.h"
+#include "libiberty.h"
+#include "elf-bfd.h"
+#include "elf/cr16.h"
+
+/* cr16_reloc_map array maps BFD relocation enum into a CRGAS relocation type. */
+
+struct cr16_reloc_map
+{
+ bfd_reloc_code_real_type bfd_reloc_enum; /* BFD relocation enum. */
+ unsigned short cr16_reloc_type; /* CR16 relocation type. */
+};
+
+static const struct cr16_reloc_map cr16_reloc_map[R_CR16_MAX] =
+{
+ {BFD_RELOC_NONE, R_CR16_NONE},
+ {BFD_RELOC_CR16_NUM8, R_CR16_NUM8},
+ {BFD_RELOC_CR16_NUM16, R_CR16_NUM16},
+ {BFD_RELOC_CR16_NUM32, R_CR16_NUM32},
+ {BFD_RELOC_CR16_NUM32a, R_CR16_NUM32a},
+ {BFD_RELOC_CR16_REGREL4, R_CR16_REGREL4},
+ {BFD_RELOC_CR16_REGREL4a, R_CR16_REGREL4a},
+ {BFD_RELOC_CR16_REGREL14, R_CR16_REGREL14},
+ {BFD_RELOC_CR16_REGREL14a, R_CR16_REGREL14a},
+ {BFD_RELOC_CR16_REGREL16, R_CR16_REGREL16},
+ {BFD_RELOC_CR16_REGREL20, R_CR16_REGREL20},
+ {BFD_RELOC_CR16_REGREL20a, R_CR16_REGREL20a},
+ {BFD_RELOC_CR16_ABS20, R_CR16_ABS20},
+ {BFD_RELOC_CR16_ABS24, R_CR16_ABS24},
+ {BFD_RELOC_CR16_IMM4, R_CR16_IMM4},
+ {BFD_RELOC_CR16_IMM8, R_CR16_IMM8},
+ {BFD_RELOC_CR16_IMM16, R_CR16_IMM16},
+ {BFD_RELOC_CR16_IMM20, R_CR16_IMM20},
+ {BFD_RELOC_CR16_IMM24, R_CR16_IMM24},
+ {BFD_RELOC_CR16_IMM32, R_CR16_IMM32},
+ {BFD_RELOC_CR16_IMM32a, R_CR16_IMM32a},
+ {BFD_RELOC_CR16_DISP4, R_CR16_DISP4},
+ {BFD_RELOC_CR16_DISP8, R_CR16_DISP8},
+ {BFD_RELOC_CR16_DISP16, R_CR16_DISP16},
+ {BFD_RELOC_CR16_DISP24, R_CR16_DISP24},
+ {BFD_RELOC_CR16_DISP24a, R_CR16_DISP24a}
+};
+
+static reloc_howto_type cr16_elf_howto_table[] =
+{
+ HOWTO (R_CR16_NONE, /* type */
+ 0, /* rightshift */
+ 2, /* size */
+ 32, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_CR16_NONE", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ HOWTO (R_CR16_NUM8, /* type */
+ 0, /* rightshift */
+ 0, /* size */
+ 8, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_bitfield,/* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_CR16_NUM8", /* name */
+ FALSE, /* partial_inplace */
+ 0xff, /* src_mask */
+ 0xff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ HOWTO (R_CR16_NUM16, /* type */
+ 0, /* rightshift */
+ 1, /* size */
+ 16, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_bitfield,/* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_CR16_NUM16", /* name */
+ FALSE, /* partial_inplace */
+ 0xffff, /* src_mask */
+ 0xffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ HOWTO (R_CR16_NUM32, /* type */
+ 0, /* rightshift */
+ 2, /* size */
+ 32, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_bitfield,/* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_CR16_NUM32", /* name */
+ FALSE, /* partial_inplace */
+ 0xffffffff, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ HOWTO (R_CR16_NUM32a, /* type */
+ 1, /* rightshift */
+ 2, /* size */
+ 32, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_bitfield,/* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_CR16_NUM32a", /* name */
+ FALSE, /* partial_inplace */
+ 0xffffffff, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ HOWTO (R_CR16_REGREL4, /* type */
+ 0, /* rightshift */
+ 0, /* size */
+ 4, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_bitfield,/* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_CR16_REGREL4", /* name */
+ FALSE, /* partial_inplace */
+ 0xf, /* src_mask */
+ 0xf, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ HOWTO (R_CR16_REGREL4a, /* type */
+ 0, /* rightshift */
+ 0, /* size */
+ 4, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_bitfield,/* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_CR16_REGREL4a", /* name */
+ FALSE, /* partial_inplace */
+ 0xf, /* src_mask */
+ 0xf, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ HOWTO (R_CR16_REGREL14, /* type */
+ 0, /* rightshift */
+ 1, /* size */
+ 14, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_bitfield,/* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_CR16_REGREL14", /* name */
+ FALSE, /* partial_inplace */
+ 0x3fff, /* src_mask */
+ 0x3fff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ HOWTO (R_CR16_REGREL14a, /* type */
+ 0, /* rightshift */
+ 1, /* size */
+ 14, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_bitfield,/* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_CR16_REGREL14a", /* name */
+ FALSE, /* partial_inplace */
+ 0x3fff, /* src_mask */
+ 0x3fff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ HOWTO (R_CR16_REGREL16, /* type */
+ 0, /* rightshift */
+ 1, /* size */
+ 16, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_bitfield,/* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_CR16_REGREL16", /* name */
+ FALSE, /* partial_inplace */
+ 0xffff, /* src_mask */
+ 0xffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ HOWTO (R_CR16_REGREL20, /* type */
+ 0, /* rightshift */
+ 2, /* size */
+ 20, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_bitfield,/* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_CR16_REGREL20", /* name */
+ FALSE, /* partial_inplace */
+ 0xfffff, /* src_mask */
+ 0xfffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ HOWTO (R_CR16_REGREL20a, /* type */
+ 0, /* rightshift */
+ 2, /* size */
+ 20, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_bitfield,/* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_CR16_REGREL20a", /* name */
+ FALSE, /* partial_inplace */
+ 0xfffff, /* src_mask */
+ 0xfffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ HOWTO (R_CR16_ABS20, /* type */
+ 0, /* rightshift */
+ 2, /* size */
+ 20, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_bitfield,/* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_CR16_ABS20", /* name */
+ FALSE, /* partial_inplace */
+ 0xfffff, /* src_mask */
+ 0xfffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ HOWTO (R_CR16_ABS24, /* type */
+ 0, /* rightshift */
+ 2, /* size */
+ 24, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_bitfield,/* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_CR16_ABS24", /* name */
+ FALSE, /* partial_inplace */
+ 0xffffff, /* src_mask */
+ 0xffffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ HOWTO (R_CR16_IMM4, /* type */
+ 0, /* rightshift */
+ 0, /* size */
+ 4, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_bitfield,/* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_CR16_IMM4", /* name */
+ FALSE, /* partial_inplace */
+ 0xf, /* src_mask */
+ 0xf, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ HOWTO (R_CR16_IMM8, /* type */
+ 0, /* rightshift */
+ 0, /* size */
+ 8, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_bitfield,/* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_CR16_IMM8", /* name */
+ FALSE, /* partial_inplace */
+ 0xff, /* src_mask */
+ 0xff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ HOWTO (R_CR16_IMM16, /* type */
+ 0, /* rightshift */
+ 1, /* size */
+ 16, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_bitfield,/* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_CR16_IMM16", /* name */
+ FALSE, /* partial_inplace */
+ 0xffff, /* src_mask */
+ 0xffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ HOWTO (R_CR16_IMM20, /* type */
+ 0, /* rightshift */
+ 2, /* size */
+ 20, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_bitfield,/* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_CR16_IMM20", /* name */
+ FALSE, /* partial_inplace */
+ 0xfffff, /* src_mask */
+ 0xfffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ HOWTO (R_CR16_IMM24, /* type */
+ 0, /* rightshift */
+ 2, /* size */
+ 24, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_bitfield,/* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_CR16_IMM24", /* name */
+ FALSE, /* partial_inplace */
+ 0xffffff, /* src_mask */
+ 0xffffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ HOWTO (R_CR16_IMM32, /* type */
+ 0, /* rightshift */
+ 2, /* size */
+ 32, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_bitfield,/* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_CR16_IMM32", /* name */
+ FALSE, /* partial_inplace */
+ 0xffffffff, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ HOWTO (R_CR16_IMM32a, /* type */
+ 1, /* rightshift */
+ 2, /* size */
+ 32, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_bitfield,/* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_CR16_IMM32a", /* name */
+ FALSE, /* partial_inplace */
+ 0xffffffff, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ HOWTO (R_CR16_DISP4, /* type */
+ 1, /* rightshift */
+ 0, /* size (0 = byte, 1 = short, 2 = long) */
+ 4, /* bitsize */
+ TRUE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_unsigned, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_CR16_DISP4", /* name */
+ FALSE, /* partial_inplace */
+ 0xf, /* src_mask */
+ 0xf, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ HOWTO (R_CR16_DISP8, /* type */
+ 1, /* rightshift */
+ 0, /* size (0 = byte, 1 = short, 2 = long) */
+ 8, /* bitsize */
+ TRUE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_unsigned, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_CR16_DISP8", /* name */
+ FALSE, /* partial_inplace */
+ 0x1ff, /* src_mask */
+ 0x1ff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ HOWTO (R_CR16_DISP16, /* type */
+ 0, /* rightshift REVIITS: To sync with WinIDEA*/
+ 1, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ TRUE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_unsigned, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_CR16_DISP16", /* name */
+ FALSE, /* partial_inplace */
+ 0x1ffff, /* src_mask */
+ 0x1ffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+ /* REVISIT: DISP24 should be left-shift by 2 as per ISA doc
+ but its not done, to sync with WinIDEA and CR16 4.1 tools */
+ HOWTO (R_CR16_DISP24, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 24, /* bitsize */
+ TRUE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_unsigned, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_CR16_DISP24", /* name */
+ FALSE, /* partial_inplace */
+ 0x1ffffff, /* src_mask */
+ 0x1ffffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ HOWTO (R_CR16_DISP24a, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 24, /* bitsize */
+ TRUE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_unsigned, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_CR16_DISP24a", /* name */
+ FALSE, /* partial_inplace */
+ 0xffffff, /* src_mask */
+ 0xffffff, /* dst_mask */
+ FALSE) /* pcrel_offset */
+};
+
+/* Retrieve a howto ptr using a BFD reloc_code. */
+
+static reloc_howto_type *
+elf_cr16_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED,
+ bfd_reloc_code_real_type code)
+{
+ unsigned int i;
+
+ for (i = 0; i < R_CR16_MAX; i++)
+ if (code == cr16_reloc_map[i].bfd_reloc_enum)
+ return &cr16_elf_howto_table[cr16_reloc_map[i].cr16_reloc_type];
+
+ _bfd_error_handler ("Unsupported CR16 relocation type: 0x%x\n", code);
+ return NULL;
+}
+
+static reloc_howto_type *
+elf_cr16_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED,
+ const char *r_name)
+{
+ unsigned int i;
+
+ for (i = 0; ARRAY_SIZE (cr16_elf_howto_table); i++)
+ if (cr16_elf_howto_table[i].name != NULL
+ && strcasecmp (cr16_elf_howto_table[i].name, r_name) == 0)
+ return cr16_elf_howto_table + i;
+
+ return NULL;
+}
+
+/* Retrieve a howto ptr using an internal relocation entry. */
+
+static void
+elf_cr16_info_to_howto (bfd *abfd ATTRIBUTE_UNUSED, arelent *cache_ptr,
+ Elf_Internal_Rela *dst)
+{
+ unsigned int r_type = ELF32_R_TYPE (dst->r_info);
+
+ BFD_ASSERT (r_type < (unsigned int) R_CR16_MAX);
+ cache_ptr->howto = &cr16_elf_howto_table[r_type];
+}
+
+/* Perform a relocation as part of a final link. */
+
+static bfd_reloc_status_type
+cr16_elf_final_link_relocate (reloc_howto_type *howto,
+ bfd *input_bfd,
+ bfd *output_bfd ATTRIBUTE_UNUSED,
+ asection *input_section,
+ bfd_byte *contents,
+ bfd_vma offset,
+ bfd_vma Rvalue,
+ bfd_vma addend,
+ struct bfd_link_info *info ATTRIBUTE_UNUSED,
+ asection *sec ATTRIBUTE_UNUSED,
+ int is_local ATTRIBUTE_UNUSED)
+{
+ unsigned short r_type = howto->type;
+ bfd_byte *hit_data = contents + offset;
+ bfd_vma reloc_bits, check, Rvalue1;
+
+ switch (r_type)
+ {
+ case R_CR16_IMM4:
+ case R_CR16_IMM8:
+ case R_CR16_IMM16:
+ case R_CR16_IMM20:
+ case R_CR16_IMM32:
+ case R_CR16_IMM32a:
+ case R_CR16_REGREL4:
+ case R_CR16_REGREL4a:
+ case R_CR16_REGREL14:
+ case R_CR16_REGREL14a:
+ case R_CR16_REGREL16:
+ case R_CR16_REGREL20:
+ case R_CR16_ABS20:
+ case R_CR16_ABS24:
+ case R_CR16_DISP16:
+ case R_CR16_DISP24:
+ /* 'hit_data' is relative to the start of the instruction, not the
+ relocation offset. Advance it to account for the exact offset. */
+ hit_data += 2;
+ break;
+
+ case R_CR16_NONE:
+ return bfd_reloc_ok;
+ break;
+
+ case R_CR16_DISP4:
+ case R_CR16_DISP8:
+ case R_CR16_DISP24a:
+ /* We only care about the addend, where the difference between
+ expressions is kept. */
+ if (is_local) Rvalue -= -1;
+
+ default:
+ break;
+ }
+
+ if (howto->pc_relative)
+ {
+ /* Subtract the address of the section containing the location. */
+ Rvalue -= (input_section->output_section->vma
+ + input_section->output_offset);
+ /* Subtract the position of the location within the section. */
+ Rvalue -= offset;
+ }
+
+ /* Add in supplied addend. */
+ Rvalue += addend;
+
+ /* Complain if the bitfield overflows, whether it is considered
+ as signed or unsigned. */
+ check = Rvalue >> howto->rightshift;
+
+ /* Assumes two's complement. This expression avoids
+ overflow if howto->bitsize is the number of bits in
+ bfd_vma. */
+ reloc_bits = (((1 << (howto->bitsize - 1)) - 1) << 1) | 1;
+
+ if (((bfd_vma) check & ~reloc_bits) != 0
+ && (((bfd_vma) check & ~reloc_bits)
+ != (-(bfd_vma) 1 & ~reloc_bits)))
+ {
+ /* The above right shift is incorrect for a signed
+ value. See if turning on the upper bits fixes the
+ overflow. */
+ if (howto->rightshift && (bfd_signed_vma) Rvalue < 0)
+ {
+ check |= ((bfd_vma) - 1
+ & ~((bfd_vma) - 1
+ >> howto->rightshift));
+
+ if (((bfd_vma) check & ~reloc_bits)
+ != (-(bfd_vma) 1 & ~reloc_bits))
+ return bfd_reloc_overflow;
+ }
+ else
+ return bfd_reloc_overflow;
+ }
+
+ /* Drop unwanted bits from the value we are relocating to. */
+ Rvalue >>= (bfd_vma) howto->rightshift;
+
+ /* Apply dst_mask to select only relocatable part of the insn. */
+ Rvalue &= howto->dst_mask;
+
+ switch (howto->size)
+ {
+ case 0:
+ if ((r_type == R_CR16_IMM4)
+ || (r_type == R_CR16_DISP4)
+ || (r_type == R_CR16_DISP8))
+ {
+ Rvalue1 = bfd_get_16 (input_bfd, hit_data);
+ Rvalue = ((Rvalue1 & 0xf000) | ((Rvalue << 4) & 0xf00)
+ | (Rvalue1 & 0x00f0) | (Rvalue & 0xf));
+ bfd_put_16 (input_bfd, Rvalue, hit_data);
+ }
+ break;
+
+ case 1:
+ if (r_type == R_CR16_DISP16)
+ {
+ Rvalue |= (bfd_get_16 (input_bfd, hit_data));
+ Rvalue = ((Rvalue & 0xfffe) | ((Rvalue >> 16) & 0x1));
+
+ bfd_put_16 (input_bfd, Rvalue, hit_data);
+ }
+ break;
+
+ case 2:
+ if (r_type == R_CR16_ABS20)
+ {
+ Rvalue |= (((bfd_get_16 (input_bfd, hit_data) << 16)
+ | (bfd_get_16 (input_bfd, hit_data + 2)))
+ & ~howto->dst_mask);
+ Rvalue |= (bfd_get_16 (input_bfd, hit_data + 2) << 16);
+
+ /* Relocation on INSTRUCTIONS is different : Instructions are
+ word-addressable, that is, each word itself is arranged according
+ to little-endian convention, whereas the words are arranged with
+ respect to one another in BIG ENDIAN fashion.
+ When there is an immediate value that spans a word boundary,
+ it is split in a big-endian way with respect to the words. */
+ bfd_put_16 (input_bfd, (Rvalue) & 0xffff, hit_data);
+ bfd_put_16 (input_bfd, (Rvalue >> 16)& 0xffff, hit_data + 2);
+ }
+ else if (r_type == R_CR16_ABS24)
+ {
+ Rvalue = ((((Rvalue >> 20)& 0xf)
+ | (((Rvalue >> 16) & 0xf) << 8)
+ | (bfd_get_16 (input_bfd, hit_data)))
+ | ((Rvalue & 0xffff) << 16));
+
+ bfd_put_32 (input_bfd, Rvalue, hit_data);
+ }
+ else if (r_type == R_CR16_DISP24)
+ {
+ Rvalue = ((((Rvalue >> 20)& 0xf) | (((Rvalue >> 16) & 0xf)<<8)
+ | (bfd_get_16 (input_bfd, hit_data)))
+ | (((Rvalue & 0xfffE) | ((Rvalue >> 24) & 0x1)) << 16));
+
+ bfd_put_32 (input_bfd, Rvalue, hit_data);
+ }
+ else if ((r_type == R_CR16_IMM32) || (r_type == R_CR16_IMM32a))
+ {
+ Rvalue = (((Rvalue >> 16)& 0xffff)
+ | (bfd_get_16 (input_bfd, hit_data)))
+ | ((Rvalue & 0xffff) << 16);
+ bfd_put_32 (input_bfd, Rvalue, hit_data);
+ }
+ else if (r_type == R_CR16_DISP24a)
+ {
+ Rvalue = (((Rvalue & 0xfffffe) | (Rvalue >> 23)));
+ Rvalue = ((Rvalue >> 16) & 0xff) | ((Rvalue & 0xffff) << 16)
+ | (bfd_get_32 (input_bfd, hit_data));
+
+ bfd_put_32 (input_bfd, Rvalue, hit_data);
+ }
+ else if ((r_type == R_CR16_NUM32) || (r_type == R_CR16_NUM32a))
+ {
+ bfd_put_32 (input_bfd, Rvalue, hit_data);
+ }
+ break;
+
+ default:
+ return bfd_reloc_notsupported;
+ }
+
+ return bfd_reloc_ok;
+}
+
+/* Delete some bytes from a section while relaxing. */
+
+static bfd_boolean
+elf32_cr16_relax_delete_bytes (struct bfd_link_info *link_info, bfd *abfd,
+ asection *sec, bfd_vma addr, int count)
+{
+ Elf_Internal_Shdr *symtab_hdr;
+ unsigned int sec_shndx;
+ bfd_byte *contents;
+ Elf_Internal_Rela *irel, *irelend;
+ Elf_Internal_Rela *irelalign;
+ bfd_vma toaddr;
+ Elf_Internal_Sym *isym;
+ Elf_Internal_Sym *isymend;
+ struct elf_link_hash_entry **sym_hashes;
+ struct elf_link_hash_entry **end_hashes;
+ struct elf_link_hash_entry **start_hashes;
+ unsigned int symcount;
+
+ sec_shndx = _bfd_elf_section_from_bfd_section (abfd, sec);
+
+ contents = elf_section_data (sec)->this_hdr.contents;
+
+ /* The deletion must stop at the next ALIGN reloc for an aligment
+ power larger than the number of bytes we are deleting. */
+ irelalign = NULL;
+ toaddr = sec->size;
+
+ irel = elf_section_data (sec)->relocs;
+ irelend = irel + sec->reloc_count;
+
+ /* Actually delete the bytes. */
+ memmove (contents + addr, contents + addr + count,
+ (size_t) (toaddr - addr - count));
+ sec->size -= count;
+
+ /* Adjust all the relocs. */
+ for (irel = elf_section_data (sec)->relocs; irel < irelend; irel++)
+ /* Get the new reloc address. */
+ if ((irel->r_offset > addr && irel->r_offset < toaddr))
+ irel->r_offset -= count;
+
+ /* Adjust the local symbols defined in this section. */
+ symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
+ isym = (Elf_Internal_Sym *) symtab_hdr->contents;
+ for (isymend = isym + symtab_hdr->sh_info; isym < isymend; isym++)
+ {
+ if (isym->st_shndx == sec_shndx
+ && isym->st_value > addr
+ && isym->st_value < toaddr)
+ {
+ /* Adjust the addend of SWITCH relocations in this section,
+ which reference this local symbol. */
+ for (irel = elf_section_data (sec)->relocs; irel < irelend; irel++)
+ {
+ unsigned long r_symndx;
+ Elf_Internal_Sym *rsym;
+ bfd_vma addsym, subsym;
+
+ r_symndx = ELF32_R_SYM (irel->r_info);
+ rsym = (Elf_Internal_Sym *) symtab_hdr->contents + r_symndx;
+
+ /* Skip if not the local adjusted symbol. */
+ if (rsym != isym)
+ continue;
+
+ addsym = isym->st_value;
+ subsym = addsym - irel->r_addend;
+
+ /* Fix the addend only when -->> (addsym > addr >= subsym). */
+ if (subsym <= addr)
+ irel->r_addend -= count;
+ else
+ continue;
+ }
+
+ isym->st_value -= count;
+ }
+ }
+
+ /* Now adjust the global symbols defined in this section. */
+ symcount = (symtab_hdr->sh_size / sizeof (Elf32_External_Sym)
+ - symtab_hdr->sh_info);
+ sym_hashes = start_hashes = elf_sym_hashes (abfd);
+ end_hashes = sym_hashes + symcount;
+
+ for (; sym_hashes < end_hashes; sym_hashes++)
+ {
+ struct elf_link_hash_entry *sym_hash = *sym_hashes;
+
+ /* The '--wrap SYMBOL' option is causing a pain when the object file,
+ containing the definition of __wrap_SYMBOL, includes a direct
+ call to SYMBOL as well. Since both __wrap_SYMBOL and SYMBOL reference
+ the same symbol (which is __wrap_SYMBOL), but still exist as two
+ different symbols in 'sym_hashes', we don't want to adjust
+ the global symbol __wrap_SYMBOL twice.
+ This check is only relevant when symbols are being wrapped. */
+ if (link_info->wrap_hash != NULL)
+ {
+ struct elf_link_hash_entry **cur_sym_hashes;
+
+ /* Loop only over the symbols whom been already checked. */
+ for (cur_sym_hashes = start_hashes; cur_sym_hashes < sym_hashes;
+ cur_sym_hashes++)
+ /* If the current symbol is identical to 'sym_hash', that means
+ the symbol was already adjusted (or at least checked). */
+ if (*cur_sym_hashes == sym_hash)
+ break;
+
+ /* Don't adjust the symbol again. */
+ if (cur_sym_hashes < sym_hashes)
+ continue;
+ }
+
+ if ((sym_hash->root.type == bfd_link_hash_defined
+ || sym_hash->root.type == bfd_link_hash_defweak)
+ && sym_hash->root.u.def.section == sec
+ && sym_hash->root.u.def.value > addr
+ && sym_hash->root.u.def.value < toaddr)
+ sym_hash->root.u.def.value -= count;
+ }
+
+ return TRUE;
+}
+
+/* Relocate a CR16 ELF section. */
+
+static bfd_boolean
+elf32_cr16_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;
+ Elf_Internal_Rela *rel, *relend;
+
+ if (info->relocatable)
+ return TRUE;
+
+ 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;
+
+ r_symndx = ELF32_R_SYM (rel->r_info);
+ r_type = ELF32_R_TYPE (rel->r_info);
+ howto = cr16_elf_howto_table + (r_type);
+
+ h = NULL;
+ sym = NULL;
+ sec = NULL;
+ 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 unresolved_reloc, warned;
+
+ RELOC_FOR_GLOBAL_SYMBOL (info, input_bfd, input_section, rel,
+ r_symndx, symtab_hdr, sym_hashes,
+ h, sec, relocation,
+ unresolved_reloc, warned);
+ }
+
+ r = cr16_elf_final_link_relocate (howto, input_bfd, output_bfd,
+ input_section,
+ contents, rel->r_offset,
+ relocation, rel->r_addend,
+ info, sec, h == NULL);
+
+ if (r != bfd_reloc_ok)
+ {
+ const char *name;
+ const char *msg = NULL;
+
+ 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);
+ }
+
+ switch (r)
+ {
+ case bfd_reloc_overflow:
+ if (!((*info->callbacks->reloc_overflow)
+ (info, (h ? &h->root : NULL), 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;
+}
+
+/* This is a version of bfd_generic_get_relocated_section_contents
+ which uses elf32_cr16_relocate_section. */
+
+static bfd_byte *
+elf32_cr16_get_relocated_section_contents (bfd *output_bfd,
+ struct bfd_link_info *link_info,
+ struct bfd_link_order *link_order,
+ bfd_byte *data,
+ bfd_boolean relocatable,
+ asymbol **symbols)
+{
+ Elf_Internal_Shdr *symtab_hdr;
+ asection *input_section = link_order->u.indirect.section;
+ bfd *input_bfd = input_section->owner;
+ asection **sections = NULL;
+ Elf_Internal_Rela *internal_relocs = NULL;
+ Elf_Internal_Sym *isymbuf = NULL;
+
+ /* We only need to handle the case of relaxing, or of having a
+ particular set of section contents, specially. */
+ if (relocatable
+ || elf_section_data (input_section)->this_hdr.contents == NULL)
+ return bfd_generic_get_relocated_section_contents (output_bfd, link_info,
+ link_order, data,
+ relocatable,
+ symbols);
+
+ symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr;
+
+ memcpy (data, elf_section_data (input_section)->this_hdr.contents,
+ (size_t) input_section->size);
+
+ if ((input_section->flags & SEC_RELOC) != 0
+ && input_section->reloc_count > 0)
+ {
+ Elf_Internal_Sym *isym;
+ Elf_Internal_Sym *isymend;
+ asection **secpp;
+ bfd_size_type amt;
+
+ internal_relocs = _bfd_elf_link_read_relocs (input_bfd, input_section,
+ NULL, NULL, FALSE);
+ if (internal_relocs == NULL)
+ goto error_return;
+
+ if (symtab_hdr->sh_info != 0)
+ {
+ isymbuf = (Elf_Internal_Sym *) symtab_hdr->contents;
+ if (isymbuf == NULL)
+ isymbuf = bfd_elf_get_elf_syms (input_bfd, symtab_hdr,
+ symtab_hdr->sh_info, 0,
+ NULL, NULL, NULL);
+ if (isymbuf == NULL)
+ goto error_return;
+ }
+
+ amt = symtab_hdr->sh_info;
+ amt *= sizeof (asection *);
+ sections = bfd_malloc (amt);
+ if (sections == NULL && amt != 0)
+ goto error_return;
+
+ isymend = isymbuf + symtab_hdr->sh_info;
+ for (isym = isymbuf, secpp = sections; isym < isymend; ++isym, ++secpp)
+ {
+ asection *isec;
+
+ if (isym->st_shndx == SHN_UNDEF)
+ isec = bfd_und_section_ptr;
+ 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
+ isec = bfd_section_from_elf_index (input_bfd, isym->st_shndx);
+
+ *secpp = isec;
+ }
+
+ if (! elf32_cr16_relocate_section (output_bfd, link_info, input_bfd,
+ input_section, data, internal_relocs,
+ isymbuf, sections))
+ goto error_return;
+
+ if (sections != NULL)
+ free (sections);
+ if (isymbuf != NULL
+ && symtab_hdr->contents != (unsigned char *) isymbuf)
+ free (isymbuf);
+ if (elf_section_data (input_section)->relocs != internal_relocs)
+ free (internal_relocs);
+ }
+
+ return data;
+
+ error_return:
+ if (sections != NULL)
+ free (sections);
+ if (isymbuf != NULL
+ && symtab_hdr->contents != (unsigned char *) isymbuf)
+ free (isymbuf);
+ if (internal_relocs != NULL
+ && elf_section_data (input_section)->relocs != internal_relocs)
+ free (internal_relocs);
+ return NULL;
+}
+
+/* This function handles relaxing for the CR16.
+
+ There's quite a few relaxing opportunites available on the CR16:
+
+ * bcond:24 -> bcond:16 2 bytes
+ * bcond:16 -> bcond:8 2 bytes
+ * arithmetic imm32 -> arithmetic imm16 2 bytes
+
+ Symbol- and reloc-reading infrastructure copied from elf-m10200.c. */
+
+static bfd_boolean
+elf32_cr16_relax_section (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;
+ bfd_byte *contents = NULL;
+ Elf_Internal_Sym *isymbuf = NULL;
+
+ /* Assume nothing changes. */
+ *again = FALSE;
+
+ /* We don't have to do anything for a relocatable link, if
+ this section does not have relocs, or if this is not a
+ code section. */
+ if (link_info->relocatable
+ || (sec->flags & SEC_RELOC) == 0
+ || sec->reloc_count == 0
+ || (sec->flags & SEC_CODE) == 0)
+ return TRUE;
+
+ symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
+
+ /* Get a copy of the native relocations. */
+ internal_relocs = _bfd_elf_link_read_relocs (abfd, sec, NULL, NULL,
+ link_info->keep_memory);
+ if (internal_relocs == NULL)
+ goto error_return;
+
+ /* Walk through them looking for relaxing opportunities. */
+ irelend = internal_relocs + sec->reloc_count;
+ for (irel = internal_relocs; irel < irelend; irel++)
+ {
+ bfd_vma symval;
+
+ /* If this isn't something that can be relaxed, then ignore
+ this reloc. */
+ if (ELF32_R_TYPE (irel->r_info) != (int) R_CR16_DISP16
+ && ELF32_R_TYPE (irel->r_info) != (int) R_CR16_DISP24)
+ 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;
+ /* Go get them off disk. */
+ else if (!bfd_malloc_and_get_section (abfd, sec, &contents))
+ goto error_return;
+ }
+
+ /* Read this BFD's local 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 error_return;
+ }
+
+ /* 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;
+ asection *sym_sec;
+
+ isym = isymbuf + ELF32_R_SYM (irel->r_info);
+ if (isym->st_shndx == SHN_UNDEF)
+ sym_sec = bfd_und_section_ptr;
+ 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);
+ }
+ else
+ {
+ unsigned long indx;
+ struct elf_link_hash_entry *h;
+
+ /* An external symbol. */
+ indx = ELF32_R_SYM (irel->r_info) - symtab_hdr->sh_info;
+ h = elf_sym_hashes (abfd)[indx];
+ BFD_ASSERT (h != NULL);
+
+ if (h->root.type != bfd_link_hash_defined
+ && h->root.type != bfd_link_hash_defweak)
+ /* This appears to be a reference to an undefined
+ symbol. Just ignore it--it will be caught by the
+ regular reloc processing. */
+ continue;
+
+ symval = (h->root.u.def.value
+ + h->root.u.def.section->output_section->vma
+ + h->root.u.def.section->output_offset);
+ }
+
+ /* For simplicity of coding, we are going to modify the section
+ contents, the section relocs, and the BFD symbol table. We
+ must tell the rest of the code not to free up this
+ information. It would be possible to instead create a table
+ of changes which have to be made, as is done in coff-mips.c;
+ that would be more work, but would require less memory when
+ the linker is run. */
+
+ /* Try to turn a 24 branch/call into a 16bit relative
+ * branch/call. */
+ if (ELF32_R_TYPE (irel->r_info) == (int) R_CR16_DISP24)
+ {
+ bfd_vma value = symval;
+
+ /* Deal with pc-relative gunk. */
+ value -= (sec->output_section->vma + sec->output_offset);
+ value -= irel->r_offset;
+ value += irel->r_addend;
+
+ /* See if the value will fit in 16 bits, note the high value is
+ 0xfffe + 2 as the target will be two bytes closer if we are
+ able to relax. */
+ if ((long) value < 0x10000 && (long) value > -0x10002)
+ {
+ unsigned int code;
+
+ /* Get the opcode. */
+ code = (unsigned int) bfd_get_32 (abfd, contents + irel->r_offset);
+
+ /* Verify it's a 'bcond' and fix the opcode. */
+ if ((code & 0xffff) == 0x0010)
+ {
+ bfd_put_16 (abfd, 0x1800 | ((0xf & (code >>20))<<4), contents + irel->r_offset);
+ bfd_put_16 (abfd, value, contents + irel->r_offset+2);
+ }
+ else
+ continue;
+
+ /* Note that we've changed the relocs, section contents, etc. */
+ elf_section_data (sec)->relocs = internal_relocs;
+ elf_section_data (sec)->this_hdr.contents = contents;
+ symtab_hdr->contents = (unsigned char *) isymbuf;
+
+ /* Fix the relocation's type. */
+ irel->r_info = ELF32_R_INFO (ELF32_R_SYM (irel->r_info),
+ R_CR16_DISP16);
+
+ /* Delete two bytes of data. */
+ if (!elf32_cr16_relax_delete_bytes (link_info, abfd, sec,
+ irel->r_offset + 2, 2))
+ goto error_return;
+
+ /* That will change things, so, we should relax again.
+ Note that this is not required, and it may be slow. */
+ *again = TRUE;
+ }
+ }
+
+ /* Try to turn a 16bit pc-relative branch into an
+ 8bit pc-relative branch. */
+ if (ELF32_R_TYPE (irel->r_info) == (int) R_CR16_DISP16)
+ {
+ bfd_vma value = symval;
+
+ /* Deal with pc-relative gunk. */
+ value -= (sec->output_section->vma + sec->output_offset);
+ value -= irel->r_offset;
+ value += irel->r_addend;
+
+ /* See if the value will fit in 8 bits, note the high value is
+ 0xfc + 2 as the target will be two bytes closer if we are
+ able to relax. */
+ if ((long) value < 0xfe && (long) value > -0x100)
+ {
+ unsigned short code;
+
+ /* Get the opcode. */
+ code = (unsigned short) bfd_get_16 (abfd, contents + irel->r_offset);
+
+ /* Verify it's a 'bcond' opcode. */
+ if ((code & 0xff00) == 0x1800)
+ {
+ bfd_put_8 (abfd, 0x1 | ((0xf & (code>>4))<<4), contents + irel->r_offset);
+ bfd_put_8 (abfd, value, contents + irel->r_offset+2);
+ }
+ else
+ continue;
+
+ /* Note that we've changed the relocs, section contents, etc. */
+ elf_section_data (sec)->relocs = internal_relocs;
+ elf_section_data (sec)->this_hdr.contents = contents;
+ symtab_hdr->contents = (unsigned char *) isymbuf;
+
+ /* Fix the relocation's type. */
+ irel->r_info = ELF32_R_INFO (ELF32_R_SYM (irel->r_info),
+ R_CR16_DISP8);
+
+ /* Delete two bytes of data. */
+ if (!elf32_cr16_relax_delete_bytes (link_info, abfd, sec,
+ irel->r_offset + 2, 2))
+ goto error_return;
+
+ /* That will change things, so, we should relax again.
+ Note that this is not required, and it may be slow. */
+ *again = TRUE;
+ }
+ }
+
+#if 0 // REVISIT: To support IMM relaxation in CR16 target
+ /* Try to turn a 32bit immediate address into
+ a 20bit immediate address. */
+ if (ELF32_R_TYPE (irel->r_info) == (int) R_CR16_IMM32)
+ {
+ bfd_vma value = symval;
+
+ /* See if the value will fit in 20 bits. */
+ if ((long) value < 0x7ffff && (long) value > -0x80000)
+ {
+ unsigned short code;
+
+ /* Get the opcode. */
+ code = (unsigned short) bfd_get_16 (abfd, contents + irel->r_offset);
+
+ /* Verify it's a 'arithmetic double'. */
+ if ((code & 0xfff0) != 0x0070)
+ continue;
+
+ /* Note that we've changed the relocs, section contents, etc. */
+ elf_section_data (sec)->relocs = internal_relocs;
+ elf_section_data (sec)->this_hdr.contents = contents;
+ symtab_hdr->contents = (unsigned char *) isymbuf;
+
+ /* Fix the opcode. */
+ bfd_put_8 (abfd, (code & 0xff) - 0x10, contents + irel->r_offset);
+
+ /* Fix the relocation's type. */
+ irel->r_info = ELF32_R_INFO (ELF32_R_SYM (irel->r_info),
+ R_CR16_IMM20);
+
+ /* Delete two bytes of data. */
+ if (!elf32_cr16_relax_delete_bytes (link_info, abfd, sec,
+ irel->r_offset + 2, 2))
+ goto error_return;
+
+ /* That will change things, so, we should relax again.
+ Note that this is not required, and it may be slow. */
+ *again = TRUE;
+ }
+ }
+ /* Try to turn a 20bit/16bit immediate address into
+ a 4bit immediate address. */
+ if ((ELF32_R_TYPE (irel->r_info) == (int) R_CR16_IMM20)
+ || (ELF32_R_TYPE (irel->r_info) == (int) R_CR16_IMM16))
+ {
+ bfd_vma value = symval;
+
+ /* See if the value will fit in 4 bits. */
+ if ((long) value < 0x7 && (long) value > -0x8)
+ {
+ unsigned short code;
+
+ /* Get the opcode. */
+ code = (unsigned short) bfd_get_8 (abfd, contents + irel->r_offset);
+
+ /* Verify it's a 'arithmetic double'. */
+ if (((code & 0xff) != 0x50) || ((code & 0xff) != 0x45))
+ continue;
+
+ /* Note that we've changed the relocs, section contents, etc. */
+ elf_section_data (sec)->relocs = internal_relocs;
+ elf_section_data (sec)->this_hdr.contents = contents;
+ symtab_hdr->contents = (unsigned char *) isymbuf;
+
+ /* Fix the opcode. */
+ bfd_put_8 (abfd, (code & 0xff) - 0x10, contents + irel->r_offset);
+
+ /* Fix the relocation's type. */
+ irel->r_info = ELF32_R_INFO (ELF32_R_SYM (irel->r_info),
+ R_CR16_IMM4);
+
+ /* Delete two bytes of data. */
+ if (!elf32_cr16_relax_delete_bytes (link_info, abfd, sec,
+ irel->r_offset + 2, 2))
+ goto error_return;
+
+ /* That will change things, so, we should relax again.
+ Note that this is not required, and it may be slow. */
+ *again = TRUE;
+ }
+ }
+#endif
+ }
+
+ 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 (! 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 (internal_relocs != NULL
+ && elf_section_data (sec)->relocs != internal_relocs)
+ free (internal_relocs);
+
+ return TRUE;
+
+ error_return:
+ if (isymbuf != NULL
+ && symtab_hdr->contents != (unsigned char *) isymbuf)
+ 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 asection *
+elf32_cr16_gc_mark_hook (asection *sec,
+ struct bfd_link_info *info ATTRIBUTE_UNUSED,
+ Elf_Internal_Rela *rel ATTRIBUTE_UNUSED,
+ struct elf_link_hash_entry *h,
+ Elf_Internal_Sym *sym)
+{
+ if (h == NULL)
+ return bfd_section_from_elf_index (sec->owner, sym->st_shndx);
+
+ 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:
+ return NULL;
+ }
+}
+
+/* Update the got entry reference counts for the section being removed. */
+
+static bfd_boolean
+elf32_cr16_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)
+{
+ /* We don't support garbage collection of GOT and PLT relocs yet. */
+ return TRUE;
+}
+
+/* Definitions for setting CR16 target vector. */
+#define TARGET_LITTLE_SYM bfd_elf32_cr16_vec
+#define TARGET_LITTLE_NAME "elf32-cr16"
+#define ELF_ARCH bfd_arch_cr16
+#define ELF_MACHINE_CODE EM_CR16
+#define ELF_MAXPAGESIZE 0x1
+#define elf_symbol_leading_char '_'
+
+#define bfd_elf32_bfd_reloc_type_lookup elf_cr16_reloc_type_lookup
+#define bfd_elf32_bfd_reloc_name_lookup elf_cr16_reloc_name_lookup
+#define elf_info_to_howto elf_cr16_info_to_howto
+#define elf_info_to_howto_rel 0
+#define elf_backend_relocate_section elf32_cr16_relocate_section
+#define bfd_elf32_bfd_relax_section elf32_cr16_relax_section
+#define bfd_elf32_bfd_get_relocated_section_contents \
+ elf32_cr16_get_relocated_section_contents
+#define elf_backend_gc_mark_hook elf32_cr16_gc_mark_hook
+#define elf_backend_gc_sweep_hook elf32_cr16_gc_sweep_hook
+#define elf_backend_can_gc_sections 1
+#define elf_backend_rela_normal 1
+
+#include "elf32-target.h"
diff --git a/contrib/binutils/bfd/elf32-gen.c b/contrib/binutils/bfd/elf32-gen.c
index f2edf69..ef7d4e2 100644
--- a/contrib/binutils/bfd/elf32-gen.c
+++ b/contrib/binutils/bfd/elf32-gen.c
@@ -1,25 +1,25 @@
/* Generic support for 32-bit ELF
- Copyright 1993, 1995, 1998, 1999, 2001, 2002, 2004
+ Copyright 1993, 1995, 1998, 1999, 2001, 2002, 2004, 2005, 2007
Free Software Foundation, Inc.
-This file is part of BFD, the Binary File Descriptor library.
+ 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 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.
+ 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. */
+ 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., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
#include "elf-bfd.h"
@@ -41,53 +41,48 @@ static reloc_howto_type dummy =
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;
+elf_generic_info_to_howto (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;
+elf_generic_info_to_howto_rel (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;
+static void
+check_for_relocs (bfd * abfd, asection * o, void * failed)
{
- asection *o;
+ if ((o->flags & SEC_RELOC) != 0)
+ {
+ Elf_Internal_Ehdr *ehdrp;
- /* 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 (_("%B: Relocations in generic ELF (EM: %d)"),
+ abfd, ehdrp->e_machine);
- 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);
+ * (bfd_boolean *) failed = TRUE;
+ }
+}
- bfd_set_error (bfd_error_wrong_format);
- return FALSE;
- }
+static bfd_boolean
+elf32_generic_link_add_symbols (bfd *abfd, struct bfd_link_info *info)
+{
+ bfd_boolean failed = FALSE;
+
+ /* Check if there are any relocations. */
+ bfd_map_over_sections (abfd, check_for_relocs, & failed);
+ if (failed)
+ return FALSE;
return bfd_elf_link_add_symbols (abfd, info);
}
@@ -99,6 +94,7 @@ elf32_generic_link_add_symbols (abfd, info)
#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_reloc_name_lookup _bfd_norelocs_bfd_reloc_name_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
diff --git a/contrib/binutils/bfd/elf32-i386.c b/contrib/binutils/bfd/elf32-i386.c
index 7b173e4..50f918c 100644
--- a/contrib/binutils/bfd/elf32-i386.c
+++ b/contrib/binutils/bfd/elf32-i386.c
@@ -1,6 +1,6 @@
/* 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.
+ 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@@ -16,13 +16,14 @@
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. */
+ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "bfdlink.h"
#include "libbfd.h"
#include "elf-bfd.h"
+#include "elf-vxworks.h"
/* 386 uses REL relocations instead of RELA. */
#define USE_REL 1
@@ -125,9 +126,19 @@ static reloc_howto_type elf_howto_table[]=
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),
+ EMPTY_HOWTO (38),
+ HOWTO(R_386_TLS_GOTDESC, 0, 2, 32, FALSE, 0, complain_overflow_bitfield,
+ bfd_elf_generic_reloc, "R_386_TLS_GOTDESC",
+ TRUE, 0xffffffff, 0xffffffff, FALSE),
+ HOWTO(R_386_TLS_DESC_CALL, 0, 0, 0, FALSE, 0, complain_overflow_dont,
+ bfd_elf_generic_reloc, "R_386_TLS_DESC_CALL",
+ FALSE, 0, 0, FALSE),
+ HOWTO(R_386_TLS_DESC, 0, 2, 32, FALSE, 0, complain_overflow_bitfield,
+ bfd_elf_generic_reloc, "R_386_TLS_DESC",
+ TRUE, 0xffffffff, 0xffffffff, FALSE),
/* Another gap. */
-#define R_386_tls (R_386_TLS_TPOFF32 + 1 - R_386_tls_offset)
+#define R_386_tls (R_386_TLS_DESC + 1 - R_386_tls_offset)
#define R_386_vt_offset (R_386_GNU_VTINHERIT - R_386_tls)
/* GNU extension to record C++ vtable hierarchy. */
@@ -291,6 +302,18 @@ elf_i386_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED,
TRACE ("BFD_RELOC_386_TLS_TPOFF32");
return &elf_howto_table[R_386_TLS_TPOFF32 - R_386_tls_offset];
+ case BFD_RELOC_386_TLS_GOTDESC:
+ TRACE ("BFD_RELOC_386_TLS_GOTDESC");
+ return &elf_howto_table[R_386_TLS_GOTDESC - R_386_tls_offset];
+
+ case BFD_RELOC_386_TLS_DESC_CALL:
+ TRACE ("BFD_RELOC_386_TLS_DESC_CALL");
+ return &elf_howto_table[R_386_TLS_DESC_CALL - R_386_tls_offset];
+
+ case BFD_RELOC_386_TLS_DESC:
+ TRACE ("BFD_RELOC_386_TLS_DESC");
+ return &elf_howto_table[R_386_TLS_DESC - 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];
@@ -307,6 +330,20 @@ elf_i386_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED,
return 0;
}
+static reloc_howto_type *
+elf_i386_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED,
+ const char *r_name)
+{
+ unsigned int i;
+
+ for (i = 0; i < sizeof (elf_howto_table) / sizeof (elf_howto_table[0]); i++)
+ if (elf_howto_table[i].name != NULL
+ && strcasecmp (elf_howto_table[i].name, r_name) == 0)
+ return &elf_howto_table[i];
+
+ return NULL;
+}
+
static void
elf_i386_info_to_howto_rel (bfd *abfd ATTRIBUTE_UNUSED,
arelent *cache_ptr,
@@ -323,8 +360,8 @@ elf_i386_info_to_howto_rel (bfd *abfd ATTRIBUTE_UNUSED,
&& ((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);
+ (*_bfd_error_handler) (_("%B: invalid relocation type %d"),
+ abfd, (int) r_type);
indx = R_386_NONE;
}
cache_ptr->howto = &elf_howto_table[indx];
@@ -351,7 +388,7 @@ static bfd_boolean
elf_i386_grok_prstatus (bfd *abfd, Elf_Internal_Note *note)
{
int offset;
- size_t raw_size;
+ size_t size;
if (note->namesz == 8 && strcmp (note->namedata, "FreeBSD") == 0)
{
@@ -368,7 +405,7 @@ elf_i386_grok_prstatus (bfd *abfd, Elf_Internal_Note *note)
/* pr_reg */
offset = 28;
- raw_size = bfd_get_32 (abfd, note->descdata + 8);
+ size = bfd_get_32 (abfd, note->descdata + 8);
}
else
{
@@ -386,7 +423,7 @@ elf_i386_grok_prstatus (bfd *abfd, Elf_Internal_Note *note)
/* pr_reg */
offset = 72;
- raw_size = 68;
+ size = 68;
break;
}
@@ -394,7 +431,7 @@ elf_i386_grok_prstatus (bfd *abfd, Elf_Internal_Note *note)
/* Make a ".reg/999" section. */
return _bfd_elfcore_make_pseudosection (abfd, ".reg",
- raw_size, note->descpos + offset);
+ size, note->descpos + offset);
}
static bfd_boolean
@@ -471,15 +508,15 @@ elf_i386_grok_psinfo (bfd *abfd, Elf_Internal_Note *note)
#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. */
+ this. See the SVR4 ABI i386 supplement to see how this works.
+ Will be padded to PLT_ENTRY_SIZE with htab->plt0_pad_byte. */
-static const bfd_byte elf_i386_plt0_entry[PLT_ENTRY_SIZE] =
+static const bfd_byte elf_i386_plt0_entry[12] =
{
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. */
+ 0, 0, 0, 0 /* replaced with address of .got + 8. */
};
/* Subsequent entries in an absolute procedure linkage table look like
@@ -495,13 +532,13 @@ static const bfd_byte elf_i386_plt_entry[PLT_ENTRY_SIZE] =
0, 0, 0, 0 /* replaced with offset to start of .plt. */
};
-/* The first entry in a PIC procedure linkage table look like this. */
+/* The first entry in a PIC procedure linkage table look like this.
+ Will be padded to PLT_ENTRY_SIZE with htab->plt0_pad_byte. */
-static const bfd_byte elf_i386_pic_plt0_entry[PLT_ENTRY_SIZE] =
+static const bfd_byte elf_i386_pic_plt0_entry[12] =
{
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. */
+ 0xff, 0xa3, 8, 0, 0, 0 /* jmp *8(%ebx) */
};
/* Subsequent entries in a PIC procedure linkage table look like this. */
@@ -516,6 +553,12 @@ static const bfd_byte elf_i386_pic_plt_entry[PLT_ENTRY_SIZE] =
0, 0, 0, 0 /* replaced with offset to start of .plt. */
};
+/* On VxWorks, the .rel.plt.unloaded section has absolute relocations
+ for the PLTResolve stub and then for each PLT entry. */
+#define PLTRESOLVE_RELOCS_SHLIB 0
+#define PLTRESOLVE_RELOCS 2
+#define PLT_NON_JUMP_SLOT_RELOCS 2
+
/* 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
@@ -552,7 +595,20 @@ struct elf_i386_link_hash_entry
#define GOT_TLS_IE_POS 5
#define GOT_TLS_IE_NEG 6
#define GOT_TLS_IE_BOTH 7
+#define GOT_TLS_GDESC 8
+#define GOT_TLS_GD_BOTH_P(type) \
+ ((type) == (GOT_TLS_GD | GOT_TLS_GDESC))
+#define GOT_TLS_GD_P(type) \
+ ((type) == GOT_TLS_GD || GOT_TLS_GD_BOTH_P (type))
+#define GOT_TLS_GDESC_P(type) \
+ ((type) == GOT_TLS_GDESC || GOT_TLS_GD_BOTH_P (type))
+#define GOT_TLS_GD_ANY_P(type) \
+ (GOT_TLS_GD_P (type) || GOT_TLS_GDESC_P (type))
unsigned char tls_type;
+
+ /* Offset of the GOTPLT entry reserved for the TLS descriptor,
+ starting at the end of the jump table. */
+ bfd_vma tlsdesc_got;
};
#define elf_i386_hash_entry(ent) ((struct elf_i386_link_hash_entry *)(ent))
@@ -563,6 +619,9 @@ struct elf_i386_obj_tdata
/* tls_type for each local got entry. */
char *local_got_tls_type;
+
+ /* GOTPLT entries for TLS descriptors. */
+ bfd_vma *local_tlsdesc_gotent;
};
#define elf_i386_tdata(abfd) \
@@ -571,14 +630,20 @@ struct elf_i386_obj_tdata
#define elf_i386_local_got_tls_type(abfd) \
(elf_i386_tdata (abfd)->local_got_tls_type)
+#define elf_i386_local_tlsdesc_gotent(abfd) \
+ (elf_i386_tdata (abfd)->local_tlsdesc_gotent)
+
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;
+ {
+ 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 bfd_elf_mkobject (abfd);
}
/* i386 ELF linker hash table. */
@@ -596,11 +661,27 @@ struct elf_i386_link_hash_table
asection *sdynbss;
asection *srelbss;
+ /* The (unloaded but important) .rel.plt.unloaded section on VxWorks. */
+ asection *srelplt2;
+
+ /* True if the target system is VxWorks. */
+ int is_vxworks;
+
+ /* Value used to fill the last word of the first plt entry. */
+ bfd_byte plt0_pad_byte;
+
+ /* The index of the next unused R_386_TLS_DESC slot in .rel.plt. */
+ bfd_vma next_tls_desc_index;
+
union {
bfd_signed_vma refcount;
bfd_vma offset;
} tls_ldm_got;
+ /* The amount of space used by the reserved portion of the sgotplt
+ section, plus whatever space is used by the jump slots. */
+ bfd_vma sgotplt_jump_table_size;
+
/* Small local sym to section mapping cache. */
struct sym_sec_cache sym_sec;
};
@@ -610,6 +691,9 @@ struct elf_i386_link_hash_table
#define elf_i386_hash_table(p) \
((struct elf_i386_link_hash_table *) ((p)->hash))
+#define elf_i386_compute_jump_table_size(htab) \
+ ((htab)->next_tls_desc_index * 4)
+
/* Create an entry in an i386 ELF linker hash table. */
static struct bfd_hash_entry *
@@ -636,6 +720,7 @@ link_hash_newfunc (struct bfd_hash_entry *entry,
eh = (struct elf_i386_link_hash_entry *) entry;
eh->dyn_relocs = NULL;
eh->tls_type = GOT_UNKNOWN;
+ eh->tlsdesc_got = (bfd_vma) -1;
}
return entry;
@@ -653,7 +738,8 @@ elf_i386_link_hash_table_create (bfd *abfd)
if (ret == NULL)
return NULL;
- if (! _bfd_elf_link_hash_table_init (&ret->elf, abfd, link_hash_newfunc))
+ if (!_bfd_elf_link_hash_table_init (&ret->elf, abfd, link_hash_newfunc,
+ sizeof (struct elf_i386_link_hash_entry)))
{
free (ret);
return NULL;
@@ -667,7 +753,12 @@ elf_i386_link_hash_table_create (bfd *abfd)
ret->sdynbss = NULL;
ret->srelbss = NULL;
ret->tls_ldm_got.refcount = 0;
+ ret->next_tls_desc_index = 0;
+ ret->sgotplt_jump_table_size = 0;
ret->sym_sec.abfd = NULL;
+ ret->is_vxworks = 0;
+ ret->srelplt2 = NULL;
+ ret->plt0_pad_byte = 0;
return &ret->elf.root;
}
@@ -689,12 +780,13 @@ create_got_section (bfd *dynobj, struct bfd_link_info *info)
if (!htab->sgot || !htab->sgotplt)
abort ();
- htab->srelgot = bfd_make_section (dynobj, ".rel.got");
+ htab->srelgot = bfd_make_section_with_flags (dynobj, ".rel.got",
+ (SEC_ALLOC | SEC_LOAD
+ | SEC_HAS_CONTENTS
+ | SEC_IN_MEMORY
+ | SEC_LINKER_CREATED
+ | SEC_READONLY));
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;
@@ -726,13 +818,17 @@ elf_i386_create_dynamic_sections (bfd *dynobj, struct bfd_link_info *info)
|| (!info->shared && !htab->srelbss))
abort ();
+ if (htab->is_vxworks
+ && !elf_vxworks_create_dynamic_sections (dynobj, info, &htab->srelplt2))
+ return FALSE;
+
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,
+elf_i386_copy_indirect_symbol (struct bfd_link_info *info,
struct elf_link_hash_entry *dir,
struct elf_link_hash_entry *ind)
{
@@ -748,10 +844,7 @@ elf_i386_copy_indirect_symbol (const struct elf_backend_data *bed,
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
+ /* Add reloc counts against the indirect sym to the direct sym
list. Merge any entries against the same section. */
for (pp = &eind->dyn_relocs; (p = *pp) != NULL; )
{
@@ -784,18 +877,19 @@ elf_i386_copy_indirect_symbol (const struct elf_backend_data *bed,
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));
+ && dir->dynamic_adjusted)
+ {
+ /* If called to transfer flags for a weakdef during processing
+ of elf_adjust_dynamic_symbol, don't copy non_got_ref.
+ We clear it ourselves for ELIMINATE_COPY_RELOCS. */
+ dir->ref_dynamic |= ind->ref_dynamic;
+ dir->ref_regular |= ind->ref_regular;
+ dir->ref_regular_nonweak |= ind->ref_regular_nonweak;
+ dir->needs_plt |= ind->needs_plt;
+ dir->pointer_equality_needed |= ind->pointer_equality_needed;
+ }
else
- _bfd_elf_link_hash_copy_indirect (bed, dir, ind);
+ _bfd_elf_link_hash_copy_indirect (info, dir, ind);
}
static int
@@ -807,6 +901,8 @@ elf_i386_tls_transition (struct bfd_link_info *info, int r_type, int is_local)
switch (r_type)
{
case R_386_TLS_GD:
+ case R_386_TLS_GOTDESC:
+ case R_386_TLS_DESC_CALL:
case R_386_TLS_IE_32:
if (is_local)
return R_386_TLS_LE_32;
@@ -861,8 +957,8 @@ elf_i386_check_relocs (bfd *abfd,
if (r_symndx >= NUM_SHDR_ENTRIES (symtab_hdr))
{
- (*_bfd_error_handler) (_("%s: bad symbol index: %d"),
- bfd_archive_filename (abfd),
+ (*_bfd_error_handler) (_("%B: bad symbol index: %d"),
+ abfd,
r_symndx);
return FALSE;
}
@@ -870,7 +966,12 @@ elf_i386_check_relocs (bfd *abfd,
if (r_symndx < symtab_hdr->sh_info)
h = NULL;
else
- h = sym_hashes[r_symndx - symtab_hdr->sh_info];
+ {
+ h = sym_hashes[r_symndx - symtab_hdr->sh_info];
+ 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;
+ }
r_type = elf_i386_tls_transition (info, r_type, h == NULL);
@@ -893,7 +994,7 @@ elf_i386_check_relocs (bfd *abfd,
if (h == NULL)
continue;
- h->elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_PLT;
+ h->needs_plt = 1;
h->plt.refcount += 1;
break;
@@ -906,6 +1007,8 @@ elf_i386_check_relocs (bfd *abfd,
case R_386_GOT32:
case R_386_TLS_GD:
+ case R_386_TLS_GOTDESC:
+ case R_386_TLS_DESC_CALL:
/* This symbol requires a global offset table entry. */
{
int tls_type, old_tls_type;
@@ -915,6 +1018,9 @@ elf_i386_check_relocs (bfd *abfd,
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_GOTDESC:
+ case R_386_TLS_DESC_CALL:
+ tls_type = GOT_TLS_GDESC; break;
case R_386_TLS_IE_32:
if (ELF32_R_TYPE (rel->r_info) == r_type)
tls_type = GOT_TLS_IE_NEG;
@@ -944,13 +1050,16 @@ elf_i386_check_relocs (bfd *abfd,
bfd_size_type size;
size = symtab_hdr->sh_info;
- size *= (sizeof (bfd_signed_vma) + sizeof(char));
+ size *= (sizeof (bfd_signed_vma)
+ + sizeof (bfd_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_tlsdesc_gotent (abfd)
+ = (bfd_vma *) (local_got_refcounts + symtab_hdr->sh_info);
elf_i386_local_got_tls_type (abfd)
- = (char *) (local_got_refcounts + symtab_hdr->sh_info);
+ = (char *) (local_got_refcounts + 2 * symtab_hdr->sh_info);
}
local_got_refcounts[r_symndx] += 1;
old_tls_type = elf_i386_local_got_tls_type (abfd) [r_symndx];
@@ -961,17 +1070,20 @@ elf_i386_check_relocs (bfd *abfd,
/* 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
+ && (! GOT_TLS_GD_ANY_P (old_tls_type)
|| (tls_type & GOT_TLS_IE) == 0))
{
- if ((old_tls_type & GOT_TLS_IE) && tls_type == GOT_TLS_GD)
+ if ((old_tls_type & GOT_TLS_IE) && GOT_TLS_GD_ANY_P (tls_type))
tls_type = old_tls_type;
+ else if (GOT_TLS_GD_ANY_P (old_tls_type)
+ && GOT_TLS_GD_ANY_P (tls_type))
+ tls_type |= old_tls_type;
else
{
(*_bfd_error_handler)
- (_("%s: `%s' accessed both as normal and "
+ (_("%B: `%s' accessed both as normal and "
"thread local symbol"),
- bfd_archive_filename (abfd),
+ abfd,
h ? h->root.root.string : "<local>");
return FALSE;
}
@@ -1018,13 +1130,13 @@ elf_i386_check_relocs (bfd *abfd,
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;
+ h->non_got_ref = 1;
/* 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;
+ h->pointer_equality_needed = 1;
}
/* If we are creating a shared library, and this is a reloc
@@ -1052,17 +1164,15 @@ elf_i386_check_relocs (bfd *abfd,
&& (sec->flags & SEC_ALLOC) != 0
&& (r_type != R_386_PC32
|| (h != NULL
- && (! info->symbolic
+ && (! SYMBOLIC_BIND (info, h)
|| h->root.type == bfd_link_hash_defweak
- || (h->elf_link_hash_flags
- & ELF_LINK_HASH_DEF_REGULAR) == 0))))
+ || !h->def_regular))))
|| (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)))
+ || !h->def_regular)))
{
struct elf_i386_dyn_relocs *p;
struct elf_i386_dyn_relocs **head;
@@ -1081,13 +1191,13 @@ elf_i386_check_relocs (bfd *abfd,
if (name == NULL)
return FALSE;
- if (strncmp (name, ".rel", 4) != 0
+ if (! CONST_STRNEQ (name, ".rel")
|| strcmp (bfd_get_section_name (abfd, sec),
name + 4) != 0)
{
(*_bfd_error_handler)
- (_("%s: bad relocation section name `%s\'"),
- bfd_archive_filename (abfd), name);
+ (_("%B: bad relocation section name `%s\'"),
+ abfd, name);
}
if (htab->elf.dynobj == NULL)
@@ -1099,13 +1209,14 @@ elf_i386_check_relocs (bfd *abfd,
{
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;
+ sreloc = bfd_make_section_with_flags (dynobj,
+ name,
+ flags);
if (sreloc == NULL
- || ! bfd_set_section_flags (dynobj, sreloc, flags)
|| ! bfd_set_section_alignment (dynobj, sreloc, 2))
return FALSE;
}
@@ -1120,6 +1231,7 @@ elf_i386_check_relocs (bfd *abfd,
}
else
{
+ void **vpp;
/* Track dynamic relocs needed for local syms too.
We really need local syms available to do this
easily. Oh well. */
@@ -1130,8 +1242,8 @@ elf_i386_check_relocs (bfd *abfd,
if (s == NULL)
return FALSE;
- head = ((struct elf_i386_dyn_relocs **)
- &elf_section_data (s)->local_dynrel);
+ vpp = &elf_section_data (s)->local_dynrel;
+ head = (struct elf_i386_dyn_relocs **)vpp;
}
p = *head;
@@ -1181,38 +1293,20 @@ elf_i386_check_relocs (bfd *abfd,
static asection *
elf_i386_gc_mark_hook (asection *sec,
- struct bfd_link_info *info ATTRIBUTE_UNUSED,
+ struct bfd_link_info *info,
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;
+ switch (ELF32_R_TYPE (rel->r_info))
+ {
+ case R_386_GNU_VTINHERIT:
+ case R_386_GNU_VTENTRY:
+ return NULL;
+ }
+
+ return _bfd_elf_gc_mark_hook (sec, info, rel, h, sym);
}
/* Update the got entry reference counts for the section being removed. */
@@ -1249,6 +1343,9 @@ elf_i386_gc_sweep_hook (bfd *abfd,
struct elf_i386_dyn_relocs *p;
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;
eh = (struct elf_i386_link_hash_entry *) h;
for (pp = &eh->dyn_relocs; (p = *pp) != NULL; pp = &p->next)
@@ -1270,6 +1367,8 @@ elf_i386_gc_sweep_hook (bfd *abfd,
break;
case R_386_TLS_GD:
+ case R_386_TLS_GOTDESC:
+ case R_386_TLS_DESC_CALL:
case R_386_TLS_IE_32:
case R_386_TLS_IE:
case R_386_TLS_GOTIE:
@@ -1320,13 +1419,12 @@ elf_i386_adjust_dynamic_symbol (struct bfd_link_info *info,
{
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)
+ || h->needs_plt)
{
if (h->plt.refcount <= 0
|| SYMBOL_CALLS_LOCAL (info, h)
@@ -1339,7 +1437,7 @@ elf_i386_adjust_dynamic_symbol (struct bfd_link_info *info,
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;
+ h->needs_plt = 0;
}
return TRUE;
@@ -1355,16 +1453,14 @@ elf_i386_adjust_dynamic_symbol (struct bfd_link_info *info,
/* 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)
+ if (h->u.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;
+ BFD_ASSERT (h->u.weakdef->root.type == bfd_link_hash_defined
+ || h->u.weakdef->root.type == bfd_link_hash_defweak);
+ h->root.u.def.section = h->u.weakdef->root.u.def.section;
+ h->root.u.def.value = h->u.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));
+ h->non_got_ref = h->u.weakdef->non_got_ref;
return TRUE;
}
@@ -1380,17 +1476,23 @@ elf_i386_adjust_dynamic_symbol (struct bfd_link_info *info,
/* 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)
+ if (!h->non_got_ref)
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;
+ h->non_got_ref = 0;
return TRUE;
}
- if (ELIMINATE_COPY_RELOCS)
+ htab = elf_i386_hash_table (info);
+
+ /* If there aren't any dynamic relocs in read-only sections, then
+ we can keep the dynamic relocs and avoid the copy reloc. This
+ doesn't work on VxWorks, where we can not have dynamic relocations
+ (other than copy and jump slot relocations) in an executable. */
+ if (ELIMINATE_COPY_RELOCS && !htab->is_vxworks)
{
struct elf_i386_link_hash_entry * eh;
struct elf_i386_dyn_relocs *p;
@@ -1403,15 +1505,20 @@ elf_i386_adjust_dynamic_symbol (struct bfd_link_info *info,
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;
+ h->non_got_ref = 0;
return TRUE;
}
}
+ if (h->size == 0)
+ {
+ (*_bfd_error_handler) (_("dynamic variable `%s' is zero size"),
+ h->root.root.string);
+ 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
@@ -1422,40 +1529,18 @@ elf_i386_adjust_dynamic_symbol (struct bfd_link_info *info,
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;
+ htab->srelbss->size += sizeof (Elf32_External_Rel);
+ h->needs_copy = 1;
}
- /* 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;
+ return _bfd_elf_adjust_dynamic_copy (h, s);
}
/* Allocate space in .plt, .got and associated reloc sections for
@@ -1487,7 +1572,7 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf)
/* Make sure this symbol is output as a dynamic symbol.
Undefined weak syms won't yet be marked as dynamic. */
if (h->dynindx == -1
- && (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0)
+ && !h->forced_local)
{
if (! bfd_elf_link_record_dynamic_symbol (info, h))
return FALSE;
@@ -1500,10 +1585,10 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf)
/* If this is the first .plt entry, make room for the special
first entry. */
- if (s->_raw_size == 0)
- s->_raw_size += PLT_ENTRY_SIZE;
+ if (s->size == 0)
+ s->size += PLT_ENTRY_SIZE;
- h->plt.offset = s->_raw_size;
+ h->plt.offset = s->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
@@ -1511,34 +1596,58 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf)
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->def_regular)
{
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;
+ s->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;
+ htab->sgotplt->size += 4;
/* We also need to make an entry in the .rel.plt section. */
- htab->srelplt->_raw_size += sizeof (Elf32_External_Rel);
+ htab->srelplt->size += sizeof (Elf32_External_Rel);
+ htab->next_tls_desc_index++;
+
+ if (htab->is_vxworks && !info->shared)
+ {
+ /* VxWorks has a second set of relocations for each PLT entry
+ in executables. They go in a separate relocation section,
+ which is processed by the kernel loader. */
+
+ /* There are two relocations for the initial PLT entry: an
+ R_386_32 relocation for _GLOBAL_OFFSET_TABLE_ + 4 and an
+ R_386_32 relocation for _GLOBAL_OFFSET_TABLE_ + 8. */
+
+ if (h->plt.offset == PLT_ENTRY_SIZE)
+ htab->srelplt2->size += (sizeof (Elf32_External_Rel) * 2);
+
+ /* There are two extra relocations for each subsequent PLT entry:
+ an R_386_32 relocation for the GOT entry, and an R_386_32
+ relocation for the PLT entry. */
+
+ htab->srelplt2->size += (sizeof (Elf32_External_Rel) * 2);
+ }
}
else
{
h->plt.offset = (bfd_vma) -1;
- h->elf_link_hash_flags &= ~ELF_LINK_HASH_NEEDS_PLT;
+ h->needs_plt = 0;
}
}
else
{
h->plt.offset = (bfd_vma) -1;
- h->elf_link_hash_flags &= ~ELF_LINK_HASH_NEEDS_PLT;
+ h->needs_plt = 0;
}
+ eh = (struct elf_i386_link_hash_entry *) h;
+ eh->tlsdesc_got = (bfd_vma) -1;
+
/* 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
@@ -1555,18 +1664,29 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf)
/* Make sure this symbol is output as a dynamic symbol.
Undefined weak syms won't yet be marked as dynamic. */
if (h->dynindx == -1
- && (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0)
+ && !h->forced_local)
{
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;
+ if (GOT_TLS_GDESC_P (tls_type))
+ {
+ eh->tlsdesc_got = htab->sgotplt->size
+ - elf_i386_compute_jump_table_size (htab);
+ htab->sgotplt->size += 8;
+ h->got.offset = (bfd_vma) -2;
+ }
+ if (! GOT_TLS_GDESC_P (tls_type)
+ || GOT_TLS_GD_P (tls_type))
+ {
+ h->got.offset = s->size;
+ s->size += 4;
+ /* R_386_TLS_GD needs 2 consecutive GOT slots. */
+ if (GOT_TLS_GD_P (tls_type) || tls_type == GOT_TLS_IE_BOTH)
+ s->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,
@@ -1574,22 +1694,24 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf)
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)
+ htab->srelgot->size += 2 * sizeof (Elf32_External_Rel);
+ else if ((GOT_TLS_GD_P (tls_type) && 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)
+ htab->srelgot->size += sizeof (Elf32_External_Rel);
+ else if (GOT_TLS_GD_P (tls_type))
+ htab->srelgot->size += 2 * sizeof (Elf32_External_Rel);
+ else if (! GOT_TLS_GDESC_P (tls_type)
+ && (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);
+ htab->srelgot->size += sizeof (Elf32_External_Rel);
+ if (GOT_TLS_GDESC_P (tls_type))
+ htab->srelplt->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;
@@ -1624,9 +1746,21 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf)
/* Also discard relocs on undefined weak syms with non-default
visibility. */
- if (ELF_ST_VISIBILITY (h->other) != STV_DEFAULT
+ if (eh->dyn_relocs != NULL
&& h->root.type == bfd_link_hash_undefweak)
- eh->dyn_relocs = NULL;
+ {
+ if (ELF_ST_VISIBILITY (h->other) != STV_DEFAULT)
+ eh->dyn_relocs = NULL;
+
+ /* Make sure undefined weak symbols are output as a dynamic
+ symbol in PIEs. */
+ else if (h->dynindx == -1
+ && !h->forced_local)
+ {
+ if (! bfd_elf_link_record_dynamic_symbol (info, h))
+ return FALSE;
+ }
+ }
}
else if (ELIMINATE_COPY_RELOCS)
{
@@ -1634,9 +1768,9 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf)
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)
+ if (!h->non_got_ref
+ && ((h->def_dynamic
+ && !h->def_regular)
|| (htab->elf.dynamic_sections_created
&& (h->root.type == bfd_link_hash_undefweak
|| h->root.type == bfd_link_hash_undefined))))
@@ -1644,7 +1778,7 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf)
/* Make sure this symbol is output as a dynamic symbol.
Undefined weak syms won't yet be marked as dynamic. */
if (h->dynindx == -1
- && (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0)
+ && !h->forced_local)
{
if (! bfd_elf_link_record_dynamic_symbol (info, h))
return FALSE;
@@ -1665,7 +1799,7 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf)
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);
+ sreloc->size += p->count * sizeof (Elf32_External_Rel);
}
return TRUE;
@@ -1725,7 +1859,7 @@ elf_i386_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
s = bfd_get_section_by_name (dynobj, ".interp");
if (s == NULL)
abort ();
- s->_raw_size = sizeof ELF_DYNAMIC_INTERPRETER;
+ s->size = sizeof ELF_DYNAMIC_INTERPRETER;
s->contents = (unsigned char *) ELF_DYNAMIC_INTERPRETER;
}
}
@@ -1737,6 +1871,7 @@ elf_i386_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
bfd_signed_vma *local_got;
bfd_signed_vma *end_local_got;
char *local_tls_type;
+ bfd_vma *local_tlsdesc_gotent;
bfd_size_type locsymcount;
Elf_Internal_Shdr *symtab_hdr;
asection *srel;
@@ -1748,8 +1883,8 @@ elf_i386_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
{
struct elf_i386_dyn_relocs *p;
- for (p = *((struct elf_i386_dyn_relocs **)
- &elf_section_data (s)->local_dynrel);
+ for (p = ((struct elf_i386_dyn_relocs *)
+ elf_section_data (s)->local_dynrel);
p != NULL;
p = p->next)
{
@@ -1764,7 +1899,7 @@ elf_i386_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
else if (p->count != 0)
{
srel = elf_section_data (p->sec)->sreloc;
- srel->_raw_size += p->count * sizeof (Elf32_External_Rel);
+ srel->size += p->count * sizeof (Elf32_External_Rel);
if ((p->sec->output_section->flags & SEC_READONLY) != 0)
info->flags |= DF_TEXTREL;
}
@@ -1779,25 +1914,42 @@ elf_i386_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
locsymcount = symtab_hdr->sh_info;
end_local_got = local_got + locsymcount;
local_tls_type = elf_i386_local_got_tls_type (ibfd);
+ local_tlsdesc_gotent = elf_i386_local_tlsdesc_gotent (ibfd);
s = htab->sgot;
srel = htab->srelgot;
- for (; local_got < end_local_got; ++local_got, ++local_tls_type)
+ for (; local_got < end_local_got;
+ ++local_got, ++local_tls_type, ++local_tlsdesc_gotent)
{
+ *local_tlsdesc_gotent = (bfd_vma) -1;
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 (GOT_TLS_GDESC_P (*local_tls_type))
+ {
+ *local_tlsdesc_gotent = htab->sgotplt->size
+ - elf_i386_compute_jump_table_size (htab);
+ htab->sgotplt->size += 8;
+ *local_got = (bfd_vma) -2;
+ }
+ if (! GOT_TLS_GDESC_P (*local_tls_type)
+ || GOT_TLS_GD_P (*local_tls_type))
+ {
+ *local_got = s->size;
+ s->size += 4;
+ if (GOT_TLS_GD_P (*local_tls_type)
+ || *local_tls_type == GOT_TLS_IE_BOTH)
+ s->size += 4;
+ }
if (info->shared
- || *local_tls_type == GOT_TLS_GD
+ || GOT_TLS_GD_ANY_P (*local_tls_type)
|| (*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);
+ srel->size += 2 * sizeof (Elf32_External_Rel);
+ else if (GOT_TLS_GD_P (*local_tls_type)
+ || ! GOT_TLS_GDESC_P (*local_tls_type))
+ srel->size += sizeof (Elf32_External_Rel);
+ if (GOT_TLS_GDESC_P (*local_tls_type))
+ htab->srelplt->size += sizeof (Elf32_External_Rel);
}
}
else
@@ -1809,9 +1961,9 @@ elf_i386_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
{
/* 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);
+ htab->tls_ldm_got.offset = htab->sgot->size;
+ htab->sgot->size += 8;
+ htab->srelgot->size += sizeof (Elf32_External_Rel);
}
else
htab->tls_ldm_got.offset = -1;
@@ -1820,24 +1972,41 @@ elf_i386_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
sym dynamic relocs. */
elf_link_hash_traverse (&htab->elf, allocate_dynrelocs, (PTR) info);
+ /* For every jump slot reserved in the sgotplt, reloc_count is
+ incremented. However, when we reserve space for TLS descriptors,
+ it's not incremented, so in order to compute the space reserved
+ for them, it suffices to multiply the reloc count by the jump
+ slot size. */
+ if (htab->srelplt)
+ htab->sgotplt_jump_table_size = htab->next_tls_desc_index * 4;
+
/* 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)
{
+ bfd_boolean strip_section = TRUE;
+
if ((s->flags & SEC_LINKER_CREATED) == 0)
continue;
if (s == htab->splt
|| s == htab->sgot
- || s == htab->sgotplt)
+ || s == htab->sgotplt
+ || s == htab->sdynbss)
{
/* Strip this section if we don't need it; see the
comment below. */
+ /* We'd like to strip these sections if they aren't needed, but if
+ we've exported dynamic symbols from them we must leave them.
+ It's too late to tell BFD to get rid of the symbols. */
+
+ if (htab->elf.hplt != NULL)
+ strip_section = FALSE;
}
- else if (strncmp (bfd_get_section_name (dynobj, s), ".rel", 4) == 0)
+ else if (CONST_STRNEQ (bfd_get_section_name (dynobj, s), ".rel"))
{
- if (s->_raw_size != 0 && s != htab->srelplt)
+ if (s->size != 0 && s != htab->srelplt && s != htab->srelplt2)
relocs = TRUE;
/* We use the reloc_count field as a counter if we need
@@ -1850,7 +2019,7 @@ elf_i386_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
continue;
}
- if (s->_raw_size == 0)
+ if (s->size == 0)
{
/* If we don't need this section, strip it from the
output file. This is mostly to handle .rel.bss and
@@ -1861,17 +2030,20 @@ elf_i386_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
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);
+ if (strip_section)
+ s->flags |= SEC_EXCLUDE;
continue;
}
+ if ((s->flags & SEC_HAS_CONTENTS) == 0)
+ 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);
+ s->contents = bfd_zalloc (dynobj, s->size);
if (s->contents == NULL)
return FALSE;
}
@@ -1892,7 +2064,7 @@ elf_i386_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
return FALSE;
}
- if (htab->splt->_raw_size != 0)
+ if (htab->splt->size != 0)
{
if (!add_dynamic_entry (DT_PLTGOT, 0)
|| !add_dynamic_entry (DT_PLTRELSZ, 0)
@@ -1926,6 +2098,41 @@ elf_i386_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
return TRUE;
}
+static bfd_boolean
+elf_i386_always_size_sections (bfd *output_bfd,
+ struct bfd_link_info *info)
+{
+ asection *tls_sec = elf_hash_table (info)->tls_sec;
+
+ if (tls_sec)
+ {
+ struct elf_link_hash_entry *tlsbase;
+
+ tlsbase = elf_link_hash_lookup (elf_hash_table (info),
+ "_TLS_MODULE_BASE_",
+ FALSE, FALSE, FALSE);
+
+ if (tlsbase && tlsbase->type == STT_TLS)
+ {
+ struct bfd_link_hash_entry *bh = NULL;
+ const struct elf_backend_data *bed
+ = get_elf_backend_data (output_bfd);
+
+ if (!(_bfd_generic_link_add_one_symbol
+ (info, output_bfd, "_TLS_MODULE_BASE_", BSF_LOCAL,
+ tls_sec, 0, NULL, FALSE,
+ bed->collect, &bh)))
+ return FALSE;
+ tlsbase = (struct elf_link_hash_entry *)bh;
+ tlsbase->def_regular = 1;
+ tlsbase->other = STV_HIDDEN;
+ (*bed->elf_backend_hide_symbol) (info, tlsbase, TRUE);
+ }
+ }
+
+ 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. */
@@ -2003,6 +2210,7 @@ elf_i386_relocate_section (bfd *output_bfd,
Elf_Internal_Shdr *symtab_hdr;
struct elf_link_hash_entry **sym_hashes;
bfd_vma *local_got_offsets;
+ bfd_vma *local_tlsdesc_gotents;
Elf_Internal_Rela *rel;
Elf_Internal_Rela *relend;
@@ -2010,6 +2218,7 @@ elf_i386_relocate_section (bfd *output_bfd,
symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr;
sym_hashes = elf_sym_hashes (input_bfd);
local_got_offsets = elf_local_got_offsets (input_bfd);
+ local_tlsdesc_gotents = elf_i386_local_tlsdesc_gotent (input_bfd);
rel = relocs;
relend = relocs + input_section->reloc_count;
@@ -2021,7 +2230,7 @@ elf_i386_relocate_section (bfd *output_bfd,
struct elf_link_hash_entry *h;
Elf_Internal_Sym *sym;
asection *sec;
- bfd_vma off;
+ bfd_vma off, offplt;
bfd_vma relocation;
bfd_boolean unresolved_reloc;
bfd_reloc_status_type r;
@@ -2039,57 +2248,15 @@ elf_i386_relocate_section (bfd *output_bfd,
&& ((indx = r_type - R_386_tls_offset) - R_386_ext
>= R_386_tls - R_386_ext))
{
+ (*_bfd_error_handler)
+ (_("%B: unrecognized relocation (0x%x) in section `%A'"),
+ input_bfd, input_section, r_type);
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;
@@ -2101,10 +2268,12 @@ elf_i386_relocate_section (bfd *output_bfd,
relocation = (sec->output_section->vma
+ sec->output_offset
+ sym->st_value);
- if ((sec->flags & SEC_MERGE)
- && ELF_ST_TYPE (sym->st_info) == STT_SECTION)
+
+ if (ELF_ST_TYPE (sym->st_info) == STT_SECTION
+ && ((sec->flags & SEC_MERGE) != 0
+ || (info->relocatable
+ && sec->output_offset != 0)))
{
- asection *msec;
bfd_vma addend;
bfd_byte *where = contents + rel->r_offset;
@@ -2138,10 +2307,16 @@ elf_i386_relocate_section (bfd *output_bfd,
abort ();
}
- msec = sec;
- addend = _bfd_elf_rel_local_sym (output_bfd, sym, &msec, addend);
- addend -= relocation;
- addend += msec->output_section->vma + msec->output_offset;
+ if (info->relocatable)
+ addend += sec->output_offset;
+ else
+ {
+ asection *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)
{
@@ -2174,6 +2349,20 @@ elf_i386_relocate_section (bfd *output_bfd,
unresolved_reloc, warned);
}
+ if (sec != NULL && elf_discarded_section (sec))
+ {
+ /* For relocs against symbols from removed linkonce sections,
+ or sections discarded by a linker script, we just want the
+ section contents zeroed. Avoid any special processing. */
+ _bfd_clear_contents (howto, input_bfd, contents + rel->r_offset);
+ rel->r_info = 0;
+ rel->r_addend = 0;
+ continue;
+ }
+
+ if (info->relocatable)
+ continue;
+
switch (r_type)
{
case R_386_GOT32:
@@ -2261,24 +2450,46 @@ elf_i386_relocate_section (bfd *output_bfd,
if (off >= (bfd_vma) -2)
abort ();
- relocation = htab->sgot->output_offset + off;
+ relocation = htab->sgot->output_section->vma
+ + htab->sgot->output_offset + off
+ - htab->sgotplt->output_section->vma
+ - htab->sgotplt->output_offset;
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
+ /* Check to make sure it isn't a protected function symbol
+ for shared library since it may not be local when used
+ as function address. */
+ if (info->shared
+ && !info->executable
+ && h
+ && h->def_regular
+ && h->type == STT_FUNC
+ && ELF_ST_VISIBILITY (h->other) == STV_PROTECTED)
+ {
+ (*_bfd_error_handler)
+ (_("%B: relocation R_386_GOTOFF against protected function `%s' can not be used when making a shared object"),
+ input_bfd, h->root.root.string);
+ bfd_set_error (bfd_error_bad_value);
+ return FALSE;
+ }
+
+ /* Note that sgot is not involved in this
+ calculation. We always want the start of .got.plt. 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;
+ relocation -= htab->sgotplt->output_section->vma
+ + htab->sgotplt->output_offset;
break;
case R_386_GOTPC:
/* Use global offset table as symbol value. */
- relocation = htab->sgot->output_section->vma;
+ relocation = htab->sgotplt->output_section->vma
+ + htab->sgotplt->output_offset;
unresolved_reloc = FALSE;
break;
@@ -2308,11 +2519,7 @@ elf_i386_relocate_section (bfd *output_bfd,
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)
+ if ((input_section->flags & SEC_ALLOC) == 0)
break;
if ((info->shared
@@ -2325,11 +2532,9 @@ elf_i386_relocate_section (bfd *output_bfd,
&& !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->non_got_ref
+ && ((h->def_dynamic
+ && !h->def_regular)
|| h->root.type == bfd_link_hash_undefweak
|| h->root.type == bfd_link_hash_undefined)))
{
@@ -2361,9 +2566,8 @@ elf_i386_relocate_section (bfd *output_bfd,
&& h->dynindx != -1
&& (r_type == R_386_PC32
|| !info->shared
- || !info->symbolic
- || (h->elf_link_hash_flags
- & ELF_LINK_HASH_DEF_REGULAR) == 0))
+ || !SYMBOLIC_BIND (info, h)
+ || !h->def_regular))
outrel.r_info = ELF32_R_INFO (h->dynindx, r_type);
else
{
@@ -2410,6 +2614,8 @@ elf_i386_relocate_section (bfd *output_bfd,
/* Fall through */
case R_386_TLS_GD:
+ case R_386_TLS_GOTDESC:
+ case R_386_TLS_DESC_CALL:
case R_386_TLS_IE_32:
case R_386_TLS_GOTIE:
r_type = elf_i386_tls_transition (info, r_type, h == NULL);
@@ -2424,7 +2630,9 @@ elf_i386_relocate_section (bfd *output_bfd,
}
if (tls_type == GOT_TLS_IE)
tls_type = GOT_TLS_IE_NEG;
- if (r_type == R_386_TLS_GD)
+ if (r_type == R_386_TLS_GD
+ || r_type == R_386_TLS_GOTDESC
+ || r_type == R_386_TLS_DESC_CALL)
{
if (tls_type == GOT_TLS_IE_POS)
r_type = R_386_TLS_GOTIE;
@@ -2444,7 +2652,7 @@ elf_i386_relocate_section (bfd *output_bfd,
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 (rel->r_offset + 9 <= input_section->size);
BFD_ASSERT (bfd_get_8 (input_bfd,
contents + rel->r_offset + 4)
== 0xe8);
@@ -2470,7 +2678,7 @@ elf_i386_relocate_section (bfd *output_bfd,
else
{
BFD_ASSERT ((val & 0xf8) == 0x80 && (val & 7) != 4);
- if (rel->r_offset + 10 <= input_section->_raw_size
+ if (rel->r_offset + 10 <= input_section->size
&& bfd_get_8 (input_bfd,
contents + rel->r_offset + 9) == 0x90)
{
@@ -2498,6 +2706,64 @@ elf_i386_relocate_section (bfd *output_bfd,
rel++;
continue;
}
+ else if (ELF32_R_TYPE (rel->r_info) == R_386_TLS_GOTDESC)
+ {
+ /* GDesc -> LE transition.
+ It's originally something like:
+ leal x@tlsdesc(%ebx), %eax
+
+ leal x@ntpoff, %eax
+
+ Registers other than %eax may be set up here. */
+
+ unsigned int val, type;
+ bfd_vma roff;
+
+ /* First, make sure it's a leal adding ebx to a
+ 32-bit offset into any register, although it's
+ probably almost always going to be eax. */
+ roff = rel->r_offset;
+ BFD_ASSERT (roff >= 2);
+ type = bfd_get_8 (input_bfd, contents + roff - 2);
+ BFD_ASSERT (type == 0x8d);
+ val = bfd_get_8 (input_bfd, contents + roff - 1);
+ BFD_ASSERT ((val & 0xc7) == 0x83);
+ BFD_ASSERT (roff + 4 <= input_section->size);
+
+ /* Now modify the instruction as appropriate. */
+ /* aoliva FIXME: remove the above and xor the byte
+ below with 0x86. */
+ bfd_put_8 (output_bfd, val ^ 0x86,
+ contents + roff - 1);
+ bfd_put_32 (output_bfd, -tpoff (info, relocation),
+ contents + roff);
+ continue;
+ }
+ else if (ELF32_R_TYPE (rel->r_info) == R_386_TLS_DESC_CALL)
+ {
+ /* GDesc -> LE transition.
+ It's originally:
+ call *(%eax)
+ Turn it into:
+ nop; nop */
+
+ unsigned int val, type;
+ bfd_vma roff;
+
+ /* First, make sure it's a call *(%eax). */
+ roff = rel->r_offset;
+ BFD_ASSERT (roff + 2 <= input_section->size);
+ type = bfd_get_8 (input_bfd, contents + roff);
+ BFD_ASSERT (type == 0xff);
+ val = bfd_get_8 (input_bfd, contents + roff + 1);
+ BFD_ASSERT (val == 0x10);
+
+ /* Now modify the instruction as appropriate. Use
+ xchg %ax,%ax instead of 2 nops. */
+ bfd_put_8 (output_bfd, 0x66, contents + roff);
+ bfd_put_8 (output_bfd, 0x90, contents + roff + 1);
+ continue;
+ }
else if (ELF32_R_TYPE (rel->r_info) == R_386_TLS_IE)
{
unsigned int val, type;
@@ -2513,7 +2779,7 @@ elf_i386_relocate_section (bfd *output_bfd,
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);
+ BFD_ASSERT (rel->r_offset + 4 <= input_section->size);
if (val == 0xa1)
{
/* movl foo, %eax. */
@@ -2570,7 +2836,7 @@ elf_i386_relocate_section (bfd *output_bfd,
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 (rel->r_offset + 4 <= input_section->size);
BFD_ASSERT ((val & 0xc0) == 0x80 && (val & 7) != 4);
if (type == 0x8b)
{
@@ -2612,13 +2878,17 @@ elf_i386_relocate_section (bfd *output_bfd,
abort ();
if (h != NULL)
- off = h->got.offset;
+ {
+ off = h->got.offset;
+ offplt = elf_i386_hash_entry (h)->tlsdesc_got;
+ }
else
{
if (local_got_offsets == NULL)
abort ();
off = local_got_offsets[r_symndx];
+ offplt = local_tlsdesc_gotents[r_symndx];
}
if ((off & 1) != 0)
@@ -2628,35 +2898,77 @@ elf_i386_relocate_section (bfd *output_bfd,
Elf_Internal_Rela outrel;
bfd_byte *loc;
int dr_type, indx;
+ asection *sreloc;
if (htab->srelgot == NULL)
abort ();
+ indx = h && h->dynindx != -1 ? h->dynindx : 0;
+
+ if (GOT_TLS_GDESC_P (tls_type))
+ {
+ outrel.r_info = ELF32_R_INFO (indx, R_386_TLS_DESC);
+ BFD_ASSERT (htab->sgotplt_jump_table_size + offplt + 8
+ <= htab->sgotplt->size);
+ outrel.r_offset = (htab->sgotplt->output_section->vma
+ + htab->sgotplt->output_offset
+ + offplt
+ + htab->sgotplt_jump_table_size);
+ sreloc = htab->srelplt;
+ loc = sreloc->contents;
+ loc += (htab->next_tls_desc_index++
+ * sizeof (Elf32_External_Rel));
+ BFD_ASSERT (loc + sizeof (Elf32_External_Rel)
+ <= sreloc->contents + sreloc->size);
+ bfd_elf32_swap_reloc_out (output_bfd, &outrel, loc);
+ if (indx == 0)
+ {
+ BFD_ASSERT (! unresolved_reloc);
+ bfd_put_32 (output_bfd,
+ relocation - dtpoff_base (info),
+ htab->sgotplt->contents + offplt
+ + htab->sgotplt_jump_table_size + 4);
+ }
+ else
+ {
+ bfd_put_32 (output_bfd, 0,
+ htab->sgotplt->contents + offplt
+ + htab->sgotplt_jump_table_size + 4);
+ }
+ }
+
+ sreloc = htab->srelgot;
+
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)
+ if (GOT_TLS_GD_P (tls_type))
dr_type = R_386_TLS_DTPMOD32;
+ else if (GOT_TLS_GDESC_P (tls_type))
+ goto dr_done;
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
+ else if (dr_type != R_386_TLS_DESC)
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);
+
+ loc = sreloc->contents;
+ loc += sreloc->reloc_count++ * sizeof (Elf32_External_Rel);
+ BFD_ASSERT (loc + sizeof (Elf32_External_Rel)
+ <= sreloc->contents + sreloc->size);
bfd_elf32_swap_reloc_out (output_bfd, &outrel, loc);
- if (r_type == R_386_TLS_GD)
+ if (GOT_TLS_GD_P (tls_type))
{
if (indx == 0)
{
@@ -2672,8 +2984,10 @@ elf_i386_relocate_section (bfd *output_bfd,
outrel.r_info = ELF32_R_INFO (indx,
R_386_TLS_DTPOFF32);
outrel.r_offset += 4;
- htab->srelgot->reloc_count++;
+ sreloc->reloc_count++;
loc += sizeof (Elf32_External_Rel);
+ BFD_ASSERT (loc + sizeof (Elf32_External_Rel)
+ <= sreloc->contents + sreloc->size);
bfd_elf32_swap_reloc_out (output_bfd, &outrel, loc);
}
}
@@ -2684,30 +2998,41 @@ elf_i386_relocate_section (bfd *output_bfd,
htab->sgot->contents + off + 4);
outrel.r_info = ELF32_R_INFO (indx, R_386_TLS_TPOFF);
outrel.r_offset += 4;
- htab->srelgot->reloc_count++;
+ sreloc->reloc_count++;
loc += sizeof (Elf32_External_Rel);
bfd_elf32_swap_reloc_out (output_bfd, &outrel, loc);
}
+ dr_done:
if (h != NULL)
h->got.offset |= 1;
else
local_got_offsets[r_symndx] |= 1;
}
- if (off >= (bfd_vma) -2)
+ if (off >= (bfd_vma) -2
+ && ! GOT_TLS_GDESC_P (tls_type))
abort ();
- if (r_type == ELF32_R_TYPE (rel->r_info))
+ if (r_type == R_386_TLS_GOTDESC
+ || r_type == R_386_TLS_DESC_CALL)
+ {
+ relocation = htab->sgotplt_jump_table_size + offplt;
+ unresolved_reloc = FALSE;
+ }
+ else if (r_type == ELF32_R_TYPE (rel->r_info))
{
- relocation = htab->sgot->output_offset + off;
+ bfd_vma g_o_t = htab->sgotplt->output_section->vma
+ + htab->sgotplt->output_offset;
+ relocation = htab->sgot->output_section->vma
+ + htab->sgot->output_offset + off - g_o_t;
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;
+ relocation += g_o_t;
unresolved_reloc = FALSE;
}
- else
+ else if (ELF32_R_TYPE (rel->r_info) == R_386_TLS_GD)
{
unsigned int val, type;
bfd_vma roff;
@@ -2716,7 +3041,7 @@ elf_i386_relocate_section (bfd *output_bfd,
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 (rel->r_offset + 9 <= input_section->size);
BFD_ASSERT (bfd_get_8 (input_bfd, contents + rel->r_offset + 4)
== 0xe8);
BFD_ASSERT (rel + 1 < relend);
@@ -2740,7 +3065,7 @@ elf_i386_relocate_section (bfd *output_bfd,
/* 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 (rel->r_offset + 10 <= input_section->size);
BFD_ASSERT ((val & 0xf8) == 0x80 && (val & 7) != 4);
BFD_ASSERT (bfd_get_8 (input_bfd,
contents + rel->r_offset + 9)
@@ -2755,18 +3080,106 @@ elf_i386_relocate_section (bfd *output_bfd,
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,
+ if (tls_type == GOT_TLS_IE_POS)
+ contents[roff + 6] = 0x03;
+ bfd_put_32 (output_bfd,
+ htab->sgot->output_section->vma
+ + htab->sgot->output_offset + off
+ - htab->sgotplt->output_section->vma
+ - htab->sgotplt->output_offset,
contents + roff + 8);
/* Skip R_386_PLT32. */
rel++;
continue;
}
+ else if (ELF32_R_TYPE (rel->r_info) == R_386_TLS_GOTDESC)
+ {
+ /* GDesc -> IE transition.
+ It's originally something like:
+ leal x@tlsdesc(%ebx), %eax
+
+ Change it to:
+ movl x@gotntpoff(%ebx), %eax # before nop; nop
+ or:
+ movl x@gottpoff(%ebx), %eax # before negl %eax
+
+ Registers other than %eax may be set up here. */
+
+ unsigned int val, type;
+ bfd_vma roff;
+
+ /* First, make sure it's a leal adding ebx to a 32-bit
+ offset into any register, although it's probably
+ almost always going to be eax. */
+ roff = rel->r_offset;
+ BFD_ASSERT (roff >= 2);
+ type = bfd_get_8 (input_bfd, contents + roff - 2);
+ BFD_ASSERT (type == 0x8d);
+ val = bfd_get_8 (input_bfd, contents + roff - 1);
+ BFD_ASSERT ((val & 0xc7) == 0x83);
+ BFD_ASSERT (roff + 4 <= input_section->size);
+
+ /* Now modify the instruction as appropriate. */
+ /* To turn a leal into a movl in the form we use it, it
+ suffices to change the first byte from 0x8d to 0x8b.
+ aoliva FIXME: should we decide to keep the leal, all
+ we have to do is remove the statement below, and
+ adjust the relaxation of R_386_TLS_DESC_CALL. */
+ bfd_put_8 (output_bfd, 0x8b, contents + roff - 2);
+
+ if (tls_type == GOT_TLS_IE_BOTH)
+ off += 4;
+
+ bfd_put_32 (output_bfd,
+ htab->sgot->output_section->vma
+ + htab->sgot->output_offset + off
+ - htab->sgotplt->output_section->vma
+ - htab->sgotplt->output_offset,
+ contents + roff);
+ continue;
+ }
+ else if (ELF32_R_TYPE (rel->r_info) == R_386_TLS_DESC_CALL)
+ {
+ /* GDesc -> IE transition.
+ It's originally:
+ call *(%eax)
+
+ Change it to:
+ nop; nop
+ or
+ negl %eax
+ depending on how we transformed the TLS_GOTDESC above.
+ */
+
+ unsigned int val, type;
+ bfd_vma roff;
+
+ /* First, make sure it's a call *(%eax). */
+ roff = rel->r_offset;
+ BFD_ASSERT (roff + 2 <= input_section->size);
+ type = bfd_get_8 (input_bfd, contents + roff);
+ BFD_ASSERT (type == 0xff);
+ val = bfd_get_8 (input_bfd, contents + roff + 1);
+ BFD_ASSERT (val == 0x10);
+
+ /* Now modify the instruction as appropriate. */
+ if (tls_type != GOT_TLS_IE_NEG)
+ {
+ /* xchg %ax,%ax */
+ bfd_put_8 (output_bfd, 0x66, contents + roff);
+ bfd_put_8 (output_bfd, 0x90, contents + roff + 1);
+ }
+ else
+ {
+ /* negl %eax */
+ bfd_put_8 (output_bfd, 0xf7, contents + roff);
+ bfd_put_8 (output_bfd, 0xd8, contents + roff + 1);
+ }
+
+ continue;
+ }
+ else
+ BFD_ASSERT (FALSE);
break;
case R_386_TLS_LDM:
@@ -2784,7 +3197,7 @@ elf_i386_relocate_section (bfd *output_bfd,
== 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 (rel->r_offset + 9 <= input_section->size);
BFD_ASSERT (bfd_get_8 (input_bfd, contents + rel->r_offset + 4)
== 0xe8);
BFD_ASSERT (rel + 1 < relend);
@@ -2823,7 +3236,10 @@ elf_i386_relocate_section (bfd *output_bfd,
bfd_elf32_swap_reloc_out (output_bfd, &outrel, loc);
htab->tls_ldm_got.offset |= 1;
}
- relocation = htab->sgot->output_offset + off;
+ relocation = htab->sgot->output_section->vma
+ + htab->sgot->output_offset + off
+ - htab->sgotplt->output_section->vma
+ - htab->sgotplt->output_offset;
unresolved_reloc = FALSE;
break;
@@ -2883,13 +3299,14 @@ elf_i386_relocate_section (bfd *output_bfd,
not process them. */
if (unresolved_reloc
&& !((input_section->flags & SEC_DEBUGGING) != 0
- && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) != 0))
+ && h->def_dynamic))
{
(*_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),
+ (_("%B(%A+0x%lx): unresolvable %s relocation against symbol `%s'"),
+ input_bfd,
+ input_section,
(long) rel->r_offset,
+ howto->name,
h->root.root.string);
return FALSE;
}
@@ -2918,16 +3335,16 @@ elf_i386_relocate_section (bfd *output_bfd,
if (r == bfd_reloc_overflow)
{
if (! ((*info->callbacks->reloc_overflow)
- (info, name, howto->name, 0,
- input_bfd, input_section, rel->r_offset)))
+ (info, (h ? &h->root : NULL), 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),
+ (_("%B(%A+0x%lx): reloc against `%s': error %d"),
+ input_bfd, input_section,
(long) rel->r_offset, name, (int) r);
return FALSE;
}
@@ -2987,6 +3404,42 @@ elf_i386_finish_dynamic_symbol (bfd *output_bfd,
+ htab->sgotplt->output_offset
+ got_offset),
htab->splt->contents + h->plt.offset + 2);
+
+ if (htab->is_vxworks)
+ {
+ int s, k, reloc_index;
+
+ /* Create the R_386_32 relocation referencing the GOT
+ for this PLT entry. */
+
+ /* S: Current slot number (zero-based). */
+ s = (h->plt.offset - PLT_ENTRY_SIZE) / PLT_ENTRY_SIZE;
+ /* K: Number of relocations for PLTResolve. */
+ if (info->shared)
+ k = PLTRESOLVE_RELOCS_SHLIB;
+ else
+ k = PLTRESOLVE_RELOCS;
+ /* Skip the PLTresolve relocations, and the relocations for
+ the other PLT slots. */
+ reloc_index = k + s * PLT_NON_JUMP_SLOT_RELOCS;
+ loc = (htab->srelplt2->contents + reloc_index
+ * sizeof (Elf32_External_Rel));
+
+ rel.r_offset = (htab->splt->output_section->vma
+ + htab->splt->output_offset
+ + h->plt.offset + 2),
+ rel.r_info = ELF32_R_INFO (htab->elf.hgot->indx, R_386_32);
+ bfd_elf32_swap_reloc_out (output_bfd, &rel, loc);
+
+ /* Create the R_386_32 relocation referencing the beginning of
+ the PLT for this GOT entry. */
+ rel.r_offset = (htab->sgotplt->output_section->vma
+ + htab->sgotplt->output_offset
+ + got_offset);
+ rel.r_info = ELF32_R_INFO (htab->elf.hplt->indx, R_386_32);
+ bfd_elf32_swap_reloc_out (output_bfd, &rel,
+ loc + sizeof (Elf32_External_Rel));
+ }
}
else
{
@@ -3017,7 +3470,7 @@ elf_i386_finish_dynamic_symbol (bfd *output_bfd,
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)
+ if (!h->def_regular)
{
/* Mark the symbol as undefined, rather than as defined in
the .plt section. Leave the value if there were any
@@ -3028,13 +3481,13 @@ elf_i386_finish_dynamic_symbol (bfd *output_bfd,
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)
+ if (!h->pointer_equality_needed)
sym->st_value = 0;
}
}
if (h->got.offset != (bfd_vma) -1
- && elf_i386_hash_entry(h)->tls_type != GOT_TLS_GD
+ && ! GOT_TLS_GD_ANY_P (elf_i386_hash_entry(h)->tls_type)
&& (elf_i386_hash_entry(h)->tls_type & GOT_TLS_IE) == 0)
{
Elf_Internal_Rela rel;
@@ -3074,7 +3527,7 @@ elf_i386_finish_dynamic_symbol (bfd *output_bfd,
bfd_elf32_swap_reloc_out (output_bfd, &rel, loc);
}
- if ((h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_COPY) != 0)
+ if (h->needs_copy)
{
Elf_Internal_Rela rel;
bfd_byte *loc;
@@ -3096,9 +3549,11 @@ elf_i386_finish_dynamic_symbol (bfd *output_bfd,
bfd_elf32_swap_reloc_out (output_bfd, &rel, loc);
}
- /* Mark _DYNAMIC and _GLOBAL_OFFSET_TABLE_ as absolute. */
+ /* Mark _DYNAMIC and _GLOBAL_OFFSET_TABLE_ as absolute.
+ On VxWorks, the _GLOBAL_OFFSET_TABLE_ symbol is not absolute: it
+ is relative to the ".got" section. */
if (strcmp (h->root.root.string, "_DYNAMIC") == 0
- || strcmp (h->root.root.string, "_GLOBAL_OFFSET_TABLE_") == 0)
+ || (!htab->is_vxworks && h == htab->elf.hgot))
sym->st_shndx = SHN_ABS;
return TRUE;
@@ -3145,7 +3600,7 @@ elf_i386_finish_dynamic_sections (bfd *output_bfd,
abort ();
dyncon = (Elf32_External_Dyn *) sdyn->contents;
- dynconend = (Elf32_External_Dyn *) (sdyn->contents + sdyn->_raw_size);
+ dynconend = (Elf32_External_Dyn *) (sdyn->contents + sdyn->size);
for (; dyncon < dynconend; dyncon++)
{
Elf_Internal_Dyn dyn;
@@ -3159,7 +3614,8 @@ elf_i386_finish_dynamic_sections (bfd *output_bfd,
continue;
case DT_PLTGOT:
- dyn.d_un.d_ptr = htab->sgot->output_section->vma;
+ s = htab->sgotplt;
+ dyn.d_un.d_ptr = s->output_section->vma + s->output_offset;
break;
case DT_JMPREL:
@@ -3169,7 +3625,7 @@ elf_i386_finish_dynamic_sections (bfd *output_bfd,
case DT_PLTRELSZ:
s = htab->srelplt;
- dyn.d_un.d_val = s->_raw_size;
+ dyn.d_un.d_val = s->size;
break;
case DT_RELSZ:
@@ -3182,7 +3638,7 @@ elf_i386_finish_dynamic_sections (bfd *output_bfd,
s = htab->srelplt;
if (s == NULL)
continue;
- dyn.d_un.d_val -= s->_raw_size;
+ dyn.d_un.d_val -= s->size;
break;
case DT_REL:
@@ -3194,7 +3650,7 @@ elf_i386_finish_dynamic_sections (bfd *output_bfd,
continue;
if (dyn.d_un.d_ptr != s->output_section->vma + s->output_offset)
continue;
- dyn.d_un.d_ptr += s->_raw_size;
+ dyn.d_un.d_ptr += s->size;
break;
}
@@ -3202,15 +3658,23 @@ elf_i386_finish_dynamic_sections (bfd *output_bfd,
}
/* Fill in the first entry in the procedure linkage table. */
- if (htab->splt && htab->splt->_raw_size > 0)
+ if (htab->splt && htab->splt->size > 0)
{
if (info->shared)
- memcpy (htab->splt->contents,
- elf_i386_pic_plt0_entry, PLT_ENTRY_SIZE);
+ {
+ memcpy (htab->splt->contents, elf_i386_pic_plt0_entry,
+ sizeof (elf_i386_pic_plt0_entry));
+ memset (htab->splt->contents + sizeof (elf_i386_pic_plt0_entry),
+ htab->plt0_pad_byte,
+ PLT_ENTRY_SIZE - sizeof (elf_i386_pic_plt0_entry));
+ }
else
{
- memcpy (htab->splt->contents,
- elf_i386_plt0_entry, PLT_ENTRY_SIZE);
+ memcpy (htab->splt->contents, elf_i386_plt0_entry,
+ sizeof(elf_i386_plt0_entry));
+ memset (htab->splt->contents + sizeof (elf_i386_plt0_entry),
+ htab->plt0_pad_byte,
+ PLT_ENTRY_SIZE - sizeof (elf_i386_plt0_entry));
bfd_put_32 (output_bfd,
(htab->sgotplt->output_section->vma
+ htab->sgotplt->output_offset
@@ -3221,19 +3685,69 @@ elf_i386_finish_dynamic_sections (bfd *output_bfd,
+ htab->sgotplt->output_offset
+ 8),
htab->splt->contents + 8);
+
+ if (htab->is_vxworks)
+ {
+ Elf_Internal_Rela rel;
+
+ /* Generate a relocation for _GLOBAL_OFFSET_TABLE_ + 4.
+ On IA32 we use REL relocations so the addend goes in
+ the PLT directly. */
+ rel.r_offset = (htab->splt->output_section->vma
+ + htab->splt->output_offset
+ + 2);
+ rel.r_info = ELF32_R_INFO (htab->elf.hgot->indx, R_386_32);
+ bfd_elf32_swap_reloc_out (output_bfd, &rel,
+ htab->srelplt2->contents);
+ /* Generate a relocation for _GLOBAL_OFFSET_TABLE_ + 8. */
+ rel.r_offset = (htab->splt->output_section->vma
+ + htab->splt->output_offset
+ + 8);
+ rel.r_info = ELF32_R_INFO (htab->elf.hgot->indx, R_386_32);
+ bfd_elf32_swap_reloc_out (output_bfd, &rel,
+ htab->srelplt2->contents +
+ sizeof (Elf32_External_Rel));
+ }
}
/* 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;
+
+ /* Correct the .rel.plt.unloaded relocations. */
+ if (htab->is_vxworks && !info->shared)
+ {
+ int num_plts = (htab->splt->size / PLT_ENTRY_SIZE) - 1;
+ unsigned char *p;
+
+ p = htab->srelplt2->contents;
+ if (info->shared)
+ p += PLTRESOLVE_RELOCS_SHLIB * sizeof (Elf32_External_Rel);
+ else
+ p += PLTRESOLVE_RELOCS * sizeof (Elf32_External_Rel);
+
+ for (; num_plts; num_plts--)
+ {
+ Elf_Internal_Rela rel;
+ bfd_elf32_swap_reloc_in (output_bfd, p, &rel);
+ rel.r_info = ELF32_R_INFO (htab->elf.hgot->indx, R_386_32);
+ bfd_elf32_swap_reloc_out (output_bfd, &rel, p);
+ p += sizeof (Elf32_External_Rel);
+
+ bfd_elf32_swap_reloc_in (output_bfd, p, &rel);
+ rel.r_info = ELF32_R_INFO (htab->elf.hplt->indx, R_386_32);
+ bfd_elf32_swap_reloc_out (output_bfd, &rel, p);
+ p += sizeof (Elf32_External_Rel);
+ }
+ }
}
}
if (htab->sgotplt)
{
/* Fill in the first three entries in the global offset table. */
- if (htab->sgotplt->_raw_size > 0)
+ if (htab->sgotplt->size > 0)
{
bfd_put_32 (output_bfd,
(sdyn == NULL ? 0
@@ -3245,9 +3759,36 @@ elf_i386_finish_dynamic_sections (bfd *output_bfd,
elf_section_data (htab->sgotplt->output_section)->this_hdr.sh_entsize = 4;
}
+
+ if (htab->sgot && htab->sgot->size > 0)
+ elf_section_data (htab->sgot->output_section)->this_hdr.sh_entsize = 4;
+
return TRUE;
}
+/* Return address for Ith PLT stub in section PLT, for relocation REL
+ or (bfd_vma) -1 if it should not be included. */
+
+static bfd_vma
+elf_i386_plt_sym_val (bfd_vma i, const asection *plt,
+ const arelent *rel ATTRIBUTE_UNUSED)
+{
+ return plt->vma + (i + 1) * PLT_ENTRY_SIZE;
+}
+
+/* Return TRUE if symbol should be hashed in the `.gnu.hash' section. */
+
+static bfd_boolean
+elf_i386_hash_symbol (struct elf_link_hash_entry *h)
+{
+ if (h->plt.offset != (bfd_vma) -1
+ && !h->def_regular
+ && !h->pointer_equality_needed)
+ return FALSE;
+
+ return _bfd_elf_hash_symbol (h);
+}
+
#define TARGET_LITTLE_SYM bfd_elf32_i386_vec
#define TARGET_LITTLE_NAME "elf32-i386"
#define ELF_ARCH bfd_arch_i386
@@ -3270,8 +3811,10 @@ elf_i386_finish_dynamic_sections (bfd *output_bfd,
#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 bfd_elf32_bfd_reloc_name_lookup elf_i386_reloc_name_lookup
#define elf_backend_adjust_dynamic_symbol elf_i386_adjust_dynamic_symbol
+#define elf_backend_relocs_compatible _bfd_elf_relocs_compatible
#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
@@ -3285,6 +3828,11 @@ elf_i386_finish_dynamic_sections (bfd *output_bfd,
#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
+#define elf_backend_always_size_sections elf_i386_always_size_sections
+#define elf_backend_omit_section_dynsym \
+ ((bfd_boolean (*) (bfd *, struct bfd_link_info *, asection *)) bfd_true)
+#define elf_backend_plt_sym_val elf_i386_plt_sym_val
+#define elf_backend_hash_symbol elf_i386_hash_symbol
#include "elf32-target.h"
@@ -3294,6 +3842,8 @@ elf_i386_finish_dynamic_sections (bfd *output_bfd,
#define TARGET_LITTLE_SYM bfd_elf32_i386_freebsd_vec
#undef TARGET_LITTLE_NAME
#define TARGET_LITTLE_NAME "elf32-i386-freebsd"
+#undef ELF_OSABI
+#define ELF_OSABI ELFOSABI_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
@@ -3308,7 +3858,7 @@ elf_i386_post_process_headers (bfd *abfd,
i_ehdrp = elf_elfheader (abfd);
/* Put an ABI label supported by FreeBSD >= 4.1. */
- i_ehdrp->e_ident[EI_OSABI] = ELFOSABI_FREEBSD;
+ i_ehdrp->e_ident[EI_OSABI] = get_elf_backend_data (abfd)->elf_osabi;
#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);
@@ -3321,3 +3871,58 @@ elf_i386_post_process_headers (bfd *abfd,
#define elf32_bed elf32_i386_fbsd_bed
#include "elf32-target.h"
+
+/* VxWorks support. */
+
+#undef TARGET_LITTLE_SYM
+#define TARGET_LITTLE_SYM bfd_elf32_i386_vxworks_vec
+#undef TARGET_LITTLE_NAME
+#define TARGET_LITTLE_NAME "elf32-i386-vxworks"
+#undef ELF_OSABI
+
+/* Like elf_i386_link_hash_table_create but with tweaks for VxWorks. */
+
+static struct bfd_link_hash_table *
+elf_i386_vxworks_link_hash_table_create (bfd *abfd)
+{
+ struct bfd_link_hash_table *ret;
+ struct elf_i386_link_hash_table *htab;
+
+ ret = elf_i386_link_hash_table_create (abfd);
+ if (ret)
+ {
+ htab = (struct elf_i386_link_hash_table *) ret;
+ htab->is_vxworks = 1;
+ htab->plt0_pad_byte = 0x90;
+ }
+
+ return ret;
+}
+
+
+#undef elf_backend_relocs_compatible
+#undef elf_backend_post_process_headers
+#undef bfd_elf32_bfd_link_hash_table_create
+#define bfd_elf32_bfd_link_hash_table_create \
+ elf_i386_vxworks_link_hash_table_create
+#undef elf_backend_add_symbol_hook
+#define elf_backend_add_symbol_hook \
+ elf_vxworks_add_symbol_hook
+#undef elf_backend_link_output_symbol_hook
+#define elf_backend_link_output_symbol_hook \
+ elf_vxworks_link_output_symbol_hook
+#undef elf_backend_emit_relocs
+#define elf_backend_emit_relocs elf_vxworks_emit_relocs
+#undef elf_backend_final_write_processing
+#define elf_backend_final_write_processing \
+ elf_vxworks_final_write_processing
+
+/* On VxWorks, we emit relocations against _PROCEDURE_LINKAGE_TABLE_, so
+ define it. */
+#undef elf_backend_want_plt_sym
+#define elf_backend_want_plt_sym 1
+
+#undef elf32_bed
+#define elf32_bed elf32_i386_vxworks_bed
+
+#include "elf32-target.h"
diff --git a/contrib/binutils/bfd/elf32-mep.c b/contrib/binutils/bfd/elf32-mep.c
new file mode 100644
index 0000000..169da44
--- /dev/null
+++ b/contrib/binutils/bfd/elf32-mep.c
@@ -0,0 +1,959 @@
+/* MeP-specific support for 32-bit ELF.
+ Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007
+ 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include "sysdep.h"
+#include "bfd.h"
+#include "libbfd.h"
+#include "elf-bfd.h"
+#include "elf/mep.h"
+#include "libiberty.h"
+
+/* Forward declarations. */
+
+/* Private relocation functions. */
+
+#define MEPREL(type, size, bits, right, left, pcrel, overflow, mask) \
+ {(unsigned)type, right, size, bits, pcrel, left, overflow, mep_reloc, #type, FALSE, 0, mask, 0 }
+
+#define N complain_overflow_dont
+#define S complain_overflow_signed
+#define U complain_overflow_unsigned
+
+static bfd_reloc_status_type mep_reloc (bfd *, arelent *, struct bfd_symbol *,
+ void *, asection *, bfd *, char **);
+
+static reloc_howto_type mep_elf_howto_table [] =
+{
+ /* type, size, bits, leftshift, rightshift, pcrel, OD/OS/OU, mask. */
+ MEPREL (R_MEP_NONE, 0, 0, 0, 0, 0, N, 0),
+ MEPREL (R_RELC, 0, 0, 0, 0, 0, N, 0),
+ /* MEPRELOC:HOWTO */
+ /* This section generated from bfd/mep-relocs.pl from include/elf/mep.h. */
+ MEPREL (R_MEP_8, 0, 8, 0, 0, 0, U, 0xff),
+ MEPREL (R_MEP_16, 1, 16, 0, 0, 0, U, 0xffff),
+ MEPREL (R_MEP_32, 2, 32, 0, 0, 0, U, 0xffffffff),
+ MEPREL (R_MEP_PCREL8A2, 1, 8, 1, 1, 1, S, 0x00fe),
+ MEPREL (R_MEP_PCREL12A2,1, 12, 1, 1, 1, S, 0x0ffe),
+ MEPREL (R_MEP_PCREL17A2,2, 17, 0, 1, 1, S, 0x0000ffff),
+ MEPREL (R_MEP_PCREL24A2,2, 24, 0, 1, 1, S, 0x07f0ffff),
+ MEPREL (R_MEP_PCABS24A2,2, 24, 0, 1, 0, U, 0x07f0ffff),
+ MEPREL (R_MEP_LOW16, 2, 16, 0, 0, 0, N, 0x0000ffff),
+ MEPREL (R_MEP_HI16U, 2, 32, 0,16, 0, N, 0x0000ffff),
+ MEPREL (R_MEP_HI16S, 2, 32, 0,16, 0, N, 0x0000ffff),
+ MEPREL (R_MEP_GPREL, 2, 16, 0, 0, 0, S, 0x0000ffff),
+ MEPREL (R_MEP_TPREL, 2, 16, 0, 0, 0, S, 0x0000ffff),
+ MEPREL (R_MEP_TPREL7, 1, 7, 0, 0, 0, U, 0x007f),
+ MEPREL (R_MEP_TPREL7A2, 1, 7, 1, 1, 0, U, 0x007e),
+ MEPREL (R_MEP_TPREL7A4, 1, 7, 2, 2, 0, U, 0x007c),
+ MEPREL (R_MEP_UIMM24, 2, 24, 0, 0, 0, U, 0x00ffffff),
+ MEPREL (R_MEP_ADDR24A4, 2, 24, 0, 2, 0, U, 0x00fcffff),
+ MEPREL (R_MEP_GNU_VTINHERIT,1, 0,16,32, 0, N, 0x0000),
+ MEPREL (R_MEP_GNU_VTENTRY,1, 0,16,32, 0, N, 0x0000),
+ /* MEPRELOC:END */
+};
+
+#define VALID_MEP_RELOC(N) ((N) >= 0 \
+ && (N) < ARRAY_SIZE (mep_elf_howto_table)
+
+#undef N
+#undef S
+#undef U
+
+static bfd_reloc_status_type
+mep_reloc
+ (bfd * abfd ATTRIBUTE_UNUSED,
+ arelent * reloc_entry ATTRIBUTE_UNUSED,
+ struct bfd_symbol * symbol ATTRIBUTE_UNUSED,
+ void * data ATTRIBUTE_UNUSED,
+ asection * input_section ATTRIBUTE_UNUSED,
+ bfd * output_bfd ATTRIBUTE_UNUSED,
+ char ** error_message ATTRIBUTE_UNUSED)
+{
+ return bfd_reloc_ok;
+}
+
+
+
+#define BFD_RELOC_MEP_NONE BFD_RELOC_NONE
+#if defined (__STDC__) || defined (ALMOST_STDC) || defined (HAVE_STRINGIZE)
+#define MAP(n) case BFD_RELOC_MEP_##n: type = R_MEP_##n; break
+#else
+#define MAP(n) case BFD_RELOC_MEP_/**/n: type = R_MEP_/**/n; break
+#endif
+
+static reloc_howto_type *
+mep_reloc_type_lookup
+ (bfd * abfd ATTRIBUTE_UNUSED,
+ bfd_reloc_code_real_type code)
+{
+ unsigned int type = 0;
+
+ switch (code)
+ {
+ MAP(NONE);
+ case BFD_RELOC_8:
+ type = R_MEP_8;
+ break;
+ case BFD_RELOC_16:
+ type = R_MEP_16;
+ break;
+ case BFD_RELOC_32:
+ type = R_MEP_32;
+ break;
+ case BFD_RELOC_VTABLE_ENTRY:
+ type = R_MEP_GNU_VTENTRY;
+ break;
+ case BFD_RELOC_VTABLE_INHERIT:
+ type = R_MEP_GNU_VTINHERIT;
+ break;
+ case BFD_RELOC_RELC:
+ type = R_RELC;
+ break;
+
+ /* MEPRELOC:MAP */
+ /* This section generated from bfd/mep-relocs.pl from include/elf/mep.h. */
+ MAP(8);
+ MAP(16);
+ MAP(32);
+ MAP(PCREL8A2);
+ MAP(PCREL12A2);
+ MAP(PCREL17A2);
+ MAP(PCREL24A2);
+ MAP(PCABS24A2);
+ MAP(LOW16);
+ MAP(HI16U);
+ MAP(HI16S);
+ MAP(GPREL);
+ MAP(TPREL);
+ MAP(TPREL7);
+ MAP(TPREL7A2);
+ MAP(TPREL7A4);
+ MAP(UIMM24);
+ MAP(ADDR24A4);
+ MAP(GNU_VTINHERIT);
+ MAP(GNU_VTENTRY);
+ /* MEPRELOC:END */
+
+ default:
+ /* Pacify gcc -Wall. */
+ fprintf (stderr, "mep: no reloc for code %d\n", code);
+ return NULL;
+ }
+
+ if (mep_elf_howto_table[type].type != type)
+ {
+ fprintf (stderr, "MeP: howto %d has type %d\n", type, mep_elf_howto_table[type].type);
+ abort ();
+ }
+
+ return mep_elf_howto_table + type;
+}
+
+#undef MAP
+
+static reloc_howto_type *
+mep_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED, const char *r_name)
+{
+ unsigned int i;
+
+ for (i = 0;
+ i < sizeof (mep_elf_howto_table) / sizeof (mep_elf_howto_table[0]);
+ i++)
+ if (mep_elf_howto_table[i].name != NULL
+ && strcasecmp (mep_elf_howto_table[i].name, r_name) == 0)
+ return &mep_elf_howto_table[i];
+
+ return NULL;
+}
+
+/* Perform a single relocation. */
+
+static struct bfd_link_info *mep_info;
+static int warn_tp = 0, warn_sda = 0;
+
+static bfd_vma
+mep_lookup_global
+ (char * name,
+ bfd_vma ofs,
+ bfd_vma * cache,
+ int * warn)
+{
+ struct bfd_link_hash_entry *h;
+
+ if (*cache || *warn)
+ return *cache;
+
+ h = bfd_link_hash_lookup (mep_info->hash, name, FALSE, FALSE, TRUE);
+ if (h == 0 || h->type != bfd_link_hash_defined)
+ {
+ *warn = ofs + 1;
+ return 0;
+ }
+ *cache = (h->u.def.value
+ + h->u.def.section->output_section->vma
+ + h->u.def.section->output_offset);
+ return *cache;
+}
+
+static bfd_vma
+mep_tpoff_base (bfd_vma ofs)
+{
+ static bfd_vma cache = 0;
+ return mep_lookup_global ("__tpbase", ofs, &cache, &warn_tp);
+}
+
+static bfd_vma
+mep_sdaoff_base (bfd_vma ofs)
+{
+ static bfd_vma cache = 0;
+ return mep_lookup_global ("__sdabase", ofs, &cache, &warn_sda);
+}
+
+static bfd_reloc_status_type
+mep_final_link_relocate
+ (reloc_howto_type * howto,
+ bfd * input_bfd,
+ asection * input_section,
+ bfd_byte * contents,
+ Elf_Internal_Rela * rel,
+ bfd_vma relocation)
+{
+ unsigned long u;
+ long s;
+ unsigned char *byte;
+ bfd_vma pc;
+ bfd_reloc_status_type r = bfd_reloc_ok;
+ int e2, e4;
+
+ if (bfd_big_endian (input_bfd))
+ {
+ e2 = 0;
+ e4 = 0;
+ }
+ else
+ {
+ e2 = 1;
+ e4 = 3;
+ }
+
+ pc = (input_section->output_section->vma
+ + input_section->output_offset
+ + rel->r_offset);
+
+ s = relocation + rel->r_addend;
+
+ byte = (unsigned char *)contents + rel->r_offset;
+
+ if (howto->type == R_MEP_PCREL24A2
+ && s == 0
+ && pc >= 0x800000)
+ {
+ /* This is an unreachable branch to an undefined weak function.
+ Silently ignore it, since the opcode can't do that but should
+ never be executed anyway. */
+ return bfd_reloc_ok;
+ }
+
+ if (howto->pc_relative)
+ s -= pc;
+
+ u = (unsigned long) s;
+
+ switch (howto->type)
+ {
+ /* MEPRELOC:APPLY */
+ /* This section generated from bfd/mep-relocs.pl from include/elf/mep.h. */
+ case R_MEP_8: /* 76543210 */
+ if (u > 255) r = bfd_reloc_overflow;
+ byte[0] = (u & 0xff);
+ break;
+ case R_MEP_16: /* fedcba9876543210 */
+ if (u > 65535) r = bfd_reloc_overflow;
+ byte[0^e2] = ((u >> 8) & 0xff);
+ byte[1^e2] = (u & 0xff);
+ break;
+ case R_MEP_32: /* vutsrqponmlkjihgfedcba9876543210 */
+ byte[0^e4] = ((u >> 24) & 0xff);
+ byte[1^e4] = ((u >> 16) & 0xff);
+ byte[2^e4] = ((u >> 8) & 0xff);
+ byte[3^e4] = (u & 0xff);
+ break;
+ case R_MEP_PCREL8A2: /* --------7654321- */
+ if (-128 > s || s > 127) r = bfd_reloc_overflow;
+ byte[1^e2] = (byte[1^e2] & 0x01) | (s & 0xfe);
+ break;
+ case R_MEP_PCREL12A2: /* ----ba987654321- */
+ if (-2048 > s || s > 2047) r = bfd_reloc_overflow;
+ byte[0^e2] = (byte[0^e2] & 0xf0) | ((s >> 8) & 0x0f);
+ byte[1^e2] = (byte[1^e2] & 0x01) | (s & 0xfe);
+ break;
+ case R_MEP_PCREL17A2: /* ----------------gfedcba987654321 */
+ if (-65536 > s || s > 65535) r = bfd_reloc_overflow;
+ byte[2^e2] = ((s >> 9) & 0xff);
+ byte[3^e2] = ((s >> 1) & 0xff);
+ break;
+ case R_MEP_PCREL24A2: /* -----7654321----nmlkjihgfedcba98 */
+ if (-8388608 > s || s > 8388607) r = bfd_reloc_overflow;
+ byte[0^e2] = (byte[0^e2] & 0xf8) | ((s >> 5) & 0x07);
+ byte[1^e2] = (byte[1^e2] & 0x0f) | ((s << 3) & 0xf0);
+ byte[2^e2] = ((s >> 16) & 0xff);
+ byte[3^e2] = ((s >> 8) & 0xff);
+ break;
+ case R_MEP_PCABS24A2: /* -----7654321----nmlkjihgfedcba98 */
+ if (u > 16777215) r = bfd_reloc_overflow;
+ byte[0^e2] = (byte[0^e2] & 0xf8) | ((u >> 5) & 0x07);
+ byte[1^e2] = (byte[1^e2] & 0x0f) | ((u << 3) & 0xf0);
+ byte[2^e2] = ((u >> 16) & 0xff);
+ byte[3^e2] = ((u >> 8) & 0xff);
+ break;
+ case R_MEP_LOW16: /* ----------------fedcba9876543210 */
+ byte[2^e2] = ((u >> 8) & 0xff);
+ byte[3^e2] = (u & 0xff);
+ break;
+ case R_MEP_HI16U: /* ----------------vutsrqponmlkjihg */
+ byte[2^e2] = ((u >> 24) & 0xff);
+ byte[3^e2] = ((u >> 16) & 0xff);
+ break;
+ case R_MEP_HI16S: /* ----------------vutsrqponmlkjihg */
+ byte[2^e2] = ((s >> 24) & 0xff);
+ byte[3^e2] = ((s >> 16) & 0xff);
+ break;
+ case R_MEP_GPREL: /* ----------------fedcba9876543210 */
+ s -= mep_sdaoff_base(rel->r_offset);
+ if (-32768 > s || s > 32767) r = bfd_reloc_overflow;
+ byte[2^e2] = ((s >> 8) & 0xff);
+ byte[3^e2] = (s & 0xff);
+ break;
+ case R_MEP_TPREL: /* ----------------fedcba9876543210 */
+ s -= mep_tpoff_base(rel->r_offset);
+ if (-32768 > s || s > 32767) r = bfd_reloc_overflow;
+ byte[2^e2] = ((s >> 8) & 0xff);
+ byte[3^e2] = (s & 0xff);
+ break;
+ case R_MEP_TPREL7: /* ---------6543210 */
+ u -= mep_tpoff_base(rel->r_offset);
+ if (u > 127) r = bfd_reloc_overflow;
+ byte[1^e2] = (byte[1^e2] & 0x80) | (u & 0x7f);
+ break;
+ case R_MEP_TPREL7A2: /* ---------654321- */
+ u -= mep_tpoff_base(rel->r_offset);
+ if (u > 127) r = bfd_reloc_overflow;
+ byte[1^e2] = (byte[1^e2] & 0x81) | (u & 0x7e);
+ break;
+ case R_MEP_TPREL7A4: /* ---------65432-- */
+ u -= mep_tpoff_base(rel->r_offset);
+ if (u > 127) r = bfd_reloc_overflow;
+ byte[1^e2] = (byte[1^e2] & 0x83) | (u & 0x7c);
+ break;
+ case R_MEP_UIMM24: /* --------76543210nmlkjihgfedcba98 */
+ if (u > 16777215) r = bfd_reloc_overflow;
+ byte[1^e2] = (u & 0xff);
+ byte[2^e2] = ((u >> 16) & 0xff);
+ byte[3^e2] = ((u >> 8) & 0xff);
+ break;
+ case R_MEP_ADDR24A4: /* --------765432--nmlkjihgfedcba98 */
+ if (u > 16777215) r = bfd_reloc_overflow;
+ byte[1^e2] = (byte[1^e2] & 0x03) | (u & 0xfc);
+ byte[2^e2] = ((u >> 16) & 0xff);
+ byte[3^e2] = ((u >> 8) & 0xff);
+ break;
+ case R_MEP_GNU_VTINHERIT: /* ---------------- */
+ break;
+ case R_MEP_GNU_VTENTRY: /* ---------------- */
+ break;
+ /* MEPRELOC:END */
+ default:
+ abort ();
+ }
+
+ return r;
+}
+
+/* Set the howto pointer for a MEP ELF reloc. */
+
+static void
+mep_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 = & mep_elf_howto_table [r_type];
+}
+
+/* Look through the relocs for a section during the first phase.
+ Since we don't do .gots or .plts, we just need to consider the
+ virtual table relocs for gc. */
+
+static bfd_boolean
+mep_elf_check_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;
+
+ if (info->relocatable)
+ return TRUE;
+
+ 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];
+ }
+ return TRUE;
+}
+
+
+/* Relocate a MEP ELF section.
+ There is some attempt to make this function usable for many architectures,
+ both USE_REL and USE_RELA ['twould be nice if such a critter existed],
+ if only to serve as a learning tool.
+
+ The RELOCATE_SECTION function is called by the new 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 adjusting 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
+mep_elf_relocate_section
+ (bfd * output_bfd ATTRIBUTE_UNUSED,
+ 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;
+
+ symtab_hdr = & elf_tdata (input_bfd)->symtab_hdr;
+ sym_hashes = elf_sym_hashes (input_bfd);
+ relend = relocs + input_section->reloc_count;
+
+ mep_info = info;
+
+ for (rel = relocs; rel < relend; rel ++)
+ {
+ 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;
+ const char * name = NULL;
+ int r_type;
+
+ r_type = ELF32_R_TYPE (rel->r_info);
+
+ r_symndx = ELF32_R_SYM (rel->r_info);
+
+ /* Is this a complex relocation? */
+ if (!info->relocatable && ELF32_R_TYPE (rel->r_info) == R_RELC)
+ {
+ bfd_elf_perform_complex_relocation (output_bfd, info,
+ input_bfd, input_section, contents,
+ rel, local_syms, local_sections);
+ continue;
+ }
+
+ howto = mep_elf_howto_table + ELF32_R_TYPE (rel->r_info);
+ h = NULL;
+ sym = NULL;
+ sec = NULL;
+
+ 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);
+
+ name = bfd_elf_string_from_elf_section
+ (input_bfd, symtab_hdr->sh_link, sym->st_name);
+ name = (name == NULL) ? bfd_section_name (input_bfd, sec) : name;
+#if 0
+ fprintf (stderr, "local: sec: %s, sym: %s (%d), value: %x + %x + %x addend %x\n",
+ sec->name, name, sym->st_name,
+ sec->output_section->vma, sec->output_offset,
+ sym->st_value, rel->r_addend);
+#endif
+ }
+ else
+ {
+ relocation = 0;
+ h = 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;
+
+ name = h->root.root.string;
+
+ if (h->root.type == bfd_link_hash_defined
+ || h->root.type == bfd_link_hash_defweak)
+ {
+ sec = h->root.u.def.section;
+ relocation = (h->root.u.def.value
+ + sec->output_section->vma
+ + sec->output_offset);
+#if 0
+ fprintf (stderr,
+ "defined: sec: %s, name: %s, value: %x + %x + %x gives: %x\n",
+ sec->name, name, h->root.u.def.value,
+ sec->output_section->vma, sec->output_offset, relocation);
+#endif
+ }
+ else if (h->root.type == bfd_link_hash_undefweak)
+ {
+#if 0
+ fprintf (stderr, "undefined: sec: %s, name: %s\n",
+ sec->name, name);
+#endif
+ }
+ else if (!info->relocatable)
+ {
+ if (! ((*info->callbacks->undefined_symbol)
+ (info, h->root.root.string, input_bfd,
+ input_section, rel->r_offset,
+ (!info->shared && info->unresolved_syms_in_objects == RM_GENERATE_ERROR))))
+ return FALSE;
+#if 0
+ fprintf (stderr, "unknown: name: %s\n", name);
+#endif
+ }
+ }
+
+ if (sec != NULL && elf_discarded_section (sec))
+ {
+ /* For relocs against symbols from removed linkonce sections,
+ or sections discarded by a linker script, we just want the
+ section contents zeroed. Avoid any special processing. */
+ _bfd_clear_contents (howto, input_bfd, contents + rel->r_offset);
+ rel->r_info = 0;
+ rel->r_addend = 0;
+ continue;
+ }
+
+ 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 (sym != NULL && ELF_ST_TYPE (sym->st_info) == STT_SECTION)
+ rel->r_addend += sec->output_offset;
+ continue;
+ }
+
+ switch (r_type)
+ {
+ default:
+ r = mep_final_link_relocate (howto, input_bfd, input_section,
+ contents, rel, relocation);
+ break;
+ }
+
+ if (r != bfd_reloc_ok)
+ {
+ const char * msg = (const char *) NULL;
+
+ switch (r)
+ {
+ case bfd_reloc_overflow:
+ r = info->callbacks->reloc_overflow
+ (info, (h ? &h->root : NULL), name, howto->name, (bfd_vma) 0,
+ input_bfd, input_section, rel->r_offset);
+ break;
+
+ case bfd_reloc_undefined:
+ r = info->callbacks->undefined_symbol
+ (info, name, input_bfd, input_section, rel->r_offset, TRUE);
+ break;
+
+ case bfd_reloc_outofrange:
+ msg = _("internal error: out of range error");
+ break;
+
+ case bfd_reloc_notsupported:
+ msg = _("internal error: unsupported relocation error");
+ break;
+
+ case bfd_reloc_dangerous:
+ msg = _("internal error: dangerous relocation");
+ break;
+
+ default:
+ msg = _("internal error: unknown error");
+ break;
+ }
+
+ if (msg)
+ r = info->callbacks->warning
+ (info, msg, name, input_bfd, input_section, rel->r_offset);
+
+ if (! r)
+ return FALSE;
+ }
+ }
+
+ if (warn_tp)
+ info->callbacks->undefined_symbol
+ (info, "__tpbase", input_bfd, input_section, warn_tp-1, TRUE);
+ if (warn_sda)
+ info->callbacks->undefined_symbol
+ (info, "__sdabase", input_bfd, input_section, warn_sda-1, TRUE);
+ if (warn_sda || warn_tp)
+ return FALSE;
+
+ return TRUE;
+}
+
+
+/* Update the got entry reference counts for the section being
+ removed. */
+
+static bfd_boolean
+mep_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)
+{
+ return TRUE;
+}
+
+/* Return the section that should be marked against GC for a given
+ relocation. */
+
+static asection *
+mep_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))
+ {
+ default:
+ switch (h->root.type)
+ {
+ case bfd_link_hash_defined:
+ case bfd_link_hash_defweak:
+ return h->root.u.def.section;
+
+ case bfd_link_hash_common:
+ return h->root.u.c.p->section;
+
+ default:
+ break;
+ }
+ }
+ }
+ else
+ {
+ if (!(elf_bad_symtab (sec->owner)
+ && ELF_ST_BIND (sym->st_info) != STB_LOCAL)
+ && ! ((sym->st_shndx <= 0 || sym->st_shndx >= SHN_LORESERVE)
+ && sym->st_shndx != SHN_COMMON))
+ return bfd_section_from_elf_index (sec->owner, sym->st_shndx);
+ }
+
+ return NULL;
+}
+
+
+/* Function to set the ELF flag bits. */
+
+static bfd_boolean
+mep_elf_set_private_flags (bfd * abfd,
+ flagword flags)
+{
+ elf_elfheader (abfd)->e_flags = flags;
+ elf_flags_init (abfd) = TRUE;
+ return TRUE;
+}
+
+static bfd_boolean
+mep_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;
+
+ elf_elfheader (obfd)->e_flags = elf_elfheader (ibfd)->e_flags;
+ elf_flags_init (obfd) = TRUE;
+
+ /* Copy object attributes. */
+ _bfd_elf_copy_obj_attributes (ibfd, obfd);
+
+ return TRUE;
+}
+
+/* Merge backend specific data from an object file to the output
+ object file when linking. */
+
+static bfd_boolean
+mep_elf_merge_private_bfd_data (bfd * ibfd, bfd * obfd)
+{
+ static bfd *last_ibfd = 0;
+ flagword old_flags, new_flags;
+ flagword old_partial, new_partial;
+
+ /* Check if we have the same endianess. */
+ if (_bfd_generic_verify_endian_match (ibfd, obfd) == FALSE)
+ return FALSE;
+
+ new_flags = elf_elfheader (ibfd)->e_flags;
+ old_flags = elf_elfheader (obfd)->e_flags;
+
+#ifdef DEBUG
+ _bfd_error_handler ("%B: old_flags = 0x%.8lx, new_flags = 0x%.8lx, init = %s",
+ ibfd, old_flags, new_flags, elf_flags_init (obfd) ? "yes" : "no");
+#endif
+
+ /* First call, no flags set. */
+ if (!elf_flags_init (obfd))
+ {
+ elf_flags_init (obfd) = TRUE;
+ old_flags = new_flags;
+ }
+ else if ((new_flags | old_flags) & EF_MEP_LIBRARY)
+ {
+ /* Non-library flags trump library flags. The choice doesn't really
+ matter if both OLD_FLAGS and NEW_FLAGS have EF_MEP_LIBRARY set. */
+ if (old_flags & EF_MEP_LIBRARY)
+ old_flags = new_flags;
+ }
+ else
+ {
+ /* Make sure they're for the same mach. Allow upgrade from the "mep"
+ mach. */
+ new_partial = (new_flags & EF_MEP_CPU_MASK);
+ old_partial = (old_flags & EF_MEP_CPU_MASK);
+ if (new_partial == old_partial)
+ ;
+ else if (new_partial == EF_MEP_CPU_MEP)
+ ;
+ else if (old_partial == EF_MEP_CPU_MEP)
+ old_flags = (old_flags & ~EF_MEP_CPU_MASK) | new_partial;
+ else
+ {
+ _bfd_error_handler (_("%B and %B are for different cores"), last_ibfd, ibfd);
+ bfd_set_error (bfd_error_invalid_target);
+ return FALSE;
+ }
+
+ /* Make sure they're for the same me_module. Allow basic config to
+ mix with any other. */
+ new_partial = (new_flags & EF_MEP_INDEX_MASK);
+ old_partial = (old_flags & EF_MEP_INDEX_MASK);
+ if (new_partial == old_partial)
+ ;
+ else if (new_partial == 0)
+ ;
+ else if (old_partial == 0)
+ old_flags = (old_flags & ~EF_MEP_INDEX_MASK) | new_partial;
+ else
+ {
+ _bfd_error_handler (_("%B and %B are for different configurations"), last_ibfd, ibfd);
+ bfd_set_error (bfd_error_invalid_target);
+ return FALSE;
+ }
+ }
+
+ elf_elfheader (obfd)->e_flags = old_flags;
+ last_ibfd = ibfd;
+ return TRUE;
+}
+
+/* This will be edited by the MeP configration tool. */
+static const char * config_names[] =
+{
+ "basic"
+ /* start-mepcfgtool */
+ ,"simple"
+ ,"fmax"
+ /* end-mepcfgtool */
+};
+
+static const char * core_names[] =
+{
+ "MeP", "MeP-c2", "MeP-c3", "MeP-h1"
+};
+
+static bfd_boolean
+mep_elf_print_private_bfd_data (bfd * abfd, void * ptr)
+{
+ FILE * file = (FILE *) ptr;
+ flagword flags, partial_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;
+ fprintf (file, _("private flags = 0x%lx"), (long)flags);
+
+ partial_flags = (flags & EF_MEP_CPU_MASK) >> 24;
+ if (partial_flags < ARRAY_SIZE (core_names))
+ fprintf (file, " core: %s", core_names[(long)partial_flags]);
+
+ partial_flags = flags & EF_MEP_INDEX_MASK;
+ if (partial_flags < ARRAY_SIZE (config_names))
+ fprintf (file, " me_module: %s", config_names[(long)partial_flags]);
+
+ fputc ('\n', file);
+
+ return TRUE;
+}
+
+/* Return the machine subcode from the ELF e_flags header. */
+
+static int
+elf32_mep_machine (bfd * abfd)
+{
+ switch (elf_elfheader (abfd)->e_flags & EF_MEP_CPU_MASK)
+ {
+ default: break;
+ case EF_MEP_CPU_C2: return bfd_mach_mep;
+ case EF_MEP_CPU_C3: return bfd_mach_mep;
+ case EF_MEP_CPU_C4: return bfd_mach_mep;
+ case EF_MEP_CPU_H1: return bfd_mach_mep_h1;
+ }
+
+ return bfd_mach_mep;
+}
+
+static bfd_boolean
+mep_elf_object_p (bfd * abfd)
+{
+ /* Irix 5 and 6 is broken. Object file symbol tables are not always
+ sorted correctly such that local symbols preceed global symbols,
+ and the sh_info field in the symbol table is not always right. */
+ /* This is needed for the RELC support code. */
+ elf_bad_symtab (abfd) = TRUE;
+ bfd_default_set_arch_mach (abfd, bfd_arch_mep, elf32_mep_machine (abfd));
+ return TRUE;
+}
+
+static bfd_boolean
+mep_elf_section_flags (flagword * flags, const Elf_Internal_Shdr * hdr)
+{
+ if (hdr->sh_flags & SHF_MEP_VLIW)
+ * flags |= SEC_MEP_VLIW;
+ return TRUE;
+}
+
+static bfd_boolean
+mep_elf_fake_sections (bfd * abfd ATTRIBUTE_UNUSED,
+ Elf_Internal_Shdr * hdr,
+ asection * sec)
+{
+ if (sec->flags & SEC_MEP_VLIW)
+ hdr->sh_flags |= SHF_MEP_VLIW;
+ return TRUE;
+}
+
+
+#define ELF_ARCH bfd_arch_mep
+#define ELF_MACHINE_CODE EM_CYGNUS_MEP
+#define ELF_MAXPAGESIZE 0x1000
+
+#define TARGET_BIG_SYM bfd_elf32_mep_vec
+#define TARGET_BIG_NAME "elf32-mep"
+
+#define TARGET_LITTLE_SYM bfd_elf32_mep_little_vec
+#define TARGET_LITTLE_NAME "elf32-mep-little"
+
+#define elf_info_to_howto_rel NULL
+#define elf_info_to_howto mep_info_to_howto_rela
+#define elf_backend_relocate_section mep_elf_relocate_section
+#define elf_backend_gc_mark_hook mep_elf_gc_mark_hook
+#define elf_backend_gc_sweep_hook mep_elf_gc_sweep_hook
+#define elf_backend_check_relocs mep_elf_check_relocs
+#define elf_backend_object_p mep_elf_object_p
+#define elf_backend_section_flags mep_elf_section_flags
+#define elf_backend_fake_sections mep_elf_fake_sections
+
+#define elf_backend_can_gc_sections 1
+
+#define bfd_elf32_bfd_reloc_type_lookup mep_reloc_type_lookup
+#define bfd_elf32_bfd_reloc_name_lookup mep_reloc_name_lookup
+#define bfd_elf32_bfd_set_private_flags mep_elf_set_private_flags
+#define bfd_elf32_bfd_copy_private_bfd_data mep_elf_copy_private_bfd_data
+#define bfd_elf32_bfd_merge_private_bfd_data mep_elf_merge_private_bfd_data
+#define bfd_elf32_bfd_print_private_bfd_data mep_elf_print_private_bfd_data
+
+/* We use only the RELA entries. */
+#define USE_RELA
+
+#include "elf32-target.h"
diff --git a/contrib/binutils/bfd/elf32-mips.c b/contrib/binutils/bfd/elf32-mips.c
index a0480f0..3843b85 100644
--- a/contrib/binutils/bfd/elf32-mips.c
+++ b/contrib/binutils/bfd/elf32-mips.c
@@ -1,6 +1,6 @@
/* MIPS-specific support for 32-bit ELF
Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
- 2003 Free Software Foundation, Inc.
+ 2003, 2004, 2005, 2007 Free Software Foundation, Inc.
Most of the information added by Ian Lance Taylor, Cygnus Support,
<ian@cygnus.com>.
@@ -23,20 +23,21 @@ 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. */
+Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, 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 "bfd.h"
#include "libbfd.h"
#include "bfdlink.h"
#include "genlink.h"
#include "elf-bfd.h"
#include "elfxx-mips.h"
#include "elf/mips.h"
+#include "elf-vxworks.h"
/* Get the ECOFF swapping routines. */
#include "coff/sym.h"
@@ -67,8 +68,6 @@ 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
@@ -257,9 +256,11 @@ static reloc_howto_type elf_mips_howto_table_rel[] =
0x0000ffff, /* dst_mask */
FALSE), /* pcrel_offset */
- /* 16 bit PC relative reference. */
+ /* 16 bit PC relative reference. Note that the ABI document has a typo
+ and claims R_MIPS_PC16 to be not rightshifted, rendering it useless.
+ We do the right thing here. */
HOWTO (R_MIPS_PC16, /* type */
- 0, /* rightshift */
+ 2, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
16, /* bitsize */
TRUE, /* pc_relative */
@@ -545,6 +546,175 @@ static reloc_howto_type elf_mips_howto_table_rel[] =
0x00000000, /* src_mask */
0x00000000, /* dst_mask */
FALSE), /* pcrel_offset */
+
+ /* TLS GD/LD dynamic relocations. */
+ HOWTO (R_MIPS_TLS_DTPMOD32, /* 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_TLS_DTPMOD32", /* name */
+ TRUE, /* partial_inplace */
+ 0xffffffff, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ HOWTO (R_MIPS_TLS_DTPREL32, /* 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_TLS_DTPREL32", /* name */
+ TRUE, /* partial_inplace */
+ 0xffffffff, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ EMPTY_HOWTO (R_MIPS_TLS_DTPMOD64),
+ EMPTY_HOWTO (R_MIPS_TLS_DTPREL64),
+
+ /* TLS general dynamic variable reference. */
+ HOWTO (R_MIPS_TLS_GD, /* 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_TLS_GD", /* name */
+ TRUE, /* partial_inplace */
+ 0x0000ffff, /* src_mask */
+ 0x0000ffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* TLS local dynamic variable reference. */
+ HOWTO (R_MIPS_TLS_LDM, /* 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_TLS_LDM", /* name */
+ TRUE, /* partial_inplace */
+ 0x0000ffff, /* src_mask */
+ 0x0000ffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* TLS local dynamic offset. */
+ HOWTO (R_MIPS_TLS_DTPREL_HI16, /* 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_TLS_DTPREL_HI16", /* name */
+ TRUE, /* partial_inplace */
+ 0x0000ffff, /* src_mask */
+ 0x0000ffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* TLS local dynamic offset. */
+ HOWTO (R_MIPS_TLS_DTPREL_LO16, /* 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_TLS_DTPREL_LO16", /* name */
+ TRUE, /* partial_inplace */
+ 0x0000ffff, /* src_mask */
+ 0x0000ffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* TLS thread pointer offset. */
+ HOWTO (R_MIPS_TLS_GOTTPREL, /* 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_TLS_GOTTPREL", /* name */
+ TRUE, /* partial_inplace */
+ 0x0000ffff, /* src_mask */
+ 0x0000ffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* TLS IE dynamic relocations. */
+ HOWTO (R_MIPS_TLS_TPREL32, /* 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_TLS_TPREL32", /* name */
+ TRUE, /* partial_inplace */
+ 0xffffffff, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ EMPTY_HOWTO (R_MIPS_TLS_TPREL64),
+
+ /* TLS thread pointer offset. */
+ HOWTO (R_MIPS_TLS_TPREL_HI16, /* 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_TLS_TPREL_HI16", /* name */
+ TRUE, /* partial_inplace */
+ 0x0000ffff, /* src_mask */
+ 0x0000ffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* TLS thread pointer offset. */
+ HOWTO (R_MIPS_TLS_TPREL_LO16, /* 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_TLS_TPREL_LO16", /* name */
+ TRUE, /* partial_inplace */
+ 0x0000ffff, /* src_mask */
+ 0x0000ffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* 32 bit relocation with no addend. */
+ HOWTO (R_MIPS_GLOB_DAT, /* 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_GLOB_DAT", /* name */
+ FALSE, /* partial_inplace */
+ 0x0, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
};
/* The reloc used for BFD_RELOC_CTOR when doing a 64 bit link. This
@@ -564,8 +734,9 @@ static reloc_howto_type elf_mips_ctor64_howto =
0xffffffff, /* dst_mask */
FALSE); /* pcrel_offset */
-/* The reloc used for the mips16 jump instruction. */
-static reloc_howto_type elf_mips16_jump_howto =
+static reloc_howto_type elf_mips16_howto_table_rel[] =
+{
+ /* The reloc used for the mips16 jump instruction. */
HOWTO (R_MIPS16_26, /* type */
2, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
@@ -576,15 +747,14 @@ static reloc_howto_type elf_mips16_jump_howto =
/* This needs complex overflow
detection, because the upper four
bits must match the PC. */
- mips16_jump_reloc, /* special_function */
+ _bfd_mips_elf_generic_reloc, /* special_function */
"R_MIPS16_26", /* name */
TRUE, /* partial_inplace */
0x3ffffff, /* src_mask */
0x3ffffff, /* dst_mask */
- FALSE); /* pcrel_offset */
+ FALSE), /* pcrel_offset */
-/* The reloc used for the mips16 gprel instruction. */
-static reloc_howto_type elf_mips16_gprel_howto =
+ /* The reloc used for the mips16 gprel instruction. */
HOWTO (R_MIPS16_GPREL, /* type */
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
@@ -595,42 +765,46 @@ static reloc_howto_type elf_mips16_gprel_howto =
mips16_gprel_reloc, /* special_function */
"R_MIPS16_GPREL", /* name */
TRUE, /* partial_inplace */
- 0x07ff001f, /* src_mask */
- 0x07ff001f, /* dst_mask */
- FALSE); /* pcrel_offset */
+ 0x0000ffff, /* src_mask */
+ 0x0000ffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* A placeholder for MIPS16 reference to global offset table. */
+ EMPTY_HOWTO (R_MIPS16_GOT16),
-/* 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 */
+ /* A placeholder for MIPS16 16 bit call through global offset table. */
+ EMPTY_HOWTO (R_MIPS16_CALL16),
+
+ /* MIPS16 high 16 bits of symbol value. */
+ HOWTO (R_MIPS16_HI16, /* type */
16, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
16, /* bitsize */
- TRUE, /* pc_relative */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
_bfd_mips_elf_hi16_reloc, /* special_function */
- "R_MIPS_GNU_REL_HI16", /* name */
+ "R_MIPS16_HI16", /* name */
TRUE, /* partial_inplace */
- 0xffff, /* src_mask */
- 0xffff, /* dst_mask */
- TRUE); /* pcrel_offset */
+ 0x0000ffff, /* src_mask */
+ 0x0000ffff, /* dst_mask */
+ FALSE), /* 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 */
+ /* MIPS16 low 16 bits of symbol value. */
+ HOWTO (R_MIPS16_LO16, /* type */
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
16, /* bitsize */
- TRUE, /* pc_relative */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
_bfd_mips_elf_lo16_reloc, /* special_function */
- "R_MIPS_GNU_REL_LO16", /* name */
+ "R_MIPS16_LO16", /* name */
TRUE, /* partial_inplace */
- 0xffff, /* src_mask */
- 0xffff, /* dst_mask */
- TRUE); /* pcrel_offset */
+ 0x0000ffff, /* src_mask */
+ 0x0000ffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+};
/* 16 bit offset for pc-relative branches. */
static reloc_howto_type elf_mips_gnu_rel16_s2 =
@@ -648,23 +822,10 @@ static reloc_howto_type elf_mips_gnu_rel16_s2 =
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. */
+/* 32 bit pc-relative. This was a GNU extension used by embedded-PIC.
+ It was co-opted by mips-linux for exception-handling data. It is no
+ longer used, but should continue to be supported by the linker for
+ backward compatibility. (GCC stopped using it in May, 2004.) */
static reloc_howto_type elf_mips_gnu_pcrel32 =
HOWTO (R_MIPS_PC32, /* type */
0, /* rightshift */
@@ -816,6 +977,17 @@ _bfd_mips_elf32_gprel16_reloc (bfd *abfd, arelent *reloc_entry,
bfd_reloc_status_type ret;
bfd_vma gp;
+ /* R_MIPS_LITERAL relocations are defined for local symbols only. */
+ if (reloc_entry->howto->type == R_MIPS_LITERAL
+ && output_bfd != NULL
+ && (symbol->flags & BSF_SECTION_SYM) == 0
+ && (symbol->flags & BSF_LOCAL) != 0)
+ {
+ *error_message = (char *)
+ _("literal relocation occurs for an external symbol");
+ return bfd_reloc_outofrange;
+ }
+
if (output_bfd != NULL)
relocatable = TRUE;
else
@@ -846,6 +1018,16 @@ mips_elf_gprel32_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol,
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;
else
@@ -879,7 +1061,7 @@ gprel32_with_gp (bfd *abfd, asymbol *symbol, arelent *reloc_entry,
relocation += symbol->section->output_section->vma;
relocation += symbol->section->output_offset;
- if (reloc_entry->address > input_section->_cooked_size)
+ if (reloc_entry->address > bfd_get_section_limit (abfd, input_section))
return bfd_reloc_outofrange;
/* Set val to the offset into the section or symbol. */
@@ -943,36 +1125,6 @@ mips32_64bit_reloc (bfd *abfd, arelent *reloc_entry,
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
@@ -982,11 +1134,8 @@ mips16_gprel_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol,
{
bfd_boolean relocatable;
bfd_reloc_status_type ret;
+ bfd_byte *location;
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. */
@@ -1011,55 +1160,16 @@ mips16_gprel_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol,
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;
+ location = (bfd_byte *) data + reloc_entry->address;
+ _bfd_mips16_elf_reloc_unshuffle (abfd, reloc_entry->howto->type, FALSE,
+ location);
+ ret = _bfd_mips_elf_gprel16_with_gp (abfd, symbol, reloc_entry,
+ input_section, relocatable,
+ data, gp);
+ _bfd_mips16_elf_reloc_shuffle (abfd, reloc_entry->howto->type, !relocatable,
+ location);
- return bfd_reloc_ok;
+ return ret;
}
/* A mapping from BFD reloc types to MIPS ELF reloc types. */
@@ -1082,7 +1192,7 @@ static const struct elf_reloc_map mips_reloc_map[] =
{ 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_16_PCREL_S2, 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 },
@@ -1092,7 +1202,28 @@ static const struct elf_reloc_map mips_reloc_map[] =
{ 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 }
+ { BFD_RELOC_MIPS_GOT_DISP, R_MIPS_GOT_DISP },
+ { BFD_RELOC_MIPS_TLS_DTPMOD32, R_MIPS_TLS_DTPMOD32 },
+ { BFD_RELOC_MIPS_TLS_DTPREL32, R_MIPS_TLS_DTPREL32 },
+ { BFD_RELOC_MIPS_TLS_DTPMOD64, R_MIPS_TLS_DTPMOD64 },
+ { BFD_RELOC_MIPS_TLS_DTPREL64, R_MIPS_TLS_DTPREL64 },
+ { BFD_RELOC_MIPS_TLS_GD, R_MIPS_TLS_GD },
+ { BFD_RELOC_MIPS_TLS_LDM, R_MIPS_TLS_LDM },
+ { BFD_RELOC_MIPS_TLS_DTPREL_HI16, R_MIPS_TLS_DTPREL_HI16 },
+ { BFD_RELOC_MIPS_TLS_DTPREL_LO16, R_MIPS_TLS_DTPREL_LO16 },
+ { BFD_RELOC_MIPS_TLS_GOTTPREL, R_MIPS_TLS_GOTTPREL },
+ { BFD_RELOC_MIPS_TLS_TPREL32, R_MIPS_TLS_TPREL32 },
+ { BFD_RELOC_MIPS_TLS_TPREL64, R_MIPS_TLS_TPREL64 },
+ { BFD_RELOC_MIPS_TLS_TPREL_HI16, R_MIPS_TLS_TPREL_HI16 },
+ { BFD_RELOC_MIPS_TLS_TPREL_LO16, R_MIPS_TLS_TPREL_LO16 }
+};
+
+static const struct elf_reloc_map mips16_reloc_map[] =
+{
+ { BFD_RELOC_MIPS16_JMP, R_MIPS16_26 - R_MIPS16_min },
+ { BFD_RELOC_MIPS16_GPREL, R_MIPS16_GPREL - R_MIPS16_min },
+ { BFD_RELOC_MIPS16_HI16_S, R_MIPS16_HI16 - R_MIPS16_min },
+ { BFD_RELOC_MIPS16_LO16, R_MIPS16_LO16 - R_MIPS16_min },
};
/* Given a BFD reloc type, return a howto structure. */
@@ -1102,6 +1233,7 @@ 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;
+ reloc_howto_type *howto16_table = elf_mips16_howto_table_rel;
for (i = 0; i < sizeof (mips_reloc_map) / sizeof (struct elf_reloc_map);
i++)
@@ -1110,6 +1242,13 @@ bfd_elf32_bfd_reloc_type_lookup (bfd *abfd, bfd_reloc_code_real_type code)
return &howto_table[(int) mips_reloc_map[i].elf_val];
}
+ for (i = 0; i < sizeof (mips16_reloc_map) / sizeof (struct elf_reloc_map);
+ i++)
+ {
+ if (mips16_reloc_map[i].bfd_val == code)
+ return &howto16_table[(int) mips16_reloc_map[i].elf_val];
+ }
+
switch (code)
{
default:
@@ -1126,27 +1265,49 @@ bfd_elf32_bfd_reloc_type_lookup (bfd *abfd, bfd_reloc_code_real_type code)
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;
}
}
+static reloc_howto_type *
+bfd_elf32_bfd_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED,
+ const char *r_name)
+{
+ unsigned int i;
+
+ for (i = 0;
+ i < (sizeof (elf_mips_howto_table_rel)
+ / sizeof (elf_mips_howto_table_rel[0]));
+ i++)
+ if (elf_mips_howto_table_rel[i].name != NULL
+ && strcasecmp (elf_mips_howto_table_rel[i].name, r_name) == 0)
+ return &elf_mips_howto_table_rel[i];
+
+ for (i = 0;
+ i < (sizeof (elf_mips16_howto_table_rel)
+ / sizeof (elf_mips16_howto_table_rel[0]));
+ i++)
+ if (elf_mips16_howto_table_rel[i].name != NULL
+ && strcasecmp (elf_mips16_howto_table_rel[i].name, r_name) == 0)
+ return &elf_mips16_howto_table_rel[i];
+
+ if (strcasecmp (elf_mips_gnu_pcrel32.name, r_name) == 0)
+ return &elf_mips_gnu_pcrel32;
+ if (strcasecmp (elf_mips_gnu_rel16_s2.name, r_name) == 0)
+ return &elf_mips_gnu_rel16_s2;
+ if (strcasecmp (elf_mips_gnu_vtinherit_howto.name, r_name) == 0)
+ return &elf_mips_gnu_vtinherit_howto;
+ if (strcasecmp (elf_mips_gnu_vtentry_howto.name, r_name) == 0)
+ return &elf_mips_gnu_vtentry_howto;
+
+ return NULL;
+}
+
/* Given a MIPS Elf_Internal_Rel, fill in an arelent structure. */
static reloc_howto_type *
@@ -1155,25 +1316,17 @@ mips_elf32_rtype_to_howto (unsigned int r_type,
{
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:
+ if (r_type >= R_MIPS16_min && r_type < R_MIPS16_max)
+ return &elf_mips16_howto_table_rel[r_type - R_MIPS16_min];
BFD_ASSERT (r_type < (unsigned int) R_MIPS_max);
return &elf_mips_howto_table_rel[r_type];
}
@@ -1184,10 +1337,12 @@ mips_elf32_rtype_to_howto (unsigned int r_type,
static void
mips_info_to_howto_rel (bfd *abfd, arelent *cache_ptr, Elf_Internal_Rela *dst)
{
+ const struct elf_backend_data *bed;
unsigned int r_type;
r_type = ELF32_R_TYPE (dst->r_info);
- cache_ptr->howto = mips_elf32_rtype_to_howto (r_type, FALSE);
+ bed = get_elf_backend_data (abfd);
+ cache_ptr->howto = bed->elf_backend_mips_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
@@ -1267,7 +1422,7 @@ static bfd_boolean
elf32_mips_grok_prstatus (bfd *abfd, Elf_Internal_Note *note)
{
int offset;
- unsigned int raw_size;
+ unsigned int size;
switch (note->descsz)
{
@@ -1283,14 +1438,14 @@ elf32_mips_grok_prstatus (bfd *abfd, Elf_Internal_Note *note)
/* pr_reg */
offset = 72;
- raw_size = 180;
+ size = 180;
break;
}
/* Make a ".reg/999" section. */
return _bfd_elfcore_make_pseudosection (abfd, ".reg",
- raw_size, note->descpos + offset);
+ size, note->descpos + offset);
}
static bfd_boolean
@@ -1335,139 +1490,6 @@ elf32_mips_irix_compat (bfd *abfd)
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 = {
@@ -1532,12 +1554,15 @@ static const struct ecoff_debug_swap mips_elf32_ecoff_debug_swap = {
#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_merge_symbol_attribute \
+ _bfd_mips_elf_merge_symbol_attribute
#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_init_index_section _bfd_elf_init_1_index_section
#define elf_backend_relocate_section _bfd_mips_elf_relocate_section
#define elf_backend_finish_dynamic_symbol \
_bfd_mips_elf_finish_dynamic_symbol
@@ -1571,6 +1596,7 @@ static const struct ecoff_debug_swap mips_elf32_ecoff_debug_swap = {
#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_find_inliner_info _bfd_mips_elf_find_inliner_info
#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 \
@@ -1593,6 +1619,7 @@ static const struct ecoff_debug_swap mips_elf32_ecoff_debug_swap = {
/* The SVR4 MIPS ABI says that this should be 0x10000, but Irix 5 uses
a value of 0x1000, and we are compatible. */
#define ELF_MAXPAGESIZE 0x1000
+#define ELF_COMMONPAGESIZE 0x1000
#include "elf32-target.h"
@@ -1603,16 +1630,182 @@ static const struct ecoff_debug_swap mips_elf32_ecoff_debug_swap = {
#undef TARGET_BIG_NAME
#undef ELF_MAXPAGESIZE
+#undef ELF_COMMONPAGESIZE
#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. */
+/* The MIPS ABI says at Page 5-1:
+ Virtual addresses and file offsets for MIPS segments are congruent
+ modulo 64 KByte (0x10000) or larger powers of 2. Because 64 KBytes
+ is the maximum page size, the files are suitable for paging
+ regardless of physical page size. */
#define ELF_MAXPAGESIZE 0x10000
+#define ELF_COMMONPAGESIZE 0x1000
#define elf32_bed elf32_tradbed
/* Include the target file again for this target. */
#include "elf32-target.h"
+
+
+/* Specific to VxWorks. */
+static reloc_howto_type mips_vxworks_copy_howto_rela =
+ HOWTO (R_MIPS_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_MIPS_COPY", /* name */
+ FALSE, /* partial_inplace */
+ 0x0, /* src_mask */
+ 0x0, /* dst_mask */
+ FALSE); /* pcrel_offset */
+
+/* Specific to VxWorks. */
+static reloc_howto_type mips_vxworks_jump_slot_howto_rela =
+ HOWTO (R_MIPS_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_MIPS_JUMP_SLOT", /* name */
+ FALSE, /* partial_inplace */
+ 0x0, /* src_mask */
+ 0x0, /* dst_mask */
+ FALSE); /* pcrel_offset */
+
+/* Implement elf_backend_bfd_reloc_type_lookup for VxWorks. */
+
+static reloc_howto_type *
+mips_vxworks_bfd_reloc_type_lookup (bfd *abfd, bfd_reloc_code_real_type code)
+{
+ switch (code)
+ {
+ case BFD_RELOC_MIPS_COPY:
+ return &mips_vxworks_copy_howto_rela;
+ case BFD_RELOC_MIPS_JUMP_SLOT:
+ return &mips_vxworks_jump_slot_howto_rela;
+ default:
+ return bfd_elf32_bfd_reloc_type_lookup (abfd, code);
+ }
+}
+
+static reloc_howto_type *
+mips_vxworks_bfd_reloc_name_lookup (bfd *abfd, const char *r_name)
+{
+ if (strcasecmp (mips_vxworks_copy_howto_rela.name, r_name) == 0)
+ return &mips_vxworks_copy_howto_rela;
+ if (strcasecmp (mips_vxworks_jump_slot_howto_rela.name, r_name) == 0)
+ return &mips_vxworks_jump_slot_howto_rela;
+
+ return bfd_elf32_bfd_reloc_name_lookup (abfd, r_name);
+}
+
+/* Implement elf_backend_mips_rtype_to_lookup for VxWorks. */
+
+static reloc_howto_type *
+mips_vxworks_rtype_to_howto (unsigned int r_type, bfd_boolean rela_p)
+{
+ switch (r_type)
+ {
+ case R_MIPS_COPY:
+ return &mips_vxworks_copy_howto_rela;
+ case R_MIPS_JUMP_SLOT:
+ return &mips_vxworks_jump_slot_howto_rela;
+ default:
+ return mips_elf32_rtype_to_howto (r_type, rela_p);
+ }
+}
+
+/* Implement elf_backend_final_write_processing for VxWorks. */
+
+static void
+mips_vxworks_final_write_processing (bfd *abfd, bfd_boolean linker)
+{
+ _bfd_mips_elf_final_write_processing (abfd, linker);
+ elf_vxworks_final_write_processing (abfd, linker);
+}
+
+#undef TARGET_LITTLE_SYM
+#undef TARGET_LITTLE_NAME
+#undef TARGET_BIG_SYM
+#undef TARGET_BIG_NAME
+
+#undef ELF_MAXPAGESIZE
+#undef ELF_COMMONPAGESIZE
+
+#define TARGET_LITTLE_SYM bfd_elf32_littlemips_vxworks_vec
+#define TARGET_LITTLE_NAME "elf32-littlemips-vxworks"
+#define TARGET_BIG_SYM bfd_elf32_bigmips_vxworks_vec
+#define TARGET_BIG_NAME "elf32-bigmips-vxworks"
+
+#undef elf32_bed
+#define elf32_bed elf32_mips_vxworks_bed
+
+#define ELF_MAXPAGESIZE 0x1000
+#define ELF_COMMONPAGESIZE 0x1000
+
+#undef elf_backend_want_got_plt
+#define elf_backend_want_got_plt 1
+#undef elf_backend_want_plt_sym
+#define elf_backend_want_plt_sym 1
+#undef elf_backend_got_symbol_offset
+#define elf_backend_got_symbol_offset 0
+#undef elf_backend_want_dynbss
+#define elf_backend_want_dynbss 1
+#undef elf_backend_may_use_rel_p
+#define elf_backend_may_use_rel_p 0
+#undef elf_backend_may_use_rela_p
+#define elf_backend_may_use_rela_p 1
+#undef elf_backend_default_use_rela_p
+#define elf_backend_default_use_rela_p 1
+#undef elf_backend_got_header_size
+#define elf_backend_got_header_size (4 * 3)
+#undef elf_backend_plt_readonly
+#define elf_backend_plt_readonly 1
+
+#undef bfd_elf32_bfd_reloc_type_lookup
+#define bfd_elf32_bfd_reloc_type_lookup \
+ mips_vxworks_bfd_reloc_type_lookup
+#undef bfd_elf32_bfd_reloc_name_lookup
+#define bfd_elf32_bfd_reloc_name_lookup \
+ mips_vxworks_bfd_reloc_name_lookup
+#undef elf_backend_mips_rtype_to_howto
+#define elf_backend_mips_rtype_to_howto \
+ mips_vxworks_rtype_to_howto
+#undef elf_backend_adjust_dynamic_symbol
+#define elf_backend_adjust_dynamic_symbol \
+ _bfd_mips_vxworks_adjust_dynamic_symbol
+#undef elf_backend_finish_dynamic_symbol
+#define elf_backend_finish_dynamic_symbol \
+ _bfd_mips_vxworks_finish_dynamic_symbol
+#undef bfd_elf32_bfd_link_hash_table_create
+#define bfd_elf32_bfd_link_hash_table_create \
+ _bfd_mips_vxworks_link_hash_table_create
+#undef elf_backend_add_symbol_hook
+#define elf_backend_add_symbol_hook \
+ elf_vxworks_add_symbol_hook
+#undef elf_backend_link_output_symbol_hook
+#define elf_backend_link_output_symbol_hook \
+ elf_vxworks_link_output_symbol_hook
+#undef elf_backend_emit_relocs
+#define elf_backend_emit_relocs \
+ elf_vxworks_emit_relocs
+#undef elf_backend_final_write_processing
+#define elf_backend_final_write_processing \
+ mips_vxworks_final_write_processing
+
+#undef elf_backend_additional_program_headers
+#undef elf_backend_modify_segment_map
+#undef elf_backend_symbol_processing
+/* NOTE: elf_backend_rela_normal is not defined for MIPS. */
+
+#include "elf32-target.h"
diff --git a/contrib/binutils/bfd/elf32-ppc.c b/contrib/binutils/bfd/elf32-ppc.c
index 4eb08ad..d67ad86 100644
--- a/contrib/binutils/bfd/elf32-ppc.c
+++ b/contrib/binutils/bfd/elf32-ppc.c
@@ -1,6 +1,6 @@
/* PowerPC-specific support for 32-bit ELF
Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
- 2004 Free Software Foundation, Inc.
+ 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
Written by Ian Lance Taylor, Cygnus Support.
This file is part of BFD, the Binary File Descriptor library.
@@ -17,21 +17,23 @@
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. */
+ Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor,
+ Boston, MA 02110-1301, 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 <stdarg.h>
+#include "bfd.h"
#include "bfdlink.h"
#include "libbfd.h"
#include "elf-bfd.h"
#include "elf/ppc.h"
#include "elf32-ppc.h"
+#include "elf-vxworks.h"
/* RELA relocations are used here. */
@@ -51,296 +53,109 @@ static bfd_reloc_status_type ppc_elf_unhandled_reloc
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
+/* For old-style PLT. */
/* 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;
+/* For new-style .glink and .plt. */
+#define GLINK_PLTRESOLVE 16*4
+#define GLINK_ENTRY_SIZE 4*4
- if (ind->root.type == bfd_link_hash_indirect)
- abort ();
+/* VxWorks uses its own plt layout, filled in by the static linker. */
- /* 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;
- }
+/* The standard VxWorks PLT entry. */
+#define VXWORKS_PLT_ENTRY_SIZE 32
+static const bfd_vma ppc_elf_vxworks_plt_entry
+ [VXWORKS_PLT_ENTRY_SIZE / 4] =
+ {
+ 0x3d800000, /* lis r12,0 */
+ 0x818c0000, /* lwz r12,0(r12) */
+ 0x7d8903a6, /* mtctr r12 */
+ 0x4e800420, /* bctr */
+ 0x39600000, /* li r11,0 */
+ 0x48000000, /* b 14 <.PLT0resolve+0x4> */
+ 0x60000000, /* nop */
+ 0x60000000, /* nop */
+ };
+static const bfd_vma ppc_elf_vxworks_pic_plt_entry
+ [VXWORKS_PLT_ENTRY_SIZE / 4] =
+ {
+ 0x3d9e0000, /* addis r12,r30,0 */
+ 0x818c0000, /* lwz r12,0(r12) */
+ 0x7d8903a6, /* mtctr r12 */
+ 0x4e800420, /* bctr */
+ 0x39600000, /* li r11,0 */
+ 0x48000000, /* b 14 <.PLT0resolve+0x4> 14: R_PPC_REL24 .PLTresolve */
+ 0x60000000, /* nop */
+ 0x60000000, /* nop */
+ };
- edir->dyn_relocs = eind->dyn_relocs;
- eind->dyn_relocs = NULL;
- }
+/* The initial VxWorks PLT entry. */
+#define VXWORKS_PLT_INITIAL_ENTRY_SIZE 32
+static const bfd_vma ppc_elf_vxworks_plt0_entry
+ [VXWORKS_PLT_INITIAL_ENTRY_SIZE / 4] =
+ {
+ 0x3d800000, /* lis r12,0 */
+ 0x398c0000, /* addi r12,r12,0 */
+ 0x800c0008, /* lwz r0,8(r12) */
+ 0x7c0903a6, /* mtctr r0 */
+ 0x818c0004, /* lwz r12,4(r12) */
+ 0x4e800420, /* bctr */
+ 0x60000000, /* nop */
+ 0x60000000, /* nop */
+ };
+static const bfd_vma ppc_elf_vxworks_pic_plt0_entry
+ [VXWORKS_PLT_INITIAL_ENTRY_SIZE / 4] =
+ {
+ 0x819e0008, /* lwz r12,8(r30) */
+ 0x7d8903a6, /* mtctr r12 */
+ 0x819e0004, /* lwz r12,4(r30) */
+ 0x4e800420, /* bctr */
+ 0x60000000, /* nop */
+ 0x60000000, /* nop */
+ 0x60000000, /* nop */
+ 0x60000000, /* nop */
+ };
- edir->tls_mask |= eind->tls_mask;
+/* For executables, we have some additional relocations in
+ .rela.plt.unloaded, for the kernel loader. */
+
+/* The number of non-JMP_SLOT relocations per PLT0 slot. */
+#define VXWORKS_PLT_NON_JMP_SLOT_RELOCS 3
+/* The number of relocations in the PLTResolve slot. */
+#define VXWORKS_PLTRESOLVE_RELOCS 2
+/* The number of relocations in the PLTResolve slot when when creating
+ a shared library. */
+#define VXWORKS_PLTRESOLVE_RELOCS_SHLIB 0
+
+/* Some instructions. */
+#define ADDIS_11_11 0x3d6b0000
+#define ADDIS_11_30 0x3d7e0000
+#define ADDIS_12_12 0x3d8c0000
+#define ADDI_11_11 0x396b0000
+#define ADD_0_11_11 0x7c0b5a14
+#define ADD_11_0_11 0x7d605a14
+#define B 0x48000000
+#define BCL_20_31 0x429f0005
+#define BCTR 0x4e800420
+#define LIS_11 0x3d600000
+#define LIS_12 0x3d800000
+#define LWZU_0_12 0x840c0000
+#define LWZ_0_12 0x800c0000
+#define LWZ_11_11 0x816b0000
+#define LWZ_11_30 0x817e0000
+#define LWZ_12_12 0x818c0000
+#define MFLR_0 0x7c0802a6
+#define MFLR_12 0x7d8802a6
+#define MTCTR_0 0x7c0903a6
+#define MTCTR_11 0x7d6903a6
+#define MTLR_0 0x7c0803a6
+#define NOP 0x60000000
+#define SUB_11_11_12 0x7d6c5850
- 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);
-}
+/* Offset of tp and dtp pointers from start of TLS block. */
+#define TP_OFFSET 0x7000
+#define DTP_OFFSET 0x8000
static reloc_howto_type *ppc_elf_howto_table[R_PPC_max];
@@ -1532,34 +1347,66 @@ static reloc_howto_type ppc_elf_howto_raw[] = {
0xffff, /* dst_mask */
FALSE), /* pcrel_offset */
- /* Phony relocs to handle branch stubs. */
- HOWTO (R_PPC_RELAX32, /* type */
+ /* A 16 bit relative relocation. */
+ HOWTO (R_PPC_REL16, /* type */
0, /* rightshift */
- 0, /* size */
- 0, /* bitsize */
- FALSE, /* pc_relative */
+ 1, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ TRUE, /* pc_relative */
0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
+ complain_overflow_bitfield, /* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
- "R_PPC_RELAX32", /* name */
+ "R_PPC_REL16", /* name */
FALSE, /* partial_inplace */
0, /* src_mask */
- 0, /* dst_mask */
- FALSE), /* pcrel_offset */
+ 0xffff, /* dst_mask */
+ TRUE), /* pcrel_offset */
- HOWTO (R_PPC_RELAX32PC, /* type */
+ /* A 16 bit relative relocation without overflow. */
+ HOWTO (R_PPC_REL16_LO, /* type */
0, /* rightshift */
- 0, /* size */
- 0, /* bitsize */
- FALSE, /* pc_relative */
+ 1, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ TRUE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont,/* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_PPC_REL16_LO", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0xffff, /* dst_mask */
+ TRUE), /* pcrel_offset */
+
+ /* The high order 16 bits of a relative address. */
+ HOWTO (R_PPC_REL16_HI, /* type */
+ 16, /* rightshift */
+ 1, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ TRUE, /* pc_relative */
0, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
- "R_PPC_RELAX32PC", /* name */
+ "R_PPC_REL16_HI", /* name */
FALSE, /* partial_inplace */
0, /* src_mask */
- 0, /* dst_mask */
- FALSE), /* pcrel_offset */
+ 0xffff, /* dst_mask */
+ TRUE), /* pcrel_offset */
+
+ /* The high order 16 bits of a relative address, plus 1 if the contents of
+ the low 16 bits, treated as a signed number, is negative. */
+ HOWTO (R_PPC_REL16_HA, /* type */
+ 16, /* rightshift */
+ 1, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ TRUE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ ppc_elf_addr16_ha_reloc, /* special_function */
+ "R_PPC_REL16_HA", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0xffff, /* dst_mask */
+ TRUE), /* pcrel_offset */
/* GNU extension to record C++ vtable hierarchy. */
HOWTO (R_PPC_GNU_VTINHERIT, /* type */
@@ -1625,381 +1472,7 @@ ppc_elf_howto_init (void)
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)
@@ -2094,6 +1567,10 @@ ppc_elf_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED,
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_16_PCREL: r = R_PPC_REL16; break;
+ case BFD_RELOC_LO16_PCREL: r = R_PPC_REL16_LO; break;
+ case BFD_RELOC_HI16_PCREL: r = R_PPC_REL16_HI; break;
+ case BFD_RELOC_HI16_S_PCREL: r = R_PPC_REL16_HA; break;
case BFD_RELOC_VTABLE_INHERIT: r = R_PPC_GNU_VTINHERIT; break;
case BFD_RELOC_VTABLE_ENTRY: r = R_PPC_GNU_VTENTRY; break;
}
@@ -2101,6 +1578,22 @@ ppc_elf_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED,
return ppc_elf_howto_table[r];
};
+static reloc_howto_type *
+ppc_elf_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED,
+ const char *r_name)
+{
+ unsigned int i;
+
+ for (i = 0;
+ i < sizeof (ppc_elf_howto_raw) / sizeof (ppc_elf_howto_raw[0]);
+ i++)
+ if (ppc_elf_howto_raw[i].name != NULL
+ && strcasecmp (ppc_elf_howto_raw[i].name, r_name) == 0)
+ return &ppc_elf_howto_raw[i];
+
+ return NULL;
+}
+
/* Set the howto pointer for a PowerPC ELF reloc. */
static void
@@ -2114,9 +1607,20 @@ ppc_elf_info_to_howto (bfd *abfd ATTRIBUTE_UNUSED,
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)];
+
+ /* Just because the above assert didn't trigger doesn't mean that
+ ELF32_R_TYPE (dst->r_info) is necessarily a valid relocation. */
+ if (!cache_ptr->howto)
+ {
+ (*_bfd_error_handler) (_("%B: invalid relocation type %d"),
+ abfd, ELF32_R_TYPE (dst->r_info));
+ bfd_set_error (bfd_error_bad_value);
+
+ cache_ptr->howto = ppc_elf_howto_table[R_PPC_NONE];
+ }
}
-/* Handle the R_PPC_ADDR16_HA reloc. */
+/* Handle the R_PPC_ADDR16_HA and R_PPC_REL16_HA relocs. */
static bfd_reloc_status_type
ppc_elf_addr16_ha_reloc (bfd *abfd ATTRIBUTE_UNUSED,
@@ -2135,7 +1639,7 @@ ppc_elf_addr16_ha_reloc (bfd *abfd ATTRIBUTE_UNUSED,
return bfd_reloc_ok;
}
- if (reloc_entry->address > input_section->_cooked_size)
+ if (reloc_entry->address > bfd_get_section_limit (abfd, input_section))
return bfd_reloc_outofrange;
if (bfd_is_com_section (symbol->section))
@@ -2146,6 +1650,8 @@ ppc_elf_addr16_ha_reloc (bfd *abfd ATTRIBUTE_UNUSED,
relocation += symbol->section->output_section->vma;
relocation += symbol->section->output_offset;
relocation += reloc_entry->addend;
+ if (reloc_entry->howto->pc_relative)
+ relocation -= reloc_entry->address;
reloc_entry->addend += (relocation & 0x8000) << 1;
@@ -2177,6 +1683,72 @@ ppc_elf_unhandled_reloc (bfd *abfd,
}
return bfd_reloc_dangerous;
}
+
+/* Sections created by the linker. */
+
+typedef struct elf_linker_section
+{
+ /* Pointer to the bfd section. */
+ asection *section;
+ /* Section name. */
+ const char *name;
+ /* Associated bss section name. */
+ const char *bss_name;
+ /* Associated symbol name. */
+ const char *sym_name;
+ /* Associated symbol. */
+ struct elf_link_hash_entry *sym;
+} 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;
+} 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;
+
+ /* Flags used to auto-detect plt type. */
+ unsigned int makes_plt_call : 1;
+ unsigned int has_rel16 : 1;
+};
+
+#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)
+{
+ if (abfd->tdata.any == NULL)
+ {
+ 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 bfd_elf_mkobject (abfd);
+}
/* Fix bad default arch selected for a 32 bit input bfd when the
default is 64 bit. */
@@ -2211,110 +1783,139 @@ ppc_elf_set_private_flags (bfd *abfd, flagword flags)
return TRUE;
}
-/* Merge backend specific data from an object file to the output
- object file when linking. */
+/* Support for core dump NOTE sections. */
static bfd_boolean
-ppc_elf_merge_private_bfd_data (bfd *ibfd, bfd *obfd)
+ppc_elf_grok_prstatus (bfd *abfd, Elf_Internal_Note *note)
{
- flagword old_flags;
- flagword new_flags;
- bfd_boolean error;
+ int offset;
+ unsigned int size;
- /* Check if we have the same endianess. */
- if (! _bfd_generic_verify_endian_match (ibfd, obfd))
- return FALSE;
+ switch (note->descsz)
+ {
+ default:
+ return FALSE;
- if (bfd_get_flavour (ibfd) != bfd_target_elf_flavour
- || bfd_get_flavour (obfd) != bfd_target_elf_flavour)
- return TRUE;
+ case 268: /* Linux/PPC. */
+ /* pr_cursig */
+ elf_tdata (abfd)->core_signal = bfd_get_16 (abfd, note->descdata + 12);
- 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;
+ /* pr_pid */
+ elf_tdata (abfd)->core_pid = bfd_get_32 (abfd, note->descdata + 24);
+
+ /* pr_reg */
+ offset = 72;
+ size = 192;
+
+ break;
}
- /* Compatible flags are ok. */
- else if (new_flags == old_flags)
- ;
+ /* Make a ".reg/999" section. */
+ return _bfd_elfcore_make_pseudosection (abfd, ".reg",
+ size, note->descpos + offset);
+}
- /* Incompatible flags. */
- else
+static bfd_boolean
+ppc_elf_grok_psinfo (bfd *abfd, Elf_Internal_Note *note)
+{
+ switch (note->descsz)
{
- /* 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));
- }
+ default:
+ return FALSE;
- /* 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;
+ 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);
+ }
- /* 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;
+ /* 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. */
- /* 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);
+ {
+ char *command = elf_tdata (abfd)->core_command;
+ int n = strlen (command);
- new_flags &= ~(EF_PPC_RELOCATABLE | EF_PPC_RELOCATABLE_LIB | EF_PPC_EMB);
- old_flags &= ~(EF_PPC_RELOCATABLE | EF_PPC_RELOCATABLE_LIB | EF_PPC_EMB);
+ if (0 < n && command[n - 1] == ' ')
+ command[n - 1] = '\0';
+ }
- /* 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);
- }
+ return TRUE;
+}
- if (error)
- {
- bfd_set_error (bfd_error_bad_value);
- return FALSE;
- }
+static char *
+ppc_elf_write_core_note (bfd *abfd, char *buf, int *bufsiz, int note_type, ...)
+{
+ switch (note_type)
+ {
+ default:
+ return NULL;
+
+ case NT_PRPSINFO:
+ {
+ char data[128];
+ va_list ap;
+
+ va_start (ap, note_type);
+ memset (data, 0, 32);
+ strncpy (data + 32, va_arg (ap, const char *), 16);
+ strncpy (data + 48, va_arg (ap, const char *), 80);
+ va_end (ap);
+ return elfcore_write_note (abfd, buf, bufsiz,
+ "CORE", note_type, data, sizeof (data));
+ }
+
+ case NT_PRSTATUS:
+ {
+ char data[268];
+ va_list ap;
+ long pid;
+ int cursig;
+ const void *greg;
+
+ va_start (ap, note_type);
+ memset (data, 0, 72);
+ pid = va_arg (ap, long);
+ bfd_put_32 (abfd, pid, data + 24);
+ cursig = va_arg (ap, int);
+ bfd_put_16 (abfd, cursig, data + 12);
+ greg = va_arg (ap, const void *);
+ memcpy (data + 72, greg, 192);
+ memset (data + 264, 0, 4);
+ va_end (ap);
+ return elfcore_write_note (abfd, buf, bufsiz,
+ "CORE", note_type, data, sizeof (data));
+ }
}
+}
- return TRUE;
+/* Return address for Ith PLT stub in section PLT, for relocation REL
+ or (bfd_vma) -1 if it should not be included. */
+
+static bfd_vma
+ppc_elf_plt_sym_val (bfd_vma i ATTRIBUTE_UNUSED,
+ const asection *plt ATTRIBUTE_UNUSED,
+ const arelent *rel)
+{
+ return rel->address;
}
-
+
/* Handle a PowerPC specific section when reading an object file. This
- is called when elfcode.h finds a section with an unknown type. */
+ is called when bfd_section_from_shdr finds a section with an unknown
+ type. */
static bfd_boolean
-ppc_elf_section_from_shdr (bfd *abfd, Elf_Internal_Shdr *hdr, const char *name)
+ppc_elf_section_from_shdr (bfd *abfd,
+ Elf_Internal_Shdr *hdr,
+ const char *name,
+ int shindex)
{
asection *newsect;
flagword flags;
- if (! _bfd_elf_make_section_from_shdr (abfd, hdr, name))
+ if (! _bfd_elf_make_section_from_shdr (abfd, hdr, name, shindex))
return FALSE;
newsect = hdr->bfd_section;
@@ -2328,7 +1929,7 @@ ppc_elf_section_from_shdr (bfd *abfd, Elf_Internal_Shdr *hdr, const char *name)
bfd_set_section_flags (abfd, newsect, flags);
return TRUE;
}
-
+
/* Set up any other section flags and such that may be necessary. */
static bfd_boolean
@@ -2336,7 +1937,7 @@ ppc_elf_fake_sections (bfd *abfd ATTRIBUTE_UNUSED,
Elf_Internal_Shdr *shdr,
asection *asect)
{
- if ((asect->flags & SEC_EXCLUDE) != 0)
+ if ((asect->flags & (SEC_GROUP | SEC_EXCLUDE)) == SEC_EXCLUDE)
shdr->sh_flags |= SHF_EXCLUDE;
if ((asect->flags & SEC_SORT_ENTRIES) != 0)
@@ -2344,402 +1945,596 @@ ppc_elf_fake_sections (bfd *abfd ATTRIBUTE_UNUSED,
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)
+/* If we have .sbss2 or .PPC.EMB.sbss0 output sections, we
+ need to bump up the number of section headers. */
+
+static int
+ppc_elf_additional_program_headers (bfd *abfd,
+ struct bfd_link_info *info ATTRIBUTE_UNUSED)
{
- for ( ; linker_pointers != NULL; linker_pointers = linker_pointers->next)
- if (lsect == linker_pointers->lsect && addend == linker_pointers->addend)
- return linker_pointers;
+ asection *s;
+ int ret = 0;
- return NULL;
+ s = bfd_get_section_by_name (abfd, ".sbss2");
+ if (s != NULL && (s->flags & SEC_ALLOC) != 0)
+ ++ret;
+
+ s = bfd_get_section_by_name (abfd, ".PPC.EMB.sbss0");
+ if (s != NULL && (s->flags & SEC_ALLOC) != 0)
+ ++ret;
+
+ return ret;
}
-
-/* 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)
+/* 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 const struct bfd_elf_special_section ppc_elf_special_sections[] =
{
- 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;
+ { STRING_COMMA_LEN (".plt"), 0, SHT_NOBITS, SHF_ALLOC + SHF_EXECINSTR },
+ { STRING_COMMA_LEN (".sbss"), -2, SHT_NOBITS, SHF_ALLOC + SHF_WRITE },
+ { STRING_COMMA_LEN (".sbss2"), -2, SHT_PROGBITS, SHF_ALLOC },
+ { STRING_COMMA_LEN (".sdata"), -2, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE },
+ { STRING_COMMA_LEN (".sdata2"), -2, SHT_PROGBITS, SHF_ALLOC },
+ { STRING_COMMA_LEN (".tags"), 0, SHT_ORDERED, SHF_ALLOC },
+ { STRING_COMMA_LEN (".PPC.EMB.apuinfo"), 0, SHT_NOTE, 0 },
+ { STRING_COMMA_LEN (".PPC.EMB.sbss0"), 0, SHT_PROGBITS, SHF_ALLOC },
+ { STRING_COMMA_LEN (".PPC.EMB.sdata0"), 0, SHT_PROGBITS, SHF_ALLOC },
+ { NULL, 0, 0, 0, 0 }
+};
- BFD_ASSERT (lsect != NULL);
+/* This is what we want for new plt/got. */
+static struct bfd_elf_special_section ppc_alt_plt =
+ { STRING_COMMA_LEN (".plt"), 0, SHT_PROGBITS, SHF_ALLOC };
- /* Is this a global symbol? */
- if (h != NULL)
+static const struct bfd_elf_special_section *
+ppc_elf_get_sec_type_attr (bfd *abfd ATTRIBUTE_UNUSED, asection *sec)
+{
+ const struct bfd_elf_special_section *ssect;
+
+ /* See if this is one of the special sections. */
+ if (sec->name == NULL)
+ return NULL;
+
+ ssect = _bfd_elf_get_special_section (sec->name, ppc_elf_special_sections,
+ sec->use_rela_p);
+ if (ssect != NULL)
{
- struct ppc_elf_link_hash_entry *eh;
+ if (ssect == ppc_elf_special_sections && (sec->flags & SEC_LOAD) != 0)
+ ssect = &ppc_alt_plt;
+ return ssect;
+ }
- /* 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;
+ return _bfd_elf_get_sec_type_attr (abfd, sec);
+}
+
+/* Very simple linked list structure for recording apuinfo values. */
+typedef struct apuinfo_list
+{
+ struct apuinfo_list *next;
+ unsigned long value;
+}
+apuinfo_list;
- 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;
- }
+static apuinfo_list *head;
- if (lsect->rel_section)
- lsect->rel_section->_raw_size += sizeof (Elf32_External_Rela);
+
+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;
}
- else
+
+ 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;)
{
- /* Allocation of a pointer to a local symbol. */
- elf_linker_section_pointers_t **ptr = elf_local_ptr_offsets (abfd);
+ apuinfo_list *next = entry->next;
+ free (entry);
+ entry = next;
+ }
- /* Allocate a table to hold the local symbols if first time. */
- if (!ptr)
- {
- unsigned int num_symbols = elf_tdata (abfd)->symtab_hdr.sh_info;
+ head = NULL;
+}
- amt = num_symbols;
- amt *= sizeof (elf_linker_section_pointers_t *);
- ptr = bfd_zalloc (abfd, amt);
+#define APUINFO_SECTION_NAME ".PPC.EMB.apuinfo"
+#define APUINFO_LABEL "APUinfo"
- if (!ptr)
- return FALSE;
+/* Scan the input BFDs and create a linked list of
+ the APUinfo values that will need to be emitted. */
- elf_local_ptr_offsets (abfd) = ptr;
+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->size;
}
+ }
- /* 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;
+ /* We need at least one input sections
+ in order to make merging worthwhile. */
+ if (num_input_sections < 1)
+ return;
- ptr_linker_section_ptr = &ptr[r_symndx];
+ /* Just make sure that the output section exists as well. */
+ asec = bfd_get_section_by_name (abfd, APUINFO_SECTION_NAME);
+ if (asec == NULL)
+ return;
- if (info->shared)
+ /* 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->size;
+ if (length < 24)
+ {
+ error_message = _("corrupt or empty %s section in %B");
+ goto fail;
+ }
+
+ if (bfd_seek (ibfd, asec->filepos, SEEK_SET) != 0
+ || (bfd_bread (buffer + offset, length, ibfd) != length))
{
- /* 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);
+ error_message = _("unable to read in %s section from %B");
+ goto fail;
}
+
+ /* Process the contents of the section. */
+ ptr = buffer + offset;
+ error_message = _("corrupt %s section in %B");
+
+ /* 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;
}
- /* 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);
+ error_message = NULL;
- if (!linker_section_ptr)
- return FALSE;
+ /* Compute the size of the output section. */
+ num_entries = apuinfo_list_length ();
+ output_section_size = 20 + num_entries * 4;
- 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;
+ asec = bfd_get_section_by_name (abfd, APUINFO_SECTION_NAME);
- linker_section_ptr->offset = lsect->section->_raw_size;
- lsect->section->_raw_size += 4;
+ if (! bfd_set_section_size (abfd, asec, output_section_size))
+ ibfd = abfd,
+ error_message = _("warning: unable to set size of %s section in %B");
-#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
+ fail:
+ free (buffer);
- return TRUE;
+ if (error_message)
+ (*_bfd_error_handler) (error_message, ibfd, APUINFO_SECTION_NAME);
}
-
-#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. */
+/* Prevent the output section from accumulating the input sections'
+ contents. We have already stored this in our linked list structure. */
-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)
+static bfd_boolean
+ppc_elf_write_section (bfd *abfd ATTRIBUTE_UNUSED,
+ struct bfd_link_info *link_info ATTRIBUTE_UNUSED,
+ asection *asec,
+ bfd_byte *contents ATTRIBUTE_UNUSED)
{
- elf_linker_section_pointers_t *linker_section_ptr;
+ return (apuinfo_list_length ()
+ && strcmp (asec->name, APUINFO_SECTION_NAME) == 0);
+}
- BFD_ASSERT (lsect != NULL);
+/* Finally we can generate the output section. */
- if (h != NULL)
- {
- /* Handle global symbol. */
- struct ppc_elf_link_hash_entry *eh;
+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;
- eh = (struct ppc_elf_link_hash_entry *) h;
- linker_section_ptr
- = elf_find_pointer_linker_section (eh->linker_section_pointer,
- rel->r_addend,
- lsect);
+ asec = bfd_get_section_by_name (abfd, APUINFO_SECTION_NAME);
+ if (asec == NULL)
+ return;
- BFD_ASSERT (linker_section_ptr != NULL);
+ if (apuinfo_list_length () == 0)
+ return;
- 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));
- }
- }
+ length = asec->size;
+ if (length < 20)
+ return;
+
+ buffer = bfd_malloc (length);
+ if (buffer == NULL)
+ {
+ (*_bfd_error_handler)
+ (_("failed to allocate space for new APUinfo section."));
+ return;
}
- else
+
+ /* 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 ((char *) buffer + 12, APUINFO_LABEL);
+
+ length = 20;
+ for (i = 0; i < num_entries; i++)
{
- /* 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_put_32 (abfd, apuinfo_list_element (i), buffer + length);
+ length += 4;
+ }
- BFD_ASSERT (linker_section_ptr != NULL);
+ if (length != asec->size)
+ (*_bfd_error_handler) (_("failed to compute new APUinfo section."));
- /* 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 (! bfd_set_section_contents (abfd, asec, buffer, (file_ptr) 0, length))
+ (*_bfd_error_handler) (_("failed to install new APUinfo section."));
- if (info->shared)
- {
- /* We need to generate a relative reloc for the dynamic
- linker. */
+ free (buffer);
- 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;
+ apuinfo_list_finish ();
+}
+
+/* The following functions are specific to the ELF linker, while
+ functions above are used generally. They appear in this file more
+ or less in the order in which they are called. eg.
+ ppc_elf_check_relocs is called early in the link process,
+ ppc_elf_finish_dynamic_sections is one of the last functions
+ called. */
- BFD_ASSERT (srel != NULL);
+/* 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. */
- 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);
- }
- }
- }
+struct ppc_elf_dyn_relocs
+{
+ struct ppc_elf_dyn_relocs *next;
- relocation = (lsect->section->output_offset
- + linker_section_ptr->offset
- - lsect->sym_offset);
+ /* The input section of the reloc. */
+ asection *sec;
-#ifdef DEBUG
- fprintf (stderr,
- "Finish pointer in linker section %s, offset = %ld (0x%lx)\n",
- lsect->name, (long) relocation, (long) relocation);
-#endif
+ /* Total number of relocs copied for the input section. */
+ bfd_size_type count;
- /* 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)
+ /* Number of pc-relative relocs copied for the input section. */
+ bfd_size_type pc_count;
+};
+
+/* Track PLT entries needed for a given symbol. We might need more
+ than one glink entry per symbol. */
+struct plt_entry
{
- 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;
+ struct plt_entry *next;
- /* Both of these sections are (technically) created by the user
- putting data in them, so they shouldn't be marked
- SEC_LINKER_CREATED.
+ /* -fPIC uses multiple GOT sections, one per file, called ".got2".
+ This field stores the offset into .got2 used to initialise the
+ GOT pointer reg. It will always be at least 32768 (and for
+ current gcc this is the only offset used). */
+ bfd_vma addend;
- 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;
+ /* The .got2 section. */
+ asection *sec;
- switch (which)
+ /* PLT refcount or offset. */
+ union
{
- default:
- abort ();
- return NULL;
+ bfd_signed_vma refcount;
+ bfd_vma offset;
+ } plt;
- case LINKER_SECTION_SDATA: /* .sdata/.sbss section */
- name = ".sdata";
- rel_name = ".rela.sdata";
- sym_name = "_SDA_BASE_";
- break;
+ /* .glink stub offset. */
+ bfd_vma glink_offset;
+};
- case LINKER_SECTION_SDATA2: /* .sdata2/.sbss2 section */
- name = ".sdata2";
- rel_name = ".rela.sdata2";
- sym_name = "_SDA2_BASE_";
- flags |= SEC_READONLY;
- break;
- }
+/* 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. */
- /* Record the first bfd that needs the special sections. */
- if (!htab->elf.dynobj)
- htab->elf.dynobj = abfd;
+#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)
- amt = sizeof (elf_linker_section_t);
- lsect = bfd_zalloc (htab->elf.dynobj, amt);
+/* 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
- lsect->sym_offset = sym_offset;
+/* PPC ELF linker hash entry. */
- /* 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;
+struct ppc_elf_link_hash_entry
+{
+ struct elf_link_hash_entry elf;
- if (bfd_get_section_alignment (htab->elf.dynobj, s) < 2
- && !bfd_set_section_alignment (htab->elf.dynobj, s, 2))
- return NULL;
+ /* 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;
- s->_raw_size = align_power (s->_raw_size, 2);
+ /* Track dynamic relocs copied for this symbol. */
+ struct ppc_elf_dyn_relocs *dyn_relocs;
-#ifdef DEBUG
- fprintf (stderr, "Creating section %s, current size = %ld\n",
- name, (long) s->_raw_size);
-#endif
+ /* 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;
- if (sym_name)
- {
- struct elf_link_hash_entry *h;
- struct bfd_link_hash_entry *bh;
+ /* Nonzero if we have seen a small data relocation referring to this
+ symbol. */
+ unsigned char has_sda_refs;
+};
-#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);
+#define ppc_elf_hash_entry(ent) ((struct ppc_elf_link_hash_entry *) (ent))
- 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;
+/* PPC ELF linker hash table. */
- h->type = STT_OBJECT;
- lsect->sym_hash = h;
+struct ppc_elf_link_hash_table
+{
+ struct elf_link_hash_table elf;
- if (info->shared
- && ! bfd_elf_link_record_dynamic_symbol (info, h))
- return NULL;
+ /* Short-cuts to get to dynamic linker sections. */
+ asection *got;
+ asection *relgot;
+ asection *glink;
+ asection *plt;
+ asection *relplt;
+ asection *dynbss;
+ asection *relbss;
+ asection *dynsbss;
+ asection *relsbss;
+ elf_linker_section_t sdata[2];
+ asection *sbss;
+
+ /* The (unloaded but important) .rela.plt.unloaded on VxWorks. */
+ asection *srelplt2;
+
+ /* The .got.plt section (VxWorks only)*/
+ asection *sgotplt;
+
+ /* Shortcut to .__tls_get_addr. */
+ struct elf_link_hash_entry *tls_get_addr;
+
+ /* The bfd that forced an old-style PLT. */
+ bfd *old_bfd;
+
+ /* TLS local dynamic got entry handling. */
+ union {
+ bfd_signed_vma refcount;
+ bfd_vma offset;
+ } tlsld_got;
+
+ /* Offset of PltResolve function in glink. */
+ bfd_vma glink_pltresolve;
+
+ /* Size of reserved GOT entries. */
+ unsigned int got_header_size;
+ /* Non-zero if allocating the header left a gap. */
+ unsigned int got_gap;
+
+ /* The type of PLT we have chosen to use. */
+ enum ppc_elf_plt_type plt_type;
+
+ /* Set if we should emit symbols for stubs. */
+ unsigned int emit_stub_syms:1;
+
+ /* True if the target system is VxWorks. */
+ unsigned int is_vxworks:1;
+
+ /* The size of PLT entries. */
+ int plt_entry_size;
+ /* The distance between adjacent PLT slots. */
+ int plt_slot_size;
+ /* The size of the first PLT entry. */
+ int plt_initial_entry_size;
+
+ /* 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;
}
- if (info->shared)
+ /* Call the allocation method of the superclass. */
+ entry = _bfd_elf_link_hash_newfunc (entry, table, string);
+ if (entry != NULL)
{
- 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;
+ 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 lsect;
+ return entry;
}
-
-/* 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)
+/* Create a PPC ELF linker hash table. */
+
+static struct bfd_link_hash_table *
+ppc_elf_link_hash_table_create (bfd *abfd)
{
- asection *s;
- int ret;
+ struct ppc_elf_link_hash_table *ret;
- ret = 0;
+ ret = bfd_zmalloc (sizeof (struct ppc_elf_link_hash_table));
+ if (ret == NULL)
+ return NULL;
- s = bfd_get_section_by_name (abfd, ".interp");
- if (s != NULL)
- ++ret;
+ if (!_bfd_elf_link_hash_table_init (&ret->elf, abfd,
+ ppc_elf_link_hash_newfunc,
+ sizeof (struct ppc_elf_link_hash_entry)))
+ {
+ free (ret);
+ return NULL;
+ }
- s = bfd_get_section_by_name (abfd, ".sbss2");
- if (s != NULL && (s->flags & SEC_LOAD) != 0 && s->_raw_size > 0)
- ++ret;
+ ret->elf.init_plt_refcount.refcount = 0;
+ ret->elf.init_plt_refcount.glist = NULL;
+ ret->elf.init_plt_offset.offset = 0;
+ ret->elf.init_plt_offset.glist = NULL;
- s = bfd_get_section_by_name (abfd, ".PPC.EMB.sbss0");
- if (s != NULL && (s->flags & SEC_LOAD) != 0 && s->_raw_size > 0)
- ++ret;
+ ret->sdata[0].name = ".sdata";
+ ret->sdata[0].sym_name = "_SDA_BASE_";
+ ret->sdata[0].bss_name = ".sbss";
- return ret;
-}
+ ret->sdata[1].name = ".sdata2";
+ ret->sdata[1].sym_name = "_SDA2_BASE_";
+ ret->sdata[1].bss_name = ".sbss2";
-/* Modify the segment map if needed. */
+ ret->plt_entry_size = 12;
+ ret->plt_slot_size = 8;
+ ret->plt_initial_entry_size = 72;
-static bfd_boolean
-ppc_elf_modify_segment_map (bfd *abfd ATTRIBUTE_UNUSED,
- struct bfd_link_info *info ATTRIBUTE_UNUSED)
-{
- return TRUE;
+ return &ret->elf.root;
}
-
-/* The powerpc .got has a blrl instruction in it. Mark it executable. */
+
+/* Create .got and the related sections. */
static bfd_boolean
ppc_elf_create_got (bfd *abfd, struct bfd_link_info *info)
@@ -2756,17 +2551,26 @@ ppc_elf_create_got (bfd *abfd, struct bfd_link_info *info)
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;
+ if (htab->is_vxworks)
+ {
+ htab->sgotplt = bfd_get_section_by_name (abfd, ".got.plt");
+ if (!htab->sgotplt)
+ abort ();
+ }
+ else
+ {
+ /* The powerpc .got has a blrl instruction in it. Mark it
+ executable. */
+ 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");
+ flags = (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS | SEC_IN_MEMORY
+ | SEC_LINKER_CREATED | SEC_READONLY);
+ htab->relgot = bfd_make_section_with_flags (abfd, ".rela.got", flags);
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;
@@ -2793,714 +2597,357 @@ ppc_elf_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info)
if (!_bfd_elf_create_dynamic_sections (abfd, info))
return FALSE;
- flags = (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS | SEC_IN_MEMORY
- | SEC_LINKER_CREATED);
+ flags = (SEC_ALLOC | SEC_LOAD | SEC_READONLY | 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");
+ s = bfd_make_section_anyway_with_flags (abfd, ".glink", flags | SEC_CODE);
+ htab->glink = s;
if (s == NULL
- || ! bfd_set_section_flags (abfd, s, SEC_ALLOC))
+ || !bfd_set_section_alignment (abfd, s, 4))
+ return FALSE;
+
+ htab->dynbss = bfd_get_section_by_name (abfd, ".dynbss");
+ s = bfd_make_section_with_flags (abfd, ".dynsbss",
+ SEC_ALLOC | SEC_LINKER_CREATED);
+ htab->dynsbss = s;
+ if (s == NULL)
return FALSE;
if (! info->shared)
{
htab->relbss = bfd_get_section_by_name (abfd, ".rela.bss");
- htab->relsbss = s = bfd_make_section (abfd, ".rela.sbss");
+ s = bfd_make_section_with_flags (abfd, ".rela.sbss", flags);
+ htab->relsbss = s;
if (s == NULL
- || ! bfd_set_section_flags (abfd, s, flags | SEC_READONLY)
|| ! bfd_set_section_alignment (abfd, s, 2))
return FALSE;
}
+ if (htab->is_vxworks
+ && !elf_vxworks_create_dynamic_sections (abfd, info, &htab->srelplt2))
+ 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;
+ flags = SEC_ALLOC | SEC_CODE | SEC_LINKER_CREATED;
+ if (htab->plt_type == PLT_VXWORKS)
+ /* The VxWorks PLT is a loaded section with contents. */
+ flags |= SEC_HAS_CONTENTS | SEC_LOAD | SEC_READONLY;
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. */
+/* Copy the extra info we tack onto an elf_link_hash_entry. */
-static bfd_boolean
-ppc_elf_adjust_dynamic_symbol (struct bfd_link_info *info,
- struct elf_link_hash_entry *h)
+static void
+ppc_elf_copy_indirect_symbol (struct bfd_link_info *info,
+ struct elf_link_hash_entry *dir,
+ struct elf_link_hash_entry *ind)
{
- 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
+ struct ppc_elf_link_hash_entry *edir, *eind;
- /* 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)));
+ edir = (struct ppc_elf_link_hash_entry *) dir;
+ eind = (struct ppc_elf_link_hash_entry *) ind;
- /* Deal with function syms. */
- if (h->type == STT_FUNC
- || (h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT) != 0)
+ if (eind->dyn_relocs != NULL)
{
- /* 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))
+ if (edir->dyn_relocs != NULL)
{
- /* 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.
+ struct ppc_elf_dyn_relocs **pp;
+ struct ppc_elf_dyn_relocs *p;
- 2. GC has rendered the entry unused.
+ /* Add reloc counts against the indirect sym to the direct sym
+ list. Merge any entries against the same section. */
+ for (pp = &eind->dyn_relocs; (p = *pp) != NULL; )
+ {
+ struct ppc_elf_dyn_relocs *q;
- 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;
+ 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;
}
- 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;
+ edir->dyn_relocs = eind->dyn_relocs;
+ eind->dyn_relocs = NULL;
}
- /* 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;
+ edir->tls_mask |= eind->tls_mask;
+ edir->has_sda_refs |= eind->has_sda_refs;
+
+ /* If called to transfer flags for a weakdef during processing
+ of elf_adjust_dynamic_symbol, don't copy 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.dynamic_adjusted))
+ edir->elf.non_got_ref |= eind->elf.non_got_ref;
+
+ edir->elf.ref_dynamic |= eind->elf.ref_dynamic;
+ edir->elf.ref_regular |= eind->elf.ref_regular;
+ edir->elf.ref_regular_nonweak |= eind->elf.ref_regular_nonweak;
+ edir->elf.needs_plt |= eind->elf.needs_plt;
+
+ /* 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;
- /* 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;
+ /* Copy over the GOT refcount entries that we may have already seen to
+ the symbol which just became indirect. */
+ edir->elf.got.refcount += eind->elf.got.refcount;
+ eind->elf.got.refcount = 0;
- if (ELIMINATE_COPY_RELOCS)
+ /* And plt entries. */
+ if (eind->elf.plt.plist != NULL)
{
- 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)
+ if (edir->elf.plt.plist != 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. */
+ struct plt_entry **entp;
+ struct plt_entry *ent;
- if (h->size <= elf_gp_size (htab->elf.dynobj))
- s = htab->dynsbss;
- else
- s = htab->dynbss;
- BFD_ASSERT (s != NULL);
+ for (entp = &eind->elf.plt.plist; (ent = *entp) != NULL; )
+ {
+ struct plt_entry *dent;
- /* 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;
+ for (dent = edir->elf.plt.plist; dent != NULL; dent = dent->next)
+ if (dent->sec == ent->sec && 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;
+ }
- 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;
+ edir->elf.plt.plist = eind->elf.plt.plist;
+ eind->elf.plt.plist = NULL;
}
- /* 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 (eind->elf.dynindx != -1)
{
- if (! bfd_set_section_alignment (htab->elf.dynobj, s, power_of_two))
- return FALSE;
+ if (edir->elf.dynindx != -1)
+ _bfd_elf_strtab_delref (elf_hash_table (info)->dynstr,
+ edir->elf.dynstr_index);
+ edir->elf.dynindx = eind->elf.dynindx;
+ edir->elf.dynstr_index = eind->elf.dynstr_index;
+ eind->elf.dynindx = -1;
+ eind->elf.dynstr_index = 0;
}
-
- /* 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. */
+/* Return 1 if target is one of ours. */
static bfd_boolean
-allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf)
+is_ppc_elf_target (const struct bfd_target *targ)
{
- 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;
- }
+ extern const bfd_target bfd_elf32_powerpc_vec;
+ extern const bfd_target bfd_elf32_powerpc_vxworks_vec;
+ extern const bfd_target bfd_elf32_powerpcle_vec;
- /* 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;
+ return (targ == &bfd_elf32_powerpc_vec
+ || targ == &bfd_elf32_powerpc_vxworks_vec
+ || targ == &bfd_elf32_powerpcle_vec);
+}
- /* 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;
- }
+/* 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. */
- eh = (struct ppc_elf_link_hash_entry *) h;
- if (eh->elf.got.refcount > 0)
+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)
+ && is_ppc_elf_target (info->hash->creator))
{
- /* 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. */
+ /* Common symbols less than or equal to -G nn bytes are automatically
+ put into .sbss. */
+ struct ppc_elf_link_hash_table *htab;
- 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))
+ htab = ppc_elf_hash_table (info);
+ if (htab->sbss == NULL)
{
- struct ppc_elf_dyn_relocs **pp;
+ flagword flags = SEC_IS_COMMON | SEC_LINKER_CREATED;
- 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;
- }
- }
+ if (!htab->elf.dynobj)
+ htab->elf.dynobj = abfd;
- /* 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))
+ htab->sbss = bfd_make_section_anyway_with_flags (htab->elf.dynobj,
+ ".sbss",
+ flags);
+ if (htab->sbss == NULL)
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);
+ *secp = htab->sbss;
+ *valp = sym->st_size;
}
return TRUE;
}
+
+static bfd_boolean
+create_sdata_sym (struct ppc_elf_link_hash_table *htab,
+ elf_linker_section_t *lsect)
+{
+ lsect->sym = elf_link_hash_lookup (&htab->elf, lsect->sym_name,
+ TRUE, FALSE, TRUE);
+ if (lsect->sym == NULL)
+ return FALSE;
+ if (lsect->sym->root.type == bfd_link_hash_new)
+ lsect->sym->non_elf = 0;
+ lsect->sym->ref_regular = 1;
+ return TRUE;
+}
-/* Find any dynamic relocs that apply to read-only sections. */
+/* Create a special linker section. */
static bfd_boolean
-readonly_dynrelocs (struct elf_link_hash_entry *h, void *info)
+ppc_elf_create_linker_section (bfd *abfd,
+ struct bfd_link_info *info,
+ flagword flags,
+ elf_linker_section_t *lsect)
{
- struct ppc_elf_dyn_relocs *p;
+ struct ppc_elf_link_hash_table *htab = ppc_elf_hash_table (info);
+ asection *s;
- if (h->root.type == bfd_link_hash_indirect)
- return TRUE;
+ flags |= (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS | SEC_IN_MEMORY
+ | SEC_LINKER_CREATED);
- if (h->root.type == bfd_link_hash_warning)
- h = (struct elf_link_hash_entry *) h->root.u.i.link;
+ /* Record the first bfd that needs the special sections. */
+ if (!htab->elf.dynobj)
+ htab->elf.dynobj = abfd;
- for (p = ppc_elf_hash_entry (h)->dyn_relocs; p != NULL; p = p->next)
- {
- asection *s = p->sec->output_section;
+ s = bfd_make_section_anyway_with_flags (htab->elf.dynobj,
+ lsect->name,
+ flags);
+ if (s == NULL
+ || !bfd_set_section_alignment (htab->elf.dynobj, s, 2))
+ return FALSE;
+ lsect->section = s;
- if (s != NULL
- && ((s->flags & (SEC_READONLY | SEC_ALLOC))
- == (SEC_READONLY | SEC_ALLOC)))
- {
- ((struct bfd_link_info *) info)->flags |= DF_TEXTREL;
+ return create_sdata_sym (htab, lsect);
+}
- /* Not an error, just cut short the traversal. */
- return FALSE;
- }
- }
- 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;
}
-/* Set the sizes of the dynamic sections. */
+/* Allocate a pointer to live in a linker created section. */
static bfd_boolean
-ppc_elf_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
- struct bfd_link_info *info)
+elf_create_pointer_linker_section (bfd *abfd,
+ elf_linker_section_t *lsect,
+ struct elf_link_hash_entry *h,
+ const Elf_Internal_Rela *rel)
{
- 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
+ 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;
- htab = ppc_elf_hash_table (info);
- BFD_ASSERT (htab->elf.dynobj != NULL);
+ BFD_ASSERT (lsect != NULL);
- if (elf_hash_table (info)->dynamic_sections_created)
+ /* Is this a global symbol? */
+ if (h != NULL)
{
- /* 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;
- }
- }
+ struct ppc_elf_link_hash_entry *eh;
- 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);
+ /* 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;
}
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;
+ /* Allocation of a pointer to a local symbol. */
+ elf_linker_section_pointers_t **ptr = elf_local_ptr_offsets (abfd);
- for (s = ibfd->sections; s != NULL; s = s->next)
+ /* Allocate a table to hold the local symbols if first time. */
+ if (!ptr)
{
- 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);
+ unsigned int num_symbols = elf_tdata (abfd)->symtab_hdr.sh_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;
+ amt = num_symbols;
+ amt *= sizeof (elf_linker_section_pointers_t *);
+ ptr = bfd_zalloc (abfd, amt);
- 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;
+ if (!ptr)
+ return FALSE;
- /* 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;
+ elf_local_ptr_offsets (abfd) = ptr;
}
- if (s->_raw_size == 0)
- {
- _bfd_strip_section_from_output (info, s);
- continue;
- }
+ /* 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;
- /* Allocate memory for the section contents. */
- s->contents = bfd_zalloc (htab->elf.dynobj, s->_raw_size);
- if (s->contents == NULL)
- return FALSE;
+ ptr_linker_section_ptr = &ptr[r_symndx];
}
- 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;
- }
+ /* 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 (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 (!linker_section_ptr)
+ 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;
- }
+ linker_section_ptr->next = *ptr_linker_section_ptr;
+ linker_section_ptr->addend = rel->r_addend;
+ linker_section_ptr->lsect = lsect;
+ *ptr_linker_section_ptr = linker_section_ptr;
- /* 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);
+ linker_section_ptr->offset = lsect->section->size;
+ lsect->section->size += 4;
- if ((info->flags & DF_TEXTREL) != 0)
- {
- if (!add_dynamic_entry (DT_TEXTREL, 0))
- return FALSE;
- }
- }
-#undef add_dynamic_entry
+#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->size);
+#endif
return TRUE;
}
-
+
static bfd_boolean
update_local_sym_info (bfd *abfd,
Elf_Internal_Shdr *symtab_hdr,
@@ -3527,12 +2974,52 @@ update_local_sym_info (bfd *abfd,
return TRUE;
}
+static bfd_boolean
+update_plt_info (bfd *abfd, struct elf_link_hash_entry *h,
+ asection *sec, bfd_vma addend)
+{
+ struct plt_entry *ent;
+
+ if (addend < 32768)
+ sec = NULL;
+ for (ent = h->plt.plist; ent != NULL; ent = ent->next)
+ if (ent->sec == sec && 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 = h->plt.plist;
+ ent->sec = sec;
+ ent->addend = addend;
+ ent->plt.refcount = 0;
+ h->plt.plist = ent;
+ }
+ ent->plt.refcount += 1;
+ return TRUE;
+}
+
+static struct plt_entry *
+find_plt_ent (struct elf_link_hash_entry *h, asection *sec, bfd_vma addend)
+{
+ struct plt_entry *ent;
+
+ if (addend < 32768)
+ sec = NULL;
+ for (ent = h->plt.plist; ent != NULL; ent = ent->next)
+ if (ent->sec == sec && ent->addend == addend)
+ break;
+ return ent;
+}
+
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),
+ (_("%B: relocation %s cannot be used when making a shared object"),
+ abfd,
ppc_elf_howto_table[r_type]->name);
bfd_set_error (bfd_error_bad_value);
}
@@ -3552,42 +3039,33 @@ ppc_elf_check_relocs (bfd *abfd,
struct elf_link_hash_entry **sym_hashes;
const Elf_Internal_Rela *rel;
const Elf_Internal_Rela *rel_end;
- asection *sreloc;
+ asection *got2, *sreloc;
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;
+
#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));
+ _bfd_error_handler ("ppc_elf_check_relocs called for section %A in %B",
+ sec, 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);
+ got2 = bfd_get_section_by_name (abfd, ".got2");
sreloc = NULL;
rel_end = relocs + sec->reloc_count;
@@ -3602,20 +3080,25 @@ ppc_elf_check_relocs (bfd *abfd,
if (r_symndx < symtab_hdr->sh_info)
h = NULL;
else
- h = sym_hashes[r_symndx - symtab_hdr->sh_info];
+ {
+ h = sym_hashes[r_symndx - symtab_hdr->sh_info];
+ 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 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 (h != NULL
+ && htab->got == NULL
+ && 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;
- }
+ if (htab->elf.dynobj == NULL)
+ htab->elf.dynobj = abfd;
+ if (!ppc_elf_create_got (htab->elf.dynobj, info))
+ return FALSE;
+ BFD_ASSERT (h == htab->elf.hgot);
}
r_type = ELF32_R_TYPE (rel->r_info);
@@ -3685,9 +3168,18 @@ ppc_elf_check_relocs (bfd *abfd,
bad_shared_reloc (abfd, r_type);
return FALSE;
}
- if (!elf_create_pointer_linker_section (abfd, info,
- htab->sdata, h, rel))
+ if (htab->sdata[0].section == NULL
+ && !ppc_elf_create_linker_section (abfd, info, 0,
+ &htab->sdata[0]))
+ return FALSE;
+ if (!elf_create_pointer_linker_section (abfd, &htab->sdata[0],
+ h, rel))
return FALSE;
+ if (h != NULL)
+ {
+ ppc_elf_hash_entry (h)->has_sda_refs = TRUE;
+ h->non_got_ref = TRUE;
+ }
break;
/* Indirect .sdata2 relocation. */
@@ -3697,15 +3189,72 @@ ppc_elf_check_relocs (bfd *abfd,
bad_shared_reloc (abfd, r_type);
return FALSE;
}
- if (!elf_create_pointer_linker_section (abfd, info,
- htab->sdata2, h, rel))
+ if (htab->sdata[1].section == NULL
+ && !ppc_elf_create_linker_section (abfd, info, SEC_READONLY,
+ &htab->sdata[1]))
+ return FALSE;
+ if (!elf_create_pointer_linker_section (abfd, &htab->sdata[1],
+ h, rel))
return FALSE;
+ if (h != NULL)
+ {
+ ppc_elf_hash_entry (h)->has_sda_refs = TRUE;
+ h->non_got_ref = TRUE;
+ }
break;
case R_PPC_SDAREL16:
+ if (info->shared)
+ {
+ bad_shared_reloc (abfd, r_type);
+ return FALSE;
+ }
+ if (htab->sdata[0].sym == NULL
+ && !create_sdata_sym (htab, &htab->sdata[0]))
+ return FALSE;
+ if (h != NULL)
+ {
+ ppc_elf_hash_entry (h)->has_sda_refs = TRUE;
+ h->non_got_ref = TRUE;
+ }
+ break;
+
case R_PPC_EMB_SDA2REL:
+ if (info->shared)
+ {
+ bad_shared_reloc (abfd, r_type);
+ return FALSE;
+ }
+ if (htab->sdata[1].sym == NULL
+ && !create_sdata_sym (htab, &htab->sdata[1]))
+ return FALSE;
+ if (h != NULL)
+ {
+ ppc_elf_hash_entry (h)->has_sda_refs = TRUE;
+ h->non_got_ref = TRUE;
+ }
+ break;
+
case R_PPC_EMB_SDA21:
case R_PPC_EMB_RELSDA:
+ if (info->shared)
+ {
+ bad_shared_reloc (abfd, r_type);
+ return FALSE;
+ }
+ if (htab->sdata[0].sym == NULL
+ && !create_sdata_sym (htab, &htab->sdata[0]))
+ return FALSE;
+ if (htab->sdata[1].sym == NULL
+ && !create_sdata_sym (htab, &htab->sdata[1]))
+ return FALSE;
+ if (h != NULL)
+ {
+ ppc_elf_hash_entry (h)->has_sda_refs = TRUE;
+ h->non_got_ref = TRUE;
+ }
+ break;
+
case R_PPC_EMB_NADDR32:
case R_PPC_EMB_NADDR16:
case R_PPC_EMB_NADDR16_LO:
@@ -3716,6 +3265,8 @@ ppc_elf_check_relocs (bfd *abfd,
bad_shared_reloc (abfd, r_type);
return FALSE;
}
+ if (h != NULL)
+ h->non_got_ref = TRUE;
break;
case R_PPC_PLT32:
@@ -3737,18 +3288,28 @@ ppc_elf_check_relocs (bfd *abfd,
{
/* 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 "
+ (*_bfd_error_handler) (_("%B(%A+0x%lx): %s reloc against "
"local symbol"),
- bfd_archive_filename (abfd),
- sec->name,
+ abfd,
+ sec,
(long) rel->r_offset,
ppc_elf_howto_table[r_type]->name);
bfd_set_error (bfd_error_bad_value);
return FALSE;
}
+ else
+ {
+ bfd_vma addend = 0;
- h->elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_PLT;
- h->plt.refcount++;
+ if (r_type == R_PPC_PLTREL24)
+ {
+ ppc_elf_tdata (abfd)->makes_plt_call = 1;
+ addend = rel->r_addend;
+ }
+ h->needs_plt = 1;
+ if (!update_plt_info (abfd, h, got2, addend))
+ return FALSE;
+ }
break;
/* The following relocations don't need to propagate the
@@ -3765,7 +3326,14 @@ ppc_elf_check_relocs (bfd *abfd,
case R_PPC_TOC16:
break;
- /* This are just markers. */
+ case R_PPC_REL16:
+ case R_PPC_REL16_LO:
+ case R_PPC_REL16_HI:
+ case R_PPC_REL16_HA:
+ ppc_elf_tdata (abfd)->has_rel16 = 1;
+ break;
+
+ /* These are just markers. */
case R_PPC_TLS:
case R_PPC_EMB_MRKREF:
case R_PPC_NONE:
@@ -3790,6 +3358,11 @@ ppc_elf_check_relocs (bfd *abfd,
/* This refers only to functions defined in the shared library. */
case R_PPC_LOCAL24PC:
+ if (h && h == htab->elf.hgot && htab->plt_type == PLT_UNSET)
+ {
+ htab->plt_type = PLT_OLD;
+ htab->old_bfd = abfd;
+ }
break;
/* This relocation describes the C++ object vtable hierarchy.
@@ -3825,17 +3398,48 @@ ppc_elf_check_relocs (bfd *abfd,
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_REL32:
+ if (h == NULL
+ && got2 != NULL
+ && (sec->flags & SEC_CODE) != 0
+ && (info->shared || info->pie)
+ && htab->plt_type == PLT_UNSET)
+ {
+ /* Old -fPIC gcc code has .long LCTOC1-LCFx just before
+ the start of a function, which assembles to a REL32
+ reference to .got2. If we detect one of these, then
+ force the old PLT layout because the linker cannot
+ reliably deduce the GOT pointer value needed for
+ PLT call stubs. */
+ asection *s;
+
+ s = bfd_section_from_r_symndx (abfd, &htab->sym_sec, sec,
+ r_symndx);
+ if (s == got2)
+ {
+ htab->plt_type = PLT_OLD;
+ htab->old_bfd = abfd;
+ }
+ }
+ if (h == NULL || h == htab->elf.hgot)
+ break;
+ goto dodyn1;
+
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)
+ if (h == NULL)
break;
+ if (h == htab->elf.hgot)
+ {
+ if (htab->plt_type == PLT_UNSET)
+ {
+ htab->plt_type = PLT_OLD;
+ htab->old_bfd = abfd;
+ }
+ break;
+ }
/* fall through */
case R_PPC_ADDR32:
@@ -3849,14 +3453,16 @@ ppc_elf_check_relocs (bfd *abfd,
case R_PPC_ADDR14_BRNTAKEN:
case R_PPC_UADDR32:
case R_PPC_UADDR16:
+ dodyn1:
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++;
+ if (!update_plt_info (abfd, h, NULL, 0))
+ return FALSE;
/* We may need a copy reloc too. */
- h->elf_link_hash_flags |= ELF_LINK_NON_GOT_REF;
+ h->non_got_ref = 1;
}
dodyn:
@@ -3886,15 +3492,12 @@ ppc_elf_check_relocs (bfd *abfd,
|| (h != NULL
&& (! info->symbolic
|| h->root.type == bfd_link_hash_defweak
- || (h->elf_link_hash_flags
- & ELF_LINK_HASH_DEF_REGULAR) == 0))))
+ || !h->def_regular))))
|| (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)))
+ || !h->def_regular)))
{
struct ppc_elf_dyn_relocs *p;
struct ppc_elf_dyn_relocs **head;
@@ -3917,23 +3520,24 @@ ppc_elf_check_relocs (bfd *abfd,
if (name == NULL)
return FALSE;
- BFD_ASSERT (strncmp (name, ".rela", 5) == 0
+ BFD_ASSERT (CONST_STRNEQ (name, ".rela")
&& strcmp (bfd_get_section_name (abfd, sec),
name + 5) == 0);
+ if (htab->elf.dynobj == NULL)
+ htab->elf.dynobj = abfd;
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;
+ | SEC_IN_MEMORY | SEC_LINKER_CREATED
+ | SEC_ALLOC | SEC_LOAD);
+ sreloc = bfd_make_section_with_flags (htab->elf.dynobj,
+ name,
+ flags);
if (sreloc == NULL
- || ! bfd_set_section_flags (htab->elf.dynobj,
- sreloc, flags)
|| ! bfd_set_section_alignment (htab->elf.dynobj,
sreloc, 2))
return FALSE;
@@ -3954,13 +3558,15 @@ ppc_elf_check_relocs (bfd *abfd,
easily. Oh well. */
asection *s;
+ void *vpp;
+
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);
+ vpp = &elf_section_data (s)->local_dynrel;
+ head = (struct ppc_elf_dyn_relocs **) vpp;
}
p = *head;
@@ -3987,44 +3593,252 @@ ppc_elf_check_relocs (bfd *abfd,
return TRUE;
}
+
-/* Return the section that should be marked against GC for a given
- relocation. */
+/* Merge object attributes from IBFD into OBFD. Raise an error if
+ there are conflicting attributes. */
+static bfd_boolean
+ppc_elf_merge_obj_attributes (bfd *ibfd, bfd *obfd)
+{
+ obj_attribute *in_attr;
+ obj_attribute *out_attr;
-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 (!elf_known_obj_attributes_proc (obfd)[0].i)
+ {
+ /* This is the first object. Copy the attributes. */
+ _bfd_elf_copy_obj_attributes (ibfd, obfd);
+
+ /* Use the Tag_null value to indicate the attributes have been
+ initialized. */
+ elf_known_obj_attributes_proc (obfd)[0].i = 1;
+
+ return TRUE;
+ }
+
+ /* Check for conflicting Tag_GNU_Power_ABI_FP attributes and merge
+ non-conflicting ones. */
+ in_attr = elf_known_obj_attributes (ibfd)[OBJ_ATTR_GNU];
+ out_attr = elf_known_obj_attributes (obfd)[OBJ_ATTR_GNU];
+ if (in_attr[Tag_GNU_Power_ABI_FP].i != out_attr[Tag_GNU_Power_ABI_FP].i)
+ {
+ out_attr[Tag_GNU_Power_ABI_FP].type = 1;
+ if (out_attr[Tag_GNU_Power_ABI_FP].i == 0)
+ out_attr[Tag_GNU_Power_ABI_FP].i = in_attr[Tag_GNU_Power_ABI_FP].i;
+ else if (in_attr[Tag_GNU_Power_ABI_FP].i == 0)
+ ;
+ else if (out_attr[Tag_GNU_Power_ABI_FP].i == 1
+ && in_attr[Tag_GNU_Power_ABI_FP].i == 2)
+ _bfd_error_handler
+ (_("Warning: %B uses hard float, %B uses soft float"), obfd, ibfd);
+ else if (out_attr[Tag_GNU_Power_ABI_FP].i == 2
+ && in_attr[Tag_GNU_Power_ABI_FP].i == 1)
+ _bfd_error_handler
+ (_("Warning: %B uses hard float, %B uses soft float"), ibfd, obfd);
+ else if (in_attr[Tag_GNU_Power_ABI_FP].i > 2)
+ _bfd_error_handler
+ (_("Warning: %B uses unknown floating point ABI %d"), ibfd,
+ in_attr[Tag_GNU_Power_ABI_FP].i);
+ else
+ _bfd_error_handler
+ (_("Warning: %B uses unknown floating point ABI %d"), obfd,
+ out_attr[Tag_GNU_Power_ABI_FP].i);
+ }
+
+ /* Merge Tag_compatibility attributes and any common GNU ones. */
+ _bfd_elf_merge_object_attributes (ibfd, obfd);
+
+ 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)
{
- if (h != NULL)
+ flagword old_flags;
+ flagword new_flags;
+ bfd_boolean error;
+
+ if (!is_ppc_elf_target (ibfd->xvec)
+ || !is_ppc_elf_target (obfd->xvec))
+ return TRUE;
+
+ /* Check if we have the same endianess. */
+ if (! _bfd_generic_verify_endian_match (ibfd, obfd))
+ return FALSE;
+
+ if (!ppc_elf_merge_obj_attributes (ibfd, obfd))
+ return FALSE;
+
+ new_flags = elf_elfheader (ibfd)->e_flags;
+ old_flags = elf_elfheader (obfd)->e_flags;
+ if (!elf_flags_init (obfd))
{
- switch (ELF32_R_TYPE (rel->r_info))
+ /* 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)
{
- case R_PPC_GNU_VTINHERIT:
- case R_PPC_GNU_VTENTRY:
- break;
+ error = TRUE;
+ (*_bfd_error_handler)
+ (_("%B: compiled with -mrelocatable and linked with "
+ "modules compiled normally"), ibfd);
+ }
+ else if ((new_flags & (EF_PPC_RELOCATABLE | EF_PPC_RELOCATABLE_LIB)) == 0
+ && (old_flags & EF_PPC_RELOCATABLE) != 0)
+ {
+ error = TRUE;
+ (*_bfd_error_handler)
+ (_("%B: compiled normally and linked with "
+ "modules compiled with -mrelocatable"), ibfd);
+ }
- default:
- switch (h->root.type)
- {
- case bfd_link_hash_defined:
- case bfd_link_hash_defweak:
- return h->root.u.def.section;
+ /* 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;
- case bfd_link_hash_common:
- return h->root.u.c.p->section;
+ /* 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);
- default:
- break;
- }
+ 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)
+ (_("%B: uses different e_flags (0x%lx) fields "
+ "than previous modules (0x%lx)"),
+ ibfd, (long) new_flags, (long) old_flags);
+ }
+
+ if (error)
+ {
+ bfd_set_error (bfd_error_bad_value);
+ return FALSE;
+ }
+ }
+
+ return TRUE;
+}
+
+/* Choose which PLT scheme to use, and set .plt flags appropriately.
+ Returns -1 on error, 0 for old PLT, 1 for new PLT. */
+int
+ppc_elf_select_plt_layout (bfd *output_bfd ATTRIBUTE_UNUSED,
+ struct bfd_link_info *info,
+ enum ppc_elf_plt_type plt_style,
+ int emit_stub_syms)
+{
+ struct ppc_elf_link_hash_table *htab;
+ flagword flags;
+
+ htab = ppc_elf_hash_table (info);
+
+ if (htab->plt_type == PLT_UNSET)
+ {
+ if (plt_style == PLT_OLD)
+ htab->plt_type = PLT_OLD;
+ else
+ {
+ bfd *ibfd;
+ enum ppc_elf_plt_type plt_type = plt_style;
+
+ /* Look through the reloc flags left by ppc_elf_check_relocs.
+ Use the old style bss plt if a file makes plt calls
+ without using the new relocs, and if ld isn't given
+ --secure-plt and we never see REL16 relocs. */
+ if (plt_type == PLT_UNSET)
+ plt_type = PLT_OLD;
+ for (ibfd = info->input_bfds; ibfd; ibfd = ibfd->link_next)
+ if (is_ppc_elf_target (ibfd->xvec))
+ {
+ if (ppc_elf_tdata (ibfd)->has_rel16)
+ plt_type = PLT_NEW;
+ else if (ppc_elf_tdata (ibfd)->makes_plt_call)
+ {
+ plt_type = PLT_OLD;
+ htab->old_bfd = ibfd;
+ break;
+ }
+ }
+ htab->plt_type = plt_type;
}
}
+ if (htab->plt_type == PLT_OLD && plt_style == PLT_NEW)
+ info->callbacks->info (_("Using bss-plt due to %B"), htab->old_bfd);
+
+ htab->emit_stub_syms = emit_stub_syms;
+
+ BFD_ASSERT (htab->plt_type != PLT_VXWORKS);
+
+ if (htab->plt_type == PLT_NEW)
+ {
+ flags = (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS
+ | SEC_IN_MEMORY | SEC_LINKER_CREATED);
+
+ /* The new PLT is a loaded section. */
+ if (htab->plt != NULL
+ && !bfd_set_section_flags (htab->elf.dynobj, htab->plt, flags))
+ return -1;
+
+ /* The new GOT is not executable. */
+ if (htab->got != NULL
+ && !bfd_set_section_flags (htab->elf.dynobj, htab->got, flags))
+ return -1;
+ }
else
- return bfd_section_from_elf_index (sec->owner, sym->st_shndx);
+ {
+ /* Stop an unused .glink section from affecting .text alignment. */
+ if (htab->glink != NULL
+ && !bfd_set_section_alignment (htab->elf.dynobj, htab->glink, 0))
+ return -1;
+ }
+ return htab->plt_type == PLT_NEW;
+}
+
+/* Return the section that should be marked against GC for a given
+ relocation. */
- return NULL;
+static asection *
+ppc_elf_gc_mark_hook (asection *sec,
+ struct bfd_link_info *info,
+ 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:
+ return NULL;
+ }
+
+ return _bfd_elf_gc_mark_hook (sec, info, rel, h, sym);
}
/* Update the got, plt and dynamic reloc reference counts for the
@@ -4041,6 +3855,10 @@ ppc_elf_gc_sweep_hook (bfd *abfd,
struct elf_link_hash_entry **sym_hashes;
bfd_signed_vma *local_got_refcounts;
const Elf_Internal_Rela *rel, *relend;
+ asection *got2;
+
+ if ((sec->flags & SEC_ALLOC) == 0)
+ return TRUE;
elf_section_data (sec)->local_dynrel = NULL;
@@ -4048,6 +3866,7 @@ ppc_elf_gc_sweep_hook (bfd *abfd,
symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
sym_hashes = elf_sym_hashes (abfd);
local_got_refcounts = elf_local_got_refcounts (abfd);
+ got2 = bfd_get_section_by_name (abfd, ".got2");
relend = relocs + sec->reloc_count;
for (rel = relocs; rel < relend; rel++)
@@ -4063,6 +3882,9 @@ ppc_elf_gc_sweep_hook (bfd *abfd,
struct ppc_elf_link_hash_entry *eh;
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;
eh = (struct ppc_elf_link_hash_entry *) h;
for (pp = &eh->dyn_relocs; (p = *pp) != NULL; pp = &p->next)
@@ -4117,8 +3939,7 @@ ppc_elf_gc_sweep_hook (bfd *abfd,
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)
+ if (h == NULL || h == htab->elf.hgot)
break;
/* Fall thru */
@@ -4133,15 +3954,21 @@ ppc_elf_gc_sweep_hook (bfd *abfd,
case R_PPC_ADDR14_BRNTAKEN:
case R_PPC_UADDR32:
case R_PPC_UADDR16:
+ if (info->shared)
+ 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:
if (h != NULL)
{
- if (h->plt.refcount > 0)
- h->plt.refcount--;
+ bfd_vma addend = r_type == R_PPC_PLTREL24 ? rel->r_addend : 0;
+ struct plt_entry *ent = find_plt_ent (h, got2, addend);
+ if (ent->plt.refcount > 0)
+ ent->plt.refcount -= 1;
}
break;
@@ -4151,7 +3978,7 @@ ppc_elf_gc_sweep_hook (bfd *abfd,
}
return TRUE;
}
-
+
/* Set htab->tls_get_addr and call the generic ELF tls_setup function. */
asection *
@@ -4160,9 +3987,16 @@ ppc_elf_tls_setup (bfd *obfd, struct bfd_link_info *info)
struct ppc_elf_link_hash_table *htab;
htab = ppc_elf_hash_table (info);
+ if (htab->plt_type == PLT_NEW
+ && htab->plt != NULL
+ && htab->plt->output_section != NULL)
+ {
+ elf_section_type (htab->plt->output_section) = SHT_PROGBITS;
+ elf_section_flags (htab->plt->output_section) = SHF_ALLOC + SHF_WRITE;
+ }
+
htab->tls_get_addr = elf_link_hash_lookup (&htab->elf, "__tls_get_addr",
FALSE, FALSE, TRUE);
-
return _bfd_elf_tls_setup (obfd, info);
}
@@ -4223,7 +4057,7 @@ ppc_elf_tls_optimize (bfd *obfd ATTRIBUTE_UNUSED,
is_local = FALSE;
if (h == NULL
- || !(h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC))
+ || !h->def_dynamic)
is_local = TRUE;
r_type = ELF32_R_TYPE (rel->r_info);
@@ -4284,8 +4118,9 @@ ppc_elf_tls_optimize (bfd *obfd ATTRIBUTE_UNUSED,
&& h != NULL
&& h == htab->tls_get_addr)
{
- if (h->plt.refcount > 0)
- h->plt.refcount -= 1;
+ struct plt_entry *ent = find_plt_ent (h, NULL, 0);
+ if (ent != NULL && ent->plt.refcount > 0)
+ ent->plt.refcount -= 1;
}
expecting_tls_get_addr = 0;
continue;
@@ -4359,230 +4194,1419 @@ ppc_elf_tls_optimize (bfd *obfd ATTRIBUTE_UNUSED,
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. */
+/* 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_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)
+ppc_elf_adjust_dynamic_symbol (struct bfd_link_info *info,
+ struct elf_link_hash_entry *h)
{
- 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))
+ struct ppc_elf_link_hash_table *htab;
+ asection *s;
+
+#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->needs_plt
+ || h->u.weakdef != NULL
+ || (h->def_dynamic
+ && h->ref_regular
+ && !h->def_regular)));
+
+ /* Deal with function syms. */
+ if (h->type == STT_FUNC
+ || h->needs_plt)
{
- /* Common symbols less than or equal to -G nn bytes are automatically
- put into .sbss. */
- struct ppc_elf_link_hash_table *htab;
+ /* 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 (ent == NULL
+ || 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:
- htab = ppc_elf_hash_table (info);
- if (htab->sbss == NULL)
+ 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.plist = NULL;
+ h->needs_plt = 0;
+ }
+ return TRUE;
+ }
+ 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->u.weakdef != NULL)
+ {
+ BFD_ASSERT (h->u.weakdef->root.type == bfd_link_hash_defined
+ || h->u.weakdef->root.type == bfd_link_hash_defweak);
+ h->root.u.def.section = h->u.weakdef->root.u.def.section;
+ h->root.u.def.value = h->u.weakdef->root.u.def.value;
+ if (ELIMINATE_COPY_RELOCS)
+ h->non_got_ref = h->u.weakdef->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->non_got_ref)
+ return TRUE;
+
+ /* 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. We can't
+ do this if there are any small data relocations. */
+ if (ELIMINATE_COPY_RELOCS
+ && !ppc_elf_hash_entry (h)->has_sda_refs)
+ {
+ 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 (p == NULL)
+ {
+ h->non_got_ref = 0;
+ return TRUE;
+ }
+ }
+
+ if (h->size == 0)
+ {
+ (*_bfd_error_handler) (_("dynamic variable `%s' is zero size"),
+ h->root.root.string);
+ 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 referenced using SDAREL relocs, we
+ must instead allocate it in .sbss. */
+
+ if (ppc_elf_hash_entry (h)->has_sda_refs)
+ 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 (ppc_elf_hash_entry (h)->has_sda_refs)
+ srel = htab->relsbss;
+ else
+ srel = htab->relbss;
+ BFD_ASSERT (srel != NULL);
+ srel->size += sizeof (Elf32_External_Rela);
+ h->needs_copy = 1;
+ }
+
+ return _bfd_elf_adjust_dynamic_copy (h, s);
+}
+
+/* Generate a symbol to mark plt call stubs. For non-PIC code the sym is
+ xxxxxxxx.plt_call32.<callee> where xxxxxxxx is a hex number, usually 0,
+ specifying the addend on the plt relocation. For -fpic code, the sym
+ is xxxxxxxx.plt_pic32.<callee>, and for -fPIC
+ xxxxxxxx.got2.plt_pic32.<callee>. */
+
+static bfd_boolean
+add_stub_sym (struct plt_entry *ent,
+ struct elf_link_hash_entry *h,
+ struct bfd_link_info *info)
+{
+ struct elf_link_hash_entry *sh;
+ size_t len1, len2, len3;
+ char *name;
+ const char *stub;
+ struct ppc_elf_link_hash_table *htab = ppc_elf_hash_table (info);
+
+ if (info->shared || info->pie)
+ stub = ".plt_pic32.";
+ else
+ stub = ".plt_call32.";
+
+ len1 = strlen (h->root.root.string);
+ len2 = strlen (stub);
+ len3 = 0;
+ if (ent->sec)
+ len3 = strlen (ent->sec->name);
+ name = bfd_malloc (len1 + len2 + len3 + 9);
+ if (name == NULL)
+ return FALSE;
+ sprintf (name, "%08x", (unsigned) ent->addend & 0xffffffff);
+ if (ent->sec)
+ memcpy (name + 8, ent->sec->name, len3);
+ memcpy (name + 8 + len3, stub, len2);
+ memcpy (name + 8 + len3 + len2, h->root.root.string, len1 + 1);
+ sh = elf_link_hash_lookup (&htab->elf, name, TRUE, FALSE, FALSE);
+ if (sh == NULL)
+ return FALSE;
+ if (sh->root.type == bfd_link_hash_new)
+ {
+ sh->root.type = bfd_link_hash_defined;
+ sh->root.u.def.section = htab->glink;
+ sh->root.u.def.value = ent->glink_offset;
+ sh->ref_regular = 1;
+ sh->def_regular = 1;
+ sh->ref_regular_nonweak = 1;
+ sh->forced_local = 1;
+ sh->non_elf = 0;
+ }
+ return TRUE;
+}
+
+/* Allocate NEED contiguous space in .got, and return the offset.
+ Handles allocation of the got header when crossing 32k. */
+
+static bfd_vma
+allocate_got (struct ppc_elf_link_hash_table *htab, unsigned int need)
+{
+ bfd_vma where;
+ unsigned int max_before_header;
+
+ if (htab->plt_type == PLT_VXWORKS)
+ {
+ where = htab->got->size;
+ htab->got->size += need;
+ }
+ else
+ {
+ max_before_header = htab->plt_type == PLT_NEW ? 32768 : 32764;
+ if (need <= htab->got_gap)
+ {
+ where = max_before_header - htab->got_gap;
+ htab->got_gap -= need;
+ }
+ else
+ {
+ if (htab->got->size + need > max_before_header
+ && htab->got->size <= max_before_header)
+ {
+ htab->got_gap = max_before_header - htab->got->size;
+ htab->got->size = max_before_header + htab->got_header_size;
+ }
+ where = htab->got->size;
+ htab->got->size += need;
+ }
+ }
+ return where;
+}
+
+/* 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)
+ {
+ struct plt_entry *ent;
+ bfd_boolean doneone = FALSE;
+ bfd_vma plt_offset = 0, glink_offset = 0;
+
+ for (ent = h->plt.plist; ent != NULL; ent = ent->next)
+ if (ent->plt.refcount > 0)
+ {
+ /* Make sure this symbol is output as a dynamic symbol. */
+ if (h->dynindx == -1
+ && !h->forced_local)
+ {
+ 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 (htab->plt_type == PLT_NEW)
+ {
+ if (!doneone)
+ {
+ plt_offset = s->size;
+ s->size += 4;
+ }
+ ent->plt.offset = plt_offset;
+
+ s = htab->glink;
+ if (!doneone || info->shared || info->pie)
+ {
+ glink_offset = s->size;
+ s->size += GLINK_ENTRY_SIZE;
+ }
+ if (!doneone
+ && !info->shared
+ && !h->def_regular)
+ {
+ h->root.u.def.section = s;
+ h->root.u.def.value = glink_offset;
+ }
+ ent->glink_offset = glink_offset;
+
+ if (htab->emit_stub_syms
+ && !add_stub_sym (ent, h, info))
+ return FALSE;
+ }
+ else
+ {
+ if (!doneone)
+ {
+ /* If this is the first .plt entry, make room
+ for the special first entry. */
+ if (s->size == 0)
+ s->size += htab->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. */
+ plt_offset = (htab->plt_initial_entry_size
+ + (htab->plt_slot_size
+ * ((s->size
+ - htab->plt_initial_entry_size)
+ / htab->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->def_regular)
+ {
+ h->root.u.def.section = s;
+ h->root.u.def.value = plt_offset;
+ }
+
+ /* Make room for this entry. */
+ s->size += htab->plt_entry_size;
+ /* After the 8192nd entry, room for two entries
+ is allocated. */
+ if (htab->plt_type == PLT_OLD
+ && (s->size - htab->plt_initial_entry_size)
+ / htab->plt_entry_size
+ > PLT_NUM_SINGLE_ENTRIES)
+ s->size += htab->plt_entry_size;
+ }
+ ent->plt.offset = plt_offset;
+ }
+
+ /* We also need to make an entry in the .rela.plt section. */
+ if (!doneone)
+ {
+ htab->relplt->size += sizeof (Elf32_External_Rela);
+
+ if (htab->plt_type == PLT_VXWORKS)
+ {
+ /* Allocate space for the unloaded relocations. */
+ if (!info->shared)
+ {
+ if (ent->plt.offset
+ == (bfd_vma) htab->plt_initial_entry_size)
+ {
+ htab->srelplt2->size
+ += sizeof (Elf32_External_Rela)
+ * VXWORKS_PLTRESOLVE_RELOCS;
+ }
+
+ htab->srelplt2->size
+ += sizeof (Elf32_External_Rela)
+ * VXWORKS_PLT_NON_JMP_SLOT_RELOCS;
+ }
+
+ /* Every PLT entry has an associated GOT entry in
+ .got.plt. */
+ htab->sgotplt->size += 4;
+ }
+ doneone = TRUE;
+ }
+ }
+ else
+ ent->plt.offset = (bfd_vma) -1;
+ }
+ else
+ ent->plt.offset = (bfd_vma) -1;
+
+ if (!doneone)
{
- flagword flags = SEC_IS_COMMON;
+ h->plt.plist = NULL;
+ h->needs_plt = 0;
+ }
+ }
+ else
+ {
+ h->plt.plist = NULL;
+ h->needs_plt = 0;
+ }
- htab->sbss = bfd_make_section_anyway (abfd, ".sbss");
- if (htab->sbss == NULL
- || ! bfd_set_section_flags (abfd, htab->sbss, flags))
+ 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.forced_local)
+ {
+ if (!bfd_elf_link_record_dynamic_symbol (info, &eh->elf))
return FALSE;
}
- *secp = htab->sbss;
- *valp = sym->st_size;
+ if (eh->tls_mask == (TLS_TLS | TLS_LD)
+ && !eh->elf.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;
+ unsigned int need = 0;
+ if ((eh->tls_mask & TLS_TLS) != 0)
+ {
+ if ((eh->tls_mask & TLS_LD) != 0)
+ need += 8;
+ if ((eh->tls_mask & TLS_GD) != 0)
+ need += 8;
+ if ((eh->tls_mask & (TLS_TPREL | TLS_TPRELGD)) != 0)
+ need += 4;
+ if ((eh->tls_mask & TLS_DTPREL) != 0)
+ need += 4;
+ }
+ else
+ need += 4;
+ eh->elf.got.offset = allocate_got (htab, need);
+ 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.
+ Except LD only needs one. */
+ if ((eh->tls_mask & TLS_LD) != 0)
+ need -= 4;
+ htab->relgot->size += need * (sizeof (Elf32_External_Rela) / 4);
+ }
+ }
+ }
+ 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 (eh->dyn_relocs != NULL
+ && h->root.type == bfd_link_hash_undefweak)
+ {
+ if (ELF_ST_VISIBILITY (h->other) != STV_DEFAULT)
+ eh->dyn_relocs = NULL;
+
+ /* Make sure undefined weak symbols are output as a dynamic
+ symbol in PIEs. */
+ else if (h->dynindx == -1
+ && !h->forced_local)
+ {
+ 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->non_got_ref
+ && h->def_dynamic
+ && !h->def_regular)
+ {
+ /* 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->forced_local)
+ {
+ 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->size += p->count * sizeof (Elf32_External_Rela);
}
return TRUE;
}
-
-/* Finish up dynamic symbol handling. We set the contents of various
- dynamic sections here. */
+
+/* Find any dynamic relocs that apply to read-only sections. */
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)
+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_finish_dynamic_symbol called for %s",
- h->root.root.string);
+ fprintf (stderr, "ppc_elf_size_dynamic_sections called\n");
#endif
htab = ppc_elf_hash_table (info);
BFD_ASSERT (htab->elf.dynobj != NULL);
- if (h->plt.offset != (bfd_vma) -1)
+ if (elf_hash_table (info)->dynamic_sections_created)
{
- Elf_Internal_Rela rela;
- bfd_byte *loc;
- bfd_vma reloc_index;
+ /* 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->size = sizeof ELF_DYNAMIC_INTERPRETER;
+ s->contents = (unsigned char *) ELF_DYNAMIC_INTERPRETER;
+ }
+ }
-#ifdef DEBUG
- fprintf (stderr, ", plt_offset = %d", h->plt.offset);
-#endif
+ if (htab->plt_type == PLT_OLD)
+ htab->got_header_size = 16;
+ else if (htab->plt_type == PLT_NEW)
+ htab->got_header_size = 12;
- /* This symbol has an entry in the procedure linkage table. Set
- it up. */
+ /* 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;
- BFD_ASSERT (h->dynindx != -1);
- BFD_ASSERT (htab->plt != NULL && htab->relplt != NULL);
+ if (!is_ppc_elf_target (ibfd->xvec))
+ continue;
- /* We don't need to fill in the .plt. The ppc dynamic linker
- will fill it in. */
+ for (s = ibfd->sections; s != NULL; s = s->next)
+ {
+ struct ppc_elf_dyn_relocs *p;
- /* 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;
+ 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->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;
+ }
+ }
+ }
- 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);
+ 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;
+ 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. */
+ htab->tlsld_got.refcount += 1;
+ *local_got = (bfd_vma) -1;
+ }
+ else
+ {
+ unsigned int need = 0;
+ if ((*lgot_masks & TLS_TLS) != 0)
+ {
+ if ((*lgot_masks & TLS_GD) != 0)
+ need += 8;
+ if ((*lgot_masks & (TLS_TPREL | TLS_TPRELGD)) != 0)
+ need += 4;
+ if ((*lgot_masks & TLS_DTPREL) != 0)
+ need += 4;
+ }
+ else
+ need += 4;
+ *local_got = allocate_got (htab, need);
+ if (info->shared)
+ htab->relgot->size += (need
+ * (sizeof (Elf32_External_Rela) / 4));
+ }
+ }
+ else
+ *local_got = (bfd_vma) -1;
+ }
+
+ if (htab->tlsld_got.refcount > 0)
+ {
+ htab->tlsld_got.offset = allocate_got (htab, 8);
+ if (info->shared)
+ htab->relgot->size += sizeof (Elf32_External_Rela);
+ }
+ else
+ htab->tlsld_got.offset = (bfd_vma) -1;
- if ((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0)
+ /* Allocate space for global sym dynamic relocs. */
+ elf_link_hash_traverse (elf_hash_table (info), allocate_dynrelocs, info);
+
+ if (htab->got != NULL && htab->plt_type != PLT_VXWORKS)
+ {
+ unsigned int g_o_t = 32768;
+
+ /* If we haven't allocated the header, do so now. When we get here,
+ for old plt/got the got size will be 0 to 32764 (not allocated),
+ or 32780 to 65536 (header allocated). For new plt/got, the
+ corresponding ranges are 0 to 32768 and 32780 to 65536. */
+ if (htab->got->size <= 32768)
{
- /* 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;
+ g_o_t = htab->got->size;
+ if (htab->plt_type == PLT_OLD)
+ g_o_t += 4;
+ htab->got->size += htab->got_header_size;
}
+
+ htab->elf.hgot->root.u.def.value = g_o_t;
}
- if ((h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_COPY) != 0)
+ if (htab->glink != NULL && htab->glink->size != 0)
{
- asection *s;
- Elf_Internal_Rela rela;
- bfd_byte *loc;
+ htab->glink_pltresolve = htab->glink->size;
+ /* Space for the branch table. */
+ htab->glink->size += htab->glink->size / (GLINK_ENTRY_SIZE / 4) - 4;
+ /* Pad out to align the start of PLTresolve. */
+ htab->glink->size += -htab->glink->size & 15;
+ htab->glink->size += GLINK_PLTRESOLVE;
+
+ if (htab->emit_stub_syms)
+ {
+ struct elf_link_hash_entry *sh;
+ sh = elf_link_hash_lookup (&htab->elf, "__glink",
+ TRUE, FALSE, FALSE);
+ if (sh == NULL)
+ return FALSE;
+ if (sh->root.type == bfd_link_hash_new)
+ {
+ sh->root.type = bfd_link_hash_defined;
+ sh->root.u.def.section = htab->glink;
+ sh->root.u.def.value = htab->glink_pltresolve;
+ sh->ref_regular = 1;
+ sh->def_regular = 1;
+ sh->ref_regular_nonweak = 1;
+ sh->forced_local = 1;
+ sh->non_elf = 0;
+ }
+ sh = elf_link_hash_lookup (&htab->elf, "__glink_PLTresolve",
+ TRUE, FALSE, FALSE);
+ if (sh == NULL)
+ return FALSE;
+ if (sh->root.type == bfd_link_hash_new)
+ {
+ sh->root.type = bfd_link_hash_defined;
+ sh->root.u.def.section = htab->glink;
+ sh->root.u.def.value = htab->glink->size - GLINK_PLTRESOLVE;
+ sh->ref_regular = 1;
+ sh->def_regular = 1;
+ sh->ref_regular_nonweak = 1;
+ sh->forced_local = 1;
+ sh->non_elf = 0;
+ }
+ }
+ }
- /* This symbols needs a copy reloc. Set it up. */
+ /* 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)
+ {
+ bfd_boolean strip_section = TRUE;
-#ifdef DEBUG
- fprintf (stderr, ", copy");
-#endif
+ if ((s->flags & SEC_LINKER_CREATED) == 0)
+ continue;
- BFD_ASSERT (h->dynindx != -1);
+ if (s == htab->plt
+ || s == htab->glink
+ || s == htab->got
+ || s == htab->sgotplt
+ || s == htab->sbss
+ || s == htab->dynbss
+ || s == htab->dynsbss)
+ {
+ /* We'd like to strip these sections if they aren't needed, but if
+ we've exported dynamic symbols from them we must leave them.
+ It's too late to tell BFD to get rid of the symbols. */
+ if ((s == htab->plt || s == htab->got) && htab->elf.hplt != NULL)
+ strip_section = FALSE;
+ /* Strip this section if we don't need it; see the
+ comment below. */
+ }
+ else if (s == htab->sdata[0].section
+ || s == htab->sdata[1].section)
+ {
+ /* Strip these too. */
+ }
+ else if (CONST_STRNEQ (bfd_get_section_name (dynobj, s), ".rela"))
+ {
+ if (s->size != 0)
+ {
+ /* Remember whether there are any relocation sections. */
+ relocs = TRUE;
- if (h->size <= elf_gp_size (htab->elf.dynobj))
- s = htab->relsbss;
+ /* We use the reloc_count field as a counter if we need
+ to copy relocs into the output file. */
+ s->reloc_count = 0;
+ }
+ }
else
- s = htab->relbss;
- BFD_ASSERT (s != NULL);
+ {
+ /* It's not one of our sections, so don't allocate space. */
+ continue;
+ }
- 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);
+ if (s->size == 0 && strip_section)
+ {
+ /* 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. */
+ s->flags |= SEC_EXCLUDE;
+ continue;
+ }
+
+ if ((s->flags & SEC_HAS_CONTENTS) == 0)
+ continue;
+
+ /* Allocate memory for the section contents. */
+ s->contents = bfd_zalloc (htab->elf.dynobj, s->size);
+ if (s->contents == NULL)
+ return FALSE;
}
-#ifdef DEBUG
- fprintf (stderr, "\n");
-#endif
+ 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)
- /* 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;
+ if (info->executable)
+ {
+ if (!add_dynamic_entry (DT_DEBUG, 0))
+ return FALSE;
+ }
+
+ if (htab->plt != NULL && htab->plt->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 (htab->glink != NULL && htab->glink->size != 0)
+ {
+ if (!add_dynamic_entry (DT_PPC_GOT, 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;
}
-/* Finish up the dynamic sections. */
+#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_finish_dynamic_sections (bfd *output_bfd,
- struct bfd_link_info *info)
+ppc_elf_relax_section (bfd *abfd,
+ asection *isec,
+ struct bfd_link_info *link_info,
+ bfd_boolean *again)
{
- asection *sdyn;
+ 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 *htab;
+ bfd_size_type trampoff;
+ asection *got2;
-#ifdef DEBUG
- fprintf (stderr, "ppc_elf_finish_dynamic_sections called\n");
-#endif
+ *again = FALSE;
- htab = ppc_elf_hash_table (info);
- sdyn = bfd_get_section_by_name (htab->elf.dynobj, ".dynamic");
+ /* Nothing to do if there are no relocations, and no need to do
+ anything with non-alloc sections. */
+ if ((isec->flags & SEC_ALLOC) == 0
+ || (isec->flags & SEC_RELOC) == 0
+ || isec->reloc_count == 0)
+ return TRUE;
- if (htab->elf.dynamic_sections_created)
+ trampoff = (isec->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;
+
+ htab = ppc_elf_hash_table (link_info);
+ got2 = bfd_get_section_by_name (abfd, ".got2");
+
+ irelend = internal_relocs + isec->reloc_count;
+ for (irel = internal_relocs; irel < irelend; irel++)
{
- Elf32_External_Dyn *dyncon, *dynconend;
+ 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;
+ unsigned char sym_type;
- BFD_ASSERT (htab->plt != NULL && sdyn != NULL);
+ switch (r_type)
+ {
+ case R_PPC_REL24:
+ case R_PPC_LOCAL24PC:
+ case R_PPC_PLTREL24:
+ max_branch_offset = 1 << 25;
+ break;
- dyncon = (Elf32_External_Dyn *) sdyn->contents;
- dynconend = (Elf32_External_Dyn *) (sdyn->contents + sdyn->_raw_size);
- for (; dyncon < dynconend; dyncon++)
+ 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)
{
- Elf_Internal_Dyn dyn;
- asection *s;
+ /* A local symbol. */
+ Elf_Internal_Sym *isym;
- bfd_elf32_swap_dyn_in (htab->elf.dynobj, dyncon, &dyn);
+ /* 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);
- switch (dyn.d_tag)
+ toff = isym->st_value;
+ sym_type = ELF_ST_TYPE (isym->st_info);
+ }
+ 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;
+
+ tsec = NULL;
+ toff = 0;
+ if (r_type == R_PPC_PLTREL24
+ && htab->plt != NULL)
{
- case DT_PLTGOT:
- s = htab->plt;
- dyn.d_un.d_ptr = s->output_section->vma + s->output_offset;
- break;
+ struct plt_entry *ent = find_plt_ent (h, got2, irel->r_addend);
- case DT_PLTRELSZ:
- dyn.d_un.d_val = htab->relplt->_raw_size;
- break;
+ if (ent != NULL)
+ {
+ if (htab->plt_type == PLT_NEW)
+ {
+ tsec = htab->glink;
+ toff = ent->glink_offset;
+ }
+ else
+ {
+ tsec = htab->plt;
+ toff = ent->plt.offset;
+ }
+ }
+ }
+ if (tsec != NULL)
+ ;
+ 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;
- case DT_JMPREL:
- s = htab->relplt;
- dyn.d_un.d_ptr = s->output_section->vma + s->output_offset;
- break;
+ sym_type = h->type;
+ }
- default:
- 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;
+
+ /* There probably isn't any reason to handle symbols in
+ SEC_MERGE sections; SEC_MERGE doesn't seem a likely
+ attribute for a code section, and we are only looking at
+ branches. However, implement it correctly here as a
+ reference for other target relax_section functions. */
+ if (0 && tsec->sec_info_type == ELF_INFO_TYPE_MERGE)
+ {
+ /* At this stage in linking, no SEC_MERGE symbol has been
+ adjusted, so all references to such symbols need to be
+ passed through _bfd_merged_section_offset. (Later, in
+ relocate_section, all SEC_MERGE symbols *except* for
+ section symbols have been adjusted.)
+
+ gas may reduce relocations against symbols in SEC_MERGE
+ sections to a relocation against the section symbol when
+ the original addend was zero. When the reloc is against
+ a section symbol we should include the addend in the
+ offset passed to _bfd_merged_section_offset, since the
+ location of interest is the original symbol. On the
+ other hand, an access to "sym+addend" where "sym" is not
+ a section symbol should not include the addend; Such an
+ access is presumed to be an offset from "sym"; The
+ location of interest is just "sym". */
+ if (sym_type == STT_SECTION)
+ toff += irel->r_addend;
+
+ toff = _bfd_merged_section_offset (abfd, &tsec,
+ elf_section_data (tsec)->sec_info,
+ toff);
+
+ if (sym_type != STT_SECTION)
+ toff += irel->r_addend;
+ }
+ /* PLTREL24 addends are special. */
+ else if (r_type != R_PPC_PLTREL24)
+ toff += irel->r_addend;
+
+ /* Attempted -shared link of non-pic code loses. */
+ if (tsec->output_section == NULL)
+ continue;
+
+ 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;
}
- bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon);
+ if (R_PPC_RELAX32_PLT - R_PPC_RELAX32
+ != R_PPC_RELAX32PC_PLT - R_PPC_RELAX32PC)
+ abort ();
+ if (tsec == htab->plt
+ || tsec == htab->glink)
+ stub_rtype += R_PPC_RELAX32_PLT - 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);
+ }
+
+ /* Get the section contents. */
+ if (contents == NULL)
+ {
+ /* 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. */
+ if (!bfd_malloc_and_get_section (abfd, isec, &contents))
+ goto error_return;
+ }
+ }
+
+ /* 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;
}
}
- /* 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)
+ /* 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->size = (isec->size + 3) & (bfd_vma) -4;
+ /* Branch around the trampolines. */
+ val = trampoff - isec->size + 0x48000000;
+ dest = contents + isec->size;
+ isec->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)
{
- unsigned char *contents = htab->got->contents;
- bfd_put_32 (output_bfd, 0x4e800021 /* blrl */, contents);
+ if (! link_info->keep_memory)
+ free (isymbuf);
+ else
+ {
+ /* Cache the symbols for elf_link_input_bfd. */
+ symtab_hdr->contents = (unsigned char *) isymbuf;
+ }
+ }
- if (sdyn == NULL)
- bfd_put_32 (output_bfd, 0, contents + 4);
+ if (contents != NULL
+ && elf_section_data (isec)->this_hdr.contents != contents)
+ {
+ if (!changed && !link_info->keep_memory)
+ free (contents);
else
- bfd_put_32 (output_bfd,
- sdyn->output_section->vma + sdyn->output_offset,
- contents + 4);
+ {
+ /* Cache the section contents for elf_link_input_bfd. */
+ elf_section_data (isec)->this_hdr.contents = contents;
+ }
+ }
- elf_section_data (htab->got->output_section)->this_hdr.sh_entsize = 4;
+ 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;
}
+/* What to do when ld finds relocations against symbols defined in
+ discarded sections. */
+
+static unsigned int
+ppc_elf_action_discarded (asection *sec)
+{
+ if (strcmp (".fixup", sec->name) == 0)
+ return 0;
+
+ if (strcmp (".got2", sec->name) == 0)
+ return 0;
+
+ return _bfd_elf_default_action_discarded (sec);
+}
+
+/* Fill in the address for a pointer generated in a linker section. */
+
+static bfd_vma
+elf_finish_pointer_linker_section (bfd *input_bfd,
+ elf_linker_section_t *lsect,
+ struct elf_link_hash_entry *h,
+ bfd_vma relocation,
+ const Elf_Internal_Rela *rel)
+{
+ 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;
+ BFD_ASSERT (eh->elf.def_regular);
+ linker_section_ptr = eh->linker_section_pointer;
+ }
+ else
+ {
+ /* Handle local symbol. */
+ unsigned long r_symndx = ELF32_R_SYM (rel->r_info);
+
+ BFD_ASSERT (elf_local_ptr_offsets (input_bfd) != NULL);
+ linker_section_ptr = elf_local_ptr_offsets (input_bfd)[r_symndx];
+ }
+
+ linker_section_ptr = elf_find_pointer_linker_section (linker_section_ptr,
+ rel->r_addend,
+ lsect);
+ BFD_ASSERT (linker_section_ptr != NULL);
+
+ /* Offset will always be a multiple of four, so use the bottom bit
+ as a "written" flag. */
+ if ((linker_section_ptr->offset & 1) == 0)
+ {
+ bfd_put_32 (lsect->section->owner,
+ relocation + linker_section_ptr->addend,
+ lsect->section->contents + linker_section_ptr->offset);
+ linker_section_ptr->offset += 1;
+ }
+
+ relocation = (lsect->section->output_offset
+ + linker_section_ptr->offset - 1
+ - 0x8000);
+
+#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;
+}
+
/* The RELOCATE_SECTION function is called by the ELF backend linker
to handle the relocations for a section.
@@ -4629,21 +5653,20 @@ ppc_elf_relocate_section (bfd *output_bfd,
Elf_Internal_Rela *relend;
Elf_Internal_Rela outrel;
bfd_byte *loc;
- asection *sreloc = NULL;
+ asection *got2, *sreloc = NULL;
bfd_vma *local_got_offsets;
bfd_boolean ret = TRUE;
+ bfd_vma d_offset = (bfd_big_endian (output_bfd) ? 2 : 0);
#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)" : "");
+ _bfd_error_handler ("ppc_elf_relocate_section called for %B section %A, "
+ "%ld relocations%s",
+ input_bfd, input_section,
+ (long) input_section->reloc_count,
+ (info->relocatable) ? " (relocatable)" : "");
#endif
- if (info->relocatable)
- return TRUE;
+ got2 = bfd_get_section_by_name (input_bfd, ".got2");
/* Initialize howto table if not already done. */
if (!ppc_elf_howto_table[R_PPC_ADDR32])
@@ -4684,7 +5707,7 @@ ppc_elf_relocate_section (bfd *output_bfd,
{
sym = local_syms + r_symndx;
sec = local_sections[r_symndx];
- sym_name = bfd_elf_local_sym_name (input_bfd, sym);
+ sym_name = bfd_elf_sym_name (input_bfd, symtab_hdr, sym, sec);
relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel);
}
@@ -4698,6 +5721,33 @@ ppc_elf_relocate_section (bfd *output_bfd,
sym_name = h->root.root.string;
}
+ if (sec != NULL && elf_discarded_section (sec))
+ {
+ /* For relocs against symbols from removed linkonce sections,
+ or sections discarded by a linker script, we just want the
+ section contents zeroed. Avoid any special processing. */
+ howto = NULL;
+ if (r_type < R_PPC_max)
+ howto = ppc_elf_howto_table[r_type];
+ _bfd_clear_contents (howto, input_bfd, contents + rel->r_offset);
+ rel->r_info = 0;
+ rel->r_addend = 0;
+ continue;
+ }
+
+ if (info->relocatable)
+ {
+ if (got2 != NULL
+ && r_type == R_PPC_PLTREL24
+ && rel->r_addend >= 32768)
+ {
+ /* R_PPC_PLTREL24 is rather special. If non-zero, the
+ addend specifies the GOT pointer offset within .got2. */
+ rel->r_addend += got2->output_offset;
+ }
+ continue;
+ }
+
/* 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
@@ -4737,10 +5787,10 @@ ppc_elf_relocate_section (bfd *output_bfd,
&& (tls_mask & TLS_TPREL) == 0)
{
bfd_vma insn;
- insn = bfd_get_32 (output_bfd, contents + rel->r_offset - 2);
+ insn = bfd_get_32 (output_bfd, contents + rel->r_offset - d_offset);
insn &= 31 << 21;
insn |= 0x3c020000; /* addis 0,2,0 */
- bfd_put_32 (output_bfd, insn, contents + rel->r_offset - 2);
+ bfd_put_32 (output_bfd, insn, contents + rel->r_offset - d_offset);
r_type = R_PPC_TPREL16_HA;
rel->r_info = ELF32_R_INFO (r_symndx, r_type);
}
@@ -4784,9 +5834,10 @@ ppc_elf_relocate_section (bfd *output_bfd,
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;
+ PPC_TPREL16_LO which is at low-order half-word. */
+ rel->r_offset += d_offset;
}
break;
@@ -4808,7 +5859,7 @@ ppc_elf_relocate_section (bfd *output_bfd,
else
{
bfd_put_32 (output_bfd, NOP, contents + rel->r_offset);
- rel->r_offset -= 2;
+ rel->r_offset -= d_offset;
r_type = R_PPC_NONE;
}
rel->r_info = ELF32_R_INFO (r_symndx, r_type);
@@ -4857,7 +5908,7 @@ ppc_elf_relocate_section (bfd *output_bfd,
/* OK, it checks out. Replace the call. */
offset = rel[1].r_offset;
insn1 = bfd_get_32 (output_bfd,
- contents + rel->r_offset - 2);
+ contents + rel->r_offset - d_offset);
if ((tls_mask & tls_gd) != 0)
{
/* IE */
@@ -4865,6 +5916,7 @@ ppc_elf_relocate_section (bfd *output_bfd,
insn1 |= 32 << 26; /* lwz */
insn2 = 0x7c631214; /* add 3,3,2 */
rel[1].r_info = ELF32_R_INFO (r_symndx2, R_PPC_NONE);
+ rel[1].r_addend = 0;
r_type = (((r_type - (R_PPC_GOT_TLSGD16 & 3)) & 3)
+ R_PPC_GOT_TPREL16);
rel->r_info = ELF32_R_INFO (r_symndx, r_type);
@@ -4879,15 +5931,15 @@ ppc_elf_relocate_section (bfd *output_bfd,
/* 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;
+ rel[1].r_offset += d_offset;
+ rel[1].r_addend = rel->r_addend;
}
- bfd_put_32 (output_bfd, insn1, contents + rel->r_offset - 2);
+ bfd_put_32 (output_bfd, insn1, contents + rel->r_offset - d_offset);
bfd_put_32 (output_bfd, insn2, contents + offset);
if (tls_gd == 0)
{
@@ -4942,8 +5994,8 @@ ppc_elf_relocate_section (bfd *output_bfd,
{
default:
(*_bfd_error_handler)
- (_("%s: unknown relocation type %d for symbol %s"),
- bfd_archive_filename (input_bfd), (int) r_type, sym_name);
+ (_("%B: unknown relocation type %d for symbol %s"),
+ input_bfd, (int) r_type, sym_name);
bfd_set_error (bfd_error_bad_value);
ret = FALSE;
@@ -5006,7 +6058,7 @@ ppc_elf_relocate_section (bfd *output_bfd,
indx = 0;
if (tls_type == (TLS_TLS | TLS_LD)
&& (h == NULL
- || !(h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC)))
+ || !h->def_dynamic))
offp = &htab->tlsld_got.offset;
else if (h != NULL)
{
@@ -5049,8 +6101,7 @@ ppc_elf_relocate_section (bfd *output_bfd,
if (offp == &htab->tlsld_got.offset)
tls_m = TLS_LD;
else if (h == NULL
- || !(h->elf_link_hash_flags
- & ELF_LINK_HASH_DEF_DYNAMIC))
+ || !h->def_dynamic)
tls_m &= ~TLS_LD;
/* We might have multiple got entries for this sym.
@@ -5169,8 +6220,7 @@ ppc_elf_relocate_section (bfd *output_bfd,
{
if ((tls_mask & TLS_LD) != 0
&& !(h == NULL
- || !(h->elf_link_hash_flags
- & ELF_LINK_HASH_DEF_DYNAMIC)))
+ || !h->def_dynamic))
off += 8;
if (tls_type != (TLS_TLS | TLS_GD))
{
@@ -5185,7 +6235,8 @@ ppc_elf_relocate_section (bfd *output_bfd,
}
}
- relocation = htab->got->output_offset + off - 4;
+ relocation = htab->got->output_offset + off;
+ relocation -= htab->elf.hgot->root.u.def.value;
/* Addends on got relocations don't make much sense.
x+off@got is actually x@got+off, and since the got is
@@ -5193,9 +6244,9 @@ ppc_elf_relocate_section (bfd *output_bfd,
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),
+ (_("%B(%A+0x%lx): non-zero addend on %s reloc against `%s'"),
+ input_bfd,
+ input_section,
(long) rel->r_offset,
howto->name,
sym_name);
@@ -5251,6 +6302,12 @@ ppc_elf_relocate_section (bfd *output_bfd,
addend = 0;
goto dodyn;
+ case R_PPC_REL16:
+ case R_PPC_REL16_LO:
+ case R_PPC_REL16_HI:
+ case R_PPC_REL16_HA:
+ break;
+
case R_PPC_REL24:
case R_PPC_REL32:
case R_PPC_REL14:
@@ -5259,7 +6316,7 @@ ppc_elf_relocate_section (bfd *output_bfd,
/* 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)
+ || h == htab->elf.hgot)
break;
/* fall through */
@@ -5276,11 +6333,8 @@ ppc_elf_relocate_section (bfd *output_bfd,
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)
+ if ((input_section->flags & SEC_ALLOC) == 0)
break;
/* Fall thru. */
@@ -5292,12 +6346,11 @@ ppc_elf_relocate_section (bfd *output_bfd,
|| !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))
+ && !h->non_got_ref
+ && h->def_dynamic
+ && !h->def_regular))
{
int skip;
@@ -5322,7 +6375,7 @@ ppc_elf_relocate_section (bfd *output_bfd,
if (name == NULL)
return FALSE;
- BFD_ASSERT (strncmp (name, ".rela", 5) == 0
+ BFD_ASSERT (CONST_STRNEQ (name, ".rela")
&& strcmp (bfd_get_section_name (input_bfd,
input_section),
name + 5) == 0);
@@ -5378,10 +6431,15 @@ ppc_elf_relocate_section (bfd *output_bfd,
but ld.so expects buggy relocs. */
osec = sec->output_section;
indx = elf_section_data (osec)->dynindx;
- BFD_ASSERT (indx > 0);
+ if (indx == 0)
+ {
+ osec = htab->elf.text_index_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",
+ if (indx == 0)
+ printf ("indx=%ld section=%s flags=%08x name=%s\n",
indx, osec->name, osec->flags,
h->root.root.string);
#endif
@@ -5411,12 +6469,33 @@ ppc_elf_relocate_section (bfd *output_bfd,
}
break;
+ case R_PPC_RELAX32PC_PLT:
+ case R_PPC_RELAX32_PLT:
+ {
+ struct plt_entry *ent = find_plt_ent (h, got2, addend);
+
+ if (htab->plt_type == PLT_NEW)
+ relocation = (htab->glink->output_section->vma
+ + htab->glink->output_offset
+ + ent->glink_offset);
+ else
+ relocation = (htab->plt->output_section->vma
+ + htab->plt->output_offset
+ + ent->plt.offset);
+ addend = 0;
+ }
+ if (r_type == R_PPC_RELAX32_PLT)
+ goto relax32;
+ /* Fall thru */
+
case R_PPC_RELAX32PC:
relocation -= (input_section->output_section->vma
+ input_section->output_offset
+ rel->r_offset - 4);
/* Fall thru */
+
case R_PPC_RELAX32:
+ relax32:
{
unsigned long t0;
unsigned long t1;
@@ -5441,20 +6520,18 @@ ppc_elf_relocate_section (bfd *output_bfd,
/* Indirect .sdata relocation. */
case R_PPC_EMB_SDAI16:
- BFD_ASSERT (htab->sdata != NULL);
+ BFD_ASSERT (htab->sdata[0].section != NULL);
relocation
- = elf_finish_pointer_linker_section (output_bfd, input_bfd, info,
- htab->sdata, h, relocation,
- rel, R_PPC_RELATIVE);
+ = elf_finish_pointer_linker_section (input_bfd, &htab->sdata[0],
+ h, relocation, rel);
break;
/* Indirect .sdata2 relocation. */
case R_PPC_EMB_SDA2I16:
- BFD_ASSERT (htab->sdata2 != NULL);
+ BFD_ASSERT (htab->sdata[1].section != NULL);
relocation
- = elf_finish_pointer_linker_section (output_bfd, input_bfd, info,
- htab->sdata2, h, relocation,
- rel, R_PPC_RELATIVE);
+ = elf_finish_pointer_linker_section (input_bfd, &htab->sdata[1],
+ h, relocation, rel);
break;
/* Handle the TOC16 reloc. We want to use the offset within the .got
@@ -5465,7 +6542,7 @@ ppc_elf_relocate_section (bfd *output_bfd,
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)
+ || strcmp (bfd_get_section_name (abfd, sec), ".cgot") == 0);
addend -= sec->output_section->vma + sec->output_offset + 0x8000;
break;
@@ -5473,48 +6550,56 @@ ppc_elf_relocate_section (bfd *output_bfd,
case R_PPC_PLTREL24:
/* Relocation is to the entry for this symbol in the
procedure linkage table. */
- BFD_ASSERT (h != NULL);
+ {
+ struct plt_entry *ent = find_plt_ent (h, got2, addend);
- 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;
- }
+ addend = 0;
+ if (ent == NULL
+ || 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);
+ unresolved_reloc = FALSE;
+ if (htab->plt_type == PLT_NEW)
+ relocation = (htab->glink->output_section->vma
+ + htab->glink->output_offset
+ + ent->glink_offset);
+ else
+ relocation = (htab->plt->output_section->vma
+ + htab->plt->output_offset
+ + ent->plt.offset);
+ }
break;
/* Relocate against _SDA_BASE_. */
case R_PPC_SDAREL16:
{
const char *name;
- const struct elf_link_hash_entry *sh;
+ 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
+ if (! ((CONST_STRNEQ (name, ".sdata")
&& (name[6] == 0 || name[6] == '.'))
- || (strncmp (name, ".sbss", 5) == 0
+ || (CONST_STRNEQ (name, ".sbss")
&& (name[5] == 0 || name[5] == '.'))))
{
(*_bfd_error_handler)
- (_("%s: the target (%s) of a %s relocation is "
+ (_("%B: the target (%s) of a %s relocation is "
"in the wrong output section (%s)"),
- bfd_archive_filename (input_bfd),
+ input_bfd,
sym_name,
howto->name,
name);
}
- sh = htab->sdata->sym_hash;
+ sh = htab->sdata[0].sym;
addend -= (sh->root.u.def.value
- + sh->root.u.def.section->output_section->vma
- + sh->root.u.def.section->output_offset);
+ + sh->root.u.def.section->output_offset
+ + sh->root.u.def.section->output_section->vma);
}
break;
@@ -5522,17 +6607,17 @@ ppc_elf_relocate_section (bfd *output_bfd,
case R_PPC_EMB_SDA2REL:
{
const char *name;
- const struct elf_link_hash_entry *sh;
+ 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))
+ if (! (CONST_STRNEQ (name, ".sdata2")
+ || CONST_STRNEQ (name, ".sbss2")))
{
(*_bfd_error_handler)
- (_("%s: the target (%s) of a %s relocation is "
+ (_("%B: the target (%s) of a %s relocation is "
"in the wrong output section (%s)"),
- bfd_archive_filename (input_bfd),
+ input_bfd,
sym_name,
howto->name,
name);
@@ -5541,10 +6626,10 @@ ppc_elf_relocate_section (bfd *output_bfd,
ret = FALSE;
continue;
}
- sh = htab->sdata2->sym_hash;
+ sh = htab->sdata[1].sym;
addend -= (sh->root.u.def.value
- + sh->root.u.def.section->output_section->vma
- + sh->root.u.def.section->output_offset);
+ + sh->root.u.def.section->output_offset
+ + sh->root.u.def.section->output_section->vma);
}
break;
@@ -5553,31 +6638,31 @@ ppc_elf_relocate_section (bfd *output_bfd,
case R_PPC_EMB_RELSDA:
{
const char *name;
- const struct elf_link_hash_entry *sh;
int reg;
+ 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
+ if (((CONST_STRNEQ (name, ".sdata")
&& (name[6] == 0 || name[6] == '.'))
- || (strncmp (name, ".sbss", 5) == 0
+ || (CONST_STRNEQ (name, ".sbss")
&& (name[5] == 0 || name[5] == '.'))))
{
reg = 13;
- sh = htab->sdata->sym_hash;
+ sh = htab->sdata[0].sym;
addend -= (sh->root.u.def.value
- + sh->root.u.def.section->output_section->vma
- + sh->root.u.def.section->output_offset);
+ + sh->root.u.def.section->output_offset
+ + sh->root.u.def.section->output_section->vma);
}
- else if (strncmp (name, ".sdata2", 7) == 0
- || strncmp (name, ".sbss2", 6) == 0)
+ else if (CONST_STRNEQ (name, ".sdata2")
+ || CONST_STRNEQ (name, ".sbss2"))
{
reg = 2;
- sh = htab->sdata2->sym_hash;
+ sh = htab->sdata[1].sym;
addend -= (sh->root.u.def.value
- + sh->root.u.def.section->output_section->vma
- + sh->root.u.def.section->output_offset);
+ + sh->root.u.def.section->output_offset
+ + sh->root.u.def.section->output_section->vma);
}
else if (strcmp (name, ".PPC.EMB.sdata0") == 0
@@ -5589,9 +6674,9 @@ ppc_elf_relocate_section (bfd *output_bfd,
else
{
(*_bfd_error_handler)
- (_("%s: the target (%s) of a %s relocation is "
+ (_("%B: the target (%s) of a %s relocation is "
"in the wrong output section (%s)"),
- bfd_archive_filename (input_bfd),
+ input_bfd,
sym_name,
howto->name,
name);
@@ -5644,8 +6729,8 @@ ppc_elf_relocate_section (bfd *output_bfd,
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),
+ (_("%B: relocation %s is not yet supported for symbol %s."),
+ input_bfd,
howto->name,
sym_name);
@@ -5661,25 +6746,29 @@ ppc_elf_relocate_section (bfd *output_bfd,
break;
case R_PPC_ADDR16_HA:
- case R_PPC_GOT16_HA:
- case R_PPC_PLT16_HA:
+ case R_PPC_REL16_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;
+ if (sec == NULL)
+ break;
+ /* Fall thru */
+
+ case R_PPC_PLT16_HA:
+ case R_PPC_GOT16_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:
+ /* Add 0x10000 if sign bit in 0:15 is set.
+ Bits 0:15 are not used. */
+ addend += 0x8000;
break;
}
@@ -5696,12 +6785,12 @@ ppc_elf_relocate_section (bfd *output_bfd,
if (unresolved_reloc
&& !((input_section->flags & SEC_DEBUGGING) != 0
- && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) != 0))
+ && h->def_dynamic))
{
(*_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),
+ (_("%B(%A+0x%lx): unresolvable %s relocation against symbol `%s'"),
+ input_bfd,
+ input_section,
(long) rel->r_offset,
howto->name,
sym_name);
@@ -5718,8 +6807,6 @@ ppc_elf_relocate_section (bfd *output_bfd,
if (r != bfd_reloc_ok)
{
- if (sym_name == NULL)
- sym_name = "(null)";
if (r == bfd_reloc_overflow)
{
if (warned)
@@ -5738,6 +6825,7 @@ ppc_elf_relocate_section (bfd *output_bfd,
}
if (! (*info->callbacks->reloc_overflow) (info,
+ (h ? &h->root : NULL),
sym_name,
howto->name,
rel->r_addend,
@@ -5749,9 +6837,8 @@ ppc_elf_relocate_section (bfd *output_bfd,
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),
+ (_("%B(%A+0x%lx): %s reloc against `%s': error %d"),
+ input_bfd, input_section,
(long) rel->r_offset, howto->name, sym_name, (int) r);
ret = FALSE;
}
@@ -5764,388 +6851,723 @@ ppc_elf_relocate_section (bfd *output_bfd,
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. */
+#define PPC_LO(v) ((v) & 0xffff)
+#define PPC_HI(v) (((v) >> 16) & 0xffff)
+#define PPC_HA(v) PPC_HI ((v) + 0x8000)
+
+/* Finish up dynamic symbol handling. We set the contents of various
+ dynamic sections here. */
static bfd_boolean
-ppc_elf_grok_prstatus (bfd *abfd, Elf_Internal_Note *note)
+ppc_elf_finish_dynamic_symbol (bfd *output_bfd,
+ struct bfd_link_info *info,
+ struct elf_link_hash_entry *h,
+ Elf_Internal_Sym *sym)
{
- 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);
+ struct ppc_elf_link_hash_table *htab;
+ struct plt_entry *ent;
+ bfd_boolean doneone;
- /* pr_pid */
- elf_tdata (abfd)->core_pid = bfd_get_32 (abfd, note->descdata + 24);
+#ifdef DEBUG
+ fprintf (stderr, "ppc_elf_finish_dynamic_symbol called for %s",
+ h->root.root.string);
+#endif
- /* pr_reg */
- offset = 72;
- raw_size = 192;
+ htab = ppc_elf_hash_table (info);
+ BFD_ASSERT (htab->elf.dynobj != NULL);
- break;
- }
+ doneone = FALSE;
+ for (ent = h->plt.plist; ent != NULL; ent = ent->next)
+ if (ent->plt.offset != (bfd_vma) -1)
+ {
+ if (!doneone)
+ {
+ Elf_Internal_Rela rela;
+ bfd_byte *loc;
+ bfd_vma reloc_index;
- /* Make a ".reg/999" section. */
- return _bfd_elfcore_make_pseudosection (abfd, ".reg",
- raw_size, note->descpos + offset);
-}
+ if (htab->plt_type == PLT_NEW)
+ reloc_index = ent->plt.offset / 4;
+ else
+ {
+ reloc_index = ((ent->plt.offset - htab->plt_initial_entry_size)
+ / htab->plt_slot_size);
+ if (reloc_index > PLT_NUM_SINGLE_ENTRIES
+ && htab->plt_type == PLT_OLD)
+ reloc_index -= (reloc_index - PLT_NUM_SINGLE_ENTRIES) / 2;
+ }
-static bfd_boolean
-ppc_elf_grok_psinfo (bfd *abfd, Elf_Internal_Note *note)
-{
- switch (note->descsz)
- {
- default:
- return FALSE;
+ /* This symbol has an entry in the procedure linkage table.
+ Set it up. */
+ if (htab->plt_type == PLT_VXWORKS)
+ {
+ bfd_vma got_offset;
+ const bfd_vma *plt_entry;
+
+ /* The first three entries in .got.plt are reserved. */
+ got_offset = (reloc_index + 3) * 4;
- 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);
- }
+ /* Use the right PLT. */
+ plt_entry = info->shared ? ppc_elf_vxworks_pic_plt_entry
+ : ppc_elf_vxworks_plt_entry;
- /* 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. */
+ /* Fill in the .plt on VxWorks. */
+ if (info->shared)
+ {
+ bfd_vma got_offset_hi = (got_offset >> 16)
+ + ((got_offset & 0x8000) >> 15);
+
+ bfd_put_32 (output_bfd,
+ plt_entry[0] | (got_offset_hi & 0xffff),
+ htab->plt->contents + ent->plt.offset + 0);
+ bfd_put_32 (output_bfd,
+ plt_entry[1] | (got_offset & 0xffff),
+ htab->plt->contents + ent->plt.offset + 4);
+ }
+ else
+ {
+ bfd_vma got_loc
+ = (got_offset
+ + htab->elf.hgot->root.u.def.value
+ + htab->elf.hgot->root.u.def.section->output_offset
+ + htab->elf.hgot->root.u.def.section->output_section->vma);
+ bfd_vma got_loc_hi = (got_loc >> 16)
+ + ((got_loc & 0x8000) >> 15);
+
+ bfd_put_32 (output_bfd,
+ plt_entry[0] | (got_loc_hi & 0xffff),
+ htab->plt->contents + ent->plt.offset + 0);
+ bfd_put_32 (output_bfd,
+ plt_entry[1] | (got_loc & 0xffff),
+ htab->plt->contents + ent->plt.offset + 4);
+ }
- {
- char *command = elf_tdata (abfd)->core_command;
- int n = strlen (command);
+ bfd_put_32 (output_bfd, plt_entry[2],
+ htab->plt->contents + ent->plt.offset + 8);
+ bfd_put_32 (output_bfd, plt_entry[3],
+ htab->plt->contents + ent->plt.offset + 12);
+
+ /* This instruction is an immediate load. The value loaded is
+ the byte offset of the R_PPC_JMP_SLOT relocation from the
+ start of the .rela.plt section. The value is stored in the
+ low-order 16 bits of the load instruction. */
+ /* NOTE: It appears that this is now an index rather than a
+ prescaled offset. */
+ bfd_put_32 (output_bfd,
+ plt_entry[4] | reloc_index,
+ htab->plt->contents + ent->plt.offset + 16);
+ /* This instruction is a PC-relative branch whose target is
+ the start of the PLT section. The address of this branch
+ instruction is 20 bytes beyond the start of this PLT entry.
+ The address is encoded in bits 6-29, inclusive. The value
+ stored is right-shifted by two bits, permitting a 26-bit
+ offset. */
+ bfd_put_32 (output_bfd,
+ (plt_entry[5]
+ | (-(ent->plt.offset + 20) & 0x03fffffc)),
+ htab->plt->contents + ent->plt.offset + 20);
+ bfd_put_32 (output_bfd, plt_entry[6],
+ htab->plt->contents + ent->plt.offset + 24);
+ bfd_put_32 (output_bfd, plt_entry[7],
+ htab->plt->contents + ent->plt.offset + 28);
+
+ /* Fill in the GOT entry corresponding to this PLT slot with
+ the address immediately after the the "bctr" instruction
+ in this PLT entry. */
+ bfd_put_32 (output_bfd, (htab->plt->output_section->vma
+ + htab->plt->output_offset
+ + ent->plt.offset + 16),
+ htab->sgotplt->contents + got_offset);
+
+ if (!info->shared)
+ {
+ /* Fill in a couple of entries in .rela.plt.unloaded. */
+ loc = htab->srelplt2->contents
+ + ((VXWORKS_PLTRESOLVE_RELOCS + reloc_index
+ * VXWORKS_PLT_NON_JMP_SLOT_RELOCS)
+ * sizeof (Elf32_External_Rela));
+
+ /* Provide the @ha relocation for the first instruction. */
+ rela.r_offset = (htab->plt->output_section->vma
+ + htab->plt->output_offset
+ + ent->plt.offset + 2);
+ rela.r_info = ELF32_R_INFO (htab->elf.hgot->indx,
+ R_PPC_ADDR16_HA);
+ rela.r_addend = got_offset;
+ bfd_elf32_swap_reloca_out (output_bfd, &rela, loc);
+ loc += sizeof (Elf32_External_Rela);
+
+ /* Provide the @l relocation for the second instruction. */
+ rela.r_offset = (htab->plt->output_section->vma
+ + htab->plt->output_offset
+ + ent->plt.offset + 6);
+ rela.r_info = ELF32_R_INFO (htab->elf.hgot->indx,
+ R_PPC_ADDR16_LO);
+ rela.r_addend = got_offset;
+ bfd_elf32_swap_reloca_out (output_bfd, &rela, loc);
+ loc += sizeof (Elf32_External_Rela);
+
+ /* Provide a relocation for the GOT entry corresponding to this
+ PLT slot. Point it at the middle of the .plt entry. */
+ rela.r_offset = (htab->sgotplt->output_section->vma
+ + htab->sgotplt->output_offset
+ + got_offset);
+ rela.r_info = ELF32_R_INFO (htab->elf.hplt->indx,
+ R_PPC_ADDR32);
+ rela.r_addend = ent->plt.offset + 16;
+ bfd_elf32_swap_reloca_out (output_bfd, &rela, loc);
+ }
- if (0 < n && command[n - 1] == ' ')
- command[n - 1] = '\0';
- }
+ /* VxWorks uses non-standard semantics for R_PPC_JMP_SLOT.
+ In particular, the offset for the relocation is not the
+ address of the PLT entry for this function, as specified
+ by the ABI. Instead, the offset is set to the address of
+ the GOT slot for this function. See EABI 4.4.4.1. */
+ rela.r_offset = (htab->sgotplt->output_section->vma
+ + htab->sgotplt->output_offset
+ + got_offset);
- return TRUE;
-}
-
-/* Very simple linked list structure for recording apuinfo values. */
-typedef struct apuinfo_list
-{
- struct apuinfo_list *next;
- unsigned long value;
-}
-apuinfo_list;
+ }
+ else
+ {
+ rela.r_offset = (htab->plt->output_section->vma
+ + htab->plt->output_offset
+ + ent->plt.offset);
+ if (htab->plt_type == PLT_OLD)
+ {
+ /* We don't need to fill in the .plt. The ppc dynamic
+ linker will fill it in. */
+ }
+ else
+ {
+ bfd_vma val = (htab->glink_pltresolve + ent->plt.offset
+ + htab->glink->output_section->vma
+ + htab->glink->output_offset);
+ bfd_put_32 (output_bfd, val,
+ htab->plt->contents + ent->plt.offset);
+ }
+ }
-static apuinfo_list *head;
+ /* Fill in the entry in the .rela.plt section. */
+ rela.r_info = ELF32_R_INFO (h->dynindx, R_PPC_JMP_SLOT);
+ rela.r_addend = 0;
+ loc = (htab->relplt->contents
+ + reloc_index * sizeof (Elf32_External_Rela));
+ bfd_elf32_swap_reloca_out (output_bfd, &rela, loc);
-static void
-apuinfo_list_init (void)
-{
- head = NULL;
-}
+ if (!h->def_regular)
+ {
+ /* 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->ref_regular_nonweak)
+ sym->st_value = 0;
+ }
+ doneone = TRUE;
+ }
-static void
-apuinfo_list_add (unsigned long value)
-{
- apuinfo_list *entry = head;
+ if (htab->plt_type == PLT_NEW)
+ {
+ bfd_vma plt;
+ unsigned char *p;
- while (entry != NULL)
- {
- if (entry->value == value)
- return;
- entry = entry->next;
- }
+ plt = (ent->plt.offset
+ + htab->plt->output_section->vma
+ + htab->plt->output_offset);
+ p = (unsigned char *) htab->glink->contents + ent->glink_offset;
- entry = bfd_malloc (sizeof (* entry));
- if (entry == NULL)
- return;
+ if (info->shared || info->pie)
+ {
+ bfd_vma got = 0;
- entry->value = value;
- entry->next = head;
- head = entry;
-}
+ if (ent->addend >= 32768)
+ got = (ent->addend
+ + ent->sec->output_section->vma
+ + ent->sec->output_offset);
+ else if (htab->elf.hgot != NULL)
+ got = (htab->elf.hgot->root.u.def.value
+ + htab->elf.hgot->root.u.def.section->output_section->vma
+ + htab->elf.hgot->root.u.def.section->output_offset);
-static unsigned
-apuinfo_list_length (void)
-{
- apuinfo_list *entry;
- unsigned long count;
+ plt -= got;
- for (entry = head, count = 0;
- entry;
- entry = entry->next)
- ++ count;
+ if (plt + 0x8000 < 0x10000)
+ {
+ bfd_put_32 (output_bfd, LWZ_11_30 + PPC_LO (plt), p);
+ p += 4;
+ bfd_put_32 (output_bfd, MTCTR_11, p);
+ p += 4;
+ bfd_put_32 (output_bfd, BCTR, p);
+ p += 4;
+ bfd_put_32 (output_bfd, NOP, p);
+ p += 4;
+ }
+ else
+ {
+ bfd_put_32 (output_bfd, ADDIS_11_30 + PPC_HA (plt), p);
+ p += 4;
+ bfd_put_32 (output_bfd, LWZ_11_11 + PPC_LO (plt), p);
+ p += 4;
+ bfd_put_32 (output_bfd, MTCTR_11, p);
+ p += 4;
+ bfd_put_32 (output_bfd, BCTR, p);
+ p += 4;
+ }
+ }
+ else
+ {
+ bfd_put_32 (output_bfd, LIS_11 + PPC_HA (plt), p);
+ p += 4;
+ bfd_put_32 (output_bfd, LWZ_11_11 + PPC_LO (plt), p);
+ p += 4;
+ bfd_put_32 (output_bfd, MTCTR_11, p);
+ p += 4;
+ bfd_put_32 (output_bfd, BCTR, p);
+ p += 4;
+
+ /* We only need one non-PIC glink stub. */
+ break;
+ }
+ }
+ else
+ break;
+ }
- return count;
-}
+ if (h->needs_copy)
+ {
+ asection *s;
+ Elf_Internal_Rela rela;
+ bfd_byte *loc;
-static inline unsigned long
-apuinfo_list_element (unsigned long number)
-{
- apuinfo_list * entry;
+ /* This symbols needs a copy reloc. Set it up. */
- for (entry = head;
- entry && number --;
- entry = entry->next)
- ;
+#ifdef DEBUG
+ fprintf (stderr, ", copy");
+#endif
- return entry ? entry->value : 0;
-}
+ BFD_ASSERT (h->dynindx != -1);
-static void
-apuinfo_list_finish (void)
-{
- apuinfo_list *entry;
+ if (ppc_elf_hash_entry (h)->has_sda_refs)
+ s = htab->relsbss;
+ else
+ s = htab->relbss;
+ BFD_ASSERT (s != NULL);
- for (entry = head; entry;)
- {
- apuinfo_list *next = entry->next;
- free (entry);
- entry = next;
+ 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);
}
- head = NULL;
-}
-
-#define APUINFO_SECTION_NAME ".PPC.EMB.apuinfo"
-#define APUINFO_LABEL "APUinfo"
+#ifdef DEBUG
+ fprintf (stderr, "\n");
+#endif
-/* Scan the input BFDs and create a linked list of
- the APUinfo values that will need to be emitted. */
+ /* Mark some specially defined symbols as absolute. */
+ if (strcmp (h->root.root.string, "_DYNAMIC") == 0
+ || (!htab->is_vxworks
+ && (h == htab->elf.hgot
+ || strcmp (h->root.root.string,
+ "_PROCEDURE_LINKAGE_TABLE_") == 0)))
+ sym->st_shndx = SHN_ABS;
-static void
-ppc_elf_begin_write_processing (bfd *abfd, struct bfd_link_info *link_info)
+ return TRUE;
+}
+
+static enum elf_reloc_type_class
+ppc_elf_reloc_type_class (const Elf_Internal_Rela *rela)
{
- 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)
+ switch (ELF32_R_TYPE (rela->r_info))
{
- asec = bfd_get_section_by_name (ibfd, APUINFO_SECTION_NAME);
- if (asec)
- {
- ++ num_input_sections;
- output_section_size += asec->_raw_size;
- }
+ 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;
}
+}
+
+/* Finish up the dynamic sections. */
- /* We need at least one input sections
- in order to make merging worthwhile. */
- if (num_input_sections < 1)
- return;
+static bfd_boolean
+ppc_elf_finish_dynamic_sections (bfd *output_bfd,
+ struct bfd_link_info *info)
+{
+ asection *sdyn;
+ asection *splt;
+ struct ppc_elf_link_hash_table *htab;
+ bfd_vma got;
+ bfd * dynobj;
- /* Just make sure that the output section exists as well. */
- asec = bfd_get_section_by_name (abfd, APUINFO_SECTION_NAME);
- if (asec == NULL)
- return;
+#ifdef DEBUG
+ fprintf (stderr, "ppc_elf_finish_dynamic_sections called\n");
+#endif
- /* Allocate a buffer for the contents of the input sections. */
- buffer = bfd_malloc (output_section_size);
- if (buffer == NULL)
- return;
+ htab = ppc_elf_hash_table (info);
+ dynobj = elf_hash_table (info)->dynobj;
+ sdyn = bfd_get_section_by_name (dynobj, ".dynamic");
+ if (htab->is_vxworks)
+ splt = bfd_get_section_by_name (dynobj, ".plt");
+ else
+ splt = NULL;
- offset = 0;
- apuinfo_list_init ();
+ got = 0;
+ if (htab->elf.hgot != NULL)
+ got = (htab->elf.hgot->root.u.def.value
+ + htab->elf.hgot->root.u.def.section->output_section->vma
+ + htab->elf.hgot->root.u.def.section->output_offset);
- /* Read in the input sections contents. */
- for (ibfd = link_info->input_bfds; ibfd; ibfd = ibfd->link_next)
+ if (htab->elf.dynamic_sections_created)
{
- unsigned long datum;
- char *ptr;
-
- asec = bfd_get_section_by_name (ibfd, APUINFO_SECTION_NAME);
- if (asec == NULL)
- continue;
+ Elf32_External_Dyn *dyncon, *dynconend;
- length = asec->_raw_size;
- if (length < 24)
- {
- error_message = _("corrupt or empty %s section in %s");
- goto fail;
- }
+ BFD_ASSERT (htab->plt != NULL && sdyn != NULL);
- if (bfd_seek (ibfd, asec->filepos, SEEK_SET) != 0
- || (bfd_bread (buffer + offset, length, ibfd) != length))
+ dyncon = (Elf32_External_Dyn *) sdyn->contents;
+ dynconend = (Elf32_External_Dyn *) (sdyn->contents + sdyn->size);
+ for (; dyncon < dynconend; dyncon++)
{
- error_message = _("unable to read in %s section from %s");
- goto fail;
- }
+ Elf_Internal_Dyn dyn;
+ asection *s;
- /* Process the contents of the section. */
- ptr = buffer + offset;
- error_message = _("corrupt %s section in %s");
+ bfd_elf32_swap_dyn_in (dynobj, dyncon, &dyn);
- /* 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;
+ switch (dyn.d_tag)
+ {
+ case DT_PLTGOT:
+ if (htab->is_vxworks)
+ s = htab->sgotplt;
+ else
+ s = htab->plt;
+ dyn.d_un.d_ptr = s->output_section->vma + s->output_offset;
+ break;
- datum = bfd_get_32 (ibfd, ptr + 8);
- if (datum != 0x2)
- goto fail;
+ case DT_PLTRELSZ:
+ dyn.d_un.d_val = htab->relplt->size;
+ break;
- if (strcmp (ptr + 12, APUINFO_LABEL) != 0)
- goto fail;
+ case DT_JMPREL:
+ s = htab->relplt;
+ dyn.d_un.d_ptr = s->output_section->vma + s->output_offset;
+ break;
- /* Get the number of bytes used for apuinfo entries. */
- datum = bfd_get_32 (ibfd, ptr + 4);
- if (datum + 20 != length)
- goto fail;
+ case DT_PPC_GOT:
+ dyn.d_un.d_ptr = got;
+ break;
- /* Make sure that we do not run off the end of the section. */
- if (offset + length > output_section_size)
- goto fail;
+ case DT_RELASZ:
+ if (htab->is_vxworks)
+ {
+ if (htab->relplt)
+ dyn.d_un.d_ptr -= htab->relplt->size;
+ break;
+ }
+ continue;
- /* 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));
+ default:
+ continue;
+ }
- /* Update the offset. */
- offset += length;
+ bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon);
+ }
}
- 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;
+ /* 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 != NULL)
+ {
+ unsigned char *p = htab->got->contents;
+ bfd_vma val;
- if (apuinfo_list_length () == 0)
- return;
+ p += htab->elf.hgot->root.u.def.value;
+ if (htab->plt_type == PLT_OLD)
+ bfd_put_32 (output_bfd, 0x4e800021 /* blrl */, p - 4);
- length = asec->_raw_size;
- if (length < 20)
- return;
+ val = 0;
+ if (sdyn != NULL)
+ val = sdyn->output_section->vma + sdyn->output_offset;
+ bfd_put_32 (output_bfd, val, p);
- buffer = bfd_malloc (length);
- if (buffer == NULL)
- {
- (*_bfd_error_handler)
- (_("failed to allocate space for new APUinfo section."));
- return;
+ elf_section_data (htab->got->output_section)->this_hdr.sh_entsize = 4;
}
- /* 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++)
+ /* Fill in the first entry in the VxWorks procedure linkage table. */
+ if (splt && splt->size > 0)
{
- bfd_put_32 (abfd, apuinfo_list_element (i), buffer + length);
- length += 4;
+ /* Use the right PLT. */
+ static const bfd_vma *plt_entry = NULL;
+ plt_entry = info->shared ?
+ ppc_elf_vxworks_pic_plt0_entry : ppc_elf_vxworks_plt0_entry;
+
+ if (!info->shared)
+ {
+ bfd_vma got_value =
+ (htab->elf.hgot->root.u.def.section->output_section->vma
+ + htab->elf.hgot->root.u.def.section->output_offset
+ + htab->elf.hgot->root.u.def.value);
+ bfd_vma got_hi = (got_value >> 16) + ((got_value & 0x8000) >> 15);
+
+ bfd_put_32 (output_bfd, plt_entry[0] | (got_hi & 0xffff),
+ splt->contents + 0);
+ bfd_put_32 (output_bfd, plt_entry[1] | (got_value & 0xffff),
+ splt->contents + 4);
+ }
+ else
+ {
+ bfd_put_32 (output_bfd, plt_entry[0], splt->contents + 0);
+ bfd_put_32 (output_bfd, plt_entry[1], splt->contents + 4);
+ }
+ bfd_put_32 (output_bfd, plt_entry[2], splt->contents + 8);
+ bfd_put_32 (output_bfd, plt_entry[3], splt->contents + 12);
+ bfd_put_32 (output_bfd, plt_entry[4], splt->contents + 16);
+ bfd_put_32 (output_bfd, plt_entry[5], splt->contents + 20);
+ bfd_put_32 (output_bfd, plt_entry[6], splt->contents + 24);
+ bfd_put_32 (output_bfd, plt_entry[7], splt->contents + 28);
+
+ if (! info->shared)
+ {
+ Elf_Internal_Rela rela;
+ bfd_byte *loc;
+
+ loc = htab->srelplt2->contents;
+
+ /* Output the @ha relocation for the first instruction. */
+ rela.r_offset = (htab->plt->output_section->vma
+ + htab->plt->output_offset
+ + 2);
+ rela.r_info = ELF32_R_INFO (htab->elf.hgot->indx, R_PPC_ADDR16_HA);
+ rela.r_addend = 0;
+ bfd_elf32_swap_reloca_out (output_bfd, &rela, loc);
+ loc += sizeof (Elf32_External_Rela);
+
+ /* Output the @l relocation for the second instruction. */
+ rela.r_offset = (htab->plt->output_section->vma
+ + htab->plt->output_offset
+ + 6);
+ rela.r_info = ELF32_R_INFO (htab->elf.hgot->indx, R_PPC_ADDR16_LO);
+ rela.r_addend = 0;
+ bfd_elf32_swap_reloca_out (output_bfd, &rela, loc);
+ loc += sizeof (Elf32_External_Rela);
+
+ /* Fix up the remaining relocations. They may have the wrong
+ symbol index for _G_O_T_ or _P_L_T_ depending on the order
+ in which symbols were output. */
+ while (loc < htab->srelplt2->contents + htab->srelplt2->size)
+ {
+ Elf_Internal_Rela rel;
+
+ bfd_elf32_swap_reloc_in (output_bfd, loc, &rel);
+ rel.r_info = ELF32_R_INFO (htab->elf.hgot->indx, R_PPC_ADDR16_HA);
+ bfd_elf32_swap_reloc_out (output_bfd, &rel, loc);
+ loc += sizeof (Elf32_External_Rela);
+
+ bfd_elf32_swap_reloc_in (output_bfd, loc, &rel);
+ rel.r_info = ELF32_R_INFO (htab->elf.hgot->indx, R_PPC_ADDR16_LO);
+ bfd_elf32_swap_reloc_out (output_bfd, &rel, loc);
+ loc += sizeof (Elf32_External_Rela);
+
+ bfd_elf32_swap_reloc_in (output_bfd, loc, &rel);
+ rel.r_info = ELF32_R_INFO (htab->elf.hplt->indx, R_PPC_ADDR32);
+ bfd_elf32_swap_reloc_out (output_bfd, &rel, loc);
+ loc += sizeof (Elf32_External_Rela);
+ }
+ }
}
- if (length != asec->_raw_size)
- (*_bfd_error_handler) (_("failed to compute new APUinfo section."));
+ if (htab->glink != NULL && htab->glink->contents != NULL)
+ {
+ unsigned char *p;
+ unsigned char *endp;
+ bfd_vma res0;
+ unsigned int i;
+
+ /*
+ * PIC glink code is the following:
+ *
+ * # ith PLT code stub.
+ * addis 11,30,(plt+(i-1)*4-got)@ha
+ * lwz 11,(plt+(i-1)*4-got)@l(11)
+ * mtctr 11
+ * bctr
+ *
+ * # A table of branches, one for each plt entry.
+ * # The idea is that the plt call stub loads ctr (and r11) with these
+ * # addresses, so (r11 - res_0) gives the plt index * 4.
+ * res_0: b PLTresolve
+ * res_1: b PLTresolve
+ * .
+ * # Some number of entries towards the end can be nops
+ * res_n_m3: nop
+ * res_n_m2: nop
+ * res_n_m1:
+ *
+ * PLTresolve:
+ * addis 11,11,(1f-res_0)@ha
+ * mflr 0
+ * bcl 20,31,1f
+ * 1: addi 11,11,(1b-res_0)@l
+ * mflr 12
+ * mtlr 0
+ * sub 11,11,12 # r11 = index * 4
+ * addis 12,12,(got+4-1b)@ha
+ * lwz 0,(got+4-1b)@l(12) # got[1] address of dl_runtime_resolve
+ * lwz 12,(got+8-1b)@l(12) # got[2] contains the map address
+ * mtctr 0
+ * add 0,11,11
+ * add 11,0,11 # r11 = index * 12 = reloc offset.
+ * bctr
+ */
+ static const unsigned int pic_plt_resolve[] =
+ {
+ ADDIS_11_11,
+ MFLR_0,
+ BCL_20_31,
+ ADDI_11_11,
+ MFLR_12,
+ MTLR_0,
+ SUB_11_11_12,
+ ADDIS_12_12,
+ LWZ_0_12,
+ LWZ_12_12,
+ MTCTR_0,
+ ADD_0_11_11,
+ ADD_11_0_11,
+ BCTR,
+ NOP,
+ NOP
+ };
+
+ static const unsigned int plt_resolve[] =
+ {
+ LIS_12,
+ ADDIS_11_11,
+ LWZ_0_12,
+ ADDI_11_11,
+ MTCTR_0,
+ ADD_0_11_11,
+ LWZ_12_12,
+ ADD_11_0_11,
+ BCTR,
+ NOP,
+ NOP,
+ NOP,
+ NOP,
+ NOP,
+ NOP,
+ NOP
+ };
+
+ if (ARRAY_SIZE (pic_plt_resolve) != GLINK_PLTRESOLVE / 4)
+ abort ();
+ if (ARRAY_SIZE (plt_resolve) != GLINK_PLTRESOLVE / 4)
+ abort ();
- if (! bfd_set_section_contents (abfd, asec, buffer, (file_ptr) 0, length))
- (*_bfd_error_handler) (_("failed to install new APUinfo section."));
+ /* Build the branch table, one for each plt entry (less one),
+ and perhaps some padding. */
+ p = htab->glink->contents;
+ p += htab->glink_pltresolve;
+ endp = htab->glink->contents;
+ endp += htab->glink->size - GLINK_PLTRESOLVE;
+ while (p < endp - 8 * 4)
+ {
+ bfd_put_32 (output_bfd, B + endp - p, p);
+ p += 4;
+ }
+ while (p < endp)
+ {
+ bfd_put_32 (output_bfd, NOP, p);
+ p += 4;
+ }
- free (buffer);
+ res0 = (htab->glink_pltresolve
+ + htab->glink->output_section->vma
+ + htab->glink->output_offset);
- apuinfo_list_finish ();
-}
+ /* Last comes the PLTresolve stub. */
+ if (info->shared || info->pie)
+ {
+ bfd_vma bcl;
-/* 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. */
+ for (i = 0; i < ARRAY_SIZE (pic_plt_resolve); i++)
+ {
+ bfd_put_32 (output_bfd, pic_plt_resolve[i], p);
+ p += 4;
+ }
+ p -= 4 * ARRAY_SIZE (pic_plt_resolve);
+
+ bcl = (htab->glink->size - GLINK_PLTRESOLVE + 3*4
+ + htab->glink->output_section->vma
+ + htab->glink->output_offset);
+
+ bfd_put_32 (output_bfd,
+ ADDIS_11_11 + PPC_HA (bcl - res0), p + 0*4);
+ bfd_put_32 (output_bfd,
+ ADDI_11_11 + PPC_LO (bcl - res0), p + 3*4);
+ bfd_put_32 (output_bfd,
+ ADDIS_12_12 + PPC_HA (got + 4 - bcl), p + 7*4);
+ if (PPC_HA (got + 4 - bcl) == PPC_HA (got + 8 - bcl))
+ {
+ bfd_put_32 (output_bfd,
+ LWZ_0_12 + PPC_LO (got + 4 - bcl), p + 8*4);
+ bfd_put_32 (output_bfd,
+ LWZ_12_12 + PPC_LO (got + 8 - bcl), p + 9*4);
+ }
+ else
+ {
+ bfd_put_32 (output_bfd,
+ LWZU_0_12 + PPC_LO (got + 4 - bcl), p + 8*4);
+ bfd_put_32 (output_bfd,
+ LWZ_12_12 + 4, p + 9*4);
+ }
+ }
+ else
+ {
+ for (i = 0; i < ARRAY_SIZE (plt_resolve); i++)
+ {
+ bfd_put_32 (output_bfd, plt_resolve[i], p);
+ p += 4;
+ }
+ p -= 4 * ARRAY_SIZE (plt_resolve);
+
+ bfd_put_32 (output_bfd,
+ LIS_12 + PPC_HA (got + 4), p + 0*4);
+ bfd_put_32 (output_bfd,
+ ADDIS_11_11 + PPC_HA (-res0), p + 1*4);
+ bfd_put_32 (output_bfd,
+ ADDI_11_11 + PPC_LO (-res0), p + 3*4);
+ if (PPC_HA (got + 4) == PPC_HA (got + 8))
+ {
+ bfd_put_32 (output_bfd,
+ LWZ_0_12 + PPC_LO (got + 4), p + 2*4);
+ bfd_put_32 (output_bfd,
+ LWZ_12_12 + PPC_LO (got + 8), p + 6*4);
+ }
+ else
+ {
+ bfd_put_32 (output_bfd,
+ LWZU_0_12 + PPC_LO (got + 4), p + 2*4);
+ bfd_put_32 (output_bfd,
+ LWZ_12_12 + 4, p + 6*4);
+ }
+ }
+ }
-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 }
-};
+ return TRUE;
+}
#define TARGET_LITTLE_SYM bfd_elf32_powerpcle_vec
#define TARGET_LITTLE_NAME "elf32-powerpcle"
@@ -6158,6 +7580,8 @@ static struct bfd_elf_special_section const ppc_elf_special_sections[]=
#else
#define ELF_MAXPAGESIZE 0x10000
#endif
+#define ELF_MINPAGESIZE 0x1000
+#define ELF_COMMONPAGESIZE 0x1000
#define elf_info_to_howto ppc_elf_info_to_howto
#ifdef EM_CYGNUS_POWERPC
@@ -6169,16 +7593,15 @@ static struct bfd_elf_special_section const ppc_elf_special_sections[]=
#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_reloc_name_lookup ppc_elf_reloc_name_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
@@ -6197,13 +7620,123 @@ static struct bfd_elf_special_section const ppc_elf_special_sections[]=
#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_write_core_note ppc_elf_write_core_note
#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
+#define elf_backend_get_sec_type_attr ppc_elf_get_sec_type_attr
+#define elf_backend_plt_sym_val ppc_elf_plt_sym_val
+#define elf_backend_action_discarded ppc_elf_action_discarded
+#define elf_backend_init_index_section _bfd_elf_init_1_index_section
+
+#include "elf32-target.h"
+
+/* VxWorks Target */
+
+#undef TARGET_LITTLE_SYM
+#undef TARGET_LITTLE_NAME
+
+#undef TARGET_BIG_SYM
+#define TARGET_BIG_SYM bfd_elf32_powerpc_vxworks_vec
+#undef TARGET_BIG_NAME
+#define TARGET_BIG_NAME "elf32-powerpc-vxworks"
+
+/* VxWorks uses the elf default section flags for .plt. */
+static const struct bfd_elf_special_section *
+ppc_elf_vxworks_get_sec_type_attr (bfd *abfd ATTRIBUTE_UNUSED, asection *sec)
+{
+ if (sec->name == NULL)
+ return NULL;
+
+ if (strcmp (sec->name, ".plt") == 0)
+ return _bfd_elf_get_sec_type_attr (abfd, sec);
+
+ return ppc_elf_get_sec_type_attr (abfd, sec);
+}
+
+/* Like ppc_elf_link_hash_table_create, but overrides
+ appropriately for VxWorks. */
+static struct bfd_link_hash_table *
+ppc_elf_vxworks_link_hash_table_create (bfd *abfd)
+{
+ struct bfd_link_hash_table *ret;
+
+ ret = ppc_elf_link_hash_table_create (abfd);
+ if (ret)
+ {
+ struct ppc_elf_link_hash_table *htab
+ = (struct ppc_elf_link_hash_table *)ret;
+ htab->is_vxworks = 1;
+ htab->plt_type = PLT_VXWORKS;
+ htab->plt_entry_size = VXWORKS_PLT_ENTRY_SIZE;
+ htab->plt_slot_size = VXWORKS_PLT_ENTRY_SIZE;
+ htab->plt_initial_entry_size = VXWORKS_PLT_INITIAL_ENTRY_SIZE;
+ }
+ return ret;
+}
+
+/* Tweak magic VxWorks symbols as they are loaded. */
+static bfd_boolean
+ppc_elf_vxworks_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 (!elf_vxworks_add_symbol_hook(abfd, info, sym,namep, flagsp, secp,
+ valp))
+ return FALSE;
+
+ return ppc_elf_add_symbol_hook(abfd, info, sym,namep, flagsp, secp, valp);
+}
+
+static void
+ppc_elf_vxworks_final_write_processing (bfd *abfd, bfd_boolean linker)
+{
+ ppc_elf_final_write_processing(abfd, linker);
+ elf_vxworks_final_write_processing(abfd, linker);
+}
+
+/* On VxWorks, we emit relocations against _PROCEDURE_LINKAGE_TABLE_, so
+ define it. */
+#undef elf_backend_want_plt_sym
+#define elf_backend_want_plt_sym 1
+#undef elf_backend_want_got_plt
+#define elf_backend_want_got_plt 1
+#undef elf_backend_got_symbol_offset
+#define elf_backend_got_symbol_offset 0
+#undef elf_backend_plt_not_loaded
+#define elf_backend_plt_not_loaded 0
+#undef elf_backend_plt_readonly
+#define elf_backend_plt_readonly 1
+#undef elf_backend_got_header_size
+#define elf_backend_got_header_size 12
+
+#undef bfd_elf32_bfd_link_hash_table_create
+#define bfd_elf32_bfd_link_hash_table_create \
+ ppc_elf_vxworks_link_hash_table_create
+#undef elf_backend_add_symbol_hook
+#define elf_backend_add_symbol_hook \
+ ppc_elf_vxworks_add_symbol_hook
+#undef elf_backend_link_output_symbol_hook
+#define elf_backend_link_output_symbol_hook \
+ elf_vxworks_link_output_symbol_hook
+#undef elf_backend_final_write_processing
+#define elf_backend_final_write_processing \
+ ppc_elf_vxworks_final_write_processing
+#undef elf_backend_get_sec_type_attr
+#define elf_backend_get_sec_type_attr \
+ ppc_elf_vxworks_get_sec_type_attr
+#undef elf_backend_emit_relocs
+#define elf_backend_emit_relocs \
+ elf_vxworks_emit_relocs
+
+#undef elf32_bed
+#define elf32_bed ppc_elf_vxworks_bed
#include "elf32-target.h"
diff --git a/contrib/binutils/bfd/elf32-ppc.h b/contrib/binutils/bfd/elf32-ppc.h
index fa2c585..f5383a7 100644
--- a/contrib/binutils/bfd/elf32-ppc.h
+++ b/contrib/binutils/bfd/elf32-ppc.h
@@ -1,5 +1,5 @@
/* PowerPC-specific support for 64-bit ELF.
- Copyright 2003 Free Software Foundation, Inc.
+ Copyright 2003, 2005, 2007 Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@@ -15,7 +15,17 @@ 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. */
+Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
+enum ppc_elf_plt_type {
+ PLT_UNSET,
+ PLT_OLD,
+ PLT_NEW,
+ PLT_VXWORKS
+};
+
+int ppc_elf_select_plt_layout (bfd *, struct bfd_link_info *,
+ enum ppc_elf_plt_type, int);
asection *ppc_elf_tls_setup (bfd *, struct bfd_link_info *);
bfd_boolean ppc_elf_tls_optimize (bfd *, struct bfd_link_info *);
+void ppc_elf_set_sdata_syms (bfd *, struct bfd_link_info *);
diff --git a/contrib/binutils/bfd/elf32-s390.c b/contrib/binutils/bfd/elf32-s390.c
index 074c108..9e36a5d 100644
--- a/contrib/binutils/bfd/elf32-s390.c
+++ b/contrib/binutils/bfd/elf32-s390.c
@@ -1,5 +1,6 @@
/* IBM S/390-specific support for 32-bit ELF
- Copyright 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
+ Copyright 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
+ Free Software Foundation, Inc.
Contributed by Carl B. Pedersen and Martin Schwidefsky.
This file is part of BFD, the Binary File Descriptor library.
@@ -16,11 +17,11 @@
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. */
+ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
+ 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "bfdlink.h"
#include "libbfd.h"
#include "elf-bfd.h"
@@ -40,17 +41,11 @@ static bfd_boolean create_got_section
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 *,
+ PARAMS ((struct bfd_link_info *, 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 *));
@@ -72,8 +67,6 @@ 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
@@ -341,6 +334,25 @@ elf_s390_reloc_type_lookup (abfd, code)
return 0;
}
+static reloc_howto_type *
+elf_s390_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED,
+ const char *r_name)
+{
+ unsigned int i;
+
+ for (i = 0; i < sizeof (elf_howto_table) / sizeof (elf_howto_table[0]); i++)
+ if (elf_howto_table[i].name != NULL
+ && strcasecmp (elf_howto_table[i].name, r_name) == 0)
+ return &elf_howto_table[i];
+
+ if (strcasecmp (elf32_s390_vtinherit_howto.name, r_name) == 0)
+ return &elf32_s390_vtinherit_howto;
+ if (strcasecmp (elf32_s390_vtentry_howto.name, r_name) == 0)
+ return &elf32_s390_vtentry_howto;
+
+ return NULL;
+}
+
/* We need to use ELF32_R_TYPE so we have our own copy of this function,
and elf32-s390.c has its own copy. */
@@ -350,7 +362,8 @@ elf_s390_info_to_howto (abfd, cache_ptr, dst)
arelent *cache_ptr;
Elf_Internal_Rela *dst;
{
- switch (ELF32_R_TYPE(dst->r_info))
+ unsigned int r_type = ELF32_R_TYPE(dst->r_info);
+ switch (r_type)
{
case R_390_GNU_VTINHERIT:
cache_ptr->howto = &elf32_s390_vtinherit_howto;
@@ -361,8 +374,13 @@ elf_s390_info_to_howto (abfd, cache_ptr, dst)
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)];
+ if (r_type >= sizeof (elf_howto_table) / sizeof (elf_howto_table[0]))
+ {
+ (*_bfd_error_handler) (_("%B: invalid relocation type %d"),
+ abfd, (int) r_type);
+ r_type = R_390_NONE;
+ }
+ cache_ptr->howto = &elf_howto_table[r_type];
}
}
@@ -411,7 +429,7 @@ s390_elf_ldisp_reloc (abfd, reloc_entry, symbol, data, input_section,
if (output_bfd != NULL)
return bfd_reloc_continue;
- if (reloc_entry->address > input_section->_cooked_size)
+ if (reloc_entry->address > bfd_get_section_limit (abfd, input_section))
return bfd_reloc_outofrange;
relocation = (symbol->value
@@ -671,14 +689,16 @@ struct elf_s390_obj_tdata
(elf_s390_tdata (abfd)->local_got_tls_type)
static bfd_boolean
-elf_s390_mkobject (abfd)
- bfd *abfd;
+elf_s390_mkobject (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;
+ {
+ 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 bfd_elf_mkobject (abfd);
}
static bfd_boolean
@@ -764,7 +784,8 @@ elf_s390_link_hash_table_create (abfd)
if (ret == NULL)
return NULL;
- if (! _bfd_elf_link_hash_table_init (&ret->elf, abfd, link_hash_newfunc))
+ if (!_bfd_elf_link_hash_table_init (&ret->elf, abfd, link_hash_newfunc,
+ sizeof (struct elf_s390_link_hash_entry)))
{
free (ret);
return NULL;
@@ -802,12 +823,13 @@ create_got_section (dynobj, info)
if (!htab->sgot || !htab->sgotplt)
abort ();
- htab->srelgot = bfd_make_section (dynobj, ".rela.got");
+ htab->srelgot = bfd_make_section_with_flags (dynobj, ".rela.got",
+ (SEC_ALLOC | SEC_LOAD
+ | SEC_HAS_CONTENTS
+ | SEC_IN_MEMORY
+ | SEC_LINKER_CREATED
+ | SEC_READONLY));
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;
@@ -847,8 +869,8 @@ elf_s390_create_dynamic_sections (dynobj, info)
/* 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;
+elf_s390_copy_indirect_symbol (info, dir, ind)
+ struct bfd_link_info *info;
struct elf_link_hash_entry *dir, *ind;
{
struct elf_s390_link_hash_entry *edir, *eind;
@@ -863,10 +885,7 @@ elf_s390_copy_indirect_symbol (bed, dir, ind)
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
+ /* Add reloc counts against the indirect sym to the direct sym
list. Merge any entries against the same section. */
for (pp = &eind->dyn_relocs; (p = *pp) != NULL; )
{
@@ -899,17 +918,18 @@ elf_s390_copy_indirect_symbol (bed, dir, ind)
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));
+ && dir->dynamic_adjusted)
+ {
+ /* If called to transfer flags for a weakdef during processing
+ of elf_adjust_dynamic_symbol, don't copy non_got_ref.
+ We clear it ourselves for ELIMINATE_COPY_RELOCS. */
+ dir->ref_dynamic |= ind->ref_dynamic;
+ dir->ref_regular |= ind->ref_regular;
+ dir->ref_regular_nonweak |= ind->ref_regular_nonweak;
+ dir->needs_plt |= ind->needs_plt;
+ }
else
- _bfd_elf_link_hash_copy_indirect (bed, dir, ind);
+ _bfd_elf_link_hash_copy_indirect (info, dir, ind);
}
static int
@@ -980,16 +1000,20 @@ elf_s390_check_relocs (abfd, info, sec, relocs)
if (r_symndx >= NUM_SHDR_ENTRIES (symtab_hdr))
{
- (*_bfd_error_handler) (_("%s: bad symbol index: %d"),
- bfd_archive_filename (abfd),
- r_symndx);
+ (*_bfd_error_handler) (_("%B: bad symbol index: %d"),
+ abfd, r_symndx);
return FALSE;
}
if (r_symndx < symtab_hdr->sh_info)
h = NULL;
else
- h = sym_hashes[r_symndx - symtab_hdr->sh_info];
+ {
+ h = sym_hashes[r_symndx - symtab_hdr->sh_info];
+ 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;
+ }
/* Create got section and local_got_refcounts array if they
are needed. */
@@ -1069,7 +1093,7 @@ elf_s390_check_relocs (abfd, info, sec, relocs)
creating a procedure linkage table entry. */
if (h != NULL)
{
- h->elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_PLT;
+ h->needs_plt = 1;
h->plt.refcount += 1;
}
break;
@@ -1090,7 +1114,7 @@ elf_s390_check_relocs (abfd, info, sec, relocs)
if (h != NULL)
{
((struct elf_s390_link_hash_entry *) h)->gotplt_refcount++;
- h->elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_PLT;
+ h->needs_plt = 1;
h->plt.refcount += 1;
}
else
@@ -1158,8 +1182,8 @@ elf_s390_check_relocs (abfd, info, sec, relocs)
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);
+ (_("%B: `%s' accessed both as normal and thread local symbol"),
+ abfd, h->root.root.string);
return FALSE;
}
if (old_tls_type > tls_type)
@@ -1199,7 +1223,7 @@ elf_s390_check_relocs (abfd, info, sec, relocs)
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;
+ h->non_got_ref = 1;
/* We may need a .plt entry if the function this reloc
refers to is in a shared lib. */
@@ -1236,15 +1260,13 @@ elf_s390_check_relocs (abfd, info, sec, relocs)
|| (h != NULL
&& (! info->symbolic
|| h->root.type == bfd_link_hash_defweak
- || (h->elf_link_hash_flags
- & ELF_LINK_HASH_DEF_REGULAR) == 0))))
+ || !h->def_regular))))
|| (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)))
+ || !h->def_regular)))
{
struct elf_s390_dyn_relocs *p;
struct elf_s390_dyn_relocs **head;
@@ -1264,13 +1286,13 @@ elf_s390_check_relocs (abfd, info, sec, relocs)
if (name == NULL)
return FALSE;
- if (strncmp (name, ".rela", 5) != 0
+ if (! CONST_STRNEQ (name, ".rela")
|| strcmp (bfd_get_section_name (abfd, sec),
name + 5) != 0)
{
(*_bfd_error_handler)
- (_("%s: bad relocation section name `%s\'"),
- bfd_archive_filename (abfd), name);
+ (_("%B: bad relocation section name `%s\'"),
+ abfd, name);
}
if (htab->elf.dynobj == NULL)
@@ -1282,13 +1304,14 @@ elf_s390_check_relocs (abfd, info, sec, relocs)
{
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;
+ sreloc = bfd_make_section_with_flags (dynobj,
+ name,
+ flags);
if (sreloc == NULL
- || ! bfd_set_section_flags (dynobj, sreloc, flags)
|| ! bfd_set_section_alignment (dynobj, sreloc, 2))
return FALSE;
}
@@ -1307,14 +1330,15 @@ elf_s390_check_relocs (abfd, info, sec, relocs)
We really need local syms available to do this
easily. Oh well. */
asection *s;
+ void *vpp;
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);
+ vpp = &elf_section_data (s)->local_dynrel;
+ head = (struct elf_s390_dyn_relocs **) vpp;
}
p = *head;
@@ -1368,50 +1392,30 @@ elf_s390_check_relocs (abfd, info, sec, relocs)
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;
+elf_s390_gc_mark_hook (asection *sec,
+ struct bfd_link_info *info,
+ 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;
+ switch (ELF32_R_TYPE (rel->r_info))
+ {
+ case R_390_GNU_VTINHERIT:
+ case R_390_GNU_VTENTRY:
+ return NULL;
+ }
+ return _bfd_elf_gc_mark_hook (sec, info, rel, h, sym);
- 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_s390_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;
@@ -1439,6 +1443,9 @@ elf_s390_gc_sweep_hook (abfd, info, sec, relocs)
struct elf_s390_dyn_relocs *p;
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;
eh = (struct elf_s390_link_hash_entry *) h;
for (pp = &eh->dyn_relocs; (p = *pp) != NULL; pp = &p->next)
@@ -1575,18 +1582,17 @@ elf_s390_adjust_dynamic_symbol (info, 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)
+ || h->needs_plt)
{
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->def_dynamic
+ && !h->ref_dynamic
&& h->root.type != bfd_link_hash_undefweak
&& h->root.type != bfd_link_hash_undefined))
{
@@ -1596,7 +1602,7 @@ elf_s390_adjust_dynamic_symbol (info, h)
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;
+ h->needs_plt = 0;
elf_s390_adjust_gotplt((struct elf_s390_link_hash_entry *) h);
}
@@ -1613,16 +1619,14 @@ elf_s390_adjust_dynamic_symbol (info, h)
/* 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)
+ if (h->u.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;
+ BFD_ASSERT (h->u.weakdef->root.type == bfd_link_hash_defined
+ || h->u.weakdef->root.type == bfd_link_hash_defweak);
+ h->root.u.def.section = h->u.weakdef->root.u.def.section;
+ h->root.u.def.value = h->u.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));
+ h->non_got_ref = h->u.weakdef->non_got_ref;
return TRUE;
}
@@ -1638,13 +1642,13 @@ elf_s390_adjust_dynamic_symbol (info, h)
/* 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)
+ if (!h->non_got_ref)
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;
+ h->non_got_ref = 0;
return TRUE;
}
@@ -1665,11 +1669,18 @@ elf_s390_adjust_dynamic_symbol (info, h)
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;
+ h->non_got_ref = 0;
return TRUE;
}
}
+ if (h->size == 0)
+ {
+ (*_bfd_error_handler) (_("dynamic variable `%s' is zero size"),
+ h->root.root.string);
+ 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
@@ -1687,33 +1698,13 @@ elf_s390_adjust_dynamic_symbol (info, h)
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;
+ htab->srelbss->size += sizeof (Elf32_External_Rela);
+ h->needs_copy = 1;
}
- /* 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;
+ return _bfd_elf_adjust_dynamic_copy (h, s);
}
/* Allocate space in .plt, .got and associated reloc sections for
@@ -1749,7 +1740,7 @@ allocate_dynrelocs (h, inf)
/* Make sure this symbol is output as a dynamic symbol.
Undefined weak syms won't yet be marked as dynamic. */
if (h->dynindx == -1
- && (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0)
+ && !h->forced_local)
{
if (! bfd_elf_link_record_dynamic_symbol (info, h))
return FALSE;
@@ -1762,10 +1753,10 @@ allocate_dynrelocs (h, inf)
/* 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;
+ if (s->size == 0)
+ s->size += PLT_FIRST_ENTRY_SIZE;
- h->plt.offset = s->_raw_size;
+ h->plt.offset = s->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
@@ -1773,33 +1764,33 @@ allocate_dynrelocs (h, inf)
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->def_regular)
{
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;
+ s->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;
+ htab->sgotplt->size += GOT_ENTRY_SIZE;
/* We also need to make an entry in the .rela.plt section. */
- htab->srelplt->_raw_size += sizeof (Elf32_External_Rela);
+ htab->srelplt->size += sizeof (Elf32_External_Rela);
}
else
{
h->plt.offset = (bfd_vma) -1;
- h->elf_link_hash_flags &= ~ELF_LINK_HASH_NEEDS_PLT;
+ h->needs_plt = 0;
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;
+ h->needs_plt = 0;
elf_s390_adjust_gotplt((struct elf_s390_link_hash_entry *) h);
}
@@ -1817,8 +1808,8 @@ allocate_dynrelocs (h, inf)
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;
+ h->got.offset = htab->sgot->size;
+ htab->sgot->size += GOT_ENTRY_SIZE;
}
else
h->got.offset = (bfd_vma) -1;
@@ -1832,31 +1823,31 @@ allocate_dynrelocs (h, inf)
/* Make sure this symbol is output as a dynamic symbol.
Undefined weak syms won't yet be marked as dynamic. */
if (h->dynindx == -1
- && (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0)
+ && !h->forced_local)
{
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;
+ h->got.offset = s->size;
+ s->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;
+ s->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);
+ htab->srelgot->size += sizeof (Elf32_External_Rela);
else if (tls_type == GOT_TLS_GD)
- htab->srelgot->_raw_size += 2 * sizeof (Elf32_External_Rela);
+ htab->srelgot->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);
+ htab->srelgot->size += sizeof (Elf32_External_Rela);
}
else
h->got.offset = (bfd_vma) -1;
@@ -1890,9 +1881,21 @@ allocate_dynrelocs (h, inf)
/* Also discard relocs on undefined weak syms with non-default
visibility. */
- if (ELF_ST_VISIBILITY (h->other) != STV_DEFAULT
+ if (eh->dyn_relocs != NULL
&& h->root.type == bfd_link_hash_undefweak)
- eh->dyn_relocs = NULL;
+ {
+ if (ELF_ST_VISIBILITY (h->other) != STV_DEFAULT)
+ eh->dyn_relocs = NULL;
+
+ /* Make sure undefined weak symbols are output as a dynamic
+ symbol in PIEs. */
+ else if (h->dynindx == -1
+ && !h->forced_local)
+ {
+ if (! bfd_elf_link_record_dynamic_symbol (info, h))
+ return FALSE;
+ }
+ }
}
else if (ELIMINATE_COPY_RELOCS)
{
@@ -1900,9 +1903,9 @@ allocate_dynrelocs (h, inf)
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)
+ if (!h->non_got_ref
+ && ((h->def_dynamic
+ && !h->def_regular)
|| (htab->elf.dynamic_sections_created
&& (h->root.type == bfd_link_hash_undefweak
|| h->root.type == bfd_link_hash_undefined))))
@@ -1910,7 +1913,7 @@ allocate_dynrelocs (h, inf)
/* Make sure this symbol is output as a dynamic symbol.
Undefined weak syms won't yet be marked as dynamic. */
if (h->dynindx == -1
- && (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0)
+ && !h->forced_local)
{
if (! bfd_elf_link_record_dynamic_symbol (info, h))
return FALSE;
@@ -1932,7 +1935,7 @@ allocate_dynrelocs (h, inf)
{
asection *sreloc = elf_section_data (p->sec)->sreloc;
- sreloc->_raw_size += p->count * sizeof (Elf32_External_Rela);
+ sreloc->size += p->count * sizeof (Elf32_External_Rela);
}
return TRUE;
@@ -1995,7 +1998,7 @@ elf_s390_size_dynamic_sections (output_bfd, info)
s = bfd_get_section_by_name (dynobj, ".interp");
if (s == NULL)
abort ();
- s->_raw_size = sizeof ELF_DYNAMIC_INTERPRETER;
+ s->size = sizeof ELF_DYNAMIC_INTERPRETER;
s->contents = (unsigned char *) ELF_DYNAMIC_INTERPRETER;
}
}
@@ -2018,10 +2021,7 @@ elf_s390_size_dynamic_sections (output_bfd, info)
{
struct elf_s390_dyn_relocs *p;
- for (p = *((struct elf_s390_dyn_relocs **)
- &elf_section_data (s)->local_dynrel);
- p != NULL;
- p = p->next)
+ for (p = 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))
@@ -2034,7 +2034,7 @@ elf_s390_size_dynamic_sections (output_bfd, info)
else if (p->count != 0)
{
srela = elf_section_data (p->sec)->sreloc;
- srela->_raw_size += p->count * sizeof (Elf32_External_Rela);
+ srela->size += p->count * sizeof (Elf32_External_Rela);
if ((p->sec->output_section->flags & SEC_READONLY) != 0)
info->flags |= DF_TEXTREL;
}
@@ -2055,12 +2055,12 @@ elf_s390_size_dynamic_sections (output_bfd, info)
{
if (*local_got > 0)
{
- *local_got = s->_raw_size;
- s->_raw_size += GOT_ENTRY_SIZE;
+ *local_got = s->size;
+ s->size += GOT_ENTRY_SIZE;
if (*local_tls_type == GOT_TLS_GD)
- s->_raw_size += GOT_ENTRY_SIZE;
+ s->size += GOT_ENTRY_SIZE;
if (info->shared)
- srela->_raw_size += sizeof (Elf32_External_Rela);
+ srela->size += sizeof (Elf32_External_Rela);
}
else
*local_got = (bfd_vma) -1;
@@ -2071,9 +2071,9 @@ elf_s390_size_dynamic_sections (output_bfd, info)
{
/* 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);
+ htab->tls_ldm_got.offset = htab->sgot->size;
+ htab->sgot->size += 2 * GOT_ENTRY_SIZE;
+ htab->srelgot->size += sizeof (Elf32_External_Rela);
}
else
htab->tls_ldm_got.offset = -1;
@@ -2092,14 +2092,15 @@ elf_s390_size_dynamic_sections (output_bfd, info)
if (s == htab->splt
|| s == htab->sgot
- || s == htab->sgotplt)
+ || s == htab->sgotplt
+ || s == htab->sdynbss)
{
/* 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)
+ else if (CONST_STRNEQ (bfd_get_section_name (dynobj, s), ".rela"))
{
- if (s->_raw_size != 0)
+ if (s->size != 0)
relocs = TRUE;
/* We use the reloc_count field as a counter if we need
@@ -2112,7 +2113,7 @@ elf_s390_size_dynamic_sections (output_bfd, info)
continue;
}
- if (s->_raw_size == 0)
+ if (s->size == 0)
{
/* If we don't need this section, strip it from the
output file. This is to handle .rela.bss and
@@ -2124,16 +2125,19 @@ elf_s390_size_dynamic_sections (output_bfd, info)
function which decides whether anything needs to go
into these sections. */
- _bfd_strip_section_from_output (info, s);
+ s->flags |= SEC_EXCLUDE;
continue;
}
+ if ((s->flags & SEC_HAS_CONTENTS) == 0)
+ 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);
+ s->contents = (bfd_byte *) bfd_zalloc (dynobj, s->size);
if (s->contents == NULL)
return FALSE;
}
@@ -2154,7 +2158,7 @@ elf_s390_size_dynamic_sections (output_bfd, info)
return FALSE;
}
- if (htab->splt->_raw_size != 0)
+ if (htab->splt->size != 0)
{
if (!add_dynamic_entry (DT_PLTGOT, 0)
|| !add_dynamic_entry (DT_PLTRELSZ, 0)
@@ -2231,11 +2235,12 @@ invalid_tls_insn (input_bfd, input_section, rel)
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),
+ (_("%B(%A+0x%lx): invalid instruction for TLS relocation %s"),
+ input_bfd,
+ input_section,
(long) rel->r_offset,
howto->name);
+ bfd_set_error (bfd_error_bad_value);
}
/* Relocate a 390 ELF section. */
@@ -2259,9 +2264,6 @@ elf_s390_relocate_section (output_bfd, info, input_bfd, input_section,
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);
@@ -2296,7 +2298,6 @@ elf_s390_relocate_section (output_bfd, info, input_bfd, input_section,
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;
@@ -2317,6 +2318,20 @@ elf_s390_relocate_section (output_bfd, info, input_bfd, input_section,
unresolved_reloc, warned);
}
+ if (sec != NULL && elf_discarded_section (sec))
+ {
+ /* For relocs against symbols from removed linkonce sections,
+ or sections discarded by a linker script, we just want the
+ section contents zeroed. Avoid any special processing. */
+ _bfd_clear_contents (howto, input_bfd, contents + rel->r_offset);
+ rel->r_info = 0;
+ rel->r_addend = 0;
+ continue;
+ }
+
+ if (info->relocatable)
+ continue;
+
switch (r_type)
{
case R_390_GOTPLT12:
@@ -2373,8 +2388,8 @@ elf_s390_relocate_section (output_bfd, info, input_bfd, input_section,
|| (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))
+ || h->forced_local)
+ && h->def_regular)
|| (ELF_ST_VISIBILITY (h->other)
&& h->root.type == bfd_link_hash_undefweak))
{
@@ -2533,11 +2548,7 @@ elf_s390_relocate_section (output_bfd, info, input_bfd, input_section,
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)
+ if ((input_section->flags & SEC_ALLOC) == 0)
break;
if ((info->shared
@@ -2554,11 +2565,9 @@ elf_s390_relocate_section (output_bfd, info, input_bfd, input_section,
&& !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->non_got_ref
+ && ((h->def_dynamic
+ && !h->def_regular)
|| h->root.type == bfd_link_hash_undefweak
|| h->root.type == bfd_link_hash_undefined)))
{
@@ -2594,8 +2603,7 @@ elf_s390_relocate_section (output_bfd, info, input_bfd, input_section,
|| r_type == R_390_PC32
|| !info->shared
|| !info->symbolic
- || (h->elf_link_hash_flags
- & ELF_LINK_HASH_DEF_REGULAR) == 0))
+ || !h->def_regular))
{
outrel.r_info = ELF32_R_INFO (h->dynindx, r_type);
outrel.r_addend = rel->r_addend;
@@ -2626,14 +2634,18 @@ elf_s390_relocate_section (output_bfd, info, input_bfd, input_section,
osec = sec->output_section;
sindx = elf_section_data (osec)->dynindx;
- BFD_ASSERT (sindx > 0);
+ if (sindx == 0)
+ {
+ osec = htab->elf.text_index_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);
@@ -2897,7 +2909,7 @@ elf_s390_relocate_section (output_bfd, info, input_bfd, input_section,
continue;
case R_390_TLS_LDO32:
- if (info->shared || (input_section->flags & SEC_CODE) == 0)
+ if (info->shared)
relocation -= dtpoff_base (info);
else
/* When converting LDO to LE, we must negate. */
@@ -2953,16 +2965,44 @@ elf_s390_relocate_section (output_bfd, info, input_bfd, input_section,
unsigned int insn;
insn = bfd_get_32 (input_bfd, contents + rel->r_offset);
- if ((insn & 0xff000fff) != 0x4d000000)
+ if ((insn & 0xff000fff) != 0x4d000000 &&
+ (insn & 0xffff0000) != 0xc0e50000)
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;
+ {
+ if ((insn & 0xff000000) == 0x4d000000)
+ {
+ /* GD->LE transition.
+ bas %r14,0(%rx,%r13) -> bc 0,0 */
+ insn = 0x47000000;
+ }
+ else
+ {
+ /* GD->LE transition.
+ brasl %r14,_tls_get_addr@plt -> brcl 0,. */
+ insn = 0xc0040000;
+ bfd_put_16 (output_bfd, 0x0000,
+ contents + rel->r_offset + 4);
+ }
+ }
else
- /* GD->IE transition.
- bas %r14,0(%rx,%r13) -> l %r2,0(%r2,%r12) */
- insn = 0x5822c000;
+ {
+ if ((insn & 0xff000000) == 0x4d000000)
+ {
+ /* GD->IE transition.
+ bas %r14,0(%rx,%r13) -> l %r2,0(%r2,%r12) */
+ insn = 0x5822c000;
+ }
+ else
+ {
+ /* GD->IE transition.
+ brasl %r14,__tls_get_addr@plt ->
+ l %r2,0(%r2,%r12) ; bcr 0,0 */
+ insn = 0x5822c000;
+ bfd_put_16 (output_bfd, 0x0700,
+ contents + rel->r_offset + 4);
+ }
+ }
bfd_put_32 (output_bfd, insn, contents + rel->r_offset);
}
else if (r_type == R_390_TLS_LDCALL)
@@ -2972,11 +3012,23 @@ elf_s390_relocate_section (output_bfd, info, input_bfd, input_section,
unsigned int insn;
insn = bfd_get_32 (input_bfd, contents + rel->r_offset);
- if ((insn & 0xff000fff) != 0x4d000000)
+ if ((insn & 0xff000fff) != 0x4d000000 &&
+ (insn & 0xffff0000) != 0xc0e50000)
invalid_tls_insn (input_bfd, input_section, rel);
- /* LD->LE transition.
- bas %r14,0(%rx,%r13) -> bc 0,0 */
- insn = 0x47000000;
+ if ((insn & 0xff000000) == 0x4d000000)
+ {
+ /* LD->LE transition.
+ bas %r14,0(%rx,%r13) -> bc 0,0 */
+ insn = 0x47000000;
+ }
+ else
+ {
+ /* LD->LE transition.
+ brasl %r14,__tls_get_addr@plt -> brcl 0,. */
+ insn = 0xc0040000;
+ bfd_put_16 (output_bfd, 0x0000,
+ contents + rel->r_offset + 4);
+ }
bfd_put_32 (output_bfd, insn, contents + rel->r_offset);
}
}
@@ -2991,12 +3043,13 @@ elf_s390_relocate_section (output_bfd, info, input_bfd, input_section,
not process them. */
if (unresolved_reloc
&& !((input_section->flags & SEC_DEBUGGING) != 0
- && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) != 0))
+ && h->def_dynamic))
(*_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),
+ (_("%B(%A+0x%lx): unresolvable %s relocation against symbol `%s'"),
+ input_bfd,
+ input_section,
(long) rel->r_offset,
+ howto->name,
h->root.root.string);
if (r_type == R_390_20
@@ -3036,16 +3089,16 @@ elf_s390_relocate_section (output_bfd, info, input_bfd, input_section,
{
if (! ((*info->callbacks->reloc_overflow)
- (info, name, howto->name, (bfd_vma) 0,
- input_bfd, input_section, rel->r_offset)))
+ (info, (h ? &h->root : NULL), 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),
+ (_("%B(%A+0x%lx): reloc against `%s': error %d"),
+ input_bfd, input_section,
(long) rel->r_offset, name, (int) r);
return FALSE;
}
@@ -3196,7 +3249,7 @@ elf_s390_finish_dynamic_symbol (output_bfd, info, h, sym)
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)
+ if (!h->def_regular)
{
/* Mark the symbol as undefined, rather than as defined in
the .plt section. Leave the value alone. This is a clue
@@ -3233,8 +3286,8 @@ elf_s390_finish_dynamic_symbol (output_bfd, info, h, sym)
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))
+ || h->forced_local)
+ && h->def_regular)
{
BFD_ASSERT((h->got.offset & 1) != 0);
rela.r_info = ELF32_R_INFO (0, R_390_RELATIVE);
@@ -3255,7 +3308,7 @@ elf_s390_finish_dynamic_symbol (output_bfd, info, h, sym)
bfd_elf32_swap_reloca_out (output_bfd, &rela, loc);
}
- if ((h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_COPY) != 0)
+ if (h->needs_copy)
{
Elf_Internal_Rela rela;
bfd_byte *loc;
@@ -3280,8 +3333,8 @@ elf_s390_finish_dynamic_symbol (output_bfd, info, h, sym)
/* 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)
+ || h == htab->elf.hgot
+ || h == htab->elf.hplt)
sym->st_shndx = SHN_ABS;
return TRUE;
@@ -3330,7 +3383,7 @@ elf_s390_finish_dynamic_sections (output_bfd, info)
abort ();
dyncon = (Elf32_External_Dyn *) sdyn->contents;
- dynconend = (Elf32_External_Dyn *) (sdyn->contents + sdyn->_raw_size);
+ dynconend = (Elf32_External_Dyn *) (sdyn->contents + sdyn->size);
for (; dyncon < dynconend; dyncon++)
{
Elf_Internal_Dyn dyn;
@@ -3353,10 +3406,7 @@ elf_s390_finish_dynamic_sections (output_bfd, info)
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;
+ dyn.d_un.d_val = s->size;
break;
}
@@ -3364,7 +3414,7 @@ elf_s390_finish_dynamic_sections (output_bfd, info)
}
/* Fill in the special first entry in the procedure linkage table. */
- if (htab->splt && htab->splt->_raw_size > 0)
+ if (htab->splt && htab->splt->size > 0)
{
memset (htab->splt->contents, 0, PLT_FIRST_ENTRY_SIZE);
if (info->shared)
@@ -3408,7 +3458,7 @@ elf_s390_finish_dynamic_sections (output_bfd, info)
if (htab->sgotplt)
{
/* Fill in the first three entries in the global offset table. */
- if (htab->sgotplt->_raw_size > 0)
+ if (htab->sgotplt->size > 0)
{
bfd_put_32 (output_bfd,
(sdyn == NULL ? (bfd_vma) 0
@@ -3432,7 +3482,7 @@ elf_s390_grok_prstatus (abfd, note)
Elf_Internal_Note * note;
{
int offset;
- unsigned int raw_size;
+ unsigned int size;
switch (note->descsz)
{
@@ -3448,15 +3498,26 @@ elf_s390_grok_prstatus (abfd, note)
/* pr_reg */
offset = 72;
- raw_size = 144;
+ size = 144;
break;
}
/* Make a ".reg/999" section. */
return _bfd_elfcore_make_pseudosection (abfd, ".reg",
- raw_size, note->descpos + offset);
+ size, note->descpos + offset);
}
+/* Return address for Ith PLT stub in section PLT, for relocation REL
+ or (bfd_vma) -1 if it should not be included. */
+
+static bfd_vma
+elf_s390_plt_sym_val (bfd_vma i, const asection *plt,
+ const arelent *rel ATTRIBUTE_UNUSED)
+{
+ return plt->vma + PLT_FIRST_ENTRY_SIZE + i * PLT_ENTRY_SIZE;
+}
+
+
#define TARGET_BIG_SYM bfd_elf32_s390_vec
#define TARGET_BIG_NAME "elf32-s390"
#define ELF_ARCH bfd_arch_s390
@@ -3477,6 +3538,7 @@ elf_s390_grok_prstatus (abfd, note)
#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 bfd_elf32_bfd_reloc_name_lookup elf_s390_reloc_name_lookup
#define elf_backend_adjust_dynamic_symbol elf_s390_adjust_dynamic_symbol
#define elf_backend_check_relocs elf_s390_check_relocs
@@ -3489,8 +3551,10 @@ elf_s390_grok_prstatus (abfd, note)
#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_init_index_section _bfd_elf_init_1_index_section
#define elf_backend_reloc_type_class elf_s390_reloc_type_class
#define elf_backend_grok_prstatus elf_s390_grok_prstatus
+#define elf_backend_plt_sym_val elf_s390_plt_sym_val
#define bfd_elf32_mkobject elf_s390_mkobject
#define elf_backend_object_p elf_s390_object_p
diff --git a/contrib/binutils/bfd/elf32-score.c b/contrib/binutils/bfd/elf32-score.c
new file mode 100644
index 0000000..070177b
--- /dev/null
+++ b/contrib/binutils/bfd/elf32-score.c
@@ -0,0 +1,3883 @@
+/* 32-bit ELF support for S+core.
+ Copyright 2006, 2007 Free Software Foundation, Inc.
+ Contributed by
+ Mei Ligang (ligang@sunnorth.com.cn)
+ Pei-Lin Tsai (pltsai@sunplus.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., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include "sysdep.h"
+#include "bfd.h"
+#include "libbfd.h"
+#include "libiberty.h"
+#include "elf-bfd.h"
+#include "elf/score.h"
+#include "elf/common.h"
+#include "elf/internal.h"
+#include "hashtab.h"
+
+
+/* Score ELF linker hash table. */
+
+struct score_elf_link_hash_table
+{
+ /* The main hash table. */
+ struct elf_link_hash_table root;
+};
+
+/* The SCORE ELF linker needs additional information for each symbol in
+ the global hash table. */
+
+struct score_elf_link_hash_entry
+{
+ struct elf_link_hash_entry root;
+
+ /* Number of R_SCORE_ABS32, R_SCORE_REL32 relocs against this symbol. */
+ unsigned int possibly_dynamic_relocs;
+
+ /* If the R_SCORE_ABS32, R_SCORE_REL32 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_SCORE_CALL15 ones. */
+ bfd_boolean no_fn_stub;
+
+ /* Are we forced local? This will only be set if we have converted
+ the initial global GOT entry to a local GOT entry. */
+ bfd_boolean forced_local;
+};
+
+/* Traverse a score ELF linker hash table. */
+#define score_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 SCORE elf linker hash table from a link_info structure. */
+#define score_elf_hash_table(info) \
+ ((struct score_elf_link_hash_table *) ((info)->hash))
+
+/* This structure is used to hold .got entries while estimating got sizes. */
+struct score_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 score_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 passed to score_elf_sort_hash_table_f when sorting
+ the dynamic symbols. */
+
+struct score_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;
+};
+
+struct score_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;
+ /* In multi-got links, a pointer to the next got (err, rather, most
+ of the time, it points to the previous got). */
+ struct score_got_info *next;
+};
+
+/* A structure used to count GOT entries, for GOT entry or ELF symbol table traversal. */
+struct _score_elf_section_data
+{
+ struct bfd_elf_section_data elf;
+ union
+ {
+ struct score_got_info *got_info;
+ bfd_byte *tdata;
+ }
+ u;
+};
+
+#define score_elf_section_data(sec) \
+ ((struct _score_elf_section_data *) elf_section_data (sec))
+
+/* The size of a symbol-table entry. */
+#define SCORE_ELF_SYM_SIZE(abfd) \
+ (get_elf_backend_data (abfd)->s->sizeof_sym)
+
+/* In case we're on a 32-bit machine, construct a 64-bit "-1" value
+ from smaller values. Start with zero, widen, *then* decrement. */
+#define MINUS_ONE (((bfd_vma)0) - 1)
+#define MINUS_TWO (((bfd_vma)0) - 2)
+
+#define PDR_SIZE 32
+
+
+/* The number of local .got entries we reserve. */
+#define SCORE_RESERVED_GOTNO (2)
+#define ELF_DYNAMIC_INTERPRETER "/usr/lib/ld.so.1"
+
+/* The offset of $gp from the beginning of the .got section. */
+#define ELF_SCORE_GP_OFFSET(abfd) (0x3ff0)
+/* The maximum size of the GOT for it to be addressable using 15-bit offsets from $gp. */
+#define SCORE_ELF_GOT_MAX_SIZE(abfd) (ELF_SCORE_GP_OFFSET(abfd) + 0x3fff)
+
+#define SCORE_ELF_STUB_SECTION_NAME (".SCORE.stub")
+#define SCORE_FUNCTION_STUB_SIZE (16)
+
+#define STUB_LW 0xc3bcc010 /* lw r29, [r28, -0x3ff0] */
+#define STUB_MOVE 0x8363bc56 /* mv r27, r3 */
+#define STUB_LI16 0x87548000 /* ori r26, .dynsym_index */
+#define STUB_BRL 0x801dbc09 /* brl r29 */
+
+#define SCORE_ELF_GOT_SIZE(abfd) \
+ (get_elf_backend_data (abfd)->s->arch_size / 8)
+
+#define SCORE_ELF_ADD_DYNAMIC_ENTRY(info, tag, val) \
+ (_bfd_elf_add_dynamic_entry (info, (bfd_vma) tag, (bfd_vma) val))
+
+/* The size of an external dynamic table entry. */
+#define SCORE_ELF_DYN_SIZE(abfd) \
+ (get_elf_backend_data (abfd)->s->sizeof_dyn)
+
+/* The size of an external REL relocation. */
+#define SCORE_ELF_REL_SIZE(abfd) \
+ (get_elf_backend_data (abfd)->s->sizeof_rel)
+
+/* The default alignment for sections, as a power of two. */
+#define SCORE_ELF_LOG_FILE_ALIGN(abfd)\
+ (get_elf_backend_data (abfd)->s->log_file_align)
+
+#ifndef NUM_ELEM
+#define NUM_ELEM(a) (sizeof (a) / (sizeof (a)[0]))
+#endif
+
+static bfd_byte *hi16_rel_addr;
+
+/* This will be used when we sort the dynamic relocation records. */
+static bfd *reldyn_sorting_bfd;
+
+/* SCORE 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 score_elf_scom_section;
+static asymbol score_elf_scom_symbol;
+static asymbol *score_elf_scom_symbol_ptr;
+
+static bfd_reloc_status_type
+score_elf_hi16_reloc (bfd *abfd ATTRIBUTE_UNUSED,
+ arelent *reloc_entry,
+ asymbol *symbol ATTRIBUTE_UNUSED,
+ void * data,
+ asection *input_section ATTRIBUTE_UNUSED,
+ bfd *output_bfd ATTRIBUTE_UNUSED,
+ char **error_message ATTRIBUTE_UNUSED)
+{
+ hi16_rel_addr = (bfd_byte *) data + reloc_entry->address;
+ return bfd_reloc_ok;
+}
+
+static bfd_reloc_status_type
+score_elf_lo16_reloc (bfd *abfd,
+ arelent *reloc_entry,
+ asymbol *symbol ATTRIBUTE_UNUSED,
+ void * data,
+ asection *input_section,
+ bfd *output_bfd ATTRIBUTE_UNUSED,
+ char **error_message ATTRIBUTE_UNUSED)
+{
+ bfd_vma addend = 0, offset = 0;
+ unsigned long val;
+ unsigned long hi16_offset, hi16_value, uvalue;
+
+ hi16_value = bfd_get_32 (abfd, hi16_rel_addr);
+ hi16_offset = ((((hi16_value >> 16) & 0x3) << 15) | (hi16_value & 0x7fff)) >> 1;
+ addend = bfd_get_32 (abfd, (bfd_byte *) data + reloc_entry->address);
+ offset = ((((addend >> 16) & 0x3) << 15) | (addend & 0x7fff)) >> 1;
+ val = reloc_entry->addend;
+ if (reloc_entry->address > input_section->size)
+ return bfd_reloc_outofrange;
+ uvalue = ((hi16_offset << 16) | (offset & 0xffff)) + val;
+ hi16_offset = (uvalue >> 16) << 1;
+ hi16_value = (hi16_value & ~0x37fff) | (hi16_offset & 0x7fff) | ((hi16_offset << 1) & 0x30000);
+ bfd_put_32 (abfd, hi16_value, hi16_rel_addr);
+ offset = (uvalue & 0xffff) << 1;
+ addend = (addend & ~0x37fff) | (offset & 0x7fff) | ((offset << 1) & 0x30000);
+ bfd_put_32 (abfd, addend, (bfd_byte *) data + reloc_entry->address);
+ return bfd_reloc_ok;
+}
+
+/* Set the GP value for OUTPUT_BFD. Returns FALSE if this is a
+ dangerous relocation. */
+
+static bfd_boolean
+score_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++)
+ {
+ 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
+score_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 (!score_elf_assign_gp (output_bfd, pgp))
+ {
+ *error_message =
+ (char *) _("GP relative relocation when _gp not defined");
+ return bfd_reloc_dangerous;
+ }
+ }
+
+ return bfd_reloc_ok;
+}
+
+static bfd_reloc_status_type
+score_elf_gprel15_with_gp (bfd *abfd,
+ asymbol *symbol,
+ arelent *reloc_entry,
+ asection *input_section,
+ bfd_boolean relocateable,
+ void * data,
+ bfd_vma gp ATTRIBUTE_UNUSED)
+{
+ bfd_vma relocation;
+ unsigned long insn;
+
+ 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->size)
+ return bfd_reloc_outofrange;
+
+ insn = bfd_get_32 (abfd, (bfd_byte *) data + reloc_entry->address);
+ if (((reloc_entry->addend & 0xffffc000) != 0)
+ && ((reloc_entry->addend & 0xffffc000) != 0xffffc000))
+ return bfd_reloc_overflow;
+
+ insn = (insn & ~0x7fff) | (reloc_entry->addend & 0x7fff);
+ bfd_put_32 (abfd, insn, (bfd_byte *) data + reloc_entry->address);
+ if (relocateable)
+ reloc_entry->address += input_section->output_offset;
+
+ return bfd_reloc_ok;
+}
+
+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 > bfd_get_section_limit (abfd, input_section))
+ 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;
+}
+
+static bfd_reloc_status_type
+score_elf_gprel15_reloc (bfd *abfd,
+ arelent *reloc_entry,
+ asymbol *symbol,
+ void * data,
+ asection *input_section,
+ bfd *output_bfd,
+ char **error_message)
+{
+ bfd_boolean relocateable;
+ bfd_reloc_status_type ret;
+ bfd_vma gp;
+
+ if (output_bfd != (bfd *) NULL
+ && (symbol->flags & BSF_SECTION_SYM) == 0 && reloc_entry->addend == 0)
+ {
+ reloc_entry->address += input_section->output_offset;
+ return bfd_reloc_ok;
+ }
+ if (output_bfd != (bfd *) NULL)
+ relocateable = TRUE;
+ else
+ {
+ relocateable = FALSE;
+ output_bfd = symbol->section->output_section->owner;
+ }
+
+ ret = score_elf_final_gp (output_bfd, symbol, relocateable, error_message, &gp);
+ if (ret != bfd_reloc_ok)
+ return ret;
+
+ return score_elf_gprel15_with_gp (abfd, symbol, reloc_entry,
+ input_section, relocateable, data, gp);
+}
+
+/* Do a R_SCORE_GPREL32 relocation. This is a 32 bit value which must
+ become the offset from the gp register. */
+
+static bfd_reloc_status_type
+score_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_SCORE_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;
+ else
+ {
+ relocatable = FALSE;
+ output_bfd = symbol->section->output_section->owner;
+ }
+
+ ret = score_elf_final_gp (output_bfd, symbol, relocatable, error_message, &gp);
+ if (ret != bfd_reloc_ok)
+ return ret;
+
+ gp = 0; /* FIXME. */
+ return gprel32_with_gp (abfd, symbol, reloc_entry, input_section,
+ relocatable, data, gp);
+}
+
+/* A howto special_function for R_SCORE_GOT15 relocations. This is just
+ like any other 16-bit relocation when applied to global symbols, but is
+ treated in the same as R_SCORE_HI16 when applied to local symbols. */
+
+static bfd_reloc_status_type
+score_elf_got15_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_elf_generic_reloc (abfd, reloc_entry, symbol, data,
+ input_section, output_bfd,
+ error_message);
+
+ return score_elf_hi16_reloc (abfd, reloc_entry, symbol, data,
+ input_section, output_bfd, error_message);
+}
+
+static bfd_reloc_status_type
+score_elf_got_lo16_reloc (bfd *abfd,
+ arelent *reloc_entry,
+ asymbol *symbol ATTRIBUTE_UNUSED,
+ void * data,
+ asection *input_section,
+ bfd *output_bfd ATTRIBUTE_UNUSED,
+ char **error_message ATTRIBUTE_UNUSED)
+{
+ bfd_vma addend = 0, offset = 0;
+ signed long val;
+ signed long hi16_offset, hi16_value, uvalue;
+
+ hi16_value = bfd_get_32 (abfd, hi16_rel_addr);
+ hi16_offset = ((((hi16_value >> 16) & 0x3) << 15) | (hi16_value & 0x7fff)) >> 1;
+ addend = bfd_get_32 (abfd, (bfd_byte *) data + reloc_entry->address);
+ offset = ((((addend >> 16) & 0x3) << 15) | (addend & 0x7fff)) >> 1;
+ val = reloc_entry->addend;
+ if (reloc_entry->address > input_section->size)
+ return bfd_reloc_outofrange;
+ uvalue = ((hi16_offset << 16) | (offset & 0xffff)) + val;
+ if ((uvalue > -0x8000) && (uvalue < 0x7fff))
+ hi16_offset = 0;
+ else
+ hi16_offset = (uvalue >> 16) & 0x7fff;
+ hi16_value = (hi16_value & ~0x37fff) | (hi16_offset & 0x7fff) | ((hi16_offset << 1) & 0x30000);
+ bfd_put_32 (abfd, hi16_value, hi16_rel_addr);
+ offset = (uvalue & 0xffff) << 1;
+ addend = (addend & ~0x37fff) | (offset & 0x7fff) | ((offset << 1) & 0x30000);
+ bfd_put_32 (abfd, addend, (bfd_byte *) data + reloc_entry->address);
+ return bfd_reloc_ok;
+}
+
+static reloc_howto_type elf32_score_howto_table[] =
+{
+ /* No relocation. */
+ HOWTO (R_SCORE_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_SCORE_NONE", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* R_SCORE_HI16 */
+ HOWTO (R_SCORE_HI16, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ FALSE, /* pc_relative */
+ 1, /* bitpos */
+ complain_overflow_dont,/* complain_on_overflow */
+ score_elf_hi16_reloc, /* special_function */
+ "R_SCORE_HI16", /* name */
+ TRUE, /* partial_inplace */
+ 0x37fff, /* src_mask */
+ 0x37fff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* R_SCORE_LO16 */
+ HOWTO (R_SCORE_LO16, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ FALSE, /* pc_relative */
+ 1, /* bitpos */
+ complain_overflow_dont,/* complain_on_overflow */
+ score_elf_lo16_reloc, /* special_function */
+ "R_SCORE_LO16", /* name */
+ TRUE, /* partial_inplace */
+ 0x37fff, /* src_mask */
+ 0x37fff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* R_SCORE_DUMMY1 */
+ HOWTO (R_SCORE_DUMMY1, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ FALSE, /* pc_relative */
+ 1, /* bitpos */
+ complain_overflow_dont,/* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_SCORE_DUMMY1", /* name */
+ TRUE, /* partial_inplace */
+ 0x0000ffff, /* src_mask */
+ 0x0000ffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /*R_SCORE_24 */
+ HOWTO (R_SCORE_24, /* type */
+ 1, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 24, /* bitsize */
+ FALSE, /* pc_relative */
+ 1, /* bitpos */
+ complain_overflow_dont,/* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_SCORE_24", /* name */
+ FALSE, /* partial_inplace */
+ 0x3ff7fff, /* src_mask */
+ 0x3ff7fff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /*R_SCORE_PC19 */
+ HOWTO (R_SCORE_PC19, /* type */
+ 1, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 19, /* bitsize */
+ TRUE, /* pc_relative */
+ 1, /* bitpos */
+ complain_overflow_dont,/* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_SCORE_PC19", /* name */
+ FALSE, /* partial_inplace */
+ 0x3ff03fe, /* src_mask */
+ 0x3ff03fe, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /*R_SCORE16_11 */
+ HOWTO (R_SCORE16_11, /* type */
+ 1, /* rightshift */
+ 1, /* size (0 = byte, 1 = short, 2 = long) */
+ 11, /* bitsize */
+ FALSE, /* pc_relative */
+ 1, /* bitpos */
+ complain_overflow_dont,/* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_SCORE16_11", /* name */
+ FALSE, /* partial_inplace */
+ 0x000000ffe, /* src_mask */
+ 0x000000ffe, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* R_SCORE16_PC8 */
+ HOWTO (R_SCORE16_PC8, /* type */
+ 1, /* rightshift */
+ 1, /* size (0 = byte, 1 = short, 2 = long) */
+ 8, /* bitsize */
+ TRUE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont,/* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_SCORE16_PC8", /* name */
+ FALSE, /* partial_inplace */
+ 0x000000ff, /* src_mask */
+ 0x000000ff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* 32 bit absolute */
+ HOWTO (R_SCORE_ABS32, /* type 8 */
+ 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_SCORE_ABS32", /* name */
+ FALSE, /* partial_inplace */
+ 0xffffffff, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* 16 bit absolute */
+ HOWTO (R_SCORE_ABS16, /* type 11 */
+ 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_SCORE_ABS16", /* name */
+ FALSE, /* partial_inplace */
+ 0x0000ffff, /* src_mask */
+ 0x0000ffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* R_SCORE_DUMMY2 */
+ HOWTO (R_SCORE_DUMMY2, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont,/* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_SCORE_DUMMY2", /* name */
+ TRUE, /* partial_inplace */
+ 0x00007fff, /* src_mask */
+ 0x00007fff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* R_SCORE_GP15 */
+ HOWTO (R_SCORE_GP15, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont,/* complain_on_overflow */
+ score_elf_gprel15_reloc,/* special_function */
+ "R_SCORE_GP15", /* name */
+ TRUE, /* partial_inplace */
+ 0x00007fff, /* src_mask */
+ 0x00007fff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* GNU extension to record C++ vtable hierarchy. */
+ HOWTO (R_SCORE_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_SCORE_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_SCORE_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_SCORE_GNU_VTENTRY", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* Reference to global offset table. */
+ HOWTO (R_SCORE_GOT15, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_signed, /* complain_on_overflow */
+ score_elf_got15_reloc, /* special_function */
+ "R_SCORE_GOT15", /* name */
+ TRUE, /* partial_inplace */
+ 0x00007fff, /* src_mask */
+ 0x00007fff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* Low 16 bits of displacement in global offset table. */
+ HOWTO (R_SCORE_GOT_LO16, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ FALSE, /* pc_relative */
+ 1, /* bitpos */
+ complain_overflow_dont,/* complain_on_overflow */
+ score_elf_got_lo16_reloc, /* special_function */
+ "R_SCORE_GOT_LO16", /* name */
+ TRUE, /* partial_inplace */
+ 0x37ffe, /* src_mask */
+ 0x37ffe, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* 15 bit call through global offset table. */
+ HOWTO (R_SCORE_CALL15, /* 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_SCORE_CALL15", /* name */
+ TRUE, /* partial_inplace */
+ 0x0000ffff, /* src_mask */
+ 0x0000ffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* 32 bit GP relative reference. */
+ HOWTO (R_SCORE_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 */
+ score_elf_gprel32_reloc, /* special_function */
+ "R_SCORE_GPREL32", /* name */
+ TRUE, /* partial_inplace */
+ 0xffffffff, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* 32 bit symbol relative relocation. */
+ HOWTO (R_SCORE_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_elf_generic_reloc, /* special_function */
+ "R_SCORE_REL32", /* name */
+ TRUE, /* partial_inplace */
+ 0xffffffff, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* R_SCORE_DUMMY_HI16 */
+ HOWTO (R_SCORE_DUMMY_HI16, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ FALSE, /* pc_relative */
+ 1, /* bitpos */
+ complain_overflow_dont,/* complain_on_overflow */
+ score_elf_hi16_reloc, /* special_function */
+ "R_SCORE_DUMMY_HI16", /* name */
+ TRUE, /* partial_inplace */
+ 0x37fff, /* src_mask */
+ 0x37fff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+};
+
+struct score_reloc_map
+{
+ bfd_reloc_code_real_type bfd_reloc_val;
+ unsigned char elf_reloc_val;
+};
+
+static const struct score_reloc_map elf32_score_reloc_map[] =
+{
+ {BFD_RELOC_NONE, R_SCORE_NONE},
+ {BFD_RELOC_HI16_S, R_SCORE_HI16},
+ {BFD_RELOC_LO16, R_SCORE_LO16},
+ {BFD_RELOC_SCORE_DUMMY1, R_SCORE_DUMMY1},
+ {BFD_RELOC_SCORE_JMP, R_SCORE_24},
+ {BFD_RELOC_SCORE_BRANCH, R_SCORE_PC19},
+ {BFD_RELOC_SCORE16_JMP, R_SCORE16_11},
+ {BFD_RELOC_SCORE16_BRANCH, R_SCORE16_PC8},
+ {BFD_RELOC_32, R_SCORE_ABS32},
+ {BFD_RELOC_16, R_SCORE_ABS16},
+ {BFD_RELOC_SCORE_DUMMY2, R_SCORE_DUMMY2},
+ {BFD_RELOC_SCORE_GPREL15, R_SCORE_GP15},
+ {BFD_RELOC_VTABLE_INHERIT, R_SCORE_GNU_VTINHERIT},
+ {BFD_RELOC_VTABLE_ENTRY, R_SCORE_GNU_VTENTRY},
+ {BFD_RELOC_SCORE_GOT15, R_SCORE_GOT15},
+ {BFD_RELOC_SCORE_GOT_LO16, R_SCORE_GOT_LO16},
+ {BFD_RELOC_SCORE_CALL15, R_SCORE_CALL15},
+ {BFD_RELOC_GPREL32, R_SCORE_GPREL32},
+ {BFD_RELOC_32_PCREL, R_SCORE_REL32},
+ {BFD_RELOC_SCORE_DUMMY_HI16, R_SCORE_DUMMY_HI16},
+};
+
+/* 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
+score_elf_got_entry_hash (const void *entry_)
+{
+ const struct score_got_entry *entry = (struct score_got_entry *)entry_;
+
+ return entry->symndx
+ + (!entry->abfd ? entry->d.address : entry->abfd->id);
+}
+
+static int
+score_elf_got_entry_eq (const void *entry1, const void *entry2)
+{
+ const struct score_got_entry *e1 = (struct score_got_entry *)entry1;
+ const struct score_got_entry *e2 = (struct score_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);
+}
+
+/* If H needs a GOT entry, assign it the highest available dynamic
+ index. Otherwise, assign it the lowest available dynamic
+ index. */
+
+static bfd_boolean
+score_elf_sort_hash_table_f (struct score_elf_link_hash_entry *h, void *data)
+{
+ struct score_elf_hash_sort_data *hsd = data;
+
+ if (h->root.root.type == bfd_link_hash_warning)
+ h = (struct score_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;
+}
+
+static asection *
+score_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 score_got_info *
+score_elf_got_info (bfd *abfd, asection **sgotp)
+{
+ asection *sgot;
+ struct score_got_info *g;
+
+ sgot = score_elf_got_section (abfd, TRUE);
+ BFD_ASSERT (sgot != NULL);
+ BFD_ASSERT (elf_section_data (sgot) != NULL);
+ g = score_elf_section_data (sgot)->u.got_info;
+ BFD_ASSERT (g != NULL);
+
+ if (sgotp)
+ *sgotp = sgot;
+ return g;
+}
+
+/* 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_score_elf_size_dynamic_sections, this value is 1. Afterward, the
+ section symbols are added and the count is higher. */
+
+static bfd_boolean
+score_elf_sort_hash_table (struct bfd_link_info *info,
+ unsigned long max_local)
+{
+ struct score_elf_hash_sort_data hsd;
+ struct score_got_info *g;
+ bfd *dynobj;
+
+ dynobj = elf_hash_table (info)->dynobj;
+
+ g = score_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;
+ score_elf_link_hash_traverse (((struct score_elf_link_hash_table *)
+ elf_hash_table (info)),
+ score_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;
+}
+
+/* Create an entry in an score ELF linker hash table. */
+
+static struct bfd_hash_entry *
+score_elf_link_hash_newfunc (struct bfd_hash_entry *entry,
+ struct bfd_hash_table *table,
+ const char *string)
+{
+ struct score_elf_link_hash_entry *ret = (struct score_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 score_elf_link_hash_entry));
+ if (ret == NULL)
+ return (struct bfd_hash_entry *)ret;
+
+ /* Call the allocation method of the superclass. */
+ ret = ((struct score_elf_link_hash_entry *)
+ _bfd_elf_link_hash_newfunc ((struct bfd_hash_entry *)ret, table, string));
+
+ if (ret != NULL)
+ {
+ ret->possibly_dynamic_relocs = 0;
+ ret->readonly_reloc = FALSE;
+ ret->no_fn_stub = FALSE;
+ ret->forced_local = FALSE;
+ }
+
+ return (struct bfd_hash_entry *)ret;
+}
+
+/* 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 *
+score_elf_next_relocation (bfd *abfd ATTRIBUTE_UNUSED, unsigned int r_type,
+ const Elf_Internal_Rela *relocation,
+ const Elf_Internal_Rela *relend)
+{
+ while (relocation < relend)
+ {
+ if (ELF32_R_TYPE (relocation->r_info) == r_type)
+ return relocation;
+
+ ++relocation;
+ }
+
+ /* We didn't find it. */
+ bfd_set_error (bfd_error_bad_value);
+ return NULL;
+}
+
+/* This function is called via qsort() to sort the dynamic relocation
+ entries by increasing r_symndx value. */
+
+static int
+score_elf_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));
+}
+
+/* Return whether a relocation is against a local symbol. */
+
+static bfd_boolean
+score_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 score_elf_link_hash_entry *h;
+ size_t extsymoff;
+
+ r_symndx = ELF32_R_SYM (relocation->r_info);
+ symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr;
+ extsymoff = (elf_bad_symtab (input_bfd)) ? 0 : symtab_hdr->sh_info;
+
+ if (r_symndx < extsymoff)
+ return TRUE;
+ if (elf_bad_symtab (input_bfd) && local_sections[r_symndx] != NULL)
+ return TRUE;
+
+ if (check_forced)
+ {
+ /* Look up the hash table to check whether the symbol was forced local. */
+ h = (struct score_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 score_elf_link_hash_entry *) h->root.root.u.i.link;
+ if (h->root.forced_local)
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+/* Returns the dynamic relocation section for DYNOBJ. */
+
+static asection *
+score_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_with_flags (dynobj, dname,
+ (SEC_ALLOC
+ | SEC_LOAD
+ | SEC_HAS_CONTENTS
+ | SEC_IN_MEMORY
+ | SEC_LINKER_CREATED
+ | SEC_READONLY));
+ if (sreloc == NULL
+ || ! bfd_set_section_alignment (dynobj, sreloc,
+ SCORE_ELF_LOG_FILE_ALIGN (dynobj)))
+ return NULL;
+ }
+ return sreloc;
+}
+
+static void
+score_elf_allocate_dynamic_relocations (bfd *abfd, unsigned int n)
+{
+ asection *s;
+
+ s = score_elf_rel_dyn_section (abfd, FALSE);
+ BFD_ASSERT (s != NULL);
+
+ if (s->size == 0)
+ {
+ /* Make room for a null element. */
+ s->size += SCORE_ELF_REL_SIZE (abfd);
+ ++s->reloc_count;
+ }
+ s->size += n * SCORE_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
+score_elf_create_dynamic_relocation (bfd *output_bfd,
+ struct bfd_link_info *info,
+ const Elf_Internal_Rela *rel,
+ struct score_elf_link_hash_entry *h,
+ bfd_vma symbol,
+ bfd_vma *addendp, asection *input_section)
+{
+ Elf_Internal_Rela outrel[3];
+ asection *sreloc;
+ bfd *dynobj;
+ int r_type;
+ long indx;
+ bfd_boolean defined_p;
+
+ r_type = ELF32_R_TYPE (rel->r_info);
+ dynobj = elf_hash_table (info)->dynobj;
+ sreloc = score_elf_rel_dyn_section (dynobj, FALSE);
+ BFD_ASSERT (sreloc != NULL);
+ BFD_ASSERT (sreloc->contents != NULL);
+ BFD_ASSERT (sreloc->reloc_count * SCORE_ELF_REL_SIZE (output_bfd) < sreloc->size);
+
+ 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 (outrel[0].r_offset == MINUS_ONE)
+ /* The relocation field has been deleted. */
+ return TRUE;
+
+ if (outrel[0].r_offset == MINUS_TWO)
+ {
+ /* 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. */
+ *addendp += symbol;
+ return TRUE;
+ }
+
+ /* We must now calculate the dynamic symbol table index to use
+ in the relocation. */
+ if (h != NULL
+ && (! info->symbolic || !h->root.def_regular)
+ /* h->root.dynindx may be -1 if this symbol was marked to
+ become local. */
+ && h->root.dynindx != -1)
+ {
+ indx = h->root.dynindx;
+ /* ??? 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
+ {
+ 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_SCORE_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 = ELF32_R_INFO ((unsigned long) indx, R_SCORE_REL32);
+
+ /* For strict adherence to the ABI specification, we should
+ generate a R_SCORE_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 SCORE dynamic
+ loaders seems to care, we don't waste space with these
+ artificial relocations. If this turns out to not be true,
+ score_elf_allocate_dynamic_relocations() 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_SCORE_64 by itself for a
+ NULL symbol before this relocation record. */
+ outrel[1].r_info = ELF32_R_INFO (0, R_SCORE_NONE);
+ outrel[2].r_info = ELF32_R_INFO (0, R_SCORE_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. */
+ 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;
+
+ return TRUE;
+}
+
+static bfd_boolean
+score_elf_create_got_section (bfd *abfd,
+ struct bfd_link_info *info,
+ bfd_boolean maybe_exclude)
+{
+ flagword flags;
+ asection *s;
+ struct elf_link_hash_entry *h;
+ struct bfd_link_hash_entry *bh;
+ struct score_got_info *g;
+ bfd_size_type amt;
+
+ /* This function may be called more than once. */
+ s = score_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_with_flags (abfd, ".got", flags);
+ if (s == NULL
+ || ! 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->non_elf = 0;
+ h->def_regular = 1;
+ h->type = STT_OBJECT;
+
+ if (info->shared && ! bfd_elf_link_record_dynamic_symbol (info, h))
+ return FALSE;
+
+ amt = sizeof (struct score_got_info);
+ g = bfd_alloc (abfd, amt);
+ if (g == NULL)
+ return FALSE;
+
+ g->global_gotsym = NULL;
+ g->global_gotno = 0;
+
+ g->local_gotno = SCORE_RESERVED_GOTNO;
+ g->assigned_gotno = SCORE_RESERVED_GOTNO;
+ g->next = NULL;
+
+ g->got_entries = htab_try_create (1, score_elf_got_entry_hash,
+ score_elf_got_entry_eq, NULL);
+ if (g->got_entries == NULL)
+ return FALSE;
+ score_elf_section_data (s)->u.got_info = g;
+ score_elf_section_data (s)->elf.this_hdr.sh_flags |= SHF_ALLOC | SHF_WRITE | SHF_SCORE_GPREL;
+
+ return TRUE;
+}
+
+/* Calculate the %high function. */
+
+static bfd_vma
+score_elf_high (bfd_vma value)
+{
+ return ((value + (bfd_vma) 0x8000) >> 16) & 0xffff;
+}
+
+/* Create a local GOT entry for VALUE. Return the index of the entry,
+ or -1 if it could not be created. */
+
+static struct score_got_entry *
+score_elf_create_local_got_entry (bfd *abfd,
+ bfd *ibfd ATTRIBUTE_UNUSED,
+ struct score_got_info *gg,
+ asection *sgot, bfd_vma value,
+ unsigned long r_symndx ATTRIBUTE_UNUSED,
+ struct score_elf_link_hash_entry *h ATTRIBUTE_UNUSED,
+ int r_type ATTRIBUTE_UNUSED)
+{
+ struct score_got_entry entry, **loc;
+ struct score_got_info *g;
+
+ entry.abfd = NULL;
+ entry.symndx = -1;
+ entry.d.address = value;
+
+ g = gg;
+ loc = (struct score_got_entry **) htab_find_slot (g->got_entries, &entry, INSERT);
+ if (*loc)
+ return *loc;
+
+ entry.gotidx = SCORE_ELF_GOT_SIZE (abfd) * g->assigned_gotno++;
+
+ *loc = 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;
+ }
+
+ bfd_put_32 (abfd, value, (sgot->contents + entry.gotidx));
+
+ return *loc;
+}
+
+/* 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
+score_elf_got16_entry (bfd *abfd, bfd *ibfd, struct bfd_link_info *info,
+ bfd_vma value, bfd_boolean external)
+{
+ asection *sgot;
+ struct score_got_info *g;
+ struct score_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 = score_elf_high (value) << 16;
+ }
+
+ g = score_elf_got_info (elf_hash_table (info)->dynobj, &sgot);
+
+ entry = score_elf_create_local_got_entry (abfd, ibfd, g, sgot, value, 0, NULL,
+ R_SCORE_GOT15);
+ if (entry)
+ return entry->gotidx;
+ else
+ return MINUS_ONE;
+}
+
+static void
+_bfd_score_elf_hide_symbol (struct bfd_link_info *info,
+ struct elf_link_hash_entry *entry,
+ bfd_boolean force_local)
+{
+ bfd *dynobj;
+ asection *got;
+ struct score_got_info *g;
+ struct score_elf_link_hash_entry *h;
+
+ h = (struct score_elf_link_hash_entry *) entry;
+ if (h->forced_local)
+ return;
+ h->forced_local = TRUE;
+
+ dynobj = elf_hash_table (info)->dynobj;
+ if (dynobj != NULL && force_local)
+ {
+ got = score_elf_got_section (dynobj, FALSE);
+ if (got == NULL)
+ return;
+ g = score_elf_section_data (got)->u.got_info;
+
+ if (g->next)
+ {
+ struct score_got_entry e;
+ struct score_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);
+}
+
+/* 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
+score_elf_record_global_got_symbol (struct elf_link_hash_entry *h,
+ bfd *abfd,
+ struct bfd_link_info *info,
+ struct score_got_info *g)
+{
+ struct score_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_score_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 score_elf_link_hash_entry *)h;
+
+ loc = (struct score_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 = 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
+score_elf_record_local_got_symbol (bfd *abfd,
+ long symndx,
+ bfd_vma addend,
+ struct score_got_info *g)
+{
+ struct score_got_entry entry, **loc;
+
+ entry.abfd = abfd;
+ entry.symndx = symndx;
+ entry.d.addend = addend;
+ loc = (struct score_got_entry **)htab_find_slot (g->got_entries, &entry, INSERT);
+
+ if (*loc)
+ return TRUE;
+
+ entry.gotidx = g->local_gotno++;
+
+ *loc = bfd_alloc (abfd, sizeof(entry));
+ if (! *loc)
+ return FALSE;
+
+ memcpy (*loc, &entry, sizeof (entry));
+
+ return TRUE;
+}
+
+/* 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
+score_elf_local_got_index (bfd *abfd, bfd *ibfd, struct bfd_link_info *info,
+ bfd_vma value, unsigned long r_symndx,
+ struct score_elf_link_hash_entry *h, int r_type)
+{
+ asection *sgot;
+ struct score_got_info *g;
+ struct score_got_entry *entry;
+
+ g = score_elf_got_info (elf_hash_table (info)->dynobj, &sgot);
+
+ entry = score_elf_create_local_got_entry (abfd, ibfd, g, sgot, value,
+ r_symndx, h, r_type);
+ if (!entry)
+ return MINUS_ONE;
+
+ else
+ return entry->gotidx;
+}
+
+/* Returns the GOT index for the global symbol indicated by H. */
+
+static bfd_vma
+score_elf_global_got_index (bfd *abfd, struct elf_link_hash_entry *h)
+{
+ bfd_vma index;
+ asection *sgot;
+ struct score_got_info *g;
+ long global_got_dynindx = 0;
+
+ g = score_elf_got_info (abfd, &sgot);
+ if (g->global_gotsym != NULL)
+ global_got_dynindx = g->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) * SCORE_ELF_GOT_SIZE (abfd));
+ BFD_ASSERT (index < sgot->size);
+
+ return index;
+}
+
+/* Returns the offset for the entry at the INDEXth position in the GOT. */
+
+static bfd_vma
+score_elf_got_offset_from_index (bfd *dynobj, bfd *output_bfd,
+ bfd *input_bfd ATTRIBUTE_UNUSED, bfd_vma index)
+{
+ asection *sgot;
+ bfd_vma gp;
+ struct score_got_info *g;
+
+ g = score_elf_got_info (dynobj, &sgot);
+ gp = _bfd_get_gp_value (output_bfd);
+
+ return sgot->output_section->vma + sgot->output_offset + index - gp;
+}
+
+/* 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
+score_elf_resolve_final_got_entry (void **entryp, void *p)
+{
+ struct score_got_entry *entry = (struct score_got_entry *)*entryp;
+ htab_t got_entries = *(htab_t *)p;
+
+ if (entry->abfd != NULL && entry->symndx == -1)
+ {
+ struct score_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 score_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
+score_elf_resolve_final_got_entries (struct score_got_info *g)
+{
+ htab_t got_entries;
+
+ do
+ {
+ got_entries = g->got_entries;
+
+ htab_traverse (got_entries,
+ score_elf_resolve_final_got_entry,
+ &got_entries);
+ }
+ while (got_entries == NULL);
+}
+
+/* Add INCREMENT to the reloc (of type HOWTO) at ADDRESS. for -r */
+
+static void
+score_elf_add_to_rel (bfd *abfd,
+ bfd_byte *address,
+ reloc_howto_type *howto,
+ bfd_signed_vma increment)
+{
+ bfd_signed_vma addend;
+ bfd_vma contents;
+ unsigned long offset;
+ unsigned long r_type = howto->type;
+ unsigned long hi16_addend, hi16_offset, hi16_value, uvalue;
+
+ 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 (r_type)
+ {
+ case R_SCORE_PC19:
+ offset =
+ (((contents & howto->src_mask) & 0x3ff0000) >> 6) | ((contents & howto->src_mask) & 0x3ff);
+ offset += increment;
+ contents =
+ (contents & ~howto->
+ src_mask) | (((offset << 6) & howto->src_mask) & 0x3ff0000) | (offset & 0x3ff);
+ bfd_put_32 (abfd, contents, address);
+ break;
+ case R_SCORE_HI16:
+ break;
+ case R_SCORE_LO16:
+ hi16_addend = bfd_get_32 (abfd, address - 4);
+ hi16_offset = ((((hi16_addend >> 16) & 0x3) << 15) | (hi16_addend & 0x7fff)) >> 1;
+ offset = ((((contents >> 16) & 0x3) << 15) | (contents & 0x7fff)) >> 1;
+ offset = (hi16_offset << 16) | (offset & 0xffff);
+ uvalue = increment + offset;
+ hi16_offset = (uvalue >> 16) << 1;
+ hi16_value = (hi16_addend & (~(howto->dst_mask)))
+ | (hi16_offset & 0x7fff) | ((hi16_offset << 1) & 0x30000);
+ bfd_put_32 (abfd, hi16_value, address - 4);
+ offset = (uvalue & 0xffff) << 1;
+ contents = (contents & (~(howto->dst_mask))) | (offset & 0x7fff) | ((offset << 1) & 0x30000);
+ bfd_put_32 (abfd, contents, address);
+ break;
+ case R_SCORE_24:
+ offset =
+ (((contents & howto->src_mask) >> 1) & 0x1ff8000) | ((contents & howto->src_mask) & 0x7fff);
+ offset += increment;
+ contents =
+ (contents & ~howto->
+ src_mask) | (((offset << 1) & howto->src_mask) & 0x3ff0000) | (offset & 0x7fff);
+ bfd_put_32 (abfd, contents, address);
+ break;
+ case R_SCORE16_11:
+
+ contents = bfd_get_16 (abfd, address);
+ offset = contents & howto->src_mask;
+ offset += increment;
+ contents = (contents & ~howto->src_mask) | (offset & howto->src_mask);
+ bfd_put_16 (abfd, contents, address);
+
+ break;
+ case R_SCORE16_PC8:
+
+ contents = bfd_get_16 (abfd, address);
+ offset = (contents & howto->src_mask) + ((increment >> 1) & 0xff);
+ contents = (contents & (~howto->src_mask)) | (offset & howto->src_mask);
+ bfd_put_16 (abfd, contents, address);
+
+ break;
+ default:
+ addend += increment;
+ contents = (contents & ~howto->dst_mask) | (addend & howto->dst_mask);
+ bfd_put_32 (abfd, contents, address);
+ break;
+ }
+}
+
+/* Perform a relocation as part of a final link. */
+
+static bfd_reloc_status_type
+score_elf_final_link_relocate (reloc_howto_type *howto,
+ bfd *input_bfd,
+ bfd *output_bfd,
+ asection *input_section,
+ bfd_byte *contents,
+ Elf_Internal_Rela *rel,
+ Elf_Internal_Rela *relocs,
+ bfd_vma symbol,
+ struct bfd_link_info *info,
+ const char *sym_name ATTRIBUTE_UNUSED,
+ int sym_flags ATTRIBUTE_UNUSED,
+ struct score_elf_link_hash_entry *h,
+ asection **local_sections,
+ bfd_boolean gp_disp_p)
+{
+ unsigned long r_type;
+ unsigned long r_symndx;
+ bfd_byte *hit_data = contents + rel->r_offset;
+ bfd_vma addend;
+ /* 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 rel_addr;
+ /* 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;
+ /* TRUE if the symbol referred to by this relocation is a local symbol. */
+ bfd_boolean local_p;
+ /* The eventual value we will relocate. */
+ bfd_vma value = symbol;
+ unsigned long hi16_addend, hi16_offset, hi16_value, uvalue, offset, abs_value = 0;
+
+ if (elf_gp (output_bfd) == 0)
+ {
+ struct bfd_link_hash_entry *bh;
+ asection *o;
+
+ bh = bfd_link_hash_lookup (info->hash, "_gp", 0, 0, 1);
+ if (bh != (struct bfd_link_hash_entry *)NULL && bh->type == bfd_link_hash_defined)
+ elf_gp (output_bfd) = (bh->u.def.value
+ + bh->u.def.section->output_section->vma
+ + bh->u.def.section->output_offset);
+ else if (info->relocatable)
+ {
+ bfd_vma lo = -1;
+
+ /* Find the GP-relative section with the lowest offset. */
+ for (o = output_bfd->sections; o != (asection *) NULL; o = o->next)
+ if (o->vma < lo)
+ lo = o->vma;
+ /* And calculate GP relative to that. */
+ elf_gp (output_bfd) = lo + ELF_SCORE_GP_OFFSET (input_bfd);
+ }
+ 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. */
+ }
+ }
+
+ /* Parse the relocation. */
+ r_symndx = ELF32_R_SYM (rel->r_info);
+ r_type = ELF32_R_TYPE (rel->r_info);
+ rel_addr = (input_section->output_section->vma + input_section->output_offset + rel->r_offset);
+ local_p = score_elf_local_relocation_p (input_bfd, rel, local_sections, TRUE);
+
+ if (r_type == R_SCORE_GOT15)
+ {
+ const Elf_Internal_Rela *relend;
+ const Elf_Internal_Rela *lo16_rel;
+ const struct elf_backend_data *bed;
+ bfd_vma lo_value = 0;
+
+ bed = get_elf_backend_data (output_bfd);
+ relend = relocs + input_section->reloc_count * bed->s->int_rels_per_ext_rel;
+ lo16_rel = score_elf_next_relocation (input_bfd, R_SCORE_GOT_LO16, rel, relend);
+ if ((local_p) && (lo16_rel != NULL))
+ {
+ bfd_vma tmp = 0;
+ tmp = bfd_get_32 (input_bfd, contents + lo16_rel->r_offset);
+ lo_value = (((tmp >> 16) & 0x3) << 14) | ((tmp & 0x7fff) >> 1);
+ }
+ addend = lo_value;
+ }
+ else
+ {
+ addend = (bfd_get_32 (input_bfd, hit_data) >> howto->bitpos) & howto->src_mask;
+ }
+
+ /* 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_SCORE_CALL15:
+ case R_SCORE_GOT15:
+ if (!local_p)
+ {
+ g = score_elf_global_got_index (elf_hash_table (info)->dynobj,
+ (struct elf_link_hash_entry *) h);
+ if ((! elf_hash_table(info)->dynamic_sections_created
+ || (info->shared
+ && (info->symbolic || h->root.dynindx == -1)
+ && h->root.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 = score_elf_got_section (tmpbfd, FALSE);
+ bfd_put_32 (tmpbfd, value, sgot->contents + g);
+ }
+ }
+ else if (r_type == R_SCORE_GOT15 || r_type == R_SCORE_CALL15)
+ {
+ /* There's no need to create a local GOT entry here; the
+ calculation for a local GOT15 entry does not involve G. */
+ ;
+ }
+ else
+ {
+ g = score_elf_local_got_index (output_bfd, input_bfd, info,
+ symbol + addend, r_symndx, h, r_type);
+ if (g == MINUS_ONE)
+ return bfd_reloc_outofrange;
+ }
+
+ /* Convert GOT indices to actual offsets. */
+ g = score_elf_got_offset_from_index (elf_hash_table (info)->dynobj,
+ output_bfd, input_bfd, g);
+ break;
+
+ case R_SCORE_HI16:
+ case R_SCORE_LO16:
+ case R_SCORE_GPREL32:
+ gp0 = _bfd_get_gp_value (input_bfd);
+ gp = _bfd_get_gp_value (output_bfd);
+ break;
+
+ case R_SCORE_GP15:
+ gp = _bfd_get_gp_value (output_bfd);
+
+ default:
+ break;
+ }
+
+ switch (r_type)
+ {
+ case R_SCORE_NONE:
+ return bfd_reloc_ok;
+
+ case R_SCORE_ABS32:
+ case R_SCORE_REL32:
+ if ((info->shared
+ || (elf_hash_table (info)->dynamic_sections_created
+ && h != NULL
+ && h->root.def_dynamic
+ && !h->root.def_regular))
+ && 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 (!score_elf_create_dynamic_relocation (output_bfd, info, rel, h,
+ symbol, &value,
+ input_section))
+ return bfd_reloc_undefined;
+ }
+ else
+ {
+ if (r_type != R_SCORE_REL32)
+ value = symbol + addend;
+ else
+ value = addend;
+ }
+ value &= howto->dst_mask;
+ bfd_put_32 (input_bfd, value, hit_data);
+ return bfd_reloc_ok;
+
+ case R_SCORE_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_SCORE_24:
+ addend = bfd_get_32 (input_bfd, hit_data);
+ offset = (((addend & howto->src_mask) >> 1) & 0x1ff8000) | ((addend & howto->src_mask) & 0x7fff);
+ if ((offset & 0x1000000) != 0)
+ offset |= 0xfe000000;
+ value += offset;
+ addend = (addend & ~howto->src_mask)
+ | (((value << 1) & howto->src_mask) & 0x3ff0000) | (value & 0x7fff);
+ bfd_put_32 (input_bfd, addend, hit_data);
+ return bfd_reloc_ok;
+
+ case R_SCORE_PC19:
+ addend = bfd_get_32 (input_bfd, hit_data);
+ offset = (((addend & howto->src_mask) & 0x3ff0000) >> 6) | ((addend & howto->src_mask) & 0x3ff);
+ if ((offset & 0x80000) != 0)
+ offset |= 0xfff00000;
+ abs_value = value = value - rel_addr + offset;
+ /* exceed 20 bit : overflow. */
+ if ((abs_value & 0x80000000) == 0x80000000)
+ abs_value = 0xffffffff - value + 1;
+ if ((abs_value & 0xfff80000) != 0)
+ return bfd_reloc_overflow;
+ addend = (addend & ~howto->src_mask)
+ | (((value << 6) & howto->src_mask) & 0x3ff0000) | (value & 0x3ff);
+ bfd_put_32 (input_bfd, addend, hit_data);
+ return bfd_reloc_ok;
+
+ case R_SCORE16_11:
+ addend = bfd_get_16 (input_bfd, hit_data);
+ offset = addend & howto->src_mask;
+ if ((offset & 0x800) != 0) /* Offset is negative. */
+ offset |= 0xfffff000;
+ value += offset;
+ addend = (addend & ~howto->src_mask) | (value & howto->src_mask);
+ bfd_put_16 (input_bfd, addend, hit_data);
+ return bfd_reloc_ok;
+
+ case R_SCORE16_PC8:
+ addend = bfd_get_16 (input_bfd, hit_data);
+ offset = (addend & howto->src_mask) << 1;
+ if ((offset & 0x100) != 0) /* Offset is negative. */
+ offset |= 0xfffffe00;
+ abs_value = value = value - rel_addr + offset;
+ /* Sign bit + exceed 9 bit. */
+ if (((value & 0xffffff00) != 0) && ((value & 0xffffff00) != 0xffffff00))
+ return bfd_reloc_overflow;
+ value >>= 1;
+ addend = (addend & ~howto->src_mask) | (value & howto->src_mask);
+ bfd_put_16 (input_bfd, addend, hit_data);
+ return bfd_reloc_ok;
+
+ case R_SCORE_HI16:
+ return bfd_reloc_ok;
+
+ case R_SCORE_LO16:
+ hi16_addend = bfd_get_32 (input_bfd, hit_data - 4);
+ hi16_offset = ((((hi16_addend >> 16) & 0x3) << 15) | (hi16_addend & 0x7fff)) >> 1;
+ addend = bfd_get_32 (input_bfd, hit_data);
+ offset = ((((addend >> 16) & 0x3) << 15) | (addend & 0x7fff)) >> 1;
+ offset = (hi16_offset << 16) | (offset & 0xffff);
+
+ if (!gp_disp_p)
+ uvalue = value + offset;
+ else
+ uvalue = offset + gp - rel_addr + 4;
+
+ hi16_offset = (uvalue >> 16) << 1;
+ hi16_value = (hi16_addend & (~(howto->dst_mask)))
+ | (hi16_offset & 0x7fff) | ((hi16_offset << 1) & 0x30000);
+ bfd_put_32 (input_bfd, hi16_value, hit_data - 4);
+ offset = (uvalue & 0xffff) << 1;
+ value = (addend & (~(howto->dst_mask))) | (offset & 0x7fff) | ((offset << 1) & 0x30000);
+ bfd_put_32 (input_bfd, value, hit_data);
+ return bfd_reloc_ok;
+
+ case R_SCORE_GP15:
+ addend = bfd_get_32 (input_bfd, hit_data);
+ offset = addend & 0x7fff;
+ if ((offset & 0x4000) == 0x4000)
+ offset |= 0xffffc000;
+ value = value + offset - gp;
+ if (((value & 0xffffc000) != 0) && ((value & 0xffffc000) != 0xffffc000))
+ return bfd_reloc_overflow;
+ value = (addend & ~howto->src_mask) | (value & howto->src_mask);
+ bfd_put_32 (input_bfd, value, hit_data);
+ return bfd_reloc_ok;
+
+ case R_SCORE_GOT15:
+ case R_SCORE_CALL15:
+ 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_SCORE_GOT_LO16 relocation follows. */
+ forced = ! score_elf_local_relocation_p (input_bfd, rel,
+ local_sections, FALSE);
+ value = score_elf_got16_entry (output_bfd, input_bfd, info,
+ symbol + addend, forced);
+ if (value == MINUS_ONE)
+ return bfd_reloc_outofrange;
+ value = score_elf_got_offset_from_index (elf_hash_table (info)->dynobj,
+ output_bfd, input_bfd, value);
+ }
+ else
+ {
+ value = g;
+ }
+
+ if ((long) value > 0x3fff || (long) value < -0x4000)
+ return bfd_reloc_overflow;
+
+ addend = bfd_get_32 (input_bfd, hit_data);
+ value = (addend & ~howto->dst_mask) | (value & howto->dst_mask);
+ bfd_put_32 (input_bfd, value, hit_data);
+ return bfd_reloc_ok;
+
+ case R_SCORE_GPREL32:
+ value = (addend + symbol - gp);
+ value &= howto->dst_mask;
+ bfd_put_32 (input_bfd, value, hit_data);
+ return bfd_reloc_ok;
+
+ case R_SCORE_GOT_LO16:
+ addend = bfd_get_32 (input_bfd, hit_data);
+ value = (((addend >> 16) & 0x3) << 14) | ((addend & 0x7fff) >> 1);
+ value += symbol;
+ value = (addend & (~(howto->dst_mask))) | ((value & 0x3fff) << 1)
+ | (((value >> 14) & 0x3) << 16);
+
+ bfd_put_32 (input_bfd, value, hit_data);
+ return bfd_reloc_ok;
+
+ case R_SCORE_DUMMY_HI16:
+ return bfd_reloc_ok;
+
+ case R_SCORE_GNU_VTINHERIT:
+ case R_SCORE_GNU_VTENTRY:
+ /* We don't do anything with these at present. */
+ return bfd_reloc_continue;
+
+ default:
+ return bfd_reloc_notsupported;
+ }
+}
+
+/* Score backend functions. */
+
+static void
+_bfd_score_info_to_howto (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 >= NUM_ELEM (elf32_score_howto_table))
+ bfd_reloc->howto = NULL;
+ else
+ bfd_reloc->howto = &elf32_score_howto_table[r_type];
+}
+
+/* Relocate an score ELF section. */
+
+static bfd_boolean
+_bfd_score_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;
+ Elf_Internal_Rela *rel;
+ Elf_Internal_Rela *relend;
+ const char *name;
+ unsigned long offset;
+ unsigned long hi16_addend, hi16_offset, hi16_value, uvalue;
+ size_t extsymoff;
+ bfd_boolean gp_disp_p = FALSE;
+
+ /* Sort dynsym. */
+ if (elf_hash_table (info)->dynamic_sections_created)
+ {
+ bfd_size_type dynsecsymcount = 0;
+ if (info->shared)
+ {
+ asection * p;
+ const struct elf_backend_data *bed = get_elf_backend_data (output_bfd);
+
+ for (p = output_bfd->sections; p ; p = p->next)
+ if ((p->flags & SEC_EXCLUDE) == 0
+ && (p->flags & SEC_ALLOC) != 0
+ && !(*bed->elf_backend_omit_section_dynsym) (output_bfd, info, p))
+ ++ dynsecsymcount;
+ }
+
+ if (!score_elf_sort_hash_table (info, dynsecsymcount + 1))
+ return FALSE;
+ }
+
+ symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr;
+ extsymoff = (elf_bad_symtab (input_bfd)) ? 0 : symtab_hdr->sh_info;
+ 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 score_elf_link_hash_entry *h;
+ bfd_vma relocation = 0;
+ bfd_reloc_status_type r;
+ arelent bfd_reloc;
+
+ r_symndx = ELF32_R_SYM (rel->r_info);
+ r_type = ELF32_R_TYPE (rel->r_info);
+
+ _bfd_score_info_to_howto (input_bfd, &bfd_reloc, (Elf_Internal_Rela *) rel);
+ howto = bfd_reloc.howto;
+
+ h = NULL;
+ sym = NULL;
+ sec = NULL;
+
+ if (r_symndx < extsymoff)
+ {
+ sym = local_syms + r_symndx;
+ sec = local_sections[r_symndx];
+ relocation = (sec->output_section->vma
+ + sec->output_offset
+ + sym->st_value);
+ name = bfd_elf_sym_name (input_bfd, symtab_hdr, sym, sec);
+
+ if (!info->relocatable
+ && (sec->flags & SEC_MERGE) != 0
+ && ELF_ST_TYPE (sym->st_info) == STT_SECTION)
+ {
+ asection *msec;
+ bfd_vma addend, value;
+
+ switch (r_type)
+ {
+ case R_SCORE_HI16:
+ break;
+ case R_SCORE_LO16:
+ hi16_addend = bfd_get_32 (input_bfd, contents + rel->r_offset - 4);
+ hi16_offset = ((((hi16_addend >> 16) & 0x3) << 15) | (hi16_addend & 0x7fff)) >> 1;
+ value = bfd_get_32 (input_bfd, contents + rel->r_offset);
+ offset = ((((value >> 16) & 0x3) << 15) | (value & 0x7fff)) >> 1;
+ addend = (hi16_offset << 16) | (offset & 0xffff);
+ msec = sec;
+ addend = _bfd_elf_rel_local_sym (output_bfd, sym, &msec, addend);
+ addend -= relocation;
+ addend += msec->output_section->vma + msec->output_offset;
+ uvalue = addend;
+ hi16_offset = (uvalue >> 16) << 1;
+ hi16_value = (hi16_addend & (~(howto->dst_mask)))
+ | (hi16_offset & 0x7fff) | ((hi16_offset << 1) & 0x30000);
+ bfd_put_32 (input_bfd, hi16_value, contents + rel->r_offset - 4);
+ offset = (uvalue & 0xffff) << 1;
+ value = (value & (~(howto->dst_mask)))
+ | (offset & 0x7fff) | ((offset << 1) & 0x30000);
+ bfd_put_32 (input_bfd, value, contents + rel->r_offset);
+ break;
+ case R_SCORE_GOT_LO16:
+ value = bfd_get_32 (input_bfd, contents + rel->r_offset);
+ addend = (((value >> 16) & 0x3) << 14) | ((value & 0x7fff) >> 1);
+ 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 & 0x3fff) << 1)
+ | (((addend >> 14) & 0x3) << 16);
+
+ bfd_put_32 (input_bfd, value, contents + rel->r_offset);
+ break;
+ default:
+ 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);
+ break;
+ }
+ }
+ }
+ else
+ {
+ /* For global symbols we look up the symbol in the hash-table. */
+ h = ((struct score_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 score_elf_link_hash_entry *) h->root.root.u.i.link;
+
+ /* Record the name of this symbol, for our caller. */
+ name = h->root.root.root.string;
+
+ /* See if this is the special GP_DISP_LABEL symbol. Note that such a
+ symbol must always be a global symbol. */
+ if (strcmp (name, GP_DISP_LABEL) == 0)
+ {
+ /* Relocations against GP_DISP_LABEL are permitted only with
+ R_SCORE_HI16 and R_SCORE_LO16 relocations. */
+ if (r_type != R_SCORE_HI16 && r_type != R_SCORE_LO16)
+ return bfd_reloc_notsupported;
+
+ gp_disp_p = TRUE;
+ }
+
+ /* If this symbol is defined, calculate its address. Note that
+ GP_DISP_LABEL 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)
+ relocation = (h->root.root.u.def.value
+ + sec->output_section->vma
+ + sec->output_offset);
+ else
+ {
+ relocation = 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. */
+ relocation = 0;
+ else if (info->unresolved_syms_in_objects == RM_IGNORE
+ && ELF_ST_VISIBILITY (h->root.other) == STV_DEFAULT)
+ relocation = 0;
+ else if (strcmp (name, "_DYNAMIC_LINK") == 0)
+ {
+ /* If this is a dynamic link, we should have created a _DYNAMIC_LINK symbol
+ in _bfd_score_elf_create_dynamic_sections. Otherwise, we should define
+ the symbol with a value of 0. */
+ BFD_ASSERT (! info->shared);
+ BFD_ASSERT (bfd_get_section_by_name (output_bfd, ".dynamic") == NULL);
+ relocation = 0;
+ }
+ else if (!info->relocatable)
+ {
+ if (! ((*info->callbacks->undefined_symbol)
+ (info, h->root.root.root.string, input_bfd,
+ input_section, rel->r_offset,
+ (info->unresolved_syms_in_objects == RM_GENERATE_ERROR)
+ || ELF_ST_VISIBILITY (h->root.other))))
+ return bfd_reloc_undefined;
+ relocation = 0;
+ }
+ }
+
+ if (sec != NULL && elf_discarded_section (sec))
+ {
+ /* For relocs against symbols from removed linkonce sections,
+ or sections discarded by a linker script, we just want the
+ section contents zeroed. Avoid any special processing. */
+ _bfd_clear_contents (howto, input_bfd, contents + rel->r_offset);
+ rel->r_info = 0;
+ rel->r_addend = 0;
+ continue;
+ }
+
+ 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 (sym != NULL && ELF_ST_TYPE (sym->st_info) == STT_SECTION)
+ score_elf_add_to_rel (input_bfd, contents + rel->r_offset,
+ howto, (bfd_signed_vma) sec->output_offset);
+ continue;
+ }
+
+ r = score_elf_final_link_relocate (howto, input_bfd, output_bfd,
+ input_section, contents, rel, relocs,
+ relocation, info, name,
+ (h ? ELF_ST_TYPE ((unsigned int)h->root.root.type) :
+ ELF_ST_TYPE ((unsigned int)sym->st_info)), h, local_sections,
+ gp_disp_p);
+
+ 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.root.type != bfd_link_hash_undefined))
+ && (!((*info->callbacks->reloc_overflow)
+ (info, NULL, 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;
+}
+
+/* Look through the relocs for a section during the first phase, and
+ allocate space in the global offset table. */
+
+static bfd_boolean
+_bfd_score_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 score_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;
+
+ name = bfd_get_section_name (abfd, sec);
+
+ if (dynobj == NULL)
+ {
+ sgot = NULL;
+ g = NULL;
+ }
+ else
+ {
+ sgot = score_elf_got_section (dynobj, FALSE);
+ if (sgot == NULL)
+ g = NULL;
+ else
+ {
+ BFD_ASSERT (score_elf_section_data (sgot) != NULL);
+ g = score_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 = ELF32_R_SYM (rel->r_info);
+ r_type = ELF32_R_TYPE (rel->r_info);
+
+ if (r_symndx < extsymoff)
+ {
+ h = NULL;
+ }
+ else if (r_symndx >= extsymoff + NUM_SHDR_ENTRIES (symtab_hdr))
+ {
+ (*_bfd_error_handler) (_("%s: Malformed reloc detected for section %s"), 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_SCORE_GOT15:
+ case R_SCORE_CALL15:
+ if (dynobj == NULL)
+ elf_hash_table (info)->dynobj = dynobj = abfd;
+ if (!score_elf_create_got_section (dynobj, info, FALSE))
+ return FALSE;
+ g = score_elf_got_info (dynobj, &sgot);
+ break;
+ case R_SCORE_ABS32:
+ case R_SCORE_REL32:
+ 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_SCORE_GOT_LO16))
+ {
+ if (! score_elf_record_local_got_symbol (abfd, r_symndx, rel->r_addend, g))
+ return FALSE;
+ }
+
+ switch (r_type)
+ {
+ case R_SCORE_CALL15:
+ if (h == NULL)
+ {
+ (*_bfd_error_handler)
+ (_("%B: CALL15 reloc at 0x%lx not against global symbol"),
+ abfd, (unsigned long) rel->r_offset);
+ bfd_set_error (bfd_error_bad_value);
+ return FALSE;
+ }
+ else
+ {
+ /* This symbol requires a global offset table entry. */
+ if (! score_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->needs_plt = 1;
+ h->type = STT_FUNC;
+ }
+ break;
+ case R_SCORE_GOT15:
+ if (h && ! score_elf_record_global_got_symbol (h, abfd, info, g))
+ return FALSE;
+ break;
+ case R_SCORE_ABS32:
+ case R_SCORE_REL32:
+ if ((info->shared || h != NULL) && (sec->flags & SEC_ALLOC) != 0)
+ {
+ if (sreloc == NULL)
+ {
+ sreloc = score_elf_rel_dyn_section (dynobj, TRUE);
+ if (sreloc == NULL)
+ return FALSE;
+ }
+#define SCORE_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_SCORE_REL32 relocs. We make room for this reloc
+ in the .rel.dyn reloc section. */
+ score_elf_allocate_dynamic_relocations (dynobj, 1);
+ if ((sec->flags & SCORE_READONLY_SECTION)
+ == SCORE_READONLY_SECTION)
+ /* We tell the dynamic linker that there are
+ relocations against the text segment. */
+ info->flags |= DF_TEXTREL;
+ }
+ else
+ {
+ struct score_elf_link_hash_entry *hscore;
+
+ /* We only need to copy this reloc if the symbol is
+ defined in a dynamic object. */
+ hscore = (struct score_elf_link_hash_entry *)h;
+ ++hscore->possibly_dynamic_relocs;
+ if ((sec->flags & SCORE_READONLY_SECTION)
+ == SCORE_READONLY_SECTION)
+ /* We need it to tell the dynamic linker if there
+ are relocations against the text segment. */
+ hscore->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_SCORE_GOTSYM if there are dynamic relocations against it. */
+ if (h != NULL)
+ {
+ if (dynobj == NULL)
+ elf_hash_table (info)->dynobj = dynobj = abfd;
+ if (! score_elf_create_got_section (dynobj, info, TRUE))
+ return FALSE;
+ g = score_elf_got_info (dynobj, &sgot);
+ if (! score_elf_record_global_got_symbol (h, abfd, info, g))
+ return FALSE;
+ }
+ }
+ break;
+
+ /* This relocation describes the C++ object vtable hierarchy.
+ Reconstruct it for later use during GC. */
+ case R_SCORE_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_SCORE_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 score_elf_link_hash_entry *sh;
+
+ sh = (struct score_elf_link_hash_entry *) h;
+ sh->no_fn_stub = TRUE;
+ }
+ break;
+ case R_SCORE_CALL15:
+ break;
+ }
+ }
+
+ return TRUE;
+}
+
+static bfd_boolean
+_bfd_score_elf_add_symbol_hook (bfd *abfd,
+ struct bfd_link_info *info ATTRIBUTE_UNUSED,
+ Elf_Internal_Sym *sym,
+ const char **namep ATTRIBUTE_UNUSED,
+ flagword *flagsp ATTRIBUTE_UNUSED,
+ asection **secp,
+ bfd_vma *valp)
+{
+ switch (sym->st_shndx)
+ {
+ case SHN_COMMON:
+ if (sym->st_size > elf_gp_size (abfd))
+ break;
+ /* Fall through. */
+ case SHN_SCORE_SCOMMON:
+ *secp = bfd_make_section_old_way (abfd, ".scommon");
+ (*secp)->flags |= SEC_IS_COMMON;
+ *valp = sym->st_size;
+ break;
+ }
+
+ return TRUE;
+}
+
+static void
+_bfd_score_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_COMMON:
+ if (asym->value > elf_gp_size (abfd))
+ break;
+ /* Fall through. */
+ case SHN_SCORE_SCOMMON:
+ if (score_elf_scom_section.name == NULL)
+ {
+ /* Initialize the small common section. */
+ score_elf_scom_section.name = ".scommon";
+ score_elf_scom_section.flags = SEC_IS_COMMON;
+ score_elf_scom_section.output_section = &score_elf_scom_section;
+ score_elf_scom_section.symbol = &score_elf_scom_symbol;
+ score_elf_scom_section.symbol_ptr_ptr = &score_elf_scom_symbol_ptr;
+ score_elf_scom_symbol.name = ".scommon";
+ score_elf_scom_symbol.flags = BSF_SECTION_SYM;
+ score_elf_scom_symbol.section = &score_elf_scom_section;
+ score_elf_scom_symbol_ptr = &score_elf_scom_symbol;
+ }
+ asym->section = &score_elf_scom_section;
+ asym->value = elfsym->internal_elf_sym.st_size;
+ break;
+ }
+}
+
+static bfd_boolean
+_bfd_score_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_SCORE_SCOMMON;
+
+ return TRUE;
+}
+
+static bfd_boolean
+_bfd_score_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_SCORE_SCOMMON;
+ return TRUE;
+ }
+
+ 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. */
+
+static bfd_boolean
+_bfd_score_elf_adjust_dynamic_symbol (struct bfd_link_info *info,
+ struct elf_link_hash_entry *h)
+{
+ bfd *dynobj;
+ struct score_elf_link_hash_entry *hscore;
+ asection *s;
+
+ dynobj = elf_hash_table (info)->dynobj;
+
+ /* Make sure we know what is going on here. */
+ BFD_ASSERT (dynobj != NULL
+ && (h->needs_plt
+ || h->u.weakdef != NULL
+ || (h->def_dynamic && h->ref_regular && !h->def_regular)));
+
+ /* If this symbol is defined in a dynamic object, we need to copy
+ any R_SCORE_ABS32 or R_SCORE_REL32 relocs against it into the output
+ file. */
+ hscore = (struct score_elf_link_hash_entry *)h;
+ if (!info->relocatable
+ && hscore->possibly_dynamic_relocs != 0
+ && (h->root.type == bfd_link_hash_defweak || !h->def_regular))
+ {
+ score_elf_allocate_dynamic_relocations (dynobj, hscore->possibly_dynamic_relocs);
+ if (hscore->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 (!hscore->no_fn_stub && h->needs_plt)
+ {
+ 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->def_regular)
+ {
+ /* We need .stub section. */
+ s = bfd_get_section_by_name (dynobj, SCORE_ELF_STUB_SECTION_NAME);
+ BFD_ASSERT (s != NULL);
+
+ h->root.u.def.section = s;
+ h->root.u.def.value = s->size;
+
+ /* XXX Write this stub address somewhere. */
+ h->plt.offset = s->size;
+
+ /* Make room for this stub code. */
+ s->size += SCORE_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->needs_plt)
+ {
+ /* 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->u.weakdef != NULL)
+ {
+ BFD_ASSERT (h->u.weakdef->root.type == bfd_link_hash_defined
+ || h->u.weakdef->root.type == bfd_link_hash_defweak);
+ h->root.u.def.section = h->u.weakdef->root.u.def.section;
+ h->root.u.def.value = h->u.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. */
+
+static bfd_boolean
+_bfd_score_elf_always_size_sections (bfd *output_bfd,
+ struct bfd_link_info *info)
+{
+ bfd *dynobj;
+ asection *s;
+ struct score_got_info *g;
+ int i;
+ bfd_size_type loadable_size = 0;
+ bfd_size_type local_gotno;
+ bfd *sub;
+
+ dynobj = elf_hash_table (info)->dynobj;
+ if (dynobj == NULL)
+ /* Relocatable links don't have it. */
+ return TRUE;
+
+ g = score_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->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_SCORE_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 (! score_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. */
+ loadable_size += SCORE_FUNCTION_STUB_SIZE * i;
+
+ /* 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->size += g->local_gotno * SCORE_ELF_GOT_SIZE (output_bfd);
+
+ g->global_gotno = i;
+ s->size += i * SCORE_ELF_GOT_SIZE (output_bfd);
+
+ score_elf_resolve_final_got_entries (g);
+
+ if (s->size > SCORE_ELF_GOT_MAX_SIZE (output_bfd))
+ {
+ /* Fixme. Error message or Warning message should be issued here. */
+ }
+
+ return TRUE;
+}
+
+/* Set the sizes of the dynamic sections. */
+
+static bfd_boolean
+_bfd_score_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->shared)
+ {
+ s = bfd_get_section_by_name (dynobj, ".interp");
+ BFD_ASSERT (s != NULL);
+ s->size = strlen (ELF_DYNAMIC_INTERPRETER) + 1;
+ s->contents = (bfd_byte *) ELF_DYNAMIC_INTERPRETER;
+ }
+ }
+
+ /* 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;
+
+ 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 (CONST_STRNEQ (name, ".rel"))
+ {
+ if (s->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)
+ s->flags |= SEC_EXCLUDE;
+ }
+ 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;
+ }
+ }
+ else if (CONST_STRNEQ (name, ".got"))
+ {
+ /* _bfd_score_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. */
+ }
+ else if (strcmp (name, SCORE_ELF_STUB_SECTION_NAME) == 0)
+ {
+ /* IRIX rld assumes that the function stub isn't at the end
+ of .text section. So put a dummy. XXX */
+ s->size += SCORE_FUNCTION_STUB_SIZE;
+ }
+ else if (! CONST_STRNEQ (name, ".init"))
+ {
+ /* It's not one of our sections, so don't allocate space. */
+ continue;
+ }
+
+ /* Allocate memory for the section contents. */
+ s->contents = bfd_zalloc (dynobj, s->size);
+ if (s->contents == NULL && s->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_score_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 (!SCORE_ELF_ADD_DYNAMIC_ENTRY (info, DT_DEBUG, 0))
+ return FALSE;
+
+ if (reltext)
+ info->flags |= DF_TEXTREL;
+
+ if ((info->flags & DF_TEXTREL) != 0)
+ {
+ if (!SCORE_ELF_ADD_DYNAMIC_ENTRY (info, DT_TEXTREL, 0))
+ return FALSE;
+ }
+
+ if (! SCORE_ELF_ADD_DYNAMIC_ENTRY (info, DT_PLTGOT, 0))
+ return FALSE;
+
+ if (score_elf_rel_dyn_section (dynobj, FALSE))
+ {
+ if (!SCORE_ELF_ADD_DYNAMIC_ENTRY (info, DT_REL, 0))
+ return FALSE;
+
+ if (!SCORE_ELF_ADD_DYNAMIC_ENTRY (info, DT_RELSZ, 0))
+ return FALSE;
+
+ if (!SCORE_ELF_ADD_DYNAMIC_ENTRY (info, DT_RELENT, 0))
+ return FALSE;
+ }
+
+ if (!SCORE_ELF_ADD_DYNAMIC_ENTRY (info, DT_SCORE_BASE_ADDRESS, 0))
+ return FALSE;
+
+ if (!SCORE_ELF_ADD_DYNAMIC_ENTRY (info, DT_SCORE_LOCAL_GOTNO, 0))
+ return FALSE;
+
+ if (!SCORE_ELF_ADD_DYNAMIC_ENTRY (info, DT_SCORE_SYMTABNO, 0))
+ return FALSE;
+
+ if (!SCORE_ELF_ADD_DYNAMIC_ENTRY (info, DT_SCORE_UNREFEXTNO, 0))
+ return FALSE;
+
+ if (!SCORE_ELF_ADD_DYNAMIC_ENTRY (info, DT_SCORE_GOTSYM, 0))
+ return FALSE;
+
+ if (!SCORE_ELF_ADD_DYNAMIC_ENTRY (info, DT_SCORE_HIPAGENO, 0))
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+static bfd_boolean
+_bfd_score_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;
+ asection *s;
+
+ flags = (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS | SEC_IN_MEMORY
+ | SEC_LINKER_CREATED | SEC_READONLY);
+
+ /* 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 (!score_elf_create_got_section (abfd, info, FALSE))
+ return FALSE;
+
+ if (!score_elf_rel_dyn_section (elf_hash_table (info)->dynobj, TRUE))
+ return FALSE;
+
+ /* Create .stub section. */
+ if (bfd_get_section_by_name (abfd, SCORE_ELF_STUB_SECTION_NAME) == NULL)
+ {
+ s = bfd_make_section_with_flags (abfd, SCORE_ELF_STUB_SECTION_NAME,
+ flags | SEC_CODE);
+ if (s == NULL
+ || !bfd_set_section_alignment (abfd, s, 2))
+
+ return FALSE;
+ }
+
+ if (!info->shared)
+ {
+ const char *name;
+
+ name = "_DYNAMIC_LINK";
+ bh = NULL;
+ if (!(_bfd_generic_link_add_one_symbol
+ (info, abfd, name, BSF_GLOBAL, bfd_abs_section_ptr,
+ (bfd_vma) 0, (const char *)NULL, FALSE, get_elf_backend_data (abfd)->collect, &bh)))
+ return FALSE;
+
+ h = (struct elf_link_hash_entry *)bh;
+ h->non_elf = 0;
+ h->def_regular = 1;
+ h->type = STT_SECTION;
+
+ if (!bfd_elf_link_record_dynamic_symbol (info, h))
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+
+/* Finish up dynamic symbol handling. We set the contents of various
+ dynamic sections here. */
+
+static bfd_boolean
+_bfd_score_elf_finish_dynamic_symbol (bfd *output_bfd,
+ struct bfd_link_info *info,
+ struct elf_link_hash_entry *h,
+ Elf_Internal_Sym *sym)
+{
+ bfd *dynobj;
+ asection *sgot;
+ struct score_got_info *g;
+ const char *name;
+
+ dynobj = elf_hash_table (info)->dynobj;
+
+ if (h->plt.offset != MINUS_ONE)
+ {
+ asection *s;
+ bfd_byte stub[SCORE_FUNCTION_STUB_SIZE];
+
+ /* This symbol has a stub. Set it up. */
+ BFD_ASSERT (h->dynindx != -1);
+
+ s = bfd_get_section_by_name (dynobj, SCORE_ELF_STUB_SECTION_NAME);
+ 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, stub);
+ bfd_put_32 (output_bfd, STUB_MOVE, stub + 4);
+ bfd_put_32 (output_bfd, STUB_LI16 | (h->dynindx << 1), stub + 8);
+ bfd_put_32 (output_bfd, STUB_BRL, stub + 12);
+
+ BFD_ASSERT (h->plt.offset <= s->size);
+ memcpy (s->contents + h->plt.offset, stub, SCORE_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. */
+ sym->st_value = (s->output_section->vma + s->output_offset + h->plt.offset);
+ }
+
+ BFD_ASSERT (h->dynindx != -1 || h->forced_local);
+
+ sgot = score_elf_got_section (dynobj, FALSE);
+ BFD_ASSERT (sgot != NULL);
+ BFD_ASSERT (score_elf_section_data (sgot) != NULL);
+ g = score_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 = score_elf_global_got_index (dynobj, h);
+ bfd_put_32 (output_bfd, value, 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)
+ {
+ 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_LABEL) == 0)
+ {
+ sym->st_shndx = SHN_ABS;
+ sym->st_info = ELF_ST_INFO (STB_GLOBAL, STT_SECTION);
+ sym->st_value = elf_gp (output_bfd);
+ }
+
+ return TRUE;
+}
+
+/* Finish up the dynamic sections. */
+
+static bfd_boolean
+_bfd_score_elf_finish_dynamic_sections (bfd *output_bfd,
+ struct bfd_link_info *info)
+{
+ bfd *dynobj;
+ asection *sdyn;
+ asection *sgot;
+ asection *s;
+ struct score_got_info *g;
+
+ dynobj = elf_hash_table (info)->dynobj;
+
+ sdyn = bfd_get_section_by_name (dynobj, ".dynamic");
+
+ sgot = score_elf_got_section (dynobj, FALSE);
+ if (sgot == NULL)
+ g = NULL;
+ else
+ {
+ BFD_ASSERT (score_elf_section_data (sgot) != NULL);
+ g = score_elf_section_data (sgot)->u.got_info;
+ 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->size;
+ b += SCORE_ELF_DYN_SIZE (dynobj))
+ {
+ Elf_Internal_Dyn dyn;
+ const char *name;
+ size_t elemsize;
+ 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 = score_elf_rel_dyn_section (dynobj, FALSE);
+ BFD_ASSERT (s != NULL);
+ dyn.d_un.d_val = SCORE_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_SCORE_BASE_ADDRESS:
+ s = output_bfd->sections;
+ BFD_ASSERT (s != NULL);
+ dyn.d_un.d_ptr = s->vma & ~(bfd_vma) 0xffff;
+ break;
+
+ case DT_SCORE_LOCAL_GOTNO:
+ dyn.d_un.d_val = g->local_gotno;
+ break;
+
+ case DT_SCORE_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_SCORE_GOTSYM:
+ if (g->global_gotsym)
+ {
+ dyn.d_un.d_val = g->global_gotsym->dynindx;
+ break;
+ }
+ /* In case if we don't have global got symbols we default
+ to setting DT_SCORE_GOTSYM to the same value as
+ DT_SCORE_SYMTABNO, so we just fall through. */
+
+ case DT_SCORE_SYMTABNO:
+ name = ".dynsym";
+ elemsize = SCORE_ELF_SYM_SIZE (output_bfd);
+ s = bfd_get_section_by_name (output_bfd, name);
+ BFD_ASSERT (s != NULL);
+
+ dyn.d_un.d_val = s->size / elemsize;
+ break;
+
+ case DT_SCORE_HIPAGENO:
+ dyn.d_un.d_val = g->local_gotno - SCORE_RESERVED_GOTNO;
+ 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->size > 0)
+ {
+ bfd_put_32 (output_bfd, 0, sgot->contents);
+ bfd_put_32 (output_bfd, 0x80000000, sgot->contents + SCORE_ELF_GOT_SIZE (output_bfd));
+ }
+
+ if (sgot != NULL)
+ elf_section_data (sgot->output_section)->this_hdr.sh_entsize
+ = SCORE_ELF_GOT_SIZE (output_bfd);
+
+
+ /* We need to sort the entries of the dynamic relocation section. */
+ s = score_elf_rel_dyn_section (dynobj, FALSE);
+
+ if (s != NULL && s->size > (bfd_vma)2 * SCORE_ELF_REL_SIZE (output_bfd))
+ {
+ reldyn_sorting_bfd = output_bfd;
+ qsort ((Elf32_External_Rel *) s->contents + 1, s->reloc_count - 1,
+ sizeof (Elf32_External_Rel), score_elf_sort_dynamic_relocs);
+ }
+
+ return TRUE;
+}
+
+/* This function 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. */
+
+static bfd_boolean
+_bfd_score_elf_fake_sections (bfd *abfd ATTRIBUTE_UNUSED,
+ Elf_Internal_Shdr *hdr,
+ asection *sec)
+{
+ const char *name;
+
+ name = bfd_get_section_name (abfd, sec);
+
+ if (strcmp (name, ".got") == 0
+ || strcmp (name, ".srdata") == 0
+ || strcmp (name, ".sdata") == 0
+ || strcmp (name, ".sbss") == 0)
+ hdr->sh_flags |= SHF_SCORE_GPREL;
+
+ return TRUE;
+}
+
+/* This function do additional processing on the ELF section header before writing
+ it out. This is used to set the flags and type fields for some sections. */
+
+/* assign_file_positions_except_relocs() check section flag and if it is allocatable,
+ warning message will be issued. backend_fake_section is called before
+ assign_file_positions_except_relocs(); backend_section_processing after it. so, we
+ modify section flag there, but not backend_fake_section. */
+
+static bfd_boolean
+_bfd_score_elf_section_processing (bfd *abfd ATTRIBUTE_UNUSED, Elf_Internal_Shdr *hdr)
+{
+ if (hdr->bfd_section != NULL)
+ {
+ const char *name = bfd_get_section_name (abfd, hdr->bfd_section);
+
+ if (strcmp (name, ".sdata") == 0)
+ {
+ hdr->sh_flags |= SHF_ALLOC | SHF_WRITE | SHF_SCORE_GPREL;
+ hdr->sh_type = SHT_PROGBITS;
+ }
+ else if (strcmp (name, ".sbss") == 0)
+ {
+ hdr->sh_flags |= SHF_ALLOC | SHF_WRITE | SHF_SCORE_GPREL;
+ hdr->sh_type = SHT_NOBITS;
+ }
+ else if (strcmp (name, ".srdata") == 0)
+ {
+ hdr->sh_flags |= SHF_ALLOC | SHF_SCORE_GPREL;
+ hdr->sh_type = SHT_PROGBITS;
+ }
+ }
+
+ return TRUE;
+}
+
+static bfd_boolean
+_bfd_score_elf_write_section (bfd *output_bfd,
+ struct bfd_link_info *link_info ATTRIBUTE_UNUSED,
+ asection *sec, bfd_byte *contents)
+{
+ bfd_byte *to, *from, *end;
+ int i;
+
+ if (strcmp (sec->name, ".pdr") != 0)
+ return FALSE;
+
+ if (score_elf_section_data (sec)->u.tdata == NULL)
+ return FALSE;
+
+ to = contents;
+ end = contents + sec->size;
+ for (from = contents, i = 0; from < end; from += PDR_SIZE, i++)
+ {
+ if ((score_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,
+ (file_ptr) sec->output_offset, sec->size);
+
+ return TRUE;
+}
+
+/* Copy data from a SCORE ELF indirect symbol to its direct symbol, hiding the old
+ indirect symbol. Process additional relocation information. */
+
+static void
+_bfd_score_elf_copy_indirect_symbol (struct bfd_link_info *info,
+ struct elf_link_hash_entry *dir,
+ struct elf_link_hash_entry *ind)
+{
+ struct score_elf_link_hash_entry *dirscore, *indscore;
+
+ _bfd_elf_link_hash_copy_indirect (info, dir, ind);
+
+ if (ind->root.type != bfd_link_hash_indirect)
+ return;
+
+ dirscore = (struct score_elf_link_hash_entry *) dir;
+ indscore = (struct score_elf_link_hash_entry *) ind;
+ dirscore->possibly_dynamic_relocs += indscore->possibly_dynamic_relocs;
+
+ if (indscore->readonly_reloc)
+ dirscore->readonly_reloc = TRUE;
+
+ if (indscore->no_fn_stub)
+ dirscore->no_fn_stub = TRUE;
+}
+
+/* Remove information about discarded functions from other sections which mention them. */
+
+static bfd_boolean
+_bfd_score_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) || (o->size == 0) || (o->size % PDR_SIZE != 0)
+ || (o->output_section != NULL && bfd_is_abs_section (o->output_section)))
+ return FALSE;
+
+ tdata = bfd_zmalloc (o->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->size; i++)
+ {
+ if (bfd_elf_reloc_symbol_deleted_p (i * PDR_SIZE, cookie))
+ {
+ tdata[i] = 1;
+ skip++;
+ }
+ }
+
+ if (skip != 0)
+ {
+ score_elf_section_data (o)->u.tdata = tdata;
+ o->size -= skip * PDR_SIZE;
+ ret = TRUE;
+ }
+ else
+ free (tdata);
+
+ if (!info->keep_memory)
+ free (cookie->rels);
+
+ return ret;
+}
+
+/* Signal that discard_info() has removed the discarded relocations for this section. */
+
+static bfd_boolean
+_bfd_score_elf_ignore_discarded_relocs (asection *sec)
+{
+ if (strcmp (sec->name, ".pdr") == 0)
+ return TRUE;
+ return FALSE;
+}
+
+/* Return the section that should be marked against GC for a given
+ relocation. */
+
+static asection *
+_bfd_score_elf_gc_mark_hook (asection *sec,
+ struct bfd_link_info *info,
+ 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_SCORE_GNU_VTINHERIT:
+ case R_SCORE_GNU_VTENTRY:
+ return NULL;
+ }
+
+ return _bfd_elf_gc_mark_hook (sec, info, rel, h, sym);
+}
+
+/* Support for core dump NOTE sections. */
+
+static bfd_boolean
+_bfd_score_elf_grok_prstatus (bfd *abfd, Elf_Internal_Note *note)
+{
+ int offset;
+ unsigned int raw_size;
+
+ switch (note->descsz)
+ {
+ default:
+ return FALSE;
+
+ case 148: /* Linux/Score 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
+_bfd_score_elf_grok_psinfo (bfd *abfd, Elf_Internal_Note *note)
+{
+ switch (note->descsz)
+ {
+ default:
+ return FALSE;
+
+ case 124: /* Linux/Score 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;
+}
+
+
+/* Score BFD functions. */
+
+static reloc_howto_type *
+elf32_score_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED, bfd_reloc_code_real_type code)
+{
+ unsigned int i;
+
+ for (i = 0; i < NUM_ELEM (elf32_score_reloc_map); i++)
+ if (elf32_score_reloc_map[i].bfd_reloc_val == code)
+ return &elf32_score_howto_table[elf32_score_reloc_map[i].elf_reloc_val];
+
+ return NULL;
+}
+
+static reloc_howto_type *
+elf32_score_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED,
+ const char *r_name)
+{
+ unsigned int i;
+
+ for (i = 0;
+ i < (sizeof (elf32_score_howto_table)
+ / sizeof (elf32_score_howto_table[0]));
+ i++)
+ if (elf32_score_howto_table[i].name != NULL
+ && strcasecmp (elf32_score_howto_table[i].name, r_name) == 0)
+ return &elf32_score_howto_table[i];
+
+ return NULL;
+}
+
+/* Create a score elf linker hash table. */
+
+static struct bfd_link_hash_table *
+elf32_score_link_hash_table_create (bfd *abfd)
+{
+ struct score_elf_link_hash_table *ret;
+ bfd_size_type amt = sizeof (struct score_elf_link_hash_table);
+
+ ret = bfd_malloc (amt);
+ if (ret == NULL)
+ return NULL;
+
+ if (!_bfd_elf_link_hash_table_init (&ret->root, abfd, score_elf_link_hash_newfunc,
+ sizeof (struct score_elf_link_hash_entry)))
+ {
+ free (ret);
+ return NULL;
+ }
+
+ return &ret->root.root;
+}
+
+static bfd_boolean
+elf32_score_print_private_bfd_data (bfd *abfd, void * ptr)
+{
+ FILE *file = (FILE *) ptr;
+
+ BFD_ASSERT (abfd != NULL && ptr != NULL);
+
+ /* Print normal ELF private data. */
+ _bfd_elf_print_private_bfd_data (abfd, ptr);
+
+ /* xgettext:c-format */
+ fprintf (file, _("private flags = %lx:"), elf_elfheader (abfd)->e_flags);
+ if (elf_elfheader (abfd)->e_flags & EF_SCORE_PIC)
+ {
+ fprintf (file, _(" [pic]"));
+ }
+ if (elf_elfheader (abfd)->e_flags & EF_SCORE_FIXDEP)
+ {
+ fprintf (file, _(" [fix dep]"));
+ }
+ fputc ('\n', file);
+
+ return TRUE;
+}
+
+static bfd_boolean
+elf32_score_merge_private_bfd_data (bfd *ibfd, bfd *obfd)
+{
+ flagword in_flags;
+ flagword out_flags;
+
+ if (!_bfd_generic_verify_endian_match (ibfd, obfd))
+ return FALSE;
+
+ in_flags = elf_elfheader (ibfd)->e_flags;
+ out_flags = elf_elfheader (obfd)->e_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))
+ {
+ 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;
+ }
+
+ if (((in_flags & EF_SCORE_PIC) != 0) != ((out_flags & EF_SCORE_PIC) != 0))
+ {
+ (*_bfd_error_handler) (_("%B: warning: linking PIC files with non-PIC files"), ibfd);
+ }
+
+ /* FIXME: Maybe dependency fix compatibility should be checked here. */
+
+ return TRUE;
+}
+
+static bfd_boolean
+elf32_score_new_section_hook (bfd *abfd, asection *sec)
+{
+ struct _score_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);
+}
+
+
+#define USE_REL 1
+#define TARGET_LITTLE_SYM bfd_elf32_littlescore_vec
+#define TARGET_LITTLE_NAME "elf32-littlescore"
+#define TARGET_BIG_SYM bfd_elf32_bigscore_vec
+#define TARGET_BIG_NAME "elf32-bigscore"
+#define ELF_ARCH bfd_arch_score
+#define ELF_MACHINE_CODE EM_SCORE
+#define ELF_MAXPAGESIZE 0x8000
+
+#define elf_info_to_howto 0
+#define elf_info_to_howto_rel _bfd_score_info_to_howto
+#define elf_backend_relocate_section _bfd_score_elf_relocate_section
+#define elf_backend_check_relocs _bfd_score_elf_check_relocs
+#define elf_backend_add_symbol_hook _bfd_score_elf_add_symbol_hook
+#define elf_backend_symbol_processing _bfd_score_elf_symbol_processing
+#define elf_backend_link_output_symbol_hook \
+ _bfd_score_elf_link_output_symbol_hook
+#define elf_backend_section_from_bfd_section \
+ _bfd_score_elf_section_from_bfd_section
+#define elf_backend_adjust_dynamic_symbol \
+ _bfd_score_elf_adjust_dynamic_symbol
+#define elf_backend_always_size_sections \
+ _bfd_score_elf_always_size_sections
+#define elf_backend_size_dynamic_sections \
+ _bfd_score_elf_size_dynamic_sections
+#define elf_backend_omit_section_dynsym \
+ ((bfd_boolean (*) (bfd *, struct bfd_link_info *, asection *)) bfd_true)
+#define elf_backend_create_dynamic_sections \
+ _bfd_score_elf_create_dynamic_sections
+#define elf_backend_finish_dynamic_symbol \
+ _bfd_score_elf_finish_dynamic_symbol
+#define elf_backend_finish_dynamic_sections \
+ _bfd_score_elf_finish_dynamic_sections
+#define elf_backend_fake_sections _bfd_score_elf_fake_sections
+#define elf_backend_section_processing _bfd_score_elf_section_processing
+#define elf_backend_write_section _bfd_score_elf_write_section
+#define elf_backend_copy_indirect_symbol _bfd_score_elf_copy_indirect_symbol
+#define elf_backend_hide_symbol _bfd_score_elf_hide_symbol
+#define elf_backend_discard_info _bfd_score_elf_discard_info
+#define elf_backend_ignore_discarded_relocs \
+ _bfd_score_elf_ignore_discarded_relocs
+#define elf_backend_gc_mark_hook _bfd_score_elf_gc_mark_hook
+#define elf_backend_grok_prstatus _bfd_score_elf_grok_prstatus
+#define elf_backend_grok_psinfo _bfd_score_elf_grok_psinfo
+#define elf_backend_can_gc_sections 1
+#define elf_backend_want_plt_sym 0
+#define elf_backend_got_header_size (4 * SCORE_RESERVED_GOTNO)
+#define elf_backend_plt_header_size 0
+#define elf_backend_collect TRUE
+#define elf_backend_type_change_ok TRUE
+
+#define bfd_elf32_bfd_reloc_type_lookup elf32_score_reloc_type_lookup
+#define bfd_elf32_bfd_reloc_name_lookup \
+ elf32_score_reloc_name_lookup
+#define bfd_elf32_bfd_link_hash_table_create elf32_score_link_hash_table_create
+#define bfd_elf32_bfd_print_private_bfd_data elf32_score_print_private_bfd_data
+#define bfd_elf32_bfd_merge_private_bfd_data elf32_score_merge_private_bfd_data
+#define bfd_elf32_new_section_hook elf32_score_new_section_hook
+
+#include "elf32-target.h"
diff --git a/contrib/binutils/bfd/elf32-sh-relocs.h b/contrib/binutils/bfd/elf32-sh-relocs.h
new file mode 100644
index 0000000..3488ef4
--- /dev/null
+++ b/contrib/binutils/bfd/elf32-sh-relocs.h
@@ -0,0 +1,1716 @@
+ /* No relocation. */
+ HOWTO (R_SH_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 */
+ sh_elf_ignore_reloc, /* special_function */
+ "R_SH_NONE", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* 32 bit absolute relocation. Setting partial_inplace to TRUE and
+ src_mask to a non-zero value is similar to the COFF toolchain. */
+ HOWTO (R_SH_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 */
+ SH_ELF_RELOC, /* special_function */
+ "R_SH_DIR32", /* name */
+ SH_PARTIAL32, /* partial_inplace */
+ SH_SRC_MASK32, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* 32 bit PC relative relocation. */
+ HOWTO (R_SH_REL32, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 32, /* bitsize */
+ TRUE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_signed, /* complain_on_overflow */
+ sh_elf_ignore_reloc, /* special_function */
+ "R_SH_REL32", /* name */
+ SH_PARTIAL32, /* partial_inplace */
+ SH_SRC_MASK32, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ TRUE), /* pcrel_offset */
+
+ /* 8 bit PC relative branch divided by 2. */
+ HOWTO (R_SH_DIR8WPN, /* type */
+ 1, /* rightshift */
+ 1, /* size (0 = byte, 1 = short, 2 = long) */
+ 8, /* bitsize */
+ TRUE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_signed, /* complain_on_overflow */
+ sh_elf_ignore_reloc, /* special_function */
+ "R_SH_DIR8WPN", /* name */
+ TRUE, /* partial_inplace */
+ 0xff, /* src_mask */
+ 0xff, /* dst_mask */
+ TRUE), /* pcrel_offset */
+
+ /* 12 bit PC relative branch divided by 2. */
+ /* This cannot be partial_inplace because relaxation can't know the
+ eventual value of a symbol. */
+ HOWTO (R_SH_IND12W, /* type */
+ 1, /* rightshift */
+ 1, /* size (0 = byte, 1 = short, 2 = long) */
+ 12, /* bitsize */
+ TRUE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_signed, /* complain_on_overflow */
+ NULL, /* special_function */
+ "R_SH_IND12W", /* name */
+ FALSE, /* partial_inplace */
+ 0x0, /* src_mask */
+ 0xfff, /* dst_mask */
+ TRUE), /* pcrel_offset */
+
+ /* 8 bit unsigned PC relative divided by 4. */
+ HOWTO (R_SH_DIR8WPL, /* type */
+ 2, /* rightshift */
+ 1, /* size (0 = byte, 1 = short, 2 = long) */
+ 8, /* bitsize */
+ TRUE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_unsigned, /* complain_on_overflow */
+ sh_elf_ignore_reloc, /* special_function */
+ "R_SH_DIR8WPL", /* name */
+ TRUE, /* partial_inplace */
+ 0xff, /* src_mask */
+ 0xff, /* dst_mask */
+ TRUE), /* pcrel_offset */
+
+ /* 8 bit unsigned PC relative divided by 2. */
+ HOWTO (R_SH_DIR8WPZ, /* type */
+ 1, /* rightshift */
+ 1, /* size (0 = byte, 1 = short, 2 = long) */
+ 8, /* bitsize */
+ TRUE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_unsigned, /* complain_on_overflow */
+ sh_elf_ignore_reloc, /* special_function */
+ "R_SH_DIR8WPZ", /* name */
+ TRUE, /* partial_inplace */
+ 0xff, /* src_mask */
+ 0xff, /* dst_mask */
+ TRUE), /* pcrel_offset */
+
+ /* 8 bit GBR relative. FIXME: This only makes sense if we have some
+ special symbol for the GBR relative area, and that is not
+ implemented. */
+ HOWTO (R_SH_DIR8BP, /* type */
+ 0, /* rightshift */
+ 1, /* size (0 = byte, 1 = short, 2 = long) */
+ 8, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_unsigned, /* complain_on_overflow */
+ sh_elf_ignore_reloc, /* special_function */
+ "R_SH_DIR8BP", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0xff, /* dst_mask */
+ TRUE), /* pcrel_offset */
+
+ /* 8 bit GBR relative divided by 2. FIXME: This only makes sense if
+ we have some special symbol for the GBR relative area, and that
+ is not implemented. */
+ HOWTO (R_SH_DIR8W, /* type */
+ 1, /* rightshift */
+ 1, /* size (0 = byte, 1 = short, 2 = long) */
+ 8, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_unsigned, /* complain_on_overflow */
+ sh_elf_ignore_reloc, /* special_function */
+ "R_SH_DIR8W", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0xff, /* dst_mask */
+ TRUE), /* pcrel_offset */
+
+ /* 8 bit GBR relative divided by 4. FIXME: This only makes sense if
+ we have some special symbol for the GBR relative area, and that
+ is not implemented. */
+ HOWTO (R_SH_DIR8L, /* type */
+ 2, /* rightshift */
+ 1, /* size (0 = byte, 1 = short, 2 = long) */
+ 8, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_unsigned, /* complain_on_overflow */
+ sh_elf_ignore_reloc, /* special_function */
+ "R_SH_DIR8L", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0xff, /* dst_mask */
+ TRUE), /* pcrel_offset */
+
+ /* 8 bit PC relative divided by 2 - but specified in a very odd way. */
+ HOWTO (R_SH_LOOP_START, /* type */
+ 1, /* rightshift */
+ 1, /* size (0 = byte, 1 = short, 2 = long) */
+ 8, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_signed, /* complain_on_overflow */
+ sh_elf_ignore_reloc, /* special_function */
+ "R_SH_LOOP_START", /* name */
+ TRUE, /* partial_inplace */
+ 0xff, /* src_mask */
+ 0xff, /* dst_mask */
+ TRUE), /* pcrel_offset */
+
+ /* 8 bit PC relative divided by 2 - but specified in a very odd way. */
+ HOWTO (R_SH_LOOP_END, /* type */
+ 1, /* rightshift */
+ 1, /* size (0 = byte, 1 = short, 2 = long) */
+ 8, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_signed, /* complain_on_overflow */
+ sh_elf_ignore_reloc, /* special_function */
+ "R_SH_LOOP_END", /* name */
+ TRUE, /* partial_inplace */
+ 0xff, /* src_mask */
+ 0xff, /* dst_mask */
+ TRUE), /* pcrel_offset */
+
+ 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),
+
+ /* The remaining relocs are a GNU extension used for relaxing. The
+ final pass of the linker never needs to do anything with any of
+ these relocs. Any required operations are handled by the
+ relaxation code. */
+
+ /* GNU extension to record C++ vtable hierarchy */
+ HOWTO (R_SH_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_SH_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_SH_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_SH_GNU_VTENTRY", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* An 8 bit switch table entry. This is generated for an expression
+ such as ``.word L1 - L2''. The offset holds the difference
+ between the reloc address and L2. */
+ HOWTO (R_SH_SWITCH8, /* type */
+ 0, /* rightshift */
+ 0, /* size (0 = byte, 1 = short, 2 = long) */
+ 8, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_unsigned, /* complain_on_overflow */
+ sh_elf_ignore_reloc, /* special_function */
+ "R_SH_SWITCH8", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0, /* dst_mask */
+ TRUE), /* pcrel_offset */
+
+ /* A 16 bit switch table entry. This is generated for an expression
+ such as ``.word L1 - L2''. The offset holds the difference
+ between the reloc address and L2. */
+ HOWTO (R_SH_SWITCH16, /* type */
+ 0, /* rightshift */
+ 1, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_unsigned, /* complain_on_overflow */
+ sh_elf_ignore_reloc, /* special_function */
+ "R_SH_SWITCH16", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0, /* dst_mask */
+ TRUE), /* pcrel_offset */
+
+ /* A 32 bit switch table entry. This is generated for an expression
+ such as ``.long L1 - L2''. The offset holds the difference
+ between the reloc address and L2. */
+ HOWTO (R_SH_SWITCH32, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 32, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_unsigned, /* complain_on_overflow */
+ sh_elf_ignore_reloc, /* special_function */
+ "R_SH_SWITCH32", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0, /* dst_mask */
+ TRUE), /* pcrel_offset */
+
+ /* Indicates a .uses pseudo-op. The compiler will generate .uses
+ pseudo-ops when it finds a function call which can be relaxed.
+ The offset field holds the PC relative offset to the instruction
+ which loads the register used in the function call. */
+ HOWTO (R_SH_USES, /* type */
+ 0, /* rightshift */
+ 1, /* size (0 = byte, 1 = short, 2 = long) */
+ 0, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_unsigned, /* complain_on_overflow */
+ sh_elf_ignore_reloc, /* special_function */
+ "R_SH_USES", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0, /* dst_mask */
+ TRUE), /* pcrel_offset */
+
+ /* The assembler will generate this reloc for addresses referred to
+ by the register loads associated with USES relocs. The offset
+ field holds the number of times the address is referenced in the
+ object file. */
+ HOWTO (R_SH_COUNT, /* type */
+ 0, /* rightshift */
+ 1, /* size (0 = byte, 1 = short, 2 = long) */
+ 0, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_unsigned, /* complain_on_overflow */
+ sh_elf_ignore_reloc, /* special_function */
+ "R_SH_COUNT", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0, /* dst_mask */
+ TRUE), /* pcrel_offset */
+
+ /* Indicates an alignment statement. The offset field is the power
+ of 2 to which subsequent portions of the object file must be
+ aligned. */
+ HOWTO (R_SH_ALIGN, /* type */
+ 0, /* rightshift */
+ 1, /* size (0 = byte, 1 = short, 2 = long) */
+ 0, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_unsigned, /* complain_on_overflow */
+ sh_elf_ignore_reloc, /* special_function */
+ "R_SH_ALIGN", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0, /* dst_mask */
+ TRUE), /* pcrel_offset */
+
+ /* The assembler will generate this reloc before a block of
+ instructions. A section should be processed as assuming it
+ contains data, unless this reloc is seen. */
+ HOWTO (R_SH_CODE, /* type */
+ 0, /* rightshift */
+ 1, /* size (0 = byte, 1 = short, 2 = long) */
+ 0, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_unsigned, /* complain_on_overflow */
+ sh_elf_ignore_reloc, /* special_function */
+ "R_SH_CODE", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0, /* dst_mask */
+ TRUE), /* pcrel_offset */
+
+ /* The assembler will generate this reloc after a block of
+ instructions when it sees data that is not instructions. */
+ HOWTO (R_SH_DATA, /* type */
+ 0, /* rightshift */
+ 1, /* size (0 = byte, 1 = short, 2 = long) */
+ 0, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_unsigned, /* complain_on_overflow */
+ sh_elf_ignore_reloc, /* special_function */
+ "R_SH_DATA", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0, /* dst_mask */
+ TRUE), /* pcrel_offset */
+
+ /* The assembler generates this reloc for each label within a block
+ of instructions. This permits the linker to avoid swapping
+ instructions which are the targets of branches. */
+ HOWTO (R_SH_LABEL, /* type */
+ 0, /* rightshift */
+ 1, /* size (0 = byte, 1 = short, 2 = long) */
+ 0, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_unsigned, /* complain_on_overflow */
+ sh_elf_ignore_reloc, /* special_function */
+ "R_SH_LABEL", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0, /* dst_mask */
+ TRUE), /* pcrel_offset */
+
+ /* The next 12 are only supported via linking in SHC-generated objects. */
+ HOWTO (R_SH_DIR16, /* 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_SH_DIR16", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0xffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ HOWTO (R_SH_DIR8, /* type */
+ 0, /* rightshift */
+ 0, /* size (0 = byte, 1 = short, 2 = long) */
+ 8, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_SH_DIR8", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0xff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ HOWTO (R_SH_DIR8UL, /* type */
+ 2, /* rightshift */
+ 0, /* size (0 = byte, 1 = short, 2 = long) */
+ 8, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_unsigned, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_SH_DIR8UL", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0xff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ HOWTO (R_SH_DIR8UW, /* type */
+ 1, /* rightshift */
+ 0, /* size (0 = byte, 1 = short, 2 = long) */
+ 8, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_unsigned, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_SH_DIR8UW", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0xff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ HOWTO (R_SH_DIR8U, /* type */
+ 0, /* rightshift */
+ 0, /* size (0 = byte, 1 = short, 2 = long) */
+ 8, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_unsigned, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_SH_DIR8U", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0xff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ HOWTO (R_SH_DIR8SW, /* type */
+ 1, /* rightshift */
+ 0, /* size (0 = byte, 1 = short, 2 = long) */
+ 8, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_signed, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_SH_DIR8SW", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0xff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ HOWTO (R_SH_DIR8S, /* type */
+ 0, /* rightshift */
+ 0, /* size (0 = byte, 1 = short, 2 = long) */
+ 8, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_signed, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_SH_DIR8S", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0xff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ HOWTO (R_SH_DIR4UL, /* type */
+ 2, /* rightshift */
+ 0, /* size (0 = byte, 1 = short, 2 = long) */
+ 4, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_unsigned, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_SH_DIR4UL", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0x0f, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ HOWTO (R_SH_DIR4UW, /* type */
+ 1, /* rightshift */
+ 0, /* size (0 = byte, 1 = short, 2 = long) */
+ 4, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_unsigned, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_SH_DIR4UW", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0x0f, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ HOWTO (R_SH_DIR4U, /* type */
+ 0, /* rightshift */
+ 0, /* size (0 = byte, 1 = short, 2 = long) */
+ 4, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_unsigned, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_SH_DIR4U", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0x0f, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ HOWTO (R_SH_PSHA, /* type */
+ 0, /* rightshift */
+ 1, /* size (0 = byte, 1 = short, 2 = long) */
+ 7, /* bitsize */
+ FALSE, /* pc_relative */
+ 4, /* bitpos */
+ complain_overflow_signed, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_SH_PSHA", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0x0f, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ HOWTO (R_SH_PSHL, /* type */
+ 0, /* rightshift */
+ 1, /* size (0 = byte, 1 = short, 2 = long) */
+ 7, /* bitsize */
+ FALSE, /* pc_relative */
+ 4, /* bitpos */
+ complain_overflow_signed, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_SH_PSHL", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0x0f, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+#ifdef INCLUDE_SHMEDIA
+ /* Used in SHLLI.L and SHLRI.L. */
+ HOWTO (R_SH_DIR5U, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 5, /* bitsize */
+ FALSE, /* pc_relative */
+ 10, /* bitpos */
+ complain_overflow_unsigned, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_SH_DIR5U", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0xfc00, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* Used in SHARI, SHLLI et al. */
+ HOWTO (R_SH_DIR6U, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 6, /* bitsize */
+ FALSE, /* pc_relative */
+ 10, /* bitpos */
+ complain_overflow_unsigned, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_SH_DIR6U", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0xfc00, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* Used in BxxI, LDHI.L et al. */
+ HOWTO (R_SH_DIR6S, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 6, /* bitsize */
+ FALSE, /* pc_relative */
+ 10, /* bitpos */
+ complain_overflow_signed, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_SH_DIR6S", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0xfc00, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* Used in ADDI, ANDI et al. */
+ HOWTO (R_SH_DIR10S, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 10, /* bitsize */
+ FALSE, /* pc_relative */
+ 10, /* bitpos */
+ complain_overflow_signed, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_SH_DIR10S", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0xffc00, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* Used in LD.UW, ST.W et al. */
+ HOWTO (R_SH_DIR10SW, /* type */
+ 1, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 11, /* bitsize */
+ FALSE, /* pc_relative */
+ 10, /* bitpos */
+ complain_overflow_signed, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_SH_DIR10SW", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0xffc00, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* Used in LD.L, FLD.S et al. */
+ HOWTO (R_SH_DIR10SL, /* type */
+ 2, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 12, /* bitsize */
+ FALSE, /* pc_relative */
+ 10, /* bitpos */
+ complain_overflow_signed, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_SH_DIR10SL", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0xffc00, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* Used in FLD.D, FST.P et al. */
+ HOWTO (R_SH_DIR10SQ, /* type */
+ 3, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 13, /* bitsize */
+ FALSE, /* pc_relative */
+ 10, /* bitpos */
+ complain_overflow_signed, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_SH_DIR10SQ", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0xffc00, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+#else
+ EMPTY_HOWTO (45),
+ EMPTY_HOWTO (46),
+ EMPTY_HOWTO (47),
+ EMPTY_HOWTO (48),
+ EMPTY_HOWTO (49),
+ EMPTY_HOWTO (50),
+ EMPTY_HOWTO (51),
+#endif
+
+ EMPTY_HOWTO (52),
+
+ HOWTO (R_SH_DIR16S, /* 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_SH_DIR16S", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0xffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ EMPTY_HOWTO (54),
+ EMPTY_HOWTO (55),
+ EMPTY_HOWTO (56),
+ EMPTY_HOWTO (57),
+ EMPTY_HOWTO (58),
+ EMPTY_HOWTO (59),
+ EMPTY_HOWTO (60),
+ EMPTY_HOWTO (61),
+ EMPTY_HOWTO (62),
+ EMPTY_HOWTO (63),
+ EMPTY_HOWTO (64),
+ EMPTY_HOWTO (65),
+ EMPTY_HOWTO (66),
+ EMPTY_HOWTO (67),
+ EMPTY_HOWTO (68),
+ EMPTY_HOWTO (69),
+ EMPTY_HOWTO (70),
+ EMPTY_HOWTO (71),
+ EMPTY_HOWTO (72),
+ EMPTY_HOWTO (73),
+ EMPTY_HOWTO (74),
+ EMPTY_HOWTO (75),
+ EMPTY_HOWTO (76),
+ EMPTY_HOWTO (77),
+ EMPTY_HOWTO (78),
+ EMPTY_HOWTO (79),
+ EMPTY_HOWTO (80),
+ EMPTY_HOWTO (81),
+ EMPTY_HOWTO (82),
+ EMPTY_HOWTO (83),
+ EMPTY_HOWTO (84),
+ EMPTY_HOWTO (85),
+ EMPTY_HOWTO (86),
+ EMPTY_HOWTO (87),
+ EMPTY_HOWTO (88),
+ EMPTY_HOWTO (89),
+ EMPTY_HOWTO (90),
+ EMPTY_HOWTO (91),
+ EMPTY_HOWTO (92),
+ EMPTY_HOWTO (93),
+ EMPTY_HOWTO (94),
+ EMPTY_HOWTO (95),
+ EMPTY_HOWTO (96),
+ EMPTY_HOWTO (97),
+ EMPTY_HOWTO (98),
+ EMPTY_HOWTO (99),
+ EMPTY_HOWTO (100),
+ EMPTY_HOWTO (101),
+ EMPTY_HOWTO (102),
+ EMPTY_HOWTO (103),
+ EMPTY_HOWTO (104),
+ EMPTY_HOWTO (105),
+ EMPTY_HOWTO (106),
+ EMPTY_HOWTO (107),
+ EMPTY_HOWTO (108),
+ EMPTY_HOWTO (109),
+ EMPTY_HOWTO (110),
+ EMPTY_HOWTO (111),
+ EMPTY_HOWTO (112),
+ EMPTY_HOWTO (113),
+ EMPTY_HOWTO (114),
+ EMPTY_HOWTO (115),
+ EMPTY_HOWTO (116),
+ EMPTY_HOWTO (117),
+ EMPTY_HOWTO (118),
+ EMPTY_HOWTO (119),
+ EMPTY_HOWTO (120),
+ EMPTY_HOWTO (121),
+ EMPTY_HOWTO (122),
+ EMPTY_HOWTO (123),
+ EMPTY_HOWTO (124),
+ EMPTY_HOWTO (125),
+ EMPTY_HOWTO (126),
+ EMPTY_HOWTO (127),
+ EMPTY_HOWTO (128),
+ EMPTY_HOWTO (129),
+ EMPTY_HOWTO (130),
+ EMPTY_HOWTO (131),
+ EMPTY_HOWTO (132),
+ EMPTY_HOWTO (133),
+ EMPTY_HOWTO (134),
+ EMPTY_HOWTO (135),
+ EMPTY_HOWTO (136),
+ EMPTY_HOWTO (137),
+ EMPTY_HOWTO (138),
+ EMPTY_HOWTO (139),
+ EMPTY_HOWTO (140),
+ EMPTY_HOWTO (141),
+ EMPTY_HOWTO (142),
+ EMPTY_HOWTO (143),
+
+ HOWTO (R_SH_TLS_GD_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, /* */
+ "R_SH_TLS_GD_32", /* name */
+ SH_PARTIAL32, /* partial_inplace */
+ SH_SRC_MASK32, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ HOWTO (R_SH_TLS_LD_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, /* */
+ "R_SH_TLS_LD_32", /* name */
+ SH_PARTIAL32, /* partial_inplace */
+ SH_SRC_MASK32, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ HOWTO (R_SH_TLS_LDO_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, /* */
+ "R_SH_TLS_LDO_32", /* name */
+ SH_PARTIAL32, /* partial_inplace */
+ SH_SRC_MASK32, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ HOWTO (R_SH_TLS_IE_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, /* */
+ "R_SH_TLS_IE_32", /* name */
+ SH_PARTIAL32, /* partial_inplace */
+ SH_SRC_MASK32, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ HOWTO (R_SH_TLS_LE_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, /* */
+ "R_SH_TLS_LE_32", /* name */
+ SH_PARTIAL32, /* partial_inplace */
+ SH_SRC_MASK32, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ HOWTO (R_SH_TLS_DTPMOD32, /* 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, /* */
+ "R_SH_TLS_DTPMOD32", /* name */
+ SH_PARTIAL32, /* partial_inplace */
+ SH_SRC_MASK32, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ HOWTO (R_SH_TLS_DTPOFF32, /* 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, /* */
+ "R_SH_TLS_DTPOFF32", /* name */
+ SH_PARTIAL32, /* partial_inplace */
+ SH_SRC_MASK32, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ HOWTO (R_SH_TLS_TPOFF32, /* 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, /* */
+ "R_SH_TLS_TPOFF32", /* name */
+ SH_PARTIAL32, /* partial_inplace */
+ SH_SRC_MASK32, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ EMPTY_HOWTO (152),
+ EMPTY_HOWTO (153),
+ EMPTY_HOWTO (154),
+ EMPTY_HOWTO (155),
+ EMPTY_HOWTO (156),
+ EMPTY_HOWTO (157),
+ EMPTY_HOWTO (158),
+ EMPTY_HOWTO (159),
+
+ HOWTO (R_SH_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, /* */
+ "R_SH_GOT32", /* name */
+ SH_PARTIAL32, /* partial_inplace */
+ SH_SRC_MASK32, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ HOWTO (R_SH_PLT32, /* 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, /* */
+ "R_SH_PLT32", /* name */
+ SH_PARTIAL32, /* partial_inplace */
+ SH_SRC_MASK32, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ TRUE), /* pcrel_offset */
+
+ HOWTO (R_SH_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, /* */
+ "R_SH_COPY", /* name */
+ SH_PARTIAL32, /* partial_inplace */
+ SH_SRC_MASK32, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ HOWTO (R_SH_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, /* */
+ "R_SH_GLOB_DAT", /* name */
+ SH_PARTIAL32, /* partial_inplace */
+ SH_SRC_MASK32, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ HOWTO (R_SH_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, /* */
+ "R_SH_JMP_SLOT", /* name */
+ SH_PARTIAL32, /* partial_inplace */
+ SH_SRC_MASK32, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ HOWTO (R_SH_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, /* */
+ "R_SH_RELATIVE", /* name */
+ SH_PARTIAL32, /* partial_inplace */
+ SH_SRC_MASK32, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ HOWTO (R_SH_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, /* */
+ "R_SH_GOTOFF", /* name */
+ SH_PARTIAL32, /* partial_inplace */
+ SH_SRC_MASK32, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ HOWTO (R_SH_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, /* */
+ "R_SH_GOTPC", /* name */
+ SH_PARTIAL32, /* partial_inplace */
+ SH_SRC_MASK32, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ TRUE), /* pcrel_offset */
+
+ HOWTO (R_SH_GOTPLT32, /* 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, /* */
+ "R_SH_GOTPLT32", /* name */
+ FALSE, /* partial_inplace */
+ /* ??? Why not 0? */
+ SH_SRC_MASK32, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+#ifdef INCLUDE_SHMEDIA
+ /* Used in MOVI and SHORI (x & 65536). */
+ HOWTO (R_SH_GOT_LOW16, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 64, /* bitsize */
+ FALSE, /* pc_relative */
+ 10, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_SH_GOT_LOW16", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0x3fffc00, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* Used in MOVI and SHORI ((x >> 16) & 65536). */
+ HOWTO (R_SH_GOT_MEDLOW16, /* type */
+ 16, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 64, /* bitsize */
+ FALSE, /* pc_relative */
+ 10, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_SH_GOT_MEDLOW16", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0x3fffc00, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* Used in MOVI and SHORI ((x >> 32) & 65536). */
+ HOWTO (R_SH_GOT_MEDHI16, /* type */
+ 32, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 64, /* bitsize */
+ FALSE, /* pc_relative */
+ 10, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_SH_GOT_MEDHI16", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0x3fffc00, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* Used in MOVI and SHORI ((x >> 48) & 65536). */
+ HOWTO (R_SH_GOT_HI16, /* type */
+ 48, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 64, /* bitsize */
+ FALSE, /* pc_relative */
+ 10, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_SH_GOT_HI16", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0x3fffc00, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* Used in MOVI and SHORI (x & 65536). */
+ HOWTO (R_SH_GOTPLT_LOW16, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 64, /* bitsize */
+ FALSE, /* pc_relative */
+ 10, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_SH_GOTPLT_LOW16", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0x3fffc00, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* Used in MOVI and SHORI ((x >> 16) & 65536). */
+ HOWTO (R_SH_GOTPLT_MEDLOW16, /* type */
+ 16, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 64, /* bitsize */
+ FALSE, /* pc_relative */
+ 10, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_SH_GOTPLT_MEDLOW16", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0x3fffc00, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* Used in MOVI and SHORI ((x >> 32) & 65536). */
+ HOWTO (R_SH_GOTPLT_MEDHI16, /* type */
+ 32, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 64, /* bitsize */
+ FALSE, /* pc_relative */
+ 10, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_SH_GOTPLT_MEDHI16", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0x3fffc00, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* Used in MOVI and SHORI ((x >> 48) & 65536). */
+ HOWTO (R_SH_GOTPLT_HI16, /* type */
+ 48, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 64, /* bitsize */
+ FALSE, /* pc_relative */
+ 10, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_SH_GOTPLT_HI16", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0x3fffc00, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* Used in MOVI and SHORI (x & 65536). */
+ HOWTO (R_SH_PLT_LOW16, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 64, /* bitsize */
+ TRUE, /* pc_relative */
+ 10, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_SH_PLT_LOW16", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0x3fffc00, /* dst_mask */
+ TRUE), /* pcrel_offset */
+
+ /* Used in MOVI and SHORI ((x >> 16) & 65536). */
+ HOWTO (R_SH_PLT_MEDLOW16, /* type */
+ 16, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 64, /* bitsize */
+ TRUE, /* pc_relative */
+ 10, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_SH_PLT_MEDLOW16", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0x3fffc00, /* dst_mask */
+ TRUE), /* pcrel_offset */
+
+ /* Used in MOVI and SHORI ((x >> 32) & 65536). */
+ HOWTO (R_SH_PLT_MEDHI16, /* type */
+ 32, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 64, /* bitsize */
+ TRUE, /* pc_relative */
+ 10, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_SH_PLT_MEDHI16", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0x3fffc00, /* dst_mask */
+ TRUE), /* pcrel_offset */
+
+ /* Used in MOVI and SHORI ((x >> 48) & 65536). */
+ HOWTO (R_SH_PLT_HI16, /* type */
+ 48, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 64, /* bitsize */
+ TRUE, /* pc_relative */
+ 10, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_SH_PLT_HI16", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0x3fffc00, /* dst_mask */
+ TRUE), /* pcrel_offset */
+
+ /* Used in MOVI and SHORI (x & 65536). */
+ HOWTO (R_SH_GOTOFF_LOW16, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 64, /* bitsize */
+ FALSE, /* pc_relative */
+ 10, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_SH_GOTOFF_LOW16", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0x3fffc00, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* Used in MOVI and SHORI ((x >> 16) & 65536). */
+ HOWTO (R_SH_GOTOFF_MEDLOW16, /* type */
+ 16, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 64, /* bitsize */
+ FALSE, /* pc_relative */
+ 10, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_SH_GOTOFF_MEDLOW16", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0x3fffc00, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* Used in MOVI and SHORI ((x >> 32) & 65536). */
+ HOWTO (R_SH_GOTOFF_MEDHI16, /* type */
+ 32, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 64, /* bitsize */
+ FALSE, /* pc_relative */
+ 10, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_SH_GOTOFF_MEDHI16", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0x3fffc00, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* Used in MOVI and SHORI ((x >> 48) & 65536). */
+ HOWTO (R_SH_GOTOFF_HI16, /* type */
+ 48, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 64, /* bitsize */
+ FALSE, /* pc_relative */
+ 10, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_SH_GOTOFF_HI16", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0x3fffc00, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* Used in MOVI and SHORI (x & 65536). */
+ HOWTO (R_SH_GOTPC_LOW16, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 64, /* bitsize */
+ TRUE, /* pc_relative */
+ 10, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_SH_GOTPC_LOW16", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0x3fffc00, /* dst_mask */
+ TRUE), /* pcrel_offset */
+
+ /* Used in MOVI and SHORI ((x >> 16) & 65536). */
+ HOWTO (R_SH_GOTPC_MEDLOW16, /* type */
+ 16, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 64, /* bitsize */
+ TRUE, /* pc_relative */
+ 10, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_SH_GOTPC_MEDLOW16", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0x3fffc00, /* dst_mask */
+ TRUE), /* pcrel_offset */
+
+ /* Used in MOVI and SHORI ((x >> 32) & 65536). */
+ HOWTO (R_SH_GOTPC_MEDHI16, /* type */
+ 32, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 64, /* bitsize */
+ TRUE, /* pc_relative */
+ 10, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_SH_GOTPC_MEDHI16", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0x3fffc00, /* dst_mask */
+ TRUE), /* pcrel_offset */
+
+ /* Used in MOVI and SHORI ((x >> 48) & 65536). */
+ HOWTO (R_SH_GOTPC_HI16, /* type */
+ 48, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 64, /* bitsize */
+ TRUE, /* pc_relative */
+ 10, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_SH_GOTPC_HI16", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0x3fffc00, /* dst_mask */
+ TRUE), /* pcrel_offset */
+
+ /* Used in LD.L, FLD.S et al. */
+ HOWTO (R_SH_GOT10BY4, /* type */
+ 2, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 12, /* bitsize */
+ FALSE, /* pc_relative */
+ 10, /* bitpos */
+ complain_overflow_signed, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_SH_GOT10BY4", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0xffc00, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* Used in LD.L, FLD.S et al. */
+ HOWTO (R_SH_GOTPLT10BY4, /* type */
+ 2, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 12, /* bitsize */
+ FALSE, /* pc_relative */
+ 10, /* bitpos */
+ complain_overflow_signed, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_SH_GOTPLT10BY4", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0xffc00, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* Used in FLD.D, FST.P et al. */
+ HOWTO (R_SH_GOT10BY8, /* type */
+ 3, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 13, /* bitsize */
+ FALSE, /* pc_relative */
+ 10, /* bitpos */
+ complain_overflow_signed, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_SH_GOT10BY8", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0xffc00, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* Used in FLD.D, FST.P et al. */
+ HOWTO (R_SH_GOTPLT10BY8, /* type */
+ 3, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 13, /* bitsize */
+ FALSE, /* pc_relative */
+ 10, /* bitpos */
+ complain_overflow_signed, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_SH_GOTPLT10BY8", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0xffc00, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ HOWTO (R_SH_COPY64, /* 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_elf_generic_reloc, /* special_function */
+ "R_SH_COPY64", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ ((bfd_vma) 0) - 1, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ HOWTO (R_SH_GLOB_DAT64, /* 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_elf_generic_reloc, /* special_function */
+ "R_SH_GLOB_DAT64", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ ((bfd_vma) 0) - 1, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ HOWTO (R_SH_JMP_SLOT64, /* 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_elf_generic_reloc, /* special_function */
+ "R_SH_JMP_SLOT64", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ ((bfd_vma) 0) - 1, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ HOWTO (R_SH_RELATIVE64, /* 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_elf_generic_reloc, /* special_function */
+ "R_SH_RELATIVE64", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ ((bfd_vma) 0) - 1, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ EMPTY_HOWTO (197),
+ EMPTY_HOWTO (198),
+ EMPTY_HOWTO (199),
+ EMPTY_HOWTO (200),
+ EMPTY_HOWTO (201),
+ EMPTY_HOWTO (202),
+ EMPTY_HOWTO (203),
+ EMPTY_HOWTO (204),
+ EMPTY_HOWTO (205),
+ EMPTY_HOWTO (206),
+ EMPTY_HOWTO (207),
+ EMPTY_HOWTO (208),
+ EMPTY_HOWTO (209),
+ EMPTY_HOWTO (210),
+ EMPTY_HOWTO (211),
+ EMPTY_HOWTO (212),
+ EMPTY_HOWTO (213),
+ EMPTY_HOWTO (214),
+ EMPTY_HOWTO (215),
+ EMPTY_HOWTO (216),
+ EMPTY_HOWTO (217),
+ EMPTY_HOWTO (218),
+ EMPTY_HOWTO (219),
+ EMPTY_HOWTO (220),
+ EMPTY_HOWTO (221),
+ EMPTY_HOWTO (222),
+ EMPTY_HOWTO (223),
+ EMPTY_HOWTO (224),
+ EMPTY_HOWTO (225),
+ EMPTY_HOWTO (226),
+ EMPTY_HOWTO (227),
+ EMPTY_HOWTO (228),
+ EMPTY_HOWTO (229),
+ EMPTY_HOWTO (230),
+ EMPTY_HOWTO (231),
+ EMPTY_HOWTO (232),
+ EMPTY_HOWTO (233),
+ EMPTY_HOWTO (234),
+ EMPTY_HOWTO (235),
+ EMPTY_HOWTO (236),
+ EMPTY_HOWTO (237),
+ EMPTY_HOWTO (238),
+ EMPTY_HOWTO (239),
+ EMPTY_HOWTO (240),
+ EMPTY_HOWTO (241),
+
+ /* Relocations for SHmedia code. None of these are partial_inplace or
+ use the field being relocated (except R_SH_PT_16). */
+
+ /* The assembler will generate this reloc before a block of SHmedia
+ instructions. A section should be processed as assuming it contains
+ data, unless this reloc is seen. Note that a block of SHcompact
+ instructions are instead preceded by R_SH_CODE.
+ This is currently not implemented, but should be used for SHmedia
+ linker relaxation. */
+ HOWTO (R_SH_SHMEDIA_CODE, /* type */
+ 0, /* rightshift */
+ 1, /* size (0 = byte, 1 = short, 2 = long) */
+ 0, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_unsigned, /* complain_on_overflow */
+ sh_elf_ignore_reloc, /* special_function */
+ "R_SH_SHMEDIA_CODE", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* The assembler will generate this reloc at a PTA or PTB instruction,
+ and the linker checks the right type of target, or changes a PTA to a
+ PTB, if the original insn was PT. */
+ HOWTO (R_SH_PT_16, /* type */
+ 2, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 18, /* bitsize */
+ TRUE, /* pc_relative */
+ 10, /* bitpos */
+ complain_overflow_signed, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_SH_PT_16", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0x3fffc00, /* dst_mask */
+ TRUE), /* pcrel_offset */
+
+ /* Used in unexpanded MOVI. */
+ HOWTO (R_SH_IMMS16, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ FALSE, /* pc_relative */
+ 10, /* bitpos */
+ complain_overflow_signed, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_SH_IMMS16", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0x3fffc00, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* Used in SHORI. */
+ HOWTO (R_SH_IMMU16, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ FALSE, /* pc_relative */
+ 10, /* bitpos */
+ complain_overflow_unsigned, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_SH_IMMU16", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0x3fffc00, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* Used in MOVI and SHORI (x & 65536). */
+ HOWTO (R_SH_IMM_LOW16, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 64, /* bitsize */
+ FALSE, /* pc_relative */
+ 10, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_SH_IMM_LOW16", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0x3fffc00, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* Used in MOVI and SHORI ((x - $) & 65536). */
+ HOWTO (R_SH_IMM_LOW16_PCREL, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 64, /* bitsize */
+ TRUE, /* pc_relative */
+ 10, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_SH_IMM_LOW16_PCREL", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0x3fffc00, /* dst_mask */
+ TRUE), /* pcrel_offset */
+
+ /* Used in MOVI and SHORI ((x >> 16) & 65536). */
+ HOWTO (R_SH_IMM_MEDLOW16, /* type */
+ 16, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 64, /* bitsize */
+ FALSE, /* pc_relative */
+ 10, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_SH_IMM_MEDLOW16", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0x3fffc00, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* Used in MOVI and SHORI (((x - $) >> 16) & 65536). */
+ HOWTO (R_SH_IMM_MEDLOW16_PCREL, /* type */
+ 16, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 64, /* bitsize */
+ TRUE, /* pc_relative */
+ 10, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_SH_IMM_MEDLOW16_PCREL", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0x3fffc00, /* dst_mask */
+ TRUE), /* pcrel_offset */
+
+ /* Used in MOVI and SHORI ((x >> 32) & 65536). */
+ HOWTO (R_SH_IMM_MEDHI16, /* type */
+ 32, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 64, /* bitsize */
+ FALSE, /* pc_relative */
+ 10, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_SH_IMM_MEDHI16", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0x3fffc00, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* Used in MOVI and SHORI (((x - $) >> 32) & 65536). */
+ HOWTO (R_SH_IMM_MEDHI16_PCREL, /* type */
+ 32, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 64, /* bitsize */
+ TRUE, /* pc_relative */
+ 10, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_SH_IMM_MEDHI16_PCREL", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0x3fffc00, /* dst_mask */
+ TRUE), /* pcrel_offset */
+
+ /* Used in MOVI and SHORI ((x >> 48) & 65536). */
+ HOWTO (R_SH_IMM_HI16, /* type */
+ 48, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 64, /* bitsize */
+ FALSE, /* pc_relative */
+ 10, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_SH_IMM_HI16", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0x3fffc00, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* Used in MOVI and SHORI (((x - $) >> 48) & 65536). */
+ HOWTO (R_SH_IMM_HI16_PCREL, /* type */
+ 48, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 64, /* bitsize */
+ TRUE, /* pc_relative */
+ 10, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_SH_IMM_HI16_PCREL", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0x3fffc00, /* dst_mask */
+ TRUE), /* pcrel_offset */
+
+ /* For the .uaquad pseudo. */
+ HOWTO (R_SH_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_elf_generic_reloc, /* special_function */
+ "R_SH_64", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ ((bfd_vma) 0) - 1, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* For the .uaquad pseudo, (x - $). */
+ HOWTO (R_SH_64_PCREL, /* type */
+ 48, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 64, /* bitsize */
+ TRUE, /* pc_relative */
+ 10, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_SH_64_PCREL", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ ((bfd_vma) 0) - 1, /* dst_mask */
+ TRUE), /* pcrel_offset */
+
+#endif
+#undef SH_PARTIAL32
+#undef SH_SRC_MASK32
+#undef SH_ELF_RELOC
diff --git a/contrib/binutils/bfd/elf32-sparc.c b/contrib/binutils/bfd/elf32-sparc.c
index 0f94f5f..f8a3bff 100644
--- a/contrib/binutils/bfd/elf32-sparc.c
+++ b/contrib/binutils/bfd/elf32-sparc.c
@@ -1,6 +1,6 @@
/* SPARC-specific support for 32-bit ELF
Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
- 2003, 2004 Free Software Foundation, Inc.
+ 2003, 2004, 2005, 2007 Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@@ -16,492 +16,18 @@
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. */
+ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "bfdlink.h"
#include "libbfd.h"
#include "elf-bfd.h"
#include "elf/sparc.h"
#include "opcode/sparc.h"
+#include "elfxx-sparc.h"
+#include "elf-vxworks.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
@@ -530,2766 +56,6 @@ elf32_sparc_grok_psinfo (bfd *abfd, Elf_Internal_Note *note)
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
@@ -3301,11 +67,10 @@ elf32_sparc_finish_dynamic_sections (output_bfd, info)
object file when linking. */
static bfd_boolean
-elf32_sparc_merge_private_bfd_data (ibfd, obfd)
- bfd *ibfd;
- bfd *obfd;
+elf32_sparc_merge_private_bfd_data (bfd *ibfd, bfd *obfd)
{
bfd_boolean error;
+ unsigned long ibfd_mach;
/* FIXME: This should not be static. */
static unsigned long previous_ibfd_e_flags = (unsigned long) -1;
@@ -3315,17 +80,17 @@ elf32_sparc_merge_private_bfd_data (ibfd, obfd)
error = FALSE;
- if (bfd_get_mach (ibfd) >= bfd_mach_sparc_v9)
+ ibfd_mach = bfd_get_mach (ibfd);
+ if (bfd_mach_sparc_64bit_p (ibfd_mach))
{
error = TRUE;
(*_bfd_error_handler)
- (_("%s: compiled for a 64 bit system and target is 32 bit"),
- bfd_archive_filename (ibfd));
+ (_("%B: compiled for a 64 bit system and target is 32 bit"), 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 (bfd_get_mach (obfd) < ibfd_mach)
+ bfd_set_arch_mach (obfd, bfd_arch_sparc, ibfd_mach);
}
if (((elf_elfheader (ibfd)->e_flags & EF_SPARC_LEDATA)
@@ -3333,8 +98,7 @@ elf32_sparc_merge_private_bfd_data (ibfd, obfd)
&& previous_ibfd_e_flags != (unsigned long) -1)
{
(*_bfd_error_handler)
- (_("%s: linking little endian files with big endian files"),
- bfd_archive_filename (ibfd));
+ (_("%B: linking little endian files with big endian files"), ibfd);
error = TRUE;
}
previous_ibfd_e_flags = elf_elfheader (ibfd)->e_flags & EF_SPARC_LEDATA;
@@ -3347,45 +111,19 @@ elf32_sparc_merge_private_bfd_data (ibfd, obfd)
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;
+elf32_sparc_final_write_processing (bfd *abfd,
+ bfd_boolean linker ATTRIBUTE_UNUSED)
{
switch (bfd_get_mach (abfd))
{
case bfd_mach_sparc :
+ case bfd_mach_sparc_sparclet :
+ case bfd_mach_sparc_sparclite :
break; /* nothing to do */
case bfd_mach_sparc_v8plus :
elf_elfheader (abfd)->e_machine = EM_SPARC32PLUS;
@@ -3404,7 +142,6 @@ elf32_sparc_final_write_processing (abfd, linker)
| 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 :
@@ -3414,8 +151,7 @@ elf32_sparc_final_write_processing (abfd, linker)
}
static enum elf_reloc_type_class
-elf32_sparc_reloc_type_class (rela)
- const Elf_Internal_Rela *rela;
+elf32_sparc_reloc_type_class (const Elf_Internal_Rela *rela)
{
switch ((int) ELF32_R_TYPE (rela->r_info))
{
@@ -3429,44 +165,51 @@ elf32_sparc_reloc_type_class (rela)
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 ELF_COMMONPAGESIZE 0x2000
+
+#define bfd_elf32_bfd_merge_private_bfd_data \
+ elf32_sparc_merge_private_bfd_data
+#define elf_backend_final_write_processing \
+ elf32_sparc_final_write_processing
+#define elf_backend_grok_psinfo elf32_sparc_grok_psinfo
+#define elf_backend_reloc_type_class elf32_sparc_reloc_type_class
-#define bfd_elf32_bfd_reloc_type_lookup elf32_sparc_reloc_type_lookup
+#define elf_info_to_howto _bfd_sparc_elf_info_to_howto
+#define bfd_elf32_bfd_reloc_type_lookup _bfd_sparc_elf_reloc_type_lookup
+#define bfd_elf32_bfd_reloc_name_lookup \
+ _bfd_sparc_elf_reloc_name_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
+ _bfd_sparc_elf_link_hash_table_create
+#define bfd_elf32_bfd_relax_section _bfd_sparc_elf_relax_section
+#define bfd_elf32_new_section_hook _bfd_sparc_elf_new_section_hook
#define elf_backend_copy_indirect_symbol \
- elf32_sparc_copy_indirect_symbol
+ _bfd_sparc_elf_copy_indirect_symbol
#define elf_backend_create_dynamic_sections \
- elf32_sparc_create_dynamic_sections
-#define elf_backend_check_relocs elf32_sparc_check_relocs
+ _bfd_sparc_elf_create_dynamic_sections
+#define elf_backend_check_relocs _bfd_sparc_elf_check_relocs
#define elf_backend_adjust_dynamic_symbol \
- elf32_sparc_adjust_dynamic_symbol
+ _bfd_sparc_elf_adjust_dynamic_symbol
+#define elf_backend_omit_section_dynsym _bfd_sparc_elf_omit_section_dynsym
#define elf_backend_size_dynamic_sections \
- elf32_sparc_size_dynamic_sections
-#define elf_backend_relocate_section elf32_sparc_relocate_section
+ _bfd_sparc_elf_size_dynamic_sections
+#define elf_backend_relocate_section _bfd_sparc_elf_relocate_section
#define elf_backend_finish_dynamic_symbol \
- elf32_sparc_finish_dynamic_symbol
+ _bfd_sparc_elf_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
+ _bfd_sparc_elf_finish_dynamic_sections
+#define bfd_elf32_mkobject _bfd_sparc_elf_mkobject
+#define elf_backend_object_p _bfd_sparc_elf_object_p
+#define elf_backend_gc_mark_hook _bfd_sparc_elf_gc_mark_hook
+#define elf_backend_gc_sweep_hook _bfd_sparc_elf_gc_sweep_hook
+#define elf_backend_plt_sym_val _bfd_sparc_elf_plt_sym_val
+#define elf_backend_init_index_section _bfd_elf_init_1_index_section
#define elf_backend_can_gc_sections 1
#define elf_backend_can_refcount 1
@@ -3477,3 +220,68 @@ elf32_sparc_reloc_type_class (rela)
#define elf_backend_rela_normal 1
#include "elf32-target.h"
+
+/* A wrapper around _bfd_sparc_elf_link_hash_table_create that identifies
+ the target system as VxWorks. */
+
+static struct bfd_link_hash_table *
+elf32_sparc_vxworks_link_hash_table_create (bfd *abfd)
+{
+ struct bfd_link_hash_table *ret;
+
+ ret = _bfd_sparc_elf_link_hash_table_create (abfd);
+ if (ret)
+ {
+ struct _bfd_sparc_elf_link_hash_table *htab;
+
+ htab = (struct _bfd_sparc_elf_link_hash_table *) ret;
+ htab->is_vxworks = 1;
+ }
+ return ret;
+}
+
+/* A final_write_processing hook that does both the SPARC- and VxWorks-
+ specific handling. */
+
+static void
+elf32_sparc_vxworks_final_write_processing (bfd *abfd, bfd_boolean linker)
+{
+ elf32_sparc_final_write_processing (abfd, linker);
+ elf_vxworks_final_write_processing (abfd, linker);
+}
+
+#undef TARGET_BIG_SYM
+#define TARGET_BIG_SYM bfd_elf32_sparc_vxworks_vec
+#undef TARGET_BIG_NAME
+#define TARGET_BIG_NAME "elf32-sparc-vxworks"
+
+#undef ELF_MINPAGESIZE
+#define ELF_MINPAGESIZE 0x1000
+
+#undef bfd_elf32_bfd_link_hash_table_create
+#define bfd_elf32_bfd_link_hash_table_create \
+ elf32_sparc_vxworks_link_hash_table_create
+
+#undef elf_backend_want_got_plt
+#define elf_backend_want_got_plt 1
+#undef elf_backend_plt_readonly
+#define elf_backend_plt_readonly 1
+#undef elf_backend_got_header_size
+#define elf_backend_got_header_size 12
+#undef elf_backend_add_symbol_hook
+#define elf_backend_add_symbol_hook \
+ elf_vxworks_add_symbol_hook
+#undef elf_backend_link_output_symbol_hook
+#define elf_backend_link_output_symbol_hook \
+ elf_vxworks_link_output_symbol_hook
+#undef elf_backend_emit_relocs
+#define elf_backend_emit_relocs \
+ elf_vxworks_emit_relocs
+#undef elf_backend_final_write_processing
+#define elf_backend_final_write_processing \
+ elf32_sparc_vxworks_final_write_processing
+
+#undef elf32_bed
+#define elf32_bed sparc_elf_vxworks_bed
+
+#include "elf32-target.h"
diff --git a/contrib/binutils/bfd/elf32-spu.c b/contrib/binutils/bfd/elf32-spu.c
new file mode 100644
index 0000000..d652117
--- /dev/null
+++ b/contrib/binutils/bfd/elf32-spu.c
@@ -0,0 +1,3154 @@
+/* SPU specific support for 32-bit ELF
+
+ Copyright 2006, 2007 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.,
+ 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include "sysdep.h"
+#include "bfd.h"
+#include "bfdlink.h"
+#include "libbfd.h"
+#include "elf-bfd.h"
+#include "elf/spu.h"
+#include "elf32-spu.h"
+
+/* We use RELA style relocs. Don't define USE_REL. */
+
+static bfd_reloc_status_type spu_elf_rel9 (bfd *, arelent *, asymbol *,
+ void *, asection *,
+ bfd *, char **);
+
+/* Values of type 'enum elf_spu_reloc_type' are used to index this
+ array, so it must be declared in the order of that type. */
+
+static reloc_howto_type elf_howto_table[] = {
+ HOWTO (R_SPU_NONE, 0, 0, 0, FALSE, 0, complain_overflow_dont,
+ bfd_elf_generic_reloc, "SPU_NONE",
+ FALSE, 0, 0x00000000, FALSE),
+ HOWTO (R_SPU_ADDR10, 4, 2, 10, FALSE, 14, complain_overflow_bitfield,
+ bfd_elf_generic_reloc, "SPU_ADDR10",
+ FALSE, 0, 0x00ffc000, FALSE),
+ HOWTO (R_SPU_ADDR16, 2, 2, 16, FALSE, 7, complain_overflow_bitfield,
+ bfd_elf_generic_reloc, "SPU_ADDR16",
+ FALSE, 0, 0x007fff80, FALSE),
+ HOWTO (R_SPU_ADDR16_HI, 16, 2, 16, FALSE, 7, complain_overflow_bitfield,
+ bfd_elf_generic_reloc, "SPU_ADDR16_HI",
+ FALSE, 0, 0x007fff80, FALSE),
+ HOWTO (R_SPU_ADDR16_LO, 0, 2, 16, FALSE, 7, complain_overflow_dont,
+ bfd_elf_generic_reloc, "SPU_ADDR16_LO",
+ FALSE, 0, 0x007fff80, FALSE),
+ HOWTO (R_SPU_ADDR18, 0, 2, 18, FALSE, 7, complain_overflow_bitfield,
+ bfd_elf_generic_reloc, "SPU_ADDR18",
+ FALSE, 0, 0x01ffff80, FALSE),
+ HOWTO (R_SPU_ADDR32, 0, 2, 32, FALSE, 0, complain_overflow_dont,
+ bfd_elf_generic_reloc, "SPU_ADDR32",
+ FALSE, 0, 0xffffffff, FALSE),
+ HOWTO (R_SPU_REL16, 2, 2, 16, TRUE, 7, complain_overflow_bitfield,
+ bfd_elf_generic_reloc, "SPU_REL16",
+ FALSE, 0, 0x007fff80, TRUE),
+ HOWTO (R_SPU_ADDR7, 0, 2, 7, FALSE, 14, complain_overflow_dont,
+ bfd_elf_generic_reloc, "SPU_ADDR7",
+ FALSE, 0, 0x001fc000, FALSE),
+ HOWTO (R_SPU_REL9, 2, 2, 9, TRUE, 0, complain_overflow_signed,
+ spu_elf_rel9, "SPU_REL9",
+ FALSE, 0, 0x0180007f, TRUE),
+ HOWTO (R_SPU_REL9I, 2, 2, 9, TRUE, 0, complain_overflow_signed,
+ spu_elf_rel9, "SPU_REL9I",
+ FALSE, 0, 0x0000c07f, TRUE),
+ HOWTO (R_SPU_ADDR10I, 0, 2, 10, FALSE, 14, complain_overflow_signed,
+ bfd_elf_generic_reloc, "SPU_ADDR10I",
+ FALSE, 0, 0x00ffc000, FALSE),
+ HOWTO (R_SPU_ADDR16I, 0, 2, 16, FALSE, 7, complain_overflow_signed,
+ bfd_elf_generic_reloc, "SPU_ADDR16I",
+ FALSE, 0, 0x007fff80, FALSE),
+ HOWTO (R_SPU_REL32, 0, 2, 32, TRUE, 0, complain_overflow_dont,
+ bfd_elf_generic_reloc, "SPU_REL32",
+ FALSE, 0, 0xffffffff, TRUE),
+ HOWTO (R_SPU_ADDR16X, 0, 2, 16, FALSE, 7, complain_overflow_bitfield,
+ bfd_elf_generic_reloc, "SPU_ADDR16X",
+ FALSE, 0, 0x007fff80, FALSE),
+ HOWTO (R_SPU_PPU32, 0, 2, 32, FALSE, 0, complain_overflow_dont,
+ bfd_elf_generic_reloc, "SPU_PPU32",
+ FALSE, 0, 0xffffffff, FALSE),
+ HOWTO (R_SPU_PPU64, 0, 4, 64, FALSE, 0, complain_overflow_dont,
+ bfd_elf_generic_reloc, "SPU_PPU64",
+ FALSE, 0, -1, FALSE),
+};
+
+static struct bfd_elf_special_section const spu_elf_special_sections[] = {
+ { ".toe", 4, 0, SHT_NOBITS, SHF_ALLOC },
+ { NULL, 0, 0, 0, 0 }
+};
+
+static enum elf_spu_reloc_type
+spu_elf_bfd_to_reloc_type (bfd_reloc_code_real_type code)
+{
+ switch (code)
+ {
+ default:
+ return R_SPU_NONE;
+ case BFD_RELOC_SPU_IMM10W:
+ return R_SPU_ADDR10;
+ case BFD_RELOC_SPU_IMM16W:
+ return R_SPU_ADDR16;
+ case BFD_RELOC_SPU_LO16:
+ return R_SPU_ADDR16_LO;
+ case BFD_RELOC_SPU_HI16:
+ return R_SPU_ADDR16_HI;
+ case BFD_RELOC_SPU_IMM18:
+ return R_SPU_ADDR18;
+ case BFD_RELOC_SPU_PCREL16:
+ return R_SPU_REL16;
+ case BFD_RELOC_SPU_IMM7:
+ return R_SPU_ADDR7;
+ case BFD_RELOC_SPU_IMM8:
+ return R_SPU_NONE;
+ case BFD_RELOC_SPU_PCREL9a:
+ return R_SPU_REL9;
+ case BFD_RELOC_SPU_PCREL9b:
+ return R_SPU_REL9I;
+ case BFD_RELOC_SPU_IMM10:
+ return R_SPU_ADDR10I;
+ case BFD_RELOC_SPU_IMM16:
+ return R_SPU_ADDR16I;
+ case BFD_RELOC_32:
+ return R_SPU_ADDR32;
+ case BFD_RELOC_32_PCREL:
+ return R_SPU_REL32;
+ case BFD_RELOC_SPU_PPU32:
+ return R_SPU_PPU32;
+ case BFD_RELOC_SPU_PPU64:
+ return R_SPU_PPU64;
+ }
+}
+
+static void
+spu_elf_info_to_howto (bfd *abfd ATTRIBUTE_UNUSED,
+ arelent *cache_ptr,
+ Elf_Internal_Rela *dst)
+{
+ enum elf_spu_reloc_type r_type;
+
+ r_type = (enum elf_spu_reloc_type) ELF32_R_TYPE (dst->r_info);
+ BFD_ASSERT (r_type < R_SPU_max);
+ cache_ptr->howto = &elf_howto_table[(int) r_type];
+}
+
+static reloc_howto_type *
+spu_elf_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED,
+ bfd_reloc_code_real_type code)
+{
+ enum elf_spu_reloc_type r_type = spu_elf_bfd_to_reloc_type (code);
+
+ if (r_type == R_SPU_NONE)
+ return NULL;
+
+ return elf_howto_table + r_type;
+}
+
+static reloc_howto_type *
+spu_elf_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED,
+ const char *r_name)
+{
+ unsigned int i;
+
+ for (i = 0; i < sizeof (elf_howto_table) / sizeof (elf_howto_table[0]); i++)
+ if (elf_howto_table[i].name != NULL
+ && strcasecmp (elf_howto_table[i].name, r_name) == 0)
+ return &elf_howto_table[i];
+
+ return NULL;
+}
+
+/* Apply R_SPU_REL9 and R_SPU_REL9I relocs. */
+
+static bfd_reloc_status_type
+spu_elf_rel9 (bfd *abfd, arelent *reloc_entry, asymbol *symbol,
+ void *data, asection *input_section,
+ bfd *output_bfd, char **error_message)
+{
+ bfd_size_type octets;
+ bfd_vma val;
+ long insn;
+
+ /* 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 (reloc_entry->address > bfd_get_section_limit (abfd, input_section))
+ return bfd_reloc_outofrange;
+ octets = reloc_entry->address * bfd_octets_per_byte (abfd);
+
+ /* Get symbol value. */
+ val = 0;
+ if (!bfd_is_com_section (symbol->section))
+ val = symbol->value;
+ if (symbol->section->output_section)
+ val += symbol->section->output_section->vma;
+
+ val += reloc_entry->addend;
+
+ /* Make it pc-relative. */
+ val -= input_section->output_section->vma + input_section->output_offset;
+
+ val >>= 2;
+ if (val + 256 >= 512)
+ return bfd_reloc_overflow;
+
+ insn = bfd_get_32 (abfd, (bfd_byte *) data + octets);
+
+ /* Move two high bits of value to REL9I and REL9 position.
+ The mask will take care of selecting the right field. */
+ val = (val & 0x7f) | ((val & 0x180) << 7) | ((val & 0x180) << 16);
+ insn &= ~reloc_entry->howto->dst_mask;
+ insn |= val & reloc_entry->howto->dst_mask;
+ bfd_put_32 (abfd, insn, (bfd_byte *) data + octets);
+ return bfd_reloc_ok;
+}
+
+static bfd_boolean
+spu_elf_new_section_hook (bfd *abfd, asection *sec)
+{
+ if (!sec->used_by_bfd)
+ {
+ struct _spu_elf_section_data *sdata;
+
+ sdata = bfd_zalloc (abfd, sizeof (*sdata));
+ if (sdata == NULL)
+ return FALSE;
+ sec->used_by_bfd = sdata;
+ }
+
+ return _bfd_elf_new_section_hook (abfd, sec);
+}
+
+/* Specially mark defined symbols named _EAR_* with BSF_KEEP so that
+ strip --strip-unneeded will not remove them. */
+
+static void
+spu_elf_backend_symbol_processing (bfd *abfd ATTRIBUTE_UNUSED, asymbol *sym)
+{
+ if (sym->name != NULL
+ && sym->section != bfd_abs_section_ptr
+ && strncmp (sym->name, "_EAR_", 5) == 0)
+ sym->flags |= BSF_KEEP;
+}
+
+/* SPU ELF linker hash table. */
+
+struct spu_link_hash_table
+{
+ struct elf_link_hash_table elf;
+
+ /* The stub hash table. */
+ struct bfd_hash_table stub_hash_table;
+
+ /* Shortcuts to overlay sections. */
+ asection *stub;
+ asection *ovtab;
+
+ struct elf_link_hash_entry *ovly_load;
+
+ /* An array of two output sections per overlay region, chosen such that
+ the first section vma is the overlay buffer vma (ie. the section has
+ the lowest vma in the group that occupy the region), and the second
+ section vma+size specifies the end of the region. We keep pointers
+ to sections like this because section vmas may change when laying
+ them out. */
+ asection **ovl_region;
+
+ /* Number of overlay buffers. */
+ unsigned int num_buf;
+
+ /* Total number of overlays. */
+ unsigned int num_overlays;
+
+ /* Set if we should emit symbols for stubs. */
+ unsigned int emit_stub_syms:1;
+
+ /* Set if we want stubs on calls out of overlay regions to
+ non-overlay regions. */
+ unsigned int non_overlay_stubs : 1;
+
+ /* Set on error. */
+ unsigned int stub_overflow : 1;
+
+ /* Set if stack size analysis should be done. */
+ unsigned int stack_analysis : 1;
+
+ /* Set if __stack_* syms will be emitted. */
+ unsigned int emit_stack_syms : 1;
+};
+
+#define spu_hash_table(p) \
+ ((struct spu_link_hash_table *) ((p)->hash))
+
+struct spu_stub_hash_entry
+{
+ struct bfd_hash_entry root;
+
+ /* Destination of this stub. */
+ asection *target_section;
+ bfd_vma target_off;
+
+ /* Offset of entry in stub section. */
+ bfd_vma off;
+
+ /* Offset from this stub to stub that loads the overlay index. */
+ bfd_vma delta;
+};
+
+/* Create an entry in a spu 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 spu_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 spu_stub_hash_entry *sh = (struct spu_stub_hash_entry *) entry;
+
+ sh->target_section = NULL;
+ sh->target_off = 0;
+ sh->off = 0;
+ sh->delta = 0;
+ }
+
+ return entry;
+}
+
+/* Create a spu ELF linker hash table. */
+
+static struct bfd_link_hash_table *
+spu_elf_link_hash_table_create (bfd *abfd)
+{
+ struct spu_link_hash_table *htab;
+
+ htab = bfd_malloc (sizeof (*htab));
+ if (htab == NULL)
+ return NULL;
+
+ if (!_bfd_elf_link_hash_table_init (&htab->elf, abfd,
+ _bfd_elf_link_hash_newfunc,
+ sizeof (struct elf_link_hash_entry)))
+ {
+ free (htab);
+ return NULL;
+ }
+
+ /* Init the stub hash table too. */
+ if (!bfd_hash_table_init (&htab->stub_hash_table, stub_hash_newfunc,
+ sizeof (struct spu_stub_hash_entry)))
+ return NULL;
+
+ memset (&htab->stub, 0,
+ sizeof (*htab) - offsetof (struct spu_link_hash_table, stub));
+
+ return &htab->elf.root;
+}
+
+/* Free the derived linker hash table. */
+
+static void
+spu_elf_link_hash_table_free (struct bfd_link_hash_table *hash)
+{
+ struct spu_link_hash_table *ret = (struct spu_link_hash_table *) hash;
+
+ bfd_hash_table_free (&ret->stub_hash_table);
+ _bfd_generic_link_hash_table_free (hash);
+}
+
+/* Find the symbol for the given R_SYMNDX in IBFD and set *HP and *SYMP
+ to (hash, NULL) for global symbols, and (NULL, sym) for locals. Set
+ *SYMSECP to the symbol's section. *LOCSYMSP caches local syms. */
+
+static bfd_boolean
+get_sym_h (struct elf_link_hash_entry **hp,
+ Elf_Internal_Sym **symp,
+ asection **symsecp,
+ 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;
+ }
+ }
+ else
+ {
+ Elf_Internal_Sym *sym;
+ Elf_Internal_Sym *locsyms = *locsymsp;
+
+ if (locsyms == NULL)
+ {
+ locsyms = (Elf_Internal_Sym *) symtab_hdr->contents;
+ if (locsyms == NULL)
+ {
+ size_t symcount = symtab_hdr->sh_info;
+
+ /* If we are reading symbols into the contents, then
+ read the global syms too. This is done to cache
+ syms for later stack analysis. */
+ if ((unsigned char **) locsymsp == &symtab_hdr->contents)
+ symcount = symtab_hdr->sh_size / symtab_hdr->sh_entsize;
+ locsyms = bfd_elf_get_elf_syms (ibfd, symtab_hdr, symcount, 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;
+ }
+ }
+
+ return TRUE;
+}
+
+/* Build a name for an entry in the stub hash table. We can't use a
+ local symbol name because ld -r might generate duplicate local symbols. */
+
+static char *
+spu_stub_name (const asection *sym_sec,
+ const struct elf_link_hash_entry *h,
+ const Elf_Internal_Rela *rel)
+{
+ char *stub_name;
+ bfd_size_type len;
+
+ if (h)
+ {
+ len = strlen (h->root.root.string) + 1 + 8 + 1;
+ stub_name = bfd_malloc (len);
+ if (stub_name == NULL)
+ return stub_name;
+
+ sprintf (stub_name, "%s+%x",
+ h->root.root.string,
+ (int) rel->r_addend & 0xffffffff);
+ len -= 8;
+ }
+ else
+ {
+ len = 8 + 1 + 8 + 1 + 8 + 1;
+ stub_name = bfd_malloc (len);
+ if (stub_name == NULL)
+ return stub_name;
+
+ sprintf (stub_name, "%x:%x+%x",
+ sym_sec->id & 0xffffffff,
+ (int) ELF32_R_SYM (rel->r_info) & 0xffffffff,
+ (int) rel->r_addend & 0xffffffff);
+ len = strlen (stub_name);
+ }
+
+ if (stub_name[len - 2] == '+'
+ && stub_name[len - 1] == '0'
+ && stub_name[len] == 0)
+ stub_name[len - 2] = 0;
+
+ return stub_name;
+}
+
+/* Create the note section if not already present. This is done early so
+ that the linker maps the sections to the right place in the output. */
+
+bfd_boolean
+spu_elf_create_sections (bfd *output_bfd,
+ struct bfd_link_info *info,
+ int stack_analysis,
+ int emit_stack_syms)
+{
+ bfd *ibfd;
+ struct spu_link_hash_table *htab = spu_hash_table (info);
+
+ /* Stash some options away where we can get at them later. */
+ htab->stack_analysis = stack_analysis;
+ htab->emit_stack_syms = emit_stack_syms;
+
+ for (ibfd = info->input_bfds; ibfd != NULL; ibfd = ibfd->link_next)
+ if (bfd_get_section_by_name (ibfd, SPU_PTNOTE_SPUNAME) != NULL)
+ break;
+
+ if (ibfd == NULL)
+ {
+ /* Make SPU_PTNOTE_SPUNAME section. */
+ asection *s;
+ size_t name_len;
+ size_t size;
+ bfd_byte *data;
+ flagword flags;
+
+ ibfd = info->input_bfds;
+ flags = SEC_LOAD | SEC_READONLY | SEC_HAS_CONTENTS | SEC_IN_MEMORY;
+ s = bfd_make_section_anyway_with_flags (ibfd, SPU_PTNOTE_SPUNAME, flags);
+ if (s == NULL
+ || !bfd_set_section_alignment (ibfd, s, 4))
+ return FALSE;
+
+ name_len = strlen (bfd_get_filename (output_bfd)) + 1;
+ size = 12 + ((sizeof (SPU_PLUGIN_NAME) + 3) & -4);
+ size += (name_len + 3) & -4;
+
+ if (!bfd_set_section_size (ibfd, s, size))
+ return FALSE;
+
+ data = bfd_zalloc (ibfd, size);
+ if (data == NULL)
+ return FALSE;
+
+ bfd_put_32 (ibfd, sizeof (SPU_PLUGIN_NAME), data + 0);
+ bfd_put_32 (ibfd, name_len, data + 4);
+ bfd_put_32 (ibfd, 1, data + 8);
+ memcpy (data + 12, SPU_PLUGIN_NAME, sizeof (SPU_PLUGIN_NAME));
+ memcpy (data + 12 + ((sizeof (SPU_PLUGIN_NAME) + 3) & -4),
+ bfd_get_filename (output_bfd), name_len);
+ s->contents = data;
+ }
+
+ return TRUE;
+}
+
+/* qsort predicate to sort sections by vma. */
+
+static int
+sort_sections (const void *a, const void *b)
+{
+ const asection *const *s1 = a;
+ const asection *const *s2 = b;
+ bfd_signed_vma delta = (*s1)->vma - (*s2)->vma;
+
+ if (delta != 0)
+ return delta < 0 ? -1 : 1;
+
+ return (*s1)->index - (*s2)->index;
+}
+
+/* Identify overlays in the output bfd, and number them. */
+
+bfd_boolean
+spu_elf_find_overlays (bfd *output_bfd, struct bfd_link_info *info)
+{
+ struct spu_link_hash_table *htab = spu_hash_table (info);
+ asection **alloc_sec;
+ unsigned int i, n, ovl_index, num_buf;
+ asection *s;
+ bfd_vma ovl_end;
+
+ if (output_bfd->section_count < 2)
+ return FALSE;
+
+ alloc_sec = bfd_malloc (output_bfd->section_count * sizeof (*alloc_sec));
+ if (alloc_sec == NULL)
+ return FALSE;
+
+ /* Pick out all the alloced sections. */
+ for (n = 0, s = output_bfd->sections; s != NULL; s = s->next)
+ if ((s->flags & SEC_ALLOC) != 0
+ && (s->flags & (SEC_LOAD | SEC_THREAD_LOCAL)) != SEC_THREAD_LOCAL
+ && s->size != 0)
+ alloc_sec[n++] = s;
+
+ if (n == 0)
+ {
+ free (alloc_sec);
+ return FALSE;
+ }
+
+ /* Sort them by vma. */
+ qsort (alloc_sec, n, sizeof (*alloc_sec), sort_sections);
+
+ /* Look for overlapping vmas. Any with overlap must be overlays.
+ Count them. Also count the number of overlay regions and for
+ each region save a section from that region with the lowest vma
+ and another section with the highest end vma. */
+ ovl_end = alloc_sec[0]->vma + alloc_sec[0]->size;
+ for (ovl_index = 0, num_buf = 0, i = 1; i < n; i++)
+ {
+ s = alloc_sec[i];
+ if (s->vma < ovl_end)
+ {
+ asection *s0 = alloc_sec[i - 1];
+
+ if (spu_elf_section_data (s0)->ovl_index == 0)
+ {
+ spu_elf_section_data (s0)->ovl_index = ++ovl_index;
+ alloc_sec[num_buf * 2] = s0;
+ alloc_sec[num_buf * 2 + 1] = s0;
+ num_buf++;
+ }
+ spu_elf_section_data (s)->ovl_index = ++ovl_index;
+ if (ovl_end < s->vma + s->size)
+ {
+ ovl_end = s->vma + s->size;
+ alloc_sec[num_buf * 2 - 1] = s;
+ }
+ }
+ else
+ ovl_end = s->vma + s->size;
+ }
+
+ htab->num_overlays = ovl_index;
+ htab->num_buf = num_buf;
+ if (ovl_index == 0)
+ {
+ free (alloc_sec);
+ return FALSE;
+ }
+
+ alloc_sec = bfd_realloc (alloc_sec, num_buf * 2 * sizeof (*alloc_sec));
+ if (alloc_sec == NULL)
+ return FALSE;
+
+ htab->ovl_region = alloc_sec;
+ return TRUE;
+}
+
+/* One of these per stub. */
+#define SIZEOF_STUB1 8
+#define ILA_79 0x4200004f /* ila $79,function_address */
+#define BR 0x32000000 /* br stub2 */
+
+/* One of these per overlay. */
+#define SIZEOF_STUB2 8
+#define ILA_78 0x4200004e /* ila $78,overlay_number */
+ /* br __ovly_load */
+#define NOP 0x40200000
+
+/* Return true for all relative and absolute branch instructions.
+ bra 00110000 0..
+ brasl 00110001 0..
+ br 00110010 0..
+ brsl 00110011 0..
+ brz 00100000 0..
+ brnz 00100001 0..
+ brhz 00100010 0..
+ brhnz 00100011 0.. */
+
+static bfd_boolean
+is_branch (const unsigned char *insn)
+{
+ return (insn[0] & 0xec) == 0x20 && (insn[1] & 0x80) == 0;
+}
+
+/* Return true for branch hint instructions.
+ hbra 0001000..
+ hbrr 0001001.. */
+
+static bfd_boolean
+is_hint (const unsigned char *insn)
+{
+ return (insn[0] & 0xfc) == 0x10;
+}
+
+/* Return TRUE if this reloc symbol should possibly go via an overlay stub. */
+
+static bfd_boolean
+needs_ovl_stub (const char *sym_name,
+ asection *sym_sec,
+ asection *input_section,
+ struct spu_link_hash_table *htab,
+ bfd_boolean is_branch)
+{
+ if (htab->num_overlays == 0)
+ return FALSE;
+
+ if (sym_sec == NULL
+ || sym_sec->output_section == NULL
+ || spu_elf_section_data (sym_sec->output_section) == NULL)
+ return FALSE;
+
+ /* setjmp always goes via an overlay stub, because then the return
+ and hence the longjmp goes via __ovly_return. That magically
+ makes setjmp/longjmp between overlays work. */
+ if (strncmp (sym_name, "setjmp", 6) == 0
+ && (sym_name[6] == '\0' || sym_name[6] == '@'))
+ return TRUE;
+
+ /* Usually, symbols in non-overlay sections don't need stubs. */
+ if (spu_elf_section_data (sym_sec->output_section)->ovl_index == 0
+ && !htab->non_overlay_stubs)
+ return FALSE;
+
+ /* A reference from some other section to a symbol in an overlay
+ section needs a stub. */
+ if (spu_elf_section_data (sym_sec->output_section)->ovl_index
+ != spu_elf_section_data (input_section->output_section)->ovl_index)
+ return TRUE;
+
+ /* If this insn isn't a branch then we are possibly taking the
+ address of a function and passing it out somehow. */
+ return !is_branch;
+}
+
+struct stubarr {
+ struct bfd_hash_table *stub_hash_table;
+ struct spu_stub_hash_entry **sh;
+ unsigned int count;
+ int err;
+};
+
+/* Called via elf_link_hash_traverse to allocate stubs for any _SPUEAR_
+ symbols. */
+
+static bfd_boolean
+allocate_spuear_stubs (struct elf_link_hash_entry *h, void *inf)
+{
+ /* Symbols starting with _SPUEAR_ need a stub because they may be
+ invoked by the PPU. */
+ if ((h->root.type == bfd_link_hash_defined
+ || h->root.type == bfd_link_hash_defweak)
+ && h->def_regular
+ && strncmp (h->root.root.string, "_SPUEAR_", 8) == 0)
+ {
+ struct stubarr *stubs = inf;
+ static Elf_Internal_Rela zero_rel;
+ char *stub_name = spu_stub_name (h->root.u.def.section, h, &zero_rel);
+ struct spu_stub_hash_entry *sh;
+
+ if (stub_name == NULL)
+ {
+ stubs->err = 1;
+ return FALSE;
+ }
+
+ sh = (struct spu_stub_hash_entry *)
+ bfd_hash_lookup (stubs->stub_hash_table, stub_name, TRUE, FALSE);
+ if (sh == NULL)
+ {
+ free (stub_name);
+ return FALSE;
+ }
+
+ /* If this entry isn't new, we already have a stub. */
+ if (sh->target_section != NULL)
+ {
+ free (stub_name);
+ return TRUE;
+ }
+
+ sh->target_section = h->root.u.def.section;
+ sh->target_off = h->root.u.def.value;
+ stubs->count += 1;
+ }
+
+ return TRUE;
+}
+
+/* Called via bfd_hash_traverse to set up pointers to all symbols
+ in the stub hash table. */
+
+static bfd_boolean
+populate_stubs (struct bfd_hash_entry *bh, void *inf)
+{
+ struct stubarr *stubs = inf;
+
+ stubs->sh[--stubs->count] = (struct spu_stub_hash_entry *) bh;
+ return TRUE;
+}
+
+/* qsort predicate to sort stubs by overlay number. */
+
+static int
+sort_stubs (const void *a, const void *b)
+{
+ const struct spu_stub_hash_entry *const *sa = a;
+ const struct spu_stub_hash_entry *const *sb = b;
+ int i;
+ bfd_signed_vma d;
+
+ i = spu_elf_section_data ((*sa)->target_section->output_section)->ovl_index;
+ i -= spu_elf_section_data ((*sb)->target_section->output_section)->ovl_index;
+ if (i != 0)
+ return i;
+
+ d = ((*sa)->target_section->output_section->vma
+ + (*sa)->target_section->output_offset
+ + (*sa)->target_off
+ - (*sb)->target_section->output_section->vma
+ - (*sb)->target_section->output_offset
+ - (*sb)->target_off);
+ if (d != 0)
+ return d < 0 ? -1 : 1;
+
+ /* Two functions at the same address. Aliases perhaps. */
+ i = strcmp ((*sb)->root.string, (*sa)->root.string);
+ BFD_ASSERT (i != 0);
+ return i;
+}
+
+/* Allocate space for overlay call and return stubs. */
+
+bfd_boolean
+spu_elf_size_stubs (bfd *output_bfd,
+ struct bfd_link_info *info,
+ int non_overlay_stubs,
+ int stack_analysis,
+ asection **stub,
+ asection **ovtab,
+ asection **toe)
+{
+ struct spu_link_hash_table *htab = spu_hash_table (info);
+ bfd *ibfd;
+ struct stubarr stubs;
+ unsigned i, group;
+ flagword flags;
+
+ htab->non_overlay_stubs = non_overlay_stubs;
+ stubs.stub_hash_table = &htab->stub_hash_table;
+ stubs.count = 0;
+ stubs.err = 0;
+ for (ibfd = info->input_bfds; ibfd != NULL; ibfd = ibfd->link_next)
+ {
+ extern const bfd_target bfd_elf32_spu_vec;
+ Elf_Internal_Shdr *symtab_hdr;
+ asection *section;
+ Elf_Internal_Sym *local_syms = NULL;
+ void *psyms;
+
+ if (ibfd->xvec != &bfd_elf32_spu_vec)
+ continue;
+
+ /* We'll need the symbol table in a second. */
+ symtab_hdr = &elf_tdata (ibfd)->symtab_hdr;
+ if (symtab_hdr->sh_info == 0)
+ continue;
+
+ /* Arrange to read and keep global syms for later stack analysis. */
+ psyms = &local_syms;
+ if (stack_analysis)
+ psyms = &symtab_hdr->contents;
+
+ /* Walk over each section attached to the input bfd. */
+ for (section = ibfd->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->flags & SEC_ALLOC) == 0
+ || (section->flags & SEC_LOAD) == 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 (ibfd, 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_spu_reloc_type r_type;
+ unsigned int r_indx;
+ asection *sym_sec;
+ Elf_Internal_Sym *sym;
+ struct elf_link_hash_entry *h;
+ const char *sym_name;
+ char *stub_name;
+ struct spu_stub_hash_entry *sh;
+ unsigned int sym_type;
+ enum _insn_type { non_branch, branch, call } insn_type;
+
+ r_type = ELF32_R_TYPE (irela->r_info);
+ r_indx = ELF32_R_SYM (irela->r_info);
+
+ if (r_type >= R_SPU_max)
+ {
+ bfd_set_error (bfd_error_bad_value);
+ goto error_ret_free_internal;
+ }
+
+ /* Determine the reloc target section. */
+ if (!get_sym_h (&h, &sym, &sym_sec, psyms, r_indx, ibfd))
+ goto error_ret_free_internal;
+
+ if (sym_sec == NULL
+ || sym_sec->output_section == NULL
+ || sym_sec->output_section->owner != output_bfd)
+ continue;
+
+ /* Ensure no stubs for user supplied overlay manager syms. */
+ if (h != NULL
+ && (strcmp (h->root.root.string, "__ovly_load") == 0
+ || strcmp (h->root.root.string, "__ovly_return") == 0))
+ continue;
+
+ insn_type = non_branch;
+ if (r_type == R_SPU_REL16
+ || r_type == R_SPU_ADDR16)
+ {
+ unsigned char insn[4];
+
+ if (!bfd_get_section_contents (ibfd, section, insn,
+ irela->r_offset, 4))
+ goto error_ret_free_internal;
+
+ if (is_branch (insn) || is_hint (insn))
+ {
+ insn_type = branch;
+ if ((insn[0] & 0xfd) == 0x31)
+ insn_type = call;
+ }
+ }
+
+ /* We are only interested in function symbols. */
+ if (h != NULL)
+ {
+ sym_type = h->type;
+ sym_name = h->root.root.string;
+ }
+ else
+ {
+ sym_type = ELF_ST_TYPE (sym->st_info);
+ sym_name = bfd_elf_sym_name (sym_sec->owner,
+ symtab_hdr,
+ sym,
+ sym_sec);
+ }
+ if (sym_type != STT_FUNC)
+ {
+ /* It's common for people to write assembly and forget
+ to give function symbols the right type. Handle
+ calls to such symbols, but warn so that (hopefully)
+ people will fix their code. We need the symbol
+ type to be correct to distinguish function pointer
+ initialisation from other pointer initialisation. */
+ if (insn_type == call)
+ (*_bfd_error_handler) (_("warning: call to non-function"
+ " symbol %s defined in %B"),
+ sym_sec->owner, sym_name);
+ else
+ continue;
+ }
+
+ if (!needs_ovl_stub (sym_name, sym_sec, section, htab,
+ insn_type != non_branch))
+ continue;
+
+ stub_name = spu_stub_name (sym_sec, h, irela);
+ if (stub_name == NULL)
+ goto error_ret_free_internal;
+
+ sh = (struct spu_stub_hash_entry *)
+ bfd_hash_lookup (&htab->stub_hash_table, stub_name,
+ TRUE, FALSE);
+ if (sh == NULL)
+ {
+ free (stub_name);
+ error_ret_free_internal:
+ if (elf_section_data (section)->relocs != internal_relocs)
+ free (internal_relocs);
+ error_ret_free_local:
+ if (local_syms != NULL
+ && (symtab_hdr->contents
+ != (unsigned char *) local_syms))
+ free (local_syms);
+ return FALSE;
+ }
+
+ /* If this entry isn't new, we already have a stub. */
+ if (sh->target_section != NULL)
+ {
+ free (stub_name);
+ continue;
+ }
+
+ sh->target_section = sym_sec;
+ if (h != NULL)
+ sh->target_off = h->root.u.def.value;
+ else
+ sh->target_off = sym->st_value;
+ sh->target_off += irela->r_addend;
+
+ stubs.count += 1;
+ }
+
+ /* 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;
+ }
+ }
+
+ elf_link_hash_traverse (&htab->elf, allocate_spuear_stubs, &stubs);
+ if (stubs.err)
+ return FALSE;
+
+ *stub = NULL;
+ if (stubs.count == 0)
+ return TRUE;
+
+ ibfd = info->input_bfds;
+ flags = (SEC_ALLOC | SEC_LOAD | SEC_CODE | SEC_READONLY
+ | SEC_HAS_CONTENTS | SEC_IN_MEMORY);
+ htab->stub = bfd_make_section_anyway_with_flags (ibfd, ".stub", flags);
+ *stub = htab->stub;
+ if (htab->stub == NULL
+ || !bfd_set_section_alignment (ibfd, htab->stub, 2))
+ return FALSE;
+
+ flags = (SEC_ALLOC | SEC_LOAD
+ | SEC_HAS_CONTENTS | SEC_IN_MEMORY);
+ htab->ovtab = bfd_make_section_anyway_with_flags (ibfd, ".ovtab", flags);
+ *ovtab = htab->ovtab;
+ if (htab->ovtab == NULL
+ || !bfd_set_section_alignment (ibfd, htab->stub, 4))
+ return FALSE;
+
+ *toe = bfd_make_section_anyway_with_flags (ibfd, ".toe", SEC_ALLOC);
+ if (*toe == NULL
+ || !bfd_set_section_alignment (ibfd, *toe, 4))
+ return FALSE;
+ (*toe)->size = 16;
+
+ /* Retrieve all the stubs and sort. */
+ stubs.sh = bfd_malloc (stubs.count * sizeof (*stubs.sh));
+ if (stubs.sh == NULL)
+ return FALSE;
+ i = stubs.count;
+ bfd_hash_traverse (&htab->stub_hash_table, populate_stubs, &stubs);
+ BFD_ASSERT (stubs.count == 0);
+
+ stubs.count = i;
+ qsort (stubs.sh, stubs.count, sizeof (*stubs.sh), sort_stubs);
+
+ /* Now that the stubs are sorted, place them in the stub section.
+ Stubs are grouped per overlay
+ . ila $79,func1
+ . br 1f
+ . ila $79,func2
+ . br 1f
+ .
+ .
+ . ila $79,funcn
+ . nop
+ . 1:
+ . ila $78,ovl_index
+ . br __ovly_load */
+
+ group = 0;
+ for (i = 0; i < stubs.count; i++)
+ {
+ if (spu_elf_section_data (stubs.sh[group]->target_section
+ ->output_section)->ovl_index
+ != spu_elf_section_data (stubs.sh[i]->target_section
+ ->output_section)->ovl_index)
+ {
+ htab->stub->size += SIZEOF_STUB2;
+ for (; group != i; group++)
+ stubs.sh[group]->delta
+ = stubs.sh[i - 1]->off - stubs.sh[group]->off;
+ }
+ if (group == i
+ || ((stubs.sh[i - 1]->target_section->output_section->vma
+ + stubs.sh[i - 1]->target_section->output_offset
+ + stubs.sh[i - 1]->target_off)
+ != (stubs.sh[i]->target_section->output_section->vma
+ + stubs.sh[i]->target_section->output_offset
+ + stubs.sh[i]->target_off)))
+ {
+ stubs.sh[i]->off = htab->stub->size;
+ htab->stub->size += SIZEOF_STUB1;
+ }
+ else
+ stubs.sh[i]->off = stubs.sh[i - 1]->off;
+ }
+ if (group != i)
+ htab->stub->size += SIZEOF_STUB2;
+ for (; group != i; group++)
+ stubs.sh[group]->delta = stubs.sh[i - 1]->off - stubs.sh[group]->off;
+
+ /* htab->ovtab consists of two arrays.
+ . struct {
+ . u32 vma;
+ . u32 size;
+ . u32 file_off;
+ . u32 buf;
+ . } _ovly_table[];
+ .
+ . struct {
+ . u32 mapped;
+ . } _ovly_buf_table[]; */
+
+ htab->ovtab->alignment_power = 4;
+ htab->ovtab->size = htab->num_overlays * 16 + htab->num_buf * 4;
+
+ return TRUE;
+}
+
+/* Functions to handle embedded spu_ovl.o object. */
+
+static void *
+ovl_mgr_open (struct bfd *nbfd ATTRIBUTE_UNUSED, void *stream)
+{
+ return stream;
+}
+
+static file_ptr
+ovl_mgr_pread (struct bfd *abfd ATTRIBUTE_UNUSED,
+ void *stream,
+ void *buf,
+ file_ptr nbytes,
+ file_ptr offset)
+{
+ struct _ovl_stream *os;
+ size_t count;
+ size_t max;
+
+ os = (struct _ovl_stream *) stream;
+ max = (const char *) os->end - (const char *) os->start;
+
+ if ((ufile_ptr) offset >= max)
+ return 0;
+
+ count = nbytes;
+ if (count > max - offset)
+ count = max - offset;
+
+ memcpy (buf, (const char *) os->start + offset, count);
+ return count;
+}
+
+bfd_boolean
+spu_elf_open_builtin_lib (bfd **ovl_bfd, const struct _ovl_stream *stream)
+{
+ *ovl_bfd = bfd_openr_iovec ("builtin ovl_mgr",
+ "elf32-spu",
+ ovl_mgr_open,
+ (void *) stream,
+ ovl_mgr_pread,
+ NULL,
+ NULL);
+ return *ovl_bfd != NULL;
+}
+
+/* Fill in the ila and br for a stub. On the last stub for a group,
+ write the stub that sets the overlay number too. */
+
+static bfd_boolean
+write_one_stub (struct bfd_hash_entry *bh, void *inf)
+{
+ struct spu_stub_hash_entry *ent = (struct spu_stub_hash_entry *) bh;
+ struct spu_link_hash_table *htab = inf;
+ asection *sec = htab->stub;
+ asection *s = ent->target_section;
+ unsigned int ovl;
+ bfd_vma val;
+
+ val = ent->target_off + s->output_offset + s->output_section->vma;
+ bfd_put_32 (sec->owner, ILA_79 + ((val << 7) & 0x01ffff80),
+ sec->contents + ent->off);
+ val = ent->delta + 4;
+ bfd_put_32 (sec->owner, BR + ((val << 5) & 0x007fff80),
+ sec->contents + ent->off + 4);
+
+ /* If this is the last stub of this group, write stub2. */
+ if (ent->delta == 0)
+ {
+ bfd_put_32 (sec->owner, NOP,
+ sec->contents + ent->off + 4);
+
+ ovl = spu_elf_section_data (s->output_section)->ovl_index;
+ bfd_put_32 (sec->owner, ILA_78 + ((ovl << 7) & 0x01ffff80),
+ sec->contents + ent->off + 8);
+
+ val = (htab->ovly_load->root.u.def.section->output_section->vma
+ + htab->ovly_load->root.u.def.section->output_offset
+ + htab->ovly_load->root.u.def.value
+ - (sec->output_section->vma
+ + sec->output_offset
+ + ent->off + 12));
+
+ if (val + 0x20000 >= 0x40000)
+ htab->stub_overflow = TRUE;
+
+ bfd_put_32 (sec->owner, BR + ((val << 5) & 0x007fff80),
+ sec->contents + ent->off + 12);
+ }
+
+ if (htab->emit_stub_syms)
+ {
+ struct elf_link_hash_entry *h;
+ size_t len1, len2;
+ char *name;
+
+ len1 = sizeof ("00000000.ovl_call.") - 1;
+ len2 = strlen (ent->root.string);
+ name = bfd_malloc (len1 + len2 + 1);
+ if (name == NULL)
+ return FALSE;
+ memcpy (name, "00000000.ovl_call.", len1);
+ memcpy (name + len1, ent->root.string, len2 + 1);
+ h = elf_link_hash_lookup (&htab->elf, name, TRUE, TRUE, FALSE);
+ free (name);
+ 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 = sec;
+ h->root.u.def.value = ent->off;
+ h->size = (ent->delta == 0
+ ? SIZEOF_STUB1 + SIZEOF_STUB2 : SIZEOF_STUB1);
+ h->type = STT_FUNC;
+ h->ref_regular = 1;
+ h->def_regular = 1;
+ h->ref_regular_nonweak = 1;
+ h->forced_local = 1;
+ h->non_elf = 0;
+ }
+ }
+
+ return TRUE;
+}
+
+/* Define an STT_OBJECT symbol. */
+
+static struct elf_link_hash_entry *
+define_ovtab_symbol (struct spu_link_hash_table *htab, const char *name)
+{
+ struct elf_link_hash_entry *h;
+
+ h = elf_link_hash_lookup (&htab->elf, name, TRUE, FALSE, FALSE);
+ if (h == NULL)
+ return NULL;
+
+ if (h->root.type != bfd_link_hash_defined
+ || !h->def_regular)
+ {
+ h->root.type = bfd_link_hash_defined;
+ h->root.u.def.section = htab->ovtab;
+ h->type = STT_OBJECT;
+ h->ref_regular = 1;
+ h->def_regular = 1;
+ h->ref_regular_nonweak = 1;
+ h->non_elf = 0;
+ }
+ else
+ {
+ (*_bfd_error_handler) (_("%B is not allowed to define %s"),
+ h->root.u.def.section->owner,
+ h->root.root.string);
+ bfd_set_error (bfd_error_bad_value);
+ return NULL;
+ }
+
+ return h;
+}
+
+/* Fill in all stubs and the overlay tables. */
+
+bfd_boolean
+spu_elf_build_stubs (struct bfd_link_info *info, int emit_syms, asection *toe)
+{
+ struct spu_link_hash_table *htab = spu_hash_table (info);
+ struct elf_link_hash_entry *h;
+ bfd_byte *p;
+ asection *s;
+ bfd *obfd;
+ unsigned int i;
+
+ htab->emit_stub_syms = emit_syms;
+ htab->stub->contents = bfd_zalloc (htab->stub->owner, htab->stub->size);
+ if (htab->stub->contents == NULL)
+ return FALSE;
+
+ h = elf_link_hash_lookup (&htab->elf, "__ovly_load", FALSE, FALSE, FALSE);
+ htab->ovly_load = h;
+ BFD_ASSERT (h != NULL
+ && (h->root.type == bfd_link_hash_defined
+ || h->root.type == bfd_link_hash_defweak)
+ && h->def_regular);
+
+ s = h->root.u.def.section->output_section;
+ if (spu_elf_section_data (s)->ovl_index)
+ {
+ (*_bfd_error_handler) (_("%s in overlay section"),
+ h->root.u.def.section->owner);
+ bfd_set_error (bfd_error_bad_value);
+ return FALSE;
+ }
+
+ /* Write out all the stubs. */
+ bfd_hash_traverse (&htab->stub_hash_table, write_one_stub, htab);
+
+ if (htab->stub_overflow)
+ {
+ (*_bfd_error_handler) (_("overlay stub relocation overflow"));
+ bfd_set_error (bfd_error_bad_value);
+ return FALSE;
+ }
+
+ htab->ovtab->contents = bfd_zalloc (htab->ovtab->owner, htab->ovtab->size);
+ if (htab->ovtab->contents == NULL)
+ return FALSE;
+
+ /* Write out _ovly_table. */
+ p = htab->ovtab->contents;
+ obfd = htab->ovtab->output_section->owner;
+ for (s = obfd->sections; s != NULL; s = s->next)
+ {
+ unsigned int ovl_index = spu_elf_section_data (s)->ovl_index;
+
+ if (ovl_index != 0)
+ {
+ unsigned int lo, hi, mid;
+ unsigned long off = (ovl_index - 1) * 16;
+ bfd_put_32 (htab->ovtab->owner, s->vma, p + off);
+ bfd_put_32 (htab->ovtab->owner, (s->size + 15) & -16, p + off + 4);
+ /* file_off written later in spu_elf_modify_program_headers. */
+
+ lo = 0;
+ hi = htab->num_buf;
+ while (lo < hi)
+ {
+ mid = (lo + hi) >> 1;
+ if (htab->ovl_region[2 * mid + 1]->vma
+ + htab->ovl_region[2 * mid + 1]->size <= s->vma)
+ lo = mid + 1;
+ else if (htab->ovl_region[2 * mid]->vma > s->vma)
+ hi = mid;
+ else
+ {
+ bfd_put_32 (htab->ovtab->owner, mid + 1, p + off + 12);
+ break;
+ }
+ }
+ BFD_ASSERT (lo < hi);
+ }
+ }
+
+ /* Write out _ovly_buf_table. */
+ p = htab->ovtab->contents + htab->num_overlays * 16;
+ for (i = 0; i < htab->num_buf; i++)
+ {
+ bfd_put_32 (htab->ovtab->owner, 0, p);
+ p += 4;
+ }
+
+ h = define_ovtab_symbol (htab, "_ovly_table");
+ if (h == NULL)
+ return FALSE;
+ h->root.u.def.value = 0;
+ h->size = htab->num_overlays * 16;
+
+ h = define_ovtab_symbol (htab, "_ovly_table_end");
+ if (h == NULL)
+ return FALSE;
+ h->root.u.def.value = htab->num_overlays * 16;
+ h->size = 0;
+
+ h = define_ovtab_symbol (htab, "_ovly_buf_table");
+ if (h == NULL)
+ return FALSE;
+ h->root.u.def.value = htab->num_overlays * 16;
+ h->size = htab->num_buf * 4;
+
+ h = define_ovtab_symbol (htab, "_ovly_buf_table_end");
+ if (h == NULL)
+ return FALSE;
+ h->root.u.def.value = htab->num_overlays * 16 + htab->num_buf * 4;
+ h->size = 0;
+
+ h = define_ovtab_symbol (htab, "_EAR_");
+ if (h == NULL)
+ return FALSE;
+ h->root.u.def.section = toe;
+ h->root.u.def.value = 0;
+ h->size = 16;
+
+ return TRUE;
+}
+
+/* OFFSET in SEC (presumably) is the beginning of a function prologue.
+ Search for stack adjusting insns, and return the sp delta. */
+
+static int
+find_function_stack_adjust (asection *sec, bfd_vma offset)
+{
+ int unrecog;
+ int reg[128];
+
+ memset (reg, 0, sizeof (reg));
+ for (unrecog = 0; offset + 4 <= sec->size && unrecog < 32; offset += 4)
+ {
+ unsigned char buf[4];
+ int rt, ra;
+ int imm;
+
+ /* Assume no relocs on stack adjusing insns. */
+ if (!bfd_get_section_contents (sec->owner, sec, buf, offset, 4))
+ break;
+
+ if (buf[0] == 0x24 /* stqd */)
+ continue;
+
+ rt = buf[3] & 0x7f;
+ ra = ((buf[2] & 0x3f) << 1) | (buf[3] >> 7);
+ /* Partly decoded immediate field. */
+ imm = (buf[1] << 9) | (buf[2] << 1) | (buf[3] >> 7);
+
+ if (buf[0] == 0x1c /* ai */)
+ {
+ imm >>= 7;
+ imm = (imm ^ 0x200) - 0x200;
+ reg[rt] = reg[ra] + imm;
+
+ if (rt == 1 /* sp */)
+ {
+ if (imm > 0)
+ break;
+ return reg[rt];
+ }
+ }
+ else if (buf[0] == 0x18 && (buf[1] & 0xe0) == 0 /* a */)
+ {
+ int rb = ((buf[1] & 0x1f) << 2) | ((buf[2] & 0xc0) >> 6);
+
+ reg[rt] = reg[ra] + reg[rb];
+ if (rt == 1)
+ return reg[rt];
+ }
+ else if ((buf[0] & 0xfc) == 0x40 /* il, ilh, ilhu, ila */)
+ {
+ if (buf[0] >= 0x42 /* ila */)
+ imm |= (buf[0] & 1) << 17;
+ else
+ {
+ imm &= 0xffff;
+
+ if (buf[0] == 0x40 /* il */)
+ {
+ if ((buf[1] & 0x80) == 0)
+ goto unknown_insn;
+ imm = (imm ^ 0x8000) - 0x8000;
+ }
+ else if ((buf[1] & 0x80) == 0 /* ilhu */)
+ imm <<= 16;
+ }
+ reg[rt] = imm;
+ continue;
+ }
+ else if (buf[0] == 0x60 && (buf[1] & 0x80) != 0 /* iohl */)
+ {
+ reg[rt] |= imm & 0xffff;
+ continue;
+ }
+ else if (buf[0] == 0x04 /* ori */)
+ {
+ imm >>= 7;
+ imm = (imm ^ 0x200) - 0x200;
+ reg[rt] = reg[ra] | imm;
+ continue;
+ }
+ else if ((buf[0] == 0x33 && imm == 1 /* brsl .+4 */)
+ || (buf[0] == 0x08 && (buf[1] & 0xe0) == 0 /* sf */))
+ {
+ /* Used in pic reg load. Say rt is trashed. */
+ reg[rt] = 0;
+ continue;
+ }
+ else if (is_branch (buf))
+ /* If we hit a branch then we must be out of the prologue. */
+ break;
+ unknown_insn:
+ ++unrecog;
+ }
+
+ return 0;
+}
+
+/* qsort predicate to sort symbols by section and value. */
+
+static Elf_Internal_Sym *sort_syms_syms;
+static asection **sort_syms_psecs;
+
+static int
+sort_syms (const void *a, const void *b)
+{
+ Elf_Internal_Sym *const *s1 = a;
+ Elf_Internal_Sym *const *s2 = b;
+ asection *sec1,*sec2;
+ bfd_signed_vma delta;
+
+ sec1 = sort_syms_psecs[*s1 - sort_syms_syms];
+ sec2 = sort_syms_psecs[*s2 - sort_syms_syms];
+
+ if (sec1 != sec2)
+ return sec1->index - sec2->index;
+
+ delta = (*s1)->st_value - (*s2)->st_value;
+ if (delta != 0)
+ return delta < 0 ? -1 : 1;
+
+ delta = (*s2)->st_size - (*s1)->st_size;
+ if (delta != 0)
+ return delta < 0 ? -1 : 1;
+
+ return *s1 < *s2 ? -1 : 1;
+}
+
+struct call_info
+{
+ struct function_info *fun;
+ struct call_info *next;
+ int is_tail;
+};
+
+struct function_info
+{
+ /* List of functions called. Also branches to hot/cold part of
+ function. */
+ struct call_info *call_list;
+ /* For hot/cold part of function, point to owner. */
+ struct function_info *start;
+ /* Symbol at start of function. */
+ union {
+ Elf_Internal_Sym *sym;
+ struct elf_link_hash_entry *h;
+ } u;
+ /* Function section. */
+ asection *sec;
+ /* Address range of (this part of) function. */
+ bfd_vma lo, hi;
+ /* Stack usage. */
+ int stack;
+ /* Set if global symbol. */
+ unsigned int global : 1;
+ /* Set if known to be start of function (as distinct from a hunk
+ in hot/cold section. */
+ unsigned int is_func : 1;
+ /* Flags used during call tree traversal. */
+ unsigned int visit1 : 1;
+ unsigned int non_root : 1;
+ unsigned int visit2 : 1;
+ unsigned int marking : 1;
+ unsigned int visit3 : 1;
+};
+
+struct spu_elf_stack_info
+{
+ int num_fun;
+ int max_fun;
+ /* Variable size array describing functions, one per contiguous
+ address range belonging to a function. */
+ struct function_info fun[1];
+};
+
+/* Allocate a struct spu_elf_stack_info with MAX_FUN struct function_info
+ entries for section SEC. */
+
+static struct spu_elf_stack_info *
+alloc_stack_info (asection *sec, int max_fun)
+{
+ struct _spu_elf_section_data *sec_data = spu_elf_section_data (sec);
+ bfd_size_type amt;
+
+ amt = sizeof (struct spu_elf_stack_info);
+ amt += (max_fun - 1) * sizeof (struct function_info);
+ sec_data->stack_info = bfd_zmalloc (amt);
+ if (sec_data->stack_info != NULL)
+ sec_data->stack_info->max_fun = max_fun;
+ return sec_data->stack_info;
+}
+
+/* Add a new struct function_info describing a (part of a) function
+ starting at SYM_H. Keep the array sorted by address. */
+
+static struct function_info *
+maybe_insert_function (asection *sec,
+ void *sym_h,
+ bfd_boolean global,
+ bfd_boolean is_func)
+{
+ struct _spu_elf_section_data *sec_data = spu_elf_section_data (sec);
+ struct spu_elf_stack_info *sinfo = sec_data->stack_info;
+ int i;
+ bfd_vma off, size;
+
+ if (sinfo == NULL)
+ {
+ sinfo = alloc_stack_info (sec, 20);
+ if (sinfo == NULL)
+ return NULL;
+ }
+
+ if (!global)
+ {
+ Elf_Internal_Sym *sym = sym_h;
+ off = sym->st_value;
+ size = sym->st_size;
+ }
+ else
+ {
+ struct elf_link_hash_entry *h = sym_h;
+ off = h->root.u.def.value;
+ size = h->size;
+ }
+
+ for (i = sinfo->num_fun; --i >= 0; )
+ if (sinfo->fun[i].lo <= off)
+ break;
+
+ if (i >= 0)
+ {
+ /* Don't add another entry for an alias, but do update some
+ info. */
+ if (sinfo->fun[i].lo == off)
+ {
+ /* Prefer globals over local syms. */
+ if (global && !sinfo->fun[i].global)
+ {
+ sinfo->fun[i].global = TRUE;
+ sinfo->fun[i].u.h = sym_h;
+ }
+ if (is_func)
+ sinfo->fun[i].is_func = TRUE;
+ return &sinfo->fun[i];
+ }
+ /* Ignore a zero-size symbol inside an existing function. */
+ else if (sinfo->fun[i].hi > off && size == 0)
+ return &sinfo->fun[i];
+ }
+
+ if (++i < sinfo->num_fun)
+ memmove (&sinfo->fun[i + 1], &sinfo->fun[i],
+ (sinfo->num_fun - i) * sizeof (sinfo->fun[i]));
+ else if (i >= sinfo->max_fun)
+ {
+ bfd_size_type amt = sizeof (struct spu_elf_stack_info);
+ bfd_size_type old = amt;
+
+ old += (sinfo->max_fun - 1) * sizeof (struct function_info);
+ sinfo->max_fun += 20 + (sinfo->max_fun >> 1);
+ amt += (sinfo->max_fun - 1) * sizeof (struct function_info);
+ sinfo = bfd_realloc (sinfo, amt);
+ if (sinfo == NULL)
+ return NULL;
+ memset ((char *) sinfo + old, 0, amt - old);
+ sec_data->stack_info = sinfo;
+ }
+ sinfo->fun[i].is_func = is_func;
+ sinfo->fun[i].global = global;
+ sinfo->fun[i].sec = sec;
+ if (global)
+ sinfo->fun[i].u.h = sym_h;
+ else
+ sinfo->fun[i].u.sym = sym_h;
+ sinfo->fun[i].lo = off;
+ sinfo->fun[i].hi = off + size;
+ sinfo->fun[i].stack = -find_function_stack_adjust (sec, off);
+ sinfo->num_fun += 1;
+ return &sinfo->fun[i];
+}
+
+/* Return the name of FUN. */
+
+static const char *
+func_name (struct function_info *fun)
+{
+ asection *sec;
+ bfd *ibfd;
+ Elf_Internal_Shdr *symtab_hdr;
+
+ while (fun->start != NULL)
+ fun = fun->start;
+
+ if (fun->global)
+ return fun->u.h->root.root.string;
+
+ sec = fun->sec;
+ if (fun->u.sym->st_name == 0)
+ {
+ size_t len = strlen (sec->name);
+ char *name = bfd_malloc (len + 10);
+ if (name == NULL)
+ return "(null)";
+ sprintf (name, "%s+%lx", sec->name,
+ (unsigned long) fun->u.sym->st_value & 0xffffffff);
+ return name;
+ }
+ ibfd = sec->owner;
+ symtab_hdr = &elf_tdata (ibfd)->symtab_hdr;
+ return bfd_elf_sym_name (ibfd, symtab_hdr, fun->u.sym, sec);
+}
+
+/* Read the instruction at OFF in SEC. Return true iff the instruction
+ is a nop, lnop, or stop 0 (all zero insn). */
+
+static bfd_boolean
+is_nop (asection *sec, bfd_vma off)
+{
+ unsigned char insn[4];
+
+ if (off + 4 > sec->size
+ || !bfd_get_section_contents (sec->owner, sec, insn, off, 4))
+ return FALSE;
+ if ((insn[0] & 0xbf) == 0 && (insn[1] & 0xe0) == 0x20)
+ return TRUE;
+ if (insn[0] == 0 && insn[1] == 0 && insn[2] == 0 && insn[3] == 0)
+ return TRUE;
+ return FALSE;
+}
+
+/* Extend the range of FUN to cover nop padding up to LIMIT.
+ Return TRUE iff some instruction other than a NOP was found. */
+
+static bfd_boolean
+insns_at_end (struct function_info *fun, bfd_vma limit)
+{
+ bfd_vma off = (fun->hi + 3) & -4;
+
+ while (off < limit && is_nop (fun->sec, off))
+ off += 4;
+ if (off < limit)
+ {
+ fun->hi = off;
+ return TRUE;
+ }
+ fun->hi = limit;
+ return FALSE;
+}
+
+/* Check and fix overlapping function ranges. Return TRUE iff there
+ are gaps in the current info we have about functions in SEC. */
+
+static bfd_boolean
+check_function_ranges (asection *sec, struct bfd_link_info *info)
+{
+ struct _spu_elf_section_data *sec_data = spu_elf_section_data (sec);
+ struct spu_elf_stack_info *sinfo = sec_data->stack_info;
+ int i;
+ bfd_boolean gaps = FALSE;
+
+ if (sinfo == NULL)
+ return FALSE;
+
+ for (i = 1; i < sinfo->num_fun; i++)
+ if (sinfo->fun[i - 1].hi > sinfo->fun[i].lo)
+ {
+ /* Fix overlapping symbols. */
+ const char *f1 = func_name (&sinfo->fun[i - 1]);
+ const char *f2 = func_name (&sinfo->fun[i]);
+
+ info->callbacks->einfo (_("warning: %s overlaps %s\n"), f1, f2);
+ sinfo->fun[i - 1].hi = sinfo->fun[i].lo;
+ }
+ else if (insns_at_end (&sinfo->fun[i - 1], sinfo->fun[i].lo))
+ gaps = TRUE;
+
+ if (sinfo->num_fun == 0)
+ gaps = TRUE;
+ else
+ {
+ if (sinfo->fun[0].lo != 0)
+ gaps = TRUE;
+ if (sinfo->fun[sinfo->num_fun - 1].hi > sec->size)
+ {
+ const char *f1 = func_name (&sinfo->fun[sinfo->num_fun - 1]);
+
+ info->callbacks->einfo (_("warning: %s exceeds section size\n"), f1);
+ sinfo->fun[sinfo->num_fun - 1].hi = sec->size;
+ }
+ else if (insns_at_end (&sinfo->fun[sinfo->num_fun - 1], sec->size))
+ gaps = TRUE;
+ }
+ return gaps;
+}
+
+/* Search current function info for a function that contains address
+ OFFSET in section SEC. */
+
+static struct function_info *
+find_function (asection *sec, bfd_vma offset, struct bfd_link_info *info)
+{
+ struct _spu_elf_section_data *sec_data = spu_elf_section_data (sec);
+ struct spu_elf_stack_info *sinfo = sec_data->stack_info;
+ int lo, hi, mid;
+
+ lo = 0;
+ hi = sinfo->num_fun;
+ while (lo < hi)
+ {
+ mid = (lo + hi) / 2;
+ if (offset < sinfo->fun[mid].lo)
+ hi = mid;
+ else if (offset >= sinfo->fun[mid].hi)
+ lo = mid + 1;
+ else
+ return &sinfo->fun[mid];
+ }
+ info->callbacks->einfo (_("%A:0x%v not found in function table\n"),
+ sec, offset);
+ return NULL;
+}
+
+/* Add CALLEE to CALLER call list if not already present. */
+
+static bfd_boolean
+insert_callee (struct function_info *caller, struct call_info *callee)
+{
+ struct call_info *p;
+ for (p = caller->call_list; p != NULL; p = p->next)
+ if (p->fun == callee->fun)
+ {
+ /* Tail calls use less stack than normal calls. Retain entry
+ for normal call over one for tail call. */
+ if (p->is_tail > callee->is_tail)
+ p->is_tail = callee->is_tail;
+ return FALSE;
+ }
+ callee->next = caller->call_list;
+ caller->call_list = callee;
+ return TRUE;
+}
+
+/* Rummage through the relocs for SEC, looking for function calls.
+ If CALL_TREE is true, fill in call graph. If CALL_TREE is false,
+ mark destination symbols on calls as being functions. Also
+ look at branches, which may be tail calls or go to hot/cold
+ section part of same function. */
+
+static bfd_boolean
+mark_functions_via_relocs (asection *sec,
+ struct bfd_link_info *info,
+ int call_tree)
+{
+ Elf_Internal_Rela *internal_relocs, *irelaend, *irela;
+ Elf_Internal_Shdr *symtab_hdr = &elf_tdata (sec->owner)->symtab_hdr;
+ Elf_Internal_Sym *syms;
+ void *psyms;
+ static bfd_boolean warned;
+
+ internal_relocs = _bfd_elf_link_read_relocs (sec->owner, sec, NULL, NULL,
+ info->keep_memory);
+ if (internal_relocs == NULL)
+ return FALSE;
+
+ symtab_hdr = &elf_tdata (sec->owner)->symtab_hdr;
+ psyms = &symtab_hdr->contents;
+ syms = *(Elf_Internal_Sym **) psyms;
+ irela = internal_relocs;
+ irelaend = irela + sec->reloc_count;
+ for (; irela < irelaend; irela++)
+ {
+ enum elf_spu_reloc_type r_type;
+ unsigned int r_indx;
+ asection *sym_sec;
+ Elf_Internal_Sym *sym;
+ struct elf_link_hash_entry *h;
+ bfd_vma val;
+ unsigned char insn[4];
+ bfd_boolean is_call;
+ struct function_info *caller;
+ struct call_info *callee;
+
+ r_type = ELF32_R_TYPE (irela->r_info);
+ if (r_type != R_SPU_REL16
+ && r_type != R_SPU_ADDR16)
+ continue;
+
+ r_indx = ELF32_R_SYM (irela->r_info);
+ if (!get_sym_h (&h, &sym, &sym_sec, psyms, r_indx, sec->owner))
+ return FALSE;
+
+ if (sym_sec == NULL
+ || sym_sec->output_section == NULL
+ || sym_sec->output_section->owner != sec->output_section->owner)
+ continue;
+
+ if (!bfd_get_section_contents (sec->owner, sec, insn,
+ irela->r_offset, 4))
+ return FALSE;
+ if (!is_branch (insn))
+ continue;
+
+ if ((sym_sec->flags & (SEC_ALLOC | SEC_LOAD | SEC_CODE))
+ != (SEC_ALLOC | SEC_LOAD | SEC_CODE))
+ {
+ if (!call_tree)
+ warned = TRUE;
+ if (!call_tree || !warned)
+ info->callbacks->einfo (_("%B(%A+0x%v): call to non-code section"
+ " %B(%A), stack analysis incomplete\n"),
+ sec->owner, sec, irela->r_offset,
+ sym_sec->owner, sym_sec);
+ continue;
+ }
+
+ is_call = (insn[0] & 0xfd) == 0x31;
+
+ if (h)
+ val = h->root.u.def.value;
+ else
+ val = sym->st_value;
+ val += irela->r_addend;
+
+ if (!call_tree)
+ {
+ struct function_info *fun;
+
+ if (irela->r_addend != 0)
+ {
+ Elf_Internal_Sym *fake = bfd_zmalloc (sizeof (*fake));
+ if (fake == NULL)
+ return FALSE;
+ fake->st_value = val;
+ fake->st_shndx
+ = _bfd_elf_section_from_bfd_section (sym_sec->owner, sym_sec);
+ sym = fake;
+ }
+ if (sym)
+ fun = maybe_insert_function (sym_sec, sym, FALSE, is_call);
+ else
+ fun = maybe_insert_function (sym_sec, h, TRUE, is_call);
+ if (fun == NULL)
+ return FALSE;
+ if (irela->r_addend != 0
+ && fun->u.sym != sym)
+ free (sym);
+ continue;
+ }
+
+ caller = find_function (sec, irela->r_offset, info);
+ if (caller == NULL)
+ return FALSE;
+ callee = bfd_malloc (sizeof *callee);
+ if (callee == NULL)
+ return FALSE;
+
+ callee->fun = find_function (sym_sec, val, info);
+ if (callee->fun == NULL)
+ return FALSE;
+ callee->is_tail = !is_call;
+ if (!insert_callee (caller, callee))
+ free (callee);
+ else if (!is_call
+ && !callee->fun->is_func
+ && callee->fun->stack == 0)
+ {
+ /* This is either a tail call or a branch from one part of
+ the function to another, ie. hot/cold section. If the
+ destination has been called by some other function then
+ it is a separate function. We also assume that functions
+ are not split across input files. */
+ if (callee->fun->start != NULL
+ || sec->owner != sym_sec->owner)
+ {
+ callee->fun->start = NULL;
+ callee->fun->is_func = TRUE;
+ }
+ else
+ callee->fun->start = caller;
+ }
+ }
+
+ return TRUE;
+}
+
+/* Handle something like .init or .fini, which has a piece of a function.
+ These sections are pasted together to form a single function. */
+
+static bfd_boolean
+pasted_function (asection *sec, struct bfd_link_info *info)
+{
+ struct bfd_link_order *l;
+ struct _spu_elf_section_data *sec_data;
+ struct spu_elf_stack_info *sinfo;
+ Elf_Internal_Sym *fake;
+ struct function_info *fun, *fun_start;
+
+ fake = bfd_zmalloc (sizeof (*fake));
+ if (fake == NULL)
+ return FALSE;
+ fake->st_value = 0;
+ fake->st_size = sec->size;
+ fake->st_shndx
+ = _bfd_elf_section_from_bfd_section (sec->owner, sec);
+ fun = maybe_insert_function (sec, fake, FALSE, FALSE);
+ if (!fun)
+ return FALSE;
+
+ /* Find a function immediately preceding this section. */
+ fun_start = NULL;
+ for (l = sec->output_section->map_head.link_order; l != NULL; l = l->next)
+ {
+ if (l->u.indirect.section == sec)
+ {
+ if (fun_start != NULL)
+ {
+ if (fun_start->start)
+ fun_start = fun_start->start;
+ fun->start = fun_start;
+ }
+ return TRUE;
+ }
+ if (l->type == bfd_indirect_link_order
+ && (sec_data = spu_elf_section_data (l->u.indirect.section)) != NULL
+ && (sinfo = sec_data->stack_info) != NULL
+ && sinfo->num_fun != 0)
+ fun_start = &sinfo->fun[sinfo->num_fun - 1];
+ }
+
+ info->callbacks->einfo (_("%A link_order not found\n"), sec);
+ return FALSE;
+}
+
+/* We're only interested in code sections. */
+
+static bfd_boolean
+interesting_section (asection *s, bfd *obfd, struct spu_link_hash_table *htab)
+{
+ return (s != htab->stub
+ && s->output_section != NULL
+ && s->output_section->owner == obfd
+ && ((s->flags & (SEC_ALLOC | SEC_LOAD | SEC_CODE))
+ == (SEC_ALLOC | SEC_LOAD | SEC_CODE))
+ && s->size != 0);
+}
+
+/* Map address ranges in code sections to functions. */
+
+static bfd_boolean
+discover_functions (bfd *output_bfd, struct bfd_link_info *info)
+{
+ struct spu_link_hash_table *htab = spu_hash_table (info);
+ bfd *ibfd;
+ int bfd_idx;
+ Elf_Internal_Sym ***psym_arr;
+ asection ***sec_arr;
+ bfd_boolean gaps = FALSE;
+
+ bfd_idx = 0;
+ for (ibfd = info->input_bfds; ibfd != NULL; ibfd = ibfd->link_next)
+ bfd_idx++;
+
+ psym_arr = bfd_zmalloc (bfd_idx * sizeof (*psym_arr));
+ if (psym_arr == NULL)
+ return FALSE;
+ sec_arr = bfd_zmalloc (bfd_idx * sizeof (*sec_arr));
+ if (sec_arr == NULL)
+ return FALSE;
+
+
+ for (ibfd = info->input_bfds, bfd_idx = 0;
+ ibfd != NULL;
+ ibfd = ibfd->link_next, bfd_idx++)
+ {
+ extern const bfd_target bfd_elf32_spu_vec;
+ Elf_Internal_Shdr *symtab_hdr;
+ asection *sec;
+ size_t symcount;
+ Elf_Internal_Sym *syms, *sy, **psyms, **psy;
+ asection **psecs, **p;
+
+ if (ibfd->xvec != &bfd_elf32_spu_vec)
+ continue;
+
+ /* Read all the symbols. */
+ symtab_hdr = &elf_tdata (ibfd)->symtab_hdr;
+ symcount = symtab_hdr->sh_size / symtab_hdr->sh_entsize;
+ if (symcount == 0)
+ continue;
+
+ syms = (Elf_Internal_Sym *) symtab_hdr->contents;
+ if (syms == NULL)
+ {
+ syms = bfd_elf_get_elf_syms (ibfd, symtab_hdr, symcount, 0,
+ NULL, NULL, NULL);
+ symtab_hdr->contents = (void *) syms;
+ if (syms == NULL)
+ return FALSE;
+ }
+
+ /* Select defined function symbols that are going to be output. */
+ psyms = bfd_malloc ((symcount + 1) * sizeof (*psyms));
+ if (psyms == NULL)
+ return FALSE;
+ psym_arr[bfd_idx] = psyms;
+ psecs = bfd_malloc (symcount * sizeof (*psecs));
+ if (psecs == NULL)
+ return FALSE;
+ sec_arr[bfd_idx] = psecs;
+ for (psy = psyms, p = psecs, sy = syms; sy < syms + symcount; ++p, ++sy)
+ if (ELF_ST_TYPE (sy->st_info) == STT_NOTYPE
+ || ELF_ST_TYPE (sy->st_info) == STT_FUNC)
+ {
+ asection *s;
+
+ *p = s = bfd_section_from_elf_index (ibfd, sy->st_shndx);
+ if (s != NULL && interesting_section (s, output_bfd, htab))
+ *psy++ = sy;
+ }
+ symcount = psy - psyms;
+ *psy = NULL;
+
+ /* Sort them by section and offset within section. */
+ sort_syms_syms = syms;
+ sort_syms_psecs = psecs;
+ qsort (psyms, symcount, sizeof (*psyms), sort_syms);
+
+ /* Now inspect the function symbols. */
+ for (psy = psyms; psy < psyms + symcount; )
+ {
+ asection *s = psecs[*psy - syms];
+ Elf_Internal_Sym **psy2;
+
+ for (psy2 = psy; ++psy2 < psyms + symcount; )
+ if (psecs[*psy2 - syms] != s)
+ break;
+
+ if (!alloc_stack_info (s, psy2 - psy))
+ return FALSE;
+ psy = psy2;
+ }
+
+ /* First install info about properly typed and sized functions.
+ In an ideal world this will cover all code sections, except
+ when partitioning functions into hot and cold sections,
+ and the horrible pasted together .init and .fini functions. */
+ for (psy = psyms; psy < psyms + symcount; ++psy)
+ {
+ sy = *psy;
+ if (ELF_ST_TYPE (sy->st_info) == STT_FUNC)
+ {
+ asection *s = psecs[sy - syms];
+ if (!maybe_insert_function (s, sy, FALSE, TRUE))
+ return FALSE;
+ }
+ }
+
+ for (sec = ibfd->sections; sec != NULL && !gaps; sec = sec->next)
+ if (interesting_section (sec, output_bfd, htab))
+ gaps |= check_function_ranges (sec, info);
+ }
+
+ if (gaps)
+ {
+ /* See if we can discover more function symbols by looking at
+ relocations. */
+ for (ibfd = info->input_bfds, bfd_idx = 0;
+ ibfd != NULL;
+ ibfd = ibfd->link_next, bfd_idx++)
+ {
+ asection *sec;
+
+ if (psym_arr[bfd_idx] == NULL)
+ continue;
+
+ for (sec = ibfd->sections; sec != NULL; sec = sec->next)
+ if (interesting_section (sec, output_bfd, htab)
+ && sec->reloc_count != 0)
+ {
+ if (!mark_functions_via_relocs (sec, info, FALSE))
+ return FALSE;
+ }
+ }
+
+ for (ibfd = info->input_bfds, bfd_idx = 0;
+ ibfd != NULL;
+ ibfd = ibfd->link_next, bfd_idx++)
+ {
+ Elf_Internal_Shdr *symtab_hdr;
+ asection *sec;
+ Elf_Internal_Sym *syms, *sy, **psyms, **psy;
+ asection **psecs;
+
+ if ((psyms = psym_arr[bfd_idx]) == NULL)
+ continue;
+
+ psecs = sec_arr[bfd_idx];
+
+ symtab_hdr = &elf_tdata (ibfd)->symtab_hdr;
+ syms = (Elf_Internal_Sym *) symtab_hdr->contents;
+
+ gaps = FALSE;
+ for (sec = ibfd->sections; sec != NULL && !gaps; sec = sec->next)
+ if (interesting_section (sec, output_bfd, htab))
+ gaps |= check_function_ranges (sec, info);
+ if (!gaps)
+ continue;
+
+ /* Finally, install all globals. */
+ for (psy = psyms; (sy = *psy) != NULL; ++psy)
+ {
+ asection *s;
+
+ s = psecs[sy - syms];
+
+ /* Global syms might be improperly typed functions. */
+ if (ELF_ST_TYPE (sy->st_info) != STT_FUNC
+ && ELF_ST_BIND (sy->st_info) == STB_GLOBAL)
+ {
+ if (!maybe_insert_function (s, sy, FALSE, FALSE))
+ return FALSE;
+ }
+ }
+
+ /* Some of the symbols we've installed as marking the
+ beginning of functions may have a size of zero. Extend
+ the range of such functions to the beginning of the
+ next symbol of interest. */
+ for (sec = ibfd->sections; sec != NULL; sec = sec->next)
+ if (interesting_section (sec, output_bfd, htab))
+ {
+ struct _spu_elf_section_data *sec_data;
+ struct spu_elf_stack_info *sinfo;
+
+ sec_data = spu_elf_section_data (sec);
+ sinfo = sec_data->stack_info;
+ if (sinfo != NULL)
+ {
+ int fun_idx;
+ bfd_vma hi = sec->size;
+
+ for (fun_idx = sinfo->num_fun; --fun_idx >= 0; )
+ {
+ sinfo->fun[fun_idx].hi = hi;
+ hi = sinfo->fun[fun_idx].lo;
+ }
+ }
+ /* No symbols in this section. Must be .init or .fini
+ or something similar. */
+ else if (!pasted_function (sec, info))
+ return FALSE;
+ }
+ }
+ }
+
+ for (ibfd = info->input_bfds, bfd_idx = 0;
+ ibfd != NULL;
+ ibfd = ibfd->link_next, bfd_idx++)
+ {
+ if (psym_arr[bfd_idx] == NULL)
+ continue;
+
+ free (psym_arr[bfd_idx]);
+ free (sec_arr[bfd_idx]);
+ }
+
+ free (psym_arr);
+ free (sec_arr);
+
+ return TRUE;
+}
+
+/* Mark nodes in the call graph that are called by some other node. */
+
+static void
+mark_non_root (struct function_info *fun)
+{
+ struct call_info *call;
+
+ fun->visit1 = TRUE;
+ for (call = fun->call_list; call; call = call->next)
+ {
+ call->fun->non_root = TRUE;
+ if (!call->fun->visit1)
+ mark_non_root (call->fun);
+ }
+}
+
+/* Remove cycles from the call graph. */
+
+static void
+call_graph_traverse (struct function_info *fun, struct bfd_link_info *info)
+{
+ struct call_info **callp, *call;
+
+ fun->visit2 = TRUE;
+ fun->marking = TRUE;
+
+ callp = &fun->call_list;
+ while ((call = *callp) != NULL)
+ {
+ if (!call->fun->visit2)
+ call_graph_traverse (call->fun, info);
+ else if (call->fun->marking)
+ {
+ const char *f1 = func_name (fun);
+ const char *f2 = func_name (call->fun);
+
+ info->callbacks->info (_("Stack analysis will ignore the call "
+ "from %s to %s\n"),
+ f1, f2);
+ *callp = call->next;
+ continue;
+ }
+ callp = &call->next;
+ }
+ fun->marking = FALSE;
+}
+
+/* Populate call_list for each function. */
+
+static bfd_boolean
+build_call_tree (bfd *output_bfd, struct bfd_link_info *info)
+{
+ struct spu_link_hash_table *htab = spu_hash_table (info);
+ bfd *ibfd;
+
+ for (ibfd = info->input_bfds; ibfd != NULL; ibfd = ibfd->link_next)
+ {
+ extern const bfd_target bfd_elf32_spu_vec;
+ asection *sec;
+
+ if (ibfd->xvec != &bfd_elf32_spu_vec)
+ continue;
+
+ for (sec = ibfd->sections; sec != NULL; sec = sec->next)
+ {
+ if (!interesting_section (sec, output_bfd, htab)
+ || sec->reloc_count == 0)
+ continue;
+
+ if (!mark_functions_via_relocs (sec, info, TRUE))
+ return FALSE;
+ }
+
+ /* Transfer call info from hot/cold section part of function
+ to main entry. */
+ for (sec = ibfd->sections; sec != NULL; sec = sec->next)
+ {
+ struct _spu_elf_section_data *sec_data;
+ struct spu_elf_stack_info *sinfo;
+
+ if ((sec_data = spu_elf_section_data (sec)) != NULL
+ && (sinfo = sec_data->stack_info) != NULL)
+ {
+ int i;
+ for (i = 0; i < sinfo->num_fun; ++i)
+ {
+ if (sinfo->fun[i].start != NULL)
+ {
+ struct call_info *call = sinfo->fun[i].call_list;
+
+ while (call != NULL)
+ {
+ struct call_info *call_next = call->next;
+ if (!insert_callee (sinfo->fun[i].start, call))
+ free (call);
+ call = call_next;
+ }
+ sinfo->fun[i].call_list = NULL;
+ sinfo->fun[i].non_root = TRUE;
+ }
+ }
+ }
+ }
+ }
+
+ /* Find the call graph root(s). */
+ for (ibfd = info->input_bfds; ibfd != NULL; ibfd = ibfd->link_next)
+ {
+ extern const bfd_target bfd_elf32_spu_vec;
+ asection *sec;
+
+ if (ibfd->xvec != &bfd_elf32_spu_vec)
+ continue;
+
+ for (sec = ibfd->sections; sec != NULL; sec = sec->next)
+ {
+ struct _spu_elf_section_data *sec_data;
+ struct spu_elf_stack_info *sinfo;
+
+ if ((sec_data = spu_elf_section_data (sec)) != NULL
+ && (sinfo = sec_data->stack_info) != NULL)
+ {
+ int i;
+ for (i = 0; i < sinfo->num_fun; ++i)
+ if (!sinfo->fun[i].visit1)
+ mark_non_root (&sinfo->fun[i]);
+ }
+ }
+ }
+
+ /* Remove cycles from the call graph. We start from the root node(s)
+ so that we break cycles in a reasonable place. */
+ for (ibfd = info->input_bfds; ibfd != NULL; ibfd = ibfd->link_next)
+ {
+ extern const bfd_target bfd_elf32_spu_vec;
+ asection *sec;
+
+ if (ibfd->xvec != &bfd_elf32_spu_vec)
+ continue;
+
+ for (sec = ibfd->sections; sec != NULL; sec = sec->next)
+ {
+ struct _spu_elf_section_data *sec_data;
+ struct spu_elf_stack_info *sinfo;
+
+ if ((sec_data = spu_elf_section_data (sec)) != NULL
+ && (sinfo = sec_data->stack_info) != NULL)
+ {
+ int i;
+ for (i = 0; i < sinfo->num_fun; ++i)
+ if (!sinfo->fun[i].non_root)
+ call_graph_traverse (&sinfo->fun[i], info);
+ }
+ }
+ }
+
+ return TRUE;
+}
+
+/* Descend the call graph for FUN, accumulating total stack required. */
+
+static bfd_vma
+sum_stack (struct function_info *fun,
+ struct bfd_link_info *info,
+ int emit_stack_syms)
+{
+ struct call_info *call;
+ struct function_info *max = NULL;
+ bfd_vma max_stack = fun->stack;
+ bfd_vma stack;
+ const char *f1;
+
+ if (fun->visit3)
+ return max_stack;
+
+ for (call = fun->call_list; call; call = call->next)
+ {
+ stack = sum_stack (call->fun, info, emit_stack_syms);
+ /* Include caller stack for normal calls, don't do so for
+ tail calls. fun->stack here is local stack usage for
+ this function. */
+ if (!call->is_tail)
+ stack += fun->stack;
+ if (max_stack < stack)
+ {
+ max_stack = stack;
+ max = call->fun;
+ }
+ }
+
+ f1 = func_name (fun);
+ info->callbacks->minfo (_("%s: 0x%v 0x%v\n"), f1, fun->stack, max_stack);
+
+ if (fun->call_list)
+ {
+ info->callbacks->minfo (_(" calls:\n"));
+ for (call = fun->call_list; call; call = call->next)
+ {
+ const char *f2 = func_name (call->fun);
+ const char *ann1 = call->fun == max ? "*" : " ";
+ const char *ann2 = call->is_tail ? "t" : " ";
+
+ info->callbacks->minfo (_(" %s%s %s\n"), ann1, ann2, f2);
+ }
+ }
+
+ /* Now fun->stack holds cumulative stack. */
+ fun->stack = max_stack;
+ fun->visit3 = TRUE;
+
+ if (emit_stack_syms)
+ {
+ struct spu_link_hash_table *htab = spu_hash_table (info);
+ char *name = bfd_malloc (18 + strlen (f1));
+ struct elf_link_hash_entry *h;
+
+ if (name != NULL)
+ {
+ if (fun->global || ELF_ST_BIND (fun->u.sym->st_info) == STB_GLOBAL)
+ sprintf (name, "__stack_%s", f1);
+ else
+ sprintf (name, "__stack_%x_%s", fun->sec->id & 0xffffffff, f1);
+
+ h = elf_link_hash_lookup (&htab->elf, name, TRUE, TRUE, FALSE);
+ free (name);
+ if (h != NULL
+ && (h->root.type == bfd_link_hash_new
+ || h->root.type == bfd_link_hash_undefined
+ || h->root.type == bfd_link_hash_undefweak))
+ {
+ h->root.type = bfd_link_hash_defined;
+ h->root.u.def.section = bfd_abs_section_ptr;
+ h->root.u.def.value = max_stack;
+ h->size = 0;
+ h->type = 0;
+ h->ref_regular = 1;
+ h->def_regular = 1;
+ h->ref_regular_nonweak = 1;
+ h->forced_local = 1;
+ h->non_elf = 0;
+ }
+ }
+ }
+
+ return max_stack;
+}
+
+/* Provide an estimate of total stack required. */
+
+static bfd_boolean
+spu_elf_stack_analysis (bfd *output_bfd,
+ struct bfd_link_info *info,
+ int emit_stack_syms)
+{
+ bfd *ibfd;
+ bfd_vma max_stack = 0;
+
+ if (!discover_functions (output_bfd, info))
+ return FALSE;
+
+ if (!build_call_tree (output_bfd, info))
+ return FALSE;
+
+ info->callbacks->info (_("Stack size for call graph root nodes.\n"));
+ info->callbacks->minfo (_("\nStack size for functions. "
+ "Annotations: '*' max stack, 't' tail call\n"));
+ for (ibfd = info->input_bfds; ibfd != NULL; ibfd = ibfd->link_next)
+ {
+ extern const bfd_target bfd_elf32_spu_vec;
+ asection *sec;
+
+ if (ibfd->xvec != &bfd_elf32_spu_vec)
+ continue;
+
+ for (sec = ibfd->sections; sec != NULL; sec = sec->next)
+ {
+ struct _spu_elf_section_data *sec_data;
+ struct spu_elf_stack_info *sinfo;
+
+ if ((sec_data = spu_elf_section_data (sec)) != NULL
+ && (sinfo = sec_data->stack_info) != NULL)
+ {
+ int i;
+ for (i = 0; i < sinfo->num_fun; ++i)
+ {
+ if (!sinfo->fun[i].non_root)
+ {
+ bfd_vma stack;
+ const char *f1;
+
+ stack = sum_stack (&sinfo->fun[i], info,
+ emit_stack_syms);
+ f1 = func_name (&sinfo->fun[i]);
+ info->callbacks->info (_(" %s: 0x%v\n"),
+ f1, stack);
+ if (max_stack < stack)
+ max_stack = stack;
+ }
+ }
+ }
+ }
+ }
+
+ info->callbacks->info (_("Maximum stack required is 0x%v\n"), max_stack);
+ return TRUE;
+}
+
+/* Perform a final link. */
+
+static bfd_boolean
+spu_elf_final_link (bfd *output_bfd, struct bfd_link_info *info)
+{
+ struct spu_link_hash_table *htab = spu_hash_table (info);
+
+ if (htab->stack_analysis
+ && !spu_elf_stack_analysis (output_bfd, info, htab->emit_stack_syms))
+ info->callbacks->einfo ("%X%P: stack analysis error: %E\n");
+
+ return bfd_elf_final_link (output_bfd, info);
+}
+
+/* Called when not normally emitting relocs, ie. !info->relocatable
+ and !info->emitrelocations. Returns a count of special relocs
+ that need to be emitted. */
+
+static unsigned int
+spu_elf_count_relocs (asection *sec, Elf_Internal_Rela *relocs)
+{
+ unsigned int count = 0;
+ Elf_Internal_Rela *relend = relocs + sec->reloc_count;
+
+ for (; relocs < relend; relocs++)
+ {
+ int r_type = ELF32_R_TYPE (relocs->r_info);
+ if (r_type == R_SPU_PPU32 || r_type == R_SPU_PPU64)
+ ++count;
+ }
+
+ return count;
+}
+
+/* Apply RELOCS to CONTENTS of INPUT_SECTION from INPUT_BFD. */
+
+static bfd_boolean
+spu_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;
+ Elf_Internal_Rela *rel, *relend;
+ struct spu_link_hash_table *htab;
+ bfd_boolean ret = TRUE;
+ bfd_boolean emit_these_relocs = FALSE;
+
+ htab = spu_hash_table (info);
+ symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr;
+ sym_hashes = (struct elf_link_hash_entry **) (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;
+ const char *sym_name;
+ bfd_vma relocation;
+ bfd_vma addend;
+ bfd_reloc_status_type r;
+ bfd_boolean unresolved_reloc;
+ bfd_boolean warned;
+ bfd_boolean branch;
+
+ r_symndx = ELF32_R_SYM (rel->r_info);
+ r_type = ELF32_R_TYPE (rel->r_info);
+ if (r_type == R_SPU_PPU32 || r_type == R_SPU_PPU64)
+ {
+ emit_these_relocs = TRUE;
+ continue;
+ }
+
+ howto = elf_howto_table + r_type;
+ unresolved_reloc = FALSE;
+ warned = FALSE;
+ h = NULL;
+ sym = NULL;
+ sec = NULL;
+ if (r_symndx < symtab_hdr->sh_info)
+ {
+ sym = local_syms + r_symndx;
+ sec = local_sections[r_symndx];
+ sym_name = bfd_elf_sym_name (input_bfd, symtab_hdr, sym, sec);
+ 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;
+ }
+
+ if (sec != NULL && elf_discarded_section (sec))
+ {
+ /* For relocs against symbols from removed linkonce sections,
+ or sections discarded by a linker script, we just want the
+ section contents zeroed. Avoid any special processing. */
+ _bfd_clear_contents (howto, input_bfd, contents + rel->r_offset);
+ rel->r_info = 0;
+ rel->r_addend = 0;
+ continue;
+ }
+
+ if (info->relocatable)
+ continue;
+
+ if (unresolved_reloc)
+ {
+ (*_bfd_error_handler)
+ (_("%B(%s+0x%lx): unresolvable %s relocation against symbol `%s'"),
+ input_bfd,
+ bfd_get_section_name (input_bfd, input_section),
+ (long) rel->r_offset,
+ howto->name,
+ sym_name);
+ ret = FALSE;
+ }
+
+ /* If this symbol is in an overlay area, we may need to relocate
+ to the overlay stub. */
+ addend = rel->r_addend;
+ branch = (is_branch (contents + rel->r_offset)
+ || is_hint (contents + rel->r_offset));
+ if (needs_ovl_stub (sym_name, sec, input_section, htab, branch))
+ {
+ char *stub_name;
+ struct spu_stub_hash_entry *sh;
+
+ stub_name = spu_stub_name (sec, h, rel);
+ if (stub_name == NULL)
+ return FALSE;
+
+ sh = (struct spu_stub_hash_entry *)
+ bfd_hash_lookup (&htab->stub_hash_table, stub_name, FALSE, FALSE);
+ if (sh != NULL)
+ {
+ relocation = (htab->stub->output_section->vma
+ + htab->stub->output_offset
+ + sh->off);
+ addend = 0;
+ }
+ free (stub_name);
+ }
+
+ r = _bfd_final_link_relocate (howto,
+ input_bfd,
+ input_section,
+ contents,
+ rel->r_offset, relocation, addend);
+
+ if (r != bfd_reloc_ok)
+ {
+ const char *msg = (const char *) 0;
+
+ switch (r)
+ {
+ case bfd_reloc_overflow:
+ if (!((*info->callbacks->reloc_overflow)
+ (info, (h ? &h->root : NULL), sym_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, sym_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, sym_name, input_bfd, input_section,
+ rel->r_offset)))
+ return FALSE;
+ break;
+ }
+ }
+ }
+
+ if (ret
+ && emit_these_relocs
+ && !info->relocatable
+ && !info->emitrelocations)
+ {
+ Elf_Internal_Rela *wrel;
+ Elf_Internal_Shdr *rel_hdr;
+
+ wrel = rel = relocs;
+ relend = relocs + input_section->reloc_count;
+ for (; rel < relend; rel++)
+ {
+ int r_type;
+
+ r_type = ELF32_R_TYPE (rel->r_info);
+ if (r_type == R_SPU_PPU32 || r_type == R_SPU_PPU64)
+ *wrel++ = *rel;
+ }
+ input_section->reloc_count = wrel - relocs;
+ /* Backflips for _bfd_elf_link_output_relocs. */
+ rel_hdr = &elf_section_data (input_section)->rel_hdr;
+ rel_hdr->sh_size = input_section->reloc_count * rel_hdr->sh_entsize;
+ ret = 2;
+ }
+
+ return ret;
+}
+
+/* Adjust _SPUEAR_ syms to point at their overlay stubs. */
+
+static bfd_boolean
+spu_elf_output_symbol_hook (struct bfd_link_info *info,
+ const char *sym_name ATTRIBUTE_UNUSED,
+ Elf_Internal_Sym *sym,
+ asection *sym_sec ATTRIBUTE_UNUSED,
+ struct elf_link_hash_entry *h)
+{
+ struct spu_link_hash_table *htab = spu_hash_table (info);
+
+ if (!info->relocatable
+ && htab->num_overlays != 0
+ && h != NULL
+ && (h->root.type == bfd_link_hash_defined
+ || h->root.type == bfd_link_hash_defweak)
+ && h->def_regular
+ && strncmp (h->root.root.string, "_SPUEAR_", 8) == 0)
+ {
+ static Elf_Internal_Rela zero_rel;
+ char *stub_name = spu_stub_name (h->root.u.def.section, h, &zero_rel);
+ struct spu_stub_hash_entry *sh;
+
+ if (stub_name == NULL)
+ return FALSE;
+ sh = (struct spu_stub_hash_entry *)
+ bfd_hash_lookup (&htab->stub_hash_table, stub_name, FALSE, FALSE);
+ free (stub_name);
+ if (sh == NULL)
+ return TRUE;
+ sym->st_shndx
+ = _bfd_elf_section_from_bfd_section (htab->stub->output_section->owner,
+ htab->stub->output_section);
+ sym->st_value = (htab->stub->output_section->vma
+ + htab->stub->output_offset
+ + sh->off);
+ }
+
+ return TRUE;
+}
+
+static int spu_plugin = 0;
+
+void
+spu_elf_plugin (int val)
+{
+ spu_plugin = val;
+}
+
+/* Set ELF header e_type for plugins. */
+
+static void
+spu_elf_post_process_headers (bfd *abfd,
+ struct bfd_link_info *info ATTRIBUTE_UNUSED)
+{
+ if (spu_plugin)
+ {
+ Elf_Internal_Ehdr *i_ehdrp = elf_elfheader (abfd);
+
+ i_ehdrp->e_type = ET_DYN;
+ }
+}
+
+/* We may add an extra PT_LOAD segment for .toe. We also need extra
+ segments for overlays. */
+
+static int
+spu_elf_additional_program_headers (bfd *abfd, struct bfd_link_info *info)
+{
+ struct spu_link_hash_table *htab = spu_hash_table (info);
+ int extra = htab->num_overlays;
+ asection *sec;
+
+ if (extra)
+ ++extra;
+
+ sec = bfd_get_section_by_name (abfd, ".toe");
+ if (sec != NULL && (sec->flags & SEC_LOAD) != 0)
+ ++extra;
+
+ return extra;
+}
+
+/* Remove .toe section from other PT_LOAD segments and put it in
+ a segment of its own. Put overlays in separate segments too. */
+
+static bfd_boolean
+spu_elf_modify_segment_map (bfd *abfd, struct bfd_link_info *info)
+{
+ asection *toe, *s;
+ struct elf_segment_map *m;
+ unsigned int i;
+
+ if (info == NULL)
+ return TRUE;
+
+ toe = bfd_get_section_by_name (abfd, ".toe");
+ for (m = elf_tdata (abfd)->segment_map; m != NULL; m = m->next)
+ if (m->p_type == PT_LOAD && m->count > 1)
+ for (i = 0; i < m->count; i++)
+ if ((s = m->sections[i]) == toe
+ || spu_elf_section_data (s)->ovl_index != 0)
+ {
+ struct elf_segment_map *m2;
+ bfd_vma amt;
+
+ if (i + 1 < m->count)
+ {
+ amt = sizeof (struct elf_segment_map);
+ amt += (m->count - (i + 2)) * sizeof (m->sections[0]);
+ m2 = bfd_zalloc (abfd, amt);
+ if (m2 == NULL)
+ return FALSE;
+ m2->count = m->count - (i + 1);
+ memcpy (m2->sections, m->sections + i + 1,
+ m2->count * sizeof (m->sections[0]));
+ m2->p_type = PT_LOAD;
+ m2->next = m->next;
+ m->next = m2;
+ }
+ m->count = 1;
+ if (i != 0)
+ {
+ m->count = i;
+ amt = sizeof (struct elf_segment_map);
+ m2 = bfd_zalloc (abfd, amt);
+ if (m2 == NULL)
+ return FALSE;
+ m2->p_type = PT_LOAD;
+ m2->count = 1;
+ m2->sections[0] = s;
+ m2->next = m->next;
+ m->next = m2;
+ }
+ break;
+ }
+
+ return TRUE;
+}
+
+/* Check that all loadable section VMAs lie in the range
+ LO .. HI inclusive. */
+
+asection *
+spu_elf_check_vma (bfd *abfd, bfd_vma lo, bfd_vma hi)
+{
+ struct elf_segment_map *m;
+ unsigned int i;
+
+ for (m = elf_tdata (abfd)->segment_map; m != NULL; m = m->next)
+ if (m->p_type == PT_LOAD)
+ for (i = 0; i < m->count; i++)
+ if (m->sections[i]->size != 0
+ && (m->sections[i]->vma < lo
+ || m->sections[i]->vma > hi
+ || m->sections[i]->vma + m->sections[i]->size - 1 > hi))
+ return m->sections[i];
+
+ return NULL;
+}
+
+/* Tweak the section type of .note.spu_name. */
+
+static bfd_boolean
+spu_elf_fake_sections (bfd *obfd ATTRIBUTE_UNUSED,
+ Elf_Internal_Shdr *hdr,
+ asection *sec)
+{
+ if (strcmp (sec->name, SPU_PTNOTE_SPUNAME) == 0)
+ hdr->sh_type = SHT_NOTE;
+ return TRUE;
+}
+
+/* Tweak phdrs before writing them out. */
+
+static int
+spu_elf_modify_program_headers (bfd *abfd, struct bfd_link_info *info)
+{
+ const struct elf_backend_data *bed;
+ struct elf_obj_tdata *tdata;
+ Elf_Internal_Phdr *phdr, *last;
+ struct spu_link_hash_table *htab;
+ unsigned int count;
+ unsigned int i;
+
+ if (info == NULL)
+ return TRUE;
+
+ bed = get_elf_backend_data (abfd);
+ tdata = elf_tdata (abfd);
+ phdr = tdata->phdr;
+ count = tdata->program_header_size / bed->s->sizeof_phdr;
+ htab = spu_hash_table (info);
+ if (htab->num_overlays != 0)
+ {
+ struct elf_segment_map *m;
+ unsigned int o;
+
+ for (i = 0, m = elf_tdata (abfd)->segment_map; m; ++i, m = m->next)
+ if (m->count != 0
+ && (o = spu_elf_section_data (m->sections[0])->ovl_index) != 0)
+ {
+ /* Mark this as an overlay header. */
+ phdr[i].p_flags |= PF_OVERLAY;
+
+ if (htab->ovtab != NULL && htab->ovtab->size != 0)
+ {
+ bfd_byte *p = htab->ovtab->contents;
+ unsigned int off = (o - 1) * 16 + 8;
+
+ /* Write file_off into _ovly_table. */
+ bfd_put_32 (htab->ovtab->owner, phdr[i].p_offset, p + off);
+ }
+ }
+ }
+
+ /* Round up p_filesz and p_memsz of PT_LOAD segments to multiples
+ of 16. This should always be possible when using the standard
+ linker scripts, but don't create overlapping segments if
+ someone is playing games with linker scripts. */
+ last = NULL;
+ for (i = count; i-- != 0; )
+ if (phdr[i].p_type == PT_LOAD)
+ {
+ unsigned adjust;
+
+ adjust = -phdr[i].p_filesz & 15;
+ if (adjust != 0
+ && last != NULL
+ && phdr[i].p_offset + phdr[i].p_filesz > last->p_offset - adjust)
+ break;
+
+ adjust = -phdr[i].p_memsz & 15;
+ if (adjust != 0
+ && last != NULL
+ && phdr[i].p_filesz != 0
+ && phdr[i].p_vaddr + phdr[i].p_memsz > last->p_vaddr - adjust
+ && phdr[i].p_vaddr + phdr[i].p_memsz <= last->p_vaddr)
+ break;
+
+ if (phdr[i].p_filesz != 0)
+ last = &phdr[i];
+ }
+
+ if (i == (unsigned int) -1)
+ for (i = count; i-- != 0; )
+ if (phdr[i].p_type == PT_LOAD)
+ {
+ unsigned adjust;
+
+ adjust = -phdr[i].p_filesz & 15;
+ phdr[i].p_filesz += adjust;
+
+ adjust = -phdr[i].p_memsz & 15;
+ phdr[i].p_memsz += adjust;
+ }
+
+ return TRUE;
+}
+
+#define TARGET_BIG_SYM bfd_elf32_spu_vec
+#define TARGET_BIG_NAME "elf32-spu"
+#define ELF_ARCH bfd_arch_spu
+#define ELF_MACHINE_CODE EM_SPU
+/* This matches the alignment need for DMA. */
+#define ELF_MAXPAGESIZE 0x80
+#define elf_backend_rela_normal 1
+#define elf_backend_can_gc_sections 1
+
+#define bfd_elf32_bfd_reloc_type_lookup spu_elf_reloc_type_lookup
+#define bfd_elf32_bfd_reloc_name_lookup spu_elf_reloc_name_lookup
+#define elf_info_to_howto spu_elf_info_to_howto
+#define elf_backend_count_relocs spu_elf_count_relocs
+#define elf_backend_relocate_section spu_elf_relocate_section
+#define elf_backend_symbol_processing spu_elf_backend_symbol_processing
+#define elf_backend_link_output_symbol_hook spu_elf_output_symbol_hook
+#define bfd_elf32_new_section_hook spu_elf_new_section_hook
+#define bfd_elf32_bfd_link_hash_table_create spu_elf_link_hash_table_create
+#define bfd_elf32_bfd_link_hash_table_free spu_elf_link_hash_table_free
+
+#define elf_backend_additional_program_headers spu_elf_additional_program_headers
+#define elf_backend_modify_segment_map spu_elf_modify_segment_map
+#define elf_backend_modify_program_headers spu_elf_modify_program_headers
+#define elf_backend_post_process_headers spu_elf_post_process_headers
+#define elf_backend_fake_sections spu_elf_fake_sections
+#define elf_backend_special_sections spu_elf_special_sections
+#define bfd_elf32_bfd_final_link spu_elf_final_link
+
+#include "elf32-target.h"
diff --git a/contrib/binutils/bfd/elf32-spu.h b/contrib/binutils/bfd/elf32-spu.h
new file mode 100644
index 0000000..b74c310
--- /dev/null
+++ b/contrib/binutils/bfd/elf32-spu.h
@@ -0,0 +1,57 @@
+/* SPU specific support for 32-bit ELF.
+
+ Copyright 2006, 2007 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. */
+
+/* Extra info kept for SPU sections. */
+
+struct spu_elf_stack_info;
+
+struct _spu_elf_section_data
+{
+ struct bfd_elf_section_data elf;
+
+ /* Stack analysis info kept for this section. */
+
+ struct spu_elf_stack_info *stack_info;
+
+ /* Non-zero for overlay output sections. */
+ unsigned int ovl_index;
+};
+
+#define spu_elf_section_data(sec) \
+ ((struct _spu_elf_section_data *) elf_section_data (sec))
+
+struct _ovl_stream
+{
+ const void *start;
+ const void *end;
+};
+
+extern void spu_elf_plugin (int);
+extern bfd_boolean spu_elf_open_builtin_lib (bfd **,
+ const struct _ovl_stream *);
+extern bfd_boolean spu_elf_create_sections (bfd *,
+ struct bfd_link_info *, int, int);
+extern bfd_boolean spu_elf_find_overlays (bfd *, struct bfd_link_info *);
+extern bfd_boolean spu_elf_size_stubs (bfd *, struct bfd_link_info *, int, int,
+ asection **, asection **,
+ asection **);
+extern bfd_boolean spu_elf_build_stubs (struct bfd_link_info *, int,
+ asection *);
+extern asection *spu_elf_check_vma (bfd *, bfd_vma, bfd_vma);
diff --git a/contrib/binutils/bfd/elf32.c b/contrib/binutils/bfd/elf32.c
index bfadd5c..6221f0a 100644
--- a/contrib/binutils/bfd/elf32.c
+++ b/contrib/binutils/bfd/elf32.c
@@ -15,7 +15,7 @@ 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. */
+Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
#define ARCH_SIZE 32
diff --git a/contrib/binutils/bfd/elf64-alpha.c b/contrib/binutils/bfd/elf64-alpha.c
index 2d4715b..3a1f8ec 100644
--- a/contrib/binutils/bfd/elf64-alpha.c
+++ b/contrib/binutils/bfd/elf64-alpha.c
@@ -1,6 +1,6 @@
/* Alpha specific support for 64-bit ELF
- Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004
- Free Software Foundation, Inc.
+ Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
+ 2006, 2007 Free Software Foundation, Inc.
Contributed by Richard Henderson <rth@tamu.edu>.
This file is part of BFD, the Binary File Descriptor library.
@@ -17,13 +17,13 @@
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. */
+ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, 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 "bfd.h"
#include "libbfd.h"
#include "elf-bfd.h"
@@ -47,116 +47,59 @@
#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;
+
+/* Instruction data for plt generation and relaxation. */
+
+#define OP_LDA 0x08
+#define OP_LDAH 0x09
+#define OP_LDQ 0x29
+#define OP_BR 0x30
+#define OP_BSR 0x34
+
+#define INSN_LDA (OP_LDA << 26)
+#define INSN_LDAH (OP_LDAH << 26)
+#define INSN_LDQ (OP_LDQ << 26)
+#define INSN_BR (OP_BR << 26)
+
+#define INSN_ADDQ 0x40000400
+#define INSN_RDUNIQ 0x0000009e
+#define INSN_SUBQ 0x40000520
+#define INSN_S4SUBQ 0x40000560
+#define INSN_UNOP 0x2ffe0000
+
+#define INSN_JSR 0x68004000
+#define INSN_JMP 0x68000000
+#define INSN_JSR_MASK 0xfc00c000
+
+#define INSN_A(I,A) (I | (A << 21))
+#define INSN_AB(I,A,B) (I | (A << 21) | (B << 16))
+#define INSN_ABC(I,A,B,C) (I | (A << 21) | (B << 16) | C)
+#define INSN_ABO(I,A,B,O) (I | (A << 21) | (B << 16) | ((O) & 0xffff))
+#define INSN_AD(I,A,D) (I | (A << 21) | (((D) >> 2) & 0x1fffff))
+
+/* PLT/GOT Stuff */
+
+/* Set by ld emulation. Putting this into the link_info or hash structure
+ is simply working too hard. */
+#ifdef USE_SECUREPLT
+bfd_boolean elf64_alpha_use_secureplt = TRUE;
+#else
+bfd_boolean elf64_alpha_use_secureplt = FALSE;
#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 *));
+#define OLD_PLT_HEADER_SIZE 32
+#define OLD_PLT_ENTRY_SIZE 12
+#define NEW_PLT_HEADER_SIZE 36
+#define NEW_PLT_ENTRY_SIZE 4
+
+#define PLT_HEADER_SIZE \
+ (elf64_alpha_use_secureplt ? NEW_PLT_HEADER_SIZE : OLD_PLT_HEADER_SIZE)
+#define PLT_ENTRY_SIZE \
+ (elf64_alpha_use_secureplt ? NEW_PLT_ENTRY_SIZE : OLD_PLT_ENTRY_SIZE)
+
+#define MAX_GOT_SIZE (64*1024)
+
+#define ELF_DYNAMIC_INTERPRETER "/usr/lib/ld.so"
struct alpha_elf_link_hash_entry
{
@@ -169,19 +112,15 @@ struct alpha_elf_link_hash_entry
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;
+#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_JSRDIRECT 0x40
+#define ALPHA_ELF_LINK_HASH_LU_PLT 0x38
+#define ALPHA_ELF_LINK_HASH_TLS_IE 0x80
/* Used to implement multiple .got subsections. */
struct alpha_elf_got_entry
@@ -197,6 +136,9 @@ struct alpha_elf_link_hash_entry
/* The .got offset for this entry. */
int got_offset;
+ /* The .plt offset for this entry. */
+ int plt_offset;
+
/* How many references to this entry? */
int use_count;
@@ -242,6 +184,10 @@ struct alpha_elf_link_hash_table
/* The head of a list of .got subsections linked through
alpha_elf_tdata(abfd)->got_link_next. */
bfd *got_list;
+
+ /* The most recent relax pass that we've seen. The GOTs
+ should be regenerated if this doesn't match. */
+ int relax_trip;
};
/* Look up an entry in a Alpha ELF linker hash table. */
@@ -256,7 +202,7 @@ struct alpha_elf_link_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), \
+ (bfd_boolean (*) (struct elf_link_hash_entry *, PTR)) (func), \
(info)))
/* Get the Alpha ELF linker hash table from a link_info structure. */
@@ -275,9 +221,8 @@ struct alpha_elf_link_hash_table
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;
+alpha_elf_dynamic_symbol_p (struct elf_link_hash_entry *h,
+ struct bfd_link_info *info)
{
return _bfd_elf_dynamic_symbol_p (h, info, 0);
}
@@ -285,10 +230,9 @@ alpha_elf_dynamic_symbol_p (h, info)
/* 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;
+elf64_alpha_link_hash_newfunc (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;
@@ -324,8 +268,7 @@ elf64_alpha_link_hash_newfunc (entry, table, string)
/* Create a Alpha ELF linker hash table. */
static struct bfd_link_hash_table *
-elf64_alpha_bfd_link_hash_table_create (abfd)
- bfd *abfd;
+elf64_alpha_bfd_link_hash_table_create (bfd *abfd)
{
struct alpha_elf_link_hash_table *ret;
bfd_size_type amt = sizeof (struct alpha_elf_link_hash_table);
@@ -334,8 +277,9 @@ elf64_alpha_bfd_link_hash_table_create (abfd)
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))
+ if (!_bfd_elf_link_hash_table_init (&ret->root, abfd,
+ elf64_alpha_link_hash_newfunc,
+ sizeof (struct alpha_elf_link_hash_entry)))
{
free (ret);
return NULL;
@@ -379,24 +323,136 @@ struct alpha_elf_obj_tdata
((struct alpha_elf_obj_tdata *) (abfd)->tdata.any)
static bfd_boolean
-elf64_alpha_mkobject (abfd)
- bfd *abfd;
+elf64_alpha_mkobject (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;
+ {
+ 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 bfd_elf_mkobject (abfd);
}
static bfd_boolean
-elf64_alpha_object_p (abfd)
- bfd *abfd;
+elf64_alpha_object_p (bfd *abfd)
{
/* Set the right machine number for an Alpha ELF file. */
return bfd_default_set_arch_mach (abfd, bfd_arch_alpha, 0);
}
+/* A relocation function which doesn't do anything. */
+
+static bfd_reloc_status_type
+elf64_alpha_reloc_nil (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 (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 (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 (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_vma high_address;
+ 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;
+ }
+
+ high_address = bfd_get_section_limit (abfd, input_section);
+ if (reloc_entry->address > high_address
+ || reloc_entry->address + reloc_entry->addend > high_address)
+ 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;
+}
+
/* 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)
@@ -944,131 +1000,6 @@ static reloc_howto_type elf64_alpha_howto_table[] =
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
@@ -1114,9 +1045,8 @@ static const struct elf_reloc_map elf64_alpha_reloc_map[] =
/* 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;
+elf64_alpha_bfd_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED,
+ bfd_reloc_code_real_type code)
{
const struct elf_reloc_map *i, *e;
i = e = elf64_alpha_reloc_map;
@@ -1129,17 +1059,30 @@ elf64_alpha_bfd_reloc_type_lookup (abfd, code)
return 0;
}
+static reloc_howto_type *
+elf64_alpha_bfd_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED,
+ const char *r_name)
+{
+ unsigned int i;
+
+ for (i = 0;
+ i < (sizeof (elf64_alpha_howto_table)
+ / sizeof (elf64_alpha_howto_table[0]));
+ i++)
+ if (elf64_alpha_howto_table[i].name != NULL
+ && strcasecmp (elf64_alpha_howto_table[i].name, r_name) == 0)
+ return &elf64_alpha_howto_table[i];
+
+ return NULL;
+}
+
/* 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;
+elf64_alpha_info_to_howto (bfd *abfd ATTRIBUTE_UNUSED, arelent *cache_ptr,
+ Elf_Internal_Rela *dst)
{
- unsigned r_type;
-
- r_type = ELF64_R_TYPE(dst->r_info);
+ unsigned 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];
}
@@ -1159,1124 +1102,17 @@ elf64_alpha_info_to_howto (abfd, cache_ptr, dst)
- 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.
+ is called when bfd_section_from_shdr 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;
+elf64_alpha_section_from_shdr (bfd *abfd,
+ Elf_Internal_Shdr *hdr,
+ const char *name,
+ int shindex)
{
asection *newsect;
@@ -2295,7 +1131,7 @@ elf64_alpha_section_from_shdr (abfd, hdr, name)
return FALSE;
}
- if (! _bfd_elf_make_section_from_shdr (abfd, hdr, name))
+ if (! _bfd_elf_make_section_from_shdr (abfd, hdr, name, shindex))
return FALSE;
newsect = hdr->bfd_section;
@@ -2313,9 +1149,7 @@ elf64_alpha_section_from_shdr (abfd, hdr, name)
/* 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;
+elf64_alpha_section_flags (flagword *flags, const Elf_Internal_Shdr *hdr)
{
if (hdr->sh_flags & SHF_ALPHA_GPREL)
*flags |= SEC_SMALL_DATA;
@@ -2327,10 +1161,7 @@ elf64_alpha_section_flags (flags, hdr)
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;
+elf64_alpha_fake_sections (bfd *abfd, Elf_Internal_Shdr *hdr, asection *sec)
{
register const char *name;
@@ -2360,14 +1191,11 @@ elf64_alpha_fake_sections (abfd, hdr, sec)
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;
+elf64_alpha_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
@@ -2380,11 +1208,11 @@ elf64_alpha_add_symbol_hook (abfd, info, sym, namep, flagsp, secp, valp)
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)))
+ scomm = bfd_make_section_with_flags (abfd, ".scommon",
+ (SEC_ALLOC
+ | SEC_IS_COMMON
+ | SEC_LINKER_CREATED));
+ if (scomm == NULL)
return FALSE;
}
@@ -2398,96 +1226,82 @@ elf64_alpha_add_symbol_hook (abfd, info, sym, namep, flagsp, secp, valp)
/* Create the .got section. */
static bfd_boolean
-elf64_alpha_create_got_section(abfd, info)
- bfd *abfd;
- struct bfd_link_info *info ATTRIBUTE_UNUSED;
+elf64_alpha_create_got_section (bfd *abfd,
+ struct bfd_link_info *info ATTRIBUTE_UNUSED)
{
+ flagword flags;
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");
+ flags = (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS | SEC_IN_MEMORY
+ | SEC_LINKER_CREATED);
+ s = bfd_make_section_anyway_with_flags (abfd, ".got", flags);
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;
+ /* 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;
+
return TRUE;
}
/* Create all the dynamic sections. */
static bfd_boolean
-elf64_alpha_create_dynamic_sections (abfd, info)
- bfd *abfd;
- struct bfd_link_info *info;
+elf64_alpha_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info)
{
asection *s;
+ flagword flags;
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))
+ flags = (SEC_ALLOC | SEC_LOAD | SEC_CODE | SEC_HAS_CONTENTS | SEC_IN_MEMORY
+ | SEC_LINKER_CREATED
+ | (elf64_alpha_use_secureplt ? SEC_READONLY : 0));
+ s = bfd_make_section_anyway_with_flags (abfd, ".plt", flags);
+ if (s == NULL || ! bfd_set_section_alignment (abfd, s, 4))
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)))
+ h = _bfd_elf_define_linkage_sym (abfd, info, s,
+ "_PROCEDURE_LINKAGE_TABLE_");
+ elf_hash_table (info)->hplt = h;
+ if (h == NULL)
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))
+ flags = (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS | SEC_IN_MEMORY
+ | SEC_LINKER_CREATED | SEC_READONLY);
+ s = bfd_make_section_anyway_with_flags (abfd, ".rela.plt", flags);
+ if (s == NULL || ! bfd_set_section_alignment (abfd, s, 3))
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;
+ if (elf64_alpha_use_secureplt)
+ {
+ flags = SEC_ALLOC | SEC_LINKER_CREATED;
+ s = bfd_make_section_anyway_with_flags (abfd, ".got.plt", flags);
+ if (s == NULL || ! 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;
+ if (alpha_elf_tdata(abfd)->gotobj == NULL)
+ {
+ if (!elf64_alpha_create_got_section (abfd, info))
+ return FALSE;
+ }
- s = bfd_make_section(abfd, ".rela.got");
+ flags = (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS | SEC_IN_MEMORY
+ | SEC_LINKER_CREATED | SEC_READONLY);
+ s = bfd_make_section_anyway_with_flags (abfd, ".rela.got", flags);
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;
@@ -2495,21 +1309,11 @@ elf64_alpha_create_dynamic_sections (abfd, info)
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;
-
+ h = _bfd_elf_define_linkage_sym (abfd, info, alpha_elf_tdata(abfd)->got,
+ "_GLOBAL_OFFSET_TABLE_");
elf_hash_table (info)->hgot = h;
+ if (h == NULL)
+ return FALSE;
return TRUE;
}
@@ -2518,10 +1322,8 @@ elf64_alpha_create_dynamic_sections (abfd, info)
ecoff_debug_info structure. */
static bfd_boolean
-elf64_alpha_read_ecoff_info (abfd, section, debug)
- bfd *abfd;
- asection *section;
- struct ecoff_debug_info *debug;
+elf64_alpha_read_ecoff_info (bfd *abfd, asection *section,
+ struct ecoff_debug_info *debug)
{
HDRR *symhdr;
const struct ecoff_debug_swap *swap;
@@ -2572,7 +1374,6 @@ elf64_alpha_read_ecoff_info (abfd, section, debug)
#undef READ
debug->fdr = NULL;
- debug->adjust = NULL;
return TRUE;
@@ -2607,9 +1408,7 @@ elf64_alpha_read_ecoff_info (abfd, section, debug)
/* Alpha ELF local labels start with '$'. */
static bfd_boolean
-elf64_alpha_is_local_label_name (abfd, name)
- bfd *abfd ATTRIBUTE_UNUSED;
- const char *name;
+elf64_alpha_is_local_label_name (bfd *abfd ATTRIBUTE_UNUSED, const char *name)
{
return name[0] == '$';
}
@@ -2626,15 +1425,10 @@ struct mips_elf_find_line
};
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;
+elf64_alpha_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;
@@ -2737,9 +1531,7 @@ struct extsym_info
};
static bfd_boolean
-elf64_alpha_output_extsym (h, data)
- struct alpha_elf_link_hash_entry *h;
- PTR data;
+elf64_alpha_output_extsym (struct alpha_elf_link_hash_entry *h, PTR data)
{
struct extsym_info *einfo = (struct extsym_info *) data;
bfd_boolean strip;
@@ -2750,10 +1542,11 @@ elf64_alpha_output_extsym (h, data)
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)
+ else if ((h->root.def_dynamic
+ || h->root.ref_dynamic
+ || h->root.root.type == bfd_link_hash_new)
+ && !h->root.def_regular
+ && !h->root.ref_regular)
strip = TRUE;
else if (einfo->info->strip == strip_all
|| (einfo->info->strip == strip_some
@@ -2840,24 +1633,6 @@ elf64_alpha_output_extsym (h, data)
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,
@@ -2873,11 +1648,9 @@ elf64_alpha_output_extsym (h, data)
/* 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;
+get_got_entry (bfd *abfd, struct alpha_elf_link_hash_entry *h,
+ unsigned long r_type, unsigned long r_symndx,
+ bfd_vma r_addend)
{
struct alpha_elf_got_entry *gotent;
struct alpha_elf_got_entry **slot;
@@ -2930,6 +1703,7 @@ get_got_entry (abfd, h, r_type, r_symndx, r_addend)
gotent->gotobj = abfd;
gotent->addend = r_addend;
gotent->got_offset = -1;
+ gotent->plt_offset = -1;
gotent->use_count = 1;
gotent->reloc_type = r_type;
gotent->reloc_done = 0;
@@ -2949,14 +1723,21 @@ get_got_entry (abfd, h, r_type, r_symndx, r_addend)
return gotent;
}
+static bfd_boolean
+elf64_alpha_want_plt (struct alpha_elf_link_hash_entry *ah)
+{
+ return ((ah->root.type == STT_FUNC
+ || ah->root.root.type == bfd_link_hash_undefweak
+ || ah->root.root.type == bfd_link_hash_undefined)
+ && (ah->flags & ALPHA_ELF_LINK_HASH_LU_PLT) != 0
+ && (ah->flags & ~ALPHA_ELF_LINK_HASH_LU_PLT) == 0);
+}
+
/* 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;
+elf64_alpha_check_relocs (bfd *abfd, struct bfd_link_info *info,
+ asection *sec, const Elf_Internal_Rela *relocs)
{
bfd *dynobj;
asection *sreloc;
@@ -2964,12 +1745,20 @@ elf64_alpha_check_relocs (abfd, info, sec, relocs)
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;
+ /* 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;
+
dynobj = elf_hash_table(info)->dynobj;
if (dynobj == NULL)
elf_hash_table(info)->dynobj = dynobj = abfd;
@@ -2978,7 +1767,6 @@ elf64_alpha_check_relocs (abfd, info, sec, relocs)
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)
@@ -3007,7 +1795,7 @@ elf64_alpha_check_relocs (abfd, info, sec, relocs)
|| 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;
+ h->root.ref_regular = 1;
}
/* We can only get preliminary data on whether a symbol is
@@ -3016,8 +1804,9 @@ elf64_alpha_check_relocs (abfd, info, sec, relocs)
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)
+ && (!info->symbolic
+ || info->unresolved_syms_in_shared_libs == RM_IGNORE))
+ || !h->root.def_regular
|| h->root.root.type == bfd_link_hash_defweak))
maybe_dynamic = TRUE;
@@ -3035,7 +1824,7 @@ elf64_alpha_check_relocs (abfd, info, sec, relocs)
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)
+ if (rel->r_addend >= 1 && rel->r_addend <= 6)
gotent_flags |= 1 << rel->r_addend;
--rel;
@@ -3055,7 +1844,7 @@ elf64_alpha_check_relocs (abfd, info, sec, relocs)
case R_ALPHA_REFLONG:
case R_ALPHA_REFQUAD:
- if ((info->shared && (sec->flags & SEC_ALLOC)) || maybe_dynamic)
+ if (info->shared || maybe_dynamic)
need = NEED_DYNREL;
break;
@@ -3089,18 +1878,10 @@ elf64_alpha_check_relocs (abfd, info, sec, relocs)
if (need & NEED_GOT)
{
- if (!got_created)
+ if (alpha_elf_tdata(abfd)->gotobj == NULL)
{
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;
}
}
@@ -3121,12 +1902,13 @@ elf64_alpha_check_relocs (abfd, info, sec, relocs)
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;
- }
+ /* ??? It appears that we won't make it into
+ adjust_dynamic_symbol for symbols that remain
+ totally undefined. Copying this check here means
+ we can create a plt entry for them too. */
+ h->root.needs_plt
+ = (maybe_dynamic && elf64_alpha_want_plt (h));
+ }
}
}
@@ -3140,7 +1922,7 @@ elf64_alpha_check_relocs (abfd, info, sec, relocs)
if (rel_sec_name == NULL)
return FALSE;
- BFD_ASSERT (strncmp (rel_sec_name, ".rela", 5) == 0
+ BFD_ASSERT (CONST_STRNEQ (rel_sec_name, ".rela")
&& strcmp (bfd_get_section_name (abfd, sec),
rel_sec_name+5) == 0);
}
@@ -3156,13 +1938,14 @@ elf64_alpha_check_relocs (abfd, info, sec, relocs)
{
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;
+ sreloc = bfd_make_section_with_flags (dynobj,
+ rel_sec_name,
+ flags);
if (sreloc == NULL
- || !bfd_set_section_flags (dynobj, sreloc, flags)
|| !bfd_set_section_alignment (dynobj, sreloc, 3))
return FALSE;
}
@@ -3192,8 +1975,7 @@ elf64_alpha_check_relocs (abfd, info, sec, relocs)
rent->srel = sreloc;
rent->rtype = r_type;
rent->count = 1;
- rent->reltext = ((sec->flags & (SEC_READONLY | SEC_ALLOC))
- == (SEC_READONLY | SEC_ALLOC));
+ rent->reltext = (sec->flags & SEC_READONLY) != 0;
rent->next = h->reloc_entries;
h->reloc_entries = rent;
@@ -3205,9 +1987,8 @@ elf64_alpha_check_relocs (abfd, info, sec, relocs)
{
/* 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))
+ sreloc->size += sizeof (Elf64_External_Rela);
+ if (sec->flags & SEC_READONLY)
info->flags |= DF_TEXTREL;
}
}
@@ -3223,9 +2004,8 @@ elf64_alpha_check_relocs (abfd, info, sec, relocs)
understand. */
static bfd_boolean
-elf64_alpha_adjust_dynamic_symbol (info, h)
- struct bfd_link_info *info;
- struct elf_link_hash_entry *h;
+elf64_alpha_adjust_dynamic_symbol (struct bfd_link_info *info,
+ struct elf_link_hash_entry *h)
{
bfd *dynobj;
asection *s;
@@ -3235,66 +2015,36 @@ elf64_alpha_adjust_dynamic_symbol (info, h)
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)
+ about whether this symbol should get a .plt entry. Irritatingly, it
+ is common for folk to leave undefined symbols in shared libraries,
+ and they still expect lazy binding; accept undefined symbols in lieu
+ of STT_FUNC. */
+ if (alpha_elf_dynamic_symbol_p (h, info) && elf64_alpha_want_plt (ah))
{
- h->elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_PLT;
+ h->needs_plt = TRUE;
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);
+ /* We need one plt entry per got subsection. Delay allocation of
+ the actual plt entries until size_plt_section, called from
+ size_dynamic_sections or during relaxation. */
return TRUE;
}
else
- h->elf_link_hash_flags &= ~ELF_LINK_HASH_NEEDS_PLT;
+ h->needs_plt = FALSE;
/* 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)
+ if (h->u.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;
+ BFD_ASSERT (h->u.weakdef->root.type == bfd_link_hash_defined
+ || h->u.weakdef->root.type == bfd_link_hash_defweak);
+ h->root.u.def.section = h->u.weakdef->root.u.def.section;
+ h->root.u.def.value = h->u.weakdef->root.u.def.value;
return TRUE;
}
@@ -3306,14 +2056,26 @@ elf64_alpha_adjust_dynamic_symbol (info, h)
return TRUE;
}
+/* Record STO_ALPHA_NOPV and STO_ALPHA_STD_GPLOAD. */
+
+static void
+elf64_alpha_merge_symbol_attribute (struct elf_link_hash_entry *h,
+ const Elf_Internal_Sym *isym,
+ bfd_boolean definition,
+ bfd_boolean dynamic)
+{
+ if (!dynamic && definition)
+ h->other = ((h->other & ELF_ST_VISIBILITY (-1))
+ | (isym->st_other & ~ELF_ST_VISIBILITY (-1)));
+}
+
/* 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;
+elf64_alpha_merge_ind_symbols (struct alpha_elf_link_hash_entry *hi,
+ PTR dummy ATTRIBUTE_UNUSED)
{
struct alpha_elf_link_hash_entry *hs;
@@ -3387,8 +2149,7 @@ elf64_alpha_merge_ind_symbols (hi, dummy)
/* Is it possible to merge two object file's .got tables? */
static bfd_boolean
-elf64_alpha_can_merge_gots (a, b)
- bfd *a, *b;
+elf64_alpha_can_merge_gots (bfd *a, bfd *b)
{
int total = alpha_elf_tdata (a)->total_got_size;
bfd *bsub;
@@ -3448,8 +2209,7 @@ elf64_alpha_can_merge_gots (a, b)
/* Actually merge two .got tables. */
static void
-elf64_alpha_merge_gots (a, b)
- bfd *a, *b;
+elf64_alpha_merge_gots (bfd *a, bfd *b)
{
int total = alpha_elf_tdata (a)->total_got_size;
bfd *bsub;
@@ -3496,16 +2256,17 @@ elf64_alpha_merge_gots (a, b)
|| 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)
+ pbe = start = &h->got_entries;
+ while ((be = *pbe) != NULL)
{
if (be->use_count == 0)
{
*pbe = be->next;
- continue;
+ memset (be, 0xa5, sizeof (*be));
+ goto kill;
}
if (be->gotobj != b)
- continue;
+ goto next;
for (ae = *start; ae ; ae = ae->next)
if (ae->gotobj == a
@@ -3515,12 +2276,15 @@ elf64_alpha_merge_gots (a, b)
ae->flags |= be->flags;
ae->use_count += be->use_count;
*pbe = be->next;
- goto global_found;
+ memset (be, 0xa5, sizeof (*be));
+ goto kill;
}
be->gotobj = a;
total += alpha_got_entry_size (be->reloc_type);
- global_found:;
+ next:;
+ pbe = &be->next;
+ kill:;
}
}
@@ -3543,11 +2307,9 @@ elf64_alpha_merge_gots (a, 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;
+elf64_alpha_calc_got_offsets_for_symbol (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)
@@ -3560,31 +2322,23 @@ elf64_alpha_calc_got_offsets_for_symbol (h, arg)
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;
+ plge = &td->got->size;
gotent->got_offset = *plge;
*plge += alpha_got_entry_size (gotent->reloc_type);
}
- return result;
+ return TRUE;
}
static void
-elf64_alpha_calc_got_offsets (info)
- struct bfd_link_info *info;
+elf64_alpha_calc_got_offsets (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;
+ alpha_elf_tdata(i)->got->size = 0;
/* Next, fill in the offsets for all the global entries. */
alpha_elf_link_hash_traverse (alpha_elf_hash_table (info),
@@ -3594,7 +2348,7 @@ elf64_alpha_calc_got_offsets (info)
/* 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_size_type got_offset = alpha_elf_tdata(i)->got->size;
bfd *j;
for (j = i; j ; j = alpha_elf_tdata(j)->in_got_link_next)
@@ -3615,19 +2369,16 @@ elf64_alpha_calc_got_offsets (info)
}
}
- alpha_elf_tdata(i)->got->_raw_size = got_offset;
- alpha_elf_tdata(i)->got->_cooked_size = got_offset;
+ alpha_elf_tdata(i)->got->size = got_offset;
}
}
/* Constructs the gots. */
static bfd_boolean
-elf64_alpha_size_got_sections (info)
- struct bfd_link_info *info;
+elf64_alpha_size_got_sections (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;
@@ -3648,9 +2399,8 @@ elf64_alpha_size_got_sections (info)
{
/* 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);
+ (_("%B: .got subsegment exceeds 64K (size %d)"),
+ i, alpha_elf_tdata (this_got)->total_got_size);
return FALSE;
}
@@ -3666,9 +2416,6 @@ elf64_alpha_size_got_sections (info)
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;
@@ -3678,9 +2425,10 @@ elf64_alpha_size_got_sections (info)
if (elf64_alpha_can_merge_gots (cur_got_obj, i))
{
elf64_alpha_merge_gots (cur_got_obj, i);
+
+ alpha_elf_tdata(i)->got->size = 0;
i = alpha_elf_tdata(i)->got_link_next;
alpha_elf_tdata(cur_got_obj)->got_link_next = i;
- something_changed = 1;
}
else
{
@@ -3691,95 +2439,86 @@ elf64_alpha_size_got_sections (info)
/* Once the gots have been merged, fill in the got offsets for
everything therein. */
- if (1 || something_changed)
- elf64_alpha_calc_got_offsets (info);
+ 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;
+elf64_alpha_size_plt_section_1 (struct alpha_elf_link_hash_entry *h, PTR data)
{
- asection *splt, *spltrel;
- unsigned long entries;
- bfd *dynobj;
+ asection *splt = (asection *) data;
+ struct alpha_elf_got_entry *gotent;
+ bfd_boolean saw_one = FALSE;
- dynobj = elf_hash_table(info)->dynobj;
- splt = bfd_get_section_by_name(dynobj, ".plt");
- if (splt == NULL)
+ /* If we didn't need an entry before, we still don't. */
+ if (!h->root.needs_plt)
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;
+ /* For each LITERAL got entry still in use, allocate a plt entry. */
+ for (gotent = h->got_entries; gotent ; gotent = gotent->next)
+ if (gotent->reloc_type == R_ALPHA_LITERAL
+ && gotent->use_count > 0)
+ {
+ if (splt->size == 0)
+ splt->size = PLT_HEADER_SIZE;
+ gotent->plt_offset = splt->size;
+ splt->size += PLT_ENTRY_SIZE;
+ saw_one = TRUE;
+ }
- /* 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;
+ /* If there weren't any, there's no longer a need for the PLT entry. */
+ if (!saw_one)
+ h->root.needs_plt = FALSE;
return TRUE;
}
-static bfd_boolean
-elf64_alpha_size_plt_section_1 (h, data)
- struct alpha_elf_link_hash_entry *h;
- PTR data;
+/* Called from relax_section to rebuild the PLT in light of potential changes
+ in the function's status. */
+
+static void
+elf64_alpha_size_plt_section (struct bfd_link_info *info)
{
- asection *splt = (asection *) data;
- struct alpha_elf_got_entry *gotent;
+ asection *splt, *spltrel, *sgotplt;
+ unsigned long entries;
+ bfd *dynobj;
- /* 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;
+ dynobj = elf_hash_table(info)->dynobj;
+ splt = bfd_get_section_by_name (dynobj, ".plt");
+ if (splt == NULL)
+ return;
- /* 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;
+ splt->size = 0;
- /* If there is, reset the PLT offset. If not, there's no longer
- a need for the PLT entry. */
- if (gotent)
+ alpha_elf_link_hash_traverse (alpha_elf_hash_table (info),
+ elf64_alpha_size_plt_section_1, splt);
+
+ /* Every plt entry requires a JMP_SLOT relocation. */
+ spltrel = bfd_get_section_by_name (dynobj, ".rela.plt");
+ entries = 0;
+ if (splt->size)
{
- if (splt->_raw_size == 0)
- splt->_raw_size = PLT_HEADER_SIZE;
- h->root.plt.offset = splt->_raw_size;
- splt->_raw_size += PLT_ENTRY_SIZE;
+ if (elf64_alpha_use_secureplt)
+ entries = (splt->size - NEW_PLT_HEADER_SIZE) / NEW_PLT_ENTRY_SIZE;
+ else
+ entries = (splt->size - OLD_PLT_HEADER_SIZE) / OLD_PLT_ENTRY_SIZE;
}
- else
- {
- h->root.elf_link_hash_flags &= ~ELF_LINK_HASH_NEEDS_PLT;
- h->root.plt.offset = -1;
+ spltrel->size = entries * sizeof (Elf64_External_Rela);
- /* 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;
- }
+ /* When using the secureplt, we need two words somewhere in the data
+ segment for the dynamic linker to tell us where to go. This is the
+ entire contents of the .got.plt section. */
+ if (elf64_alpha_use_secureplt)
+ {
+ sgotplt = bfd_get_section_by_name (dynobj, ".got.plt");
+ sgotplt->size = entries ? 16 : 0;
}
-
- return TRUE;
}
static bfd_boolean
-elf64_alpha_always_size_sections (output_bfd, info)
- bfd *output_bfd ATTRIBUTE_UNUSED;
- struct bfd_link_info *info;
+elf64_alpha_always_size_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
+ struct bfd_link_info *info)
{
bfd *i;
@@ -3799,9 +2538,9 @@ elf64_alpha_always_size_sections (output_bfd, info)
for ( ; i ; i = alpha_elf_tdata(i)->got_link_next)
{
asection *s = alpha_elf_tdata(i)->got;
- if (s->_raw_size > 0)
+ if (s->size > 0)
{
- s->contents = (bfd_byte *) bfd_zalloc (i, s->_raw_size);
+ s->contents = (bfd_byte *) bfd_zalloc (i, s->size);
if (s->contents == NULL)
return FALSE;
}
@@ -3813,8 +2552,7 @@ elf64_alpha_always_size_sections (output_bfd, info)
/* 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;
+alpha_dynamic_entries_for_reloc (int r_type, int dynamic, int shared)
{
switch (r_type)
{
@@ -3845,9 +2583,8 @@ alpha_dynamic_entries_for_reloc (r_type, dynamic, shared)
/* 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;
+elf64_alpha_calc_dynrel_sizes (struct alpha_elf_link_hash_entry *h,
+ struct bfd_link_info *info)
{
bfd_boolean dynamic;
struct alpha_elf_reloc_entry *relent;
@@ -3863,29 +2600,32 @@ elf64_alpha_calc_dynrel_sizes (h, info)
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)
+ if (!h->root.def_regular
+ && h->root.ref_regular
+ && !h->root.def_dynamic
&& (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;
+ h->root.def_regular = 1;
/* 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);
+ /* If the symbol is a hidden undefined weak, then we never have any
+ relocations. Avoid the loop which may want to add RELATIVE relocs
+ based on info->shared. */
+ if (h->root.root.type == bfd_link_hash_undefweak && !dynamic)
+ return TRUE;
+
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 +=
+ relent->srel->size +=
entries * sizeof (Elf64_External_Rela) * relent->count;
if (relent->reltext)
info->flags |= DT_TEXTREL;
@@ -3895,11 +2635,57 @@ elf64_alpha_calc_dynrel_sizes (h, info)
return TRUE;
}
-/* Set the sizes of the dynamic relocation sections. */
+/* Subroutine of elf64_alpha_size_rela_got_section for doing the
+ global symbols. */
static bfd_boolean
-elf64_alpha_size_rela_got_section (info)
- struct bfd_link_info *info;
+elf64_alpha_size_rela_got_1 (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 we're using a plt for this symbol, then all of its relocations
+ for its got entries go into .rela.plt. */
+ if (h->root.needs_plt)
+ return TRUE;
+
+ /* 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);
+
+ /* If the symbol is a hidden undefined weak, then we never have any
+ relocations. Avoid the loop which may want to add RELATIVE relocs
+ based on info->shared. */
+ if (h->root.root.type == bfd_link_hash_undefweak && !dynamic)
+ return TRUE;
+
+ 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 (entries > 0)
+ {
+ bfd *dynobj = elf_hash_table(info)->dynobj;
+ asection *srel = bfd_get_section_by_name (dynobj, ".rela.got");
+ BFD_ASSERT (srel != NULL);
+ srel->size += sizeof (Elf64_External_Rela) * entries;
+ }
+
+ return TRUE;
+}
+
+/* Set the sizes of the dynamic relocation sections. */
+
+static void
+elf64_alpha_size_rela_got_section (struct bfd_link_info *info)
{
unsigned long entries;
bfd *i, *dynobj;
@@ -3937,68 +2723,20 @@ elf64_alpha_size_rela_got_section (info)
if (!srel)
{
BFD_ASSERT (entries == 0);
- return TRUE;
+ return;
}
- srel->_raw_size = sizeof (Elf64_External_Rela) * entries;
+ srel->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;
+elf64_alpha_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
+ struct bfd_link_info *info)
{
bfd *dynobj;
asection *s;
@@ -4014,7 +2752,7 @@ elf64_alpha_size_dynamic_sections (output_bfd, info)
{
s = bfd_get_section_by_name (dynobj, ".interp");
BFD_ASSERT (s != NULL);
- s->_raw_size = sizeof ELF_DYNAMIC_INTERPRETER;
+ s->size = sizeof ELF_DYNAMIC_INTERPRETER;
s->contents = (unsigned char *) ELF_DYNAMIC_INTERPRETER;
}
@@ -4026,6 +2764,7 @@ elf64_alpha_size_dynamic_sections (output_bfd, info)
elf64_alpha_calc_dynrel_sizes, info);
elf64_alpha_size_rela_got_section (info);
+ elf64_alpha_size_plt_section (info);
}
/* else we're not dynamic and by definition we don't need such things. */
@@ -4036,7 +2775,6 @@ elf64_alpha_size_dynamic_sections (output_bfd, info)
for (s = dynobj->sections; s != NULL; s = s->next)
{
const char *name;
- bfd_boolean strip;
if (!(s->flags & SEC_LINKER_CREATED))
continue;
@@ -4045,23 +2783,11 @@ elf64_alpha_size_dynamic_sections (output_bfd, info)
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)
+ if (CONST_STRNEQ (name, ".rela"))
{
- strip = (s->_raw_size == 0);
-
- if (!strip)
+ if (s->size != 0)
{
- if (strcmp(name, ".rela.plt") == 0)
+ if (strcmp (name, ".rela.plt") == 0)
relplt = TRUE;
/* We use the reloc_count field as a counter if we need
@@ -4069,19 +2795,30 @@ elf64_alpha_size_dynamic_sections (output_bfd, info)
s->reloc_count = 0;
}
}
- else if (strcmp (name, ".plt") != 0)
+ else if (! CONST_STRNEQ (name, ".got")
+ && strcmp (name, ".plt") != 0
+ && strcmp (name, ".dynbss") != 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
+ if (s->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. */
+ s->flags |= SEC_EXCLUDE;
+ }
+ else if ((s->flags & SEC_HAS_CONTENTS) != 0)
{
/* Allocate memory for the section contents. */
- s->contents = (bfd_byte *) bfd_zalloc (dynobj, s->_raw_size);
- if (s->contents == NULL && s->_raw_size != 0)
+ s->contents = (bfd_byte *) bfd_zalloc (dynobj, s->size);
+ if (s->contents == NULL)
return FALSE;
}
}
@@ -4109,6 +2846,10 @@ elf64_alpha_size_dynamic_sections (output_bfd, info)
|| !add_dynamic_entry (DT_PLTREL, DT_RELA)
|| !add_dynamic_entry (DT_JMPREL, 0))
return FALSE;
+
+ if (elf64_alpha_use_secureplt
+ && !add_dynamic_entry (DT_ALPHA_PLTRO, 1))
+ return FALSE;
}
if (!add_dynamic_entry (DT_RELA, 0)
@@ -4126,17 +2867,1030 @@ elf64_alpha_size_dynamic_sections (output_bfd, info)
return TRUE;
}
+
+/* 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. */
+
+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 Elf_Internal_Rela *
+elf64_alpha_find_reloc_at_ofs (Elf_Internal_Rela *rel,
+ Elf_Internal_Rela *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_got_load (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)
+ ("%B: %A+0x%lx: warning: %s relocation against unexpected insn",
+ info->abfd, info->sec,
+ (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)
+ {
+ /* Look for nice constant addresses. This includes the not-uncommon
+ special case of 0 for undefweak symbols. */
+ if ((info->h && info->h->root.root.type == bfd_link_hash_undefweak)
+ || (!info->link_info->shared
+ && (symval >= (bfd_vma)-0x8000 || symval < 0x8000)))
+ {
+ disp = 0;
+ insn = (OP_LDA << 26) | (insn & (31 << 21)) | (31 << 16);
+ insn |= (symval & 0xffff);
+ r_type = R_ALPHA_NONE;
+ }
+ else
+ {
+ disp = symval - info->gp;
+ insn = (OP_LDA << 26) | (insn & 0x03ff0000);
+ r_type = R_ALPHA_GPREL16;
+ }
+ }
+ 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);
+
+ insn = (OP_LDA << 26) | (insn & (31 << 21)) | (31 << 16);
+
+ switch (r_type)
+ {
+ 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;
+ }
+ }
+
+ if (disp < -0x8000 || disp >= 0x8000)
+ return TRUE;
+
+ 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. */
+ 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_vma
+elf64_alpha_relax_opt_call (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_with_lituse (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)
+ ("%B: %A+0x%lx: warning: LITERAL relocation against unexpected insn",
+ info->abfd, info->sec,
+ (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 <= 6)
+ 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 & 0xffff) ^ 0x8000) - 0x8000;
+
+ 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:
+ case LITUSE_ALPHA_JSRDIRECT:
+ {
+ bfd_vma optdest, org;
+ bfd_signed_vma odisp;
+
+ /* For undefined weak symbols, we're mostly interested in getting
+ rid of the got entry whenever possible, so optimize this to a
+ use of the zero register. */
+ if (info->h && info->h->root.root.type == bfd_link_hash_undefweak)
+ {
+ insn |= 31 << 16;
+ bfd_put_32 (info->abfd, (bfd_vma) insn,
+ info->contents + urel->r_offset);
+
+ info->changed_contents = TRUE;
+ break;
+ }
+
+ /* 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;
+ }
+ else
+ return elf64_alpha_relax_got_load (info, symval, irel, R_ALPHA_LITERAL);
+}
+
+static bfd_boolean
+elf64_alpha_relax_tls_get_addr (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 (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;
+
+ /* There's nothing to change, yet. */
+ *again = FALSE;
+
+ if (link_info->relocatable
+ || ((sec->flags & (SEC_CODE | SEC_RELOC | SEC_ALLOC))
+ != (SEC_CODE | SEC_RELOC | SEC_ALLOC))
+ || sec->reloc_count == 0)
+ return TRUE;
+
+ /* Make sure our GOT and PLT tables are up-to-date. */
+ if (alpha_elf_hash_table(link_info)->relax_trip != link_info->relax_trip)
+ {
+ alpha_elf_hash_table(link_info)->relax_trip = link_info->relax_trip;
+
+ /* This should never fail after the initial round, since the only
+ error is GOT overflow, and relaxation only shrinks the table. */
+ if (!elf64_alpha_size_got_sections (link_info))
+ abort ();
+ if (elf_hash_table (link_info)->dynamic_sections_created)
+ {
+ elf64_alpha_size_plt_section (link_info);
+ elf64_alpha_size_rela_got_section (link_info);
+ }
+ }
+
+ 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
+ {
+ if (!bfd_malloc_and_get_section (abfd, sec, &info.contents))
+ 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_undefined)
+ continue;
+
+ /* If the symbol isn't defined in the current module,
+ again we can't do anything. */
+ if (h->root.root.type == bfd_link_hash_undefweak)
+ {
+ info.tsec = bfd_abs_section_ptr;
+ symval = 0;
+ }
+ else if (!h->root.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_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 (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;
+}
+
/* 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;
+elf64_alpha_emit_dynrel (bfd *abfd, struct bfd_link_info *info,
+ asection *sec, asection *srel, bfd_vma offset,
+ long dynindx, long rtype, bfd_vma addend)
{
Elf_Internal_Rela outrel;
bfd_byte *loc;
@@ -4155,8 +3909,7 @@ elf64_alpha_emit_dynrel (abfd, info, sec, srel, offset, dynindx, rtype, addend)
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);
+ BFD_ASSERT (sizeof (Elf64_External_Rela) * srel->reloc_count <= srel->size);
}
/* Relocate an Alpha ELF section for a relocatable link.
@@ -4166,23 +3919,22 @@ elf64_alpha_emit_dynrel (abfd, info, sec, srel, offset, dynindx, rtype, addend)
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;
+elf64_alpha_relocate_section_r (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;
+ struct elf_link_hash_entry **sym_hashes;
bfd_boolean ret_val = TRUE;
symtab_hdr_sh_info = elf_tdata (input_bfd)->symtab_hdr.sh_info;
+ sym_hashes = elf_sym_hashes (input_bfd);
relend = relocs + input_section->reloc_count;
for (rel = relocs; rel < relend; rel++)
@@ -4192,33 +3944,60 @@ elf64_alpha_relocate_section_r (output_bfd, info, input_bfd, input_section,
asection *sec;
unsigned long r_type;
- r_type = ELF64_R_TYPE(rel->r_info);
+ 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);
+ (_("%B: unknown relocation type %d"),
+ 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;
+ r_symndx = ELF64_R_SYM (rel->r_info);
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;
- }
+ sec = local_sections[r_symndx];
}
+ else
+ {
+ 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 (h->root.type != bfd_link_hash_defined
+ && h->root.type != bfd_link_hash_defweak)
+ continue;
+
+ sym = NULL;
+ sec = h->root.u.def.section;
+ }
+
+ if (sec != NULL && elf_discarded_section (sec))
+ {
+ /* For relocs against symbols from removed linkonce sections,
+ or sections discarded by a linker script, we just want the
+ section contents zeroed. */
+ _bfd_clear_contents (elf64_alpha_howto_table + r_type,
+ input_bfd, contents + rel->r_offset);
+ rel->r_info = 0;
+ rel->r_addend = 0;
+ continue;
+ }
+
+ if (sym != NULL && ELF_ST_TYPE (sym->st_info) == STT_SECTION)
+ rel->r_addend += sec->output_offset;
}
return ret_val;
@@ -4227,16 +4006,11 @@ elf64_alpha_relocate_section_r (output_bfd, info, input_bfd, input_section,
/* 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;
+elf64_alpha_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;
Elf_Internal_Rela *rel;
@@ -4246,7 +4020,6 @@ elf64_alpha_relocate_section (output_bfd, info, input_bfd, input_section,
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)
@@ -4266,11 +4039,17 @@ elf64_alpha_relocate_section (output_bfd, info, input_bfd, input_section,
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);
+ if (input_section->flags & SEC_ALLOC)
+ {
+ const char *section_name;
+ 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);
+ }
+ else
+ srel = NULL;
/* Find the gp value for this input bfd. */
gotobj = alpha_elf_tdata (input_bfd)->gotobj;
@@ -4322,8 +4101,8 @@ elf64_alpha_relocate_section (output_bfd, info, input_bfd, input_section,
if (r_type >= R_ALPHA_max)
{
(*_bfd_error_handler)
- (_("%s: unknown relocation type %d"),
- bfd_archive_filename (input_bfd), (int)r_type);
+ (_("%B: unknown relocation type %d"),
+ input_bfd, (int) r_type);
bfd_set_error (bfd_error_bad_value);
ret_val = FALSE;
continue;
@@ -4347,7 +4126,7 @@ elf64_alpha_relocate_section (output_bfd, info, input_bfd, input_section,
/* If this is a tp-relative relocation against sym 0,
this is hackery from relax_section. Force the value to
- be the tls base. */
+ be the tls module base. */
if (r_symndx == 0
&& (r_type == R_ALPHA_TLSLDM
|| r_type == R_ALPHA_GOTTPREL
@@ -4355,7 +4134,7 @@ elf64_alpha_relocate_section (output_bfd, info, input_bfd, input_section,
|| r_type == R_ALPHA_TPRELHI
|| r_type == R_ALPHA_TPRELLO
|| r_type == R_ALPHA_TPREL16))
- value = tp_base;
+ value = dtp_base;
if (local_got_entries)
gotent = local_got_entries[r_symndx];
@@ -4382,8 +4161,7 @@ elf64_alpha_relocate_section (output_bfd, info, input_bfd, input_section,
_bfd_merged_section_offset (output_bfd, &msec,
elf_section_data (sec)->
sec_info,
- sym->st_value + ent->addend,
- (bfd_vma) 0);
+ sym->st_value + ent->addend);
ent->addend -= sym->st_value;
ent->addend += msec->output_section->vma
+ msec->output_offset
@@ -4419,6 +4197,17 @@ elf64_alpha_relocate_section (output_bfd, info, input_bfd, input_section,
gotent = h->got_entries;
}
+ if (sec != NULL && elf_discarded_section (sec))
+ {
+ /* For relocs against symbols from removed linkonce sections,
+ or sections discarded by a linker script, we just want the
+ section contents zeroed. Avoid any special processing. */
+ _bfd_clear_contents (howto, input_bfd, contents + rel->r_offset);
+ rel->r_info = 0;
+ rel->r_addend = 0;
+ continue;
+ }
+
addend = rel->r_addend;
value += addend;
@@ -4465,7 +4254,7 @@ elf64_alpha_relocate_section (output_bfd, info, input_bfd, input_section,
/* 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)
+ if (info->shared && !dynamic_symbol_p && !undef_weak_ref)
elf64_alpha_emit_dynrel (output_bfd, info, sgot, srelgot,
gotent->got_offset, 0,
R_ALPHA_RELATIVE, value);
@@ -4478,25 +4267,13 @@ elf64_alpha_relocate_section (output_bfd, info, input_bfd, input_section,
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);
+ (_("%B: gp-relative relocation against dynamic symbol %s"),
+ input_bfd, h->root.root.root.string);
ret_val = FALSE;
}
BFD_ASSERT(gp != 0);
@@ -4507,8 +4284,8 @@ elf64_alpha_relocate_section (output_bfd, info, input_bfd, input_section,
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);
+ (_("%B: gp-relative relocation against dynamic symbol %s"),
+ input_bfd, h->root.root.root.string);
ret_val = FALSE;
}
BFD_ASSERT(gp != 0);
@@ -4533,8 +4310,8 @@ elf64_alpha_relocate_section (output_bfd, info, input_bfd, input_section,
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);
+ (_("%B: pc-relative relocation against dynamic symbol %s"),
+ input_bfd, h->root.root.root.string);
ret_val = FALSE;
}
/* The regular PC-relative stuff measures from the start of
@@ -4561,8 +4338,8 @@ elf64_alpha_relocate_section (output_bfd, info, input_bfd, input_section,
&& 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);
+ (_("%B: change in gp: BRSGP %s"),
+ input_bfd, h->root.root.root.string);
ret_val = FALSE;
}
@@ -4591,8 +4368,8 @@ elf64_alpha_relocate_section (output_bfd, info, input_bfd, input_section,
name = bfd_section_name (input_bfd, sec);
}
(*_bfd_error_handler)
- (_("%s: !samegp reloc against symbol without .prologue: %s"),
- bfd_archive_filename (input_bfd), name);
+ (_("%B: !samegp reloc against symbol without .prologue: %s"),
+ input_bfd, name);
ret_val = FALSE;
break;
}
@@ -4637,13 +4414,14 @@ elf64_alpha_relocate_section (output_bfd, info, input_bfd, input_section,
}
else if (info->shared
&& r_symndx != 0
- && (input_section->flags & SEC_ALLOC))
+ && (input_section->flags & SEC_ALLOC)
+ && !undef_weak_ref)
{
if (r_type == R_ALPHA_REFLONG)
{
(*_bfd_error_handler)
- (_("%s: unhandled dynamic relocation against %s"),
- bfd_archive_filename (input_bfd),
+ (_("%B: unhandled dynamic relocation against %s"),
+ input_bfd,
h->root.root.root.string);
ret_val = FALSE;
}
@@ -4654,9 +4432,10 @@ elf64_alpha_relocate_section (output_bfd, info, input_bfd, input_section,
else
goto default_reloc;
- elf64_alpha_emit_dynrel (output_bfd, info, input_section,
- srel, rel->r_offset, dynindx,
- dyntype, dynaddend);
+ if (input_section->flags & SEC_ALLOC)
+ elf64_alpha_emit_dynrel (output_bfd, info, input_section,
+ srel, rel->r_offset, dynindx,
+ dyntype, dynaddend);
}
goto default_reloc;
@@ -4666,11 +4445,19 @@ elf64_alpha_relocate_section (output_bfd, info, input_bfd, input_section,
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);
+ (_("%B: pc-relative relocation against dynamic symbol %s"),
+ input_bfd, h->root.root.root.string);
+ ret_val = FALSE;
+ }
+ else if ((info->shared || info->pie) && undef_weak_ref)
+ {
+ (*_bfd_error_handler)
+ (_("%B: pc-relative relocation against undefined weak symbol %s"),
+ 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. */
@@ -4725,8 +4512,8 @@ elf64_alpha_relocate_section (output_bfd, info, input_bfd, input_section,
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);
+ (_("%B: dtp-relative relocation against dynamic symbol %s"),
+ input_bfd, h->root.root.root.string);
ret_val = FALSE;
}
BFD_ASSERT (elf_hash_table (info)->tls_sec != NULL);
@@ -4741,15 +4528,15 @@ elf64_alpha_relocate_section (output_bfd, info, input_bfd, input_section,
if (info->shared)
{
(*_bfd_error_handler)
- (_("%s: TLS local exec code cannot be linked into shared objects"),
- bfd_archive_filename (input_bfd));
+ (_("%B: TLS local exec code cannot be linked into shared objects"),
+ 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);
+ (_("%B: tp-relative relocation against dynamic symbol %s"),
+ input_bfd, h->root.root.root.string);
ret_val = FALSE;
}
BFD_ASSERT (elf_hash_table (info)->tls_sec != NULL);
@@ -4823,7 +4610,7 @@ elf64_alpha_relocate_section (output_bfd, info, input_bfd, input_section,
break;
if (h != NULL)
- name = h->root.root.root.string;
+ name = NULL;
else
{
name = (bfd_elf_string_from_elf_section
@@ -4834,8 +4621,9 @@ elf64_alpha_relocate_section (output_bfd, info, input_bfd, input_section,
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)))
+ (info, (h ? &h->root.root : NULL), name, howto->name,
+ (bfd_vma) 0, input_bfd, input_section,
+ rel->r_offset)))
ret_val = FALSE;
}
break;
@@ -4853,15 +4641,14 @@ elf64_alpha_relocate_section (output_bfd, info, input_bfd, input_section,
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;
+elf64_alpha_finish_dynamic_symbol (bfd *output_bfd, struct bfd_link_info *info,
+ struct elf_link_hash_entry *h,
+ Elf_Internal_Sym *sym)
{
+ struct alpha_elf_link_hash_entry *ah = (struct alpha_elf_link_hash_entry *)h;
bfd *dynobj = elf_hash_table(info)->dynobj;
- if (h->plt.offset != MINUS_ONE)
+ if (h->needs_plt)
{
/* Fill in the .plt entry for this symbol. */
asection *splt, *sgot, *srel;
@@ -4873,83 +4660,71 @@ elf64_alpha_finish_dynamic_symbol (output_bfd, info, h, sym)
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);
- }
+ for (gotent = ah->got_entries; gotent ; gotent = gotent->next)
+ if (gotent->reloc_type == R_ALPHA_LITERAL
+ && gotent->use_count > 0)
+ {
+ unsigned int insn;
+ int disp;
- /* 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;
+ sgot = alpha_elf_tdata (gotent->gotobj)->got;
+ BFD_ASSERT (sgot != NULL);
- loc = srel->contents + plt_index * sizeof (Elf64_External_Rela);
- bfd_elf64_swap_reloca_out (output_bfd, &outrel, loc);
+ BFD_ASSERT (gotent->got_offset != -1);
+ BFD_ASSERT (gotent->plt_offset != -1);
- 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;
- }
+ got_addr = (sgot->output_section->vma
+ + sgot->output_offset
+ + gotent->got_offset);
+ plt_addr = (splt->output_section->vma
+ + splt->output_offset
+ + gotent->plt_offset);
- /* Fill in the entries in the .got. */
- bfd_put_64 (output_bfd, plt_addr, sgot->contents + gotent->got_offset);
+ plt_index = (gotent->plt_offset-PLT_HEADER_SIZE) / PLT_ENTRY_SIZE;
- /* 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);
+ /* Fill in the entry in the procedure linkage table. */
+ if (elf64_alpha_use_secureplt)
+ {
+ disp = (PLT_HEADER_SIZE - 4) - (gotent->plt_offset + 4);
+ insn = INSN_AD (INSN_BR, 31, disp);
+ bfd_put_32 (output_bfd, insn,
+ splt->contents + gotent->plt_offset);
- gotent = gotent->next;
- do
- {
- sgot = alpha_elf_tdata(gotent->gotobj)->got;
- BFD_ASSERT(sgot != NULL);
- BFD_ASSERT(gotent->addend == 0);
+ plt_index = ((gotent->plt_offset - NEW_PLT_HEADER_SIZE)
+ / NEW_PLT_ENTRY_SIZE);
+ }
+ else
+ {
+ disp = -(gotent->plt_offset + 4);
+ insn = INSN_AD (INSN_BR, 28, disp);
+ bfd_put_32 (output_bfd, insn,
+ splt->contents + gotent->plt_offset);
+ bfd_put_32 (output_bfd, INSN_UNOP,
+ splt->contents + gotent->plt_offset + 4);
+ bfd_put_32 (output_bfd, INSN_UNOP,
+ splt->contents + gotent->plt_offset + 8);
+
+ plt_index = ((gotent->plt_offset - OLD_PLT_HEADER_SIZE)
+ / OLD_PLT_ENTRY_SIZE);
+ }
- bfd_put_64 (output_bfd, plt_addr,
- sgot->contents + gotent->got_offset);
+ /* 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;
- if (info->shared)
- elf64_alpha_emit_dynrel (output_bfd, info, sgot, srel,
- gotent->got_offset, 0,
- R_ALPHA_RELATIVE, plt_addr);
+ loc = srel->contents + plt_index * sizeof (Elf64_External_Rela);
+ bfd_elf64_swap_reloca_out (output_bfd, &outrel, loc);
- gotent = gotent->next;
- }
- while (gotent != NULL);
- }
+ /* Fill in the entry in the .got. */
+ bfd_put_64 (output_bfd, plt_addr,
+ sgot->contents + gotent->got_offset);
+ }
}
else if (alpha_elf_dynamic_symbol_p (h, info))
{
@@ -5005,8 +4780,8 @@ elf64_alpha_finish_dynamic_symbol (output_bfd, info, h, sym)
/* 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)
+ || h == elf_hash_table (info)->hgot
+ || h == elf_hash_table (info)->hplt)
sym->st_shndx = SHN_ABS;
return TRUE;
@@ -5015,9 +4790,8 @@ elf64_alpha_finish_dynamic_symbol (output_bfd, info, h, sym)
/* Finish up the dynamic sections. */
static bfd_boolean
-elf64_alpha_finish_dynamic_sections (output_bfd, info)
- bfd *output_bfd;
- struct bfd_link_info *info;
+elf64_alpha_finish_dynamic_sections (bfd *output_bfd,
+ struct bfd_link_info *info)
{
bfd *dynobj;
asection *sdyn;
@@ -5027,33 +4801,45 @@ elf64_alpha_finish_dynamic_sections (output_bfd, info)
if (elf_hash_table (info)->dynamic_sections_created)
{
- asection *splt;
+ asection *splt, *sgotplt, *srelaplt;
Elf64_External_Dyn *dyncon, *dynconend;
+ bfd_vma plt_vma, gotplt_vma;
splt = bfd_get_section_by_name (dynobj, ".plt");
+ srelaplt = bfd_get_section_by_name (output_bfd, ".rela.plt");
BFD_ASSERT (splt != NULL && sdyn != NULL);
+ plt_vma = splt->output_section->vma + splt->output_offset;
+
+ gotplt_vma = 0;
+ if (elf64_alpha_use_secureplt)
+ {
+ sgotplt = bfd_get_section_by_name (dynobj, ".got.plt");
+ BFD_ASSERT (sgotplt != NULL);
+ if (sgotplt->size > 0)
+ gotplt_vma = sgotplt->output_section->vma + sgotplt->output_offset;
+ }
+
dyncon = (Elf64_External_Dyn *) sdyn->contents;
- dynconend = (Elf64_External_Dyn *) (sdyn->contents + sdyn->_raw_size);
+ dynconend = (Elf64_External_Dyn *) (sdyn->contents + sdyn->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;
+ dyn.d_un.d_ptr
+ = elf64_alpha_use_secureplt ? gotplt_vma : plt_vma;
+ break;
case DT_PLTRELSZ:
- name = ".rela.plt";
- goto get_size;
+ dyn.d_un.d_val = srelaplt ? srelaplt->size : 0;
+ break;
case DT_JMPREL:
- name = ".rela.plt";
- goto get_vma;
+ dyn.d_un.d_ptr = srelaplt ? srelaplt->vma : 0;
+ break;
case DT_RELASZ:
/* My interpretation of the TIS v1.1 ELF document indicates
@@ -5061,40 +4847,69 @@ elf64_alpha_finish_dynamic_sections (output_bfd, info)
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);
+ if (srelaplt)
+ dyn.d_un.d_val -= srelaplt->size;
break;
}
bfd_elf64_swap_dyn_out (output_bfd, &dyn, dyncon);
}
- /* Initialize the PLT0 entry. */
- if (splt->_raw_size > 0)
+ /* Initialize the plt header. */
+ if (splt->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);
+ unsigned int insn;
+ int ofs;
- /* 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);
+ if (elf64_alpha_use_secureplt)
+ {
+ ofs = gotplt_vma - (plt_vma + PLT_HEADER_SIZE);
+
+ insn = INSN_ABC (INSN_SUBQ, 27, 28, 25);
+ bfd_put_32 (output_bfd, insn, splt->contents);
+
+ insn = INSN_ABO (INSN_LDAH, 28, 28, (ofs + 0x8000) >> 16);
+ bfd_put_32 (output_bfd, insn, splt->contents + 4);
+
+ insn = INSN_ABC (INSN_S4SUBQ, 25, 25, 25);
+ bfd_put_32 (output_bfd, insn, splt->contents + 8);
+
+ insn = INSN_ABO (INSN_LDA, 28, 28, ofs);
+ bfd_put_32 (output_bfd, insn, splt->contents + 12);
+
+ insn = INSN_ABO (INSN_LDQ, 27, 28, 0);
+ bfd_put_32 (output_bfd, insn, splt->contents + 16);
+
+ insn = INSN_ABC (INSN_ADDQ, 25, 25, 25);
+ bfd_put_32 (output_bfd, insn, splt->contents + 20);
+
+ insn = INSN_ABO (INSN_LDQ, 28, 28, 8);
+ bfd_put_32 (output_bfd, insn, splt->contents + 24);
+
+ insn = INSN_AB (INSN_JMP, 31, 27);
+ bfd_put_32 (output_bfd, insn, splt->contents + 28);
+
+ insn = INSN_AD (INSN_BR, 28, -PLT_HEADER_SIZE);
+ bfd_put_32 (output_bfd, insn, splt->contents + 32);
+ }
+ else
+ {
+ insn = INSN_AD (INSN_BR, 27, 0); /* br $27, .+4 */
+ bfd_put_32 (output_bfd, insn, splt->contents);
+
+ insn = INSN_ABO (INSN_LDQ, 27, 27, 12);
+ bfd_put_32 (output_bfd, insn, splt->contents + 4);
+
+ insn = INSN_UNOP;
+ bfd_put_32 (output_bfd, insn, splt->contents + 8);
+
+ insn = INSN_AB (INSN_JMP, 27, 27);
+ bfd_put_32 (output_bfd, insn, splt->contents + 12);
+
+ /* The next two words will be filled in by ld.so. */
+ bfd_put_64 (output_bfd, 0, splt->contents + 16);
+ bfd_put_64 (output_bfd, 0, splt->contents + 24);
+ }
elf_section_data (splt->output_section)->this_hdr.sh_entsize = 0;
}
@@ -5108,9 +4923,7 @@ elf64_alpha_finish_dynamic_sections (output_bfd, info)
them all out sequentially. */
static bfd_boolean
-elf64_alpha_final_link (abfd, info)
- bfd *abfd;
- struct bfd_link_info *info;
+elf64_alpha_final_link (bfd *abfd, struct bfd_link_info *info)
{
asection *o;
struct bfd_link_order *p;
@@ -5196,7 +5009,7 @@ elf64_alpha_final_link (abfd, info)
if (s != NULL)
{
esym.asym.value = s->vma;
- last = s->vma + s->_raw_size;
+ last = s->vma + s->size;
}
else
esym.asym.value = last;
@@ -5207,7 +5020,7 @@ elf64_alpha_final_link (abfd, info)
}
}
- for (p = o->link_order_head;
+ for (p = o->map_head.link_order;
p != (struct bfd_link_order *) NULL;
p = p->next)
{
@@ -5241,7 +5054,7 @@ elf64_alpha_final_link (abfd, info)
input_swap = (get_elf_backend_data (input_bfd)
->elf_backend_ecoff_debug_swap);
- BFD_ASSERT (p->size == input_section->_raw_size);
+ BFD_ASSERT (p->size == input_section->size);
/* The ECOFF linking code expects that we have already
read in the debugging information and set up an
@@ -5324,11 +5137,11 @@ elf64_alpha_final_link (abfd, info)
return FALSE;
/* Set the size of the .mdebug section. */
- o->_raw_size = bfd_ecoff_debug_size (abfd, &debug, swap);
+ o->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;
+ o->map_head.link_order = (struct bfd_link_order *) NULL;
mdebug_sec = o;
}
@@ -5357,7 +5170,7 @@ elf64_alpha_final_link (abfd, info)
if (! bfd_set_section_contents (abfd, sgot->output_section,
sgot->contents,
(file_ptr) sgot->output_offset,
- sgot->_raw_size))
+ sgot->size))
return FALSE;
}
}
@@ -5377,8 +5190,7 @@ elf64_alpha_final_link (abfd, info)
}
static enum elf_reloc_type_class
-elf64_alpha_reloc_type_class (rela)
- const Elf_Internal_Rela *rela;
+elf64_alpha_reloc_type_class (const Elf_Internal_Rela *rela)
{
switch ((int) ELF64_R_TYPE (rela->r_info))
{
@@ -5393,11 +5205,11 @@ elf64_alpha_reloc_type_class (rela)
}
}
-static struct bfd_elf_special_section const elf64_alpha_special_sections[]=
+static const struct bfd_elf_special_section 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 }
+ { STRING_COMMA_LEN (".sbss"), -2, SHT_NOBITS, SHF_ALLOC + SHF_WRITE + SHF_ALPHA_GPREL },
+ { STRING_COMMA_LEN (".sdata"), -2, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE + SHF_ALPHA_GPREL },
+ { NULL, 0, 0, 0, 0 }
};
/* ECOFF swapping routines. These are used when dealing with the
@@ -5481,12 +5293,15 @@ static const struct elf_size_info alpha_elf_size_info =
#define ELF_ARCH bfd_arch_alpha
#define ELF_MACHINE_CODE EM_ALPHA
#define ELF_MAXPAGESIZE 0x10000
+#define ELF_COMMONPAGESIZE 0x2000
#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 bfd_elf64_bfd_reloc_name_lookup \
+ elf64_alpha_bfd_reloc_name_lookup
#define elf_info_to_howto \
elf64_alpha_info_to_howto
@@ -5511,16 +5326,22 @@ static const struct elf_size_info alpha_elf_size_info =
#define elf_backend_add_symbol_hook \
elf64_alpha_add_symbol_hook
+#define elf_backend_relocs_compatible \
+ _bfd_elf_relocs_compatible
#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_merge_symbol_attribute \
+ elf64_alpha_merge_symbol_attribute
#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_omit_section_dynsym \
+ ((bfd_boolean (*) (bfd *, struct bfd_link_info *, asection *)) bfd_true)
#define elf_backend_relocate_section \
elf64_alpha_relocate_section
#define elf_backend_finish_dynamic_symbol \
@@ -5555,25 +5376,23 @@ static const struct elf_size_info alpha_elf_size_info =
#define TARGET_LITTLE_SYM bfd_elf64_alpha_freebsd_vec
#undef TARGET_LITTLE_NAME
#define TARGET_LITTLE_NAME "elf64-alpha-freebsd"
+#undef ELF_OSABI
+#define ELF_OSABI ELFOSABI_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;
+elf64_alpha_fbsd_post_process_headers (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;
+ i_ehdrp->e_ident[EI_OSABI] = get_elf_backend_data (abfd)->elf_osabi;
#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);
diff --git a/contrib/binutils/bfd/elf64-gen.c b/contrib/binutils/bfd/elf64-gen.c
index be1dc3e..05a94f0 100644
--- a/contrib/binutils/bfd/elf64-gen.c
+++ b/contrib/binutils/bfd/elf64-gen.c
@@ -1,25 +1,25 @@
/* Generic support for 64-bit ELF
- Copyright 1993, 1995, 1998, 1999, 2001, 2002, 2004
+ Copyright 1993, 1995, 1998, 1999, 2001, 2002, 2004, 2005, 2007
Free Software Foundation, Inc.
-This file is part of BFD, the Binary File Descriptor library.
+ 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 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.
+ 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. */
+ 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., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
#include "elf-bfd.h"
@@ -41,53 +41,48 @@ static reloc_howto_type dummy =
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;
+elf_generic_info_to_howto (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;
+elf_generic_info_to_howto_rel (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;
+static void
+check_for_relocs (bfd * abfd, asection * o, void * failed)
{
- asection *o;
+ if ((o->flags & SEC_RELOC) != 0)
+ {
+ Elf_Internal_Ehdr *ehdrp;
- /* 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 (_("%B: Relocations in generic ELF (EM: %d)"),
+ abfd, ehdrp->e_machine);
- 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);
+ * (bfd_boolean *) failed = TRUE;
+ }
+}
- bfd_set_error (bfd_error_wrong_format);
- return FALSE;
- }
+static bfd_boolean
+elf64_generic_link_add_symbols (bfd *abfd, struct bfd_link_info *info)
+{
+ bfd_boolean failed = FALSE;
+
+ /* Check if there are any relocations. */
+ bfd_map_over_sections (abfd, check_for_relocs, & failed);
+ if (failed)
+ return FALSE;
return bfd_elf_link_add_symbols (abfd, info);
}
@@ -99,6 +94,7 @@ elf64_generic_link_add_symbols (abfd, info)
#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_reloc_name_lookup _bfd_norelocs_bfd_reloc_name_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
diff --git a/contrib/binutils/bfd/elf64-mips.c b/contrib/binutils/bfd/elf64-mips.c
index fa3b494..e64b50c 100644
--- a/contrib/binutils/bfd/elf64-mips.c
+++ b/contrib/binutils/bfd/elf64-mips.c
@@ -1,6 +1,6 @@
/* MIPS-specific support for 64-bit ELF
- Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
- Free Software Foundation, Inc.
+ Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
+ 2007 Free Software Foundation, Inc.
Ian Lance Taylor, Cygnus Support
Linker support added by Mark Mitchell, CodeSourcery, LLC.
<mark@codesourcery.com>
@@ -19,7 +19,7 @@ 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. */
+Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
/* This file supports the 64-bit MIPS ELF ABI.
@@ -40,8 +40,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
. the OldABI version is still lying around and should be removed.
*/
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
#include "aout/ar.h"
#include "bfdlink.h"
@@ -112,8 +112,6 @@ 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
@@ -299,9 +297,11 @@ static reloc_howto_type mips_elf64_howto_table_rel[] =
0x0000ffff, /* dst_mask */
FALSE), /* pcrel_offset */
- /* 16 bit PC relative reference. */
+ /* 16 bit PC relative reference. Note that the ABI document has a typo
+ and claims R_MIPS_PC16 to be not rightshifted, rendering it useless.
+ We do the right thing here. */
HOWTO (R_MIPS_PC16, /* type */
- 0, /* rightshift */
+ 2, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
16, /* bitsize */
TRUE, /* pc_relative */
@@ -622,7 +622,7 @@ static reloc_howto_type mips_elf64_howto_table_rel[] =
/* Protected jump conversion. This is an optimization hint. No
relocation is required for correctness. */
- HOWTO (R_MIPS_JALR, /* type */
+ HOWTO (R_MIPS_JALR, /* type */
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
32, /* bitsize */
@@ -630,11 +630,180 @@ static reloc_howto_type mips_elf64_howto_table_rel[] =
0, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
_bfd_mips_elf_generic_reloc, /* special_function */
- "R_MIPS_JALR", /* name */
+ "R_MIPS_JALR", /* name */
FALSE, /* partial_inplace */
0, /* src_mask */
0x00000000, /* dst_mask */
FALSE), /* pcrel_offset */
+
+ /* TLS relocations. */
+ EMPTY_HOWTO (R_MIPS_TLS_DTPMOD32),
+ EMPTY_HOWTO (R_MIPS_TLS_DTPREL32),
+
+ HOWTO (R_MIPS_TLS_DTPMOD64, /* 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_TLS_DTPMOD64", /* name */
+ TRUE, /* partial_inplace */
+ MINUS_ONE, /* src_mask */
+ MINUS_ONE, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ HOWTO (R_MIPS_TLS_DTPREL64, /* 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_TLS_DTPREL64", /* name */
+ TRUE, /* partial_inplace */
+ MINUS_ONE, /* src_mask */
+ MINUS_ONE, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* TLS general dynamic variable reference. */
+ HOWTO (R_MIPS_TLS_GD, /* 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_TLS_GD", /* name */
+ TRUE, /* partial_inplace */
+ 0x0000ffff, /* src_mask */
+ 0x0000ffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* TLS local dynamic variable reference. */
+ HOWTO (R_MIPS_TLS_LDM, /* 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_TLS_LDM", /* name */
+ TRUE, /* partial_inplace */
+ 0x0000ffff, /* src_mask */
+ 0x0000ffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* TLS local dynamic offset. */
+ HOWTO (R_MIPS_TLS_DTPREL_HI16, /* 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_TLS_DTPREL_HI16", /* name */
+ TRUE, /* partial_inplace */
+ 0x0000ffff, /* src_mask */
+ 0x0000ffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* TLS local dynamic offset. */
+ HOWTO (R_MIPS_TLS_DTPREL_LO16, /* 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_TLS_DTPREL_LO16", /* name */
+ TRUE, /* partial_inplace */
+ 0x0000ffff, /* src_mask */
+ 0x0000ffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* TLS thread pointer offset. */
+ HOWTO (R_MIPS_TLS_GOTTPREL, /* 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_TLS_GOTTPREL", /* name */
+ TRUE, /* partial_inplace */
+ 0x0000ffff, /* src_mask */
+ 0x0000ffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* TLS IE dynamic relocations. */
+ EMPTY_HOWTO (R_MIPS_TLS_TPREL32),
+
+ HOWTO (R_MIPS_TLS_TPREL64, /* 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_TLS_TPREL64", /* name */
+ TRUE, /* partial_inplace */
+ MINUS_ONE, /* src_mask */
+ MINUS_ONE, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* TLS thread pointer offset. */
+ HOWTO (R_MIPS_TLS_TPREL_HI16, /* 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_TLS_TPREL_HI16", /* name */
+ TRUE, /* partial_inplace */
+ 0x0000ffff, /* src_mask */
+ 0x0000ffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* TLS thread pointer offset. */
+ HOWTO (R_MIPS_TLS_TPREL_LO16, /* 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_TLS_TPREL_LO16", /* name */
+ TRUE, /* partial_inplace */
+ 0x0000ffff, /* src_mask */
+ 0x0000ffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* 32 bit relocation with no addend. */
+ HOWTO (R_MIPS_GLOB_DAT, /* 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_GLOB_DAT", /* name */
+ FALSE, /* partial_inplace */
+ 0x0, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
};
/* The relocation table used for SHT_RELA sections. */
@@ -794,9 +963,11 @@ static reloc_howto_type mips_elf64_howto_table_rela[] =
0x0000ffff, /* dst_mask */
FALSE), /* pcrel_offset */
- /* 16 bit PC relative reference. */
+ /* 16 bit PC relative reference. Note that the ABI document has a typo
+ and claims R_MIPS_PC16 to be not rightshifted, rendering it useless.
+ We do the right thing here. */
HOWTO (R_MIPS_PC16, /* type */
- 0, /* rightshift */
+ 2, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
16, /* bitsize */
TRUE, /* pc_relative */
@@ -1138,7 +1309,7 @@ static reloc_howto_type mips_elf64_howto_table_rela[] =
/* Protected jump conversion. This is an optimization hint. No
relocation is required for correctness. */
- HOWTO (R_MIPS_JALR, /* type */
+ HOWTO (R_MIPS_JALR, /* type */
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
32, /* bitsize */
@@ -1146,15 +1317,158 @@ static reloc_howto_type mips_elf64_howto_table_rela[] =
0, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
_bfd_mips_elf_generic_reloc, /* special_function */
- "R_MIPS_JALR", /* name */
+ "R_MIPS_JALR", /* name */
FALSE, /* partial_inplace */
0, /* src_mask */
0x00000000, /* dst_mask */
FALSE), /* pcrel_offset */
+
+ /* TLS relocations. */
+ EMPTY_HOWTO (R_MIPS_TLS_DTPMOD32),
+ EMPTY_HOWTO (R_MIPS_TLS_DTPREL32),
+ EMPTY_HOWTO (R_MIPS_TLS_DTPMOD64),
+
+ HOWTO (R_MIPS_TLS_DTPREL64, /* 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_TLS_DTPREL64", /* name */
+ TRUE, /* partial_inplace */
+ MINUS_ONE, /* src_mask */
+ MINUS_ONE, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* TLS general dynamic variable reference. */
+ HOWTO (R_MIPS_TLS_GD, /* 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_TLS_GD", /* name */
+ TRUE, /* partial_inplace */
+ 0x0000ffff, /* src_mask */
+ 0x0000ffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* TLS local dynamic variable reference. */
+ HOWTO (R_MIPS_TLS_LDM, /* 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_TLS_LDM", /* name */
+ TRUE, /* partial_inplace */
+ 0x0000ffff, /* src_mask */
+ 0x0000ffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* TLS local dynamic offset. */
+ HOWTO (R_MIPS_TLS_DTPREL_HI16, /* 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_TLS_DTPREL_HI16", /* name */
+ TRUE, /* partial_inplace */
+ 0x0000ffff, /* src_mask */
+ 0x0000ffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* TLS local dynamic offset. */
+ HOWTO (R_MIPS_TLS_DTPREL_LO16, /* 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_TLS_DTPREL_LO16", /* name */
+ TRUE, /* partial_inplace */
+ 0x0000ffff, /* src_mask */
+ 0x0000ffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* TLS thread pointer offset. */
+ HOWTO (R_MIPS_TLS_GOTTPREL, /* 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_TLS_GOTTPREL", /* name */
+ TRUE, /* partial_inplace */
+ 0x0000ffff, /* src_mask */
+ 0x0000ffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ EMPTY_HOWTO (R_MIPS_TLS_TPREL32),
+ EMPTY_HOWTO (R_MIPS_TLS_TPREL64),
+
+ /* TLS thread pointer offset. */
+ HOWTO (R_MIPS_TLS_TPREL_HI16, /* 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_TLS_TPREL_HI16", /* name */
+ TRUE, /* partial_inplace */
+ 0x0000ffff, /* src_mask */
+ 0x0000ffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* TLS thread pointer offset. */
+ HOWTO (R_MIPS_TLS_TPREL_LO16, /* 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_TLS_TPREL_LO16", /* name */
+ TRUE, /* partial_inplace */
+ 0x0000ffff, /* src_mask */
+ 0x0000ffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* 32 bit relocation with no addend. */
+ HOWTO (R_MIPS_GLOB_DAT, /* 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_GLOB_DAT", /* name */
+ FALSE, /* partial_inplace */
+ 0x0, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
};
-/* The reloc used for the mips16 jump instruction. */
-static reloc_howto_type elf_mips16_jump_howto =
+static reloc_howto_type mips16_elf64_howto_table_rel[] =
+{
+ /* The reloc used for the mips16 jump instruction. */
HOWTO (R_MIPS16_26, /* type */
2, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
@@ -1165,15 +1479,14 @@ static reloc_howto_type elf_mips16_jump_howto =
/* This needs complex overflow
detection, because the upper four
bits must match the PC. */
- mips16_jump_reloc, /* special_function */
+ _bfd_mips_elf_generic_reloc, /* special_function */
"R_MIPS16_26", /* name */
TRUE, /* partial_inplace */
0x3ffffff, /* src_mask */
0x3ffffff, /* dst_mask */
- FALSE); /* pcrel_offset */
+ FALSE), /* pcrel_offset */
-/* The reloc used for the mips16 gprel instruction. */
-static reloc_howto_type elf_mips16_gprel_howto =
+ /* The reloc used for the mips16 gprel instruction. */
HOWTO (R_MIPS16_GPREL, /* type */
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
@@ -1184,9 +1497,118 @@ static reloc_howto_type elf_mips16_gprel_howto =
mips16_gprel_reloc, /* special_function */
"R_MIPS16_GPREL", /* name */
TRUE, /* partial_inplace */
- 0x07ff001f, /* src_mask */
- 0x07ff001f, /* dst_mask */
- FALSE); /* pcrel_offset */
+ 0x0000ffff, /* src_mask */
+ 0x0000ffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* A placeholder for MIPS16 reference to global offset table. */
+ EMPTY_HOWTO (R_MIPS16_GOT16),
+
+ /* A placeholder for MIPS16 16 bit call through global offset table. */
+ EMPTY_HOWTO (R_MIPS16_CALL16),
+
+ /* MIPS16 high 16 bits of symbol value. */
+ HOWTO (R_MIPS16_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_MIPS16_HI16", /* name */
+ TRUE, /* partial_inplace */
+ 0x0000ffff, /* src_mask */
+ 0x0000ffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* MIPS16 low 16 bits of symbol value. */
+ HOWTO (R_MIPS16_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_MIPS16_LO16", /* name */
+ TRUE, /* partial_inplace */
+ 0x0000ffff, /* src_mask */
+ 0x0000ffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+};
+
+static reloc_howto_type mips16_elf64_howto_table_rela[] =
+{
+ /* The reloc used for the mips16 jump instruction. */
+ 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. */
+ _bfd_mips_elf_generic_reloc, /* special_function */
+ "R_MIPS16_26", /* name */
+ FALSE, /* partial_inplace */
+ 0x3ffffff, /* src_mask */
+ 0x3ffffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* The reloc used for the mips16 gprel instruction. */
+ 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 */
+ FALSE, /* partial_inplace */
+ 0x0000ffff, /* src_mask */
+ 0x0000ffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* A placeholder for MIPS16 reference to global offset table. */
+ EMPTY_HOWTO (R_MIPS16_GOT16),
+
+ /* A placeholder for MIPS16 16 bit call through global offset table. */
+ EMPTY_HOWTO (R_MIPS16_CALL16),
+
+ /* MIPS16 high 16 bits of symbol value. */
+ HOWTO (R_MIPS16_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_MIPS16_HI16", /* name */
+ FALSE, /* partial_inplace */
+ 0x0000ffff, /* src_mask */
+ 0x0000ffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* MIPS16 low 16 bits of symbol value. */
+ HOWTO (R_MIPS16_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_MIPS16_LO16", /* name */
+ FALSE, /* partial_inplace */
+ 0x0000ffff, /* src_mask */
+ 0x0000ffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+};
/* GNU extension to record C++ vtable hierarchy */
static reloc_howto_type elf_mips_gnu_vtinherit_howto =
@@ -1367,9 +1789,6 @@ mips_elf64_be_swap_reloc_out (bfd *abfd, const Elf_Internal_Rela *src,
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);
@@ -1546,14 +1965,14 @@ mips_elf64_literal_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol,
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. */
+ /* R_MIPS_LITERAL relocations are defined for local symbols only. */
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;
+ *error_message = (char *)
+ _("literal relocation occurs for an external symbol");
+ return bfd_reloc_outofrange;
}
/* FIXME: The entries in the .lit8 and .lit4 sections should be merged. */
@@ -1589,8 +2008,7 @@ mips_elf64_gprel32_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol,
bfd_vma relocation;
bfd_vma val;
- /* If we're relocating, and this is an external symbol, we don't want
- to change anything. */
+ /* 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)
@@ -1608,10 +2026,10 @@ mips_elf64_gprel32_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol,
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;
+ 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;
@@ -1621,7 +2039,7 @@ mips_elf64_gprel32_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol,
relocation += symbol->section->output_section->vma;
relocation += symbol->section->output_offset;
- if (reloc_entry->address > input_section->_cooked_size)
+ if (reloc_entry->address > bfd_get_section_limit (abfd, input_section))
return bfd_reloc_outofrange;
/* Set val to the offset into the section or symbol. */
@@ -1667,37 +2085,6 @@ mips_elf64_shift6_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol,
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
@@ -1707,14 +2094,11 @@ mips16_gprel_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol,
{
bfd_boolean relocatable;
bfd_reloc_status_type ret;
+ bfd_byte *location;
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 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)
@@ -1736,55 +2120,16 @@ mips16_gprel_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol,
if (ret != bfd_reloc_ok)
return ret;
- if (reloc_entry->address > input_section->_cooked_size)
- return bfd_reloc_outofrange;
+ location = (bfd_byte *) data + reloc_entry->address;
+ _bfd_mips16_elf_reloc_unshuffle (abfd, reloc_entry->howto->type, FALSE,
+ location);
+ ret = _bfd_mips_elf_gprel16_with_gp (abfd, symbol, reloc_entry,
+ input_section, relocatable,
+ data, gp);
+ _bfd_mips16_elf_reloc_shuffle (abfd, reloc_entry->howto->type, !relocatable,
+ location);
- 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;
+ return ret;
}
/* A mapping from BFD reloc types to MIPS ELF reloc types. */
@@ -1802,7 +2147,7 @@ static const struct elf_reloc_map mips_reloc_map[] =
/* 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_16_PCREL_S2, R_MIPS_PC16 },
{ BFD_RELOC_HI16_S, R_MIPS_HI16 },
{ BFD_RELOC_LO16, R_MIPS_LO16 },
{ BFD_RELOC_GPREL16, R_MIPS_GPREL16 },
@@ -1830,7 +2175,28 @@ static const struct elf_reloc_map mips_reloc_map[] =
{ 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 }
+ { BFD_RELOC_MIPS_JALR, R_MIPS_JALR },
+ { BFD_RELOC_MIPS_TLS_DTPMOD32, R_MIPS_TLS_DTPMOD32 },
+ { BFD_RELOC_MIPS_TLS_DTPREL32, R_MIPS_TLS_DTPREL32 },
+ { BFD_RELOC_MIPS_TLS_DTPMOD64, R_MIPS_TLS_DTPMOD64 },
+ { BFD_RELOC_MIPS_TLS_DTPREL64, R_MIPS_TLS_DTPREL64 },
+ { BFD_RELOC_MIPS_TLS_GD, R_MIPS_TLS_GD },
+ { BFD_RELOC_MIPS_TLS_LDM, R_MIPS_TLS_LDM },
+ { BFD_RELOC_MIPS_TLS_DTPREL_HI16, R_MIPS_TLS_DTPREL_HI16 },
+ { BFD_RELOC_MIPS_TLS_DTPREL_LO16, R_MIPS_TLS_DTPREL_LO16 },
+ { BFD_RELOC_MIPS_TLS_GOTTPREL, R_MIPS_TLS_GOTTPREL },
+ { BFD_RELOC_MIPS_TLS_TPREL32, R_MIPS_TLS_TPREL32 },
+ { BFD_RELOC_MIPS_TLS_TPREL64, R_MIPS_TLS_TPREL64 },
+ { BFD_RELOC_MIPS_TLS_TPREL_HI16, R_MIPS_TLS_TPREL_HI16 },
+ { BFD_RELOC_MIPS_TLS_TPREL_LO16, R_MIPS_TLS_TPREL_LO16 }
+};
+
+static const struct elf_reloc_map mips16_reloc_map[] =
+{
+ { BFD_RELOC_MIPS16_JMP, R_MIPS16_26 - R_MIPS16_min },
+ { BFD_RELOC_MIPS16_GPREL, R_MIPS16_GPREL - R_MIPS16_min },
+ { BFD_RELOC_MIPS16_HI16_S, R_MIPS16_HI16 - R_MIPS16_min },
+ { BFD_RELOC_MIPS16_LO16, R_MIPS16_LO16 - R_MIPS16_min },
};
/* Given a BFD reloc type, return a howto structure. */
@@ -1843,6 +2209,7 @@ bfd_elf64_bfd_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED,
/* FIXME: We default to RELA here instead of choosing the right
relocation variant. */
reloc_howto_type *howto_table = mips_elf64_howto_table_rela;
+ reloc_howto_type *howto16_table = mips16_elf64_howto_table_rela;
for (i = 0; i < sizeof (mips_reloc_map) / sizeof (struct elf_reloc_map);
i++)
@@ -1851,24 +2218,58 @@ bfd_elf64_bfd_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED,
return &howto_table[(int) mips_reloc_map[i].elf_val];
}
+ for (i = 0; i < sizeof (mips16_reloc_map) / sizeof (struct elf_reloc_map);
+ i++)
+ {
+ if (mips16_reloc_map[i].bfd_val == code)
+ return &howto16_table[(int) mips16_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;
}
}
+static reloc_howto_type *
+bfd_elf64_bfd_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED,
+ const char *r_name)
+{
+ unsigned int i;
+
+ for (i = 0;
+ i < (sizeof (mips_elf64_howto_table_rela)
+ / sizeof (mips_elf64_howto_table_rela[0])); i++)
+ if (mips_elf64_howto_table_rela[i].name != NULL
+ && strcasecmp (mips_elf64_howto_table_rela[i].name, r_name) == 0)
+ return &mips_elf64_howto_table_rela[i];
+
+ for (i = 0;
+ i < (sizeof (mips16_elf64_howto_table_rela)
+ / sizeof (mips16_elf64_howto_table_rela[0]));
+ i++)
+ if (mips16_elf64_howto_table_rela[i].name != NULL
+ && strcasecmp (mips16_elf64_howto_table_rela[i].name, r_name) == 0)
+ return &mips16_elf64_howto_table_rela[i];
+
+ if (strcasecmp (elf_mips_gnu_vtinherit_howto.name, r_name) == 0)
+ return &elf_mips_gnu_vtinherit_howto;
+ if (strcasecmp (elf_mips_gnu_vtentry_howto.name, r_name) == 0)
+ return &elf_mips_gnu_vtentry_howto;
+ if (strcasecmp (elf_mips_gnu_rel16_s2.name, r_name) == 0)
+ return &elf_mips_gnu_rel16_s2;
+ if (strcasecmp (elf_mips_gnu_rela16_s2.name, r_name) == 0)
+ return &elf_mips_gnu_rela16_s2;
+
+ return NULL;
+}
+
/* Given a MIPS Elf_Internal_Rel, fill in an arelent structure. */
static reloc_howto_type *
@@ -1876,10 +2277,6 @@ 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:
@@ -1890,6 +2287,13 @@ mips_elf64_rtype_to_howto (unsigned int r_type, bfd_boolean rela_p)
else
return &elf_mips_gnu_rel16_s2;
default:
+ if (r_type >= R_MIPS16_min && r_type < R_MIPS16_max)
+ {
+ if (rela_p)
+ return &mips16_elf64_howto_table_rela[r_type - R_MIPS16_min];
+ else
+ return &mips16_elf64_howto_table_rel[r_type - R_MIPS16_min];
+ }
BFD_ASSERT (r_type < (unsigned int) R_MIPS_max);
if (rela_p)
return &mips_elf64_howto_table_rela[r_type];
@@ -1984,7 +2388,7 @@ mips_elf64_canonicalize_dynamic_reloc (bfd *abfd, arelent **storage,
if (! (*slurp_relocs) (abfd, s, syms, TRUE))
return -1;
- count = s->_raw_size / elf_section_data (s)->this_hdr.sh_entsize * 3;
+ count = s->size / elf_section_data (s)->this_hdr.sh_entsize * 3;
p = s->relocation;
for (i = 0; i < count; i++)
*storage++ = p++;
@@ -2120,7 +2524,7 @@ mips_elf64_slurp_one_reloc_table (bfd *abfd, asection *asect,
case RSS_GP0:
case RSS_LOC:
/* FIXME: I think these need to be handled using
- special howto structures. */
+ special howto structures. */
BFD_ASSERT (0);
break;
@@ -2210,7 +2614,7 @@ mips_elf64_slurp_reloc_table (bfd *abfd, asection *asect,
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)
+ if (asect->size == 0)
return TRUE;
rel_hdr = &d->this_hdr;
@@ -2352,6 +2756,8 @@ mips_elf64_write_rel (bfd *abfd, asection *sec,
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;
@@ -2448,6 +2854,8 @@ mips_elf64_write_rela (bfd *abfd, asection *sec,
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;
@@ -2539,7 +2947,7 @@ static bfd_boolean
elf64_mips_grok_prstatus (bfd *abfd, Elf_Internal_Note *note)
{
int offset;
- unsigned int raw_size;
+ unsigned int size;
switch (note->descsz)
{
@@ -2555,14 +2963,14 @@ elf64_mips_grok_prstatus (bfd *abfd, Elf_Internal_Note *note)
/* pr_reg */
offset = 112;
- raw_size = 360;
+ size = 360;
break;
}
/* Make a ".reg/999" section. */
return _bfd_elfcore_make_pseudosection (abfd, ".reg",
- raw_size, note->descpos + offset);
+ size, note->descpos + offset);
}
static bfd_boolean
@@ -2652,8 +3060,8 @@ const struct elf_size_info mips_elf64_size_info =
sizeof (Elf64_External_Sym),
sizeof (Elf64_External_Dyn),
sizeof (Elf_External_Note),
- 4, /* hash-table entry size */
- 3, /* internal relocations per external relocations */
+ 4, /* hash-table entry size */
+ 3, /* internal relocations per external relocations */
64, /* arch_size */
3, /* log_file_align */
ELFCLASS64,
@@ -2694,12 +3102,15 @@ const struct elf_size_info mips_elf64_size_info =
#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_merge_symbol_attribute \
+ _bfd_mips_elf_merge_symbol_attribute
#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_init_index_section _bfd_elf_init_1_index_section
#define elf_backend_relocate_section _bfd_mips_elf_relocate_section
#define elf_backend_finish_dynamic_symbol \
_bfd_mips_elf_finish_dynamic_symbol
@@ -2739,6 +3150,7 @@ const struct elf_size_info mips_elf64_size_info =
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_find_inliner_info _bfd_mips_elf_find_inliner_info
#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 \
@@ -2786,10 +3198,8 @@ extern bfd_boolean bfd_elf64_archive_write_armap
#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
+#define ELF_MAXPAGESIZE 0x10000
+#define ELF_COMMONPAGESIZE 0x1000
#include "elf64-target.h"
@@ -2800,15 +3210,15 @@ extern bfd_boolean bfd_elf64_archive_write_armap
#undef TARGET_BIG_NAME
#undef ELF_MAXPAGESIZE
+#undef ELF_COMMONPAGESIZE
-#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"
+#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 ELF_COMMONPAGESIZE 0x1000
#define elf64_bed elf64_tradbed
/* Include the target file again for this target. */
diff --git a/contrib/binutils/bfd/elf64-ppc.c b/contrib/binutils/bfd/elf64-ppc.c
index bc9e0a7..c292d1e 100644
--- a/contrib/binutils/bfd/elf64-ppc.c
+++ b/contrib/binutils/bfd/elf64-ppc.c
@@ -1,5 +1,5 @@
/* PowerPC64-specific support for 64-bit ELF.
- Copyright 1999, 2000, 2001, 2002, 2003, 2004
+ Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
Free Software Foundation, Inc.
Written by Linus Nordberg, Swox AB <info@swox.com>,
based on elf32-ppc.c by Ian Lance Taylor.
@@ -19,14 +19,15 @@
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. */
+ 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, 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 <stdarg.h>
+#include "bfd.h"
#include "bfdlink.h"
#include "libbfd.h"
#include "elf-bfd.h"
@@ -35,6 +36,8 @@
static bfd_reloc_status_type ppc64_elf_ha_reloc
(bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **);
+static bfd_reloc_status_type ppc64_elf_branch_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
@@ -49,7 +52,8 @@ 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 **);
-
+static bfd_vma opd_entry_value
+ (asection *, bfd_vma, asection **, bfd_vma *);
#define TARGET_LITTLE_SYM bfd_elf64_powerpcle_vec
#define TARGET_LITTLE_NAME "elf64-powerpcle"
@@ -58,38 +62,48 @@ static bfd_reloc_status_type ppc64_elf_unhandled_reloc
#define ELF_ARCH bfd_arch_powerpc
#define ELF_MACHINE_CODE EM_PPC64
#define ELF_MAXPAGESIZE 0x10000
+#define ELF_COMMONPAGESIZE 0x1000
#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 elf_backend_default_execstack 0
#define bfd_elf64_mkobject ppc64_elf_mkobject
#define bfd_elf64_bfd_reloc_type_lookup ppc64_elf_reloc_type_lookup
+#define bfd_elf64_bfd_reloc_name_lookup ppc64_elf_reloc_name_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 bfd_elf64_get_synthetic_symtab ppc64_elf_get_synthetic_symtab
#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_write_core_note ppc64_elf_write_core_note
#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_directives ppc64_elf_check_directives
+#define elf_backend_as_needed_cleanup ppc64_elf_as_needed_cleanup
+#define elf_backend_archive_symbol_lookup ppc64_elf_archive_symbol_lookup
#define elf_backend_check_relocs ppc64_elf_check_relocs
+#define elf_backend_gc_mark_dynamic_ref ppc64_elf_gc_mark_dynamic_ref
#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_init_index_section _bfd_elf_init_2_index_sections
+#define elf_backend_action_discarded ppc64_elf_action_discarded
#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
@@ -127,30 +141,29 @@ static bfd_reloc_status_type ppc64_elf_unhandled_reloc
#define BCTR 0x4e800420 /* bctr */
+#define ADDIS_R12_R12 0x3d8c0000 /* addis %r12,%r12,off@ha */
#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. */
+/* glink call stub instructions. We enter with the index in R0. */
#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 */
+ /* 0: */
+ /* .quad plt0-1f */
+ /* __glink: */
+#define MFLR_R12 0x7d8802a6 /* mflr %12 */
+#define BCL_20_31 0x429f0005 /* bcl 20,31,1f */
+ /* 1: */
+#define MFLR_R11 0x7d6802a6 /* mflr %11 */
+#define LD_R2_M16R11 0xe84bfff0 /* ld %2,(0b-1b)(%11) */
+#define MTLR_R12 0x7d8803a6 /* mtlr %12 */
+#define ADD_R12_R2_R11 0x7d825a14 /* add %12,%2,%11 */
+ /* ld %11,0(%12) */
+ /* ld %2,8(%12) */
+ /* mtctr %11 */
+ /* ld %11,16(%12) */
+ /* bctr */
/* Pad with this. */
#define NOP 0x60000000
@@ -168,9 +181,17 @@ static bfd_reloc_status_type ppc64_elf_unhandled_reloc
#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. */
+/* Instructions used by the save and restore reg functions. */
+#define STD_R0_0R1 0xf8010000 /* std %r0,0(%r1) */
+#define STD_R0_0R12 0xf80c0000 /* std %r0,0(%r12) */
+#define LD_R0_0R1 0xe8010000 /* ld %r0,0(%r1) */
+#define LD_R0_0R12 0xe80c0000 /* ld %r0,0(%r12) */
#define STFD_FR0_0R1 0xd8010000 /* stfd %fr0,0(%r1) */
#define LFD_FR0_0R1 0xc8010000 /* lfd %fr0,0(%r1) */
+#define LI_R12_0 0x39800000 /* li %r12,0 */
+#define STVX_VR0_R12_R0 0x7c0c01ce /* stvx %v0,%r12,%r0 */
+#define LVX_VR0_R12_R0 0x7c0c00ce /* lvx %v0,%r12,%r0 */
+#define MTLR_R0 0x7c0803a6 /* mtlr %r0 */
#define BLR 0x4e800020 /* blr */
/* Since .opd is an array of descriptors and each entry will end up
@@ -303,7 +324,7 @@ static reloc_howto_type ppc64_elf_howto_raw[] = {
FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
+ ppc64_elf_branch_reloc, /* special_function */
"R_PPC64_ADDR14", /* name */
FALSE, /* partial_inplace */
0, /* src_mask */
@@ -352,7 +373,7 @@ static reloc_howto_type ppc64_elf_howto_raw[] = {
TRUE, /* pc_relative */
0, /* bitpos */
complain_overflow_signed, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
+ ppc64_elf_branch_reloc, /* special_function */
"R_PPC64_REL24", /* name */
FALSE, /* partial_inplace */
0, /* src_mask */
@@ -367,7 +388,7 @@ static reloc_howto_type ppc64_elf_howto_raw[] = {
TRUE, /* pc_relative */
0, /* bitpos */
complain_overflow_signed, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
+ ppc64_elf_branch_reloc, /* special_function */
"R_PPC64_REL14", /* name */
FALSE, /* partial_inplace */
0, /* src_mask */
@@ -1178,7 +1199,7 @@ static reloc_howto_type ppc64_elf_howto_raw[] = {
/* Like R_PPC64_PLTGOT16, but for instructions with a DS field. */
/* FIXME: R_PPC64_PLTGOT16_DS not implemented. */
- HOWTO (R_PPC64_PLTGOT16_DS, /* type */
+ HOWTO (R_PPC64_PLTGOT16_DS, /* type */
0, /* rightshift */
1, /* size (0 = byte, 1 = short, 2 = long) */
16, /* bitsize */
@@ -2091,6 +2112,22 @@ ppc64_elf_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED,
return ppc64_elf_howto_table[r];
};
+static reloc_howto_type *
+ppc64_elf_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED,
+ const char *r_name)
+{
+ unsigned int i;
+
+ for (i = 0;
+ i < sizeof (ppc64_elf_howto_raw) / sizeof (ppc64_elf_howto_raw[0]);
+ i++)
+ if (ppc64_elf_howto_raw[i].name != NULL
+ && strcasecmp (ppc64_elf_howto_raw[i].name, r_name) == 0)
+ return &ppc64_elf_howto_raw[i];
+
+ return NULL;
+}
+
/* Set the howto pointer for a PowerPC ELF reloc. */
static void
@@ -2104,8 +2141,13 @@ ppc64_elf_info_to_howto (bfd *abfd ATTRIBUTE_UNUSED, arelent *cache_ptr,
ppc_howto_init ();
type = ELF64_R_TYPE (dst->r_info);
- BFD_ASSERT (type < (sizeof (ppc64_elf_howto_table)
- / sizeof (ppc64_elf_howto_table[0])));
+ if (type >= (sizeof (ppc64_elf_howto_table)
+ / sizeof (ppc64_elf_howto_table[0])))
+ {
+ (*_bfd_error_handler) (_("%B: invalid relocation type %d"),
+ abfd, (int) type);
+ type = R_PPC64_NONE;
+ }
cache_ptr->howto = ppc64_elf_howto_table[type];
}
@@ -2131,6 +2173,29 @@ ppc64_elf_ha_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol,
}
static bfd_reloc_status_type
+ppc64_elf_branch_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol,
+ void *data, asection *input_section,
+ bfd *output_bfd, char **error_message)
+{
+ if (output_bfd != NULL)
+ return bfd_elf_generic_reloc (abfd, reloc_entry, symbol, data,
+ input_section, output_bfd, error_message);
+
+ if (strcmp (symbol->section->name, ".opd") == 0
+ && (symbol->section->owner->flags & DYNAMIC) == 0)
+ {
+ bfd_vma dest = opd_entry_value (symbol->section,
+ symbol->value + reloc_entry->addend,
+ NULL, NULL);
+ if (dest != (bfd_vma) -1)
+ reloc_entry->addend = dest - (symbol->value
+ + symbol->section->output_section->vma
+ + symbol->section->output_offset);
+ }
+ 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)
@@ -2166,7 +2231,7 @@ ppc64_elf_brtaken_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol,
else if ((insn & (0x14 << 21)) == (0x10 << 21))
insn |= 0x08 << 21;
else
- return bfd_reloc_continue;
+ goto out;
}
else
{
@@ -2188,7 +2253,9 @@ ppc64_elf_brtaken_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol,
insn ^= 0x01 << 21;
}
bfd_put_32 (abfd, insn, (bfd_byte *) data + octets);
- return bfd_reloc_continue;
+ out:
+ return ppc64_elf_branch_reloc (abfd, reloc_entry, symbol, data,
+ input_section, output_bfd, error_message);
}
static bfd_reloc_status_type
@@ -2331,12 +2398,19 @@ struct ppc64_elf_obj_tdata
asection *got;
asection *relgot;
+ /* Used during garbage collection. We attach global symbols defined
+ on removed .opd entries to this section so that the sym is removed. */
+ asection *deleted_section;
+
/* 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;
+
+ /* A copy of relocs before they are modified for --emit-relocs. */
+ Elf_Internal_Rela *opd_relocs;
};
#define ppc64_elf_tdata(bfd) \
@@ -2350,11 +2424,25 @@ struct ppc64_elf_obj_tdata
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;
+ {
+ 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 bfd_elf_mkobject (abfd);
+}
+
+/* Return 1 if target is one of ours. */
+
+static bfd_boolean
+is_ppc64_elf_target (const struct bfd_target *targ)
+{
+ extern const bfd_target bfd_elf64_powerpc_vec;
+ extern const bfd_target bfd_elf64_powerpcle_vec;
+
+ return targ == &bfd_elf64_powerpc_vec || targ == &bfd_elf64_powerpcle_vec;
}
/* Fix bad default arch selected for a 64 bit input bfd when the
@@ -2382,7 +2470,7 @@ ppc64_elf_object_p (bfd *abfd)
static bfd_boolean
ppc64_elf_grok_prstatus (bfd *abfd, Elf_Internal_Note *note)
{
- size_t offset, raw_size;
+ size_t offset, size;
if (note->descsz != 504)
return FALSE;
@@ -2395,11 +2483,11 @@ ppc64_elf_grok_prstatus (bfd *abfd, Elf_Internal_Note *note)
/* pr_reg */
offset = 112;
- raw_size = 384;
+ size = 384;
/* Make a ".reg/999" section. */
return _bfd_elfcore_make_pseudosection (abfd, ".reg",
- raw_size, note->descpos + offset);
+ size, note->descpos + offset);
}
static bfd_boolean
@@ -2416,6 +2504,53 @@ ppc64_elf_grok_psinfo (bfd *abfd, Elf_Internal_Note *note)
return TRUE;
}
+static char *
+ppc64_elf_write_core_note (bfd *abfd, char *buf, int *bufsiz, int note_type,
+ ...)
+{
+ switch (note_type)
+ {
+ default:
+ return NULL;
+
+ case NT_PRPSINFO:
+ {
+ char data[136];
+ va_list ap;
+
+ va_start (ap, note_type);
+ memset (data, 0, 40);
+ strncpy (data + 40, va_arg (ap, const char *), 16);
+ strncpy (data + 56, va_arg (ap, const char *), 80);
+ va_end (ap);
+ return elfcore_write_note (abfd, buf, bufsiz,
+ "CORE", note_type, data, sizeof (data));
+ }
+
+ case NT_PRSTATUS:
+ {
+ char data[504];
+ va_list ap;
+ long pid;
+ int cursig;
+ const void *greg;
+
+ va_start (ap, note_type);
+ memset (data, 0, 112);
+ pid = va_arg (ap, long);
+ bfd_put_32 (abfd, pid, data + 32);
+ cursig = va_arg (ap, int);
+ bfd_put_16 (abfd, cursig, data + 12);
+ greg = va_arg (ap, const void *);
+ memcpy (data + 112, greg, 384);
+ memset (data + 496, 0, 8);
+ va_end (ap);
+ return elfcore_write_note (abfd, buf, bufsiz,
+ "CORE", note_type, data, sizeof (data));
+ }
+ }
+}
+
/* Merge backend specific data from an object file to the output
object file when linking. */
@@ -2430,13 +2565,13 @@ ppc64_elf_merge_private_bfd_data (bfd *ibfd, bfd *obfd)
const char *msg;
if (bfd_big_endian (ibfd))
- msg = _("%s: compiled for a big endian system "
+ msg = _("%B: compiled for a big endian system "
"and target is little endian");
else
- msg = _("%s: compiled for a little endian system "
+ msg = _("%B: compiled for a little endian system "
"and target is big endian");
- (*_bfd_error_handler) (msg, bfd_archive_filename (ibfd));
+ (*_bfd_error_handler) (msg, ibfd);
bfd_set_error (bfd_error_wrong_format);
return FALSE;
@@ -2447,15 +2582,21 @@ ppc64_elf_merge_private_bfd_data (bfd *ibfd, bfd *obfd)
/* Add extra PPC sections. */
-static struct bfd_elf_special_section const ppc64_elf_special_sections[]=
+static const struct bfd_elf_special_section 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 }
+ { STRING_COMMA_LEN (".plt"), 0, SHT_NOBITS, 0 },
+ { STRING_COMMA_LEN (".sbss"), -2, SHT_NOBITS, SHF_ALLOC + SHF_WRITE },
+ { STRING_COMMA_LEN (".sdata"), -2, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE },
+ { STRING_COMMA_LEN (".toc"), 0, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE },
+ { STRING_COMMA_LEN (".toc1"), 0, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE },
+ { STRING_COMMA_LEN (".tocbss"), 0, SHT_NOBITS, SHF_ALLOC + SHF_WRITE },
+ { NULL, 0, 0, 0, 0 }
+};
+
+enum _ppc64_sec_type {
+ sec_normal = 0,
+ sec_opd = 1,
+ sec_toc = 2
};
struct _ppc64_elf_section_data
@@ -2466,14 +2607,20 @@ struct _ppc64_elf_section_data
union
{
/* Points to the function code section for local opd entries. */
- asection **func_sec;
+ asection **opd_func_sec;
/* After editing .opd, adjust references to opd local syms. */
- long *adjust;
- } opd;
+ long *opd_adjust;
+
+ /* An array for toc sections, indexed by offset/8.
+ Specifies the relocation symbol index used at a given toc offset. */
+ unsigned *t_symndx;
+ } u;
- /* An array for toc sections, indexed by offset/8.
- Specifies the relocation symbol index used at a given toc offset. */
- unsigned *t_symndx;
+ enum _ppc64_sec_type sec_type:2;
+
+ /* Flag set when small branches are detected. Used to
+ select suitable defaults for the stub group size. */
+ unsigned int has_14bit_branch:1;
};
#define ppc64_elf_section_data(sec) \
@@ -2482,16 +2629,428 @@ struct _ppc64_elf_section_data
static bfd_boolean
ppc64_elf_new_section_hook (bfd *abfd, asection *sec)
{
- struct _ppc64_elf_section_data *sdata;
- bfd_size_type amt = sizeof (*sdata);
+ if (!sec->used_by_bfd)
+ {
+ 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;
+ sdata = bfd_zalloc (abfd, amt);
+ if (sdata == NULL)
+ return FALSE;
+ sec->used_by_bfd = sdata;
+ }
return _bfd_elf_new_section_hook (abfd, sec);
}
+
+static void *
+get_opd_info (asection * sec)
+{
+ if (sec != NULL
+ && ppc64_elf_section_data (sec) != NULL
+ && ppc64_elf_section_data (sec)->sec_type == sec_opd)
+ return ppc64_elf_section_data (sec)->u.opd_adjust;
+ return NULL;
+}
+
+/* Parameters for the qsort hook. */
+static asection *synthetic_opd;
+static bfd_boolean synthetic_relocatable;
+
+/* qsort comparison function for ppc64_elf_get_synthetic_symtab. */
+
+static int
+compare_symbols (const void *ap, const void *bp)
+{
+ const asymbol *a = * (const asymbol **) ap;
+ const asymbol *b = * (const asymbol **) bp;
+
+ /* Section symbols first. */
+ if ((a->flags & BSF_SECTION_SYM) && !(b->flags & BSF_SECTION_SYM))
+ return -1;
+ if (!(a->flags & BSF_SECTION_SYM) && (b->flags & BSF_SECTION_SYM))
+ return 1;
+
+ /* then .opd symbols. */
+ if (a->section == synthetic_opd && b->section != synthetic_opd)
+ return -1;
+ if (a->section != synthetic_opd && b->section == synthetic_opd)
+ return 1;
+
+ /* then other code symbols. */
+ if ((a->section->flags & (SEC_CODE | SEC_ALLOC | SEC_THREAD_LOCAL))
+ == (SEC_CODE | SEC_ALLOC)
+ && (b->section->flags & (SEC_CODE | SEC_ALLOC | SEC_THREAD_LOCAL))
+ != (SEC_CODE | SEC_ALLOC))
+ return -1;
+
+ if ((a->section->flags & (SEC_CODE | SEC_ALLOC | SEC_THREAD_LOCAL))
+ != (SEC_CODE | SEC_ALLOC)
+ && (b->section->flags & (SEC_CODE | SEC_ALLOC | SEC_THREAD_LOCAL))
+ == (SEC_CODE | SEC_ALLOC))
+ return 1;
+
+ if (synthetic_relocatable)
+ {
+ if (a->section->id < b->section->id)
+ return -1;
+
+ if (a->section->id > b->section->id)
+ return 1;
+ }
+
+ if (a->value + a->section->vma < b->value + b->section->vma)
+ return -1;
+
+ if (a->value + a->section->vma > b->value + b->section->vma)
+ return 1;
+
+ /* For syms with the same value, prefer strong dynamic global function
+ syms over other syms. */
+ if ((a->flags & BSF_GLOBAL) != 0 && (b->flags & BSF_GLOBAL) == 0)
+ return -1;
+
+ if ((a->flags & BSF_GLOBAL) == 0 && (b->flags & BSF_GLOBAL) != 0)
+ return 1;
+
+ if ((a->flags & BSF_FUNCTION) != 0 && (b->flags & BSF_FUNCTION) == 0)
+ return -1;
+
+ if ((a->flags & BSF_FUNCTION) == 0 && (b->flags & BSF_FUNCTION) != 0)
+ return 1;
+
+ if ((a->flags & BSF_WEAK) == 0 && (b->flags & BSF_WEAK) != 0)
+ return -1;
+
+ if ((a->flags & BSF_WEAK) != 0 && (b->flags & BSF_WEAK) == 0)
+ return 1;
+
+ if ((a->flags & BSF_DYNAMIC) != 0 && (b->flags & BSF_DYNAMIC) == 0)
+ return -1;
+
+ if ((a->flags & BSF_DYNAMIC) == 0 && (b->flags & BSF_DYNAMIC) != 0)
+ return 1;
+
+ return 0;
+}
+
+/* Search SYMS for a symbol of the given VALUE. */
+
+static asymbol *
+sym_exists_at (asymbol **syms, long lo, long hi, int id, bfd_vma value)
+{
+ long mid;
+
+ if (id == -1)
+ {
+ while (lo < hi)
+ {
+ mid = (lo + hi) >> 1;
+ if (syms[mid]->value + syms[mid]->section->vma < value)
+ lo = mid + 1;
+ else if (syms[mid]->value + syms[mid]->section->vma > value)
+ hi = mid;
+ else
+ return syms[mid];
+ }
+ }
+ else
+ {
+ while (lo < hi)
+ {
+ mid = (lo + hi) >> 1;
+ if (syms[mid]->section->id < id)
+ lo = mid + 1;
+ else if (syms[mid]->section->id > id)
+ hi = mid;
+ else if (syms[mid]->value < value)
+ lo = mid + 1;
+ else if (syms[mid]->value > value)
+ hi = mid;
+ else
+ return syms[mid];
+ }
+ }
+ return NULL;
+}
+
+/* Create synthetic symbols, effectively restoring "dot-symbol" function
+ entry syms. */
+
+static long
+ppc64_elf_get_synthetic_symtab (bfd *abfd,
+ long static_count, asymbol **static_syms,
+ long dyn_count, asymbol **dyn_syms,
+ asymbol **ret)
+{
+ asymbol *s;
+ long i;
+ long count;
+ char *names;
+ long symcount, codesecsym, codesecsymend, secsymend, opdsymend;
+ asection *opd;
+ bfd_boolean relocatable = (abfd->flags & (EXEC_P | DYNAMIC)) == 0;
+ asymbol **syms;
+
+ *ret = NULL;
+
+ opd = bfd_get_section_by_name (abfd, ".opd");
+ if (opd == NULL)
+ return 0;
+
+ symcount = static_count;
+ if (!relocatable)
+ symcount += dyn_count;
+ if (symcount == 0)
+ return 0;
+
+ syms = bfd_malloc ((symcount + 1) * sizeof (*syms));
+ if (syms == NULL)
+ return -1;
+
+ if (!relocatable && static_count != 0 && dyn_count != 0)
+ {
+ /* Use both symbol tables. */
+ memcpy (syms, static_syms, static_count * sizeof (*syms));
+ memcpy (syms + static_count, dyn_syms, (dyn_count + 1) * sizeof (*syms));
+ }
+ else if (!relocatable && static_count == 0)
+ memcpy (syms, dyn_syms, (symcount + 1) * sizeof (*syms));
+ else
+ memcpy (syms, static_syms, (symcount + 1) * sizeof (*syms));
+
+ synthetic_opd = opd;
+ synthetic_relocatable = relocatable;
+ qsort (syms, symcount, sizeof (*syms), compare_symbols);
+
+ if (!relocatable && symcount > 1)
+ {
+ long j;
+ /* Trim duplicate syms, since we may have merged the normal and
+ dynamic symbols. Actually, we only care about syms that have
+ different values, so trim any with the same value. */
+ for (i = 1, j = 1; i < symcount; ++i)
+ if (syms[i - 1]->value + syms[i - 1]->section->vma
+ != syms[i]->value + syms[i]->section->vma)
+ syms[j++] = syms[i];
+ symcount = j;
+ }
+
+ i = 0;
+ if (syms[i]->section == opd)
+ ++i;
+ codesecsym = i;
+
+ for (; i < symcount; ++i)
+ if (((syms[i]->section->flags & (SEC_CODE | SEC_ALLOC | SEC_THREAD_LOCAL))
+ != (SEC_CODE | SEC_ALLOC))
+ || (syms[i]->flags & BSF_SECTION_SYM) == 0)
+ break;
+ codesecsymend = i;
+
+ for (; i < symcount; ++i)
+ if ((syms[i]->flags & BSF_SECTION_SYM) == 0)
+ break;
+ secsymend = i;
+
+ for (; i < symcount; ++i)
+ if (syms[i]->section != opd)
+ break;
+ opdsymend = i;
+
+ for (; i < symcount; ++i)
+ if ((syms[i]->section->flags & (SEC_CODE | SEC_ALLOC | SEC_THREAD_LOCAL))
+ != (SEC_CODE | SEC_ALLOC))
+ break;
+ symcount = i;
+
+ count = 0;
+ if (opdsymend == secsymend)
+ goto done;
+
+ if (relocatable)
+ {
+ bfd_boolean (*slurp_relocs) (bfd *, asection *, asymbol **, bfd_boolean);
+ arelent *r;
+ size_t size;
+ long relcount;
+
+ slurp_relocs = get_elf_backend_data (abfd)->s->slurp_reloc_table;
+ relcount = (opd->flags & SEC_RELOC) ? opd->reloc_count : 0;
+ if (relcount == 0)
+ goto done;
+
+ if (!(*slurp_relocs) (abfd, opd, static_syms, FALSE))
+ {
+ count = -1;
+ goto done;
+ }
+
+ size = 0;
+ for (i = secsymend, r = opd->relocation; i < opdsymend; ++i)
+ {
+ asymbol *sym;
+
+ while (r < opd->relocation + relcount
+ && r->address < syms[i]->value + opd->vma)
+ ++r;
+
+ if (r == opd->relocation + relcount)
+ break;
+
+ if (r->address != syms[i]->value + opd->vma)
+ continue;
+
+ if (r->howto->type != R_PPC64_ADDR64)
+ continue;
+
+ sym = *r->sym_ptr_ptr;
+ if (!sym_exists_at (syms, opdsymend, symcount,
+ sym->section->id, sym->value + r->addend))
+ {
+ ++count;
+ size += sizeof (asymbol);
+ size += strlen (syms[i]->name) + 2;
+ }
+ }
+
+ s = *ret = bfd_malloc (size);
+ if (s == NULL)
+ {
+ count = -1;
+ goto done;
+ }
+
+ names = (char *) (s + count);
+
+ for (i = secsymend, r = opd->relocation; i < opdsymend; ++i)
+ {
+ asymbol *sym;
+
+ while (r < opd->relocation + relcount
+ && r->address < syms[i]->value + opd->vma)
+ ++r;
+
+ if (r == opd->relocation + relcount)
+ break;
+
+ if (r->address != syms[i]->value + opd->vma)
+ continue;
+
+ if (r->howto->type != R_PPC64_ADDR64)
+ continue;
+
+ sym = *r->sym_ptr_ptr;
+ if (!sym_exists_at (syms, opdsymend, symcount,
+ sym->section->id, sym->value + r->addend))
+ {
+ size_t len;
+
+ *s = *syms[i];
+ s->section = sym->section;
+ s->value = sym->value + r->addend;
+ s->name = names;
+ *names++ = '.';
+ len = strlen (syms[i]->name);
+ memcpy (names, syms[i]->name, len + 1);
+ names += len + 1;
+ s++;
+ }
+ }
+ }
+ else
+ {
+ bfd_byte *contents;
+ size_t size;
+
+ if (!bfd_malloc_and_get_section (abfd, opd, &contents))
+ {
+ if (contents)
+ {
+ free_contents_and_exit:
+ free (contents);
+ }
+ count = -1;
+ goto done;
+ }
+
+ size = 0;
+ for (i = secsymend; i < opdsymend; ++i)
+ {
+ bfd_vma ent;
+
+ ent = bfd_get_64 (abfd, contents + syms[i]->value);
+ if (!sym_exists_at (syms, opdsymend, symcount, -1, ent))
+ {
+ ++count;
+ size += sizeof (asymbol);
+ size += strlen (syms[i]->name) + 2;
+ }
+ }
+
+ s = *ret = bfd_malloc (size);
+ if (s == NULL)
+ goto free_contents_and_exit;
+
+ names = (char *) (s + count);
+
+ for (i = secsymend; i < opdsymend; ++i)
+ {
+ bfd_vma ent;
+
+ ent = bfd_get_64 (abfd, contents + syms[i]->value);
+ if (!sym_exists_at (syms, opdsymend, symcount, -1, ent))
+ {
+ long lo, hi;
+ size_t len;
+ asection *sec = abfd->sections;
+
+ *s = *syms[i];
+ lo = codesecsym;
+ hi = codesecsymend;
+ while (lo < hi)
+ {
+ long mid = (lo + hi) >> 1;
+ if (syms[mid]->section->vma < ent)
+ lo = mid + 1;
+ else if (syms[mid]->section->vma > ent)
+ hi = mid;
+ else
+ {
+ sec = syms[mid]->section;
+ break;
+ }
+ }
+
+ if (lo >= hi && lo > codesecsym)
+ sec = syms[lo - 1]->section;
+
+ for (; sec != NULL; sec = sec->next)
+ {
+ if (sec->vma > ent)
+ break;
+ if ((sec->flags & SEC_ALLOC) == 0
+ || (sec->flags & SEC_LOAD) == 0)
+ break;
+ if ((sec->flags & SEC_CODE) != 0)
+ s->section = sec;
+ }
+ s->value = ent - s->section->vma;
+ s->name = names;
+ *names++ = '.';
+ len = strlen (syms[i]->name);
+ memcpy (names, syms[i]->name, len + 1);
+ names += len + 1;
+ s++;
+ }
+ }
+ free (contents);
+ }
+
+ done:
+ free (syms);
+ return count;
+}
/* The following functions are specific to the ELF linker, while
functions above are used generally. Those named ppc64_elf_* are
@@ -2559,7 +3118,11 @@ ppc64_elf_new_section_hook (bfd *abfd, asection *sec)
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. */
+ definition from some other object, eg. a static library.
+
+ Update: As of August 2004, we support a new convention. Function
+ calls may use the function descriptor symbol, ie. "bl foo". This
+ behaves exactly as "bl .foo". */
/* 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.
@@ -2669,7 +3232,10 @@ struct plt_entry
. bctr
ppc_stub_plt_call:
- Used to call a function in a shared library.
+ Used to call a function in a shared library. If it so happens that
+ the plt entry referenced crosses a 64k boundary, then an extra
+ "addis %r12,%r12,1" will be inserted before the load at xxx+8 or
+ xxx+16 as appropriate.
. addis %r12,%r2,xxx@toc@ha
. std %r2,40(%r1)
. ld %r11,xxx+0@toc@l(%r12)
@@ -2739,7 +3305,7 @@ struct ppc_branch_hash_entry {
/* Base hash table entry structure. */
struct bfd_hash_entry root;
- /* Offset within .branch_lt. */
+ /* Offset within branch lookup table. */
unsigned int offset;
/* Generation marker. */
@@ -2750,24 +3316,34 @@ 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;
+ union {
+ /* A pointer to the most recently used stub hash entry against this
+ symbol. */
+ struct ppc_stub_hash_entry *stub_cache;
+
+ /* A pointer to the next symbol starting with a '.' */
+ struct ppc_link_hash_entry *next_dot_sym;
+ } u;
/* 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;
+ struct ppc_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;
+ unsigned int fake:1;
- /* Whether global opd sym has been adjusted or not. */
+ /* Whether global opd/toc sym has been adjusted or not.
+ After ppc64_elf_edit_opd/ppc64_elf_edit_toc has run, this flag
+ should be set for all globals defined in any opd/toc section. */
unsigned int adjust_done:1;
+ /* Set if we twiddled this symbol to weak at some stage. */
+ unsigned int was_undefined: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.
@@ -2816,10 +3392,6 @@ struct ppc_link_hash_table
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;
@@ -2829,6 +3401,9 @@ struct ppc_link_hash_table
/* Highest output section index. */
int top_index;
+ /* Used when adding symbols. */
+ struct ppc_link_hash_entry *dot_syms;
+
/* List of input sections for each output section. */
asection **input_list;
@@ -2843,24 +3418,28 @@ struct ppc_link_hash_table
asection *brlt;
asection *relbrlt;
- /* Shortcut to .__tls_get_addr. */
- struct elf_link_hash_entry *tls_get_addr;
+ /* Shortcut to .__tls_get_addr and __tls_get_addr. */
+ struct ppc_link_hash_entry *tls_get_addr;
+ struct ppc_link_hash_entry *tls_get_addr_fd;
/* Statistics. */
unsigned long stub_count[ppc_stub_plt_call];
+ /* Number of stubs against global syms. */
+ unsigned long stub_globals;
+
/* Set if we should emit symbols for stubs. */
- unsigned int emit_stub_syms;
+ unsigned int emit_stub_syms:1;
- /* Set on error. */
- unsigned int stub_error;
+ /* Support for multiple toc sections. */
+ unsigned int no_multi_toc:1;
+ unsigned int multi_toc_needed:1;
- /* Flag set when small branches are detected. Used to
- select suitable defaults for the stub group size. */
- unsigned int has_14bit_branch;
+ /* Set on error. */
+ unsigned int stub_error:1;
- /* Set if we detect a reference undefined weak symbol. */
- unsigned int have_undefweak;
+ /* Temp used by ppc64_elf_check_directives. */
+ unsigned int twiddled_syms:1;
/* Incremented every time we size stubs. */
unsigned int stub_iteration;
@@ -2869,6 +3448,12 @@ struct ppc_link_hash_table
struct sym_sec_cache sym_sec;
};
+/* Rename some of the generic section flags to better document how they
+ are used here. */
+#define has_toc_reloc has_gp_reloc
+#define makes_toc_func_call need_finalize_relax
+#define call_check_in_progress reloc_done
+
/* Get the ppc64 ELF linker hash table from a link_info structure. */
#define ppc_hash_table(p) \
@@ -2971,14 +3556,34 @@ link_hash_newfunc (struct bfd_hash_entry *entry,
{
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;
+ memset (&eh->u.stub_cache, 0,
+ (sizeof (struct ppc_link_hash_entry)
+ - offsetof (struct ppc_link_hash_entry, u.stub_cache)));
+
+ /* When making function calls, old ABI code references function entry
+ points (dot symbols), while new ABI code references the function
+ descriptor symbol. We need to make any combination of reference and
+ definition work together, without breaking archive linking.
+
+ For a defined function "foo" and an undefined call to "bar":
+ An old object defines "foo" and ".foo", references ".bar" (possibly
+ "bar" too).
+ A new object defines "foo" and references "bar".
+
+ A new object thus has no problem with its undefined symbols being
+ satisfied by definitions in an old object. On the other hand, the
+ old object won't have ".bar" satisfied by a new object.
+
+ Keep a list of newly added dot-symbols. */
+
+ if (string[0] == '.')
+ {
+ struct ppc_link_hash_table *htab;
+
+ htab = (struct ppc_link_hash_table *) table;
+ eh->u.next_dot_sym = htab->dot_syms;
+ htab->dot_syms = eh;
+ }
}
return entry;
@@ -2996,28 +3601,35 @@ ppc64_elf_link_hash_table_create (bfd *abfd)
if (htab == NULL)
return NULL;
- if (! _bfd_elf_link_hash_table_init (&htab->elf, abfd, link_hash_newfunc))
+ if (!_bfd_elf_link_hash_table_init (&htab->elf, abfd, link_hash_newfunc,
+ sizeof (struct ppc_link_hash_entry)))
{
free (htab);
return NULL;
}
/* Init the stub hash table too. */
- if (!bfd_hash_table_init (&htab->stub_hash_table, stub_hash_newfunc))
+ if (!bfd_hash_table_init (&htab->stub_hash_table, stub_hash_newfunc,
+ sizeof (struct ppc_stub_hash_entry)))
return NULL;
/* And the branch hash table. */
- if (!bfd_hash_table_init (&htab->branch_hash_table, branch_hash_newfunc))
+ if (!bfd_hash_table_init (&htab->branch_hash_table, branch_hash_newfunc,
+ sizeof (struct ppc_branch_hash_entry)))
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;
+ htab->elf.init_got_refcount.refcount = 0;
+ htab->elf.init_got_refcount.glist = NULL;
+ htab->elf.init_plt_refcount.refcount = 0;
+ htab->elf.init_plt_refcount.glist = NULL;
+ htab->elf.init_got_offset.offset = 0;
+ htab->elf.init_got_offset.glist = NULL;
+ htab->elf.init_plt_offset.offset = 0;
+ htab->elf.init_plt_offset.glist = NULL;
return &htab->elf.root;
}
@@ -3071,27 +3683,29 @@ ppc_stub_name (const asection *input_section,
{
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);
- }
+ if (stub_name == NULL)
+ return stub_name;
+
+ 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);
- }
+ if (stub_name == NULL)
+ return stub_name;
+
+ 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);
}
+ if (stub_name[len - 2] == '+' && stub_name[len - 1] == '0')
+ stub_name[len - 2] = 0;
return stub_name;
}
@@ -3101,12 +3715,11 @@ ppc_stub_name (const asection *input_section,
static struct ppc_stub_hash_entry *
ppc_get_stub_entry (const asection *input_section,
const asection *sym_sec,
- struct elf_link_hash_entry *hash,
+ struct ppc_link_hash_entry *h,
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
@@ -3116,11 +3729,11 @@ ppc_get_stub_entry (const asection *input_section,
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)
+ if (h != NULL && h->u.stub_cache != NULL
+ && h->u.stub_cache->h == h
+ && h->u.stub_cache->id_sec == id_sec)
{
- stub_entry = h->stub_cache;
+ stub_entry = h->u.stub_cache;
}
else
{
@@ -3133,7 +3746,7 @@ ppc_get_stub_entry (const asection *input_section,
stub_entry = ppc_stub_hash_lookup (&htab->stub_hash_table,
stub_name, FALSE, FALSE);
if (h != NULL)
- h->stub_cache = stub_entry;
+ h->u.stub_cache = stub_entry;
free (stub_name);
}
@@ -3185,9 +3798,8 @@ ppc_add_stub (const char *stub_name,
TRUE, FALSE);
if (stub_entry == NULL)
{
- (*_bfd_error_handler) (_("%s: cannot create stub entry %s"),
- bfd_archive_filename (section->owner),
- stub_name);
+ (*_bfd_error_handler) (_("%B: cannot create stub entry %s"),
+ section->owner, stub_name);
return NULL;
}
@@ -3210,38 +3822,40 @@ create_linkage_sections (bfd *dynobj, struct bfd_link_info *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");
+ htab->sfpr = bfd_make_section_anyway_with_flags (dynobj, ".sfpr",
+ flags);
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");
+ htab->glink = bfd_make_section_anyway_with_flags (dynobj, ".glink",
+ flags);
if (htab->glink == NULL
- || ! bfd_set_section_flags (dynobj, htab->glink, flags)
- || ! bfd_set_section_alignment (dynobj, htab->glink, 2))
+ || ! bfd_set_section_alignment (dynobj, htab->glink, 3))
return FALSE;
- /* Create .branch_lt for plt_branch stubs. */
+ /* Create branch lookup table 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");
+ htab->brlt = bfd_make_section_anyway_with_flags (dynobj, ".branch_lt",
+ flags);
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;
- }
+ if (!info->shared)
+ return TRUE;
+
+ flags = (SEC_ALLOC | SEC_LOAD | SEC_READONLY
+ | SEC_HAS_CONTENTS | SEC_IN_MEMORY | SEC_LINKER_CREATED);
+ htab->relbrlt = bfd_make_section_anyway_with_flags (dynobj,
+ ".rela.branch_lt",
+ flags);
+ if (!htab->relbrlt
+ || ! bfd_set_section_alignment (dynobj, htab->relbrlt, 3))
+ return FALSE;
+
return TRUE;
}
@@ -3268,15 +3882,14 @@ create_got_section (bfd *abfd, struct bfd_link_info *info)
flags = (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS | SEC_IN_MEMORY
| SEC_LINKER_CREATED);
- got = bfd_make_section_anyway (abfd, ".got");
+ got = bfd_make_section_anyway_with_flags (abfd, ".got", flags);
if (!got
- || !bfd_set_section_flags (abfd, got, flags)
|| !bfd_set_section_alignment (abfd, got, 3))
return FALSE;
- relgot = bfd_make_section_anyway (abfd, ".rela.got");
+ relgot = bfd_make_section_anyway_with_flags (abfd, ".rela.got",
+ flags | SEC_READONLY);
if (!relgot
- || ! bfd_set_section_flags (abfd, relgot, flags | SEC_READONLY)
|| ! bfd_set_section_alignment (abfd, relgot, 3))
return FALSE;
@@ -3311,16 +3924,49 @@ ppc64_elf_create_dynamic_sections (bfd *dynobj, struct bfd_link_info *info)
return TRUE;
}
+/* Merge PLT info on FROM with that on TO. */
+
+static void
+move_plt_plist (struct ppc_link_hash_entry *from,
+ struct ppc_link_hash_entry *to)
+{
+ if (from->elf.plt.plist != NULL)
+ {
+ if (to->elf.plt.plist != NULL)
+ {
+ struct plt_entry **entp;
+ struct plt_entry *ent;
+
+ for (entp = &from->elf.plt.plist; (ent = *entp) != NULL; )
+ {
+ struct plt_entry *dent;
+
+ for (dent = to->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 = to->elf.plt.plist;
+ }
+
+ to->elf.plt.plist = from->elf.plt.plist;
+ from->elf.plt.plist = NULL;
+ }
+}
+
/* 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)
+ppc64_elf_copy_indirect_symbol (struct bfd_link_info *info,
+ 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;
@@ -3333,10 +3979,7 @@ ppc64_elf_copy_indirect_symbol
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
+ /* Add reloc counts against the indirect sym to the direct sym
list. Merge any entries against the same section. */
for (pp = &eind->dyn_relocs; (p = *pp) != NULL; )
{
@@ -3362,21 +4005,20 @@ ppc64_elf_copy_indirect_symbol
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.
+ of elf_adjust_dynamic_symbol, don't copy 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;
+ if (!(ELIMINATE_COPY_RELOCS
+ && eind->elf.root.type != bfd_link_hash_indirect
+ && edir->elf.dynamic_adjusted))
+ edir->elf.non_got_ref |= eind->elf.non_got_ref;
- edir->elf.elf_link_hash_flags |= eind->elf.elf_link_hash_flags & mask;
+ edir->elf.ref_dynamic |= eind->elf.ref_dynamic;
+ edir->elf.ref_regular |= eind->elf.ref_regular;
+ edir->elf.ref_regular_nonweak |= eind->elf.ref_regular_nonweak;
+ edir->elf.needs_plt |= eind->elf.needs_plt;
/* If we were called to copy over info for a weak sym, that's all. */
if (eind->elf.root.type != bfd_link_hash_indirect)
@@ -3415,67 +4057,83 @@ ppc64_elf_copy_indirect_symbol
}
/* And plt entries. */
- if (eind->elf.plt.plist != NULL)
- {
- if (edir->elf.plt.plist != NULL)
- {
- struct plt_entry **entp;
- struct plt_entry *ent;
+ move_plt_plist (eind, edir);
- 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)
+ if (eind->elf.dynindx != -1)
{
+ if (edir->elf.dynindx != -1)
+ _bfd_elf_strtab_delref (elf_hash_table (info)->dynstr,
+ edir->elf.dynstr_index);
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. */
+/* Find the function descriptor hash entry from the given function code
+ hash entry FH. Link the entries via their OH fields. */
-bfd_boolean
-ppc64_elf_mark_entry_syms (struct bfd_link_info *info)
+static struct ppc_link_hash_entry *
+get_fdh (struct ppc_link_hash_entry *fh, struct ppc_link_hash_table *htab)
{
- struct ppc_link_hash_table *htab;
- struct bfd_sym_chain *sym;
+ struct ppc_link_hash_entry *fdh = fh->oh;
- htab = ppc_hash_table (info);
- for (sym = info->gc_sym_list; sym; sym = sym->next)
+ if (fdh == NULL)
{
- struct elf_link_hash_entry *h;
+ const char *fd_name = fh->elf.root.root.string + 1;
- h = elf_link_hash_lookup (&htab->elf, sym->name, FALSE, FALSE, FALSE);
- if (h != NULL)
- ((struct ppc_link_hash_entry *) h)->is_entry = 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;
+ fh->is_func = 1;
+ fh->oh = fdh;
+ }
}
- return TRUE;
+
+ return fdh;
+}
+
+/* Make a fake function descriptor sym for the code sym FH. */
+
+static struct ppc_link_hash_entry *
+make_fdh (struct bfd_link_info *info,
+ struct ppc_link_hash_entry *fh)
+{
+ bfd *abfd;
+ asymbol *newsym;
+ struct bfd_link_hash_entry *bh;
+ struct ppc_link_hash_entry *fdh;
+
+ 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_WEAK;
+
+ bh = NULL;
+ if (!_bfd_generic_link_add_one_symbol (info, abfd, newsym->name,
+ newsym->flags, newsym->section,
+ newsym->value, NULL, FALSE, FALSE,
+ &bh))
+ return NULL;
+
+ fdh = (struct ppc_link_hash_entry *) bh;
+ fdh->elf.non_elf = 0;
+ fdh->fake = 1;
+ fdh->is_func_descriptor = 1;
+ fdh->oh = fh;
+ fh->is_func = 1;
+ fh->oh = fdh;
+ return fdh;
}
-/* Hack symbols defined in .opd sections to be function type. */
+/* Fix function descriptor symbols defined in .opd sections to be
+ function type. */
static bfd_boolean
ppc64_elf_add_symbol_hook (bfd *ibfd ATTRIBUTE_UNUSED,
@@ -3486,8 +4144,162 @@ ppc64_elf_add_symbol_hook (bfd *ibfd ATTRIBUTE_UNUSED,
asection **sec,
bfd_vma *value ATTRIBUTE_UNUSED)
{
- if (strcmp (bfd_get_section_name (ibfd, *sec), ".opd") == 0)
+ if (*sec != NULL
+ && 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;
+}
+
+/* This function makes an old ABI object reference to ".bar" cause the
+ inclusion of a new ABI object archive that defines "bar".
+ NAME is a symbol defined in an archive. Return a symbol in the hash
+ table that might be satisfied by the archive symbols. */
+
+static struct elf_link_hash_entry *
+ppc64_elf_archive_symbol_lookup (bfd *abfd,
+ struct bfd_link_info *info,
+ const char *name)
+{
+ struct elf_link_hash_entry *h;
+ char *dot_name;
+ size_t len;
+
+ h = _bfd_elf_archive_symbol_lookup (abfd, info, name);
+ if (h != NULL
+ /* Don't return this sym if it is a fake function descriptor
+ created by add_symbol_adjust. */
+ && !(h->root.type == bfd_link_hash_undefweak
+ && ((struct ppc_link_hash_entry *) h)->fake))
+ return h;
+
+ if (name[0] == '.')
+ return h;
+
+ len = strlen (name);
+ dot_name = bfd_alloc (abfd, len + 2);
+ if (dot_name == NULL)
+ return (struct elf_link_hash_entry *) 0 - 1;
+ dot_name[0] = '.';
+ memcpy (dot_name + 1, name, len + 1);
+ h = _bfd_elf_archive_symbol_lookup (abfd, info, dot_name);
+ bfd_release (abfd, dot_name);
+ return h;
+}
+
+/* This function satisfies all old ABI object references to ".bar" if a
+ new ABI object defines "bar". Well, at least, undefined dot symbols
+ are made weak. This stops later archive searches from including an
+ object if we already have a function descriptor definition. It also
+ prevents the linker complaining about undefined symbols.
+ We also check and correct mismatched symbol visibility here. The
+ most restrictive visibility of the function descriptor and the
+ function entry symbol is used. */
+
+static bfd_boolean
+add_symbol_adjust (struct ppc_link_hash_entry *eh, struct bfd_link_info *info)
+{
+ struct ppc_link_hash_table *htab;
+ struct ppc_link_hash_entry *fdh;
+
+ if (eh->elf.root.type == bfd_link_hash_indirect)
+ return TRUE;
+
+ if (eh->elf.root.type == bfd_link_hash_warning)
+ eh = (struct ppc_link_hash_entry *) eh->elf.root.u.i.link;
+
+ if (eh->elf.root.root.string[0] != '.')
+ abort ();
+
+ htab = ppc_hash_table (info);
+ fdh = get_fdh (eh, htab);
+ if (fdh == NULL
+ && !info->relocatable
+ && (eh->elf.root.type == bfd_link_hash_undefined
+ || eh->elf.root.type == bfd_link_hash_undefweak)
+ && eh->elf.ref_regular)
+ {
+ /* Make an undefweak function descriptor sym, which is enough to
+ pull in an --as-needed shared lib, but won't cause link
+ errors. Archives are handled elsewhere. */
+ fdh = make_fdh (info, eh);
+ if (fdh == NULL)
+ return FALSE;
+ else
+ fdh->elf.ref_regular = 1;
+ }
+ else if (fdh != NULL)
+ {
+ unsigned entry_vis = ELF_ST_VISIBILITY (eh->elf.other) - 1;
+ unsigned descr_vis = ELF_ST_VISIBILITY (fdh->elf.other) - 1;
+ if (entry_vis < descr_vis)
+ fdh->elf.other += entry_vis - descr_vis;
+ else if (entry_vis > descr_vis)
+ eh->elf.other += descr_vis - entry_vis;
+
+ if ((fdh->elf.root.type == bfd_link_hash_defined
+ || fdh->elf.root.type == bfd_link_hash_defweak)
+ && eh->elf.root.type == bfd_link_hash_undefined)
+ {
+ eh->elf.root.type = bfd_link_hash_undefweak;
+ eh->was_undefined = 1;
+ htab->twiddled_syms = 1;
+ }
+ }
+
+ return TRUE;
+}
+
+/* Process list of dot-symbols we made in link_hash_newfunc. */
+
+static bfd_boolean
+ppc64_elf_check_directives (bfd *ibfd, struct bfd_link_info *info)
+{
+ struct ppc_link_hash_table *htab;
+ struct ppc_link_hash_entry **p, *eh;
+
+ htab = ppc_hash_table (info);
+ if (!is_ppc64_elf_target (htab->elf.root.creator))
+ return TRUE;
+
+ if (is_ppc64_elf_target (ibfd->xvec))
+ {
+ p = &htab->dot_syms;
+ while ((eh = *p) != NULL)
+ {
+ *p = NULL;
+ if (!add_symbol_adjust (eh, info))
+ return FALSE;
+ p = &eh->u.next_dot_sym;
+ }
+ }
+
+ /* Clear the list for non-ppc64 input files. */
+ p = &htab->dot_syms;
+ while ((eh = *p) != NULL)
+ {
+ *p = NULL;
+ p = &eh->u.next_dot_sym;
+ }
+
+ /* We need to fix the undefs list for any syms we have twiddled to
+ undef_weak. */
+ if (htab->twiddled_syms)
+ {
+ bfd_link_repair_undef_list (&htab->elf.root);
+ htab->twiddled_syms = 0;
+ }
+ return TRUE;
+}
+
+/* Undo hash table changes when an --as-needed input file is determined
+ not to be needed. */
+
+static bfd_boolean
+ppc64_elf_as_needed_cleanup (bfd *ibfd ATTRIBUTE_UNUSED,
+ struct bfd_link_info *info)
+{
+ ppc_hash_table (info)->dot_syms = NULL;
return TRUE;
}
@@ -3559,36 +4371,13 @@ update_plt_info (bfd *abfd, struct ppc_link_hash_entry *eh, bfd_vma addend)
eh->elf.plt.plist = ent;
}
ent->plt.refcount += 1;
- eh->elf.elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_PLT;
- eh->is_func = 1;
+ eh->elf.needs_plt = 1;
+ if (eh->elf.root.root.string[0] == '.'
+ && eh->elf.root.root.string[1] != '\0')
+ 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. */
@@ -3644,11 +4433,13 @@ ppc64_elf_check_relocs (bfd *abfd, struct bfd_link_info *info,
};
bfd_size_type amt;
- amt = sec->_raw_size * sizeof (union opd_info) / 24;
+ amt = sec->size * sizeof (union opd_info) / 8;
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;
+ ppc64_elf_section_data (sec)->u.opd_func_sec = opd_sym_map;
+ BFD_ASSERT (ppc64_elf_section_data (sec)->sec_type == sec_normal);
+ ppc64_elf_section_data (sec)->sec_type = sec_opd;
}
if (htab->sfpr == NULL
@@ -3662,12 +4453,18 @@ ppc64_elf_check_relocs (bfd *abfd, struct bfd_link_info *info,
struct elf_link_hash_entry *h;
enum elf_ppc64_reloc_type r_type;
int tls_type = 0;
+ struct _ppc64_elf_section_data *ppc64_sec;
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];
+ {
+ 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;
+ }
r_type = ELF64_R_TYPE (rel->r_info);
switch (r_type)
@@ -3712,7 +4509,7 @@ ppc64_elf_check_relocs (bfd *abfd, struct bfd_link_info *info,
case R_PPC64_GOT16_LO:
case R_PPC64_GOT16_LO_DS:
/* This symbol requires a global offset table entry. */
- sec->has_gp_reloc = 1;
+ sec->has_toc_reloc = 1;
if (ppc64_elf_tdata (abfd)->got == NULL
&& !create_got_section (abfd, info))
return FALSE;
@@ -3802,7 +4599,7 @@ ppc64_elf_check_relocs (bfd *abfd, struct bfd_link_info *info,
case R_PPC64_TOC16_HA:
case R_PPC64_TOC16_DS:
case R_PPC64_TOC16_LO_DS:
- sec->has_gp_reloc = 1;
+ sec->has_toc_reloc = 1;
break;
/* This relocation describes the C++ object vtable hierarchy.
@@ -3822,27 +4619,51 @@ ppc64_elf_check_relocs (bfd *abfd, struct bfd_link_info *info,
case R_PPC64_REL14:
case R_PPC64_REL14_BRTAKEN:
case R_PPC64_REL14_BRNTAKEN:
- htab->has_14bit_branch = 1;
+ {
+ asection *dest = NULL;
+
+ /* Heuristic: If jumping outside our section, chances are
+ we are going to need a stub. */
+ if (h != NULL)
+ {
+ /* If the sym is weak it may be overridden later, so
+ don't assume we know where a weak sym lives. */
+ if (h->root.type == bfd_link_hash_defined)
+ dest = h->root.u.def.section;
+ }
+ else
+ dest = bfd_section_from_r_symndx (abfd, &htab->sym_sec,
+ sec, r_symndx);
+ if (dest != sec)
+ ppc64_elf_section_data (sec)->has_14bit_branch = 1;
+ }
/* Fall through. */
case R_PPC64_REL24:
- if (h != NULL
- && h->root.root.string[0] == '.'
- && h->root.root.string[1] != 0)
+ if (h != NULL)
{
/* 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)
+ if (h == &htab->tls_get_addr->elf
+ || h == &htab->tls_get_addr_fd->elf)
sec->has_tls_reloc = 1;
- else if ((strncmp (h->root.root.string, ".__tls_get_addr", 15)
- == 0)
+ else if (htab->tls_get_addr == NULL
+ && CONST_STRNEQ (h->root.root.string, ".__tls_get_addr")
&& (h->root.root.string[15] == 0
|| h->root.root.string[15] == '@'))
{
- htab->tls_get_addr = h;
+ htab->tls_get_addr = (struct ppc_link_hash_entry *) h;
+ sec->has_tls_reloc = 1;
+ }
+ else if (htab->tls_get_addr_fd == NULL
+ && CONST_STRNEQ (h->root.root.string, "__tls_get_addr")
+ && (h->root.root.string[14] == 0
+ || h->root.root.string[14] == '@'))
+ {
+ htab->tls_get_addr_fd = (struct ppc_link_hash_entry *) h;
sec->has_tls_reloc = 1;
}
}
@@ -3885,23 +4706,26 @@ ppc64_elf_check_relocs (bfd *abfd, struct bfd_link_info *info,
rel->r_addend, tls_type))
return FALSE;
- if (ppc64_elf_section_data (sec)->t_symndx == NULL)
+ ppc64_sec = ppc64_elf_section_data (sec);
+ if (ppc64_sec->sec_type != sec_toc)
{
/* 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)
+ bfd_size_type amt = sec->size * sizeof (unsigned) / 8 + 1;
+ ppc64_sec->u.t_symndx = bfd_zalloc (abfd, amt);
+ if (ppc64_sec->u.t_symndx == NULL)
return FALSE;
+ BFD_ASSERT (ppc64_sec->sec_type == sec_normal);
+ ppc64_sec->sec_type = sec_toc;
}
BFD_ASSERT (rel->r_offset % 8 == 0);
- ppc64_elf_section_data (sec)->t_symndx[rel->r_offset / 8] = r_symndx;
+ ppc64_sec->u.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;
+ ppc64_sec->u.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;
+ ppc64_sec->u.t_symndx[rel->r_offset / 8 + 1] = -2;
goto dodyn;
case R_PPC64_TPREL16:
@@ -3923,24 +4747,29 @@ ppc64_elf_check_relocs (bfd *abfd, struct bfd_link_info *info,
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;
+ if (h != NULL)
+ {
+ if (h->root.root.string[0] == '.'
+ && h->root.root.string[1] != 0
+ && get_fdh ((struct ppc_link_hash_entry *) h, htab))
+ ;
+ else
+ ((struct ppc_link_hash_entry *) h)->is_func = 1;
+ }
+ else
+ {
+ 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;
+ 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 / 8] = s;
+ }
}
/* Fall through. */
@@ -3968,7 +4797,7 @@ ppc64_elf_check_relocs (bfd *abfd, struct bfd_link_info *info,
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;
+ h->non_got_ref = 1;
/* Don't propagate .opd relocs. */
if (NO_OPD_RELOCS && opd_sym_map != NULL)
@@ -4001,14 +4830,12 @@ ppc64_elf_check_relocs (bfd *abfd, struct bfd_link_info *info,
|| (h != NULL
&& (! info->symbolic
|| h->root.type == bfd_link_hash_defweak
- || (h->elf_link_hash_flags
- & ELF_LINK_HASH_DEF_REGULAR) == 0))))
+ || !h->def_regular))))
|| (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)))
+ || !h->def_regular)))
{
struct ppc_dyn_relocs *p;
struct ppc_dyn_relocs **head;
@@ -4028,13 +4855,13 @@ ppc64_elf_check_relocs (bfd *abfd, struct bfd_link_info *info,
if (name == NULL)
return FALSE;
- if (strncmp (name, ".rela", 5) != 0
+ if (! CONST_STRNEQ (name, ".rela")
|| strcmp (bfd_get_section_name (abfd, sec),
name + 5) != 0)
{
(*_bfd_error_handler)
- (_("%s: bad relocation section name `%s\'"),
- bfd_archive_filename (abfd), name);
+ (_("%B: bad relocation section name `%s\'"),
+ abfd, name);
bfd_set_error (bfd_error_bad_value);
}
@@ -4044,13 +4871,13 @@ ppc64_elf_check_relocs (bfd *abfd, struct bfd_link_info *info,
{
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;
+ | SEC_IN_MEMORY | SEC_LINKER_CREATED
+ | SEC_ALLOC | SEC_LOAD);
+ sreloc = bfd_make_section_with_flags (dynobj,
+ name,
+ flags);
if (sreloc == NULL
- || ! bfd_set_section_flags (dynobj, sreloc, flags)
|| ! bfd_set_section_alignment (dynobj, sreloc, 3))
return FALSE;
}
@@ -4070,13 +4897,15 @@ ppc64_elf_check_relocs (bfd *abfd, struct bfd_link_info *info,
easily. Oh well. */
asection *s;
+ void *vpp;
+
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);
+ vpp = &elf_section_data (s)->local_dynrel;
+ head = (struct ppc_dyn_relocs **) vpp;
}
p = *head;
@@ -4106,22 +4935,235 @@ ppc64_elf_check_relocs (bfd *abfd, struct bfd_link_info *info,
return TRUE;
}
+/* OFFSET in OPD_SEC specifies a function descriptor. Return the address
+ of the code entry point, and its section. */
+
+static bfd_vma
+opd_entry_value (asection *opd_sec,
+ bfd_vma offset,
+ asection **code_sec,
+ bfd_vma *code_off)
+{
+ bfd *opd_bfd = opd_sec->owner;
+ Elf_Internal_Rela *relocs;
+ Elf_Internal_Rela *lo, *hi, *look;
+ bfd_vma val;
+
+ /* No relocs implies we are linking a --just-symbols object. */
+ if (opd_sec->reloc_count == 0)
+ {
+ bfd_vma val;
+
+ if (!bfd_get_section_contents (opd_bfd, opd_sec, &val, offset, 8))
+ return (bfd_vma) -1;
+
+ if (code_sec != NULL)
+ {
+ asection *sec, *likely = NULL;
+ for (sec = opd_bfd->sections; sec != NULL; sec = sec->next)
+ if (sec->vma <= val
+ && (sec->flags & SEC_LOAD) != 0
+ && (sec->flags & SEC_ALLOC) != 0)
+ likely = sec;
+ if (likely != NULL)
+ {
+ *code_sec = likely;
+ if (code_off != NULL)
+ *code_off = val - likely->vma;
+ }
+ }
+ return val;
+ }
+
+ relocs = ppc64_elf_tdata (opd_bfd)->opd_relocs;
+ if (relocs == NULL)
+ relocs = _bfd_elf_link_read_relocs (opd_bfd, opd_sec, NULL, NULL, TRUE);
+
+ /* Go find the opd reloc at the sym address. */
+ lo = relocs;
+ BFD_ASSERT (lo != NULL);
+ hi = lo + opd_sec->reloc_count - 1; /* ignore last reloc */
+ val = (bfd_vma) -1;
+ while (lo < hi)
+ {
+ look = lo + (hi - lo) / 2;
+ if (look->r_offset < offset)
+ lo = look + 1;
+ else if (look->r_offset > offset)
+ hi = look;
+ else
+ {
+ Elf_Internal_Shdr *symtab_hdr = &elf_tdata (opd_bfd)->symtab_hdr;
+ if (ELF64_R_TYPE (look->r_info) == R_PPC64_ADDR64
+ && ELF64_R_TYPE ((look + 1)->r_info) == R_PPC64_TOC)
+ {
+ unsigned long symndx = ELF64_R_SYM (look->r_info);
+ asection *sec;
+
+ if (symndx < symtab_hdr->sh_info)
+ {
+ Elf_Internal_Sym *sym;
+
+ sym = (Elf_Internal_Sym *) symtab_hdr->contents;
+ if (sym == NULL)
+ {
+ sym = bfd_elf_get_elf_syms (opd_bfd, symtab_hdr,
+ symtab_hdr->sh_info,
+ 0, NULL, NULL, NULL);
+ if (sym == NULL)
+ break;
+ symtab_hdr->contents = (bfd_byte *) sym;
+ }
+
+ sym += symndx;
+ val = sym->st_value;
+ sec = NULL;
+ if ((sym->st_shndx != SHN_UNDEF
+ && sym->st_shndx < SHN_LORESERVE)
+ || sym->st_shndx > SHN_HIRESERVE)
+ sec = bfd_section_from_elf_index (opd_bfd, sym->st_shndx);
+ BFD_ASSERT ((sec->flags & SEC_MERGE) == 0);
+ }
+ else
+ {
+ struct elf_link_hash_entry **sym_hashes;
+ struct elf_link_hash_entry *rh;
+
+ sym_hashes = elf_sym_hashes (opd_bfd);
+ rh = sym_hashes[symndx - symtab_hdr->sh_info];
+ 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);
+ BFD_ASSERT (rh->root.type == bfd_link_hash_defined
+ || rh->root.type == bfd_link_hash_defweak);
+ val = rh->root.u.def.value;
+ sec = rh->root.u.def.section;
+ }
+ val += look->r_addend;
+ if (code_off != NULL)
+ *code_off = val;
+ if (code_sec != NULL)
+ *code_sec = sec;
+ if (sec != NULL && sec->output_section != NULL)
+ val += sec->output_section->vma + sec->output_offset;
+ }
+ break;
+ }
+ }
+
+ return val;
+}
+
+/* Mark sections containing dynamically referenced symbols. When
+ building shared libraries, we must assume that any visible symbol is
+ referenced. */
+
+static bfd_boolean
+ppc64_elf_gc_mark_dynamic_ref (struct elf_link_hash_entry *h, void *inf)
+{
+ struct bfd_link_info *info = (struct bfd_link_info *) inf;
+ struct ppc_link_hash_entry *eh = (struct ppc_link_hash_entry *) h;
+
+ if (eh->elf.root.type == bfd_link_hash_warning)
+ eh = (struct ppc_link_hash_entry *) eh->elf.root.u.i.link;
+
+ /* Dynamic linking info is on the func descriptor sym. */
+ if (eh->oh != NULL
+ && eh->oh->is_func_descriptor
+ && (eh->oh->elf.root.type == bfd_link_hash_defined
+ || eh->oh->elf.root.type == bfd_link_hash_defweak))
+ eh = eh->oh;
+
+ if ((eh->elf.root.type == bfd_link_hash_defined
+ || eh->elf.root.type == bfd_link_hash_defweak)
+ && (eh->elf.ref_dynamic
+ || (!info->executable
+ && eh->elf.def_regular
+ && ELF_ST_VISIBILITY (eh->elf.other) != STV_INTERNAL
+ && ELF_ST_VISIBILITY (eh->elf.other) != STV_HIDDEN)))
+ {
+ asection *code_sec;
+
+ eh->elf.root.u.def.section->flags |= SEC_KEEP;
+
+ /* Function descriptor syms cause the associated
+ function code sym section to be marked. */
+ if (eh->is_func_descriptor
+ && (eh->oh->elf.root.type == bfd_link_hash_defined
+ || eh->oh->elf.root.type == bfd_link_hash_defweak))
+ eh->oh->elf.root.u.def.section->flags |= SEC_KEEP;
+ else if (get_opd_info (eh->elf.root.u.def.section) != NULL
+ && opd_entry_value (eh->elf.root.u.def.section,
+ eh->elf.root.u.def.value,
+ &code_sec, NULL) != (bfd_vma) -1)
+ code_sec->flags |= SEC_KEEP;
+ }
+
+ 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,
+ struct bfd_link_info *info,
Elf_Internal_Rela *rel,
struct elf_link_hash_entry *h,
Elf_Internal_Sym *sym)
{
- asection *rsec = NULL;
+ asection *rsec;
+
+ /* First mark all our entry sym sections. */
+ if (info->gc_sym_list != NULL)
+ {
+ struct ppc_link_hash_table *htab = ppc_hash_table (info);
+ struct bfd_sym_chain *sym = info->gc_sym_list;
+
+ info->gc_sym_list = NULL;
+ for (; sym != NULL; sym = sym->next)
+ {
+ struct ppc_link_hash_entry *eh;
+
+ eh = (struct ppc_link_hash_entry *)
+ elf_link_hash_lookup (&htab->elf, sym->name, FALSE, FALSE, FALSE);
+ if (eh == NULL)
+ continue;
+ if (eh->elf.root.type != bfd_link_hash_defined
+ && eh->elf.root.type != bfd_link_hash_defweak)
+ continue;
+
+ if (eh->is_func_descriptor
+ && (eh->oh->elf.root.type == bfd_link_hash_defined
+ || eh->oh->elf.root.type == bfd_link_hash_defweak))
+ rsec = eh->oh->elf.root.u.def.section;
+ else if (get_opd_info (eh->elf.root.u.def.section) != NULL
+ && opd_entry_value (eh->elf.root.u.def.section,
+ eh->elf.root.u.def.value,
+ &rsec, NULL) != (bfd_vma) -1)
+ ;
+ else
+ continue;
+
+ if (!rsec->gc_mark)
+ _bfd_elf_gc_mark (info, rsec, ppc64_elf_gc_mark_hook);
+
+ rsec = eh->elf.root.u.def.section;
+ if (!rsec->gc_mark)
+ _bfd_elf_gc_mark (info, rsec, ppc64_elf_gc_mark_hook);
+ }
+ }
+
+ /* Syms return NULL if we're marking .opd, so we avoid marking all
+ function sections, as all functions are referenced in .opd. */
+ rsec = NULL;
+ if (get_opd_info (sec) != NULL)
+ return rsec;
if (h != NULL)
{
enum elf_ppc64_reloc_type r_type;
- struct ppc_link_hash_entry *fdh;
+ struct ppc_link_hash_entry *eh;
r_type = ELF64_R_TYPE (rel->r_info);
switch (r_type)
@@ -4135,20 +5177,36 @@ ppc64_elf_gc_mark_hook (asection *sec,
{
case bfd_link_hash_defined:
case bfd_link_hash_defweak:
- fdh = (struct ppc_link_hash_entry *) h;
+ eh = (struct ppc_link_hash_entry *) h;
+ if (eh->oh != NULL
+ && eh->oh->is_func_descriptor
+ && (eh->oh->elf.root.type == bfd_link_hash_defined
+ || eh->oh->elf.root.type == bfd_link_hash_defweak))
+ eh = eh->oh;
/* 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)
+ if (eh->is_func_descriptor
+ && (eh->oh->elf.root.type == bfd_link_hash_defined
+ || eh->oh->elf.root.type == bfd_link_hash_defweak))
+ {
+ /* They also mark their opd section. */
+ if (!eh->elf.root.u.def.section->gc_mark)
+ _bfd_elf_gc_mark (info, eh->elf.root.u.def.section,
+ ppc64_elf_gc_mark_hook);
+
+ rsec = eh->oh->elf.root.u.def.section;
+ }
+ else if (get_opd_info (eh->elf.root.u.def.section) != NULL
+ && opd_entry_value (eh->elf.root.u.def.section,
+ eh->elf.root.u.def.value,
+ &rsec, NULL) != (bfd_vma) -1)
+ {
+ if (!eh->elf.root.u.def.section->gc_mark)
+ _bfd_elf_gc_mark (info, eh->elf.root.u.def.section,
+ ppc64_elf_gc_mark_hook);
+ }
+ else
rsec = h->root.u.def.section;
break;
@@ -4166,11 +5224,14 @@ ppc64_elf_gc_mark_hook (asection *sec,
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;
+ opd_sym_section = get_opd_info (rsec);
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;
+ {
+ if (!rsec->gc_mark)
+ _bfd_elf_gc_mark (info, rsec, ppc64_elf_gc_mark_hook);
+
+ rsec = opd_sym_section[(sym->st_value + rel->r_addend) / 8];
+ }
}
return rsec;
@@ -4216,6 +5277,9 @@ ppc64_elf_gc_sweep_hook (bfd *abfd, struct bfd_link_info *info,
struct ppc_dyn_relocs *p;
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;
eh = (struct ppc_link_hash_entry *) h;
for (pp = &eh->dyn_relocs; (p = *pp) != NULL; pp = &p->next)
@@ -4301,9 +5365,7 @@ ppc64_elf_gc_sweep_hook (bfd *abfd, struct bfd_link_info *info,
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)
+ if (ent != NULL && ent->plt.refcount > 0)
ent->plt.refcount -= 1;
}
break;
@@ -4315,9 +5377,235 @@ ppc64_elf_gc_sweep_hook (bfd *abfd, struct bfd_link_info *info,
return TRUE;
}
+/* The maximum size of .sfpr. */
+#define SFPR_MAX (218*4)
+
+struct sfpr_def_parms
+{
+ const char name[12];
+ unsigned char lo, hi;
+ bfd_byte * (*write_ent) (bfd *, bfd_byte *, int);
+ bfd_byte * (*write_tail) (bfd *, bfd_byte *, int);
+};
+
+/* Auto-generate _save*, _rest* functions in .sfpr. */
+
+static unsigned int
+sfpr_define (struct bfd_link_info *info, const struct sfpr_def_parms *parm)
+{
+ struct ppc_link_hash_table *htab = ppc_hash_table (info);
+ unsigned int i;
+ size_t len = strlen (parm->name);
+ bfd_boolean writing = FALSE;
+ char sym[16];
+
+ memcpy (sym, parm->name, len);
+ sym[len + 2] = 0;
+
+ for (i = parm->lo; i <= parm->hi; i++)
+ {
+ struct elf_link_hash_entry *h;
+
+ sym[len + 0] = i / 10 + '0';
+ sym[len + 1] = i % 10 + '0';
+ h = elf_link_hash_lookup (&htab->elf, sym, FALSE, FALSE, TRUE);
+ if (h != NULL
+ && !h->def_regular)
+ {
+ h->root.type = bfd_link_hash_defined;
+ h->root.u.def.section = htab->sfpr;
+ h->root.u.def.value = htab->sfpr->size;
+ h->type = STT_FUNC;
+ h->def_regular = 1;
+ _bfd_elf_link_hash_hide_symbol (info, h, TRUE);
+ writing = TRUE;
+ if (htab->sfpr->contents == NULL)
+ {
+ htab->sfpr->contents = bfd_alloc (htab->elf.dynobj, SFPR_MAX);
+ if (htab->sfpr->contents == NULL)
+ return FALSE;
+ }
+ }
+ if (writing)
+ {
+ bfd_byte *p = htab->sfpr->contents + htab->sfpr->size;
+ if (i != parm->hi)
+ p = (*parm->write_ent) (htab->elf.dynobj, p, i);
+ else
+ p = (*parm->write_tail) (htab->elf.dynobj, p, i);
+ htab->sfpr->size = p - htab->sfpr->contents;
+ }
+ }
+
+ return TRUE;
+}
+
+static bfd_byte *
+savegpr0 (bfd *abfd, bfd_byte *p, int r)
+{
+ bfd_put_32 (abfd, STD_R0_0R1 + (r << 21) + (1 << 16) - (32 - r) * 8, p);
+ return p + 4;
+}
+
+static bfd_byte *
+savegpr0_tail (bfd *abfd, bfd_byte *p, int r)
+{
+ p = savegpr0 (abfd, p, r);
+ bfd_put_32 (abfd, STD_R0_0R1 + 16, p);
+ p = p + 4;
+ bfd_put_32 (abfd, BLR, p);
+ return p + 4;
+}
+
+static bfd_byte *
+restgpr0 (bfd *abfd, bfd_byte *p, int r)
+{
+ bfd_put_32 (abfd, LD_R0_0R1 + (r << 21) + (1 << 16) - (32 - r) * 8, p);
+ return p + 4;
+}
+
+static bfd_byte *
+restgpr0_tail (bfd *abfd, bfd_byte *p, int r)
+{
+ bfd_put_32 (abfd, LD_R0_0R1 + 16, p);
+ p = p + 4;
+ p = restgpr0 (abfd, p, r);
+ bfd_put_32 (abfd, MTLR_R0, p);
+ p = p + 4;
+ if (r == 29)
+ {
+ p = restgpr0 (abfd, p, 30);
+ p = restgpr0 (abfd, p, 31);
+ }
+ bfd_put_32 (abfd, BLR, p);
+ return p + 4;
+}
+
+static bfd_byte *
+savegpr1 (bfd *abfd, bfd_byte *p, int r)
+{
+ bfd_put_32 (abfd, STD_R0_0R12 + (r << 21) + (1 << 16) - (32 - r) * 8, p);
+ return p + 4;
+}
+
+static bfd_byte *
+savegpr1_tail (bfd *abfd, bfd_byte *p, int r)
+{
+ p = savegpr1 (abfd, p, r);
+ bfd_put_32 (abfd, BLR, p);
+ return p + 4;
+}
+
+static bfd_byte *
+restgpr1 (bfd *abfd, bfd_byte *p, int r)
+{
+ bfd_put_32 (abfd, LD_R0_0R12 + (r << 21) + (1 << 16) - (32 - r) * 8, p);
+ return p + 4;
+}
+
+static bfd_byte *
+restgpr1_tail (bfd *abfd, bfd_byte *p, int r)
+{
+ p = restgpr1 (abfd, p, r);
+ bfd_put_32 (abfd, BLR, p);
+ return p + 4;
+}
+
+static bfd_byte *
+savefpr (bfd *abfd, bfd_byte *p, int r)
+{
+ bfd_put_32 (abfd, STFD_FR0_0R1 + (r << 21) + (1 << 16) - (32 - r) * 8, p);
+ return p + 4;
+}
+
+static bfd_byte *
+savefpr0_tail (bfd *abfd, bfd_byte *p, int r)
+{
+ p = savefpr (abfd, p, r);
+ bfd_put_32 (abfd, STD_R0_0R1 + 16, p);
+ p = p + 4;
+ bfd_put_32 (abfd, BLR, p);
+ return p + 4;
+}
+
+static bfd_byte *
+restfpr (bfd *abfd, bfd_byte *p, int r)
+{
+ bfd_put_32 (abfd, LFD_FR0_0R1 + (r << 21) + (1 << 16) - (32 - r) * 8, p);
+ return p + 4;
+}
+
+static bfd_byte *
+restfpr0_tail (bfd *abfd, bfd_byte *p, int r)
+{
+ bfd_put_32 (abfd, LD_R0_0R1 + 16, p);
+ p = p + 4;
+ p = restfpr (abfd, p, r);
+ bfd_put_32 (abfd, MTLR_R0, p);
+ p = p + 4;
+ if (r == 29)
+ {
+ p = restfpr (abfd, p, 30);
+ p = restfpr (abfd, p, 31);
+ }
+ bfd_put_32 (abfd, BLR, p);
+ return p + 4;
+}
+
+static bfd_byte *
+savefpr1_tail (bfd *abfd, bfd_byte *p, int r)
+{
+ p = savefpr (abfd, p, r);
+ bfd_put_32 (abfd, BLR, p);
+ return p + 4;
+}
+
+static bfd_byte *
+restfpr1_tail (bfd *abfd, bfd_byte *p, int r)
+{
+ p = restfpr (abfd, p, r);
+ bfd_put_32 (abfd, BLR, p);
+ return p + 4;
+}
+
+static bfd_byte *
+savevr (bfd *abfd, bfd_byte *p, int r)
+{
+ bfd_put_32 (abfd, LI_R12_0 + (1 << 16) - (32 - r) * 16, p);
+ p = p + 4;
+ bfd_put_32 (abfd, STVX_VR0_R12_R0 + (r << 21), p);
+ return p + 4;
+}
+
+static bfd_byte *
+savevr_tail (bfd *abfd, bfd_byte *p, int r)
+{
+ p = savevr (abfd, p, r);
+ bfd_put_32 (abfd, BLR, p);
+ return p + 4;
+}
+
+static bfd_byte *
+restvr (bfd *abfd, bfd_byte *p, int r)
+{
+ bfd_put_32 (abfd, LI_R12_0 + (1 << 16) - (32 - r) * 16, p);
+ p = p + 4;
+ bfd_put_32 (abfd, LVX_VR0_R12_R0 + (r << 21), p);
+ return p + 4;
+}
+
+static bfd_byte *
+restvr_tail (bfd *abfd, bfd_byte *p, int r)
+{
+ p = restvr (abfd, p, r);
+ bfd_put_32 (abfd, BLR, p);
+ return p + 4;
+}
+
/* 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)
{
@@ -4338,15 +5626,29 @@ func_desc_adjust (struct elf_link_hash_entry *h, void *inf)
info = inf;
htab = ppc_hash_table (info);
+ /* Resolve undefined references to dot-symbols as the value
+ in the function descriptor, if we have one in a regular object.
+ This is to satisfy cases like ".quad .foo". Calls to functions
+ in dynamic objects are handled elsewhere. */
+ if (fh->elf.root.type == bfd_link_hash_undefweak
+ && fh->was_undefined
+ && (fh->oh->elf.root.type == bfd_link_hash_defined
+ || fh->oh->elf.root.type == bfd_link_hash_defweak)
+ && get_opd_info (fh->oh->elf.root.u.def.section) != NULL
+ && opd_entry_value (fh->oh->elf.root.u.def.section,
+ fh->oh->elf.root.u.def.value,
+ &fh->elf.root.u.def.section,
+ &fh->elf.root.u.def.value) != (bfd_vma) -1)
+ {
+ fh->elf.root.type = fh->oh->elf.root.type;
+ fh->elf.forced_local = 1;
+ }
+
/* 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;
@@ -4369,56 +5671,56 @@ func_desc_adjust (struct elf_link_hash_entry *h, void *inf)
&& (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)))
+ fdh = make_fdh (info, fh);
+ if (fdh == NULL)
+ return FALSE;
+ }
+
+ /* Fake function descriptors are made undefweak. If the function
+ code symbol is strong undefined, make the fake sym the same.
+ If the function code symbol is defined, then force the fake
+ descriptor local; We can't support overriding of symbols in a
+ shared library on a fake descriptor. */
+
+ if (fdh != NULL
+ && fdh->fake
+ && fdh->elf.root.type == bfd_link_hash_undefweak)
+ {
+ if (fh->elf.root.type == bfd_link_hash_undefined)
{
- return FALSE;
+ fdh->elf.root.type = bfd_link_hash_undefined;
+ bfd_link_add_undef (&htab->elf.root, &fdh->elf.root);
+ }
+ else if (fh->elf.root.type == bfd_link_hash_defined
+ || fh->elf.root.type == bfd_link_hash_defweak)
+ {
+ _bfd_elf_link_hash_hide_symbol (info, &fdh->elf, TRUE);
}
- 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
+ && !fdh->elf.forced_local
&& (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.def_dynamic
+ || fdh->elf.ref_dynamic
|| (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));
+ fdh->elf.ref_regular |= fh->elf.ref_regular;
+ fdh->elf.ref_dynamic |= fh->elf.ref_dynamic;
+ fdh->elf.ref_regular_nonweak |= fh->elf.ref_regular_nonweak;
+ fdh->elf.non_got_ref |= fh->elf.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;
+ move_plt_plist (fh, fdh);
+ fdh->elf.needs_plt = 1;
}
fdh->is_func_descriptor = 1;
- fdh->oh = &fh->elf;
- fh->oh = &fdh->elf;
+ fdh->oh = fh;
+ fh->oh = fdh;
}
/* Now that the info is on the function descriptor, clear the
@@ -4428,130 +5730,57 @@ func_desc_adjust (struct elf_link_hash_entry *h, void *inf)
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));
+ force_local = (!fh->elf.def_regular
+ || fdh == NULL
+ || !fdh->elf.def_regular
+ || fdh->elf.forced_local);
_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];
+ const struct sfpr_def_parms funcs[] =
+ {
+ { "_savegpr0_", 14, 31, savegpr0, savegpr0_tail },
+ { "_restgpr0_", 14, 29, restgpr0, restgpr0_tail },
+ { "_restgpr0_", 30, 31, restgpr0, restgpr0_tail },
+ { "_savegpr1_", 14, 31, savegpr1, savegpr1_tail },
+ { "_restgpr1_", 14, 31, restgpr1, restgpr1_tail },
+ { "_savefpr_", 14, 31, savefpr, savefpr0_tail },
+ { "_restfpr_", 14, 29, restfpr, restfpr0_tail },
+ { "_restfpr_", 30, 31, restfpr, restfpr0_tail },
+ { "._savef", 14, 31, savefpr, savefpr1_tail },
+ { "._restf", 14, 31, restfpr, restfpr1_tail },
+ { "_savevr_", 20, 31, savevr, savevr_tail },
+ { "_restvr_", 20, 31, restvr, restvr_tail }
+ };
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);
- }
- }
+ /* Provide any missing _save* and _rest* functions. */
+ htab->sfpr->size = 0;
+ for (i = 0; i < sizeof (funcs) / sizeof (funcs[0]); i++)
+ if (!sfpr_define (info, &funcs[i]))
+ return FALSE;
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);
- }
+ if (htab->sfpr->size == 0)
+ htab->sfpr->flags |= SEC_EXCLUDE;
return TRUE;
}
@@ -4568,13 +5797,12 @@ ppc64_elf_adjust_dynamic_symbol (struct bfd_link_info *info,
{
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)
+ || h->needs_plt)
{
/* Clear procedure linkage table information for any symbol that
won't need a .plt entry. */
@@ -4582,14 +5810,13 @@ ppc64_elf_adjust_dynamic_symbol (struct bfd_link_info *info,
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
+ if (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;
+ h->needs_plt = 0;
}
}
else
@@ -4598,16 +5825,14 @@ ppc64_elf_adjust_dynamic_symbol (struct bfd_link_info *info,
/* 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)
+ if (h->u.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;
+ BFD_ASSERT (h->u.weakdef->root.type == bfd_link_hash_defined
+ || h->u.weakdef->root.type == bfd_link_hash_defweak);
+ h->root.u.def.section = h->u.weakdef->root.u.def.section;
+ h->root.u.def.value = h->u.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));
+ h->non_got_ref = h->u.weakdef->non_got_ref;
return TRUE;
}
@@ -4620,7 +5845,11 @@ ppc64_elf_adjust_dynamic_symbol (struct bfd_link_info *info,
/* 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)
+ if (!h->non_got_ref)
+ return TRUE;
+
+ /* Don't generate a copy reloc for symbols defined in the executable. */
+ if (!h->def_dynamic || !h->ref_regular || h->def_regular)
return TRUE;
if (ELIMINATE_COPY_RELOCS)
@@ -4640,7 +5869,7 @@ ppc64_elf_adjust_dynamic_symbol (struct bfd_link_info *info,
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;
+ h->non_got_ref = 0;
return TRUE;
}
}
@@ -4661,6 +5890,13 @@ ppc64_elf_adjust_dynamic_symbol (struct bfd_link_info *info,
/* This is a reference to a symbol defined by a dynamic object which
is not a function. */
+ if (h->size == 0)
+ {
+ (*_bfd_error_handler) (_("dynamic variable `%s' is zero size"),
+ h->root.root.string);
+ 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
@@ -4677,33 +5913,13 @@ ppc64_elf_adjust_dynamic_symbol (struct bfd_link_info *info,
.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;
+ htab->relbss->size += sizeof (Elf64_External_Rela);
+ h->needs_copy = 1;
}
- /* 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;
+ return _bfd_elf_adjust_dynamic_copy (h, s);
}
/* If given a function descriptor symbol, hide both the function code
@@ -4713,11 +5929,13 @@ ppc64_elf_hide_symbol (struct bfd_link_info *info,
struct elf_link_hash_entry *h,
bfd_boolean force_local)
{
+ struct ppc_link_hash_entry *eh;
_bfd_elf_link_hash_hide_symbol (info, h, force_local);
- if (((struct ppc_link_hash_entry *) h)->is_func_descriptor)
+ eh = (struct ppc_link_hash_entry *) h;
+ if (eh->is_func_descriptor)
{
- struct elf_link_hash_entry *fh = ((struct ppc_link_hash_entry *) h)->oh;
+ struct ppc_link_hash_entry *fh = eh->oh;
if (fh == NULL)
{
@@ -4731,14 +5949,15 @@ ppc64_elf_hide_symbol (struct bfd_link_info *info,
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. */
+ accessed; It's either a string in an ELF string table,
+ or allocated in an objalloc structure. */
- p = h->root.root.string - 1;
+ p = eh->elf.root.root.string - 1;
save = *p;
*(char *) p = '.';
htab = ppc_hash_table (info);
- fh = elf_link_hash_lookup (&htab->elf, p, FALSE, FALSE, FALSE);
+ fh = (struct ppc_link_hash_entry *)
+ elf_link_hash_lookup (&htab->elf, p, FALSE, FALSE, FALSE);
*(char *) p = save;
/* Unfortunately, if it so happens that the string we were
@@ -4747,27 +5966,32 @@ ppc64_elf_hide_symbol (struct bfd_link_info *info,
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 = eh->elf.root.root.string + strlen (eh->elf.root.root.string);
+ while (q >= eh->elf.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 (q < eh->elf.root.root.string && *p == '.')
+ fh = (struct ppc_link_hash_entry *)
+ 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;
+ eh->oh = fh;
+ fh->oh = eh;
}
}
if (fh != NULL)
- _bfd_elf_link_hash_hide_symbol (info, fh, force_local);
+ _bfd_elf_link_hash_hide_symbol (info, &fh->elf, 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)
+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;
@@ -4878,7 +6102,7 @@ get_tls_mask (char **tls_maskp, unsigned long *toc_symndx,
if ((*tls_maskp != NULL && **tls_maskp != 0)
|| sec == NULL
- || ppc64_elf_section_data (sec)->t_symndx == NULL)
+ || ppc64_elf_section_data (sec)->sec_type != sec_toc)
return 1;
/* Look inside a TOC section too. */
@@ -4891,8 +6115,8 @@ get_tls_mask (char **tls_maskp, unsigned long *toc_symndx,
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];
+ r_symndx = ppc64_elf_section_data (sec)->u.t_symndx[off / 8];
+ next_r = ppc64_elf_section_data (sec)->u.t_symndx[off / 8 + 1];
if (!get_sym_h (&h, &sym, &sec, tls_maskp, locsymsp, r_symndx, ibfd))
return 0;
if (toc_symndx != NULL)
@@ -4900,15 +6124,14 @@ get_tls_mask (char **tls_maskp, unsigned long *toc_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)))
+ && !h->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. */
+ code for the old ABI, these will already have been done. */
static bfd_boolean
adjust_opd_syms (struct elf_link_hash_entry *h, void *inf ATTRIBUTE_UNUSED)
@@ -4932,16 +6155,167 @@ adjust_opd_syms (struct elf_link_hash_entry *h, void *inf ATTRIBUTE_UNUSED)
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)
+ opd_adjust = get_opd_info (sym_sec);
+ if (opd_adjust != NULL)
{
- eh->elf.root.u.def.value += opd_adjust[eh->elf.root.u.def.value / 24];
+ long adjust = opd_adjust[eh->elf.root.u.def.value / 8];
+ if (adjust == -1)
+ {
+ /* This entry has been deleted. */
+ asection *dsec = ppc64_elf_tdata (sym_sec->owner)->deleted_section;
+ if (dsec == NULL)
+ {
+ for (dsec = sym_sec->owner->sections; dsec; dsec = dsec->next)
+ if (elf_discarded_section (dsec))
+ {
+ ppc64_elf_tdata (sym_sec->owner)->deleted_section = dsec;
+ break;
+ }
+ }
+ eh->elf.root.u.def.value = 0;
+ eh->elf.root.u.def.section = dsec;
+ }
+ else
+ eh->elf.root.u.def.value += adjust;
eh->adjust_done = 1;
}
return TRUE;
}
+/* Handles decrementing dynamic reloc counts for the reloc specified by
+ R_INFO in section SEC. If LOCAL_SYMS is NULL, then H and SYM_SEC
+ have already been determined. */
+
+static bfd_boolean
+dec_dynrel_count (bfd_vma r_info,
+ asection *sec,
+ struct bfd_link_info *info,
+ Elf_Internal_Sym **local_syms,
+ struct elf_link_hash_entry *h,
+ asection *sym_sec)
+{
+ enum elf_ppc64_reloc_type r_type;
+ struct ppc_dyn_relocs *p;
+ struct ppc_dyn_relocs **pp;
+
+ /* Can this reloc be dynamic? This switch, and later tests here
+ should be kept in sync with the code in check_relocs. */
+ r_type = ELF64_R_TYPE (r_info);
+ switch (r_type)
+ {
+ default:
+ return TRUE;
+
+ 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)
+ return TRUE;
+
+ case R_PPC64_TPREL64:
+ case R_PPC64_DTPMOD64:
+ case R_PPC64_DTPREL64:
+ case R_PPC64_ADDR64:
+ 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:
+ break;
+ }
+
+ if (local_syms != NULL)
+ {
+ unsigned long r_symndx;
+ Elf_Internal_Sym *sym;
+ bfd *ibfd = sec->owner;
+
+ r_symndx = ELF64_R_SYM (r_info);
+ if (!get_sym_h (&h, &sym, &sym_sec, NULL, local_syms, r_symndx, ibfd))
+ return FALSE;
+ }
+
+ if ((info->shared
+ && (MUST_BE_DYN_RELOC (r_type)
+ || (h != NULL
+ && (!info->symbolic
+ || h->root.type == bfd_link_hash_defweak
+ || !h->def_regular))))
+ || (ELIMINATE_COPY_RELOCS
+ && !info->shared
+ && h != NULL
+ && (h->root.type == bfd_link_hash_defweak
+ || !h->def_regular)))
+ ;
+ else
+ return TRUE;
+
+ if (h != NULL)
+ pp = &((struct ppc_link_hash_entry *) h)->dyn_relocs;
+ else
+ {
+ if (sym_sec != NULL)
+ {
+ void *vpp = &elf_section_data (sym_sec)->local_dynrel;
+ pp = (struct ppc_dyn_relocs **) vpp;
+ }
+ else
+ {
+ void *vpp = &elf_section_data (sec)->local_dynrel;
+ pp = (struct ppc_dyn_relocs **) vpp;
+ }
+
+ /* elf_gc_sweep may have already removed all dyn relocs associated
+ with local syms for a given section. Don't report a dynreloc
+ miscount. */
+ if (*pp == NULL)
+ return TRUE;
+ }
+
+ while ((p = *pp) != NULL)
+ {
+ if (p->sec == sec)
+ {
+ if (!MUST_BE_DYN_RELOC (r_type))
+ p->pc_count -= 1;
+ p->count -= 1;
+ if (p->count == 0)
+ *pp = p->next;
+ return TRUE;
+ }
+ pp = &p->next;
+ }
+
+ (*_bfd_error_handler) (_("dynreloc miscount for %B, section %A"),
+ sec->owner, sec);
+ bfd_set_error (bfd_error_bad_value);
+ return FALSE;
+}
+
/* 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
@@ -4949,10 +6323,13 @@ adjust_opd_syms (struct elf_link_hash_entry *h, void *inf ATTRIBUTE_UNUSED)
applications. */
bfd_boolean
-ppc64_elf_edit_opd (bfd *obfd, struct bfd_link_info *info)
+ppc64_elf_edit_opd (bfd *obfd, struct bfd_link_info *info,
+ bfd_boolean no_opd_opt,
+ bfd_boolean non_overlapping)
{
bfd *ibfd;
bfd_boolean some_edited = FALSE;
+ asection *need_pad = NULL;
for (ibfd = info->input_bfds; ibfd != NULL; ibfd = ibfd->link_next)
{
@@ -4963,23 +6340,34 @@ ppc64_elf_edit_opd (bfd *obfd, struct bfd_link_info *info)
struct elf_link_hash_entry **sym_hashes;
bfd_vma offset;
bfd_size_type amt;
- long *adjust;
- bfd_boolean need_edit;
+ long *opd_adjust;
+ bfd_boolean need_edit, add_aux_fields;
+ bfd_size_type cnt_16b = 0;
sec = bfd_get_section_by_name (ibfd, ".opd");
- if (sec == NULL)
+ if (sec == NULL || sec->size == 0)
continue;
- amt = sec->_raw_size * sizeof (long) / 24;
- adjust = ppc64_elf_section_data (sec)->opd.adjust;
- if (adjust == NULL)
+ amt = sec->size * sizeof (long) / 8;
+ opd_adjust = get_opd_info (sec);
+ if (opd_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;
+ /* check_relocs hasn't been called. Must be a ld -r link
+ or --just-symbols object. */
+ opd_adjust = bfd_alloc (obfd, amt);
+ if (opd_adjust == NULL)
+ return FALSE;
+ ppc64_elf_section_data (sec)->u.opd_adjust = opd_adjust;
+ BFD_ASSERT (ppc64_elf_section_data (sec)->sec_type == sec_normal);
+ ppc64_elf_section_data (sec)->sec_type = sec_opd;
}
- memset (adjust, 0, amt);
+ memset (opd_adjust, 0, amt);
+
+ if (no_opd_opt)
+ continue;
+
+ if (sec->sec_info_type == ELF_INFO_TYPE_JUST_SYMS)
+ continue;
if (sec->output_section == bfd_abs_section_ptr)
continue;
@@ -5001,6 +6389,7 @@ ppc64_elf_edit_opd (bfd *obfd, struct bfd_link_info *info)
/* First run through the relocs to check they are sane, and to
determine whether we need to edit this opd section. */
need_edit = FALSE;
+ need_pad = sec;
offset = 0;
relend = relstart + sec->reloc_count;
for (rel = relstart; rel < relend; )
@@ -5011,7 +6400,7 @@ ppc64_elf_edit_opd (bfd *obfd, struct bfd_link_info *info)
struct elf_link_hash_entry *h;
Elf_Internal_Sym *sym;
- /* .opd contains a regular array of 24 byte entries. We're
+ /* .opd contains a regular array of 16 or 24 byte entries. We're
only interested in the reloc pointing to a function entry
point. */
if (rel->r_offset != offset
@@ -5023,9 +6412,9 @@ ppc64_elf_edit_opd (bfd *obfd, struct bfd_link_info *info)
Also, there's nothing to prevent someone putting
something silly in .opd with the assembler. No .opd
optimization for them! */
+ broken_opd:
(*_bfd_error_handler)
- (_("%s: .opd is not a regular array of opd entries"),
- bfd_archive_filename (ibfd));
+ (_("%B: .opd is not a regular array of opd entries"), ibfd);
need_edit = FALSE;
break;
}
@@ -5034,8 +6423,8 @@ ppc64_elf_edit_opd (bfd *obfd, struct bfd_link_info *info)
|| (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);
+ (_("%B: unexpected reloc type %u in .opd section"),
+ ibfd, r_type);
need_edit = FALSE;
break;
}
@@ -5051,12 +6440,12 @@ ppc64_elf_edit_opd (bfd *obfd, struct bfd_link_info *info)
if (h != NULL)
sym_name = h->root.root.string;
else
- sym_name = bfd_elf_local_sym_name (ibfd, sym);
+ sym_name = bfd_elf_sym_name (ibfd, symtab_hdr, sym,
+ sym_sec);
(*_bfd_error_handler)
- (_("%s: undefined sym `%s' in .opd section"),
- bfd_archive_filename (ibfd),
- sym_name);
+ (_("%B: undefined sym `%s' in .opd section"),
+ ibfd, sym_name);
need_edit = FALSE;
break;
}
@@ -5072,19 +6461,54 @@ ppc64_elf_edit_opd (bfd *obfd, struct bfd_link_info *info)
|| 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 (rel == relend
+ || (rel + 1 == relend && rel->r_offset == offset + 16))
+ {
+ if (sec->size == offset + 24)
+ {
+ need_pad = NULL;
+ break;
+ }
+ if (rel == relend && sec->size == offset + 16)
+ {
+ cnt_16b++;
+ break;
+ }
+ goto broken_opd;
+ }
+
+ if (rel->r_offset == offset + 24)
+ offset += 24;
+ else if (rel->r_offset != offset + 16)
+ goto broken_opd;
+ else if (rel + 1 < relend
+ && ELF64_R_TYPE (rel[0].r_info) == R_PPC64_ADDR64
+ && ELF64_R_TYPE (rel[1].r_info) == R_PPC64_TOC)
+ {
+ offset += 16;
+ cnt_16b++;
+ }
+ else if (rel + 2 < relend
+ && ELF64_R_TYPE (rel[1].r_info) == R_PPC64_ADDR64
+ && ELF64_R_TYPE (rel[2].r_info) == R_PPC64_TOC)
+ {
+ offset += 24;
+ rel += 1;
+ }
+ else
+ goto broken_opd;
}
- if (need_edit)
+ add_aux_fields = non_overlapping && cnt_16b > 0;
+
+ if (need_edit || add_aux_fields)
{
Elf_Internal_Rela *write_rel;
bfd_byte *rptr, *wptr;
+ bfd_byte *new_contents = NULL;
bfd_boolean skip;
+ long opd_ent_size;
/* This seems a waste of time as input .opd sections are all
zeros as generated by gcc, but I suppose there's no reason
@@ -5092,11 +6516,11 @@ ppc64_elf_edit_opd (bfd *obfd, struct bfd_link_info *info)
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))
+ bfd_byte *loc;
+ if (!bfd_malloc_and_get_section (ibfd, sec, &loc))
{
+ if (loc != NULL)
+ free (loc);
error_ret:
if (local_syms != NULL
&& symtab_hdr->contents != (unsigned char *) local_syms)
@@ -5111,11 +6535,21 @@ ppc64_elf_edit_opd (bfd *obfd, struct bfd_link_info *info)
elf_section_data (sec)->relocs = relstart;
- wptr = sec->contents;
+ new_contents = sec->contents;
+ if (add_aux_fields)
+ {
+ new_contents = bfd_malloc (sec->size + cnt_16b * 8);
+ if (new_contents == NULL)
+ return FALSE;
+ need_pad = FALSE;
+ }
+ wptr = new_contents;
rptr = sec->contents;
+
write_rel = relstart;
skip = FALSE;
offset = 0;
+ opd_ent_size = 0;
for (rel = relstart; rel < relend; rel++)
{
unsigned long r_symndx;
@@ -5131,27 +6565,48 @@ ppc64_elf_edit_opd (bfd *obfd, struct bfd_link_info *info)
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));
+
+ /* See if the .opd entry is full 24 byte or
+ 16 byte (with fd_aux entry overlapped with next
+ fd_func). */
+ opd_ent_size = 24;
+ if ((rel + 2 == relend && sec->size == offset + 16)
+ || (rel + 3 < relend
+ && rel[2].r_offset == offset + 16
+ && rel[3].r_offset == offset + 24
+ && ELF64_R_TYPE (rel[2].r_info) == R_PPC64_ADDR64
+ && ELF64_R_TYPE (rel[3].r_info) == R_PPC64_TOC))
+ opd_ent_size = 16;
+
+ if (h != NULL
+ && h->root.root.string[0] == '.')
+ {
+ fdh = get_fdh ((struct ppc_link_hash_entry *) h,
+ ppc_hash_table (info));
+ if (fdh != NULL
+ && fdh->elf.root.type != bfd_link_hash_defined
+ && fdh->elf.root.type != bfd_link_hash_defweak)
+ fdh = NULL;
+ }
skip = (sym_sec->owner != ibfd
|| sym_sec->output_section == bfd_abs_section_ptr);
if (skip)
{
- if (h != NULL && sym_sec->owner == ibfd)
+ if (fdh != 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;
}
+ opd_adjust[rel->r_offset / 8] = -1;
}
else
{
/* We'll be keeping this opd entry. */
- if (h != NULL)
+ if (fdh != NULL)
{
/* Redefine the function descriptor symbol to
this location in the opd section. It is
@@ -5160,7 +6615,7 @@ ppc64_elf_edit_opd (bfd *obfd, struct bfd_link_info *info)
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->elf.root.u.def.value = wptr - new_contents;
fdh->adjust_done = 1;
}
@@ -5170,61 +6625,51 @@ ppc64_elf_edit_opd (bfd *obfd, struct bfd_link_info *info)
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;
+ opd_adjust[rel->r_offset / 8]
+ = (wptr - new_contents) - (rptr - sec->contents);
if (wptr != rptr)
- memcpy (wptr, rptr, 24);
- wptr += 24;
+ memcpy (wptr, rptr, opd_ent_size);
+ wptr += opd_ent_size;
+ if (add_aux_fields && opd_ent_size == 16)
+ {
+ memset (wptr, '\0', 8);
+ wptr += 8;
+ }
}
- rptr += 24;
- offset += 24;
+ rptr += opd_ent_size;
+ offset += opd_ent_size;
}
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;
- }
- }
+ if (!NO_OPD_RELOCS
+ && !info->relocatable
+ && !dec_dynrel_count (rel->r_info, sec, info,
+ NULL, h, sym_sec))
+ goto error_ret;
}
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;
+ rel->r_offset += opd_adjust[(offset - opd_ent_size) / 8];
if (write_rel != rel)
memcpy (write_rel, rel, sizeof (*rel));
++write_rel;
}
}
- sec->_cooked_size = wptr - sec->contents;
+ sec->size = wptr - new_contents;
sec->reloc_count = write_rel - relstart;
- /* Fudge the size too, as this is used later in
+ if (add_aux_fields)
+ {
+ free (sec->contents);
+ sec->contents = new_contents;
+ }
+
+ /* Fudge the header 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;
@@ -5247,6 +6692,40 @@ ppc64_elf_edit_opd (bfd *obfd, struct bfd_link_info *info)
if (some_edited)
elf_link_hash_traverse (elf_hash_table (info), adjust_opd_syms, NULL);
+ /* If we are doing a final link and the last .opd entry is just 16 byte
+ long, add a 8 byte padding after it. */
+ if (need_pad != NULL && !info->relocatable)
+ {
+ bfd_byte *p;
+
+ if ((need_pad->flags & SEC_IN_MEMORY) == 0)
+ {
+ BFD_ASSERT (need_pad->size > 0);
+
+ p = bfd_malloc (need_pad->size + 8);
+ if (p == NULL)
+ return FALSE;
+
+ if (! bfd_get_section_contents (need_pad->owner, need_pad,
+ p, 0, need_pad->size))
+ return FALSE;
+
+ need_pad->contents = p;
+ need_pad->flags |= (SEC_IN_MEMORY | SEC_HAS_CONTENTS);
+ }
+ else
+ {
+ p = bfd_realloc (need_pad->contents, need_pad->size + 8);
+ if (p == NULL)
+ return FALSE;
+
+ need_pad->contents = p;
+ }
+
+ memset (need_pad->contents + need_pad->size, 0, 8);
+ need_pad->size += 8;
+ }
+
return TRUE;
}
@@ -5260,13 +6739,31 @@ ppc64_elf_tls_setup (bfd *obfd, struct bfd_link_info *info)
htab = ppc_hash_table (info);
if (htab->tls_get_addr != NULL)
{
- struct elf_link_hash_entry *h = htab->tls_get_addr;
+ struct ppc_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;
+ while (h->elf.root.type == bfd_link_hash_indirect
+ || h->elf.root.type == bfd_link_hash_warning)
+ h = (struct ppc_link_hash_entry *) h->elf.root.u.i.link;
htab->tls_get_addr = h;
+
+ if (htab->tls_get_addr_fd == NULL
+ && h->oh != NULL
+ && h->oh->is_func_descriptor
+ && (h->oh->elf.root.type == bfd_link_hash_defined
+ || h->oh->elf.root.type == bfd_link_hash_defweak))
+ htab->tls_get_addr_fd = h->oh;
+ }
+
+ if (htab->tls_get_addr_fd != NULL)
+ {
+ struct ppc_link_hash_entry *h = htab->tls_get_addr_fd;
+
+ while (h->elf.root.type == bfd_link_hash_indirect
+ || h->elf.root.type == bfd_link_hash_warning)
+ h = (struct ppc_link_hash_entry *) h->elf.root.u.i.link;
+
+ htab->tls_get_addr_fd = h;
}
return _bfd_elf_tls_setup (obfd, info);
@@ -5293,12 +6790,22 @@ ppc64_elf_tls_optimize (bfd *obfd ATTRIBUTE_UNUSED, struct bfd_link_info *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)
+ asection *toc = bfd_get_section_by_name (ibfd, ".toc");
+ unsigned char *toc_ref = NULL;
+
+ /* Look at all the sections for this file, with TOC last. */
+ for (sec = (ibfd->sections == toc && toc && toc->next ? toc->next
+ : ibfd->sections);
+ sec != NULL;
+ sec = (sec == toc ? NULL
+ : sec->next == NULL ? toc
+ : sec->next == toc && toc->next ? toc->next
+ : 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;
+ long toc_ref_index = 0;
/* Read the relocations. */
relstart = _bfd_elf_link_read_relocs (ibfd, sec, NULL, NULL,
@@ -5327,6 +6834,8 @@ ppc64_elf_tls_optimize (bfd *obfd ATTRIBUTE_UNUSED, struct bfd_link_info *info)
err_free_rel:
if (elf_section_data (sec)->relocs != relstart)
free (relstart);
+ if (toc_ref != NULL)
+ free (toc_ref);
if (locsyms != NULL
&& (elf_tdata (ibfd)->symtab_hdr.contents
!= (unsigned char *) locsyms))
@@ -5342,22 +6851,14 @@ ppc64_elf_tls_optimize (bfd *obfd ATTRIBUTE_UNUSED, struct bfd_link_info *info)
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];
- }
- }
+ /* Symbols referenced by TLS relocs must be of type
+ STT_TLS. So no need for .opd local sym adjust. */
+ value = sym->st_value;
ok_tprel = FALSE;
is_local = FALSE;
if (h == NULL
- || !(h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC))
+ || !h->def_dynamic)
{
is_local = TRUE;
value += sym_sec->output_offset;
@@ -5424,7 +6925,8 @@ ppc64_elf_tls_optimize (bfd *obfd ATTRIBUTE_UNUSED, struct bfd_link_info *info)
case R_PPC64_REL14_BRNTAKEN:
case R_PPC64_REL24:
if (h != NULL
- && h == htab->tls_get_addr)
+ && (h == &htab->tls_get_addr->elf
+ || h == &htab->tls_get_addr_fd->elf))
{
if (!expecting_tls_get_addr
&& rel != relstart
@@ -5441,8 +6943,12 @@ ppc64_elf_tls_optimize (bfd *obfd ATTRIBUTE_UNUSED, struct bfd_link_info *info)
rel - 1, ibfd);
if (retval == 0)
goto err_free_rel;
- if (toc_tls != NULL)
- expecting_tls_get_addr = retval > 1;
+ if (retval > 1 && toc_tls != NULL)
+ {
+ expecting_tls_get_addr = 1;
+ if (toc_ref != NULL)
+ toc_ref[toc_ref_index] = 1;
+ }
}
if (expecting_tls_get_addr)
@@ -5460,8 +6966,40 @@ ppc64_elf_tls_optimize (bfd *obfd ATTRIBUTE_UNUSED, struct bfd_link_info *info)
expecting_tls_get_addr = 0;
continue;
+ case R_PPC64_TOC16:
+ case R_PPC64_TOC16_LO:
+ case R_PPC64_TLS:
+ expecting_tls_get_addr = 0;
+ if (sym_sec == toc && toc != NULL)
+ {
+ /* Mark this toc entry as referenced by a TLS
+ code sequence. We can do that now in the
+ case of R_PPC64_TLS, and after checking for
+ tls_get_addr for the TOC16 relocs. */
+ if (toc_ref == NULL)
+ {
+ toc_ref = bfd_zmalloc (toc->size / 8);
+ if (toc_ref == NULL)
+ goto err_free_rel;
+ }
+ if (h != NULL)
+ value = h->root.u.def.value;
+ else
+ value = sym->st_value;
+ value += rel->r_addend;
+ BFD_ASSERT (value < toc->size && value % 8 == 0);
+ toc_ref_index = value / 8;
+ if (r_type == R_PPC64_TLS)
+ toc_ref[toc_ref_index] = 1;
+ }
+ continue;
+
case R_PPC64_TPREL64:
expecting_tls_get_addr = 0;
+ if (sec != toc
+ || toc_ref == NULL
+ || !toc_ref[rel->r_offset / 8])
+ continue;
if (ok_tprel)
{
/* IE -> LE */
@@ -5474,6 +7012,10 @@ ppc64_elf_tls_optimize (bfd *obfd ATTRIBUTE_UNUSED, struct bfd_link_info *info)
case R_PPC64_DTPMOD64:
expecting_tls_get_addr = 0;
+ if (sec != toc
+ || toc_ref == NULL
+ || !toc_ref[rel->r_offset / 8])
+ continue;
if (rel + 1 < relend
&& (rel[1].r_info
== ELF64_R_INFO (r_symndx, R_PPC64_DTPREL64))
@@ -5528,29 +7070,20 @@ ppc64_elf_tls_optimize (bfd *obfd ATTRIBUTE_UNUSED, struct bfd_link_info *info)
ent->got.refcount -= 1;
}
}
- else if (h != NULL)
+ else
{
- 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;
- }
+ /* If we got rid of a DTPMOD/DTPREL reloc pair then
+ we'll lose one or two dyn relocs. */
+ if (!dec_dynrel_count (rel->r_info, sec, info,
+ NULL, h, sym_sec))
+ return FALSE;
+
+ if (tls_set == (TLS_EXPLICIT | TLS_GD))
+ {
+ if (!dec_dynrel_count ((rel + 1)->r_info, sec, info,
+ NULL, h, sym_sec))
+ return FALSE;
+ }
}
*tls_mask |= tls_set;
@@ -5561,6 +7094,9 @@ ppc64_elf_tls_optimize (bfd *obfd ATTRIBUTE_UNUSED, struct bfd_link_info *info)
free (relstart);
}
+ if (toc_ref != NULL)
+ free (toc_ref);
+
if (locsyms != NULL
&& (elf_tdata (ibfd)->symtab_hdr.contents
!= (unsigned char *) locsyms))
@@ -5574,6 +7110,462 @@ ppc64_elf_tls_optimize (bfd *obfd ATTRIBUTE_UNUSED, struct bfd_link_info *info)
return TRUE;
}
+/* Called via elf_link_hash_traverse from ppc64_elf_edit_toc to adjust
+ the values of any global symbols in a toc section that has been
+ edited. Globals in toc sections should be a rarity, so this function
+ sets a flag if any are found in toc sections other than the one just
+ edited, so that futher hash table traversals can be avoided. */
+
+struct adjust_toc_info
+{
+ asection *toc;
+ unsigned long *skip;
+ bfd_boolean global_toc_syms;
+};
+
+static bfd_boolean
+adjust_toc_syms (struct elf_link_hash_entry *h, void *inf)
+{
+ struct ppc_link_hash_entry *eh;
+ struct adjust_toc_info *toc_inf = (struct adjust_toc_info *) inf;
+
+ 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;
+
+ if (eh->elf.root.u.def.section == toc_inf->toc)
+ {
+ unsigned long skip = toc_inf->skip[eh->elf.root.u.def.value >> 3];
+ if (skip != (unsigned long) -1)
+ eh->elf.root.u.def.value -= skip;
+ else
+ {
+ (*_bfd_error_handler)
+ (_("%s defined in removed toc entry"), eh->elf.root.root.string);
+ eh->elf.root.u.def.section = &bfd_abs_section;
+ eh->elf.root.u.def.value = 0;
+ }
+ eh->adjust_done = 1;
+ }
+ else if (strcmp (eh->elf.root.u.def.section->name, ".toc") == 0)
+ toc_inf->global_toc_syms = TRUE;
+
+ return TRUE;
+}
+
+/* Examine all relocs referencing .toc sections in order to remove
+ unused .toc entries. */
+
+bfd_boolean
+ppc64_elf_edit_toc (bfd *obfd ATTRIBUTE_UNUSED, struct bfd_link_info *info)
+{
+ bfd *ibfd;
+ struct adjust_toc_info toc_inf;
+
+ toc_inf.global_toc_syms = TRUE;
+ for (ibfd = info->input_bfds; ibfd != NULL; ibfd = ibfd->link_next)
+ {
+ asection *toc, *sec;
+ Elf_Internal_Shdr *symtab_hdr;
+ Elf_Internal_Sym *local_syms;
+ struct elf_link_hash_entry **sym_hashes;
+ Elf_Internal_Rela *relstart, *rel;
+ unsigned long *skip, *drop;
+ unsigned char *used;
+ unsigned char *keep, last, some_unused;
+
+ toc = bfd_get_section_by_name (ibfd, ".toc");
+ if (toc == NULL
+ || toc->size == 0
+ || toc->sec_info_type == ELF_INFO_TYPE_JUST_SYMS
+ || elf_discarded_section (toc))
+ continue;
+
+ local_syms = NULL;
+ symtab_hdr = &elf_tdata (ibfd)->symtab_hdr;
+ sym_hashes = elf_sym_hashes (ibfd);
+
+ /* Look at sections dropped from the final link. */
+ skip = NULL;
+ relstart = NULL;
+ for (sec = ibfd->sections; sec != NULL; sec = sec->next)
+ {
+ if (sec->reloc_count == 0
+ || !elf_discarded_section (sec)
+ || get_opd_info (sec)
+ || (sec->flags & SEC_ALLOC) == 0
+ || (sec->flags & SEC_DEBUGGING) != 0)
+ continue;
+
+ relstart = _bfd_elf_link_read_relocs (ibfd, sec, NULL, NULL, FALSE);
+ if (relstart == NULL)
+ goto error_ret;
+
+ /* Run through the relocs to see which toc entries might be
+ unused. */
+ for (rel = relstart; rel < relstart + sec->reloc_count; ++rel)
+ {
+ enum elf_ppc64_reloc_type r_type;
+ unsigned long r_symndx;
+ asection *sym_sec;
+ struct elf_link_hash_entry *h;
+ Elf_Internal_Sym *sym;
+ bfd_vma val;
+
+ r_type = ELF64_R_TYPE (rel->r_info);
+ switch (r_type)
+ {
+ default:
+ continue;
+
+ 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:
+ 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 != toc)
+ continue;
+
+ if (h != NULL)
+ val = h->root.u.def.value;
+ else
+ val = sym->st_value;
+ val += rel->r_addend;
+
+ if (val >= toc->size)
+ continue;
+
+ /* Anything in the toc ought to be aligned to 8 bytes.
+ If not, don't mark as unused. */
+ if (val & 7)
+ continue;
+
+ if (skip == NULL)
+ {
+ skip = bfd_zmalloc (sizeof (*skip) * (toc->size + 7) / 8);
+ if (skip == NULL)
+ goto error_ret;
+ }
+
+ skip[val >> 3] = 1;
+ }
+
+ if (elf_section_data (sec)->relocs != relstart)
+ free (relstart);
+ }
+
+ if (skip == NULL)
+ continue;
+
+ used = bfd_zmalloc (sizeof (*used) * (toc->size + 7) / 8);
+ if (used == NULL)
+ {
+ error_ret:
+ if (local_syms != NULL
+ && symtab_hdr->contents != (unsigned char *) local_syms)
+ free (local_syms);
+ if (sec != NULL
+ && relstart != NULL
+ && elf_section_data (sec)->relocs != relstart)
+ free (relstart);
+ if (skip != NULL)
+ free (skip);
+ return FALSE;
+ }
+
+ /* Now check all kept sections that might reference the toc.
+ Check the toc itself last. */
+ for (sec = (ibfd->sections == toc && toc->next ? toc->next
+ : ibfd->sections);
+ sec != NULL;
+ sec = (sec == toc ? NULL
+ : sec->next == NULL ? toc
+ : sec->next == toc && toc->next ? toc->next
+ : sec->next))
+ {
+ int repeat;
+
+ if (sec->reloc_count == 0
+ || elf_discarded_section (sec)
+ || get_opd_info (sec)
+ || (sec->flags & SEC_ALLOC) == 0
+ || (sec->flags & SEC_DEBUGGING) != 0)
+ continue;
+
+ relstart = _bfd_elf_link_read_relocs (ibfd, sec, NULL, NULL, TRUE);
+ if (relstart == NULL)
+ goto error_ret;
+
+ /* Mark toc entries referenced as used. */
+ repeat = 0;
+ do
+ for (rel = relstart; rel < relstart + sec->reloc_count; ++rel)
+ {
+ enum elf_ppc64_reloc_type r_type;
+ unsigned long r_symndx;
+ asection *sym_sec;
+ struct elf_link_hash_entry *h;
+ Elf_Internal_Sym *sym;
+ bfd_vma val;
+
+ r_type = ELF64_R_TYPE (rel->r_info);
+ switch (r_type)
+ {
+ 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:
+ /* In case we're taking addresses of toc entries. */
+ case R_PPC64_ADDR64:
+ break;
+
+ default:
+ continue;
+ }
+
+ r_symndx = ELF64_R_SYM (rel->r_info);
+ if (!get_sym_h (&h, &sym, &sym_sec, NULL, &local_syms,
+ r_symndx, ibfd))
+ {
+ free (used);
+ goto error_ret;
+ }
+
+ if (sym_sec != toc)
+ continue;
+
+ if (h != NULL)
+ val = h->root.u.def.value;
+ else
+ val = sym->st_value;
+ val += rel->r_addend;
+
+ if (val >= toc->size)
+ continue;
+
+ /* For the toc section, we only mark as used if
+ this entry itself isn't unused. */
+ if (sec == toc
+ && !used[val >> 3]
+ && (used[rel->r_offset >> 3]
+ || !skip[rel->r_offset >> 3]))
+ /* Do all the relocs again, to catch reference
+ chains. */
+ repeat = 1;
+
+ used[val >> 3] = 1;
+ }
+ while (repeat);
+ }
+
+ /* Merge the used and skip arrays. Assume that TOC
+ doublewords not appearing as either used or unused belong
+ to to an entry more than one doubleword in size. */
+ for (drop = skip, keep = used, last = 0, some_unused = 0;
+ drop < skip + (toc->size + 7) / 8;
+ ++drop, ++keep)
+ {
+ if (*keep)
+ {
+ *drop = 0;
+ last = 0;
+ }
+ else if (*drop)
+ {
+ some_unused = 1;
+ last = 1;
+ }
+ else
+ *drop = last;
+ }
+
+ free (used);
+
+ if (some_unused)
+ {
+ bfd_byte *contents, *src;
+ unsigned long off;
+
+ /* Shuffle the toc contents, and at the same time convert the
+ skip array from booleans into offsets. */
+ if (!bfd_malloc_and_get_section (ibfd, toc, &contents))
+ goto error_ret;
+
+ elf_section_data (toc)->this_hdr.contents = contents;
+
+ for (src = contents, off = 0, drop = skip;
+ src < contents + toc->size;
+ src += 8, ++drop)
+ {
+ if (*drop)
+ {
+ *drop = (unsigned long) -1;
+ off += 8;
+ }
+ else if (off != 0)
+ {
+ *drop = off;
+ memcpy (src - off, src, 8);
+ }
+ }
+ toc->rawsize = toc->size;
+ toc->size = src - contents - off;
+
+ if (toc->reloc_count != 0)
+ {
+ Elf_Internal_Rela *wrel;
+ bfd_size_type sz;
+
+ /* Read toc relocs. */
+ relstart = _bfd_elf_link_read_relocs (ibfd, toc, NULL, NULL,
+ TRUE);
+ if (relstart == NULL)
+ goto error_ret;
+
+ /* Remove unused toc relocs, and adjust those we keep. */
+ wrel = relstart;
+ for (rel = relstart; rel < relstart + toc->reloc_count; ++rel)
+ if (skip[rel->r_offset >> 3] != (unsigned long) -1)
+ {
+ wrel->r_offset = rel->r_offset - skip[rel->r_offset >> 3];
+ wrel->r_info = rel->r_info;
+ wrel->r_addend = rel->r_addend;
+ ++wrel;
+ }
+ else if (!dec_dynrel_count (rel->r_info, toc, info,
+ &local_syms, NULL, NULL))
+ goto error_ret;
+
+ toc->reloc_count = wrel - relstart;
+ sz = elf_section_data (toc)->rel_hdr.sh_entsize;
+ elf_section_data (toc)->rel_hdr.sh_size = toc->reloc_count * sz;
+ BFD_ASSERT (elf_section_data (toc)->rel_hdr2 == NULL);
+ }
+
+ /* Adjust addends for relocs against the toc section sym. */
+ for (sec = ibfd->sections; sec != NULL; sec = sec->next)
+ {
+ if (sec->reloc_count == 0
+ || elf_discarded_section (sec))
+ continue;
+
+ relstart = _bfd_elf_link_read_relocs (ibfd, sec, NULL, NULL,
+ TRUE);
+ if (relstart == NULL)
+ goto error_ret;
+
+ for (rel = relstart; rel < relstart + sec->reloc_count; ++rel)
+ {
+ enum elf_ppc64_reloc_type r_type;
+ unsigned long r_symndx;
+ asection *sym_sec;
+ struct elf_link_hash_entry *h;
+ Elf_Internal_Sym *sym;
+
+ r_type = ELF64_R_TYPE (rel->r_info);
+ switch (r_type)
+ {
+ default:
+ continue;
+
+ 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:
+ case R_PPC64_ADDR64:
+ 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 != toc || h != NULL || sym->st_value != 0)
+ continue;
+
+ rel->r_addend -= skip[rel->r_addend >> 3];
+ }
+ }
+
+ /* We shouldn't have local or global symbols defined in the TOC,
+ but handle them anyway. */
+ if (local_syms != NULL)
+ {
+ Elf_Internal_Sym *sym;
+
+ for (sym = local_syms;
+ sym < local_syms + symtab_hdr->sh_info;
+ ++sym)
+ if (sym->st_shndx != SHN_UNDEF
+ && (sym->st_shndx < SHN_LORESERVE
+ || sym->st_shndx > SHN_HIRESERVE)
+ && sym->st_value != 0
+ && bfd_section_from_elf_index (ibfd, sym->st_shndx) == toc)
+ {
+ if (skip[sym->st_value >> 3] != (unsigned long) -1)
+ sym->st_value -= skip[sym->st_value >> 3];
+ else
+ {
+ (*_bfd_error_handler)
+ (_("%s defined in removed toc entry"),
+ bfd_elf_sym_name (ibfd, symtab_hdr, sym,
+ NULL));
+ sym->st_value = 0;
+ sym->st_shndx = SHN_ABS;
+ }
+ symtab_hdr->contents = (unsigned char *) local_syms;
+ }
+ }
+
+ /* Finally, adjust any global syms defined in the toc. */
+ if (toc_inf.global_toc_syms)
+ {
+ toc_inf.toc = toc;
+ toc_inf.skip = skip;
+ toc_inf.global_toc_syms = FALSE;
+ elf_link_hash_traverse (elf_hash_table (info), adjust_toc_syms,
+ &toc_inf);
+ }
+ }
+
+ 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;
+ }
+ free (skip);
+ }
+
+ return TRUE;
+}
+
/* Allocate space in .plt, .got and associated reloc sections for
dynamic relocs. */
@@ -5605,31 +7597,29 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf)
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;
+ if (s->size == 0)
+ s->size += PLT_INITIAL_ENTRY_SIZE;
- pent->plt.offset = s->_raw_size;
+ pent->plt.offset = s->size;
/* Make room for this entry. */
- s->_raw_size += PLT_ENTRY_SIZE;
+ s->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;
+ if (s->size == 0)
+ s->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;
+ if (s->size >= GLINK_CALL_STUB_SIZE + 32768*2*4)
+ s->size += 4;
+ s->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);
+ s->size += sizeof (Elf64_External_Rela);
doneone = TRUE;
}
else
@@ -5637,13 +7627,13 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf)
if (!doneone)
{
h->plt.plist = NULL;
- h->elf_link_hash_flags &= ~ELF_LINK_HASH_NEEDS_PLT;
+ h->needs_plt = 0;
}
}
else
{
h->plt.plist = NULL;
- h->elf_link_hash_flags &= ~ELF_LINK_HASH_NEEDS_PLT;
+ h->needs_plt = 0;
}
eh = (struct ppc_link_hash_entry *) h;
@@ -5681,29 +7671,29 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf)
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)
+ && !h->forced_local)
{
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))
+ && !h->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->got.offset = s->size;
+ s->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
+ ppc64_elf_tdata (gent->owner)->relgot->size
+= (gent->tls_type & eh->tls_mask & TLS_GD
? 2 * sizeof (Elf64_External_Rela)
: sizeof (Elf64_External_Rela));
@@ -5745,9 +7735,21 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf)
/* Also discard relocs on undefined weak syms with non-default
visibility. */
- if (ELF_ST_VISIBILITY (h->other) != STV_DEFAULT
+ if (eh->dyn_relocs != NULL
&& h->root.type == bfd_link_hash_undefweak)
- eh->dyn_relocs = NULL;
+ {
+ if (ELF_ST_VISIBILITY (h->other) != STV_DEFAULT)
+ eh->dyn_relocs = NULL;
+
+ /* Make sure this symbol is output as a dynamic symbol.
+ Undefined weak syms won't yet be marked as dynamic. */
+ else if (h->dynindx == -1
+ && !h->forced_local)
+ {
+ if (! bfd_elf_link_record_dynamic_symbol (info, h))
+ return FALSE;
+ }
+ }
}
else if (ELIMINATE_COPY_RELOCS)
{
@@ -5755,14 +7757,14 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf)
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)
+ if (!h->non_got_ref
+ && h->def_dynamic
+ && !h->def_regular)
{
/* Make sure this symbol is output as a dynamic symbol.
Undefined weak syms won't yet be marked as dynamic. */
if (h->dynindx == -1
- && (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0)
+ && !h->forced_local)
{
if (! bfd_elf_link_record_dynamic_symbol (info, h))
return FALSE;
@@ -5783,7 +7785,7 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf)
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);
+ sreloc->size += p->count * sizeof (Elf64_External_Rela);
}
return TRUE;
@@ -5843,7 +7845,7 @@ ppc64_elf_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
s = bfd_get_section_by_name (dynobj, ".interp");
if (s == NULL)
abort ();
- s->_raw_size = sizeof ELF_DYNAMIC_INTERPRETER;
+ s->size = sizeof ELF_DYNAMIC_INTERPRETER;
s->contents = (unsigned char *) ELF_DYNAMIC_INTERPRETER;
}
}
@@ -5859,18 +7861,18 @@ ppc64_elf_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
Elf_Internal_Shdr *symtab_hdr;
asection *srel;
- if (bfd_get_flavour (ibfd) != bfd_target_elf_flavour)
+ if (!is_ppc64_elf_target (ibfd->xvec))
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;
+ ppc64_tlsld_got (ibfd)->offset = s->size;
+ s->size += 16;
if (info->shared)
{
srel = ppc64_elf_tdata (ibfd)->relgot;
- srel->_raw_size += sizeof (Elf64_External_Rela);
+ srel->size += sizeof (Elf64_External_Rela);
}
}
else
@@ -5880,10 +7882,7 @@ ppc64_elf_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
{
struct ppc_dyn_relocs *p;
- for (p = *((struct ppc_dyn_relocs **)
- &elf_section_data (s)->local_dynrel);
- p != NULL;
- p = p->next)
+ for (p = 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))
@@ -5896,7 +7895,7 @@ ppc64_elf_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
else if (p->count != 0)
{
srel = elf_section_data (p->sec)->sreloc;
- srel->_raw_size += p->count * sizeof (Elf64_External_Rela);
+ srel->size += p->count * sizeof (Elf64_External_Rela);
if ((p->sec->output_section->flags & SEC_READONLY) != 0)
info->flags |= DF_TEXTREL;
}
@@ -5924,27 +7923,27 @@ ppc64_elf_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
{
if (ppc64_tlsld_got (ibfd)->offset == (bfd_vma) -1)
{
- ppc64_tlsld_got (ibfd)->offset = s->_raw_size;
- s->_raw_size += 16;
+ ppc64_tlsld_got (ibfd)->offset = s->size;
+ s->size += 16;
if (info->shared)
- srel->_raw_size += sizeof (Elf64_External_Rela);
+ srel->size += sizeof (Elf64_External_Rela);
}
ent->got.offset = ppc64_tlsld_got (ibfd)->offset;
}
else
{
- ent->got.offset = s->_raw_size;
+ ent->got.offset = s->size;
if ((ent->tls_type & *lgot_masks & TLS_GD) != 0)
{
- s->_raw_size += 16;
+ s->size += 16;
if (info->shared)
- srel->_raw_size += 2 * sizeof (Elf64_External_Rela);
+ srel->size += 2 * sizeof (Elf64_External_Rela);
}
else
{
- s->_raw_size += 8;
+ s->size += 8;
if (info->shared)
- srel->_raw_size += sizeof (Elf64_External_Rela);
+ srel->size += sizeof (Elf64_External_Rela);
}
}
}
@@ -5965,35 +7964,20 @@ ppc64_elf_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
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)
+ || s == htab->glink
+ || s == htab->dynbss)
{
/* 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)
+ else if (CONST_STRNEQ (bfd_get_section_name (dynobj, s), ".rela"))
{
- 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->size != 0)
{
if (s != htab->relplt)
relocs = TRUE;
@@ -6009,14 +7993,22 @@ ppc64_elf_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
continue;
}
- if (s->_raw_size == 0)
+ if (s->size == 0)
{
- _bfd_strip_section_from_output (info, s);
+ /* 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. */
+ s->flags |= SEC_EXCLUDE;
continue;
}
- /* .plt is in the bss section. We don't initialise it. */
- if (s == htab->plt)
+ if ((s->flags & SEC_HAS_CONTENTS) == 0)
continue;
/* Allocate memory for the section contents. We use bfd_zalloc
@@ -6026,26 +8018,24 @@ ppc64_elf_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
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);
+ s->contents = bfd_zalloc (dynobj, s->size);
if (s->contents == NULL)
return FALSE;
}
for (ibfd = info->input_bfds; ibfd != NULL; ibfd = ibfd->link_next)
{
- /* Skip this BFD if it is not ELF */
- if (bfd_get_flavour (ibfd) != bfd_target_elf_flavour)
+ if (!is_ppc64_elf_target (ibfd->xvec))
continue;
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);
+ if (s->size == 0)
+ s->flags |= SEC_EXCLUDE;
else
{
- s->contents = bfd_zalloc (ibfd, s->_raw_size);
+ s->contents = bfd_zalloc (ibfd, s->size);
if (s->contents == NULL)
return FALSE;
}
@@ -6053,12 +8043,11 @@ ppc64_elf_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
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);
+ if (s->size == 0)
+ s->flags |= SEC_EXCLUDE;
else
{
- s->contents = bfd_zalloc (ibfd, s->_raw_size);
+ s->contents = bfd_zalloc (ibfd, s->size);
if (s->contents == NULL)
return FALSE;
relocs = TRUE;
@@ -6083,7 +8072,7 @@ ppc64_elf_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
return FALSE;
}
- if (htab->plt != NULL && htab->plt->_raw_size != 0)
+ if (htab->plt != NULL && htab->plt->size != 0)
{
if (!add_dynamic_entry (DT_PLTGOT, 0)
|| !add_dynamic_entry (DT_PLTRELSZ, 0)
@@ -6140,22 +8129,34 @@ ppc_type_of_stub (asection *input_sec,
if (h != NULL)
{
- if (h->oh != NULL
- && h->oh->dynindx != -1)
+ struct ppc_link_hash_entry *fdh = h;
+ if (fdh->oh != NULL
+ && fdh->oh->is_func_descriptor)
+ fdh = fdh->oh;
+
+ if (fdh->elf.dynindx != -1)
{
struct plt_entry *ent;
- for (ent = h->oh->plt.plist; ent != NULL; ent = ent->next)
+
+ for (ent = fdh->elf.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;
+ *hash = fdh;
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)
+ /* Here, we know we don't have a plt entry. If we don't have a
+ either a defined function descriptor or a defined entry symbol
+ in a regular object file, then it is pointless trying to make
+ any other type of stub. */
+ if (!((fdh->elf.root.type == bfd_link_hash_defined
+ || fdh->elf.root.type == bfd_link_hash_defweak)
+ && fdh->elf.root.u.def.section->output_section != NULL)
+ && !((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;
}
@@ -6216,7 +8217,7 @@ ppc_build_one_stub (struct bfd_hash_entry *gen_entry, void *in_arg)
bfd_byte *p;
unsigned int indx;
struct plt_entry *ent;
- bfd_vma off;
+ bfd_vma dest, off;
int size;
/* Massage our args to the form they really have. */
@@ -6226,7 +8227,7 @@ ppc_build_one_stub (struct bfd_hash_entry *gen_entry, void *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;
+ stub_entry->stub_offset = stub_entry->stub_sec->size;
loc = stub_entry->stub_sec->contents + stub_entry->stub_offset;
htab->stub_count[stub_entry->stub_type - 1] += 1;
@@ -6235,9 +8236,9 @@ ppc_build_one_stub (struct bfd_hash_entry *gen_entry, void *in_arg)
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);
+ off = dest = (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
@@ -6263,7 +8264,74 @@ ppc_build_one_stub (struct bfd_hash_entry *gen_entry, void *in_arg)
}
bfd_put_32 (htab->stub_bfd, B_DOT | (off & 0x3fffffc), loc);
- BFD_ASSERT (off + (1 << 25) < (bfd_vma) (1 << 26));
+ if (off + (1 << 25) >= (bfd_vma) (1 << 26))
+ {
+ (*_bfd_error_handler) (_("long branch stub `%s' offset overflow"),
+ stub_entry->root.string);
+ htab->stub_error = TRUE;
+ return FALSE;
+ }
+
+ if (info->emitrelocations)
+ {
+ Elf_Internal_Rela *relocs, *r;
+ struct bfd_elf_section_data *elfsec_data;
+
+ elfsec_data = elf_section_data (stub_entry->stub_sec);
+ relocs = elfsec_data->relocs;
+ if (relocs == NULL)
+ {
+ bfd_size_type relsize;
+ relsize = stub_entry->stub_sec->reloc_count * sizeof (*relocs);
+ relocs = bfd_alloc (htab->stub_bfd, relsize);
+ if (relocs == NULL)
+ return FALSE;
+ elfsec_data->relocs = relocs;
+ elfsec_data->rel_hdr.sh_size = relsize;
+ elfsec_data->rel_hdr.sh_entsize = 24;
+ stub_entry->stub_sec->reloc_count = 0;
+ }
+ r = relocs + stub_entry->stub_sec->reloc_count;
+ stub_entry->stub_sec->reloc_count += 1;
+ r->r_offset = loc - stub_entry->stub_sec->contents;
+ r->r_info = ELF64_R_INFO (0, R_PPC64_REL24);
+ r->r_addend = dest;
+ if (stub_entry->h != NULL)
+ {
+ struct elf_link_hash_entry **hashes;
+ unsigned long symndx;
+ struct ppc_link_hash_entry *h;
+
+ hashes = elf_sym_hashes (htab->stub_bfd);
+ if (hashes == NULL)
+ {
+ bfd_size_type hsize;
+
+ hsize = (htab->stub_globals + 1) * sizeof (*hashes);
+ hashes = bfd_zalloc (htab->stub_bfd, hsize);
+ if (hashes == NULL)
+ return FALSE;
+ elf_sym_hashes (htab->stub_bfd) = hashes;
+ htab->stub_globals = 1;
+ }
+ symndx = htab->stub_globals++;
+ h = stub_entry->h;
+ hashes[symndx] = &h->elf;
+ r->r_info = ELF64_R_INFO (symndx, R_PPC64_REL24);
+ if (h->oh != NULL && h->oh->is_func)
+ h = h->oh;
+ if (h->elf.root.u.def.section != stub_entry->target_section)
+ /* H is an opd symbol. The addend must be zero. */
+ r->r_addend = 0;
+ else
+ {
+ off = (h->elf.root.u.def.value
+ + h->elf.root.u.def.section->output_offset
+ + h->elf.root.u.def.section->output_section->vma);
+ r->r_addend -= off;
+ }
+ }
+ }
break;
case ppc_stub_plt_branch:
@@ -6274,7 +8342,7 @@ ppc_build_one_stub (struct bfd_hash_entry *gen_entry, void *in_arg)
if (br_entry == NULL)
{
(*_bfd_error_handler) (_("can't find branch stub `%s'"),
- stub_entry->root.string + 9);
+ stub_entry->root.string);
htab->stub_error = TRUE;
return FALSE;
}
@@ -6286,7 +8354,7 @@ ppc_build_one_stub (struct bfd_hash_entry *gen_entry, void *in_arg)
bfd_put_64 (htab->brlt->owner, off,
htab->brlt->contents + br_entry->offset);
- if (info->shared)
+ if (htab->relbrlt != NULL)
{
/* Create a reloc for the branch lookup table entry. */
Elf_Internal_Rela rela;
@@ -6302,6 +8370,33 @@ ppc_build_one_stub (struct bfd_hash_entry *gen_entry, void *in_arg)
rl += htab->relbrlt->reloc_count++ * sizeof (Elf64_External_Rela);
bfd_elf64_swap_reloca_out (htab->relbrlt->owner, &rela, rl);
}
+ else if (info->emitrelocations)
+ {
+ Elf_Internal_Rela *relocs, *r;
+ struct bfd_elf_section_data *elfsec_data;
+
+ elfsec_data = elf_section_data (htab->brlt);
+ relocs = elfsec_data->relocs;
+ if (relocs == NULL)
+ {
+ bfd_size_type relsize;
+ relsize = htab->brlt->reloc_count * sizeof (*relocs);
+ relocs = bfd_alloc (htab->brlt->owner, relsize);
+ if (relocs == NULL)
+ return FALSE;
+ elfsec_data->relocs = relocs;
+ elfsec_data->rel_hdr.sh_size = relsize;
+ elfsec_data->rel_hdr.sh_entsize = 24;
+ htab->brlt->reloc_count = 0;
+ }
+ r = relocs + htab->brlt->reloc_count;
+ htab->brlt->reloc_count += 1;
+ r->r_offset = (br_entry->offset
+ + htab->brlt->output_offset
+ + htab->brlt->output_section->vma);
+ r->r_info = ELF64_R_INFO (0, R_PPC64_RELATIVE);
+ r->r_addend = off;
+ }
off = (br_entry->offset
+ htab->brlt->output_offset
@@ -6354,17 +8449,18 @@ ppc_build_one_stub (struct bfd_hash_entry *gen_entry, void *in_arg)
/* 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)
+ if (stub_entry->h->oh != NULL
+ && stub_entry->h->oh->elf.root.type != bfd_link_hash_defined
+ && stub_entry->h->oh->elf.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;
+ stub_entry->h->oh->elf.root.type = bfd_link_hash_defined;
+ stub_entry->h->oh->elf.root.u.def.section = stub_entry->stub_sec;
+ stub_entry->h->oh->elf.root.u.def.value = stub_entry->stub_offset;
}
/* Now build the stub. */
@@ -6403,17 +8499,28 @@ ppc_build_one_stub (struct bfd_hash_entry *gen_entry, void *in_arg)
return FALSE;
}
- stub_entry->stub_sec->_cooked_size += size;
+ stub_entry->stub_sec->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))
+ if (htab->emit_stub_syms)
{
struct elf_link_hash_entry *h;
- h = elf_link_hash_lookup (&htab->elf, stub_entry->root.string,
- TRUE, FALSE, FALSE);
+ size_t len1, len2;
+ char *name;
+ const char *const stub_str[] = { "long_branch",
+ "long_branch_r2off",
+ "plt_branch",
+ "plt_branch_r2off",
+ "plt_call" };
+
+ len1 = strlen (stub_str[stub_entry->stub_type - 1]);
+ len2 = strlen (stub_entry->root.string);
+ name = bfd_malloc (len1 + len2 + 2);
+ if (name == NULL)
+ return FALSE;
+ memcpy (name, stub_entry->root.string, 9);
+ memcpy (name + 9, stub_str[stub_entry->stub_type - 1], len1);
+ memcpy (name + len1 + 9, stub_entry->root.string + 8, len2 - 8 + 1);
+ h = elf_link_hash_lookup (&htab->elf, name, TRUE, FALSE, FALSE);
if (h == NULL)
return FALSE;
if (h->root.type == bfd_link_hash_new)
@@ -6421,10 +8528,11 @@ ppc_build_one_stub (struct bfd_hash_entry *gen_entry, void *in_arg)
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);
+ h->ref_regular = 1;
+ h->def_regular = 1;
+ h->ref_regular_nonweak = 1;
+ h->forced_local = 1;
+ h->non_elf = 0;
}
}
@@ -6478,7 +8586,7 @@ ppc_size_one_stub (struct bfd_hash_entry *gen_entry, void *in_arg)
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
+ off -= (stub_entry->stub_sec->size
+ stub_entry->stub_sec->output_offset
+ stub_entry->stub_sec->output_section->vma);
@@ -6505,7 +8613,7 @@ ppc_size_one_stub (struct bfd_hash_entry *gen_entry, void *in_arg)
if (br_entry == NULL)
{
(*_bfd_error_handler) (_("can't build branch stub `%s'"),
- stub_entry->root.string + 9);
+ stub_entry->root.string);
htab->stub_error = TRUE;
return FALSE;
}
@@ -6513,11 +8621,16 @@ ppc_size_one_stub (struct bfd_hash_entry *gen_entry, void *in_arg)
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;
+ br_entry->offset = htab->brlt->size;
+ htab->brlt->size += 8;
- if (info->shared)
- htab->relbrlt->_raw_size += sizeof (Elf64_External_Rela);
+ if (htab->relbrlt != NULL)
+ htab->relbrlt->size += sizeof (Elf64_External_Rela);
+ else if (info->emitrelocations)
+ {
+ htab->brlt->reloc_count += 1;
+ htab->brlt->flags |= SEC_RELOC;
+ }
}
stub_entry->stub_type += ppc_stub_plt_branch - ppc_stub_long_branch;
@@ -6525,9 +8638,14 @@ ppc_size_one_stub (struct bfd_hash_entry *gen_entry, void *in_arg)
if (stub_entry->stub_type != ppc_stub_plt_branch)
size = 28;
}
+ else if (info->emitrelocations)
+ {
+ stub_entry->stub_sec->reloc_count += 1;
+ stub_entry->stub_sec->flags |= SEC_RELOC;
+ }
}
- stub_entry->stub_sec->_raw_size += size;
+ stub_entry->stub_sec->size += size;
return TRUE;
}
@@ -6536,7 +8654,9 @@ ppc_size_one_stub (struct bfd_hash_entry *gen_entry, void *in_arg)
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)
+ppc64_elf_setup_section_lists (bfd *output_bfd,
+ struct bfd_link_info *info,
+ int no_multi_toc)
{
bfd *input_bfd;
int top_id, top_index, id;
@@ -6545,6 +8665,8 @@ ppc64_elf_setup_section_lists (bfd *output_bfd, struct bfd_link_info *info)
bfd_size_type amt;
struct ppc_link_hash_table *htab = ppc_hash_table (info);
+ htab->no_multi_toc = no_multi_toc;
+
if (htab->brlt == NULL)
return 0;
@@ -6576,7 +8698,7 @@ ppc64_elf_setup_section_lists (bfd *output_bfd, struct bfd_link_info *info)
/* 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. */
+ strip_excluded_output_sections doesn't renumber the indices. */
for (section = output_bfd->sections, top_index = 0;
section != NULL;
section = section->next)
@@ -6609,11 +8731,10 @@ ppc64_elf_next_toc_section (struct bfd_link_info *info, asection *isec)
{
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;
- }
+
+ if (off + isec->size > 0x10000)
+ htab->toc_curr = addr;
+
elf_gp (isec->owner) = (htab->toc_curr
- elf_gp (isec->output_section->owner)
+ TOC_BASE_OFF);
@@ -6623,11 +8744,12 @@ ppc64_elf_next_toc_section (struct bfd_link_info *info, asection *isec)
/* Called after the last call to the above function. */
void
-ppc64_elf_reinit_toc (bfd *output_bfd ATTRIBUTE_UNUSED,
- struct bfd_link_info *info)
+ppc64_elf_reinit_toc (bfd *output_bfd, struct bfd_link_info *info)
{
struct ppc_link_hash_table *htab = ppc_hash_table (info);
+ htab->multi_toc_needed = htab->toc_curr != elf_gp (output_bfd);
+
/* 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;
@@ -6636,64 +8758,208 @@ ppc64_elf_reinit_toc (bfd *output_bfd ATTRIBUTE_UNUSED,
/* 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. */
+ load r2. Returns -1 on error, 0 for no stub needed, 1 for stub
+ needed, and 2 if a cyclical call-graph was found but no other reason
+ for a stub was detected. If called from the top level, a return of
+ 2 means the same as a return of 0. */
static int
toc_adjusting_stub_needed (struct bfd_link_info *info, asection *isec)
{
- bfd_byte *contents;
- bfd_size_type i;
+ Elf_Internal_Rela *relstart, *rel;
+ Elf_Internal_Sym *local_syms;
int ret;
- int branch_ok;
+ struct ppc_link_hash_table *htab;
/* 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)
+ if (isec->size == 0)
+ return 0;
+
+ if (isec->output_section == NULL)
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;
+ if (strcmp (isec->name, ".fixup") == 0)
+ return 0;
+
+ if (isec->reloc_count == 0)
+ return 0;
+
+ relstart = _bfd_elf_link_read_relocs (isec->owner, isec, NULL, NULL,
+ info->keep_memory);
+ if (relstart == NULL)
+ return -1;
- contents = elf_section_data (isec)->this_hdr.contents;
- if (contents == NULL)
+ /* Look for branches to outside of this section. */
+ local_syms = NULL;
+ ret = 0;
+ htab = ppc_hash_table (info);
+ for (rel = relstart; rel < relstart + isec->reloc_count; ++rel)
{
- contents = bfd_malloc (isec->_raw_size);
- if (contents == NULL)
- return -1;
- if (! bfd_get_section_contents (isec->owner, isec, contents,
- 0, isec->_raw_size))
+ enum elf_ppc64_reloc_type r_type;
+ unsigned long r_symndx;
+ struct elf_link_hash_entry *h;
+ Elf_Internal_Sym *sym;
+ asection *sym_sec;
+ long *opd_adjust;
+ bfd_vma sym_value;
+ bfd_vma dest;
+
+ r_type = ELF64_R_TYPE (rel->r_info);
+ if (r_type != R_PPC64_REL24
+ && r_type != R_PPC64_REL14
+ && r_type != R_PPC64_REL14_BRTAKEN
+ && r_type != R_PPC64_REL14_BRNTAKEN)
+ continue;
+
+ r_symndx = ELF64_R_SYM (rel->r_info);
+ if (!get_sym_h (&h, &sym, &sym_sec, NULL, &local_syms, r_symndx,
+ isec->owner))
{
- free (contents);
- return -1;
+ ret = -1;
+ break;
}
- 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))
+ /* Calls to dynamic lib functions go through a plt call stub
+ that uses r2. Branches to undefined symbols might be a call
+ using old-style dot symbols that can be satisfied by a plt
+ call into a new-style dynamic library. */
+ if (sym_sec == NULL)
+ {
+ struct ppc_link_hash_entry *eh = (struct ppc_link_hash_entry *) h;
+ if (eh != NULL
+ && eh->oh != NULL
+ && eh->oh->elf.plt.plist != NULL)
+ {
+ ret = 1;
+ break;
+ }
+
+ /* Ignore other undefined symbols. */
+ continue;
+ }
+
+ /* Assume branches to other sections not included in the link need
+ stubs too, to cover -R and absolute syms. */
+ if (sym_sec->output_section == NULL)
{
ret = 1;
break;
}
+
+ if (h == NULL)
+ sym_value = sym->st_value;
+ else
+ {
+ if (h->root.type != bfd_link_hash_defined
+ && h->root.type != bfd_link_hash_defweak)
+ abort ();
+ sym_value = h->root.u.def.value;
+ }
+ sym_value += rel->r_addend;
+
+ /* If this branch reloc uses an opd sym, find the code section. */
+ opd_adjust = get_opd_info (sym_sec);
+ if (opd_adjust != NULL)
+ {
+ if (h == NULL)
+ {
+ long adjust;
+
+ adjust = opd_adjust[sym->st_value / 8];
+ if (adjust == -1)
+ /* Assume deleted functions won't ever be called. */
+ continue;
+ sym_value += adjust;
+ }
+
+ dest = opd_entry_value (sym_sec, sym_value, &sym_sec, NULL);
+ if (dest == (bfd_vma) -1)
+ continue;
+ }
+ else
+ dest = (sym_value
+ + sym_sec->output_offset
+ + sym_sec->output_section->vma);
+
+ /* Ignore branch to self. */
+ if (sym_sec == isec)
+ continue;
+
+ /* If the called function uses the toc, we need a stub. */
+ if (sym_sec->has_toc_reloc
+ || sym_sec->makes_toc_func_call)
+ {
+ ret = 1;
+ break;
+ }
+
+ /* Assume any branch that needs a long branch stub might in fact
+ need a plt_branch stub. A plt_branch stub uses r2. */
+ else if (dest - (isec->output_offset
+ + isec->output_section->vma
+ + rel->r_offset) + (1 << 25) >= (2 << 25))
+ {
+ ret = 1;
+ break;
+ }
+
+ /* If calling back to a section in the process of being tested, we
+ can't say for sure that no toc adjusting stubs are needed, so
+ don't return zero. */
+ else if (sym_sec->call_check_in_progress)
+ ret = 2;
+
+ /* Branches to another section that itself doesn't have any TOC
+ references are OK. Recursively call ourselves to check. */
+ else if (sym_sec->id <= htab->top_id
+ && htab->stub_group[sym_sec->id].toc_off == 0)
+ {
+ int recur;
+
+ /* Mark current section as indeterminate, so that other
+ sections that call back to current won't be marked as
+ known. */
+ isec->call_check_in_progress = 1;
+ recur = toc_adjusting_stub_needed (info, sym_sec);
+ isec->call_check_in_progress = 0;
+
+ if (recur < 0)
+ {
+ /* An error. Exit. */
+ ret = -1;
+ break;
+ }
+ else if (recur <= 1)
+ {
+ /* Known result. Mark as checked and set section flag. */
+ htab->stub_group[sym_sec->id].toc_off = 1;
+ if (recur != 0)
+ {
+ sym_sec->makes_toc_func_call = 1;
+ ret = 1;
+ break;
+ }
+ }
+ else
+ {
+ /* Unknown result. Continue checking. */
+ ret = 2;
+ }
+ }
}
- if (elf_section_data (isec)->this_hdr.contents != contents)
- free (contents);
+ if (local_syms != NULL
+ && (elf_tdata (isec->owner)->symtab_hdr.contents
+ != (unsigned char *) local_syms))
+ free (local_syms);
+ if (elf_section_data (isec)->relocs != relstart)
+ free (relstart);
+
return ret;
}
@@ -6706,7 +8972,6 @@ 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)
@@ -6720,19 +8985,26 @@ ppc64_elf_next_input_section (struct bfd_link_info *info, asection *isec)
*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 (htab->multi_toc_needed)
{
- if (elf_gp (isec->owner) != 0)
- htab->toc_curr = elf_gp (isec->owner);
+ /* 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_toc_reloc || (isec->flags & SEC_CODE) == 0)
+ {
+ if (elf_gp (isec->owner) != 0)
+ htab->toc_curr = elf_gp (isec->owner);
+ }
+ else if (htab->stub_group[isec->id].toc_off == 0)
+ {
+ int ret = toc_adjusting_stub_needed (info, isec);
+ if (ret < 0)
+ return FALSE;
+ else
+ isec->makes_toc_func_call = ret & 1;
+ }
}
- 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
@@ -6753,7 +9025,29 @@ 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;
+ asection **list;
+ bfd_size_type stub14_group_size;
+ bfd_boolean suppress_size_errors;
+
+ suppress_size_errors = FALSE;
+ stub14_group_size = stub_group_size;
+ if (stub_group_size == 1)
+ {
+ /* Default values. */
+ if (stubs_always_before_branch)
+ {
+ stub_group_size = 0x1e00000;
+ stub14_group_size = 0x7800;
+ }
+ else
+ {
+ stub_group_size = 0x1c00000;
+ stub14_group_size = 0x7000;
+ }
+ suppress_size_errors = TRUE;
+ }
+
+ list = htab->input_list + htab->top_index;
do
{
asection *tail = *list;
@@ -6766,16 +9060,18 @@ group_sections (struct ppc_link_hash_table *htab,
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;
+ total = tail->size;
+ big_sec = total > (ppc64_elf_section_data (tail)->has_14bit_branch
+ ? stub14_group_size : stub_group_size);
+ if (big_sec && !suppress_size_errors)
+ (*_bfd_error_handler) (_("%B section %A exceeds stub group size"),
+ tail->owner, tail);
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)
+ < (ppc64_elf_section_data (prev)->has_14bit_branch
+ ? stub14_group_size : stub_group_size))
&& htab->stub_group[prev->id].toc_off == curr_toc)
curr = prev;
@@ -6807,7 +9103,8 @@ group_sections (struct ppc_link_hash_table *htab,
total = 0;
while (prev != NULL
&& ((total += tail->output_offset - prev->output_offset)
- < stub_group_size)
+ < (ppc64_elf_section_data (prev)->has_14bit_branch
+ ? stub14_group_size : stub_group_size))
&& htab->stub_group[prev->id].toc_off == curr_toc)
{
tail = prev;
@@ -6848,22 +9145,6 @@ ppc64_elf_size_stubs (bfd *output_bfd,
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);
@@ -6872,10 +9153,8 @@ ppc64_elf_size_stubs (bfd *output_bfd,
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;
@@ -6885,6 +9164,9 @@ ppc64_elf_size_stubs (bfd *output_bfd,
asection *section;
Elf_Internal_Sym *local_syms = NULL;
+ if (!is_ppc64_elf_target (input_bfd->xvec))
+ continue;
+
/* We'll need the symbol table in a second. */
symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr;
if (symtab_hdr->sh_info == 0)
@@ -6900,6 +9182,9 @@ ppc64_elf_size_stubs (bfd *output_bfd,
/* If there aren't any relocs, then there's nothing more
to do. */
if ((section->flags & SEC_RELOC) == 0
+ || (section->flags & SEC_ALLOC) == 0
+ || (section->flags & SEC_LOAD) == 0
+ || (section->flags & SEC_CODE) == 0
|| section->reloc_count == 0)
continue;
@@ -6925,14 +9210,17 @@ ppc64_elf_size_stubs (bfd *output_bfd,
unsigned int r_indx;
enum ppc_stub_type stub_type;
struct ppc_stub_hash_entry *stub_entry;
- asection *sym_sec;
+ asection *sym_sec, *code_sec;
bfd_vma sym_value;
bfd_vma destination;
+ bfd_boolean ok_dest;
struct ppc_link_hash_entry *hash;
+ struct ppc_link_hash_entry *fdh;
struct elf_link_hash_entry *h;
Elf_Internal_Sym *sym;
char *stub_name;
const asection *id_sec;
+ long *opd_adjust;
r_type = ELF64_R_TYPE (irela->r_info);
r_indx = ELF64_R_SYM (irela->r_info);
@@ -6952,41 +9240,88 @@ ppc64_elf_size_stubs (bfd *output_bfd,
/* 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;
+ ok_dest = FALSE;
+ fdh = NULL;
+ sym_value = 0;
if (hash == NULL)
{
- /* It's a local symbol. */
sym_value = sym->st_value;
- destination = (sym_value + irela->r_addend
+ ok_dest = TRUE;
+ }
+ else 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)
+ ok_dest = TRUE;
+ }
+ else if (hash->elf.root.type == bfd_link_hash_undefweak
+ || hash->elf.root.type == bfd_link_hash_undefined)
+ {
+ /* Recognise an old ABI func code entry sym, and
+ use the func descriptor sym instead if it is
+ defined. */
+ if (hash->elf.root.root.string[0] == '.'
+ && (fdh = get_fdh (hash, htab)) != NULL)
+ {
+ if (fdh->elf.root.type == bfd_link_hash_defined
+ || fdh->elf.root.type == bfd_link_hash_defweak)
+ {
+ sym_sec = fdh->elf.root.u.def.section;
+ sym_value = fdh->elf.root.u.def.value;
+ if (sym_sec->output_section != NULL)
+ ok_dest = TRUE;
+ }
+ else
+ fdh = NULL;
+ }
+ }
+ else
+ {
+ bfd_set_error (bfd_error_bad_value);
+ goto error_ret_free_internal;
+ }
+
+ destination = 0;
+ if (ok_dest)
+ {
+ sym_value += irela->r_addend;
+ destination = (sym_value
+ sym_sec->output_offset
+ sym_sec->output_section->vma);
}
- else
+
+ code_sec = sym_sec;
+ opd_adjust = get_opd_info (sym_sec);
+ if (opd_adjust != NULL)
{
- /* 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)
+ bfd_vma dest;
+
+ if (hash == NULL)
{
- 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);
+ long adjust = opd_adjust[sym_value / 8];
+ if (adjust == -1)
+ continue;
+ sym_value += adjust;
}
- else if (hash->elf.root.type == bfd_link_hash_undefweak)
- ;
- else if (hash->elf.root.type == bfd_link_hash_undefined)
- ;
- else
+ dest = opd_entry_value (sym_sec, sym_value,
+ &code_sec, &sym_value);
+ if (dest != (bfd_vma) -1)
{
- bfd_set_error (bfd_error_bad_value);
- goto error_ret_free_internal;
+ destination = dest;
+ if (fdh != NULL)
+ {
+ /* Fixup old ABI sym to point at code
+ entry. */
+ hash->elf.root.type = bfd_link_hash_defweak;
+ hash->elf.root.u.def.section = code_sec;
+ hash->elf.root.u.def.value = sym_value;
+ }
}
}
@@ -7002,12 +9337,12 @@ ppc64_elf_size_stubs (bfd *output_bfd,
_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
+ if (code_sec != NULL
+ && code_sec->output_section != NULL
+ && (htab->stub_group[code_sec->id].toc_off
!= htab->stub_group[section->id].toc_off)
- && sym_sec->has_gp_reloc
- && section->has_gp_reloc)
+ && (code_sec->has_toc_reloc
+ || code_sec->makes_toc_func_call))
stub_type = ppc_stub_long_branch_r2off;
}
@@ -7017,7 +9352,8 @@ ppc64_elf_size_stubs (bfd *output_bfd,
/* __tls_get_addr calls might be eliminated. */
if (stub_type != ppc_stub_plt_call
&& hash != NULL
- && &hash->elf == htab->tls_get_addr
+ && (hash == htab->tls_get_addr
+ || hash == htab->tls_get_addr_fd)
&& section->has_tls_reloc
&& irela != internal_relocs)
{
@@ -7065,10 +9401,12 @@ ppc64_elf_size_stubs (bfd *output_bfd,
stub_entry->stub_type = stub_type;
stub_entry->target_value = sym_value;
- stub_entry->target_section = sym_sec;
+ stub_entry->target_section = code_sec;
stub_entry->h = hash;
stub_entry->addend = irela->r_addend;
- stub_changed = TRUE;
+
+ if (stub_entry->h != NULL)
+ htab->stub_globals += 1;
}
/* We're done with the internal relocs, free them. */
@@ -7086,34 +9424,44 @@ ppc64_elf_size_stubs (bfd *output_bfd,
}
}
- if (!stub_changed)
- break;
-
- /* OK, we've added some stubs. Find out the new size of the
+ /* We may have 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;
+ stub_sec->rawsize = stub_sec->size;
+ stub_sec->size = 0;
+ stub_sec->reloc_count = 0;
+ stub_sec->flags &= ~SEC_RELOC;
}
- htab->brlt->_raw_size = 0;
- htab->brlt->_cooked_size = 0;
- if (info->shared)
- {
- htab->relbrlt->_raw_size = 0;
- htab->relbrlt->_cooked_size = 0;
- }
+
+ htab->brlt->size = 0;
+ htab->brlt->reloc_count = 0;
+ htab->brlt->flags &= ~SEC_RELOC;
+ if (htab->relbrlt != NULL)
+ htab->relbrlt->size = 0;
bfd_hash_traverse (&htab->stub_hash_table, ppc_size_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->rawsize != stub_sec->size)
+ break;
+
+ /* Exit from this loop when no stubs have been added, and no stubs
+ have changed size. */
+ if (stub_sec == NULL)
+ break;
+
/* Ask the linker to do its stuff. */
(*htab->layout_sections_again) ();
}
- /* It would be nice to strip .branch_lt from the output if the
+ /* It would be nice to strip htab->brlt 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. */
@@ -7192,42 +9540,29 @@ ppc64_elf_build_stubs (bfd_boolean emit_stub_syms,
int stub_sec_count = 0;
htab->emit_stub_syms = emit_stub_syms;
+
+ /* Allocate memory to hold the linker stubs. */
for (stub_sec = htab->stub_bfd->sections;
stub_sec != NULL;
stub_sec = stub_sec->next)
- if ((stub_sec->flags & SEC_LINKER_CREATED) == 0)
+ if ((stub_sec->flags & SEC_LINKER_CREATED) == 0
+ && stub_sec->size != 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;
+ stub_sec->contents = bfd_zalloc (htab->stub_bfd, stub_sec->size);
+ if (stub_sec->contents == NULL)
+ return FALSE;
+ /* We want to check that built size is the same as calculated
+ size. rawsize is a convenient location to use. */
+ stub_sec->rawsize = stub_sec->size;
+ stub_sec->size = 0;
}
- if (htab->glink != NULL && htab->glink->contents != NULL)
+ if (htab->glink != NULL && htab->glink->size != 0)
{
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;
@@ -7238,37 +9573,35 @@ ppc64_elf_build_stubs (bfd_boolean emit_stub_syms,
{
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);
+ h->root.u.def.value = 8;
+ h->ref_regular = 1;
+ h->def_regular = 1;
+ h->ref_regular_nonweak = 1;
+ h->forced_local = 1;
+ h->non_elf = 0;
}
}
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);
+ plt0 = (htab->plt->output_section->vma
+ + htab->plt->output_offset
+ - (htab->glink->output_section->vma
+ + htab->glink->output_offset
+ + 16));
+ bfd_put_64 (htab->glink->owner, plt0, p);
+ p += 8;
+ bfd_put_32 (htab->glink->owner, MFLR_R12, p);
p += 4;
- bfd_put_32 (htab->glink->owner, AND_R2_R2_R11, p);
+ bfd_put_32 (htab->glink->owner, BCL_20_31, p);
p += 4;
- bfd_put_32 (htab->glink->owner, SUB_R12_R12_R11, p);
+ bfd_put_32 (htab->glink->owner, MFLR_R11, p);
p += 4;
- bfd_put_32 (htab->glink->owner, ADD_R12_R12_R2, p);
+ bfd_put_32 (htab->glink->owner, LD_R2_M16R11, p);
p += 4;
- bfd_put_32 (htab->glink->owner, ADDIS_R12_R12 | PPC_HA (plt0), p);
+ bfd_put_32 (htab->glink->owner, MTLR_R12, p);
p += 4;
- bfd_put_32 (htab->glink->owner, LD_R11_0R12 | PPC_LO (plt0), p);
+ bfd_put_32 (htab->glink->owner, ADD_R12_R2_R11, p);
p += 4;
- bfd_put_32 (htab->glink->owner, ADDI_R12_R12 | PPC_LO (plt0), p);
+ bfd_put_32 (htab->glink->owner, LD_R11_0R12, p);
p += 4;
bfd_put_32 (htab->glink->owner, LD_R2_0R12 | 8, p);
p += 4;
@@ -7278,10 +9611,15 @@ ppc64_elf_build_stubs (bfd_boolean emit_stub_syms,
p += 4;
bfd_put_32 (htab->glink->owner, BCTR, p);
p += 4;
+ while (p - htab->glink->contents < GLINK_CALL_STUB_SIZE)
+ {
+ bfd_put_32 (htab->glink->owner, NOP, p);
+ p += 4;
+ }
/* Build the .glink lazy link call stubs. */
indx = 0;
- while (p < htab->glink->contents + htab->glink->_raw_size)
+ while (p < htab->glink->contents + htab->glink->size)
{
if (indx < 0x8000)
{
@@ -7296,24 +9634,24 @@ ppc64_elf_build_stubs (bfd_boolean emit_stub_syms,
p += 4;
}
bfd_put_32 (htab->glink->owner,
- B_DOT | ((htab->glink->contents - p) & 0x3fffffc), p);
+ B_DOT | ((htab->glink->contents - p + 8) & 0x3fffffc), p);
indx++;
p += 4;
}
- htab->glink->_cooked_size = p - htab->glink->contents;
+ htab->glink->rawsize = p - htab->glink->contents;
}
- if (htab->brlt->_raw_size != 0)
+ if (htab->brlt->size != 0)
{
htab->brlt->contents = bfd_zalloc (htab->brlt->owner,
- htab->brlt->_raw_size);
+ htab->brlt->size);
if (htab->brlt->contents == NULL)
return FALSE;
}
- if (info->shared && htab->relbrlt->_raw_size != 0)
+ if (htab->relbrlt != NULL && htab->relbrlt->size != 0)
{
htab->relbrlt->contents = bfd_zalloc (htab->relbrlt->owner,
- htab->relbrlt->_raw_size);
+ htab->relbrlt->size);
if (htab->relbrlt->contents == NULL)
return FALSE;
}
@@ -7321,18 +9659,21 @@ ppc64_elf_build_stubs (bfd_boolean emit_stub_syms,
/* Build the stubs as directed by the stub hash table. */
bfd_hash_traverse (&htab->stub_hash_table, ppc_build_one_stub, info);
+ if (htab->relbrlt != NULL)
+ htab->relbrlt->reloc_count = 0;
+
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)
+ if (stub_sec->rawsize != stub_sec->size)
break;
}
if (stub_sec != NULL
- || htab->glink->_raw_size != htab->glink->_cooked_size)
+ || htab->glink->rawsize != htab->glink->size)
{
htab->stub_error = TRUE;
(*_bfd_error_handler) (_("stubs don't match calculated size"));
@@ -7347,13 +9688,14 @@ ppc64_elf_build_stubs (bfd_boolean emit_stub_syms,
if (*stats == NULL)
return FALSE;
- sprintf (*stats, _("linker stubs in %u groups\n"
+ sprintf (*stats, _("linker stubs in %u group%s\n"
" branch %lu\n"
" toc adjust %lu\n"
" long branch %lu\n"
" long toc adj %lu\n"
" plt call %lu"),
stub_sec_count,
+ stub_sec_count == 1 ? "" : "s",
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],
@@ -7363,6 +9705,55 @@ ppc64_elf_build_stubs (bfd_boolean emit_stub_syms,
return TRUE;
}
+/* This function undoes the changes made by add_symbol_adjust. */
+
+static bfd_boolean
+undo_symbol_twiddle (struct elf_link_hash_entry *h, void *inf ATTRIBUTE_UNUSED)
+{
+ struct ppc_link_hash_entry *eh;
+
+ 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;
+
+ eh = (struct ppc_link_hash_entry *) h;
+ if (eh->elf.root.type != bfd_link_hash_undefweak || !eh->was_undefined)
+ return TRUE;
+
+ eh->elf.root.type = bfd_link_hash_undefined;
+ return TRUE;
+}
+
+void
+ppc64_elf_restore_symbols (struct bfd_link_info *info)
+{
+ struct ppc_link_hash_table *htab = ppc_hash_table (info);
+ elf_link_hash_traverse (&htab->elf, undo_symbol_twiddle, info);
+}
+
+/* What to do when ld finds relocations against symbols defined in
+ discarded sections. */
+
+static unsigned int
+ppc64_elf_action_discarded (asection *sec)
+{
+ if (strcmp (".opd", sec->name) == 0)
+ return 0;
+
+ if (strcmp (".toc", sec->name) == 0)
+ return 0;
+
+ if (strcmp (".toc1", sec->name) == 0)
+ return 0;
+
+ if (sec->flags & SEC_RELOC)
+ return 0;
+
+ return _bfd_elf_default_action_discarded (sec);
+}
+
/* The RELOCATE_SECTION function is called by the ELF backend linker
to handle the relocations for a section.
@@ -7415,32 +9806,36 @@ ppc64_elf_relocate_section (bfd *output_bfd,
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;
+ bfd_vma d_offset = (bfd_big_endian (output_bfd) ? 2 : 0);
/* Initialize howto table if needed. */
if (!ppc64_elf_howto_table[R_PPC64_ADDR32])
ppc_howto_init ();
htab = ppc_hash_table (info);
+
+ /* Don't relocate stub sections. */
+ if (input_section->owner == htab->stub_bfd)
+ return TRUE;
+
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;
+ is_opd = ppc64_elf_section_data (input_section)->sec_type == sec_opd;
rel = relocs;
relend = relocs + input_section->reloc_count;
for (; rel < relend; rel++)
{
enum elf_ppc64_reloc_type r_type;
- bfd_vma addend;
+ bfd_vma addend, orig_addend;
bfd_reloc_status_type r;
Elf_Internal_Sym *sym;
asection *sec;
- struct elf_link_hash_entry *h;
- struct elf_link_hash_entry *fdh;
+ struct elf_link_hash_entry *h_elf;
+ struct ppc_link_hash_entry *h;
+ struct ppc_link_hash_entry *fdh;
const char *sym_name;
unsigned long r_symndx, toc_symndx;
char tls_mask, tls_gd, tls_type;
@@ -7467,37 +9862,67 @@ ppc64_elf_relocate_section (bfd *output_bfd,
sym = NULL;
sec = NULL;
- h = NULL;
+ h_elf = NULL;
sym_name = NULL;
unresolved_reloc = FALSE;
warned = FALSE;
+ orig_addend = rel->r_addend;
if (r_symndx < symtab_hdr->sh_info)
{
/* It's a local symbol. */
+ long *opd_adjust;
+
sym = local_syms + r_symndx;
sec = local_sections[r_symndx];
- sym_name = bfd_elf_local_sym_name (input_bfd, sym);
+ sym_name = bfd_elf_sym_name (input_bfd, symtab_hdr, sym, sec);
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)
+ opd_adjust = get_opd_info (sec);
+ if (opd_adjust != 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];
+ long adjust = opd_adjust[(sym->st_value + rel->r_addend) / 8];
+ if (adjust == -1)
+ relocation = 0;
+ else
+ {
+ /* If this is a relocation against the opd section sym
+ and we have edited .opd, adjust the reloc addend so
+ that ld -r and ld --emit-relocs output is correct.
+ If it is a reloc against some other .opd symbol,
+ then the symbol value will be adjusted later. */
+ if (ELF_ST_TYPE (sym->st_info) == STT_SECTION)
+ rel->r_addend += adjust;
+ else
+ relocation += adjust;
+ }
}
}
else
{
RELOC_FOR_GLOBAL_SYMBOL (info, input_bfd, input_section, rel,
r_symndx, symtab_hdr, sym_hashes,
- h, sec, relocation,
+ h_elf, sec, relocation,
unresolved_reloc, warned);
- sym_name = h->root.root.string;
- sym_type = h->type;
+ sym_name = h_elf->root.root.string;
+ sym_type = h_elf->type;
}
+ h = (struct ppc_link_hash_entry *) h_elf;
+
+ if (sec != NULL && elf_discarded_section (sec))
+ {
+ /* For relocs against symbols from removed linkonce sections,
+ or sections discarded by a linker script, we just want the
+ section contents zeroed. Avoid any special processing. */
+ _bfd_clear_contents (ppc64_elf_howto_table[r_type], input_bfd,
+ contents + rel->r_offset);
+ rel->r_info = 0;
+ rel->r_addend = 0;
+ continue;
+ }
+
+ if (info->relocatable)
+ continue;
/* TLS optimizations. Replace instruction sequences and relocs
based on information we collected in tls_optimize. We edit
@@ -7509,7 +9934,7 @@ ppc64_elf_relocate_section (bfd *output_bfd,
if (IS_PPC64_TLS_RELOC (r_type))
{
if (h != NULL)
- tls_mask = ((struct ppc_link_hash_entry *) h)->tls_mask;
+ tls_mask = h->tls_mask;
else if (local_got_ents != NULL)
{
char *lgot_masks;
@@ -7535,8 +9960,8 @@ ppc64_elf_relocate_section (bfd *output_bfd,
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)
+ || h->elf.root.type == bfd_link_hash_defined
+ || h->elf.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)
@@ -7545,10 +9970,10 @@ ppc64_elf_relocate_section (bfd *output_bfd,
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,
+ ? _("%B(%A+0x%lx): %s used with TLS symbol %s")
+ : _("%B(%A+0x%lx): %s used with non-TLS symbol %s"),
+ input_bfd,
+ input_section,
(long) rel->r_offset,
ppc64_elf_howto_table[r_type]->name,
sym_name);
@@ -7622,10 +10047,10 @@ ppc64_elf_relocate_section (bfd *output_bfd,
&& (tls_mask & TLS_TPREL) == 0)
{
toctprel:
- insn = bfd_get_32 (output_bfd, contents + rel->r_offset - 2);
+ insn = bfd_get_32 (output_bfd, contents + rel->r_offset - d_offset);
insn &= 31 << 21;
insn |= 0x3c0d0000; /* addis 0,13,0 */
- bfd_put_32 (output_bfd, insn, contents + rel->r_offset - 2);
+ bfd_put_32 (output_bfd, insn, contents + rel->r_offset - d_offset);
r_type = R_PPC64_TPREL16_HA;
if (toc_symndx != 0)
{
@@ -7677,8 +10102,8 @@ ppc64_elf_relocate_section (bfd *output_bfd,
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;
+ PPC64_TPREL16_LO which is at low-order half-word. */
+ rel->r_offset += d_offset;
r_type = R_PPC64_TPREL16_LO;
if (toc_symndx != 0)
{
@@ -7711,7 +10136,7 @@ ppc64_elf_relocate_section (bfd *output_bfd,
else
{
bfd_put_32 (output_bfd, NOP, contents + rel->r_offset);
- rel->r_offset -= 2;
+ rel->r_offset -= d_offset;
r_type = R_PPC64_NONE;
}
rel->r_info = ELF64_R_INFO (r_symndx, r_type);
@@ -7753,13 +10178,14 @@ ppc64_elf_relocate_section (bfd *output_bfd,
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)
+ if (h2 == NULL || (h2 != &htab->tls_get_addr->elf
+ && h2 != &htab->tls_get_addr_fd->elf))
break;
/* OK, it checks out. Replace the call. */
offset = rel[1].r_offset;
insn1 = bfd_get_32 (output_bfd,
- contents + rel->r_offset - 2);
+ contents + rel->r_offset - d_offset);
insn3 = bfd_get_32 (output_bfd,
contents + offset + 4);
if ((tls_mask & tls_gd) != 0)
@@ -7794,7 +10220,7 @@ ppc64_elf_relocate_section (bfd *output_bfd,
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;
+ rel[1].r_offset += d_offset;
}
if (insn3 == NOP
|| insn3 == CROR_151515 || insn3 == CROR_313131)
@@ -7803,7 +10229,7 @@ ppc64_elf_relocate_section (bfd *output_bfd,
insn2 = NOP;
rel[1].r_offset += 4;
}
- bfd_put_32 (output_bfd, insn1, contents + rel->r_offset - 2);
+ bfd_put_32 (output_bfd, insn1, contents + rel->r_offset - d_offset);
bfd_put_32 (output_bfd, insn2, contents + offset);
bfd_put_32 (output_bfd, insn3, contents + offset + 4);
if (tls_gd == 0 || toc_symndx != 0)
@@ -7857,6 +10283,8 @@ ppc64_elf_relocate_section (bfd *output_bfd,
/* Handle other relocations that tweak non-addend part of insn. */
insn = 0;
+ max_br_offset = 1 << 25;
+ addend = rel->r_addend;
switch (r_type)
{
default:
@@ -7873,31 +10301,11 @@ ppc64_elf_relocate_section (bfd *output_bfd,
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;
- }
+ /* Fall thru. */
- bfd_put_32 (output_bfd, insn, contents + rel->r_offset);
- break;
+ case R_PPC64_REL14:
+ max_br_offset = 1 << 15;
+ /* Fall thru. */
case R_PPC64_REL24:
/* Calls to functions with a different TOC, such as calls to
@@ -7906,11 +10314,15 @@ ppc64_elf_relocate_section (bfd *output_bfd,
linkage stubs needs to be followed by a nop, as the nop
will be replaced with an instruction to restore the TOC
base pointer. */
+ stub_entry = NULL;
+ fdh = h;
if (((h != NULL
- && (fdh = ((struct ppc_link_hash_entry *) h)->oh) != NULL
- && fdh->plt.plist != NULL)
- || ((fdh = h, sec) != NULL
+ && (((fdh = h->oh) != NULL
+ && fdh->elf.plt.plist != NULL)
+ || (fdh = h)->elf.plt.plist != NULL))
+ || (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, fdh,
@@ -7919,17 +10331,18 @@ ppc64_elf_relocate_section (bfd *output_bfd,
|| stub_entry->stub_type == ppc_stub_plt_branch_r2off
|| stub_entry->stub_type == ppc_stub_long_branch_r2off))
{
- bfd_boolean can_plt_call = 0;
+ bfd_boolean can_plt_call = FALSE;
- if (rel->r_offset + 8 <= input_section->_cooked_size)
+ if (rel->r_offset + 8 <= input_section->size)
{
- insn = bfd_get_32 (input_bfd, contents + rel->r_offset + 4);
- if (insn == NOP
- || insn == CROR_151515 || insn == CROR_313131)
+ unsigned long nop;
+ nop = bfd_get_32 (input_bfd, contents + rel->r_offset + 4);
+ if (nop == NOP
+ || nop == CROR_151515 || nop == CROR_313131)
{
bfd_put_32 (input_bfd, LD_R2_40R1,
contents + rel->r_offset + 4);
- can_plt_call = 1;
+ can_plt_call = TRUE;
}
}
@@ -7938,17 +10351,22 @@ ppc64_elf_relocate_section (bfd *output_bfd,
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;
+ and link, don't require a nop. However, don't
+ allow tail calls in a shared library as they
+ will result in r2 being corrupted. */
+ unsigned long br;
+ br = bfd_get_32 (input_bfd, contents + rel->r_offset);
+ if (info->executable && (br & 1) == 0)
+ can_plt_call = TRUE;
+ else
+ stub_entry = NULL;
}
else if (h != NULL
- && strcmp (h->root.root.string,
+ && strcmp (h->elf.root.root.string,
".__libc_start_main") == 0)
{
/* Allow crt1 branch to go via a toc adjusting stub. */
- can_plt_call = 1;
+ can_plt_call = TRUE;
}
else
{
@@ -7957,21 +10375,21 @@ ppc64_elf_relocate_section (bfd *output_bfd,
|| strcmp (input_section->output_section->name,
".fini") == 0)
(*_bfd_error_handler)
- (_("%s(%s+0x%lx): automatic multiple TOCs "
+ (_("%B(%A+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,
+ input_bfd,
+ input_section,
(long) rel->r_offset);
else
(*_bfd_error_handler)
- (_("%s(%s+0x%lx): sibling call optimization to `%s' "
+ (_("%B(%A+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,
+ input_bfd,
+ input_section,
(long) rel->r_offset,
sym_name,
sym_name);
@@ -7980,51 +10398,97 @@ ppc64_elf_relocate_section (bfd *output_bfd,
}
}
- if (can_plt_call)
+ if (can_plt_call
+ && stub_entry->stub_type == ppc_stub_plt_call)
+ unresolved_reloc = FALSE;
+ }
+
+ if (stub_entry == NULL
+ && get_opd_info (sec) != NULL)
+ {
+ /* The branch destination is the value of the opd entry. */
+ bfd_vma off = (relocation + addend
+ - sec->output_section->vma
+ - sec->output_offset);
+ bfd_vma dest = opd_entry_value (sec, off, NULL, NULL);
+ if (dest != (bfd_vma) -1)
{
- 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;
+ relocation = dest;
+ addend = 0;
+ }
+ }
+
+ /* If the branch is out of reach we ought to have a long
+ branch stub. */
+ from = (rel->r_offset
+ + input_section->output_offset
+ + input_section->output_section->vma);
+
+ if (stub_entry == NULL
+ && (relocation + addend - from + max_br_offset
+ >= 2 * max_br_offset)
+ && r_type != R_PPC64_ADDR14_BRTAKEN
+ && r_type != R_PPC64_ADDR14_BRNTAKEN)
+ stub_entry = ppc_get_stub_entry (input_section, sec, h, rel,
+ htab);
+
+ if (stub_entry != 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;
+ }
+
+ if (insn != 0)
+ {
+ 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
+ {
+ /* Invert 'y' bit if not the default. */
+ if ((bfd_signed_vma) (relocation + addend - from) < 0)
+ insn ^= 0x01 << 21;
}
+
+ bfd_put_32 (output_bfd, insn, contents + rel->r_offset);
}
- if (h != NULL
- && h->root.type == bfd_link_hash_undefweak
- && relocation == 0
- && rel->r_addend == 0)
+ /* NOP out calls to undefined weak functions.
+ We can thus call a weak function without first
+ checking whether the function is defined. */
+ else if (h != NULL
+ && h->elf.root.type == bfd_link_hash_undefweak
+ && r_type == R_PPC64_REL24
+ && relocation == 0
+ && 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;
+ bfd_put_32 (output_bfd, NOP, contents + rel->r_offset);
+ continue;
}
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);
+ (_("%B: unknown relocation type %d for symbol %s"),
+ input_bfd, (int) r_type, sym_name);
bfd_set_error (bfd_error_bad_value);
ret = FALSE;
@@ -8085,7 +10549,7 @@ ppc64_elf_relocate_section (bfd *output_bfd,
if (tls_type == (TLS_TLS | TLS_LD)
&& (h == NULL
- || !(h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC)))
+ || !h->elf.def_dynamic))
offp = &ppc64_tlsld_got (input_bfd)->offset;
else
{
@@ -8094,9 +10558,10 @@ ppc64_elf_relocate_section (bfd *output_bfd,
if (h != NULL)
{
bfd_boolean dyn = htab->elf.dynamic_sections_created;
- if (!WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, info->shared, h)
+ if (!WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, info->shared,
+ &h->elf)
|| (info->shared
- && SYMBOL_REFERENCES_LOCAL (info, h)))
+ && SYMBOL_REFERENCES_LOCAL (info, &h->elf)))
/* 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
@@ -8104,10 +10569,10 @@ ppc64_elf_relocate_section (bfd *output_bfd,
;
else
{
- indx = h->dynindx;
+ indx = h->elf.dynindx;
unresolved_reloc = FALSE;
}
- ent = h->got.glist;
+ ent = h->elf.got.glist;
}
else
{
@@ -8117,7 +10582,7 @@ ppc64_elf_relocate_section (bfd *output_bfd,
}
for (; ent != NULL; ent = ent->next)
- if (ent->addend == rel->r_addend
+ if (ent->addend == orig_addend
&& ent->owner == input_bfd
&& ent->tls_type == tls_type)
break;
@@ -8146,13 +10611,13 @@ ppc64_elf_relocate_section (bfd *output_bfd,
*offp = off | 1;
if ((info->shared || indx != 0)
&& (h == NULL
- || ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
- || h->root.type != bfd_link_hash_undefweak))
+ || ELF_ST_VISIBILITY (h->elf.other) == STV_DEFAULT
+ || h->elf.root.type != bfd_link_hash_undefweak))
{
outrel.r_offset = (got->output_section->vma
+ got->output_offset
+ off);
- outrel.r_addend = rel->r_addend;
+ outrel.r_addend = addend;
if (tls_type & (TLS_LD | TLS_GD))
{
outrel.r_addend = 0;
@@ -8165,7 +10630,7 @@ ppc64_elf_relocate_section (bfd *output_bfd,
bfd_elf64_swap_reloca_out (output_bfd,
&outrel, loc);
outrel.r_offset += 8;
- outrel.r_addend = rel->r_addend;
+ outrel.r_addend = addend;
outrel.r_info
= ELF64_R_INFO (indx, R_PPC64_DTPREL64);
}
@@ -8203,7 +10668,7 @@ ppc64_elf_relocate_section (bfd *output_bfd,
emitting a reloc. */
else
{
- relocation += rel->r_addend;
+ relocation += addend;
if (tls_type == (TLS_TLS | TLS_LD))
relocation = 1;
else if (tls_type != 0)
@@ -8255,8 +10720,8 @@ ppc64_elf_relocate_section (bfd *output_bfd,
if (htab->plt != NULL)
{
struct plt_entry *ent;
- for (ent = h->plt.plist; ent != NULL; ent = ent->next)
- if (ent->addend == rel->r_addend
+ for (ent = h->elf.plt.plist; ent != NULL; ent = ent->next)
+ if (ent->addend == orig_addend
&& ent->plt.offset != (bfd_vma) -1)
{
relocation = (htab->plt->output_section->vma
@@ -8278,7 +10743,7 @@ ppc64_elf_relocate_section (bfd *output_bfd,
relocation += htab->stub_group[sec->id].toc_off;
else
unresolved_reloc = TRUE;
- goto dodyn2;
+ goto dodyn;
/* TOC16 relocs. We want the offset relative to the TOC base,
which is the address of the start of the TOC plus 0x8000.
@@ -8378,15 +10843,7 @@ ppc64_elf_relocate_section (bfd *output_bfd,
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;
@@ -8395,17 +10852,17 @@ ppc64_elf_relocate_section (bfd *output_bfd,
if ((info->shared
&& (h == NULL
- || ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
- || h->root.type != bfd_link_hash_undefweak)
+ || ELF_ST_VISIBILITY (h->elf.other) == STV_DEFAULT
+ || h->elf.root.type != bfd_link_hash_undefweak)
&& (MUST_BE_DYN_RELOC (r_type)
- || !SYMBOL_CALLS_LOCAL (info, h)))
+ || !SYMBOL_CALLS_LOCAL (info, &h->elf)))
|| (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->elf.dynindx != -1
+ && !h->elf.non_got_ref
+ && h->elf.def_dynamic
+ && !h->elf.def_regular))
{
Elf_Internal_Rela outrel;
bfd_boolean skip, relocate;
@@ -8444,10 +10901,10 @@ ppc64_elf_relocate_section (bfd *output_bfd,
if (skip)
memset (&outrel, 0, sizeof outrel);
- else if (!SYMBOL_REFERENCES_LOCAL (info, h)
+ else if (!SYMBOL_REFERENCES_LOCAL (info, &h->elf)
&& !is_opd
&& r_type != R_PPC64_TOC)
- outrel.r_info = ELF64_R_INFO (h->dynindx, r_type);
+ outrel.r_info = ELF64_R_INFO (h->elf.dynindx, r_type);
else
{
/* This symbol is local, or marked to become local,
@@ -8496,6 +10953,17 @@ ppc64_elf_relocate_section (bfd *output_bfd,
osec = sec->output_section;
indx = elf_section_data (osec)->dynindx;
+ if (indx == 0)
+ {
+ if ((osec->flags & SEC_READONLY) == 0
+ && htab->elf.data_index_section != NULL)
+ osec = htab->elf.data_index_section;
+ else
+ osec = htab->elf.text_index_section;
+ indx = elf_section_data (osec)->dynindx;
+ }
+ BFD_ASSERT (indx != 0);
+
/* We are turning this relocation into one
against a section symbol, so subtract out
the output section's address but not the
@@ -8512,6 +10980,9 @@ ppc64_elf_relocate_section (bfd *output_bfd,
if (sreloc == NULL)
abort ();
+ if (sreloc->reloc_count * sizeof (Elf64_External_Rela)
+ >= sreloc->size)
+ abort ();
loc = sreloc->contents;
loc += sreloc->reloc_count++ * sizeof (Elf64_External_Rela);
bfd_elf64_swap_reloca_out (output_bfd, &outrel, loc);
@@ -8563,8 +11034,8 @@ ppc64_elf_relocate_section (bfd *output_bfd,
/* These ones haven't been implemented yet. */
(*_bfd_error_handler)
- (_("%s: relocation %s is not supported for symbol %s."),
- bfd_archive_filename (input_bfd),
+ (_("%B: relocation %s is not supported for symbol %s."),
+ input_bfd,
ppc64_elf_howto_table[r_type]->name, sym_name);
bfd_set_error (bfd_error_invalid_operation);
@@ -8581,17 +11052,10 @@ ppc64_elf_relocate_section (bfd *output_bfd,
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:
@@ -8604,10 +11068,20 @@ ppc64_elf_relocate_section (bfd *output_bfd,
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;
+ if (sec == NULL)
+ break;
+ /* Fall thru */
+
+ case R_PPC64_GOT16_HA:
+ case R_PPC64_PLTGOT16_HA:
+ case R_PPC64_PLT16_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:
+ /* Add 0x10000 if sign bit in 0:15 is set.
+ Bits 0:15 are not used. */
+ addend += 0x8000;
break;
case R_PPC64_ADDR16_DS:
@@ -8642,8 +11116,8 @@ ppc64_elf_relocate_section (bfd *output_bfd,
if (((relocation + addend) & mask) != 0)
{
(*_bfd_error_handler)
- (_("%s: error: relocation %s not a multiple of %d"),
- bfd_archive_filename (input_bfd),
+ (_("%B: error: relocation %s not a multiple of %d"),
+ input_bfd,
ppc64_elf_howto_table[r_type]->name,
mask + 1);
bfd_set_error (bfd_error_bad_value);
@@ -8651,40 +11125,6 @@ ppc64_elf_relocate_section (bfd *output_bfd,
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
@@ -8692,15 +11132,15 @@ ppc64_elf_relocate_section (bfd *output_bfd,
not process them. */
if (unresolved_reloc
&& !((input_section->flags & SEC_DEBUGGING) != 0
- && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) != 0))
+ && h->elf.def_dynamic))
{
(*_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),
+ (_("%B(%A+0x%lx): unresolvable %s relocation against symbol `%s'"),
+ input_bfd,
+ input_section,
(long) rel->r_offset,
ppc64_elf_howto_table[(int) r_type]->name,
- h->root.root.string);
+ h->elf.root.root.string);
ret = FALSE;
}
@@ -8721,7 +11161,7 @@ ppc64_elf_relocate_section (bfd *output_bfd,
if (warned)
continue;
if (h != NULL
- && h->root.type == bfd_link_hash_undefweak
+ && h->elf.root.type == bfd_link_hash_undefweak
&& ppc64_elf_howto_table[r_type]->pc_relative)
{
/* Assume this is a call protected by other code that
@@ -8734,16 +11174,17 @@ ppc64_elf_relocate_section (bfd *output_bfd,
}
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)))
+ (info, (h ? &h->elf.root : NULL), sym_name,
+ ppc64_elf_howto_table[r_type]->name,
+ orig_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),
+ (_("%B(%A+0x%lx): %s reloc against `%s': error %d"),
+ input_bfd,
+ input_section,
(long) rel->r_offset,
ppc64_elf_howto_table[r_type]->name,
sym_name,
@@ -8753,6 +11194,22 @@ ppc64_elf_relocate_section (bfd *output_bfd,
}
}
+ /* If we're emitting relocations, then shortly after this function
+ returns, reloc offsets and addends for this section will be
+ adjusted. Worse, reloc symbol indices will be for the output
+ file rather than the input. Save a copy of the relocs for
+ opd_entry_value. */
+ if (is_opd && (info->emitrelocations || info->relocatable))
+ {
+ bfd_size_type amt;
+ amt = input_section->reloc_count * sizeof (Elf_Internal_Rela);
+ rel = bfd_alloc (input_bfd, amt);
+ BFD_ASSERT (ppc64_elf_tdata (input_bfd)->opd_relocs == NULL);
+ ppc64_elf_tdata (input_bfd)->opd_relocs = rel;
+ if (rel == NULL)
+ return FALSE;
+ memcpy (rel, relocs, amt);
+ }
return ret;
}
@@ -8765,20 +11222,25 @@ ppc64_elf_output_symbol_hook (struct bfd_link_info *info,
asection *input_sec,
struct elf_link_hash_entry *h)
{
- long *adjust;
+ long *opd_adjust, 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)
+ if (h != NULL)
+ return TRUE;
+
+ opd_adjust = get_opd_info (input_sec);
+ if (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];
+ adjust = opd_adjust[value / 8];
+ if (adjust == -1)
+ elfsym->st_value = 0;
+ else
+ elfsym->st_value += adjust;
return TRUE;
}
@@ -8792,44 +11254,38 @@ ppc64_elf_finish_dynamic_symbol (bfd *output_bfd,
Elf_Internal_Sym *sym)
{
struct ppc_link_hash_table *htab;
- bfd *dynobj;
+ struct plt_entry *ent;
+ Elf_Internal_Rela rela;
+ bfd_byte *loc;
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);
- }
- }
+ 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)
+ if (h->needs_copy)
{
Elf_Internal_Rela rela;
bfd_byte *loc;
@@ -8903,7 +11359,7 @@ ppc64_elf_finish_dynamic_sections (bfd *output_bfd,
abort ();
dyncon = (Elf64_External_Dyn *) sdyn->contents;
- dynconend = (Elf64_External_Dyn *) (sdyn->contents + sdyn->_raw_size);
+ dynconend = (Elf64_External_Dyn *) (sdyn->contents + sdyn->size);
for (; dyncon < dynconend; dyncon++)
{
Elf_Internal_Dyn dyn;
@@ -8937,7 +11393,7 @@ ppc64_elf_finish_dynamic_sections (bfd *output_bfd,
s = bfd_get_section_by_name (output_bfd, ".opd");
if (s == NULL)
continue;
- dyn.d_un.d_val = s->_raw_size;
+ dyn.d_un.d_val = s->size;
break;
case DT_PLTGOT:
@@ -8951,7 +11407,7 @@ ppc64_elf_finish_dynamic_sections (bfd *output_bfd,
break;
case DT_PLTRELSZ:
- dyn.d_un.d_val = htab->relplt->_raw_size;
+ dyn.d_un.d_val = htab->relplt->size;
break;
case DT_RELASZ:
@@ -8960,7 +11416,7 @@ ppc64_elf_finish_dynamic_sections (bfd *output_bfd,
s = htab->relplt;
if (s == NULL)
continue;
- dyn.d_un.d_val -= s->_raw_size;
+ dyn.d_un.d_val -= s->size;
break;
case DT_RELA:
@@ -8972,7 +11428,7 @@ ppc64_elf_finish_dynamic_sections (bfd *output_bfd,
continue;
if (dyn.d_un.d_ptr != s->output_section->vma + s->output_offset)
continue;
- dyn.d_un.d_ptr += s->_raw_size;
+ dyn.d_un.d_ptr += s->size;
break;
}
@@ -8980,7 +11436,7 @@ ppc64_elf_finish_dynamic_sections (bfd *output_bfd,
}
}
- if (htab->got != NULL && htab->got->_raw_size != 0)
+ if (htab->got != NULL && htab->got->size != 0)
{
/* Fill in the first entry in the global offset table.
We use it to hold the link-time TOCbase. */
@@ -8992,37 +11448,49 @@ ppc64_elf_finish_dynamic_sections (bfd *output_bfd,
elf_section_data (htab->got->output_section)->this_hdr.sh_entsize = 8;
}
- if (htab->plt != NULL && htab->plt->_raw_size != 0)
+ if (htab->plt != NULL && htab->plt->size != 0)
{
/* Set .plt entry size. */
elf_section_data (htab->plt->output_section)->this_hdr.sh_entsize
= PLT_ENTRY_SIZE;
}
+ /* brlt is SEC_LINKER_CREATED, so we need to write out relocs for
+ brlt ourselves if emitrelocations. */
+ if (htab->brlt != NULL
+ && htab->brlt->reloc_count != 0
+ && !_bfd_elf_link_output_relocs (output_bfd,
+ htab->brlt,
+ &elf_section_data (htab->brlt)->rel_hdr,
+ elf_section_data (htab->brlt)->relocs,
+ NULL))
+ return FALSE;
+
/* We need to handle writing out multiple GOT sections ourselves,
- since we didn't add them to DYNOBJ. */
+ since we didn't add them to DYNOBJ. We know dynobj is the first
+ bfd. */
while ((dynobj = dynobj->link_next) != NULL)
{
asection *s;
- if (bfd_get_flavour (dynobj) != bfd_target_elf_flavour)
+ if (!is_ppc64_elf_target (dynobj->xvec))
continue;
s = ppc64_elf_tdata (dynobj)->got;
if (s != NULL
- && s->_raw_size != 0
+ && s->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))
+ s->size))
return FALSE;
s = ppc64_elf_tdata (dynobj)->relgot;
if (s != NULL
- && s->_raw_size != 0
+ && s->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))
+ s->size))
return FALSE;
}
diff --git a/contrib/binutils/bfd/elf64-ppc.h b/contrib/binutils/bfd/elf64-ppc.h
index 998e7e1..a27e93e 100644
--- a/contrib/binutils/bfd/elf64-ppc.h
+++ b/contrib/binutils/bfd/elf64-ppc.h
@@ -1,5 +1,5 @@
/* PowerPC64-specific support for 64-bit ELF.
- Copyright 2002, 2003 Free Software Foundation, Inc.
+ Copyright 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@@ -15,22 +15,22 @@ 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. */
+Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, 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 *);
+ (bfd *, struct bfd_link_info *, bfd_boolean, bfd_boolean);
asection *ppc64_elf_tls_setup
(bfd *, struct bfd_link_info *);
bfd_boolean ppc64_elf_tls_optimize
(bfd *, struct bfd_link_info *);
+bfd_boolean ppc64_elf_edit_toc
+ (bfd *, struct bfd_link_info *);
bfd_vma ppc64_elf_toc
(bfd *);
int ppc64_elf_setup_section_lists
- (bfd *, struct bfd_link_info *);
+ (bfd *, struct bfd_link_info *, int);
void ppc64_elf_next_toc_section
(struct bfd_link_info *, asection *);
void ppc64_elf_reinit_toc
@@ -42,3 +42,5 @@ bfd_boolean ppc64_elf_size_stubs
asection *(*) (const char *, asection *), void (*) (void));
bfd_boolean ppc64_elf_build_stubs
(bfd_boolean, struct bfd_link_info *, char **);
+void ppc64_elf_restore_symbols
+ (struct bfd_link_info *info);
diff --git a/contrib/binutils/bfd/elf64-s390.c b/contrib/binutils/bfd/elf64-s390.c
index 63a261a..47fbff6 100644
--- a/contrib/binutils/bfd/elf64-s390.c
+++ b/contrib/binutils/bfd/elf64-s390.c
@@ -1,5 +1,6 @@
/* IBM S/390-specific support for 64-bit ELF
- Copyright 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
+ Copyright 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
+ Free Software Foundation, Inc.
Contributed Martin Schwidefsky (schwidefsky@de.ibm.com).
This file is part of BFD, the Binary File Descriptor library.
@@ -16,11 +17,11 @@
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. */
+ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
+ 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "bfdlink.h"
#include "libbfd.h"
#include "elf-bfd.h"
@@ -40,17 +41,11 @@ static bfd_boolean create_got_section
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 *,
+ PARAMS ((struct bfd_link_info *, 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 *));
@@ -72,8 +67,6 @@ 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
@@ -363,6 +356,27 @@ elf_s390_reloc_type_lookup (abfd, code)
return 0;
}
+static reloc_howto_type *
+elf_s390_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED,
+ const char *r_name)
+{
+ unsigned int i;
+
+ for (i = 0;
+ i < sizeof (elf_howto_table) / sizeof (elf_howto_table[0]);
+ i++)
+ if (elf_howto_table[i].name != NULL
+ && strcasecmp (elf_howto_table[i].name, r_name) == 0)
+ return &elf_howto_table[i];
+
+ if (strcasecmp (elf64_s390_vtinherit_howto.name, r_name) == 0)
+ return &elf64_s390_vtinherit_howto;
+ if (strcasecmp (elf64_s390_vtentry_howto.name, r_name) == 0)
+ return &elf64_s390_vtentry_howto;
+
+ return NULL;
+}
+
/* We need to use ELF64_R_TYPE so we have our own copy of this function,
and elf64-s390.c has its own copy. */
@@ -372,7 +386,8 @@ elf_s390_info_to_howto (abfd, cache_ptr, dst)
arelent *cache_ptr;
Elf_Internal_Rela *dst;
{
- switch (ELF64_R_TYPE(dst->r_info))
+ unsigned int r_type = ELF64_R_TYPE(dst->r_info);
+ switch (r_type)
{
case R_390_GNU_VTINHERIT:
cache_ptr->howto = &elf64_s390_vtinherit_howto;
@@ -383,8 +398,13 @@ elf_s390_info_to_howto (abfd, cache_ptr, dst)
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)];
+ if (r_type >= sizeof (elf_howto_table) / sizeof (elf_howto_table[0]))
+ {
+ (*_bfd_error_handler) (_("%B: invalid relocation type %d"),
+ abfd, (int) r_type);
+ r_type = R_390_NONE;
+ }
+ cache_ptr->howto = &elf_howto_table[r_type];
}
}
@@ -432,7 +452,7 @@ s390_elf_ldisp_reloc (abfd, reloc_entry, symbol, data, input_section,
if (output_bfd != NULL)
return bfd_reloc_continue;
- if (reloc_entry->address > input_section->_cooked_size)
+ if (reloc_entry->address > bfd_get_section_limit (abfd, input_section))
return bfd_reloc_outofrange;
relocation = (symbol->value
@@ -624,14 +644,16 @@ struct elf_s390_obj_tdata
(elf_s390_tdata (abfd)->local_got_tls_type)
static bfd_boolean
-elf_s390_mkobject (abfd)
- bfd *abfd;
+elf_s390_mkobject (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;
+ {
+ 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 bfd_elf_mkobject (abfd);
}
static bfd_boolean
@@ -717,7 +739,8 @@ elf_s390_link_hash_table_create (abfd)
if (ret == NULL)
return NULL;
- if (! _bfd_elf_link_hash_table_init (&ret->elf, abfd, link_hash_newfunc))
+ if (!_bfd_elf_link_hash_table_init (&ret->elf, abfd, link_hash_newfunc,
+ sizeof (struct elf_s390_link_hash_entry)))
{
free (ret);
return NULL;
@@ -755,12 +778,13 @@ create_got_section (dynobj, info)
if (!htab->sgot || !htab->sgotplt)
abort ();
- htab->srelgot = bfd_make_section (dynobj, ".rela.got");
+ htab->srelgot = bfd_make_section_with_flags (dynobj, ".rela.got",
+ (SEC_ALLOC | SEC_LOAD
+ | SEC_HAS_CONTENTS
+ | SEC_IN_MEMORY
+ | SEC_LINKER_CREATED
+ | SEC_READONLY));
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;
@@ -800,8 +824,8 @@ elf_s390_create_dynamic_sections (dynobj, info)
/* 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;
+elf_s390_copy_indirect_symbol (info, dir, ind)
+ struct bfd_link_info *info;
struct elf_link_hash_entry *dir, *ind;
{
struct elf_s390_link_hash_entry *edir, *eind;
@@ -816,10 +840,7 @@ elf_s390_copy_indirect_symbol (bed, dir, ind)
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
+ /* Add reloc counts against the indirect sym to the direct sym
list. Merge any entries against the same section. */
for (pp = &eind->dyn_relocs; (p = *pp) != NULL; )
{
@@ -852,17 +873,18 @@ elf_s390_copy_indirect_symbol (bed, dir, ind)
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));
+ && dir->dynamic_adjusted)
+ {
+ /* If called to transfer flags for a weakdef during processing
+ of elf_adjust_dynamic_symbol, don't copy non_got_ref.
+ We clear it ourselves for ELIMINATE_COPY_RELOCS. */
+ dir->ref_dynamic |= ind->ref_dynamic;
+ dir->ref_regular |= ind->ref_regular;
+ dir->ref_regular_nonweak |= ind->ref_regular_nonweak;
+ dir->needs_plt |= ind->needs_plt;
+ }
else
- _bfd_elf_link_hash_copy_indirect (bed, dir, ind);
+ _bfd_elf_link_hash_copy_indirect (info, dir, ind);
}
static int
@@ -933,8 +955,8 @@ elf_s390_check_relocs (abfd, info, sec, relocs)
if (r_symndx >= NUM_SHDR_ENTRIES (symtab_hdr))
{
- (*_bfd_error_handler) (_("%s: bad symbol index: %d"),
- bfd_archive_filename (abfd),
+ (*_bfd_error_handler) (_("%B: bad symbol index: %d"),
+ abfd,
r_symndx);
return FALSE;
}
@@ -942,7 +964,12 @@ elf_s390_check_relocs (abfd, info, sec, relocs)
if (r_symndx < symtab_hdr->sh_info)
h = NULL;
else
- h = sym_hashes[r_symndx - symtab_hdr->sh_info];
+ {
+ h = sym_hashes[r_symndx - symtab_hdr->sh_info];
+ 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;
+ }
/* Create got section and local_got_refcounts array if they
are needed. */
@@ -1028,7 +1055,7 @@ elf_s390_check_relocs (abfd, info, sec, relocs)
creating a procedure linkage table entry. */
if (h != NULL)
{
- h->elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_PLT;
+ h->needs_plt = 1;
h->plt.refcount += 1;
}
break;
@@ -1050,7 +1077,7 @@ elf_s390_check_relocs (abfd, info, sec, relocs)
if (h != NULL)
{
((struct elf_s390_link_hash_entry *) h)->gotplt_refcount++;
- h->elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_PLT;
+ h->needs_plt = 1;
h->plt.refcount += 1;
}
else
@@ -1119,8 +1146,8 @@ elf_s390_check_relocs (abfd, info, sec, relocs)
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);
+ (_("%B: `%s' accessed both as normal and thread local symbol"),
+ abfd, h->root.root.string);
return FALSE;
}
if (old_tls_type > tls_type)
@@ -1162,7 +1189,7 @@ elf_s390_check_relocs (abfd, info, sec, relocs)
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;
+ h->non_got_ref = 1;
/* We may need a .plt entry if the function this reloc
refers to is in a shared lib. */
@@ -1200,15 +1227,13 @@ elf_s390_check_relocs (abfd, info, sec, relocs)
|| (h != NULL
&& (! info->symbolic
|| h->root.type == bfd_link_hash_defweak
- || (h->elf_link_hash_flags
- & ELF_LINK_HASH_DEF_REGULAR) == 0))))
+ || !h->def_regular))))
|| (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)))
+ || !h->def_regular)))
{
struct elf_s390_dyn_relocs *p;
struct elf_s390_dyn_relocs **head;
@@ -1228,13 +1253,13 @@ elf_s390_check_relocs (abfd, info, sec, relocs)
if (name == NULL)
return FALSE;
- if (strncmp (name, ".rela", 5) != 0
+ if (! CONST_STRNEQ (name, ".rela")
|| strcmp (bfd_get_section_name (abfd, sec),
name + 5) != 0)
{
(*_bfd_error_handler)
- (_("%s: bad relocation section name `%s\'"),
- bfd_archive_filename (abfd), name);
+ (_("%B: bad relocation section name `%s\'"),
+ abfd, name);
}
if (htab->elf.dynobj == NULL)
@@ -1246,13 +1271,14 @@ elf_s390_check_relocs (abfd, info, sec, relocs)
{
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;
+ sreloc = bfd_make_section_with_flags (dynobj,
+ name,
+ flags);
if (sreloc == NULL
- || ! bfd_set_section_flags (dynobj, sreloc, flags)
|| ! bfd_set_section_alignment (dynobj, sreloc, 3))
return FALSE;
}
@@ -1272,13 +1298,15 @@ elf_s390_check_relocs (abfd, info, sec, relocs)
easily. Oh well. */
asection *s;
+ void *vpp;
+
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);
+ vpp = &elf_section_data (s)->local_dynrel;
+ head = (struct elf_s390_dyn_relocs **) vpp;
}
p = *head;
@@ -1332,50 +1360,30 @@ elf_s390_check_relocs (abfd, info, sec, relocs)
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;
+elf_s390_gc_mark_hook (asection *sec,
+ struct bfd_link_info *info,
+ 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;
+ switch (ELF64_R_TYPE (rel->r_info))
+ {
+ case R_390_GNU_VTINHERIT:
+ case R_390_GNU_VTENTRY:
+ return NULL;
+ }
+
+ return _bfd_elf_gc_mark_hook (sec, info, rel, h, sym);
}
/* 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_s390_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;
@@ -1403,6 +1411,9 @@ elf_s390_gc_sweep_hook (abfd, info, sec, relocs)
struct elf_s390_dyn_relocs *p;
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;
eh = (struct elf_s390_link_hash_entry *) h;
for (pp = &eh->dyn_relocs; (p = *pp) != NULL; pp = &p->next)
@@ -1546,18 +1557,17 @@ elf_s390_adjust_dynamic_symbol (info, 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)
+ || h->needs_plt)
{
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->def_dynamic
+ && !h->ref_dynamic
&& h->root.type != bfd_link_hash_undefweak
&& h->root.type != bfd_link_hash_undefined))
{
@@ -1567,7 +1577,7 @@ elf_s390_adjust_dynamic_symbol (info, h)
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;
+ h->needs_plt = 0;
elf_s390_adjust_gotplt((struct elf_s390_link_hash_entry *) h);
}
@@ -1584,16 +1594,14 @@ elf_s390_adjust_dynamic_symbol (info, h)
/* 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)
+ if (h->u.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;
+ BFD_ASSERT (h->u.weakdef->root.type == bfd_link_hash_defined
+ || h->u.weakdef->root.type == bfd_link_hash_defweak);
+ h->root.u.def.section = h->u.weakdef->root.u.def.section;
+ h->root.u.def.value = h->u.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));
+ h->non_got_ref = h->u.weakdef->non_got_ref;
return TRUE;
}
@@ -1609,13 +1617,13 @@ elf_s390_adjust_dynamic_symbol (info, h)
/* 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)
+ if (!h->non_got_ref)
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;
+ h->non_got_ref = 0;
return TRUE;
}
@@ -1636,11 +1644,18 @@ elf_s390_adjust_dynamic_symbol (info, h)
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;
+ h->non_got_ref = 0;
return TRUE;
}
}
+ if (h->size == 0)
+ {
+ (*_bfd_error_handler) (_("dynamic variable `%s' is zero size"),
+ h->root.root.string);
+ 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
@@ -1658,33 +1673,13 @@ elf_s390_adjust_dynamic_symbol (info, h)
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;
+ htab->srelbss->size += sizeof (Elf64_External_Rela);
+ h->needs_copy = 1;
}
- /* 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;
+ return _bfd_elf_adjust_dynamic_copy (h, s);
}
/* Allocate space in .plt, .got and associated reloc sections for
@@ -1720,7 +1715,7 @@ allocate_dynrelocs (h, inf)
/* Make sure this symbol is output as a dynamic symbol.
Undefined weak syms won't yet be marked as dynamic. */
if (h->dynindx == -1
- && (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0)
+ && !h->forced_local)
{
if (! bfd_elf_link_record_dynamic_symbol (info, h))
return FALSE;
@@ -1733,10 +1728,10 @@ allocate_dynrelocs (h, inf)
/* 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;
+ if (s->size == 0)
+ s->size += PLT_FIRST_ENTRY_SIZE;
- h->plt.offset = s->_raw_size;
+ h->plt.offset = s->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
@@ -1744,33 +1739,33 @@ allocate_dynrelocs (h, inf)
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->def_regular)
{
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;
+ s->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;
+ htab->sgotplt->size += GOT_ENTRY_SIZE;
/* We also need to make an entry in the .rela.plt section. */
- htab->srelplt->_raw_size += sizeof (Elf64_External_Rela);
+ htab->srelplt->size += sizeof (Elf64_External_Rela);
}
else
{
h->plt.offset = (bfd_vma) -1;
- h->elf_link_hash_flags &= ~ELF_LINK_HASH_NEEDS_PLT;
+ h->needs_plt = 0;
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;
+ h->needs_plt = 0;
elf_s390_adjust_gotplt((struct elf_s390_link_hash_entry *) h);
}
@@ -1788,8 +1783,8 @@ allocate_dynrelocs (h, inf)
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;
+ h->got.offset = htab->sgot->size;
+ htab->sgot->size += GOT_ENTRY_SIZE;
}
else
h->got.offset = (bfd_vma) -1;
@@ -1803,31 +1798,31 @@ allocate_dynrelocs (h, inf)
/* Make sure this symbol is output as a dynamic symbol.
Undefined weak syms won't yet be marked as dynamic. */
if (h->dynindx == -1
- && (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0)
+ && !h->forced_local)
{
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;
+ h->got.offset = s->size;
+ s->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;
+ s->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);
+ htab->srelgot->size += sizeof (Elf64_External_Rela);
else if (tls_type == GOT_TLS_GD)
- htab->srelgot->_raw_size += 2 * sizeof (Elf64_External_Rela);
+ htab->srelgot->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);
+ htab->srelgot->size += sizeof (Elf64_External_Rela);
}
else
h->got.offset = (bfd_vma) -1;
@@ -1861,9 +1856,21 @@ allocate_dynrelocs (h, inf)
/* Also discard relocs on undefined weak syms with non-default
visibility. */
- if (ELF_ST_VISIBILITY (h->other) != STV_DEFAULT
+ if (eh->dyn_relocs != NULL
&& h->root.type == bfd_link_hash_undefweak)
- eh->dyn_relocs = NULL;
+ {
+ if (ELF_ST_VISIBILITY (h->other) != STV_DEFAULT)
+ eh->dyn_relocs = NULL;
+
+ /* Make sure undefined weak symbols are output as a dynamic
+ symbol in PIEs. */
+ else if (h->dynindx == -1
+ && !h->forced_local)
+ {
+ if (! bfd_elf_link_record_dynamic_symbol (info, h))
+ return FALSE;
+ }
+ }
}
else if (ELIMINATE_COPY_RELOCS)
{
@@ -1871,9 +1878,9 @@ allocate_dynrelocs (h, inf)
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)
+ if (!h->non_got_ref
+ && ((h->def_dynamic
+ && !h->def_regular)
|| (htab->elf.dynamic_sections_created
&& (h->root.type == bfd_link_hash_undefweak
|| h->root.type == bfd_link_hash_undefined))))
@@ -1881,7 +1888,7 @@ allocate_dynrelocs (h, inf)
/* Make sure this symbol is output as a dynamic symbol.
Undefined weak syms won't yet be marked as dynamic. */
if (h->dynindx == -1
- && (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0)
+ && !h->forced_local)
{
if (! bfd_elf_link_record_dynamic_symbol (info, h))
return FALSE;
@@ -1902,7 +1909,7 @@ allocate_dynrelocs (h, inf)
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);
+ sreloc->size += p->count * sizeof (Elf64_External_Rela);
}
return TRUE;
@@ -1965,7 +1972,7 @@ elf_s390_size_dynamic_sections (output_bfd, info)
s = bfd_get_section_by_name (dynobj, ".interp");
if (s == NULL)
abort ();
- s->_raw_size = sizeof ELF_DYNAMIC_INTERPRETER;
+ s->size = sizeof ELF_DYNAMIC_INTERPRETER;
s->contents = (unsigned char *) ELF_DYNAMIC_INTERPRETER;
}
}
@@ -1988,10 +1995,7 @@ elf_s390_size_dynamic_sections (output_bfd, info)
{
struct elf_s390_dyn_relocs *p;
- for (p = *((struct elf_s390_dyn_relocs **)
- &elf_section_data (s)->local_dynrel);
- p != NULL;
- p = p->next)
+ for (p = 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))
@@ -2004,7 +2008,7 @@ elf_s390_size_dynamic_sections (output_bfd, info)
else if (p->count != 0)
{
srela = elf_section_data (p->sec)->sreloc;
- srela->_raw_size += p->count * sizeof (Elf64_External_Rela);
+ srela->size += p->count * sizeof (Elf64_External_Rela);
if ((p->sec->output_section->flags & SEC_READONLY) != 0)
info->flags |= DF_TEXTREL;
}
@@ -2025,12 +2029,12 @@ elf_s390_size_dynamic_sections (output_bfd, info)
{
if (*local_got > 0)
{
- *local_got = s->_raw_size;
- s->_raw_size += GOT_ENTRY_SIZE;
+ *local_got = s->size;
+ s->size += GOT_ENTRY_SIZE;
if (*local_tls_type == GOT_TLS_GD)
- s->_raw_size += GOT_ENTRY_SIZE;
+ s->size += GOT_ENTRY_SIZE;
if (info->shared)
- srela->_raw_size += sizeof (Elf64_External_Rela);
+ srela->size += sizeof (Elf64_External_Rela);
}
else
*local_got = (bfd_vma) -1;
@@ -2041,9 +2045,9 @@ elf_s390_size_dynamic_sections (output_bfd, info)
{
/* 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);
+ htab->tls_ldm_got.offset = htab->sgot->size;
+ htab->sgot->size += 2 * GOT_ENTRY_SIZE;
+ htab->srelgot->size += sizeof (Elf64_External_Rela);
}
else
htab->tls_ldm_got.offset = -1;
@@ -2062,14 +2066,15 @@ elf_s390_size_dynamic_sections (output_bfd, info)
if (s == htab->splt
|| s == htab->sgot
- || s == htab->sgotplt)
+ || s == htab->sgotplt
+ || s == htab->sdynbss)
{
/* 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)
+ else if (CONST_STRNEQ (bfd_get_section_name (dynobj, s), ".rela"))
{
- if (s->_raw_size != 0 && s != htab->srelplt)
+ if (s->size != 0 && s != htab->srelplt)
relocs = TRUE;
/* We use the reloc_count field as a counter if we need
@@ -2082,7 +2087,7 @@ elf_s390_size_dynamic_sections (output_bfd, info)
continue;
}
- if (s->_raw_size == 0)
+ if (s->size == 0)
{
/* If we don't need this section, strip it from the
output file. This is to handle .rela.bss and
@@ -2094,16 +2099,19 @@ elf_s390_size_dynamic_sections (output_bfd, info)
function which decides whether anything needs to go
into these sections. */
- _bfd_strip_section_from_output (info, s);
+ s->flags |= SEC_EXCLUDE;
continue;
}
+ if ((s->flags & SEC_HAS_CONTENTS) == 0)
+ 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);
+ s->contents = (bfd_byte *) bfd_zalloc (dynobj, s->size);
if (s->contents == NULL)
return FALSE;
}
@@ -2124,7 +2132,7 @@ elf_s390_size_dynamic_sections (output_bfd, info)
return FALSE;
}
- if (htab->splt->_raw_size != 0)
+ if (htab->splt->size != 0)
{
if (!add_dynamic_entry (DT_PLTGOT, 0)
|| !add_dynamic_entry (DT_PLTRELSZ, 0)
@@ -2201,11 +2209,12 @@ invalid_tls_insn (input_bfd, input_section, rel)
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),
+ (_("%B(%A+0x%lx): invalid instruction for TLS relocation %s"),
+ input_bfd,
+ input_section,
(long) rel->r_offset,
howto->name);
+ bfd_set_error (bfd_error_bad_value);
}
/* Relocate a 390 ELF section. */
@@ -2229,9 +2238,6 @@ elf_s390_relocate_section (output_bfd, info, input_bfd, input_section,
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);
@@ -2266,7 +2272,6 @@ elf_s390_relocate_section (output_bfd, info, input_bfd, input_section,
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;
@@ -2287,6 +2292,20 @@ elf_s390_relocate_section (output_bfd, info, input_bfd, input_section,
unresolved_reloc, warned);
}
+ if (sec != NULL && elf_discarded_section (sec))
+ {
+ /* For relocs against symbols from removed linkonce sections,
+ or sections discarded by a linker script, we just want the
+ section contents zeroed. Avoid any special processing. */
+ _bfd_clear_contents (howto, input_bfd, contents + rel->r_offset);
+ rel->r_info = 0;
+ rel->r_addend = 0;
+ continue;
+ }
+
+ if (info->relocatable)
+ continue;
+
switch (r_type)
{
case R_390_GOTPLT12:
@@ -2345,8 +2364,8 @@ elf_s390_relocate_section (output_bfd, info, input_bfd, input_section,
|| (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))
+ || h->forced_local)
+ && h->def_regular)
|| (ELF_ST_VISIBILITY (h->other)
&& h->root.type == bfd_link_hash_undefweak))
{
@@ -2510,11 +2529,7 @@ elf_s390_relocate_section (output_bfd, info, input_bfd, input_section,
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)
+ if ((input_section->flags & SEC_ALLOC) == 0)
break;
if ((info->shared
@@ -2532,11 +2547,9 @@ elf_s390_relocate_section (output_bfd, info, input_bfd, input_section,
&& !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->non_got_ref
+ && ((h->def_dynamic
+ && !h->def_regular)
|| h->root.type == bfd_link_hash_undefweak
|| h->root.type == bfd_link_hash_undefined)))
{
@@ -2573,8 +2586,7 @@ elf_s390_relocate_section (output_bfd, info, input_bfd, input_section,
|| r_type == R_390_PC64
|| !info->shared
|| !info->symbolic
- || (h->elf_link_hash_flags
- & ELF_LINK_HASH_DEF_REGULAR) == 0))
+ || !h->def_regular))
{
outrel.r_info = ELF64_R_INFO (h->dynindx, r_type);
outrel.r_addend = rel->r_addend;
@@ -2605,14 +2617,19 @@ elf_s390_relocate_section (output_bfd, info, input_bfd, input_section,
osec = sec->output_section;
sindx = elf_section_data (osec)->dynindx;
- BFD_ASSERT (sindx > 0);
+
+ if (sindx == 0)
+ {
+ osec = htab->elf.text_index_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);
@@ -2877,7 +2894,7 @@ elf_s390_relocate_section (output_bfd, info, input_bfd, input_section,
continue;
case R_390_TLS_LDO64:
- if (info->shared || (input_section->flags & SEC_CODE) == 0)
+ if (info->shared)
relocation -= dtpoff_base (info);
else
/* When converting LDO to LE, we must negate. */
@@ -2987,12 +3004,13 @@ elf_s390_relocate_section (output_bfd, info, input_bfd, input_section,
not process them. */
if (unresolved_reloc
&& !((input_section->flags & SEC_DEBUGGING) != 0
- && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) != 0))
+ && h->def_dynamic))
(*_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),
+ (_("%B(%A+0x%lx): unresolvable %s relocation against symbol `%s'"),
+ input_bfd,
+ input_section,
(long) rel->r_offset,
+ howto->name,
h->root.root.string);
if (r_type == R_390_20
@@ -3032,16 +3050,16 @@ elf_s390_relocate_section (output_bfd, info, input_bfd, input_section,
{
if (! ((*info->callbacks->reloc_overflow)
- (info, name, howto->name, (bfd_vma) 0,
- input_bfd, input_section, rel->r_offset)))
+ (info, (h ? &h->root : NULL), 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),
+ (_("%B(%A+0x%lx): reloc against `%s': error %d"),
+ input_bfd, input_section,
(long) rel->r_offset, name, (int) r);
return FALSE;
}
@@ -3138,7 +3156,7 @@ elf_s390_finish_dynamic_symbol (output_bfd, info, h, sym)
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)
+ if (!h->def_regular)
{
/* Mark the symbol as undefined, rather than as defined in
the .plt section. Leave the value alone. This is a clue
@@ -3174,8 +3192,8 @@ elf_s390_finish_dynamic_symbol (output_bfd, info, h, sym)
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))
+ || h->forced_local)
+ && h->def_regular)
{
BFD_ASSERT((h->got.offset & 1) != 0);
rela.r_info = ELF64_R_INFO (0, R_390_RELATIVE);
@@ -3196,7 +3214,7 @@ elf_s390_finish_dynamic_symbol (output_bfd, info, h, sym)
bfd_elf64_swap_reloca_out (output_bfd, &rela, loc);
}
- if ((h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_COPY) != 0)
+ if (h->needs_copy)
{
Elf_Internal_Rela rela;
bfd_byte *loc;
@@ -3221,8 +3239,8 @@ elf_s390_finish_dynamic_symbol (output_bfd, info, h, sym)
/* 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)
+ || h == htab->elf.hgot
+ || h == htab->elf.hplt)
sym->st_shndx = SHN_ABS;
return TRUE;
@@ -3271,7 +3289,7 @@ elf_s390_finish_dynamic_sections (output_bfd, info)
abort ();
dyncon = (Elf64_External_Dyn *) sdyn->contents;
- dynconend = (Elf64_External_Dyn *) (sdyn->contents + sdyn->_raw_size);
+ dynconend = (Elf64_External_Dyn *) (sdyn->contents + sdyn->size);
for (; dyncon < dynconend; dyncon++)
{
Elf_Internal_Dyn dyn;
@@ -3294,10 +3312,7 @@ elf_s390_finish_dynamic_sections (output_bfd, info)
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;
+ dyn.d_un.d_val = s->size;
break;
case DT_RELASZ:
@@ -3309,10 +3324,7 @@ elf_s390_finish_dynamic_sections (output_bfd, info)
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;
+ dyn.d_un.d_val -= s->size;
break;
}
@@ -3320,7 +3332,7 @@ elf_s390_finish_dynamic_sections (output_bfd, info)
}
/* Fill in the special first entry in the procedure linkage table. */
- if (htab->splt && htab->splt->_raw_size > 0)
+ if (htab->splt && htab->splt->size > 0)
{
/* fill in blueprint for plt 0 entry */
bfd_put_32 (output_bfd, (bfd_vma) PLT_FIRST_ENTRY_WORD0,
@@ -3351,7 +3363,7 @@ elf_s390_finish_dynamic_sections (output_bfd, info)
if (htab->sgotplt)
{
/* Fill in the first three entries in the global offset table. */
- if (htab->sgotplt->_raw_size > 0)
+ if (htab->sgotplt->size > 0)
{
bfd_put_64 (output_bfd,
(sdyn == NULL ? (bfd_vma) 0
@@ -3369,6 +3381,17 @@ elf_s390_finish_dynamic_sections (output_bfd, info)
return TRUE;
}
+/* Return address for Ith PLT stub in section PLT, for relocation REL
+ or (bfd_vma) -1 if it should not be included. */
+
+static bfd_vma
+elf_s390_plt_sym_val (bfd_vma i, const asection *plt,
+ const arelent *rel ATTRIBUTE_UNUSED)
+{
+ return plt->vma + PLT_FIRST_ENTRY_SIZE + i * PLT_ENTRY_SIZE;
+}
+
+
/* 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. */
@@ -3425,6 +3448,7 @@ const struct elf_size_info s390_elf64_size_info =
#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 bfd_elf64_bfd_reloc_name_lookup elf_s390_reloc_name_lookup
#define elf_backend_adjust_dynamic_symbol elf_s390_adjust_dynamic_symbol
#define elf_backend_check_relocs elf_s390_check_relocs
@@ -3437,7 +3461,9 @@ const struct elf_size_info s390_elf64_size_info =
#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_init_index_section _bfd_elf_init_1_index_section
#define elf_backend_reloc_type_class elf_s390_reloc_type_class
+#define elf_backend_plt_sym_val elf_s390_plt_sym_val
#define bfd_elf64_mkobject elf_s390_mkobject
#define elf_backend_object_p elf_s390_object_p
diff --git a/contrib/binutils/bfd/elf64-sparc.c b/contrib/binutils/bfd/elf64-sparc.c
index 90de3b9..63f8ec6 100644
--- a/contrib/binutils/bfd/elf64-sparc.c
+++ b/contrib/binutils/bfd/elf64-sparc.c
@@ -1,6 +1,6 @@
/* SPARC-specific support for 64-bit ELF
Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
- 2003, 2004 Free Software Foundation, Inc.
+ 2003, 2004, 2005, 2007 Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@@ -16,330 +16,31 @@
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. */
+ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.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"
+#include "opcode/sparc.h"
+#include "elfxx-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;
+elf64_sparc_get_reloc_upper_bound (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;
+elf64_sparc_get_dynamic_reloc_upper_bound (bfd *abfd)
{
return _bfd_elf_get_dynamic_reloc_upper_bound (abfd) * 2;
}
@@ -350,12 +51,9 @@ sparc64_elf_get_dynamic_reloc_upper_bound (abfd)
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;
+elf64_sparc_slurp_one_reloc_table (bfd *abfd, asection *asect,
+ Elf_Internal_Shdr *rel_hdr,
+ asymbol **symbols, bfd_boolean dynamic)
{
PTR allocated = NULL;
bfd_byte *native_relocs;
@@ -386,6 +84,7 @@ sparc64_elf_slurp_one_reloc_table (abfd, asect, rel_hdr, symbols, dynamic)
i++, relent++, native_relocs += entsize)
{
Elf_Internal_Rela rela;
+ unsigned int r_type;
bfd_elf64_swap_reloca_in (abfd, native_relocs, &rela);
@@ -416,18 +115,18 @@ sparc64_elf_slurp_one_reloc_table (abfd, asect, rel_hdr, symbols, dynamic)
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)
+ r_type = ELF64_R_TYPE_ID (rela.r_info);
+ if (r_type == R_SPARC_OLO10)
{
- relent->howto = &sparc64_elf_howto_table[R_SPARC_LO10];
+ relent->howto = _bfd_sparc_elf_info_to_howto_ptr (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];
+ relent->howto = _bfd_sparc_elf_info_to_howto_ptr (R_SPARC_13);
}
else
- relent->howto = &sparc64_elf_howto_table[ELF64_R_TYPE_ID (rela.r_info)];
+ relent->howto = _bfd_sparc_elf_info_to_howto_ptr (r_type);
}
canon_reloc_count (asect) += relent - relents;
@@ -446,11 +145,8 @@ sparc64_elf_slurp_one_reloc_table (abfd, asect, rel_hdr, symbols, dynamic)
/* 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;
+elf64_sparc_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;
@@ -478,7 +174,7 @@ sparc64_elf_slurp_reloc_table (abfd, asect, symbols, dynamic)
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)
+ if (asect->size == 0)
return TRUE;
rel_hdr = &d->this_hdr;
@@ -492,16 +188,16 @@ sparc64_elf_slurp_reloc_table (abfd, asect, symbols, dynamic)
if (asect->relocation == NULL)
return FALSE;
- /* The sparc64_elf_slurp_one_reloc_table routine increments
+ /* The elf64_sparc_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,
+ if (!elf64_sparc_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,
+ && !elf64_sparc_slurp_one_reloc_table (abfd, asect, rel_hdr2, symbols,
dynamic))
return FALSE;
@@ -511,11 +207,8 @@ sparc64_elf_slurp_reloc_table (abfd, asect, symbols, dynamic)
/* Canonicalize the relocs. */
static long
-sparc64_elf_canonicalize_reloc (abfd, section, relptr, symbols)
- bfd *abfd;
- sec_ptr section;
- arelent **relptr;
- asymbol **symbols;
+elf64_sparc_canonicalize_reloc (bfd *abfd, sec_ptr section,
+ arelent **relptr, asymbol **symbols)
{
arelent *tblptr;
unsigned int i;
@@ -544,10 +237,8 @@ sparc64_elf_canonicalize_reloc (abfd, section, relptr, symbols)
section. */
static long
-sparc64_elf_canonicalize_dynamic_reloc (abfd, storage, syms)
- bfd *abfd;
- arelent **storage;
- asymbol **syms;
+elf64_sparc_canonicalize_dynamic_reloc (bfd *abfd, arelent **storage,
+ asymbol **syms)
{
asection *s;
long ret;
@@ -567,7 +258,7 @@ sparc64_elf_canonicalize_dynamic_reloc (abfd, storage, syms)
arelent *p;
long count, i;
- if (! sparc64_elf_slurp_reloc_table (abfd, s, syms, TRUE))
+ if (! elf64_sparc_slurp_reloc_table (abfd, s, syms, TRUE))
return -1;
count = canon_reloc_count (s);
p = s->relocation;
@@ -585,13 +276,11 @@ sparc64_elf_canonicalize_dynamic_reloc (abfd, storage, syms)
/* Write out the relocs. */
static void
-sparc64_elf_write_relocs (abfd, sec, data)
- bfd *abfd;
- asection *sec;
- PTR data;
+elf64_sparc_write_relocs (bfd *abfd, asection *sec, PTR data)
{
bfd_boolean *failedp = (bfd_boolean *) data;
Elf_Internal_Shdr *rela_hdr;
+ bfd_vma addr_offset;
Elf64_External_Rela *outbound_relocas, *src_rela;
unsigned int idx, count;
asymbol *last_sym = 0;
@@ -649,6 +338,13 @@ sparc64_elf_write_relocs (abfd, sec, data)
if (rela_hdr->sh_type != SHT_RELA)
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... */
outbound_relocas = (Elf64_External_Rela *) rela_hdr->contents;
src_rela = outbound_relocas;
@@ -661,15 +357,6 @@ sparc64_elf_write_relocs (abfd, sec, data)
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;
@@ -716,687 +403,30 @@ sparc64_elf_write_relocs (abfd, sec, data)
else
dst_rela.r_info = ELF64_R_INFO (n, ptr->howto->type);
+ dst_rela.r_offset = ptr->address + addr_offset;
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;
+elf64_sparc_add_symbol_hook (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;
+ struct _bfd_sparc_elf_app_reg *p;
reg = (int)sym->st_value;
switch (reg & ~1)
@@ -1405,8 +435,8 @@ sparc64_elf_add_symbol_hook (abfd, info, sym, namep, flagsp, secp, valp)
case 6: reg -= 4; break;
default:
(*_bfd_error_handler)
- (_("%s: Only registers %%g[2367] can be declared using STT_REGISTER"),
- bfd_archive_filename (abfd));
+ (_("%B: Only registers %%g[2367] can be declared using STT_REGISTER"),
+ abfd);
return FALSE;
}
@@ -1420,15 +450,15 @@ sparc64_elf_add_symbol_hook (abfd, info, sym, namep, flagsp, secp, valp)
return TRUE;
}
- p = sparc64_elf_hash_table(info)->app_regs + reg;
+ p = _bfd_sparc_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));
+ (_("Register %%g%d used incompatibly: %s in %B, previously %s in %B"),
+ abfd, p->abfd, (int) sym->st_value,
+ **namep ? *namep : "#scratch",
+ *p->name ? p->name : "#scratch");
return FALSE;
}
@@ -1448,9 +478,8 @@ sparc64_elf_add_symbol_hook (abfd, info, sym, namep, flagsp, secp, valp)
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));
+ (_("Symbol `%s' has differing types: REGISTER in %B, previously %s in %B"),
+ abfd, p->abfd, *namep, stt_types[type]);
return FALSE;
}
@@ -1483,9 +512,9 @@ sparc64_elf_add_symbol_hook (abfd, info, sym, namep, flagsp, secp, valp)
&& info->hash->creator == abfd->xvec)
{
int i;
- struct sparc64_elf_app_reg *p;
+ struct _bfd_sparc_elf_app_reg *p;
- p = sparc64_elf_hash_table(info)->app_regs;
+ p = _bfd_sparc_elf_hash_table(info)->app_regs;
for (i = 0; i < 4; i++, p++)
if (p->name != NULL && ! strcmp (p->name, *namep))
{
@@ -1494,9 +523,8 @@ sparc64_elf_add_symbol_hook (abfd, info, sym, namep, flagsp, secp, valp)
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));
+ (_("Symbol `%s' has differing types: %s in %B, previously REGISTER in %B"),
+ abfd, p->abfd, *namep, stt_types[type]);
return FALSE;
}
}
@@ -1507,17 +535,16 @@ sparc64_elf_add_symbol_hook (abfd, info, sym, namep, flagsp, secp, valp)
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 *));
+elf64_sparc_output_arch_syms (bfd *output_bfd ATTRIBUTE_UNUSED,
+ struct bfd_link_info *info,
+ PTR finfo, bfd_boolean (*func) (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;
+ struct _bfd_sparc_elf_app_reg *app_regs =
+ _bfd_sparc_elf_hash_table(info)->app_regs;
Elf_Internal_Sym sym;
/* We arranged in size_dynamic_sections to put the STT_REGISTER entries
@@ -1568,9 +595,7 @@ sparc64_elf_output_arch_syms (output_bfd, info, finfo, func)
}
static int
-sparc64_elf_get_symbol_type (elf_sym, type)
- Elf_Internal_Sym * elf_sym;
- int type;
+elf64_sparc_get_symbol_type (Elf_Internal_Sym *elf_sym, int type)
{
if (ELF_ST_TYPE (elf_sym->st_info) == STT_REGISTER)
return STT_REGISTER;
@@ -1582,9 +607,7 @@ sparc64_elf_get_symbol_type (elf_sym, type)
even in SHN_UNDEF section. */
static void
-sparc64_elf_symbol_processing (abfd, asym)
- bfd *abfd ATTRIBUTE_UNUSED;
- asymbol *asym;
+elf64_sparc_symbol_processing (bfd *abfd ATTRIBUTE_UNUSED, asymbol *asym)
{
elf_symbol_type *elfsym;
@@ -1596,1359 +619,6 @@ sparc64_elf_symbol_processing (abfd, asym)
}
}
-/* 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. */
@@ -2956,9 +626,7 @@ sparc64_elf_reloc_type_class (rela)
object file when linking. */
static bfd_boolean
-sparc64_elf_merge_private_bfd_data (ibfd, obfd)
- bfd *ibfd;
- bfd *obfd;
+elf64_sparc_merge_private_bfd_data (bfd *ibfd, bfd *obfd)
{
bfd_boolean error;
flagword new_flags, old_flags;
@@ -3006,8 +674,8 @@ sparc64_elf_merge_private_bfd_data (ibfd, obfd)
{
error = TRUE;
(*_bfd_error_handler)
- (_("%s: linking UltraSPARC specific with HAL specific code"),
- bfd_archive_filename (ibfd));
+ (_("%B: linking UltraSPARC specific with HAL specific code"),
+ ibfd);
}
/* Choose the most restrictive memory ordering. */
old_mm = (old_flags & EF_SPARCV9_MM);
@@ -3025,8 +693,8 @@ sparc64_elf_merge_private_bfd_data (ibfd, obfd)
{
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);
+ (_("%B: uses different e_flags (0x%lx) fields than previous modules (0x%lx)"),
+ ibfd, (long) new_flags, (long) old_flags);
}
elf_elfheader (obfd)->e_flags = old_flags;
@@ -3043,10 +711,9 @@ sparc64_elf_merge_private_bfd_data (ibfd, obfd)
/* 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;
+elf64_sparc_fake_sections (bfd *abfd ATTRIBUTE_UNUSED,
+ Elf_Internal_Shdr *hdr ATTRIBUTE_UNUSED,
+ asection *sec)
{
const char *name;
@@ -3064,10 +731,8 @@ sparc64_elf_fake_sections (abfd, hdr, sec)
/* 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;
+elf64_sparc_print_symbol_all (bfd *abfd ATTRIBUTE_UNUSED, PTR filep,
+ asymbol *symbol)
{
FILE *file = (FILE *) filep;
int reg, type;
@@ -3089,19 +754,20 @@ sparc64_elf_print_symbol_all (abfd, filep, symbol)
return symbol->name;
}
-/* Set the right machine number for a SPARC64 ELF file. */
-
-static bfd_boolean
-sparc64_elf_object_p (abfd)
- bfd *abfd;
+static enum elf_reloc_type_class
+elf64_sparc_reloc_type_class (const Elf_Internal_Rela *rela)
{
- 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);
+ 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;
+ }
}
/* Relocations in the 64 bit SPARC ELF ABI are more complex than in
@@ -3109,7 +775,7 @@ sparc64_elf_object_p (abfd)
ELF64_R_TYPE_DATA field. This structure is used to redirect the
relocation handling routines. */
-const struct elf_size_info sparc64_elf_size_info =
+const struct elf_size_info elf64_sparc_size_info =
{
sizeof (Elf64_External_Ehdr),
sizeof (Elf64_External_Phdr),
@@ -3131,10 +797,10 @@ const struct elf_size_info sparc64_elf_size_info =
EV_CURRENT,
bfd_elf64_write_out_phdrs,
bfd_elf64_write_shdrs_and_ehdr,
- sparc64_elf_write_relocs,
+ elf64_sparc_write_relocs,
bfd_elf64_swap_symbol_in,
bfd_elf64_swap_symbol_out,
- sparc64_elf_slurp_reloc_table,
+ elf64_sparc_slurp_reloc_table,
bfd_elf64_slurp_symbol_table,
bfd_elf64_swap_dyn_in,
bfd_elf64_swap_dyn_out,
@@ -3148,6 +814,7 @@ const struct elf_size_info sparc64_elf_size_info =
#define TARGET_BIG_NAME "elf64-sparc"
#define ELF_ARCH bfd_arch_sparc
#define ELF_MAXPAGESIZE 0x100000
+#define ELF_COMMONPAGESIZE 0x2000
/* This is the official ABI value. */
#define ELF_MACHINE_CODE EM_SPARCV9
@@ -3155,70 +822,105 @@ const struct elf_size_info sparc64_elf_size_info =
/* 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 elf_backend_reloc_type_class \
+ elf64_sparc_reloc_type_class
#define bfd_elf64_get_reloc_upper_bound \
- sparc64_elf_get_reloc_upper_bound
+ elf64_sparc_get_reloc_upper_bound
#define bfd_elf64_get_dynamic_reloc_upper_bound \
- sparc64_elf_get_dynamic_reloc_upper_bound
+ elf64_sparc_get_dynamic_reloc_upper_bound
#define bfd_elf64_canonicalize_reloc \
- sparc64_elf_canonicalize_reloc
+ elf64_sparc_canonicalize_reloc
#define bfd_elf64_canonicalize_dynamic_reloc \
- sparc64_elf_canonicalize_dynamic_reloc
+ elf64_sparc_canonicalize_dynamic_reloc
+#define elf_backend_add_symbol_hook \
+ elf64_sparc_add_symbol_hook
+#define elf_backend_get_symbol_type \
+ elf64_sparc_get_symbol_type
+#define elf_backend_symbol_processing \
+ elf64_sparc_symbol_processing
+#define elf_backend_print_symbol_all \
+ elf64_sparc_print_symbol_all
+#define elf_backend_output_arch_syms \
+ elf64_sparc_output_arch_syms
+#define bfd_elf64_bfd_merge_private_bfd_data \
+ elf64_sparc_merge_private_bfd_data
+#define elf_backend_fake_sections \
+ elf64_sparc_fake_sections
+#define elf_backend_size_info \
+ elf64_sparc_size_info
+
+#define elf_backend_plt_sym_val \
+ _bfd_sparc_elf_plt_sym_val
+#define bfd_elf64_bfd_link_hash_table_create \
+ _bfd_sparc_elf_link_hash_table_create
+#define elf_info_to_howto \
+ _bfd_sparc_elf_info_to_howto
+#define elf_backend_copy_indirect_symbol \
+ _bfd_sparc_elf_copy_indirect_symbol
#define bfd_elf64_bfd_reloc_type_lookup \
- sparc64_elf_reloc_type_lookup
+ _bfd_sparc_elf_reloc_type_lookup
+#define bfd_elf64_bfd_reloc_name_lookup \
+ _bfd_sparc_elf_reloc_name_lookup
#define bfd_elf64_bfd_relax_section \
- sparc64_elf_relax_section
+ _bfd_sparc_elf_relax_section
#define bfd_elf64_new_section_hook \
- sparc64_elf_new_section_hook
+ _bfd_sparc_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
+ _bfd_sparc_elf_create_dynamic_sections
+#define elf_backend_relocs_compatible \
+ _bfd_elf_relocs_compatible
#define elf_backend_check_relocs \
- sparc64_elf_check_relocs
+ _bfd_sparc_elf_check_relocs
#define elf_backend_adjust_dynamic_symbol \
- sparc64_elf_adjust_dynamic_symbol
+ _bfd_sparc_elf_adjust_dynamic_symbol
+#define elf_backend_omit_section_dynsym \
+ _bfd_sparc_elf_omit_section_dynsym
#define elf_backend_size_dynamic_sections \
- sparc64_elf_size_dynamic_sections
+ _bfd_sparc_elf_size_dynamic_sections
#define elf_backend_relocate_section \
- sparc64_elf_relocate_section
+ _bfd_sparc_elf_relocate_section
#define elf_backend_finish_dynamic_symbol \
- sparc64_elf_finish_dynamic_symbol
+ _bfd_sparc_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
+ _bfd_sparc_elf_finish_dynamic_sections
-#define elf_backend_size_info \
- sparc64_elf_size_info
+#define bfd_elf64_mkobject \
+ _bfd_sparc_elf_mkobject
#define elf_backend_object_p \
- sparc64_elf_object_p
-#define elf_backend_reloc_type_class \
- sparc64_elf_reloc_type_class
-
+ _bfd_sparc_elf_object_p
+#define elf_backend_gc_mark_hook \
+ _bfd_sparc_elf_gc_mark_hook
+#define elf_backend_gc_sweep_hook \
+ _bfd_sparc_elf_gc_sweep_hook
+#define elf_backend_init_index_section \
+ _bfd_elf_init_1_index_section
+
+#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 8
#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"
+
+/* FreeBSD support */
+#undef TARGET_BIG_SYM
+#define TARGET_BIG_SYM bfd_elf64_sparc_freebsd_vec
+#undef TARGET_BIG_NAME
+#define TARGET_BIG_NAME "elf64-sparc-freebsd"
+#undef ELF_OSABI
+#define ELF_OSABI ELFOSABI_FREEBSD
+
+#undef elf_backend_post_process_headers
+#define elf_backend_post_process_headers _bfd_elf_set_osabi
+#undef elf64_bed
+#define elf64_bed elf64_sparc_fbsd_bed
#include "elf64-target.h"
+
diff --git a/contrib/binutils/bfd/elf64-x86-64.c b/contrib/binutils/bfd/elf64-x86-64.c
index a1d6250..d4135d1 100644
--- a/contrib/binutils/bfd/elf64-x86-64.c
+++ b/contrib/binutils/bfd/elf64-x86-64.c
@@ -1,5 +1,6 @@
/* X86-64 specific support for 64-bit ELF
- Copyright 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
+ Copyright 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
+ Free Software Foundation, Inc.
Contributed by Jan Hubicka <jh@suse.cz>.
This file is part of BFD, the Binary File Descriptor library.
@@ -16,10 +17,10 @@
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. */
+ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "bfdlink.h"
#include "libbfd.h"
#include "elf-bfd.h"
@@ -30,8 +31,8 @@
#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. */
+ type, rightshift, size, bitsize, pc_relative, bitpos, complain_on_overflow,
+ special_function, name, partial_inplace, src_mask, dst_mask, pcrel_offset. */
static reloc_howto_type x86_64_elf_howto_table[] =
{
HOWTO(R_X86_64_NONE, 0, 0, 0, FALSE, 0, complain_overflow_dont,
@@ -74,7 +75,7 @@ static reloc_howto_type x86_64_elf_howto_table[] =
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,
+ HOWTO(R_X86_64_8, 0, 0, 8, FALSE, 0, complain_overflow_bitfield,
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),
@@ -93,7 +94,7 @@ static reloc_howto_type x86_64_elf_howto_table[] =
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,
+ HOWTO(R_X86_64_DTPOFF32, 0, 2, 32, FALSE, 0, complain_overflow_signed,
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,
@@ -102,6 +103,51 @@ static reloc_howto_type x86_64_elf_howto_table[] =
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),
+ HOWTO(R_X86_64_PC64, 0, 4, 64, TRUE, 0, complain_overflow_bitfield,
+ bfd_elf_generic_reloc, "R_X86_64_PC64", FALSE, MINUS_ONE, MINUS_ONE,
+ TRUE),
+ HOWTO(R_X86_64_GOTOFF64, 0, 4, 64, FALSE, 0, complain_overflow_bitfield,
+ bfd_elf_generic_reloc, "R_X86_64_GOTOFF64",
+ FALSE, MINUS_ONE, MINUS_ONE, FALSE),
+ HOWTO(R_X86_64_GOTPC32, 0, 2, 32, TRUE, 0, complain_overflow_signed,
+ bfd_elf_generic_reloc, "R_X86_64_GOTPC32",
+ FALSE, 0xffffffff, 0xffffffff, TRUE),
+ HOWTO(R_X86_64_GOT64, 0, 4, 64, FALSE, 0, complain_overflow_signed,
+ bfd_elf_generic_reloc, "R_X86_64_GOT64", FALSE, MINUS_ONE, MINUS_ONE,
+ FALSE),
+ HOWTO(R_X86_64_GOTPCREL64, 0, 4, 64, TRUE, 0, complain_overflow_signed,
+ bfd_elf_generic_reloc, "R_X86_64_GOTPCREL64", FALSE, MINUS_ONE,
+ MINUS_ONE, TRUE),
+ HOWTO(R_X86_64_GOTPC64, 0, 4, 64, TRUE, 0, complain_overflow_signed,
+ bfd_elf_generic_reloc, "R_X86_64_GOTPC64",
+ FALSE, MINUS_ONE, MINUS_ONE, TRUE),
+ HOWTO(R_X86_64_GOTPLT64, 0, 4, 64, FALSE, 0, complain_overflow_signed,
+ bfd_elf_generic_reloc, "R_X86_64_GOTPLT64", FALSE, MINUS_ONE,
+ MINUS_ONE, FALSE),
+ HOWTO(R_X86_64_PLTOFF64, 0, 4, 64, FALSE, 0, complain_overflow_signed,
+ bfd_elf_generic_reloc, "R_X86_64_PLTOFF64", FALSE, MINUS_ONE,
+ MINUS_ONE, FALSE),
+ EMPTY_HOWTO (32),
+ EMPTY_HOWTO (33),
+ HOWTO(R_X86_64_GOTPC32_TLSDESC, 0, 2, 32, TRUE, 0,
+ complain_overflow_bitfield, bfd_elf_generic_reloc,
+ "R_X86_64_GOTPC32_TLSDESC",
+ FALSE, 0xffffffff, 0xffffffff, TRUE),
+ HOWTO(R_X86_64_TLSDESC_CALL, 0, 0, 0, FALSE, 0,
+ complain_overflow_dont, bfd_elf_generic_reloc,
+ "R_X86_64_TLSDESC_CALL",
+ FALSE, 0, 0, FALSE),
+ HOWTO(R_X86_64_TLSDESC, 0, 4, 64, FALSE, 0,
+ complain_overflow_bitfield, bfd_elf_generic_reloc,
+ "R_X86_64_TLSDESC",
+ FALSE, MINUS_ONE, MINUS_ONE, FALSE),
+
+ /* We have a gap in the reloc numbers here.
+ R_X86_64_standard counts the number up to this point, and
+ R_X86_64_vt_offset is the value to subtract from a reloc type of
+ R_X86_64_GNU_VT* to form an index into this table. */
+#define R_X86_64_standard (R_X86_64_TLSDESC + 1)
+#define R_X86_64_vt_offset (R_X86_64_GNU_VTINHERIT - R_X86_64_standard)
/* GNU extension to record C++ vtable hierarchy. */
HOWTO (R_X86_64_GNU_VTINHERIT, 0, 4, 0, FALSE, 0, complain_overflow_dont,
@@ -146,14 +192,46 @@ static const struct elf_reloc_map x86_64_reloc_map[] =
{ 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_64_PCREL, R_X86_64_PC64, },
+ { BFD_RELOC_X86_64_GOTOFF64, R_X86_64_GOTOFF64, },
+ { BFD_RELOC_X86_64_GOTPC32, R_X86_64_GOTPC32, },
+ { BFD_RELOC_X86_64_GOT64, R_X86_64_GOT64, },
+ { BFD_RELOC_X86_64_GOTPCREL64,R_X86_64_GOTPCREL64, },
+ { BFD_RELOC_X86_64_GOTPC64, R_X86_64_GOTPC64, },
+ { BFD_RELOC_X86_64_GOTPLT64, R_X86_64_GOTPLT64, },
+ { BFD_RELOC_X86_64_PLTOFF64, R_X86_64_PLTOFF64, },
+ { BFD_RELOC_X86_64_GOTPC32_TLSDESC, R_X86_64_GOTPC32_TLSDESC, },
+ { BFD_RELOC_X86_64_TLSDESC_CALL, R_X86_64_TLSDESC_CALL, },
+ { BFD_RELOC_X86_64_TLSDESC, R_X86_64_TLSDESC, },
{ BFD_RELOC_VTABLE_INHERIT, R_X86_64_GNU_VTINHERIT, },
{ BFD_RELOC_VTABLE_ENTRY, R_X86_64_GNU_VTENTRY, },
};
+static reloc_howto_type *
+elf64_x86_64_rtype_to_howto (bfd *abfd, unsigned r_type)
+{
+ unsigned i;
+
+ if (r_type < (unsigned int) R_X86_64_GNU_VTINHERIT
+ || r_type >= (unsigned int) R_X86_64_max)
+ {
+ if (r_type >= (unsigned int) R_X86_64_standard)
+ {
+ (*_bfd_error_handler) (_("%B: invalid relocation type %d"),
+ abfd, (int) r_type);
+ r_type = R_X86_64_NONE;
+ }
+ i = r_type;
+ }
+ else
+ i = r_type - (unsigned int) R_X86_64_vt_offset;
+ BFD_ASSERT (x86_64_elf_howto_table[i].type == r_type);
+ return &x86_64_elf_howto_table[i];
+}
/* Given a BFD reloc type, return a HOWTO structure. */
static reloc_howto_type *
-elf64_x86_64_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED,
+elf64_x86_64_reloc_type_lookup (bfd *abfd,
bfd_reloc_code_real_type code)
{
unsigned int i;
@@ -162,31 +240,39 @@ elf64_x86_64_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED,
i++)
{
if (x86_64_reloc_map[i].bfd_reloc_val == code)
- return &x86_64_elf_howto_table[i];
+ return elf64_x86_64_rtype_to_howto (abfd,
+ x86_64_reloc_map[i].elf_reloc_val);
}
return 0;
}
+static reloc_howto_type *
+elf64_x86_64_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED,
+ const char *r_name)
+{
+ unsigned int i;
+
+ for (i = 0;
+ i < (sizeof (x86_64_elf_howto_table)
+ / sizeof (x86_64_elf_howto_table[0]));
+ i++)
+ if (x86_64_elf_howto_table[i].name != NULL
+ && strcasecmp (x86_64_elf_howto_table[i].name, r_name) == 0)
+ return &x86_64_elf_howto_table[i];
+
+ return NULL;
+}
+
/* 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;
+ unsigned r_type;
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];
+ cache_ptr->howto = elf64_x86_64_rtype_to_howto (abfd, r_type);
BFD_ASSERT (r_type == cache_ptr->howto->type);
}
@@ -195,7 +281,7 @@ static bfd_boolean
elf64_x86_64_grok_prstatus (bfd *abfd, Elf_Internal_Note *note)
{
int offset;
- size_t raw_size;
+ size_t size;
switch (note->descsz)
{
@@ -213,14 +299,14 @@ elf64_x86_64_grok_prstatus (bfd *abfd, Elf_Internal_Note *note)
/* pr_reg */
offset = 112;
- raw_size = 216;
+ size = 216;
break;
}
/* Make a ".reg/999" section. */
return _bfd_elfcore_make_pseudosection (abfd, ".reg",
- raw_size, note->descpos + offset);
+ size, note->descpos + offset);
}
static bfd_boolean
@@ -281,7 +367,7 @@ 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. */
+ 0x0f, 0x1f, 0x40, 0x00 /* nopl 0(%rax) */
};
/* Subsequent entries in a procedure linkage table look like this. */
@@ -330,7 +416,20 @@ struct elf64_x86_64_link_hash_entry
#define GOT_NORMAL 1
#define GOT_TLS_GD 2
#define GOT_TLS_IE 3
+#define GOT_TLS_GDESC 4
+#define GOT_TLS_GD_BOTH_P(type) \
+ ((type) == (GOT_TLS_GD | GOT_TLS_GDESC))
+#define GOT_TLS_GD_P(type) \
+ ((type) == GOT_TLS_GD || GOT_TLS_GD_BOTH_P (type))
+#define GOT_TLS_GDESC_P(type) \
+ ((type) == GOT_TLS_GDESC || GOT_TLS_GD_BOTH_P (type))
+#define GOT_TLS_GD_ANY_P(type) \
+ (GOT_TLS_GD_P (type) || GOT_TLS_GDESC_P (type))
unsigned char tls_type;
+
+ /* Offset of the GOTPLT entry reserved for the TLS descriptor,
+ starting at the end of the jump table. */
+ bfd_vma tlsdesc_got;
};
#define elf64_x86_64_hash_entry(ent) \
@@ -342,6 +441,9 @@ struct elf64_x86_64_obj_tdata
/* tls_type for each local got entry. */
char *local_got_tls_type;
+
+ /* GOTPLT entries for TLS descriptors. */
+ bfd_vma *local_tlsdesc_gotent;
};
#define elf64_x86_64_tdata(abfd) \
@@ -350,6 +452,8 @@ struct elf64_x86_64_obj_tdata
#define elf64_x86_64_local_got_tls_type(abfd) \
(elf64_x86_64_tdata (abfd)->local_got_tls_type)
+#define elf64_x86_64_local_tlsdesc_gotent(abfd) \
+ (elf64_x86_64_tdata (abfd)->local_tlsdesc_gotent)
/* x86-64 ELF linker hash table. */
@@ -366,11 +470,23 @@ struct elf64_x86_64_link_hash_table
asection *sdynbss;
asection *srelbss;
+ /* The offset into splt of the PLT entry for the TLS descriptor
+ resolver. Special values are 0, if not necessary (or not found
+ to be necessary yet), and -1 if needed but not determined
+ yet. */
+ bfd_vma tlsdesc_plt;
+ /* The offset into sgot of the GOT entry used by the PLT entry
+ above. */
+ bfd_vma tlsdesc_got;
+
union {
bfd_signed_vma refcount;
bfd_vma offset;
} tls_ld_got;
+ /* The amount of space used by the jump slots in the GOT. */
+ bfd_vma sgotplt_jump_table_size;
+
/* Small local sym to section mapping cache. */
struct sym_sec_cache sym_sec;
};
@@ -380,6 +496,9 @@ struct elf64_x86_64_link_hash_table
#define elf64_x86_64_hash_table(p) \
((struct elf64_x86_64_link_hash_table *) ((p)->hash))
+#define elf64_x86_64_compute_jump_table_size(htab) \
+ ((htab)->srelplt->reloc_count * GOT_ENTRY_SIZE)
+
/* Create an entry in an x86-64 ELF linker hash table. */
static struct bfd_hash_entry *
@@ -405,6 +524,7 @@ link_hash_newfunc (struct bfd_hash_entry *entry, struct bfd_hash_table *table,
eh = (struct elf64_x86_64_link_hash_entry *) entry;
eh->dyn_relocs = NULL;
eh->tls_type = GOT_UNKNOWN;
+ eh->tlsdesc_got = (bfd_vma) -1;
}
return entry;
@@ -422,7 +542,8 @@ elf64_x86_64_link_hash_table_create (bfd *abfd)
if (ret == NULL)
return NULL;
- if (! _bfd_elf_link_hash_table_init (&ret->elf, abfd, link_hash_newfunc))
+ if (!_bfd_elf_link_hash_table_init (&ret->elf, abfd, link_hash_newfunc,
+ sizeof (struct elf64_x86_64_link_hash_entry)))
{
free (ret);
return NULL;
@@ -436,7 +557,10 @@ elf64_x86_64_link_hash_table_create (bfd *abfd)
ret->sdynbss = NULL;
ret->srelbss = NULL;
ret->sym_sec.abfd = NULL;
+ ret->tlsdesc_plt = 0;
+ ret->tlsdesc_got = 0;
ret->tls_ld_got.refcount = 0;
+ ret->sgotplt_jump_table_size = 0;
return &ret->elf.root;
}
@@ -458,12 +582,13 @@ create_got_section (bfd *dynobj, struct bfd_link_info *info)
if (!htab->sgot || !htab->sgotplt)
abort ();
- htab->srelgot = bfd_make_section (dynobj, ".rela.got");
+ htab->srelgot = bfd_make_section_with_flags (dynobj, ".rela.got",
+ (SEC_ALLOC | SEC_LOAD
+ | SEC_HAS_CONTENTS
+ | SEC_IN_MEMORY
+ | SEC_LINKER_CREATED
+ | SEC_READONLY));
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;
@@ -501,7 +626,7 @@ elf64_x86_64_create_dynamic_sections (bfd *dynobj, struct bfd_link_info *info)
/* 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,
+elf64_x86_64_copy_indirect_symbol (struct bfd_link_info *info,
struct elf_link_hash_entry *dir,
struct elf_link_hash_entry *ind)
{
@@ -517,10 +642,7 @@ elf64_x86_64_copy_indirect_symbol (const struct elf_backend_data *bed,
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
+ /* Add reloc counts against the indirect sym to the direct sym
list. Merge any entries against the same section. */
for (pp = &eind->dyn_relocs; (p = *pp) != NULL; )
{
@@ -553,27 +675,32 @@ elf64_x86_64_copy_indirect_symbol (const struct elf_backend_data *bed,
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));
+ && dir->dynamic_adjusted)
+ {
+ /* If called to transfer flags for a weakdef during processing
+ of elf_adjust_dynamic_symbol, don't copy non_got_ref.
+ We clear it ourselves for ELIMINATE_COPY_RELOCS. */
+ dir->ref_dynamic |= ind->ref_dynamic;
+ dir->ref_regular |= ind->ref_regular;
+ dir->ref_regular_nonweak |= ind->ref_regular_nonweak;
+ dir->needs_plt |= ind->needs_plt;
+ dir->pointer_equality_needed |= ind->pointer_equality_needed;
+ }
else
- _bfd_elf_link_hash_copy_indirect (bed, dir, ind);
+ _bfd_elf_link_hash_copy_indirect (info, 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;
+ {
+ 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 bfd_elf_mkobject (abfd);
}
static bfd_boolean
@@ -593,6 +720,8 @@ elf64_x86_64_tls_transition (struct bfd_link_info *info, int r_type, int is_loca
switch (r_type)
{
case R_X86_64_TLSGD:
+ case R_X86_64_GOTPC32_TLSDESC:
+ case R_X86_64_TLSDESC_CALL:
case R_X86_64_GOTTPOFF:
if (is_local)
return R_X86_64_TPOFF32;
@@ -640,16 +769,20 @@ elf64_x86_64_check_relocs (bfd *abfd, struct bfd_link_info *info, asection *sec,
if (r_symndx >= NUM_SHDR_ENTRIES (symtab_hdr))
{
- (*_bfd_error_handler) (_("%s: bad symbol index: %d"),
- bfd_archive_filename (abfd),
- r_symndx);
+ (*_bfd_error_handler) (_("%B: bad symbol index: %d"),
+ abfd, r_symndx);
return FALSE;
}
if (r_symndx < symtab_hdr->sh_info)
h = NULL;
else
- h = sym_hashes[r_symndx - symtab_hdr->sh_info];
+ {
+ h = sym_hashes[r_symndx - symtab_hdr->sh_info];
+ 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;
+ }
r_type = elf64_x86_64_tls_transition (info, r_type, h == NULL);
switch (r_type)
@@ -662,9 +795,10 @@ elf64_x86_64_check_relocs (bfd *abfd, struct bfd_link_info *info, asection *sec,
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);
+ (_("%B: relocation %s against `%s' can not be used when making a shared object; recompile with -fPIC"),
+ abfd,
+ x86_64_elf_howto_table[r_type].name,
+ (h) ? h->root.root.string : "a local symbol");
bfd_set_error (bfd_error_bad_value);
return FALSE;
}
@@ -678,6 +812,11 @@ elf64_x86_64_check_relocs (bfd *abfd, struct bfd_link_info *info, asection *sec,
case R_X86_64_GOT32:
case R_X86_64_GOTPCREL:
case R_X86_64_TLSGD:
+ case R_X86_64_GOT64:
+ case R_X86_64_GOTPCREL64:
+ case R_X86_64_GOTPLT64:
+ case R_X86_64_GOTPC32_TLSDESC:
+ case R_X86_64_TLSDESC_CALL:
/* This symbol requires a global offset table entry. */
{
int tls_type, old_tls_type;
@@ -687,10 +826,21 @@ elf64_x86_64_check_relocs (bfd *abfd, struct bfd_link_info *info, asection *sec,
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;
+ case R_X86_64_GOTPC32_TLSDESC:
+ case R_X86_64_TLSDESC_CALL:
+ tls_type = GOT_TLS_GDESC; break;
}
if (h != NULL)
{
+ if (r_type == R_X86_64_GOTPLT64)
+ {
+ /* This relocation indicates that we also need
+ a PLT entry, as this is a function. We don't need
+ a PLT entry for local symbols. */
+ h->needs_plt = 1;
+ h->plt.refcount += 1;
+ }
h->got.refcount += 1;
old_tls_type = elf64_x86_64_hash_entry (h)->tls_type;
}
@@ -705,14 +855,17 @@ elf64_x86_64_check_relocs (bfd *abfd, struct bfd_link_info *info, asection *sec,
bfd_size_type size;
size = symtab_hdr->sh_info;
- size *= sizeof (bfd_signed_vma) + sizeof (char);
+ size *= sizeof (bfd_signed_vma)
+ + sizeof (bfd_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_tlsdesc_gotent (abfd)
+ = (bfd_vma *) (local_got_refcounts + symtab_hdr->sh_info);
elf64_x86_64_local_got_tls_type (abfd)
- = (char *) (local_got_refcounts + symtab_hdr->sh_info);
+ = (char *) (local_got_refcounts + 2 * symtab_hdr->sh_info);
}
local_got_refcounts[r_symndx] += 1;
old_tls_type
@@ -722,16 +875,19 @@ elf64_x86_64_check_relocs (bfd *abfd, struct bfd_link_info *info, asection *sec,
/* 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))
+ && (! GOT_TLS_GD_ANY_P (old_tls_type)
+ || tls_type != GOT_TLS_IE))
{
- if (old_tls_type == GOT_TLS_IE && tls_type == GOT_TLS_GD)
+ if (old_tls_type == GOT_TLS_IE && GOT_TLS_GD_ANY_P (tls_type))
tls_type = old_tls_type;
+ else if (GOT_TLS_GD_ANY_P (old_tls_type)
+ && GOT_TLS_GD_ANY_P (tls_type))
+ 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>");
+ (_("%B: %s' accessed both as normal and thread local symbol"),
+ abfd, h ? h->root.root.string : "<local>");
return FALSE;
}
}
@@ -746,7 +902,9 @@ elf64_x86_64_check_relocs (bfd *abfd, struct bfd_link_info *info, asection *sec,
}
/* Fall through */
- //case R_X86_64_GOTPCREL:
+ case R_X86_64_GOTOFF64:
+ case R_X86_64_GOTPC32:
+ case R_X86_64_GOTPC64:
create_got:
if (htab->sgot == NULL)
{
@@ -770,10 +928,20 @@ elf64_x86_64_check_relocs (bfd *abfd, struct bfd_link_info *info, asection *sec,
if (h == NULL)
continue;
- h->elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_PLT;
+ h->needs_plt = 1;
h->plt.refcount += 1;
break;
+ case R_X86_64_PLTOFF64:
+ /* This tries to form the 'address' of a function relative
+ to GOT. For global symbols we need a PLT entry. */
+ if (h != NULL)
+ {
+ h->needs_plt = 1;
+ h->plt.refcount += 1;
+ }
+ goto create_got;
+
case R_X86_64_8:
case R_X86_64_16:
case R_X86_64_32:
@@ -787,9 +955,10 @@ elf64_x86_64_check_relocs (bfd *abfd, struct bfd_link_info *info, asection *sec,
&& (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);
+ (_("%B: relocation %s against `%s' can not be used when making a shared object; recompile with -fPIC"),
+ abfd,
+ x86_64_elf_howto_table[r_type].name,
+ (h) ? h->root.root.string : "a local symbol");
bfd_set_error (bfd_error_bad_value);
return FALSE;
}
@@ -798,6 +967,7 @@ elf64_x86_64_check_relocs (bfd *abfd, struct bfd_link_info *info, asection *sec,
case R_X86_64_PC8:
case R_X86_64_PC16:
case R_X86_64_PC32:
+ case R_X86_64_PC64:
case R_X86_64_64:
if (h != NULL && !info->shared)
{
@@ -807,11 +977,13 @@ elf64_x86_64_check_relocs (bfd *abfd, struct bfd_link_info *info, asection *sec,
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;
+ h->non_got_ref = 1;
/* 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_X86_64_PC32 && r_type != R_X86_64_PC64)
+ h->pointer_equality_needed = 1;
}
/* If we are creating a shared library, and this is a reloc
@@ -839,19 +1011,18 @@ elf64_x86_64_check_relocs (bfd *abfd, struct bfd_link_info *info, asection *sec,
&& (sec->flags & SEC_ALLOC) != 0
&& (((r_type != R_X86_64_PC8)
&& (r_type != R_X86_64_PC16)
- && (r_type != R_X86_64_PC32))
+ && (r_type != R_X86_64_PC32)
+ && (r_type != R_X86_64_PC64))
|| (h != NULL
- && (! info->symbolic
+ && (! SYMBOLIC_BIND (info, h)
|| h->root.type == bfd_link_hash_defweak
- || (h->elf_link_hash_flags
- & ELF_LINK_HASH_DEF_REGULAR) == 0))))
+ || !h->def_regular))))
|| (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)))
+ || !h->def_regular)))
{
struct elf64_x86_64_dyn_relocs *p;
struct elf64_x86_64_dyn_relocs **head;
@@ -871,13 +1042,13 @@ elf64_x86_64_check_relocs (bfd *abfd, struct bfd_link_info *info, asection *sec,
if (name == NULL)
return FALSE;
- if (strncmp (name, ".rela", 5) != 0
+ if (! CONST_STRNEQ (name, ".rela")
|| strcmp (bfd_get_section_name (abfd, sec),
name + 5) != 0)
{
(*_bfd_error_handler)
- (_("%s: bad relocation section name `%s\'"),
- bfd_archive_filename (abfd), name);
+ (_("%B: bad relocation section name `%s\'"),
+ abfd, name);
}
if (htab->elf.dynobj == NULL)
@@ -890,13 +1061,14 @@ elf64_x86_64_check_relocs (bfd *abfd, struct bfd_link_info *info, asection *sec,
{
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;
+ sreloc = bfd_make_section_with_flags (dynobj,
+ name,
+ flags);
if (sreloc == NULL
- || ! bfd_set_section_flags (dynobj, sreloc, flags)
|| ! bfd_set_section_alignment (dynobj, sreloc, 3))
return FALSE;
}
@@ -911,6 +1083,7 @@ elf64_x86_64_check_relocs (bfd *abfd, struct bfd_link_info *info, asection *sec,
}
else
{
+ void **vpp;
/* Track dynamic relocs needed for local syms too.
We really need local syms available to do this
easily. Oh well. */
@@ -921,8 +1094,10 @@ elf64_x86_64_check_relocs (bfd *abfd, struct bfd_link_info *info, asection *sec,
if (s == NULL)
return FALSE;
- head = ((struct elf64_x86_64_dyn_relocs **)
- &elf_section_data (s)->local_dynrel);
+ /* Beware of type punned pointers vs strict aliasing
+ rules. */
+ vpp = &(elf_section_data (s)->local_dynrel);
+ head = (struct elf64_x86_64_dyn_relocs **)vpp;
}
p = *head;
@@ -943,7 +1118,8 @@ elf64_x86_64_check_relocs (bfd *abfd, struct bfd_link_info *info, asection *sec,
p->count += 1;
if (r_type == R_X86_64_PC8
|| r_type == R_X86_64_PC16
- || r_type == R_X86_64_PC32)
+ || r_type == R_X86_64_PC32
+ || r_type == R_X86_64_PC64)
p->pc_count += 1;
}
break;
@@ -975,38 +1151,20 @@ elf64_x86_64_check_relocs (bfd *abfd, struct bfd_link_info *info, asection *sec,
static asection *
elf64_x86_64_gc_mark_hook (asection *sec,
- struct bfd_link_info *info ATTRIBUTE_UNUSED,
+ struct bfd_link_info *info,
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;
+ switch (ELF64_R_TYPE (rel->r_info))
+ {
+ case R_X86_64_GNU_VTINHERIT:
+ case R_X86_64_GNU_VTENTRY:
+ return NULL;
+ }
+
+ return _bfd_elf_gc_mark_hook (sec, info, rel, h, sym);
}
/* Update the got entry reference counts for the section being removed. */
@@ -1041,6 +1199,9 @@ elf64_x86_64_gc_sweep_hook (bfd *abfd, struct bfd_link_info *info,
struct elf64_x86_64_dyn_relocs *p;
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;
eh = (struct elf64_x86_64_link_hash_entry *) h;
for (pp = &eh->dyn_relocs; (p = *pp) != NULL; pp = &p->next)
@@ -1062,11 +1223,18 @@ elf64_x86_64_gc_sweep_hook (bfd *abfd, struct bfd_link_info *info,
break;
case R_X86_64_TLSGD:
+ case R_X86_64_GOTPC32_TLSDESC:
+ case R_X86_64_TLSDESC_CALL:
case R_X86_64_GOTTPOFF:
case R_X86_64_GOT32:
case R_X86_64_GOTPCREL:
+ case R_X86_64_GOT64:
+ case R_X86_64_GOTPCREL64:
+ case R_X86_64_GOTPLT64:
if (h != NULL)
{
+ if (r_type == R_X86_64_GOTPLT64 && h->plt.refcount > 0)
+ h->plt.refcount -= 1;
if (h->got.refcount > 0)
h->got.refcount -= 1;
}
@@ -1085,11 +1253,13 @@ elf64_x86_64_gc_sweep_hook (bfd *abfd, struct bfd_link_info *info,
case R_X86_64_PC8:
case R_X86_64_PC16:
case R_X86_64_PC32:
+ case R_X86_64_PC64:
if (info->shared)
break;
/* Fall thru */
case R_X86_64_PLT32:
+ case R_X86_64_PLTOFF64:
if (h != NULL)
{
if (h->plt.refcount > 0)
@@ -1117,13 +1287,12 @@ elf64_x86_64_adjust_dynamic_symbol (struct bfd_link_info *info,
{
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)
+ || h->needs_plt)
{
if (h->plt.refcount <= 0
|| SYMBOL_CALLS_LOCAL (info, h)
@@ -1136,7 +1305,7 @@ elf64_x86_64_adjust_dynamic_symbol (struct bfd_link_info *info,
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;
+ h->needs_plt = 0;
}
return TRUE;
@@ -1152,16 +1321,14 @@ elf64_x86_64_adjust_dynamic_symbol (struct bfd_link_info *info,
/* 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)
+ if (h->u.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;
+ BFD_ASSERT (h->u.weakdef->root.type == bfd_link_hash_defined
+ || h->u.weakdef->root.type == bfd_link_hash_defweak);
+ h->root.u.def.section = h->u.weakdef->root.u.def.section;
+ h->root.u.def.value = h->u.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));
+ h->non_got_ref = h->u.weakdef->non_got_ref;
return TRUE;
}
@@ -1177,13 +1344,13 @@ elf64_x86_64_adjust_dynamic_symbol (struct bfd_link_info *info,
/* 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)
+ if (!h->non_got_ref)
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;
+ h->non_got_ref = 0;
return TRUE;
}
@@ -1204,11 +1371,18 @@ elf64_x86_64_adjust_dynamic_symbol (struct bfd_link_info *info,
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;
+ h->non_got_ref = 0;
return TRUE;
}
}
+ if (h->size == 0)
+ {
+ (*_bfd_error_handler) (_("dynamic variable `%s' is zero size"),
+ h->root.root.string);
+ 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
@@ -1226,36 +1400,13 @@ elf64_x86_64_adjust_dynamic_symbol (struct bfd_link_info *info,
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;
+ htab->srelbss->size += sizeof (Elf64_External_Rela);
+ h->needs_copy = 1;
}
- /* 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;
+ return _bfd_elf_adjust_dynamic_copy (h, s);
}
/* Allocate space in .plt, .got and associated reloc sections for
@@ -1284,7 +1435,7 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void * inf)
/* Make sure this symbol is output as a dynamic symbol.
Undefined weak syms won't yet be marked as dynamic. */
if (h->dynindx == -1
- && (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0)
+ && !h->forced_local)
{
if (! bfd_elf_link_record_dynamic_symbol (info, h))
return FALSE;
@@ -1297,10 +1448,10 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void * inf)
/* If this is the first .plt entry, make room for the special
first entry. */
- if (s->_raw_size == 0)
- s->_raw_size += PLT_ENTRY_SIZE;
+ if (s->size == 0)
+ s->size += PLT_ENTRY_SIZE;
- h->plt.offset = s->_raw_size;
+ h->plt.offset = s->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
@@ -1308,34 +1459,38 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void * inf)
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->def_regular)
{
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;
+ s->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;
+ htab->sgotplt->size += GOT_ENTRY_SIZE;
/* We also need to make an entry in the .rela.plt section. */
- htab->srelplt->_raw_size += sizeof (Elf64_External_Rela);
+ htab->srelplt->size += sizeof (Elf64_External_Rela);
+ htab->srelplt->reloc_count++;
}
else
{
h->plt.offset = (bfd_vma) -1;
- h->elf_link_hash_flags &= ~ELF_LINK_HASH_NEEDS_PLT;
+ h->needs_plt = 0;
}
}
else
{
h->plt.offset = (bfd_vma) -1;
- h->elf_link_hash_flags &= ~ELF_LINK_HASH_NEEDS_PLT;
+ h->needs_plt = 0;
}
+ eh = (struct elf64_x86_64_link_hash_entry *) h;
+ eh->tlsdesc_got = (bfd_vma) -1;
+
/* 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
@@ -1352,37 +1507,52 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void * inf)
/* Make sure this symbol is output as a dynamic symbol.
Undefined weak syms won't yet be marked as dynamic. */
if (h->dynindx == -1
- && (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0)
+ && !h->forced_local)
{
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;
+ if (GOT_TLS_GDESC_P (tls_type))
+ {
+ eh->tlsdesc_got = htab->sgotplt->size
+ - elf64_x86_64_compute_jump_table_size (htab);
+ htab->sgotplt->size += 2 * GOT_ENTRY_SIZE;
+ h->got.offset = (bfd_vma) -2;
+ }
+ if (! GOT_TLS_GDESC_P (tls_type)
+ || GOT_TLS_GD_P (tls_type))
+ {
+ s = htab->sgot;
+ h->got.offset = s->size;
+ s->size += GOT_ENTRY_SIZE;
+ if (GOT_TLS_GD_P (tls_type))
+ s->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)
+ if ((GOT_TLS_GD_P (tls_type) && 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)
+ htab->srelgot->size += sizeof (Elf64_External_Rela);
+ else if (GOT_TLS_GD_P (tls_type))
+ htab->srelgot->size += 2 * sizeof (Elf64_External_Rela);
+ else if (! GOT_TLS_GDESC_P (tls_type)
+ && (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);
+ htab->srelgot->size += sizeof (Elf64_External_Rela);
+ if (GOT_TLS_GDESC_P (tls_type))
+ {
+ htab->srelplt->size += sizeof (Elf64_External_Rela);
+ htab->tlsdesc_plt = (bfd_vma) -1;
+ }
}
else
h->got.offset = (bfd_vma) -1;
- eh = (struct elf64_x86_64_link_hash_entry *) h;
if (eh->dyn_relocs == NULL)
return TRUE;
@@ -1417,9 +1587,21 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void * inf)
/* Also discard relocs on undefined weak syms with non-default
visibility. */
- if (ELF_ST_VISIBILITY (h->other) != STV_DEFAULT
+ if (eh->dyn_relocs != NULL
&& h->root.type == bfd_link_hash_undefweak)
- eh->dyn_relocs = NULL;
+ {
+ if (ELF_ST_VISIBILITY (h->other) != STV_DEFAULT)
+ eh->dyn_relocs = NULL;
+
+ /* Make sure undefined weak symbols are output as a dynamic
+ symbol in PIEs. */
+ else if (h->dynindx == -1
+ && !h->forced_local)
+ {
+ if (! bfd_elf_link_record_dynamic_symbol (info, h))
+ return FALSE;
+ }
+ }
}
else if (ELIMINATE_COPY_RELOCS)
{
@@ -1427,9 +1609,9 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void * inf)
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)
+ if (!h->non_got_ref
+ && ((h->def_dynamic
+ && !h->def_regular)
|| (htab->elf.dynamic_sections_created
&& (h->root.type == bfd_link_hash_undefweak
|| h->root.type == bfd_link_hash_undefined))))
@@ -1437,7 +1619,7 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void * inf)
/* Make sure this symbol is output as a dynamic symbol.
Undefined weak syms won't yet be marked as dynamic. */
if (h->dynindx == -1
- && (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0)
+ && !h->forced_local)
{
if (! bfd_elf_link_record_dynamic_symbol (info, h))
return FALSE;
@@ -1458,7 +1640,7 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void * inf)
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);
+ sreloc->size += p->count * sizeof (Elf64_External_Rela);
}
return TRUE;
@@ -1518,7 +1700,7 @@ elf64_x86_64_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
s = bfd_get_section_by_name (dynobj, ".interp");
if (s == NULL)
abort ();
- s->_raw_size = sizeof ELF_DYNAMIC_INTERPRETER;
+ s->size = sizeof ELF_DYNAMIC_INTERPRETER;
s->contents = (unsigned char *) ELF_DYNAMIC_INTERPRETER;
}
}
@@ -1530,6 +1712,7 @@ elf64_x86_64_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
bfd_signed_vma *local_got;
bfd_signed_vma *end_local_got;
char *local_tls_type;
+ bfd_vma *local_tlsdesc_gotent;
bfd_size_type locsymcount;
Elf_Internal_Shdr *symtab_hdr;
asection *srel;
@@ -1541,8 +1724,8 @@ elf64_x86_64_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
{
struct elf64_x86_64_dyn_relocs *p;
- for (p = *((struct elf64_x86_64_dyn_relocs **)
- &elf_section_data (s)->local_dynrel);
+ for (p = (struct elf64_x86_64_dyn_relocs *)
+ (elf_section_data (s)->local_dynrel);
p != NULL;
p = p->next)
{
@@ -1557,7 +1740,7 @@ elf64_x86_64_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
else if (p->count != 0)
{
srel = elf_section_data (p->sec)->sreloc;
- srel->_raw_size += p->count * sizeof (Elf64_External_Rela);
+ srel->size += p->count * sizeof (Elf64_External_Rela);
if ((p->sec->output_section->flags & SEC_READONLY) != 0)
info->flags |= DF_TEXTREL;
@@ -1573,20 +1756,43 @@ elf64_x86_64_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
locsymcount = symtab_hdr->sh_info;
end_local_got = local_got + locsymcount;
local_tls_type = elf64_x86_64_local_got_tls_type (ibfd);
+ local_tlsdesc_gotent = elf64_x86_64_local_tlsdesc_gotent (ibfd);
s = htab->sgot;
srel = htab->srelgot;
- for (; local_got < end_local_got; ++local_got, ++local_tls_type)
+ for (; local_got < end_local_got;
+ ++local_got, ++local_tls_type, ++local_tlsdesc_gotent)
{
+ *local_tlsdesc_gotent = (bfd_vma) -1;
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 (GOT_TLS_GDESC_P (*local_tls_type))
+ {
+ *local_tlsdesc_gotent = htab->sgotplt->size
+ - elf64_x86_64_compute_jump_table_size (htab);
+ htab->sgotplt->size += 2 * GOT_ENTRY_SIZE;
+ *local_got = (bfd_vma) -2;
+ }
+ if (! GOT_TLS_GDESC_P (*local_tls_type)
+ || GOT_TLS_GD_P (*local_tls_type))
+ {
+ *local_got = s->size;
+ s->size += GOT_ENTRY_SIZE;
+ if (GOT_TLS_GD_P (*local_tls_type))
+ s->size += GOT_ENTRY_SIZE;
+ }
if (info->shared
- || *local_tls_type == GOT_TLS_GD
+ || GOT_TLS_GD_ANY_P (*local_tls_type)
|| *local_tls_type == GOT_TLS_IE)
- srel->_raw_size += sizeof (Elf64_External_Rela);
+ {
+ if (GOT_TLS_GDESC_P (*local_tls_type))
+ {
+ htab->srelplt->size += sizeof (Elf64_External_Rela);
+ htab->tlsdesc_plt = (bfd_vma) -1;
+ }
+ if (! GOT_TLS_GDESC_P (*local_tls_type)
+ || GOT_TLS_GD_P (*local_tls_type))
+ srel->size += sizeof (Elf64_External_Rela);
+ }
}
else
*local_got = (bfd_vma) -1;
@@ -1597,9 +1803,9 @@ elf64_x86_64_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
{
/* 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);
+ htab->tls_ld_got.offset = htab->sgot->size;
+ htab->sgot->size += 2 * GOT_ENTRY_SIZE;
+ htab->srelgot->size += sizeof (Elf64_External_Rela);
}
else
htab->tls_ld_got.offset = -1;
@@ -1608,6 +1814,34 @@ elf64_x86_64_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
sym dynamic relocs. */
elf_link_hash_traverse (&htab->elf, allocate_dynrelocs, (PTR) info);
+ /* For every jump slot reserved in the sgotplt, reloc_count is
+ incremented. However, when we reserve space for TLS descriptors,
+ it's not incremented, so in order to compute the space reserved
+ for them, it suffices to multiply the reloc count by the jump
+ slot size. */
+ if (htab->srelplt)
+ htab->sgotplt_jump_table_size
+ = elf64_x86_64_compute_jump_table_size (htab);
+
+ if (htab->tlsdesc_plt)
+ {
+ /* If we're not using lazy TLS relocations, don't generate the
+ PLT and GOT entries they require. */
+ if ((info->flags & DF_BIND_NOW))
+ htab->tlsdesc_plt = 0;
+ else
+ {
+ htab->tlsdesc_got = htab->sgot->size;
+ htab->sgot->size += GOT_ENTRY_SIZE;
+ /* Reserve room for the initial entry.
+ FIXME: we could probably do away with it in this case. */
+ if (htab->splt->size == 0)
+ htab->splt->size += PLT_ENTRY_SIZE;
+ htab->tlsdesc_plt = htab->splt->size;
+ htab->splt->size += PLT_ENTRY_SIZE;
+ }
+ }
+
/* We now have determined the sizes of the various dynamic sections.
Allocate memory for them. */
relocs = FALSE;
@@ -1618,19 +1852,21 @@ elf64_x86_64_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
if (s == htab->splt
|| s == htab->sgot
- || s == htab->sgotplt)
+ || s == htab->sgotplt
+ || s == htab->sdynbss)
{
/* 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)
+ else if (CONST_STRNEQ (bfd_get_section_name (dynobj, s), ".rela"))
{
- if (s->_raw_size != 0 && s != htab->srelplt)
+ if (s->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;
+ if (s != htab->srelplt)
+ s->reloc_count = 0;
}
else
{
@@ -1638,7 +1874,7 @@ elf64_x86_64_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
continue;
}
- if (s->_raw_size == 0)
+ if (s->size == 0)
{
/* If we don't need this section, strip it from the
output file. This is mostly to handle .rela.bss and
@@ -1650,16 +1886,19 @@ elf64_x86_64_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
function which decides whether anything needs to go
into these sections. */
- _bfd_strip_section_from_output (info, s);
+ s->flags |= SEC_EXCLUDE;
continue;
}
+ if ((s->flags & SEC_HAS_CONTENTS) == 0)
+ 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);
+ s->contents = (bfd_byte *) bfd_zalloc (dynobj, s->size);
if (s->contents == NULL)
return FALSE;
}
@@ -1680,13 +1919,18 @@ elf64_x86_64_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
return FALSE;
}
- if (htab->splt->_raw_size != 0)
+ if (htab->splt->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 (htab->tlsdesc_plt
+ && (!add_dynamic_entry (DT_TLSDESC_PLT, 0)
+ || !add_dynamic_entry (DT_TLSDESC_GOT, 0)))
+ return FALSE;
}
if (relocs)
@@ -1714,6 +1958,41 @@ elf64_x86_64_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
return TRUE;
}
+static bfd_boolean
+elf64_x86_64_always_size_sections (bfd *output_bfd,
+ struct bfd_link_info *info)
+{
+ asection *tls_sec = elf_hash_table (info)->tls_sec;
+
+ if (tls_sec)
+ {
+ struct elf_link_hash_entry *tlsbase;
+
+ tlsbase = elf_link_hash_lookup (elf_hash_table (info),
+ "_TLS_MODULE_BASE_",
+ FALSE, FALSE, FALSE);
+
+ if (tlsbase && tlsbase->type == STT_TLS)
+ {
+ struct bfd_link_hash_entry *bh = NULL;
+ const struct elf_backend_data *bed
+ = get_elf_backend_data (output_bfd);
+
+ if (!(_bfd_generic_link_add_one_symbol
+ (info, output_bfd, "_TLS_MODULE_BASE_", BSF_LOCAL,
+ tls_sec, 0, NULL, FALSE,
+ bed->collect, &bh)))
+ return FALSE;
+ tlsbase = (struct elf_link_hash_entry *)bh;
+ tlsbase->def_regular = 1;
+ tlsbase->other = STV_HIDDEN;
+ (*bed->elf_backend_hide_symbol) (info, tlsbase, TRUE);
+ }
+ }
+
+ 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. */
@@ -1741,6 +2020,24 @@ tpoff (struct bfd_link_info *info, bfd_vma address)
return address - htab->tls_size - htab->tls_sec->vma;
}
+/* Is the instruction before OFFSET in CONTENTS a 32bit relative
+ branch? */
+
+static bfd_boolean
+is_32bit_relative_branch (bfd_byte *contents, bfd_vma offset)
+{
+ /* Opcode Instruction
+ 0xe8 call
+ 0xe9 jump
+ 0x0f 0x8x conditional jump */
+ return ((offset > 0
+ && (contents [offset - 1] == 0xe8
+ || contents [offset - 1] == 0xe9))
+ || (offset > 1
+ && contents [offset - 2] == 0x0f
+ && (contents [offset - 1] & 0xf0) == 0x80));
+}
+
/* Relocate an x86_64 ELF section. */
static bfd_boolean
@@ -1754,16 +2051,15 @@ elf64_x86_64_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
Elf_Internal_Shdr *symtab_hdr;
struct elf_link_hash_entry **sym_hashes;
bfd_vma *local_got_offsets;
+ bfd_vma *local_tlsdesc_gotents;
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);
+ local_tlsdesc_gotents = elf64_x86_64_local_tlsdesc_gotent (input_bfd);
rel = relocs;
relend = relocs + input_section->reloc_count;
@@ -1775,7 +2071,7 @@ elf64_x86_64_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
struct elf_link_hash_entry *h;
Elf_Internal_Sym *sym;
asection *sec;
- bfd_vma off;
+ bfd_vma off, offplt;
bfd_vma relocation;
bfd_boolean unresolved_reloc;
bfd_reloc_status_type r;
@@ -1814,15 +2110,42 @@ elf64_x86_64_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
h, sec, relocation,
unresolved_reloc, warned);
}
+
+ if (sec != NULL && elf_discarded_section (sec))
+ {
+ /* For relocs against symbols from removed linkonce sections,
+ or sections discarded by a linker script, we just want the
+ section contents zeroed. Avoid any special processing. */
+ _bfd_clear_contents (howto, input_bfd, contents + rel->r_offset);
+ rel->r_info = 0;
+ rel->r_addend = 0;
+ continue;
+ }
+
+ if (info->relocatable)
+ continue;
+
/* When generating a shared object, the relocations handled here are
copied into the output file to be resolved at run time. */
switch (r_type)
{
+ asection *base_got;
case R_X86_64_GOT32:
+ case R_X86_64_GOT64:
/* 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. */
+ case R_X86_64_GOTPCREL64:
+ /* Use global offset table entry as symbol value. */
+ case R_X86_64_GOTPLT64:
+ /* This is the same as GOT64 for relocation purposes, but
+ indicates the existence of a PLT entry. The difficulty is,
+ that we must calculate the GOT slot offset from the PLT
+ offset, if this symbol got a PLT entry (it was global).
+ Additionally if it's computed from the PLT entry, then that
+ GOT offset is relative to .got.plt, not to .got. */
+ base_got = htab->sgot;
+
if (htab->sgot == NULL)
abort ();
@@ -1831,6 +2154,19 @@ elf64_x86_64_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
bfd_boolean dyn;
off = h->got.offset;
+ if (h->needs_plt
+ && h->plt.offset != (bfd_vma)-1
+ && off == (bfd_vma)-1)
+ {
+ /* We can't use h->got.offset here to save
+ state, or even just remember the offset, as
+ finish_dynamic_symbol would use that as offset into
+ .got. */
+ bfd_vma plt_index = h->plt.offset / PLT_ENTRY_SIZE - 1;
+ off = (plt_index + 3) * GOT_ENTRY_SIZE;
+ base_got = htab->sgotplt;
+ }
+
dyn = htab->elf.dynamic_sections_created;
if (! WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, info->shared, h)
@@ -1855,7 +2191,9 @@ elf64_x86_64_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
else
{
bfd_put_64 (output_bfd, relocation,
- htab->sgot->contents + off);
+ base_got->contents + off);
+ /* Note that this is harmless for the GOTPLT64 case,
+ as -1 | 1 still is -1. */
h->got.offset |= 1;
}
}
@@ -1877,7 +2215,7 @@ elf64_x86_64_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
else
{
bfd_put_64 (output_bfd, relocation,
- htab->sgot->contents + off);
+ base_got->contents + off);
if (info->shared)
{
@@ -1891,8 +2229,8 @@ elf64_x86_64_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
if (s == NULL)
abort ();
- outrel.r_offset = (htab->sgot->output_section->vma
- + htab->sgot->output_offset
+ outrel.r_offset = (base_got->output_section->vma
+ + base_got->output_offset
+ off);
outrel.r_info = ELF64_R_INFO (0, R_X86_64_RELATIVE);
outrel.r_addend = relocation;
@@ -1908,12 +2246,69 @@ elf64_x86_64_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
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;
+ relocation = base_got->output_section->vma
+ + base_got->output_offset + off;
+ if (r_type != R_X86_64_GOTPCREL && r_type != R_X86_64_GOTPCREL64)
+ relocation -= htab->sgotplt->output_section->vma
+ - htab->sgotplt->output_offset;
break;
+ case R_X86_64_GOTOFF64:
+ /* Relocation is relative to the start of the global offset
+ table. */
+
+ /* Check to make sure it isn't a protected function symbol
+ for shared library since it may not be local when used
+ as function address. */
+ if (info->shared
+ && h
+ && h->def_regular
+ && h->type == STT_FUNC
+ && ELF_ST_VISIBILITY (h->other) == STV_PROTECTED)
+ {
+ (*_bfd_error_handler)
+ (_("%B: relocation R_X86_64_GOTOFF64 against protected function `%s' can not be used when making a shared object"),
+ input_bfd, h->root.root.string);
+ bfd_set_error (bfd_error_bad_value);
+ return FALSE;
+ }
+
+ /* Note that sgot is not involved in this
+ calculation. We always want the start of .got.plt. 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->sgotplt->output_section->vma
+ + htab->sgotplt->output_offset;
+ break;
+
+ case R_X86_64_GOTPC32:
+ case R_X86_64_GOTPC64:
+ /* Use global offset table as symbol value. */
+ relocation = htab->sgotplt->output_section->vma
+ + htab->sgotplt->output_offset;
+ unresolved_reloc = FALSE;
+ break;
+
+ case R_X86_64_PLTOFF64:
+ /* Relocation is PLT entry relative to GOT. For local
+ symbols it's the symbol itself relative to GOT. */
+ if (h != NULL
+ /* See PLT32 handling. */
+ && h->plt.offset != (bfd_vma) -1
+ && htab->splt != NULL)
+ {
+ relocation = (htab->splt->output_section->vma
+ + htab->splt->output_offset
+ + h->plt.offset);
+ unresolved_reloc = FALSE;
+ }
+
+ relocation -= htab->sgotplt->output_section->vma
+ + htab->sgotplt->output_offset;
+ break;
+
case R_X86_64_PLT32:
/* Relocation is to the entry for this symbol in the
procedure linkage table. */
@@ -1941,18 +2336,43 @@ elf64_x86_64_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
case R_X86_64_PC8:
case R_X86_64_PC16:
case R_X86_64_PC32:
+ if (info->shared
+ && !SYMBOL_REFERENCES_LOCAL (info, h)
+ && (input_section->flags & SEC_ALLOC) != 0
+ && (input_section->flags & SEC_READONLY) != 0
+ && (!h->def_regular
+ || r_type != R_X86_64_PC32
+ || h->type != STT_FUNC
+ || ELF_ST_VISIBILITY (h->other) != STV_PROTECTED
+ || !is_32bit_relative_branch (contents,
+ rel->r_offset)))
+ {
+ if (h->def_regular
+ && r_type == R_X86_64_PC32
+ && h->type == STT_FUNC
+ && ELF_ST_VISIBILITY (h->other) == STV_PROTECTED)
+ (*_bfd_error_handler)
+ (_("%B: relocation R_X86_64_PC32 against protected function `%s' can not be used when making a shared object"),
+ input_bfd, h->root.root.string);
+ else
+ (*_bfd_error_handler)
+ (_("%B: relocation %s against `%s' can not be used when making a shared object; recompile with -fPIC"),
+ input_bfd, x86_64_elf_howto_table[r_type].name,
+ h->root.root.string);
+ bfd_set_error (bfd_error_bad_value);
+ return FALSE;
+ }
+ /* Fall through. */
+
case R_X86_64_8:
case R_X86_64_16:
case R_X86_64_32:
+ case R_X86_64_PC64:
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)
+ if ((input_section->flags & SEC_ALLOC) == 0)
break;
if ((info->shared
@@ -1961,17 +2381,16 @@ elf64_x86_64_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
|| 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)
+ && r_type != R_X86_64_PC32
+ && r_type != R_X86_64_PC64)
|| !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->non_got_ref
+ && ((h->def_dynamic
+ && !h->def_regular)
|| h->root.type == bfd_link_hash_undefweak
|| h->root.type == bfd_link_hash_undefined)))
{
@@ -2007,10 +2426,10 @@ elf64_x86_64_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
&& (r_type == R_X86_64_PC8
|| r_type == R_X86_64_PC16
|| r_type == R_X86_64_PC32
+ || r_type == R_X86_64_PC64
|| !info->shared
- || !info->symbolic
- || (h->elf_link_hash_flags
- & ELF_LINK_HASH_DEF_REGULAR) == 0))
+ || !SYMBOLIC_BIND (info, h)
+ || !h->def_regular))
{
outrel.r_info = ELF64_R_INFO (h->dynindx, r_type);
outrel.r_addend = rel->r_addend;
@@ -2039,9 +2458,19 @@ elf64_x86_64_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
{
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;
sindx = elf_section_data (osec)->dynindx;
- BFD_ASSERT (sindx > 0);
+ if (sindx == 0)
+ {
+ asection *oi = htab->elf.text_index_section;
+ sindx = elf_section_data (oi)->dynindx;
+ }
+ BFD_ASSERT (sindx != 0);
}
outrel.r_info = ELF64_R_INFO (sindx, r_type);
@@ -2068,6 +2497,8 @@ elf64_x86_64_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
break;
case R_X86_64_TLSGD:
+ case R_X86_64_GOTPC32_TLSDESC:
+ case R_X86_64_TLSDESC_CALL:
case R_X86_64_GOTTPOFF:
r_type = elf64_x86_64_tls_transition (info, r_type, h == NULL);
tls_type = GOT_UNKNOWN;
@@ -2079,7 +2510,9 @@ elf64_x86_64_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
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 (r_type == R_X86_64_TLSGD
+ || r_type == R_X86_64_GOTPC32_TLSDESC
+ || r_type == R_X86_64_TLSDESC_CALL)
{
if (tls_type == GOT_TLS_IE)
r_type = R_X86_64_GOTTPOFF;
@@ -2105,7 +2538,7 @@ elf64_x86_64_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
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);
+ BFD_ASSERT (rel->r_offset + 12 <= input_section->size);
for (i = 0; i < 4; i++)
BFD_ASSERT (bfd_get_8 (input_bfd,
contents + rel->r_offset + 4 + i)
@@ -2121,6 +2554,68 @@ elf64_x86_64_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
rel++;
continue;
}
+ else if (ELF64_R_TYPE (rel->r_info) == R_X86_64_GOTPC32_TLSDESC)
+ {
+ /* GDesc -> LE transition.
+ It's originally something like:
+ leaq x@tlsdesc(%rip), %rax
+
+ Change it to:
+ movl $x@tpoff, %rax
+
+ Registers other than %rax may be set up here. */
+
+ unsigned int val, type, type2;
+ bfd_vma roff;
+
+ /* First, make sure it's a leaq adding rip to a
+ 32-bit offset into any register, although it's
+ probably almost always going to be rax. */
+ roff = rel->r_offset;
+ BFD_ASSERT (roff >= 3);
+ type = bfd_get_8 (input_bfd, contents + roff - 3);
+ BFD_ASSERT ((type & 0xfb) == 0x48);
+ type2 = bfd_get_8 (input_bfd, contents + roff - 2);
+ BFD_ASSERT (type2 == 0x8d);
+ val = bfd_get_8 (input_bfd, contents + roff - 1);
+ BFD_ASSERT ((val & 0xc7) == 0x05);
+ BFD_ASSERT (roff + 4 <= input_section->size);
+
+ /* Now modify the instruction as appropriate. */
+ bfd_put_8 (output_bfd, 0x48 | ((type >> 2) & 1),
+ contents + roff - 3);
+ bfd_put_8 (output_bfd, 0xc7, contents + roff - 2);
+ bfd_put_8 (output_bfd, 0xc0 | ((val >> 3) & 7),
+ contents + roff - 1);
+ bfd_put_32 (output_bfd, tpoff (info, relocation),
+ contents + roff);
+ continue;
+ }
+ else if (ELF64_R_TYPE (rel->r_info) == R_X86_64_TLSDESC_CALL)
+ {
+ /* GDesc -> LE transition.
+ It's originally:
+ call *(%rax)
+ Turn it into:
+ nop; nop. */
+
+ unsigned int val, type;
+ bfd_vma roff;
+
+ /* First, make sure it's a call *(%rax). */
+ roff = rel->r_offset;
+ BFD_ASSERT (roff + 2 <= input_section->size);
+ type = bfd_get_8 (input_bfd, contents + roff);
+ BFD_ASSERT (type == 0xff);
+ val = bfd_get_8 (input_bfd, contents + roff + 1);
+ BFD_ASSERT (val == 0x10);
+
+ /* Now modify the instruction as appropriate. Use
+ xchg %ax,%ax instead of 2 nops. */
+ bfd_put_8 (output_bfd, 0x66, contents + roff);
+ bfd_put_8 (output_bfd, 0x90, contents + roff + 1);
+ continue;
+ }
else
{
unsigned int val, type, reg;
@@ -2141,7 +2636,7 @@ elf64_x86_64_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
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);
+ BFD_ASSERT (rel->r_offset + 4 <= input_section->size);
if (type == 0x8b)
{
/* movq */
@@ -2186,13 +2681,17 @@ elf64_x86_64_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
abort ();
if (h != NULL)
- off = h->got.offset;
+ {
+ off = h->got.offset;
+ offplt = elf64_x86_64_hash_entry (h)->tlsdesc_got;
+ }
else
{
if (local_got_offsets == NULL)
abort ();
off = local_got_offsets[r_symndx];
+ offplt = local_tlsdesc_gotents[r_symndx];
}
if ((off & 1) != 0)
@@ -2202,30 +2701,61 @@ elf64_x86_64_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
Elf_Internal_Rela outrel;
bfd_byte *loc;
int dr_type, indx;
+ asection *sreloc;
if (htab->srelgot == NULL)
abort ();
+ indx = h && h->dynindx != -1 ? h->dynindx : 0;
+
+ if (GOT_TLS_GDESC_P (tls_type))
+ {
+ outrel.r_info = ELF64_R_INFO (indx, R_X86_64_TLSDESC);
+ BFD_ASSERT (htab->sgotplt_jump_table_size + offplt
+ + 2 * GOT_ENTRY_SIZE <= htab->sgotplt->size);
+ outrel.r_offset = (htab->sgotplt->output_section->vma
+ + htab->sgotplt->output_offset
+ + offplt
+ + htab->sgotplt_jump_table_size);
+ sreloc = htab->srelplt;
+ loc = sreloc->contents;
+ loc += sreloc->reloc_count++
+ * sizeof (Elf64_External_Rela);
+ BFD_ASSERT (loc + sizeof (Elf64_External_Rela)
+ <= sreloc->contents + sreloc->size);
+ if (indx == 0)
+ outrel.r_addend = relocation - dtpoff_base (info);
+ else
+ outrel.r_addend = 0;
+ bfd_elf64_swap_reloca_out (output_bfd, &outrel, loc);
+ }
+
+ sreloc = htab->srelgot;
+
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)
+ if (GOT_TLS_GD_P (tls_type))
dr_type = R_X86_64_DTPMOD64;
+ else if (GOT_TLS_GDESC_P (tls_type))
+ goto dr_done;
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)
+ if ((dr_type == R_X86_64_TPOFF64
+ || dr_type == R_X86_64_TLSDESC) && 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);
+ loc = sreloc->contents;
+ loc += sreloc->reloc_count++ * sizeof (Elf64_External_Rela);
+ BFD_ASSERT (loc + sizeof (Elf64_External_Rela)
+ <= sreloc->contents + sreloc->size);
bfd_elf64_swap_reloca_out (output_bfd, &outrel, loc);
- if (r_type == R_X86_64_TLSGD)
+ if (GOT_TLS_GD_P (tls_type))
{
if (indx == 0)
{
@@ -2241,27 +2771,37 @@ elf64_x86_64_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
outrel.r_info = ELF64_R_INFO (indx,
R_X86_64_DTPOFF64);
outrel.r_offset += GOT_ENTRY_SIZE;
- htab->srelgot->reloc_count++;
+ sreloc->reloc_count++;
loc += sizeof (Elf64_External_Rela);
+ BFD_ASSERT (loc + sizeof (Elf64_External_Rela)
+ <= sreloc->contents + sreloc->size);
bfd_elf64_swap_reloca_out (output_bfd, &outrel, loc);
}
}
+ dr_done:
if (h != NULL)
h->got.offset |= 1;
else
local_got_offsets[r_symndx] |= 1;
}
- if (off >= (bfd_vma) -2)
+ if (off >= (bfd_vma) -2
+ && ! GOT_TLS_GDESC_P (tls_type))
abort ();
if (r_type == ELF64_R_TYPE (rel->r_info))
{
- relocation = htab->sgot->output_section->vma
- + htab->sgot->output_offset + off;
+ if (r_type == R_X86_64_GOTPC32_TLSDESC
+ || r_type == R_X86_64_TLSDESC_CALL)
+ relocation = htab->sgotplt->output_section->vma
+ + htab->sgotplt->output_offset
+ + offplt + htab->sgotplt_jump_table_size;
+ else
+ relocation = htab->sgot->output_section->vma
+ + htab->sgot->output_offset + off;
unresolved_reloc = FALSE;
}
- else
+ else if (ELF64_R_TYPE (rel->r_info) == R_X86_64_TLSGD)
{
unsigned int i;
static unsigned char tlsgd[8]
@@ -2278,7 +2818,7 @@ elf64_x86_64_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
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);
+ BFD_ASSERT (rel->r_offset + 12 <= input_section->size);
for (i = 0; i < 4; i++)
BFD_ASSERT (bfd_get_8 (input_bfd,
contents + rel->r_offset + 4 + i)
@@ -2301,6 +2841,78 @@ elf64_x86_64_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
rel++;
continue;
}
+ else if (ELF64_R_TYPE (rel->r_info) == R_X86_64_GOTPC32_TLSDESC)
+ {
+ /* GDesc -> IE transition.
+ It's originally something like:
+ leaq x@tlsdesc(%rip), %rax
+
+ Change it to:
+ movq x@gottpoff(%rip), %rax # before nop; nop
+
+ Registers other than %rax may be set up here. */
+
+ unsigned int val, type, type2;
+ bfd_vma roff;
+
+ /* First, make sure it's a leaq adding rip to a 32-bit
+ offset into any register, although it's probably
+ almost always going to be rax. */
+ roff = rel->r_offset;
+ BFD_ASSERT (roff >= 3);
+ type = bfd_get_8 (input_bfd, contents + roff - 3);
+ BFD_ASSERT ((type & 0xfb) == 0x48);
+ type2 = bfd_get_8 (input_bfd, contents + roff - 2);
+ BFD_ASSERT (type2 == 0x8d);
+ val = bfd_get_8 (input_bfd, contents + roff - 1);
+ BFD_ASSERT ((val & 0xc7) == 0x05);
+ BFD_ASSERT (roff + 4 <= input_section->size);
+
+ /* Now modify the instruction as appropriate. */
+ /* To turn a leaq into a movq in the form we use it, it
+ suffices to change the second byte from 0x8d to
+ 0x8b. */
+ bfd_put_8 (output_bfd, 0x8b, contents + roff - 2);
+
+ bfd_put_32 (output_bfd,
+ htab->sgot->output_section->vma
+ + htab->sgot->output_offset + off
+ - rel->r_offset
+ - input_section->output_section->vma
+ - input_section->output_offset
+ - 4,
+ contents + roff);
+ continue;
+ }
+ else if (ELF64_R_TYPE (rel->r_info) == R_X86_64_TLSDESC_CALL)
+ {
+ /* GDesc -> IE transition.
+ It's originally:
+ call *(%rax)
+
+ Change it to:
+ nop; nop. */
+
+ unsigned int val, type;
+ bfd_vma roff;
+
+ /* First, make sure it's a call *(%eax). */
+ roff = rel->r_offset;
+ BFD_ASSERT (roff + 2 <= input_section->size);
+ type = bfd_get_8 (input_bfd, contents + roff);
+ BFD_ASSERT (type == 0xff);
+ val = bfd_get_8 (input_bfd, contents + roff + 1);
+ BFD_ASSERT (val == 0x10);
+
+ /* Now modify the instruction as appropriate. Use
+ xchg %ax,%ax instead of 2 nops. */
+ bfd_put_8 (output_bfd, 0x66, contents + roff);
+ bfd_put_8 (output_bfd, 0x90, contents + roff + 1);
+
+ continue;
+ }
+ else
+ BFD_ASSERT (FALSE);
break;
case R_X86_64_TLSLD:
@@ -2318,7 +2930,7 @@ elf64_x86_64_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
== 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 (rel->r_offset + 9 <= input_section->size);
BFD_ASSERT (bfd_get_8 (input_bfd, contents + rel->r_offset + 4)
== 0xe8);
BFD_ASSERT (rel + 1 < relend);
@@ -2384,12 +2996,13 @@ elf64_x86_64_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
not process them. */
if (unresolved_reloc
&& !((input_section->flags & SEC_DEBUGGING) != 0
- && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) != 0))
+ && h->def_dynamic))
(*_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),
+ (_("%B(%A+0x%lx): unresolvable %s relocation against symbol `%s'"),
+ input_bfd,
+ input_section,
(long) rel->r_offset,
+ howto->name,
h->root.root.string);
r = _bfd_final_link_relocate (howto, input_bfd, input_section,
@@ -2415,18 +3028,17 @@ elf64_x86_64_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
if (r == bfd_reloc_overflow)
{
-
if (! ((*info->callbacks->reloc_overflow)
- (info, name, howto->name, (bfd_vma) 0,
- input_bfd, input_section, rel->r_offset)))
+ (info, (h ? &h->root : NULL), 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),
+ (_("%B(%A+0x%lx): reloc against `%s': error %d"),
+ input_bfd, input_section,
(long) rel->r_offset, name, (int) r);
return FALSE;
}
@@ -2516,19 +3128,24 @@ elf64_x86_64_finish_dynamic_symbol (bfd *output_bfd,
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)
+ if (!h->def_regular)
{
/* Mark the symbol as undefined, rather than as defined in
- the .plt section. Leave the value alone. This is a clue
+ 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. */
+ 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->pointer_equality_needed)
+ sym->st_value = 0;
}
}
if (h->got.offset != (bfd_vma) -1
- && elf64_x86_64_hash_entry (h)->tls_type != GOT_TLS_GD
+ && ! GOT_TLS_GD_ANY_P (elf64_x86_64_hash_entry (h)->tls_type)
&& elf64_x86_64_hash_entry (h)->tls_type != GOT_TLS_IE)
{
Elf_Internal_Rela rela;
@@ -2571,7 +3188,7 @@ elf64_x86_64_finish_dynamic_symbol (bfd *output_bfd,
bfd_elf64_swap_reloca_out (output_bfd, &rela, loc);
}
- if ((h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_COPY) != 0)
+ if (h->needs_copy)
{
Elf_Internal_Rela rela;
bfd_byte *loc;
@@ -2596,7 +3213,7 @@ elf64_x86_64_finish_dynamic_symbol (bfd *output_bfd,
/* 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)
+ || h == htab->elf.hgot)
sym->st_shndx = SHN_ABS;
return TRUE;
@@ -2642,7 +3259,7 @@ elf64_x86_64_finish_dynamic_sections (bfd *output_bfd, struct bfd_link_info *inf
abort ();
dyncon = (Elf64_External_Dyn *) sdyn->contents;
- dynconend = (Elf64_External_Dyn *) (sdyn->contents + sdyn->_raw_size);
+ dynconend = (Elf64_External_Dyn *) (sdyn->contents + sdyn->size);
for (; dyncon < dynconend; dyncon++)
{
Elf_Internal_Dyn dyn;
@@ -2656,7 +3273,8 @@ elf64_x86_64_finish_dynamic_sections (bfd *output_bfd, struct bfd_link_info *inf
continue;
case DT_PLTGOT:
- dyn.d_un.d_ptr = htab->sgot->output_section->vma;
+ s = htab->sgotplt;
+ dyn.d_un.d_ptr = s->output_section->vma + s->output_offset;
break;
case DT_JMPREL:
@@ -2665,10 +3283,7 @@ elf64_x86_64_finish_dynamic_sections (bfd *output_bfd, struct bfd_link_info *inf
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;
+ dyn.d_un.d_val = s->size;
break;
case DT_RELASZ:
@@ -2682,19 +3297,28 @@ elf64_x86_64_finish_dynamic_sections (bfd *output_bfd, struct bfd_link_info *inf
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;
+ dyn.d_un.d_val -= s->size;
}
break;
+
+ case DT_TLSDESC_PLT:
+ s = htab->splt;
+ dyn.d_un.d_ptr = s->output_section->vma + s->output_offset
+ + htab->tlsdesc_plt;
+ break;
+
+ case DT_TLSDESC_GOT:
+ s = htab->sgot;
+ dyn.d_un.d_ptr = s->output_section->vma + s->output_offset
+ + htab->tlsdesc_got;
+ 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)
+ if (htab->splt && htab->splt->size > 0)
{
/* Fill in the first entry in the procedure linkage table. */
memcpy (htab->splt->contents, elf64_x86_64_plt0_entry,
@@ -2722,13 +3346,47 @@ elf64_x86_64_finish_dynamic_sections (bfd *output_bfd, struct bfd_link_info *inf
elf_section_data (htab->splt->output_section)->this_hdr.sh_entsize =
PLT_ENTRY_SIZE;
+
+ if (htab->tlsdesc_plt)
+ {
+ bfd_put_64 (output_bfd, (bfd_vma) 0,
+ htab->sgot->contents + htab->tlsdesc_got);
+
+ memcpy (htab->splt->contents + htab->tlsdesc_plt,
+ 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
+ - htab->tlsdesc_plt
+ - 6),
+ htab->splt->contents + htab->tlsdesc_plt + 2);
+ /* Add offset for jmp *GOT+TDG(%rip), where TGD stands for
+ htab->tlsdesc_got. The 12 is the offset to the end of
+ the instruction. */
+ bfd_put_32 (output_bfd,
+ (htab->sgot->output_section->vma
+ + htab->sgot->output_offset
+ + htab->tlsdesc_got
+ - htab->splt->output_section->vma
+ - htab->splt->output_offset
+ - htab->tlsdesc_plt
+ - 12),
+ htab->splt->contents + htab->tlsdesc_plt + 8);
+ }
}
}
if (htab->sgotplt)
{
/* Fill in the first three entries in the global offset table. */
- if (htab->sgotplt->_raw_size > 0)
+ if (htab->sgotplt->size > 0)
{
/* Set the first entry in the global offset table to the address of
the dynamic section. */
@@ -2747,15 +3405,240 @@ elf64_x86_64_finish_dynamic_sections (bfd *output_bfd, struct bfd_link_info *inf
GOT_ENTRY_SIZE;
}
+ if (htab->sgot && htab->sgot->size > 0)
+ elf_section_data (htab->sgot->output_section)->this_hdr.sh_entsize
+ = GOT_ENTRY_SIZE;
+
return TRUE;
}
+/* Return address for Ith PLT stub in section PLT, for relocation REL
+ or (bfd_vma) -1 if it should not be included. */
+
+static bfd_vma
+elf64_x86_64_plt_sym_val (bfd_vma i, const asection *plt,
+ const arelent *rel ATTRIBUTE_UNUSED)
+{
+ return plt->vma + (i + 1) * PLT_ENTRY_SIZE;
+}
+
+/* Handle an x86-64 specific section when reading an object file. This
+ is called when elfcode.h finds a section with an unknown type. */
+
+static bfd_boolean
+elf64_x86_64_section_from_shdr (bfd *abfd,
+ Elf_Internal_Shdr *hdr,
+ const char *name,
+ int shindex)
+{
+ if (hdr->sh_type != SHT_X86_64_UNWIND)
+ return FALSE;
+
+ if (! _bfd_elf_make_section_from_shdr (abfd, hdr, name, shindex))
+ return FALSE;
+
+ return TRUE;
+}
+
+/* Hook called by the linker routine which adds symbols from an object
+ file. We use it to put SHN_X86_64_LCOMMON items in .lbss, instead
+ of .bss. */
+
+static bfd_boolean
+elf64_x86_64_add_symbol_hook (bfd *abfd,
+ struct bfd_link_info *info ATTRIBUTE_UNUSED,
+ Elf_Internal_Sym *sym,
+ const char **namep ATTRIBUTE_UNUSED,
+ flagword *flagsp ATTRIBUTE_UNUSED,
+ asection **secp, bfd_vma *valp)
+{
+ asection *lcomm;
+
+ switch (sym->st_shndx)
+ {
+ case SHN_X86_64_LCOMMON:
+ lcomm = bfd_get_section_by_name (abfd, "LARGE_COMMON");
+ if (lcomm == NULL)
+ {
+ lcomm = bfd_make_section_with_flags (abfd,
+ "LARGE_COMMON",
+ (SEC_ALLOC
+ | SEC_IS_COMMON
+ | SEC_LINKER_CREATED));
+ if (lcomm == NULL)
+ return FALSE;
+ elf_section_flags (lcomm) |= SHF_X86_64_LARGE;
+ }
+ *secp = lcomm;
+ *valp = sym->st_size;
+ break;
+ }
+ return TRUE;
+}
+
+
+/* Given a BFD section, try to locate the corresponding ELF section
+ index. */
+
+static bfd_boolean
+elf64_x86_64_elf_section_from_bfd_section (bfd *abfd ATTRIBUTE_UNUSED,
+ asection *sec, int *index)
+{
+ if (sec == &_bfd_elf_large_com_section)
+ {
+ *index = SHN_X86_64_LCOMMON;
+ return TRUE;
+ }
+ return FALSE;
+}
+
+/* Process a symbol. */
+
+static void
+elf64_x86_64_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_X86_64_LCOMMON:
+ asym->section = &_bfd_elf_large_com_section;
+ asym->value = elfsym->internal_elf_sym.st_size;
+ /* Common symbol doesn't set BSF_GLOBAL. */
+ asym->flags &= ~BSF_GLOBAL;
+ break;
+ }
+}
+
+static bfd_boolean
+elf64_x86_64_common_definition (Elf_Internal_Sym *sym)
+{
+ return (sym->st_shndx == SHN_COMMON
+ || sym->st_shndx == SHN_X86_64_LCOMMON);
+}
+
+static unsigned int
+elf64_x86_64_common_section_index (asection *sec)
+{
+ if ((elf_section_flags (sec) & SHF_X86_64_LARGE) == 0)
+ return SHN_COMMON;
+ else
+ return SHN_X86_64_LCOMMON;
+}
+
+static asection *
+elf64_x86_64_common_section (asection *sec)
+{
+ if ((elf_section_flags (sec) & SHF_X86_64_LARGE) == 0)
+ return bfd_com_section_ptr;
+ else
+ return &_bfd_elf_large_com_section;
+}
+
+static bfd_boolean
+elf64_x86_64_merge_symbol (struct bfd_link_info *info ATTRIBUTE_UNUSED,
+ struct elf_link_hash_entry **sym_hash ATTRIBUTE_UNUSED,
+ struct elf_link_hash_entry *h,
+ Elf_Internal_Sym *sym,
+ asection **psec,
+ bfd_vma *pvalue ATTRIBUTE_UNUSED,
+ unsigned int *pold_alignment ATTRIBUTE_UNUSED,
+ bfd_boolean *skip ATTRIBUTE_UNUSED,
+ bfd_boolean *override ATTRIBUTE_UNUSED,
+ bfd_boolean *type_change_ok ATTRIBUTE_UNUSED,
+ bfd_boolean *size_change_ok ATTRIBUTE_UNUSED,
+ bfd_boolean *newdef ATTRIBUTE_UNUSED,
+ bfd_boolean *newdyn,
+ bfd_boolean *newdyncommon ATTRIBUTE_UNUSED,
+ bfd_boolean *newweak ATTRIBUTE_UNUSED,
+ bfd *abfd ATTRIBUTE_UNUSED,
+ asection **sec,
+ bfd_boolean *olddef ATTRIBUTE_UNUSED,
+ bfd_boolean *olddyn,
+ bfd_boolean *olddyncommon ATTRIBUTE_UNUSED,
+ bfd_boolean *oldweak ATTRIBUTE_UNUSED,
+ bfd *oldbfd,
+ asection **oldsec)
+{
+ /* A normal common symbol and a large common symbol result in a
+ normal common symbol. We turn the large common symbol into a
+ normal one. */
+ if (!*olddyn
+ && h->root.type == bfd_link_hash_common
+ && !*newdyn
+ && bfd_is_com_section (*sec)
+ && *oldsec != *sec)
+ {
+ if (sym->st_shndx == SHN_COMMON
+ && (elf_section_flags (*oldsec) & SHF_X86_64_LARGE) != 0)
+ {
+ h->root.u.c.p->section
+ = bfd_make_section_old_way (oldbfd, "COMMON");
+ h->root.u.c.p->section->flags = SEC_ALLOC;
+ }
+ else if (sym->st_shndx == SHN_X86_64_LCOMMON
+ && (elf_section_flags (*oldsec) & SHF_X86_64_LARGE) == 0)
+ *psec = *sec = bfd_com_section_ptr;
+ }
+
+ return TRUE;
+}
+
+static int
+elf64_x86_64_additional_program_headers (bfd *abfd,
+ struct bfd_link_info *info ATTRIBUTE_UNUSED)
+{
+ asection *s;
+ int count = 0;
+
+ /* Check to see if we need a large readonly segment. */
+ s = bfd_get_section_by_name (abfd, ".lrodata");
+ if (s && (s->flags & SEC_LOAD))
+ count++;
+
+ /* Check to see if we need a large data segment. Since .lbss sections
+ is placed right after the .bss section, there should be no need for
+ a large data segment just because of .lbss. */
+ s = bfd_get_section_by_name (abfd, ".ldata");
+ if (s && (s->flags & SEC_LOAD))
+ count++;
+
+ return count;
+}
+
+/* Return TRUE if symbol should be hashed in the `.gnu.hash' section. */
+
+static bfd_boolean
+elf64_x86_64_hash_symbol (struct elf_link_hash_entry *h)
+{
+ if (h->plt.offset != (bfd_vma) -1
+ && !h->def_regular
+ && !h->pointer_equality_needed)
+ return FALSE;
+
+ return _bfd_elf_hash_symbol (h);
+}
+
+static const struct bfd_elf_special_section
+ elf64_x86_64_special_sections[]=
+{
+ { STRING_COMMA_LEN (".gnu.linkonce.lb"), -2, SHT_NOBITS, SHF_ALLOC + SHF_WRITE + SHF_X86_64_LARGE},
+ { STRING_COMMA_LEN (".gnu.linkonce.lr"), -2, SHT_PROGBITS, SHF_ALLOC + SHF_X86_64_LARGE},
+ { STRING_COMMA_LEN (".gnu.linkonce.lt"), -2, SHT_PROGBITS, SHF_ALLOC + SHF_EXECINSTR + SHF_X86_64_LARGE},
+ { STRING_COMMA_LEN (".lbss"), -2, SHT_NOBITS, SHF_ALLOC + SHF_WRITE + SHF_X86_64_LARGE},
+ { STRING_COMMA_LEN (".ldata"), -2, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE + SHF_X86_64_LARGE},
+ { STRING_COMMA_LEN (".lrodata"), -2, SHT_PROGBITS, SHF_ALLOC + SHF_X86_64_LARGE},
+ { NULL, 0, 0, 0, 0 }
+};
#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_MAXPAGESIZE 0x200000
+#define ELF_MINPAGESIZE 0x1000
+#define ELF_COMMONPAGESIZE 0x1000
#define elf_backend_can_gc_sections 1
#define elf_backend_can_refcount 1
@@ -2770,8 +3653,11 @@ elf64_x86_64_finish_dynamic_sections (bfd *output_bfd, struct bfd_link_info *inf
#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 bfd_elf64_bfd_reloc_name_lookup \
+ elf64_x86_64_reloc_name_lookup
#define elf_backend_adjust_dynamic_symbol elf64_x86_64_adjust_dynamic_symbol
+#define elf_backend_relocs_compatible _bfd_elf_relocs_compatible
#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
@@ -2784,7 +3670,52 @@ elf64_x86_64_finish_dynamic_sections (bfd *output_bfd, struct bfd_link_info *inf
#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_always_size_sections elf64_x86_64_always_size_sections
+#define elf_backend_init_index_section _bfd_elf_init_1_index_section
+#define elf_backend_plt_sym_val elf64_x86_64_plt_sym_val
#define elf_backend_object_p elf64_x86_64_elf_object_p
#define bfd_elf64_mkobject elf64_x86_64_mkobject
+#define elf_backend_section_from_shdr \
+ elf64_x86_64_section_from_shdr
+
+#define elf_backend_section_from_bfd_section \
+ elf64_x86_64_elf_section_from_bfd_section
+#define elf_backend_add_symbol_hook \
+ elf64_x86_64_add_symbol_hook
+#define elf_backend_symbol_processing \
+ elf64_x86_64_symbol_processing
+#define elf_backend_common_section_index \
+ elf64_x86_64_common_section_index
+#define elf_backend_common_section \
+ elf64_x86_64_common_section
+#define elf_backend_common_definition \
+ elf64_x86_64_common_definition
+#define elf_backend_merge_symbol \
+ elf64_x86_64_merge_symbol
+#define elf_backend_special_sections \
+ elf64_x86_64_special_sections
+#define elf_backend_additional_program_headers \
+ elf64_x86_64_additional_program_headers
+#define elf_backend_hash_symbol \
+ elf64_x86_64_hash_symbol
+
+#include "elf64-target.h"
+
+/* FreeBSD support. */
+
+#undef TARGET_LITTLE_SYM
+#define TARGET_LITTLE_SYM bfd_elf64_x86_64_freebsd_vec
+#undef TARGET_LITTLE_NAME
+#define TARGET_LITTLE_NAME "elf64-x86-64-freebsd"
+
+#undef ELF_OSABI
+#define ELF_OSABI ELFOSABI_FREEBSD
+
+#undef elf_backend_post_process_headers
+#define elf_backend_post_process_headers _bfd_elf_set_osabi
+
+#undef elf64_bed
+#define elf64_bed elf64_x86_64_fbsd_bed
+
#include "elf64-target.h"
diff --git a/contrib/binutils/bfd/elf64.c b/contrib/binutils/bfd/elf64.c
index 69fb5b5..5058c0c 100644
--- a/contrib/binutils/bfd/elf64.c
+++ b/contrib/binutils/bfd/elf64.c
@@ -15,7 +15,7 @@ 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. */
+Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
#define ARCH_SIZE 64
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
index bc69d48..191e124 100644
--- a/contrib/binutils/bfd/elfcode.h
+++ b/contrib/binutils/bfd/elfcode.h
@@ -1,6 +1,7 @@
/* ELF executable support for BFD.
Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
- 2001, 2002, 2003 Free Software Foundation, Inc.
+ 2001, 2002, 2003, 2004, 2005, 2006, 2007
+ Free Software Foundation, Inc.
Written by Fred Fish @ Cygnus Support, from information published
in "UNIX System V Release 4, Programmers Guide: ANSI C and
@@ -28,12 +29,12 @@ 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. */
+Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, 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
+ 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
@@ -64,8 +65,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
it's cast in stone.
*/
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libiberty.h"
#include "bfdlink.h"
#include "libbfd.h"
@@ -105,6 +106,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#define elf_canonicalize_symtab NAME(bfd_elf,canonicalize_symtab)
#define elf_canonicalize_dynamic_symtab \
NAME(bfd_elf,canonicalize_dynamic_symtab)
+#define elf_get_synthetic_symtab \
+ NAME(bfd_elf,get_synthetic_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)
@@ -137,10 +140,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#define LOG_FILE_ALIGN 2
#endif
-#ifdef DEBUG
+#if DEBUG & 2
static void elf_debug_section (int, Elf_Internal_Shdr *);
+#endif
+#if DEBUG & 1
static void elf_debug_file (Elf_Internal_Ehdr *);
-static char *elf_symbol_flags (flagword);
#endif
/* Structure swapping routines */
@@ -163,7 +167,7 @@ static char *elf_symbol_flags (flagword);
/* Translate an ELF symbol in external format into an ELF symbol in internal
format. */
-void
+bfd_boolean
elf_swap_symbol_in (bfd *abfd,
const void *psrc,
const void *pshn,
@@ -185,9 +189,10 @@ elf_swap_symbol_in (bfd *abfd,
if (dst->st_shndx == SHN_XINDEX)
{
if (shndx == NULL)
- abort ();
+ return FALSE;
dst->st_shndx = H_GET_32 (abfd, shndx->est_shndx);
}
+ return TRUE;
}
/* Translate an ELF symbol in internal format into an ELF symbol in external
@@ -456,6 +461,25 @@ elf_file_p (Elf_External_Ehdr *x_ehdrp)
&& (x_ehdrp->e_ident[EI_MAG3] == ELFMAG3));
}
+/* Determines if a given section index is valid. */
+
+static inline bfd_boolean
+valid_section_index_p (unsigned index, unsigned num_sections)
+{
+ /* Note: We allow SHN_UNDEF as a valid section index. */
+ if (index < SHN_LORESERVE || index > SHN_HIRESERVE)
+ return index < num_sections;
+
+ /* We disallow the use of reserved indcies, except for those
+ with OS or Application specific meaning. The test make use
+ of the knowledge that:
+ SHN_LORESERVE == SHN_LOPROC
+ and
+ SHN_HIPROC == SHN_LOOS - 1 */
+ /* XXX - Should we allow SHN_XINDEX as a valid index here ? */
+ return (index >= SHN_LOPROC && index <= SHN_HIOS);
+}
+
/* Check to see if the file associated with ABFD matches the target vector
that ABFD points to.
@@ -473,11 +497,12 @@ elf_object_p (bfd *abfd)
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;
+ const bfd_target *target;
+ const bfd_target * const *target_ptr;
preserve.marker = NULL;
@@ -521,10 +546,12 @@ elf_object_p (bfd *abfd)
if (!bfd_preserve_save (abfd, &preserve))
goto got_no_match;
+ target = abfd->xvec;
+
/* 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))
+ if (! (*target->_bfd_set_format[bfd_object]) (abfd))
goto got_no_match;
preserve.marker = elf_tdata (abfd);
@@ -544,7 +571,7 @@ elf_object_p (bfd *abfd)
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
+ /* As a simple sanity check, verify that 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)
@@ -564,8 +591,6 @@ elf_object_p (bfd *abfd)
&& (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;
@@ -606,13 +631,54 @@ elf_object_p (bfd *abfd)
goto got_no_match;
}
- /* Remember the entry point specified in the ELF file header. */
- bfd_set_start_address (abfd, i_ehdrp->e_entry);
+ if (ebd->elf_machine_code != EM_NONE
+ && i_ehdrp->e_ident[EI_OSABI] != ebd->elf_osabi)
+ {
+ if (ebd->elf_osabi != ELFOSABI_NONE)
+ goto got_wrong_format_error;
+
+ /* This is an ELFOSABI_NONE ELF target. Let it match any ELF
+ target of the compatible machine for which we do not have a
+ backend with matching ELFOSABI. */
+ for (target_ptr = bfd_target_vector;
+ *target_ptr != NULL;
+ target_ptr++)
+ {
+ const struct elf_backend_data *back;
+
+ /* Skip this target and targets with incompatible byte
+ order. */
+ if (*target_ptr == target
+ || (*target_ptr)->flavour != bfd_target_elf_flavour
+ || (*target_ptr)->byteorder != target->byteorder
+ || ((*target_ptr)->header_byteorder
+ != target->header_byteorder))
+ continue;
+
+ back = (const struct elf_backend_data *) (*target_ptr)->backend_data;
+ if (back->elf_osabi == i_ehdrp->e_ident[EI_OSABI]
+ && (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 ELFOSABI_NONE ELF target. */
+ goto got_wrong_format_error;
+ }
+ }
+ }
if (i_ehdrp->e_shoff != 0)
{
+ bfd_signed_vma where = i_ehdrp->e_shoff;
+
+ if (where != (file_ptr) where)
+ goto got_wrong_format_error;
+
/* Seek to the section header table in the file. */
- if (bfd_seek (abfd, (file_ptr) i_ehdrp->e_shoff, SEEK_SET) != 0)
+ if (bfd_seek (abfd, (file_ptr) where, SEEK_SET) != 0)
goto got_no_match;
/* Read the first section header at index 0, and convert to internal
@@ -624,11 +690,46 @@ elf_object_p (bfd *abfd)
/* 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;
+ {
+ i_ehdrp->e_shnum = i_shdr.sh_size;
+ if (i_ehdrp->e_shnum != i_shdr.sh_size
+ || i_ehdrp->e_shnum == 0)
+ goto got_wrong_format_error;
+ }
/* And similarly for the string table index. */
if (i_ehdrp->e_shstrndx == SHN_XINDEX)
- i_ehdrp->e_shstrndx = i_shdr.sh_link;
+ {
+ i_ehdrp->e_shstrndx = i_shdr.sh_link;
+ if (i_ehdrp->e_shstrndx != i_shdr.sh_link)
+ goto got_wrong_format_error;
+ }
+
+ /* Sanity check that we can read all of the section headers.
+ It ought to be good enough to just read the last one. */
+ if (i_ehdrp->e_shnum != 1)
+ {
+ /* Check that we don't have a totally silly number of sections. */
+ if (i_ehdrp->e_shnum > (unsigned int) -1 / sizeof (x_shdr)
+ || i_ehdrp->e_shnum > (unsigned int) -1 / sizeof (i_shdr))
+ goto got_wrong_format_error;
+
+ where += (i_ehdrp->e_shnum - 1) * sizeof (x_shdr);
+ if (where != (file_ptr) where)
+ goto got_wrong_format_error;
+ if ((bfd_size_type) where <= i_ehdrp->e_shoff)
+ goto got_wrong_format_error;
+
+ if (bfd_seek (abfd, (file_ptr) where, SEEK_SET) != 0)
+ goto got_no_match;
+ if (bfd_bread (&x_shdr, sizeof x_shdr, abfd) != sizeof (x_shdr))
+ goto got_no_match;
+
+ /* Back to where we were. */
+ where = i_ehdrp->e_shoff + sizeof (x_shdr);
+ if (bfd_seek (abfd, (file_ptr) where, SEEK_SET) != 0)
+ goto got_no_match;
+ }
}
/* Allocate space for a copy of the section header table in
@@ -672,23 +773,45 @@ elf_object_p (bfd *abfd)
goto got_no_match;
elf_swap_shdr_in (abfd, &x_shdr, i_shdrp + shindex);
+ /* Sanity check sh_link and sh_info. */
+ if (! valid_section_index_p (i_shdrp[shindex].sh_link, num_sec))
+ goto got_wrong_format_error;
+
+ if (((i_shdrp[shindex].sh_flags & SHF_INFO_LINK)
+ || i_shdrp[shindex].sh_type == SHT_RELA
+ || i_shdrp[shindex].sh_type == SHT_REL)
+ && ! valid_section_index_p (i_shdrp[shindex].sh_info, num_sec))
+ goto got_wrong_format_error;
+
/* 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)
+ % ebd->minpagesize)
!= 0))
abfd->flags &= ~D_PAGED;
}
}
- if (i_ehdrp->e_shstrndx && i_ehdrp->e_shoff)
+ /* A further sanity check. */
+ if (i_ehdrp->e_shnum != 0)
{
- if (! bfd_section_from_shdr (abfd, i_ehdrp->e_shstrndx))
- goto got_no_match;
+ if (! valid_section_index_p (i_ehdrp->e_shstrndx, elf_numsections (abfd)))
+ {
+ /* PR 2257:
+ We used to just goto got_wrong_format_error here
+ but there are binaries in existance for which this test
+ will prevent the binutils from working with them at all.
+ So we are kind, and reset the string index value to 0
+ so that at least some processing can be done. */
+ i_ehdrp->e_shstrndx = SHN_UNDEF;
+ _bfd_error_handler (_("warning: %s has a corrupt string table index - ignoring"), abfd->filename);
+ }
}
+ else if (i_ehdrp->e_shstrndx != SHN_UNDEF)
+ goto got_wrong_format_error;
/* Read in the program headers. */
if (i_ehdrp->e_phnum == 0)
@@ -715,20 +838,10 @@ elf_object_p (bfd *abfd)
}
}
- /* 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)
+ if (i_ehdrp->e_shstrndx != 0 && i_ehdrp->e_shoff != 0)
{
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. */
@@ -740,6 +853,10 @@ elf_object_p (bfd *abfd)
if (shindex == SHN_LORESERVE - 1)
shindex += SHN_HIRESERVE + 1 - SHN_LORESERVE;
}
+
+ /* Set up ELF sections for SHF_GROUP and SHF_LINK_ORDER. */
+ if (! _bfd_elf_setup_sections (abfd))
+ goto got_wrong_format_error;
}
/* Let the backend double check the format and override global
@@ -750,6 +867,9 @@ elf_object_p (bfd *abfd)
goto got_wrong_format_error;
}
+ /* Remember the entry point specified in the ELF file header. */
+ bfd_set_start_address (abfd, i_ehdrp->e_entry);
+
/* 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)
@@ -770,7 +890,7 @@ elf_object_p (bfd *abfd)
}
bfd_preserve_finish (abfd, &preserve);
- return abfd->xvec;
+ return target;
got_wrong_format_error:
/* There is way too much undoing of half-known state here. The caller,
@@ -821,6 +941,12 @@ elf_write_relocs (bfd *abfd, asection *sec, void *data)
if (sec->reloc_count == 0)
return;
+ /* If we have opened an existing file for update, reloc_count may be
+ set even though we are not linking. In that case we have nothing
+ to do. */
+ if (sec->orelocation == NULL)
+ return;
+
rela_hdr = &elf_section_data (sec)->rel_hdr;
rela_hdr->sh_size = rela_hdr->sh_entsize * sec->reloc_count;
@@ -1020,7 +1146,7 @@ elf_slurp_symbol_table (bfd *abfd, asymbol **symptrs, bfd_boolean dynamic)
|| (elf_tdata (abfd)->dynverref_section != 0
&& elf_tdata (abfd)->verref == NULL))
{
- if (! _bfd_elf_slurp_version_tables (abfd))
+ if (!_bfd_elf_slurp_version_tables (abfd, FALSE))
return -1;
}
}
@@ -1053,7 +1179,7 @@ elf_slurp_symbol_table (bfd *abfd, asymbol **symptrs, bfd_boolean dynamic)
symcount);
/* Slurp in the symbols without the version information,
- since that is more helpful than just quitting. */
+ since that is more helpful than just quitting. */
verhdr = NULL;
}
@@ -1080,9 +1206,7 @@ elf_slurp_symbol_table (bfd *abfd, asymbol **symptrs, bfd_boolean dynamic)
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.name = bfd_elf_sym_name (abfd, hdr, isym, NULL);
sym->symbol.value = isym->st_value;
@@ -1120,7 +1244,7 @@ elf_slurp_symbol_table (bfd *abfd, asymbol **symptrs, bfd_boolean dynamic)
sym->symbol.section = bfd_abs_section_ptr;
/* If this is a relocatable file, then the symbol value is
- already section relative. */
+ already section relative. */
if ((abfd->flags & (EXEC_P | DYNAMIC)) != 0)
sym->symbol.value -= sym->symbol.section->vma;
@@ -1152,6 +1276,15 @@ elf_slurp_symbol_table (bfd *abfd, asymbol **symptrs, bfd_boolean dynamic)
case STT_OBJECT:
sym->symbol.flags |= BSF_OBJECT;
break;
+ case STT_TLS:
+ sym->symbol.flags |= BSF_THREAD_LOCAL;
+ break;
+ case STT_RELC:
+ sym->symbol.flags |= BSF_RELC;
+ break;
+ case STT_SRELC:
+ sym->symbol.flags |= BSF_SRELC;
+ break;
}
if (dynamic)
@@ -1208,7 +1341,7 @@ error_return:
return -1;
}
-/* Read relocations for ASECT from REL_HDR. There are RELOC_COUNT of
+/* Read relocations for ASECT from REL_HDR. There are RELOC_COUNT of
them. */
static bfd_boolean
@@ -1279,16 +1412,11 @@ elf_slurp_reloc_table_from_section (bfd *abfd,
}
else
{
- asymbol **ps, *s;
+ asymbol **ps;
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->sym_ptr_ptr = ps;
}
relent->addend = rela.r_addend;
@@ -1353,7 +1481,7 @@ elf_slurp_reloc_table (bfd *abfd,
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)
+ if (asect->size == 0)
return TRUE;
rel_hdr = &d->this_hdr;
@@ -1384,7 +1512,7 @@ elf_slurp_reloc_table (bfd *abfd,
return TRUE;
}
-#ifdef DEBUG
+#if DEBUG & 2
static void
elf_debug_section (int num, Elf_Internal_Shdr *hdr)
{
@@ -1410,7 +1538,9 @@ elf_debug_section (int num, Elf_Internal_Shdr *hdr)
(long) hdr->sh_entsize);
fflush (stderr);
}
+#endif
+#if DEBUG & 1
static void
elf_debug_file (Elf_Internal_Ehdr *ehdrp)
{
@@ -1422,77 +1552,6 @@ elf_debug_file (Elf_Internal_Ehdr *ehdrp)
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,
@@ -1513,7 +1572,7 @@ NAME(_bfd_elf,bfd_from_remote_memory)
(bfd *templ,
bfd_vma ehdr_vma,
bfd_vma *loadbasep,
- int (*target_read_memory) (bfd_vma, char *, int))
+ int (*target_read_memory) (bfd_vma, bfd_byte *, int))
{
Elf_External_Ehdr x_ehdr; /* Elf file header, external form */
Elf_Internal_Ehdr i_ehdr; /* Elf file header, internal form */
@@ -1522,13 +1581,13 @@ NAME(_bfd_elf,bfd_from_remote_memory)
bfd *nbfd;
struct bfd_in_memory *bim;
int contents_size;
- char *contents;
+ bfd_byte *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);
+ err = target_read_memory (ehdr_vma, (bfd_byte *) &x_ehdr, sizeof x_ehdr);
if (err)
{
bfd_set_error (bfd_error_system_call);
@@ -1588,7 +1647,7 @@ NAME(_bfd_elf,bfd_from_remote_memory)
bfd_set_error (bfd_error_no_memory);
return NULL;
}
- err = target_read_memory (ehdr_vma + i_ehdr.e_phoff, (char *) x_phdrs,
+ err = target_read_memory (ehdr_vma + i_ehdr.e_phoff, (bfd_byte *) x_phdrs,
i_ehdr.e_phnum * sizeof x_phdrs[0]);
if (err)
{
@@ -1605,7 +1664,10 @@ NAME(_bfd_elf,bfd_from_remote_memory)
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)
+ /* IA-64 vDSO may have two mappings for one segment, where one mapping
+ is executable only, and one is read only. We must not use the
+ executable one. */
+ if (i_phdrs[i].p_type == PT_LOAD && (i_phdrs[i].p_flags & PF_R))
{
bfd_vma segment_end;
segment_end = (i_phdrs[i].p_offset + i_phdrs[i].p_filesz
@@ -1652,7 +1714,10 @@ NAME(_bfd_elf,bfd_from_remote_memory)
}
for (i = 0; i < i_ehdr.e_phnum; ++i)
- if (i_phdrs[i].p_type == PT_LOAD)
+ /* IA-64 vDSO may have two mappings for one segment, where one mapping
+ is executable only, and one is read only. We must not use the
+ executable one. */
+ if (i_phdrs[i].p_type == PT_LOAD && (i_phdrs[i].p_flags & PF_R))
{
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
diff --git a/contrib/binutils/bfd/elfcore.h b/contrib/binutils/bfd/elfcore.h
index 81c4cff..b1cf42d 100644
--- a/contrib/binutils/bfd/elfcore.h
+++ b/contrib/binutils/bfd/elfcore.h
@@ -1,5 +1,5 @@
/* ELF core file support for BFD.
- Copyright 1995, 1996, 1997, 1998, 2000, 2001, 2002, 2003
+ Copyright 1995, 1996, 1997, 1998, 2000, 2001, 2002, 2003, 2005
Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@@ -16,7 +16,7 @@
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. */
+ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
char*
elf_core_file_failing_command (bfd *abfd)
@@ -207,12 +207,19 @@ elf_core_file_p (bfd *abfd)
/* 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))
- {
+ 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;
- }
+ && ebd->elf_machine_code != EM_NONE)
+ goto fail;
+
+ /* Let the backend double check the format and override global
+ information. We do this before processing the program headers
+ to allow the correct machine (as opposed to just the default
+ machine) to be set, making it possible for grok_prstatus and
+ grok_psinfo to rely on the mach setting. */
+ if (ebd->elf_backend_object_p != NULL
+ && ! ebd->elf_backend_object_p (abfd))
+ goto wrong;
/* Process each program header. */
for (phindex = 0; phindex < i_ehdrp->e_phnum; ++phindex)
@@ -222,12 +229,6 @@ elf_core_file_p (bfd *abfd)
/* 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;
diff --git a/contrib/binutils/bfd/elflink.c b/contrib/binutils/bfd/elflink.c
index 6628db3..331ae4f 100644
--- a/contrib/binutils/bfd/elflink.c
+++ b/contrib/binutils/bfd/elflink.c
@@ -1,31 +1,70 @@
/* ELF linking support for BFD.
- Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004
- Free Software Foundation, Inc.
+ Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
+ 2005, 2006, 2007 Free Software Foundation, Inc.
-This file is part of BFD, the Binary File Descriptor library.
+ 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 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.
+ 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. */
+ 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., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "bfdlink.h"
#include "libbfd.h"
#define ARCH_SIZE 0
#include "elf-bfd.h"
#include "safe-ctype.h"
#include "libiberty.h"
+#include "objalloc.h"
+
+/* Define a symbol in a dynamic linkage section. */
+
+struct elf_link_hash_entry *
+_bfd_elf_define_linkage_sym (bfd *abfd,
+ struct bfd_link_info *info,
+ asection *sec,
+ const char *name)
+{
+ struct elf_link_hash_entry *h;
+ struct bfd_link_hash_entry *bh;
+ const struct elf_backend_data *bed;
+
+ h = elf_link_hash_lookup (elf_hash_table (info), name, FALSE, FALSE, FALSE);
+ if (h != NULL)
+ {
+ /* Zap symbol defined in an as-needed lib that wasn't linked.
+ This is a symptom of a larger problem: Absolute symbols
+ defined in shared libraries can't be overridden, because we
+ lose the link to the bfd which is via the symbol section. */
+ h->root.type = bfd_link_hash_new;
+ }
+
+ bh = &h->root;
+ if (!_bfd_generic_link_add_one_symbol (info, abfd, name, BSF_GLOBAL,
+ sec, 0, NULL, FALSE,
+ get_elf_backend_data (abfd)->collect,
+ &bh))
+ return NULL;
+ h = (struct elf_link_hash_entry *) bh;
+ h->def_regular = 1;
+ h->type = STT_OBJECT;
+ h->other = (h->other & ~ELF_ST_VISIBILITY (-1)) | STV_HIDDEN;
+
+ bed = get_elf_backend_data (abfd);
+ (*bed->elf_backend_hide_symbol) (info, h, TRUE);
+ return h;
+}
bfd_boolean
_bfd_elf_create_got_section (bfd *abfd, struct bfd_link_info *info)
@@ -33,7 +72,6 @@ _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;
@@ -57,20 +95,17 @@ _bfd_elf_create_got_section (bfd *abfd, struct bfd_link_info *info)
return FALSE;
}
- flags = (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS | SEC_IN_MEMORY
- | SEC_LINKER_CREATED);
+ flags = bed->dynamic_sec_flags;
- s = bfd_make_section (abfd, ".got");
+ s = bfd_make_section_with_flags (abfd, ".got", flags);
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");
+ s = bfd_make_section_with_flags (abfd, ".got.plt", flags);
if (s == NULL
- || !bfd_set_section_flags (abfd, s, flags)
|| !bfd_set_section_alignment (abfd, s, ptralign))
return FALSE;
}
@@ -81,28 +116,37 @@ _bfd_elf_create_got_section (bfd *abfd, struct bfd_link_info *info)
(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;
-
+ h = _bfd_elf_define_linkage_sym (abfd, info, s, "_GLOBAL_OFFSET_TABLE_");
elf_hash_table (info)->hgot = h;
+ if (h == NULL)
+ return FALSE;
}
/* The first bit of the global offset table is the header. */
- s->_raw_size += bed->got_header_size + bed->got_symbol_offset;
+ s->size += bed->got_header_size;
return TRUE;
}
+/* Create a strtab to hold the dynamic symbol names. */
+static bfd_boolean
+_bfd_elf_link_create_dynstrtab (bfd *abfd, struct bfd_link_info *info)
+{
+ struct elf_link_hash_table *hash_table;
+
+ hash_table = elf_hash_table (info);
+ if (hash_table->dynobj == NULL)
+ hash_table->dynobj = abfd;
+
+ if (hash_table->dynstr == NULL)
+ {
+ hash_table->dynstr = _bfd_elf_strtab_init ();
+ if (hash_table->dynstr == NULL)
+ return FALSE;
+ }
+ 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
@@ -115,8 +159,6 @@ _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))
@@ -125,111 +167,93 @@ _bfd_elf_link_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info)
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;
+ if (!_bfd_elf_link_create_dynstrtab (abfd, info))
+ return FALSE;
- /* 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);
+ abfd = elf_hash_table (info)->dynobj;
+ bed = get_elf_backend_data (abfd);
+
+ flags = bed->dynamic_sec_flags;
/* 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))
+ s = bfd_make_section_with_flags (abfd, ".interp",
+ flags | SEC_READONLY);
+ if (s == NULL)
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");
+ s = bfd_make_section_with_flags (abfd, ".gnu.version_d",
+ flags | SEC_READONLY);
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");
+ s = bfd_make_section_with_flags (abfd, ".gnu.version",
+ flags | SEC_READONLY);
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");
+ s = bfd_make_section_with_flags (abfd, ".gnu.version_r",
+ flags | SEC_READONLY);
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");
+ s = bfd_make_section_with_flags (abfd, ".dynsym",
+ flags | SEC_READONLY);
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))
+ s = bfd_make_section_with_flags (abfd, ".dynstr",
+ flags | SEC_READONLY);
+ if (s == NULL)
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");
+ s = bfd_make_section_with_flags (abfd, ".dynamic", flags);
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)))
+ .dynamic section. 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. */
+ if (!_bfd_elf_define_linkage_sym (abfd, info, s, "_DYNAMIC"))
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;
+ if (info->emit_hash)
+ {
+ s = bfd_make_section_with_flags (abfd, ".hash", flags | SEC_READONLY);
+ if (s == NULL
+ || ! 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;
+ }
- 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;
+ if (info->emit_gnu_hash)
+ {
+ s = bfd_make_section_with_flags (abfd, ".gnu.hash",
+ flags | SEC_READONLY);
+ if (s == NULL
+ || ! bfd_set_section_alignment (abfd, s, bed->s->log_file_align))
+ return FALSE;
+ /* For 64-bit ELF, .gnu.hash is a non-uniform entity size section:
+ 4 32-bit words followed by variable count of 64-bit words, then
+ variable count of 32-bit words. */
+ if (bed->s->arch_size == 64)
+ elf_section_data (s)->this_hdr.sh_entsize = 0;
+ else
+ elf_section_data (s)->this_hdr.sh_entsize = 4;
+ }
/* Let the backend create the rest of the sections. This lets the
backend set the right flags. The backend will normally create
@@ -248,52 +272,46 @@ bfd_boolean
_bfd_elf_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info)
{
flagword flags, pltflags;
+ struct elf_link_hash_entry *h;
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);
+ flags = bed->dynamic_sec_flags;
pltflags = flags;
- pltflags |= SEC_CODE;
if (bed->plt_not_loaded)
+ /* We do not clear SEC_ALLOC here because we still want the OS to
+ allocate space for the section; it's just that there's nothing
+ to read in from the object file. */
pltflags &= ~ (SEC_CODE | SEC_LOAD | SEC_HAS_CONTENTS);
+ else
+ pltflags |= SEC_ALLOC | SEC_CODE | SEC_LOAD;
if (bed->plt_readonly)
pltflags |= SEC_READONLY;
- s = bfd_make_section (abfd, ".plt");
+ s = bfd_make_section_with_flags (abfd, ".plt", pltflags);
if (s == NULL
- || ! bfd_set_section_flags (abfd, s, pltflags)
|| ! bfd_set_section_alignment (abfd, s, bed->plt_alignment))
return FALSE;
+ /* Define the symbol _PROCEDURE_LINKAGE_TABLE_ at the start of the
+ .plt section. */
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))
+ h = _bfd_elf_define_linkage_sym (abfd, info, s,
+ "_PROCEDURE_LINKAGE_TABLE_");
+ elf_hash_table (info)->hplt = h;
+ if (h == NULL)
return FALSE;
}
- s = bfd_make_section (abfd,
- bed->default_use_rela_p ? ".rela.plt" : ".rel.plt");
+ s = bfd_make_section_with_flags (abfd,
+ (bed->default_use_rela_p
+ ? ".rela.plt" : ".rel.plt"),
+ flags | SEC_READONLY);
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;
@@ -308,29 +326,30 @@ _bfd_elf_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info)
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))
+ s = bfd_make_section_with_flags (abfd, ".dynbss",
+ (SEC_ALLOC
+ | SEC_LINKER_CREATED));
+ if (s == NULL)
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. */
+ 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"));
+ s = bfd_make_section_with_flags (abfd,
+ (bed->default_use_rela_p
+ ? ".rela.bss" : ".rel.bss"),
+ flags | SEC_READONLY);
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;
}
@@ -369,8 +388,9 @@ bfd_elf_link_record_dynamic_symbol (struct bfd_link_info *info,
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;
+ h->forced_local = 1;
+ if (!elf_hash_table (info)->is_relocatable_executable)
+ return TRUE;
}
default:
@@ -414,41 +434,74 @@ bfd_elf_link_record_dynamic_symbol (struct bfd_link_info *info,
return TRUE;
}
+/* Mark a symbol dynamic. */
+
+void
+bfd_elf_link_mark_dynamic_symbol (struct bfd_link_info *info,
+ struct elf_link_hash_entry *h,
+ Elf_Internal_Sym *sym)
+{
+ struct bfd_elf_dynamic_list *d = info->dynamic_list;
+
+ /* It may be called more than once on the same H. */
+ if(h->dynamic || info->relocatable)
+ return;
+
+ if ((info->dynamic_data
+ && (h->type == STT_OBJECT
+ || (sym != NULL
+ && ELF_ST_TYPE (sym->st_info) == STT_OBJECT)))
+ || (d != NULL
+ && h->root.type == bfd_link_hash_new
+ && (*d->match) (&d->head, NULL, h->root.root.string)))
+ h->dynamic = 1;
+}
+
/* 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,
+bfd_elf_record_link_assignment (bfd *output_bfd,
struct bfd_link_info *info,
const char *name,
- bfd_boolean provide)
+ bfd_boolean provide,
+ bfd_boolean hidden)
{
struct elf_link_hash_entry *h;
+ struct elf_link_hash_table *htab;
if (!is_elf_hash_table (info->hash))
return TRUE;
- h = elf_link_hash_lookup (elf_hash_table (info), name, TRUE, TRUE, FALSE);
+ htab = elf_hash_table (info);
+ h = elf_link_hash_lookup (htab, name, !provide, TRUE, FALSE);
if (h == NULL)
- return FALSE;
+ return provide;
/* 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;
+ {
+ h->root.type = bfd_link_hash_new;
+ if (h->root.u.undef.next != NULL || htab->root.undefs_tail == &h->root)
+ bfd_link_repair_undef_list (&htab->root);
+ }
if (h->root.type == bfd_link_hash_new)
- h->elf_link_hash_flags &= ~ELF_LINK_NON_ELF;
+ {
+ bfd_elf_link_mark_dynamic_symbol (info, h, NULL);
+ h->non_elf = 0;
+ }
/* 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->def_dynamic
+ && !h->def_regular)
h->root.type = bfd_link_hash_undefined;
/* If this symbol is not being provided by the linker script, and it is
@@ -456,15 +509,32 @@ bfd_elf_record_link_assignment (bfd *output_bfd ATTRIBUTE_UNUSED,
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->def_dynamic
+ && !h->def_regular)
h->verinfo.verdef = NULL;
- h->elf_link_hash_flags |= ELF_LINK_HASH_DEF_REGULAR;
+ h->def_regular = 1;
- if (((h->elf_link_hash_flags & (ELF_LINK_HASH_DEF_DYNAMIC
- | ELF_LINK_HASH_REF_DYNAMIC)) != 0
- || info->shared)
+ if (provide && hidden)
+ {
+ const struct elf_backend_data *bed = get_elf_backend_data (output_bfd);
+
+ h->other = (h->other & ~ELF_ST_VISIBILITY (-1)) | STV_HIDDEN;
+ (*bed->elf_backend_hide_symbol) (info, h, TRUE);
+ }
+
+ /* STV_HIDDEN and STV_INTERNAL symbols must be STB_LOCAL in shared objects
+ and executables. */
+ if (!info->relocatable
+ && h->dynindx != -1
+ && (ELF_ST_VISIBILITY (h->other) == STV_HIDDEN
+ || ELF_ST_VISIBILITY (h->other) == STV_INTERNAL))
+ h->forced_local = 1;
+
+ if ((h->def_dynamic
+ || h->ref_dynamic
+ || info->shared
+ || (info->executable && elf_hash_table (info)->is_relocatable_executable))
&& h->dynindx == -1)
{
if (! bfd_elf_link_record_dynamic_symbol (info, h))
@@ -473,10 +543,10 @@ bfd_elf_record_link_assignment (bfd *output_bfd ATTRIBUTE_UNUSED,
/* 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 (h->u.weakdef != NULL
+ && h->u.weakdef->dynindx == -1)
{
- if (! bfd_elf_link_record_dynamic_symbol (info, h->weakdef))
+ if (! bfd_elf_link_record_dynamic_symbol (info, h->u.weakdef))
return FALSE;
}
}
@@ -602,29 +672,111 @@ elf_link_renumber_hash_table_dynsyms (struct elf_link_hash_entry *h,
if (h->root.type == bfd_link_hash_warning)
h = (struct elf_link_hash_entry *) h->root.u.i.link;
+ if (h->forced_local)
+ return TRUE;
+
if (h->dynindx != -1)
h->dynindx = ++(*count);
return TRUE;
}
+
+/* Like elf_link_renumber_hash_table_dynsyms, but just number symbols with
+ STB_LOCAL binding. */
+
+static bfd_boolean
+elf_link_renumber_local_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->forced_local)
+ return TRUE;
+
+ if (h->dynindx != -1)
+ h->dynindx = ++(*count);
+
+ return TRUE;
+}
+
+/* Return true if the dynamic symbol for a given section should be
+ omitted when creating a shared library. */
+bfd_boolean
+_bfd_elf_link_omit_section_dynsym (bfd *output_bfd ATTRIBUTE_UNUSED,
+ struct bfd_link_info *info,
+ asection *p)
+{
+ struct elf_link_hash_table *htab;
+
+ switch (elf_section_data (p)->this_hdr.sh_type)
+ {
+ case SHT_PROGBITS:
+ case SHT_NOBITS:
+ /* If sh_type is yet undecided, assume it could be
+ SHT_PROGBITS/SHT_NOBITS. */
+ case SHT_NULL:
+ htab = elf_hash_table (info);
+ if (p == htab->tls_sec)
+ return FALSE;
+
+ if (htab->text_index_section != NULL)
+ return p != htab->text_index_section && p != htab->data_index_section;
+
+ if (strcmp (p->name, ".got") == 0
+ || strcmp (p->name, ".got.plt") == 0
+ || strcmp (p->name, ".plt") == 0)
+ {
+ asection *ip;
+
+ if (htab->dynobj != NULL
+ && (ip = bfd_get_section_by_name (htab->dynobj, p->name)) != NULL
+ && (ip->flags & SEC_LINKER_CREATED)
+ && ip->output_section == p)
+ return TRUE;
+ }
+ return FALSE;
+
+ /* There shouldn't be section relative relocations
+ against any other section. */
+ default:
+ 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. */
+ symbol for each output section, which come first. Next come symbols
+ which have been forced to local binding. Then 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)
+static unsigned long
+_bfd_elf_link_renumber_dynsyms (bfd *output_bfd,
+ struct bfd_link_info *info,
+ unsigned long *section_sym_count)
{
unsigned long dynsymcount = 0;
- if (info->shared)
+ if (info->shared || elf_hash_table (info)->is_relocatable_executable)
{
+ const struct elf_backend_data *bed = get_elf_backend_data (output_bfd);
asection *p;
for (p = output_bfd->sections; p ; p = p->next)
- if ((p->flags & SEC_EXCLUDE) == 0)
+ if ((p->flags & SEC_EXCLUDE) == 0
+ && (p->flags & SEC_ALLOC) != 0
+ && !(*bed->elf_backend_omit_section_dynsym) (output_bfd, info, p))
elf_section_data (p)->dynindx = ++dynsymcount;
+ else
+ elf_section_data (p)->dynindx = 0;
}
+ *section_sym_count = dynsymcount;
+
+ elf_link_hash_traverse (elf_hash_table (info),
+ elf_link_renumber_local_hash_table_dynsyms,
+ &dynsymcount);
if (elf_hash_table (info)->dynlocal)
{
@@ -643,7 +795,8 @@ _bfd_elf_link_renumber_dynsyms (bfd *output_bfd, struct bfd_link_info *info)
if (dynsymcount != 0)
++dynsymcount;
- return elf_hash_table (info)->dynsymcount = dynsymcount;
+ elf_hash_table (info)->dynsymcount = dynsymcount;
+ return dynsymcount;
}
/* This function is called when we want to define a new symbol. It
@@ -655,7 +808,8 @@ _bfd_elf_link_renumber_dynsyms (bfd *output_bfd, struct bfd_link_info *info)
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. */
+ change. We set POLD_ALIGNMENT if an old common symbol in a dynamic
+ object is overridden by a regular object. */
bfd_boolean
_bfd_elf_merge_symbol (bfd *abfd,
@@ -664,19 +818,21 @@ _bfd_elf_merge_symbol (bfd *abfd,
Elf_Internal_Sym *sym,
asection **psec,
bfd_vma *pvalue,
+ unsigned int *pold_alignment,
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;
+ asection *sec, *oldsec;
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;
+ const struct elf_backend_data *bed;
*skip = FALSE;
*override = FALSE;
@@ -684,6 +840,15 @@ _bfd_elf_merge_symbol (bfd *abfd,
sec = *psec;
bind = ELF_ST_BIND (sym->st_info);
+ /* Silently discard TLS symbols from --just-syms. There's no way to
+ combine a static TLS block with a new TLS block for this executable. */
+ if (ELF_ST_TYPE (sym->st_info) == STT_TLS
+ && sec->sec_info_type == ELF_INFO_TYPE_JUST_SYMS)
+ {
+ *skip = TRUE;
+ return TRUE;
+ }
+
if (! bfd_is_und_section (sec))
h = elf_link_hash_lookup (elf_hash_table (info), name, TRUE, FALSE, FALSE);
else
@@ -693,9 +858,11 @@ _bfd_elf_merge_symbol (bfd *abfd,
return FALSE;
*sym_hash = h;
+ bed = get_elf_backend_data (abfd);
+
/* 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)
+ if (!(*bed->relocs_compatible) (abfd->xvec, info->hash->creator))
return TRUE;
/* For merging, we only care about real symbols. */
@@ -704,36 +871,46 @@ _bfd_elf_merge_symbol (bfd *abfd,
|| h->root.type == bfd_link_hash_warning)
h = (struct elf_link_hash_entry *) h->root.u.i.link;
+ /* We have to check it for every instance since the first few may be
+ refereences and not all compilers emit symbol type for undefined
+ symbols. */
+ bfd_elf_link_mark_dynamic_symbol (info, h, sym);
+
/* 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;
+ h->non_elf = 0;
return TRUE;
}
- /* OLDBFD is a BFD associated with the existing symbol. */
+ /* OLDBFD and OLDSEC are a BFD and an ASECTION associated with the
+ existing symbol. */
switch (h->root.type)
{
default:
oldbfd = NULL;
+ oldsec = NULL;
break;
case bfd_link_hash_undefined:
case bfd_link_hash_undefweak:
oldbfd = h->root.u.undef.abfd;
+ oldsec = NULL;
break;
case bfd_link_hash_defined:
case bfd_link_hash_defweak:
oldbfd = h->root.u.def.section->owner;
+ oldsec = h->root.u.def.section;
break;
case bfd_link_hash_common:
oldbfd = h->root.u.c.p->section->owner;
+ oldsec = h->root.u.c.p->section;
break;
}
@@ -745,81 +922,124 @@ _bfd_elf_merge_symbol (bfd *abfd,
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))
+ || !h->def_regular))
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;
+ newdyn = (abfd->flags & DYNAMIC) != 0;
+ olddyn = FALSE;
if (oldbfd != NULL)
olddyn = (oldbfd->flags & DYNAMIC) != 0;
- else
+ else if (oldsec != NULL)
{
- asection *hsec;
-
- /* This code handles the special SHN_MIPS_{TEXT,DATA} section
+ /* This 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;
+ olddyn = (oldsec->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;
+ newdef = !bfd_is_und_section (sec) && !bfd_is_com_section (sec);
+
+ olddef = (h->root.type != bfd_link_hash_undefined
+ && h->root.type != bfd_link_hash_undefweak
+ && h->root.type != bfd_link_hash_common);
+
+ /* When we try to create a default indirect symbol from the dynamic
+ definition with the default version, we skip it if its type and
+ the type of existing regular definition mismatch. We only do it
+ if the existing regular definition won't be dynamic. */
+ if (pold_alignment == NULL
+ && !info->shared
+ && !info->export_dynamic
+ && !h->ref_dynamic
+ && newdyn
+ && newdef
+ && !olddyn
+ && (olddef || h->root.type == bfd_link_hash_common)
+ && ELF_ST_TYPE (sym->st_info) != h->type
+ && ELF_ST_TYPE (sym->st_info) != STT_NOTYPE
+ && h->type != STT_NOTYPE
+ && !(bed->is_function_type (ELF_ST_TYPE (sym->st_info))
+ && bed->is_function_type (h->type)))
+ {
+ *skip = TRUE;
+ return 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;
+ /* Check TLS symbol. We don't check undefined symbol introduced by
+ "ld -u". */
+ if ((ELF_ST_TYPE (sym->st_info) == STT_TLS || h->type == STT_TLS)
+ && ELF_ST_TYPE (sym->st_info) != h->type
+ && oldbfd != NULL)
+ {
+ bfd *ntbfd, *tbfd;
+ bfd_boolean ntdef, tdef;
+ asection *ntsec, *tsec;
+
+ if (h->type == STT_TLS)
+ {
+ ntbfd = abfd;
+ ntsec = sec;
+ ntdef = newdef;
+ tbfd = oldbfd;
+ tsec = oldsec;
+ tdef = olddef;
+ }
+ else
+ {
+ ntbfd = oldbfd;
+ ntsec = oldsec;
+ ntdef = olddef;
+ tbfd = abfd;
+ tsec = sec;
+ tdef = newdef;
+ }
+
+ if (tdef && ntdef)
+ (*_bfd_error_handler)
+ (_("%s: TLS definition in %B section %A mismatches non-TLS definition in %B section %A"),
+ tbfd, tsec, ntbfd, ntsec, h->root.root.string);
+ else if (!tdef && !ntdef)
+ (*_bfd_error_handler)
+ (_("%s: TLS reference in %B mismatches non-TLS reference in %B"),
+ tbfd, ntbfd, h->root.root.string);
+ else if (tdef)
+ (*_bfd_error_handler)
+ (_("%s: TLS definition in %B section %A mismatches non-TLS reference in %B"),
+ tbfd, tsec, ntbfd, h->root.root.string);
+ else
+ (*_bfd_error_handler)
+ (_("%s: TLS reference in %B mismatches non-TLS definition in %B section %A"),
+ tbfd, ntbfd, ntsec, h->root.root.string);
+
+ bfd_set_error (bfd_error_bad_value);
+ return FALSE;
+ }
/* 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 (newdyn && !h->dynamic_def)
{
if (!bfd_is_und_section (sec))
- h->elf_link_hash_flags |= ELF_LINK_DYNAMIC_DEF;
+ h->dynamic_def = 1;
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 (!h->ref_dynamic)
{
if (bind == STB_WEAK)
- h->elf_link_hash_flags |= ELF_LINK_DYNAMIC_WEAK;
+ h->dynamic_weak = 1;
}
else if (bind != STB_WEAK)
- h->elf_link_hash_flags &= ~ELF_LINK_DYNAMIC_WEAK;
+ h->dynamic_weak = 0;
}
}
@@ -831,7 +1051,7 @@ _bfd_elf_merge_symbol (bfd *abfd,
{
*skip = TRUE;
/* Make sure this symbol is dynamic. */
- h->elf_link_hash_flags |= ELF_LINK_HASH_REF_DYNAMIC;
+ h->ref_dynamic = 1;
/* A protected symbol has external availability. Make sure it is
recorded as dynamic.
@@ -843,25 +1063,58 @@ _bfd_elf_merge_symbol (bfd *abfd,
}
else if (!newdyn
&& ELF_ST_VISIBILITY (sym->st_other) != STV_DEFAULT
- && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) != 0)
+ && h->def_dynamic)
{
/* 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;
+ {
+ /* Handle the case where the old dynamic definition is
+ default versioned. We need to copy the symbol info from
+ the symbol with default version to the normal one if it
+ was referenced before. */
+ if (h->ref_regular)
+ {
+ const struct elf_backend_data *bed
+ = get_elf_backend_data (abfd);
+ struct elf_link_hash_entry *vh = *sym_hash;
+ vh->root.type = h->root.type;
+ h->root.type = bfd_link_hash_indirect;
+ (*bed->elf_backend_copy_indirect_symbol) (info, vh, h);
+ /* Protected symbols will override the dynamic definition
+ with default version. */
+ if (ELF_ST_VISIBILITY (sym->st_other) == STV_PROTECTED)
+ {
+ h->root.u.i.link = (struct bfd_link_hash_entry *) vh;
+ vh->dynamic_def = 1;
+ vh->ref_dynamic = 1;
+ }
+ else
+ {
+ h->root.type = vh->root.type;
+ vh->ref_dynamic = 0;
+ /* We have to hide it here since it was made dynamic
+ global with extra bits when the symbol info was
+ copied from the old dynamic definition. */
+ (*bed->elf_backend_hide_symbol) (info, vh, TRUE);
+ }
+ h = vh;
+ }
+ else
+ h = *sym_hash;
+ }
- if ((h->root.und_next || info->hash->undefs_tail == &h->root)
+ if ((h->root.u.undef.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
+ 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
@@ -870,11 +1123,11 @@ _bfd_elf_merge_symbol (bfd *abfd,
h->root.u.undef.abfd = NULL;
}
- if (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC)
+ if (h->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);
+ h->def_dynamic = 0;
+ h->ref_dynamic = 1;
+ h->dynamic_def = 1;
}
/* FIXME: Should we check type and size for protected symbol? */
h->size = 0;
@@ -903,6 +1156,11 @@ _bfd_elf_merge_symbol (bfd *abfd,
if (olddef && newdyn)
oldweak = FALSE;
+ /* Allow changes between different types of funciton symbol. */
+ if (bed->is_function_type (ELF_ST_TYPE (sym->st_info))
+ && bed->is_function_type (h->type))
+ *type_change_ok = TRUE;
+
/* 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. */
@@ -949,7 +1207,7 @@ _bfd_elf_merge_symbol (bfd *abfd,
&& (sec->flags & SEC_ALLOC) != 0
&& (sec->flags & SEC_LOAD) == 0
&& sym->st_size > 0
- && ELF_ST_TYPE (sym->st_info) != STT_FUNC)
+ && !bed->is_function_type (ELF_ST_TYPE (sym->st_info)))
newdyncommon = TRUE;
else
newdyncommon = FALSE;
@@ -957,15 +1215,27 @@ _bfd_elf_merge_symbol (bfd *abfd,
if (olddyn
&& olddef
&& h->root.type == bfd_link_hash_defined
- && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) != 0
+ && h->def_dynamic
&& (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)
+ && !bed->is_function_type (h->type))
olddyncommon = TRUE;
else
olddyncommon = FALSE;
+ /* We now know everything about the old and new symbols. We ask the
+ backend to check if we can merge them. */
+ if (bed->merge_symbol
+ && !bed->merge_symbol (info, sym_hash, h, sym, psec, pvalue,
+ pold_alignment, skip, override,
+ type_change_ok, size_change_ok,
+ &newdyn, &newdef, &newdyncommon, &newweak,
+ abfd, &sec,
+ &olddyn, &olddef, &olddyncommon, &oldweak,
+ oldbfd, &oldsec))
+ return 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. */
@@ -1010,7 +1280,7 @@ _bfd_elf_merge_symbol (bfd *abfd,
&& (olddef
|| (h->root.type == bfd_link_hash_common
&& (newweak
- || ELF_ST_TYPE (sym->st_info) == STT_FUNC))))
+ || bed->is_function_type (ELF_ST_TYPE (sym->st_info))))))
{
*override = TRUE;
newdef = FALSE;
@@ -1032,8 +1302,8 @@ _bfd_elf_merge_symbol (bfd *abfd,
/* 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. */
+ common symbol, and let _bfd_generic_link_add_one_symbol do the
+ right thing. */
if (newdyncommon
&& h->root.type == bfd_link_hash_common)
@@ -1042,10 +1312,14 @@ _bfd_elf_merge_symbol (bfd *abfd,
newdef = FALSE;
newdyncommon = FALSE;
*pvalue = sym->st_size;
- *psec = sec = bfd_com_section_ptr;
+ *psec = sec = bed->common_section (oldsec);
*size_change_ok = TRUE;
}
+ /* Skip weak definitions of symbols that are already defined. */
+ if (newdef && olddef && newweak)
+ *skip = 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
@@ -1057,14 +1331,14 @@ _bfd_elf_merge_symbol (bfd *abfd,
symbol is a function or is weak. */
flip = NULL;
- if (! newdyn
+ if (!newdyn
&& (newdef
|| (bfd_is_com_section (sec)
&& (oldweak
- || h->type == STT_FUNC)))
+ || bed->is_function_type (h->type))))
&& olddyn
&& olddef
- && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) != 0)
+ && h->def_dynamic)
{
/* Change the hash table entry to undefined, and let
_bfd_generic_link_add_one_symbol do the right thing with the
@@ -1116,9 +1390,10 @@ _bfd_elf_merge_symbol (bfd *abfd,
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. */
+ /* We need to remember the alignment required by the symbol
+ in the dynamic object. */
+ BFD_ASSERT (pold_alignment);
+ *pold_alignment = h->root.u.def.section->alignment_power;
olddef = FALSE;
olddyncommon = FALSE;
@@ -1144,12 +1419,12 @@ _bfd_elf_merge_symbol (bfd *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);
+ (*bed->elf_backend_copy_indirect_symbol) (info, flip, h);
flip->root.u.undef.abfd = h->root.u.undef.abfd;
- if (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC)
+ if (h->def_dynamic)
{
- h->elf_link_hash_flags &= ~ELF_LINK_HASH_DEF_DYNAMIC;
- flip->elf_link_hash_flags |= ELF_LINK_HASH_REF_DYNAMIC;
+ h->def_dynamic = 0;
+ flip->ref_dynamic = 1;
}
}
@@ -1230,8 +1505,8 @@ _bfd_elf_add_default_symbol (bfd *abfd,
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))
+ NULL, &hi, &skip, &override,
+ &type_change_ok, &size_change_ok))
return FALSE;
if (skip)
@@ -1272,13 +1547,12 @@ _bfd_elf_add_default_symbol (bfd *abfd,
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)
+ if (h->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))
+ h->def_dynamic = 0;
+ hi->ref_dynamic = 1;
+ if (hi->ref_regular
+ || hi->def_regular)
{
if (! bfd_elf_link_record_dynamic_symbol (info, hi))
return FALSE;
@@ -1290,6 +1564,10 @@ _bfd_elf_add_default_symbol (bfd *abfd,
hi = h;
}
+ /* Check if HI is a warning symbol. */
+ if (hi->root.type == bfd_link_hash_warning)
+ hi = (struct elf_link_hash_entry *) hi->root.u.i.link;
+
/* 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. */
@@ -1299,7 +1577,7 @@ _bfd_elf_add_default_symbol (bfd *abfd,
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);
+ (*bed->elf_backend_copy_indirect_symbol) (info, ht, hi);
/* See if the new flags lead us to realize that the symbol must
be dynamic. */
@@ -1308,14 +1586,12 @@ _bfd_elf_add_default_symbol (bfd *abfd,
if (! dynamic)
{
if (info->shared
- || ((hi->elf_link_hash_flags
- & ELF_LINK_HASH_REF_DYNAMIC) != 0))
+ || hi->ref_dynamic)
*dynsym = TRUE;
}
else
{
- if ((hi->elf_link_hash_flags
- & ELF_LINK_HASH_REF_REGULAR) != 0)
+ if (hi->ref_regular)
*dynsym = TRUE;
}
}
@@ -1337,8 +1613,8 @@ nondefault:
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))
+ NULL, &hi, &skip, &override,
+ &type_change_ok, &size_change_ok))
return FALSE;
if (skip)
@@ -1352,8 +1628,8 @@ nondefault:
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);
+ (_("%B: unexpected redefinition of indirect versioned symbol `%s'"),
+ abfd, shortname);
}
else
{
@@ -1370,7 +1646,7 @@ nondefault:
if (hi->root.type == bfd_link_hash_indirect)
{
- (*bed->elf_backend_copy_indirect_symbol) (bed, h, hi);
+ (*bed->elf_backend_copy_indirect_symbol) (info, h, hi);
/* See if the new flags lead us to realize that the symbol
must be dynamic. */
@@ -1379,14 +1655,12 @@ nondefault:
if (! dynamic)
{
if (info->shared
- || ((hi->elf_link_hash_flags
- & ELF_LINK_HASH_REF_DYNAMIC) != 0))
+ || hi->ref_dynamic)
*dynsym = TRUE;
}
else
{
- if ((hi->elf_link_hash_flags
- & ELF_LINK_HASH_REF_REGULAR) != 0)
+ if (hi->ref_regular)
*dynsym = TRUE;
}
}
@@ -1404,6 +1678,10 @@ _bfd_elf_export_symbol (struct elf_link_hash_entry *h, void *data)
{
struct elf_info_failed *eif = data;
+ /* Ignore this if we won't export it. */
+ if (!eif->info->export_dynamic && !h->dynamic)
+ return TRUE;
+
/* Ignore indirect symbols. These are added by the versioning code. */
if (h->root.type == bfd_link_hash_indirect)
return TRUE;
@@ -1412,8 +1690,8 @@ _bfd_elf_export_symbol (struct elf_link_hash_entry *h, void *data)
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)
+ && (h->def_regular
+ || h->ref_regular))
{
struct bfd_elf_version_tree *t;
struct bfd_elf_version_expr *d;
@@ -1468,8 +1746,8 @@ _bfd_elf_link_find_version_dependencies (struct elf_link_hash_entry *h,
/* 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
+ if (!h->def_dynamic
+ || h->def_regular
|| h->dynindx == -1
|| h->verinfo.verdef == NULL)
return TRUE;
@@ -1559,7 +1837,7 @@ _bfd_elf_link_assign_sym_version (struct elf_link_hash_entry *h, void *data)
/* We only need version numbers for symbols defined in regular
objects. */
- if ((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0)
+ if (!h->def_regular)
return TRUE;
bed = get_elf_backend_data (sinfo->output_bfd);
@@ -1584,7 +1862,7 @@ _bfd_elf_link_assign_sym_version (struct elf_link_hash_entry *h, void *data)
if (*p == '\0')
{
if (hidden)
- h->elf_link_hash_flags |= ELF_LINK_HIDDEN;
+ h->hidden = 1;
return TRUE;
}
@@ -1620,7 +1898,6 @@ _bfd_elf_link_assign_sym_version (struct elf_link_hash_entry *h, void *data)
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);
}
@@ -1671,15 +1948,15 @@ _bfd_elf_link_assign_sym_version (struct elf_link_hash_entry *h, void *data)
/* 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);
+ (_("%B: version node not found for symbol %s"),
+ 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;
+ h->hidden = 1;
}
/* If we don't have a version for this symbol, see if we can find
@@ -1747,7 +2024,6 @@ _bfd_elf_link_assign_sym_version (struct elf_link_hash_entry *h, void *data)
{
h->verinfo.vertree = local_ver;
if (h->dynindx != -1
- && info->shared
&& ! info->export_dynamic)
{
(*bed->elf_backend_hide_symbol) (info, h, TRUE);
@@ -1820,9 +2096,10 @@ elf_link_read_relocs_from_section (bfd *abfd,
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);
+ (_("%B: bad reloc symbol index (0x%lx >= 0x%lx)"
+ " for offset 0x%lx in section `%A'"),
+ abfd, sec,
+ (unsigned long) r_symndx, (unsigned long) nsyms, irela->r_offset);
bfd_set_error (bfd_error_bad_value);
return FALSE;
}
@@ -1979,7 +2256,9 @@ 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 *internal_relocs,
+ struct elf_link_hash_entry **rel_hash
+ ATTRIBUTE_UNUSED)
{
Elf_Internal_Rela *irela;
Elf_Internal_Rela *irelaend;
@@ -2009,10 +2288,8 @@ _bfd_elf_link_output_relocs (bfd *output_bfd,
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);
+ (_("%B: relocation size mismatch in %B section %A"),
+ output_bfd, input_section->owner, input_section);
bfd_set_error (bfd_error_wrong_object_format);
return FALSE;
}
@@ -2044,6 +2321,20 @@ _bfd_elf_link_output_relocs (bfd *output_bfd,
return TRUE;
}
+/* Make weak undefined symbols in PIE dynamic. */
+
+bfd_boolean
+_bfd_elf_link_hash_fixup_symbol (struct bfd_link_info *info,
+ struct elf_link_hash_entry *h)
+{
+ if (info->pie
+ && h->dynindx == -1
+ && h->root.type == bfd_link_hash_undefweak)
+ return bfd_elf_link_record_dynamic_symbol (info, h);
+
+ 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
@@ -2054,33 +2345,39 @@ bfd_boolean
_bfd_elf_fix_symbol_flags (struct elf_link_hash_entry *h,
struct elf_info_failed *eif)
{
+ const struct elf_backend_data *bed = NULL;
+
/* 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)
+ if (h->non_elf)
{
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);
+ {
+ h->ref_regular = 1;
+ h->ref_regular_nonweak = 1;
+ }
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);
+ {
+ h->ref_regular = 1;
+ h->ref_regular_nonweak = 1;
+ }
else
- h->elf_link_hash_flags |= ELF_LINK_HASH_DEF_REGULAR;
+ h->def_regular = 1;
}
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))
+ && (h->def_dynamic
+ || h->ref_dynamic))
{
if (! bfd_elf_link_record_dynamic_symbol (eif->info, h))
{
@@ -2091,7 +2388,7 @@ _bfd_elf_fix_symbol_flags (struct elf_link_hash_entry *h,
}
else
{
- /* Unfortunately, ELF_LINK_NON_ELF is only correct if the symbol
+ /* Unfortunately, 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.
@@ -2099,27 +2396,35 @@ _bfd_elf_fix_symbol_flags (struct elf_link_hash_entry *h,
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->def_regular
&& (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;
+ && !h->def_dynamic)))
+ h->def_regular = 1;
+ }
+
+ /* Backend specific symbol fixup. */
+ if (elf_hash_table (eif->info)->dynobj)
+ {
+ bed = get_elf_backend_data (elf_hash_table (eif->info)->dynobj);
+ if (bed->elf_backend_fixup_symbol
+ && !(*bed->elf_backend_fixup_symbol) (eif->info, h))
+ return FALSE;
}
/* 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
+ the symbol in a common section but the 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->def_regular
+ && h->ref_regular
+ && !h->def_dynamic
&& (h->root.u.def.section->owner->flags & DYNAMIC) == 0)
- h->elf_link_hash_flags |= ELF_LINK_HASH_DEF_REGULAR;
+ h->def_regular = 1;
/* If -Bsymbolic was used (which means to bind references to global
symbols to the definition within the shared object), and this
@@ -2127,18 +2432,15 @@ _bfd_elf_fix_symbol_flags (struct elf_link_hash_entry *h,
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
+ if (h->needs_plt
&& eif->info->shared
&& is_elf_hash_table (eif->info->hash)
- && (eif->info->symbolic
+ && (SYMBOLIC_BIND (eif->info, h)
|| ELF_ST_VISIBILITY (h->other) != STV_DEFAULT)
- && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) != 0)
+ && h->def_regular)
{
- 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);
@@ -2157,11 +2459,11 @@ _bfd_elf_fix_symbol_flags (struct elf_link_hash_entry *h,
/* If this is a weak defined symbol in a dynamic object, and we know
the real definition in the dynamic object, copy interesting flags
over to the real definition. */
- if (h->weakdef != NULL)
+ if (h->u.weakdef != NULL)
{
struct elf_link_hash_entry *weakdef;
- weakdef = h->weakdef;
+ weakdef = h->u.weakdef;
if (h->root.type == bfd_link_hash_indirect)
h = (struct elf_link_hash_entry *) h->root.u.i.link;
@@ -2169,20 +2471,16 @@ _bfd_elf_fix_symbol_flags (struct elf_link_hash_entry *h,
|| 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);
+ BFD_ASSERT (weakdef->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;
+ if (weakdef->def_regular)
+ h->u.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);
- }
+ (*bed->elf_backend_copy_indirect_symbol) (eif->info, weakdef,
+ h);
}
return TRUE;
@@ -2204,8 +2502,8 @@ _bfd_elf_adjust_dynamic_symbol (struct elf_link_hash_entry *h, void *data)
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;
+ h->got = elf_hash_table (eif->info)->init_got_offset;
+ h->plt = elf_hash_table (eif->info)->init_plt_offset;
/* When warning symbols are created, they **replace** the "real"
entry in the hash table, thus we never get to see the real
@@ -2228,26 +2526,26 @@ _bfd_elf_adjust_dynamic_symbol (struct elf_link_hash_entry *h, void *data)
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))))
+ if (!h->needs_plt
+ && (h->def_regular
+ || !h->def_dynamic
+ || (!h->ref_regular
+ && (h->u.weakdef == NULL || h->u.weakdef->dynindx == -1))))
{
- h->plt = elf_hash_table (eif->info)->init_offset;
+ h->plt = elf_hash_table (eif->info)->init_plt_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)
+ if (h->dynamic_adjusted)
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;
+ h->dynamic_adjusted = 1;
/* 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,
@@ -2277,15 +2575,15 @@ _bfd_elf_adjust_dynamic_symbol (struct elf_link_hash_entry *h, void *data)
wind up at different memory locations. The tzset call will set
_timezone, leaving timezone unchanged. */
- if (h->weakdef != NULL)
+ if (h->u.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;
+ H->U.WEAKDEF before it finds H? */
+ h->u.weakdef->ref_regular = 1;
- if (! _bfd_elf_adjust_dynamic_symbol (h->weakdef, eif))
+ if (! _bfd_elf_adjust_dynamic_symbol (h->u.weakdef, eif))
return FALSE;
}
@@ -2296,7 +2594,7 @@ _bfd_elf_adjust_dynamic_symbol (struct elf_link_hash_entry *h, void *data)
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)
+ && !h->needs_plt)
(*_bfd_error_handler)
(_("warning: type and size of dynamic symbol `%s' are not defined"),
h->root.root.string);
@@ -2312,6 +2610,52 @@ _bfd_elf_adjust_dynamic_symbol (struct elf_link_hash_entry *h, void *data)
return TRUE;
}
+/* Adjust the dynamic symbol, H, for copy in the dynamic bss section,
+ DYNBSS. */
+
+bfd_boolean
+_bfd_elf_adjust_dynamic_copy (struct elf_link_hash_entry *h,
+ asection *dynbss)
+{
+ unsigned int power_of_two;
+ bfd_vma mask;
+ asection *sec = h->root.u.def.section;
+
+ /* The section aligment of definition is the maximum alignment
+ requirement of symbols defined in the section. Since we don't
+ know the symbol alignment requirement, we start with the
+ maximum alignment and check low bits of the symbol address
+ for the minimum alignment. */
+ power_of_two = bfd_get_section_alignment (sec->owner, sec);
+ mask = ((bfd_vma) 1 << power_of_two) - 1;
+ while ((h->root.u.def.value & mask) != 0)
+ {
+ mask >>= 1;
+ --power_of_two;
+ }
+
+ if (power_of_two > bfd_get_section_alignment (dynbss->owner,
+ dynbss))
+ {
+ /* Adjust the section alignment if needed. */
+ if (! bfd_set_section_alignment (dynbss->owner, dynbss,
+ power_of_two))
+ return FALSE;
+ }
+
+ /* We make sure that the symbol will be aligned properly. */
+ dynbss->size = BFD_ALIGN (dynbss->size, mask + 1);
+
+ /* Define the symbol as being at this point in DYNBSS. */
+ h->root.u.def.section = dynbss;
+ h->root.u.def.value = dynbss->size;
+
+ /* Increment the size of DYNBSS to make room for the symbol. */
+ dynbss->size += h->size;
+
+ return TRUE;
+}
+
/* Adjust all external symbols pointing into SEC_MERGE sections
to reflect the object merging within the sections. */
@@ -2334,7 +2678,7 @@ _bfd_elf_link_sec_merge_syms (struct elf_link_hash_entry *h, void *data)
_bfd_merged_section_offset (output_bfd,
&h->root.u.def.section,
elf_section_data (sec)->sec_info,
- h->root.u.def.value, 0);
+ h->root.u.def.value);
}
return TRUE;
@@ -2350,6 +2694,8 @@ _bfd_elf_dynamic_symbol_p (struct elf_link_hash_entry *h,
bfd_boolean ignore_protected)
{
bfd_boolean binding_stays_local_p;
+ const struct elf_backend_data *bed;
+ struct elf_link_hash_table *hash_table;
if (h == NULL)
return FALSE;
@@ -2361,12 +2707,12 @@ _bfd_elf_dynamic_symbol_p (struct elf_link_hash_entry *h,
/* 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)
+ if (h->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;
+ binding_stays_local_p = info->executable || SYMBOLIC_BIND (info, h);
switch (ELF_ST_VISIBILITY (h->other))
{
@@ -2375,10 +2721,16 @@ _bfd_elf_dynamic_symbol_p (struct elf_link_hash_entry *h,
return FALSE;
case STV_PROTECTED:
+ hash_table = elf_hash_table (info);
+ if (!is_elf_hash_table (hash_table))
+ return FALSE;
+
+ bed = get_elf_backend_data (hash_table->dynobj);
+
/* 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)
+ if (!ignore_protected || !bed->is_function_type (h->type))
binding_stays_local_p = TRUE;
break;
@@ -2387,7 +2739,7 @@ _bfd_elf_dynamic_symbol_p (struct elf_link_hash_entry *h,
}
/* If it isn't defined locally, then clearly it's dynamic. */
- if ((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0)
+ if (!h->def_regular)
return TRUE;
/* Otherwise, the symbol is dynamic if binding rules don't tell
@@ -2405,17 +2757,24 @@ _bfd_elf_symbol_refs_local_p (struct elf_link_hash_entry *h,
struct bfd_link_info *info,
bfd_boolean local_protected)
{
+ const struct elf_backend_data *bed;
+ struct elf_link_hash_table *hash_table;
+
/* If it's a local sym, of course we resolve locally. */
if (h == NULL)
return TRUE;
+ /* Common symbols that become definitions don't get the DEF_REGULAR
+ flag set, so test it first, and don't bail out. */
+ if (ELF_COMMON_DEF_P (h))
+ /* Do nothing. */;
/* 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)
+ else if (!h->def_regular)
return FALSE;
/* Forced local symbols resolve locally. */
- if ((h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) != 0)
+ if (h->forced_local)
return TRUE;
/* As do non-dynamic symbols. */
@@ -2425,7 +2784,7 @@ _bfd_elf_symbol_refs_local_p (struct elf_link_hash_entry *h,
/* 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)
+ if (info->executable || SYMBOLIC_BIND (info, h))
return TRUE;
/* Now deal with defined dynamic symbols in shared libraries. Ones
@@ -2437,6 +2796,16 @@ _bfd_elf_symbol_refs_local_p (struct elf_link_hash_entry *h,
if (ELF_ST_VISIBILITY (h->other) != STV_PROTECTED)
return TRUE;
+ hash_table = elf_hash_table (info);
+ if (!is_elf_hash_table (hash_table))
+ return TRUE;
+
+ bed = get_elf_backend_data (hash_table->dynobj);
+
+ /* STV_PROTECTED non-function symbols are local. */
+ if (!bed->is_function_type (h->type))
+ 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. */
@@ -2476,13 +2845,16 @@ static bfd_boolean
is_global_data_symbol_definition (bfd *abfd ATTRIBUTE_UNUSED,
Elf_Internal_Sym *sym)
{
+ const struct elf_backend_data *bed;
+
/* 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;
+ bed = get_elf_backend_data (abfd);
/* Function symbols do not count. */
- if (ELF_ST_TYPE (sym->st_info) == STT_FUNC)
+ if (bed->is_function_type (ELF_ST_TYPE (sym->st_info)))
return FALSE;
/* If the section is undefined, then so is the symbol. */
@@ -2491,7 +2863,7 @@ is_global_data_symbol_definition (bfd *abfd ATTRIBUTE_UNUSED,
/* 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)
+ if (bed->common_definition (sym))
return FALSE;
/* If the symbol is in a target specific section then we
@@ -2613,16 +2985,16 @@ _bfd_elf_add_dynamic_entry (struct bfd_link_info *info,
s = bfd_get_section_by_name (hash_table->dynobj, ".dynamic");
BFD_ASSERT (s != NULL);
- newsize = s->_raw_size + bed->s->sizeof_dyn;
+ newsize = s->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);
+ bed->s->swap_dyn_out (hash_table->dynobj, &dyn, newcontents + s->size);
- s->_raw_size = newsize;
+ s->size = newsize;
s->contents = newcontents;
return TRUE;
@@ -2633,7 +3005,8 @@ _bfd_elf_add_dynamic_entry (struct bfd_link_info *info,
1 if a DT_NEEDED tag already exists, and 0 on success. */
static int
-elf_add_dt_needed_tag (struct bfd_link_info *info,
+elf_add_dt_needed_tag (bfd *abfd,
+ struct bfd_link_info *info,
const char *soname,
bfd_boolean do_it)
{
@@ -2641,6 +3014,9 @@ elf_add_dt_needed_tag (struct bfd_link_info *info,
bfd_size_type oldsize;
bfd_size_type strindex;
+ if (!_bfd_elf_link_create_dynstrtab (abfd, info))
+ return -1;
+
hash_table = elf_hash_table (info);
oldsize = _bfd_elf_strtab_size (hash_table->dynstr);
strindex = _bfd_elf_strtab_add (hash_table->dynstr, soname, FALSE);
@@ -2655,26 +3031,28 @@ elf_add_dt_needed_tag (struct bfd_link_info *info,
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;
+ if (sdyn != NULL)
+ for (extdyn = sdyn->contents;
+ extdyn < sdyn->contents + sdyn->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;
- }
- }
+ 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_link_create_dynamic_sections (hash_table->dynobj, info))
+ return -1;
+
if (!_bfd_elf_add_dynamic_entry (info, DT_NEEDED, strindex))
return -1;
}
@@ -2700,7 +3078,7 @@ elf_sort_symbol (const void *arg1, const void *arg2)
return vdiff > 0 ? 1 : -1;
else
{
- long sdiff = h1->root.u.def.section - h2->root.u.def.section;
+ long sdiff = h1->root.u.def.section->id - h2->root.u.def.section->id;
if (sdiff != 0)
return sdiff > 0 ? 1 : -1;
}
@@ -2747,7 +3125,7 @@ elf_finalize_dynstr (bfd *output_bfd, struct bfd_link_info *info)
/* Update all .dynamic entries referencing .dynstr strings. */
for (extdyn = sdyn->contents;
- extdyn < sdyn->contents + sdyn->_raw_size;
+ extdyn < sdyn->contents + sdyn->size;
extdyn += bed->s->sizeof_dyn)
{
Elf_Internal_Dyn dyn;
@@ -2796,6 +3174,8 @@ elf_finalize_dynstr (bfd *output_bfd, struct bfd_link_info *info)
_bfd_elf_swap_verdef_in (output_bfd, (Elf_External_Verdef *) p,
&def);
p += sizeof (Elf_External_Verdef);
+ if (def.vd_aux != sizeof (Elf_External_Verdef))
+ continue;
for (i = 0; i < def.vd_cnt; ++i)
{
_bfd_elf_swap_verdaux_in (output_bfd,
@@ -2847,17 +3227,45 @@ elf_finalize_dynstr (bfd *output_bfd, struct bfd_link_info *info)
return TRUE;
}
+/* Return TRUE iff relocations for INPUT are compatible with OUTPUT.
+ The default is to only match when the INPUT and OUTPUT are exactly
+ the same target. */
+
+bfd_boolean
+_bfd_elf_default_relocs_compatible (const bfd_target *input,
+ const bfd_target *output)
+{
+ return input == output;
+}
+
+/* Return TRUE iff relocations for INPUT are compatible with OUTPUT.
+ This version is used when different targets for the same architecture
+ are virtually identical. */
+
+bfd_boolean
+_bfd_elf_relocs_compatible (const bfd_target *input,
+ const bfd_target *output)
+{
+ const struct elf_backend_data *obed, *ibed;
+
+ if (input == output)
+ return TRUE;
+
+ ibed = xvec_get_elf_backend_data (input);
+ obed = xvec_get_elf_backend_data (output);
+
+ if (ibed->arch != obed->arch)
+ return FALSE;
+
+ /* If both backends are using this function, deem them compatible. */
+ return ibed->relocs_compatible == obed->relocs_compatible;
+}
+
/* 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;
@@ -2874,14 +3282,23 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info)
Elf_Internal_Sym *isymend;
const struct elf_backend_data *bed;
bfd_boolean add_needed;
- struct elf_link_hash_table * hash_table;
+ struct elf_link_hash_table *htab;
bfd_size_type amt;
-
- hash_table = elf_hash_table (info);
-
+ void *alloc_mark = NULL;
+ struct bfd_hash_entry **old_table = NULL;
+ unsigned int old_size = 0;
+ unsigned int old_count = 0;
+ void *old_tab = NULL;
+ void *old_hash;
+ void *old_ent;
+ struct bfd_link_hash_entry *old_undefs = NULL;
+ struct bfd_link_hash_entry *old_undefs_tail = NULL;
+ long old_dynsymcount = 0;
+ size_t tabsize = 0;
+ size_t hashsize = 0;
+
+ htab = 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;
@@ -2893,10 +3310,13 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info)
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)
+ || !is_elf_hash_table (htab)
+ || htab->root.creator != abfd->xvec)
{
- bfd_set_error (bfd_error_invalid_operation);
+ if (info->relocatable)
+ bfd_set_error (bfd_error_invalid_operation);
+ else
+ bfd_set_error (bfd_error_wrong_format);
goto error_return;
}
}
@@ -2914,12 +3334,10 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info)
const char *name;
name = bfd_get_section_name (abfd, s);
- if (strncmp (name, ".gnu.warning.", sizeof ".gnu.warning." - 1) == 0)
+ if (CONST_STRNEQ (name, ".gnu.warning."))
{
char *msg;
bfd_size_type sz;
- bfd_size_type prefix_len;
- const char * gnu_warning_prefix = _("warning: ");
name += sizeof ".gnu.warning." - 1;
@@ -2936,8 +3354,7 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info)
{
struct elf_link_hash_entry *h;
- h = elf_link_hash_lookup (hash_table, name,
- FALSE, FALSE, TRUE);
+ h = elf_link_hash_lookup (htab, name, FALSE, FALSE, TRUE);
/* FIXME: What about bfd_link_hash_common? */
if (h != NULL
@@ -2947,33 +3364,35 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info)
/* 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;
+ s->size = 0;
continue;
}
}
- sz = bfd_section_size (abfd, s);
- prefix_len = strlen (gnu_warning_prefix);
- msg = bfd_alloc (abfd, prefix_len + sz + 1);
+ sz = s->size;
+ msg = bfd_alloc (abfd, 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))
+ if (! bfd_get_section_contents (abfd, s, msg, 0, sz))
goto error_return;
- msg[prefix_len + sz] = '\0';
+ msg[sz] = '\0';
if (! (_bfd_generic_link_add_one_symbol
(info, abfd, name, BSF_WARNING, s, 0, msg,
- FALSE, collect, NULL)))
+ FALSE, bed->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;
+ s->size = 0;
+
+ /* Also set SEC_EXCLUDE, so that symbols defined in
+ the warning section don't get copied to the output. */
+ s->flags |= SEC_EXCLUDE;
}
}
}
@@ -2988,15 +3407,15 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info)
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)
+ && is_elf_hash_table (htab)
+ && htab->root.creator == abfd->xvec
+ && !htab->dynamic_sections_created)
{
if (! _bfd_elf_link_create_dynamic_sections (abfd, info))
goto error_return;
}
}
- else if (!is_elf_hash_table (hash_table))
+ else if (!is_elf_hash_table (htab))
goto error_return;
else
{
@@ -3006,17 +3425,21 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info)
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. */
+ ld shouldn't allow it. */
if ((s = abfd->sections) != NULL
&& s->sec_info_type == ELF_INFO_TYPE_JUST_SYMS)
- goto error_return;
+ abort ();
/* 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;
+ in by another lib's DT_NEEDED. When --no-add-needed is used
+ on a dynamic lib, we don't want to add a DT_NEEDED entry for
+ any dynamic library in DT_NEEDED tags in the dynamic lib at
+ all. */
+ add_needed = (elf_dyn_lib_class (abfd)
+ & (DYN_AS_NEEDED | DYN_DT_NEEDED
+ | DYN_NO_NEEDED)) == 0;
s = bfd_get_section_by_name (abfd, ".dynamic");
if (s != NULL)
@@ -3026,11 +3449,7 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info)
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))
+ if (!bfd_malloc_and_get_section (abfd, s, &dynbuf))
goto error_free_dyn;
elfsec = _bfd_elf_section_from_bfd_section (abfd, s);
@@ -3039,7 +3458,7 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info)
shlink = elf_elfsections (abfd)[elfsec]->sh_link;
for (extdyn = dynbuf;
- extdyn < dynbuf + s->_raw_size;
+ extdyn < dynbuf + s->size;
extdyn += bed->s->sizeof_dyn)
{
Elf_Internal_Dyn dyn;
@@ -3071,9 +3490,7 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info)
n->name = anm;
n->by = abfd;
n->next = NULL;
- for (pn = & hash_table->needed;
- *pn != NULL;
- pn = &(*pn)->next)
+ for (pn = &htab->needed; *pn != NULL; pn = &(*pn)->next)
;
*pn = n;
}
@@ -3145,9 +3562,7 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info)
if (rpath)
{
struct bfd_link_needed_list **pn;
- for (pn = & hash_table->runpath;
- *pn != NULL;
- pn = &(*pn)->next)
+ for (pn = &htab->runpath; *pn != NULL; pn = &(*pn)->next)
;
*pn = rpath;
}
@@ -3161,11 +3576,6 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info)
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
@@ -3182,7 +3592,7 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info)
will need to know it. */
elf_dt_name (abfd) = soname;
- ret = elf_add_dt_needed_tag (info, soname, add_needed);
+ ret = elf_add_dt_needed_tag (abfd, info, soname, add_needed);
if (ret < 0)
goto error_return;
@@ -3239,7 +3649,8 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info)
if (dynamic)
{
/* Read in any version definitions. */
- if (! _bfd_elf_slurp_version_tables (abfd))
+ if (!_bfd_elf_slurp_version_tables (abfd,
+ info->default_imported_symver))
goto error_free_sym;
/* Read in the symbol versions, but don't bother to convert them
@@ -3259,8 +3670,80 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info)
}
}
- weaks = NULL;
+ /* If we are loading an as-needed shared lib, save the symbol table
+ state before we start adding symbols. If the lib turns out
+ to be unneeded, restore the state. */
+ if ((elf_dyn_lib_class (abfd) & DYN_AS_NEEDED) != 0)
+ {
+ unsigned int i;
+ size_t entsize;
+
+ for (entsize = 0, i = 0; i < htab->root.table.size; i++)
+ {
+ struct bfd_hash_entry *p;
+ struct elf_link_hash_entry *h;
+
+ for (p = htab->root.table.table[i]; p != NULL; p = p->next)
+ {
+ h = (struct elf_link_hash_entry *) p;
+ entsize += htab->root.table.entsize;
+ if (h->root.type == bfd_link_hash_warning)
+ entsize += htab->root.table.entsize;
+ }
+ }
+
+ tabsize = htab->root.table.size * sizeof (struct bfd_hash_entry *);
+ hashsize = extsymcount * sizeof (struct elf_link_hash_entry *);
+ old_tab = bfd_malloc (tabsize + entsize + hashsize);
+ if (old_tab == NULL)
+ goto error_free_vers;
+ /* Remember the current objalloc pointer, so that all mem for
+ symbols added can later be reclaimed. */
+ alloc_mark = bfd_hash_allocate (&htab->root.table, 1);
+ if (alloc_mark == NULL)
+ goto error_free_vers;
+
+ /* Make a special call to the linker "notice" function to
+ tell it that we are about to handle an as-needed lib. */
+ if (!(*info->callbacks->notice) (info, NULL, abfd, NULL,
+ notice_as_needed))
+ return FALSE;
+
+
+ /* Clone the symbol table and sym hashes. Remember some
+ pointers into the symbol table, and dynamic symbol count. */
+ old_hash = (char *) old_tab + tabsize;
+ old_ent = (char *) old_hash + hashsize;
+ memcpy (old_tab, htab->root.table.table, tabsize);
+ memcpy (old_hash, sym_hash, hashsize);
+ old_undefs = htab->root.undefs;
+ old_undefs_tail = htab->root.undefs_tail;
+ old_table = htab->root.table.table;
+ old_size = htab->root.table.size;
+ old_count = htab->root.table.count;
+ old_dynsymcount = htab->dynsymcount;
+
+ for (i = 0; i < htab->root.table.size; i++)
+ {
+ struct bfd_hash_entry *p;
+ struct elf_link_hash_entry *h;
+
+ for (p = htab->root.table.table[i]; p != NULL; p = p->next)
+ {
+ memcpy (old_ent, p, htab->root.table.entsize);
+ old_ent = (char *) old_ent + htab->root.table.entsize;
+ h = (struct elf_link_hash_entry *) p;
+ if (h->root.type == bfd_link_hash_warning)
+ {
+ memcpy (old_ent, h->root.u.i.link, htab->root.table.entsize);
+ old_ent = (char *) old_ent + htab->root.table.entsize;
+ }
+ }
+ }
+ }
+
+ weaks = NULL;
ever = extversym != NULL ? extversym + extsymoff : NULL;
for (isym = isymbuf, isymend = isymbuf + extsymcount;
isym < isymend;
@@ -3268,7 +3751,7 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info)
{
int bind;
bfd_vma value;
- asection *sec;
+ asection *sec, *new_sec;
flagword flags;
const char *name;
struct elf_link_hash_entry *h;
@@ -3277,6 +3760,7 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info)
bfd_boolean type_change_ok;
bfd_boolean new_weakdef;
bfd_boolean override;
+ bfd_boolean common;
unsigned int old_alignment;
bfd *old_bfd;
@@ -3286,6 +3770,7 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info)
sec = NULL;
value = isym->st_value;
*sym_hash = NULL;
+ common = bed->common_definition (isym);
bind = ELF_ST_BIND (isym->st_info);
if (bind == STB_LOCAL)
@@ -3298,8 +3783,7 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info)
}
else if (bind == STB_GLOBAL)
{
- if (isym->st_shndx != SHN_UNDEF
- && isym->st_shndx != SHN_COMMON)
+ if (isym->st_shndx != SHN_UNDEF && !common)
flags = BSF_GLOBAL;
}
else if (bind == STB_WEAK)
@@ -3311,11 +3795,19 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info)
if (isym->st_shndx == SHN_UNDEF)
sec = bfd_und_section_ptr;
- else if (isym->st_shndx < SHN_LORESERVE || isym->st_shndx > SHN_HIRESERVE)
+ 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 (sec->kept_section)
+ {
+ /* Symbols from discarded section are undefined. We keep
+ its visibility. */
+ sec = bfd_und_section_ptr;
+ isym->st_shndx = SHN_UNDEF;
+ }
else if ((abfd->flags & (EXEC_P | DYNAMIC)) != 0)
value -= sec->vma;
}
@@ -3339,26 +3831,27 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info)
goto error_free_vers;
if (isym->st_shndx == SHN_COMMON
- && ELF_ST_TYPE (isym->st_info) == STT_TLS)
+ && ELF_ST_TYPE (isym->st_info) == STT_TLS
+ && !info->relocatable)
{
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)))
+ tcomm = bfd_make_section_with_flags (abfd, ".tcommon",
+ (SEC_ALLOC
+ | SEC_IS_COMMON
+ | SEC_LINKER_CREATED
+ | SEC_THREAD_LOCAL));
+ if (tcomm == NULL)
goto error_free_vers;
}
sec = tcomm;
}
- else if (add_symbol_hook)
+ else if (bed->elf_add_symbol_hook)
{
- if (! (*add_symbol_hook) (abfd, info, isym, &name, &flags, &sec,
- &value))
+ if (! (*bed->elf_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
@@ -3381,112 +3874,126 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info)
definition = TRUE;
size_change_ok = FALSE;
- type_change_ok = get_elf_backend_data (abfd)->type_change_ok;
+ type_change_ok = bed->type_change_ok;
old_alignment = 0;
old_bfd = NULL;
+ new_sec = sec;
- if (is_elf_hash_table (hash_table))
+ if (is_elf_hash_table (htab))
{
Elf_Internal_Versym iver;
unsigned int vernum = 0;
bfd_boolean skip;
- if (ever != NULL)
+ 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)))
+ if (info->default_imported_symver)
+ /* Use the default symbol version created earlier. */
+ iver.vs_vers = elf_tdata (abfd)->cverdefs;
+ else
+ iver.vs_vers = 0;
+ }
+ else
+ _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
+ if it is not a function, 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)
+ || bed->is_function_type (ELF_ST_TYPE (isym->st_info)))))
+ {
+ const char *verstr;
+ size_t namelen, verlen, newlen;
+ char *newname, *p;
+
+ if (isym->st_shndx != SHN_UNDEF)
{
- const char *verstr;
- size_t namelen, verlen, newlen;
- char *newname, *p;
+ if (vernum > elf_tdata (abfd)->cverdefs)
+ verstr = NULL;
+ else if (vernum > 1)
+ verstr =
+ elf_tdata (abfd)->verdef[vernum - 1].vd_nodename;
+ else
+ verstr = "";
- if (isym->st_shndx != SHN_UNDEF)
+ if (verstr == NULL)
{
- 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 = "";
+ (*_bfd_error_handler)
+ (_("%B: %s: invalid version %u (max %d)"),
+ abfd, name, vernum,
+ elf_tdata (abfd)->cverdefs);
+ bfd_set_error (bfd_error_bad_value);
+ goto error_free_vers;
}
- else
+ }
+ 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)
{
- /* 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;
+ Elf_Internal_Vernaux *a;
- for (a = t->vn_auxptr; a != NULL; a = a->vna_nextptr)
+ for (a = t->vn_auxptr; a != NULL; a = a->vna_nextptr)
+ {
+ if (a->vna_other == vernum)
{
- if (a->vna_other == vernum)
- {
- verstr = a->vna_nodename;
- break;
- }
+ 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;
}
+ if (a != NULL)
+ break;
+ }
+ if (verstr == NULL)
+ {
+ (*_bfd_error_handler)
+ (_("%B: %s: invalid needed version %d"),
+ 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;
+ 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);
+ newname = bfd_hash_allocate (&htab->root.table, 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;
- }
+ name = newname;
}
- if (!_bfd_elf_merge_symbol (abfd, info, name, isym, &sec, &value,
+ if (!_bfd_elf_merge_symbol (abfd, info, name, isym, &sec,
+ &value, &old_alignment,
sym_hash, &skip, &override,
&type_change_ok, &size_change_ok))
goto error_free_vers;
@@ -3532,7 +4039,7 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info)
}
if (! (_bfd_generic_link_add_one_symbol
- (info, abfd, name, flags, sec, value, NULL, FALSE, collect,
+ (info, abfd, name, flags, sec, value, NULL, FALSE, bed->collect,
(struct bfd_link_hash_entry **) sym_hash)))
goto error_free_vers;
@@ -3546,9 +4053,9 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info)
if (dynamic
&& definition
&& (flags & BSF_WEAK) != 0
- && ELF_ST_TYPE (isym->st_info) != STT_FUNC
- && is_elf_hash_table (hash_table)
- && h->weakdef == NULL)
+ && !bed->is_function_type (ELF_ST_TYPE (isym->st_info))
+ && is_elf_hash_table (htab)
+ && h->u.weakdef == NULL)
{
/* Keep a list of all weak defined non function symbols from
a dynamic object, using the weakdef field. Later in this
@@ -3562,18 +4069,25 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info)
dynamic object, and we will be using that previous
definition anyhow. */
- h->weakdef = weaks;
+ h->u.weakdef = weaks;
weaks = h;
new_weakdef = TRUE;
}
/* Set the alignment of a common symbol. */
- if (isym->st_shndx == SHN_COMMON
+ if ((common || bfd_is_com_section (sec))
&& h->root.type == bfd_link_hash_common)
{
unsigned int align;
- align = bfd_log2 (isym->st_value);
+ if (common)
+ align = bfd_log2 (isym->st_value);
+ else
+ {
+ /* The new symbol is a common symbol in a shared object.
+ We need to get the alignment from the section. */
+ align = new_sec->alignment_power;
+ }
if (align > old_alignment
/* Permit an alignment power of zero if an alignment of one
is specified and no other alignments have been specified. */
@@ -3583,18 +4097,16 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info)
h->root.u.c.p->alignment_power = old_alignment;
}
- if (is_elf_hash_table (hash_table))
+ if (is_elf_hash_table (htab))
{
- 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)
+ if ((old_alignment || common)
&& h->root.type != bfd_link_hash_common)
{
unsigned int common_align;
@@ -3628,26 +4140,36 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info)
}
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));
+ {
+ /* PR binutils/2735 */
+ if (normal_bfd == NULL)
+ (*_bfd_error_handler)
+ (_("Warning: alignment %u of common symbol `%s' in %B"
+ " is greater than the alignment (%u) of its section %A"),
+ common_bfd, h->root.u.def.section,
+ 1 << common_align, name, 1 << normal_align);
+ else
+ (*_bfd_error_handler)
+ (_("Warning: alignment %u of symbol `%s' in %B"
+ " is smaller than %u in %B"),
+ normal_bfd, common_bfd,
+ 1 << normal_align, name, 1 << common_align);
+ }
}
- /* Remember the symbol size and type. */
- if (isym->st_size != 0
+ /* Remember the symbol size if it isn't undefined. */
+ if ((isym->st_size != 0 && isym->st_shndx != SHN_UNDEF)
&& (definition || h->size == 0))
{
- if (h->size != 0 && h->size != isym->st_size && ! size_change_ok)
+ 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"),
+ (_("Warning: size of symbol `%s' changed"
+ " from %lu in %B to %lu in %B"),
+ old_bfd, abfd,
name, (unsigned long) h->size,
- bfd_archive_filename (old_bfd),
- (unsigned long) isym->st_size,
- bfd_archive_filename (abfd));
+ (unsigned long) isym->st_size);
h->size = isym->st_size;
}
@@ -3656,7 +4178,8 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info)
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. */
+ covered by --warn-common. Allow changed between different
+ function types. */
if (h->root.type == bfd_link_hash_common)
h->size = h->root.u.c.size;
@@ -3667,9 +4190,9 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info)
&& 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));
+ (_("Warning: type of symbol `%s' changed"
+ " from %d to %d in %B"),
+ abfd, name, h->type, ELF_ST_TYPE (isym->st_info));
h->type = ELF_ST_TYPE (isym->st_info);
}
@@ -3681,13 +4204,22 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info)
(*bed->elf_backend_merge_symbol_attribute) (h, isym, definition,
dynamic);
- if (isym->st_other != 0 && !dynamic)
+ /* If this symbol has default visibility and the user has requested
+ we not re-export it, then mark it as hidden. */
+ if (definition && !dynamic
+ && (abfd->no_export
+ || (abfd->my_archive && abfd->my_archive->no_export))
+ && ELF_ST_VISIBILITY (isym->st_other) != STV_INTERNAL)
+ isym->st_other = (STV_HIDDEN
+ | (isym->st_other & ~ELF_ST_VISIBILITY (-1)));
+
+ if (ELF_ST_VISIBILITY (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);
+ /* Only merge the visibility. Leave the remainder of the
+ st_other field to elf_backend_merge_symbol_attribute. */
+ other = h->other & ~ELF_ST_VISIBILITY (-1);
/* Combine visibilities, using the most constraining one. */
hvis = ELF_ST_VISIBILITY (h->other);
@@ -3707,38 +4239,42 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info)
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;
+ h->ref_regular = 1;
if (bind != STB_WEAK)
- new_flag |= ELF_LINK_HASH_REF_REGULAR_NONWEAK;
+ h->ref_regular_nonweak = 1;
}
else
- new_flag = ELF_LINK_HASH_DEF_REGULAR;
+ h->def_regular = 1;
if (! info->executable
- || (old_flags & (ELF_LINK_HASH_DEF_DYNAMIC
- | ELF_LINK_HASH_REF_DYNAMIC)) != 0)
+ || h->def_dynamic
+ || h->ref_dynamic)
dynsym = TRUE;
}
else
{
if (! definition)
- new_flag = ELF_LINK_HASH_REF_DYNAMIC;
+ h->ref_dynamic = 1;
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
+ h->def_dynamic = 1;
+ if (h->def_regular
+ || h->ref_regular
+ || (h->u.weakdef != NULL
&& ! new_weakdef
- && h->weakdef->dynindx != -1))
+ && h->u.weakdef->dynindx != -1))
dynsym = TRUE;
}
- h->elf_link_hash_flags |= new_flag;
+ if (definition && (sec->flags & SEC_DEBUGGING))
+ {
+ /* We don't want to make debug symbol dynamic. */
+ (*bed->elf_backend_hide_symbol) (info, h, TRUE);
+ dynsym = FALSE;
+ }
/* Check to see if we need to add an indirect symbol for
the default name. */
@@ -3755,13 +4291,13 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info)
{
/* Queue non-default versions so that .symver x, x@FOO
aliases can be checked. */
- if (! nondeflt_vers)
+ if (!nondeflt_vers)
{
- amt = (isymend - isym + 1)
- * sizeof (struct elf_link_hash_entry *);
+ amt = ((isymend - isym + 1)
+ * sizeof (struct elf_link_hash_entry *));
nondeflt_vers = bfd_malloc (amt);
}
- nondeflt_vers [nondeflt_vers_cnt++] = h;
+ nondeflt_vers[nondeflt_vers_cnt++] = h;
}
}
@@ -3769,11 +4305,11 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info)
{
if (! bfd_elf_link_record_dynamic_symbol (info, h))
goto error_free_vers;
- if (h->weakdef != NULL
+ if (h->u.weakdef != NULL
&& ! new_weakdef
- && h->weakdef->dynindx == -1)
+ && h->u.weakdef->dynindx == -1)
{
- if (! bfd_elf_link_record_dynamic_symbol (info, h->weakdef))
+ if (!bfd_elf_link_record_dynamic_symbol (info, h->u.weakdef))
goto error_free_vers;
}
}
@@ -3793,17 +4329,28 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info)
if (!add_needed
&& definition
&& dynsym
- && (h->elf_link_hash_flags
- & ELF_LINK_HASH_REF_REGULAR) != 0)
+ && h->ref_regular)
{
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 a DT_NEEDED entry for it. Issue an error if
+ --no-add-needed is used. */
+ if ((elf_dyn_lib_class (abfd) & DYN_NO_NEEDED) != 0)
+ {
+ (*_bfd_error_handler)
+ (_("%s: invalid DSO for symbol `%s' definition"),
+ abfd, name);
+ bfd_set_error (bfd_error_bad_value);
+ goto error_free_vers;
+ }
+
+ elf_dyn_lib_class (abfd) &= ~DYN_AS_NEEDED;
+
add_needed = TRUE;
- ret = elf_add_dt_needed_tag (info, soname, add_needed);
+ ret = elf_add_dt_needed_tag (abfd, info, soname, add_needed);
if (ret < 0)
goto error_free_vers;
@@ -3812,6 +4359,82 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info)
}
}
+ if (extversym != NULL)
+ {
+ free (extversym);
+ extversym = NULL;
+ }
+
+ if (isymbuf != NULL)
+ {
+ free (isymbuf);
+ isymbuf = NULL;
+ }
+
+ if ((elf_dyn_lib_class (abfd) & DYN_AS_NEEDED) != 0)
+ {
+ unsigned int i;
+
+ /* Restore the symbol table. */
+ if (bed->as_needed_cleanup)
+ (*bed->as_needed_cleanup) (abfd, info);
+ old_hash = (char *) old_tab + tabsize;
+ old_ent = (char *) old_hash + hashsize;
+ sym_hash = elf_sym_hashes (abfd);
+ htab->root.table.table = old_table;
+ htab->root.table.size = old_size;
+ htab->root.table.count = old_count;
+ memcpy (htab->root.table.table, old_tab, tabsize);
+ memcpy (sym_hash, old_hash, hashsize);
+ htab->root.undefs = old_undefs;
+ htab->root.undefs_tail = old_undefs_tail;
+ for (i = 0; i < htab->root.table.size; i++)
+ {
+ struct bfd_hash_entry *p;
+ struct elf_link_hash_entry *h;
+
+ for (p = htab->root.table.table[i]; p != NULL; p = p->next)
+ {
+ h = (struct elf_link_hash_entry *) p;
+ if (h->root.type == bfd_link_hash_warning)
+ h = (struct elf_link_hash_entry *) h->root.u.i.link;
+ if (h->dynindx >= old_dynsymcount)
+ _bfd_elf_strtab_delref (htab->dynstr, h->dynstr_index);
+
+ memcpy (p, old_ent, htab->root.table.entsize);
+ old_ent = (char *) old_ent + htab->root.table.entsize;
+ h = (struct elf_link_hash_entry *) p;
+ if (h->root.type == bfd_link_hash_warning)
+ {
+ memcpy (h->root.u.i.link, old_ent, htab->root.table.entsize);
+ old_ent = (char *) old_ent + htab->root.table.entsize;
+ }
+ }
+ }
+
+ /* Make a special call to the linker "notice" function to
+ tell it that symbols added for crefs may need to be removed. */
+ if (!(*info->callbacks->notice) (info, NULL, abfd, NULL,
+ notice_not_needed))
+ return FALSE;
+
+ free (old_tab);
+ objalloc_free_block ((struct objalloc *) htab->root.table.memory,
+ alloc_mark);
+ if (nondeflt_vers != NULL)
+ free (nondeflt_vers);
+ return TRUE;
+ }
+
+ if (old_tab != NULL)
+ {
+ if (!(*info->callbacks->notice) (info, NULL, abfd, NULL,
+ notice_needed))
+ return FALSE;
+ free (old_tab);
+ old_tab = NULL;
+ }
+
/* 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)
@@ -3835,7 +4458,7 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info)
shortname[amt] = '\0';
hi = (struct elf_link_hash_entry *)
- bfd_link_hash_lookup (&hash_table->root, shortname,
+ bfd_link_hash_lookup (&htab->root, shortname,
FALSE, FALSE, FALSE);
if (hi != NULL
&& hi->root.type == h->root.type
@@ -3845,7 +4468,7 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info)
(*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);
+ (*bed->elf_backend_copy_indirect_symbol) (info, h, hi);
sym_hash = elf_sym_hashes (abfd);
if (sym_hash)
for (symidx = 0; symidx < extsymcount; ++symidx)
@@ -3861,16 +4484,6 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info)
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
@@ -3908,7 +4521,7 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info)
h = *hpp;
if (h != NULL
&& h->root.type == bfd_link_hash_defined
- && h->type != STT_FUNC)
+ && !bed->is_function_type (h->type))
{
*sym_hash = h;
sym_hash++;
@@ -3929,8 +4542,8 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info)
size_t i, j, idx;
hlook = weaks;
- weaks = hlook->weakdef;
- hlook->weakdef = NULL;
+ weaks = hlook->u.weakdef;
+ hlook->u.weakdef = NULL;
BFD_ASSERT (hlook->root.type == bfd_link_hash_defined
|| hlook->root.type == bfd_link_hash_defweak
@@ -3954,7 +4567,7 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info)
i = idx + 1;
else
{
- long sdiff = slook - h->root.u.def.section;
+ long sdiff = slook->id - h->root.u.def.section->id;
if (sdiff < 0)
j = idx;
else if (sdiff > 0)
@@ -3981,7 +4594,7 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info)
break;
else if (h != hlook)
{
- hlook->weakdef = h;
+ hlook->u.weakdef = h;
/* If the weak definition is in the list of dynamic
symbols, make sure the real definition is put
@@ -4010,6 +4623,9 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info)
free (sorted_sym_hash);
}
+ if (bed->check_directives)
+ (*bed->check_directives) (abfd, info);
+
/* 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.
@@ -4027,11 +4643,10 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info)
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)
+ && is_elf_hash_table (htab)
+ && bed->check_relocs != NULL
+ && (*bed->relocs_compatible) (abfd->xvec, htab->root.creator))
{
asection *o;
@@ -4052,7 +4667,7 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info)
if (internal_relocs == NULL)
goto error_return;
- ok = (*check_relocs) (abfd, info, o, internal_relocs);
+ ok = (*bed->check_relocs) (abfd, info, o, internal_relocs);
if (elf_section_data (o)->relocs != internal_relocs)
free (internal_relocs);
@@ -4066,7 +4681,7 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info)
of the .stab/.stabstr sections. */
if (! dynamic
&& ! info->traditional_format
- && is_elf_hash_table (hash_table)
+ && is_elf_hash_table (htab)
&& (info->strip != strip_all && info->strip != strip_debugger))
{
asection *stabstr;
@@ -4078,7 +4693,7 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info)
asection *stab;
for (stab = abfd->sections; stab; stab = stab->next)
- if (strncmp (".stab", stab->name, 5) == 0
+ if (CONST_STRNEQ (stab->name, ".stab")
&& (!stab->name[5] ||
(stab->name[5] == '.' && ISDIGIT (stab->name[6])))
&& (stab->flags & SEC_MERGE) == 0
@@ -4087,10 +4702,8 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info)
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,
+ if (! _bfd_link_section_stabs (abfd, &htab->stab_info, stab,
+ stabstr, &secdata->sec_info,
&string_offset))
goto error_return;
if (secdata->sec_info)
@@ -4099,29 +4712,7 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info)
}
}
- 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))
+ if (is_elf_hash_table (htab) && add_needed)
{
/* Add this bfd to the loaded list. */
struct elf_link_loaded_list *n;
@@ -4130,13 +4721,15 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info)
if (n == NULL)
goto error_return;
n->abfd = abfd;
- n->next = hash_table->loaded;
- hash_table->loaded = n;
+ n->next = htab->loaded;
+ htab->loaded = n;
}
return TRUE;
error_free_vers:
+ if (old_tab != NULL)
+ free (old_tab);
if (nondeflt_vers != NULL)
free (nondeflt_vers);
if (extversym != NULL)
@@ -4148,6 +4741,55 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info)
return FALSE;
}
+/* Return the linker hash table entry of a symbol that might be
+ satisfied by an archive symbol. Return -1 on error. */
+
+struct elf_link_hash_entry *
+_bfd_elf_archive_symbol_lookup (bfd *abfd,
+ struct bfd_link_info *info,
+ const char *name)
+{
+ struct elf_link_hash_entry *h;
+ char *p, *copy;
+ size_t len, first;
+
+ h = elf_link_hash_lookup (elf_hash_table (info), name, FALSE, FALSE, FALSE);
+ if (h != NULL)
+ return h;
+
+ /* 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 (name, ELF_VER_CHR);
+ if (p == NULL || p[1] != ELF_VER_CHR)
+ return h;
+
+ /* First check with only one `@'. */
+ len = strlen (name);
+ copy = bfd_alloc (abfd, len);
+ if (copy == NULL)
+ return (struct elf_link_hash_entry *) 0 - 1;
+
+ first = p - name + 1;
+ memcpy (copy, name, first);
+ memcpy (copy + first, 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);
+ return h;
+}
+
/* 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
@@ -4182,6 +4824,9 @@ elf_link_add_archive_symbols (bfd *abfd, struct bfd_link_info *info)
carsym *symdefs;
bfd_boolean loop;
bfd_size_type amt;
+ const struct elf_backend_data *bed;
+ struct elf_link_hash_entry * (*archive_symbol_lookup)
+ (bfd *, struct bfd_link_info *, const char *);
if (! bfd_has_map (abfd))
{
@@ -4206,6 +4851,8 @@ elf_link_add_archive_symbols (bfd *abfd, struct bfd_link_info *info)
goto error_return;
symdefs = bfd_ardata (abfd)->symdefs;
+ bed = get_elf_backend_data (abfd);
+ archive_symbol_lookup = bed->elf_backend_archive_symbol_lookup;
do
{
@@ -4234,48 +4881,9 @@ elf_link_add_archive_symbols (bfd *abfd, struct bfd_link_info *info)
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);
- }
+ h = archive_symbol_lookup (abfd, info, symdef->name);
+ if (h == (struct elf_link_hash_entry *) 0 - 1)
+ goto error_return;
if (h == NULL)
continue;
@@ -4427,7 +5035,77 @@ elf_collect_hash_codes (struct elf_link_hash_entry *h, void *data)
/* And store it in the struct so that we can put it in the hash table
later. */
- h->elf_hash_value = ha;
+ h->u.elf_hash_value = ha;
+
+ if (alc != NULL)
+ free (alc);
+
+ return TRUE;
+}
+
+struct collect_gnu_hash_codes
+{
+ bfd *output_bfd;
+ const struct elf_backend_data *bed;
+ unsigned long int nsyms;
+ unsigned long int maskbits;
+ unsigned long int *hashcodes;
+ unsigned long int *hashval;
+ unsigned long int *indx;
+ unsigned long int *counts;
+ bfd_vma *bitmask;
+ bfd_byte *contents;
+ long int min_dynindx;
+ unsigned long int bucketcount;
+ unsigned long int symindx;
+ long int local_indx;
+ long int shift1, shift2;
+ unsigned long int mask;
+};
+
+/* 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_gnu_hash_codes (struct elf_link_hash_entry *h, void *data)
+{
+ struct collect_gnu_hash_codes *s = 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;
+
+ /* Ignore also local symbols and undefined symbols. */
+ if (! (*s->bed->elf_hash_symbol) (h))
+ 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_gnu_hash (name);
+
+ /* Store the found hash value in the array for compute_bucket_count,
+ and also for .dynsym reordering purposes. */
+ s->hashcodes[s->nsyms] = ha;
+ s->hashval[h->dynindx] = ha;
+ ++s->nsyms;
+ if (s->min_dynindx < 0 || s->min_dynindx > h->dynindx)
+ s->min_dynindx = h->dynindx;
if (alc != NULL)
free (alc);
@@ -4435,6 +5113,61 @@ elf_collect_hash_codes (struct elf_link_hash_entry *h, void *data)
return TRUE;
}
+/* This function will be called though elf_link_hash_traverse to do
+ final dynaminc symbol renumbering. */
+
+static bfd_boolean
+elf_renumber_gnu_hash_syms (struct elf_link_hash_entry *h, void *data)
+{
+ struct collect_gnu_hash_codes *s = data;
+ unsigned long int bucket;
+ unsigned long int val;
+
+ if (h->root.type == bfd_link_hash_warning)
+ h = (struct elf_link_hash_entry *) h->root.u.i.link;
+
+ /* Ignore indirect symbols. */
+ if (h->dynindx == -1)
+ return TRUE;
+
+ /* Ignore also local symbols and undefined symbols. */
+ if (! (*s->bed->elf_hash_symbol) (h))
+ {
+ if (h->dynindx >= s->min_dynindx)
+ h->dynindx = s->local_indx++;
+ return TRUE;
+ }
+
+ bucket = s->hashval[h->dynindx] % s->bucketcount;
+ val = (s->hashval[h->dynindx] >> s->shift1)
+ & ((s->maskbits >> s->shift1) - 1);
+ s->bitmask[val] |= ((bfd_vma) 1) << (s->hashval[h->dynindx] & s->mask);
+ s->bitmask[val]
+ |= ((bfd_vma) 1) << ((s->hashval[h->dynindx] >> s->shift2) & s->mask);
+ val = s->hashval[h->dynindx] & ~(unsigned long int) 1;
+ if (s->counts[bucket] == 1)
+ /* Last element terminates the chain. */
+ val |= 1;
+ bfd_put_32 (s->output_bfd, val,
+ s->contents + (s->indx[bucket] - s->symindx) * 4);
+ --s->counts[bucket];
+ h->dynindx = s->indx[bucket]++;
+ return TRUE;
+}
+
+/* Return TRUE if symbol should be hashed in the `.gnu.hash' section. */
+
+bfd_boolean
+_bfd_elf_hash_symbol (struct elf_link_hash_entry *h)
+{
+ return !(h->forced_local
+ || h->root.type == bfd_link_hash_undefined
+ || h->root.type == bfd_link_hash_undefweak
+ || ((h->root.type == bfd_link_hash_defined
+ || h->root.type == bfd_link_hash_defweak)
+ && h->root.u.def.section->output_section == NULL));
+}
+
/* 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,
@@ -4456,42 +5189,26 @@ static const size_t elf_buckets[] =
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)
+compute_bucket_count (struct bfd_link_info *info, unsigned long int *hashcodes,
+ unsigned long int nsyms, int gnu_hash)
{
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);
+ 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
@@ -4500,6 +5217,13 @@ compute_bucket_count (struct bfd_link_info *info)
if (minsize == 0)
minsize = 1;
best_size = maxsize = nsyms * 2;
+ if (gnu_hash)
+ {
+ if (minsize < 2)
+ minsize = 2;
+ if ((best_size & 31) == 0)
+ ++best_size;
+ }
/* Create array where we count the collisions in. We must use bfd_malloc
since the size could be large. */
@@ -4507,10 +5231,7 @@ compute_bucket_count (struct bfd_link_info *info)
amt *= sizeof (unsigned long int);
counts = bfd_malloc (amt);
if (counts == NULL)
- {
- free (hashcodes);
- return 0;
- }
+ 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
@@ -4522,6 +5243,9 @@ compute_bucket_count (struct bfd_link_info *info)
unsigned long int j;
unsigned long int fact;
+ if (gnu_hash && (i & 31) == 0)
+ continue;
+
memset (counts, '\0', i * sizeof (unsigned long int));
/* Determine how often each hash bucket is used. */
@@ -4537,9 +5261,9 @@ compute_bucket_count (struct bfd_link_info *info)
# 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);
+ /* We in any case need 2 + DYNSYMCOUNT entries for the size values
+ and the chains. */
+ max = (2 + dynsymcount) * bed->s->sizeof_hash_entry;
# if 1
/* Variant 1: optimize for short chains. We add the squares
@@ -4549,7 +5273,7 @@ compute_bucket_count (struct bfd_link_info *info)
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;
+ fact = i / (BFD_TARGET_PAGESIZE / bed->s->sizeof_hash_entry) + 1;
max *= fact * fact;
# else
/* Variant 2: Optimize a lot more for small table. Here we
@@ -4560,7 +5284,7 @@ compute_bucket_count (struct bfd_link_info *info)
/* 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;
+ fact = i / (BFD_TARGET_PAGESIZE / bed->s->sizeof_hash_entry) + 1;
max *= fact;
# endif
@@ -4583,14 +5307,13 @@ compute_bucket_count (struct bfd_link_info *info)
for (i = 0; elf_buckets[i] != 0; i++)
{
best_size = elf_buckets[i];
- if (dynsymcount < elf_buckets[i + 1])
+ if (nsyms < elf_buckets[i + 1])
break;
}
+ if (gnu_hash && best_size < 2)
+ best_size = 2;
}
- /* Free the arrays we needed. */
- free (hashcodes);
-
return best_size;
}
@@ -4621,6 +5344,8 @@ bfd_elf_size_dynamic_sections (bfd *output_bfd,
if (!is_elf_hash_table (info->hash))
return TRUE;
+ bed = get_elf_backend_data (output_bfd);
+ elf_tdata (output_bfd)->relro = info->relro;
if (info->execstack)
elf_tdata (output_bfd)->stack_flags = PF_R | PF_W | PF_X;
else if (info->noexecstack)
@@ -4637,7 +5362,7 @@ bfd_elf_size_dynamic_sections (bfd *output_bfd,
{
asection *s;
- if (inputobj->flags & DYNAMIC)
+ if (inputobj->flags & (DYNAMIC | BFD_LINKER_CREATED))
continue;
s = bfd_get_section_by_name (inputobj, ".note.GNU-stack");
if (s)
@@ -4646,7 +5371,7 @@ bfd_elf_size_dynamic_sections (bfd *output_bfd,
exec = PF_X;
notesec = s;
}
- else
+ else if (bed->default_execstack)
exec = PF_X;
}
if (notesec)
@@ -4660,15 +5385,20 @@ bfd_elf_size_dynamic_sections (bfd *output_bfd,
/* 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;
+ elf_hash_table (info)->init_got_refcount
+ = elf_hash_table (info)->init_got_offset;
+ elf_hash_table (info)->init_plt_refcount
+ = elf_hash_table (info)->init_plt_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;
+ if (! _bfd_elf_maybe_strip_eh_frame_hdr (info))
+ return FALSE;
+
dynobj = elf_hash_table (info)->dynobj;
/* If there were no dynamic objects in the link, there is nothing to
@@ -4676,9 +5406,6 @@ bfd_elf_size_dynamic_sections (bfd *output_bfd,
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;
@@ -4686,6 +5413,7 @@ bfd_elf_size_dynamic_sections (bfd *output_bfd,
asection *dynstr;
struct bfd_elf_version_tree *t;
struct bfd_elf_version_expr *d;
+ asection *s;
bfd_boolean all_defined;
*sinterpptr = bfd_get_section_by_name (dynobj, ".interp");
@@ -4758,7 +5486,8 @@ bfd_elf_size_dynamic_sections (bfd *output_bfd,
/* 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)
+ if (info->export_dynamic
+ || (info->executable && info->dynamic))
{
elf_link_hash_traverse (elf_hash_table (info),
_bfd_elf_export_symbol,
@@ -4811,8 +5540,7 @@ bfd_elf_size_dynamic_sections (bfd *output_bfd,
/* 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->def_dynamic
&& (newh->root.type == bfd_link_hash_defined
|| newh->root.type == bfd_link_hash_defweak))
d->symver = 1;
@@ -4860,7 +5588,7 @@ bfd_elf_size_dynamic_sections (bfd *output_bfd,
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
+ values later, in bfd_elf_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
@@ -4871,8 +5599,8 @@ bfd_elf_size_dynamic_sections (bfd *output_bfd,
FALSE, FALSE)
: NULL);
if (h != NULL
- && (h->elf_link_hash_flags & (ELF_LINK_HASH_REF_REGULAR
- | ELF_LINK_HASH_DEF_REGULAR)) != 0)
+ && (h->ref_regular
+ || h->def_regular))
{
if (!_bfd_elf_add_dynamic_entry (info, DT_INIT, 0))
return FALSE;
@@ -4883,14 +5611,15 @@ bfd_elf_size_dynamic_sections (bfd *output_bfd,
FALSE, FALSE)
: NULL);
if (h != NULL
- && (h->elf_link_hash_flags & (ELF_LINK_HASH_REF_REGULAR
- | ELF_LINK_HASH_DEF_REGULAR)) != 0)
+ && (h->ref_regular
+ || h->def_regular))
{
if (!_bfd_elf_add_dynamic_entry (info, DT_FINI, 0))
return FALSE;
}
- if (bfd_get_section_by_name (output_bfd, ".preinit_array") != NULL)
+ s = bfd_get_section_by_name (output_bfd, ".preinit_array");
+ if (s != NULL && s->linker_has_input)
{
/* DT_PREINIT_ARRAY is not allowed in shared library. */
if (! info->executable)
@@ -4900,15 +5629,16 @@ bfd_elf_size_dynamic_sections (bfd *output_bfd,
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;
- }
+ if (bfd_get_flavour (sub) == bfd_target_elf_flavour)
+ for (o = sub->sections; o != NULL; o = o->next)
+ if (elf_section_data (o)->this_hdr.sh_type
+ == SHT_PREINIT_ARRAY)
+ {
+ (*_bfd_error_handler)
+ (_("%B: .preinit_array section is not allowed in DSO"),
+ sub);
+ break;
+ }
bfd_set_error (bfd_error_nonrepresentable_section);
return FALSE;
@@ -4918,13 +5648,15 @@ bfd_elf_size_dynamic_sections (bfd *output_bfd,
|| !_bfd_elf_add_dynamic_entry (info, DT_PREINIT_ARRAYSZ, 0))
return FALSE;
}
- if (bfd_get_section_by_name (output_bfd, ".init_array") != NULL)
+ s = bfd_get_section_by_name (output_bfd, ".init_array");
+ if (s != NULL && s->linker_has_input)
{
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)
+ s = bfd_get_section_by_name (output_bfd, ".fini_array");
+ if (s != NULL && s->linker_has_input)
{
if (!_bfd_elf_add_dynamic_entry (info, DT_FINI_ARRAY, 0)
|| !_bfd_elf_add_dynamic_entry (info, DT_FINI_ARRAYSZ, 0))
@@ -4941,7 +5673,10 @@ bfd_elf_size_dynamic_sections (bfd *output_bfd,
bfd_size_type strsize;
strsize = _bfd_elf_strtab_size (elf_hash_table (info)->dynstr);
- if (!_bfd_elf_add_dynamic_entry (info, DT_HASH, 0)
+ if ((info->emit_hash
+ && !_bfd_elf_add_dynamic_entry (info, DT_HASH, 0))
+ || (info->emit_gnu_hash
+ && !_bfd_elf_add_dynamic_entry (info, DT_GNU_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)
@@ -4959,11 +5694,8 @@ bfd_elf_size_dynamic_sections (bfd *output_bfd,
if (elf_hash_table (info)->dynamic_sections_created)
{
- bfd_size_type dynsymcount;
+ unsigned long section_sym_count;
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");
@@ -4977,8 +5709,8 @@ bfd_elf_size_dynamic_sections (bfd *output_bfd,
if (verdefs != NULL && verdefs->vernum == 0)
verdefs = verdefs->next;
- if (verdefs == NULL)
- _bfd_strip_section_from_output (info, s);
+ if (verdefs == NULL && !info->create_default_symver)
+ s->flags |= SEC_EXCLUDE;
else
{
unsigned int cdefs;
@@ -4987,6 +5719,9 @@ bfd_elf_size_dynamic_sections (bfd *output_bfd,
bfd_byte *p;
Elf_Internal_Verdef def;
Elf_Internal_Verdaux defaux;
+ struct bfd_link_hash_entry *bh;
+ struct elf_link_hash_entry *h;
+ const char *name;
cdefs = 0;
size = 0;
@@ -4996,6 +5731,13 @@ bfd_elf_size_dynamic_sections (bfd *output_bfd,
size += sizeof (Elf_External_Verdaux);
++cdefs;
+ /* Make space for the default version. */
+ if (info->create_default_symver)
+ {
+ size += sizeof (Elf_External_Verdef);
+ ++cdefs;
+ }
+
for (t = verdefs; t != NULL; t = t->next)
{
struct bfd_elf_version_deps *n;
@@ -5008,9 +5750,9 @@ bfd_elf_size_dynamic_sections (bfd *output_bfd,
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)
+ s->size = size;
+ s->contents = bfd_alloc (output_bfd, s->size);
+ if (s->contents == NULL && s->size != 0)
return FALSE;
/* Fill in the version definition section. */
@@ -5021,9 +5763,17 @@ bfd_elf_size_dynamic_sections (bfd *output_bfd,
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 (info->create_default_symver)
+ {
+ def.vd_aux = 2 * sizeof (Elf_External_Verdef);
+ def.vd_next = sizeof (Elf_External_Verdef);
+ }
+ else
+ {
+ 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)
{
@@ -5031,13 +5781,13 @@ bfd_elf_size_dynamic_sections (bfd *output_bfd,
soname_indx);
def.vd_hash = bfd_elf_hash (soname);
defaux.vda_name = soname_indx;
+ name = soname;
}
else
{
- const char *name;
bfd_size_type indx;
- name = basename (output_bfd->filename);
+ name = lbasename (output_bfd->filename);
def.vd_hash = bfd_elf_hash (name);
indx = _bfd_elf_strtab_add (elf_hash_table (info)->dynstr,
name, FALSE);
@@ -5050,6 +5800,38 @@ bfd_elf_size_dynamic_sections (bfd *output_bfd,
_bfd_elf_swap_verdef_out (output_bfd, &def,
(Elf_External_Verdef *) p);
p += sizeof (Elf_External_Verdef);
+ if (info->create_default_symver)
+ {
+ /* Add a symbol representing this version. */
+ bh = NULL;
+ if (! (_bfd_generic_link_add_one_symbol
+ (info, dynobj, 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->non_elf = 0;
+ h->def_regular = 1;
+ h->type = STT_OBJECT;
+ h->verinfo.vertree = NULL;
+
+ if (! bfd_elf_link_record_dynamic_symbol (info, h))
+ return FALSE;
+
+ /* Create a duplicate of the base version with the same
+ aux block, but different flags. */
+ def.vd_flags = 0;
+ def.vd_ndx = 2;
+ def.vd_aux = sizeof (Elf_External_Verdef);
+ if (verdefs)
+ def.vd_next = (sizeof (Elf_External_Verdef)
+ + 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);
+ }
_bfd_elf_swap_verdaux_out (output_bfd, &defaux,
(Elf_External_Verdaux *) p);
p += sizeof (Elf_External_Verdaux);
@@ -5058,8 +5840,6 @@ bfd_elf_size_dynamic_sections (bfd *output_bfd,
{
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)
@@ -5073,8 +5853,8 @@ bfd_elf_size_dynamic_sections (bfd *output_bfd,
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->non_elf = 0;
+ h->def_regular = 1;
h->type = STT_OBJECT;
h->verinfo.vertree = t;
@@ -5087,7 +5867,7 @@ bfd_elf_size_dynamic_sections (bfd *output_bfd,
&& t->locals.list == NULL
&& ! t->used)
def.vd_flags |= VER_FLG_WEAK;
- def.vd_ndx = t->vernum + 1;
+ def.vd_ndx = t->vernum + (info->create_default_symver ? 2 : 1);
def.vd_cnt = cdeps + 1;
def.vd_hash = bfd_elf_hash (t->name);
def.vd_aux = sizeof (Elf_External_Verdef);
@@ -5184,7 +5964,7 @@ bfd_elf_size_dynamic_sections (bfd *output_bfd,
&sinfo);
if (elf_tdata (output_bfd)->verref == NULL)
- _bfd_strip_section_from_output (info, s);
+ s->flags |= SEC_EXCLUDE;
else
{
Elf_Internal_Verneed *t;
@@ -5207,8 +5987,8 @@ bfd_elf_size_dynamic_sections (bfd *output_bfd,
size += sizeof (Elf_External_Vernaux);
}
- s->_raw_size = size;
- s->contents = bfd_alloc (output_bfd, s->_raw_size);
+ s->size = size;
+ s->contents = bfd_alloc (output_bfd, s->size);
if (s->contents == NULL)
return FALSE;
@@ -5230,7 +6010,7 @@ bfd_elf_size_dynamic_sections (bfd *output_bfd,
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),
+ : lbasename (t->vn_bfd->filename),
FALSE);
if (indx == (bfd_size_type) -1)
return FALSE;
@@ -5273,28 +6053,100 @@ bfd_elf_size_dynamic_sections (bfd *output_bfd,
}
}
+ if ((elf_tdata (output_bfd)->cverrefs == 0
+ && elf_tdata (output_bfd)->cverdefs == 0)
+ || _bfd_elf_link_renumber_dynsyms (output_bfd, info,
+ &section_sym_count) == 0)
+ {
+ s = bfd_get_section_by_name (dynobj, ".gnu.version");
+ s->flags |= SEC_EXCLUDE;
+ }
+ }
+ return TRUE;
+}
+
+/* Find the first non-excluded output section. We'll use its
+ section symbol for some emitted relocs. */
+void
+_bfd_elf_init_1_index_section (bfd *output_bfd, struct bfd_link_info *info)
+{
+ asection *s;
+
+ for (s = output_bfd->sections; s != NULL; s = s->next)
+ if ((s->flags & (SEC_EXCLUDE | SEC_ALLOC)) == SEC_ALLOC
+ && !_bfd_elf_link_omit_section_dynsym (output_bfd, info, s))
+ {
+ elf_hash_table (info)->text_index_section = s;
+ break;
+ }
+}
+
+/* Find two non-excluded output sections, one for code, one for data.
+ We'll use their section symbols for some emitted relocs. */
+void
+_bfd_elf_init_2_index_sections (bfd *output_bfd, struct bfd_link_info *info)
+{
+ asection *s;
+
+ for (s = output_bfd->sections; s != NULL; s = s->next)
+ if (((s->flags & (SEC_EXCLUDE | SEC_ALLOC | SEC_READONLY))
+ == (SEC_ALLOC | SEC_READONLY))
+ && !_bfd_elf_link_omit_section_dynsym (output_bfd, info, s))
+ {
+ elf_hash_table (info)->text_index_section = s;
+ break;
+ }
+
+ for (s = output_bfd->sections; s != NULL; s = s->next)
+ if (((s->flags & (SEC_EXCLUDE | SEC_ALLOC | SEC_READONLY)) == SEC_ALLOC)
+ && !_bfd_elf_link_omit_section_dynsym (output_bfd, info, s))
+ {
+ elf_hash_table (info)->data_index_section = s;
+ break;
+ }
+
+ if (elf_hash_table (info)->text_index_section == NULL)
+ elf_hash_table (info)->text_index_section
+ = elf_hash_table (info)->data_index_section;
+}
+
+bfd_boolean
+bfd_elf_size_dynsym_hash_dynstr (bfd *output_bfd, struct bfd_link_info *info)
+{
+ const struct elf_backend_data *bed;
+
+ if (!is_elf_hash_table (info->hash))
+ return TRUE;
+
+ bed = get_elf_backend_data (output_bfd);
+ (*bed->elf_backend_init_index_section) (output_bfd, info);
+
+ if (elf_hash_table (info)->dynamic_sections_created)
+ {
+ bfd *dynobj;
+ asection *s;
+ bfd_size_type dynsymcount;
+ unsigned long section_sym_count;
+ unsigned int dtagcount;
+
+ dynobj = elf_hash_table (info)->dynobj;
+
/* 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);
+ dynsymcount = _bfd_elf_link_renumber_dynsyms (output_bfd, info,
+ &section_sym_count);
/* 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))
+ if (dynsymcount != 0
+ && (s->flags & SEC_EXCLUDE) == 0)
{
- _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);
+ s->size = dynsymcount * sizeof (Elf_External_Versym);
+ s->contents = bfd_zalloc (output_bfd, s->size);
if (s->contents == NULL)
return FALSE;
@@ -5310,49 +6162,236 @@ bfd_elf_size_dynamic_sections (bfd *output_bfd,
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;
+ s->size = dynsymcount * bed->s->sizeof_sym;
if (dynsymcount != 0)
{
- Elf_Internal_Sym isym;
+ s->contents = bfd_alloc (output_bfd, s->size);
+ if (s->contents == NULL)
+ return FALSE;
- /* 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);
+ /* The first entry in .dynsym is a dummy symbol.
+ Clear all the section syms, in case we don't output them all. */
+ ++section_sym_count;
+ memset (s->contents, 0, section_sym_count * bed->s->sizeof_sym);
}
+ elf_hash_table (info)->bucketcount = 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);
+ if (info->emit_hash)
+ {
+ unsigned long int *hashcodes;
+ unsigned long int *hashcodesp;
+ bfd_size_type amt;
+ unsigned long int nsyms;
+ size_t bucketcount;
+ size_t hash_entry_size;
+
+ /* 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 * sizeof (unsigned long int);
+ hashcodes = bfd_malloc (amt);
+ if (hashcodes == NULL)
+ return FALSE;
+ hashcodesp = hashcodes;
- 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;
+ /* Put all hash values in HASHCODES. */
+ elf_link_hash_traverse (elf_hash_table (info),
+ elf_collect_hash_codes, &hashcodesp);
+
+ nsyms = hashcodesp - hashcodes;
+ bucketcount
+ = compute_bucket_count (info, hashcodes, nsyms, 0);
+ free (hashcodes);
+
+ if (bucketcount == 0)
+ return FALSE;
+
+ elf_hash_table (info)->bucketcount = bucketcount;
+
+ s = bfd_get_section_by_name (dynobj, ".hash");
+ BFD_ASSERT (s != NULL);
+ hash_entry_size = elf_section_data (s)->this_hdr.sh_entsize;
+ s->size = ((2 + bucketcount + dynsymcount) * hash_entry_size);
+ s->contents = bfd_zalloc (output_bfd, s->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);
+ }
+
+ if (info->emit_gnu_hash)
+ {
+ size_t i, cnt;
+ unsigned char *contents;
+ struct collect_gnu_hash_codes cinfo;
+ bfd_size_type amt;
+ size_t bucketcount;
+
+ memset (&cinfo, 0, sizeof (cinfo));
+
+ /* 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 * 2 * sizeof (unsigned long int);
+ cinfo.hashcodes = bfd_malloc (amt);
+ if (cinfo.hashcodes == NULL)
+ return FALSE;
+
+ cinfo.hashval = cinfo.hashcodes + dynsymcount;
+ cinfo.min_dynindx = -1;
+ cinfo.output_bfd = output_bfd;
+ cinfo.bed = bed;
+
+ /* Put all hash values in HASHCODES. */
+ elf_link_hash_traverse (elf_hash_table (info),
+ elf_collect_gnu_hash_codes, &cinfo);
+
+ bucketcount
+ = compute_bucket_count (info, cinfo.hashcodes, cinfo.nsyms, 1);
- 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);
+ if (bucketcount == 0)
+ {
+ free (cinfo.hashcodes);
+ return FALSE;
+ }
- elf_hash_table (info)->bucketcount = bucketcount;
+ s = bfd_get_section_by_name (dynobj, ".gnu.hash");
+ BFD_ASSERT (s != NULL);
+
+ if (cinfo.nsyms == 0)
+ {
+ /* Empty .gnu.hash section is special. */
+ BFD_ASSERT (cinfo.min_dynindx == -1);
+ free (cinfo.hashcodes);
+ s->size = 5 * 4 + bed->s->arch_size / 8;
+ contents = bfd_zalloc (output_bfd, s->size);
+ if (contents == NULL)
+ return FALSE;
+ s->contents = contents;
+ /* 1 empty bucket. */
+ bfd_put_32 (output_bfd, 1, contents);
+ /* SYMIDX above the special symbol 0. */
+ bfd_put_32 (output_bfd, 1, contents + 4);
+ /* Just one word for bitmask. */
+ bfd_put_32 (output_bfd, 1, contents + 8);
+ /* Only hash fn bloom filter. */
+ bfd_put_32 (output_bfd, 0, contents + 12);
+ /* No hashes are valid - empty bitmask. */
+ bfd_put (bed->s->arch_size, output_bfd, 0, contents + 16);
+ /* No hashes in the only bucket. */
+ bfd_put_32 (output_bfd, 0,
+ contents + 16 + bed->s->arch_size / 8);
+ }
+ else
+ {
+ unsigned long int maskwords, maskbitslog2;
+ BFD_ASSERT (cinfo.min_dynindx != -1);
+
+ maskbitslog2 = bfd_log2 (cinfo.nsyms) + 1;
+ if (maskbitslog2 < 3)
+ maskbitslog2 = 5;
+ else if ((1 << (maskbitslog2 - 2)) & cinfo.nsyms)
+ maskbitslog2 = maskbitslog2 + 3;
+ else
+ maskbitslog2 = maskbitslog2 + 2;
+ if (bed->s->arch_size == 64)
+ {
+ if (maskbitslog2 == 5)
+ maskbitslog2 = 6;
+ cinfo.shift1 = 6;
+ }
+ else
+ cinfo.shift1 = 5;
+ cinfo.mask = (1 << cinfo.shift1) - 1;
+ cinfo.shift2 = maskbitslog2;
+ cinfo.maskbits = 1 << maskbitslog2;
+ maskwords = 1 << (maskbitslog2 - cinfo.shift1);
+ amt = bucketcount * sizeof (unsigned long int) * 2;
+ amt += maskwords * sizeof (bfd_vma);
+ cinfo.bitmask = bfd_malloc (amt);
+ if (cinfo.bitmask == NULL)
+ {
+ free (cinfo.hashcodes);
+ return FALSE;
+ }
+
+ cinfo.counts = (void *) (cinfo.bitmask + maskwords);
+ cinfo.indx = cinfo.counts + bucketcount;
+ cinfo.symindx = dynsymcount - cinfo.nsyms;
+ memset (cinfo.bitmask, 0, maskwords * sizeof (bfd_vma));
+
+ /* Determine how often each hash bucket is used. */
+ memset (cinfo.counts, 0, bucketcount * sizeof (cinfo.counts[0]));
+ for (i = 0; i < cinfo.nsyms; ++i)
+ ++cinfo.counts[cinfo.hashcodes[i] % bucketcount];
+
+ for (i = 0, cnt = cinfo.symindx; i < bucketcount; ++i)
+ if (cinfo.counts[i] != 0)
+ {
+ cinfo.indx[i] = cnt;
+ cnt += cinfo.counts[i];
+ }
+ BFD_ASSERT (cnt == dynsymcount);
+ cinfo.bucketcount = bucketcount;
+ cinfo.local_indx = cinfo.min_dynindx;
+
+ s->size = (4 + bucketcount + cinfo.nsyms) * 4;
+ s->size += cinfo.maskbits / 8;
+ contents = bfd_zalloc (output_bfd, s->size);
+ if (contents == NULL)
+ {
+ free (cinfo.bitmask);
+ free (cinfo.hashcodes);
+ return FALSE;
+ }
+
+ s->contents = contents;
+ bfd_put_32 (output_bfd, bucketcount, contents);
+ bfd_put_32 (output_bfd, cinfo.symindx, contents + 4);
+ bfd_put_32 (output_bfd, maskwords, contents + 8);
+ bfd_put_32 (output_bfd, cinfo.shift2, contents + 12);
+ contents += 16 + cinfo.maskbits / 8;
+
+ for (i = 0; i < bucketcount; ++i)
+ {
+ if (cinfo.counts[i] == 0)
+ bfd_put_32 (output_bfd, 0, contents);
+ else
+ bfd_put_32 (output_bfd, cinfo.indx[i], contents);
+ contents += 4;
+ }
+
+ cinfo.contents = contents;
+
+ /* Renumber dynamic symbols, populate .gnu.hash section. */
+ elf_link_hash_traverse (elf_hash_table (info),
+ elf_renumber_gnu_hash_syms, &cinfo);
+
+ contents = s->contents + 16;
+ for (i = 0; i < maskwords; ++i)
+ {
+ bfd_put (bed->s->arch_size, output_bfd, cinfo.bitmask[i],
+ contents);
+ contents += bed->s->arch_size / 8;
+ }
+
+ free (cinfo.bitmask);
+ free (cinfo.hashcodes);
+ }
+ }
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);
+ s->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))
@@ -5421,6 +6460,719 @@ struct elf_outext_info
struct elf_final_link_info *finfo;
};
+
+/* Support for evaluating a complex relocation.
+
+ Complex relocations are generalized, self-describing relocations. The
+ implementation of them consists of two parts: complex symbols, and the
+ relocations themselves.
+
+ The relocations are use a reserved elf-wide relocation type code (R_RELC
+ external / BFD_RELOC_RELC internal) and an encoding of relocation field
+ information (start bit, end bit, word width, etc) into the addend. This
+ information is extracted from CGEN-generated operand tables within gas.
+
+ Complex symbols are mangled symbols (BSF_RELC external / STT_RELC
+ internal) representing prefix-notation expressions, including but not
+ limited to those sorts of expressions normally encoded as addends in the
+ addend field. The symbol mangling format is:
+
+ <node> := <literal>
+ | <unary-operator> ':' <node>
+ | <binary-operator> ':' <node> ':' <node>
+ ;
+
+ <literal> := 's' <digits=N> ':' <N character symbol name>
+ | 'S' <digits=N> ':' <N character section name>
+ | '#' <hexdigits>
+ ;
+
+ <binary-operator> := as in C
+ <unary-operator> := as in C, plus "0-" for unambiguous negation. */
+
+static void
+set_symbol_value (bfd * bfd_with_globals,
+ struct elf_final_link_info * finfo,
+ int symidx,
+ bfd_vma val)
+{
+ bfd_boolean is_local;
+ Elf_Internal_Sym * sym;
+ struct elf_link_hash_entry ** sym_hashes;
+ struct elf_link_hash_entry * h;
+
+ sym_hashes = elf_sym_hashes (bfd_with_globals);
+ sym = finfo->internal_syms + symidx;
+ is_local = ELF_ST_BIND(sym->st_info) == STB_LOCAL;
+
+ if (is_local)
+ {
+ /* It is a local symbol: move it to the
+ "absolute" section and give it a value. */
+ sym->st_shndx = SHN_ABS;
+ sym->st_value = val;
+ }
+ else
+ {
+ /* It is a global symbol: set its link type
+ to "defined" and give it a value. */
+ h = sym_hashes [symidx];
+ 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->root.type = bfd_link_hash_defined;
+ h->root.u.def.value = val;
+ h->root.u.def.section = bfd_abs_section_ptr;
+ }
+}
+
+static bfd_boolean
+resolve_symbol (const char * name,
+ bfd * input_bfd,
+ struct elf_final_link_info * finfo,
+ bfd_vma * result,
+ size_t locsymcount)
+{
+ Elf_Internal_Sym * sym;
+ struct bfd_link_hash_entry * global_entry;
+ const char * candidate = NULL;
+ Elf_Internal_Shdr * symtab_hdr;
+ asection * sec = NULL;
+ size_t i;
+
+ symtab_hdr = & elf_tdata (input_bfd)->symtab_hdr;
+
+ for (i = 0; i < locsymcount; ++ i)
+ {
+ sym = finfo->internal_syms + i;
+ sec = finfo->sections [i];
+
+ if (ELF_ST_BIND (sym->st_info) != STB_LOCAL)
+ continue;
+
+ candidate = bfd_elf_string_from_elf_section (input_bfd,
+ symtab_hdr->sh_link,
+ sym->st_name);
+#ifdef DEBUG
+ printf ("Comparing string: '%s' vs. '%s' = 0x%x\n",
+ name, candidate, (unsigned int)sym->st_value);
+#endif
+ if (candidate && strcmp (candidate, name) == 0)
+ {
+ * result = sym->st_value;
+
+ if (sym->st_shndx > SHN_UNDEF &&
+ sym->st_shndx < SHN_LORESERVE)
+ {
+#ifdef DEBUG
+ printf ("adjusting for sec '%s' @ 0x%x + 0x%x\n",
+ sec->output_section->name,
+ (unsigned int)sec->output_section->vma,
+ (unsigned int)sec->output_offset);
+#endif
+ * result += sec->output_offset + sec->output_section->vma;
+ }
+#ifdef DEBUG
+ printf ("Found symbol with effective value %8.8x\n", (unsigned int)* result);
+#endif
+ return TRUE;
+ }
+ }
+
+ /* Hmm, haven't found it yet. perhaps it is a global. */
+ global_entry = bfd_link_hash_lookup (finfo->info->hash, name, FALSE, FALSE, TRUE);
+ if (!global_entry)
+ return FALSE;
+
+ if (global_entry->type == bfd_link_hash_defined
+ || global_entry->type == bfd_link_hash_defweak)
+ {
+ * result = global_entry->u.def.value
+ + global_entry->u.def.section->output_section->vma
+ + global_entry->u.def.section->output_offset;
+#ifdef DEBUG
+ printf ("Found GLOBAL symbol '%s' with value %8.8x\n",
+ global_entry->root.string, (unsigned int)*result);
+#endif
+ return TRUE;
+ }
+
+ if (global_entry->type == bfd_link_hash_common)
+ {
+ *result = global_entry->u.def.value +
+ bfd_com_section_ptr->output_section->vma +
+ bfd_com_section_ptr->output_offset;
+#ifdef DEBUG
+ printf ("Found COMMON symbol '%s' with value %8.8x\n",
+ global_entry->root.string, (unsigned int)*result);
+#endif
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+static bfd_boolean
+resolve_section (const char * name,
+ asection * sections,
+ bfd_vma * result)
+{
+ asection * curr;
+ unsigned int len;
+
+ for (curr = sections; curr; curr = curr->next)
+ if (strcmp (curr->name, name) == 0)
+ {
+ *result = curr->vma;
+ return TRUE;
+ }
+
+ /* Hmm. still haven't found it. try pseudo-section names. */
+ for (curr = sections; curr; curr = curr->next)
+ {
+ len = strlen (curr->name);
+ if (len > strlen (name))
+ continue;
+
+ if (strncmp (curr->name, name, len) == 0)
+ {
+ if (strncmp (".end", name + len, 4) == 0)
+ {
+ *result = curr->vma + curr->size;
+ return TRUE;
+ }
+
+ /* Insert more pseudo-section names here, if you like. */
+ }
+ }
+
+ return FALSE;
+}
+
+static void
+undefined_reference (const char * reftype,
+ const char * name)
+{
+ _bfd_error_handler (_("undefined %s reference in complex symbol: %s"), reftype, name);
+}
+
+static bfd_boolean
+eval_symbol (bfd_vma * result,
+ char * sym,
+ char ** advanced,
+ bfd * input_bfd,
+ struct elf_final_link_info * finfo,
+ bfd_vma addr,
+ bfd_vma section_offset,
+ size_t locsymcount,
+ int signed_p)
+{
+ int len;
+ int symlen;
+ bfd_vma a;
+ bfd_vma b;
+ const int bufsz = 4096;
+ char symbuf [bufsz];
+ const char * symend;
+ bfd_boolean symbol_is_section = FALSE;
+
+ len = strlen (sym);
+ symend = sym + len;
+
+ if (len < 1 || len > bufsz)
+ {
+ bfd_set_error (bfd_error_invalid_operation);
+ return FALSE;
+ }
+
+ switch (* sym)
+ {
+ case '.':
+ * result = addr + section_offset;
+ * advanced = sym + 1;
+ return TRUE;
+
+ case '#':
+ ++ sym;
+ * result = strtoul (sym, advanced, 16);
+ return TRUE;
+
+ case 'S':
+ symbol_is_section = TRUE;
+ case 's':
+ ++ sym;
+ symlen = strtol (sym, &sym, 10);
+ ++ sym; /* Skip the trailing ':'. */
+
+ if ((symend < sym) || ((symlen + 1) > bufsz))
+ {
+ bfd_set_error (bfd_error_invalid_operation);
+ return FALSE;
+ }
+
+ memcpy (symbuf, sym, symlen);
+ symbuf [symlen] = '\0';
+ * advanced = sym + symlen;
+
+ /* Is it always possible, with complex symbols, that gas "mis-guessed"
+ the symbol as a section, or vice-versa. so we're pretty liberal in our
+ interpretation here; section means "try section first", not "must be a
+ section", and likewise with symbol. */
+
+ if (symbol_is_section)
+ {
+ if ((resolve_section (symbuf, finfo->output_bfd->sections, result) != TRUE)
+ && (resolve_symbol (symbuf, input_bfd, finfo, result, locsymcount) != TRUE))
+ {
+ undefined_reference ("section", symbuf);
+ return FALSE;
+ }
+ }
+ else
+ {
+ if ((resolve_symbol (symbuf, input_bfd, finfo, result, locsymcount) != TRUE)
+ && (resolve_section (symbuf, finfo->output_bfd->sections,
+ result) != TRUE))
+ {
+ undefined_reference ("symbol", symbuf);
+ return FALSE;
+ }
+ }
+
+ return TRUE;
+
+ /* All that remains are operators. */
+
+#define UNARY_OP(op) \
+ if (strncmp (sym, #op, strlen (#op)) == 0) \
+ { \
+ sym += strlen (#op); \
+ if (* sym == ':') \
+ ++ sym; \
+ if (eval_symbol (& a, sym, & sym, input_bfd, finfo, addr, \
+ section_offset, locsymcount, signed_p) \
+ != TRUE) \
+ return FALSE; \
+ if (signed_p) \
+ * result = op ((signed)a); \
+ else \
+ * result = op a; \
+ * advanced = sym; \
+ return TRUE; \
+ }
+
+#define BINARY_OP(op) \
+ if (strncmp (sym, #op, strlen (#op)) == 0) \
+ { \
+ sym += strlen (#op); \
+ if (* sym == ':') \
+ ++ sym; \
+ if (eval_symbol (& a, sym, & sym, input_bfd, finfo, addr, \
+ section_offset, locsymcount, signed_p) \
+ != TRUE) \
+ return FALSE; \
+ ++ sym; \
+ if (eval_symbol (& b, sym, & sym, input_bfd, finfo, addr, \
+ section_offset, locsymcount, signed_p) \
+ != TRUE) \
+ return FALSE; \
+ if (signed_p) \
+ * result = ((signed) a) op ((signed) b); \
+ else \
+ * result = a op b; \
+ * advanced = sym; \
+ return TRUE; \
+ }
+
+ default:
+ UNARY_OP (0-);
+ BINARY_OP (<<);
+ BINARY_OP (>>);
+ BINARY_OP (==);
+ BINARY_OP (!=);
+ BINARY_OP (<=);
+ BINARY_OP (>=);
+ BINARY_OP (&&);
+ BINARY_OP (||);
+ UNARY_OP (~);
+ UNARY_OP (!);
+ BINARY_OP (*);
+ BINARY_OP (/);
+ BINARY_OP (%);
+ BINARY_OP (^);
+ BINARY_OP (|);
+ BINARY_OP (&);
+ BINARY_OP (+);
+ BINARY_OP (-);
+ BINARY_OP (<);
+ BINARY_OP (>);
+#undef UNARY_OP
+#undef BINARY_OP
+ _bfd_error_handler (_("unknown operator '%c' in complex symbol"), * sym);
+ bfd_set_error (bfd_error_invalid_operation);
+ return FALSE;
+ }
+}
+
+/* Entry point to evaluator, called from elf_link_input_bfd. */
+
+static bfd_boolean
+evaluate_complex_relocation_symbols (bfd * input_bfd,
+ struct elf_final_link_info * finfo,
+ size_t locsymcount)
+{
+ const struct elf_backend_data * bed;
+ Elf_Internal_Shdr * symtab_hdr;
+ struct elf_link_hash_entry ** sym_hashes;
+ asection * reloc_sec;
+ bfd_boolean result = TRUE;
+
+ /* For each section, we're going to check and see if it has any
+ complex relocations, and we're going to evaluate any of them
+ we can. */
+
+ if (finfo->info->relocatable)
+ return TRUE;
+
+ symtab_hdr = & elf_tdata (input_bfd)->symtab_hdr;
+ sym_hashes = elf_sym_hashes (input_bfd);
+ bed = get_elf_backend_data (input_bfd);
+
+ for (reloc_sec = input_bfd->sections; reloc_sec; reloc_sec = reloc_sec->next)
+ {
+ Elf_Internal_Rela * internal_relocs;
+ unsigned long i;
+
+ /* This section was omitted from the link. */
+ if (! reloc_sec->linker_mark)
+ continue;
+
+ /* Only process sections containing relocs. */
+ if ((reloc_sec->flags & SEC_RELOC) == 0)
+ continue;
+
+ if (reloc_sec->reloc_count == 0)
+ continue;
+
+ /* Read in the relocs for this section. */
+ internal_relocs
+ = _bfd_elf_link_read_relocs (input_bfd, reloc_sec, NULL,
+ (Elf_Internal_Rela *) NULL,
+ FALSE);
+ if (internal_relocs == NULL)
+ continue;
+
+ for (i = reloc_sec->reloc_count; i--;)
+ {
+ Elf_Internal_Rela * rel;
+ char * sym_name;
+ bfd_vma index;
+ Elf_Internal_Sym * sym;
+ bfd_vma result;
+ bfd_vma section_offset;
+ bfd_vma addr;
+ int signed_p = 0;
+
+ rel = internal_relocs + i;
+ section_offset = reloc_sec->output_section->vma
+ + reloc_sec->output_offset;
+ addr = rel->r_offset;
+
+ index = ELF32_R_SYM (rel->r_info);
+ if (bed->s->arch_size == 64)
+ index >>= 24;
+
+ if (index == STN_UNDEF)
+ continue;
+
+ if (index < locsymcount)
+ {
+ /* The symbol is local. */
+ sym = finfo->internal_syms + index;
+
+ /* We're only processing STT_RELC or STT_SRELC type symbols. */
+ if ((ELF_ST_TYPE (sym->st_info) != STT_RELC) &&
+ (ELF_ST_TYPE (sym->st_info) != STT_SRELC))
+ continue;
+
+ sym_name = bfd_elf_string_from_elf_section
+ (input_bfd, symtab_hdr->sh_link, sym->st_name);
+
+ signed_p = (ELF_ST_TYPE (sym->st_info) == STT_SRELC);
+ }
+ else
+ {
+ /* The symbol is global. */
+ struct elf_link_hash_entry * h;
+
+ if (elf_bad_symtab (input_bfd))
+ continue;
+
+ h = sym_hashes [index - locsymcount];
+ 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->type != STT_RELC && h->type != STT_SRELC)
+ continue;
+
+ signed_p = (h->type == STT_SRELC);
+ sym_name = (char *) h->root.root.string;
+ }
+#ifdef DEBUG
+ printf ("Encountered a complex symbol!");
+ printf (" (input_bfd %s, section %s, reloc %ld\n",
+ input_bfd->filename, reloc_sec->name, i);
+ printf (" symbol: idx %8.8lx, name %s\n",
+ index, sym_name);
+ printf (" reloc : info %8.8lx, addr %8.8lx\n",
+ rel->r_info, addr);
+ printf (" Evaluating '%s' ...\n ", sym_name);
+#endif
+ if (eval_symbol (& result, sym_name, & sym_name, input_bfd,
+ finfo, addr, section_offset, locsymcount,
+ signed_p))
+ /* Symbol evaluated OK. Update to absolute value. */
+ set_symbol_value (input_bfd, finfo, index, result);
+
+ else
+ result = FALSE;
+ }
+
+ if (internal_relocs != elf_section_data (reloc_sec)->relocs)
+ free (internal_relocs);
+ }
+
+ /* If nothing went wrong, then we adjusted
+ everything we wanted to adjust. */
+ return result;
+}
+
+static void
+put_value (bfd_vma size,
+ unsigned long chunksz,
+ bfd * input_bfd,
+ bfd_vma x,
+ bfd_byte * location)
+{
+ location += (size - chunksz);
+
+ for (; size; size -= chunksz, location -= chunksz, x >>= (chunksz * 8))
+ {
+ switch (chunksz)
+ {
+ 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;
+ }
+ }
+}
+
+static bfd_vma
+get_value (bfd_vma size,
+ unsigned long chunksz,
+ bfd * input_bfd,
+ bfd_byte * location)
+{
+ bfd_vma x = 0;
+
+ for (; size; size -= chunksz, location += chunksz)
+ {
+ switch (chunksz)
+ {
+ default:
+ case 0:
+ abort ();
+ case 1:
+ x = (x << (8 * chunksz)) | bfd_get_8 (input_bfd, location);
+ break;
+ case 2:
+ x = (x << (8 * chunksz)) | bfd_get_16 (input_bfd, location);
+ break;
+ case 4:
+ x = (x << (8 * chunksz)) | bfd_get_32 (input_bfd, location);
+ break;
+ case 8:
+#ifdef BFD64
+ x = (x << (8 * chunksz)) | bfd_get_64 (input_bfd, location);
+#else
+ abort ();
+#endif
+ break;
+ }
+ }
+ return x;
+}
+
+static void
+decode_complex_addend
+ (unsigned long * start, /* in bits */
+ unsigned long * oplen, /* in bits */
+ unsigned long * len, /* in bits */
+ unsigned long * wordsz, /* in bytes */
+ unsigned long * chunksz, /* in bytes */
+ unsigned long * lsb0_p,
+ unsigned long * signed_p,
+ unsigned long * trunc_p,
+ unsigned long encoded)
+{
+ * start = encoded & 0x3F;
+ * len = (encoded >> 6) & 0x3F;
+ * oplen = (encoded >> 12) & 0x3F;
+ * wordsz = (encoded >> 18) & 0xF;
+ * chunksz = (encoded >> 22) & 0xF;
+ * lsb0_p = (encoded >> 27) & 1;
+ * signed_p = (encoded >> 28) & 1;
+ * trunc_p = (encoded >> 29) & 1;
+}
+
+void
+bfd_elf_perform_complex_relocation
+ (bfd * output_bfd ATTRIBUTE_UNUSED,
+ struct bfd_link_info * info,
+ bfd * input_bfd,
+ asection * input_section,
+ bfd_byte * contents,
+ Elf_Internal_Rela * rel,
+ Elf_Internal_Sym * local_syms,
+ asection ** local_sections)
+{
+ const struct elf_backend_data * bed;
+ Elf_Internal_Shdr * symtab_hdr;
+ asection * sec;
+ bfd_vma relocation = 0, shift, x;
+ bfd_vma r_symndx;
+ bfd_vma mask;
+ unsigned long start, oplen, len, wordsz,
+ chunksz, lsb0_p, signed_p, trunc_p;
+
+ /* Perform this reloc, since it is complex.
+ (this is not to say that it necessarily refers to a complex
+ symbol; merely that it is a self-describing CGEN based reloc.
+ i.e. the addend has the complete reloc information (bit start, end,
+ word size, etc) encoded within it.). */
+ r_symndx = ELF32_R_SYM (rel->r_info);
+ bed = get_elf_backend_data (input_bfd);
+ if (bed->s->arch_size == 64)
+ r_symndx >>= 24;
+
+#ifdef DEBUG
+ printf ("Performing complex relocation %ld...\n", r_symndx);
+#endif
+
+ symtab_hdr = & elf_tdata (input_bfd)->symtab_hdr;
+ if (r_symndx < symtab_hdr->sh_info)
+ {
+ /* The symbol is local. */
+ Elf_Internal_Sym * sym;
+
+ sym = local_syms + r_symndx;
+ sec = local_sections [r_symndx];
+ relocation = sym->st_value;
+ if (sym->st_shndx > SHN_UNDEF &&
+ sym->st_shndx < SHN_LORESERVE)
+ relocation += (sec->output_offset +
+ sec->output_section->vma);
+ }
+ else
+ {
+ /* The symbol is global. */
+ struct elf_link_hash_entry **sym_hashes;
+ struct elf_link_hash_entry * h;
+
+ sym_hashes = elf_sym_hashes (input_bfd);
+ h = 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;
+
+ if (h->root.type == bfd_link_hash_defined
+ || h->root.type == bfd_link_hash_defweak)
+ {
+ sec = h->root.u.def.section;
+ relocation = h->root.u.def.value;
+
+ if (! bfd_is_abs_section (sec))
+ relocation += (sec->output_section->vma
+ + sec->output_offset);
+ }
+ if (h->root.type == bfd_link_hash_undefined
+ && !((*info->callbacks->undefined_symbol)
+ (info, h->root.root.string, input_bfd,
+ input_section, rel->r_offset,
+ info->unresolved_syms_in_objects == RM_GENERATE_ERROR
+ || ELF_ST_VISIBILITY (h->other))))
+ return;
+ }
+
+ decode_complex_addend (& start, & oplen, & len, & wordsz,
+ & chunksz, & lsb0_p, & signed_p,
+ & trunc_p, rel->r_addend);
+
+ mask = (((1L << (len - 1)) - 1) << 1) | 1;
+
+ if (lsb0_p)
+ shift = (start + 1) - len;
+ else
+ shift = (8 * wordsz) - (start + len);
+
+ x = get_value (wordsz, chunksz, input_bfd, contents + rel->r_offset);
+
+#ifdef DEBUG
+ printf ("Doing complex reloc: "
+ "lsb0? %ld, signed? %ld, trunc? %ld, wordsz %ld, "
+ "chunksz %ld, start %ld, len %ld, oplen %ld\n"
+ " dest: %8.8lx, mask: %8.8lx, reloc: %8.8lx\n",
+ lsb0_p, signed_p, trunc_p, wordsz, chunksz, start, len,
+ oplen, x, mask, relocation);
+#endif
+
+ if (! trunc_p)
+ {
+ /* Now do an overflow check. */
+ if (bfd_check_overflow ((signed_p ?
+ complain_overflow_signed :
+ complain_overflow_unsigned),
+ len, 0, (8 * wordsz),
+ relocation) == bfd_reloc_overflow)
+ (*_bfd_error_handler)
+ ("%s (%s + 0x%lx): relocation overflow: 0x%lx %sdoes not fit "
+ "within 0x%lx",
+ input_bfd->filename, input_section->name, rel->r_offset,
+ relocation, (signed_p ? "(signed) " : ""), mask);
+ }
+
+ /* Do the deed. */
+ x = (x & ~(mask << shift)) | ((relocation & mask) << shift);
+
+#ifdef DEBUG
+ printf (" relocation: %8.8lx\n"
+ " shifted mask: %8.8lx\n"
+ " shifted/masked reloc: %8.8lx\n"
+ " result: %8.8lx\n",
+ relocation, (mask << shift),
+ ((relocation & mask) << shift), x);
+#endif
+ put_value (wordsz, chunksz, input_bfd, x, contents + rel->r_offset);
+}
+
/* 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
@@ -5549,7 +7301,9 @@ elf_link_sort_cmp2 (const void *A, const void *B)
static size_t
elf_link_sort_relocs (bfd *abfd, struct bfd_link_info *info, asection **psec)
{
- asection *reldyn;
+ asection *dynamic_relocs;
+ asection *rela_dyn;
+ asection *rel_dyn;
bfd_size_type count, size;
size_t i, ret, sort_elt, ext_size;
bfd_byte *sort, *s_non_relative, *p;
@@ -5560,39 +7314,170 @@ elf_link_sort_relocs (bfd *abfd, struct bfd_link_info *info, asection **psec)
void (*swap_out) (bfd *, const Elf_Internal_Rela *, bfd_byte *);
struct bfd_link_order *lo;
bfd_vma r_sym_mask;
+ bfd_boolean use_rela;
- reldyn = bfd_get_section_by_name (abfd, ".rela.dyn");
- if (reldyn == NULL || reldyn->_raw_size == 0)
+ /* Find a dynamic reloc section. */
+ rela_dyn = bfd_get_section_by_name (abfd, ".rela.dyn");
+ rel_dyn = bfd_get_section_by_name (abfd, ".rel.dyn");
+ if (rela_dyn != NULL && rela_dyn->size > 0
+ && rel_dyn != NULL && rel_dyn->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;
+ bfd_boolean use_rela_initialised = FALSE;
+
+ /* This is just here to stop gcc from complaining.
+ It's initialization checking code is not perfect. */
+ use_rela = TRUE;
+
+ /* Both sections are present. Examine the sizes
+ of the indirect sections to help us choose. */
+ for (lo = rela_dyn->map_head.link_order; lo != NULL; lo = lo->next)
+ if (lo->type == bfd_indirect_link_order)
+ {
+ asection *o = lo->u.indirect.section;
+
+ if ((o->size % bed->s->sizeof_rela) == 0)
+ {
+ if ((o->size % bed->s->sizeof_rel) == 0)
+ /* Section size is divisible by both rel and rela sizes.
+ It is of no help to us. */
+ ;
+ else
+ {
+ /* Section size is only divisible by rela. */
+ if (use_rela_initialised && (use_rela == FALSE))
+ {
+ _bfd_error_handler
+ (_("%B: Unable to sort relocs - they are in more than one size"), abfd);
+ bfd_set_error (bfd_error_invalid_operation);
+ return 0;
+ }
+ else
+ {
+ use_rela = TRUE;
+ use_rela_initialised = TRUE;
+ }
+ }
+ }
+ else if ((o->size % bed->s->sizeof_rel) == 0)
+ {
+ /* Section size is only divisible by rel. */
+ if (use_rela_initialised && (use_rela == TRUE))
+ {
+ _bfd_error_handler
+ (_("%B: Unable to sort relocs - they are in more than one size"), abfd);
+ bfd_set_error (bfd_error_invalid_operation);
+ return 0;
+ }
+ else
+ {
+ use_rela = FALSE;
+ use_rela_initialised = TRUE;
+ }
+ }
+ else
+ {
+ /* The section size is not divisible by either - something is wrong. */
+ _bfd_error_handler
+ (_("%B: Unable to sort relocs - they are of an unknown size"), abfd);
+ bfd_set_error (bfd_error_invalid_operation);
+ return 0;
+ }
+ }
+
+ for (lo = rel_dyn->map_head.link_order; lo != NULL; lo = lo->next)
+ if (lo->type == bfd_indirect_link_order)
+ {
+ asection *o = lo->u.indirect.section;
+
+ if ((o->size % bed->s->sizeof_rela) == 0)
+ {
+ if ((o->size % bed->s->sizeof_rel) == 0)
+ /* Section size is divisible by both rel and rela sizes.
+ It is of no help to us. */
+ ;
+ else
+ {
+ /* Section size is only divisible by rela. */
+ if (use_rela_initialised && (use_rela == FALSE))
+ {
+ _bfd_error_handler
+ (_("%B: Unable to sort relocs - they are in more than one size"), abfd);
+ bfd_set_error (bfd_error_invalid_operation);
+ return 0;
+ }
+ else
+ {
+ use_rela = TRUE;
+ use_rela_initialised = TRUE;
+ }
+ }
+ }
+ else if ((o->size % bed->s->sizeof_rel) == 0)
+ {
+ /* Section size is only divisible by rel. */
+ if (use_rela_initialised && (use_rela == TRUE))
+ {
+ _bfd_error_handler
+ (_("%B: Unable to sort relocs - they are in more than one size"), abfd);
+ bfd_set_error (bfd_error_invalid_operation);
+ return 0;
+ }
+ else
+ {
+ use_rela = FALSE;
+ use_rela_initialised = TRUE;
+ }
+ }
+ else
+ {
+ /* The section size is not divisible by either - something is wrong. */
+ _bfd_error_handler
+ (_("%B: Unable to sort relocs - they are of an unknown size"), abfd);
+ bfd_set_error (bfd_error_invalid_operation);
+ return 0;
+ }
+ }
+
+ if (! use_rela_initialised)
+ /* Make a guess. */
+ use_rela = TRUE;
}
+ else if (rela_dyn != NULL && rela_dyn->size > 0)
+ use_rela = TRUE;
+ else if (rel_dyn != NULL && rel_dyn->size > 0)
+ use_rela = FALSE;
else
+ return 0;
+
+ if (use_rela)
{
+ dynamic_relocs = rela_dyn;
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;
+ else
+ {
+ dynamic_relocs = rel_dyn;
+ ext_size = bed->s->sizeof_rel;
+ swap_in = bed->s->swap_reloc_in;
+ swap_out = bed->s->swap_reloc_out;
+ }
size = 0;
- for (lo = reldyn->link_order_head; lo != NULL; lo = lo->next)
+ for (lo = dynamic_relocs->map_head.link_order; lo != NULL; lo = lo->next)
if (lo->type == bfd_indirect_link_order)
- {
- asection *o = lo->u.indirect.section;
- size += o->_raw_size;
- }
+ size += lo->u.indirect.section->size;
- if (size != reldyn->_raw_size)
+ if (size != dynamic_relocs->size)
return 0;
sort_elt = (sizeof (struct elf_link_sort_rela)
+ (i2e - 1) * sizeof (Elf_Internal_Rela));
+
+ count = dynamic_relocs->size / ext_size;
sort = bfd_zmalloc (sort_elt * count);
+
if (sort == NULL)
{
(*info->callbacks->warning)
@@ -5605,18 +7490,28 @@ elf_link_sort_relocs (bfd *abfd, struct bfd_link_info *info, asection **psec)
else
r_sym_mask = ~(bfd_vma) 0xffffffff;
- for (lo = reldyn->link_order_head; lo != NULL; lo = lo->next)
+ for (lo = dynamic_relocs->map_head.link_order; lo != NULL; lo = lo->next)
if (lo->type == bfd_indirect_link_order)
{
bfd_byte *erel, *erelend;
asection *o = lo->u.indirect.section;
+ if (o->contents == NULL && o->size != 0)
+ {
+ /* This is a reloc section that is being handled as a normal
+ section. See bfd_section_from_shdr. We can't combine
+ relocs in this case. */
+ free (sort);
+ return 0;
+ }
erel = o->contents;
- erelend = o->contents + o->_raw_size;
+ erelend = o->contents + o->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;
@@ -5647,14 +7542,14 @@ elf_link_sort_relocs (bfd *abfd, struct bfd_link_info *info, asection **psec)
qsort (s_non_relative, count - ret, sort_elt, elf_link_sort_cmp2);
- for (lo = reldyn->link_order_head; lo != NULL; lo = lo->next)
+ for (lo = dynamic_relocs->map_head.link_order; 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;
+ erelend = o->contents + o->size;
p = sort + o->output_offset / ext_size * sort_elt;
while (erel < erelend)
{
@@ -5666,7 +7561,7 @@ elf_link_sort_relocs (bfd *abfd, struct bfd_link_info *info, asection **psec)
}
free (sort);
- *psec = reldyn;
+ *psec = dynamic_relocs;
return ret;
}
@@ -5763,6 +7658,24 @@ elf_link_output_sym (struct elf_final_link_info *finfo,
return TRUE;
}
+/* Return TRUE if the dynamic symbol SYM in ABFD is supported. */
+
+static bfd_boolean
+check_dynsym (bfd *abfd, Elf_Internal_Sym *sym)
+{
+ if (sym->st_shndx > SHN_HIRESERVE)
+ {
+ /* The gABI doesn't support dynamic symbols in output sections
+ beyond 64k. */
+ (*_bfd_error_handler)
+ (_("%B: Too many sections: %d (>= %d)"),
+ abfd, bfd_count_sections (abfd), SHN_LORESERVE);
+ bfd_set_error (bfd_error_nonrepresentable_section);
+ return FALSE;
+ }
+ 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.
@@ -5790,7 +7703,7 @@ elf_link_check_versioned_symbol (struct bfd_link_info *info,
case bfd_link_hash_undefweak:
abfd = h->root.u.undef.abfd;
if ((abfd->flags & DYNAMIC) == 0
- || elf_dyn_lib_class (abfd) != DYN_DT_NEEDED)
+ || (elf_dyn_lib_class (abfd) & DYN_DT_NEEDED) == 0)
return FALSE;
break;
@@ -5938,33 +7851,43 @@ elf_link_output_extsym (struct elf_link_hash_entry *h, void *data)
/* Decide whether to output this symbol in this pass. */
if (eoinfo->localsyms)
{
- if ((h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0)
+ if (!h->forced_local)
return TRUE;
}
else
{
- if ((h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) != 0)
+ if (h->forced_local)
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 (h->root.type == bfd_link_hash_undefined)
{
- 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)))
+ /* 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). */
+ bfd_boolean ignore_undef = FALSE;
+
+ /* Some symbols may be special in that the fact that they're
+ undefined can be safely ignored - let backend determine that. */
+ if (bed->elf_backend_ignore_undef_symbol)
+ ignore_undef = bed->elf_backend_ignore_undef_symbol (h);
+
+ /* If we are reporting errors for this situation then do so now. */
+ if (ignore_undef == FALSE
+ && h->ref_dynamic
+ && ! h->ref_regular
+ && ! elf_link_check_versioned_symbol (finfo->info, bed, h)
+ && finfo->info->unresolved_syms_in_shared_libs != RM_IGNORE)
{
- eoinfo->failed = TRUE;
- return FALSE;
+ 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;
+ }
}
}
@@ -5972,20 +7895,22 @@ elf_link_output_extsym (struct elf_link_hash_entry *h, void *data)
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)
+ && h->forced_local
+ && h->ref_dynamic
+ && !h->dynamic_def
+ && !h->dynamic_weak
&& ! 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),
+ (_("%B: %s symbol `%s' in %B is referenced by DSO"),
+ finfo->output_bfd,
+ h->root.u.def.section == bfd_abs_section_ptr
+ ? finfo->output_bfd : h->root.u.def.section->owner,
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));
+ ? "hidden" : "local",
+ h->root.root.string);
eoinfo->failed = TRUE;
return FALSE;
}
@@ -5996,10 +7921,11 @@ elf_link_output_extsym (struct elf_link_hash_entry *h, void *data)
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)
+ else if ((h->def_dynamic
+ || h->ref_dynamic
+ || h->root.type == bfd_link_hash_new)
+ && !h->def_regular
+ && !h->ref_regular)
strip = TRUE;
else if (finfo->info->strip == strip_all)
strip = TRUE;
@@ -6019,13 +7945,13 @@ elf_link_output_extsym (struct elf_link_hash_entry *h, void *data)
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)
+ && !h->forced_local)
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)
+ if (h->forced_local)
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)
@@ -6059,10 +7985,8 @@ elf_link_output_extsym (struct elf_link_hash_entry *h, void *data)
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);
+ (_("%B: could not find output section %A for input section %A"),
+ finfo->output_bfd, input_sec->output_section, input_sec);
eoinfo->failed = TRUE;
return FALSE;
}
@@ -6095,7 +8019,7 @@ elf_link_output_extsym (struct elf_link_hash_entry *h, void *data)
case bfd_link_hash_common:
input_sec = h->root.u.c.p->section;
- sym.st_shndx = SHN_COMMON;
+ sym.st_shndx = bed->common_section_index (input_sec);
sym.st_value = 1 << h->root.u.c.p->alignment_power;
break;
@@ -6114,11 +8038,11 @@ elf_link_output_extsym (struct elf_link_hash_entry *h, void *data)
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)
+ || h->forced_local)
&& ((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)
+ || !h->forced_local)
&& elf_hash_table (finfo->info)->dynamic_sections_created)
{
if (! ((*bed->elf_backend_finish_dynamic_symbol)
@@ -6136,13 +8060,13 @@ elf_link_output_extsym (struct elf_link_hash_entry *h, void *data)
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
+ && h->ref_regular
&& (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)
+ if (h->ref_regular_nonweak)
bindtype = STB_GLOBAL;
else
bindtype = STB_WEAK;
@@ -6155,16 +8079,16 @@ elf_link_output_extsym (struct elf_link_hash_entry *h, void *data)
&& 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)
+ && !h->def_regular)
{
(*_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);
+ (_("%B: %s symbol `%s' isn't defined"),
+ 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;
}
@@ -6175,35 +8099,45 @@ elf_link_output_extsym (struct elf_link_hash_entry *h, void *data)
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;
+ if (! check_dynsym (finfo->output_bfd, &sym))
+ {
+ eoinfo->failed = TRUE;
+ return FALSE;
+ }
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->hash_sec != NULL)
+ {
+ size_t hash_entry_size;
+ bfd_byte *bucketpos;
+ bfd_vma chain;
+ size_t bucketcount;
+ size_t bucket;
+
+ bucketcount = elf_hash_table (finfo->info)->bucketcount;
+ bucket = h->u.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->def_regular)
{
if (h->verinfo.verdef == NULL)
iversym.vs_vers = 0;
@@ -6216,9 +8150,11 @@ elf_link_output_extsym (struct elf_link_hash_entry *h, void *data)
iversym.vs_vers = 1;
else
iversym.vs_vers = h->verinfo.vertree->vernum + 1;
+ if (finfo->info->create_default_symver)
+ iversym.vs_vers++;
}
- if ((h->elf_link_hash_flags & ELF_LINK_HIDDEN) != 0)
+ if (h->hidden)
iversym.vs_vers |= VERSYM_HIDDEN;
eversym = (Elf_External_Versym *) finfo->symver_sec->contents;
@@ -6243,6 +8179,9 @@ elf_link_output_extsym (struct elf_link_hash_entry *h, void *data)
return TRUE;
}
+/* Return TRUE if special handling is done for relocs in SEC against
+ symbols defined in discarded sections. */
+
static bfd_boolean
elf_section_ignore_discarded_relocs (asection *sec)
{
@@ -6265,6 +8204,73 @@ elf_section_ignore_discarded_relocs (asection *sec)
return FALSE;
}
+/* Return a mask saying how ld should treat relocations in SEC against
+ symbols defined in discarded sections. If this function returns
+ COMPLAIN set, ld will issue a warning message. If this function
+ returns PRETEND set, and the discarded section was link-once and the
+ same size as the kept link-once section, ld will pretend that the
+ symbol was actually defined in the kept section. Otherwise ld will
+ zero the reloc (at least that is the intent, but some cooperation by
+ the target dependent code is needed, particularly for REL targets). */
+
+unsigned int
+_bfd_elf_default_action_discarded (asection *sec)
+{
+ if (sec->flags & SEC_DEBUGGING)
+ return PRETEND;
+
+ if (strcmp (".eh_frame", sec->name) == 0)
+ return 0;
+
+ if (strcmp (".gcc_except_table", sec->name) == 0)
+ return 0;
+
+ return COMPLAIN | PRETEND;
+}
+
+/* Find a match between a section and a member of a section group. */
+
+static asection *
+match_group_member (asection *sec, asection *group,
+ struct bfd_link_info *info)
+{
+ asection *first = elf_next_in_group (group);
+ asection *s = first;
+
+ while (s != NULL)
+ {
+ if (bfd_elf_match_symbols_in_sections (s, sec, info))
+ return s;
+
+ s = elf_next_in_group (s);
+ if (s == first)
+ break;
+ }
+
+ return NULL;
+}
+
+/* Check if the kept section of a discarded section SEC can be used
+ to replace it. Return the replacement if it is OK. Otherwise return
+ NULL. */
+
+asection *
+_bfd_elf_check_kept_section (asection *sec, struct bfd_link_info *info)
+{
+ asection *kept;
+
+ kept = sec->kept_section;
+ if (kept != NULL)
+ {
+ if ((kept->flags & SEC_GROUP) != 0)
+ kept = match_group_member (sec, kept, info);
+ if (kept != NULL && sec->size != kept->size)
+ kept = NULL;
+ sec->kept_section = kept;
+ }
+ return kept;
+}
+
/* 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
@@ -6273,7 +8279,7 @@ elf_section_ignore_discarded_relocs (asection *sec)
static bfd_boolean
elf_link_input_bfd (struct elf_final_link_info *finfo, bfd *input_bfd)
{
- bfd_boolean (*relocate_section)
+ int (*relocate_section)
(bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *,
Elf_Internal_Rela *, Elf_Internal_Sym *, asection **);
bfd *output_bfd;
@@ -6287,7 +8293,6 @@ elf_link_input_bfd (struct elf_final_link_info *finfo, bfd *input_bfd)
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;
@@ -6300,10 +8305,6 @@ elf_link_input_bfd (struct elf_final_link_info *finfo, bfd *input_bfd)
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))
{
@@ -6327,6 +8328,15 @@ elf_link_input_bfd (struct elf_final_link_info *finfo, bfd *input_bfd)
if (isymbuf == NULL)
return FALSE;
}
+ /* evaluate_complex_relocation_symbols looks for symbols in
+ finfo->internal_syms. */
+ else if (isymbuf != NULL && locsymcount != 0)
+ {
+ bfd_elf_get_elf_syms (input_bfd, symtab_hdr, locsymcount, 0,
+ finfo->internal_syms,
+ finfo->external_syms,
+ finfo->locsym_shndx);
+ }
/* Find local symbol sections and adjust values of symbols in
SEC_MERGE sections. Write out those local symbols we know are
@@ -6363,7 +8373,7 @@ elf_link_input_bfd (struct elf_final_link_info *finfo, bfd *input_bfd)
isym->st_value =
_bfd_merged_section_offset (output_bfd, &isec,
elf_section_data (isec)->sec_info,
- isym->st_value, 0);
+ isym->st_value);
}
else if (isym->st_shndx == SHN_ABS)
isec = bfd_abs_section_ptr;
@@ -6371,8 +8381,10 @@ elf_link_input_bfd (struct elf_final_link_info *finfo, bfd *input_bfd)
isec = bfd_com_section_ptr;
else
{
- /* Who knows? */
- isec = NULL;
+ /* Don't attempt to output symbols with st_shnx in the
+ reserved range other than SHN_ABS and SHN_COMMON. */
+ *ppsection = NULL;
+ continue;
}
*ppsection = isec;
@@ -6403,15 +8415,12 @@ elf_link_input_bfd (struct elf_final_link_info *finfo, bfd *input_bfd)
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)))
+ discarding, we don't need to keep it. */
+ if (isym->st_shndx != SHN_UNDEF
+ && (isym->st_shndx < SHN_LORESERVE || isym->st_shndx > SHN_HIRESERVE)
+ && (isec == NULL
+ || bfd_section_removed_from_list (output_bfd,
+ isec->output_section)))
continue;
/* Get the name of the symbol. */
@@ -6465,6 +8474,9 @@ elf_link_input_bfd (struct elf_final_link_info *finfo, bfd *input_bfd)
return FALSE;
}
+ if (! evaluate_complex_relocation_symbols (input_bfd, finfo, locsymcount))
+ 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)
@@ -6478,7 +8490,7 @@ elf_link_input_bfd (struct elf_final_link_info *finfo, bfd *input_bfd)
}
if ((o->flags & SEC_HAS_CONTENTS) == 0
- || (o->_raw_size == 0 && (o->flags & SEC_RELOC) == 0))
+ || (o->size == 0 && (o->flags & SEC_RELOC) == 0))
continue;
if ((o->flags & SEC_LINKER_CREATED) != 0)
@@ -6496,9 +8508,10 @@ elf_link_input_bfd (struct elf_final_link_info *finfo, bfd *input_bfd)
contents = elf_section_data (o)->this_hdr.contents;
else
{
+ bfd_size_type amt = o->rawsize ? o->rawsize : o->size;
+
contents = finfo->contents;
- if (! bfd_get_section_contents (input_bfd, o, contents, 0,
- o->_raw_size))
+ if (! bfd_get_section_contents (input_bfd, o, contents, 0, amt))
return FALSE;
}
@@ -6507,6 +8520,7 @@ elf_link_input_bfd (struct elf_final_link_info *finfo, bfd *input_bfd)
Elf_Internal_Rela *internal_relocs;
bfd_vma r_type_mask;
int r_sym_shift;
+ int ret;
/* Get the swapped relocs. */
internal_relocs
@@ -6531,98 +8545,93 @@ elf_link_input_bfd (struct elf_final_link_info *finfo, bfd *input_bfd)
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. */
+ link-once sections. */
if (!elf_section_ignore_discarded_relocs (o))
{
Elf_Internal_Rela *rel, *relend;
+ unsigned int action = (*bed->action_discarded) (o);
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;
+ asection **ps, *sec;
+ struct elf_link_hash_entry *h = NULL;
+ const char *sym_name;
+
+ 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 *h;
-
h = sym_hashes[r_symndx - extsymoff];
+
+ /* Badly formatted input files can contain relocs that
+ reference non-existant symbols. Check here so that
+ we do not seg fault. */
+ if (h == NULL)
+ {
+ char buffer [32];
+
+ sprintf_vma (buffer, rel->r_info);
+ (*_bfd_error_handler)
+ (_("error: %B contains a reloc (0x%s) for section %A "
+ "that references a non-existent global symbol"),
+ input_bfd, o, buffer);
+ bfd_set_error (bfd_error_bad_value);
+ 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;
- /* 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));
- }
+ if (h->root.type != bfd_link_hash_defined
+ && h->root.type != bfd_link_hash_defweak)
+ continue;
+
+ ps = &h->root.u.def.section;
+ sym_name = h->root.root.string;
}
else
{
- sec = finfo->sections[r_symndx];
+ Elf_Internal_Sym *sym = isymbuf + r_symndx;
+ ps = &finfo->sections[r_symndx];
+ sym_name = bfd_elf_sym_name (input_bfd,
+ symtab_hdr,
+ sym, *ps);
+ }
- if (sec != NULL && elf_discarded_section (sec))
+ /* Complain if the definition comes from a
+ discarded section. */
+ if ((sec = *ps) != NULL && elf_discarded_section (sec))
+ {
+ BFD_ASSERT (r_symndx != 0);
+ if (action & COMPLAIN)
+ (*finfo->info->callbacks->einfo)
+ (_("%X`%s' referenced in section `%A' of %B: "
+ "defined in discarded section `%A' of %B\n"),
+ sym_name, o, input_bfd, sec, sec->owner);
+
+ /* Try to do the best we can to support buggy old
+ versions of gcc. Pretend that the symbol is
+ really defined in the kept linkonce section.
+ FIXME: This is quite broken. Modifying the
+ symbol here means we will be changing all later
+ uses of the symbol, not just in this section. */
+ if (action & PRETEND)
{
- 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
+ asection *kept;
+
+ kept = _bfd_elf_check_kept_section (sec,
+ finfo->info);
+ if (kept != NULL)
{
- 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);
+ *ps = kept;
+ continue;
}
}
}
@@ -6649,23 +8658,25 @@ elf_link_input_bfd (struct elf_final_link_info *finfo, bfd *input_bfd)
corresponding to the output section, which will require
the addend to be adjusted. */
- if (! (*relocate_section) (output_bfd, finfo->info,
+ ret = (*relocate_section) (output_bfd, finfo->info,
input_bfd, o, contents,
internal_relocs,
isymbuf,
- finfo->sections))
+ finfo->sections);
+ if (!ret)
return FALSE;
- if (emit_relocs)
+ if (ret == 2
+ || finfo->info->relocatable
+ || finfo->info->emitrelocations)
{
Elf_Internal_Rela *irela;
Elf_Internal_Rela *irelaend;
bfd_vma last_offset;
struct elf_link_hash_entry **rel_hash;
+ struct elf_link_hash_entry **rel_hash_list;
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;
@@ -6680,6 +8691,7 @@ elf_link_input_bfd (struct elf_final_link_info *finfo, bfd *input_bfd)
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);
+ rel_hash_list = rel_hash;
last_offset = o->output_offset;
if (!finfo->info->relocatable)
last_offset += o->output_section->vma;
@@ -6703,7 +8715,7 @@ elf_link_input_bfd (struct elf_final_link_info *finfo, bfd *input_bfd)
/* 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
+ bfd_elf_discard_info rely on reloc offsets
being ordered. */
irela->r_offset = last_offset;
irela->r_info = 0;
@@ -6736,7 +8748,7 @@ elf_link_input_bfd (struct elf_final_link_info *finfo, bfd *input_bfd)
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. */
+ set at the end of bfd_elf_final_link. */
indx = r_symndx - extsymoff;
rh = elf_sym_hashes (input_bfd)[indx];
while (rh->root.type == bfd_link_hash_indirect
@@ -6763,13 +8775,10 @@ elf_link_input_bfd (struct elf_final_link_info *finfo, bfd *input_bfd)
{
/* 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;
+ processor specific section. */
+ r_symndx = 0;
+ if (bfd_is_abs_section (sec))
+ ;
else if (sec == NULL || sec->owner == NULL)
{
bfd_set_error (bfd_error_bad_value);
@@ -6777,8 +8786,45 @@ elf_link_input_bfd (struct elf_final_link_info *finfo, bfd *input_bfd)
}
else
{
- r_symndx = sec->output_section->target_index;
- BFD_ASSERT (r_symndx != 0);
+ asection *osec = sec->output_section;
+
+ /* If we have discarded a section, the output
+ section will be the absolute section. In
+ case of discarded SEC_MERGE sections, use
+ the kept section. relocate_section should
+ have already handled discarded linkonce
+ sections. */
+ if (bfd_is_abs_section (osec)
+ && sec->kept_section != NULL
+ && sec->kept_section->output_section != NULL)
+ {
+ osec = sec->kept_section->output_section;
+ irela->r_addend -= osec->vma;
+ }
+
+ if (!bfd_is_abs_section (osec))
+ {
+ r_symndx = osec->target_index;
+ if (r_symndx == 0)
+ {
+ struct elf_link_hash_table *htab;
+ asection *oi;
+
+ htab = elf_hash_table (finfo->info);
+ oi = htab->text_index_section;
+ if ((osec->flags & SEC_READONLY) == 0
+ && htab->data_index_section != NULL)
+ oi = htab->data_index_section;
+
+ if (oi != NULL)
+ {
+ irela->r_addend += osec->vma - oi->vma;
+ r_symndx = oi->target_index;
+ }
+ }
+
+ BFD_ASSERT (r_symndx != 0);
+ }
}
/* Adjust the addend according to where the
@@ -6848,16 +8894,11 @@ elf_link_input_bfd (struct elf_final_link_info *finfo, bfd *input_bfd)
}
/* 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))
+ && !bed->elf_backend_emit_relocs (output_bfd, o,
+ input_rel_hdr,
+ internal_relocs,
+ rel_hash_list))
return FALSE;
input_rel_hdr2 = elf_section_data (o)->rel_hdr2;
@@ -6865,8 +8906,11 @@ elf_link_input_bfd (struct elf_final_link_info *finfo, bfd *input_bfd)
{
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))
+ rel_hash_list += NUM_SHDR_ENTRIES (input_rel_hdr);
+ if (!bed->elf_backend_emit_relocs (output_bfd, o,
+ input_rel_hdr2,
+ internal_relocs,
+ rel_hash_list))
return FALSE;
}
}
@@ -6874,7 +8918,8 @@ elf_link_input_bfd (struct elf_final_link_info *finfo, bfd *input_bfd)
/* Write out the modified section contents. */
if (bed->elf_backend_write_section
- && (*bed->elf_backend_write_section) (output_bfd, o, contents))
+ && (*bed->elf_backend_write_section) (output_bfd, finfo->info, o,
+ contents))
{
/* Section written out. */
}
@@ -6901,14 +8946,11 @@ elf_link_input_bfd (struct elf_final_link_info *finfo, bfd *input_bfd)
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))
+ o->size))
return FALSE;
}
break;
@@ -6919,7 +8961,7 @@ elf_link_input_bfd (struct elf_final_link_info *finfo, bfd *input_bfd)
}
/* Generate a reloc when linking an ELF file. This is a reloc
- requested by the linker, and does come from any input file. This
+ requested by the linker, and does not come from any input file. This
is used to build constructor and destructor tables when linking
with -Ur. */
@@ -7031,7 +9073,8 @@ elf_reloc_link_order (bfd *output_bfd,
else
sym_name = link_order->u.reloc.p->u.name;
if (! ((*info->callbacks->reloc_overflow)
- (info, sym_name, howto->name, addend, NULL, NULL, 0)))
+ (info, NULL, sym_name, howto->name, addend, NULL,
+ NULL, (bfd_vma) 0)))
{
free (buf);
return FALSE;
@@ -7084,6 +9127,151 @@ elf_reloc_link_order (bfd *output_bfd,
return TRUE;
}
+
+/* Get the output vma of the section pointed to by the sh_link field. */
+
+static bfd_vma
+elf_get_linked_section_vma (struct bfd_link_order *p)
+{
+ Elf_Internal_Shdr **elf_shdrp;
+ asection *s;
+ int elfsec;
+
+ s = p->u.indirect.section;
+ elf_shdrp = elf_elfsections (s->owner);
+ elfsec = _bfd_elf_section_from_bfd_section (s->owner, s);
+ elfsec = elf_shdrp[elfsec]->sh_link;
+ /* PR 290:
+ The Intel C compiler generates SHT_IA_64_UNWIND with
+ SHF_LINK_ORDER. But it doesn't set the sh_link or
+ sh_info fields. Hence we could get the situation
+ where elfsec is 0. */
+ if (elfsec == 0)
+ {
+ const struct elf_backend_data *bed
+ = get_elf_backend_data (s->owner);
+ if (bed->link_order_error_handler)
+ bed->link_order_error_handler
+ (_("%B: warning: sh_link not set for section `%A'"), s->owner, s);
+ return 0;
+ }
+ else
+ {
+ s = elf_shdrp[elfsec]->bfd_section;
+ return s->output_section->vma + s->output_offset;
+ }
+}
+
+
+/* Compare two sections based on the locations of the sections they are
+ linked to. Used by elf_fixup_link_order. */
+
+static int
+compare_link_order (const void * a, const void * b)
+{
+ bfd_vma apos;
+ bfd_vma bpos;
+
+ apos = elf_get_linked_section_vma (*(struct bfd_link_order **)a);
+ bpos = elf_get_linked_section_vma (*(struct bfd_link_order **)b);
+ if (apos < bpos)
+ return -1;
+ return apos > bpos;
+}
+
+
+/* Looks for sections with SHF_LINK_ORDER set. Rearranges them into the same
+ order as their linked sections. Returns false if this could not be done
+ because an output section includes both ordered and unordered
+ sections. Ideally we'd do this in the linker proper. */
+
+static bfd_boolean
+elf_fixup_link_order (bfd *abfd, asection *o)
+{
+ int seen_linkorder;
+ int seen_other;
+ int n;
+ struct bfd_link_order *p;
+ bfd *sub;
+ const struct elf_backend_data *bed = get_elf_backend_data (abfd);
+ unsigned elfsec;
+ struct bfd_link_order **sections;
+ asection *s, *other_sec, *linkorder_sec;
+ bfd_vma offset;
+
+ other_sec = NULL;
+ linkorder_sec = NULL;
+ seen_other = 0;
+ seen_linkorder = 0;
+ for (p = o->map_head.link_order; p != NULL; p = p->next)
+ {
+ if (p->type == bfd_indirect_link_order)
+ {
+ s = p->u.indirect.section;
+ sub = s->owner;
+ if (bfd_get_flavour (sub) == bfd_target_elf_flavour
+ && elf_elfheader (sub)->e_ident[EI_CLASS] == bed->s->elfclass
+ && (elfsec = _bfd_elf_section_from_bfd_section (sub, s))
+ && elfsec < elf_numsections (sub)
+ && elf_elfsections (sub)[elfsec]->sh_flags & SHF_LINK_ORDER)
+ {
+ seen_linkorder++;
+ linkorder_sec = s;
+ }
+ else
+ {
+ seen_other++;
+ other_sec = s;
+ }
+ }
+ else
+ seen_other++;
+
+ if (seen_other && seen_linkorder)
+ {
+ if (other_sec && linkorder_sec)
+ (*_bfd_error_handler) (_("%A has both ordered [`%A' in %B] and unordered [`%A' in %B] sections"),
+ o, linkorder_sec,
+ linkorder_sec->owner, other_sec,
+ other_sec->owner);
+ else
+ (*_bfd_error_handler) (_("%A has both ordered and unordered sections"),
+ o);
+ bfd_set_error (bfd_error_bad_value);
+ return FALSE;
+ }
+ }
+
+ if (!seen_linkorder)
+ return TRUE;
+
+ sections = (struct bfd_link_order **)
+ xmalloc (seen_linkorder * sizeof (struct bfd_link_order *));
+ seen_linkorder = 0;
+
+ for (p = o->map_head.link_order; p != NULL; p = p->next)
+ {
+ sections[seen_linkorder++] = p;
+ }
+ /* Sort the input sections in the order of their linked section. */
+ qsort (sections, seen_linkorder, sizeof (struct bfd_link_order *),
+ compare_link_order);
+
+ /* Change the offsets of the sections. */
+ offset = 0;
+ for (n = 0; n < seen_linkorder; n++)
+ {
+ s = sections[n]->u.indirect.section;
+ offset &= ~(bfd_vma)((1 << s->alignment_power) - 1);
+ s->output_offset = offset;
+ sections[n]->offset = offset;
+ offset += sections[n]->size;
+ }
+
+ return TRUE;
+}
+
+
/* Do the final step of an ELF link. */
bfd_boolean
@@ -7113,6 +9301,9 @@ bfd_elf_final_link (bfd *abfd, struct bfd_link_info *info)
size_t relativecount = 0;
asection *reldyn = 0;
bfd_size_type amt;
+ asection *attr_section = NULL;
+ bfd_vma attr_size = 0;
+ const char *std_attrs_section;
if (! is_elf_hash_table (info->hash))
return FALSE;
@@ -7124,8 +9315,7 @@ bfd_elf_final_link (bfd *abfd, struct bfd_link_info *info)
dynobj = elf_hash_table (info)->dynobj;
emit_relocs = (info->relocatable
- || info->emitrelocations
- || bed->elf_backend_emit_relocs);
+ || info->emitrelocations);
finfo.info = info;
finfo.output_bfd = abfd;
@@ -7143,7 +9333,7 @@ bfd_elf_final_link (bfd *abfd, struct bfd_link_info *info)
{
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);
+ BFD_ASSERT (finfo.dynsym_sec != NULL);
finfo.symver_sec = bfd_get_section_by_name (dynobj, ".gnu.version");
/* Note that it is OK if symver_sec is NULL. */
}
@@ -7161,6 +9351,40 @@ bfd_elf_final_link (bfd *abfd, struct bfd_link_info *info)
finfo.symbuf_count = 0;
finfo.shndxbuf_size = 0;
+ /* The object attributes have been merged. Remove the input
+ sections from the link, and set the contents of the output
+ secton. */
+ std_attrs_section = get_elf_backend_data (abfd)->obj_attrs_section;
+ for (o = abfd->sections; o != NULL; o = o->next)
+ {
+ if ((std_attrs_section && strcmp (o->name, std_attrs_section) == 0)
+ || strcmp (o->name, ".gnu.attributes") == 0)
+ {
+ for (p = o->map_head.link_order; p != NULL; p = p->next)
+ {
+ asection *input_section;
+
+ if (p->type != bfd_indirect_link_order)
+ continue;
+ 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;
+ }
+
+ attr_size = bfd_elf_obj_attr_size (abfd);
+ if (attr_size)
+ {
+ bfd_set_section_size (abfd, o, attr_size);
+ attr_section = o;
+ /* Skip this section later on. */
+ o->map_head.link_order = NULL;
+ }
+ else
+ o->flags |= SEC_EXCLUDE;
+ }
+ }
+
/* 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. */
@@ -7175,7 +9399,7 @@ bfd_elf_final_link (bfd *abfd, struct bfd_link_info *info)
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)
+ for (p = o->map_head.link_order; p != NULL; p = p->next)
{
unsigned int reloc_count = 0;
struct bfd_elf_section_data *esdi = NULL;
@@ -7206,19 +9430,24 @@ bfd_elf_final_link (bfd *abfd, struct bfd_link_info *info)
{
Elf_Internal_Rela * relocs;
- relocs = _bfd_elf_link_read_relocs (abfd, sec, NULL, NULL,
+ relocs = _bfd_elf_link_read_relocs (sec->owner, sec,
+ NULL, NULL,
info->keep_memory);
- reloc_count = (*bed->elf_backend_count_relocs) (sec, relocs);
+ if (relocs != NULL)
+ {
+ reloc_count
+ = (*bed->elf_backend_count_relocs) (sec, relocs);
- if (elf_section_data (o)->relocs != relocs)
- free (relocs);
+ if (elf_section_data (sec)->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;
+ if (sec->rawsize > max_contents_size)
+ max_contents_size = sec->rawsize;
+ if (sec->size > max_contents_size)
+ max_contents_size = sec->size;
/* We are interested in just local symbols, not all
symbols. */
@@ -7334,8 +9563,7 @@ bfd_elf_final_link (bfd *abfd, struct bfd_link_info *info)
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. */
+ /* Set sizes, and assign file positions for reloc sections. */
for (o = abfd->sections; o != NULL; o = o->next)
{
if ((o->flags & SEC_RELOC) != 0)
@@ -7417,22 +9645,6 @@ bfd_elf_final_link (bfd *abfd, struct bfd_link_info *info)
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
@@ -7444,18 +9656,19 @@ bfd_elf_final_link (bfd *abfd, struct bfd_link_info *info)
elfsym.st_size = 0;
elfsym.st_info = ELF_ST_INFO (STB_LOCAL, STT_SECTION);
elfsym.st_other = 0;
+ elfsym.st_value = 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;
+ {
+ o->target_index = bfd_get_symcount (abfd);
+ elfsym.st_shndx = i;
+ if (!info->relocatable)
+ 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;
}
@@ -7526,15 +9739,14 @@ bfd_elf_final_link (bfd *abfd, struct bfd_link_info *info)
sec && (sec->flags & SEC_THREAD_LOCAL);
sec = sec->next)
{
- bfd_vma size = sec->_raw_size;
+ bfd_size_type size = sec->size;
- if (size == 0 && (sec->flags & SEC_HAS_CONTENTS) == 0)
+ 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;
+ struct bfd_link_order *o = sec->map_tail.link_order;
+ if (o != NULL)
+ size = o->offset + o->size;
}
end = sec->vma + size;
}
@@ -7543,6 +9755,13 @@ bfd_elf_final_link (bfd *abfd, struct bfd_link_info *info)
elf_hash_table (info)->tls_size = end - base;
}
+ /* Reorder SHF_LINK_ORDER sections. */
+ for (o = abfd->sections; o != NULL; o = o->next)
+ {
+ if (!elf_fixup_link_order (abfd, o))
+ return FALSE;
+ }
+
/* 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
@@ -7567,7 +9786,7 @@ bfd_elf_final_link (bfd *abfd, struct bfd_link_info *info)
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)
+ for (p = o->map_head.link_order; p != NULL; p = p->next)
{
if (p->type == bfd_indirect_link_order
&& (bfd_get_flavour ((sub = p->u.indirect.section->owner))
@@ -7595,6 +9814,18 @@ bfd_elf_final_link (bfd *abfd, struct bfd_link_info *info)
}
}
+ /* Free symbol buffer if needed. */
+ if (!info->reduce_memory_overheads)
+ {
+ for (sub = info->input_bfds; sub != NULL; sub = sub->link_next)
+ if (bfd_get_flavour (sub) == bfd_target_elf_flavour
+ && elf_tdata (sub)->symbuf)
+ {
+ free (elf_tdata (sub)->symbuf);
+ elf_tdata (sub)->symbuf = NULL;
+ }
+ }
+
/* 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
@@ -7609,6 +9840,19 @@ bfd_elf_final_link (bfd *abfd, struct bfd_link_info *info)
if (eoinfo.failed)
return FALSE;
+ /* If backend needs to output some local symbols not present in the hash
+ table, do it now. */
+ if (bed->elf_backend_output_arch_local_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_local_syms)
+ (abfd, info, &finfo, (out_sym_func) elf_link_output_sym)))
+ 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
@@ -7625,7 +9869,7 @@ bfd_elf_final_link (bfd *abfd, struct bfd_link_info *info)
long last_local = 0;
/* Write out the section symbols for the output sections. */
- if (info->shared)
+ if (info->shared || elf_hash_table (info)->is_relocatable_executable)
{
asection *s;
@@ -7640,16 +9884,20 @@ bfd_elf_final_link (bfd *abfd, struct bfd_link_info *info)
bfd_byte *dest;
long dynindx;
- indx = elf_section_data (s)->this_idx;
dynindx = elf_section_data (s)->dynindx;
+ if (dynindx <= 0)
+ continue;
+ indx = elf_section_data (s)->this_idx;
BFD_ASSERT (indx > 0);
sym.st_shndx = indx;
+ if (! check_dynsym (abfd, &sym))
+ return FALSE;
sym.st_value = s->vma;
dest = dynsym + dynindx * bed->s->sizeof_sym;
+ if (last_local < dynindx)
+ last_local = dynindx;
bed->s->swap_symbol_out (abfd, &sym, dest, 0);
}
-
- last_local = bfd_count_sections (abfd);
}
/* Write out the local dynsyms. */
@@ -7678,6 +9926,8 @@ bfd_elf_final_link (bfd *abfd, struct bfd_link_info *info)
sym.st_shndx =
elf_section_data (s->output_section)->this_idx;
+ if (! check_dynsym (abfd, &sym))
+ return FALSE;
sym.st_value = (s->output_section->vma
+ s->output_offset
+ e->isym.st_value);
@@ -7800,7 +10050,7 @@ bfd_elf_final_link (bfd *abfd, struct bfd_link_info *info)
BFD_ASSERT (o != NULL);
dyncon = o->contents;
- dynconend = o->contents + o->_raw_size;
+ dynconend = o->contents + o->size;
for (; dyncon < dynconend; dyncon += bed->s->sizeof_dyn)
{
Elf_Internal_Dyn dyn;
@@ -7872,14 +10122,13 @@ bfd_elf_final_link (bfd *abfd, struct bfd_link_info *info)
if (o == NULL)
{
(*_bfd_error_handler)
- (_("%s: could not find output section %s"),
- bfd_get_filename (abfd), name);
+ (_("%B: could not find output section %s"), abfd, name);
goto error_return;
}
- if (o->_raw_size == 0)
+ if (o->size == 0)
(*_bfd_error_handler)
(_("warning: %s section has zero size"), name);
- dyn.d_un.d_val = o->_raw_size;
+ dyn.d_un.d_val = o->size;
break;
case DT_PREINIT_ARRAY:
@@ -7895,6 +10144,9 @@ bfd_elf_final_link (bfd *abfd, struct bfd_link_info *info)
case DT_HASH:
name = ".hash";
goto get_vma;
+ case DT_GNU_HASH:
+ name = ".gnu.hash";
+ goto get_vma;
case DT_STRTAB:
name = ".dynstr";
goto get_vma;
@@ -7914,8 +10166,7 @@ bfd_elf_final_link (bfd *abfd, struct bfd_link_info *info)
if (o == NULL)
{
(*_bfd_error_handler)
- (_("%s: could not find output section %s"),
- bfd_get_filename (abfd), name);
+ (_("%B: could not find output section %s"), abfd, name);
goto error_return;
}
dyn.d_un.d_ptr = o->vma;
@@ -7960,10 +10211,36 @@ bfd_elf_final_link (bfd *abfd, struct bfd_link_info *info)
if (! (*bed->elf_backend_finish_dynamic_sections) (abfd, info))
goto error_return;
+ /* Check for DT_TEXTREL (late, in case the backend removes it). */
+ if (info->warn_shared_textrel && info->shared)
+ {
+ 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->size;
+ for (; dyncon < dynconend; dyncon += bed->s->sizeof_dyn)
+ {
+ Elf_Internal_Dyn dyn;
+
+ bed->s->swap_dyn_in (dynobj, dyncon, &dyn);
+
+ if (dyn.d_tag == DT_TEXTREL)
+ {
+ info->callbacks->einfo
+ (_("%P: warning: creating a DT_TEXTREL in a shared object.\n"));
+ break;
+ }
+ }
+ }
+
for (o = dynobj->sections; o != NULL; o = o->next)
{
if ((o->flags & SEC_HAS_CONTENTS) == 0
- || o->_raw_size == 0
+ || o->size == 0
|| o->output_section == bfd_abs_section_ptr)
continue;
if ((o->flags & SEC_LINKER_CREATED) == 0)
@@ -7972,6 +10249,10 @@ bfd_elf_final_link (bfd *abfd, struct bfd_link_info *info)
created by _bfd_elf_link_create_dynamic_sections. */
continue;
}
+ if (elf_hash_table (info)->stab_info.stabstr == o)
+ continue;
+ if (elf_hash_table (info)->eh_info.hdr_sec == o)
+ continue;
if ((elf_section_data (o->output_section)->this_hdr.sh_type
!= SHT_STRTAB)
|| strcmp (bfd_get_section_name (abfd, o), ".dynstr") != 0)
@@ -7979,7 +10260,7 @@ bfd_elf_final_link (bfd *abfd, struct bfd_link_info *info)
if (! bfd_set_section_contents (abfd, o->output_section,
o->contents,
(file_ptr) o->output_offset,
- o->_raw_size))
+ o->size))
goto error_return;
}
else
@@ -8005,7 +10286,7 @@ bfd_elf_final_link (bfd *abfd, struct bfd_link_info *info)
}
/* If we have optimized stabs strings, output them. */
- if (elf_hash_table (info)->stab_info != NULL)
+ if (elf_hash_table (info)->stab_info.stabstr != NULL)
{
if (! _bfd_write_stab_strings (abfd, &elf_hash_table (info)->stab_info))
goto error_return;
@@ -8048,6 +10329,16 @@ bfd_elf_final_link (bfd *abfd, struct bfd_link_info *info)
elf_tdata (abfd)->linker = TRUE;
+ if (attr_section)
+ {
+ bfd_byte *contents = bfd_malloc (attr_size);
+ if (contents == NULL)
+ goto error_return;
+ bfd_elf_set_obj_attr_contents (abfd, contents, attr_size);
+ bfd_set_section_contents (abfd, attr_section, contents, 0, attr_size);
+ free (contents);
+ }
+
return TRUE;
error_return:
@@ -8085,20 +10376,47 @@ bfd_elf_final_link (bfd *abfd, struct bfd_link_info *info)
/* Garbage collect unused sections. */
+/* Default gc_mark_hook. */
+
+asection *
+_bfd_elf_gc_mark_hook (asection *sec,
+ struct bfd_link_info *info ATTRIBUTE_UNUSED,
+ Elf_Internal_Rela *rel ATTRIBUTE_UNUSED,
+ struct elf_link_hash_entry *h,
+ Elf_Internal_Sym *sym)
+{
+ if (h != NULL)
+ {
+ 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;
+}
+
/* 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
+_bfd_elf_gc_mark (struct bfd_link_info *info,
+ asection *sec,
+ elf_gc_mark_hook_fn gc_mark_hook)
{
bfd_boolean ret;
+ bfd_boolean is_eh;
asection *group_sec;
sec->gc_mark = 1;
@@ -8106,11 +10424,12 @@ elf_gc_mark (struct bfd_link_info *info,
/* 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))
+ if (!_bfd_elf_gc_mark (info, group_sec, gc_mark_hook))
return FALSE;
/* Look through the section relocs. */
ret = TRUE;
+ is_eh = strcmp (sec->name, ".eh_frame") == 0;
if ((sec->flags & SEC_RELOC) != 0 && sec->reloc_count > 0)
{
Elf_Internal_Rela *relstart, *rel, *relend;
@@ -8173,6 +10492,9 @@ elf_gc_mark (struct bfd_link_info *info,
|| ELF_ST_BIND (isym[r_symndx].st_info) != STB_LOCAL)
{
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;
rsec = (*gc_mark_hook) (sec, info, rel, h, NULL);
}
else
@@ -8184,7 +10506,9 @@ elf_gc_mark (struct bfd_link_info *info,
{
if (bfd_get_flavour (rsec->owner) != bfd_target_elf_flavour)
rsec->gc_mark = 1;
- else if (!elf_gc_mark (info, rsec, gc_mark_hook))
+ else if (is_eh)
+ rsec->gc_mark_from_eh = 1;
+ else if (!_bfd_elf_gc_mark (info, rsec, gc_mark_hook))
{
ret = FALSE;
goto out2;
@@ -8210,19 +10534,27 @@ elf_gc_mark (struct bfd_link_info *info,
/* 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)
+struct elf_gc_sweep_symbol_info
{
- int *idx = idxptr;
+ struct bfd_link_info *info;
+ void (*hide_symbol) (struct bfd_link_info *, struct elf_link_hash_entry *,
+ bfd_boolean);
+};
+static bfd_boolean
+elf_gc_sweep_symbol (struct elf_link_hash_entry *h, void *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->root.type != bfd_link_hash_defined
- && h->root.type != bfd_link_hash_defweak)
- || h->root.u.def.section->gc_mark))
- h->dynindx = (*idx)++;
+ if ((h->root.type == bfd_link_hash_defined
+ || h->root.type == bfd_link_hash_defweak)
+ && !h->root.u.def.section->gc_mark
+ && !(h->root.u.def.section->owner->flags & DYNAMIC))
+ {
+ struct elf_gc_sweep_symbol_info *inf = data;
+ (*inf->hide_symbol) (inf->info, h, TRUE);
+ }
return TRUE;
}
@@ -8233,9 +10565,13 @@ 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)
+elf_gc_sweep (bfd *abfd, struct bfd_link_info *info)
{
bfd *sub;
+ const struct elf_backend_data *bed = get_elf_backend_data (abfd);
+ gc_sweep_hook_fn gc_sweep_hook = bed->gc_sweep_hook;
+ unsigned long section_sym_count;
+ struct elf_gc_sweep_symbol_info sweep_info;
for (sub = info->input_bfds; sub != NULL; sub = sub->link_next)
{
@@ -8246,9 +10582,9 @@ elf_gc_sweep (struct bfd_link_info *info, gc_sweep_hook_fn gc_sweep_hook)
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))
+ /* Keep debug and special sections. */
+ if ((o->flags & (SEC_DEBUGGING | SEC_LINKER_CREATED)) != 0
+ || (o->flags & (SEC_ALLOC | SEC_LOAD | SEC_RELOC)) == 0)
o->gc_mark = 1;
if (o->gc_mark)
@@ -8262,10 +10598,15 @@ elf_gc_sweep (struct bfd_link_info *info, gc_sweep_hook_fn gc_sweep_hook)
to remove a section from the output. */
o->flags |= SEC_EXCLUDE;
+ if (info->print_gc_sections && o->size != 0)
+ _bfd_error_handler (_("Removing unused section '%s' in file '%B'"), sub, o->name);
+
/* 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)
+ && (o->flags & SEC_RELOC) != 0
+ && o->reloc_count > 0
+ && !bfd_is_abs_section (o->output_section))
{
Elf_Internal_Rela *internal_relocs;
bfd_boolean r;
@@ -8290,14 +10631,12 @@ elf_gc_sweep (struct bfd_link_info *info, gc_sweep_hook_fn gc_sweep_hook)
/* 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;
- }
+ sweep_info.info = info;
+ sweep_info.hide_symbol = bed->elf_backend_hide_symbol;
+ elf_link_hash_traverse (elf_hash_table (info), elf_gc_sweep_symbol,
+ &sweep_info);
+ _bfd_elf_link_renumber_dynsyms (abfd, info, &section_sym_count);
return TRUE;
}
@@ -8311,26 +10650,26 @@ elf_gc_propagate_vtable_entries_used (struct elf_link_hash_entry *h, void *okp)
h = (struct elf_link_hash_entry *) h->root.u.i.link;
/* Those that are not vtables. */
- if (h->vtable_parent == NULL)
+ if (h->vtable == NULL || 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)
+ 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])
+ if (h->vtable->used && h->vtable->used[-1])
return TRUE;
/* Make sure the parent's table is up to date. */
- elf_gc_propagate_vtable_entries_used (h->vtable_parent, okp);
+ elf_gc_propagate_vtable_entries_used (h->vtable->parent, okp);
- if (h->vtable_entries_used == NULL)
+ if (h->vtable->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;
+ h->vtable->used = h->vtable->parent->vtable->used;
+ h->vtable->size = h->vtable->parent->vtable->size;
}
else
{
@@ -8338,9 +10677,9 @@ elf_gc_propagate_vtable_entries_used (struct elf_link_hash_entry *h, void *okp)
bfd_boolean *cu, *pu;
/* Or the parent's entries into ours. */
- cu = h->vtable_entries_used;
+ cu = h->vtable->used;
cu[-1] = TRUE;
- pu = h->vtable_parent->vtable_entries_used;
+ pu = h->vtable->parent->vtable->used;
if (pu != NULL)
{
const struct elf_backend_data *bed;
@@ -8348,7 +10687,7 @@ elf_gc_propagate_vtable_entries_used (struct elf_link_hash_entry *h, void *okp)
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;
+ n = h->vtable->parent->vtable->size >> log_file_align;
while (n--)
{
if (*pu)
@@ -8376,7 +10715,7 @@ elf_gc_smash_unused_vtentry_relocs (struct elf_link_hash_entry *h, void *okp)
/* Take care of both those symbols that do not describe vtables as
well as those that are not loaded. */
- if (h->vtable_parent == NULL)
+ if (h->vtable == NULL || h->vtable->parent == NULL)
return TRUE;
BFD_ASSERT (h->root.type == bfd_link_hash_defined
@@ -8398,11 +10737,11 @@ elf_gc_smash_unused_vtentry_relocs (struct elf_link_hash_entry *h, void *okp)
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)
+ if (h->vtable->used
+ && (rel->r_offset - hstart) < h->vtable->size)
{
bfd_vma entry = (rel->r_offset - hstart) >> log_file_align;
- if (h->vtable_entries_used[entry])
+ if (h->vtable->used[entry])
continue;
}
/* Otherwise, kill it. */
@@ -8412,6 +10751,30 @@ elf_gc_smash_unused_vtentry_relocs (struct elf_link_hash_entry *h, void *okp)
return TRUE;
}
+/* Mark sections containing dynamically referenced symbols. When
+ building shared libraries, we must assume that any visible symbol is
+ referenced. */
+
+bfd_boolean
+bfd_elf_gc_mark_dynamic_ref_symbol (struct elf_link_hash_entry *h, void *inf)
+{
+ struct bfd_link_info *info = (struct bfd_link_info *) inf;
+
+ 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)
+ && (h->ref_dynamic
+ || (!info->executable
+ && h->def_regular
+ && ELF_ST_VISIBILITY (h->other) != STV_INTERNAL
+ && ELF_ST_VISIBILITY (h->other) != STV_HIDDEN)))
+ h->root.u.def.section->flags |= SEC_KEEP;
+
+ return TRUE;
+}
+
/* Do mark and sweep of unused sections. */
bfd_boolean
@@ -8419,15 +10782,13 @@ 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 *);
+ elf_gc_mark_hook_fn gc_mark_hook;
+ const struct elf_backend_data *bed = get_elf_backend_data (abfd);
- if (!get_elf_backend_data (abfd)->can_gc_sections
+ if (!bed->can_gc_sections
|| info->relocatable
|| info->emitrelocations
- || !is_elf_hash_table (info->hash)
- || elf_hash_table (info)->dynamic_sections_created)
+ || !is_elf_hash_table (info->hash))
{
(*_bfd_error_handler)(_("Warning: gc-sections option ignored"));
return TRUE;
@@ -8447,9 +10808,32 @@ bfd_elf_gc_sections (bfd *abfd, struct bfd_link_info *info)
if (!ok)
return FALSE;
+ /* Mark dynamically referenced symbols. */
+ if (elf_hash_table (info)->dynamic_sections_created)
+ elf_link_hash_traverse (elf_hash_table (info),
+ bed->gc_mark_dynamic_ref,
+ info);
+
/* Grovel through relocs to find out who stays ... */
+ gc_mark_hook = bed->gc_mark_hook;
+ for (sub = info->input_bfds; sub != NULL; sub = sub->link_next)
+ {
+ asection *o;
- gc_mark_hook = get_elf_backend_data (abfd)->gc_mark_hook;
+ if (bfd_get_flavour (sub) != bfd_target_elf_flavour)
+ continue;
+
+ for (o = sub->sections; o != NULL; o = o->next)
+ if ((o->flags & (SEC_EXCLUDE | SEC_KEEP)) == SEC_KEEP && !o->gc_mark)
+ if (!_bfd_elf_gc_mark (info, o, gc_mark_hook))
+ return FALSE;
+ }
+
+ /* Allow the backend to mark additional target specific sections. */
+ if (bed->gc_mark_extra_sections)
+ bed->gc_mark_extra_sections(info, gc_mark_hook);
+
+ /* ... again for sections marked from eh_frame. */
for (sub = info->input_bfds; sub != NULL; sub = sub->link_next)
{
asection *o;
@@ -8457,19 +10841,62 @@ bfd_elf_gc_sections (bfd *abfd, struct bfd_link_info *info)
if (bfd_get_flavour (sub) != bfd_target_elf_flavour)
continue;
+ /* Keep .gcc_except_table.* if the associated .text.* (or the
+ associated .gnu.linkonce.t.* if .text.* doesn't exist) is
+ marked. This isn't very nice, but the proper solution,
+ splitting .eh_frame up and using comdat doesn't pan out
+ easily due to needing special relocs to handle the
+ difference of two symbols in separate sections.
+ Don't keep code sections referenced by .eh_frame. */
+#define TEXT_PREFIX ".text."
+#define TEXT_PREFIX2 ".gnu.linkonce.t."
+#define GCC_EXCEPT_TABLE_PREFIX ".gcc_except_table."
for (o = sub->sections; o != NULL; o = o->next)
- {
- if (o->flags & SEC_KEEP)
- if (!elf_gc_mark (info, o, gc_mark_hook))
+ if (!o->gc_mark && o->gc_mark_from_eh && (o->flags & SEC_CODE) == 0)
+ {
+ if (CONST_STRNEQ (o->name, GCC_EXCEPT_TABLE_PREFIX))
+ {
+ char *fn_name;
+ const char *sec_name;
+ asection *fn_text;
+ unsigned o_name_prefix_len , fn_name_prefix_len, tmp;
+
+ o_name_prefix_len = strlen (GCC_EXCEPT_TABLE_PREFIX);
+ sec_name = o->name + o_name_prefix_len;
+ fn_name_prefix_len = strlen (TEXT_PREFIX);
+ tmp = strlen (TEXT_PREFIX2);
+ if (tmp > fn_name_prefix_len)
+ fn_name_prefix_len = tmp;
+ fn_name
+ = bfd_malloc (fn_name_prefix_len + strlen (sec_name) + 1);
+ if (fn_name == NULL)
+ return FALSE;
+
+ /* Try the first prefix. */
+ sprintf (fn_name, "%s%s", TEXT_PREFIX, sec_name);
+ fn_text = bfd_get_section_by_name (sub, fn_name);
+
+ /* Try the second prefix. */
+ if (fn_text == NULL)
+ {
+ sprintf (fn_name, "%s%s", TEXT_PREFIX2, sec_name);
+ fn_text = bfd_get_section_by_name (sub, fn_name);
+ }
+
+ free (fn_name);
+ if (fn_text == NULL || !fn_text->gc_mark)
+ continue;
+ }
+
+ /* If not using specially named exception table section,
+ then keep whatever we are using. */
+ if (!_bfd_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;
+ return elf_gc_sweep (abfd, info);
}
/* Called from check_relocs to record the existence of a VTINHERIT reloc. */
@@ -8507,13 +10934,18 @@ bfd_elf_gc_record_vtinherit (bfd *abfd,
goto win;
}
- (*_bfd_error_handler) ("%s: %s+%lu: No symbol found for INHERIT",
- bfd_archive_filename (abfd), sec->name,
- (unsigned long) offset);
+ (*_bfd_error_handler) ("%B: %A+%lu: No symbol found for INHERIT",
+ abfd, sec, (unsigned long) offset);
bfd_set_error (bfd_error_invalid_operation);
return FALSE;
win:
+ if (!child->vtable)
+ {
+ child->vtable = bfd_zalloc (abfd, sizeof (*child->vtable));
+ if (!child->vtable)
+ return FALSE;
+ }
if (!h)
{
/* This *should* only be the absolute section. It could potentially
@@ -8521,10 +10953,10 @@ bfd_elf_gc_record_vtinherit (bfd *abfd,
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;
+ child->vtable->parent = (struct elf_link_hash_entry *) -1;
}
else
- child->vtable_parent = h;
+ child->vtable->parent = h;
return TRUE;
}
@@ -8540,10 +10972,17 @@ bfd_elf_gc_record_vtentry (bfd *abfd ATTRIBUTE_UNUSED,
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)
+ if (!h->vtable)
+ {
+ h->vtable = bfd_zalloc (abfd, sizeof (*h->vtable));
+ if (!h->vtable)
+ return FALSE;
+ }
+
+ if (addend >= h->vtable->size)
{
size_t size, bytes, file_align;
- bfd_boolean *ptr = h->vtable_entries_used;
+ bfd_boolean *ptr = h->vtable->used;
/* While the symbol is undefined, we have to be prepared to handle
a zero size. */
@@ -8574,7 +11013,7 @@ bfd_elf_gc_record_vtentry (bfd *abfd ATTRIBUTE_UNUSED,
{
size_t oldbytes;
- oldbytes = (((h->vtable_entries_size >> log_file_align) + 1)
+ oldbytes = (((h->vtable->size >> log_file_align) + 1)
* sizeof (bfd_boolean));
memset (((char *) ptr) + oldbytes, 0, bytes - oldbytes);
}
@@ -8586,11 +11025,11 @@ bfd_elf_gc_record_vtentry (bfd *abfd ATTRIBUTE_UNUSED,
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->used = ptr + 1;
+ h->vtable->size = size;
}
- h->vtable_entries_used[addend >> log_file_align] = TRUE;
+ h->vtable->used[addend >> log_file_align] = TRUE;
return TRUE;
}
@@ -8792,16 +11231,19 @@ bfd_elf_discard_info (bfd *output_bfd, struct bfd_link_info *info)
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;
+ eh = NULL;
+ if (!info->relocatable)
+ {
+ eh = bfd_get_section_by_name (abfd, ".eh_frame");
+ if (eh != NULL
+ && (eh->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
+ && (stab->size == 0
|| bfd_is_abs_section (stab->output_section)
|| stab->sec_info_type != ELF_INFO_TYPE_STABS))
stab = NULL;
@@ -8838,7 +11280,10 @@ bfd_elf_discard_info (bfd *output_bfd, struct bfd_link_info *info)
cookie.locsymcount, 0,
NULL, NULL, NULL);
if (cookie.locsyms == NULL)
- return FALSE;
+ {
+ info->callbacks->einfo (_("%P%X: can not read symbols: %E\n"));
+ return FALSE;
+ }
}
if (stab != NULL)
@@ -8906,3 +11351,204 @@ bfd_elf_discard_info (bfd *output_bfd, struct bfd_link_info *info)
return ret;
}
+
+void
+_bfd_elf_section_already_linked (bfd *abfd, struct bfd_section *sec,
+ struct bfd_link_info *info)
+{
+ flagword flags;
+ const char *name, *p;
+ struct bfd_section_already_linked *l;
+ struct bfd_section_already_linked_hash_entry *already_linked_list;
+
+ if (sec->output_section == bfd_abs_section_ptr)
+ return;
+
+ flags = sec->flags;
+
+ /* Return if it isn't a linkonce section. A comdat group section
+ also has SEC_LINK_ONCE set. */
+ if ((flags & SEC_LINK_ONCE) == 0)
+ return;
+
+ /* Don't put group member sections on our list of already linked
+ sections. They are handled as a group via their group section. */
+ if (elf_sec_group (sec) != NULL)
+ return;
+
+ /* FIXME: When doing a relocatable link, we may have trouble
+ copying relocations in other sections that refer to local symbols
+ in the section being discarded. Those relocations will have to
+ be converted somehow; as of this writing I'm not sure that any of
+ the backends handle that correctly.
+
+ It is tempting to instead not discard link once sections when
+ doing a relocatable link (technically, they should be discarded
+ whenever we are building constructors). However, that fails,
+ because the linker winds up combining all the link once sections
+ into a single large link once section, which defeats the purpose
+ of having link once sections in the first place.
+
+ Also, not merging link once sections in a relocatable link
+ causes trouble for MIPS ELF, which relies on link once semantics
+ to handle the .reginfo section correctly. */
+
+ name = bfd_get_section_name (abfd, sec);
+
+ if (CONST_STRNEQ (name, ".gnu.linkonce.")
+ && (p = strchr (name + sizeof (".gnu.linkonce.") - 1, '.')) != NULL)
+ p++;
+ else
+ p = name;
+
+ already_linked_list = bfd_section_already_linked_table_lookup (p);
+
+ for (l = already_linked_list->entry; l != NULL; l = l->next)
+ {
+ /* We may have 2 different types of sections on the list: group
+ sections and linkonce sections. Match like sections. */
+ if ((flags & SEC_GROUP) == (l->sec->flags & SEC_GROUP)
+ && strcmp (name, l->sec->name) == 0
+ && bfd_coff_get_comdat_section (l->sec->owner, l->sec) == NULL)
+ {
+ /* The section has already been linked. See if we should
+ issue a warning. */
+ switch (flags & SEC_LINK_DUPLICATES)
+ {
+ default:
+ abort ();
+
+ case SEC_LINK_DUPLICATES_DISCARD:
+ break;
+
+ case SEC_LINK_DUPLICATES_ONE_ONLY:
+ (*_bfd_error_handler)
+ (_("%B: ignoring duplicate section `%A'"),
+ abfd, sec);
+ break;
+
+ case SEC_LINK_DUPLICATES_SAME_SIZE:
+ if (sec->size != l->sec->size)
+ (*_bfd_error_handler)
+ (_("%B: duplicate section `%A' has different size"),
+ abfd, sec);
+ break;
+
+ case SEC_LINK_DUPLICATES_SAME_CONTENTS:
+ if (sec->size != l->sec->size)
+ (*_bfd_error_handler)
+ (_("%B: duplicate section `%A' has different size"),
+ abfd, sec);
+ else if (sec->size != 0)
+ {
+ bfd_byte *sec_contents, *l_sec_contents;
+
+ if (!bfd_malloc_and_get_section (abfd, sec, &sec_contents))
+ (*_bfd_error_handler)
+ (_("%B: warning: could not read contents of section `%A'"),
+ abfd, sec);
+ else if (!bfd_malloc_and_get_section (l->sec->owner, l->sec,
+ &l_sec_contents))
+ (*_bfd_error_handler)
+ (_("%B: warning: could not read contents of section `%A'"),
+ l->sec->owner, l->sec);
+ else if (memcmp (sec_contents, l_sec_contents, sec->size) != 0)
+ (*_bfd_error_handler)
+ (_("%B: warning: duplicate section `%A' has different contents"),
+ abfd, sec);
+
+ if (sec_contents)
+ free (sec_contents);
+ if (l_sec_contents)
+ free (l_sec_contents);
+ }
+ break;
+ }
+
+ /* Set the output_section field so that lang_add_section
+ does not create a lang_input_section structure for this
+ section. Since there might be a symbol in the section
+ being discarded, we must retain a pointer to the section
+ which we are really going to use. */
+ sec->output_section = bfd_abs_section_ptr;
+ sec->kept_section = l->sec;
+
+ if (flags & SEC_GROUP)
+ {
+ asection *first = elf_next_in_group (sec);
+ asection *s = first;
+
+ while (s != NULL)
+ {
+ s->output_section = bfd_abs_section_ptr;
+ /* Record which group discards it. */
+ s->kept_section = l->sec;
+ s = elf_next_in_group (s);
+ /* These lists are circular. */
+ if (s == first)
+ break;
+ }
+ }
+
+ return;
+ }
+ }
+
+ /* A single member comdat group section may be discarded by a
+ linkonce section and vice versa. */
+
+ if ((flags & SEC_GROUP) != 0)
+ {
+ asection *first = elf_next_in_group (sec);
+
+ if (first != NULL && elf_next_in_group (first) == first)
+ /* Check this single member group against linkonce sections. */
+ for (l = already_linked_list->entry; l != NULL; l = l->next)
+ if ((l->sec->flags & SEC_GROUP) == 0
+ && bfd_coff_get_comdat_section (l->sec->owner, l->sec) == NULL
+ && bfd_elf_match_symbols_in_sections (l->sec, first, info))
+ {
+ first->output_section = bfd_abs_section_ptr;
+ first->kept_section = l->sec;
+ sec->output_section = bfd_abs_section_ptr;
+ break;
+ }
+ }
+ else
+ /* Check this linkonce section against single member groups. */
+ for (l = already_linked_list->entry; l != NULL; l = l->next)
+ if (l->sec->flags & SEC_GROUP)
+ {
+ asection *first = elf_next_in_group (l->sec);
+
+ if (first != NULL
+ && elf_next_in_group (first) == first
+ && bfd_elf_match_symbols_in_sections (first, sec, info))
+ {
+ sec->output_section = bfd_abs_section_ptr;
+ sec->kept_section = first;
+ break;
+ }
+ }
+
+ /* This is the first section with this name. Record it. */
+ bfd_section_already_linked_table_insert (already_linked_list, sec);
+}
+
+bfd_boolean
+_bfd_elf_common_definition (Elf_Internal_Sym *sym)
+{
+ return sym->st_shndx == SHN_COMMON;
+}
+
+unsigned int
+_bfd_elf_common_section_index (asection *sec ATTRIBUTE_UNUSED)
+{
+ return SHN_COMMON;
+}
+
+asection *
+_bfd_elf_common_section (asection *sec ATTRIBUTE_UNUSED)
+{
+ return bfd_com_section_ptr;
+}
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
index 973edd5..e0994a0 100644
--- a/contrib/binutils/bfd/elfn32-mips.c
+++ b/contrib/binutils/bfd/elfn32-mips.c
@@ -1,6 +1,6 @@
/* MIPS-specific support for 32-bit ELF
Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
- 2003 Free Software Foundation, Inc.
+ 2003, 2004, 2005, 2007 Free Software Foundation, Inc.
Most of the information added by Ian Lance Taylor, Cygnus Support,
<ian@cygnus.com>.
@@ -23,14 +23,14 @@ 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. */
+Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, 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 "bfd.h"
#include "libbfd.h"
#include "bfdlink.h"
#include "genlink.h"
@@ -61,8 +61,6 @@ 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
@@ -262,9 +260,11 @@ static reloc_howto_type elf_mips_howto_table_rel[] =
0x0000ffff, /* dst_mask */
FALSE), /* pcrel_offset */
- /* 16 bit PC relative reference. */
+ /* 16 bit PC relative reference. Note that the ABI document has a typo
+ and claims R_MIPS_PC16 to be not rightshifted, rendering it useless.
+ We do the right thing here. */
HOWTO (R_MIPS_PC16, /* type */
- 0, /* rightshift */
+ 2, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
16, /* bitsize */
TRUE, /* pc_relative */
@@ -502,7 +502,7 @@ static reloc_howto_type elf_mips_howto_table_rel[] =
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. */
+ b) No other NewABI toolchain actually emits such relocations. */
EMPTY_HOWTO (R_MIPS_HIGHER),
EMPTY_HOWTO (R_MIPS_HIGHEST),
@@ -600,6 +600,175 @@ static reloc_howto_type elf_mips_howto_table_rel[] =
0x00000000, /* src_mask */
0x00000000, /* dst_mask */
FALSE), /* pcrel_offset */
+
+ /* TLS GD/LD dynamic relocations. */
+ HOWTO (R_MIPS_TLS_DTPMOD32, /* 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_TLS_DTPMOD32", /* name */
+ TRUE, /* partial_inplace */
+ 0xffffffff, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ HOWTO (R_MIPS_TLS_DTPREL32, /* 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_TLS_DTPREL32", /* name */
+ TRUE, /* partial_inplace */
+ 0xffffffff, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ EMPTY_HOWTO (R_MIPS_TLS_DTPMOD64),
+ EMPTY_HOWTO (R_MIPS_TLS_DTPREL64),
+
+ /* TLS general dynamic variable reference. */
+ HOWTO (R_MIPS_TLS_GD, /* 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_TLS_GD", /* name */
+ TRUE, /* partial_inplace */
+ 0x0000ffff, /* src_mask */
+ 0x0000ffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* TLS local dynamic variable reference. */
+ HOWTO (R_MIPS_TLS_LDM, /* 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_TLS_LDM", /* name */
+ TRUE, /* partial_inplace */
+ 0x0000ffff, /* src_mask */
+ 0x0000ffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* TLS local dynamic offset. */
+ HOWTO (R_MIPS_TLS_DTPREL_HI16, /* 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_TLS_DTPREL_HI16", /* name */
+ TRUE, /* partial_inplace */
+ 0x0000ffff, /* src_mask */
+ 0x0000ffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* TLS local dynamic offset. */
+ HOWTO (R_MIPS_TLS_DTPREL_LO16, /* 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_TLS_DTPREL_LO16", /* name */
+ TRUE, /* partial_inplace */
+ 0x0000ffff, /* src_mask */
+ 0x0000ffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* TLS thread pointer offset. */
+ HOWTO (R_MIPS_TLS_GOTTPREL, /* 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_TLS_GOTTPREL", /* name */
+ TRUE, /* partial_inplace */
+ 0x0000ffff, /* src_mask */
+ 0x0000ffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* TLS IE dynamic relocations. */
+ HOWTO (R_MIPS_TLS_TPREL32, /* 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_TLS_TPREL32", /* name */
+ TRUE, /* partial_inplace */
+ 0xffffffff, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ EMPTY_HOWTO (R_MIPS_TLS_TPREL64),
+
+ /* TLS thread pointer offset. */
+ HOWTO (R_MIPS_TLS_TPREL_HI16, /* 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_TLS_TPREL_HI16", /* name */
+ TRUE, /* partial_inplace */
+ 0x0000ffff, /* src_mask */
+ 0x0000ffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* TLS thread pointer offset. */
+ HOWTO (R_MIPS_TLS_TPREL_LO16, /* 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_TLS_TPREL_LO16", /* name */
+ TRUE, /* partial_inplace */
+ 0x0000ffff, /* src_mask */
+ 0x0000ffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* 32 bit relocation with no addend. */
+ HOWTO (R_MIPS_GLOB_DAT, /* 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_GLOB_DAT", /* name */
+ FALSE, /* partial_inplace */
+ 0x0, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
};
/* The relocation table used for SHT_RELA sections. */
@@ -759,9 +928,11 @@ static reloc_howto_type elf_mips_howto_table_rela[] =
0x0000ffff, /* dst_mask */
FALSE), /* pcrel_offset */
- /* 16 bit PC relative reference. */
+ /* 16 bit PC relative reference. Note that the ABI document has a typo
+ and claims R_MIPS_PC16 to be not rightshifted, rendering it useless.
+ We do the right thing here. */
HOWTO (R_MIPS_PC16, /* type */
- 0, /* rightshift */
+ 2, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
16, /* bitsize */
TRUE, /* pc_relative */
@@ -1115,12 +1286,182 @@ static reloc_howto_type elf_mips_howto_table_rela[] =
"R_MIPS_JALR", /* name */
FALSE, /* partial_inplace */
0, /* src_mask */
+ 0, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* TLS GD/LD dynamic relocations. */
+ HOWTO (R_MIPS_TLS_DTPMOD32, /* 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_TLS_DTPMOD32", /* name */
+ TRUE, /* partial_inplace */
+ 0xffffffff, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ HOWTO (R_MIPS_TLS_DTPREL32, /* 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_TLS_DTPREL32", /* name */
+ TRUE, /* partial_inplace */
+ 0xffffffff, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ EMPTY_HOWTO (R_MIPS_TLS_DTPMOD64),
+ EMPTY_HOWTO (R_MIPS_TLS_DTPREL64),
+
+ /* TLS general dynamic variable reference. */
+ HOWTO (R_MIPS_TLS_GD, /* 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_TLS_GD", /* name */
+ TRUE, /* partial_inplace */
+ 0x0000ffff, /* src_mask */
+ 0x0000ffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* TLS local dynamic variable reference. */
+ HOWTO (R_MIPS_TLS_LDM, /* 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_TLS_LDM", /* name */
+ TRUE, /* partial_inplace */
+ 0x0000ffff, /* src_mask */
+ 0x0000ffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* TLS local dynamic offset. */
+ HOWTO (R_MIPS_TLS_DTPREL_HI16, /* 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_TLS_DTPREL_HI16", /* name */
+ TRUE, /* partial_inplace */
+ 0x0000ffff, /* src_mask */
+ 0x0000ffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* TLS local dynamic offset. */
+ HOWTO (R_MIPS_TLS_DTPREL_LO16, /* 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_TLS_DTPREL_LO16", /* name */
+ TRUE, /* partial_inplace */
+ 0x0000ffff, /* src_mask */
+ 0x0000ffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* TLS thread pointer offset. */
+ HOWTO (R_MIPS_TLS_GOTTPREL, /* 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_TLS_GOTTPREL", /* name */
+ TRUE, /* partial_inplace */
+ 0x0000ffff, /* src_mask */
+ 0x0000ffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* TLS IE dynamic relocations. */
+ HOWTO (R_MIPS_TLS_TPREL32, /* 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_TLS_TPREL32", /* name */
+ TRUE, /* partial_inplace */
+ 0xffffffff, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ EMPTY_HOWTO (R_MIPS_TLS_TPREL64),
+
+ /* TLS thread pointer offset. */
+ HOWTO (R_MIPS_TLS_TPREL_HI16, /* 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_TLS_TPREL_HI16", /* name */
+ TRUE, /* partial_inplace */
+ 0x0000ffff, /* src_mask */
+ 0x0000ffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* TLS thread pointer offset. */
+ HOWTO (R_MIPS_TLS_TPREL_LO16, /* 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_TLS_TPREL_LO16", /* name */
+ TRUE, /* partial_inplace */
+ 0x0000ffff, /* src_mask */
+ 0x0000ffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* 32 bit relocation with no addend. */
+ HOWTO (R_MIPS_GLOB_DAT, /* 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_GLOB_DAT", /* name */
+ FALSE, /* partial_inplace */
+ 0x0, /* src_mask */
0xffffffff, /* dst_mask */
FALSE), /* pcrel_offset */
};
-/* The reloc used for the mips16 jump instruction. */
-static reloc_howto_type elf_mips16_jump_howto =
+static reloc_howto_type elf_mips16_howto_table_rel[] =
+{
+ /* The reloc used for the mips16 jump instruction. */
HOWTO (R_MIPS16_26, /* type */
2, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
@@ -1131,15 +1472,14 @@ static reloc_howto_type elf_mips16_jump_howto =
/* This needs complex overflow
detection, because the upper four
bits must match the PC. */
- mips16_jump_reloc, /* special_function */
+ _bfd_mips_elf_generic_reloc, /* special_function */
"R_MIPS16_26", /* name */
TRUE, /* partial_inplace */
0x3ffffff, /* src_mask */
0x3ffffff, /* dst_mask */
- FALSE); /* pcrel_offset */
+ FALSE), /* pcrel_offset */
-/* The reloc used for the mips16 gprel instruction. */
-static reloc_howto_type elf_mips16_gprel_howto =
+ /* The reloc used for the mips16 gprel instruction. */
HOWTO (R_MIPS16_GPREL, /* type */
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
@@ -1150,9 +1490,118 @@ static reloc_howto_type elf_mips16_gprel_howto =
mips16_gprel_reloc, /* special_function */
"R_MIPS16_GPREL", /* name */
TRUE, /* partial_inplace */
- 0x07ff001f, /* src_mask */
- 0x07ff001f, /* dst_mask */
- FALSE); /* pcrel_offset */
+ 0x0000ffff, /* src_mask */
+ 0x0000ffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* A placeholder for MIPS16 reference to global offset table. */
+ EMPTY_HOWTO (R_MIPS16_GOT16),
+
+ /* A placeholder for MIPS16 16 bit call through global offset table. */
+ EMPTY_HOWTO (R_MIPS16_CALL16),
+
+ /* MIPS16 high 16 bits of symbol value. */
+ HOWTO (R_MIPS16_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_MIPS16_HI16", /* name */
+ TRUE, /* partial_inplace */
+ 0x0000ffff, /* src_mask */
+ 0x0000ffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* MIPS16 low 16 bits of symbol value. */
+ HOWTO (R_MIPS16_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_MIPS16_LO16", /* name */
+ TRUE, /* partial_inplace */
+ 0x0000ffff, /* src_mask */
+ 0x0000ffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+};
+
+static reloc_howto_type elf_mips16_howto_table_rela[] =
+{
+ /* The reloc used for the mips16 jump instruction. */
+ 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. */
+ _bfd_mips_elf_generic_reloc, /* special_function */
+ "R_MIPS16_26", /* name */
+ FALSE, /* partial_inplace */
+ 0x3ffffff, /* src_mask */
+ 0x3ffffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* The reloc used for the mips16 gprel instruction. */
+ 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 */
+ FALSE, /* partial_inplace */
+ 0x0000ffff, /* src_mask */
+ 0x0000ffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* A placeholder for MIPS16 reference to global offset table. */
+ EMPTY_HOWTO (R_MIPS16_GOT16),
+
+ /* A placeholder for MIPS16 16 bit call through global offset table. */
+ EMPTY_HOWTO (R_MIPS16_CALL16),
+
+ /* MIPS16 high 16 bits of symbol value. */
+ HOWTO (R_MIPS16_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_MIPS16_HI16", /* name */
+ FALSE, /* partial_inplace */
+ 0x0000ffff, /* src_mask */
+ 0x0000ffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* MIPS16 low 16 bits of symbol value. */
+ HOWTO (R_MIPS16_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_MIPS16_LO16", /* name */
+ FALSE, /* partial_inplace */
+ 0x0000ffff, /* src_mask */
+ 0x0000ffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+};
/* GNU extension to record C++ vtable hierarchy */
static reloc_howto_type elf_mips_gnu_vtinherit_howto =
@@ -1348,6 +1797,16 @@ mips_elf_literal_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol,
bfd_reloc_status_type ret;
bfd_vma gp;
+ /* R_MIPS_LITERAL 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 *)
+ _("literal relocation occurs for an external symbol");
+ return bfd_reloc_outofrange;
+ }
+
/* FIXME: The entries in the .lit8 and .lit4 sections should be merged. */
if (output_bfd != NULL)
relocatable = TRUE;
@@ -1425,7 +1884,7 @@ gprel32_with_gp (bfd *abfd, asymbol *symbol, arelent *reloc_entry,
relocation += symbol->section->output_section->vma;
relocation += symbol->section->output_offset;
- if (reloc_entry->address > input_section->_cooked_size)
+ if (reloc_entry->address > bfd_get_section_limit (abfd, input_section))
return bfd_reloc_outofrange;
if (reloc_entry->howto->src_mask == 0)
@@ -1470,28 +1929,6 @@ mips_elf_shift6_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol,
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
@@ -1501,11 +1938,18 @@ mips16_gprel_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol,
{
bfd_boolean relocatable;
bfd_reloc_status_type ret;
+ bfd_byte *location;
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;
@@ -1520,55 +1964,16 @@ mips16_gprel_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol,
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;
+ location = (bfd_byte *) data + reloc_entry->address;
+ _bfd_mips16_elf_reloc_unshuffle (abfd, reloc_entry->howto->type, FALSE,
+ location);
+ ret = _bfd_mips_elf_gprel16_with_gp (abfd, symbol, reloc_entry,
+ input_section, relocatable,
+ data, gp);
+ _bfd_mips16_elf_reloc_shuffle (abfd, reloc_entry->howto->type, !relocatable,
+ location);
- return bfd_reloc_ok;
+ return ret;
}
/* A mapping from BFD reloc types to MIPS ELF reloc types. */
@@ -1586,7 +1991,7 @@ static const struct elf_reloc_map mips_reloc_map[] =
/* 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_16_PCREL_S2, R_MIPS_PC16 },
{ BFD_RELOC_HI16_S, R_MIPS_HI16 },
{ BFD_RELOC_LO16, R_MIPS_LO16 },
{ BFD_RELOC_GPREL16, R_MIPS_GPREL16 },
@@ -1614,7 +2019,28 @@ static const struct elf_reloc_map mips_reloc_map[] =
{ 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 }
+ { BFD_RELOC_MIPS_JALR, R_MIPS_JALR },
+ { BFD_RELOC_MIPS_TLS_DTPMOD32, R_MIPS_TLS_DTPMOD32 },
+ { BFD_RELOC_MIPS_TLS_DTPREL32, R_MIPS_TLS_DTPREL32 },
+ { BFD_RELOC_MIPS_TLS_DTPMOD64, R_MIPS_TLS_DTPMOD64 },
+ { BFD_RELOC_MIPS_TLS_DTPREL64, R_MIPS_TLS_DTPREL64 },
+ { BFD_RELOC_MIPS_TLS_GD, R_MIPS_TLS_GD },
+ { BFD_RELOC_MIPS_TLS_LDM, R_MIPS_TLS_LDM },
+ { BFD_RELOC_MIPS_TLS_DTPREL_HI16, R_MIPS_TLS_DTPREL_HI16 },
+ { BFD_RELOC_MIPS_TLS_DTPREL_LO16, R_MIPS_TLS_DTPREL_LO16 },
+ { BFD_RELOC_MIPS_TLS_GOTTPREL, R_MIPS_TLS_GOTTPREL },
+ { BFD_RELOC_MIPS_TLS_TPREL32, R_MIPS_TLS_TPREL32 },
+ { BFD_RELOC_MIPS_TLS_TPREL64, R_MIPS_TLS_TPREL64 },
+ { BFD_RELOC_MIPS_TLS_TPREL_HI16, R_MIPS_TLS_TPREL_HI16 },
+ { BFD_RELOC_MIPS_TLS_TPREL_LO16, R_MIPS_TLS_TPREL_LO16 }
+};
+
+static const struct elf_reloc_map mips16_reloc_map[] =
+{
+ { BFD_RELOC_MIPS16_JMP, R_MIPS16_26 - R_MIPS16_min },
+ { BFD_RELOC_MIPS16_GPREL, R_MIPS16_GPREL - R_MIPS16_min },
+ { BFD_RELOC_MIPS16_HI16_S, R_MIPS16_HI16 - R_MIPS16_min },
+ { BFD_RELOC_MIPS16_LO16, R_MIPS16_LO16 - R_MIPS16_min },
};
/* Given a BFD reloc type, return a howto structure. */
@@ -1627,6 +2053,7 @@ bfd_elf32_bfd_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED,
/* FIXME: We default to RELA here instead of choosing the right
relocation variant. */
reloc_howto_type *howto_table = elf_mips_howto_table_rela;
+ reloc_howto_type *howto16_table = elf_mips16_howto_table_rela;
for (i = 0; i < sizeof (mips_reloc_map) / sizeof (struct elf_reloc_map);
i++)
@@ -1635,24 +2062,59 @@ bfd_elf32_bfd_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED,
return &howto_table[(int) mips_reloc_map[i].elf_val];
}
+ for (i = 0; i < sizeof (mips16_reloc_map) / sizeof (struct elf_reloc_map);
+ i++)
+ {
+ if (mips16_reloc_map[i].bfd_val == code)
+ return &howto16_table[(int) mips16_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;
}
}
+static reloc_howto_type *
+bfd_elf32_bfd_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED,
+ const char *r_name)
+{
+ unsigned int i;
+
+ for (i = 0;
+ i < (sizeof (elf_mips_howto_table_rela)
+ / sizeof (elf_mips_howto_table_rela[0]));
+ i++)
+ if (elf_mips_howto_table_rela[i].name != NULL
+ && strcasecmp (elf_mips_howto_table_rela[i].name, r_name) == 0)
+ return &elf_mips_howto_table_rela[i];
+
+ for (i = 0;
+ i < (sizeof (elf_mips16_howto_table_rela)
+ / sizeof (elf_mips16_howto_table_rela[0]));
+ i++)
+ if (elf_mips16_howto_table_rela[i].name != NULL
+ && strcasecmp (elf_mips16_howto_table_rela[i].name, r_name) == 0)
+ return &elf_mips16_howto_table_rela[i];
+
+ if (strcasecmp (elf_mips_gnu_vtinherit_howto.name, r_name) == 0)
+ return &elf_mips_gnu_vtinherit_howto;
+ if (strcasecmp (elf_mips_gnu_vtentry_howto.name, r_name) == 0)
+ return &elf_mips_gnu_vtentry_howto;
+ if (strcasecmp (elf_mips_gnu_rel16_s2.name, r_name) == 0)
+ return &elf_mips_gnu_rel16_s2;
+ if (strcasecmp (elf_mips_gnu_rela16_s2.name, r_name) == 0)
+ return &elf_mips_gnu_rela16_s2;
+
+ return NULL;
+}
+
/* Given a MIPS Elf_Internal_Rel, fill in an arelent structure. */
static reloc_howto_type *
@@ -1660,10 +2122,6 @@ 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:
@@ -1674,6 +2132,13 @@ mips_elf_n32_rtype_to_howto (unsigned int r_type, bfd_boolean rela_p)
else
return &elf_mips_gnu_rel16_s2;
default:
+ if (r_type >= R_MIPS16_min && r_type < R_MIPS16_max)
+ {
+ if (rela_p)
+ return &elf_mips16_howto_table_rela[r_type - R_MIPS16_min];
+ else
+ return &elf_mips16_howto_table_rel[r_type - R_MIPS16_min];
+ }
BFD_ASSERT (r_type < (unsigned int) R_MIPS_max);
if (rela_p)
return &elf_mips_howto_table_rela[r_type];
@@ -1760,7 +2225,7 @@ static bfd_boolean
elf32_mips_grok_prstatus (bfd *abfd, Elf_Internal_Note *note)
{
int offset;
- unsigned int raw_size;
+ unsigned int size;
switch (note->descsz)
{
@@ -1776,13 +2241,13 @@ elf32_mips_grok_prstatus (bfd *abfd, Elf_Internal_Note *note)
/* pr_reg */
offset = 72;
- raw_size = 360;
+ size = 360;
break;
}
/* Make a ".reg/999" section. */
- return _bfd_elfcore_make_pseudosection (abfd, ".reg", raw_size,
+ return _bfd_elfcore_make_pseudosection (abfd, ".reg", size,
note->descpos + offset);
}
@@ -1892,12 +2357,15 @@ static const struct ecoff_debug_swap mips_elf32_ecoff_debug_swap = {
#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_merge_symbol_attribute \
+ _bfd_mips_elf_merge_symbol_attribute
#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_init_index_section _bfd_elf_init_1_index_section
#define elf_backend_relocate_section _bfd_mips_elf_relocate_section
#define elf_backend_finish_dynamic_symbol \
_bfd_mips_elf_finish_dynamic_symbol
@@ -1933,6 +2401,7 @@ static const struct ecoff_debug_swap mips_elf32_ecoff_debug_swap = {
#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_find_inliner_info _bfd_mips_elf_find_inliner_info
#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 \
@@ -1954,10 +2423,8 @@ static const struct ecoff_debug_swap mips_elf32_ecoff_debug_swap = {
#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
+#define ELF_MAXPAGESIZE 0x10000
+#define ELF_COMMONPAGESIZE 0x1000
#include "elf32-target.h"
@@ -1968,15 +2435,15 @@ static const struct ecoff_debug_swap mips_elf32_ecoff_debug_swap = {
#undef TARGET_BIG_NAME
#undef ELF_MAXPAGESIZE
+#undef ELF_COMMONPAGESIZE
#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 ELF_COMMONPAGESIZE 0x1000
#define elf32_bed elf32_tradbed
/* Include the target file again for this target. */
diff --git a/contrib/binutils/bfd/elfxx-ia64.c b/contrib/binutils/bfd/elfxx-ia64.c
index b19aac2..e797212 100644
--- a/contrib/binutils/bfd/elfxx-ia64.c
+++ b/contrib/binutils/bfd/elfxx-ia64.c
@@ -1,5 +1,5 @@
/* IA-64 support for 64-bit ELF
- Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2004
+ Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
Free Software Foundation, Inc.
Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
@@ -17,10 +17,10 @@
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. */
+ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
#include "elf-bfd.h"
#include "opcode/ia64.h"
@@ -28,6 +28,16 @@
#include "objalloc.h"
#include "hashtab.h"
+#define ARCH_SIZE NN
+
+#if ARCH_SIZE == 64
+#define LOG_SECTION_ALIGN 3
+#endif
+
+#if ARCH_SIZE == 32
+#define LOG_SECTION_ALIGN 2
+#endif
+
/* THE RULES for all the stuff the linker creates --
GOT Entries created in response to LTOFF or LTOFF_FPTR
@@ -70,9 +80,6 @@ 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;
@@ -123,6 +130,13 @@ struct elfNN_ia64_local_hash_entry
{
int id;
unsigned int r_sym;
+ /* The number of elements in elfNN_ia64_dyn_sym_info array. */
+ unsigned int count;
+ /* The number of sorted elements in elfNN_ia64_dyn_sym_info array. */
+ unsigned int sorted_count;
+ /* The size of elfNN_ia64_dyn_sym_info array. */
+ unsigned int size;
+ /* The array of elfNN_ia64_dyn_sym_info. */
struct elfNN_ia64_dyn_sym_info *info;
/* TRUE if this hash entry's addends was translated for
@@ -133,6 +147,13 @@ struct elfNN_ia64_local_hash_entry
struct elfNN_ia64_link_hash_entry
{
struct elf_link_hash_entry root;
+ /* The number of elements in elfNN_ia64_dyn_sym_info array. */
+ unsigned int count;
+ /* The number of sorted elements in elfNN_ia64_dyn_sym_info array. */
+ unsigned int sorted_count;
+ /* The size of elfNN_ia64_dyn_sym_info array. */
+ unsigned int size;
+ /* The array of elfNN_ia64_dyn_sym_info. */
struct elfNN_ia64_dyn_sym_info *info;
};
@@ -162,6 +183,7 @@ struct elfNN_ia64_allocate_data
{
struct bfd_link_info *info;
bfd_size_type ofs;
+ bfd_boolean only_got;
};
#define elfNN_ia64_hash_table(p) \
@@ -180,13 +202,11 @@ 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));
+ PARAMS((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 *));
+ PARAMS ((flagword *, const 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
@@ -195,10 +215,6 @@ 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
@@ -207,7 +223,7 @@ 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 *,
+ PARAMS ((struct bfd_link_info *, 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));
@@ -273,7 +289,7 @@ static bfd_boolean allocate_dynrel_entries
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));
+ PARAMS ((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,
@@ -445,8 +461,8 @@ static reloc_howto_type ia64_howto_table[] =
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_DTPMOD64MSB, "DTPMOD64MSB", 4, FALSE, FALSE),
+ IA64_HOWTO (R_IA64_DTPMOD64LSB, "DTPMOD64LSB", 4, FALSE, FALSE),
IA64_HOWTO (R_IA64_LTOFF_DTPMOD22, "LTOFF_DTPMOD22", 0, FALSE, FALSE),
IA64_HOWTO (R_IA64_DTPREL14, "DTPREL14", 0, FALSE, FALSE),
@@ -479,7 +495,8 @@ lookup_howto (rtype)
elf_code_to_howto_index[ia64_howto_table[i].type] = i;
}
- BFD_ASSERT (rtype <= R_IA64_MAX_RELOC_CODE);
+ if (rtype > R_IA64_MAX_RELOC_CODE)
+ return 0;
i = elf_code_to_howto_index[rtype];
if (i >= NELEMS (ia64_howto_table))
return 0;
@@ -596,6 +613,22 @@ elfNN_ia64_reloc_type_lookup (abfd, bfd_code)
return lookup_howto (rtype);
}
+static reloc_howto_type *
+elfNN_ia64_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED,
+ const char *r_name)
+{
+ unsigned int i;
+
+ for (i = 0;
+ i < sizeof (ia64_howto_table) / sizeof (ia64_howto_table[0]);
+ i++)
+ if (ia64_howto_table[i].name != NULL
+ && strcasecmp (ia64_howto_table[i].name, r_name) == 0)
+ return &ia64_howto_table[i];
+
+ return NULL;
+}
+
/* Given a ELF reloc, return the matching HOWTO structure. */
static void
@@ -673,8 +706,146 @@ bfd_elfNN_ia64_after_parse (int itanium)
oor_branch_size = itanium ? sizeof (oor_ip) : sizeof (oor_brl);
}
+#define BTYPE_SHIFT 6
+#define Y_SHIFT 26
+#define X6_SHIFT 27
+#define X4_SHIFT 27
+#define X3_SHIFT 33
+#define X2_SHIFT 31
+#define X_SHIFT 33
+#define OPCODE_SHIFT 37
+
+#define OPCODE_BITS (0xfLL << OPCODE_SHIFT)
+#define X6_BITS (0x3fLL << X6_SHIFT)
+#define X4_BITS (0xfLL << X4_SHIFT)
+#define X3_BITS (0x7LL << X3_SHIFT)
+#define X2_BITS (0x3LL << X2_SHIFT)
+#define X_BITS (0x1LL << X_SHIFT)
+#define Y_BITS (0x1LL << Y_SHIFT)
+#define BTYPE_BITS (0x7LL << BTYPE_SHIFT)
+#define PREDICATE_BITS (0x3fLL)
+
+#define IS_NOP_B(i) \
+ (((i) & (OPCODE_BITS | X6_BITS)) == (2LL << OPCODE_SHIFT))
+#define IS_NOP_F(i) \
+ (((i) & (OPCODE_BITS | X_BITS | X6_BITS | Y_BITS)) \
+ == (0x1LL << X6_SHIFT))
+#define IS_NOP_I(i) \
+ (((i) & (OPCODE_BITS | X3_BITS | X6_BITS | Y_BITS)) \
+ == (0x1LL << X6_SHIFT))
+#define IS_NOP_M(i) \
+ (((i) & (OPCODE_BITS | X3_BITS | X2_BITS | X4_BITS | Y_BITS)) \
+ == (0x1LL << X4_SHIFT))
+#define IS_BR_COND(i) \
+ (((i) & (OPCODE_BITS | BTYPE_BITS)) == (0x4LL << OPCODE_SHIFT))
+#define IS_BR_CALL(i) \
+ (((i) & OPCODE_BITS) == (0x5LL << OPCODE_SHIFT))
+
+static bfd_boolean
+elfNN_ia64_relax_br (bfd_byte *contents, bfd_vma off)
+{
+ unsigned int template, mlx;
+ bfd_vma t0, t1, s0, s1, s2, br_code;
+ long br_slot;
+ bfd_byte *hit_addr;
+
+ hit_addr = (bfd_byte *) (contents + off);
+ br_slot = (long) hit_addr & 0x3;
+ hit_addr -= br_slot;
+ t0 = bfd_getl64 (hit_addr + 0);
+ t1 = bfd_getl64 (hit_addr + 8);
+
+ /* Check if we can turn br into brl. A label is always at the start
+ of the bundle. Even if there are predicates on NOPs, we still
+ perform this optimization. */
+ template = t0 & 0x1e;
+ s0 = (t0 >> 5) & 0x1ffffffffffLL;
+ s1 = ((t0 >> 46) | (t1 << 18)) & 0x1ffffffffffLL;
+ s2 = (t1 >> 23) & 0x1ffffffffffLL;
+ switch (br_slot)
+ {
+ case 0:
+ /* Check if slot 1 and slot 2 are NOPs. Possible template is
+ BBB. We only need to check nop.b. */
+ if (!(IS_NOP_B (s1) && IS_NOP_B (s2)))
+ return FALSE;
+ br_code = s0;
+ break;
+ case 1:
+ /* Check if slot 2 is NOP. Possible templates are MBB and BBB.
+ For BBB, slot 0 also has to be nop.b. */
+ if (!((template == 0x12 /* MBB */
+ && IS_NOP_B (s2))
+ || (template == 0x16 /* BBB */
+ && IS_NOP_B (s0)
+ && IS_NOP_B (s2))))
+ return FALSE;
+ br_code = s1;
+ break;
+ case 2:
+ /* Check if slot 1 is NOP. Possible templates are MIB, MBB, BBB,
+ MMB and MFB. For BBB, slot 0 also has to be nop.b. */
+ if (!((template == 0x10 /* MIB */
+ && IS_NOP_I (s1))
+ || (template == 0x12 /* MBB */
+ && IS_NOP_B (s1))
+ || (template == 0x16 /* BBB */
+ && IS_NOP_B (s0)
+ && IS_NOP_B (s1))
+ || (template == 0x18 /* MMB */
+ && IS_NOP_M (s1))
+ || (template == 0x1c /* MFB */
+ && IS_NOP_F (s1))))
+ return FALSE;
+ br_code = s2;
+ break;
+ default:
+ /* It should never happen. */
+ abort ();
+ }
+
+ /* We can turn br.cond/br.call into brl.cond/brl.call. */
+ if (!(IS_BR_COND (br_code) || IS_BR_CALL (br_code)))
+ return FALSE;
+
+ /* Turn br into brl by setting bit 40. */
+ br_code |= 0x1LL << 40;
+
+ /* Turn the old bundle into a MLX bundle with the same stop-bit
+ variety. */
+ if (t0 & 0x1)
+ mlx = 0x5;
+ else
+ mlx = 0x4;
+
+ if (template == 0x16)
+ {
+ /* For BBB, we need to put nop.m in slot 0. We keep the original
+ predicate only if slot 0 isn't br. */
+ if (br_slot == 0)
+ t0 = 0LL;
+ else
+ t0 &= PREDICATE_BITS << 5;
+ t0 |= 0x1LL << (X4_SHIFT + 5);
+ }
+ else
+ {
+ /* Keep the original instruction in slot 0. */
+ t0 &= 0x1ffffffffffLL << 5;
+ }
+
+ t0 |= mlx;
+
+ /* Put brl in slot 1. */
+ t1 = br_code << 23;
+
+ bfd_putl64 (t0, hit_addr);
+ bfd_putl64 (t1, hit_addr + 8);
+ return TRUE;
+}
+
static void
-elfNN_ia64_relax_brl (bfd *abfd, bfd_byte *contents, bfd_vma off)
+elfNN_ia64_relax_brl (bfd_byte *contents, bfd_vma off)
{
int template;
bfd_byte *hit_addr;
@@ -682,8 +853,8 @@ elfNN_ia64_relax_brl (bfd *abfd, bfd_byte *contents, bfd_vma off)
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);
+ t0 = bfd_getl64 (hit_addr);
+ t1 = bfd_getl64 (hit_addr + 8);
/* Keep the instruction in slot 0. */
i0 = (t0 >> 5) & 0x1ffffffffffLL;
@@ -694,15 +865,22 @@ elfNN_ia64_relax_brl (bfd *abfd, bfd_byte *contents, bfd_vma off)
/* Turn a MLX bundle into a MBB bundle with the same stop-bit
variety. */
- template = 0x12;
- if ((t0 & 0x1fLL) == 5)
- template += 1;
+ if (t0 & 0x1)
+ template = 0x13;
+ else
+ template = 0x12;
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);
+ bfd_putl64 (t0, hit_addr);
+ bfd_putl64 (t1, hit_addr + 8);
}
+
+/* Rename some of the generic section flags to better document how they
+ are used here. */
+#define skip_relax_pass_0 need_finalize_relax
+#define skip_relax_pass_1 has_gp_reloc
+
/* These functions do relaxation for IA-64 ELF. */
@@ -731,6 +909,8 @@ elfNN_ia64_relax_section (abfd, sec, link_info, again)
bfd_boolean changed_contents = FALSE;
bfd_boolean changed_relocs = FALSE;
bfd_boolean changed_got = FALSE;
+ bfd_boolean skip_relax_pass_0 = TRUE;
+ bfd_boolean skip_relax_pass_1 = TRUE;
bfd_vma gp = 0;
/* Assume we're not going to change any sizes, and we'll only need
@@ -742,18 +922,13 @@ elfNN_ia64_relax_section (abfd, sec, link_info, again)
return FALSE;
/* Nothing to do if there are no relocations or there is no need for
- the relax finalize pass. */
+ the current pass. */
if ((sec->flags & SEC_RELOC) == 0
|| sec->reloc_count == 0
- || (!link_info->need_relax_finalize
- && sec->need_finalize_relax == 0))
+ || (link_info->relax_pass == 0 && sec->skip_relax_pass_0)
+ || (link_info->relax_pass == 1 && sec->skip_relax_pass_1))
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. */
@@ -771,12 +946,7 @@ elfNN_ia64_relax_section (abfd, sec, link_info, again)
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))
+ if (!bfd_malloc_and_get_section (abfd, sec, &contents))
goto error_return;
}
@@ -789,6 +959,7 @@ elfNN_ia64_relax_section (abfd, sec, link_info, again)
bfd_size_type amt;
bfd_boolean is_branch;
struct elfNN_ia64_dyn_sym_info *dyn_i;
+ char symtype;
switch (r_type)
{
@@ -796,20 +967,19 @@ elfNN_ia64_relax_section (abfd, sec, link_info, again)
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)
+ /* In pass 1, all br relaxations are done. We can skip it. */
+ if (link_info->relax_pass == 1)
continue;
+ skip_relax_pass_0 = FALSE;
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)
+ /* We can't optimize brl to br in pass 0 since br relaxations
+ will increase the code size. Defer it to pass 1. */
+ if (link_info->relax_pass == 0)
{
- sec->need_finalize_relax = 1;
+ skip_relax_pass_1 = FALSE;
continue;
}
is_branch = TRUE;
@@ -817,12 +987,11 @@ elfNN_ia64_relax_section (abfd, sec, link_info, again)
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)
+ /* We can't relax ldx/mov in pass 0 since br relaxations will
+ increase the code size. Defer it to pass 1. */
+ if (link_info->relax_pass == 0)
{
- sec->need_finalize_relax = 1;
+ skip_relax_pass_1 = FALSE;
continue;
}
is_branch = FALSE;
@@ -864,6 +1033,7 @@ elfNN_ia64_relax_section (abfd, sec, link_info, again)
toff = isym->st_value;
dyn_i = get_dyn_sym_info (ia64_info, NULL, abfd, irel, FALSE);
+ symtype = ELF_ST_TYPE (isym->st_info);
}
else
{
@@ -908,13 +1078,38 @@ elfNN_ia64_relax_section (abfd, sec, link_info, again)
tsec = h->root.u.def.section;
toff = h->root.u.def.value;
}
+
+ symtype = h->type;
}
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);
+ {
+ /* At this stage in linking, no SEC_MERGE symbol has been
+ adjusted, so all references to such symbols need to be
+ passed through _bfd_merged_section_offset. (Later, in
+ relocate_section, all SEC_MERGE symbols *except* for
+ section symbols have been adjusted.)
+
+ gas may reduce relocations against symbols in SEC_MERGE
+ sections to a relocation against the section symbol when
+ the original addend was zero. When the reloc is against
+ a section symbol we should include the addend in the
+ offset passed to _bfd_merged_section_offset, since the
+ location of interest is the original symbol. On the
+ other hand, an access to "sym+addend" where "sym" is not
+ a section symbol should not include the addend; Such an
+ access is presumed to be an offset from "sym"; The
+ location of interest is just "sym". */
+ if (symtype == STT_SECTION)
+ toff += irel->r_addend;
+
+ toff = _bfd_merged_section_offset (abfd, &tsec,
+ elf_section_data (tsec)->sec_info,
+ toff);
+
+ if (symtype != STT_SECTION)
+ toff += irel->r_addend;
+ }
else
toff += irel->r_addend;
@@ -937,10 +1132,10 @@ elfNN_ia64_relax_section (abfd, sec, link_info, again)
/* 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);
+ elfNN_ia64_relax_brl (contents, roff);
irel->r_info
- = ELF64_R_INFO (ELF64_R_SYM (irel->r_info),
+ = ELFNN_R_INFO (ELFNN_R_SYM (irel->r_info),
R_IA64_PCREL21B);
/* If the original relocation offset points to slot
@@ -953,11 +1148,34 @@ elfNN_ia64_relax_section (abfd, sec, link_info, again)
}
else if (r_type == R_IA64_PCREL60B)
continue;
+ else if (elfNN_ia64_relax_br (contents, roff))
+ {
+ irel->r_info
+ = ELFNN_R_INFO (ELFNN_R_SYM (irel->r_info),
+ R_IA64_PCREL60B);
+
+ /* Make the relocation offset point to slot 1. */
+ irel->r_offset = (irel->r_offset & ~((bfd_vma) 0x3)) + 1;
+ continue;
+ }
+
+ /* We can't put a trampoline in a .init/.fini section. Issue
+ an error. */
+ if (strcmp (sec->output_section->name, ".init") == 0
+ || strcmp (sec->output_section->name, ".fini") == 0)
+ {
+ (*_bfd_error_handler)
+ (_("%B: Can't relax br at 0x%lx in section `%A'. Please use brl or indirect branch."),
+ sec->owner, sec, (unsigned long) roff);
+ bfd_set_error (bfd_error_bad_value);
+ goto error_return;
+ }
/* 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)
+ got one honking big section and we can't help you unless
+ you are branching backwards. You'll get an error message
+ later. */
+ if (tsec == sec && toff > roff)
continue;
/* Look for an existing fixup to this address. */
@@ -979,7 +1197,7 @@ elfNN_ia64_relax_section (abfd, sec, link_info, again)
size = oor_branch_size;
/* Resize the current section to make room for the new branch. */
- trampoff = (sec->_cooked_size + 15) & (bfd_vma) -16;
+ trampoff = (sec->size + 15) & (bfd_vma) -16;
/* If trampoline is out of range, there is nothing we
can do. */
@@ -991,7 +1209,7 @@ elfNN_ia64_relax_section (abfd, sec, link_info, again)
contents = (bfd_byte *) bfd_realloc (contents, amt);
if (contents == NULL)
goto error_return;
- sec->_cooked_size = amt;
+ sec->size = amt;
if (tsec == ia64_info->plt_sec)
{
@@ -1044,8 +1262,8 @@ elfNN_ia64_relax_section (abfd, sec, link_info, again)
}
/* Fix up the existing branch to hit the trampoline. */
- if (elfNN_ia64_install_value (abfd, contents + roff, offset,
- r_type) != bfd_reloc_ok)
+ if (elfNN_ia64_install_value (contents + roff, offset, r_type)
+ != bfd_reloc_ok)
goto error_return;
changed_contents = TRUE;
@@ -1084,7 +1302,7 @@ elfNN_ia64_relax_section (abfd, sec, link_info, again)
}
else
{
- elfNN_ia64_relax_ldxmov (abfd, contents, roff);
+ elfNN_ia64_relax_ldxmov (contents, roff);
irel->r_info = ELFNN_R_INFO (0, R_IA64_NONE);
changed_contents = TRUE;
changed_relocs = TRUE;
@@ -1096,7 +1314,7 @@ elfNN_ia64_relax_section (abfd, sec, link_info, again)
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)
{
@@ -1147,14 +1365,28 @@ elfNN_ia64_relax_section (abfd, sec, link_info, again)
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;
+ ia64_info->got_sec->size = data.ofs;
- /* ??? Resize .rela.got too. */
+ if (ia64_info->root.dynamic_sections_created
+ && ia64_info->rel_got_sec != NULL)
+ {
+ /* Resize .rela.got. */
+ ia64_info->rel_got_sec->size = 0;
+ if (link_info->shared
+ && ia64_info->self_dtpmod_offset != (bfd_vma) -1)
+ ia64_info->rel_got_sec->size += sizeof (ElfNN_External_Rela);
+ data.only_got = TRUE;
+ elfNN_ia64_dyn_sym_traverse (ia64_info, allocate_dynrel_entries,
+ &data);
+ }
}
- if (!link_info->need_relax_finalize)
- sec->need_finalize_relax = 0;
+ if (link_info->relax_pass == 0)
+ {
+ /* Pass 0 is only needed to relax br. */
+ sec->skip_relax_pass_0 = skip_relax_pass_0;
+ sec->skip_relax_pass_1 = skip_relax_pass_1;
+ }
*again = changed_contents || changed_relocs;
return TRUE;
@@ -1170,10 +1402,11 @@ elfNN_ia64_relax_section (abfd, sec, link_info, again)
free (internal_relocs);
return FALSE;
}
+#undef skip_relax_pass_0
+#undef skip_relax_pass_1
static void
-elfNN_ia64_relax_ldxmov (abfd, contents, off)
- bfd *abfd;
+elfNN_ia64_relax_ldxmov (contents, off)
bfd_byte *contents;
bfd_vma off;
{
@@ -1189,7 +1422,7 @@ elfNN_ia64_relax_ldxmov (abfd, contents, off)
abort ();
}
- dword = bfd_get_64 (abfd, contents + off);
+ dword = bfd_getl64 (contents + off);
insn = (dword >> shift) & 0x1ffffffffffLL;
r1 = (insn >> 6) & 127;
@@ -1201,38 +1434,32 @@ elfNN_ia64_relax_ldxmov (abfd, contents, off)
dword &= ~(0x1ffffffffffLL << shift);
dword |= (insn << shift);
- bfd_put_64 (abfd, dword, contents + off);
+ bfd_putl64 (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;
+is_unwind_section_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);
+ return ((CONST_STRNEQ (name, ELF_STRING_ia64_unwind)
+ && ! CONST_STRNEQ (name, ELF_STRING_ia64_unwind_info))
+ || CONST_STRNEQ (name, ELF_STRING_ia64_unwind_once));
}
/* Handle an IA-64 specific section when reading an object file. This
- is called when elfcode.h finds a section with an unknown type. */
+ is called when bfd_section_from_shdr 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;
+elfNN_ia64_section_from_shdr (bfd *abfd,
+ Elf_Internal_Shdr *hdr,
+ const char *name,
+ int shindex)
{
asection *newsect;
@@ -1256,7 +1483,7 @@ elfNN_ia64_section_from_shdr (abfd, hdr, name)
return FALSE;
}
- if (! _bfd_elf_make_section_from_shdr (abfd, hdr, name))
+ if (! _bfd_elf_make_section_from_shdr (abfd, hdr, name, shindex))
return FALSE;
newsect = hdr->bfd_section;
@@ -1271,7 +1498,7 @@ elfNN_ia64_section_from_shdr (abfd, hdr, name)
static bfd_boolean
elfNN_ia64_section_flags (flags, hdr)
flagword *flags;
- Elf_Internal_Shdr *hdr;
+ const Elf_Internal_Shdr *hdr;
{
if (hdr->sh_flags & SHF_IA_64_SHORT)
*flags |= SEC_SMALL_DATA;
@@ -1325,6 +1552,11 @@ elfNN_ia64_fake_sections (abfd, hdr, sec)
if (sec->flags & SEC_SMALL_DATA)
hdr->sh_flags |= SHF_IA_64_SHORT;
+ /* Some HP linkers look for the SHF_IA_64_HP_TLS flag instead of SHF_TLS. */
+
+ if (elfNN_ia64_hpux_vec (abfd->xvec) && (sec->flags & SHF_TLS))
+ hdr->sh_flags |= SHF_IA_64_HP_TLS;
+
return TRUE;
}
@@ -1337,9 +1569,7 @@ elfNN_ia64_final_write_processing (abfd, linker)
bfd_boolean linker ATTRIBUTE_UNUSED;
{
Elf_Internal_Shdr *hdr;
- const char *sname;
- asection *text_sect, *s;
- size_t len;
+ asection *s;
for (s = abfd->sections; s; s = s->next)
{
@@ -1347,64 +1577,11 @@ elfNN_ia64_final_write_processing (abfd, linker)
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;
- }
+ /* 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_info = hdr->sh_link;
break;
}
}
@@ -1447,11 +1624,11 @@ elfNN_ia64_add_symbol_hook (abfd, info, sym, namep, flagsp, secp, valp)
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)))
+ scomm = bfd_make_section_with_flags (abfd, ".scommon",
+ (SEC_ALLOC
+ | SEC_IS_COMMON
+ | SEC_LINKER_CREATED));
+ if (scomm == NULL)
return FALSE;
}
@@ -1465,8 +1642,8 @@ elfNN_ia64_add_symbol_hook (abfd, info, sym, namep, flagsp, secp, valp)
/* Return the number of additional phdrs we will need. */
static int
-elfNN_ia64_additional_program_headers (abfd)
- bfd *abfd;
+elfNN_ia64_additional_program_headers (bfd *abfd,
+ struct bfd_link_info *info ATTRIBUTE_UNUSED)
{
asection *s;
int ret = 0;
@@ -1485,9 +1662,8 @@ elfNN_ia64_additional_program_headers (abfd)
}
static bfd_boolean
-elfNN_ia64_modify_segment_map (abfd, info)
- bfd *abfd;
- struct bfd_link_info *info ATTRIBUTE_UNUSED;
+elfNN_ia64_modify_segment_map (bfd *abfd,
+ struct bfd_link_info *info ATTRIBUTE_UNUSED)
{
struct elf_segment_map *m, **pm;
Elf_Internal_Shdr *hdr;
@@ -1570,17 +1746,30 @@ elfNN_ia64_modify_segment_map (abfd, info)
}
}
- /* 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)
+ return TRUE;
+}
+
+/* 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. */
+
+static bfd_boolean
+elfNN_ia64_modify_program_headers (bfd *abfd,
+ struct bfd_link_info *info ATTRIBUTE_UNUSED)
+{
+ struct elf_obj_tdata *tdata = elf_tdata (abfd);
+ struct elf_segment_map *m;
+ Elf_Internal_Phdr *p;
+
+ for (p = tdata->phdr, m = tdata->segment_map; m != NULL; m = m->next, p++)
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)
+ struct bfd_link_order *order = m->sections[i]->map_head.link_order;
+
+ while (order != NULL)
{
if (order->type == bfd_indirect_link_order)
{
@@ -1588,7 +1777,7 @@ elfNN_ia64_modify_segment_map (abfd, info)
bfd_vma flags = elf_section_data(is)->this_hdr.sh_flags;
if (flags & SHF_IA_64_NORECOV)
{
- m->p_flags |= PF_IA_64_NORECOV;
+ p->p_flags |= PF_IA_64_NORECOV;
goto found;
}
}
@@ -1644,21 +1833,21 @@ elfNN_ia64_new_elf_hash_entry (entry, table, string)
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));
+ ret->info = NULL;
+ ret->count = 0;
+ ret->sorted_count = 0;
+ ret->size = 0;
return (struct bfd_hash_entry *) ret;
}
static void
-elfNN_ia64_hash_copy_indirect (bed, xdir, xind)
- const struct elf_backend_data *bed ATTRIBUTE_UNUSED;
+elfNN_ia64_hash_copy_indirect (info, xdir, xind)
+ struct bfd_link_info *info;
struct elf_link_hash_entry *xdir, *xind;
{
struct elfNN_ia64_link_hash_entry *dir, *ind;
@@ -1669,12 +1858,10 @@ elfNN_ia64_hash_copy_indirect (bed, xdir, 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));
+ dir->root.ref_dynamic |= ind->root.ref_dynamic;
+ dir->root.ref_regular |= ind->root.ref_regular;
+ dir->root.ref_regular_nonweak |= ind->root.ref_regular_nonweak;
+ dir->root.needs_plt |= ind->root.needs_plt;
if (ind->root.root.type != bfd_link_hash_indirect)
return;
@@ -1682,29 +1869,43 @@ elfNN_ia64_hash_copy_indirect (bed, xdir, xind)
/* Copy over the got and plt data. This would have been done
by check_relocs. */
- if (dir->info == NULL)
+ if (ind->info != NULL)
{
struct elfNN_ia64_dyn_sym_info *dyn_i;
+ unsigned int count;
+
+ if (dir->info)
+ free (dir->info);
+
+ dir->info = ind->info;
+ dir->count = ind->count;
+ dir->sorted_count = ind->sorted_count;
+ dir->size = ind->size;
- dir->info = dyn_i = ind->info;
ind->info = NULL;
+ ind->count = 0;
+ ind->sorted_count = 0;
+ ind->size = 0;
/* Fix up the dyn_sym_info pointers to the global symbol. */
- for (; dyn_i; dyn_i = dyn_i->next)
+ for (count = dir->count, dyn_i = dir->info;
+ count != 0;
+ count--, dyn_i++)
dyn_i->h = &dir->root;
}
- BFD_ASSERT (ind->info == NULL);
/* Copy over the dynindx. */
- if (dir->root.dynindx == -1)
+ if (ind->root.dynindx != -1)
{
+ if (dir->root.dynindx != -1)
+ _bfd_elf_strtab_delref (elf_hash_table (info)->dynstr,
+ dir->root.dynstr_index);
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
@@ -1715,12 +1916,15 @@ elfNN_ia64_hash_hide_symbol (info, xh, force_local)
{
struct elfNN_ia64_link_hash_entry *h;
struct elfNN_ia64_dyn_sym_info *dyn_i;
+ unsigned int count;
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)
+ for (count = h->count, dyn_i = h->info;
+ count != 0;
+ count--, dyn_i++)
{
dyn_i->want_plt2 = 0;
dyn_i->want_plt = 0;
@@ -1769,7 +1973,8 @@ elfNN_ia64_hash_table_create (abfd)
return 0;
if (!_bfd_elf_link_hash_table_init (&ret->root, abfd,
- elfNN_ia64_new_elf_hash_entry))
+ elfNN_ia64_new_elf_hash_entry,
+ sizeof (struct elfNN_ia64_link_hash_entry)))
{
free (ret);
return 0;
@@ -1787,6 +1992,51 @@ elfNN_ia64_hash_table_create (abfd)
return &ret->root.root;
}
+/* Free the global elfNN_ia64_dyn_sym_info array. */
+
+static bfd_boolean
+elfNN_ia64_global_dyn_info_free (void **xentry,
+ PTR unused ATTRIBUTE_UNUSED)
+{
+ struct elfNN_ia64_link_hash_entry *entry
+ = (struct elfNN_ia64_link_hash_entry *) xentry;
+
+ if (entry->root.root.type == bfd_link_hash_warning)
+ entry = (struct elfNN_ia64_link_hash_entry *) entry->root.root.u.i.link;
+
+ if (entry->info)
+ {
+ free (entry->info);
+ entry->info = NULL;
+ entry->count = 0;
+ entry->sorted_count = 0;
+ entry->size = 0;
+ }
+
+ return TRUE;
+}
+
+/* Free the local elfNN_ia64_dyn_sym_info array. */
+
+static bfd_boolean
+elfNN_ia64_local_dyn_info_free (void **slot,
+ PTR unused ATTRIBUTE_UNUSED)
+{
+ struct elfNN_ia64_local_hash_entry *entry
+ = (struct elfNN_ia64_local_hash_entry *) *slot;
+
+ if (entry->info)
+ {
+ free (entry->info);
+ entry->info = NULL;
+ entry->count = 0;
+ entry->sorted_count = 0;
+ entry->size = 0;
+ }
+
+ return TRUE;
+}
+
/* Destroy IA-64 linker hash table. */
static void
@@ -1796,9 +2046,15 @@ elfNN_ia64_hash_table_free (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);
+ {
+ htab_traverse (ia64_info->loc_hash_table,
+ elfNN_ia64_local_dyn_info_free, NULL);
+ htab_delete (ia64_info->loc_hash_table);
+ }
if (ia64_info->loc_hash_memory)
objalloc_free ((struct objalloc *) ia64_info->loc_hash_memory);
+ elf_link_hash_traverse (&ia64_info->root,
+ elfNN_ia64_global_dyn_info_free, NULL);
_bfd_generic_link_hash_table_free (hash);
}
@@ -1820,11 +2076,14 @@ elfNN_ia64_global_dyn_sym_thunk (xentry, xdata)
struct elfNN_ia64_dyn_sym_traverse_data *data
= (struct elfNN_ia64_dyn_sym_traverse_data *) xdata;
struct elfNN_ia64_dyn_sym_info *dyn_i;
+ unsigned int count;
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)
+ for (count = entry->count, dyn_i = entry->info;
+ count != 0;
+ count--, dyn_i++)
if (! (*data->func) (dyn_i, data->data))
return FALSE;
return TRUE;
@@ -1840,11 +2099,14 @@ elfNN_ia64_local_dyn_sym_thunk (slot, xdata)
struct elfNN_ia64_dyn_sym_traverse_data *data
= (struct elfNN_ia64_dyn_sym_traverse_data *) xdata;
struct elfNN_ia64_dyn_sym_info *dyn_i;
+ unsigned int count;
- for (dyn_i = entry->info; dyn_i; dyn_i = dyn_i->next)
+ for (count = entry->count, dyn_i = entry->info;
+ count != 0;
+ count--, dyn_i++)
if (! (*data->func) (dyn_i, data->data))
- return 0;
- return 1;
+ return FALSE;
+ return TRUE;
}
static void
@@ -1890,25 +2152,25 @@ elfNN_ia64_create_dynamic_sections (abfd, info)
if (!get_pltoff (abfd, info, ia64_info))
return FALSE;
- s = bfd_make_section(abfd, ".rela.IA_64.pltoff");
+ s = bfd_make_section_with_flags (abfd, ".rela.IA_64.pltoff",
+ (SEC_ALLOC | SEC_LOAD
+ | SEC_HAS_CONTENTS
+ | SEC_IN_MEMORY
+ | SEC_LINKER_CREATED
+ | SEC_READONLY));
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))
+ || !bfd_set_section_alignment (abfd, s, LOG_SECTION_ALIGN))
return FALSE;
ia64_info->rel_pltoff_sec = s;
- s = bfd_make_section(abfd, ".rela.got");
+ s = bfd_make_section_with_flags (abfd, ".rela.got",
+ (SEC_ALLOC | SEC_LOAD
+ | SEC_HAS_CONTENTS
+ | SEC_IN_MEMORY
+ | SEC_LINKER_CREATED
+ | SEC_READONLY));
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))
+ || !bfd_set_section_alignment (abfd, s, LOG_SECTION_ALIGN))
return FALSE;
ia64_info->rel_got_sec = s;
@@ -1953,8 +2215,200 @@ get_local_sym_hash (ia64_info, abfd, rel, create)
return ret;
}
+/* Used to sort elfNN_ia64_dyn_sym_info array. */
+
+static int
+addend_compare (const void *xp, const void *yp)
+{
+ const struct elfNN_ia64_dyn_sym_info *x
+ = (const struct elfNN_ia64_dyn_sym_info *) xp;
+ const struct elfNN_ia64_dyn_sym_info *y
+ = (const struct elfNN_ia64_dyn_sym_info *) yp;
+
+ return x->addend < y->addend ? -1 : x->addend > y->addend ? 1 : 0;
+}
+
+/* Sort elfNN_ia64_dyn_sym_info array and remove duplicates. */
+
+static unsigned int
+sort_dyn_sym_info (struct elfNN_ia64_dyn_sym_info *info,
+ unsigned int count)
+{
+ bfd_vma curr, prev, got_offset;
+ unsigned int i, kept, dup, diff, dest, src, len;
+
+ qsort (info, count, sizeof (*info), addend_compare);
+
+ /* Find the first duplicate. */
+ prev = info [0].addend;
+ got_offset = info [0].got_offset;
+ for (i = 1; i < count; i++)
+ {
+ curr = info [i].addend;
+ if (curr == prev)
+ {
+ /* For duplicates, make sure that GOT_OFFSET is valid. */
+ if (got_offset == (bfd_vma) -1)
+ got_offset = info [i].got_offset;
+ break;
+ }
+ got_offset = info [i].got_offset;
+ prev = curr;
+ }
+
+ /* We may move a block of elements to here. */
+ dest = i++;
+
+ /* Remove duplicates. */
+ if (i < count)
+ {
+ while (i < count)
+ {
+ /* For duplicates, make sure that the kept one has a valid
+ got_offset. */
+ kept = dest - 1;
+ if (got_offset != (bfd_vma) -1)
+ info [kept].got_offset = got_offset;
+
+ curr = info [i].addend;
+ got_offset = info [i].got_offset;
+
+ /* Move a block of elements whose first one is different from
+ the previous. */
+ if (curr == prev)
+ {
+ for (src = i + 1; src < count; src++)
+ {
+ if (info [src].addend != curr)
+ break;
+ /* For duplicates, make sure that GOT_OFFSET is
+ valid. */
+ if (got_offset == (bfd_vma) -1)
+ got_offset = info [src].got_offset;
+ }
+
+ /* Make sure that the kept one has a valid got_offset. */
+ if (got_offset != (bfd_vma) -1)
+ info [kept].got_offset = got_offset;
+ }
+ else
+ src = i;
+
+ if (src >= count)
+ break;
+
+ /* Find the next duplicate. SRC will be kept. */
+ prev = info [src].addend;
+ got_offset = info [src].got_offset;
+ for (dup = src + 1; dup < count; dup++)
+ {
+ curr = info [dup].addend;
+ if (curr == prev)
+ {
+ /* Make sure that got_offset is valid. */
+ if (got_offset == (bfd_vma) -1)
+ got_offset = info [dup].got_offset;
+
+ /* For duplicates, make sure that the kept one has
+ a valid got_offset. */
+ if (got_offset != (bfd_vma) -1)
+ info [dup - 1].got_offset = got_offset;
+ break;
+ }
+ got_offset = info [dup].got_offset;
+ prev = curr;
+ }
+
+ /* How much to move. */
+ len = dup - src;
+ i = dup + 1;
+
+ if (len == 1 && dup < count)
+ {
+ /* If we only move 1 element, we combine it with the next
+ one. There must be at least a duplicate. Find the
+ next different one. */
+ for (diff = dup + 1, src++; diff < count; diff++, src++)
+ {
+ if (info [diff].addend != curr)
+ break;
+ /* Make sure that got_offset is valid. */
+ if (got_offset == (bfd_vma) -1)
+ got_offset = info [diff].got_offset;
+ }
+
+ /* Makre sure that the last duplicated one has an valid
+ offset. */
+ BFD_ASSERT (curr == prev);
+ if (got_offset != (bfd_vma) -1)
+ info [diff - 1].got_offset = got_offset;
+
+ if (diff < count)
+ {
+ /* Find the next duplicate. Track the current valid
+ offset. */
+ prev = info [diff].addend;
+ got_offset = info [diff].got_offset;
+ for (dup = diff + 1; dup < count; dup++)
+ {
+ curr = info [dup].addend;
+ if (curr == prev)
+ {
+ /* For duplicates, make sure that GOT_OFFSET
+ is valid. */
+ if (got_offset == (bfd_vma) -1)
+ got_offset = info [dup].got_offset;
+ break;
+ }
+ got_offset = info [dup].got_offset;
+ prev = curr;
+ diff++;
+ }
+
+ len = diff - src + 1;
+ i = diff + 1;
+ }
+ }
+
+ memmove (&info [dest], &info [src], len * sizeof (*info));
+
+ dest += len;
+ }
+
+ count = dest;
+ }
+ else
+ {
+ /* When we get here, either there is no duplicate at all or
+ the only duplicate is the last element. */
+ if (dest < count)
+ {
+ /* If the last element is a duplicate, make sure that the
+ kept one has a valid got_offset. We also update count. */
+ if (got_offset != (bfd_vma) -1)
+ info [dest - 1].got_offset = got_offset;
+ count = dest;
+ }
+ }
+
+ return count;
+}
+
/* 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. */
+ vary based on global or local symbol, and the addend to the reloc.
+
+ We don't sort when inserting. Also, we sort and eliminate
+ duplicates if there is an unsorted section. Typically, this will
+ only happen once, because we do all insertions before lookups. We
+ then use bsearch to do a lookup. This also allows lookups to be
+ fast. So we have fast insertion (O(log N) due to duplicate check),
+ fast lookup (O(log N)) and one sort (O(N log N) expected time).
+ Previously, all lookups were O(N) because of the use of the linked
+ list and also all insertions were O(N) because of the check for
+ duplicates. There are some complications here because the array
+ size grows occasionally, which may add an O(N) factor, but this
+ should be rare. Also, we free the excess array allocation, which
+ requires a copy which is O(N), but this only happens once. */
static struct elfNN_ia64_dyn_sym_info *
get_dyn_sym_info (ia64_info, h, abfd, rel, create)
@@ -1964,12 +2418,22 @@ get_dyn_sym_info (ia64_info, h, abfd, rel, create)
const Elf_Internal_Rela *rel;
bfd_boolean create;
{
- struct elfNN_ia64_dyn_sym_info **pp;
- struct elfNN_ia64_dyn_sym_info *dyn_i;
+ struct elfNN_ia64_dyn_sym_info **info_p, *info, *dyn_i, key;
+ unsigned int *count_p, *sorted_count_p, *size_p;
+ unsigned int count, sorted_count, size;
bfd_vma addend = rel ? rel->r_addend : 0;
+ bfd_size_type amt;
if (h)
- pp = &((struct elfNN_ia64_link_hash_entry *)h)->info;
+ {
+ struct elfNN_ia64_link_hash_entry *global_h;
+
+ global_h = (struct elfNN_ia64_link_hash_entry *) h;
+ info_p = &global_h->info;
+ count_p = &global_h->count;
+ sorted_count_p = &global_h->sorted_count;
+ size_p = &global_h->size;
+ }
else
{
struct elfNN_ia64_local_hash_entry *loc_h;
@@ -1981,18 +2445,108 @@ get_dyn_sym_info (ia64_info, h, abfd, rel, create)
return NULL;
}
- pp = &loc_h->info;
+ info_p = &loc_h->info;
+ count_p = &loc_h->count;
+ sorted_count_p = &loc_h->sorted_count;
+ size_p = &loc_h->size;
}
- for (dyn_i = *pp; dyn_i && dyn_i->addend != addend; dyn_i = *pp)
- pp = &dyn_i->next;
-
- if (dyn_i == NULL && create)
+ count = *count_p;
+ sorted_count = *sorted_count_p;
+ size = *size_p;
+ info = *info_p;
+ if (create)
{
- dyn_i = ((struct elfNN_ia64_dyn_sym_info *)
- bfd_zalloc (abfd, (bfd_size_type) sizeof *dyn_i));
- *pp = dyn_i;
+ /* When we create the array, we don't check for duplicates,
+ except in the previously sorted section if one exists, and
+ against the last inserted entry. This allows insertions to
+ be fast. */
+ if (info)
+ {
+ if (sorted_count)
+ {
+ /* Try bsearch first on the sorted section. */
+ key.addend = addend;
+ dyn_i = bsearch (&key, info, sorted_count,
+ sizeof (*info), addend_compare);
+
+ if (dyn_i)
+ {
+ return dyn_i;
+ }
+ }
+
+ /* Do a quick check for the last inserted entry. */
+ dyn_i = info + count - 1;
+ if (dyn_i->addend == addend)
+ {
+ return dyn_i;
+ }
+ }
+
+ if (size == 0)
+ {
+ /* It is the very first element. We create the array of size
+ 1. */
+ size = 1;
+ amt = size * sizeof (*info);
+ info = bfd_malloc (amt);
+ }
+ else if (size <= count)
+ {
+ /* We double the array size every time when we reach the
+ size limit. */
+ size += size;
+ amt = size * sizeof (*info);
+ info = bfd_realloc (info, amt);
+ }
+ else
+ goto has_space;
+
+ if (info == NULL)
+ return NULL;
+ *size_p = size;
+ *info_p = info;
+
+has_space:
+ /* Append the new one to the array. */
+ dyn_i = info + count;
+ memset (dyn_i, 0, sizeof (*dyn_i));
+ dyn_i->got_offset = (bfd_vma) -1;
dyn_i->addend = addend;
+
+ /* We increment count only since the new ones are unsorted and
+ may have duplicate. */
+ (*count_p)++;
+ }
+ else
+ {
+ /* It is a lookup without insertion. Sort array if part of the
+ array isn't sorted. */
+ if (count != sorted_count)
+ {
+ count = sort_dyn_sym_info (info, count);
+ *count_p = count;
+ *sorted_count_p = count;
+ }
+
+ /* Free unused memory. */
+ if (size != count)
+ {
+ amt = count * sizeof (*info);
+ info = bfd_malloc (amt);
+ if (info != NULL)
+ {
+ memcpy (info, *info_p, amt);
+ free (*info_p);
+ *size_p = count;
+ *info_p = info;
+ }
+ }
+
+ key.addend = addend;
+ dyn_i = bsearch (&key, info, count,
+ sizeof (*info), addend_compare);
}
return dyn_i;
@@ -2054,15 +2608,14 @@ get_fptr (abfd, info, ia64_info)
if (!dynobj)
ia64_info->root.dynobj = dynobj = abfd;
- fptr = bfd_make_section (dynobj, ".opd");
+ fptr = bfd_make_section_with_flags (dynobj, ".opd",
+ (SEC_ALLOC
+ | SEC_LOAD
+ | SEC_HAS_CONTENTS
+ | SEC_IN_MEMORY
+ | (info->pie ? 0 : SEC_READONLY)
+ | SEC_LINKER_CREATED));
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);
@@ -2074,15 +2627,15 @@ get_fptr (abfd, info, ia64_info)
if (info->pie)
{
asection *fptr_rel;
- fptr_rel = bfd_make_section(dynobj, ".rela.opd");
+ fptr_rel = bfd_make_section_with_flags (dynobj, ".rela.opd",
+ (SEC_ALLOC | SEC_LOAD
+ | SEC_HAS_CONTENTS
+ | SEC_IN_MEMORY
+ | SEC_LINKER_CREATED
+ | SEC_READONLY));
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_set_section_alignment (abfd, fptr_rel,
+ LOG_SECTION_ALIGN))
{
BFD_ASSERT (0);
return NULL;
@@ -2111,15 +2664,15 @@ get_pltoff (abfd, info, ia64_info)
if (!dynobj)
ia64_info->root.dynobj = dynobj = abfd;
- pltoff = bfd_make_section (dynobj, ELF_STRING_ia64_pltoff);
+ pltoff = bfd_make_section_with_flags (dynobj,
+ ELF_STRING_ia64_pltoff,
+ (SEC_ALLOC
+ | SEC_LOAD
+ | SEC_HAS_CONTENTS
+ | SEC_IN_MEMORY
+ | SEC_SMALL_DATA
+ | SEC_LINKER_CREATED));
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);
@@ -2149,10 +2702,10 @@ get_reloc_section (abfd, ia64_info, sec, create)
if (srel_name == NULL)
return NULL;
- BFD_ASSERT ((strncmp (srel_name, ".rela", 5) == 0
+ BFD_ASSERT ((CONST_STRNEQ (srel_name, ".rela")
&& strcmp (bfd_get_section_name (abfd, sec),
srel_name+5) == 0)
- || (strncmp (srel_name, ".rel", 4) == 0
+ || (CONST_STRNEQ (srel_name, ".rel")
&& strcmp (bfd_get_section_name (abfd, sec),
srel_name+4) == 0));
@@ -2163,16 +2716,15 @@ get_reloc_section (abfd, ia64_info, sec, create)
srel = bfd_get_section_by_name (dynobj, srel_name);
if (srel == NULL && create)
{
- srel = bfd_make_section (dynobj, srel_name);
+ srel = bfd_make_section_with_flags (dynobj, srel_name,
+ (SEC_ALLOC | SEC_LOAD
+ | SEC_HAS_CONTENTS
+ | SEC_IN_MEMORY
+ | SEC_LINKER_CREATED
+ | SEC_READONLY));
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))
+ || !bfd_set_section_alignment (dynobj, srel,
+ LOG_SECTION_ALIGN))
return NULL;
}
@@ -2219,7 +2771,24 @@ elfNN_ia64_check_relocs (abfd, info, sec, relocs)
const Elf_Internal_Rela *relend;
Elf_Internal_Shdr *symtab_hdr;
const Elf_Internal_Rela *rel;
- asection *got, *fptr, *srel;
+ asection *got, *fptr, *srel, *pltoff;
+ 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
+ };
+ int need_entry;
+ struct elf_link_hash_entry *h;
+ unsigned long r_symndx;
+ bfd_boolean maybe_dynamic;
if (info->relocatable)
return TRUE;
@@ -2227,55 +2796,36 @@ elfNN_ia64_check_relocs (abfd, info, sec, relocs)
symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
ia64_info = elfNN_ia64_hash_table (info);
- got = fptr = srel = NULL;
+ got = fptr = srel = pltoff = NULL;
relend = relocs + sec->reloc_count;
+
+ /* We scan relocations first to create dynamic relocation arrays. We
+ modified get_dyn_sym_info to allow fast insertion and support fast
+ lookup in the next loop. */
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;
-
+ r_symndx = ELFNN_R_SYM (rel->r_info);
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;
}
+ else
+ h = NULL;
/* 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;
+ maybe_dynamic = (h && ((!info->executable
+ && (!SYMBOLIC_BIND (info, h)
+ || info->unresolved_syms_in_shared_libs == RM_IGNORE))
+ || !h->def_regular
+ || h->root.type == bfd_link_hash_defweak));
need_entry = 0;
switch (ELFNN_R_TYPE (rel->r_info))
@@ -2284,9 +2834,6 @@ elfNN_ia64_check_relocs (abfd, info, sec, relocs)
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:
@@ -2295,11 +2842,12 @@ elfNN_ia64_check_relocs (abfd, info, sec, relocs)
info->flags |= DF_STATIC_TLS;
break;
+ case R_IA64_DTPREL32MSB:
+ case R_IA64_DTPREL32LSB:
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:
@@ -2310,7 +2858,6 @@ elfNN_ia64_check_relocs (abfd, info, sec, relocs)
case R_IA64_DTPMOD64LSB:
if (info->shared || maybe_dynamic)
need_entry = NEED_DYNREL;
- dynrel_type = R_IA64_DTPMOD64LSB;
break;
case R_IA64_LTOFF_DTPMOD22:
@@ -2335,7 +2882,6 @@ elfNN_ia64_check_relocs (abfd, info, sec, relocs)
need_entry = NEED_FPTR | NEED_DYNREL;
else
need_entry = NEED_FPTR;
- dynrel_type = R_IA64_FPTR64LSB;
break;
case R_IA64_LTOFF22:
@@ -2385,7 +2931,6 @@ elfNN_ia64_check_relocs (abfd, info, sec, relocs)
/* 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:
@@ -2393,7 +2938,6 @@ elfNN_ia64_check_relocs (abfd, info, sec, relocs)
/* 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:
@@ -2404,7 +2948,6 @@ elfNN_ia64_check_relocs (abfd, info, sec, relocs)
case R_IA64_PCREL64LSB:
if (maybe_dynamic)
need_entry = NEED_DYNREL;
- dynrel_type = R_IA64_PCREL64LSB;
break;
}
@@ -2419,7 +2962,174 @@ elfNN_ia64_check_relocs (abfd, info, sec, relocs)
abfd, 0, (bfd_vma) 0);
}
- dyn_i = get_dyn_sym_info (ia64_info, h, abfd, rel, TRUE);
+ if (get_dyn_sym_info (ia64_info, h, abfd, rel, TRUE) == NULL)
+ return FALSE;
+ }
+
+ /* Now, we only do lookup without insertion, which is very fast
+ with the modified get_dyn_sym_info. */
+ for (rel = relocs; rel < relend; ++rel)
+ {
+ struct elfNN_ia64_dyn_sym_info *dyn_i;
+ int dynrel_type = R_IA64_NONE;
+
+ r_symndx = ELFNN_R_SYM (rel->r_info);
+ 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->ref_regular = 1;
+ }
+ else
+ h = NULL;
+
+ /* 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 = (h && ((!info->executable
+ && (!SYMBOLIC_BIND (info, h)
+ || info->unresolved_syms_in_shared_libs == RM_IGNORE))
+ || !h->def_regular
+ || h->root.type == bfd_link_hash_defweak));
+
+ 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_DTPREL32MSB:
+ case R_IA64_DTPREL32LSB:
+ case R_IA64_DTPREL64MSB:
+ case R_IA64_DTPREL64LSB:
+ if (info->shared || maybe_dynamic)
+ need_entry = NEED_DYNREL;
+ dynrel_type = R_IA64_DTPRELNNLSB;
+ 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_FPTRNNLSB;
+ 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;
+ }
+ 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_DIRNNLSB;
+ 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_PCRELNNLSB;
+ break;
+ }
+
+ if (!need_entry)
+ continue;
+
+ dyn_i = get_dyn_sym_info (ia64_info, h, abfd, rel, FALSE);
/* Record whether or not this is a local symbol. */
dyn_i->h = h;
@@ -2472,13 +3182,24 @@ elfNN_ia64_check_relocs (abfd, info, sec, relocs)
{
if (!ia64_info->root.dynobj)
ia64_info->root.dynobj = abfd;
- h->elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_PLT;
+ h->needs_plt = 1;
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;
+ {
+ /* This is needed here, in case @pltoff is used in a non-shared
+ link. */
+ if (!pltoff)
+ {
+ pltoff = get_pltoff (abfd, info, ia64_info);
+ if (!pltoff)
+ return FALSE;
+ }
+
+ dyn_i->want_pltoff = 1;
+ }
if ((need_entry & NEED_DYNREL) && (sec->flags & SEC_ALLOC))
{
if (!srel)
@@ -2557,7 +3278,7 @@ allocate_global_fptr_got (dyn_i, data)
if (dyn_i->want_got
&& dyn_i->want_fptr
- && elfNN_ia64_dynamic_symbol_p (dyn_i->h, x->info, R_IA64_FPTR64LSB))
+ && elfNN_ia64_dynamic_symbol_p (dyn_i->h, x->info, R_IA64_FPTRNNLSB))
{
dyn_i->got_offset = x->ofs;
x->ofs += 8;
@@ -2624,7 +3345,8 @@ allocate_fptr (dyn_i, data)
if (!x->info->executable
&& (!h
|| ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
- || h->root.type != bfd_link_hash_undefweak))
+ || (h->root.type != bfd_link_hash_undefweak
+ && h->root.type != bfd_link_hash_undefined)))
{
if (h && h->dynindx == -1)
{
@@ -2668,7 +3390,7 @@ allocate_plt_entries (dyn_i, data)
|| 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. */
+ /* ??? Versioned symbols seem to lose NEEDS_PLT. */
if (elfNN_ia64_dynamic_symbol_p (h, x->info, 0))
{
bfd_size_type offset = x->ofs;
@@ -2756,6 +3478,52 @@ allocate_dynrel_entries (dyn_i, data)
&& ELF_ST_VISIBILITY (dyn_i->h->other)
&& dyn_i->h->root.type == bfd_link_hash_undefweak);
+ /* 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->size += sizeof (ElfNN_External_Rela);
+ }
+ if ((dynamic_symbol || shared) && dyn_i->want_tprel)
+ ia64_info->rel_got_sec->size += sizeof (ElfNN_External_Rela);
+ if (dynamic_symbol && dyn_i->want_dtpmod)
+ ia64_info->rel_got_sec->size += sizeof (ElfNN_External_Rela);
+ if (dynamic_symbol && dyn_i->want_dtprel)
+ ia64_info->rel_got_sec->size += sizeof (ElfNN_External_Rela);
+
+ if (x->only_got)
+ return TRUE;
+
+ 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->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->size += t;
+ }
+
/* Take care of the normal data relocations. */
for (rent = dyn_i->reloc_entries; rent; rent = rent->next)
@@ -2764,6 +3532,7 @@ allocate_dynrel_entries (dyn_i, data)
switch (rent->type)
{
+ case R_IA64_FPTR32LSB:
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
@@ -2772,10 +3541,12 @@ allocate_dynrel_entries (dyn_i, data)
if (dyn_i->want_fptr && !x->info->pie)
continue;
break;
+ case R_IA64_PCREL32LSB:
case R_IA64_PCREL64LSB:
if (!dynamic_symbol)
continue;
break;
+ case R_IA64_DIR32LSB:
case R_IA64_DIR64LSB:
if (!dynamic_symbol && !shared)
continue;
@@ -2788,6 +3559,7 @@ allocate_dynrel_entries (dyn_i, data)
if (!dynamic_symbol)
count *= 2;
break;
+ case R_IA64_DTPREL32LSB:
case R_IA64_TPREL64LSB:
case R_IA64_DTPREL64LSB:
case R_IA64_DTPMOD64LSB:
@@ -2797,49 +3569,7 @@ allocate_dynrel_entries (dyn_i, data)
}
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;
+ rent->srel->size += sizeof (ElfNN_External_Rela) * count;
}
return TRUE;
@@ -2856,12 +3586,12 @@ elfNN_ia64_adjust_dynamic_symbol (info, h)
/* 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)
+ if (h->u.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;
+ BFD_ASSERT (h->u.weakdef->root.type == bfd_link_hash_defined
+ || h->u.weakdef->root.type == bfd_link_hash_defweak);
+ h->root.u.def.section = h->u.weakdef->root.u.def.section;
+ h->root.u.def.value = h->u.weakdef->root.u.def.value;
return TRUE;
}
@@ -2899,7 +3629,7 @@ elfNN_ia64_size_dynamic_sections (output_bfd, info)
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;
+ sec->size = strlen (ELF_DYNAMIC_INTERPRETER) + 1;
}
/* Allocate the GOT entries. */
@@ -2910,7 +3640,7 @@ elfNN_ia64_size_dynamic_sections (output_bfd, info)
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->size = data.ofs;
}
/* Allocate the FPTR entries. */
@@ -2919,7 +3649,7 @@ elfNN_ia64_size_dynamic_sections (output_bfd, info)
{
data.ofs = 0;
elfNN_ia64_dyn_sym_traverse (ia64_info, allocate_fptr, &data);
- ia64_info->fptr_sec->_raw_size = data.ofs;
+ ia64_info->fptr_sec->size = data.ofs;
}
/* Now that we've seen all of the input files, we can decide which
@@ -2949,12 +3679,12 @@ elfNN_ia64_size_dynamic_sections (output_bfd, info)
BFD_ASSERT (ia64_info->root.dynamic_sections_created);
- ia64_info->plt_sec->_raw_size = data.ofs;
+ ia64_info->plt_sec->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;
+ sec->size = 8 * PLT_RESERVED_WORDS;
}
/* Allocate the PLTOFF entries. */
@@ -2963,7 +3693,7 @@ elfNN_ia64_size_dynamic_sections (output_bfd, info)
{
data.ofs = 0;
elfNN_ia64_dyn_sym_traverse (ia64_info, allocate_pltoff_entries, &data);
- ia64_info->pltoff_sec->_raw_size = data.ofs;
+ ia64_info->pltoff_sec->size = data.ofs;
}
if (ia64_info->root.dynamic_sections_created)
@@ -2972,7 +3702,8 @@ elfNN_ia64_size_dynamic_sections (output_bfd, info)
required. */
if (info->shared && ia64_info->self_dtpmod_offset != (bfd_vma) -1)
- ia64_info->rel_got_sec->_raw_size += sizeof (ElfNN_External_Rela);
+ ia64_info->rel_got_sec->size += sizeof (ElfNN_External_Rela);
+ data.only_got = FALSE;
elfNN_ia64_dyn_sym_traverse (ia64_info, allocate_dynrel_entries, &data);
}
@@ -2993,7 +3724,7 @@ elfNN_ia64_size_dynamic_sections (output_bfd, info)
function which decides whether anything needs to go into
these sections. */
- strip = (sec->_raw_size == 0);
+ strip = (sec->size == 0);
if (sec == ia64_info->got_sec)
strip = FALSE;
@@ -3052,7 +3783,7 @@ elfNN_ia64_size_dynamic_sections (output_bfd, info)
if (strcmp (name, ".got.plt") == 0)
strip = FALSE;
- else if (strncmp (name, ".rel", 4) == 0)
+ else if (CONST_STRNEQ (name, ".rel"))
{
if (!strip)
{
@@ -3066,12 +3797,12 @@ elfNN_ia64_size_dynamic_sections (output_bfd, info)
}
if (strip)
- _bfd_strip_section_from_output (info, sec);
+ sec->flags |= SEC_EXCLUDE;
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)
+ sec->contents = (bfd_byte *) bfd_zalloc (dynobj, sec->size);
+ if (sec->contents == NULL && sec->size != 0)
return FALSE;
}
}
@@ -3125,15 +3856,15 @@ elfNN_ia64_size_dynamic_sections (output_bfd, info)
}
static bfd_reloc_status_type
-elfNN_ia64_install_value (abfd, hit_addr, v, r_type)
- bfd *abfd;
+elfNN_ia64_install_value (hit_addr, v, r_type)
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;
+ bfd_vma t0, t1, dword;
+ ia64_insn insn;
enum ia64_opnd opnd;
const char *err;
size_t size = 8;
@@ -3258,8 +3989,8 @@ elfNN_ia64_install_value (abfd, hit_addr, v, r_type)
{
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);
+ t0 = bfd_getl64 (hit_addr);
+ t1 = bfd_getl64 (hit_addr + 8);
/* tmpl/s: bits 0.. 5 in t0
slot 0: bits 5..45 in t0
@@ -3281,14 +4012,14 @@ elfNN_ia64_install_value (abfd, hit_addr, v, r_type)
| (((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);
+ bfd_putl64 (t0, hit_addr);
+ bfd_putl64 (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);
+ t0 = bfd_getl64 (hit_addr);
+ t1 = bfd_getl64 (hit_addr + 8);
/* tmpl/s: bits 0.. 5 in t0
slot 0: bits 5..45 in t0
@@ -3306,8 +4037,8 @@ elfNN_ia64_install_value (abfd, hit_addr, v, r_type)
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);
+ bfd_putl64 (t0, hit_addr);
+ bfd_putl64 (t1, hit_addr + 8);
break;
default:
@@ -3318,17 +4049,17 @@ elfNN_ia64_install_value (abfd, hit_addr, v, r_type)
case 2: shift = 23; hit_addr += 6; break;
case 3: return bfd_reloc_notsupported; /* shouldn't happen... */
}
- dword = bfd_get_64 (abfd, hit_addr);
+ dword = bfd_getl64 (hit_addr);
insn = (dword >> shift) & 0x1ffffffffffLL;
op = elf64_ia64_operands + opnd;
- err = (*op->insert) (op, val, (ia64_insn *)& insn);
+ err = (*op->insert) (op, val, &insn);
if (err)
return bfd_reloc_overflow;
dword &= ~(0x1ffffffffffLL << shift);
dword |= (insn << shift);
- bfd_put_64 (abfd, dword, hit_addr);
+ bfd_putl64 (dword, hit_addr);
break;
case IA64_OPND_NIL:
@@ -3382,8 +4113,7 @@ elfNN_ia64_install_dyn_reloc (abfd, info, sec, srel, offset, type,
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);
+ BFD_ASSERT (sizeof (ElfNN_External_Rela) * srel->reloc_count <= srel->size);
}
/* Store an entry for target address TARGET_ADDR in the linkage table
@@ -3428,6 +4158,7 @@ set_got_entry (abfd, info, dyn_i, dynindx, addend, value, dyn_r_type)
}
got_offset = dyn_i->dtpmod_offset;
break;
+ case R_IA64_DTPREL32LSB:
case R_IA64_DTPREL64LSB:
done = dyn_i->dtprel_done;
dyn_i->dtprel_done = TRUE;
@@ -3452,9 +4183,12 @@ set_got_entry (abfd, info, dyn_i, dynindx, addend, value, dyn_r_type)
&& (!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_DTPREL32LSB
&& 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))
+ || (dynindx != -1
+ && (dyn_r_type == R_IA64_FPTR32LSB
+ || dyn_r_type == R_IA64_FPTR64LSB)))
&& (!dyn_i->want_ltoff_fptr
|| !info->pie
|| !dyn_i->h
@@ -3463,9 +4197,10 @@ set_got_entry (abfd, info, dyn_i, dynindx, addend, value, dyn_r_type)
if (dynindx == -1
&& dyn_r_type != R_IA64_TPREL64LSB
&& dyn_r_type != R_IA64_DTPMOD64LSB
+ && dyn_r_type != R_IA64_DTPREL32LSB
&& dyn_r_type != R_IA64_DTPREL64LSB)
{
- dyn_r_type = R_IA64_REL64LSB;
+ dyn_r_type = R_IA64_RELNNLSB;
dynindx = 0;
addend = value;
}
@@ -3474,6 +4209,18 @@ set_got_entry (abfd, info, dyn_i, dynindx, addend, value, dyn_r_type)
{
switch (dyn_r_type)
{
+ case R_IA64_REL32LSB:
+ dyn_r_type = R_IA64_REL32MSB;
+ break;
+ case R_IA64_DIR32LSB:
+ dyn_r_type = R_IA64_DIR32MSB;
+ break;
+ case R_IA64_FPTR32LSB:
+ dyn_r_type = R_IA64_FPTR32MSB;
+ break;
+ case R_IA64_DTPREL32LSB:
+ dyn_r_type = R_IA64_DTPREL32MSB;
+ break;
case R_IA64_REL64LSB:
dyn_r_type = R_IA64_REL64MSB;
break;
@@ -3603,9 +4350,9 @@ set_pltoff_entry (abfd, info, dyn_i, value, is_plt)
unsigned int dyn_r_type;
if (bfd_big_endian (abfd))
- dyn_r_type = R_IA64_REL64MSB;
+ dyn_r_type = R_IA64_RELNNMSB;
else
- dyn_r_type = R_IA64_REL64LSB;
+ dyn_r_type = R_IA64_RELNNLSB;
elfNN_ia64_install_dyn_reloc (abfd, NULL, pltoff_sec,
ia64_info->rel_pltoff_sec,
@@ -3613,7 +4360,7 @@ set_pltoff_entry (abfd, info, dyn_i, value, is_plt)
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_i->pltoff_offset + ARCH_SIZE / 8,
dyn_r_type, 0, gp);
}
@@ -3631,7 +4378,7 @@ set_pltoff_entry (abfd, info, dyn_i, value, is_plt)
/* 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). */
+ is assigned offset round(2 * size of pointer, PT_TLS p_align). */
static bfd_vma
elfNN_ia64_tprel_base (info)
@@ -3640,7 +4387,8 @@ elfNN_ia64_tprel_base (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 tls_sec->vma - align_power ((bfd_vma) ARCH_SIZE / 4,
+ tls_sec->alignment_power);
}
/* Return the base VMA address which should be subtracted from real addresses
@@ -3699,7 +4447,7 @@ elfNN_ia64_choose_gp (abfd, info)
continue;
lo = os->vma;
- hi = os->vma + os->_raw_size;
+ hi = os->vma + (os->rawsize ? os->rawsize : os->size);
if (hi < lo)
hi = (bfd_vma) -1;
@@ -3740,14 +4488,16 @@ elfNN_ia64_choose_gp (abfd, info)
gp_val = got_sec->output_section->vma;
else if (max_short_vma != 0)
gp_val = min_short_vma;
- else
+ else if (max_vma - min_vma < 0x200000)
gp_val = min_vma;
+ else
+ gp_val = max_vma - 0x200000 + 8;
/* 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)
+ && (max_vma - gp_val >= 0x200000
+ || gp_val - min_vma > 0x200000))
gp_val = min_vma + 0x200000;
else if (max_short_vma != 0)
{
@@ -3804,15 +4554,15 @@ elfNN_ia64_final_link (abfd, info)
/* Make sure we've got ourselves a nice fat __gp value. */
if (!info->relocatable)
{
- bfd_vma gp_val = _bfd_get_gp_value (abfd);
+ bfd_vma gp_val;
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);
- }
+ /* We assume after gp is set, section size will only decrease. We
+ need to adjust gp for it. */
+ _bfd_set_gp_value (abfd, 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);
@@ -3835,7 +4585,7 @@ elfNN_ia64_final_link (abfd, info)
{
unwind_output_sec = s->output_section;
unwind_output_sec->contents
- = bfd_malloc (unwind_output_sec->_raw_size);
+ = bfd_malloc (unwind_output_sec->size);
if (unwind_output_sec->contents == NULL)
return FALSE;
}
@@ -3849,13 +4599,13 @@ elfNN_ia64_final_link (abfd, info)
{
elfNN_ia64_unwind_entry_compare_bfd = abfd;
qsort (unwind_output_sec->contents,
- (size_t) (unwind_output_sec->_raw_size / 24),
+ (size_t) (unwind_output_sec->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))
+ unwind_output_sec->size))
return FALSE;
}
@@ -3895,7 +4645,6 @@ elfNN_ia64_relocate_section (output_bfd, info, input_bfd, input_section,
elf_section_data(input_section->output_section)
->this_hdr.sh_flags |= flags;
- return TRUE;
}
gp_val = _bfd_get_gp_value (output_bfd);
@@ -3922,8 +4671,8 @@ elfNN_ia64_relocate_section (output_bfd, info, input_bfd, input_section,
if (r_type > R_IA64_MAX_RELOC_CODE)
{
(*_bfd_error_handler)
- (_("%s: unknown relocation type %d"),
- bfd_archive_filename (input_bfd), (int)r_type);
+ (_("%B: unknown relocation type %d"),
+ input_bfd, (int) r_type);
bfd_set_error (bfd_error_bad_value);
ret_val = FALSE;
continue;
@@ -3944,7 +4693,8 @@ elfNN_ia64_relocate_section (output_bfd, info, input_bfd, input_section,
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)
+ if (!info->relocatable
+ && (sym_sec->flags & SEC_MERGE) != 0
&& ELF_ST_TYPE (sym->st_info) == STT_SECTION
&& sym_sec->sec_info_type == ELF_INFO_TYPE_MERGE)
{
@@ -3954,8 +4704,11 @@ elfNN_ia64_relocate_section (output_bfd, info, input_bfd, input_section,
if (loc_h && ! loc_h->sec_merge_done)
{
struct elfNN_ia64_dyn_sym_info *dynent;
+ unsigned int count;
- for (dynent = loc_h->info; dynent; dynent = dynent->next)
+ for (count = loc_h->count, dynent = loc_h->info;
+ count != 0;
+ count--, dynent++)
{
msec = sym_sec;
dynent->addend =
@@ -3963,14 +4716,23 @@ elfNN_ia64_relocate_section (output_bfd, info, input_bfd, input_section,
elf_section_data (msec)->
sec_info,
sym->st_value
- + dynent->addend,
- (bfd_vma) 0);
+ + dynent->addend);
dynent->addend -= sym->st_value;
dynent->addend += msec->output_section->vma
+ msec->output_offset
- sym_sec->output_section->vma
- sym_sec->output_offset;
}
+
+ /* We may have introduced duplicated entries. We need
+ to remove them properly. */
+ count = sort_dyn_sym_info (loc_h->info, loc_h->count);
+ if (count != loc_h->count)
+ {
+ loc_h->count = count;
+ loc_h->sorted_count = count;
+ }
+
loc_h->sec_merge_done = 1;
}
}
@@ -3992,6 +4754,20 @@ elfNN_ia64_relocate_section (output_bfd, info, input_bfd, input_section,
continue;
}
+ /* For relocs against symbols from removed linkonce sections,
+ or sections discarded by a linker script, we just want the
+ section contents zeroed. Avoid any special processing. */
+ if (sym_sec != NULL && elf_discarded_section (sym_sec))
+ {
+ _bfd_clear_contents (howto, input_bfd, contents + rel->r_offset);
+ rel->r_info = 0;
+ rel->r_addend = 0;
+ continue;
+ }
+
+ if (info->relocatable)
+ continue;
+
hit_addr = contents + rel->r_offset;
value += rel->r_addend;
dynamic_symbol_p = elfNN_ia64_dynamic_symbol_p (h, info, r_type);
@@ -4028,9 +4804,11 @@ elfNN_ia64_relocate_section (output_bfd, info, input_bfd, input_section,
/* ??? 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);
+ (_("%B: non-pic code with imm relocation against dynamic symbol `%s'"),
+ input_bfd,
+ h ? h->root.root.string
+ : bfd_elf_sym_name (input_bfd, symtab_hdr, sym,
+ sym_sec));
ret_val = FALSE;
continue;
@@ -4081,7 +4859,7 @@ elfNN_ia64_relocate_section (output_bfd, info, input_bfd, input_section,
case R_IA64_LTV32LSB:
case R_IA64_LTV64MSB:
case R_IA64_LTV64LSB:
- r = elfNN_ia64_install_value (output_bfd, hit_addr, value, r_type);
+ r = elfNN_ia64_install_value (hit_addr, value, r_type);
break;
case R_IA64_GPREL22:
@@ -4093,13 +4871,16 @@ elfNN_ia64_relocate_section (output_bfd, info, input_bfd, input_section,
if (dynamic_symbol_p)
{
(*_bfd_error_handler)
- (_("%s: @gprel relocation against dynamic symbol %s"),
- bfd_archive_filename (input_bfd), h->root.root.string);
+ (_("%B: @gprel relocation against dynamic symbol %s"),
+ input_bfd,
+ h ? h->root.root.string
+ : bfd_elf_sym_name (input_bfd, symtab_hdr, sym,
+ sym_sec));
ret_val = FALSE;
continue;
}
value -= gp_val;
- r = elfNN_ia64_install_value (output_bfd, hit_addr, value, r_type);
+ r = elfNN_ia64_install_value (hit_addr, value, r_type);
break;
case R_IA64_LTOFF22:
@@ -4107,9 +4888,9 @@ elfNN_ia64_relocate_section (output_bfd, info, input_bfd, input_section,
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);
+ rel->r_addend, value, R_IA64_DIRNNLSB);
value -= gp_val;
- r = elfNN_ia64_install_value (output_bfd, hit_addr, value, r_type);
+ r = elfNN_ia64_install_value (hit_addr, value, r_type);
break;
case R_IA64_PLTOFF22:
@@ -4119,7 +4900,7 @@ elfNN_ia64_relocate_section (output_bfd, info, input_bfd, input_section,
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);
+ r = elfNN_ia64_install_value (hit_addr, value, r_type);
break;
case R_IA64_FPTR64I:
@@ -4153,14 +4934,14 @@ elfNN_ia64_relocate_section (output_bfd, info, input_bfd, input_section,
/* ??? 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));
+ (_("%B: linking non-pic code in a position independent executable"),
+ input_bfd);
ret_val = FALSE;
continue;
}
dynindx = 0;
addend = value;
- dyn_r_type = r_type + R_IA64_REL64LSB - R_IA64_FPTR64LSB;
+ dyn_r_type = r_type + R_IA64_RELNNLSB - R_IA64_FPTRNNLSB;
}
else if (h)
{
@@ -4184,7 +4965,7 @@ elfNN_ia64_relocate_section (output_bfd, info, input_bfd, input_section,
dynindx, addend);
}
- r = elfNN_ia64_install_value (output_bfd, hit_addr, value, r_type);
+ r = elfNN_ia64_install_value (hit_addr, value, r_type);
break;
case R_IA64_LTOFF_FPTR22:
@@ -4199,7 +4980,7 @@ elfNN_ia64_relocate_section (output_bfd, info, input_bfd, input_section,
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)
+ BFD_ASSERT (h == NULL || h->dynindx == -1);
if (!undef_weak_ref)
value = set_fptr_entry (output_bfd, info, dyn_i, value);
dynindx = -1;
@@ -4224,9 +5005,9 @@ elfNN_ia64_relocate_section (output_bfd, info, input_bfd, input_section,
}
value = set_got_entry (output_bfd, info, dyn_i, dynindx,
- rel->r_addend, value, R_IA64_FPTR64LSB);
+ rel->r_addend, value, R_IA64_FPTRNNLSB);
value -= gp_val;
- r = elfNN_ia64_install_value (output_bfd, hit_addr, value, r_type);
+ r = elfNN_ia64_install_value (hit_addr, value, r_type);
}
break;
@@ -4283,20 +5064,24 @@ elfNN_ia64_relocate_section (output_bfd, info, input_bfd, input_section,
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
+ 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");
+ msg = _("%B: @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");
+ msg = _("%B: 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);
+ msg = _("%B: @pcrel relocation against dynamic symbol %s");
+ (*_bfd_error_handler) (msg, input_bfd,
+ h ? h->root.root.string
+ : bfd_elf_sym_name (input_bfd,
+ symtab_hdr,
+ sym,
+ sym_sec));
ret_val = FALSE;
continue;
}
@@ -4307,20 +5092,13 @@ elfNN_ia64_relocate_section (output_bfd, info, input_bfd, input_section,
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);
+ r = elfNN_ia64_install_value (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;
@@ -4351,8 +5129,7 @@ elfNN_ia64_relocate_section (output_bfd, info, input_bfd, input_section,
value -= p->p_vaddr;
else
value = 0;
- r = elfNN_ia64_install_value (output_bfd, hit_addr, value,
- r_type);
+ r = elfNN_ia64_install_value (hit_addr, value, r_type);
}
break;
}
@@ -4361,12 +5138,11 @@ elfNN_ia64_relocate_section (output_bfd, info, input_bfd, input_section,
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);
+ /* Make output-section relative to section where the symbol
+ is defined. PR 475 */
+ if (sym_sec)
+ value -= sym_sec->output_section->vma;
+ r = elfNN_ia64_install_value (hit_addr, value, r_type);
break;
case R_IA64_IPLTMSB:
@@ -4407,25 +5183,26 @@ elfNN_ia64_relocate_section (output_bfd, info, input_bfd, input_section,
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);
+ elfNN_ia64_install_value (hit_addr, value, r_type);
+ r = elfNN_ia64_install_value (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);
+ r = elfNN_ia64_install_value (hit_addr, value, r_type);
break;
case R_IA64_DTPREL14:
case R_IA64_DTPREL22:
case R_IA64_DTPREL64I:
+ case R_IA64_DTPREL32LSB:
+ case R_IA64_DTPREL32MSB:
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);
+ r = elfNN_ia64_install_value (hit_addr, value, r_type);
break;
case R_IA64_LTOFF_TPREL22:
@@ -4460,15 +5237,14 @@ elfNN_ia64_relocate_section (output_bfd, info, input_bfd, input_section,
case R_IA64_LTOFF_DTPREL22:
if (!dynamic_symbol_p)
value -= elfNN_ia64_dtprel_base (info);
- got_r_type = R_IA64_DTPREL64LSB;
+ got_r_type = R_IA64_DTPRELNNLSB;
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);
+ r = elfNN_ia64_install_value (hit_addr, value, r_type);
}
break;
@@ -4497,15 +5273,8 @@ elfNN_ia64_relocate_section (output_bfd, info, input_bfd, input_section,
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);
- }
+ name = bfd_elf_sym_name (input_bfd, symtab_hdr, sym,
+ sym_sec);
if (!(*info->callbacks->warning) (info, _("unsupported reloc"),
name, input_bfd,
input_section, rel->r_offset))
@@ -4524,22 +5293,39 @@ elfNN_ia64_relocate_section (output_bfd, info, input_bfd, input_section,
if (h)
name = h->root.root.string;
else
+ name = bfd_elf_sym_name (input_bfd, symtab_hdr, sym,
+ sym_sec);
+
+ switch (r_type)
{
- name = bfd_elf_string_from_elf_section (input_bfd,
- symtab_hdr->sh_link,
- sym->st_name);
- if (name == NULL)
+ case R_IA64_PCREL21B:
+ case R_IA64_PCREL21BI:
+ case R_IA64_PCREL21M:
+ case R_IA64_PCREL21F:
+ if (is_elf_hash_table (info->hash))
+ {
+ /* Relaxtion is always performed for ELF output.
+ Overflow failures for those relocations mean
+ that the section is too big to relax. */
+ (*_bfd_error_handler)
+ (_("%B: Can't relax br (%s) to `%s' at 0x%lx in section `%A' with size 0x%lx (> 0x1000000)."),
+ input_bfd, input_section, howto->name, name,
+ rel->r_offset, input_section->size);
+ break;
+ }
+ default:
+ if (!(*info->callbacks->reloc_overflow) (info,
+ &h->root,
+ name,
+ howto->name,
+ (bfd_vma) 0,
+ input_bfd,
+ input_section,
+ rel->r_offset))
return FALSE;
- if (*name == '\0')
- name = bfd_section_name (input_bfd, input_section);
+ break;
}
- 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;
@@ -4579,9 +5365,8 @@ elfNN_ia64_finish_dynamic_symbol (output_bfd, info, h, sym)
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);
+ elfNN_ia64_install_value (loc, index, R_IA64_IMM22);
+ elfNN_ia64_install_value (loc+2, -dyn_i->plt_offset, R_IA64_PCREL21B);
plt_addr = (plt_sec->output_section->vma
+ plt_sec->output_offset
@@ -4594,14 +5379,13 @@ elfNN_ia64_finish_dynamic_symbol (output_bfd, info, h, sym)
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);
+ elfNN_ia64_install_value (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)
+ if (!h->def_regular)
sym->st_shndx = SHN_UNDEF;
}
@@ -4633,8 +5417,8 @@ elfNN_ia64_finish_dynamic_symbol (output_bfd, info, h, sym)
/* 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)
+ || h == ia64_info->root.hgot
+ || h == ia64_info->root.hplt)
sym->st_shndx = SHN_ABS;
return TRUE;
@@ -4661,7 +5445,7 @@ elfNN_ia64_finish_dynamic_sections (abfd, info)
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);
+ dynconend = (ElfNN_External_Dyn *) (sdyn->contents + sdyn->size);
gp_val = _bfd_get_gp_value (abfd);
@@ -4718,7 +5502,7 @@ elfNN_ia64_finish_dynamic_sections (abfd, info)
+ sgotplt->output_offset
- gp_val);
- elfNN_ia64_install_value (abfd, loc+1, pltres, R_IA64_GPREL22);
+ elfNN_ia64_install_value (loc+1, pltres, R_IA64_GPREL22);
}
}
@@ -4785,8 +5569,8 @@ elfNN_ia64_merge_private_bfd_data (ibfd, obfd)
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));
+ (_("%B: linking trap-on-NULL-dereference with non-trapping files"),
+ ibfd);
bfd_set_error (bfd_error_bad_value);
ok = FALSE;
@@ -4794,8 +5578,8 @@ elfNN_ia64_merge_private_bfd_data (ibfd, obfd)
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));
+ (_("%B: linking big-endian files with little-endian files"),
+ ibfd);
bfd_set_error (bfd_error_bad_value);
ok = FALSE;
@@ -4803,8 +5587,8 @@ elfNN_ia64_merge_private_bfd_data (ibfd, obfd)
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));
+ (_("%B: linking 64-bit files with 32-bit files"),
+ ibfd);
bfd_set_error (bfd_error_bad_value);
ok = FALSE;
@@ -4812,8 +5596,8 @@ elfNN_ia64_merge_private_bfd_data (ibfd, obfd)
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));
+ (_("%B: linking constant-gp files with non-constant-gp files"),
+ ibfd);
bfd_set_error (bfd_error_bad_value);
ok = FALSE;
@@ -4822,8 +5606,8 @@ elfNN_ia64_merge_private_bfd_data (ibfd, obfd)
!= (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));
+ (_("%B: linking auto-pic files with non-auto-pic files"),
+ ibfd);
bfd_set_error (bfd_error_bad_value);
ok = FALSE;
@@ -4877,14 +5661,107 @@ elfNN_ia64_reloc_type_class (rela)
}
}
-static struct bfd_elf_special_section const elfNN_ia64_special_sections[]=
+static const struct bfd_elf_special_section 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 }
+ { STRING_COMMA_LEN (".sbss"), -1, SHT_NOBITS, SHF_ALLOC + SHF_WRITE + SHF_IA_64_SHORT },
+ { STRING_COMMA_LEN (".sdata"), -1, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE + SHF_IA_64_SHORT },
+ { NULL, 0, 0, 0, 0 }
};
static bfd_boolean
+elfNN_ia64_object_p (bfd *abfd)
+{
+ asection *sec;
+ asection *group, *unwi, *unw;
+ flagword flags;
+ const char *name;
+ char *unwi_name, *unw_name;
+ bfd_size_type amt;
+
+ if (abfd->flags & DYNAMIC)
+ return TRUE;
+
+ /* Flags for fake group section. */
+ flags = (SEC_LINKER_CREATED | SEC_GROUP | SEC_LINK_ONCE
+ | SEC_EXCLUDE);
+
+ /* We add a fake section group for each .gnu.linkonce.t.* section,
+ which isn't in a section group, and its unwind sections. */
+ for (sec = abfd->sections; sec != NULL; sec = sec->next)
+ {
+ if (elf_sec_group (sec) == NULL
+ && ((sec->flags & (SEC_LINK_ONCE | SEC_CODE | SEC_GROUP))
+ == (SEC_LINK_ONCE | SEC_CODE))
+ && CONST_STRNEQ (sec->name, ".gnu.linkonce.t."))
+ {
+ name = sec->name + 16;
+
+ amt = strlen (name) + sizeof (".gnu.linkonce.ia64unwi.");
+ unwi_name = bfd_alloc (abfd, amt);
+ if (!unwi_name)
+ return FALSE;
+
+ strcpy (stpcpy (unwi_name, ".gnu.linkonce.ia64unwi."), name);
+ unwi = bfd_get_section_by_name (abfd, unwi_name);
+
+ amt = strlen (name) + sizeof (".gnu.linkonce.ia64unw.");
+ unw_name = bfd_alloc (abfd, amt);
+ if (!unw_name)
+ return FALSE;
+
+ strcpy (stpcpy (unw_name, ".gnu.linkonce.ia64unw."), name);
+ unw = bfd_get_section_by_name (abfd, unw_name);
+
+ /* We need to create a fake group section for it and its
+ unwind sections. */
+ group = bfd_make_section_anyway_with_flags (abfd, name,
+ flags);
+ if (group == NULL)
+ return FALSE;
+
+ /* Move the fake group section to the beginning. */
+ bfd_section_list_remove (abfd, group);
+ bfd_section_list_prepend (abfd, group);
+
+ elf_next_in_group (group) = sec;
+
+ elf_group_name (sec) = name;
+ elf_next_in_group (sec) = sec;
+ elf_sec_group (sec) = group;
+
+ if (unwi)
+ {
+ elf_group_name (unwi) = name;
+ elf_next_in_group (unwi) = sec;
+ elf_next_in_group (sec) = unwi;
+ elf_sec_group (unwi) = group;
+ }
+
+ if (unw)
+ {
+ elf_group_name (unw) = name;
+ if (unwi)
+ {
+ elf_next_in_group (unw) = elf_next_in_group (unwi);
+ elf_next_in_group (unwi) = unw;
+ }
+ else
+ {
+ elf_next_in_group (unw) = sec;
+ elf_next_in_group (sec) = unw;
+ }
+ elf_sec_group (unw) = group;
+ }
+
+ /* Fake SHT_GROUP section header. */
+ elf_section_data (group)->this_hdr.bfd_section = group;
+ elf_section_data (group)->this_hdr.sh_type = SHT_GROUP;
+ }
+ }
+ return TRUE;
+}
+
+static bfd_boolean
elfNN_ia64_hpux_vec (const bfd_target *vec)
{
extern const bfd_target bfd_elfNN_ia64_hpux_big_vec;
@@ -4898,7 +5775,7 @@ elfNN_hpux_post_process_headers (abfd, info)
{
Elf_Internal_Ehdr *i_ehdrp = elf_elfheader (abfd);
- i_ehdrp->e_ident[EI_OSABI] = ELFOSABI_HPUX;
+ i_ehdrp->e_ident[EI_OSABI] = get_elf_backend_data (abfd)->elf_osabi;
i_ehdrp->e_ident[EI_ABIVERSION] = 1;
}
@@ -4920,7 +5797,7 @@ static void
elfNN_hpux_backend_symbol_processing (bfd *abfd ATTRIBUTE_UNUSED,
asymbol *asym)
{
- elf_symbol_type *elfsym = (elf_symbol_type *) asym;;
+ elf_symbol_type *elfsym = (elf_symbol_type *) asym;
switch (elfsym->internal_elf_sym.st_shndx)
{
@@ -4942,6 +5819,7 @@ elfNN_hpux_backend_symbol_processing (bfd *abfd ATTRIBUTE_UNUSED,
#define ELF_MACHINE_ALT1 1999 /* EAS2.3 */
#define ELF_MACHINE_ALT2 1998 /* EAS2.2 */
#define ELF_MAXPAGESIZE 0x10000 /* 64KB */
+#define ELF_COMMONPAGESIZE 0x4000 /* 16KB */
#define elf_backend_section_from_shdr \
elfNN_ia64_section_from_shdr
@@ -4957,16 +5835,23 @@ elfNN_hpux_backend_symbol_processing (bfd *abfd ATTRIBUTE_UNUSED,
elfNN_ia64_additional_program_headers
#define elf_backend_modify_segment_map \
elfNN_ia64_modify_segment_map
+#define elf_backend_modify_program_headers \
+ elfNN_ia64_modify_program_headers
#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_reloc_name_lookup \
+ elfNN_ia64_reloc_name_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
+#define elf_backend_object_p \
+ elfNN_ia64_object_p
+
/* Stuff for the BFD linker: */
#define bfd_elfNN_bfd_link_hash_table_create \
elfNN_ia64_hash_table_create
@@ -4980,6 +5865,8 @@ elfNN_hpux_backend_symbol_processing (bfd *abfd ATTRIBUTE_UNUSED,
elfNN_ia64_adjust_dynamic_symbol
#define elf_backend_size_dynamic_sections \
elfNN_ia64_size_dynamic_sections
+#define elf_backend_omit_section_dynsym \
+ ((bfd_boolean (*) (bfd *, struct bfd_link_info *, asection *)) bfd_true)
#define elf_backend_relocate_section \
elfNN_ia64_relocate_section
#define elf_backend_finish_dynamic_symbol \
@@ -5007,9 +5894,38 @@ elfNN_hpux_backend_symbol_processing (bfd *abfd ATTRIBUTE_UNUSED,
#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_fixup_symbol _bfd_elf_link_hash_fixup_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
+#define elf_backend_default_execstack 0
+
+/* FIXME: PR 290: The Intel C compiler generates SHT_IA_64_UNWIND with
+ SHF_LINK_ORDER. But it doesn't set the sh_link or sh_info fields.
+ We don't want to flood users with so many error messages. We turn
+ off the warning for now. It will be turned on later when the Intel
+ compiler is fixed. */
+#define elf_backend_link_order_error_handler NULL
+
+#include "elfNN-target.h"
+
+/* FreeBSD support. */
+
+#undef TARGET_LITTLE_SYM
+#define TARGET_LITTLE_SYM bfd_elfNN_ia64_freebsd_vec
+#undef TARGET_LITTLE_NAME
+#define TARGET_LITTLE_NAME "elfNN-ia64-freebsd"
+#undef TARGET_BIG_SYM
+#undef TARGET_BIG_NAME
+
+#undef ELF_OSABI
+#define ELF_OSABI ELFOSABI_FREEBSD
+
+#undef elf_backend_post_process_headers
+#define elf_backend_post_process_headers _bfd_elf_set_osabi
+
+#undef elfNN_bed
+#define elfNN_bed elfNN_ia64_fbsd_bed
#include "elfNN-target.h"
@@ -5037,7 +5953,10 @@ elfNN_hpux_backend_symbol_processing (bfd *abfd ATTRIBUTE_UNUSED,
#define elf_backend_want_p_paddr_set_to_zero 1
#undef ELF_MAXPAGESIZE
-#define ELF_MAXPAGESIZE 0x1000 /* 1K */
+#define ELF_MAXPAGESIZE 0x1000 /* 4K */
+#undef ELF_COMMONPAGESIZE
+#undef ELF_OSABI
+#define ELF_OSABI ELFOSABI_HPUX
#undef elfNN_bed
#define elfNN_bed elfNN_ia64_hpux_bed
diff --git a/contrib/binutils/bfd/elfxx-mips.c b/contrib/binutils/bfd/elfxx-mips.c
index 87973d5..eac685f 100644
--- a/contrib/binutils/bfd/elfxx-mips.c
+++ b/contrib/binutils/bfd/elfxx-mips.c
@@ -1,6 +1,6 @@
/* MIPS-specific support for ELF
Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
- 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
+ 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
Most of the information added by Ian Lance Taylor, Cygnus Support,
<ian@cygnus.com>.
@@ -27,13 +27,14 @@
/* This file handles functionality common to the different MIPS ABI's. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
#include "libiberty.h"
#include "elf-bfd.h"
#include "elfxx-mips.h"
#include "elf/mips.h"
+#include "elf-vxworks.h"
/* Get the ECOFF swapping routines. */
#include "coff/sym.h"
@@ -43,8 +44,39 @@
#include "hashtab.h"
-/* This structure is used to hold .got entries while estimating got
- sizes. */
+/* This structure is used to hold information about one GOT entry.
+ There are three types of entry:
+
+ (1) absolute addresses
+ (abfd == NULL)
+ (2) SYMBOL + OFFSET addresses, where SYMBOL is local to an input bfd
+ (abfd != NULL, symndx >= 0)
+ (3) global and forced-local symbols
+ (abfd != NULL, symndx == -1)
+
+ Type (3) entries are treated differently for different types of GOT.
+ In the "master" GOT -- i.e. the one that describes every GOT
+ reference needed in the link -- the mips_got_entry is keyed on both
+ the symbol and the input bfd that references it. If it turns out
+ that we need multiple GOTs, we can then use this information to
+ create separate GOTs for each input bfd.
+
+ However, we want each of these separate GOTs to have at most one
+ entry for a given symbol, so their type (3) entries are keyed only
+ on the symbol. The input bfd given by the "abfd" field is somewhat
+ arbitrary in this case.
+
+ This means that when there are multiple GOTs, each GOT has a unique
+ mips_got_entry for every symbol within it. We can therefore use the
+ mips_got_entry fields (tls_type and gotidx) to track the symbol's
+ GOT index.
+
+ However, if it turns out that we need only a single GOT, we continue
+ to use the master GOT to describe it. There may therefore be several
+ mips_got_entries for the same symbol, each with a different input bfd.
+ We want to make sure that each symbol gets a unique GOT entry, so when
+ there's a single GOT, we use the symbol's hash entry, not the
+ mips_got_entry fields, to track a symbol's GOT index. */
struct mips_got_entry
{
/* The input bfd in which the symbol is defined. */
@@ -64,6 +96,14 @@ struct mips_got_entry
h->forced_local). */
struct mips_elf_link_hash_entry *h;
} d;
+
+ /* The TLS types included in this GOT entry (specifically, GD and
+ IE). The GD and IE flags can be added as we encounter new
+ relocations. LDM can also be set; it will always be alone, not
+ combined with any GD or IE flags. An LDM GOT entry will be
+ a local symbol entry with r_symndx == 0. */
+ unsigned char tls_type;
+
/* 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. */
@@ -79,6 +119,11 @@ struct mips_got_info
struct elf_link_hash_entry *global_gotsym;
/* The number of global .got entries. */
unsigned int global_gotno;
+ /* The number of .got slots used for TLS. */
+ unsigned int tls_gotno;
+ /* The first unused TLS .got entry. Used only during
+ mips_elf_initialize_tls_index. */
+ unsigned int tls_assigned_gotno;
/* The number of local .got entries. */
unsigned int local_gotno;
/* The number of local .got entries we have used. */
@@ -91,6 +136,11 @@ struct mips_got_info
/* 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;
+ /* This is the GOT index of the TLS LDM entry for the GOT, MINUS_ONE
+ for none, or MINUS_TWO for not yet assigned. This is needed
+ because a single-GOT link may have multiple hash table entries
+ for the LDM. It does not get initialized in multi-GOT mode. */
+ bfd_vma tls_ldm_offset;
};
/* Map an input bfd to a got in a multi-got link. */
@@ -125,6 +175,11 @@ struct mips_elf_got_per_bfd_arg
unsigned int primary_count;
/* The number of local and global entries in the current got. */
unsigned int current_count;
+ /* The total number of global entries which will live in the
+ primary got and be automatically relocated. This includes
+ those not referenced by the primary GOT but included in
+ the "master" GOT. */
+ unsigned int global_count;
};
/* Another structure used to pass arguments for got entries traversal. */
@@ -137,6 +192,15 @@ struct mips_elf_set_global_got_offset_arg
struct bfd_link_info *info;
};
+/* A structure used to count TLS relocations or GOT entries, for GOT
+ entry or ELF symbol table traversal. */
+
+struct mips_elf_count_tls_arg
+{
+ struct bfd_link_info *info;
+ unsigned int needed;
+};
+
struct _mips_elf_section_data
{
struct bfd_elf_section_data elf;
@@ -158,8 +222,8 @@ 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. */
+ /* The least dynamic symbol table index corresponding to a non-TLS
+ 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
@@ -210,8 +274,30 @@ struct mips_elf_link_hash_entry
being called returns a floating point value. */
asection *call_fp_stub;
- /* Are we forced local? .*/
+ /* Are we forced local? This will only be set if we have converted
+ the initial global GOT entry to a local GOT entry. */
bfd_boolean forced_local;
+
+ /* Are we referenced by some kind of relocation? */
+ bfd_boolean is_relocation_target;
+
+ /* Are we referenced by branch relocations? */
+ bfd_boolean is_branch_target;
+
+#define GOT_NORMAL 0
+#define GOT_TLS_GD 1
+#define GOT_TLS_LDM 2
+#define GOT_TLS_IE 4
+#define GOT_TLS_OFFSET_DONE 0x40
+#define GOT_TLS_DONE 0x80
+ unsigned char tls_type;
+ /* This is only used in single-GOT mode; in multi-GOT mode there
+ is one mips_got_entry per GOT entry, so the offset is stored
+ there. In single-GOT mode there may be many mips_got_entry
+ structures all referring to the same GOT slot. It might be
+ possible to use root.got.offset instead, but that field is
+ overloaded already. */
+ bfd_vma tls_got_offset;
};
/* MIPS ELF linker hash table. */
@@ -235,8 +321,39 @@ struct mips_elf_link_hash_table
bfd_vma rld_value;
/* This is set if we see any mips16 stub sections. */
bfd_boolean mips16_stubs_seen;
+ /* True if we're generating code for VxWorks. */
+ bfd_boolean is_vxworks;
+ /* Shortcuts to some dynamic sections, or NULL if they are not
+ being used. */
+ asection *srelbss;
+ asection *sdynbss;
+ asection *srelplt;
+ asection *srelplt2;
+ asection *sgotplt;
+ asection *splt;
+ /* The size of the PLT header in bytes (VxWorks only). */
+ bfd_vma plt_header_size;
+ /* The size of a PLT entry in bytes (VxWorks only). */
+ bfd_vma plt_entry_size;
+ /* The size of a function stub entry in bytes. */
+ bfd_vma function_stub_size;
};
+#define TLS_RELOC_P(r_type) \
+ (r_type == R_MIPS_TLS_DTPMOD32 \
+ || r_type == R_MIPS_TLS_DTPMOD64 \
+ || r_type == R_MIPS_TLS_DTPREL32 \
+ || r_type == R_MIPS_TLS_DTPREL64 \
+ || r_type == R_MIPS_TLS_GD \
+ || r_type == R_MIPS_TLS_LDM \
+ || r_type == R_MIPS_TLS_DTPREL_HI16 \
+ || r_type == R_MIPS_TLS_DTPREL_LO16 \
+ || r_type == R_MIPS_TLS_GOTTPREL \
+ || r_type == R_MIPS_TLS_TPREL32 \
+ || r_type == R_MIPS_TLS_TPREL64 \
+ || r_type == R_MIPS_TLS_TPREL_HI16 \
+ || r_type == R_MIPS_TLS_TPREL_LO16)
+
/* Structure used to pass information to mips_elf_output_extsym. */
struct extsym_info
@@ -369,134 +486,21 @@ typedef struct runtime_pdr {
#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);
+ (bfd *, struct bfd_link_info *, bfd *, struct mips_got_info *, asection *,
+ bfd_vma, unsigned long, struct mips_elf_link_hash_entry *, int);
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
+static bfd_boolean mips16_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
@@ -506,7 +510,6 @@ static struct mips_got_info *mips_elf_got_for_ibfd
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)
@@ -529,6 +532,16 @@ static bfd *reldyn_sorting_bfd;
#define MIPS_ELF_OPTIONS_SECTION_NAME(abfd) \
(NEWABI_P (abfd) ? ".MIPS.options" : ".options")
+/* True if NAME is the recognized name of any SHT_MIPS_OPTIONS section.
+ Some IRIX system files do not use MIPS_ELF_OPTIONS_SECTION_NAME. */
+#define MIPS_ELF_OPTIONS_SECTION_NAME_P(NAME) \
+ (strcmp (NAME, ".MIPS.options") == 0 || strcmp (NAME, ".options") == 0)
+
+/* Whether the section is readonly. */
+#define MIPS_ELF_READONLY_SECTION(sec) \
+ ((sec->flags & (SEC_ALLOC | SEC_LOAD | SEC_READONLY)) \
+ == (SEC_ALLOC | SEC_LOAD | SEC_READONLY))
+
/* The name of the stub section. */
#define MIPS_ELF_STUB_SECTION_NAME(abfd) ".MIPS.stubs"
@@ -536,6 +549,10 @@ static bfd *reldyn_sorting_bfd;
#define MIPS_ELF_REL_SIZE(abfd) \
(get_elf_backend_data (abfd)->s->sizeof_rel)
+/* The size of an external RELA relocation. */
+#define MIPS_ELF_RELA_SIZE(abfd) \
+ (get_elf_backend_data (abfd)->s->sizeof_rela)
+
/* The size of an external dynamic table entry. */
#define MIPS_ELF_DYN_SIZE(abfd) \
(get_elf_backend_data (abfd)->s->sizeof_dyn)
@@ -586,35 +603,47 @@ static bfd *reldyn_sorting_bfd;
== (ABI_64_P (abfd) ? sizeof (Elf64_External_Rela) \
: sizeof (Elf32_External_Rela))))
+/* The name of the dynamic relocation section. */
+#define MIPS_ELF_REL_DYN_NAME(INFO) \
+ (mips_elf_hash_table (INFO)->is_vxworks ? ".rela.dyn" : ".rel.dyn")
+
/* In case we're on a 32-bit machine, construct a 64-bit "-1" value
from smaller values. Start with zero, widen, *then* decrement. */
#define MINUS_ONE (((bfd_vma)0) - 1)
+#define MINUS_TWO (((bfd_vma)0) - 2)
/* The number of local .got entries we reserve. */
-#define MIPS_RESERVED_GOTNO (2)
+#define MIPS_RESERVED_GOTNO(INFO) \
+ (mips_elf_hash_table (INFO)->is_vxworks ? 3 : 2)
/* The offset of $gp from the beginning of the .got section. */
-#define ELF_MIPS_GP_OFFSET(abfd) (0x7ff0)
+#define ELF_MIPS_GP_OFFSET(INFO) \
+ (mips_elf_hash_table (INFO)->is_vxworks ? 0x0 : 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)
+#define MIPS_ELF_GOT_MAX_SIZE(INFO) (ELF_MIPS_GP_OFFSET (INFO) + 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)
+#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_LUI(VAL) (0x3c180000 + (VAL)) /* lui t8,VAL */
+#define STUB_JALR 0x0320f809 /* jalr t9,ra */
+#define STUB_ORI(VAL) (0x37180000 + (VAL)) /* ori t8,t8,VAL */
+#define STUB_LI16U(VAL) (0x34180000 + (VAL)) /* ori t8,zero,VAL unsigned */
+#define STUB_LI16S(abfd, VAL) \
+ ((ABI_64_P (abfd) \
+ ? (0x64180000 + (VAL)) /* daddiu t8,zero,VAL sign extended */ \
+ : (0x24180000 + (VAL)))) /* addiu t8,zero,VAL sign extended */
+
+#define MIPS_FUNCTION_STUB_NORMAL_SIZE 16
+#define MIPS_FUNCTION_STUB_BIG_SIZE 20
/* The name of the dynamic interpreter. This is put in the .interp
section. */
@@ -680,6 +709,48 @@ static bfd *reldyn_sorting_bfd;
#define FN_STUB ".mips16.fn."
#define CALL_STUB ".mips16.call."
#define CALL_FP_STUB ".mips16.call.fp."
+
+#define FN_STUB_P(name) CONST_STRNEQ (name, FN_STUB)
+#define CALL_STUB_P(name) CONST_STRNEQ (name, CALL_STUB)
+#define CALL_FP_STUB_P(name) CONST_STRNEQ (name, CALL_FP_STUB)
+
+/* The format of the first PLT entry in a VxWorks executable. */
+static const bfd_vma mips_vxworks_exec_plt0_entry[] = {
+ 0x3c190000, /* lui t9, %hi(_GLOBAL_OFFSET_TABLE_) */
+ 0x27390000, /* addiu t9, t9, %lo(_GLOBAL_OFFSET_TABLE_) */
+ 0x8f390008, /* lw t9, 8(t9) */
+ 0x00000000, /* nop */
+ 0x03200008, /* jr t9 */
+ 0x00000000 /* nop */
+};
+
+/* The format of subsequent PLT entries. */
+static const bfd_vma mips_vxworks_exec_plt_entry[] = {
+ 0x10000000, /* b .PLT_resolver */
+ 0x24180000, /* li t8, <pltindex> */
+ 0x3c190000, /* lui t9, %hi(<.got.plt slot>) */
+ 0x27390000, /* addiu t9, t9, %lo(<.got.plt slot>) */
+ 0x8f390000, /* lw t9, 0(t9) */
+ 0x00000000, /* nop */
+ 0x03200008, /* jr t9 */
+ 0x00000000 /* nop */
+};
+
+/* The format of the first PLT entry in a VxWorks shared object. */
+static const bfd_vma mips_vxworks_shared_plt0_entry[] = {
+ 0x8f990008, /* lw t9, 8(gp) */
+ 0x00000000, /* nop */
+ 0x03200008, /* jr t9 */
+ 0x00000000, /* nop */
+ 0x00000000, /* nop */
+ 0x00000000 /* nop */
+};
+
+/* The format of subsequent PLT entries. */
+static const bfd_vma mips_vxworks_shared_plt_entry[] = {
+ 0x10000000, /* b .PLT_resolver */
+ 0x24180000 /* li t8, <pltindex> */
+};
/* Look up an entry in a MIPS ELF linker hash table. */
@@ -701,6 +772,30 @@ static bfd *reldyn_sorting_bfd;
#define mips_elf_hash_table(p) \
((struct mips_elf_link_hash_table *) ((p)->hash))
+/* Find the base offsets for thread-local storage in this object,
+ for GD/LD and IE/LE respectively. */
+
+#define TP_OFFSET 0x7000
+#define DTP_OFFSET 0x8000
+
+static bfd_vma
+dtprel_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 + DTP_OFFSET;
+}
+
+static bfd_vma
+tprel_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 + TP_OFFSET;
+}
+
/* Create an entry in a MIPS ELF linker hash table. */
static struct bfd_hash_entry *
@@ -736,6 +831,9 @@ mips_elf_link_hash_newfunc (struct bfd_hash_entry *entry,
ret->call_stub = NULL;
ret->call_fp_stub = NULL;
ret->forced_local = FALSE;
+ ret->is_branch_target = FALSE;
+ ret->is_relocation_target = FALSE;
+ ret->tls_type = GOT_NORMAL;
}
return (struct bfd_hash_entry *) ret;
@@ -744,13 +842,16 @@ mips_elf_link_hash_newfunc (struct bfd_hash_entry *entry,
bfd_boolean
_bfd_mips_elf_new_section_hook (bfd *abfd, asection *sec)
{
- struct _mips_elf_section_data *sdata;
- bfd_size_type amt = sizeof (*sdata);
+ if (!sec->used_by_bfd)
+ {
+ 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;
+ sdata = bfd_zalloc (abfd, amt);
+ if (sdata == NULL)
+ return FALSE;
+ sec->used_by_bfd = sdata;
+ }
return _bfd_elf_new_section_hook (abfd, sec);
}
@@ -811,7 +912,6 @@ _bfd_mips_elf_read_ecoff_info (bfd *abfd, asection *section,
#undef READ
debug->fdr = NULL;
- debug->adjust = NULL;
return TRUE;
@@ -859,9 +959,6 @@ ecoff_swap_rpdr_out (bfd *abfd, const RPDR *in, struct rpdr_ext *ex)
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. */
@@ -932,7 +1029,7 @@ mips_elf_create_procedure_table (void *handle, bfd *abfd,
ss = bfd_malloc (count);
if (ss == NULL)
goto error_return;
- if (! _bfd_ecoff_get_accumulated_ss (handle, ss))
+ if (! _bfd_ecoff_get_accumulated_ss (handle, (bfd_byte *) ss))
goto error_return;
count = hdr->ipdMax;
@@ -980,12 +1077,12 @@ mips_elf_create_procedure_table (void *handle, bfd *abfd,
H_PUT_S32 (abfd, -1, (erp + count)->p_adr);
/* Set the size and contents of .rtproc section. */
- s->_raw_size = size;
+ s->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;
+ s->map_head.link_order = NULL;
if (epdr != NULL)
free (epdr);
@@ -1030,8 +1127,7 @@ mips_elf_check_mips16_stubs (struct mips_elf_link_hash_entry *h,
/* 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->size = 0;
h->fn_stub->flags &= ~SEC_RELOC;
h->fn_stub->reloc_count = 0;
h->fn_stub->flags |= SEC_EXCLUDE;
@@ -1043,8 +1139,7 @@ mips_elf_check_mips16_stubs (struct mips_elf_link_hash_entry *h,
/* 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->size = 0;
h->call_stub->flags &= ~SEC_RELOC;
h->call_stub->reloc_count = 0;
h->call_stub->flags |= SEC_EXCLUDE;
@@ -1056,8 +1151,7 @@ mips_elf_check_mips16_stubs (struct mips_elf_link_hash_entry *h,
/* 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->size = 0;
h->call_fp_stub->flags &= ~SEC_RELOC;
h->call_fp_stub->reloc_count = 0;
h->call_fp_stub->flags |= SEC_EXCLUDE;
@@ -1066,6 +1160,152 @@ mips_elf_check_mips16_stubs (struct mips_elf_link_hash_entry *h,
return TRUE;
}
+/* 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)
+
+ 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.
+
+ R_MIPS16_HI16 and R_MIPS16_LO16 are used in mips16 mode to
+ access data when neither GP-relative nor PC-relative addressing
+ can be used. They are handled like R_MIPS_HI16 and R_MIPS_LO16,
+ except that the addend is retrieved and stored as shown above
+ for R_MIPS16_GPREL.
+ */
+void
+_bfd_mips16_elf_reloc_unshuffle (bfd *abfd, int r_type,
+ bfd_boolean jal_shuffle, bfd_byte *data)
+{
+ bfd_vma extend, insn, val;
+
+ if (r_type != R_MIPS16_26 && r_type != R_MIPS16_GPREL
+ && r_type != R_MIPS16_HI16 && r_type != R_MIPS16_LO16)
+ return;
+
+ /* Pick up the mips16 extend instruction and the real instruction. */
+ extend = bfd_get_16 (abfd, data);
+ insn = bfd_get_16 (abfd, data + 2);
+ if (r_type == R_MIPS16_26)
+ {
+ if (jal_shuffle)
+ val = ((extend & 0xfc00) << 16) | ((extend & 0x3e0) << 11)
+ | ((extend & 0x1f) << 21) | insn;
+ else
+ val = extend << 16 | insn;
+ }
+ else
+ val = ((extend & 0xf800) << 16) | ((insn & 0xffe0) << 11)
+ | ((extend & 0x1f) << 11) | (extend & 0x7e0) | (insn & 0x1f);
+ bfd_put_32 (abfd, val, data);
+}
+
+void
+_bfd_mips16_elf_reloc_shuffle (bfd *abfd, int r_type,
+ bfd_boolean jal_shuffle, bfd_byte *data)
+{
+ bfd_vma extend, insn, val;
+
+ if (r_type != R_MIPS16_26 && r_type != R_MIPS16_GPREL
+ && r_type != R_MIPS16_HI16 && r_type != R_MIPS16_LO16)
+ return;
+
+ val = bfd_get_32 (abfd, data);
+ if (r_type == R_MIPS16_26)
+ {
+ if (jal_shuffle)
+ {
+ insn = val & 0xffff;
+ extend = ((val >> 16) & 0xfc00) | ((val >> 11) & 0x3e0)
+ | ((val >> 21) & 0x1f);
+ }
+ else
+ {
+ insn = val & 0xffff;
+ extend = val >> 16;
+ }
+ }
+ else
+ {
+ insn = ((val >> 11) & 0xffe0) | (val & 0x1f);
+ extend = ((val >> 16) & 0xf800) | ((val >> 11) & 0x1f) | (val & 0x7e0);
+ }
+ bfd_put_16 (abfd, insn, data + 2);
+ bfd_put_16 (abfd, extend, data);
+}
+
bfd_reloc_status_type
_bfd_mips_elf_gprel16_with_gp (bfd *abfd, asymbol *symbol,
arelent *reloc_entry, asection *input_section,
@@ -1083,7 +1323,7 @@ _bfd_mips_elf_gprel16_with_gp (bfd *abfd, asymbol *symbol,
relocation += symbol->section->output_section->vma;
relocation += symbol->section->output_offset;
- if (reloc_entry->address > input_section->_cooked_size)
+ if (reloc_entry->address > bfd_get_section_limit (abfd, input_section))
return bfd_reloc_outofrange;
/* Set val to the offset into the section or symbol. */
@@ -1149,7 +1389,7 @@ _bfd_mips_elf_hi16_reloc (bfd *abfd ATTRIBUTE_UNUSED, arelent *reloc_entry,
{
struct mips_hi16 *n;
- if (reloc_entry->address > input_section->_cooked_size)
+ if (reloc_entry->address > bfd_get_section_limit (abfd, input_section))
return bfd_reloc_outofrange;
n = bfd_malloc (sizeof *n);
@@ -1199,11 +1439,17 @@ _bfd_mips_elf_lo16_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol,
bfd *output_bfd, char **error_message)
{
bfd_vma vallo;
+ bfd_byte *location = (bfd_byte *) data + reloc_entry->address;
- if (reloc_entry->address > input_section->_cooked_size)
+ if (reloc_entry->address > bfd_get_section_limit (abfd, input_section))
return bfd_reloc_outofrange;
- vallo = bfd_get_32 (abfd, (bfd_byte *) data + reloc_entry->address);
+ _bfd_mips16_elf_reloc_unshuffle (abfd, reloc_entry->howto->type, FALSE,
+ location);
+ vallo = bfd_get_32 (abfd, location);
+ _bfd_mips16_elf_reloc_shuffle (abfd, reloc_entry->howto->type, FALSE,
+ location);
+
while (mips_hi16_list != NULL)
{
bfd_reloc_status_type ret;
@@ -1223,13 +1469,6 @@ _bfd_mips_elf_lo16_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol,
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);
@@ -1261,7 +1500,7 @@ _bfd_mips_elf_generic_reloc (bfd *abfd ATTRIBUTE_UNUSED, arelent *reloc_entry,
relocatable = (output_bfd != NULL);
- if (reloc_entry->address > input_section->_cooked_size)
+ if (reloc_entry->address > bfd_get_section_limit (abfd, input_section))
return bfd_reloc_outofrange;
/* Build up the field adjustment in VAL. */
@@ -1296,13 +1535,19 @@ _bfd_mips_elf_generic_reloc (bfd *abfd ATTRIBUTE_UNUSED, arelent *reloc_entry,
reloc_entry->addend += val;
else
{
+ bfd_byte *location = (bfd_byte *) data + reloc_entry->address;
+
/* Add in the separate addend, if any. */
val += reloc_entry->addend;
/* Add VAL to the relocation field. */
+ _bfd_mips16_elf_reloc_unshuffle (abfd, reloc_entry->howto->type, FALSE,
+ location);
status = _bfd_relocate_contents (reloc_entry->howto, abfd, val,
- (bfd_byte *) data
- + reloc_entry->address);
+ location);
+ _bfd_mips16_elf_reloc_shuffle (abfd, reloc_entry->howto->type, FALSE,
+ location);
+
if (status != bfd_reloc_ok)
return status;
}
@@ -1451,18 +1696,29 @@ sort_dynamic_relocs (const void *arg1, const void *arg2)
{
Elf_Internal_Rela int_reloc1;
Elf_Internal_Rela int_reloc2;
+ int diff;
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);
+ diff = ELF32_R_SYM (int_reloc1.r_info) - ELF32_R_SYM (int_reloc2.r_info);
+ if (diff != 0)
+ return diff;
+
+ if (int_reloc1.r_offset < int_reloc2.r_offset)
+ return -1;
+ if (int_reloc1.r_offset > int_reloc2.r_offset)
+ return 1;
+ return 0;
}
/* Like sort_dynamic_relocs, but used for elf64 relocations. */
static int
-sort_dynamic_relocs_64 (const void *arg1, const void *arg2)
+sort_dynamic_relocs_64 (const void *arg1 ATTRIBUTE_UNUSED,
+ const void *arg2 ATTRIBUTE_UNUSED)
{
+#ifdef BFD64
Elf_Internal_Rela int_reloc1[3];
Elf_Internal_Rela int_reloc2[3];
@@ -1471,8 +1727,19 @@ sort_dynamic_relocs_64 (const void *arg1, const void *arg2)
(*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));
+ if (ELF64_R_SYM (int_reloc1[0].r_info) < ELF64_R_SYM (int_reloc2[0].r_info))
+ return -1;
+ if (ELF64_R_SYM (int_reloc1[0].r_info) > ELF64_R_SYM (int_reloc2[0].r_info))
+ return 1;
+
+ if (int_reloc1[0].r_offset < int_reloc2[0].r_offset)
+ return -1;
+ if (int_reloc1[0].r_offset > int_reloc2[0].r_offset)
+ return 1;
+ return 0;
+#else
+ abort ();
+#endif
}
@@ -1502,10 +1769,11 @@ mips_elf_output_extsym (struct mips_elf_link_hash_entry *h, void *data)
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)
+ else if ((h->root.def_dynamic
+ || h->root.ref_dynamic
+ || h->root.type == bfd_link_hash_new)
+ && !h->root.def_regular
+ && !h->root.ref_regular)
strip = TRUE;
else if (einfo->info->strip == strip_all
|| (einfo->info->strip == strip_some
@@ -1623,7 +1891,7 @@ mips_elf_output_extsym (struct mips_elf_link_hash_entry *h, void *data)
else
h->esym.asym.value = 0;
}
- else if ((h->root.elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT) != 0)
+ else if (h->root.needs_plt)
{
struct mips_elf_link_hash_entry *hd = h;
bfd_boolean no_fn_stub = h->no_fn_stub;
@@ -1651,9 +1919,6 @@ mips_elf_output_extsym (struct mips_elf_link_hash_entry *h, void *data)
else
h->esym.asym.value = 0;
}
-#if 0 /* FIXME? */
- h->esym.ifd = 0;
-#endif
}
}
@@ -1704,6 +1969,7 @@ mips_elf_got_entry_hash (const void *entry_)
const struct mips_got_entry *entry = (struct mips_got_entry *)entry_;
return entry->symndx
+ + ((entry->tls_type & GOT_TLS_LDM) << 17)
+ (! entry->abfd ? mips_elf_hash_bfd_vma (entry->d.address)
: entry->abfd->id
+ (entry->symndx >= 0 ? mips_elf_hash_bfd_vma (entry->d.addend)
@@ -1716,6 +1982,10 @@ 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;
+ /* An LDM entry can only match another LDM entry. */
+ if ((e1->tls_type ^ e2->tls_type) & GOT_TLS_LDM)
+ return 0;
+
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
@@ -1736,8 +2006,10 @@ mips_elf_multi_got_entry_hash (const void *entry_)
+ (! 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->tls_type & GOT_TLS_LDM)
+ ? (GOT_TLS_LDM << 17)
+ : (entry->abfd->id
+ + mips_elf_hash_bfd_vma (entry->d.addend)))
: entry->d.h->root.root.root.hash);
}
@@ -1747,6 +2019,14 @@ 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;
+ /* Any two LDM entries match. */
+ if (e1->tls_type & e2->tls_type & GOT_TLS_LDM)
+ return 1;
+
+ /* Nothing else matches an LDM entry. */
+ if ((e1->tls_type ^ e2->tls_type) & GOT_TLS_LDM)
+ return 0;
+
return e1->symndx == e2->symndx
&& (e1->symndx >= 0 ? e1->abfd == e2->abfd && e1->d.addend == e2->d.addend
: e1->abfd == NULL || e2->abfd == NULL
@@ -1754,26 +2034,30 @@ mips_elf_multi_got_entry_eq (const void *entry1, const void *entry2)
: e1->d.h == e2->d.h);
}
-/* Returns the dynamic relocation section for DYNOBJ. */
+/* Return the dynamic relocation section. If it doesn't exist, try to
+ create a new it if CREATE_P, otherwise return NULL. Also return NULL
+ if creation fails. */
static asection *
-mips_elf_rel_dyn_section (bfd *dynobj, bfd_boolean create_p)
+mips_elf_rel_dyn_section (struct bfd_link_info *info, bfd_boolean create_p)
{
- static const char dname[] = ".rel.dyn";
+ const char *dname;
asection *sreloc;
+ bfd *dynobj;
+ dname = MIPS_ELF_REL_DYN_NAME (info);
+ dynobj = elf_hash_table (info)->dynobj;
sreloc = bfd_get_section_by_name (dynobj, dname);
if (sreloc == NULL && create_p)
{
- sreloc = bfd_make_section (dynobj, dname);
+ sreloc = bfd_make_section_with_flags (dynobj, dname,
+ (SEC_ALLOC
+ | SEC_LOAD
+ | SEC_HAS_CONTENTS
+ | SEC_IN_MEMORY
+ | SEC_LINKER_CREATED
+ | SEC_READONLY));
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;
@@ -1815,35 +2099,329 @@ mips_elf_got_info (bfd *abfd, asection **sgotp)
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)
+/* Count the number of relocations needed for a TLS GOT entry, with
+ access types from TLS_TYPE, and symbol H (or a local symbol if H
+ is NULL). */
+
+static int
+mips_tls_got_relocs (struct bfd_link_info *info, unsigned char tls_type,
+ struct elf_link_hash_entry *h)
{
- asection *sgot;
- struct mips_got_info *g;
+ int indx = 0;
+ int ret = 0;
+ bfd_boolean need_relocs = FALSE;
+ bfd_boolean dyn = elf_hash_table (info)->dynamic_sections_created;
- if (abfd == NULL)
- return 0;
+ if (h && WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, info->shared, h)
+ && (!info->shared || !SYMBOL_REFERENCES_LOCAL (info, h)))
+ indx = h->dynindx;
- sgot = mips_elf_got_section (abfd, TRUE);
- if (sgot == NULL || mips_elf_section_data (sgot) == NULL)
- return 0;
+ if ((info->shared || indx != 0)
+ && (h == NULL
+ || ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
+ || h->root.type != bfd_link_hash_undefweak))
+ need_relocs = TRUE;
- g = mips_elf_section_data (sgot)->u.got_info;
- if (g == NULL || g->global_gotsym == NULL)
- return 0;
+ if (!need_relocs)
+ return FALSE;
+
+ if (tls_type & GOT_TLS_GD)
+ {
+ ret++;
+ if (indx != 0)
+ ret++;
+ }
+
+ if (tls_type & GOT_TLS_IE)
+ ret++;
+
+ if ((tls_type & GOT_TLS_LDM) && info->shared)
+ ret++;
+
+ return ret;
+}
+
+/* Count the number of TLS relocations required for the GOT entry in
+ ARG1, if it describes a local symbol. */
+
+static int
+mips_elf_count_local_tls_relocs (void **arg1, void *arg2)
+{
+ struct mips_got_entry *entry = * (struct mips_got_entry **) arg1;
+ struct mips_elf_count_tls_arg *arg = arg2;
+
+ if (entry->abfd != NULL && entry->symndx != -1)
+ arg->needed += mips_tls_got_relocs (arg->info, entry->tls_type, NULL);
+
+ return 1;
+}
+
+/* Count the number of TLS GOT entries required for the global (or
+ forced-local) symbol in ARG1. */
+
+static int
+mips_elf_count_global_tls_entries (void *arg1, void *arg2)
+{
+ struct mips_elf_link_hash_entry *hm
+ = (struct mips_elf_link_hash_entry *) arg1;
+ struct mips_elf_count_tls_arg *arg = arg2;
+
+ if (hm->tls_type & GOT_TLS_GD)
+ arg->needed += 2;
+ if (hm->tls_type & GOT_TLS_IE)
+ arg->needed += 1;
+
+ return 1;
+}
+
+/* Count the number of TLS relocations required for the global (or
+ forced-local) symbol in ARG1. */
+
+static int
+mips_elf_count_global_tls_relocs (void *arg1, void *arg2)
+{
+ struct mips_elf_link_hash_entry *hm
+ = (struct mips_elf_link_hash_entry *) arg1;
+ struct mips_elf_count_tls_arg *arg = arg2;
+
+ arg->needed += mips_tls_got_relocs (arg->info, hm->tls_type, &hm->root);
+
+ return 1;
+}
+
+/* Output a simple dynamic relocation into SRELOC. */
+
+static void
+mips_elf_output_dynamic_relocation (bfd *output_bfd,
+ asection *sreloc,
+ unsigned long indx,
+ int r_type,
+ bfd_vma offset)
+{
+ Elf_Internal_Rela rel[3];
+
+ memset (rel, 0, sizeof (rel));
- return g->global_gotsym->dynindx;
+ rel[0].r_info = ELF_R_INFO (output_bfd, indx, r_type);
+ rel[0].r_offset = rel[1].r_offset = rel[2].r_offset = offset;
+
+ if (ABI_64_P (output_bfd))
+ {
+ (*get_elf_backend_data (output_bfd)->s->swap_reloc_out)
+ (output_bfd, &rel[0],
+ (sreloc->contents
+ + sreloc->reloc_count * sizeof (Elf64_Mips_External_Rel)));
+ }
+ else
+ bfd_elf32_swap_reloc_out
+ (output_bfd, &rel[0],
+ (sreloc->contents
+ + sreloc->reloc_count * sizeof (Elf32_External_Rel)));
+ ++sreloc->reloc_count;
+}
+
+/* Initialize a set of TLS GOT entries for one symbol. */
+
+static void
+mips_elf_initialize_tls_slots (bfd *abfd, bfd_vma got_offset,
+ unsigned char *tls_type_p,
+ struct bfd_link_info *info,
+ struct mips_elf_link_hash_entry *h,
+ bfd_vma value)
+{
+ int indx;
+ asection *sreloc, *sgot;
+ bfd_vma offset, offset2;
+ bfd *dynobj;
+ bfd_boolean need_relocs = FALSE;
+
+ dynobj = elf_hash_table (info)->dynobj;
+ sgot = mips_elf_got_section (dynobj, FALSE);
+
+ indx = 0;
+ if (h != NULL)
+ {
+ bfd_boolean dyn = elf_hash_table (info)->dynamic_sections_created;
+
+ if (WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, info->shared, &h->root)
+ && (!info->shared || !SYMBOL_REFERENCES_LOCAL (info, &h->root)))
+ indx = h->root.dynindx;
+ }
+
+ if (*tls_type_p & GOT_TLS_DONE)
+ return;
+
+ if ((info->shared || indx != 0)
+ && (h == NULL
+ || ELF_ST_VISIBILITY (h->root.other) == STV_DEFAULT
+ || h->root.type != bfd_link_hash_undefweak))
+ need_relocs = TRUE;
+
+ /* MINUS_ONE means the symbol is not defined in this object. It may not
+ be defined at all; assume that the value doesn't matter in that
+ case. Otherwise complain if we would use the value. */
+ BFD_ASSERT (value != MINUS_ONE || (indx != 0 && need_relocs)
+ || h->root.root.type == bfd_link_hash_undefweak);
+
+ /* Emit necessary relocations. */
+ sreloc = mips_elf_rel_dyn_section (info, FALSE);
+
+ /* General Dynamic. */
+ if (*tls_type_p & GOT_TLS_GD)
+ {
+ offset = got_offset;
+ offset2 = offset + MIPS_ELF_GOT_SIZE (abfd);
+
+ if (need_relocs)
+ {
+ mips_elf_output_dynamic_relocation
+ (abfd, sreloc, indx,
+ ABI_64_P (abfd) ? R_MIPS_TLS_DTPMOD64 : R_MIPS_TLS_DTPMOD32,
+ sgot->output_offset + sgot->output_section->vma + offset);
+
+ if (indx)
+ mips_elf_output_dynamic_relocation
+ (abfd, sreloc, indx,
+ ABI_64_P (abfd) ? R_MIPS_TLS_DTPREL64 : R_MIPS_TLS_DTPREL32,
+ sgot->output_offset + sgot->output_section->vma + offset2);
+ else
+ MIPS_ELF_PUT_WORD (abfd, value - dtprel_base (info),
+ sgot->contents + offset2);
+ }
+ else
+ {
+ MIPS_ELF_PUT_WORD (abfd, 1,
+ sgot->contents + offset);
+ MIPS_ELF_PUT_WORD (abfd, value - dtprel_base (info),
+ sgot->contents + offset2);
+ }
+
+ got_offset += 2 * MIPS_ELF_GOT_SIZE (abfd);
+ }
+
+ /* Initial Exec model. */
+ if (*tls_type_p & GOT_TLS_IE)
+ {
+ offset = got_offset;
+
+ if (need_relocs)
+ {
+ if (indx == 0)
+ MIPS_ELF_PUT_WORD (abfd, value - elf_hash_table (info)->tls_sec->vma,
+ sgot->contents + offset);
+ else
+ MIPS_ELF_PUT_WORD (abfd, 0,
+ sgot->contents + offset);
+
+ mips_elf_output_dynamic_relocation
+ (abfd, sreloc, indx,
+ ABI_64_P (abfd) ? R_MIPS_TLS_TPREL64 : R_MIPS_TLS_TPREL32,
+ sgot->output_offset + sgot->output_section->vma + offset);
+ }
+ else
+ MIPS_ELF_PUT_WORD (abfd, value - tprel_base (info),
+ sgot->contents + offset);
+ }
+
+ if (*tls_type_p & GOT_TLS_LDM)
+ {
+ /* The initial offset is zero, and the LD offsets will include the
+ bias by DTP_OFFSET. */
+ MIPS_ELF_PUT_WORD (abfd, 0,
+ sgot->contents + got_offset
+ + MIPS_ELF_GOT_SIZE (abfd));
+
+ if (!info->shared)
+ MIPS_ELF_PUT_WORD (abfd, 1,
+ sgot->contents + got_offset);
+ else
+ mips_elf_output_dynamic_relocation
+ (abfd, sreloc, indx,
+ ABI_64_P (abfd) ? R_MIPS_TLS_DTPMOD64 : R_MIPS_TLS_DTPMOD32,
+ sgot->output_offset + sgot->output_section->vma + got_offset);
+ }
+
+ *tls_type_p |= GOT_TLS_DONE;
+}
+
+/* Return the GOT index to use for a relocation of type R_TYPE against
+ a symbol accessed using TLS_TYPE models. The GOT entries for this
+ symbol in this GOT start at GOT_INDEX. This function initializes the
+ GOT entries and corresponding relocations. */
+
+static bfd_vma
+mips_tls_got_index (bfd *abfd, bfd_vma got_index, unsigned char *tls_type,
+ int r_type, struct bfd_link_info *info,
+ struct mips_elf_link_hash_entry *h, bfd_vma symbol)
+{
+ BFD_ASSERT (r_type == R_MIPS_TLS_GOTTPREL || r_type == R_MIPS_TLS_GD
+ || r_type == R_MIPS_TLS_LDM);
+
+ mips_elf_initialize_tls_slots (abfd, got_index, tls_type, info, h, symbol);
+
+ if (r_type == R_MIPS_TLS_GOTTPREL)
+ {
+ BFD_ASSERT (*tls_type & GOT_TLS_IE);
+ if (*tls_type & GOT_TLS_GD)
+ return got_index + 2 * MIPS_ELF_GOT_SIZE (abfd);
+ else
+ return got_index;
+ }
+
+ if (r_type == R_MIPS_TLS_GD)
+ {
+ BFD_ASSERT (*tls_type & GOT_TLS_GD);
+ return got_index;
+ }
+
+ if (r_type == R_MIPS_TLS_LDM)
+ {
+ BFD_ASSERT (*tls_type & GOT_TLS_LDM);
+ return got_index;
+ }
+
+ return got_index;
+}
+
+/* Return the offset from _GLOBAL_OFFSET_TABLE_ of the .got.plt entry
+ for global symbol H. .got.plt comes before the GOT, so the offset
+ will be negative. */
+
+static bfd_vma
+mips_elf_gotplt_index (struct bfd_link_info *info,
+ struct elf_link_hash_entry *h)
+{
+ bfd_vma plt_index, got_address, got_value;
+ struct mips_elf_link_hash_table *htab;
+
+ htab = mips_elf_hash_table (info);
+ BFD_ASSERT (h->plt.offset != (bfd_vma) -1);
+
+ /* Calculate the index of the symbol's PLT entry. */
+ plt_index = (h->plt.offset - htab->plt_header_size) / htab->plt_entry_size;
+
+ /* Calculate the address of the associated .got.plt entry. */
+ got_address = (htab->sgotplt->output_section->vma
+ + htab->sgotplt->output_offset
+ + plt_index * 4);
+
+ /* Calculate the value of _GLOBAL_OFFSET_TABLE_. */
+ got_value = (htab->root.hgot->root.u.def.section->output_section->vma
+ + htab->root.hgot->root.u.def.section->output_offset
+ + htab->root.hgot->root.u.def.value);
+
+ return got_address - got_value;
}
-/* 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. */
+/* Return the GOT offset for address VALUE. If there is not yet a GOT
+ entry for this value, create one. If R_SYMNDX refers to a TLS symbol,
+ create a TLS GOT entry instead. Return -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)
+ bfd_vma value, unsigned long r_symndx,
+ struct mips_elf_link_hash_entry *h, int r_type)
{
asection *sgot;
struct mips_got_info *g;
@@ -1851,17 +2429,31 @@ mips_elf_local_got_index (bfd *abfd, bfd *ibfd, struct bfd_link_info *info,
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
+ entry = mips_elf_create_local_got_entry (abfd, info, ibfd, g, sgot,
+ value, r_symndx, h, r_type);
+ if (!entry)
return MINUS_ONE;
+
+ if (TLS_RELOC_P (r_type))
+ {
+ if (entry->symndx == -1 && g->next == NULL)
+ /* A type (3) entry in the single-GOT case. We use the symbol's
+ hash table entry to track the index. */
+ return mips_tls_got_index (abfd, h->tls_got_offset, &h->tls_type,
+ r_type, info, h, value);
+ else
+ return mips_tls_got_index (abfd, entry->gotidx, &entry->tls_type,
+ r_type, info, h, value);
+ }
+ else
+ return entry->gotidx;
}
/* 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)
+mips_elf_global_got_index (bfd *abfd, bfd *ibfd, struct elf_link_hash_entry *h,
+ int r_type, struct bfd_link_info *info)
{
bfd_vma index;
asection *sgot;
@@ -1876,39 +2468,74 @@ mips_elf_global_got_index (bfd *abfd, bfd *ibfd, struct elf_link_hash_entry *h)
BFD_ASSERT (h->dynindx >= 0);
g = mips_elf_got_for_ibfd (g, ibfd);
- if (g->next != gg)
+ if (g->next != gg || TLS_RELOC_P (r_type))
{
e.abfd = ibfd;
e.symndx = -1;
e.d.h = (struct mips_elf_link_hash_entry *)h;
+ e.tls_type = 0;
p = htab_find (g->got_entries, &e);
BFD_ASSERT (p->gotidx > 0);
- return p->gotidx;
+
+ if (TLS_RELOC_P (r_type))
+ {
+ bfd_vma value = MINUS_ONE;
+ if ((h->root.type == bfd_link_hash_defined
+ || h->root.type == bfd_link_hash_defweak)
+ && h->root.u.def.section->output_section)
+ value = (h->root.u.def.value
+ + h->root.u.def.section->output_offset
+ + h->root.u.def.section->output_section->vma);
+
+ return mips_tls_got_index (abfd, p->gotidx, &p->tls_type, r_type,
+ info, e.d.h, value);
+ }
+ else
+ 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);
+ if (TLS_RELOC_P (r_type))
+ {
+ struct mips_elf_link_hash_entry *hm
+ = (struct mips_elf_link_hash_entry *) h;
+ bfd_vma value = MINUS_ONE;
+
+ if ((h->root.type == bfd_link_hash_defined
+ || h->root.type == bfd_link_hash_defweak)
+ && h->root.u.def.section->output_section)
+ value = (h->root.u.def.value
+ + h->root.u.def.section->output_offset
+ + h->root.u.def.section->output_section->vma);
+
+ index = mips_tls_got_index (abfd, hm->tls_got_offset, &hm->tls_type,
+ r_type, info, hm, value);
+ }
+ else
+ {
+ /* 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->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. */
+/* Find a GOT page entry that points to within 32KB of VALUE. These
+ entries are supposed to be placed at small offsets in the GOT, i.e.,
+ within 32KB of GP. Return the index of the GOT entry, or -1 if no
+ entry could be created. If OFFSETP is nonnull, use it to return the
+ offset of the GOT entry from VALUE. */
static bfd_vma
mips_elf_got_page (bfd *abfd, bfd *ibfd, struct bfd_link_info *info,
@@ -1916,14 +2543,14 @@ mips_elf_got_page (bfd *abfd, bfd *ibfd, struct bfd_link_info *info,
{
asection *sgot;
struct mips_got_info *g;
- bfd_vma index;
+ bfd_vma page, 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));
+ page = (value + 0x8000) & ~(bfd_vma) 0xffff;
+ entry = mips_elf_create_local_got_entry (abfd, info, ibfd, g, sgot,
+ page, 0, NULL, R_MIPS_GOT_PAGE);
if (!entry)
return MINUS_ONE;
@@ -1936,8 +2563,9 @@ mips_elf_got_page (bfd *abfd, bfd *ibfd, struct bfd_link_info *info,
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. */
+/* Find a local GOT entry for an R_MIPS_GOT16 relocation against VALUE.
+ EXTERNAL is true if the relocation was against a global symbol
+ that has been forced local. */
static bfd_vma
mips_elf_got16_entry (bfd *abfd, bfd *ibfd, struct bfd_link_info *info,
@@ -1947,18 +2575,17 @@ mips_elf_got16_entry (bfd *abfd, bfd *ibfd, struct bfd_link_info *info,
struct mips_got_info *g;
struct mips_got_entry *entry;
+ /* GOT16 relocations against local symbols are followed by a LO16
+ relocation; those against global symbols are not. Thus if the
+ symbol was originally local, the GOT16 relocation should load the
+ equivalent of %hi(VALUE), otherwise it should load VALUE itself. */
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;
- }
+ 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);
+ entry = mips_elf_create_local_got_entry (abfd, info, ibfd, g, sgot,
+ value, 0, NULL, R_MIPS_GOT16);
if (entry)
return entry->gotidx;
else
@@ -1983,20 +2610,29 @@ mips_elf_got_offset_from_index (bfd *dynobj, bfd *output_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. */
+/* Create and return a local GOT entry for VALUE, which was calculated
+ from a symbol belonging to INPUT_SECTON. Return NULL if it could not
+ be created. If R_SYMNDX refers to a TLS symbol, create a TLS entry
+ instead. */
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)
+mips_elf_create_local_got_entry (bfd *abfd, struct bfd_link_info *info,
+ bfd *ibfd, struct mips_got_info *gg,
+ asection *sgot, bfd_vma value,
+ unsigned long r_symndx,
+ struct mips_elf_link_hash_entry *h,
+ int r_type)
{
struct mips_got_entry entry, **loc;
struct mips_got_info *g;
+ struct mips_elf_link_hash_table *htab;
+
+ htab = mips_elf_hash_table (info);
entry.abfd = NULL;
entry.symndx = -1;
entry.d.address = value;
+ entry.tls_type = 0;
g = mips_elf_got_for_ibfd (gg, ibfd);
if (g == NULL)
@@ -2005,12 +2641,44 @@ mips_elf_create_local_got_entry (bfd *abfd, bfd *ibfd,
BFD_ASSERT (g != NULL);
}
+ /* We might have a symbol, H, if it has been forced local. Use the
+ global entry then. It doesn't matter whether an entry is local
+ or global for TLS, since the dynamic linker does not
+ automatically relocate TLS GOT entries. */
+ BFD_ASSERT (h == NULL || h->root.forced_local);
+ if (TLS_RELOC_P (r_type))
+ {
+ struct mips_got_entry *p;
+
+ entry.abfd = ibfd;
+ if (r_type == R_MIPS_TLS_LDM)
+ {
+ entry.tls_type = GOT_TLS_LDM;
+ entry.symndx = 0;
+ entry.d.addend = 0;
+ }
+ else if (h == NULL)
+ {
+ entry.symndx = r_symndx;
+ entry.d.addend = 0;
+ }
+ else
+ entry.d.h = h;
+
+ p = (struct mips_got_entry *)
+ htab_find (g->got_entries, &entry);
+
+ BFD_ASSERT (p);
+ return p;
+ }
+
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++;
+ entry.tls_type = 0;
*loc = (struct mips_got_entry *)bfd_alloc (abfd, sizeof entry);
@@ -2032,6 +2700,26 @@ mips_elf_create_local_got_entry (bfd *abfd, bfd *ibfd,
MIPS_ELF_PUT_WORD (abfd, value,
(sgot->contents + entry.gotidx));
+ /* These GOT entries need a dynamic relocation on VxWorks. */
+ if (htab->is_vxworks)
+ {
+ Elf_Internal_Rela outrel;
+ asection *s;
+ bfd_byte *loc;
+ bfd_vma got_address;
+
+ s = mips_elf_rel_dyn_section (info, FALSE);
+ got_address = (sgot->output_section->vma
+ + sgot->output_offset
+ + entry.gotidx);
+
+ loc = s->contents + (s->reloc_count++ * sizeof (Elf32_External_Rela));
+ outrel.r_offset = got_address;
+ outrel.r_info = ELF32_R_INFO (STN_UNDEF, R_MIPS_32);
+ outrel.r_addend = value;
+ bfd_elf32_swap_reloca_out (abfd, &outrel, loc);
+ }
+
return *loc;
}
@@ -2106,6 +2794,8 @@ mips_elf_sort_hash_table_f (struct mips_elf_link_hash_entry *h, void *data)
-1. */
if (h->root.got.offset == 2)
{
+ BFD_ASSERT (h->tls_type == GOT_NORMAL);
+
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++;
@@ -2114,6 +2804,8 @@ mips_elf_sort_hash_table_f (struct mips_elf_link_hash_entry *h, void *data)
h->root.dynindx = hsd->max_non_got_dynindx++;
else
{
+ BFD_ASSERT (h->tls_type == GOT_NORMAL);
+
h->root.dynindx = --hsd->min_got_dynindx;
hsd->low = (struct elf_link_hash_entry *) h;
}
@@ -2128,7 +2820,8 @@ mips_elf_sort_hash_table_f (struct mips_elf_link_hash_entry *h, void *data)
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_info *g,
+ unsigned char tls_flag)
{
struct mips_got_entry entry, **loc;
@@ -2147,9 +2840,13 @@ mips_elf_record_global_got_symbol (struct elf_link_hash_entry *h,
return FALSE;
}
+ /* Make sure we have a GOT to put this entry into. */
+ BFD_ASSERT (g != NULL);
+
entry.abfd = abfd;
entry.symndx = -1;
entry.d.h = (struct mips_elf_link_hash_entry *) h;
+ entry.tls_type = 0;
loc = (struct mips_got_entry **) htab_find_slot (g->got_entries, &entry,
INSERT);
@@ -2157,7 +2854,10 @@ mips_elf_record_global_got_symbol (struct elf_link_hash_entry *h,
/* If we've already marked this entry as needing GOT space, we don't
need to do it again. */
if (*loc)
- return TRUE;
+ {
+ (*loc)->tls_type |= tls_flag;
+ return TRUE;
+ }
*loc = (struct mips_got_entry *)bfd_alloc (abfd, sizeof entry);
@@ -2165,6 +2865,8 @@ mips_elf_record_global_got_symbol (struct elf_link_hash_entry *h,
return FALSE;
entry.gotidx = -1;
+ entry.tls_type = tls_flag;
+
memcpy (*loc, &entry, sizeof entry);
if (h->got.offset != MINUS_ONE)
@@ -2173,7 +2875,8 @@ mips_elf_record_global_got_symbol (struct elf_link_hash_entry *h,
/* 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;
+ if (tls_flag == 0)
+ h->got.offset = 1;
return TRUE;
}
@@ -2183,20 +2886,52 @@ mips_elf_record_global_got_symbol (struct elf_link_hash_entry *h,
static bfd_boolean
mips_elf_record_local_got_symbol (bfd *abfd, long symndx, bfd_vma addend,
- struct mips_got_info *g)
+ struct mips_got_info *g,
+ unsigned char tls_flag)
{
struct mips_got_entry entry, **loc;
entry.abfd = abfd;
entry.symndx = symndx;
entry.d.addend = addend;
+ entry.tls_type = tls_flag;
loc = (struct mips_got_entry **)
htab_find_slot (g->got_entries, &entry, INSERT);
if (*loc)
- return TRUE;
+ {
+ if (tls_flag == GOT_TLS_GD && !((*loc)->tls_type & GOT_TLS_GD))
+ {
+ g->tls_gotno += 2;
+ (*loc)->tls_type |= tls_flag;
+ }
+ else if (tls_flag == GOT_TLS_IE && !((*loc)->tls_type & GOT_TLS_IE))
+ {
+ g->tls_gotno += 1;
+ (*loc)->tls_type |= tls_flag;
+ }
+ return TRUE;
+ }
- entry.gotidx = g->local_gotno++;
+ if (tls_flag != 0)
+ {
+ entry.gotidx = -1;
+ entry.tls_type = tls_flag;
+ if (tls_flag == GOT_TLS_IE)
+ g->tls_gotno += 1;
+ else if (tls_flag == GOT_TLS_GD)
+ g->tls_gotno += 2;
+ else if (g->tls_ldm_offset == MINUS_ONE)
+ {
+ g->tls_ldm_offset = MINUS_TWO;
+ g->tls_gotno += 2;
+ }
+ }
+ else
+ {
+ entry.gotidx = g->local_gotno++;
+ entry.tls_type = 0;
+ }
*loc = (struct mips_got_entry *)bfd_alloc (abfd, sizeof entry);
@@ -2232,7 +2967,7 @@ mips_elf_bfd2got_entry_eq (const void *entry1, const void *entry2)
return e1->bfd == e2->bfd;
}
-/* In a multi-got link, determine the GOT to be used for IBDF. G must
+/* In a multi-got link, determine the GOT to be used for IBFD. G must
be the master GOT data. */
static struct mips_got_info *
@@ -2296,6 +3031,9 @@ mips_elf_make_got_per_bfd (void **entryp, void *p)
g->global_gotno = 0;
g->local_gotno = 0;
g->assigned_gotno = -1;
+ g->tls_gotno = 0;
+ g->tls_assigned_gotno = 0;
+ g->tls_ldm_offset = MINUS_ONE;
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)
@@ -2315,7 +3053,14 @@ mips_elf_make_got_per_bfd (void **entryp, void *p)
*entryp = entry;
- if (entry->symndx >= 0 || entry->d.h->forced_local)
+ if (entry->tls_type)
+ {
+ if (entry->tls_type & (GOT_TLS_GD | GOT_TLS_LDM))
+ g->tls_gotno += 2;
+ if (entry->tls_type & GOT_TLS_IE)
+ g->tls_gotno += 1;
+ }
+ else if (entry->symndx >= 0 || entry->d.h->forced_local)
++g->local_gotno;
else
++g->global_gotno;
@@ -2338,11 +3083,25 @@ mips_elf_merge_gots (void **bfd2got_, void *p)
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 tcount = bfd2got->g->tls_gotno;
unsigned int maxcnt = arg->max_count;
+ bfd_boolean too_many_for_tls = FALSE;
+
+ /* We place TLS GOT entries after both locals and globals. The globals
+ for the primary GOT may overflow the normal GOT size limit, so be
+ sure not to merge a GOT which requires TLS with the primary GOT in that
+ case. This doesn't affect non-primary GOTs. */
+ if (tcount > 0)
+ {
+ unsigned int primary_total = lcount + tcount + arg->global_count;
+ if (primary_total > maxcnt)
+ too_many_for_tls = TRUE;
+ }
/* 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)
+ if (! arg->primary && lcount + gcount + tcount <= maxcnt
+ && ! too_many_for_tls)
{
arg->primary = bfd2got->g;
arg->primary_count = lcount + gcount;
@@ -2350,12 +3109,13 @@ mips_elf_merge_gots (void **bfd2got_, void *p)
/* 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)
+ else if (arg->primary && ! too_many_for_tls
+ && (arg->primary_count + lcount + gcount + tcount) <= maxcnt)
{
struct mips_got_info *g = bfd2got->g;
int old_lcount = arg->primary->local_gotno;
int old_gcount = arg->primary->global_gotno;
+ int old_tcount = arg->primary->tls_gotno;
bfd2got->g = arg->primary;
@@ -2372,17 +3132,19 @@ mips_elf_merge_gots (void **bfd2got_, void *p)
BFD_ASSERT (old_lcount + lcount >= arg->primary->local_gotno);
BFD_ASSERT (old_gcount + gcount >= arg->primary->global_gotno);
+ BFD_ASSERT (old_tcount + tcount >= arg->primary->tls_gotno);
arg->primary_count = arg->primary->local_gotno
- + arg->primary->global_gotno;
+ + arg->primary->global_gotno + arg->primary->tls_gotno;
}
/* If we can merge with the last-created got, do it. */
else if (arg->current
- && arg->current_count + lcount + gcount <= maxcnt)
+ && arg->current_count + lcount + gcount + tcount <= maxcnt)
{
struct mips_got_info *g = bfd2got->g;
int old_lcount = arg->current->local_gotno;
int old_gcount = arg->current->global_gotno;
+ int old_tcount = arg->current->tls_gotno;
bfd2got->g = arg->current;
@@ -2396,9 +3158,10 @@ mips_elf_merge_gots (void **bfd2got_, void *p)
BFD_ASSERT (old_lcount + lcount >= arg->current->local_gotno);
BFD_ASSERT (old_gcount + gcount >= arg->current->global_gotno);
+ BFD_ASSERT (old_tcount + tcount >= arg->current->tls_gotno);
arg->current_count = arg->current->local_gotno
- + arg->current->global_gotno;
+ + arg->current->global_gotno + arg->current->tls_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
@@ -2408,12 +3171,66 @@ mips_elf_merge_gots (void **bfd2got_, void *p)
bfd2got->g->next = arg->current;
arg->current = bfd2got->g;
- arg->current_count = lcount + gcount;
+ arg->current_count = lcount + gcount + 2 * tcount;
}
return 1;
}
+/* Set the TLS GOT index for the GOT entry in ENTRYP. ENTRYP's NEXT field
+ is null iff there is just a single GOT. */
+
+static int
+mips_elf_initialize_tls_index (void **entryp, void *p)
+{
+ struct mips_got_entry *entry = (struct mips_got_entry *)*entryp;
+ struct mips_got_info *g = p;
+ bfd_vma next_index;
+ unsigned char tls_type;
+
+ /* We're only interested in TLS symbols. */
+ if (entry->tls_type == 0)
+ return 1;
+
+ next_index = MIPS_ELF_GOT_SIZE (entry->abfd) * (long) g->tls_assigned_gotno;
+
+ if (entry->symndx == -1 && g->next == NULL)
+ {
+ /* A type (3) got entry in the single-GOT case. We use the symbol's
+ hash table entry to track its index. */
+ if (entry->d.h->tls_type & GOT_TLS_OFFSET_DONE)
+ return 1;
+ entry->d.h->tls_type |= GOT_TLS_OFFSET_DONE;
+ entry->d.h->tls_got_offset = next_index;
+ tls_type = entry->d.h->tls_type;
+ }
+ else
+ {
+ if (entry->tls_type & GOT_TLS_LDM)
+ {
+ /* There are separate mips_got_entry objects for each input bfd
+ that requires an LDM entry. Make sure that all LDM entries in
+ a GOT resolve to the same index. */
+ if (g->tls_ldm_offset != MINUS_TWO && g->tls_ldm_offset != MINUS_ONE)
+ {
+ entry->gotidx = g->tls_ldm_offset;
+ return 1;
+ }
+ g->tls_ldm_offset = next_index;
+ }
+ entry->gotidx = next_index;
+ tls_type = entry->tls_type;
+ }
+
+ /* Account for the entries we've just allocated. */
+ if (tls_type & (GOT_TLS_GD | GOT_TLS_LDM))
+ g->tls_assigned_gotno += 2;
+ if (tls_type & GOT_TLS_IE)
+ g->tls_assigned_gotno += 1;
+
+ 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.
@@ -2435,8 +3252,14 @@ mips_elf_set_global_got_offset (void **entryp, void *p)
= (struct mips_elf_set_global_got_offset_arg *)p;
struct mips_got_info *g = arg->g;
+ if (g && entry->tls_type != GOT_NORMAL)
+ arg->needed_relocs +=
+ mips_tls_got_relocs (arg->info, entry->tls_type,
+ entry->symndx == -1 ? &entry->d.h->root : NULL);
+
if (entry->abfd != NULL && entry->symndx == -1
- && entry->d.h->root.dynindx != -1)
+ && entry->d.h->root.dynindx != -1
+ && entry->d.h->tls_type == GOT_NORMAL)
{
if (g)
{
@@ -2445,10 +3268,8 @@ mips_elf_set_global_got_offset (void **entryp, void *p)
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)))
+ && entry->d.h->root.def_dynamic
+ && !entry->d.h->root.def_regular))
++arg->needed_relocs;
}
else
@@ -2553,7 +3374,8 @@ mips_elf_adjust_gp (bfd *abfd, struct mips_got_info *g, bfd *ibfd)
g = g->next;
- return (g->local_gotno + g->global_gotno) * MIPS_ELF_GOT_SIZE (abfd);
+ return (g->local_gotno + g->global_gotno + g->tls_gotno)
+ * MIPS_ELF_GOT_SIZE (abfd);
}
/* Turn a single GOT that is too big for 16-bit addressing into
@@ -2580,7 +3402,6 @@ mips_elf_multi_got (bfd *abfd, struct bfd_link_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;
@@ -2590,9 +3411,13 @@ mips_elf_multi_got (bfd *abfd, struct bfd_link_info *info,
/* 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)
+ got_per_bfd_arg.max_count = ((MIPS_ELF_GOT_MAX_SIZE (info)
/ MIPS_ELF_GOT_SIZE (abfd))
- - MIPS_RESERVED_GOTNO - pages);
+ - MIPS_RESERVED_GOTNO (info) - pages);
+ /* The number of globals that will be included in the primary GOT.
+ See the calls to mips_elf_set_global_got_offset below for more
+ information. */
+ got_per_bfd_arg.global_count = g->global_gotno;
/* 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
@@ -2601,7 +3426,7 @@ mips_elf_multi_got (bfd *abfd, struct bfd_link_info *info,
if (got_per_bfd_arg.obfd == NULL)
return FALSE;
- /* If we find any suitable primary GOT, create an empty one. */
+ /* If we do not find any suitable primary GOT, create an empty one. */
if (got_per_bfd_arg.primary == NULL)
{
g->next = (struct mips_got_info *)
@@ -2612,7 +3437,10 @@ mips_elf_multi_got (bfd *abfd, struct bfd_link_info *info,
g->next->global_gotsym = NULL;
g->next->global_gotno = 0;
g->next->local_gotno = 0;
+ g->next->tls_gotno = 0;
g->next->assigned_gotno = 0;
+ g->next->tls_assigned_gotno = 0;
+ g->next->tls_ldm_offset = MINUS_ONE;
g->next->got_entries = htab_try_create (1, mips_elf_multi_got_entry_hash,
mips_elf_multi_got_entry_eq,
NULL);
@@ -2712,6 +3540,7 @@ mips_elf_multi_got (bfd *abfd, struct bfd_link_info *info,
points back to the master GOT. */
gg->local_gotno = -g->global_gotno;
gg->global_gotno = g->global_gotno;
+ gg->tls_gotno = 0;
assign = 0;
gg->next = gg;
@@ -2719,16 +3548,24 @@ mips_elf_multi_got (bfd *abfd, struct bfd_link_info *info,
{
struct mips_got_info *gn;
- assign += MIPS_RESERVED_GOTNO;
+ assign += MIPS_RESERVED_GOTNO (info);
g->assigned_gotno = assign;
g->local_gotno += assign + pages;
- assign = g->local_gotno + g->global_gotno;
+ assign = g->local_gotno + g->global_gotno + g->tls_gotno;
/* Take g out of the direct list, and push it onto the reversed
- list that gg points to. */
+ list that gg points to. g->next is guaranteed to be nonnull after
+ this operation, as required by mips_elf_initialize_tls_index. */
gn = g->next;
g->next = gg->next;
gg->next = g;
+
+ /* Set up any TLS entries. We always place the TLS entries after
+ all non-TLS entries. */
+ g->tls_assigned_gotno = g->local_gotno + g->global_gotno;
+ htab_traverse (g->got_entries, mips_elf_initialize_tls_index, g);
+
+ /* Move onto the next GOT. It will be a secondary GOT if nonull. */
g = gn;
/* Mark global symbols in every non-primary GOT as ineligible for
@@ -2738,8 +3575,9 @@ mips_elf_multi_got (bfd *abfd, struct bfd_link_info *info,
}
while (g);
- got->_raw_size = (gg->next->local_gotno
- + gg->next->global_gotno) * MIPS_ELF_GOT_SIZE (abfd);
+ got->size = (gg->next->local_gotno
+ + gg->next->global_gotno
+ + gg->next->tls_gotno) * MIPS_ELF_GOT_SIZE (abfd);
return TRUE;
}
@@ -2753,22 +3591,18 @@ 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. */
+ unsigned long r_symndx = ELF_R_SYM (abfd, relocation->r_info);
+
while (relocation < relend)
{
- if (ELF_R_TYPE (abfd, relocation->r_info) == r_type)
+ if (ELF_R_TYPE (abfd, relocation->r_info) == r_type
+ && ELF_R_SYM (abfd, relocation->r_info) == r_symndx)
return relocation;
++relocation;
}
/* We didn't find it. */
- bfd_set_error (bfd_error_bad_value);
return NULL;
}
@@ -2804,7 +3638,7 @@ mips_elf_local_relocation_p (bfd *input_bfd,
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)
+ if (h->root.forced_local)
return TRUE;
}
@@ -2860,7 +3694,7 @@ mips_elf_higher (bfd_vma value ATTRIBUTE_UNUSED)
return ((value + (bfd_vma) 0x80008000) >> 32) & 0xffff;
#else
abort ();
- return (bfd_vma) -1;
+ return MINUS_ONE;
#endif
}
@@ -2873,7 +3707,7 @@ mips_elf_highest (bfd_vma value ATTRIBUTE_UNUSED)
return ((value + (((bfd_vma) 0x8000 << 32) | 0x80008000)) >> 48) & 0xffff;
#else
abort ();
- return (bfd_vma) -1;
+ return MINUS_ONE;
#endif
}
@@ -2891,14 +3725,13 @@ mips_elf_create_compact_rel_section
flags = (SEC_HAS_CONTENTS | SEC_IN_MEMORY | SEC_LINKER_CREATED
| SEC_READONLY);
- s = bfd_make_section (abfd, ".compact_rel");
+ s = bfd_make_section_with_flags (abfd, ".compact_rel", flags);
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);
+ s->size = sizeof (Elf32_External_compact_rel);
}
return TRUE;
@@ -2916,6 +3749,9 @@ mips_elf_create_got_section (bfd *abfd, struct bfd_link_info *info,
struct bfd_link_hash_entry *bh;
struct mips_got_info *g;
bfd_size_type amt;
+ struct mips_elf_link_hash_table *htab;
+
+ htab = mips_elf_hash_table (info);
/* This function may be called more than once. */
s = mips_elf_got_section (abfd, TRUE);
@@ -2934,9 +3770,8 @@ mips_elf_create_got_section (bfd *abfd, struct bfd_link_info *info,
/* 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");
+ s = bfd_make_section_with_flags (abfd, ".got", flags);
if (s == NULL
- || ! bfd_set_section_flags (abfd, s, flags)
|| ! bfd_set_section_alignment (abfd, s, 4))
return FALSE;
@@ -2950,9 +3785,10 @@ mips_elf_create_got_section (bfd *abfd, struct bfd_link_info *info,
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->non_elf = 0;
+ h->def_regular = 1;
h->type = STT_OBJECT;
+ elf_hash_table (info)->hgot = h;
if (info->shared
&& ! bfd_elf_link_record_dynamic_symbol (info, h))
@@ -2964,10 +3800,12 @@ mips_elf_create_got_section (bfd *abfd, struct bfd_link_info *info,
return FALSE;
g->global_gotsym = NULL;
g->global_gotno = 0;
- g->local_gotno = MIPS_RESERVED_GOTNO;
- g->assigned_gotno = MIPS_RESERVED_GOTNO;
+ g->tls_gotno = 0;
+ g->local_gotno = MIPS_RESERVED_GOTNO (info);
+ g->assigned_gotno = MIPS_RESERVED_GOTNO (info);
g->bfd2got = NULL;
g->next = NULL;
+ g->tls_ldm_offset = MINUS_ONE;
g->got_entries = htab_try_create (1, mips_elf_got_entry_hash,
mips_elf_got_entry_eq, NULL);
if (g->got_entries == NULL)
@@ -2976,9 +3814,33 @@ mips_elf_create_got_section (bfd *abfd, struct bfd_link_info *info,
mips_elf_section_data (s)->elf.this_hdr.sh_flags
|= SHF_ALLOC | SHF_WRITE | SHF_MIPS_GPREL;
+ /* VxWorks also needs a .got.plt section. */
+ if (htab->is_vxworks)
+ {
+ s = bfd_make_section_with_flags (abfd, ".got.plt",
+ SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS
+ | SEC_IN_MEMORY | SEC_LINKER_CREATED);
+ if (s == NULL || !bfd_set_section_alignment (abfd, s, 4))
+ return FALSE;
+
+ htab->sgotplt = s;
+ }
return TRUE;
}
+/* Return true if H refers to the special VxWorks __GOTT_BASE__ or
+ __GOTT_INDEX__ symbols. These symbols are only special for
+ shared objects; they are not used in executables. */
+
+static bfd_boolean
+is_gott_symbol (struct bfd_link_info *info, struct elf_link_hash_entry *h)
+{
+ return (mips_elf_hash_table (info)->is_vxworks
+ && info->shared
+ && (strcmp (h->root.root.string, "__GOTT_BASE__") == 0
+ || strcmp (h->root.root.string, "__GOTT_INDEX__") == 0));
+}
+
/* 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.
@@ -3029,6 +3891,9 @@ mips_elf_calculate_relocation (bfd *abfd, bfd *input_bfd,
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;
+ /* TRUE if the symbol referred to by this relocation is
+ "__gnu_local_gp". */
+ bfd_boolean gnu_local_gp_p = FALSE;
Elf_Internal_Shdr *symtab_hdr;
size_t extsymoff;
unsigned long r_symndx;
@@ -3038,6 +3903,11 @@ mips_elf_calculate_relocation (bfd *abfd, bfd *input_bfd,
bfd_boolean overflowed_p;
/* TRUE if this relocation refers to a MIPS16 function. */
bfd_boolean target_is_16_bit_code_p = FALSE;
+ struct mips_elf_link_hash_table *htab;
+ bfd *dynobj;
+
+ dynobj = elf_hash_table (info)->dynobj;
+ htab = mips_elf_hash_table (info);
/* Parse the relocation. */
r_symndx = ELF_R_SYM (input_bfd, relocation->r_info);
@@ -3119,11 +3989,18 @@ mips_elf_calculate_relocation (bfd *abfd, bfd *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)
+ if (r_type != R_MIPS_HI16 && r_type != R_MIPS_LO16
+ && r_type != R_MIPS16_HI16 && r_type != R_MIPS16_LO16)
return bfd_reloc_notsupported;
gp_disp_p = TRUE;
}
+ /* See if this is the special _gp symbol. Note that such a
+ symbol must always be a global symbol. */
+ else if (strcmp (*namep, "__gnu_local_gp") == 0)
+ gnu_local_gp_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
@@ -3149,8 +4026,8 @@ mips_elf_calculate_relocation (bfd *abfd, bfd *input_bfd,
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)
+ else if (strcmp (*namep, SGI_COMPAT (input_bfd)
+ ? "_DYNAMIC_LINK" : "_DYNAMIC_LINKING") == 0)
{
/* If this is a dynamic link, we should have created a
_DYNAMIC_LINK symbol or _DYNAMIC_LINKING(for normal mips) symbol
@@ -3162,6 +4039,17 @@ mips_elf_calculate_relocation (bfd *abfd, bfd *input_bfd,
BFD_ASSERT (bfd_get_section_by_name (abfd, ".dynamic") == NULL);
symbol = 0;
}
+ else if (ELF_MIPS_IS_OPTIONAL (h->root.other))
+ {
+ /* This is an optional symbol - an Irix specific extension to the
+ ELF spec. Ignore it for now.
+ XXX - FIXME - there is more to the spec for OPTIONAL symbols
+ than simply ignoring them, but we do not handle this for now.
+ For information see the "64-bit ELF Object File Specification"
+ which is available from here:
+ http://techpubs.sgi.com/library/manuals/4000/007-4658-001/pdf/007-4658-001.pdf */
+ symbol = 0;
+ }
else
{
if (! ((*info->callbacks->undefined_symbol)
@@ -3181,9 +4069,10 @@ mips_elf_calculate_relocation (bfd *abfd, bfd *input_bfd,
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
+ || (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))
+ && !mips16_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
@@ -3197,40 +4086,48 @@ mips_elf_calculate_relocation (bfd *abfd, bfd *input_bfd,
}
symbol = sec->output_section->vma + sec->output_offset;
+ /* The target is 16-bit, but the stub isn't. */
+ target_is_16_bit_code_p = FALSE;
}
/* 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)
+ && ((h != NULL && (h->call_stub != NULL || h->call_fp_stub != NULL))
+ || (local_p
+ && elf_tdata (input_bfd)->local_call_stubs != NULL
+ && elf_tdata (input_bfd)->local_call_stubs[r_symndx] != 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)
+ if (local_p)
+ sec = elf_tdata (input_bfd)->local_call_stubs[r_symndx];
+ else
{
- asection *o;
-
- sec = NULL;
- for (o = input_bfd->sections; o != NULL; o = o->next)
+ /* If both call_stub and call_fp_stub are defined, we can figure
+ out which one to use by checking which one appears in the input
+ file. */
+ if (h->call_stub != NULL && h->call_fp_stub != NULL)
{
- if (strncmp (bfd_get_section_name (input_bfd, o),
- CALL_FP_STUB, sizeof CALL_FP_STUB - 1) == 0)
+ asection *o;
+
+ sec = NULL;
+ for (o = input_bfd->sections; o != NULL; o = o->next)
{
- sec = h->call_fp_stub;
- break;
+ if (CALL_FP_STUB_P (bfd_get_section_name (input_bfd, o)))
+ {
+ sec = h->call_fp_stub;
+ break;
+ }
}
+ if (sec == NULL)
+ sec = h->call_stub;
}
- if (sec == NULL)
+ else if (h->call_stub != NULL)
sec = h->call_stub;
- }
- else if (h->call_stub != NULL)
- sec = h->call_stub;
- else
- sec = h->call_fp_stub;
+ else
+ sec = h->call_fp_stub;
+ }
- BFD_ASSERT (sec->_raw_size > 0);
+ BFD_ASSERT (sec->size > 0);
symbol = sec->output_section->vma + sec->output_offset;
}
@@ -3263,59 +4160,81 @@ mips_elf_calculate_relocation (bfd *abfd, bfd *input_bfd,
case R_MIPS_CALL_HI16:
case R_MIPS_GOT_LO16:
case R_MIPS_CALL_LO16:
+ case R_MIPS_TLS_GD:
+ case R_MIPS_TLS_GOTTPREL:
+ case R_MIPS_TLS_LDM:
/* 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)))
+ if (r_type == R_MIPS_TLS_LDM)
+ {
+ g = mips_elf_local_got_index (abfd, input_bfd, info,
+ 0, 0, NULL, r_type);
+ if (g == MINUS_ONE)
+ return bfd_reloc_outofrange;
+ }
+ else if (!local_p)
+ {
+ /* On VxWorks, CALL relocations should refer to the .got.plt
+ entry, which is initialized to point at the PLT stub. */
+ if (htab->is_vxworks
+ && (r_type == R_MIPS_CALL_HI16
+ || r_type == R_MIPS_CALL_LO16
+ || r_type == R_MIPS_CALL16))
{
- /* 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);
+ BFD_ASSERT (addend == 0);
+ BFD_ASSERT (h->root.needs_plt);
+ g = mips_elf_gotplt_index (info, &h->root);
+ }
+ else
+ {
+ /* 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 (dynobj, input_bfd,
+ &h->root, r_type, info);
+ if (h->tls_type == GOT_NORMAL
+ && (! elf_hash_table(info)->dynamic_sections_created
+ || (info->shared
+ && (info->symbolic || h->root.forced_local)
+ && h->root.def_regular)))
+ {
+ /* This is a static link or a -Bsymbolic link. The
+ symbol is defined locally, or was forced to be local.
+ We must initialize this entry in the GOT. */
+ asection *sgot = mips_elf_got_section (dynobj, FALSE);
+ MIPS_ELF_PUT_WORD (dynobj, 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. */
+ else if (!htab->is_vxworks
+ && (r_type == R_MIPS_CALL16 || (r_type == R_MIPS_GOT16)))
+ /* The calculation below does not involve "g". */
break;
else
{
- g = mips_elf_local_got_index (abfd, input_bfd,
- info, symbol + addend);
+ g = mips_elf_local_got_index (abfd, input_bfd, info,
+ symbol + addend, r_symndx, h, r_type);
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);
+ g = mips_elf_got_offset_from_index (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:
+ case R_MIPS16_HI16:
+ case R_MIPS16_LO16:
+ case R_MIPS16_GPREL:
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),
+ if (dynobj)
+ gp += mips_elf_adjust_gp (abfd, mips_elf_got_info (dynobj, NULL),
input_bfd);
break;
@@ -3323,6 +4242,37 @@ mips_elf_calculate_relocation (bfd *abfd, bfd *input_bfd,
break;
}
+ if (gnu_local_gp_p)
+ symbol = gp;
+
+ /* Relocations against the VxWorks __GOTT_BASE__ and __GOTT_INDEX__
+ symbols are resolved by the loader. Add them to .rela.dyn. */
+ if (h != NULL && is_gott_symbol (info, &h->root))
+ {
+ Elf_Internal_Rela outrel;
+ bfd_byte *loc;
+ asection *s;
+
+ s = mips_elf_rel_dyn_section (info, FALSE);
+ loc = s->contents + s->reloc_count++ * sizeof (Elf32_External_Rela);
+
+ outrel.r_offset = (input_section->output_section->vma
+ + input_section->output_offset
+ + relocation->r_offset);
+ outrel.r_info = ELF32_R_INFO (h->root.dynindx, r_type);
+ outrel.r_addend = addend;
+ bfd_elf32_swap_reloca_out (abfd, &outrel, loc);
+
+ /* If we've written this relocation for a readonly section,
+ we need to set DF_TEXTREL again, so that we do not delete the
+ DT_TEXTREL tag. */
+ if (MIPS_ELF_READONLY_SECTION (input_section))
+ info->flags |= DF_TEXTREL;
+
+ *valuep = 0;
+ return bfd_reloc_ok;
+ }
+
/* Figure out what kind of relocation is being performed. */
switch (r_type)
{
@@ -3338,12 +4288,11 @@ mips_elf_calculate_relocation (bfd *abfd, bfd *input_bfd,
case R_MIPS_REL32:
case R_MIPS_64:
if ((info->shared
- || (elf_hash_table (info)->dynamic_sections_created
+ || (!htab->is_vxworks
+ && htab->root.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)))
+ && h->root.def_dynamic
+ && !h->root.def_regular))
&& r_symndx != 0
&& (input_section->flags & SEC_ALLOC) != 0)
{
@@ -3351,7 +4300,11 @@ mips_elf_calculate_relocation (bfd *abfd, bfd *input_bfd,
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. */
+ linker.
+
+ In VxWorks executables, references to external symbols
+ are handled using copy relocs or PLT stubs, so there's
+ no need to add a dynamic relocation here. */
value = addend;
if (!mips_elf_create_dynamic_relocation (abfd,
info,
@@ -3374,28 +4327,10 @@ mips_elf_calculate_relocation (bfd *abfd, bfd *input_bfd,
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
@@ -3406,11 +4341,36 @@ mips_elf_calculate_relocation (bfd *abfd, bfd *input_bfd,
if (local_p)
value = ((addend | ((p + 4) & 0xf0000000)) + symbol) >> 2;
else
- value = (_bfd_mips_elf_sign_extend (addend, 28) + symbol) >> 2;
+ {
+ value = (_bfd_mips_elf_sign_extend (addend, 28) + symbol) >> 2;
+ if (h->root.root.type != bfd_link_hash_undefweak)
+ overflowed_p = (value >> 26) != ((p + 4) >> 28);
+ }
value &= howto->dst_mask;
break;
+ case R_MIPS_TLS_DTPREL_HI16:
+ value = (mips_elf_high (addend + symbol - dtprel_base (info))
+ & howto->dst_mask);
+ break;
+
+ case R_MIPS_TLS_DTPREL_LO16:
+ case R_MIPS_TLS_DTPREL32:
+ case R_MIPS_TLS_DTPREL64:
+ value = (symbol + addend - dtprel_base (info)) & howto->dst_mask;
+ break;
+
+ case R_MIPS_TLS_TPREL_HI16:
+ value = (mips_elf_high (addend + symbol - tprel_base (info))
+ & howto->dst_mask);
+ break;
+
+ case R_MIPS_TLS_TPREL_LO16:
+ value = (symbol + addend - tprel_base (info)) & howto->dst_mask;
+ break;
+
case R_MIPS_HI16:
+ case R_MIPS16_HI16:
if (!gp_disp_p)
{
value = mips_elf_high (addend + symbol);
@@ -3418,17 +4378,35 @@ mips_elf_calculate_relocation (bfd *abfd, bfd *input_bfd,
}
else
{
- value = mips_elf_high (addend + gp - p);
+ /* For MIPS16 ABI code we generate this sequence
+ 0: li $v0,%hi(_gp_disp)
+ 4: addiupc $v1,%lo(_gp_disp)
+ 8: sll $v0,16
+ 12: addu $v0,$v1
+ 14: move $gp,$v0
+ So the offsets of hi and lo relocs are the same, but the
+ $pc is four higher than $t9 would be, so reduce
+ both reloc addends by 4. */
+ if (r_type == R_MIPS16_HI16)
+ value = mips_elf_high (addend + gp - p - 4);
+ else
+ value = mips_elf_high (addend + gp - p);
overflowed_p = mips_elf_overflow_p (value, 16);
}
break;
case R_MIPS_LO16:
+ case R_MIPS16_LO16:
if (!gp_disp_p)
value = (symbol + addend) & howto->dst_mask;
else
{
- value = addend + gp - p + 4;
+ /* See the comment for R_MIPS16_HI16 above for the reason
+ for this conditional. */
+ if (r_type == R_MIPS16_LO16)
+ value = addend + gp - p;
+ 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
@@ -3480,13 +4458,12 @@ mips_elf_calculate_relocation (bfd *abfd, bfd *input_bfd,
case R_MIPS_GOT16:
case R_MIPS_CALL16:
- if (local_p)
+ /* VxWorks does not have separate local and global semantics for
+ R_MIPS_GOT16; every relocation evaluates to "G". */
+ if (!htab->is_vxworks && 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,
@@ -3494,14 +4471,16 @@ mips_elf_calculate_relocation (bfd *abfd, bfd *input_bfd,
if (value == MINUS_ONE)
return bfd_reloc_outofrange;
value
- = mips_elf_got_offset_from_index (elf_hash_table (info)->dynobj,
- abfd, input_bfd, value);
+ = mips_elf_got_offset_from_index (dynobj, abfd, input_bfd, value);
overflowed_p = mips_elf_overflow_p (value, 16);
break;
}
/* Fall through. */
+ case R_MIPS_TLS_GD:
+ case R_MIPS_TLS_GOTTPREL:
+ case R_MIPS_TLS_LDM:
case R_MIPS_GOT_DISP:
got_disp:
value = g;
@@ -3515,8 +4494,11 @@ mips_elf_calculate_relocation (bfd *abfd, bfd *input_bfd,
break;
case R_MIPS_PC16:
- value = _bfd_mips_elf_sign_extend (addend, 16) + symbol - p;
- overflowed_p = mips_elf_overflow_p (value, 16);
+ 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 >>= howto->rightshift;
+ value &= howto->dst_mask;
break;
case R_MIPS_GOT_HI16:
@@ -3543,8 +4525,7 @@ mips_elf_calculate_relocation (bfd *abfd, bfd *input_bfd,
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);
+ value = mips_elf_got_offset_from_index (dynobj, abfd, input_bfd, value);
overflowed_p = mips_elf_overflow_p (value, 16);
break;
@@ -3576,12 +4557,16 @@ mips_elf_calculate_relocation (bfd *abfd, bfd *input_bfd,
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;
+ /* This relocation is only a hint. In some cases, we optimize
+ it into a bal instruction. But we don't try to optimize
+ branches to the PLT; that will wind up wasting time. */
+ if (h != NULL && h->root.plt.offset != (bfd_vma) -1)
+ return bfd_reloc_continue;
+ value = symbol + addend;
+ break;
+ case R_MIPS_PJUMP:
case R_MIPS_GNU_VTINHERIT:
case R_MIPS_GNU_VTENTRY:
/* We don't do anything with these at present. */
@@ -3610,13 +4595,6 @@ mips_elf_obtain_contents (reloc_howto_type *howto,
/* 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;
}
@@ -3644,107 +4622,14 @@ mips_elf_perform_relocation (struct bfd_link_info *info,
/* Figure out where the relocation is occurring. */
location = contents + relocation->r_offset;
+ _bfd_mips16_elf_reloc_unshuffle (input_bfd, r_type, FALSE, location);
+
/* 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);
@@ -3771,9 +4656,9 @@ mips_elf_perform_relocation (struct bfd_link_info *info,
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,
+ (_("%B: %A+0x%lx: jump to stub routine which is not jal"),
+ input_bfd,
+ input_section,
(unsigned long) relocation->r_offset);
bfd_set_error (bfd_error_bad_value);
return FALSE;
@@ -3783,46 +4668,77 @@ mips_elf_perform_relocation (struct bfd_link_info *info,
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));
+ /* On the RM9000, bal is faster than jal, because bal uses branch
+ prediction hardware. If we are linking for the RM9000, and we
+ see jal, and bal fits, use it instead. Note that this
+ transformation should be safe for all architectures. */
+ if (bfd_get_mach (input_bfd) == bfd_mach_mips9000
+ && !info->relocatable
+ && !require_jalx
+ && ((r_type == R_MIPS_26 && (x >> 26) == 0x3) /* jal addr */
+ || (r_type == R_MIPS_JALR && x == 0x0320f809))) /* jalr t9 */
+ {
+ bfd_vma addr;
+ bfd_vma dest;
+ bfd_signed_vma off;
+
+ addr = (input_section->output_section->vma
+ + input_section->output_offset
+ + relocation->r_offset
+ + 4);
+ if (r_type == R_MIPS_26)
+ dest = (value << 2) | ((addr >> 28) << 28);
+ else
+ dest = value;
+ off = dest - addr;
+ if (off <= 0x1ffff && off >= -0x20000)
+ x = 0x04110000 | (((bfd_vma) off >> 2) & 0xffff); /* bal addr */
+ }
/* Put the value into the output. */
bfd_put (8 * bfd_get_reloc_size (howto), input_bfd, x, location);
+
+ _bfd_mips16_elf_reloc_shuffle(input_bfd, r_type, !info->relocatable,
+ 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)
+mips16_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);
+ return FN_STUB_P (name) || CALL_STUB_P (name) || CALL_FP_STUB_P (name);
}
-/* Add room for N relocations to the .rel.dyn section in ABFD. */
+/* Add room for N relocations to the .rel(a).dyn section in ABFD. */
static void
-mips_elf_allocate_dynamic_relocations (bfd *abfd, unsigned int n)
+mips_elf_allocate_dynamic_relocations (bfd *abfd, struct bfd_link_info *info,
+ unsigned int n)
{
asection *s;
+ struct mips_elf_link_hash_table *htab;
- s = mips_elf_rel_dyn_section (abfd, FALSE);
+ htab = mips_elf_hash_table (info);
+ s = mips_elf_rel_dyn_section (info, FALSE);
BFD_ASSERT (s != NULL);
- if (s->_raw_size == 0)
+ if (htab->is_vxworks)
+ s->size += n * MIPS_ELF_RELA_SIZE (abfd);
+ else
{
- /* Make room for a null element. */
- s->_raw_size += MIPS_ELF_REL_SIZE (abfd);
- ++s->reloc_count;
+ if (s->size == 0)
+ {
+ /* Make room for a null element. */
+ s->size += MIPS_ELF_REL_SIZE (abfd);
+ ++s->reloc_count;
+ }
+ s->size += n * MIPS_ELF_REL_SIZE (abfd);
}
- s->_raw_size += n * MIPS_ELF_REL_SIZE (abfd);
}
/* Create a rel.dyn relocation for the dynamic linker to resolve. REL
@@ -3839,167 +4755,144 @@ mips_elf_create_dynamic_relocation (bfd *output_bfd,
bfd_vma *addendp, asection *input_section)
{
Elf_Internal_Rela outrel[3];
- bfd_boolean skip;
asection *sreloc;
bfd *dynobj;
int r_type;
+ long indx;
+ bfd_boolean defined_p;
+ struct mips_elf_link_hash_table *htab;
+ htab = mips_elf_hash_table (info);
r_type = ELF_R_TYPE (output_bfd, rel->r_info);
dynobj = elf_hash_table (info)->dynobj;
- sreloc = mips_elf_rel_dyn_section (dynobj, FALSE);
+ sreloc = mips_elf_rel_dyn_section (info, FALSE);
BFD_ASSERT (sreloc != NULL);
BFD_ASSERT (sreloc->contents != NULL);
BFD_ASSERT (sreloc->reloc_count * MIPS_ELF_REL_SIZE (output_bfd)
- < sreloc->_raw_size);
+ < sreloc->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
+ if (ABI_64_P (output_bfd))
{
- /* 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;
+ 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);
}
-#endif
- if (outrel[0].r_offset == (bfd_vma) -1)
+ if (outrel[0].r_offset == MINUS_ONE)
/* The relocation field has been deleted. */
- skip = TRUE;
- else if (outrel[0].r_offset == (bfd_vma) -2)
+ return TRUE;
+
+ if (outrel[0].r_offset == MINUS_TWO)
{
/* 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;
+ return TRUE;
}
- /* If we've decided to skip this relocation, just output an empty
- record. Note that R_MIPS_NONE == 0, so that this call to memset
- is a way of setting R_TYPE to R_MIPS_NONE. */
- if (skip)
- memset (outrel, 0, sizeof (Elf_Internal_Rela) * 3);
+ /* We must now calculate the dynamic symbol table index to use
+ in the relocation. */
+ if (h != NULL
+ && (!h->root.def_regular
+ || (info->shared && !info->symbolic && !h->root.forced_local)))
+ {
+ indx = h->root.dynindx;
+ if (SGI_COMPAT (output_bfd))
+ defined_p = h->root.def_regular;
+ 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
{
- 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;
+ 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
{
- 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)
{
- indx = elf_section_data (sec->output_section)->dynindx;
- if (indx == 0)
- abort ();
+ asection *osec = htab->root.text_index_section;
+ indx = elf_section_data (osec)->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);
- }
+ /* 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;
+
+ if (htab->is_vxworks)
+ /* VxWorks uses non-relative relocations for this. */
+ outrel[0].r_info = ELF32_R_INFO (indx, R_MIPS_32);
+ else
+ /* 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
@@ -4011,6 +4904,15 @@ mips_elf_create_dynamic_relocation (bfd *output_bfd,
(sreloc->contents
+ sreloc->reloc_count * sizeof (Elf64_Mips_External_Rel)));
}
+ else if (htab->is_vxworks)
+ {
+ /* VxWorks uses RELA rather than REL dynamic relocations. */
+ outrel[0].r_addend = *addendp;
+ bfd_elf32_swap_reloca_out
+ (output_bfd, &outrel[0],
+ (sreloc->contents
+ + sreloc->reloc_count * sizeof (Elf32_External_Rela)));
+ }
else
bfd_elf32_swap_reloc_out
(output_bfd, &outrel[0],
@@ -4025,7 +4927,7 @@ mips_elf_create_dynamic_relocation (bfd *output_bfd,
|= SHF_WRITE;
/* On IRIX5, make an entry of compact relocation info. */
- if (! skip && IRIX_COMPAT (output_bfd) == ict_irix5)
+ if (IRIX_COMPAT (output_bfd) == ict_irix5)
{
asection *scpt = bfd_get_section_by_name (dynobj, ".compact_rel");
bfd_byte *cr;
@@ -4047,6 +4949,7 @@ mips_elf_create_dynamic_relocation (bfd *output_bfd,
cr = (scpt->contents
+ sizeof (Elf32_External_compact_rel));
+ mips_elf_set_cr_relvaddr (cptrel, 0);
bfd_elf32_swap_crinfo_out (output_bfd, &cptrel,
((Elf32_External_crinfo *) cr
+ scpt->reloc_count));
@@ -4054,6 +4957,12 @@ mips_elf_create_dynamic_relocation (bfd *output_bfd,
}
}
+ /* If we've written this relocation for a readonly section,
+ we need to set DF_TEXTREL again, so that we do not delete the
+ DT_TEXTREL tag. */
+ if (MIPS_ELF_READONLY_SECTION (input_section))
+ info->flags |= DF_TEXTREL;
+
return TRUE;
}
@@ -4103,39 +5012,30 @@ _bfd_elf_mips_mach (flagword flags)
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;
}
}
@@ -4225,6 +5125,7 @@ _bfd_mips_elf_symbol_processing (bfd *abfd, asymbol *asym)
/* Common symbols less than the GP size are automatically
treated as SHN_MIPS_SCOMMON symbols on IRIX5. */
if (asym->value > elf_gp_size (abfd)
+ || ELF_ST_TYPE (elfsym->internal_elf_sym.st_info) == STT_TLS
|| IRIX_COMPAT (abfd) == ict_irix6)
break;
/* Fall through. */
@@ -4250,18 +5151,106 @@ _bfd_mips_elf_symbol_processing (bfd *abfd, asymbol *asym)
asym->section = bfd_und_section_ptr;
break;
-#if 0 /* for SGI_COMPAT */
case SHN_MIPS_TEXT:
- asym->section = mips_elf_text_section_ptr;
+ {
+ asection *section = bfd_get_section_by_name (abfd, ".text");
+
+ BFD_ASSERT (SGI_COMPAT (abfd));
+ if (section != NULL)
+ {
+ asym->section = section;
+ /* MIPS_TEXT is a bit special, the address is not an offset
+ to the base of the .text section. So substract the section
+ base address to make it an offset. */
+ asym->value -= section->vma;
+ }
+ }
break;
case SHN_MIPS_DATA:
- asym->section = mips_elf_data_section_ptr;
+ {
+ asection *section = bfd_get_section_by_name (abfd, ".data");
+
+ BFD_ASSERT (SGI_COMPAT (abfd));
+ if (section != NULL)
+ {
+ asym->section = section;
+ /* MIPS_DATA is a bit special, the address is not an offset
+ to the base of the .data section. So substract the section
+ base address to make it an offset. */
+ asym->value -= section->vma;
+ }
+ }
break;
-#endif
}
}
+/* Implement elf_backend_eh_frame_address_size. This differs from
+ the default in the way it handles EABI64.
+
+ EABI64 was originally specified as an LP64 ABI, and that is what
+ -mabi=eabi normally gives on a 64-bit target. However, gcc has
+ historically accepted the combination of -mabi=eabi and -mlong32,
+ and this ILP32 variation has become semi-official over time.
+ Both forms use elf32 and have pointer-sized FDE addresses.
+
+ If an EABI object was generated by GCC 4.0 or above, it will have
+ an empty .gcc_compiled_longXX section, where XX is the size of longs
+ in bits. Unfortunately, ILP32 objects generated by earlier compilers
+ have no special marking to distinguish them from LP64 objects.
+
+ We don't want users of the official LP64 ABI to be punished for the
+ existence of the ILP32 variant, but at the same time, we don't want
+ to mistakenly interpret pre-4.0 ILP32 objects as being LP64 objects.
+ We therefore take the following approach:
+
+ - If ABFD contains a .gcc_compiled_longXX section, use it to
+ determine the pointer size.
+
+ - Otherwise check the type of the first relocation. Assume that
+ the LP64 ABI is being used if the relocation is of type R_MIPS_64.
+
+ - Otherwise punt.
+
+ The second check is enough to detect LP64 objects generated by pre-4.0
+ compilers because, in the kind of output generated by those compilers,
+ the first relocation will be associated with either a CIE personality
+ routine or an FDE start address. Furthermore, the compilers never
+ used a special (non-pointer) encoding for this ABI.
+
+ Checking the relocation type should also be safe because there is no
+ reason to use R_MIPS_64 in an ILP32 object. Pre-4.0 compilers never
+ did so. */
+
+unsigned int
+_bfd_mips_elf_eh_frame_address_size (bfd *abfd, asection *sec)
+{
+ if (elf_elfheader (abfd)->e_ident[EI_CLASS] == ELFCLASS64)
+ return 8;
+ if ((elf_elfheader (abfd)->e_flags & EF_MIPS_ABI) == E_MIPS_ABI_EABI64)
+ {
+ bfd_boolean long32_p, long64_p;
+
+ long32_p = bfd_get_section_by_name (abfd, ".gcc_compiled_long32") != 0;
+ long64_p = bfd_get_section_by_name (abfd, ".gcc_compiled_long64") != 0;
+ if (long32_p && long64_p)
+ return 0;
+ if (long32_p)
+ return 4;
+ if (long64_p)
+ return 8;
+
+ if (sec->reloc_count > 0
+ && elf_section_data (sec)->relocs != NULL
+ && (ELF32_R_TYPE (elf_section_data (sec)->relocs[0].r_info)
+ == R_MIPS_64))
+ return 8;
+
+ return 0;
+ }
+ return 4;
+}
+
/* 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:
@@ -4333,12 +5322,10 @@ _bfd_mips_elf_section_processing (bfd *abfd, Elf_Internal_Shdr *hdr)
if (intopt.size < sizeof (Elf_External_Options))
{
(*_bfd_error_handler)
- (_("Warning: bad `%s' option size %u smaller than its header"),
- MIPS_ELF_OPTIONS_SECTION_NAME (abfd), intopt.size);
+ (_("%B: Warning: bad `%s' option size %u smaller than its header"),
+ abfd, MIPS_ELF_OPTIONS_SECTION_NAME (abfd), intopt.size);
break;
}
-
-
if (ABI_64_P (abfd) && intopt.kind == ODK_REGINFO)
{
bfd_byte buf[8];
@@ -4423,8 +5410,10 @@ _bfd_mips_elf_section_processing (bfd *abfd, Elf_Internal_Shdr *hdr)
how to. */
bfd_boolean
-_bfd_mips_elf_section_from_shdr (bfd *abfd, Elf_Internal_Shdr *hdr,
- const char *name)
+_bfd_mips_elf_section_from_shdr (bfd *abfd,
+ Elf_Internal_Shdr *hdr,
+ const char *name,
+ int shindex)
{
flagword flags = 0;
@@ -4448,7 +5437,7 @@ _bfd_mips_elf_section_from_shdr (bfd *abfd, Elf_Internal_Shdr *hdr,
return FALSE;
break;
case SHT_MIPS_GPTAB:
- if (strncmp (name, ".gptab.", sizeof ".gptab." - 1) != 0)
+ if (! CONST_STRNEQ (name, ".gptab."))
return FALSE;
break;
case SHT_MIPS_UCODE:
@@ -4471,15 +5460,15 @@ _bfd_mips_elf_section_from_shdr (bfd *abfd, Elf_Internal_Shdr *hdr,
return FALSE;
break;
case SHT_MIPS_CONTENT:
- if (strncmp (name, ".MIPS.content", sizeof ".MIPS.content" - 1) != 0)
+ if (! CONST_STRNEQ (name, ".MIPS.content"))
return FALSE;
break;
case SHT_MIPS_OPTIONS:
- if (strcmp (name, MIPS_ELF_OPTIONS_SECTION_NAME (abfd)) != 0)
+ if (!MIPS_ELF_OPTIONS_SECTION_NAME_P (name))
return FALSE;
break;
case SHT_MIPS_DWARF:
- if (strncmp (name, ".debug_", sizeof ".debug_" - 1) != 0)
+ if (! CONST_STRNEQ (name, ".debug_"))
return FALSE;
break;
case SHT_MIPS_SYMBOL_LIB:
@@ -4487,16 +5476,15 @@ _bfd_mips_elf_section_from_shdr (bfd *abfd, Elf_Internal_Shdr *hdr,
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)
+ if (! CONST_STRNEQ (name, ".MIPS.events")
+ && ! CONST_STRNEQ (name, ".MIPS.post_rel"))
return FALSE;
break;
default:
- return FALSE;
+ break;
}
- if (! _bfd_elf_make_section_from_shdr (abfd, hdr, name))
+ if (! _bfd_elf_make_section_from_shdr (abfd, hdr, name, shindex))
return FALSE;
if (flags)
@@ -4554,11 +5542,10 @@ _bfd_mips_elf_section_from_shdr (bfd *abfd, Elf_Internal_Shdr *hdr,
if (intopt.size < sizeof (Elf_External_Options))
{
(*_bfd_error_handler)
- (_("Warning: bad `%s' option size %u smaller than its header"),
- MIPS_ELF_OPTIONS_SECTION_NAME (abfd), intopt.size);
+ (_("%B: Warning: bad `%s' option size %u smaller than its header"),
+ abfd, MIPS_ELF_OPTIONS_SECTION_NAME (abfd), intopt.size);
break;
}
-
if (ABI_64_P (abfd) && intopt.kind == ODK_REGINFO)
{
Elf64_Internal_RegInfo intreg;
@@ -4596,19 +5583,17 @@ _bfd_mips_elf_section_from_shdr (bfd *abfd, Elf_Internal_Shdr *hdr,
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);
+ const char *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);
+ hdr->sh_info = sec->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)
+ else if (CONST_STRNEQ (name, ".gptab."))
{
hdr->sh_type = SHT_MIPS_GPTAB;
hdr->sh_entsize = sizeof (Elf32_External_gptab);
@@ -4665,19 +5650,19 @@ _bfd_mips_elf_fake_sections (bfd *abfd, Elf_Internal_Shdr *hdr, asection *sec)
hdr->sh_type = SHT_MIPS_IFACE;
hdr->sh_flags |= SHF_MIPS_NOSTRIP;
}
- else if (strncmp (name, ".MIPS.content", strlen (".MIPS.content")) == 0)
+ else if (CONST_STRNEQ (name, ".MIPS.content"))
{
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)
+ else if (MIPS_ELF_OPTIONS_SECTION_NAME_P (name))
{
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)
+ else if (CONST_STRNEQ (name, ".debug_"))
hdr->sh_type = SHT_MIPS_DWARF;
else if (strcmp (name, ".MIPS.symlib") == 0)
{
@@ -4685,9 +5670,8 @@ _bfd_mips_elf_fake_sections (bfd *abfd, Elf_Internal_Shdr *hdr, asection *sec)
/* 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)
+ else if (CONST_STRNEQ (name, ".MIPS.events")
+ || CONST_STRNEQ (name, ".MIPS.post_rel"))
{
hdr->sh_type = SHT_MIPS_EVENTS;
hdr->sh_flags |= SHF_MIPS_NOSTRIP;
@@ -4750,12 +5734,27 @@ _bfd_mips_elf_add_symbol_hook (bfd *abfd, struct bfd_link_info *info,
return TRUE;
}
+ /* Shared objects may have a dynamic symbol '_gp_disp' defined as
+ a SECTION *ABS*. This causes ld to think it can resolve _gp_disp
+ by setting a DT_NEEDED for the shared object. Since _gp_disp is
+ a magic symbol resolved by the linker, we ignore this bogus definition
+ of _gp_disp. New ABI objects do not suffer from this problem so this
+ is not done for them. */
+ if (!NEWABI_P(abfd)
+ && (sym->st_shndx == SHN_ABS)
+ && (strcmp (*namep, "_gp_disp") == 0))
+ {
+ *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)
+ || ELF_ST_TYPE (sym->st_info) == STT_TLS
|| IRIX_COMPAT (abfd) == ict_irix6)
break;
/* Fall through. */
@@ -4866,8 +5865,8 @@ _bfd_mips_elf_add_symbol_hook (bfd *abfd, struct bfd_link_info *info,
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->non_elf = 0;
+ h->def_regular = 1;
h->type = STT_OBJECT;
if (! bfd_elf_link_record_dynamic_symbol (info, h))
@@ -4902,9 +5901,8 @@ _bfd_mips_elf_link_output_symbol_hook
&& 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;
+ if (sym->st_other == STO_MIPS16)
+ sym->st_value &= ~1;
return TRUE;
}
@@ -4921,32 +5919,39 @@ _bfd_mips_elf_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info)
flagword flags;
register asection *s;
const char * const *namep;
+ struct mips_elf_link_hash_table *htab;
+ htab = mips_elf_hash_table (info);
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)
+ /* The psABI requires a read-only .dynamic section, but the VxWorks
+ EABI doesn't. */
+ if (!htab->is_vxworks)
{
- if (! bfd_set_section_flags (abfd, s, flags))
- return FALSE;
+ 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))
+ if (! mips_elf_rel_dyn_section (info, 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));
+ s = bfd_make_section_with_flags (abfd,
+ MIPS_ELF_STUB_SECTION_NAME (abfd),
+ flags | SEC_CODE);
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;
@@ -4956,9 +5961,9 @@ _bfd_mips_elf_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info)
&& !info->shared
&& bfd_get_section_by_name (abfd, ".rld_map") == NULL)
{
- s = bfd_make_section (abfd, ".rld_map");
+ s = bfd_make_section_with_flags (abfd, ".rld_map",
+ flags &~ (flagword) SEC_READONLY);
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;
@@ -4979,8 +5984,8 @@ _bfd_mips_elf_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info)
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->non_elf = 0;
+ h->def_regular = 1;
h->type = STT_SECTION;
if (! bfd_elf_link_record_dynamic_symbol (info, h))
@@ -5024,8 +6029,8 @@ _bfd_mips_elf_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info)
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->non_elf = 0;
+ h->def_regular = 1;
h->type = STT_SECTION;
if (! bfd_elf_link_record_dynamic_symbol (info, h))
@@ -5048,8 +6053,8 @@ _bfd_mips_elf_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info)
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->non_elf = 0;
+ h->def_regular = 1;
h->type = STT_OBJECT;
if (! bfd_elf_link_record_dynamic_symbol (info, h))
@@ -5057,6 +6062,45 @@ _bfd_mips_elf_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info)
}
}
+ if (htab->is_vxworks)
+ {
+ /* Create the .plt, .rela.plt, .dynbss and .rela.bss sections.
+ Also create the _PROCEDURE_LINKAGE_TABLE symbol. */
+ if (!_bfd_elf_create_dynamic_sections (abfd, info))
+ return FALSE;
+
+ /* Cache the sections created above. */
+ htab->sdynbss = bfd_get_section_by_name (abfd, ".dynbss");
+ htab->srelbss = bfd_get_section_by_name (abfd, ".rela.bss");
+ htab->srelplt = bfd_get_section_by_name (abfd, ".rela.plt");
+ htab->splt = bfd_get_section_by_name (abfd, ".plt");
+ if (!htab->sdynbss
+ || (!htab->srelbss && !info->shared)
+ || !htab->srelplt
+ || !htab->splt)
+ abort ();
+
+ /* Do the usual VxWorks handling. */
+ if (!elf_vxworks_create_dynamic_sections (abfd, info, &htab->srelplt2))
+ return FALSE;
+
+ /* Work out the PLT sizes. */
+ if (info->shared)
+ {
+ htab->plt_header_size
+ = 4 * ARRAY_SIZE (mips_vxworks_shared_plt0_entry);
+ htab->plt_entry_size
+ = 4 * ARRAY_SIZE (mips_vxworks_shared_plt_entry);
+ }
+ else
+ {
+ htab->plt_header_size
+ = 4 * ARRAY_SIZE (mips_vxworks_exec_plt0_entry);
+ htab->plt_entry_size
+ = 4 * ARRAY_SIZE (mips_vxworks_exec_plt_entry);
+ }
+ }
+
return TRUE;
}
@@ -5078,10 +6122,12 @@ _bfd_mips_elf_check_relocs (bfd *abfd, struct bfd_link_info *info,
asection *sgot;
asection *sreloc;
const struct elf_backend_data *bed;
+ struct mips_elf_link_hash_table *htab;
if (info->relocatable)
return TRUE;
+ htab = mips_elf_hash_table (info);
dynobj = elf_hash_table (info)->dynobj;
symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
sym_hashes = elf_sym_hashes (abfd);
@@ -5090,7 +6136,7 @@ _bfd_mips_elf_check_relocs (bfd *abfd, struct bfd_link_info *info,
/* Check for the mips16 stub sections. */
name = bfd_get_section_name (abfd, sec);
- if (strncmp (name, FN_STUB, sizeof FN_STUB - 1) == 0)
+ if (FN_STUB_P (name))
{
unsigned long r_symndx;
@@ -5115,12 +6161,7 @@ _bfd_mips_elf_check_relocs (bfd *abfd, struct bfd_link_info *info,
/* 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)
+ || mips16_stub_section_p (abfd, o))
continue;
sec_relocs
@@ -5172,6 +6213,7 @@ _bfd_mips_elf_check_relocs (bfd *abfd, struct bfd_link_info *info,
elf_tdata (abfd)->local_stubs = n;
}
+ sec->flags |= SEC_KEEP;
elf_tdata (abfd)->local_stubs[r_symndx] = sec;
/* We don't need to set mips16_stubs_seen in this case.
@@ -5186,14 +6228,29 @@ _bfd_mips_elf_check_relocs (bfd *abfd, struct bfd_link_info *info,
h = ((struct mips_elf_link_hash_entry *)
sym_hashes[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;
+
/* H is the symbol this stub is for. */
+ /* 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. */
+ if (h->fn_stub != NULL)
+ {
+ sec->flags |= SEC_EXCLUDE;
+ return TRUE;
+ }
+
+ sec->flags |= SEC_KEEP;
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)
+ else if (CALL_STUB_P (name) || CALL_FP_STUB_P (name))
{
unsigned long r_symndx;
struct mips_elf_link_hash_entry *h;
@@ -5207,42 +6264,106 @@ _bfd_mips_elf_check_relocs (bfd *abfd, struct bfd_link_info *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;
- }
+ asection *o;
- h = ((struct mips_elf_link_hash_entry *)
- sym_hashes[r_symndx - extsymoff]);
+ /* This stub is for a local symbol. This stub will only be
+ needed if there is some relocation (R_MIPS16_26) in this BFD
+ that refers to this symbol. */
+ for (o = abfd->sections; o != NULL; o = o->next)
+ {
+ Elf_Internal_Rela *sec_relocs;
+ const Elf_Internal_Rela *r, *rend;
- /* H is the symbol this stub is for. */
+ /* We can ignore stub sections when looking for relocs. */
+ if ((o->flags & SEC_RELOC) == 0
+ || o->reloc_count == 0
+ || mips16_stub_section_p (abfd, o))
+ continue;
- 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;
+ 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 call_stubs for
+ this BFD. */
+ if (elf_tdata (abfd)->local_call_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_call_stubs = n;
+ }
+
+ sec->flags |= SEC_KEEP;
+ elf_tdata (abfd)->local_call_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
+ {
+ h = ((struct mips_elf_link_hash_entry *)
+ sym_hashes[r_symndx - extsymoff]);
+
+ /* H is the symbol this stub is for. */
+
+ if (CALL_FP_STUB_P (name))
+ 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. */
+ if (*loc != NULL)
+ {
+ sec->flags |= SEC_EXCLUDE;
+ return TRUE;
+ }
- *loc = sec;
- mips_elf_hash_table (info)->mips16_stubs_seen = TRUE;
+ sec->flags |= SEC_KEEP;
+ *loc = sec;
+ mips_elf_hash_table (info)->mips16_stubs_seen = TRUE;
+ }
}
if (dynobj == NULL)
@@ -5280,8 +6401,8 @@ _bfd_mips_elf_check_relocs (bfd *abfd, struct bfd_link_info *info,
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);
+ (_("%B: Malformed reloc detected for section %s"),
+ abfd, name);
bfd_set_error (bfd_error_bad_value);
return FALSE;
}
@@ -5311,18 +6432,32 @@ _bfd_mips_elf_check_relocs (bfd *abfd, struct bfd_link_info *info,
case R_MIPS_GOT_PAGE:
case R_MIPS_GOT_OFST:
case R_MIPS_GOT_DISP:
+ case R_MIPS_TLS_GOTTPREL:
+ case R_MIPS_TLS_GD:
+ case R_MIPS_TLS_LDM:
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);
+ if (htab->is_vxworks && !info->shared)
+ {
+ (*_bfd_error_handler)
+ (_("%B: GOT reloc at 0x%lx not expected in executables"),
+ abfd, (unsigned long) rel->r_offset);
+ bfd_set_error (bfd_error_bad_value);
+ return FALSE;
+ }
break;
case R_MIPS_32:
case R_MIPS_REL32:
case R_MIPS_64:
+ /* In VxWorks executables, references to external symbols
+ are handled using copy relocs or PLT stubs, so there's
+ no need to add a dynamic relocation here. */
if (dynobj == NULL
- && (info->shared || h != NULL)
+ && (info->shared || (h != NULL && !htab->is_vxworks))
&& (sec->flags & SEC_ALLOC) != 0)
elf_hash_table (info)->dynobj = dynobj = abfd;
break;
@@ -5332,19 +6467,43 @@ _bfd_mips_elf_check_relocs (bfd *abfd, struct bfd_link_info *info,
}
}
- if (!h && (r_type == R_MIPS_CALL_LO16
- || r_type == R_MIPS_GOT_LO16
- || r_type == R_MIPS_GOT_DISP))
+ if (h)
+ {
+ ((struct mips_elf_link_hash_entry *) h)->is_relocation_target = TRUE;
+
+ /* Relocations against the special VxWorks __GOTT_BASE__ and
+ __GOTT_INDEX__ symbols must be left to the loader. Allocate
+ room for them in .rela.dyn. */
+ if (is_gott_symbol (info, h))
+ {
+ if (sreloc == NULL)
+ {
+ sreloc = mips_elf_rel_dyn_section (info, TRUE);
+ if (sreloc == NULL)
+ return FALSE;
+ }
+ mips_elf_allocate_dynamic_relocations (dynobj, info, 1);
+ if (MIPS_ELF_READONLY_SECTION (sec))
+ /* We tell the dynamic linker that there are
+ relocations against the text segment. */
+ info->flags |= DF_TEXTREL;
+ }
+ }
+ else if (r_type == R_MIPS_CALL_LO16
+ || r_type == R_MIPS_GOT_LO16
+ || r_type == R_MIPS_GOT_DISP
+ || (r_type == R_MIPS_GOT16 && htab->is_vxworks))
{
/* 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_CALL16, except on VxWorks, where GOT relocations
+ always evaluate to "G". 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))
+ rel->r_addend, g, 0))
return FALSE;
}
@@ -5354,8 +6513,8 @@ _bfd_mips_elf_check_relocs (bfd *abfd, struct bfd_link_info *info,
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);
+ (_("%B: CALL16 reloc at 0x%lx not against global symbol"),
+ abfd, (unsigned long) rel->r_offset);
bfd_set_error (bfd_error_bad_value);
return FALSE;
}
@@ -5365,14 +6524,17 @@ _bfd_mips_elf_check_relocs (bfd *abfd, struct bfd_link_info *info,
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))
+ /* VxWorks call relocations point the function's .got.plt
+ entry, which will be allocated by adjust_dynamic_symbol.
+ Otherwise, this symbol requires a global GOT entry. */
+ if (!htab->is_vxworks
+ && !mips_elf_record_global_got_symbol (h, abfd, info, g, 0))
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->needs_plt = 1;
h->type = STT_FUNC;
}
break;
@@ -5392,10 +6554,9 @@ _bfd_mips_elf_check_relocs (bfd *abfd, struct bfd_link_info *info,
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)
+ if (hmips->root.def_regular
&& ! (info->shared && ! info->symbolic
- && ! (hmips->root.elf_link_hash_flags
- & ELF_LINK_FORCED_LOCAL)))
+ && ! hmips->root.forced_local))
break;
}
/* Fall through. */
@@ -5404,33 +6565,74 @@ _bfd_mips_elf_check_relocs (bfd *abfd, struct bfd_link_info *info,
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))
+ if (h && ! mips_elf_record_global_got_symbol (h, abfd, info, g, 0))
return FALSE;
break;
+ case R_MIPS_TLS_GOTTPREL:
+ if (info->shared)
+ info->flags |= DF_STATIC_TLS;
+ /* Fall through */
+
+ case R_MIPS_TLS_LDM:
+ if (r_type == R_MIPS_TLS_LDM)
+ {
+ r_symndx = 0;
+ h = NULL;
+ }
+ /* Fall through */
+
+ case R_MIPS_TLS_GD:
+ /* This symbol requires a global offset table entry, or two
+ for TLS GD relocations. */
+ {
+ unsigned char flag = (r_type == R_MIPS_TLS_GD
+ ? GOT_TLS_GD
+ : r_type == R_MIPS_TLS_LDM
+ ? GOT_TLS_LDM
+ : GOT_TLS_IE);
+ if (h != NULL)
+ {
+ struct mips_elf_link_hash_entry *hmips =
+ (struct mips_elf_link_hash_entry *) h;
+ hmips->tls_type |= flag;
+
+ if (h && ! mips_elf_record_global_got_symbol (h, abfd, info, g, flag))
+ return FALSE;
+ }
+ else
+ {
+ BFD_ASSERT (flag == GOT_TLS_LDM || r_symndx != 0);
+
+ if (! mips_elf_record_local_got_symbol (abfd, r_symndx,
+ rel->r_addend, g, flag))
+ return FALSE;
+ }
+ }
+ break;
+
case R_MIPS_32:
case R_MIPS_REL32:
case R_MIPS_64:
- if ((info->shared || h != NULL)
+ /* In VxWorks executables, references to external symbols
+ are handled using copy relocs or PLT stubs, so there's
+ no need to add a .rela.dyn entry for this relocation. */
+ if ((info->shared || (h != NULL && !htab->is_vxworks))
&& (sec->flags & SEC_ALLOC) != 0)
{
if (sreloc == NULL)
{
- sreloc = mips_elf_rel_dyn_section (dynobj, TRUE);
+ sreloc = mips_elf_rel_dyn_section (info, 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)
+ relocs. Make room for this reloc in .rel(a).dyn. */
+ mips_elf_allocate_dynamic_relocations (dynobj, info, 1);
+ if (MIPS_ELF_READONLY_SECTION (sec))
/* We tell the dynamic linker that there are
relocations against the text segment. */
info->flags |= DF_TEXTREL;
@@ -5443,8 +6645,7 @@ _bfd_mips_elf_check_relocs (bfd *abfd, struct bfd_link_info *info,
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)
+ if (MIPS_ELF_READONLY_SECTION (sec))
/* We need it to tell the dynamic linker if there
are relocations against the text segment. */
hmips->readonly_reloc = TRUE;
@@ -5453,15 +6654,17 @@ _bfd_mips_elf_check_relocs (bfd *abfd, struct bfd_link_info *info,
/* 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)
+ dynamic relocations against it. This does not apply
+ to VxWorks, which does not have the usual coupling
+ between global GOT entries and .dynsym entries. */
+ if (h != NULL && !htab->is_vxworks)
{
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))
+ if (! mips_elf_record_global_got_symbol (h, abfd, info, g, 0))
return FALSE;
}
}
@@ -5471,7 +6674,16 @@ _bfd_mips_elf_check_relocs (bfd *abfd, struct bfd_link_info *info,
sizeof (Elf32_External_crinfo);
break;
+ case R_MIPS_PC16:
+ if (h)
+ ((struct mips_elf_link_hash_entry *) h)->is_branch_target = TRUE;
+ break;
+
case R_MIPS_26:
+ if (h)
+ ((struct mips_elf_link_hash_entry *) h)->is_branch_target = TRUE;
+ /* Fall through. */
+
case R_MIPS_GPREL16:
case R_MIPS_LITERAL:
case R_MIPS_GPREL32:
@@ -5499,36 +6711,28 @@ _bfd_mips_elf_check_relocs (bfd *abfd, struct bfd_link_info *info,
}
/* 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;
- }
+ related to taking the function's address. This doesn't apply to
+ VxWorks, where CALL relocs refer to a .got.plt entry instead of
+ a normal .got entry. */
+ if (!htab->is_vxworks && h != NULL)
+ switch (r_type)
+ {
+ default:
+ ((struct mips_elf_link_hash_entry *) h)->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)
+ && !mips16_stub_section_p (abfd, sec))
{
struct mips_elf_link_hash_entry *mh;
@@ -5549,7 +6753,6 @@ _bfd_mips_relax_section (bfd *abfd, asection *sec,
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;
@@ -5605,7 +6808,7 @@ _bfd_mips_relax_section (bfd *abfd, asection *sec,
|| 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)))
+ && !h->root.forced_local))
continue;
sym_sec = h->root.root.u.def.section;
@@ -5670,13 +6873,7 @@ _bfd_mips_relax_section (bfd *abfd, asection *sec,
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))
+ if (!bfd_malloc_and_get_section (abfd, sec, &contents))
goto relax_return;
}
}
@@ -5711,8 +6908,9 @@ _bfd_mips_relax_section (bfd *abfd, asection *sec,
return TRUE;
relax_return:
- if (free_contents != NULL)
- free (free_contents);
+ if (contents != NULL
+ && elf_section_data (sec)->this_hdr.contents != contents)
+ free (contents);
return FALSE;
}
@@ -5729,19 +6927,18 @@ _bfd_mips_elf_adjust_dynamic_symbol (struct bfd_link_info *info,
bfd *dynobj;
struct mips_elf_link_hash_entry *hmips;
asection *s;
+ struct mips_elf_link_hash_table *htab;
+ htab = mips_elf_hash_table (info);
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)));
+ && (h->needs_plt
+ || h->u.weakdef != NULL
+ || (h->def_dynamic
+ && h->ref_regular
+ && !h->def_regular)));
/* 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
@@ -5750,11 +6947,10 @@ _bfd_mips_elf_adjust_dynamic_symbol (struct bfd_link_info *info,
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))
+ || !h->def_regular))
{
- mips_elf_allocate_dynamic_relocations (dynobj,
- hmips->possibly_dynamic_relocs);
+ mips_elf_allocate_dynamic_relocations
+ (dynobj, info, hmips->possibly_dynamic_relocs);
if (hmips->readonly_reloc)
/* We tell the dynamic linker that there are relocations
against the text segment. */
@@ -5763,7 +6959,7 @@ _bfd_mips_elf_adjust_dynamic_symbol (struct bfd_link_info *info,
/* For a function, create a stub, if allowed. */
if (! hmips->no_fn_stub
- && (h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT) != 0)
+ && h->needs_plt)
{
if (! elf_hash_table (info)->dynamic_sections_created)
return TRUE;
@@ -5772,7 +6968,7 @@ _bfd_mips_elf_adjust_dynamic_symbol (struct bfd_link_info *info,
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)
+ if (!h->def_regular)
{
/* We need .stub section. */
s = bfd_get_section_by_name (dynobj,
@@ -5780,13 +6976,13 @@ _bfd_mips_elf_adjust_dynamic_symbol (struct bfd_link_info *info,
BFD_ASSERT (s != NULL);
h->root.u.def.section = s;
- h->root.u.def.value = s->_raw_size;
+ h->root.u.def.value = s->size;
/* XXX Write this stub address somewhere. */
- h->plt.offset = s->_raw_size;
+ h->plt.offset = s->size;
/* Make room for this stub code. */
- s->_raw_size += MIPS_FUNCTION_STUB_SIZE;
+ s->size += htab->function_stub_size;
/* The last half word of the stub will be filled with the index
of this symbol in .dynsym section. */
@@ -5794,7 +6990,7 @@ _bfd_mips_elf_adjust_dynamic_symbol (struct bfd_link_info *info,
}
}
else if ((h->type == STT_FUNC)
- && (h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT) == 0)
+ && !h->needs_plt)
{
/* This will set the entry for this symbol in the GOT to 0, and
the dynamic linker will take care of this. */
@@ -5805,12 +7001,12 @@ _bfd_mips_elf_adjust_dynamic_symbol (struct bfd_link_info *info,
/* 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)
+ if (h->u.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;
+ BFD_ASSERT (h->u.weakdef->root.type == bfd_link_hash_defined
+ || h->u.weakdef->root.type == bfd_link_hash_defweak);
+ h->root.u.def.section = h->u.weakdef->root.u.def.section;
+ h->root.u.def.value = h->u.weakdef->root.u.def.value;
return TRUE;
}
@@ -5819,7 +7015,167 @@ _bfd_mips_elf_adjust_dynamic_symbol (struct bfd_link_info *info,
return TRUE;
}
+
+/* Likewise, for VxWorks. */
+
+bfd_boolean
+_bfd_mips_vxworks_adjust_dynamic_symbol (struct bfd_link_info *info,
+ struct elf_link_hash_entry *h)
+{
+ bfd *dynobj;
+ struct mips_elf_link_hash_entry *hmips;
+ struct mips_elf_link_hash_table *htab;
+
+ htab = mips_elf_hash_table (info);
+ dynobj = elf_hash_table (info)->dynobj;
+ hmips = (struct mips_elf_link_hash_entry *) h;
+
+ /* Make sure we know what is going on here. */
+ BFD_ASSERT (dynobj != NULL
+ && (h->needs_plt
+ || h->needs_copy
+ || h->u.weakdef != NULL
+ || (h->def_dynamic
+ && h->ref_regular
+ && !h->def_regular)));
+
+ /* If the symbol is defined by a dynamic object, we need a PLT stub if
+ either (a) we want to branch to the symbol or (b) we're linking an
+ executable that needs a canonical function address. In the latter
+ case, the canonical address will be the address of the executable's
+ load stub. */
+ if ((hmips->is_branch_target
+ || (!info->shared
+ && h->type == STT_FUNC
+ && hmips->is_relocation_target))
+ && h->def_dynamic
+ && h->ref_regular
+ && !h->def_regular
+ && !h->forced_local)
+ h->needs_plt = 1;
+
+ /* Locally-binding symbols do not need a PLT stub; we can refer to
+ the functions directly. */
+ else if (h->needs_plt
+ && (SYMBOL_CALLS_LOCAL (info, h)
+ || (ELF_ST_VISIBILITY (h->other) != STV_DEFAULT
+ && h->root.type == bfd_link_hash_undefweak)))
+ {
+ h->needs_plt = 0;
+ return TRUE;
+ }
+
+ if (h->needs_plt)
+ {
+ /* If this is the first symbol to need a PLT entry, allocate room
+ for the header, and for the header's .rela.plt.unloaded entries. */
+ if (htab->splt->size == 0)
+ {
+ htab->splt->size += htab->plt_header_size;
+ if (!info->shared)
+ htab->srelplt2->size += 2 * sizeof (Elf32_External_Rela);
+ }
+
+ /* Assign the next .plt entry to this symbol. */
+ h->plt.offset = htab->splt->size;
+ htab->splt->size += htab->plt_entry_size;
+
+ /* If the output file has no definition of the symbol, set the
+ symbol's value to the address of the stub. For executables,
+ point at the PLT load stub rather than the lazy resolution stub;
+ this stub will become the canonical function address. */
+ if (!h->def_regular)
+ {
+ h->root.u.def.section = htab->splt;
+ h->root.u.def.value = h->plt.offset;
+ if (!info->shared)
+ h->root.u.def.value += 8;
+ }
+
+ /* Make room for the .got.plt entry and the R_JUMP_SLOT relocation. */
+ htab->sgotplt->size += 4;
+ htab->srelplt->size += sizeof (Elf32_External_Rela);
+
+ /* Make room for the .rela.plt.unloaded relocations. */
+ if (!info->shared)
+ htab->srelplt2->size += 3 * sizeof (Elf32_External_Rela);
+
+ return TRUE;
+ }
+
+ /* If a function symbol is defined by a dynamic object, and we do not
+ need a PLT stub for it, the symbol's value should be zero. */
+ if (h->type == STT_FUNC
+ && h->def_dynamic
+ && h->ref_regular
+ && !h->def_regular)
+ {
+ 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->u.weakdef != NULL)
+ {
+ BFD_ASSERT (h->u.weakdef->root.type == bfd_link_hash_defined
+ || h->u.weakdef->root.type == bfd_link_hash_defweak);
+ h->root.u.def.section = h->u.weakdef->root.u.def.section;
+ h->root.u.def.value = h->u.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 (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. */
+
+ if ((h->root.u.def.section->flags & SEC_ALLOC) != 0)
+ {
+ htab->srelbss->size += sizeof (Elf32_External_Rela);
+ h->needs_copy = 1;
+ }
+
+ return _bfd_elf_adjust_dynamic_copy (h, htab->sdynbss);
+}
+/* Return the number of dynamic section symbols required by OUTPUT_BFD.
+ The number might be exact or a worst-case estimate, depending on how
+ much information is available to elf_backend_omit_section_dynsym at
+ the current linking stage. */
+
+static bfd_size_type
+count_section_dynsyms (bfd *output_bfd, struct bfd_link_info *info)
+{
+ bfd_size_type count;
+
+ count = 0;
+ if (info->shared || elf_hash_table (info)->is_relocatable_executable)
+ {
+ asection *p;
+ const struct elf_backend_data *bed;
+
+ bed = get_elf_backend_data (output_bfd);
+ for (p = output_bfd->sections; p ; p = p->next)
+ if ((p->flags & SEC_EXCLUDE) == 0
+ && (p->flags & SEC_ALLOC) != 0
+ && !(*bed->elf_backend_omit_section_dynsym) (output_bfd, info, p))
+ ++count;
+ }
+ return count;
+}
+
/* 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. */
@@ -5836,7 +7192,12 @@ _bfd_mips_elf_always_size_sections (bfd *output_bfd,
int i;
bfd_size_type loadable_size = 0;
bfd_size_type local_gotno;
+ bfd_size_type dynsymcount;
bfd *sub;
+ struct mips_elf_count_tls_arg count_tls_arg;
+ struct mips_elf_link_hash_table *htab;
+
+ htab = mips_elf_hash_table (info);
/* The .reginfo section has a fixed size. */
ri = bfd_get_section_by_name (output_bfd, ".reginfo");
@@ -5870,7 +7231,7 @@ _bfd_mips_elf_always_size_sections (bfd *output_bfd,
{
if ((subsection->flags & SEC_ALLOC) == 0)
continue;
- loadable_size += ((subsection->_raw_size + 0xf)
+ loadable_size += ((subsection->size + 0xf)
&~ (bfd_size_type) 0xf);
}
}
@@ -5890,24 +7251,66 @@ _bfd_mips_elf_always_size_sections (bfd *output_bfd,
relocations, then GLOBAL_GOTSYM will be NULL. */
i = 0;
+ /* Get a worst-case estimate of the number of dynamic symbols needed.
+ At this point, dynsymcount does not account for section symbols
+ and count_section_dynsyms may overestimate the number that will
+ be needed. */
+ dynsymcount = (elf_hash_table (info)->dynsymcount
+ + count_section_dynsyms (output_bfd, info));
+
+ /* Determine the size of one stub entry. */
+ htab->function_stub_size = (dynsymcount > 0x10000
+ ? MIPS_FUNCTION_STUB_BIG_SIZE
+ : MIPS_FUNCTION_STUB_NORMAL_SIZE);
+
/* 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);
+ loadable_size += htab->function_stub_size * (i + 1);
- /* Assume there are two loadable segments consisting of
- contiguous sections. Is 5 enough? */
- local_gotno = (loadable_size >> 16) + 5;
+ if (htab->is_vxworks)
+ /* There's no need to allocate page entries for VxWorks; R_MIPS_GOT16
+ relocations against local symbols evaluate to "G", and the EABI does
+ not include R_MIPS_GOT_PAGE. */
+ local_gotno = 0;
+ else
+ /* 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);
+ s->size += g->local_gotno * MIPS_ELF_GOT_SIZE (output_bfd);
g->global_gotno = i;
- s->_raw_size += i * MIPS_ELF_GOT_SIZE (output_bfd);
+ s->size += i * MIPS_ELF_GOT_SIZE (output_bfd);
+
+ /* We need to calculate tls_gotno for global symbols at this point
+ instead of building it up earlier, to avoid doublecounting
+ entries for one global symbol from multiple input files. */
+ count_tls_arg.info = info;
+ count_tls_arg.needed = 0;
+ elf_link_hash_traverse (elf_hash_table (info),
+ mips_elf_count_global_tls_entries,
+ &count_tls_arg);
+ g->tls_gotno += count_tls_arg.needed;
+ s->size += g->tls_gotno * 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;
+ mips_elf_resolve_final_got_entries (g);
+
+ /* VxWorks does not support multiple GOTs. It initializes $gp to
+ __GOTT_BASE__[__GOTT_INDEX__], the value of which is set by the
+ dynamic loader. */
+ if (!htab->is_vxworks && s->size > MIPS_ELF_GOT_MAX_SIZE (info))
+ {
+ if (! mips_elf_multi_got (output_bfd, info, g, s, local_gotno))
+ return FALSE;
+ }
+ else
+ {
+ /* Set up TLS entries for the first GOT. */
+ g->tls_assigned_gotno = g->global_gotno + g->local_gotno;
+ htab_traverse (g->got_entries, mips_elf_initialize_tls_index, g);
+ }
return TRUE;
}
@@ -5919,9 +7322,11 @@ _bfd_mips_elf_size_dynamic_sections (bfd *output_bfd,
struct bfd_link_info *info)
{
bfd *dynobj;
- asection *s;
+ asection *s, *sreldyn;
bfd_boolean reltext;
+ struct mips_elf_link_hash_table *htab;
+ htab = mips_elf_hash_table (info);
dynobj = elf_hash_table (info)->dynobj;
BFD_ASSERT (dynobj != NULL);
@@ -5932,7 +7337,7 @@ _bfd_mips_elf_size_dynamic_sections (bfd *output_bfd,
{
s = bfd_get_section_by_name (dynobj, ".interp");
BFD_ASSERT (s != NULL);
- s->_raw_size
+ s->size
= strlen (ELF_DYNAMIC_INTERPRETER (output_bfd)) + 1;
s->contents
= (bfd_byte *) ELF_DYNAMIC_INTERPRETER (output_bfd);
@@ -5943,10 +7348,10 @@ _bfd_mips_elf_size_dynamic_sections (bfd *output_bfd,
determined the sizes of the various dynamic sections. Allocate
memory for them. */
reltext = FALSE;
+ sreldyn = NULL;
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. */
@@ -5955,31 +7360,16 @@ _bfd_mips_elf_size_dynamic_sections (bfd *output_bfd,
if ((s->flags & SEC_LINKER_CREATED) == 0)
continue;
- strip = FALSE;
-
- if (strncmp (name, ".rel", 4) == 0)
+ if (CONST_STRNEQ (name, ".rel"))
{
- 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
+ if (s->size != 0)
{
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
+ If the relocation section is .rel(a).dyn, we always
assert a DT_TEXTREL entry rather than testing whether
there exists a relocation to a read only section or
not. */
@@ -5989,12 +7379,12 @@ _bfd_mips_elf_size_dynamic_sections (bfd *output_bfd,
if ((target != NULL
&& (target->flags & SEC_READONLY) != 0
&& (target->flags & SEC_ALLOC) != 0)
- || strcmp (outname, ".rel.dyn") == 0)
+ || strcmp (outname, MIPS_ELF_REL_DYN_NAME (info)) == 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)
+ if (strcmp (name, MIPS_ELF_REL_DYN_NAME (info)) != 0)
s->reloc_count = 0;
/* If combreloc is enabled, elf_link_sort_relocs() will
@@ -6006,7 +7396,23 @@ _bfd_mips_elf_size_dynamic_sections (bfd *output_bfd,
info->combreloc = 0;
}
}
- else if (strncmp (name, ".got", 4) == 0)
+ else if (htab->is_vxworks && strcmp (name, ".got") == 0)
+ {
+ /* Executables do not need a GOT. */
+ if (info->shared)
+ {
+ /* Allocate relocations for all but the reserved entries. */
+ struct mips_got_info *g;
+ unsigned int count;
+
+ g = mips_elf_got_info (dynobj, NULL);
+ count = (g->global_gotno
+ + g->local_gotno
+ - MIPS_RESERVED_GOTNO (info));
+ mips_elf_allocate_dynamic_relocations (dynobj, info, count);
+ }
+ }
+ else if (!htab->is_vxworks && CONST_STRNEQ (name, ".got"))
{
/* _bfd_mips_elf_always_size_sections() has already done
most of the work, but some symbols may have been mapped
@@ -6022,6 +7428,9 @@ _bfd_mips_elf_size_dynamic_sections (bfd *output_bfd,
set_got_offset_arg.value = MIPS_ELF_GOT_SIZE (output_bfd);
set_got_offset_arg.info = info;
+ /* NOTE 2005-02-03: How can this call, or the next, ever
+ find any indirect entries to resolve? They were all
+ resolved in mips_elf_multi_got. */
mips_elf_resolve_final_got_entries (gg);
for (g = gg->next; g && g->next != gg; g = g->next)
{
@@ -6047,46 +7456,86 @@ _bfd_mips_elf_size_dynamic_sections (bfd *output_bfd,
needed_relocs += g->local_gotno - g->assigned_gotno;
BFD_ASSERT (g->assigned_gotno == g->next->local_gotno
+ g->next->global_gotno
- + MIPS_RESERVED_GOTNO);
+ + g->next->tls_gotno
+ + MIPS_RESERVED_GOTNO (info));
}
}
+ }
+ else
+ {
+ struct mips_elf_count_tls_arg arg;
+ arg.info = info;
+ arg.needed = 0;
+
+ htab_traverse (gg->got_entries, mips_elf_count_local_tls_relocs,
+ &arg);
+ elf_link_hash_traverse (elf_hash_table (info),
+ mips_elf_count_global_tls_relocs,
+ &arg);
- if (needed_relocs)
- mips_elf_allocate_dynamic_relocations (dynobj, needed_relocs);
+ needed_relocs += arg.needed;
}
+
+ if (needed_relocs)
+ mips_elf_allocate_dynamic_relocations (dynobj, info,
+ 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;
+ of .text section. So put a dummy. XXX */
+ s->size += htab->function_stub_size;
}
else if (! info->shared
&& ! mips_elf_hash_table (info)->use_rld_obj_head
- && strncmp (name, ".rld_map", 8) == 0)
+ && CONST_STRNEQ (name, ".rld_map"))
{
- /* We add a room for __rld_map. It will be filled in by the
+ /* 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;
+ s->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)
+ && CONST_STRNEQ (name, ".compact_rel"))
+ s->size += mips_elf_hash_table (info)->compact_rel_size;
+ else if (! CONST_STRNEQ (name, ".init")
+ && s != htab->sgotplt
+ && s != htab->splt)
{
/* It's not one of our sections, so don't allocate space. */
continue;
}
- if (strip)
+ if (s->size == 0)
+ {
+ s->flags |= SEC_EXCLUDE;
+ continue;
+ }
+
+ if ((s->flags & SEC_HAS_CONTENTS) == 0)
+ continue;
+
+ /* Allocate memory for this section last, since we may increase its
+ size above. */
+ if (strcmp (name, MIPS_ELF_REL_DYN_NAME (info)) == 0)
{
- _bfd_strip_section_from_output (info, s);
+ sreldyn = s;
continue;
}
/* Allocate memory for the section contents. */
- s->contents = bfd_zalloc (dynobj, s->_raw_size);
- if (s->contents == NULL && s->_raw_size != 0)
+ s->contents = bfd_zalloc (dynobj, s->size);
+ if (s->contents == NULL)
+ {
+ bfd_set_error (bfd_error_no_memory);
+ return FALSE;
+ }
+ }
+
+ /* Allocate memory for the .rel(a).dyn section. */
+ if (sreldyn != NULL)
+ {
+ sreldyn->contents = bfd_zalloc (dynobj, sreldyn->size);
+ if (sreldyn->contents == NULL)
{
bfd_set_error (bfd_error_no_memory);
return FALSE;
@@ -6098,105 +7547,160 @@ _bfd_mips_elf_size_dynamic_sections (bfd *output_bfd,
/* 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;
- }
- }
+ the .dynamic section. */
+
+ /* SGI object has the equivalence of DT_DEBUG in the
+ DT_MIPS_RLD_MAP entry. This must come first because glibc
+ only fills in DT_MIPS_RLD_MAP (not DT_DEBUG) and GDB only
+ looks at the first one it sees. */
+ if (!info->shared
+ && !MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_MIPS_RLD_MAP, 0))
+ return FALSE;
+
+ /* The DT_DEBUG entry may be filled in by the dynamic linker and
+ used by the debugger. */
+ if (info->executable
+ && !SGI_COMPAT (output_bfd)
+ && !MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_DEBUG, 0))
+ return FALSE;
- if (reltext && SGI_COMPAT (output_bfd))
+ if (reltext && (SGI_COMPAT (output_bfd) || htab->is_vxworks))
info->flags |= DF_TEXTREL;
if ((info->flags & DF_TEXTREL) != 0)
{
if (! MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_TEXTREL, 0))
return FALSE;
+
+ /* Clear the DF_TEXTREL flag. It will be set again if we
+ write out an actual text relocation; we may not, because
+ at this point we do not know whether e.g. any .eh_frame
+ absolute relocations have been converted to PC-relative. */
+ info->flags &= ~DF_TEXTREL;
}
if (! MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_PLTGOT, 0))
return FALSE;
- if (mips_elf_rel_dyn_section (dynobj, FALSE))
+ if (htab->is_vxworks)
{
- if (! MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_REL, 0))
- return FALSE;
+ /* VxWorks uses .rela.dyn instead of .rel.dyn. It does not
+ use any of the DT_MIPS_* tags. */
+ if (mips_elf_rel_dyn_section (info, FALSE))
+ {
+ if (! MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_RELA, 0))
+ return FALSE;
- if (! MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_RELSZ, 0))
- return FALSE;
+ if (! MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_RELASZ, 0))
+ return FALSE;
- if (! MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_RELENT, 0))
- return FALSE;
- }
+ if (! MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_RELAENT, 0))
+ return FALSE;
+ }
+ if (htab->splt->size > 0)
+ {
+ if (! MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_PLTREL, 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_JMPREL, 0))
+ return FALSE;
- if (! MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_MIPS_FLAGS, 0))
- return FALSE;
+ if (! MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_PLTRELSZ, 0))
+ return FALSE;
+ }
+ }
+ else
+ {
+ if (mips_elf_rel_dyn_section (info, FALSE))
+ {
+ if (! MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_REL, 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 (! MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_RELSZ, 0))
+ return FALSE;
-#if 0 /* FIXME */
- if (! MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_MIPS_ICHECKSUM, 0))
- return FALSE;
-#endif
+ if (! MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_RELENT, 0))
+ return FALSE;
+ }
-#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_RLD_VERSION, 0))
+ return FALSE;
- if (! MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_MIPS_BASE_ADDRESS, 0))
- return FALSE;
+ if (! MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_MIPS_FLAGS, 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_BASE_ADDRESS, 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_LOCAL_GOTNO, 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_SYMTABNO, 0))
+ return FALSE;
- if (! MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_MIPS_GOTSYM, 0))
- return FALSE;
+ if (! MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_MIPS_UNREFEXTNO, 0))
+ return FALSE;
- if (IRIX_COMPAT (dynobj) == ict_irix5
- && ! MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_MIPS_HIPAGENO, 0))
- return FALSE;
+ if (! MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_MIPS_GOTSYM, 0))
+ return FALSE;
- if (IRIX_COMPAT (dynobj) == ict_irix6
- && (bfd_get_section_by_name
- (dynobj, MIPS_ELF_OPTIONS_SECTION_NAME (dynobj)))
- && !MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_MIPS_OPTIONS, 0))
- return FALSE;
+ if (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;
}
+/* REL is a relocation in INPUT_BFD that is being copied to OUTPUT_BFD.
+ Adjust its R_ADDEND field so that it is correct for the output file.
+ LOCAL_SYMS and LOCAL_SECTIONS are arrays of INPUT_BFD's local symbols
+ and sections respectively; both use symbol indexes. */
+
+static void
+mips_elf_adjust_addend (bfd *output_bfd, struct bfd_link_info *info,
+ bfd *input_bfd, Elf_Internal_Sym *local_syms,
+ asection **local_sections, Elf_Internal_Rela *rel)
+{
+ unsigned int r_type, r_symndx;
+ Elf_Internal_Sym *sym;
+ asection *sec;
+
+ if (mips_elf_local_relocation_p (input_bfd, rel, local_sections, FALSE))
+ {
+ r_type = ELF_R_TYPE (output_bfd, rel->r_info);
+ if (r_type == R_MIPS16_GPREL
+ || r_type == R_MIPS_GPREL16
+ || r_type == R_MIPS_GPREL32
+ || r_type == R_MIPS_LITERAL)
+ {
+ rel->r_addend += _bfd_get_gp_value (input_bfd);
+ rel->r_addend -= _bfd_get_gp_value (output_bfd);
+ }
+
+ r_symndx = ELF_R_SYM (output_bfd, rel->r_info);
+ sym = local_syms + r_symndx;
+
+ /* Adjust REL's addend to account for section merging. */
+ if (!info->relocatable)
+ {
+ sec = local_sections[r_symndx];
+ _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel);
+ }
+
+ /* This would normally be done by the rela_normal code in elflink.c. */
+ if (ELF_ST_TYPE (sym->st_info) == STT_SECTION)
+ rel->r_addend += local_sections[r_symndx]->output_offset;
+ }
+}
+
/* Relocate a MIPS ELF section. */
bfd_boolean
@@ -6217,7 +7721,7 @@ _bfd_mips_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
for (rel = relocs; rel < relend; ++rel)
{
const char *name;
- bfd_vma value;
+ bfd_vma value = 0;
reloc_howto_type *howto;
bfd_boolean require_jalx;
/* TRUE if the relocation is a RELA relocation, rather than a
@@ -6225,8 +7729,54 @@ _bfd_mips_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
bfd_boolean rela_relocation_p = TRUE;
unsigned int r_type = ELF_R_TYPE (output_bfd, rel->r_info);
const char *msg;
+ unsigned long r_symndx;
+ asection *sec;
+ Elf_Internal_Shdr *symtab_hdr;
+ struct elf_link_hash_entry *h;
/* Find the relocation howto for this relocation. */
+ howto = MIPS_ELF_RTYPE_TO_HOWTO (input_bfd, r_type,
+ NEWABI_P (input_bfd)
+ && (MIPS_RELOC_RELA_P
+ (input_bfd, input_section,
+ rel - relocs)));
+
+ r_symndx = ELF_R_SYM (input_bfd, rel->r_info);
+ symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr;
+ if (mips_elf_local_relocation_p (input_bfd, rel, local_sections, FALSE))
+ {
+ sec = local_sections[r_symndx];
+ h = NULL;
+ }
+ else
+ {
+ unsigned long extsymoff;
+
+ extsymoff = 0;
+ if (!elf_bad_symtab (input_bfd))
+ extsymoff = symtab_hdr->sh_info;
+ h = elf_sym_hashes (input_bfd) [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;
+
+ sec = NULL;
+ if (h->root.type == bfd_link_hash_defined
+ || h->root.type == bfd_link_hash_defweak)
+ sec = h->root.u.def.section;
+ }
+
+ if (sec != NULL && elf_discarded_section (sec))
+ {
+ /* For relocs against symbols from removed linkonce sections,
+ or sections discarded by a linker script, we just want the
+ section contents zeroed. Avoid any special processing. */
+ _bfd_clear_contents (howto, input_bfd, contents + rel->r_offset);
+ rel->r_info = 0;
+ rel->r_addend = 0;
+ continue;
+ }
+
if (r_type == R_MIPS_64 && ! NEWABI_P (input_bfd))
{
/* Some 32-bit code uses R_MIPS_64. In particular, people use
@@ -6242,13 +7792,6 @@ _bfd_mips_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
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)
{
@@ -6266,27 +7809,37 @@ _bfd_mips_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
rel_hdr = elf_section_data (input_section)->rel_hdr2;
if (rel_hdr->sh_entsize == MIPS_ELF_REL_SIZE (input_bfd))
{
+ bfd_byte *location = contents + rel->r_offset;
+
/* Note that this is a REL relocation. */
rela_relocation_p = FALSE;
/* Get the addend, which is stored in the input file. */
+ _bfd_mips16_elf_reloc_unshuffle (input_bfd, r_type, FALSE,
+ location);
addend = mips_elf_obtain_contents (howto, rel, input_bfd,
contents);
+ _bfd_mips16_elf_reloc_shuffle(input_bfd, r_type, FALSE,
+ location);
+
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
+ if (r_type == R_MIPS_HI16 || r_type == R_MIPS16_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;
+ int lo16_type;
+
+ if (r_type == R_MIPS16_HI16)
+ lo16_type = R_MIPS16_LO16;
+ else
+ lo16_type = R_MIPS_LO16;
/* The combined value is the sum of the HI16 addend,
left-shifted by sixteen bits, and the LO16
@@ -6294,97 +7847,86 @@ _bfd_mips_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
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,
+ Scan ahead to find a matching LO16 relocation.
+
+ 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.
+
+ In some cases GCC dead code elimination removes
+ the LO16 but keeps the corresponding HI16. This
+ is strictly speaking a violation of the ABI but
+ not immediately harmful. */
+ lo16_relocation = mips_elf_next_relocation (input_bfd,
+ lo16_type,
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));
+ {
+ const char *name;
+
+ if (h)
+ name = h->root.root.string;
+ else
+ name = bfd_elf_sym_name (input_bfd, symtab_hdr,
+ local_syms + r_symndx,
+ sec);
+ (*_bfd_error_handler)
+ (_("%B: Can't find matching LO16 reloc against `%s' for %s at 0x%lx in section `%A'"),
+ input_bfd, input_section, name, howto->name,
+ rel->r_offset);
+ }
+ else
+ {
+ bfd_byte *lo16_location;
+ bfd_vma l;
+
+ lo16_location = contents + lo16_relocation->r_offset;
+
+ /* Obtain the addend kept there. */
+ lo16_howto = MIPS_ELF_RTYPE_TO_HOWTO (input_bfd,
+ lo16_type, FALSE);
+ _bfd_mips16_elf_reloc_unshuffle (input_bfd, lo16_type,
+ FALSE, lo16_location);
+ l = mips_elf_obtain_contents (lo16_howto,
+ lo16_relocation,
+ input_bfd, contents);
+ _bfd_mips16_elf_reloc_shuffle (input_bfd, lo16_type,
+ FALSE, lo16_location);
+ 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;
+ }
}
else
addend <<= howto->rightshift;
}
else
addend = rel->r_addend;
+ mips_elf_adjust_addend (output_bfd, info, input_bfd,
+ local_syms, local_sections, rel);
}
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 (!rela_relocation_p && rel->r_addend)
{
+ addend += rel->r_addend;
if (r_type == R_MIPS_HI16
- || r_type == R_MIPS_GOT16
- || r_type == R_MIPS_GNU_REL_HI16)
+ || r_type == R_MIPS_GOT16)
addend = mips_elf_high (addend);
else if (r_type == R_MIPS_HIGHER)
addend = mips_elf_higher (addend);
@@ -6493,7 +8035,7 @@ _bfd_mips_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
{
BFD_ASSERT (name != NULL);
if (! ((*info->callbacks->reloc_overflow)
- (info, name, howto->name, 0,
+ (info, NULL, name, howto->name, (bfd_vma) 0,
input_bfd, input_section, rel->r_offset)))
return FALSE;
}
@@ -6630,18 +8172,19 @@ _bfd_mips_elf_finish_dynamic_symbol (bfd *output_bfd,
Elf_Internal_Sym *sym)
{
bfd *dynobj;
- bfd_vma gval;
asection *sgot;
struct mips_got_info *g, *gg;
const char *name;
+ int idx;
+ struct mips_elf_link_hash_table *htab;
+ htab = mips_elf_hash_table (info);
dynobj = elf_hash_table (info)->dynobj;
- gval = sym->st_value;
- if (h->plt.offset != (bfd_vma) -1)
+ if (h->plt.offset != MINUS_ONE)
{
asection *s;
- bfd_byte stub[MIPS_FUNCTION_STUB_SIZE];
+ bfd_byte stub[MIPS_FUNCTION_STUB_BIG_SIZE];
/* This symbol has a stub. Set it up. */
@@ -6651,18 +8194,42 @@ _bfd_mips_elf_finish_dynamic_symbol (bfd *output_bfd,
MIPS_ELF_STUB_SECTION_NAME (dynobj));
BFD_ASSERT (s != NULL);
- /* FIXME: Can h->dynindex be more than 64K? */
- if (h->dynindx & 0xffff0000)
+ BFD_ASSERT ((htab->function_stub_size == MIPS_FUNCTION_STUB_BIG_SIZE)
+ || (h->dynindx <= 0xffff));
+
+ /* Values up to 2^31 - 1 are allowed. Larger values would cause
+ sign extension at runtime in the stub, resulting in a negative
+ index value. */
+ if (h->dynindx & ~0x7fffffff)
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);
+ idx = 0;
+ bfd_put_32 (output_bfd, STUB_LW (output_bfd), stub + idx);
+ idx += 4;
+ bfd_put_32 (output_bfd, STUB_MOVE (output_bfd), stub + idx);
+ idx += 4;
+ if (htab->function_stub_size == MIPS_FUNCTION_STUB_BIG_SIZE)
+ {
+ bfd_put_32 (output_bfd, STUB_LUI ((h->dynindx >> 16) & 0x7fff),
+ stub + idx);
+ idx += 4;
+ }
+ bfd_put_32 (output_bfd, STUB_JALR, stub + idx);
+ idx += 4;
+
+ /* If a large stub is not required and sign extension is not a
+ problem, then use legacy code in the stub. */
+ if (htab->function_stub_size == MIPS_FUNCTION_STUB_BIG_SIZE)
+ bfd_put_32 (output_bfd, STUB_ORI (h->dynindx & 0xffff), stub + idx);
+ else if (h->dynindx & ~0x7fff)
+ bfd_put_32 (output_bfd, STUB_LI16U (h->dynindx & 0xffff), stub + idx);
+ else
+ bfd_put_32 (output_bfd, STUB_LI16S (output_bfd, h->dynindx),
+ stub + idx);
- BFD_ASSERT (h->plt.offset <= s->_raw_size);
- memcpy (s->contents + h->plt.offset, stub, MIPS_FUNCTION_STUB_SIZE);
+ BFD_ASSERT (h->plt.offset <= s->size);
+ memcpy (s->contents + h->plt.offset, stub, htab->function_stub_size);
/* Mark the symbol as undefined. plt.offset != -1 occurs
only for the referenced symbol. */
@@ -6671,12 +8238,12 @@ _bfd_mips_elf_finish_dynamic_symbol (bfd *output_bfd,
/* 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;
+ sym->st_value = (s->output_section->vma + s->output_offset
+ + h->plt.offset);
}
BFD_ASSERT (h->dynindx != -1
- || (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) != 0);
+ || h->forced_local);
sgot = mips_elf_got_section (dynobj, FALSE);
BFD_ASSERT (sgot != NULL);
@@ -6693,11 +8260,11 @@ _bfd_mips_elf_finish_dynamic_symbol (bfd *output_bfd,
bfd_vma value;
value = sym->st_value;
- offset = mips_elf_global_got_index (dynobj, output_bfd, h);
+ offset = mips_elf_global_got_index (dynobj, output_bfd, h, R_MIPS_GOT16, info);
MIPS_ELF_PUT_WORD (output_bfd, value, sgot->contents + offset);
}
- if (g->next && h->dynindx != -1)
+ if (g->next && h->dynindx != -1 && h->type != STT_TLS)
{
struct mips_got_entry e, *p;
bfd_vma entry;
@@ -6708,6 +8275,7 @@ _bfd_mips_elf_finish_dynamic_symbol (bfd *output_bfd,
e.abfd = output_bfd;
e.symndx = -1;
e.d.h = (struct mips_elf_link_hash_entry *)h;
+ e.tls_type = 0;
for (g = g->next; g->next != gg; g = g->next)
{
@@ -6719,10 +8287,8 @@ _bfd_mips_elf_finish_dynamic_symbol (bfd *output_bfd,
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)))
+ && p->d.h->root.def_dynamic
+ && !p->d.h->root.def_regular))
{
/* Create an R_MIPS_REL32 relocation for this entry. Due to
the various compatibility problems, it's easier to mock
@@ -6754,7 +8320,7 @@ _bfd_mips_elf_finish_dynamic_symbol (bfd *output_bfd,
/* Mark _DYNAMIC and _GLOBAL_OFFSET_TABLE_ as absolute. */
name = h->root.root.string;
if (strcmp (name, "_DYNAMIC") == 0
- || strcmp (name, "_GLOBAL_OFFSET_TABLE_") == 0)
+ || h == elf_hash_table (info)->hgot)
sym->st_shndx = SHN_ABS;
else if (strcmp (name, "_DYNAMIC_LINK") == 0
|| strcmp (name, "_DYNAMIC_LINKING") == 0)
@@ -6825,13 +8391,274 @@ _bfd_mips_elf_finish_dynamic_symbol (bfd *output_bfd,
}
/* 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;
+ if (sym->st_other == STO_MIPS16)
+ sym->st_value &= ~1;
+
+ return TRUE;
+}
+
+/* Likewise, for VxWorks. */
+
+bfd_boolean
+_bfd_mips_vxworks_finish_dynamic_symbol (bfd *output_bfd,
+ struct bfd_link_info *info,
+ struct elf_link_hash_entry *h,
+ Elf_Internal_Sym *sym)
+{
+ bfd *dynobj;
+ asection *sgot;
+ struct mips_got_info *g;
+ struct mips_elf_link_hash_table *htab;
+
+ htab = mips_elf_hash_table (info);
+ dynobj = elf_hash_table (info)->dynobj;
+
+ if (h->plt.offset != (bfd_vma) -1)
+ {
+ bfd_byte *loc;
+ bfd_vma plt_address, plt_index, got_address, got_offset, branch_offset;
+ Elf_Internal_Rela rel;
+ static const bfd_vma *plt_entry;
+
+ BFD_ASSERT (h->dynindx != -1);
+ BFD_ASSERT (htab->splt != NULL);
+ BFD_ASSERT (h->plt.offset <= htab->splt->size);
+
+ /* Calculate the address of the .plt entry. */
+ plt_address = (htab->splt->output_section->vma
+ + htab->splt->output_offset
+ + h->plt.offset);
+
+ /* Calculate the index of the entry. */
+ plt_index = ((h->plt.offset - htab->plt_header_size)
+ / htab->plt_entry_size);
+
+ /* Calculate the address of the .got.plt entry. */
+ got_address = (htab->sgotplt->output_section->vma
+ + htab->sgotplt->output_offset
+ + plt_index * 4);
+
+ /* Calculate the offset of the .got.plt entry from
+ _GLOBAL_OFFSET_TABLE_. */
+ got_offset = mips_elf_gotplt_index (info, h);
+
+ /* Calculate the offset for the branch at the start of the PLT
+ entry. The branch jumps to the beginning of .plt. */
+ branch_offset = -(h->plt.offset / 4 + 1) & 0xffff;
+
+ /* Fill in the initial value of the .got.plt entry. */
+ bfd_put_32 (output_bfd, plt_address,
+ htab->sgotplt->contents + plt_index * 4);
+
+ /* Find out where the .plt entry should go. */
+ loc = htab->splt->contents + h->plt.offset;
+
+ if (info->shared)
+ {
+ plt_entry = mips_vxworks_shared_plt_entry;
+ bfd_put_32 (output_bfd, plt_entry[0] | branch_offset, loc);
+ bfd_put_32 (output_bfd, plt_entry[1] | plt_index, loc + 4);
+ }
+ else
+ {
+ bfd_vma got_address_high, got_address_low;
+
+ plt_entry = mips_vxworks_exec_plt_entry;
+ got_address_high = ((got_address + 0x8000) >> 16) & 0xffff;
+ got_address_low = got_address & 0xffff;
+
+ bfd_put_32 (output_bfd, plt_entry[0] | branch_offset, loc);
+ bfd_put_32 (output_bfd, plt_entry[1] | plt_index, loc + 4);
+ bfd_put_32 (output_bfd, plt_entry[2] | got_address_high, loc + 8);
+ bfd_put_32 (output_bfd, plt_entry[3] | got_address_low, loc + 12);
+ bfd_put_32 (output_bfd, plt_entry[4], loc + 16);
+ bfd_put_32 (output_bfd, plt_entry[5], loc + 20);
+ bfd_put_32 (output_bfd, plt_entry[6], loc + 24);
+ bfd_put_32 (output_bfd, plt_entry[7], loc + 28);
+
+ loc = (htab->srelplt2->contents
+ + (plt_index * 3 + 2) * sizeof (Elf32_External_Rela));
+
+ /* Emit a relocation for the .got.plt entry. */
+ rel.r_offset = got_address;
+ rel.r_info = ELF32_R_INFO (htab->root.hplt->indx, R_MIPS_32);
+ rel.r_addend = h->plt.offset;
+ bfd_elf32_swap_reloca_out (output_bfd, &rel, loc);
+
+ /* Emit a relocation for the lui of %hi(<.got.plt slot>). */
+ loc += sizeof (Elf32_External_Rela);
+ rel.r_offset = plt_address + 8;
+ rel.r_info = ELF32_R_INFO (htab->root.hgot->indx, R_MIPS_HI16);
+ rel.r_addend = got_offset;
+ bfd_elf32_swap_reloca_out (output_bfd, &rel, loc);
+
+ /* Emit a relocation for the addiu of %lo(<.got.plt slot>). */
+ loc += sizeof (Elf32_External_Rela);
+ rel.r_offset += 4;
+ rel.r_info = ELF32_R_INFO (htab->root.hgot->indx, R_MIPS_LO16);
+ bfd_elf32_swap_reloca_out (output_bfd, &rel, loc);
+ }
+
+ /* Emit an R_MIPS_JUMP_SLOT relocation against the .got.plt entry. */
+ loc = htab->srelplt->contents + plt_index * sizeof (Elf32_External_Rela);
+ rel.r_offset = got_address;
+ rel.r_info = ELF32_R_INFO (h->dynindx, R_MIPS_JUMP_SLOT);
+ rel.r_addend = 0;
+ bfd_elf32_swap_reloca_out (output_bfd, &rel, loc);
+
+ if (!h->def_regular)
+ sym->st_shndx = SHN_UNDEF;
+ }
+
+ BFD_ASSERT (h->dynindx != -1 || h->forced_local);
+
+ 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);
+
+ /* See if this symbol has an entry in the GOT. */
+ if (g->global_gotsym != NULL
+ && h->dynindx >= g->global_gotsym->dynindx)
+ {
+ bfd_vma offset;
+ Elf_Internal_Rela outrel;
+ bfd_byte *loc;
+ asection *s;
+
+ /* Install the symbol value in the GOT. */
+ offset = mips_elf_global_got_index (dynobj, output_bfd, h,
+ R_MIPS_GOT16, info);
+ MIPS_ELF_PUT_WORD (output_bfd, sym->st_value, sgot->contents + offset);
+
+ /* Add a dynamic relocation for it. */
+ s = mips_elf_rel_dyn_section (info, FALSE);
+ loc = s->contents + (s->reloc_count++ * sizeof (Elf32_External_Rela));
+ outrel.r_offset = (sgot->output_section->vma
+ + sgot->output_offset
+ + offset);
+ outrel.r_info = ELF32_R_INFO (h->dynindx, R_MIPS_32);
+ outrel.r_addend = 0;
+ bfd_elf32_swap_reloca_out (dynobj, &outrel, loc);
+ }
+
+ /* Emit a copy reloc, if needed. */
+ if (h->needs_copy)
+ {
+ Elf_Internal_Rela rel;
+
+ BFD_ASSERT (h->dynindx != -1);
+
+ rel.r_offset = (h->root.u.def.section->output_section->vma
+ + h->root.u.def.section->output_offset
+ + h->root.u.def.value);
+ rel.r_info = ELF32_R_INFO (h->dynindx, R_MIPS_COPY);
+ rel.r_addend = 0;
+ bfd_elf32_swap_reloca_out (output_bfd, &rel,
+ htab->srelbss->contents
+ + (htab->srelbss->reloc_count
+ * sizeof (Elf32_External_Rela)));
+ ++htab->srelbss->reloc_count;
+ }
+
+ /* If this is a mips16 symbol, force the value to be even. */
+ if (sym->st_other == STO_MIPS16)
+ sym->st_value &= ~1;
return TRUE;
}
+/* Install the PLT header for a VxWorks executable and finalize the
+ contents of .rela.plt.unloaded. */
+
+static void
+mips_vxworks_finish_exec_plt (bfd *output_bfd, struct bfd_link_info *info)
+{
+ Elf_Internal_Rela rela;
+ bfd_byte *loc;
+ bfd_vma got_value, got_value_high, got_value_low, plt_address;
+ static const bfd_vma *plt_entry;
+ struct mips_elf_link_hash_table *htab;
+
+ htab = mips_elf_hash_table (info);
+ plt_entry = mips_vxworks_exec_plt0_entry;
+
+ /* Calculate the value of _GLOBAL_OFFSET_TABLE_. */
+ got_value = (htab->root.hgot->root.u.def.section->output_section->vma
+ + htab->root.hgot->root.u.def.section->output_offset
+ + htab->root.hgot->root.u.def.value);
+
+ got_value_high = ((got_value + 0x8000) >> 16) & 0xffff;
+ got_value_low = got_value & 0xffff;
+
+ /* Calculate the address of the PLT header. */
+ plt_address = htab->splt->output_section->vma + htab->splt->output_offset;
+
+ /* Install the PLT header. */
+ loc = htab->splt->contents;
+ bfd_put_32 (output_bfd, plt_entry[0] | got_value_high, loc);
+ bfd_put_32 (output_bfd, plt_entry[1] | got_value_low, loc + 4);
+ bfd_put_32 (output_bfd, plt_entry[2], loc + 8);
+ bfd_put_32 (output_bfd, plt_entry[3], loc + 12);
+ bfd_put_32 (output_bfd, plt_entry[4], loc + 16);
+ bfd_put_32 (output_bfd, plt_entry[5], loc + 20);
+
+ /* Output the relocation for the lui of %hi(_GLOBAL_OFFSET_TABLE_). */
+ loc = htab->srelplt2->contents;
+ rela.r_offset = plt_address;
+ rela.r_info = ELF32_R_INFO (htab->root.hgot->indx, R_MIPS_HI16);
+ rela.r_addend = 0;
+ bfd_elf32_swap_reloca_out (output_bfd, &rela, loc);
+ loc += sizeof (Elf32_External_Rela);
+
+ /* Output the relocation for the following addiu of
+ %lo(_GLOBAL_OFFSET_TABLE_). */
+ rela.r_offset += 4;
+ rela.r_info = ELF32_R_INFO (htab->root.hgot->indx, R_MIPS_LO16);
+ bfd_elf32_swap_reloca_out (output_bfd, &rela, loc);
+ loc += sizeof (Elf32_External_Rela);
+
+ /* Fix up the remaining relocations. They may have the wrong
+ symbol index for _G_O_T_ or _P_L_T_ depending on the order
+ in which symbols were output. */
+ while (loc < htab->srelplt2->contents + htab->srelplt2->size)
+ {
+ Elf_Internal_Rela rel;
+
+ bfd_elf32_swap_reloca_in (output_bfd, loc, &rel);
+ rel.r_info = ELF32_R_INFO (htab->root.hplt->indx, R_MIPS_32);
+ bfd_elf32_swap_reloca_out (output_bfd, &rel, loc);
+ loc += sizeof (Elf32_External_Rela);
+
+ bfd_elf32_swap_reloca_in (output_bfd, loc, &rel);
+ rel.r_info = ELF32_R_INFO (htab->root.hgot->indx, R_MIPS_HI16);
+ bfd_elf32_swap_reloca_out (output_bfd, &rel, loc);
+ loc += sizeof (Elf32_External_Rela);
+
+ bfd_elf32_swap_reloca_in (output_bfd, loc, &rel);
+ rel.r_info = ELF32_R_INFO (htab->root.hgot->indx, R_MIPS_LO16);
+ bfd_elf32_swap_reloca_out (output_bfd, &rel, loc);
+ loc += sizeof (Elf32_External_Rela);
+ }
+}
+
+/* Install the PLT header for a VxWorks shared library. */
+
+static void
+mips_vxworks_finish_shared_plt (bfd *output_bfd, struct bfd_link_info *info)
+{
+ unsigned int i;
+ struct mips_elf_link_hash_table *htab;
+
+ htab = mips_elf_hash_table (info);
+
+ /* We just need to copy the entry byte-by-byte. */
+ for (i = 0; i < ARRAY_SIZE (mips_vxworks_shared_plt0_entry); i++)
+ bfd_put_32 (output_bfd, mips_vxworks_shared_plt0_entry[i],
+ htab->splt->contents + i * 4);
+}
+
/* Finish up the dynamic sections. */
bfd_boolean
@@ -6842,7 +8669,9 @@ _bfd_mips_elf_finish_dynamic_sections (bfd *output_bfd,
asection *sdyn;
asection *sgot;
struct mips_got_info *gg, *g;
+ struct mips_elf_link_hash_table *htab;
+ htab = mips_elf_hash_table (info);
dynobj = elf_hash_table (info)->dynobj;
sdyn = bfd_get_section_by_name (dynobj, ".dynamic");
@@ -6862,12 +8691,13 @@ _bfd_mips_elf_finish_dynamic_sections (bfd *output_bfd,
if (elf_hash_table (info)->dynamic_sections_created)
{
bfd_byte *b;
+ int dyn_to_skip = 0, dyn_skipped = 0;
BFD_ASSERT (sdyn != NULL);
BFD_ASSERT (g != NULL);
for (b = sdyn->contents;
- b < sdyn->contents + sdyn->_raw_size;
+ b < sdyn->contents + sdyn->size;
b += MIPS_ELF_DYN_SIZE (dynobj))
{
Elf_Internal_Dyn dyn;
@@ -6885,11 +8715,14 @@ _bfd_mips_elf_finish_dynamic_sections (bfd *output_bfd,
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_RELAENT:
+ BFD_ASSERT (htab->is_vxworks);
+ dyn.d_un.d_val = MIPS_ELF_RELA_SIZE (dynobj);
+ break;
+
case DT_STRSZ:
/* Rewrite DT_STRSZ. */
dyn.d_un.d_val =
@@ -6898,9 +8731,20 @@ _bfd_mips_elf_finish_dynamic_sections (bfd *output_bfd,
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;
+ if (htab->is_vxworks)
+ {
+ /* _GLOBAL_OFFSET_TABLE_ is defined to be the beginning
+ of the ".got" section in DYNOBJ. */
+ s = bfd_get_section_by_name (dynobj, name);
+ BFD_ASSERT (s != NULL);
+ dyn.d_un.d_ptr = s->output_section->vma + s->output_offset;
+ }
+ else
+ {
+ 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:
@@ -6912,7 +8756,11 @@ _bfd_mips_elf_finish_dynamic_sections (bfd *output_bfd,
break;
case DT_MIPS_TIME_STAMP:
- time ((time_t *) &dyn.d_un.d_val);
+ {
+ time_t t;
+ time (&t);
+ dyn.d_un.d_val = t;
+ }
break;
case DT_MIPS_ICHECKSUM:
@@ -6958,14 +8806,11 @@ _bfd_mips_elf_finish_dynamic_sections (bfd *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;
+ dyn.d_un.d_val = s->size / elemsize;
break;
case DT_MIPS_HIPAGENO:
- dyn.d_un.d_val = g->local_gotno - MIPS_RESERVED_GOTNO;
+ dyn.d_un.d_val = g->local_gotno - MIPS_RESERVED_GOTNO (info);
break;
case DT_MIPS_RLD_MAP:
@@ -6978,16 +8823,46 @@ _bfd_mips_elf_finish_dynamic_sections (bfd *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)));
+ case DT_RELASZ:
+ BFD_ASSERT (htab->is_vxworks);
+ /* The count does not include the JUMP_SLOT relocations. */
+ if (htab->srelplt)
+ dyn.d_un.d_val -= htab->srelplt->size;
+ break;
+
+ case DT_PLTREL:
+ BFD_ASSERT (htab->is_vxworks);
+ dyn.d_un.d_val = DT_RELA;
+ break;
+
+ case DT_PLTRELSZ:
+ BFD_ASSERT (htab->is_vxworks);
+ dyn.d_un.d_val = htab->srelplt->size;
+ break;
+
+ case DT_JMPREL:
+ BFD_ASSERT (htab->is_vxworks);
+ dyn.d_un.d_val = (htab->srelplt->output_section->vma
+ + htab->srelplt->output_offset);
+ break;
+
+ case DT_TEXTREL:
+ /* If we didn't need any text relocations after all, delete
+ the dynamic tag. */
+ if (!(info->flags & DF_TEXTREL))
+ {
+ dyn_to_skip = MIPS_ELF_DYN_SIZE (dynobj);
+ swap_out_p = FALSE;
+ }
+ break;
+
+ case DT_FLAGS:
+ /* If we didn't need any text relocations after all, clear
+ DF_TEXTREL from DT_FLAGS. */
+ if (!(info->flags & DF_TEXTREL))
+ dyn.d_un.d_val &= ~DF_TEXTREL;
+ else
+ swap_out_p = FALSE;
break;
default:
@@ -6995,25 +8870,53 @@ _bfd_mips_elf_finish_dynamic_sections (bfd *output_bfd,
break;
}
- if (swap_out_p)
+ if (swap_out_p || dyn_skipped)
(*get_elf_backend_data (dynobj)->s->swap_dyn_out)
- (dynobj, &dyn, b);
+ (dynobj, &dyn, b - dyn_skipped);
+
+ if (dyn_to_skip)
+ {
+ dyn_skipped += dyn_to_skip;
+ dyn_to_skip = 0;
+ }
}
+
+ /* Wipe out any trailing entries if we shifted down a dynamic tag. */
+ if (dyn_skipped > 0)
+ memset (b - dyn_skipped, 0, dyn_skipped);
}
- /* 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)
+ if (sgot != NULL && sgot->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 (htab->is_vxworks)
+ {
+ /* The first entry of the global offset table points to the
+ ".dynamic" section. The second is initialized by the
+ loader and contains the shared library identifier.
+ The third is also initialized by the loader and points
+ to the lazy resolution stub. */
+ MIPS_ELF_PUT_WORD (output_bfd,
+ sdyn->output_offset + sdyn->output_section->vma,
+ sgot->contents);
+ MIPS_ELF_PUT_WORD (output_bfd, 0,
+ sgot->contents + MIPS_ELF_GOT_SIZE (output_bfd));
+ MIPS_ELF_PUT_WORD (output_bfd, 0,
+ sgot->contents
+ + 2 * MIPS_ELF_GOT_SIZE (output_bfd));
+ }
+ else
+ {
+ /* 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. */
+ MIPS_ELF_PUT_WORD (output_bfd, (bfd_vma) 0, sgot->contents);
+ MIPS_ELF_PUT_WORD (output_bfd, (bfd_vma) 0x80000000,
+ sgot->contents + MIPS_ELF_GOT_SIZE (output_bfd));
+ }
- if (sgot != NULL)
- elf_section_data (sgot->output_section)->this_hdr.sh_entsize
- = MIPS_ELF_GOT_SIZE (output_bfd);
+ 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)
@@ -7026,7 +8929,8 @@ _bfd_mips_elf_finish_dynamic_sections (bfd *output_bfd,
for (g = gg->next; g->next != gg; g = g->next)
{
- bfd_vma index = g->next->local_gotno + g->next->global_gotno;
+ bfd_vma index = g->next->local_gotno + g->next->global_gotno
+ + g->next->tls_gotno;
MIPS_ELF_PUT_WORD (output_bfd, 0, sgot->contents
+ index++ * MIPS_ELF_GOT_SIZE (output_bfd));
@@ -7050,6 +8954,59 @@ _bfd_mips_elf_finish_dynamic_sections (bfd *output_bfd,
}
}
+ /* The generation of dynamic relocations for the non-primary gots
+ adds more dynamic relocations. We cannot count them until
+ here. */
+
+ if (elf_hash_table (info)->dynamic_sections_created)
+ {
+ bfd_byte *b;
+ bfd_boolean swap_out_p;
+
+ BFD_ASSERT (sdyn != NULL);
+
+ for (b = sdyn->contents;
+ b < sdyn->contents + sdyn->size;
+ b += MIPS_ELF_DYN_SIZE (dynobj))
+ {
+ Elf_Internal_Dyn dyn;
+ asection *s;
+
+ /* 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_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 (info, FALSE);
+ dyn.d_un.d_val = (s->reloc_count
+ * (ABI_64_P (output_bfd)
+ ? sizeof (Elf64_Mips_External_Rel)
+ : sizeof (Elf32_External_Rel)));
+ /* Adjust the section size too. Tools like the prelinker
+ can reasonably expect the values to the same. */
+ elf_section_data (s->output_section)->this_hdr.sh_size
+ = dyn.d_un.d_val;
+ break;
+
+ default:
+ swap_out_p = FALSE;
+ break;
+ }
+
+ if (swap_out_p)
+ (*get_elf_backend_data (dynobj)->s->swap_dyn_out)
+ (dynobj, &dyn, b);
+ }
+ }
+
{
asection *s;
Elf32_compact_rel cpt;
@@ -7078,32 +9035,45 @@ _bfd_mips_elf_finish_dynamic_sections (bfd *output_bfd,
{
file_ptr dummy_offset;
- BFD_ASSERT (s->_raw_size >= MIPS_FUNCTION_STUB_SIZE);
- dummy_offset = s->_raw_size - MIPS_FUNCTION_STUB_SIZE;
+ BFD_ASSERT (s->size >= htab->function_stub_size);
+ dummy_offset = s->size - htab->function_stub_size;
memset (s->contents + dummy_offset, 0,
- MIPS_FUNCTION_STUB_SIZE);
+ htab->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))
+ /* The psABI says that the dynamic relocations must be sorted in
+ increasing order of r_symndx. The VxWorks EABI doesn't require
+ this, and because the code below handles REL rather than RELA
+ relocations, using it for VxWorks would be outright harmful. */
+ if (!htab->is_vxworks)
{
- 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);
+ s = mips_elf_rel_dyn_section (info, FALSE);
+ if (s != NULL
+ && s->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);
+ }
}
}
+ if (htab->is_vxworks && htab->splt->size > 0)
+ {
+ if (info->shared)
+ mips_vxworks_finish_shared_plt (output_bfd, info);
+ else
+ mips_vxworks_finish_exec_plt (output_bfd, info);
+ }
return TRUE;
}
@@ -7249,7 +9219,7 @@ _bfd_mips_elf_final_write_processing (bfd *abfd,
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);
+ && CONST_STRNEQ (name, ".gptab."));
sec = bfd_get_section_by_name (abfd, name + sizeof ".gptab" - 1);
BFD_ASSERT (sec != NULL);
(*hdrpp)->sh_info = elf_section_data (sec)->this_idx;
@@ -7259,8 +9229,7 @@ _bfd_mips_elf_final_write_processing (bfd *abfd,
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);
+ && CONST_STRNEQ (name, ".MIPS.content"));
sec = bfd_get_section_by_name (abfd,
name + sizeof ".MIPS.content" - 1);
BFD_ASSERT (sec != NULL);
@@ -7280,13 +9249,12 @@ _bfd_mips_elf_final_write_processing (bfd *abfd,
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)
+ if (CONST_STRNEQ (name, ".MIPS.events"))
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);
+ BFD_ASSERT (CONST_STRNEQ (name, ".MIPS.post_rel"));
sec = bfd_get_section_by_name (abfd,
(name
+ sizeof ".MIPS.post_rel" - 1));
@@ -7303,7 +9271,8 @@ _bfd_mips_elf_final_write_processing (bfd *abfd,
segments. */
int
-_bfd_mips_elf_additional_program_headers (bfd *abfd)
+_bfd_mips_elf_additional_program_headers (bfd *abfd,
+ struct bfd_link_info *info ATTRIBUTE_UNUSED)
{
asection *s;
int ret = 0;
@@ -7325,6 +9294,12 @@ _bfd_mips_elf_additional_program_headers (bfd *abfd)
&& bfd_get_section_by_name (abfd, ".mdebug"))
++ret;
+ /* Allocate a PT_NULL header in dynamic objects. See
+ _bfd_mips_elf_modify_segment_map for details. */
+ if (!SGI_COMPAT (abfd)
+ && bfd_get_section_by_name (abfd, ".dynamic"))
+ ++ret;
+
return ret;
}
@@ -7394,15 +9369,18 @@ _bfd_mips_elf_modify_segment_map (bfd *abfd,
|| (*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;
+ if (*pm == NULL || (*pm)->p_type != PT_MIPS_OPTIONS)
+ {
+ 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
@@ -7472,8 +9450,18 @@ _bfd_mips_elf_modify_segment_map (bfd *abfd,
m->p_flags_valid = 1;
}
}
- if (m != NULL
- && m->count == 1 && strcmp (m->sections[0]->name, ".dynamic") == 0)
+ /* GNU/Linux binaries do not need the extended PT_DYNAMIC section.
+ glibc's dynamic linker has traditionally derived the number of
+ tags from the p_filesz field, and sometimes allocates stack
+ arrays of that size. An overly-big PT_DYNAMIC segment can
+ be actively harmful in such cases. Making PT_DYNAMIC contain
+ other sections can also make life hard for the prelinker,
+ which might move one of the other sections to a different
+ PT_LOAD segment. */
+ if (SGI_COMPAT (abfd)
+ && m != NULL
+ && m->count == 1
+ && strcmp (m->sections[0]->name, ".dynamic") == 0)
{
static const char *sec_names[] =
{
@@ -7494,9 +9482,7 @@ _bfd_mips_elf_modify_segment_map (bfd *abfd,
if (low > s->vma)
low = s->vma;
- sz = s->_cooked_size;
- if (sz == 0)
- sz = s->_raw_size;
+ sz = s->size;
if (high < s->vma + sz)
high = s->vma + sz;
}
@@ -7506,9 +9492,7 @@ _bfd_mips_elf_modify_segment_map (bfd *abfd,
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))
+ && s->vma + s->size <= high)
++c;
amt = sizeof *n + (bfd_size_type) (c - 1) * sizeof (asection *);
@@ -7523,9 +9507,7 @@ _bfd_mips_elf_modify_segment_map (bfd *abfd,
{
if ((s->flags & SEC_LOAD) != 0
&& s->vma >= low
- && ((s->vma
- + (s->_cooked_size != 0 ?
- s->_cooked_size : s->_raw_size)) <= high))
+ && s->vma + s->size <= high)
{
n->sections[i] = s;
++i;
@@ -7536,6 +9518,38 @@ _bfd_mips_elf_modify_segment_map (bfd *abfd,
}
}
+ /* Allocate a spare program header in dynamic objects so that tools
+ like the prelinker can add an extra PT_LOAD entry.
+
+ If the prelinker needs to make room for a new PT_LOAD entry, its
+ standard procedure is to move the first (read-only) sections into
+ the new (writable) segment. However, the MIPS ABI requires
+ .dynamic to be in a read-only segment, and the section will often
+ start within sizeof (ElfNN_Phdr) bytes of the last program header.
+
+ Although the prelinker could in principle move .dynamic to a
+ writable segment, it seems better to allocate a spare program
+ header instead, and avoid the need to move any sections.
+ There is a long tradition of allocating spare dynamic tags,
+ so allocating a spare program header seems like a natural
+ extension. */
+ if (!SGI_COMPAT (abfd)
+ && bfd_get_section_by_name (abfd, ".dynamic"))
+ {
+ for (pm = &elf_tdata (abfd)->segment_map; *pm != NULL; pm = &(*pm)->next)
+ if ((*pm)->p_type == PT_NULL)
+ break;
+ if (*pm == NULL)
+ {
+ m = bfd_zalloc (abfd, sizeof (*m));
+ if (m == NULL)
+ return FALSE;
+
+ m->p_type = PT_NULL;
+ *pm = m;
+ }
+ }
+
return TRUE;
}
@@ -7544,7 +9558,7 @@ _bfd_mips_elf_modify_segment_map (bfd *abfd,
asection *
_bfd_mips_elf_gc_mark_hook (asection *sec,
- struct bfd_link_info *info ATTRIBUTE_UNUSED,
+ struct bfd_link_info *info,
Elf_Internal_Rela *rel,
struct elf_link_hash_entry *h,
Elf_Internal_Sym *sym)
@@ -7552,32 +9566,14 @@ _bfd_mips_elf_gc_mark_hook (asection *sec,
/* ??? 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);
+ switch (ELF_R_TYPE (sec->owner, rel->r_info))
+ {
+ case R_MIPS_GNU_VTINHERIT:
+ case R_MIPS_GNU_VTENTRY:
+ return NULL;
+ }
- return NULL;
+ return _bfd_elf_gc_mark_hook (sec, info, rel, h, sym);
}
/* Update the got entry reference counts for the section being removed. */
@@ -7632,13 +9628,13 @@ _bfd_mips_elf_gc_sweep_hook (bfd *abfd ATTRIBUTE_UNUSED,
_bfd_elf_link_hash_copy_indirect copy the flags for us. */
void
-_bfd_mips_elf_copy_indirect_symbol (const struct elf_backend_data *bed,
+_bfd_mips_elf_copy_indirect_symbol (struct bfd_link_info *info,
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);
+ _bfd_elf_link_hash_copy_indirect (info, dir, ind);
if (ind->root.type != bfd_link_hash_indirect)
return;
@@ -7650,6 +9646,9 @@ _bfd_mips_elf_copy_indirect_symbol (const struct elf_backend_data *bed,
dirmips->readonly_reloc = TRUE;
if (indmips->no_fn_stub)
dirmips->no_fn_stub = TRUE;
+
+ if (dirmips->tls_type == 0)
+ dirmips->tls_type = indmips->tls_type;
}
void
@@ -7668,11 +9667,10 @@ _bfd_mips_elf_hide_symbol (struct bfd_link_info *info,
h->forced_local = force_local;
dynobj = elf_hash_table (info)->dynobj;
- if (dynobj != NULL && force_local)
+ if (dynobj != NULL && force_local && h->root.type != STT_TLS
+ && (got = mips_elf_got_section (dynobj, TRUE)) != NULL
+ && (g = mips_elf_section_data (got)->u.got_info) != NULL)
{
- got = mips_elf_got_section (dynobj, FALSE);
- g = mips_elf_section_data (got)->u.got_info;
-
if (g->next)
{
struct mips_got_entry e;
@@ -7686,6 +9684,7 @@ _bfd_mips_elf_hide_symbol (struct bfd_link_info *info,
e.abfd = dynobj;
e.symndx = -1;
e.d.h = h;
+ e.tls_type = 0;
for (g = g->next; g != gg; g = g->next)
if (htab_find (g->got_entries, &e))
@@ -7738,15 +9737,15 @@ _bfd_mips_elf_discard_info (bfd *abfd, struct elf_reloc_cookie *cookie,
o = bfd_get_section_by_name (abfd, ".pdr");
if (! o)
return FALSE;
- if (o->_raw_size == 0)
+ if (o->size == 0)
return FALSE;
- if (o->_raw_size % PDR_SIZE != 0)
+ if (o->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);
+ tdata = bfd_zmalloc (o->size / PDR_SIZE);
if (! tdata)
return FALSE;
@@ -7761,7 +9760,7 @@ _bfd_mips_elf_discard_info (bfd *abfd, struct elf_reloc_cookie *cookie,
cookie->rel = cookie->rels;
cookie->relend = cookie->rels + o->reloc_count;
- for (i = 0, skip = 0; i < o->_raw_size / PDR_SIZE; i ++)
+ for (i = 0, skip = 0; i < o->size / PDR_SIZE; i ++)
{
if (bfd_elf_reloc_symbol_deleted_p (i * PDR_SIZE, cookie))
{
@@ -7773,7 +9772,7 @@ _bfd_mips_elf_discard_info (bfd *abfd, struct elf_reloc_cookie *cookie,
if (skip != 0)
{
mips_elf_section_data (o)->u.tdata = tdata;
- o->_cooked_size = o->_raw_size - skip * PDR_SIZE;
+ o->size -= skip * PDR_SIZE;
ret = TRUE;
}
else
@@ -7794,8 +9793,9 @@ _bfd_mips_elf_ignore_discarded_relocs (asection *sec)
}
bfd_boolean
-_bfd_mips_elf_write_section (bfd *output_bfd, asection *sec,
- bfd_byte *contents)
+_bfd_mips_elf_write_section (bfd *output_bfd,
+ struct bfd_link_info *link_info ATTRIBUTE_UNUSED,
+ asection *sec, bfd_byte *contents)
{
bfd_byte *to, *from, *end;
int i;
@@ -7807,7 +9807,7 @@ _bfd_mips_elf_write_section (bfd *output_bfd, asection *sec,
return FALSE;
to = contents;
- end = contents + sec->_raw_size;
+ end = contents + sec->size;
for (from = contents, i = 0;
from < end;
from += PDR_SIZE, i++)
@@ -7819,7 +9819,7 @@ _bfd_mips_elf_write_section (bfd *output_bfd, asection *sec,
to += PDR_SIZE;
}
bfd_set_section_contents (output_bfd, sec->output_section, contents,
- sec->output_offset, sec->_cooked_size);
+ sec->output_offset, sec->size);
return TRUE;
}
@@ -7932,6 +9932,20 @@ _bfd_mips_elf_find_nearest_line (bfd *abfd, asection *section,
filename_ptr, functionname_ptr,
line_ptr);
}
+
+bfd_boolean
+_bfd_mips_elf_find_inliner_info (bfd *abfd,
+ const char **filename_ptr,
+ const char **functionname_ptr,
+ unsigned int *line_ptr)
+{
+ bfd_boolean found;
+ found = _bfd_dwarf2_find_inliner_info (abfd, filename_ptr,
+ functionname_ptr, line_ptr,
+ & elf_tdata (abfd)->dwarf2_find_line_info);
+ return found;
+}
+
/* When are writing out the .options or .MIPS.options section,
remember the bytes we are writing out, so that we can install the
@@ -7942,7 +9956,7 @@ _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)
+ if (MIPS_ELF_OPTIONS_SECTION_NAME_P (section->name))
{
bfd_byte *c;
@@ -7956,13 +9970,7 @@ _bfd_mips_elf_set_section_contents (bfd *abfd, sec_ptr section,
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);
+ c = bfd_zalloc (abfd, section->size);
if (c == NULL)
return FALSE;
mips_elf_section_data (section)->u.tdata = c;
@@ -7990,6 +9998,7 @@ _bfd_elf_mips_get_relocated_section_contents
/* Get enough memory to hold the stuff */
bfd *input_bfd = link_order->u.indirect.section->owner;
asection *input_section = link_order->u.indirect.section;
+ bfd_size_type sz;
long reloc_size = bfd_get_reloc_upper_bound (input_bfd, input_section);
arelent **reloc_vector = NULL;
@@ -8003,14 +10012,10 @@ _bfd_elf_mips_get_relocated_section_contents
goto error_return;
/* read in the section */
- if (!bfd_get_section_contents (input_bfd, input_section, data, 0,
- input_section->_raw_size))
+ sz = input_section->rawsize ? input_section->rawsize : input_section->size;
+ if (!bfd_get_section_contents (input_bfd, input_section, data, 0, sz))
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,
@@ -8074,30 +10079,21 @@ _bfd_elf_mips_get_relocated_section_contents
/* 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 we've managed to find the gp and have a special
+ function for the relocation then go ahead, else default
+ to the generic handling. */
+ if (gp_found
+ && (*parent)->howto->special_function
+ == _bfd_mips_elf32_gprel16_reloc)
+ r = _bfd_mips_elf_gprel16_with_gp (input_bfd, sym, *parent,
+ input_section, relocatable,
+ data, gp);
+ else
+ r = bfd_perform_relocation (input_bfd, *parent, data,
+ input_section,
+ relocatable ? abfd : NULL,
+ &error_message);
if (relocatable)
{
@@ -8115,8 +10111,7 @@ _bfd_elf_mips_get_relocated_section_contents
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)))
+ input_bfd, input_section, (*parent)->address, TRUE)))
goto error_return;
break;
case bfd_reloc_dangerous:
@@ -8128,7 +10123,8 @@ _bfd_elf_mips_get_relocated_section_contents
break;
case bfd_reloc_overflow:
if (!((*link_info->callbacks->reloc_overflow)
- (link_info, bfd_asymbol_name (*(*parent)->sym_ptr_ptr),
+ (link_info, NULL,
+ bfd_asymbol_name (*(*parent)->sym_ptr_ptr),
(*parent)->howto->name, (*parent)->addend,
input_bfd, input_section, (*parent)->address)))
goto error_return;
@@ -8164,8 +10160,9 @@ _bfd_mips_elf_link_hash_table_create (bfd *abfd)
if (ret == NULL)
return NULL;
- if (! _bfd_elf_link_hash_table_init (&ret->root, abfd,
- mips_elf_link_hash_newfunc))
+ if (!_bfd_elf_link_hash_table_init (&ret->root, abfd,
+ mips_elf_link_hash_newfunc,
+ sizeof (struct mips_elf_link_hash_entry)))
{
free (ret);
return NULL;
@@ -8181,9 +10178,37 @@ _bfd_mips_elf_link_hash_table_create (bfd *abfd)
ret->use_rld_obj_head = FALSE;
ret->rld_value = 0;
ret->mips16_stubs_seen = FALSE;
+ ret->is_vxworks = FALSE;
+ ret->srelbss = NULL;
+ ret->sdynbss = NULL;
+ ret->srelplt = NULL;
+ ret->srelplt2 = NULL;
+ ret->sgotplt = NULL;
+ ret->splt = NULL;
+ ret->plt_header_size = 0;
+ ret->plt_entry_size = 0;
+ ret->function_stub_size = 0;
return &ret->root.root;
}
+
+/* Likewise, but indicate that the target is VxWorks. */
+
+struct bfd_link_hash_table *
+_bfd_mips_vxworks_link_hash_table_create (bfd *abfd)
+{
+ struct bfd_link_hash_table *ret;
+
+ ret = _bfd_mips_elf_link_hash_table_create (abfd);
+ if (ret)
+ {
+ struct mips_elf_link_hash_table *htab;
+
+ htab = (struct mips_elf_link_hash_table *) ret;
+ htab->is_vxworks = 1;
+ }
+ return ret;
+}
/* We need to use a special link routine to handle the .reginfo and
the .mdebug sections. We need to merge all instances of these
@@ -8192,21 +10217,21 @@ _bfd_mips_elf_link_hash_table_create (bfd *abfd)
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;
+ const struct elf_backend_data *bed = get_elf_backend_data (abfd);
+ const struct ecoff_debug_swap *swap = bed->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;
+ struct mips_elf_link_hash_table *htab;
static const char * const secname[] =
{
@@ -8223,11 +10248,13 @@ _bfd_mips_elf_final_link (bfd *abfd, struct bfd_link_info *info)
generic size_dynamic_sections renumbered them out from under us.
Rather than trying somehow to prevent the renumbering, just do
the sort again. */
+ htab = mips_elf_hash_table (info);
if (elf_hash_table (info)->dynamic_sections_created)
{
bfd *dynobj;
asection *got;
struct mips_got_info *g;
+ bfd_size_type dynsecsymcount;
/* 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
@@ -8235,9 +10262,9 @@ _bfd_mips_elf_final_link (bfd *abfd, struct bfd_link_info *info)
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)))
+
+ dynsecsymcount = count_section_dynsyms (abfd, info);
+ if (! mips_elf_sort_hash_table (info, dynsecsymcount + 1))
return FALSE;
/* Make sure we didn't grow the global .got region. */
@@ -8251,47 +10278,6 @@ _bfd_mips_elf_final_link (bfd *abfd, struct bfd_link_info *info)
<= 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)
{
@@ -8302,6 +10288,14 @@ _bfd_mips_elf_final_link (bfd *abfd, struct bfd_link_info *info)
elf_gp (abfd) = (h->u.def.value
+ h->u.def.section->output_section->vma
+ h->u.def.section->output_offset);
+ else if (htab->is_vxworks
+ && (h = bfd_link_hash_lookup (info->hash,
+ "_GLOBAL_OFFSET_TABLE_",
+ FALSE, FALSE, TRUE))
+ && h->type == bfd_link_hash_defined)
+ elf_gp (abfd) = (h->u.def.section->output_section->vma
+ + h->u.def.section->output_offset
+ + h->u.def.value);
else if (info->relocatable)
{
bfd_vma lo = MINUS_ONE;
@@ -8313,7 +10307,7 @@ _bfd_mips_elf_final_link (bfd *abfd, struct bfd_link_info *info)
lo = o->vma;
/* And calculate GP relative to that. */
- elf_gp (abfd) = lo + ELF_MIPS_GP_OFFSET (abfd);
+ elf_gp (abfd) = lo + ELF_MIPS_GP_OFFSET (info);
}
else
{
@@ -8338,7 +10332,7 @@ _bfd_mips_elf_final_link (bfd *abfd, struct bfd_link_info *info)
/* 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)
+ for (p = o->map_head.link_order; p != NULL; p = p->next)
{
asection *input_section;
bfd *input_bfd;
@@ -8355,11 +10349,6 @@ _bfd_mips_elf_final_link (bfd *abfd, struct bfd_link_info *info)
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;
@@ -8382,11 +10371,11 @@ _bfd_mips_elf_final_link (bfd *abfd, struct bfd_link_info *info)
}
/* Size has been set in _bfd_mips_elf_always_size_sections. */
- BFD_ASSERT(o->_raw_size == sizeof (Elf32_External_RegInfo));
+ BFD_ASSERT(o->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;
+ o->map_head.link_order = NULL;
reginfo_sec = o;
}
@@ -8450,7 +10439,7 @@ _bfd_mips_elf_final_link (bfd *abfd, struct bfd_link_info *info)
if (s != NULL)
{
esym.asym.value = s->vma;
- last = s->vma + s->_raw_size;
+ last = s->vma + s->size;
}
else
esym.asym.value = last;
@@ -8459,7 +10448,7 @@ _bfd_mips_elf_final_link (bfd *abfd, struct bfd_link_info *info)
return FALSE;
}
- for (p = o->link_order_head; p != NULL; p = p->next)
+ for (p = o->map_head.link_order; p != NULL; p = p->next)
{
asection *input_section;
bfd *input_bfd;
@@ -8491,7 +10480,7 @@ _bfd_mips_elf_final_link (bfd *abfd, struct bfd_link_info *info)
input_swap = (get_elf_backend_data (input_bfd)
->elf_backend_ecoff_debug_swap);
- BFD_ASSERT (p->size == input_section->_raw_size);
+ BFD_ASSERT (p->size == input_section->size);
/* The ECOFF linking code expects that we have already
read in the debugging information and set up an
@@ -8570,9 +10559,10 @@ _bfd_mips_elf_final_link (bfd *abfd, struct bfd_link_info *info)
flagword flags = (SEC_HAS_CONTENTS | SEC_IN_MEMORY
| SEC_LINKER_CREATED | SEC_READONLY);
- rtproc_sec = bfd_make_section (abfd, ".rtproc");
+ rtproc_sec = bfd_make_section_with_flags (abfd,
+ ".rtproc",
+ flags);
if (rtproc_sec == NULL
- || ! bfd_set_section_flags (abfd, rtproc_sec, flags)
|| ! bfd_set_section_alignment (abfd, rtproc_sec, 4))
return FALSE;
}
@@ -8595,16 +10585,16 @@ _bfd_mips_elf_final_link (bfd *abfd, struct bfd_link_info *info)
return FALSE;
/* Set the size of the .mdebug section. */
- o->_raw_size = bfd_ecoff_debug_size (abfd, &debug, swap);
+ o->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;
+ o->map_head.link_order = NULL;
mdebug_sec = o;
}
- if (strncmp (o->name, ".gptab.", sizeof ".gptab." - 1) == 0)
+ if (CONST_STRNEQ (o->name, ".gptab."))
{
const char *subname;
unsigned int c;
@@ -8618,7 +10608,7 @@ _bfd_mips_elf_final_link (bfd *abfd, struct bfd_link_info *info)
not used in executables files. */
if (! info->relocatable)
{
- for (p = o->link_order_head; p != NULL; p = p->next)
+ for (p = o->map_head.link_order; p != NULL; p = p->next)
{
asection *input_section;
@@ -8638,14 +10628,10 @@ _bfd_mips_elf_final_link (bfd *abfd, struct bfd_link_info *info)
/* Skip this section later on (I don't think this
currently matters, but someday it might). */
- o->link_order_head = NULL;
+ o->map_head.link_order = NULL;
/* Really remove the section. */
- for (secpp = &abfd->sections;
- *secpp != o;
- secpp = &(*secpp)->next)
- ;
- bfd_section_list_remove (abfd, secpp);
+ bfd_section_list_remove (abfd, o);
--abfd->section_count;
continue;
@@ -8692,7 +10678,7 @@ _bfd_mips_elf_final_link (bfd *abfd, struct bfd_link_info *info)
tab[0].gt_header.gt_unused = 0;
/* Combine the input sections. */
- for (p = o->link_order_head; p != NULL; p = p->next)
+ for (p = o->map_head.link_order; p != NULL; p = p->next)
{
asection *input_section;
bfd *input_bfd;
@@ -8713,7 +10699,7 @@ _bfd_mips_elf_final_link (bfd *abfd, struct bfd_link_info *info)
/* 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);
+ size = input_section->size;
last = 0;
for (gpentry = sizeof (Elf32_External_gptab);
gpentry < size;
@@ -8810,12 +10796,12 @@ _bfd_mips_elf_final_link (bfd *abfd, struct bfd_link_info *info)
bfd_mips_elf32_swap_gptab_out (abfd, tab + j, ext_tab + j);
free (tab);
- o->_raw_size = c * sizeof (Elf32_External_gptab);
+ o->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;
+ o->map_head.link_order = NULL;
}
}
@@ -8849,7 +10835,7 @@ _bfd_mips_elf_final_link (bfd *abfd, struct bfd_link_info *info)
{
if (! bfd_set_section_contents (abfd, gptab_data_sec,
gptab_data_sec->contents,
- 0, gptab_data_sec->_raw_size))
+ 0, gptab_data_sec->size))
return FALSE;
}
@@ -8857,7 +10843,7 @@ _bfd_mips_elf_final_link (bfd *abfd, struct bfd_link_info *info)
{
if (! bfd_set_section_contents (abfd, gptab_bss_sec,
gptab_bss_sec->contents,
- 0, gptab_bss_sec->_raw_size))
+ 0, gptab_bss_sec->size))
return FALSE;
}
@@ -8868,7 +10854,7 @@ _bfd_mips_elf_final_link (bfd *abfd, struct bfd_link_info *info)
{
if (! bfd_set_section_contents (abfd, rtproc_sec,
rtproc_sec->contents,
- 0, rtproc_sec->_raw_size))
+ 0, rtproc_sec->size))
return FALSE;
}
}
@@ -8986,6 +10972,112 @@ mips_32bit_flags_p (flagword flags)
}
+/* Merge object attributes from IBFD into OBFD. Raise an error if
+ there are conflicting attributes. */
+static bfd_boolean
+mips_elf_merge_obj_attributes (bfd *ibfd, bfd *obfd)
+{
+ obj_attribute *in_attr;
+ obj_attribute *out_attr;
+
+ if (!elf_known_obj_attributes_proc (obfd)[0].i)
+ {
+ /* This is the first object. Copy the attributes. */
+ _bfd_elf_copy_obj_attributes (ibfd, obfd);
+
+ /* Use the Tag_null value to indicate the attributes have been
+ initialized. */
+ elf_known_obj_attributes_proc (obfd)[0].i = 1;
+
+ return TRUE;
+ }
+
+ /* Check for conflicting Tag_GNU_MIPS_ABI_FP attributes and merge
+ non-conflicting ones. */
+ in_attr = elf_known_obj_attributes (ibfd)[OBJ_ATTR_GNU];
+ out_attr = elf_known_obj_attributes (obfd)[OBJ_ATTR_GNU];
+ if (in_attr[Tag_GNU_MIPS_ABI_FP].i != out_attr[Tag_GNU_MIPS_ABI_FP].i)
+ {
+ out_attr[Tag_GNU_MIPS_ABI_FP].type = 1;
+ if (out_attr[Tag_GNU_MIPS_ABI_FP].i == 0)
+ out_attr[Tag_GNU_MIPS_ABI_FP].i = in_attr[Tag_GNU_MIPS_ABI_FP].i;
+ else if (in_attr[Tag_GNU_MIPS_ABI_FP].i == 0)
+ ;
+ else if (in_attr[Tag_GNU_MIPS_ABI_FP].i > 3)
+ _bfd_error_handler
+ (_("Warning: %B uses unknown floating point ABI %d"), ibfd,
+ in_attr[Tag_GNU_MIPS_ABI_FP].i);
+ else if (out_attr[Tag_GNU_MIPS_ABI_FP].i > 3)
+ _bfd_error_handler
+ (_("Warning: %B uses unknown floating point ABI %d"), obfd,
+ out_attr[Tag_GNU_MIPS_ABI_FP].i);
+ else
+ switch (out_attr[Tag_GNU_MIPS_ABI_FP].i)
+ {
+ case 1:
+ switch (in_attr[Tag_GNU_MIPS_ABI_FP].i)
+ {
+ case 2:
+ _bfd_error_handler
+ (_("Warning: %B uses -msingle-float, %B uses -mdouble-float"),
+ obfd, ibfd);
+
+ case 3:
+ _bfd_error_handler
+ (_("Warning: %B uses hard float, %B uses soft float"),
+ obfd, ibfd);
+ break;
+
+ default:
+ abort ();
+ }
+ break;
+
+ case 2:
+ switch (in_attr[Tag_GNU_MIPS_ABI_FP].i)
+ {
+ case 1:
+ _bfd_error_handler
+ (_("Warning: %B uses -msingle-float, %B uses -mdouble-float"),
+ ibfd, obfd);
+
+ case 3:
+ _bfd_error_handler
+ (_("Warning: %B uses hard float, %B uses soft float"),
+ obfd, ibfd);
+ break;
+
+ default:
+ abort ();
+ }
+ break;
+
+ case 3:
+ switch (in_attr[Tag_GNU_MIPS_ABI_FP].i)
+ {
+ case 1:
+ case 2:
+ _bfd_error_handler
+ (_("Warning: %B uses hard float, %B uses soft float"),
+ ibfd, obfd);
+ break;
+
+ default:
+ abort ();
+ }
+ break;
+
+ default:
+ abort ();
+ }
+ }
+
+ /* Merge Tag_compatibility attributes and any common GNU ones. */
+ _bfd_elf_merge_object_attributes (ibfd, obfd);
+
+ return TRUE;
+}
+
/* Merge backend specific data from an object file to the output
object file when linking. */
@@ -9002,8 +11094,8 @@ _bfd_mips_elf_merge_private_bfd_data (bfd *ibfd, bfd *obfd)
if (! _bfd_generic_verify_endian_match (ibfd, obfd))
{
(*_bfd_error_handler)
- (_("%s: endianness incompatible with that of the selected emulation"),
- bfd_archive_filename (ibfd));
+ (_("%B: endianness incompatible with that of the selected emulation"),
+ ibfd);
return FALSE;
}
@@ -9014,11 +11106,14 @@ _bfd_mips_elf_merge_private_bfd_data (bfd *ibfd, bfd *obfd)
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));
+ (_("%B: ABI is incompatible with that of the selected emulation"),
+ ibfd);
return FALSE;
}
+ if (!mips_elf_merge_obj_attributes (ibfd, obfd))
+ 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;
@@ -9031,7 +11126,9 @@ _bfd_mips_elf_merge_private_bfd_data (bfd *ibfd, bfd *obfd)
= elf_elfheader (ibfd)->e_ident[EI_CLASS];
if (bfd_get_arch (obfd) == bfd_get_arch (ibfd)
- && bfd_get_arch_info (obfd)->the_default)
+ && (bfd_get_arch_info (obfd)->the_default
+ || mips_mach_extends_p (bfd_get_mach (obfd),
+ bfd_get_mach (ibfd))))
{
if (! bfd_set_arch_mach (obfd, bfd_get_arch (ibfd),
bfd_get_mach (ibfd)))
@@ -9056,6 +11153,12 @@ _bfd_mips_elf_merge_private_bfd_data (bfd *ibfd, bfd *obfd)
new_flags &= ~EF_MIPS_UCODE;
old_flags &= ~EF_MIPS_UCODE;
+ /* Don't care about the PIC flags from dynamic objects; they are
+ PIC by design. */
+ if ((new_flags & (EF_MIPS_PIC | EF_MIPS_CPIC)) != 0
+ && (ibfd->flags & DYNAMIC) != 0)
+ new_flags &= ~ (EF_MIPS_PIC | EF_MIPS_CPIC);
+
if (new_flags == old_flags)
return TRUE;
@@ -9068,7 +11171,7 @@ _bfd_mips_elf_merge_private_bfd_data (bfd *ibfd, bfd *obfd)
which are automatically generated by gas. */
if (strcmp (sec->name, ".reginfo")
&& strcmp (sec->name, ".mdebug")
- && (sec->_raw_size != 0
+ && (sec->size != 0
|| (strcmp (sec->name, ".text")
&& strcmp (sec->name, ".data")
&& strcmp (sec->name, ".bss"))))
@@ -9086,8 +11189,8 @@ _bfd_mips_elf_merge_private_bfd_data (bfd *ibfd, bfd *obfd)
!= ((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));
+ (_("%B: warning: linking PIC files with non-PIC files"),
+ ibfd);
ok = TRUE;
}
@@ -9103,8 +11206,8 @@ _bfd_mips_elf_merge_private_bfd_data (bfd *ibfd, bfd *obfd)
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));
+ (_("%B: linking 32-bit code with 64-bit code"),
+ ibfd);
ok = FALSE;
}
else if (!mips_mach_extends_p (bfd_get_mach (ibfd), bfd_get_mach (obfd)))
@@ -9131,8 +11234,8 @@ _bfd_mips_elf_merge_private_bfd_data (bfd *ibfd, bfd *obfd)
{
/* The ISAs aren't compatible. */
(*_bfd_error_handler)
- (_("%s: linking %s module with previous %s modules"),
- bfd_archive_filename (ibfd),
+ (_("%B: linking %s module with previous %s modules"),
+ ibfd,
bfd_printable_name (ibfd),
bfd_printable_name (obfd));
ok = FALSE;
@@ -9154,8 +11257,8 @@ _bfd_mips_elf_merge_private_bfd_data (bfd *ibfd, bfd *obfd)
!= elf_elfheader (obfd)->e_ident[EI_CLASS]))
{
(*_bfd_error_handler)
- (_("%s: ABI mismatch: linking %s module with previous %s modules"),
- bfd_archive_filename (ibfd),
+ (_("%B: ABI mismatch: linking %s module with previous %s modules"),
+ ibfd,
elf_mips_abi_name (ibfd),
elf_mips_abi_name (obfd));
ok = FALSE;
@@ -9177,8 +11280,8 @@ _bfd_mips_elf_merge_private_bfd_data (bfd *ibfd, bfd *obfd)
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,
+ (_("%B: uses different e_flags (0x%lx) fields than previous modules (0x%lx)"),
+ ibfd, (unsigned long) new_flags,
(unsigned long) old_flags);
ok = FALSE;
}
@@ -9236,49 +11339,103 @@ _bfd_mips_elf_print_private_bfd_data (bfd *abfd, void *ptr)
fprintf (file, _(" [no abi set]"));
if ((elf_elfheader (abfd)->e_flags & EF_MIPS_ARCH) == E_MIPS_ARCH_1)
- fprintf (file, _(" [mips1]"));
+ fprintf (file, " [mips1]");
else if ((elf_elfheader (abfd)->e_flags & EF_MIPS_ARCH) == E_MIPS_ARCH_2)
- fprintf (file, _(" [mips2]"));
+ fprintf (file, " [mips2]");
else if ((elf_elfheader (abfd)->e_flags & EF_MIPS_ARCH) == E_MIPS_ARCH_3)
- fprintf (file, _(" [mips3]"));
+ fprintf (file, " [mips3]");
else if ((elf_elfheader (abfd)->e_flags & EF_MIPS_ARCH) == E_MIPS_ARCH_4)
- fprintf (file, _(" [mips4]"));
+ fprintf (file, " [mips4]");
else if ((elf_elfheader (abfd)->e_flags & EF_MIPS_ARCH) == E_MIPS_ARCH_5)
- fprintf (file, _(" [mips5]"));
+ fprintf (file, " [mips5]");
else if ((elf_elfheader (abfd)->e_flags & EF_MIPS_ARCH) == E_MIPS_ARCH_32)
- fprintf (file, _(" [mips32]"));
+ fprintf (file, " [mips32]");
else if ((elf_elfheader (abfd)->e_flags & EF_MIPS_ARCH) == E_MIPS_ARCH_64)
- fprintf (file, _(" [mips64]"));
+ fprintf (file, " [mips64]");
else if ((elf_elfheader (abfd)->e_flags & EF_MIPS_ARCH) == E_MIPS_ARCH_32R2)
- fprintf (file, _(" [mips32r2]"));
+ fprintf (file, " [mips32r2]");
else if ((elf_elfheader (abfd)->e_flags & EF_MIPS_ARCH) == E_MIPS_ARCH_64R2)
- fprintf (file, _(" [mips64r2]"));
+ fprintf (file, " [mips64r2]");
else
fprintf (file, _(" [unknown ISA]"));
if (elf_elfheader (abfd)->e_flags & EF_MIPS_ARCH_ASE_MDMX)
- fprintf (file, _(" [mdmx]"));
+ fprintf (file, " [mdmx]");
if (elf_elfheader (abfd)->e_flags & EF_MIPS_ARCH_ASE_M16)
- fprintf (file, _(" [mips16]"));
+ fprintf (file, " [mips16]");
if (elf_elfheader (abfd)->e_flags & EF_MIPS_32BITMODE)
- fprintf (file, _(" [32bitmode]"));
+ fprintf (file, " [32bitmode]");
else
fprintf (file, _(" [not 32bitmode]"));
+ if (elf_elfheader (abfd)->e_flags & EF_MIPS_NOREORDER)
+ fprintf (file, " [noreorder]");
+
+ if (elf_elfheader (abfd)->e_flags & EF_MIPS_PIC)
+ fprintf (file, " [PIC]");
+
+ if (elf_elfheader (abfd)->e_flags & EF_MIPS_CPIC)
+ fprintf (file, " [CPIC]");
+
+ if (elf_elfheader (abfd)->e_flags & EF_MIPS_XGOT)
+ fprintf (file, " [XGOT]");
+
+ if (elf_elfheader (abfd)->e_flags & EF_MIPS_UCODE)
+ fprintf (file, " [UCODE]");
+
fputc ('\n', file);
return TRUE;
}
-struct bfd_elf_special_section const _bfd_mips_elf_special_sections[]=
+const struct bfd_elf_special_section _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 }
+ { STRING_COMMA_LEN (".lit4"), 0, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE + SHF_MIPS_GPREL },
+ { STRING_COMMA_LEN (".lit8"), 0, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE + SHF_MIPS_GPREL },
+ { STRING_COMMA_LEN (".mdebug"), 0, SHT_MIPS_DEBUG, 0 },
+ { STRING_COMMA_LEN (".sbss"), -2, SHT_NOBITS, SHF_ALLOC + SHF_WRITE + SHF_MIPS_GPREL },
+ { STRING_COMMA_LEN (".sdata"), -2, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE + SHF_MIPS_GPREL },
+ { STRING_COMMA_LEN (".ucode"), 0, SHT_MIPS_UCODE, 0 },
+ { NULL, 0, 0, 0, 0 }
};
+
+/* Merge non visibility st_other attributes. Ensure that the
+ STO_OPTIONAL flag is copied into h->other, even if this is not a
+ definiton of the symbol. */
+void
+_bfd_mips_elf_merge_symbol_attribute (struct elf_link_hash_entry *h,
+ const Elf_Internal_Sym *isym,
+ bfd_boolean definition,
+ bfd_boolean dynamic ATTRIBUTE_UNUSED)
+{
+ if ((isym->st_other & ~ELF_ST_VISIBILITY (-1)) != 0)
+ {
+ unsigned char other;
+
+ other = (definition ? isym->st_other : h->other);
+ other &= ~ELF_ST_VISIBILITY (-1);
+ h->other = other | ELF_ST_VISIBILITY (h->other);
+ }
+
+ if (!definition
+ && ELF_MIPS_IS_OPTIONAL (isym->st_other))
+ h->other |= STO_OPTIONAL;
+}
+
+/* Decide whether an undefined symbol is special and can be ignored.
+ This is the case for OPTIONAL symbols on IRIX. */
+bfd_boolean
+_bfd_mips_elf_ignore_undef_symbol (struct elf_link_hash_entry *h)
+{
+ return ELF_MIPS_IS_OPTIONAL (h->other) ? TRUE : FALSE;
+}
+
+bfd_boolean
+_bfd_mips_elf_common_definition (Elf_Internal_Sym *sym)
+{
+ return (sym->st_shndx == SHN_COMMON
+ || sym->st_shndx == SHN_MIPS_ACOMMON
+ || sym->st_shndx == SHN_MIPS_SCOMMON);
+}
diff --git a/contrib/binutils/bfd/elfxx-mips.h b/contrib/binutils/bfd/elfxx-mips.h
index 0a684d9..3e97cc0 100644
--- a/contrib/binutils/bfd/elfxx-mips.h
+++ b/contrib/binutils/bfd/elfxx-mips.h
@@ -1,5 +1,6 @@
/* MIPS ELF specific backend routines.
- Copyright 2002, 2003, 2004 Free Software Foundation, Inc.
+ Copyright 2002, 2003, 2004, 2005, 2006
+ Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@@ -15,7 +16,7 @@ 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. */
+Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
#include "elf/common.h"
#include "elf/internal.h"
@@ -24,12 +25,14 @@ extern bfd_boolean _bfd_mips_elf_new_section_hook
(bfd *, asection *);
extern void _bfd_mips_elf_symbol_processing
(bfd *, asymbol *);
+extern unsigned int _bfd_mips_elf_eh_frame_address_size
+ (bfd *, asection *);
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 *);
+ (bfd *, Elf_Internal_Shdr *, const char *, int);
extern bfd_boolean _bfd_mips_elf_fake_sections
(bfd *, Elf_Internal_Shdr *, asection *);
extern bfd_boolean _bfd_mips_elf_section_from_bfd_section
@@ -46,6 +49,8 @@ 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_vxworks_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
@@ -56,12 +61,15 @@ extern bfd_boolean _bfd_mips_elf_relocate_section
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_vxworks_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 *);
+ (bfd *, struct bfd_link_info *);
extern bfd_boolean _bfd_mips_elf_modify_segment_map
(bfd *, struct bfd_link_info *);
extern asection * _bfd_mips_elf_gc_mark_hook
@@ -70,7 +78,7 @@ extern asection * _bfd_mips_elf_gc_mark_hook
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 bfd_link_info *, 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);
@@ -79,6 +87,8 @@ extern bfd_boolean _bfd_mips_elf_ignore_discarded_relocs
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_find_inliner_info
+ (bfd *, 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
@@ -86,6 +96,8 @@ extern bfd_byte *_bfd_elf_mips_get_relocated_section_contents
bfd_byte *, bfd_boolean, asymbol **);
extern struct bfd_link_hash_table *_bfd_mips_elf_link_hash_table_create
(bfd *);
+extern struct bfd_link_hash_table *_bfd_mips_vxworks_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
@@ -97,10 +109,14 @@ extern bfd_boolean _bfd_mips_elf_print_private_bfd_data
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 *);
+ (bfd *, struct bfd_link_info *, asection *, bfd_byte *);
extern bfd_boolean _bfd_mips_elf_read_ecoff_info
(bfd *, asection *, struct ecoff_debug_info *);
+extern void _bfd_mips16_elf_reloc_unshuffle
+ (bfd *, int, bfd_boolean, bfd_byte *);
+extern void _bfd_mips16_elf_reloc_shuffle
+ (bfd *, int, bfd_boolean, bfd_byte *);
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
@@ -119,8 +135,19 @@ 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 void _bfd_mips_elf_merge_symbol_attribute
+ (struct elf_link_hash_entry *, const Elf_Internal_Sym *, bfd_boolean, bfd_boolean);
+extern bfd_boolean _bfd_mips_elf_ignore_undef_symbol
+ (struct elf_link_hash_entry *);
+
+extern const struct bfd_elf_special_section _bfd_mips_elf_special_sections [];
+
+extern bfd_boolean _bfd_mips_elf_common_definition (Elf_Internal_Sym *);
-extern struct bfd_elf_special_section const _bfd_mips_elf_special_sections[];
+#define elf_backend_common_definition _bfd_mips_elf_common_definition
#define elf_backend_name_local_section_symbols \
_bfd_mips_elf_name_local_section_symbols
#define elf_backend_special_sections _bfd_mips_elf_special_sections
+#define elf_backend_eh_frame_address_size _bfd_mips_elf_eh_frame_address_size
+#define elf_backend_merge_symbol_attribute _bfd_mips_elf_merge_symbol_attribute
+#define elf_backend_ignore_undef_symbol _bfd_mips_elf_ignore_undef_symbol
diff --git a/contrib/binutils/bfd/elfxx-sparc.c b/contrib/binutils/bfd/elfxx-sparc.c
new file mode 100644
index 0000000..708af29
--- /dev/null
+++ b/contrib/binutils/bfd/elfxx-sparc.c
@@ -0,0 +1,4104 @@
+/* SPARC-specific support for ELF
+ Copyright 2005, 2006, 2007 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., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
+
+/* This file handles functionality common to the different SPARC ABI's. */
+
+#include "sysdep.h"
+#include "bfd.h"
+#include "bfdlink.h"
+#include "libbfd.h"
+#include "libiberty.h"
+#include "elf-bfd.h"
+#include "elf/sparc.h"
+#include "opcode/sparc.h"
+#include "elfxx-sparc.h"
+#include "elf-vxworks.h"
+
+/* In case we're on a 32-bit machine, construct a 64-bit "-1" value. */
+#define MINUS_ONE (~ (bfd_vma) 0)
+
+#define ABI_64_P(abfd) \
+ (get_elf_backend_data (abfd)->s->elfclass == ELFCLASS64)
+
+/* The relocation "howto" table. */
+
+/* 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 (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 > bfd_get_section_limit (abfd, input_section))
+ 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 (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 (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 (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 (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;
+}
+
+static 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,2,32,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_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),
+ 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)
+};
+static reloc_howto_type 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 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 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_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 },
+ { BFD_RELOC_SPARC_PLT32, R_SPARC_PLT32 },
+ { 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 },
+ { BFD_RELOC_VTABLE_INHERIT, R_SPARC_GNU_VTINHERIT },
+ { BFD_RELOC_VTABLE_ENTRY, R_SPARC_GNU_VTENTRY },
+ { BFD_RELOC_SPARC_REV32, R_SPARC_REV32 },
+};
+
+reloc_howto_type *
+_bfd_sparc_elf_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED,
+ bfd_reloc_code_real_type code)
+{
+ unsigned int i;
+
+ switch (code)
+ {
+ case BFD_RELOC_VTABLE_INHERIT:
+ return &sparc_vtinherit_howto;
+
+ case BFD_RELOC_VTABLE_ENTRY:
+ return &sparc_vtentry_howto;
+
+ case BFD_RELOC_SPARC_REV32:
+ return &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;
+}
+
+reloc_howto_type *
+_bfd_sparc_elf_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED,
+ const char *r_name)
+{
+ unsigned int i;
+
+ for (i = 0;
+ i < (sizeof (_bfd_sparc_elf_howto_table)
+ / sizeof (_bfd_sparc_elf_howto_table[0]));
+ i++)
+ if (_bfd_sparc_elf_howto_table[i].name != NULL
+ && strcasecmp (_bfd_sparc_elf_howto_table[i].name, r_name) == 0)
+ return &_bfd_sparc_elf_howto_table[i];
+
+ if (strcasecmp (sparc_vtinherit_howto.name, r_name) == 0)
+ return &sparc_vtinherit_howto;
+ if (strcasecmp (sparc_vtentry_howto.name, r_name) == 0)
+ return &sparc_vtentry_howto;
+ if (strcasecmp (sparc_rev32_howto.name, r_name) == 0)
+ return &sparc_rev32_howto;
+
+ return NULL;
+}
+
+reloc_howto_type *
+_bfd_sparc_elf_info_to_howto_ptr (unsigned int r_type)
+{
+ switch (r_type)
+ {
+ case R_SPARC_GNU_VTINHERIT:
+ return &sparc_vtinherit_howto;
+
+ case R_SPARC_GNU_VTENTRY:
+ return &sparc_vtentry_howto;
+
+ case R_SPARC_REV32:
+ return &sparc_rev32_howto;
+
+ default:
+ if (r_type >= (unsigned int) R_SPARC_max_std)
+ {
+ (*_bfd_error_handler) (_("invalid relocation type %d"),
+ (int) r_type);
+ r_type = R_SPARC_NONE;
+ }
+ return &_bfd_sparc_elf_howto_table[r_type];
+ }
+}
+
+/* Both 32-bit and 64-bit sparc encode this in an identical manner,
+ so just take advantage of that. */
+#define SPARC_ELF_R_TYPE(r_info) \
+ ((r_info) & 0xff)
+
+void
+_bfd_sparc_elf_info_to_howto (bfd *abfd ATTRIBUTE_UNUSED, arelent *cache_ptr,
+ Elf_Internal_Rela *dst)
+{
+ unsigned int r_type = SPARC_ELF_R_TYPE (dst->r_info);
+
+ cache_ptr->howto = _bfd_sparc_elf_info_to_howto_ptr (r_type);
+}
+
+
+/* The nop opcode we use. */
+#define SPARC_NOP 0x01000000
+
+#define SPARC_INSN_BYTES 4
+
+/* 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 _bfd_sparc_elf_dyn_relocs
+{
+ struct _bfd_sparc_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;
+};
+
+/* SPARC ELF linker hash entry. */
+
+struct _bfd_sparc_elf_link_hash_entry
+{
+ struct elf_link_hash_entry elf;
+
+ /* Track dynamic relocs copied for this symbol. */
+ struct _bfd_sparc_elf_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 _bfd_sparc_elf_hash_entry(ent) ((struct _bfd_sparc_elf_link_hash_entry *)(ent))
+
+struct _bfd_sparc_elf_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 _bfd_sparc_elf_tdata(abfd) \
+ ((struct _bfd_sparc_elf_obj_tdata *) (abfd)->tdata.any)
+
+#define _bfd_sparc_elf_local_got_tls_type(abfd) \
+ (_bfd_sparc_elf_tdata (abfd)->local_got_tls_type)
+
+bfd_boolean
+_bfd_sparc_elf_mkobject (bfd *abfd)
+{
+ if (abfd->tdata.any == NULL)
+ {
+ bfd_size_type amt = sizeof (struct _bfd_sparc_elf_obj_tdata);
+ abfd->tdata.any = bfd_zalloc (abfd, amt);
+ if (abfd->tdata.any == NULL)
+ return FALSE;
+ }
+ return bfd_elf_mkobject (abfd);
+}
+
+static void
+sparc_put_word_32 (bfd *bfd, bfd_vma val, void *ptr)
+{
+ bfd_put_32 (bfd, val, ptr);
+}
+
+static void
+sparc_put_word_64 (bfd *bfd, bfd_vma val, void *ptr)
+{
+ bfd_put_64 (bfd, val, ptr);
+}
+
+static void
+sparc_elf_append_rela (bfd *abfd, asection *s, Elf_Internal_Rela *rel)
+{
+ const struct elf_backend_data *bed;
+ bfd_byte *loc;
+
+ bed = get_elf_backend_data (abfd);
+ loc = s->contents + (s->reloc_count++ * bed->s->sizeof_rela);
+ bed->s->swap_reloca_out (abfd, rel, loc);
+}
+
+static bfd_vma
+sparc_elf_r_info_64 (Elf_Internal_Rela *in_rel ATTRIBUTE_UNUSED,
+ bfd_vma index ATTRIBUTE_UNUSED,
+ bfd_vma type ATTRIBUTE_UNUSED)
+{
+ return ELF64_R_INFO (index,
+ (in_rel ?
+ ELF64_R_TYPE_INFO (ELF64_R_TYPE_DATA (in_rel->r_info),
+ type) : type));
+}
+
+static bfd_vma
+sparc_elf_r_info_32 (Elf_Internal_Rela *in_rel ATTRIBUTE_UNUSED,
+ bfd_vma index, bfd_vma type)
+{
+ return ELF32_R_INFO (index, type);
+}
+
+static bfd_vma
+sparc_elf_r_symndx_64 (bfd_vma r_info)
+{
+ bfd_vma r_symndx = ELF32_R_SYM (r_info);
+ return (r_symndx >> 24);
+}
+
+static bfd_vma
+sparc_elf_r_symndx_32 (bfd_vma r_info)
+{
+ return ELF32_R_SYM (r_info);
+}
+
+/* PLT/GOT stuff */
+
+#define PLT32_ENTRY_SIZE 12
+#define PLT32_HEADER_SIZE (4 * PLT32_ENTRY_SIZE)
+
+/* The first four entries in a 32-bit 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 PLT32_ENTRY_WORD0 0x03000000
+/* b,a .plt0. We fill in the offset later. */
+#define PLT32_ENTRY_WORD1 0x30800000
+/* nop. */
+#define PLT32_ENTRY_WORD2 SPARC_NOP
+
+static int
+sparc32_plt_entry_build (bfd *output_bfd, asection *splt, bfd_vma offset,
+ bfd_vma max ATTRIBUTE_UNUSED,
+ bfd_vma *r_offset)
+{
+ bfd_put_32 (output_bfd,
+ PLT32_ENTRY_WORD0 + offset,
+ splt->contents + offset);
+ bfd_put_32 (output_bfd,
+ (PLT32_ENTRY_WORD1
+ + (((- (offset + 4)) >> 2) & 0x3fffff)),
+ splt->contents + offset + 4);
+ bfd_put_32 (output_bfd, (bfd_vma) PLT32_ENTRY_WORD2,
+ splt->contents + offset + 8);
+
+ *r_offset = offset;
+
+ return offset / PLT32_ENTRY_SIZE - 4;
+}
+
+/* Both the headers and the entries are icache aligned. */
+#define PLT64_ENTRY_SIZE 32
+#define PLT64_HEADER_SIZE (4 * PLT64_ENTRY_SIZE)
+#define PLT64_LARGE_THRESHOLD 32768
+
+static int
+sparc64_plt_entry_build (bfd *output_bfd, asection *splt, bfd_vma offset,
+ bfd_vma max, bfd_vma *r_offset)
+{
+ unsigned char *entry = splt->contents + offset;
+ const unsigned int nop = SPARC_NOP;
+ int index;
+
+ if (offset < (PLT64_LARGE_THRESHOLD * PLT64_ENTRY_SIZE))
+ {
+ unsigned int sethi, ba;
+
+ *r_offset = offset;
+
+ index = (offset / PLT64_ENTRY_SIZE);
+
+ sethi = 0x03000000 | (index * PLT64_ENTRY_SIZE);
+ ba = 0x30680000
+ | (((splt->contents + PLT64_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);
+ }
+ else
+ {
+ unsigned char *ptr;
+ unsigned int ldx;
+ int block, last_block, ofs, last_ofs, chunks_this_block;
+ const int insn_chunk_size = (6 * 4);
+ const int ptr_chunk_size = (1 * 8);
+ const int entries_per_block = 160;
+ const int block_size = entries_per_block * (insn_chunk_size
+ + ptr_chunk_size);
+
+ /* Entries 32768 and higher are grouped into blocks of 160.
+ The blocks are further subdivided into 160 sequences of
+ 6 instructions and 160 pointers. If a block does not require
+ the full 160 entries, let's say it requires N, then there
+ will be N sequences of 6 instructions and N pointers. */
+
+ offset -= (PLT64_LARGE_THRESHOLD * PLT64_ENTRY_SIZE);
+ max -= (PLT64_LARGE_THRESHOLD * PLT64_ENTRY_SIZE);
+
+ block = offset / block_size;
+ last_block = max / block_size;
+ if (block != last_block)
+ {
+ chunks_this_block = 160;
+ }
+ else
+ {
+ last_ofs = max % block_size;
+ chunks_this_block = last_ofs / (insn_chunk_size + ptr_chunk_size);
+ }
+
+ ofs = offset % block_size;
+
+ index = (PLT64_LARGE_THRESHOLD +
+ (block * 160) +
+ (ofs / insn_chunk_size));
+
+ ptr = splt->contents
+ + (PLT64_LARGE_THRESHOLD * PLT64_ENTRY_SIZE)
+ + (block * block_size)
+ + (chunks_this_block * insn_chunk_size)
+ + (ofs / insn_chunk_size) * ptr_chunk_size;
+
+ *r_offset = (bfd_vma) (ptr - splt->contents);
+
+ 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) SPARC_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) (splt->contents - (entry + 4)), ptr);
+ }
+
+ return index - 4;
+}
+
+/* The format of the first PLT entry in a VxWorks executable. */
+static const bfd_vma sparc_vxworks_exec_plt0_entry[] =
+ {
+ 0x05000000, /* sethi %hi(_GLOBAL_OFFSET_TABLE_+8), %g2 */
+ 0x8410a000, /* or %g2, %lo(_GLOBAL_OFFSET_TABLE_+8), %g2 */
+ 0xc4008000, /* ld [ %g2 ], %g2 */
+ 0x81c08000, /* jmp %g2 */
+ 0x01000000 /* nop */
+ };
+
+/* The format of subsequent PLT entries. */
+static const bfd_vma sparc_vxworks_exec_plt_entry[] =
+ {
+ 0x03000000, /* sethi %hi(_GLOBAL_OFFSET_TABLE_+f@got), %g1 */
+ 0x82106000, /* or %g1, %lo(_GLOBAL_OFFSET_TABLE_+f@got), %g1 */
+ 0xc2004000, /* ld [ %g1 ], %g1 */
+ 0x81c04000, /* jmp %g1 */
+ 0x01000000, /* nop */
+ 0x03000000, /* sethi %hi(f@pltindex), %g1 */
+ 0x10800000, /* b _PLT_resolve */
+ 0x82106000 /* or %g1, %lo(f@pltindex), %g1 */
+ };
+
+/* The format of the first PLT entry in a VxWorks shared object. */
+static const bfd_vma sparc_vxworks_shared_plt0_entry[] =
+ {
+ 0xc405e008, /* ld [ %l7 + 8 ], %g2 */
+ 0x81c08000, /* jmp %g2 */
+ 0x01000000 /* nop */
+ };
+
+/* The format of subsequent PLT entries. */
+static const bfd_vma sparc_vxworks_shared_plt_entry[] =
+ {
+ 0x03000000, /* sethi %hi(f@got), %g1 */
+ 0x82106000, /* or %g1, %lo(f@got), %g1 */
+ 0xc205c001, /* ld [ %l7 + %g1 ], %g1 */
+ 0x81c04000, /* jmp %g1 */
+ 0x01000000, /* nop */
+ 0x03000000, /* sethi %hi(f@pltindex), %g1 */
+ 0x10800000, /* b _PLT_resolve */
+ 0x82106000 /* or %g1, %lo(f@pltindex), %g1 */
+ };
+
+#define SPARC_ELF_PUT_WORD(htab, bfd, val, ptr) \
+ htab->put_word(bfd, val, ptr)
+
+#define SPARC_ELF_R_INFO(htab, in_rel, index, type) \
+ htab->r_info(in_rel, index, type)
+
+#define SPARC_ELF_R_SYMNDX(htab, r_info) \
+ htab->r_symndx(r_info)
+
+#define SPARC_ELF_WORD_BYTES(htab) \
+ htab->bytes_per_word
+
+#define SPARC_ELF_RELA_BYTES(htab) \
+ htab->bytes_per_rela
+
+#define SPARC_ELF_DTPOFF_RELOC(htab) \
+ htab->dtpoff_reloc
+
+#define SPARC_ELF_DTPMOD_RELOC(htab) \
+ htab->dtpmod_reloc
+
+#define SPARC_ELF_TPOFF_RELOC(htab) \
+ htab->tpoff_reloc
+
+#define SPARC_ELF_BUILD_PLT_ENTRY(htab, obfd, splt, off, max, r_off) \
+ htab->build_plt_entry (obfd, splt, off, max, r_off)
+
+/* Create an entry in an SPARC 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 _bfd_sparc_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)
+ {
+ struct _bfd_sparc_elf_link_hash_entry *eh;
+
+ eh = (struct _bfd_sparc_elf_link_hash_entry *) entry;
+ eh->dyn_relocs = NULL;
+ eh->tls_type = GOT_UNKNOWN;
+ }
+
+ return entry;
+}
+
+/* The name of the dynamic interpreter. This is put in the .interp
+ section. */
+
+#define ELF32_DYNAMIC_INTERPRETER "/usr/lib/ld.so.1"
+#define ELF64_DYNAMIC_INTERPRETER "/usr/lib/sparcv9/ld.so.1"
+
+/* Create a SPARC ELF linker hash table. */
+
+struct bfd_link_hash_table *
+_bfd_sparc_elf_link_hash_table_create (bfd *abfd)
+{
+ struct _bfd_sparc_elf_link_hash_table *ret;
+ bfd_size_type amt = sizeof (struct _bfd_sparc_elf_link_hash_table);
+
+ ret = (struct _bfd_sparc_elf_link_hash_table *) bfd_zmalloc (amt);
+ if (ret == NULL)
+ return NULL;
+
+ if (ABI_64_P (abfd))
+ {
+ ret->put_word = sparc_put_word_64;
+ ret->r_info = sparc_elf_r_info_64;
+ ret->r_symndx = sparc_elf_r_symndx_64;
+ ret->dtpoff_reloc = R_SPARC_TLS_DTPOFF64;
+ ret->dtpmod_reloc = R_SPARC_TLS_DTPMOD64;
+ ret->tpoff_reloc = R_SPARC_TLS_TPOFF64;
+ ret->word_align_power = 3;
+ ret->align_power_max = 4;
+ ret->bytes_per_word = 8;
+ ret->bytes_per_rela = sizeof (Elf64_External_Rela);
+ ret->dynamic_interpreter = ELF64_DYNAMIC_INTERPRETER;
+ ret->dynamic_interpreter_size = sizeof ELF64_DYNAMIC_INTERPRETER;
+ }
+ else
+ {
+ ret->put_word = sparc_put_word_32;
+ ret->r_info = sparc_elf_r_info_32;
+ ret->r_symndx = sparc_elf_r_symndx_32;
+ ret->dtpoff_reloc = R_SPARC_TLS_DTPOFF32;
+ ret->dtpmod_reloc = R_SPARC_TLS_DTPMOD32;
+ ret->tpoff_reloc = R_SPARC_TLS_TPOFF32;
+ ret->word_align_power = 2;
+ ret->align_power_max = 3;
+ ret->bytes_per_word = 4;
+ ret->bytes_per_rela = sizeof (Elf32_External_Rela);
+ ret->dynamic_interpreter = ELF32_DYNAMIC_INTERPRETER;
+ ret->dynamic_interpreter_size = sizeof ELF32_DYNAMIC_INTERPRETER;
+ }
+
+ if (!_bfd_elf_link_hash_table_init (&ret->elf, abfd, link_hash_newfunc,
+ sizeof (struct _bfd_sparc_elf_link_hash_entry)))
+ {
+ free (ret);
+ return 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 (bfd *dynobj, struct bfd_link_info *info)
+{
+ struct _bfd_sparc_elf_link_hash_table *htab;
+
+ if (! _bfd_elf_create_got_section (dynobj, info))
+ return FALSE;
+
+ htab = _bfd_sparc_elf_hash_table (info);
+ htab->sgot = bfd_get_section_by_name (dynobj, ".got");
+ BFD_ASSERT (htab->sgot != NULL);
+
+ htab->srelgot = bfd_make_section_with_flags (dynobj, ".rela.got",
+ SEC_ALLOC
+ | SEC_LOAD
+ | SEC_HAS_CONTENTS
+ | SEC_IN_MEMORY
+ | SEC_LINKER_CREATED
+ | SEC_READONLY);
+ if (htab->srelgot == NULL
+ || ! bfd_set_section_alignment (dynobj, htab->srelgot,
+ htab->word_align_power))
+ return FALSE;
+
+ if (htab->is_vxworks)
+ {
+ htab->sgotplt = bfd_get_section_by_name (dynobj, ".got.plt");
+ if (!htab->sgotplt)
+ 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. */
+
+bfd_boolean
+_bfd_sparc_elf_create_dynamic_sections (bfd *dynobj,
+ struct bfd_link_info *info)
+{
+ struct _bfd_sparc_elf_link_hash_table *htab;
+
+ htab = _bfd_sparc_elf_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->is_vxworks)
+ {
+ if (!elf_vxworks_create_dynamic_sections (dynobj, info, &htab->srelplt2))
+ return FALSE;
+ if (info->shared)
+ {
+ htab->plt_header_size
+ = 4 * ARRAY_SIZE (sparc_vxworks_shared_plt0_entry);
+ htab->plt_entry_size
+ = 4 * ARRAY_SIZE (sparc_vxworks_shared_plt_entry);
+ }
+ else
+ {
+ htab->plt_header_size
+ = 4 * ARRAY_SIZE (sparc_vxworks_exec_plt0_entry);
+ htab->plt_entry_size
+ = 4 * ARRAY_SIZE (sparc_vxworks_exec_plt_entry);
+ }
+ }
+ else
+ {
+ if (ABI_64_P (dynobj))
+ {
+ htab->build_plt_entry = sparc64_plt_entry_build;
+ htab->plt_header_size = PLT64_HEADER_SIZE;
+ htab->plt_entry_size = PLT64_ENTRY_SIZE;
+ }
+ else
+ {
+ htab->build_plt_entry = sparc32_plt_entry_build;
+ htab->plt_header_size = PLT32_HEADER_SIZE;
+ htab->plt_entry_size = PLT32_ENTRY_SIZE;
+ }
+ }
+
+ 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. */
+
+void
+_bfd_sparc_elf_copy_indirect_symbol (struct bfd_link_info *info,
+ struct elf_link_hash_entry *dir,
+ struct elf_link_hash_entry *ind)
+{
+ struct _bfd_sparc_elf_link_hash_entry *edir, *eind;
+
+ edir = (struct _bfd_sparc_elf_link_hash_entry *) dir;
+ eind = (struct _bfd_sparc_elf_link_hash_entry *) ind;
+
+ if (eind->dyn_relocs != NULL)
+ {
+ if (edir->dyn_relocs != NULL)
+ {
+ struct _bfd_sparc_elf_dyn_relocs **pp;
+ struct _bfd_sparc_elf_dyn_relocs *p;
+
+ /* Add reloc counts against the indirect sym to the direct sym
+ list. Merge any entries against the same section. */
+ for (pp = &eind->dyn_relocs; (p = *pp) != NULL; )
+ {
+ struct _bfd_sparc_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;
+ }
+
+ 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 (info, dir, ind);
+}
+
+static int
+sparc_elf_tls_transition (struct bfd_link_info *info, bfd *abfd,
+ int r_type, int is_local)
+{
+ if (! ABI_64_P (abfd)
+ && r_type == R_SPARC_TLS_GD_HI22
+ && ! _bfd_sparc_elf_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. */
+
+bfd_boolean
+_bfd_sparc_elf_check_relocs (bfd *abfd, struct bfd_link_info *info,
+ asection *sec, const Elf_Internal_Rela *relocs)
+{
+ struct _bfd_sparc_elf_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;
+ int num_relocs;
+ bfd_boolean checked_tlsgd = FALSE;
+
+ if (info->relocatable)
+ return TRUE;
+
+ htab = _bfd_sparc_elf_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;
+
+ if (ABI_64_P (abfd))
+ num_relocs = NUM_SHDR_ENTRIES (& elf_section_data (sec)->rel_hdr);
+ else
+ num_relocs = sec->reloc_count;
+ rel_end = relocs + num_relocs;
+ for (rel = relocs; rel < rel_end; rel++)
+ {
+ unsigned int r_type;
+ unsigned long r_symndx;
+ struct elf_link_hash_entry *h;
+
+ r_symndx = SPARC_ELF_R_SYMNDX (htab, rel->r_info);
+ r_type = SPARC_ELF_R_TYPE (rel->r_info);
+
+ if (r_symndx >= NUM_SHDR_ENTRIES (symtab_hdr))
+ {
+ (*_bfd_error_handler) (_("%B: bad symbol index: %d"),
+ abfd, r_symndx);
+ return FALSE;
+ }
+
+ if (r_symndx < symtab_hdr->sh_info)
+ h = NULL;
+ else
+ {
+ 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;
+ }
+
+ /* Compatibility with old R_SPARC_REV32 reloc conflicting
+ with R_SPARC_TLS_GD_HI22. */
+ if (! ABI_64_P (abfd) && ! 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;
+ _bfd_sparc_elf_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;
+ _bfd_sparc_elf_tdata (abfd)->has_tlsgd = TRUE;
+ break;
+ }
+
+ r_type = sparc_elf_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 = _bfd_sparc_elf_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;
+ _bfd_sparc_elf_local_got_tls_type (abfd)
+ = (char *) (local_got_refcounts + symtab_hdr->sh_info);
+ }
+ local_got_refcounts[r_symndx] += 1;
+ old_tls_type = _bfd_sparc_elf_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)
+ (_("%B: `%s' accessed both as normal and thread local symbol"),
+ abfd, h ? h->root.root.string : "<local>");
+ return FALSE;
+ }
+ }
+
+ if (old_tls_type != tls_type)
+ {
+ if (h != NULL)
+ _bfd_sparc_elf_hash_entry (h)->tls_type = tls_type;
+ else
+ _bfd_sparc_elf_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:
+ 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)
+ {
+ if (! ABI_64_P (abfd))
+ {
+ /* 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;
+ }
+
+ /* 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;
+ }
+
+ h->needs_plt = 1;
+
+ {
+ int this_r_type;
+
+ this_r_type = SPARC_ELF_R_TYPE (rel->r_info);
+ if (this_r_type == R_SPARC_PLT32
+ || this_r_type == R_SPARC_PLT64)
+ goto r_sparc_plt32;
+ }
+ h->plt.refcount += 1;
+ break;
+
+ 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)
+ h->non_got_ref = 1;
+
+ 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:
+ 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_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:
+ if (h != NULL)
+ h->non_got_ref = 1;
+
+ 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->def_regular))))
+ || (!info->shared
+ && (sec->flags & SEC_ALLOC) != 0
+ && h != NULL
+ && (h->root.type == bfd_link_hash_defweak
+ || !h->def_regular)))
+ {
+ struct _bfd_sparc_elf_dyn_relocs *p;
+ struct _bfd_sparc_elf_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 (CONST_STRNEQ (name, ".rela")
+ && 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;
+
+ flags = (SEC_HAS_CONTENTS | SEC_READONLY
+ | SEC_IN_MEMORY | SEC_LINKER_CREATED);
+ if ((sec->flags & SEC_ALLOC) != 0)
+ flags |= SEC_ALLOC | SEC_LOAD;
+ sreloc = bfd_make_section_with_flags (dynobj,
+ name,
+ flags);
+ if (sreloc == NULL
+ || ! bfd_set_section_alignment (dynobj, sreloc,
+ htab->word_align_power))
+ 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 _bfd_sparc_elf_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;
+ void *vpp;
+
+ s = bfd_section_from_r_symndx (abfd, &htab->sym_sec,
+ sec, r_symndx);
+ if (s == NULL)
+ return FALSE;
+
+ vpp = &elf_section_data (s)->local_dynrel;
+ head = (struct _bfd_sparc_elf_dyn_relocs **) vpp;
+ }
+
+ p = *head;
+ if (p == NULL || p->sec != sec)
+ {
+ bfd_size_type amt = sizeof *p;
+ p = ((struct _bfd_sparc_elf_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;
+
+ case R_SPARC_REGISTER:
+ /* Nothing to do. */
+ break;
+
+ default:
+ break;
+ }
+ }
+
+ return TRUE;
+}
+
+asection *
+_bfd_sparc_elf_gc_mark_hook (asection *sec,
+ struct bfd_link_info *info,
+ Elf_Internal_Rela *rel,
+ struct elf_link_hash_entry *h,
+ Elf_Internal_Sym *sym)
+{
+ if (h != NULL)
+ switch (SPARC_ELF_R_TYPE (rel->r_info))
+ {
+ case R_SPARC_GNU_VTINHERIT:
+ case R_SPARC_GNU_VTENTRY:
+ return NULL;
+ }
+
+ return _bfd_elf_gc_mark_hook (sec, info, rel, h, sym);
+}
+
+/* Update the got entry reference counts for the section being removed. */
+bfd_boolean
+_bfd_sparc_elf_gc_sweep_hook (bfd *abfd, struct bfd_link_info *info,
+ asection *sec, const Elf_Internal_Rela *relocs)
+{
+ struct _bfd_sparc_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 = _bfd_sparc_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;
+ unsigned int r_type;
+ struct elf_link_hash_entry *h = NULL;
+
+ r_symndx = SPARC_ELF_R_SYMNDX (htab, rel->r_info);
+ if (r_symndx >= symtab_hdr->sh_info)
+ {
+ struct _bfd_sparc_elf_link_hash_entry *eh;
+ struct _bfd_sparc_elf_dyn_relocs **pp;
+ struct _bfd_sparc_elf_dyn_relocs *p;
+
+ 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;
+ eh = (struct _bfd_sparc_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 = SPARC_ELF_R_TYPE (rel->r_info);
+ r_type = sparc_elf_tls_transition (info, abfd, r_type, h != NULL);
+ switch (r_type)
+ {
+ case R_SPARC_TLS_LDM_HI22:
+ case R_SPARC_TLS_LDM_LO10:
+ if (_bfd_sparc_elf_hash_table (info)->tls_ldm_got.refcount > 0)
+ _bfd_sparc_elf_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:
+ 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:
+ 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:
+ 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:
+ 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. */
+
+bfd_boolean
+_bfd_sparc_elf_adjust_dynamic_symbol (struct bfd_link_info *info,
+ struct elf_link_hash_entry *h)
+{
+ struct _bfd_sparc_elf_link_hash_table *htab;
+ struct _bfd_sparc_elf_link_hash_entry * eh;
+ struct _bfd_sparc_elf_dyn_relocs *p;
+ asection *s;
+
+ htab = _bfd_sparc_elf_hash_table (info);
+
+ /* Make sure we know what is going on here. */
+ BFD_ASSERT (htab->elf.dynobj != NULL
+ && (h->needs_plt
+ || h->u.weakdef != NULL
+ || (h->def_dynamic
+ && h->ref_regular
+ && !h->def_regular)));
+
+ /* 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->needs_plt
+ || (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->def_dynamic
+ && !h->ref_dynamic
+ && 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->needs_plt = 0;
+ }
+
+ 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->u.weakdef != NULL)
+ {
+ BFD_ASSERT (h->u.weakdef->root.type == bfd_link_hash_defined
+ || h->u.weakdef->root.type == bfd_link_hash_defweak);
+ h->root.u.def.section = h->u.weakdef->root.u.def.section;
+ h->root.u.def.value = h->u.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->non_got_ref)
+ return TRUE;
+
+ eh = (struct _bfd_sparc_elf_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->non_got_ref = 0;
+ return TRUE;
+ }
+
+ if (h->size == 0)
+ {
+ (*_bfd_error_handler) (_("dynamic variable `%s' is zero size"),
+ h->root.root.string);
+ 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->size += SPARC_ELF_RELA_BYTES (htab);
+ h->needs_copy = 1;
+ }
+
+ s = htab->sdynbss;
+
+ return _bfd_elf_adjust_dynamic_copy (h, s);
+}
+
+/* Allocate space in .plt, .got and associated reloc sections for
+ dynamic relocs. */
+
+static bfd_boolean
+allocate_dynrelocs (struct elf_link_hash_entry *h, PTR inf)
+{
+ struct bfd_link_info *info;
+ struct _bfd_sparc_elf_link_hash_table *htab;
+ struct _bfd_sparc_elf_link_hash_entry *eh;
+ struct _bfd_sparc_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;
+
+ info = (struct bfd_link_info *) inf;
+ htab = _bfd_sparc_elf_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->forced_local)
+ {
+ 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;
+
+ /* Allocate room for the header. */
+ if (s->size == 0)
+ {
+ s->size = htab->plt_header_size;
+
+ /* Allocate space for the .rela.plt.unloaded relocations. */
+ if (htab->is_vxworks && !info->shared)
+ htab->srelplt2->size = sizeof (Elf32_External_Rela) * 2;
+ }
+
+ /* The procedure linkage table size is bounded by the magnitude
+ of the offset we can describe in the entry. */
+ if (s->size >= (SPARC_ELF_WORD_BYTES(htab) == 8 ?
+ (((bfd_vma)1 << 31) << 1) : 0x400000))
+ {
+ bfd_set_error (bfd_error_bad_value);
+ return FALSE;
+ }
+
+ if (SPARC_ELF_WORD_BYTES(htab) == 8
+ && s->size >= PLT64_LARGE_THRESHOLD * PLT64_ENTRY_SIZE)
+ {
+ bfd_vma off = s->size - PLT64_LARGE_THRESHOLD * PLT64_ENTRY_SIZE;
+
+
+ off = (off % (160 * PLT64_ENTRY_SIZE)) / PLT64_ENTRY_SIZE;
+
+ h->plt.offset = (s->size - (off * 8));
+ }
+ else
+ h->plt.offset = s->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->def_regular)
+ {
+ h->root.u.def.section = s;
+ h->root.u.def.value = h->plt.offset;
+ }
+
+ /* Make room for this entry. */
+ s->size += htab->plt_entry_size;
+
+ /* We also need to make an entry in the .rela.plt section. */
+ htab->srelplt->size += SPARC_ELF_RELA_BYTES (htab);
+
+ if (htab->is_vxworks)
+ {
+ /* Allocate space for the .got.plt entry. */
+ htab->sgotplt->size += 4;
+
+ /* ...and for the .rela.plt.unloaded relocations. */
+ if (!info->shared)
+ htab->srelplt2->size += sizeof (Elf32_External_Rela) * 3;
+ }
+ }
+ else
+ {
+ h->plt.offset = (bfd_vma) -1;
+ h->needs_plt = 0;
+ }
+ }
+ else
+ {
+ h->plt.offset = (bfd_vma) -1;
+ h->needs_plt = 0;
+ }
+
+ /* 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
+ && _bfd_sparc_elf_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 = _bfd_sparc_elf_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->forced_local)
+ {
+ if (! bfd_elf_link_record_dynamic_symbol (info, h))
+ return FALSE;
+ }
+
+ s = htab->sgot;
+ h->got.offset = s->size;
+ s->size += SPARC_ELF_WORD_BYTES (htab);
+ /* R_SPARC_TLS_GD_HI{22,LO10} needs 2 consecutive GOT slots. */
+ if (tls_type == GOT_TLS_GD)
+ s->size += SPARC_ELF_WORD_BYTES (htab);
+ 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->size += SPARC_ELF_RELA_BYTES (htab);
+ else if (tls_type == GOT_TLS_GD)
+ htab->srelgot->size += 2 * SPARC_ELF_RELA_BYTES (htab);
+ else if (WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, info->shared, h))
+ htab->srelgot->size += SPARC_ELF_RELA_BYTES (htab);
+ }
+ else
+ h->got.offset = (bfd_vma) -1;
+
+ eh = (struct _bfd_sparc_elf_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->def_regular
+ && (h->forced_local
+ || info->symbolic))
+ {
+ struct _bfd_sparc_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 (eh->dyn_relocs != NULL
+ && h->root.type == bfd_link_hash_undefweak)
+ {
+ if (ELF_ST_VISIBILITY (h->other) != STV_DEFAULT)
+ eh->dyn_relocs = NULL;
+
+ /* Make sure undefined weak symbols are output as a dynamic
+ symbol in PIEs. */
+ else if (h->dynindx == -1
+ && !h->forced_local)
+ {
+ if (! bfd_elf_link_record_dynamic_symbol (info, h))
+ return FALSE;
+ }
+ }
+ }
+ 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->non_got_ref
+ && ((h->def_dynamic
+ && !h->def_regular)
+ || (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->forced_local)
+ {
+ 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->size += p->count * SPARC_ELF_RELA_BYTES (htab);
+ }
+
+ return TRUE;
+}
+
+/* Find any dynamic relocs that apply to read-only sections. */
+
+static bfd_boolean
+readonly_dynrelocs (struct elf_link_hash_entry *h, PTR inf)
+{
+ struct _bfd_sparc_elf_link_hash_entry *eh;
+ struct _bfd_sparc_elf_dyn_relocs *p;
+
+ if (h->root.type == bfd_link_hash_warning)
+ h = (struct elf_link_hash_entry *) h->root.u.i.link;
+
+ eh = (struct _bfd_sparc_elf_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;
+}
+
+/* Return true if the dynamic symbol for a given section should be
+ omitted when creating a shared library. */
+
+bfd_boolean
+_bfd_sparc_elf_omit_section_dynsym (bfd *output_bfd,
+ struct bfd_link_info *info,
+ asection *p)
+{
+ /* We keep the .got section symbol so that explicit relocations
+ against the _GLOBAL_OFFSET_TABLE_ symbol emitted in PIC mode
+ can be turned into relocations against the .got symbol. */
+ if (strcmp (p->name, ".got") == 0)
+ return FALSE;
+
+ return _bfd_elf_link_omit_section_dynsym (output_bfd, info, p);
+}
+
+/* Set the sizes of the dynamic sections. */
+
+bfd_boolean
+_bfd_sparc_elf_size_dynamic_sections (bfd *output_bfd,
+ struct bfd_link_info *info)
+{
+ struct _bfd_sparc_elf_link_hash_table *htab;
+ bfd *dynobj;
+ asection *s;
+ bfd *ibfd;
+
+ htab = _bfd_sparc_elf_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->size = htab->dynamic_interpreter_size;
+ s->contents = (unsigned char *) htab->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 _bfd_sparc_elf_dyn_relocs *p;
+
+ for (p = 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->size += p->count * SPARC_ELF_RELA_BYTES (htab);
+ 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 = _bfd_sparc_elf_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->size;
+ s->size += SPARC_ELF_WORD_BYTES (htab);
+ if (*local_tls_type == GOT_TLS_GD)
+ s->size += SPARC_ELF_WORD_BYTES (htab);
+ if (info->shared
+ || *local_tls_type == GOT_TLS_GD
+ || *local_tls_type == GOT_TLS_IE)
+ srel->size += SPARC_ELF_RELA_BYTES (htab);
+ }
+ 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->size;
+ htab->sgot->size += (2 * SPARC_ELF_WORD_BYTES (htab));
+ htab->srelgot->size += SPARC_ELF_RELA_BYTES (htab);
+ }
+ 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 (! ABI_64_P (output_bfd)
+ && !htab->is_vxworks
+ && elf_hash_table (info)->dynamic_sections_created)
+ {
+ /* Make space for the trailing nop in .plt. */
+ if (htab->splt->size > 0)
+ htab->splt->size += 1 * SPARC_INSN_BYTES;
+
+ /* 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.
+
+ FIXME: Make this optimization work for 64-bit too. */
+ if (htab->sgot->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)
+ {
+ if ((s->flags & SEC_LINKER_CREATED) == 0)
+ continue;
+
+ if (s == htab->splt
+ || s == htab->sgot
+ || s == htab->sdynbss
+ || s == htab->sgotplt)
+ {
+ /* Strip this section if we don't need it; see the
+ comment below. */
+ }
+ else if (CONST_STRNEQ (s->name, ".rela"))
+ {
+ if (s->size != 0)
+ {
+ /* We use the reloc_count field as a counter if we need
+ to copy relocs into the output file. */
+ s->reloc_count = 0;
+ }
+ }
+ else
+ {
+ /* It's not one of our sections. */
+ continue;
+ }
+
+ if (s->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. */
+ s->flags |= SEC_EXCLUDE;
+ continue;
+ }
+
+ if ((s->flags & SEC_HAS_CONTENTS) == 0)
+ 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->size);
+ if (s->contents == NULL)
+ 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_sparc_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->srelplt->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,
+ SPARC_ELF_RELA_BYTES (htab)))
+ 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;
+ }
+
+ if (ABI_64_P (output_bfd))
+ {
+ int reg;
+ struct _bfd_sparc_elf_app_reg * app_regs;
+ struct elf_strtab_hash *dynstr;
+ struct elf_link_hash_table *eht = elf_hash_table (info);
+
+ /* Add dynamic STT_REGISTER symbols and corresponding DT_SPARC_REGISTER
+ entries if needed. */
+ app_regs = _bfd_sparc_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;
+}
+
+bfd_boolean
+_bfd_sparc_elf_new_section_hook (bfd *abfd, asection *sec)
+{
+ if (!sec->used_by_bfd)
+ {
+ struct _bfd_sparc_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);
+}
+
+bfd_boolean
+_bfd_sparc_elf_relax_section (bfd *abfd ATTRIBUTE_UNUSED,
+ struct bfd_section *section,
+ 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 (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 address - htab->tls_size - htab->tls_sec->vma;
+}
+
+/* Relocate a SPARC ELF section. */
+
+bfd_boolean
+_bfd_sparc_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 _bfd_sparc_elf_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;
+ int num_relocs;
+
+ htab = _bfd_sparc_elf_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;
+ if (ABI_64_P (output_bfd))
+ num_relocs = NUM_SHDR_ENTRIES (& elf_section_data (input_section)->rel_hdr);
+ else
+ num_relocs = input_section->reloc_count;
+ relend = relocs + num_relocs;
+ 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 = SPARC_ELF_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;
+
+ r_symndx = SPARC_ELF_R_SYMNDX (htab, 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;
+ }
+ }
+
+ if (sec != NULL && elf_discarded_section (sec))
+ {
+ /* For relocs against symbols from removed linkonce
+ sections, or sections discarded by a linker script, we
+ just want the section contents zeroed. Avoid any
+ special processing. */
+ _bfd_clear_contents (howto, input_bfd, contents + rel->r_offset);
+ rel->r_info = 0;
+ rel->r_addend = 0;
+ continue;
+ }
+
+ if (info->relocatable)
+ continue;
+
+ 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->forced_local)
+ && h->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 for 64-bit
+ and 4 for 32-bit, 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
+ {
+ SPARC_ELF_PUT_WORD (htab, 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 8 on 64-bit and
+ 4 on 32-bit. 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;
+
+ /* 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 = SPARC_ELF_R_INFO (htab, NULL,
+ 0, R_SPARC_RELATIVE);
+ outrel.r_addend = relocation;
+ relocation = 0;
+ sparc_elf_append_rela (output_bfd, s, &outrel);
+ }
+
+ SPARC_ELF_PUT_WORD (htab, 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:
+ case R_SPARC_PLT64:
+ if (h == NULL || h->plt.offset == (bfd_vma) -1)
+ {
+ r_type = (r_type == R_SPARC_PLT32) ? R_SPARC_32 : R_SPARC_64;
+ goto r_sparc_plt32;
+ }
+ /* Fall through. */
+
+ case R_SPARC_WPLT30:
+ case R_SPARC_HIPLT22:
+ case R_SPARC_LOPLT10:
+ case R_SPARC_PCPLT32:
+ case R_SPARC_PCPLT22:
+ case R_SPARC_PCPLT10:
+ r_sparc_wplt30:
+ /* Relocation is to the entry for this symbol in the
+ procedure linkage table. */
+
+ if (! ABI_64_P (output_bfd))
+ {
+ /* 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;
+ }
+ else
+ {
+ BFD_ASSERT (h != NULL);
+ }
+
+ 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_PLT64)
+ {
+ r_type = r_type == R_SPARC_PLT32 ? R_SPARC_32 : R_SPARC_64;
+ is_plt = TRUE;
+ goto r_sparc_plt32;
+ }
+ break;
+
+ 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:
+ 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_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:
+ r_sparc_plt32:
+ if ((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)
+ && (! howto->pc_relative
+ || (h != NULL
+ && h->dynindx != -1
+ && (! info->symbolic
+ || !h->def_regular))))
+ || (!info->shared
+ && h != NULL
+ && h->dynindx != -1
+ && !h->non_got_ref
+ && ((h->def_dynamic
+ && !h->def_regular)
+ || h->root.type == bfd_link_hash_undefweak
+ || h->root.type == bfd_link_hash_undefined)))
+ {
+ Elf_Internal_Rela outrel;
+ 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_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->def_regular))
+ {
+ BFD_ASSERT (h->dynindx != -1);
+ outrel.r_info = SPARC_ELF_R_INFO (htab, rel, h->dynindx, r_type);
+ outrel.r_addend = rel->r_addend;
+ }
+ else
+ {
+ if (r_type == R_SPARC_32 || r_type == R_SPARC_64)
+ {
+ outrel.r_info = SPARC_ELF_R_INFO (htab, NULL,
+ 0, R_SPARC_RELATIVE);
+ outrel.r_addend = relocation + rel->r_addend;
+ }
+ else
+ {
+ long indx;
+
+ outrel.r_addend = relocation + rel->r_addend;
+
+ 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;
+
+ /* 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;
+
+ if (indx == 0)
+ {
+ osec = htab->elf.text_index_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)
+ (_("%B: probably compiled without -fPIC?"),
+ input_bfd);
+ bfd_set_error (bfd_error_bad_value);
+ return FALSE;
+ }
+ }
+
+ outrel.r_info = SPARC_ELF_R_INFO (htab, rel, indx,
+ r_type);
+ }
+ }
+
+ sparc_elf_append_rela (output_bfd, sreloc, &outrel);
+
+ /* 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 (! ABI_64_P (input_bfd)
+ && ! _bfd_sparc_elf_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 = sparc_elf_tls_transition (info, input_bfd, r_type, h == NULL);
+ tls_type = GOT_UNKNOWN;
+ if (h == NULL && local_got_offsets)
+ tls_type = _bfd_sparc_elf_local_got_tls_type (input_bfd) [r_symndx];
+ else if (h != NULL)
+ {
+ tls_type = _bfd_sparc_elf_hash_entry(h)->tls_type;
+ if (!info->shared && h->dynindx == -1 && tls_type == GOT_TLS_IE)
+ switch (SPARC_ELF_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;
+ int dr_type, indx;
+
+ if (htab->srelgot == NULL)
+ abort ();
+
+ SPARC_ELF_PUT_WORD (htab, 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 = SPARC_ELF_TPOFF_RELOC (htab);
+ else
+ dr_type = SPARC_ELF_DTPMOD_RELOC (htab);
+ if (dr_type == SPARC_ELF_TPOFF_RELOC (htab) && indx == 0)
+ outrel.r_addend = relocation - dtpoff_base (info);
+ else
+ outrel.r_addend = 0;
+ outrel.r_info = SPARC_ELF_R_INFO (htab, NULL, indx, dr_type);
+ sparc_elf_append_rela (output_bfd, htab->srelgot, &outrel);
+
+ if (r_type == R_SPARC_TLS_GD_HI22
+ || r_type == R_SPARC_TLS_GD_LO10)
+ {
+ if (indx == 0)
+ {
+ BFD_ASSERT (! unresolved_reloc);
+ SPARC_ELF_PUT_WORD (htab, output_bfd,
+ relocation - dtpoff_base (info),
+ (htab->sgot->contents + off
+ + SPARC_ELF_WORD_BYTES (htab)));
+ }
+ else
+ {
+ SPARC_ELF_PUT_WORD (htab, output_bfd, 0,
+ (htab->sgot->contents + off
+ + SPARC_ELF_WORD_BYTES (htab)));
+ outrel.r_info = SPARC_ELF_R_INFO (htab, NULL, indx,
+ SPARC_ELF_DTPOFF_RELOC (htab));
+ outrel.r_offset += SPARC_ELF_WORD_BYTES (htab);
+ sparc_elf_append_rela (output_bfd, htab->srelgot,
+ &outrel);
+ }
+ }
+ else if (dr_type == SPARC_ELF_DTPMOD_RELOC (htab))
+ {
+ SPARC_ELF_PUT_WORD (htab, output_bfd, 0,
+ (htab->sgot->contents + off
+ + SPARC_ELF_WORD_BYTES (htab)));
+ }
+ }
+
+ 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);
+ break;
+ }
+
+ r_type = (r_type == R_SPARC_TLS_LDO_HIX22
+ ? R_SPARC_TLS_LE_HIX22 : R_SPARC_TLS_LE_LOX10);
+ /* Fall through. */
+
+ 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 = SPARC_ELF_R_INFO (htab, NULL, 0, r_type);
+ outrel.r_addend = relocation - dtpoff_base (info)
+ + rel->r_addend;
+ }
+
+ sparc_elf_append_rela (output_bfd, sreloc, &outrel);
+ 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 = _bfd_sparc_elf_local_got_tls_type (input_bfd) [r_symndx];
+ else if (h != NULL)
+ tls_type = _bfd_sparc_elf_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
+ && SPARC_ELF_R_TYPE (rel[1].r_info) == R_SPARC_TLS_GD_ADD
+ && rel[1].r_offset == rel->r_offset + 4
+ && SPARC_ELF_R_SYMNDX (htab, 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,ldx} [%reg1 + %reg2], %o0, %tie_ldx(foo)
+ add %g7, %o0, %o0, %tie_add(foo).
+ add is 0x80000000 | (rd << 25) | (rs1 << 14) | rs2,
+ ld is 0xc0000000 | (rd << 25) | (rs1 << 14) | rs2,
+ ldx is 0xc0580000 | (rd << 25) | (rs1 << 14) | rs2. */
+ bfd_put_32 (output_bfd, insn | (ABI_64_P (output_bfd) ? 0xc0580000 : 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 = _bfd_sparc_elf_local_got_tls_type (input_bfd) [r_symndx];
+ else if (h != NULL)
+ tls_type = _bfd_sparc_elf_hash_entry(h)->tls_type;
+ if (! info->shared || tls_type == GOT_TLS_IE)
+ {
+ /* add %reg1, %reg2, %reg3, %tgd_add(foo)
+ changed into IE:
+ {ld,ldx} [%reg1 + %reg2], %reg3, %tie_ldx(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 | (ABI_64_P (output_bfd) ? 0xc0580000 : 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:
+ case R_SPARC_TLS_DTPOFF64:
+ 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->def_dynamic))
+ (*_bfd_error_handler)
+ (_("%B(%A+0x%lx): unresolvable %s relocation against symbol `%s'"),
+ input_bfd,
+ input_section,
+ (long) rel->r_offset,
+ howto->name,
+ h->root.root.string);
+
+ r = bfd_reloc_continue;
+ if (r_type == R_SPARC_OLO10)
+ {
+ bfd_vma x;
+
+ if (! ABI_64_P (output_bfd))
+ abort ();
+
+ 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);
+ }
+ else 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);
+
+ r = bfd_check_overflow (howto->complain_on_overflow,
+ howto->bitsize, howto->rightshift,
+ bfd_arch_bits_per_address (input_bfd),
+ relocation);
+ }
+ 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;
+ if (r_type == R_SPARC_TLS_LE_HIX22)
+ 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_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 &= 0x3ff;
+ if (r_type == R_SPARC_TLS_LE_LOX10)
+ relocation |= 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_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);
+ }
+ else if (r_type == 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;
+ }
+ else if ((r_type == R_SPARC_WDISP30 || r_type == R_SPARC_WPLT30)
+ && sec_do_relax (input_section)
+ && rel->r_offset + 4 < input_section->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 branch 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. */
+ if (((reloc & 0x3c0000) == 0
+ || (reloc & 0x3c0000) == 0x3c0000)
+ && (ABI_64_P (output_bfd)
+ || 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;
+
+ /* 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 in
+ this case and also for discarded entries. */
+ if ((r_type == R_SPARC_32 || r_type == R_SPARC_DISP32)
+ && (((input_section->flags & SEC_DEBUGGING) != 0
+ && strcmp (bfd_section_name (input_bfd,
+ input_section),
+ ".stab") == 0)
+ || _bfd_elf_section_offset (output_bfd, info,
+ input_section,
+ rel->r_offset)
+ == (bfd_vma)-1))
+ break;
+
+ if (h != NULL)
+ {
+ /* 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. */
+ if (h->root.type == bfd_link_hash_undefweak
+ && howto->pc_relative)
+ break;
+
+ name = NULL;
+ }
+ 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, (h ? &h->root : NULL), name, howto->name,
+ (bfd_vma) 0, input_bfd, input_section,
+ rel->r_offset)))
+ return FALSE;
+ }
+ break;
+ }
+ }
+ }
+
+ return TRUE;
+}
+
+/* Build a VxWorks PLT entry. PLT_INDEX is the index of the PLT entry
+ and PLT_OFFSET is the byte offset from the start of .plt. GOT_OFFSET
+ is the offset of the associated .got.plt entry from
+ _GLOBAL_OFFSET_TABLE_. */
+
+static void
+sparc_vxworks_build_plt_entry (bfd *output_bfd, struct bfd_link_info *info,
+ bfd_vma plt_offset, bfd_vma plt_index,
+ bfd_vma got_offset)
+{
+ bfd_vma got_base;
+ const bfd_vma *plt_entry;
+ struct _bfd_sparc_elf_link_hash_table *htab;
+ bfd_byte *loc;
+ Elf_Internal_Rela rela;
+
+ htab = _bfd_sparc_elf_hash_table (info);
+ if (info->shared)
+ {
+ plt_entry = sparc_vxworks_shared_plt_entry;
+ got_base = 0;
+ }
+ else
+ {
+ plt_entry = sparc_vxworks_exec_plt_entry;
+ got_base = (htab->elf.hgot->root.u.def.value
+ + htab->elf.hgot->root.u.def.section->output_offset
+ + htab->elf.hgot->root.u.def.section->output_section->vma);
+ }
+
+ /* Fill in the entry in the procedure linkage table. */
+ bfd_put_32 (output_bfd, plt_entry[0] + ((got_base + got_offset) >> 10),
+ htab->splt->contents + plt_offset);
+ bfd_put_32 (output_bfd, plt_entry[1] + ((got_base + got_offset) & 0x3ff),
+ htab->splt->contents + plt_offset + 4);
+ bfd_put_32 (output_bfd, plt_entry[2],
+ htab->splt->contents + plt_offset + 8);
+ bfd_put_32 (output_bfd, plt_entry[3],
+ htab->splt->contents + plt_offset + 12);
+ bfd_put_32 (output_bfd, plt_entry[4],
+ htab->splt->contents + plt_offset + 16);
+ bfd_put_32 (output_bfd, plt_entry[5] + (plt_index >> 10),
+ htab->splt->contents + plt_offset + 20);
+ /* PC-relative displacement for a branch to the start of
+ the PLT section. */
+ bfd_put_32 (output_bfd, plt_entry[6] + (((-plt_offset - 24) >> 2)
+ & 0x003fffff),
+ htab->splt->contents + plt_offset + 24);
+ bfd_put_32 (output_bfd, plt_entry[7] + (plt_index & 0x3ff),
+ htab->splt->contents + plt_offset + 28);
+
+ /* Fill in the .got.plt entry, pointing initially at the
+ second half of the PLT entry. */
+ BFD_ASSERT (htab->sgotplt != NULL);
+ bfd_put_32 (output_bfd,
+ htab->splt->output_section->vma
+ + htab->splt->output_offset
+ + plt_offset + 20,
+ htab->sgotplt->contents + got_offset);
+
+ /* Add relocations to .rela.plt.unloaded. */
+ if (!info->shared)
+ {
+ loc = (htab->srelplt2->contents
+ + (2 + 3 * plt_index) * sizeof (Elf32_External_Rela));
+
+ /* Relocate the initial sethi. */
+ rela.r_offset = (htab->splt->output_section->vma
+ + htab->splt->output_offset
+ + plt_offset);
+ rela.r_info = ELF32_R_INFO (htab->elf.hgot->indx, R_SPARC_HI22);
+ rela.r_addend = got_offset;
+ bfd_elf32_swap_reloca_out (output_bfd, &rela, loc);
+ loc += sizeof (Elf32_External_Rela);
+
+ /* Likewise the following or. */
+ rela.r_offset += 4;
+ rela.r_info = ELF32_R_INFO (htab->elf.hgot->indx, R_SPARC_LO10);
+ bfd_elf32_swap_reloca_out (output_bfd, &rela, loc);
+ loc += sizeof (Elf32_External_Rela);
+
+ /* Relocate the .got.plt entry. */
+ rela.r_offset = (htab->sgotplt->output_section->vma
+ + htab->sgotplt->output_offset
+ + got_offset);
+ rela.r_info = ELF32_R_INFO (htab->elf.hplt->indx, R_SPARC_32);
+ rela.r_addend = plt_offset + 20;
+ bfd_elf32_swap_reloca_out (output_bfd, &rela, loc);
+ }
+}
+
+/* Finish up dynamic symbol handling. We set the contents of various
+ dynamic sections here. */
+
+bfd_boolean
+_bfd_sparc_elf_finish_dynamic_symbol (bfd *output_bfd,
+ struct bfd_link_info *info,
+ struct elf_link_hash_entry *h,
+ Elf_Internal_Sym *sym)
+{
+ bfd *dynobj;
+ struct _bfd_sparc_elf_link_hash_table *htab;
+ const struct elf_backend_data *bed;
+
+ htab = _bfd_sparc_elf_hash_table (info);
+ dynobj = htab->elf.dynobj;
+ bed = get_elf_backend_data (output_bfd);
+
+ if (h->plt.offset != (bfd_vma) -1)
+ {
+ asection *splt;
+ asection *srela;
+ Elf_Internal_Rela rela;
+ bfd_byte *loc;
+ bfd_vma r_offset, got_offset;
+ int rela_index;
+
+ /* This symbol has an entry in the PLT. 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 .rela.plt section. */
+ if (htab->is_vxworks)
+ {
+ /* Work out the index of this PLT entry. */
+ rela_index = ((h->plt.offset - htab->plt_header_size)
+ / htab->plt_entry_size);
+
+ /* Calculate the offset of the associated .got.plt entry.
+ The first three entries are reserved. */
+ got_offset = (rela_index + 3) * 4;
+
+ sparc_vxworks_build_plt_entry (output_bfd, info, h->plt.offset,
+ rela_index, got_offset);
+
+
+ /* On VxWorks, the relocation points to the .got.plt entry,
+ not the .plt entry. */
+ rela.r_offset = (htab->sgotplt->output_section->vma
+ + htab->sgotplt->output_offset
+ + got_offset);
+ rela.r_addend = 0;
+ }
+ else
+ {
+ /* Fill in the entry in the procedure linkage table. */
+ rela_index = SPARC_ELF_BUILD_PLT_ENTRY (htab, output_bfd, splt,
+ h->plt.offset, splt->size,
+ &r_offset);
+
+ rela.r_offset = r_offset
+ + (splt->output_section->vma + splt->output_offset);
+ if (! ABI_64_P (output_bfd)
+ || h->plt.offset < (PLT64_LARGE_THRESHOLD * PLT64_ENTRY_SIZE))
+ {
+ rela.r_addend = 0;
+ }
+ else
+ {
+ rela.r_addend = (-(h->plt.offset + 4)
+ - splt->output_section->vma
+ - splt->output_offset);
+ }
+ }
+ rela.r_info = SPARC_ELF_R_INFO (htab, NULL, 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 += rela_index * bed->s->sizeof_rela;
+ bed->s->swap_reloca_out (output_bfd, &rela, loc);
+
+ if (!h->def_regular)
+ {
+ /* 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->ref_regular_nonweak)
+ sym->st_value = 0;
+ }
+ }
+
+ if (h->got.offset != (bfd_vma) -1
+ && _bfd_sparc_elf_hash_entry(h)->tls_type != GOT_TLS_GD
+ && _bfd_sparc_elf_hash_entry(h)->tls_type != GOT_TLS_IE)
+ {
+ asection *sgot;
+ asection *srela;
+ Elf_Internal_Rela rela;
+
+ /* This symbol has an entry in the GOT. 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->def_regular)
+ {
+ asection *sec = h->root.u.def.section;
+ rela.r_info = SPARC_ELF_R_INFO (htab, NULL, 0, R_SPARC_RELATIVE);
+ rela.r_addend = (h->root.u.def.value
+ + sec->output_section->vma
+ + sec->output_offset);
+ }
+ else
+ {
+ rela.r_info = SPARC_ELF_R_INFO (htab, NULL, h->dynindx, R_SPARC_GLOB_DAT);
+ rela.r_addend = 0;
+ }
+
+ SPARC_ELF_PUT_WORD (htab, output_bfd, 0,
+ sgot->contents + (h->got.offset & ~(bfd_vma) 1));
+ sparc_elf_append_rela (output_bfd, srela, &rela);
+ }
+
+ if (h->needs_copy)
+ {
+ asection *s;
+ Elf_Internal_Rela rela;
+
+ /* 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 = SPARC_ELF_R_INFO (htab, NULL, h->dynindx, R_SPARC_COPY);
+ rela.r_addend = 0;
+ sparc_elf_append_rela (output_bfd, s, &rela);
+ }
+
+ /* Mark some specially defined symbols as absolute. On VxWorks,
+ _GLOBAL_OFFSET_TABLE_ is not absolute: it is relative to the
+ ".got" section. Likewise _PROCEDURE_LINKAGE_TABLE_ and ".plt". */
+ if (strcmp (h->root.root.string, "_DYNAMIC") == 0
+ || (!htab->is_vxworks
+ && (h == htab->elf.hgot || h == htab->elf.hplt)))
+ sym->st_shndx = SHN_ABS;
+
+ return TRUE;
+}
+
+/* Finish up the dynamic sections. */
+
+static bfd_boolean
+sparc_finish_dyn (bfd *output_bfd, struct bfd_link_info *info,
+ bfd *dynobj, asection *sdyn,
+ asection *splt ATTRIBUTE_UNUSED)
+{
+ struct _bfd_sparc_elf_link_hash_table *htab;
+ const struct elf_backend_data *bed;
+ bfd_byte *dyncon, *dynconend;
+ size_t dynsize;
+ int stt_regidx = -1;
+ bfd_boolean abi_64_p;
+
+ htab = _bfd_sparc_elf_hash_table (info);
+ bed = get_elf_backend_data (output_bfd);
+ dynsize = bed->s->sizeof_dyn;
+ dynconend = sdyn->contents + sdyn->size;
+ abi_64_p = ABI_64_P (output_bfd);
+ for (dyncon = sdyn->contents; dyncon < dynconend; dyncon += dynsize)
+ {
+ Elf_Internal_Dyn dyn;
+ const char *name;
+ bfd_boolean size;
+
+ bed->s->swap_dyn_in (dynobj, dyncon, &dyn);
+
+ if (htab->is_vxworks && dyn.d_tag == DT_RELASZ)
+ {
+ /* On VxWorks, DT_RELASZ should not include the relocations
+ in .rela.plt. */
+ if (htab->srelplt)
+ {
+ dyn.d_un.d_val -= htab->srelplt->size;
+ bed->s->swap_dyn_out (output_bfd, &dyn, dyncon);
+ }
+ }
+ else if (htab->is_vxworks && dyn.d_tag == DT_PLTGOT)
+ {
+ /* On VxWorks, DT_PLTGOT should point to the start of the GOT,
+ not to the start of the PLT. */
+ if (htab->sgotplt)
+ {
+ dyn.d_un.d_val = (htab->sgotplt->output_section->vma
+ + htab->sgotplt->output_offset);
+ bed->s->swap_dyn_out (output_bfd, &dyn, dyncon);
+ }
+ }
+ else if (abi_64_p && dyn.d_tag == 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++;
+ bed->s->swap_dyn_out (output_bfd, &dyn, dyncon);
+ }
+ else
+ {
+ 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
+ dyn.d_un.d_val = s->size;
+ }
+ bed->s->swap_dyn_out (output_bfd, &dyn, dyncon);
+ }
+ }
+ }
+ return TRUE;
+}
+
+/* Install the first PLT entry in a VxWorks executable and make sure that
+ .rela.plt.unloaded relocations have the correct symbol indexes. */
+
+static void
+sparc_vxworks_finish_exec_plt (bfd *output_bfd, struct bfd_link_info *info)
+{
+ struct _bfd_sparc_elf_link_hash_table *htab;
+ Elf_Internal_Rela rela;
+ bfd_vma got_base;
+ bfd_byte *loc;
+
+ htab = _bfd_sparc_elf_hash_table (info);
+
+ /* Calculate the absolute value of _GLOBAL_OFFSET_TABLE_. */
+ got_base = (htab->elf.hgot->root.u.def.section->output_section->vma
+ + htab->elf.hgot->root.u.def.section->output_offset
+ + htab->elf.hgot->root.u.def.value);
+
+ /* Install the initial PLT entry. */
+ bfd_put_32 (output_bfd,
+ sparc_vxworks_exec_plt0_entry[0] + ((got_base + 8) >> 10),
+ htab->splt->contents);
+ bfd_put_32 (output_bfd,
+ sparc_vxworks_exec_plt0_entry[1] + ((got_base + 8) & 0x3ff),
+ htab->splt->contents + 4);
+ bfd_put_32 (output_bfd,
+ sparc_vxworks_exec_plt0_entry[2],
+ htab->splt->contents + 8);
+ bfd_put_32 (output_bfd,
+ sparc_vxworks_exec_plt0_entry[3],
+ htab->splt->contents + 12);
+ bfd_put_32 (output_bfd,
+ sparc_vxworks_exec_plt0_entry[4],
+ htab->splt->contents + 16);
+
+ loc = htab->srelplt2->contents;
+
+ /* Add an unloaded relocation for the initial entry's "sethi". */
+ rela.r_offset = (htab->splt->output_section->vma
+ + htab->splt->output_offset);
+ rela.r_info = ELF32_R_INFO (htab->elf.hgot->indx, R_SPARC_HI22);
+ rela.r_addend = 8;
+ bfd_elf32_swap_reloca_out (output_bfd, &rela, loc);
+ loc += sizeof (Elf32_External_Rela);
+
+ /* Likewise the following "or". */
+ rela.r_offset += 4;
+ rela.r_info = ELF32_R_INFO (htab->elf.hgot->indx, R_SPARC_LO10);
+ bfd_elf32_swap_reloca_out (output_bfd, &rela, loc);
+ loc += sizeof (Elf32_External_Rela);
+
+ /* Fix up the remaining .rela.plt.unloaded relocations. They may have
+ the wrong symbol index for _G_O_T_ or _P_L_T_ depending on the order
+ in which symbols were output. */
+ while (loc < htab->srelplt2->contents + htab->srelplt2->size)
+ {
+ Elf_Internal_Rela rel;
+
+ /* The entry's initial "sethi" (against _G_O_T_). */
+ bfd_elf32_swap_reloc_in (output_bfd, loc, &rel);
+ rel.r_info = ELF32_R_INFO (htab->elf.hgot->indx, R_SPARC_HI22);
+ bfd_elf32_swap_reloc_out (output_bfd, &rel, loc);
+ loc += sizeof (Elf32_External_Rela);
+
+ /* The following "or" (also against _G_O_T_). */
+ bfd_elf32_swap_reloc_in (output_bfd, loc, &rel);
+ rel.r_info = ELF32_R_INFO (htab->elf.hgot->indx, R_SPARC_LO10);
+ bfd_elf32_swap_reloc_out (output_bfd, &rel, loc);
+ loc += sizeof (Elf32_External_Rela);
+
+ /* The .got.plt entry (against _P_L_T_). */
+ bfd_elf32_swap_reloc_in (output_bfd, loc, &rel);
+ rel.r_info = ELF32_R_INFO (htab->elf.hplt->indx, R_SPARC_32);
+ bfd_elf32_swap_reloc_out (output_bfd, &rel, loc);
+ loc += sizeof (Elf32_External_Rela);
+ }
+}
+
+/* Install the first PLT entry in a VxWorks shared object. */
+
+static void
+sparc_vxworks_finish_shared_plt (bfd *output_bfd, struct bfd_link_info *info)
+{
+ struct _bfd_sparc_elf_link_hash_table *htab;
+ unsigned int i;
+
+ htab = _bfd_sparc_elf_hash_table (info);
+ for (i = 0; i < ARRAY_SIZE (sparc_vxworks_shared_plt0_entry); i++)
+ bfd_put_32 (output_bfd, sparc_vxworks_shared_plt0_entry[i],
+ htab->splt->contents + i * 4);
+}
+
+bfd_boolean
+_bfd_sparc_elf_finish_dynamic_sections (bfd *output_bfd, struct bfd_link_info *info)
+{
+ bfd *dynobj;
+ asection *sdyn;
+ struct _bfd_sparc_elf_link_hash_table *htab;
+
+ htab = _bfd_sparc_elf_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;
+
+ splt = bfd_get_section_by_name (dynobj, ".plt");
+ BFD_ASSERT (splt != NULL && sdyn != NULL);
+
+ if (!sparc_finish_dyn (output_bfd, info, dynobj, sdyn, splt))
+ return FALSE;
+
+ /* Initialize the contents of the .plt section. */
+ if (splt->size > 0)
+ {
+ if (htab->is_vxworks)
+ {
+ if (info->shared)
+ sparc_vxworks_finish_shared_plt (output_bfd, info);
+ else
+ sparc_vxworks_finish_exec_plt (output_bfd, info);
+ }
+ else
+ {
+ memset (splt->contents, 0, htab->plt_header_size);
+ if (!ABI_64_P (output_bfd))
+ bfd_put_32 (output_bfd, (bfd_vma) SPARC_NOP,
+ splt->contents + splt->size - 4);
+ }
+ }
+
+ elf_section_data (splt->output_section)->this_hdr.sh_entsize
+ = (htab->is_vxworks || !ABI_64_P (output_bfd))
+ ? 0 : htab->plt_entry_size;
+ }
+
+ /* Set the first entry in the global offset table to the address of
+ the dynamic section. */
+ if (htab->sgot && htab->sgot->size > 0)
+ {
+ bfd_vma val = (sdyn ?
+ sdyn->output_section->vma + sdyn->output_offset :
+ 0);
+
+ SPARC_ELF_PUT_WORD (htab, output_bfd, val, htab->sgot->contents);
+ }
+
+ if (htab->sgot)
+ elf_section_data (htab->sgot->output_section)->this_hdr.sh_entsize =
+ SPARC_ELF_WORD_BYTES (htab);
+
+ return TRUE;
+}
+
+
+/* Set the right machine number for a SPARC ELF file. */
+
+bfd_boolean
+_bfd_sparc_elf_object_p (bfd *abfd)
+{
+ if (ABI_64_P (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);
+ }
+ else
+ {
+ 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);
+ }
+}
+
+/* Return address for Ith PLT stub in section PLT, for relocation REL
+ or (bfd_vma) -1 if it should not be included. */
+
+bfd_vma
+_bfd_sparc_elf_plt_sym_val (bfd_vma i, const asection *plt, const arelent *rel)
+{
+ if (ABI_64_P (plt->owner))
+ {
+ bfd_vma j;
+
+ i += PLT64_HEADER_SIZE / PLT64_ENTRY_SIZE;
+ if (i < PLT64_LARGE_THRESHOLD)
+ return plt->vma + i * PLT64_ENTRY_SIZE;
+
+ j = (i - PLT64_LARGE_THRESHOLD) % 160;
+ i -= j;
+ return plt->vma + i * PLT64_ENTRY_SIZE + j * 4 * 6;
+ }
+ else
+ return rel->address;
+}
diff --git a/contrib/binutils/bfd/elfxx-sparc.h b/contrib/binutils/bfd/elfxx-sparc.h
new file mode 100644
index 0000000..787fd33
--- /dev/null
+++ b/contrib/binutils/bfd/elfxx-sparc.h
@@ -0,0 +1,146 @@
+/* SPARC ELF specific backend routines.
+ Copyright 2005, 2007 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., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include "elf/common.h"
+#include "elf/internal.h"
+
+struct _bfd_sparc_elf_section_data
+{
+ struct bfd_elf_section_data elf;
+ unsigned int do_relax, reloc_count;
+};
+
+#define sec_do_relax(sec) \
+ ((struct _bfd_sparc_elf_section_data *) elf_section_data (sec))->do_relax
+#define canon_reloc_count(sec) \
+ ((struct _bfd_sparc_elf_section_data *) elf_section_data (sec))->reloc_count
+
+struct _bfd_sparc_elf_app_reg
+{
+ unsigned char bind;
+ unsigned short shndx;
+ bfd *abfd;
+ char *name;
+};
+
+/* Sparc ELF linker hash table. */
+
+struct _bfd_sparc_elf_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;
+
+ /* True if the target system is VxWorks. */
+ int is_vxworks;
+
+ /* The (unloaded but important) .rela.plt.unloaded section, for VxWorks. */
+ asection *srelplt2;
+
+ /* .got.plt is only used on VxWorks. */
+ asection *sgotplt;
+
+ void (*put_word) (bfd *, bfd_vma, void *);
+ bfd_vma (*r_info) (Elf_Internal_Rela *, bfd_vma, bfd_vma);
+ bfd_vma (*r_symndx) (bfd_vma);
+ int (*build_plt_entry) (bfd *, asection *, bfd_vma, bfd_vma, bfd_vma *);
+ const char *dynamic_interpreter;
+ int dynamic_interpreter_size;
+ unsigned int word_align_power;
+ unsigned int align_power_max;
+ unsigned int plt_header_size;
+ unsigned int plt_entry_size;
+ int bytes_per_word;
+ int bytes_per_rela;
+ int dtpoff_reloc;
+ int dtpmod_reloc;
+ int tpoff_reloc;
+
+ struct _bfd_sparc_elf_app_reg app_regs [4];
+};
+
+/* Get the SPARC ELF linker hash table from a link_info structure. */
+
+#define _bfd_sparc_elf_hash_table(p) \
+ ((struct _bfd_sparc_elf_link_hash_table *) ((p)->hash))
+
+extern reloc_howto_type *_bfd_sparc_elf_reloc_type_lookup
+ (bfd *, bfd_reloc_code_real_type);
+extern reloc_howto_type *_bfd_sparc_elf_reloc_name_lookup
+ (bfd *, const char *);
+extern void _bfd_sparc_elf_info_to_howto
+ (bfd *, arelent *, Elf_Internal_Rela *);
+extern reloc_howto_type *_bfd_sparc_elf_info_to_howto_ptr
+ (unsigned int);
+extern bfd_boolean _bfd_sparc_elf_mkobject
+ (bfd *);
+extern struct bfd_link_hash_table *_bfd_sparc_elf_link_hash_table_create
+ (bfd *);
+extern bfd_boolean _bfd_sparc_elf_create_dynamic_sections
+ (bfd *, struct bfd_link_info *);
+extern void _bfd_sparc_elf_copy_indirect_symbol
+ (struct bfd_link_info *,
+ struct elf_link_hash_entry *,
+ struct elf_link_hash_entry *);
+extern bfd_boolean _bfd_sparc_elf_check_relocs
+ (bfd *, struct bfd_link_info *,
+ asection *, const Elf_Internal_Rela *);
+extern asection *_bfd_sparc_elf_gc_mark_hook
+ (asection *, struct bfd_link_info *,
+ Elf_Internal_Rela *, struct elf_link_hash_entry *,
+ Elf_Internal_Sym *);
+extern bfd_boolean _bfd_sparc_elf_gc_sweep_hook
+ (bfd *, struct bfd_link_info *,
+ asection *, const Elf_Internal_Rela *);
+extern bfd_boolean _bfd_sparc_elf_adjust_dynamic_symbol
+ (struct bfd_link_info *, struct elf_link_hash_entry *);
+extern bfd_boolean _bfd_sparc_elf_omit_section_dynsym
+ (bfd *, struct bfd_link_info *, asection *);
+extern bfd_boolean _bfd_sparc_elf_size_dynamic_sections
+ (bfd *, struct bfd_link_info *);
+extern bfd_boolean _bfd_sparc_elf_new_section_hook
+ (bfd *, asection *);
+extern bfd_boolean _bfd_sparc_elf_relax_section
+ (bfd *, struct bfd_section *, struct bfd_link_info *, bfd_boolean *);
+extern bfd_boolean _bfd_sparc_elf_relocate_section
+ (bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *,
+ Elf_Internal_Rela *, Elf_Internal_Sym *, asection **);
+extern bfd_boolean _bfd_sparc_elf_finish_dynamic_symbol
+ (bfd *, struct bfd_link_info *, struct elf_link_hash_entry *,
+ Elf_Internal_Sym *sym);
+extern bfd_boolean _bfd_sparc_elf_finish_dynamic_sections
+ (bfd *, struct bfd_link_info *);
+extern bfd_boolean _bfd_sparc_elf_object_p
+ (bfd *);
+extern bfd_vma _bfd_sparc_elf_plt_sym_val
+ (bfd_vma, const asection *, const arelent *);
diff --git a/contrib/binutils/bfd/elfxx-target.h b/contrib/binutils/bfd/elfxx-target.h
index e250a97..a7104b6 100644
--- a/contrib/binutils/bfd/elfxx-target.h
+++ b/contrib/binutils/bfd/elfxx-target.h
@@ -1,6 +1,6 @@
/* Target definitions for NN-bit ELF
Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
- 2003 Free Software Foundation, Inc.
+ 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@@ -16,7 +16,7 @@
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. */
+ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
/* This structure contains everything that BFD knows about a target.
It includes things like its byte order, name, what routines to call
@@ -26,20 +26,31 @@
There are two such structures here: one for big-endian machines and
one for little-endian machines. */
+#ifndef bfd_elfNN_close_and_cleanup
#define bfd_elfNN_close_and_cleanup _bfd_elf_close_and_cleanup
-#define bfd_elfNN_bfd_free_cached_info _bfd_generic_bfd_free_cached_info
+#endif
+#ifndef bfd_elfNN_bfd_free_cached_info
+#define bfd_elfNN_bfd_free_cached_info _bfd_free_cached_info
+#endif
#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_get_synthetic_symtab
+#define bfd_elfNN_get_synthetic_symtab \
+ _bfd_elf_get_synthetic_symtab
+#endif
#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
+#ifndef bfd_elfNN_find_inliner_info
+#define bfd_elfNN_find_inliner_info _bfd_elf_find_inliner_info
+#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 \
@@ -68,9 +79,6 @@
#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
@@ -95,6 +103,9 @@
#ifndef elf_backend_want_p_paddr_set_to_zero
#define elf_backend_want_p_paddr_set_to_zero 0
#endif
+#ifndef elf_backend_default_execstack
+#define elf_backend_default_execstack 1
+#endif
#define bfd_elfNN_bfd_debug_info_start bfd_void
#define bfd_elfNN_bfd_debug_info_end bfd_void
@@ -119,8 +130,14 @@
#ifndef elf_backend_want_got_sym
#define elf_backend_want_got_sym 1
#endif
+#ifndef elf_backend_gc_mark_dynamic_ref
+#define elf_backend_gc_mark_dynamic_ref bfd_elf_gc_mark_dynamic_ref_symbol
+#endif
#ifndef elf_backend_gc_mark_hook
-#define elf_backend_gc_mark_hook NULL
+#define elf_backend_gc_mark_hook _bfd_elf_gc_mark_hook
+#endif
+#ifndef elf_backend_gc_mark_extra_sections
+#define elf_backend_gc_mark_extra_sections NULL
#endif
#ifndef elf_backend_gc_sweep_hook
#define elf_backend_gc_sweep_hook NULL
@@ -134,8 +151,17 @@
_bfd_elf_merge_sections
#endif
+#ifndef bfd_elfNN_bfd_is_group_section
+#define bfd_elfNN_bfd_is_group_section bfd_elf_is_group_section
+#endif
+
#ifndef bfd_elfNN_bfd_discard_group
-#define bfd_elfNN_bfd_discard_group bfd_elf_discard_group
+#define bfd_elfNN_bfd_discard_group bfd_generic_discard_group
+#endif
+
+#ifndef bfd_elfNN_section_already_linked
+#define bfd_elfNN_section_already_linked \
+ _bfd_elf_section_already_linked
#endif
#ifndef bfd_elfNN_bfd_make_debug_symbol
@@ -152,6 +178,10 @@
#define bfd_elfNN_bfd_copy_private_section_data \
_bfd_elf_copy_private_section_data
#endif
+#ifndef bfd_elfNN_bfd_copy_private_header_data
+#define bfd_elfNN_bfd_copy_private_header_data \
+ _bfd_elf_copy_private_header_data
+#endif
#ifndef bfd_elfNN_bfd_copy_private_bfd_data
#define bfd_elfNN_bfd_copy_private_bfd_data \
_bfd_elf_copy_private_bfd_data
@@ -171,6 +201,10 @@
#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_bfd_is_target_special_symbol
+#define bfd_elfNN_bfd_is_target_special_symbol \
+ ((bfd_boolean (*) (bfd *, asymbol *)) bfd_false)
+#endif
#ifndef bfd_elfNN_get_dynamic_reloc_upper_bound
#define bfd_elfNN_get_dynamic_reloc_upper_bound \
@@ -257,11 +291,30 @@
#define elf_info_to_howto_rel 0
#endif
+#ifndef ELF_OSABI
+#define ELF_OSABI ELFOSABI_NONE
+#endif
+
#ifndef ELF_MAXPAGESIZE
#error ELF_MAXPAGESIZE is not defined
#define ELF_MAXPAGESIZE 1
#endif
+#ifndef ELF_MINPAGESIZE
+#define ELF_MINPAGESIZE ELF_MAXPAGESIZE
+#endif
+
+#ifndef ELF_COMMONPAGESIZE
+#define ELF_COMMONPAGESIZE ELF_MAXPAGESIZE
+#endif
+
+#ifndef ELF_DYNAMIC_SEC_FLAGS
+/* Note that we set the SEC_IN_MEMORY flag for these sections. */
+#define ELF_DYNAMIC_SEC_FLAGS \
+ (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS \
+ | SEC_IN_MEMORY | SEC_LINKER_CREATED)
+#endif
+
#ifndef elf_backend_collect
#define elf_backend_collect FALSE
#endif
@@ -284,6 +337,9 @@
#ifndef elf_backend_get_symbol_type
#define elf_backend_get_symbol_type 0
#endif
+#ifndef elf_backend_archive_symbol_lookup
+#define elf_backend_archive_symbol_lookup _bfd_elf_archive_symbol_lookup
+#endif
#ifndef elf_backend_name_local_section_symbols
#define elf_backend_name_local_section_symbols 0
#endif
@@ -291,13 +347,16 @@
#define elf_backend_section_processing 0
#endif
#ifndef elf_backend_section_from_shdr
-#define elf_backend_section_from_shdr 0
+#define elf_backend_section_from_shdr _bfd_elf_make_section_from_shdr
#endif
#ifndef elf_backend_section_flags
#define elf_backend_section_flags 0
#endif
+#ifndef elf_backend_get_sec_type_attr
+#define elf_backend_get_sec_type_attr _bfd_elf_get_sec_type_attr
+#endif
#ifndef elf_backend_section_from_phdr
-#define elf_backend_section_from_phdr 0
+#define elf_backend_section_from_phdr _bfd_elf_make_section_from_phdr
#endif
#ifndef elf_backend_fake_sections
#define elf_backend_fake_sections 0
@@ -314,9 +373,21 @@
#ifndef elf_backend_create_dynamic_sections
#define elf_backend_create_dynamic_sections 0
#endif
+#ifndef elf_backend_omit_section_dynsym
+#define elf_backend_omit_section_dynsym _bfd_elf_link_omit_section_dynsym
+#endif
+#ifndef elf_backend_relocs_compatible
+#define elf_backend_relocs_compatible _bfd_elf_default_relocs_compatible
+#endif
#ifndef elf_backend_check_relocs
#define elf_backend_check_relocs 0
#endif
+#ifndef elf_backend_check_directives
+#define elf_backend_check_directives 0
+#endif
+#ifndef elf_backend_as_needed_cleanup
+#define elf_backend_as_needed_cleanup 0
+#endif
#ifndef elf_backend_adjust_dynamic_symbol
#define elf_backend_adjust_dynamic_symbol 0
#endif
@@ -326,6 +397,10 @@
#ifndef elf_backend_size_dynamic_sections
#define elf_backend_size_dynamic_sections 0
#endif
+#ifndef elf_backend_init_index_section
+#define elf_backend_init_index_section \
+ ((void (*) (bfd *, struct bfd_link_info *)) bfd_void)
+#endif
#ifndef elf_backend_relocate_section
#define elf_backend_relocate_section 0
#endif
@@ -347,6 +422,9 @@
#ifndef elf_backend_modify_segment_map
#define elf_backend_modify_segment_map 0
#endif
+#ifndef elf_backend_modify_program_headers
+#define elf_backend_modify_program_headers 0
+#endif
#ifndef elf_backend_ecoff_debug_swap
#define elf_backend_ecoff_debug_swap 0
#endif
@@ -356,12 +434,27 @@
#ifndef elf_backend_got_header_size
#define elf_backend_got_header_size 0
#endif
+#ifndef elf_backend_obj_attrs_vendor
+#define elf_backend_obj_attrs_vendor NULL
+#endif
+#ifndef elf_backend_obj_attrs_section
+#define elf_backend_obj_attrs_section NULL
+#endif
+#ifndef elf_backend_obj_attrs_arg_type
+#define elf_backend_obj_attrs_arg_type NULL
+#endif
+#ifndef elf_backend_obj_attrs_section_type
+#define elf_backend_obj_attrs_section_type SHT_GNU_ATTRIBUTES
+#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_local_syms
+#define elf_backend_output_arch_local_syms NULL
+#endif
#ifndef elf_backend_output_arch_syms
#define elf_backend_output_arch_syms NULL
#endif
@@ -371,11 +464,17 @@
#ifndef elf_backend_hide_symbol
#define elf_backend_hide_symbol _bfd_elf_link_hash_hide_symbol
#endif
+#ifndef elf_backend_fixup_symbol
+#define elf_backend_fixup_symbol NULL
+#endif
#ifndef elf_backend_merge_symbol_attribute
#define elf_backend_merge_symbol_attribute NULL
#endif
+#ifndef elf_backend_ignore_undef_symbol
+#define elf_backend_ignore_undef_symbol NULL
+#endif
#ifndef elf_backend_emit_relocs
-#define elf_backend_emit_relocs NULL
+#define elf_backend_emit_relocs _bfd_elf_link_output_relocs
#endif
#ifndef elf_backend_count_relocs
#define elf_backend_count_relocs NULL
@@ -386,6 +485,9 @@
#ifndef elf_backend_grok_psinfo
#define elf_backend_grok_psinfo NULL
#endif
+#ifndef elf_backend_write_core_note
+#define elf_backend_write_core_note NULL
+#endif
#ifndef elf_backend_sprintf_vma
#define elf_backend_sprintf_vma _bfd_elf_sprintf_vma
#endif
@@ -401,6 +503,12 @@
#ifndef elf_backend_ignore_discarded_relocs
#define elf_backend_ignore_discarded_relocs NULL
#endif
+#ifndef elf_backend_action_discarded
+#define elf_backend_action_discarded _bfd_elf_default_action_discarded
+#endif
+#ifndef elf_backend_eh_frame_address_size
+#define elf_backend_eh_frame_address_size _bfd_elf_eh_frame_address_size
+#endif
#ifndef elf_backend_can_make_relative_eh_frame
#define elf_backend_can_make_relative_eh_frame _bfd_elf_can_make_relative
#endif
@@ -443,6 +551,13 @@
#define elf_backend_rela_normal 0
#endif
+#ifndef elf_backend_plt_sym_val
+#define elf_backend_plt_sym_val NULL
+#endif
+#ifndef elf_backend_relplt_name
+#define elf_backend_relplt_name NULL
+#endif
+
#ifndef ELF_MACHINE_ALT1
#define ELF_MACHINE_ALT1 0
#endif
@@ -463,14 +578,45 @@
#define elf_backend_sign_extend_vma 0
#endif
+#ifndef elf_backend_link_order_error_handler
+#define elf_backend_link_order_error_handler _bfd_default_error_handler
+#endif
+
+#ifndef elf_backend_common_definition
+#define elf_backend_common_definition _bfd_elf_common_definition
+#endif
+
+#ifndef elf_backend_common_section_index
+#define elf_backend_common_section_index _bfd_elf_common_section_index
+#endif
+
+#ifndef elf_backend_common_section
+#define elf_backend_common_section _bfd_elf_common_section
+#endif
+
+#ifndef elf_backend_merge_symbol
+#define elf_backend_merge_symbol NULL
+#endif
+
+#ifndef elf_backend_hash_symbol
+#define elf_backend_hash_symbol _bfd_elf_hash_symbol
+#endif
+
+#ifndef elf_backend_is_function_type
+#define elf_backend_is_function_type _bfd_elf_is_function_type
+#endif
+
extern const struct elf_size_info _bfd_elfNN_size_info;
-#ifndef INCLUDED_TARGET_FILE
-static const struct elf_backend_data elfNN_bed =
+static struct elf_backend_data elfNN_bed =
{
ELF_ARCH, /* arch */
ELF_MACHINE_CODE, /* elf_machine_code */
+ ELF_OSABI, /* elf_osabi */
ELF_MAXPAGESIZE, /* maxpagesize */
+ ELF_MINPAGESIZE, /* minpagesize */
+ ELF_COMMONPAGESIZE, /* commonpagesize */
+ ELF_DYNAMIC_SEC_FLAGS, /* dynamic_sec_flags */
elf_info_to_howto,
elf_info_to_howto_rel,
elf_backend_sym_is_global,
@@ -478,20 +624,27 @@ static const struct elf_backend_data elfNN_bed =
elf_backend_symbol_processing,
elf_backend_symbol_table_processing,
elf_backend_get_symbol_type,
+ elf_backend_archive_symbol_lookup,
elf_backend_name_local_section_symbols,
elf_backend_section_processing,
elf_backend_section_from_shdr,
elf_backend_section_flags,
+ elf_backend_get_sec_type_attr,
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_omit_section_dynsym,
+ elf_backend_relocs_compatible,
elf_backend_check_relocs,
+ elf_backend_check_directives,
+ elf_backend_as_needed_cleanup,
elf_backend_adjust_dynamic_symbol,
elf_backend_always_size_sections,
elf_backend_size_dynamic_sections,
+ elf_backend_init_index_section,
elf_backend_relocate_section,
elf_backend_finish_dynamic_symbol,
elf_backend_finish_dynamic_sections,
@@ -499,23 +652,32 @@ static const struct elf_backend_data elfNN_bed =
elf_backend_final_write_processing,
elf_backend_additional_program_headers,
elf_backend_modify_segment_map,
+ elf_backend_modify_program_headers,
+ elf_backend_gc_mark_dynamic_ref,
elf_backend_gc_mark_hook,
+ elf_backend_gc_mark_extra_sections,
elf_backend_gc_sweep_hook,
elf_backend_post_process_headers,
elf_backend_print_symbol_all,
+ elf_backend_output_arch_local_syms,
elf_backend_output_arch_syms,
elf_backend_copy_indirect_symbol,
elf_backend_hide_symbol,
+ elf_backend_fixup_symbol,
elf_backend_merge_symbol_attribute,
+ elf_backend_ignore_undef_symbol,
elf_backend_emit_relocs,
elf_backend_count_relocs,
elf_backend_grok_prstatus,
elf_backend_grok_psinfo,
+ elf_backend_write_core_note,
elf_backend_sprintf_vma,
elf_backend_fprintf_vma,
elf_backend_reloc_type_class,
elf_backend_discard_info,
elf_backend_ignore_discarded_relocs,
+ elf_backend_action_discarded,
+ elf_backend_eh_frame_address_size,
elf_backend_can_make_relative_eh_frame,
elf_backend_can_make_lsda_relative_eh_frame,
elf_backend_encode_eh_address,
@@ -524,12 +686,24 @@ static const struct elf_backend_data elfNN_bed =
elf_backend_mips_rtype_to_howto,
elf_backend_ecoff_debug_swap,
elf_backend_bfd_from_remote_memory,
+ elf_backend_plt_sym_val,
+ elf_backend_common_definition,
+ elf_backend_common_section_index,
+ elf_backend_common_section,
+ elf_backend_merge_symbol,
+ elf_backend_hash_symbol,
+ elf_backend_is_function_type,
+ elf_backend_link_order_error_handler,
+ elf_backend_relplt_name,
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_obj_attrs_vendor,
+ elf_backend_obj_attrs_section,
+ elf_backend_obj_attrs_arg_type,
+ elf_backend_obj_attrs_section_type,
elf_backend_collect,
elf_backend_type_change_ok,
elf_backend_may_use_rel_p,
@@ -546,9 +720,9 @@ static const struct elf_backend_data elfNN_bed =
elf_backend_can_refcount,
elf_backend_want_got_sym,
elf_backend_want_dynbss,
- elf_backend_want_p_paddr_set_to_zero
+ elf_backend_want_p_paddr_set_to_zero,
+ elf_backend_default_execstack
};
-#endif
/* Forward declaration for use when initialising alternative_target field. */
#ifdef TARGET_LITTLE_SYM
@@ -577,7 +751,7 @@ const bfd_target TARGET_BIG_SYM =
/* 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),
+ | 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 */
@@ -673,7 +847,7 @@ const bfd_target TARGET_LITTLE_SYM =
/* 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),
+ | 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 */
diff --git a/contrib/binutils/bfd/format.c b/contrib/binutils/bfd/format.c
index 9d9ee86..5143898 100644
--- a/contrib/binutils/bfd/format.c
+++ b/contrib/binutils/bfd/format.c
@@ -1,6 +1,6 @@
/* Generic BFD support for file formats.
- Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1999, 2000, 2001, 2002, 2003
- Free Software Foundation, Inc.
+ Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1999, 2000, 2001, 2002,
+ 2003, 2005, 2007 Free Software Foundation, Inc.
Written by Cygnus Support.
This file is part of BFD, the Binary File Descriptor library.
@@ -17,7 +17,7 @@
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. */
+ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
/*
SECTION
@@ -38,10 +38,12 @@ SECTION
The BFD contains the result of an executable core dump.
+SUBSECTION
+ File format functions
*/
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
/* IMPORT from targets.c. */
@@ -173,6 +175,14 @@ bfd_check_format_matches (bfd *abfd, bfd_format format, char ***matching)
if (matching)
free (matching_vector);
+ /* If the file was opened for update, then `output_has_begun'
+ some time ago when the file was created. Do not recompute
+ sections sizes or alignments in _bfd_set_section_contents.
+ We can not set this flag until after checking the format,
+ because it will interfere with creation of BFD sections. */
+ if (abfd->direction == both_direction)
+ abfd->output_has_begun = TRUE;
+
return TRUE; /* File position has moved, BTW. */
}
@@ -207,7 +217,9 @@ bfd_check_format_matches (bfd *abfd, bfd_format format, char ***matching)
const bfd_target *temp;
bfd_error_type err;
- if (*target == &binary_vec)
+ /* Don't check the default target twice. */
+ if (*target == &binary_vec
+ || (!abfd->target_defaulted && *target == save_targ))
continue;
abfd->xvec = *target; /* Change BFD's target temporarily. */
@@ -245,16 +257,6 @@ bfd_check_format_matches (bfd *abfd, bfd_format format, char ***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)
@@ -329,6 +331,14 @@ bfd_check_format_matches (bfd *abfd, bfd_format format, char ***matching)
if (matching)
free (matching_vector);
+ /* If the file was opened for update, then `output_has_begun'
+ some time ago when the file was created. Do not recompute
+ sections sizes or alignments in _bfd_set_section_contents.
+ We can not set this flag until after checking the format,
+ because it will interfere with creation of BFD sections. */
+ if (abfd->direction == both_direction)
+ abfd->output_has_begun = TRUE;
+
return TRUE; /* File position has moved, BTW. */
}
diff --git a/contrib/binutils/bfd/freebsd.h b/contrib/binutils/bfd/freebsd.h
index 5b0ede1..67e67fc 100644
--- a/contrib/binutils/bfd/freebsd.h
+++ b/contrib/binutils/bfd/freebsd.h
@@ -1,23 +1,23 @@
/* BFD back-end definitions used by all FreeBSD targets.
- Copyright 1990, 1991, 1992, 1996, 1997, 2000, 2001, 2002
+ Copyright 1990, 1991, 1992, 1996, 1997, 2000, 2001, 2002, 2005, 2007
Free Software Foundation, Inc.
-This file is part of BFD, the Binary File Descriptor library.
+ 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 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.
+ 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.
-*/
+ 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., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301,
+ USA. */
/* $FreeBSD$ */
@@ -55,31 +55,28 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
| (((flags) & 0x3f) << 26))
#define N_SET_MACHTYPE(exec, machtype) \
((exec).a_info = \
- ((exec).a_info & 0xfb00ffff) | ((((int)(machtype))&0x3ff) << 16))
+ ((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 "bfd.h"
#include "libbfd.h"
#include "libaout.h"
#define SWAP_MAGIC(ext) (freebsd_swap_magic(ext))
-#define MY_bfd_final_link MY(bfd_final_link)
-#define MY_write_object_contents MY(write_object_contents)
-
-static bfd_boolean MY(bfd_final_link) PARAMS ((bfd *, struct bfd_link_info *));
-static bfd_boolean MY(write_object_contents) PARAMS ((bfd *abfd));
-static long freebsd_swap_magic PARAMS ((void *ext));
+#define MY_bfd_final_link MY (bfd_final_link)
+#define MY_write_object_contents MY (write_object_contents)
+static bfd_boolean MY (bfd_final_link) (bfd *, struct bfd_link_info *);
+static bfd_boolean MY (write_object_contents) (bfd *);
+static long freebsd_swap_magic (void *);
#include "aout-target.h"
static bfd_boolean
-MY(bfd_final_link) (abfd, info)
- bfd *abfd;
- struct bfd_link_info *info;
+MY (bfd_final_link) (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);
@@ -88,8 +85,7 @@ MY(bfd_final_link) (abfd, info)
/* Swap a magic number. We accept either endian, whichever looks valid. */
static long
-freebsd_swap_magic (ext)
- void *ext;
+freebsd_swap_magic (void *ext)
{
long linfo = bfd_getl32(ext);
long binfo = bfd_getb32(ext);
@@ -108,8 +104,7 @@ freebsd_swap_magic (ext)
file header, symbols, and relocation. */
static bfd_boolean
-MY(write_object_contents) (abfd)
- bfd *abfd;
+MY (write_object_contents) (bfd *abfd)
{
struct external_exec exec_bytes;
struct internal_exec *execp = exec_hdr (abfd);
@@ -117,26 +112,27 @@ MY(write_object_contents) (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;
- }
+ 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);
diff --git a/contrib/binutils/bfd/gen-aout.c b/contrib/binutils/bfd/gen-aout.c
index ea207db..80e90c0 100644
--- a/contrib/binutils/bfd/gen-aout.c
+++ b/contrib/binutils/bfd/gen-aout.c
@@ -1,5 +1,5 @@
/* Generate parameters for an a.out system.
- Copyright 1990, 1991, 1992, 1993, 1994, 1995, 2001, 2002
+ Copyright 1990, 1991, 1992, 1993, 1994, 1995, 2001, 2002, 2007
Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@@ -16,7 +16,7 @@ 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. */
+Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
#include "/usr/include/a.out.h"
#include <stdio.h>
@@ -99,8 +99,8 @@ main (argc, argv)
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 \"bfd.h\"\n");
printf("#include \"libbfd.h\"\n");
printf("#include \"libaout.h\"\n");
printf("\n#include \"aout-target.h\"\n");
diff --git a/contrib/binutils/bfd/genlink.h b/contrib/binutils/bfd/genlink.h
index bcdc34b..175bee6 100644
--- a/contrib/binutils/bfd/genlink.h
+++ b/contrib/binutils/bfd/genlink.h
@@ -1,22 +1,22 @@
/* genlink.h -- interface to the BFD generic linker
- Copyright 1993, 1994, 1996, 2002 Free Software Foundation, Inc.
+ Copyright 1993, 1994, 1996, 2002, 2005 Free Software Foundation, Inc.
Written by Ian Lance Taylor, Cygnus Support.
-This file is part of BFD, the Binary File Descriptor library.
+ 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 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.
+ 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. */
+ 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., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
#ifndef GENLINK_H
#define GENLINK_H
@@ -65,7 +65,7 @@ struct 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), \
+ (bfd_boolean (*) (struct bfd_link_hash_entry *, void *)) (func), \
(info)))
/* Get the generic link hash table from the info structure. This is
@@ -77,14 +77,13 @@ struct generic_link_hash_table
/* 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_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));
+ (bfd *, bfd *, struct bfd_link_info *, size_t *);
/* This structure is used to pass information to
_bfd_generic_link_write_global_symbol, which may be called via
@@ -101,11 +100,10 @@ struct generic_write_global_symbol_info
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));
+ (struct generic_link_hash_entry *, void *);
/* 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 *));
+ (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
index 58fa532..2b67dc5 100644
--- a/contrib/binutils/bfd/hash.c
+++ b/contrib/binutils/bfd/hash.c
@@ -1,28 +1,29 @@
/* hash.c -- hash table routines for BFD
- Copyright 1993, 1994, 1995, 1997, 1999, 2001, 2002, 2003
- Free Software Foundation, Inc.
+ Copyright 1993, 1994, 1995, 1997, 1999, 2001, 2002, 2003, 2004, 2005,
+ 2006, 2007 Free Software Foundation, Inc.
Written by Steve Chamberlain <sac@cygnus.com>
-This file is part of BFD, the Binary File Descriptor library.
+ 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 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.
+ 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. */
+ 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., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
#include "objalloc.h"
+#include "libiberty.h"
/*
SECTION
@@ -87,6 +88,10 @@ SUBSECTION
been allocated for a hash table. This will not free up the
<<struct bfd_hash_table>> itself, which you must provide.
+@findex bfd_hash_set_default_size
+ Use <<bfd_hash_set_default_size>> to set the default size of
+ hash table to use.
+
INODE
Looking Up or Entering a String, Traversing a Hash Table, Creating and Freeing a Hash Table, Hash Tables
SUBSECTION
@@ -225,20 +230,18 @@ SUBSUBSECTION
EXAMPLE
.struct bfd_hash_entry *
-.@var{function_name} (entry, table, string)
-. struct bfd_hash_entry *entry;
-. struct bfd_hash_table *table;
-. const char *string;
+.@var{function_name} (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)
+. if (ret == NULL)
. {
-. ret = ((@var{entry_type} *)
-. bfd_hash_allocate (table, sizeof (@var{entry_type})));
-. if (ret == (@var{entry_type} *) NULL)
+. ret = bfd_hash_allocate (table, sizeof (* ret));
+. if (ret == NULL)
. return NULL;
. }
.
@@ -295,37 +298,92 @@ SUBSUBSECTION
*/
/* The default number of entries to use when creating a hash table. */
-#define DEFAULT_SIZE (4051)
+#define DEFAULT_SIZE 4051
+
+/* The following function returns a nearest prime number which is
+ greater than N, and near a power of two. Copied from libiberty.
+ Returns zero for ridiculously large N to signify an error. */
+
+static unsigned long
+higher_prime_number (unsigned long n)
+{
+ /* These are primes that are near, but slightly smaller than, a
+ power of two. */
+ static const unsigned long primes[] = {
+ (unsigned long) 127,
+ (unsigned long) 2039,
+ (unsigned long) 32749,
+ (unsigned long) 65521,
+ (unsigned long) 131071,
+ (unsigned long) 262139,
+ (unsigned long) 524287,
+ (unsigned long) 1048573,
+ (unsigned long) 2097143,
+ (unsigned long) 4194301,
+ (unsigned long) 8388593,
+ (unsigned long) 16777213,
+ (unsigned long) 33554393,
+ (unsigned long) 67108859,
+ (unsigned long) 134217689,
+ (unsigned long) 268435399,
+ (unsigned long) 536870909,
+ (unsigned long) 1073741789,
+ (unsigned long) 2147483647,
+ /* 4294967291L */
+ ((unsigned long) 2147483647) + ((unsigned long) 2147483644),
+ };
+
+ const unsigned long *low = &primes[0];
+ const unsigned long *high = &primes[sizeof (primes) / sizeof (primes[0])];
+
+ while (low != high)
+ {
+ const unsigned long *mid = low + (high - low) / 2;
+ if (n >= *mid)
+ low = mid + 1;
+ else
+ high = mid;
+ }
+
+ if (n >= *low)
+ return 0;
+
+ return *low;
+}
+
+static size_t bfd_default_hash_table_size = DEFAULT_SIZE;
/* 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;
+bfd_hash_table_init_n (struct bfd_hash_table *table,
+ struct bfd_hash_entry *(*newfunc) (struct bfd_hash_entry *,
+ struct bfd_hash_table *,
+ const char *),
+ unsigned int entsize,
+ unsigned int size)
{
unsigned int alloc;
alloc = size * sizeof (struct bfd_hash_entry *);
- table->memory = (PTR) objalloc_create ();
+ table->memory = (void *) 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));
+ table->table = 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);
+ memset ((void *) table->table, 0, alloc);
table->size = size;
+ table->entsize = entsize;
+ table->count = 0;
+ table->frozen = 0;
table->newfunc = newfunc;
return TRUE;
}
@@ -333,37 +391,36 @@ bfd_hash_table_init_n (table, newfunc, size)
/* 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 *));
+bfd_hash_table_init (struct bfd_hash_table *table,
+ struct bfd_hash_entry *(*newfunc) (struct bfd_hash_entry *,
+ struct bfd_hash_table *,
+ const char *),
+ unsigned int entsize)
{
- return bfd_hash_table_init_n (table, newfunc, DEFAULT_SIZE);
+ return bfd_hash_table_init_n (table, newfunc, entsize,
+ bfd_default_hash_table_size);
}
/* Free a hash table. */
void
-bfd_hash_table_free (table)
- struct bfd_hash_table *table;
+bfd_hash_table_free (struct bfd_hash_table *table)
{
- objalloc_free ((struct objalloc *) table->memory);
+ objalloc_free (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;
+bfd_hash_lookup (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;
+ const unsigned char *s;
+ unsigned long hash;
+ unsigned int c;
struct bfd_hash_entry *hashp;
unsigned int len;
unsigned int index;
@@ -382,7 +439,7 @@ bfd_hash_lookup (table, string, create, copy)
index = hash % table->size;
for (hashp = table->table[index];
- hashp != (struct bfd_hash_entry *) NULL;
+ hashp != NULL;
hashp = hashp->next)
{
if (hashp->hash == hash
@@ -391,21 +448,20 @@ bfd_hash_lookup (table, string, create, copy)
}
if (! create)
- return (struct bfd_hash_entry *) NULL;
+ return NULL;
- hashp = (*table->newfunc) ((struct bfd_hash_entry *) NULL, table, string);
- if (hashp == (struct bfd_hash_entry *) NULL)
- return (struct bfd_hash_entry *) NULL;
+ hashp = (*table->newfunc) (NULL, table, string);
+ if (hashp == NULL)
+ return NULL;
if (copy)
{
char *new;
- new = (char *) objalloc_alloc ((struct objalloc *) table->memory,
- len + 1);
+ new = objalloc_alloc ((struct objalloc *) table->memory, len + 1);
if (!new)
{
bfd_set_error (bfd_error_no_memory);
- return (struct bfd_hash_entry *) NULL;
+ return NULL;
}
memcpy (new, string, len + 1);
string = new;
@@ -414,6 +470,45 @@ bfd_hash_lookup (table, string, create, copy)
hashp->hash = hash;
hashp->next = table->table[index];
table->table[index] = hashp;
+ table->count++;
+
+ if (!table->frozen && table->count > table->size * 3 / 4)
+ {
+ unsigned long newsize = higher_prime_number (table->size);
+ struct bfd_hash_entry **newtable;
+ unsigned int hi;
+ unsigned long alloc = newsize * sizeof (struct bfd_hash_entry *);
+
+ /* If we can't find a higher prime, or we can't possibly alloc
+ that much memory, don't try to grow the table. */
+ if (newsize == 0 || alloc / sizeof (struct bfd_hash_entry *) != newsize)
+ {
+ table->frozen = 1;
+ return hashp;
+ }
+
+ newtable = ((struct bfd_hash_entry **)
+ objalloc_alloc ((struct objalloc *) table->memory, alloc));
+ memset ((PTR) newtable, 0, alloc);
+
+ for (hi = 0; hi < table->size; hi ++)
+ while (table->table[hi])
+ {
+ struct bfd_hash_entry *chain = table->table[hi];
+ struct bfd_hash_entry *chain_end = chain;
+ int index;
+
+ while (chain_end->next && chain_end->next->hash == chain->hash)
+ chain_end = chain_end->next;
+
+ table->table[hi] = chain_end->next;
+ index = chain->hash % newsize;
+ chain_end->next = newtable[index];
+ newtable[index] = chain;
+ }
+ table->table = newtable;
+ table->size = newsize;
+ }
return hashp;
}
@@ -421,17 +516,16 @@ bfd_hash_lookup (table, string, create, copy)
/* 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;
+bfd_hash_replace (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) != NULL;
pph = &(*pph)->next)
{
if (*pph == old)
@@ -444,28 +538,13 @@ bfd_hash_replace (table, old, nw)
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;
+void *
+bfd_hash_allocate (struct bfd_hash_table *table,
+ unsigned int size)
{
- PTR ret;
+ void * ret;
ret = objalloc_alloc ((struct objalloc *) table->memory, size);
if (ret == NULL && size != 0)
@@ -473,26 +552,56 @@ bfd_hash_allocate (table, size)
return ret;
}
+/* Base method for creating a new hash table entry. */
+
+struct bfd_hash_entry *
+bfd_hash_newfunc (struct bfd_hash_entry *entry,
+ struct bfd_hash_table *table,
+ const char *string ATTRIBUTE_UNUSED)
+{
+ if (entry == NULL)
+ entry = bfd_hash_allocate (table, sizeof (* entry));
+ return entry;
+}
+
/* 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;
+bfd_hash_traverse (struct bfd_hash_table *table,
+ bfd_boolean (*func) (struct bfd_hash_entry *, void *),
+ void * info)
{
unsigned int i;
+ table->frozen = 1;
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;
- }
+ if (! (*func) (p, info))
+ goto out;
}
+ out:
+ table->frozen = 0;
+}
+
+void
+bfd_hash_set_default_size (bfd_size_type hash_size)
+{
+ /* Extend this prime list if you want more granularity of hash table size. */
+ static const bfd_size_type hash_size_primes[] =
+ {
+ 251, 509, 1021, 2039, 4051, 8599, 16699, 32749
+ };
+ size_t index;
+
+ /* Work out best prime number near the hash_size. */
+ for (index = 0; index < ARRAY_SIZE (hash_size_primes) - 1; ++index)
+ if (hash_size <= hash_size_primes[index])
+ break;
+
+ bfd_default_hash_table_size = hash_size_primes[index];
}
/* A few different object file formats (a.out, COFF, ELF) use a string
@@ -534,30 +643,25 @@ struct bfd_strtab_hash
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;
+strtab_hash_newfunc (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)
+ if (ret == NULL)
+ ret = bfd_hash_allocate (table, sizeof (* ret));
+ if (ret == 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));
+ ret = (struct strtab_hash_entry *)
+ bfd_hash_newfunc ((struct bfd_hash_entry *) ret, table, string);
if (ret)
{
@@ -578,16 +682,17 @@ strtab_hash_newfunc (entry, table, string)
/* Create a new strtab. */
struct bfd_strtab_hash *
-_bfd_stringtab_init ()
+_bfd_stringtab_init (void)
{
struct bfd_strtab_hash *table;
- bfd_size_type amt = sizeof (struct bfd_strtab_hash);
+ bfd_size_type amt = sizeof (* table);
- table = (struct bfd_strtab_hash *) bfd_malloc (amt);
+ table = bfd_malloc (amt);
if (table == NULL)
return NULL;
- if (! bfd_hash_table_init (&table->table, strtab_hash_newfunc))
+ if (!bfd_hash_table_init (&table->table, strtab_hash_newfunc,
+ sizeof (struct strtab_hash_entry)))
{
free (table);
return NULL;
@@ -606,7 +711,7 @@ _bfd_stringtab_init ()
string. */
struct bfd_strtab_hash *
-_bfd_xcoff_stringtab_init ()
+_bfd_xcoff_stringtab_init (void)
{
struct bfd_strtab_hash *ret;
@@ -619,8 +724,7 @@ _bfd_xcoff_stringtab_init ()
/* Free a strtab. */
void
-_bfd_stringtab_free (table)
- struct bfd_strtab_hash *table;
+_bfd_stringtab_free (struct bfd_strtab_hash *table)
{
bfd_hash_table_free (&table->table);
free (table);
@@ -631,13 +735,12 @@ _bfd_stringtab_free (table)
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;
+_bfd_stringtab_add (struct bfd_strtab_hash *tab,
+ const char *str,
+ bfd_boolean hash,
+ bfd_boolean copy)
{
- register struct strtab_hash_entry *entry;
+ struct strtab_hash_entry *entry;
if (hash)
{
@@ -647,9 +750,7 @@ _bfd_stringtab_add (tab, str, hash, copy)
}
else
{
- entry = ((struct strtab_hash_entry *)
- bfd_hash_allocate (&tab->table,
- sizeof (struct strtab_hash_entry)));
+ entry = bfd_hash_allocate (&tab->table, sizeof (* entry));
if (entry == NULL)
return (bfd_size_type) -1;
if (! copy)
@@ -658,7 +759,7 @@ _bfd_stringtab_add (tab, str, hash, copy)
{
char *n;
- n = (char *) bfd_hash_allocate (&tab->table, strlen (str) + 1);
+ n = bfd_hash_allocate (&tab->table, strlen (str) + 1);
if (n == NULL)
return (bfd_size_type) -1;
entry->root.string = n;
@@ -689,8 +790,7 @@ _bfd_stringtab_add (tab, str, hash, copy)
/* Get the number of bytes in a strtab. */
bfd_size_type
-_bfd_stringtab_size (tab)
- struct bfd_strtab_hash *tab;
+_bfd_stringtab_size (struct bfd_strtab_hash *tab)
{
return tab->size;
}
@@ -699,12 +799,10 @@ _bfd_stringtab_size (tab)
the file. */
bfd_boolean
-_bfd_stringtab_emit (abfd, tab)
- register bfd *abfd;
- struct bfd_strtab_hash *tab;
+_bfd_stringtab_emit (bfd *abfd, struct bfd_strtab_hash *tab)
{
- register bfd_boolean xcoff;
- register struct strtab_hash_entry *entry;
+ bfd_boolean xcoff;
+ struct strtab_hash_entry *entry;
xcoff = tab->xcoff;
@@ -722,11 +820,11 @@ _bfd_stringtab_emit (abfd, tab)
/* 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)
+ if (bfd_bwrite ((void *) buf, (bfd_size_type) 2, abfd) != 2)
return FALSE;
}
- if (bfd_bwrite ((PTR) str, (bfd_size_type) len, abfd) != len)
+ if (bfd_bwrite ((void *) str, (bfd_size_type) len, abfd) != len)
return FALSE;
}
diff --git a/contrib/binutils/bfd/host-aout.c b/contrib/binutils/bfd/host-aout.c
index 5cbb5df..12e5951 100644
--- a/contrib/binutils/bfd/host-aout.c
+++ b/contrib/binutils/bfd/host-aout.c
@@ -1,5 +1,5 @@
/* BFD backend for local host's a.out binaries
- Copyright 1990, 1991, 1992, 1994, 1995, 2001
+ Copyright 1990, 1991, 1992, 1994, 1995, 2001, 2007
Free Software Foundation, Inc.
Written by Cygnus Support. Probably John Gilmore's fault.
@@ -17,10 +17,10 @@ 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. */
+Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
#define ARCH_SIZE 32
diff --git a/contrib/binutils/bfd/i386aout.c b/contrib/binutils/bfd/i386aout.c
index 6b2948e..936ffb2 100644
--- a/contrib/binutils/bfd/i386aout.c
+++ b/contrib/binutils/bfd/i386aout.c
@@ -1,23 +1,22 @@
/* BFD back-end for i386 a.out binaries.
- Copyright 1990, 1991, 1992, 1994, 1996, 1997, 2001, 2002, 2003
- Free Software Foundation, Inc.
+ Copyright 1990, 1991, 1992, 1994, 1996, 1997, 2001, 2002, 2003, 2005,
+ 2007 Free Software Foundation, Inc.
-This file is part of BFD, the Binary File Descriptor library.
+ 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 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 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., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, 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
@@ -25,20 +24,13 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
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
+#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)
+#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
@@ -47,20 +39,16 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#define TARGETNAME "a.out-i386"
#define NO_WRITE_HEADER_KLUDGE 1
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.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;
+i386aout_write_object_contents (bfd *abfd)
{
struct external_exec exec_bytes;
struct internal_exec *execp = exec_hdr (abfd);
@@ -74,23 +62,26 @@ i386aout_write_object_contents (abfd)
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 */
-};
+#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);
#include "aout-target.h"
+
+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. */
+};
diff --git a/contrib/binutils/bfd/i386bsd.c b/contrib/binutils/bfd/i386bsd.c
index e21a9ca..f8b109e 100644
--- a/contrib/binutils/bfd/i386bsd.c
+++ b/contrib/binutils/bfd/i386bsd.c
@@ -1,5 +1,5 @@
/* BFD back-end for i386 a.out binaries under BSD.
- Copyright 1990, 1991, 1992, 1993, 1994, 2001
+ Copyright 1990, 1991, 1992, 1993, 1994, 2001, 2007
Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@@ -16,7 +16,7 @@ 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. */
+Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
/* This data should be correct for the format used under all the various
BSD ports for 386 machines. */
@@ -42,8 +42,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#define MY(OP) CONCAT2 (i386bsd_,OP)
#define TARGETNAME "a.out-i386-bsd"
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
#include "libaout.h"
diff --git a/contrib/binutils/bfd/i386freebsd.c b/contrib/binutils/bfd/i386freebsd.c
index 73fa0ca..57b38a7 100644
--- a/contrib/binutils/bfd/i386freebsd.c
+++ b/contrib/binutils/bfd/i386freebsd.c
@@ -15,7 +15,7 @@ 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. */
+Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
#define BYTES_IN_WORD 4
#undef TARGET_IS_BIG_ENDIAN_P
diff --git a/contrib/binutils/bfd/i386linux.c b/contrib/binutils/bfd/i386linux.c
index da36e75..83f9965 100644
--- a/contrib/binutils/bfd/i386linux.c
+++ b/contrib/binutils/bfd/i386linux.c
@@ -1,6 +1,6 @@
/* BFD back-end for linux flavored i386 a.out binaries.
- Copyright 1992, 1993, 1994, 1995, 1996, 1997, 2001, 2002, 2003
- Free Software Foundation, Inc.
+ Copyright 1992, 1993, 1994, 1995, 1996, 1997, 1999, 2001, 2002, 2003,
+ 2004, 2006, 2007 Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@@ -16,7 +16,7 @@ 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. */
+Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
#define TARGET_PAGE_SIZE 4096
#define ZMAGIC_DISK_BLOCK_SIZE 1024
@@ -26,8 +26,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#define MACHTYPE_OK(mtype) ((mtype) == M_386 || (mtype) == M_UNKNOWN)
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
#include "aout/aout64.h"
#include "aout/stab_gnu.h"
@@ -93,8 +93,7 @@ i386linux_write_object_contents (abfd)
#define GOT_REF_PREFIX "__GOT_"
#endif
-#define IS_GOT_SYM(name) \
- (strncmp (name, GOT_REF_PREFIX, sizeof GOT_REF_PREFIX - 1) == 0)
+#define IS_GOT_SYM(name) (CONST_STRNEQ (name, GOT_REF_PREFIX))
/* See if a symbol name is a reference to the procedure linkage table. */
@@ -102,8 +101,7 @@ i386linux_write_object_contents (abfd)
#define PLT_REF_PREFIX "__PLT_"
#endif
-#define IS_PLT_SYM(name) \
- (strncmp (name, PLT_REF_PREFIX, sizeof PLT_REF_PREFIX - 1) == 0)
+#define IS_PLT_SYM(name) (CONST_STRNEQ (name, PLT_REF_PREFIX))
/* This string is used to generate specialized error messages. */
@@ -231,8 +229,9 @@ linux_link_hash_table_create (abfd)
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))
+ if (!NAME(aout,link_hash_table_init) (&ret->root, abfd,
+ linux_link_hash_newfunc,
+ sizeof (struct linux_link_hash_entry)))
{
free (ret);
return (struct bfd_link_hash_table *) NULL;
@@ -311,12 +310,11 @@ linux_link_create_dynamic_sections (abfd, info)
/* We choose to use the name ".linux-dynamic" for the fixup table.
Why not? */
- s = bfd_make_section (abfd, ".linux-dynamic");
+ s = bfd_make_section_with_flags (abfd, ".linux-dynamic", flags);
if (s == NULL
- || ! bfd_set_section_flags (abfd, s, flags)
|| ! bfd_set_section_alignment (abfd, s, 2))
return FALSE;
- s->_raw_size = 0;
+ s->size = 0;
s->contents = 0;
return TRUE;
@@ -441,8 +439,7 @@ linux_tally_symbols (h, data)
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_STRNEQ (h->root.root.root.string, NEEDS_SHRLIB))
{
const char *name;
char *p;
@@ -594,9 +591,9 @@ bfd_i386linux_size_dynamic_sections (output_bfd, info)
".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);
+ s->size = linux_hash_table (info)->fixup_count + 1;
+ s->size *= 8;
+ s->contents = (bfd_byte *) bfd_zalloc (output_bfd, s->size);
if (s->contents == NULL)
return FALSE;
}
@@ -761,7 +758,7 @@ linux_finish_dynamic_link (output_bfd, info)
SEEK_SET) != 0)
return FALSE;
- if (bfd_bwrite ((PTR) s->contents, s->_raw_size, output_bfd) != s->_raw_size)
+ if (bfd_bwrite ((PTR) s->contents, s->size, output_bfd) != s->size)
return FALSE;
return TRUE;
diff --git a/contrib/binutils/bfd/i386netbsd.c b/contrib/binutils/bfd/i386netbsd.c
index 26fa30e..d011670 100644
--- a/contrib/binutils/bfd/i386netbsd.c
+++ b/contrib/binutils/bfd/i386netbsd.c
@@ -16,7 +16,7 @@ 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. */
+Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
#define BYTES_IN_WORD 4
#undef TARGET_IS_BIG_ENDIAN_P
diff --git a/contrib/binutils/bfd/ieee.c b/contrib/binutils/bfd/ieee.c
index 8a08028..727869e6 100644
--- a/contrib/binutils/bfd/ieee.c
+++ b/contrib/binutils/bfd/ieee.c
@@ -1,6 +1,6 @@
/* BFD back-end for ieee-695 objects.
Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
- 2000, 2001, 2002, 2003
+ 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
Free Software Foundation, Inc.
Written by Steve Chamberlain of Cygnus Support.
@@ -19,7 +19,7 @@
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. */
+ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
#define KEEPMINUSPCININST 0
@@ -27,8 +27,8 @@
token (which is one byte in this lexicon) lookahead recursive decent
parser. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
#include "ieee.h"
#include "libieee.h"
@@ -40,181 +40,47 @@ struct output_buffer_struct
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));
+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 void block (void);
/* Functions for writing to ieee files in the strange way that the
- standard requires. */
+ standard requires. */
static bfd_boolean
-ieee_write_byte (abfd, barg)
- bfd *abfd;
- int barg;
+ieee_write_byte (bfd *abfd, int barg)
{
bfd_byte byte;
byte = barg;
- if (bfd_bwrite ((PTR) &byte, (bfd_size_type) 1, abfd) != 1)
+ if (bfd_bwrite ((void *) &byte, (bfd_size_type) 1, abfd) != 1)
return FALSE;
return TRUE;
}
static bfd_boolean
-ieee_write_2bytes (abfd, bytes)
- bfd *abfd;
- int bytes;
+ieee_write_2bytes (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)
+ if (bfd_bwrite ((void *) buffer, (bfd_size_type) 2, abfd) != 2)
return FALSE;
return TRUE;
}
static bfd_boolean
-ieee_write_int (abfd, value)
- bfd *abfd;
- bfd_vma value;
+ieee_write_int (bfd *abfd, bfd_vma value)
{
if (value <= 127)
{
@@ -264,9 +130,7 @@ ieee_write_int (abfd, value)
}
static bfd_boolean
-ieee_write_id (abfd, id)
- bfd *abfd;
- const char *id;
+ieee_write_id (bfd *abfd, const char *id)
{
size_t length = strlen (id);
@@ -296,7 +160,7 @@ ieee_write_id (abfd, id)
return FALSE;
}
- if (bfd_bwrite ((PTR) id, (bfd_size_type) length, abfd) != length)
+ if (bfd_bwrite ((void *) id, (bfd_size_type) length, abfd) != length)
return FALSE;
return TRUE;
}
@@ -304,13 +168,12 @@ ieee_write_id (abfd, id)
/* 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(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;
+read_2bytes (common_header_type *ieee)
{
unsigned char c1 = this_byte_and_next (ieee);
unsigned char c2 = this_byte_and_next (ieee);
@@ -319,10 +182,7 @@ read_2bytes (ieee)
}
static void
-bfd_get_string (ieee, string, length)
- common_header_type *ieee;
- char *string;
- size_t length;
+bfd_get_string (common_header_type *ieee, char *string, size_t length)
{
size_t i;
@@ -331,22 +191,20 @@ bfd_get_string (ieee, string, length)
}
static char *
-read_id (ieee)
- common_header_type *ieee;
+read_id (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. */
- }
+ /* Simple string of length 0 to 127. */
+ ;
+
else if (length == 0xde)
- {
- /* Length is next byte, allowing 0..255. */
- length = this_byte_and_next (ieee);
- }
+ /* 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. */
@@ -364,12 +222,11 @@ read_id (ieee)
}
static bfd_boolean
-ieee_write_expression (abfd, value, symbol, pcrel, index)
- bfd *abfd;
- bfd_vma value;
- asymbol *symbol;
- bfd_boolean pcrel;
- unsigned int index;
+ieee_write_expression (bfd *abfd,
+ bfd_vma value,
+ asymbol *symbol,
+ bfd_boolean pcrel,
+ unsigned int index)
{
unsigned int term_count = 0;
@@ -396,7 +253,6 @@ ieee_write_expression (abfd, value, symbol, pcrel, index)
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)
@@ -462,9 +318,7 @@ ieee_write_expression (abfd, value, symbol, pcrel, index)
/* 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;
+ieee_write_int5 (bfd_byte *buffer, bfd_vma value)
{
buffer[0] = (bfd_byte) ieee_number_repeat_4_enum;
buffer[1] = (value >> 24) & 0xff;
@@ -474,22 +328,18 @@ ieee_write_int5 (buffer, value)
}
static bfd_boolean
-ieee_write_int5_out (abfd, value)
- bfd *abfd;
- bfd_vma value;
+ieee_write_int5_out (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)
+ if (bfd_bwrite ((void *) 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;
+parse_int (common_header_type *ieee, bfd_vma *value_ptr)
{
int value = this_byte (ieee);
int result;
@@ -518,20 +368,17 @@ parse_int (ieee, value_ptr)
}
static int
-parse_i (ieee, ok)
- common_header_type *ieee;
- bfd_boolean *ok;
+parse_i (common_header_type *ieee, bfd_boolean *ok)
{
- bfd_vma x;
+ bfd_vma x = 0;
*ok = parse_int (ieee, &x);
return x;
}
static bfd_vma
-must_parse_int (ieee)
- common_header_type *ieee;
+must_parse_int (common_header_type *ieee)
{
- bfd_vma result;
+ bfd_vma result = 0;
BFD_ASSERT (parse_int (ieee, &result));
return result;
}
@@ -649,29 +496,28 @@ static reloc_howto_type rel8_howto =
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;
+parse_expression (ieee_data_type *ieee,
+ bfd_vma *value,
+ ieee_symbol_index_type *symbol,
+ bfd_boolean *pcrel,
+ unsigned int *extra,
+ asection **section)
{
+ bfd_boolean loop = TRUE;
+ ieee_value_type stack[10];
+ ieee_value_type *sp = stack;
+ asection *dummy;
+
#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;
+#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;
while (loop && ieee->h.input_p < ieee->h.last_byte)
{
@@ -704,12 +550,13 @@ parse_expression (ieee, value, symbol, pcrel, extra, section)
next_byte (&(ieee->h));
PUSH (NOSYMBOL,
0,
- ieee->section_table[must_parse_int (&(ieee->h))]->_raw_size);
+ ieee->section_table[must_parse_int (&(ieee->h))]->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';
@@ -721,6 +568,7 @@ parse_expression (ieee, value, symbol, pcrel, extra, section)
/* 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';
@@ -733,6 +581,7 @@ parse_expression (ieee, value, symbol, pcrel, extra, section)
bfd_vma value1, value2;
asection *section1, *section_dummy;
ieee_symbol_index_type sy;
+
next_byte (&(ieee->h));
POP (sy, section1, value1);
@@ -747,6 +596,7 @@ parse_expression (ieee, value, symbol, pcrel, extra, section)
asection *section2;
ieee_symbol_index_type sy1;
ieee_symbol_index_type sy2;
+
next_byte (&(ieee->h));
POP (sy1, section1, value1);
@@ -759,6 +609,7 @@ parse_expression (ieee, value, symbol, pcrel, extra, section)
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))
@@ -766,10 +617,8 @@ parse_expression (ieee, value, symbol, pcrel, extra, section)
PUSH (NOSYMBOL, bfd_abs_section_ptr, va);
}
else
- {
- /* Thats all that we can understand. */
- loop = FALSE;
- }
+ /* Thats all that we can understand. */
+ loop = FALSE;
}
}
}
@@ -784,6 +633,7 @@ parse_expression (ieee, value, symbol, pcrel, extra, section)
{
asection *section1;
ieee_symbol_index_type sy1;
+
POP (sy1, section1, *extra);
}
@@ -808,9 +658,7 @@ parse_expression (ieee, value, symbol, pcrel, extra, section)
/* 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;
+ieee_part_after (ieee_data_type *ieee, file_ptr here)
{
int part;
file_ptr after = ieee->w.r.me_record;
@@ -828,14 +676,13 @@ 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;
+get_symbol (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));
@@ -845,7 +692,7 @@ get_symbol (abfd, ieee, last_symbol, symbol_count, pptr, max_index, this_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);
+ new_symbol = bfd_alloc (ieee->h.abfd, amt);
if (!new_symbol)
return NULL;
@@ -865,17 +712,17 @@ get_symbol (abfd, ieee, last_symbol, symbol_count, pptr, max_index, this_type)
}
static bfd_boolean
-ieee_slurp_external_symbols (abfd)
- bfd *abfd;
+ieee_slurp_external_symbols (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;
+ ieee_symbol_type *symbol = NULL;
unsigned int symbol_count = 0;
bfd_boolean loop = TRUE;
+
last_index = 0xffffff;
ieee->symbol_table_full = TRUE;
@@ -889,14 +736,14 @@ ieee_slurp_external_symbols (abfd)
next_byte (&(ieee->h));
symbol = get_symbol (abfd, ieee, symbol, &symbol_count,
- &prev_symbols_ptr,
- &ieee->external_symbol_max_index, 'I');
+ & 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.udata.p = NULL;
symbol->symbol.flags = BSF_NO_FLAGS;
break;
case ieee_external_symbol_enum:
@@ -912,7 +759,7 @@ ieee_slurp_external_symbols (abfd)
symbol->symbol.the_bfd = abfd;
symbol->symbol.name = read_id (&(ieee->h));
- symbol->symbol.udata.p = (PTR) NULL;
+ symbol->symbol.udata.p = NULL;
symbol->symbol.flags = BSF_NO_FLAGS;
break;
case ieee_attribute_record_enum >> 8:
@@ -920,7 +767,8 @@ ieee_slurp_external_symbols (abfd)
unsigned int symbol_name_index;
unsigned int symbol_type_index;
unsigned int symbol_attribute_def;
- bfd_vma value;
+ bfd_vma value = 0;
+
switch (read_2bytes (&ieee->h))
{
case ieee_attribute_record_enum:
@@ -935,9 +783,8 @@ ieee_slurp_external_symbols (abfd)
break;
default:
(*_bfd_error_handler)
- (_("%s: unimplemented ATI record %u for symbol %u"),
- bfd_archive_filename (abfd), symbol_attribute_def,
- symbol_name_index);
+ (_("%B: unimplemented ATI record %u for symbol %u"),
+ abfd, symbol_attribute_def, symbol_name_index);
bfd_set_error (bfd_error_bad_value);
return FALSE;
break;
@@ -960,8 +807,8 @@ ieee_slurp_external_symbols (abfd)
if (value != 0x3f)
{
(*_bfd_error_handler)
- (_("%s: unexpected ATN type %d in external part"),
- bfd_archive_filename (abfd), (int) value);
+ (_("%B: unexpected ATN type %d in external part"),
+ abfd, (int) value);
bfd_set_error (bfd_error_bad_value);
return FALSE;
}
@@ -982,8 +829,7 @@ ieee_slurp_external_symbols (abfd)
default:
(*_bfd_error_handler)
- (_("%s: unexpected type after ATN"),
- bfd_archive_filename (abfd));
+ (_("%B: unexpected type after ATN"), abfd);
bfd_set_error (bfd_error_bad_value);
return FALSE;
}
@@ -997,6 +843,7 @@ ieee_slurp_external_symbols (abfd)
ieee_symbol_index_type symbol_ignore;
bfd_boolean pcrel_ignore;
unsigned int extra;
+
next_byte (&(ieee->h));
next_byte (&(ieee->h));
@@ -1021,7 +868,7 @@ ieee_slurp_external_symbols (abfd)
val = symbol->symbol.value;
for (s = abfd->sections; s != NULL; s = s->next)
{
- if (val >= s->vma && val < s->vma + s->_raw_size)
+ if (val >= s->vma && val < s->vma + s->size)
{
symbol->symbol.section = s;
symbol->symbol.value -= s->vma;
@@ -1038,6 +885,7 @@ ieee_slurp_external_symbols (abfd)
{
bfd_vma size;
bfd_vma value;
+
next_byte (&(ieee->h));
/* Throw away the external reference index. */
(void) must_parse_int (&(ieee->h));
@@ -1045,9 +893,7 @@ ieee_slurp_external_symbols (abfd)
size = must_parse_int (&(ieee->h));
/* Fetch the default value if available. */
if (! parse_int (&(ieee->h), &value))
- {
- value = 0;
- }
+ value = 0;
/* This turns into a common. */
symbol->symbol.section = bfd_com_section_ptr;
symbol->symbol.value = size;
@@ -1065,7 +911,7 @@ ieee_slurp_external_symbols (abfd)
symbol->symbol.the_bfd = abfd;
symbol->symbol.name = read_id (&(ieee->h));
- symbol->symbol.udata.p = (PTR) NULL;
+ symbol->symbol.udata.p = NULL;
symbol->symbol.section = bfd_und_section_ptr;
symbol->symbol.value = (bfd_vma) 0;
symbol->symbol.flags = 0;
@@ -1085,9 +931,7 @@ ieee_slurp_external_symbols (abfd)
ieee->external_symbol_min_index + 1;
}
else
- {
- ieee->external_symbol_count = 0;
- }
+ ieee->external_symbol_count = 0;
if (ieee->external_reference_max_index != 0)
{
@@ -1096,28 +940,23 @@ ieee_slurp_external_symbols (abfd)
ieee->external_reference_min_index + 1;
}
else
- {
- ieee->external_reference_count = 0;
- }
+ 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;
- }
+ /* 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;
+ *prev_symbols_ptr = NULL;
+ *prev_reference_ptr = NULL;
return TRUE;
}
static bfd_boolean
-ieee_slurp_symbol_table (abfd)
- bfd *abfd;
+ieee_slurp_symbol_table (bfd *abfd)
{
if (! IEEE_DATA (abfd)->read_symbols)
{
@@ -1129,8 +968,7 @@ ieee_slurp_symbol_table (abfd)
}
static long
-ieee_get_symtab_upper_bound (abfd)
- bfd *abfd;
+ieee_get_symtab_upper_bound (bfd *abfd)
{
if (! ieee_slurp_symbol_table (abfd))
return -1;
@@ -1145,9 +983,7 @@ ieee_get_symtab_upper_bound (abfd)
extern const bfd_target ieee_vec;
static long
-ieee_canonicalize_symtab (abfd, location)
- bfd *abfd;
- asymbol **location;
+ieee_canonicalize_symtab (bfd *abfd, asymbol **location)
{
ieee_symbol_type *symp;
static bfd dummy_bfd;
@@ -1167,6 +1003,7 @@ ieee_canonicalize_symtab (abfd, location)
if (abfd->symcount)
{
ieee_data_type *ieee = IEEE_DATA (abfd);
+
dummy_bfd.xvec = &ieee_vec;
if (! ieee_slurp_symbol_table (abfd))
return -1;
@@ -1206,10 +1043,7 @@ ieee_canonicalize_symtab (abfd, location)
}
static asection *
-get_section_entry (abfd, ieee, index)
- bfd *abfd;
- ieee_data_type *ieee;
- unsigned int index;
+get_section_entry (bfd *abfd, ieee_data_type *ieee, unsigned int index)
{
if (index >= ieee->section_table_size)
{
@@ -1225,7 +1059,7 @@ get_section_entry (abfd, ieee, index)
amt = c;
amt *= sizeof (asection *);
- n = (asection **) bfd_realloc (ieee->section_table, amt);
+ n = bfd_realloc (ieee->section_table, amt);
if (n == NULL)
return NULL;
@@ -1246,7 +1080,6 @@ get_section_entry (abfd, ieee, index)
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;
}
@@ -1254,8 +1087,7 @@ get_section_entry (abfd, ieee, index)
}
static void
-ieee_slurp_sections (abfd)
- bfd *abfd;
+ieee_slurp_sections (bfd *abfd)
{
ieee_data_type *ieee = IEEE_DATA (abfd);
file_ptr offset = ieee->w.r.section_part;
@@ -1264,6 +1096,7 @@ ieee_slurp_sections (abfd)
if (offset != 0)
{
bfd_byte section_type[3];
+
ieee_seek (ieee, offset);
while (TRUE)
{
@@ -1273,6 +1106,7 @@ ieee_slurp_sections (abfd)
{
asection *section;
unsigned int section_index;
+
next_byte (&(ieee->h));
section_index = must_parse_int (&(ieee->h));
@@ -1290,7 +1124,8 @@ ieee_slurp_sections (abfd)
section->flags = SEC_ALLOC;
switch (section_type[1])
{
- case 0xD3: /* AS Absolute section attributes. */
+ /* AS Absolute section attributes. */
+ case 0xD3:
next_byte (&(ieee->h));
section_type[2] = this_byte (&(ieee->h));
switch (section_type[2])
@@ -1315,7 +1150,9 @@ ieee_slurp_sections (abfd)
}
}
break;
- case 0xC3: /* Named relocatable sections (type C). */
+
+ /* Named relocatable sections (type C). */
+ case 0xC3:
section_type[1] = this_byte (&(ieee->h));
section->flags = SEC_ALLOC;
switch (section_type[1])
@@ -1345,6 +1182,7 @@ ieee_slurp_sections (abfd)
/* 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);
@@ -1356,13 +1194,13 @@ ieee_slurp_sections (abfd)
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;
- }
+ ieee->section_count = section_index;
+
section->alignment_power =
bfd_log2 (must_parse_int (&ieee->h));
(void) parse_int (&(ieee->h), &value);
@@ -1378,11 +1216,11 @@ ieee_slurp_sections (abfd)
{
case ieee_section_size_enum:
section = ieee->section_table[must_parse_int (&(ieee->h))];
- section->_raw_size = must_parse_int (&(ieee->h));
+ section->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));
+ section->size = must_parse_int (&(ieee->h));
break;
case ieee_region_base_address_enum:
section = ieee->section_table[must_parse_int (&(ieee->h))];
@@ -1424,33 +1262,32 @@ ieee_slurp_sections (abfd)
out. */
static bfd_boolean
-ieee_slurp_debug (abfd)
- bfd *abfd;
+ieee_slurp_debug (bfd *abfd)
{
ieee_data_type *ieee = IEEE_DATA (abfd);
asection *sec;
file_ptr debug_end;
+ flagword flags;
if (ieee->w.r.debug_information_part == 0)
return TRUE;
- sec = bfd_make_section (abfd, ".debug");
+ flags = SEC_DEBUGGING | SEC_HAS_CONTENTS;
+ sec = bfd_make_section_with_flags (abfd, ".debug", flags);
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;
+ sec->size = debug_end - ieee->w.r.debug_information_part;
return TRUE;
}
/* Archive stuff. */
-const bfd_target *
-ieee_archive_p (abfd)
- bfd *abfd;
+static const bfd_target *
+ieee_archive_p (bfd *abfd)
{
char *library;
unsigned int i;
@@ -1462,14 +1299,14 @@ ieee_archive_p (abfd)
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);
+ abfd->tdata.ieee_ar_data = 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);
+ bfd_bread ((void *) buffer, (bfd_size_type) sizeof (buffer), abfd);
ieee->h.first_byte = buffer;
ieee->h.input_p = buffer;
@@ -1495,7 +1332,7 @@ ieee_archive_p (abfd)
must_parse_int (&(ieee->h));
alc_elts = 10;
- elts = (ieee_ar_obstack_type *) bfd_malloc (alc_elts * sizeof *elts);
+ elts = bfd_malloc (alc_elts * sizeof *elts);
if (elts == NULL)
goto error_return;
@@ -1514,8 +1351,7 @@ ieee_archive_p (abfd)
ieee_ar_obstack_type *n;
alc_elts *= 2;
- n = ((ieee_ar_obstack_type *)
- bfd_realloc (elts, alc_elts * sizeof *elts));
+ n = bfd_realloc (elts, alc_elts * sizeof (* elts));
if (n == NULL)
goto error_return;
elts = n;
@@ -1537,7 +1373,7 @@ ieee_archive_p (abfd)
goto error_return;
/* Again ignore return value of bfd_bread. */
- bfd_bread ((PTR) buffer, (bfd_size_type) sizeof (buffer), abfd);
+ bfd_bread ((void *) buffer, (bfd_size_type) sizeof (buffer), abfd);
ieee->h.first_byte = buffer;
ieee->h.input_p = buffer;
}
@@ -1545,7 +1381,7 @@ ieee_archive_p (abfd)
amt = ieee->element_count;
amt *= sizeof *ieee->elements;
- ieee->elements = (ieee_ar_obstack_type *) bfd_alloc (abfd, amt);
+ ieee->elements = bfd_alloc (abfd, amt);
if (ieee->elements == NULL)
goto error_return;
@@ -1560,7 +1396,7 @@ ieee_archive_p (abfd)
goto error_return;
/* Again ignore return value of bfd_bread. */
- bfd_bread ((PTR) buffer, (bfd_size_type) sizeof (buffer), abfd);
+ bfd_bread ((void *) buffer, (bfd_size_type) sizeof (buffer), abfd);
ieee->h.first_byte = buffer;
ieee->h.input_p = buffer;
@@ -1591,257 +1427,31 @@ ieee_archive_p (abfd)
return NULL;
}
-const bfd_target *
-ieee_object_p (abfd)
- bfd *abfd;
+static bfd_boolean
+ieee_mkobject (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;
- }
+ 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 = bfd_zalloc (abfd, amt);
+ return abfd->tdata.ieee_data != NULL;
}
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;
+do_one (ieee_data_type *ieee,
+ ieee_per_section_type *current_map,
+ unsigned char *location_ptr,
+ asection *s,
+ int iterations)
{
switch (this_byte (&(ieee->h)))
{
@@ -1880,9 +1490,8 @@ do_one (ieee, current_map, location_ptr, s, iterations)
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);
+ r = bfd_alloc (ieee->h.abfd, sizeof (* r));
if (!r)
return FALSE;
@@ -2010,9 +1619,11 @@ do_one (ieee, current_map, location_ptr, s, iterations)
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));
@@ -2020,14 +1631,12 @@ do_one (ieee, current_map, location_ptr, s, iterations)
}
}
else
- {
- loop = FALSE;
- }
+ loop = FALSE;
}
}
/* Prevent more than the first load-item of an LR record
- from being repeated (MRI convention). */
+ from being repeated (MRI convention). */
if (iterations != 1)
loop = FALSE;
}
@@ -2039,15 +1648,14 @@ do_one (ieee, current_map, location_ptr, s, iterations)
/* Read in all the section data and relocation stuff too. */
static bfd_boolean
-ieee_slurp_section_data (abfd)
- bfd *abfd;
+ieee_slurp_section_data (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;
+ ieee_per_section_type *current_map = NULL;
asection *s;
+
/* Seek to the start of the data area. */
if (ieee->read_data)
return TRUE;
@@ -2058,13 +1666,15 @@ ieee_slurp_section_data (abfd)
for (s = abfd->sections; s != (asection *) NULL; s = s->next)
{
ieee_per_section_type *per = ieee_per_section (s);
+ arelent **relpp;
+
if ((s->flags & SEC_DEBUGGING) != 0)
continue;
- per->data = (bfd_byte *) bfd_alloc (ieee->h.abfd, s->_raw_size);
+ per->data = bfd_alloc (ieee->h.abfd, s->size);
if (!per->data)
return FALSE;
- per->reloc_tail_ptr =
- (ieee_reloc_type **) & (s->relocation);
+ relpp = &s->relocation;
+ per->reloc_tail_ptr = (ieee_reloc_type **) relpp;
}
while (TRUE)
@@ -2106,7 +1716,7 @@ ieee_slurp_section_data (abfd)
&pcrel, &extra,
0);
current_map->pc = value;
- BFD_ASSERT ((unsigned) (value - s->vma) <= s->_raw_size);
+ BFD_ASSERT ((unsigned) (value - s->vma) <= s->size);
}
break;
@@ -2167,24 +1777,256 @@ ieee_slurp_section_data (abfd)
}
}
+static const bfd_target *
+ieee_object_p (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 ((void *) 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 ((CONST_STRNEQ (processor, "cpu32")) /* CPU32 and CPU32+ */
+ || (CONST_STRNEQ (processor, "CPU32")))
+ 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 = 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 ((void *) (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 (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 (bfd *abfd,
+ void * 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:
+ 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, (void *) file, symbol);
+
+ fprintf (file, " %-5s %04x %02x %s",
+ section_name,
+ (unsigned) ieee_symbol (symbol)->index,
+ (unsigned) 0,
+ symbol->name);
+ }
+ }
+ break;
+ }
+}
+
static bfd_boolean
-ieee_new_section_hook (abfd, newsect)
- bfd *abfd;
- asection *newsect;
+ieee_new_section_hook (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;
+ {
+ newsect->used_by_bfd = bfd_alloc (abfd, sizeof (ieee_per_section_type));
+ if (!newsect->used_by_bfd)
+ return FALSE;
+ }
+ ieee_per_section (newsect)->data = NULL;
ieee_per_section (newsect)->section = newsect;
- return TRUE;
+ return _bfd_generic_new_section_hook (abfd, newsect);
}
static long
-ieee_get_reloc_upper_bound (abfd, asect)
- bfd *abfd;
- sec_ptr asect;
+ieee_get_reloc_upper_bound (bfd *abfd, sec_ptr asect)
{
if ((asect->flags & SEC_DEBUGGING) != 0)
return 0;
@@ -2194,28 +2036,26 @@ ieee_get_reloc_upper_bound (abfd, asect)
}
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_get_section_contents (bfd *abfd,
+ sec_ptr section,
+ void * 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);
+ (void) memcpy ((void *) location, (void *) (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_canonicalize_reloc (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);
@@ -2248,14 +2088,12 @@ ieee_canonicalize_reloc (abfd, section, relptr, symbols)
*relptr++ = &src->relent;
src = src->next;
}
- *relptr = (arelent *) NULL;
+ *relptr = NULL;
return section->reloc_count;
}
static int
-comp (ap, bp)
- const PTR ap;
- const PTR bp;
+comp (const void * ap, const void * bp)
{
arelent *a = *((arelent **) ap);
arelent *b = *((arelent **) bp);
@@ -2265,11 +2103,11 @@ comp (ap, bp)
/* Write the section headers. */
static bfd_boolean
-ieee_write_section_part (abfd)
- bfd *abfd;
+ieee_write_section_part (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)
{
@@ -2318,11 +2156,6 @@ ieee_write_section_part (abfd)
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,
@@ -2336,7 +2169,7 @@ ieee_write_section_part (abfd)
|| ! ieee_write_byte (abfd,
(bfd_byte) (s->index
+ IEEE_SECTION_NUMBER_BASE))
- || ! ieee_write_int (abfd, s->_raw_size))
+ || ! ieee_write_int (abfd, s->size))
return FALSE;
if (abfd->flags & EXEC_P)
{
@@ -2356,11 +2189,8 @@ ieee_write_section_part (abfd)
return TRUE;
}
-
static bfd_boolean
-do_with_relocs (abfd, s)
- bfd *abfd;
- asection *s;
+do_with_relocs (bfd *abfd, asection *s)
{
unsigned int number_of_maus_in_address =
bfd_arch_bits_per_address (abfd) / bfd_arch_bits_per_byte (abfd);
@@ -2398,14 +2228,14 @@ do_with_relocs (abfd, s)
{
/* 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)
+ while (current_byte_index < s->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 > s->size - current_byte_index)
+ run = s->size - current_byte_index;
if (run != 0)
{
@@ -2414,7 +2244,7 @@ do_with_relocs (abfd, s)
/* Output a stream of bytes. */
if (! ieee_write_int (abfd, run))
return FALSE;
- if (bfd_bwrite ((PTR) (stream + current_byte_index), run, abfd)
+ if (bfd_bwrite ((void *) (stream + current_byte_index), run, abfd)
!= run)
return FALSE;
current_byte_index += run;
@@ -2429,15 +2259,14 @@ do_with_relocs (abfd, s)
/* 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)
+ if (stream == NULL)
{
/* Outputting a section without data, fill it up. */
- stream = (unsigned char *) bfd_zalloc (abfd, s->_raw_size);
+ stream = bfd_zalloc (abfd, s->size);
if (!stream)
return FALSE;
}
- while (current_byte_index < s->_raw_size)
+ while (current_byte_index < s->size)
{
bfd_size_type run;
unsigned int MAXRUN = 127;
@@ -2451,15 +2280,15 @@ do_with_relocs (abfd, s)
else
run = MAXRUN;
- if (run > s->_raw_size - current_byte_index)
- run = s->_raw_size - current_byte_index;
+ if (run > s->size - current_byte_index)
+ run = s->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)
+ if (bfd_bwrite ((void *) (stream + current_byte_index), run, abfd)
!= run)
return FALSE;
current_byte_index += run;
@@ -2473,14 +2302,9 @@ do_with_relocs (abfd, s)
{
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;
@@ -2511,8 +2335,6 @@ do_with_relocs (abfd, s)
ieee_function_either_open_b_enum))
return FALSE;
-/* abort();*/
-
if (r->sym_ptr_ptr != (asymbol **) NULL)
{
if (! ieee_write_expression (abfd, r->addend + ov,
@@ -2557,11 +2379,9 @@ do_with_relocs (abfd, s)
bytes. */
static bfd_boolean
-do_as_repeat (abfd, s)
- bfd *abfd;
- asection *s;
+do_as_repeat (bfd *abfd, asection *s)
{
- if (s->_raw_size)
+ if (s->size)
{
if (! ieee_write_byte (abfd, ieee_set_current_section_enum)
|| ! ieee_write_byte (abfd,
@@ -2586,7 +2406,7 @@ do_as_repeat (abfd, s)
}
if (! ieee_write_byte (abfd, ieee_repeat_data_enum)
- || ! ieee_write_int (abfd, s->_raw_size)
+ || ! ieee_write_int (abfd, s->size)
|| ! ieee_write_byte (abfd, ieee_load_constant_bytes_enum)
|| ! ieee_write_byte (abfd, 1)
|| ! ieee_write_byte (abfd, 0))
@@ -2597,9 +2417,7 @@ do_as_repeat (abfd, s)
}
static bfd_boolean
-do_without_relocs (abfd, s)
- bfd *abfd;
- asection *s;
+do_without_relocs (bfd *abfd, asection *s)
{
bfd_byte *stream = ieee_per_section (s)->data;
@@ -2612,7 +2430,7 @@ do_without_relocs (abfd, s)
{
unsigned int i;
- for (i = 0; i < s->_raw_size; i++)
+ for (i = 0; i < s->size; i++)
{
if (stream[i] != 0)
{
@@ -2628,65 +2446,33 @@ do_without_relocs (abfd, s)
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 ()
+fill (void)
{
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);
+ bfd_bread ((void *) input_ptr_start, amt, input_bfd);
input_ptr = input_ptr_start;
}
static void
-flush ()
+flush (void)
{
bfd_size_type amt = output_ptr - output_ptr_start;
- if (bfd_bwrite ((PTR) (output_ptr_start), amt, output_bfd) != amt)
+ if (bfd_bwrite ((void *) (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(); }
+#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;
+write_int (int value)
{
if (value >= 0 && value <= 127)
{
@@ -2695,6 +2481,7 @@ write_int (value)
else
{
unsigned int length;
+
/* How many significant bytes ? */
/* FIXME FOR LONGER INTS. */
if (value & 0xff000000)
@@ -2722,7 +2509,7 @@ write_int (value)
}
static void
-copy_id ()
+copy_id (void)
{
int length = THIS ();
char ch;
@@ -2739,7 +2526,7 @@ copy_id ()
#define VAR(x) ((x | 0x80))
static void
-copy_expression ()
+copy_expression (void)
{
int stack[10];
int *tos = stack;
@@ -2837,11 +2624,10 @@ copy_expression ()
}
/* Drop the int in the buffer, and copy a null into the gap, which we
- will overwrite later */
+ will overwrite later. */
static void
-fill_int (buf)
- struct output_buffer_struct *buf;
+fill_int (struct output_buffer_struct *buf)
{
if (buf->buffer == output_buffer)
{
@@ -2855,8 +2641,7 @@ fill_int (buf)
}
static void
-drop_int (buf)
- struct output_buffer_struct *buf;
+drop_int (struct output_buffer_struct *buf)
{
int type = THIS ();
int ch;
@@ -2892,7 +2677,7 @@ drop_int (buf)
}
static void
-copy_int ()
+copy_int (void)
{
int type = THIS ();
int ch;
@@ -2924,14 +2709,53 @@ copy_int ()
}
}
-#define ID copy_id()
-#define INT copy_int()
-#define EXP copy_expression()
-#define INTn(q) copy_int()
-#define EXPn(q) copy_expression()
+#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 ()
+copy_till_end (void)
+{
+ 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
+f1_record (void)
{
int ch;
@@ -3032,7 +2856,7 @@ f1_record ()
}
static void
-f0_record ()
+f0_record (void)
{
/* Attribute record. */
NEXT ();
@@ -3042,46 +2866,7 @@ f0_record ()
}
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 ()
+f2_record (void)
{
NEXT ();
OUT (0xf2);
@@ -3092,9 +2877,8 @@ f2_record ()
copy_till_end ();
}
-
static void
-f8_record ()
+f8_record (void)
{
int ch;
NEXT ();
@@ -3243,7 +3027,7 @@ f8_record ()
}
static void
-e2_record ()
+e2_record (void)
{
OUT (0xe2);
NEXT ();
@@ -3254,7 +3038,7 @@ e2_record ()
}
static void
-block ()
+block (void)
{
int ch;
@@ -3288,14 +3072,12 @@ block ()
}
}
-
/* 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;
+relocate_debug (bfd *output ATTRIBUTE_UNUSED,
+ bfd *input)
{
#define IBS 400
#define OBS 400
@@ -3306,7 +3088,7 @@ relocate_debug (output, input)
input_bfd = input;
/* FIXME: Check return value. I'm not sure whether it needs to read
the entire buffer or not. */
- bfd_bread ((PTR) input_ptr_start, (bfd_size_type) IBS, input);
+ bfd_bread ((void *) input_ptr_start, (bfd_size_type) IBS, input);
block ();
}
@@ -3314,8 +3096,7 @@ relocate_debug (output, input)
one place, relocating it and emitting it as we go. */
static bfd_boolean
-ieee_write_debug_part (abfd)
- bfd *abfd;
+ieee_write_debug_part (bfd *abfd)
{
ieee_data_type *ieee = IEEE_DATA (abfd);
bfd_chain_type *chain = ieee->chain_root;
@@ -3342,7 +3123,7 @@ ieee_write_debug_part (abfd)
}
ieee->w.r.debug_information_part = here;
- if (bfd_bwrite (s->contents, s->_raw_size, abfd) != s->_raw_size)
+ if (bfd_bwrite (s->contents, s->size, abfd) != s->size)
return FALSE;
}
else
@@ -3377,8 +3158,7 @@ ieee_write_debug_part (abfd)
/* Write the data in an ieee way. */
static bfd_boolean
-ieee_write_data_part (abfd)
- bfd *abfd;
+ieee_write_data_part (bfd *abfd)
{
asection *s;
@@ -3393,7 +3173,7 @@ ieee_write_data_part (abfd)
continue;
/* Sort the reloc records so we can insert them in the correct
- places */
+ places. */
if (s->reloc_count != 0)
{
if (! do_with_relocs (abfd, s))
@@ -3409,10 +3189,8 @@ ieee_write_data_part (abfd)
return TRUE;
}
-
static bfd_boolean
-init_for_output (abfd)
- bfd *abfd;
+init_for_output (bfd *abfd)
{
asection *s;
@@ -3420,10 +3198,10 @@ init_for_output (abfd)
{
if ((s->flags & SEC_DEBUGGING) != 0)
continue;
- if (s->_raw_size != 0)
+ if (s->size != 0)
{
- bfd_size_type size = s->_raw_size;
- ieee_per_section (s)->data = (bfd_byte *) (bfd_alloc (abfd, size));
+ bfd_size_type size = s->size;
+ ieee_per_section (s)->data = bfd_alloc (abfd, size);
if (!ieee_per_section (s)->data)
return FALSE;
}
@@ -3437,19 +3215,18 @@ init_for_output (abfd)
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;
+ieee_set_section_contents (bfd *abfd,
+ sec_ptr section,
+ const void * 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);
+ bfd_size_type size = section->size;
+ section->contents = bfd_alloc (abfd, size);
if (section->contents == NULL)
return FALSE;
}
@@ -3464,8 +3241,8 @@ ieee_set_section_contents (abfd, section, location, offset, count)
if (!init_for_output (abfd))
return FALSE;
}
- memcpy ((PTR) (ieee_per_section (section)->data + offset),
- (PTR) location,
+ memcpy ((void *) (ieee_per_section (section)->data + offset),
+ (void *) location,
(unsigned int) count);
return TRUE;
}
@@ -3476,8 +3253,7 @@ ieee_set_section_contents (abfd, section, location, offset, count)
symbol values into indexes from the right base. */
static bfd_boolean
-ieee_write_external_part (abfd)
- bfd *abfd;
+ieee_write_external_part (bfd *abfd)
{
asymbol **q;
ieee_data_type *ieee = IEEE_DATA (abfd);
@@ -3527,9 +3303,9 @@ ieee_write_external_part (abfd)
|| ! 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 */
+ || ! 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. */
@@ -3600,15 +3376,14 @@ static const unsigned char envi[] =
/* 0xf1, 0xce, 0x21, 00, 50, 0x82, 0x07, 0xc7, 0x09, 0x11, 0x11,
0x19, 0x2c,
*/
- 0xf1, 0xce, 0x21, 00, 52, 0x00, /* exec ok */
+ 0xf1, 0xce, 0x21, 00, 52, 0x00, /* exec ok. */
- 0xf1, 0xce, 0x21, 0, 53, 0x03,/* host unix */
+ 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_write_me_part (bfd *abfd)
{
ieee_data_type *ieee = IEEE_DATA (abfd);
ieee->w.r.trailer_part = bfd_tell (abfd);
@@ -3629,8 +3404,7 @@ ieee_write_me_part (abfd)
/* Write out the IEEE processor ID. */
static bfd_boolean
-ieee_write_processor (abfd)
- bfd *abfd;
+ieee_write_processor (bfd *abfd)
{
const bfd_arch_info_type *arch;
@@ -3642,11 +3416,6 @@ ieee_write_processor (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;
@@ -3700,11 +3469,22 @@ ieee_write_processor (abfd)
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;
+ case bfd_mach_mcf_isa_a_nodiv: id = "isa-a:nodiv"; break;
+ case bfd_mach_mcf_isa_a: id = "isa-a"; break;
+ case bfd_mach_mcf_isa_a_mac: id = "isa-a:mac"; break;
+ case bfd_mach_mcf_isa_a_emac: id = "isa-a:emac"; break;
+ case bfd_mach_mcf_isa_aplus: id = "isa-aplus"; break;
+ case bfd_mach_mcf_isa_aplus_mac: id = "isa-aplus:mac"; break;
+ case bfd_mach_mcf_isa_aplus_emac: id = "isa-aplus:mac"; break;
+ case bfd_mach_mcf_isa_b_nousp: id = "isa-b:nousp"; break;
+ case bfd_mach_mcf_isa_b_nousp_mac: id = "isa-b:nousp:mac"; break;
+ case bfd_mach_mcf_isa_b_nousp_emac: id = "isa-b:nousp:emac"; break;
+ case bfd_mach_mcf_isa_b: id = "isa-b"; break;
+ case bfd_mach_mcf_isa_b_mac: id = "isa-b:mac"; break;
+ case bfd_mach_mcf_isa_b_emac: id = "isa-b:emac"; break;
+ case bfd_mach_mcf_isa_b_float: id = "isa-b:float"; break;
+ case bfd_mach_mcf_isa_b_float_mac: id = "isa-b:float:mac"; break;
+ case bfd_mach_mcf_isa_b_float_emac: id = "isa-b:float:emac"; break;
}
if (! ieee_write_id (abfd, id))
@@ -3717,8 +3497,7 @@ ieee_write_processor (abfd)
}
static bfd_boolean
-ieee_write_object_contents (abfd)
- bfd *abfd;
+ieee_write_object_contents (bfd *abfd)
{
ieee_data_type *ieee = IEEE_DATA (abfd);
unsigned int i;
@@ -3756,12 +3535,12 @@ ieee_write_object_contents (abfd)
return FALSE;
if (abfd->flags & EXEC_P)
{
- if (! ieee_write_byte (abfd, 0x1)) /* Absolute */
+ if (! ieee_write_byte (abfd, 0x1)) /* Absolute. */
return FALSE;
}
else
{
- if (! ieee_write_byte (abfd, 0x2)) /* Relocateable */
+ if (! ieee_write_byte (abfd, 0x2)) /* Relocateable. */
return FALSE;
}
@@ -3830,18 +3609,17 @@ ieee_write_object_contents (abfd)
return TRUE;
}
-/* Native-level interface to symbols. */
+/* 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;
+ieee_make_empty_symbol (bfd *abfd)
{
bfd_size_type amt = sizeof (ieee_symbol_type);
- ieee_symbol_type *new = (ieee_symbol_type *) bfd_zalloc (abfd, amt);
+ ieee_symbol_type *new = bfd_zalloc (abfd, amt);
if (!new)
return NULL;
@@ -3850,9 +3628,7 @@ ieee_make_empty_symbol (abfd)
}
static bfd *
-ieee_openr_next_archived_file (arch, prev)
- bfd *arch;
- bfd *prev;
+ieee_openr_next_archived_file (bfd *arch, bfd *prev)
{
ieee_ar_data_type *ar = IEEE_AR_DATA (arch);
@@ -3881,29 +3657,34 @@ ieee_openr_next_archived_file (arch, prev)
else
{
bfd_set_error (bfd_error_no_more_archived_files);
- return (bfd *) NULL;
+ return 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;
+ieee_find_nearest_line (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 bfd_boolean
+ieee_find_inliner_info (bfd *abfd 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_generic_stat_arch_elt (bfd *abfd, struct stat *buf)
{
ieee_ar_data_type *ar = (ieee_ar_data_type *) NULL;
ieee_data_type *ieee;
@@ -3933,75 +3714,12 @@ ieee_generic_stat_arch_elt (abfd, buf)
}
static int
-ieee_sizeof_headers (abfd, x)
- bfd *abfd ATTRIBUTE_UNUSED;
- bfd_boolean x ATTRIBUTE_UNUSED;
+ieee_sizeof_headers (bfd *abfd ATTRIBUTE_UNUSED,
+ struct bfd_link_info *info 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
@@ -4009,17 +3727,19 @@ ieee_bfd_debug_info_accumulate (abfd, section)
#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 *, 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 *, 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_target_special_symbol \
+ ((bfd_boolean (*) (bfd *, asymbol *)) bfd_false)
#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
@@ -4027,6 +3747,7 @@ ieee_bfd_debug_info_accumulate (abfd, section)
#define ieee_minisymbol_to_symbol _bfd_generic_minisymbol_to_symbol
#define ieee_bfd_reloc_type_lookup _bfd_norelocs_bfd_reloc_type_lookup
+#define ieee_bfd_reloc_name_lookup _bfd_norelocs_bfd_reloc_name_lookup
#define ieee_set_arch_mach _bfd_generic_set_arch_mach
@@ -4037,7 +3758,10 @@ ieee_bfd_debug_info_accumulate (abfd, section)
#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_is_group_section bfd_generic_is_group_section
#define ieee_bfd_discard_group bfd_generic_discard_group
+#define ieee_section_already_linked \
+ _bfd_generic_section_already_linked
#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
@@ -4047,27 +3771,27 @@ ieee_bfd_debug_info_accumulate (abfd, section)
const bfd_target ieee_vec =
{
- "ieee", /* name */
+ "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 */
+ 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 */
+ | 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_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_getb16, bfd_getb_signed_16, bfd_putb16, /* Headers. */
{_bfd_dummy_target,
- ieee_object_p, /* bfd_check_format */
+ ieee_object_p, /* bfd_check_format. */
ieee_archive_p,
_bfd_dummy_target,
},
@@ -4085,7 +3809,7 @@ const bfd_target ieee_vec =
},
/* ieee_close_and_cleanup, ieee_bfd_free_cached_info, ieee_new_section_hook,
- ieee_get_section_contents, ieee_get_section_contents_in_window */
+ ieee_get_section_contents, ieee_get_section_contents_in_window. */
BFD_JUMP_TABLE_GENERIC (ieee),
BFD_JUMP_TABLE_COPY (_bfd_generic),
@@ -4095,21 +3819,21 @@ const bfd_target ieee_vec =
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 */
+ 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 */
+ 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 */
+ ieee_bfd_reloc_type_lookup. */
BFD_JUMP_TABLE_RELOCS (ieee),
- /* ieee_set_arch_mach, ieee_set_section_contents */
+ /* ieee_set_arch_mach, ieee_set_section_contents. */
BFD_JUMP_TABLE_WRITE (ieee),
/* ieee_sizeof_headers, ieee_bfd_get_relocated_section_contents,
@@ -4117,12 +3841,12 @@ const bfd_target ieee_vec =
_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 */
+ ieee_bfd_merge_sections. */
BFD_JUMP_TABLE_LINK (ieee),
BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
NULL,
- (PTR) 0
+ NULL
};
diff --git a/contrib/binutils/bfd/ihex.c b/contrib/binutils/bfd/ihex.c
index 5d2d47f..9f765b3 100644
--- a/contrib/binutils/bfd/ihex.c
+++ b/contrib/binutils/bfd/ihex.c
@@ -1,6 +1,6 @@
/* BFD back-end for Intel Hex objects.
- Copyright 1995, 1996, 1998, 1999, 2000, 2001, 2002, 2003
- Free Software Foundation, Inc.
+ Copyright 1995, 1996, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
+ 2006, 2007 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.
@@ -17,7 +17,7 @@
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. */
+ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
/* This is what Intel Hex files look like:
@@ -116,42 +116,14 @@ The MRI compiler uses this, which is a repeat of type 5:
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
-*/
+ 20..21 Carriage return, line feed. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.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
@@ -185,7 +157,7 @@ struct ihex_data_struct
/* Initialize by filling in the hex conversion array. */
static void
-ihex_init ()
+ihex_init (void)
{
static bfd_boolean inited;
@@ -199,13 +171,11 @@ ihex_init ()
/* Create an ihex object. */
static bfd_boolean
-ihex_mkobject (abfd)
- bfd *abfd;
+ihex_mkobject (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);
+ tdata = bfd_alloc (abfd, sizeof (* tdata));
if (tdata == NULL)
return FALSE;
@@ -219,9 +189,7 @@ ihex_mkobject (abfd)
Return EOF on error or end of file. */
static INLINE int
-ihex_get_byte (abfd, errorptr)
- bfd *abfd;
- bfd_boolean *errorptr;
+ihex_get_byte (bfd *abfd, bfd_boolean *errorptr)
{
bfd_byte c;
@@ -238,11 +206,7 @@ ihex_get_byte (abfd, errorptr)
/* 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;
+ihex_bad_byte (bfd *abfd, unsigned int lineno, int c, bfd_boolean error)
{
if (c == EOF)
{
@@ -261,8 +225,8 @@ ihex_bad_byte (abfd, lineno, c, error)
buf[1] = '\0';
}
(*_bfd_error_handler)
- (_("%s:%d: unexpected character `%s' in Intel Hex file\n"),
- bfd_archive_filename (abfd), lineno, buf);
+ (_("%B:%d: unexpected character `%s' in Intel Hex file"),
+ abfd, lineno, buf);
bfd_set_error (bfd_error_bad_value);
}
}
@@ -271,8 +235,7 @@ ihex_bad_byte (abfd, lineno, c, error)
section for each contiguous set of bytes. */
static bfd_boolean
-ihex_scan (abfd)
- bfd *abfd;
+ihex_scan (bfd *abfd)
{
bfd_vma segbase;
bfd_vma extbase;
@@ -344,7 +307,7 @@ ihex_scan (abfd)
chars = len * 2 + 2;
if (chars >= bufsize)
{
- buf = (bfd_byte *) bfd_realloc (buf, (bfd_size_type) chars);
+ buf = bfd_realloc (buf, (bfd_size_type) chars);
if (buf == NULL)
goto error_return;
bufsize = chars;
@@ -369,8 +332,8 @@ ihex_scan (abfd)
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,
+ (_("%B:%u: bad checksum in Intel Hex file (expected %u, found %u)"),
+ abfd, lineno,
(- chksum) & 0xff, (unsigned int) HEX2 (buf + 2 * i));
bfd_set_error (bfd_error_bad_value);
goto error_return;
@@ -381,31 +344,32 @@ ihex_scan (abfd)
case 0:
/* This is a data record. */
if (sec != NULL
- && sec->vma + sec->_raw_size == extbase + segbase + addr)
+ && sec->vma + sec->size == extbase + segbase + addr)
{
/* This data goes at the end of the section we are
currently building. */
- sec->_raw_size += len;
+ sec->size += len;
}
else if (len > 0)
{
char secbuf[20];
char *secname;
bfd_size_type amt;
+ flagword flags;
sprintf (secbuf, ".sec%d", bfd_count_sections (abfd) + 1);
amt = strlen (secbuf) + 1;
- secname = (char *) bfd_alloc (abfd, amt);
+ secname = bfd_alloc (abfd, amt);
if (secname == NULL)
goto error_return;
strcpy (secname, secbuf);
- sec = bfd_make_section (abfd, secname);
+ flags = SEC_HAS_CONTENTS | SEC_LOAD | SEC_ALLOC;
+ sec = bfd_make_section_with_flags (abfd, secname, flags);
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->size = len;
sec->filepos = pos;
}
break;
@@ -423,8 +387,8 @@ ihex_scan (abfd)
if (len != 2)
{
(*_bfd_error_handler)
- (_("%s:%u: bad extended address record length in Intel Hex file"),
- bfd_archive_filename (abfd), lineno);
+ (_("%B:%u: bad extended address record length in Intel Hex file"),
+ abfd, lineno);
bfd_set_error (bfd_error_bad_value);
goto error_return;
}
@@ -440,8 +404,8 @@ ihex_scan (abfd)
if (len != 4)
{
(*_bfd_error_handler)
- (_("%s:%u: bad extended start address length in Intel Hex file"),
- bfd_archive_filename (abfd), lineno);
+ (_("%B:%u: bad extended start address length in Intel Hex file"),
+ abfd, lineno);
bfd_set_error (bfd_error_bad_value);
goto error_return;
}
@@ -457,8 +421,8 @@ ihex_scan (abfd)
if (len != 2)
{
(*_bfd_error_handler)
- (_("%s:%u: bad extended linear address record length in Intel Hex file"),
- bfd_archive_filename (abfd), lineno);
+ (_("%B:%u: bad extended linear address record length in Intel Hex file"),
+ abfd, lineno);
bfd_set_error (bfd_error_bad_value);
goto error_return;
}
@@ -474,8 +438,8 @@ ihex_scan (abfd)
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);
+ (_("%B:%u: bad extended linear start address length in Intel Hex file"),
+ abfd, lineno);
bfd_set_error (bfd_error_bad_value);
goto error_return;
}
@@ -491,8 +455,8 @@ ihex_scan (abfd)
default:
(*_bfd_error_handler)
- (_("%s:%u: unrecognized ihex type %u in Intel Hex file\n"),
- bfd_archive_filename (abfd), lineno, type);
+ (_("%B:%u: unrecognized ihex type %u in Intel Hex file"),
+ abfd, lineno, type);
bfd_set_error (bfd_error_bad_value);
goto error_return;
}
@@ -516,10 +480,9 @@ ihex_scan (abfd)
/* Try to recognize an Intel Hex file. */
static const bfd_target *
-ihex_object_p (abfd)
- bfd *abfd;
+ihex_object_p (bfd *abfd)
{
- PTR tdata_save;
+ void * tdata_save;
bfd_byte b[9];
unsigned int i;
unsigned int type;
@@ -573,10 +536,7 @@ ihex_object_p (abfd)
/* 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;
+ihex_read_section (bfd *abfd, asection *section, bfd_byte *contents)
{
int c;
bfd_byte *p;
@@ -594,7 +554,6 @@ ihex_read_section (abfd, section, contents)
{
char hdr[8];
unsigned int len;
- bfd_vma addr;
unsigned int type;
unsigned int i;
@@ -609,22 +568,20 @@ ihex_read_section (abfd, section, contents)
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));
+ (_("%B: internal error in ihex_read_section"), 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);
+ buf = bfd_realloc (buf, (bfd_size_type) len * 2);
if (buf == NULL)
goto error_return;
bufsize = len * 2;
@@ -635,7 +592,7 @@ ihex_read_section (abfd, section, contents)
for (i = 0; i < len; i++)
*p++ = HEX2 (buf + 2 * i);
- if ((bfd_size_type) (p - contents) >= section->_raw_size)
+ if ((bfd_size_type) (p - contents) >= section->size)
{
/* We've read everything in the section. */
if (buf != NULL)
@@ -648,11 +605,10 @@ ihex_read_section (abfd, section, contents)
goto error_return;
}
- if ((bfd_size_type) (p - contents) < section->_raw_size)
+ if ((bfd_size_type) (p - contents) < section->size)
{
(*_bfd_error_handler)
- (_("%s: bad section length in ihex_read_section"),
- bfd_archive_filename (abfd));
+ (_("%B: bad section length in ihex_read_section"), abfd);
bfd_set_error (bfd_error_bad_value);
goto error_return;
}
@@ -671,16 +627,15 @@ ihex_read_section (abfd, section, contents)
/* 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;
+ihex_get_section_contents (bfd *abfd,
+ asection *section,
+ void * location,
+ file_ptr offset,
+ bfd_size_type count)
{
if (section->used_by_bfd == NULL)
{
- section->used_by_bfd = bfd_alloc (abfd, section->_raw_size);
+ section->used_by_bfd = bfd_alloc (abfd, section->size);
if (section->used_by_bfd == NULL)
return FALSE;
if (! ihex_read_section (abfd, section, section->used_by_bfd))
@@ -696,29 +651,26 @@ ihex_get_section_contents (abfd, section, location, offset, count)
/* 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;
+ihex_set_section_contents (bfd *abfd,
+ asection *section,
+ const void * 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);
+ n = bfd_alloc (abfd, sizeof (* n));
if (n == NULL)
return FALSE;
- data = (bfd_byte *) bfd_alloc (abfd, count);
+ data = bfd_alloc (abfd, count);
if (data == NULL)
return FALSE;
memcpy (data, location, (size_t) count);
@@ -739,7 +691,7 @@ ihex_set_section_contents (abfd, section, location, offset, count)
}
else
{
- register struct ihex_data_list **pp;
+ struct ihex_data_list **pp;
for (pp = &tdata->head;
*pp != NULL && (*pp)->where < n->where;
@@ -757,12 +709,11 @@ ihex_set_section_contents (abfd, section, location, offset, count)
/* 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;
+ihex_write_record (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];
@@ -802,8 +753,7 @@ ihex_write_record (abfd, count, addr, type, data)
/* Write out an Intel Hex file. */
static bfd_boolean
-ihex_write_object_contents (abfd)
- bfd *abfd;
+ihex_write_object_contents (bfd *abfd)
{
bfd_vma segbase;
bfd_vma extbase;
@@ -820,6 +770,7 @@ ihex_write_object_contents (abfd)
where = l->where;
p = l->data;
count = l->size;
+
while (count > 0)
{
size_t now;
@@ -933,10 +884,9 @@ ihex_write_object_contents (abfd)
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;
+ihex_set_arch_mach (bfd *abfd,
+ enum bfd_architecture arch,
+ unsigned long mach)
{
if (! bfd_default_set_arch_mach (abfd, arch, mach))
{
@@ -949,76 +899,68 @@ ihex_set_arch_mach (abfd, arch, mach)
/* 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;
+ihex_sizeof_headers (bfd *abfd ATTRIBUTE_UNUSED,
+ struct bfd_link_info *info 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
+#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 (*) (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_target_special_symbol ((bfd_boolean (*) (bfd *, asymbol *)) bfd_false)
+#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_find_inliner_info _bfd_nosymbols_find_inliner_info
+#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_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_is_group_section bfd_generic_is_group_section
+#define ihex_bfd_discard_group bfd_generic_discard_group
+#define ihex_section_already_linked _bfd_generic_section_already_linked
+#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 */
+ "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_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_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_getb16, bfd_getb_signed_16, bfd_putb16, /* Headers. */
{
_bfd_dummy_target,
- ihex_object_p, /* bfd_check_format */
+ ihex_object_p, /* bfd_check_format. */
_bfd_dummy_target,
_bfd_dummy_target,
},
@@ -1028,7 +970,7 @@ const bfd_target ihex_vec =
_bfd_generic_mkarchive,
bfd_false,
},
- { /* bfd_write_contents */
+ { /* bfd_write_contents. */
bfd_false,
ihex_write_object_contents,
_bfd_write_archive_contents,
@@ -1040,12 +982,12 @@ const bfd_target ihex_vec =
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_RELOCS (_bfd_norelocs),
BFD_JUMP_TABLE_WRITE (ihex),
BFD_JUMP_TABLE_LINK (ihex),
BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
NULL,
- (PTR) 0
+ NULL
};
diff --git a/contrib/binutils/bfd/init.c b/contrib/binutils/bfd/init.c
index 07401eb..49f5533f 100644
--- a/contrib/binutils/bfd/init.c
+++ b/contrib/binutils/bfd/init.c
@@ -1,5 +1,5 @@
/* bfd initialization stuff
- Copyright 1990, 1991, 1992, 1993, 1994, 1995, 2003
+ Copyright 1990, 1991, 1992, 1993, 1994, 1995, 2003, 2007
Free Software Foundation, Inc.
Written by Steve Chamberlain of Cygnus Support.
@@ -17,16 +17,19 @@ 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. */
+Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
/*
SECTION
Initialization
+SUBSECTION
+ Initialization functions
+
These are the functions that handle initializing a BFD.
*/
diff --git a/contrib/binutils/bfd/libaout.h b/contrib/binutils/bfd/libaout.h
index 67054e3..879de13 100644
--- a/contrib/binutils/bfd/libaout.h
+++ b/contrib/binutils/bfd/libaout.h
@@ -1,6 +1,6 @@
/* 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
+ 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
Free Software Foundation, Inc.
Written by Cygnus Support.
@@ -18,7 +18,7 @@
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. */
+ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
#ifndef LIBAOUT_H
#define LIBAOUT_H
@@ -31,22 +31,22 @@
/* 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_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_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
+#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. */
@@ -54,10 +54,10 @@
remove whitespace added here, and thus will fail to concatenate
the tokens. */
#if ARCH_SIZE==64
-#define GET_WORD H_GET_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_WORD H_PUT_64
#define PUT_MAGIC H_PUT_32
#ifndef NAME
#define NAME(x,y) CONCAT3 (x,_64_,y)
@@ -66,10 +66,10 @@
#define BYTES_IN_WORD 8
#else
#if ARCH_SIZE==16
-#define GET_WORD H_GET_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_WORD H_PUT_16
#define PUT_MAGIC H_PUT_16
#ifndef NAME
#define NAME(x,y) CONCAT3 (x,_16_,y)
@@ -77,10 +77,10 @@
#define JNAME(x) CONCAT2 (x,_16)
#define BYTES_IN_WORD 2
#else /* ARCH_SIZE == 32 */
-#define GET_WORD H_GET_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_WORD H_PUT_32
#define PUT_MAGIC H_PUT_32
#ifndef NAME
#define NAME(x,y) CONCAT3 (x,_32_,y)
@@ -126,7 +126,7 @@ struct aout_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), \
+ (bfd_boolean (*) (struct bfd_link_hash_entry *, void *)) (func), \
(info)))
/* Get the a.out link hash table from the info structure. This is
@@ -165,8 +165,7 @@ struct aout_backend_data
/* Callback for setting the page and segment sizes, if they can't be
trivially determined from the architecture. */
- bfd_boolean (*set_sizes)
- PARAMS ((bfd *));
+ bfd_boolean (*set_sizes) (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
@@ -176,39 +175,38 @@ struct aout_backend_data
/* 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 **));
+ (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 **));
+ (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 *));
+ (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 *));
+ (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));
+ (struct bfd_link_info *info, bfd *input_bfd,
+ asection *input_section, struct aout_link_hash_entry *h,
+ void * 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 *));
+ bfd_boolean (*finish_dynamic_link) (bfd *, struct bfd_link_info *);
};
#define aout_backend_info(abfd) \
((const struct aout_backend_data *)((abfd)->xvec->backend_data))
@@ -221,73 +219,77 @@ struct aout_backend_data
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 */
+ 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 >
-*/
+ < MSB >
+ 3130292827262524232221201918171615141312111009080706050403020100
+ < FLAGS >< MACHINE TYPE >< MAGIC NUMBER > */
+
/* Magic number for NetBSD is
-<MSB >
-3130292827262524232221201918171615141312111009080706050403020100
-< FLAGS >< MACHINE TYPE >< MAGIC NUMBER >
-*/
+ <MSB >
+ 3130292827262524232221201918171615141312111009080706050403020100
+ < FLAGS >< MACHINE TYPE >< MAGIC NUMBER > */
-enum machine_type {
+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_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_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_POWERPC_NETBSD = 149, /* NetBSD/powerpc (big-endian) binary. */
+ M_VAX4K_NETBSD = 150, /* NetBSD/vax 4K pages binary. */
+ M_MIPS1 = 151, /* MIPS R2000/R3000 binary. */
+ M_MIPS2 = 152, /* MIPS R4000/R6000 binary. */
+ M_88K_OPENBSD = 153, /* OpenBSD/m88k binary. */
+ M_HPPA_OPENBSD = 154, /* OpenBSD/hppa binary. */
+ M_SPARC64_NETBSD = 156, /* NetBSD/sparc64 binary. */
+ M_X86_64_NETBSD = 157, /* NetBSD/amd64 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. */
+ M_CRIS = 255 /* Axis CRIS binary. */
};
#define N_DYNAMIC(exec) ((exec).a_info & 0x80000000)
@@ -334,7 +336,8 @@ enum machine_type {
((exec).a_info&0x00ffffff) | (((flags) & 0xff) << 24))
#endif
-typedef struct aout_symbol {
+typedef struct aout_symbol
+{
asymbol symbol;
short desc;
char other;
@@ -345,9 +348,10 @@ typedef struct aout_symbol {
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 */
+struct aoutdata
+{
+ struct internal_exec *hdr; /* Exec file header. */
+ aout_symbol_type *symbols; /* Symtab for input bfd. */
/* For ease, we do this. */
asection *textsec;
@@ -409,7 +413,7 @@ struct aoutdata {
struct aout_link_hash_entry **sym_hashes;
/* A pointer for shared library information. */
- PTR dynamic_info;
+ void * 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
@@ -417,30 +421,31 @@ struct aoutdata {
bfd_vma *local_got_offsets;
};
-struct aout_data_struct {
- struct aoutdata a;
- struct internal_exec e;
+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)
+#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. */
@@ -452,137 +457,148 @@ struct aout_data_struct {
struct aout_section_data_struct
{
/* The unswapped relocation entries for this section. */
- PTR relocs;
+ void * 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)
+ ((s)->used_by_bfd = (void *)&(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, squirt_out_relocs)
+ (bfd *, asection *);
-extern bfd_boolean NAME(aout,make_sections)
- PARAMS ((bfd *));
+extern bfd_boolean NAME (aout, make_sections)
+ (bfd *);
-extern const bfd_target * NAME(aout,some_aout_object_p)
- PARAMS ((bfd *, struct internal_exec *, const bfd_target *(*) (bfd *)));
+extern const bfd_target * NAME (aout, some_aout_object_p)
+ (bfd *, struct internal_exec *, const bfd_target *(*) (bfd *));
-extern bfd_boolean NAME(aout,mkobject)
- PARAMS ((bfd *));
+extern bfd_boolean NAME (aout, mkobject)
+ (bfd *);
-extern enum machine_type NAME(aout,machine_type)
- PARAMS ((enum bfd_architecture, unsigned long, bfd_boolean *));
+extern enum machine_type NAME (aout, machine_type)
+ (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, set_arch_mach)
+ (bfd *, enum bfd_architecture, unsigned long);
-extern bfd_boolean NAME(aout,new_section_hook)
- PARAMS ((bfd *, asection *));
+extern bfd_boolean NAME (aout, new_section_hook)
+ (bfd *, asection *);
-extern bfd_boolean NAME(aout,set_section_contents)
- PARAMS ((bfd *, sec_ptr, const PTR, file_ptr, bfd_size_type));
+extern bfd_boolean NAME (aout, set_section_contents)
+ (bfd *, sec_ptr, const void *, file_ptr, bfd_size_type);
-extern asymbol * NAME(aout,make_empty_symbol)
- PARAMS ((bfd *));
+extern asymbol * NAME (aout, make_empty_symbol)
+ (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, translate_symbol_table)
+ (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, slurp_symbol_table)
+ (bfd *);
-extern bfd_boolean NAME(aout,write_syms)
- PARAMS ((bfd *));
+extern bfd_boolean NAME (aout, write_syms)
+ (bfd *);
-extern void NAME(aout,reclaim_symbol_table)
- PARAMS ((bfd *));
+extern void NAME (aout, reclaim_symbol_table)
+ (bfd *);
-extern long NAME(aout,get_symtab_upper_bound)
- PARAMS ((bfd *));
+extern long NAME (aout, get_symtab_upper_bound)
+ (bfd *);
-extern long NAME(aout,canonicalize_symtab)
- PARAMS ((bfd *, asymbol **));
+extern long NAME (aout, canonicalize_symtab)
+ (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 void NAME (aout, swap_ext_reloc_in)
+ (bfd *, struct reloc_ext_external *, arelent *, asymbol **,
+ bfd_size_type);
-extern reloc_howto_type * NAME(aout,reloc_type_lookup)
- PARAMS ((bfd *, bfd_reloc_code_real_type));
+extern void NAME (aout, swap_std_reloc_in)
+ (bfd *, struct reloc_std_external *, arelent *, asymbol **,
+ bfd_size_type);
-extern bfd_boolean NAME(aout,slurp_reloc_table)
- PARAMS ((bfd *, sec_ptr, asymbol **));
+extern reloc_howto_type * NAME (aout, reloc_type_lookup)
+ (bfd *, bfd_reloc_code_real_type);
-extern long NAME(aout,canonicalize_reloc)
- PARAMS ((bfd *, sec_ptr, arelent **, asymbol **));
+extern reloc_howto_type * NAME (aout, reloc_name_lookup)
+ (bfd *, const char *);
-extern long NAME(aout,get_reloc_upper_bound)
- PARAMS ((bfd *, sec_ptr));
+extern bfd_boolean NAME (aout, slurp_reloc_table)
+ (bfd *, sec_ptr, asymbol **);
-extern void NAME(aout,reclaim_reloc)
- PARAMS ((bfd *, sec_ptr));
+extern long NAME (aout, canonicalize_reloc)
+ (bfd *, sec_ptr, arelent **, asymbol **);
-extern alent * NAME(aout,get_lineno)
- PARAMS ((bfd *, asymbol *));
+extern long NAME (aout, get_reloc_upper_bound)
+ (bfd *, sec_ptr);
-extern void NAME(aout,print_symbol)
- PARAMS ((bfd *, PTR, asymbol *, bfd_print_symbol_type));
+extern void NAME (aout, reclaim_reloc)
+ (bfd *, sec_ptr);
-extern void NAME(aout,get_symbol_info)
- PARAMS ((bfd *, asymbol *, symbol_info *));
+extern alent * NAME (aout, get_lineno)
+ (bfd *, asymbol *);
-extern bfd_boolean NAME(aout,find_nearest_line)
- PARAMS ((bfd *, asection *, asymbol **, bfd_vma, const char **,
- const char **, unsigned int *));
+extern void NAME (aout, print_symbol)
+ (bfd *, void *, asymbol *, bfd_print_symbol_type);
-extern long NAME(aout,read_minisymbols)
- PARAMS ((bfd *, bfd_boolean, PTR *, unsigned int *));
+extern void NAME (aout, get_symbol_info)
+ (bfd *, asymbol *, symbol_info *);
-extern asymbol * NAME(aout,minisymbol_to_symbol)
- PARAMS ((bfd *, bfd_boolean, const PTR, asymbol *));
+extern bfd_boolean NAME (aout, find_nearest_line)
+ (bfd *, asection *, asymbol **, bfd_vma, const char **,
+ const char **, unsigned int *);
-extern int NAME(aout,sizeof_headers)
- PARAMS ((bfd *, bfd_boolean));
+extern long NAME (aout, read_minisymbols)
+ (bfd *, bfd_boolean, void * *, unsigned int *);
-extern bfd_boolean NAME(aout,adjust_sizes_and_vmas)
- PARAMS ((bfd *, bfd_size_type *, file_ptr *));
+extern asymbol * NAME (aout, minisymbol_to_symbol)
+ (bfd *, bfd_boolean, const void *, asymbol *);
-extern void NAME(aout,swap_exec_header_in)
- PARAMS ((bfd *, struct external_exec *, struct internal_exec *));
+extern int NAME (aout, sizeof_headers)
+ (bfd *, struct bfd_link_info *);
-extern void NAME(aout,swap_exec_header_out)
- PARAMS ((bfd *, struct internal_exec *, struct external_exec *));
+extern bfd_boolean NAME (aout, adjust_sizes_and_vmas)
+ (bfd *, bfd_size_type *, file_ptr *);
-extern struct bfd_hash_entry * NAME(aout,link_hash_newfunc)
- PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, const char *));
+extern void NAME (aout, swap_exec_header_in)
+ (bfd *, struct external_exec *, struct internal_exec *);
-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 void NAME (aout, swap_exec_header_out)
+ (bfd *, struct internal_exec *, struct external_exec *);
-extern struct bfd_link_hash_table * NAME(aout,link_hash_table_create)
- PARAMS ((bfd *));
+extern struct bfd_hash_entry * NAME (aout, link_hash_newfunc)
+ (struct bfd_hash_entry *, struct bfd_hash_table *, const char *);
-extern bfd_boolean NAME(aout,link_add_symbols)
- PARAMS ((bfd *, struct bfd_link_info *));
+extern bfd_boolean NAME (aout, link_hash_table_init)
+ (struct aout_link_hash_table *, bfd *,
+ struct bfd_hash_entry *(*) (struct bfd_hash_entry *,
+ struct bfd_hash_table *,
+ const char *),
+ unsigned int);
-extern bfd_boolean NAME(aout,final_link)
- PARAMS ((bfd *, struct bfd_link_info *,
- void (*) (bfd *, file_ptr *, file_ptr *, file_ptr *)));
+extern struct bfd_link_hash_table * NAME (aout, link_hash_table_create)
+ (bfd *);
-extern bfd_boolean NAME(aout,bfd_free_cached_info)
- PARAMS ((bfd *));
+extern bfd_boolean NAME (aout, link_add_symbols)
+ (bfd *, struct bfd_link_info *);
+
+extern bfd_boolean NAME (aout, final_link)
+ (bfd *, struct bfd_link_info *,
+ void (*) (bfd *, file_ptr *, file_ptr *, file_ptr *));
+
+extern bfd_boolean NAME (aout, bfd_free_cached_info)
+ (bfd *);
+
+#define aout_32_find_inliner_info _bfd_nosymbols_find_inliner_info
+#if 0 /* Are these needed? */
+#define aout_16_find_inliner_info _bfd_nosymbols_find_inliner_info
+#define aout_64_find_inliner_info _bfd_nosymbols_find_inliner_info
+#endif
/* A.out uses the generic versions of these routines... */
@@ -599,13 +615,19 @@ extern bfd_boolean NAME(aout,bfd_free_cached_info)
#define aout_32_bfd_is_local_label_name bfd_generic_is_local_label_name
#endif
+#ifndef aout_32_bfd_is_target_special_symbol
+#define aout_32_bfd_is_target_special_symbol \
+ ((bfd_boolean (*) (bfd *, asymbol *)) bfd_false)
+#endif
+
#ifndef WRITE_HEADERS
#define WRITE_HEADERS(abfd, execp) \
{ \
- bfd_size_type text_size; /* dummy vars */ \
+ 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); \
+ 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); \
@@ -614,32 +636,32 @@ extern bfd_boolean NAME(aout,bfd_free_cached_info)
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); \
+ 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, \
+ || bfd_bwrite (& 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 \
+ if (bfd_get_outsymbols (abfd) != 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)) \
+ if (! NAME (aout, write_syms) (abfd)) \
return FALSE; \
} \
\
- if (bfd_seek (abfd, (file_ptr) (N_TRELOFF(*execp)), SEEK_SET) != 0) \
+ if (bfd_seek (abfd, (file_ptr) (N_TRELOFF (*execp)), SEEK_SET) != 0) \
return FALSE; \
- if (!NAME(aout,squirt_out_relocs) (abfd, obj_textsec (abfd))) \
+ if (!NAME (aout, squirt_out_relocs) (abfd, obj_textsec (abfd))) \
return FALSE; \
\
- if (bfd_seek (abfd, (file_ptr) (N_DRELOFF(*execp)), SEEK_SET) != 0) \
+ if (bfd_seek (abfd, (file_ptr) (N_DRELOFF (*execp)), SEEK_SET) != 0) \
return FALSE; \
- if (!NAME(aout,squirt_out_relocs) (abfd, obj_datasec (abfd))) \
+ if (!NAME (aout, squirt_out_relocs) (abfd, obj_datasec (abfd))) \
return FALSE; \
}
#endif
@@ -659,8 +681,8 @@ extern bfd_boolean NAME(aout,bfd_free_cached_info)
&& 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 \
+ obj_textsec (abfd)->size) \
+ && ((sec)->vma + (sec)->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
index 10cafef..3555e6a 100644
--- a/contrib/binutils/bfd/libbfd-in.h
+++ b/contrib/binutils/bfd/libbfd-in.h
@@ -2,7 +2,8 @@
(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.
+ 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
+ Free Software Foundation, Inc.
Written by Cygnus Support.
@@ -20,7 +21,9 @@ 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. */
+Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include "hashtab.h"
/* 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
@@ -50,17 +53,24 @@ struct bfd_in_memory
bfd_byte *buffer;
};
+struct section_hash_entry
+{
+ struct bfd_hash_entry root;
+ asection section;
+};
+
/* 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;
+ htab_t 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 */
+ bfd_size_type extended_names_size; /* Size of extended names */
/* 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
@@ -90,7 +100,14 @@ extern void *bfd_realloc
(void *, bfd_size_type);
extern void *bfd_zmalloc
(bfd_size_type);
-
+extern void *bfd_malloc2
+ (bfd_size_type, bfd_size_type);
+extern void *bfd_realloc2
+ (void *, bfd_size_type, bfd_size_type);
+extern void *bfd_zmalloc2
+ (bfd_size_type, bfd_size_type);
+
+extern void _bfd_default_error_handler (const char *s, ...);
extern bfd_error_handler_type _bfd_error_handler;
/* These routines allocate and free things on the BFD's objalloc. */
@@ -99,6 +116,10 @@ extern void *bfd_alloc
(bfd *, bfd_size_type);
extern void *bfd_zalloc
(bfd *, bfd_size_type);
+extern void *bfd_alloc2
+ (bfd *, bfd_size_type, bfd_size_type);
+extern void *bfd_zalloc2
+ (bfd *, bfd_size_type, bfd_size_type);
extern void bfd_release
(bfd *, void *);
@@ -134,6 +155,8 @@ bfd * _bfd_new_bfd
(void);
void _bfd_delete_bfd
(bfd *);
+bfd_boolean _bfd_free_cached_info
+ (bfd *);
bfd_boolean bfd_false
(bfd *ignore);
@@ -174,6 +197,8 @@ bfd_boolean coff_write_armap
extern void *_bfd_generic_read_ar_hdr
(bfd *);
+extern void _bfd_ar_spacepad
+ (char *, size_t, const char *, long);
extern void *_bfd_generic_read_ar_hdr_mag
(bfd *, const char *);
@@ -192,8 +217,8 @@ int bfd_generic_stat_arch_elt
#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_new_section_hook
+ (bfd *, asection *);
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
@@ -212,9 +237,14 @@ extern bfd_boolean _bfd_generic_get_section_contents_in_window
((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_copy_private_header_data \
+ ((bfd_boolean (*) (bfd *, bfd *)) bfd_true)
#define _bfd_generic_bfd_print_private_bfd_data \
((bfd_boolean (*) (bfd *, void *)) bfd_true)
+extern bfd_boolean _bfd_generic_init_private_section_data
+ (bfd *, asection *, bfd *, asection *, struct bfd_link_info *);
+
/* Routines to use for BFD_JUMP_TABLE_CORE when there is no core file
support. Use BFD_JUMP_TABLE_CORE (_bfd_nocore). */
@@ -296,12 +326,17 @@ extern bfd_boolean _bfd_archive_coff_construct_extended_name_table
((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_bfd_is_target_special_symbol \
+ ((bfd_boolean (*) (bfd *, asymbol *)) 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_find_inliner_info \
+ ((bfd_boolean (*) (bfd *, 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 \
@@ -313,12 +348,13 @@ extern bfd_boolean _bfd_archive_coff_construct_extended_name_table
/* 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)
+extern long _bfd_norelocs_get_reloc_upper_bound (bfd *, asection *);
+extern long _bfd_norelocs_canonicalize_reloc (bfd *, asection *,
+ arelent **, asymbol **);
#define _bfd_norelocs_bfd_reloc_type_lookup \
((reloc_howto_type *(*) (bfd *, bfd_reloc_code_real_type)) bfd_nullvoidptr)
+#define _bfd_norelocs_bfd_reloc_name_lookup \
+ ((reloc_howto_type *(*) (bfd *, const char *)) bfd_nullvoidptr)
/* Routines to use for BFD_JUMP_TABLE_WRITE for targets which may not
be written. Use BFD_JUMP_TABLE_WRITE (_bfd_nowrite). */
@@ -340,7 +376,8 @@ extern bfd_boolean _bfd_generic_set_section_contents
/* 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_sizeof_headers \
+ ((int (*) (bfd *, struct bfd_link_info *)) 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 **)) \
@@ -355,6 +392,9 @@ extern bfd_boolean _bfd_generic_set_section_contents
#define _bfd_nolink_bfd_merge_sections \
((bfd_boolean (*) (bfd *, struct bfd_link_info *)) \
bfd_false)
+#define _bfd_nolink_bfd_is_group_section \
+ ((bfd_boolean (*) (bfd *, const struct bfd_section *)) \
+ bfd_false)
#define _bfd_nolink_bfd_discard_group \
((bfd_boolean (*) (bfd *, struct bfd_section *)) \
bfd_false)
@@ -370,6 +410,8 @@ extern bfd_boolean _bfd_generic_set_section_contents
((bfd_boolean (*) (bfd *, struct bfd_link_info *)) bfd_false)
#define _bfd_nolink_bfd_link_split_section \
((bfd_boolean (*) (bfd *, struct bfd_section *)) bfd_false)
+#define _bfd_nolink_section_already_linked \
+ ((void (*) (bfd *, struct bfd_section *, struct bfd_link_info *)) bfd_void)
/* Routines to use for BFD_JUMP_TABLE_DYNAMIC for targets which do not
have dynamic symbols or relocs. Use BFD_JUMP_TABLE_DYNAMIC
@@ -378,6 +420,8 @@ extern bfd_boolean _bfd_generic_set_section_contents
#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_synthetic_symtab \
+ ((long (*) (bfd *, long, asymbol **, long, asymbol **, 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)
@@ -398,7 +442,7 @@ 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. */
+/* Find the nearest 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 *);
@@ -408,6 +452,18 @@ extern bfd_boolean _bfd_dwarf2_find_nearest_line
(bfd *, asection *, asymbol **, bfd_vma, const char **, const char **,
unsigned int *, unsigned int, void **);
+/* Find the line using DWARF 2 debugging information. */
+extern bfd_boolean _bfd_dwarf2_find_line
+ (bfd *, asymbol **, asymbol *, const char **,
+ unsigned int *, unsigned int, void **);
+
+bfd_boolean _bfd_generic_find_line
+ (bfd *, asymbol **, asymbol *, const char **, unsigned int *);
+
+/* Find inliner info after calling bfd_find_nearest_line. */
+extern bfd_boolean _bfd_dwarf2_find_inliner_info
+ (bfd *, const char **, const char **, 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 *);
@@ -422,7 +478,8 @@ 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 *));
+ const char *),
+ unsigned int);
/* Generic link hash table creation routine. */
extern struct bfd_link_hash_table *_bfd_generic_link_hash_table_create
@@ -467,6 +524,9 @@ extern bfd_boolean _bfd_generic_final_link
extern bfd_boolean _bfd_generic_link_split_section
(bfd *, struct bfd_section *);
+extern void _bfd_generic_section_already_linked
+ (bfd *, struct bfd_section *, struct bfd_link_info *);
+
/* Generic reloc_link_order processing routine. */
extern bfd_boolean _bfd_generic_reloc_link_order
(bfd *, struct bfd_link_info *, asection *, struct bfd_link_order *);
@@ -488,10 +548,15 @@ extern bfd_reloc_status_type _bfd_final_link_relocate
extern bfd_reloc_status_type _bfd_relocate_contents
(reloc_howto_type *, bfd *, bfd_vma, bfd_byte *);
+/* Clear a given location using a given howto. */
+extern void _bfd_clear_contents (reloc_howto_type *howto, bfd *input_bfd,
+ bfd_byte *location);
+
/* Link stabs in sections in the first pass. */
extern bfd_boolean _bfd_link_section_stabs
- (bfd *, void **, asection *, asection *, void **, bfd_size_type *);
+ (bfd *, struct stab_info *, asection *, asection *, void **,
+ bfd_size_type *);
/* Eliminate stabs for discarded functions and symbols. */
extern bfd_boolean _bfd_discard_section_stabs
@@ -500,28 +565,28 @@ extern bfd_boolean _bfd_discard_section_stabs
/* Write out the .stab section when linking stabs in sections. */
extern bfd_boolean _bfd_write_section_stabs
- (bfd *, void **, asection *, void **, bfd_byte *);
+ (bfd *, struct stab_info *, asection *, void **, bfd_byte *);
/* Write out the .stabstr string table when linking stabs in sections. */
extern bfd_boolean _bfd_write_stab_strings
- (bfd *, void **);
+ (bfd *, struct stab_info *);
/* 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);
+ (asection *, void *, bfd_vma);
-/* Attempt to merge a SEC_MERGE section. */
+/* Register a SEC_MERGE section as a candidate for merging. */
-extern bfd_boolean _bfd_merge_section
+extern bfd_boolean _bfd_add_merge_section
(bfd *, void **, asection *, void **);
/* Attempt to merge SEC_MERGE sections. */
extern bfd_boolean _bfd_merge_sections
- (bfd *, void *, void (*) (bfd *, asection *));
+ (bfd *, struct bfd_link_info *, void *, void (*) (bfd *, asection *));
/* Write out a merged section. */
@@ -531,7 +596,7 @@ extern bfd_boolean _bfd_write_merged_section
/* Find an offset within a modified SEC_MERGE section. */
extern bfd_vma _bfd_merged_section_offset
- (bfd *, asection **, void *, bfd_vma, bfd_vma);
+ (bfd *, asection **, void *, bfd_vma);
/* Create a string table. */
extern struct bfd_strtab_hash *_bfd_stringtab_init
@@ -579,10 +644,10 @@ void bfd_assert
(const char*,int);
#define BFD_ASSERT(x) \
- { if (!(x)) bfd_assert(__FILE__,__LINE__); }
+ do { if (!(x)) bfd_assert(__FILE__,__LINE__); } while (0)
#define BFD_FAIL() \
- { bfd_assert(__FILE__,__LINE__); }
+ do { bfd_assert(__FILE__,__LINE__); } while (0)
extern void _bfd_abort
(const char *, int, const char *) ATTRIBUTE_NORETURN;
@@ -599,11 +664,7 @@ extern void _bfd_abort
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;
+extern FILE *real_fopen (const char *filename, const char *modes);
/* List of supported target vectors, and the default vector (if
bfd_default_vector[0] is NULL, there is no default). */
@@ -645,3 +706,31 @@ extern bfd_boolean _bfd_sh_align_load_span
bfd_boolean (*) (bfd *, asection *, void *, bfd_byte *, bfd_vma),
void *, bfd_vma **, bfd_vma *, bfd_vma, bfd_vma, bfd_boolean *);
#endif
+
+/* This is the shape of the elements inside the already_linked hash
+ table. It maps a name onto a list of already_linked elements with
+ the same name. */
+
+struct bfd_section_already_linked_hash_entry
+{
+ struct bfd_hash_entry root;
+ struct bfd_section_already_linked *entry;
+};
+
+struct bfd_section_already_linked
+{
+ struct bfd_section_already_linked *next;
+ asection *sec;
+};
+
+extern struct bfd_section_already_linked_hash_entry *
+ bfd_section_already_linked_table_lookup (const char *);
+extern void bfd_section_already_linked_table_insert
+ (struct bfd_section_already_linked_hash_entry *, asection *);
+extern void bfd_section_already_linked_table_traverse
+ (bfd_boolean (*) (struct bfd_section_already_linked_hash_entry *,
+ void *), void *);
+
+extern bfd_vma read_unsigned_leb128 (bfd *, bfd_byte *, unsigned int *);
+extern bfd_signed_vma read_signed_leb128 (bfd *, bfd_byte *, unsigned int *);
+
diff --git a/contrib/binutils/bfd/libbfd.c b/contrib/binutils/bfd/libbfd.c
index be090e9..7dada1c 100644
--- a/contrib/binutils/bfd/libbfd.c
+++ b/contrib/binutils/bfd/libbfd.c
@@ -1,6 +1,6 @@
/* Assorted BFD support routines, only used internally.
Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
- 2000, 2001, 2002, 2003, 2004
+ 2000, 2001, 2002, 2003, 2004, 2005, 2007
Free Software Foundation, Inc.
Written by Cygnus Support.
@@ -18,10 +18,10 @@
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. */
+ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
#ifndef HAVE_GETPAGESIZE
@@ -30,6 +30,9 @@
/*
SECTION
+ Implementation details
+
+SUBSECTION
Internal functions
DESCRIPTION
@@ -100,6 +103,23 @@ bfd_void (bfd *ignore ATTRIBUTE_UNUSED)
{
}
+long
+_bfd_norelocs_get_reloc_upper_bound (bfd *abfd ATTRIBUTE_UNUSED,
+ asection *sec ATTRIBUTE_UNUSED)
+{
+ return sizeof (arelent *);
+}
+
+long
+_bfd_norelocs_canonicalize_reloc (bfd *abfd ATTRIBUTE_UNUSED,
+ asection *sec ATTRIBUTE_UNUSED,
+ arelent **relptr,
+ asymbol **symbols ATTRIBUTE_UNUSED)
+{
+ *relptr = NULL;
+ return 0;
+}
+
bfd_boolean
_bfd_nocore_core_file_matches_executable_p
(bfd *ignore_core_bfd ATTRIBUTE_UNUSED,
@@ -156,6 +176,36 @@ bfd_malloc (bfd_size_type size)
return ptr;
}
+/* Allocate memory using malloc, nmemb * size with overflow checking. */
+
+void *
+bfd_malloc2 (bfd_size_type nmemb, bfd_size_type size)
+{
+ void *ptr;
+
+ if ((nmemb | size) >= HALF_BFD_SIZE_TYPE
+ && size != 0
+ && nmemb > ~(bfd_size_type) 0 / size)
+ {
+ bfd_set_error (bfd_error_no_memory);
+ return NULL;
+ }
+
+ size *= nmemb;
+
+ 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 *
@@ -180,6 +230,40 @@ bfd_realloc (void *ptr, bfd_size_type size)
return ret;
}
+/* Reallocate memory using realloc, nmemb * size with overflow checking. */
+
+void *
+bfd_realloc2 (void *ptr, bfd_size_type nmemb, bfd_size_type size)
+{
+ void *ret;
+
+ if ((nmemb | size) >= HALF_BFD_SIZE_TYPE
+ && size != 0
+ && nmemb > ~(bfd_size_type) 0 / size)
+ {
+ bfd_set_error (bfd_error_no_memory);
+ return NULL;
+ }
+
+ size *= nmemb;
+
+ 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 *
@@ -205,6 +289,44 @@ bfd_zmalloc (bfd_size_type size)
return ptr;
}
+
+/* Allocate memory using malloc (nmemb * size) with overflow checking
+ and clear it. */
+
+void *
+bfd_zmalloc2 (bfd_size_type nmemb, bfd_size_type size)
+{
+ void *ptr;
+
+ if ((nmemb | size) >= HALF_BFD_SIZE_TYPE
+ && size != 0
+ && nmemb > ~(bfd_size_type) 0 / size)
+ {
+ bfd_set_error (bfd_error_no_memory);
+ return NULL;
+ }
+
+ size *= nmemb;
+
+ 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
@@ -692,10 +814,12 @@ _bfd_generic_get_section_contents (bfd *abfd,
file_ptr offset,
bfd_size_type count)
{
+ bfd_size_type sz;
if (count == 0)
return TRUE;
- if (offset + count > section->_raw_size)
+ sz = section->rawsize ? section->rawsize : section->size;
+ if (offset + count > sz)
{
bfd_set_error (bfd_error_invalid_operation);
return FALSE;
@@ -717,6 +841,8 @@ _bfd_generic_get_section_contents_in_window
bfd_size_type count ATTRIBUTE_UNUSED)
{
#ifdef USE_MMAP
+ bfd_size_type sz;
+
if (count == 0)
return TRUE;
if (abfd->xvec->_bfd_get_section_contents
@@ -744,7 +870,8 @@ _bfd_generic_get_section_contents_in_window
w->data = w->i->data;
return bfd_get_section_contents (abfd, section, w->data, offset, count);
}
- if (offset + count > section->_raw_size
+ sz = section->rawsize ? section->rawsize : section->size;
+ if (offset + count > sz
|| ! bfd_get_file_window (abfd, section->filepos + offset, count, w,
TRUE))
return FALSE;
@@ -818,11 +945,11 @@ _bfd_generic_verify_endian_match (bfd *ibfd, bfd *obfd)
const char *msg;
if (bfd_big_endian (ibfd))
- msg = _("%s: compiled for a big endian system and target is little endian");
+ msg = _("%B: 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");
+ msg = _("%B: compiled for a little endian system and target is big endian");
- (*_bfd_error_handler) (msg, bfd_archive_filename (ibfd));
+ (*_bfd_error_handler) (msg, ibfd);
bfd_set_error (bfd_error_wrong_format);
return FALSE;
@@ -855,3 +982,81 @@ warn_deprecated (const char *what,
mask |= ~(size_t) func;
}
}
+
+/* Helper function for reading uleb128 encoded data. */
+
+bfd_vma
+read_unsigned_leb128 (bfd *abfd ATTRIBUTE_UNUSED,
+ bfd_byte *buf,
+ unsigned int *bytes_read_ptr)
+{
+ bfd_vma result;
+ unsigned int num_read;
+ unsigned int shift;
+ unsigned char byte;
+
+ result = 0;
+ shift = 0;
+ num_read = 0;
+ do
+ {
+ byte = bfd_get_8 (abfd, 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. */
+
+bfd_signed_vma
+read_signed_leb128 (bfd *abfd ATTRIBUTE_UNUSED,
+ bfd_byte *buf,
+ unsigned int *bytes_read_ptr)
+{
+ bfd_vma result;
+ unsigned int shift;
+ unsigned int num_read;
+ unsigned char byte;
+
+ result = 0;
+ shift = 0;
+ num_read = 0;
+ do
+ {
+ byte = bfd_get_8 (abfd, buf);
+ buf ++;
+ num_read ++;
+ result |= (((bfd_vma) byte & 0x7f) << shift);
+ shift += 7;
+ }
+ while (byte & 0x80);
+ if (shift < 8 * sizeof (result) && (byte & 0x40))
+ result |= (((bfd_vma) -1) << shift);
+ *bytes_read_ptr = num_read;
+ return result;
+}
+
+bfd_boolean
+_bfd_generic_find_line (bfd *abfd ATTRIBUTE_UNUSED,
+ asymbol **symbols ATTRIBUTE_UNUSED,
+ asymbol *symbol ATTRIBUTE_UNUSED,
+ const char **filename_ptr ATTRIBUTE_UNUSED,
+ unsigned int *linenumber_ptr ATTRIBUTE_UNUSED)
+{
+ return FALSE;
+}
+
+bfd_boolean
+_bfd_generic_init_private_section_data (bfd *ibfd ATTRIBUTE_UNUSED,
+ asection *isec ATTRIBUTE_UNUSED,
+ bfd *obfd ATTRIBUTE_UNUSED,
+ asection *osec ATTRIBUTE_UNUSED,
+ struct bfd_link_info *link_info ATTRIBUTE_UNUSED)
+{
+ return TRUE;
+}
diff --git a/contrib/binutils/bfd/libbfd.h b/contrib/binutils/bfd/libbfd.h
index 62043f3..4c1414f 100644
--- a/contrib/binutils/bfd/libbfd.h
+++ b/contrib/binutils/bfd/libbfd.h
@@ -7,7 +7,8 @@
(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.
+ 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
+ Free Software Foundation, Inc.
Written by Cygnus Support.
@@ -25,7 +26,9 @@ 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. */
+Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include "hashtab.h"
/* 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
@@ -55,17 +58,24 @@ struct bfd_in_memory
bfd_byte *buffer;
};
+struct section_hash_entry
+{
+ struct bfd_hash_entry root;
+ asection section;
+};
+
/* 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;
+ htab_t 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 */
+ bfd_size_type extended_names_size; /* Size of extended names */
/* 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
@@ -95,7 +105,14 @@ extern void *bfd_realloc
(void *, bfd_size_type);
extern void *bfd_zmalloc
(bfd_size_type);
-
+extern void *bfd_malloc2
+ (bfd_size_type, bfd_size_type);
+extern void *bfd_realloc2
+ (void *, bfd_size_type, bfd_size_type);
+extern void *bfd_zmalloc2
+ (bfd_size_type, bfd_size_type);
+
+extern void _bfd_default_error_handler (const char *s, ...);
extern bfd_error_handler_type _bfd_error_handler;
/* These routines allocate and free things on the BFD's objalloc. */
@@ -104,6 +121,10 @@ extern void *bfd_alloc
(bfd *, bfd_size_type);
extern void *bfd_zalloc
(bfd *, bfd_size_type);
+extern void *bfd_alloc2
+ (bfd *, bfd_size_type, bfd_size_type);
+extern void *bfd_zalloc2
+ (bfd *, bfd_size_type, bfd_size_type);
extern void bfd_release
(bfd *, void *);
@@ -139,6 +160,8 @@ bfd * _bfd_new_bfd
(void);
void _bfd_delete_bfd
(bfd *);
+bfd_boolean _bfd_free_cached_info
+ (bfd *);
bfd_boolean bfd_false
(bfd *ignore);
@@ -179,6 +202,8 @@ bfd_boolean coff_write_armap
extern void *_bfd_generic_read_ar_hdr
(bfd *);
+extern void _bfd_ar_spacepad
+ (char *, size_t, const char *, long);
extern void *_bfd_generic_read_ar_hdr_mag
(bfd *, const char *);
@@ -197,8 +222,8 @@ int bfd_generic_stat_arch_elt
#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_new_section_hook
+ (bfd *, asection *);
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
@@ -217,9 +242,14 @@ extern bfd_boolean _bfd_generic_get_section_contents_in_window
((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_copy_private_header_data \
+ ((bfd_boolean (*) (bfd *, bfd *)) bfd_true)
#define _bfd_generic_bfd_print_private_bfd_data \
((bfd_boolean (*) (bfd *, void *)) bfd_true)
+extern bfd_boolean _bfd_generic_init_private_section_data
+ (bfd *, asection *, bfd *, asection *, struct bfd_link_info *);
+
/* Routines to use for BFD_JUMP_TABLE_CORE when there is no core file
support. Use BFD_JUMP_TABLE_CORE (_bfd_nocore). */
@@ -301,12 +331,17 @@ extern bfd_boolean _bfd_archive_coff_construct_extended_name_table
((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_bfd_is_target_special_symbol \
+ ((bfd_boolean (*) (bfd *, asymbol *)) 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_find_inliner_info \
+ ((bfd_boolean (*) (bfd *, 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 \
@@ -318,12 +353,13 @@ extern bfd_boolean _bfd_archive_coff_construct_extended_name_table
/* 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)
+extern long _bfd_norelocs_get_reloc_upper_bound (bfd *, asection *);
+extern long _bfd_norelocs_canonicalize_reloc (bfd *, asection *,
+ arelent **, asymbol **);
#define _bfd_norelocs_bfd_reloc_type_lookup \
((reloc_howto_type *(*) (bfd *, bfd_reloc_code_real_type)) bfd_nullvoidptr)
+#define _bfd_norelocs_bfd_reloc_name_lookup \
+ ((reloc_howto_type *(*) (bfd *, const char *)) bfd_nullvoidptr)
/* Routines to use for BFD_JUMP_TABLE_WRITE for targets which may not
be written. Use BFD_JUMP_TABLE_WRITE (_bfd_nowrite). */
@@ -345,7 +381,8 @@ extern bfd_boolean _bfd_generic_set_section_contents
/* 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_sizeof_headers \
+ ((int (*) (bfd *, struct bfd_link_info *)) 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 **)) \
@@ -360,6 +397,9 @@ extern bfd_boolean _bfd_generic_set_section_contents
#define _bfd_nolink_bfd_merge_sections \
((bfd_boolean (*) (bfd *, struct bfd_link_info *)) \
bfd_false)
+#define _bfd_nolink_bfd_is_group_section \
+ ((bfd_boolean (*) (bfd *, const struct bfd_section *)) \
+ bfd_false)
#define _bfd_nolink_bfd_discard_group \
((bfd_boolean (*) (bfd *, struct bfd_section *)) \
bfd_false)
@@ -375,6 +415,8 @@ extern bfd_boolean _bfd_generic_set_section_contents
((bfd_boolean (*) (bfd *, struct bfd_link_info *)) bfd_false)
#define _bfd_nolink_bfd_link_split_section \
((bfd_boolean (*) (bfd *, struct bfd_section *)) bfd_false)
+#define _bfd_nolink_section_already_linked \
+ ((void (*) (bfd *, struct bfd_section *, struct bfd_link_info *)) bfd_void)
/* Routines to use for BFD_JUMP_TABLE_DYNAMIC for targets which do not
have dynamic symbols or relocs. Use BFD_JUMP_TABLE_DYNAMIC
@@ -383,6 +425,8 @@ extern bfd_boolean _bfd_generic_set_section_contents
#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_synthetic_symtab \
+ ((long (*) (bfd *, long, asymbol **, long, asymbol **, 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)
@@ -403,7 +447,7 @@ 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. */
+/* Find the nearest 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 *);
@@ -413,6 +457,18 @@ extern bfd_boolean _bfd_dwarf2_find_nearest_line
(bfd *, asection *, asymbol **, bfd_vma, const char **, const char **,
unsigned int *, unsigned int, void **);
+/* Find the line using DWARF 2 debugging information. */
+extern bfd_boolean _bfd_dwarf2_find_line
+ (bfd *, asymbol **, asymbol *, const char **,
+ unsigned int *, unsigned int, void **);
+
+bfd_boolean _bfd_generic_find_line
+ (bfd *, asymbol **, asymbol *, const char **, unsigned int *);
+
+/* Find inliner info after calling bfd_find_nearest_line. */
+extern bfd_boolean _bfd_dwarf2_find_inliner_info
+ (bfd *, const char **, const char **, 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 *);
@@ -427,7 +483,8 @@ 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 *));
+ const char *),
+ unsigned int);
/* Generic link hash table creation routine. */
extern struct bfd_link_hash_table *_bfd_generic_link_hash_table_create
@@ -472,6 +529,9 @@ extern bfd_boolean _bfd_generic_final_link
extern bfd_boolean _bfd_generic_link_split_section
(bfd *, struct bfd_section *);
+extern void _bfd_generic_section_already_linked
+ (bfd *, struct bfd_section *, struct bfd_link_info *);
+
/* Generic reloc_link_order processing routine. */
extern bfd_boolean _bfd_generic_reloc_link_order
(bfd *, struct bfd_link_info *, asection *, struct bfd_link_order *);
@@ -493,10 +553,15 @@ extern bfd_reloc_status_type _bfd_final_link_relocate
extern bfd_reloc_status_type _bfd_relocate_contents
(reloc_howto_type *, bfd *, bfd_vma, bfd_byte *);
+/* Clear a given location using a given howto. */
+extern void _bfd_clear_contents (reloc_howto_type *howto, bfd *input_bfd,
+ bfd_byte *location);
+
/* Link stabs in sections in the first pass. */
extern bfd_boolean _bfd_link_section_stabs
- (bfd *, void **, asection *, asection *, void **, bfd_size_type *);
+ (bfd *, struct stab_info *, asection *, asection *, void **,
+ bfd_size_type *);
/* Eliminate stabs for discarded functions and symbols. */
extern bfd_boolean _bfd_discard_section_stabs
@@ -505,28 +570,28 @@ extern bfd_boolean _bfd_discard_section_stabs
/* Write out the .stab section when linking stabs in sections. */
extern bfd_boolean _bfd_write_section_stabs
- (bfd *, void **, asection *, void **, bfd_byte *);
+ (bfd *, struct stab_info *, asection *, void **, bfd_byte *);
/* Write out the .stabstr string table when linking stabs in sections. */
extern bfd_boolean _bfd_write_stab_strings
- (bfd *, void **);
+ (bfd *, struct stab_info *);
/* 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);
+ (asection *, void *, bfd_vma);
-/* Attempt to merge a SEC_MERGE section. */
+/* Register a SEC_MERGE section as a candidate for merging. */
-extern bfd_boolean _bfd_merge_section
+extern bfd_boolean _bfd_add_merge_section
(bfd *, void **, asection *, void **);
/* Attempt to merge SEC_MERGE sections. */
extern bfd_boolean _bfd_merge_sections
- (bfd *, void *, void (*) (bfd *, asection *));
+ (bfd *, struct bfd_link_info *, void *, void (*) (bfd *, asection *));
/* Write out a merged section. */
@@ -536,7 +601,7 @@ extern bfd_boolean _bfd_write_merged_section
/* Find an offset within a modified SEC_MERGE section. */
extern bfd_vma _bfd_merged_section_offset
- (bfd *, asection **, void *, bfd_vma, bfd_vma);
+ (bfd *, asection **, void *, bfd_vma);
/* Create a string table. */
extern struct bfd_strtab_hash *_bfd_stringtab_init
@@ -584,10 +649,10 @@ void bfd_assert
(const char*,int);
#define BFD_ASSERT(x) \
- { if (!(x)) bfd_assert(__FILE__,__LINE__); }
+ do { if (!(x)) bfd_assert(__FILE__,__LINE__); } while (0)
#define BFD_FAIL() \
- { bfd_assert(__FILE__,__LINE__); }
+ do { bfd_assert(__FILE__,__LINE__); } while (0)
extern void _bfd_abort
(const char *, int, const char *) ATTRIBUTE_NORETURN;
@@ -604,11 +669,7 @@ extern void _bfd_abort
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;
+extern FILE *real_fopen (const char *filename, const char *modes);
/* List of supported target vectors, and the default vector (if
bfd_default_vector[0] is NULL, there is no default). */
@@ -650,6 +711,34 @@ extern bfd_boolean _bfd_sh_align_load_span
bfd_boolean (*) (bfd *, asection *, void *, bfd_byte *, bfd_vma),
void *, bfd_vma **, bfd_vma *, bfd_vma, bfd_vma, bfd_boolean *);
#endif
+
+/* This is the shape of the elements inside the already_linked hash
+ table. It maps a name onto a list of already_linked elements with
+ the same name. */
+
+struct bfd_section_already_linked_hash_entry
+{
+ struct bfd_hash_entry root;
+ struct bfd_section_already_linked *entry;
+};
+
+struct bfd_section_already_linked
+{
+ struct bfd_section_already_linked *next;
+ asection *sec;
+};
+
+extern struct bfd_section_already_linked_hash_entry *
+ bfd_section_already_linked_table_lookup (const char *);
+extern void bfd_section_already_linked_table_insert
+ (struct bfd_section_already_linked_hash_entry *, asection *);
+extern void bfd_section_already_linked_table_traverse
+ (bfd_boolean (*) (struct bfd_section_already_linked_hash_entry *,
+ void *), void *);
+
+extern bfd_vma read_unsigned_leb128 (bfd *, bfd_byte *, unsigned int *);
+extern bfd_signed_vma read_signed_leb128 (bfd *, bfd_byte *, unsigned int *);
+
/* Extracted from init.c. */
/* Extracted from libbfd.c. */
bfd_boolean bfd_write_bigendian_4byte_int (bfd *, unsigned int);
@@ -657,6 +746,27 @@ bfd_boolean bfd_write_bigendian_4byte_int (bfd *, unsigned int);
unsigned int bfd_log2 (bfd_vma x);
/* Extracted from bfdio.c. */
+struct bfd_iovec
+{
+ /* To avoid problems with macros, a "b" rather than "f"
+ prefix is prepended to each method name. */
+ /* Attempt to read/write NBYTES on ABFD's IOSTREAM storing/fetching
+ bytes starting at PTR. Return the number of bytes actually
+ transfered (a read past end-of-file returns less than NBYTES),
+ or -1 (setting <<bfd_error>>) if an error occurs. */
+ file_ptr (*bread) (struct bfd *abfd, void *ptr, file_ptr nbytes);
+ file_ptr (*bwrite) (struct bfd *abfd, const void *ptr,
+ file_ptr nbytes);
+ /* Return the current IOSTREAM file offset, or -1 (setting <<bfd_error>>
+ if an error occurs. */
+ file_ptr (*btell) (struct bfd *abfd);
+ /* For the following, on successful completion a value of 0 is returned.
+ Otherwise, a value of -1 is returned (and <<bfd_error>> is set). */
+ int (*bseek) (struct bfd *abfd, file_ptr offset, int whence);
+ int (*bclose) (struct bfd *abfd);
+ int (*bflush) (struct bfd *abfd);
+ int (*bstat) (struct bfd *abfd, struct stat *sb);
+};
/* Extracted from bfdwin.c. */
struct _bfd_window_internal {
struct _bfd_window_internal *next;
@@ -666,21 +776,12 @@ struct _bfd_window_internal {
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
@@ -699,6 +800,7 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@",
"BFD_RELOC_16_PCREL",
"BFD_RELOC_12_PCREL",
"BFD_RELOC_8_PCREL",
+ "BFD_RELOC_32_SECREL",
"BFD_RELOC_32_GOT_PCREL",
"BFD_RELOC_16_GOT_PCREL",
"BFD_RELOC_8_GOT_PCREL",
@@ -805,6 +907,20 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@",
"BFD_RELOC_SPARC_TLS_DTPOFF64",
"BFD_RELOC_SPARC_TLS_TPOFF32",
"BFD_RELOC_SPARC_TLS_TPOFF64",
+ "BFD_RELOC_SPU_IMM7",
+ "BFD_RELOC_SPU_IMM8",
+ "BFD_RELOC_SPU_IMM10",
+ "BFD_RELOC_SPU_IMM10W",
+ "BFD_RELOC_SPU_IMM16",
+ "BFD_RELOC_SPU_IMM16W",
+ "BFD_RELOC_SPU_IMM18",
+ "BFD_RELOC_SPU_PCREL9a",
+ "BFD_RELOC_SPU_PCREL9b",
+ "BFD_RELOC_SPU_PCREL16",
+ "BFD_RELOC_SPU_LO16",
+ "BFD_RELOC_SPU_HI16",
+ "BFD_RELOC_SPU_PPU32",
+ "BFD_RELOC_SPU_PPU64",
"BFD_RELOC_ALPHA_GPDISP_HI16",
"BFD_RELOC_ALPHA_GPDISP_LO16",
"BFD_RELOC_ALPHA_GPDISP",
@@ -836,8 +952,12 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@",
"BFD_RELOC_HI16",
"BFD_RELOC_HI16_S",
"BFD_RELOC_LO16",
- "BFD_RELOC_PCREL_HI16_S",
- "BFD_RELOC_PCREL_LO16",
+ "BFD_RELOC_HI16_PCREL",
+ "BFD_RELOC_HI16_S_PCREL",
+ "BFD_RELOC_LO16_PCREL",
+ "BFD_RELOC_MIPS16_HI16",
+ "BFD_RELOC_MIPS16_HI16_S",
+ "BFD_RELOC_MIPS16_LO16",
"BFD_RELOC_MIPS_LITERAL",
"BFD_RELOC_MIPS_GOT16",
"BFD_RELOC_MIPS_CALL16",
@@ -860,6 +980,22 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@",
"BFD_RELOC_MIPS_REL16",
"BFD_RELOC_MIPS_RELGOT",
"BFD_RELOC_MIPS_JALR",
+ "BFD_RELOC_MIPS_TLS_DTPMOD32",
+ "BFD_RELOC_MIPS_TLS_DTPREL32",
+ "BFD_RELOC_MIPS_TLS_DTPMOD64",
+ "BFD_RELOC_MIPS_TLS_DTPREL64",
+ "BFD_RELOC_MIPS_TLS_GD",
+ "BFD_RELOC_MIPS_TLS_LDM",
+ "BFD_RELOC_MIPS_TLS_DTPREL_HI16",
+ "BFD_RELOC_MIPS_TLS_DTPREL_LO16",
+ "BFD_RELOC_MIPS_TLS_GOTTPREL",
+ "BFD_RELOC_MIPS_TLS_TPREL32",
+ "BFD_RELOC_MIPS_TLS_TPREL64",
+ "BFD_RELOC_MIPS_TLS_TPREL_HI16",
+ "BFD_RELOC_MIPS_TLS_TPREL_LO16",
+
+ "BFD_RELOC_MIPS_COPY",
+ "BFD_RELOC_MIPS_JUMP_SLOT",
"BFD_RELOC_FRV_LABEL16",
"BFD_RELOC_FRV_LABEL24",
@@ -884,6 +1020,22 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@",
"BFD_RELOC_FRV_GOTOFF12",
"BFD_RELOC_FRV_GOTOFFHI",
"BFD_RELOC_FRV_GOTOFFLO",
+ "BFD_RELOC_FRV_GETTLSOFF",
+ "BFD_RELOC_FRV_TLSDESC_VALUE",
+ "BFD_RELOC_FRV_GOTTLSDESC12",
+ "BFD_RELOC_FRV_GOTTLSDESCHI",
+ "BFD_RELOC_FRV_GOTTLSDESCLO",
+ "BFD_RELOC_FRV_TLSMOFF12",
+ "BFD_RELOC_FRV_TLSMOFFHI",
+ "BFD_RELOC_FRV_TLSMOFFLO",
+ "BFD_RELOC_FRV_GOTTLSOFF12",
+ "BFD_RELOC_FRV_GOTTLSOFFHI",
+ "BFD_RELOC_FRV_GOTTLSOFFLO",
+ "BFD_RELOC_FRV_TLSOFF",
+ "BFD_RELOC_FRV_TLSDESC_RELAX",
+ "BFD_RELOC_FRV_GETTLSOFF_RELAX",
+ "BFD_RELOC_FRV_TLSOFF_RELAX",
+ "BFD_RELOC_FRV_TLSMOFF",
"BFD_RELOC_MN10300_GOTOFF24",
"BFD_RELOC_MN10300_GOT32",
@@ -914,6 +1066,9 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@",
"BFD_RELOC_386_TLS_DTPMOD32",
"BFD_RELOC_386_TLS_DTPOFF32",
"BFD_RELOC_386_TLS_TPOFF32",
+ "BFD_RELOC_386_TLS_GOTDESC",
+ "BFD_RELOC_386_TLS_DESC_CALL",
+ "BFD_RELOC_386_TLS_DESC",
"BFD_RELOC_X86_64_GOT32",
"BFD_RELOC_X86_64_PLT32",
"BFD_RELOC_X86_64_COPY",
@@ -930,6 +1085,16 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@",
"BFD_RELOC_X86_64_DTPOFF32",
"BFD_RELOC_X86_64_GOTTPOFF",
"BFD_RELOC_X86_64_TPOFF32",
+ "BFD_RELOC_X86_64_GOTOFF64",
+ "BFD_RELOC_X86_64_GOTPC32",
+ "BFD_RELOC_X86_64_GOT64",
+ "BFD_RELOC_X86_64_GOTPCREL64",
+ "BFD_RELOC_X86_64_GOTPC64",
+ "BFD_RELOC_X86_64_GOTPLT64",
+ "BFD_RELOC_X86_64_PLTOFF64",
+ "BFD_RELOC_X86_64_GOTPC32_TLSDESC",
+ "BFD_RELOC_X86_64_TLSDESC_CALL",
+ "BFD_RELOC_X86_64_TLSDESC",
"BFD_RELOC_NS32K_IMM_8",
"BFD_RELOC_NS32K_IMM_16",
"BFD_RELOC_NS32K_IMM_32",
@@ -1048,35 +1213,107 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@",
"BFD_RELOC_ARM_PCREL_BRANCH",
"BFD_RELOC_ARM_PCREL_BLX",
"BFD_RELOC_THUMB_PCREL_BLX",
+ "BFD_RELOC_ARM_PCREL_CALL",
+ "BFD_RELOC_ARM_PCREL_JUMP",
+ "BFD_RELOC_THUMB_PCREL_BRANCH7",
+ "BFD_RELOC_THUMB_PCREL_BRANCH9",
+ "BFD_RELOC_THUMB_PCREL_BRANCH12",
+ "BFD_RELOC_THUMB_PCREL_BRANCH20",
+ "BFD_RELOC_THUMB_PCREL_BRANCH23",
+ "BFD_RELOC_THUMB_PCREL_BRANCH25",
+ "BFD_RELOC_ARM_OFFSET_IMM",
+ "BFD_RELOC_ARM_THUMB_OFFSET",
+ "BFD_RELOC_ARM_TARGET1",
+ "BFD_RELOC_ARM_ROSEGREL32",
+ "BFD_RELOC_ARM_SBREL32",
+ "BFD_RELOC_ARM_TARGET2",
+ "BFD_RELOC_ARM_PREL31",
+ "BFD_RELOC_ARM_MOVW",
+ "BFD_RELOC_ARM_MOVT",
+ "BFD_RELOC_ARM_MOVW_PCREL",
+ "BFD_RELOC_ARM_MOVT_PCREL",
+ "BFD_RELOC_ARM_THUMB_MOVW",
+ "BFD_RELOC_ARM_THUMB_MOVT",
+ "BFD_RELOC_ARM_THUMB_MOVW_PCREL",
+ "BFD_RELOC_ARM_THUMB_MOVT_PCREL",
+ "BFD_RELOC_ARM_JUMP_SLOT",
+ "BFD_RELOC_ARM_GLOB_DAT",
+ "BFD_RELOC_ARM_GOT32",
+ "BFD_RELOC_ARM_PLT32",
+ "BFD_RELOC_ARM_RELATIVE",
+ "BFD_RELOC_ARM_GOTOFF",
+ "BFD_RELOC_ARM_GOTPC",
+ "BFD_RELOC_ARM_TLS_GD32",
+ "BFD_RELOC_ARM_TLS_LDO32",
+ "BFD_RELOC_ARM_TLS_LDM32",
+ "BFD_RELOC_ARM_TLS_DTPOFF32",
+ "BFD_RELOC_ARM_TLS_DTPMOD32",
+ "BFD_RELOC_ARM_TLS_TPOFF32",
+ "BFD_RELOC_ARM_TLS_IE32",
+ "BFD_RELOC_ARM_TLS_LE32",
+ "BFD_RELOC_ARM_ALU_PC_G0_NC",
+ "BFD_RELOC_ARM_ALU_PC_G0",
+ "BFD_RELOC_ARM_ALU_PC_G1_NC",
+ "BFD_RELOC_ARM_ALU_PC_G1",
+ "BFD_RELOC_ARM_ALU_PC_G2",
+ "BFD_RELOC_ARM_LDR_PC_G0",
+ "BFD_RELOC_ARM_LDR_PC_G1",
+ "BFD_RELOC_ARM_LDR_PC_G2",
+ "BFD_RELOC_ARM_LDRS_PC_G0",
+ "BFD_RELOC_ARM_LDRS_PC_G1",
+ "BFD_RELOC_ARM_LDRS_PC_G2",
+ "BFD_RELOC_ARM_LDC_PC_G0",
+ "BFD_RELOC_ARM_LDC_PC_G1",
+ "BFD_RELOC_ARM_LDC_PC_G2",
+ "BFD_RELOC_ARM_ALU_SB_G0_NC",
+ "BFD_RELOC_ARM_ALU_SB_G0",
+ "BFD_RELOC_ARM_ALU_SB_G1_NC",
+ "BFD_RELOC_ARM_ALU_SB_G1",
+ "BFD_RELOC_ARM_ALU_SB_G2",
+ "BFD_RELOC_ARM_LDR_SB_G0",
+ "BFD_RELOC_ARM_LDR_SB_G1",
+ "BFD_RELOC_ARM_LDR_SB_G2",
+ "BFD_RELOC_ARM_LDRS_SB_G0",
+ "BFD_RELOC_ARM_LDRS_SB_G1",
+ "BFD_RELOC_ARM_LDRS_SB_G2",
+ "BFD_RELOC_ARM_LDC_SB_G0",
+ "BFD_RELOC_ARM_LDC_SB_G1",
+ "BFD_RELOC_ARM_LDC_SB_G2",
"BFD_RELOC_ARM_IMMEDIATE",
"BFD_RELOC_ARM_ADRL_IMMEDIATE",
- "BFD_RELOC_ARM_OFFSET_IMM",
+ "BFD_RELOC_ARM_T32_IMMEDIATE",
+ "BFD_RELOC_ARM_T32_ADD_IMM",
+ "BFD_RELOC_ARM_T32_IMM12",
+ "BFD_RELOC_ARM_T32_ADD_PC12",
"BFD_RELOC_ARM_SHIFT_IMM",
+ "BFD_RELOC_ARM_SMC",
"BFD_RELOC_ARM_SWI",
"BFD_RELOC_ARM_MULTI",
"BFD_RELOC_ARM_CP_OFF_IMM",
"BFD_RELOC_ARM_CP_OFF_IMM_S2",
+ "BFD_RELOC_ARM_T32_CP_OFF_IMM",
+ "BFD_RELOC_ARM_T32_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_T32_OFFSET_U8",
+ "BFD_RELOC_ARM_T32_OFFSET_IMM",
"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_IMM3",
+ "BFD_RELOC_SH_IMM3U",
+ "BFD_RELOC_SH_DISP12",
+ "BFD_RELOC_SH_DISP12BY2",
+ "BFD_RELOC_SH_DISP12BY4",
+ "BFD_RELOC_SH_DISP12BY8",
+ "BFD_RELOC_SH_DISP20",
+ "BFD_RELOC_SH_DISP20BY8",
"BFD_RELOC_SH_IMM4",
"BFD_RELOC_SH_IMM4BY2",
"BFD_RELOC_SH_IMM4BY4",
@@ -1157,11 +1394,55 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@",
"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_BFIN_16_IMM",
+ "BFD_RELOC_BFIN_16_HIGH",
+ "BFD_RELOC_BFIN_4_PCREL",
+ "BFD_RELOC_BFIN_5_PCREL",
+ "BFD_RELOC_BFIN_16_LOW",
+ "BFD_RELOC_BFIN_10_PCREL",
+ "BFD_RELOC_BFIN_11_PCREL",
+ "BFD_RELOC_BFIN_12_PCREL_JUMP",
+ "BFD_RELOC_BFIN_12_PCREL_JUMP_S",
+ "BFD_RELOC_BFIN_24_PCREL_CALL_X",
+ "BFD_RELOC_BFIN_24_PCREL_JUMP_L",
+ "BFD_RELOC_BFIN_GOT17M4",
+ "BFD_RELOC_BFIN_GOTHI",
+ "BFD_RELOC_BFIN_GOTLO",
+ "BFD_RELOC_BFIN_FUNCDESC",
+ "BFD_RELOC_BFIN_FUNCDESC_GOT17M4",
+ "BFD_RELOC_BFIN_FUNCDESC_GOTHI",
+ "BFD_RELOC_BFIN_FUNCDESC_GOTLO",
+ "BFD_RELOC_BFIN_FUNCDESC_VALUE",
+ "BFD_RELOC_BFIN_FUNCDESC_GOTOFF17M4",
+ "BFD_RELOC_BFIN_FUNCDESC_GOTOFFHI",
+ "BFD_RELOC_BFIN_FUNCDESC_GOTOFFLO",
+ "BFD_RELOC_BFIN_GOTOFF17M4",
+ "BFD_RELOC_BFIN_GOTOFFHI",
+ "BFD_RELOC_BFIN_GOTOFFLO",
+ "BFD_RELOC_BFIN_GOT",
+ "BFD_RELOC_BFIN_PLTPC",
+ "BFD_ARELOC_BFIN_PUSH",
+ "BFD_ARELOC_BFIN_CONST",
+ "BFD_ARELOC_BFIN_ADD",
+ "BFD_ARELOC_BFIN_SUB",
+ "BFD_ARELOC_BFIN_MULT",
+ "BFD_ARELOC_BFIN_DIV",
+ "BFD_ARELOC_BFIN_MOD",
+ "BFD_ARELOC_BFIN_LSHIFT",
+ "BFD_ARELOC_BFIN_RSHIFT",
+ "BFD_ARELOC_BFIN_AND",
+ "BFD_ARELOC_BFIN_OR",
+ "BFD_ARELOC_BFIN_XOR",
+ "BFD_ARELOC_BFIN_LAND",
+ "BFD_ARELOC_BFIN_LOR",
+ "BFD_ARELOC_BFIN_LEN",
+ "BFD_ARELOC_BFIN_NEG",
+ "BFD_ARELOC_BFIN_COMP",
+ "BFD_ARELOC_BFIN_PAGE",
+ "BFD_ARELOC_BFIN_HWPAGE",
+ "BFD_ARELOC_BFIN_ADDR",
"BFD_RELOC_D10V_10_PCREL_R",
"BFD_RELOC_D10V_10_PCREL_L",
"BFD_RELOC_D10V_18",
@@ -1180,6 +1461,10 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@",
"BFD_RELOC_DLX_HI16_S",
"BFD_RELOC_DLX_LO16",
"BFD_RELOC_DLX_JMP26",
+ "BFD_RELOC_M32C_HI8",
+ "BFD_RELOC_M32C_RL_JUMP",
+ "BFD_RELOC_M32C_RL_1ADDR",
+ "BFD_RELOC_M32C_RL_2ADDR",
"BFD_RELOC_M32R_24",
"BFD_RELOC_M32R_10_PCREL",
"BFD_RELOC_M32R_18_PCREL",
@@ -1195,6 +1480,9 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@",
"BFD_RELOC_M32R_JMP_SLOT",
"BFD_RELOC_M32R_RELATIVE",
"BFD_RELOC_M32R_GOTOFF",
+ "BFD_RELOC_M32R_GOTOFF_HI_ULO",
+ "BFD_RELOC_M32R_GOTOFF_HI_SLO",
+ "BFD_RELOC_M32R_GOTOFF_LO",
"BFD_RELOC_M32R_GOTPC24",
"BFD_RELOC_M32R_GOT16_HI_ULO",
"BFD_RELOC_M32R_GOT16_HI_SLO",
@@ -1221,6 +1509,7 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@",
"BFD_RELOC_V850_LONGCALL",
"BFD_RELOC_V850_LONGJUMP",
"BFD_RELOC_V850_ALIGN",
+ "BFD_RELOC_V850_LO16_SPLIT_OFFSET",
"BFD_RELOC_MN10300_32_PCREL",
"BFD_RELOC_MN10300_16_PCREL",
"BFD_RELOC_TIC30_LDP",
@@ -1243,6 +1532,27 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@",
"BFD_RELOC_MCORE_PCREL_32",
"BFD_RELOC_MCORE_PCREL_JSR_IMM11BY2",
"BFD_RELOC_MCORE_RVA",
+ "BFD_RELOC_MEP_8",
+ "BFD_RELOC_MEP_16",
+ "BFD_RELOC_MEP_32",
+ "BFD_RELOC_MEP_PCREL8A2",
+ "BFD_RELOC_MEP_PCREL12A2",
+ "BFD_RELOC_MEP_PCREL17A2",
+ "BFD_RELOC_MEP_PCREL24A2",
+ "BFD_RELOC_MEP_PCABS24A2",
+ "BFD_RELOC_MEP_LOW16",
+ "BFD_RELOC_MEP_HI16U",
+ "BFD_RELOC_MEP_HI16S",
+ "BFD_RELOC_MEP_GPREL",
+ "BFD_RELOC_MEP_TPREL",
+ "BFD_RELOC_MEP_TPREL7",
+ "BFD_RELOC_MEP_TPREL7A2",
+ "BFD_RELOC_MEP_TPREL7A4",
+ "BFD_RELOC_MEP_UIMM24",
+ "BFD_RELOC_MEP_ADDR24A4",
+ "BFD_RELOC_MEP_GNU_VTINHERIT",
+ "BFD_RELOC_MEP_GNU_VTENTRY",
+
"BFD_RELOC_MMIX_GETA",
"BFD_RELOC_MMIX_GETA_1",
"BFD_RELOC_MMIX_GETA_2",
@@ -1273,16 +1583,23 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@",
"BFD_RELOC_AVR_LO8_LDI",
"BFD_RELOC_AVR_HI8_LDI",
"BFD_RELOC_AVR_HH8_LDI",
+ "BFD_RELOC_AVR_MS8_LDI",
"BFD_RELOC_AVR_LO8_LDI_NEG",
"BFD_RELOC_AVR_HI8_LDI_NEG",
"BFD_RELOC_AVR_HH8_LDI_NEG",
+ "BFD_RELOC_AVR_MS8_LDI_NEG",
"BFD_RELOC_AVR_LO8_LDI_PM",
+ "BFD_RELOC_AVR_LO8_LDI_GS",
"BFD_RELOC_AVR_HI8_LDI_PM",
+ "BFD_RELOC_AVR_HI8_LDI_GS",
"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_AVR_LDI",
+ "BFD_RELOC_AVR_6",
+ "BFD_RELOC_AVR_6_ADIW",
"BFD_RELOC_390_12",
"BFD_RELOC_390_GOT12",
"BFD_RELOC_390_PLT32",
@@ -1333,6 +1650,17 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@",
"BFD_RELOC_390_GOT20",
"BFD_RELOC_390_GOTPLT20",
"BFD_RELOC_390_TLS_GOTIE20",
+ "BFD_RELOC_SCORE_DUMMY1",
+ "BFD_RELOC_SCORE_GPREL15",
+ "BFD_RELOC_SCORE_DUMMY2",
+ "BFD_RELOC_SCORE_JMP",
+ "BFD_RELOC_SCORE_BRANCH",
+ "BFD_RELOC_SCORE16_JMP",
+ "BFD_RELOC_SCORE16_BRANCH",
+ "BFD_RELOC_SCORE_GOT15",
+ "BFD_RELOC_SCORE_GOT_LO16",
+ "BFD_RELOC_SCORE_CALL15",
+ "BFD_RELOC_SCORE_DUMMY_HI16",
"BFD_RELOC_IP2K_FR9",
"BFD_RELOC_IP2K_BANK",
"BFD_RELOC_IP2K_ADDR16CJP",
@@ -1437,10 +1765,102 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@",
"BFD_RELOC_M68HC11_PAGE",
"BFD_RELOC_M68HC11_24",
"BFD_RELOC_M68HC12_5B",
+ "BFD_RELOC_16C_NUM08",
+ "BFD_RELOC_16C_NUM08_C",
+ "BFD_RELOC_16C_NUM16",
+ "BFD_RELOC_16C_NUM16_C",
+ "BFD_RELOC_16C_NUM32",
+ "BFD_RELOC_16C_NUM32_C",
+ "BFD_RELOC_16C_DISP04",
+ "BFD_RELOC_16C_DISP04_C",
+ "BFD_RELOC_16C_DISP08",
+ "BFD_RELOC_16C_DISP08_C",
+ "BFD_RELOC_16C_DISP16",
+ "BFD_RELOC_16C_DISP16_C",
+ "BFD_RELOC_16C_DISP24",
+ "BFD_RELOC_16C_DISP24_C",
+ "BFD_RELOC_16C_DISP24a",
+ "BFD_RELOC_16C_DISP24a_C",
+ "BFD_RELOC_16C_REG04",
+ "BFD_RELOC_16C_REG04_C",
+ "BFD_RELOC_16C_REG04a",
+ "BFD_RELOC_16C_REG04a_C",
+ "BFD_RELOC_16C_REG14",
+ "BFD_RELOC_16C_REG14_C",
+ "BFD_RELOC_16C_REG16",
+ "BFD_RELOC_16C_REG16_C",
+ "BFD_RELOC_16C_REG20",
+ "BFD_RELOC_16C_REG20_C",
+ "BFD_RELOC_16C_ABS20",
+ "BFD_RELOC_16C_ABS20_C",
+ "BFD_RELOC_16C_ABS24",
+ "BFD_RELOC_16C_ABS24_C",
+ "BFD_RELOC_16C_IMM04",
+ "BFD_RELOC_16C_IMM04_C",
+ "BFD_RELOC_16C_IMM16",
+ "BFD_RELOC_16C_IMM16_C",
+ "BFD_RELOC_16C_IMM20",
+ "BFD_RELOC_16C_IMM20_C",
+ "BFD_RELOC_16C_IMM24",
+ "BFD_RELOC_16C_IMM24_C",
+ "BFD_RELOC_16C_IMM32",
+ "BFD_RELOC_16C_IMM32_C",
+ "BFD_RELOC_CR16_NUM8",
+ "BFD_RELOC_CR16_NUM16",
+ "BFD_RELOC_CR16_NUM32",
+ "BFD_RELOC_CR16_NUM32a",
+ "BFD_RELOC_CR16_REGREL0",
+ "BFD_RELOC_CR16_REGREL4",
+ "BFD_RELOC_CR16_REGREL4a",
+ "BFD_RELOC_CR16_REGREL14",
+ "BFD_RELOC_CR16_REGREL14a",
+ "BFD_RELOC_CR16_REGREL16",
+ "BFD_RELOC_CR16_REGREL20",
+ "BFD_RELOC_CR16_REGREL20a",
+ "BFD_RELOC_CR16_ABS20",
+ "BFD_RELOC_CR16_ABS24",
+ "BFD_RELOC_CR16_IMM4",
+ "BFD_RELOC_CR16_IMM8",
+ "BFD_RELOC_CR16_IMM16",
+ "BFD_RELOC_CR16_IMM20",
+ "BFD_RELOC_CR16_IMM24",
+ "BFD_RELOC_CR16_IMM32",
+ "BFD_RELOC_CR16_IMM32a",
+ "BFD_RELOC_CR16_DISP4",
+ "BFD_RELOC_CR16_DISP8",
+ "BFD_RELOC_CR16_DISP16",
+ "BFD_RELOC_CR16_DISP20",
+ "BFD_RELOC_CR16_DISP24",
+ "BFD_RELOC_CR16_DISP24a",
+ "BFD_RELOC_CRX_REL4",
+ "BFD_RELOC_CRX_REL8",
+ "BFD_RELOC_CRX_REL8_CMP",
+ "BFD_RELOC_CRX_REL16",
+ "BFD_RELOC_CRX_REL24",
+ "BFD_RELOC_CRX_REL32",
+ "BFD_RELOC_CRX_REGREL12",
+ "BFD_RELOC_CRX_REGREL22",
+ "BFD_RELOC_CRX_REGREL28",
+ "BFD_RELOC_CRX_REGREL32",
+ "BFD_RELOC_CRX_ABS16",
+ "BFD_RELOC_CRX_ABS32",
+ "BFD_RELOC_CRX_NUM8",
+ "BFD_RELOC_CRX_NUM16",
+ "BFD_RELOC_CRX_NUM32",
+ "BFD_RELOC_CRX_IMM16",
+ "BFD_RELOC_CRX_IMM32",
+ "BFD_RELOC_CRX_SWITCH8",
+ "BFD_RELOC_CRX_SWITCH16",
+ "BFD_RELOC_CRX_SWITCH32",
"BFD_RELOC_CRIS_BDISP8",
"BFD_RELOC_CRIS_UNSIGNED_5",
"BFD_RELOC_CRIS_SIGNED_6",
"BFD_RELOC_CRIS_UNSIGNED_6",
+ "BFD_RELOC_CRIS_SIGNED_8",
+ "BFD_RELOC_CRIS_UNSIGNED_8",
+ "BFD_RELOC_CRIS_SIGNED_16",
+ "BFD_RELOC_CRIS_UNSIGNED_16",
+ "BFD_RELOC_CRIS_LAPCQ_OFFSET",
"BFD_RELOC_CRIS_UNSIGNED_4",
"BFD_RELOC_CRIS_COPY",
"BFD_RELOC_CRIS_GLOB_DAT",
@@ -1496,14 +1916,28 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@",
"BFD_RELOC_XSTORMY16_12",
"BFD_RELOC_XSTORMY16_24",
"BFD_RELOC_XSTORMY16_FPTR16",
+ "BFD_RELOC_RELC",
+
+ "BFD_RELOC_XC16X_PAG",
+ "BFD_RELOC_XC16X_POF",
+ "BFD_RELOC_XC16X_SEG",
+ "BFD_RELOC_XC16X_SOF",
"BFD_RELOC_VAX_GLOB_DAT",
"BFD_RELOC_VAX_JMP_SLOT",
"BFD_RELOC_VAX_RELATIVE",
+ "BFD_RELOC_MT_PC16",
+ "BFD_RELOC_MT_HI16",
+ "BFD_RELOC_MT_LO16",
+ "BFD_RELOC_MT_GNU_VTINHERIT",
+ "BFD_RELOC_MT_GNU_VTENTRY",
+ "BFD_RELOC_MT_PCINSN8",
"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_MSP430_2X_PCREL",
+ "BFD_RELOC_MSP430_RL_PCREL",
"BFD_RELOC_IQ2000_OFFSET_16",
"BFD_RELOC_IQ2000_OFFSET_21",
"BFD_RELOC_IQ2000_UHI16",
@@ -1512,11 +1946,48 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@",
"BFD_RELOC_XTENSA_JMP_SLOT",
"BFD_RELOC_XTENSA_RELATIVE",
"BFD_RELOC_XTENSA_PLT",
+ "BFD_RELOC_XTENSA_DIFF8",
+ "BFD_RELOC_XTENSA_DIFF16",
+ "BFD_RELOC_XTENSA_DIFF32",
+ "BFD_RELOC_XTENSA_SLOT0_OP",
+ "BFD_RELOC_XTENSA_SLOT1_OP",
+ "BFD_RELOC_XTENSA_SLOT2_OP",
+ "BFD_RELOC_XTENSA_SLOT3_OP",
+ "BFD_RELOC_XTENSA_SLOT4_OP",
+ "BFD_RELOC_XTENSA_SLOT5_OP",
+ "BFD_RELOC_XTENSA_SLOT6_OP",
+ "BFD_RELOC_XTENSA_SLOT7_OP",
+ "BFD_RELOC_XTENSA_SLOT8_OP",
+ "BFD_RELOC_XTENSA_SLOT9_OP",
+ "BFD_RELOC_XTENSA_SLOT10_OP",
+ "BFD_RELOC_XTENSA_SLOT11_OP",
+ "BFD_RELOC_XTENSA_SLOT12_OP",
+ "BFD_RELOC_XTENSA_SLOT13_OP",
+ "BFD_RELOC_XTENSA_SLOT14_OP",
+ "BFD_RELOC_XTENSA_SLOT0_ALT",
+ "BFD_RELOC_XTENSA_SLOT1_ALT",
+ "BFD_RELOC_XTENSA_SLOT2_ALT",
+ "BFD_RELOC_XTENSA_SLOT3_ALT",
+ "BFD_RELOC_XTENSA_SLOT4_ALT",
+ "BFD_RELOC_XTENSA_SLOT5_ALT",
+ "BFD_RELOC_XTENSA_SLOT6_ALT",
+ "BFD_RELOC_XTENSA_SLOT7_ALT",
+ "BFD_RELOC_XTENSA_SLOT8_ALT",
+ "BFD_RELOC_XTENSA_SLOT9_ALT",
+ "BFD_RELOC_XTENSA_SLOT10_ALT",
+ "BFD_RELOC_XTENSA_SLOT11_ALT",
+ "BFD_RELOC_XTENSA_SLOT12_ALT",
+ "BFD_RELOC_XTENSA_SLOT13_ALT",
+ "BFD_RELOC_XTENSA_SLOT14_ALT",
"BFD_RELOC_XTENSA_OP0",
"BFD_RELOC_XTENSA_OP1",
"BFD_RELOC_XTENSA_OP2",
"BFD_RELOC_XTENSA_ASM_EXPAND",
"BFD_RELOC_XTENSA_ASM_SIMPLIFY",
+ "BFD_RELOC_Z80_DISP8",
+ "BFD_RELOC_Z8K_DISP7",
+ "BFD_RELOC_Z8K_CALLR",
+ "BFD_RELOC_Z8K_IMM4L",
"@@overflow: BFD_RELOC_UNUSED@@",
};
#endif
diff --git a/contrib/binutils/bfd/libcoff-in.h b/contrib/binutils/bfd/libcoff-in.h
index 6b5947c..fdb1a59 100644
--- a/contrib/binutils/bfd/libcoff-in.h
+++ b/contrib/binutils/bfd/libcoff-in.h
@@ -1,55 +1,52 @@
/* BFD COFF object file private structure.
Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
- 2000, 2001, 2002, 2003
+ 2000, 2001, 2002, 2003, 2004, 2005, 2006
Free Software Foundation, Inc.
Written by Cygnus Support.
-This file is part of BFD, the Binary File Descriptor library.
+ 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 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.
+ 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. */
+ 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., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, 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)
+/* 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)
+#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 */
+ struct coff_symbol_struct *symbols; /* Symtab for input bfd. */
unsigned int *conversion_table;
int conv_table_size;
file_ptr sym_filepos;
@@ -57,7 +54,7 @@ typedef struct coff_tdata
struct coff_ptr_struct *raw_syments;
unsigned long raw_syment_count;
- /* These are only valid once writing has begun */
+ /* These are only valid once writing has begun. */
long int relocbase;
/* These members communicate important constants about the symbol table
@@ -73,7 +70,7 @@ typedef struct coff_tdata
/* The unswapped external symbols. May be NULL. Read by
_bfd_coff_get_external_symbols. */
- PTR external_syms;
+ void * external_syms;
/* If this is TRUE, the external_syms may not be freed. */
bfd_boolean keep_syms;
@@ -85,21 +82,21 @@ typedef struct coff_tdata
/* If this is TRUE, the strings have been written out already. */
bfd_boolean strings_written;
- /* is this a PE format coff file */
+ /* 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 */
+ /* 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;
+ void * line_info;
- /* A place to stash dwarf2 info for this bfd. */
- PTR dwarf2_find_line_info;
+ /* A place to stash dwarf2 info for this bfd. */
+ void * dwarf2_find_line_info;
/* The timestamp from the COFF file header. */
long timestamp;
@@ -110,14 +107,14 @@ typedef struct coff_tdata
} coff_data_type;
-/* Tdata for pe image files. */
+/* 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 *));
+ bfd_boolean (*in_reloc_p) (bfd *, reloc_howto_type *);
flagword real_flags;
int target_subsystem;
bfd_boolean force_minimum_alignment;
@@ -174,7 +171,7 @@ struct xcoff_tdata
#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. */
+ 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
@@ -194,11 +191,13 @@ struct coff_section_tdata
bfd_vma offset;
unsigned int i;
const char *function;
+ /* Optional information about a COMDAT entry; NULL if not COMDAT. */
+ struct coff_comdat_info *comdat;
int line_base;
/* A pointer used for .stab linking optimizations. */
- PTR stab_info;
+ void * stab_info;
/* Available for individual backends. */
- PTR tdata;
+ void * tdata;
};
/* An accessor macro for the coff_section_tdata structure. */
@@ -276,7 +275,7 @@ struct coff_link_hash_table
{
struct bfd_link_hash_table root;
/* A pointer to information used to link stabs in sections. */
- PTR stab_info;
+ struct stab_info stab_info;
};
/* Look up an entry in a COFF linker hash table. */
@@ -291,7 +290,7 @@ struct coff_link_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), \
+ (bfd_boolean (*) (struct bfd_link_hash_entry *, void *)) (func), \
(info)))
/* Get the COFF linker hash table from a link_info structure. */
@@ -300,67 +299,69 @@ struct coff_link_hash_table
/* Functions in coffgen.c. */
extern const bfd_target *coff_object_p
- PARAMS ((bfd *));
+ (bfd *);
extern struct bfd_section *coff_section_from_bfd_index
- PARAMS ((bfd *, int));
+ (bfd *, int);
extern long coff_get_symtab_upper_bound
- PARAMS ((bfd *));
+ (bfd *);
extern long coff_canonicalize_symtab
- PARAMS ((bfd *, asymbol **));
+ (bfd *, asymbol **);
extern int coff_count_linenumbers
- PARAMS ((bfd *));
+ (bfd *);
extern struct coff_symbol_struct *coff_symbol_from
- PARAMS ((bfd *, asymbol *));
+ (bfd *, asymbol *);
extern bfd_boolean coff_renumber_symbols
- PARAMS ((bfd *, int *));
+ (bfd *, int *);
extern void coff_mangle_symbols
- PARAMS ((bfd *));
+ (bfd *);
extern bfd_boolean coff_write_symbols
- PARAMS ((bfd *));
+ (bfd *);
extern bfd_boolean coff_write_linenumbers
- PARAMS ((bfd *));
+ (bfd *);
extern alent *coff_get_lineno
- PARAMS ((bfd *, asymbol *));
+ (bfd *, asymbol *);
extern asymbol *coff_section_symbol
- PARAMS ((bfd *, char *));
+ (bfd *, char *);
extern bfd_boolean _bfd_coff_get_external_symbols
- PARAMS ((bfd *));
+ (bfd *);
extern const char *_bfd_coff_read_string_table
- PARAMS ((bfd *));
+ (bfd *);
extern bfd_boolean _bfd_coff_free_symbols
- PARAMS ((bfd *));
+ (bfd *);
extern struct coff_ptr_struct *coff_get_normalized_symtab
- PARAMS ((bfd *));
+ (bfd *);
extern long coff_get_reloc_upper_bound
- PARAMS ((bfd *, sec_ptr));
+ (bfd *, sec_ptr);
extern asymbol *coff_make_empty_symbol
- PARAMS ((bfd *));
+ (bfd *);
extern void coff_print_symbol
- PARAMS ((bfd *, PTR filep, asymbol *, bfd_print_symbol_type));
+ (bfd *, void * filep, asymbol *, bfd_print_symbol_type);
extern void coff_get_symbol_info
- PARAMS ((bfd *, asymbol *, symbol_info *ret));
+ (bfd *, asymbol *, symbol_info *ret);
extern bfd_boolean _bfd_coff_is_local_label_name
- PARAMS ((bfd *, const char *));
+ (bfd *, const char *);
extern asymbol *coff_bfd_make_debug_symbol
- PARAMS ((bfd *, PTR, unsigned long));
+ (bfd *, void *, unsigned long);
extern bfd_boolean coff_find_nearest_line
- PARAMS ((bfd *, asection *, asymbol **, bfd_vma, const char **,
- const char **, unsigned int *));
+ (bfd *, asection *, asymbol **, bfd_vma, const char **,
+ const char **, unsigned int *);
+extern bfd_boolean coff_find_inliner_info
+ (bfd *, const char **, const char **, unsigned int *);
extern int coff_sizeof_headers
- PARAMS ((bfd *, bfd_boolean));
+ (bfd *, struct bfd_link_info *);
extern bfd_boolean bfd_coff_reloc16_relax_section
- PARAMS ((bfd *, asection *, struct bfd_link_info *, bfd_boolean *));
+ (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 **));
+ (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 *));
+ (arelent *, struct bfd_link_info *, asection *);
extern void bfd_perform_slip
- PARAMS ((bfd *, unsigned int, asection *, bfd_vma));
+ (bfd *, unsigned int, asection *, bfd_vma);
/* Functions and types in cofflink.c. */
-#define STRING_SIZE_SIZE (4)
+#define STRING_SIZE_SIZE 4
/* We use a hash table to merge identical enum, struct, and union
definitions in the linker. */
@@ -420,7 +421,8 @@ struct coff_debug_merge_hash_table
/* 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))
+ (bfd_hash_table_init (&(table)->root, _bfd_coff_debug_merge_hash_newfunc, \
+ sizeof (struct coff_debug_merge_hash_entry)))
/* Free a COFF debug merge hash table. */
@@ -531,38 +533,38 @@ struct coff_section_alignment_entry
};
extern struct bfd_hash_entry *_bfd_coff_link_hash_newfunc
- PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, const char *));
+ (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 *)));
+ (struct coff_link_hash_table *, bfd *,
+ struct bfd_hash_entry *(*) (struct bfd_hash_entry *,
+ struct bfd_hash_table *,
+ const char *),
+ unsigned int);
extern struct bfd_link_hash_table *_bfd_coff_link_hash_table_create
- PARAMS ((bfd *));
+ (bfd *);
extern const char *_bfd_coff_internal_syment_name
- PARAMS ((bfd *, const struct internal_syment *, char *));
+ (bfd *, const struct internal_syment *, char *);
extern bfd_boolean _bfd_coff_link_add_symbols
- PARAMS ((bfd *, struct bfd_link_info *));
+ (bfd *, struct bfd_link_info *);
extern bfd_boolean _bfd_coff_final_link
- PARAMS ((bfd *, struct bfd_link_info *));
+ (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 *));
+ (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 **));
-
+ (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 *));
+ (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));
+ (struct coff_link_hash_entry *, void *);
extern bfd_boolean _bfd_coff_write_task_globals
- PARAMS ((struct coff_link_hash_entry *, PTR));
+ (struct coff_link_hash_entry *, void *);
extern bfd_boolean _bfd_coff_link_input_bfd
- PARAMS ((struct coff_final_link_info *, bfd *));
+ (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 *));
+ (bfd *, struct coff_final_link_info *, asection *,
+ struct bfd_link_order *);
#define coff_get_section_contents_in_window \
@@ -571,30 +573,30 @@ extern bfd_boolean _bfd_coff_reloc_link_order
/* Functions in xcofflink.c. */
extern long _bfd_xcoff_get_dynamic_symtab_upper_bound
- PARAMS ((bfd *));
+ (bfd *);
extern long _bfd_xcoff_canonicalize_dynamic_symtab
- PARAMS ((bfd *, asymbol **));
+ (bfd *, asymbol **);
extern long _bfd_xcoff_get_dynamic_reloc_upper_bound
- PARAMS ((bfd *));
+ (bfd *);
extern long _bfd_xcoff_canonicalize_dynamic_reloc
- PARAMS ((bfd *, arelent **, asymbol **));
+ (bfd *, arelent **, asymbol **);
extern struct bfd_link_hash_table *_bfd_xcoff_bfd_link_hash_table_create
- PARAMS ((bfd *));
+ (bfd *);
extern void _bfd_xcoff_bfd_link_hash_table_free
- PARAMS ((struct bfd_link_hash_table *));
+ (struct bfd_link_hash_table *);
extern bfd_boolean _bfd_xcoff_bfd_link_add_symbols
- PARAMS ((bfd *, struct bfd_link_info *));
+ (bfd *, struct bfd_link_info *);
extern bfd_boolean _bfd_xcoff_bfd_final_link
- PARAMS ((bfd *, struct bfd_link_info *));
+ (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 **));
+ (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 *));
+ (struct bfd_link_info *);
extern bfd_boolean ppc_process_before_allocation
- PARAMS ((bfd *, struct bfd_link_info *));
+ (bfd *, struct bfd_link_info *);
diff --git a/contrib/binutils/bfd/libcoff.h b/contrib/binutils/bfd/libcoff.h
index 5771132..e26fce0 100644
--- a/contrib/binutils/bfd/libcoff.h
+++ b/contrib/binutils/bfd/libcoff.h
@@ -4,56 +4,53 @@
/* BFD COFF object file private structure.
Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
- 2000, 2001, 2002, 2003
+ 2000, 2001, 2002, 2003, 2004, 2005, 2006
Free Software Foundation, Inc.
Written by Cygnus Support.
-This file is part of BFD, the Binary File Descriptor library.
+ 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 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.
+ 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. */
+ 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., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, 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)
+/* 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)
+#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 */
+ struct coff_symbol_struct *symbols; /* Symtab for input bfd. */
unsigned int *conversion_table;
int conv_table_size;
file_ptr sym_filepos;
@@ -61,7 +58,7 @@ typedef struct coff_tdata
struct coff_ptr_struct *raw_syments;
unsigned long raw_syment_count;
- /* These are only valid once writing has begun */
+ /* These are only valid once writing has begun. */
long int relocbase;
/* These members communicate important constants about the symbol table
@@ -77,7 +74,7 @@ typedef struct coff_tdata
/* The unswapped external symbols. May be NULL. Read by
_bfd_coff_get_external_symbols. */
- PTR external_syms;
+ void * external_syms;
/* If this is TRUE, the external_syms may not be freed. */
bfd_boolean keep_syms;
@@ -89,21 +86,21 @@ typedef struct coff_tdata
/* If this is TRUE, the strings have been written out already. */
bfd_boolean strings_written;
- /* is this a PE format coff file */
+ /* 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 */
+ /* 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;
+ void * line_info;
- /* A place to stash dwarf2 info for this bfd. */
- PTR dwarf2_find_line_info;
+ /* A place to stash dwarf2 info for this bfd. */
+ void * dwarf2_find_line_info;
/* The timestamp from the COFF file header. */
long timestamp;
@@ -114,14 +111,14 @@ typedef struct coff_tdata
} coff_data_type;
-/* Tdata for pe image files. */
+/* 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 *));
+ bfd_boolean (*in_reloc_p) (bfd *, reloc_howto_type *);
flagword real_flags;
int target_subsystem;
bfd_boolean force_minimum_alignment;
@@ -178,7 +175,7 @@ struct xcoff_tdata
#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. */
+ 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
@@ -198,11 +195,13 @@ struct coff_section_tdata
bfd_vma offset;
unsigned int i;
const char *function;
+ /* Optional information about a COMDAT entry; NULL if not COMDAT. */
+ struct coff_comdat_info *comdat;
int line_base;
/* A pointer used for .stab linking optimizations. */
- PTR stab_info;
+ void * stab_info;
/* Available for individual backends. */
- PTR tdata;
+ void * tdata;
};
/* An accessor macro for the coff_section_tdata structure. */
@@ -280,7 +279,7 @@ struct coff_link_hash_table
{
struct bfd_link_hash_table root;
/* A pointer to information used to link stabs in sections. */
- PTR stab_info;
+ struct stab_info stab_info;
};
/* Look up an entry in a COFF linker hash table. */
@@ -295,7 +294,7 @@ struct coff_link_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), \
+ (bfd_boolean (*) (struct bfd_link_hash_entry *, void *)) (func), \
(info)))
/* Get the COFF linker hash table from a link_info structure. */
@@ -304,67 +303,69 @@ struct coff_link_hash_table
/* Functions in coffgen.c. */
extern const bfd_target *coff_object_p
- PARAMS ((bfd *));
+ (bfd *);
extern struct bfd_section *coff_section_from_bfd_index
- PARAMS ((bfd *, int));
+ (bfd *, int);
extern long coff_get_symtab_upper_bound
- PARAMS ((bfd *));
+ (bfd *);
extern long coff_canonicalize_symtab
- PARAMS ((bfd *, asymbol **));
+ (bfd *, asymbol **);
extern int coff_count_linenumbers
- PARAMS ((bfd *));
+ (bfd *);
extern struct coff_symbol_struct *coff_symbol_from
- PARAMS ((bfd *, asymbol *));
+ (bfd *, asymbol *);
extern bfd_boolean coff_renumber_symbols
- PARAMS ((bfd *, int *));
+ (bfd *, int *);
extern void coff_mangle_symbols
- PARAMS ((bfd *));
+ (bfd *);
extern bfd_boolean coff_write_symbols
- PARAMS ((bfd *));
+ (bfd *);
extern bfd_boolean coff_write_linenumbers
- PARAMS ((bfd *));
+ (bfd *);
extern alent *coff_get_lineno
- PARAMS ((bfd *, asymbol *));
+ (bfd *, asymbol *);
extern asymbol *coff_section_symbol
- PARAMS ((bfd *, char *));
+ (bfd *, char *);
extern bfd_boolean _bfd_coff_get_external_symbols
- PARAMS ((bfd *));
+ (bfd *);
extern const char *_bfd_coff_read_string_table
- PARAMS ((bfd *));
+ (bfd *);
extern bfd_boolean _bfd_coff_free_symbols
- PARAMS ((bfd *));
+ (bfd *);
extern struct coff_ptr_struct *coff_get_normalized_symtab
- PARAMS ((bfd *));
+ (bfd *);
extern long coff_get_reloc_upper_bound
- PARAMS ((bfd *, sec_ptr));
+ (bfd *, sec_ptr);
extern asymbol *coff_make_empty_symbol
- PARAMS ((bfd *));
+ (bfd *);
extern void coff_print_symbol
- PARAMS ((bfd *, PTR filep, asymbol *, bfd_print_symbol_type));
+ (bfd *, void * filep, asymbol *, bfd_print_symbol_type);
extern void coff_get_symbol_info
- PARAMS ((bfd *, asymbol *, symbol_info *ret));
+ (bfd *, asymbol *, symbol_info *ret);
extern bfd_boolean _bfd_coff_is_local_label_name
- PARAMS ((bfd *, const char *));
+ (bfd *, const char *);
extern asymbol *coff_bfd_make_debug_symbol
- PARAMS ((bfd *, PTR, unsigned long));
+ (bfd *, void *, unsigned long);
extern bfd_boolean coff_find_nearest_line
- PARAMS ((bfd *, asection *, asymbol **, bfd_vma, const char **,
- const char **, unsigned int *));
+ (bfd *, asection *, asymbol **, bfd_vma, const char **,
+ const char **, unsigned int *);
+extern bfd_boolean coff_find_inliner_info
+ (bfd *, const char **, const char **, unsigned int *);
extern int coff_sizeof_headers
- PARAMS ((bfd *, bfd_boolean));
+ (bfd *, struct bfd_link_info *);
extern bfd_boolean bfd_coff_reloc16_relax_section
- PARAMS ((bfd *, asection *, struct bfd_link_info *, bfd_boolean *));
+ (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 **));
+ (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 *));
+ (arelent *, struct bfd_link_info *, asection *);
extern void bfd_perform_slip
- PARAMS ((bfd *, unsigned int, asection *, bfd_vma));
+ (bfd *, unsigned int, asection *, bfd_vma);
/* Functions and types in cofflink.c. */
-#define STRING_SIZE_SIZE (4)
+#define STRING_SIZE_SIZE 4
/* We use a hash table to merge identical enum, struct, and union
definitions in the linker. */
@@ -424,7 +425,8 @@ struct coff_debug_merge_hash_table
/* 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))
+ (bfd_hash_table_init (&(table)->root, _bfd_coff_debug_merge_hash_newfunc, \
+ sizeof (struct coff_debug_merge_hash_entry)))
/* Free a COFF debug merge hash table. */
@@ -535,38 +537,38 @@ struct coff_section_alignment_entry
};
extern struct bfd_hash_entry *_bfd_coff_link_hash_newfunc
- PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, const char *));
+ (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 *)));
+ (struct coff_link_hash_table *, bfd *,
+ struct bfd_hash_entry *(*) (struct bfd_hash_entry *,
+ struct bfd_hash_table *,
+ const char *),
+ unsigned int);
extern struct bfd_link_hash_table *_bfd_coff_link_hash_table_create
- PARAMS ((bfd *));
+ (bfd *);
extern const char *_bfd_coff_internal_syment_name
- PARAMS ((bfd *, const struct internal_syment *, char *));
+ (bfd *, const struct internal_syment *, char *);
extern bfd_boolean _bfd_coff_link_add_symbols
- PARAMS ((bfd *, struct bfd_link_info *));
+ (bfd *, struct bfd_link_info *);
extern bfd_boolean _bfd_coff_final_link
- PARAMS ((bfd *, struct bfd_link_info *));
+ (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 *));
+ (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 **));
-
+ (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 *));
+ (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));
+ (struct coff_link_hash_entry *, void *);
extern bfd_boolean _bfd_coff_write_task_globals
- PARAMS ((struct coff_link_hash_entry *, PTR));
+ (struct coff_link_hash_entry *, void *);
extern bfd_boolean _bfd_coff_link_input_bfd
- PARAMS ((struct coff_final_link_info *, bfd *));
+ (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 *));
+ (bfd *, struct coff_final_link_info *, asection *,
+ struct bfd_link_order *);
#define coff_get_section_contents_in_window \
@@ -575,32 +577,32 @@ extern bfd_boolean _bfd_coff_reloc_link_order
/* Functions in xcofflink.c. */
extern long _bfd_xcoff_get_dynamic_symtab_upper_bound
- PARAMS ((bfd *));
+ (bfd *);
extern long _bfd_xcoff_canonicalize_dynamic_symtab
- PARAMS ((bfd *, asymbol **));
+ (bfd *, asymbol **);
extern long _bfd_xcoff_get_dynamic_reloc_upper_bound
- PARAMS ((bfd *));
+ (bfd *);
extern long _bfd_xcoff_canonicalize_dynamic_reloc
- PARAMS ((bfd *, arelent **, asymbol **));
+ (bfd *, arelent **, asymbol **);
extern struct bfd_link_hash_table *_bfd_xcoff_bfd_link_hash_table_create
- PARAMS ((bfd *));
+ (bfd *);
extern void _bfd_xcoff_bfd_link_hash_table_free
- PARAMS ((struct bfd_link_hash_table *));
+ (struct bfd_link_hash_table *);
extern bfd_boolean _bfd_xcoff_bfd_link_add_symbols
- PARAMS ((bfd *, struct bfd_link_info *));
+ (bfd *, struct bfd_link_info *);
extern bfd_boolean _bfd_xcoff_bfd_final_link
- PARAMS ((bfd *, struct bfd_link_info *));
+ (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 **));
+ (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 *));
+ (struct bfd_link_info *);
extern bfd_boolean ppc_process_before_allocation
- PARAMS ((bfd *, struct bfd_link_info *));
+ (bfd *, struct bfd_link_info *);
/* Extracted from coffcode.h. */
typedef struct coff_ptr_struct
@@ -674,34 +676,34 @@ enum coff_symbol_classification
typedef struct
{
void (*_bfd_coff_swap_aux_in)
- PARAMS ((bfd *, PTR, int, int, int, int, PTR));
+ (bfd *, void *, int, int, int, int, void *);
void (*_bfd_coff_swap_sym_in)
- PARAMS ((bfd *, PTR, PTR));
+ (bfd *, void *, void *);
void (*_bfd_coff_swap_lineno_in)
- PARAMS ((bfd *, PTR, PTR));
+ (bfd *, void *, void *);
unsigned int (*_bfd_coff_swap_aux_out)
- PARAMS ((bfd *, PTR, int, int, int, int, PTR));
+ (bfd *, void *, int, int, int, int, void *);
unsigned int (*_bfd_coff_swap_sym_out)
- PARAMS ((bfd *, PTR, PTR));
+ (bfd *, void *, void *);
unsigned int (*_bfd_coff_swap_lineno_out)
- PARAMS ((bfd *, PTR, PTR));
+ (bfd *, void *, void *);
unsigned int (*_bfd_coff_swap_reloc_out)
- PARAMS ((bfd *, PTR, PTR));
+ (bfd *, void *, void *);
unsigned int (*_bfd_coff_swap_filehdr_out)
- PARAMS ((bfd *, PTR, PTR));
+ (bfd *, void *, void *);
unsigned int (*_bfd_coff_swap_aouthdr_out)
- PARAMS ((bfd *, PTR, PTR));
+ (bfd *, void *, void *);
unsigned int (*_bfd_coff_swap_scnhdr_out)
- PARAMS ((bfd *, PTR, PTR));
+ (bfd *, void *, void *);
unsigned int _bfd_filhsz;
unsigned int _bfd_aoutsz;
@@ -718,86 +720,86 @@ typedef struct
unsigned int _bfd_coff_debug_string_prefix_length;
void (*_bfd_coff_swap_filehdr_in)
- PARAMS ((bfd *, PTR, PTR));
+ (bfd *, void *, void *);
void (*_bfd_coff_swap_aouthdr_in)
- PARAMS ((bfd *, PTR, PTR));
+ (bfd *, void *, void *);
void (*_bfd_coff_swap_scnhdr_in)
- PARAMS ((bfd *, PTR, PTR));
+ (bfd *, void *, void *);
void (*_bfd_coff_swap_reloc_in)
- PARAMS ((bfd *abfd, PTR, PTR));
+ (bfd *abfd, void *, void *);
bfd_boolean (*_bfd_coff_bad_format_hook)
- PARAMS ((bfd *, PTR));
+ (bfd *, void *);
bfd_boolean (*_bfd_coff_set_arch_mach_hook)
- PARAMS ((bfd *, PTR));
+ (bfd *, void *);
- PTR (*_bfd_coff_mkobject_hook)
- PARAMS ((bfd *, PTR, PTR));
+ void * (*_bfd_coff_mkobject_hook)
+ (bfd *, void *, void *);
bfd_boolean (*_bfd_styp_to_sec_flags_hook)
- PARAMS ((bfd *, PTR, const char *, asection *, flagword *));
+ (bfd *, void *, const char *, asection *, flagword *);
void (*_bfd_set_alignment_hook)
- PARAMS ((bfd *, asection *, PTR));
+ (bfd *, asection *, void *);
bfd_boolean (*_bfd_coff_slurp_symbol_table)
- PARAMS ((bfd *));
+ (bfd *);
bfd_boolean (*_bfd_coff_symname_in_debug)
- PARAMS ((bfd *, struct internal_syment *));
+ (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 *, 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));
+ (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 *));
+ (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 *));
+ (bfd *, asection *, arelent *, unsigned int,
+ struct bfd_link_info *);
enum coff_symbol_classification (*_bfd_coff_classify_symbol)
- PARAMS ((bfd *, struct internal_syment *));
+ (bfd *, struct internal_syment *);
bfd_boolean (*_bfd_coff_compute_section_file_positions)
- PARAMS ((bfd *));
+ (bfd *);
bfd_boolean (*_bfd_coff_start_final_link)
- PARAMS ((bfd *, struct bfd_link_info *));
+ (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 **));
+ (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 *,
+ (bfd *, asection *, struct internal_reloc *,
struct coff_link_hash_entry *, struct internal_syment *,
- bfd_vma *));
+ bfd_vma *);
bfd_boolean (*_bfd_coff_adjust_symndx)
- PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *,
- struct internal_reloc *, bfd_boolean *));
+ (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,
+ (struct bfd_link_info *, bfd *, const char *, flagword,
asection *, bfd_vma, const char *, bfd_boolean, bfd_boolean,
- struct bfd_link_hash_entry **));
+ struct bfd_link_hash_entry **);
bfd_boolean (*_bfd_coff_link_output_has_begun)
- PARAMS ((bfd *, struct coff_final_link_info *));
+ (bfd *, struct coff_final_link_info *);
bfd_boolean (*_bfd_coff_final_link_postscript)
- PARAMS ((bfd *, struct coff_final_link_info *));
+ (bfd *, struct coff_final_link_info *);
} bfd_coff_backend_data;
@@ -927,7 +929,7 @@ typedef struct
(info, abfd, name, flags, section, value, string, cp, coll, hashp))
#define bfd_coff_link_output_has_begun(a,p) \
- ((coff_backend_info (a)->_bfd_coff_link_output_has_begun) (a,p))
+ ((coff_backend_info (a)->_bfd_coff_link_output_has_begun) (a, p))
#define bfd_coff_final_link_postscript(a,p) \
- ((coff_backend_info (a)->_bfd_coff_final_link_postscript) (a,p))
+ ((coff_backend_info (a)->_bfd_coff_final_link_postscript) (a, p))
diff --git a/contrib/binutils/bfd/libecoff.h b/contrib/binutils/bfd/libecoff.h
index 161f06c..165e755 100644
--- a/contrib/binutils/bfd/libecoff.h
+++ b/contrib/binutils/bfd/libecoff.h
@@ -1,23 +1,23 @@
/* BFD ECOFF object file private structure.
- Copyright 1993, 1994, 1995, 1996, 1999, 2001, 2002, 2003
- Free Software Foundation, Inc.
+ Copyright 1993, 1994, 1995, 1996, 1999, 2001, 2002, 2003, 2004,
+ 2005, 2006 Free Software Foundation, Inc.
Written by Ian Lance Taylor, Cygnus Support.
-This file is part of BFD, the Binary File Descriptor library.
+ 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 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.
+ 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. */
+ 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., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
#include "bfdlink.h"
@@ -57,24 +57,22 @@ struct ecoff_backend_data
/* 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));
+ void (*swap_reloc_in) (bfd *, void *, struct internal_reloc *);
+ void (*swap_reloc_out) (bfd *, const struct internal_reloc *, void *);
/* Backend reloc tweaking. */
void (*adjust_reloc_in)
- PARAMS ((bfd *, const struct internal_reloc *, arelent *));
+ (bfd *, const struct internal_reloc *, arelent *);
void (*adjust_reloc_out)
- PARAMS ((bfd *, const arelent *, struct internal_reloc *));
+ (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));
+ (bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *, void *);
/* Do final adjustments to filehdr and aouthdr. */
bfd_boolean (*adjust_headers)
- PARAMS ((bfd *, struct internal_filehdr *, struct internal_aouthdr *));
+ (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));
+ bfd *(*get_elt_at_filepos) (bfd *, file_ptr);
};
/* This is the target specific information kept for ECOFF files. */
@@ -115,7 +113,7 @@ typedef struct ecoff_tdata
struct ecoff_debug_info debug_info;
/* The unswapped ECOFF symbolic information. */
- PTR raw_syments;
+ void * raw_syments;
/* The canonical BFD symbols. */
struct ecoff_symbol_struct *canonical_symbols;
@@ -163,7 +161,7 @@ typedef struct ecoff_symbol_struct
/* 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;
+ void * native;
} ecoff_symbol_type;
/* We take the address of the first element of an asymbol to ensure that the
@@ -176,41 +174,13 @@ typedef struct ecoff_symbol_struct
#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. */
+/* A pointer to this structure is put in the used_by_bfd pointer of
+ a section to keep track of any per-section data.
+ 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
@@ -249,34 +219,37 @@ struct ecoff_link_hash_table
};
/* Make an ECOFF object. */
-extern bfd_boolean _bfd_ecoff_mkobject PARAMS ((bfd *));
+extern bfd_boolean _bfd_ecoff_mkobject (bfd *);
/* Read in the ECOFF symbolic debugging information. */
extern bfd_boolean _bfd_ecoff_slurp_symbolic_info
- PARAMS ((bfd *, asection *, struct ecoff_debug_info *));
+ (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));
+extern bfd_boolean _bfd_ecoff_write_object_contents (bfd *);
+extern const bfd_target *_bfd_ecoff_archive_p (bfd *);
#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 *));
+ (bfd *, asection *);
extern bfd_boolean _bfd_ecoff_get_section_contents
- PARAMS ((bfd *, asection *, PTR location, file_ptr, bfd_size_type));
+ (bfd *, asection *, void * 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 *));
+ (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_copy_private_header_data \
+ _bfd_generic_bfd_copy_private_header_data
+
#define _bfd_ecoff_bfd_print_private_bfd_data \
_bfd_generic_bfd_print_private_bfd_data
@@ -284,79 +257,81 @@ extern bfd_boolean _bfd_ecoff_bfd_copy_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));
+extern bfd_boolean _bfd_ecoff_slurp_armap (bfd *);
#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));
+ (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
+#define _bfd_ecoff_bfd_is_target_special_symbol \
+ ((bfd_boolean (*) (bfd *, asymbol *)) bfd_false)
-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 long _bfd_ecoff_get_symtab_upper_bound (bfd *);
+extern long _bfd_ecoff_canonicalize_symtab (bfd *, asymbol **);
+extern asymbol *_bfd_ecoff_make_empty_symbol (bfd *);
extern void _bfd_ecoff_print_symbol
- PARAMS ((bfd *, PTR filep, asymbol *, bfd_print_symbol_type));
+ (bfd *, void *, asymbol *, bfd_print_symbol_type);
extern void _bfd_ecoff_get_symbol_info
- PARAMS ((bfd *, asymbol *, symbol_info *));
+ (bfd *, asymbol *, symbol_info *);
extern bfd_boolean _bfd_ecoff_bfd_is_local_label_name
- PARAMS ((bfd *, const char *));
+ (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));
+ (bfd *, asection *, asymbol **, bfd_vma, const char **, const char **,
+ unsigned int *);
#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_find_inliner_info _bfd_nosymbols_find_inliner_info
#define _bfd_ecoff_get_reloc_upper_bound coff_get_reloc_upper_bound
extern long _bfd_ecoff_canonicalize_reloc
- PARAMS ((bfd *, asection *, arelent **, asymbol **symbols));
+ (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));
+ (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));
+ (bfd *, asection *, const void * location, file_ptr, bfd_size_type);
-extern int _bfd_ecoff_sizeof_headers PARAMS ((bfd *abfd, bfd_boolean reloc));
+extern int _bfd_ecoff_sizeof_headers (bfd *, struct bfd_link_info *);
/* 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 *));
+ (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 *));
+ (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 *));
+ (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));
+extern void * _bfd_ecoff_mkobject_hook (bfd *, void *, void *);
#define _bfd_ecoff_set_alignment_hook \
- ((void (*) PARAMS ((bfd *, asection *, PTR))) bfd_void)
+ ((void (*) (bfd *, asection *, void *)) bfd_void)
extern bfd_boolean _bfd_ecoff_set_arch_mach_hook
- PARAMS ((bfd *abfd, PTR filehdr));
+ (bfd *, void *);
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));
+ (bfd *, void *, const char *, asection *, flagword *);
+extern bfd_boolean _bfd_ecoff_slurp_symbol_table (bfd *);
/* 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 *));
+ (int, const struct tir_ext *, TIR *);
extern void _bfd_ecoff_swap_tir_out
- PARAMS ((int, const TIR *, struct tir_ext *));
+ (int, const TIR *, struct tir_ext *);
extern void _bfd_ecoff_swap_rndx_in
- PARAMS ((int, const struct rndx_ext *, RNDXR *));
+ (int, const struct rndx_ext *, RNDXR *);
extern void _bfd_ecoff_swap_rndx_out
- PARAMS ((int, const RNDXR *, struct rndx_ext *));
+ (int, const RNDXR *, struct rndx_ext *);
diff --git a/contrib/binutils/bfd/libieee.h b/contrib/binutils/bfd/libieee.h
index 56c7ce1..ab06251 100644
--- a/contrib/binutils/bfd/libieee.h
+++ b/contrib/binutils/bfd/libieee.h
@@ -17,7 +17,7 @@ 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. */
+Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
typedef struct {
unsigned int index:24;
diff --git a/contrib/binutils/bfd/libpei.h b/contrib/binutils/bfd/libpei.h
index 9ed9c12..0e08e03 100644
--- a/contrib/binutils/bfd/libpei.h
+++ b/contrib/binutils/bfd/libpei.h
@@ -1,5 +1,5 @@
/* Support for the generic parts of PE/PEI; common header information.
- Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
+ Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2005, 2006
Free Software Foundation, Inc.
Written by Cygnus Solutions.
@@ -17,7 +17,7 @@
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. */
+ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
/* Most of this hacked by Steve Chamberlain,
sac@cygnus.com
@@ -204,7 +204,38 @@
#define PUT_SCNHDR_LNNOPTR H_PUT_32
#endif
-#ifdef COFF_WITH_pep
+#ifdef COFF_WITH_pex64
+
+#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_32
+
+#define _bfd_XX_bfd_copy_private_bfd_data_common _bfd_pex64_bfd_copy_private_bfd_data_common
+#define _bfd_XX_bfd_copy_private_section_data _bfd_pex64_bfd_copy_private_section_data
+#define _bfd_XX_get_symbol_info _bfd_pex64_get_symbol_info
+#define _bfd_XX_only_swap_filehdr_out _bfd_pex64_only_swap_filehdr_out
+#define _bfd_XX_print_private_bfd_data_common _bfd_pex64_print_private_bfd_data_common
+#define _bfd_XXi_final_link_postscript _bfd_pex64i_final_link_postscript
+#define _bfd_XXi_only_swap_filehdr_out _bfd_pex64i_only_swap_filehdr_out
+#define _bfd_XXi_swap_aouthdr_in _bfd_pex64i_swap_aouthdr_in
+#define _bfd_XXi_swap_aouthdr_out _bfd_pex64i_swap_aouthdr_out
+#define _bfd_XXi_swap_aux_in _bfd_pex64i_swap_aux_in
+#define _bfd_XXi_swap_aux_out _bfd_pex64i_swap_aux_out
+#define _bfd_XXi_swap_lineno_in _bfd_pex64i_swap_lineno_in
+#define _bfd_XXi_swap_lineno_out _bfd_pex64i_swap_lineno_out
+#define _bfd_XXi_swap_scnhdr_out _bfd_pex64i_swap_scnhdr_out
+#define _bfd_XXi_swap_sym_in _bfd_pex64i_swap_sym_in
+#define _bfd_XXi_swap_sym_out _bfd_pex64i_swap_sym_out
+
+#elif defined COFF_WITH_pep
#define GET_OPTHDR_IMAGE_BASE H_GET_64
#define PUT_OPTHDR_IMAGE_BASE H_PUT_64
@@ -224,7 +255,6 @@
#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
@@ -256,7 +286,6 @@
#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
@@ -270,6 +299,28 @@
#endif /* !COFF_WITH_pep */
+/* Returns true if the target is a PE executable target. */
+#define bfd_target_pei_p(xvec) \
+ (CONST_STRNEQ ((xvec)->name, "pei-"))
+
+/* Return the arch string of a PE executable target. */
+#define bfd_target_pei_arch(xvec) \
+ ((xvec)->name + sizeof ("pei-") - 1)
+
+/* Returns true if the target is an EFI target. */
+#define bfd_target_efi_p(xvec) \
+ (CONST_STRNEQ ((xvec)->name, "efi-app-"))
+
+/* Return the arch string of an EFI target. */
+#define bfd_target_efi_arch(xvec) \
+ ((xvec)->name + sizeof ("efi-app-") - 1)
+
+/* Macro: Returns true if the bfd is a PE executable as opposed to a
+ PE object file. */
+#define bfd_pe_executable_p(abfd) \
+ (bfd_target_pei_p ((abfd)->xvec) \
+ || bfd_target_efi_p ((abfd)->xvec))
+
/* These functions are architecture dependent, and are in peicode.h:
coff_swap_reloc_in
int coff_swap_reloc_out
@@ -282,56 +333,39 @@
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_sym_in _bfd_XXi_swap_sym_in
+#define coff_swap_sym_out _bfd_XXi_swap_sym_out
+#define coff_swap_aux_in _bfd_XXi_swap_aux_in
+#define coff_swap_aux_out _bfd_XXi_swap_aux_out
+#define coff_swap_lineno_in _bfd_XXi_swap_lineno_in
+#define coff_swap_lineno_out _bfd_XXi_swap_lineno_out
+#define coff_swap_aouthdr_in _bfd_XXi_swap_aouthdr_in
#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 *));
+#define coff_swap_scnhdr_out _bfd_XXi_swap_scnhdr_out
#ifndef coff_final_link_postscript
#define coff_final_link_postscript _bfd_XXi_final_link_postscript
#endif
+
+void _bfd_XXi_swap_sym_in (bfd *, void *, void *);
+unsigned _bfd_XXi_swap_sym_out (bfd *, void *, void *);
+void _bfd_XXi_swap_aux_in (bfd *, void *, int, int, int, int, void *);
+unsigned _bfd_XXi_swap_aux_out (bfd *, void *, int, int, int, int, void *);
+void _bfd_XXi_swap_lineno_in (bfd *, void *, void *);
+unsigned _bfd_XXi_swap_lineno_out (bfd *, void *, void *);
+void _bfd_XXi_swap_aouthdr_in (bfd *, void *, void *);
+unsigned _bfd_XXi_swap_aouthdr_out (bfd *, void *, void *);
+unsigned _bfd_XXi_swap_scnhdr_out (bfd *, void *, void *);
+bfd_boolean _bfd_XX_print_private_bfd_data_common (bfd *, void *);
+bfd_boolean _bfd_XX_bfd_copy_private_bfd_data_common (bfd *, bfd *);
+void _bfd_XX_get_symbol_info (bfd *, asymbol *, symbol_info *);
+bfd_boolean _bfd_XXi_final_link_postscript (bfd *, struct coff_final_link_info *);
+
/* 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 *));
+unsigned _bfd_XX_only_swap_filehdr_out (bfd *, void *, void *);
+unsigned _bfd_XXi_only_swap_filehdr_out (bfd *, void *, void *);
+bfd_boolean _bfd_XX_bfd_copy_private_section_data (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
index 8537617..78b5f5f 100644
--- a/contrib/binutils/bfd/libxcoff.h
+++ b/contrib/binutils/bfd/libxcoff.h
@@ -1,5 +1,5 @@
/* BFD XCOFF object file private structure.
- Copyright 2001, 2002 Free Software Foundation, Inc.
+ Copyright 2001, 2002, 2005 Free Software Foundation, Inc.
Written by Tom Rix, Redhat.
This file is part of BFD, the Binary File Descriptor library.
@@ -16,7 +16,7 @@
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. */
+ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
#ifndef LIBXCOFF_H
#define LIBXCOFF_H
@@ -39,18 +39,12 @@ struct xcoff_backend_data_rec
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));
+ void (* _xcoff_swap_ldhdr_in) (bfd *, const void *, struct internal_ldhdr *);
+ void (* _xcoff_swap_ldhdr_out)(bfd *, const struct internal_ldhdr *, void *);
+ void (* _xcoff_swap_ldsym_in) (bfd *, const void *, struct internal_ldsym *);
+ void (* _xcoff_swap_ldsym_out)(bfd *, const struct internal_ldsym *, void *);
+ void (* _xcoff_swap_ldrel_in) (bfd *, const void *, struct internal_ldrel *);
+ void (* _xcoff_swap_ldrel_out)(bfd *, const struct internal_ldrel *, void *);
/* Size of the external struct. */
unsigned int _xcoff_ldhdrsz;
@@ -69,33 +63,29 @@ struct xcoff_backend_data_rec
unsigned long _xcoff_ldhdr_version;
bfd_boolean (* _xcoff_put_symbol_name)
- PARAMS ((bfd *, struct bfd_strtab_hash *, struct internal_syment *,
- const char *));
+ (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 *));
+ (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 *));
+ (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));
+ bfd_boolean (*_xcoff_is_lineno_count_overflow) (bfd *, bfd_vma);
+ bfd_boolean (*_xcoff_is_reloc_count_overflow) (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 *));
+ bfd_vma (*_xcoff_loader_symbol_offset) (bfd *, struct internal_ldhdr *);
+ bfd_vma (*_xcoff_loader_reloc_offset) (bfd *, struct internal_ldhdr *);
/* Global linkage. The first word of global linkage code must be be
modified by filling in the correct TOC offset. */
@@ -107,7 +97,7 @@ struct xcoff_backend_data_rec
/* rtinit. */
unsigned int _xcoff_rtinit_size;
bfd_boolean (*_xcoff_generate_rtinit)
- PARAMS ((bfd *, const char *, const char *, bfd_boolean));
+ (bfd *, const char *, const char *, bfd_boolean);
};
/* Look up an entry in an XCOFF link hash table. */
@@ -120,7 +110,7 @@ struct xcoff_backend_data_rec
#define xcoff_link_hash_traverse(table, func, info) \
(bfd_link_hash_traverse \
(&(table)->root, \
- (bfd_boolean (*) PARAMS ((struct bfd_link_hash_entry *, PTR))) (func), \
+ (bfd_boolean (*) (struct bfd_link_hash_entry *, void *)) (func), \
(info)))
/* Get the XCOFF link hash table from the info structure. This is
@@ -131,80 +121,80 @@ struct xcoff_backend_data_rec
#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_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)))
+ ((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)))
+ ((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)))
+ ((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)))
+ ((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)))
+ ((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)))
+ ((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_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))
+ ((xcoff_backend (a)->_xcoff_function_descriptor_size))
#define bfd_xcoff_small_aout_header_size(a) \
- ((xcoff_backend(a)->_xcoff_small_aout_header_size))
+ ((xcoff_backend (a)->_xcoff_small_aout_header_size))
-#define bfd_xcoff_ldhdr_version(a) ((xcoff_backend(a)->_xcoff_ldhdr_version))
+#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)))
+ ((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)))
+ ((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))
+ ((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))))
+ ((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))))
+ ((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))))
+ ((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))))
+ ((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))))
+ ((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))
+#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))))
+ ( (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_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))))
+#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))
@@ -228,18 +218,18 @@ struct xcoff_backend_data_rec
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));
+ (XCOFF_RELOC_FUNCTION_ARGS);
extern bfd_boolean (*xcoff_complain_overflow[XCOFF_MAX_COMPLAIN_OVERFLOW])
- PARAMS ((XCOFF_COMPLAIN_FUNCTION_ARGS));
+ (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));
+bfd_boolean xcoff_reloc_type_noop (XCOFF_RELOC_FUNCTION_ARGS);
+bfd_boolean xcoff_reloc_type_fail (XCOFF_RELOC_FUNCTION_ARGS);
+bfd_boolean xcoff_reloc_type_pos (XCOFF_RELOC_FUNCTION_ARGS);
+bfd_boolean xcoff_reloc_type_neg (XCOFF_RELOC_FUNCTION_ARGS);
+bfd_boolean xcoff_reloc_type_rel (XCOFF_RELOC_FUNCTION_ARGS);
+bfd_boolean xcoff_reloc_type_toc (XCOFF_RELOC_FUNCTION_ARGS);
+bfd_boolean xcoff_reloc_type_ba (XCOFF_RELOC_FUNCTION_ARGS);
+bfd_boolean xcoff_reloc_type_crel (XCOFF_RELOC_FUNCTION_ARGS);
#endif /* LIBXCOFF_H */
diff --git a/contrib/binutils/bfd/linker.c b/contrib/binutils/bfd/linker.c
index 58befc3..497b5c2 100644
--- a/contrib/binutils/bfd/linker.c
+++ b/contrib/binutils/bfd/linker.c
@@ -1,6 +1,7 @@
/* linker.c -- BFD linker routines
Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
- 2003, 2004 Free Software Foundation, Inc.
+ 2003, 2004, 2005, 2006, 2007
+ 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.
@@ -17,10 +18,10 @@
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. */
+ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
#include "bfdlink.h"
#include "genlink.h"
@@ -309,7 +310,7 @@ SUBSUBSECTION
of the <<bfd>> structure.
Each section in the output file will have a list of
- <<link_order>> structures attached to the <<link_order_head>>
+ <<link_order>> structures attached to the <<map_head.link_order>>
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
@@ -455,7 +456,9 @@ _bfd_link_hash_newfunc (struct bfd_hash_entry *entry,
/* Initialize the local fields. */
h->type = bfd_link_hash_new;
- h->und_next = NULL;
+ memset (&h->u.undef.next, 0,
+ (sizeof (struct bfd_link_hash_entry)
+ - offsetof (struct bfd_link_hash_entry, u.undef.next)));
}
return entry;
@@ -470,14 +473,15 @@ _bfd_link_hash_table_init
bfd *abfd,
struct bfd_hash_entry *(*newfunc) (struct bfd_hash_entry *,
struct bfd_hash_table *,
- const char *))
+ const char *),
+ unsigned int entsize)
{
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);
+ return bfd_hash_table_init (&table->table, newfunc, entsize);
}
/* Look up a symbol in a link hash table. If follow is TRUE, we
@@ -559,11 +563,11 @@ bfd_wrapped_link_hash_lookup (bfd *abfd,
#undef WRAP
-#undef REAL
+#undef REAL
#define REAL "__real_"
if (*l == '_'
- && strncmp (l, REAL, sizeof REAL - 1) == 0
+ && CONST_STRNEQ (l, REAL)
&& bfd_hash_lookup (info->wrap_hash, l + sizeof REAL - 1,
FALSE, FALSE) != NULL)
{
@@ -616,13 +620,52 @@ void
bfd_link_add_undef (struct bfd_link_hash_table *table,
struct bfd_link_hash_entry *h)
{
- BFD_ASSERT (h->und_next == NULL);
+ BFD_ASSERT (h->u.undef.next == NULL);
if (table->undefs_tail != NULL)
- table->undefs_tail->und_next = h;
+ table->undefs_tail->u.undef.next = h;
if (table->undefs == NULL)
table->undefs = h;
table->undefs_tail = h;
}
+
+/* The undefs list was designed so that in normal use we don't need to
+ remove entries. However, if symbols on the list are changed from
+ bfd_link_hash_undefined to either bfd_link_hash_undefweak or
+ bfd_link_hash_new for some reason, then they must be removed from the
+ list. Failure to do so might result in the linker attempting to add
+ the symbol to the list again at a later stage. */
+
+void
+bfd_link_repair_undef_list (struct bfd_link_hash_table *table)
+{
+ struct bfd_link_hash_entry **pun;
+
+ pun = &table->undefs;
+ while (*pun != NULL)
+ {
+ struct bfd_link_hash_entry *h = *pun;
+
+ if (h->type == bfd_link_hash_new
+ || h->type == bfd_link_hash_undefweak)
+ {
+ *pun = h->u.undef.next;
+ h->u.undef.next = NULL;
+ if (h == table->undefs_tail)
+ {
+ if (pun == &table->undefs)
+ table->undefs_tail = NULL;
+ else
+ /* pun points at an u.undef.next field. Go back to
+ the start of the link_hash_entry. */
+ table->undefs_tail = (struct bfd_link_hash_entry *)
+ ((char *) pun - ((char *) &h->u.undef.next - (char *) h));
+ break;
+ }
+ }
+ else
+ pun = &h->u.undef.next;
+ }
+}
/* Routine to create an entry in a generic link hash table. */
@@ -668,7 +711,8 @@ _bfd_generic_link_hash_table_create (bfd *abfd)
if (ret == NULL)
return NULL;
if (! _bfd_link_hash_table_init (&ret->root, abfd,
- _bfd_generic_link_hash_newfunc))
+ _bfd_generic_link_hash_newfunc,
+ sizeof (struct generic_link_hash_entry)))
{
free (ret);
return NULL;
@@ -860,9 +904,10 @@ archive_hash_table_init
(struct archive_hash_table *table,
struct bfd_hash_entry *(*newfunc) (struct bfd_hash_entry *,
struct bfd_hash_table *,
- const char *))
+ const char *),
+ unsigned int entsize)
{
- return bfd_hash_table_init (&table->table, newfunc);
+ return bfd_hash_table_init (&table->table, newfunc, entsize);
}
/* Look up an entry in an archive hash table. */
@@ -940,7 +985,8 @@ _bfd_generic_link_add_archive_symbols
/* 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))
+ if (! archive_hash_table_init (&arsym_hash, archive_hash_newfunc,
+ sizeof (struct archive_hash_entry)))
return FALSE;
for (arsym = arsyms, indx = 0; arsym < arsym_end; arsym++, indx++)
{
@@ -990,9 +1036,9 @@ _bfd_generic_link_add_archive_symbols
us to lose track of whether the symbol has been
referenced). */
if (*pundef != info->hash->undefs_tail)
- *pundef = (*pundef)->und_next;
+ *pundef = (*pundef)->u.undef.next;
else
- pundef = &(*pundef)->und_next;
+ pundef = &(*pundef)->u.undef.next;
continue;
}
@@ -1015,7 +1061,7 @@ _bfd_generic_link_add_archive_symbols
}
if (arh == NULL)
{
- pundef = &(*pundef)->und_next;
+ pundef = &(*pundef)->u.undef.next;
continue;
}
}
@@ -1064,7 +1110,7 @@ _bfd_generic_link_add_archive_symbols
}
}
- pundef = &(*pundef)->und_next;
+ pundef = &(*pundef)->u.undef.next;
}
archive_hash_table_free (&arsym_hash);
@@ -1565,6 +1611,7 @@ _bfd_generic_link_add_one_symbol (struct bfd_link_info *info,
/* Make a new weak undefined symbol. */
h->type = bfd_link_hash_undefweak;
h->u.undef.abfd = abfd;
+ h->u.undef.weak = abfd;
break;
case CDEF:
@@ -1613,8 +1660,7 @@ _bfd_generic_link_add_one_symbol (struct bfd_link_info *info,
s = name + 1;
while (*s == '_')
++s;
- if (s[0] == 'G'
- && strncmp (s, CONS_PREFIX, CONS_PREFIX_LEN - 1) == 0)
+ if (s[0] == 'G' && CONST_STRNEQ (s, CONS_PREFIX))
{
char c;
@@ -1694,8 +1740,8 @@ _bfd_generic_link_add_one_symbol (struct bfd_link_info *info,
case REF:
/* A reference to a defined symbol. */
- if (h->und_next == NULL && info->hash->undefs_tail != h)
- h->und_next = h;
+ if (h->u.undef.next == NULL && info->hash->undefs_tail != h)
+ h->u.undef.next = h;
break;
case BIG:
@@ -1828,8 +1874,8 @@ _bfd_generic_link_add_one_symbol (struct bfd_link_info *info,
&& inh->u.i.link == h)
{
(*_bfd_error_handler)
- (_("%s: indirect symbol `%s' to `%s' is a loop"),
- bfd_archive_filename (abfd), name, string);
+ (_("%B: indirect symbol `%s' to `%s' is a loop"),
+ abfd, name, string);
bfd_set_error (bfd_error_invalid_operation);
return FALSE;
}
@@ -1881,8 +1927,8 @@ _bfd_generic_link_add_one_symbol (struct bfd_link_info *info,
case REFC:
/* A reference to an indirect symbol. */
- if (h->und_next == NULL && info->hash->undefs_tail != h)
- h->und_next = h;
+ if (h->u.undef.next == NULL && info->hash->undefs_tail != h)
+ h->u.undef.next = h;
h = h->u.i.link;
cycle = TRUE;
break;
@@ -1897,10 +1943,10 @@ _bfd_generic_link_add_one_symbol (struct bfd_link_info *info,
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
+ the u.undef.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 (h->u.undef.next != NULL || info->hash->undefs_tail == h)
{
if (! (*info->callbacks->warning) (info, string, h->root.string,
hash_entry_bfd (h), NULL, 0))
@@ -1967,7 +2013,7 @@ _bfd_generic_final_link (bfd *abfd, struct bfd_link_info *info)
/* 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)
+ for (p = o->map_head.link_order; p != NULL; p = p->next)
if (p->type == bfd_indirect_link_order)
p->u.indirect.section->linker_mark = TRUE;
@@ -1996,7 +2042,7 @@ _bfd_generic_final_link (bfd *abfd, struct bfd_link_info *info)
for (o = abfd->sections; o != NULL; o = o->next)
{
o->reloc_count = 0;
- for (p = o->link_order_head; p != NULL; p = p->next)
+ for (p = o->map_head.link_order; p != NULL; p = p->next)
{
if (p->type == bfd_section_reloc_link_order
|| p->type == bfd_symbol_reloc_link_order)
@@ -2052,7 +2098,7 @@ _bfd_generic_final_link (bfd *abfd, struct bfd_link_info *info)
/* 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)
+ for (p = o->map_head.link_order; p != NULL; p = p->next)
{
switch (p->type)
{
@@ -2321,12 +2367,11 @@ _bfd_generic_link_output_symbols (bfd *output_bfd,
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)
+ in the output file, then we don't want to output the
+ symbol. */
+ if (!bfd_is_abs_section (sym->section)
+ && bfd_section_removed_from_list (output_bfd,
+ sym->section->output_section))
output = FALSE;
if (output)
@@ -2529,7 +2574,7 @@ _bfd_generic_reloc_link_order (bfd *abfd,
abort ();
case bfd_reloc_overflow:
if (! ((*info->callbacks->reloc_overflow)
- (info,
+ (info, NULL,
(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),
@@ -2570,11 +2615,11 @@ bfd_new_link_order (bfd *abfd, asection *section)
new->type = bfd_undefined_link_order;
- if (section->link_order_tail != NULL)
- section->link_order_tail->next = new;
+ if (section->map_tail.link_order != NULL)
+ section->map_tail.link_order->next = new;
else
- section->link_order_head = new;
- section->link_order_tail = new;
+ section->map_head.link_order = new;
+ section->map_tail.link_order = new;
return new;
}
@@ -2676,15 +2721,14 @@ default_indirect_link_order (bfd *output_bfd,
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;
+ if (input_section->size == 0)
+ return TRUE;
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);
+ BFD_ASSERT (input_section->size == link_order->size);
if (info->relocatable
&& input_section->reloc_count > 0
@@ -2756,7 +2800,9 @@ default_indirect_link_order (bfd *output_bfd,
}
/* Get and relocate the section contents. */
- sec_size = bfd_section_size (input_bfd, input_section);
+ sec_size = (input_section->rawsize > input_section->size
+ ? input_section->rawsize
+ : input_section->size);
contents = bfd_malloc (sec_size);
if (contents == NULL && sec_size != 0)
goto error_return;
@@ -2767,9 +2813,9 @@ default_indirect_link_order (bfd *output_bfd,
goto error_return;
/* Output the section contents. */
- loc = link_order->offset * bfd_octets_per_byte (output_bfd);
+ loc = input_section->output_offset * bfd_octets_per_byte (output_bfd);
if (! bfd_set_section_contents (output_bfd, output_section,
- new_contents, loc, link_order->size))
+ new_contents, loc, input_section->size))
goto error_return;
if (contents != NULL)
@@ -2825,3 +2871,296 @@ _bfd_generic_link_split_section (bfd *abfd ATTRIBUTE_UNUSED,
{
return FALSE;
}
+
+/*
+FUNCTION
+ bfd_section_already_linked
+
+SYNOPSIS
+ void bfd_section_already_linked (bfd *abfd, asection *sec,
+ struct bfd_link_info *info);
+
+DESCRIPTION
+ Check if @var{sec} has been already linked during a reloceatable
+ or final link.
+
+.#define bfd_section_already_linked(abfd, sec, info) \
+. BFD_SEND (abfd, _section_already_linked, (abfd, sec, info))
+.
+
+*/
+
+/* Sections marked with the SEC_LINK_ONCE flag should only be linked
+ once into the output. This routine checks each section, and
+ arrange to discard it if a section of the same name has already
+ been linked. This code assumes that all relevant sections have the
+ SEC_LINK_ONCE flag set; that is, it does not depend solely upon the
+ section name. bfd_section_already_linked is called via
+ bfd_map_over_sections. */
+
+/* The hash table. */
+
+static struct bfd_hash_table _bfd_section_already_linked_table;
+
+/* Support routines for the hash table used by section_already_linked,
+ initialize the table, traverse, lookup, fill in an entry and remove
+ the table. */
+
+void
+bfd_section_already_linked_table_traverse
+ (bfd_boolean (*func) (struct bfd_section_already_linked_hash_entry *,
+ void *), void *info)
+{
+ bfd_hash_traverse (&_bfd_section_already_linked_table,
+ (bfd_boolean (*) (struct bfd_hash_entry *,
+ void *)) func,
+ info);
+}
+
+struct bfd_section_already_linked_hash_entry *
+bfd_section_already_linked_table_lookup (const char *name)
+{
+ return ((struct bfd_section_already_linked_hash_entry *)
+ bfd_hash_lookup (&_bfd_section_already_linked_table, name,
+ TRUE, FALSE));
+}
+
+void
+bfd_section_already_linked_table_insert
+ (struct bfd_section_already_linked_hash_entry *already_linked_list,
+ asection *sec)
+{
+ struct bfd_section_already_linked *l;
+
+ /* Allocate the memory from the same obstack as the hash table is
+ kept in. */
+ l = bfd_hash_allocate (&_bfd_section_already_linked_table, sizeof *l);
+ l->sec = sec;
+ l->next = already_linked_list->entry;
+ already_linked_list->entry = l;
+}
+
+static struct bfd_hash_entry *
+already_linked_newfunc (struct bfd_hash_entry *entry ATTRIBUTE_UNUSED,
+ struct bfd_hash_table *table,
+ const char *string ATTRIBUTE_UNUSED)
+{
+ struct bfd_section_already_linked_hash_entry *ret =
+ bfd_hash_allocate (table, sizeof *ret);
+
+ ret->entry = NULL;
+
+ return &ret->root;
+}
+
+bfd_boolean
+bfd_section_already_linked_table_init (void)
+{
+ return bfd_hash_table_init_n (&_bfd_section_already_linked_table,
+ already_linked_newfunc,
+ sizeof (struct bfd_section_already_linked_hash_entry),
+ 42);
+}
+
+void
+bfd_section_already_linked_table_free (void)
+{
+ bfd_hash_table_free (&_bfd_section_already_linked_table);
+}
+
+/* This is used on non-ELF inputs. */
+
+void
+_bfd_generic_section_already_linked (bfd *abfd, asection *sec,
+ struct bfd_link_info *info ATTRIBUTE_UNUSED)
+{
+ flagword flags;
+ const char *name;
+ struct bfd_section_already_linked *l;
+ struct bfd_section_already_linked_hash_entry *already_linked_list;
+
+ flags = sec->flags;
+ if ((flags & SEC_LINK_ONCE) == 0)
+ return;
+
+ /* FIXME: When doing a relocatable link, we may have trouble
+ copying relocations in other sections that refer to local symbols
+ in the section being discarded. Those relocations will have to
+ be converted somehow; as of this writing I'm not sure that any of
+ the backends handle that correctly.
+
+ It is tempting to instead not discard link once sections when
+ doing a relocatable link (technically, they should be discarded
+ whenever we are building constructors). However, that fails,
+ because the linker winds up combining all the link once sections
+ into a single large link once section, which defeats the purpose
+ of having link once sections in the first place. */
+
+ name = bfd_get_section_name (abfd, sec);
+
+ already_linked_list = bfd_section_already_linked_table_lookup (name);
+
+ for (l = already_linked_list->entry; l != NULL; l = l->next)
+ {
+ bfd_boolean skip = FALSE;
+ struct coff_comdat_info *s_comdat
+ = bfd_coff_get_comdat_section (abfd, sec);
+ struct coff_comdat_info *l_comdat
+ = bfd_coff_get_comdat_section (l->sec->owner, l->sec);
+
+ /* We may have 3 different sections on the list: group section,
+ comdat section and linkonce section. SEC may be a linkonce or
+ comdat section. We always ignore group section. For non-COFF
+ inputs, we also ignore comdat section.
+
+ FIXME: Is that safe to match a linkonce section with a comdat
+ section for COFF inputs? */
+ if ((l->sec->flags & SEC_GROUP) != 0)
+ skip = TRUE;
+ else if (bfd_get_flavour (abfd) == bfd_target_coff_flavour)
+ {
+ if (s_comdat != NULL
+ && l_comdat != NULL
+ && strcmp (s_comdat->name, l_comdat->name) != 0)
+ skip = TRUE;
+ }
+ else if (l_comdat != NULL)
+ skip = TRUE;
+
+ if (!skip)
+ {
+ /* The section has already been linked. See if we should
+ issue a warning. */
+ switch (flags & SEC_LINK_DUPLICATES)
+ {
+ default:
+ abort ();
+
+ case SEC_LINK_DUPLICATES_DISCARD:
+ break;
+
+ case SEC_LINK_DUPLICATES_ONE_ONLY:
+ (*_bfd_error_handler)
+ (_("%B: warning: ignoring duplicate section `%A'\n"),
+ abfd, sec);
+ break;
+
+ case SEC_LINK_DUPLICATES_SAME_CONTENTS:
+ /* FIXME: We should really dig out the contents of both
+ sections and memcmp them. The COFF/PE spec says that
+ the Microsoft linker does not implement this
+ correctly, so I'm not going to bother doing it
+ either. */
+ /* Fall through. */
+ case SEC_LINK_DUPLICATES_SAME_SIZE:
+ if (sec->size != l->sec->size)
+ (*_bfd_error_handler)
+ (_("%B: warning: duplicate section `%A' has different size\n"),
+ abfd, sec);
+ break;
+ }
+
+ /* Set the output_section field so that lang_add_section
+ does not create a lang_input_section structure for this
+ section. Since there might be a symbol in the section
+ being discarded, we must retain a pointer to the section
+ which we are really going to use. */
+ sec->output_section = bfd_abs_section_ptr;
+ sec->kept_section = l->sec;
+
+ return;
+ }
+ }
+
+ /* This is the first section with this name. Record it. */
+ bfd_section_already_linked_table_insert (already_linked_list, sec);
+}
+
+/* Convert symbols in excluded output sections to use a kept section. */
+
+static bfd_boolean
+fix_syms (struct bfd_link_hash_entry *h, void *data)
+{
+ bfd *obfd = (bfd *) data;
+
+ if (h->type == bfd_link_hash_warning)
+ h = h->u.i.link;
+
+ if (h->type == bfd_link_hash_defined
+ || h->type == bfd_link_hash_defweak)
+ {
+ asection *s = h->u.def.section;
+ if (s != NULL
+ && s->output_section != NULL
+ && (s->output_section->flags & SEC_EXCLUDE) != 0
+ && bfd_section_removed_from_list (obfd, s->output_section))
+ {
+ asection *op, *op1;
+
+ h->u.def.value += s->output_offset + s->output_section->vma;
+
+ /* Find preceding kept section. */
+ for (op1 = s->output_section->prev; op1 != NULL; op1 = op1->prev)
+ if ((op1->flags & SEC_EXCLUDE) == 0
+ && !bfd_section_removed_from_list (obfd, op1))
+ break;
+
+ /* Find following kept section. Start at prev->next because
+ other sections may have been added after S was removed. */
+ if (s->output_section->prev != NULL)
+ op = s->output_section->prev->next;
+ else
+ op = s->output_section->owner->sections;
+ for (; op != NULL; op = op->next)
+ if ((op->flags & SEC_EXCLUDE) == 0
+ && !bfd_section_removed_from_list (obfd, op))
+ break;
+
+ /* Choose better of two sections, based on flags. The idea
+ is to choose a section that will be in the same segment
+ as S would have been if it was kept. */
+ if (op1 == NULL)
+ {
+ if (op == NULL)
+ op = bfd_abs_section_ptr;
+ }
+ else if (op == NULL)
+ op = op1;
+ else if (((op1->flags ^ op->flags)
+ & (SEC_ALLOC | SEC_THREAD_LOCAL)) != 0)
+ {
+ if (((op->flags ^ s->flags)
+ & (SEC_ALLOC | SEC_THREAD_LOCAL)) != 0)
+ op = op1;
+ }
+ else if (((op1->flags ^ op->flags) & SEC_READONLY) != 0)
+ {
+ if (((op->flags ^ s->flags) & SEC_READONLY) != 0)
+ op = op1;
+ }
+ else if (((op1->flags ^ op->flags) & SEC_CODE) != 0)
+ {
+ if (((op->flags ^ s->flags) & SEC_CODE) != 0)
+ op = op1;
+ }
+ else
+ {
+ /* Flags we care about are the same. Prefer the following
+ section if that will result in a positive valued sym. */
+ if (h->u.def.value < op->vma)
+ op = op1;
+ }
+
+ h->u.def.value -= op->vma;
+ h->u.def.section = op;
+ }
+ }
+
+ return TRUE;
+}
+
+void
+_bfd_fix_excluded_sec_syms (bfd *obfd, struct bfd_link_info *info)
+{
+ bfd_link_hash_traverse (info->hash, fix_syms, obfd);
+}
diff --git a/contrib/binutils/bfd/mep-relocs.pl b/contrib/binutils/bfd/mep-relocs.pl
new file mode 100755
index 0000000..d227b82
--- /dev/null
+++ b/contrib/binutils/bfd/mep-relocs.pl
@@ -0,0 +1,274 @@
+#!/usr/bin/perl
+# -*- perl -*-
+#
+# Toshiba MeP Media Engine Relocation Generator
+# Copyright (C) 2001, 2007 Free Software Foundation, Inc.
+# This file is part of BFD.
+# Originally written by DJ Delorie <dj@redhat.com>
+#
+# 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+
+# Usage: Run this anywhere inside your source tree. It will read
+# include/elf/mep.h and scan the comments therein. It will renumber
+# the relocs to be sequential (this is needed so that bfd/elf32-mep.h
+# works) if needed. It will then update the reloc list in bfd/reloc.c
+# and the howto, mapping, and apply routines in bfd/elf32-mep.c. You
+# can then regenerate bfd-in2.h and check everything in.
+
+# FIXME: After the relocation list is finalized, change this to
+# *verify* the reloc list, rather than resequence it.
+
+while (! -f "include/elf/mep.h" && ! -f "bfd/reloc.c") {
+ chdir "..";
+ $pwd = `pwd`;
+ if ($pwd !~ m@/.*/@) {
+ print STDERR "Cannot find include/elf/mep.h or bfd/reloc.h\n";
+ exit 1;
+ }
+}
+$pwd = `pwd`;
+print "srctop is $pwd";
+
+printf "Reading include/elf/mep.h ...\n";
+open(MEPH, "include/elf/mep.h");
+open(MEPHO, "> include/elf/mep.h.new") || die("mep.h.new create: $!");
+$val = 0;
+while (<MEPH>) {
+ if (($pre,$rel,$rest) = /(.*RELOC_NUMBER \()([^,]+), *\d+(.*)/) {
+ $rest =~ s/[\r\n]+$//;
+ print (MEPHO "$pre$rel, $val$rest\n") || die("mep.h.new write: $!");
+ $val ++;
+ $rel =~ s/R_MEP_//;
+ push(@relocs, $rel);
+
+ $rest =~ s@.*/\* @@;
+ ($pattern, $sign, $attrs) = $rest =~ m@(.*) ([US]) (.*)\*/@;
+ $pattern =~ s/ //g;
+ push(@pattern, $pattern);
+ push(@sign, $sign);
+ push(@attrs, $attrs);
+
+ printf "%4d $rel p=`$pattern' s=`$sign' a=`$attrs'\n", $#pattern;
+
+ } else {
+ print(MEPHO) || die("mep.h.new write: $!");
+ }
+}
+close(MEPH);
+close(MEPHO) || die("mep.h.new close: $!");
+
+&swapfile("include/elf/mep.h");
+
+redo_file ("bfd/reloc.c",
+ "",
+ "ENUMDOC\n Toshiba Media Processor Relocations.\n\nCOMMENT\n",
+ "ENUM\n BFD_RELOC_MEP_%s\n",
+ "");
+
+$autogen = " /* This section generated from bfd/mep-relocs.pl from include/elf/mep.h. */\n";
+
+redo_file ("bfd/elf32-mep.c",
+ "MEPRELOC:HOWTO",
+ $autogen,
+ "MEPRELOC:END",
+ "",
+ "&emit_howto();",
+ "MEPRELOC:MAP",
+ $autogen,
+ "MEPRELOC:END",
+ "",
+ " MAP(%s);\n",
+ "MEPRELOC:APPLY",
+ $autogen,
+ "MEPRELOC:END",
+ "",
+ "&emit_apply();",
+ );
+
+sub mask2shifts {
+ my ($mask) = @_;
+ my ($bits, $left, $right, $ci, $c, $cv);
+ $bits = 0;
+ $left = 0;
+ $right = 32;
+ for ($ci=0; $ci<length($mask); $ci++) {
+ $c = substr($mask, $ci, 1);
+ $left++;
+ next if $c eq '-';
+ $left = 0;
+ $cv = ord($c) - ord('0');
+ $cv -= ord('a') - ord('9') - 1 if $cv > 9;
+ $right = $cv unless $right < $cv;
+ $bits = $cv+1 unless $bits > $cv+1;
+ }
+ $mask =~ tr/-/1/c;
+ $mask =~ tr/-/0/;
+ ($rmask = $mask) =~ tr/01/10/;
+ $mask = unpack("H*", pack("B*", $mask));
+ $rmask = unpack("H*", pack("B*", $rmask));
+ return ($bits, $left, $right, $mask, $rmask);
+}
+
+sub emit_howto {
+ for ($i=2; $i<=$#relocs; $i++) {
+ $mask = $pattern[$i];
+
+ if (length($mask) == 8) { $bytesize = 0; }
+ elsif (length($mask) == 16) { $bytesize = 1; }
+ elsif (length($mask) == 32) { $bytesize = 2; }
+
+ ($bits, $left, $right, $mask) = mask2shifts ($mask);
+ $bits[$i] = $bits;
+ $pcrel = 0;
+ $pcrel = 1 if $attrs[$i] =~ /pc-rel/i;
+ $overflow = $sign[$i];
+ $overflow = 'N' if $attrs[$i] =~ /no-overflow/;
+
+ $c = "$relocs[$i],";
+ printf(NEW " MEPREL (R_MEP_%-10s%d,%3d,%2d,%2d,%2d,%2s, 0x%s),\n",
+ $c, $bytesize, $bits, $left, $right, $pcrel, $overflow, $mask);
+ }
+}
+
+sub emit_apply {
+ for ($i=2; $i<=$#relocs; $i++) {
+ $v = "u";
+ $v = "s" if $sign[$i] =~ /S/;
+ if (length($pattern[$i]) == 8) {
+ $e = ''; # no endian swap for bytes
+ } elsif ($pattern[$i] =~ /-/ || length($pattern[$i]) == 16) {
+ $e = '^e2'; # endian swap - 2byte words only
+ } else {
+ $e = '^e4' # endian swap for data
+ }
+ print NEW " case R_MEP_$relocs[$i]: /* $pattern[$i] */\n";
+ if ($attrs[$i] =~ /tp-rel/i) {
+ print NEW " $v -= mep_tpoff_base(rel->r_offset);\n";
+ }
+ if ($attrs[$i] =~ /gp-rel/i) {
+ print NEW " $v -= mep_sdaoff_base(rel->r_offset);\n";
+ }
+ if ($attrs[$i] !~ /no-overflow/ && $bits[$i] < 32) {
+ if ($v eq "u") {
+ $max = (1 << $bits[$i]) - 1;
+ print NEW " if (u > $max) r = bfd_reloc_overflow;\n";
+ } else {
+ $min = -(1 << ($bits[$i]-1));
+ $max = (1 << ($bits[$i]-1)) - 1;
+ print NEW " if ($min > s || s > $max) r = bfd_reloc_overflow;\n";
+ }
+ }
+ for ($b=0; $b<length($pattern[$i]); $b += 8) {
+ $mask = substr($pattern[$i], $b, 8);
+ ($bits, $left, $right, $mask, $rmask) = mask2shifts ($mask);
+ if ($left > $right) { $left -= $right; $right = 0; }
+ else { $right -= $left; $left = 0; }
+
+ if ($mask ne "00") {
+ $bb = $b / 8;
+ print NEW " byte[$bb$e] = ";
+ print NEW "(byte[$bb$e] & 0x$rmask) | " if $rmask ne "00";
+ if ($left) {
+ print NEW "(($v << $left) & 0x$mask)";
+ } elsif ($right) {
+ print NEW "(($v >> $right) & 0x$mask)";
+ } else {
+ print NEW "($v & 0x$mask)";
+ }
+ print NEW ";\n";
+ }
+ }
+ print NEW " break;\n";
+ }
+}
+
+
+#-----------------------------------------------------------------------------
+
+sub redo_file {
+ my ($file, @control) = @_;
+ open(OLD, $file);
+ open(NEW, "> $file.new") || die("$file.new create: $!");
+
+ print "Scanning file $file ...\n";
+
+ while (1) {
+ $start = shift @control;
+ $prefix = shift @control;
+ $end = shift @control;
+ $suffix = shift @control;
+ $pattern = shift @control;
+
+ if (!$start) {
+ print NEW while <OLD>;
+ last;
+ }
+
+ print " looking for $start\n";
+ while (<OLD>) {
+ print NEW;
+ last if /\Q$start\E/;
+ }
+ print "can't find $start\n" unless $_;
+ last unless $_;
+
+ print NEW $prefix;
+ if ($pattern =~ /^\&/) {
+ eval $pattern;
+ die("$pattern: $@") if $@;
+ } else {
+ for $i (2..$#relocs) {
+ printf (NEW "$pattern", $relocs[$i]) || die("$file.new write: $!");
+ $pattern =~ s/^ENUM\n/ENUMX\n/;
+ }
+ }
+ print NEW $suffix;
+ while (<OLD>) {
+ last if /\Q$end\E/;
+ }
+ print NEW;
+ }
+
+ close(OLD);
+ close(NEW) || die("$file.new close: $!");
+ &swapfile($file);
+}
+
+#-----------------------------------------------------------------------------
+
+sub swapfile {
+ my ($f) = @_;
+ if ( ! -f "$f.save") {
+ system "cp $f $f.save";
+ }
+ open(ORIG, $f);
+ open(NEW, "$f.new");
+ while (<ORIG>) {
+ $n = <NEW>;
+ if ($n ne $_) {
+ close(ORIG);
+ close(NEW);
+ print " Updating $f\n";
+ rename "$f", "$f.old";
+ rename "$f.new", "$f";
+ return;
+ }
+ }
+ close(ORIG);
+ close(NEW);
+ print " No change to $f\n";
+ unlink "$f.new";
+}
diff --git a/contrib/binutils/bfd/merge.c b/contrib/binutils/bfd/merge.c
index 89f45cd..71b31d3 100644
--- a/contrib/binutils/bfd/merge.c
+++ b/contrib/binutils/bfd/merge.c
@@ -1,5 +1,6 @@
/* SEC_MERGE support.
- Copyright 2001, 2002, 2003 Free Software Foundation, Inc.
+ Copyright 2001, 2002, 2003, 2004, 2005, 2006, 2007
+ Free Software Foundation, Inc.
Written by Jakub Jelinek <jakub@redhat.com>.
This file is part of BFD, the Binary File Descriptor library.
@@ -16,13 +17,13 @@
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. */
+ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
/* This file contains support for merging duplicate entities within sections,
as used in ELF SHF_MERGE. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
#include "hashtab.h"
#include "libiberty.h"
@@ -90,7 +91,7 @@ struct sec_merge_sec_info
/* A hash table used to hold section content. */
struct sec_merge_hash *htab;
/* First string in this section. */
- struct sec_merge_hash_entry *first;
+ struct sec_merge_hash_entry *first_str;
/* Original section content. */
unsigned char contents[1];
};
@@ -102,30 +103,28 @@ 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)
+ if (entry == NULL)
+ entry = bfd_hash_allocate (table, sizeof (struct sec_merge_hash_entry));
+ if (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));
+ entry = bfd_hash_newfunc (entry, table, string);
- if (ret)
+ if (entry != NULL)
{
/* Initialize the local fields. */
+ struct sec_merge_hash_entry *ret = (struct sec_merge_hash_entry *) entry;
+
ret->u.suffix = NULL;
ret->alignment = 0;
ret->secinfo = NULL;
ret->next = NULL;
}
- return (struct bfd_hash_entry *) ret;
+ return entry;
}
/* Look up an entry in a section merge hash table. */
@@ -192,7 +191,7 @@ sec_merge_hash_lookup (struct sec_merge_hash *table, const char *string,
index = hash % table->table.size;
for (hashp = (struct sec_merge_hash_entry *) table->table.table[index];
- hashp != (struct sec_merge_hash_entry *) NULL;
+ hashp != NULL;
hashp = (struct sec_merge_hash_entry *) hashp->root.next)
{
if (hashp->root.hash == hash
@@ -216,13 +215,12 @@ sec_merge_hash_lookup (struct sec_merge_hash *table, const char *string,
}
if (! create)
- return (struct sec_merge_hash_entry *) NULL;
+ return 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 = ((struct sec_merge_hash_entry *)
+ sec_merge_hash_newfunc (NULL, &table->table, string));
+ if (hashp == NULL)
+ return NULL;
hashp->root.string = string;
hashp->root.hash = hash;
hashp->len = len;
@@ -239,13 +237,13 @@ 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);
+ table = bfd_malloc (sizeof (struct sec_merge_hash));
if (table == NULL)
return NULL;
- if (! bfd_hash_table_init (&table->table, sec_merge_hash_newfunc))
+ if (! bfd_hash_table_init_n (&table->table, sec_merge_hash_newfunc,
+ sizeof (struct sec_merge_hash_entry), 16699))
{
free (table);
return NULL;
@@ -292,56 +290,73 @@ 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 = "";
+ char *pad = NULL;
bfd_size_type off = 0;
- int alignment_power = bfd_get_section_alignment (abfd, sec->output_section);
+ int alignment_power = sec->output_section->alignment_power;
if (alignment_power)
- pad = bfd_zmalloc ((bfd_size_type) 1 << alignment_power);
+ {
+ pad = bfd_zmalloc ((bfd_size_type) 1 << alignment_power);
+ if (pad == NULL)
+ return FALSE;
+ }
for (; entry != NULL && entry->secinfo == secinfo; entry = entry->next)
{
- register const char *str;
- register size_t len;
+ const char *str;
+ bfd_size_type len;
- len = off & (entry->alignment - 1);
- if (len)
+ len = -off & (entry->alignment - 1);
+ if (len != 0)
{
- len = entry->alignment - len;
- if (bfd_bwrite (pad, (bfd_size_type) len, abfd) != len)
- break;
+ if (bfd_bwrite (pad, len, abfd) != len)
+ goto err;
off += len;
}
str = entry->root.string;
len = entry->len;
- if (bfd_bwrite (str, (bfd_size_type) len, abfd) != len)
- break;
+ if (bfd_bwrite (str, len, abfd) != len)
+ goto err;
off += len;
}
- if (alignment_power)
+ /* Trailing alignment needed? */
+ off = sec->size - off;
+ if (off != 0
+ && bfd_bwrite (pad, off, abfd) != off)
+ goto err;
+
+ if (pad != NULL)
free (pad);
+ return TRUE;
- return entry == NULL || entry->secinfo != secinfo;
+ err:
+ if (pad != NULL)
+ free (pad);
+ return FALSE;
}
-/* This function is called for each input file from the add_symbols
- pass of the linker. */
+/* Register a SEC_MERGE section as a candidate for merging.
+ This function is called for all non-dynamic SEC_MERGE input sections. */
bfd_boolean
-_bfd_merge_section (bfd *abfd, void **psinfo, asection *sec, void **psecinfo)
+_bfd_add_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
+ if ((abfd->flags & DYNAMIC) != 0
+ || (sec->flags & SEC_MERGE) == 0)
+ abort ();
+
+ if (sec->size == 0
+ || (sec->flags & SEC_EXCLUDE) != 0
|| sec->entsize == 0)
return TRUE;
@@ -351,12 +366,12 @@ _bfd_merge_section (bfd *abfd, void **psinfo, asection *sec, void **psecinfo)
return TRUE;
}
- align = bfd_get_section_alignment (sec->owner, sec);
- if ((sec->entsize < (unsigned int)(1 << align)
+ align = sec->alignment_power;
+ if ((sec->entsize < (unsigned) 1 << align
&& ((sec->entsize & (sec->entsize - 1))
|| !(sec->flags & SEC_STRINGS)))
- || (sec->entsize > (unsigned int)(1 << align)
- && (sec->entsize & ((1 << align) - 1))))
+ || (sec->entsize > (unsigned) 1 << align
+ && (sec->entsize & (((unsigned) 1 << align) - 1))))
{
/* Sanity check. If string character size is smaller than
alignment, then we require character size to be a power
@@ -371,14 +386,14 @@ _bfd_merge_section (bfd *abfd, void **psinfo, asection *sec, void **psecinfo)
if ((secinfo = sinfo->chain)
&& ! ((secinfo->sec->flags ^ sec->flags) & (SEC_MERGE | SEC_STRINGS))
&& secinfo->sec->entsize == sec->entsize
- && ! strcmp (secinfo->sec->name, sec->name))
+ && secinfo->sec->alignment_power == sec->alignment_power
+ && secinfo->sec->output_section == sec->output_section)
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);
+ sinfo = bfd_alloc (abfd, sizeof (struct sec_merge_info));
if (sinfo == NULL)
goto error_return;
sinfo->next = (struct sec_merge_info *) *psinfo;
@@ -391,12 +406,12 @@ _bfd_merge_section (bfd *abfd, void **psinfo, asection *sec, void **psecinfo)
/* Read the section from abfd. */
- amt = sizeof (struct sec_merge_sec_info) + sec->_raw_size - 1;
+ amt = sizeof (struct sec_merge_sec_info) + sec->size - 1;
*psecinfo = bfd_alloc (abfd, amt);
if (*psecinfo == NULL)
goto error_return;
- secinfo = (struct sec_merge_sec_info *)*psecinfo;
+ secinfo = (struct sec_merge_sec_info *) *psecinfo;
if (sinfo->chain)
{
secinfo->next = sinfo->chain->next;
@@ -408,10 +423,11 @@ _bfd_merge_section (bfd *abfd, void **psinfo, asection *sec, void **psecinfo)
secinfo->sec = sec;
secinfo->psecinfo = psecinfo;
secinfo->htab = sinfo->htab;
- secinfo->first = NULL;
+ secinfo->first_str = NULL;
+ sec->rawsize = sec->size;
if (! bfd_get_section_contents (sec->owner, sec, secinfo->contents,
- (bfd_vma) 0, sec->_raw_size))
+ 0, sec->size))
goto error_return;
return TRUE;
@@ -433,8 +449,8 @@ record_section (struct sec_merge_info *sinfo,
bfd_vma mask, eltalign;
unsigned int align, i;
- align = bfd_get_section_alignment (sec->owner, sec);
- end = secinfo->contents + sec->_raw_size;
+ align = sec->alignment_power;
+ end = secinfo->contents + sec->size;
nul = FALSE;
mask = ((bfd_vma) 1 << align) - 1;
if (sec->flags & SEC_STRINGS)
@@ -445,7 +461,8 @@ record_section (struct sec_merge_info *sinfo,
eltalign = ((eltalign ^ (eltalign - 1)) + 1) >> 1;
if (!eltalign || eltalign > mask)
eltalign = mask + 1;
- entry = sec_merge_add (sinfo->htab, p, (unsigned) eltalign, secinfo);
+ entry = sec_merge_add (sinfo->htab, (char *) p, (unsigned) eltalign,
+ secinfo);
if (! entry)
goto error_return;
p += entry->len;
@@ -476,7 +493,7 @@ record_section (struct sec_merge_info *sinfo,
if (!nul && !((p - secinfo->contents) & mask))
{
nul = TRUE;
- entry = sec_merge_add (sinfo->htab, p,
+ entry = sec_merge_add (sinfo->htab, (char *) p,
(unsigned) mask + 1, secinfo);
if (! entry)
goto error_return;
@@ -490,7 +507,7 @@ record_section (struct sec_merge_info *sinfo,
{
for (p = secinfo->contents; p < end; p += sec->entsize)
{
- entry = sec_merge_add (sinfo->htab, p, 1, secinfo);
+ entry = sec_merge_add (sinfo->htab, (char *) p, 1, secinfo);
if (! entry)
goto error_return;
}
@@ -511,8 +528,8 @@ strrevcmp (const void *a, const void *b)
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;
+ const unsigned char *s = (const unsigned char *) A->root.string + lenA - 1;
+ const unsigned char *t = (const unsigned char *) B->root.string + lenB - 1;
int l = lenA < lenB ? lenA : lenB;
while (l)
@@ -536,8 +553,8 @@ strrevcmp_align (const void *a, const void *b)
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;
+ const unsigned char *s = (const unsigned char *) A->root.string + lenA - 1;
+ const unsigned char *t = (const unsigned char *) B->root.string + lenB - 1;
int l = lenA < lenB ? lenA : lenB;
int tail_align = (lenA & (A->alignment - 1)) - (lenB & (A->alignment - 1));
@@ -580,7 +597,7 @@ merge_strings (struct sec_merge_info *sinfo)
/* Now sort the strings */
amt = sinfo->htab->size * sizeof (struct sec_merge_hash_entry *);
- array = (struct sec_merge_hash_entry **) bfd_malloc (amt);
+ array = bfd_malloc (amt);
if (array == NULL)
goto alloc_failure;
@@ -638,14 +655,14 @@ alloc_failure:
{
if (e->secinfo != secinfo)
{
- secinfo->sec->_cooked_size = size;
+ secinfo->sec->size = size;
secinfo = e->secinfo;
}
if (e->alignment)
{
- if (e->secinfo->first == NULL)
+ if (e->secinfo->first_str == NULL)
{
- e->secinfo->first = e;
+ e->secinfo->first_str = e;
size = 0;
}
size = (size + e->alignment - 1) & ~((bfd_vma) e->alignment - 1);
@@ -653,7 +670,12 @@ alloc_failure:
size += e->len;
}
}
- secinfo->sec->_cooked_size = size;
+ secinfo->sec->size = size;
+ if (secinfo->sec->alignment_power != 0)
+ {
+ bfd_size_type align = (bfd_size_type) 1 << secinfo->sec->alignment_power;
+ secinfo->sec->size = (secinfo->sec->size + align - 1) & -align;
+ }
/* And now adjust the rest, removing them from the chain (but not hashtable)
at the same time. */
@@ -676,7 +698,9 @@ alloc_failure:
with _bfd_merge_section. */
bfd_boolean
-_bfd_merge_sections (bfd *abfd ATTRIBUTE_UNUSED, void *xsinfo,
+_bfd_merge_sections (bfd *abfd ATTRIBUTE_UNUSED,
+ struct bfd_link_info *info ATTRIBUTE_UNUSED,
+ void *xsinfo,
void (*remove_hook) (bfd *, asection *))
{
struct sec_merge_info *sinfo;
@@ -722,11 +746,11 @@ _bfd_merge_sections (bfd *abfd ATTRIBUTE_UNUSED, void *xsinfo,
secinfo = NULL;
for (e = sinfo->htab->first; e; e = e->next)
{
- if (e->secinfo->first == NULL)
+ if (e->secinfo->first_str == NULL)
{
if (secinfo)
- secinfo->sec->_cooked_size = size;
- e->secinfo->first = e;
+ secinfo->sec->size = size;
+ e->secinfo->first_str = e;
size = 0;
}
size = (size + e->alignment - 1)
@@ -735,17 +759,14 @@ _bfd_merge_sections (bfd *abfd ATTRIBUTE_UNUSED, void *xsinfo,
size += e->len;
secinfo = e->secinfo;
}
- secinfo->sec->_cooked_size = size;
+ secinfo->sec->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;
- }
+ if (secinfo->first_str == NULL)
+ secinfo->sec->flags |= SEC_EXCLUDE | SEC_KEEP;
}
return TRUE;
@@ -761,14 +782,14 @@ _bfd_write_merged_section (bfd *output_bfd, asection *sec, void *psecinfo)
secinfo = (struct sec_merge_sec_info *) psecinfo;
- if (!secinfo->first)
+ if (secinfo->first_str == NULL)
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))
+ if (! sec_merge_emit (output_bfd, secinfo->first_str))
return FALSE;
return TRUE;
@@ -780,7 +801,7 @@ _bfd_write_merged_section (bfd *output_bfd, asection *sec, void *psecinfo)
bfd_vma
_bfd_merged_section_offset (bfd *output_bfd ATTRIBUTE_UNUSED, asection **psec,
- void *psecinfo, bfd_vma offset, bfd_vma addend)
+ void *psecinfo, bfd_vma offset)
{
struct sec_merge_sec_info *secinfo;
struct sec_merge_hash_entry *entry;
@@ -789,30 +810,29 @@ _bfd_merged_section_offset (bfd *output_bfd ATTRIBUTE_UNUSED, asection **psec,
secinfo = (struct sec_merge_sec_info *) psecinfo;
- if (offset + addend >= sec->_raw_size)
+ if (offset >= sec->rawsize)
{
- if (offset + addend > sec->_raw_size)
+ if (offset > sec->rawsize)
{
(*_bfd_error_handler)
- (_("%s: access beyond end of merged section (%ld + %ld)"),
- bfd_get_filename (sec->owner), (long) offset, (long) addend);
+ (_("%s: access beyond end of merged section (%ld)"),
+ bfd_get_filename (sec->owner), (long) offset);
}
- return (secinfo->first ? sec->_cooked_size : 0);
+ return secinfo->first_str ? sec->size : 0;
}
if (secinfo->htab->strings)
{
if (sec->entsize == 1)
{
- p = secinfo->contents + offset + addend - 1;
+ p = secinfo->contents + offset - 1;
while (p >= secinfo->contents && *p)
--p;
++p;
}
else
{
- p = secinfo->contents
- + ((offset + addend) / sec->entsize) * sec->entsize;
+ p = secinfo->contents + (offset / sec->entsize) * sec->entsize;
p -= sec->entsize;
while (p >= secinfo->contents)
{
@@ -830,10 +850,9 @@ _bfd_merged_section_offset (bfd *output_bfd ATTRIBUTE_UNUSED, asection **psec,
}
else
{
- p = secinfo->contents
- + ((offset + addend) / sec->entsize) * sec->entsize;
+ p = secinfo->contents + (offset / sec->entsize) * sec->entsize;
}
- entry = sec_merge_hash_lookup (secinfo->htab, p, 0, FALSE);
+ entry = sec_merge_hash_lookup (secinfo->htab, (char *) p, 0, FALSE);
if (!entry)
{
if (! secinfo->htab->strings)
@@ -845,9 +864,8 @@ _bfd_merged_section_offset (bfd *output_bfd ATTRIBUTE_UNUSED, asection **psec,
if (! secinfo->htab->first)
abort ();
entry = secinfo->htab->first;
- p = secinfo->contents
- + ((offset + addend) / sec->entsize + 1) * sec->entsize
- - entry->len;
+ p = (secinfo->contents + (offset / sec->entsize + 1) * sec->entsize
+ - entry->len);
}
*psec = entry->secinfo->sec;
diff --git a/contrib/binutils/bfd/mipsbsd.c b/contrib/binutils/bfd/mipsbsd.c
index cb2050f..6edb972 100644
--- a/contrib/binutils/bfd/mipsbsd.c
+++ b/contrib/binutils/bfd/mipsbsd.c
@@ -1,6 +1,6 @@
/* BFD backend for MIPS BSD (a.out) binaries.
- Copyright 1993, 1994, 1995, 1997, 1998, 1999, 2000, 2001, 2002, 2003
- Free Software Foundation, Inc.
+ Copyright 1993, 1994, 1995, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
+ 2007 Free Software Foundation, Inc.
Written by Ralph Campbell.
This file is part of BFD, the Binary File Descriptor library.
@@ -17,7 +17,7 @@ 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. */
+Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
/* #define ENTRY_CAN_BE_ZERO */
#define N_HEADER_IN_TEXT(x) 1
@@ -40,8 +40,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
the tokens. */
#define MY(OP) CONCAT2 (mipsbsd_,OP)
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
#include "libaout.h"
@@ -56,7 +56,8 @@ 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_bfd_reloc_type_lookup mipsbsd_reloc_type_lookup
+#define MY_bfd_reloc_name_lookup mipsbsd_reloc_name_lookup
#define MY_canonicalize_reloc mipsbsd_canonicalize_reloc
#define MY_bfd_link_hash_table_create _bfd_generic_link_hash_table_create
@@ -72,8 +73,6 @@ static bfd_boolean MY(write_object_contents) PARAMS ((bfd *abfd));
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 **));
@@ -115,7 +114,6 @@ MY (choose_reloc_size) (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;
@@ -157,9 +155,6 @@ MY (write_object_contents) (abfd)
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))
{
@@ -306,9 +301,7 @@ static reloc_howto_type mips_howto_table_ext[] = {
};
static reloc_howto_type *
-MY(reloc_howto_type_lookup) (abfd, code)
- bfd *abfd;
- bfd_reloc_code_real_type code;
+MY(reloc_type_lookup) (bfd *abfd, bfd_reloc_code_real_type code)
{
if (bfd_get_arch (abfd) != bfd_arch_mips)
@@ -334,6 +327,22 @@ MY(reloc_howto_type_lookup) (abfd, code)
}
}
+static reloc_howto_type *
+MY(reloc_name_lookup) (bfd *abfd ATTRIBUTE_UNUSED,
+ const char *r_name)
+{
+ unsigned int i;
+
+ for (i = 0;
+ i < sizeof (mips_howto_table_ext) / sizeof (mips_howto_table_ext[0]);
+ i++)
+ if (mips_howto_table_ext[i].name != NULL
+ && strcasecmp (mips_howto_table_ext[i].name, r_name) == 0)
+ return &mips_howto_table_ext[i];
+
+ return NULL;
+}
+
/* 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
diff --git a/contrib/binutils/bfd/netbsd-core.c b/contrib/binutils/bfd/netbsd-core.c
index 84f2ad7..913e862 100644
--- a/contrib/binutils/bfd/netbsd-core.c
+++ b/contrib/binutils/bfd/netbsd-core.c
@@ -1,78 +1,71 @@
/* BFD back end for NetBSD style core files
Copyright 1988, 1989, 1991, 1992, 1993, 1996, 1998, 1999, 2000, 2001,
- 2002, 2003, 2004
+ 2002, 2003, 2004, 2005, 2006, 2007
Free Software Foundation, Inc.
Written by Paul Kranenburg, EUR
-This file is part of BFD, the Binary File Descriptor library.
+ 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 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.
+ 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. */
+ 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., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
-#include "libaout.h" /* BFD a.out internal data structures */
+#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))
- */
+/* The machine ID for OpenBSD/sparc64 and older versions of
+ NetBSD/sparc64 overlaps with M_MIPS1. */
+#define M_SPARC64_OPENBSD M_MIPS1
/* Offset of StackGhost cookie within `struct md_coredump' on
OpenBSD/sparc. */
-#define CORE_WCOOKIE_OFFSET 344
+#define SPARC_WCOOKIE_OFFSET 344
-struct netbsd_core_struct {
- struct core core;
-} *rawptr;
+/* Offset of StackGhost cookie within `struct md_coredump' on
+ OpenBSD/sparc64. */
+#define SPARC64_WCOOKIE_OFFSET 832
-/* forward declarations */
+#define netbsd_core_file_matches_executable_p generic_core_file_matches_executable_p
-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));
+struct netbsd_core_struct
+{
+ struct core core;
+} *rawptr;
/* Handle NetBSD-style core dump file. */
static const bfd_target *
-netbsd_core_file_p (abfd)
- bfd *abfd;
-
+netbsd_core_file_p (bfd *abfd)
{
- int i, val;
+ int val;
+ unsigned i;
file_ptr offset;
- asection *asect, *asect2;
+ asection *asect;
struct core core;
struct coreseg coreseg;
bfd_size_type amt = sizeof core;
- val = bfd_bread ((void *) &core, amt, abfd);
+ val = bfd_bread (&core, amt, abfd);
if (val != sizeof core)
{
- /* Too small to be a core file */
+ /* Too small to be a core file. */
bfd_set_error (bfd_error_wrong_format);
return 0;
}
@@ -100,7 +93,7 @@ netbsd_core_file_p (abfd)
if (bfd_seek (abfd, offset, SEEK_SET) != 0)
goto punt;
- val = bfd_bread ((void *) &coreseg, (bfd_size_type) sizeof coreseg, abfd);
+ val = bfd_bread (&coreseg, sizeof coreseg, abfd);
if (val != sizeof coreseg)
{
bfd_set_error (bfd_error_file_truncated);
@@ -133,54 +126,103 @@ netbsd_core_file_p (abfd)
flags = SEC_ALLOC + SEC_HAS_CONTENTS;
break;
}
- asect = bfd_make_section_anyway (abfd, sname);
+ asect = bfd_make_section_anyway_with_flags (abfd, sname, flags);
if (asect == NULL)
goto punt;
- asect->flags = flags;
- asect->_raw_size = coreseg.c_size;
+ asect->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)
+ if (CORE_GETFLAG (coreseg) == CORE_CPU)
{
- /* 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;
+ bfd_size_type wcookie_offset;
+
+ switch (CORE_GETMID (core))
+ {
+ case M_SPARC_NETBSD:
+ wcookie_offset = SPARC_WCOOKIE_OFFSET;
+ break;
+ case M_SPARC64_OPENBSD:
+ wcookie_offset = SPARC64_WCOOKIE_OFFSET;
+ break;
+ default:
+ wcookie_offset = 0;
+ break;
+ }
+
+ if (wcookie_offset > 0 && coreseg.c_size > wcookie_offset)
+ {
+ /* Truncate the .reg section. */
+ asect->size = wcookie_offset;
+
+ /* And create the .wcookie section. */
+ flags = SEC_ALLOC + SEC_HAS_CONTENTS;
+ asect = bfd_make_section_anyway_with_flags (abfd, ".wcookie",
+ flags);
+ if (asect == NULL)
+ goto punt;
+
+ asect->size = coreseg.c_size - wcookie_offset;
+ asect->vma = 0;
+ asect->filepos = offset + 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
+ /* Set architecture from machine ID. */
+ switch (CORE_GETMID (core))
+ {
+ case M_ALPHA_NETBSD:
+ bfd_default_set_arch_mach (abfd, bfd_arch_alpha, 0);
+ break;
+
+ case M_ARM6_NETBSD:
+ bfd_default_set_arch_mach (abfd, bfd_arch_arm, bfd_mach_arm_3);
+ break;
+
+ case M_X86_64_NETBSD:
+ bfd_default_set_arch_mach (abfd, bfd_arch_i386, bfd_mach_x86_64);
+ break;
+
+ case M_386_NETBSD:
+ bfd_default_set_arch_mach (abfd, bfd_arch_i386, bfd_mach_i386_i386);
+ break;
+
+ case M_68K_NETBSD:
+ case M_68K4K_NETBSD:
+ bfd_default_set_arch_mach (abfd, bfd_arch_m68k, 0);
+ break;
+
+ case M_88K_OPENBSD:
+ bfd_default_set_arch_mach (abfd, bfd_arch_m88k, 0);
+ break;
+
+ case M_HPPA_OPENBSD:
+ bfd_default_set_arch_mach (abfd, bfd_arch_hppa, bfd_mach_hppa11);
+ break;
+
+ case M_POWERPC_NETBSD:
+ bfd_default_set_arch_mach (abfd, bfd_arch_powerpc, bfd_mach_ppc);
+ break;
+
+ case M_SPARC_NETBSD:
+ bfd_default_set_arch_mach (abfd, bfd_arch_sparc, bfd_mach_sparc);
+ break;
+
+ case M_SPARC64_NETBSD:
+ case M_SPARC64_OPENBSD:
+ bfd_default_set_arch_mach (abfd, bfd_arch_sparc, bfd_mach_sparc_v9);
+ break;
+
+ case M_VAX_NETBSD:
+ case M_VAX4K_NETBSD:
+ bfd_default_set_arch_mach (abfd, bfd_arch_vax, 0);
+ break;
}
/* OK, we believe you. You're a core file (sure, sure). */
@@ -194,34 +236,26 @@ netbsd_core_file_p (abfd)
}
static char*
-netbsd_core_file_failing_command (abfd)
- bfd *abfd;
+netbsd_core_file_failing_command (bfd *abfd)
{
- /*return core_command (abfd);*/
+ /*return core_command (abfd);*/
return abfd->tdata.netbsd_core_data->core.c_name;
}
static int
-netbsd_core_file_failing_signal (abfd)
- bfd *abfd;
+netbsd_core_file_failing_signal (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 ()
+swap_abort (void)
{
- abort (); /* This way doesn't require any declaration for ANSI to fuck up */
+ /* This way doesn't require any declaration for ANSI to fuck up. */
+ abort ();
}
#define NO_GET ((bfd_vma (*) (const void *)) swap_abort)
@@ -235,15 +269,16 @@ 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 */
+ 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 */
+ (SEC_HAS_CONTENTS | /* Section flags. */
+ SEC_ALLOC | SEC_LOAD | SEC_RELOC),
+ 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. */
@@ -251,17 +286,17 @@ const bfd_target netbsd_core_vec =
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_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_set_format. */
bfd_false, bfd_false,
bfd_false, bfd_false
},
- { /* bfd_write_contents */
+ { /* bfd_write_contents. */
bfd_false, bfd_false,
bfd_false, bfd_false
},
@@ -278,5 +313,5 @@ const bfd_target netbsd_core_vec =
NULL,
- (PTR) 0 /* backend_data */
+ (PTR) 0 /* Backend_data. */
};
diff --git a/contrib/binutils/bfd/netbsd.h b/contrib/binutils/bfd/netbsd.h
index 04a4eab..7182eda 100644
--- a/contrib/binutils/bfd/netbsd.h
+++ b/contrib/binutils/bfd/netbsd.h
@@ -1,23 +1,23 @@
/* BFD back-end definitions used by all NetBSD targets.
- Copyright 1990, 1991, 1992, 1994, 1995, 1996, 1997, 1998, 2000, 2002
- Free Software Foundation, Inc.
+ Copyright 1990, 1991, 1992, 1994, 1995, 1996, 1997, 1998, 2000, 2002,
+ 2005, 2007 Free Software Foundation, Inc.
-This file is part of BFD, the Binary File Descriptor library.
+ 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 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.
+ 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. */
+ 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., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301,
+ USA. */
/* Check for our machine type (part of magic number). */
#ifndef MACHTYPE_OK
@@ -31,7 +31,7 @@ USA. */
#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))
+#define N_SHARED_LIB(x) (N_DYNAMIC (x))
/* We have 6 bits of flags and 10 bits of machine ID. */
#define N_MACHTYPE(exec) \
@@ -45,13 +45,13 @@ USA. */
| (((flags) & 0x3f) << 24))
#define N_SET_MACHTYPE(exec, machtype) \
((exec).a_info = \
- ((exec).a_info & 0xfb00ffff) | ((((int) (machtype))&0x3ff) << 16))
+ ((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 "bfd.h"
#include "libbfd.h"
#include "libaout.h"
@@ -63,8 +63,9 @@ USA. */
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_write_object_contents MY (write_object_contents)
+static bfd_boolean MY (write_object_contents) (bfd *);
+
#define MY_text_includes_header 1
#include "aout-target.h"
@@ -74,8 +75,7 @@ static bfd_boolean MY(write_object_contents) PARAMS ((bfd *abfd));
file header, symbols, and relocation. */
static bfd_boolean
-MY(write_object_contents) (abfd)
- bfd *abfd;
+MY (write_object_contents) (bfd *abfd)
{
struct external_exec exec_bytes;
struct internal_exec *execp = exec_hdr (abfd);
@@ -88,20 +88,21 @@ MY(write_object_contents) (abfd)
bfd_size_type text_size;
file_ptr text_end;
- NAME(aout,adjust_sizes_and_vmas) (abfd, &text_size, &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;
- }
+ 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
@@ -112,7 +113,7 @@ MY(write_object_contents) (abfd)
| (execp->a_info & 0xff0000) >> 8 | (execp->a_info & 0xff000000) >> 24;
#endif
- WRITE_HEADERS(abfd, execp);
+ WRITE_HEADERS (abfd, execp);
return TRUE;
}
diff --git a/contrib/binutils/bfd/opncls.c b/contrib/binutils/bfd/opncls.c
index ac025e5..9e0cc26 100644
--- a/contrib/binutils/bfd/opncls.c
+++ b/contrib/binutils/bfd/opncls.c
@@ -1,6 +1,6 @@
/* opncls.c -- open and close a BFD.
Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 2000,
- 2001, 2002, 2003
+ 2001, 2002, 2003, 2004, 2005, 2006, 2007
Free Software Foundation, Inc.
Written by Cygnus Support.
@@ -19,10 +19,10 @@
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. */
+ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "objalloc.h"
#include "libbfd.h"
#include "libiberty.h"
@@ -71,13 +71,13 @@ _bfd_new_bfd (void)
nbfd->iostream = NULL;
nbfd->where = 0;
if (!bfd_hash_table_init_n (& nbfd->section_htab, bfd_section_hash_newfunc,
- 251))
+ sizeof (struct section_hash_entry), 251))
{
free (nbfd);
return NULL;
}
nbfd->sections = NULL;
- nbfd->section_tail = &nbfd->sections;
+ nbfd->section_last = NULL;
nbfd->format = bfd_unknown;
nbfd->my_archive = NULL;
nbfd->origin = 0;
@@ -103,6 +103,7 @@ _bfd_new_bfd_contained_in (bfd *obfd)
if (nbfd == NULL)
return NULL;
nbfd->xvec = obfd->xvec;
+ nbfd->iovec = obfd->iovec;
nbfd->my_archive = obfd;
nbfd->direction = read_direction;
nbfd->target_defaulted = obfd->target_defaulted;
@@ -114,38 +115,70 @@ _bfd_new_bfd_contained_in (bfd *obfd)
void
_bfd_delete_bfd (bfd *abfd)
{
- bfd_hash_table_free (&abfd->section_htab);
- objalloc_free ((struct objalloc *) abfd->memory);
+ if (abfd->memory)
+ {
+ bfd_hash_table_free (&abfd->section_htab);
+ objalloc_free ((struct objalloc *) abfd->memory);
+ }
free (abfd);
}
+/* Free objalloc memory. */
+
+bfd_boolean
+_bfd_free_cached_info (bfd *abfd)
+{
+ if (abfd->memory)
+ {
+ bfd_hash_table_free (&abfd->section_htab);
+ objalloc_free ((struct objalloc *) abfd->memory);
+
+ abfd->sections = NULL;
+ abfd->section_last = NULL;
+ abfd->outsymbols = NULL;
+ abfd->tdata.any = NULL;
+ abfd->usrdata = NULL;
+ abfd->memory = NULL;
+ }
+
+ return TRUE;
+}
+
/*
SECTION
Opening and closing BFDs
+SUBSECTION
+ Functions for opening and closing
*/
/*
FUNCTION
- bfd_openr
+ bfd_fopen
SYNOPSIS
- bfd *bfd_openr (const char *filename, const char *target);
+ bfd *bfd_fopen (const char *filename, const char *target,
+ const char *mode, int fd);
DESCRIPTION
- Open the file @var{filename} (using <<fopen>>) with the target
- @var{target}. Return a pointer to the created BFD.
+ Open the file @var{filename} with the target @var{target}.
+ Return a pointer to the created BFD. If @var{fd} is not -1,
+ then <<fdopen>> is used to open the file; otherwise, <<fopen>>
+ is used. @var{mode} is passed directly to <<fopen>> or
+ <<fdopen>>.
Calls <<bfd_find_target>>, so @var{target} is interpreted as by
that function.
+ The new BFD is marked as cacheable iff @var{fd} is -1.
+
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_fopen (const char *filename, const char *target, const char *mode, int fd)
{
bfd *nbfd;
const bfd_target *target_vec;
@@ -160,21 +193,74 @@ bfd_openr (const char *filename, const char *target)
_bfd_delete_bfd (nbfd);
return NULL;
}
+
+#ifdef HAVE_FDOPEN
+ if (fd != -1)
+ nbfd->iostream = fdopen (fd, mode);
+ else
+#endif
+ nbfd->iostream = real_fopen (filename, mode);
+ if (nbfd->iostream == NULL)
+ {
+ bfd_set_error (bfd_error_system_call);
+ _bfd_delete_bfd (nbfd);
+ return NULL;
+ }
+ /* OK, put everything where it belongs. */
nbfd->filename = filename;
- nbfd->direction = read_direction;
- if (bfd_open_file (nbfd) == NULL)
+ /* Figure out whether the user is opening the file for reading,
+ writing, or both, by looking at the MODE argument. */
+ if ((mode[0] == 'r' || mode[0] == 'w' || mode[0] == 'a')
+ && mode[1] == '+')
+ nbfd->direction = both_direction;
+ else if (mode[0] == 'r')
+ nbfd->direction = read_direction;
+ else
+ nbfd->direction = write_direction;
+
+ if (! bfd_cache_init (nbfd))
{
- /* File didn't exist, or some such. */
- bfd_set_error (bfd_error_system_call);
_bfd_delete_bfd (nbfd);
return NULL;
}
+ nbfd->opened_once = TRUE;
+ /* If we opened the file by name, mark it cacheable; we can close it
+ and reopen it later. However, if a file descriptor was provided,
+ then it may have been opened with special flags that make it
+ unsafe to close and reopen the file. */
+ if (fd == -1)
+ bfd_set_cacheable (nbfd, TRUE);
return nbfd;
}
+/*
+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)
+{
+ return bfd_fopen (filename, target, FOPEN_RB, -1);
+}
+
/* Don't try to `optimize' this function:
o - We lock using stack space so that interrupting the locking
@@ -211,93 +297,238 @@ DESCRIPTION
bfd *
bfd_fdopenr (const char *filename, const char *target, int fd)
{
- bfd *nbfd;
- const bfd_target *target_vec;
+ const char *mode;
+#if defined(HAVE_FCNTL) && defined(F_GETFL)
int fdflags;
+#endif
- bfd_set_error (bfd_error_system_call);
#if ! defined(HAVE_FCNTL) || ! defined(F_GETFL)
- fdflags = O_RDWR; /* Assume full access. */
+ mode = FOPEN_RUB; /* 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);
+ bfd_set_error (bfd_error_system_call);
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;
+ case O_RDONLY: mode = FOPEN_RB; break;
+ case O_WRONLY: mode = FOPEN_RUB; break;
+ case O_RDWR: mode = FOPEN_RUB; break;
default: abort ();
}
#endif
- if (nbfd->iostream == NULL)
+ return bfd_fopen (filename, target, mode, fd);
+}
+
+/*
+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;
}
- /* OK, put everything where it belongs. */
+ nbfd->iostream = stream;
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 ();
- }
+ nbfd->direction = read_direction;
if (! bfd_cache_init (nbfd))
{
_bfd_delete_bfd (nbfd);
return NULL;
}
- nbfd->opened_once = TRUE;
return nbfd;
}
/*
FUNCTION
- bfd_openstreamr
+ bfd_openr_iovec
SYNOPSIS
- bfd *bfd_openstreamr (const char *, const char *, void *);
+ bfd *bfd_openr_iovec (const char *filename, const char *target,
+ void *(*open) (struct bfd *nbfd,
+ void *open_closure),
+ void *open_closure,
+ file_ptr (*pread) (struct bfd *nbfd,
+ void *stream,
+ void *buf,
+ file_ptr nbytes,
+ file_ptr offset),
+ int (*close) (struct bfd *nbfd,
+ void *stream),
+ int (*stat) (struct bfd *abfd,
+ void *stream,
+ struct stat *sb));
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.
+ Create and return a BFD backed by a read-only @var{stream}.
+ The @var{stream} is created using @var{open}, accessed using
+ @var{pread} and destroyed using @var{close}.
+
+ Calls <<bfd_find_target>>, so @var{target} is interpreted as by
+ that function.
+
+ Calls @var{open} (which can call <<bfd_zalloc>> and
+ <<bfd_get_filename>>) to obtain the read-only stream backing
+ the BFD. @var{open} either succeeds returning the
+ non-<<NULL>> @var{stream}, or fails returning <<NULL>>
+ (setting <<bfd_error>>).
+
+ Calls @var{pread} to request @var{nbytes} of data from
+ @var{stream} starting at @var{offset} (e.g., via a call to
+ <<bfd_read>>). @var{pread} either succeeds returning the
+ number of bytes read (which can be less than @var{nbytes} when
+ end-of-file), or fails returning -1 (setting <<bfd_error>>).
+
+ Calls @var{close} when the BFD is later closed using
+ <<bfd_close>>. @var{close} either succeeds returning 0, or
+ fails returning -1 (setting <<bfd_error>>).
+
+ Calls @var{stat} to fill in a stat structure for bfd_stat,
+ bfd_get_size, and bfd_get_mtime calls. @var{stat} returns 0
+ on success, or returns -1 on failure (setting <<bfd_error>>).
+
+ If <<bfd_openr_iovec>> returns <<NULL>> then an error has
+ occurred. Possible errors are <<bfd_error_no_memory>>,
+ <<bfd_error_invalid_target>> and <<bfd_error_system_call>>.
+
*/
+struct opncls
+{
+ void *stream;
+ file_ptr (*pread) (struct bfd *abfd, void *stream, void *buf,
+ file_ptr nbytes, file_ptr offset);
+ int (*close) (struct bfd *abfd, void *stream);
+ int (*stat) (struct bfd *abfd, void *stream, struct stat *sb);
+ file_ptr where;
+};
+
+static file_ptr
+opncls_btell (struct bfd *abfd)
+{
+ struct opncls *vec = abfd->iostream;
+ return vec->where;
+}
+
+static int
+opncls_bseek (struct bfd *abfd, file_ptr offset, int whence)
+{
+ struct opncls *vec = abfd->iostream;
+ switch (whence)
+ {
+ case SEEK_SET: vec->where = offset; break;
+ case SEEK_CUR: vec->where += offset; break;
+ case SEEK_END: return -1;
+ }
+ return 0;
+}
+
+static file_ptr
+opncls_bread (struct bfd *abfd, void *buf, file_ptr nbytes)
+{
+ struct opncls *vec = abfd->iostream;
+ file_ptr nread = (vec->pread) (abfd, vec->stream, buf, nbytes, vec->where);
+ if (nread < 0)
+ return nread;
+ vec->where += nread;
+ return nread;
+}
+
+static file_ptr
+opncls_bwrite (struct bfd *abfd ATTRIBUTE_UNUSED,
+ const void *where ATTRIBUTE_UNUSED,
+ file_ptr nbytes ATTRIBUTE_UNUSED)
+{
+ return -1;
+}
+
+static int
+opncls_bclose (struct bfd *abfd)
+{
+ struct opncls *vec = abfd->iostream;
+ /* Since the VEC's memory is bound to the bfd deleting the bfd will
+ free it. */
+ int status = 0;
+ if (vec->close != NULL)
+ status = (vec->close) (abfd, vec->stream);
+ abfd->iostream = NULL;
+ return status;
+}
+
+static int
+opncls_bflush (struct bfd *abfd ATTRIBUTE_UNUSED)
+{
+ return 0;
+}
+
+static int
+opncls_bstat (struct bfd *abfd, struct stat *sb)
+{
+ struct opncls *vec = abfd->iostream;
+
+ memset (sb, 0, sizeof (*sb));
+ if (vec->stat == NULL)
+ return 0;
+
+ return (vec->stat) (abfd, vec->stream, sb);
+}
+
+static const struct bfd_iovec opncls_iovec = {
+ &opncls_bread, &opncls_bwrite, &opncls_btell, &opncls_bseek,
+ &opncls_bclose, &opncls_bflush, &opncls_bstat
+};
+
bfd *
-bfd_openstreamr (const char *filename, const char *target, void *streamarg)
+bfd_openr_iovec (const char *filename, const char *target,
+ void *(*open) (struct bfd *nbfd,
+ void *open_closure),
+ void *open_closure,
+ file_ptr (*pread) (struct bfd *abfd,
+ void *stream,
+ void *buf,
+ file_ptr nbytes,
+ file_ptr offset),
+ int (*close) (struct bfd *nbfd,
+ void *stream),
+ int (*stat) (struct bfd *abfd,
+ void *stream,
+ struct stat *sb))
{
- FILE *stream = streamarg;
bfd *nbfd;
const bfd_target *target_vec;
+ struct opncls *vec;
+ void *stream;
nbfd = _bfd_new_bfd ();
if (nbfd == NULL)
@@ -310,16 +541,25 @@ bfd_openstreamr (const char *filename, const char *target, void *streamarg)
return NULL;
}
- nbfd->iostream = stream;
nbfd->filename = filename;
nbfd->direction = read_direction;
- if (! bfd_cache_init (nbfd))
+ stream = open (nbfd, open_closure);
+ if (stream == NULL)
{
_bfd_delete_bfd (nbfd);
return NULL;
}
+ vec = bfd_zalloc (nbfd, sizeof (struct opncls));
+ vec->stream = stream;
+ vec->pread = pread;
+ vec->close = close;
+ vec->stat = stat;
+
+ nbfd->iovec = &opncls_iovec;
+ nbfd->iostream = vec;
+
return nbfd;
}
@@ -415,7 +655,12 @@ bfd_close (bfd *abfd)
if (! BFD_SEND (abfd, _close_and_cleanup, (abfd)))
return FALSE;
- ret = bfd_cache_close (abfd);
+ /* FIXME: cagney/2004-02-15: Need to implement a BFD_IN_MEMORY io
+ vector. */
+ if (!(abfd->flags & BFD_IN_MEMORY))
+ ret = abfd->iovec->bclose (abfd);
+ else
+ ret = TRUE;
/* If the file was open for writing and is now executable,
make it so. */
@@ -630,14 +875,13 @@ INTERNAL_FUNCTION
bfd_alloc
SYNOPSIS
- void *bfd_alloc (bfd *abfd, size_t wanted);
+ void *bfd_alloc (bfd *abfd, bfd_size_type 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)
{
@@ -655,6 +899,57 @@ bfd_alloc (bfd *abfd, bfd_size_type size)
return ret;
}
+/*
+INTERNAL_FUNCTION
+ bfd_alloc2
+
+SYNOPSIS
+ void *bfd_alloc2 (bfd *abfd, bfd_size_type nmemb, bfd_size_type size);
+
+DESCRIPTION
+ Allocate a block of @var{nmemb} elements of @var{size} bytes each
+ of memory attached to <<abfd>> and return a pointer to it.
+*/
+
+void *
+bfd_alloc2 (bfd *abfd, bfd_size_type nmemb, bfd_size_type size)
+{
+ void *ret;
+
+ if ((nmemb | size) >= HALF_BFD_SIZE_TYPE
+ && size != 0
+ && nmemb > ~(bfd_size_type) 0 / size)
+ {
+ bfd_set_error (bfd_error_no_memory);
+ return NULL;
+ }
+
+ size *= nmemb;
+
+ 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;
+}
+
+/*
+INTERNAL_FUNCTION
+ bfd_zalloc
+
+SYNOPSIS
+ void *bfd_zalloc (bfd *abfd, bfd_size_type wanted);
+
+DESCRIPTION
+ Allocate a block of @var{wanted} bytes of zeroed memory
+ attached to <<abfd>> and return a pointer to it.
+*/
+
void *
bfd_zalloc (bfd *abfd, bfd_size_type size)
{
@@ -666,6 +961,39 @@ bfd_zalloc (bfd *abfd, bfd_size_type size)
return res;
}
+/*
+INTERNAL_FUNCTION
+ bfd_zalloc2
+
+SYNOPSIS
+ void *bfd_zalloc2 (bfd *abfd, bfd_size_type nmemb, bfd_size_type size);
+
+DESCRIPTION
+ Allocate a block of @var{nmemb} elements of @var{size} bytes each
+ of zeroed memory attached to <<abfd>> and return a pointer to it.
+*/
+
+void *
+bfd_zalloc2 (bfd *abfd, bfd_size_type nmemb, bfd_size_type size)
+{
+ void *res;
+
+ if ((nmemb | size) >= HALF_BFD_SIZE_TYPE
+ && size != 0
+ && nmemb > ~(bfd_size_type) 0 / size)
+ {
+ bfd_set_error (bfd_error_no_memory);
+ return NULL;
+ }
+
+ size *= nmemb;
+
+ 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! */
@@ -676,9 +1004,9 @@ bfd_release (bfd *abfd, void *block)
}
-/*
- GNU Extension: separate debug-info files
-
+/*
+ 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
@@ -706,7 +1034,7 @@ DESCRIPTION
RETURNS
Return the updated CRC32 value.
-*/
+*/
unsigned long
bfd_calc_gnu_debuglink_crc32 (unsigned long crc,
@@ -793,12 +1121,11 @@ DESCRIPTION
static char *
get_debug_link_info (bfd *abfd, unsigned long *crc32_out)
{
- asection * sect;
- bfd_size_type debuglink_size;
+ asection *sect;
unsigned long crc32;
- char * contents;
+ bfd_byte *contents;
int crc_offset;
- bfd_boolean ret;
+ char *name;
BFD_ASSERT (abfd);
BFD_ASSERT (crc32_out);
@@ -808,27 +1135,22 @@ get_debug_link_info (bfd *abfd, unsigned long *crc32_out)
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)
+ if (!bfd_malloc_and_get_section (abfd, sect, &contents))
{
- free (contents);
+ if (contents != NULL)
+ free (contents);
return NULL;
}
/* Crc value is stored after the filename, aligned up to 4 bytes. */
- crc_offset = strlen (contents) + 1;
+ name = (char *) contents;
+ crc_offset = strlen (name) + 1;
crc_offset = (crc_offset + 3) & ~3;
crc32 = bfd_get_32 (abfd, contents + crc_offset);
*crc32_out = crc32;
- return contents;
+ return name;
}
/*
@@ -847,7 +1169,7 @@ DESCRIPTION
static bfd_boolean
separate_debug_file_exists (const char *name, const unsigned long crc)
{
- static char buffer [8 * 1024];
+ static unsigned char buffer [8 * 1024];
unsigned long file_crc = 0;
int fd;
bfd_size_type count;
@@ -917,19 +1239,19 @@ find_separate_debug_file (bfd *abfd, const char *debug_file_directory)
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')
+ BFD_ASSERT (dir[i] == '/' || dir[0] == '\0');
debugfile = malloc (strlen (debug_file_directory) + 1
+ strlen (dir)
+ strlen (".debug/")
- + strlen (basename)
+ + strlen (basename)
+ 1);
if (debugfile == NULL)
{
@@ -1014,10 +1336,6 @@ RETURNS
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);
}
@@ -1036,7 +1354,7 @@ DESCRIPTION
RETURNS
A pointer to the new section is returned if all is ok. Otherwise <<NULL>> is
- returned and bfd_error is set.
+ returned and bfd_error is set.
*/
asection *
@@ -1044,6 +1362,7 @@ bfd_create_gnu_debuglink_section (bfd *abfd, const char *filename)
{
asection *sect;
bfd_size_type debuglink_size;
+ flagword flags;
if (abfd == NULL || filename == NULL)
{
@@ -1053,7 +1372,7 @@ bfd_create_gnu_debuglink_section (bfd *abfd, const char *filename)
/* Strip off any path components in filename. */
filename = lbasename (filename);
-
+
sect = bfd_get_section_by_name (abfd, GNU_DEBUGLINK);
if (sect)
{
@@ -1062,16 +1381,11 @@ bfd_create_gnu_debuglink_section (bfd *abfd, const char *filename)
return NULL;
}
- sect = bfd_make_section (abfd, GNU_DEBUGLINK);
+ flags = SEC_HAS_CONTENTS | SEC_READONLY | SEC_DEBUGGING;
+ sect = bfd_make_section_with_flags (abfd, GNU_DEBUGLINK, flags);
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;
@@ -1080,7 +1394,7 @@ bfd_create_gnu_debuglink_section (bfd *abfd, const char *filename)
if (! bfd_set_section_size (abfd, sect, debuglink_size))
/* XXX Should we delete the section from the bfd ? */
return NULL;
-
+
return sect;
}
@@ -1102,7 +1416,7 @@ DESCRIPTION
RETURNS
<<TRUE>> is returned if all is ok. Otherwise <<FALSE>> is returned
- and bfd_error is set.
+ and bfd_error is set.
*/
bfd_boolean
@@ -1115,7 +1429,7 @@ bfd_fill_in_gnu_debuglink_section (bfd *abfd,
char * contents;
bfd_size_type crc_offset;
FILE * handle;
- static char buffer[8 * 1024];
+ static unsigned char buffer[8 * 1024];
size_t count;
if (abfd == NULL || sect == NULL || filename == NULL)
@@ -1130,7 +1444,7 @@ bfd_fill_in_gnu_debuglink_section (bfd *abfd,
.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);
+ handle = real_fopen (filename, FOPEN_RB);
if (handle == NULL)
{
bfd_set_error (bfd_error_system_call);
@@ -1145,7 +1459,7 @@ bfd_fill_in_gnu_debuglink_section (bfd *abfd,
/* 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;
diff --git a/contrib/binutils/bfd/osf-core.c b/contrib/binutils/bfd/osf-core.c
index 8273504..b9472ab 100644
--- a/contrib/binutils/bfd/osf-core.c
+++ b/contrib/binutils/bfd/osf-core.c
@@ -1,6 +1,6 @@
/* BFD back-end for OSF/1 core files.
- Copyright 1993, 1994, 1995, 1998, 1999, 2001, 2002, 2003, 2004
- Free Software Foundation, Inc.
+ Copyright 1993, 1994, 1995, 1998, 1999, 2001, 2002, 2003, 2004, 2006,
+ 2007 Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@@ -16,17 +16,19 @@ 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. */
+Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
/* This file can only be compiled on systems which use OSF/1 style
core files. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
#include <sys/user.h>
+#ifdef OSF_CORE
#include <sys/core.h>
+#endif
/* forward declarations */
@@ -38,8 +40,7 @@ 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 *));
+#define osf_core_core_file_matches_executable_p generic_core_file_matches_executable_p
static void swap_abort
PARAMS ((void));
@@ -56,22 +57,21 @@ struct osf_core_struct
#define core_command(bfd) (core_hdr(bfd)->cmd)
static asection *
-make_bfd_asection (abfd, name, flags, _raw_size, vma, filepos)
+make_bfd_asection (abfd, name, flags, size, vma, filepos)
bfd *abfd;
const char *name;
flagword flags;
- bfd_size_type _raw_size;
+ bfd_size_type size;
bfd_vma vma;
file_ptr filepos;
{
asection *asect;
- asect = bfd_make_section_anyway (abfd, name);
+ asect = bfd_make_section_anyway_with_flags (abfd, name, flags);
if (!asect)
return NULL;
- asect->flags = flags;
- asect->_raw_size = _raw_size;
+ asect->size = size;
asect->vma = vma;
asect->filepos = filepos;
asect->alignment_power = 8;
@@ -94,7 +94,7 @@ osf_core_core_file_p (abfd)
if (val != sizeof core_header)
return NULL;
- if (strncmp (core_header.magic, "Core", 4) != 0)
+ if (! CONST_STRNEQ (core_header.magic, "Core"))
return NULL;
core_hdr (abfd) = (struct osf_core_struct *)
@@ -170,14 +170,6 @@ osf_core_core_file_failing_signal (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
diff --git a/contrib/binutils/bfd/pe-arm-wince.c b/contrib/binutils/bfd/pe-arm-wince.c
new file mode 100644
index 0000000..a13594f
--- /dev/null
+++ b/contrib/binutils/bfd/pe-arm-wince.c
@@ -0,0 +1,37 @@
+/* BFD back-end for ARM WINCE PE files.
+ Copyright 2006 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., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#define TARGET_UNDERSCORE 0
+#define USER_LABEL_PREFIX ""
+
+#define TARGET_LITTLE_SYM arm_wince_pe_little_vec
+#define TARGET_LITTLE_NAME "pe-arm-wince-little"
+#define TARGET_BIG_SYM arm_wince_pe_big_vec
+#define TARGET_BIG_NAME "pe-arm-wince-big"
+
+#define bfd_arm_allocate_interworking_sections \
+ bfd_arm_wince_pe_allocate_interworking_sections
+#define bfd_arm_get_bfd_for_interworking \
+ bfd_arm_wince_pe_get_bfd_for_interworking
+#define bfd_arm_process_before_allocation \
+ bfd_arm_wince_pe_process_before_allocation
+
+#define LOCAL_LABEL_PREFIX "."
+
+#include "pe-arm.c"
diff --git a/contrib/binutils/bfd/pe-arm.c b/contrib/binutils/bfd/pe-arm.c
index 8b5d1c7..5700e23 100644
--- a/contrib/binutils/bfd/pe-arm.c
+++ b/contrib/binutils/bfd/pe-arm.c
@@ -1,5 +1,6 @@
/* BFD back-end for ARM PECOFF files.
- Copyright 1995, 1996, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
+ Copyright 1995, 1996, 1999, 2000, 2001, 2002, 2007
+ Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@@ -15,10 +16,21 @@ 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. */
+Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
+
+/* Do this before including bfd.h, so we prototype the right functions. */
+
+#ifndef bfd_arm_allocate_interworking_sections
+#define bfd_arm_allocate_interworking_sections \
+ bfd_armpe_allocate_interworking_sections
+#define bfd_arm_get_bfd_for_interworking \
+ bfd_armpe_get_bfd_for_interworking
+#define bfd_arm_process_before_allocation \
+ bfd_armpe_process_before_allocation
+#endif
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#ifndef TARGET_LITTLE_SYM
#define TARGET_LITTLE_SYM armpe_little_vec
@@ -31,17 +43,22 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#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
+#define COFF_SECTION_ALIGNMENT_ENTRIES \
+{ COFF_SECTION_NAME_EXACT_MATCH (".bss"), \
+ COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 2 }, \
+{ COFF_SECTION_NAME_EXACT_MATCH (".data"), \
+ COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 2 }, \
+{ COFF_SECTION_NAME_EXACT_MATCH (".rdata"), \
+ COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 2 }, \
+{ COFF_SECTION_NAME_EXACT_MATCH (".text"), \
+ COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 2 }, \
+{ 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 }, \
+{ COFF_SECTION_NAME_PARTIAL_MATCH (".debug"), \
+ COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 0 }, \
+{ COFF_SECTION_NAME_PARTIAL_MATCH (".gnu.linkonce.wi."), \
+ COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 0 }
#include "coff-arm.c"
diff --git a/contrib/binutils/bfd/pe-i386.c b/contrib/binutils/bfd/pe-i386.c
index a912cff..72aacf0 100644
--- a/contrib/binutils/bfd/pe-i386.c
+++ b/contrib/binutils/bfd/pe-i386.c
@@ -1,5 +1,6 @@
/* BFD back-end for Intel 386 PECOFF files.
- Copyright 1995, 1996, 1999, 2001, 2002 Free Software Foundation, Inc.
+ Copyright 1995, 1996, 1999, 2001, 2002, 2004, 2007
+ Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@@ -15,17 +16,18 @@
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. */
+ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
-#define TARGET_SYM i386pe_vec
-#define TARGET_NAME "pe-i386"
+#define TARGET_SYM i386pe_vec
+#define TARGET_NAME "pe-i386"
#define COFF_WITH_PE
-#define PCRELOFFSET TRUE
-#define TARGET_UNDERSCORE '_'
+#define PCRELOFFSET TRUE
+#define TARGET_UNDERSCORE '_'
#define COFF_LONG_SECTION_NAMES
+#define COFF_SUPPORT_GNU_LINKONCE
#define COFF_LONG_FILENAMES
#define COFF_SECTION_ALIGNMENT_ENTRIES \
@@ -33,11 +35,23 @@
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_PARTIAL_MATCH (".data$"), \
+ COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 4 }, \
+{ COFF_SECTION_NAME_EXACT_MATCH (".rdata"), \
+ COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 4 }, \
+{ COFF_SECTION_NAME_PARTIAL_MATCH (".rdata$"), \
+ 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 (".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 }
+ COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 2 }, \
+{ COFF_SECTION_NAME_PARTIAL_MATCH (".debug"), \
+ COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 0 }, \
+{ COFF_SECTION_NAME_PARTIAL_MATCH (".gnu.linkonce.wi."), \
+ COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 0 }
#include "coff-i386.c"
diff --git a/contrib/binutils/bfd/pe-mips.c b/contrib/binutils/bfd/pe-mips.c
index 3066aaa..628cecf 100644
--- a/contrib/binutils/bfd/pe-mips.c
+++ b/contrib/binutils/bfd/pe-mips.c
@@ -1,70 +1,37 @@
/* 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.
+ 2000, 2001, 2002, 2003, 2004, 2005, 2007 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 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 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.
+ 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. */
+ 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., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
#define COFF_WITH_PE
#define COFF_LONG_SECTION_NAMES
#define PCRELOFFSET TRUE
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.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)
+#define COFF_DEFAULT_SECTION_ALIGNMENT_POWER 2
/* The page size is a guess based on ELF. */
#define COFF_PAGE_SIZE 0x1000
@@ -79,19 +46,17 @@ static bfd_boolean coff_pe_mips_relocate_section
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;
+coff_mips_reloc (bfd *abfd,
+ arelent *reloc_entry,
+ asymbol *symbol,
+ void * data,
+ asection *input_section ATTRIBUTE_UNUSED,
+ bfd *output_bfd,
+ char **error_message ATTRIBUTE_UNUSED)
{
symvalue diff;
- if (output_bfd == (bfd *) NULL)
+ if (output_bfd == NULL)
return bfd_reloc_continue;
if (bfd_is_com_section (symbol->section))
@@ -115,22 +80,11 @@ coff_mips_reloc (abfd, reloc_entry, symbol, data, input_section, output_bfd,
#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
+ /* 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;
#define DOIT(x) \
x = ((x & ~howto->dst_mask) | (((x & howto->src_mask) + (diff >> howto->rightshift)) & howto->dst_mask))
@@ -145,6 +99,7 @@ coff_mips_reloc (abfd, reloc_entry, symbol, data, input_section, output_bfd,
case 0:
{
char x = bfd_get_8 (abfd, addr);
+
DOIT (x);
bfd_put_8 (abfd, x, addr);
}
@@ -153,6 +108,7 @@ coff_mips_reloc (abfd, reloc_entry, symbol, data, input_section, output_bfd,
case 1:
{
short x = bfd_get_16 (abfd, addr);
+
DOIT (x);
bfd_put_16 (abfd, (bfd_vma) x, addr);
}
@@ -161,6 +117,7 @@ coff_mips_reloc (abfd, reloc_entry, symbol, data, input_section, output_bfd,
case 2:
{
long x = bfd_get_32 (abfd, addr);
+
DOIT (x);
bfd_put_32 (abfd, (bfd_vma) x, addr);
}
@@ -180,9 +137,7 @@ coff_mips_reloc (abfd, reloc_entry, symbol, data, input_section, output_bfd,
appear in the output .reloc section. */
static bfd_boolean
-in_reloc_p (abfd, howto)
- bfd * abfd ATTRIBUTE_UNUSED;
- reloc_howto_type *howto;
+in_reloc_p (bfd * abfd ATTRIBUTE_UNUSED, reloc_howto_type *howto)
{
return ! howto->pc_relative && howto->type != MIPS_R_RVA;
}
@@ -197,130 +152,130 @@ 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 */
+ 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 */
+ 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 */
+ 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 */
+ 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 */
+ 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 */
+ 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 */
+ 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 */
+ 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 */
+ 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),
@@ -348,41 +303,43 @@ static reloc_howto_type howto_table[] =
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 */
+ 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 */
+ 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 */
+/* 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 SELECT_RELOC(x, howto) { x.r_type = howto->type; }
+#define BADMAG(x) MIPSBADMAG (x)
+
+/* Customize coffcode.h. */
+#define MIPS 1
#define RTYPE2HOWTO(cache_ptr, dst) \
(cache_ptr)->howto = howto_table + (dst)->r_type;
@@ -402,17 +359,17 @@ static reloc_howto_type howto_table[] =
#define CALC_ADDEND(abfd, ptr, reloc, cache_ptr) \
{ \
- coff_symbol_type *coffsym = (coff_symbol_type *) NULL; \
+ coff_symbol_type *coffsym = 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 \
+ if (coffsym != 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) \
+ && ptr->section != NULL) \
cache_ptr->addend = - (ptr->section->vma + ptr->value); \
else \
cache_ptr->addend = 0; \
@@ -423,13 +380,12 @@ static reloc_howto_type howto_table[] =
/* 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;
+coff_mips_rtype_to_howto (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;
@@ -489,24 +445,21 @@ coff_mips_rtype_to_howto (abfd, sec, rel, h, sym, addendp)
}
if (rel->r_type == MIPS_R_RVA)
- {
- *addendp -= pe_data(sec->output_section->owner)->pe_opthdr.ImageBase;
- }
+ *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
+#define coff_rtype_to_howto coff_mips_rtype_to_howto
+#define coff_bfd_reloc_type_lookup coff_mips_reloc_type_lookup
+#define coff_bfd_reloc_name_lookup coff_mips_reloc_name_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;
+coff_mips_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED,
+ bfd_reloc_code_real_type code)
{
int mips_type;
@@ -534,35 +487,34 @@ coff_mips_reloc_type_lookup (abfd, code)
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 NULL;
}
- return &howto_table[mips_type];
+ return & howto_table [mips_type];
+}
+
+static reloc_howto_type *
+coff_mips_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED,
+ const char *r_name)
+{
+ unsigned int i;
+
+ for (i = 0;
+ i < sizeof (howto_table) / sizeof (howto_table[0]);
+ i++)
+ if (howto_table[i].name != NULL
+ && strcasecmp (howto_table[i].name, r_name) == 0)
+ return &howto_table[i];
+
+ return NULL;
}
static void
-mips_swap_reloc_in (abfd, src, dst)
- bfd *abfd;
- PTR src;
- PTR dst;
+mips_swap_reloc_in (bfd * abfd, void * src, void * dst)
{
static struct internal_reloc pair_prev;
RELOC *reloc_src = (RELOC *) src;
@@ -584,17 +536,13 @@ mips_swap_reloc_in (abfd, src, dst)
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;
+mips_swap_reloc_out (bfd * abfd, void * src, void * dst)
{
static int prev_offset = 1;
static bfd_vma prev_addr = 0;
@@ -629,22 +577,19 @@ mips_swap_reloc_out (abfd, src, dst)
return RELSZ;
}
-#define coff_swap_reloc_in mips_swap_reloc_in
-#define coff_swap_reloc_out mips_swap_reloc_out
+#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;
+coff_pe_mips_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)
{
bfd_vma gp;
bfd_boolean gp_undefined;
@@ -655,35 +600,23 @@ coff_pe_mips_relocate_section (output_bfd, info, input_bfd,
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_error_handler)
+ (_("%B: `ld -r' not supported with PE MIPS objects\n"), 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;
-
+ gp_undefined = (gp == 0) ? TRUE : 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;
@@ -779,57 +712,49 @@ coff_pe_mips_relocate_section (output_bfd, info, input_bfd,
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
- */
+ 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); \
+#define UI(x) (*_bfd_error_handler) (_("%B: unimplemented %s\n"), \
+ input_bfd, x); \
bfd_set_error (bfd_error_bad_value);
switch (rel->r_type)
{
case MIPS_R_ABSOLUTE:
- /* ignore these */
+ /* Ignore these. */
break;
case MIPS_R_REFHALF:
- UI("refhalf");
+ UI ("refhalf");
break;
case MIPS_R_REFWORD:
- tmp = bfd_get_32(input_bfd, mem);
+ 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);
+ bfd_put_32 (input_bfd, tmp, mem);
break;
case MIPS_R_JMPADDR:
- tmp = bfd_get_32(input_bfd, mem);
- targ = val + (tmp&0x03ffffff)*4;
+ 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_error_handler) (_("%B: jump too far away\n"), input_bfd);
bfd_set_error (bfd_error_bad_value);
return FALSE;
}
tmp &= 0xfc000000;
- tmp |= (targ/4) & 0x3ffffff;
- bfd_put_32(input_bfd, tmp, mem);
+ tmp |= (targ / 4) & 0x3ffffff;
+ bfd_put_32 (input_bfd, tmp, mem);
break;
case MIPS_R_REFHI:
- tmp = bfd_get_32(input_bfd, mem);
+ tmp = bfd_get_32 (input_bfd, mem);
switch (rel[1].r_type)
{
case MIPS_R_PAIR:
@@ -838,51 +763,51 @@ coff_pe_mips_relocate_section (output_bfd, info, input_bfd,
break;
case MIPS_R_REFLO:
/* GNU COFF object */
- low = bfd_get_32(input_bfd, contents + rel[1].r_vaddr);
+ 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_error_handler) (_("%B: bad pair/reflo after refhi\n"),
+ input_bfd);
bfd_set_error (bfd_error_bad_value);
return FALSE;
}
tmp &= 0xffff0000;
tmp |= (targ >> 16) & 0xffff;
- bfd_put_32(input_bfd, tmp, mem);
+ bfd_put_32 (input_bfd, tmp, mem);
break;
case MIPS_R_REFLO:
- tmp = bfd_get_32(input_bfd, mem);
+ 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);
+ bfd_put_32 (input_bfd, tmp, mem);
break;
case MIPS_R_GPREL:
case MIPS_R_LITERAL:
- UI("gprel");
+ UI ("gprel");
break;
case MIPS_R_SECTION:
- UI("section");
+ UI ("section");
break;
case MIPS_R_SECREL:
- UI("secrel");
+ UI ("secrel");
break;
case MIPS_R_SECRELLO:
- UI("secrello");
+ UI ("secrello");
break;
case MIPS_R_SECRELHI:
- UI("secrelhi");
+ UI ("secrelhi");
break;
case MIPS_R_RVA:
@@ -910,13 +835,8 @@ coff_pe_mips_relocate_section (output_bfd, info, input_bfd,
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;
+coff_mips_is_local_label_name (bfd *abfd, const char *name)
{
if (name[0] == 'L')
return TRUE;
@@ -942,57 +862,57 @@ const bfd_target
#ifdef TARGET_NAME
TARGET_NAME,
#else
- "pe-mips", /* name */
+ "pe-mips", /* Name. */
#endif
bfd_target_coff_flavour,
- BFD_ENDIAN_LITTLE, /* data byte order is little */
- BFD_ENDIAN_LITTLE, /* header byte order is little */
+ BFD_ENDIAN_LITTLE, /* Data byte order is little. */
+ BFD_ENDIAN_LITTLE, /* Header byte order is little. */
- (HAS_RELOC | EXEC_P | /* object flags */
+ (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_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_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 */
+ TARGET_UNDERSCORE, /* Leading underscore. */
#else
0, /* leading underscore */
#endif
- '/', /* ar_pad_char */
- 15, /* ar_max_namelen */
+ '/', /* 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_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),
+ bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* Headers. */
+
+ /* 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,
diff --git a/contrib/binutils/bfd/pe-ppc.c b/contrib/binutils/bfd/pe-ppc.c
index adbf317..fa6404e 100644
--- a/contrib/binutils/bfd/pe-ppc.c
+++ b/contrib/binutils/bfd/pe-ppc.c
@@ -1,5 +1,5 @@
/* BFD back-end for PowerPC PECOFF files.
- Copyright 1995, 1996, 2001 Free Software Foundation, Inc.
+ Copyright 1995, 1996, 1999, 2001, 2007 Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@@ -15,11 +15,11 @@ 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. */
+Foundation, 51 Franklin Street - Fifth Floor,
+Boston, MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#define E_FILENMLEN 18
diff --git a/contrib/binutils/bfd/pe-x86_64.c b/contrib/binutils/bfd/pe-x86_64.c
new file mode 100644
index 0000000..0c6badf
--- /dev/null
+++ b/contrib/binutils/bfd/pe-x86_64.c
@@ -0,0 +1,53 @@
+/* BFD back-end for Intel/AMD x86_64 PECOFF files.
+ Copyright 2006, 2007 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., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
+
+ Written by Kai Tietz, OneVision Software GmbH&CoKg. */
+
+#include "sysdep.h"
+#include "bfd.h"
+
+#define TARGET_SYM x86_64pe_vec
+#define TARGET_NAME "pe-x86-64"
+#define COFF_WITH_PE
+#define COFF_WITH_pex64
+#define PCRELOFFSET TRUE
+#define TARGET_UNDERSCORE '_'
+#define COFF_LONG_SECTION_NAMES
+#define COFF_SUPPORT_GNU_LINKONCE
+#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 (".rdata"), \
+ 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 }, \
+{ COFF_SECTION_NAME_PARTIAL_MATCH (".debug"), \
+ COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 0 }, \
+{ COFF_SECTION_NAME_PARTIAL_MATCH (".gnu.linkonce.wi."), \
+ COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 0 }
+
+#include "coff-x86_64.c"
diff --git a/contrib/binutils/bfd/peXXigen.c b/contrib/binutils/bfd/peXXigen.c
index 598aa7c..f96825f 100644
--- a/contrib/binutils/bfd/peXXigen.c
+++ b/contrib/binutils/bfd/peXXigen.c
@@ -1,6 +1,6 @@
/* 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.
+ Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
+ 2005, 2006, 2007 Free Software Foundation, Inc.
Written by Cygnus Solutions.
This file is part of BFD, the Binary File Descriptor library.
@@ -17,7 +17,7 @@
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. */
+ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
/* Most of this hacked by Steve Chamberlain <sac@cygnus.com>.
@@ -52,12 +52,12 @@
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+. */
+/* This expands into COFF_WITH_pe, COFF_WITH_pep, or COFF_WITH_pex64
+ depending on whether we're compiling for straight PE or PE+. */
#define COFF_WITH_XX
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
#include "coff/internal.h"
@@ -67,7 +67,9 @@
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
+#if defined COFF_WITH_pex64
+# include "coff/x86_64.h"
+#elif defined COFF_WITH_pep
# include "coff/ia64.h"
#else
# include "coff/i386.h"
@@ -77,7 +79,7 @@
#include "libcoff.h"
#include "libpei.h"
-#ifdef COFF_WITH_pep
+#if defined COFF_WITH_pep || defined COFF_WITH_pex64
# undef AOUTSZ
# define AOUTSZ PEPAOUTSZ
# define PEAOUTHDR PEPAOUTHDR
@@ -88,20 +90,9 @@
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;
+_bfd_XXi_swap_sym_in (bfd * abfd, void * ext1, void * in1)
{
SYMENT *ext = (SYMENT *) ext1;
struct internal_syment *in = (struct internal_syment *) in1;
@@ -138,24 +129,6 @@ _bfd_XXi_swap_sym_in (abfd, ext1, in1)
{
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)
{
@@ -176,6 +149,7 @@ _bfd_XXi_swap_sym_in (abfd, ext1, in1)
int unused_section_number = 0;
asection *sec;
char *name;
+ flagword flags;
for (sec = abfd->sections; sec; sec = sec->next)
if (unused_section_number <= sec->target_index)
@@ -185,29 +159,26 @@ _bfd_XXi_swap_sym_in (abfd, ext1, in1)
if (name == NULL)
return;
strcpy (name, in->n_name);
- sec = bfd_make_section_anyway (abfd, name);
+ flags = SEC_HAS_CONTENTS | SEC_ALLOC | SEC_DATA | SEC_LOAD;
+ sec = bfd_make_section_anyway_with_flags (abfd, name, flags);
sec->vma = 0;
sec->lma = 0;
- sec->_cooked_size = 0;
- sec->_raw_size = 0;
+ sec->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->next = NULL;
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
@@ -219,10 +190,7 @@ _bfd_XXi_swap_sym_in (abfd, ext1, in1)
}
unsigned int
-_bfd_XXi_swap_sym_out (abfd, inp, extp)
- bfd *abfd;
- PTR inp;
- PTR extp;
+_bfd_XXi_swap_sym_out (bfd * abfd, void * inp, void * extp)
{
struct internal_syment *in = (struct internal_syment *) inp;
SYMENT *ext = (SYMENT *) extp;
@@ -250,14 +218,13 @@ _bfd_XXi_swap_sym_out (abfd, inp, extp)
}
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;
+_bfd_XXi_swap_aux_in (bfd * abfd,
+ void * ext1,
+ int type,
+ int class,
+ int indx ATTRIBUTE_UNUSED,
+ int numaux ATTRIBUTE_UNUSED,
+ void * in1)
{
AUXENT *ext = (AUXENT *) ext1;
union internal_auxent *in = (union internal_auxent *) in1;
@@ -322,19 +289,19 @@ _bfd_XXi_swap_aux_in (abfd, ext1, type, class, indx, numaux, in1)
}
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;
+_bfd_XXi_swap_aux_out (bfd * abfd,
+ void * inp,
+ int type,
+ int class,
+ int indx ATTRIBUTE_UNUSED,
+ int numaux ATTRIBUTE_UNUSED,
+ void * extp)
{
union internal_auxent *in = (union internal_auxent *) inp;
AUXENT *ext = (AUXENT *) extp;
- memset ((PTR) ext, 0, AUXESZ);
+ memset (ext, 0, AUXESZ);
+
switch (class)
{
case C_FILE:
@@ -396,10 +363,7 @@ _bfd_XXi_swap_aux_out (abfd, inp, type, class, indx, numaux, extp)
}
void
-_bfd_XXi_swap_lineno_in (abfd, ext1, in1)
- bfd *abfd;
- PTR ext1;
- PTR in1;
+_bfd_XXi_swap_lineno_in (bfd * abfd, void * ext1, void * in1)
{
LINENO *ext = (LINENO *) ext1;
struct internal_lineno *in = (struct internal_lineno *) in1;
@@ -409,10 +373,7 @@ _bfd_XXi_swap_lineno_in (abfd, ext1, in1)
}
unsigned int
-_bfd_XXi_swap_lineno_out (abfd, inp, outp)
- bfd *abfd;
- PTR inp;
- PTR outp;
+_bfd_XXi_swap_lineno_out (bfd * abfd, void * inp, void * outp)
{
struct internal_lineno *in = (struct internal_lineno *) inp;
struct external_lineno *ext = (struct external_lineno *) outp;
@@ -423,15 +384,15 @@ _bfd_XXi_swap_lineno_out (abfd, inp, outp)
}
void
-_bfd_XXi_swap_aouthdr_in (abfd, aouthdr_ext1, aouthdr_int1)
- bfd *abfd;
- PTR aouthdr_ext1;
- PTR aouthdr_int1;
+_bfd_XXi_swap_aouthdr_in (bfd * abfd,
+ void * aouthdr_ext1,
+ void * 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;
+ PEAOUTHDR * src = (PEAOUTHDR *) aouthdr_ext1;
+ AOUTHDR * aouthdr_ext = (AOUTHDR *) aouthdr_ext1;
+ struct internal_aouthdr *aouthdr_int
+ = (struct internal_aouthdr *) aouthdr_int1;
+ struct internal_extra_pe_aouthdr *a = &aouthdr_int->pe;
aouthdr_int->magic = H_GET_16 (abfd, aouthdr_ext->magic);
aouthdr_int->vstamp = H_GET_16 (abfd, aouthdr_ext->vstamp);
@@ -441,13 +402,21 @@ _bfd_XXi_swap_aouthdr_in (abfd, aouthdr_ext1, aouthdr_int1)
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! */
+#if !defined(COFF_WITH_pep) && !defined(COFF_WITH_pex64)
+ /* PE32+ does not have data_start member! */
aouthdr_int->data_start =
GET_AOUTHDR_DATA_START (abfd, aouthdr_ext->data_start);
+ a->BaseOfData = aouthdr_int->data_start;
#endif
- a = &aouthdr_int->pe;
+ a->Magic = aouthdr_int->magic;
+ a->MajorLinkerVersion = H_GET_8 (abfd, aouthdr_ext->vstamp);
+ a->MinorLinkerVersion = H_GET_8 (abfd, aouthdr_ext->vstamp + 1);
+ a->SizeOfCode = aouthdr_int->tsize ;
+ a->SizeOfInitializedData = aouthdr_int->dsize ;
+ a->SizeOfUninitializedData = aouthdr_int->bsize ;
+ a->AddressOfEntryPoint = aouthdr_int->entry;
+ a->BaseOfCode = aouthdr_int->text_start;
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);
@@ -484,6 +453,7 @@ _bfd_XXi_swap_aouthdr_in (abfd, aouthdr_ext1, aouthdr_int1)
/* 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)
@@ -497,7 +467,7 @@ _bfd_XXi_swap_aouthdr_in (abfd, aouthdr_ext1, aouthdr_int1)
if (aouthdr_int->entry)
{
aouthdr_int->entry += a->ImageBase;
-#ifndef COFF_WITH_pep
+#if !defined(COFF_WITH_pep) && !defined(COFF_WITH_pex64)
aouthdr_int->entry &= 0xffffffff;
#endif
}
@@ -505,13 +475,13 @@ _bfd_XXi_swap_aouthdr_in (abfd, aouthdr_ext1, aouthdr_int1)
if (aouthdr_int->tsize)
{
aouthdr_int->text_start += a->ImageBase;
-#ifndef COFF_WITH_pep
+#if !defined(COFF_WITH_pep) && !defined(COFF_WITH_pex64)
aouthdr_int->text_start &= 0xffffffff;
#endif
}
-#ifndef COFF_WITH_pep
- /* PE32+ does not have data_start member! */
+#if !defined(COFF_WITH_pep) && !defined(COFF_WITH_pex64)
+ /* PE32+ does not have data_start member! */
if (aouthdr_int->dsize)
{
aouthdr_int->data_start += a->ImageBase;
@@ -523,21 +493,20 @@ _bfd_XXi_swap_aouthdr_in (abfd, aouthdr_ext1, aouthdr_int1)
/* 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;
+ first_thunk_address = a->DataDirectory[PE_IMPORT_ADDRESS_TABLE].VirtualAddress;
+ thunk_size = a->DataDirectory[PE_IMPORT_ADDRESS_TABLE].Size;
+ import_table_size = a->DataDirectory[PE_IMPORT_TABLE].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;
+add_data_entry (bfd * abfd,
+ struct internal_extra_pe_aouthdr *aout,
+ int idx,
+ char *name,
+ bfd_vma base)
{
asection *sec = bfd_get_section_by_name (abfd, name);
@@ -560,10 +529,7 @@ add_data_entry (abfd, aout, idx, name, base)
}
unsigned int
-_bfd_XXi_swap_aouthdr_out (abfd, in, out)
- bfd *abfd;
- PTR in;
- PTR out;
+_bfd_XXi_swap_aouthdr_out (bfd * abfd, void * in, void * out)
{
struct internal_aouthdr *aouthdr_in = (struct internal_aouthdr *) in;
pe_data_type *pe = pe_data (abfd);
@@ -587,14 +553,14 @@ _bfd_XXi_swap_aouthdr_out (abfd, in, out)
fa = extra->FileAlignment;
ib = extra->ImageBase;
- idata2 = pe->pe_opthdr.DataDirectory[1];
- idata5 = pe->pe_opthdr.DataDirectory[12];
- tls = pe->pe_opthdr.DataDirectory[9];
+ idata2 = pe->pe_opthdr.DataDirectory[PE_IMPORT_TABLE];
+ idata5 = pe->pe_opthdr.DataDirectory[PE_IMPORT_ADDRESS_TABLE];
+ tls = pe->pe_opthdr.DataDirectory[PE_TLS_TABLE];
if (aouthdr_in->tsize)
{
aouthdr_in->text_start -= ib;
-#ifndef COFF_WITH_pep
+#if !defined(COFF_WITH_pep) && !defined(COFF_WITH_pex64)
aouthdr_in->text_start &= 0xffffffff;
#endif
}
@@ -602,7 +568,7 @@ _bfd_XXi_swap_aouthdr_out (abfd, in, out)
if (aouthdr_in->dsize)
{
aouthdr_in->data_start -= ib;
-#ifndef COFF_WITH_pep
+#if !defined(COFF_WITH_pep) && !defined(COFF_WITH_pex64)
aouthdr_in->data_start &= 0xffffffff;
#endif
}
@@ -610,7 +576,7 @@ _bfd_XXi_swap_aouthdr_out (abfd, in, out)
if (aouthdr_in->entry)
{
aouthdr_in->entry -= ib;
-#ifndef COFF_WITH_pep
+#if !defined(COFF_WITH_pep) && !defined(COFF_WITH_pex64)
aouthdr_in->entry &= 0xffffffff;
#endif
}
@@ -639,11 +605,11 @@ _bfd_XXi_swap_aouthdr_out (abfd, in, out)
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;
+ extra->DataDirectory[PE_IMPORT_TABLE] = idata2;
+ extra->DataDirectory[PE_IMPORT_ADDRESS_TABLE] = idata5;
+ extra->DataDirectory[PE_TLS_TABLE] = tls;
- if (extra->DataDirectory[1].VirtualAddress == 0)
+ if (extra->DataDirectory[PE_IMPORT_TABLE].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);
@@ -658,14 +624,19 @@ _bfd_XXi_swap_aouthdr_out (abfd, in, out)
{
asection *sec;
+ bfd_vma hsize = 0;
bfd_vma dsize = 0;
- bfd_vma isize = SA(abfd->sections->filepos);
+ bfd_vma isize = 0;
bfd_vma tsize = 0;
for (sec = abfd->sections; sec; sec = sec->next)
{
- int rounded = FA(sec->_raw_size);
+ int rounded = FA (sec->size);
+ /* The first non-zero section filepos is the header size.
+ Sections without contents will have a filepos of 0. */
+ if (hsize == 0)
+ hsize = sec->filepos;
if (sec->flags & SEC_DATA)
dsize += rounded;
if (sec->flags & SEC_CODE)
@@ -674,18 +645,24 @@ _bfd_XXi_swap_aouthdr_out (abfd, in, out)
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. */
+ fix, strip munges the file.
+
+ FIXME: We need to handle holes between sections, which may
+ happpen when we covert from another format. We just use
+ the virtual address and virtual size of the last section
+ for the image size. */
if (coff_section_data (abfd, sec) != NULL
&& pei_section_data (abfd, sec) != NULL)
- isize += SA (FA (pei_section_data (abfd, sec)->virt_size));
+ isize = (sec->vma - extra->ImageBase
+ + SA (FA (pei_section_data (abfd, sec)->virt_size)));
}
aouthdr_in->dsize = dsize;
aouthdr_in->tsize = tsize;
+ extra->SizeOfHeaders = hsize;
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 */
@@ -702,7 +679,7 @@ _bfd_XXi_swap_aouthdr_out (abfd, in, out)
PUT_AOUTHDR_TEXT_START (abfd, aouthdr_in->text_start,
aouthdr_out->standard.text_start);
-#ifndef COFF_WITH_pep
+#if !defined(COFF_WITH_pep) && !defined(COFF_WITH_pex64)
/* PE32+ does not have data_start member! */
PUT_AOUTHDR_DATA_START (abfd, aouthdr_in->data_start,
aouthdr_out->standard.data_start);
@@ -754,10 +731,7 @@ _bfd_XXi_swap_aouthdr_out (abfd, in, out)
}
unsigned int
-_bfd_XXi_only_swap_filehdr_out (abfd, in, out)
- bfd *abfd;
- PTR in;
- PTR out;
+_bfd_XXi_only_swap_filehdr_out (bfd * abfd, void * in, void * out)
{
int idx;
struct internal_filehdr *filehdr_in = (struct internal_filehdr *) in;
@@ -865,10 +839,7 @@ _bfd_XXi_only_swap_filehdr_out (abfd, in, out)
}
unsigned int
-_bfd_XX_only_swap_filehdr_out (abfd, in, out)
- bfd *abfd;
- PTR in;
- PTR out;
+_bfd_XX_only_swap_filehdr_out (bfd * abfd, void * in, void * out)
{
struct internal_filehdr *filehdr_in = (struct internal_filehdr *) in;
FILHDR *filehdr_out = (FILHDR *) out;
@@ -885,10 +856,7 @@ _bfd_XX_only_swap_filehdr_out (abfd, in, out)
}
unsigned int
-_bfd_XXi_swap_scnhdr_out (abfd, in, out)
- bfd *abfd;
- PTR in;
- PTR out;
+_bfd_XXi_swap_scnhdr_out (bfd * abfd, void * in, void * out)
{
struct internal_scnhdr *scnhdr_int = (struct internal_scnhdr *) in;
SCNHDR *scnhdr_ext = (SCNHDR *) out;
@@ -983,7 +951,6 @@ _bfd_XXi_swap_scnhdr_out (abfd, in, out)
};
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
@@ -998,12 +965,12 @@ _bfd_XXi_swap_scnhdr_out (abfd, in, out)
{
if (strcmp (scnhdr_int->s_name, ".text")
|| (bfd_get_file_flags (abfd) & WP_TEXT))
- flags &= ~IMAGE_SCN_MEM_WRITE;
- flags |= p->must_have;
+ scnhdr_int->s_flags &= ~IMAGE_SCN_MEM_WRITE;
+ scnhdr_int->s_flags |= p->must_have;
break;
}
- H_PUT_32 (abfd, flags, scnhdr_ext->s_flags);
+ H_PUT_32 (abfd, scnhdr_int->s_flags, scnhdr_ext->s_flags);
}
if (coff_data (abfd)->link_info
@@ -1048,38 +1015,30 @@ _bfd_XXi_swap_scnhdr_out (abfd, in, out)
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")
- };
+{
+ 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_("CLR Runtime Header"),
+ N_("Reserved")
+};
#ifdef POWERPC_LE_PE
/* The code for the PPC really falls in the "architecture dependent"
@@ -1090,9 +1049,7 @@ static char * dir_names[IMAGE_NUMBEROF_DIRECTORY_ENTRIES] =
#endif
static bfd_boolean
-pe_print_idata (abfd, vfile)
- bfd *abfd;
- PTR vfile;
+pe_print_idata (bfd * abfd, void * vfile)
{
FILE *file = (FILE *) vfile;
bfd_byte *data;
@@ -1106,7 +1063,6 @@ pe_print_idata (abfd, vfile)
bfd_size_type datasize = 0;
bfd_size_type dataoff;
bfd_size_type i;
- bfd_size_type amt;
int onaline = 20;
pe_data_type *pe = pe_data (abfd);
@@ -1114,9 +1070,9 @@ pe_print_idata (abfd, vfile)
bfd_vma addr;
- addr = extra->DataDirectory[1].VirtualAddress;
+ addr = extra->DataDirectory[PE_IMPORT_TABLE].VirtualAddress;
- if (addr == 0 && extra->DataDirectory[1].Size == 0)
+ if (addr == 0 && extra->DataDirectory[PE_IMPORT_TABLE].Size == 0)
{
/* Maybe the extra header isn't there. Look for the section. */
section = bfd_get_section_by_name (abfd, ".idata");
@@ -1124,7 +1080,7 @@ pe_print_idata (abfd, vfile)
return TRUE;
addr = section->vma;
- datasize = bfd_section_size (abfd, section);
+ datasize = section->size;
if (datasize == 0)
return TRUE;
}
@@ -1133,7 +1089,7 @@ pe_print_idata (abfd, vfile)
addr += extra->ImageBase;
for (section = abfd->sections; section != NULL; section = section->next)
{
- datasize = bfd_section_size (abfd, section);
+ datasize = section->size;
if (addr >= section->vma && addr < section->vma + datasize)
break;
}
@@ -1153,7 +1109,7 @@ pe_print_idata (abfd, vfile)
datasize -= dataoff;
#ifdef POWERPC_LE_PE
- if (rel_section != 0 && bfd_section_size (abfd, rel_section) != 0)
+ if (rel_section != 0 && rel_section->size != 0)
{
/* The toc address can be found by taking the starting address,
which on the PPC locates a function descriptor. The
@@ -1165,19 +1121,25 @@ pe_print_idata (abfd, vfile)
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_byte *data;
+ bfd_vma offset;
- bfd_get_section_contents (abfd, rel_section, (PTR) data, (bfd_vma) 0,
- amt);
+ if (!bfd_malloc_and_get_section (abfd, rel_section, &data))
+ {
+ if (data != NULL)
+ free (data);
+ return FALSE;
+ }
offset = abfd->start_address - rel_section->vma;
+ if (offset >= rel_section->size || offset + 8 > rel_section->size)
+ {
+ if (data != NULL)
+ free (data);
+ return FALSE;
+ }
+
start_address = bfd_get_32 (abfd, data + offset);
loadable_toc_address = bfd_get_32 (abfd, data + offset + 4);
toc_address = loadable_toc_address - 32768;
@@ -1188,6 +1150,8 @@ pe_print_idata (abfd, vfile)
fprintf (file,
_("\tcode-base %08lx toc (loadable/actual) %08lx/%08lx\n"),
start_address, loadable_toc_address, toc_address);
+ if (data != NULL)
+ free (data);
}
else
{
@@ -1204,14 +1168,13 @@ pe_print_idata (abfd, vfile)
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;
+ if (!bfd_malloc_and_get_section (abfd, section, &data))
+ {
+ if (data != NULL)
+ free (data);
+ return FALSE;
+ }
adj = section->vma - extra->ImageBase;
@@ -1227,13 +1190,8 @@ pe_print_idata (abfd, vfile)
bfd_size_type j;
char *dll;
- /* Print (i + extra->DataDirectory[1].VirtualAddress). */
+ /* Print (i + extra->DataDirectory[PE_IMPORT_TABLE].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);
@@ -1250,6 +1208,9 @@ pe_print_idata (abfd, vfile)
if (hint_addr == 0 && first_thunk == 0)
break;
+ if (dll_name - adj >= section->size)
+ break;
+
dll = (char *) data + dll_name - adj;
fprintf (file, _("\n\tDLL Name: %s\n"), dll);
@@ -1270,15 +1231,15 @@ pe_print_idata (abfd, vfile)
ft_data = data;
ft_idx = first_thunk - adj;
ft_allocated = 0;
-
- if (first_thunk != hint_addr)
+
+ 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);
+ ft_datasize = ft_section->size;
if (ft_addr >= ft_section->vma
&& ft_addr < ft_section->vma + ft_datasize)
break;
@@ -1301,15 +1262,13 @@ pe_print_idata (abfd, vfile)
else
{
ft_idx = first_thunk - (ft_section->vma - extra->ImageBase);
- ft_data = (bfd_byte *) bfd_malloc (datasize);
+ ft_data = 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))
+ if (! bfd_get_section_contents
+ (abfd, ft_section, ft_data, (bfd_vma) ft_idx, datasize))
{
free (ft_data);
continue;
@@ -1321,6 +1280,38 @@ pe_print_idata (abfd, vfile)
}
/* Print HintName vector entries. */
+#ifdef COFF_WITH_pex64
+ for (j = 0; j < datasize; j += 8)
+ {
+ unsigned long member = bfd_get_32 (abfd, data + idx + j);
+ unsigned long member_high = bfd_get_32 (abfd, data + idx + j + 4);
+
+ if (!member && !member_high)
+ break;
+
+ if (member_high & 0x80000000)
+ fprintf (file, "\t%lx%08lx\t %4lx%08lx <none>",
+ member_high,member, member_high & 0x7fffffff, member);
+ 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");
+ }
+#else
for (j = 0; j < datasize; j += 4)
{
unsigned long member = bfd_get_32 (abfd, data + idx + j);
@@ -1353,7 +1344,7 @@ pe_print_idata (abfd, vfile)
fprintf (file, "\n");
}
-
+#endif
if (ft_allocated)
free (ft_data);
}
@@ -1367,9 +1358,7 @@ pe_print_idata (abfd, vfile)
}
static bfd_boolean
-pe_print_edata (abfd, vfile)
- bfd *abfd;
- PTR vfile;
+pe_print_edata (bfd * abfd, void * vfile)
{
FILE *file = (FILE *) vfile;
bfd_byte *data;
@@ -1380,17 +1369,17 @@ pe_print_edata (abfd, vfile)
bfd_signed_vma adj;
struct EDT_type
{
- long export_flags; /* reserved - should be zero */
+ 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 */
+ 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);
@@ -1398,9 +1387,9 @@ pe_print_edata (abfd, vfile)
bfd_vma addr;
- addr = extra->DataDirectory[0].VirtualAddress;
+ addr = extra->DataDirectory[PE_EXPORT_TABLE].VirtualAddress;
- if (addr == 0 && extra->DataDirectory[0].Size == 0)
+ if (addr == 0 && extra->DataDirectory[PE_EXPORT_TABLE].Size == 0)
{
/* Maybe the extra header isn't there. Look for the section. */
section = bfd_get_section_by_name (abfd, ".edata");
@@ -1408,7 +1397,8 @@ pe_print_edata (abfd, vfile)
return TRUE;
addr = section->vma;
- datasize = bfd_section_size (abfd, section);
+ dataoff = 0;
+ datasize = section->size;
if (datasize == 0)
return TRUE;
}
@@ -1417,12 +1407,8 @@ pe_print_edata (abfd, vfile)
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 (addr >= section->vma && addr < section->vma + section->size)
+ break;
if (section == NULL)
{
@@ -1430,19 +1416,26 @@ pe_print_edata (abfd, vfile)
_("\nThere is an export table, but the section containing it could not be found\n"));
return TRUE;
}
+
+ dataoff = addr - section->vma;
+ datasize = extra->DataDirectory[PE_EXPORT_TABLE].Size;
+ if (datasize > section->size - dataoff)
+ {
+ fprintf (file,
+ _("\nThere is an export table in %s, but it does not fit into that section\n"),
+ section->name);
+ 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);
+ data = bfd_malloc (datasize);
if (data == NULL)
return FALSE;
- if (! bfd_get_section_contents (abfd, section, (PTR) data,
+ if (! bfd_get_section_contents (abfd, section, data,
(file_ptr) dataoff, datasize))
return FALSE;
@@ -1519,8 +1512,7 @@ pe_print_edata (abfd, vfile)
{
long export_rva;
long forwarder_rva;
- } export_address_table_entry;
- */
+ } export_address_table_entry; */
fprintf (file,
_("\nExport Address Table -- Ordinal Base %ld\n"),
@@ -1590,14 +1582,12 @@ pe_print_edata (abfd, vfile)
covers and the address of the corresponding unwind info data. */
static bfd_boolean
-pe_print_pdata (abfd, vfile)
- bfd *abfd;
- PTR vfile;
+pe_print_pdata (bfd * abfd, void * vfile)
{
-#ifdef COFF_WITH_pep
-# define PDATA_ROW_SIZE (3*8)
+#if defined(COFF_WITH_pep) && !defined(COFF_WITH_pex64)
+# define PDATA_ROW_SIZE (3 * 8)
#else
-# define PDATA_ROW_SIZE (5*4)
+# define PDATA_ROW_SIZE (5 * 4)
#endif
FILE *file = (FILE *) vfile;
bfd_byte *data = 0;
@@ -1620,7 +1610,7 @@ pe_print_pdata (abfd, vfile)
fprintf (file,
_("\nThe Function Table (interpreted .pdata section contents)\n"));
-#ifdef COFF_WITH_pep
+#if defined(COFF_WITH_pep) && !defined(COFF_WITH_pex64)
fprintf (file,
_(" vma:\t\t\tBegin Address End Address Unwind Info\n"));
#else
@@ -1629,16 +1619,16 @@ pe_print_pdata (abfd, vfile)
\t\tAddress Address Handler Data Address Mask\n"));
#endif
- datasize = bfd_section_size (abfd, section);
+ datasize = section->size;
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);
+ if (! bfd_malloc_and_get_section (abfd, section, &data))
+ {
+ if (data != NULL)
+ free (data);
+ return FALSE;
+ }
start = 0;
@@ -1674,7 +1664,7 @@ pe_print_pdata (abfd, vfile)
fprintf_vma (file, begin_addr); fputc (' ', file);
fprintf_vma (file, end_addr); fputc (' ', file);
fprintf_vma (file, eh_handler);
-#ifndef COFF_WITH_pep
+#if !defined(COFF_WITH_pep) || defined(COFF_WITH_pex64)
fputc (' ', file);
fprintf_vma (file, eh_data); fputc (' ', file);
fprintf_vma (file, prolog_end_addr);
@@ -1685,12 +1675,12 @@ pe_print_pdata (abfd, vfile)
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 */
+ 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:
@@ -1717,26 +1707,24 @@ pe_print_pdata (abfd, vfile)
#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 */
- };
+{
+ "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;
+pe_print_reloc (bfd * abfd, void * vfile)
{
FILE *file = (FILE *) vfile;
bfd_byte *data = 0;
@@ -1748,23 +1736,23 @@ pe_print_reloc (abfd, vfile)
if (section == NULL)
return TRUE;
- if (bfd_section_size (abfd, section) == 0)
+ if (section->size == 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);
+ datasize = section->size;
+ if (! bfd_malloc_and_get_section (abfd, section, &data))
+ {
+ if (data != NULL)
+ free (data);
+ return FALSE;
+ }
start = 0;
- stop = bfd_section_size (abfd, section);
+ stop = section->size;
for (i = start; i < stop;)
{
@@ -1822,15 +1810,14 @@ pe_print_reloc (abfd, vfile)
/* Print out the program headers. */
bfd_boolean
-_bfd_XX_print_private_bfd_data_common (abfd, vfile)
- bfd *abfd;
- PTR vfile;
+_bfd_XX_print_private_bfd_data_common (bfd * abfd, void * 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;
+ const char *name;
/* The MS dumpbin program reportedly ands with 0xff0f before
printing the characteristics field. Not sure why. No reason to
@@ -1838,16 +1825,17 @@ _bfd_XX_print_private_bfd_data_common (abfd, vfile)
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");
+ PF (IMAGE_FILE_RELOCS_STRIPPED, "relocations stripped");
+ PF (IMAGE_FILE_EXECUTABLE_IMAGE, "executable");
+ PF (IMAGE_FILE_LINE_NUMS_STRIPPED, "line numbers stripped");
+ PF (IMAGE_FILE_LOCAL_SYMS_STRIPPED, "symbols stripped");
+ PF (IMAGE_FILE_LARGE_ADDRESS_AWARE, "large address aware");
+ PF (IMAGE_FILE_BYTES_REVERSED_LO, "little endian");
+ PF (IMAGE_FILE_32BIT_MACHINE, "32 bit words");
+ PF (IMAGE_FILE_DEBUG_STRIPPED, "debugging information removed");
+ PF (IMAGE_FILE_SYSTEM, "system file");
+ PF (IMAGE_FILE_DLL, "DLL");
+ PF (IMAGE_FILE_BYTES_REVERSED_HI, "big endian");
#undef PF
/* ctime implies '\n'. */
@@ -1855,6 +1843,52 @@ _bfd_XX_print_private_bfd_data_common (abfd, vfile)
time_t t = pe->coff.timestamp;
fprintf (file, "\nTime/Date\t\t%s", ctime (&t));
}
+
+#ifndef IMAGE_NT_OPTIONAL_HDR_MAGIC
+# define IMAGE_NT_OPTIONAL_HDR_MAGIC 0x10b
+#endif
+#ifndef IMAGE_NT_OPTIONAL_HDR64_MAGIC
+# define IMAGE_NT_OPTIONAL_HDR64_MAGIC 0x20b
+#endif
+#ifndef IMAGE_NT_OPTIONAL_HDRROM_MAGIC
+# define IMAGE_NT_OPTIONAL_HDRROM_MAGIC 0x107
+#endif
+
+ switch (i->Magic)
+ {
+ case IMAGE_NT_OPTIONAL_HDR_MAGIC:
+ name = "PE32";
+ break;
+ case IMAGE_NT_OPTIONAL_HDR64_MAGIC:
+ name = "PE32+";
+ break;
+ case IMAGE_NT_OPTIONAL_HDRROM_MAGIC:
+ name = "ROM";
+ break;
+ default:
+ name = NULL;
+ break;
+ }
+ fprintf (file, "Magic\t\t\t%04x", i->Magic);
+ if (name)
+ fprintf (file, "\t(%s)",name);
+ fprintf (file, "\nMajorLinkerVersion\t%d\n", i->MajorLinkerVersion);
+ fprintf (file, "MinorLinkerVersion\t%d\n", i->MinorLinkerVersion);
+ fprintf (file, "SizeOfCode\t\t%08lx\n", i->SizeOfCode);
+ fprintf (file, "SizeOfInitializedData\t%08lx\n",
+ i->SizeOfInitializedData);
+ fprintf (file, "SizeOfUninitializedData\t%08lx\n",
+ i->SizeOfUninitializedData);
+ fprintf (file, "AddressOfEntryPoint\t");
+ fprintf_vma (file, i->AddressOfEntryPoint);
+ fprintf (file, "\nBaseOfCode\t\t");
+ fprintf_vma (file, i->BaseOfCode);
+#if !defined(COFF_WITH_pep) && !defined(COFF_WITH_pex64)
+ /* PE32+ does not have BaseOfData member! */
+ fprintf (file, "\nBaseOfData\t\t");
+ fprintf_vma (file, i->BaseOfData);
+#endif
+
fprintf (file, "\nImageBase\t\t");
fprintf_vma (file, i->ImageBase);
fprintf (file, "\nSectionAlignment\t");
@@ -1901,6 +1935,16 @@ _bfd_XX_print_private_bfd_data_common (abfd, vfile)
case IMAGE_SUBSYSTEM_EFI_RUNTIME_DRIVER:
subsystem_name = "EFI runtime driver";
break;
+ // These are from revision 8.0 of the MS PE/COFF spec
+ case IMAGE_SUBSYSTEM_EFI_ROM:
+ subsystem_name = "EFI ROM";
+ break;
+ case IMAGE_SUBSYSTEM_XBOX:
+ subsystem_name = "XBOX";
+ break;
+ // Added default case for clarity - subsystem_name is NULL anyway.
+ default:
+ subsystem_name = NULL;
}
fprintf (file, "Subsystem\t\t%08x", i->Subsystem);
@@ -1939,8 +1983,7 @@ _bfd_XX_print_private_bfd_data_common (abfd, vfile)
to the output bfd. */
bfd_boolean
-_bfd_XX_bfd_copy_private_bfd_data_common (ibfd, obfd)
- bfd *ibfd, *obfd;
+_bfd_XX_bfd_copy_private_bfd_data_common (bfd * ibfd, bfd * obfd)
{
/* One day we may try to grok other private data. */
if (ibfd->xvec->flavour != bfd_target_coff_flavour
@@ -1954,8 +1997,8 @@ _bfd_XX_bfd_copy_private_bfd_data_common (ibfd, obfd)
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;
+ pe_data (obfd)->pe_opthdr.DataDirectory[PE_BASE_RELOCATION_TABLE].VirtualAddress = 0;
+ pe_data (obfd)->pe_opthdr.DataDirectory[PE_BASE_RELOCATION_TABLE].Size = 0;
}
return TRUE;
}
@@ -1963,11 +2006,10 @@ _bfd_XX_bfd_copy_private_bfd_data_common (ibfd, obfd)
/* 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;
+_bfd_XX_bfd_copy_private_section_data (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)
@@ -1979,7 +2021,7 @@ _bfd_XX_bfd_copy_private_section_data (ibfd, isec, obfd, osec)
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);
+ osec->used_by_bfd = bfd_zalloc (obfd, amt);
if (osec->used_by_bfd == NULL)
return FALSE;
}
@@ -1987,7 +2029,7 @@ _bfd_XX_bfd_copy_private_section_data (ibfd, isec, obfd, osec)
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);
+ coff_section_data (obfd, osec)->tdata = bfd_zalloc (obfd, amt);
if (coff_section_data (obfd, osec)->tdata == NULL)
return FALSE;
}
@@ -2002,32 +2044,20 @@ _bfd_XX_bfd_copy_private_section_data (ibfd, isec, obfd, osec)
}
void
-_bfd_XX_get_symbol_info (abfd, symbol, ret)
- bfd *abfd;
- asymbol *symbol;
- symbol_info *ret;
+_bfd_XX_get_symbol_info (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;
+_bfd_XXi_final_link_postscript (bfd * abfd, struct coff_final_link_info *pfinfo)
{
struct coff_link_hash_entry *h1;
struct bfd_link_info *info = pfinfo->info;
+ bfd_boolean result = TRUE;
/* There are a few fields that need to be filled in now while we
have symbol table access.
@@ -2041,49 +2071,103 @@ _bfd_XXi_final_link_postscript (abfd, pfinfo)
".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);
+ /* PR ld/2729: We cannot rely upon all the output sections having been
+ created properly, so check before referencing them. Issue a warning
+ message for any sections tht could not be found. */
+ if (h1->root.u.def.section != NULL
+ && h1->root.u.def.section->output_section != NULL)
+ pe_data (abfd)->pe_opthdr.DataDirectory[PE_IMPORT_TABLE].VirtualAddress =
+ (h1->root.u.def.value
+ + h1->root.u.def.section->output_section->vma
+ + h1->root.u.def.section->output_offset);
+ else
+ {
+ _bfd_error_handler
+ (_("%B: unable to fill in DataDictionary[1] because .idata$2 is missing"),
+ abfd);
+ result = FALSE;
+ }
+
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);
+ if (h1 != NULL
+ && h1->root.u.def.section != NULL
+ && h1->root.u.def.section->output_section != NULL)
+ pe_data (abfd)->pe_opthdr.DataDirectory[PE_IMPORT_TABLE].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[PE_IMPORT_TABLE].VirtualAddress);
+ else
+ {
+ _bfd_error_handler
+ (_("%B: unable to fill in DataDictionary[1] because .idata$4 is missing"),
+ abfd);
+ result = FALSE;
+ }
/* 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);
+ if (h1 != NULL
+ && h1->root.u.def.section != NULL
+ && h1->root.u.def.section->output_section != NULL)
+ pe_data (abfd)->pe_opthdr.DataDirectory[PE_IMPORT_ADDRESS_TABLE].VirtualAddress =
+ (h1->root.u.def.value
+ + h1->root.u.def.section->output_section->vma
+ + h1->root.u.def.section->output_offset);
+ else
+ {
+ _bfd_error_handler
+ (_("%B: unable to fill in DataDictionary[12] because .idata$5 is missing"),
+ abfd);
+ result = FALSE;
+ }
+
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);
+ if (h1 != NULL
+ && h1->root.u.def.section != NULL
+ && h1->root.u.def.section->output_section != NULL)
+ pe_data (abfd)->pe_opthdr.DataDirectory[PE_IMPORT_ADDRESS_TABLE].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[PE_IMPORT_ADDRESS_TABLE].VirtualAddress);
+ else
+ {
+ _bfd_error_handler
+ (_("%B: unable to fill in DataDictionary[PE_IMPORT_ADDRESS_TABLE (12)] because .idata$6 is missing"),
+ abfd);
+ result = FALSE;
+ }
}
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 (h1->root.u.def.section != NULL
+ && h1->root.u.def.section->output_section != NULL)
+ pe_data (abfd)->pe_opthdr.DataDirectory[PE_TLS_TABLE].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);
+ else
+ {
+ _bfd_error_handler
+ (_("%B: unable to fill in DataDictionary[9] because __tls_used is missing"),
+ abfd);
+ result = FALSE;
+ }
+
+ pe_data (abfd)->pe_opthdr.DataDirectory[PE_TLS_TABLE].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;
+ return result;
}
diff --git a/contrib/binutils/bfd/pei-arm-wince.c b/contrib/binutils/bfd/pei-arm-wince.c
new file mode 100644
index 0000000..7d5a3be
--- /dev/null
+++ b/contrib/binutils/bfd/pei-arm-wince.c
@@ -0,0 +1,30 @@
+/* BFD back-end for ARM WINCE PE IMAGE COFF files.
+ Copyright 2006 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., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#define TARGET_UNDERSCORE 0
+#define USER_LABEL_PREFIX ""
+
+#define TARGET_LITTLE_SYM arm_wince_pei_little_vec
+#define TARGET_LITTLE_NAME "pei-arm-wince-little"
+#define TARGET_BIG_SYM arm_wince_pei_big_vec
+#define TARGET_BIG_NAME "pei-arm-wince-big"
+
+#define LOCAL_LABEL_PREFIX "."
+
+#include "pei-arm.c"
diff --git a/contrib/binutils/bfd/pei-mips.c b/contrib/binutils/bfd/pei-mips.c
index 976b2f9..4405c0a 100644
--- a/contrib/binutils/bfd/pei-mips.c
+++ b/contrib/binutils/bfd/pei-mips.c
@@ -1,5 +1,5 @@
/* BFD back-end for MIPS PE IMAGE COFF files.
- Copyright 1995, 2000, 2001, 2002 Free Software Foundation, Inc.
+ Copyright 1995, 2000, 2001, 2002, 2007 Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@@ -15,10 +15,10 @@ 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. */
+Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#define TARGET_SYM mipslpei_vec
#define TARGET_NAME "pei-mips"
diff --git a/contrib/binutils/bfd/pei-x86_64.c b/contrib/binutils/bfd/pei-x86_64.c
new file mode 100644
index 0000000..37d9c7f
--- /dev/null
+++ b/contrib/binutils/bfd/pei-x86_64.c
@@ -0,0 +1,54 @@
+/* BFD back-end for Intel 386 PE IMAGE COFF files.
+ Copyright 2006, 2007 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., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
+
+ Written by Kai Tietz, OneVision Software GmbH&CoKg. */
+
+#include "sysdep.h"
+#include "bfd.h"
+
+#define TARGET_SYM x86_64pei_vec
+#define TARGET_NAME "pei-x86-64"
+#define COFF_IMAGE_WITH_PE
+#define COFF_WITH_PE
+#define COFF_WITH_pex64
+#define PCRELOFFSET TRUE
+#define TARGET_UNDERSCORE '_'
+#define COFF_LONG_SECTION_NAMES
+#define COFF_SUPPORT_GNU_LINKONCE
+#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 (".rdata"), \
+ 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 }, \
+{ COFF_SECTION_NAME_PARTIAL_MATCH (".debug"), \
+ COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 0 }, \
+{ COFF_SECTION_NAME_PARTIAL_MATCH (".gnu.linkonce.wi."), \
+ COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 0 }
+
+#include "coff-x86_64.c"
diff --git a/contrib/binutils/bfd/peicode.h b/contrib/binutils/bfd/peicode.h
index 41445e5..0f4858f 100644
--- a/contrib/binutils/bfd/peicode.h
+++ b/contrib/binutils/bfd/peicode.h
@@ -1,6 +1,6 @@
/* Support for the generic parts of PE/PEI, for BFD.
- Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
- Free Software Foundation, Inc.
+ Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
+ 2005, 2006 Free Software Foundation, Inc.
Written by Cygnus Solutions.
This file is part of BFD, the Binary File Descriptor library.
@@ -17,7 +17,7 @@
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. */
+ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
/* Most of this hacked by Steve Chamberlain,
sac@cygnus.com
@@ -55,8 +55,7 @@
#include "libpei.h"
-static bfd_boolean (*pe_saved_coff_bfd_print_private_bfd_data)
- PARAMS ((bfd *, PTR)) =
+static bfd_boolean (*pe_saved_coff_bfd_print_private_bfd_data) (bfd *, void *) =
#ifndef coff_bfd_print_private_bfd_data
NULL;
#else
@@ -64,11 +63,10 @@ static bfd_boolean (*pe_saved_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));
+static bfd_boolean pe_print_private_bfd_data (bfd *, void *);
#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 *)) =
+static bfd_boolean (*pe_saved_coff_bfd_copy_private_bfd_data) (bfd *, bfd *) =
#ifndef coff_bfd_copy_private_bfd_data
NULL;
#else
@@ -76,21 +74,12 @@ static bfd_boolean (*pe_saved_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 *));
+static bfd_boolean pe_bfd_copy_private_bfd_data (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;
@@ -130,76 +119,54 @@ typedef struct
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;
+coff_swap_reloc_in (bfd * abfd, void * src, void * 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_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_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;
+coff_swap_reloc_out (bfd * abfd, void * src, void * dst)
{
- struct internal_reloc *reloc_src = (struct internal_reloc *)src;
- struct external_reloc *reloc_dst = (struct external_reloc *)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
+#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);
+ 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;
+coff_swap_filehdr_in (bfd * abfd, void * src, void * 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_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
@@ -215,27 +182,29 @@ coff_swap_filehdr_in (abfd, src, dst)
#ifdef COFF_IMAGE_WITH_PE
# define coff_swap_filehdr_out _bfd_XXi_only_swap_filehdr_out
+#elif defined COFF_WITH_pex64
+# define coff_swap_filehdr_out _bfd_pex64_only_swap_filehdr_out
+#elif defined COFF_WITH_pep
+# define coff_swap_filehdr_out _bfd_pep_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;
+coff_swap_scnhdr_in (bfd * abfd, void * ext, void * 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);
+ 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);
+ 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
@@ -252,7 +221,10 @@ coff_swap_scnhdr_in (abfd, ext, in)
if (scnhdr_int->s_vaddr != 0)
{
scnhdr_int->s_vaddr += pe_data (abfd)->pe_opthdr.ImageBase;
+ /* Do not cut upper 32-bits for 64-bit vma. */
+#ifndef COFF_WITH_pex64
scnhdr_int->s_vaddr &= 0xffffffff;
+#endif
}
#ifndef COFF_NO_HACK_SCNHDR_SIZE
@@ -264,20 +236,16 @@ coff_swap_scnhdr_in (abfd, ext, in)
&& (((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. */
- }
+ /* 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. */
+ scnhdr_int->s_size = scnhdr_int->s_paddr;
#endif
}
static bfd_boolean
-pe_mkobject (abfd)
- bfd * abfd;
+pe_mkobject (bfd * abfd)
{
pe_data_type *pe;
bfd_size_type amt = sizeof (pe_data_type);
@@ -305,11 +273,11 @@ pe_mkobject (abfd)
}
/* Create the COFF backend specific information. */
-static PTR
-pe_mkobject_hook (abfd, filehdr, aouthdr)
- bfd * abfd;
- PTR filehdr;
- PTR aouthdr ATTRIBUTE_UNUSED;
+
+static void *
+pe_mkobject_hook (bfd * abfd,
+ void * filehdr,
+ void * aouthdr ATTRIBUTE_UNUSED)
{
struct internal_filehdr *internal_f = (struct internal_filehdr *) filehdr;
pe_data_type *pe;
@@ -346,7 +314,7 @@ pe_mkobject_hook (abfd, filehdr, aouthdr)
#ifdef COFF_IMAGE_WITH_PE
if (aouthdr)
- pe->pe_opthdr = ((struct internal_aouthdr *)aouthdr)->pe;
+ pe->pe_opthdr = ((struct internal_aouthdr *) aouthdr)->pe;
#endif
#ifdef ARM
@@ -354,36 +322,39 @@ pe_mkobject_hook (abfd, filehdr, aouthdr)
coff_data (abfd) ->flags = 0;
#endif
- return (PTR) pe;
+ return (void *) pe;
}
static bfd_boolean
-pe_print_private_bfd_data (abfd, vfile)
- bfd *abfd;
- PTR vfile;
+pe_print_private_bfd_data (bfd *abfd, void * 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);
+ if (pe_saved_coff_bfd_print_private_bfd_data == NULL)
+ return TRUE;
- return pe_saved_coff_bfd_print_private_bfd_data (abfd, vfile);
- }
+ fputc ('\n', file);
- return TRUE;
+ return pe_saved_coff_bfd_print_private_bfd_data (abfd, vfile);
}
/* 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;
+pe_bfd_copy_private_bfd_data (bfd *ibfd, bfd *obfd)
{
+ /* PR binutils/716: Copy the large address aware flag.
+ XXX: Should we be copying other flags or other fields in the pe_data()
+ structure ? */
+ if (pe_data (obfd) != NULL
+ && pe_data (ibfd) != NULL
+ && pe_data (ibfd)->real_flags & IMAGE_FILE_LARGE_ADDRESS_AWARE)
+ pe_data (obfd)->real_flags |= IMAGE_FILE_LARGE_ADDRESS_AWARE;
+
if (!_bfd_XX_bfd_copy_private_bfd_data_common (ibfd, obfd))
return FALSE;
@@ -429,20 +400,28 @@ pe_bfd_copy_private_bfd_data (ibfd, obfd)
#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_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 \
+#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)
+
+/* For PEx64 idata4 & 5 have thumb size of 8 bytes. */
+#ifdef COFF_WITH_pex64
+#define SIZEOF_IDATA4 (2 * 4)
+#define SIZEOF_IDATA5 (2 * 4)
+#else
#define SIZEOF_IDATA4 (1 * 4)
#define SIZEOF_IDATA5 (1 * 4)
+#endif
+
#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))
@@ -466,12 +445,13 @@ pe_bfd_copy_private_bfd_data (ibfd, obfd)
+ 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)
+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;
@@ -487,11 +467,6 @@ pe_ILF_make_a_symbol_reloc (pe_ILF_vars * vars,
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 ++;
@@ -499,6 +474,7 @@ pe_ILF_make_a_symbol_reloc (pe_ILF_vars * vars,
}
/* Create an empty relocation against the given section. */
+
static void
pe_ILF_make_a_reloc (pe_ILF_vars * vars,
bfd_vma address,
@@ -510,6 +486,7 @@ pe_ILF_make_a_reloc (pe_ILF_vars * vars,
}
/* Move the queued relocs into the given section. */
+
static void
pe_ILF_save_relocs (pe_ILF_vars * vars,
asection_ptr sec)
@@ -534,6 +511,7 @@ pe_ILF_save_relocs (pe_ILF_vars * vars,
}
/* 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,
@@ -583,39 +561,18 @@ pe_ILF_make_a_symbol (pe_ILF_vars * vars,
/* 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;
@@ -632,6 +589,7 @@ pe_ILF_make_a_symbol (pe_ILF_vars * vars,
}
/* Create a section. */
+
static asection_ptr
pe_ILF_make_a_section (pe_ILF_vars * vars,
const char * name,
@@ -713,9 +671,20 @@ static jump_table jtab[] =
},
#endif
+#ifdef AMD64MAGIC
+ { AMD64MAGIC,
+ { 0xff, 0x25, 0x00, 0x00, 0x00, 0x00, 0x90, 0x90 },
+ 8, 2
+ },
+#endif
+
#ifdef MC68MAGIC
- { MC68MAGIC, { /* XXX fill me in */ }, 0, 0 },
+ { 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,
@@ -755,11 +724,12 @@ static jump_table jtab[] =
#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,
+ char * symbol_name,
+ char * source_dll,
unsigned int ordinal,
unsigned int types)
{
@@ -784,13 +754,13 @@ pe_ILF_build_a_bfd (bfd * abfd,
case IMPORT_CONST:
/* XXX code yet to be written. */
- _bfd_error_handler (_("%s: Unhandled import type; %x"),
- bfd_archive_filename (abfd), import_type);
+ _bfd_error_handler (_("%B: Unhandled import type; %x"),
+ abfd, import_type);
return FALSE;
default:
- _bfd_error_handler (_("%s: Unrecognised import type; %x"),
- bfd_archive_filename (abfd), import_type);
+ _bfd_error_handler (_("%B: Unrecognised import type; %x"),
+ abfd, import_type);
return FALSE;
}
@@ -803,8 +773,8 @@ pe_ILF_build_a_bfd (bfd * abfd,
break;
default:
- _bfd_error_handler (_("%s: Unrecognised import name type; %x"),
- bfd_archive_filename (abfd), import_name_type);
+ _bfd_error_handler (_("%B: Unrecognised import name type; %x"),
+ abfd, import_name_type);
return FALSE;
}
@@ -855,10 +825,10 @@ pe_ILF_build_a_bfd (bfd * abfd,
vars.int_reltab = (struct internal_reloc *) ptr;
ptr += SIZEOF_ILF_INT_RELOCS;
- vars.string_table = ptr;
- vars.string_ptr = ptr + STRING_SIZE_SIZE;
+ vars.string_table = (char *) ptr;
+ vars.string_ptr = (char *) ptr + STRING_SIZE_SIZE;
ptr += SIZEOF_ILF_STRINGS;
- vars.end_string_ptr = ptr;
+ vars.end_string_ptr = (char *) ptr;
/* The remaining space in bim->buffer is used
by the pe_ILF_make_a_section() function. */
@@ -886,12 +856,20 @@ pe_ILF_build_a_bfd (bfd * abfd,
/* XXX - treat as IMPORT_NAME ??? */
abort ();
+#ifdef COFF_WITH_pex64
+ ((unsigned int *) id4->contents)[0] = ordinal;
+ ((unsigned int *) id4->contents)[1] = 0x80000000;
+ ((unsigned int *) id5->contents)[0] = ordinal;
+ ((unsigned int *) id5->contents)[1] = 0x80000000;
+#else
* (unsigned int *) id4->contents = ordinal | 0x80000000;
* (unsigned int *) id5->contents = ordinal | 0x80000000;
+#endif
}
else
{
char * symbol;
+ unsigned int len;
/* Create .idata$6 - the Hint Name Table. */
id6 = pe_ILF_make_a_section (& vars, ".idata$6", SIZEOF_IDATA6, 0);
@@ -901,54 +879,35 @@ pe_ILF_build_a_bfd (bfd * abfd,
/* If necessary, trim the import symbol name. */
symbol = symbol_name;
+ /* As used by MS compiler, '_', '@', and '?' are alternative
+ forms of USER_LABEL_PREFIX, with '?' for c++ mangled names,
+ '@' used for fastcall (in C), '_' everywhere else. Only one
+ of these is used for a symbol. We strip this leading char for
+ IMPORT_NAME_NOPREFIX and IMPORT_NAME_UNDECORATE as per the
+ PE COFF 6.0 spec (section 8.3, Import Name Type). */
+
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);
+ char c = symbol[0];
+ if (c == '_' || c == '@' || c == '?')
+ symbol++;
}
+ len = strlen (symbol);
if (import_name_type == IMPORT_NAME_UNDECORATE)
{
- /* Truncate at the first '@' */
- while (* symbol != 0 && * symbol != '@')
- symbol ++;
+ /* Truncate at the first '@'. */
+ char *at = strchr (symbol, '@');
- * symbol = 0;
+ if (at != NULL)
+ len = at - symbol;
}
id6->contents[0] = ordinal & 0xff;
id6->contents[1] = ordinal >> 8;
- strcpy (id6->contents + 2, symbol);
+ memcpy ((char *) id6->contents + 2, symbol, len);
+ id6->contents[len + 2] = '\0';
}
if (import_name_type != IMPORT_ORDINAL)
@@ -1033,7 +992,7 @@ pe_ILF_build_a_bfd (bfd * abfd,
|| ! bfd_coff_set_arch_mach_hook (abfd, & internal_f))
return FALSE;
- if (bfd_coff_mkobject_hook (abfd, (PTR) & internal_f, NULL) == NULL)
+ if (bfd_coff_mkobject_hook (abfd, (void *) & internal_f, NULL) == NULL)
return FALSE;
coff_data (abfd)->pe = 1;
@@ -1046,7 +1005,7 @@ pe_ILF_build_a_bfd (bfd * abfd,
/* Switch from file contents to memory contents. */
bfd_cache_close (abfd);
- abfd->iostream = (PTR) vars.bim;
+ abfd->iostream = (void *) vars.bim;
abfd->flags |= BFD_IN_MEMORY /* | HAS_LOCALS */;
abfd->where = 0;
obj_sym_filepos (abfd) = 0;
@@ -1060,7 +1019,7 @@ pe_ILF_build_a_bfd (bfd * abfd,
/* Create an import symbol for the DLL, without the
.dll suffix. */
- ptr = strrchr (source_dll, '.');
+ ptr = (bfd_byte *) strrchr (source_dll, '.');
if (ptr)
* ptr = 0;
pe_ILF_make_a_symbol (& vars, "__IMPORT_DESCRIPTOR_", source_dll, NULL, 0);
@@ -1084,7 +1043,7 @@ pe_ILF_build_a_bfd (bfd * abfd,
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_external_syms (abfd) = (void *) vars.esym_table;
obj_coff_keep_syms (abfd) = TRUE;
obj_convert (abfd) = vars.sym_table;
@@ -1100,13 +1059,14 @@ pe_ILF_build_a_bfd (bfd * abfd,
/* 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;
+ char * symbol_name;
+ char * source_dll;
unsigned int machine;
bfd_size_type size;
unsigned int ordinal;
@@ -1144,6 +1104,12 @@ pe_ILF_object_p (bfd * abfd)
#endif
break;
+ case IMAGE_FILE_MACHINE_AMD64:
+#ifdef AMD64MAGIC
+ magic = AMD64MAGIC;
+#endif
+ break;
+
case IMAGE_FILE_MACHINE_M68K:
#ifdef MC68AGIC
magic = MC68MAGIC;
@@ -1190,9 +1156,9 @@ pe_ILF_object_p (bfd * abfd)
/* 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);
+ (_("%B: Unrecognised machine type (0x%x)"
+ " in Import Library Format archive"),
+ abfd, machine);
bfd_set_error (bfd_error_malformed_archive);
return NULL;
@@ -1202,9 +1168,9 @@ _("%s: Unrecognised machine type (0x%x) in Import Library Format archive"),
if (magic == 0)
{
_bfd_error_handler
- (
-_("%s: Recognised but unhandled machine type (0x%x) in Import Library Format archive"),
- bfd_archive_filename (abfd), machine);
+ (_("%B: Recognised but unhandled machine type (0x%x)"
+ " in Import Library Format archive"),
+ abfd, machine);
bfd_set_error (bfd_error_wrong_format);
return NULL;
@@ -1220,8 +1186,7 @@ _("%s: Recognised but unhandled machine type (0x%x) in Import Library Format arc
if (size == 0)
{
_bfd_error_handler
- (_("%s: size field is zero in Import Library Format header"),
- bfd_archive_filename (abfd));
+ (_("%B: size field is zero in Import Library Format header"), abfd);
bfd_set_error (bfd_error_malformed_archive);
return NULL;
@@ -1244,15 +1209,15 @@ _("%s: Recognised but unhandled machine type (0x%x) in Import Library Format arc
return NULL;
}
- symbol_name = ptr;
- source_dll = ptr + strlen (ptr) + 1;
+ symbol_name = (char *) ptr;
+ source_dll = symbol_name + strlen (symbol_name) + 1;
/* Verify that the strings are null terminated. */
- if (ptr[size - 1] != 0 || ((unsigned long) (source_dll - ptr) >= size))
+ if (ptr[size - 1] != 0
+ || (bfd_size_type) ((bfd_byte *) source_dll - ptr) >= size)
{
_bfd_error_handler
- (_("%s: string not null terminated in ILF object file."),
- bfd_archive_filename (abfd));
+ (_("%B: string not null terminated in ILF object file."), abfd);
bfd_set_error (bfd_error_malformed_archive);
bfd_release (abfd, ptr);
return NULL;
@@ -1269,6 +1234,25 @@ _("%s: Recognised but unhandled machine type (0x%x) in Import Library Format arc
return abfd->xvec;
}
+enum arch_type
+{
+ arch_type_unknown,
+ arch_type_i386,
+ arch_type_x86_64
+};
+
+static enum arch_type
+pe_arch (const char *arch)
+{
+ if (strcmp (arch, "i386") == 0 || strcmp (arch, "ia32") == 0)
+ return arch_type_i386;
+
+ if (strcmp (arch, "x86_64") == 0 || strcmp (arch, "x86-64") == 0)
+ return arch_type_x86_64;
+
+ return arch_type_unknown;
+}
+
static const bfd_target *
pe_bfd_object_p (bfd * abfd)
{
@@ -1276,6 +1260,7 @@ pe_bfd_object_p (bfd * abfd)
struct external_PEI_DOS_hdr dos_hdr;
struct external_PEI_IMAGE_hdr image_hdr;
file_ptr offset;
+ const bfd_target *target;
/* Detect if this a Microsoft Import Library Format element. */
if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0
@@ -1340,7 +1325,60 @@ pe_bfd_object_p (bfd * abfd)
return NULL;
}
- return coff_object_p (abfd);
+ target = coff_object_p (abfd);
+ if (target)
+ {
+ pe_data_type *pe = pe_data (abfd);
+ struct internal_extra_pe_aouthdr *i = &pe->pe_opthdr;
+ bfd_boolean efi = i->Subsystem == IMAGE_SUBSYSTEM_EFI_APPLICATION;
+ enum arch_type arch;
+ const bfd_target * const *target_ptr;
+
+ /* Get the machine. */
+ if (bfd_target_efi_p (abfd->xvec))
+ arch = pe_arch (bfd_target_efi_arch (abfd->xvec));
+ else
+ arch = pe_arch (bfd_target_pei_arch (abfd->xvec));
+
+ for (target_ptr = bfd_target_vector; *target_ptr != NULL;
+ target_ptr++)
+ {
+ if (*target_ptr == target
+ || (*target_ptr)->flavour != bfd_target_coff_flavour)
+ continue;
+
+ if (bfd_target_efi_p (*target_ptr))
+ {
+ /* Skip incompatible arch. */
+ if (pe_arch (bfd_target_efi_arch (*target_ptr)) != arch)
+ continue;
+
+ if (efi)
+ {
+ /* TARGET_PTR is an EFI backend. Don't match
+ TARGET with a EFI file. */
+ bfd_set_error (bfd_error_wrong_format);
+ return NULL;
+ }
+ }
+ else if (bfd_target_pei_p (*target_ptr))
+ {
+ /* Skip incompatible arch. */
+ if (pe_arch (bfd_target_pei_arch (*target_ptr)) != arch)
+ continue;
+
+ if (!efi)
+ {
+ /* TARGET_PTR is a PE backend. Don't match
+ TARGET with a PE file. */
+ bfd_set_error (bfd_error_wrong_format);
+ return NULL;
+ }
+ }
+ }
+ }
+
+ return target;
}
#define coff_object_p pe_bfd_object_p
diff --git a/contrib/binutils/bfd/po/BLD-POTFILES.in b/contrib/binutils/bfd/po/BLD-POTFILES.in
index 2dbe723..07ad4b3 100644
--- a/contrib/binutils/bfd/po/BLD-POTFILES.in
+++ b/contrib/binutils/bfd/po/BLD-POTFILES.in
@@ -5,4 +5,5 @@ elf64-ia64.c
elf64-target.h
peigen.c
pepigen.c
+pex64igen.c
targmatch.h
diff --git a/contrib/binutils/bfd/po/Make-in b/contrib/binutils/bfd/po/Make-in
index 1608b2d..1a61992 100644
--- a/contrib/binutils/bfd/po/Make-in
+++ b/contrib/binutils/bfd/po/Make-in
@@ -1,7 +1,8 @@
# Makefile for program source directory in GNU NLS utilities package.
# Copyright (C) 1995, 1996, 1997 by Ulrich Drepper <drepper@gnu.ai.mit.edu>
+# Copyright 2001, 2003, 2006 Free Software Foundation, Inc.
#
-# This file file be copied and used freely without restrictions. It can
+# This file may 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.
@@ -15,6 +16,7 @@ SHELL = /bin/sh
srcdir = @srcdir@
top_srcdir = @top_srcdir@
VPATH = @srcdir@
+top_builddir = @top_builddir@
prefix = @prefix@
exec_prefix = @exec_prefix@
@@ -77,7 +79,7 @@ INSTOBJEXT = @INSTOBJEXT@
$(MSGFMT) -o $@ $<
.po.gmo:
- file=$(srcdir)/`echo $* | sed 's,.*/,,'`.gmo \
+ file=`echo $* | sed 's,.*/,,'`.gmo \
&& rm -f $$file && $(GMSGFMT) -o $$file $<
.po.cat:
@@ -122,6 +124,7 @@ $(srcdir)/stamp-cat-id: $(PACKAGE).pot
install: install-exec install-data
install-exec:
install-info:
+install-html:
install-data: install-data-@USE_NLS@
install-data-no: all
install-data-yes: all
@@ -197,7 +200,7 @@ check: all
cat-id-tbl.o: ../intl/libgettext.h
-dvi info tags TAGS ID:
+html dvi pdf ps info tags TAGS ID:
mostlyclean:
rm -f core core.* *.pox $(PACKAGE).po *.old.po cat-id-tbl.tmp
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
index d29593d..5a3d361 100644
--- a/contrib/binutils/bfd/po/SRC-POTFILES.in
+++ b/contrib/binutils/bfd/po/SRC-POTFILES.in
@@ -23,11 +23,9 @@ 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
@@ -43,6 +41,7 @@ coff-i960.c
cofflink.c
coff-m68k.c
coff-m88k.c
+coff-maxq.c
coff-mips.c
coff-or32.c
coff-rs6000.c
@@ -58,14 +57,19 @@ coff-tic80.c
coff-u68k.c
coff-w65.c
coff-we32k.c
+coff-x86_64.c
+coff-z80.c
coff-z8k.c
corefile.c
-cpu-a29k.c
cpu-alpha.c
cpu-arc.c
cpu-arm.c
cpu-avr.c
+cpu-bfin.c
+cpu-cr16.c
+cpu-cr16c.c
cpu-cris.c
+cpu-crx.c
cpu-d10v.c
cpu-d30v.c
cpu-dlx.c
@@ -83,15 +87,19 @@ cpu-ip2k.c
cpu-iq2000.c
cpu-m10200.c
cpu-m10300.c
+cpu-m32c.c
cpu-m32r.c
cpu-m68hc11.c
cpu-m68hc12.c
cpu-m68k.c
cpu-m88k.c
+cpu-maxq.c
cpu-mcore.c
+cpu-mep.c
cpu-mips.c
cpu-mmix.c
cpu-msp430.c
+cpu-mt.c
cpu-ns32k.c
cpu-openrisc.c
cpu-or32.c
@@ -100,8 +108,10 @@ cpu-pj.c
cpu-powerpc.c
cpu-rs6000.c
cpu-s390.c
+cpu-score.c
cpu-sh.c
cpu-sparc.c
+cpu-spu.c
cpu-tic30.c
cpu-tic4x.c
cpu-tic54x.c
@@ -110,8 +120,10 @@ cpu-v850.c
cpu-vax.c
cpu-w65.c
cpu-we32k.c
+cpu-xc16x.c
cpu-xstormy16.c
cpu-xtensa.c
+cpu-z80.c
cpu-z8k.c
demo64.c
dwarf1.c
@@ -121,12 +133,17 @@ ecofflink.c
ecoffswap.h
efi-app-ia32.c
efi-app-ia64.c
+efi-app-x86_64.c
elf32-am33lin.c
elf32-arc.c
-elf32-arm.h
+elf32-arm.c
elf32-avr.c
+elf32-bfin.c
elf32.c
+elf32-cr16.c
+elf32-cr16c.c
elf32-cris.c
+elf32-crx.c
elf32-d10v.c
elf32-d30v.c
elf32-dlx.c
@@ -142,6 +159,7 @@ elf32-i860.c
elf32-i960.c
elf32-ip2k.c
elf32-iq2000.c
+elf32-m32c.c
elf32-m32r.c
elf32-m68hc11.c
elf32-m68hc12.c
@@ -149,19 +167,25 @@ elf32-m68hc1x.c
elf32-m68k.c
elf32-m88k.c
elf32-mcore.c
+elf32-mep.c
elf32-mips.c
elf32-msp430.c
+elf32-mt.c
elf32-openrisc.c
elf32-or32.c
elf32-pj.c
elf32-ppc.c
elf32-s390.c
+elf32-score.c
elf32-sh64.c
elf32-sh64-com.c
elf32-sh.c
+elf32-sh-symbian.c
elf32-sparc.c
+elf32-spu.c
elf32-v850.c
elf32-vax.c
+elf32-xc16x.c
elf32-xstormy16.c
elf32-xtensa.c
elf64-alpha.c
@@ -176,8 +200,7 @@ elf64-s390.c
elf64-sh64.c
elf64-sparc.c
elf64-x86-64.c
-elfarm-nabi.c
-elfarm-oabi.c
+elf-attrs.c
elf-bfd.h
elf.c
elfcode.h
@@ -189,7 +212,9 @@ elf-m10200.c
elf-m10300.c
elfn32-mips.c
elf-strtab.c
+elf-vxworks.c
elfxx-mips.c
+elfxx-sparc.c
epoc-pe-arm.c
epoc-pei-arm.c
format.c
@@ -229,9 +254,9 @@ linker.c
lynx-core.c
m68k4knetbsd.c
m68klinux.c
-m68klynx.c
m68knetbsd.c
m88kmach3.c
+m88kopenbsd.c
mach-o.c
mach-o.h
merge.c
@@ -257,21 +282,25 @@ osf-core.c
pc532-mach.c
pdp11.c
pe-arm.c
+pe-arm-wince.c
pef.c
pef.h
pef-traceback.h
pe-i386.c
pei-arm.c
+pei-arm-wince.c
peicode.h
pei-i386.c
pei-mcore.c
pei-mips.c
pei-ppc.c
pei-sh.c
+pei-x86_64.c
pe-mcore.c
pe-mips.c
pe-ppc.c
pe-sh.c
+pe-x86_64.c
ppcboot.c
reloc16.c
reloc.c
diff --git a/contrib/binutils/bfd/po/bfd.pot b/contrib/binutils/bfd/po/bfd.pot
index 5d4f234..a01ee37 100644
--- a/contrib/binutils/bfd/po/bfd.pot
+++ b/contrib/binutils/bfd/po/bfd.pot
@@ -1,12 +1,14 @@
# SOME DESCRIPTIVE TITLE.
-# Copyright (C) YEAR Free Software Foundation, Inc.
+# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
+# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
-"POT-Creation-Date: 2003-07-17 14:52+0100\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2007-07-02 16:16+0930\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"
@@ -14,1480 +16,1995 @@ msgstr ""
"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"
+#: aout-adobe.c:127
+msgid "%B: Unknown section type in a.out.adobe file: %x\n"
msgstr ""
-#: aout-cris.c:207
+#: aout-cris.c:202
#, c-format
msgid "%s: Invalid relocation type exported: %d"
msgstr ""
-#: aout-cris.c:251
-#, c-format
-msgid "%s: Invalid relocation type imported: %d"
+#: aout-cris.c:245
+msgid "%B: Invalid relocation type imported: %d"
msgstr ""
-#: aout-cris.c:262
-#, c-format
-msgid "%s: Bad relocation record imported: %d"
+#: aout-cris.c:256
+msgid "%B: Bad relocation record imported: %d"
msgstr ""
-#: aoutx.h:1295 aoutx.h:1716
+#: aoutx.h:1267 aoutx.h:1601
#, c-format
msgid "%s: can not represent section `%s' in a.out object file format"
msgstr ""
-#: aoutx.h:1682
+#: aoutx.h:1567
#, c-format
msgid ""
"%s: can not represent section for symbol `%s' in a.out object file format"
msgstr ""
-#: aoutx.h:1684
+#: aoutx.h:1569
msgid "*unknown*"
msgstr ""
-#: aoutx.h:3776
+#: aoutx.h:5311
#, c-format
msgid "%s: relocatable link from %s to %s not supported"
msgstr ""
-#: archive.c:1751
+#: archive.c:1764
msgid "Warning: writing archive was slow: rewriting timestamp\n"
msgstr ""
-#: archive.c:2014
+#: archive.c:2027
msgid "Reading archive file mod timestamp"
msgstr ""
-#: archive.c:2040
+#: archive.c:2051
msgid "Writing updated armap timestamp"
msgstr ""
-#: bfd.c:280
+#: bfd.c:288
msgid "No error"
msgstr ""
-#: bfd.c:281
+#: bfd.c:289
msgid "System call error"
msgstr ""
-#: bfd.c:282
+#: bfd.c:290
msgid "Invalid bfd target"
msgstr ""
-#: bfd.c:283
+#: bfd.c:291
msgid "File in wrong format"
msgstr ""
-#: bfd.c:284
+#: bfd.c:292
msgid "Archive object file in wrong format"
msgstr ""
-#: bfd.c:285
+#: bfd.c:293
msgid "Invalid operation"
msgstr ""
-#: bfd.c:286
+#: bfd.c:294
msgid "Memory exhausted"
msgstr ""
-#: bfd.c:287
+#: bfd.c:295
msgid "No symbols"
msgstr ""
-#: bfd.c:288
+#: bfd.c:296
msgid "Archive has no index; run ranlib to add one"
msgstr ""
-#: bfd.c:289
+#: bfd.c:297
msgid "No more archived files"
msgstr ""
-#: bfd.c:290
+#: bfd.c:298
msgid "Malformed archive"
msgstr ""
-#: bfd.c:291
+#: bfd.c:299
msgid "File format not recognized"
msgstr ""
-#: bfd.c:292
+#: bfd.c:300
msgid "File format is ambiguous"
msgstr ""
-#: bfd.c:293
+#: bfd.c:301
msgid "Section has no contents"
msgstr ""
-#: bfd.c:294
+#: bfd.c:302
msgid "Nonrepresentable section on output"
msgstr ""
-#: bfd.c:295
+#: bfd.c:303
msgid "Symbol needs debug section which does not exist"
msgstr ""
-#: bfd.c:296
+#: bfd.c:304
msgid "Bad value"
msgstr ""
-#: bfd.c:297
+#: bfd.c:305
msgid "File truncated"
msgstr ""
-#: bfd.c:298
+#: bfd.c:306
msgid "File too big"
msgstr ""
-#: bfd.c:299
+#: bfd.c:307
+#, c-format
+msgid "Error reading %s: %s"
+msgstr ""
+
+#: bfd.c:308
msgid "#<Invalid error code>"
msgstr ""
-#: bfd.c:687
+#: bfd.c:829
#, c-format
msgid "BFD %s assertion fail %s:%d"
msgstr ""
-#: bfd.c:703
+#: bfd.c:841
#, c-format
msgid "BFD %s internal error, aborting at %s line %d in %s\n"
msgstr ""
-#: bfd.c:707
+#: bfd.c:845
#, c-format
msgid "BFD %s internal error, aborting at %s line %d\n"
msgstr ""
-#: bfd.c:709
+#: bfd.c:847
msgid "Please report this bug.\n"
msgstr ""
-#: bfdwin.c:202
+#: bfdwin.c:207
#, c-format
msgid "not mapping: data=%lx mapped=%d\n"
msgstr ""
-#: bfdwin.c:205
+#: bfdwin.c:210
+#, c-format
msgid "not mapping: env var not set\n"
msgstr ""
-#: binary.c:306
+#: binary.c:283
#, 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"
+#: cache.c:237
+msgid "reopening %B: %s\n"
msgstr ""
-#: coff-a29k.c:120
-msgid "Missing IHCONST"
+#: coff64-rs6000.c:2125 coff-rs6000.c:3623
+msgid "%B: symbol `%s' has unrecognized smclas %d"
msgstr ""
-#: coff-a29k.c:181
-msgid "Missing IHIHALF"
+#: coff-alpha.c:489
+msgid ""
+"%B: Cannot handle compressed Alpha binaries.\n"
+" Use compiler flags, or objZ, to generate uncompressed binaries."
msgstr ""
-#: coff-a29k.c:213 coff-or32.c:236
-msgid "Unrecognized reloc"
+#: coff-alpha.c:646
+msgid "%B: unknown/unsupported relocation type %d"
msgstr ""
-#: coff-a29k.c:409
-msgid "missing IHCONST reloc"
+#: coff-alpha.c:898 coff-alpha.c:935 coff-alpha.c:2023 coff-mips.c:1001
+msgid "GP relative relocation used when GP not defined"
msgstr ""
-#: coff-a29k.c:499
-msgid "missing IHIHALF reloc"
+#: coff-alpha.c:1500
+msgid "using multiple gp values"
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"
+#: coff-alpha.c:1559
+msgid "%B: unsupported relocation: ALPHA_R_GPRELHIGH"
msgstr ""
-#: coff-alpha.c:1488
-msgid "using multiple gp values"
+#: coff-alpha.c:1566
+msgid "%B: unsupported relocation: ALPHA_R_GPRELLOW"
msgstr ""
-#: coff-arm.c:1066 elf32-arm.h:294
-#, c-format
-msgid "%s: unable to find THUMB glue '%s' for `%s'"
+#: coff-alpha.c:1573 elf32-m32r.c:2486 elf64-alpha.c:3951 elf64-alpha.c:4104
+#: elf32-ia64.c:4674 elf64-ia64.c:4674
+msgid "%B: unknown relocation type %d"
msgstr ""
-#: coff-arm.c:1096 elf32-arm.h:329
+#: coff-arm.c:1035
#, c-format
-msgid "%s: unable to find ARM glue '%s' for `%s'"
+msgid "%B: unable to find THUMB glue '%s' for `%s'"
msgstr ""
-#: coff-arm.c:1394 coff-arm.c:1489 elf32-arm.h:892 elf32-arm.h:999
+#: coff-arm.c:1064
#, c-format
-msgid "%s(%s): warning: interworking not enabled."
+msgid "%B: unable to find ARM glue '%s' for `%s'"
msgstr ""
-#: coff-arm.c:1398 elf32-arm.h:1002
+#: coff-arm.c:1366 elf32-arm.c:4156
#, c-format
-msgid " first occurrence: %s: arm call to thumb"
+msgid ""
+"%B(%s): warning: interworking not enabled.\n"
+" first occurrence: %B: arm call to thumb"
msgstr ""
-#: coff-arm.c:1493 elf32-arm.h:895
+#: coff-arm.c:1456
#, c-format
-msgid " first occurrence: %s: thumb call to arm"
-msgstr ""
-
-#: coff-arm.c:1496
-msgid " consider relinking with --support-old-code enabled"
+msgid ""
+"%B(%s): warning: interworking not enabled.\n"
+" first occurrence: %B: thumb call to arm\n"
+" 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'"
+#: coff-arm.c:1749 cofflink.c:3014 coff-tic80.c:695
+msgid "%B: bad reloc address 0x%lx in section `%A'"
msgstr ""
-#: coff-arm.c:2132
-#, c-format
-msgid "%s: illegal symbol index in reloc: %d"
+#: coff-arm.c:2074
+msgid "%B: illegal symbol index in reloc: %d"
msgstr ""
-#: coff-arm.c:2265
+#: coff-arm.c:2205
#, c-format
-msgid "ERROR: %s is compiled for APCS-%d, whereas %s is compiled for APCS-%d"
+msgid "ERROR: %B is compiled for APCS-%d, whereas %B is compiled for APCS-%d"
msgstr ""
-#: coff-arm.c:2280 elf32-arm.h:2328
+#: coff-arm.c:2221 elf32-arm.c:7103
#, c-format
msgid ""
-"ERROR: %s passes floats in float registers, whereas %s passes them in "
+"ERROR: %B passes floats in float registers, whereas %B passes them in "
"integer registers"
msgstr ""
-#: coff-arm.c:2283 elf32-arm.h:2333
+#: coff-arm.c:2224 elf32-arm.c:7107
#, c-format
msgid ""
-"ERROR: %s passes floats in integer registers, whereas %s passes them in "
+"ERROR: %B passes floats in integer registers, whereas %B passes them in "
"float registers"
msgstr ""
-#: coff-arm.c:2298
+#: coff-arm.c:2238
#, c-format
msgid ""
-"ERROR: %s is compiled as position independent code, whereas target %s is "
+"ERROR: %B is compiled as position independent code, whereas target %B is "
"absolute position"
msgstr ""
-#: coff-arm.c:2301
+#: coff-arm.c:2241
#, c-format
msgid ""
-"ERROR: %s is compiled as absolute position code, whereas target %s is "
+"ERROR: %B is compiled as absolute position code, whereas target %B is "
"position independent"
msgstr ""
-#: coff-arm.c:2330 elf32-arm.h:2405
+#: coff-arm.c:2269 elf32-arm.c:7172
#, c-format
-msgid "Warning: %s supports interworking, whereas %s does not"
+msgid "Warning: %B supports interworking, whereas %B does not"
msgstr ""
-#: coff-arm.c:2333 elf32-arm.h:2412
+#: coff-arm.c:2272 elf32-arm.c:7178
#, c-format
-msgid "Warning: %s does not support interworking, whereas %s does"
+msgid "Warning: %B does not support interworking, whereas %B does"
msgstr ""
-#: coff-arm.c:2360
+#: coff-arm.c:2296
#, c-format
msgid "private flags = %x:"
msgstr ""
-#: coff-arm.c:2368 elf32-arm.h:2467
+#: coff-arm.c:2304 elf32-arm.c:7229
+#, c-format
msgid " [floats passed in float registers]"
msgstr ""
-#: coff-arm.c:2370
+#: coff-arm.c:2306
+#, c-format
msgid " [floats passed in integer registers]"
msgstr ""
-#: coff-arm.c:2373 elf32-arm.h:2470
+#: coff-arm.c:2309 elf32-arm.c:7232
+#, c-format
msgid " [position independent]"
msgstr ""
-#: coff-arm.c:2375
+#: coff-arm.c:2311
+#, c-format
msgid " [absolute position]"
msgstr ""
-#: coff-arm.c:2379
+#: coff-arm.c:2315
+#, c-format
msgid " [interworking flag not initialised]"
msgstr ""
-#: coff-arm.c:2381
+#: coff-arm.c:2317
+#, c-format
msgid " [interworking supported]"
msgstr ""
-#: coff-arm.c:2383
+#: coff-arm.c:2319
+#, c-format
msgid " [interworking not supported]"
msgstr ""
-#: coff-arm.c:2431 elf32-arm.h:2150
+#: coff-arm.c:2365 elf32-arm.c:6626
#, c-format
msgid ""
-"Warning: Not setting interworking flag of %s since it has already been "
+"Warning: Not setting interworking flag of %B since it has already been "
"specified as non-interworking"
msgstr ""
-#: coff-arm.c:2435 elf32-arm.h:2154
+#: coff-arm.c:2369 elf32-arm.c:6630
#, c-format
-msgid "Warning: Clearing the interworking flag of %s due to outside request"
+msgid "Warning: Clearing the interworking flag of %B due to outside request"
msgstr ""
-#: coffcode.h:1108
-#, c-format
-msgid "%s (%s): Section flag %s (0x%x) ignored"
+#: coffcode.h:849
+msgid "%B: warning: COMDAT symbol '%s' does not match section name '%s'"
msgstr ""
-#: coffcode.h:2214
+#. Generate a warning message rather using the 'unhandled'
+#. variable as this will allow some .sys files generate by
+#. other toolchains to be processed. See bugzilla issue 196.
+#: coffcode.h:1061
+msgid ""
+"%B: Warning: Ignoring section flag IMAGE_SCN_MEM_NOT_PAGED in section %s"
+msgstr ""
+
+#: coffcode.h:1116
+msgid "%B (%s): Section flag %s (0x%x) ignored"
+msgstr ""
+
+#: coffcode.h:2231
#, 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"
+#: coffcode.h:2546
+msgid "%B: reloc against a non-existant symbol index: %ld"
msgstr ""
-#: coffcode.h:4453
-#, c-format
-msgid "%s: warning: duplicate line number information for `%s'"
+#: coffcode.h:4269
+msgid "%B: warning: line number table read failed"
msgstr ""
-#: coffcode.h:4807
-#, c-format
-msgid "%s: Unrecognized storage class %d for %s symbol `%s'"
+#: coffcode.h:4301
+msgid "%B: warning: illegal symbol index %ld in line numbers"
msgstr ""
-#: coffcode.h:4940
-#, c-format
-msgid "warning: %s: local symbol `%s' has no section"
+#: coffcode.h:4315
+msgid "%B: warning: duplicate line number information for `%s'"
msgstr ""
-#: coff-tic4x.c:218 coff-tic54x.c:373 coffcode.h:5047
-#, c-format
-msgid "%s: warning: illegal symbol index %ld in relocs"
+#: coffcode.h:4655
+msgid "%B: Unrecognized storage class %d for %s symbol `%s'"
msgstr ""
-#: coffcode.h:5085
-#, c-format
-msgid "%s: illegal relocation type %d at address 0x%lx"
+#: coffcode.h:4781
+msgid "warning: %B: local symbol `%s' has no section"
msgstr ""
-#: coffgen.c:1666
-#, c-format
-msgid "%s: bad string table size %lu"
+#: coffcode.h:4886 coff-i860.c:600 coff-tic54x.c:393
+msgid "%B: warning: illegal symbol index %ld in relocs"
+msgstr ""
+
+#: coffcode.h:4924
+msgid "%B: illegal relocation type %d at address 0x%lx"
+msgstr ""
+
+#: coffgen.c:1511
+msgid "%B: bad string table size %lu"
msgstr ""
-#: coff-h8300.c:1047
+#: coff-h8300.c:1121
#, c-format
msgid "cannot handle R_MEM_INDIRECT reloc when using %s output"
msgstr ""
-#: coff-i960.c:137 coff-i960.c:486
+#: coff-i860.c:142
+#, c-format
+msgid "Relocation `%s' not yet implemented\n"
+msgstr ""
+
+#: coff-i960.c:137 coff-i960.c:500
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"
+#: cofflink.c:509 elflink.c:4158
+msgid "Warning: type of symbol `%s' changed from %d to %d in %B"
msgstr ""
-#: cofflink.c:2328
-#, c-format
-msgid "%s: relocs in section `%s', but it has no contents"
+#: cofflink.c:2292
+msgid "%B: relocs in section `%A', but it has no contents"
msgstr ""
-#: cofflink.c:2671 coffswap.h:890
+#: cofflink.c:2623 coffswap.h:823
#, c-format
msgid "%s: %s: reloc overflow: 0x%lx > 0xffff"
msgstr ""
-#: cofflink.c:2680 coffswap.h:876
+#: cofflink.c:2632 coffswap.h:809
#, 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
+#: coff-m68k.c:505 elf32-bfin.c:5434 elf32-m68k.c:2392
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"
+#: coff-maxq.c:126
+msgid "Can't Make it a Short Jump"
+msgstr ""
+
+#: coff-maxq.c:191
+msgid "Exceeds Long Jump Range"
+msgstr ""
+
+#: coff-maxq.c:202 coff-maxq.c:276
+msgid "Absolute address Exceeds 16 bit Range"
+msgstr ""
+
+#: coff-maxq.c:240
+msgid "Absolute address Exceeds 8 bit Range"
+msgstr ""
+
+#: coff-maxq.c:333
+msgid "Unrecognized Reloc Type"
msgstr ""
-#. No other sections should appear in -membedded-pic
-#. code.
-#: coff-mips.c:2431
-msgid "reloc against unsupported section"
+#: coff-mips.c:686 elf32-mips.c:956 elf32-score.c:344 elf64-mips.c:1896
+#: elfn32-mips.c:1750
+msgid "GP relative relocation when _gp not defined"
msgstr ""
-#: coff-mips.c:2439
-msgid "reloc not properly aligned"
+#: coff-or32.c:227
+msgid "Unrecognized reloc"
msgstr ""
-#: coff-rs6000.c:2790
+#: coff-rs6000.c:2798
#, c-format
msgid "%s: unsupported relocation type 0x%02x"
msgstr ""
-#: coff-rs6000.c:2883
+#: coff-rs6000.c:2891
#, 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
+#: coff-tic4x.c:191 coff-tic54x.c:299 coff-tic80.c:458
#, c-format
msgid "Unrecognized reloc type 0x%x"
msgstr ""
-#: coff-w65.c:364
+#: coff-tic4x.c:236
#, c-format
-msgid "ignoring reloc %s\n"
+msgid "%s: warning: illegal symbol index %ld in relocs"
msgstr ""
-#: cpu-arm.c:196 cpu-arm.c:206
+#: coff-w65.c:366
#, c-format
-msgid "ERROR: %s is compiled for the EP9312, whereas %s is compiled for XScale"
+msgid "ignoring reloc %s\n"
+msgstr ""
+
+#: cpu-arm.c:188 cpu-arm.c:199
+msgid "ERROR: %B is compiled for the EP9312, whereas %B is compiled for XScale"
msgstr ""
-#: cpu-arm.c:344
+#: cpu-arm.c:331
#, c-format
msgid "warning: unable to update contents of %s section in %s"
msgstr ""
-#: dwarf2.c:380
+#: dwarf2.c:329
msgid "Dwarf Error: Can't find .debug_str section."
msgstr ""
-#: dwarf2.c:397
+#: dwarf2.c:347
#, c-format
msgid ""
"Dwarf Error: DW_FORM_strp offset (%lu) greater than or equal to .debug_str "
"size (%lu)."
msgstr ""
-#: dwarf2.c:541
+#: dwarf2.c:440
msgid "Dwarf Error: Can't find .debug_abbrev section."
msgstr ""
-#: dwarf2.c:556
+#: dwarf2.c:455
#, c-format
msgid ""
"Dwarf Error: Abbrev offset (%lu) greater than or equal to .debug_abbrev size "
"(%lu)."
msgstr ""
-#: dwarf2.c:756
+#: dwarf2.c:670
#, c-format
msgid "Dwarf Error: Invalid or unhandled FORM value: %u."
msgstr ""
-#: dwarf2.c:933
+#: dwarf2.c:873
msgid "Dwarf Error: mangled line number section (bad file number)."
msgstr ""
-#: dwarf2.c:1032
+#: dwarf2.c:985
msgid "Dwarf Error: Can't find .debug_line section."
msgstr ""
-#: dwarf2.c:1049
+#: dwarf2.c:1002
#, c-format
msgid ""
"Dwarf Error: Line offset (%lu) greater than or equal to .debug_line size (%"
"lu)."
msgstr ""
-#: dwarf2.c:1255
+#: dwarf2.c:1228
msgid "Dwarf Error: mangled line number section."
msgstr ""
-#: dwarf2.c:1470 dwarf2.c:1620
+#: dwarf2.c:1416
+msgid "Dwarf Error: Can't find .debug_ranges section."
+msgstr ""
+
+#: dwarf2.c:1579 dwarf2.c:1695 dwarf2.c:1965
#, c-format
msgid "Dwarf Error: Could not find abbrev number %u."
msgstr ""
-#: dwarf2.c:1581
+#: dwarf2.c:1926
#, c-format
msgid ""
"Dwarf Error: found dwarf version '%u', this reader only handles version 2 "
"information."
msgstr ""
-#: dwarf2.c:1588
+#: dwarf2.c:1933
#, c-format
msgid ""
"Dwarf Error: found address size '%u', this reader can not handle sizes "
"greater than '%u'."
msgstr ""
-#: dwarf2.c:1611
+#: dwarf2.c:1956
#, c-format
msgid "Dwarf Error: Bad abbrev number: %u."
msgstr ""
-#: ecoff.c:1339
+#: ecoff.c:1226
#, c-format
msgid "Unknown basic type %d"
msgstr ""
-#: ecoff.c:1599
+#: ecoff.c:1483
#, c-format
msgid ""
"\n"
" End+1 symbol: %ld"
msgstr ""
-#: ecoff.c:1606 ecoff.c:1609
+#: ecoff.c:1490 ecoff.c:1493
#, c-format
msgid ""
"\n"
" First symbol: %ld"
msgstr ""
-#: ecoff.c:1621
+#: ecoff.c:1505
#, c-format
msgid ""
"\n"
" End+1 symbol: %-7ld Type: %s"
msgstr ""
-#: ecoff.c:1628
+#: ecoff.c:1512
#, c-format
msgid ""
"\n"
" Local symbol: %ld"
msgstr ""
-#: ecoff.c:1636
+#: ecoff.c:1520
#, c-format
msgid ""
"\n"
" struct; End+1 symbol: %ld"
msgstr ""
-#: ecoff.c:1641
+#: ecoff.c:1525
#, c-format
msgid ""
"\n"
" union; End+1 symbol: %ld"
msgstr ""
-#: ecoff.c:1646
+#: ecoff.c:1530
#, c-format
msgid ""
"\n"
" enum; End+1 symbol: %ld"
msgstr ""
-#: ecoff.c:1652
+#: ecoff.c:1536
#, c-format
msgid ""
"\n"
" Type: %s"
msgstr ""
-#: elf32-arm.h:1228
+#: elf32-arm.c:2516
#, c-format
-msgid "%s: Warning: Arm BLX instruction targets Arm function '%s'."
+msgid "unable to find THUMB glue '%s' for '%s'"
msgstr ""
-#: elf32-arm.h:1424
+#: elf32-arm.c:2549
#, c-format
-msgid "%s: Warning: Thumb BLX instruction targets thumb function '%s'."
+msgid "unable to find ARM glue '%s' for '%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"
+#: elf32-arm.c:3119
+msgid "%B: BE8 images only valid in big-endian mode."
+msgstr ""
+
+#. Give a warning, but do as the user requests anyway.
+#: elf32-arm.c:3320
+msgid ""
+"%B: warning: selected VFP11 erratum workaround is not necessary for target "
+"architecture"
+msgstr ""
+
+#: elf32-arm.c:3854 elf32-arm.c:3874
+msgid "%B: unable to find VFP11 veneer `%s'"
msgstr ""
-#: elf32-arm.h:2012
+#: elf32-arm.c:3919
#, c-format
+msgid "Invalid TARGET2 relocation type '%s'."
+msgstr ""
+
+#: elf32-arm.c:4060
msgid ""
-"%s: warning: unresolvable relocation %d against symbol `%s' from %s section"
+"%B(%s): warning: interworking not enabled.\n"
+" first occurrence: %B: thumb call to arm"
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"
+#: elf32-arm.c:4748
+msgid "\\%B: Warning: Arm BLX instruction targets Arm function '%s'."
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"
+#: elf32-arm.c:5047
+msgid "%B: Warning: Thumb BLX instruction targets thumb function '%s'."
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"
+#: elf32-arm.c:5738
+msgid "%B(%A+0x%lx): R_ARM_TLS_LE32 relocation not permitted in shared object"
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"
+#: elf32-arm.c:5939
+msgid ""
+"%B(%A+0x%lx): Only ADD or SUB instructions are allowed for ALU group "
+"relocations"
msgstr ""
-#: elf32-arm.h:2202
-#, c-format
+#: elf32-arm.c:5979 elf32-arm.c:6066 elf32-arm.c:6149 elf32-arm.c:6234
+msgid "%B(%A+0x%lx): Overflow whilst splitting 0x%lx for group relocation %s"
+msgstr ""
+
+#: elf32-arm.c:6417 elf32-sh.c:3303 elf64-sh64.c:1555
+msgid "%B(%A+0x%lx): %s relocation against SEC_MERGE section"
+msgstr ""
+
+#: elf32-arm.c:6506 elf64-ppc.c:9972
+msgid "%B(%A+0x%lx): %s used with TLS symbol %s"
+msgstr ""
+
+#: elf32-arm.c:6507 elf64-ppc.c:9973
+msgid "%B(%A+0x%lx): %s used with non-TLS symbol %s"
+msgstr ""
+
+#: elf32-arm.c:6530 elf32-i386.c:3305 elf32-m32r.c:2597 elf32-m68k.c:1981
+#: elf32-ppc.c:6791 elf32-s390.c:3048 elf32-sh.c:3407 elf32-xtensa.c:2290
+#: elf64-ppc.c:11137 elf64-s390.c:3009 elf64-sh64.c:1647 elf64-x86-64.c:3001
+#: elf-hppa.h:2193 elf-m10300.c:1459 elfxx-sparc.c:3254
+msgid "%B(%A+0x%lx): unresolvable %s relocation against symbol `%s'"
+msgstr ""
+
+#: elf32-arm.c:6564
+msgid "out of range"
+msgstr ""
+
+#: elf32-arm.c:6568
+msgid "unsupported relocation"
+msgstr ""
+
+#: elf32-arm.c:6576
+msgid "unknown error"
+msgstr ""
+
+#: elf32-arm.c:6676
msgid ""
-"Warning: Clearing the interworking flag of %s because non-interworking code "
-"in %s has been linked with it"
+"Warning: Clearing the interworking flag of %B because non-interworking code "
+"in %B has been linked with it"
msgstr ""
-#: elf32-arm.h:2302
-#, c-format
+#: elf32-arm.c:6778
+msgid "ERROR: %B uses VFP register arguments, %B does not"
+msgstr ""
+
+#: elf32-arm.c:6828
+msgid "ERROR: %B: Conflicting architecture profiles %c/%c"
+msgstr ""
+
+#: elf32-arm.c:6843
+msgid "Warning: %B: Conflicting platform configuration"
+msgstr ""
+
+#: elf32-arm.c:6852
+msgid "ERROR: %B: Conflicting use of R9"
+msgstr ""
+
+#: elf32-arm.c:6864
+msgid "ERROR: %B: SB relative addressing conflicts with use of R9"
+msgstr ""
+
+#: elf32-arm.c:6886
+msgid "ERROR: %B: Conflicting definitions of wchar_t"
+msgstr ""
+
+#: elf32-arm.c:6915
msgid ""
-"ERROR: %s is compiled for EABI version %d, whereas %s is compiled for "
-"version %d"
+"warning: %B uses %s enums yet the output is to use %s enums; use of enum "
+"values across objects may fail"
msgstr ""
-#: elf32-arm.h:2316
-#, c-format
-msgid "ERROR: %s is compiled for APCS-%d, whereas target %s uses APCS-%d"
+#: elf32-arm.c:6928
+msgid "ERROR: %B uses iWMMXt register arguments, %B does not"
msgstr ""
-#: elf32-arm.h:2344
-#, c-format
-msgid "ERROR: %s uses VFP instructions, whereas %s does not"
+#: elf32-arm.c:6951
+msgid "Warning: %B: Unknown EABI object attribute %d"
msgstr ""
-#: elf32-arm.h:2349
-#, c-format
-msgid "ERROR: %s uses FPA instructions, whereas %s does not"
+#: elf32-arm.c:7076
+msgid ""
+"ERROR: Source object %B has EABI version %d, but target %B has EABI version %"
+"d"
msgstr ""
-#: elf32-arm.h:2360 elf32-arm.h:2365
-#, c-format
-msgid "ERROR: %s uses Maverick instructions, whereas %s does not"
+#: elf32-arm.c:7092
+msgid "ERROR: %B is compiled for APCS-%d, whereas target %B uses APCS-%d"
msgstr ""
-#: elf32-arm.h:2385
-#, c-format
-msgid "ERROR: %s uses software FP, whereas %s uses hardware FP"
+#: elf32-arm.c:7117
+msgid "ERROR: %B uses VFP instructions, whereas %B does not"
msgstr ""
-#: elf32-arm.h:2390
-#, c-format
-msgid "ERROR: %s uses hardware FP, whereas %s uses software FP"
+#: elf32-arm.c:7121
+msgid "ERROR: %B uses FPA instructions, whereas %B does not"
+msgstr ""
+
+#: elf32-arm.c:7131
+msgid "ERROR: %B uses Maverick instructions, whereas %B does not"
+msgstr ""
+
+#: elf32-arm.c:7135
+msgid "ERROR: %B does not use Maverick instructions, whereas %B does"
+msgstr ""
+
+#: elf32-arm.c:7154
+msgid "ERROR: %B uses software FP, whereas %B uses hardware FP"
+msgstr ""
+
+#: elf32-arm.c:7158
+msgid "ERROR: %B uses hardware FP, whereas %B 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
+#. Ignore init flag - it may not be set, despite the flags field containing valid data.
+#: elf32-arm.c:7205 elf32-bfin.c:4795 elf32-cris.c:3233 elf32-m68hc1x.c:1276
+#: elf32-m68k.c:619 elf32-score.c:3752 elf32-vax.c:537 elfxx-mips.c:11310
#, c-format
msgid "private flags = %lx:"
msgstr ""
-#: elf32-arm.h:2452
+#: elf32-arm.c:7214
+#, c-format
msgid " [interworking enabled]"
msgstr ""
-#: elf32-arm.h:2460
+#: elf32-arm.c:7222
+#, c-format
msgid " [VFP float format]"
msgstr ""
-#: elf32-arm.h:2462
+#: elf32-arm.c:7224
+#, c-format
msgid " [Maverick float format]"
msgstr ""
-#: elf32-arm.h:2464
+#: elf32-arm.c:7226
+#, c-format
msgid " [FPA float format]"
msgstr ""
-#: elf32-arm.h:2473
+#: elf32-arm.c:7235
+#, c-format
msgid " [new ABI]"
msgstr ""
-#: elf32-arm.h:2476
+#: elf32-arm.c:7238
+#, c-format
msgid " [old ABI]"
msgstr ""
-#: elf32-arm.h:2479
+#: elf32-arm.c:7241
+#, c-format
msgid " [software FP]"
msgstr ""
-#: elf32-arm.h:2488
+#: elf32-arm.c:7250
+#, c-format
msgid " [Version1 EABI]"
msgstr ""
-#: elf32-arm.h:2491 elf32-arm.h:2502
+#: elf32-arm.c:7253 elf32-arm.c:7264
+#, c-format
msgid " [sorted symbol table]"
msgstr ""
-#: elf32-arm.h:2493 elf32-arm.h:2504
+#: elf32-arm.c:7255 elf32-arm.c:7266
+#, c-format
msgid " [unsorted symbol table]"
msgstr ""
-#: elf32-arm.h:2499
+#: elf32-arm.c:7261
+#, c-format
msgid " [Version2 EABI]"
msgstr ""
-#: elf32-arm.h:2507
+#: elf32-arm.c:7269
+#, c-format
msgid " [dynamic symbols use segment index]"
msgstr ""
-#: elf32-arm.h:2510
+#: elf32-arm.c:7272
+#, c-format
msgid " [mapping symbols precede others]"
msgstr ""
-#: elf32-arm.h:2517
+#: elf32-arm.c:7279
+#, c-format
+msgid " [Version3 EABI]"
+msgstr ""
+
+#: elf32-arm.c:7283
+#, c-format
+msgid " [Version4 EABI]"
+msgstr ""
+
+#: elf32-arm.c:7287
+#, c-format
+msgid " [Version5 EABI]"
+msgstr ""
+
+#: elf32-arm.c:7290
+#, c-format
+msgid " [BE8]"
+msgstr ""
+
+#: elf32-arm.c:7293
+#, c-format
+msgid " [LE8]"
+msgstr ""
+
+#: elf32-arm.c:7299
+#, c-format
msgid " <EABI version unrecognised>"
msgstr ""
-#: elf32-arm.h:2524
+#: elf32-arm.c:7306
+#, c-format
msgid " [relocatable executable]"
msgstr ""
-#: elf32-arm.h:2527
+#: elf32-arm.c:7309
+#, c-format
msgid " [has entry point]"
msgstr ""
-#: elf32-arm.h:2532
+#: elf32-arm.c:7314
+#, c-format
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"
+#: elf32-arm.c:7545 elf32-i386.c:960 elf32-s390.c:1003 elf32-xtensa.c:814
+#: elf64-s390.c:958 elf64-x86-64.c:772 elfxx-sparc.c:1113
+msgid "%B: bad symbol index: %d"
msgstr ""
-#: elf32-cris.c:931
+#: elf32-arm.c:8091 elf32-cris.c:2399 elf32-hppa.c:1905 elf32-i370.c:506
+#: elf32-i386.c:1517 elf32-m32r.c:1930 elf32-m68k.c:1330 elf32-ppc.c:4309
+#: elf32-s390.c:1679 elf32-sh.c:2583 elf32-vax.c:1049 elf64-ppc.c:5897
+#: elf64-s390.c:1654 elf64-sh64.c:3437 elf64-x86-64.c:1381 elf-m10300.c:4206
+#: elfxx-sparc.c:1795
#, c-format
-msgid "%s: unresolvable relocation %s against symbol `%s' from %s section"
+msgid "dynamic variable `%s' is zero size"
msgstr ""
-#: elf32-cris.c:993
+#: elf32-arm.c:8609
#, c-format
-msgid ""
-"%s: No PLT nor GOT for relocation %s against symbol `%s' from %s section"
+msgid "Errors encountered processing file %s"
msgstr ""
-#: elf32-cris.c:996 elf32-cris.c:1122
-msgid "[whose name is lost]"
+#: elf32-arm.c:9837 elf32-arm.c:9859
+msgid "%B: error: VFP11 veneer out of range"
+msgstr ""
+
+#: elf32-avr.c:1253 elf32-bfin.c:2795 elf32-cr16.c:887 elf32-cr16c.c:789
+#: elf32-cris.c:1537 elf32-crx.c:932 elf32-d10v.c:517 elf32-fr30.c:615
+#: elf32-frv.c:4128 elf32-h8300.c:515 elf32-i860.c:1217 elf32-ip2k.c:1499
+#: elf32-iq2000.c:647 elf32-m32c.c:560 elf32-m32r.c:3123 elf32-m68hc1x.c:1132
+#: elf32-mep.c:639 elf32-msp430.c:496 elf32-mt.c:401 elf32-openrisc.c:411
+#: elf32-score.c:2455 elf32-spu.c:2813 elf32-v850.c:1700 elf32-xstormy16.c:946
+#: elf64-mmix.c:1531 elf-m10200.c:455 elf-m10300.c:1522
+msgid "internal error: out of range error"
+msgstr ""
+
+#: elf32-avr.c:1257 elf32-bfin.c:2799 elf32-cr16.c:891 elf32-cr16c.c:793
+#: elf32-cris.c:1541 elf32-crx.c:936 elf32-d10v.c:521 elf32-fr30.c:619
+#: elf32-frv.c:4132 elf32-h8300.c:519 elf32-i860.c:1221 elf32-iq2000.c:651
+#: elf32-m32c.c:564 elf32-m32r.c:3127 elf32-m68hc1x.c:1136 elf32-mep.c:643
+#: elf32-msp430.c:500 elf32-openrisc.c:415 elf32-score.c:2459 elf32-spu.c:2817
+#: elf32-v850.c:1704 elf32-xstormy16.c:950 elf64-mmix.c:1535 elf-m10200.c:459
+#: elf-m10300.c:1526 elfxx-mips.c:8019
+msgid "internal error: unsupported relocation error"
+msgstr ""
+
+#: elf32-avr.c:1261 elf32-bfin.c:2803 elf32-cris.c:1545 elf32-fr30.c:623
+#: elf32-frv.c:4136 elf32-i860.c:1225 elf32-ip2k.c:1510 elf32-iq2000.c:655
+#: elf32-m32c.c:568 elf32-mep.c:647 elf32-msp430.c:504 elf32-mt.c:405
+#: elf32-openrisc.c:419 elf32-v850.c:1708 elf32-xstormy16.c:954
+#: elf64-mmix.c:1539
+msgid "internal error: dangerous relocation"
+msgstr ""
+
+#: elf32-avr.c:1265 elf32-bfin.c:2807 elf32-cr16.c:899 elf32-cr16c.c:801
+#: elf32-cris.c:1549 elf32-crx.c:944 elf32-d10v.c:529 elf32-fr30.c:627
+#: elf32-frv.c:4140 elf32-h8300.c:527 elf32-i860.c:1229 elf32-ip2k.c:1514
+#: elf32-iq2000.c:659 elf32-m32c.c:572 elf32-m32r.c:3135 elf32-m68hc1x.c:1144
+#: elf32-mep.c:651 elf32-msp430.c:508 elf32-mt.c:409 elf32-openrisc.c:423
+#: elf32-score.c:2467 elf32-spu.c:2825 elf32-v850.c:1724 elf32-xstormy16.c:958
+#: elf64-mmix.c:1543 elf-m10200.c:467 elf-m10300.c:1539
+msgid "internal error: unknown error"
msgstr ""
-#: elf32-cris.c:1111
+#: elf32-avr.c:2369 elf32-hppa.c:594 elf32-m68hc1x.c:163 elf64-ppc.c:3801
+msgid "%B: cannot create stub entry %s"
+msgstr ""
+
+#: elf32-bfin.c:2274
+msgid "%B: relocation at `%A+0x%x' references symbol `%s' with nonzero addend"
+msgstr ""
+
+#: elf32-bfin.c:2288 elf32-frv.c:2918
+msgid "relocation references symbol not defined in the module"
+msgstr ""
+
+#: elf32-bfin.c:2385
+msgid "R_BFIN_FUNCDESC references dynamic symbol with nonzero addend"
+msgstr ""
+
+#: elf32-bfin.c:2424 elf32-bfin.c:2547 elf32-frv.c:3655 elf32-frv.c:3776
+msgid "cannot emit fixups in read-only section"
+msgstr ""
+
+#: elf32-bfin.c:2452 elf32-bfin.c:2587 elf32-frv.c:3686 elf32-frv.c:3820
+msgid "cannot emit dynamic relocations in read-only section"
+msgstr ""
+
+#: elf32-bfin.c:2505
+msgid "R_BFIN_FUNCDESC_VALUE references dynamic symbol with nonzero addend"
+msgstr ""
+
+#: elf32-bfin.c:2673
+msgid "relocations between different segments are not supported"
+msgstr ""
+
+#: elf32-bfin.c:2674
+msgid "warning: relocation references a different segment"
+msgstr ""
+
+#: elf32-bfin.c:3083
+msgid "%B(%A+0x%lx): unresolvable relocation against symbol `%s'"
+msgstr ""
+
+#: elf32-bfin.c:3116 elf32-i386.c:3346 elf32-m68k.c:2022 elf32-s390.c:3100
+#: elf64-s390.c:3061 elf64-x86-64.c:3040
+msgid "%B(%A+0x%lx): reloc against `%s': error %d"
+msgstr ""
+
+#: elf32-bfin.c:4687 elf32-frv.c:6422
+msgid "%B: unsupported relocation type %i"
+msgstr ""
+
+#: elf32-bfin.c:4868 elf32-frv.c:6830
#, c-format
-msgid ""
-"%s: relocation %s with non-zero addend %d against local symbol from %s "
-"section"
+msgid "%s: cannot link non-fdpic object file into fdpic executable"
msgstr ""
-#: elf32-cris.c:1118
+#: elf32-bfin.c:4872 elf32-frv.c:6834
#, c-format
+msgid "%s: cannot link fdpic object file into non-fdpic executable"
+msgstr ""
+
+#: elf32-cr16.c:895 elf32-cr16c.c:797 elf32-crx.c:940 elf32-d10v.c:525
+#: elf32-h8300.c:523 elf32-m32r.c:3131 elf32-m68hc1x.c:1140 elf32-score.c:2463
+#: elf32-spu.c:2821 elf-m10200.c:463
+msgid "internal error: dangerous error"
+msgstr ""
+
+#: elf32-cris.c:1059
+msgid "%B, section %A: unresolvable relocation %s against symbol `%s'"
+msgstr ""
+
+#: elf32-cris.c:1128
+msgid "%B, section %A: No PLT nor GOT for relocation %s against symbol `%s'"
+msgstr ""
+
+#: elf32-cris.c:1130
+msgid "%B, section %A: No PLT for relocation %s against symbol `%s'"
+msgstr ""
+
+#: elf32-cris.c:1136 elf32-cris.c:1268
+msgid "[whose name is lost]"
+msgstr ""
+
+#: elf32-cris.c:1254
msgid ""
-"%s: relocation %s with non-zero addend %d against symbol `%s' from %s section"
+"%B, section %A: relocation %s with non-zero addend %d against local symbol"
msgstr ""
-#: elf32-cris.c:1143
-#, c-format
+#: elf32-cris.c:1262
msgid ""
-"%s: relocation %s is not allowed for global symbol: `%s' from %s section"
+"%B, section %A: relocation %s with non-zero addend %d against symbol `%s'"
msgstr ""
-#: elf32-cris.c:1158
-#, c-format
-msgid "%s: relocation %s in section %s with no GOT created"
+#: elf32-cris.c:1288
+msgid "%B, section %A: relocation %s is not allowed for global symbol: `%s'"
msgstr ""
-#: elf32-cris.c:1277
-#, c-format
-msgid "%s: Internal inconsistency; no relocation section %s"
+#: elf32-cris.c:1304
+msgid "%B, section %A: relocation %s with no GOT created"
msgstr ""
-#: elf32-cris.c:2500
-#, c-format
+#: elf32-cris.c:1422
+msgid "%B: Internal inconsistency; no relocation section %s"
+msgstr ""
+
+#: elf32-cris.c:2510
+msgid ""
+"%B, section %A:\n"
+" v10/v32 compatible object %s must not contain a PIC relocation"
+msgstr ""
+
+#: elf32-cris.c:2697 elf32-cris.c:2765
msgid ""
-"%s, section %s:\n"
+"%B, section %A:\n"
" relocation %s should not be used in a shared object; recompile with -fPIC"
msgstr ""
-#: elf32-cris.c:2978
+#: elf32-cris.c:3182
+msgid "Unexpected machine number"
+msgstr ""
+
+#: elf32-cris.c:3236
+#, c-format
msgid " [symbols have a _ prefix]"
msgstr ""
-#: elf32-cris.c:3017
+#: elf32-cris.c:3239
#, c-format
-msgid "%s: uses _-prefixed symbols, but writing file with non-prefixed symbols"
+msgid " [v10 and v32]"
msgstr ""
-#: elf32-cris.c:3018
+#: elf32-cris.c:3242
#, c-format
-msgid "%s: uses non-prefixed symbols, but writing file with _-prefixed symbols"
+msgid " [v32]"
+msgstr ""
+
+#: elf32-cris.c:3287
+msgid "%B: uses _-prefixed symbols, but writing file with non-prefixed symbols"
+msgstr ""
+
+#: elf32-cris.c:3288
+msgid "%B: uses non-prefixed symbols, but writing file with _-prefixed symbols"
+msgstr ""
+
+#: elf32-cris.c:3307
+msgid "%B contains CRIS v32 code, incompatible with previous objects"
+msgstr ""
+
+#: elf32-cris.c:3309
+msgid "%B contains non-CRIS-v32 code, incompatible with previous objects"
+msgstr ""
+
+#: elf32-frv.c:1522 elf32-frv.c:1671
+msgid "relocation requires zero addend"
+msgstr ""
+
+#: elf32-frv.c:2905
+msgid "%B(%A+0x%x): relocation to `%s+%x' may have caused the error above"
+msgstr ""
+
+#: elf32-frv.c:2994
+msgid "R_FRV_GETTLSOFF not applied to a call instruction"
+msgstr ""
+
+#: elf32-frv.c:3036
+msgid "R_FRV_GOTTLSDESC12 not applied to an lddi instruction"
+msgstr ""
+
+#: elf32-frv.c:3107
+msgid "R_FRV_GOTTLSDESCHI not applied to a sethi instruction"
+msgstr ""
+
+#: elf32-frv.c:3144
+msgid "R_FRV_GOTTLSDESCLO not applied to a setlo or setlos instruction"
+msgstr ""
+
+#: elf32-frv.c:3192
+msgid "R_FRV_TLSDESC_RELAX not applied to an ldd instruction"
+msgstr ""
+
+#: elf32-frv.c:3276
+msgid "R_FRV_GETTLSOFF_RELAX not applied to a calll instruction"
msgstr ""
-#: elf32-frv.c:1223
+#: elf32-frv.c:3331
+msgid "R_FRV_GOTTLSOFF12 not applied to an ldi instruction"
+msgstr ""
+
+#: elf32-frv.c:3361
+msgid "R_FRV_GOTTLSOFFHI not applied to a sethi instruction"
+msgstr ""
+
+#: elf32-frv.c:3390
+msgid "R_FRV_GOTTLSOFFLO not applied to a setlo or setlos instruction"
+msgstr ""
+
+#: elf32-frv.c:3421
+msgid "R_FRV_TLSOFF_RELAX not applied to an ld instruction"
+msgstr ""
+
+#: elf32-frv.c:3466
+msgid "R_FRV_TLSMOFFHI not applied to a sethi instruction"
+msgstr ""
+
+#: elf32-frv.c:3493
+msgid "R_FRV_TLSMOFFLO not applied to a setlo or setlos instruction"
+msgstr ""
+
+#: elf32-frv.c:3614
+msgid "R_FRV_FUNCDESC references dynamic symbol with nonzero addend"
+msgstr ""
+
+#: elf32-frv.c:3734
+msgid "R_FRV_FUNCDESC_VALUE references dynamic symbol with nonzero addend"
+msgstr ""
+
+#: elf32-frv.c:3991 elf32-frv.c:4147
+msgid "%B(%A+0x%lx): reloc against `%s': %s"
+msgstr ""
+
+#: elf32-frv.c:3993 elf32-frv.c:3997
+msgid "relocation references a different segment"
+msgstr ""
+
+#: elf32-frv.c:6744
#, 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
+#: elf32-frv.c:6797 elf32-iq2000.c:808 elf32-m32c.c:819
#, c-format
msgid "%s: compiled with %s and linked with modules compiled with %s"
msgstr ""
-#: elf32-frv.c:1285
+#: elf32-frv.c:6809
#, 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
+#: elf32-frv.c:6859 elf32-iq2000.c:845 elf32-m32c.c:855 elf32-mt.c:586
#, 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"
+#: elf32-gen.c:68 elf64-gen.c:68
+msgid "%B: Relocations in generic ELF (EM: %d)"
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"
+#: elf32-hppa.c:843 elf32-hppa.c:3576
+msgid "%B(%A+0x%lx): cannot reach %s, recompile with -ffunction-sections"
msgstr ""
-#: elf32-hppa.c:1360
-#, c-format
+#: elf32-hppa.c:1252
msgid ""
-"%s: relocation %s should not be used when making a shared object; recompile "
+"%B: relocation %s can not be used when making a shared object; recompile "
"with -fPIC"
msgstr ""
-#: elf32-hppa.c:1553
+#: elf32-hppa.c:1505
#, c-format
msgid "Could not find relocation section for %s"
msgstr ""
-#: elf32-hppa.c:2828
-#, c-format
-msgid "%s: duplicate export stub %s"
+#: elf32-hppa.c:2794
+msgid "%B: duplicate export stub %s"
msgstr ""
-#: elf32-hppa.c:3416
-#, c-format
-msgid "%s(%s+0x%lx): fixing %s"
+#: elf32-hppa.c:3412
+msgid ""
+"%B(%A+0x%lx): %s fixup for insn 0x%x is not supported in a non-shared link"
msgstr ""
-#: elf32-hppa.c:4039
-#, c-format
-msgid "%s(%s+0x%lx): cannot handle %s for %s"
+#: elf32-hppa.c:4266
+msgid "%B(%A+0x%lx): cannot handle %s for %s"
msgstr ""
-#: elf32-hppa.c:4357
+#: elf32-hppa.c:4573
msgid ".got section not immediately after .plt section"
msgstr ""
-#: elf32-i386.c:326
-#, c-format
-msgid "%s: invalid relocation type %d"
+#: elf32-i386.c:363 elf32-ppc.c:1615 elf32-s390.c:379 elf64-ppc.c:2147
+#: elf64-s390.c:403 elf64-x86-64.c:220
+msgid "%B: 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"
+#: elf32-i386.c:1084 elf32-s390.c:1185 elf32-sh.c:5062 elf64-s390.c:1149
+#: elfxx-sparc.c:1241
+msgid "%B: `%s' accessed both as normal and thread local symbol"
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'"
+#: elf32-i386.c:1199 elf32-s390.c:1294 elf64-ppc.c:4863 elf64-s390.c:1261
+#: elf64-x86-64.c:1050
+msgid "%B: 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'"
+#: elf32-i386.c:2252
+msgid "%B: unrecognized relocation (0x%x) in section `%A'"
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"
+#: elf32-i386.c:2474
+msgid ""
+"%B: relocation R_386_GOTOFF against protected function `%s' can not be used "
+"when making a shared object"
msgstr ""
-#: elf32-ip2k.c:565 elf32-ip2k.c:571 elf32-ip2k.c:734 elf32-ip2k.c:740
+#: elf32-ip2k.c:868 elf32-ip2k.c:874 elf32-ip2k.c:941 elf32-ip2k.c:947
msgid ""
"ip2k relaxer: switch table without complete matching relocation information."
msgstr ""
-#: elf32-ip2k.c:588 elf32-ip2k.c:767
+#: elf32-ip2k.c:891 elf32-ip2k.c:974
msgid "ip2k relaxer: switch table header corrupt."
msgstr ""
-#: elf32-ip2k.c:1395
+#: elf32-ip2k.c:1316
#, c-format
msgid "ip2k linker: missing page instruction at 0x%08lx (dest = 0x%08lx)."
msgstr ""
-#: elf32-ip2k.c:1409
+#: elf32-ip2k.c:1332
#, 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
+#: elf32-ip2k.c:1506
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
+#: elf32-iq2000.c:821 elf32-m32c.c:831
#, c-format
msgid "%s: uses different e_flags (0x%lx) fields than previous modules (0x%lx)"
msgstr ""
-#: elf32-m32r.c:930
+#: elf32-m32r.c:1452
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)"
+#: elf32-m32r.c:3060
+msgid "%B: The target (%s) of an %s relocation is in the wrong section (%A)"
msgstr ""
-#: elf32-m32r.c:1952
-#, c-format
-msgid "%s: Instruction set mismatch with previous modules"
+#: elf32-m32r.c:3588
+msgid "%B: Instruction set mismatch with previous modules"
msgstr ""
-#: elf32-m32r.c:1975
+#: elf32-m32r.c:3609
#, c-format
msgid "private flags = %lx"
msgstr ""
-#: elf32-m32r.c:1980
+#: elf32-m32r.c:3614
+#, c-format
msgid ": m32r instructions"
msgstr ""
-#: elf32-m32r.c:1981
+#: elf32-m32r.c:3615
+#, c-format
msgid ": m32rx instructions"
msgstr ""
-#: elf32-m68hc1x.c:1217
+#: elf32-m32r.c:3616
+#, c-format
+msgid ": m32r2 instructions"
+msgstr ""
+
+#: elf32-m68hc1x.c:1044
#, c-format
msgid ""
"Reference to the far symbol `%s' using a wrong relocation may result in "
"incorrect execution"
msgstr ""
-#: elf32-m68hc1x.c:1240
+#: elf32-m68hc1x.c:1067
#, 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
+#: elf32-m68hc1x.c:1086
#, c-format
msgid ""
"reference to a banked address [%lx:%04lx] in the normal address space at %"
"04lx"
msgstr ""
-#: elf32-m68hc1x.c:1396
-#, c-format
+#: elf32-m68hc1x.c:1219
msgid ""
-"%s: linking files compiled for 16-bit integers (-mshort) and others for 32-"
+"%B: linking files compiled for 16-bit integers (-mshort) and others for 32-"
"bit integers"
msgstr ""
-#: elf32-m68hc1x.c:1404
-#, c-format
+#: elf32-m68hc1x.c:1226
msgid ""
-"%s: linking files compiled for 32-bit double (-fshort-double) and others for "
+"%B: 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"
+#: elf32-m68hc1x.c:1235
+msgid "%B: linking files compiled for HCS12 with others compiled for HC12"
+msgstr ""
+
+#: elf32-m68hc1x.c:1251 elf32-ppc.c:3733 elf64-sparc.c:696 elfxx-mips.c:11271
+msgid "%B: uses different e_flags (0x%lx) fields than previous modules (0x%lx)"
msgstr ""
-#: elf32-m68hc1x.c:1462
+#: elf32-m68hc1x.c:1279
+#, c-format
msgid "[abi=32-bit int, "
msgstr ""
-#: elf32-m68hc1x.c:1464
+#: elf32-m68hc1x.c:1281
+#, c-format
msgid "[abi=16-bit int, "
msgstr ""
-#: elf32-m68hc1x.c:1467
+#: elf32-m68hc1x.c:1284
+#, c-format
msgid "64-bit double, "
msgstr ""
-#: elf32-m68hc1x.c:1469
+#: elf32-m68hc1x.c:1286
+#, c-format
msgid "32-bit double, "
msgstr ""
-#: elf32-m68hc1x.c:1472
+#: elf32-m68hc1x.c:1289
+#, c-format
msgid "cpu=HC11]"
msgstr ""
-#: elf32-m68hc1x.c:1474
+#: elf32-m68hc1x.c:1291
+#, c-format
msgid "cpu=HCS12]"
msgstr ""
-#: elf32-m68hc1x.c:1476
+#: elf32-m68hc1x.c:1293
+#, c-format
msgid "cpu=HC12]"
msgstr ""
-#: elf32-m68hc1x.c:1479
+#: elf32-m68hc1x.c:1296
+#, c-format
msgid " [memory=bank-model]"
msgstr ""
-#: elf32-m68hc1x.c:1481
+#: elf32-m68hc1x.c:1298
+#, c-format
msgid " [memory=flat]"
msgstr ""
-#: elf32-m68k.c:400
-msgid " [cpu32]"
+#: elf32-m68k.c:634 elf32-m68k.c:635
+msgid "unknown"
msgstr ""
-#: elf32-m68k.c:403
-msgid " [m68000]"
+#: elf32-mcore.c:98 elf32-mcore.c:441
+msgid "%B: Relocation %s (%d) is not currently supported.\n"
msgstr ""
-#: elf32-mcore.c:353 elf32-mcore.c:456
-#, c-format
-msgid "%s: Relocation %s (%d) is not currently supported.\n"
+#: elf32-mcore.c:427
+msgid "%B: Unknown relocation type %d\n"
msgstr ""
-#: elf32-mcore.c:441
-#, c-format
-msgid "%s: Unknown relocation type %d\n"
+#: elf32-mep.c:809
+msgid "%B and %B are for different cores"
msgstr ""
-#: elf32-mips.c:1170 elf64-mips.c:1717 elfn32-mips.c:1664
-msgid "32bits gp relative relocation occurs for an external symbol"
+#: elf32-mep.c:826
+msgid "%B and %B are for different configurations"
msgstr ""
-#: elf32-mips.c:1314 elf64-mips.c:1830 elfn32-mips.c:1783
+#: elf32-mep.c:864
#, c-format
-msgid "Linking mips16 objects into %s format is not supported"
+msgid "private flags = 0x%lx"
msgstr ""
-#: elf32-ppc.c:2056
+#: elf32-mips.c:987 elf64-mips.c:1961 elfn32-mips.c:1806
+msgid "literal relocation occurs for an external symbol"
+msgstr ""
+
+#: elf32-mips.c:1027 elf32-score.c:483 elf64-mips.c:2004 elfn32-mips.c:1847
+msgid "32bits gp relative relocation occurs for an external symbol"
+msgstr ""
+
+#: elf32-ppc.c:1680
#, 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"
+#: elf32-ppc.c:2162
+msgid "corrupt or empty %s section in %B"
msgstr ""
-#: elf32-ppc.c:2147
-#, c-format
-msgid ""
-"%s: compiled normally and linked with modules compiled with -mrelocatable"
+#: elf32-ppc.c:2169
+msgid "unable to read in %s section from %B"
msgstr ""
-#: elf32-ppc.c:3413
-#, c-format
-msgid "%s: relocation %s cannot be used when making a shared object"
+#: elf32-ppc.c:2175
+msgid "corrupt %s section in %B"
+msgstr ""
+
+#: elf32-ppc.c:2218
+msgid "warning: unable to set size of %s section in %B"
+msgstr ""
+
+#: elf32-ppc.c:2266
+msgid "failed to allocate space for new APUinfo section."
+msgstr ""
+
+#: elf32-ppc.c:2285
+msgid "failed to compute new APUinfo section."
+msgstr ""
+
+#: elf32-ppc.c:2288
+msgid "failed to install new APUinfo section."
+msgstr ""
+
+#: elf32-ppc.c:3021
+msgid "%B: 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"
+#: elf32-ppc.c:3291
+msgid "%B(%A+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"
+#: elf32-ppc.c:3632 elf32-ppc.c:3636 elfxx-mips.c:11015 elfxx-mips.c:11034
+#: elfxx-mips.c:11049
+msgid "Warning: %B uses hard float, %B uses soft float"
msgstr ""
-#: elf32-ppc.c:5113
-#, c-format
-msgid "%s(%s+0x%lx): non-zero addend on %s reloc against `%s'"
+#: elf32-ppc.c:3639 elf32-ppc.c:3643 elfxx-mips.c:10996 elfxx-mips.c:11000
+msgid "Warning: %B uses unknown floating point ABI %d"
msgstr ""
-#: elf32-ppc.c:5399 elf32-ppc.c:5425 elf32-ppc.c:5484
-#, c-format
+#: elf32-ppc.c:3698
msgid ""
-"%s: the target (%s) of a %s relocation is in the wrong output section (%s)"
+"%B: compiled with -mrelocatable and linked with modules compiled normally"
msgstr ""
-#: elf32-ppc.c:5539
-#, c-format
-msgid "%s: relocation %s is not yet supported for symbol %s."
+#: elf32-ppc.c:3706
+msgid ""
+"%B: compiled normally and linked with modules compiled with -mrelocatable"
msgstr ""
-#: elf32-ppc.c:5594 elf64-ppc.c:8461
-#, c-format
-msgid "%s(%s+0x%lx): unresolvable %s relocation against symbol `%s'"
+#: elf32-ppc.c:3792
+msgid "Using bss-plt due to %B"
msgstr ""
-#: elf32-ppc.c:5644 elf64-ppc.c:8507
-#, c-format
-msgid "%s(%s+0x%lx): %s reloc against `%s': error %d"
+#: elf32-ppc.c:5997 elf64-ppc.c:10489
+msgid "%B: unknown relocation type %d for symbol %s"
msgstr ""
-#: elf32-ppc.c:5888
-#, c-format
-msgid "corrupt or empty %s section in %s"
+#: elf32-ppc.c:6247
+msgid "%B(%A+0x%lx): non-zero addend on %s reloc against `%s'"
msgstr ""
-#: elf32-ppc.c:5895
-#, c-format
-msgid "unable to read in %s section from %s"
+#: elf32-ppc.c:6592 elf32-ppc.c:6618 elf32-ppc.c:6677
+msgid ""
+"%B: the target (%s) of a %s relocation is in the wrong output section (%s)"
msgstr ""
-#: elf32-ppc.c:5901
-#, c-format
-msgid "corrupt %s section in %s"
+#: elf32-ppc.c:6732
+msgid "%B: relocation %s is not yet supported for symbol %s."
msgstr ""
-#: elf32-ppc.c:5944
-#, c-format
-msgid "warning: unable to set size of %s section in %s"
+#: elf32-ppc.c:6840 elf64-ppc.c:11184
+msgid "%B(%A+0x%lx): %s reloc against `%s': error %d"
msgstr ""
-#: elf32-ppc.c:5994
-msgid "failed to allocate space for new APUinfo section."
+#: elf32-s390.c:2238 elf64-s390.c:2212
+msgid "%B(%A+0x%lx): invalid instruction for TLS relocation %s"
msgstr ""
-#: elf32-ppc.c:6013
-msgid "failed to compute new APUinfo section."
+#: elf32-score.c:1417 elfxx-mips.c:2695
+msgid "not enough GOT space for local GOT entries"
msgstr ""
-#: elf32-ppc.c:6016
-msgid "failed to install new APUinfo section."
+#: elf32-score.c:2549
+#, c-format
+msgid "%s: Malformed reloc detected for section %s"
+msgstr ""
+
+#: elf32-score.c:2600
+msgid "%B: CALL15 reloc at 0x%lx not against global symbol"
+msgstr ""
+
+#: elf32-score.c:3755
+#, c-format
+msgid " [pic]"
msgstr ""
-#: elf32-s390.c:2256 elf64-s390.c:2226
+#: elf32-score.c:3759
#, c-format
-msgid "%s(%s+0x%lx): invalid instruction for TLS relocation %s"
+msgid " [fix dep]"
+msgstr ""
+
+#: elf32-score.c:3801 elfxx-mips.c:11180
+msgid "%B: warning: linking PIC files with non-PIC files"
msgstr ""
-#: elf32-sh64.c:221 elf64-sh64.c:2407
+#: elf32-sh64.c:221 elf64-sh64.c:2349
#, c-format
msgid "%s: compiled as 32-bit object and %s is 64-bit"
msgstr ""
-#: elf32-sh64.c:224 elf64-sh64.c:2410
+#: elf32-sh64.c:224 elf64-sh64.c:2352
#, c-format
msgid "%s: compiled as 64-bit object and %s is 32-bit"
msgstr ""
-#: elf32-sh64.c:226 elf64-sh64.c:2412
+#: elf32-sh64.c:226 elf64-sh64.c:2354
#, c-format
msgid "%s: object size does not match that of target %s"
msgstr ""
-#: elf32-sh64.c:461 elf64-sh64.c:2990
+#: elf32-sh64.c:449 elf64-sh64.c:2893
#, c-format
msgid "%s: encountered datalabel symbol in input"
msgstr ""
-#: elf32-sh64.c:544
+#: elf32-sh64.c:526
msgid "PTB mismatch: a SHmedia address (bit 0 == 1)"
msgstr ""
-#: elf32-sh64.c:547
+#: elf32-sh64.c:529
msgid "PTA mismatch: a SHcompact address (bit 0 == 0)"
msgstr ""
-#: elf32-sh64.c:565
+#: elf32-sh64.c:547
#, 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"
+#: elf32-sh64.c:596
+msgid "%B: error: unaligned relocation type %d at %08x reloc %p\n"
msgstr ""
-#: elf32-sh64.c:698
+#: elf32-sh64.c:672
#, c-format
msgid "%s: could not write out added .cranges entries"
msgstr ""
-#: elf32-sh64.c:760
+#: elf32-sh64.c:732
#, 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"
+#: elf32-sh.c:532
+msgid "%B: 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"
+#: elf32-sh.c:544
+msgid "%B: 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"
+#: elf32-sh.c:561
+msgid "%B: 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"
+#: elf32-sh.c:576
+msgid "%B: 0x%lx: warning: could not find expected reloc"
msgstr ""
-#: elf32-sh.c:2175
-#, c-format
-msgid "%s: 0x%lx: warning: symbol in unexpected section"
+#: elf32-sh.c:604
+msgid "%B: 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"
+#: elf32-sh.c:730
+msgid "%B: 0x%lx: warning: could not find expected COUNT reloc"
msgstr ""
-#: elf32-sh.c:2309
-#, c-format
-msgid "%s: 0x%lx: warning: bad count"
+#: elf32-sh.c:739
+msgid "%B: 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"
+#: elf32-sh.c:1143 elf32-sh.c:1513
+msgid "%B: 0x%lx: fatal: reloc overflow while relaxing"
msgstr ""
-#: elf32-sh.c:4654 elf64-sh64.c:1585
+#: elf32-sh.c:3248 elf64-sh64.c:1525
msgid "Unexpected STO_SH5_ISA32 on local symbol is not handled"
msgstr ""
-#: elf32-sh.c:4809
+#: elf32-sh.c:3485
+msgid "%B: 0x%lx: fatal: unaligned branch target for relax-support relocation"
+msgstr ""
+
+#: elf32-sh.c:3518 elf32-sh.c:3533
+msgid "%B: 0x%lx: fatal: unaligned %s relocation 0x%lx"
+msgstr ""
+
+#: elf32-sh.c:3547
+msgid "%B: 0x%lx: fatal: R_SH_PSHA relocation %d not in range -32..32"
+msgstr ""
+
+#: elf32-sh.c:3561
+msgid "%B: 0x%lx: fatal: R_SH_PSHL relocation %d not in range -32..32"
+msgstr ""
+
+#: elf32-sh.c:5274 elf64-alpha.c:4531
+msgid "%B: TLS local exec code cannot be linked into shared objects"
+msgstr ""
+
+#: elf32-sh-symbian.c:128
+msgid "%B: IMPORT AS directive for %s conceals previous IMPORT AS"
+msgstr ""
+
+#: elf32-sh-symbian.c:381
+msgid "%B: Unrecognised .directive command: %s"
+msgstr ""
+
+#: elf32-sh-symbian.c:502
+msgid "%B: Failed to add renamed symbol %s"
+msgstr ""
+
+#: elf32-sparc.c:88
+msgid "%B: compiled for a 64 bit system and target is 32 bit"
+msgstr ""
+
+#: elf32-sparc.c:101
+msgid "%B: linking little endian files with big endian files"
+msgstr ""
+
+#: elf32-spu.c:995
+msgid "warning: call to non-function symbol %s defined in %B"
+msgstr ""
+
+#: elf32-spu.c:1315
+msgid "%B is not allowed to define %s"
+msgstr ""
+
+#: elf32-spu.c:1352
#, c-format
-msgid "%s: unresolvable relocation against symbol `%s' from %s section"
+msgid "%s in overlay section"
+msgstr ""
+
+#: elf32-spu.c:1363
+msgid "overlay stub relocation overflow"
msgstr ""
-#: elf32-sh.c:4881
+#: elf32-spu.c:1820
#, c-format
-msgid "%s: 0x%lx: fatal: unaligned branch target for relax-support relocation"
+msgid "warning: %s overlaps %s\n"
msgstr ""
-#: elf32-sh.c:6627 elf64-alpha.c:4848
+#: elf32-spu.c:1836
#, c-format
-msgid "%s: TLS local exec code cannot be linked into shared objects"
+msgid "warning: %s exceeds section size\n"
msgstr ""
-#: elf32-sparc.c:2521 elf64-sparc.c:2314
+#: elf32-spu.c:1867
+msgid "%A:0x%v not found in function table\n"
+msgstr ""
+
+#: elf32-spu.c:1958
+msgid ""
+"%B(%A+0x%v): call to non-code section %B(%A), stack analysis incomplete\n"
+msgstr ""
+
+#: elf32-spu.c:2079
#, c-format
-msgid "%s: probably compiled without -fPIC?"
+msgid "%A link_order not found\n"
msgstr ""
-#: elf32-sparc.c:3348
+#: elf32-spu.c:2358
#, c-format
-msgid "%s: compiled for a 64 bit system and target is 32 bit"
+msgid "Stack analysis will ignore the call from %s to %s\n"
+msgstr ""
+
+#: elf32-spu.c:2513
+msgid "%s: 0x%v 0x%v\n"
+msgstr ""
+
+#: elf32-spu.c:2517
+msgid " calls:\n"
msgstr ""
-#: elf32-sparc.c:3362
+#: elf32-spu.c:2524
#, c-format
-msgid "%s: linking little endian files with big endian files"
+msgid " %s%s %s\n"
+msgstr ""
+
+#: elf32-spu.c:2585
+msgid "Stack size for call graph root nodes.\n"
+msgstr ""
+
+#: elf32-spu.c:2586
+msgid ""
+"\n"
+"Stack size for functions. Annotations: '*' max stack, 't' tail call\n"
msgstr ""
-#: elf32-v850.c:753
+#: elf32-spu.c:2615
+msgid " %s: 0x%v\n"
+msgstr ""
+
+#: elf32-spu.c:2625
+msgid "Maximum stack required is 0x%v\n"
+msgstr ""
+
+#: elf32-spu.c:2751
+msgid "%B(%s+0x%lx): unresolvable %s relocation against symbol `%s'"
+msgstr ""
+
+#: elf32-v850.c:162
#, c-format
msgid "Variable `%s' cannot occupy in multiple small data regions"
msgstr ""
-#: elf32-v850.c:756
+#: elf32-v850.c:165
#, c-format
msgid ""
"Variable `%s' can only be in one of the small, zero, and tiny data regions"
msgstr ""
-#: elf32-v850.c:759
+#: elf32-v850.c:168
#, c-format
msgid ""
"Variable `%s' cannot be in both small and zero data regions simultaneously"
msgstr ""
-#: elf32-v850.c:762
+#: elf32-v850.c:171
#, c-format
msgid ""
"Variable `%s' cannot be in both small and tiny data regions simultaneously"
msgstr ""
-#: elf32-v850.c:765
+#: elf32-v850.c:174
#, c-format
msgid ""
"Variable `%s' cannot be in both zero and tiny data regions simultaneously"
msgstr ""
-#: elf32-v850.c:1144
+#: elf32-v850.c:477
+#, c-format
msgid "FAILED to find previous HI16 reloc\n"
msgstr ""
-#: elf32-v850.c:1789
+#: elf32-v850.c:1712
msgid "could not locate special linker symbol __gp"
msgstr ""
-#: elf32-v850.c:1793
+#: elf32-v850.c:1716
msgid "could not locate special linker symbol __ep"
msgstr ""
-#: elf32-v850.c:1797
+#: elf32-v850.c:1720
msgid "could not locate special linker symbol __ctbp"
msgstr ""
-#: elf32-v850.c:1963
-#, c-format
-msgid "%s: Architecture mismatch with previous modules"
+#: elf32-v850.c:1870
+msgid "%B: Architecture mismatch with previous modules"
msgstr ""
-#: elf32-v850.c:1983
+#: elf32-v850.c:1889
#, c-format
msgid "private flags = %lx: "
msgstr ""
-#: elf32-v850.c:1988
+#: elf32-v850.c:1894
+#, c-format
msgid "v850 architecture"
msgstr ""
-#: elf32-v850.c:1989
+#: elf32-v850.c:1895
+#, c-format
msgid "v850e architecture"
msgstr ""
-#: elf32-vax.c:549
+#: elf32-v850.c:1896
+#, c-format
+msgid "v850e1 architecture"
+msgstr ""
+
+#: elf32-vax.c:540
+#, c-format
msgid " [nonpic]"
msgstr ""
-#: elf32-vax.c:552
+#: elf32-vax.c:543
+#, c-format
msgid " [d-float]"
msgstr ""
-#: elf32-vax.c:555
+#: elf32-vax.c:546
+#, c-format
msgid " [g-float]"
msgstr ""
-#: elf32-vax.c:663
+#: elf32-vax.c:656
#, c-format
msgid ""
"%s: warning: GOT addend of %ld to `%s' does not match previous GOT addend of "
"%ld"
msgstr ""
-#: elf32-vax.c:1667
+#: elf32-vax.c:1583
#, c-format
msgid "%s: warning: PLT addend of %d to `%s' from %s section ignored"
msgstr ""
-#: elf32-vax.c:1802
+#: elf32-vax.c:1720
#, c-format
msgid "%s: warning: %s relocation against symbol `%s' from %s section"
msgstr ""
-#: elf32-vax.c:1808
+#: elf32-vax.c:1726
#, 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
+#: elf32-xstormy16.c:451 elf32-ia64.c:2961 elf64-ia64.c:2961
msgid "non-zero addend in @fptr reloc"
msgstr ""
-#: elf64-alpha.c:1108
+#: elf32-xtensa.c:733
+msgid "%B(%A): invalid property table"
+msgstr ""
+
+#: elf32-xtensa.c:2177
+msgid "%B(%A+0x%lx): relocation offset out of range (size=0x%x)"
+msgstr ""
+
+#: elf32-xtensa.c:2234
+msgid "dynamic relocation in read-only section"
+msgstr ""
+
+#: elf32-xtensa.c:2407
+msgid "internal inconsistency in size of .got.loc section"
+msgstr ""
+
+#: elf32-xtensa.c:2714
+msgid "%B: incompatible machine type. Output is 0x%x. Input is 0x%x"
+msgstr ""
+
+#: elf32-xtensa.c:3920 elf32-xtensa.c:3928
+msgid "Attempt to convert L32R/CALLX to CALL failed"
+msgstr ""
+
+#: elf32-xtensa.c:5522 elf32-xtensa.c:5598 elf32-xtensa.c:6714
+msgid ""
+"%B(%A+0x%lx): could not decode instruction; possible configuration mismatch"
+msgstr ""
+
+#: elf32-xtensa.c:6454
+msgid ""
+"%B(%A+0x%lx): could not decode instruction for XTENSA_ASM_SIMPLIFY "
+"relocation; possible configuration mismatch"
+msgstr ""
+
+#: elf32-xtensa.c:8166
+msgid "invalid relocation address"
+msgstr ""
+
+#: elf32-xtensa.c:8215
+msgid "overflow after relaxation"
+msgstr ""
+
+#: elf32-xtensa.c:9341
+msgid "%B(%A+0x%lx): unexpected fix for %s relocation"
+msgstr ""
+
+#: elf64-alpha.c:451
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)"
+#: elf64-alpha.c:2402
+msgid "%B: .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"
+#: elf64-alpha.c:4275 elf64-alpha.c:4287
+msgid "%B: 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"
+#: elf64-alpha.c:4313 elf64-alpha.c:4448
+msgid "%B: pc-relative relocation against dynamic symbol %s"
msgstr ""
-#: elf64-alpha.c:4668
-#, c-format
-msgid "%s: change in gp: BRSGP %s"
+#: elf64-alpha.c:4341
+msgid "%B: change in gp: BRSGP %s"
msgstr ""
-#: elf64-alpha.c:4693
+#: elf64-alpha.c:4366
msgid "<unknown>"
msgstr ""
-#: elf64-alpha.c:4698
-#, c-format
-msgid "%s: !samegp reloc against symbol without .prologue: %s"
+#: elf64-alpha.c:4371
+msgid "%B: !samegp reloc against symbol without .prologue: %s"
msgstr ""
-#: elf64-alpha.c:4749
-#, c-format
-msgid "%s: unhandled dynamic relocation against %s"
+#: elf64-alpha.c:4423
+msgid "%B: unhandled dynamic relocation against %s"
msgstr ""
-#: elf64-alpha.c:4832
-#, c-format
-msgid "%s: dtp-relative relocation against dynamic symbol %s"
+#: elf64-alpha.c:4455
+msgid "%B: pc-relative relocation against undefined weak symbol %s"
msgstr ""
-#: elf64-alpha.c:4855
-#, c-format
-msgid "%s: tp-relative relocation against dynamic symbol %s"
+#: elf64-alpha.c:4515
+msgid "%B: dtp-relative relocation against dynamic symbol %s"
+msgstr ""
+
+#: elf64-alpha.c:4538
+msgid "%B: tp-relative relocation against dynamic symbol %s"
msgstr ""
-#: elf64-hppa.c:2086
+#: elf64-hppa.c:2039
#, c-format
msgid "stub entry for %s cannot load .plt, dp offset = %ld"
msgstr ""
-#: elf64-mmix.c:1032
+#: elf64-mmix.c:1175
#, c-format
msgid ""
"%s: Internal inconsistency error for value for\n"
@@ -1495,109 +2012,125 @@ msgid ""
"08lx\n"
msgstr ""
-#: elf64-mmix.c:1416
+#: elf64-mmix.c:1616
#, c-format
msgid ""
"%s: base-plus-offset relocation against register symbol: (unknown) in %s"
msgstr ""
-#: elf64-mmix.c:1421
+#: elf64-mmix.c:1621
#, c-format
msgid "%s: base-plus-offset relocation against register symbol: %s in %s"
msgstr ""
-#: elf64-mmix.c:1465
+#: elf64-mmix.c:1665
#, c-format
msgid "%s: register relocation against non-register symbol: (unknown) in %s"
msgstr ""
-#: elf64-mmix.c:1470
+#: elf64-mmix.c:1670
#, c-format
msgid "%s: register relocation against non-register symbol: %s in %s"
msgstr ""
-#: elf64-mmix.c:1507
+#: elf64-mmix.c:1707
#, c-format
msgid "%s: directive LOCAL valid only with a register or absolute value"
msgstr ""
-#: elf64-mmix.c:1535
+#: elf64-mmix.c:1735
#, c-format
msgid ""
"%s: LOCAL directive: Register $%ld is not a local register. First global "
"register is $%ld."
msgstr ""
-#: elf64-mmix.c:1994
+#: elf64-mmix.c:2200
#, 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
+#: elf64-mmix.c:2258
msgid "Register section has contents\n"
msgstr ""
-#: elf64-mmix.c:2216
+#: elf64-mmix.c:2450
#, 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"
+#: elf64-ppc.c:2568 libbfd.c:948
+msgid "%B: 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"
+#: elf64-ppc.c:2571 libbfd.c:950
+msgid "%B: compiled for a little endian system and target is big endian"
msgstr ""
-#: elf64-ppc.c:4857
+#: elf64-ppc.c:5887
#, c-format
-msgid "%s: unexpected reloc type %u in .opd section"
+msgid ""
+"copy reloc against `%s' requires lazy plt linking; avoid setting "
+"LD_BIND_NOW=1 or upgrade gcc"
msgstr ""
-#: elf64-ppc.c:4877
+#: elf64-ppc.c:6315
+msgid "dynreloc miscount for %B, section %A"
+msgstr ""
+
+#: elf64-ppc.c:6419
+msgid "%B: .opd is not a regular array of opd entries"
+msgstr ""
+
+#: elf64-ppc.c:6428
+msgid "%B: unexpected reloc type %u in .opd section"
+msgstr ""
+
+#: elf64-ppc.c:6449
+msgid "%B: undefined sym `%s' in .opd section"
+msgstr ""
+
+#: elf64-ppc.c:7156 elf64-ppc.c:7536
#, c-format
-msgid "%s: .opd is not a regular array of opd entries"
+msgid "%s defined in removed toc entry"
msgstr ""
-#: elf64-ppc.c:4897
+#: elf64-ppc.c:8271
#, c-format
-msgid "%s: undefined sym `%s' in .opd section"
+msgid "long branch stub `%s' offset overflow"
msgstr ""
-#: elf64-ppc.c:6136
+#: elf64-ppc.c:8346
#, c-format
msgid "can't find branch stub `%s'"
msgstr ""
-#: elf64-ppc.c:6175 elf64-ppc.c:6250
+#: elf64-ppc.c:8412 elf64-ppc.c:8488
#, c-format
msgid "linkage table error against `%s'"
msgstr ""
-#: elf64-ppc.c:6340
+#: elf64-ppc.c:8617
#, c-format
msgid "can't build branch stub `%s'"
msgstr ""
-#: elf64-ppc.c:7047
-msgid ".glink and .plt too far apart"
+#: elf64-ppc.c:9069
+msgid "%B section %A exceeds stub group size"
msgstr ""
-#: elf64-ppc.c:7135
+#: elf64-ppc.c:9681
msgid "stubs don't match calculated size"
msgstr ""
-#: elf64-ppc.c:7147
+#: elf64-ppc.c:9693
#, c-format
msgid ""
-"linker stubs in %u groups\n"
+"linker stubs in %u group%s\n"
" branch %lu\n"
" toc adjust %lu\n"
" long branch %lu\n"
@@ -1605,662 +2138,806 @@ msgid ""
" plt call %lu"
msgstr ""
-#: elf64-ppc.c:7723
-#, c-format
+#: elf64-ppc.c:10377
msgid ""
-"%s(%s+0x%lx): automatic multiple TOCs not supported using your crt files; "
+"%B(%A+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
+#: elf64-ppc.c:10385
msgid ""
-"%s(%s+0x%lx): sibling call optimization to `%s' does not allow automatic "
+"%B(%A+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."
+#: elf64-ppc.c:11036
+msgid "%B: 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"
+#: elf64-ppc.c:11118
+msgid "%B: 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
+#: elf64-sh64.c:1700
#, c-format
+msgid "%s: error: unaligned relocation type %d at %08x reloc %08x\n"
+msgstr ""
+
+#: elf64-sparc.c:438
+msgid "%B: Only registers %%g[2367] can be declared using STT_REGISTER"
+msgstr ""
+
+#: elf64-sparc.c:458
+msgid "Register %%g%d used incompatibly: %s in %B, previously %s in %B"
+msgstr ""
+
+#: elf64-sparc.c:481
+msgid "Symbol `%s' has differing types: REGISTER in %B, previously %s in %B"
+msgstr ""
+
+#: elf64-sparc.c:526
+msgid "Symbol `%s' has differing types: %s in %B, previously REGISTER in %B"
+msgstr ""
+
+#: elf64-sparc.c:677
+msgid "%B: linking UltraSPARC specific with HAL specific code"
+msgstr ""
+
+#: elf64-x86-64.c:798 elf64-x86-64.c:958 elf64-x86-64.c:2359
msgid ""
-"%s: warning: unresolvable relocation against symbol `%s' from %s section"
+"%B: relocation %s against `%s' can not be used when making a shared object; "
+"recompile with -fPIC"
msgstr ""
-#: elf64-sparc.c:1370
-#, c-format
-msgid "%s: check_relocs: unhandled reloc type %d"
+#: elf64-x86-64.c:889
+msgid "%B: %s' accessed both as normal and thread local symbol"
msgstr ""
-#: elf64-sparc.c:1407
-#, c-format
-msgid "%s: Only registers %%g[2367] can be declared using STT_REGISTER"
+#: elf64-x86-64.c:2271
+msgid ""
+"%B: relocation R_X86_64_GOTOFF64 against protected function `%s' can not be "
+"used when making a shared object"
msgstr ""
-#: elf64-sparc.c:1427
-#, c-format
-msgid "Register %%g%d used incompatibly: %s in %s, previously %s in %s"
+#: elf64-x86-64.c:2355
+msgid ""
+"%B: relocation R_X86_64_PC32 against protected function `%s' can not be used "
+"when making a shared object"
msgstr ""
-#: elf64-sparc.c:1450
-#, c-format
-msgid "Symbol `%s' has differing types: REGISTER in %s, previously %s in %s"
+#: elf-attrs.c:581
+msgid "ERROR: %B: Must be processed by '%s' toolchain"
msgstr ""
-#: elf64-sparc.c:1496
-#, c-format
-msgid "Symbol `%s' has differing types: %s in %s, previously REGISTER in %s"
+#: elf-attrs.c:601 elf-attrs.c:620
+msgid "ERROR: %B: Incompatible object tag '%s':%d"
msgstr ""
-#: elf64-sparc.c:3053
-#, c-format
-msgid "%s: linking UltraSPARC specific with HAL specific code"
+#: elf.c:309
+msgid "%B: invalid string offset %u >= %lu for section `%s'"
msgstr ""
-#: elf64-x86-64.c:739
-#, c-format
-msgid "%s: %s' accessed both as normal and thread local symbol"
+#: elf.c:411
+msgid "%B symbol number %lu references nonexistent SHT_SYMTAB_SHNDX section"
msgstr ""
-#: elf.c:372
-#, c-format
-msgid "%s: invalid string offset %u >= %lu for section `%s'"
+#: elf.c:564
+msgid "%B: Corrupt size field in group section header: 0x%lx"
msgstr ""
-#: elf.c:624
-#, c-format
-msgid "%s: invalid SHT_GROUP entry"
+#: elf.c:600
+msgid "%B: invalid SHT_GROUP entry"
msgstr ""
-#: elf.c:695
-#, c-format
-msgid "%s: no group info for section %s"
+#: elf.c:670
+msgid "%B: no group info for section %A"
+msgstr ""
+
+#: elf.c:700 elf.c:3251 elflink.c:9120
+msgid "%B: warning: sh_link not set for section `%A'"
+msgstr ""
+
+#: elf.c:716
+msgid "%B: sh_link [%d] in section `%A' is incorrect"
+msgstr ""
+
+#: elf.c:751
+msgid "%B: unknown [%d] section `%s' in group [%s]"
msgstr ""
-#: elf.c:1055
+#: elf.c:1160
+#, c-format
msgid ""
"\n"
"Program Header:\n"
msgstr ""
-#: elf.c:1106
+#: elf.c:1202
+#, c-format
msgid ""
"\n"
"Dynamic Section:\n"
msgstr ""
-#: elf.c:1235
+#: elf.c:1328
+#, c-format
msgid ""
"\n"
"Version definitions:\n"
msgstr ""
-#: elf.c:1258
+#: elf.c:1353
+#, c-format
msgid ""
"\n"
"Version References:\n"
msgstr ""
-#: elf.c:1263
+#: elf.c:1358
#, c-format
msgid " required from %s:\n"
msgstr ""
-#: elf.c:1944
-#, c-format
-msgid "%s: invalid link %lu for reloc section %s (index %u)"
+#: elf.c:2054
+msgid "%B: 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)"
+#: elf.c:2222
+msgid ""
+"%B: don't know how to handle allocated, application specific section `%s' [0x"
+"%8x]"
msgstr ""
-#: elf.c:3791
-#, c-format
-msgid "%s: Not enough room for program headers, try linking with -N"
+#: elf.c:2234
+msgid "%B: don't know how to handle processor specific section `%s' [0x%8x]"
msgstr ""
-#: elf.c:3922
-#, c-format
+#: elf.c:2245
+msgid "%B: don't know how to handle OS specific section `%s' [0x%8x]"
+msgstr ""
+
+#: elf.c:2255
+msgid "%B: don't know how to handle section `%s' [0x%8x]"
+msgstr ""
+
+#: elf.c:3208
+msgid "%B: sh_link of section `%A' points to discarded section `%A' of `%B'"
+msgstr ""
+
+#: elf.c:3231
+msgid "%B: sh_link of section `%A' points to removed section `%A' of `%B'"
+msgstr ""
+
+#: elf.c:4472
msgid ""
-"Error: First section in segment (%s) starts at 0x%x whereas the segment "
-"starts at 0x%x"
+"%B: The first section in the PT_DYNAMIC segment is not the .dynamic section"
msgstr ""
-#: elf.c:4242
-#, c-format
-msgid "%s: warning: allocated section `%s' not in segment"
+#: elf.c:4495
+msgid "%B: Not enough room for program headers, try linking with -N"
msgstr ""
-#: elf.c:4566
-#, c-format
-msgid "%s: symbol `%s' required but not present"
+#: elf.c:4573
+msgid "%B: section %A lma 0x%lx overlaps previous sections"
msgstr ""
-#: elf.c:4854
-#, c-format
-msgid "%s: warning: Empty loadable segment detected, is this intentional ?\n"
+#: elf.c:4671
+msgid "%B: section `%A' can't be allocated in segment %d"
+msgstr ""
+
+#: elf.c:4720
+msgid "%B: warning: allocated section `%s' not in segment"
msgstr ""
-#: elf.c:5485
+#: elf.c:5209
+msgid "%B: symbol `%s' required but not present"
+msgstr ""
+
+#: elf.c:5522
+msgid "%B: warning: Empty loadable segment detected, is this intentional ?\n"
+msgstr ""
+
+#: elf.c:6425
#, c-format
msgid ""
"Unable to find equivalent output section for symbol '%s' from section '%s'"
msgstr ""
-#: elf.c:6298
+#: elf.c:7399
+msgid "%B: unsupported relocation type %s"
+msgstr ""
+
+#: elfcode.h:810
#, c-format
-msgid "%s: unsupported relocation type %s"
+msgid "warning: %s has a corrupt string table index - ignoring"
msgstr ""
-#: elfcode.h:1113
+#: elfcode.h:1176
#, c-format
msgid "%s: version count (%ld) does not match symbol count (%ld)"
msgstr ""
-#: elfcode.h:1342
+#: elfcode.h:1409
#, 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'"
+#: elf-eh-frame.c:822
+msgid ""
+"%P: fde encoding in %B(%A) prevents .eh_frame_hdr table being created.\n"
msgstr ""
-#: elflink.c:1807
-#, c-format
-msgid "%s: undefined versioned symbol name %s"
+#: elf-eh-frame.c:973
+msgid "%P: error in %B(%A); no .eh_frame_hdr table will be created.\n"
msgstr ""
-#: elflink.c:2142
-#, c-format
-msgid "%s: relocation size mismatch in %s section %s"
+#: elf-hppa.h:2218 elf-hppa.h:2232
+msgid "%B(%A): warning: unresolvable relocation against symbol `%s'"
+msgstr ""
+
+#: elflink.c:1004
+msgid ""
+"%s: TLS definition in %B section %A mismatches non-TLS definition in %B "
+"section %A"
+msgstr ""
+
+#: elflink.c:1008
+msgid "%s: TLS reference in %B mismatches non-TLS reference in %B"
+msgstr ""
+
+#: elflink.c:1012
+msgid "%s: TLS definition in %B section %A mismatches non-TLS reference in %B"
+msgstr ""
+
+#: elflink.c:1016
+msgid "%s: TLS reference in %B mismatches non-TLS definition in %B section %A"
+msgstr ""
+
+#: elflink.c:1630
+msgid "%B: unexpected redefinition of indirect versioned symbol `%s'"
+msgstr ""
+
+#: elflink.c:1950
+msgid "%B: version node not found for symbol %s"
+msgstr ""
+
+#: elflink.c:2098
+msgid ""
+"%B: bad reloc symbol index (0x%lx >= 0x%lx) for offset 0x%lx in section `%A'"
+msgstr ""
+
+#: elflink.c:2290
+msgid "%B: relocation size mismatch in %B section %A"
msgstr ""
-#: elflink.c:2434
+#: elflink.c:2598
#, 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)"
+#: elflink.c:3893
+msgid "%B: %s: invalid version %u (max %d)"
msgstr ""
-#: elflink.h:1063
-#, c-format
-msgid "%s: %s: invalid needed version %d"
+#: elflink.c:3929
+msgid "%B: %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"
+#: elflink.c:4112
+msgid ""
+"Warning: alignment %u of common symbol `%s' in %B is greater than the "
+"alignment (%u) of its section %A"
msgstr ""
-#: elflink.h:1252
-#, c-format
-msgid "Warning: size of symbol `%s' changed from %lu in %s to %lu in %s"
+#: elflink.c:4118
+msgid "Warning: alignment %u of symbol `%s' in %B is smaller than %u in %B"
msgstr ""
-#: elflink.h:2160
+#: elflink.c:4133
+msgid "Warning: size of symbol `%s' changed from %lu in %B to %lu in %B"
+msgstr ""
+
+#: elflink.c:4309
#, c-format
-msgid "%s: undefined version: %s"
+msgid "%s: invalid DSO for symbol `%s' definition"
msgstr ""
-#: elflink.h:2226
+#: elflink.c:5535
#, c-format
-msgid "%s: .preinit_array section is not allowed in DSO"
+msgid "%s: undefined version: %s"
msgstr ""
-#: elflink.h:3078
-msgid "Not enough memory to sort relocations"
+#: elflink.c:5603
+msgid "%B: .preinit_array section is not allowed in DSO"
msgstr ""
-#: elflink.h:3958 elflink.h:4001
+#: elflink.c:6621
#, c-format
-msgid "%s: could not find output section %s"
+msgid "undefined %s reference in complex symbol: %s"
msgstr ""
-#: elflink.h:3964
+#: elflink.c:6776
#, c-format
-msgid "warning: %s section has zero size"
+msgid "unknown operator '%c' in complex symbol"
msgstr ""
-#: elflink.h:4483
-#, c-format
-msgid "%s: %s symbol `%s' in %s is referenced by DSO"
+#: elflink.c:7315 elflink.c:7332 elflink.c:7369 elflink.c:7386
+msgid "%B: Unable to sort relocs - they are in more than one size"
msgstr ""
-#: elflink.h:4564
-#, c-format
-msgid "%s: could not find output section %s for input section %s"
+#: elflink.c:7346 elflink.c:7400
+msgid "%B: Unable to sort relocs - they are of an unknown size"
msgstr ""
-#: elflink.h:4666
-#, c-format
-msgid "%s: %s symbol `%s' isn't defined"
+#: elflink.c:7449
+msgid "Not enough memory to sort relocations"
msgstr ""
-#: elflink.h:5053 elflink.h:5095
-msgid "%T: discarded in section `%s' from %s\n"
+#: elflink.c:7636
+msgid "%B: Too many sections: %d (>= %d)"
msgstr ""
-#: elfxx-mips.c:887
-msgid "static procedure (no name)"
+#: elflink.c:7870
+msgid "%B: %s symbol `%s' in %B is referenced by DSO"
msgstr ""
-#: elfxx-mips.c:1897
-msgid "not enough GOT space for local GOT entries"
+#: elflink.c:7953
+msgid "%B: could not find output section %A for input section %A"
msgstr ""
-#: elfxx-mips.c:3691
-#, c-format
-msgid "%s: %s+0x%lx: jump to stub routine which is not jal"
+#: elflink.c:8050
+msgid "%B: %s symbol `%s' isn't defined"
msgstr ""
-#: elfxx-mips.c:5192
-#, c-format
-msgid "%s: Malformed reloc detected for section %s"
+#: elflink.c:8546
+msgid ""
+"error: %B contains a reloc (0x%s) for section %A that references a non-"
+"existent global symbol"
msgstr ""
-#: elfxx-mips.c:5266
-#, c-format
-msgid "%s: CALL16 reloc at 0x%lx not against global symbol"
+#: elflink.c:8580
+msgid ""
+"%X`%s' referenced in section `%A' of %B: defined in discarded section `%A' "
+"of %B\n"
msgstr ""
-#: elfxx-mips.c:8693
-#, c-format
-msgid "%s: illegal section name `%s'"
+#: elflink.c:9198
+msgid "%A has both ordered [`%A' in %B] and unordered [`%A' in %B] sections"
msgstr ""
-#: elfxx-mips.c:9027
+#: elflink.c:9203
#, c-format
-msgid "%s: endianness incompatible with that of the selected emulation"
+msgid "%A has both ordered and unordered sections"
msgstr ""
-#: elfxx-mips.c:9039
-#, c-format
-msgid "%s: ABI is incompatible with that of the selected emulation"
+#: elflink.c:10090 elflink.c:10134
+msgid "%B: could not find output section %s"
msgstr ""
-#: elfxx-mips.c:9106
+#: elflink.c:10095
#, c-format
-msgid "%s: warning: linking PIC files with non-PIC files"
+msgid "warning: %s section has zero size"
msgstr ""
-#: elfxx-mips.c:9123
-#, c-format
-msgid "%s: linking 32-bit code with 64-bit code"
+#: elflink.c:10199
+msgid "%P: warning: creating a DT_TEXTREL in a shared object.\n"
msgstr ""
-#: elfxx-mips.c:9151
-#, c-format
-msgid "%s: linking %s module with previous %s modules"
+#: elflink.c:10567
+msgid "Removing unused section '%s' in file '%B'"
msgstr ""
-#: elfxx-mips.c:9174
-#, c-format
-msgid "%s: ABI mismatch: linking %s module with previous %s modules"
+#: elflink.c:10758
+msgid "Warning: gc-sections option ignored"
msgstr ""
-#: elfxx-mips.c:9243
-msgid " [abi=O32]"
+#: elflink.c:11249
+msgid "%P%X: can not read symbols: %E\n"
msgstr ""
-#: elfxx-mips.c:9245
-msgid " [abi=O64]"
+#: elflink.c:11391
+msgid "%B: ignoring duplicate section `%A'"
msgstr ""
-#: elfxx-mips.c:9247
-msgid " [abi=EABI32]"
+#: elflink.c:11398 elflink.c:11405
+msgid "%B: duplicate section `%A' has different size"
msgstr ""
-#: elfxx-mips.c:9249
-msgid " [abi=EABI64]"
+#: elflink.c:11413 elflink.c:11418
+msgid "%B: warning: could not read contents of section `%A'"
msgstr ""
-#: elfxx-mips.c:9251
-msgid " [abi unknown]"
+#: elflink.c:11422
+msgid "%B: warning: duplicate section `%A' has different contents"
msgstr ""
-#: elfxx-mips.c:9253
-msgid " [abi=N32]"
+#: elf-m10300.c:1531
+msgid ""
+"error: inappropriate relocation type for shared library (did you forget -"
+"fpic?)"
msgstr ""
-#: elfxx-mips.c:9255
-msgid " [abi=64]"
+#: elf-m10300.c:1534
+msgid "internal error: suspicious relocation type used in shared library"
msgstr ""
-#: elfxx-mips.c:9257
-msgid " [no abi set]"
+#: elfxx-mips.c:986
+msgid "static procedure (no name)"
msgstr ""
-#: elfxx-mips.c:9260
-msgid " [mips1]"
+#: elfxx-mips.c:4657
+msgid "%B: %A+0x%lx: jump to stub routine which is not jal"
msgstr ""
-#: elfxx-mips.c:9262
-msgid " [mips2]"
+#: elfxx-mips.c:5320 elfxx-mips.c:5540
+msgid "%B: Warning: bad `%s' option size %u smaller than its header"
msgstr ""
-#: elfxx-mips.c:9264
-msgid " [mips3]"
+#: elfxx-mips.c:6399
+msgid "%B: Malformed reloc detected for section %s"
msgstr ""
-#: elfxx-mips.c:9266
-msgid " [mips4]"
+#: elfxx-mips.c:6441
+msgid "%B: GOT reloc at 0x%lx not expected in executables"
msgstr ""
-#: elfxx-mips.c:9268
-msgid " [mips5]"
+#: elfxx-mips.c:6511
+msgid "%B: CALL16 reloc at 0x%lx not against global symbol"
msgstr ""
-#: elfxx-mips.c:9270
-msgid " [mips32]"
+#: elfxx-mips.c:7874
+msgid ""
+"%B: Can't find matching LO16 reloc against `%s' for %s at 0x%lx in section `%"
+"A'"
msgstr ""
-#: elfxx-mips.c:9272
-msgid " [mips64]"
+#: elfxx-mips.c:10640
+#, c-format
+msgid "%s: illegal section name `%s'"
msgstr ""
-#: elfxx-mips.c:9274
-msgid " [mips32r2]"
+#: elfxx-mips.c:11010 elfxx-mips.c:11029
+msgid "Warning: %B uses -msingle-float, %B uses -mdouble-float"
msgstr ""
-#: elfxx-mips.c:9276
-msgid " [unknown ISA]"
+#: elfxx-mips.c:11085
+msgid "%B: endianness incompatible with that of the selected emulation"
msgstr ""
-#: elfxx-mips.c:9279
-msgid " [mdmx]"
+#: elfxx-mips.c:11097
+msgid "%B: ABI is incompatible with that of the selected emulation"
msgstr ""
-#: elfxx-mips.c:9282
-msgid " [mips16]"
+#: elfxx-mips.c:11197
+msgid "%B: linking 32-bit code with 64-bit code"
msgstr ""
-#: elfxx-mips.c:9285
-msgid " [32bitmode]"
+#: elfxx-mips.c:11225
+msgid "%B: linking %s module with previous %s modules"
msgstr ""
-#: elfxx-mips.c:9287
-msgid " [not 32bitmode]"
+#: elfxx-mips.c:11248
+msgid "%B: ABI mismatch: linking %s module with previous %s modules"
msgstr ""
-#: i386linux.c:457 m68klinux.c:461 sparclinux.c:458
+#: elfxx-mips.c:11313
#, c-format
-msgid "Output file requires shared library `%s'\n"
+msgid " [abi=O32]"
msgstr ""
-#: i386linux.c:465 m68klinux.c:469 sparclinux.c:466
+#: elfxx-mips.c:11315
#, c-format
-msgid "Output file requires shared library `%s.so.%s'\n"
+msgid " [abi=O64]"
msgstr ""
-#: i386linux.c:654 i386linux.c:704 m68klinux.c:661 m68klinux.c:709
-#: sparclinux.c:656 sparclinux.c:706
+#: elfxx-mips.c:11317
#, c-format
-msgid "Symbol %s not defined for fixups\n"
+msgid " [abi=EABI32]"
msgstr ""
-#: i386linux.c:728 m68klinux.c:733 sparclinux.c:730
-msgid "Warning: fixup count mismatch\n"
+#: elfxx-mips.c:11319
+#, c-format
+msgid " [abi=EABI64]"
msgstr ""
-#: ieee.c:293
+#: elfxx-mips.c:11321
#, c-format
-msgid "%s: string too long (%d chars, max 65535)"
+msgid " [abi unknown]"
msgstr ""
-#: ieee.c:428
+#: elfxx-mips.c:11323
#, c-format
-msgid "%s: unrecognized symbol `%s' flags 0x%x"
+msgid " [abi=N32]"
msgstr ""
-#: ieee.c:938
+#: elfxx-mips.c:11325
#, c-format
-msgid "%s: unimplemented ATI record %u for symbol %u"
+msgid " [abi=64]"
msgstr ""
-#: ieee.c:963
+#: elfxx-mips.c:11327
#, c-format
-msgid "%s: unexpected ATN type %d in external part"
+msgid " [no abi set]"
msgstr ""
-#: ieee.c:985
+#: elfxx-mips.c:11348
#, c-format
-msgid "%s: unexpected type after ATN"
+msgid " [unknown ISA]"
msgstr ""
-#: ihex.c:264
+#: elfxx-mips.c:11359
#, c-format
-msgid "%s:%d: unexpected character `%s' in Intel Hex file\n"
+msgid " [not 32bitmode]"
msgstr ""
-#: ihex.c:372
+#: elfxx-sparc.c:428
#, c-format
-msgid "%s:%u: bad checksum in Intel Hex file (expected %u, found %u)"
+msgid "invalid relocation type %d"
msgstr ""
-#: ihex.c:426
-#, c-format
-msgid "%s:%u: bad extended address record length in Intel Hex file"
+#: elfxx-sparc.c:2899
+msgid "%B: probably compiled without -fPIC?"
msgstr ""
-#: ihex.c:443
+#: i386linux.c:454 m68klinux.c:458 sparclinux.c:453
#, c-format
-msgid "%s:%u: bad extended start address length in Intel Hex file"
+msgid "Output file requires shared library `%s'\n"
msgstr ""
-#: ihex.c:460
+#: i386linux.c:462 m68klinux.c:466 sparclinux.c:461
#, c-format
-msgid "%s:%u: bad extended linear address record length in Intel Hex file"
+msgid "Output file requires shared library `%s.so.%s'\n"
msgstr ""
-#: ihex.c:477
+#: i386linux.c:651 i386linux.c:701 m68klinux.c:658 m68klinux.c:706
+#: sparclinux.c:651 sparclinux.c:701
#, c-format
-msgid "%s:%u: bad extended linear start address length in Intel Hex file"
+msgid "Symbol %s not defined for fixups\n"
msgstr ""
-#: ihex.c:494
-#, c-format
-msgid "%s:%u: unrecognized ihex type %u in Intel Hex file\n"
+#: i386linux.c:725 m68klinux.c:730 sparclinux.c:725
+msgid "Warning: fixup count mismatch\n"
msgstr ""
-#: ihex.c:619
+#: ieee.c:157
#, c-format
-msgid "%s: internal error in ihex_read_section"
+msgid "%s: string too long (%d chars, max 65535)"
msgstr ""
-#: ihex.c:654
+#: ieee.c:284
#, c-format
-msgid "%s: bad section length in ihex_read_section"
+msgid "%s: unrecognized symbol `%s' flags 0x%x"
+msgstr ""
+
+#: ieee.c:786
+msgid "%B: unimplemented ATI record %u for symbol %u"
+msgstr ""
+
+#: ieee.c:810
+msgid "%B: unexpected ATN type %d in external part"
msgstr ""
-#: ihex.c:872
+#: ieee.c:832
+msgid "%B: unexpected type after ATN"
+msgstr ""
+
+#: ihex.c:228
+msgid "%B:%d: unexpected character `%s' in Intel Hex file"
+msgstr ""
+
+#: ihex.c:335
+msgid "%B:%u: bad checksum in Intel Hex file (expected %u, found %u)"
+msgstr ""
+
+#: ihex.c:390
+msgid "%B:%u: bad extended address record length in Intel Hex file"
+msgstr ""
+
+#: ihex.c:407
+msgid "%B:%u: bad extended start address length in Intel Hex file"
+msgstr ""
+
+#: ihex.c:424
+msgid "%B:%u: bad extended linear address record length in Intel Hex file"
+msgstr ""
+
+#: ihex.c:441
+msgid "%B:%u: bad extended linear start address length in Intel Hex file"
+msgstr ""
+
+#: ihex.c:458
+msgid "%B:%u: unrecognized ihex type %u in Intel Hex file"
+msgstr ""
+
+#: ihex.c:577
+msgid "%B: internal error in ihex_read_section"
+msgstr ""
+
+#: ihex.c:611
+msgid "%B: bad section length in ihex_read_section"
+msgstr ""
+
+#: ihex.c:823
#, c-format
msgid "%s: address 0x%s out of range for Intel Hex file"
msgstr ""
-#: libbfd.c:861
+#: libbfd.c:978
#, c-format
msgid "Deprecated %s called at %s line %d in %s\n"
msgstr ""
-#: libbfd.c:864
+#: libbfd.c:981
#, c-format
msgid "Deprecated %s called\n"
msgstr ""
-#: linker.c:1829
-#, c-format
-msgid "%s: indirect symbol `%s' to `%s' is a loop"
+#: linker.c:1877
+msgid "%B: indirect symbol `%s' to `%s' is a loop"
msgstr ""
-#: linker.c:2697
+#: linker.c:2743
#, c-format
msgid "Attempt to do relocatable link with %s input and %s output"
msgstr ""
-#: merge.c:896
+#: linker.c:3044
+msgid "%B: warning: ignoring duplicate section `%A'\n"
+msgstr ""
+
+#: linker.c:3058
+msgid "%B: warning: duplicate section `%A' has different size\n"
+msgstr ""
+
+#: merge.c:818
#, c-format
-msgid "%s: access beyond end of merged section (%ld + %ld)"
+msgid "%s: access beyond end of merged section (%ld)"
msgstr ""
-#: mmo.c:503
+#: mmo.c:454
#, c-format
msgid "%s: No core to allocate section name %s\n"
msgstr ""
-#: mmo.c:579
+#: mmo.c:529
#, c-format
msgid "%s: No core to allocate a symbol %d bytes long\n"
msgstr ""
-#: mmo.c:1287
+#: mmo.c:1185
#, c-format
msgid "%s: invalid mmo file: initialization value for $255 is not `Main'\n"
msgstr ""
-#: mmo.c:1433
+#: mmo.c:1330
#, c-format
msgid ""
"%s: unsupported wide character sequence 0x%02X 0x%02X after symbol name "
"starting with `%s'\n"
msgstr ""
-#: mmo.c:1674
+#: mmo.c:1564
#, c-format
msgid "%s: invalid mmo file: unsupported lopcode `%d'\n"
msgstr ""
-#: mmo.c:1684
+#: mmo.c:1574
#, c-format
msgid "%s: invalid mmo file: expected YZ = 1 got YZ = %d for lop_quote\n"
msgstr ""
-#: mmo.c:1720
+#: mmo.c:1610
#, c-format
msgid "%s: invalid mmo file: expected z = 1 or z = 2, got z = %d for lop_loc\n"
msgstr ""
-#: mmo.c:1766
+#: mmo.c:1656
#, c-format
msgid ""
"%s: invalid mmo file: expected z = 1 or z = 2, got z = %d for lop_fixo\n"
msgstr ""
-#: mmo.c:1805
+#: mmo.c:1695
#, c-format
msgid "%s: invalid mmo file: expected y = 0, got y = %d for lop_fixrx\n"
msgstr ""
-#: mmo.c:1814
+#: mmo.c:1704
#, c-format
msgid ""
"%s: invalid mmo file: expected z = 16 or z = 24, got z = %d for lop_fixrx\n"
msgstr ""
-#: mmo.c:1837
+#: mmo.c:1727
#, 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
+#: mmo.c:1750
#, c-format
msgid "%s: cannot allocate file name for file number %d, %d bytes\n"
msgstr ""
-#: mmo.c:1880
+#: mmo.c:1770
#, c-format
msgid ""
"%s: invalid mmo file: file number %d `%s', was already entered as `%s'\n"
msgstr ""
-#: mmo.c:1893
+#: mmo.c:1783
#, c-format
msgid ""
"%s: invalid mmo file: file name for number %d was not specified before use\n"
msgstr ""
-#: mmo.c:1999
+#: mmo.c:1890
#, 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
+#: mmo.c:1926
#, c-format
msgid "%s: invalid mmo file: lop_end not last item in file\n"
msgstr ""
-#: mmo.c:2048
+#: mmo.c:1939
#, 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
+#: mmo.c:2649
#, c-format
msgid "%s: invalid symbol table: duplicate symbol `%s'\n"
msgstr ""
-#: mmo.c:2949
+#: mmo.c:2892
#, c-format
msgid ""
"%s: Bad symbol definition: `Main' set to %s rather than the start address %"
"s\n"
msgstr ""
-#: mmo.c:3039
+#: mmo.c:2984
#, 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
+#: mmo.c:3029
#, c-format
msgid "%s: internal error, symbol table changed size from %d to %d words\n"
msgstr ""
-#: mmo.c:3139
+#: mmo.c:3081
#, c-format
msgid "%s: internal error, internal register section %s had contents\n"
msgstr ""
-#: mmo.c:3191
+#: mmo.c:3132
#, c-format
msgid "%s: no initialized registers; section length 0\n"
msgstr ""
-#: mmo.c:3197
+#: mmo.c:3138
#, c-format
msgid "%s: too many initialized registers; section length %ld\n"
msgstr ""
-#: mmo.c:3202
+#: mmo.c:3143
#, c-format
msgid ""
"%s: invalid start address for initialized registers of length %ld: 0x%lx%"
"08lx\n"
msgstr ""
-#: oasys.c:1052
+#: oasys.c:880
#, c-format
msgid "%s: can not represent section `%s' in oasys"
msgstr ""
@@ -2271,246 +2948,240 @@ 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"
+#: peicode.h:757
+msgid "%B: Unhandled import type; %x"
msgstr ""
-#: peicode.h:792
-#, c-format
-msgid "%s: Unrecognised import type; %x"
+#: peicode.h:762
+msgid "%B: Unrecognised import type; %x"
msgstr ""
-#: peicode.h:806
-#, c-format
-msgid "%s: Unrecognised import name type; %x"
+#: peicode.h:776
+msgid "%B: Unrecognised import name type; %x"
msgstr ""
-#: peicode.h:1164
-#, c-format
-msgid "%s: Unrecognised machine type (0x%x) in Import Library Format archive"
+#: peicode.h:1159
+msgid "%B: Unrecognised machine type (0x%x) in Import Library Format archive"
msgstr ""
-#: peicode.h:1176
-#, c-format
+#: peicode.h:1171
msgid ""
-"%s: Recognised but unhandled machine type (0x%x) in Import Library Format "
+"%B: 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"
+#: peicode.h:1189
+msgid "%B: 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."
+#: peicode.h:1220
+msgid "%B: 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"
+#: pe-mips.c:605
+msgid "%B: `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"
+#. val = VMA of what we need to refer to.
+#: pe-mips.c:721
+msgid "%B: unimplemented %s\n"
msgstr ""
-#: pe-mips.c:821
-#, c-format
-msgid "%s: jump too far away\n"
+#: pe-mips.c:747
+msgid "%B: jump too far away\n"
msgstr ""
-#: pe-mips.c:848
-#, c-format
-msgid "%s: bad pair/reflo after refhi\n"
+#: pe-mips.c:773
+msgid "%B: bad pair/reflo after refhi\n"
msgstr ""
-#: ppcboot.c:416
+#: ppcboot.c:412
+#, c-format
msgid ""
"\n"
"ppcboot header:\n"
msgstr ""
-#: ppcboot.c:417
+#: ppcboot.c:413
#, c-format
msgid "Entry offset = 0x%.8lx (%ld)\n"
msgstr ""
-#: ppcboot.c:418
+#: ppcboot.c:414
#, c-format
msgid "Length = 0x%.8lx (%ld)\n"
msgstr ""
-#: ppcboot.c:421
+#: ppcboot.c:417
#, c-format
msgid "Flag field = 0x%.2x\n"
msgstr ""
-#: ppcboot.c:427
+#: ppcboot.c:423
#, c-format
msgid "Partition name = \"%s\"\n"
msgstr ""
-#: ppcboot.c:446
+#: ppcboot.c:442
#, c-format
msgid ""
"\n"
"Partition[%d] start = { 0x%.2x, 0x%.2x, 0x%.2x, 0x%.2x }\n"
msgstr ""
-#: ppcboot.c:452
+#: ppcboot.c:448
#, c-format
msgid "Partition[%d] end = { 0x%.2x, 0x%.2x, 0x%.2x, 0x%.2x }\n"
msgstr ""
-#: ppcboot.c:458
+#: ppcboot.c:454
#, c-format
msgid "Partition[%d] sector = 0x%.8lx (%ld)\n"
msgstr ""
-#: ppcboot.c:459
+#: ppcboot.c:455
#, c-format
msgid "Partition[%d] length = 0x%.8lx (%ld)\n"
msgstr ""
-#: som.c:5422
+#: som.c:5088
+#, c-format
+msgid ""
+"\n"
+"Exec Auxiliary Header\n"
+msgstr ""
+
+#: som.c:5349
msgid "som_sizeof_headers unimplemented"
msgstr ""
-#: srec.c:302
-#, c-format
-msgid "%s:%d: Unexpected character `%s' in S-record file\n"
+#: srec.c:259
+msgid "%B:%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."
+#: stabs.c:277
+msgid "%B(%A+0x%lx): Stabs entry has invalid string index."
msgstr ""
-#: syms.c:1019
+#: syms.c:1056
msgid "Unsupported .stab relocation"
msgstr ""
-#: vms-gsd.c:356
+#: vms-gsd.c:337
#, c-format
msgid "bfd_make_section (%s) failed"
msgstr ""
-#: vms-gsd.c:371
+#: vms-gsd.c:352
#, c-format
msgid "bfd_set_section_flags (%s, %x) failed"
msgstr ""
-#: vms-gsd.c:407
+#: vms-gsd.c:387
#, c-format
msgid "Size mismatch section %s=%lx, %s=%lx"
msgstr ""
-#: vms-gsd.c:704
+#: vms-gsd.c:678
#, c-format
msgid "unknown gsd/egsd subtype %d"
msgstr ""
-#: vms-hdr.c:408
+#: vms-hdr.c:327
msgid "Object module NOT error-free !\n"
msgstr ""
-#: vms-misc.c:541
+#: vms-misc.c:473
#, c-format
msgid "Stack overflow (%d) in _bfd_vms_push"
msgstr ""
-#: vms-misc.c:559
+#: vms-misc.c:488
msgid "Stack underflow in _bfd_vms_pop"
msgstr ""
-#: vms-misc.c:918
+#: vms-misc.c:802
msgid "_bfd_vms_output_counted called with zero bytes"
msgstr ""
-#: vms-misc.c:923
+#: vms-misc.c:807
msgid "_bfd_vms_output_counted called with too many bytes"
msgstr ""
-#: vms-misc.c:1054
+#: vms-misc.c:925
#, c-format
msgid "Symbol %s replaced by %s\n"
msgstr ""
-#: vms-misc.c:1117
+#: vms-misc.c:984
#, c-format
msgid "failed to enter %s"
msgstr ""
-#: vms-tir.c:102
+#: vms-tir.c:55
msgid "No Mem !"
msgstr ""
-#: vms-tir.c:383
+#: vms-tir.c:298
#, c-format
msgid "bad section index in %s"
msgstr ""
-#: vms-tir.c:396
+#: vms-tir.c:311
#, c-format
msgid "unsupported STA cmd %s"
msgstr ""
-#: vms-tir.c:401 vms-tir.c:1261
+#: vms-tir.c:316 vms-tir.c:1118
#, c-format
msgid "reserved STA cmd %d"
msgstr ""
-#: vms-tir.c:512 vms-tir.c:535
+#: vms-tir.c:408 vms-tir.c:430
#, c-format
msgid "%s: no symbol \"%s\""
msgstr ""
-#. unsigned shift
-#. rotate
+#. 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
+#: vms-tir.c:495 vms-tir.c:604 vms-tir.c:702 vms-tir.c:719 vms-tir.c:726
+#: vms-tir.c:734 vms-tir.c:1438
#, c-format
msgid "%s: not supported"
msgstr ""
-#: vms-tir.c:607 vms-tir.c:1439
+#: vms-tir.c:500 vms-tir.c:1295
#, c-format
msgid "%s: not implemented"
msgstr ""
-#: vms-tir.c:611 vms-tir.c:1443
+#: vms-tir.c:504 vms-tir.c:1299
#, c-format
msgid "reserved STO cmd %d"
msgstr ""
-#: vms-tir.c:729 vms-tir.c:1589
+#: vms-tir.c:619 vms-tir.c:1443
#, c-format
msgid "reserved OPR cmd %d"
msgstr ""
-#: vms-tir.c:797 vms-tir.c:1653
+#: vms-tir.c:679 vms-tir.c:1507
#, c-format
msgid "reserved CTL cmd %d"
msgstr ""
#. stack byte from image
#. arg: none.
-#: vms-tir.c:1169
+#: vms-tir.c:1026
msgid "stack-from-image not implemented"
msgstr ""
-#: vms-tir.c:1187
+#: vms-tir.c:1044
msgid "stack-entry-mask not fully implemented"
msgstr ""
@@ -2521,345 +3192,357 @@ msgstr ""
#.
#. compare argument descriptor with symbol argument (ARG$V_PASSMECH)
#. and stack TRUE (args match) or FALSE (args dont match) value.
-#: vms-tir.c:1201
+#: vms-tir.c:1058
msgid "PASSMECH not fully implemented"
msgstr ""
-#: vms-tir.c:1220
+#: vms-tir.c:1077
msgid "stack-local-symbol not fully implemented"
msgstr ""
-#: vms-tir.c:1233
+#: vms-tir.c:1090
msgid "stack-literal not fully implemented"
msgstr ""
-#: vms-tir.c:1254
+#: vms-tir.c:1111
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
+#: vms-tir.c:1385 vms-tir.c:1397 vms-tir.c:1409 vms-tir.c:1421 vms-tir.c:1486
+#: vms-tir.c:1494 vms-tir.c:1502
#, c-format
msgid "%s: not fully implemented"
msgstr ""
-#: vms-tir.c:1705
+#: vms-tir.c:1560
#, c-format
msgid "obj code %d not found"
msgstr ""
-#: vms-tir.c:2043
+#: vms-tir.c:1868
#, c-format
msgid "SEC_RELOC with no relocs in section %s"
msgstr ""
-#: vms-tir.c:2331
+#: vms-tir.c:2150
#, c-format
msgid "Unhandled relocation %s"
msgstr ""
-#: xcofflink.c:1244
+#: xcofflink.c:565
#, c-format
-msgid "%s: `%s' has line numbers but no enclosing section"
+msgid "%s: XCOFF shared object when not producing XCOFF output"
msgstr ""
-#: xcofflink.c:1297
+#: xcofflink.c:586
#, c-format
-msgid "%s: class %d symbol `%s' has no aux entries"
+msgid "%s: dynamic object with no .loader section"
msgstr ""
-#: xcofflink.c:1320
-#, c-format
-msgid "%s: symbol `%s' has unrecognized csect type %d"
+#: xcofflink.c:1149
+msgid "%B: `%s' has line numbers but no enclosing section"
msgstr ""
-#: xcofflink.c:1332
-#, c-format
-msgid "%s: bad XTY_ER symbol `%s': class %d scnum %d scnlen %d"
+#: xcofflink.c:1201
+msgid "%B: class %d symbol `%s' has no aux entries"
msgstr ""
-#: xcofflink.c:1368
-#, c-format
-msgid "%s: XMC_TC0 symbol `%s' is class %d scnlen %d"
+#: xcofflink.c:1224
+msgid "%B: symbol `%s' has unrecognized csect type %d"
msgstr ""
-#: xcofflink.c:1520
-#, c-format
-msgid "%s: csect `%s' not in enclosing section"
+#: xcofflink.c:1236
+msgid "%B: bad XTY_ER symbol `%s': class %d scnum %d scnlen %d"
msgstr ""
-#: xcofflink.c:1627
-#, c-format
-msgid "%s: misplaced XTY_LD `%s'"
+#: xcofflink.c:1272
+msgid "%B: XMC_TC0 symbol `%s' is class %d scnlen %d"
msgstr ""
-#: xcofflink.c:1958
-#, c-format
-msgid "%s: reloc %s:%d not in csect"
+#: xcofflink.c:1418
+msgid "%B: csect `%s' not in enclosing section"
msgstr ""
-#: xcofflink.c:2095
-#, c-format
-msgid "%s: XCOFF shared object when not producing XCOFF output"
+#: xcofflink.c:1525
+msgid "%B: misplaced XTY_LD `%s'"
msgstr ""
-#: xcofflink.c:2116
-#, c-format
-msgid "%s: dynamic object with no .loader section"
+#: xcofflink.c:1841
+msgid "%B: reloc %s:%d not in csect"
msgstr ""
-#: xcofflink.c:2761
+#: xcofflink.c:2639
#, c-format
msgid "%s: no such symbol"
msgstr ""
-#: xcofflink.c:2894
-msgid "error: undefined symbol __rtinit"
-msgstr ""
-
-#: xcofflink.c:3455
+#: xcofflink.c:2868
#, c-format
msgid "warning: attempt to export undefined symbol `%s'"
msgstr ""
-#: xcofflink.c:4448
+#: xcofflink.c:3035
+msgid "error: undefined symbol __rtinit"
+msgstr ""
+
+#: xcofflink.c:3655
#, 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
+#: xcofflink.c:4491
+msgid "%B: loader reloc in unrecognized section `%A'"
+msgstr ""
+
+#: xcofflink.c:4512
+msgid "%B: `%s' in loader reloc but not loader sym"
+msgstr ""
+
+#: xcofflink.c:4527
+msgid "%B: loader reloc in read-only section %A"
+msgstr ""
+
+#: xcofflink.c:4936 xcofflink.c:4998 xcofflink.c:5293
#, c-format
msgid "%s: loader reloc in unrecognized section `%s'"
msgstr ""
-#: xcofflink.c:5310 xcofflink.c:6130
+#: xcofflink.c:5304
#, 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"
+#: elf32-ia64.c:1168 elf64-ia64.c:1168
+msgid ""
+"%B: Can't relax br at 0x%lx in section `%A'. Please use brl or indirect "
+"branch."
msgstr ""
-#: elf32-ia64.c:2271 elf64-ia64.c:2271
+#: elf32-ia64.c:2909 elf64-ia64.c:2909
msgid "@pltoff reloc against local symbol"
msgstr ""
-#: elf32-ia64.c:3663 elf64-ia64.c:3663
+#: elf32-ia64.c:4522 elf64-ia64.c:4522
#, c-format
msgid "%s: short data segment overflowed (0x%lx >= 0x400000)"
msgstr ""
-#: elf32-ia64.c:3674 elf64-ia64.c:3674
+#: elf32-ia64.c:4533 elf64-ia64.c:4533
#, 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"
+#: elf32-ia64.c:4807 elf64-ia64.c:4807
+msgid "%B: non-pic code with imm relocation against dynamic symbol `%s'"
msgstr ""
-#: elf32-ia64.c:4017 elf64-ia64.c:4017
-#, c-format
-msgid "%s: @gprel relocation against dynamic symbol %s"
+#: elf32-ia64.c:4874 elf64-ia64.c:4874
+msgid "%B: @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"
+#: elf32-ia64.c:4937 elf64-ia64.c:4937
+msgid "%B: 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"
+#: elf32-ia64.c:5074 elf64-ia64.c:5074
+msgid "%B: @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"
+#: elf32-ia64.c:5076 elf64-ia64.c:5076
+msgid "%B: 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"
+#: elf32-ia64.c:5078 elf64-ia64.c:5078
+msgid "%B: @pcrel relocation against dynamic symbol %s"
msgstr ""
-#: elf32-ia64.c:4430 elf64-ia64.c:4430
+#: elf32-ia64.c:5278 elf64-ia64.c:5278
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"
+#: elf32-ia64.c:5311 elf64-ia64.c:5311
+msgid ""
+"%B: Can't relax br (%s) to `%s' at 0x%lx in section `%A' with size 0x%lx (> "
+"0x1000000)."
msgstr ""
-#: elf32-ia64.c:4718 elf64-ia64.c:4718
-#, c-format
-msgid "%s: linking big-endian files with little-endian files"
+#: elf32-ia64.c:5572 elf64-ia64.c:5572
+msgid "%B: linking trap-on-NULL-dereference with non-trapping files"
msgstr ""
-#: elf32-ia64.c:4727 elf64-ia64.c:4727
-#, c-format
-msgid "%s: linking 64-bit files with 32-bit files"
+#: elf32-ia64.c:5581 elf64-ia64.c:5581
+msgid "%B: linking big-endian files with little-endian files"
msgstr ""
-#: elf32-ia64.c:4736 elf64-ia64.c:4736
-#, c-format
-msgid "%s: linking constant-gp files with non-constant-gp files"
+#: elf32-ia64.c:5590 elf64-ia64.c:5590
+msgid "%B: linking 64-bit files with 32-bit files"
msgstr ""
-#: elf32-ia64.c:4746 elf64-ia64.c:4746
-#, c-format
-msgid "%s: linking auto-pic files with non-auto-pic files"
+#: elf32-ia64.c:5599 elf64-ia64.c:5599
+msgid "%B: linking constant-gp files with non-constant-gp files"
msgstr ""
-#: peigen.c:985 pepigen.c:985
-#, c-format
-msgid "%s: line number overflow: 0x%lx > 0xffff"
+#: elf32-ia64.c:5609 elf64-ia64.c:5609
+msgid "%B: linking auto-pic files with non-auto-pic files"
msgstr ""
-#: peigen.c:1002 pepigen.c:1002
+#: peigen.c:998 pepigen.c:998 pex64igen.c:998
#, c-format
-msgid "%s: reloc overflow 1: 0x%lx > 0xffff"
+msgid "%s: line number overflow: 0x%lx > 0xffff"
msgstr ""
-#: peigen.c:1016 pepigen.c:1016
+#: peigen.c:1025 pepigen.c:1025 pex64igen.c:1025
msgid "Export Directory [.edata (or where ever we found it)]"
msgstr ""
-#: peigen.c:1017 pepigen.c:1017
+#: peigen.c:1026 pepigen.c:1026 pex64igen.c:1026
msgid "Import Directory [parts of .idata]"
msgstr ""
-#: peigen.c:1018 pepigen.c:1018
+#: peigen.c:1027 pepigen.c:1027 pex64igen.c:1027
msgid "Resource Directory [.rsrc]"
msgstr ""
-#: peigen.c:1019 pepigen.c:1019
+#: peigen.c:1028 pepigen.c:1028 pex64igen.c:1028
msgid "Exception Directory [.pdata]"
msgstr ""
-#: peigen.c:1020 pepigen.c:1020
+#: peigen.c:1029 pepigen.c:1029 pex64igen.c:1029
msgid "Security Directory"
msgstr ""
-#: peigen.c:1021 pepigen.c:1021
+#: peigen.c:1030 pepigen.c:1030 pex64igen.c:1030
msgid "Base Relocation Directory [.reloc]"
msgstr ""
-#: peigen.c:1022 pepigen.c:1022
+#: peigen.c:1031 pepigen.c:1031 pex64igen.c:1031
msgid "Debug Directory"
msgstr ""
-#: peigen.c:1023 pepigen.c:1023
+#: peigen.c:1032 pepigen.c:1032 pex64igen.c:1032
msgid "Description Directory"
msgstr ""
-#: peigen.c:1024 pepigen.c:1024
+#: peigen.c:1033 pepigen.c:1033 pex64igen.c:1033
msgid "Special Directory"
msgstr ""
-#: peigen.c:1025 pepigen.c:1025
+#: peigen.c:1034 pepigen.c:1034 pex64igen.c:1034
msgid "Thread Storage Directory [.tls]"
msgstr ""
-#: peigen.c:1026 pepigen.c:1026
+#: peigen.c:1035 pepigen.c:1035 pex64igen.c:1035
msgid "Load Configuration Directory"
msgstr ""
-#: peigen.c:1027 pepigen.c:1027
+#: peigen.c:1036 pepigen.c:1036 pex64igen.c:1036
msgid "Bound Import Directory"
msgstr ""
-#: peigen.c:1028 pepigen.c:1028
+#: peigen.c:1037 pepigen.c:1037 pex64igen.c:1037
msgid "Import Address Table Directory"
msgstr ""
-#: peigen.c:1029 pepigen.c:1029
+#: peigen.c:1038 pepigen.c:1038 pex64igen.c:1038
msgid "Delay Import Directory"
msgstr ""
-#: peigen.c:1030 peigen.c:1031 pepigen.c:1030 pepigen.c:1031
+#: peigen.c:1039 pepigen.c:1039 pex64igen.c:1039
+msgid "CLR Runtime Header"
+msgstr ""
+
+#: peigen.c:1040 pepigen.c:1040 pex64igen.c:1040
msgid "Reserved"
msgstr ""
-#: peigen.c:1094 pepigen.c:1094
+#: peigen.c:1100 pepigen.c:1100 pex64igen.c:1100
+#, c-format
msgid ""
"\n"
"There is an import table, but the section containing it could not be found\n"
msgstr ""
-#: peigen.c:1099 pepigen.c:1099
+#: peigen.c:1105 pepigen.c:1105 pex64igen.c:1105
#, c-format
msgid ""
"\n"
"There is an import table in %s at 0x%lx\n"
msgstr ""
-#: peigen.c:1136 pepigen.c:1136
+#: peigen.c:1148 pepigen.c:1148 pex64igen.c:1148
#, c-format
msgid ""
"\n"
"Function descriptor located at the start address: %04lx\n"
msgstr ""
-#: peigen.c:1139 pepigen.c:1139
+#: peigen.c:1151 pepigen.c:1151 pex64igen.c:1151
#, c-format
msgid "\tcode-base %08lx toc (loadable/actual) %08lx/%08lx\n"
msgstr ""
-#: peigen.c:1145 pepigen.c:1145
+#: peigen.c:1159 pepigen.c:1159 pex64igen.c:1159
+#, c-format
msgid ""
"\n"
"No reldata section! Function descriptor not decoded.\n"
msgstr ""
-#: peigen.c:1150 pepigen.c:1150
+#: peigen.c:1164 pepigen.c:1164 pex64igen.c:1164
#, c-format
msgid ""
"\n"
"The Import Tables (interpreted %s section contents)\n"
msgstr ""
-#: peigen.c:1153 pepigen.c:1153
+#: peigen.c:1167 pepigen.c:1167 pex64igen.c:1167
+#, c-format
msgid ""
" vma: Hint Time Forward DLL First\n"
" Table Stamp Chain Name Thunk\n"
msgstr ""
-#: peigen.c:1204 pepigen.c:1204
+#: peigen.c:1215 pepigen.c:1215 pex64igen.c:1215
#, c-format
msgid ""
"\n"
"\tDLL Name: %s\n"
msgstr ""
-#: peigen.c:1215 pepigen.c:1215
+#: peigen.c:1226 pepigen.c:1226 pex64igen.c:1226
+#, c-format
msgid "\tvma: Hint/Ord Member-Name Bound-To\n"
msgstr ""
-#: peigen.c:1240 pepigen.c:1240
+#: peigen.c:1251 pepigen.c:1251 pex64igen.c:1251
+#, c-format
msgid ""
"\n"
"There is a first thunk, but the section containing it could not be found\n"
msgstr ""
-#: peigen.c:1380 pepigen.c:1380
+#: peigen.c:1416 pepigen.c:1416 pex64igen.c:1416
+#, c-format
msgid ""
"\n"
"There is an export table, but the section containing it could not be found\n"
msgstr ""
-#: peigen.c:1385 pepigen.c:1385
+#: peigen.c:1425 pepigen.c:1425 pex64igen.c:1425
+#, c-format
+msgid ""
+"\n"
+"There is an export table in %s, but it does not fit into that section\n"
+msgstr ""
+
+#: peigen.c:1431 pepigen.c:1431 pex64igen.c:1431
#, c-format
msgid ""
"\n"
"There is an export table in %s at 0x%lx\n"
msgstr ""
-#: peigen.c:1416 pepigen.c:1416
+#: peigen.c:1459 pepigen.c:1459 pex64igen.c:1459
#, c-format
msgid ""
"\n"
@@ -2867,129 +3550,143 @@ msgid ""
"\n"
msgstr ""
-#: peigen.c:1420 pepigen.c:1420
+#: peigen.c:1463 pepigen.c:1463 pex64igen.c:1463
#, c-format
msgid "Export Flags \t\t\t%lx\n"
msgstr ""
-#: peigen.c:1423 pepigen.c:1423
+#: peigen.c:1466 pepigen.c:1466 pex64igen.c:1466
#, c-format
msgid "Time/Date stamp \t\t%lx\n"
msgstr ""
-#: peigen.c:1426 pepigen.c:1426
+#: peigen.c:1469 pepigen.c:1469 pex64igen.c:1469
#, c-format
msgid "Major/Minor \t\t\t%d/%d\n"
msgstr ""
-#: peigen.c:1429 pepigen.c:1429
+#: peigen.c:1472 pepigen.c:1472 pex64igen.c:1472
+#, c-format
msgid "Name \t\t\t\t"
msgstr ""
-#: peigen.c:1435 pepigen.c:1435
+#: peigen.c:1478 pepigen.c:1478 pex64igen.c:1478
#, c-format
msgid "Ordinal Base \t\t\t%ld\n"
msgstr ""
-#: peigen.c:1438 pepigen.c:1438
+#: peigen.c:1481 pepigen.c:1481 pex64igen.c:1481
+#, c-format
msgid "Number in:\n"
msgstr ""
-#: peigen.c:1441 pepigen.c:1441
+#: peigen.c:1484 pepigen.c:1484 pex64igen.c:1484
#, c-format
msgid "\tExport Address Table \t\t%08lx\n"
msgstr ""
-#: peigen.c:1445 pepigen.c:1445
+#: peigen.c:1488 pepigen.c:1488 pex64igen.c:1488
#, c-format
msgid "\t[Name Pointer/Ordinal] Table\t%08lx\n"
msgstr ""
-#: peigen.c:1448 pepigen.c:1448
+#: peigen.c:1491 pepigen.c:1491 pex64igen.c:1491
+#, c-format
msgid "Table Addresses\n"
msgstr ""
-#: peigen.c:1451 pepigen.c:1451
+#: peigen.c:1494 pepigen.c:1494 pex64igen.c:1494
+#, c-format
msgid "\tExport Address Table \t\t"
msgstr ""
-#: peigen.c:1456 pepigen.c:1456
+#: peigen.c:1499 pepigen.c:1499 pex64igen.c:1499
+#, c-format
msgid "\tName Pointer Table \t\t"
msgstr ""
-#: peigen.c:1461 pepigen.c:1461
+#: peigen.c:1504 pepigen.c:1504 pex64igen.c:1504
+#, c-format
msgid "\tOrdinal Table \t\t\t"
msgstr ""
-#: peigen.c:1476 pepigen.c:1476
+#: peigen.c:1518 pepigen.c:1518 pex64igen.c:1518
#, c-format
msgid ""
"\n"
"Export Address Table -- Ordinal Base %ld\n"
msgstr ""
-#: peigen.c:1495 pepigen.c:1495
+#: peigen.c:1537 pepigen.c:1537 pex64igen.c:1537
msgid "Forwarder RVA"
msgstr ""
-#: peigen.c:1506 pepigen.c:1506
+#: peigen.c:1548 pepigen.c:1548 pex64igen.c:1548
msgid "Export RVA"
msgstr ""
-#: peigen.c:1513 pepigen.c:1513
+#: peigen.c:1555 pepigen.c:1555 pex64igen.c:1555
+#, c-format
msgid ""
"\n"
"[Ordinal/Name Pointer] Table\n"
msgstr ""
-#: peigen.c:1568 pepigen.c:1568
+#: peigen.c:1608 pepigen.c:1608 pex64igen.c:1608
#, c-format
msgid "Warning, .pdata section size (%ld) is not a multiple of %d\n"
msgstr ""
-#: peigen.c:1572 pepigen.c:1572
+#: peigen.c:1612 pepigen.c:1612 pex64igen.c:1612
+#, c-format
msgid ""
"\n"
"The Function Table (interpreted .pdata section contents)\n"
msgstr ""
-#: peigen.c:1575 pepigen.c:1575
+#: peigen.c:1615 pepigen.c:1615 pex64igen.c:1615
+#, c-format
msgid " vma:\t\t\tBegin Address End Address Unwind Info\n"
msgstr ""
-#: peigen.c:1577 pepigen.c:1577
+#: peigen.c:1617 pepigen.c:1617 pex64igen.c:1617
+#, c-format
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
+#: peigen.c:1687 pepigen.c:1687 pex64igen.c:1687
+#, c-format
msgid " Register save millicode"
msgstr ""
-#: peigen.c:1650 pepigen.c:1650
+#: peigen.c:1690 pepigen.c:1690 pex64igen.c:1690
+#, c-format
msgid " Register restore millicode"
msgstr ""
-#: peigen.c:1653 pepigen.c:1653
+#: peigen.c:1693 pepigen.c:1693 pex64igen.c:1693
+#, c-format
msgid " Glue code sequence"
msgstr ""
-#: peigen.c:1705 pepigen.c:1705
+#: peigen.c:1743 pepigen.c:1743 pex64igen.c:1743
+#, c-format
msgid ""
"\n"
"\n"
"PE File Base Relocations (interpreted .reloc section contents)\n"
msgstr ""
-#: peigen.c:1735 pepigen.c:1735
+#: peigen.c:1773 pepigen.c:1773 pex64igen.c:1773
#, c-format
msgid ""
"\n"
"Virtual Address: %08lx Chunk size %ld (0x%lx) Number of fixups %ld\n"
msgstr ""
-#: peigen.c:1748 pepigen.c:1748
+#: peigen.c:1786 pepigen.c:1786 pex64igen.c:1786
#, c-format
msgid "\treloc %4d offset %4x [%4lx] %s"
msgstr ""
@@ -2997,9 +3694,31 @@ 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
+#: peigen.c:1825 pepigen.c:1825 pex64igen.c:1825
#, c-format
msgid ""
"\n"
"Characteristics 0x%x\n"
msgstr ""
+
+#: peigen.c:2086 pepigen.c:2086 pex64igen.c:2086
+msgid "%B: unable to fill in DataDictionary[1] because .idata$2 is missing"
+msgstr ""
+
+#: peigen.c:2104 pepigen.c:2104 pex64igen.c:2104
+msgid "%B: unable to fill in DataDictionary[1] because .idata$4 is missing"
+msgstr ""
+
+#: peigen.c:2123 pepigen.c:2123 pex64igen.c:2123
+msgid "%B: unable to fill in DataDictionary[12] because .idata$5 is missing"
+msgstr ""
+
+#: peigen.c:2141 pepigen.c:2141 pex64igen.c:2141
+msgid ""
+"%B: unable to fill in DataDictionary[PE_IMPORT_ADDRESS_TABLE (12)] because ."
+"idata$6 is missing"
+msgstr ""
+
+#: peigen.c:2161 pepigen.c:2161 pex64igen.c:2161
+msgid "%B: unable to fill in DataDictionary[9] because __tls_used is missing"
+msgstr ""
diff --git a/contrib/binutils/bfd/ppcboot.c b/contrib/binutils/bfd/ppcboot.c
index 05fb7de..da8c6b8 100644
--- a/contrib/binutils/bfd/ppcboot.c
+++ b/contrib/binutils/bfd/ppcboot.c
@@ -1,6 +1,6 @@
/* BFD back-end for PPCbug boot records.
- Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
- Free Software Foundation, Inc.
+ Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2006,
+ 2007 Free Software Foundation, Inc.
Written by Michael Meissner, Cygnus Support, <meissner@cygnus.com>
This file is part of BFD, the Binary File Descriptor library.
@@ -17,7 +17,7 @@ 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. */
+Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, 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
@@ -32,9 +32,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
the file. objcopy cooperates by specially setting the start
address to zero by default. */
+#include "sysdep.h"
#include "safe-ctype.h"
#include "bfd.h"
-#include "sysdep.h"
#include "libbfd.h"
/* PPCbug location structure */
@@ -99,7 +99,6 @@ 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))
@@ -151,6 +150,7 @@ ppcboot_object_p (abfd)
ppcboot_hdr_t hdr;
size_t i;
ppcboot_data_t *tdata;
+ flagword flags;
BFD_ASSERT (sizeof (ppcboot_hdr_t) == 1024);
@@ -205,12 +205,12 @@ ppcboot_object_p (abfd)
abfd->symcount = PPCBOOT_SYMS;
/* One data section. */
- sec = bfd_make_section (abfd, ".data");
+ flags = SEC_ALLOC | SEC_LOAD | SEC_DATA | SEC_CODE | SEC_HAS_CONTENTS;
+ sec = bfd_make_section_with_flags (abfd, ".data", flags);
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->size = statbuf.st_size - sizeof (ppcboot_hdr_t);
sec->filepos = sizeof (ppcboot_hdr_t);
ppcboot_mkobject (abfd);
@@ -311,7 +311,7 @@ ppcboot_canonicalize_symtab (abfd, alocation)
/* End symbol. */
syms[1].the_bfd = abfd;
syms[1].name = mangle_name (abfd, "end");
- syms[1].value = sec->_raw_size;
+ syms[1].value = sec->size;
syms[1].flags = BSF_GLOBAL;
syms[1].section = sec;
syms[1].udata.p = NULL;
@@ -319,7 +319,7 @@ ppcboot_canonicalize_symtab (abfd, alocation)
/* Size symbol. */
syms[2].the_bfd = abfd;
syms[2].name = mangle_name (abfd, "size");
- syms[2].value = sec->_raw_size;
+ syms[2].value = sec->size;
syms[2].flags = BSF_GLOBAL;
syms[2].section = bfd_abs_section_ptr;
syms[2].udata.p = NULL;
@@ -345,18 +345,15 @@ ppcboot_get_symbol_info (ignore_abfd, symbol, ret)
bfd_symbol_info (symbol, ret);
}
+#define ppcboot_bfd_is_target_special_symbol \
+ ((bfd_boolean (*) (bfd *, asymbol *)) bfd_false)
#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_find_inliner_info _bfd_nosymbols_find_inliner_info
#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. */
@@ -392,9 +389,8 @@ ppcboot_set_section_contents (abfd, sec, data, offset, size)
static int
-ppcboot_sizeof_headers (abfd, exec)
- bfd *abfd ATTRIBUTE_UNUSED;
- bfd_boolean exec ATTRIBUTE_UNUSED;
+ppcboot_sizeof_headers (bfd *abfd ATTRIBUTE_UNUSED,
+ struct bfd_link_info *info ATTRIBUTE_UNUSED)
{
return sizeof (ppcboot_hdr_t);
}
@@ -469,7 +465,10 @@ ppcboot_bfd_print_private_bfd_data (abfd, farg)
#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_is_group_section bfd_generic_is_group_section
#define ppcboot_bfd_discard_group bfd_generic_discard_group
+#define ppcboot_section_already_linked \
+ _bfd_generic_section_already_linked
#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
@@ -483,6 +482,7 @@ ppcboot_bfd_print_private_bfd_data (abfd, farg)
#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_copy_private_header_data _bfd_generic_bfd_copy_private_header_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
@@ -528,7 +528,7 @@ const bfd_target ppcboot_vec =
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_RELOCS (_bfd_norelocs),
BFD_JUMP_TABLE_WRITE (ppcboot),
BFD_JUMP_TABLE_LINK (ppcboot),
BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
diff --git a/contrib/binutils/bfd/ptrace-core.c b/contrib/binutils/bfd/ptrace-core.c
index 15b6777..8607225 100644
--- a/contrib/binutils/bfd/ptrace-core.c
+++ b/contrib/binutils/bfd/ptrace-core.c
@@ -1,6 +1,6 @@
/* 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.
+ Copyright 1993, 1994, 1995, 1996, 1998, 1999, 2001, 2002, 2003, 2004,
+ 2006, 2007 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.
@@ -20,12 +20,12 @@ 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. */
+Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
#ifdef PTRACE_CORE
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
#include <sys/param.h>
@@ -51,8 +51,7 @@ struct trad_core_struct
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));
+#define ptrace_unix_core_file_matches_executable_p generic_core_file_matches_executable_p
static void swap_abort PARAMS ((void));
const bfd_target *
@@ -64,6 +63,7 @@ ptrace_unix_core_file_p (abfd)
struct ptrace_user u;
struct trad_core_struct *rawptr;
bfd_size_type amt;
+ flagword flags;
val = bfd_bread ((void *)&u, (bfd_size_type) sizeof u, abfd);
if (val != sizeof u || u.pt_magic != _BCS_PTRACE_MAGIC
@@ -90,13 +90,17 @@ ptrace_unix_core_file_p (abfd)
/* Create the sections. */
- core_stacksec (abfd) = bfd_make_section_anyway (abfd, ".stack");
+ flags = SEC_ALLOC + SEC_LOAD + SEC_HAS_CONTENTS;
+ core_stacksec (abfd) = bfd_make_section_anyway_with_flags (abfd, ".stack",
+ flags);
if (core_stacksec (abfd) == NULL)
goto fail;
- core_datasec (abfd) = bfd_make_section_anyway (abfd, ".data");
+ core_datasec (abfd) = bfd_make_section_anyway_with_flags (abfd, ".data",
+ flags);
if (core_datasec (abfd) == NULL)
goto fail;
- core_regsec (abfd) = bfd_make_section_anyway (abfd, ".reg");
+ core_regsec (abfd) = bfd_make_section_anyway_with_flags (abfd, ".reg",
+ SEC_HAS_CONTENTS);
if (core_regsec (abfd) == NULL)
goto fail;
@@ -104,13 +108,9 @@ ptrace_unix_core_file_p (abfd)
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)->size = u.pt_dsize;
+ core_stacksec (abfd)->size = u.pt_ssize;
+ core_regsec (abfd)->size = sizeof (u);
core_datasec (abfd)->vma = u.pt_o_data_start;
core_stacksec (abfd)->vma = USRSTACK - u.pt_ssize;
@@ -151,15 +151,6 @@ ptrace_unix_core_file_failing_signal (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
diff --git a/contrib/binutils/bfd/reloc.c b/contrib/binutils/bfd/reloc.c
index 9bffaa3..1e5d4bd 100644
--- a/contrib/binutils/bfd/reloc.c
+++ b/contrib/binutils/bfd/reloc.c
@@ -1,6 +1,6 @@
/* BFD support for handling relocation entries.
Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
- 2000, 2001, 2002, 2003, 2004
+ 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
Free Software Foundation, Inc.
Written by Cygnus Support.
@@ -18,7 +18,7 @@
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. */
+ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
/*
SECTION
@@ -47,8 +47,8 @@ SECTION
/* 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 "bfd.h"
#include "bfdlink.h"
#include "libbfd.h"
/*
@@ -255,11 +255,12 @@ CODE_FRAGMENT
. {* Do not complain on overflow. *}
. complain_overflow_dont,
.
-. {* Complain if the bitfield overflows, whether it is considered
-. as signed or unsigned. *}
+. {* Complain if the value overflows when considered as a signed
+. number one bit larger than the field. ie. A bitfield of N bits
+. is allowed to represent -2**n to 2**n-1. *}
. complain_overflow_bitfield,
.
-. {* Complain if the value overflows when considered as signed
+. {* Complain if the value overflows when considered as a signed
. number. *}
. complain_overflow_signed,
.
@@ -496,14 +497,14 @@ bfd_check_overflow (enum complain_overflow how,
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);
+ signmask = ~fieldmask;
addrmask = N_ONES (addrsize) | fieldmask;
+ a = (relocation & addrmask) >> rightshift;;
switch (how)
{
@@ -513,19 +514,8 @@ bfd_check_overflow (enum complain_overflow how,
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;
+ /* Fall thru */
case complain_overflow_bitfield:
/* Bitfields are sometimes signed, sometimes unsigned. We
@@ -533,9 +523,14 @@ bfd_check_overflow (enum complain_overflow how,
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))
+ 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. */
+ if ((a & signmask) != 0)
flag = bfd_reloc_overflow;
break;
@@ -623,8 +618,7 @@ bfd_perform_relocation (bfd *abfd,
}
/* Is the address of the relocation really within the section? */
- if (reloc_entry->address > (input_section->_cooked_size
- / bfd_octets_per_byte (abfd)))
+ if (reloc_entry->address > bfd_get_section_limit (abfd, input_section))
return bfd_reloc_outofrange;
/* Work out which section the relocation is targeted at and the
@@ -716,7 +710,6 @@ bfd_perform_relocation (bfd *abfd,
&& 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.
@@ -787,7 +780,6 @@ space consuming. For each target:
right
*/
relocation -= reloc_entry->addend;
-#endif
reloc_entry->addend = 0;
}
else
@@ -1013,8 +1005,7 @@ bfd_install_relocation (bfd *abfd,
}
/* Is the address of the relocation really within the section? */
- if (reloc_entry->address > (input_section->_cooked_size
- / bfd_octets_per_byte (abfd)))
+ if (reloc_entry->address > bfd_get_section_limit (abfd, input_section))
return bfd_reloc_outofrange;
/* Work out which section the relocation is targeted at and the
@@ -1102,10 +1093,10 @@ bfd_install_relocation (bfd *abfd,
&& 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.
+
+ /* 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
@@ -1172,8 +1163,9 @@ space consuming. For each target:
7) if they are different you have to figure out which version is
right. */
relocation -= reloc_entry->addend;
-#endif
- reloc_entry->addend = 0;
+ /* FIXME: There should be no target specific code here... */
+ if (strcmp (abfd->xvec->name, "coff-z8k") != 0)
+ reloc_entry->addend = 0;
}
else
{
@@ -1350,7 +1342,7 @@ _bfd_final_link_relocate (reloc_howto_type *howto,
bfd_vma relocation;
/* Sanity check the address. */
- if (address > input_section->_raw_size)
+ if (address > bfd_get_section_limit (input_bfd, input_section))
return bfd_reloc_outofrange;
/* This function assumes that we are dealing with a basic relocation
@@ -1440,19 +1432,26 @@ _bfd_relocate_contents (reloc_howto_type *howto,
the size of an address. For bitfields, all the bits matter.
See also bfd_check_overflow. */
fieldmask = N_ONES (howto->bitsize);
+ signmask = ~fieldmask;
addrmask = N_ONES (bfd_arch_bits_per_address (input_bfd)) | fieldmask;
- a = relocation;
- b = x & howto->src_mask;
+ a = (relocation & addrmask) >> rightshift;
+ b = (x & howto->src_mask & addrmask) >> bitpos;
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);
+ signmask = ~(fieldmask >> 1);
+ /* Fall thru */
+
+ case complain_overflow_bitfield:
+ /* Much like the signed check, but for a field one bit
+ wider. 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. */
ss = a & signmask;
if (ss != 0 && ss != ((addrmask >> rightshift) & signmask))
flag = bfd_reloc_overflow;
@@ -1463,12 +1462,11 @@ _bfd_relocate_contents (reloc_howto_type *howto,
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;
+ ss = ((~howto->src_mask) >> 1) & howto->src_mask;
+ ss >>= bitpos;
/* Set all the bits above the sign bit. */
- b = (b ^ signmask) - signmask;
-
- b = (b & addrmask) >> bitpos;
+ b = (b ^ ss) - ss;
/* Now we can do the addition. */
sum = a + b;
@@ -1480,11 +1478,14 @@ _bfd_relocate_contents (reloc_howto_type *howto,
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;
+ 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. */
+ if (((~(a ^ b)) & (a ^ sum)) & signmask & addrmask)
+ flag = bfd_reloc_overflow;
break;
case complain_overflow_unsigned:
@@ -1499,44 +1500,9 @@ _bfd_relocate_contents (reloc_howto_type *howto,
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)
+ if ((a | b | sum) & signmask)
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:
@@ -1556,7 +1522,6 @@ _bfd_relocate_contents (reloc_howto_type *howto,
switch (size)
{
default:
- case 0:
abort ();
case 1:
bfd_put_8 (input_bfd, x, location);
@@ -1579,12 +1544,78 @@ _bfd_relocate_contents (reloc_howto_type *howto,
return flag;
}
+/* Clear a given location using a given howto, by applying a relocation value
+ of zero and discarding any in-place addend. This is used for fixed-up
+ relocations against discarded symbols, to make ignorable debug or unwind
+ information more obvious. */
+
+void
+_bfd_clear_contents (reloc_howto_type *howto,
+ bfd *input_bfd,
+ bfd_byte *location)
+{
+ int size;
+ bfd_vma x = 0;
+
+ /* 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;
+ }
+
+ /* Zero out the unwanted bits of X. */
+ x &= ~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;
+ }
+}
+
/*
DOCDD
INODE
howto manager, , typedef arelent, Relocations
-SECTION
+SUBSECTION
The howto manager
When an application wants to create a relocation, but doesn't
@@ -1647,6 +1678,11 @@ 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_SECREL
+ENUMDOC
+ Section relative relocations. Some targets need this for DWARF2.
+
+ENUM
BFD_RELOC_32_GOT_PCREL
ENUMX
BFD_RELOC_16_GOT_PCREL
@@ -1913,6 +1949,37 @@ ENUMDOC
SPARC TLS relocations
ENUM
+ BFD_RELOC_SPU_IMM7
+ENUMX
+ BFD_RELOC_SPU_IMM8
+ENUMX
+ BFD_RELOC_SPU_IMM10
+ENUMX
+ BFD_RELOC_SPU_IMM10W
+ENUMX
+ BFD_RELOC_SPU_IMM16
+ENUMX
+ BFD_RELOC_SPU_IMM16W
+ENUMX
+ BFD_RELOC_SPU_IMM18
+ENUMX
+ BFD_RELOC_SPU_PCREL9a
+ENUMX
+ BFD_RELOC_SPU_PCREL9b
+ENUMX
+ BFD_RELOC_SPU_PCREL16
+ENUMX
+ BFD_RELOC_SPU_LO16
+ENUMX
+ BFD_RELOC_SPU_HI16
+ENUMX
+ BFD_RELOC_SPU_PPU32
+ENUMX
+ BFD_RELOC_SPU_PPU64
+ENUMDOC
+ SPU Relocations.
+
+ENUM
BFD_RELOC_ALPHA_GPDISP_HI16
ENUMDOC
Alpha ECOFF and ELF relocations. Some of these treat the symbol or
@@ -2061,14 +2128,35 @@ ENUM
BFD_RELOC_LO16
ENUMDOC
Low 16 bits.
+
ENUM
- BFD_RELOC_PCREL_HI16_S
+ BFD_RELOC_HI16_PCREL
ENUMDOC
- Like BFD_RELOC_HI16_S, but PC relative.
+ High 16 bits of 32-bit pc-relative value
ENUM
- BFD_RELOC_PCREL_LO16
+ BFD_RELOC_HI16_S_PCREL
ENUMDOC
- Like BFD_RELOC_LO16, but PC relative.
+ High 16 bits of 32-bit pc-relative value, adjusted
+ENUM
+ BFD_RELOC_LO16_PCREL
+ENUMDOC
+ Low 16 bits of pc-relative value
+
+ENUM
+ BFD_RELOC_MIPS16_HI16
+ENUMDOC
+ MIPS16 high 16 bits of 32-bit value.
+ENUM
+ BFD_RELOC_MIPS16_HI16_S
+ENUMDOC
+ MIPS16 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_MIPS16_LO16
+ENUMDOC
+ MIPS16 low 16 bits.
ENUM
BFD_RELOC_MIPS_LITERAL
@@ -2117,11 +2205,45 @@ ENUMX
BFD_RELOC_MIPS_RELGOT
ENUMX
BFD_RELOC_MIPS_JALR
+ENUMX
+ BFD_RELOC_MIPS_TLS_DTPMOD32
+ENUMX
+ BFD_RELOC_MIPS_TLS_DTPREL32
+ENUMX
+ BFD_RELOC_MIPS_TLS_DTPMOD64
+ENUMX
+ BFD_RELOC_MIPS_TLS_DTPREL64
+ENUMX
+ BFD_RELOC_MIPS_TLS_GD
+ENUMX
+ BFD_RELOC_MIPS_TLS_LDM
+ENUMX
+ BFD_RELOC_MIPS_TLS_DTPREL_HI16
+ENUMX
+ BFD_RELOC_MIPS_TLS_DTPREL_LO16
+ENUMX
+ BFD_RELOC_MIPS_TLS_GOTTPREL
+ENUMX
+ BFD_RELOC_MIPS_TLS_TPREL32
+ENUMX
+ BFD_RELOC_MIPS_TLS_TPREL64
+ENUMX
+ BFD_RELOC_MIPS_TLS_TPREL_HI16
+ENUMX
+ BFD_RELOC_MIPS_TLS_TPREL_LO16
ENUMDOC
MIPS ELF relocations.
COMMENT
ENUM
+ BFD_RELOC_MIPS_COPY
+ENUMX
+ BFD_RELOC_MIPS_JUMP_SLOT
+ENUMDOC
+ MIPS ELF relocations (VxWorks extensions).
+COMMENT
+
+ENUM
BFD_RELOC_FRV_LABEL16
ENUMX
BFD_RELOC_FRV_LABEL24
@@ -2167,6 +2289,38 @@ ENUMX
BFD_RELOC_FRV_GOTOFFHI
ENUMX
BFD_RELOC_FRV_GOTOFFLO
+ENUMX
+ BFD_RELOC_FRV_GETTLSOFF
+ENUMX
+ BFD_RELOC_FRV_TLSDESC_VALUE
+ENUMX
+ BFD_RELOC_FRV_GOTTLSDESC12
+ENUMX
+ BFD_RELOC_FRV_GOTTLSDESCHI
+ENUMX
+ BFD_RELOC_FRV_GOTTLSDESCLO
+ENUMX
+ BFD_RELOC_FRV_TLSMOFF12
+ENUMX
+ BFD_RELOC_FRV_TLSMOFFHI
+ENUMX
+ BFD_RELOC_FRV_TLSMOFFLO
+ENUMX
+ BFD_RELOC_FRV_GOTTLSOFF12
+ENUMX
+ BFD_RELOC_FRV_GOTTLSOFFHI
+ENUMX
+ BFD_RELOC_FRV_GOTTLSOFFLO
+ENUMX
+ BFD_RELOC_FRV_TLSOFF
+ENUMX
+ BFD_RELOC_FRV_TLSDESC_RELAX
+ENUMX
+ BFD_RELOC_FRV_GETTLSOFF_RELAX
+ENUMX
+ BFD_RELOC_FRV_TLSOFF_RELAX
+ENUMX
+ BFD_RELOC_FRV_TLSMOFF
ENUMDOC
Fujitsu Frv Relocations.
COMMENT
@@ -2248,6 +2402,12 @@ ENUMX
BFD_RELOC_386_TLS_DTPOFF32
ENUMX
BFD_RELOC_386_TLS_TPOFF32
+ENUMX
+ BFD_RELOC_386_TLS_GOTDESC
+ENUMX
+ BFD_RELOC_386_TLS_DESC_CALL
+ENUMX
+ BFD_RELOC_386_TLS_DESC
ENUMDOC
i386/elf relocations
@@ -2283,6 +2443,26 @@ ENUMX
BFD_RELOC_X86_64_GOTTPOFF
ENUMX
BFD_RELOC_X86_64_TPOFF32
+ENUMX
+ BFD_RELOC_X86_64_GOTOFF64
+ENUMX
+ BFD_RELOC_X86_64_GOTPC32
+ENUMX
+ BFD_RELOC_X86_64_GOT64
+ENUMX
+ BFD_RELOC_X86_64_GOTPCREL64
+ENUMX
+ BFD_RELOC_X86_64_GOTPC64
+ENUMX
+ BFD_RELOC_X86_64_GOTPLT64
+ENUMX
+ BFD_RELOC_X86_64_PLTOFF64
+ENUMX
+ BFD_RELOC_X86_64_GOTPC32_TLSDESC
+ENUMX
+ BFD_RELOC_X86_64_TLSDESC_CALL
+ENUMX
+ BFD_RELOC_X86_64_TLSDESC
ENUMDOC
x86-64/elf relocations
@@ -2557,14 +2737,197 @@ ENUMDOC
not stored in the instruction. The 2nd lowest bit comes from a 1 bit
field in the instruction.
ENUM
+ BFD_RELOC_ARM_PCREL_CALL
+ENUMDOC
+ ARM 26-bit pc-relative branch for an unconditional BL or BLX instruction.
+ENUM
+ BFD_RELOC_ARM_PCREL_JUMP
+ENUMDOC
+ ARM 26-bit pc-relative branch for B or conditional BL instruction.
+
+ENUM
+ BFD_RELOC_THUMB_PCREL_BRANCH7
+ENUMX
+ BFD_RELOC_THUMB_PCREL_BRANCH9
+ENUMX
+ BFD_RELOC_THUMB_PCREL_BRANCH12
+ENUMX
+ BFD_RELOC_THUMB_PCREL_BRANCH20
+ENUMX
+ BFD_RELOC_THUMB_PCREL_BRANCH23
+ENUMX
+ BFD_RELOC_THUMB_PCREL_BRANCH25
+ENUMDOC
+ Thumb 7-, 9-, 12-, 20-, 23-, and 25-bit pc-relative branches.
+ The lowest bit must be zero and is not stored in the instruction.
+ Note that the corresponding ELF R_ARM_THM_JUMPnn constant has an
+ "nn" one smaller in all cases. Note further that BRANCH23
+ corresponds to R_ARM_THM_CALL.
+
+ENUM
+ BFD_RELOC_ARM_OFFSET_IMM
+ENUMDOC
+ 12-bit immediate offset, used in ARM-format ldr and str instructions.
+
+ENUM
+ BFD_RELOC_ARM_THUMB_OFFSET
+ENUMDOC
+ 5-bit immediate offset, used in Thumb-format ldr and str instructions.
+
+ENUM
+ BFD_RELOC_ARM_TARGET1
+ENUMDOC
+ Pc-relative or absolute relocation depending on target. Used for
+ entries in .init_array sections.
+ENUM
+ BFD_RELOC_ARM_ROSEGREL32
+ENUMDOC
+ Read-only segment base relative address.
+ENUM
+ BFD_RELOC_ARM_SBREL32
+ENUMDOC
+ Data segment base relative address.
+ENUM
+ BFD_RELOC_ARM_TARGET2
+ENUMDOC
+ This reloc is used for references to RTTI data from exception handling
+ tables. The actual definition depends on the target. It may be a
+ pc-relative or some form of GOT-indirect relocation.
+ENUM
+ BFD_RELOC_ARM_PREL31
+ENUMDOC
+ 31-bit PC relative address.
+ENUM
+ BFD_RELOC_ARM_MOVW
+ENUMX
+ BFD_RELOC_ARM_MOVT
+ENUMX
+ BFD_RELOC_ARM_MOVW_PCREL
+ENUMX
+ BFD_RELOC_ARM_MOVT_PCREL
+ENUMX
+ BFD_RELOC_ARM_THUMB_MOVW
+ENUMX
+ BFD_RELOC_ARM_THUMB_MOVT
+ENUMX
+ BFD_RELOC_ARM_THUMB_MOVW_PCREL
+ENUMX
+ BFD_RELOC_ARM_THUMB_MOVT_PCREL
+ENUMDOC
+ Low and High halfword relocations for MOVW and MOVT instructions.
+
+ENUM
+ BFD_RELOC_ARM_JUMP_SLOT
+ENUMX
+ BFD_RELOC_ARM_GLOB_DAT
+ENUMX
+ BFD_RELOC_ARM_GOT32
+ENUMX
+ BFD_RELOC_ARM_PLT32
+ENUMX
+ BFD_RELOC_ARM_RELATIVE
+ENUMX
+ BFD_RELOC_ARM_GOTOFF
+ENUMX
+ BFD_RELOC_ARM_GOTPC
+ENUMDOC
+ Relocations for setting up GOTs and PLTs for shared libraries.
+
+ENUM
+ BFD_RELOC_ARM_TLS_GD32
+ENUMX
+ BFD_RELOC_ARM_TLS_LDO32
+ENUMX
+ BFD_RELOC_ARM_TLS_LDM32
+ENUMX
+ BFD_RELOC_ARM_TLS_DTPOFF32
+ENUMX
+ BFD_RELOC_ARM_TLS_DTPMOD32
+ENUMX
+ BFD_RELOC_ARM_TLS_TPOFF32
+ENUMX
+ BFD_RELOC_ARM_TLS_IE32
+ENUMX
+ BFD_RELOC_ARM_TLS_LE32
+ENUMDOC
+ ARM thread-local storage relocations.
+
+ENUM
+ BFD_RELOC_ARM_ALU_PC_G0_NC
+ENUMX
+ BFD_RELOC_ARM_ALU_PC_G0
+ENUMX
+ BFD_RELOC_ARM_ALU_PC_G1_NC
+ENUMX
+ BFD_RELOC_ARM_ALU_PC_G1
+ENUMX
+ BFD_RELOC_ARM_ALU_PC_G2
+ENUMX
+ BFD_RELOC_ARM_LDR_PC_G0
+ENUMX
+ BFD_RELOC_ARM_LDR_PC_G1
+ENUMX
+ BFD_RELOC_ARM_LDR_PC_G2
+ENUMX
+ BFD_RELOC_ARM_LDRS_PC_G0
+ENUMX
+ BFD_RELOC_ARM_LDRS_PC_G1
+ENUMX
+ BFD_RELOC_ARM_LDRS_PC_G2
+ENUMX
+ BFD_RELOC_ARM_LDC_PC_G0
+ENUMX
+ BFD_RELOC_ARM_LDC_PC_G1
+ENUMX
+ BFD_RELOC_ARM_LDC_PC_G2
+ENUMX
+ BFD_RELOC_ARM_ALU_SB_G0_NC
+ENUMX
+ BFD_RELOC_ARM_ALU_SB_G0
+ENUMX
+ BFD_RELOC_ARM_ALU_SB_G1_NC
+ENUMX
+ BFD_RELOC_ARM_ALU_SB_G1
+ENUMX
+ BFD_RELOC_ARM_ALU_SB_G2
+ENUMX
+ BFD_RELOC_ARM_LDR_SB_G0
+ENUMX
+ BFD_RELOC_ARM_LDR_SB_G1
+ENUMX
+ BFD_RELOC_ARM_LDR_SB_G2
+ENUMX
+ BFD_RELOC_ARM_LDRS_SB_G0
+ENUMX
+ BFD_RELOC_ARM_LDRS_SB_G1
+ENUMX
+ BFD_RELOC_ARM_LDRS_SB_G2
+ENUMX
+ BFD_RELOC_ARM_LDC_SB_G0
+ENUMX
+ BFD_RELOC_ARM_LDC_SB_G1
+ENUMX
+ BFD_RELOC_ARM_LDC_SB_G2
+ENUMDOC
+ ARM group relocations.
+
+ENUM
BFD_RELOC_ARM_IMMEDIATE
ENUMX
BFD_RELOC_ARM_ADRL_IMMEDIATE
ENUMX
- BFD_RELOC_ARM_OFFSET_IMM
+ BFD_RELOC_ARM_T32_IMMEDIATE
+ENUMX
+ BFD_RELOC_ARM_T32_ADD_IMM
+ENUMX
+ BFD_RELOC_ARM_T32_IMM12
+ENUMX
+ BFD_RELOC_ARM_T32_ADD_PC12
ENUMX
BFD_RELOC_ARM_SHIFT_IMM
ENUMX
+ BFD_RELOC_ARM_SMC
+ENUMX
BFD_RELOC_ARM_SWI
ENUMX
BFD_RELOC_ARM_MULTI
@@ -2573,6 +2936,10 @@ ENUMX
ENUMX
BFD_RELOC_ARM_CP_OFF_IMM_S2
ENUMX
+ BFD_RELOC_ARM_T32_CP_OFF_IMM
+ENUMX
+ BFD_RELOC_ARM_T32_CP_OFF_IMM_S2
+ENUMX
BFD_RELOC_ARM_ADR_IMM
ENUMX
BFD_RELOC_ARM_LDR_IMM
@@ -2583,6 +2950,10 @@ ENUMX
ENUMX
BFD_RELOC_ARM_OFFSET_IMM8
ENUMX
+ BFD_RELOC_ARM_T32_OFFSET_U8
+ENUMX
+ BFD_RELOC_ARM_T32_OFFSET_IMM
+ENUMX
BFD_RELOC_ARM_HWLITERAL
ENUMX
BFD_RELOC_ARM_THUMB_ADD
@@ -2590,34 +2961,30 @@ ENUMX
BFD_RELOC_ARM_THUMB_IMM
ENUMX
BFD_RELOC_ARM_THUMB_SHIFT
+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_ARM_THUMB_OFFSET
+ BFD_RELOC_SH_PCDISP12BY2
ENUMX
- BFD_RELOC_ARM_GOT12
+ BFD_RELOC_SH_IMM3
ENUMX
- BFD_RELOC_ARM_GOT32
+ BFD_RELOC_SH_IMM3U
ENUMX
- BFD_RELOC_ARM_JUMP_SLOT
+ BFD_RELOC_SH_DISP12
ENUMX
- BFD_RELOC_ARM_COPY
+ BFD_RELOC_SH_DISP12BY2
ENUMX
- BFD_RELOC_ARM_GLOB_DAT
+ BFD_RELOC_SH_DISP12BY4
ENUMX
- BFD_RELOC_ARM_PLT32
+ BFD_RELOC_SH_DISP12BY8
ENUMX
- BFD_RELOC_ARM_RELATIVE
+ BFD_RELOC_SH_DISP20
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
+ BFD_RELOC_SH_DISP20BY8
ENUMX
BFD_RELOC_SH_IMM4
ENUMX
@@ -2782,16 +3149,6 @@ 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.
@@ -2806,6 +3163,169 @@ ENUMDOC
through 0.
ENUM
+ BFD_RELOC_BFIN_16_IMM
+ENUMDOC
+ ADI Blackfin 16 bit immediate absolute reloc.
+ENUM
+ BFD_RELOC_BFIN_16_HIGH
+ENUMDOC
+ ADI Blackfin 16 bit immediate absolute reloc higher 16 bits.
+ENUM
+ BFD_RELOC_BFIN_4_PCREL
+ENUMDOC
+ ADI Blackfin 'a' part of LSETUP.
+ENUM
+ BFD_RELOC_BFIN_5_PCREL
+ENUMDOC
+ ADI Blackfin.
+ENUM
+ BFD_RELOC_BFIN_16_LOW
+ENUMDOC
+ ADI Blackfin 16 bit immediate absolute reloc lower 16 bits.
+ENUM
+ BFD_RELOC_BFIN_10_PCREL
+ENUMDOC
+ ADI Blackfin.
+ENUM
+ BFD_RELOC_BFIN_11_PCREL
+ENUMDOC
+ ADI Blackfin 'b' part of LSETUP.
+ENUM
+ BFD_RELOC_BFIN_12_PCREL_JUMP
+ENUMDOC
+ ADI Blackfin.
+ENUM
+ BFD_RELOC_BFIN_12_PCREL_JUMP_S
+ENUMDOC
+ ADI Blackfin Short jump, pcrel.
+ENUM
+ BFD_RELOC_BFIN_24_PCREL_CALL_X
+ENUMDOC
+ ADI Blackfin Call.x not implemented.
+ENUM
+ BFD_RELOC_BFIN_24_PCREL_JUMP_L
+ENUMDOC
+ ADI Blackfin Long Jump pcrel.
+ENUM
+ BFD_RELOC_BFIN_GOT17M4
+ENUMX
+ BFD_RELOC_BFIN_GOTHI
+ENUMX
+ BFD_RELOC_BFIN_GOTLO
+ENUMX
+ BFD_RELOC_BFIN_FUNCDESC
+ENUMX
+ BFD_RELOC_BFIN_FUNCDESC_GOT17M4
+ENUMX
+ BFD_RELOC_BFIN_FUNCDESC_GOTHI
+ENUMX
+ BFD_RELOC_BFIN_FUNCDESC_GOTLO
+ENUMX
+ BFD_RELOC_BFIN_FUNCDESC_VALUE
+ENUMX
+ BFD_RELOC_BFIN_FUNCDESC_GOTOFF17M4
+ENUMX
+ BFD_RELOC_BFIN_FUNCDESC_GOTOFFHI
+ENUMX
+ BFD_RELOC_BFIN_FUNCDESC_GOTOFFLO
+ENUMX
+ BFD_RELOC_BFIN_GOTOFF17M4
+ENUMX
+ BFD_RELOC_BFIN_GOTOFFHI
+ENUMX
+ BFD_RELOC_BFIN_GOTOFFLO
+ENUMDOC
+ ADI Blackfin FD-PIC relocations.
+ENUM
+ BFD_RELOC_BFIN_GOT
+ENUMDOC
+ ADI Blackfin GOT relocation.
+ENUM
+ BFD_RELOC_BFIN_PLTPC
+ENUMDOC
+ ADI Blackfin PLTPC relocation.
+ENUM
+ BFD_ARELOC_BFIN_PUSH
+ENUMDOC
+ ADI Blackfin arithmetic relocation.
+ENUM
+ BFD_ARELOC_BFIN_CONST
+ENUMDOC
+ ADI Blackfin arithmetic relocation.
+ENUM
+ BFD_ARELOC_BFIN_ADD
+ENUMDOC
+ ADI Blackfin arithmetic relocation.
+ENUM
+ BFD_ARELOC_BFIN_SUB
+ENUMDOC
+ ADI Blackfin arithmetic relocation.
+ENUM
+ BFD_ARELOC_BFIN_MULT
+ENUMDOC
+ ADI Blackfin arithmetic relocation.
+ENUM
+ BFD_ARELOC_BFIN_DIV
+ENUMDOC
+ ADI Blackfin arithmetic relocation.
+ENUM
+ BFD_ARELOC_BFIN_MOD
+ENUMDOC
+ ADI Blackfin arithmetic relocation.
+ENUM
+ BFD_ARELOC_BFIN_LSHIFT
+ENUMDOC
+ ADI Blackfin arithmetic relocation.
+ENUM
+ BFD_ARELOC_BFIN_RSHIFT
+ENUMDOC
+ ADI Blackfin arithmetic relocation.
+ENUM
+ BFD_ARELOC_BFIN_AND
+ENUMDOC
+ ADI Blackfin arithmetic relocation.
+ENUM
+ BFD_ARELOC_BFIN_OR
+ENUMDOC
+ ADI Blackfin arithmetic relocation.
+ENUM
+ BFD_ARELOC_BFIN_XOR
+ENUMDOC
+ ADI Blackfin arithmetic relocation.
+ENUM
+ BFD_ARELOC_BFIN_LAND
+ENUMDOC
+ ADI Blackfin arithmetic relocation.
+ENUM
+ BFD_ARELOC_BFIN_LOR
+ENUMDOC
+ ADI Blackfin arithmetic relocation.
+ENUM
+ BFD_ARELOC_BFIN_LEN
+ENUMDOC
+ ADI Blackfin arithmetic relocation.
+ENUM
+ BFD_ARELOC_BFIN_NEG
+ENUMDOC
+ ADI Blackfin arithmetic relocation.
+ENUM
+ BFD_ARELOC_BFIN_COMP
+ENUMDOC
+ ADI Blackfin arithmetic relocation.
+ENUM
+ BFD_ARELOC_BFIN_PAGE
+ENUMDOC
+ ADI Blackfin arithmetic relocation.
+ENUM
+ BFD_ARELOC_BFIN_HWPAGE
+ENUMDOC
+ ADI Blackfin arithmetic relocation.
+ENUM
+ BFD_ARELOC_BFIN_ADDR
+ENUMDOC
+ ADI Blackfin arithmetic relocation.
+
+ENUM
BFD_RELOC_D10V_10_PCREL_R
ENUMDOC
Mitsubishi D10V relocs.
@@ -2904,6 +3424,17 @@ ENUMDOC
DLX relocs
ENUM
+ BFD_RELOC_M32C_HI8
+ENUMX
+ BFD_RELOC_M32C_RL_JUMP
+ENUMX
+ BFD_RELOC_M32C_RL_1ADDR
+ENUMX
+ BFD_RELOC_M32C_RL_2ADDR
+ENUMDOC
+ Renesas M16C/M32C Relocations.
+
+ENUM
BFD_RELOC_M32R_24
ENUMDOC
Renesas M32R (formerly Mitsubishi M32R) relocs.
@@ -2954,6 +3485,12 @@ ENUMX
ENUMX
BFD_RELOC_M32R_GOTOFF
ENUMX
+ BFD_RELOC_M32R_GOTOFF_HI_ULO
+ENUMX
+ BFD_RELOC_M32R_GOTOFF_HI_SLO
+ENUMX
+ BFD_RELOC_M32R_GOTOFF_LO
+ENUMX
BFD_RELOC_M32R_GOTPC24
ENUMX
BFD_RELOC_M32R_GOT16_HI_ULO
@@ -3057,6 +3594,11 @@ ENUM
ENUMDOC
Used to maintain alignment whilst relaxing.
ENUM
+ BFD_RELOC_V850_LO16_SPLIT_OFFSET
+ENUMDOC
+ This is a variation of BFD_RELOC_LO16 that can be used in v850e ld.bu
+ instructions.
+ENUM
BFD_RELOC_MN10300_32_PCREL
ENUMDOC
This is a 32bit pcrel reloc for the mn10300, offset by two bytes in the
@@ -3163,6 +3705,50 @@ ENUMDOC
Motorola Mcore relocations.
ENUM
+ BFD_RELOC_MEP_8
+ENUMX
+ BFD_RELOC_MEP_16
+ENUMX
+ BFD_RELOC_MEP_32
+ENUMX
+ BFD_RELOC_MEP_PCREL8A2
+ENUMX
+ BFD_RELOC_MEP_PCREL12A2
+ENUMX
+ BFD_RELOC_MEP_PCREL17A2
+ENUMX
+ BFD_RELOC_MEP_PCREL24A2
+ENUMX
+ BFD_RELOC_MEP_PCABS24A2
+ENUMX
+ BFD_RELOC_MEP_LOW16
+ENUMX
+ BFD_RELOC_MEP_HI16U
+ENUMX
+ BFD_RELOC_MEP_HI16S
+ENUMX
+ BFD_RELOC_MEP_GPREL
+ENUMX
+ BFD_RELOC_MEP_TPREL
+ENUMX
+ BFD_RELOC_MEP_TPREL7
+ENUMX
+ BFD_RELOC_MEP_TPREL7A2
+ENUMX
+ BFD_RELOC_MEP_TPREL7A4
+ENUMX
+ BFD_RELOC_MEP_UIMM24
+ENUMX
+ BFD_RELOC_MEP_ADDR24A4
+ENUMX
+ BFD_RELOC_MEP_GNU_VTINHERIT
+ENUMX
+ BFD_RELOC_MEP_GNU_VTENTRY
+ENUMDOC
+ Toshiba Media Processor Relocations.
+COMMENT
+
+ENUM
BFD_RELOC_MMIX_GETA
ENUMX
BFD_RELOC_MMIX_GETA_1
@@ -3267,6 +3853,11 @@ 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_MS8_LDI
+ENUMDOC
+ This is a 16 bit reloc for the AVR that stores 8 bit value (most high 8 bit
+ of 32 bit value) 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
@@ -3284,16 +3875,35 @@ ENUMDOC
(most high 8 bit of program memory address) into 8 bit immediate value
of LDI or SUBI insn.
ENUM
+ BFD_RELOC_AVR_MS8_LDI_NEG
+ENUMDOC
+ This is a 16 bit reloc for the AVR that stores negated 8 bit value (msb
+ of 32 bit value) into 8 bit immediate value of LDI 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_LO8_LDI_GS
+ENUMDOC
+ This is a 16 bit reloc for the AVR that stores 8 bit value
+ (command address) into 8 bit immediate value of LDI insn. If the address
+ is beyond the 128k boundary, the linker inserts a jump stub for this reloc
+ in the lower 128k.
+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_HI8_LDI_GS
+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. If the address
+ is beyond the 128k boundary, the linker inserts a jump stub for this reloc
+ below 128k.
+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
@@ -3320,6 +3930,21 @@ ENUM
ENUMDOC
This is a 32 bit reloc for the AVR that stores 23 bit value
into 22 bits.
+ENUM
+ BFD_RELOC_AVR_LDI
+ENUMDOC
+ This is a 16 bit reloc for the AVR that stores all needed bits
+ for absolute addressing with ldi with overflow check to linktime
+ENUM
+ BFD_RELOC_AVR_6
+ENUMDOC
+ This is a 6 bit reloc for the AVR that stores offset for ldd/std
+ instructions
+ENUM
+ BFD_RELOC_AVR_6_ADIW
+ENUMDOC
+ This is a 6 bit reloc for the AVR that stores offset for adiw/sbiw
+ instructions
ENUM
BFD_RELOC_390_12
@@ -3481,6 +4106,43 @@ ENUMDOC
Long displacement extension.
ENUM
+ BFD_RELOC_SCORE_DUMMY1
+ENUMDOC
+ Score relocations
+ENUM
+ BFD_RELOC_SCORE_GPREL15
+ENUMDOC
+ Low 16 bit for load/store
+ENUM
+ BFD_RELOC_SCORE_DUMMY2
+ENUMX
+ BFD_RELOC_SCORE_JMP
+ENUMDOC
+ This is a 24-bit reloc with the right 1 bit assumed to be 0
+ENUM
+ BFD_RELOC_SCORE_BRANCH
+ENUMDOC
+ This is a 19-bit reloc with the right 1 bit assumed to be 0
+ENUM
+ BFD_RELOC_SCORE16_JMP
+ENUMDOC
+ This is a 11-bit reloc with the right 1 bit assumed to be 0
+ENUM
+ BFD_RELOC_SCORE16_BRANCH
+ENUMDOC
+ This is a 8-bit reloc with the right 1 bit assumed to be 0
+ENUM
+ BFD_RELOC_SCORE_GOT15
+ENUMX
+ BFD_RELOC_SCORE_GOT_LO16
+ENUMX
+ BFD_RELOC_SCORE_CALL15
+ENUMX
+ BFD_RELOC_SCORE_DUMMY_HI16
+ENUMDOC
+ Undocumented Score relocs
+
+ENUM
BFD_RELOC_IP2K_FR9
ENUMDOC
Scenix IP2K - 9-bit register number / data address
@@ -3771,6 +4433,189 @@ ENUMDOC
This is the 5 bits of a value.
ENUM
+ BFD_RELOC_16C_NUM08
+ENUMX
+ BFD_RELOC_16C_NUM08_C
+ENUMX
+ BFD_RELOC_16C_NUM16
+ENUMX
+ BFD_RELOC_16C_NUM16_C
+ENUMX
+ BFD_RELOC_16C_NUM32
+ENUMX
+ BFD_RELOC_16C_NUM32_C
+ENUMX
+ BFD_RELOC_16C_DISP04
+ENUMX
+ BFD_RELOC_16C_DISP04_C
+ENUMX
+ BFD_RELOC_16C_DISP08
+ENUMX
+ BFD_RELOC_16C_DISP08_C
+ENUMX
+ BFD_RELOC_16C_DISP16
+ENUMX
+ BFD_RELOC_16C_DISP16_C
+ENUMX
+ BFD_RELOC_16C_DISP24
+ENUMX
+ BFD_RELOC_16C_DISP24_C
+ENUMX
+ BFD_RELOC_16C_DISP24a
+ENUMX
+ BFD_RELOC_16C_DISP24a_C
+ENUMX
+ BFD_RELOC_16C_REG04
+ENUMX
+ BFD_RELOC_16C_REG04_C
+ENUMX
+ BFD_RELOC_16C_REG04a
+ENUMX
+ BFD_RELOC_16C_REG04a_C
+ENUMX
+ BFD_RELOC_16C_REG14
+ENUMX
+ BFD_RELOC_16C_REG14_C
+ENUMX
+ BFD_RELOC_16C_REG16
+ENUMX
+ BFD_RELOC_16C_REG16_C
+ENUMX
+ BFD_RELOC_16C_REG20
+ENUMX
+ BFD_RELOC_16C_REG20_C
+ENUMX
+ BFD_RELOC_16C_ABS20
+ENUMX
+ BFD_RELOC_16C_ABS20_C
+ENUMX
+ BFD_RELOC_16C_ABS24
+ENUMX
+ BFD_RELOC_16C_ABS24_C
+ENUMX
+ BFD_RELOC_16C_IMM04
+ENUMX
+ BFD_RELOC_16C_IMM04_C
+ENUMX
+ BFD_RELOC_16C_IMM16
+ENUMX
+ BFD_RELOC_16C_IMM16_C
+ENUMX
+ BFD_RELOC_16C_IMM20
+ENUMX
+ BFD_RELOC_16C_IMM20_C
+ENUMX
+ BFD_RELOC_16C_IMM24
+ENUMX
+ BFD_RELOC_16C_IMM24_C
+ENUMX
+ BFD_RELOC_16C_IMM32
+ENUMX
+ BFD_RELOC_16C_IMM32_C
+ENUMDOC
+ NS CR16C Relocations.
+
+ENUM
+ BFD_RELOC_CR16_NUM8
+ENUMX
+ BFD_RELOC_CR16_NUM16
+ENUMX
+ BFD_RELOC_CR16_NUM32
+ENUMX
+ BFD_RELOC_CR16_NUM32a
+ENUMX
+ BFD_RELOC_CR16_REGREL0
+ENUMX
+ BFD_RELOC_CR16_REGREL4
+ENUMX
+ BFD_RELOC_CR16_REGREL4a
+ENUMX
+ BFD_RELOC_CR16_REGREL14
+ENUMX
+ BFD_RELOC_CR16_REGREL14a
+ENUMX
+ BFD_RELOC_CR16_REGREL16
+ENUMX
+ BFD_RELOC_CR16_REGREL20
+ENUMX
+ BFD_RELOC_CR16_REGREL20a
+ENUMX
+ BFD_RELOC_CR16_ABS20
+ENUMX
+ BFD_RELOC_CR16_ABS24
+ENUMX
+ BFD_RELOC_CR16_IMM4
+ENUMX
+ BFD_RELOC_CR16_IMM8
+ENUMX
+ BFD_RELOC_CR16_IMM16
+ENUMX
+ BFD_RELOC_CR16_IMM20
+ENUMX
+ BFD_RELOC_CR16_IMM24
+ENUMX
+ BFD_RELOC_CR16_IMM32
+ENUMX
+ BFD_RELOC_CR16_IMM32a
+ENUMX
+ BFD_RELOC_CR16_DISP4
+ENUMX
+ BFD_RELOC_CR16_DISP8
+ENUMX
+ BFD_RELOC_CR16_DISP16
+ENUMX
+ BFD_RELOC_CR16_DISP20
+ENUMX
+ BFD_RELOC_CR16_DISP24
+ENUMX
+ BFD_RELOC_CR16_DISP24a
+ENUMDOC
+ NS CR16 Relocations.
+
+ENUM
+ BFD_RELOC_CRX_REL4
+ENUMX
+ BFD_RELOC_CRX_REL8
+ENUMX
+ BFD_RELOC_CRX_REL8_CMP
+ENUMX
+ BFD_RELOC_CRX_REL16
+ENUMX
+ BFD_RELOC_CRX_REL24
+ENUMX
+ BFD_RELOC_CRX_REL32
+ENUMX
+ BFD_RELOC_CRX_REGREL12
+ENUMX
+ BFD_RELOC_CRX_REGREL22
+ENUMX
+ BFD_RELOC_CRX_REGREL28
+ENUMX
+ BFD_RELOC_CRX_REGREL32
+ENUMX
+ BFD_RELOC_CRX_ABS16
+ENUMX
+ BFD_RELOC_CRX_ABS32
+ENUMX
+ BFD_RELOC_CRX_NUM8
+ENUMX
+ BFD_RELOC_CRX_NUM16
+ENUMX
+ BFD_RELOC_CRX_NUM32
+ENUMX
+ BFD_RELOC_CRX_IMM16
+ENUMX
+ BFD_RELOC_CRX_IMM32
+ENUMX
+ BFD_RELOC_CRX_SWITCH8
+ENUMX
+ BFD_RELOC_CRX_SWITCH16
+ENUMX
+ BFD_RELOC_CRX_SWITCH32
+ENUMDOC
+ NS CRX Relocations.
+
+ENUM
BFD_RELOC_CRIS_BDISP8
ENUMX
BFD_RELOC_CRIS_UNSIGNED_5
@@ -3779,6 +4624,16 @@ ENUMX
ENUMX
BFD_RELOC_CRIS_UNSIGNED_6
ENUMX
+ BFD_RELOC_CRIS_SIGNED_8
+ENUMX
+ BFD_RELOC_CRIS_UNSIGNED_8
+ENUMX
+ BFD_RELOC_CRIS_SIGNED_16
+ENUMX
+ BFD_RELOC_CRIS_UNSIGNED_16
+ENUMX
+ BFD_RELOC_CRIS_LAPCQ_OFFSET
+ENUMX
BFD_RELOC_CRIS_UNSIGNED_4
ENUMDOC
These relocs are only used within the CRIS assembler. They are not
@@ -3921,6 +4776,23 @@ ENUMDOC
Sony Xstormy16 Relocations.
ENUM
+ BFD_RELOC_RELC
+ENUMDOC
+ Self-describing complex relocations.
+COMMENT
+
+ENUM
+ BFD_RELOC_XC16X_PAG
+ENUMX
+ BFD_RELOC_XC16X_POF
+ENUMX
+ BFD_RELOC_XC16X_SEG
+ENUMX
+ BFD_RELOC_XC16X_SOF
+ENUMDOC
+ Infineon Relocations.
+
+ENUM
BFD_RELOC_VAX_GLOB_DAT
ENUMX
BFD_RELOC_VAX_JMP_SLOT
@@ -3928,7 +4800,32 @@ ENUMX
BFD_RELOC_VAX_RELATIVE
ENUMDOC
Relocations used by VAX ELF.
-
+
+ENUM
+ BFD_RELOC_MT_PC16
+ENUMDOC
+ Morpho MT - 16 bit immediate relocation.
+ENUM
+ BFD_RELOC_MT_HI16
+ENUMDOC
+ Morpho MT - Hi 16 bits of an address.
+ENUM
+ BFD_RELOC_MT_LO16
+ENUMDOC
+ Morpho MT - Low 16 bits of an address.
+ENUM
+ BFD_RELOC_MT_GNU_VTINHERIT
+ENUMDOC
+ Morpho MT - Used to tell the linker which vtable entries are used.
+ENUM
+ BFD_RELOC_MT_GNU_VTENTRY
+ENUMDOC
+ Morpho MT - Used to tell the linker which vtable entries are used.
+ENUM
+ BFD_RELOC_MT_PCINSN8
+ENUMDOC
+ Morpho MT - 8 bit immediate relocation.
+
ENUM
BFD_RELOC_MSP430_10_PCREL
ENUMX
@@ -3939,6 +4836,10 @@ ENUMX
BFD_RELOC_MSP430_16_PCREL_BYTE
ENUMX
BFD_RELOC_MSP430_16_BYTE
+ENUMX
+ BFD_RELOC_MSP430_2X_PCREL
+ENUMX
+ BFD_RELOC_MSP430_RL_PCREL
ENUMDOC
msp430 specific relocation codes
@@ -3971,29 +4872,127 @@ 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_DIFF8
+ENUMX
+ BFD_RELOC_XTENSA_DIFF16
+ENUMX
+ BFD_RELOC_XTENSA_DIFF32
+ENUMDOC
+ Xtensa relocations to mark the difference of two local symbols.
+ These are only needed to support linker relaxation and can be ignored
+ when not relaxing. The field is set to the value of the difference
+ assuming no relaxation. The relocation encodes the position of the
+ first symbol so the linker can determine whether to adjust the field
+ value.
+ENUM
+ BFD_RELOC_XTENSA_SLOT0_OP
+ENUMX
+ BFD_RELOC_XTENSA_SLOT1_OP
+ENUMX
+ BFD_RELOC_XTENSA_SLOT2_OP
+ENUMX
+ BFD_RELOC_XTENSA_SLOT3_OP
+ENUMX
+ BFD_RELOC_XTENSA_SLOT4_OP
+ENUMX
+ BFD_RELOC_XTENSA_SLOT5_OP
+ENUMX
+ BFD_RELOC_XTENSA_SLOT6_OP
+ENUMX
+ BFD_RELOC_XTENSA_SLOT7_OP
+ENUMX
+ BFD_RELOC_XTENSA_SLOT8_OP
+ENUMX
+ BFD_RELOC_XTENSA_SLOT9_OP
+ENUMX
+ BFD_RELOC_XTENSA_SLOT10_OP
+ENUMX
+ BFD_RELOC_XTENSA_SLOT11_OP
+ENUMX
+ BFD_RELOC_XTENSA_SLOT12_OP
+ENUMX
+ BFD_RELOC_XTENSA_SLOT13_OP
+ENUMX
+ BFD_RELOC_XTENSA_SLOT14_OP
+ENUMDOC
+ Generic Xtensa relocations for instruction operands. Only the slot
+ number is encoded in the relocation. The relocation applies to the
+ last PC-relative immediate operand, or if there are no PC-relative
+ immediates, to the last immediate operand.
+ENUM
+ BFD_RELOC_XTENSA_SLOT0_ALT
+ENUMX
+ BFD_RELOC_XTENSA_SLOT1_ALT
+ENUMX
+ BFD_RELOC_XTENSA_SLOT2_ALT
+ENUMX
+ BFD_RELOC_XTENSA_SLOT3_ALT
+ENUMX
+ BFD_RELOC_XTENSA_SLOT4_ALT
+ENUMX
+ BFD_RELOC_XTENSA_SLOT5_ALT
+ENUMX
+ BFD_RELOC_XTENSA_SLOT6_ALT
+ENUMX
+ BFD_RELOC_XTENSA_SLOT7_ALT
+ENUMX
+ BFD_RELOC_XTENSA_SLOT8_ALT
+ENUMX
+ BFD_RELOC_XTENSA_SLOT9_ALT
+ENUMX
+ BFD_RELOC_XTENSA_SLOT10_ALT
+ENUMX
+ BFD_RELOC_XTENSA_SLOT11_ALT
+ENUMX
+ BFD_RELOC_XTENSA_SLOT12_ALT
+ENUMX
+ BFD_RELOC_XTENSA_SLOT13_ALT
+ENUMX
+ BFD_RELOC_XTENSA_SLOT14_ALT
+ENUMDOC
+ Alternate Xtensa relocations. Only the slot is encoded in the
+ relocation. The meaning of these relocations is opcode-specific.
+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.
+ Xtensa relocations for backward compatibility. These have all been
+ replaced by BFD_RELOC_XTENSA_SLOT0_OP.
ENUM
BFD_RELOC_XTENSA_ASM_EXPAND
ENUMDOC
- Xtensa relocation to mark that the assembler expanded the
+ 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
+ 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.
+ENUM
+ BFD_RELOC_Z80_DISP8
+ENUMDOC
+ 8 bit signed offset in (ix+d) or (iy+d).
+
+ENUM
+ BFD_RELOC_Z8K_DISP7
+ENUMDOC
+ DJNZ offset.
+ENUM
+ BFD_RELOC_Z8K_CALLR
+ENUMDOC
+ CALR offset.
+ENUM
+ BFD_RELOC_Z8K_IMM4L
+ENUMDOC
+ 4 bit value.
+
ENDSENUM
BFD_RELOC_UNUSED
CODE_FRAGMENT
@@ -4004,10 +5003,13 @@ CODE_FRAGMENT
/*
FUNCTION
bfd_reloc_type_lookup
+ bfd_reloc_name_lookup
SYNOPSIS
reloc_howto_type *bfd_reloc_type_lookup
(bfd *abfd, bfd_reloc_code_real_type code);
+ reloc_howto_type *bfd_reloc_name_lookup
+ (bfd *abfd, const char *reloc_name);
DESCRIPTION
Return a pointer to a howto structure which, when
@@ -4022,8 +5024,14 @@ bfd_reloc_type_lookup (bfd *abfd, bfd_reloc_code_real_type code)
return BFD_SEND (abfd, reloc_type_lookup, (abfd, code));
}
+reloc_howto_type *
+bfd_reloc_name_lookup (bfd *abfd, const char *reloc_name)
+{
+ return BFD_SEND (abfd, reloc_name_lookup, (abfd, reloc_name));
+}
+
static reloc_howto_type bfd_howto_32 =
-HOWTO (0, 00, 2, 32, FALSE, 0, complain_overflow_bitfield, 0, "VRT32", FALSE, 0xffffffff, 0xffffffff, TRUE);
+HOWTO (0, 00, 2, 32, FALSE, 0, complain_overflow_dont, 0, "VRT32", FALSE, 0xffffffff, 0xffffffff, TRUE);
/*
INTERNAL_FUNCTION
@@ -4096,8 +5104,7 @@ SYNOPSIS
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.
+ don't do relaxing.
*/
bfd_boolean
@@ -4106,11 +5113,6 @@ bfd_generic_relax_section (bfd *abfd 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;
}
@@ -4130,7 +5132,7 @@ DESCRIPTION
bfd_boolean
bfd_generic_gc_sections (bfd *abfd ATTRIBUTE_UNUSED,
- struct bfd_link_info *link_info ATTRIBUTE_UNUSED)
+ struct bfd_link_info *info ATTRIBUTE_UNUSED)
{
return TRUE;
}
@@ -4189,6 +5191,7 @@ bfd_generic_get_relocated_section_contents (bfd *abfd,
long reloc_size = bfd_get_reloc_upper_bound (input_bfd, input_section);
arelent **reloc_vector = NULL;
long reloc_count;
+ bfd_size_type sz;
if (reloc_size < 0)
goto error_return;
@@ -4198,22 +5201,10 @@ bfd_generic_get_relocated_section_contents (bfd *abfd,
goto error_return;
/* Read in the section. */
- if (!bfd_get_section_contents (input_bfd,
- input_section,
- data,
- 0,
- input_section->_raw_size))
+ sz = input_section->rawsize ? input_section->rawsize : input_section->size;
+ if (!bfd_get_section_contents (input_bfd, input_section, data, 0, sz))
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,
@@ -4227,13 +5218,31 @@ bfd_generic_get_relocated_section_contents (bfd *abfd,
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);
+ asymbol *symbol;
+ bfd_reloc_status_type r;
+
+ symbol = *(*parent)->sym_ptr_ptr;
+ if (symbol->section && elf_discarded_section (symbol->section))
+ {
+ bfd_byte *p;
+ static reloc_howto_type none_howto
+ = HOWTO (0, 0, 0, 0, FALSE, 0, complain_overflow_dont, NULL,
+ "unused", FALSE, 0, 0, FALSE);
+
+ p = data + (*parent)->address * bfd_octets_per_byte (input_bfd);
+ _bfd_clear_contents ((*parent)->howto, input_bfd, p);
+ (*parent)->sym_ptr_ptr = bfd_abs_section.symbol_ptr_ptr;
+ (*parent)->addend = 0;
+ (*parent)->howto = &none_howto;
+ r = bfd_reloc_ok;
+ }
+ else
+ r = bfd_perform_relocation (input_bfd,
+ *parent,
+ data,
+ input_section,
+ relocatable ? abfd : NULL,
+ &error_message);
if (relocatable)
{
@@ -4264,7 +5273,8 @@ bfd_generic_get_relocated_section_contents (bfd *abfd,
break;
case bfd_reloc_overflow:
if (!((*link_info->callbacks->reloc_overflow)
- (link_info, bfd_asymbol_name (*(*parent)->sym_ptr_ptr),
+ (link_info, NULL,
+ bfd_asymbol_name (*(*parent)->sym_ptr_ptr),
(*parent)->howto->name, (*parent)->addend,
input_bfd, input_section, (*parent)->address)))
goto error_return;
diff --git a/contrib/binutils/bfd/reloc16.c b/contrib/binutils/bfd/reloc16.c
index 720e2d6..f5c78b2 100644
--- a/contrib/binutils/bfd/reloc16.c
+++ b/contrib/binutils/bfd/reloc16.c
@@ -1,6 +1,6 @@
/* 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.
+ 2002, 2003, 2004, 2007 Free Software Foundation, Inc.
Written by Cygnus Support.
This file is part of BFD, the Binary File Descriptor library.
@@ -17,7 +17,7 @@ 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. */
+Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
/* Most of this hacked by Steve Chamberlain <sac@cygnus.com>. */
@@ -32,8 +32,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
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 "bfd.h"
#include "libbfd.h"
#include "bfdlink.h"
#include "genlink.h"
@@ -230,7 +230,8 @@ bfd_coff_reloc16_relax_section (abfd, input_section, link_info, again)
free ((char *) shrinks);
}
- input_section->_cooked_size -= shrink;
+ input_section->rawsize = input_section->size;
+ input_section->size -= shrink;
free ((char *) reloc_vector);
return TRUE;
}
@@ -255,6 +256,7 @@ bfd_coff_reloc16_get_relocated_section_contents (in_abfd,
long reloc_size = bfd_get_reloc_upper_bound (input_bfd, input_section);
arelent **reloc_vector;
long reloc_count;
+ bfd_size_type sz;
if (reloc_size < 0)
return NULL;
@@ -267,11 +269,8 @@ bfd_coff_reloc16_get_relocated_section_contents (in_abfd,
symbols);
/* Read in the section. */
- if (!bfd_get_section_contents (input_bfd,
- input_section,
- data,
- (bfd_vma) 0,
- input_section->_raw_size))
+ sz = input_section->rawsize ? input_section->rawsize : input_section->size;
+ if (!bfd_get_section_contents (input_bfd, input_section, data, 0, sz))
return NULL;
reloc_vector = (arelent **) bfd_malloc ((bfd_size_type) reloc_size);
diff --git a/contrib/binutils/bfd/rs6000-core.c b/contrib/binutils/bfd/rs6000-core.c
index 3fa0975..4a2e107 100644
--- a/contrib/binutils/bfd/rs6000-core.c
+++ b/contrib/binutils/bfd/rs6000-core.c
@@ -1,13 +1,8 @@
/* IBM RS/6000 "XCOFF" back-end for BFD.
Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 2000,
- 2001, 2002
+ 2001, 2002, 2004, 2006, 2007
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.
+ Written by Metin G. Ozisik, Mimi Phuong-Thao Vo, and John Gilmore.
Archive support from Damon A. Permezel.
Contributed by IBM Corporation and Cygnus Support.
@@ -25,7 +20,7 @@
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. */
+ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
/* This port currently only handles reading object files, except when
compiled on an RS/6000 host. -- no archive support, no core files.
@@ -44,8 +39,8 @@
#define _LONG_LONG
#endif
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
#ifdef AIX_CORE
@@ -71,6 +66,9 @@
#include <sys/core.h>
#include <sys/systemcfg.h>
+/* Borrowed from <sys/inttypes.h> on recent AIX versions. */
+typedef unsigned long ptr_to_uint;
+
#define core_hdr(bfd) ((CoreHdr *) bfd->tdata.any)
/* AIX 4.1 changed the names and locations of a few items in the core file.
@@ -250,6 +248,15 @@ typedef union {
#define CORE_COMMONSZ ((int) &((struct core_dump *) 0)->c_entries \
+ sizeof (((struct core_dump *) 0)->c_entries))
+/* Define prototypes for certain functions, to avoid a compiler warning
+ saying that they are missing. */
+
+const bfd_target * rs6000coff_core_p (bfd *abfd);
+bfd_boolean rs6000coff_core_file_matches_executable_p (bfd *core_bfd,
+ bfd *exec_bfd);
+char * rs6000coff_core_file_failing_command (bfd *abfd);
+int rs6000coff_core_file_failing_signal (bfd *abfd);
+
/* Try to read into CORE the header from the core file associated with ABFD.
Return success. */
@@ -277,22 +284,16 @@ read_hdr (bfd *abfd, CoreHdr *core)
}
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;
+make_bfd_asection (bfd *abfd, const char *name, flagword flags,
+ bfd_size_type size, bfd_vma vma, file_ptr filepos)
{
asection *asect;
- asect = bfd_make_section_anyway (abfd, name);
+ asect = bfd_make_section_anyway_with_flags (abfd, name, flags);
if (!asect)
return NULL;
- asect->flags = flags;
- asect->_raw_size = _raw_size;
+ asect->size = size;
asect->vma = vma;
asect->filepos = filepos;
asect->alignment_power = 8;
@@ -304,8 +305,7 @@ make_bfd_asection (abfd, name, flags, _raw_size, vma, filepos)
magic number or anything like, in rs6000coff. */
const bfd_target *
-rs6000coff_core_p (abfd)
- bfd *abfd;
+rs6000coff_core_p (bfd *abfd)
{
CoreHdr core;
struct stat statbuf;
@@ -341,11 +341,11 @@ rs6000coff_core_p (abfd)
else
{
c_flag = core.old.c_flag;
- c_stack = (file_ptr) core.old.c_stack;
+ c_stack = (file_ptr) (ptr_to_uint) 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);
+ c_loader = (file_ptr) (ptr_to_uint) COLD_LOADER (core.old);
proc64 = 0;
}
@@ -523,9 +523,9 @@ rs6000coff_core_p (abfd)
else
{
c_datasize = core.old.c_datasize;
- c_data = (file_ptr) core.old.c_data;
+ c_data = (file_ptr) (ptr_to_uint) core.old.c_data;
c_vmregions = core.old.c_vmregions;
- c_vmm = (file_ptr) core.old.c_vmm;
+ c_vmm = (file_ptr) (ptr_to_uint) core.old.c_vmm;
}
/* .data section from executable. */
@@ -633,9 +633,7 @@ rs6000coff_core_p (abfd)
/* 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;
+rs6000coff_core_file_matches_executable_p (bfd *core_bfd, bfd *exec_bfd)
{
CoreHdr core;
bfd_size_type size;
@@ -651,7 +649,7 @@ rs6000coff_core_file_matches_executable_p (core_bfd, exec_bfd)
if (CORE_NEW (core))
c_loader = CNEW_LOADER (core.new);
else
- c_loader = (file_ptr) COLD_LOADER (core.old);
+ c_loader = (file_ptr) (ptr_to_uint) COLD_LOADER (core.old);
if (CORE_NEW (core) && CNEW_PROC64 (core.new))
size = (int) ((LdInfo *) 0)->l64.ldinfo_filename;
@@ -711,8 +709,7 @@ rs6000coff_core_file_matches_executable_p (core_bfd, exec_bfd)
}
char *
-rs6000coff_core_file_failing_command (abfd)
- bfd *abfd;
+rs6000coff_core_file_failing_command (bfd *abfd)
{
CoreHdr *core = core_hdr (abfd);
char *com = CORE_NEW (*core) ?
@@ -725,8 +722,7 @@ rs6000coff_core_file_failing_command (abfd)
}
int
-rs6000coff_core_file_failing_signal (abfd)
- bfd *abfd;
+rs6000coff_core_file_failing_signal (bfd *abfd)
{
CoreHdr *core = core_hdr (abfd);
return CORE_NEW (*core) ? core->new.c_signo : core->old.c_signo;
diff --git a/contrib/binutils/bfd/sco5-core.c b/contrib/binutils/bfd/sco5-core.c
index 5c34ff1..21631cf 100644
--- a/contrib/binutils/bfd/sco5-core.c
+++ b/contrib/binutils/bfd/sco5-core.c
@@ -1,5 +1,5 @@
/* BFD back end for SCO5 core files (U-area and raw sections)
- Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2004
+ Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
Free Software Foundation, Inc.
Written by Jouke Numan <jnuman@hiscom.nl>
@@ -17,10 +17,10 @@ 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. */
+Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
#include "libaout.h" /* BFD a.out internal data structures */
@@ -31,8 +31,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include <signal.h>
#include <sys/user.h> /* After a.out.h */
+#ifdef SCO5_CORE
#include <sys/paccess.h>
#include <sys/region.h>
+#endif
struct sco5_core_struct
{
@@ -47,26 +49,24 @@ 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));
+#define sco5_core_file_matches_executable_p generic_core_file_matches_executable_p
static void swap_abort PARAMS ((void));
static asection *
-make_bfd_asection (abfd, name, flags, _raw_size, vma, filepos)
+make_bfd_asection (abfd, name, flags, size, vma, filepos)
bfd *abfd;
const char *name;
flagword flags;
- bfd_size_type _raw_size;
+ bfd_size_type size;
bfd_vma vma;
file_ptr filepos;
{
asection *asect;
- asect = bfd_make_section_anyway (abfd, name);
+ asect = bfd_make_section_anyway_with_flags (abfd, name, flags);
if (!asect)
return NULL;
- asect->flags = flags;
- asect->_raw_size = _raw_size;
+ asect->size = size;
asect->vma = vma;
asect->filepos = filepos;
asect->alignment_power = 2;
@@ -123,18 +123,14 @@ sco5_core_file_p (abfd)
char *secname;
flagword flags;
- /* Read coreoffsets region at end of core (see core(FP)) */
+ /* Read coreoffsets region at end of core (see core(FP)). */
{
- FILE *stream = bfd_cache_lookup (abfd);
struct stat statbuf;
- if (stream == NULL)
+
+ if (bfd_stat (abfd, &statbuf) < 0)
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 */
@@ -347,14 +343,6 @@ sco5_core_file_failing_signal (ignore_abfd)
: -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 ()
diff --git a/contrib/binutils/bfd/section.c b/contrib/binutils/bfd/section.c
index fce8e1e..135f44c 100644
--- a/contrib/binutils/bfd/section.c
+++ b/contrib/binutils/bfd/section.c
@@ -1,6 +1,6 @@
/* Object file "section" support for the BFD library.
Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
- 2000, 2001, 2002, 2003
+ 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
Free Software Foundation, Inc.
Written by Cygnus Support.
@@ -18,7 +18,7 @@ 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. */
+Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
/*
SECTION
@@ -133,8 +133,8 @@ SUBSECTION
*/
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
#include "bfdlink.h"
@@ -149,23 +149,6 @@ SUBSECTION
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
@@ -181,6 +164,9 @@ CODE_FRAGMENT
. {* The next section in the list belonging to the BFD, or NULL. *}
. struct bfd_section *next;
.
+. {* The previous section in the list belonging to the BFD, or NULL. *}
+. struct bfd_section *prev;
+.
. {* The field flags contains attributes of the section. Some
. flags are read in from the object file, and some are
. synthesized from other information. *}
@@ -200,23 +186,17 @@ CODE_FRAGMENT
. 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
+.#define SEC_READONLY 0x008
.
. {* The section contains code only. *}
-.#define SEC_CODE 0x020
+.#define SEC_CODE 0x010
.
. {* The section contains data only. *}
-.#define SEC_DATA 0x040
+.#define SEC_DATA 0x020
.
. {* The section will reside in ROM. *}
-.#define SEC_ROM 0x080
+.#define SEC_ROM 0x040
.
. {* The section contains constructor information. This section
. type is used by the linker to create lists of constructors and
@@ -228,30 +208,19 @@ CODE_FRAGMENT
. sections called <<__CTOR_LIST__>> and relocate the data
. contained within - exactly the operations it would peform on
. standard data. *}
-.#define SEC_CONSTRUCTOR 0x100
+.#define SEC_CONSTRUCTOR 0x080
.
. {* 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
+.#define SEC_HAS_CONTENTS 0x100
.
. {* 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
+.#define SEC_NEVER_LOAD 0x200
.
. {* The section contains thread local data. *}
-.#define SEC_THREAD_LOCAL 0x1000
+.#define SEC_THREAD_LOCAL 0x400
.
. {* The section has GOT references. This flag is only for the
. linker, and is currently only used by the elf32-hppa back end.
@@ -259,46 +228,46 @@ CODE_FRAGMENT
. 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
+.#define SEC_HAS_GOT_REF 0x800
.
. {* 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
+.#define SEC_IS_COMMON 0x1000
.
. {* 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
+.#define SEC_DEBUGGING 0x2000
.
. {* 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
+.#define SEC_IN_MEMORY 0x4000
.
. {* 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
+.#define SEC_EXCLUDE 0x8000
.
. {* 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
+.#define SEC_SORT_ENTRIES 0x10000
.
. {* 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
+.#define SEC_LINK_ONCE 0x20000
.
. {* If SEC_LINK_ONCE is set, this bitfield describes how the linker
. should handle duplicate sections. *}
-.#define SEC_LINK_DUPLICATES 0x600000
+.#define SEC_LINK_DUPLICATES 0x40000
.
. {* This value for SEC_LINK_DUPLICATES means that duplicate
. sections with the same name should simply be discarded. *}
@@ -307,55 +276,71 @@ CODE_FRAGMENT
. {* 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
+.#define SEC_LINK_DUPLICATES_ONE_ONLY 0x80000
.
. {* 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
+.#define SEC_LINK_DUPLICATES_SAME_SIZE 0x100000
.
. {* 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
+.#define SEC_LINK_DUPLICATES_SAME_CONTENTS \
+. (SEC_LINK_DUPLICATES_ONE_ONLY | SEC_LINK_DUPLICATES_SAME_SIZE)
.
. {* 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
+.#define SEC_LINKER_CREATED 0x200000
.
-. {* This section should not be subject to garbage collection. *}
-.#define SEC_KEEP 0x1000000
+. {* This section should not be subject to garbage collection.
+. Also set to inform the linker that this section should not be
+. listed in the link map as discarded. *}
+.#define SEC_KEEP 0x400000
.
. {* 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
+.#define SEC_SMALL_DATA 0x800000
.
. {* Attempt to merge identical entities in the section.
. Entity size is given in the entsize field. *}
-.#define SEC_MERGE 0x20000000
+.#define SEC_MERGE 0x1000000
.
. {* 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
+.#define SEC_STRINGS 0x2000000
.
. {* This section contains data about section groups. *}
-.#define SEC_GROUP 0x80000000
+.#define SEC_GROUP 0x4000000
+.
+. {* 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 0x10000000
+.
+. {* This section contains data which may be shared with other
+. executables or shared objects. This is for COFF only. *}
+.#define SEC_COFF_SHARED 0x20000000
+.
+. {* 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. This is for TI
+. TMS320C54X only. *}
+.#define SEC_TIC54X_BLOCK 0x40000000
+.
+. {* Conditionally link this section; do not link if there are no
+. references found to any symbol in the section. This is for TI
+. TMS320C54X only. *}
+.#define SEC_TIC54X_CLINK 0x80000000
.
. {* End of section flags. *}
.
@@ -364,9 +349,6 @@ CODE_FRAGMENT
. {* 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;
.
@@ -374,8 +356,9 @@ CODE_FRAGMENT
. output sections that have an input section. *}
. unsigned int linker_has_input : 1;
.
-. {* A mark flag used by some linker backends for garbage collection. *}
+. {* Mark flags used by some linker backends for garbage collection. *}
. unsigned int gc_mark : 1;
+. unsigned int gc_mark_from_eh : 1;
.
. {* The following flags are used by the ELF linker. *}
.
@@ -393,22 +376,20 @@ CODE_FRAGMENT
. {* 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;
+. {* Bits used by various backends. The generic code doesn't touch
+. these fields. *}
.
-. {* Nonzero if this section needs the relax finalize pass. *}
-. unsigned int need_finalize_relax:1;
+. {* Nonzero if this section has TLS related relocations. *}
+. unsigned int has_tls_reloc: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;
+. {* Nonzero if this section needs the relax finalize pass. *}
+. unsigned int need_finalize_relax:1;
+.
+. {* Whether relocations have been processed. *}
+. unsigned int reloc_done : 1;
.
. {* End of internal packed boolean fields. *}
.
@@ -427,13 +408,18 @@ CODE_FRAGMENT
.
. {* 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;
+. size of <<.bss>>). *}
+. bfd_size_type size;
+.
+. {* For input sections, the original size on disk of the section, in
+. octets. This field is used by the linker relaxation code. It is
+. currently only set for sections where the linker relaxation scheme
+. doesn't cache altered section and reloc contents (stabs, eh_frame,
+. SEC_MERGE, some coff relaxing targets), and thus the original size
+. needs to be kept to read the section multiple times.
+. For output sections, rawsize holds the section size calculated on
+. a previous linker relaxation pass. *}
+. bfd_size_type rawsize;
.
. {* 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
@@ -490,9 +476,6 @@ CODE_FRAGMENT
. {* 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;
@@ -517,8 +500,14 @@ CODE_FRAGMENT
. struct bfd_symbol *symbol;
. struct bfd_symbol **symbol_ptr_ptr;
.
-. struct bfd_link_order *link_order_head;
-. struct bfd_link_order *link_order_tail;
+. {* Early in the link process, map_head and map_tail are used to build
+. a list of input sections attached to an output section. Later,
+. output sections use these fields for a list of bfd_link_order
+. structs. *}
+. union {
+. struct bfd_link_order *link_order;
+. struct bfd_section *s;
+. } map_head, map_tail;
.} asection;
.
.{* These sections are global, and are managed by BFD. The application
@@ -553,40 +542,133 @@ CODE_FRAGMENT
. || ((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) \
+.#define bfd_section_list_remove(ABFD, S) \
+. do \
+. { \
+. asection *_s = S; \
+. asection *_next = _s->next; \
+. asection *_prev = _s->prev; \
+. if (_prev) \
+. _prev->next = _next; \
+. else \
+. (ABFD)->sections = _next; \
+. if (_next) \
+. _next->prev = _prev; \
+. else \
+. (ABFD)->section_last = _prev; \
+. } \
+. while (0)
+.#define bfd_section_list_append(ABFD, S) \
+. do \
+. { \
+. asection *_s = S; \
+. bfd *_abfd = ABFD; \
+. _s->next = NULL; \
+. if (_abfd->section_last) \
+. { \
+. _s->prev = _abfd->section_last; \
+. _abfd->section_last->next = _s; \
+. } \
+. else \
+. { \
+. _s->prev = NULL; \
+. _abfd->sections = _s; \
+. } \
+. _abfd->section_last = _s; \
+. } \
+. while (0)
+.#define bfd_section_list_prepend(ABFD, S) \
+. do \
+. { \
+. asection *_s = S; \
+. bfd *_abfd = ABFD; \
+. _s->prev = NULL; \
+. if (_abfd->sections) \
+. { \
+. _s->next = _abfd->sections; \
+. _abfd->sections->prev = _s; \
+. } \
+. else \
+. { \
+. _s->next = NULL; \
+. _abfd->section_last = _s; \
+. } \
+. _abfd->sections = _s; \
+. } \
+. while (0)
+.#define bfd_section_list_insert_after(ABFD, A, S) \
. do \
. { \
-. asection **_ps = PS; \
-. asection *_s = *_ps; \
-. *_ps = _s->next; \
-. if (_s->next == NULL) \
-. (ABFD)->section_tail = _ps; \
+. asection *_a = A; \
+. asection *_s = S; \
+. asection *_next = _a->next; \
+. _s->next = _next; \
+. _s->prev = _a; \
+. _a->next = _s; \
+. if (_next) \
+. _next->prev = _s; \
+. else \
+. (ABFD)->section_last = _s; \
. } \
. while (0)
-.#define bfd_section_list_insert(ABFD, PS, S) \
+.#define bfd_section_list_insert_before(ABFD, B, S) \
. do \
. { \
-. asection **_ps = PS; \
+. asection *_b = B; \
. asection *_s = S; \
-. _s->next = *_ps; \
-. *_ps = _s; \
-. if (_s->next == NULL) \
-. (ABFD)->section_tail = &_s->next; \
+. asection *_prev = _b->prev; \
+. _s->prev = _prev; \
+. _s->next = _b; \
+. _b->prev = _s; \
+. if (_prev) \
+. _prev->next = _s; \
+. else \
+. (ABFD)->sections = _s; \
. } \
. while (0)
+.#define bfd_section_removed_from_list(ABFD, S) \
+. ((S)->next == NULL ? (ABFD)->section_last != (S) : (S)->next->prev != (S))
+.
+.#define BFD_FAKE_SECTION(SEC, FLAGS, SYM, NAME, IDX) \
+. {* name, id, index, next, prev, flags, user_set_vma, *} \
+. { NAME, IDX, 0, NULL, NULL, FLAGS, 0, \
+. \
+. {* linker_mark, linker_has_input, gc_mark, gc_mark_from_eh, *} \
+. 0, 0, 1, 0, \
+. \
+. {* segment_mark, sec_info_type, use_rela_p, has_tls_reloc, *} \
+. 0, 0, 0, 0, \
+. \
+. {* has_gp_reloc, need_finalize_relax, reloc_done, *} \
+. 0, 0, 0, \
+. \
+. {* vma, lma, size, rawsize *} \
+. 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, kept_section, moving_line_filepos, *} \
+. 0, NULL, 0, \
+. \
+. {* target_index, used_by_bfd, constructor_chain, owner, *} \
+. 0, NULL, NULL, NULL, \
+. \
+. {* symbol, symbol_ptr_ptr, *} \
+. (struct bfd_symbol *) SYM, &SEC.symbol, \
+. \
+. {* map_head, map_tail *} \
+. { NULL }, { NULL } \
+. }
.
*/
@@ -613,65 +695,16 @@ static const asymbol global_syms[] =
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 \
- }
+#define STD_SECTION(SEC, FLAGS, NAME, IDX) \
+ asection SEC = BFD_FAKE_SECTION(SEC, FLAGS, &global_syms[IDX], \
+ NAME, IDX)
-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);
+STD_SECTION (bfd_com_section, SEC_IS_COMMON, BFD_COM_SECTION_NAME, 0);
+STD_SECTION (bfd_und_section, 0, BFD_UND_SECTION_NAME, 1);
+STD_SECTION (bfd_abs_section, 0, BFD_ABS_SECTION_NAME, 2);
+STD_SECTION (bfd_ind_section, 0, 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 *
@@ -702,23 +735,16 @@ bfd_section_hash_newfunc (struct bfd_hash_entry *entry,
((struct section_hash_entry *) \
bfd_hash_lookup ((table), (string), (create), (copy)))
-/* Initializes a new section. NEWSECT->NAME is already set. */
+/* 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. */
-static asection *
-bfd_section_init (bfd *abfd, asection *newsect)
+bfd_boolean
+_bfd_generic_new_section_hook (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;
+ return FALSE;
newsect->symbol->name = newsect->name;
newsect->symbol->value = 0;
@@ -726,14 +752,26 @@ bfd_section_init (bfd *abfd, asection *newsect)
newsect->symbol->flags = BSF_SECTION_SYM;
newsect->symbol_ptr_ptr = &newsect->symbol;
+ return TRUE;
+}
+
+/* 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;
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;
+ bfd_section_list_append (abfd, newsect);
return newsect;
}
@@ -763,7 +801,7 @@ void
bfd_section_list_clear (bfd *abfd)
{
abfd->sections = NULL;
- abfd->section_tail = &abfd->sections;
+ abfd->section_last = NULL;
abfd->section_count = 0;
memset (abfd->section_htab.table, 0,
abfd->section_htab.size * sizeof (struct bfd_hash_entry *));
@@ -801,6 +839,57 @@ bfd_get_section_by_name (bfd *abfd, const char *name)
/*
FUNCTION
+ bfd_get_section_by_name_if
+
+SYNOPSIS
+ asection *bfd_get_section_by_name_if
+ (bfd *abfd,
+ const char *name,
+ bfd_boolean (*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} whose name matches @var{name},
+ passing @var{obj} as an argument. The function will be called
+ as if by
+
+| func (abfd, the_section, obj);
+
+ It returns the first section for which @var{func} returns true,
+ otherwise <<NULL>>.
+
+*/
+
+asection *
+bfd_get_section_by_name_if (bfd *abfd, const char *name,
+ bfd_boolean (*operation) (bfd *,
+ asection *,
+ void *),
+ void *user_storage)
+{
+ struct section_hash_entry *sh;
+ unsigned long hash;
+
+ sh = section_hash_lookup (&abfd->section_htab, name, FALSE, FALSE);
+ if (sh == NULL)
+ return NULL;
+
+ hash = sh->root.hash;
+ do
+ {
+ if ((*operation) (abfd, &sh->section, user_storage))
+ return &sh->section;
+ sh = (struct section_hash_entry *) sh->root.next;
+ }
+ while (sh != NULL && sh->root.hash == hash
+ && strcmp (sh->root.string, name) == 0);
+
+ return NULL;
+}
+
+/*
+FUNCTION
bfd_get_unique_section_name
SYNOPSIS
@@ -873,7 +962,6 @@ DESCRIPTION
asection *
bfd_make_section_old_way (bfd *abfd, const char *name)
{
- struct section_hash_entry *sh;
asection *newsect;
if (abfd->output_has_begun)
@@ -883,43 +971,53 @@ bfd_make_section_old_way (bfd *abfd, const char *name)
}
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;
+ newsect = bfd_abs_section_ptr;
+ else if (strcmp (name, BFD_COM_SECTION_NAME) == 0)
+ newsect = bfd_com_section_ptr;
+ else if (strcmp (name, BFD_UND_SECTION_NAME) == 0)
+ newsect = bfd_und_section_ptr;
+ else if (strcmp (name, BFD_IND_SECTION_NAME) == 0)
+ newsect = bfd_ind_section_ptr;
+ else
+ {
+ struct section_hash_entry *sh;
- 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;
- 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 = &sh->section;
- if (newsect->name != NULL)
- {
- /* Section already exists. */
- return newsect;
+ newsect->name = name;
+ return bfd_section_init (abfd, newsect);
}
- newsect->name = name;
- return bfd_section_init (abfd, newsect);
+ /* Call new_section_hook when "creating" the standard abs, com, und
+ and ind sections to tack on format specific section data.
+ Also, create a proper section symbol. */
+ if (! BFD_SEND (abfd, _new_section_hook, (abfd, newsect)))
+ return NULL;
+ return newsect;
}
/*
FUNCTION
- bfd_make_section_anyway
+ bfd_make_section_anyway_with_flags
SYNOPSIS
- asection *bfd_make_section_anyway (bfd *abfd, const char *name);
+ asection *bfd_make_section_anyway_with_flags
+ (bfd *abfd, const char *name, flagword flags);
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.
+ is already a section with that name. Also set the attributes of the
+ new section to the value @var{flags}.
Return <<NULL>> and set <<bfd_error>> on error; possible errors are:
o <<bfd_error_invalid_operation>> - If output has already started for @var{abfd}.
@@ -927,7 +1025,8 @@ DESCRIPTION
*/
sec_ptr
-bfd_make_section_anyway (bfd *abfd, const char *name)
+bfd_make_section_anyway_with_flags (bfd *abfd, const char *name,
+ flagword flags)
{
struct section_hash_entry *sh;
asection *newsect;
@@ -945,35 +1044,68 @@ bfd_make_section_anyway (bfd *abfd, const char *name)
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)
+ /* We are making a section of the same name. Put it in the
+ section hash table. Even though we can't find it directly by a
+ hash lookup, we'll be able to find the section by traversing
+ sh->root.next quicker than looking at all the bfd sections. */
+ struct section_hash_entry *new_sh;
+ new_sh = (struct section_hash_entry *)
+ bfd_section_hash_newfunc (NULL, &abfd->section_htab, name);
+ if (new_sh == NULL)
return NULL;
+
+ new_sh->root = sh->root;
+ sh->root.next = &new_sh->root;
+ newsect = &new_sh->section;
}
+ newsect->flags = flags;
newsect->name = name;
return bfd_section_init (abfd, newsect);
}
/*
FUNCTION
- bfd_make_section
+ bfd_make_section_anyway
SYNOPSIS
- asection *bfd_make_section (bfd *, const char *name);
+ 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)
+{
+ return bfd_make_section_anyway_with_flags (abfd, name, 0);
+}
+
+/*
+FUNCTION
+ bfd_make_section_with_flags
+
+SYNOPSIS
+ asection *bfd_make_section_with_flags
+ (bfd *, const char *name, flagword flags);
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
+ section named @var{name}. Also set the attributes of the new section to
+ the value @var{flags}. If there is an error, return <<NULL>> and set
<<bfd_error>>.
*/
asection *
-bfd_make_section (bfd *abfd, const char *name)
+bfd_make_section_with_flags (bfd *abfd, const char *name,
+ flagword flags)
{
struct section_hash_entry *sh;
asection *newsect;
@@ -1002,11 +1134,32 @@ bfd_make_section (bfd *abfd, const char *name)
}
newsect->name = name;
+ newsect->flags = flags;
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)
+{
+ return bfd_make_section_with_flags (abfd, name, 0);
+}
+
+/*
+FUNCTION
bfd_set_section_flags
SYNOPSIS
@@ -1030,19 +1183,6 @@ 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;
}
@@ -1090,6 +1230,41 @@ bfd_map_over_sections (bfd *abfd,
/*
FUNCTION
+ bfd_sections_find_if
+
+SYNOPSIS
+ asection *bfd_sections_find_if
+ (bfd *abfd,
+ bfd_boolean (*operation) (bfd *abfd, asection *sect, void *obj),
+ void *obj);
+
+DESCRIPTION
+ Call the provided function @var{operation} for each section
+ attached to the BFD @var{abfd}, passing @var{obj} as an
+ argument. The function will be called as if by
+
+| operation (abfd, the_section, obj);
+
+ It returns the first section for which @var{operation} returns true.
+
+*/
+
+asection *
+bfd_sections_find_if (bfd *abfd,
+ bfd_boolean (*operation) (bfd *, asection *, void *),
+ void *user_storage)
+{
+ asection *sect;
+
+ for (sect = abfd->sections; sect != NULL; sect = sect->next)
+ if ((*operation) (abfd, sect, user_storage))
+ break;
+
+ return sect;
+}
+
+/*
+FUNCTION
bfd_set_section_size
SYNOPSIS
@@ -1118,9 +1293,7 @@ bfd_set_section_size (bfd *abfd, sec_ptr ptr, bfd_size_type val)
return FALSE;
}
- ptr->_cooked_size = val;
- ptr->_raw_size = val;
-
+ ptr->size = val;
return TRUE;
}
@@ -1151,11 +1324,6 @@ DESCRIPTION
*/
-#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,
@@ -1171,7 +1339,7 @@ bfd_set_section_contents (bfd *abfd,
return FALSE;
}
- sz = bfd_get_section_size_now (abfd, section);
+ sz = section->size;
if ((bfd_size_type) offset > sz
|| count > sz
|| offset + count > sz
@@ -1181,22 +1349,10 @@ bfd_set_section_contents (bfd *abfd,
return FALSE;
}
- switch (abfd->direction)
+ if (!bfd_write_p (abfd))
{
- 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. */
@@ -1251,9 +1407,7 @@ bfd_get_section_contents (bfd *abfd,
return TRUE;
}
- /* Even if reloc_done is TRUE, this function reads unrelocated
- contents, so we want the raw size. */
- sz = section->_raw_size;
+ sz = section->rawsize ? section->rawsize : section->size;
if ((bfd_size_type) offset > sz
|| count > sz
|| offset + count > sz
@@ -1285,6 +1439,36 @@ bfd_get_section_contents (bfd *abfd,
/*
FUNCTION
+ bfd_malloc_and_get_section
+
+SYNOPSIS
+ bfd_boolean bfd_malloc_and_get_section
+ (bfd *abfd, asection *section, bfd_byte **buf);
+
+DESCRIPTION
+ Read all data from @var{section} in BFD @var{abfd}
+ into a buffer, *@var{buf}, malloc'd by this function.
+*/
+
+bfd_boolean
+bfd_malloc_and_get_section (bfd *abfd, sec_ptr sec, bfd_byte **buf)
+{
+ bfd_size_type sz = sec->rawsize ? sec->rawsize : sec->size;
+ bfd_byte *p = NULL;
+
+ *buf = p;
+ if (sz == 0)
+ return TRUE;
+
+ p = bfd_malloc (sec->rawsize > sec->size ? sec->rawsize : sec->size);
+ if (p == NULL)
+ return FALSE;
+ *buf = p;
+
+ return bfd_get_section_contents (abfd, sec, p, 0, sz);
+}
+/*
+FUNCTION
bfd_copy_private_section_data
SYNOPSIS
@@ -1307,46 +1491,20 @@ DESCRIPTION
/*
FUNCTION
- _bfd_strip_section_from_output
+ bfd_generic_is_group_section
SYNOPSIS
- void _bfd_strip_section_from_output
- (struct bfd_link_info *info, asection *section);
+ bfd_boolean bfd_generic_is_group_section (bfd *, const asection *sec);
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.
+ Returns TRUE if @var{sec} is a member of a group.
*/
-void
-_bfd_strip_section_from_output (struct bfd_link_info *info, asection *s)
+
+bfd_boolean
+bfd_generic_is_group_section (bfd *abfd ATTRIBUTE_UNUSED,
+ const asection *sec ATTRIBUTE_UNUSED)
{
- 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;
+ return FALSE;
}
/*
diff --git a/contrib/binutils/bfd/simple.c b/contrib/binutils/bfd/simple.c
index fc2472e..8ebc47e 100644
--- a/contrib/binutils/bfd/simple.c
+++ b/contrib/binutils/bfd/simple.c
@@ -1,5 +1,5 @@
/* simple.c -- BFD simple client routines
- Copyright 2002, 2003, 2004
+ Copyright 2002, 2003, 2004, 2005, 2007
Free Software Foundation, Inc.
Contributed by MontaVista Software, Inc.
@@ -17,10 +17,10 @@
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. */
+ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
#include "bfdlink.h"
@@ -48,6 +48,7 @@ simple_dummy_undefined_symbol (struct bfd_link_info *link_info ATTRIBUTE_UNUSED,
static bfd_boolean
simple_dummy_reloc_overflow (struct bfd_link_info *link_info ATTRIBUTE_UNUSED,
+ struct bfd_link_hash_entry *entry ATTRIBUTE_UNUSED,
const char *name ATTRIBUTE_UNUSED,
const char *reloc_name ATTRIBUTE_UNUSED,
bfd_vma addend ATTRIBUTE_UNUSED,
@@ -78,6 +79,24 @@ simple_dummy_unattached_reloc (struct bfd_link_info *link_info ATTRIBUTE_UNUSED,
return TRUE;
}
+static bfd_boolean
+simple_dummy_multiple_definition (struct bfd_link_info *link_info ATTRIBUTE_UNUSED,
+ const char *name ATTRIBUTE_UNUSED,
+ bfd *obfd ATTRIBUTE_UNUSED,
+ asection *osec ATTRIBUTE_UNUSED,
+ bfd_vma oval ATTRIBUTE_UNUSED,
+ bfd *nbfd ATTRIBUTE_UNUSED,
+ asection *nsec ATTRIBUTE_UNUSED,
+ bfd_vma nval ATTRIBUTE_UNUSED)
+{
+ return TRUE;
+}
+
+static void
+simple_dummy_einfo (const char *fmt ATTRIBUTE_UNUSED, ...)
+{
+}
+
struct saved_output_info
{
bfd_vma offset;
@@ -92,8 +111,12 @@ simple_save_output_info (bfd *abfd ATTRIBUTE_UNUSED,
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;
+ if ((section->flags & SEC_DEBUGGING) != 0
+ || section->output_section == NULL)
+ {
+ section->output_offset = 0;
+ section->output_section = section;
+ }
}
static void
@@ -117,13 +140,10 @@ SYNOPSIS
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
+ @var{symbol_table} is NULL. The output offsets for debug 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.
*/
@@ -140,14 +160,14 @@ bfd_simple_get_relocated_section_contents (bfd *abfd,
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);
+ bfd_size_type amt = sec->rawsize > sec->size ? sec->rawsize : sec->size;
+ bfd_size_type size = sec->rawsize ? sec->rawsize : sec->size;
if (outbuf == NULL)
- contents = bfd_malloc (size);
+ contents = bfd_malloc (amt);
else
contents = outbuf;
@@ -163,6 +183,7 @@ bfd_simple_get_relocated_section_contents (bfd *abfd,
/* 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.input_bfds_tail = &abfd->link_next;
link_info.hash = _bfd_generic_link_hash_table_create (abfd);
link_info.callbacks = &callbacks;
@@ -171,18 +192,20 @@ bfd_simple_get_relocated_section_contents (bfd *abfd,
callbacks.reloc_overflow = simple_dummy_reloc_overflow;
callbacks.reloc_dangerous = simple_dummy_reloc_dangerous;
callbacks.unattached_reloc = simple_dummy_unattached_reloc;
+ callbacks.multiple_definition = simple_dummy_multiple_definition;
+ callbacks.einfo = simple_dummy_einfo;
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.size = sec->size;
link_order.u.indirect.section = sec;
data = NULL;
if (outbuf == NULL)
{
- data = bfd_malloc (bfd_section_size (abfd, sec));
+ data = bfd_malloc (sec->size);
if (data == NULL)
return NULL;
outbuf = data;
@@ -218,12 +241,6 @@ bfd_simple_get_relocated_section_contents (bfd *abfd,
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,
@@ -233,25 +250,9 @@ bfd_simple_get_relocated_section_contents (bfd *abfd,
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
index ecaaa0f..445a66c 100644
--- a/contrib/binutils/bfd/sparclinux.c
+++ b/contrib/binutils/bfd/sparclinux.c
@@ -1,23 +1,23 @@
/* 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.
+ Copyright 1992, 1993, 1994, 1995, 1996, 1997, 1999, 2000, 2001, 2002,
+ 2003, 2004, 2006, 2007 Free Software Foundation, Inc.
-This file is part of BFD, the Binary File Descriptor library.
+ 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 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.
+ 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. */
+ 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., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301,
+ USA. */
#define TARGET_PAGE_SIZE 4096
#define ZMAGIC_DISK_BLOCK_SIZE 1024
@@ -27,8 +27,8 @@ USA. */
#define MACHTYPE_OK(mtype) ((mtype) == M_SPARC || (mtype) == M_UNKNOWN)
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
#include "aout/aout64.h"
#include "aout/stab_gnu.h"
@@ -94,8 +94,7 @@ sparclinux_write_object_contents (abfd)
#define GOT_REF_PREFIX "__GOT_"
#endif
-#define IS_GOT_SYM(name) \
- (strncmp (name, GOT_REF_PREFIX, sizeof GOT_REF_PREFIX - 1) == 0)
+#define IS_GOT_SYM(name) (CONST_STRNEQ (name, GOT_REF_PREFIX))
/* See if a symbol name is a reference to the procedure linkage table. */
@@ -103,8 +102,7 @@ sparclinux_write_object_contents (abfd)
#define PLT_REF_PREFIX "__PLT_"
#endif
-#define IS_PLT_SYM(name) \
- (strncmp (name, PLT_REF_PREFIX, sizeof PLT_REF_PREFIX - 1) == 0)
+#define IS_PLT_SYM(name) (CONST_STRNEQ (name, PLT_REF_PREFIX))
/* This string is used to generate specialized error messages. */
@@ -232,8 +230,9 @@ linux_link_hash_table_create (abfd)
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))
+ if (!NAME(aout,link_hash_table_init) (&ret->root, abfd,
+ linux_link_hash_newfunc,
+ sizeof (struct linux_link_hash_entry)))
{
free (ret);
return (struct bfd_link_hash_table *) NULL;
@@ -312,12 +311,11 @@ linux_link_create_dynamic_sections (abfd, info)
/* We choose to use the name ".linux-dynamic" for the fixup table.
Why not? */
- s = bfd_make_section (abfd, ".linux-dynamic");
+ s = bfd_make_section_with_flags (abfd, ".linux-dynamic", flags);
if (s == NULL
- || ! bfd_set_section_flags (abfd, s, flags)
|| ! bfd_set_section_alignment (abfd, s, 2))
return FALSE;
- s->_raw_size = 0;
+ s->size = 0;
s->contents = 0;
return TRUE;
@@ -428,9 +426,7 @@ linux_add_one_symbol (info, abfd, name, flags, section, value, string,
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;
+linux_tally_symbols (struct linux_link_hash_entry *h, void * data)
{
struct bfd_link_info *info = (struct bfd_link_info *) data;
struct fixup *f, *f1;
@@ -442,8 +438,7 @@ linux_tally_symbols (h, data)
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_STRNEQ (h->root.root.root.string, NEEDS_SHRLIB))
{
const char *name;
char *p;
@@ -596,9 +591,9 @@ bfd_sparclinux_size_dynamic_sections (output_bfd, info)
".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);
+ s->size = linux_hash_table (info)->fixup_count + 1;
+ s->size *= 8;
+ s->contents = (bfd_byte *) bfd_zalloc (output_bfd, s->size);
if (s->contents == NULL)
return FALSE;
}
@@ -763,7 +758,7 @@ linux_finish_dynamic_link (output_bfd, info)
SEEK_SET) != 0)
return FALSE;
- if (bfd_bwrite ((PTR) s->contents, s->_raw_size, output_bfd) != s->_raw_size)
+ if (bfd_bwrite ((PTR) s->contents, s->size, output_bfd) != s->size)
return FALSE;
return TRUE;
diff --git a/contrib/binutils/bfd/sparcnetbsd.c b/contrib/binutils/bfd/sparcnetbsd.c
index be8e536..ac00018 100644
--- a/contrib/binutils/bfd/sparcnetbsd.c
+++ b/contrib/binutils/bfd/sparcnetbsd.c
@@ -16,7 +16,7 @@ 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. */
+Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
#define TARGET_IS_BIG_ENDIAN_P
diff --git a/contrib/binutils/bfd/srec.c b/contrib/binutils/bfd/srec.c
index c0a3d58..354a6ee 100644
--- a/contrib/binutils/bfd/srec.c
+++ b/contrib/binutils/bfd/srec.c
@@ -1,30 +1,29 @@
/* BFD back-end for s-record objects.
Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
- 2000, 2001, 2002, 2003
+ 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
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 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 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.
+ 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. */
+ 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., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
-/*
-SUBSECTION
+/* SUBSECTION
S-Record handling
-DESCRIPTION
+ DESCRIPTION
Ordinary S-Records cannot hold anything but addresses and
data, so that's all that we implement.
@@ -44,10 +43,10 @@ DESCRIPTION
An s record looks like:
-EXAMPLE
+ EXAMPLE
S<type><length><address><data><checksum>
-DESCRIPTION
+ DESCRIPTION
Where
o length
is the number of bytes following upto the checksum. Note that
@@ -72,10 +71,10 @@ DESCRIPTION
is the sum of all the raw byte data in the record, from the length
upwards, modulo 256 and subtracted from 255.
-SUBSECTION
+ SUBSECTION
Symbol S-Record handling
-DESCRIPTION
+ DESCRIPTION
Some ICE equipment understands an addition to the standard
S-Record format; symbols and their addresses can be sent
before the data.
@@ -87,7 +86,7 @@ DESCRIPTION
so a short symbol table could look like:
-EXAMPLE
+ EXAMPLE
$$ flash.x
$$ flash.c
_port6 $0
@@ -98,73 +97,28 @@ EXAMPLE
_end $8036
$$
-DESCRIPTION
+ DESCRIPTION
We allow symbols to be anywhere in the data stream - the module names
- are always ignored.
+ are always ignored. */
-*/
-
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.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 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 ();
- }
-}
+#define ISHEX(x) hex_p(x)
/* The maximum number of address+data+crc bytes on a line is FF. */
#define MAXCHUNK 0xff
@@ -219,24 +173,30 @@ typedef struct srec_data_struct
}
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 *));
+/* Initialize by filling in the hex conversion array. */
+
+static void
+srec_init (void)
+{
+ static bfd_boolean inited = FALSE;
+
+ if (! inited)
+ {
+ inited = TRUE;
+ hex_init ();
+ }
+}
/* Set up the S-record tdata information. */
static bfd_boolean
-srec_mkobject (abfd)
- bfd *abfd;
+srec_mkobject (bfd *abfd)
{
- bfd_size_type amt;
tdata_type *tdata;
srec_init ();
- amt = sizeof (tdata_type);
- tdata = (tdata_type *) bfd_alloc (abfd, amt);
+ tdata = bfd_alloc (abfd, sizeof (tdata_type));
if (tdata == NULL)
return FALSE;
@@ -255,9 +215,7 @@ srec_mkobject (abfd)
occurred. Return EOF on error or end of file. */
static int
-srec_get_byte (abfd, errorptr)
- bfd *abfd;
- bfd_boolean *errorptr;
+srec_get_byte (bfd *abfd, bfd_boolean *errorptr)
{
bfd_byte c;
@@ -276,11 +234,10 @@ srec_get_byte (abfd, errorptr)
error messages. */
static void
-srec_bad_byte (abfd, lineno, c, error)
- bfd *abfd;
- unsigned int lineno;
- int c;
- bfd_boolean error;
+srec_bad_byte (bfd *abfd,
+ unsigned int lineno,
+ int c,
+ bfd_boolean error)
{
if (c == EOF)
{
@@ -299,8 +256,8 @@ srec_bad_byte (abfd, lineno, c, error)
buf[1] = '\0';
}
(*_bfd_error_handler)
- (_("%s:%d: Unexpected character `%s' in S-record file\n"),
- bfd_archive_filename (abfd), lineno, buf);
+ (_("%B:%d: Unexpected character `%s' in S-record file\n"),
+ abfd, lineno, buf);
bfd_set_error (bfd_error_bad_value);
}
}
@@ -308,15 +265,11 @@ srec_bad_byte (abfd, lineno, c, error)
/* 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;
+srec_new_symbol (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);
+ n = bfd_alloc (abfd, sizeof (* n));
if (n == NULL)
return FALSE;
@@ -339,8 +292,7 @@ srec_new_symbol (abfd, name, val)
section for each contiguous set of bytes. */
static bfd_boolean
-srec_scan (abfd)
- bfd *abfd;
+srec_scan (bfd *abfd)
{
int c;
unsigned int lineno = 1;
@@ -385,7 +337,6 @@ srec_scan (abfd)
}
++lineno;
-
break;
case ' ':
@@ -410,7 +361,7 @@ srec_scan (abfd)
}
alc = 10;
- symbuf = (char *) bfd_malloc (alc + 1);
+ symbuf = bfd_malloc (alc + 1);
if (symbuf == NULL)
goto error_return;
@@ -425,7 +376,7 @@ srec_scan (abfd)
char *n;
alc *= 2;
- n = (char *) bfd_realloc (symbuf, alc + 1);
+ n = bfd_realloc (symbuf, alc + 1);
if (n == NULL)
goto error_return;
p = n + (p - symbuf);
@@ -523,7 +474,7 @@ srec_scan (abfd)
{
if (buf != NULL)
free (buf);
- buf = (bfd_byte *) bfd_malloc ((bfd_size_type) bytes * 2);
+ buf = bfd_malloc ((bfd_size_type) bytes * 2);
if (buf == NULL)
goto error_return;
bufsize = bytes * 2;
@@ -564,32 +515,32 @@ srec_scan (abfd)
bytes -= 2;
if (sec != NULL
- && sec->vma + sec->_raw_size == address)
+ && sec->vma + sec->size == address)
{
/* This data goes at the end of the section we are
currently building. */
- sec->_raw_size += bytes;
+ sec->size += bytes;
}
else
{
char secbuf[20];
char *secname;
bfd_size_type amt;
+ flagword flags;
sprintf (secbuf, ".sec%d", bfd_count_sections (abfd) + 1);
amt = strlen (secbuf) + 1;
- secname = (char *) bfd_alloc (abfd, amt);
+ secname = bfd_alloc (abfd, amt);
strcpy (secname, secbuf);
- sec = bfd_make_section (abfd, secname);
+ flags = SEC_HAS_CONTENTS | SEC_LOAD | SEC_ALLOC;
+ sec = bfd_make_section_with_flags (abfd, secname, flags);
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->size = bytes;
sec->filepos = pos;
}
-
break;
case '7':
@@ -638,10 +589,9 @@ srec_scan (abfd)
/* Check whether an existing file is an S-record file. */
static const bfd_target *
-srec_object_p (abfd)
- bfd *abfd;
+srec_object_p (bfd *abfd)
{
- PTR tdata_save;
+ void * tdata_save;
bfd_byte b[4];
srec_init ();
@@ -674,10 +624,9 @@ srec_object_p (abfd)
/* Check whether an existing file is an S-record file with symbols. */
static const bfd_target *
-symbolsrec_object_p (abfd)
- bfd *abfd;
+symbolsrec_object_p (bfd *abfd)
{
- PTR tdata_save;
+ void * tdata_save;
char b[2];
srec_init ();
@@ -710,10 +659,7 @@ symbolsrec_object_p (abfd)
/* 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;
+srec_read_section (bfd *abfd, asection *section, bfd_byte *contents)
{
int c;
bfd_size_type sofar = 0;
@@ -749,7 +695,7 @@ srec_read_section (abfd, section, contents)
{
if (buf != NULL)
free (buf);
- buf = (bfd_byte *) bfd_malloc ((bfd_size_type) bytes * 2);
+ buf = bfd_malloc ((bfd_size_type) bytes * 2);
if (buf == NULL)
goto error_return;
bufsize = bytes * 2;
@@ -763,7 +709,7 @@ srec_read_section (abfd, section, contents)
switch (hdr[0])
{
default:
- BFD_ASSERT (sofar == section->_raw_size);
+ BFD_ASSERT (sofar == section->size);
if (buf != NULL)
free (buf);
return TRUE;
@@ -788,7 +734,7 @@ srec_read_section (abfd, section, contents)
if (address != section->vma + sofar)
{
/* We've come to the end of this section. */
- BFD_ASSERT (sofar == section->_raw_size);
+ BFD_ASSERT (sofar == section->size);
if (buf != NULL)
free (buf);
return TRUE;
@@ -811,7 +757,7 @@ srec_read_section (abfd, section, contents)
if (error)
goto error_return;
- BFD_ASSERT (sofar == section->_raw_size);
+ BFD_ASSERT (sofar == section->size);
if (buf != NULL)
free (buf);
@@ -827,17 +773,16 @@ srec_read_section (abfd, section, contents)
/* 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;
+srec_get_section_contents (bfd *abfd,
+ asection *section,
+ void * 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)
+ section->used_by_bfd = bfd_alloc (abfd, section->size);
+ if (section->used_by_bfd == NULL && section->size != 0)
return FALSE;
if (! srec_read_section (abfd, section, section->used_by_bfd))
@@ -853,34 +798,28 @@ srec_get_section_contents (abfd, section, location, offset, count)
/* 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;
+srec_set_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);
+ if (arch != bfd_arch_unknown)
+ return bfd_default_set_arch_mach (abfd, arch, mach);
+
+ abfd->arch_info = & bfd_default_arch_struct;
+ return TRUE;
}
/* 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;
+srec_set_section_contents (bfd *abfd,
+ sec_ptr section,
+ const void * location,
+ file_ptr offset,
+ bfd_size_type bytes_to_do)
{
tdata_type *tdata = abfd->tdata.srec_data;
- register srec_data_list_type *entry;
+ srec_data_list_type *entry;
- entry = ((srec_data_list_type *)
- bfd_alloc (abfd, (bfd_size_type) sizeof (srec_data_list_type)));
+ entry = bfd_alloc (abfd, sizeof (* entry));
if (entry == NULL)
return FALSE;
@@ -890,10 +829,10 @@ srec_set_section_contents (abfd, section, location, offset, bytes_to_do)
{
bfd_byte *data;
- data = (bfd_byte *) bfd_alloc (abfd, bytes_to_do);
+ data = bfd_alloc (abfd, bytes_to_do);
if (data == NULL)
return FALSE;
- memcpy ((PTR) data, location, (size_t) bytes_to_do);
+ memcpy ((void *) data, location, (size_t) bytes_to_do);
/* Ff S3Forced is TRUE then always select S3 records,
regardless of the siez of the addresses. */
@@ -922,7 +861,7 @@ srec_set_section_contents (abfd, section, location, offset, bytes_to_do)
}
else
{
- register srec_data_list_type **look;
+ srec_data_list_type **look;
for (look = &tdata->head;
*look != NULL && (*look)->where < entry->where;
@@ -942,12 +881,11 @@ srec_set_section_contents (abfd, section, location, offset, bytes_to_do)
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;
+srec_write_record (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;
@@ -998,14 +936,12 @@ srec_write_record (abfd, type, address, data, end)
*dst++ = '\r';
*dst++ = '\n';
wrlen = dst - buffer;
- if (bfd_bwrite ((PTR) buffer, wrlen, abfd) != wrlen)
- return FALSE;
- return TRUE;
+
+ return bfd_bwrite ((void *) buffer, wrlen, abfd) == wrlen;
}
static bfd_boolean
-srec_write_header (abfd)
- bfd *abfd;
+srec_write_header (bfd *abfd)
{
unsigned int len = strlen (abfd->filename);
@@ -1014,14 +950,14 @@ srec_write_header (abfd)
len = 40;
return srec_write_record (abfd, 0, (bfd_vma) 0,
- abfd->filename, abfd->filename + len);
+ (bfd_byte *) abfd->filename,
+ (bfd_byte *) abfd->filename + len);
}
static bfd_boolean
-srec_write_section (abfd, tdata, list)
- bfd *abfd;
- tdata_type *tdata;
- srec_data_list_type *list;
+srec_write_section (bfd *abfd,
+ tdata_type *tdata,
+ srec_data_list_type *list)
{
unsigned int octets_written = 0;
bfd_byte *location = list->data;
@@ -1062,17 +998,14 @@ srec_write_section (abfd, tdata, list)
}
static bfd_boolean
-srec_write_terminator (abfd, tdata)
- bfd *abfd;
- tdata_type *tdata;
+srec_write_terminator (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;
+srec_write_symbols (bfd *abfd)
{
/* Dump out the symbols of a bfd. */
int i;
@@ -1082,6 +1015,7 @@ srec_write_symbols (abfd)
{
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
@@ -1126,9 +1060,7 @@ srec_write_symbols (abfd)
}
static bfd_boolean
-internal_srec_write_object_contents (abfd, symbols)
- bfd *abfd;
- int symbols;
+internal_srec_write_object_contents (bfd *abfd, int symbols)
{
tdata_type *tdata = abfd->tdata.srec_data;
srec_data_list_type *list;
@@ -1155,23 +1087,20 @@ internal_srec_write_object_contents (abfd, symbols)
}
static bfd_boolean
-srec_write_object_contents (abfd)
- bfd *abfd;
+srec_write_object_contents (bfd *abfd)
{
return internal_srec_write_object_contents (abfd, 0);
}
static bfd_boolean
-symbolsrec_write_object_contents (abfd)
- bfd *abfd;
+symbolsrec_write_object_contents (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;
+srec_sizeof_headers (bfd *abfd ATTRIBUTE_UNUSED,
+ struct bfd_link_info *info ATTRIBUTE_UNUSED)
{
return 0;
}
@@ -1179,8 +1108,7 @@ srec_sizeof_headers (abfd, exec)
/* Return the amount of memory needed to read the symbol table. */
static long
-srec_get_symtab_upper_bound (abfd)
- bfd *abfd;
+srec_get_symtab_upper_bound (bfd *abfd)
{
return (bfd_get_symcount (abfd) + 1) * sizeof (asymbol *);
}
@@ -1188,9 +1116,7 @@ srec_get_symtab_upper_bound (abfd)
/* Return the symbol table. */
static long
-srec_canonicalize_symtab (abfd, alocation)
- bfd *abfd;
- asymbol **alocation;
+srec_canonicalize_symtab (bfd *abfd, asymbol **alocation)
{
bfd_size_type symcount = bfd_get_symcount (abfd);
asymbol *csymbols;
@@ -1202,7 +1128,7 @@ srec_canonicalize_symtab (abfd, alocation)
asymbol *c;
struct srec_symbol *s;
- csymbols = (asymbol *) bfd_alloc (abfd, symcount * sizeof (asymbol));
+ csymbols = bfd_alloc (abfd, symcount * sizeof (asymbol));
if (csymbols == NULL && symcount != 0)
return 0;
abfd->tdata.srec_data->csymbols = csymbols;
@@ -1228,94 +1154,85 @@ srec_canonicalize_symtab (abfd, alocation)
}
static void
-srec_get_symbol_info (ignore_abfd, symbol, ret)
- bfd *ignore_abfd ATTRIBUTE_UNUSED;
- asymbol *symbol;
- symbol_info *ret;
+srec_get_symbol_info (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;
+srec_print_symbol (bfd *abfd,
+ void * 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);
+ bfd_print_symbol_vandf (abfd, (void *) 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
+#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_target_special_symbol ((bfd_boolean (*) (bfd *, asymbol *)) bfd_false)
+#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_find_inliner_info _bfd_nosymbols_find_inliner_info
+#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_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_is_group_section bfd_generic_is_group_section
+#define srec_bfd_discard_group bfd_generic_discard_group
+#define srec_section_already_linked _bfd_generic_section_already_linked
+#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 */
+ "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 */
+ 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 */
+ | 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_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_getb16, bfd_getb_signed_16, bfd_putb16, /* Hdrs. */
{
_bfd_dummy_target,
- srec_object_p, /* bfd_check_format */
+ srec_object_p, /* bfd_check_format. */
_bfd_dummy_target,
_bfd_dummy_target,
},
@@ -1325,7 +1242,7 @@ const bfd_target srec_vec =
_bfd_generic_mkarchive,
bfd_false,
},
- { /* bfd_write_contents */
+ { /* bfd_write_contents. */
bfd_false,
srec_write_object_contents,
_bfd_write_archive_contents,
@@ -1337,40 +1254,40 @@ const bfd_target srec_vec =
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_RELOCS (_bfd_norelocs),
BFD_JUMP_TABLE_WRITE (srec),
BFD_JUMP_TABLE_LINK (srec),
BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
NULL,
- (PTR) 0
+ NULL
};
const bfd_target symbolsrec_vec =
{
- "symbolsrec", /* name */
+ "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 */
+ 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 */
+ | 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_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_getb16, bfd_getb_signed_16, bfd_putb16, /* Headers. */
{
_bfd_dummy_target,
- symbolsrec_object_p, /* bfd_check_format */
+ symbolsrec_object_p, /* bfd_check_format. */
_bfd_dummy_target,
_bfd_dummy_target,
},
@@ -1380,7 +1297,7 @@ const bfd_target symbolsrec_vec =
_bfd_generic_mkarchive,
bfd_false,
},
- { /* bfd_write_contents */
+ { /* bfd_write_contents. */
bfd_false,
symbolsrec_write_object_contents,
_bfd_write_archive_contents,
@@ -1392,12 +1309,12 @@ const bfd_target symbolsrec_vec =
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_RELOCS (_bfd_norelocs),
BFD_JUMP_TABLE_WRITE (srec),
BFD_JUMP_TABLE_LINK (srec),
BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
NULL,
- (PTR) 0
+ NULL
};
diff --git a/contrib/binutils/bfd/stab-syms.c b/contrib/binutils/bfd/stab-syms.c
index a685e31..c577e1f 100644
--- a/contrib/binutils/bfd/stab-syms.c
+++ b/contrib/binutils/bfd/stab-syms.c
@@ -17,7 +17,7 @@ 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. */
+Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
#include "bfd.h"
diff --git a/contrib/binutils/bfd/stabs.c b/contrib/binutils/bfd/stabs.c
index 04b91f6..1192cd1 100644
--- a/contrib/binutils/bfd/stabs.c
+++ b/contrib/binutils/bfd/stabs.c
@@ -1,6 +1,6 @@
/* Stabs in sections linking support.
- Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004
- Free Software Foundation, Inc.
+ Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
+ 2006, 2007 Free Software Foundation, Inc.
Written by Ian Lance Taylor, Cygnus Support.
This file is part of BFD, the Binary File Descriptor library.
@@ -17,13 +17,13 @@
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. */
+ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
/* This file contains support for linking stabs in sections, as used
on COFF and ELF. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
#include "aout/stab_gnu.h"
#include "safe-ctype.h"
@@ -41,19 +41,12 @@
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;
-};
+#define STRDXOFF 0
+#define TYPEOFF 4
+#define OTHEROFF 5
+#define DESCOFF 6
+#define VALOFF 8
+#define STABSIZE 12
/* 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
@@ -80,12 +73,6 @@ struct stab_link_includes_entry
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. */
@@ -124,50 +111,31 @@ struct stab_section_info
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;
+stab_link_includes_newfunc (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;
+ if (ret == NULL)
+ ret = bfd_hash_allocate (table,
+ sizeof (struct stab_link_includes_entry));
+ if (ret == NULL)
+ return NULL;
/* 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;
- }
+ /* Set local fields. */
+ ret->totals = NULL;
return (struct bfd_hash_entry *) ret;
}
@@ -176,16 +144,14 @@ stab_link_includes_newfunc (entry, table, string)
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_link_section_stabs (bfd *abfd,
+ struct stab_info *sinfo,
+ asection *stabsec,
+ asection *stabstrsec,
+ void * *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;
@@ -194,67 +160,55 @@ _bfd_link_section_stabs (abfd, psinfo, stabsec, stabstrsec, psecinfo, pstring_of
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->size == 0
+ || stabstrsec->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 (stabsec->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;
- }
+ /* 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;
- }
+ if (bfd_is_abs_section (stabsec->output_section)
+ || 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)
+ if (sinfo->stabstr == NULL)
{
+ flagword flags;
+
/* 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))
+ if (! bfd_hash_table_init (&sinfo->includes,
+ stab_link_includes_newfunc,
+ sizeof (struct stab_link_includes_entry)))
+ goto error_return;
+ flags = (SEC_HAS_CONTENTS | SEC_READONLY | SEC_DEBUGGING
+ | SEC_LINKER_CREATED);
+ sinfo->stabstr = bfd_make_section_anyway_with_flags (abfd, ".stabstr",
+ flags);
+ if (sinfo->stabstr == NULL)
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;
+ count = stabsec->size / STABSIZE;
amt = sizeof (struct stab_section_info);
amt += (count - 1) * sizeof (bfd_size_type);
@@ -264,25 +218,17 @@ _bfd_link_section_stabs (abfd, psinfo, stabsec, stabstrsec, psecinfo, pstring_of
secinfo = (struct stab_section_info *) *psecinfo;
secinfo->excls = NULL;
+ stabsec->rawsize = stabsec->size;
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))
+ if (!bfd_malloc_and_get_section (abfd, stabsec, &stabbuf)
+ || !bfd_malloc_and_get_section (abfd, stabstrsec, &stabstrbuf))
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
@@ -291,7 +237,7 @@ _bfd_link_section_stabs (abfd, psinfo, stabsec, stabstrsec, psecinfo, pstring_of
next_stroff = pstring_offset ? *pstring_offset : 0;
skip = 0;
- symend = stabbuf + stabsec->_raw_size;
+ symend = stabbuf + stabsec->size;
for (sym = stabbuf, pstridx = secinfo->stridxs;
sym < symend;
sym += STABSIZE, ++pstridx)
@@ -301,10 +247,8 @@ _bfd_link_section_stabs (abfd, psinfo, stabsec, stabstrsec, psecinfo, pstring_of
const char *string;
if (*pstridx != 0)
- {
- /* This symbol has already been handled by an N_BINCL pass. */
- continue;
- }
+ /* This symbol has already been handled by an N_BINCL pass. */
+ continue;
type = sym[TYPEOFF];
@@ -327,13 +271,11 @@ _bfd_link_section_stabs (abfd, psinfo, stabsec, stabstrsec, psecinfo, pstring_of
/* Store the string in the hash table, and record the index. */
symstroff = stroff + bfd_get_32 (abfd, sym + STRDXOFF);
- if (symstroff >= stabstrsec->_raw_size)
+ if (symstroff >= stabstrsec->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));
+ (_("%B(%A+0x%lx): Stabs entry has invalid string index."),
+ abfd, stabsec, (long) (sym - stabbuf));
bfd_set_error (bfd_error_bad_value);
goto error_return;
}
@@ -417,8 +359,8 @@ _bfd_link_section_stabs (abfd, psinfo, stabsec, stabstrsec, psecinfo, pstring_of
/* 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);
+ incl_entry = (struct stab_link_includes_entry * )
+ bfd_hash_lookup (&sinfo->includes, string, TRUE, TRUE);
if (incl_entry == NULL)
goto error_return;
@@ -431,7 +373,7 @@ _bfd_link_section_stabs (abfd, psinfo, stabsec, stabstrsec, psecinfo, pstring_of
/* Record this symbol, so that we can set the value
correctly. */
amt = sizeof *ne;
- ne = (struct stab_excl_list *) bfd_alloc (abfd, amt);
+ ne = bfd_alloc (abfd, amt);
if (ne == NULL)
goto error_return;
ne->offset = sym - stabbuf;
@@ -444,8 +386,7 @@ _bfd_link_section_stabs (abfd, psinfo, stabsec, stabstrsec, psecinfo, pstring_of
{
/* 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));
+ t = bfd_hash_allocate (&sinfo->includes, sizeof *t);
if (t == NULL)
goto error_return;
t->sum_chars = sum_chars;
@@ -490,7 +431,7 @@ _bfd_link_section_stabs (abfd, psinfo, stabsec, stabstrsec, psecinfo, pstring_of
++nest;
else if (incl_type == (int) N_EXCL)
/* Keep existing exclusion marks. */
- continue;
+ continue;
else if (nest == 0)
{
*incl_pstridx = (bfd_size_type) -1;
@@ -513,11 +454,11 @@ _bfd_link_section_stabs (abfd, psinfo, stabsec, stabstrsec, psecinfo, pstring_of
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);
+ stabsec->size = (count - skip) * STABSIZE;
+ if (stabsec->size == 0)
+ stabsec->flags |= SEC_EXCLUDE | SEC_KEEP;
+ stabstrsec->flags |= SEC_EXCLUDE | SEC_KEEP;
+ sinfo->stabstr->size = _bfd_stringtab_size (sinfo->strings);
/* Calculate the `cumulative_skips' array now that stabs have been
deleted for this section. */
@@ -528,7 +469,7 @@ _bfd_link_section_stabs (abfd, psinfo, stabsec, stabstrsec, psecinfo, pstring_of
bfd_size_type *pskips;
amt = count * sizeof (bfd_size_type);
- secinfo->cumulative_skips = (bfd_size_type *) bfd_alloc (abfd, amt);
+ secinfo->cumulative_skips = bfd_alloc (abfd, amt);
if (secinfo->cumulative_skips == NULL)
goto error_return;
@@ -555,7 +496,6 @@ _bfd_link_section_stabs (abfd, psinfo, stabsec, stabstrsec, psecinfo, pstring_of
free (stabstrbuf);
return FALSE;
}
-
/* This function is called for each input file before the stab
section is relocated. It discards stab entries for discarded
@@ -564,13 +504,11 @@ _bfd_link_section_stabs (abfd, psinfo, stabsec, stabstrsec, psecinfo, pstring_of
*/
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_discard_section_stabs (bfd *abfd,
+ asection *stabsec,
+ void * psecinfo,
+ bfd_boolean (*reloc_symbol_deleted_p) (bfd_vma, void *),
+ void * cookie)
{
bfd_size_type count, amt;
struct stab_section_info *secinfo;
@@ -580,26 +518,20 @@ _bfd_discard_section_stabs (abfd, stabsec, psecinfo,
bfd_size_type *pstridx;
int deleting;
- if (stabsec->_raw_size == 0)
- {
- /* This file does not contain stabs debugging information. */
- return FALSE;
- }
+ if (stabsec->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->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;
- }
+ /* 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,
@@ -607,26 +539,19 @@ _bfd_discard_section_stabs (abfd, stabsec, psecinfo,
if (psecinfo == NULL)
return FALSE;
- count = stabsec->_raw_size / STABSIZE;
+ count = stabsec->rawsize / 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))
+ if (!bfd_malloc_and_get_section (abfd, stabsec, &stabbuf))
goto error_return;
/* Look through the stabs symbols and discard any information for
discarded functions. */
-
skip = 0;
deleting = -1;
- symend = stabbuf + stabsec->_raw_size;
+ symend = stabbuf + stabsec->rawsize;
for (sym = stabbuf, pstridx = secinfo->stridxs;
sym < symend;
sym += STABSIZE, ++pstridx)
@@ -634,10 +559,8 @@ _bfd_discard_section_stabs (abfd, stabsec, psecinfo,
int type;
if (*pstridx == (bfd_size_type) -1)
- {
- /* This stab was deleted in a previous pass. */
- continue;
- }
+ /* This stab was deleted in a previous pass. */
+ continue;
type = sym[TYPEOFF];
@@ -684,9 +607,9 @@ _bfd_discard_section_stabs (abfd, stabsec, psecinfo,
stabbuf = NULL;
/* Shrink the stabsec as needed. */
- stabsec->_cooked_size -= skip * STABSIZE;
- if (stabsec->_cooked_size == 0)
- stabsec->flags |= SEC_EXCLUDE;
+ stabsec->size -= skip * STABSIZE;
+ if (stabsec->size == 0)
+ stabsec->flags |= SEC_EXCLUDE | SEC_KEEP;
/* Recalculate the `cumulative_skips' array now that stabs have been
deleted for this section. */
@@ -699,7 +622,7 @@ _bfd_discard_section_stabs (abfd, stabsec, psecinfo,
if (secinfo->cumulative_skips == NULL)
{
amt = count * sizeof (bfd_size_type);
- secinfo->cumulative_skips = (bfd_size_type *) bfd_alloc (abfd, amt);
+ secinfo->cumulative_skips = bfd_alloc (abfd, amt);
if (secinfo->cumulative_skips == NULL)
goto error_return;
}
@@ -730,34 +653,30 @@ _bfd_discard_section_stabs (abfd, stabsec, psecinfo,
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;
+_bfd_write_section_stabs (bfd *output_bfd,
+ struct stab_info *sinfo,
+ asection *stabsec,
+ void * *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);
+ contents, stabsec->output_offset,
+ stabsec->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);
+ BFD_ASSERT (e->offset < stabsec->rawsize);
excl_sym = contents + e->offset;
bfd_put_32 (output_bfd, e->val, excl_sym + VALOFF);
excl_sym[TYPEOFF] = e->type;
@@ -766,7 +685,7 @@ _bfd_write_section_stabs (output_bfd, psinfo, stabsec, psecinfo, contents)
/* 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;
+ symend = contents + stabsec->rawsize;
for (sym = contents, pstridx = secinfo->stridxs;
sym < symend;
sym += STABSIZE, ++pstridx)
@@ -787,7 +706,7 @@ _bfd_write_section_stabs (output_bfd, psinfo, stabsec, psecinfo, 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,
+ stabsec->output_section->size / STABSIZE - 1,
tosym + DESCOFF);
}
@@ -795,36 +714,25 @@ _bfd_write_section_stabs (output_bfd, psinfo, stabsec, psecinfo, contents)
}
}
- BFD_ASSERT ((bfd_size_type) (tosym - contents) == stabsec->_cooked_size);
+ BFD_ASSERT ((bfd_size_type) (tosym - contents) == stabsec->size);
return bfd_set_section_contents (output_bfd, stabsec->output_section,
contents, (file_ptr) stabsec->output_offset,
- stabsec->_cooked_size);
+ stabsec->size);
}
/* Write out the .stabstr section. */
bfd_boolean
-_bfd_write_stab_strings (output_bfd, psinfo)
- bfd *output_bfd;
- PTR *psinfo;
+_bfd_write_stab_strings (bfd *output_bfd, struct stab_info *sinfo)
{
- 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;
- }
+ /* 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);
+ <= sinfo->stabstr->output_section->size);
if (bfd_seek (output_bfd,
(file_ptr) (sinfo->stabstr->output_section->filepos
@@ -837,7 +745,7 @@ _bfd_write_stab_strings (output_bfd, psinfo)
/* We no longer need the stabs information. */
_bfd_stringtab_free (sinfo->strings);
- bfd_hash_table_free (&sinfo->includes.root);
+ bfd_hash_table_free (&sinfo->includes);
return TRUE;
}
@@ -847,22 +755,19 @@ _bfd_write_stab_strings (output_bfd, psinfo)
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;
+_bfd_stab_section_offset (asection *stabsec,
+ void * psecinfo,
+ bfd_vma offset)
{
struct stab_section_info *secinfo;
- secinfo = (struct stab_section_info *) *psecinfo;
+ 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 (offset >= stabsec->rawsize)
+ return offset - stabsec->rawsize + stabsec->size;
if (secinfo->cumulative_skips)
{
diff --git a/contrib/binutils/bfd/sunos.c b/contrib/binutils/bfd/sunos.c
index 5b1b18b..a9117f4 100644
--- a/contrib/binutils/bfd/sunos.c
+++ b/contrib/binutils/bfd/sunos.c
@@ -1,23 +1,23 @@
/* BFD backend for SunOS binaries.
- Copyright 1990, 1991, 1992, 1994, 1995, 1996, 1997, 1998, 2000, 2001,
- 2002, 2003 Free Software Foundation, Inc.
+ Copyright 1990, 1991, 1992, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
+ 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
Written by Cygnus Support.
-This file is part of BFD, the Binary File Descriptor library.
+ 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 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.
+ 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. */
+ 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., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
#define TARGETNAME "a.out-sunos-big"
@@ -30,59 +30,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#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) \
@@ -93,6 +40,31 @@ static bfd_boolean sunos_finish_dynamic_link
|| (((mtype) == M_UNKNOWN || (mtype) == M_68010 || (mtype) == M_68020) \
&& bfd_lookup_arch (bfd_arch_m68k, 0) != NULL))
+#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_synthetic_symtab _bfd_nodynamic_get_synthetic_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
+
+static bfd_boolean sunos_add_dynamic_symbols (bfd *, struct bfd_link_info *, struct external_nlist **, bfd_size_type *, char **);
+static bfd_boolean sunos_add_one_symbol (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_link_dynamic_object (struct bfd_link_info *, bfd *);
+static bfd_boolean sunos_write_dynamic_symbol (bfd *, struct bfd_link_info *, struct aout_link_hash_entry *);
+static bfd_boolean sunos_check_dynamic_reloc (struct bfd_link_info *, bfd *, asection *, struct aout_link_hash_entry *, void *, bfd_byte *, bfd_boolean *, bfd_vma *);
+static bfd_boolean sunos_finish_dynamic_link (bfd *, struct bfd_link_info *);
+static struct bfd_link_hash_table *sunos_link_hash_table_create (bfd *);
+static long sunos_get_dynamic_symtab_upper_bound (bfd *);
+static long sunos_canonicalize_dynamic_symtab (bfd *, asymbol **);
+static long sunos_get_dynamic_reloc_upper_bound (bfd *);
+static long sunos_canonicalize_dynamic_reloc (bfd *, arelent **, asymbol **);
+
/* Include the usual a.out support. */
#include "aoutf1.h"
@@ -120,7 +92,7 @@ struct sunos_dynamic_info
unsigned long dynrel_count;
/* Read in dynamic relocs. This may be reloc_std_external or
reloc_ext_external. */
- PTR dynrel;
+ void * dynrel;
/* arelent structures for dynamic relocs. */
arelent *canonical_dynrel;
};
@@ -137,8 +109,7 @@ struct sunos_dynamic_info
structure to FALSE to avoid doing this work again. */
static bfd_boolean
-sunos_read_dynamic_info (abfd)
- bfd *abfd;
+sunos_read_dynamic_info (bfd *abfd)
{
struct sunos_dynamic_info *info;
asection *dynsec;
@@ -148,7 +119,7 @@ sunos_read_dynamic_info (abfd)
struct external_sun4_dynamic_link linkinfo;
bfd_size_type amt;
- if (obj_aout_dynamic_info (abfd) != (PTR) NULL)
+ if (obj_aout_dynamic_info (abfd) != NULL)
return TRUE;
if ((abfd->flags & DYNAMIC) == 0)
@@ -158,7 +129,7 @@ sunos_read_dynamic_info (abfd)
}
amt = sizeof (struct sunos_dynamic_info);
- info = (struct sunos_dynamic_info *) bfd_zalloc (abfd, amt);
+ info = bfd_zalloc (abfd, amt);
if (!info)
return FALSE;
info->valid = FALSE;
@@ -167,7 +138,7 @@ sunos_read_dynamic_info (abfd)
info->canonical_dynsym = NULL;
info->dynrel = NULL;
info->canonical_dynrel = NULL;
- obj_aout_dynamic_info (abfd) = (PTR) info;
+ obj_aout_dynamic_info (abfd) = (void *) info;
/* This code used to look for the __DYNAMIC symbol to locate the dynamic
linking information.
@@ -178,7 +149,7 @@ sunos_read_dynamic_info (abfd)
symbols for the __DYNAMIC symbol. */
if ((abfd->flags & DYNAMIC) == 0)
return TRUE;
- if (! bfd_get_section_contents (abfd, obj_datasec (abfd), (PTR) &dyninfo,
+ if (! bfd_get_section_contents (abfd, obj_datasec (abfd), (void *) &dyninfo,
(file_ptr) 0,
(bfd_size_type) sizeof dyninfo))
return TRUE;
@@ -196,12 +167,12 @@ sunos_read_dynamic_info (abfd)
else
dynsec = obj_datasec (abfd);
dynoff -= bfd_get_section_vma (abfd, dynsec);
- if (dynoff > bfd_section_size (abfd, dynsec))
+ if (dynoff > dynsec->size)
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,
+ if (! bfd_get_section_contents (abfd, dynsec, (void *) &linkinfo,
(file_ptr) dynoff,
(bfd_size_type) sizeof linkinfo))
return TRUE;
@@ -259,8 +230,7 @@ sunos_read_dynamic_info (abfd)
/* Return the amount of memory required for the dynamic symbols. */
static long
-sunos_get_dynamic_symtab_upper_bound (abfd)
- bfd *abfd;
+sunos_get_dynamic_symtab_upper_bound (bfd *abfd)
{
struct sunos_dynamic_info *info;
@@ -280,8 +250,7 @@ sunos_get_dynamic_symtab_upper_bound (abfd)
/* Read the external dynamic symbols. */
static bfd_boolean
-sunos_slurp_dynamic_symtab (abfd)
- bfd *abfd;
+sunos_slurp_dynamic_symtab (bfd *abfd)
{
struct sunos_dynamic_info *info;
bfd_size_type amt;
@@ -301,14 +270,14 @@ sunos_slurp_dynamic_symtab (abfd)
}
/* Get the dynamic nlist structures. */
- if (info->dynsym == (struct external_nlist *) NULL)
+ if (info->dynsym == NULL)
{
amt = (bfd_size_type) info->dynsym_count * EXTERNAL_NLIST_SIZE;
- info->dynsym = (struct external_nlist *) bfd_alloc (abfd, amt);
+ info->dynsym = 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)
+ || bfd_bread ((void *) info->dynsym, amt, abfd) != amt)
{
if (info->dynsym != NULL)
{
@@ -320,14 +289,14 @@ sunos_slurp_dynamic_symtab (abfd)
}
/* Get the dynamic strings. */
- if (info->dynstr == (char *) NULL)
+ if (info->dynstr == NULL)
{
amt = info->dyninfo.ld_symb_size;
- info->dynstr = (char *) bfd_alloc (abfd, amt);
+ info->dynstr = 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)
+ || bfd_bread ((void *) info->dynstr, amt, abfd) != amt)
{
if (info->dynstr != NULL)
{
@@ -344,9 +313,7 @@ sunos_slurp_dynamic_symtab (abfd)
/* Read in the dynamic symbols. */
static long
-sunos_canonicalize_dynamic_symtab (abfd, storage)
- bfd *abfd;
- asymbol **storage;
+sunos_canonicalize_dynamic_symtab (bfd *abfd, asymbol **storage)
{
struct sunos_dynamic_info *info;
unsigned long i;
@@ -367,11 +334,11 @@ sunos_canonicalize_dynamic_symtab (abfd, storage)
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);
+ table = 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)
+ || bfd_bread ((void *) table, table_size, abfd) != table_size)
abort ();
for (i = 0; i < info->dynsym_count; i++)
{
@@ -399,13 +366,13 @@ sunos_canonicalize_dynamic_symtab (abfd, storage)
/* Get the asymbol structures corresponding to the dynamic nlist
structures. */
- if (info->canonical_dynsym == (aout_symbol_type *) NULL)
+ if (info->canonical_dynsym == 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);
+ info->canonical_dynsym = bfd_alloc (abfd, size);
if (info->canonical_dynsym == NULL && info->dynsym_count != 0)
return -1;
@@ -434,8 +401,7 @@ sunos_canonicalize_dynamic_symtab (abfd, storage)
/* Return the amount of memory required for the dynamic relocs. */
static long
-sunos_get_dynamic_reloc_upper_bound (abfd)
- bfd *abfd;
+sunos_get_dynamic_reloc_upper_bound (bfd *abfd)
{
struct sunos_dynamic_info *info;
@@ -455,17 +421,14 @@ sunos_get_dynamic_reloc_upper_bound (abfd)
/* Read in the dynamic relocs. */
static long
-sunos_canonicalize_dynamic_reloc (abfd, storage, syms)
- bfd *abfd;
- arelent **storage;
- asymbol **syms;
+sunos_canonicalize_dynamic_reloc (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 (obj_aout_dynamic_info (abfd) == NULL)
{
if (! sunos_read_dynamic_info (abfd))
return -1;
@@ -482,11 +445,11 @@ sunos_canonicalize_dynamic_reloc (abfd, storage, syms)
if (info->dynrel == NULL)
{
size = (bfd_size_type) info->dynrel_count * obj_reloc_entry_size (abfd);
- info->dynrel = (PTR) bfd_alloc (abfd, size);
+ info->dynrel = 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)
+ || bfd_bread ((void *) info->dynrel, size, abfd) != size)
{
if (info->dynrel != NULL)
{
@@ -499,12 +462,12 @@ sunos_canonicalize_dynamic_reloc (abfd, storage, syms)
/* Get the arelent structures corresponding to the dynamic reloc
information. */
- if (info->canonical_dynrel == (arelent *) NULL)
+ if (info->canonical_dynrel == NULL)
{
arelent *to;
size = (bfd_size_type) info->dynrel_count * sizeof (arelent);
- info->canonical_dynrel = (arelent *) bfd_alloc (abfd, size);
+ info->canonical_dynrel = bfd_alloc (abfd, size);
if (info->canonical_dynrel == NULL && info->dynrel_count != 0)
return -1;
@@ -512,25 +475,25 @@ sunos_canonicalize_dynamic_reloc (abfd, storage, syms)
if (obj_reloc_entry_size (abfd) == RELOC_EXT_SIZE)
{
- register struct reloc_ext_external *p;
+ 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);
+ 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 *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);
+ NAME (aout, swap_std_reloc_in) (abfd, p, to, syms,
+ (bfd_size_type) info->dynsym_count);
}
}
@@ -675,25 +638,23 @@ struct sunos_link_hash_table
/* 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;
+sunos_link_hash_newfunc (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;
+ if (ret == NULL)
+ ret = bfd_hash_allocate (table, sizeof (* ret));
+ if (ret == NULL)
+ return NULL;
/* 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));
+ NAME (aout, link_hash_newfunc) ((struct bfd_hash_entry *) ret,
+ table, string));
if (ret != NULL)
{
/* Set local fields. */
@@ -710,20 +671,20 @@ sunos_link_hash_newfunc (entry, table, string)
/* Create a SunOS link hash table. */
static struct bfd_link_hash_table *
-sunos_link_hash_table_create (abfd)
- bfd *abfd;
+sunos_link_hash_table_create (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))
+ ret = bfd_malloc (amt);
+ if (ret == NULL)
+ return NULL;
+ if (!NAME (aout, link_hash_table_init) (&ret->root, abfd,
+ sunos_link_hash_newfunc,
+ sizeof (struct sunos_link_hash_entry)))
{
free (ret);
- return (struct bfd_link_hash_table *) NULL;
+ return NULL;
}
ret->dynobj = NULL;
@@ -750,7 +711,7 @@ sunos_link_hash_table_create (abfd)
#define sunos_link_hash_traverse(table, func, info) \
(aout_link_hash_traverse \
(&(table)->root, \
- (bfd_boolean (*) PARAMS ((struct aout_link_hash_entry *, PTR))) (func), \
+ (bfd_boolean (*) (struct aout_link_hash_entry *, void *)) (func), \
(info)))
/* Get the SunOS link hash table from the info structure. This is
@@ -758,9 +719,6 @@ sunos_link_hash_table_create (abfd)
#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
@@ -769,10 +727,9 @@ static bfd_boolean sunos_scan_dynamic_symbol
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;
+sunos_create_dynamic_sections (bfd *abfd,
+ struct bfd_link_info *info,
+ bfd_boolean needed)
{
asection *s;
@@ -788,57 +745,50 @@ sunos_create_dynamic_sections (abfd, info, needed)
/* 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");
+ s = bfd_make_section_with_flags (abfd, ".dynamic", flags);
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");
+ s = bfd_make_section_with_flags (abfd, ".got", flags);
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");
+ s = bfd_make_section_with_flags (abfd, ".plt", flags | SEC_CODE);
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");
+ s = bfd_make_section_with_flags (abfd, ".dynrel", flags | SEC_READONLY);
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");
+ s = bfd_make_section_with_flags (abfd, ".hash", flags | SEC_READONLY);
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");
+ s = bfd_make_section_with_flags (abfd, ".dynsym", flags | SEC_READONLY);
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");
+ s = bfd_make_section_with_flags (abfd, ".dynstr", flags | SEC_READONLY);
if (s == NULL
- || ! bfd_set_section_flags (abfd, s, flags | SEC_READONLY)
|| ! bfd_set_section_alignment (abfd, s, 2))
return FALSE;
@@ -853,8 +803,8 @@ sunos_create_dynamic_sections (abfd, info, needed)
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;
+ if (s->size == 0)
+ s->size = BYTES_IN_WORD;
sunos_hash_table (info)->dynamic_sections_needed = TRUE;
sunos_hash_table (info)->got_needed = TRUE;
@@ -867,17 +817,15 @@ sunos_create_dynamic_sections (abfd, info, needed)
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;
+sunos_add_dynamic_symbols (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)
@@ -901,12 +849,17 @@ sunos_add_dynamic_symbols (abfd, info, symsp, sym_countp, stringsp)
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)
+ abfd->sections = NULL;
+ else
{
- if (abfd != dynobj || ((*ps)->flags & SEC_LINKER_CREATED) == 0)
- bfd_section_list_remove (abfd, ps);
- else
- ps = &(*ps)->next;
+ asection *s;
+
+ for (s = abfd->sections; s != NULL; s = s->next)
+ {
+ if ((s->flags & SEC_LINKER_CREATED) == 0)
+ bfd_section_list_remove (abfd, s);
+ }
}
/* The native linker seems to just ignore dynamic objects when -r is
@@ -930,14 +883,10 @@ sunos_add_dynamic_symbols (abfd, info, symsp, sym_countp, stringsp)
/* 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");
+ flagword flags = (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS
+ | SEC_IN_MEMORY | SEC_READONLY);
+ asection *s = bfd_make_section_with_flags (dynobj, ".need", flags);
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;
}
@@ -947,14 +896,10 @@ sunos_add_dynamic_symbols (abfd, info, symsp, sym_countp, stringsp)
/* 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");
+ flagword flags = (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS
+ | SEC_IN_MEMORY | SEC_READONLY);
+ asection *s = bfd_make_section_with_flags (dynobj, ".rules", flags);
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;
}
@@ -987,7 +932,6 @@ sunos_add_dynamic_symbols (abfd, info, symsp, sym_countp, stringsp)
/* 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);
@@ -995,14 +939,14 @@ sunos_add_dynamic_symbols (abfd, info, symsp, sym_countp, stringsp)
need = bfd_get_32 (abfd, buf + 12);
alc = sizeof (struct bfd_link_needed_list);
- needed = (struct bfd_link_needed_list *) bfd_alloc (abfd, alc);
+ needed = 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);
+ namebuf = bfd_malloc (alc + 1);
if (namebuf == NULL)
return FALSE;
p = namebuf;
@@ -1031,7 +975,7 @@ sunos_add_dynamic_symbols (abfd, info, symsp, sym_countp, stringsp)
char *n;
alc *= 2;
- n = (char *) bfd_realloc (namebuf, alc + 1);
+ n = bfd_realloc (namebuf, alc + 1);
if (n == NULL)
{
free (namebuf);
@@ -1063,7 +1007,7 @@ sunos_add_dynamic_symbols (abfd, info, symsp, sym_countp, stringsp)
char *n;
alc = (p - namebuf) + strlen (majbuf) + strlen (minbuf);
- n = (char *) bfd_realloc (namebuf, alc + 1);
+ n = bfd_realloc (namebuf, alc + 1);
if (n == NULL)
{
free (namebuf);
@@ -1104,18 +1048,16 @@ sunos_add_dynamic_symbols (abfd, info, symsp, sym_countp, stringsp)
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;
+sunos_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)
{
struct sunos_link_hash_entry *h;
int new_flag;
@@ -1180,25 +1122,21 @@ sunos_add_one_symbol (info, abfd, name, flags, section, value, string,
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;
- }
+ /* 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;
- }
+ /* 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,
@@ -1244,14 +1182,15 @@ sunos_add_one_symbol (info, abfd, name, flags, section, value, string,
return TRUE;
}
+extern const bfd_target MY (vec);
+
/* 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;
+bfd_sunos_get_needed_list (bfd *abfd ATTRIBUTE_UNUSED,
+ struct bfd_link_info *info)
{
- if (info->hash->creator != &MY(vec))
+ if (info->hash->creator != &MY (vec))
return NULL;
return sunos_hash_table (info)->needed;
}
@@ -1260,10 +1199,9 @@ bfd_sunos_get_needed_list (abfd, info)
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;
+bfd_sunos_record_link_assignment (bfd *output_bfd,
+ struct bfd_link_info *info,
+ const char *name)
{
struct sunos_link_hash_entry *h;
@@ -1294,295 +1232,6 @@ bfd_sunos_record_link_assignment (output_bfd, info, name)
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
@@ -1594,12 +1243,11 @@ sunos_scan_relocs (info, abfd, sec, rel_size)
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;
+sunos_scan_std_relocs (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;
@@ -1649,11 +1297,9 @@ sunos_scan_std_relocs (info, abfd, sec, relocs, rel_size)
/* 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;
- }
+ /* 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
@@ -1682,8 +1328,8 @@ sunos_scan_std_relocs (info, abfd, sec, relocs, rel_size)
sgot = bfd_get_section_by_name (dynobj, ".got");
BFD_ASSERT (sgot != NULL);
- if (sgot->_raw_size == 0)
- sgot->_raw_size = BYTES_IN_WORD;
+ if (sgot->size == 0)
+ sgot->size = BYTES_IN_WORD;
sunos_hash_table (info)->got_needed = TRUE;
}
@@ -1697,13 +1343,10 @@ sunos_scan_std_relocs (info, abfd, sec, relocs, rel_size)
/* 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;
- }
+ /* Presumably this symbol was marked as being undefined by
+ an earlier reloc. */
+ srel->size += RELOC_STD_SIZE;
else if ((h->root.root.u.def.section->flags & SEC_CODE) == 0)
{
bfd *sub;
@@ -1711,7 +1354,7 @@ sunos_scan_std_relocs (info, abfd, sec, relocs, rel_size)
/* 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;
+ srel->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;
@@ -1725,21 +1368,21 @@ sunos_scan_std_relocs (info, abfd, sec, relocs, rel_size)
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 (splt->size == 0)
+ splt->size = M68K_PLT_ENTRY_SIZE;
+ h->plt_offset = splt->size;
if ((h->flags & SUNOS_DEF_REGULAR) == 0)
{
h->root.root.u.def.section = splt;
- h->root.root.u.def.value = splt->_raw_size;
+ h->root.root.u.def.value = splt->size;
}
- splt->_raw_size += M68K_PLT_ENTRY_SIZE;
+ splt->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;
+ srel->size += RELOC_STD_SIZE;
}
}
}
@@ -1754,12 +1397,11 @@ sunos_scan_std_relocs (info, abfd, sec, relocs, rel_size)
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;
+sunos_scan_ext_relocs (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;
@@ -1836,8 +1478,8 @@ sunos_scan_ext_relocs (info, abfd, sec, relocs, rel_size)
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;
+ if (sgot->size == 0)
+ sgot->size = BYTES_IN_WORD;
sunos_hash_table (info)->got_needed = TRUE;
}
@@ -1846,23 +1488,20 @@ sunos_scan_ext_relocs (info, abfd, sec, relocs, rel_size)
if (h->got_offset != 0)
continue;
- h->got_offset = sgot->_raw_size;
+ h->got_offset = sgot->size;
}
else
{
if (r_index >= bfd_get_symcount (abfd))
- {
- /* This is abnormal, but should be caught in the
- relocation phase. */
- continue;
- }
+ /* 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);
+ adata (abfd).local_got_offsets = bfd_zalloc (abfd, amt);
if (adata (abfd).local_got_offsets == NULL)
return FALSE;
}
@@ -1870,10 +1509,10 @@ sunos_scan_ext_relocs (info, abfd, sec, relocs, rel_size)
if (adata (abfd).local_got_offsets[r_index] != 0)
continue;
- adata (abfd).local_got_offsets[r_index] = sgot->_raw_size;
+ adata (abfd).local_got_offsets[r_index] = sgot->size;
}
- sgot->_raw_size += BYTES_IN_WORD;
+ sgot->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
@@ -1882,7 +1521,7 @@ sunos_scan_ext_relocs (info, abfd, sec, relocs, rel_size)
|| (h != NULL
&& (h->flags & SUNOS_DEF_DYNAMIC) != 0
&& (h->flags & SUNOS_DEF_REGULAR) == 0))
- srel->_raw_size += RELOC_EXT_SIZE;
+ srel->size += RELOC_EXT_SIZE;
continue;
}
@@ -1907,7 +1546,7 @@ sunos_scan_ext_relocs (info, abfd, sec, relocs, rel_size)
BFD_ASSERT (splt != NULL && sgot != NULL && srel != NULL);
}
- srel->_raw_size += RELOC_EXT_SIZE;
+ srel->size += RELOC_EXT_SIZE;
}
continue;
@@ -1954,8 +1593,8 @@ sunos_scan_ext_relocs (info, abfd, sec, relocs, rel_size)
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;
+ if (sgot->size == 0)
+ sgot->size = BYTES_IN_WORD;
sunos_hash_table (info)->got_needed = TRUE;
}
@@ -1976,11 +1615,10 @@ sunos_scan_ext_relocs (info, abfd, sec, relocs, rel_size)
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;
- }
+ /* Presumably this symbol was marked as being undefined by
+ an earlier reloc. */
+ srel->size += RELOC_EXT_SIZE;
+
else if (r_type != RELOC_JMP_TBL
&& (h->root.root.u.def.section->flags & SEC_CODE) == 0)
{
@@ -1989,7 +1627,7 @@ sunos_scan_ext_relocs (info, abfd, sec, relocs, rel_size)
/* 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;
+ srel->size += RELOC_EXT_SIZE;
if ((h->flags & SUNOS_DEF_REGULAR) == 0)
{
sub = h->root.root.u.def.section->owner;
@@ -2006,44 +1644,106 @@ sunos_scan_ext_relocs (info, abfd, sec, relocs, rel_size)
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 (splt->size == 0)
+ splt->size = SPARC_PLT_ENTRY_SIZE;
+ h->plt_offset = splt->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;
+ h->root.root.u.def.value = splt->size;
}
- splt->_raw_size += SPARC_PLT_ENTRY_SIZE;
+ splt->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;
+ srel->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;
+ srel->size += RELOC_EXT_SIZE;
+ }
+ }
+
+ return TRUE;
+}
+
+/* Scan the relocs for an input section. */
+
+static bfd_boolean
+sunos_scan_relocs (struct bfd_link_info *info,
+ bfd *abfd,
+ asection *sec,
+ bfd_size_type rel_size)
+{
+ void * relocs;
+ void * 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 = 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;
}
/* 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;
+sunos_scan_dynamic_symbol (struct sunos_link_hash_entry *h, void * data)
{
struct bfd_link_info *info = (struct bfd_link_info *) data;
@@ -2067,7 +1767,6 @@ sunos_scan_dynamic_symbol (h, data)
/* 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)
@@ -2118,15 +1817,14 @@ sunos_scan_dynamic_symbol (h, data)
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);
+ contents = bfd_realloc (s->contents, s->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;
+ h->dynstr_index = s->size;
+ strcpy ((char *) contents + s->size, h->root.root.root.string);
+ s->size += len + 1;
/* Add it to the dynamic hash table. */
name = (unsigned char *) h->root.root.root.string;
@@ -2149,14 +1847,235 @@ sunos_scan_dynamic_symbol (h, data)
(s->contents
+ hash * HASH_ENTRY_SIZE
+ BYTES_IN_WORD));
- PUT_WORD (dynobj, s->_raw_size / HASH_ENTRY_SIZE,
+ PUT_WORD (dynobj, s->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;
+ PUT_WORD (dynobj, h->dynindx, s->contents + s->size);
+ PUT_WORD (dynobj, next, s->contents + s->size + BYTES_IN_WORD);
+ s->size += HASH_ENTRY_SIZE;
+ }
+ }
+
+ 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 (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->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->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->size = dynsymcount * sizeof (struct external_nlist);
+ s->contents = bfd_alloc (output_bfd, s->size);
+ if (s->contents == NULL && s->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_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->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,
+ (void *) 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->size & 7) != 0)
+ {
+ bfd_size_type add;
+ bfd_byte *contents;
+
+ add = 8 - (s->size & 7);
+ contents = bfd_realloc (s->contents, s->size + add);
+ if (contents == NULL)
+ return FALSE;
+ memset (contents + s->size, 0, (size_t) add);
+ s->contents = contents;
+ s->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->size != 0)
+ {
+ s->contents = bfd_alloc (dynobj, s->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->size != 0)
+ {
+ s->contents = bfd_alloc (dynobj, s->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_alloc (dynobj, s->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;
}
@@ -2165,9 +2084,8 @@ sunos_scan_dynamic_symbol (h, data)
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;
+sunos_link_dynamic_object (struct bfd_link_info *info ATTRIBUTE_UNUSED,
+ bfd *abfd ATTRIBUTE_UNUSED)
{
return TRUE;
}
@@ -2176,10 +2094,9 @@ sunos_link_dynamic_object (info, abfd)
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;
+sunos_write_dynamic_symbol (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;
@@ -2254,7 +2171,7 @@ sunos_write_dynamic_symbol (output_bfd, info, harg)
{
BFD_ASSERT (h->dynindx >= 0);
BFD_ASSERT (s->reloc_count * obj_reloc_entry_size (dynobj)
- < s->_raw_size);
+ < s->size);
p = s->contents + s->reloc_count * obj_reloc_entry_size (output_bfd);
if (obj_reloc_entry_size (output_bfd) == RELOC_STD_SIZE)
{
@@ -2409,16 +2326,14 @@ sunos_write_dynamic_symbol (output_bfd, info, harg)
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;
+sunos_check_dynamic_reloc (struct bfd_link_info *info,
+ bfd *input_bfd,
+ asection *input_section,
+ struct aout_link_hash_entry *harg,
+ void * 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;
@@ -2561,7 +2476,7 @@ sunos_check_dynamic_reloc (info, input_bfd, input_section, harg, reloc,
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);
+ < s->size);
p = (s->contents
+ s->reloc_count * obj_reloc_entry_size (dynobj));
@@ -2690,7 +2605,7 @@ sunos_check_dynamic_reloc (info, input_bfd, input_section, harg, reloc,
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);
+ BFD_ASSERT (s->reloc_count * obj_reloc_entry_size (dynobj) < s->size);
p = s->contents + s->reloc_count * obj_reloc_entry_size (dynobj);
@@ -2773,9 +2688,7 @@ sunos_check_dynamic_reloc (info, input_bfd, input_section, harg, reloc,
/* Finish up the dynamic linking information. */
static bfd_boolean
-sunos_finish_dynamic_link (abfd, info)
- bfd *abfd;
- struct bfd_link_info *info;
+sunos_finish_dynamic_link (bfd *abfd, struct bfd_link_info *info)
{
bfd *dynobj;
asection *o;
@@ -2796,7 +2709,7 @@ sunos_finish_dynamic_link (abfd, info)
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)
+ if (s != NULL && s->size != 0)
{
file_ptr filepos;
bfd_byte *p;
@@ -2820,7 +2733,7 @@ sunos_finish_dynamic_link (abfd, info)
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)
+ if (info->shared || sdyn->size == 0)
PUT_WORD (dynobj, 0, s->contents);
else
PUT_WORD (dynobj, sdyn->output_section->vma + sdyn->output_offset,
@@ -2836,12 +2749,12 @@ sunos_finish_dynamic_link (abfd, info)
if (! bfd_set_section_contents (abfd, o->output_section,
o->contents,
(file_ptr) o->output_offset,
- o->_raw_size))
+ o->size))
return FALSE;
}
}
- if (sdyn->_raw_size > 0)
+ if (sdyn->size > 0)
{
struct external_sun4_dynamic esd;
struct external_sun4_dynamic_link esdl;
@@ -2867,14 +2780,14 @@ sunos_finish_dynamic_link (abfd, info)
PUT_WORD (dynobj, (bfd_vma) 0, esdl.ld_loaded);
s = bfd_get_section_by_name (dynobj, ".need");
- if (s == NULL || s->_raw_size == 0)
+ if (s == NULL || s->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)
+ if (s == NULL || s->size == 0)
PUT_WORD (dynobj, (bfd_vma) 0, esdl.ld_rules);
else
PUT_WORD (dynobj, s->output_section->filepos + s->output_offset,
@@ -2889,12 +2802,12 @@ sunos_finish_dynamic_link (abfd, info)
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);
+ PUT_WORD (dynobj, s->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);
+ == s->size);
PUT_WORD (dynobj, s->output_section->filepos + s->output_offset,
esdl.ld_rel);
@@ -2917,13 +2830,13 @@ sunos_finish_dynamic_link (abfd, info)
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);
+ PUT_WORD (dynobj, s->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),
+ BFD_ALIGN (obj_textsec (abfd)->size, 0x2000),
esdl.ld_text);
pos = sdyn->output_offset;
diff --git a/contrib/binutils/bfd/syms.c b/contrib/binutils/bfd/syms.c
index c07f48b..89c3869 100644
--- a/contrib/binutils/bfd/syms.c
+++ b/contrib/binutils/bfd/syms.c
@@ -1,6 +1,6 @@
/* Generic symbol-table support for the BFD library.
Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
- 2000, 2001, 2002, 2003
+ 2000, 2001, 2002, 2003, 2004, 2007
Free Software Foundation, Inc.
Written by Cygnus Support.
@@ -18,7 +18,7 @@
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. */
+ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
/*
SECTION
@@ -288,6 +288,14 @@ CODE_FRAGMENT
. {* This symbol is thread local. Used in ELF. *}
.#define BSF_THREAD_LOCAL 0x40000
.
+. {* This symbol represents a complex relocation expression,
+. with the expression tree serialized in the symbol name. *}
+.#define BSF_RELC 0x80000
+.
+. {* This symbol represents a signed complex relocation expression,
+. with the expression tree serialized in the symbol name. *}
+.#define BSF_SRELC 0x100000
+.
. flagword flags;
.
. {* A pointer to the section to which this symbol is
@@ -307,8 +315,8 @@ CODE_FRAGMENT
.
*/
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
#include "safe-ctype.h"
#include "bfdlink.h"
@@ -355,7 +363,7 @@ 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)
+ if ((sym->flags & (BSF_GLOBAL | BSF_WEAK | BSF_FILE | BSF_SECTION_SYM)) != 0)
return FALSE;
if (sym->name == NULL)
return FALSE;
@@ -382,6 +390,23 @@ DESCRIPTION
/*
FUNCTION
+ bfd_is_target_special_symbol
+
+SYNOPSIS
+ bfd_boolean bfd_is_target_special_symbol (bfd *abfd, asymbol *sym);
+
+DESCRIPTION
+ Return TRUE iff a symbol @var{sym} in the BFD @var{abfd} is something
+ special to the particular target represented by the BFD. Such symbols
+ should normally not be mentioned to the user.
+
+.#define bfd_is_target_special_symbol(abfd, sym) \
+. BFD_SEND (abfd, _bfd_is_target_special_symbol, (abfd, sym))
+.
+*/
+
+/*
+FUNCTION
bfd_canonicalize_symtab
DESCRIPTION
@@ -934,8 +959,12 @@ _bfd_stab_section_find_nearest_line (bfd *abfd,
return TRUE;
}
- stabsize = info->stabsec->_raw_size;
- strsize = info->strsec->_raw_size;
+ stabsize = (info->stabsec->rawsize
+ ? info->stabsec->rawsize
+ : info->stabsec->size);
+ strsize = (info->strsec->rawsize
+ ? info->strsec->rawsize
+ : info->strsec->size);
}
else
{
@@ -965,8 +994,12 @@ _bfd_stab_section_find_nearest_line (bfd *abfd,
return TRUE;
}
- stabsize = info->stabsec->_raw_size;
- strsize = info->strsec->_raw_size;
+ stabsize = (info->stabsec->rawsize
+ ? info->stabsec->rawsize
+ : info->stabsec->size);
+ strsize = (info->strsec->rawsize
+ ? info->strsec->rawsize
+ : info->strsec->size);
info->stabs = bfd_alloc (abfd, stabsize);
info->strs = bfd_alloc (abfd, strsize);
@@ -974,9 +1007,9 @@ _bfd_stab_section_find_nearest_line (bfd *abfd,
return FALSE;
if (! bfd_get_section_contents (abfd, info->stabsec, info->stabs,
- (bfd_vma) 0, stabsize)
+ 0, stabsize)
|| ! bfd_get_section_contents (abfd, info->strsec, info->strs,
- (bfd_vma) 0, strsize))
+ 0, strsize))
return FALSE;
/* If this is a relocatable object file, we have to relocate
@@ -1008,6 +1041,10 @@ _bfd_stab_section_find_nearest_line (bfd *abfd,
asymbol *sym;
r = *pr;
+ /* Ignore R_*_NONE relocs. */
+ if (r->howto->dst_mask == 0)
+ continue;
+
if (r->howto->rightshift != 0
|| r->howto->size != 2
|| r->howto->bitsize != 32
diff --git a/contrib/binutils/bfd/sysdep.h b/contrib/binutils/bfd/sysdep.h
index 1954470..e1b070b 100644
--- a/contrib/binutils/bfd/sysdep.h
+++ b/contrib/binutils/bfd/sysdep.h
@@ -1,5 +1,5 @@
/* sysdep.h -- handle host dependencies for the BFD library
- Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001
+ Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2007
Free Software Foundation, Inc.
Written by Cygnus Support.
@@ -17,15 +17,15 @@ 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. */
+Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
#ifndef BFD_SYSDEP_H
#define BFD_SYSDEP_H
-#include "ansidecl.h"
-
#include "config.h"
+#include "ansidecl.h"
+
#ifdef HAVE_STDDEF_H
#include <stddef.h>
#endif
@@ -39,6 +39,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
extern int errno;
#endif
+#ifdef STRING_WITH_STRINGS
+#include <string.h>
+#include <strings.h>
+#else
#ifdef HAVE_STRING_H
#include <string.h>
#else
@@ -49,6 +53,7 @@ extern char *strchr ();
extern char *strrchr ();
#endif
#endif
+#endif
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
@@ -105,24 +110,56 @@ extern char *strrchr ();
#include "filenames.h"
-#ifdef NEED_DECLARATION_STRSTR
-extern char *strstr ();
+#if !HAVE_DECL_FFS
+extern int ffs (int);
+#endif
+
+#if !HAVE_DECL_FREE
+extern void free ();
+#endif
+
+#if !HAVE_DECL_GETENV
+extern char *getenv ();
#endif
-#ifdef NEED_DECLARATION_MALLOC
+#if !HAVE_DECL_MALLOC
extern PTR malloc ();
#endif
-#ifdef NEED_DECLARATION_REALLOC
+#if !HAVE_DECL_REALLOC
extern PTR realloc ();
#endif
-#ifdef NEED_DECLARATION_FREE
-extern void free ();
+#if !HAVE_DECL_STPCPY
+extern char *stpcpy (char *__dest, const char *__src);
#endif
-#ifdef NEED_DECLARATION_GETENV
-extern char *getenv ();
+#if !HAVE_DECL_STRSTR
+extern char *strstr ();
+#endif
+
+#ifdef HAVE_FTELLO
+#if !HAVE_DECL_FTELLO
+extern off_t ftello (FILE *stream);
+#endif
+#endif
+
+#ifdef HAVE_FTELLO64
+#if !HAVE_DECL_FTELLO64
+extern off64_t ftello64 (FILE *stream);
+#endif
+#endif
+
+#ifdef HAVE_FSEEKO
+#if !HAVE_DECL_FSEEKO
+extern int fseeko (FILE *stream, off_t offset, int whence);
+#endif
+#endif
+
+#ifdef HAVE_FSEEKO64
+#if !HAVE_DECL_FSEEKO64
+extern int fseeko64 (FILE *stream, off64_t offset, int whence);
+#endif
#endif
/* Define offsetof for those systems which lack it */
diff --git a/contrib/binutils/bfd/targets.c b/contrib/binutils/bfd/targets.c
index 3d8e0a5..71c8f4b 100644
--- a/contrib/binutils/bfd/targets.c
+++ b/contrib/binutils/bfd/targets.c
@@ -1,6 +1,6 @@
/* 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
+ 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
Free Software Foundation, Inc.
Written by Cygnus Support.
@@ -18,14 +18,22 @@
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. */
+ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
#include "fnmatch.h"
/*
+ It's okay to see some:
+#if 0
+ directives in this source file, as targets.c uses them to exclude
+ certain BFD vectors. This comment is specially formatted to catch
+ users who grep for ^#if 0, so please keep it this way!
+*/
+
+/*
SECTION
Targets
@@ -201,7 +209,7 @@ DESCRIPTION
. 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.
+. other entry points, since they don't take a BFD as the 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 *);
@@ -263,8 +271,10 @@ BFD_JUMP_TABLE macros.
.#define BFD_JUMP_TABLE_COPY(NAME) \
. NAME##_bfd_copy_private_bfd_data, \
. NAME##_bfd_merge_private_bfd_data, \
+. _bfd_generic_init_private_section_data, \
. NAME##_bfd_copy_private_section_data, \
. NAME##_bfd_copy_private_symbol_data, \
+. NAME##_bfd_copy_private_header_data, \
. NAME##_bfd_set_private_flags, \
. NAME##_bfd_print_private_bfd_data
.
@@ -274,6 +284,12 @@ BFD_JUMP_TABLE macros.
. {* 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 initialize BFD private section data from one object file
+. to another. *}
+.#define bfd_init_private_section_data(ibfd, isec, obfd, osec, link_info) \
+. BFD_SEND (obfd, _bfd_init_private_section_data, (ibfd, isec, obfd, osec, link_info))
+. bfd_boolean (*_bfd_init_private_section_data)
+. (bfd *, sec_ptr, bfd *, sec_ptr, struct bfd_link_info *);
. {* Called to copy BFD private section data from one object file
. to another. *}
. bfd_boolean (*_bfd_copy_private_section_data)
@@ -282,6 +298,10 @@ BFD_JUMP_TABLE macros.
. to another. *}
. bfd_boolean (*_bfd_copy_private_symbol_data)
. (bfd *, asymbol *, bfd *, asymbol *);
+. {* Called to copy BFD private header data from one object file
+. to another. *}
+. bfd_boolean (*_bfd_copy_private_header_data)
+. (bfd *, bfd *);
. {* Called to set private backend flags. *}
. bfd_boolean (*_bfd_set_private_flags) (bfd *, flagword);
.
@@ -333,8 +353,11 @@ BFD_JUMP_TABLE macros.
. NAME##_print_symbol, \
. NAME##_get_symbol_info, \
. NAME##_bfd_is_local_label_name, \
+. NAME##_bfd_is_target_special_symbol, \
. NAME##_get_lineno, \
. NAME##_find_nearest_line, \
+. _bfd_generic_find_line, \
+. NAME##_find_inliner_info, \
. NAME##_bfd_make_debug_symbol, \
. NAME##_read_minisymbols, \
. NAME##_minisymbol_to_symbol
@@ -351,11 +374,16 @@ BFD_JUMP_TABLE macros.
. (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 *);
-.
+. bfd_boolean (*_bfd_is_target_special_symbol) (bfd *, asymbol *);
. 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 *);
+. bfd_boolean (*_bfd_find_line)
+. (bfd *, struct bfd_symbol **, struct bfd_symbol *,
+. const char **, unsigned int *);
+. bfd_boolean (*_bfd_find_inliner_info)
+. (bfd *, 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. *}
@@ -374,7 +402,8 @@ BFD_JUMP_TABLE macros.
.#define BFD_JUMP_TABLE_RELOCS(NAME) \
. NAME##_get_reloc_upper_bound, \
. NAME##_canonicalize_reloc, \
-. NAME##_bfd_reloc_type_lookup
+. NAME##_bfd_reloc_type_lookup, \
+. NAME##_bfd_reloc_name_lookup
.
. long (*_get_reloc_upper_bound) (bfd *, sec_ptr);
. long (*_bfd_canonicalize_reloc)
@@ -382,6 +411,9 @@ BFD_JUMP_TABLE macros.
. {* See documentation on reloc types. *}
. reloc_howto_type *
. (*reloc_type_lookup) (bfd *, bfd_reloc_code_real_type);
+. reloc_howto_type *
+. (*reloc_name_lookup) (bfd *, const char *);
+.
.
. {* Routines used when writing an object file. *}
.#define BFD_JUMP_TABLE_WRITE(NAME) \
@@ -406,9 +438,11 @@ BFD_JUMP_TABLE macros.
. NAME##_bfd_link_split_section, \
. NAME##_bfd_gc_sections, \
. NAME##_bfd_merge_sections, \
-. NAME##_bfd_discard_group
+. NAME##_bfd_is_group_section, \
+. NAME##_bfd_discard_group, \
+. NAME##_section_already_linked \
.
-. int (*_bfd_sizeof_headers) (bfd *, bfd_boolean);
+. int (*_bfd_sizeof_headers) (bfd *, struct bfd_link_info *);
. bfd_byte * (*_bfd_get_relocated_section_contents)
. (bfd *, struct bfd_link_info *, struct bfd_link_order *,
. bfd_byte *, bfd_boolean, struct bfd_symbol **);
@@ -443,13 +477,22 @@ BFD_JUMP_TABLE macros.
. {* Attempt to merge SEC_MERGE sections. *}
. bfd_boolean (*_bfd_merge_sections) (bfd *, struct bfd_link_info *);
.
+. {* Is this section a member of a group? *}
+. bfd_boolean (*_bfd_is_group_section) (bfd *, const struct bfd_section *);
+.
. {* Discard members of a group. *}
. bfd_boolean (*_bfd_discard_group) (bfd *, struct bfd_section *);
.
+. {* Check if SEC has been already linked during a reloceatable or
+. final link. *}
+. void (*_section_already_linked) (bfd *, struct bfd_section *,
+. struct bfd_link_info *);
+.
. {* 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_synthetic_symtab, \
. NAME##_get_dynamic_reloc_upper_bound, \
. NAME##_canonicalize_dynamic_reloc
.
@@ -458,6 +501,10 @@ BFD_JUMP_TABLE macros.
. {* Read in the dynamic symbols. *}
. long (*_bfd_canonicalize_dynamic_symtab)
. (bfd *, struct bfd_symbol **);
+. {* Create synthetized symbols. *}
+. long (*_bfd_get_synthetic_symtab)
+. (bfd *, long, struct bfd_symbol **, long, struct bfd_symbol **,
+. 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. *}
@@ -487,7 +534,6 @@ to find an alternative output format that is suitable.
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;
@@ -500,6 +546,10 @@ 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 arm_wince_pe_big_vec;
+extern const bfd_target arm_wince_pe_little_vec;
+extern const bfd_target arm_wince_pei_big_vec;
+extern const bfd_target arm_wince_pei_little_vec;
extern const bfd_target armcoff_big_vec;
extern const bfd_target armcoff_little_vec;
extern const bfd_target armnetbsd_vec;
@@ -513,12 +563,19 @@ extern const bfd_target bfd_efi_app_ia32_vec;
extern const bfd_target bfd_efi_app_x86_64_vec;
extern const bfd_target bfd_efi_app_ia64_vec;
extern const bfd_target bfd_elf32_avr_vec;
+extern const bfd_target bfd_elf32_bfin_vec;
+extern const bfd_target bfd_elf32_bfinfdpic_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_bigarm_symbian_vec;
+extern const bfd_target bfd_elf32_bigarm_vxworks_vec;
extern const bfd_target bfd_elf32_bigmips_vec;
+extern const bfd_target bfd_elf32_bigmips_vxworks_vec;
+extern const bfd_target bfd_elf32_cr16_vec;
+extern const bfd_target bfd_elf32_cr16c_vec;
extern const bfd_target bfd_elf32_cris_vec;
+extern const bfd_target bfd_elf32_crx_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;
@@ -527,22 +584,28 @@ 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_nbsd_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_vxworks_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_elf64_ia64_freebsd_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_littlearm_symbian_vec;
+extern const bfd_target bfd_elf32_littlearm_vxworks_vec;
extern const bfd_target bfd_elf32_littlemips_vec;
+extern const bfd_target bfd_elf32_littlemips_vxworks_vec;
+extern const bfd_target bfd_elf32_m32c_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;
@@ -553,8 +616,11 @@ 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_mep_vec;
+extern const bfd_target bfd_elf32_mep_little_vec;
extern const bfd_target bfd_elf32_mn10200_vec;
extern const bfd_target bfd_elf32_mn10300_vec;
+extern const bfd_target bfd_elf32_mt_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;
@@ -566,7 +632,10 @@ 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_powerpc_vxworks_vec;
extern const bfd_target bfd_elf32_s390_vec;
+extern const bfd_target bfd_elf32_bigscore_vec;
+extern const bfd_target bfd_elf32_littlescore_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;
@@ -576,15 +645,21 @@ 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_shl_symbian_vec;
extern const bfd_target bfd_elf32_shlin_vec;
extern const bfd_target bfd_elf32_shlnbsd_vec;
+extern const bfd_target bfd_elf32_shlvxworks_vec;
extern const bfd_target bfd_elf32_shnbsd_vec;
+extern const bfd_target bfd_elf32_shvxworks_vec;
extern const bfd_target bfd_elf32_sparc_vec;
+extern const bfd_target bfd_elf32_sparc_vxworks_vec;
+extern const bfd_target bfd_elf32_spu_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_xc16x_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;
@@ -610,8 +685,10 @@ 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_sparc_freebsd_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_freebsd_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;
@@ -654,15 +731,15 @@ 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 m88kopenbsd_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 maxqcoff_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;
@@ -724,6 +801,10 @@ 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 x86_64pe_vec;
+extern const bfd_target x86_64pei_vec;
+extern const bfd_target x86_64coff_vec;
+extern const bfd_target z80coff_vec;
extern const bfd_target z8kcoff_vec;
/* These are always included. */
@@ -747,8 +828,8 @@ 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[] = {
-
+static const bfd_target * const _bfd_target_vector[] =
+{
#ifdef SELECT_VECS
SELECT_VECS,
@@ -764,7 +845,6 @@ static const bfd_target * const _bfd_target_vector[] = {
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,
@@ -785,6 +865,10 @@ static const bfd_target * const _bfd_target_vector[] = {
&arm_epoc_pe_little_vec,
&arm_epoc_pei_big_vec,
&arm_epoc_pei_little_vec,
+ &arm_wince_pe_big_vec,
+ &arm_wince_pe_little_vec,
+ &arm_wince_pei_big_vec,
+ &arm_wince_pei_little_vec,
&armcoff_big_vec,
&armcoff_little_vec,
&armnetbsd_vec,
@@ -797,9 +881,12 @@ static const bfd_target * const _bfd_target_vector[] = {
&bfd_efi_app_ia32_vec,
&bfd_efi_app_x86_64_vec,
#ifdef BFD64
+ &bfd_efi_app_x86_64_vec,
&bfd_efi_app_ia64_vec,
#endif
&bfd_elf32_avr_vec,
+ &bfd_elf32_bfin_vec,
+ &bfd_elf32_bfinfdpic_vec,
/* This, and other vectors, may not be used in any *.mt configuration.
But that does not mean they are unnecessary. If configured with
@@ -807,10 +894,15 @@ static const bfd_target * const _bfd_target_vector[] = {
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_bigarm_symbian_vec,
+ &bfd_elf32_bigarm_vxworks_vec,
&bfd_elf32_bigmips_vec,
+ &bfd_elf32_bigmips_vxworks_vec,
+ &bfd_elf32_cr16_vec,
+ &bfd_elf32_cr16c_vec,
&bfd_elf32_cris_vec,
+ &bfd_elf32_crx_vec,
&bfd_elf32_d10v_vec,
&bfd_elf32_d30v_vec,
&bfd_elf32_dlx_big_vec,
@@ -819,9 +911,11 @@ static const bfd_target * const _bfd_target_vector[] = {
&bfd_elf32_frvfdpic_vec,
&bfd_elf32_h8300_vec,
&bfd_elf32_hppa_linux_vec,
+ &bfd_elf32_hppa_nbsd_vec,
&bfd_elf32_hppa_vec,
&bfd_elf32_i370_vec,
&bfd_elf32_i386_freebsd_vec,
+ &bfd_elf32_i386_vxworks_vec,
&bfd_elf32_i386_vec,
&bfd_elf32_i860_little_vec,
&bfd_elf32_i860_vec,
@@ -829,14 +923,19 @@ static const bfd_target * const _bfd_target_vector[] = {
#if 0
&bfd_elf32_ia64_big_vec,
#endif
+#ifdef BFD64
&bfd_elf32_ia64_hpux_big_vec,
+#endif
&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_littlearm_symbian_vec,
+ &bfd_elf32_littlearm_vxworks_vec,
&bfd_elf32_littlemips_vec,
+ &bfd_elf32_littlemips_vxworks_vec,
+ &bfd_elf32_m32c_vec,
&bfd_elf32_m32r_vec,
&bfd_elf32_m32rle_vec,
&bfd_elf32_m32rlin_vec,
@@ -847,8 +946,10 @@ static const bfd_target * const _bfd_target_vector[] = {
&bfd_elf32_m88k_vec,
&bfd_elf32_mcore_big_vec,
&bfd_elf32_mcore_little_vec,
+ &bfd_elf32_mep_vec,
&bfd_elf32_mn10200_vec,
&bfd_elf32_mn10300_vec,
+ &bfd_elf32_mt_vec,
&bfd_elf32_msp430_vec,
#ifdef BFD64
&bfd_elf32_nbigmips_vec,
@@ -861,14 +962,20 @@ static const bfd_target * const _bfd_target_vector[] = {
&bfd_elf32_pj_vec,
&bfd_elf32_pjl_vec,
&bfd_elf32_powerpc_vec,
+ &bfd_elf32_powerpc_vxworks_vec,
&bfd_elf32_powerpcle_vec,
&bfd_elf32_s390_vec,
+ &bfd_elf32_bigscore_vec,
+ &bfd_elf32_littlescore_vec,
&bfd_elf32_sh_vec,
&bfd_elf32_shblin_vec,
&bfd_elf32_shl_vec,
+ &bfd_elf32_shl_symbian_vec,
&bfd_elf32_shlin_vec,
&bfd_elf32_shlnbsd_vec,
+ &bfd_elf32_shlvxworks_vec,
&bfd_elf32_shnbsd_vec,
+ &bfd_elf32_shvxworks_vec,
#ifdef BFD64
&bfd_elf32_sh64_vec,
&bfd_elf32_sh64l_vec,
@@ -878,11 +985,14 @@ static const bfd_target * const _bfd_target_vector[] = {
&bfd_elf32_sh64blin_vec,
#endif
&bfd_elf32_sparc_vec,
+ &bfd_elf32_sparc_vxworks_vec,
+ &bfd_elf32_spu_vec,
&bfd_elf32_tradbigmips_vec,
&bfd_elf32_tradlittlemips_vec,
&bfd_elf32_us_cris_vec,
&bfd_elf32_v850_vec,
&bfd_elf32_vax_vec,
+ &bfd_elf32_xc16x_vec,
&bfd_elf32_xstormy16_vec,
&bfd_elf32_xtensa_be_vec,
&bfd_elf32_xtensa_le_vec,
@@ -909,10 +1019,12 @@ static const bfd_target * const _bfd_target_vector[] = {
&bfd_elf64_sh64lin_vec,
&bfd_elf64_sh64blin_vec,
&bfd_elf64_sparc_vec,
+ &bfd_elf64_sparc_freebsd_vec,
&bfd_elf64_tradbigmips_vec,
&bfd_elf64_tradlittlemips_vec,
+ &bfd_elf64_x86_64_freebsd_vec,
&bfd_elf64_x86_64_vec,
- &bfd_mmo_vec,
+ &bfd_mmo_vec,
#endif
&bfd_powerpc_pe_vec,
&bfd_powerpc_pei_vec,
@@ -963,6 +1075,11 @@ static const bfd_target * const _bfd_target_vector[] = {
&i386os9k_vec,
&i386pe_vec,
&i386pei_vec,
+#ifdef BFD64
+ &x86_64coff_vec,
+ &x86_64pe_vec,
+ &x86_64pei_vec,
+#endif
&i860coff_vec,
&icoff_big_vec,
&icoff_little_vec,
@@ -978,15 +1095,15 @@ static const bfd_target * const _bfd_target_vector[] = {
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,
+ &m88kopenbsd_vec,
&mach_o_be_vec,
&mach_o_le_vec,
&mach_o_fat_vec,
+ &maxqcoff_vec,
&mcore_pe_big_vec,
&mcore_pe_little_vec,
&mcore_pei_big_vec,
@@ -1065,6 +1182,7 @@ static const bfd_target * const _bfd_target_vector[] = {
&vms_vax_vec,
&w65_vec,
&we32kcoff_vec,
+ &z80coff_vec,
&z8kcoff_vec,
&bfd_elf32_am33lin_vec,
#endif /* not SELECT_VECS */
@@ -1186,7 +1304,6 @@ find_target (const char *name)
while (match->vector == NULL)
++match;
return match->vector;
- break;
}
}
@@ -1233,14 +1350,15 @@ SYNOPSIS
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.
+ 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 if @var{abfd} isn't <<NULL>>. This causes
+ <<bfd_check_format>> to loop over all the targets to find the
+ one that matches the file being read.
*/
const bfd_target *
@@ -1257,21 +1375,27 @@ bfd_find_target (const char *target_name, bfd *abfd)
/* 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];
+ target = bfd_default_vector[0];
else
- abfd->xvec = bfd_target_vector[0];
- return abfd->xvec;
+ target = bfd_target_vector[0];
+ if (abfd)
+ {
+ abfd->xvec = target;
+ abfd->target_defaulted = TRUE;
+ }
+ return target;
}
- abfd->target_defaulted = FALSE;
+ if (abfd)
+ abfd->target_defaulted = FALSE;
target = find_target (targname);
if (target == NULL)
return NULL;
- abfd->xvec = target;
+ if (abfd)
+ abfd->xvec = target;
return target;
}
diff --git a/contrib/binutils/bfd/tekhex.c b/contrib/binutils/bfd/tekhex.c
index f828fe7..78deaf9 100644
--- a/contrib/binutils/bfd/tekhex.c
+++ b/contrib/binutils/bfd/tekhex.c
@@ -1,29 +1,28 @@
/* BFD backend for Extended Tektronix Hex Format objects.
- Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002, 2003
- Free Software Foundation, Inc.
+ Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002,
+ 2003, 2004, 2007 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 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 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.
+ 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. */
+ 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., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
-/*
-SUBSECTION
+/* SUBSECTION
Tektronix Hex Format handling
-DESCRIPTION
+ DESCRIPTION
Tek Hex records can hold symbols and data, but not
relocations. Their main application is communication with
@@ -50,10 +49,10 @@ DESCRIPTION
up and output them when it's time to close the bfd.
A TekHex record looks like:
-EXAMPLE
+ EXAMPLE
%<block length><type><checksum><stuff><cr>
-DESCRIPTION
+ DESCRIPTION
Where
o length
is the number of bytes in the record not including the % sign.
@@ -63,180 +62,145 @@ DESCRIPTION
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
-*/
+ 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 "bfd.h"
#include "libbfd.h"
#include "libiberty.h"
typedef struct
- {
- bfd_vma low;
- bfd_vma high;
- } addr_range_type;
+{
+ bfd_vma low;
+ bfd_vma high;
+} addr_range_type;
typedef struct tekhex_symbol_struct
- {
-
- asymbol symbol;
- struct tekhex_symbol_struct *prev;
-
- } tekhex_symbol_type;
+{
+ 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
-...
-
-*/
+#define NOT_HEX 20
+#define NIBBLE(x) hex_value(x)
+#define HEX(buffer) ((NIBBLE ((buffer)[0]) << 4) + NIBBLE ((buffer)[1]))
+#define ISHEX(x) hex_p(x)
+#define TOHEX(d, x) \
+ (d)[1] = digs[(x) & 0xf]; \
+ (d)[0] = digs[((x)>>4)&0xf];
+
+/* 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 ()
+tekhex_init (void)
{
unsigned int i;
static bfd_boolean inited = FALSE;
@@ -248,27 +212,23 @@ tekhex_init ()
hex_init ();
val = 0;
for (i = 0; i < 10; i++)
- {
- sum_block[i + '0'] = val++;
- }
+ sum_block[i + '0'] = val++;
+
for (i = 'A'; i <= 'Z'; i++)
- {
- sum_block[i] = val++;
- }
+ 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++;
- }
+ sum_block[i] = val++;
}
}
-/* The maximum number of bytes on a line is FF */
+/* The maximum number of bytes on a line is FF. */
#define MAXCHUNK 0xff
-/* The number of bytes we fit onto a line on output */
+/* 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
@@ -287,12 +247,12 @@ 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;
- };
+{
+ char chunk_data[CHUNK_MASK + 1];
+ char chunk_init[CHUNK_MASK + 1];
+ bfd_vma vma;
+ struct data_struct *next;
+};
typedef struct tekhex_data_struct
{
@@ -304,59 +264,65 @@ typedef struct tekhex_data_struct
#define enda(x) (x->vma + x->size)
-static bfd_vma
-getvalue (srcp)
- char **srcp;
+static bfd_boolean
+getvalue (char **srcp, bfd_vma *valuep)
{
char *src = *srcp;
bfd_vma value = 0;
- unsigned int len = hex_value(*src++);
+ unsigned int len;
+
+ if (!ISHEX (*src))
+ return FALSE;
+ len = hex_value (*src++);
if (len == 0)
len = 16;
while (len--)
{
- value = value << 4 | hex_value(*src++);
+ if (!ISHEX (*src))
+ return FALSE;
+ value = value << 4 | hex_value (*src++);
}
+
*srcp = src;
- return value;
+ *valuep = value;
+ return TRUE;
}
-static unsigned int
-getsym (dstp, srcp)
- char *dstp;
- char **srcp;
+static bfd_boolean
+getsym (char *dstp, char **srcp, unsigned int *lenp)
{
char *src = *srcp;
unsigned int i;
- unsigned int len = hex_value(*src++);
+ unsigned int len;
+
+ if (!ISHEX (*src))
+ return FALSE;
+ 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;
+ *lenp = len;
+ return TRUE;
}
static struct data_struct *
-find_chunk (abfd, vma)
- bfd *abfd;
- bfd_vma vma;
+find_chunk (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;
- }
+ 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)));
+ /* No chunk for this address, so make one up. */
+ d = bfd_zalloc (abfd, (bfd_size_type) sizeof (struct data_struct));
if (!d)
return NULL;
@@ -369,12 +335,9 @@ find_chunk (abfd, vma)
}
static void
-insert_byte (abfd, value, addr)
- bfd *abfd;
- int value;
- bfd_vma addr;
+insert_byte (bfd *abfd, int value, bfd_vma addr)
{
- /* Find the chunk that this byte needs and put it in */
+ /* 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;
@@ -382,23 +345,25 @@ insert_byte (abfd, value, addr)
}
/* 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;
+ how big the data is. */
+
+static bfd_boolean
+first_phase (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 */
+ bfd_vma val;
+ char sym[17]; /* A symbol can only be 16chars long. */
switch (type)
{
case '6':
- /* Data record - read it and store it */
+ /* Data record - read it and store it. */
{
- bfd_vma addr = getvalue (&src);
+ bfd_vma addr;
+
+ if (!getvalue (&src, &addr))
+ return FALSE;
while (*src)
{
@@ -408,17 +373,18 @@ first_phase (abfd, type, src)
}
}
- return;
+ return TRUE;
case '3':
- /* Symbol record, read the segment */
- len = getsym (sym, &src);
+ /* Symbol record, read the segment. */
+ if (!getsym (sym, &src, &len))
+ return FALSE;
section = bfd_get_section_by_name (abfd, sym);
- if (section == (asection *) NULL)
+ if (section == NULL)
{
char *n = bfd_alloc (abfd, (bfd_size_type) len + 1);
if (!n)
- abort (); /* FIXME */
+ return FALSE;
memcpy (n, sym, len + 1);
section = bfd_make_section (abfd, n);
}
@@ -426,10 +392,13 @@ first_phase (abfd, type, src)
{
switch (*src)
{
- case '1': /* section range */
+ case '1': /* Section range. */
src++;
- section->vma = getvalue (&src);
- section->_raw_size = getvalue (&src) - section->vma;
+ if (!getvalue (&src, &section->vma))
+ return FALSE;
+ if (!getvalue (&src, &val))
+ return FALSE;
+ section->size = val - section->vma;
section->flags = SEC_HAS_CONTENTS | SEC_LOAD | SEC_ALLOC;
break;
case '0':
@@ -439,92 +408,100 @@ first_phase (abfd, type, src)
case '6':
case '7':
case '8':
- /* Symbols, add to section */
+ /* Symbols, add to section. */
{
bfd_size_type amt = sizeof (tekhex_symbol_type);
- tekhex_symbol_type *new =
- (tekhex_symbol_type *) bfd_alloc (abfd, amt);
+ tekhex_symbol_type *new = bfd_alloc (abfd, amt);
char stype = (*src);
if (!new)
- abort (); /* FIXME */
+ return FALSE;
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);
+ if (!getsym (sym, &src, &len))
+ return FALSE;
new->symbol.name = bfd_alloc (abfd, (bfd_size_type) len + 1);
if (!new->symbol.name)
- abort (); /* FIXME */
+ return FALSE;
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;
+ if (!getvalue (&src, &val))
+ return FALSE;
+ new->symbol.value = val - section->vma;
+ break;
}
+ default:
+ return FALSE;
}
}
}
+
+ return TRUE;
}
/* 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 *));
+static bfd_boolean
+pass_over (bfd *abfd, bfd_boolean (*func) (bfd *, int, char *))
{
unsigned int chars_on_line;
bfd_boolean eof = FALSE;
- /* To the front of the file */
+ /* To the front of the file. */
if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0)
- abort ();
+ return FALSE;
while (! eof)
{
- char buffer[MAXCHUNK];
- char *src = buffer;
+ char src[MAXCHUNK];
char type;
- /* Find first '%' */
+ /* 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);
- }
+ 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 */
+ /* Fetch the type and the length and the checksum. */
if (bfd_bread (src, (bfd_size_type) 5, abfd) != 5)
- abort (); /* FIXME */
+ return FALSE;
type = src[2];
if (!ISHEX (src[0]) || !ISHEX (src[1]))
break;
- chars_on_line = HEX (src) - 5; /* Already read five char */
+ /* Already read five chars. */
+ chars_on_line = HEX (src) - 5;
+
+ if (chars_on_line >= MAXCHUNK)
+ return FALSE;
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 */
+ return FALSE;
+
+ /* Put a null at the end. */
+ src[chars_on_line] = 0;
- func (abfd, type, src);
+ if (!func (abfd, type, src))
+ return FALSE;
}
+ return TRUE;
}
static long
-tekhex_canonicalize_symtab (abfd, table)
- bfd *abfd;
- asymbol **table;
+tekhex_canonicalize_symtab (bfd *abfd, asymbol **table)
{
tekhex_symbol_type *p = abfd->tdata.tekhex_data->symbols;
unsigned int c = bfd_get_symcount (abfd);
@@ -540,37 +517,33 @@ tekhex_canonicalize_symtab (abfd, table)
}
static long
-tekhex_get_symtab_upper_bound (abfd)
- bfd *abfd;
+tekhex_get_symtab_upper_bound (bfd *abfd)
{
return (abfd->symcount + 1) * (sizeof (struct tekhex_asymbol_struct *));
}
static bfd_boolean
-tekhex_mkobject (abfd)
- bfd *abfd;
+tekhex_mkobject (bfd *abfd)
{
tdata_type *tdata;
- tdata = (tdata_type *) bfd_alloc (abfd, (bfd_size_type) sizeof (tdata_type));
+ tdata = 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;
+ tdata->head = NULL;
+ tdata->symbols = NULL;
+ tdata->data = 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 */
+/* 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;
+tekhex_object_p (bfd *abfd)
{
char b[4];
@@ -581,27 +554,28 @@ tekhex_object_p (abfd)
return NULL;
if (b[0] != '%' || !ISHEX (b[1]) || !ISHEX (b[2]) || !ISHEX (b[3]))
- return (const bfd_target *) NULL;
+ return NULL;
tekhex_mkobject (abfd);
- pass_over (abfd, first_phase);
+ if (!pass_over (abfd, first_phase))
+ return NULL;
+
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;
+move_section_contents (bfd *abfd,
+ asection *section,
+ const void * 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_vma prev_number = 1; /* Nothing can have this as a high bit. */
+ struct data_struct *d = NULL;
BFD_ASSERT (offset == 0);
for (addr = section->vma; count != 0; count--, addr++)
@@ -611,21 +585,15 @@ move_section_contents (abfd, section, locationp, offset, count, get)
bfd_vma low_bits = addr & CHUNK_MASK;
if (chunk_number != prev_number)
- {
- /* Different chunk, so move pointer */
- d = find_chunk (abfd, chunk_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];
- }
+ *location = d->chunk_data[low_bits];
else
- {
- *location = 0;
- }
+ *location = 0;
}
else
{
@@ -634,52 +602,45 @@ move_section_contents (abfd, section, locationp, offset, count, get)
}
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;
+tekhex_get_section_contents (bfd *abfd,
+ asection *section,
+ void * 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;
+
+ return FALSE;
}
static bfd_boolean
-tekhex_set_arch_mach (abfd, arch, machine)
- bfd *abfd;
- enum bfd_architecture arch;
- unsigned long machine;
+tekhex_set_arch_mach (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,
- */
+/* 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;
+tekhex_set_section_contents (bfd *abfd,
+ sec_ptr section,
+ const void * 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 */
+ /* The first time around, allocate enough sections to hold all the chunks. */
asection *s = abfd->sections;
bfd_vma vma;
@@ -688,28 +649,25 @@ tekhex_set_section_contents (abfd, section, locationp, offset, bytes_to_do)
if (s->flags & SEC_LOAD)
{
for (vma = s->vma & ~(bfd_vma) CHUNK_MASK;
- vma < s->vma + s->_raw_size;
+ vma < s->vma + s->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;
+ return FALSE;
}
static void
-writevalue (dst, value)
- char **dst;
- bfd_vma value;
+writevalue (char **dst, bfd_vma value)
{
char *p = *dst;
int len;
@@ -737,9 +695,7 @@ writevalue (dst, value)
}
static void
-writesym (dst, sym)
- char **dst;
- const char *sym;
+writesym (char **dst, const char *sym)
{
char *p = *dst;
int len = (sym ? strlen (sym) : 0);
@@ -749,7 +705,6 @@ writesym (dst, sym)
*p++ = '0';
len = 16;
}
-
else
{
if (len == 0)
@@ -759,24 +714,17 @@ writesym (dst, sym)
len = 1;
}
else
- {
- *p++ = digs[len];
- }
+ *p++ = digs[len];
}
while (len--)
- {
- *p++ = *sym++;
- }
+ *p++ = *sym++;
+
*dst = p;
}
static void
-out (abfd, type, start, end)
- bfd *abfd;
- int type;
- char *start;
- char *end;
+out (bfd *abfd, int type, char *start, char *end)
{
int sum = 0;
char *s;
@@ -788,13 +736,11 @@ out (abfd, type, start, end)
front[3] = type;
for (s = start; s < end; s++)
- {
- sum += sum_block[(unsigned char) *s];
- }
+ sum += sum_block[(unsigned char) *s];
- sum += sum_block[(unsigned char) front[1]]; /* length */
+ sum += sum_block[(unsigned char) front[1]]; /* Length. */
sum += sum_block[(unsigned char) front[2]];
- sum += sum_block[(unsigned char) front[3]]; /* type */
+ sum += sum_block[(unsigned char) front[3]]; /* Type. */
TOHEX (front + 4, sum);
if (bfd_bwrite (front, (bfd_size_type) 6, abfd) != 6)
abort ();
@@ -805,10 +751,8 @@ out (abfd, type, start, end)
}
static bfd_boolean
-tekhex_write_object_contents (abfd)
- bfd *abfd;
+tekhex_write_object_contents (bfd *abfd)
{
- int bytes_written;
char buffer[100];
asymbol **p;
asection *s;
@@ -816,11 +760,9 @@ tekhex_write_object_contents (abfd)
tekhex_init ();
- bytes_written = 0;
-
- /* And the raw data */
+ /* And the raw data. */
for (d = abfd->tdata.tekhex_data->data;
- d != (struct data_struct *) NULL;
+ d != NULL;
d = d->next)
{
int low;
@@ -828,18 +770,16 @@ tekhex_write_object_contents (abfd)
const int span = 32;
int addr;
- /* Write it in blocks of 32 bytes */
-
+ /* Write it in blocks of 32 bytes. */
for (addr = 0; addr < CHUNK_MASK + 1; addr += span)
{
int need = 0;
- /* Check to see if necessary */
+ /* Check to see if necessary. */
for (low = 0; !need && low < span; low++)
- {
- if (d->chunk_init[addr + low])
- need = 1;
- }
+ if (d->chunk_init[addr + low])
+ need = 1;
+
if (need)
{
char *dst = buffer;
@@ -854,19 +794,20 @@ tekhex_write_object_contents (abfd)
}
}
}
- /* write all the section headers for the sections */
- for (s = abfd->sections; s != (asection *) NULL; s = s->next)
+
+ /* Write all the section headers for the sections. */
+ for (s = abfd->sections; s != NULL; s = s->next)
{
char *dst = buffer;
writesym (&dst, s->name);
*dst++ = '1';
writevalue (&dst, s->vma);
- writevalue (&dst, s->vma + s->_raw_size);
+ writevalue (&dst, s->vma + s->size);
out (abfd, '3', buffer, dst);
}
- /* And the symbols */
+ /* And the symbols. */
if (abfd->outsymbols)
{
for (p = abfd->outsymbols; *p; p++)
@@ -874,7 +815,8 @@ tekhex_write_object_contents (abfd)
int section_code = bfd_decode_symclass (*p);
if (section_code != '?')
- { /* do not include debug symbols */
+ {
+ /* Do not include debug symbols. */
asymbol *sym = *p;
char *dst = buffer;
@@ -917,50 +859,45 @@ tekhex_write_object_contents (abfd)
}
}
- /* And the terminator */
+ /* 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;
-
+tekhex_sizeof_headers (bfd *abfd ATTRIBUTE_UNUSED,
+ struct bfd_link_info *info ATTRIBUTE_UNUSED)
{
return 0;
}
static asymbol *
-tekhex_make_empty_symbol (abfd)
- bfd *abfd;
+tekhex_make_empty_symbol (bfd *abfd)
{
bfd_size_type amt = sizeof (struct tekhex_symbol_struct);
- tekhex_symbol_type *new = (tekhex_symbol_type *) bfd_zalloc (abfd, amt);
+ tekhex_symbol_type *new = bfd_zalloc (abfd, amt);
if (!new)
return NULL;
new->symbol.the_bfd = abfd;
- new->prev = (struct tekhex_symbol_struct *) NULL;
+ new->prev = NULL;
return &(new->symbol);
}
static void
-tekhex_get_symbol_info (ignore_abfd, symbol, ret)
- bfd *ignore_abfd ATTRIBUTE_UNUSED;
- asymbol *symbol;
- symbol_info *ret;
+tekhex_get_symbol_info (bfd *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;
+tekhex_print_symbol (bfd *abfd,
+ void * filep,
+ asymbol *symbol,
+ bfd_print_symbol_type how)
{
FILE *file = (FILE *) filep;
@@ -976,66 +913,64 @@ tekhex_print_symbol (abfd, filep, symbol, how)
{
const char *section_name = symbol->section->name;
- bfd_print_symbol_vandf (abfd, (PTR) file, symbol);
+ bfd_print_symbol_vandf (abfd, (void *) file, symbol);
fprintf (file, " %-5s %s",
- section_name,
- symbol->name);
+ 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
+#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_target_special_symbol ((bfd_boolean (*) (bfd *, asymbol *)) bfd_false)
+#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_find_inliner_info _bfd_nosymbols_find_inliner_info
+#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_is_group_section bfd_generic_is_group_section
+#define tekhex_bfd_discard_group bfd_generic_discard_group
+#define tekhex_section_already_linked _bfd_generic_section_already_linked
+#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 */
+ "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),
+ 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 */
+ | 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_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_getb16, bfd_getb_signed_16, bfd_putb16, /* Headers. */
{
_bfd_dummy_target,
- tekhex_object_p, /* bfd_check_format */
+ tekhex_object_p, /* bfd_check_format. */
_bfd_dummy_target,
_bfd_dummy_target,
},
@@ -1045,7 +980,7 @@ const bfd_target tekhex_vec =
_bfd_generic_mkarchive,
bfd_false,
},
- { /* bfd_write_contents */
+ { /* bfd_write_contents. */
bfd_false,
tekhex_write_object_contents,
_bfd_write_archive_contents,
@@ -1064,5 +999,5 @@ const bfd_target tekhex_vec =
NULL,
- (PTR) 0
+ NULL
};
diff --git a/contrib/binutils/bfd/trad-core.c b/contrib/binutils/bfd/trad-core.c
index f8c03d7..79b869c 100644
--- a/contrib/binutils/bfd/trad-core.c
+++ b/contrib/binutils/bfd/trad-core.c
@@ -1,6 +1,6 @@
/* BFD back end for traditional Unix core files (U-area and raw sections)
Copyright 1988, 1989, 1991, 1992, 1993, 1994, 1995, 1996, 1998, 1999,
- 2000, 2001, 2002, 2003, 2004
+ 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
Free Software Foundation, Inc.
Written by John Gilmore of Cygnus Support.
@@ -18,10 +18,10 @@ 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. */
+Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
#include "libaout.h" /* BFD a.out internal data structures */
@@ -65,8 +65,7 @@ struct trad_core_struct
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));
+#define trad_unix_core_file_matches_executable_p generic_core_file_matches_executable_p
static void swap_abort PARAMS ((void));
/* Handle 4.2-style (and perhaps also sysV-style) core dump file. */
@@ -80,6 +79,7 @@ trad_unix_core_file_p (abfd)
struct user u;
struct trad_core_struct *rawptr;
bfd_size_type amt;
+ flagword flags;
#ifdef TRAD_CORE_USER_OFFSET
/* If defined, this macro is the file position of the user struct. */
@@ -109,33 +109,29 @@ trad_unix_core_file_p (abfd)
/* Check that the size claimed is no greater than the file size. */
{
- FILE *stream = bfd_cache_lookup (abfd);
struct stat statbuf;
- if (stream == NULL)
+
+ if (bfd_stat (abfd, &statbuf) < 0)
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
+
+ if ((ufile_ptr) NBPG * (UPAGES + u.u_dsize
#ifdef TRAD_CORE_DSIZE_INCLUDES_TSIZE
- - u.u_tsize
+ - u.u_tsize
#endif
- + u.u_ssize))
- > (unsigned long) statbuf.st_size)
+ + u.u_ssize)
+ > (ufile_ptr) 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)
+ if (((ufile_ptr) 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
+ + TRAD_CORE_EXTRA_SIZE_ALLOWED
#endif
- )
- < (unsigned long) statbuf.st_size)
+ )
+ < (ufile_ptr) 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). */
@@ -160,27 +156,27 @@ trad_unix_core_file_p (abfd)
/* Create the sections. */
- core_stacksec(abfd) = bfd_make_section_anyway (abfd, ".stack");
+ flags = SEC_ALLOC + SEC_LOAD + SEC_HAS_CONTENTS;
+ core_stacksec(abfd) = bfd_make_section_anyway_with_flags (abfd, ".stack",
+ flags);
if (core_stacksec (abfd) == NULL)
goto fail;
- core_datasec (abfd) = bfd_make_section_anyway (abfd, ".data");
+ core_datasec (abfd) = bfd_make_section_anyway_with_flags (abfd, ".data",
+ flags);
if (core_datasec (abfd) == NULL)
goto fail;
- core_regsec (abfd) = bfd_make_section_anyway (abfd, ".reg");
+ core_regsec (abfd) = bfd_make_section_anyway_with_flags (abfd, ".reg",
+ SEC_HAS_CONTENTS);
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
+ core_datasec (abfd)->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 */
+ core_stacksec (abfd)->size = NBPG * u.u_ssize;
+ core_regsec (abfd)->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. */
@@ -257,14 +253,6 @@ trad_unix_core_file_failing_signal (ignore_abfd)
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
diff --git a/contrib/binutils/bfd/version.h b/contrib/binutils/bfd/version.h
index ab4618d..88dbbce 100644
--- a/contrib/binutils/bfd/version.h
+++ b/contrib/binutils/bfd/version.h
@@ -1,3 +1,4 @@
-#define BFD_VERSION_DATE 20040523
+#define BFD_VERSION_DATE 20070703
#define BFD_VERSION @bfd_version@
-#define BFD_VERSION_STRING @bfd_version_string@
+#define BFD_VERSION_STRING @bfd_version_package@ @bfd_version_string@
+#define REPORT_BUGS_TO @report_bugs_to@
diff --git a/contrib/binutils/bfd/xcoff-target.h b/contrib/binutils/bfd/xcoff-target.h
index 7bf3de7..b912fdf 100644
--- a/contrib/binutils/bfd/xcoff-target.h
+++ b/contrib/binutils/bfd/xcoff-target.h
@@ -1,23 +1,23 @@
/* Common definitions for backends based on IBM RS/6000 "XCOFF64" files.
- Copyright 2000, 2001, 2002
+ Copyright 2000, 2001, 2002, 2004, 2005, 2006
Free Software Foundation, Inc.
Contributed by Cygnus Support.
-This file is part of BFD, the Binary File Descriptor library.
+ 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 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.
+ 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. */
+ 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., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
/* Internalcoff.h and coffcode.h modify themselves based on this flag. */
#define RS6000COFF_C 1
@@ -32,7 +32,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
| (howto->bitsize - 1)); \
}
-#define COFF_DEFAULT_SECTION_ALIGNMENT_POWER (3)
+#define COFF_DEFAULT_SECTION_ALIGNMENT_POWER 3
#define COFF_LONG_FILENAMES
@@ -40,74 +40,71 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#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 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_is_target_special_symbol ((bfd_boolean (*) (bfd *, asymbol *)) bfd_false)
+#define coff_bfd_reloc_type_lookup _bfd_xcoff_reloc_type_lookup
+#define coff_relocate_section _bfd_ppc_xcoff_relocate_section
+#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
+#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_section_already_linked _bfd_generic_section_already_linked
+#define _bfd_xcoff_bfd_link_split_section coff_bfd_link_split_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
+
+#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 ();
+extern const bfd_target * rs6000coff_core_p (bfd *);
+extern bfd_boolean rs6000coff_core_file_matches_executable_p (bfd *, bfd*);
#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
+extern char *rs6000coff_core_file_failing_command (bfd *);
+#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
+extern int rs6000coff_core_file_failing_signal (bfd *);
+#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
+#undef CORE_FILE_P
#define CORE_FILE_P lynx_core_file_p
-extern const bfd_target *lynx_core_file_p PARAMS ((bfd *abfd));
+extern const bfd_target *lynx_core_file_p (bfd *);
-extern bfd_boolean lynx_core_file_matches_executable_p
- PARAMS ((bfd *core_bfd, bfd *exec_bfd));
+extern bfd_boolean lynx_core_file_matches_executable_p (bfd *, 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
+extern char *lynx_core_file_failing_command (bfd *);
+#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
+extern int lynx_core_file_failing_signal (bfd *);
+#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)
+ ((bfd_boolean (*) (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. */
@@ -118,31 +115,28 @@ extern int lynx_core_file_failing_signal PARAMS ((bfd *abfd));
#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));
+extern bfd_boolean _bfd_xcoff_mkobject (bfd *);
+extern bfd_boolean _bfd_xcoff_copy_private_bfd_data (bfd *, bfd *);
+extern bfd_boolean _bfd_xcoff_is_local_label_name (bfd *, const char *);
+extern void _bfd_xcoff_rtype2howto (arelent *, struct internal_reloc *);
+extern bfd_boolean _bfd_xcoff_slurp_armap (bfd *);
+extern void * _bfd_xcoff_read_ar_hdr (bfd *);
+extern bfd * _bfd_xcoff_openr_next_archived_file (bfd *, bfd *);
+extern int _bfd_xcoff_generic_stat_arch_elt (bfd *, struct stat *);
+extern bfd_boolean _bfd_xcoff_write_armap (bfd *, unsigned int, struct orl *, unsigned int, int);
+extern bfd_boolean _bfd_xcoff_write_archive_contents (bfd *);
+extern int _bfd_xcoff_sizeof_headers (bfd *, struct bfd_link_info *);
+extern void _bfd_xcoff_swap_sym_in (bfd *, void *, void *);
+extern unsigned int _bfd_xcoff_swap_sym_out (bfd *, void *, void *);
+extern void _bfd_xcoff_swap_aux_in (bfd *, void *, int, int, int, int, void *);
+extern unsigned int _bfd_xcoff_swap_aux_out (bfd *, void *, int, int, int, int, void *);
+extern reloc_howto_type * _bfd_xcoff_reloc_type_lookup (bfd *, bfd_reloc_code_real_type);
+extern const bfd_target * _bfd_xcoff_archive_p (bfd *);
#ifndef coff_SWAP_sym_in
-#define coff_SWAP_sym_in _bfd_xcoff_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_in _bfd_xcoff_swap_aux_in
#define coff_SWAP_aux_out _bfd_xcoff_swap_aux_out
#endif
@@ -154,30 +148,30 @@ 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 */
+ BFD_ENDIAN_BIG, /* Data byte order is big. */
+ BFD_ENDIAN_BIG, /* Header byte order is big. */
- (HAS_RELOC | EXEC_P | /* object flags */
+ (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 */
+ (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* Section flags. */
+ 0, /* Leading char. */
+ '/', /* AR_pad_char. */
+ 15, /* AR_max_namelen??? FIXME. */
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_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_getb16, bfd_getb_signed_16, bfd_putb16,/* Headers. */
- {_bfd_dummy_target, coff_object_p, /* bfd_check_format */
+ {_bfd_dummy_target, coff_object_p, /* bfd_check_format. */
_bfd_xcoff_archive_p, CORE_FILE_P},
- {bfd_false, coff_mkobject, /* bfd_set_format */
+ {bfd_false, coff_mkobject, /* bfd_set_format. */
_bfd_generic_mkarchive, bfd_false},
- {bfd_false, coff_write_object_contents, /* bfd_write_contents */
+ {bfd_false, coff_write_object_contents, /* bfd_write_contents. */
_bfd_xcoff_write_archive_contents, bfd_false},
BFD_JUMP_TABLE_GENERIC (coff),
diff --git a/contrib/binutils/bfd/xcofflink.c b/contrib/binutils/bfd/xcofflink.c
index ccd82be..b02886a 100644
--- a/contrib/binutils/bfd/xcofflink.c
+++ b/contrib/binutils/bfd/xcofflink.c
@@ -1,6 +1,6 @@
/* POWER/PowerPC XCOFF linker support.
- Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
- Free Software Foundation, Inc.
+ Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
+ 2005, 2006, 2007 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.
@@ -17,10 +17,10 @@
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. */
+ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "bfdlink.h"
#include "libbfd.h"
#include "coff/internal.h"
@@ -30,7 +30,8 @@
/* This file holds the XCOFF linker code. */
-#define STRING_SIZE_SIZE (4)
+#undef STRING_SIZE_SIZE
+#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. */
@@ -65,7 +66,8 @@ struct xcoff_link_section_info
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
+ {
struct xcoff_toc_rel_hash *next;
struct xcoff_link_hash_entry *h;
struct internal_reloc *rel;
@@ -113,40 +115,8 @@ struct xcoff_final_link_info
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));
+static bfd_boolean xcoff_mark (struct bfd_link_info *, asection *);
+
/* Routines to read XCOFF dynamic information. This don't really
@@ -156,14 +126,12 @@ static int xcoff_sort_relocs PARAMS ((const PTR, const PTR));
/* Read the contents of a section. */
static bfd_boolean
-xcoff_get_section_contents (abfd, sec)
- bfd *abfd;
- asection *sec;
+xcoff_get_section_contents (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;
@@ -171,15 +139,15 @@ xcoff_get_section_contents (abfd, sec)
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;
+ bfd_byte *contents;
- if (! bfd_get_section_contents (abfd, sec,
- coff_section_data (abfd, sec)->contents,
- (file_ptr) 0, sec->_raw_size))
- return FALSE;
+ if (! bfd_malloc_and_get_section (abfd, sec, &contents))
+ {
+ if (contents != NULL)
+ free (contents);
+ return FALSE;
+ }
+ coff_section_data (abfd, sec)->contents = contents;
}
return TRUE;
@@ -188,8 +156,7 @@ xcoff_get_section_contents (abfd, sec)
/* Get the size required to hold the dynamic symbols. */
long
-_bfd_xcoff_get_dynamic_symtab_upper_bound (abfd)
- bfd *abfd;
+_bfd_xcoff_get_dynamic_symtab_upper_bound (bfd *abfd)
{
asection *lsec;
bfd_byte *contents;
@@ -212,7 +179,7 @@ _bfd_xcoff_get_dynamic_symtab_upper_bound (abfd)
return -1;
contents = coff_section_data (abfd, lsec)->contents;
- bfd_xcoff_swap_ldhdr_in (abfd, (PTR) contents, &ldhdr);
+ bfd_xcoff_swap_ldhdr_in (abfd, (void *) contents, &ldhdr);
return (ldhdr.l_nsyms + 1) * sizeof (asymbol *);
}
@@ -220,9 +187,7 @@ _bfd_xcoff_get_dynamic_symtab_upper_bound (abfd)
/* Get the dynamic symbols. */
long
-_bfd_xcoff_canonicalize_dynamic_symtab (abfd, psyms)
- bfd *abfd;
- asymbol **psyms;
+_bfd_xcoff_canonicalize_dynamic_symtab (bfd *abfd, asymbol **psyms)
{
asection *lsec;
bfd_byte *contents;
@@ -254,8 +219,7 @@ _bfd_xcoff_canonicalize_dynamic_symtab (abfd, psyms)
strings = (char *) contents + ldhdr.l_stoff;
- symbuf = ((coff_symbol_type *)
- bfd_zalloc (abfd, ldhdr.l_nsyms * sizeof (coff_symbol_type)));
+ symbuf = bfd_zalloc (abfd, ldhdr.l_nsyms * sizeof (* symbuf));
if (symbuf == NULL)
return -1;
@@ -297,7 +261,6 @@ _bfd_xcoff_canonicalize_dynamic_symtab (abfd, psyms)
/* FIXME: We have no way to record the other information stored
with the loader symbol. */
-
*psyms = (asymbol *) symbuf;
}
@@ -309,8 +272,7 @@ _bfd_xcoff_canonicalize_dynamic_symtab (abfd, psyms)
/* Get the size required to hold the dynamic relocs. */
long
-_bfd_xcoff_get_dynamic_reloc_upper_bound (abfd)
- bfd *abfd;
+_bfd_xcoff_get_dynamic_reloc_upper_bound (bfd *abfd)
{
asection *lsec;
bfd_byte *contents;
@@ -341,10 +303,9 @@ _bfd_xcoff_get_dynamic_reloc_upper_bound (abfd)
/* Get the dynamic relocs. */
long
-_bfd_xcoff_canonicalize_dynamic_reloc (abfd, prelocs, syms)
- bfd *abfd;
- arelent **prelocs;
- asymbol **syms;
+_bfd_xcoff_canonicalize_dynamic_reloc (bfd *abfd,
+ arelent **prelocs,
+ asymbol **syms)
{
asection *lsec;
bfd_byte *contents;
@@ -371,7 +332,7 @@ _bfd_xcoff_canonicalize_dynamic_reloc (abfd, prelocs, syms)
bfd_xcoff_swap_ldhdr_in (abfd, contents, &ldhdr);
- relbuf = (arelent *) bfd_alloc (abfd, ldhdr.l_nreloc * sizeof (arelent));
+ relbuf = bfd_alloc (abfd, ldhdr.l_nreloc * sizeof (arelent));
if (relbuf == NULL)
return -1;
@@ -439,20 +400,18 @@ _bfd_xcoff_canonicalize_dynamic_reloc (abfd, prelocs, syms)
/* 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;
+xcoff_link_hash_newfunc (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;
+ if (ret == NULL)
+ ret = bfd_hash_allocate (table, sizeof (* ret));
+ if (ret == NULL)
+ return NULL;
/* Call the allocation method of the superclass. */
ret = ((struct xcoff_link_hash_entry *)
@@ -477,19 +436,19 @@ xcoff_link_hash_newfunc (entry, table, string)
/* Create a XCOFF link hash table. */
struct bfd_link_hash_table *
-_bfd_xcoff_bfd_link_hash_table_create (abfd)
- bfd *abfd;
+_bfd_xcoff_bfd_link_hash_table_create (bfd *abfd)
{
struct xcoff_link_hash_table *ret;
- bfd_size_type amt = sizeof (struct xcoff_link_hash_table);
+ bfd_size_type amt = sizeof (* ret);
- 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))
+ ret = bfd_malloc (amt);
+ if (ret == NULL)
+ return NULL;
+ if (!_bfd_link_hash_table_init (&ret->root, abfd, xcoff_link_hash_newfunc,
+ sizeof (struct xcoff_link_hash_entry)))
{
free (ret);
- return (struct bfd_link_hash_table *) NULL;
+ return NULL;
}
ret->debug_strtab = _bfd_xcoff_stringtab_init ();
@@ -517,8 +476,7 @@ _bfd_xcoff_bfd_link_hash_table_create (abfd)
/* Free a XCOFF link hash table. */
void
-_bfd_xcoff_bfd_link_hash_table_free (hash)
- struct bfd_link_hash_table *hash;
+_bfd_xcoff_bfd_link_hash_table_free (struct bfd_link_hash_table *hash)
{
struct xcoff_link_hash_table *ret = (struct xcoff_link_hash_table *) hash;
@@ -532,16 +490,13 @@ _bfd_xcoff_bfd_link_hash_table_free (hash)
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;
+xcoff_read_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)
@@ -557,8 +512,7 @@ xcoff_read_internal_relocs (abfd, sec, cache, external_relocs,
&& enclosing->reloc_count > 0)
{
if (_bfd_coff_read_internal_relocs (abfd, enclosing, TRUE,
- external_relocs, FALSE,
- (struct internal_reloc *) NULL)
+ external_relocs, FALSE, NULL)
== NULL)
return NULL;
}
@@ -585,215 +539,64 @@ xcoff_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. */
+/* This function is used to add symbols from a dynamic object to the
+ global symbol table. */
static bfd_boolean
-xcoff_link_check_dynamic_ar_symbols (abfd, info, pneeded)
- bfd *abfd;
- struct bfd_link_info *info;
- bfd_boolean *pneeded;
+xcoff_link_add_dynamic_symbols (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;
- *pneeded = FALSE;
+ /* 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)
{
- /* There are no symbols, so don't try to include it. */
- return TRUE;
+ (*_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;
@@ -801,12 +604,13 @@ xcoff_link_check_dynamic_ar_symbols (abfd, info, pneeded)
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;
+ struct xcoff_link_hash_entry *h;
bfd_xcoff_swap_ldsym_in (abfd, elsym, &ldsym);
@@ -823,24 +627,109 @@ xcoff_link_check_dynamic_ar_symbols (abfd, info, pneeded)
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
+ /* 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. */
- if (h != NULL
- && h->type == bfd_link_hash_undefined
- && (((struct xcoff_link_hash_entry *) h)->flags
- & XCOFF_DEF_DYNAMIC) == 0)
+
+ 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)
{
- if (! (*info->callbacks->add_archive_element) (info, abfd, name))
- return FALSE;
- *pneeded = TRUE;
- return TRUE;
+ 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. */
}
- }
- /* We do not need this shared object. */
+ 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)
{
@@ -848,73 +737,56 @@ xcoff_link_check_dynamic_ar_symbols (abfd, info, pneeded)
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;
+ /* Record this file in the import files. */
+ n = bfd_alloc (abfd, (bfd_size_type) sizeof (struct xcoff_import_file));
+ if (n == NULL)
+ return FALSE;
+ n->next = NULL;
- if (count < 2)
+ /* 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)
{
- if (count == 1 && relocs[0].r_vaddr < address)
- return 1;
- else
- return 0;
+ bname = bfd_get_filename (abfd);
+ mname = "";
}
-
- min = 0;
- max = count;
-
- /* Do a binary search over (min,max]. */
- while (min + 1 < max)
+ else
{
- 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;
- }
+ 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;
- if (relocs[min].r_vaddr < address)
- return min + 1;
+ /* 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;
- while (min > 0
- && relocs[min - 1].r_vaddr == address)
- --min;
+ xcoff_data (abfd)->import_file_id = c;
- return min;
+ return TRUE;
}
-
/* 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)
+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. */
@@ -922,30 +794,27 @@ xcoff_link_create_extra_sections(bfd * abfd, struct bfd_link_info *info)
if (xcoff_hash_table (info)->loader_section == NULL)
{
asection *lsec;
+ flagword flags = SEC_HAS_CONTENTS | SEC_IN_MEMORY;
- lsec = bfd_make_section_anyway (abfd, ".loader");
+ lsec = bfd_make_section_anyway_with_flags (abfd, ".loader", flags);
if (lsec == NULL)
- {
- goto end_return;
- }
+ 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;
+ flagword flags = (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS
+ | SEC_IN_MEMORY);
- lsec = bfd_make_section_anyway (abfd, ".gl");
+ lsec = bfd_make_section_anyway_with_flags (abfd, ".gl", flags);
if (lsec == NULL)
- {
- goto end_return;
- }
+ 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;
}
@@ -953,16 +822,14 @@ xcoff_link_create_extra_sections(bfd * abfd, struct bfd_link_info *info)
if (xcoff_hash_table (info)->toc_section == NULL)
{
asection *tsec;
+ flagword flags = (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS
+ | SEC_IN_MEMORY);
- tsec = bfd_make_section_anyway (abfd, ".tc");
+ tsec = bfd_make_section_anyway_with_flags (abfd, ".tc", flags);
if (tsec == NULL)
- {
- goto end_return;
- }
+ 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;
}
@@ -970,16 +837,14 @@ xcoff_link_create_extra_sections(bfd * abfd, struct bfd_link_info *info)
if (xcoff_hash_table (info)->descriptor_section == NULL)
{
asection *dsec;
+ flagword flags = (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS
+ | SEC_IN_MEMORY);
- dsec = bfd_make_section_anyway (abfd, ".ds");
+ dsec = bfd_make_section_anyway_with_flags (abfd, ".ds", flags);
if (dsec == NULL)
- {
- goto end_return;
- }
+ 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;
}
@@ -988,14 +853,13 @@ xcoff_link_create_extra_sections(bfd * abfd, struct bfd_link_info *info)
&& info->strip != strip_all)
{
asection *dsec;
+ flagword flags = SEC_HAS_CONTENTS | SEC_IN_MEMORY;
- dsec = bfd_make_section_anyway (abfd, ".debug");
+ dsec = bfd_make_section_anyway_with_flags (abfd, ".debug", flags);
if (dsec == NULL)
- {
- goto end_return;
- }
+ goto end_return;
+
xcoff_hash_table (info)->debug_section = dsec;
- dsec->flags |= SEC_HAS_CONTENTS | SEC_IN_MEMORY;
}
}
@@ -1006,6 +870,55 @@ xcoff_link_create_extra_sections(bfd * abfd, struct bfd_link_info *info)
return return_value;
}
+/* 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 (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;
+}
+
/* 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
@@ -1025,9 +938,7 @@ xcoff_link_create_extra_sections(bfd * abfd, struct bfd_link_info *info)
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;
+xcoff_link_add_symbols (bfd *abfd, struct bfd_link_info *info)
{
unsigned int n_tmask;
unsigned int n_btshft;
@@ -1062,7 +973,7 @@ xcoff_link_add_symbols (abfd, info)
return FALSE;
}
- /* create the loader, toc, gl, ds and debug sections, if needed */
+ /* Create the loader, toc, gl, ds and debug sections, if needed. */
if (! xcoff_link_create_extra_sections (abfd, info))
goto error_return;
@@ -1087,7 +998,7 @@ xcoff_link_add_symbols (abfd, info)
/* 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);
+ sym_hash = 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;
@@ -1096,7 +1007,7 @@ xcoff_link_add_symbols (abfd, info)
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);
+ csect_cache = bfd_zalloc (abfd, amt);
if (csect_cache == NULL && symcount != 0)
goto error_return;
xcoff_data (abfd)->csects = csect_cache;
@@ -1108,7 +1019,7 @@ xcoff_link_add_symbols (abfd, info)
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);
+ reloc_info = bfd_zmalloc (amt);
if (reloc_info == NULL)
goto error_return;
@@ -1117,17 +1028,15 @@ xcoff_link_add_symbols (abfd, info)
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);
+ xcoff_read_internal_relocs (abfd, o, TRUE, NULL, FALSE, NULL);
amt = o->reloc_count;
amt *= sizeof (asection *);
- reloc_info[o->target_index].csects = (asection **) bfd_zmalloc (amt);
+ reloc_info[o->target_index].csects = bfd_zmalloc (amt);
if (reloc_info[o->target_index].csects == NULL)
goto error_return;
}
@@ -1135,18 +1044,16 @@ xcoff_link_add_symbols (abfd, info)
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);
+ linenos = 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;
-
}
}
@@ -1174,13 +1081,12 @@ xcoff_link_add_symbols (abfd, info)
bfd_vma value;
struct xcoff_link_hash_entry *set_toc;
- bfd_coff_swap_sym_in (abfd, (PTR) esym, (PTR) &sym);
+ bfd_coff_swap_sym_in (abfd, (void *) esym, (void *) &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
@@ -1225,12 +1131,11 @@ xcoff_link_add_symbols (abfd, info)
&& csect != NULL
&& ISFCN (sym.n_type))
{
-
union internal_auxent auxlin;
- bfd_coff_swap_aux_in (abfd, (PTR) (esym + symesz),
+ bfd_coff_swap_aux_in (abfd, (void *) (esym + symesz),
sym.n_type, sym.n_sclass,
- 0, sym.n_numaux, (PTR) &auxlin);
+ 0, sym.n_numaux, (void *) &auxlin);
if (auxlin.x_sym.x_fcnary.x_fcn.x_lnnoptr != 0)
{
@@ -1241,14 +1146,14 @@ xcoff_link_add_symbols (abfd, info)
if (enclosing == NULL)
{
(*_bfd_error_handler)
- (_("%s: `%s' has line numbers but no enclosing section"),
- bfd_archive_filename (abfd), name);
+ (_("%B: `%s' has line numbers but no enclosing section"),
+ 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 */
+ /* Explicit cast to bfd_signed_vma for compiler. */
if (linoff < (bfd_signed_vma) (enclosing->lineno_count * linesz))
{
struct internal_lineno lin;
@@ -1256,7 +1161,7 @@ xcoff_link_add_symbols (abfd, info)
linpstart = (reloc_info[enclosing->target_index].linenos
+ linoff);
- bfd_coff_swap_lineno_in (abfd, (PTR) linpstart, (PTR) &lin);
+ bfd_coff_swap_lineno_in (abfd, (void *) linpstart, (void *) &lin);
if (lin.l_lnno == 0
&& ((bfd_size_type) lin.l_addr.l_symndx
== ((esym
@@ -1271,8 +1176,8 @@ xcoff_link_add_symbols (abfd, info)
linp < linpend;
linp += linesz)
{
- bfd_coff_swap_lineno_in (abfd, (PTR) linp,
- (PTR) &lin);
+ bfd_coff_swap_lineno_in (abfd, (void *) linp,
+ (void *) &lin);
if (lin.l_lnno == 0)
break;
}
@@ -1290,21 +1195,20 @@ xcoff_link_add_symbols (abfd, info)
}
/* 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);
+ (_("%B: class %d symbol `%s' has no aux entries"),
+ 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),
+ (void *) (esym + symesz * sym.n_numaux),
sym.n_type, sym.n_sclass,
sym.n_numaux - 1, sym.n_numaux,
- (PTR) &aux);
+ (void *) &aux);
smtyp = SMTYP_SMTYP (aux.x_csect.x_smtyp);
@@ -1317,8 +1221,8 @@ xcoff_link_add_symbols (abfd, info)
{
default:
(*_bfd_error_handler)
- (_("%s: symbol `%s' has unrecognized csect type %d"),
- bfd_archive_filename (abfd), name, smtyp);
+ (_("%B: symbol `%s' has unrecognized csect type %d"),
+ abfd, name, smtyp);
bfd_set_error (bfd_error_bad_value);
goto error_return;
@@ -1329,8 +1233,8 @@ xcoff_link_add_symbols (abfd, info)
|| 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,
+ (_("%B: bad XTY_ER symbol `%s': class %d scnum %d scnlen %d"),
+ abfd, name, sym.n_sclass, sym.n_scnum,
aux.x_csect.x_scnlen.l);
bfd_set_error (bfd_error_bad_value);
goto error_return;
@@ -1365,9 +1269,8 @@ xcoff_link_add_symbols (abfd, info)
|| 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);
+ (_("%B: XMC_TC0 symbol `%s' is class %d scnlen %d"),
+ abfd, name, sym.n_sclass, aux.x_csect.x_scnlen.l);
bfd_set_error (bfd_error_bad_value);
goto error_return;
}
@@ -1426,7 +1329,7 @@ xcoff_link_add_symbols (abfd, info)
erelsym = ((bfd_byte *) obj_coff_external_syms (abfd)
+ rel->r_symndx * symesz);
- bfd_coff_swap_sym_in (abfd, (PTR) erelsym, (PTR) &relsym);
+ bfd_coff_swap_sym_in (abfd, (void *) erelsym, (void *) &relsym);
if (relsym.n_sclass == C_EXT)
{
const char *relname;
@@ -1436,7 +1339,6 @@ xcoff_link_add_symbols (abfd, info)
/* 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)
@@ -1447,7 +1349,6 @@ xcoff_link_add_symbols (abfd, info)
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
@@ -1486,13 +1387,12 @@ xcoff_link_add_symbols (abfd, info)
/* 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
@@ -1501,9 +1401,7 @@ xcoff_link_add_symbols (abfd, info)
csect = bfd_xcoff_create_csect_from_smclas(abfd, &aux, name);
if (NULL == csect)
- {
- goto error_return;
- }
+ goto error_return;
/* The enclosing section is the main section : .data, .text
or .bss that the csect is coming from. */
@@ -1514,11 +1412,11 @@ xcoff_link_add_symbols (abfd, info)
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)))
+ > enclosing->vma + enclosing->size)))
{
(*_bfd_error_handler)
- (_("%s: csect `%s' not in enclosing section"),
- bfd_archive_filename (abfd), name);
+ (_("%B: csect `%s' not in enclosing section"),
+ abfd, name);
bfd_set_error (bfd_error_bad_value);
goto error_return;
}
@@ -1526,14 +1424,14 @@ xcoff_link_add_symbols (abfd, info)
csect->filepos = (enclosing->filepos
+ sym.n_value
- enclosing->vma);
- csect->_raw_size = aux.x_csect.x_scnlen.l;
+ csect->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);
+ csect->used_by_bfd = bfd_zalloc (abfd, amt);
if (csect->used_by_bfd == NULL)
goto error_return;
amt = sizeof (struct xcoff_section_tdata);
@@ -1563,7 +1461,7 @@ xcoff_link_add_symbols (abfd, info)
+ relindx * bfd_coff_relsz (abfd));
while (relindx < enclosing->reloc_count
&& *rel_csect == NULL
- && rel->r_vaddr < csect->vma + csect->_raw_size)
+ && rel->r_vaddr < csect->vma + csect->size)
{
*rel_csect = csect;
@@ -1624,8 +1522,8 @@ xcoff_link_add_symbols (abfd, info)
if (bad)
{
(*_bfd_error_handler)
- (_("%s: misplaced XTY_LD `%s'"),
- bfd_archive_filename (abfd), name);
+ (_("%B: misplaced XTY_LD `%s'"),
+ abfd, name);
bfd_set_error (bfd_error_bad_value);
goto error_return;
}
@@ -1654,18 +1552,17 @@ xcoff_link_add_symbols (abfd, info)
{
/* The linker script puts the .td section in the data
section after the .tc section. */
- csect = bfd_make_section_anyway (abfd, ".td");
-
+ csect = bfd_make_section_anyway_with_flags (abfd, ".td",
+ SEC_ALLOC);
}
else
- {
- csect = bfd_make_section_anyway (abfd, ".bss");
- }
+ csect = bfd_make_section_anyway_with_flags (abfd, ".bss",
+ SEC_ALLOC);
+
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->size = aux.x_csect.x_scnlen.l;
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. */
@@ -1675,7 +1572,7 @@ xcoff_link_add_symbols (abfd, info)
/ symesz);
amt = sizeof (struct coff_section_tdata);
- csect->used_by_bfd = (PTR) bfd_zalloc (abfd, amt);
+ csect->used_by_bfd = bfd_zalloc (abfd, amt);
if (csect->used_by_bfd == NULL)
goto error_return;
amt = sizeof (struct xcoff_section_tdata);
@@ -1690,7 +1587,7 @@ xcoff_link_add_symbols (abfd, info)
if (sym.n_sclass == C_EXT)
{
csect->flags |= SEC_IS_COMMON;
- csect->_raw_size = 0;
+ csect->size = 0;
section = csect;
value = aux.x_csect.x_scnlen.l;
}
@@ -1703,7 +1600,6 @@ xcoff_link_add_symbols (abfd, info)
&& aux.x_csect.x_smclas != XMC_TC
&& aux.x_csect.x_smclas != XMC_TD)
{
-
int i = -1;
if (name[0] == '_')
@@ -1720,14 +1616,10 @@ xcoff_link_add_symbols (abfd, info)
i = XCOFF_SPECIAL_SECTION_END;
}
else if (name[0] == 'e' && strcmp (name, "end") == 0)
- {
- i = XCOFF_SPECIAL_SECTION_END2;
- }
+ i = XCOFF_SPECIAL_SECTION_END2;
if (i != -1)
- {
- xcoff_hash_table (info)->special_sections[i] = csect;
- }
+ xcoff_hash_table (info)->special_sections[i] = csect;
}
/* Now we have enough information to add the symbol to the
@@ -1774,19 +1666,15 @@ xcoff_link_add_symbols (abfd, info)
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);
- }
+ *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));
- }
+ /* 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
@@ -1827,7 +1715,7 @@ xcoff_link_add_symbols (abfd, info)
section = bfd_und_section_ptr;
value = 0;
}
- else if ((*sym_hash)->root.und_next != NULL
+ else if ((*sym_hash)->root.u.undef.next != NULL
|| info->hash->undefs_tail == &(*sym_hash)->root)
{
/* This symbol has been referenced. In this
@@ -1860,7 +1748,7 @@ xcoff_link_add_symbols (abfd, info)
not an error. */
if (! ((*info->callbacks->multiple_definition)
(info, (*sym_hash)->root.root.string,
- (bfd *) NULL, (asection *) NULL, (bfd_vma) 0,
+ NULL, NULL, (bfd_vma) 0,
(*sym_hash)->root.u.def.section->owner,
(*sym_hash)->root.u.def.section,
(*sym_hash)->root.u.def.value)))
@@ -1884,7 +1772,7 @@ xcoff_link_add_symbols (abfd, info)
last_real->next = NULL;
if (! (_bfd_generic_link_add_one_symbol
(info, abfd, name, flags, section, value,
- (const char *) NULL, copy, TRUE,
+ NULL, copy, TRUE,
(struct bfd_link_hash_entry **) sym_hash)))
goto error_return;
last_real->next = first_csect;
@@ -1893,15 +1781,11 @@ xcoff_link_add_symbols (abfd, info)
{
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;
- }
+ /* We don't need the common csect we just created. */
+ csect->size = 0;
else
- {
- (*sym_hash)->root.u.c.p->alignment_power
- = csect->alignment_power;
- }
+ (*sym_hash)->root.u.c.p->alignment_power
+ = csect->alignment_power;
}
if (info->hash->creator == abfd->xvec)
@@ -1937,7 +1821,7 @@ xcoff_link_add_symbols (abfd, info)
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->size = 0;
o->lineno_count = 0;
if ((o->flags & SEC_RELOC) != 0)
@@ -1951,12 +1835,11 @@ xcoff_link_add_symbols (abfd, info)
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);
+ (_("%B: reloc %s:%d not in csect"),
+ abfd, o->name, i);
bfd_set_error (bfd_error_bad_value);
goto error_return;
}
@@ -2000,7 +1883,7 @@ xcoff_link_add_symbols (abfd, info)
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,
+ (bfd_vma) 0, NULL, FALSE,
TRUE, &bh)))
goto error_return;
hds = (struct xcoff_link_hash_entry *) bh;
@@ -2067,81 +1950,62 @@ xcoff_link_add_symbols (abfd, info)
#undef N_TMASK
#undef N_BTSHFT
-/* This function is used to add symbols from a dynamic object to the
- global symbol table. */
+/* Add symbols from an XCOFF object file. */
static bfd_boolean
-xcoff_link_add_dynamic_symbols (abfd, info)
- bfd *abfd;
- struct bfd_link_info *info;
+xcoff_link_add_object_symbols (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;
+}
+
+/* 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 (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;
- 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. */
+ *pneeded = FALSE;
- /* 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;
- }
-
+ /* 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;
- /* 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);
+ elsym = contents + bfd_xcoff_loader_symbol_offset (abfd, &ldhdr);
- for (; elsym < elsymend; elsym += bfd_xcoff_ldsymsz(abfd))
+ 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;
+ struct bfd_link_hash_entry *h;
bfd_xcoff_swap_ldsym_in (abfd, elsym, &ldsym);
@@ -2158,169 +2022,192 @@ xcoff_link_add_dynamic_symbols (abfd, info)
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;
+ h = bfd_link_hash_lookup (info->hash, name, FALSE, FALSE, TRUE);
- if (h->root.type == bfd_link_hash_new)
+ /* 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)
{
- 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 (! (*info->callbacks->add_archive_element) (info, abfd, name))
+ return FALSE;
+ *pneeded = TRUE;
+ return TRUE;
}
+ }
- if (h->smclas == XMC_UA
- || h->root.type == bfd_link_hash_undefined
- || h->root.type == bfd_link_hash_undefweak)
- h->smclas = ldsym.l_smclas;
+ /* 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;
+ }
- /* 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. */
+ return TRUE;
+}
- 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;
- }
+/* Look through the symbols to see if this object file should be
+ included in the link. */
- /* 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;
+static bfd_boolean
+xcoff_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;
- hds = h->descriptor;
- if (hds == NULL)
- {
- char *dsnm;
+ *pneeded = FALSE;
- 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 ((abfd->flags & DYNAMIC) != 0
+ && ! info->static_link
+ && info->hash->creator == abfd->xvec)
+ return xcoff_link_check_dynamic_ar_symbols (abfd, info, pneeded);
- 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. */
- }
+ 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;
- hds->descriptor = h;
- h->descriptor = hds;
- }
+ bfd_coff_swap_sym_in (abfd, (void *) esym, (void *) &sym);
- hds->flags |= XCOFF_DEF_DYNAMIC;
- if (hds->smclas == XMC_UA)
- hds->smclas = XMC_PR;
+ if (sym.n_sclass == C_EXT && sym.n_scnum != N_UNDEF)
+ {
+ const char *name;
+ char buf[SYMNMLEN + 1];
+ struct bfd_link_hash_entry *h;
- /* 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))
+ /* 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 != NULL
+ && h->type == bfd_link_hash_undefined
+ && (info->hash->creator != abfd->xvec
+ || (((struct xcoff_link_hash_entry *) h)->flags
+ & XCOFF_DEF_DYNAMIC) == 0))
{
- 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 (! (*info->callbacks->add_archive_element) (info, abfd, name))
+ return FALSE;
+ *pneeded = TRUE;
+ return TRUE;
}
}
- }
- if (contents != NULL && ! coff_section_data (abfd, lsec)->keep_contents)
- {
- free (coff_section_data (abfd, lsec)->contents);
- coff_section_data (abfd, lsec)->contents = NULL;
+ esym += (sym.n_numaux + 1) * symesz;
}
- /* Record this file in the import files. */
+ /* We do not need this object file. */
+ return TRUE;
+}
- n = ((struct xcoff_import_file *)
- bfd_alloc (abfd, (bfd_size_type) sizeof (struct xcoff_import_file)));
- if (n == NULL)
+/* 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 (bfd *abfd,
+ struct bfd_link_info *info,
+ bfd_boolean *pneeded)
+{
+ if (! _bfd_coff_get_external_symbols (abfd))
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)
+ if (! xcoff_link_check_ar_symbols (abfd, info, pneeded))
+ return FALSE;
+
+ if (*pneeded)
{
- bname = bfd_get_filename (abfd);
- mname = "";
+ if (! xcoff_link_add_symbols (abfd, info))
+ return FALSE;
}
- else
+
+ if (! info->keep_memory || ! *pneeded)
{
- bname = bfd_get_filename (abfd->my_archive);
- mname = bfd_get_filename (abfd);
+ if (! _bfd_coff_free_symbols (abfd))
+ return FALSE;
}
- 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;
+ return TRUE;
+}
- xcoff_data (abfd)->import_file_id = c;
+/* Given an XCOFF BFD, add symbols to the global hash table as
+ appropriate. */
- return TRUE;
+bfd_boolean
+_bfd_xcoff_bfd_link_add_symbols (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, 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;
+ }
}
-/* 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;
+static inline bfd_boolean
+xcoff_mark_symbol (struct bfd_link_info *info, struct xcoff_link_hash_entry *h)
{
-
if ((h->flags & XCOFF_MARK) != 0)
return TRUE;
@@ -2356,9 +2243,7 @@ xcoff_mark_symbol (info, h)
section. */
static bfd_boolean
-xcoff_mark (info, sec)
- struct bfd_link_info *info;
- asection *sec;
+xcoff_mark (struct bfd_link_info *info, asection *sec)
{
if (bfd_is_abs_section (sec)
|| (sec->flags & SEC_MARK) != 0)
@@ -2370,18 +2255,17 @@ xcoff_mark (info, sec)
&& coff_section_data (sec->owner, sec) != NULL
&& xcoff_section_data (sec->owner, sec) != NULL)
{
- register struct xcoff_link_hash_entry **hp, **hpend;
+ 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;
+ struct xcoff_link_hash_entry *h;
h = *hp;
if (h != NULL
@@ -2393,13 +2277,11 @@ xcoff_mark (info, sec)
}
/* 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);
+ NULL, FALSE, NULL);
if (rel == NULL)
return FALSE;
relend = rel + sec->reloc_count;
@@ -2481,12 +2363,14 @@ xcoff_mark (info, sec)
return TRUE;
}
+/* Routines that are called after all the input files have been
+ handled, but before the sections are laid out in memory. */
+
/* The sweep phase of garbage collection. Remove all garbage
sections. */
static void
-xcoff_sweep (info)
- struct bfd_link_info *info;
+xcoff_sweep (struct bfd_link_info *info)
{
bfd *sub;
@@ -2511,7 +2395,7 @@ xcoff_sweep (info)
o->flags |= SEC_MARK;
else
{
- o->_raw_size = 0;
+ o->size = 0;
o->reloc_count = 0;
o->lineno_count = 0;
}
@@ -2524,11 +2408,10 @@ xcoff_sweep (info)
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;
+bfd_xcoff_link_record_set (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;
@@ -2540,9 +2423,8 @@ bfd_xcoff_link_record_set (output_bfd, info, harg, size)
/* 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);
+ amt = sizeof (* n);
+ n = bfd_alloc (output_bfd, amt);
if (n == NULL)
return FALSE;
n->next = xcoff_hash_table (info)->size_list;
@@ -2558,16 +2440,14 @@ bfd_xcoff_link_record_set (output_bfd, info, harg, size)
/* 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;
+bfd_xcoff_import_symbol (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;
@@ -2656,9 +2536,9 @@ bfd_xcoff_import_symbol (output_bfd, info, harg, val, imppath, impfile,
if (*pp == NULL)
{
struct xcoff_import_file *n;
- bfd_size_type amt = sizeof (struct xcoff_import_file);
+ bfd_size_type amt = sizeof (* n);
- n = (struct xcoff_import_file *) bfd_alloc (output_bfd, amt);
+ n = bfd_alloc (output_bfd, amt);
if (n == NULL)
return FALSE;
n->next = NULL;
@@ -2677,10 +2557,9 @@ bfd_xcoff_import_symbol (output_bfd, info, harg, val, imppath, impfile,
/* 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;
+bfd_xcoff_export_symbol (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;
@@ -2701,7 +2580,7 @@ bfd_xcoff_export_symbol (output_bfd, info, harg)
struct xcoff_link_hash_entry *hfn;
bfd_size_type amt = strlen (h->root.root.string) + 2;
- fnname = (char *) bfd_malloc (amt);
+ fnname = bfd_malloc (amt);
if (fnname == NULL)
return FALSE;
fnname[0] = '.';
@@ -2743,10 +2622,9 @@ bfd_xcoff_export_symbol (output_bfd, info, harg)
and destructors. */
bfd_boolean
-bfd_xcoff_link_count_reloc (output_bfd, info, name)
- bfd *output_bfd;
- struct bfd_link_info *info;
- const char *name;
+bfd_xcoff_link_count_reloc (bfd *output_bfd,
+ struct bfd_link_info *info,
+ const char *name)
{
struct xcoff_link_hash_entry *h;
@@ -2777,10 +2655,9 @@ bfd_xcoff_link_count_reloc (output_bfd, info, name)
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;
+bfd_xcoff_record_link_assignment (bfd *output_bfd,
+ struct bfd_link_info *info,
+ const char *name)
{
struct xcoff_link_hash_entry *h;
@@ -2797,6 +2674,274 @@ bfd_xcoff_record_link_assignment (output_bfd, info, name)
return TRUE;
}
+/* Add a symbol to the .loader symbols, if necessary. */
+
+static bfd_boolean
+xcoff_build_ldsyms (struct xcoff_link_hash_entry *h, void * 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, 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->size;
+ h->smclas = XMC_GL;
+ h->flags |= XCOFF_DEF_REGULAR;
+ sec->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->size;
+ hds->toc_section->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->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->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->size == 0)
+ {
+ BFD_ASSERT (bfd_is_com_section (h->root.u.c.p->section));
+ h->root.u.c.p->section->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 = 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;
+}
/* 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.
@@ -2815,23 +2960,19 @@ bfd_xcoff_record_link_assignment (output_bfd, info, name)
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;
+bfd_xcoff_size_dynamic_sections (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;
@@ -2841,7 +2982,7 @@ bfd_xcoff_size_dynamic_sections (output_bfd, info, libpath, entry,
struct xcoff_import_file *fl;
struct internal_ldhdr *ldhdr;
bfd_size_type stoff;
- register char *out;
+ char *out;
asection *sec;
bfd *sub;
struct bfd_strtab_hash *debug_strtab;
@@ -2898,16 +3039,16 @@ bfd_xcoff_size_dynamic_sections (output_bfd, info, libpath, entry,
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);
+ /* __rtinit initialized. */
+ amt = sizeof (* ldsym);
+ 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 */
+ 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
@@ -2973,20 +3114,17 @@ bfd_xcoff_size_dynamic_sections (output_bfd, info, libpath, entry,
if (sec != NULL
&& gc
&& (sec->flags & SEC_MARK) == 0)
- {
- sec = NULL;
- }
+ sec = NULL;
+
special_sections[i] = sec;
}
if (info->input_bfds == NULL)
- {
- /* I'm not sure what to do in this bizarre case. */
- return TRUE;
- }
+ /* 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);
+ (void *) &ldinfo);
if (ldinfo.failed)
goto error_return;
@@ -3035,8 +3173,8 @@ bfd_xcoff_size_dynamic_sections (output_bfd, info, libpath, entry,
/* 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);
+ lsec->size = stoff + ldhdr->l_stlen;
+ lsec->contents = bfd_zalloc (output_bfd, lsec->size);
if (lsec->contents == NULL)
goto error_return;
@@ -3051,7 +3189,7 @@ bfd_xcoff_size_dynamic_sections (output_bfd, info, libpath, entry,
*out++ = '\0';
for (fl = xcoff_hash_table (info)->imports; fl != NULL; fl = fl->next)
{
- register const char *s;
+ const char *s;
s = fl->path;
while ((*out++ = *s++) != '\0')
@@ -3080,28 +3218,27 @@ bfd_xcoff_size_dynamic_sections (output_bfd, info, libpath, entry,
symbols are written out in xcoff_link_input_bfd or
xcoff_write_global_symbol. The .loader relocs are written out
when the corresponding normal relocs are handled in
- xcoff_link_input_bfd.
- */
+ xcoff_link_input_bfd. */
/* Allocate space for the magic sections. */
sec = xcoff_hash_table (info)->linkage_section;
- if (sec->_raw_size > 0)
+ if (sec->size > 0)
{
- sec->contents = (bfd_byte *) bfd_zalloc (output_bfd, sec->_raw_size);
+ sec->contents = bfd_zalloc (output_bfd, sec->size);
if (sec->contents == NULL)
goto error_return;
}
sec = xcoff_hash_table (info)->toc_section;
- if (sec->_raw_size > 0)
+ if (sec->size > 0)
{
- sec->contents = (bfd_byte *) bfd_zalloc (output_bfd, sec->_raw_size);
+ sec->contents = bfd_zalloc (output_bfd, sec->size);
if (sec->contents == NULL)
goto error_return;
}
sec = xcoff_hash_table (info)->descriptor_section;
- if (sec->_raw_size > 0)
+ if (sec->size > 0)
{
- sec->contents = (bfd_byte *) bfd_zalloc (output_bfd, sec->_raw_size);
+ sec->contents = bfd_zalloc (output_bfd, sec->size);
if (sec->contents == NULL)
goto error_return;
}
@@ -3122,14 +3259,14 @@ bfd_xcoff_size_dynamic_sections (output_bfd, info, libpath, entry,
if (sub->xvec != info->hash->creator)
continue;
subdeb = bfd_get_section_by_name (sub, ".debug");
- if (subdeb == NULL || subdeb->_raw_size == 0)
+ if (subdeb == NULL || subdeb->size == 0)
continue;
if (info->strip == strip_all
|| info->strip == strip_debugger
|| info->discard == discard_all)
{
- subdeb->_raw_size = 0;
+ subdeb->size = 0;
continue;
}
@@ -3137,8 +3274,7 @@ bfd_xcoff_size_dynamic_sections (output_bfd, info, libpath, entry,
goto error_return;
symcount = obj_raw_syment_count (sub);
- debug_index = ((unsigned long *)
- bfd_zalloc (sub, symcount * sizeof (unsigned long)));
+ debug_index = bfd_zalloc (sub, symcount * sizeof (unsigned long));
if (debug_index == NULL)
goto error_return;
xcoff_data (sub)->debug_indices = debug_index;
@@ -3148,11 +3284,7 @@ bfd_xcoff_size_dynamic_sections (output_bfd, info, libpath, entry,
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))
+ if (! bfd_malloc_and_get_section (sub, subdeb, &debug_contents))
goto error_return;
csectpp = xcoff_data (sub)->csects;
@@ -3168,7 +3300,7 @@ bfd_xcoff_size_dynamic_sections (output_bfd, info, libpath, entry,
{
struct internal_syment sym;
- bfd_coff_swap_sym_in (sub, (PTR) esym, (PTR) &sym);
+ bfd_coff_swap_sym_in (sub, (void *) esym, (void *) &sym);
*debug_index = (unsigned long) -1;
@@ -3200,7 +3332,7 @@ bfd_xcoff_size_dynamic_sections (output_bfd, info, libpath, entry,
/* Clear the size of subdeb, so that it is not included directly
in the output file. */
- subdeb->_raw_size = 0;
+ subdeb->size = 0;
if (! info->keep_memory)
{
@@ -3210,7 +3342,7 @@ bfd_xcoff_size_dynamic_sections (output_bfd, info, libpath, entry,
}
if (info->strip != strip_all)
- xcoff_hash_table (info)->debug_section->_raw_size =
+ xcoff_hash_table (info)->debug_section->size =
_bfd_stringtab_size (debug_strtab);
return TRUE;
@@ -3224,16 +3356,14 @@ bfd_xcoff_size_dynamic_sections (output_bfd, info, libpath, entry,
}
bfd_boolean
-bfd_xcoff_link_generate_rtinit (abfd, init, fini, rtld)
- bfd *abfd;
- const char *init;
- const char *fini;
- bfd_boolean rtld;
+bfd_xcoff_link_generate_rtinit (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)));
+ bim = bfd_malloc ((bfd_size_type) sizeof (* bim));
if (bim == NULL)
return FALSE;
@@ -3242,7 +3372,7 @@ bfd_xcoff_link_generate_rtinit (abfd, init, fini, rtld)
abfd->link_next = 0;
abfd->format = bfd_object;
- abfd->iostream = (PTR) bim;
+ abfd->iostream = (void *) bim;
abfd->flags = BFD_IN_MEMORY;
abfd->direction = write_direction;
abfd->where = 0;
@@ -3257,934 +3387,13 @@ bfd_xcoff_link_generate_rtinit (abfd, init, fini, rtld)
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;
+xcoff_link_input_bfd (struct xcoff_final_link_info *finfo,
+ bfd *input_bfd)
{
bfd *output_bfd;
const char *strings;
@@ -4215,7 +3424,6 @@ xcoff_link_input_bfd (finfo, input_bfd)
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);
@@ -4255,7 +3463,6 @@ xcoff_link_input_bfd (finfo, input_bfd)
while (esym < esym_end)
{
-
struct internal_syment isym;
union internal_auxent aux;
int smtyp = 0;
@@ -4263,7 +3470,7 @@ xcoff_link_input_bfd (finfo, input_bfd)
bfd_boolean require;
int add;
- bfd_coff_swap_sym_in (input_bfd, (PTR) esym, (PTR) isymp);
+ bfd_coff_swap_sym_in (input_bfd, (void *) esym, (void *) isymp);
/* If this is a C_EXT or C_HIDEXT symbol, we need the csect
information. */
@@ -4271,10 +3478,10 @@ xcoff_link_input_bfd (finfo, input_bfd)
{
BFD_ASSERT (isymp->n_numaux > 0);
bfd_coff_swap_aux_in (input_bfd,
- (PTR) (esym + isymesz * isymp->n_numaux),
+ (void *) (esym + isymesz * isymp->n_numaux),
isymp->n_type, isymp->n_sclass,
isymp->n_numaux - 1, isymp->n_numaux,
- (PTR) &aux);
+ (void *) &aux);
smtyp = SMTYP_SMTYP (aux.x_csect.x_smtyp);
}
@@ -4423,7 +3630,7 @@ xcoff_link_input_bfd (finfo, input_bfd)
output section, as it does in the default linker
script. */
tocend = ((*csectpp)->output_section->vma
- + (*csectpp)->output_section->_raw_size);
+ + (*csectpp)->output_section->size);
for (inp = finfo->info->input_bfds;
inp != NULL;
inp = inp->link_next)
@@ -4435,7 +3642,7 @@ xcoff_link_input_bfd (finfo, input_bfd)
bfd_vma new_toc_end;
new_toc_end = (o->output_section->vma
+ o->output_offset
- + o->_cooked_size);
+ + o->size);
if (new_toc_end > tocend)
tocend = new_toc_end;
}
@@ -4560,8 +3767,7 @@ xcoff_link_input_bfd (finfo, input_bfd)
const char *name;
bfd_size_type indx;
- name = _bfd_coff_internal_syment_name (input_bfd, &isym,
- (char *) NULL);
+ name = _bfd_coff_internal_syment_name (input_bfd, &isym, NULL);
if (name == NULL)
return FALSE;
@@ -4599,8 +3805,8 @@ xcoff_link_input_bfd (finfo, input_bfd)
{
/* The last C_FILE symbol is in this input file. */
bfd_coff_swap_sym_out (output_bfd,
- (PTR) &finfo->last_file,
- (PTR) (finfo->outsyms
+ (void *) &finfo->last_file,
+ (void *) (finfo->outsyms
+ ((finfo->last_file_index
- syment_base)
* osymesz)));
@@ -4613,8 +3819,8 @@ xcoff_link_input_bfd (finfo, input_bfd)
file_ptr pos;
bfd_coff_swap_sym_out (output_bfd,
- (PTR) &finfo->last_file,
- (PTR) outsym);
+ (void *) &finfo->last_file,
+ (void *) outsym);
pos = obj_sym_filepos (output_bfd);
pos += finfo->last_file_index * osymesz;
@@ -4641,7 +3847,7 @@ xcoff_link_input_bfd (finfo, input_bfd)
/* Output the symbol. */
- bfd_coff_swap_sym_out (output_bfd, (PTR) &isym, (PTR) outsym);
+ bfd_coff_swap_sym_out (output_bfd, (void *) &isym, (void *) outsym);
*indexp = output_index;
@@ -4715,7 +3921,7 @@ xcoff_link_input_bfd (finfo, input_bfd)
/* 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);
+ bfd_coff_swap_sym_in (output_bfd, (void *) outsym, (void *) &isym);
indx = isym.n_value;
if (indx < obj_raw_syment_count (input_bfd))
{
@@ -4726,8 +3932,8 @@ xcoff_link_input_bfd (finfo, input_bfd)
isym.n_value = 0;
else
isym.n_value = symindx;
- bfd_coff_swap_sym_out (output_bfd, (PTR) &isym,
- (PTR) outsym);
+ bfd_coff_swap_sym_out (output_bfd, (void *) &isym,
+ (void *) outsym);
}
}
@@ -4738,9 +3944,9 @@ xcoff_link_input_bfd (finfo, input_bfd)
{
union internal_auxent aux;
- bfd_coff_swap_aux_in (input_bfd, (PTR) esym, isymp->n_type,
+ bfd_coff_swap_aux_in (input_bfd, (void *) esym, isymp->n_type,
isymp->n_sclass, i, isymp->n_numaux,
- (PTR) &aux);
+ (void *) &aux);
if (isymp->n_sclass == C_FILE)
{
@@ -4884,8 +4090,8 @@ xcoff_link_input_bfd (finfo, input_bfd)
- enclosing->line_filepos);
bfd_coff_swap_lineno_in (input_bfd,
- (PTR) (finfo->linenos + linoff),
- (PTR) &lin);
+ (void *) (finfo->linenos + linoff),
+ (void *) &lin);
if (lin.l_lnno != 0
|| ((bfd_size_type) lin.l_addr.l_symndx
!= ((esym
@@ -4901,8 +4107,8 @@ xcoff_link_input_bfd (finfo, input_bfd)
bfd_size_type count;
lin.l_addr.l_symndx = *indexp;
- bfd_coff_swap_lineno_out (output_bfd, (PTR) &lin,
- (PTR) (finfo->linenos
+ bfd_coff_swap_lineno_out (output_bfd, (void *) &lin,
+ (void *) (finfo->linenos
+ linoff));
linpend = (finfo->linenos
@@ -4914,14 +4120,14 @@ xcoff_link_input_bfd (finfo, input_bfd)
linp < linpend;
linp += linesz)
{
- bfd_coff_swap_lineno_in (input_bfd, (PTR) linp,
- (PTR) &lin);
+ bfd_coff_swap_lineno_in (input_bfd, (void *) linp,
+ (void *) &lin);
if (lin.l_lnno == 0)
break;
lin.l_addr.l_paddr += offset;
bfd_coff_swap_lineno_out (output_bfd,
- (PTR) &lin,
- (PTR) linp);
+ (void *) &lin,
+ (void *) linp);
}
count = (linp - (finfo->linenos + linoff)) / linesz;
@@ -4969,16 +4175,16 @@ xcoff_link_input_bfd (finfo, input_bfd)
struct internal_syment iis;
bfd_coff_swap_sym_in (output_bfd,
- (PTR) oos,
- (PTR) &iis);
+ (void *) oos,
+ (void *) &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);
+ (void *) &iis,
+ (void *) oos);
--incls;
}
@@ -4993,9 +4199,9 @@ xcoff_link_input_bfd (finfo, input_bfd)
}
}
- bfd_coff_swap_aux_out (output_bfd, (PTR) &aux, isymp->n_type,
+ bfd_coff_swap_aux_out (output_bfd, (void *) &aux, isymp->n_type,
isymp->n_sclass, i, isymp->n_numaux,
- (PTR) outsym);
+ (void *) outsym);
outsym += osymesz;
esym += isymesz;
}
@@ -5014,8 +4220,8 @@ xcoff_link_input_bfd (finfo, input_bfd)
&& (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
+ bfd_coff_swap_sym_out (output_bfd, (void *) &finfo->last_file,
+ (void *) (finfo->outsyms
+ ((finfo->last_file_index - syment_base)
* osymesz)));
}
@@ -5043,17 +4249,14 @@ xcoff_link_input_bfd (finfo, input_bfd)
/* 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;
- }
+ /* This section was omitted from the link. */
+ continue;
if ((o->flags & SEC_HAS_CONTENTS) == 0
- || o->_raw_size == 0
+ || o->size == 0
|| (o->flags & SEC_IN_MEMORY) != 0)
continue;
@@ -5062,12 +4265,13 @@ xcoff_link_input_bfd (finfo, input_bfd)
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;
- }
+ else
+ {
+ bfd_size_type sz = o->rawsize ? o->rawsize : o->size;
+ if (!bfd_get_section_contents (input_bfd, o, finfo->contents, 0, sz))
+ return FALSE;
+ contents = finfo->contents;
+ }
if ((o->flags & SEC_RELOC) != 0)
{
@@ -5148,9 +4352,8 @@ xcoff_link_input_bfd (finfo, input_bfd)
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));
+ amt = sizeof (* n);
+ n = bfd_alloc (finfo->output_bfd, amt);
if (n == NULL)
return FALSE;
si = finfo->section_info + target_index;
@@ -5194,10 +4397,10 @@ xcoff_link_input_bfd (finfo, input_bfd)
if (is->n_sclass == C_HIDEXT
&& is->n_numaux > 0)
{
- PTR auxptr;
+ void * auxptr;
union internal_auxent aux;
- auxptr = ((PTR)
+ auxptr = ((void *)
(((bfd_byte *)
obj_coff_external_syms (input_bfd))
+ ((r_symndx + is->n_numaux)
@@ -5206,7 +4409,7 @@ xcoff_link_input_bfd (finfo, input_bfd)
is->n_type, is->n_sclass,
is->n_numaux - 1,
is->n_numaux,
- (PTR) &aux);
+ (void *) &aux);
if (SMTYP_SMTYP (aux.x_csect.x_smtyp) == XTY_SD
&& aux.x_csect.x_smclas == XMC_TC0)
indx = finfo->toc_symindx;
@@ -5285,9 +4488,8 @@ xcoff_link_input_bfd (finfo, input_bfd)
else
{
(*_bfd_error_handler)
- (_("%s: loader reloc in unrecognized section `%s'"),
- bfd_archive_filename (input_bfd),
- sec->name);
+ (_("%B: loader reloc in unrecognized section `%A'"),
+ input_bfd, sec);
bfd_set_error (bfd_error_nonrepresentable_section);
return FALSE;
}
@@ -5307,8 +4509,8 @@ xcoff_link_input_bfd (finfo, input_bfd)
if (h->ldindx < 0 && ! quiet)
{
(*_bfd_error_handler)
- (_("%s: `%s' in loader reloc but not loader sym"),
- bfd_archive_filename (input_bfd),
+ (_("%B: `%s' in loader reloc but not loader sym"),
+ input_bfd,
h->root.root.string);
bfd_set_error (bfd_error_bad_value);
return FALSE;
@@ -5322,10 +4524,8 @@ xcoff_link_input_bfd (finfo, input_bfd)
&& ! 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));
+ (_("%B: loader reloc in read-only section %A"),
+ input_bfd, o->output_section);
bfd_set_error (bfd_error_invalid_operation);
return FALSE;
}
@@ -5352,9 +4552,7 @@ xcoff_link_input_bfd (finfo, input_bfd)
/* 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)))
+ o->size))
return FALSE;
}
@@ -5372,13 +4570,26 @@ xcoff_link_input_bfd (finfo, input_bfd)
#undef N_TMASK
#undef N_BTSHFT
-/* Write out a non-XCOFF global symbol. */
+/* Sort relocs by VMA. This is called via qsort. */
+static int
+xcoff_sort_relocs (const void * p1, const void * 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;
+}
+
+/* Write out a non-XCOFF global symbol. */
static bfd_boolean
-xcoff_write_global_symbol (h, inf)
- struct xcoff_link_hash_entry *h;
- PTR inf;
+xcoff_write_global_symbol (struct xcoff_link_hash_entry *h, void * inf)
{
struct xcoff_final_link_info *finfo = (struct xcoff_final_link_info *) inf;
bfd *output_bfd;
@@ -5425,7 +4636,6 @@ xcoff_write_global_symbol (h, inf)
else if (h->root.type == bfd_link_hash_defined
|| h->root.type == bfd_link_hash_defweak)
{
-
asection *sec;
sec = h->root.u.def.section;
@@ -5443,30 +4653,22 @@ xcoff_write_global_symbol (h, inf)
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;
- }
+ /* 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;
- }
+ ldsym->l_smtype |= L_EXPORT;
if ((h->flags & XCOFF_ENTRY) != 0)
- {
- ldsym->l_smtype |= L_ENTRY;
- }
+ ldsym->l_smtype |= L_ENTRY;
if ((h->flags & XCOFF_RTINIT) != 0)
- {
- ldsym->l_smtype = XTY_SD;
- }
+ ldsym->l_smtype = XTY_SD;
ldsym->l_smclas = h->smclas;
@@ -5475,22 +4677,17 @@ xcoff_write_global_symbol (h, inf)
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;
- }
+ ldsym->l_smclas = XMC_XO;
+
else if ((h->flags & (XCOFF_SYSCALL32 | XCOFF_SYSCALL64)) ==
(XCOFF_SYSCALL32 | XCOFF_SYSCALL64))
- {
- ldsym->l_smclas = XMC_SV3264;
- }
+ ldsym->l_smclas = XMC_SV3264;
+
else if (h->flags & XCOFF_SYSCALL32)
- {
- ldsym->l_smclas = XMC_SV;
- }
+ ldsym->l_smclas = XMC_SV;
+
else if (h->flags & XCOFF_SYSCALL64)
- {
- ldsym->l_smclas = XMC_SV64;
- }
+ ldsym->l_smclas = XMC_SV64;
}
if (ldsym->l_ifile == -(bfd_size_type) 1)
@@ -5500,13 +4697,9 @@ xcoff_write_global_symbol (h, inf)
else if (ldsym->l_ifile == 0)
{
if ((ldsym->l_smtype & L_IMPORT) == 0)
- {
- ldsym->l_ifile = 0;
- }
+ ldsym->l_ifile = 0;
else if (impbfd == NULL)
- {
- ldsym->l_ifile = 0;
- }
+ ldsym->l_ifile = 0;
else
{
BFD_ASSERT (impbfd->xvec == output_bfd->xvec);
@@ -5543,10 +4736,7 @@ xcoff_write_global_symbol (h, inf)
- xcoff_data (output_bfd)->toc);
if ((h->descriptor->flags & XCOFF_SET_TOC) != 0)
- {
- tocoff += h->descriptor->u.toc_offset;
- }
-
+ 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
@@ -5558,11 +4748,9 @@ xcoff_write_global_symbol (h, inf)
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]);
- }
+ 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
@@ -5585,11 +4773,8 @@ xcoff_write_global_symbol (h, inf)
+ tocsec->output_offset
+ h->u.toc_offset);
-
if (h->indx >= 0)
- {
- irel->r_symndx = h->indx;
- }
+ irel->r_symndx = h->indx;
else
{
h->indx = -2;
@@ -5603,7 +4788,7 @@ xcoff_write_global_symbol (h, inf)
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_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
@@ -5623,9 +4808,8 @@ xcoff_write_global_symbol (h, inf)
iraux.x_csect.x_scnlen.l = 4;
}
else
- {
- return FALSE;
- }
+ return FALSE;
+
irel->r_type = R_POS;
finfo->section_info[oindx].rel_hashes[osec->reloc_count] = NULL;
++osec->reloc_count;
@@ -5641,7 +4825,6 @@ xcoff_write_global_symbol (h, inf)
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)
@@ -5653,12 +4836,12 @@ xcoff_write_global_symbol (h, inf)
irsym.n_type = T_NULL;
irsym.n_numaux = 1;
- bfd_coff_swap_sym_out (output_bfd, (PTR) &irsym, (PTR) outsym);
+ bfd_coff_swap_sym_out (output_bfd, (void *) &irsym, (void *) 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);
+ /* Note : iraux is initialized above. */
+ bfd_coff_swap_aux_out (output_bfd, (void *) &iraux, T_NULL, C_HIDEXT,
+ 0, 1, (void *) outsym);
outsym += bfd_coff_auxesz (output_bfd);
if (h->indx >= 0)
@@ -5717,9 +4900,7 @@ xcoff_write_global_symbol (h, inf)
byte_size = 4;
}
else
- {
- return FALSE;
- }
+ return FALSE;
sec = h->root.u.def.section;
osec = sec->output_section;
@@ -5920,12 +5101,12 @@ xcoff_write_global_symbol (h, inf)
isym.n_type = T_NULL;
isym.n_numaux = 1;
- bfd_coff_swap_sym_out (output_bfd, (PTR) &isym, (PTR) outsym);
+ bfd_coff_swap_sym_out (output_bfd, (void *) &isym, (void *) 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);
+ bfd_coff_swap_aux_out (output_bfd, (void *) &aux, T_NULL, isym.n_sclass, 0, 1,
+ (void *) outsym);
outsym += bfd_coff_auxesz (output_bfd);
if ((h->root.type == bfd_link_hash_defined
@@ -5933,17 +5114,16 @@ xcoff_write_global_symbol (h, inf)
&& 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);
+ bfd_coff_swap_sym_out (output_bfd, (void *) &isym, (void *) 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);
+ bfd_coff_swap_aux_out (output_bfd, (void *) &aux, T_NULL, C_EXT, 0, 1,
+ (void *) outsym);
outsym += bfd_coff_auxesz (output_bfd);
}
@@ -5962,11 +5142,10 @@ xcoff_write_global_symbol (h, inf)
/* 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;
+xcoff_reloc_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;
@@ -5978,13 +5157,11 @@ xcoff_reloc_link_order (output_bfd, finfo, output_section, link_order)
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 ();
- }
+ /* 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)
@@ -6000,8 +5177,7 @@ xcoff_reloc_link_order (output_bfd, finfo, output_section, link_order)
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)))
+ (finfo->info, link_order->u.reloc.p->u.name, NULL, NULL, (bfd_vma) 0)))
return FALSE;
return TRUE;
}
@@ -6037,7 +5213,7 @@ xcoff_reloc_link_order (output_bfd, finfo, output_section, link_order)
bfd_boolean ok;
size = bfd_get_reloc_size (howto);
- buf = (bfd_byte *) bfd_zmalloc (size);
+ buf = bfd_zmalloc (size);
if (buf == NULL)
return FALSE;
@@ -6051,16 +5227,15 @@ xcoff_reloc_link_order (output_bfd, finfo, output_section, link_order)
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)))
+ (finfo->info, NULL, link_order->u.reloc.p->u.name,
+ howto->name, addend, NULL, NULL, (bfd_vma) 0)))
{
free (buf);
return FALSE;
}
break;
}
- ok = bfd_set_section_contents (output_bfd, output_section, (PTR) buf,
+ ok = bfd_set_section_contents (output_bfd, output_section, (void *) buf,
(file_ptr) link_order->offset, size);
free (buf);
if (! ok)
@@ -6069,7 +5244,6 @@ xcoff_reloc_link_order (output_bfd, finfo, output_section, link_order)
/* 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
@@ -6144,24 +5318,639 @@ xcoff_reloc_link_order (output_bfd, finfo, output_section, link_order)
return TRUE;
}
-/* Sort relocs by VMA. This is called via qsort. */
+/* Do the final link step. */
-static int
-xcoff_sort_relocs (p1, p2)
- const PTR p1;
- const PTR p2;
+bfd_boolean
+_bfd_xcoff_bfd_final_link (bfd *abfd, struct bfd_link_info *info)
{
- const struct internal_reloc *r1 = (const struct internal_reloc *) p1;
- const struct internal_reloc *r2 = (const struct internal_reloc *) p2;
+ 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 (r1->r_vaddr > r2->r_vaddr)
- return 1;
- else if (r1->r_vaddr < r2->r_vaddr)
- return -1;
+ 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->map_head.link_order; 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->rawsize > max_contents_size)
+ max_contents_size = sec->rawsize;
+ if (sec->size > max_contents_size)
+ max_contents_size = sec->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
- return 0;
-}
+ {
+ bfd_vma file_align;
+
+ file_align = xcoff_hash_table (info)->file_align;
+ if (file_align != 0)
+ {
+ bfd_boolean saw_contents;
+ int indx;
+ 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 (o = abfd->sections; o != NULL; o = o->next)
+ {
+ if (strcmp (o->name, ".pad") == 0)
+ saw_contents = FALSE;
+ else if ((o->flags & SEC_HAS_CONTENTS) != 0
+ && (o->flags & SEC_LOAD) != 0)
+ {
+ if (! saw_contents)
+ saw_contents = TRUE;
+ else
+ {
+ asection *n;
+
+ /* Create a pad section and place it before the section
+ that needs padding. This requires unlinking and
+ relinking the bfd's section list. */
+
+ n = bfd_make_section_anyway_with_flags (abfd, ".pad",
+ SEC_HAS_CONTENTS);
+ n->alignment_power = 0;
+
+ bfd_section_list_remove (abfd, n);
+ bfd_section_list_insert_before (abfd, o, n);
+ 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->size == 0);
+ pageoff = sofar & (file_align - 1);
+ if (pageoff != 0)
+ {
+ o->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->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 = 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 = bfd_malloc (amt);
+
+ amt = o->reloc_count;
+ amt *= sizeof (struct xcoff_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;
+ }
+ }
+
+ /* 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 = bfd_malloc (amt);
+ amt = max_sym_count * sizeof (long);
+ finfo.sym_indices = bfd_malloc (amt);
+
+ amt = (max_sym_count + 1) * symesz;
+ finfo.outsyms = bfd_malloc (amt);
+
+ amt = max_lineno_count * bfd_coff_linesz (abfd);
+ finfo.linenos = bfd_malloc (amt);
+
+ amt = max_contents_size;
+ finfo.contents = bfd_malloc (amt);
+
+ amt = max_reloc_count * relsz;
+ finfo.external_relocs = 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->map_head.link_order; 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, (void *) &finfo.last_file,
+ (void *) 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,
+ (void *) &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_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,
+ 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,
+ 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 ((void *) 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, (void *) irel, (void *) erel);
+
+ rel_size = relsz * o->reloc_count;
+ if (bfd_seek (abfd, o->rel_filepos, SEEK_SET) != 0
+ || bfd_bwrite ((void *) 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->size))
+ goto error_return;
+
+ /* Write out the magic sections. */
+ o = xcoff_hash_table (info)->linkage_section;
+ if (o->size > 0
+ && ! bfd_set_section_contents (abfd, o->output_section, o->contents,
+ (file_ptr) o->output_offset,
+ o->size))
+ goto error_return;
+ o = xcoff_hash_table (info)->toc_section;
+ if (o->size > 0
+ && ! bfd_set_section_contents (abfd, o->output_section, o->contents,
+ (file_ptr) o->output_offset,
+ o->size))
+ goto error_return;
+ o = xcoff_hash_table (info)->descriptor_section;
+ if (o->size > 0
+ && ! bfd_set_section_contents (abfd, o->output_section, o->contents,
+ (file_ptr) o->output_offset,
+ o->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->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;
+}
OpenPOWER on IntegriCloud