summaryrefslogtreecommitdiffstats
path: root/contrib/binutils/bfd
diff options
context:
space:
mode:
authorobrien <obrien@FreeBSD.org>2004-06-16 05:45:41 +0000
committerobrien <obrien@FreeBSD.org>2004-06-16 05:45:41 +0000
commit2504df11e1275f63f4c53377bf91eee996360cb5 (patch)
tree04848ae93445e503c4190ca1748abe15eabc9e11 /contrib/binutils/bfd
parent6b4c52b743ec5e2e9f65d42b517feefad5017901 (diff)
downloadFreeBSD-src-2504df11e1275f63f4c53377bf91eee996360cb5.zip
FreeBSD-src-2504df11e1275f63f4c53377bf91eee996360cb5.tar.gz
Import of Binutils from the FSF 2.15 branch (just post-.0 release).
These bits are taken from the FSF anoncvs repo on 23-May-2004 04:41:00 UTC.
Diffstat (limited to 'contrib/binutils/bfd')
-rw-r--r--contrib/binutils/bfd/ChangeLog5639
-rw-r--r--contrib/binutils/bfd/ChangeLog-000116
-rw-r--r--contrib/binutils/bfd/ChangeLog-020311405
-rw-r--r--contrib/binutils/bfd/Makefile.am257
-rw-r--r--contrib/binutils/bfd/Makefile.in282
-rw-r--r--contrib/binutils/bfd/acinclude.m416
-rw-r--r--contrib/binutils/bfd/aclocal.m471
-rw-r--r--contrib/binutils/bfd/aout-arm.c48
-rw-r--r--contrib/binutils/bfd/aout-encap.c7
-rw-r--r--contrib/binutils/bfd/aout-target.h38
-rw-r--r--contrib/binutils/bfd/aoutf1.h55
-rw-r--r--contrib/binutils/bfd/aoutx.h985
-rw-r--r--contrib/binutils/bfd/archive.c624
-rw-r--r--contrib/binutils/bfd/archive64.c84
-rw-r--r--contrib/binutils/bfd/archures.c345
-rw-r--r--contrib/binutils/bfd/bfd-in.h603
-rw-r--r--contrib/binutils/bfd/bfd-in2.h2134
-rw-r--r--contrib/binutils/bfd/bfd.c586
-rw-r--r--contrib/binutils/bfd/bfdio.c442
-rw-r--r--contrib/binutils/bfd/bfdwin.c251
-rw-r--r--contrib/binutils/bfd/binary.c82
-rw-r--r--contrib/binutils/bfd/bout.c1579
-rw-r--r--contrib/binutils/bfd/cache.c78
-rw-r--r--contrib/binutils/bfd/coff-alpha.c297
-rw-r--r--contrib/binutils/bfd/coff-arm.c427
-rw-r--r--contrib/binutils/bfd/coff-aux.c24
-rw-r--r--contrib/binutils/bfd/coff-i386.c69
-rw-r--r--contrib/binutils/bfd/coff-ia64.c10
-rw-r--r--contrib/binutils/bfd/coff-ppc.c874
-rw-r--r--contrib/binutils/bfd/coff-rs6000.c1919
-rw-r--r--contrib/binutils/bfd/coff-sparc.c54
-rw-r--r--contrib/binutils/bfd/coff64-rs6000.c1046
-rw-r--r--contrib/binutils/bfd/coffcode.h1091
-rw-r--r--contrib/binutils/bfd/coffgen.c164
-rw-r--r--contrib/binutils/bfd/cofflink.c985
-rw-r--r--contrib/binutils/bfd/coffswap.h85
-rwxr-xr-xcontrib/binutils/bfd/config.bfd362
-rw-r--r--contrib/binutils/bfd/config.in29
-rwxr-xr-xcontrib/binutils/bfd/configure1501
-rw-r--r--contrib/binutils/bfd/configure.host42
-rw-r--r--contrib/binutils/bfd/configure.in212
-rw-r--r--contrib/binutils/bfd/corefile.c59
-rw-r--r--contrib/binutils/bfd/cpu-alpha.c12
-rw-r--r--contrib/binutils/bfd/cpu-arc.c14
-rw-r--r--contrib/binutils/bfd/cpu-arm.c316
-rw-r--r--contrib/binutils/bfd/cpu-i386.c10
-rw-r--r--contrib/binutils/bfd/cpu-ia64-opc.c25
-rw-r--r--contrib/binutils/bfd/cpu-ia64.c6
-rw-r--r--contrib/binutils/bfd/cpu-powerpc.c48
-rw-r--r--contrib/binutils/bfd/cpu-rs6000.c13
-rw-r--r--contrib/binutils/bfd/cpu-s390.c4
-rw-r--r--contrib/binutils/bfd/cpu-sparc.c20
-rw-r--r--contrib/binutils/bfd/dep-in.sed1
-rw-r--r--contrib/binutils/bfd/doc/ChangeLog552
-rw-r--r--contrib/binutils/bfd/doc/ChangeLog-9103594
-rw-r--r--contrib/binutils/bfd/doc/Makefile.am27
-rw-r--r--contrib/binutils/bfd/doc/Makefile.in37
-rw-r--r--contrib/binutils/bfd/doc/aoutx.texi6
-rw-r--r--contrib/binutils/bfd/doc/archive.texi7
-rw-r--r--contrib/binutils/bfd/doc/archures.texi184
-rw-r--r--contrib/binutils/bfd/doc/bfd.texinfo392
-rw-r--r--contrib/binutils/bfd/doc/bfdint.texi44
-rw-r--r--contrib/binutils/bfd/doc/bfdio.texi41
-rw-r--r--contrib/binutils/bfd/doc/bfdt.texi221
-rw-r--r--contrib/binutils/bfd/doc/bfdwin.texi2
-rw-r--r--contrib/binutils/bfd/doc/cache.texi10
-rw-r--r--contrib/binutils/bfd/doc/chew.c7
-rw-r--r--contrib/binutils/bfd/doc/coffcode.texi51
-rw-r--r--contrib/binutils/bfd/doc/core.texi10
-rw-r--r--contrib/binutils/bfd/doc/fdl.texi366
-rw-r--r--contrib/binutils/bfd/doc/format.texi13
-rw-r--r--contrib/binutils/bfd/doc/hash.texi12
-rw-r--r--contrib/binutils/bfd/doc/init.texi2
-rw-r--r--contrib/binutils/bfd/doc/libbfd.texi126
-rw-r--r--contrib/binutils/bfd/doc/linker.texi12
-rw-r--r--contrib/binutils/bfd/doc/mmo.texi365
-rw-r--r--contrib/binutils/bfd/doc/opncls.texi188
-rw-r--r--contrib/binutils/bfd/doc/reloc.texi443
-rw-r--r--contrib/binutils/bfd/doc/section.texi134
-rw-r--r--contrib/binutils/bfd/doc/syms.texi85
-rw-r--r--contrib/binutils/bfd/doc/targets.texi364
-rw-r--r--contrib/binutils/bfd/dwarf1.c78
-rw-r--r--contrib/binutils/bfd/dwarf2.c715
-rw-r--r--contrib/binutils/bfd/ecoff.c521
-rw-r--r--contrib/binutils/bfd/ecofflink.c492
-rw-r--r--contrib/binutils/bfd/ecoffswap.h237
-rw-r--r--contrib/binutils/bfd/efi-app-ia32.c4
-rw-r--r--contrib/binutils/bfd/efi-app-ia64.c4
-rw-r--r--contrib/binutils/bfd/elf-bfd.h1374
-rw-r--r--contrib/binutils/bfd/elf-eh-frame.c549
-rw-r--r--contrib/binutils/bfd/elf-strtab.c279
-rw-r--r--contrib/binutils/bfd/elf.c2476
-rw-r--r--contrib/binutils/bfd/elf32-arc.c43
-rw-r--r--contrib/binutils/bfd/elf32-arm.h1847
-rw-r--r--contrib/binutils/bfd/elf32-gen.c25
-rw-r--r--contrib/binutils/bfd/elf32-i386.c1290
-rw-r--r--contrib/binutils/bfd/elf32-ppc.c6085
-rw-r--r--contrib/binutils/bfd/elf32-s390.c2138
-rw-r--r--contrib/binutils/bfd/elf32-sparc.c2594
-rw-r--r--contrib/binutils/bfd/elf64-alpha.c1556
-rw-r--r--contrib/binutils/bfd/elf64-gen.c25
-rw-r--r--contrib/binutils/bfd/elf64-ppc.c6637
-rw-r--r--contrib/binutils/bfd/elf64-ppc.h36
-rw-r--r--contrib/binutils/bfd/elf64-s390.c2164
-rw-r--r--contrib/binutils/bfd/elf64-sparc.c763
-rw-r--r--contrib/binutils/bfd/elf64-x86-64.c1456
-rw-r--r--contrib/binutils/bfd/elfarm-nabi.c238
-rw-r--r--contrib/binutils/bfd/elfarm-oabi.c126
-rw-r--r--contrib/binutils/bfd/elfcode.h810
-rw-r--r--contrib/binutils/bfd/elfcore.h148
-rw-r--r--contrib/binutils/bfd/elflink.c8726
-rw-r--r--contrib/binutils/bfd/elfxx-ia64.c2407
-rw-r--r--contrib/binutils/bfd/elfxx-target.h149
-rw-r--r--contrib/binutils/bfd/format.c158
-rw-r--r--contrib/binutils/bfd/freebsd.h8
-rw-r--r--contrib/binutils/bfd/gen-aout.c2
-rw-r--r--contrib/binutils/bfd/genlink.h14
-rw-r--r--contrib/binutils/bfd/hash.c55
-rw-r--r--contrib/binutils/bfd/i386aout.c11
-rw-r--r--contrib/binutils/bfd/i386linux.c105
-rw-r--r--contrib/binutils/bfd/ieee.c1198
-rw-r--r--contrib/binutils/bfd/ihex.c136
-rw-r--r--contrib/binutils/bfd/init.c6
-rw-r--r--contrib/binutils/bfd/libaout.h211
-rw-r--r--contrib/binutils/bfd/libbfd-in.h502
-rw-r--r--contrib/binutils/bfd/libbfd.c1153
-rw-r--r--contrib/binutils/bfd/libbfd.h773
-rw-r--r--contrib/binutils/bfd/libcoff-in.h98
-rw-r--r--contrib/binutils/bfd/libcoff.h147
-rw-r--r--contrib/binutils/bfd/libecoff.h84
-rw-r--r--contrib/binutils/bfd/libieee.h12
-rw-r--r--contrib/binutils/bfd/libpei.h52
-rw-r--r--contrib/binutils/bfd/linker.c945
-rw-r--r--contrib/binutils/bfd/merge.c413
-rw-r--r--contrib/binutils/bfd/netbsd-core.c105
-rw-r--r--contrib/binutils/bfd/netbsd.h8
-rw-r--r--contrib/binutils/bfd/opncls.c742
-rw-r--r--contrib/binutils/bfd/osf-core.c64
-rw-r--r--contrib/binutils/bfd/pe-arm.c4
-rw-r--r--contrib/binutils/bfd/pe-i386.c2
-rw-r--r--contrib/binutils/bfd/peXXigen.c249
-rw-r--r--contrib/binutils/bfd/peicode.h156
-rw-r--r--contrib/binutils/bfd/po/BLD-POTFILES.in1
-rw-r--r--contrib/binutils/bfd/po/Make-in24
-rw-r--r--contrib/binutils/bfd/po/SRC-POTFILES.in101
-rw-r--r--contrib/binutils/bfd/po/bfd.pot1722
-rw-r--r--contrib/binutils/bfd/ppcboot.c48
-rw-r--r--contrib/binutils/bfd/ptrace-core.c78
-rw-r--r--contrib/binutils/bfd/reloc.c977
-rw-r--r--contrib/binutils/bfd/reloc16.c105
-rw-r--r--contrib/binutils/bfd/rs6000-core.c26
-rw-r--r--contrib/binutils/bfd/sco5-core.c146
-rw-r--r--contrib/binutils/bfd/section.c332
-rw-r--r--contrib/binutils/bfd/simple.c257
-rw-r--r--contrib/binutils/bfd/sparclinux.c448
-rw-r--r--contrib/binutils/bfd/sparcnetbsd.c3
-rw-r--r--contrib/binutils/bfd/srec.c189
-rw-r--r--contrib/binutils/bfd/stabs.c178
-rw-r--r--contrib/binutils/bfd/sunos.c372
-rw-r--r--contrib/binutils/bfd/syms.c325
-rw-r--r--contrib/binutils/bfd/sysdep.h2
-rw-r--r--contrib/binutils/bfd/targets.c509
-rw-r--r--contrib/binutils/bfd/tekhex.c76
-rw-r--r--contrib/binutils/bfd/trad-core.c92
-rw-r--r--contrib/binutils/bfd/version.h4
-rw-r--r--contrib/binutils/bfd/xcoff-target.h22
-rw-r--r--contrib/binutils/bfd/xcofflink.c867
167 files changed, 66204 insertions, 33746 deletions
diff --git a/contrib/binutils/bfd/ChangeLog b/contrib/binutils/bfd/ChangeLog
index 6c92f76..04a27e1 100644
--- a/contrib/binutils/bfd/ChangeLog
+++ b/contrib/binutils/bfd/ChangeLog
@@ -1,4632 +1,1233 @@
-2002-11-27 David O'Brien <obrien@FreeBSD.org>
+2004-05-17 Daniel Jacobowitz <dan@debian.org>
- * elf.c (_bfd_elf_copy_private_section_data): Don't define bed.
-
-2002-11-21 Richard Henderson <rth@redhat.com>
-
- * elflink.h (elf_link_add_object_symbols): Don't overwrite the
- arch's st_other bits when merging visibilities.
- (elf_link_output_extsym): Tidy clearing of visibility field.
-
-2002-11-14 David O'Brien <obrien@FreeBSD.org>
-
- Merge from mainline:
- 2002-11-12 Thomas Moestl <tmm@FreeBSD.org>
- * elf64-sparc.c (sparc64_elf_adjust_dynamic_symbol): Correct
- references to large plt symbols.
-
-2002-11-13 Alan Modra <amodra@bigpond.net.au>
-
- Merge from mainline.
- 2002-11-07 Alan Modra <amodra@bigpond.net.au>
- * elf64-ppc.c: Comment typo fixes.
- (ppc64_elf_merge_private_bfd_data): Allow BFD_ENDIAN_UNKNOWN input.
-
-2002-11-11 Nick Clifton <nickc@redhat.com>
-
- Import this patch from mainline:
-
- 2002-09-19 Nick Clifton <nickc@redhat.com>
-
- * elflink.h (elf_fix_symbol_flags): When examining weak symbols,
- follow indirect links.
-
-2002-11-07 Daniel Jacobowitz <drow@mvista.com>
-
- * configure.in: Clear is_release on the branch after release.
-
-2002-11-07 Daniel Jacobowitz <drow@mvista.com>
-
- * configure.in: Bump version and set is_release.
+ * configure.in: Mark unreleased for post-2.15 snapshots.
* configure: Regenerate.
-2002-11-07 Nick Clifton <nickc@redhat.com>
-
- * po/da.po: Updated Danish translation.
-
-2002-11-07 Graeme Peterson <gp@qnx.com>
-
- * Makefile.am: Removed entries for elf32-i386qnx.c and
- elf32-i386qnx.lo.
- * Makefile.in: Regenerate.
- * config.bfd: Changed i[3456]86-*-nto-qnx* targ_defvec from
- bfd_elf32_i386qnx_vec to bfd_elf32_i386_vec.
- * configure.in: Removed support for bfd_elf32_i386qnx_vec.
- * configure: Regenerate.
- * elf32-i386qnx.c: Removed.
- * elf.c: Removed calls to QNX specific set_nonloadable_filepos,
- is_contained_by_filepos, and copy_private_bfd_data_p.
- * elf32-i386.c: Removed QNX specific #ifdef ELF32_I386_C_INCLUDED.
- * targets.c: Removed bfd_elf32_i386qnx_vec.
- * elfxx-target.h: Removed QNX specific elf_backend_set_nonloadable_filepos,
- elf_backend_is_contained_by_filepos, and elf_backend_copy_private_bfd_data_p.
- * elf-bfd.h: Removed QNX specific set_nonloadable_filepos,
- is_contained_by_filepos, and copy_private_bfd_data_p.
-
-2002-11-06 David O'Brien <obrien@FreeBSD.org>
- Alan Modra <amodra@bigpond.net.au>
-
- * elf64-sparc.c (sparc64_elf_relocate_section): Adjust addend of
- dynamic relocs against section symbols for the output section vma.
-
-2002-11-05 Elias Athanasopoulos <eathan@otenet.gr>
-
- * vms-gsd.c (_bfd_vms_write_gsd): Check that symbol->udata.p is
- non-NULL before dereferencing.
-
-2002-11-04 Kaz Kojima <kkojima@rr.iij4u.or.jp>
-
- * vms.c (vms_object_p): Restore the start address when returning
- NULL.
-
-2002-10-31 David O'Brien <obrien@FreeBSD.org>
-
- * elf-eh-frame.c (_bfd_elf_discard_section_eh_frame): Don't mix
- signed and unsigned in comparison.
-
-2002-10-30 Daniel Jacobowitz <drow@mvista.com>
-
- * bfd-in2.h: Regenerated.
- * po/SRC-POTFILES.in: Regenerated.
- * po/bfd.pot: Regenerated.
-
-2002-10-30 Daniel Jacobowitz <drow@mvista.com>
+2004-05-17 Daniel Jacobowitz <dan@debian.org>
- * coffcode.h: Remove extraneous '\'.
-
-2002-10-28 Daniel Jacobowitz <drow@mvista.com>
-
- Merge from mainline:
- 2002-10-24 John David Anglin <dave@hiauly1.hia.nrc.ca>
- * aoutx.h (NAME(aout,swap_ext_reloc_in)): Cast bytes->r_index to
- unsigned int. Cast RELOC_BASE10, RELOC_BASE13 and RELOC_BASE22 to
- unsigned int.
- (NAME(aout,final_link)): Cast enum used in assignment.
- (aout_link_write_symbols): Cast enums in comparisons, int values to
- boolean, enums in assignments to int.
- (aout_link_input_section_std): Cast rel->r_index to unsigned int.
- (aout_link_input_section_ext): Likewise. Cast enums used in comparisons
- with unsigned ints.
- (aout_link_reloc_link_order): Cast enum to int in assignment.
- * archive.c (_bfd_generic_read_ar_hdr_mag): Cast result of memchr
- calls to char *.
- * bfd-in.h (bfd_set_section_vma): Cast enum true to unsigned int in
- assignment.
- * bfd-in2.h (bfd_set_section_vma): Likewise.
- * bfd.c (bfd_record_phdr): Cast enums in assignments.
- * binary.c (bfd_alloc): Cast enum to long.
- * coffgen.c (_bfd_coff_is_local_label_name): Cast return to boolean.
- * dwarf2.c (read_abbrevs): Add casts to enum types.
- (read_attribute_value): Likewise.
- (arange_add): Cast result of bfd_zalloc call.
- (comp_unit_contains_address): Return true and false.
- (comp_unit_find_nearest_line): Cast return to boolean.
- * format.c (bfd_check_format_matches, bfd_set_format): Likewise.
- * gen-aout.c: define macro '_' if not defined.
- * libbfd.c (bfd_realloc): Cast malloc and realloc to PTR.
- (bfd_bwrite): Cast bfd_realloc to bfd_byte *.
- (bfd_write_bigendian_4byte_int): Cast return to boolean.
- (bfd_seek): Cast bfd_realloc to bfd_byte *.
- (bfd_generic_is_local_label_name): Cast return to boolean.
- * libcoff.h (_bfd_coff_adjust_symndx): Remove extraneous '\'.
- * linker.c (_bfd_link_hash_newfunc): Cast bfd_hash_allocate result to
- struct bfd_hash_entry *.
- (_bfd_generic_link_hash_newfunc): likewise.
- (_bfd_generic_final_link): Cast enum to unsigned int.
- * merge.c (sec_merge_emit): Cast return to boolean.
- (merge_strings): Add casts to const unsigned char *.
- * reloc.c (bfd_get_reloc_code_name): Cast enums in comparison to int.
- (bfd_generic_get_relocated_section_content): Cast enum to unsigned int.
- * section.c (bfd_section_hash_newfunc): Cast bfd_hash_allocate result to
- struct bfd_hash_entry *.
- (bfd_set_section_content): Add cast to PTR in comparison.
- * srec.c (S3Forced): Initialize to false.
- (srec_get_symtab): Cast return value from bfd_alloc to asymbol *.
- * stabs.c (_bfd_link_section_stabs): Cast enum to int in comparisons.
- (_bfd_discard_section_stabs): Likewise. Also cast return to boolean.
- * syms.c (bfd_is_undefined_symclass): Cast return to boolean.
- (_bfd_stab_section_find_nearest_line): Cast enum to bfd_byte in
- comparisons.
-
- 2002-10-23 Jakub Jelinek <jakub@redhat.com>
- * elf64-alpha.c (elf64_alpha_check_relocs): Only put maybe_dynamic
- relocs into shared lib non-allocated reloc sections.
-
- 2002-10-23 Nathan Tallent <eraxxon@alumni.rice.edu>
- * dwarf2.c (add_line_info): Ensure that the line_info_table is
- sorted even when given an out-of-order line sequence.
- (lookup_address_in_line_info_table): When an exact VMA match is
- not found, return line information with the closest VMA.
-
- 2002-10-21 Alan Modra <amodra@bigpond.net.au>
- * targets.c (bfd_target_list): Don't return the default target twice.
-
- 2002-10-19 H.J. Lu <hjl@gnu.org>
- * elflink.h (elf_link_add_object_symbols): Correctly handle
- DT_RPATH and DT_RUNPATH.
-
- 2002-10-16 Jakub Jelinek <jakub@redhat.com>
- * config.bfd (s390-*-linux*): Add targ64_selvecs.
- (s390x-*-linux*): Add targ_selvecs.
-
- 2002-10-16 Alan Modra <amodra@bigpond.net.au>
- * elflink.h (elf_link_add_object_symbols): Error out on dynamic objects
- loaded with --just-symbols.
-
- * elf32-i386qnx.c (TARGET_LITTLE_NAME): Define.
-
- 2002-10-14 Kaz Kojima <kkojima@rr.iij4u.or.jp>
- * config.bfd (sh*eb-*-linux*, sh*-*-linux*): Add the alternative
- endian vector to targ_selvecs.
-
- 2002-10-08 H.J. Lu <hjl@gnu.org>
- * elf32-i386.c (elf_i386_relocate_section): Re-arrange the
- IE->LE transition for R_386_TLS_IE.
-
- 2002-10-07 Mark Elbrecht <snowball3@softhome.net>
- * cofflink.c (mark_relocs): Don't mark relocations in excluded
- sections.
-
- 2002-10-05 Alexandre Oliva <aoliva@redhat.com>
- * elfxx-mips.c (mips_elf_create_dynamic_relocation): Set the type
- of the other two relocations packed with a REL32 to NONE.
-
- 2002-10-02 Stephen Clarke <stephen.clarke@superh.com>
- * elf32-sh.c (elf_sh_link_hash_entry): Add gotplt_refcount.
- (sh_elf_link_hash_newfunc): Initialize it.
- (allocate_dynrelocs): Transfer gotplt refs from plt.refcount
- to got.refcount for symbols that are forced local or when
- we have direct got refs.
- (sh_elf_gc_sweep_hook): Adjust gotplt_refcount. Use it
- to correctly adjust got.refcount and plt.refcount.
- (sh_elf_copy_indirect_symbol): Copy gotplt_refcount across.
- (sh_elf_check_relocs): Increment gotplt_refcount.
-
- 2002-10-01 Jakub Jelinek <jakub@redhat.com>
- * elf32-i386.c (elf_i386_relocate_section): Fix
- movl foo@indntpoff, %eax IE->LE transition.
-
- 2002-09-28 Jason Thorpe <thorpej@wasabisystems.com>
- * elf32-vax.c (elf_vax_size_dynamic_section): Don't strip
- .got sections.
-
- 2002-09-27 Matt Thomas <matt@3am-software.com>
- * elf32-vax.c (elf_vax_check_relocs): Remove unused
- local_got_refcounts usage. Remove allocation of got slot.
- (elf_vax_gc_sweep_hook): Remove unused local_got_refcounts usage.
- Remove de-allocation of got slot.
- (elf_vax_size_dynamic_section): Fix some indentation. Add hash
- traversal for elf_vax_instantiate_got_entries. Allow empty .got
- sections to be GC'ed.
- (elf_vax_instantiate_got_entries): New function.
- (elf_vax_relocate_section): Simplify R_VAX_GOT32 handling. Remove
- tests that are now handled by elf_vax_instantiate_got_entries.
- Assert GOT entry falls within .got section size. Remove redundant
- comparisions. Fix comments.
-
- 2002-09-24 Jakub Jelinek <jakub@redhat.com>
- * elf32-sparc.c (elf32_sparc_relocate_section): Put R_SPARC_RELATIVE
- addend into r_addend, not *r_offset.
- (elf32_sparc_finish_dynamic_symbol): Likewise.
- * elf64-sparc.c (sparc64_elf_finish_dynamic_symbol): Clear xword at
- R_SPARC_RELATIVE's r_offset.
-
- 2002-08-07 Thiemo Seufer <seufer@csv.ica.uni-stuttgart.de>
- * elfxx-mips.c (mips_elf_create_dynamic_relocation): Cast signedness
- mismatch.
-
-2002-10-14 Richard Henderson <rth@redhat.com>
-
- * elf64-alpha.c (elf64_alpha_relocate_section) [BRSGP]: Increment
- VALUE, not ADDEND.
-
-2002-10-11 Alan Modra <amodra@bigpond.net.au>
-
- * coff-arm.c (record_arm_to_thumb_glue): Avoid type-punned pointers.
- (record_thumb_to_arm_glue): Likewise.
- * ecoff.c (ecoff_link_add_externals): Likewise.
- * elf32-arm.h (record_arm_to_thumb_glue): Likewise.
- (record_thumb_to_arm_glue): Likewise.
- * elf32-m32r.c (m32r_elf_add_symbol_hook): Likewise.
- * elf32-sh.c (sh_elf_create_dynamic_sections): Likewise.
- * elf32-sh64.c (sh64_elf_add_symbol_hook): Likewise.
- * elf64-alpha.c (elf64_alpha_create_dynamic_sections): Likewise.
- * elf64-ppc.c (func_desc_adjust): Likewise.
- * elf64-sh64.c (sh64_elf64_add_symbol_hook): Likewise.
- (sh64_elf64_create_dynamic_sections): Likewise.
- * elflink.c (_bfd_elf_create_got_section): Likewise.
- (_bfd_elf_create_dynamic_sections): Likewise.
- (_bfd_elf_create_linker_section): Likewise.
- * elflink.h (elf_add_default_symbol): Likewise.
- (elf_link_create_dynamic_sections): Likewise.
- (NAME(bfd_elf,size_dynamic_sections)): Likewise.
- * elfxx-ia64.c (elfNN_ia64_aix_add_symbol_hook): Likewise.
- * elfxx-mips.c (mips_elf_create_got_section): Likewise.
- (_bfd_mips_elf_add_symbol_hook): Likewise.
- (_bfd_mips_elf_create_dynamic_sections): Likewise.
- * linker.c (generic_link_add_symbol_list): Likewise.
- * xcofflink.c (xcoff_link_add_symbols): Likewise.
-
- * elfxx-ia64.c (oor_brl, oor_ip): Conditionally define.
-
- * elf64-ppc.c (edit_opd): Only zero opd syms when function is
- completely removed. Correct local sym adjustment.
-
-2002-10-08 Alan Modra <amodra@bigpond.net.au>
-
- * elf64-ppc.c (edit_opd): Correct test for discarded sections.
-
-2002-10-07 Alan Modra <amodra@bigpond.net.au>
-
- * elflink.h (elf_link_input_bfd): Remove BFD_VERSION_DATE dependent
- code.
-
- * elf64-ppc.c (ppc64_elf_build_stubs): Increment .glink indx.
-
-2002-09-28 Alan Modra <amodra@bigpond.net.au>
-
- * elf.c (map_sections_to_segments): Correct test for start of
- writable section in the same page as end of read-only section.
-
-2002-09-26 Alan Modra <amodra@bigpond.net.au>
-
- * elf64-ppc.c (ppc_build_one_stub): Don't build glink stubs here.
- (ppc64_elf_build_stubs): Build them here instead.
-
-2002-09-23 Daniel Jacobowitz <drow@mvista.com>
-
- Merge from mainline:
- 2002-09-23 Alan Modra <amodra@bigpond.net.au>
- * elf-eh-frame.c (_bfd_elf_discard_section_eh_frame): Zero relocs
- for discarded FDEs. Remove redundant assignment.
- * elflink.h (elf_bfd_discard_info): Save edited relocs.
-
- 2002-09-23 Nathan Tallent <eraxxon@alumni.rice.edu>
- * dwarf2.c (decode_line_info): Update to correctly decode
- the (non-standard DWARF2) out-of-order address sequences
- generated by the Intel C++ 6.0 compiler for ia64-Linux.
-
- 2002-09-22 H.J. Lu <hjl@gnu.org>
- * elf64-alpha.c (elf64_alpha_merge_ind_symbols): Don't merge
- the relocation count between different .reloc sections.
-
- 2002-09-22 Mark Elbrecht <snowball3@softhome.net>
- * config.bfd: For DJGPP targets, match with any cpu and any machine.
-
- 2002-09-21 Alan Modra <amodra@bigpond.net.au>
- * elfcode.h (elf_slurp_reloc_table_from_section): Make "symcount"
- unsigned. Move "symcount" assignment out of loop.
-
- 2002-09-19 Nathan Tallent <eraxxon@alumni.rice.edu>
- * dwarf2.c (_bfd_dwarf2_find_nearest_line): If address length is
- zero, set it to 8 for (non-standard) 64-bit DWARF2 formats
- (e.g. IRIX64).
-
- 2002-09-19 Jakub Jelinek <jakub@redhat.com>
- * reloc.c (BFD_RELOC_386_TLS_TPOFF, BFD_RELOC_386_TLS_IE,
- BFD_RELOC_386_TLS_GOTIE): Add.
- * bfd-in2.h, libbfd.h: Rebuilt.
- * elf32-i386.c (elf_howto_table): Add R_386_TLS_TPOFF, R_386_TLS_IE
- and R_386_TLS_GOTIE.
- (elf_i386_reloc_type_lookup): Handle it.
- (struct elf_i386_link_hash_entry): Change tls_type type to unsigned
- char instead of enum, change GOT_* into defines.
- (GOT_TLS_IE_POS, GOT_TLS_IE_NEG, GOT_TLS_IE_BOTH): Define.
- (elf_i386_tls_transition): Handle R_386_TLS_IE and R_386_TLS_GOTIE.
- (elf_i386_check_relocs): Likewise. Avoid crash if local symbol is
- accessed both as normal and TLS symbol. Move R_386_TLS_LDM and
- R_386_PLT32 cases so that R_386_TLS_IE can fall through.
- Handle R_386_TLS_LE_32 and R_386_TLS_LE in shared libs.
- (elf_i386_gc_sweep_hook): Handle R_386_TLS_IE and R_386_TLS_GOTIE.
- Handle R_386_TLS_LE_32 and R_386_TLS_LE in shared libs.
- (allocate_dynrelocs): Allocate 2 .got and 2 .rel.got entries if
- tls_type is GOT_TLS_IE_BOTH.
- (elf_i386_size_dynamic_sections): Likewise.
- (elf_i386_relocate_section): Handle R_386_TLS_IE and R_386_TLS_GOTIE.
- Handle R_386_TLS_LE_32 and R_386_TLS_LE in shared libs.
- (elf_i386_finish_dynamic_symbol): Use tls_type & GOT_TLS_IE to catch
- all 4 GOT_TLS_* TLS types.
-
- 2002-09-18 Daniel Jacobowitz <drow@mvista.com>
- * elfcode.h (elf_slurp_reloc_table_from_section): Check
- correct relocation count.
-
- 2002-09-17 Daniel Jacobowitz <drow@mvista.com>
- * bfd-in.h (bfd_get_dynamic_symcount): Define.
- * bfd.c (struct _bfd): Add dynsymcount.
- * bfd-in2.h: Regenerated.
- * elf.c (_bfd_elf_canonicalize_dynamic_symtab): Set
- abfd->dynsymcount.
- * elfcode.h (elf_slurp_reloc_table_from_section): Check
- for overflow.
-
- 2002-09-17 Alan Modra <amodra@bigpond.net.au>
- * elf64-alpha.c (alpha_elf_size_info): Make static.
-
- 2002-09-17 Jakub Jelinek <jakub@redhat.com>
- * elf32-ppc.c (ppc_elf_finish_dynamic_symbol): Clear .got word
- even if generating R_PPC_RELATIVE reloc.
- (ppc_elf_relocate_section): Make sure relocation is performed if
- skip == -2. Clear memory at r_offset when creating dynamic
- relocation.
-
- 2002-09-16 David O'Brien <obrien@FreeBSD.org>
- * elf32-i386-fbsd.c: Always label using the EI_OSABI method.
- It is benign for FreeBSD < 4.1. Minor reformatting.
- * elf64-alpha-fbsd.c: Likewise.
-
- 2002-09-16 Nathan Tallent <eraxxon@alumni.rice.edu>
- * ecoff.c (_bfd_ecoff_slurp_symbolic_info) <ioptMax>: Fix error
- reading ECOFF information: 'ioptMax' refers to the actual *size*
- of the optimization symtab, not the number of entries.
-
- 2002-09-16 Jakub Jelinek <jakub@redhat.com>
- * elf_i386_relocate_section (R_386_TLS_TPOFF32): Negate addend.
-
- 2002-09-13 Daniel Jacobowitz <drow@mvista.com>
- * elf32-arm.h (elf32_arm_adjust_dynamic_symbol): Update
- ELF_LINK_HASH_NEEDS_PLT logic.
-
- 2002-09-11 Nick Clifton <nickc@redhat.com>
- * po/da.po: New Danish translation file.
- * configure.in (LINGUAS): Add 'da'.
+ * configure.in: Bump version to 2.15. Mark as released.
* configure: Regenerate.
- 2002-09-11 Jakub Jelinek <jakub@redhat.com>
- * elf32-i386.c (dtpoff_base, tpoff): Don't crash if tls_segment is
- NULL.
- (elf_i386_relocate_section): Return false after printing error about
- unresolvable relocation.
-
- 2002-09-11 Jeffrey Law <law@redhat.com>
- * elf32-h8300.c (elf32_h8_relax_section): Fix typo.
-
- 2002-09-06 Andrew Haley <aph@cambridge.redhat.com>
- * elf.c (_bfd_elf_find_nearest_line): Check functionname_ptr and
- line_ptr before deciding we've found a symbol.
-
- 2002-08-29 John David Anglin <dave@hiauly1.hia.nrc.ca>
- * bfd-in.h (align_power): Cast constants to bfd_vma type.
- * bfd-in2.h (align_power): Likewise.
-
- 2002-08-24 Kaz Kojima <kkojima@rr.iij4u.or.jp>
- * elf32-sh.c (sh_elf_copy_indirect_symbol): New.
- (create_got_section, allocate_dynrelocs, readonly_dynrelocs):
- Likewise.
- (struct elf_sh_pcrel_relocs_copied): Removed.
- (struct elf_sh_dyn_relocs): New.
- (struct elf_sh_link_hash_entry): Replace pcrel_relocs_copied
- field with dyn_relocs.
- (struct elf_sh_link_hash_table): Add short-cuts to get dynamic
- sections and sym_sec.
- (sh_elf_link_hash_newfunc): Clear dyn_relocs.
- (sh_elf_link_hash_table_create): Clear shorts-cuts and sym_sec.
- (sh_elf_create_dynamic_sections): Use create_got_section instead
- of _bfd_elf_create_got_section.
- (sh_elf_check_relocs): Likewise.
- (sh_elf_create_dynamic_sections): Use short-cuts to the dynamic
- sections.
- (sh_elf_adjust_dynamic_symbol, sh_elf_size_dynamic_sections,
- sh_elf_relocate_section, sh_elf_check_relocs,
- sh_elf_finish_dynamic_symbol, sh_elf_finish_dynamic_sections):
- Likewise.
- (sh_elf_adjust_dynamic_symbol): Handle nocopyreloc. Keep the
- dynamic relocations and avoiding the copy relocation when we
- didn't find any dynamic relocations in the section which has
- contents or is read-only.
- (WILL_CALL_FINISH_DYNAMIC_SYMBOL): New.
- (sh_elf_size_dynamic_sections): Don't reset the size of
- .rela.got section even if dynamic_sections_created flag is off.
- Don't use sh_elf_discard_copies. Scan all input bfd and use
- allocate_dynrelocs. Call readonly_dynrelocs to determine
- whether we need DT_TEXTREL.
- (sh_elf_adjust_dynamic_symbol): Use plt.refcount to determine
- whether the symbol was never referred to.
- (sh_elf_relocate_section): Use WILL_CALL_FINISH_DYNAMIC_SYMBOL.
- (sh_elf_gc_sweep_hook): Fill with the real sweep function.
- (sh_elf_check_relocs): Call create_got_section if the short-cut
- to .got is null. Increment reference counters only instead of
- allocating space on dynamic sections here. Don't conditionalize
- uninitialized got.offset value when marking the symbol as a
- global offset table entry. Keep relocations for symbols satisfied
- by a dynamic library to avoid copy relocations for the symbol.
- Set dynobj field of an elf hash table if needed.
- (sh_elf_finish_dynamic_sections): Handle null section pointer
- correctly.
- (elf_backend_copy_indirect_symbol): Defined.
- (elf_backend_can_refcount): Defined.
-
- 2002-08-22 Nick Clifton <nickc@redhat.com>
- * po/tr.po: Updated Turkish translation.
-
- 2002-08-21 Stephen Clarke <stephen.clarke@superh.com>
- * bfd/elf32-sh.c (sh_elf_size_dynamic_sections): Zero
- initialize dynamic section.
- * bfd/elf64-sh64.c (sh64_elf64_size_dynamic_sections):
- Likewise.
-
- 2002-08-13 H.J. Lu <hjl@gnu.org>
- * elflink.h (NAME(bfd_elf,size_dynamic_sections): Don't count
- definitions in shared objects when checking symbol with
- undefined version.
-
- 2002-08-10 H.J. Lu <hjl@gnu.org>
- * elflink.h (elf_add_default_symbol): Preserve section across
- elf_merge_symbol.
-
- 2002-08-09 Nick Clifton <nickc@redhat.com>
- * po/sv.po: Updated Swedish translation.
-
- 2002-08-08 Alan Modra <amodra@bigpond.net.au>
- * elflink.h (elf_link_output_extsym): Don't output symbols from
- SEC_EXCLUDE sections.
-
- * aoutx.h (aout_link_write_symbols): Correct handling of warning syms.
-
- 2002-08-08 H.J. Lu <hjl@gnu.org>
- * elflink.h (elf_add_default_symbol): Don't warn a defintion
- overrides an indirect versioned symbol.
-
- 2002-08-07 Alan Modra <amodra@bigpond.net.au>
- * elf64-ppc.c (edit_opd): Arrange to drop symbols for discarded .opd
- entries.
-
- 2002-08-07 Jakub Jelinek <jakub@redhat.com>
- * elf32-i386.c (elf_i386_relocate_section): Fill in proper addend
- for R_386_TLS_TPOFF32 relocs against symndx 0.
-
- 2002-08-07 Thiemo Seufer <seufer@csv.ica.uni-stuttgart.de>
- * elfxx-mips.c (mips_elf_global_got_index): Avoid segfault if
- g->global_gotsym is NULL.
-
- 2002-08-06 Alan Modra <amodra@bigpond.net.au>
- * xcofflink.c (xcoff_write_global_symbol): Set n_scnum for abs_section.
-
- 2002-08-06 Alan Modra <amodra@bigpond.net.au>
- * elf64-ppc.c (ppc64_elf_howto_raw): Zero all src_mask entries.
-
- 2002-08-06 H.J. Lu <hjl@gnu.org>
- * elflink.h (NAME(bfd_elf,size_dynamic_sections)): Check symbol
- with undefined version if needed.
- (elf_link_assign_sym_version): Match a default symbol with a
- version without definition. No need to hide the default
- definition separately.
-
- 2002-08-06 Alan Modra <amodra@bigpond.net.au>
- * coff-rs6000.c: Formatting fixes.
- (xcoff_calculate_relocation): Use PARAMS in declaration.
- (xcoff_complain_overflow): Likewise.
- (xcoff_ppc_relocate_section): Use old-style function pointer call.
- (bfd_xcoff_backend_data): Remove useless comments.
- (rs6000coff_vec): Likewise.
- (bfd_pmac_xcoff_backend_data): Likewise.
- (pmac_xcoff_vec): Likewise.
- * coff64-rs6000.c: Formatting fixes.
- (xcoff64_calculate_relocation): Use PARAMS in declaration.
- (xcoff64_ppc_relocate_section): Use old-style function pointer call.
- (bfd_xcoff_backend_data): Remove useless comments.
- (rs6000coff64_vec): Likewise.
- (bfd_xcoff_aix5_backend_data): Likewise.
- (aix5coff64_vec): Likewise.
-
- 2002-08-06 Alan Modra <amodra@bigpond.net.au>
- * coff-rs6000.c: (xcoff_rtype2howto): Don't place reloc address in
- addend.
- * coff64-rs6000.c: (xcoff64_rtype2howto): Likewise.
-
- 2002-08-06 Alan Modra <amodra@bigpond.net.au>
- * coff-rs6000.c (xcoff_howto_table): Revert some of last change to
- mask entries. Use complain_overflow_dont for R_REF.
- (xcoff_reloc_type_ba): Revert last change.
- (xcoff_reloc_type_br): Likewise.
- (xcoff_reloc_type_crel): Likewise.
- (xcoff_ppc_relocate_section): Likewise.
- * coff64-rs6000.c (xcoff64_reloc_type_br): Likewise.
- (xcoff64_ppc_relocate_section): Likewise.
- (xcoff64_howto_table): Revert some of last change to mask entries.
- Use complain_overflow_dont for R_REF.
-
- * coff-rs6000.c (xcoff_howto_table): Fix src_mask entries. Make all
- relocs with bitsize == 16 have size = 1.
- (xcoff_reloc_type_ba): Correct src_mask and dst_mask adjustment.
- (xcoff_reloc_type_br): Likewise.
- (xcoff_reloc_type_crel): Likewise.
- (xcoff_ppc_relocate_section): Set up src_mask and dst_mask correctly.
- * coff64-rs6000.c (xcoff64_reloc_type_br): Correct src_mask and
- dst_mask adjustment.
- (xcoff64_ppc_relocate_section): Set up src_mask and dst_mask correctly.
- (xcoff64_howto_table): Fix src_mask entries. Make all relocs with
- bitsize == 16 have size = 1.
-
- 2002-07-31 Nick Clifton <nickc@redhat.com>
- * bfd.c (bfd_alt_mach_code): Rename parameter 'index' to
- 'alternative' in order to avoid shadowing global symbol of the
- same name.
- * bfd-in2.h: Regenerate.
- * libbfd.h: Regenerate.
- * libcoff.h: Regenerate.
-
- 2002-07-30 Alan Modra <amodra@bigpond.net.au>
- * aoutx.h (some_aout_object_p): Clean up tdata properly on error.
- * archive.c (bfd_generic_archive_p): Likewise.
- * coff-rs6000.c (_bfd_xcoff_archive_p): Likewise.
- (_bfd_xcoff_archive_p): Use bfd_scan_vma in place of strtol.
- * coff64-rs6000.c (xcoff64_slurp_armap): Likewise.
- (xcoff64_archive_p): Likewise.
- (xcoff64_openr_next_archived_file): Likewise.
- (xcoff64_archive_p): Clean up tdata properly on error.
- * coffgen.c (coff_real_object_p): Likewise.
- (coff_object_p): Release filehdr and opthdr.
- * ecoff.c (_bfd_ecoff_archive_p): Clean up tdata properly on error.
- * ieee.c (ieee_archive_p): Likewise.
- * ihex.c (ihex_object_p): Likewise.
- (ihex_mkobject): Always allocate tdata.
- * peicode.h (pe_ILF_object_p): Release bfd_alloc'd buffer on error.
- * srec.c (srec_mkobject): Always allocate tdata.
- (srec_object_p): Clean up tdata properly on error.
- (symbolsrec_object_p): Likewise.
- * versados.c (versados_object_p): Likewise.
- * vms-misc.c (_bfd_vms_get_record): Use bfd_malloc instead of malloc,
- and bfd_realloc instead of realloc.
- (add_new_contents): Use bfd_alloc instead of bfd_malloc for sections.
- * vms.c (vms_initialize): Always allocate tdata. Use bfd_alloc in
- place of bfd_malloc, simplifying error freeing. Free hash table too.
- (vms_object_p): Clean up tdata on error.
- (vms_mkobject): Don't complain on stderr if vms_initialize fails.
- (vms_close_and_cleanup): Adjust for bfd_alloc use.
-
- 2002-07-17 Ian Rickards <irickard@arm.com>
- * dwarf2.c (concat_filename): If we can't establish the directory
- just return the filename.
-
- 2002-07-16 Alan Modra <amodra@bigpond.net.au>
- * elflink.h: Formatting fixes, tidy prototypes.
- (elf_link_assign_sym_version): Move common code out of loop.
-
- 2002-07-04 Bruno Haible <bruno@clisp.org>
- * elf32-i386.c: Don't defined ELF_ARCH etc. if this file is included
- by a target variant implementation.
- * elf64-alpha.c: Likewise.
- * elf32-i386-fbsd.c: New file.
- * elf64-alpha-fbsd.c: New file.
- * targets.c: Support bfd_elf32_i386_freebsd_vec and
- bfd_elf64_alpha_freebsd_vec.
- * configure.in: Accept the vectors bfd_elf32_i386_freebsd_vec,
- bfd_elf64_alpha_freebsd_vec.
- * Makefile.am (BFD32_BACKENDS): Add elf32-i386-fbsd.lo.
- (BFD32_BACKENDS_CFILES): Add elf32-i386-fbsd.c.
- (BFD64_BACKENDS): Add elf64-alpha-fbsd.lo.
- (BFD64_BACKENDS_CFILES): Add elf64-alpha-fbsd.c.
- (elf32-i386-fbsd.lo, elf64-alpha-fbsd.lo): Add dependencies.
- * config.bfd: For FreeBSD targets, set targ_defvec to a FreeBSD
- specific targets. Define OLD_FREEBSD_ABI_LABEL if appropriate.
-
-2002-09-21 David O'Brien <obrien@FreeBSD.org>
+2004-05-13 Joel Sherrill <joel@oarcorp.com>
- Merge from mainline:
- 2002-08-17 Andrew Cagney <ac131313@redhat.com>
- * elf.c (bfd_elf_get_elf_syms): Change type of `esym' to
- `bfd_byte'.
+ * config.bfd (or32-*-rtems*): Switch to elf.
-2002-08-26 Alan Modra <amodra@bigpond.net.au>
+2004-05-13 Nick Clifton <nickc@redhat.com>
- * coffcode.h (coff_set_arch_mach_hook): Handle W65MAGIC.
+ * po/fr.po: Updated French translation.
-2002-08-22 Alan Modra <amodra@bigpond.net.au>
+2004-05-07 Daniel Jacobowitz <dan@debian.org>
- * configure.in: Unset is_release.
+ * configure.in: Bump version to 2.14.92.
* configure: Regenerate.
- * elf-bfd.h (struct elf_backend_data): Add struct elf_backend_data
- param to elf_backend_copy_indirect_symbol.
- (_bfd_elf_link_hash_copy_indirect): Likewise.
- * elflink.h (elf_add_default_symbol, elf_fix_symbol_flags): Adjust
- calls to copy_indirect_symbol.
- * elf32-hppa.c (elf32_hppa_copy_indirect_symbol): Likewise.
- * elf32-i386.c (elf_i386_copy_indirect_symbol): Likewise.
- * elf32-s390.c (elf_s390_copy_indirect_symbol): Likewise.
- * elf64-ppc.c (ppc64_elf_copy_indirect_symbol): Likewise.
- * elf64-s390.c (elf_s390_copy_indirect_symbol): Likewise.
- * elf64-x86-64.c (elf64_x86_64_copy_indirect_symbol): Likewise.
- * elfxx-ia64.c (elfNN_ia64_hash_copy_indirect): Likewise.
- * elfxx-mips.c (_bfd_mips_elf_copy_indirect_symbol): Likewise.
- * elfxx-mips.h (_bfd_mips_elf_copy_indirect_symbol): Likewise.
- * elf.c (_bfd_elf_link_hash_copy_indirect): Likewise. Properly
- test refcounts for "used" values.
-
-2002-08-15 Hans-Peter Nilsson <hp@axis.com>
-
- * elf32-cris.c (elf_cris_discard_excess_program_dynamics): Add
- missing check for whether the symbol is referenced by DSO before
- unexporting it as an unneeded dynamic symbol.
-
-2002-08-05 Daniel Jacobowitz <drow@mvista.com>
-
- * configure.in: Bump version, set is_release.
- * configure: Regenerated.
-
-2002-08-01 Daniel Jacobowitz <drow@mvista.com>
+2004-05-07 Daniel Jacobowitz <dan@debian.org>
Merge from mainline:
- 2002-07-31 Jakub Jelinek <jakub@redhat.com>
- * elf32-i386.c (elf_i386_copy_indirect_symbol): Swap tls_type
- if _bfd_elf_link_hash_copy_indirect will swap got.refcount.
-
-2002-07-30 Daniel Jacobowitz <drow@mvista.com>
+ 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:
- 2002-07-30 Nick Clifton <nickc@redhat.com>
- * po/sv.po: Updated Swedish translation.
-
- 2002-07-30 Jakub Jelinek <jakub@redhat.com>
- * elf.c (elf_fake_sections): Fix up .tbss sh_size and sh_type.
-
- 2002-07-26 Chris Demetriou <cgd@broadcom.com>
- * elfxx-mips.c (_bfd_mips_elf_merge_private_bfd_data): Merge ASE
- flags into resulting BFD.
-
- 2002-07-25 Alan Modra <amodra@bigpond.net.au>
- * elf-bfd.h (_bfd_elf32_link_record_local_dynamic_symbol): Define
- as elf_link_record_local_dynamic_symbol.
- (_bfd_elf64_link_record_local_dynamic_symbol): Likewise.
- (elf_link_record_local_dynamic_symbol): Declare. Now returns int.
- * elflink.h (elf_link_record_local_dynamic_symbol): Move to..
- * elflink.c: .. here. Use bfd_elf_get_elf_syms. Check whether an
- attempt is made to record a symbol in a discarded section, and
- return `2' in that case.
-
-2002-07-26 Alan Modra <amodra@bigpond.net.au>
-
- From John Reiser <jreiser@BitWagon.com>
- * elf32-i386.c (elf_i386_link_hash_table_create): Clear
- tls_ldm_got.refcount.
-
-2002-07-25 Nick Clifton <nickc@redhat.com>
-
- * po/sv.po: Updated Swedish translation.
- * po/es.po: Updated Spanish translation.
- * po/fr.po: Updated French translation.
-
-2002-07-24 Nick Clifton <nickc@redhat.com>
-
- * po/sv.po: Updated Swedish translation.
- * po/es.po: Updates Spanish translation.
-
-2002-07-23 Daniel Jacobowitz <drow@mvista.com>
-
- * configure.in: Bump version for snapshot.
- * configure: Regenerated.
-
-2002-07-23 Daniel Jacobowitz <drow@mvista.com>
-
- * po/bfd.pot: Regenerated.
-
-2002-07-23 Nick Clifton <nickc@redhat.com>
-
- * elf-bfd.h (struct elf_backend_data): Add new bitfield
- 'want_p_paddr_set_to_zero'.
- * elfxx-target.h: Set default value for want_p_paddr_set_to_zero
- to false;
- * elfxx-ia64.c: Set want_p_paddr_set_zero for HPUX target.
- * elf.c (copy_private_bfd_data): Test want_p_paddr_set_zero.
-
-2002-07-23 Gabor Keresztfalvi <keresztg@mail.com>
-
- * nlmcode.h (nlm_swap_auxiliary_headers_out): Swapped the order of
- the MeSsAgEs and CoPyRiGhT tags to make >=NW4.x NLM loaders to
- show the Copyright string.
-
-2002-07-23 Nick Clifton <nickc@redhat.com>
-
- * po/fr.po: New French translation.
- * po/sv.po: New Swedish translation.
-
-2002-07-23 Alan Modra <amodra@bigpond.net.au>
-
- * elflink.h (elf_link_input_bfd): Don't change internal symbols
- when outputting relocs.
-
-2002-07-20 Jason Thorpe <thorpej@wasabisystems.com>
-
- * elf64-alpha.c (elf64_alpha_size_dynamic_sections): Only insert
- DT_PLTGOT into the dynamic section if there is a PLT.
-
-2002-07-19 Alan Modra <amodra@bigpond.net.au>
-
- * elfxx-ia64.c: (elfNN_ia64_modify_segment_map): Properly scan
- PT_IA_64_UNWIND segments for a given section.
-
-2002-07-16 Moritz Jodeit <moritz@jodeit.org>
-
- * peXXigen.c (_bfd_XXi_swap_aouthdr_out): Correct order of memset args.
-
-2002-07-16 Alan Modra <amodra@bigpond.net.au>
-
- * elflink.h (elf_link_input_bfd): Don't call reloc_emitter when
- reloc section size is zero. Correct reloc output location.
-
- Merge from mainline.
- 2002-07-14 H.J. Lu <hjl@gnu.org>
- * elflink.h (elf_link_assign_sym_version): Hide the default
- definition if there is a hidden versioned definition.
-
-2002-07-16 John David Anglin <dave@hiauly1.hia.nrc.ca>
-
- * elf-hppa.h (elf_hppa_reloc_final_type): Use R_PARISC_PCREL16F as
- the final type for the e_fsel selector when generating PA2.0W code.
- (elf_hppa_relocate_insn): Provide support for PA2.0W 16-bit format 1
- relocations.
-
-2002-07-12 Hans-Peter Nilsson <hp@axis.com>
-
- * elf32-cris.c (cris_elf_relocate_section): Drop nonsensical
- dynamic reference test in assertion when initializing GOT with
- static contents. Just assert that there are either no dynamic
- sections, the symbol is defined in the regular objects or that the
- symbol is undef weak. Tweak comment.
- (elf_cris_finish_dynamic_symbol): Emit .got reloc for a program
- only if the symbol isn't defined in the program and isn't undef
- weak.
- (elf_cris_adjust_dynamic_symbol): Simplify condition for getting
- rid of PLT entry: only do it if the symbol isn't defined in a DSO.
- When doing so, clear ELF_LINK_HASH_NEEDS_PLT. Tweak comments.
- (elf_cris_discard_excess_program_dynamics): Don't consider
- ELF_LINK_HASH_REF_DYNAMIC when omitting .got runtime relocs.
-
-2002-07-11 Alan Modra <amodra@bigpond.net.au>
-
- * elf32-i386.c (elf_i386_relocate_section): Don't complain about
- unresolved debugging relocs in dynamic applications.
- * elf32-s390.c (elf_s390_relocate_section): Likewise.
- * elf32-sparc.c (elf32_sparc_relocate_section): Likewise.
- * elf64-ppc.c (ppc64_elf_relocate_section): Likewise.
- * elf64-s390.c (elf_s390_relocate_section): Likewise.
+ 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.
- * elf64-x86-64.c (elf64_x86_64_relocate_section): Likewise.
-
-2002-07-10 Alan Modra <amodra@bigpond.net.au>
-
- * elf64-ppc.c (ONES): Define.
- (ppc64_elf_howto_table): Use ONES here to avoid warnings. Fill in
- missing src_mask fields. Tweak R_PPC64_NONE, R_PPC64_COPY. Fill
- in missing dst_mask fields on R_PPC64_PLT32, R_PPC64_PLTREL32.
-
- * elf64-ppc.c (ppc64_elf_get_symbol_info): Delete.
- (ppc64_elf_set_private_flags): Delete.
- (ppc64_elf_section_from_shdr): Delete.
- (ppc64_elf_merge_private_bfd_data): Remove flag checking/merging code.
- (ppc64_elf_fake_sections): Delete.
- (bfd_elf64_bfd_set_private_flags): Don't define.
- (bfd_elf64_get_symbol_info): Likewise.
- (elf_backend_section_from_shdr): Likewise.
- (elf_backend_fake_sections): Likewise.
-
-2002-07-10 Marco Walther <Marco.Walther@sun.com>
-
- * elf.c: (assign_section_numbers) Set sh_entsize for .stab only
- when not already set.
- * elf64-sparc.c: (sparc64_elf_fake_sections): New function.
- (elf_backend_fake_sections): Define.
-
-2002-07-10 Alan Modra <amodra@bigpond.net.au>
-
- * merge.c (_bfd_merge_section): Remove redundant output_section check.
- Formatting.
- (_bfd_merge_sections): Don't set SEC_EXCLUDE on unused sections.
-
-2002-07-09 Hans-Peter Nilsson <hp@axis.com>
-
- * elf32-cris.c (cris_elf_relocate_section): Move sanity-check for
- NULL sym_hashes to just before use.
- <case R_CRIS_32_GOTREL>: In test for local symbol, accept also
- symbol with non-default visibility.
- <case R_CRIS_32_GOTREL, case R_CRIS_32_PLT_GOTREL>: Ditto.
- <case R_CRIS_8_PCREL, case R_CRIS_16_PCREL, case R_CRIS_32_PCREL>:
- Ditto.
- (cris_elf_gc_sweep_hook): Only decrease h->plt.refcount for
- symbol with non-default visibility.
- (cris_elf_check_relocs): At tests for local symbol before
- increasing h->plt.refcount, also check for non-default
- visibility. Ditto when checking for local symbol to eliminate
- pc-relative runtime relocs.
-
-2002-07-08 Alan Modra <amodra@bigpond.net.au>
-
- * elf.c: Formatting.
- (IS_SOLARIS_PT_INTERP): Add p_paddr and p_memsz checks.
- (INCLUDE_SECTION_IN_SEGMENT): Remove IS_SOLARIS_PT_INTERP.
- (copy_private_bfd_data): Set p_vaddr on broken Solaris PT_INTERP
- segments.
-
-2002-07-07 Mark Mitchell <mark@codesourcery.com>
- Alan Modra <amodra@bigpond.net.au>
-
- * cofflink.c (_bfd_coff_final_link): On PE COFF systems, take into
- account the impact of relocation count overflow when computing
- section offsets.
- * coffcode.h (coff_write_relocs): Use obj_pe when deciding whether
- or not to apply the PE COFF reloc overflow handling. Fix a
- fencepost error in deciding whether or not to use that technique.
-
-2002-07-07 Alan Modra <amodra@bigpond.net.au>
-
- * elf-bfd.h (struct elf_reloc_cookie): Remove locsym_shndx,
- change type of locsyms.
- (bfd_elf_get_elf_syms): Declare.
- * elf.c (bfd_elf_get_elf_syms): New function.
- (group_signature): Use bfd_elf_get_elf_syms.
- (bfd_section_from_r_symndx): Likewise.
- * elfcode.h (elf_slurp_symbol_table): Likewise.
- * elflink.h (elf_link_is_defined_archive_symbol): Likewise.
- (elf_link_add_object_symbols): Likewise. Reorganise to increase
- locality of various data structures. Properly free internal relocs.
- (elf_bfd_final_link): Properly free internal relocs.
- (elf_link_check_versioned_symbol): Use bfd_elf_get_elf_syms.
- (elf_link_input_bfd): Likewise.
- (elf_gc_mark): Likewise. Properly free internal relocs.
- (elf_gc_sweep): Properly free internal relocs.
- (elf_reloc_symbol_deleted_p): No need to swap syms in.
- (elf_bfd_discard_info): Use bfd_elf_get_elf_syms. Properly free
- internal relocs.
- * elf-m10200.c (mn10200_elf_relax_section): Use bfd_elf_get_elf_syms.
- Properly free possibly cached info.
- (mn10200_elf_relax_delete_bytes): Remove symbol swapping code.
- (mn10200_elf_symbol_address_p): Pass in internal syms. Remove
- symbol swapping code.
- (mn10200_elf_get_relocated_section_contents): Use bfd_elf_get_elf_syms.
- Properly free possibly cached info.
- * elf-m10300.c (mn10300_elf_relax_section): As above for elf-m10200.c.
- (mn10300_elf_relax_delete_bytes): Likewise.
- (mn10300_elf_symbol_address_p): Likewise.
- (mn10300_elf_get_relocated_section_contents): Likewise.
- * elf32-h8300.c (elf32_h8_relax_section): As above for elf-m10200.c.
- (elf32_h8_relax_delete_bytes): Likewise.
- (elf32_h8_symbol_address_p): Likewise.
- (elf32_h8_get_relocated_section_contents): Likewise.
- * elf32-m32r.c (m32r_elf_relax_section): As above for elf-m10200.c.
- (m32r_elf_relax_delete_bytes): Likewise.
- (m32r_elf_get_relocated_section_contents): Likewise.
- * elf32-sh.c (sh_elf_reloc_loop): Free section contents using
- elf_section_data to determine whether cached.
- (sh_elf_relax_section): As above for elf-m10200.c.
- (sh_elf_relax_delete_bytes): Likewise.
- (sh_elf_get_relocated_section_contents): Likewise.
- * elf32-xstormy16.c (xstormy16_elf_relax_section): As above.
- * elf64-alpha.c (elf64_alpha_relax_section): As above. Also delay
- reading of local syms.
- * elf64-mmix.c (mmix_elf_relax_section): Likewise.
- * elf64-sh64.c (sh_elf64_get_relocated_section_contents): As above.
- * elfxx-ia64.c (elfNN_ia64_relax_section): As above.
- * elfxx-mips.c (_bfd_mips_elf_check_relocs): Properly free internal
- relocs.
- * elf32-arm.h (bfd_elf32_arm_process_before_allocation): Properly
- free internal relocs and section contents. Don't read symbols.
- * elf32-hppa.c (get_local_syms): Use bfd_elf_get_elf_syms.
- (elf32_hppa_size_stubs): Don't free local syms.
- * elf32-m68k.c (bfd_m68k_elf32_create_embedded_relocs): Delay
- reading of local syms. Use bfd_elf_get_elf_syms. Properly free
- possibly cached info.
- * elf32-mips.c (bfd_mips_elf32_create_embedded_relocs): Likewise.
- * elf64-hppa.c (elf64_hppa_check_relocs): Use bfd_elf_get_elf_syms.
- * elf64-ppc.c (struct ppc_link_hash_table): Delete bfd_count and
- all_local_syms.
- (get_local_syms): Delete function.
- (edit_opd): Use bfd_elf_get_elf_syms. Free on error exit. Cache
- on exit.
- (ppc64_elf_size_stubs): Use bfd_elf_get_elf_syms. Free/cache on exit.
-
-2002-07-05 Jim Wilson <wilson@redhat.com>
-
- * syms.c (decode_section_type): New.
- (bfd_decode_symclass): Call decode_section_type.
-
-2002-07-04 Jakub Jelinek <jakub@redhat.com>
-
- * merge.c (_bfd_merged_section_offset): Avoid accessing byte before
- section content start.
- Reported by Michael Schumacher <mike@hightec-rt.com>.
-
-2002-07-04 Alan Modra <amodra@bigpond.net.au>
-
- * section.c (_bfd_strip_section_from_output): Remove unnecessary
- link order code. Don't actually remove the output section here;
- Just set a flag for the linker to do so.
- * elflink.c (_bfd_elf_link_renumber_dynsyms): Test for removed
- sections when setting up output section dynsyms.
-
-2002-07-04 Alan Modra <amodra@bigpond.net.au>
-
- * elflink.h (elf_link_add_object_symbols): Revert 1999-09-02 hpux
- fudge.
- * elf.c (bfd_section_from_shdr): Work around broken hpux shared
- libs here instead.
-
-2002-07-02 Martin Schwidefsky <schwidefsky@de.ibm.com>
-
- * elf64-s390.c (create_got_section): Set .got section alignment to
- 8 bytes.
- (elf_s390_check_relocs): Set .rela.dyn section alignment to 8 bytes.
-
-2002-07-02 Alan Modra <amodra@bigpond.net.au>
-
- * elf.c (_bfd_elf_reloc_type_class): Fix comment grammar.
-
-2002-07-01 Matt Thomas <matt@3am-software.com>
-
- * elf32-vax.c (elf32_vax_print_private_bfd_data): Change EF_*
- to EF_VAX_*.
-
-2002-07-01 Thiemo Seufer <seufer@csv.ica.uni-stuttgart.de>
-
- * elfxx-mips.c (ABI_64_P): Fix comment.
- (MIPS_ELF_OPTIONS_SECTION_NAME,MIPS_ELF_STUB_SECTION_NAME): Use the
- new section names for N64 ABI.
- (mips_elf_output_extsym): No special _gp_disp handling for NewABI.
- (mips_elf_calculate_relocation): Code formatting.
- (mips_elf_create_dynamic_relocation): Likewise.
- (_bfd_mips_elf_fake_sections): IRIX6 needs this hack, too.
- (_bfd_mips_elf_size_dynamic_sections): Handle GOT_PAGE for any NewABI.
- (_bfd_mips_elf_relocate_section): No special handling for R_MIPS_64
- in any NewABI.
- (_bfd_mips_elf_finish_dynamic_symbol): No special _gp_disp handling
- for NewABI.
- (_bfd_mips_elf_modify_segment_map): Handle any N64 ABI.
- (_bfd_mips_elf_gc_sweep_hook): NewABI GOT relocs should be handled
- here, too.
-
-2002-07-01 Andreas Schwab <schwab@suse.de>
-
- * elf64-x86-64.c (elf64_x86_64_relocate_section): Only convert
- R_X86_64_64 to R_X86_64_RELATIVE.
-
-2002-07-01 John David Anglin <dave@hiauly1.hia.nrc.ca>
-
- * vaxbsd.c: New BFD backend for VAX BSD and Ultrix.
- * Makefile.am (BFD32_BACKENDS, BFD32_BACKENDS_CFILES): Add new backend.
- Run "make dep-am".
- * config.bfd (vax-*-bsd* | vax-*-ultrix*): Use vaxbsd_vec instead of
- host_aout_vec.
- * configure.in (vaxbsd_vec): Add.
- * targets.c (vaxbsd_vec): Add.
- * Makefile.in: Rebuild.
- * configure: Rebuild.
- * po/SRC-POTFILES.in: Rebuild.
-
-2002-07-01 Alan Modra <amodra@bigpond.net.au>
-
- * elflink.h (elf_gc_mark): Pass in the section whose relocs we are
- examining to gc_mark_hook, rather than the bfd.
- (elf_gc_sections): Adjust.
- * elf-bfd.h (struct elf_backend_data <gc_mark_hook>): Likewise.
- * elf-m10300.c (mn10300_elf_gc_mark_hook): Likewise.
- * elf32-arm.h (elf32_arm_gc_mark_hook): Likewise.
- * elf32-avr.c (elf32_avr_gc_mark_hook): Likewise.
- * elf32-cris.c (cris_elf_gc_mark_hook): Likewise.
- * elf32-d10v.c (elf32_d10v_gc_mark_hook): Likewise.
- * elf32-fr30.c (fr30_elf_gc_mark_hook): Likewise.
- * elf32-hppa.c (elf32_hppa_gc_mark_hook): Likewise.
- * elf32-i386.c (elf_i386_gc_mark_hook): Likewise.
- * elf32-m32r.c (m32r_elf_gc_mark_hook): Likewise.
- * elf32-m68k.c (elf_m68k_gc_mark_hook): Likewise.
- * elf32-mcore.c (mcore_elf_gc_mark_hook): Likewise.
- * elf32-openrisc.c (openrisc_elf_gc_mark_hook): Likewise.
- * elf32-ppc.c (ppc_elf_gc_mark_hook): Likewise.
- * elf32-s390.c (elf_s390_gc_mark_hook): Likewise.
- * elf32-sh.c (sh_elf_gc_mark_hook): Likewise.
- * elf32-sparc.c (elf32_sparc_gc_mark_hook): Likewise.
- * elf32-v850.c (v850_elf_gc_mark_hook): Likewise.
- * elf32-vax.c (elf_vax_gc_mark_hook): Likewise.
- * elf32-xstormy16.c (xstormy16_elf_gc_mark_hook): Likewise.
- * elf64-mmix.c (mmix_elf_gc_mark_hook): Likewise.
- * elf64-ppc.c (ppc64_elf_gc_mark_hook): Likewise.
- * elf64-s390.c (elf_s390_gc_mark_hook): Likewise.
- * elf64-sh64.c (sh_elf64_gc_mark_hook): Likewise.
- * elfxx-mips.c (_bfd_mips_elf_gc_mark_hook): Likewise.
- * elfxx-mips.h (_bfd_mips_elf_gc_mark_hook): Likewise.
- * elf64-x86-64.c (elf64_x86_64_gc_mark_hook): Likewise.
- * elf32-frv.c (elf32_frv_gc_mark_hook): Likewise. Also remove
- redundant local sym tests.
- * elf64-ppc.c (struct ppc_link_hash_entry): Add is_entry.
- (link_hash_newfunc): Init is_entry.
- (ppc64_elf_copy_indirect_symbol): Copy is_entry.
- (ppc64_elf_link_hash_table_create): Init all_local_syms.
- (create_linkage_sections): Use bfd_make_section_anyway rather than
- bfd_make_section.
- (ppc64_elf_mark_entry_syms): New function.
- (ppc64_elf_check_relocs): Don't bother testing elf_bad_symtab. Set
- up opd entry to function section map.
- (ppc64_elf_gc_mark_hook): Special case opd section relocs, and
- relocs that reference the opd section.
- (edit_opd): New function.
- (ppc64_elf_size_dynamic_sections): Call get_local_syms and edit_opd.
- (ppc64_elf_setup_section_lists): Don't calculate htab->bfd_count here.
- (get_local_syms): Do so here. Exit if we already have local syms.
- Remove bogus comment imported from elf32-hppa.c. Don't attempt to
- read local syms on non-ELF input.
- (ppc64_elf_size_stubs): Call _bfd_elf64_link_read_relocs rather
- than duplicating it's function here. Adjust free of internal
- relocs to suit.
- (ppc64_elf_relocate_section): Adjust local syms in opd section.
- * elf64-ppc.h (ppc64_elf_mark_entry_syms): Declare.
- * elf32-hppa.c (elf32_hppa_size_stubs): Call
- _bfd_elf32_link_read_relocs rather than duplicating it's function
- here. Adjust free of internal relocs to suit.
-
-2002-07-01 Andreas Jaeger <aj@suse.de>
-
- * elf64-x86-64.c (elf64_x86_64_check_relocs): Certain relocations
- are not allowed in shared libs code, enforce -fPIC.
-
-2002-06-29 Hans-Peter Nilsson <hp@bitrange.com>
-
- * mmo.c (mmo_write_loc_chunk): Don't eliminate leading and
- trailing zero-sequences when there's previous left-over data.
-
-2002-06-27 John David Anglin <dave@hiauly1.hia.nrc.ca>
-
- * elf64-hppa.c (elf64_hppa_reloc_type_class): New function.
- (elf64_hppa_finish_dynamic_sections): Check other_rel_sec, dlt_rel_sec
- and opd_rel_sec in order for starting rela section. Check _raw_size.
- (elf_backend_reloc_type_class): Define.
-
-2002-06-27 Kevin Buettner <kevinb@redhat.com>
-
- * dwarf2.c (decode_line_info): Handle older, non-standard, 64-bit
- DWARF2 formats.
-
-2002-06-27 Alan Modra <amodra@bigpond.net.au>
-
- * cpu-powerpc.c: Comment on ordering of arch_info.
- * elf32-ppc.c (ppc_elf_object_p): New function.
- (elf_backend_object_p): Define.
- * elf64-ppc.c (ppc64_elf_object_p): New function.
- (elf_backend_object_p): Define.
-
-2002-06-26 Jason Thorpe <thorpej@wasabisystems.com>
-
- * configure.in (vax-*-netbsd*): Set COREFILE to netbsd-core.lo.
- * configure: Regenerate.
-2002-06-25 Jason Eckhardt <jle@rice.edu>
-
- * dwarf2.c (decode_line_info): Check unit->addr_size
- to read in the proper number of prologue bytes.
-
-2002-06-25 Nick Clifton <nickc@cambridge.redhat.com>
-
- * config.bfd (powerpc-*-aix5*): Only create a selvecs for
- aix5coff64_vec if 64-bit bfd support has been enabled.
- (powerpc64-*-aix5*): Only define if 64-bit bfd support has
- been enabled.
-
- * targets.c (_bfd_target_vector[]): Only include
- aix5coff64_vec if 64-bit bfd support has been enabled.
-
-2002-06-25 Alan Modra <amodra@bigpond.net.au>
-
- * elf64-ppc.c (ppc_add_stub): Replace strcpy/strncpy with memcpy.
- * elf32-hppa.c (hppa_add_stub): Likewise.
- * elflink.c (_bfd_elf_link_record_dynamic_symbol): Likewise.
- * elflink.h (elf_add_default_symbol): Fix comment typo.
- (elf_add_default_symbol): Replace strcpy and strncpy with memcpy.
- (elf_link_add_object_symbols): Likewise.
- (elf_link_assign_sym_version): Likewise.
- * hash.c (bfd_hash_lookup): Likewise.
- * linker.c (_bfd_generic_link_add_one_symbol): Likewise.
- * section.c (bfd_get_unique_section_name): Likewise.
- * syms.c (_bfd_stab_section_find_nearest_line): Likewise.
- * elf.c (_bfd_elf_make_section_from_phdr): Likewise.
- (assign_section_numbers): Likewise.
- (_bfd_elfcore_make_pseudosection): Likewise.
- (elfcore_grok_lwpstatus): Likewise.
- (elfcore_grok_win32pstatus): Likewise.
- (elfcore_write_note): Constify input params. Use PTR instead of
- void *. Include terminating NUL in namesz. Correct padding.
- Support NULL "name" param. Use memcpy instead of strcpy.
- (elfcore_write_prpsinfo): Constify input params.
- (elfcore_write_prstatus): Likewise. Use PTR instead of void *.
- (elfcore_write_lwpstatus): Likewise.
- (elfcore_write_pstatus): Likewise.
- (elfcore_write_prfpreg): Likewise.
- (elfcore_write_prxfpreg): Likewise.
- * elf-bfd.h (elfcore_write_note): Update declaration.
- (elfcore_write_prpsinfo): Likewise.
- (elfcore_write_prstatus): Likewise.
- (elfcore_write_pstatus): Likewise.
- (elfcore_write_prfpreg): Likewise.
- (elfcore_write_prxfpreg): Likewise.
- (elfcore_write_lwpstatus): Likewise.
-
-2002-06-25 Jason Eckhardt <jle@rice.edu>
-
- * ecoff.c (ecoff_set_symbol_info): Set BSF_FUNCTION for
- symbols of type stProc and stStaticProc.
-
-2002-06-25 Nick Clifton <nickc@redhat.com>
-
- * ecoff.c: VArious formatting fixes.
-
-2002-06-25 Alan Modra <amodra@bigpond.net.au>
-
- * coff-rs6000.c (xcoff_generate_rtinit): Fix typo.
-
-2002-06-25 Alan Modra <amodra@bigpond.net.au>
-
- * aout-adobe.c: Don't compare against "true" or "false.
- * aout-target.h: Likewise.
- * aoutx.h: Likewise.
- * archive.c: Likewise.
- * bout.c: Likewise.
- * cache.c: Likewise.
- * coff-a29k.c: Likewise.
- * coff-alpha.c: Likewise.
- * coff-i386.c: Likewise.
- * coff-mips.c: Likewise.
- * coff-or32.c: Likewise.
- * coff64-rs6000.c: Likewise.
- * coffcode.h: Likewise.
- * coffgen.c: Likewise.
- * cpu-ns32k.c: Likewise.
- * ecoff.c: Likewise.
- * ecofflink.c: Likewise.
- * elf.c: Likewise.
- * elf32-arm.h: Likewise.
- * elf32-cris.c: Likewise.
- * elf32-d30v.c: Likewise.
- * elf32-i386.c: Likewise.
- * elf32-mcore.c: Likewise.
- * elf32-ppc.c: Likewise.
- * elf32-sh.c: Likewise.
- * elf32-sh64.c: Likewise.
- * elf32-v850.c: Likewise.
- * elf64-alpha.c: Likewise.
- * elf64-sh64.c: Likewise.
- * elfcode.h: Likewise.
- * elfcore.h: Likewise.
- * elflink.h: Likewise.
- * elfxx-mips.c: Likewise.
- * i386os9k.c: Likewise.
- * ieee.c: Likewise.
- * libbfd.c: Likewise.
- * linker.c: Likewise.
- * mmo.c: Likewise.
- * nlm32-alpha.c: Likewise.
- * nlm32-i386.c: Likewise.
- * nlm32-ppc.c: Likewise.
- * nlm32-sparc.c: Likewise.
- * nlmcode.h: Likewise.
- * oasys.c: Likewise.
- * pdp11.c: Likewise.
- * peicode.h: Likewise.
- * reloc.c: Likewise.
- * som.c: Likewise.
- * srec.c: Likewise.
- * tekhex.c: Likewise.
- * vms.c: Likewise.
- * xcofflink.c: Likewise.
- * elf64-sparc.c: Edit comment to not use "== false".
-
- * aoutf1.h: Don't use "? true : false".
- * ecoff.c: Likewise.
- * format.c: Likewise.
- * ieee.c: Likewise.
- * linker.c: Likewise.
- * mmo.c: Likewise.
- * oasys.c: Likewise.
-
-2002-06-23 H.J. Lu <hjl@gnu.org>
-
- * elflink.h (elf_link_add_archive_symbols): For the default
- version, check references with only one `@' first.
-
-2002-06-23 John David Anglin <dave@hiauly1.hia.nrc.ca>
-
- * elf64-hppa.c (elf64_hppa_mark_milli_and_exported_functions): New
- function.
- (allocate_global_data_dlt): Don't add millicode symbols to dynamic
- symbol table.
- (allocate_global_data_opd, allocate_dynrel_entries): Likewise.
- (elf64_hppa_size_dynamic_sections): Revise to use
- elf64_hppa_mark_milli_and_exported_functions.
- (elf64_hppa_finish_dynamic_symbol): Remove code to keep millicode
- symbols out of dynamic symbol table.
-
-2002-06-23 Alan Modra <amodra@bigpond.net.au>
+2004-04-11 Thiemo Seufer <seufer@csv.ica.uni-stuttgart.de>
- * Makefile.in: Regenerate.
- * libbfd.h: Regenerate.
- * bfd-in2.h: Regenerate.
+ * config.bfd: Remove mips*-*-mach3* and mips*-dec-mach3* targets.
+ * configure.in: Remove mips-dec-bsd*, mips-dec-mach3*, mips-*-mach3*
+ targets amd aout_mips_big_vec, aout_mips_little_vec target vectors.
* configure: Regenerate.
- * po/SRC-POTFILES.in: Regenerate.
-
- * elflink.h: Comment typo fixes.
-
-2002-06-23 H.J. Lu <hjl@gnu.org>
-
- * elf-bfd.h (elf_link_loaded_list): New structure.
- (elf_link_hash_table): Add "loaded".
- * elf.c (_bfd_elf_link_hash_table_init): Initialize "loaded".
- * elflink.h (elf_link_check_versioned_symbol): New function.
- (elf_link_output_extsym): Call elf_link_check_versioned_symbol.
-
-2002-06-19 Nick Clifton <nickc@cambridge.redhat.com>
-
- * elflink.h (size_dynamic_sections): If the target does not
- support an ELF style hash table, return true, indicating that
- nothing needed to be done, rather than false, indicating that the
- section's size could not be computed.
-
-2002-06-18 Dave Brolley <brolley@redhat.com>
-
- From Catherine Moore, Michael Meissner, Dave Brolley:
- * po/SRC-POTFILES.in: Add cpu-frv.c and elf32-frv.c
- * targets.c: Support bfd_elf32_frv_vec.
- * reloc.c: Add FRV relocs.
- * configure.in: Add support for bfd-elf32-frv-vec.
- * config.bfd (targ_cpu): Add support for frv-*-elf.
- * archures.c: Add frv arch and machines.
- * Makefile.am (ALL_MACHINES): Add cpu-frv.lo.
- (ALL_MACHINES_CFILES): Add cpu-frv.c.
- (BFD32_BACKENDS): Add elf32-frv.lo.
- (BFD32_BACKENDS_CFILES): Add elf32-frv.c
- (cpu-frv.lo): New target.
- (elf32-frv.lo): New target.
- * cpu-frv.c: New file.
- * elf32-frv.c: New file.
-
-2002-06-18 Jakub Jelinek <jakub@redhat.com>
-
- * elfcode.h (elf_object_p): Sanity check eh_shoff == 0 implies
- e_shnum == 0.
- Only read the first section header if e_shoff is non-zero.
- Don't consider e_shstrndx if there are no sections.
-
-2002-06-17 Tom Rix <trix@redhat.com>
-
- * elf32-d10v.c (elf_d10v_howto_table): Change R_D10V_10_PCREL_R,
- R_D10V_10_PCREL_L and R_D10V_18_PCREL to use
- complain_overflow_bitfield.
-
-2002-06-17 Alan Modra <amodra@bigpond.net.au>
-
- * opncls.c (bfd_openr): Remove redundant bfd_set_error.
- (bfd_fdopenr): Likewise.
- (bfd_openstreamr): Likewise.
- (bfd_openw): Likewise.
-
- * targets.c: Sort target vecs.
- (_bfd_target_vector): Add aix5coff64_vec, bfd_elf32_sh64_vec,
- bfd_elf32_sh64l_vec, bfd_elf32_sh64lnbsd_vec,
- bfd_elf32_sh64nbsd_vec, bfd_elf64_sh64_vec, bfd_elf64_sh64l_vec,
- bfd_elf64_sh64lnbsd_vec, bfd_elf64_sh64nbsd_vec.
- * configure.in: Sort target vecs. Add m88kmach3_vec.
- * configure: Regenerate.
-
-2002-06-16 Hans-Peter Nilsson <hp@bitrange.com>
-
- * elf64-mmix.c (bpo_reloc_request_sort_fn): Use member
- bpo_reloc_no to break sort order ties, not address of items.
-2002-06-16 John David Anglin <dave@hiauly1.hia.nrc.ca>
+2004-04-09 Daniel Jacobowitz <drow@mvista.com>
- * elf-hppa.h (elf_hppa_final_link): Fix formatting in comment.
- Skip excluded sections in determing __gp value.
- (elf_hppa_final_link_relocate): Use the symbol's address in
- R_PARISC_FPTR64 relocations that don't need an opd entry.
- * elf64-hppa.c (allocate_dynrel_entries): Simplify code.
- (elf64_hppa_finalize_dynreloc): Likewise.
- (elf64_hppa_size_dynamic_sections): Move comments and fix typo.
- (elf64_hppa_finish_dynamic_symbol): Break up assert.
+ * configure.in: Update version to 2.14.91.
+ * configure: Likewise.
-2002-06-14 Sergey Grigoriev <serge@leopold.Physik.Uni-Augsburg.DE>
+2004-04-09 Daniel Jacobowitz <drow@mvista.com>
- * pei-i386.c (COFF_SECTION_ALIGNMENT_ENTRIES): Enable 16 byte
- alignment for .bss, .data and .text sections so that sse and sse2
- code will work.
- * pe-i386.c (COFF_SECTION_ALIGNMENT_ENTRIES): Likewise.
-
-2002-06013 J"orn Rennecke <joern.rennecke@superh.com>
-
- config.bfd: Add support for sh[1234]l*-*-elf* | sh3el*-*-elf*,
- sh[1234]*-elf*.
-
-2002-06-12 John David Anglin <dave@hiauly1.hia.nrc.ca>
-
- * elflink.h (elf_bfd_final_link): Improve error handling for missing
- dynamic sections.
-
- * elf64-hppa.c (allocate_global_data_opd): We don't need an opd entry
- for a symbol that has no output section.
- (allocate_dynrel_entries): Correct comment.
- (elf64_hppa_finalize_dynreloc): Likewise. Don't create an opd entry
- unless we want one.
- (elf64_hppa_finalize_opd): Prevent segfault if dyn_h is NULL.
- (elf64_hppa_finalize_dlt): Likewise. Prevent segfault for symbols
- with no section. Remove unnecessary parentheses.
-
-2002-06-11 Tom Rix <trix@redhat.com>
-
- * coffcode.h (coff_compute_section_file_positions): Add data
- section to AIX loader alignment check.
-
- * coff-rs6000.c (_bfd_xcoff_mkobject): Set default text section
- alignment to 4 bytes.
- (_bfd_xcoff_copy_private_bfd_data): Use text and data alignment
- power accessor macro.
- (do_shared_object_padding): Remove invalid assertion.
-
-2002-06-10 Richard Sandiford <rsandifo@redhat.com>
-
- * section.c (_bfd_strip_section_from_output): Set SEC_EXCLUDE
- for removed output sections.
-
-2002-06-10 Geoffrey Keating <geoffk@redhat.com>
-
- * merge.c (merge_strings): Use htab_create_alloc with calloc, not
- htab_alloc.
- * elf-strtab.c (_bfd_elf_strtab_finalize): Likewise.
-
-2002-06-08 H.J. Lu <hjl@gnu.org>
-
- * elf.c (copy_private_bfd_data): Don't cast to bfd_size_type to
- work around a long long bug in gcc 2.96 on mips.
+ 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.
-2002-06-08 Jason Thorpe <thorpej@wasabisystems.com>
+ 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.
- * Makefile.am (BFD32_BACKENDS): Add vax1knetbsd.lo.
- (BFD32_BACKENDS_CFILES): Add vax1knetbsd.c.
- Regenerate dependency lists.
+ 2004-02-26 H.J. Lu <hongjiu.lu@intel.com>
+ * elfxx-ia64.c (elfNN_ia64_check_relocs): Fix call to
+ count_dyn_reloc.
+
+ 2004-02-25 H.J. Lu <hongjiu.lu@intel.com>
+ * elfxx-ia64.c (elfNN_ia64_dyn_reloc_entry): Add the reltext.
+ field to track if a relocation is against readonly section.
+ (count_dyn_reloc): Take a new argument for rent->reltext.
+ (elfNN_ia64_check_relocs): Adjust call to count_dyn_reloc.
+ (get_reloc_section): Don't set ia64_info->reltext here.
+ (allocate_dynrel_entries): Set ia64_info->reltext here.
+
+ 2004-02-24 Alexandre Oliva <aoliva@redhat.com>
+ * elf32-frv.c (FRV_SYM_LOCAL): Weak undefined doesn't imply local.
+ (_frv_emit_got_relocs_plt_entries): Decay relocation to protected
+ function's descriptor to symbol+offset, and map local undefweak
+ symbol to NULL function descriptor.
+ (elf32_frv_relocate_section): Likewise.
+
+ 2004-02-21 Danny Smith <daanysmith@users.sourceforge.net>
+ * peXXigen.c (_bfd_XXi_swap_scnhdr_out): Clear
+ IMAGE_SCN_MEM_WRITE on known sections only.
+
+ 2004-02-19 Jakub Jelinek <jakub@redhat.com>
+ * elf32-sparc.c (elf32_sparc_finish_dynamic_sections): Clear
+ .plt sh_entsize.
+
+2004-04-08 Richard Sandiford <rsandifo@redhat.com>
+
+ * elflink.c: Include libiberty.h.
+ * Makefile.am (elflink.lo): Depend on libiberty.h.
* Makefile.in: Regenerate.
- * config.bfd (vax-*-netbsdelf*, vax-*-netbsdaout*): Add
- vax1knetbsd_vec to targ_selvecs.
- * configure.in: Add vax1knetbsd_vec.
- * configure: Regenerate.
- * targets.c (_bfd_target_vector): Add vax1knetbsd_vec.
- * vax1knetbsd.c: New file.
- * vaxnetbsd.c: Update copyright years.
- (TARGET_PAGE_SIZE): Set to 0x1000.
- (DEFAULT_MID): Set to M_VAX4K_NETBSD.
-
-2002-06-08 Matt Thomas <matt@3am-software.com>
-
- * libaout.h (enum machine_type): Add M_VAX4K_NETBSD.
-
-2002-06-08 Alan Modra <amodra@bigpond.net.au>
- * elf64-sh64.c (sh64_elf64_link_output_symbol_hook): Make static.
+2004-04-08 Alan Modra <amodra@bigpond.net.au>
-2002-06-08 Alan Modra <amodra@bigpond.net.au>
+ Apply from mainline.
+ 2004-03-30 Jakub Jelinek <jakub@redhat.com>
+ * elf.c (map_sections_to_segments): Fix handling of .tbss.
- * Makefile.am: Run "make dep-am".
+ 2004-03-27 Alan Modra <amodra@bigpond.net.au>
+ * Makefile.am: Remove all mention of elflink.h.
* Makefile.in: Regenerate.
-
- * armnetbsd.c: Replace CONST with const.
- * corefile.c: Likewise.
- * elf32-dlx.c: Likewise.
- * elf64-mips.c: Likewise.
- * mmo.c: Likewise.
- * ns32knetbsd.c: Likewise.
-
- * elf64-sparc.c (sparc64_elf_add_symbol_hook): Check the hash
- table is elf64-sparc.
-
-2002-06-08 Thiemo Seufer <seufer@csv.ica.uni-stuttgart.de>
-
- * elfxx-mips.c (_bfd_mips_elf_relocate_section): Simplify code.
- Fix RELA addends to get not shifted in the result. Don't do special
- handling of R_MIPS_64 for NewABI.
-
-2002-06-07 Alan Modra <amodra@bigpond.net.au>
-
- * aoutx.h (NAME(aout,slurp_symbol_table)): Use bfd_zmalloc.
- (NAME(aout,slurp_reloc_table)): Likewise.
- * coff-mips.c (mips_relax_section): Use bfd_zalloc.
- * coff-rs6000.c (xcoff_write_armap_big): Use bfd_zmalloc.
- (xcoff_write_archive_contents_big): Likewise.
- (xcoff_generate_rtinit): Likewise.
- (xcoff_generate_rtinit): Likewise, and check error return.
- * coff64-rs6000.c (xcoff64_generate_rtinit): Likewise.
- * coffgen.c (coff_section_symbol): Use bfd_zalloc.
- (coff_get_normalized_symtab): Likewise.
- (coff_make_empty_symbol): Likewise.
- (bfd_coff_set_symbol_class): Likewise.
- * cofflink.c (coff_link_add_symbols): Likewise.
- * ecoff.c (_bfd_ecoff_make_empty_symbol): Likewise.
- * ecofflink.c (ecoff_write_shuffle): Use bfd_zmalloc.
- (bfd_ecoff_write_accumulated_debug): Likewise.
- * elf64-alpha.c (get_got_entry): Use bfd_zalloc.
- * i386linux.c (bfd_i386linux_size_dynamic_sections): Likewise.
- * i386lynx.c (NAME(lynx,slurp_reloc_table)): Use bfd_zmalloc.
- * ieee.c (do_with_relocs): Use bfd_zalloc.
- * m68klinux.c (bfd_m68klinux_size_dynamic_sections): Likewise.
- * pdp11.c (NAME(aout,slurp_symbol_table)): Use bfd_zmalloc.
- (NAME(aout,slurp_reloc_table)): Likewise.
- (NAME(aout,squirt_out_relocs)): Don't memset when zalloc'd.
- * reloc16.c (bfd_coff_reloc16_relax_section): Use bfd_zmalloc.
- * som.c (som_build_and_write_symbol_table): Likewise.
- (som_slurp_string_table): Likewise.
- (som_slurp_symbol_table): Likewise.
- (som_bfd_ar_write_symbol_stuff): Likewise.
- * sparclinux.c (bfd_sparclinux_size_dynamic_sections): Use bfd_zalloc.
- * sunos.c (bfd_sunos_size_dynamic_sections): Likewise.
- * tekhex.c (find_chunk): Likewise. Get rid of unused "sname".
- * vms-gsd.c (_bfd_vms_slurp_gsd): Use bfd_zmalloc.
- * xcofflink.c (xcoff_link_add_symbols): Use bfd_zalloc/bfd_zmalloc.
-
-2002-06-07 Alan Modra <amodra@bigpond.net.au>
-
- * elf-bfd.h (struct bfd_elf_section_data <group_name>): Replace with
- "group" union.
- (elf_group_name): Update.
- (elf_group_id): Define.
- (bfd_elf_set_group_contents): Declare.
- * elf.c (elf_fake_sections): Qualify use of elf_group_name.
- (set_group_contents): Rename to bfd_elf_set_group_contents. Remove
- ATTRIBUTE_UNUSED from failedptrarg. If elf_group_id is set, use
- that sym for the signature.
- (_bfd_elf_compute_section_file_positions): Don't call
- set_group_contents for "ld -r" case.
- (swap_out_syms): Use bfd_zalloc.
- * elflink.h (elf_link_add_archive_symbols): Likewise.
- (NAME(bfd_elf,size_dynamic_sections)): Likewise.
- (elf_bfd_final_link): Call bfd_elf_set_group_contents.
-
-2002-06-07 Alan Modra <amodra@bigpond.net.au>
-
- * elf64-ppc.c (ppc64_elf_relocate_section): Allow unresolved
- relocs in opd for non-shared too.
-
-2002-06-06 Jeffrey Law <law@redhat.com
-
- * elf32-h8300.c (elf32_h8_relax_section): Ignore uninteresting
- relocations.
-
-2002-06-06 Nick Clifton <nickc@cambridge.redhat.com>
-
- * merge.c: Include libiberty.h.
- * elf-strtab.c: Include libiberty.h.
-
-2002-06-06 Elias Athanasopoulos <eathan@otenet.gr>
-
- * peXXigen.c (pe_print_idata): Remove unused variable.
-
-2002-06-06 David Heine <dlheine@tensilica.com>
-
- * elf.c (assign_file_positions_for_segments): Remove unallocated
- sections from the section to segment mapping for PT_LOAD segments.
- Update comment about empty loadable segments.
-
-2002-06-06 Richard Sandiford <rsandifo@redhat.com>
-
- * stabs.c (_bfd_link_section_stabs): Check that the symbol offset
- is within the .stabstr section.
-
-2002-06-06 Alan Modra <amodra@bigpond.net.au>
-
- * elf-bfd.h (struct elf_size_info <swap_symbol_in>): Function args
- are "const PTR", not "const PTR *".
- (bfd_elf32_swap_symbol_in): Likewise.
- (bfd_elf64_swap_symbol_in): Likewise.
- * elfcode.h (elf_swap_symbol_in): Change input args to const PTR.
- (elf_slurp_symbol_table): Adjust call to elf_swap_symbol_in.
- * elflink.h (elf_link_is_defined_archive_symbol): Likewise.
- (elf_link_add_object_symbols): Likewise.
- (elf_link_record_local_dynamic_symbol): Likewise.
- (elf_link_input_bfd): Likewise.
- (elf_gc_mark): Likewise.
- (elf_reloc_symbol_deleted_p): Likewise.
- * elf-m10200.c (mn10200_elf_relax_section): Likewise.
- (mn10200_elf_relax_delete_bytes): Likewise.
- (mn10200_elf_symbol_address_p): Likewise.
- (mn10200_elf_get_relocated_section_contents): Likewise.
- * elf-m10300.c (mn10300_elf_relax_section): Likewise.
- (mn10300_elf_relax_section): Likewise.
- (mn10300_elf_relax_delete_bytes): Likewise.
- (mn10300_elf_symbol_address_p): Likewise.
- (mn10300_elf_get_relocated_section_contents): Likewise.
- * elf32-h8300.c (elf32_h8_relax_section): Likewise.
- (elf32_h8_relax_delete_bytes): Likewise.
- (elf32_h8_symbol_address_p): Likewise.
- (elf32_h8_get_relocated_section_contents): Likewise.
- * elf32-hppa.c (get_local_syms): Likewise.
- * elf32-m68k.c (bfd_m68k_elf32_create_embedded_relocs): Likewise.
- * elf32-mips.c (bfd_mips_elf32_create_embedded_relocs): Likewise.
- * elf32-sh.c (sh_elf_relax_section): Likewise.
- (sh_elf_relax_delete_bytes): Likewise.
- (sh_elf_get_relocated_section_contents): Likewise.
- * elf32-xstormy16.c (xstormy16_elf_relax_section): Likewise.
- * elf64-alpha.c (elf64_alpha_relax_section): Likewise.
- * elf64-hppa.c (elf64_hppa_check_relocs): Likewise.
- * elf64-mmix.c (mmix_elf_relax_section): Likewise.
- * elf64-ppc.c (get_local_syms): Likewise.
- * elf64-sh64.c (sh_elf64_get_relocated_section_contents): Likewise.
- * elfxx-ia64.c (elfNN_ia64_relax_section): Likewise.
-
-2002-06-05 J"orn Rennecke <joern.rennecke@superh.com>
-
- * config.bfd (sh64l*-*-elf*, shl*-*-elf*): New configurations.
-
-2002-06-05 Alan Modra <amodra@bigpond.net.au>
-
- * elf.c (group_signature): Swap in the whole symbol, and handle
- extracting section symbol names.
- (setup_group): Add comment.
- (set_group_contents): When called from objcopy or ld, arrange for
- section contents to be written. Write group member output section
- indices to allow objcopy to reorganize sections.
- (_bfd_elf_copy_private_section_data): Copy group info.
-
- * elf-bfd.h (struct elf_size_info): Add swap_symbol_in field.
- (bfd_elf32_swap_symbol_in): Update prototype.
- (bfd_elf64_swap_symbol_in): Likewise.
- * elfcode.h (elf_swap_symbol_in): Change input args to const PTR *.
- (elf_slurp_symbol_table): Adjust call to elf_swap_symbol_in.
- * elflink.h (elf_link_is_defined_archive_symbol): Likewise.
- (elf_link_add_object_symbols): Likewise.
- (elf_link_record_local_dynamic_symbol): Likewise.
- (elf_link_input_bfd): Likewise.
- (elf_gc_mark): Likewise.
- (elf_reloc_symbol_deleted_p): Likewise.
- * elf-m10200.c (mn10200_elf_relax_section): Likewise.
- (mn10200_elf_relax_delete_bytes): Likewise.
- (mn10200_elf_symbol_address_p): Likewise.
- (mn10200_elf_get_relocated_section_contents): Likewise.
- * elf-m10300.c (mn10300_elf_relax_section): Likewise.
- (mn10300_elf_relax_section): Likewise.
- (mn10300_elf_relax_delete_bytes): Likewise.
- (mn10300_elf_symbol_address_p): Likewise.
- (mn10300_elf_get_relocated_section_contents): Likewise.
- * elf32-h8300.c (elf32_h8_relax_section): Likewise.
- (elf32_h8_relax_delete_bytes): Likewise.
- (elf32_h8_symbol_address_p): Likewise.
- (elf32_h8_get_relocated_section_contents): Likewise.
- * elf32-hppa.c (get_local_syms): Likewise.
- * elf32-m68k.c (bfd_m68k_elf32_create_embedded_relocs): Likewise.
- * elf32-mips.c (bfd_mips_elf32_create_embedded_relocs): Likewise.
- * elf32-sh.c (sh_elf_relax_section): Likewise.
- (sh_elf_relax_delete_bytes): Likewise.
- (sh_elf_get_relocated_section_contents): Likewise.
- * elf32-xstormy16.c (xstormy16_elf_relax_section): Likewise.
- * elf64-alpha.c (elf64_alpha_relax_section): Likewise.
- * elf64-hppa.c (elf64_hppa_check_relocs): Likewise.
- * elf64-mmix.c (mmix_elf_relax_section): Likewise.
- * elf64-ppc.c (get_local_syms): Likewise.
- * elf64-sh64.c (sh_elf64_get_relocated_section_contents): Likewise.
- * elfxx-ia64.c (elfNN_ia64_relax_section): Likewise.
- * elfcode.h (NAME(_bfd_elf,size_info)): Update initialiser.
- * elf64-alpha.c (alpha_elf_size_info): Likewise.
- * elf64-hppa.c (hppa64_elf_size_info): Likewise.
- * elf64-mips.c (mips_elf64_size_info): Likewise.
- * elf64-s390.c (s390_elf64_size_info): Likewise.
- * elf64-sparc.c (sparc64_elf_size_info): Likewise.
-
-2002-06-05 Maciej W. Rozycki <macro@ds2.pg.gda.pl>
-
- * elf32-mips.c (elf32_mips_ignore_discarded_relocs): Move to...
- elfxx-mips.c (_bfd_mips_elf_ignore_discarded_relocs): ... here.
- elf64-mips.c (elf_backend_ignore_discarded_relocs): Use
- _bfd_mips_elf_ignore_discarded_relocs.
- elfxx-mips.h (_bfd_mips_elf_ignore_discarded_relocs): Declare.
-
-2002-06-05 H.J. Lu <hjl@gnu.org>
-
- * elfxx-mips.c (mips_elf_calculate_relocation): Call
- _bfd_elf_rel_local_sym for STT_SECTION relocations against
- the SEC_MERGE section.
-
-2002-06-05 Alan Modra <amodra@bigpond.net.au>
-
- * coff-alpha.c: Update copyright date.
- * coff-mips.c: Likewise.
- * xcoff-target.h: Likewise.
-
- * bfd-in.h: Remove "taken from the source" comment.
- * libbfd-in.h: Likewise.
- * libcoff-in.h: Likewise.
- * bfd-in2.h: Regenerate.
- * libbfd.h: Regenerate.
- * libcoff.h: Regenerate.
-
- * elf.c (bfd_elf_discard_group): Return true.
- * elf-bfd.h (bfd_elf_discard_group): Declare.
- * bfd-in.h (bfd_elf_discard_group): Don't declare here.
- * section.c (bfd_discard_group): Rename to bfd_generic_discard_group.
- * bfd.c (bfd_discard_group): Define.
- * targets.c (struct bfd_target): Add _bfd_discard_group.
- (BFD_JUMP_TABLE_LINK): Here too.
- * libbfd-in.h (_bfd_nolink_bfd_discard_group): Define.
- * aout-adobe.c (aout_32_bfd_discard_group): Define.
- * aout-target.h (MY_bfd_discard_group): Define.
- * aout-tic30.c (MY_bfd_discard_group): Define.
- * binary.c (binary_bfd_discard_group): Define.
- * bout.c (b_out_bfd_discard_group): Define.
- * coff-alpha.c (_bfd_ecoff_bfd_discard_group): Define.
- * coffcode.h (coff_bfd_discard_group): Define.
- * coff-mips.c (_bfd_ecoff_bfd_discard_group): Define.
- * elfxx-target.h (bfd_elfNN_bfd_discard_group): Define.
- * i386msdos.c (msdos_bfd_discard_group): Define.
- * i386os9k.c (os9k_bfd_discard_group): Define.
- * ieee.c (ieee_bfd_discard_group): Define.
- * ihex.c (ihex_bfd_discard_group): Define.
- * mmo.c (mmo_bfd_discard_group): Define.
- * nlm-target.h (nlm_bfd_discard_group): Define.
- * oasys.c (oasys_bfd_discard_group): Define.
- * ppcboot.c (ppcboot_bfd_discard_group): Define.
- * som.c (som_bfd_discard_group): Define.
- * srec.c (srec_bfd_discard_group): Define.
- * tekhex.c (tekhex_bfd_discard_group): Define.
- * versados.c (versados_bfd_discard_group): Define.
- * vms.c (vms_bfd_discard_group): Define.
- * xcoff-target.h (_bfd_xcoff_bfd_discard_group): Define.
- * coff64-rs6000.c (rs6000coff64_vec): Update initialiser.
- (aix5coff64_vec): Likewise.
- * coff-rs6000.c (rs6000coff_vec, pmac_xcoff_vec): Likewise.
-
-2002-06-04 Jason Thorpe <thorpej@wasabisystems.com>
-
- * Makefile.am (BFD32_BACKENDS): Add elf32-sh64-com.lo.
- (BFD32_BACKENDS_CFILES): Add elf32-sh64-com.c.
- (elf32-sh64-com.lo): New dependency list.
- * Makefile.in: Regenerate.
- * configure.in (bfd_elf32_sh64_vec, bfd_elf32_sh64l_vec)
- (bfd_elf32_sh64nbsd_vec, bfd_elf32_sh64lnbsd_vec): Add
- elf32-sh64-com.lo.
- * configure: Regenerate.
- * elf32-sh64.c (sh64_address_in_cranges)
- (sh64_get_contents_type, sh64_address_is_shmedia): Move to...
- (crange_qsort_cmpb, crange_qsort_cmpl, crange_bsearch_cmpb):
- (crange_bsearch_cmpl): Prepend _bfd_sh64_ to name and move to...
- * elf32-sh64-com.c: ...here. New file.
-
-2002-06-04 Alan Modra <amodra@bigpond.net.au>
-
- * elf32-openrisc.c (openrisc_elf_gc_mark_hook): Remove
- ATTRIBUTE_UNUSED on used params.
- * elf32-vax.c (elf_vax_gc_mark_hook): Remove unnecessary checks
- before calling bfd_section_from_elf_index on local syms.
- * elf64-sh64.c (sh_elf64_gc_mark_hook): Likewise.
-
-2002-06-04 Jason Thorpe <thorpej@wasabisystems.com>
-
- * Makefile.am (BFD32_BACKENDS): Add elf32-sh64-nbsd.lo.
- (BFD32_BACKENDS_CFILES): Add elf32-sh64-nbsd.c.
- (BFD64_BACKENDS): Add elf64-sh64-nbsd.lo.
- (BFD64_BACKENDS_CFILES): Add elf64-sh64-nbsd.c.
- (elf32-sh64-nbsd.lo, elf64-sh64-nbsd.lo): New rules.
- * Makefile.in: Regenerate.
- * config.bfd (sh5le-*-netbsd*, sh5-*-netbsd*, sh64le-*-netbsd*)
- (sh64-*-netbsd*): New targets.
- * configure.in: Add bfd_elf32_sh64nbsd_vec, bfd_elf32_sh64lnbsd_vec,
- bfd_elf64_sh64nbsd_vec, and bfd_elf64_sh64lnbsd_vec.
- * configure: Regenerate.
- * elf32-sh64-nbsd.c: New file.
- * elf64-sh64-nbsd.c: New file.
- * targets.c: Add extern decls for bfd_elf32_sh64nbsd_vec,
- bfd_elf32_sh64lnbsd_vec, bfd_elf64_sh64nbsd_vec, and
- bfd_elf64_sh64lnbsd_vec.
-
-2002-06-04 Alan Modra <amodra@bigpond.net.au>
-
- * elf.c (setup_group): Set SEC_LINK_ONCE on GRP_COMDAT groups.
- (bfd_section_from_shdr): Likewise. Set section name of group
- sections from signature.
- (group_signature): Split out from setup_group. Ensure symbol table
- is available.
- (bfd_elf_discard_group): New function.
- (_bfd_elf_make_section_from_shdr): Don't set SEC_LINK_ONCE on
- .gnu.linkonce* sections if they are members of a group.
- (set_group_contents): Set GRP_COMDAT flag.
- * section.c (bfd_discard_group): New function.
- * bfd-in.h (bfd_elf_discard_group): Declare.
- * bfd-in2.h: Regenerate.
- * elf-bfd.h (struct bfd_elf_section_data): Add linkonce_p field.
- (elf_linkonce_p): Define.
-
-2002-06-04 Alan Modra <amodra@bigpond.net.au>
-
- * elf.c (bfd_section_from_shdr): Make "name" const.
- * elf-bfd.h (elf_backend_section_from_shdr): Likewise.
- * elf32-i370.c (i370_elf_section_from_shdr): Likewise.
- * elf32-ppc.c (ppc_elf_section_from_shdr): Likewise.
- * elf32-sh64.c (sh64_backend_section_from_shdr): Likewise.
- * elf32-v850.c (v850_elf_section_from_shdr): Likewise.
- * elf64-alpha.c (elf64_alpha_section_from_shdr): Likewise.
- * elf64-hppa.c (elf64_hppa_section_from_shdr): Likewise.
- * elf64-ppc.c (ppc64_elf_section_from_shdr): Likewise.
- * elfxx-ia64.c (elfNN_ia64_section_from_shdr): Likewise.
- * elfxx-mips.c (_bfd_mips_elf_section_from_shdr): Likewise.
- * elfxx-mips.h (_bfd_mips_elf_section_from_shdr): Likewise.
-
-2002-06-03 Maciej W. Rozycki <macro@ds2.pg.gda.pl>
-
- * elfxx-mips.c (ABI_64_P): Use backend's data to determine the
- ABI.
-
-2002-06-02 Kazu Hirata <kazu@cs.umass.edu>
-
- * elf32-arc.c: Fix formatting.
- * elf32-arm.h: Likewise.
- * elf32-cris.c: Likewise.
- * elf32-dlx.c: Likewise.
- * elf32-hppa.c: Likewise.
- * elf32-i386.c: Likewise.
- * elf32-i386qnx.c: Likewise.
- * elf32-or32.c: Likewise.
- * elf32-s390.c: Likewise.
- * elf32-sh64.c: Likewise.
- * elf32-vax.c: Likewise.
- * elf32-xstormy16.c: Likewise.
- * elf64-alpha.c: Likewise.
- * elf64-mmix.c: Likewise.
- * elf64-ppc.c: Likewise.
- * elf64-s390.c: Likewise.
- * elf64-sh64.c: Likewise.
- * elf64-x86-64.c: Likewise.
-
-2002-06-02 Richard Henderson <rth@redhat.com>
-
- * elf64-alpha.c (elf64_alpha_relocate_section): Don't dereference
- null when there are no got entries for a symbol.
- (elf64_alpha_relax_find_tls_segment): Rearrange to avoid
- uninitialized variable warning.
-
-2002-06-01 Richard Henderson <rth@redhat.com>
-
- * elf64-alpha.c (elf64_alpha_relax_with_lituse): Don't test for
- undefined symbols here.
- (elf64_alpha_relax_section): Do it here. Also test for not
- defined in the current module.
- (elf64_alpha_relocate_section_r): Split out of ...
- (elf64_alpha_relocate_section): ... here. Don't dereference
- NULL when looking up local got entries.
-
-2002-06-01 Richard Henderson <rth@redhat.com>
-
- * elf64-alpha.c (elf64_alpha_relax_with_lituse): Reject undefined
- symbols from JSR relaxation.
- (elf64_alpha_size_plt_section_1): New.
- (elf64_alpha_calc_dynrel_sizes): Split out .rela.got bits ...
- (elf64_alpha_size_rela_got_1): ... here.
- (elf64_alpha_size_dynamic_sections): Split out .rela.got bits ...
- (elf64_alpha_size_rela_got_section): ... here.
- (elf64_alpha_size_plt_section): New.
- (elf64_alpha_relax_section): Call them.
- (elf64_alpha_size_got_sections): Remove output_bfd arg.
- (elf64_alpha_finish_dynamic_symbol): Check gotent use_count.
-
-2002-06-01 Richard Henderson <rth@redhat.com>
-
- * elf64-alpha.c (alpha_get_dtprel_base, alpha_get_tprel_base): New.
- (elf64_alpha_relocate_section): Use them. Reject LE TLS relocs
- in shared libraries. Fix DTPRELHI and TPRELHI value.
- (INSN_ADDQ, INSN_RDUNIQ): New.
- (struct alpha_relax_info): Add symtab_hdr, tls_segment, first_gotent.
- (elf64_alpha_relax_with_lituse): Return boolean. Remove irelend
- argument. Reject dynamic symbols. Use LITUSE symbolic constants.
- (elf64_alpha_relax_got_load): Rename from relax_without_lituse.
- Handle GOTDTPREL and GOTTPREL relocations.
- (elf64_alpha_relax_gprelhilo): New.
- (elf64_alpha_relax_tls_get_addr): New.
- (elf64_alpha_relax_find_tls_segment): New.
- (elf64_alpha_relax_section): Handle TLS relocations.
- (ALPHA_ELF_LINK_HASH_TLS_IE): New.
- (elf64_alpha_check_relocs): Set it.
-
-2002-06-01 Richard Henderson <rth@redhat.com>
-
- * elf64-alpha.c (elf64_alpha_relax_section): Don't store computed gp.
-
- * elf64-alpha.c (elf64_alpha_check_relocs): Fix typo on maybe_dynamic
- check; don't suppress dynamic relocs for non-allocated sections.
-
- * elf64-alpha.c: Remove dead code.
-
-2002-05-31 Alan Modra <amodra@bigpond.net.au>
-
+ * bfd-in.h (bfd_elf_discard_info): Declare.
+ (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete.
* bfd-in2.h: Regenerate.
- * libbfd.h: Regenerate.
+ * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol,
+ bfd_elf32_link_record_dynamic_symbol,
+ bfd_elf64_link_record_dynamic_symbol,
+ _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link,
+ bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol,
+ _bfd_elf32_link_record_local_dynamic_symbol,
+ _bfd_elf64_link_record_local_dynamic_symbol,
+ _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets,
+ _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link,
+ _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry,
+ _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets,
+ _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry,
+ _bfd_elf32_reloc_symbol_deleted_p,
+ _bfd_elf64_reloc_symbol_deleted_p): Delete.
+ (bfd_elf_link_record_dynamic_symbol,
+ bfd_elf_link_record_local_dynamic_symbol,
+ bfd_elf_final_link, bfd_elf_gc_sections,
+ bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry,
+ bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link,
+ bfd_elf_reloc_symbol_deleted_p): Declare.
+ (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define.
+ * elf32-arm.h: Update for changed function names. Remove local
+ WILL_CALL_FINISH_DYNAMIC_SECTION define.
+ * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c,
+ * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c,
+ * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c,
+ * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c,
+ * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c,
+ * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c,
+ * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c,
+ * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise.
+ * elfxx-target.h (bfd_elfNN_bfd_final_link): Define.
+ (bfd_elfNN_print_symbol): Define.
+ * elfcode.h: Don't include elflink.h.
+ (elf_bfd_discard_info, elf_reloc_symbol_deleted_p,
+ elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections,
+ elf_gc_common_finalize_got_offsets, elf_gc_common_final_link,
+ elf_gc_record_vtinherit, elf_gc_record_vtentry,
+ elf_link_record_local_dynamic_symbol): Don't define.
+ * elflink.c: Update for changed function names. Move elflink.h
+ code here.
+ * elflink.h: Delete file.
* po/SRC-POTFILES.in: Regenerate.
+ * po/bfd.pot: Regenerate.
- * elf64-ppc.c (ppc64_elf_size_dynamic_sections): Don't allocate
- space for bss .plt.
-
-2002-05-31 Graeme Peterson <gp@qnx.com>
-
- * Makefile.am (BFD32_BACKENDS): Add elf32-i386qnx.lo.
- (BFD32_BACKENDS_CFILES): Add elf32-i386qnx.c.
- Run "make dep-am".
- * Makefile.in: Regenerate.
- * config.bfd: Add i[3456]86-*-nto-qnx* support.
- * configure.in: Add bfd_elf32_i386qnx_vec support.
- * configure: Regenerate.
- * elf-bfd.h (struct elf_backend_data): Add set_nonloadable_filepos,
- is_contained_by_filepos, and copy_private_bfd_data_p.
- * elf.c (assign_file_positions_for_segments): Call backend
- set_nonloadable_filepos. Fix non-K&R call to _bfd_error_handler.
- (IS_CONTAINED_BY_FILEPOS): Define.
- (INCLUDE_SECTION_IN_SEGMENT): Also test IS_CONTAINED_BY_FILEPOS.
- (copy_private_bfd_data): Use IS_CONTAINED_BY_FILEPOS. Typo fix.
- Fix non-K&R call to _bfd_error_handler.
- (_bfd_elf_copy_private_section_data): Use backend
- copy_private_bfd_data_p.
- * elf32-i386.c: Don't include elfxx-target.h when
- ELF32_I386_C_INCLUDED is defined.
- * elf32-i386qnx.c: New QNX elf backend file.
- * elfxx-target.h: Add elf_backend_set_nonloadable_filepos,
- elf_backend_is_contained_by_filepos, and
- elf_backend_do_copy_private_bfd_data.
- * targets.c: Add bfd_target bfd_elf32_i386qnx_vec.
-
-2002-05-31 Alan Modra <amodra@bigpond.net.au>
-
- * elfarm-oabi.c (bfd_elf32_arm_add_glue_sections_to_bfd): Define.
- Move other similar defines to start of file.
-
-2002-05-30 Tom Rix <trix@redhat.com>
-
- * coff-rs6000.c (xcoff_rtype2howto): Handle 16 bit R_RBA.
- * coff64-rs6000.c (xcoff64_rtype2howto): Same.
-
-2002-05-30 Richard Henderson <rth@redhat.com>
-
- * elf64-alpha.c (ALPHA_ELF_LINK_HASH_LU_TLSGD,
- ALPHA_ELF_LINK_HASH_LU_TLSLDM, ALPHA_ELF_LINK_HASH_LU_FUNC): New.
- (ALPHA_ELF_GOT_ENTRY_RELOCS_DONE): Remove.
- (ALPHA_ELF_GOT_ENTRY_RELOCS_XLATED): Remove.
- (struct alpha_elf_got_entry): Add reloc_type, reloc_done, reloc_xlated.
- (struct alpha_elf_obj_tdata): Rename total_got_entries and
- n_local_got_entries to total_got_size and local_got_size.
- (elf64_alpha_howto, elf64_alpha_reloc_map): Update for TLS relocs.
- (alpha_got_entry_size): New.
- (elf64_alpha_relax_with_lituse): Use it.
- (elf64_alpha_relax_without_lituse): Likewise.
- (MAX_GOT_SIZE): Rename from MAX_GOT_ENTRIES.
- (get_got_entry): New.
- (elf64_alpha_check_relocs): Handle TLS relocs. Reorganize.
- (elf64_alpha_adjust_dynamic_symbol): Test LU_FUNC as a mask.
- (elf64_alpha_merge_ind_symbols): Check gotent->reloc_type.
- (elf64_alpha_can_merge_gots, elf64_alpha_merge_gots): Likewise.
- (elf64_alpha_calc_got_offsets_for_symbol): Use alpha_got_entry_size.
- (elf64_alpha_calc_got_offsets): Likewise.
- (alpha_dynamic_entries_for_reloc): New.
- (elf64_alpha_calc_dynrel_sizes): Use it.
- (elf64_alpha_size_dynamic_sections): Likewise.
- (elf64_alpha_relocate_section): Handle TLS relocations.
- * reloc.c: Add Alpha TLS relocations.
- * bfd-in2.h, libbfd.h: Rebuild.
-
-2002-05-29 Ralf Habacker <ralf.habacker@freenet.de>
-
- * peXXigen.c (pe_print_idata): Remove double printed
- import table lines; add Bound-To comment.
-
-2002-05-29 Matt Thomas <matt@3am-software.com>
-
- * Makefile.am (BFD32_BACKENDS): Add elf32-vax.lo.
- (BFD32_BACKENDS_CFILES): Add elf32-vax.c.
- (elf32-vax.lo): New rule.
- * Makefile.in: Regenerate.
- * configure.in (bfd_elf32_vax_vec)
- (vaxnetbsd_vec): New vectors.
- * configure: Regenerate.
- * config.bfd (vax-*-netbsdelf*)
- (vax-*-netbsdaout*)
- (vax-*-netbsd*): New targets.
- * elf32-vax.c: New file.
- * reloc.c: Add VAX relocations.
- * bfd-in2.h: Regenerate.
- * targets.c (_bfd_target_vector): Add bfd_elf32_vax_vec.
-
-2002-05-29 Jason Thorpe <thorpej@wasabisystems.com>
-
- * config.bfd (arm-*-netbsd*): Add bfd_elf32_littlearm_vec
- and bfd_elf32_bigarm_vec to targ_selvecs.
-
-2002-05-29 Ralf Habacker <ralf.habacker@freenet.de>
-
- * peXXigen.c (pe_print_idata): Fix seg faults on printing import tables
- with auto-imported symbols.
-
-2002-05-29 Adam Nemet <anemet@lnxw.com>
-
- * elf32-arm.h (bfd_elf32_arm_get_bfd_for_interworking): Don't add glue
- sections only record bfd.
- (bfd_elf32_arm_add_glue_sections_to_bfd): New function.
- * bfd-in.h (bfd_elf32_arm_add_glue_sections_to_bfd): Declare it.
- * bfd-in2.h: Regenerate.
-
-2002-05-28 Nick Clifton <nickc@cambridge.redhat.com>
-
- * syms.c (_bfd_stab_section_find_nearest_line): Move
- declaration and initialisation of saw_line and saw_func out of
- for loop.
-
-2002-05-29 Alan Modra <amodra@bigpond.net.au>
-
- * elf64-ppc.c (ppc64_elf_get_symbol_info): New function.
- (bfd_elf64_get_symbol_info): Define.
- * elfxx-target.h (bfd_elfNN_get_symbol_info): Only define if undef.
-
-2002-05-29 Andrey Volkov <avolkov@transas.com>
-
- * cpu-h8300.c: Make default h8300 machine first in machine list.
-
-2002-05-28 Kuang Hwa Lin <kuang@sbcglobal.net>
-
- * config.bfd: Added DLX configuraton.
- * Makefile.am: Added DLX configuraton.
- * configure.in: Added DLX configuraton.
- * archures.c: Add DLX architecure.
- * reloc.c: Add DLX relocs.
- * targets.c: Added DLX target vector.
- * configure: Regenerate.
- * Makefile.in: Regenreate.
- * bfd-in2.h: Regenreate.
- * elf32-dlx.c: New file: Support DLX target.
- * cpu-dlx.c: New file: Support DLX target.
-
-2002-05-25 Alan Modra <amodra@bigpond.net.au>
-
- * elf32-m68k.c (elf32_m68k_print_private_bfd_data): Formatting.
-
- * elf64-ppc.c (ppc64_elf_copy_indirect_symbol): Revert last change.
- (ppc64_elf_check_relocs): Don't set up function descriptor symbol
- strings to point inside function code sym string.
- (func_desc_adjust): Likewise.
- (ppc64_elf_hide_symbol): Rewrite code to look up function code sym.
-
-2002-05-24 Michal Ludvig <mludvig@suse.cz>
-
- * elf64-x86-64.c (elf64_x86_64_grok_prstatus): Added.
- (elf64_x86_64_grok_psinfo): Added.
-
-2002-05-24 TAMURA Kent <kent@netbsd.org>
-
- * config.bfd: Add a target for i386-netbsdpe.
-
-2002-05-24 Alan Modra <amodra@bigpond.net.au>
-
- * elf64-ppc.c (ppc64_elf_copy_indirect_symbol): Don't copy is_func
- and is_func_descriptor.
- (func_desc_adjust): Hide function code sym in shared libs unless
- there is a matching exported function descriptor sym.
-
-2002-05-23 Jakub Jelinek <jakub@redhat.com>
-
- * elf.c (_bfd_elf_make_section_from_shdr): Set SEC_THREAD_LOCAL
- for symbols from SHF_TLS section.
- (_bfd_elf_print_private_bfd_data): Add PT_TLS.
- (elf_fake_sections): Set SHF_TLS for SEC_THREAD_LOCAL sections.
- (map_sections_to_segments): Build PT_TLS segment if necessary.
- (assign_file_positions_for_segments): Likewise.
- (get_program_header_size): Account for PT_TLS segment.
- (swap_out_syms): Set type of BSF_THREAD_LOCAL symbols and symbols from
- SEC_THREAD_LOCAL sections to STT_TLS.
- * reloc.c: Add 386 and IA-64 TLS relocs.
- * section.c (SEC_THREAD_LOCAL): Define.
- (SEC_CONSTRUCTOR_TEXT, SEC_CONSTRUCTOR_DATA, SEC_CONSTRUCTOR_BSS):
- Remove.
- * elflink.h (elf_link_add_object_symbols): Support .tcommon.
- (size_dynamic_sections): If DF_STATIC_TLS, set DF_FLAGS
- unconditionally.
- (struct elf_final_link_info): Add first_tls_sec.
- (elf_bfd_final_link): Set first_tls_sec.
- Compute elf_hash_table (info)->tls_segment.
- (elf_link_output_extsym): Handle STT_TLS symbols.
- (elf_link_input_bfd): Likewise.
- * syms.c (BSF_THREAD_LOCAL): Define.
- * bfd-in2.h: Rebuilt.
- * libbfd.h: Rebuilt.
- * elf32-i386.c (elf_i386_tls_transition, dtpoff_base, tpoff,
- elf_i386_mkobject, elf_i386_object_p): New functions.
- (elf_howto_table): Add TLS relocs.
- (elf_i386_reloc_type_lookup): Support TLS relocs.
- (elf_i386_info_to_howto_rel): Likewise.
- (struct elf_i386_link_hash_entry): Add tls_type.
- (struct elf_i386_obj_tdata): New.
- (elf_i386_hash_entry, elf_i386_tdata, elf_i386_local_got_tls_type):
- New macros.
- (struct elf_i386_link_hash_table): Add tls_ldm_got.
- (link_hash_newfunc): Clear tls_type.
- (elf_i386_check_relocs): Support TLS relocs.
- (elf_i386_gc_sweep_hook): Likewise.
- (allocate_dynrelocs): Likewise.
- (elf_i386_size_dynamic_sections): Likewise.
- (elf_i386_relocate_section): Likewise.
- (elf_i386_finish_dynamic_symbol): Likewise.
- (bfd_elf32_mkobject, elf_backend_object_p): Define.
- * elfxx-ia64.c (struct elfNN_ia64_dyn_sym_info): Add tprel_offset,
- dtpmod_offset, dtprel_offset, tprel_done, dtpmod_done, dtprel_done,
- want_tprel, want_dtpmod, want_dtprel.
- (elfNN_ia64_tprel_base, elfNN_ia64_dtprel_base): New functions.
- (ia64_howto_table): Add TLS relocs, rename R_IA64_LTOFF_TP22 to
- R_IA64_LTOFF_TPREL22.
- (elf_code_to_howto_index): Add TLS relocs.
- (elfNN_ia64_check_relocs): Support TLS relocs.
- (allocate_global_data_got): Account for TLS .got data.
- (allocate_dynrel_entries): Account for TLS dynamic relocations.
- (elfNN_ia64_install_value): Supprt TLS relocs.
- (set_got_entry): Support TLS relocs.
- (elfNN_ia64_relocate_section): Likewise.
-
-2002-05-23 Nick Clifton <nickc@cambridge.redhat.com>
-
- * elf32-arm.h (elf32_arm_final_link_relocate): For the Thumb
- BLX reloc round the relocation up rather than down.
- * coff-arm.c (coff_arm_relocate_section): Likewise.
-
-2002-05-21 H.J. Lu (hjl@gnu.org)
-
- * linker.c (_bfd_generic_link_add_one_symbol): Allow multiple
- definition.
-
-2002-05-22 Alan Modra <amodra@bigpond.net.au>
-
- * elf64-ppc.c (ppc64_elf_size_stubs): Don't strip .branch_lt.
- (ppc64_elf_relocate_section): Handle unresolved relocs in opd.
-
-2002-05-22 Alan Modra <amodra@bigpond.net.au>
-
- * elf64-ppc.c (ppc64_elf_relocate_section): Return false for
- unresolved relocs.
- (ppc64_elf_size_dynamic_sections): Check for splt NULL.
-
-2002-05-21 Thiemo Seufer <seufer@csv.ica.uni-stuttgart.de>
-
- * bfd/bfd.c (bfd_get_arch_size): Remove bfd_set_error call for
- non-ELF targets.
-
-2002-05-21 Thiemo Seufer <seufer@csv.ica.uni-stuttgart.de>
-
- * elf-bfd.h (elf_backend_emit_relocs): Change prototype to return
- an error value.
- * elflink.h (elf_link_output_relocs): Likewise. Improve error message.
- return with false on error.
- (elf_link_input_bfd): Check reloc_emitter return value.
-
-2002-05-21 Jason Thorpe <thorpej@wasabisystems.com>
-
- * config.bfd (armeb-*-netbsdelf*): New target.
-
-2002-05-20 Alan Modra <amodra@bigpond.net.au>
-
- * elf64-ppc.c (ppc_build_one_stub): Point undefined function syms
- at the plt call stub.
-
-2002-05-19 Thiemo Seufer <seufer@csv.ica.uni-stuttgart.de>
-
- * cpu-mips.c (mips_compatible): Don't try to check machine
- compatibility.
-
-2002-05-18 Tom Rix <trix@redhat.com>
-
- * coff64-rs6000.c (_bfd_xcoff64_swap_aux_out): Fix C_FILE auxent.
-
-2002-05-17 Alan Modra <amodra@bigpond.net.au>
-
- * elf64-ppc.c (ppc64_elf_info_to_howto): Formatting.
- (ppc64_elf_relocate_section): Don't warn about reloc overflow when
- we've already warned about an undefined symbol. Report more
- detail on reloc errors.
-
-2002-05-17 Alan Modra <amodra@bigpond.net.au>
-
- * acinclude.m4 (AM_INSTALL_LIBBFD): New.
- * configure.in: Invoke AM_INSTALL_LIBBFD.
- * Makefile.am (install-data-local): Revert 2002-05-13. Move to..
- (install_libbfd): .. New target.
- (uninstall_libbfd): Likewise.
- (install-bfdlibLTLIBRARIES): Likewise.
- (uninstall-bfdlibLTLIBRARIES): Likewise.
- (bfdlibdir): New.
- (bfdincludedir): New.
- (lib_LTLIBRARIES): Rename to bfdlib_LTLIBRARIES.
- * aclocal.m4: Regenerate.
- * configure: Regenerate.
- * Makefile.in: Regenerate.
-
-2002-05-17 Stuart Balfour <sbalfour@cisco.com>
-
- * hash.c (bfd_hash_lookup): Remove computation of len from inside
- hash loop.
-
-2002-05-16 Nick Clifton <nickc@cambridge.redhat.com>
-
- * config.bfd: Add targets for sh64-linux (little endian and
- big endian).
-
-2002-05-15 Laurent Pinchart <laurent.pinchart@skynet.be>
-
- * peXXigen.c (pe_print_idata): Do not assume that the first thunk
- is located in the same section as the import table. Instead
- check, and if necessary load the section containing the thunk.
-
-2002-05-15 Nick Clifton <nickc@cambridge.redhat.com>
-
- * aix5ppc-core.c (xcoff64_core_p): Replace bfd_read with
- bfd_bread.
- (xcoff64_core_file_matches_executable_p): Replace bfd_read
- with bfd_bread.
-
-2002-05-15 Alan Modra <amodra@bigpond.net.au>
-
- * aix5ppc-core.c: Warning fixes.
- * aout-adobe.c (aout_32_bfd_link_just_syms): Define.
- * aout-target.h (MY_bfd_link_just_syms): Define.
- * aout-tic30.c (MY_bfd_link_just_syms): Define.
- * bfd.c (bfd_link_just_syms): Define.
- * binary.c (binary_bfd_link_just_syms): Define.
- * bout.c (b_out_bfd_link_just_syms): Define.
- * coff-rs6000.c (rs6000coff_vec, pmac_xcoff_vec): Update initializer.
- * coff64-rs6000.c (rs6000coff64_vec, aix5coff64_vec): Likewise.
- * coffcode.h (coff_bfd_link_just_syms): Define.
- * elf-bfd.h (enum elf_link_info_type): Add ELF_INFO_TYPE_JUST_SYMS.
- (elf_discarded_section): Check for ELF_INFO_TYPE_JUST_SYMS.
- (_bfd_elf_link_just_syms): Declare.
- * elf.c (_bfd_elf_link_just_syms): New function.
- * elf-eh-frame.c (_bfd_elf_maybe_strip_eh_frame_hdr): Check that
- sections haven't already been discarded by the linker.
- * elflink.h (elf_link_add_object_symbols): Likewise for stab
- sections and SEC_MERGE sections.
- (elf_bfd_discard_info): Similarly here.
- * elfxx-target.h (bfd_elfNN_bfd_link_just_syms): Define.
- * i386msdos.c (msdos_bfd_link_just_syms): Define.
- * i386os9k.c (os9k_bfd_link_just_syms): Define.
- * ieee.c (ieee_bfd_link_just_syms): Define.
- * ihex.c (ihex_bfd_link_just_syms): Define.
- * libbfd-in.h (_bfd_nolink_bfd_link_just_syms): Define.
- (_bfd_generic_link_just_syms): Declare.
- * libecoff.h (_bfd_ecoff_bfd_link_just_syms): Define.
- * linker.c (_bfd_generic_link_just_syms): New function.
- * mmo.c (mmo_bfd_link_just_syms): Define.
- * nlm-target.h (nlm_bfd_link_just_syms): Define.
- * oasys.c (oasys_bfd_link_just_syms): Define.
- * ppcboot.c (ppcboot_bfd_link_just_syms): Define.
- * som.c (som_bfd_link_just_syms): Define.
- * srec.c (srec_bfd_link_just_syms): Define.
- * targets.c (struct bfd_target): Add _bfd_link_just_syms.
- (BFD_JUMP_TABLE_LINK): And here.
- * tekhex.c (tekhex_bfd_link_just_syms): Define.
- * versados.c (versados_bfd_link_just_syms): Define.
- * vms.c (vms_bfd_link_just_syms): Define.
- * libbfd.h: Regenerate.
- * bfd-in2.h: Regenerate.
-
-2002-05-15 Thiemo Seufer <seufer@csv.ica.uni-stuttgart.de>
-
- * elf32-mips.c: Remove superfluous definitions copied from
- elfxx-mips.c.
- (bfd_elf32_bigmips_vec,bfd_elf32_littlemips_vec): Use the
- SGIish vectors to check the special case.
- (mips_elf_hi16_reloc): Fix comment.
- (mips_elf_got16_reloc): Likewise.
- (_bfd_mips_elf32_gprel16_reloc): Likewise.
- (elf_reloc_map): Code cleanup.
- (mips_reloc_map): Add comment.
- (bfd_elf23_bfd_reloc_type_lookup): Code cleanup.
- (mips_elf32_rtype_to_howto): Likewise.
- (mips_elf32_discard_info): Likewise.
- (elf32_mips_irix_compat): Invert logic: Only SGIish vectors
- lead to IRIX compatibility now.
-
-2002-05-15 Thiemo Seufer <seufer@csv.ica.uni-stuttgart.de>
-
- * elfxx-mips.c: Call it IRIX, not Irix in comments.
-
-2002-05-13 Jason Thorpe <thorpej@wasabisystems.com>
-
- * config.bfd (shle-*-netbsdelf*): Add target which includes
- sh64 support.
-
-2002-05-13 David Edelsohn <edelsohn@gnu.org>
-
- * configure.in: Revert 2002-04-07. Instead, auto-configure
- HAVE_ST_C_IMPL.
- * configure: Regenerate.
- * config.in: Regenerate.
- * rs6000-core.c (CNEW_IMPL): Guard use of c_impl with HAVE_ST_C_IMPL
- or AIX_5_CORE.
-
-2002-05-11 Federico G. Schwindt <fgsch@olimpo.com.br>
-
- * configure.in (sparc*-*-openbsd*): Support sparc64-openbsd
- corefiles as well.2
- * configure: Regenerate.
-
-2002-05-13 Alan Modra <amodra@bigpond.net.au>
-
- * Makefile.am (install-data-local): Install headers to
- $(exec_prefix)/include.
- * Makefile.in: Regenerate.
-
-2002-05-11 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
- Daniel Jacobowitz <drow@mvista.com>
-
- * coff-sh.c (sh_reloc_map): Map to R_SH_IMM32 for non-PE. Don't
- map BFD_RELOC_RVA.
-
-2002-05-11 Federico G. Schwindt <fgsch@olimpo.com.br>
-
- * config.bfd (alpha*-*-openbsd*, sparc64*-*-openbsd*,
- hppa*-*-openbsd*): New targets.
- * configure.in (alpha*-*-openbsd*): Set COREFILE.
- * configure: Regenerate.
-
-2002-05-10 Tom Rix <trix@redhat.com>
-
- * coff64-rs6000.c (xcoff64_reloc_type_br): New function for
- xcoff64_ppc_relocate_section.
- * coff-rs6000.c : Extern common xcoff_reloc_type functions.
- * libxcoff.h: Common xcoff_reloc_type function declaration.
-
-2002-05-10 Alan Modra <amodra@bigpond.net.au>
-
- * elf32-i386.c (elf_i386_relocate_section): Remove overflow checks
- added in 2002-05-09 commit.
-
- * elf32-hppa.c (elf32_hppa_size_stubs): Revert part of 2002-05-04,
- don't look for stubs on all undefined syms.
-
-2002-05-09 Alan Modra <amodra@bigpond.net.au>
-
- * elf64-ppc.c (RA_REGISTER_MASK, RA_REGISTER_SHIFT): Delete.
- (ppc64_elf_howto_raw <R_PPC64_RELATIVE>): Not pc_relative or
- pcrel_offset.
-
- * elf32-i386.c (elf_howto_table): Comments.
- (elf_i386_relocate_section): Handle more relocs for relocatable
- linking and against SEC_MERGE sections.
-
-2002-05-08 Alan Modra <amodra@bigpond.net.au>
-
- * elf32-ppc.c (ppc_elf_create_got): New function.
- (ppc_elf_create_dynamic_sections): Call ppc_elf_create_got before
- _bfd_elf_create_dynamic_sections. Correct .plt flags.
- (ppc_elf_check_relocs): Use ppc_elf_create_got in place of
- _bfd_elf_create_got_section.
-
-2002-05-07 Alan Modra <amodra@bigpond.net.au>
-
- * elf-bfd.h (struct elf_backend_data): Add rela_normal.
- * elfxx-target.h (elf_backend_rela_normal): Define.
- (elfNN_bed): Init rela_normal.
- * elflink.h (elf_link_input_bfd <emit_relocs>): Handle adjustment
- for section symbols here if rela_normal. Simplify abs section test.
- * elf-m10200.c (mn10200_elf_relocate_section): If relocatable,
- return immediately. Remove code handling relocatable linking.
- * elf-m10300.c (mn10300_elf_relocate_section): Likewise.
- * elf32-fr30.c (fr30_elf_relocate_section): Likewise.
+ 2004-03-27 Alan Modra <amodra@bigpond.net.au>
+ * elf64-mmix.c (mmix_elf_relocate_section): Restore code setting
+ "name" for global syms accidentally removed in 2004-03-20 change.
+
+ 2004-03-27 Alan Modra <amodra@bigpond.net.au>
+ * elf-bfd.h (struct elf_reloc_cookie): Add r_sym_shift field.
+ * elflink.h: Replace all occurrences of sizeof (Elf_External_*)
+ where Elf_External_* is different for 64 and 32 bit, with
+ corresponding elf_size_info field.
+ (struct elf_final_link_info): Use "bfd_byte *" instead
+ of "Elf_External_Sym *" for external_syms and symbuf.
+ (elf_link_adjust_relocs): Set up r_type_mask and r_sym_shift local
+ vars and use instead of ELF_R_INFO and ELF_R_TYPE macros.
+ (struct elf_link_sort_rela): Add "sym_mask" alias for "offset".
+ (elf_link_sort_cmp1): Use sym_mask field instead of ELF_R_SYM.
+ (elf_link_sort_cmp2): Adjust.
+ (elf_link_sort_relocs): Set up r_sym_mask local var instead of
+ using ELF_R_SYM macro. Set u.sym_mask.
+ (elf_bfd_final_link): Call _bfd_elf_stringtab_init instead of macro
+ version, elf_stringtab_init. Ditto for bfd_section_from_elf_index
+ vs. section_from_elf_index. Adjust Elf_External_Sym pointer
+ arithmetic. Pass bed to elf_link_flush_output_syms. Adjust
+ Elf_External_Dyn pointer arithmentic. Use bed swap_dyn_in and
+ swap_syn_out functions. Rearrange dyn swap in/out switch.
+ (elf_link_output_sym): Adjust Elf_External_Sym pointer arithmentic.
+ Pass bed to elf_link_flush_output_syms. Use bed swap_symbol_out.
+ (elf_link_flush_output_syms): Add elf_backend_data arg.
+ (elf_link_check_versioned_symbol): Likewise.
+ (elf_link_output_extsym): Pass bed to elf_link_check_versioned_symbol.
+ Adjust Elf_External_Sym pointer arithmetic. Use bed swap_symbol_out.
+ (elf_link_input_bfd): Use bfd_section_from_elf_index. Set up
+ r_type_mask and r_sym_shift local vars and use instead of ELF_R_SYM,
+ ELF_R_TYPE and ELF_R_INFO macros.
+ (elf_reloc_link_order): Select ELF32_R_INFO or ELF64_R_INFO invocation
+ based on size rather than using ELF_R_INFO.
+ (elf_gc_mark): Set up r_sym_shift local var and use instead of
+ ELF_R_SYM macro.
+ (struct alloc_got_off_arg): New.
+ (elf_gc_common_finalize_got_offsets): Use elf_size_info instead of
+ ARCH_SIZE. Pass get entry size down to elf_gc_allocate_got_offsets.
+ (elf_gc_allocate_got_offsets): Adjust.
+ (elf_reloc_symbol_deleted_p): Usee cookie.r_sym_shift instead of
+ ELF_R_SYM. Use bfd_section_from_elf_index.
+ (elf_bfd_discard_info): Set cookie.r_sym_shift.
+ * elfcode.h (elf_stringtab_init, section_from_elf_index): Delete.
+ (elf_slurp_symbol_table): Use bfd_section_from_elf_index.
+
+ 2004-03-26 Alan Modra <amodra@bigpond.net.au>
+ * elf64-ppc.c (elf_backend_add_symbol_hook): Define.
+ (ppc64_elf_add_symbol_hook): New function.
+ * elf-bfd.h (struct elf_backend_data <elf_add_symbol_hook>): Remove
+ const from Elf_Internal_Sym param.
+ * elflink.c (elf_link_add_object_symbols): Adjust.
+ * elf-hppa.h (elf_hppa_add_symbol_hook): Adjust.
+ * elf32-frv.c (elf32_frv_add_symbol_hook): Adjust.
+ * elf32-i370.c (elf_backend_add_symbol_hook): Adjust.
+ * elf32-m32r.c (m32r_elf_add_symbol_hook): Adjust.
+ * elf32-m68hc1x.c (elf32_m68hc11_add_symbol_hook): Adjust.
+ * elf32-m68hc1x.h (elf32_m68hc11_add_symbol_hook): Adjust.
+ * elf32-ppc.c (ppc_elf_add_symbol_hook): Adjust.
+ * elf32-sh64.c (sh64_elf_add_symbol_hook): Adjust.
+ * elf32-v850.c (v850_elf_add_symbol_hook): Adjust.
+ * elf64-alpha.c (elf64_alpha_add_symbol_hook): Adjust.
+ * elf64-mmix.c (mmix_elf_add_symbol_hook): Adjust.
+ * elf64-sh64.c (sh64_elf64_add_symbol_hook): Adjust.
+ * elf64-sparc.c (sparc64_elf_add_symbol_hook): Adjust.
+ * elfxx-ia64.c (elfNN_ia64_add_symbol_hook): Adjust.
+ * elfxx-mips.c (_bfd_mips_elf_add_symbol_hook): Adjust.
+ * elfxx-mips.h (_bfd_mips_elf_add_symbol_hook): Adjust.
+
+ 2004-03-26 Alan Modra <amodra@bigpond.net.au>
+ * elfxx-target.h (bfd_elfNN_bfd_link_add_symbols): Define.
+ * elf-bfd.h (_bfd_elf_link_add_archive_symbols): Delete.
+ (_bfd_elf_sort_symbol, _bfd_elf_add_dt_needed_tag): Delete.
+ (_bfd_elf_finalize_dynstr, bfd_elf32_bfd_link_add_symbols): Delete.
+ (bfd_elf64_bfd_link_add_symbols): Delete.
+ (bfd_elf_link_add_symbols): Declare.
+ * elfcode.h (elf_bfd_link_add_symbols): Delete.
+ * elflink.c: Include safe-ctype.h.
+ (elf_add_dt_needed_tag): Rename from _bfd_elf_add_dt_needed_tag,
+ make static.
+ (elf_sort_symbol): Rename from _bfd_elf_sort_symbol, make static.
+ (elf_finalize_dynstr): Rename from _bfd_elf_finalize_dynstr, make
+ static.
+ (elf_link_add_archive_symbols): Rename from
+ _bfd_elf_link_add_archive_symbols, make static.
+ (elf_link_add_object_symbols): New function. Corresponding
+ elflink.h function converted to use elf_size_info.
+ (bfd_elf_link_add_symbols): Likewise.
+ (bfd_elf_size_dynamic_sections): Adjust.
+ * elflink.h (elf_bfd_link_add_symbols): Delete.
+ (elf_link_add_object_symbols): Delete.
+ * elf32-gen.c (elf32_generic_link_add_symbols): Call
+ bfd_elf_link_add_symbols.
+ * elf64-gen.c (elf64_generic_link_add_symbols): Likewise.
+
+ 2004-03-25 Alan Modra <amodra@bigpond.net.au>
+ * elflink.h (elf_link_add_object_symbols): Add DT_NEEDED for as-needed
+ and chained shared libs only if dynsym. Clear dynsym on forced-local.
+ * elf-bfd.h (_bfd_elf_add_dynamic_entry): Declare.
+ (bfd_elf32_add_dynamic_entry, bfd_elf64_add_dynamic_entry): Delete.
+ (_bfd_elf_add_dt_needed_tag): Declare.
+ (_bfd_elf_sort_symbol): Declare.
+ (_bfd_elf_finalize_dynstr): Declare.
+ (RELOC_FOR_GLOBAL_SYM): Formatting.
+ * elfcode.h (elf_add_dynamic_entry): Delete.
+ * elflink.c (_bfd_elf_add_dynamic_entry): New function. Corresponding
+ elflink.h function converted to use elf_size_info.
+ (_bfd_elf_add_dt_needed_tag): Likewise.
+ (_bfd_elf_sort_symbol): Likewise.
+ (_bfd_elf_finalize_dynstr): Likewise.
+ (compute_bucket_count): Likewise.
+ (bfd_elf_size_dynamic_sections): Likewise. Check result of
+ _bfd_elf_strtab_add before calling _bfd_elf_strtab_addref.
+ (elf_adjust_dynstr_offsets, elf_collect_hash_codes): Moved from..
+ * elflink.h: ..here.
+ (sort_symbol, add_dt_needed_tag): Delete.
+ (elf_add_dynamic_entry, elf_finalize_dynstr): Delete.
+ (compute_bucket_count, NAME(bfd_elf,size_dynamic_sections)): Delete.
+ Update all users.
+ * elf32-arm.h (add_dynamic_entry): Update. Remove casts.
+ * elf32-cris.c (add_dynamic_entry): Likewise.
+ * elf32-hppa.c (add_dynamic_entry): Likewise.
+ * elf32-i370.c (add_dynamic_entry): Likewise.
+ * elf32-i386.c (add_dynamic_entry): Likewise.
+ * elf32-m32r.c (add_dynamic_entry): Likewise.
+ * elf32-m68k.c (add_dynamic_entry): Likewise.
+ * elf32-ppc.c (add_dynamic_entry): Likewise.
+ * elf32-s390.c (add_dynamic_entry): Likewise.
+ * elf32-sh.c (add_dynamic_entry): Likewise.
+ * elf32-sparc.c (add_dynamic_entry): Likewise.
+ * elf32-vax.c (add_dynamic_entry): Likewise.
+ * elf32-xtensa.c (add_dynamic_entry): Likewise.
+ * elf64-alpha.c (add_dynamic_entry): Likewise.
+ * elf64-hppa.c (add_dynamic_entry): Likewise.
+ * elf64-ppc.c (add_dynamic_entry): Likewise.
+ * elf64-s390.c (add_dynamic_entry): Likewise.
+ * elf64-sparc.c (add_dynamic_entry): Likewise.
+ * elf64-x86-64.c (add_dynamic_entry): Likewise.
+ * elfxx-ia64.c (add_dynamic_entry): Likewise.
+ * elfxx-mips.c (MIPS_ELF_ADD_DYNAMIC_ENTRY): Likewise.
+ * elf-m10300.c (_bfd_mn10300_elf_size_dynamic_sections): Likewise.
+ * elf32-frv.c (elf32_frv_size_dynamic_sections): Likewise.
+ * elf64-sh64.c (sh64_elf64_size_dynamic_sections): Likewise.
+
+ 2004-03-22 Alan Modra <amodra@bigpond.net.au>
+ * elf-bfd.h (RELOC_FOR_GLOBAL_SYMBOL): Add input_bfd, input_section
+ and rel args. Group input and output args. Wrap to 80 columns.
+ * elf-m10200.c, elf-m10300.c, elf32-arm.h, elf32-avr.c,
+ elf32-cris.c, elf32-d10v.c, elf32-fr30.c, elf32-h8300.c,
+ elf32-hppa.c, elf32-i386.c, elf32-i860.c, elf32-ip2k.c,
+ elf32-iq2000.c, elf32-m68hc1x.c, elf32-m68k.c, elf32-mcore.c,
+ elf32-msp430.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c,
+ elf32-sparc.c, elf32-v850.c, elf32-vax.c, elf32-xstormy16.c,
+ elf32-xtensa.c, elf64-alpha.c, elf64-mmix.c, elf64-ppc.c,
+ elf64-s390.c, elf64-sparc.c, elf64-x86-64.c, elfxx-ia64.c: Update
+ RELOC_FOR_GLOBAL_SYMBOL invocation.
+
+ 2004-03-20 H.J. Lu <hongjiu.lu@intel.com>
+ * elf-bfd.h (RELOC_FOR_GLOBAL_SYMBOL): Report error if
+ unresolved symbols in objects aren't allowed.
+ * elf-hppa.h (elf_hppa_relocate_section): Properly handle
+ unresolved symbols.
+ (elf_hppa_remark_useless_dynamic_symbols): Likewise.
+ (elf_hppa_unmark_useless_dynamic_symbols):
+ * elf32-frv.c (elf32_frv_relocate_section): Likewise.
+ * elf32-hppa.c (elf32_hppa_size_stubs): Likewise.
+ (elf32_hppa_relocate_section): Likewise.
* elf32-i370.c (i370_elf_relocate_section): Likewise.
+ * elf32-m32r.c (m32r_elf_relocate_section): Likewise.
+ * elf32-sh.c (sh_elf_relocate_section): Likewise.
+ * elf64-sh64.c (sh_elf64_relocate_section): Likewise.
+ * elfxx-mips.c (mips_elf_calculate_relocation): Likewise.
+ * elf-m10200.c (mn10200_elf_relocate_section): Use
+ RELOC_FOR_GLOBAL_SYMBOL.
+ * elf32-avr.c (elf32_avr_relocate_section): Likewise.
+ * elf32-d10v.c (elf32_d10v_relocate_section): Likewise.
+ * elf32-fr30.c (fr30_elf_relocate_section): Likewise.
+ * elf32-h8300.c (elf32_h8_relocate_section): Likewise.
* elf32-i860.c (elf32_i860_relocate_section): Likewise.
- * elf32-m68k.c (elf_m68k_relocate_section): Likewise.
+ * elf32-m68hc1x.c (m68hc11_get_relocation_value): Likewise.
* elf32-mcore.c (mcore_elf_relocate_section): Likewise.
+ * elf32-msp430.c (elf32_msp430_relocate_section): Likewise.
* elf32-openrisc.c (openrisc_elf_relocate_section): Likewise.
- * elf32-ppc.c (ppc_elf_relocate_section): Likewise.
- * elf32-s390.c (elf_s390_relocate_section): Likewise.
+ * elf32-v850.c (v850_elf_relocate_section): Likewise.
* elf32-xstormy16.c (xstormy16_elf_relocate_section): Likewise.
- * elf64-ppc.c (ppc64_elf_relocate_section): Likewise.
- * elf64-s390.c (elf_s390_relocate_section): Likewise.
- * elf64-x86-64.c (elf64_x86_64_relocate_section): Likewise.
- * elfxx-ia64.c (elfNN_ia64_relocate_section): Likewise.
- * elf32-arm.h (elf32_arm_relocate_section): Likewise #ifndef USE_REL.
- * elf32-m32r.c (m32r_elf_relocate_section): Likewise.
- * elf-m10200.c (elf_backend_rela_normal): Define.
- * elf-m10300.c (elf_backend_rela_normal): Define.
- * elf32-fr30.c (elf_backend_rela_normal): Define.
- * elf32-i370.c (elf_backend_rela_normal): Define.
- * elf32-i860.c (elf_backend_rela_normal): Define.
- * elf32-m68k.c (elf_backend_rela_normal): Define.
- * elf32-mcore.c (elf_backend_rela_normal): Define.
- * elf32-openrisc.c (elf_backend_rela_normal): Define.
- * elf32-ppc.c (elf_backend_rela_normal): Define.
- * elf32-s390.c (elf_backend_rela_normal): Define.
- * elf32-xstormy16.c (elf_backend_rela_normal): Define.
- * elf64-ppc.c (elf_backend_rela_normal): Define.
- * elf64-s390.c (elf_backend_rela_normal): Define.
- * elf64-x86-64.c (elf_backend_rela_normal): Define.
- * elfxx-ia64.c (elf_backend_rela_normal): Define.
- * elf32-arm.h (elf_backend_rela_normal): Define #ifndef USE_REL.
- * elf32-m32r.c (elf_backend_rela_normal): Likewise.
-
-2002-05-06 Nick Clifton <nickc@cambridge.redhat.com>
-
- * elf32-arm.h (elf32_arm_final_link_relocate): Convert
- 'reloc_signed_max' and 'reloc_signed_min' into half-word offsets.
-
-2002-05-06 Alan Modra <amodra@bigpond.net.au>
-
- * elflink.h (elf_link_input_bfd <emit_relocs>): Adjust r_offset
- when not relocatable. Fix reloc_emitter call for K&R.
-
-2002-05-04 Alan Modra <amodra@bigpond.net.au>
-
- * elf64-ppc.c (ppc64_elf_relocate_section): Reinstate code
- reloading local sym addend mistakenly removed in 2002-05-01 change.
-
- * dwarf2.c (struct line_head): Make prologue_length a bfd_vma.
- (read_abbrevs): Change "offset" param to bfd_vma.
- (parse_comp_unit): Change "version" and addr_size to unsigned ints.
- Change "abbrev_offset" to bfd_vma.
- (read_indirect_string): Use correct conversion chars in error
- message format string, cast bfd_vma's to unsigned long.
- (read_abbrevs): Likewise.
- (read_attribute_value): Likewise.
- (decode_line_info): Likewise.
- (scan_unit_for_functions): Likewise.
- (parse_comp_unit): Likewise.
-
-2002-05-04 Tom Rix <trix@redhat.com>
-
- * coffswap.h (coff_swap_reloc_in): Remove XCOFF support.
- (coff_swap_reloc_out): Same.
- * coff-rs6000.c: (xcoff_swap_reloc_in): Moved from coffswap.h.
- (xcoff_swap_reloc_out): Same.
- (xcoff_rtype2howto): Renamed from _bfd_xcoff_rtype2howto. Special
- case some 16 bit relocs. Add reloc value to output.
- (xcoff_howto_table): Remove 64 bit R_POS, add 16 bit
- R_RBR. Improve names.
- (_bfd_xcoff_reloc_type_lookup): Adjust for removal of 64 bit R_POS.
- (bfd_xcoff_backend_data): Update with new reloc swap names.
- (bfd_pmac_xcoff_backend_data) : Same.
- * coff64-rs6000.c: (xcoff64_swap_reloc_in): Moved from coffswap.h.
- (xcoff64_swap_reloc_out): Same.
- (xcoff64_rtype2howto): Special case some 16 bit relocs and 32 bit
- R_POS. Add reloc value to output.
- (xcoff64_howto_table): Move 64 bit R_POS to first entry. Add 16
- bit R_RBR. Improve names, masks.
- (xcoff64_reloc_type_lookup): Adjust for move of 64 bit R_POS.
- (bfd_xcoff_backend_data): Update with new reloc swap names.
- (bfd_xcoff_aix5_backend_data) : Same.
-
-2002-05-04 Alan Modra <amodra@bigpond.net.au>
-
- * elf32-hppa.c (struct elf32_hppa_link_hash_table): Add
- bfd_count top_index, input_list, all_local_syms.
- (elf32_hppa_setup_section_lists): New function, split from
- elf32_hppa_size_stubs.
- (elf32_hppa_next_input_section): Likewise.
- (group_sections): Likewise.
- (get_local_syms): Likewise.
- (elf32_hppa_size_stubs): Adjust for split out functions. Look for
- stubs on undefined syms too.
- (elf32_hppa_set_gp): Use bfd_link_hash* instead of elf_link_hash*.
- Only access htab elf fields when we have an elf hash table.
- * elf32-hppa.h (elf32_hppa_setup_section_lists): Declare.
- (elf32_hppa_next_input_section): Declare.
-
-2002-05-04 Bob Byrnes <byrnes@curl.com>
-
- * opncls.c (_bfd_new_bfd_contained_in): Check return value of
- _bfd_new_bfd.
-
-2002-05-03 H.J. Lu (hjl@gnu.org)
-
- * elfxx-mips.c (mips_elf_link_hash_entry): Add forced_local.
- (mips_elf_link_hash_newfunc): Initialize forced_local to false.
- (mips_elf_record_global_got_symbol): Call _bfd_mips_elf_hide_symbol
- to hide a global symbol.
- (_bfd_mips_elf_hide_symbol): Return if forced_local is true. Set
- forced_local to true.
-
-2002-05-02 Richard Henderson <rth@redhat.com>
-
- * elf64-alpha.c (elf64_alpha_relocate_section): Force relative relocs
- vs SHN_UNDEF to zero.
-
-2002-05-02 Alan Modra <amodra@bigpond.net.au>
-
- * elf64-ppc.c (ppc64_elf_howto_raw <R_PPC64_SECTOFF>): Change to a
- 16 bit reloc.
- <R_PPC64_SECTOFF_DS>: Likewise.
- (ppc64_elf_reloc_type_lookup): Map from BFD_RELOC_16_BASEREL to
- SECTOFF reloc.
- * elf32-ppc.c (ppc_elf_howto_raw <R_PPC_SECTOFF>): Correct.
- (ppc_elf_reloc_type_lookup): Map from BFD_RELOC_16_BASEREL to
- SECTOFF reloc.
-
- * elf64-ppc.c (ppc64_elf_addr16_ha_reloc): Delete.
- (ppc64_elf_ha_reloc): New function.
- (ppc64_elf_brtaken_reloc): New function.
- (ppc64_elf_sectoff_reloc): New function.
- (ppc64_elf_sectoff_ha_reloc): New function.
- (ppc64_elf_toc_reloc): New function.
- (ppc64_elf_toc_ha_reloc): New function.
- (ppc64_elf_toc64_reloc): New function.
- (ppc64_elf_unhandled_reloc): New function.
- (ppc64_elf_howto_raw): Use the above.
- <R_PPC64_RELATIVE>: Mark pc_relative, pcrel_offset.
- <R_PPC64_SECTOFF>: Not pc_relative or pcrel_offset. Fix dst_mask.
- <R_PPC64_SECTOFF_DS>: Likewise.
- (IS_ABSOLUTE_RELOC): Update.
- (struct ppc_link_hash_table): Add have_undefweak.
- (ppc64_elf_link_hash_table_create): Init.
- (func_desc_adjust): Set have_undefweak.
- (ppc64_elf_func_desc_adjust): Call func_desc_adjust earlier. Only
- add the .sfpr blr when have_undefweak.
- (ppc64_elf_setup_section_lists): Check hash table flavour.
- (ppc64_elf_next_input_section): Move output_section->owner test to
- ppc64elf.em.
- (ppc64_elf_set_toc): Rename to ppc64_elf_toc, remove info param
- and relocatable test. Return TOCstart and don't set elf_gp.
- (ppc64_elf_relocate_section): Correct BRTAKEN/BRNTAKEN branch
- offset calculation. Add assert on weak sym branch tweaks.
- * elf64-ppc.h (ppc64_elf_set_toc): Delete.
- (ppc64_elf_toc): Declare.
- (ppc64_elf_next_input_section): Update.
-
-2002-05-01 Alan Modra <amodra@bigpond.net.au>
-
- * syms.c (_bfd_stab_section_find_nearest_line): Don't bomb on NULL
- file_name.
-
-2002-05-01 Alan Modra <amodra@bigpond.net.au>
-
- * elf64-ppc.c (CROR_151515, CROR_313131): Define.
- (ppc64_elf_relocate_section): Use them. Don't look for plt calls
- on R_PPC64_ADDR24 relocs. Require a nop or no link reg on plt
- call branches. Correct undefined weak destination.
- (ppc64_elf_func_desc_adjust): Always create at least one blr in
- .sfpr, and correct case where either only savef* or restf* is
- needed.
-
- Long branch stubs, multiple stub sections.
- * elf64-ppc.h (ppc64_elf_setup_section_lists): Declare.
- (ppc64_elf_next_input_section): Declare.
- * elf64-ppc.c: Move linker-only prototypes.
- (STUB_SUFFIX): Define.
- (enum ppc_stub_type): New.
- (struct ppc_stub_hash_entry): New.
- (struct ppc_branch_hash_entry): New.
- (struct ppc_link_hash_entry): Add stub_cache, oh.
- (struct ppc_link_hash_table): Add stub_hash_table etc. Remove
- sstub. Add sbrlt, srelbrlt, has_14bit_branch, stub_iteration.
- Rename plt_overflow to stub_error.
- (ppc_stub_hash_lookup): Define.
- (ppc_branch_hash_lookup): Define.
- (stub_hash_newfunc): New function.
- (branch_hash_newfunc): New function.
- (link_hash_newfunc): Init new fields.
- (ppc64_elf_link_hash_table_create): Likewise.
- (ppc64_elf_link_hash_table_free): New function.
- (ppc_stub_name): New function.
- (ppc_get_stub_entry): New function.
- (ppc_add_stub): New function.
- (create_linkage_sections): Use bfd_make_section_anyway. Create
- .branch_lt and .rela.branch_lt sections. Don't create .stub.
- (ppc64_elf_check_relocs): Set has_14bit_branch on R_PPC64_REL14*,
- and set up for plt call stubs. Link func and func desc syms.
- (ppc64_elf_gc_sweep_hook): Handle REL14* as per REL24.
- (func_desc_adjust): Avoid hash lookup when func desc sym available
- via shortcut, and set links when processing.
- (ppc64_elf_hide_symbol): Likewise.
- (allocate_dynrelocs): Don't allocate stub section here.
- (ppc64_elf_size_dynamic_sections): Handle sbrlt and srelbrlt.
- Remove sstub code.
- (ppc_type_of_stub): New function.
- (build_one_stub): Delete.
- (ppc_build_one_stub): New function.
- (ppc_size_one_stub): New function.
- (ppc64_elf_setup_section_lists): New function.
- (ppc64_elf_next_input_section): New function.
- (group_sections): New function.
- (get_local_syms): New function.
- (ppc64_elf_size_stubs): Rewrite.
- (ppc64_elf_build_stubs): Rewrite.
- (ppc64_elf_relocate_section): Look up stub entry for REL24
- relocs. Don't propagate REL14* to dynamic objects. Look for long
- branch stubs if REL14* or REL24 relocs won't reach.
- (bfd_elf64_bfd_link_hash_table_free): Define.
-
-2002-04-30 Mark Mitchell <mark@codesourcery.com>
-
- * bfd/config.bfd: Add support for powerpc-*-windiss.
-
-2002-04-30 Tom Rix <trix@redhat.com>
-
- * xcofflink.c (xcoff_link_add_symbols): Always copy undef C_EXT
- symbol names into the hash table.
-
-2002-04-28 Tom Rix <trix@redhat.com>
-
- * coff-rs6000.c (xcoff_calculate_relocation) : Function table for
- calulating relocations.
- (xcoff_complain_overflow) : Function table for relocation errors.
- (xcoff_ppc_relocate_section): Use relocation and complain function
- tables.
- (xcoff_complain_overflow_unsigned_func): New complain function.
- (xcoff_complain_overflow_signed_func): Same.
- (xcoff_complain_overflow_bitfield_func): Same.
- (xcoff_complain_overflow_dont_func): Same.
- (xcoff_reloc_type_crel): New recot function.
- (xcoff_reloc_type_br): Same.
- (xcoff_reloc_type_ba): Same.
- (xcoff_reloc_type_toc): Same.
- (xcoff_reloc_type_rel): Same.
- (xcoff_reloc_type_neg): Same.
- (xcoff_reloc_type_pos): Same.
- (xcoff_reloc_type_fail): Same.
- (xcoff_reloc_type_noop): Same.
- * libxcoff.h : Declare common parts for xcoff64.
- * coff64-rs6000.c (xcoff64_ppc_relocate_section): Use relocation
- and complain function tables.
-
-2002-04-28 Alan Modra <amodra@bigpond.net.au>
-
- * elf64-x86-64.c (struct elf64_x86_64_dyn_relocs): Comment typo.
- * elf32-hppa.c (elf32_hppa_final_link): Formatting.
-
-2002-04-26 Alan Modra <amodra@bigpond.net.au>
-
- * opncls.c (bfd_make_readable): Call bfd_section_list_clear.
- * xcofflink.c (xcoff_link_add_dynamic_symbols): Likewise.
-
- * elflink.h (elf_bfd_final_link): Ensure input bfd class is the
- same as the output before calling elf_link_input_bfd.
-
- * coffcode.h (coff_compute_section_file_positions): Set
- section_tail after shuffling section list.
-
-2002-04-24 Christian Groessler <chris@groessler.org>
-
- * coff-z8k.c (extra_case): Fix R_IMM32 relocations: The
- addresses are 23bit with a special layout, not plain 32bit
- values. Prevent relocation of immediate values.
-
-2002-04-24 Chris G. Demetriou <cgd@broadcom.com>
-
- * elfxx-mips.c (_bfd_mips_elf_print_private_bfd_data): If MDMX or
- MIPS-16 ASE flags are set, print something to indicate that.
-
-2002-04-23 Alan Modra <amodra@bigpond.net.au>
-
- * elf32-hppa.c (hppa_type_of_stub): Correct and simplify condition
- under which a plt call stub is used.
- (final_link_relocate): Similarly.
- (allocate_plt_static): Clear h-plabel except when plt entry is
- exclusively used for a plabel.
- (allocate_dynrelocs): Use the above to simplify plt sizing.
- (struct elf32_hppa_link_hash_table): Add has_22bit_branch.
- (elf32_hppa_link_hash_table_create): Init.
- (BL22_RP): Define.
- (hppa_build_one_stub): Use BL22_RP if has_22bit_branch.
- (elf32_hppa_check_relocs): Set has_22bit_branch.
-
- * elf32-hppa.c (elf32_hppa_check_relocs): Remove debug message.
- (final_link_relocate): Likewise.
-
-2002-04-22 Jakub Jelinek <jakub@redhat.com>
-
- * elf-eh-frame.c (_bfd_elf_discard_section_eh_frame): Don't build
- search table if some FDE is DW_EH_PE_aligned encoded either.
- (_bfd_elf_write_section_eh_frame): Handle terminating FDE specially.
-
-2002-04-22 Richard Smith <richard@ex-parrot.com>
- Jakub Jelinek <jakub@redhat.com>
-
- * elf-eh-frame.c (struct eh_cie_fde): Add per_encoding_relative.
- (_bfd_elf_discard_section_eh_frame): Set it for CIEs with pcrel
- encoded personality.
- (_bfd_elf_write_section_eh_frame): Adjust pcrel encoded personality
- for CIE/FDE removal.
-
-2002-04-20 Tom Rix <trix@redhat.com>
-
- * coff64-rs6000.c (_bfd_xcoff64_swap_aux_in): Fix C_FILE auxent.
-
-2002-04-20 Alan Modra <amodra@bigpond.net.au>
-
- * archures.c (bfd_lookup_arch): Move the list order comment..
- (struct bfd_arch_info): ..to where it belongs.
+ * elf64-mmix.c (mmix_elf_relocate_section): Likewise.
+
+ 2004-03-19 Alan Modra <amodra@bigpond.net.au>
+ H.J. Lu <hongjiu.lu@intel.com>
+ * elflink.c (_bfd_elf_merge_symbol): Revert last change. Move
+ type and size change code to where it was previously. Remove
+ dt_needed param. Treat old weak syms as strong if new sym is
+ from a shared lib, even when old sym is from another shared
+ lib. Remove unnecessary tests of oldweak and newweak. Correct
+ comments.
+ (_bfd_elf_add_default_symbol): Remove dt_needed param. Update
+ _bfd_elf_merge_symbol calls.
+ * elflink.h (elf_link_add_object_symbols): Update calls. Remove
+ dt_needed local var. Update comments.
+ * elf-bfd.h (_bfd_elf_merge_symbol): Update prototype.
+ (_bfd_elf_add_default_symbol): Likewise.
+ * elflink.c (_bfd_elf_merge_symbol): Reinstate code to handle
+ strong syms in one shared object overriding weak syms in another.
+
+ 2004-03-18 Alan Modra <amodra@bigpond.net.au>
+ * elf-bfd.h (struct elf_obj_tdata): Delete dt_soname field. Add
+ dyn_lib_class field. Rearrange for better packing.
+ (elf_dt_soname): Delete.
+ (elf_dyn_lib_class): Define.
+ * elf.c (bfd_elf_set_dt_needed_name): Update comment.
+ (bfd_elf_set_dt_needed_soname): Delete.
+ (bfd_elf_set_dyn_lib_class): New function.
+ * elflink.h (add_dt_needed_tag): New function. Split out from..
+ (elf_link_add_object_symbols): ..here. Rename "name" to "soname".
+ Use elf_dyn_lib_class to set dt_needed and add_needed. Move fallback
+ initialization of soname.
+ (elf_link_check_versioned_symbol): Test elf_dyn_lib_class instead of
+ elf_dt_soname.
+ * bfd-in.h (enum dynamic_lib_link_class): New.
+ (bfd_elf_set_dt_needed_soname): Delete.
+ (bfd_elf_set_dyn_lib_class): Declare.
* bfd-in2.h: Regenerate.
+ * elflink.c (_bfd_elf_merge_symbol): Rewrite weak symbol handling.
+ (_bfd_elf_add_default_symbol): Remove indirect BFD_ASSERTs.
+ * elflink.h (elf_link_add_object_symbols): Don't clear dt_needed in
+ symbol loop. Instead use add_needed to flag tag as written.
+
+ 2004-03-03 Alexandre Oliva <aoliva@redhat.com>
+ * elflink.c (bfd_elf_record_link_assignment): Mark undefweak and
+ undefined symbols as hash_new.
+
+ 2004-02-28 H.J. Lu <hongjiu.lu@intel.com>
+ * elf-bfd.h (_bfd_elf_link_add_archive_symbols): New prototype.
+ * elflink.h (is_global_data_symbol_definition): Moved to
+ elflink.c.
+ (elf_link_is_defined_archive_symbol): Likewise.
+ (elf_link_add_archive_symbols): Likewise. Renamed to
+ _bfd_elf_link_add_archive_symbols.
+ * elflink.c (elf_link_is_defined_archive_symbol): Get the size
+ of ELF symbol table entry from backend.
+ (_bfd_elf_link_add_archive_symbols): Call bfd_link_add_symbols
+ instead of elf_link_add_object_symbols.
+
+ 2004-02-27 H.J. Lu <hongjiu.lu@intel.com>
+ * elflink.h (sort_symbol): New.
+ (elf_link_add_object_symbols): Use a sorted symbol array for
+ weakdef.
+
+ 2004-02-23 Jakub Jelinek <jakub@redhat.com>
+ * elflink.h (size_dynamic_sections): If not adding DT_FLAGS and
+ DF_BIND_NOW is set in info->flags, create DT_BIND_NOW dynamic entry.
+
+ 2004-02-21 H.J. Lu <hongjiu.lu@intel.com>
+ * elflink.c (_bfd_elf_merge_symbol): Properly handle undefined
+ symbols with non-default visibility.
+
+2004-03-22 Bob Wilson <bob.wilson@acm.org>
+
+ * elf32-xtensa.c (elf_xtensa_check_relocs): Remove code to read
+ literal tables and check for relocs outside of literal pools.
+ (elf_xtensa_make_sym_local): Don't clear ELF_LINK_NON_GOT_REF flag.
+ (elf_xtensa_fix_refcounts): Don't check ELF_LINK_NON_GOT_REF or
+ set DF_TEXTREL.
+ (elf_xtensa_size_dynamic_sections): Don't add DT_TEXTREL entry.
+ (elf_xtensa_relocate_section): Read literal tables and check for
+ dynamic relocations in read-only sections and not in literal pools.
+
+2004-03-23 Alan Modra <amodra@bigpond.net.au>
+
+ PR 51.
+ * linker.c (bfd_wrapped_link_hash_lookup): Handle info->wrap_char.
+
+2004-03-22 Hans-Peter Nilsson <hp@axis.com>
+
+ * elf32-cris.c (cris_elf_relocate_section) <case R_CRIS_16_GOTPLT,
+ R_CRIS_16_GOTPLT>: Also error if there's no PLT for a symbol
+ not defined by the executable, or defined in a DSO.
+ <eliding run-time relocation of .got>: Initialize GOT entry for a
+ function symbol or ELF_LINK_HASH_NEEDS_PLT statically in an
+ executable.
+ (cris_elf_gc_sweep_hook): Improve fallthrough marking.
+ (elf_cris_try_fold_plt_to_got): Improve head comment. Do not fold
+ a PLT reloc to GOT for an executable.
+ (elf_cris_adjust_dynamic_symbol): Only fold a .got.plt entry with
+ .got for a DSO and explain why.
+ (elf_cris_discard_excess_program_dynamics): Also lose GOT-relocs
+ and unreferenced symbols for which a PLT is defined. Adjust
+ dynamic-symbol pruning correspondingly, to make sure we don't lose
+ a dynamic symbol also defined by a DSO.
+
+2004-03-17 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
+
+ * config.bfd: Switch sh-*-rtems* to ELF. Add sh-*-rtemscoff*.
+
+2004-03-16 Alan Modra <amodra@bigpond.net.au>
+
+ * elflink.c (elf_link_read_relocs_from_section): Don't use
+ NUM_SHDR_ENTRIES in end of reloc calc. Move NULL shdr check..
+ (_bfd_elf_link_read_relocs): ..to here.
+ * elf32-ppc.c (ppc_elf_relax_section): Formatting.
- * archures.c (bfd_lookup_arch): Add comment on list order.
- (bfd_default_set_arch_mach): Use bfd_lookup_arch.
- * cpu-powerpc.c (bfd_powerpc_archs): Re-order so that the default
- is always at head of list.
-
-2002-04-18 Nick Clifton <nickc@cambridge.redhat.com>
-
- * coff-arm.c (coff_thumb_pcrel_12, coff_thumb_pcrel_9,
- insert_thumb_branch, record_thumb_to_arm_glue): Suppress
- definition of these functions for ARM_WINCE builds as they are
- not used.
- (SWAP_IN_RELOC_OFFSET, SWAP_OUT_RELOC_OFFSET): Do not define
- for ARM_WINCE builds.
-
-2002-04-18 Nick Clifton <nickc@cambridge.redhat.com>
-
- * coff-arm.c (bfd_arm_process_before_allocation):
-
-2002-04-17 J"orn Rennecke <joern.rennecke@superh.com>
-
- * cpu-sh.c (scan_mach): Delete.
- (arch_info_struct): Replace scan_mach with bfd_default_scan.
- (bfd_sh_arch): Likewise.
-
-2002-04-16 Nick Clifton <nickc@cambridge.redhat.com>
-
- * ihex.c (ihex_write_object_contents): Fix check for records
- crossing 64K boundaries.
-
-2002-04-16 Alan Modra <amodra@bigpond.net.au>
-
- * elf32-m32r.c (m32r_elf_add_symbol_hook): Check the hash table
- type rather than just assuming entries are ELF.
- * elf32-sh64.c (sh64_elf_add_symbol_hook): Likewise.
- * elf64-sh64.c (sh64_elf64_add_symbol_hook): Likewise.
- * elf64-sparc.c (sparc64_elf_add_symbol_hook): Likewise.
- * elf64-mmix.c (mmix_elf_add_symbol_hook): Use bfd_link_hash_entry
- rather than elf_link_hash_entry.
-
-2002-04-15 Richard Henderson <rth@redhat.com>
-
- * elf32-mips.c (mips_elf32_object_p): Revert 0404 fragment: allow
- n32 binaries.
-
-2002-04-15 Michael Snyder <msnyder@redhat.com>
-
- * opncls.c (bfd_close): Write contents if writeable.
- Minor formatting tidy-ups.
-
-2002-04-15 Alan Modra <amodra@bigpond.net.au>
-
- * elf32-ppc.c (ppc_elf_add_symbol_hook): Check the hash table type.
-
-2002-04-12 Michael Snyder <msnyder@redhat.com>
-
- * bfd-in.h (bfd_get_section_lma): New access macro.
- Minor white-space fix-up.
-
-2002-04-12 Alan Modra <amodra@bigpond.net.au>
-
- * elf.c (prep_headers): Don't zero EI_OSABI, EI_ABIVERSION or
- header pad.
-
-2002-04-09 DJ Delorie <dj@redhat.com>
-
- * elfarm-nabi.c (elf32_arm_howto_table): Fix ABS16 masks.
-
-2002-04-09 Casper S. Hornstrup <chorns@users.sourceforge.net>
-
- * coffcode.h (coff_read_word): New.
- (coff_compute_checksum): New.
- (coff_apply_checksum): New.
- (coff_write_object_contents): Call coff_apply_checksum () to
- apply checksum to PE image.
-
-2002-04-08 Randolph Chung <tausq@debian.org>
-
- * elf32-hppa.c (hppa_unwind_entry_compare): Move to elf-hppa.h.
- (elf32_hppa_final_link): Split out sorting logic to..
- * elf-hppa.h (elf_hppa_sort_unwind): ..here.
- (elf_hppa_final_link): Call elf_hppa_sort_unwind.
-
-2002-04-07 Andrew Cagney <ac131313@redhat.com>
-
- * configure.in: Add missing ``|'' to powerpc-*-aix4.[4-9]*
- pattern.
- * configure: Re-generate.
-
-2002-04-07 Andrew Cagney <ac131313@redhat.com>
-
- * configure.in: Only define AIX_CORE_DUMPX_CORE when AIX version
- is greater or equal to 4.3.3.
+ 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.
- Fix PR gdb/344.
-
-2002-04-05 Hans-Peter Nilsson <hp@axis.com>
-
- * elf32-cris.c (cris_elf_howto_table) <R_CRIS_16_PCREL,
- R_CRIS_32_PCREL>: Fix typo in name.
- (cris_elf_check_relocs): Always create .rela.got here when
- R_CRIS_16_GOTPLT or R_CRIS_32_GOTPLT is seen.
- (elf_cris_adjust_gotplt_to_got): Don't create .rela.got here;
- assume it's created.
-
-2002-04-04 Daniel Jacobowitz <drow@mvista.com>
-
- * aout-adobe.c (aout_32_bfd_link_hash_table_free): Define.
- * aout-target.h (MY_bfd_link_hash_table_free): Conditionally
- define.
- * aout-tic30.c (MY_bfd_link_hash_table_free): Likewise.
- * bfd.c (bfd_link_hash_table_free): Define.
- * binary.c (binary_bfd_link_hash_table_free): Define.
- * bout.c (b_out_bfd_link_hash_table_free): Define.
- * coff-rs6000.c (rs6000coff_vec): Include
- _bfd_generic_link_hash_table_free.
- (pmac_xcoff_vec): Likewise.
- * coff64-rs6000.c (rs6000coff64_vec): Likewise.
- (aix5coff64_vec): Likewise.
- * coffcode.h (coff_bfd_link_hash_table_free): Conditionally define.
- * elf-m10300.c (elf32_mn10300_link_hash_table_free): New function.
- (bfd_elf32_bfd_link_hash_table_free): Define.
- * elf32-hppa.c (elf32_hppa_link_hash_table_free): New function.
- (bfd_elf32_bfd_link_hash_table_free): Define.
- * elfxx-target.h (bfd_elfNN_bfd_link_hash_table_free): Conditionally
- define.
- * i386msdos.c (msdos_bfd_link_hash_table_free): Define.
- * i386os9k.c (os9k_bfd_link_hash_table_free): Define.
- * ieee.c (ieee_bfd_link_hash_table_free): Define.
- * ihex.c (ihex_bfd_link_hash_table_free): Define.
- * libbfd-in.h (_bfd_nolink_bfd_link_hash_table_free): Define.
- (_bfd_generic_link_hash_table_free): Add prototype.
- * libcoff-in.h (_bfd_xcoff_bfd_link_hash_table_free): Add prototype.
- * libecoff.h (_bfd_ecoff_bfd_link_hash_table_free): Define.
- * linker.c (_bfd_generic_link_hash_table_free): New function.
- * mmo.c (mmo_bfd_link_hash_table_free): Define.
- * nlm-target.h (nlm_bfd_link_hash_table_free): Define.
- * oasys.c (oasys_bfd_link_hash_table_free): Define.
- * ppcboot.c (ppcboot_bfd_link_hash_table_free): Define.
- * som.c (som_bfd_link_hash_table_free): Define.
- * srec.c (srec_bfd_link_hash_table_free): Define.
- * tekhex.c (tekhex_bfd_link_hash_table_free): Define.
- * versados.c (versados_bfd_link_hash_table_free): Define.
- * vms.c (vms_bfd_link_hash_table_free): New function.
- * xcofflink.c (_bfd_xcoff_bfd_link_hash_table_free): New function.
-
- * coff-arm.c (coff_arm_link_hash_table_create): Use bfd_malloc
- instead of bfd_alloc.
- * coff-h8300.c (h8300_coff_link_hash_table_create): Likewise.
- * coff-mcore.c (coff_mcore_link_hash_table_create): Likewise.
- * coff-ppc.c (ppc_coff_link_hash_table_create): Likewise.
- * cofflink.c (_bfd_coff_link_hash_table_create): Likewise.
- * ecoff.c (_bfd_ecoff_bfd_link_hash_table_create): Likewise.
- * elf-m10300.c (elf32_mn10300_link_hash_table_create): Likewise.
- * elf.c (_bfd_elf_link_hash_table_create): Likewise.
- * elf32-arm.h (elf32_arm_link_hash_table_create): Likewise.
- * elf32-cris.c (elf_cris_link_hash_table_create): Likewise.
- * elf32-hppa.c (elf32_hppa_link_hash_table_create): Likewise.
- * elf32-i386.c (elf_i386_link_hash_table_create): Likewise.
- * elf32-m68k.c (elf_m68k_link_hash_table_create): Likewise.
- * elf32-s390.c (elf_s390_link_hash_table_create): Likewise.
- * elf32-sh.c (sh_elf_link_hash_table_create): Likewise.
- * elf64-alpha.c (elf64_alpha_bfd_link_hash_table_create): Likewise.
- * elf64-ppc.c (ppc64_elf_link_hash_table_create): Likewise.
- * elf64-s390.c (elf_s390_link_hash_table_create): Likewise.
- * elf64-sh64.c (sh64_elf64_link_hash_table_create): Likewise.
- * elf64-sparc.c (sparc64_elf_bfd_link_hash_table_create): Likewise.
- * elf64-x86-64.c (elf64_x86_64_link_hash_table_create): Likewise.
- * elfxx-mips.c (_bfd_mips_elf_link_hash_table_create): Likewise.
- * linker.c (_bfd_generic_link_hash_table_create): Likewise.
- * m68klinux.c (linux_link_hash_table_create): Likewise.
- * sparclinux.c (linux_link_hash_table_create): Likewise.
- * sunos.c (sunos_link_hash_table_create): Likewise.
- * xcofflink.c (_bfd_xcoff_bfd_link_hash_table_create): Likewise.
-
- * targets.c: Add _bfd_link_hash_table_free to xvec.
-
- * bfd-in2.h: Regenerate.
- * libbfd.h: Regenerate.
- * libcoff.h: Regenerate.
-
-2002-04-04 Alan Modra <amodra@bigpond.net.au>
-
- * dep-in.sed: Cope with absolute paths.
- * Makefile.am (dep.sed): Subst TOPDIR, and not INCDIR.
- Run "make dep-am".
- * Makefile.in: Regenerate.
- * coff-arm.c: Fix copyright date.
- * cpu-h8300.c: Likewise.
- * cpu-i370.c: Likewise.
- * cpu-s390.c: Likewise.
- * cpu-mips.c: Likewise.
- * po/SRC-POTFILES.in: Regenerate.
-
-2002-04-04 Thiemo Seufer <seufer@csv.ica.uni-stuttgart.de>
- * Makefile.am: Add elfxx-mips.c to the known backends.
- (elf32-mips.lo): remove dependency to coff/external.h.
- * Makefile.in: Regenerate.
- * configure.in: Add elfxx-mips.lo to all vectors using elf32-mips.lo
- Remove elf32-mips.lo from 64 bit vectors. Update dependencies
- accordingly.
+2004-03-16 Alan Modra <amodra@bigpond.net.au>
+
+ * elf32-m32r.c (m32r_elf_create_dynamic_sections): Fix pointer
+ aliasing warning. Remove trailing whitespace throughout file.
+
+2004-03-15 John David Anglin <dave.anglin@nrc-cnrc.gc.ca>
+
+ * elf-hppa.h (elf_hppa_relocate_section): Pass input_bfd instead of
+ input_section in calls to get_dyn_name.
+ * elf64-hppa.c (get_dyn_name): Change type of first argument to "bfd *". Use section id of first section in input BFD to build dynamic name for
+ local symbols.
+ (elf64_hppa_check_relocs): Pass abfd in call to get_dyn_name.
+
+2004-03-15 Alan Modra <amodra@bigpond.net.au>
+
+ * bfd-in.h (bfd_int64_t, bfd_uint64_t): New types.
+ (BFD_HOST_64_BIT, BFD_HOST_U_64_BIT): Don't define here.
+ (bfd_getb64, bfd_getl64, bfd_get_bits): Return bfd_uint64_t.
+ (bfd_getb_signed_64, bfd_getl_signed_64): Return bfd_int64_t.
+ (bfd_putb64, bfd_putl64, bfd_put_bits): Accept bfd_uint64_t.
+ * configure.in (HOST_U_64BIT_TYPE): Set when sizeof long is 8.
+ (BFD_HOST_64_BIT_DEFINED, BFD_HOST_64_BIT, BFD_HOST_U_64_BIT): Set
+ when using long.
+ * libbfd.c (EIGHT_GAZILLION, COERCE64): Use bfd_int64_t.
+ (bfd_getb64): Return bfd_uint64_t. Enable when BFD_HOST_64_BIT.
+ (bfd_getl64, bfd_getb_signed_64, bfd_getl_signed_64): Likewise.
+ (bfd_putb64): Accept bfd_uint64_t. Enable when BFD_HOST_64_BIT.
+ (bfd_putl64, bfd_put_bits, bfd_get_bits): Likewise.
+ * dwarf2.c (struct attribute): Use bfd_int64_t and bfd_uint64_t.
+ (read_8_bytes, read_indirect_string, read_address): Likewise.
+ (read_abbrevs, parse_comp_unit): Likewise.
+ * targets.c (struct bfd_target): Likewise.
+ * aix386-core.c (NO_GET64, NO_PUT64, NO_GETS64): Define and use.
+ * hppabsd-core.c: Likewise. Formatting.
+ * hpux-core.c: Likewise.
+ * irix-core.c: Likewise.
+ * netbsd-core.c: Likewise.
+ * osf-core.c: Likewise.
+ * ptrace-core.c: Likewise.
+ * sco5-core.c: Likewise.
+ * trad-core.c: Likewise.
* configure: Regenerate.
- * elf-bfd.h: Move all MIPS ELF specific prototypes to elfxx-mips.h.
- (irix_compat_t): IRIX compatibility level, moved from elf32-mips.c.
- (elf_backend_mips_irix_compat, elf_backend_mips_rtype_to_howto): New
- MIPS specific backend functions.
- * elf32-mips.c: Moved most code to elfxx-mips.c.
- (mips_elf_hi16_reloc): Rename from _bfd_mips_elf_hi16_reloc and make
- static.
- (mips_elf_lo16_reloc): Likewise, was _bfd_mips_elf_lo16_reloc.
- (mips_elf_got16_reloc): Likewise, was _bfd_mips_elf_got16_reloc.
- (mips_elf_gprel32_reloc): Likewise, was _bfd_mips_elf_gprel32_reloc.
- (mips_elf32_rtype_to_howto): Rename from mips_rtype_to_howto. Changed
- interface to allow selection of the right REL or RELA howto table.
- (mips_elf32_object_p): Rename from _bfd_mips_elf_object_p and made
- static. Let it refuse n32 objects.
- (elf32_mips_grok_prstatus): Rename from _bfd_elf32_mips_grok_prstatus.
- (elf32_mips_grok_psinfo): Rename from _bfd_elf32_mips_grok_psinfo.
- (elf32_mips_discard_info): Rename from _bfd_elf32_mips_discard_info.
- (elf32_mips_ignore_discarded_relocs): Rename from
- _bfd_elf32_mips_ignore_discarded_relocs.
- (elf32_mips_write_section): Rename from _bfd_elf32_mips_write_section.
- (elf32_mips_irix_compat): New function, replaces IRIX_COMPAT.
- (elf_mips_howto_table_rela): Remove.
- * elf64-mips.c: Moved most code to elfxx-mips.c.
- (bfd_elf64_bfd_reloc_type_lookup): Make static.
- (mips_elf64_rtype_to_howto): New function.
- (mips_elf64_object_p): Likewise.
- (elf64_mips_irix_compat): Likewise.
- * elfxx-mips.c: New file containing common code merged together from
- elf32-mips.c and elf64-mips.c.
- * elfxx-mips.h: New file containing MIPS specific prototypes from
- elf-bfd.h.
- * elfxx-target.h: Add handling for elf_backend_mips_irix_compat and
- elf_backend_mips_rtype_to_howto.
-
-2002-04-04 Alan Modra <amodra@bigpond.net.au>
-
- * srec.c (MAXCHUNK, Chunk): Revise comments.
- (srec_write_record): Correct buffer size.
- (srec_write_header): Do without intermediate buffer.
- (srec_write_section): Validate Chunk.
- (srec_write_terminator): Pass NULL instead of dummy buffer.
- (srec_write_symbols): Pass file and symbol names directly to
- bfd_bwrite so sprintf won't overflow buffer.
-
-2002-04-03 Jakub Jelinek <jakub@redhat.com>
-
- * elf32-sparc.c (elf32_sparc_relocate_section): Don't emit dynamic
- PC relative relocs against hidden symbols.
- * elf64-sparc.c (sparc64_elf_relocate_section): Likewise.
-
-2002-04-03 Alan Modra <amodra@bigpond.net.au>
-
- * elf.c (_bfd_elf_make_section_from_shdr): When setting section
- LMAs, loop over segments until p_vaddr and p_memsz specify an
- extent enclosing the section.
-
-2002-04-02 Nick Clifton <nickc@cambridge.redhat.com>
-
- * ihex.c (ihex_write_object_contents): Do not allow records to
- cross a 64K boundary - wrap if necessary.
-
-2002-04-01 Nathan Williams <nathanw@wasabisystems.com>
-
- * elf.c (elfcore_netbsd_get_lwpid): Fix off-by-one error
- which caused the returned LWP ID to always be 0.
-
-2002-04-01 Richard Henderson <rth@redhat.com>
-
- * elf32-sparc.c (WILL_CALL_FINISH_DYNAMIC_SYMBOL): New.
- (elf32_sparc_relocate_section): Use it to figure out when to
- initialize .got entries.
- * elf64-sparc.c: Similarly.
-
-2002-03-28 Alan Modra <amodra@bigpond.net.au>
-
- * linker.c (link_action): Ignore duplicate warning syms.
- (_bfd_generic_link_write_global_symbol): Follow warning symbol link.
- * elflink.h (elf_adjust_dynstr_offsets): Likewise.
- (elf_adjust_dynamic_symbol): Likewise.
- (elf_export_symbol): Likewise.
- (elf_link_find_version_dependencies): Likewise.
- (elf_link_assign_sym_version): Likewise.
- (elf_link_sec_merge_syms): Likewise.
- (elf_link_output_extsym): Likewise.
- (elf_gc_sweep_symbol): Likewise.
- (elf_gc_propagate_vtable_entries_used): Likewise.
- (elf_gc_smash_unused_vtentry_relocs): Likewise.
- (elf_gc_allocate_got_offsets): Likewise.
- (elf_collect_hash_codes): Likewise.
- * elflink.c (elf_link_renumber_hash_table_dynsyms): Likewise.
- * elf-hppa.h (elf_hppa_unmark_useless_dynamic_symbols): Likewise.
- (elf_hppa_remark_useless_dynamic_symbols): Likewise.
- * elf-m10300.c (elf32_mn10300_finish_hash_table_entry): Likewise.
- * elf32-arm.h (elf32_arm_discard_copies): Likewise.
- * elf32-cris.c (elf_cris_adjust_gotplt_to_got): Likewise.
- (elf_cris_discard_excess_dso_dynamics): Likewise.
- * elf32-hppa.c (clobber_millicode_symbols): Likewise.
- (mark_PIC_calls): Likewise.
- (allocate_plt_static): Likewise.
- (allocate_dynrelocs): Likewise.
- (readonly_dynrelocs): Likewise.
- * elf32-i386.c (allocate_dynrelocs): Likewise.
- (readonly_dynrelocs): Likewise.
- * elf32-i370.c (i370_elf_adjust_dynindx): Likewise.
- * elf32-m68k.c (elf_m68k_discard_copies): Likewise.
- * elf32-mips.c (mips_elf_output_extsym): Likewise.
- (mips_elf_sort_hash_table_f): Likewise.
- (mips_elf_check_mips16_stubs): Likewise.
- * elf32-s390.c (allocate_dynrelocs): Likewise.
- (readonly_dynrelocs): Likewise.
- * elf32-sh.c (sh_elf_discard_copies): Likewise.
- * elf32-xstormy16.c (xstormy16_relax_plt_check): Likewise.
- (xstormy16_relax_plt_realloc): Likewise.
- * elf64-alpha.c (elf64_alpha_calc_got_offsets_for_symbol): Likewise.
- (elf64_alpha_output_extsym): Likewise.
- * elf64-hppa.c (elf64_hppa_mark_exported_functions): Likewise.
- * elf64-mips.c (mips_elf64_sort_hash_table_f): Likewise.
- (mips_elf64_check_mips16_stubs): Likewise.
- (mips_elf64_output_extsym): Likewise.
- * elf64-ppc.c (func_desc_adjust): Likewise.
- (allocate_dynrelocs): Likewise.
- (readonly_dynrelocs): Likewise.
- * elf64-s390.c (allocate_dynrelocs): Likewise.
- (readonly_dynrelocs): Likewise.
- * elf64-sh64.c (sh64_elf64_discard_copies): Likewise.
- * elf64-x86-64.c (allocate_dynrelocs): Likewise.
- (readonly_dynrelocs): Likewise.
- * elfxx-ia64.c (elfNN_ia64_global_dyn_sym_thunk): Likewise.
- * aoutx.h (aout_link_write_other_symbol): Likewise.
- * cofflink.c (_bfd_coff_write_task_globals): Likewise.
- (_bfd_coff_write_global_sym): Likewise.
- * i386linux.c (linux_tally_symbols): Likewise.
- * m68klinux.c (linux_tally_symbols): Likewise.
- * sparclinux.c (linux_tally_symbols): Likewise.
- * pdp11.c (aout_link_write_other_symbol): Likewise.
- * sunos.c (sunos_scan_dynamic_symbol): Likewise.
- * xcofflink.c (xcoff_build_ldsyms): Likewise.
- (xcoff_write_global_symbol): Likewise.
-
- * cofflink.c (_bfd_coff_final_link): Formatting.
- * cpu-mips.c (mips_compatible): Make static, prototype.
- * elf32-i386.c (elf_i386_check_relocs): Formatting.
- * elf32-sh.c (sh_elf_size_dynamic_sections): Likewise.
- * elf64-alpha.c (elf64_alpha_output_extsym): Likewise.
- * elf64-mips.c (mips_elf64_sort_hash_table): Likewise.
- (mips_elf64_final_link): Likewise.
- * elflink.h (elf_link_find_version_dependencies): Remove duplicate
- prototype.
-
-2002-03-27 Nick Clifton <nickc@cambridge.redhat.com>
-
- * coff-arm.c (SWAP_IN_RELOC_OFFSET): Define.
- (SWAP_OUT_RELOC_OFFSET): Define.
-
-2002-03-27 Gregory Steuck <greg@nest.cx>
-
- * elf.c (_bfd_elf_get_symtab_upper_bound): Leave space for
- terminating NULL if empty symbol table.
- (_bfd_elf_get_dynamic_symtab_upper_bound): Likewise.
-
-2002-03-26 H.J. Lu (hjl@gnu.org)
-
- * elflink.h (elf_link_input_bfd): Revert the last change since
- the gcc exception handling isn't fixed yet.
-
-2002-03-26 H.J. Lu (hjl@gnu.org)
-
- * elflink.h (elf_link_input_bfd): Complain about relocations
- against local symbols in discarded sections.
-
-2002-03-26 Alan Modra <amodra@bigpond.net.au>
-
- * elflink.h (elf_gc_mark): Don't recurse into non-ELF sections.
-
-2002-03-23 Alan Modra <amodra@bigpond.net.au>
-
- * elf.c (_bfd_elf_make_section_from_shdr): Don't set lma based on
- section file offset for !SEC_LOAD sections.
-
-2002-03-21 Richard Earnshaw <rearnsha@arm.com>
-
- * elf32-arm.h (elf32_arm_final_link_relocate <case R_ARM_GOTOFF>,
- <case R_ARM_GOT>): Handle relocations to Thumb functions.
-
-2002-03-21 Alan Modra <amodra@bigpond.net.au>
-
- * coff64-rs6000.c (_bfd_xcoff64_put_symbol_name): Prototype.
- Whitespace changes.
- * archive.c: Update copyright date.
* bfd-in2.h: Regenerate.
- * libbfd.h: Regenerate.
- * Makefile.am: Run "make dep-am"
- * Makefile.in: Regenerate.
- * po/SRC-POTFILES.in: Regenerate.
-
-2002-03-20 Daniel Jacobowitz <drow@mvista.com>
-
- * dwarf2.c (struct funcinfo): Move up.
- (lookup_address_in_function_table): New argument function_ptr.
- Set it.
- (lookup_address_in_line_table): New argument function. If function
- is non-NULL, use it to handle ``addr'' before the first line note of
- the function.
- (comp_unit_find_nearest_line): Update and swap calls to
- lookup_address_in_function_table and lookup_address_in_line_table.
- * syms.c (_bfd_stab_section_find_nearest_line): Use the first
- N_SLINE encountered if we see an N_FUN before any N_SLINE.
-
-2002-03-20 Tom Rix <trix@redhat.com>
-
- * coff-rs6000.c (_bfd_xcoff_stat_arch_elt): Renamed from
- _bfd_xcoff_generic_stat_arch_elt. Fix format check.
- * coff64-rs6000.c : Use _bfd_xcoff_stat_arch_elt.
-
-2002-03-19 Tom Rix <trix@redhat.com>
-
- * xcofflink.c (_bfd_xcoff_bfd_link_add_symbols): Look through all
- dynamic objects in archives.
-
-2002-03-19 Hans-Peter Nilsson <hp@bitrange.com>
-
- * elflink.h (NAME(bfd_elf,record_link_assignment)): Don't set
- STT_NOTYPE symbols to STT_OBJECT.
-
-2002-03-18 Jan Hubicka <jh@suse.cz>
-
- * cpu-i386.c (bfd_x86_64_arch): Rename to "i386:x86-64"
-
-2002-03-18 Tom Rix <trix@redhat.com>
-
- * aix5ppc.core.c : New file for AIX 5 64 bit core support.
- * bfd-in.h : Add bfd_xcoff_ar_archive_set_magic declaration.
- * coff-rs6000 (do_pad) : New function for archive padding.
- (do_copy) : New function for object file copying in archives.
- (do_shared_object_padding) : New function for padding shared
- objects to their text section alignment in archives.
- (bfd_xcoff_ar_achive_set_magic) : Stub.
- (xcoff_write_armap_big) : Use do_copy and do_pad.
- (xcoff_write_archive_contents_big) : Use do_shared_object_padding,
- do_copy and do_pad.
- * coff64-rs6000.c (xcoff64_write_ojbect_contents) : Use
- bfd_xcoff_magic_number.
- (xcoff64_bad_format_hook) : New function for _bfd_bad_format_hook
- fop.
- (xcoff_backend_data_r) : Use xcoff64_bad_format_hook.
- (bfd_xcoff_aix5_backend_data) : New Aix 5 backend data.
- (aix5coff64_vec) : New Aix 5 target aix5coff64-rs6000.
- * rs6000-core.c : Update copyright date.
- * xcofflink.c (bfd_xcoff_size_dynamic_sections): Check for NULL
- csectpp.
- * coffcode.h (coff_new_section_hook) : Use new accessor macros.
- (coff_set_arch_mach_hook) : Add Aix 5 U64_TOCMAGIC magic #.
- (coff_set_flags) : Use bfd_xcoff_magic_number.
- * libxcoff.h (bfd_xcoff_is_xcoff64): Add U64_TOCMAGIC.
- * configure.in : Add powerpc-*-aix5 and rs6000-*-aix5 support.
- * Makefile.am : Same.
- * config.bfd : Same.
- * targets.c : Same.
- * configure : Regnerate.
- * Makefile.in : Same.
- * bfd-in2.h : Same.
-
-2002-03-18 Nick Clifton <nickc@cambridge.redhat.com>
-
- * po/fr.po: Updated version.
-
-2002-03-18 Alan Modra <amodra@bigpond.net.au>
-
- * libbfd.c (bfd_write_bigendian_4byte_int): Return true iff success.
- * libbfd.h: Regenerate.
- * archive.c (coff_write_armap): Pass on failures from
- bfd_write_bigendian_4byte_int.
-
-2002-03-14 H.J. Lu <hjl@gnu.org>
-
- * elflink.h (NAME(bfd_elf,size_dynamic_sections)): Set the BFD
- error to bfd_error_nonrepresentable_section for reinit_array
- section in DSO.
-
-2002-03-14 Nick Clifton <nickc@cambridge.redhat.com>
-
- * coffcode.h (coff_slurp_symbol_table): When adding BSF_WEAK flag,
- OR it in rather than replacing previously selected flags.
-
- * elfxx-target.h (TARGET_BIG_SYM): Set ar_max_namelen to 15.
- (TARGET_LITTLE_SYM): Set ar_max_namelen to 15.
-
-2002-03-14 Alan Modra <amodra@bigpond.net.au>
-
- * cpu-mips.c (mips_compatible): New. Don't check bits_per_word.
- (N): Use the above.
- * elflink.h (elf_bfd_final_link): Revert last change. Instead,
- ensure reloc size matches before calling elf_link_input_bfd.
- Add an assert to check reloc size when counting output relocs.
-
-2002-03-14 Nick Clifton <nickc@cambridge.redhat.com>
-
- * mmo.c (mmo_get_loc): Return NULL rather than false.
-
-2002-03-13 Nick Clifton <nickc@cambridge.redhat.com>
-
- * po/fr.po: Updated version.
-
-2002-03-13 Alan Modra <amodra@bigpond.net.au>
-
- * archures.c (bfd_default_compatible): Test bits_per_word.
- * cpu-i386.c (i386_compatible): Remove. Replace occurrences with
- bfd_default_compatible.
- * cpu-i370.c (i370_compatible): Likewise.
- * cpu-sparc.c (sparc_compatible): Likewise.
- * cpu-h8300.c (compatible): Test in->arch == out->arch.
-
- * elflink.h: Formatting fixes.
- (elf_link_output_extsym): Merge undefined and undef weak cases.
-
- * elflink.h (elf_bfd_final_link): Only call elf_link_input_bfd
- when word size of input matches output word size.
-
-2002-03-12 Andreas Jaeger <aj@suse.de>
-
- * cpu-i386.c (i386_compatible): New. Use it instead of
- bfd_default_compatible.
-
-2002-03-07 H.J. Lu (hjl@gnu.org)
-
- * coff-sh.c (shcoff_reloc_map): Use bfd_reloc_code_real_type
- as the type for bfd_reloc_val.
-
-2002-03-05 John David Anglin <dave@hiauly1.hia.nrc.ca>
-
- * elf-hppa.h (elf_hppa_is_dynamic_loader_symbol): New function.
- (elf_hppa_relocate_section): Ignore undefined dynamic loader symbols.
- (elf_hppa_final_link_relocate): Correct relocations for indirect
- references to local data through the DLT. Fix .opd creation for
- local symbols using R_PARISC_LTOFF_FPTR32 and R_PARISC_FPTR64
- relocations. Use e_lsel selector for R_PARISC_DLTIND21L,
- R_PARISC_LTOFF_FPTR21L and R_PARISC_LTOFF_TP21L as per
- "Processor-Specific ELF for PA_RISC, Version 1.43" document.
- Similarly, use e_rsel for DLT and LTOFF 'R' relocations.
- * elf32-hppa.c (final_link_relocate): Revise relocation selectors
- as per "Processor-Specific ELF for PA_RISC, Version 1.43" document.
-
-2002-03-05 Jakub Jelinek <jakub@redhat.com>
-
- * merge.c (_bfd_merge_sections): Don't segfault if there
- is nothing to merge due to GC.
-
-2002-03-05 Alan Modra <amodra@bigpond.net.au>
- * elf32-hppa.c (clobber_millicode_symbols): Remove hack to keep
- symbols that have been forced local.
-
- * elflink.h (elf_bfd_final_link): Call elf_link_output_extsym
- to output forced local syms for non-shared link.
- (elf_link_output_extsym): Tweak condition for calling backend
- adjust_dynamic_symbol so that previous behaviour is kept.
- Whitespace changes throughout file.
-
-2002-03-04 H.J. Lu <hjl@gnu.org>
-
- * elf.c (bfd_section_from_shdr): Handle special sections,
- .init_array, .fini_array and .preinit_array.
- (elf_fake_sections): Likewise.
-
- * elflink.h (NAME(bfd_elf,size_dynamic_sections)): Create the
- DT entry only if the section is in output for .init_array,
- .fini_array and .preinit_array. Complain about .preinit_array
- section in DSO.
- (elf_bfd_final_link): Warn zero size for .init_array,
- .fini_array and .preinit_array sections.
-
- * elfxx-ia64.c (elfNN_ia64_section_from_shdr): Remove
- SHT_INIT_ARRAY, SHT_FINI_ARRAY and SHT_PREINIT_ARRAY.
- (elfNN_ia64_fake_sections): Remove .init_array, .fini_array and
- .preinit_array.
-
-2002-03-04 Alan Modra <amodra@bigpond.net.au>
-
- * configure.in (WIN32LIBADD): Don't eval PICFLAG assignment.
- * configure: Regenerate.
-
-2002-03-02 Tom Rix <trix@redhat.com>
-
- * coff64-rs6000.c (xcoff64_howto_table): Replace howto types with
- symbolic equiv.
- * coff-rs6000.c (xcoff_howto_table): Same.
-
-2002-03-01 David Mosberger <davidm@hpl.hp.com>
-
- * elflink.h (size_dynamic_sections): If section named
- ".preinit_array" exists, create DT_PREINIT_ARRAY and
- DT_PREINIT_ARRAYSZ entries in dynamic table. Analogously for
- ".init_array" and ".fini_array".
- (elf_bfd_final_link): Handle DT_PREINIT_ARRAYSZ, DT_INIT_ARRAYSZ,
- DT_FINI_ARRAYSZ, DT_PREINIT_ARRAY, DT_INIT_ARRAY, and
- DT_FINI_ARRAY.
-
-2002-02-26 Andrew Macleod <amacleod@cygnus.com>
-
- * elflink.h (elf_bfd_final_link): Don't crash on SHN_UNDEF local
- dynsyms.
-
-2002-02-25 Alan Modra <amodra@bigpond.net.au>
-
- * elf64-hppa.h: Update copyright date.
-
- * elf64-ppc.c (ppc64_elf_check_relocs): Warning fix.
- (ppc64_elf_relocate_section): Don't generate power4 style branch
- hints for *_BRTAKEN and *_BRNTAKEN relocs.
-
-2002-02-22 Jakub Jelinek <jakub@redhat.com>
-
- * elf64-sh64.c (sh_elf64_relocate_section): Fix a typo from my
- last patch.
- * elf64-x86-64.c (elf64_x86_64_relocate_section): Likewise.
-
-2002-02-21 Andreas Jaeger <aj@suse.de>
-
- * elf64-x86-64.c: Major rework that introduces all recent changes
- to the x86-64 backend. Get a closer match to elf32-i386.
- (struct elf64_x86_64_dyn_relocs): Rename from
- elf64_x86_64_pcrel_relocs_copied, add additional fields. Change
- all users.
- (struct elf64_x86_64_link_hash_table): Add short cuts to some
- sections.
- (link_hash_newfunc): Rename from elf64_x86_64_link_hash_newfunc,
- remove casts, initialize new hash members.
- (create_got_section): New.
- (elf64_x86_64_create_dynamic_sections): New.
- (elf64_x86_64_copy_indirect_symbol): New.
- (elf64_x86_64_check_relocs): Don't allocate space for dynamic
- relocs, .got or .relgot here but do it in allocate_dynrelocs.
- Reference count possible .plt and .got entries. Don't test input
- section SEC_READONLY here to try to avoid copy relocs, and keep
- dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set
- DF_TEXTREL here. Delay setting of variables until needed. Cache
- pointer to "sreloc" section in elf_section_data. Tweak condition
- under which .got created. Report files with bad relocation
- section names.
- (elf64_x86_64_gc_sweep_hook): Sweep dyn_relocs and local_dynrel.
- Reference count possible .plt entries. Don't deallocate .got and
- .relgot space here.
- (elf64_x86_64_adjust_dynamic_symbol): Handle nocopyreloc. Don't
- do copy reloc processing for weakdefs. Remove redundant casts and
- aborts. Delay setting of vars until needed. Move creation of
- dynamic symbols and allocation of .plt and .rela.plt to
- allocate_dynrelocs. Replace BFD_ASSERT with abort.
- (WILL_CALL_FINISH_DYNAMIC_SYMBOL): New.
- (allocate_dynrelocs): New.
- (readonly_dynrelocs): New.
- (elf64_x86_64_size_dynamic_sections): Call readonly_dynrelocs.
- Allocate space for dyn relocs. Replace BFD_ASSERT with abort.
- Zero out the dynamic allocated content space.
- (elf64_x86_64_discard_copies): Removed.
- (elf64_x86_64_relocate_section): Make use of dynamic section
- short-cuts. Localise vars, and delay setting. Better error
- reporting, replace BFD_ASSERT with abort. Check
- ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the
- regular object file and tread the weak definition as the normal
- one. Don't discard relocs for undefweak or undefined symbols and
- check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy
- relocs.
- (elf64_x86_64_finish_dynamic_symbol): Don't copy relocs for
- symbols that have been forced local. Use same test to decide if
- we can use a relative reloc for got as relocate_section. Expand
- SHN_UNDEF comment. Move expressions out of function calls.
- Replace BFD_ASSERT with abort.
- (bfd_elf64_bfd_final_link): Removed.
- (elf_backend_copy_indirect_symbol): Define.
-
-2002-02-20 Tom Rix <trix@redhat.com>
-
- * coff-rs6000.c (xcoff_howto_table): Add 16 bit R_BA.
- (_bfd_xcoff_reloc_type_lookup): Use it.
- * coff64-rs6000.c (xcoff64_howto_table): Same.
- (xcoff64_reloc_type_lookup): Same.
-
-2002-02-20 Peter Schauer <pes@regent.e-technik.tu-muenchen.de>
-
- * osf-core.c (osf_core_vec): OSF/1 (Digital Unix) core files are
- little endian.
-
-2002-02-19 Martin Schwidefsky <schwidefsky@de.ibm.com>
-
- * archures.c (bfd_mach_s390_esa): Rename to bfd_mach_s390_31.
- (bfd_mach_s390_esame): Rename to bfd_mach_s390_64.
- * bfd-in2.h: Regenerate.
- * cpu-s390.c (arch_info_struct): Use renamed architecture defines.
- Replace architecture name "s390" with "s390:31-bit" and "s390:esame"
- with "s390:64-bit".
- * elf32-s390.c (elf_howto_table): Add 32 bit pc relative relocations.
- (elf_s390_reloc_type_lookup): Likewise.
- (elf_s390_check_relocs): Likewise.
- (elf_s390_gc_sweep_hook): Likewise.
- (elf_s390_relocate_section): Likewise.
- (elf_s390_object_p): Use renamed architecture define.
- * elf64-s390.c (elf_s390_object_p): Use renamed architecture define.
-
-2002-02-19 Frank Ch. Eigler <fche@redhat.com>
-
- * syms.c (stt[]): Sorted. Added .init/.fini -> "t" mapping.
-
-2002-02-19 Jakub Jelinek <jakub@redhat.com>
-
- * elf-eh-frame.c (_bfd_elf_discard_section_eh_frame): Enable
- absptr -> pcrel optimization for shared libs.
- Only create minimal .eh_frame_hdr if absptr FDE encoding in shared
- library cannot be converted to pcrel.
- (_bfd_elf_eh_frame_section_offset): Return -2 if making absptr
- relative.
- * elf32-i386.c (elf_i386_relocate_section): If
- _bfd_elf_section_offset returned -2, skip, but make sure the
- relocation is installed.
- * elf32-arm.h (elf32_arm_final_link_relocate): Likewise.
- * elf32-cris.c (cris_elf_relocate_section): Likewise.
- * elf32-hppa.c (elf32_hppa_relocate_section): Likewise.
- * elf32-i370.c (i370_elf_relocate_section): Likewise.
- * elf32-m68k.c (elf_m68k_relocate_section): Likewise.
- * elf32-ppc.c (ppc_elf_relocate_section): Likewise.
- * elf32-s390.c (elf_s390_relocate_section): Likewise.
- * elf32-sh.c (sh_elf_relocate_section): Likewise.
- * elf32-sparc.c (elf32_sparc_relocate_section): Likewise.
- * elf64-ppc.c (ppc64_elf_relocate_section): Likewise.
- * elf64-s390.c (elf_s390_relocate_section): Likewise.
- * elf64-sh64.c (sh_elf64_relocate_section): Likewise.
- * elf64-sparc.c (sparc64_elf_relocate_section): Likewise.
- * elf64-x86-64.c (elf64_x86_64_relocate_section): Likewise.
- * elf64-alpha.c (elf64_alpha_relocate_section): Handle
- _bfd_elf_section_offset returning -2 the same way as -1.
- * elfxx-ia64.c (elfNN_ia64_install_dyn_reloc): Likewise.
- * elf32-mips.c (mips_elf_create_dynamic_relocation): Add FIXME
- and BFD_ASSERT.
- * elf64-mips.c (mips_elf64_create_dynamic_relocation): Likewise.
-
-2002-02-18 Tom Rix <trix@redhat.com>
-
- * xcofflink.c (bfd_xcoff_link_gernate_rtinit): Add -brtl support.
- (bfd_xcoff_size_dynamic_sections): Same.
- * bfd-in.h (bfd_xcoff_link_generate_rtinit): Same.
- (bfd_xcoff_size_dynamic_sections): Same.
- * coff-rs6000.c (xcoff_generate_rtinit): Same.
- * coff-rs646000.c (xcoff64_generate_rtinit): Same.
- * libxcoff.h (struct xcoff_backend_data_rec): Same.
- * xcofflink.c (xcoff_build_ldsyms, xcoff_link_add_symbols): Clean.
+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.
-2002-02-18 Alan Modra <amodra@bigpond.net.au>
+2004-03-15 Matt Thomas <matt@3am-software.com>
- * elf64-ppc.c (STFD_FR0_0R1, LFD_FR0_0R1, BLR): Define.
- (struct ppc_link_hash_table): Add sfpr.
- (ppc64_elf_link_hash_table_create): Init it.
- (ppc64_elf_create_dynamic_sections): Split creation of .stub and
- .glink out to..
- (create_linkage_sections): ..here. Make .sfpr too.
- (ppc64_elf_check_relocs): Call create_linkage_sections, and set
- dynobj early.
- (MIN_SAVE_FPR, MAX_SAVE_FPR): Define.
- (ppc64_elf_func_desc_adjust): Look for missing ._savef* and
- ._restf* functions, and create as needed.
- (func_desc_adjust): Only force_local for shared libs.
+ * config.bfd: Add x86-64 vector to NetBSD/i386 if 64bit BFD is
+ selected.
-2002-02-18 David O'Brien <obrien@FreeBSD.org>
+2004-03-13 Mark Kettenis <kettenis@gnu.org>
- * configure.in: Bump version number post 2.12 branching.
+ * config.bfd: Add x86_64-*-openbsd*.
+ * configure.in (x86_64-*-openbsd*): Set COREFILE to
+ netbsd-core.lo.
* configure: Regenerate.
-2002-02-17 Hans-Peter Nilsson <hp@bitrange.com>
-
- * mmo.c: Correct and improve comments.
- (mmo_write_chunk): Store trailing byte in bfd buffer; don't
- zero-pad. Use input to fill up non-empty bfd buffer.
- (mmo_flush_chunk): New function.
- (mmo_write_loc_chunk): Add parameter last_vmap, all callers
- changed. Don't emit location specifier if VMA is same as
- *LAST_VMAP after omitting leading zero contents. Call
- mmo_flush_chunk before emitting location specifier.
- (mmo_write_loc_chunk_list): Call mmo_flush_chunk when finished
- with mmo_write_loc_chunk calls.
- (mmo_internal_write_section): Call mmo_flush_chunk after
- mmo_write_chunk.
- (mmo_write_symbols_and_terminator): Move :Main to first position
- in symbol array. Add faked one if it does not exist if there are
- other symbols. Don't add it if there are no symbols at all. Move
- out test for value of :Main from symbol loop. Rename table
- fakemain to maintable and variable mainsym to fakemain.
-
-2002-02-15 Richard Henderson <rth@redhat.com>
+2004-03-09 Steve Ellcey <sje@cup.hp.com>
- * elf64-alpha.c (elf64_alpha_relocate_section) [BRSGP]: A target
- section with no got matches any got. Simplify error generaion.
+ * elfxx-ia64.c (plt_full_entry): Change ld8 to ld8.acq.
-2002-02-15 Alan Modra <amodra@bigpond.net.au>
+2004-03-05 Nathan Sidwell <nathan@codesourcery.com>
- Support arbitrary length fill patterns.
- * linker.c (bfd_new_link_order): Zero all fields with bfd_zalloc.
- (_bfd_default_link_order): Remove bfd_fill_link_order code.
- Call default_data_link_order.
- (default_fill_link_order): Delete.
- (default_data_link_order): New function.
- * elf32-mips.c (_bfd_mips_elf_final_link): Replace occurrences
- of bfd_fill_link_order with bfd_data_link_order.
- * elf64-alpha.c (elf64_alpha_final_link): Likewise.
- * elf64-mips.c (mips_elf64_final_link): Likewise.
+ * elf.c (map_sections_to_segments): Ignore .tbss sections for
+ layout purposes.
- * bfd.c (bfd_scan_vma): Clamp overflows to max bfd_vma value.
- Correct value returned in "end" for "0x<non-hex>".
-
-2002-02-14 Nick Clifton <nickc@cambridge.redhat.com>
-
- * cpu-arm.c (processors): Replace 'arch' field with 'mach'.
- (scan): Test against 'mach' field in info structure.
-
-2002-02-14 Alan Modra <amodra@bigpond.net.au>
-
- * elf.c (elf_fake_sections): Use SHT_NOBITS when SEC_NEVER_LOAD.
-
-2002-02-14 Matt Fredette <fredette@netbsd.org>
-
- * elf32-m68k.c (elf32_m68k_print_private_bfd_data): Recognize
- EF_M68000.
-
-2002-02-13 Nick Clifton <nickc@cambridge.redhat.com>
-
- * elf.c (_bfd_elf_make_section_from_shdr): Do not insist on
- non-zero physical addresses when adjusting the LMAs of new
- sections.
-
-2002-02-12 John David Anglin <dave@hiauly1.hia.nrc.ca>
-
- * elf-hppa.h (elf_hppa_reloc_final_type): New function stripped
- from _bfd_elf_hppa_gen_reloc_type.
- (_bfd_elf_hppa_gen_reloc_type): Remove duplicate prototype.
- * elf32-hppa.h (elf32_hppa_reloc_final_type): Add protptype.
- * elf32-hppa.c: Include elf32-hppa.h before elf-hppa.h.
- * elf64-hppa.h (elf64_hppa_reloc_final_type): Add protptype.
-
-2002-02-12 Alexandre Oliva <aoliva@redhat.com>
-
- * elf-m10300.c (mn10300_elf_relax_section): Skip section before
- loading its contents if there's nothing to do in it.
-
-2002-02-12 Alan Modra <amodra@bigpond.net.au>
-
- * elf64-ppc.c (ppc64_elf_size_stubs): Correct test for crossing
- 64k boundary.
-
- * elf64-ppc.c (ppc64_elf_size_dynamic_sections): Add dynamic
- DT_PPC64_OPD and DT_PPC64_OPDSZ tags.
- (ppc64_elf_finish_dynamic_sections): Set values for them.
-
-2002-02-11 Michael Snyder <msnyder@redhat.com>
-
- * elf-bfd.h (elfcore_write_lwpstatus): Add prototype.
- * elf.c (elfcore_grok_pstatus): Add prototype.
- (elfcore_grok_lwpstatus): Add prototype.
- (elfcore_write_lwpstatus): New function.
- (elfcore_write_pstatus): Fix typo, eliminate unnecessary memcpy.
-
-2002-02-11 Alexandre Oliva <aoliva@redhat.com>
-
- * elf32-sh.c: Added missing prototypes.
- * elf32-sh64.c: Likewise.
- (sh_elf_align_loads): Mark unused args as such.
- * elf64-sh64.c: Added missing prototypes.
- (struct elf_sh64_link_hash_entry): Fix typo.
- (sh_elf64_relocate_section): Fix info argument passed to
- _bfd_elf_section_offset.
-
-2002-02-11 Alan Modra <amodra@bigpond.net.au>
-
- * Makefile.am: "make dep-am".
- * Makefile.in: Regenerate.
- * aclocal.m4: Regenerate.
- * config.in: Regenerate.
- * configure: Regenerate.
-
-2002-02-10 Daniel Jacobowitz <drow@mvista.com>
-
- * coff-rs6000.c (xcoff_generate_rtinit): Silence uninitialized
- variable warnings.
- * elf32-sh.c (sh_elf_relax_section): Silence signed/unsigned
- comparison warning.
- * trad-core.c (trad_unix_core_file_p): Silence pointer/integer
- cast warnings for the common case.
-
-2002-02-10 Hans-Peter Nilsson <hp@bitrange.com>
-
- * config.bfd (sh-*-linux*, sh-*-elf* | sh-*-rtemself*): Add sh64
- vectors.
- (sh-*-netbsdelf*): New, to trump sh*-*-netbsdelf* and add sh64
- vectors.
-
-2002-02-09 Richard Henderson <rth@redhat.com>
-
- * elf64-alpha.c (elf64_alpha_howto): Add R_ALPHA_BRSGP.
- (elf64_alpha_reloc_map, elf64_alpha_check_relocs): Likewise.
- (elf64_alpha_relocate_section): Likewise.
- * reloc.c (BFD_RELOC_ALPHA_BRSGP): New.
- * bfd-in2.h, libbfd.h: Rebuild.
-
-2002-02-09 Hans-Peter Nilsson <hp@bitrange.com>
-
- * elf64-mmix.c (_bfd_mmix_finalize_linker_allocated_gregs): Check
- that base-plus-offset reloc accounting is consistent.
- (mmix_elf_relax_section): Keep base-plus-offset reloc accounting
- up to date for undefined symbols.
-
-2002-02-08 Eric Christopher <echristo@redhat.com>
-
- From Rainer Orth <ro@TechFak.Uni-Bielefeld.DE>
-
- * elf32-mips.c (_bfd_mips_elf_fake_sections): Don't create .rela
- sections for the O32 ABI.
-
-2002-02-08 Chris Demetriou <cgd@broadcom.com>
-
- * elf32-arm.h: Fix formatting of _("...").
- * elf32-d10v.c: Likewise.
- * elf32-m68k.c: Likewise.
- * elf32-mips.c: Likewise.
-
-2002-02-08 Ivan Guzvinec <ivang@opencores.org>
-
- * coff-or32.c: Fix compile time warning messages.
-
-2002-02-08 Alexandre Oliva <aoliva@redhat.com>
-
- Contribute sh64-elf.
- 2002-01-23 Alexandre Oliva <aoliva@redhat.com>
- * reloc.c (R_SH_GOTPLT32, R_SH_GOT_LOW16, R_SH_GOT_MEDLOW16,
- R_SH_GOT_MEDHI16, R_SH_GOT_HI16, R_SH_GOTPLT_LOW16,
- R_SH_GOTPLT_MEDLOW16, R_SH_GOTPLT_MEDHI16, R_SH_GOTPLT_HI16,
- R_SH_PLT_LOW16, R_SH_PLT_MEDLOW16, R_SH_PLT_MEDHI16,
- R_SH_PLT_HI16, R_SH_GOTOFF_LOW16, R_SH_GOTOFF_MEDLOW16,
- R_SH_GOTOFF_MEDHI16, R_SH_GOTOFF_HI16, R_SH_GOTPC_LOW16,
- R_SH_GOTPC_MEDLOW16, R_SH_GOTPC_MEDHI16, R_SH_GOTPC_HI16,
- R_SH_GOT10BY4, R_SH_GOTPLT10BY4, R_SH_GOT10BY8, R_SH_GOTPLT10BY8,
- R_SH_COPY64, R_SH_GLOB_DAT64, R_SH_JMP_SLOT64, R_SH_RELATIVE64):
- New relocs.
- * libbfd.h, bfd-in2.h: Rebuilt.
- * elf32-sh.c (sh_elf_howto_table): Define new relocs.
- (sh_reloc_map): Map them.
- (PLT_ENTRY_SIZE, elf_sh_plt0_entry_be, elf_sh_plt0_entry_le,
- elf_sh_plt_entry_be, elf_sh_plt_entry_le, elf_sh_pic_plt_entry_be,
- elf_sh_pic_plt_entry_le, elf_sh_plt0_entry, elf_sh_plt_entry,
- elf_sh_pic_plt_entry, elf_sh_sizeof_plt, elf_sh_plt_plt0_offset,
- elf_sh_plt0_gotplt_offset, elf_sh_plt_temp_offset,
- elf_sh_plt_symbol_offset, elf_sh_plt_reloc_offset,
- movi_shori_putval) [INCLUDE_SHMEDIA]: New.
- (elf_sh_link_hash_entry) [INCLUDE_SHMEDIA]: Add
- datalabel_got_offset.
- (sh_elf_link_hash_newfunc): Initialize it.
- (sh_elf_relocate_section): Augment the scope of
- seen_stt_datalabel. Introduce GOTPLT support. Extend GOTPC, PLT,
- GOT and GOTOFF handling to new SHmedia relocation types. Support
- GOT_BIAS.
- (sh_elf_check_relocs): Likewise.
- (sh_elf_finish_dynamic_symbol) [TARGET_SHMEDIA]: Set up values in
- PLT entries using movi_shori_putval. Support GOT_BIAS.
- (sh_elf_finish_dynamic_sections): Likewise.
- * elf32-sh64.c (shmedia_prepare_reloc): Do not add addend to
- relocation, it's now done by the caller.
- (GOT_BIAS): New.
- * elf64-sh64.c (GOT_BIAS, PLT_ENTRY_SIZE, elf_sh64_sizeof_plt,
- elf_sh64_plt_plt0_offset, elf_sh64_plt0_gotplt_offset,
- elf_sh64_plt_temp_offset, elf_sh64_plt_symbol_offset,
- elf_sh64_plt_reloc_offset, ELF_DYNAMIC_INTERPRETER,
- elf_sh64_pcrel_relocs_copied, elf_sh64_link_hash_entry,
- elf_sh64_link_hash_table, sh64_elf64_link_hash_traverse,
- sh64_elf64_hash_table): New.
- (sh_elf64_howto_table): Introduce new relocs.
- (sh_elf64_info_to_howto): Accept new PIC relocs.
- (sh_elf64_relocate_section): Augment the scope of
- seen_stt_datalabel. Support new PIC relocs.
- (sh_elf64_check_relocs): Support new PIC relocs.
- (elf_sh64_plt0_entry_be, elf_sh64_plt0_entry_le,
- elf_sh64_plt_entry_be, elf_sh64_plt_entry_le,
- elf_sh64_pic_plt_entry_be, elf_sh64_pic_plt_entry_le,
- elf_sh64_plt0_entry, elf_sh64_plt_entry, elf_sh64_pic_plt_entry,
- sh64_elf64_link_hash_newfunc, sh64_elf64_link_hash_table_create,
- movi_shori_putval, movi_3shori_putval,
- sh64_elf64_create_dynamic_sections,
- sh64_elf64_adjust_dynamic_symbol, sh64_elf64_discard_copies,
- sh64_elf64_size_dynamic_sections,
- sh64_elf64_finish_dynamic_symbol,
- sh64_elf64_finish_dynamic_sections): New.
- (elf_backend_create_dynamic-sections,
- bfd_elf64_bfd_link_hash_table_create,
- elf_backend_adjust_dynamic_symbol,
- elf_backend_size_dynamic_sections,
- elf_backend_finish_dynamic_symbol,
- elf_backend_finish_dynamic_sections, elf_backend_want_got_plt,
- elf_backend_plt_readonly, elf_backend_want_plt_sym,
- elf_backend_got_header_size, elf_backend_plt_header_size):
- Define.
- 2001-05-16 Alexandre Oliva <aoliva@redhat.com>
- * elf32-sh.c: Renumbered and renamed some SH5 relocations to
- match official numbers and names; moved unmaching ones to the
- range 0xf2-0xff.
- * elf32-sh64.c, elf64-sh64.c: Likewise.
- 2001-03-12 DJ Delorie <dj@redhat.com>
- * elf32-sh.c (sh_elf_relax_section): Don't relax SHmedia
- sections.
- 2001-03-12 DJ Delorie <dj@redhat.com>
- * elf32-sh64.c (shmedia_prepare_reloc): Validate relocs that must
- be aligned.
- * elf64-sh64.c (sh_elf64_relocate_section): Ditto.
- 2001-01-14 Hans-Peter Nilsson <hpn@cygnus.com>
- * elf32-sh64.c (bfd_elf32_bfd_copy_private_section_data): Define.
- (sh64_elf_fake_sections): Set type to SHT_SH5_CR_SORTED for a
- .cranges section with SEC_SORT_ENTRIES set.
- (sh64_backend_section_from_shdr): Set SEC_SORT_ENTRIES on an
- incoming sorted .cranges section.
- (sh64_bfd_elf_copy_private_section_data): New.
- (sh64_elf_final_write_processing): Only sort .cranges and modify
- start address if called by linker.
- 2001-01-08 Ben Elliston <bje@redhat.com>
- * elf32-sh64.c (sh64_elf_final_write_processing): Activate
- Hans-Peter Nilsson's set bit 0 patch from 2001-01-06.
- * elf64-sh64.c (sh64_elf64_final_write_processing): Ditto.
- 2001-01-06 Hans-Peter Nilsson <hpn@cygnus.com>
- * elf64-sh64.c (sh_elf64_howto_table): No open brace at start of
- line. Add comments before all entries.
- <R_SH_PT_16, R_SH_SHMEDIA_CODE>: Correct and clarify describing
- comment.
- (sh_elf64_reloc): Correct head comment.
- (sh_elf64_relocate_section): Correct spacing.
- <relocating for a local symbol>: Do not honour STO_SH5_ISA32;
- instead call reloc_dangerous callback.
- <case R_SH_SHMEDIA_CODE>: New case.
- (sh_elf64_gc_mark_hook): Correct spacing.
- (sh_elf64_check_relocs): Ditto.
- * elf32-sh64.c (shmedia_prepare_reloc) <case R_SH_SHMEDIA_CODE>:
- New case.
- * elf32-sh.c: Correct #endif comments for #ifndef-wrapped
- functions.
- (sh_elf_howto_table) <R_SH_PT_16, R_SH_SHMEDIA_CODE>: Correct,
- clarify describing comment. Add comments before all entries.
- (sh_elf_relocate_section) <relocating for a local symbol>: Do not
- honour STO_SH5_ISA32; instead call reloc_dangerous callback.
- 2001-01-06 Hans-Peter Nilsson <hpn@cygnus.com>
- Sort .cranges section in final link. Prepare to set bit 0 on
- entry address.
- * elf32-sh64.c (struct sh64_find_section_vma_data): New.
- (sh64_elf_link_output_symbol_hook): Fix typo in prototype.
- (sh64_elf_set_mach_from_flags): Set SEC_DEBUGGING on incoming
- .cranges section.
- (sh64_backend_section_from_shdr): New, to recognize
- SHT_SH5_CR_SORTED on incoming .cranges section.
- (elf_backend_section_from_shdr): Define.
- (sh64_elf_final_write_processing): Sort outgoing .cranges
- section. (New, temporarily disabled:) Set bit 0 on entry address
- according to ISA type.
- (sh64_find_section_for_address): New.
- (crange_qsort_cmpb, crange_qsort_cmpl, crange_bsearch_cmpb,
- crange_bsearch_cmpl): Move here from opcodes/sh64-dis.c.
- (sh64_address_in_cranges): Move here from opcodes/sh64-dis.c. Use
- bfd_malloc, not xmalloc.
- (sh64_get_contents_type): Move here from opcodes/sh64-dis.c. Make
- global.
- * elf32-sh64.c (sh64_elf64_final_write_processing): New, (but
- temporarily disabled) setting bit 0 on entry address.
- (elf_backend_final_write_processing): Define.
- 2001-01-05 Hans-Peter Nilsson <hpn@cygnus.com>
- * elf32-sh.c (sh_elf_howto_table) <R_SH_PT_16>: Adjust fields to
- be a proper relocation for PTA and PTB rather than a marker.
- <R_SH_IMMU5, R_SH_IMMS6, R_SH_IMMU6, R_SH_IMMS10, R_SH_IMMS10BY2,
- R_SH_IMMS10BY4, R_SH_IMMS10BY8, R_SH_IMMS16, R_SH_IMMU16,
- R_SH_IMM_LOW16, R_SH_IMM_LOW16_PCREL, R_SH_IMM_MEDLOW16,
- R_SH_IMM_MEDLOW16_PCREL, R_SH_IMM_MEDHI16, R_SH_IMM_MEDHI16_PCREL,
- R_SH_IMM_HI16, R_SH_IMM_HI16_PCREL, R_SH_64, R_SH_64_PCREL>:
- Zero src_mask.
- * elf64-sh64.c: Ditto.
- (sh_elf64_relocate_section) <case R_SH_PT_16>: New case.
- * elf32-sh64.c: Include opcodes/sh64-opc.h
- (shmedia_prepare_reloc): Take a bfd_link_info pointer as first
- argument. Drop const qualifiers from "bfd *" and "bfd_byte *"
- parameters. No unused parameters. Caller changed.
- <case R_SH_PT_16>: New case.
- * Makefile.am (elf32-sh64.lo): Add dependency on sh64-opc.h.
- * Makefile.in: Regenerate.
- 2000-12-30 Hans-Peter Nilsson <hpn@cygnus.com>
- * elf64-sh64.c (sh64_elf64_fake_sections): Set SHF_SH5_ISA32 for
- all code sections.
- (sh_elf64_set_mach_from_flags): Change from EF_SH64 to EF_SH5.
- (sh64_elf_merge_private_data): Ditto.
- * elf32-sh64.c (sh64_elf_fake_sections): Use sh64_elf_section_data
- to access stored section flags.
- (sh64_elf_final_write_processing): Return immediately unless
- called by linker. Use sh64_elf_section_data (cranges) to get size
- of linker-generated cranges entries.
- (sh64_elf_copy_private_data): Add missing "return true".
- (sh64_elf_set_mach_from_flags): Change from EF_SH64 to EF_SH5.
- (sh_elf64_merge_private_data): Ditto.
- 2000-12-19 Hans-Peter Nilsson <hpn@cygnus.com>
- * elf64-sh64.c (sh64_elf64_fake_sections): New, copy of
- elf64-sh64.c:sh64_elf_fake_sections.
- (elf_backend_fake_sections): Define as sh64_elf64_fake_sections.
- 2000-12-18 Hans-Peter Nilsson <hpn@cygnus.com>
- * elf32-sh64.c (sh64_elf_copy_private_data_internal): Delete.
- (sh64_elf_final_write_processing): New.
- (elf_backend_final_write_processing): Define.
- (sh64_elf_fake_sections): Get header flags from tdata field.
- (sh64_elf_copy_private_data): Do not call
- sh64_elf_copy_private_data_internal, just copy e_flags field.
- (sh64_elf_merge_private_data): Do not call
- sh64_elf_copy_private_data_internal.
- 2000-12-12 Hans-Peter Nilsson <hpn@cygnus.com>
- Remove EF_SH64_ABI64, let ELF size make difference.
- Remove SH64-specific BFD section flag.
- * elf32-sh64.c (sh64_elf_fake_sections): Recognize section as
- containing SHmedia through elf_section_data (asect)->tdata
- non-zero, not using a BFD section flag.
- (sh64_elf_set_mach_from_flags): Don't recognize EF_SH64_ABI64.
- (sh64_elf_merge_private_data): Similar.
- (elf_backend_section_flags): Don't define.
- (sh64_elf_backend_section_flags): Delete.
- * elf64-sh64.c (sh_elf64_set_mach_from_flags): Recognize EF_SH64,
- not EF_SH64_ABI64.
- (sh_elf64_merge_private_data): Similar.
- * section.c (Section flags definitions): Don't define
- SEC_SH_ISA_SHMEDIA.
- (bfd-in2.h): Regenerate.
- 2000-12-09 Hans-Peter Nilsson <hpn@cygnus.com>
- Make DataLabel references work with partial linking.
- * elf32-sh64.c: Fix formatting.
- (sh64_elf_link_output_symbol_hook): New.
- (elf_backend_link_output_symbol_hook): Define to
- sh64_elf_link_output_symbol_hook.
- (sh64_elf_add_symbol_hook): Make DataLabel symbol just global
- undefined if partial linking. Adjust sanity check.
- * elf64-sh64.c (sh64_elf64_link_output_symbol_hook): New.
- (elf_backend_link_output_symbol_hook): Define to
- sh64_elf64_link_output_symbol_hook.
- (sh64_elf64_add_symbol_hook): Make DataLabel symbol just global
- undefined if partial linking. Adjust sanity check.
- 2000-12-07 Hans-Peter Nilsson <hpn@cygnus.com>
- Implement semantics for inter-file DataLabel references.
- * elf64-sh64.c (DATALABEL_SUFFIX): Define.
- (sh64_elf64_add_symbol_hook): New.
- (sh_elf64_relocate_section): If passing an indirect symbol with
- st_type STT_DATALABEL on the way to a symbol with st_other
- STO_SH5_ISA32, do not bitor 1 to the relocation.
- (elf_backend_add_symbol_hook): Define to
- sh64_elf64_add_symbol_hook.
- * elf64-sh32.c: Tweak comments.
- (DATALABEL_SUFFIX): Define.
- (sh64_elf_add_symbol_hook): New.
- (elf_backend_add_symbol_hook): Define to sh64_elf_add_symbol_hook.
- * elf32-sh.c (sh_elf_relocate_section): If passing an indirect
- symbol with st_type STT_DATALABEL on the way to a symbol with
- st_other STO_SH5_ISA32, do not bitor 1 to the relocation.
- 2000-12-05 Hans-Peter Nilsson <hpn@cygnus.com>
- Pass through STT_DATALABEL.
- * elf32-sh64.c (sh64_elf_get_symbol_type): New.
- (elf_backend_get_symbol_type): Define.
- * elf64-sh64.c (sh64_elf64_get_symbol_type): New.
- (elf_backend_get_symbol_type): Define.
- 2000-11-30 Hans-Peter Nilsson <hpn@cygnus.com>
- * elf32-sh64.c: Tweak comments.
- (sh64_elf_copy_private_data_internal): Add prototype.
- (bfd_elf32_bfd_set_private_flags): Define.
- (sh64_elf_copy_private_data_internal): Compare machine name, not
- textual BFD target name, to check whether to copy section flag
- SHF_SH5_ISA32.
- (sh64_elf_merge_private_data): Validize bfd_get_arch_size.
- Tweak section-contents-type-mismatch message.
- (shmedia_prepare_reloc): Add ATTRIBUTE_UNUSED markers.
- Validize reloc-types.
- * elf64-sh64.c: New file.
- * targets.c (bfd_elf64_sh64_vec, bfd_elf64_sh64l_vec): Declare.
- * Makefile.am (BFD64_BACKENDS): Add elf64-sh64.lo.
- (BFD64_BACKENDS_CFILES): Add elf64-sh64.c.
- Regenerate dependencies.
- * Makefile.in: Regenerate.
- * config.bfd (sh64-*-elf*): Add bfd_elf64_sh64_vec and
- bfd_elf64_sh64l_vec.
- * configure.in: Handle bfd_elf64_sh64_vec and
- bfd_elf64_sh64l_vec.
- * configure: Regenerate.
- * po/POTFILES.in: Regenerate.
- * po/bfd.pot: Regenerate.
- 2000-11-29 Hans-Peter Nilsson <hpn@cygnus.com>
- * elf32-sh64.c (sh64_elf_set_mach_from_flags): Do not recognize
- anything else but EF_SH64 and EF_SH64_ABI64.
- (sh64_elf_merge_private_data): Emit error for anything else but
- EF_SH64 and EF_SH64_ABI64.
- * config.bfd: Remove bfd_elf32_shblin_vec and bfd_elf32_shlin_vec
- from targ_selvecs.
- * configure.in: Add cofflink.lo to bfd_elf32_sh64_vec and
- bfd_elf32_sh64l_vec as a temporary measure.
- * configure: Regenerate.
- 2000-11-27 Hans-Peter Nilsson <hpn@cygnus.com>
- * cpu-sh.c (arch_info_struct): Include sh5 item
- unconditionalized.
- * config.bfd (sh64-*-elf*): Do not set targ_cflags.
- Add targ_selvecs bfd_elf32_sh_vec, bfd_elf32_shl_vec,
- bfd_elf32_shblin_vec and bfd_elf32_shlin_vec.
- * elf32-sh64.c: Tweak comments.
- (sh64_elf_set_mach_from_flags): Recognize all machine flags that
- are proper subsets of SH64 as bfd_mach_sh5. Add EF_SH64_ABI64.
- (sh64_elf_copy_private_data_internal): Wrap long line.
- (sh64_elf_merge_private_data): Rewrite to allow objects from
- SH64 subsets to be linked together.
- (INCLUDE_SHMEDIA): Define.
- * elf32-sh.c (sh_elf_relocate_section) <local symbol>:
- Parenthesize plus-expression inside or-expression.
- <global symbol>: Ditto.
- (sh_elf_set_mach_from_flags): Remove code refusing
- deleted EF_SH64_32BIT_ABI flag.
- 2000-11-26 Hans-Peter Nilsson <hpn@cygnus.com>
- * elf32-sh.c (sh_elf_howto_table) <R_SH_IMM_LOW16_PCREL,
- R_SH_IMM_MEDLOW16_PCREL, R_SH_IMM_MEDHI16_PCREL,
- R_SH_IMM_HI16_PCREL, R_SH_64_PCREL>: Set pcrel_offset to true.
- (sh_elf_relocate_section) <local symbol>: Or 1 in
- calculation of relocation if sym->st_other & STO_SH5_ISA32.
- <global symbol>: Ditto if h->other & STO_SH5_ISA32.
- * elf32-sh64.c (shmedia_prepare_reloc): Add rel->r_addend to
- relocation.
- 2000-11-24 Hans-Peter Nilsson <hpn@cygnus.com>
- * Makefile.am (BFD32_BACKENDS): Add elf32-sh64.lo.
- (BFD32_BACKENDS_CFILES): Add elf32-sh64.c.
- Regenerate dependencies.
- * Makefile.in: Regenerate.
- * archures.c: Add bfd_mach_sh5.
- * config.bfd: Map targ_cpu sh* to bfd_sh_arch.
- Handle sh64-*-elf*. Set targ_cflags to -DINCLUDE_SHMEDIA.
- * configure.in: Handle bfd_elf32_sh64_vec and bfd_elf32_sh64l_vec.
- * configure: Regenerate.
- * reloc.c (BFD_RELOC_SH_SHMEDIA_CODE, BFD_RELOC_SH_IMMU5,
- BFD_RELOC_SH_IMMS6, BFD_RELOC_SH_IMMS6BY32, BFD_RELOC_SH_IMMU6,
- BFD_RELOC_SH_IMMS10, BFD_RELOC_SH_IMMS10BY2,
- BFD_RELOC_SH_IMMS10BY4, BFD_RELOC_SH_IMMS10BY8,
- BFD_RELOC_SH_IMMS16, BFD_RELOC_SH_IMMU16, BFD_RELOC_SH_IMM_LOW16,
- BFD_RELOC_SH_IMM_LOW16_PCREL, BFD_RELOC_SH_IMM_MEDLOW16,
- BFD_RELOC_SH_IMM_MEDLOW16_PCREL, BFD_RELOC_SH_IMM_MEDHI16,
- BFD_RELOC_SH_IMM_MEDHI16_PCREL, BFD_RELOC_SH_IMM_HI16,
- BFD_RELOC_SH_IMM_HI16_PCREL, BFD_RELOC_SH_PT_16): New relocations.
- * cpu-sh.c [INCLUDE_SHMEDIA] (arch_info_struct): Define and link
- in item for SH5.
- * elf32-sh.c [INCLUDE_SHMEDIA] (sh_elf_howto_table): Add howto items
- for SHmedia relocs.
- [INCLUDE_SHMEDIA] (sh_rel): Add mappings for SHmedia relocs.
- [INCLUDE_SHMEDIA] (sh_elf_relocate_section) [default]: Call
- shmedia_prepare_reloc, goto final_link_relocate if it returns
- non-zero, else fail as before.
- (sh_elf_set_mach_from_flags): Provide function only if not defined
- as macro. Do not recognize objects with EF_SH64_32BIT_ABI set.
- (sh_elf_set_private_flags): Provide function only if not defined
- as a macro.
- (sh_elf_copy_private_data): Similar.
- (sh_elf_merge_private_data): Similar.
- * section.c (SEC_SH_ISA_SHMEDIA): New.
- * targets.c (bfd_elf32_sh64_vec, bfd_elf32_sh64l_vec): Declare.
- * elf32-sh64.c: New file.
- * libbfd.h: Regenerate.
- * bfd-in2.h: Regenerate.
- * po/POTFILES.in: Regenerate.
- * po/bfd.pot: Regenerate.
- * bfd-in2.h: Regenerate.
- * libbfd.h: Regenerate.
+2004-02-17 Daniel Jacobowitz <drow@mvista.com>
+ Richard Sandiford <rsandifo@redhat.com>
-2002-02-07 Daniel Jacobowitz <drow@mvista.com>
+ * elfxx-mips.c (mips_elf_calculate_relocation): Use
+ _bfd_elf_symbol_refs_local_p to decide whether to decay
+ a GOT_PAGE/GOT_OFST pair to GOT_DISP/addend.
+ (_bfd_mips_elf_check_relocs): Add a global GOT entry for GOT_PAGE
+ relocs if the symbol wasn't defined by a regular object file.
+ Don't check the symbol's dynindx.
- * bfd-in.h: Update <stdbool.h> check to only see if <stdbool.h> has
- been included, not drag it in.
- * bfd-in2.h: Regenerate.
+2004-02-16 Andrew Cagney <cagney@redhat.com>
-2002-02-06 H.J. Lu (hjl@gnu.org)
+ * bfd-in.h (file_ptr, ufile_ptr): Configure type using
+ @bfd_file_ptr@.
+ * bfd-in2.h: Re-generate.
- * elf32-mips.c (_bfd_mips_elf_merge_private_bfd_data): Update
- the mach and ISA fields if necessary.
+2004-02-14 Andrew Cagney <cagney@redhat.com>
-2002-02-06 Nick Clifton <nickc@cambridge.redhat.com>
+ * configure.host (HDEFINES): When hppa*-*-hpux*, define
+ _LARGEFILE64_SOURCE.
- * coffcode.h (coff_set_arch_mach_hook): Select the highest known
- ARM architecture when an F_ARM_5 flag is detected, since we cannot
- be sure exactly which architecture this represents.
+2004-02-13 Andrew Cagney <cagney@redhat.com>
-2002-02-05 Nick Clifton <nickc@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.
- * po/tr.po: Updated translation.
+2004-02-11 Andrew Cagney <cagney@redhat.com>
-2002-02-05 Alan Modra <amodra@bigpond.net.au>
+ * 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.
- From Jimi X <jimix@watson.ibm.com>
- * archures (bfd_mach_ppc64): Define.
- (bfd_powerpc_arch): Rename to bfd_powerpc_archs.
- (bfd_powerpc_arch): Define.
- * bfd-in2.h: Regenerate.
- * cpu-powerpc.c (arch_info_struct): Rename to bfd_powerpc_archs.
- (bfd_powerpc_arch): Move to tail of bfd_powerpc_archs.
- (bfd_powerpc_archs): Add default powerpc64 arch.
-
-2002-02-05 Alan Modra <amodra@bigpond.net.au>
-
- * elf64-ppc.c (ppc64_elf_size_dynamic_sections): Check for relocs
- against section syms in readonly sections. Don't do the global
- sym check if we find one.
- * elf64-s390.c (elf_s390_size_dynamic_sections): Likewise.
- * elf32-hppa.c (elf32_hppa_size_dynamic_sections): Likewise.
- * elf32-i386.c (elf_i386_size_dynamic_sections): Likewise.
- * elf32-s390.c (elf_s390_size_dynamic_sections): Likewise.
- (elf_s390_grok_prstatus): Add missing prototype.
-
-2002-02-04 Hans-Peter Nilsson <hp@bitrange.com>
-
- * elf64-mmix.c (mmix_dump_bpo_gregs): New function.
- (mmix_elf_check_common_relocs) <case R_MMIX_BASE_PLUS_OFFSET>:
- Call bfd_get_section_by_name only once. Initialize
- bpodata->n_bpo_relocs_this_section.
- (_bfd_mmix_prepare_linker_allocated_gregs): Remove comment
- referring to DSOs.
- (bpo_reloc_request_sort_fn): Don't use difference of values as
- return-value.
-
-2002-02-02 David O'Brien <obrien@FreeBSD>
-
- * configure.in: Tweak the FreeBSD 4.x recognition more. Only treat
- version 4.5 and later the same as 5-CURRENT.
+ * configure.in (AC_CHECK_FUNCS): Check for ftello, ftello64,
+ fseeko and fseeko64. Determine bfd_file_ptr.
* configure: Re-generate.
+ * config.in: Re-generate.
-2002-02-02 Jason Thorpe <thorpej@wasabisystems.com>
-
- * config.bfd (hppa*-*-netbsd*): New target.
-
-2002-01-31 Philipp Thomas <pthomas@suse.de>
-
- * coff-arm.c (coff_arm_merge_private_bfd_data): Move ERROR
- to front of message. Unify messages with elf32-arm.h. Use
- commas where neccessary.
- * elf32-arm.h (elf32_arm_merge_private_bfd_data): Use all upcase
- ERROR in messages. Unify messages with coff-arm.c. Correct
- VFP/FPA error message.
- (elf32_arm_print_private_bfd_data): Don't mark APCS-26 and
- APCS-32 for translation.
-
-2002-02-01 Hans-Peter Nilsson <hp@bitrange.com>
-
- Perform on-demand global register allocation from
- R_MMIX_BASE_PLUS_OFFSET relocs.
- * elf64-mmix.c (struct bpo_reloc_section_info, struct
- bpo_reloc_request, struct bpo_greg_section_info): New.
- (mmix_elf_check_common_relocs, mmix_elf_gc_sweep_hook,
- bpo_reloc_request_sort_fn, mmix_elf_relax_section,
- _bfd_mmix_check_all_relocs,
- _bfd_mmix_prepare_linker_allocated_gregs,
- _bfd_mmix_finalize_linker_allocated_gregs): New functions.
- (elf_mmix_howto_table): Correct src_mask for most relocs.
- (mmix_elf_perform_relocation) <case R_MMIX_BASE_PLUS_OFFSET>: New
- case.
- (mmix_final_link_relocate) <case R_MMIX_BASE_PLUS_OFFSET>: New
- case. Fix typo in comment. New label do_mmix_reloc.
- (mmix_elf_check_relocs): Abuse bfd_link_info member base_file to
- store first object file with a base-plus-offset reloc. Call
- mmix_elf_check_common_relocs for the part common with mmo.
- (mmix_elf_final_link): Write out linker-allocated register
- contents section.
- (elf_backend_gc_sweep_hook): Define.
- (bfd_elf64_bfd_relax_section): Define.
-
- * mmo.c: Don't include <ctype.h>
- (mmo_init): Correct init-once logic.
-
-2002-02-01 Tom Rix <trix@redhat.com>
-
- * config.bfd: Conditionally support <aiaff> for pre AIX 4.3.
-
-2002-02-01 Alan Modra <amodra@bigpond.net.au>
-
- * Makefile.am: Run "make dep-am"
- * Makefile.in: Regenerate.
-
-2002-01-31 David O'Brien <obrien@FreeBSD>
-
- * configure.in: Recognize the differences in core files from FreeBSD
- 4.{0,1} and later versions of 4.x. This treats 4.2+ the same as
- 5-CURRENT.
- * configure: Regenerate.
-
-2002-01-31 Ivan Guzvinec <ivang@opencores.org>
-
- * coff-or32.c: New file.
- * cpu-or32.c: New file.
- * elf32-or32.c: New file.
- * archures.c: Add support for or32.
- * targets.c: Add support for or32.
- * bfd-in2.h: Regenerate.
- * coffcode.h (coff_set_arch_mach_hook, coff_set_flags,
- coff_write_object_contents): Add support for or32.
- * config.bfd: Add target.
- * configure.in: Add support for or32.
- * configure: Regenerate.
- * Makefile.am: Add support for or32.
- * Makefile.in: Regenerate.
- * po/SRC-POTFILES.in: Add or32 files.
- * po/bfd.pot: Regenerate.
-
-2002-01-31 Nick Clifton <nickc@cambridge.redhat.com>
- Don Lindsay <lindsayd@cisco.com>
-
- * elf32-mips.c (mips_elf_calculate_relocation): Replace 'return
- false' with a return of a bfd_reloc_ error code.
-
-2002-01-31 Hans-Peter Nilsson <hp@axis.com>
-
- * elf32-cris.c (elf_cris_discard_excess_program_dynamics): Don't
- unexport unreferenced symbols when --export-dynamic. Call
- _bfd_elf_strtab_delref when unexporting.
-
-2002-01-30 Daniel Jacobowitz <drow@mvista.com>
-
- * bfd-in.h: Include <stdbool.h> if it is available.
- * bfd-in2.h: Regenerated.
-
-2002-01-31 Alan Modra <amodra@bigpond.net.au>
-
- * elf64-ppc.c (func_desc_adjust): STV_PROTECTED functions should
- not go via the plt.
-
-2002-01-30 Nick Clifton <nickc@cambridge.redhat.com>
-
- * archures.c: Tidy up formatting of embedded comments.
- * bfd.c: Tidy up formatting of embedded comments.
- * bfd-in.h: Fix formatting of comments.
- * reloc.c: Tidy up formatting of ordinary & embedded comments.
- * section.c: Tidy up formatting of embedded comments.
- * syms.c: Tidy up formatting of embedded comments.
- * targets.c: Tidy up formatting of embedded comments.
-
- * bfd-in2.h: Regenerate.
-
-2002-01-30 Nick Clifton <nickc@cambridge.redhat.com>
-
- * vms-tir.c (cmd_name): New function.
- (tir_cmd_name): New function.
- (etir_sta, etir_sto, etir_opr, etir_stc): Use cmd_name().
- (tir_opr, tir_ctl, tir_cmd): use tir_cmd_name().
- Fix formatting.
-
- * peXXigen.c (pe_print_idata): Rearrange message to aid in
- translation.
- (pe_print_pdata): Rearrange message to aid in translation.
-
- * libbfd.c (warn_deprecated): Rearrange error message to aid in
- translation.
-
- * ihex.c (ihex_write_object_contents): Fix spelling typo.
-
- * ieee.c (ieee_slurp_external_symbols): Remove spurious space.
-
- * elf64-sparc.c (sparc64_elf_add_symbol_hook): Rearrange error
- message to aid in translation.
-
- * elf64-mmix.c (mmix_final_link_relocate): Rearrange error message
- to aid in translation.
-
- * elf32-arm.h (elf32_arm_merge_private_bfd_data): Fix typo.
-
-2002-01-30 Philipp Thomas <pthomas@suse.de>
-
- * coff-arm.c, elf32-elf.h: Unify messages.
-
-2002-01-30 Nick Clifton <nickc@redhat.com>
-
- * po/sv.po: Updated translation.
-
-2002-01-30 Philipp Thomas <pthomas@suse.de>
-
- * dwarf2.c (read_abbrev): Use full section name in error message.
- (decode_line_info): Likewise.
-
- * elf.c (_bfd_elf_symbol_from_bfd_symbol): Don't translate debugging
- message.
-
-2002-01-30 Alan Modra <amodra@bigpond.net.au>
-
- * elf64-ppc.c (func_desc_adjust): Only provide missing function
- descriptor symbols for undefined function code syms. Clear
- ELF_LINK_NON_ELF so that they can stay weak.
-
-2002-01-29 Chris Demetriou <cgd@broadcom.com>
- Mitch Lichtenberg <mpl@broadcom.com>
-
- * bfd-in.h (bfd_mips_elf32_create_embedded_relocs): New prototype.
- * elf32-mips.c (bfd_mips_elf32_create_embedded_relocs): New function
- to handle 32-bit ELF embedded reloc (ld --embedded-relocs)
- generation.
- * bfd-in2.h: Regenerate.
-
-2002-01-29 Chris Demetriou <cgd@broadcom.com>
-
- * elf32-mips.c: Add additional comments about HI16 relocation
- processing.
- (_bfd_mips_elf_hi16_reloc): Don't subtract address here for
- pc-relative relocations. (Reverts change made on 2001-10-31.)
- (_bfd_mips_elf_lo16_reloc): Subtract address of LO16 part here
- for pc-relative relocations.
- (mips_elf_calculate_relocation): Add a comment about a kludge
- in the R_MIPS_GNU_REL_HI16 handling.
- (_bfd_mips_elf_relocate_section): Implement that kludge;
- adjust pc-relative HI16 relocation for difference in HI16 and
- LO16 addresses, since it can't easily be done in
- mips_elf_calculate_relocation.
-
-2002-01-29 Martin Schwidefsky <schwidefsky@de.ibm.com>
-
- * elf32-i386 (elf_i386_adjust_dynamic_symbol): Do not replace PLT32
- relocations with PC32 relocations for undefined or weak symbols.
- * elf32-s390 (elf_i386_adjust_dynamic_symbol): Likewise.
- * elf64-s390x (elf_i386_adjust_dynamic_symbol): Likewise.
-
-2002-01-28 Jason Thorpe <thorpej@wasabisystems.com>
-
- * elfcore.h (elf_core_file_p): Improve comment for last change.
-
-2002-01-27 Daniel Jacobowitz <drow@mvista.com>
-
- * configure: Regenerated.
-
-2002-01-27 Jason Thorpe <thorpej@wasabisystems.com>
-
- * elfcore.h (elf_core_file_p): Set the machine architecture
- before processing the program headers.
-
-2002-01-26 Hans-Peter Nilsson <hp@bitrange.com>
-
- * configure.in <64-bit configuration>: If using gcc, check and
- emit error for egcs-1.1.2.
- * configure: Regenerate.
-
-2002-01-26 Egor Duda <deo@logos-m.ru>
-
- * elf.c (elfcore_grok_win32pstatus): Copy only as much information
- as possible to avoid stack corruption.
-
-2002-01-26 Richard Henderson <rth@redhat.com>
-
- * elf64-alpha.c (elf64_alpha_check_relocs): Don't set reltext
- for non-allocated sections.
-
-2002-01-25 Mark Kettenis <kettenis@gnu.org>
-
- * elf.c (elfcore_write_prstatus): Make sure we pass the address of
- prstat.pr_reg even if it is a struct.
-
-2002-01-25 Steve Ellcey <sje@cup.hp.com>
-
- * bfd/elfxx-ia64.c: Reset AIX vector function overrides for HP-UX.
-
-2002-01-25 Philipp Thomas <pthomas@suse.de>
-
- * coffgen.c (coff_print_symbol): Don't mark info message
- for translation.
-
-2002-01-25 Nick Clifton <nickc@redhat.com>
-
- * po/fr.po: Updated translation.
- * po/es.po: Updated translation.
-
-2002-01-25 Philipp Thomas <pthomas@suse.de>
-
- * coff-alpha.c (alpha_relocate_section): Unify warning message
- for GP relative relocations without GP defined.
- * coff-mips.c (mips_relocate_section): Likewise.
-
-2002-01-25 Alan Modra <amodra@bigpond.net.au>
+2004-02-09 Anil Paranjpe <anilp1@KPITCummins.com>
- * elf-eh-frame.c (_bfd_elf_eh_frame_section_offset): Avoid
- unsigned overflow when new_offset < old_offset.
+ * coff-h8300.c: Added comments about relaxation for ldc.w and stc.w.
+ * elf32-h8300.c: Likewise.
-2002-01-24 Philipp Thomas <pthomas@suse.de>
+2004-02-09 Christian Vogel <vogelchr@vogel.cx>
+ Nick Clifton <nickc@redhat.com>
- * bfd.c (_bfd_abort): Fix typo.
+ * elf64-alpha.c (elf64_alpha_calc_got_offsets_for_symbol): Catch
+ GOT entries with no associated GOT subsection.
-2002-01-23 Richard Henderson <rth@redhat.com>
+2004-02-09 Richard Sandiford <rsandifo@redhat.com>
- * elf64-alpha.c (elf64_alpha_adjust_dynamic_symbol): Don't suppress
- plt entries for undefweak symbols.
+ * 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.
-2002-01-23 Steve Ellcey <sje@cup.hp.com>
+2004-01-30 H.J. Lu <hongjiu.lu@intel.com>
- * bfd/targets.c (bfd_elf32_ia64_hpux_big_vec): Add to
- DEFAULT_VECTOR.
- (bfd_elf64_ia64_hpux_big_vec): Ditto.
- (bfd_elf32_h8300_vec): Ditto.
+ * elfxx-ia64.c (elfNN_ia64_relax_brl): New function.
+ (elfNN_ia64_relax_section): Optimize brl to br during the relax
+ finalize pass.
-2002-01-23 Alan Modra <amodra@bigpond.net.au>
+2004-01-30 Alexandre Oliva <aoliva@redhat.com>
- * elf64-ppc.c: Remove stale part of ABI comment.
- (NO_OPD_RELOCS): Define.
- (ppc64_elf_check_relocs): Use it.
- (ppc64_elf_relocate_section): Here too.
- (build_one_stub): Don't point function syms at the stub. Instead,
- hijack plt.offset.
- (ppc64_elf_relocate_section): Check whether REL24 relocs should
- really go to the stub. Make all dynamic relocs in opd against
- locals.
- (ppc64_elf_finish_dynamic_symbol): Allow for non-standard use of
- plt.offset.
+ * 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.
-2002-01-22 Richard Henderson <rth@redhat.com>
+2004-01-25 H.J. Lu <hongjiu.lu@intel.com>
- * elf64-alpha.c (INSN_UNOP): Encode with RB as $sp.
+ * elfxx-ia64.c (elfNN_ia64_relocate_section): Disallow imm
+ relocations against dynamic symbols.
-2002-01-22 Alan Modra <amodra@bigpond.net.au>
+2004-01-23 Daniel Jacobowitz <drow@mvista.com>
- * elf64-ppc.c (ppc64_elf_finish_dynamic_sections): Correct sign of
- TOC_BASE_OFF adjustment.
+ * elf32-arm.h (elf32_arm_check_relocs): Revert part of 2004-01-13
+ change.
- * Makefile.am: Run "make dep-am".
- * Makefile.in: Regenerate.
- * po/SRC-POTFILES.in: Regenerate.
-
-2002-01-22 John David Anglin <dave@hiauly1.hia.nrc.ca>
-
- * configure.host (hppa*64*-*-hpux*, hppa*64*-*-linux*): Add new
- host defines.
-
-2002-01-21 Hans-Peter Nilsson <hp@axis.com>
-
- * elf32-cris.c (cris_elf_relocate_section) <case R_CRIS_32_GOTREL>:
- Check for and emit error if sgot is NULL at this point.
-
-2002-01-21 Jason Thorpe <thorpej@wasabisystems.com>
-
- * config.bfd (ia64*-*-netbsd*): New target.
-
-2002-01-21 Thomas Klausner <wiz@danbala.ifoer.tuwien.ac.at>
-
- * som.c (som_write_space_strings): Comment typo fix.
-
-2002-01-21 Alan Modra <amodra@bigpond.net.au>
-
- * elf64-ppc.c (struct ppc_link_hash_entry): Add is_func and
- is_func_descriptor fields.
- (link_hash_newfunc): Init them.
- (ppc64_elf_check_relocs): Only R_PPC24_REL24 syms starting with a
- dot are candidates for plt entries. When processing .opd relocs,
- set function descriptor strings to point inside function code
- string, and set new ppc_link_hash_entry fields.
- (ppc64_elf_gc_sweep_hook): Don't sweep R_PPC64_REL24 relocs.
- (ppc64_elf_adjust_dynamic_symbol): Remove most code dealing with
- function descriptors. It's now done in..
- (func_desc_adjust): New.
- (ppc64_elf_func_desc_adjust): New.
- (define elf_backend_always_size_sections): Define.
- (ppc64_elf_hide_symbol): New.
- (define elf_backend_hide_symbol): Define.
- (allocate_dynrelocs): Remove code looking up function descriptors
- as that has been done earlier.
- (ppc64_elf_size_dynamic_sections): Use htab shortcut to elf hash
- table.
- (ppc64_elf_finish_dynamic_symbol): Likewise. Remove code looking
- up function descriptor.
- (build_one_stub): Look up the function code sym. Check for
- invalid plt offsets.
- (ppc64_elf_relocate_section): Tweak calls to undefined weak syms.
- Convert R_PPC64_TOC relocs to R_PPC64_RELATIVE in shared libs.
-
- * elf-bfd.h (elf_backend_data <elf_backend_hide_symbol>): Add
- boolean param.
- (_bfd_elf_link_hash_hide_symbol): Likewise.
- * elflink.h (elf_link_add_object_symbols): Adjust call to
- elf_backend_hide_symbol.
- (elf_fix_symbol_flags): Likewise.
- (elf_link_assign_sym_version): Likewise. Use bfd_malloc rather
- than bfd_alloc.
- * elf.c (_bfd_elf_link_hash_hide_symbol): Add "force_local" param.
- Set ELF_LINK_FORCED_LOCAL and call _bfd_elf_strtab_delref.
- * elf32-hppa.c (elf32_hppa_hide_symbol): Likewise.
- (clobber_millicode_symbols): Adjust to suit new hide_symbol.
- * elf32-cris.c (elf_cris_hide_symbol): Add "force_local" param
- and adjust to suit.
- * elf32-mips.c (_bfd_mips_elf_hide_symbol): Likewise, and call
- _bfd_elf_link_hash_hide_symbol rather than duplicating code.
- * elfxx-ia64.c (elfNN_ia64_hash_hide_symbol): Likewise.
-
-2002-01-18 Alan Modra <amodra@bigpond.net.au>
-
- * elf64-ppc.c (ppc64_elf_adjust_dynamic_symbol): Test for a
- dynamic function descriptor symbol, not the associated function
- symbol.
-
-2002-01-17 Eric Christopher <echristo@redhat.com>
-
- * elf32-mips.c (mips_elf_calculate_relocation): Fix typo.
-
-2002-01-17 Nick Clifton <nickc@cambridge.redhat.com>
-
- * po/bfd.pot: Regenerate.
- * po/fr.po: Regenerate.
-
-2002-01-17 Alan Modra <amodra@bigpond.net.au>
-
- * elf-bfd.h (elf_backend_data <elf_backend_section_from_bfd_section>):
- Remove "Elf_Internal_Shdr *" param.
- (_bfd_mips_elf_section_from_bfd_section): Ditto.
- * elf32-mips.c (_bfd_mips_elf_section_from_bfd_section): Ditto.
- * elf32-m32r.c (_bfd_m32r_elf_section_from_bfd_section): Ditto.
- * elf32-v850.c (v850_elf_section_from_bfd_section): Ditto.
- * elf64-mmix.c (mmix_elf_section_from_bfd_section): Ditto.
- * elfxx-ia64.c (elfNN_hpux_backend_section_from_bfd_section): Ditto.
- * elf.c (_bfd_elf_section_from_bfd_section): Allow backend
- function to override special sections. Remove hdr arg from
- backend call, and don't loop.
-
-2002-01-16 Eric Christopher <echristo@redhat.com>
-
- * elf32-mips.c (mips_elf_calculate_relocation): Set require_jalxp
- on R_MIPS_26 and target is 16bit. Add R_MIPS16_GPREL to list of
- relocations requiring gp0 and gp.
-
-2002-01-16 Richard Earnshaw <rearnsha@arm.com>
-
- * elf32-arm.h (elf32_arm_merge_private_bfd_data): Handle
- EF_ARM_VFP_FLOAT.
- (elf32_arm_print_private_bfd_data): Likewise.
-
-2002-01-16 Nick Clifton <nickc@cambridge.redhat.com>
-
- * po/tr.po: Import new version.
-
-2002-01-16 Alan Modra <amodra@bigpond.net.au>
-
- * elf64-ppc.c (ppc64_elf_howto_raw): Remove stale FIXMEs.
- (ppc64_elf_reloc_type_lookup): Use proper CTOR reloc.
- (ORI_R0_R0_0): Correct.
-
-2002-01-16 Alan Modra <amodra@bigpond.net.au>
-
- * elflink.c (_bfd_elf_create_dynamic_sections): Don't set SEC_CODE
- when plt_not_loaded.
- * elf64-ppc.c (ppc64_elf_create_dynamic_sections): No need to
- clear .plt SEC_CODE here. Create .stub and correct .glink flags.
- (PLT_INITIAL_ENTRY_SIZE): Set to 24.
- (ppc64_elf_glink_code): Delete.
- (PPC64_ELF_GLINK_SIZE): Delete.
- (ADDIS_R12_R2, STD_R2_40R1, LD_R11_0R12, LD_R2_0R12, MTCTR_R11,
- BCTR, ADDIS_R12_R12_1, LD_R2_40R1, NOP, LI_R0_0, B_DOT, LIS_R0_0,
- ORI_R0_R0_0): Define.
- (PLT_CALL_STUB_SIZE, GLINK_CALL_STUB_SIZE): Define.
- (struct ppc_link_hash_table): Add sstub and plt_overflow.
- (ppc64_elf_link_hash_table_create): Init them.
- (ppc64_elf_check_relocs <R_PPC64_REL24>): Refcount .plt entry.
- Don't copy to shared lib.
- (ppc64_elf_check_relocs): Call bfd_set_error on errors.
- (ppc64_elf_gc_sweep_hook <R_PPC64_REL24>): Sweep plt refcount.
- (allocate_dynrelocs <plt>): Don't change function sym here. Make
- room for .stub and .glink code.
- (ppc64_elf_size_dynamic_sections): Handle .stub. Make entry for
- DT_PPC64_GLINK.
- (ppc64_elf_final_link): Rename to ppc64_elf_set_toc. Don't call
- bfd_elf64_bfd_final_link.
- (bfd_elf64_bfd_final_link): Don't define.
- (ppc64_elf_size_stubs): New.
- (build_plt_stub): New.
- (build_one_stub): New.
- (ppc64_elf_build_stubs): New.
- (ppc64_elf_relocate_section <toc relocs>): Remove assert.
- (ppc64_elf_relocate_section): Don't copy R_PPC64_REL24 relocs.
- (ppc64_elf_finish_dynamic_symbol): Don't build stubs here. Set
- DT_PPC64_GLINK entry. Tweak DT_PLTGOT, DT_JMPREL, DT_PLTRELSZ in
- case output sections not separate. Adjust DT_RELASZ to not
- include plt relocs. Set reserved got entry. Set got and plt
- entry size.
- (elf_backend_got_header_size): Set to 8.
- * elf64-ppc.h: New file.
-
-2002-01-16 Alan Modra <amodra@bigpond.net.au>
-
- * elf32-arm.h (elf32_arm_size_dynamic_sections): When removing
- sections, use bfd_section_list_remove.
- * elf32-i370.c (i370_elf_size_dynamic_sections): Likewise.
- * elflink.h (elf_link_add_object_symbols): When removing all
- sections, use bfd_section_list_clear.
-
-2002-01-15 Nick Clifton <nickc@cambridge.redhat.com>
-
- * po/sv.po: New file: Swedish translation.
- * configure.in (ALL_LINGUAS): Add sv.
- * configure: Regenerate.
-
-2002-01-15 Jakub Jelinek <jakub@redhat.com>
-
- * elflink.h (elf_link_input_bfd): Back out 2002-01-07 change.
- * elf.c (merge_sections_remove_hook): New function.
- (_bfd_elf_merge_sections): Pass it as 3rd argument to
- _bfd_merge_sections.
- * libbfd-in.h (_bfd_merge_sections): Add 3rd argument.
- * libbfd.h: Rebuilt.
- * merge.c (_bfd_merge_sections): Add remove_hook argument.
- Call remove_hook if a SEC_EXCLUDE section is encountered.
-
-2002-01-15 Nick Clifton <nickc@cambridge.redhat.com>
-
- * elf32-xstormy16.c (xstormy16_reloc_map): Add new field 'table'.
- (xstormy16_reloc_map): Initialise new field with correct howto
- table.
- (xstormy16_reloc_type_lookup): Use 'table' field to locate correct
- howto entry.
-
-2002-01-10 Michael Snyder <msnyder@redhat.com>
-
- * elf.c (elfcore_write_prstatus): Use long instead of pid_t;
- (elfcore_write_pstatus): Use long instead of pid_t;
- * elf-bfd.h: Change prototypes to use long instead of pid_t;
-
-2002-01-09 Jason Thorpe <thorpej@wasabisystems.com>
-
- * elf.c: Update copyright years.
- (elfcore_grok_netbsd_note): Use NT_NETBSDCORE_PROCINFO
- and NT_NETBSDCORE_FIRSTMACH. Improve a comment.
-
-2002-01-08 Michael Snyder <msnyder@redhat.com>
+2004-01-21 Tom Rix <tcrix@worldnet.att.net>
- Add capability to write corefile note sections, for gdb.
- * elf.c (elfcore_write_note): New function.
- (elfcore_write_prpsinfo): New function.
- (elfcore_write_prstatus): New function.
- (elfcore_write_pstatus): New function.
- (elfcore_write_prfpreg): New function.
- (elfcore_write_prxfpreg): New function.
- * elf-bfd.h: Add prototypes for above functions.
+ * reloc.c: New 5 bit reloc, BFD_RELOC_M68HC12_5B, for m68hc12 movb/movw.
+ * bfd-in2.h, libbfd.h: Rebuilt.
-2002-01-08 Alexandre Oliva <aoliva@redhat.com>
+2004-01-20 Danny Smith <dannysmith@users.sourceforge.net>
- * elf.c (elf_fake_sections): Propagate errors from
- elf_backend_fake_section.
+ * 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.
-2002-01-07 Jason Thorpe <thorpej@wasabisystems.com>
+2004-01-19 Kazu Hirata <kazu@cs.umass.edu>
- * Makefile.am (BFD32_BACKENDS): Add elf32-sh-nbsd.lo.
- (BFD32_BACKENDS_CFILES): Add elf32-sh-nbsd.c.
- (elf32-sh-nbsd.lo): New rule.
- * Makefile.in: Regenerate.
- * config.bfd (sh*le-*-netbsdelf*): New target.
- (sh*-*-netbsdelf*): New target.
- * configure.in: Include netbsd-core.lo for native sh*-*-netbsd*.
- (bfd_elf32_shnbsd_vec): New vector.
- (bfd_elf32_shlnbsd_vec): New vector.
- * configure: Regenerate.
- * elf32-sh-nbsd.c: New file.
- * targets.c: Update copyright years.
- (_bfd_target_vector): Add bfd_elf32_shlnbsd_vec and
- bfd_elf32_shnbsd_vec.
+ * coff-h8300.c: Add and adjust comments about relaxation.
+ * elf32-h8300.c: Likewise.
-2002-01-07 Aldy Hernandez <aldyh@redhat.com>
+2004-01-16 Kazu Hirata <kazu@cs.umass.edu>
- * coff-rs6000.c (READ20): Use bfd_scan_vma.
+ * coff-h8300.c: Fix comment typos.
+ * elf32-h8300.c: Likewise.
-2002-01-07 Geoffrey Keating <geoffk@redhat.com>
+2004-01-16 Kazu Hirata <kazu@cs.umass.edu>
- * elflink.h (elf_link_input_bfd): Don't ask for the merged offset
- of a symbol in a section that will be deleted.
+ * coff-h8300.c: Add comments about relaxation.
+ * elf32-h8300.c: Likewise.
-2002-01-07 Nick Clifton <nickc@cambridge.redhat.com>
+2004-01-14 Maciej W. Rozycki <macro@ds2.pg.gda.pl>
- * po/es.po: New file: Spanish translation.
- * configure.in (ALL_LINGUAS): Add es.
+ * acinclude.m4: Quote names of macros to be defined by AC_DEFUN
+ throughout.
+ * aclocal.m4: Regenerate.
* configure: Regenerate.
-2002-01-06 Steve Ellcey <sje@cup.hp.com>
-
- * elfxx-ia64.c (is_unwind_section_name): Add target vector as
- argument so we can handle HP-UX specially.
- (elfNN_ia64_hpux_vec): New for use in is_unwind_section_name.
- (elfNN_hpux_backend_section_from_bfd_section): New for support
- of SHN_IA_64_ANSI_COMMON.
- (elfNN_ia64_relax_section): Add support for SHN_IA_64_ANSI_COMMON.
- (is_unwind_section_name): Add special HP-UX support.
- (elfNN_ia64_section_from_shdr): Add support for more sections.
- (elfNN_ia64_fake_sections): Modify is_unwind_section_name call and
- add support for more sections.
- (elfNN_ia64_additional_program_headers): Modify
- is_unwind_section_name call.
- (elfNN_ia64_modify_segment_map): Remove assumption that there is
- only one unwind section in segment.
-
-2002-01-06 Alan Modra <amodra@bigpond.net.au>
-
- * syms.c (_bfd_generic_make_empty_symbol): New function.
- * libbfd-in.h (_bfd_nosymbols_make_empty_symbol): Define as
- _bfd_generic_make_empty_symbol.
- * libbfd.h: Regenerate.
- * bfd-in2.h: Regenerate.
- * hppabsd-core.c (hppabsd_core_make_empty_symbol): Delete function.
- (hppabsd_core_get_symtab_upper_bound): Don't define.
- (hppabsd_core_get_symtab): Likewise.
- (hppabsd_core_print_symbol): Likewise.
- (hppabsd_core_get_symbol_info): Likewise.
- (hppabsd_core_bfd_is_local_label_name): Likewise.
- (hppabsd_core_get_lineno): Likewise.
- (hppabsd_core_find_nearest_line): Likewise.
- (hppabsd_core_bfd_make_debug_symbol): Likewise.
- (hppabsd_core_read_minisymbols): Likewise.
- (hppabsd_core_minisymbol_to_symbol): Likewise.
- (hppabsd_core_vec): Use BFD_JUMP_TABLE_SYMBOLS (_bfd_nosymbols).
- Formatting fixes.
- * hpux-core.c: Similarly.
- * irix-core.c: Similarly.
- * osf-core.c: Similarly.
- * sco5-core.c: Similarly.
- * binary.c (binary_make_empty_symbol): Remove function, define as
- _bfd_generic_make_empty_symbol.
- * ihex.c (ihex_make_empty_symbol): Likewise.
- * mmo.c (mmo_make_empty_symbol): Likewise.
- * ppcboot.c (ppcboot_make_empty_symbol): Likewise.
- * srec.c (srec_make_empty_symbol): Likewise.
- * versados.c (versados_make_empty_symbol): Likewise.
- * vms.c (_bfd_vms_make_empty_symbol): Remove.
- (vms_make_empty_symbol): Define as _bfd_generic_make_empty_symbol.
- * vms-gsd.c (_bfd_vms_slurp_gsd): Call bfd_make_empty_symbol
- rather than _bfd_vms_make_empty_symbol.
- * vms-misc.c (new_symbol): Likewise.
-
-2002-01-05 Alan Modra <amodra@bigpond.net.au>
-
- * section.c (bfd_section_init): Remove unnecessary initialisations.
- (bfd_section_list_clear): New function.
- (bfd_section_list_remove, bfd_section_list_insert): New macros.
- (_bfd_strip_section_from_output): Use them.
- * coffcode.h (coff_set_alignment_hook): Likewise.
- * elf32-mips.c (_bfd_mips_elf_final_link): Likewise.
- * elf64-mips.c (mips_elf64_final_link): Likewise.
- * elf64-mmix.c (mmix_elf_final_link): Likewise.
- * sunos.c (sunos_add_dynamic_symbols): Likewise.
- * xcofflink.c (_bfd_xcoff_bfd_final_link): Likewise.
- * bfd-in2.h: Regenerate.
-
- * netbsd-core.c (netbsd_core_file_p): Use bfd_make_section_anyway
- rather than doing our own section handling. Clean up after errors
- with bfd_release and bfd_section_list_clear. Handle unexpected
- flags.
- * aoutf1.h (sunos4_core_file_p): Likewise.
- * aix386-core.c (aix386_core_file_p): Likewise.
- * cisco-core.c (cisco_core_file_validate): Likewise.
- * ptrace-core.c (ptrace_unix_core_file_p): Likewise.
- * trad-core.c (trad_unix_core_file_p): Likewise.
+2004-01-13 Ian Lance Taylor <ian@wasabisystems.com>
- * hppabsd-core.c (hppabsd_core_core_file_p): Clean up after errors
- with bfd_release and bfd_section_list_clear.
- * hpux-core.c (hpux_core_core_file_p): Likewise.
- * irix-core.c (irix_core_core_file_p): Likewise.
- * lynx-core.c (lynx_core_file_p): Likewise.
- * osf-core.c (osf_core_core_file_p): Likewise.
- * rs6000-core.c (rs6000coff_core_p): Likewise.
- * sco5-core.c (sco5_core_file_p): Likewise.
+ * elf64-mips.c (mips_elf64_slurp_one_reloc_table): Call
+ mips_elf64_rtype_to_howto instead of using howto_table.
- * elf32-mips.c (_bfd_mips_elf_lo16_reloc): Simplify, and perform
- sign extension adjustments without conditionals.
-
-2002-01-04 Jakub Jelinek <jakub@redhat.com>
-
- * elf-eh-frame.c (_bfd_elf_write_section_eh_frame): Don't crash if
- CIE at .eh_frame start is removed due to no FDEs referencing it.
+2004-01-13 Daniel Jacobowitz <drow@mvista.com>
+
+ * elf32-arm.h (elf32_arm_final_link_relocate): Check that we created
+ the .plt section.
+ (elf32_arm_check_relocs): Don't increment the PLT refcount for
+ relocs which would not use the PLT.
+
+2004-01-13 Alan Modra <amodra@bigpond.net.au>
+
+ * elf64-ppc.c (ppc64_elf_check_relocs): Ignore !SEC_ALLOC relocs.
+ (ppc64_elf_gc_sweep_hook): Likewise.
+ (ppc64_elf_size_dynamic_sections): Test for .plt directly.
+
+2004-01-12 Anil Paranjpe <anilp1@KPITCummins.com>
+
+ Adds linker relaxation support for bit manipulation insns like
+ band, bclr, biand, bild, bior, bist, bixor, bld, bnot, bor, bset,
+ bst, btst, bxor.
+ * elf32-h8300.c: Opcode for bit manipulation insn is checked in
+ elf32_h8_relax_section function while relxation for aa:16 and aa:32.
+ * coff-h8300.c: Opcode for bit manipulation insn is checked in
+ h8300_reloc16_extra_cases function while relxation for aa:16 and aa:32.
+
+2004-01-12 Alan Modra <amodra@bigpond.net.au>
+
+ * dwarf2.c: Convert to C90, remove unneeded casts and prototypes.
+
+2004-01-11 Kazu Hirata <kazu@cs.umass.edu>
+
+ * elf32-h8300.c: Fix formatting.
+
+2004-01-11 Kazu Hirata <kazu@cs.umass.edu>
+
+ * elf32-cris.c (cris_elf_gc_sweep_hook): Return early if no
+ dynamic object is present. Declare r_symndx and h in an inner
+ scope.
+ * elf32-vax.c (elf_vax_gc_sweep_hook): Likewise.
+
+2004-01-09 Daniel Jacobowitz <drow@mvista.com>
+
+ * elf32-arm.h (struct elf32_arm_relocs_copied): Remove pc_count.
+ (elf32_arm_copy_indirect_symbol): Don't copy pc_count.
+ (elf32_arm_final_link_relocate): Handle PLT32 and PC24 relocs
+ identically. Do not emit PC24 relocations for shared libraries.
+ (elf32_arm_gc_sweep_hook): Handle PLT32 and PC24 relocs
+ identically. Don't adjust pc_count.
+ (elf32_arm_check_relocs): Handle PLT32 and PC24 relocs identically.
+ Set ELF_LINK_HASH_NEEDS_PLT for both. Don't adjust pc_count; don't
+ adjust count for branch relocations.
+ (allocate_dynrelocs): Correct typo in call to
+ WILL_CALL_FINISH_DYNAMIC_SYMBOL. Never allocate space for
+ PC24 or PLT32 relocs when linking.
+
+2004-01-09 Dmitry Semyonov <Dmitry.Semyonov@oktet.ru>
+
+ * coff-arm.c (aoutarm_std_reloc_howto): [ARM_WINCE] Synchronize ARM_26D
+ relocation howto with ARM_26 one for consistency.
+ (coff_arm_relocate_section): Set partial_inplace for ARM_26 relocations
+ that will be converted to ARM_26D ones, since we always want 'done'
+ relocations to be reflected in section's data.
+ (coff_arm_relocate_section): [ARM_WINCE] Quick fix for BL instruction
+ offset.
+ (_bfd_final_link_relocate): Do not modify "inplace" data, if not
+ requested.
+
+2004-01-08 Dmitry Semyonov <Dmitry.Semyonov@oktet.ru>
+
+ * coff-arm.c (coff_arm_relocate_section): Do not alter relocs that
+ are not partial_inplace during a relocatable link.
+
+2004-01-08 Kazu Hirata <kazu@cs.umass.edu>
+
+ * elf32-m68k.c (elf_m68k_gc_sweep_hook): Return early
+ if no dynamic object is present. Declare r_symndx and h in an
+ inner scope.
+
+2004-01-07 H.J. Lu <hongjiu.lu@intel.com>
+
+ * elfxx-ia64.c (elfNN_ia64_relax_section): Don't install
+ trampoline if it is known out of range.
+
+2004-01-06 Alexandre Oliva <aoliva@redhat.com>
+
+ 2003-12-17 Alexandre Oliva <aoliva@redhat.com>
+ * elf32-frv.c (_frv_osec_readonly_p): New.
+ (_frv_emit_got_relocs_plt_entries): Don't emit rofixup for
+ undefweak symbol.
+ (_frv_count_got_plt_entries): Adjust expected count accordingly.
+ (elf32_frv_relocate_section): Likewise. Error out if attempting
+ to emit rofixups or dynamic relocs in read-only segments. Use
+ _bfd_elf_section_offset to adjust r_offsets in rofixups and
+ dynamic relocations.
+ 2003-12-12 Alexandre Oliva <aoliva@redhat.com>
+ * elf32-frv.c (elf32_frv_relocate_section): Compute dynamic
+ relocations or fixups involving merged sections correctly. Avoid
+ crash when undefined symbol is referenced by R_FRV_32 or
+ R_FRV_FUNCDESC_VALUE.
+ 2003-12-02 Alexandre Oliva <aoliva@redhat.com>
+ * elf32-frv.c (elf32_frv_relocate_section): Add output_offset of
+ input section holding local symbol to addend of R_FRV_32 or
+ R_FRV_FUNCDESC_VALUE dynamic relocation.
+ 2003-11-27 Alexandre Oliva <aoliva@redhat.com>
+ * elf32-frv.c (elf32_frv_modify_segment_map): Add link info arg.
+ (elf32_frv_always_size_sections): Don't store pointer to
+ __stacksize symbol in sec_info.
+ (elf32_frv_modify_segment_map): Look it up here.
+ 2003-11-26 Alexandre Oliva <aoliva@redhat.com>
+ * elf32-frv.c (_frv_emit_got_relocs_plt_entries): Emit the address
+ of the lazy PLT entry, not only its offset, as the low word of a
+ function descriptor.
+ 2003-11-10 Alexandre Oliva <aoliva@redhat.com>
+ * elf32-frv.c (elf32_frv_always_size_sections): Define __stacksize
+ if a hash table entry already exists but is not a definition.
+ 2003-11-05 Alexandre Oliva <aoliva@redhat.com>
+ * elf32-frv.c (frv_elf_link_hash_table_create): Use bfd_zalloc.
+ (_frv_add_rofixup): Don't inline.
+ (_frv_emit_got_relocs_plt_entries): Use NULL as funcdesc address
+ for undefweak symbols.
+ (elf32_frv_relocate_section): Avoid crash while computing
+ relocation when linking with shared library. Only emit rofixups
+ and dynamic relocations for alloc&load sections. Mark binaries
+ with inter-segment relocations for relocation as a unit.
+ (_frv_create_got_section): Rename .rofixup.got to .rofixup.
+ (DEFAULT_STACK_SIZE): New.
+ (_frv_count_got_plt_entries): Fix thinko in deciding whether to
+ emit rofixups or dynamic relocs when linking dynamic non-PIE
+ executables.
+ (elf32_frv_size_dynamic_sections): Generate rofixup on PIEs and
+ shared libs too. Reserve the last entry for the GOT pointer.
+ (elf32_frv_finish_dynamic_sections): Emit it.
+ (elf32_frv_always_size_sections): New.
+ (elf32_frv_modify_segment_map): New.
+ (elf32_frv_check_relocs): Reserve relocs32 space only in ALLOC
+ sections.
+ (frv_elf_merge_private_bfd_data): Clear PIC bit if FDPIC is set.
+ (frv_elf_print_private_bfd_data): Handle FDPIC and LIBPIC.
+ (elf_backend_always_size_sections): New.
+ (elf_backend_modify_segment_map): New.
+ 2003-10-31 Alexandre Oliva <aoliva@redhat.com>
+ * config.bfd: Added frv-*-*linux*.
+ * elf32-frv.c (_frv_emit_got_relocs_plt_entries): Use idx 0 for
+ ABS section, instead of crashing.
+ (elf32_frv_relocate_section): Don't crash before warning about
+ different segments in non-PIC relocation.
+ 2003-10-17 Alexandre Oliva <aoliva@redhat.com>
+ * elf32-frv.c (elf32_frv_relocate_section): Don't warn on LABEL24
+ relocs to undefweak symbols.
+ (elf32_frv_relocate_section): Ditto for undefined symbols.
+ 2003-10-06 Alexandre Oliva <aoliva@redhat.com>
+ * elf32-frv.c (elf32_frv_create_dynamic_sections): Make sure
+ gotfixup section was created.
+ 2003-09-30 Alexandre Oliva <aoliva@redhat.com>
+ * elf32-frv.c (elf32_frv_howto_table): Change GOT12,
+ FUNCDESC_GOT12, GOTOFF12 and FUNCDESC_GOTOFF12 to
+ complain_overflow_signed.
+ * elf32-frv.c (_frv_add_rofixup): Do not error out if contents
+ have not been allocated.
+ (_frv_emit_got_relocs_plt_entries): Return non-void. Assert
+ privfd only if dynamic sections were created.
+ (elf32_frv_relocate_section): Compute gprel_segment, and use it
+ for GPREL relocs. When linking relocatable FDPIC executables,
+ emit warnings for relocations that would be illegal on PIE or
+ shared libraries. Emit rofixup for R_FRV_32 only if input object
+ is not FDPIC.
+ (_frv_create_got_section): Define _gp symbol in the rofixup
+ section.
+ (elf32_frv_finish_dynamic_sections): If rofixups needed but
+ dynamic sections missing, error out requesting -melf32frvfd.
+ 2003-09-19 Alexandre Oliva <aoliva@redhat.com>
+ * elf32-frv.c (_frv_emit_got_relocs_plt_entries): Rearrange
+ computation of addends from section and global or local symbol
+ value. Change return type to bfd_boolean, and return a failure if
+ a dynamic FUNCDESC or FUNCDESC_VALUE relocation that requires a
+ nonzero addend is required.
+ (elf32_frv_relocate_section): Likewise. Print error for
+ unsupported nonzero addends.
+ 2003-09-18 Alexandre Oliva <aoliva@redhat.com>
+ * elf32-frv.c (FRV_SYM_LOCAL): In the absence of dynamic sections,
+ force everything local.
+ (_frv_emit_got_relocs_plt_entries): Cope with NULL sec.
+ * elf32-frv.c (struct frv_elf_link_hash_table): Added sgotfixup.
+ (frv_gotfixup_section): New.
+ (FRV_SYM_LOCAL): Accept undefweak and local common symbols.
+ (struct frv_pic_relocs_info): Split relocs into relocs32, relocsfd
+ and relocsfdv.
+ (_frv_add_rofixup): New.
+ (_frv_emit_got_relocs_plt_entries): Generate fixups for non-PIE
+ fdpic executables. Use FRV_SYM_LOCAL more widely to simplify and
+ improve some ugly conditions.
+ (elf32_frv_relocate_section): Likewise. Reject inter-segment
+ relocations in fdpic.
+ (_frv_create_got_section): Create .rofixup.got section.
+ (struct _frv_dynamic_got_info): Added fixups.
+ (_frv_count_got_plt_entries): Account in-GOT relocations into
+ relocs32, relocsfd and relocsfdv. Account them into relocs or
+ fixups, as appropriate.
+ (elf32_frv_size_dynamic_sections): Size rofixup section. Simplify
+ sizing of gotrel.
+ (elf32_frv_finish_dynamic_sections): Verify that the right number
+ of relocations and fixups was generated.
+ (elf32_frv_check_relocs): Compute relocs32, relocsfd and
+ relocsfdv.
+ * elf32-frv.c (FRV_SYM_LOCAL): New macro, used instead of
+ SYMBOL_CALLS_LOCAL and SYMBOL_REFERENCES_LOCAL.
+ (FRV_FUNCDESC_LOCAL): New macro, used to decide whether a function
+ descriptor of a (formerly-)global symbol is local.
+ (struct frv_pic_relocs_info): Adjust comments.
+ (_frv_emit_got_relocs_plt_entries): Adjust.
+ (elf32_frv_relocate_section): Likewise.
+ (_frv_count_got_plt_entries): Likewise.
+ * elf32-frv.c (_frv_emit_got_relocs_plt_entries): Don't add global
+ symbol's value to addend in the common preamble. Decay dynamic
+ symbols to section+offset if they bind or call locally, for GOT
+ and FUNCDESC_VALUE, respectively.
+ (elf32_frv_relocate_section): Likewise.
+ (elf32_frv_check_relocs): Don't register as dynamic symbols of
+ internal or hidden visibility.
+ 2003-09-17 Alexandre Oliva <aoliva@redhat.com>
+ * elf32-frv.c (_frv_emit_got_relocs_plt_entries): Get addend as
+ argument, so as to not call _bfd_elf_rel_local_sym to compute it.
+ (elf32_frv_relocate_section): Pass relocation addend in. Use
+ original relocation addend to look up the got relocs/plt entries
+ table. Do not call _bfd_elf_rel_local_sym. Don't error out when
+ processing relocations that reference .scommon symbols.
+ 2003-09-15 Alexandre Oliva <aoliva@redhat.com>
+ Introduce support for dynamic linking.
+ * elf32-frv.c (R_FRV_FUNCDESC_VALUE): Mark it as 64 bits.
+ (elf32_frv_rel_32_howto, elf32_frv_rel_funcdesc_howto,
+ elf32_frv_rel_funcdesc_value_howto): New REL descriptors.
+ (frv_reloc_type_lookup): Return REL howtos for executables and
+ dynamic libraries.
+ (frv_info_to_howto_rel): New.
+ (struct frv_elf_link_hash_table): New.
+ (frv_hash_table, frv_got_section, frv_gotrel_section,
+ frv_plt_section, frv_pltrel_section, frv_relocs_info,
+ frv_got_initial_offset, frv_plt_initial_offset): New macros.
+ (frv_elf_link_hash_table_create): New.
+ (struct frv_pic_relocs_info): New.
+ (frv_pic_relocs_info_hash, frv_pic_relocs_info_eq): New.
+ (frv_pic_relocs_info_find): New.
+ (frv_pic_relocs_info_for_global, frv_pic_relocs_info_for_local):
+ New.
+ (FRV_LZPLT_BLOCK_SIZE, FRV_LZPLT_RESOLVE_LOC): New.
+ (_frv_add_dyn_reloc, _frv_osec_to_segment): New.
+ (_frv_emit_got_relocs_plt_entries): New.
+ (elf32_frv_relocate_section): Add support for dynamic linking.
+ Handle new relocations.
+ (_frv_create_got_section): New.
+ (elf32_frv_create_dynamic_sections): New.
+ (ELF_DYNAMIC_INTERPRETER): New.
+ (struct _frv_dynamic_got_info): New.
+ (_frv_count_got_plt_entries): New.
+ (struct _frv_dynamic_got_plt_info): New.
+ (_frv_compute_got_alloc_data): New.
+ (_frv_get_got_entry, _frv_get_fd_entry): New.
+ (_frv_assign_got_entries, _frv_assign_plt_entries): New.
+ (_frv_resolve_final_relocs_info): New.
+ (elf32_frv_size_dynamic_sections): New.
+ (elf32_frv_finish_dynamic_sections): New.
+ (elf32_frv_adjust_dynamic_symbol): New.
+ (elf32_frv_finish_dynamic_symbol): New.
+ (elf32_frv_check_relocs): Handle new relocs. Explain how the
+ whole thing works.
+ (elf_info_to_howto_rel): Define.
+ (bfd_elf32_bfd_link_hash_table_create): Define.
+ (elf_backend_create_dynamic_sections): Define.
+ (elf_backend_adjust_dynamic_symbol): Define.
+ (elf_backend_size_dynamic_sections): Define.
+ (elf_backend_finish_dynamic_symbol): Define.
+ (elf_backend_finish_dynamic_sections): Define.
+ (elf_backend_want_got_sym): Define.
+ (elf_backend_got_header_size): Define.
+ (elf_backend_want_got_plt): Define.
+ (elf_backend_plt_readonly): Define.
+ (elf_backend_want_plt_sym): Define.
+ (elf_backend_plt_header_size): Define.
+ (elf_backend_may_use_rel_p): Define.
+ (elf_backend_may_use_rela_p): Define.
+ (elf_backend_default_use_rela_p): Define.
+ 2003-08-08 Alexandre Oliva <aoliva@redhat.com>
+ * elf32-frv.c (R_FRV_FUNCDESC_VALUE, R_FRV_FUNCDESC_GOTOFF12,
+ R_FRV_FUNCDESC_GOTOFFHI, R_FRV_FUNCDESC_GOTOFFLO, R_FRV_GOTOFF12,
+ R_FRV_GOTOFFHI, R_FRV_GOTOFFLO): New.
+ (frv_reloc_map): Map the corresponding BFD relocs to them.
+ (frv_reloc_type_lookup): ... and back to BFD relocs.
+ * reloc.c: New relocs.
+ * bfd-in2.h, libbfd.h: Rebuilt.
+ 2003-08-04 Alexandre Oliva <aoliva@redhat.com>
+ * elf32-frv.c (R_FRV_GOT12, R_FRV_GOTHI, R_FRV_GOTLO,
+ R_FRV_FUNCDESC, R_FRV_FUNCDESC_GOT12, R_FRV_FUNCDESC_GOTHI,
+ R_FRV_FUNCDESC_GOTLO): New.
+ (frv_reloc_map): Map the corresponding BFD relocs to them.
+ (frv_reloc_type_lookup): ... and back to BFD relocs.
+ * reloc.c: New relocs.
+ * bfd-in2.h, libbfd.h: Rebuilt.
-2002-01-04 Jason Thorpe <thorpej@wasabisystems.com>
+2004-01-05 Maciej W. Rozycki <macro@ds2.pg.gda.pl>
- * config.bfd (x86_64-*-netbsd*): New target.
- * configure.in (x86_64-*-netbsd*): Set COREFILE
- to netbsd-core.lo.
- * configure: Regenerated.
+ * 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.
-2002-01-03 Tom Rix <trix@redhat.com>
+2004-01-04 Mark Kettenis <kettenis@gnu.org>
- * xcofflink.c (_bfd_xcoff_bfd_final_link): Update .pad section ordering
- for recent bfd_make_section_anyway change.
+ * elf32-sparc.c (elf32_sparc_grok_psinfo): New function.
-2002-01-03 Nick Clifton <nickc@cambridge.redhat.com>
+2004-01-02 Mark Kettenis <kettenis@gnu.org>
- * elf32-arm.h (elf32_arm_final_link_relocate): Handle
- R_ARM_THM_PC11 reloc.
+ * elf32-i386.c (elf_i386_grok_prstatus): Add support for FreeBSD.
+ (elf_i386_grok_psinfo): Likewise.
-2002-01-02 Nick Clifton <nickc@cambridge.redhat.com>
+2004-01-02 Bernardo Innocenti <bernie@develer.com>
- * configure.in (LINGUAS): Add ja.
- * configure: Regenerate.
- * po/ja.po: Import from translation project's web site.
+ * config.bfd: Add m68k-uClinux target.
-2002-01-02 Nick Clifton <nickc@cambridge.redhat.com>
+2004-01-01 Grant Edwards <grante@visi.com>
- * elf32-arm.h (elf32_arm_merge_private_bfd_data): Reformat error
- messages to ease translation into other languages.
+ * 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-0001
+For older changes see ChangeLog-0203
Local Variables:
mode: change-log
diff --git a/contrib/binutils/bfd/ChangeLog-0001 b/contrib/binutils/bfd/ChangeLog-0001
index 3000c03..b5a3475 100644
--- a/contrib/binutils/bfd/ChangeLog-0001
+++ b/contrib/binutils/bfd/ChangeLog-0001
@@ -1514,7 +1514,7 @@
2001-10-08 Aldy Hernandez <aldyh@redhat.com>
- * bfd/config.bfd (targ_cpu): Add arm9e-*-elf.
+ * config.bfd (targ_cpu): Add arm9e-*-elf.
2001-10-06 Stephane Carrez <Stephane.Carrez@worldnet.fr>
@@ -2858,13 +2858,13 @@
2001-08-31 Eric Christopher <echristo@redhat.com>
Jason Eckhardt <jle@redhat.com>
- * bfd/archures.c: Add mipsisa32 and mipsisa64. Remove mips32,
+ * archures.c: Add mipsisa32 and mipsisa64. Remove mips32,
mips32_4k and mips64.
- * bfd/aoutx.h: Remove bfd_mach_mips32, bfd_mach_mips32_4k,
+ * aoutx.h: Remove bfd_mach_mips32, bfd_mach_mips32_4k,
bfd_mach_mips64. Add bfd_mach_mipsisa32, bfd_mach_mipsisa64.
- * bfd/cpu-mips.c: Ditto.
- * bfd/elf32-mips.c (_bfd_mips_elf_final_write_processing): Ditto.
- * bfd/bfd-in2.h: Regenerate.
+ * cpu-mips.c: Ditto.
+ * elf32-mips.c (_bfd_mips_elf_final_write_processing): Ditto.
+ * bfd-in2.h: Regenerate.
2001-08-31 Jakub Jelinek <jakub@redhat.com>
@@ -3726,7 +3726,7 @@
2001-07-04 H.J. Lu <hjl@gnu.org>
- * bfd/elf32-mips.c (_bfd_mips_elf_final_write_processing):
+ * elf32-mips.c (_bfd_mips_elf_final_write_processing):
Handle bfd_mach_mips4400, bfd_mach_mips4600 and
bfd_mach_mips5000.
@@ -4529,7 +4529,7 @@
* elf32-openrisc.c (openrisc_elf_howto_table): Do not complain
about overflow in R_OPENRISC_LO_16_IN_INSN and
- R_OPENRISC_HI_16_IN_INSN.Index: bfd/elf32-openrisc.c
+ R_OPENRISC_HI_16_IN_INSN.
2001-04-30 H.J. Lu <hjl@gnu.org>
diff --git a/contrib/binutils/bfd/ChangeLog-0203 b/contrib/binutils/bfd/ChangeLog-0203
new file mode 100644
index 0000000..f99029a
--- /dev/null
+++ b/contrib/binutils/bfd/ChangeLog-0203
@@ -0,0 +1,11405 @@
+2003-12-19 Kazuhiro Inaoka <inaoka.kazuhiro@renesas.com>
+
+ Adfd m32r-linux and PIC support. Add new ABI that uses RELA.
+ * config.bfd (m32r*-*-linux*, m32r*le-*-linux*, m32r*le-*-*): Added.
+ * configure.in (bfd_elf32_m32rlin_vec, bfd_elf32_m32rlelin_vec,
+ bfd_elf32_m32rle_vec): Added
+ * configure: Regenerated.
+ * elf32-m32r.c (m32r_info_to_howto, m32r_elf_adjust_dynamic_symbol,
+ m32r_elf_size_dynamic_sections, m32r_elf_create_dynamic_sections,
+ m32r_elf_finish_dynamic_sections, m32r_elf_finish_dynamic_symbol,
+ allocate_dynrelocs, readonly_dynrelocs, m32r_elf_reloc_type_class,
+ m32r_elf_fake_sections): Added.
+ (m32r_elf_howto_table): Added
+ R_M32R_16_RELA, R_M32R_32_RELA, R_M32R_24_RELA,
+ R_M32R_10_PCREL_RELA, R_M32R_18_PCREL_RELA,
+ R_M32R_26_PCREL_RELA, R_M32R_HI16_ULO_RELA,
+ R_M32R_HI16_SLO_RELA, R_M32R_LO16_RELA,
+ R_M32R_SDA16_RELA, R_M32R_RELA_GNU_VTINHERIT,
+ R_M32R_RELA_GNU_VTENTRY, R_M32R_GOT24,
+ R_M32R_26_PLTREL, R_M32R_COPY, R_M32R_GLOB_DAT,
+ R_M32R_JMP_SLOT, R_M32R_RELATIVE, R_M32R_GOTOFF,
+ R_M32R_GOTPC24, R_M32R_GOT16_HI_ULO,
+ R_M32R_GOT16_HI_SLO, R_M32R_GOT16_LO,
+ R_M32R_GOTPC_HI_ULO, R_M32R_GOTPC_HI_SLO,
+ R_M32R_GOTPC_LO.
+ (m32r_elf_relocate_section, m32r_elf_check_relocs): Changed for
+ New ABI.
+ * reloc.c: Add BFD_RELOC_M32R_GOT24, BFD_RELOC_M32R_26_PLTREL,
+ BFD_RELOC_M32R_COPY, BFD_RELOC_M32R_GLOB_DAT,
+ BFD_RELOC_M32R_JMP_SLOT, BFD_RELOC_M32R_RELATIVE,
+ BFD_RELOC_M32R_GOTOFF, BFD_RELOC_M32R_GOTPC24,
+ BFD_RELOC_M32R_GOT16_HI_ULO, BFD_RELOC_M32R_GOT16_HI_SLO,
+ BFD_RELOC_M32R_GOT16_LO, BFD_RELOC_M32R_GOTPC_HI_ULO,
+ BFD_RELOC_M32R_GOTPC_HI_SLO, BFD_RELOC_M32R_GOTPC_LO.
+ * targets.c (bfd_elf32_m32rlin_vec, bfd_elf32_m32rlelin_vec,
+ bfd_elf32_m32rle_vec): Added.
+ * bfd-in2.h: Regenerated.
+ * libbfd.h: Regenerated.
+
+2003-12-19 Danny Smith <dannysmith@users.sourceforge.net>
+
+ * coffcode.h (styp_to_sec_flags): Don't treat .reloc section
+ as SEC_DEBUGGING.
+
+2003-12-18 Richard Sandiford <rsandifo@redhat.com>
+
+ * elf32-mips.c (elf_mips_howto_table_rel): Replace all uses of
+ mips_elf_generic_reloc with _bfd_mips_elf_generic_reloc. Use
+ _bfd_mips_elf_hi16_reloc for R_MIPS_HI16 and R_MIPS_GNU_REL_HI16,
+ _bfd_mips_elf_lo16_reloc for R_MIPS_LO16 and R_MIPS_GNU_REL_LO16,
+ and _bfd_mips_elf_got16_reloc for R_MIPS_GOT16. Change rightshift
+ to 16 for R_MIPS_HI16 and R_MIPS_GNU_REL_HI16.
+ (mips_elf_generic_reloc, struct mips_hi16, mips_elf_hi16_reloc)
+ (mips_elf_lo16_reloc, mips_elf_got16_reloc): Delete.
+ (_bfd_mips_elf32_gprel16_reloc): Remove special case.
+ (mips_elf_gprel32_reloc, mips32_64bit_reloc): Likewise.
+
+ * elf64-mips.c (mips_elf64_howto_table_rel): Replace all uses of
+ mips_elf_generic_reloc with _bfd_mips_elf_generic_reloc. Use
+ _bfd_mips_elf_hi16_reloc for R_MIPS_HI16, _bfd_mips_elf_lo16_reloc
+ for R_MIPS_LO16 and _bfd_mips_elf_got16_reloc for R_MIPS_GOT16.
+ Change R_MIPS_HI16's rightshift to 16.
+ (mips_elf64_howto_table_rela): Replace all uses of
+ mips_elf_generic_reloc with _bfd_mips_elf_generic_reloc.
+ Use _bfd_mips_elf_generic_reloc for R_MIPS_GOT16 as well.
+ (mips_elf64_hi16_reloc, mips_elf64_got16_reloc): Delete.
+ (mips_elf64_shift6_reloc): Remove special case. Use
+ _bfd_mips_elf_generic_reloc instead of returning bfd_reloc_continue.
+
+ * elfn32-mips.c (prev_reloc_section): Delete.
+ (prev_reloc_address, prev_reloc_addend): Delete.
+ (elf_mips_howto_table_rel, elf_mips_howto_table_rela): As for
+ elf64-mips.c
+ (GET_RELOC_ADDEND, SET_RELOC_ADDEND): Delete.
+ (mips_elf_generic_reloc, struct mips_hi16, mips_elf_hi16_reloc)
+ (mips_elf_lo16_reloc, mips_elf_got16_reloc): Delete.
+ (mips_elf_gprel16_reloc): Delete use of GET_RELOC_ADDEND.
+ (mips_elf_literal_reloc, mips_elf_gprel32_reloc): Likewise.
+ (mips16_jump_reloc, mips16_gprel_reloc): Likewise.
+ (mips_elf_shift6_reloc): Likewise. Delete use of SET_RELOC_ADDEND.
+
+ * elfxx-mips.c (_bfd_mips_elf_gprel16_with_gp): Use
+ _bfd_relocate_contents to install an in-place addend.
+ (mips_hi16): New structure.
+ (mips_hi16_list): Moved from elf32-mips.c.
+ (_bfd_mips_elf_hi16_reloc, _bfd_mips_elf_got16_reloc): New functions.
+ (_bfd_mips_elf_lo16_reloc, _bfd_mips_elf_generic_reloc): New functions.
+ (mips_elf_calculate_relocation): Assume addend is unshifted.
+ (_bfd_mips_elf_relocate_section): Don't apply the howto rightshift
+ on top of the usual high-part shift. Don't shift the addend right
+ before calling mips_elf_calculate_relocation.
+
+ * elfxx-mips.h (_bfd_mips_elf_hi16_reloc): Declare.
+ (_bfd_mips_elf_got16_reloc, _bfd_mips_elf_lo16_reloc): Declare.
+ (_bfd_mips_elf_generic_reloc): Declare.
+
+2003-12-16 Eric Youngdale <eric@mkssoftware.com>
+ Nick Clifton <nickc@redhat.com>
+
+ * peicode.h (pe_ILF_build_a_bfd): Only skip one instance of each
+ prefix character, if they are present.
+
+2003-12-15 Dmitry Semyonov <Dmitry.Semyonov@oktet.ru>
+ Nick Clifton <nickc@redhat.com>
+
+ * peXXigen.c (_bfd_XXi_swap_scnhdr_out): Ensure that correct flags
+ are set on known section types.
+
+2003-12-12 Nick Clifton <nickc@redhat.com>
+
+ * po/ro.po: Updated translation.
+
+2003-12-12 Alan Modra <amodra@bigpond.net.au>
+
+ * elf64-hppa.c (elf64_hppa_link_output_symbol_hook): Check for
+ NULL dyn_h.
+
+2003-12-11 Nick Clifton <nickc@redhat.com>
+
+ * elf.c (INCLUDE_SECTION_IN_SEGMENT): Skip PT_GNU_STACK segments.
+
+2003-12-08 Richard Sandiford <rsandifo@redhat.com>
+
+ * elfxx-mips.h, elfxx-mips.c, cpu-mips.c: Convert prototypes.
+ Remove casts that were only needed for K&R compatibility.
+
+2003-12-08 Alan Modra <amodra@bigpond.net.au>
+
+ * elf-bfd.h (struct elf_backend_data): Remove "bfd *" and add
+ "elflink_hash_entry *" param to elf_backend_link_output_symbol_hook.
+ Add "elflink_hash_entry *" param to elf_backend_output_arch_syms.
+ * elflink.h (elf_link_output_sym): Add "elflink_hash_entry *" param,
+ and pass to output_symbol_hook.
+ (elf_bfd_final_link): Adjust elf_link_output_sym calls.
+ (elf_link_output_extsym): Likewise.
+ (elf_link_input_bfd): Likewise.
+ * elf32-sh64.c (sh64_elf_link_output_symbol_hook): Adjust.
+ * elf32-v850.c (v850_elf_link_output_symbol_hook): Likewise.
+ * elf64-mmix.c (mmix_elf_link_output_symbol_hook): Likewise.
+ * elf64-sh64.c (sh64_elf64_link_output_symbol_hook): Likewise.
+ * elfxx-mips.c (_bfd_mips_elf_link_output_symbol_hook): Likewise.
+ * elfxx-mips.h (_bfd_mips_elf_link_output_symbol_hook): Likewise.
+ * elf64-sparc.c (sparc64_elf_output_arch_syms): Likewise.
+ * elf64-hppa.c (elf64_hppa_link_output_symbol_hook): Likewise.
+ Validate dynh->h against h.
+ * elf64-ppc.c (struct ppc_link_hash_entry): Add adjust_done bitfield.
+ (link_hash_newfunc): Init it.
+ (adjust_opd_syms): New function.
+ (ppc64_elf_edit_opd): Set adjust_done when global .opd sym adjusted.
+ Set opd.adjust for all .opd relocs. Call adjust_opd_syms.
+ (ppc64_elf_tls_optimize): Adjust possible .opd sym values here.
+ (ppc64_elf_relocate_section): Also adjust syms not a multiple of 24.
+ (ppc64_elf_output_symbol_hook): New function.
+ (elf_backend_link_output_symbol_hook): Define.
+
+2003-12-07 Richard Sandiford <rsandifo@redhat.com>
+
+ * elf32-mips.c, elfn32-mips.c, elf64-mips.c: Convert prototypes.
+ Remove casts that were only needed for K&R compatibility.
+
+2003-12-05 Dmitry Semyonov <Dmitry.Semyonov@oktet.ru>
+
+ * coff-arm.c (aoutarm_std_reloc_howto [ARM_WINCE]): Set
+ partial_inplace for these relocs to FALSE for comptability with
+ the MS linker.
+ Remap ARM_26D relocation from 5 to 0. This fixes "bad fixup" error
+ generated by MS linker, and brings the relocation in line the MS
+ PE documentation.
+
+2003-12-04 H.J. Lu <hongjiu.lu@intel.com>
+
+ * elf32-ppc.c (ppc_elf_relax_section): Don't check relax_finalizing.
+
+2003-12-04 H.J. Lu <hongjiu.lu@intel.com>
+
+ * elfxx-ia64.c (elfNN_ia64_relax_section): Use the
+ need_relax_finalize field in link_info instead of
+ relax_finalizing to check if the relax finalize pass is being
+ done.
+
+2003-12-04 Dmitry Semyonov <Dmitry.Semyonov@oktet.ru>
+
+ * coff-arm.c (coff_arm_relocate_section, bfd_arm_process_before_allocation):
+ Change ARM26* to ARM_26* in comments to match definitions.
+ (coff_arm_adjust_symndx): Replace hard-coded constants with
+ appropriate definitions (ARM_26*).
+
+2003-12-04 Alan Modra <amodra@bigpond.net.au>
+
+ * coff-i860.c (coff_i860_reloc_nyi): Return bfd_reloc_not_supported.
+ * elf-m10300.c (elf32_mn10300_finish_hash_table_entry): Warning fixes.
+ (mn10300_elf_relax_section): Likewise.
+ * nlm32-alpha.c (ONES): Define.
+ (nlm32_alpha_howto_table): Use it to avoid warnings.
+
+2003-12-04 Alan Modra <amodra@bigpond.net.au>
+
+ * elf32-i386.c (elf_i386_object_p): Delete.
+ (elf_backend_object_p): Don't define.
+ * elf32-s390.c (elf_s390_object_p): No need to alloc tdata here.
+ * elf32-sh.c (sh_elf_object_p): Likewise.
+ * elf32-sparc.c (elf32_sparc_object_p): Likewise.
+ * elf64-alpha.c (elf64_alpha_object_p): Likewise.
+ * elf64-s390.c (elf_s390_object_p): Likewise.
+ * elf64-x86-64.c (elf64_x86_64_elf_object_p): Likewise.
+
+2003-12-03 Kazuhiro Inaoka <inaoka.kazuhiro@renesas.com>
+
+ * archures.c (bfd_mach_m32r2): Add new machine type.
+ * bfd-in2.h: Regenerate.
+ * cpu-m32r.c : Add new machine type.
+ * elf32-m32r.c (m32r_elf_object_p, m32r_elf_final_write_processing,
+ m32r_elf_merge_private_bfd_data): Add support for new machine
+ type.
+
+2003-12-03 Dave Airlie <airlied@linux.ie>
+
+ * config.bfd: Add vax-linux-gnu target.
+ * configure.in: Likewise.
+ * configure: Regenerate.
+
+2003-12-03 Alan Modra <amodra@bigpond.net.au>
+
+ * ecoff.c (ecoff_link_add_archive_symbols): Update for renamed
+ bfd_link_hash_entry field "next" -> "und_next".
+ * linker.c (_bfd_link_hash_newfunc): Likewise.
+ (bfd_link_add_undef): Likewise.
+ (_bfd_generic_link_add_archive_symbols): Likewise.
+ (_bfd_generic_link_add_one_symbol): Likewise.
+ * xcofflink.c (xcoff_link_add_symbols): Likewise.
+
+2003-12-02 Nick Clifton <nickc@redhat.com>
+
+ * configure.in (ALL_LINGUAS): Add ro.
+ * po/ro.po: New Romanian translation.
+
+2003-12-02 Alan Modra <amodra@bigpond.net.au>
+
+ * Makefile.am: Run "make dep-am".
+ * Makefile.in: Regenerate.
+
+2003-12-01 Dmitry Semyonov <Dmitry.Semyonov@oktet.ru>
+
+ * coffcode.h (coff_compute_section_file_positions): Set page_size
+ to 1 instead of 0 in the case file alignment value is zero.
+
+2003-12-01 Kazu Hirata <kazu@cs.umass.edu>
+
+ * coff-rs6000.c: Remove ARGSUSED and VARARGS.
+ * coff64-rs6000.c: Likewise.
+ * coffcode.h: Likewise.
+ * elf32-vax.c: Likewise.
+ * hash.c: Likewise.
+ * hppabsd-core.c: Likewise.
+ * hpux-core.c: Likewise.
+ * ihex.c: Likewise.
+ * netbsd-core.c: Likewise.
+ * osf-core.c: Likewise.
+ * pdp11.c: Likewise.
+ * ptrace-core.c: Likewise.
+ * sco5-core.c: Likewise.
+ * section.c: Likewise.
+ * sunos.c: Likewise.
+ * trad-core.c: Likewise.
+
+2003-12-01 Alan Modra <amodra@bigpond.net.au>
+
+ * elf-bfd.h (is_elf_hash_table): Take hash tab rather than info arg.
+ * elf.c (_bfd_elf_merge_sections): Adjust to suit.
+ (_bfd_elf_link_just_syms): Likewise.
+ (bfd_elf_get_needed_list): Likewise.
+ (bfd_elf_get_runpath_list): Likewise.
+ (_bfd_elf_link_hash_copy_indirect): Remove unneeded parens.
+ * elf32-hppa.c (elf32_hppa_setup_section_lists): Don't check hash tab
+ creator flavour.
+ (elf32_hppa_set_gp): Look up output sections rather than using htab.
+ * elf32-i960.c: Comment fix. Formatting.
+ * elf32-m32r.c (m32r_elf_add_symbol_hook): Use is_elf_hash_table
+ rather than testing creator flavour.
+ * elf32-sh64.c (sh64_elf_add_symbol_hook): Likewise.
+ * elf64-sh64.c (sh64_elf64_add_symbol_hook): Likewise.
+ * elflink.c (_bfd_elf_link_create_dynamic_sections): Adjust for
+ is_elf_hash_table change. Remove redundant test.
+ (bfd_elf_record_link_assignment): Use is_elf_hash_table rather than
+ testing creator flavour.
+ (elf_link_record_local_dynamic_symbol): Adjust for is_elf_hash_table.
+ (_bfd_elf_fix_symbol_flags): Likewise.
+ (_bfd_elf_adjust_dynamic_symbol): Likewise.
+ * elflink.h (elf_link_add_object_symbols): Likewise. Remove redundant
+ checks. Use is_elf_hash_table rather than testing creator flavour.
+ Use hash_table throughout in place of info->hash.
+ (elf_add_dynamic_entry): Adjust for is_elf_hash_table change.
+ (NAME(bfd_elf,size_dynamic_sections)): Likewise. Remove redundant
+ check.
+ (elf_bfd_final_link): Adjust for is_elf_hash_table change.
+ (elf_link_check_versioned_symbol): Use is_elf_hash_table rather than
+ testing creator flavour.
+ (elf_gc_sections): Add is_elf_hash_table check.
+ (elf_gc_common_finalize_got_offsets): Likewise.
+ (elf_bfd_discard_info): Adjust for is_elf_hash_table change. Remove
+ redundant check.
+ * elfxx-ia64.c (elfNN_ia64_relax_section): Use is_elf_hash_table
+ rather than testing creator flavour.
+
+2003-11-28 Christian Groessler <chris@groessler.org>
+
+ * cpu-z8k.c: Convert to ISO C90.
+ * coff-z8k.c: Likewise.
+
+2003-11-27 Alexandre Oliva <aoliva@redhat.com>
+
+ * elf-bfd.h (elf_backend_data::elf_backend_modify_segment_map):
+ Add link info argument.
+ * elf32-i370.c (elf_backend_modify_segment_map): Likewise.
+ * elf32-ppc.c (ppc_elf_modify_segment_map): Likewise.
+ * elf32-xtensa.c (elf_xtensa_modify_segment_map): Likewise.
+ * elf64-hppa.c (elf64_hppa_modify_segment_map): Likewise.
+ * elfxx-ia64.c (elfNN_ia64_modify_segment_map): Likewise.
+ * elfxx-mips.c (_bfd_mips_elf_modify_segment_map): Likewise.
+ * elfxx-mips.h (_bfd_mips_elf_modify_segment_map): Likewise.
+ * elf.c (assign_file_positions_except_relocs,
+ assign_file_positions_for_segments): Likewise. Adjust calls.
+
+2003-11-27 Mark Kettenis <kettenis@gnu.org>
+
+ * elf.c (elfcore_grok_netbsd_procinfo): Make a pseudosection out
+ of the note.
+
+2003-11-26 Daniel Jacobowitz <drow@mvista.com>
+ Richard Sandiford <rsandifo@redhat.com>
+
+ * elfxx-mips.c (mips_elf_set_global_got_offset): Don't set no_fn_stub.
+ (mips_elf_set_no_stub): New function.
+ (mips_elf_multi_got): Call it.
+ (_bfd_mips_elf_finish_dynamic_symbol): If a relocation is needed for
+ a secondary GOT entry, create an R_MIPS_32 or R_MIPS_64 relocation and
+ use mips_elf_create_dynamic_relocation to deal with any compatibility
+ issues. Store the adjusted addend in the GOT slot.
+
+2003-11-25 Mattias Engdegård <mattias@virtutech.se>
+
+ * stabs.c (_bfd_link_section_stabs): Skip N_EXCL stabs when
+ procesing N_BINCL stabs.
+
+2003-11-25 Alan Modra <amodra@bigpond.net.au>
+
+ * elf64-ppc.c (ppc_type_of_stub): Disallow stubs other than
+ ppc_stub_plt_call to symbols defined in shared libs.
+
+2003-11-22 Jakub Jelinek <jakub@redhat.com>
+
+ * elf-bfd.h (ELF_LINK_POINTER_EQUALITY_NEEDED): Define new flag.
+ * elf.c (_bfd_elf_link_hash_copy_indirect): Copy it.
+ * elf32-i386.c (elf_i386_copy_indirect_symbol): Likewise.
+ (elf_i386_check_relocs): Set it.
+ (elf_i386_finish_dynamic_symbol): If it is not set,
+ clear st_value of SHN_UNDEF symbol.
+
+2003-11-20 Jim Blandy <jimb@redhat.com>
+
+ * cpu-powerpc.c (powerpc_compatible): Any ISA in the PowerPC
+ family is a superset of <bfd_arch_rs6000,bfd_mach_rs6k>.
+
+2003-11-20 Martin Schwidefsky <schwidefsky@de.ibm.com>
+
+ * elf32-s390.c (elf_s390_relocate_section): Don't recalculate symbol
+ section for reloc output and subtract the output section's address
+ from the addend when converting a relocation into one against a
+ section symbol.
+ * elf64-s390.c (elf_s390_relocate_section): Likewise.
+
+2003-11-18 James E Wilson <wilson@specifixinc.com>
+
+ * elfxx-ia64.c (get_fptr): For fptr_rel, use dynobj not abfd.
+ (elfNN_ia64_size_dynamic_sections): When stripping sections, check
+ for ia64_info->rel_fptr_sec.
+
+2003-11-18 Alan Modra <amodra@bigpond.net.au>
+
+ * elf64-ppc.c (toc_adjusting_stub_needed): Exit early if section
+ size is zero.
+
+2003-11-17 Daniel Jacobowitz <drow@mvista.com>
+
+ * elf.c (_bfd_elf_link_hash_copy_indirect): Copy
+ ELF_LINK_HASH_NEEDS_PLT. Fix formatting.
+ * elf32-hppa.c (elf32_hppa_copy_indirect_symbol): Likewise.
+ * elf32-i386.c (elf_i386_copy_indirect_symbol): Likewise.
+ * elf32-ppc.c (ppc_elf_copy_indirect_symbol): Likewise.
+ * elf32-s390.c (elf_s390_copy_indirect_symbol): Likewise.
+ * elf32-sh.c (sh_elf_copy_indirect_symbol): Likewise.
+ * elf64-ppc.c (ppc64_elf_copy_indirect_symbol): Likewise.
+ * elf64-s390.c (elf_s390_copy_indirect_symbol): Likewise.
+ * elf64-x86-64.c (elf64_x86_64_copy_indirect_symbol): Likewise.
+ * elfxx-ia64.c (elfNN_ia64_hash_copy_indirect): Likewise.
+ * elf32-xtensa.c (elf_xtensa_copy_indirect_symbol): Remove.
+ (elf_backend_copy_indirect_symbol): Don't define.
+
+2003-11-14 Daniel Jacobowitz <drow@mvista.com>
+
+ * elfxx-mips.c (mips_elf_merge_gots): Weaken assert for local
+ GOT entries.
+
+2003-11-13 Martin Schwidefsky <schwidefsky@de.ibm.com>
+
+ * elf32-s390.c (elf_s390_relocate_section): Only convert R_390_32
+ to R_390_RELATIVE. Convert the other relocations against local
+ symbols to relocations against the start of the section.
+ * elf64-s390.c (elf_s390_relocate_section): Only convert R_390_64
+ to R_390_RELATIVE. Convert the other relocations against local
+ symbols to relocations against the start of the section.
+
+2003-11-11 Nick Clifton <nickc@redhat.com>
+
+ * elf-m10300.c (bfd_mn10300_elf_size_dynamic_sections): Use
+ info->executable not info->shared to decide if a .interp section
+ should be present.
+ * elf32-arm.h (elf32_arm_size_dynamic_sections): Likewise.
+ * elf32-cris.c (elf_cris_size_dynamic_sections): Likewise.
+ * elf32-hppa.c (elf32_hppa_size_dynamic_sections): Likewise.
+ * elf32-i370.c (i370_elf_size_dynamic_sections): Likewise.
+ * elf32-m68k.c (elf_m68k_size_dynamic_sections): Likewise.
+ * elf32-vax.c (elf_vax_size_dynamic_sections): Likewise.
+ * elf32-xtensa.c (elf_xtensa_size_dynamic_sections): Likewise.
+ * elf64-hppa.c (elf64_hppa_size_dynamic_sections): Likewise.
+ * elfxx-mips.c (_bfd_mips_size_dynamic_sections): Likewise.
+ * elflink.h (size_dynamic_sections): Likewise.
+
+2003-11-10 Jonathan Wilson <jonwil@tpgi.com.au>
+
+ * peXXigen.c (_bfd_XXi_swap_aouthdr_out): Swap out tls pointer.
+ (_bfd_XXi_final_link_postscript): Look for __tks_used symbol. If
+ found initialise the tls data directory entry.
+
+2003-11-07 Alan Modra <amodra@bigpond.net.au>
+
+ * elf32-ppc.c (ppc_elf_install_value): Delete.
+ (shared_stub_entry, stub_entry): Make them arrays of ints.
+ Remove initial branch.
+ (ppc_elf_relax_section): Write one branch around all trampolines
+ instead. Correct bogus R_PPC_PLTREL24 handling. Correct
+ branch range check. Only use shared_stub_entry when shared.
+ Test that branches can reach stubs. Write trampolines out at
+ end so that just one realloc is used. Handle little-endian
+ mode. Move relevant code from ppc_elf_install_value to here.
+ (ppc_elf_relocate_section): Move code handling RELAX32 from
+ ppc_elf_install_value to here.
+
+2003-11-06 Alan Modra <amodra@bigpond.net.au>
+
+ * elf32-ppc.c (ppc_elf_howto_raw); Add entry for R_PPC_RELAX32PC.
+ (ppc_elf_install_value): Handle R_PPC_RELAX32PC. Merge duplicate
+ cases.
+ (shared_stub_entry): Correct opcode.
+ (ppc_elf_relax_section): Generate R_PPC_RELAX32PC relocs.
+ (ppc_elf_relocate_section): Handle them.
+
+2003-11-05 Alan Modra <amodra@bigpond.net.au>
+
+ * elf.c (_bfd_elf_rela_local_sym): Accept asection **, and return
+ updated section in case of merged section.
+ * elf-bfd.h (_bfd_elf_rela_local_sym): Update declaration.
+ * elf-hppa.h (elf_hppa_relocate_section): Adjust call.
+ * elf-m10200.c (mn10200_elf_relocate_section): Likewise.
+ * elf-m10300.c (mn10300_elf_relocate_section): Likewise.
+ * elf32-arm.h (elf32_arm_relocate_section): Likewise.
+ * elf32-avr.c (elf32_avr_relocate_section): Likewise.
+ * elf32-cris.c (cris_elf_relocate_section): Likewise.
+ * elf32-fr30.c (fr30_elf_relocate_section): Likewise.
+ * elf32-frv.c (elf32_frv_relocate_section): Likewise.
+ * elf32-h8300.c (elf32_h8_relocate_section): Likewise.
+ * elf32-hppa.c (elf32_hppa_relocate_section): Likewise.
+ * elf32-i370.c (i370_elf_relocate_section): Likewise.
+ * elf32-i860.c (elf32_i860_relocate_section): Likewise.
+ * elf32-m32r.c (m32r_elf_relocate_section): Likewise.
+ * elf32-m68k.c (elf_m68k_relocate_section): Likewise.
+ * elf32-mcore.c (mcore_elf_relocate_section): Likewise.
+ * elf32-msp430.c (elf32_msp430_relocate_section): Likewise.
+ * elf32-openrisc.c (openrisc_elf_relocate_section): Likewise.
+ * elf32-ppc.c (ppc_elf_relocate_section): Likewise.
+ * elf32-s390.c (elf_s390_relocate_section): Likewise.
+ * elf32-sh.c (sh_elf_relocate_section): Likewise.
+ * elf32-sparc.c (elf32_sparc_relocate_section): Likewise.
+ * elf32-v850.c (v850_elf_relocate_section) Likewise.
+ * elf32-vax.c (elf_vax_relocate_section): Likewise.
+ * elf32-xstormy16.c (xstormy16_elf_relocate_section): Likewise.
+ * elf32-xtensa.c (elf_xtensa_relocate_section): Likewise.
+ * elf64-alpha.c (elf64_alpha_relocate_section): Likewise.
+ * elf64-mmix.c (mmix_elf_relocate_section): Likewise.
+ * elf64-ppc.c (ppc64_elf_relocate_section): Likewise.
+ * elf64-s390.c (elf_s390_relocate_section): Likewise.
+ * elf64-sh64.c (sh_elf64_relocate_section): Likewise.
+ * elf64-sparc.c (sparc64_elf_relocate_section): Likewise.
+ * elf64-x86-64.c (elf64_x86_64_relocate_section): Likewise.
+ * elfxx-ia64.c (elfNN_ia64_relocate_section): Likewise.
+
+ * elf32-cris.c (cris_elf_relocate_section): Don't recalculate symbol
+ section for reloc output.
+ * elf32-i370.c (i370_elf_relocate_section): Likewise.
+ * elf32-m68k.c (elf_m68k_relocate_section): Likewise.
+ * elf32-sparc.c (elf32_sparc_relocate_section): Likewise.
+ * elf32-vax.c (elf_vax_relocate_section): Likewise.
+ * elf64-sparc.c (sparc64_elf_relocate_section): Likewise.
+ * elf64-x86-64.c (elf64_x86_64_relocate_section): Likewise.
+
+ * elf32-ppc.c (ppc_elf_relocate_section): Don't recalculate everything
+ for R_PPC_RELAX32 reloc. Don't bother checking ppc_elf_install_value
+ return value.
+ * elf64-ppc.c (ppc64_elf_relocate_section <R_PPC64_TOC>): Sanity check
+ sec->id.
+
+2003-11-05 Alan Modra <amodra@bigpond.net.au>
+
+ * elf32-d10v.c (extract_rel_addend, insert_rel_addend): New functions.
+ (elf32_d10v_relocate_section): Use them to handle -r reloc
+ adjustments, and in place of _bfd_elf_rela_local_sym.
+
+ * cpu-iq2000.c (arch_info_struct): Warning fix.
+
+2003-11-05 Alan Modra <amodra@bigpond.net.au>
+
+ * elf32-hppa.c (ELIMINATE_COPY_RELOCS): Define.
+ (elf32_hppa_copy_indirect_symbol): Don't copy NON_GOT_REF on
+ weakdefs.
+ (elf32_hppa_check_relocs): Use ELIMINATE_COPY_RELOCS.
+ (elf32_hppa_adjust_dynamic_symbol): Likewise. Copy weakdef
+ NON_GOT_REF.
+ (allocate_dynrelocs): Use ELIMINATE_COPY_RELOCS and
+ SYMBOL_CALLS_LOCAL. Discard relocs for undef weak syms with
+ non-default visibility.
+ (elf32_hppa_relocate_section): Use ELIMINATE_COPY_RELOCS and
+ SYMBOL_CALLS_LOCAL.
+
+2003-11-04 Alan Modra <amodra@bigpond.net.au>
+
+ * aout-target.h, aoutf1.h, bfdio.c, bfdwin.c: Update copyright date.
+ * coff-apollo.c, coff-sparc.c, coff-w65.c, coff-we32k.c: Ditto.
+ * coff-z8k.c, coffgen.c, cpu-frv.c, cpu-h8500.c, cpu-hppa.c: Ditto.
+ * cpu-ia64-opc.c, cpu-m10300.c, cpu-mips.c, cpu-msp430.c: Ditto.
+ * cpu-rs6000.c, cpu-z8k.c, efi-app-ia32.c, elf32-am33lin.c: Ditto.
+ * gen-aout.c, hash.c, hp300hpux.c, init.c, mach-o.c: Ditto.
+ * nlm-target.h, nlm.c, som.h, stabs.c, sysdep.h, xsym.h: Ditto.
+
+ * elf-m10300.c (_bfd_mn10300_elf_create_got_section): Fix
+ "dereferencing type-punned pointer" warnings.
+
+ * aout-adobe.c (aout_adobe_set_section_contents): Constify location.
+ * aoutx.h (NAME(aout,set_section_contents)): Ditto.
+ * bfd-in2.h: Regenerate.
+ * binary.c (binary_set_section_contents): Ditto.
+ * bout.c (b_out_set_section_contents): Ditto.
+ * coff-tic54x.c (tic54x_set_section_contents): Ditto.
+ * coffcode.h (coff_set_section_contents): Ditto.
+ * ecoff.c (_bfd_ecoff_set_section_contents): Ditto.
+ * elf-bfd.h (_bfd_elf_set_section_contents): Ditto.
+ * elf.c (_bfd_elf_set_section_contents): Ditto.
+ * elfxx-mips.c (_bfd_mips_elf_set_section_contents): Ditto.
+ * elfxx-mips.h (_bfd_mips_elf_set_section_contents): Ditto.
+ * i386msdos.c (msdos_set_section_contents): Ditto.
+ * ieee.c (ieee_set_section_contents): Ditto.
+ * ihex.c (ihex_set_section_contents): Ditto.
+ * libaout.h (NAME(aout,set_section_contents)): Ditto.
+ * libbfd-in.h (_bfd_nowrite_set_section_contents): Ditto.
+ (_bfd_generic_set_section_contents): Ditto.
+ * libbfd.h: Regenerate.
+ * libbfd.c (_bfd_generic_set_section_contents): Ditto.
+ * libecoff.h (_bfd_ecoff_set_section_contents): Ditto.
+ * libnlm.h (nlmNAME(set_section_contents)): Ditto.
+ (struct nlm_backend_data <nlm_mangle_relocs>): Ditto.
+ * mmo.c (mmo_set_section_contents): Ditto.
+ * nlm32-alpha.c (nlm_alpha_mangle_relocs): Ditto.
+ * nlm32-i386.c (nlm_i386_mangle_relocs): Ditto.
+ * nlm32-ppc.c (nlm_powerpc_mangle_relocs): Ditto.
+ * nlm32-sparc.c (nlm_sparc_mangle_relocs): Ditto.
+ * nlmcode.h (nlm_set_section_contents): Ditto.
+ * oasys.c (oasys_set_section_contents): Ditto.
+ * pdp11.c (NAME(aout,set_section_contents)): Ditto.
+ * ppcboot.c (ppcboot_set_section_contents): Ditto.
+ * srec.c (srec_set_section_contents): Ditto.
+ * targets.c (BFD_JUMP_TABLE_WRITE <_bfd_set_section_contents>): Ditto.
+ * tekhex.c (tekhex_set_section_contents): Ditto.
+ (move_section_contents): Ditto.
+ * versados.c (versados_set_section_contents): Ditto.
+ * vms-misc.c (_bfd_save_vms_section): Ditto.
+ * vms.c (vms_set_section_contents): Ditto.
+ * vms.h (_bfd_save_vms_section): Ditto.
+
+2003-11-04 Alan Modra <amodra@bigpond.net.au>
+
+ * elf64-ppc.c (ppc_size_one_stub): Size relbrlt. Accept info arg
+ rather than htab.
+ (ppc64_elf_size_stubs): Adjust ppc_size_one_stub traversal. Zero
+ relbrlt size.
+ (ppc64_elf_build_stubs): Allocate space for relbrlt.
+
+2003-11-04 Alan Modra <amodra@bigpond.net.au>
+
+ * bfd-in.h (_bfd_elf_tls_setup): Declare.
+ * bfd-in2.h: Regenerate.
+ * elf-bfd.h (struct elf_link_tls_segment): Delete.
+ (struct elf_link_hash_table): Add tls_sec and tls_size.
+ * elf.c (_bfd_elf_link_hash_table_init): Init tls_sec and tls_size.
+ * elflink.c (_bfd_elf_tls_setup): New function.
+ * elflink.h (struct elf_final_link_info): Remove first_tls_sec.
+ (elf_bfd_final_link): Don't set first_tls_sec here. Update code
+ saving tls segment info, round segment size up.
+ (elf_link_output_extsym): Adjust code using tls segment info.
+ (elf_link_input_bfd): Likewise.
+ * elf32-i386.c (dtpoff_base, tpoff): Likewise.
+ * elf32-s390.c (dtpoff_base, tpoff): Likewise.
+ * elf32-sh.c (dtpoff_base, tpoff): Likewise.
+ * elf32-sparc.c (dtpoff_base, tpoff): Likewise.
+ * elf64-s390.c (dtpoff_base, tpoff): Likewise.
+ * elf64-x86-64.c (dtpoff_base, tpoff): Likewise.
+ * elfxx-ia64.c (elfNN_ia64_tprel_base): Likewise.
+ (elfNN_ia64_dtprel_base): Likewise.
+ * elf64-alpha.c (alpha_get_dtprel_base): Likewise.
+ (alpha_get_tprel_base): Likewise.
+ (struct alpha_relax_info): Remove tls_segment.
+ (elf64_alpha_relax_got_load): Adjust invocation of
+ alpha_get_dtprel_base and alpha_get_tprel_base.
+ (elf64_alpha_relax_tls_get_addr): Likewise.
+ (elf64_alpha_relax_section): Likewise.
+ (elf64_alpha_relocate_section): Likewise.
+ (elf64_alpha_relax_find_tls_segment): Delete.
+ * elf32-ppc.c (struct ppc_elf_link_hash_table): Remove tls_sec.
+ (ppc_elf_tls_setup): Call _bfd_elf_tls_setup. Return section.
+ (ppc_elf_relocate_section): Adjust to use elf.tls_sec.
+ * elf32-ppc.h (ppc_elf_tls_setup): Update.
+ * elf64-ppc.c (struct ppc_link_hash_table): Remove tls_sec.
+ (ppc64_elf_tls_setup): Call _bfd_elf_tls_setup. Return section.
+ (ppc64_elf_tls_optimize): Adjust to use elf.tls_sec.
+ (ppc64_elf_relocate_section): Likewise.
+ * elf64-ppc.h (ppc64_elf_tls_setup): Update.
+
+2003-11-03 Daniel Jacobowitz <drow@mvista.com>
+
+ * elf-bfd.h (struct elf_backend_data): Remove plt_header_size.
+ * elf-m10300.c (elf_backend_plt_header_size): Don't define.
+ * elf32-arm.h (elf_backend_plt_header_size): Don't define.
+ * elf32-cris.c (elf_backend_plt_header_size): Don't define.
+ * elf32-i386.c (elf_backend_plt_header_size): Don't define.
+ * elf32-mips.c (elf_backend_plt_header_size): Don't define.
+ * elf32-ppc.c (elf_backend_plt_header_size): Don't define.
+ * elf32-s390.c (elf_backend_plt_header_size): Don't define.
+ * elf32-sh.c (elf_backend_plt_header_size): Don't define.
+ * elf32-sparc.c (elf_backend_plt_header_size): Don't define.
+ * elf64-alpha.c (elf_backend_plt_header_size): Don't define.
+ * elf64-hppa.c (elf_backend_plt_header_size): Don't define.
+ * elf64-mips.c (elf_backend_plt_header_size): Don't define.
+ * elf64-ppc.c (elf_backend_plt_header_size): Don't define.
+ * elf64-s390.c (elf_backend_plt_header_size): Don't define.
+ * elf64-sh64.c (elf_backend_plt_header_size): Don't define.
+ * elf64-sparc.c (elf_backend_plt_header_size): Don't define.
+ * elf64-x86-64.c (elf_backend_plt_header_size): Don't define.
+ * elfn32-mips.c (elf_backend_plt_header_size): Don't define.
+ * elfxx-ia64.c (elf_backend_plt_header_size): Don't define.
+ * elfxx-target.h (elf_backend_plt_header_size): Don't define
+ or include in target initializer.
+
+2003-11-03 Andrew Cagney <cagney@redhat.com>
+
+ * section.c (bfd_set_section_contents): Make the "location" buffer
+ constant.
+ * bfd-in2.h: Re-generate.
+
+2003-10-30 Andrew Cagney <cagney@redhat.com>
+
+ * syms.c: Replace "struct symbol_cache_entry" with "struct
+ bfd_symbol".
+ * vms.h, targets.c, section.c, reloc.c, peicode.h: Ditto.
+ * mipsbsd.c, elf.c, linker.c, elf-bfd.h, ecoff.c: Ditto.
+ * cpu-z8k.c, cpu-ns32k.c, cpu-h8500.c, bfd.c, bfd-in.h: Ditto.
+ * bfd-in2.h: Re-generate.
+
+2003-10-30 Jakub Jelinek <jakub@redhat.com>
+
+ * elfxx-ia64.c: Include objalloc.h, hashtab.h.
+ (struct elfNN_ia64_local_hash_entry): Remove root. Add id and r_sym
+ fields.
+ (struct elfNN_ia64_local_hash_table): Remove.
+ (struct elfNN_ia64_link_hash_table): Change loc_hash_table's type
+ to htab_t. Add loc_hash_memory field.
+ (elfNN_ia64_local_hash_table_init, elfNN_ia64_new_loc_hash_entry):
+ Removed.
+ (elfNN_ia64_local_htab_hash, elfNN_ia64_local_htab_eq): New
+ functions.
+ (elfNN_ia64_hash_table_create): Use hashtab.h hashtable for
+ loc_hash_table. Initialize loc_hash_memory.
+ (elfNN_ia64_hash_table_free): New function.
+ (elfNN_ia64_local_hash_lookup): Remove.
+ (elfNN_ia64_local_dyn_sym_thunk): Change into htab_traverse
+ callback.
+ (elfNN_ia64_dyn_sym_traverse): Use htab_traverse.
+ (get_local_sym_hash): Use hashtab.h hashtable for loc_hash_table.
+ (bfd_elfNN_bfd_link_hash_table_free): Define.
+
+2003-10-30 Alan Modra <amodra@bigpond.net.au>
+
+ * elflink.c (_bfd_elf_link_record_dynamic_symbol): Modify versioned
+ symbol string in place.
+
+2003-10-30 Jim Blandy <jimb@redhat.com>
+
+ * cpu-rs6000.c (rs6000_compatible): Check the correct arch_info
+ object's mach field: all PowerPC machines are supersets of the
+ original rs6000, but not later rs6000 machines.
+
+2003-10-30 Alan Modra <amodra@bigpond.net.au>
+
+ * dwarf2.c (struct attribute): Delete "unsnd", "snd" and "addr".
+ Add "val" and "sval" fields.
+ (DW_STRING, DW_UNSND, DW_BLOCK, DW_SND, DW_ADDR): Delete.
+ (read_attribute_value): Expand and adjust DW_* occurrences.
+ (scan_unit_for_functions, parse_comp_unit): Likewise.
+
+2003-10-30 Phil Edwards <phil@codesourcery.com>
+
+ * config.bfd (arm-*-vxworks): Remove separate stanza; merge with
+ other common ELF triples.
+ (i[3-7]86-*-vxworks): Change to ELF format.
+ (mips*-*-windiss): New triple, add to common MIPS/ELF stanza.
+ (sh-*-vxworks): New stanza.
+
+2003-10-30 Lars Knoll <lars@trolltech.com>
+ Michael Matz <matz@suse.de>
+ Jakub Jelinek <jakub@redhat.com>
+ Alan Modra <amodra@bigpond.net.au>
+
+ * merge.c (struct sec_merge_sec_info): Update comment.
+ (struct sec_merge_hash_entry): Remove entsize.
+ (sec_merge_hash_lookup): Only adjust alignment when creating.
+ (sec_merge_emit): Remove register keyword.
+ (cmplengthentry, last4_eq, last_eq): Delete.
+ (strrevcmp, strrevcmp_align, is_suffix): New.
+ (merge_strings): Use them to implement fast suffix merging.
+ * elf-strtab.c (struct elf_strtab_hash_entry): Update comments.
+ Make "len" signed.
+ (_bfd_elf_strtab_add): Lose on >2G strings.
+ (_bfd_elf_strtab_emit): Don't emit strings with len < 0.
+ (cmplengthentry, last4_eq): Delete.
+ (strrevcmp, is_suffix): New.
+ (_bfd_elf_strtab_finalize): Rework to implement fast suffix merging.
+
+2003-10-29 Daniel Jacobowitz <drow@mvista.com>
+
+ * elf32-arm.h (elf32_arm_final_link_relocate): Move check for
+ SEC_ALLOC.
+
+2003-10-29 Philip Blundell <philb@gnu.org>
+
+ * elf32-arm.h (elf32_arm_plt0_entry, elf32_arm_plt_entry): New
+ code sequence.
+ (PLT_HEADER_SIZE): New.
+ (struct elf32_arm_pcrel_relocs_copied): Rename to ...
+ (struct elf32_arm_relocs_copied): ... this. Count both
+ pcrel and non-pcrel relocs. All uses updated.
+ (struct elf32_arm_link_hash_table): Add pointers to dynamic linker
+ sections and symbol/section mapping cache.
+ (create_got_section): New.
+ (elf32_arm_create_dynamic_sections): New.
+ (elf_backend_create_dynamic_sections): Use it.
+ (elf32_arm_final_link_relocate): Support garbage collection of relocs.
+ (elf32_arm_check_relocs): Likewise.
+ (elf32_arm_adjust_dynamic_symbol): Likewise.
+ (elf32_arm_copy_indirect_symbol): New.
+ (elf32_arm_link_hash_table_create): Initialise new fields.
+ (elf32_arm_gc_sweep_hook): Implement.
+ (elf32_arm_discard_copies): Delete.
+ (elf32_arm_finish_dynamic_symbol): Use new PLT code.
+ (elf32_arm_finish_dynamic_sections): Likewise.
+ (elf_backend_can_refcount): Define.
+ (elf_backend_copy_indirect_symbol): Likewise.
+ (elf_backend_plt_header_size): Set to PLT_HEADER_SIZE.
+
+2003-10-29 Alan Modra <amodra@bigpond.net.au>
+
+ * elf64-ppc.c (elf_backend_grok_prstatus): Define.
+ (elf_backend_grok_psinfo): Define.
+ (ppc64_elf_grok_prstatus, ppc64_elf_grok_psinfo): New functions.
+
+ * elf.c (_bfd_elfcore_make_pseudosection): Allow multiple
+ sections with the same name.
+ (elfcore_grok_lwpstatus): Likewise.
+ (elfcore_grok_win32pstatus): Likewise.
+ (elfcore_grok_note): Likewise.
+ (elfcore_grok_nto_status): Likewise.
+ (elfcore_grok_nto_gregs): Likewise.
+
+2003-10-27 Daniel Jacobowitz <drow@mvista.com>
+
+ * elf32-arm.h (elf32_arm_merge_private_bfd_data): Never skip dynamic
+ objects.
+
+2003-10-14 Richard Sandiford <rsandifo@redhat.com>
+
+ * elfxx-mips.c (mips_elf_create_got_section): Initialize global_gotno.
+
+2003-10-24 H.J. Lu <hongjiu.lu@intel.com>
+
+ * elflink.h (NAME(bfd_elf,size_dynamic_sections)): Look up
+ hash table for real symbols.
+
+2003-10-23 Michael Snyder <msnyder@redhat.com>
+
+ * section.c (asection): Fix typo in comment.
+
+2003-10-23 Alan Modra <amodra@bigpond.net.au>
+
+ * elf64-ppc.c (get_tls_mask): Add toc_symndx param, save toc
+ reloc symbol index to it. Don't allow gd syms in shared libs
+ to be optimized.
+ (ppc64_elf_tls_optimize): Adjust get_tls_mask call.
+ (ppc64_elf_size_stubs): Likewise.
+ (ppc64_elf_relocate_section): Check that tls relocs are only used
+ with tls syms, and similarly for non-tls. Correct symbol used
+ when optimizing toc tls code.
+
+2003-10-22 Nick Clifton <nickc@redhat.com>
+
+ * peicode.h (coff_swap_scnhdr_in): Only remove padding when
+ processing an executable.
+
+2003-10-22 Jakub Jelinek <jakub@redhat.com>
+
+ * elflink.c (_bfd_elf_export_symbol): Adjust for globals and locals
+ field changes.
+ (_bfd_elf_link_assign_sym_version): Likewise.
+ * elflink.h (size_dynamic_sections): Likewise.
+
+2003-10-21 Alexandre Oliva <aoliva@redhat.com>,
+ Michael Snyder <msnyder@redhat.com>
+
+ * archures.c (bfd_mach_sh4a, bfd_mach_sh4al_dsp, bfd_mach_sh4_nofpu,
+ bfd_mach_sh4a_nofpu): New machine types.
+ * bfd-in2.h: Rebuilt.
+ * cpu-sh.c (compatible): Remove unused function.
+ (SH4A_NEXT, SH4AL_DSP_NEXT, SH4_NOFPU_NEXT, SH4A_NOFPU_NEXT): New.
+ (arch_info_struct): Add sh4a, sh4al_dsp, sh4-nofpu and sh4a-nofpu.
+ * elf32-sh.c (sh_elf_set_mach_from_flags): Handle them.
+
+2003-10-21 Wouter van Heyst <wouter@vidicode.nl>
+
+ * elf32-arm.h (elf32_arm_merge_private_bfd_data): Correct text
+ describing mismatched formats involving the Maverick FP type.
+
+2003-10-21 Anil Paranjpe <anilp1@KPITCummins.com>
+
+ * binary.c (binary_object_p): Pass machine flag along with
+ architecture.
+
+2003-10-21 Thorsten Brehm <brehm@gmx.net>
+
+ * archures.c (bfd_default_scan): Add support for mcf528x.
+ * ieee.c (ieee_write_processor): Likewise.
+
+2003-10-21 Peter Barada <pbarada@mail.wm.sps.mot.com>
+ Bernardo Innocenti <bernie@develer.com>
+
+ * archures.c: Add MCF528x (MCFv4) support.
+ * bfd/cpu-m68k.c (arch_info_struct): Likewise.
+ * bfd-in2.h: Regenerate.
+
+2003-10-20 Andrew Cagney <cagney@redhat.com>
+
+ * targets.c: Replace "struct sec" with "struct bfd_section"
+ * syms.c, sparclynx.c, section.c, opncls.c: Ditto.
+ * libcoff-in.h, libbfd-in.h, elfxx-target.h: Ditto.
+ * elf.c, coffgen.c, bfd.c, bfd-in.h, aoutf1.h: Ditto.
+ * aout-tic30.c, aout-target.h:
+ * bfd-in2.h, libcoff.h, libbfd.h: Regenerate.
+
+2003-10-18 Hans-Peter Nilsson <hp@bitrange.com>
+
+ Support linker relaxation of new R_MMIX_PUSHJ_STUBBABLE relocs.
+ * elf64-mmix.c (MAX_PUSHJ_STUB_SIZE): New macro.
+ (struct _mmix_elf_section_data): New member pjs.
+ (mmix_set_relaxable_size, mmix_elf_get_section_contents): New
+ functions.
+ (elf_mmix_howto_table): New entry for R_MMIX_PUSHJ_STUBBABLE.
+ (mmix_reloc_map): Ditto.
+ (mmix_elf_relocate_section): Handle R_MMIX_PUSHJ_STUBBABLE.
+ (mmix_final_link_relocate, mmix_elf_check_common_relocs): Ditto.
+ (mmix_elf_perform_relocation): Ditto. Don't mark parameter addr
+ unused.
+ (mmix_elf_check_relocs): Move early return to after
+ mmix_elf_check_common_relocs call.
+ (mmix_elf_symbol_processing): Fix cut-and-pasto in head comment.
+ (_bfd_mmix_before_linker_allocation): Rename from
+ _bfd_mmix_prepare_linker_allocated_gregs. All referers changed.
+ Arrange to set the initial relaxable size of sections.
+ (_bfd_mmix_after_linker_allocation): Rename from
+ _bfd_mmix_finalize_linker_allocated_gregs.
+ (mmix_elf_relax_section): Relax a R_MMIX_PUSHJ_STUBBABLE reloc.
+ (bfd_elf64_get_section_contents): Define.
+ * reloc.c: Add ENUMX for BFD_RELOC_MMIX_PUSHJ_STUBBABLE.
+ * libbfd.h, bfd-in2.h: Regenerate.
+
+ * reloc.c (bfd_generic_relax_section): Default-set
+ section->_cooked_size here.
+ (bfd_generic_get_relocated_section_contents): Don't set it here.
+ Explain why.
+
+2003-10-17 John David Anglin <dave.anglin@nrc-cnrc.gc.ca>
+
+ * elf32-hppa.c (elf32_hppa_relocate_section): Skip relocation if
+ output section has been discarded.
+
+2003-10-17 Shrinivas Atre <shrinivasa@KPITCummins.com>
+
+ * coff-h8300.c (funcvec_hash_newfunc): Handle normal mode.
+ (h8300_reloc16_extra_cases): Likewise.
+ (h8300_bfd_link_add_symbols): Likewise.
+
+2003-10-17 Dhananjay Deshpande <dhananjayd@kpitcummins.com>
+
+ * cpu-h8300.c (h8300sxn_info_struct): Correct address size.
+ (h8300sn_info_struct): Likewise.
+ (h8300hn_info_struct): Likewise.
+
+2003-10-16 Pavel Roskin <proski@gnu.org>
+
+ * peXXigen.c (_bfd_XXi_swap_aouthdr_out): Don't calculate image size
+ for sections which lack size info.
+
+2003-10-17 Danny Smith <dannysmith@users.sourceforge.net>
+
+ * configure.host: Add __USE_MINGW_FSEEK to HDEFINES for
+ mingw32.
+
+2003-10-16 H.J. Lu <hongjiu.lu@intel.com>
+
+ * elflink.h (NAME(bfd_elf,size_dynamic_sections)): Also warn
+ undefined patterns with '*'.
+
+2003-10-16 H.J. Lu <hongjiu.lu@intel.com>
+
+ * elf-eh-frame.c (_bfd_elf_discard_section_eh_frame): Don't
+ use the last CIE from a different section.
+ (_bfd_elf_write_section_eh_frame): Don't pad beyond the raw
+ size of the output section.
+
+2003-10-07 Roland McGrath <roland@redhat.com>
+
+ * elf.c (_bfd_elf_make_section_from_phdr): Set alignment_power of
+ new section from p_align header field.
+
+2003-10-16 H.J. Lu <hongjiu.lu@intel.com>
+
+ * elf32-xtensa.c (xtensa_read_table_entries): The external size
+ of entry is 8 bytes.
+
+2003-10-15 Andrew Cagney <cagney@redhat.com>
+
+ * targets.c (BFD_JUMP_TABLE_SYMBOLS): Replace NAME##_get_symtab
+ with NAME##_canonicalize_symtab.
+ * libcoff-in.h (coff_canonicalize_symtab): Update.
+ * xsym.h (bfd_sym_canonicalize_symtab): Update.
+ * elf-bfd.h (_bfd_elf_canonicalize_symtab): Update.
+ * coffgen.c (coff_canonicalize_symtab): Update.
+ * libbfd-in.h (_bfd_nosymbols_canonicalize_symtab): Update.
+ * libnlm.h (nlmNAME(canonicalize_symtab)): Update.
+ * ieee.c (ieee_vec): Update comment.
+ * libecoff.h (_bfd_ecoff_canonicalize_symtab): Update.
+ * mmo.c (mmo_canonicalize_symtab): Update.
+ * nlm-target.h (nlm_canonicalize_symtab): Update.
+ * nlmcode.h (nlm_canonicalize_symtab): Update.
+ * i386msdos.c (msdos_canonicalize_symtab): Update.
+ * hp300hpux.c (MY (canonicalize_symtab)): Update.
+ * oasys.c (oasys_canonicalize_symtab): Update.
+ * som.c (som_canonicalize_symtab): Update.
+ * pef.c (bfd_pef_canonicalize_symtab): Update.
+ * nlmcode.h (nlm_canonicalize_symtab): Update.
+ * xsym.c (bfd_sym_canonicalize_symtab): Update.
+ * vms.c (vms_canonicalize_symtab): Update.
+ * versados.c (versados_canonicalize_symtab): Update.
+ * mach-o.c (bfd_mach_o_canonicalize_symtab): Update.
+ * ieee.c (ieee_canonicalize_symtab): Update.
+ * pdp11.c (NAME(aout,canonicalize_symtab)): Update.
+ * reloc.c: Update comment.
+ * libaout.h (NAME(aout,canonicalize_symtab)): Update.
+ * coff64-rs6000.c (aix5coff64_vec): Update.
+ * coff64-rs6000.c (bfd_xcoff_aix5_backend_data): Update.
+ * coff-rs6000.c (rs6000coff_vec, pmac_xcoff_vec): Update.
+ * aoutx.h (NAME(aout,canonicalize_symtab)): Update.
+ * elfxx-target.h (bfd_elfNN_canonicalize_symtab): Update.
+ * hp300hpux.c (MY_canonicalize_symtab): Update.
+ * ecoff.c (_bfd_ecoff_canonicalize_symtab): Update.
+ * aout-tic30.c (MY_canonicalize_symtab): Update.
+ * aout-target.h (MY_canonicalize_symtab): Update.
+ * ppcboot.c (ppcboot_canonicalize_symtab): Update.
+ * elf.c (_bfd_elf_canonicalize_symtab): Update.
+ * elfcode.h (elf_canonicalize_symtab): Update.
+ * ihex.c (ihex_canonicalize_symtab): Update.
+ * tekhex.c (tekhex_canonicalize_symtab): Update.
+ * binary.c (binary_canonicalize_symtab): Update.
+ * srec.c (srec_canonicalize_symtab): Update.
+
+2003-10-15 Kazu Hirata <kazu@cs.umass.edu>
+
+ * elf32-h8300.c (elf_reloc_map): Fix a comment typo.
+
+2003-10-15 Kaz Kojima <kkojima@rr.iij4u.or.jp>
+
+ * elf32-sh.c (sh_elf_relocate_section): Handle R_SH_IMM_*_PCREL
+ relocations.
+ (sh_elf_check_relocs): Likewise.
+
+ * elf32-sh64.c (elf_backend_merge_symbol_attribute): Define.
+ (sh64_elf_merge_symbol_attribute): New.
+ * elf64-sh64.c (elf_backend_merge_symbol_attribute): Define.
+ (sh64_elf64_merge_symbol_attribute): New.
+
+2003-10-14 Kaz Kojima <kkojima@rr.iij4u.or.jp>
+
+ * elf-bfd.h (struct elf_backend_data): New function pointer member
+ elf_backend_merge_symbol_attribute.
+ * elflink.h (elf_link_add_object_symbols): Adjust call to
+ elf_backend_merge_symbol_attribute if the backend defined it.
+ * elfxx-target.h (elf_backend_merge_symbol_attribute): New macro.
+ (elfNN_bed): Add that to the initializer.
+
+2003-10-14 Bob Wilson <bob.wilson@acm.org>
+
+ * elf32-xtensa.c (get_is_linkonce_section): Delete.
+ (xtensa_is_property_section, xtensa_is_littable_section): Use
+ XTENSA_INSN_SEC_NAME and XTENSA_LIT_SEC_NAME macros. Do not recognize
+ linkonce sections containing ".xt.insn" and ".xt.lit" substrings.
+ (xtensa_get_property_section_name): Check section name instead of
+ calling get_is_linkonce_section. Remove unused bfd parameter. Use
+ XTENSA_INSN_SEC_NAME and XTENSA_LIT_SEC_NAME macros. Never generate
+ linkonce section names by appending ".xt.insn" or ".xt.lit".
+ (xtensa_read_table_entries): Remove bfd argument in call to
+ xtensa_get_property_section_name. Free section name when done.
+ (elf_xtensa_combine_prop_entries): Free leaking table.
+
+2003-10-13 Richard Sandiford <rsandifo@redht.com>
+
+ * elfxx-mips.c (_bfd_mips_elf_size_dynamic_sections): Don't add
+ DT_MIPS_LIBLIST or DT_MIPS_CONFLICT entries.
+ (_bfd_mips_elf_finish_dynamic_symbol): Don't handle them. Don't
+ handle DT_MIPS_MSYM. Set DT_RELSZ based on the number of relocations
+ that were needed.
+ (_bfd_mips_elf_modify_segment_map): Fix placement of PT_MIPS_OPTIONS.
+ (_bfd_mips_elf_merge_private_bfd_data): Ignore EF_MIPS_UCODE.
+
+2003-10-13 H.J. Lu <hongjiu.lu@intel.com>
+
+ * bfd-in.h (bfd_elf32_ia64_after_parse): New prototype.
+ (bfd_elf64_ia64_after_parse): Likewise.
+ * bfd-in2.h: Regenerated.
+
+ * elfxx-ia64.c (oor_ip): New.
+ (oor_branch_size): Likewise.
+ (bfd_elfNN_ia64_after_parse): Likewise.
+ (elfNN_ia64_relax_section): Use oor_ip if oor_branch_size
+ equals sizeof (oor_ip).
+
+2003-10-12 Kaz Kojima <kkojima@rr.iij4u.or.jp>
+
+ * elf64-sh64.c (sh_elf64_relocate_section): Tidy up for the
+ renumbering of some relocation numbers.
+
+2003-10-11 Alan Modra <amodra@bigpond.net.au>
+
+ * coff-sh.c: Move definition of MAP and guard more code with
+ COFF_IMAGE_WITH_PE.
+
+ * section.c (bfd_get_section_size_before_reloc): Ignore reloc_done.
+ * bfd-in2.h: Regenerate.
+
+2003-10-10 H.J. Lu <hongjiu.lu@intel.com>
+
+ * Makefile.am: Run "make dep-am".
+ * Makefile.in: Regenerate.
+ * doc/Makefile.in: Likewise.
+
+2003-10-09 H.J. Lu <hongjiu.lu@intel.com>
+
+ * cofflink.c: Include "safe-ctype.h".
+ (coff_link_add_symbols): Use ISDIGIT instead of isdigit.
+
+2003-10-08 Dave Brolley <brolley@redhat.com>
+ On behalf of Michael Snyder <msnyder@redhat.com>
+
+ * archures.c: Add FRV fr550 machine.
+ * cpu-frv.c: Ditto.
+ * elf32-frv.c: Ditto.
+ * bfd-in2.h: Regenerate.
+
+2003-10-08 Thiemo Seufer <seufer@csv.ica.uni-stuttgart.de>
+
+ * elfxx-mips.c (STUB_MOVE,STUB_LI16): Fix stub code
+ for non-SGI N64 ABI. Improve code consitency.
+
+2003-10-07 Alexandre Oliva <aoliva@redhat.com>
+
+ * elf32-frv.c (elf32_frv_howto_table): Set R_FRV_LABEL16's
+ rightshift to 2.
+
+2003-10-07 Nathan Sidwell <nathan@codesourcery.com>
+
+ * libbfd-in.h (_bfd_link_section_stabs): Add string offset
+ parameter.
+ * cofflink.c (coff_link_add_symbols): Deal with split stab
+ sections.
+ * elflink.h (elf_link_add_object_symbols): Deal with split stab
+ sections.
+ * stabs.c (_bfd_link_section_stabs): Add string offset parameter.
+ * libbfd.h: Regenerated.
+
+ * coffcode.h (coff_set_alignment_hook): With PE_COFF reloc
+ overflow, set reloc start position to after the count
+ reloc. Subtract one from num relocs. Give error on 0xffff relocs
+ and no overflow.
+ * cofflink.c (_bfd_coff_final_link): Deal with PE_COFF reloc
+ overflow.
+ * peXXigen.c (_bfd_XXi_swap_scnhdr_out): Do overflow if >=
+ 0xffff.
+
+2003-10-06 H.J. Lu <hongjiu.lu@intel.com>
+
+ * elf-eh-frame.c (_bfd_elf_write_section_eh_frame): Pad the
+ last CIE/FDE if needed.
+
+2003-10-06 Nick Clifton <nickc@redhat.com>
+
+ * targets.c (_bfd_target_vector): Include bfd_elf64_sparc_vec if
+ BFD64 is enabled.
+
+2003-10-06 Matt Thomas <matt@3am-software.com>
+
+ * config.bfd: Move the hppa*-*-netbsd* case to the hppa*-*-linux* case.
+
+2003-10-06 Robert Millan <robertmh@gnu.org>
+
+ * configure.in: Match GNU/KNetBSD with new knetbsd*-gnu triplet.
+ * config.bfd: Likewise.
+ * configure: Regenerate.
+
+2003-10-04 Christian Groessler <chris@groessler.org>
+
+ * coff-z8k.c (extra_case): Fix displacement length check for R_JR
+ and R_CALLR.
+
+2003-10-04 Stephane Carrez <stcarrez@nerim.fr>
+
+ * elf32-m68hc1x.c: Update to ISO C90; replace PTR with void*.
+ * elf32-m68hc11.c: Likewise.
+ * elf32-m68hc12.c: Likewise.
+ * elf32-m68hc1x.h: Likewise.
+
+2003-10-04 Stephane Carrez <stcarrez@nerim.fr>
+
+ * elf32-m68hc1x.c (_bfd_m68hc11_elf_merge_private_bfd_data): Fix merge
+ of flags between HC12 and HCS12.
+
+2003-10-04 Bryce McKinlay <bryce@mckinlay.net.nz>
+
+ * merge.c (_bfd_merge_sections): Set SEC_EXCLUDE flag on sections
+ which become empty after merging.
+
+2003-09-30 Jakub Jelinek <jakub@redhat.com>
+
+ * elfxx-ia64.c (ia64_howto_table): Fix size of R_IA64_TPREL64[LM]SB,
+ R_IA64_DTPREL{32,64}[LM]SB and R_IA64_DTPMOD64[LM]SB.
+
+2003-09-30 Chris Demetriou <cgd@broadcom.com>
+
+ * archures.c (bfd_mach_mipsisa64r2): New define.
+ * bfd-in2.h: Regenerate.
+ * aoutx.h (NAME(aout,machine_type)): Handle bfd_mach_mipsisa64r2.
+ * cpu-mips.c (I_mipsisa64r2): New enum value.
+ (arch_info_struct): Add entry for I_mipsisa64r2.
+ * elfxx-mips.c (_bfd_elf_mips_mach)
+ (_bfd_mips_elf_print_private_bfd_data): Handle E_MIPS_ARCH_64R2.
+ (mips_set_isa_flags): Add bfd_mach_mipsisa64r2 case.
+ (mips_mach_extensions): Add entry for bfd_mach_mipsisa64r2.
+
+2003-09-29 H.J. Lu <hongjiu.lu@intel.com>
+
+ * elfxx-ia64.c (elfNN_hpux_backend_symbol_processing): New.
+ Handle SHN_IA_64_ANSI_COMMON.
+ (elf_backend_section_from_bfd_section): Defined.
+
+2003-09-26 H.J. Lu <hongjiu.lu@intel.com>
+
+ * elflink.c (elf_link_read_relocs_from_section): Add an argument
+ of a pointer to section. Check bad symbol index.
+ (_bfd_elf_link_read_relocs): Modify calls to
+ elf_link_read_relocs_from_section.
+
+2003-09-23 DJ Delorie <dj@redhat.com>
+
+ * elf32-sh.c (sh_elf_howto_table): R_SH_SWITCH8,
+ R_SH_GNU_VTINHERIT, R_SH_GNU_VTENTRY,
+ R_SH_LOOP_START,R_SH_LOOP_END moved to "reserved" spaces,
+ R_SH_DIR16, R_SH_DIR8, R_SH_DIR8UL, R_SH_DIR8UW, R_SH_DIR8U,
+ R_SH_DIR8SW, R_SH_DIR8S, R_SH_DIR4UL, R_SH_DIR4UW, R_SH_DIR4U,
+ R_SH_PSHA, R_SH_PSHL added.
+ (sh_reloc_map): Add R_SH_DIR16 and R_SH_DIR8.
+ (sh_elf_relocate_section): Support new relocs.
+
+2003-09-23 Bob Wilson <bob.wilson@acm.org>
+
+ * elf32-xtensa.c (elf_xtensa_relocate_section): Fix typo that clobbered
+ dynamic relocation offsets.
+
+2003-09-23 Alan Modra <amodra@bigpond.net.au>
+
+ * simple.c (bfd_simple_get_relocated_section_contents): Free the
+ hash table using _bfd_generic_link_hash_table_free.
+
+2003-09-23 Alan Modra <amodra@bigpond.net.au>
+
+ * elf-bfd.h (struct bfd_elf_special_section): Remove "suffix". Change
+ type of prefix_length and suffix_length to int. Rename "attributes"
+ to "attr". Comment.
+ (_bfd_elf_get_sec_type_attr): Update prototype.
+ * elf.c (get_special_section): Rewrite.
+ (_bfd_elf_get_sec_type_attr): Return struct rather than passing in
+ attr and type pointers.
+ (_bfd_elf_new_section_hook): Adjust for above.
+ (special_sections): Merge suffix with prefix. Set
+ prefix_length for all entries. Set suffix_length appropriately.
+ * elf32-m32r.c (m32r_elf_special_sections): Likewise.
+ * elf32-m68hc11.c (elf32_m68hc11_special_sections): Likewise.
+ * elf32-m68hc12.c (elf32_m68hc12_special_sections): Likewise.
+ * elf32-mcore.c (mcore_elf_special_sections): Likewise.
+ * elf32-sh64.c (sh64_elf_special_sections): Likewise.
+ * elf32-v850.c (v850_elf_special_sections): Likewise.
+ * elf32-xtensa.c (elf_xtensa_special_sections): Likewise.
+ * elf64-alpha.c (elf64_alpha_special_sections): Likewise.
+ * elf64-hppa.c (elf64_hppa_special_sections): Likewise.
+ * elf64-ppc.c (ppc64_elf_special_sections): Likewise.
+ * elf64-sh64.c (sh64_elf64_special_sections): Likewise.
+ * elfxx-ia64.c (elfNN_ia64_special_sections): Likewise.
+ * elfxx-mips.c (_bfd_mips_elf_special_sections): Likewise.
+ * elf32-ppc.c (ppc_elf_special_sections): Likewise. Fix .plt flags.
+
+2003-09-21 Daniel Jacobowitz <drow@mvista.com>
+
+ * elf64-alpha.c (elf64_alpha_create_got_section): Initialize
+ ->got if the section already exists.
+
+2003-09-19 Nathan Sidwell <nathan@codesourcery.com>
+
+ * dwarf2.c (decode_line_info): Cope with an initially empty
+ filename table.
+
+2003-09-18 H.J. Lu <hongjiu.lu@intel.com>
+
+ * acinclude.m4: Include ../config/accross.m4.
+ * aclocal.m4: Regenerated.
+
+ * configure.host (HOST_64BIT_TYPE): Remove if it is set to long
+ or long long.
+ (HOST_U_64BIT_TYPE): Remove if it is set to unsigned long long.
+ (host64): Remove if HOST_64BIT_TYPE is set to long.
+
+ * configure.in (HOST_64BIT_TYPE): Set according to the size of
+ long and long long.
+ (HOST_U_64BIT_TYPE): Likewise.
+ (host64): Likewise.
+ * configure: Regenerated.
+
+2003-09-19 Alan Modra <amodra@bigpond.net.au>
+
+ * elf.c (elfcore_write_note): Don't use sizeof(Elf_External_note)
+ since some ABIs round up the size of the struct.
+
+2003-09-18 H.J. Lu <hongjiu.lu@intel.com>
+
+ * elflink.c (_bfd_elf_merge_symbol): Allow type change if
+ the old symbol is undefined and the new symbol is defined.
+
+2003-09-18 Andreas Schwab <schwab@suse.de>
+
+ * simple.c (bfd_simple_get_relocated_section_contents): Use
+ _bfd_generic_link_hash_table_create instead of
+ bfd_link_hash_table_create.
+
+2003-09-10 H.J. Lu <hongjiu.lu@intel.com>
+
+ * elfxx-ia64.c (elfNN_ia64_special_sections): Mark all sections
+ started with ".sbss" or "".sdata" as SHF_IA_64_SHORT.
+
+2003-09-10 John David Anglin <dave.anglin@nrc-cnrc.nrc.ca>
+ Randolph Chung <randolph@tausq.org>
+
+ * elf32-hppa.c (struct elf32_hppa_link_hash_entry,
+ hppa_link_hash_newfunc, hppa_build_one_stub,
+ elf32_hppa_adjust_dynamic_symbol, mark_PIC_calls, allocate_plt_static,
+ allocate_dynrelocs, elf32_hppa_size_dynamic_sections,
+ elf32_hppa_finish_dynamic_symbol): Remove pic_call field and all code
+ for generating import stubs for calls to statically linked PIC
+ functions.
+ (hppa_type_of_stub): Don't generate an import stub for calls to
+ statically linked pic functions. Generate import stubs for calls
+ in a shared object, to functions not in a regular file, and to
+ defined weak functions. Add new argument INFO.
+ (hppa_build_one_stub): Don't undef ADDIL_DP.
+ (elf32_hppa_check_relocs): Don't set SEC_HAS_GOT_REF flag.
+ (elf32_hppa_size_stubs): Pass info to hppa_type_of_stub.
+ (final_link_relocate): Change all DLTIND relocs to DPREL relocs in a
+ non-shared link. Convert instructions that use the the linkage table
+ pointer, or a facsimile thereof, to use the global data pointer when
+ the reloc has been changed.
+
+2003-09-08 Joel Brobecker <brobecker@gnat.com>
+
+ * archures.c: Add new machine names for hppa.
+ * bfd-in2.h: Regenerate.
+ * cpu-hppa.c: Use the new machine names.
+
+2003-09-06 Stephane Carrez <stcarrez@nerim.fr>
+
+ * elf32-m68hc1x.h (struct m68hc11_elf_link_hash_table): Remove
+ all_local_syms member.
+ * elf32-m68hc1x.c (elf32_m68hc11_size_stubs): Use bfd_elf_get_elf_syms
+ to get the local symbols.
+
+2003-09-06 Stephane Carrez <stcarrez@nerim.fr>
+
+ * elf32-m68hc12.c (elf32_m68hc12_special_sections): New for hc11.
+ (elf_backend_special_sections): Define.a
+
+ PR savannah/4950:
+ * elf32-m68hc11.c (elf32_m68hc11_special_sections): The .vectors
+ section is read-only.
+
+2003-09-04 Nick Clifton <nickc@redhat.com>
+
+ * archures.c (bfd_mach_v850e1): Define.
+ * bfd-in2.h: Regenerate.
+ * cpu-v850.h (scan): Accept bfd_mach_v850e1.
+ (arch_info_struct): Include an entry for bfd_mach_v850e1.
+ * elf32-v850.c (v850_elf_object_p): Accept E_V850E1_ARCH flag.
+ (v850_elf_final_write_processing): Accept bfd_mach_v850e1.
+ (v850_elf_print_private_bfd_data): Interpret E_V850E1_ARCH flag.
+ (v850_elf_merge_private_bfd_data): Allow v850e1 binaries to be
+ linked with v850e binaries. Mark the output as v850e.
+
+2003-09-03 Nick Clifton <nickc@redhat.com>
+
+ * cofflink.c (_bfd_coff_link_input_bfd): Do not skip section
+ symbols that are used in relocs.
+
+2003-08-30 Robert Millan <robertmh@gnu.org>
+
+ * configure.in: Match GNU/KFreeBSD with new kfreebsd*-gnu triplet.
+ * config.bfd: Likewise.
+ * configure: Regenerate.
+
+2003-08-31 Christian Groessler <chris@groessler.org>
+
+ * elf32-i860.c (i860_howto_pc26_reloc): Finish relocation here
+ instead of returning bfd_reloc_continue.
+
+2003-08-31 Andreas Jaeger <aj@suse.de>
+
+ * merge.c: Update to ISO C90.
+
+2003-08-27 Ian Lance Taylor <ian@airs.com>
+
+ * configure.in: Check for strtoull.
+ * bfd.c (bfd_scan_vma): Use strtoull when available.
+ * configure, config.in: Regenerate.
+
+ * configure.in: Define and substitute BFD_HOST_LONG_LONG.
+ * bfd-in.h: Define BFD_HOST_LONG_LONG. Test it rather than
+ __GNUC__ when deciding whether to use long long for
+ BFD_HOST_64_BIT.
+ * configure, Makefile.in, doc/Makefile.in, bfd-in2.h: Regenerate.
+
+2003-08-27 Christian Groessler <chris@groessler.org>
+
+ * elf32-i860.c (i860_howto_pc26_reloc, i860_howto_pc16_reloc,
+ i860_howto_splitn_reloc, i860_howto_highadj_reloc): New
+ functions.
+ (elf32_i860_howto_table): Insert the new functions as
+ 'special_function's in the proper reloc type entries.
+
+2003-08-27 Richard Sandiford <rsandifo@redhat.com>
+
+ * elf32-frv.c (elf32_frv_relocate_section): Use
+ _bfd_elf_rela_local_sym.
+
+2003-08-26 Michael Snyder <msnyder@redhat.com>
+
+ * cpu-frv.c: Remove unused enum.
+
+2003-08-25 Maciej W. Rozycki <macro@ds2.pg.gda.pl>
+
+ * reloc.c: Fix documentation for MIPS ELF relocations.
+ libbfd.h: Regenerate.
+ bfd-in2.h: Regenerate.
+
+2003-08-24 Jason Eckhardt <jle@rice.edu>
+
+ * coff-i860.c (CALC_ADDEND): Define to be a no-op.
+
+2003-08-24 Jason Eckhardt <jle@rice.edu>
+
+ * elf32-i860.c (elf32_i860_relocate_pc16): Subtract 4 and
+ shift by 2 before storing the relocated value.
+
+2003-08-23 Jason Eckhardt <jle@rice.edu>
+
+ * coff-i860.c (coff_i860_reloc_nyi): New function.
+ (howto_table): Add entries for relocations PAIR, HIGHADJ, HIGH,
+ LOWn, SPLITn, and BRADDR.
+ (RTYPE2HOWTO): Check that the r_type is within the howto_table
+ before trying to access the entry.
+ (coff_i860_rtype_to_howto): Likewise.
+ (coff_i860_reloc_type_lookup): New function.
+ (i860_reloc_processing): New function.
+ (coff_bfd_reloc_type_lookup): Define macro.
+ (RELOC_PROCESSING): Define macro.
+ Minor formatting adjustments.
+
+2003-08-23 Alan Modra <amodra@bigpond.net.au>
+
+ * elflink.h (elf_link_add_object_symbols): Don't crash on NULL owner.
+
+2003-08-22 H.J. Lu <hongjiu.lu@intel.com>
+
+ * elfxx-ia64.c (elfNN_ia64_create_dynamic_sections): Align the
+ .got section at 8 bytes.
+
+2003-08-21 Nick Clifton <nickc@redhat.com>
+
+ * cofflink.c: Update to ISO C90 and tidy up formatting.
+
+2003-08-21 Randolph Chung <tausq@debian.org>
+
+ * elf32-hppa.c (elf32_hppa_object_p): For elf32-hppa-linux, objects
+ can have OSABI=Linux or OSABI=SysV. Check for both.
+ * elf64-hppa.c (elf64_hppa_object_p): Likewise.
+
+2003-08-21 Nick Clifton <nickc@redhat.com>
+
+ * po/sv.po: Updated Swedish translation.
+
+2003-08-20 Richard Sandiford <rsandifo@redhat.com>
+
+ * elf64-mips.c (elf_backend_copy_indirect_symbol): Define.
+
+2003-08-20 Nick Clifton <nickc@redhat.com>
+
+ * elf-bfd.h (RELOC_FOR_GLOBAL_SYMBOL): New macro used to
+ replace some duplicated code in most elfxx-xxxx.c files. This
+ version uses the new fields in bfd_link_info.
+
+ * elf-m10300.c (mn10300_elf_relocate_section): Use new macro.
+ * elf32-arm.h (elf32_arm_relocate_section): Likewise.
+ * elf32-cris.c (cris_elf_relocate_section): Likewise.
+ * elf32-hppa.c (elf32_hppa_relocate_section): Likewise.
+ * elf32-i386.c (elf_i386_relocate_section): Likewise.
+ * elf32-ip2k.c (ip2k_elf_relocate_section): Likewise.
+ * elf32-iq2000.c (iq2000_elf_relocate_section): Likewise.
+ * elf32-m68k.c (elf_m68k_relocate_section): Likewise.
+ * elf32-ppc.c (ppc_elf_relocate_section): Likewise.
+ * elf32-s390.c (elf_s390_relocate_section): Likewise.
+ * elf32-sparc.c (elf32_sparc_relocate_section): Likewise.
+ * elf32-vax.c (elf_vax_relocate_section): Likewise.
+ * elf32-xtensa.c (elf_xtensa_relocate_section): Likewise.
+ * elf64-alpha.c (elf64_alpha_relocate_section): Likewise.
+ * elf64-ppc.c (ppc64_elf_relocate_section): Likewise.
+ * elf64-s390.c (elf_s390_relocate_section): Likewise.
+ * elf64-sparc.c (sparc64_elf_relocate_section): Likewise.
+ * elf64-x86-64.c (elf64_x86_64_relocate_section): Likewise.
+ * elfxx-ia64.c (elfNN_ia64_relocate_section): Likewise.
+
+ * elf-hppa.h (elf_hppa_unmark_useless_dynamic_symbols,
+ elf_hppa_remark_useless_dynamic_symbols,
+ elf_hppa_relocate_section): Use the new fields in
+ bfd_link_info structure.
+ * elf32-sh.c (sh_elf_relocate_section): Likewise.
+ * elf64-alpha.c (elf64_alpha_check_relocs): Likewise.
+ * elf64-hppa.c (elf64_hppa_check_relocs): Likewise.
+ * elf64-sh64.c (sh_elf64_relocate_section): Likewise.
+ * elfxx-ia64.c (elfNN_ia64_check_relocs): Likewise.
+ * elfxx-mips.c (mips_elf_calculate_relocation): Likewise.
+
+ * elflink.h (elf_link_output_extsym): Fix test for reporting
+ undefined symbols in shared libraries. Remove redundant test
+ of shlib_undefined when reporting references to forced local
+ symbols.
+
+2003-08-18 Andreas Schwab <schwab@suse.de>
+
+ * libpei.h (bfd_pe_executable_p): Also recognize efi-app
+ executables.
+
+2003-08-17 Hans-Peter Nilsson <hp@bitrange.com>
+
+ * simple.c (bfd_simple_get_relocated_section_contents): Move
+ reloc_done hack to before first bfd_section_size call. Change all
+ returns to use new wrapper macro RETURN, restoring sec->reloc_done.
+
+2003-08-16 Alan Modra <amodra@bigpond.net.au>
+
+ * elf64-ppc.c: Don't include elf/ppc.h.
+
+2003-08-14 Richard Sandiford <rsandifo@redhat.com>
+
+ * elfxx-mips.c (_bfd_mips_elf_modify_segment_map): Fix PT_DYNAMIC
+ code to work with 64-bit bfds.
+
+2003-08-14 Alan Modra <amodra@bigpond.net.au>
+
+ * dep-in.sed: Remove libintl.h.
+ * Makefile.am (SRC-POTFILES.in, BLD-POTFILES.in): Unset LC_COLLATE.
+ (POTFILES.in): Remove target.
+ * Makefile.in: Regenerate.
+
+2003-08-12 Alan Modra <amodra@bigpond.net.au>
+
+ * elf64-ppc.c (ppc64_elf_next_input_section): Update comment.
+ (ppc64_elf_relocate_section): For zero sym R_PPC64_TOC relocs,
+ use the function sym from the previous reloc.
+
+2003-08-11 Jakub Jelinek <jakub@redhat.com>
+
+ * elf32-i386.c (elf_i386_relocate_section): Make undefined symbols
+ fatal if -pie.
+ * elf32-s390.c (elf_s390_relocate_section): Likewise.
+ * elf32-sparc.c (elf32_sparc_relocate_section): Likewise.
+ * elf64-alpha.c (elf64_alpha_relocate_section): Likewise.
+ * elf64-ppc.c (ppc64_elf_relocate_section): Likewise.
+ * elf64-s390.c (elf_s390_relocate_section): Likewise.
+ * elf64-sparc.c (sparc64_elf_relocate_section): Likewise.
+ * elf64-x86-64.c (elf64_x86_64_relocate_section): Likewise.
+ * elfxx-ia64.c (elfNN_ia64_relocate_section): Likewise.
+ * elf32-ppc.c (ppc_elf_relocate_section): Likewise.
+ (ppc_elf_relocate_section) <case R_PPC_RELAX32>: Issue fatal error
+ on undefined symbols if -pie.
+ * elf32-sh.c (sh_elf_relocate_section): Likewise.
+
+2003-08-11 Alan Modra <amodra@bigpond.net.au>
+
+ * elf64-ppc.c (ppc64_elf_relocate_section): Add special case for crt1.o
+ branch to __libc_start_main.
+
+2003-08-08 Dmitry Diky <diwil@mail.ru>
+
+ * archures.c: Add xW42 and xE42 parts. Sort MPU list according to
+ gcc order.
+ * cpu-msp430.c: Likewise.
+ * elf32-msp430.c: Likewise.
+ * bfd-in2.h: Regenerate.
+
+2003-08-07 Alan Modra <amodra@bigpond.net.au>
+
+ * elfxx-target.h: Remove PTR cast.
+ * targets.c (bfd_target): Make backend_data const void *.
+ * elf-bfd.h: Constify all occurrences of struct elf_backend_data.
+ * elf-m10300.c: Likewise.
+ * elf.c: Likewise.
+ * elf32-hppa.c: Likewise.
+ * elf32-i386.c: Likewise.
+ * elf32-m68hc1x.c: Likewise.
+ * elf32-ppc.c: Likewise.
+ * elf32-s390.c: Likewise.
+ * elf32-sh.c: Likewise.
+ * elf32-sh64.c: Likewise.
+ * elf32-sparc.c: Likewise.
+ * elf32-xtensa.c: Likewise.
+ * elf64-mips.c: Likewise.
+ * elf64-ppc.c: Likewise.
+ * elf64-s390.c: Likewise.
+ * elf64-sh64.c: Likewise.
+ * elf64-sparc.c: Likewise.
+ * elf64-x86-64.c: Likewise.
+ * elfcode.h: Likewise.
+ * elfcore.h: Likewise.
+ * elflink.c: Likewise.
+ * elflink.h: Likewise.
+ * elfxx-ia64.c: Likewise.
+ * elfxx-mips.c: Likewise.
+ * elfxx-mips.h: Likewise.
+ * elf.c (prep_headers): Remove useless check for null backend_data.
+ * bfd-in2.h: Regenerate.
+
+ * elf-bfd.h: Remove PARAMS macro. Replace PTR with void *.
+ (NAME): Use ## rather than CONCAT4 macro.
+ * elfcode.h: Remove one remaining PARAMS macro.
+ * elf-eh-frame.c: Convert to C90, remove unneeded casts and prototypes.
+ * elf-strtab.c: Likewise.
+ * elf-hppa.h: Likewise.
+ * elf32-hppa.h: Likewise.
+ * elf32-hppa.c: Likewise.
+ (elf32_hppa_add_symbol_hook): Delete.
+ (elf_backend_add_symbol_hook): Don't define.
+ * libhppa.h: Convert to C90. Replace INLINE with inline.
+
+2003-08-06 Alan Modra <amodra@bigpond.net.au>
+
+ * elf64-ppc.c (ppc_stub_name): Tweak names for better readability.
+ (ppc64_elf_adjust_dynamic_symbol): Allow copy relocs against
+ function descriptors, but warn.
+ (ppc_build_one_stub): Remove a couple of vars. Move code creating
+ stub syms so that we can avoid a stub sym if we already have a
+ plt sym. Do not redefine an existing symbol.
+ (ppc64_elf_build_stubs): When --emit-stub-syms, print a symbol for
+ glink.
+
+2003-08-06 Nick Clifton <nickc@redhat.com>
+
+ * po/fr.po: Updated French translation.
+
+2003-08-06 Alan Modra <amodra@bigpond.net.au>
+
+ * elflink.c (_bfd_elf_create_dynamic_sections): Mark .dynbss with
+ SEC_LINKER_CREATED.
+
+2003-08-05 Daniel Jacobowitz <drow@mvista.com>
+
+ * elf32-arm.h (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define.
+ (elf32_arm_final_link_relocate, elf32_arm_relocate_section): Use it.
+
+2003-08-03 Jeff Muizelaar <muizelaar@rogers.com>
+
+ * coffcode.h (coff_slurp_line_table): Return with a warning
+ message if the line number table could not be read.
+
+2003-08-04 Nick Clifton <nickc@redhat.com>
+
+ * elflink.h (elf_link_add_object_symbols): Prepend "warning: "
+ to messages produced for .gnu.warning.SYMBOL sections.
+
+2003-08-04 Alan Modra <amodra@bigpond.net.au>
+
+ * elfcode.h: Convert to C90, remove unneeded casts and prototypes.
+ * elfcore.h: Likewise.
+ * elflink.c: Likewise.
+ * elflink.h: Likewise.
+ * elf.c (sym_is_global): Remove INLINE.
+ (align_file_position): Replace INLINE with inline.
+ * elfcode.h (elf_swap_dyn_in, elf_swap_dyn_out): Remove INLINE.
+ (elf_file_p): Replace INLINE with inline.
+
+2003-08-02 Kaz Kojima <kkojima@rr.iij4u.or.jp>
+
+ * elf32-sh.c (sh_elf_check_relocs): Don't set DF_TEXTREL here.
+
+2003-08-01 H.J. Lu <hongjiu.lu@intel.com>
+
+ * elfxx-ia64.c (get_got): Align the .got section at 8 bytes.
+
+2003-08-01 H.J. Lu <hongjiu.lu@intel.com>
+
+ * elfxx-ia64.c (elfNN_ia64_finish_dynamic_symbol): Use
+ ElfNN_External_Rela instead of Elf64_External_Rela.
+
+2003-08-01 Nick Clifton <nickc@redhat.com>
+
+ * config.bfd: Add code to catch obsolete configurations and warn
+ about them unless --enable-obsolete is used. Use this to mark
+ vax-vms port as obsolete.
+
+2003-07-30 Alan Modra <amodra@bigpond.net.au>
+
+ * elf32-ppc.c (ppc_elf_install_value): Tidy.
+ (ppc_elf_relax_section): Remove dead code. Remove unnecessary casts.
+ Formatting.
+ * elfxx-target.h: Remove PARAMS macro. Formatting.
+
+2003-07-30 Alan Modra <amodra@bigpond.net.au>
+
+ * elf.c (bfd_section_from_r_symndx): Test for SHN_UNDEF.
+ * elf64-ppc.c (get_fdh): New function, split out from
+ ppc64_elf_edit_opd.
+ (ppc64_elf_check_relocs): Use get_fdh.
+ (func_desc_adjust): Likewise. Tidy.
+ (ppc64_elf_edit_opd): Tighten reloc checks. Free local_syms on error
+ exit. Use get_fdh. Account for superfluous dynamic relocs.
+ (ppc64_elf_relocate_section): Warning fix.
+
+2003-07-30 Jason Eckhardt <jle@rice.edu>
+
+ * coff-i860.c: Convert to ISO C90. Remove superflous prototypes.
+
+2003-07-30 Jason Eckhardt <jle@rice.edu>
+
+ * elf32-i860.c: Convert to ISO C90. Remove superflous prototypes.
+
+2003-07-30 Randolph Chung <tausq@debian.org>
+
+ * elf-hppa.h (elf_hppa_relocate_section): Look up dyn_h for undefweak.
+ * elf64-hppa.c (elf64_hppa_finalize_dlt): Check h->root.type.
+
+2003-07-30 Alan Modra <amodra@bigpond.net.au>
+
+ * elf.c: Convert to C90, remove unnecessary prototypes and casts.
+ Replace PTR with void *. Formatting.
+ (_bfd_elf_assign_file_position_for_section): Remove INLINE.
+ (make_mapping): Likewise.
+
+2003-07-29 Alan Modra <amodra@bigpond.net.au>
+
+ * elf64-ppc.c (func_desc_adjust): Give linker created function
+ descriptor symbols a size and type.
+ (ppc64_elf_relocate_section): Correct lq insn test.
+
+2003-07-28 Eric Christopher <echristo@redhat.com>
+
+ * elf32-ppc.c (R_PPC_RELAX32): New relocation.
+ (ppc_elf_install_value): New function.
+ (ppc_elf_sort_rela): Remove.
+ (ppc_elf_relax_section): Rewrite. Remove old relaxation
+ and replace with out of range branch stubs.
+ (ppc_elf_relocate_section): Handle R_PPC_RELAX32.
+
+2003-07-29 Alexandre Oliva <aoliva@redhat.com>
+
+ * elf-m10300.c (mn10300_elf_relax_section): Take symbol hash table
+ from input_bfd.
+
+2003-07-28 Alan Modra <amodra@bigpond.net.au>
+
+ * elf.c (special_sections): Set attributes for .got and .plt.
+
+2003-07-27 Alan Modra <amodra@bigpond.net.au>
+
+ * elf64-ppc.c (ppc64_elf_adjust_dynamic_symbol): Ensure no copy relocs
+ on function descriptors.
+ (ELIMINATE_COPY_RELOCS): Expand comment.
+ (ppc64_elf_special_sections): Move. Don't include non-ppc64 sections.
+ Do include ".toc1".
+
+2003-07-25 H.J. Lu <hongjiu.lu@intel.com>
+
+ * elf.c (_bfd_elf_new_section_hook): Set the default section
+ type to SHT_NULL.
+ (elf_fake_sections): Set the section type based on asect->flags
+ if it is SHT_NULL. Don't abort on processor specific section
+ types.
+
+2003-07-25 H.J. Lu <hongjiu.lu@intel.com>
+
+ * bfd-in2.h: Regenerated.
+
+2003-07-25 H.J. Lu <hongjiu.lu@intel.com>
+
+ * elf-bfd.h (bfd_elf_special_section): New.
+ (elf_backend_data): Add special_sections, a pointer to
+ bfd_elf_special_section.
+ (elf_section_type). New.
+ (elf_section_flags): New.
+ (_bfd_elf_get_sec_type_attr): New.
+
+ * elf.c (_bfd_elf_make_section_from_shdr): Always use the
+ real section type/flags.
+ (special_sections): New.
+ (get_special_section): New.
+ (_bfd_elf_get_sec_type_attr): New.
+ (_bfd_elf_new_section_hook): Check special_section to set
+ elf_section_type and elf_section_flags.
+ (elf_fake_sections): Don't use section name to set ELF section
+ data.
+
+ * elf32-m32r.c (m32r_elf_special_sections): New.
+ (elf_backend_special_sections): Defined.
+
+ * elf32-m68hc11.c (elf32_m68hc11_special_sections): New.
+ (elf_backend_special_sections): Defined.
+
+ * elf32-mcore.c (mcore_elf_special_sections): New.
+ (elf_backend_special_sections): Defined.
+
+ * elf32-ppc.c (ppc_elf_special_sections): New.
+ (elf_backend_special_sections): Defined.
+
+ * elf32-sh64.c (sh64_elf_special_sections): New.
+ (elf_backend_special_sections): Defined.
+
+ * elf32-v850.c (v850_elf_special_sections): New.
+ (elf_backend_special_sections): Defined.
+
+ * elf32-xtensa.c (elf_xtensa_special_sections): New.
+ (elf_backend_special_sections): Defined.
+
+ * elf64-alpha.c (elf64_alpha_special_sections): New.
+ (elf_backend_special_sections): Defined.
+
+ * elf64-hppa.c (elf64_hppa_special_sections): New.
+ (elf_backend_special_sections): Defined.
+
+ * elf64-ppc.c (ppc64_elf_special_sections): New.
+ (elf_backend_special_sections): Defined.
+
+ * elf64-sh64.c (sh64_elf64_special_sections): New.
+ (elf_backend_special_sections): Defined.
+
+ * elfxx-ia64.c (elfNN_ia64_special_sections): New.
+ (elf_backend_special_sections): Defined.
+
+ * elfxx-mips.c (_bfd_mips_elf_special_sections): New.
+
+ * elfxx-mips.h (_bfd_mips_elf_special_sections): New.
+ (elf_backend_special_sections): Defined.
+
+ * elfxx-target.h (elf_backend_special_sections): New. Default
+ to NULL.
+ (elfNN_bed): Initialize special_sections.
+
+ * section.c (bfd_abs_section): Remove const.
+ (bfd_und_section): Likewise.
+ (bfd_com_section): Likewise.
+ (bfd_ind_section): Likewise.
+
+2003-07-24 Nick Clifton <nickc@redhat.com>
+
+ * coff-arm.c (EXTRA_S_FLAGS): Include SEC_CODE so that code
+ sections are assigned the LOAD attribute.
+
+2003-07-25 Kaz Kojima <kkojima@rr.iij4u.or.jp>
+
+ * elf32-sh.c: Convert to C90. Replace PTR with void *.
+ * elf32-sh64-com.c: Likewise.
+ * elf32-sh64.c: Likewise.
+ * elf32-sh64.h: Likewise.
+ * elf64-sh64.c: Likewise.
+
+2003-07-24 Kaz Kojima <kkojima@rr.iij4u.or.jp>
+
+ * elf32-sh.c (sh_elf_adjust_dynamic_symbol): Use SYMBOL_CALLS_LOCAL.
+ (allocate_dynrelocs): Likewise.
+ (sh_elf_relocate_section): Likewise. Use SYMBOL_REFERENCES_LOCAL.
+ (sh_elf_finish_dynamic_symbol): Use SYMBOL_REFERENCES_LOCAL.
+
+2003-07-24 Nick Clifton <nickc@redhat.com>
+
+ * po/fr.po: Updated French translation.
+
+2003-07-23 Bob Wilson <bob.wilson@acm.org>
+
+ * elf32-xtensa.c (xtensa_elf_dynamic_symbol_p): Make inline and move
+ near the beginning of the file. Swap order of arguments. Call
+ _bfd_elf_dynamic_symbol_p with "ignore_protected" set to 0.
+ (elf_xtensa_fix_refcounts): Adjust xtensa_elf_dynamic_symbol_p call.
+ (elf_xtensa_relocate_section): Likewise.
+ (shrink_dynamic_reloc_sections): Likewise.
+
+2003-07-23 Bob Wilson <bob.wilson@acm.org>
+
+ * elf32-xtensa.c (plt_reloc_count): Fix typo in comment.
+ (elf_xtensa_size_dynamic_sections): Use elf_discarded_section.
+ (elf_xtensa_combine_prop_entries): Avoid returning non-zero without
+ first printing an error message.
+ (elf_xtensa_finish_dynamic_sections): Likewise.
+ (elf_xtensa_discard_info_for_section): Adjust size of .got.loc when
+ discarding literal table entries.
+ (elf_xtensa_merge_private_bfd_data): Remove newline from error message.
+ (elf_xtensa_do_asm_simplify): Likewise.
+
+2003-07-23 Stephane Carrez <stcarrez@nerim.fr>
+
+ * elf32-m68hc1x.c (elf32_m68hc11_size_stubs): Avoid crash when
+ we have a local symbol in common section.
+
+2003-07-22 H.J. Lu <hongjiu.lu@intel.com>
+
+ * elflink.c (_bfd_elf_dynamic_symbol_p): Don't return TRUE for
+ weak symbols.
+
+2003-07-22 Nick Clifton <nickc@redhat.com>
+
+ * coffcode.h (coff_slurp_symbol_table): Add C_TCSYM and C_ECOML to
+ expected RS6000 storage classes.
+
+2003-07-21 H.J. Lu <hongjiu.lu@intel.com>
+
+ * elfxx-ia64.c (elfNN_ia64_size_dynamic_sections): Mark
+ output_bfd unused to silence gcc.
+
+2003-07-21 Nick Clifton <nickc@redhat.com>
+
+ * po/sv.po: Updated Swedish translation.
+
+2003-07-21 Alan Modra <amodra@bigpond.net.au>
+
+ * elf-bfd.h (SYMBOL_REFERENCES_LOCAL, SYMBOL_CALLS_LOCAL): Use..
+ (_bfd_elf_symbol_refs_local_p): ..this. Declare.
+ * elflink.c (_bfd_elf_symbol_refs_local_p): New function.
+ * elf32-i386.c (elf_i386_relocate_section): Remove h NULL test
+ now done in _bfd_elf_symbol_refs_local_p.
+ * elf32-ppc.c (ppc_elf_relocate_section): Likewise.
+ * elf64-ppc.c (ppc64_elf_relocate_section): Likewise.
+ * elf64-x86-64.c (elf64_x86_64_relocate_section): Likewise.
+
+2003-07-18 H.J. Lu <hongjiu.lu@intel.com>
+
+ * elflink.c (_bfd_elf_dynamic_symbol_p): Undo the last change.
+
+2003-07-18 H.J. Lu <hongjiu.lu@intel.com>
+
+ * elf-bfd.h (SYMBOL_REFERENCES_LOCAL): Fix a typo.
+ (SYMBOL_CALLS_LOCAL): Likewise.
+
+ * elflink.c (_bfd_elf_dynamic_symbol_p): Return TRUE
+ immediately if symbol isn't defined locally.
+
+2003-07-18 Richard Henderson <rth@redhat.com>
+
+ * elflink.c (_bfd_elf_dynamic_symbol_p): New.
+ * elf-bfd.h (_bfd_elf_dynamic_symbol_p): Declare it.
+ (SYMBOL_REFERENCES_LOCAL, SYMBOL_CALLS_LOCAL): Use it.
+ * elf32-xtensa.c (xtensa_elf_dynamic_symbol_p): Likewise.
+ * elf64-alpha.c (alpha_elf_dynamic_symbol_p): Likewise.
+ * elf64-hppa.c (elf64_hppa_dynamic_symbol_p): Likewise.
+ * elfxx-ia64.c (elfNN_ia64_dynamic_symbol_p): Likewise.
+ Update all callers to provide the relocation being resolved.
+
+2003-07-17 Shaun Jackman <sjackman@pathwayconnect.com>
+
+ * config.bfd (arm-wince-pe): Add -DARM_COFF_BUGFIX to
+ targ_cflags.
+
+2003-07-17 Nick Clifton <nickc@redhat.com>
+
+ * po/es.po: New Spanish translation.
+ * po/sv.po: New Swedish translation.
+ * po/opcodes.pot: Regenerate.
+
+2003-07-16 Richard Henderson <rth@redhat.com>
+
+ * config.bfd, configure.host, configure.in: Remove ia64-aix support.
+ * elfxx-ia64.c, targets.c: Likewise.
+
+2003-07-16 Richard Henderson <rth@redhat.com>
+
+ * elfxx-ia64.c (elfNN_ia64_dynamic_symbol_p): Properly return false
+ for symbols defined locally plus -Bsymbolic. Tidy logic.
+
+2003-07-15 Richard Sandiford <rsandifo@redhat.com>
+
+ * archures.c (bfd_mach_mips7000): New.
+ * bfd-in2.h: Regenerated.
+ * cpu-mips.c (arch_info_struct): Add an entry for mips:7000.
+ * elfxx-mips.c (mips_set_isa_flags): Handle bfd_mach_mips7000.
+ (mips_mach_extensions): Add an entry for it.
+
+2003-07-14 Nick Clifton <nickc@redhat.com>
+
+ * po/tr.po: Update with latest version.
+ * po/SRC-POTFILES.in: Regenerate.
+ * po/bfd.pot: Regenerate.
+ * Makfile.in: Regenerate.
+ * configure: Regenerate.
+
+2003-07-12 Jeff Baker <jbaker@qnx.com>
+
+ * bfd/config.bfd (__QNXTARGET__): Define for Neutrino architectures.
+ * bfd/elf32-arm.h (ELF_MAXPAGESIZE): Set to 4k for Neutrino.
+ * bfd/elf32-sh.c (ELF_MAXPAGESIZE): Set to 4k for Neutrino.
+ * bfd/elf32-ppc.c (ELF_MAXPAGESIZE): Set to 4k for Neutrino.
+
+2003-07-12 Jeff Muizelaar <muizelaar@rogers.com>
+
+ * coffcode.h (coff_set_section_contents): Set the
+ IMAGE_FILE_32BIT_MACHINE flag for PE targets.
+
+2003-07-11 Richard Sandiford <rsandifo@redhat.com>
+
+ * bfd-in.h (bfd_h8300_pad_address): Declare.
+ * bfd-in2.h: Regenerate.
+ * cpu-h8300.c (bfd_h8300_pad_address): New function.
+ * coff-h8300.c (h8300_reloc16_estimate): Use it to canonicalize
+ addresses before checking whether they can be relaxed.
+ (h8300_reloc16_extra_cases): Likewise for the R_MOVL2 sanity check.
+ Don't complain about overflows in general 8-bit relocations.
+ * elf32-h8300.c (elf32_h8_relax_section): Use bfd_h8300_pad_address.
+ Fix handling of R_H8_DIR24A8.
+
+2003-07-11 Richard Sandiford <rsandifo@redhat.com>
+
+ * elf32-h8300.c: Convert function prototypes and definitions
+ to C90 syntax.
+ * coff-h8300.c: Likewise.
+ * cpu-h8300.c: Likewise.
+
+2003-07-11 Alan Modra <amodra@bigpond.net.au>
+
+ * po/SRC-POTFILES.in: Regenerate.
+ * po/bfd.pot: Likewise.
+
+2003-07-10 Bob Wilson <bob.wilson@acm.org>
+
+ * elf32-xtensa.c (elf_xtensa_create_dynamic_sections): Create new
+ .got.loc section. Do not set SEC_ALLOC or SEC_LOAD flags for the
+ .xt.lit.plt section.
+ (elf_xtensa_size_dynamic_sections): Set size of the .got.loc section
+ and allocate memory for it.
+ (elf_xtensa_combine_prop_entries): Copy contents of .xt.lit output
+ section to the .got.loc section.
+ (elf_xtensa_finish_dynamic_sections): Fix up call to
+ elf_xtensa_combine_prop_entries and set DT_XTENSA_GOT_LOC_OFF to
+ the address of .got.loc.
+ (relax_property_section): Shrink .got.loc to match changes in any
+ literal table section.
+ (xtensa_is_property_section): Change to match
+ xtensa_get_property_section_name.
+ (xtensa_is_littable_section): New.
+
+2003-07-10 H.J. Lu <hongjiu.lu@intel.com>
+
+ * elfxx-ia64.c (IA64_HOWTO): Set dst_mask to -1 instead of
+ -1LL.
+
+2003-07-10 Alan Modra <amodra@bigpond.net.au>
+
+ * Makefile.am (BFD32_BACKENDS): Add elf32-am33lin.lo.
+ (BFD32_BACKENDS_CFILES): elf32-am33lin.c not elf32-am33lin.lo.
+ Run "make dep-am".
+ * Makefile.in: Regenerate.
+
+2003-07-10 Alexandre Oliva <aoliva@redhat.com>
+
+ 2001-09-12 Alexandre Oliva <aoliva@redhat.com>
+ * elf32-am33lin.c (ELF_MACHINE_CODE): Redefine to EM_MN10300.
+ (ELF_MACHINE_ALT1): Define to EM_CYGNUS_MN10300.
+ 2001-06-02 Nick Clifton <nickc@cambridge.redhat.com>
+ * elf32-am33lin.c: Rename global functions.
+ 2001-05-09 Alexandre Oliva <aoliva@redhat.com>
+ * config.bfd (am33_2.0, am33_2.0-*-linux*): Added.
+ * configure.in (bfd_elf32_am33lin_vec): Added.
+ * Makefile.am (BFD32_BACKENDS): Added elf32-am33lin.lo.
+ (elf32-am33lin.lo): List dependencies.
+ * aclocal.m4, configure, Makefile.in: Rebuilt.
+ * elf-m10300.c (TARGET_LITTLE_SYM, TARGET_LITTLE_NAME,
+ ELF_ARCH, ELF_MACHINE_CODE, ELF_MAXPAGESIZE): Define only if
+ ELF_ARCH was not defined before.
+ (elf_symbol_leading_char): Define if not defined.
+ * elf32-am33lin.c: Override the definitions above.
+ * targets.c (bfd_elf32_am33lin_vec): New.
+
+2003-07-09 Alexandre Oliva <aoliva@redhat.com>
+
+ 2002-12-12 Alexandre Oliva <aoliva@redhat.com>
+ * elf-m10300.c (elf32_mn10300_link_hash_newfunc): Initialize
+ pcrel_relocs_copied.
+ 2001-12-13 Alexandre Oliva <aoliva@redhat.com>
+ * elf-m10300.c (ELF_DYNAMIC_INTERPRETER): Renamed from
+ ld-linux.so.2 to ld.so.1.
+ 2001-10-10 Alexandre Oliva <aoliva@redhat.com>
+ * elf-m10300.c (elf_mn10300_sizeof_plt0): New macro.
+ (_bfd_mn10300_elf_adjust_dynamic_symbol): Use it.
+ (_bfd_mn10300_elf_finish_dynamic_symbol): Likewise.
+ * elf-m10300.c (_bfd_mn10300_elf_size_dynamic_sections): Allocate
+ .rela.* section contents with bfd_zalloc.
+ 2001-09-25 Alexandre Oliva <aoliva@redhat.com>
+ * elf-m10300.c: Added declarations for functions missing them.
+ Merge some shared-library changes from the i386 back-end. Use
+ R_MN10300_RELATIVE instead of R_MN10300_PCREL32 and
+ R_MN10300_GLOB_DAT instead of R_MN10300_32 where appropriate.
+ (struct elf32_mn10300_link_hash_entry): Remove duplicates of
+ members of elf_link_hash_entry. Adjusted references.
+ (mn10300_elf_final_link_relocate): dynobj was already loaded
+ into a local variable, use it.
+ 2001-09-21 Nick Clifton <nickc@cambridge.redhat.com>
+ * elf-m10300.c: Add missing function prototypes.
+ 2001-08-24 Alexandre Oliva <aoliva@redhat.com>
+ * elf-m10300.c (mn10300_elf_relocate_section): Don't compute
+ relocation for dynamic relocations.
+ 2001-05-16 Alexandre Oliva <aoliva@redhat.com>
+ * reloc.c (BFD_RELOC_MN10300_GOTOFF24): New.
+ * elf-m10300.c: Introduce GOTPC16, GOTOFF24, GOTOFF16 and
+ PLT16, and rename GOTPC to GOTPC32 and GOTOFF to GOTOFF32.
+ (_bfd_mn10300_elf_create_dynamic_sections): Move creation ot PLT...
+ (_bfd_mn10300_elf_create_got_section): ... here, so that its
+ adress is already known at the time we compute relaxations.
+ (mn10300_elf_relax_section): Relax GOTPC32, GOTOFF32, GOT32
+ and PLT32 to narrower relocations.
+ * libbfd.h, bfd-in2.h: Rebuilt.
+ 2001-04-12 Alexandre Oliva <aoliva@redhat.com>
+ * reloc.c (BFD_RELOC_MN10300_GOT32, BFD_RELOC_MN10300_GOT24,
+ BFD_RELOC_MN10300_GOT16, BFD_RELOC_MN10300_COPY,
+ BFD_RELOC_MN10300_GLOB_DAT, BFD_RELOC_MN10300_JMP_SLOT,
+ BFD_RELOC_MN10300_RELATIVE): New relocs.
+ * libbfd.h, bfd-in2.h: Rebuilt.
+ * elf-m10300.c (struct elf_mn10300_pcrel_relocs_copied): New.
+ (struct elf32_mn10300_link_hash_entry): Added DSO-related
+ fields.
+ (elf_mn10300_howto): Defined new relocation types.
+ (mn10300_reloc_map): Map them.
+ (_bfd_mn10300_elf_create_got_section): New fn.
+ (mn10300_elf_check_relocs): Handle PIC relocs.
+ (mn10300_elf_final_link_relocate): Likewise.
+ (mn10300_elf_relocate_section): Handle DSOs.
+ (PLT0_ENTRY_SIZE, PLT_ENTRY_SIZE, PIC_PLT_ENTRY_SIZE): New macros.
+ (elf_mn10300_plt0_entry, elf_mn10300_plt_entry,
+ elf_mn10300_pic_plt_entry): New.
+ (elf_mn10300_sizeof_plt, elf_mn10300_plt_plt0_offset,
+ elf_mn10300_plt0_linker_offset, elf_mn10300_plt0_gotid_offset,
+ elf_mn10300_plt_temp_offset, elf_mn10300_plt_symbol_offset,
+ elf_mn10300_plt_reloc_offset: New macros.
+ (ELF_DYNAMIC_INTERPRETER): Likewise.
+ (_bfd_mn10300_elf_create_dynamic_sections): New function.
+ (_bfd_mn10300_elf_adjust_dynamic_symbol): Likewise.
+ (_bfd_mn10300_elf_discard_copies): Likewise.
+ (_bfd_mn10300_elf_size_dynamic_sections): Likewise.
+ (_bfd_mn10300_elf_finish_dynamic_symbol): Likewise.
+ (_bfd_mn10300_elf_finish_dynamic_sections): Likewise.
+ (elf_backend_can_gc_sections,
+ elf_backend_create_dynamic_sections,
+ elf_backend_adjust_dynamic_sections,
+ elf_backend_size_dynamic_sections,
+ elf_backend_finish_dynamic_symbol,
+ elf_backend_finish_dynamic_sections, elf_backend_want_got_plt,
+ elf_backend_plt_readonly, elf_backend_want_plt_sym,
+ elf_backend_got_header_size, elf_backend_plt_header_size): New
+ macros.
+
+2003-07-09 Alexandre Oliva <aoliva@redhat.com>
+
+ 2001-05-06 Alexandre Oliva <aoliva@redhat.com>
+ * elf-m10300.c (compute_function_info): Account for AM33
+ registers in `movm' when computing stack space for `call' when
+ linking for AM33/2.0 link.
+ 2000-04-01 Alexandre Oliva <aoliva@cygnus.com>
+ * archures.c (bfd_mach_am33_2): Renamed from bfd_mach_am332.
+ * bfd-in2.h: Rebuilt.
+ * cpu-m10300.c (bfd_am33_2_arch): Renamed from bfd_am332_arch.
+ * elf-m10300.c: Updated.
+ 2000-03-31 Alexandre Oliva <aoliva@cygnus.com>
+ * archures.c (bfd_mach_am332): Defined.
+ * bfd-in2.h: Rebuilt.
+ * cpu-m10300.c (bfd_am332_arch): Defined.
+ (bfd_am33_arch): Chained with am33-2.
+ * elf-m10300.c (elf_mn10300_mach): Handle am332.
+ (_bfd_mn10300_elf_final_write_processing): Likewise.
+
+2003-07-09 H.J. Lu <hongjiu.lu@intel.com>
+
+ * elfxx-ia64.c (IA64_HOWTO): Set dst_mask to -1LL.
+
+2003-07-10 Alan Modra <amodra@bigpond.net.au>
+
+ * elf64-ppc.c (bfd_elf64_mkobject): Define.
+ (struct ppc64_elf_obj_tdata): New.
+ (ppc64_elf_tdata, ppc64_tlsld_got): Define.
+ (ppc64_elf_mkobject): New function.
+ (struct got_entry): Add "owner". Move "tls_type".
+ (struct ppc_link_hash_table): Delete "relgot", "tlsld_got".
+ (ppc64_elf_init_stub_bfd): New function.
+ (create_got_section): Create header .got in dynobj. Create .got
+ and .rela.got in each bfd. Stash pointers in ppc64_elf_obj_tdata.
+ (ppc64_elf_create_dynamic_sections): Don't call create_got_section.
+ Look for dynobj .got, and test it.
+ (ppc64_elf_copy_indirect_symbol): Adjust for changed got.
+ (update_local_sym_info): Likewise.
+ (ppc64_elf_check_relocs): Likewise.
+ (ppc64_elf_gc_sweep_hook): Likewise.
+ (ppc64_elf_tls_optimize): Likewise.
+ (allocate_dynrelocs): Likewise.
+ (ppc64_elf_size_dynamic_sections): Likewise.
+ (ppc64_elf_relocate_section): Likewise.
+ (ppc64_elf_next_toc_section): Update comment.
+ (toc_adjusting_stub_needed): Remove unneeded cast.
+ (ppc64_elf_build_stubs): Check for stub sections in stub bfd by
+ testing section flags.
+ (ppc64_elf_build_stubs): Likewise.
+ (ppc64_elf_size_stubs): Likewise. Remove stub_bfd param.
+ (ppc64_elf_finish_dynamic_sections): Write out got sections.
+ (func_desc_adjust): Copy over dynamic info for undef weaks.
+ * elf64-ppc.h (ppc64_elf_init_stub_bfd): Declare.
+ (ppc64_elf_size_stubs): Update prototype.
+ * elflink.h (elf_link_sort_relocs): Use link_orders to find reldyn
+ input sections rather than scanning dynobj.
+
+2003-07-09 Richard Sandiford <rsandifo@redhat.com>
+
+ * elfxx-mips.c (mips_elf_link_hash_entry): Remove min_dyn_reloc_index.
+ (bfd_mips_elf_swap_msym_in, bfd_mips_elf_swap_msym_out): Delete.
+ (mips_elf_create_msym_section): Delete.
+ (mips_elf_create_dynamic_relocation): Don't set min_dyn_reloc_index.
+ (_bfd_mips_elf_copy_indirect_symbol): Likewise.
+ (_bfd_mips_elf_create_dynamic_sections): Don't create .msym.
+ (_bfd_mips_elf_size_dynamic_sections): Don't calculate its size.
+ (_bfd_mips_elf_size_dynamic_sections): Don't add DT_MIPS_MSYM.
+ (_bfd_mips_elf_finish_dynamic_symbol): Don't add symbols to .msym.
+ (_bfd_mips_elf_finish_dynamic_sections): Likewise.
+
+2003-07-09 Richard Sandiford <rsandifo@redhat.com>
+
+ * elfxx-mips.c (mips_elf_irix6_finish_dynamic_symbol): Make the
+ symbols protected.
+
+2003-07-09 Richard Sandiford <rsandifo@redhat.com>
+
+ * elfxx-mips.c (mips_elf_create_dynamic_relocation): Fix handling
+ of relocations whose offset is -2.
+
+2003-07-09 Richard Sandiford <rsandifo@redhat.com>
+
+ * bfd/elfxx-mips.c (mips_elf_create_dynamic_relocation): Treat
+ forced-local symbols like other locals. Don't create relocations
+ against STN_UNDEF in irix objects.
+
+2003-07-09 Richard Sandiford <rsandifo@redhat.com>
+
+ * bfd/elfxx-mips.c (mips_elf_create_dynamic_relocation): In SGI-
+ compatible objects, add the values of defined external symbols
+ to the addend.
+
+2003-07-09 Richard Sandiford <rsandifo@redhat.com>
+
+ * elfxx-mips.c (_bfd_mips_elf_finish_dynamic_symbol): Always
+ initialize a GOT entry to the symbol's st_value.
+
+2003-07-08 Alan Modra <amodra@bigpond.net.au>
+
+ * elf-bfd.h (struct elf_obj_tdata): Move linker_section_pointers..
+ * elf32-ppc.c (struct ppc_elf_obj_tdata): ..to here. New.
+ (ppc_elf_tdata): Define.
+ (elf_local_ptr_offsets): Adjust.
+ (ppc_elf_mkobject): New function.
+ (bfd_elf32_mkobject): Define.
+
+ * elfcode.h (elf_object_p): Allocate tdata via _bfd_set_format.
+ * elfcore.h (elf_core_file_p): Likewise.
+ * section.c (bfd_section_init): Remove prototype.
+
+2003-07-08 Alan Modra <amodra@bigpond.net.au>
+
+ * elf-bfd.h (struct elf_link_hash_entry): Remove linker_section_pointer
+ field.
+ (enum elf_linker_section_enum): Delete.
+ (struct elf_linker_section): Delete.
+ (struct elf_linker_section_pointers): Delete.
+ (struct elf_obj_tdata): Remove #if 0 chunk. Remove linker_section.
+ Make linker_section_pointers a void**.
+ (elf_local_ptr_offsets, elf_linker_section): Don't define.
+ * elf32-ppc.c (enum elf_linker_section_enum): New, cut-down version
+ of old item in elf-bfd.h.
+ (struct elf_linker_section): Likewise.
+ (struct elf_linker_section_pointers): Likewise.
+ (elf_local_ptr_offsets): Define.
+ (struct ppc_elf_link_hash_entry): Add linker_section_pointer.
+ (ppc_elf_link_hash_newfunc): Init it.
+ (struct ppc_elf_link_hash_table): Add sbss.
+ (ppc_elf_link_hash_table_create): zmalloc rather than clearing
+ individual fields.
+ (elf_create_linker_section): Fold into..
+ (ppc_elf_create_linker_section): ..here. Remove hole_size code.
+ Make rela section here if shared.
+ (elf_find_pointer_linker_section): Pass lsect rather than enum.
+ (elf_create_pointer_linker_section): Adjust. zalloc rather than
+ clearing in a loop.
+ (elf_finish_pointer_linker_section): Adjust. Don't make rela
+ section here.
+ (ppc_elf_check_relocs): Adjust.
+ (ppc_elf_add_symbol_hook): Tighten hash creator test. Remove code
+ creating .sbss by hand.
+ * elf.c (_bfd_elf_link_hash_newfunc): Adjust.
+
+2003-07-04 Jakub Jelinek <jakub@redhat.com>
+
+ * elf32-s390.c (elf_howto_table): Change R_390_GOT12 to
+ complain_overflow_bitfield.
+ * elf64-s390.c (elf_howto_table): Change R_390_GOT12 to
+ complain_overflow_bitfield.
+
+2003-07-04 Jakub Jelinek <jakub@redhat.com>
+
+ * elf-bfd.h (SYMBOL_REFERENCES_LOCAL, SYMBOL_CALLS_LOCAL): Return
+ true even if -pie.
+
+2003-07-04 Jakub Jelinek <jakub@redhat.com>
+
+ * elfxx-ia64.c (struct elfNN_ia64_link_hash_table): Add rel_fptr_sec.
+ (elfNN_ia64_dynamic_symbol_p): Change info->shared into
+ !info->executable.
+ (get_fptr): For -pie create .opd as writable section and create
+ .rela.opd as well.
+ (elfNN_ia64_check_relocs): Change info->shared into
+ !info->executable.
+ (allocate_fptr): Likewise.
+ (allocate_dynrel_entries): Account for a relative reloc for -pie
+ @fptr(). Don't account for a relative reloc if -pie want_ltoff_fptr
+ for undefweak symbol. Account for an IPLT reloc in .rela.opd
+ section if -pie.
+ (set_got_entry): Don't create a relative reloc if -pie
+ want_ltoff_fptr for undefweak symbol.
+ (set_fptr_entry): Emit an IPLT reloc in .rela.opd for -pie.
+ (elfNN_ia64_relocate_section): Emit a relative reloc for -pie
+ @fptr().
+
+ * elfxx-ia64.c (elfNN_ia64_relocate_section): Issue undefined_symbol
+ even if -pie.
+ * elf32-i386.c (elf_i386_relocate_section): Likewise.
+ * elf64-x86-64.c (elf64_x86_64_relocate_section): Likewise.
+ * elf64-sparc.c (sparc64_elf_relocate_section): Likewise.
+ * elf64-s390.c (elf_s390_relocate_section): Likewise.
+ * elf64-ppc.c (ppc64_elf_relocate_section): Likewise.
+ * elf64-alpha.c (elf64_alpha_relocate_section): Likewise.
+ * elf32-sparc.c (elf32_sparc_relocate_section): Likewise.
+ * elf32-s390.c (elf_s390_relocate_section): Likewise.
+ * elf32-ppc.c (ppc_elf_relocate_section): Likewise.
+
+2003-07-04 Paul Clarke <paulc@senet.com.au>
+
+ * elf32-h8300.c (R_H8_DIR32A16): Fix name field.
+ (elf32_h8_relax_section) <R_H8_DIR16A8>: Adjust position of relocation.
+ <R_H8_DIR32A16>: Fix type of relocation.
+
+2003-07-04 Kaz Kojima <kkojima@rr.iij4u.or.jp>
+
+ * elf32-sh.c (sh_elf_create_dynamic_sections): Return if dynamic
+ sections were created already. Remove unnecessary tests of
+ the previous change.
+
+2003-07-04 Kaz Kojima <kkojima@rr.iij4u.or.jp>
+
+ * elf32-sh.c (sh_elf_create_dynamic_sections): Don't call
+ bfd_make_section for existing sections.
+
+2003-07-04 Alan Modra <amodra@bigpond.net.au>
+
+ * elf32-sparc.c (elf32_sparc_check_relocs): Don't call
+ create_got_section if we already have done so.
+ * elf32-sh.c (sh_elf_create_dynamic_sections): Likewise.
+ (sh_elf_check_relocs): Likewise.
+ (sh_elf_adjust_dynamic_symbol): Delete "dynobj" var. Use
+ htab->root.dynobj instead.
+ (sh_elf_check_relocs): Likewise.
+ (sh_elf_finish_dynamic_sections): Likewise.
+
+ * section.c (bfd_make_section): Return NULL for existing section.
+
+2003-07-04 Alan Modra <amodra@bigpond.net.au>
+
+ * elf32-ppc.c (ppc_elf_create_dynamic_sections): Don't call
+ ppc_elf_create_got if we've already done so.
+
+ * elf-bfd.h (_bfd_elf_create_linker_section) Don't declare.
+ (_bfd_elf_find_pointer_linker_section): Likewise.
+ (bfd_elf32_create_pointer_linker_section): Likewise.
+ (bfd_elf32_finish_pointer_linker_section): Likewise.
+ (bfd_elf64_create_pointer_linker_section): Likewise.
+ (bfd_elf64_finish_pointer_linker_section): Likewise.
+ (_bfd_elf_make_linker_section_rela): Likewise.
+ * elfcode.h (elf_create_pointer_linker_section): Don't define.
+ (elf_finish_pointer_linker_section): Likewise.
+ * elflink.c (_bfd_elf_make_linker_section_rela): Delete.
+ (_bfd_elf_create_linker_section): Move this function..
+ (_bfd_elf_find_pointer_linker_section): ..and this..
+ * elflink.h (elf_create_pointer_linker_section): ..and this..
+ (elf_finish_pointer_linker_section): ..and this..
+ * elf32-ppc.c: ..to here, renaming to the following, and adjusting
+ calls.
+ (elf_create_linker_section): Convert to C90, tidy.
+ (elf_find_pointer_linker_section): Likewise.
+ (elf_create_pointer_linker_section): Likewise.
+ (elf_finish_pointer_linker_section): Likewise.
+ * elf32-i370.c: Delete #if 0 code.
+
+2003-07-02 Alan Modra <amodra@bigpond.net.au>
+
+ * elf64-ppc.c (ppc64_elf_func_desc_adjust): Don't allow _savef* and
+ _restf* to be satisfied by shared libs, and always force them local.
+ (toc_adjusting_stub_needed): Avoid scanning linker created sections.
+ Correct test for "bl".
+ (ppc64_elf_relocate_section <R_PPC64_TLS>): Correct test for
+ primary opcode 31.
+
+2003-07-01 Martin Schwidefsky <schwidefsky@de.ibm.com>
+
+ * elf32-s390.c (s390_elf_ldisp_reloc): New prototype.
+ (s390_tls_reloc): New function.
+ (elf_howto_table): Add long displacement relocations R_390_20,
+ R_390_GOT20, R_390_GOTPLT20 and R_390_TLS_GOTIE20.
+ (elf_s390_reloc_type_lookup): Likewise.
+ (elf_s390_check_relocs): Likewise.
+ (elf_s390_gc_sweep_hook): Likewise.
+ (elf_s390_relocate_section): Likewise.
+ * elf64-s390.c: Same changes as for elf32-s390.c.
+ * reloc.c: Add long displacement relocations BFD_RELOC_390_20,
+ BFD_RELOC_390_GOT20, BFD_RELOC_390_GOTPLT20 and
+ BFD_RELOC_390_TLS_GOTIE20.
+ * bfd-in2.h: Regenerate.
+ * libbfd.h: Likewise.
+
+2003-06-30 Alan Modra <amodra@bigpond.net.au>
+
+ * cpu-ia64-opc.c (ext_imms_scaled): Don't sign extend using shifts.
+ (ins_imms, ins_immsm1u4): Likewise. Warning fix.
+
+2003-06-29 Alan Modra <amodra@bigpond.net.au>
+
+ * archive.c: Convert to C90, remove unnecessary prototypes and casts.
+ Replace PTR with void *. Formatting.
+ * archive64.c: Likewise.
+ * archures.c: Likewise.
+ * bfd-in.h: Likewise.
+ * bfd.c: Likewise.
+ * bfdio.c: Likewise.
+ * bfdwin.c: Likewise.
+ * cache.c: Likewise.
+ * corefile.c: Likewise.
+ * format.c: Likewise.
+ * init.c: Likewise.
+ * libbfd-in.h: Likewise.
+ * libbfd.c: Likewise.
+ * linker.c: Likewise.
+ * opncls.c: Likewise.
+ * reloc.c: Likewise.
+ * section.c: Likewise.
+ * simple.c: Likewise.
+ * syms.c: Likewise.
+ * targets.c: Likewise.
+ * bfd-in2.h: Regenerate.
+ * libbfd.h: Regenerate.
+
+ * ecoff.c (bfd_debug_section): Add missing kept_section initialization.
+ * libbfd-in.h (_bfd_sh_align_load_span): Don't declare if defined.
+ * libbfd.c (COERCE32, EIGHT_GAZILLION): Simplify.
+ (bfd_getb64): Rewrite without parens.
+ (bfd_getl64, bfd_getb_signed_64, bfd_getl_signed_64): Likewise.
+ * cache.c (insert, snip): Remove INLINE.
+ * linker.c (bfd_link_add_undef): Likewise.
+
+2003-06-29 Andreas Jaeger <aj@suse.de>
+
+ * elf64-x86-64.c: Convert to ISO C90 prototypes, remove
+ unnecessary prototypes. Replace PTR with void *.
+ (elf64_x86_64_adjust_dynamic_symbol): Use SYMBOL_CALLS_LOCAL to
+ trim plt entries. Move undefweak non-default visibility test ...
+ (allocate_dynrelocs): ... from here.
+ (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Pass SHARED instead of INFO.
+ Change all callers.
+ (allocate_dynrelocs): Use SYMBOL_CALLS_LOCAL. Use
+ SYMBOL_REFERENCES_LOCAL for dynreloc check.
+ (elf64_x86_64_relocate_section): Use SYMBOL_CALLS_LOCAL for
+ dynreloc and .got relocs.
+ (elf64_x86_64_finish_dynamic_symbol): Use SYMBOL_REFERENCES_LOCAL
+ for .got relocs.
+
+2003-06-29 Thiemo Seufer <seufer@csv.ica.uni-stuttgart.de>
+
+ * elfxx-mips.c: Allow lazy binding for R_MIPS_JALR.
+
+2003-06-27 Nick Clifton <nickc@redhat.com>
+
+ * opncls.c (bfd_add_gnu_debuglink_section): Rename to
+ bfd_add_gnu_debuglink_section and only create the section, do not
+ fill in its contents.
+ (bfd_fill_in_gnu_debuglink_section): New function. Fill in the
+ contents of a .gnu-debuglink section.
+ * bfd-in2.h: Regenerate.
+
+2003-06-27 Thiemo Seufer <seufer@csv.ica.uni-stuttgart.de>
+
+ * elfxx-mips.c: Revert .got alignment to 2**4.
+
+2003-06-27 Thiemo Seufer <seufer@csv.ica.uni-stuttgart.de>
+
+ * elf32-mips.c: Fix addend for _gp_disp special symbol.
+
+2003-06-27 Thiemo Seufer <seufer@csv.ica.uni-stuttgart.de>
+
+ * elfxx-mips.c (_bfd_mips_elf_fake_sections): Remove non-default
+ relocation header setup.
+
+2003-06-25 Alan Modra <amodra@bigpond.net.au>
+
+ * elf32-ppc.c (ppc_elf_howto_table): Remove unnecessary cast.
+ (ppc_elf_reloc_type_lookup): Modify comment.
+ (ppc_elf_info_to_howto): Ditto.
+ (ppc_elf_relocate_section): Ditto.
+ (ppc_elf_check_relocs): Call ppc_elf_howto_init.
+
+2003-06-25 Alan Modra <amodra@bigpond.net.au>
+
+ * aout-ns32k.c: Correct spelling of "relocatable".
+ * aoutx.h: Likewise.
+ * bfd-in.h: Likewise.
+ * bfd.c: Likewise.
+ * bout.c: Likewise.
+ * coff-a29k.c: Likewise.
+ * coff-alpha.c: Likewise.
+ * coff-arm.c: Likewise.
+ * coff-i386.c: Likewise.
+ * coff-i860.c: Likewise.
+ * coff-i960.c: Likewise.
+ * coff-m68k.c: Likewise.
+ * coff-m88k.c: Likewise.
+ * coff-mcore.c: Likewise.
+ * coff-mips.c: Likewise.
+ * coff-or32.c: Likewise.
+ * coff-ppc.c: Likewise.
+ * coff-rs6000.c: Likewise.
+ * coff-sh.c: Likewise.
+ * coff-tic80.c: Likewise.
+ * coff64-rs6000.c: Likewise.
+ * cofflink.c: Likewise.
+ * cpu-ns32k.c: Likewise.
+ * ecoff.c: Likewise.
+ * ecofflink.c: Likewise.
+ * elf-bfd.h: Likewise.
+ * elf-eh-frame.c: Likewise.
+ * elf-hppa.h: Likewise.
+ * elf-m10200.c: Likewise.
+ * elf-m10300.c: Likewise.
+ * elf.c: Likewise.
+ * elf32-arm.h: Likewise.
+ * elf32-avr.c: Likewise.
+ * elf32-cris.c: Likewise.
+ * elf32-d10v.c: Likewise.
+ * elf32-dlx.c: Likewise.
+ * elf32-fr30.c: Likewise.
+ * elf32-frv.c: Likewise.
+ * elf32-h8300.c: Likewise.
+ * elf32-hppa.c: Likewise.
+ * elf32-i370.c: Likewise.
+ * elf32-i386.c: Likewise.
+ * elf32-i860.c: Likewise.
+ * elf32-i960.c: Likewise.
+ * elf32-ip2k.c: Likewise.
+ * elf32-iq2000.c: Likewise.
+ * elf32-m32r.c: Likewise.
+ * elf32-m68hc11.c: Likewise.
+ * elf32-m68hc1x.c: Likewise.
+ * elf32-m68k.c: Likewise.
+ * elf32-mcore.c: Likewise.
+ * elf32-mips.c: Likewise.
+ * elf32-msp430.c: Likewise.
+ * elf32-openrisc.c: Likewise.
+ * elf32-ppc.c: Likewise.
+ * elf32-s390.c: Likewise.
+ * elf32-sh.c: Likewise.
+ * elf32-sh64.c: Likewise.
+ * elf32-sparc.c: Likewise.
+ * elf32-v850.c: Likewise.
+ * elf32-vax.c: Likewise.
+ * elf32-xstormy16.c: Likewise.
+ * elf32-xtensa.c: Likewise.
+ * elf64-alpha.c: Likewise.
+ * elf64-hppa.c: Likewise.
+ * elf64-mips.c: Likewise.
+ * elf64-mmix.c: Likewise.
+ * elf64-ppc.c: Likewise.
+ * elf64-s390.c: Likewise.
+ * elf64-sh64.c: Likewise.
+ * elf64-sparc.c: Likewise.
+ * elf64-x86-64.c: Likewise.
+ * elfcode.h: Likewise.
+ * elflink.h: Likewise.
+ * elfn32-mips.c: Likewise.
+ * elfxx-ia64.c: Likewise.
+ * elfxx-mips.c: Likewise.
+ * i386linux.c: Likewise.
+ * ieee.c: Likewise.
+ * libcoff-in.h: Likewise.
+ * linker.c: Likewise.
+ * m68klinux.c: Likewise.
+ * pdp11.c: Likewise.
+ * pe-mips.c: Likewise.
+ * peXXigen.c: Likewise.
+ * reloc.c: Likewise.
+ * reloc16.c: Likewise.
+ * sparclinux.c: Likewise.
+ * sunos.c: Likewise.
+ * syms.c: Likewise.
+ * versados.c: Likewise.
+ * vms.c: Likewise.
+ * xcofflink.c: Likewise.
+ * bfd-in2.h: Regenerate.
+ * libcoff.h: Regenerate.
+ * libbfd.h: Regenerate.
+
+2003-06-24 Alan Modra <amodra@bigpond.net.au>
+
+ * elf32-ppc.c (ppc_elf_check_relocs): Report plt reloc against
+ local sym errors.
+
+ * elf32-i386.c: Convert to C90 function definitions, remove unnecessary
+ prototypes and casts. Replace PTR with void *. Formatting.
+ * elf32-ppc.c: Likewise. Break long strings too.
+ (ppc_elf_relax_section): Use enum elf_ppc_reloc_type for r_type.
+ (ppc_elf_unhandled_reloc): Internationalize error message.
+ * elf32-ppc.h: Remove PARAMS.
+
+2003-06-23 Mark Mitchell <mark@codesourcery.com>
+
+ * elf32-ppc.c (ppc_elf_begin_write_processing): Use bytes to count
+ APUinfo slots.
+ (ppc_elf_final_write_processing): Likewise.
+
+2003-06-23 H.J. Lu <hongjiu.lu@intel.com>
+
+ * elflink.h (elf_link_input_bfd): Check raw size when using
+ kept_section to preserve debug information discarded by
+ linkonce.
+
+2003-06-20 Alan Modra <amodra@bigpond.net.au>
+
+ * elf64-ppc.c (struct ppc_link_hash_table): Add top_id.
+ (ppc64_elf_setup_section_lists): Set it.
+ (ppc64_elf_relocate_section): Check sym section id against top_id.
+ (ppc_build_one_stub): Comment on top_id.
+
+2003-06-20 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
+
+ * config.bfd: Add tic4x-*-rtems*.
+
+2003-06-20 Alan Modra <amodra@bigpond.net.au>
+
+ * elf64-ppc.c: Convert to C90 function definitions, remove unnecessary
+ prototypes and casts. Replace PTR with void *. Format copyright.
+ Mention ABI links.
+ (struct ppc_link_hash_table): Rename sgot, srelgot, splt, srelplt,
+ sdynbss, srelbss, sglink, sbrlt and srelbrlt to got, relgot .. relbrlt.
+ (ppc_type_of_stub): Make r_type an enum.
+ (ppc64_elf_size_stubs): Likewise.
+ * elf64-ppc.h: Remove PARAMS macro.
+
+2003-06-19 Alan Modra <amodra@bigpond.net.au>
+
+ * elf64-ppc.c (ppc64_elf_link_hash_table_create): Reinstate init of
+ elf hash tab fields.
+
+ * elf64-ppc.c (ppc64_elf_reloc_type_lookup): Tidy prototype.
+ (ppc64_elf_info_to_howto): Likewise.
+ (ppc64_elf_build_stubs): Add "stats" param, and print statistics.
+ * elf64-ppc.h (ppc64_elf_build_stubs): Adjust prototype.
+
+2003-06-19 Alan Modra <amodra@bigpond.net.au>
+
+ * elf64-sparc.c (sparc64_elf_relocate_section): Ignore R_SPARC_DISP32
+ reloc overflow on discarded eh_frame entries.
+
+2003-06-19 Alan Modra <amodra@bigpond.net.au>
+
+ * elf64-ppc.c (toc_adjusting_stub_needed): New function.
+ (ppc64_elf_next_input_section): Use it here to set has_gp_reloc.
+ Return error condition.
+ (ppc64_elf_size_stubs): Restrict toc adjusting stubs to sections
+ that have has_gp_reloc set.
+ (struct ppc_link_hash_table): Add stub_count.
+ (ppc_build_one_stub): Increment it.
+ (ppc64_elf_link_hash_table_create): zmalloc rather than clearing
+ individual fields.
+ * elf64-ppc.h (ppc64_elf_next_input_section): Update prototype.
+
+2003-06-18 Alan Modra <amodra@bigpond.net.au>
+
+ * elflink.h (elf_gc_record_vtentry): Revert last change. Correct
+ size calculation from addend. Round size up.
+
+2003-06-18 Hans-Peter Nilsson <hp@axis.com>
+
+ * elf32-cris.c (cris_elf_relocate_section) <case
+ R_CRIS_32_GOTREL>: When linking a program, don't complain about a
+ symbol from a normal object or an undefined weak symbol.
+
+2003-06-18 Alan Modra <amodra@bigpond.net.au>
+
+ * elf64-ppc.c (ppc64_elf_relocate_section): Accept a symbol on
+ R_PPC64_TOC relocs.
+
+2003-06-17 H.J. Lu <hongjiu.lu@intel.com>
+
+ * section.c (struct sec): Put back kept_section.
+ (STD_SECTION): Put back kept_section initialization.
+ * bfd-in2.h: Regenerate.
+
+ * elflink.h (elf_link_input_bfd): Also check discarded linkonce
+ sections for relocateable output. Use kept_section to preserve
+ debug information discarded by linkonce.
+
+2003-06-17 Roland McGrath <roland@redhat.com>
+
+ * elfxx-ia64.c (elfNN_ia64_relocate_section): Support
+ segment-relative relocation between different segments.
+
+2003-06-17 Alan Modra <amodra@bigpond.net.au>
+
+ * elf64-ppc.c (ppc64_elf_relocate_section): Do unaligned reloc
+ optimizations earlier.
+
+ * elf64-ppc.c (struct ppc_link_hash_table): Reinstate top_index.
+ Restore previous input_list type.
+ (ppc64_elf_link_hash_table_create): Undo last change.
+ (ppc64_elf_setup_section_lists): Reinstate code setting up input lists
+ per output section, but don't bother with bfd_abs_section marker.
+ (ppc64_elf_next_input_section): Adjust for multiple input section
+ lists.
+ (group_sections): Likewise.
+
+2003-06-17 Jakub Jelinek <jakub@redhat.com>
+
+ * elf64-ppc.c (ppc64_elf_relocation_section): Ensure
+ *r_offset == r_addend for RELATIVE relocs against .got.
+
+2003-06-17 Alan Modra <amodra@bigpond.net.au>
+
+ * elf64-ppc.c (ppc64_elf_relocate_section): Optimize unaligned relocs.
+
+2003-06-17 Nick Clifton <nickc@redhat.com>
+
+ * elflink.h (elf_gc_record_vtentry): Allocate an extra element
+ in the vtable_entries_used array to allow for the accessing
+ the largest element.
+
+2003-06-17 Alan Modra <amodra@bigpond.net.au>
+
+ * elf64-ppc.c (struct ppc_link_hash_table): Remove top_index. Modify
+ input_list.
+ (ppc64_elf_link_hash_table_create): Init input_list here.
+ (ppc64_elf_setup_section_lists): Remove code setting up input lists
+ per output section. Set toc_off for abs and other standard sections.
+ (ppc64_elf_reinit_toc): Don't set elf_gp on input bfds lacking a toc.
+ (ppc64_elf_next_input_section): Adjust for single input section list.
+ Don't set toc_curr from input bfds that haven't set elf_gp.
+ (group_sections): Adjust for single input section list.
+
+ * elf64-ppc.c (ppc64_elf_relocate_section): Correct pcrel section zero.
+
+2003-06-16 Alan Modra <amodra@bigpond.net.au>
+
+ * elf64-ppc.c (ppc64_elf_relocate_section): When optimizing toctprel
+ tls, check that a TOC16_DS or TOC16_LO_DS reloc isn't pointing to a
+ dtprel entry. Ensure TLS_LD DTPMOD reloc has a zero addend. Write
+ got section for RELATIVE relocs. Fix wrong comment. Change condition
+ under which dynamic relocs update the section contents.
+
+2003-06-13 Robert Millan <zeratul2@wanadoo.es>
+
+ * config.bfd: Add i386-netbsd-gnu target.
+
+2003-06-12 Nick Clifton <nickc@redhat.com>
+
+ * opncls.c (calc_crc32): Rename to
+ bfd_calc_gnu_debuglink_crc32 and export.
+ (GNU_DEBUGLINK): Define and use to replace occurrences of
+ hard-coded ".gnu_debuglink" in the code.
+ (get_debug_link_info): Prevent aborts by replacing call to
+ xmalloc with a call to malloc.
+ (find_separate_debug_file): Prevent aborts by replacing calls
+ to xmalloc and xstrdup with calls to malloc and strdup.
+ (bfd_add_gnu_debuglink): New function. Add a .gnu_debuglink
+ section to a bfd.
+ * bfd-in2.h: Regenerate.
+
+2003-06-12 Federico G. Schwindt <fgsch@lodoss.net>
+
+ * config.bfd (i[3-7]86-*-openbsd[0-2].* | i[3-7]86-*-openbsd3.[0-3]):
+ New target (was i[3-7]86-*-openbsd* before).
+ (i[3-7]86-*-openbsd*): Change to use bfd_elf32_i386_vec.
+ (vax-*-openbsd*): New target.
+
+2003-06-11 Thiemo Seufer <seufer@csv.ica.uni-stuttgart.de>
+
+ * elfxx-mips.c (MIPS_ELF_OPTIONS_SECTION_NAME): Use .MIPS.options
+ for n32, too.
+ (MIPS_ELF_STUB_SECTION_NAME): Use .MIPS.stubs for n32, too.
+ (mips_elf_rel_dyn_section): Use appropriate section alignment.
+ (mips_elf_create_got_section): Likewise.
+ (_bfd_mips_elf_create_dynamic_sections): Likewise.
+
+2003-06-11 Thiemo Seufer <seufer@csv.ica.uni-stuttgart.de>
+
+ * elf32-mips.c (mips_elf_generic_reloc): New Function.
+ (elf_mips_howto_table_rel): Use it.
+ (gprel32_with_gp): Move prototype.
+ (mips_elf_hi16_reloc): Check for ! BSF_LOCAL instead of zero addend.
+ Use mips_elf_generic_reloc.
+ (mips_elf_got16_reloc): Check for ! BSF_LOCAL instead of zero addend.
+ Code cleanup.
+ (_bfd_mips_elf32_gprel16_reloc): Check for ! BSF_LOCAL instead of
+ zero addend.
+ (mips_elf_gprel32_reloc): Likewise. Use the same GP assignment logic
+ as in the other *_gprel*_reloc functions.
+ (gprel32_with_gp): Handle partial_inplace properly.
+ (mips32_64bit_reloc): Use mips_elf_generic_reloc.
+ (mips16_gprel_reloc): Check for ! BSF_LOCAL instead of zero addend.
+ Do addend handling directly instead of calling
+ _bfd_mips_elf_gprel16_with_gp. Handle partial_inplace properly.
+ * elf64-mips.c (mips_elf64_hi16_reloc): Check for ! BSF_LOCAL instead
+ of zero addend. Handle partial_inplace properly.
+ (mips_elf64_got16_reloc): Check for ! BSF_LOCAL instead of zero
+ addend.
+ (mips_elf64_gprel16_reloc): Likewise.
+ (mips_elf64_literal_reloc): Likewise.
+ (mips_elf64_gprel32_reloc): Likewise. Use the same GP assignment
+ logic as in the other *_gprel*_reloc functions. Handle
+ partial_inplace properly.
+ (mips_elf64_shift6_reloc): Check for ! BSF_LOCAL instead of zero
+ addend. Handle partial_inplace properly.
+ (mips16_gprel_reloc): Likewise. Do addend handling directly instead
+ of calling _bfd_mips_elf_gprel16_with_gp.
+ * elfn32-mips.c (mips_elf_got16_reloc): Check for BSF_LOCAL.
+ (mips_elf_gprel32_reloc): Check for ! BSF_LOCAL instead
+ of zero addend.
+ (mips_elf_shift6_reloc): Handle partial_inplace properly.
+ (mips16_gprel_reloc): Likewise. Do addend handling directly instead
+ of calling _bfd_mips_elf_gprel16_with_gp.
+ * elfxx-mips.c (_bfd_mips_elf_gprel16_with_gp): Handle
+ partial_inplace properly. Fix wrong addend handling. Fix overflow
+ check.
+ (_bfd_mips_elf_sign_extend): Renamed from mips_elf_sign_extend and
+ exported.
+ (mips_elf_calculate_relocation): Use _bfd_mips_elf_sign_extend.
+ (_bfd_mips_elf_relocate_section): Likewise.
+ (mips_elf_create_dynamic_relocation): Update sec_info_type access.
+ * elfxx-mips.h (_bfd_mips_relax_section): Fix prototype declaration.
+ (_bfd_mips_elf_sign_extend): New prototype.
+
+2003-06-11 Federico G. Schwindt <fgsch@lodoss.net>
+
+ * config.bfd (sparc-*-openbsd[0-2].* | sparc-*-openbsd3.[0-1]):
+ New target (was sparc-*-openbsd* before).
+ (sparc-*-openbsd*): Change to use bfd_elf32_sparc_vec.
+
+ * configure.in (vax-*-openbsd*): Set COREFILE to netbsd-core.lo.
+ * configure: Regenerate.
+
+2003-06-11 H.J. Lu <hongjiu.lu@intel.com>
+
+ * po/Make-in (DESTDIR): New.
+ (install-data-yes): Support $(DESTDIR).
+ (uninstall): Likewise.
+
+2003-06-11 Alan Modra <amodra@bigpond.net.au>
+
+ * Makefile.am (config.status): Depend on version.h.
+ Run "make dep-am".
+ * Makefile.in: Regenerate.
+ * po/SRC-POTFILES.in: Regenerate.
+
+2003-06-10 Alan Modra <amodra@bigpond.net.au>
+ Gary Hade <garyhade@us.ibm.com>
+
+ * elf64-ppc.c (ppc64_elf_relocate_section <*_DS>): Special case lq.
+
+2003-06-10 Richard Sandiford <rsandifo@redhat.com>
+
+ * archures.c (bfd_mach_h8300sxn): New architecture.
+ * bfd-in2.h: Regenerate.
+ * cpu-h8300.c (h8300_scan): Check for 'sxn'.
+ (h8300sxn_info_struct): New.
+ (h8300sx_info_struct): Link to it.
+ * elf32-h8300.c (elf32_h8_mach): Add h8300sxn case.
+ (elf32_h8_final_write_processing): Likewise.
+
+2003-06-08 Alan Modra <amodra@bigpond.net.au>
+
+ * elf64-ppc.c: Move TARGET_LITTLE_SYM and other macros used by
+ elfxx-target.h so that we can use elf_backend_got_header_size.
+ (ELF_MACHINE_ALT1, ELF_MACHINE_ALT2): Delete.
+ (GLINK_CALL_STUB_SIZE): Modify. Define new glink call stub and
+ associated macros.
+ (ppc64_elf_howto_raw <GOT_TPREL16_DS, GOT_TPREL16_LO_DS>): Correct
+ dst_mask.
+ (enum ppc_stub_type): Add ppc_stub_long_branch_r2off and
+ ppc_stub_plt_branch_r2off.
+ (struct ppc_stub_hash_entry): Reorganize.
+ (struct ppc_link_hash_table): Add no_multi_toc, multi_toc_needed,
+ toc_curr, toc_off and emit_stub_syms.
+ (ppc64_elf_link_hash_table_create): Init them.
+ (ppc_stub_name): Correct string size.
+ (ppc64_elf_check_relocs): Set has_gp_reloc on GOT and TOC relocs.
+ (ppc64_elf_size_dynamic_sections): Set no_multi_toc if GOT entries
+ used.
+ (ppc_type_of_stub): Tweak root.type test.
+ (build_plt_stub): Remove glink code. Adjust for insn macro changes.
+ (ppc_size_one_stub): Handle ppc_stub_long_branch_r2off and
+ ppc_stub_plt_branch_r2off.
+ (ppc_build_one_stub): Likewise. Fix var shadowing. Correct addis,addi
+ range test. Use toc_off to calculte r2 values. Handle emit_stub_syms.
+ (ppc64_elf_setup_section_lists): Remove htab creator flavour test.
+ Initialize elf_gp and toc_curr.
+ (ppc64_elf_next_toc_section, ppc64_elf_reinit_toc): New functions.
+ (ppc64_elf_next_input_section): Set toc_off.
+ (group_sections): Ensure groups have the same TOC.
+ (ppc64_elf_size_stubs): Check whether we need a TOC adjusting stub.
+ (ppc64_elf_build_stubs): Add emit_stub_syms param, and stash in htab.
+ Build new glink stub.
+ (ppc64_elf_relocate_section): Handle multiple TOCs. Fix comments.
+ (ppc64_elf_finish_dynamic_sections): Adjust DT_PPC64_GLINK.
+ * elf64-ppc.h (ppc64_elf_build_stubs): Update prototype.
+ (ppc64_elf_next_toc_section, ppc64_elf_reinit_toc): Declare.
+ * section.c (struct sec): Rename flag12 to has_gp_reloc.
+ (STD_SECTION): Update.
+ * ecoff.c (bfd_debug_section): Update comment.
+ * bfd-in2.h: Regenerate.
+
+2003-06-05 Daniel Jacobowitz <drow@mvista.com>
+
+ * elfcode.h (elf_slurp_reloc_table_from_section): Don't dereference
+ NULL function pointers.
+
+2003-06-05 Daniel Jacobowitz <drow@mvista.com>
+
+ * simple.c (bfd_simple_get_relocated_section_contents): Call
+ _bfd_generic_link_add_symbols instead of bfd_link_add_symbols.
+
+2003-06-04 Svein E. Seldal <Svein.Seldal@solidas.com>
+
+ * coff-tic54x.c: Removed the ticoff0_bad_format_hook() and
+ ticoff1_bad_format_hook() functions. Removed the coff0 and coff1
+ swaptables.
+ * coff-tic4x.c: Ditto
+ * coffcode.h: Added extra arguments to CREATE_BIG_COFF_TARGET_VEC
+ and CREATE_LITTLE_COFF_TARGET_VEC. Created the macro
+ CREATE_BIGHDR_COFF_TARGET_VEC. Created the ticoff0_bad_format_hook(),
+ ticoff1_bad_format_hook() functions. Created the coff0 and coff1
+ swap tables.
+ * coff-tic4x.c: Adopted new CREATE_xxx_COFF_TARGET_VEC macros.
+ * coff-a29k.c: Append COFF_SWAP_TABLE argument
+ * coff-apollo.c: Ditto
+ * coff-arm.c: Ditto
+ * coff-h8300.c: Ditto
+ * coff-h8500.c: Ditto
+ * coff-i960.c: Ditto
+ * coff-m68k.c: Ditto
+ * coff-m88k.c: Ditto
+ * coff-mcore.c: Ditto
+ * coff-sh.c: Ditto
+ * coff-sparc.c: Ditto
+ * coff-tic80.c: Ditto
+ * coff-we32k.c: Ditto
+ * coff-z8k.c: Ditto
+ * coff-w65.c: Ditto
+
+2003-06-04 Svein E. Seldal <Svein.Seldal@solidas.com>
+
+ * coff-tic4x.c (ticoff0_swap_table, ticoff1_swap_table): Fixed
+ initialization bug
+
+2003-06-03 Jakub Jelinek <jakub@redhat.com>
+
+ * elf.c (_bfd_elf_print_private_bfd_data): Handle PT_GNU_STACK.
+ (bfd_section_from_phdr): Likewise.
+ (map_sections_to_segments): Create PT_GNU_STACK segment header.
+ (get_program_header_size): Count with PT_GNU_STACK.
+ * elf-bfd.h (struct elf_obj_tdata): Add stack_flags.
+ * elflink.h (bfd_elfNN_size_dynamic_sections): Set stack_flags.
+
+2003-06-03 H.J. Lu <hongjiu.lu@intel.com>
+
+ * elflink.h (elf_link_input_bfd): Call linker error_handler
+ for discarded definitions.
+
+2003-06-03 Elias Athanasopoulos <elathan@phys.uoa.gr>
+
+ * syms.c (decode_section_type): Return 'n' if section flags are
+ SEC_HAS_CONTENTS && SEC_READONLY.
+
+2003-06-03 Nick Clifton <nickc@redhat.com>
+
+ * elf32-v850.c (v850_elf_howto_t): Rename R_V850_32to
+ R_V850_ABS32. Add entry for R_V850_REL32.
+ (v850_elf_reloc_map): Likewise.
+ (v850_elf_check_relocs): Likewise.
+ (v850_elf_perform_relocation): Likewise.
+ (v850_elf_final_link_relocate): Likewise. Include computation
+ to make R_V850_REl32 pc-relative.
+
+2003-06-03 Kaz Kojima <kkojima@rr.iij4u.or.jp>
+
+ * elf32-sh.c (sh_elf_size_dynamic_sections): Create .interp section
+ and DT_DEBUG dynamic tag even for position independent executables.
+ * elf64-sh64.c (sh64_elf64_size_dynamic_sections): Likewize.
+
+2003-06-02 Daniel Jacobowitz <drow@mvista.com>
+
+ * config.bfd: Move obsolete entries out of the range of the
+ targmatch sed script.
+
+2003-06-02 Daniel Jacobowitz <drow@mvista.com>
+
+ * config.bfd (mips*-dec-bsd*, mips*-*-pe*): Mark as obsolete.
+
+2003-05-31 Jakub Jelinek <jakub@redhat.com>
+
+ * elf32-ppc.c (allocate_dynrelocs): Use single slot for first 8192
+ plt entries, not just 8191.
+
+2003-05-30 Daniel Jacobowitz <drow@mvista.com>
+
+ * elfxx-mips.c (_bfd_mips_elf_discard_info): Correct loop index.
+ Reported by Ken Faiczak <kfaiczak@SANDVINE.com>.
+
+2003-05-30 Ulrich Drepper <drepper@redhat.com>
+ Jakub Jelinek <jakub@redhat.com>
+
+ * elflink.h (elf_link_add_object_symbols): Use !info->executable
+ instead of info->shared where appropriate.
+ (bfd_elfNN_size_dynamic_sections, elf_link_output_extsym): Likewise.
+ * elflink.c (_bfd_elf_create_got_section): Likewise.
+ (_bfd_elf_link_create_dynamic_sections): Likewise.
+ (_bfd_elf_link_assign_sym_version): Likewise.
+ * elf32-i386.c (elf_i386_size_dynamic_sections): Create .interp section
+ and DT_DEBUG dynamic tag even for position independent executables.
+ * elf32-ppc.c (ppc_elf_size_dynamic_sections): Likewise.
+ * elf32-s390.c (elf_s390_size_dynamic_sections: Likewise.
+ * elf64-ppc.c (ppc64_elf_size_dynamic_sections: Likewise.
+ * elf64-s390.c (elf_s390_size_dynamic_sections: Likewise.
+ * elf64-x86-64.c (elf64_x86_64_size_dynamic_sections: Likewise.
+ * elfxx-ia64.c (elfNN_ia64_size_dynamic_sections: Likewise.
+ * elf32-sparc.c (elf32_sparc_size_dynamic_sections: Likewise.
+ * elf64-alpha.c (elf64_alpha_size_dynamic_sections: Likewise.
+ * elf64-sparc.c (sparc64_elf_size_dynamic_sections: Likewise.
+
+2003-05-30 Kris Warkentin <kewarken@qnx.com>
+
+ * elf.c (elfcore_grok_nto_status): Only set lwpid for the active or
+ signalled thread.
+ (elfcore_grok_nto_gregs): Only make .reg section for the active thread.
+
+2003-05-29 Nick Clifton <nickc@redhat.com>
+
+ * pef.c: Include "safe-ctype.h" instead of <ctype.h>.
+ Tidy up formatting.
+ * Makefile.am: Add dependency on safe-ctype.h.
+ * Makefile.in: Regenerate.
+
+2003-05-29 Thiemo Seufer <seufer@csv.ica.uni-stuttgart.de>
+
+ * elfxx-mips.c: Don't force symbols local unconditionally.
+
+2003-05-28 Alan Modra <amodra@bigpond.net.au>
+
+ * elf32-hppa.c (elf32_hppa_relocate_section): Delete bogus
+ undefined_symbol call.
+
+2003-05-27 Richard Sandiford <rsandifo@redhat.com>
+
+ * elfxx-mips.c (mips_elf_hash_sort_data): Fix formattting.
+ (mips_elf_link_hash_table): Likewise.
+
+2003-05-22 Thiemo Seufer <seufer@csv.ica.uni-stuttgart.de>
+
+ * elf64-mips.c (elf_mips_gnu_rel16_s2): Add internally used
+ R_MIPS_GNU_REL16_S2 support.
+ (bfd_elf64_bfd_reloc_type_lookup): Use it.
+ (mips_elf64_rtype_to_howto): Use it.
+ * elfn32-mips.c (elf_mips_gnu_rel16_s2): Add internally used
+ R_MIPS_GNU_REL16_S2 support.
+ (bfd_elf32_bfd_reloc_type_lookup): Use it.
+ (mips_elf_n32_rtype_to_howto): Use it.
+
+2003-05-21 Stuart F. Downing <sdowning@fame.com>
+
+ * som.h: Define PA_2_0 before including a.out.h
+
+2003-05-07 Eric Christopher <echristo@redhat.com>
+ Alexandre Oliva <aoliva@redhat.com>
+
+ * elfxx-mips.c (_bfd_mips_elf_merge_private_bfd_data): Adjust
+ pic tests, change to warning.
+ (_bfd_mips_elf_final_link): Remove EF_MIPS_CPIC flag setting.
+
+2003-05-21 Marcus Comstedt <marcus@mc.pp.se>
+
+ * config.bfd: Check for a target triplet of shl-...-netbsdelf as
+ well as shle-...-netbsdelf. Remove duplicate entry.
+
+2003-05-21 Nick Clifton <nickc@redhat.com>
+
+ * elf32-xstormy16.c (xstormy16_elf_howto_table): Fix dst_mask
+ for X_STORMY16_REL_12 reloc.
+
+ * elf.c (bfd_elf_get_needed_list): Use is_elf_hash_table to check
+ the type of the hash table in the bfd_link_info structure.
+ (bfd_elf_get_runpath_list): Likewise.
+
+2003-05-19 Roland McGrath <roland@redhat.com>
+
+ * elf.c (bfd_elf_bfd_from_remote_memory): New function.
+ * bfd-in.h: Declare it.
+ * bfd-in2.h: Regenerated.
+ * elfcode.h (NAME(_bfd_elf,bfd_from_remote_memory)): New function.
+ * elf-bfd.h (struct elf_backend_data): New function pointer member
+ elf_backend_bfd_from_remote_memory.
+ (_bfd_elf32_bfd_from_remote_memory, _bfd_elf64_bfd_from_remote_memory):
+ Declare them.
+ * elfxx-target.h (elf_backend_bfd_from_remote_memory): New macro.
+ (elfNN_bed): Add that to the initializer.
+
+2003-05-15 Roland McGrath <roland@redhat.com>
+
+ * elf.c (elfcore_grok_note): Grok NT_AUXV note, make ".auxv" section.
+
+2003-05-20 Jakub Jelinek <jakub@redhat.com>
+
+ * elflink.h (elf_link_output_extsym): Only issue error about !=
+ STV_DEFAULT symbols if they are bfd_link_hash_undefined.
+
+2003-05-20 H.J. Lu <hongjiu.lu@intel.com>
+
+ * elflink.c (_bfd_elf_merge_symbol): Check ELF_LINK_DYNAMIC_DEF
+ when removing the old definition for symbols with non-default
+ visibility.
+
+2003-05-18 Jason Eckhardt <jle@rice.edu>
+
+ * elf32-i860.c (elf32_i860_relocate_highadj): Simplify calculation.
+
+2003-05-17 Andreas Schwab <schwab@suse.de>
+
+ * elf32-m68k.c (elf_m68k_check_relocs): Cache reloc section in
+ elf_section_data during processing of pc-relative and absolute
+ relocations.
+ (elf_m68k_relocate_section): Use the cached reloc section instead
+ of computing it again. Fix handling of visibility. Don't modify
+ addend when copying over a relocation into the output.
+
+2003-05-17 Alan Modra <amodra@bigpond.net.au>
+
+ * elf32-i386.c (elf_i386_adjust_dynamic_symbol): Use SYMBOL_CALLS_LOCAL
+ to trim plt entries. Move undefweak non-default visibility test..
+ (allocate_dynrelocs): ..from here.
+ * elf32-ppc.c (ppc_elf_adjust_dynamic_symbol): Don't test
+ dynamic_sections_created here. Update comment. Move undefweak
+ non-default visibility test..
+ (allocate_dynrelocs): ..from here. Fix comment.
+ * elf64-ppc.c (ppc64_elf_adjust_dynamic_symbol): Use SYMBOL_CALLS_LOCAL
+ to trim plt entries. Move undefweak non-default visibility test..
+ (allocate_dynrelocs): ..from here. Fix comment.
+ * elflink.h (elf_link_output_extsym): Compare ELF_ST_VISIBILITY with
+ STV_DEFAULT rather than comparing with zero.
+ * elflink.c (_bfd_elf_merge_symbol): Likewise.
+ (_bfd_elf_fix_symbol_flags): Likewise. Format comment.
+
+2003-05-17 Thiemo Seufer <seufer@csv.ica.uni-stuttgart.de>
+
+ * bfd.c (_bfd_get_gp_value): Prevent illegal access for abfd null
+ pointers.
+ (_bfd_set_gp_value): Likewise.
+
+2003-05-16 Michael Snyder <msnyder@redhat.com>
+ From Bernd Schmidt <bernds@redhat.com>
+ * archures.c (bfd_mach_h8300sx): New.
+ * bfd-in2.h: Regenerate.
+ * cpu-h8300.c (h8300_scan)): Add support for h8300sx.
+ (h8300sx_info_struct): New.
+ (h8300s_info_struct): Link to it.
+ * elf32-h8300.c (elf32_h8_mach): Add support for h8300sx.
+ (elf32_h8_final_write_processing): Likewise.
+ (elf32_h8_relax_section): Likewise.
+
+2003-05-16 Kelley Cook <kelleycook@wideopenwest.com>
+
+ * config.bfd: Accept i[3-7]86 variants.
+ * configure.host: Likewise.
+ * configure.in: Likewise.
+ * configure: Regenerate.
+
+2003-05-15 H.J. Lu <hongjiu.lu@intel.com>
+
+ * elflink.c (_bfd_elf_fix_symbol_flags): Also hide protected
+ symbol.
+
+2003-05-15 H.J. Lu <hongjiu.lu@intel.com>
+
+ * elflink.h (elf_link_check_versioned_symbol): Also allow
+ the base version.
+
+2003-05-15 Alan Modra <amodra@bigpond.net.au>
+ H.J. Lu <hongjiu.lu@intel.com>
+
+ * elf32-i386.c (allocate_dynrelocs): Use SYMBOL_CALLS_LOCAL.
+ (elf_i386_relocate_section): Likewise.
+ * elf32-ppc.c (allocate_dynrelocs): Likewise.
+ (ppc_elf_relocate_section): Likewise.
+ * elf64-ppc.c (allocate_dynrelocs): Likewise.
+ (ppc64_elf_relocate_section): Likewise.
+
+2003-05-15 Thiemo Seufer <seufer@csv.ica.uni-stuttgart.de>
+
+ * elf32-mips.c (gprel32_with_gp): Remove useless N64 ABI case.
+
+2003-05-13 Stephane Carrez <stcarrez@nerim.fr>
+
+ * elf32-m68hc1x.c (_bfd_m68hc11_elf_merge_private_bfd_data): Check for
+ processor capability, allow merge of HC12 and HCS12 in some cases.
+ (m68hc11_elf_hash_table_create): Use bfd_malloc instead of bfd_zalloc.
+ * cpu-m68hc12.c (bfd_m68hc12s_arch): New struct.
+ (bfd_m68hc12_arch): Link it.
+ (scan_mach): New function.
+
+2003-05-13 Andrew Haley <aph@redhat.com>
+
+ * elf.c (bfd_elf_hash): Mask lower 32 bits of hash.
+
+2003-05-13 Alan Modra <amodra@bigpond.net.au>
+ H.J. Lu <hongjiu.lu@intel.com>
+
+ * elf-bfd.h (SYMBOL_REFERENCES_LOCAL, SYMBOL_CALLS_LOCAL): Move from
+ elf32-ppc.c. Add ELF_LINK_FORCED_LOCAL check.
+ * elf32-ppc.c: (SYMBOL_REFERENCES_LOCAL, SYMBOL_CALLS_LOCAL): Delete.
+ (allocate_dynrelocs): Use SYMBOL_REFERENCES_LOCAL for dynreloc check.
+ (ppc_elf_relocate_section): Likewise.
+ * elf64-ppc.c (allocate_dynrelocs): Likewise.
+ (ppc64_elf_relocate_section): Likewise. Use for .got relocs too.
+ (ppc64_elf_adjust_dynamic_symbol): Don't assume symbols with .plt
+ relocs need no other types.
+ * elf32-i386.c (allocate_dynrelocs): Use SYMBOL_REFERENCES_LOCAL for
+ dynreloc check.
+ (elf_i386_relocate_section): Likewise. Use for .got relocs too.
+ (elf_i386_finish_dynamic_symbol): Use SYMBOL_REFERENCES_LOCAL for
+ .got relocs.
+
+2003-05-13 Kaz Kojima <kkojima@rr.iij4u.or.jp>
+
+ * elf32-sh.c (sh_elf_adjust_dynamic_symbol): For weak symbols,
+ copy ELF_LINK_NON_GOT_REF from weakdef.
+ (allocate_dynrelocs): For undef weak syms with non-default
+ visibility, a) don't allocate plt entries, b) don't allocate
+ .got relocs, c) discard dyn rel space
+ (sh_elf_relocate_section): d) don't generate .got relocs, e)
+ don't generate dynamic relocs.
+ (sh_elf_copy_indirect_symbol): Don't copy ELF_LINK_NON_GOT_REF
+ for weakdefs when symbol already adjusted.
+
+2003-05-12 Nick Clifton <nickc@redhat.com>
+
+ * elf32-xstormy16.c (xstormy16_elf_howto_table): use 'bitfield'
+ overflow detection for R_XSTORMY16_16 reloc.
+
+2003-05-12 Paul Clarke <paulc@senet.com.au>
+
+ * elf32-h8300.c: Fix typo in name of R_H8_DIR8 reloc.
+
+2003-05-11 Jason Eckhardt <jle@rice.edu>
+
+ * elf32-i860.c (elf32_i860_relocate_highadj): Properly
+ adjust upper bits.
+ (elf32_i860_relocate_splitn): Obtain upper 5 bits from the
+ proper place.
+ (elf32_i860_relocate_pc16): Obtain upper 5 bits from the
+ proper place.
+
+2003-05-11 Andreas Schwab <schwab@suse.de>
+
+ * elf32-m68k.c (elf_m68k_relocate_section): Replace ugly
+ complicated tests for unresolvable relocs with a simple direct
+ scheme using "unresolved_reloc" var. Report some detail on
+ bfd_reloc_outofrange and similar errors.
+
+2003-05-09 Martin Schwidefsky <schwidefsky@de.ibm.com>
+
+ * elf32-s390.c (allocate_dynrelocs, elf_s390_relocate_section):
+ Fix WILL_CALL_FINISH_DYNAMIC_SYMBOL call.
+ (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Pass SHARED instead of INFO.
+ * elf64-s390.c: Likewise.
+
+2003-05-09 Martin Schwidefsky <schwidefsky@de.ibm.com>
+
+ * elf32-s390.c (ELIMINATE_COPY_RELOCS): Define as one.
+ (elf_s390_adjust_dynamic_symbol): For weak symbols, copy
+ ELF_LINK_NON_GOT_REF from weakdef.
+ (elf_s390_copy_indirect_symbol): Test whether the weakdef sym has
+ already been adjusted before treating it specially.
+ * el64-s390.c: Likwise.
+
+2003-05-09 Martin Schwidefsky <schwidefsky@de.ibm.com>
+
+ * elf32-s390.c (allocate_dynrelocs): For undef weak syms with
+ non-default visibility, a) don't make them dynamic, b) discard
+ space for dynamic relocs.
+ (elf_s390_relocate_section): Initialize the GOT entries and skip
+ R_390_{8,16,32}/R_390_PC{16,16DBL,32DBL,32} for weak undefined
+ symbols with non-default visibility.
+ * elf64-s390.c: Likewise.
+
+2003-05-09 Alan Modra <amodra@bigpond.net.au>
+
+ * cpu-arm.c (arm_check_note): Warning fix.
+ * elf32-iq2000.c (iq2000_elf_check_relocs): Warning fixes. Arrange
+ to keep relocs if edited.
+ (iq2000_elf_print_private_bfd_data): Return TRUE.
+ * elfxx-ia64.c (elfNN_ia64_relax_section): Use ELFNN_R_SYM, not
+ ELF64_R_SYM.
+ (elfNN_ia64_relax_ldxmov): Warning fix.
+ * xtensa-isa.c (xtensa_add_isa): Warning fix.
+ * xtensa-modules.c (get_num_opcodes): Warning fix.
+
+2003-05-09 Andrey Petrov <petrov@netbsd.org>
+
+ * elf.c (elf_fake_sections): Use correct cast for sh_name.
+
+2003-05-09 Alan Modra <amodra@bigpond.net.au>
+
+ * elflink.c (_bfd_elf_link_create_dynamic_sections): Move from
+ elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align.
+ (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align.
+ (bfd_elf_record_link_assignment): Move from elflink.h.
+ (_bfd_elf_merge_symbol): Likewise.
+ (_bfd_elf_add_default_symbol): Likewise.
+ (_bfd_elf_export_symbol): Likewise.
+ (_bfd_elf_link_find_version_dependencies): Likewise.
+ (_bfd_elf_link_assign_sym_version): Likewise.
+ (_bfd_elf_link_read_relocs): Likewise.
+ (_bfd_elf_link_size_reloc_section): Likewise.
+ (_bfd_elf_fix_symbol_flags): Likewise.
+ (_bfd_elf_adjust_dynamic_symbol): Likewise.
+ (_bfd_elf_link_sec_merge_syms): Likewise.
+ (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel
+ and bed->s->sizeof_rela.
+ (_bfd_elf_link_output_relocs): Likewise.
+ * elf-bfd.h (struct elf_size_info): Rename file_align to
+ log_file_align.
+ (struct elf_info_failed): Move from elflink.h.
+ (struct elf_assign_sym_version_info): Likewise.
+ (struct elf_find_verdep_info): Likewise.
+ (_bfd_elf_create_dynamic_sections): Delete duplicate declaration.
+ (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol,
+ _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies,
+ _bfd_elf_link_assign_sym_version,
+ _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs,
+ _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs,
+ _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol,
+ _bfd_elf_link_sec_merge_syms): Declare.
+ (bfd_elf32_link_create_dynamic_sections): Don't declare.
+ (_bfd_elf32_link_read_relocs): Likewise.
+ (bfd_elf64_link_create_dynamic_sections): Likewise.
+ (_bfd_elf64_link_read_relocs): Likewise.
+ * elflink.h: Move lots o' stuff elsewhere.
+ * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare.
+ (bfd_elf64_record_link_assignment): Likewise.
+ (bfd_elf_record_link_assignment): Declare.
+ * bfd-in2.h: Regenerate.
+ * elfcode.h (elf_link_create_dynamic_sections): Don't declare.
+ (NAME(_bfd_elf,size_info)): Adjust for log_file_align.
+ * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align.
+ (assign_file_positions_for_segments): Likewise.
+ (assign_file_positions_except_relocs): Likewise.
+ (swap_out_syms, elfcore_write_note): Likewise.
+ * elf-m10200.c: Adjust for changed function names.
+ * elf-m10300.c: Likewise.
+ * elf32-arm.h: Likewise.
+ * elf32-h8300.c: Likewise.
+ * elf32-hppa.c: Likewise.
+ * elf32-ip2k.c: Likewise.
+ * elf32-m32r.c: Likewise.
+ * elf32-m68hc11.c: Likewise.
+ * elf32-m68hc1x.c: Likewise.
+ * elf32-m68k.c: Likewise.
+ * elf32-mips.c: Likewise.
+ * elf32-ppc.c: Likewise.
+ * elf32-sh.c: Likewise.
+ * elf32-v850.c: Likewise.
+ * elf32-xtensa.c: Likewise.
+ * elf64-alpha.c: Likewise.
+ * elf64-hppa.c: Likewise.
+ * elf64-mmix.c: Likewise.
+ * elf64-ppc.c: Likewise.
+ * elf64-sh64.c: Likewise.
+ * elfxx-ia64.c: Likewise.
+ * elfxx-mips.c: Likewise.
+ (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align.
+ * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align.
+ * elf64-hppa.c (hppa64_elf_size_info): Likewise.
+ * elf64-mips.c (mips_elf64_size_info): Likewise.
+ * elf64-s390.c (s390_elf64_size_info): Likewise.
+ * elf64-sparc.c (sparc64_elf_size_info): Likewise.
+
+2003-05-08 H.J. Lu <hongjiu.lu@intel.com>
+
+ * elflink.h (elf_add_default_symbol): After skipping the
+ unversioned symbol, go to non-default one.
+
+2003-05-07 H.J. Lu <hongjiu.lu@intel.com>
+
+ * elfxx-ia64.c (_bfd_elf_link_hash_hide_symbol): Also clear the
+ want_plt field.
+ (elfNN_ia64_relocate_section): Don't do dynamic symbol lookup
+ for symbols with non-default visibility.
+
+2003-05-07 H.J. Lu <hongjiu.lu@intel.com>
+
+ * elflink.h (elf_link_check_versioned_symbol): Also handle the
+ case that a DSO references a hidden symbol which may be
+ satisfied by a versioned symbol in another DSO.
+ (elf_link_output_extsym): Check versioned definition for hidden
+ symbol referenced by a DSO.
+
+2003-05-07 Nick Clifton <nickc@redhat.com>
+
+ * elf32-xstormy16.c (xstormy16_elf_howto_table): Reset
+ R_XSTORMY16_16 reloc to ignore overflows.
+
+2003-05-06 Alexandre Oliva <aoliva@redhat.com>
+
+ * elfxx-mips.c (_bfd_mips_elf_merge_private_bfd_data): Improve
+ error message for mixing different-endian files. Check for ABI
+ compatibility of input files with the selected emulation.
+
+2003-05-05 Alan Modra <amodra@bigpond.net.au>
+
+ * elf32-i386.c (allocate_dynrelocs): For undef weak syms with
+ non-default visibility, a) don't make them dynamic, b) discard
+ space for dynamic relocs.
+ * elf64-x86-64.c (allocate_dynrelocs): Likewise.
+
+ * elf32-ppc.c (allocate_dynrelocs): For undef weak syms with
+ non-default visibility, a) don't allocate plt entries, b) don't
+ allocate .got relocs, c) discard dyn rel space,
+ (ppc_elf_relocate_section): d) don't generate .got relocs, e)
+ don't generate dynamic relocs.
+ * elf64-ppc.c (allocate_dynrelocs): As above.
+ (ppc64_elf_relocate_section): As above.
+
+2003-05-05 Andreas Jaeger <aj@suse.de>
+
+ * elf64-x86-64.c (allocate_dynrelocs): Don't allocate dynamic
+ relocation entries for weak undefined symbols with non-default
+ visibility.
+ (elf64_x86_64_relocate_section): Initialize the GOT entries and
+ skip R_386_32/R_386_PC32 for weak undefined symbols with
+ non-default visibility.
+
+2003-05-04 H.J. Lu <hjl@gnu.org>
+
+ * elf32-i386.c (allocate_dynrelocs): Don't allocate dynamic
+ relocation entries for weak undefined symbols with non-default
+ visibility.
+ (elf_i386_relocate_section): Initialize the GOT entries and
+ skip R_386_32/R_386_PC32 for weak undefined symbols with
+ non-default visibility.
+
+ * elfxx-ia64.c (allocate_fptr): Don't allocate function
+ descriptors for weak undefined symbols with non-default
+ visibility.
+ (allocate_dynrel_entries): Don't allocate relocation entries
+ for symbols resolved to 0.
+ (set_got_entry): Don't install dynamic relocation for weak
+ undefined symbols with non-default visibility.
+ (set_pltoff_entry): Likewise.
+
+ * elflink.h (elf_fix_symbol_flags): Hide weak undefined symbols
+ with non-default visibility.
+ (elf_link_output_extsym): Don't make weak undefined symbols
+ with non-default visibility dynamic.
+
+2003-05-04 H.J. Lu <hjl@gnu.org>
+
+ * elflink.h (elf_merge_symbol): Correctly handle weak definition.
+
+2003-05-04 H.J. Lu <hjl@gnu.org>
+
+ * elflink.h (elf_merge_symbol): Don't record a hidden/internal
+ symbol dynamic. Check indirection when removing the old
+ definition for symbols with non-default visibility.
+ (elf_add_default_symbol): Skip when told by elf_merge_symbol.
+
+2003-05-02 Nick Clifton <nickc@redhat.com>
+
+ * elf32-xstormy16.c (xstormy16_elf_howto_table): Make the
+ R_XSTORMY16_8 and R_XSTORMY16_16 relocs detect and complain about
+ unsigned overflow.
+
+2003-05-02 Andreas Jaeger <aj@suse.de>
+
+ * elf64-x86-64.c (elf_x86_64_copy_indirect_symbol): Don't copy
+ ELF_LINK_NON_GOT_REF for weakdefs when symbol already adjusted.
+ (ELIMINATE_COPY_RELOCS): Define as one. Use throughout.
+ (elf_x86_64_adjust_dynamic_symbol): For weak symbols, copy
+ ELF_LINK_NON_GOT_REF from weakdef.
+
+2003-05-02 Charles Lepple <clepple@ghz.cc>
+ Nick Clifton <nickc@redhat.com>
+
+ * acinclude.m4: Fix name of --enable-install-libbfd switch.
+ * aclocal.m4: Regenerate.
+ * configure: Regenerate.
+ * Makefile.in: Regenerate.
+
+2003-05-01 Alan Modra <amodra@bigpond.net.au>
+
+ * elf32-ppc.c (ppc_elf_copy_indirect_symbol): Test whether the
+ weakdef sym has already been adjusted before treating it specially.
+ * elf32-i386.c (elf_i386_copy_indirect_symbol): Don't copy
+ ELF_LINK_NON_GOT_REF for weakdefs when symbol already adjusted.
+ * elf64-ppc.c (ppc64_elf_copy_indirect_symbol): Likewise.
+ (ppc64_elf_check_relocs): Set ELF_LINK_NON_GOT_REF.
+
+2003-04-28 H.J. Lu <hjl@gnu.org>
+
+ * elfxx-ia64.c (elfNN_ia64_relax_section): Relax ldxmov during
+ the relax finalize pass.
+
+ * section.c (struct sec): Add need_finalize_relax and remove
+ flag11.
+ (STD_SECTION): Update struct sec initializer.
+ * bfd-in2.h: Regenerated.
+
+2003-04-28 H.J. Lu <hjl@gnu.org>
+
+ * elflink.h (elf_merge_symbol): Call elf_backend_copy_indirect_symbol
+ to copy any information related to dynamic linking when we flip
+ the indirection.
+
+2003-04-27 H.J. Lu <hjl@gnu.org>
+
+ * elf-bfd.h (ELF_LINK_DYNAMIC_DEF): New.
+ (ELF_LINK_DYNAMIC_WEAK): New.
+
+ * elflink.h (elf_merge_symbol): Add one argument to indicate if
+ a symbol should be skipped. Ignore definitions in dynamic
+ objects for symbols with non-default visibility.
+ (elf_add_default_symbol): Adjusted.
+ (elf_link_add_object_symbols): Check if a symbol should be
+ skipped. Don't merge the visibility field with the one from
+ a dynamic object.
+ (elf_link_check_versioned_symbol): Use undef_bfd.
+ (elf_link_output_extsym): Warn if a forced local symbol is
+ referenced from dynamic objects. Make non-weak undefined symbol
+ with non-default visibility a fatal error.
+
+2003-04-27 Daniel Jacobowitz <drow@mvista.com>
+
+ * configure.in: Bump version on HEAD to 2.14.90.
+ * configure: Regenerated.
+
+2003-04-26 Stephane Carrez <stcarrez@nerim.fr>
+
+ PR savannah/3331:
+ * elf32-m68hc11.c (m68hc11_elf_relax_section): Clear prev_insn_group
+ when we couldn't relax something.
+
+2003-04-25 Alan Modra <amodra@bigpond.net.au>
+
+ * elflink.h (elf_merge_symbol): When we find a regular definition
+ for an indirect symbol, flip the indirection so that the old
+ direct symbol now points to the new definition.
+
+2003-04-24 Roland McGrath <roland@redhat.com>
+
+ * elf.c (bfd_section_from_phdr): Map PT_GNU_EH_FRAME to "eh_frame_hdr".
+
+2003-04-24 Alan Modra <amodra@bigpond.net.au>
+
+ * elf32-ppc.c: Formatting and comment fixes.
+ (ELIMINATE_COPY_RELOCS): Move before ppc_elf_copy_indirect_symbol.
+ (ppc_elf_copy_indirect_symbol): Copy flags here for weakdefs.
+
+2003-04-24 Dhananjay Deshpande <dhananjayd@kpitcummins.com>
+
+ * archures.c (bfd_mach_h8300hn, bfd_mach_h8300sn): Added.
+ * bfd-in2.h: Rebuilt.
+ * coff-h8300.c (BADMAG): Add check for H8300HNBADMAG & H8300SNBADMAG.
+ * coffcode.h (coff_set_arch_mach_hook): Add case for H8300HNMAGIC
+ & H8300SNMAGIC.
+ (coff_set_flags): Add case for bfd_mach_h8300hn & bfd_mach_h8300sn.
+ * cpu-h8300.c (h8300_scan): Handle h8300hn, h8300sn.
+ (h8300sn_info_struct, h8300hn_info_struct): New.
+ * elf32-h8300.c (elf32_h8_mach): Handle case for h8300hn & h8300sn
+ (elf32_h8_final_write_processing): Likewise.
+
+2003-04-23 Kaz Kojima <kkojima@rr.iij4u.or.jp>
+
+ * elf32-sh.c (tpoff): New.
+ (struct elf_sh_dyn_relocs): Remove tls_tpoff32.
+ (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Pass SHARED instead of INFO.
+ (allocate_dynrelocs): Don't make unnecessary dynamic TLS
+ relocations. Adjust WILL_CALL_FINISH_DYNAMIC_SYMBOL uses.
+ (sh_elf_relocate_section): Likewise. Remove unnecessary tests.
+ (dtpoff_base): Fix wrong indentation.
+ (sh_elf_check_relocs): Don't set DF_STATIC_TLS flag with non-TLS
+ relocations. Don't set tls_tpoff32 flag. Don't make unnecessary
+ R_SH_TLS_TPOFF32 relocations.
+
+2003-04-23 J"orn Rennecke <joern.rennecke@superh.com>
+
+ * archures.c (enum bfd_architecture): Amend comment to refer to SuperH.
+ * cpu-sh.c: Likewise.
+ * elf32-sh.c: Likewise.
+ * reloc.c (bfd_reloc_code_real): Likewise.
+ * elf32-sh64-com.c: Change comment to refer to SuperH.
+ * elf32-sh64.c: Likewise.
+ * elf64-sh64.c: Likewise.
+ * bfd-in2.h (enum bfd_architecture): Regenerate.
+
+2003-04-23 Alan Modra <amodra@bigpond.net.au>
+
+ From Julien LEMOINE <speedblue@debian.org>
+ * elf32-i386.c (elf_i386_info_to_howto): Delete.
+ (elf_info_to_howto): Define as elf_i386_info_to_howto_rel.
+
+2003-04-22 Kazuhiro Inaoka <inaoka.kazuhiro@renesas.com>
+
+ * archures.c: Replace references to Mitsubishi M32R with references
+ to Renesas M32R.
+ * relocs.c: Likewise.
+ * bfd-in2.h: Regenerate.
+
+2003-04-21 Richard Henderson <rth@redhat.com>
+
+ * elf64-alpha.c (alpha_elf_dynamic_symbol_p): Return false for an
+ executable when a symbol is defined both regular and dynamic.
+
+2003-04-21 Stephane Carrez <stcarrez@nerim.fr>
+
+ * Makefile.am (BFD32_BACKENDS): Add elf32-m68hc1x.lo.
+ (elf32-m68hc1x.lo): Update dependencies
+ * configure.in: Add elf32-m68hc1x.lo.
+ * configure: Rebuild.
+ * Makefile.in: Rebuild.
+
+2003-04-21 Stephane Carrez <stcarrez@nerim.fr>
+
+ * elf32-m68hc1x.c: New file (from elf32-m68hc11.c and elf32-m68hc12.c)
+ (m68hc11_elf_hash_table_create): New function.
+ (elf32_m68hc11_link_hash_table_free): New function.
+ (stub_hash_newfunc): New function.
+ (m68hc11_add_stub): New function.
+ (elf32_m68hc11_add_symbol_hook): New function.
+ (elf32_m68hc11_setup_section_lists): New function.
+ (elf32_m68hc11_next_input_section): New function.
+ (elf32_m68hc11_size_stubs): New function.
+ (elf32_m68hc11_build_stubs): New function.
+ (m68hc11_get_relocation_value): New function.
+ (elf32_m68hc11_relocate_section): Call the above to redirect
+ some relocations to the trampoline code.
+ (m68hc11_elf_export_one_stub): New function.
+ (m68hc11_elf_set_symbol): New function.
+ (elf32_m68hc11_build_stubs): Call it via bfd_hash_traverse.
+ (m68hc11_elf_get_bank_parameters): Get parameters only when the info
+ is not yet initialized.
+
+ * elf32-m68hc1x.h: New file (from elf32-m68hc11.c and elf32-m68hc12.c)
+ (elf32_m68hc11_stub_hash_entry): New struct.
+ (m68hc11_page_info): Add trampoline handler address.
+ (m68hc11_elf_link_hash_table): Add stubs generation members.
+ (elf32_m68hc11_add_symbol_hook): Declare.
+ (elf32_m68hc11_setup_section_lists): Declare.
+ (elf32_m68hc11_size_stubs): Declare.
+ (elf32_m68hc11_build_stubs): Declare.
+
+ * elf32-m68hc11.c (m68hc11_elf_ignore_reloc): Move to elf32-m68hc1x.c.
+ (elf32_m68hc11_gc_mark_hook, elf32_m68hc11_gc_sweep_hook): Likewise.
+ (elf32_m68hc11_check_relocs, elf32_m68hc11_relocate_section): Ditto.
+ (_bfd_m68hc11_elf_set_private_flags): Ditto.
+ (_bfd_m68hc11_elf_merge_private_bfd_data): Ditto.
+ (_bfd_m68hc11_elf_print_private_bfd_data): Ditto.
+ (bfd_elf32_bfd_link_hash_table_create): Define.
+ (elf_backend_add_symbol_hook): Define.
+ (m68hc11_elf_bfd_link_hash_table_create): New function.
+ (m68hc11_elf_build_one_stub): New function.
+ (m68hc11_elf_size_one_stub): New function.
+ (m68hc11_elf_bfd_link_hash_table_create): Install the above.
+ (bfd_elf32_bfd_link_hash_table_create): Define.
+
+ * elf32-m68hc12.c (m68hc11_elf_ignore_reloc): Remove.
+ (m68hc12_addr_is_banked): Remove, use m68hc11_addr_is_banked.
+ (m68hc12_phys_addr): Ditto.
+ (m68hc12_phys_page): Ditto.
+ (m68hc12_elf_special_reloc): Move to elf32-m68hc1x.c.
+ (elf32_m68hc11_gc_mark_hook): Likewise.
+ (elf32_m68hc11_gc_sweep_hook): Likewise.
+ (elf32_m68hc11_check_relocs): Likewise.
+ (elf32_m68hc11_relocate_section): Likewise.
+ (_bfd_m68hc12_elf_set_private_flags): Likewise.
+ (_bfd_m68hc12_elf_merge_private_bfd_data): Likewise.
+ (_bfd_m68hc12_elf_print_private_bfd_data): Likewise.
+ (m68hc12_elf_build_one_stub): New function.
+ (m68hc12_elf_size_one_stub): New function.
+ (m68hc12_elf_bfd_link_hash_table_create): New function, use the above.
+ (elf_backend_add_symbol_hook): Define.
+ (elf_m68hc11_howto_table): Use TRUE for pcrel relocs; fix masks.
+
+2003-04-18 Nick Clifton <nickc@redhat.com>
+
+ * format.c (bfd_check_format_matches): Only check associated
+ vector if the matching_vector has been created.
+
+2003-04-15 Alexandre Oliva <aoliva@redhat.com>
+
+ * dwarf2.c (_bfd_dwarf2_find_nearest_line): Fix typo in
+ 2003-04-09's change.
+
+2003-04-15 Brian Ford <ford@vss.fsi.com>
+
+ * peicode.h (coff_swap_scnhdr_in): If a section holds
+ uninitialized data and is from an object file or from an
+ executable image that has not initialized the s_size field, or if
+ the physical size is padded, use the virtual size (stored in
+ s_paddr) instead.
+
+2003-04-15 H.J. Lu <hjl@gnu.org>
+
+ * elflink.h (elf_link_add_object_symbols): Properly report
+ filename for alignment reduction.
+
+2003-04-15 Rohit Kumar Srivastava <rohits@kpitcummins.com>
+
+ * archures.c: Replace occurrances of 'Hitachi' with 'Renesas'.
+ * reloc.c: Likewise.
+ * coff-h8300.c: Likewise.
+ * coff-h8500.c: Likewise.
+ * coff-sh.c: Likewise.
+ * cpu-h8300.c: Likewise.
+ * cpu-sh.c: Likewise.
+ * elf32-h8300.c: Likewise.
+ * elf32-sh.c: Likewise.
+ * elf32-sh64-com.c: Likewise.
+ * elf32-sh64.c: Likewise.
+ * elf64-sh64.c: Likewise.
+ * bfd-in2.h: Regenerate.
+
+2003-04-14 H.J. Lu <hjl@gnu.org>
+
+ * elflink.h (elf_link_add_object_symbols): Maintain maximum
+ alignment for common symbols. Warn reducing alignment for
+ common symbols. Report old filename when symbol size changes.
+
+2003-04-12 Alexandre Oliva <aoliva@redhat.com>
+
+ * elfxx-mips.c (mips_elf_calculate_relocation): Adjust two other
+ occurrences of the same test changed in the previous patch.
+ Optimize.
+
+2003-04-11 Alexandre Oliva <aoliva@redhat.com>
+
+ * elfxx-mips.c (mips_elf_get_global_gotsym_index): New.
+ (mips_elf_calculate_relocation): Decay GOT_PAGE/GOT_OFST to
+ GOT_DISP/addend only if the symbol got a global GOT entry.
+
+2003-04-10 Alexandre Oliva <aoliva@redhat.com>
+
+ * elfxx-mips.c (mips_elf_calculate_relocation): Decay
+ GOT_PAGE/GOT_OFST referencing overridable symbol to
+ GOT_DISP/addend.
+ (_bfd_mips_elf_check_relocs): Handle GOT_PAGE referencing
+ global symbol as GOT_DISP.
+
+2003-04-10 Bob Wilson <bob.wilson@acm.org>
+
+ * elf32-xtensa.c (elf_xtensa_relocate_section): Don't continue to the
+ next relocation on an undefined symbol.
+
+2003-04-09 Richard Henderson <rth@redhat.com>
+
+ * elf64-alpha.c (elf64_alpha_relocate_section) <R_ALPHA_GPREL32>:
+ Ignore relocations against r_symndx == 0.
+
+2003-04-09 H.J. Lu <hjl@gnu.org>
+
+ * elf64-alpha.c (elf64_alpha_relocate_section): Don't return
+ FALSE for undefined symbols.
+ * elfxx-ia64.c (elfNN_ia64_relocate_section): Likewise.
+
+2003-04-09 Alexandre Oliva <aoliva@redhat.com>
+
+ * dwarf2.c (_bfd_dwarf2_find_nearest_line): Try DWARF3-standard
+ and IRIX-specific shift-to-64-bit 4-byte lengths before following
+ addr_size.
+
+2003-04-08 Alexandre Oliva <aoliva@redhat.com>
+
+ * elf32-mips.c (bfd_elf32_bfd_reloc_type_lookup): Detect (ctor)
+ pointer size from ABI, not arch_bits_per_address.
+
+2003-04-07 Kevin Buettner <kevinb@redhat.com>
+
+ * elfn32-mips.c (elf32_mips_grok_prstatus): Adjust core file related
+ constants for n32 ABI.
+
+2003-04-06 Andrew Cagney <cagney@redhat.com>
+
+ * simple.c (bfd_simple_get_relocated_section_contents): Disable
+ free that leads to GDB vs BFD memory corruption.
+
+2003-04-04 Stephane Carrez <stcarrez@nerim.fr>
+
+ * elf32-m68hc11.c (m68hc11_elf_relax_delete_bytes): Also adjust
+ symbols that mark the end of the section.
+ (m68hc11_elf_relax_section): Use R_M68HC11_PCREL_8 relocs when
+ converting to a relative branch so that the offset is computed after
+ the relaxation; also relocate a jsr into a bsr if possible but don't
+ relax them if they are to a far symbol as we need to call the
+ trampoline code.
+ (elf_m68hc11_howto_table): Set pcrel_offset to true.
+
+2003-04-04 Svein E. Seldal <Svein.Seldal@solidas.com>
+
+ * archures.c: Namespace cleanup. Rename bfd_mach_c3x to
+ bfd_mach_tic3x and bfd_mach_c4x to bfd_mach_tic4x
+ * bfd-in2.h: Regenerate
+ * coff-tic4x.c: Namespace cleanup. Replace s/c4x/tic4x/
+ * cpu-tic4x.c: Ditto
+
+2003-04-03 Nick Clifton <nickc@redhat.com>
+
+ * peXXigen.c (_bfd_XXi_swap_scnhdr_out): Compute ps and ss
+ differently for object files and executables.
+ * peicode.h (coff_swap_scnhdr_in): Only set the s_size field
+ for object files or for executables who have not already
+ initialised the field.
+ * libpei.h (bfd_pe_executable_p): New macro. Return true if
+ the PE format bfd is an executable.
+
+2003-04-03 Alan Modra <amodra@bigpond.net.au>
+
+ * elf32-ppc.c (ppc_elf_check_relocs): Don't use SYMBOL_REFERENCES_LOCAL
+ here as it's too early to reliably determine locality.
+ (ppc_elf_gc_sweep_hook): Likewise.
+ (SYMBOL_REFERENCES_LOCAL): Expand comment.
+
+2003-04-02 Bob Wilson <bob.wilson@acm.org>
+
+ * xtensa-modules.c: Remove comment indicating that this is a
+ generated file.
+
+2003-04-02 Alan Modra <amodra@bigpond.net.au>
+
+ * elfxx-mips.c (_bfd_mips_elf_hide_symbol): Test for NULL dynobj.
+
+2003-04-01 Bob Wilson <bob.wilson@acm.org>
+
+ * Makefile.am (ALL_MACHINES): Add cpu-xtensa.lo.
+ (ALL_MACHINES_CFILES): Add cpu-xtensa.c.
+ (BFD32_BACKENDS): Add elf32-xtensa.lo, xtensa-isa.lo, and
+ xtensa-modules.lo.
+ (BFD32_BACKENDS_CFILES): Add elf32-xtensa.c, xtensa-isa.c, and
+ xtensa-modules.c.
+ (cpu-xtensa.lo): New target.
+ (elf32-xtensa.lo): Likewise.
+ (xtensa-isa.lo): Likewise.
+ (xtensa-modules.lo): Likewise.
+ * Makefile.in: Regenerate.
+ * archures.c (bfd_architecture): Add bfd_{arch,mach}_xtensa.
+ (bfd_archures_list): Add bfd_xtensa_arch.
+ * config.bfd: Handle xtensa-*-*.
+ * configure.in: Handle bfd_elf32_xtensa_{le,be}_vec.
+ * configure: Regenerate.
+ * reloc.c: Add BFD_RELOC_XTENSA_{RTLD,GLOB_DAT,JMP_SLOT,RELATIVE,
+ PLT,OP0,OP1,OP2,ASM_EXPAND,ASM_SIMPLIFY}.
+ * targets.c (bfd_elf32_xtensa_be_vec): Declare.
+ (bfd_elf32_xtensa_le_vec): Likewise.
+ (bfd_target_vector): Add bfd_elf32_xtensa_{be,le}_vec.
+ * cpu-xtensa.c: New file.
+ * elf32-xtensa.c: Likewise.
+ * xtensa-isa.c: Likewise.
+ * xtensa-modules.c: Likewise.
+ * libbfd.h: Regenerate.
+ * bfd-in2.h: Likewise.
+
+2003-04-01 Nick Clifton <nickc@redhat.com>
+
+ * archures.c (bfd_mach_arm_unknown): Define.
+ * bfd-in.h (bfd_arm_merge_machines, bfd_arm+update_notes,
+ bfd_arm_get_mach_from_notes): Prototype.
+ * bfd-in2.h: Regenerate.
+ * coff-arm.c (coff_arm_merge_private_bfd_data): Call
+ bfd_arm_merge_machines.
+ (coff_arm_final_link_postscript): Call bfd_arm_update_notes.
+ * coffcode.h (coff_set_arch_mach_hook): Call
+ bfd_arm_get_mach_from_notes.
+ * coffgen.c (coff_real_object_p): Revert previous delta.
+ * cpu_arm.c (arm_check_note): New function. Examine a note in a
+ .note section.
+ (bfd_arm_merge_machines): New function: Handle the merging of ARM
+ binaries compiled for different architectures..
+ (bfd_arm_update_notes): New function: Update an ARM note section.
+ (bfd_arm_get_mach_from_notes): New function: Extract a bfd machine
+ number from an ARM note section.
+ * elf32-arm.h (elf32_arm_object_p): Use
+ bfd_arm_get_mach_from_notes.
+ (elf32_arm_merge_private_bfd_data): Use bfd_arm_merge_machines.
+ (elf32_arm_final_write_processing): Use bfd_arm_update_notes.
+
+2003-04-01 Ben Elliston <bje@wasabisystems.com>
+
+ * dwarf2.c (read_attribute_value): Correct typo in comment.
+
+2003-04-01 Nick Clifton <nickc@redhat.com>
+
+ * dwarf2.c (concat_filename): Use bfd_malloc() and strdup()
+ instead of concat().
+ (decode_line_info): Only free filename if it is not NULL.
+ (add_line_info): Make a copy of the filename when storing it into
+ the info structure.
+
+2003-03-31 Andreas Schwab <schwab@suse.de>
+ Daniel Jacobowitz <drow@mvista.com>
+
+ * simple.c (bfd_simple_get_relocated_section_contents): Add
+ parameter symbol_table. Optionally use it instead of the symbol
+ table from the bfd. Save and restore output offsets and output
+ sections around bfd_get_relocated_section_contents. Fix a memory
+ leak.
+ (simple_save_output_info, simple_restore_output_info): New
+ functions.
+ * bfd-in2.h: Regenerate.
+ * dwarf2.c (read_abbrevs): Use
+ bfd_simple_get_relocated_section_contents instead of
+ bfd_get_section_contents.
+ (decode_line_info): Likewise.
+ (_bfd_dwarf2_find_nearest_line): Likewise. Don't call
+ find_rela_addend.
+ (find_rela_addend): Remove.
+ * elfxx-ia64.c (elfNN_ia64_reloc): Weaken sanity check for
+ debugging sections.
+ (elfNN_ia64_hash_table_create): Create the hash table with malloc,
+ not bfd_zalloc.
+
+2003-03-31 David Heine <dlheine@suif.stanford.edu>
+
+ * aoutx.h (aout_link_hash_table_create): Use bfd_malloc instead of
+ bfd_alloc.
+ * dwarf2.c (concat_filename): Always allocate space for the
+ returned filename.
+ (decode_line_info): Free the allocated filename returned by
+ concat_filename.
+ * elf-eh-frame.c (bfd_elf_write_section_eh_frame): Fix memory leaks.
+ * elf.c (copy_private_bfd_data): Likewise.
+ (_bfd_elf_slurp_version_tables): Fix bug freeing contents pointer.
+ * elflink.h (elf_link_sort_relocs): Fix memory leak.
+ * format.c (bfd_check_format_matches): Likewise.
+ * linker.c (bfd_generic_final_link): Likewise.
+ * opncls.c (find_separate_debug_info): Likewise.
+ * simple.c (bfd_simple_get_relocated_section_contents): Likewise.
+
+2003-03-28 H.J. Lu <hjl@gnu.org>
+
+ * elflink.h (elf_link_add_object_symbols): Correctly combine
+ visibilities.
+
+2003-03-27 Jakub Jelinek <jakub@redhat.com>
+
+ * elfxx-ia64.c (elfNN_ia64_relax_section): Reset self_dtpmod_offset
+ to -1 before recomputing got offsets.
+
+2003-03-26 Andreas Schwab <schwab@suse.de>
+
+ * elf32-m68k.c (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define.
+ (elf_m68k_relocate_section): Use it to correctly handle symbols
+ forced to be local.
+ (elf_m68k_finish_dynamic_symbol): Emit RELATIVE reloc for got
+ entries for symbols that are forced to be local.
+
+2003-03-25 Alexandre Oliva <aoliva@redhat.com>
+
+ * elfxx-mips.c (_bfd_mips_relax_section): New function.
+ * elfxx-mips.h (_bfd_mips_relax_section): Declare.
+ * elfn32-mips.c, elf64-mips.c: Use it.
+
+2003-03-25 Stan Cox <scox@redhat.com>
+ Nick Clifton <nickc@redhat.com>
+
+ Contribute support for Intel's iWMMXt chip - an ARM variant:
+
+ * archures.c: Add bfd_mach_arm_iWMMXt.
+ * reloc.c: Add BFD_RELOC_ARM_CP_OFF_IMM_S2.
+ * bfd-in2.h: Regenerate.
+ * libbfd.h: Regenerate.
+ * coff-arm.c (coff_arm_merge_private_bfd_data): Allow iWMMXt
+ object files to be linked with XScale ones.
+ (coff_arm_final_link_postscript): Update note section.
+ * coffcode.h (coff_set_arch_mach_hook): Handle note section.
+ * coffgen.c (coff_real_object_p): Call bfd_coff_set_arch_mach_hook
+ after identifying a coff binary.
+ * cpu-arm.c (processors): Add iWMMXt.
+ (arch_inf): Likewise.
+ * elf32-arm.h (arm_object_p): Handle note section.
+ (elf32_arm_merge_private_bfd_data): Allow iWMMXt object files to
+ be linked with XScale ones.
+ (elf32_arm_section_flags): New function: Set flags on note section.
+ (elf32_arm_final_write_processing): Handle note section.
+
+2003-03-21 DJ Delorie <dj@redhat.com>
+
+ * elf32-xstormy16.c (elf32_xstormy16_relocate_section): Call
+ _bfd_elf_rela_local_sym.
+
+2003-03-20 H.J. Lu <hjl@gnu.org>
+
+ * elfxx-ia64.c (elfNN_ia64_relax_section): Don't try relax for
+ non-ELF outputs.
+
+2003-03-20 Nick Clifton <nickc@redhat.com>
+
+ * peXXigen.c (_bfd_XXi_swap_aouthdr_out): Initialise $idata2 and
+ $idata5 in case bfd_coff_final_link is not called.
+
+2003-03-19 Jakub Jelinek <jakub@redhat.com>
+
+ * elf64-sparc.c (struct sparc64_elf_section_data): Add reloc_count
+ field.
+ (canon_reloc_count): Define.
+ (sparc64_elf_slurp_one_reloc_table, sparc64_elf_slurp_reloc_table,
+ sparc64_elf_canonicalize_dynamic_reloc): Use it instead of
+ reloc_count.
+ (sparc64_elf_canonicalize_reloc): New routine.
+ (bfd_elf64_canonicalize_reloc): Define.
+
+2003-03-18 Jakub Jelinek <jakub@redhat.com>
+
+ * elfxx-ia64.c (elfNN_ia64_relax_section): Handle relaxation
+ againt mergeable sections. Take r_addend into account when caching
+ trampolines.
+
+2003-03-18 Richard Henderson <rth@redhat.com>
+
+ * elfxx-ia64.c (get_dyn_sym_info): Return NULL gracefully for
+ local symbols that have no dyninfo.
+
+2003-03-14 Gene Smith <gene.smith@siemens.com>
+
+ * ieee.c (ieee_write_expression): Handle the case where symbol is
+ NULL.
+ General formatting improvements.
+
+2003-03-13 Nick Clifton <nickc@redhat.com>
+
+ * configure.in (LINGUAS): Add zh_CN.
+ * configure: Regenerate.
+ * po/zh_CN.po: New file.
+
+2003-03-13 Elias Athanasopoulos <elathan@phys.uoa.gr>
+
+ * aout-cris.c (BYTES_IN_WORD): Don't define.
+ aout-encap.c: Likewise.
+ aout-ns32k.c: Likewise.
+ aout-tic30.c: Likewise.
+ hp300bsd.c: Likewise.
+ i386aout.c: Likewise.
+ i386dynix.c: Likewise.
+ i386linux.c: Likewise.
+ i386lynx.c: Likewise.
+ i386mach3.c: Likewise.
+ m68k4knetbsd.c: Likewise.
+ m68klinux.c: Likewise.
+ m68klynx.c: Likewise.
+ m68knetbsd.c: Likewise.
+ m88kmach3.c: Likewise.
+ mipsbsd.c: Likewise.
+ newsos3.c: Likewise.
+ sparclinux.c: Likewise.
+ sparclynx.c: Likewise.
+ sparcnetbsd.c: Likewise.
+ vaxbsd.c: Likewise. Fix comment formatting.
+
+2003-03-12 Alexandre Oliva <aoliva@redhat.com>
+
+ * Reverted 2003-03-02's patch.
+
+ * elfxx-target.h (bfd_elfNN_canonicalize_reloc): Make it
+ overridable.
+ * elf64-mips.c (mips_elf64_canonicalize_reloc,
+ mips_elf64_get_dynamic_reloc_upper_bound,
+ mips_elf64_canonicalize_dynamic_reloc): New, adapted from elf.c.
+ (bfd_elf64_get_canonicalize_reloc,
+ bfd_elf64_get_dynamic_reloc_upper_bound,
+ bfd_elf64_canonicalize_dynamic_reloc): Define.
+ (mips_elf64_slurp_reloc_table): Support dynamic.
+ (mips_elf64_slurp_one_reloc_table): Adjust.
+
+2003-03-12 Nick Clifton <nickc@redhat.com>
+
+ * xsym.c (bfd_sym_fetch_type_information_table_entry): Change
+ 'index' to 'offset' in test for zero value.
+
+2003-03-11 Alexandre Oliva <aoliva@redhat.com>
+
+ * elfxx-mips.c (mips_elf_create_dynamic_relocation): Do not create
+ dynamic relocations pointing to local or section symbols, use the
+ NULL symbol instead. Document the choice to not emit an
+ additional R_MIPS_64 relocation.
+
+2003-03-11 Alan Modra <amodra@bigpond.net.au>
+
+ * elf32-ppc.c (ppc_elf_relocate_section): Subtract tls seg vma from
+ zero index dynamic tls relocs generated for the GOT. Tidy code.
+ Set "relocation" to 1 on DTPMOD32 relocs. Optimize HA adjustment.
+ * elf64-ppc.c (ppc64_elf_relocate_section): Likewise.
+
+2003-03-07 Alan Modra <amodra@bigpond.net.au>
+
+ * elf32-ppc.c (ppc_elf_relocate_section): Don't look for a nop after
+ a tls_get_addr call.
+
+ * elf32-ppc.c (ELIMINATE_COPY_RELOCS): Define as one.
+ (ppc_elf_adjust_dynamic_symbol): For weak symbols, copy
+ ELF_LINK_NON_GOT_REF from weakdef.
+ * elf64-ppc.c (ELIMINATE_COPY_RELOCS): Define as one.
+ (ppc64_elf_adjust_dynamic_symbol): For weak symbols, copy
+ ELF_LINK_NON_GOT_REF from weakdef.
+ * elf32-i386.c (ELIMINATE_COPY_RELOCS): Define as one. Use throughout.
+ (elf_i386_adjust_dynamic_symbol): For weak symbols, copy
+ ELF_LINK_NON_GOT_REF from weakdef.
+
+2003-03-06 Jakub Jelinek <jakub@redhat.com>
+ Andrew Haley <aph@redhat.com>
+
+ * elflink.h (elf_bfd_discard_info): Don't process eh frames if
+ output is relocateable.
+
+2003-03-06 Steven Konopa <skonopa@kgo.csc.com>
+
+ * som.c (som_fixup_formats): Correct formats for R_AUX_UNWIND and
+ R_COMMENT.
+
+2003-03-06 Alan Modra <amodra@bigpond.net.au>
+
+ * elf32-ppc.c (ppc_elf_create_linker_section): Don't capitalize
+ error messages.
+ (ELIMINATE_COPY_RELOCS): Define to zero.
+ (ppc_elf_relocate_section): Don't deref htab->tls_sec when calculating
+ TLSLD relocs. Report reloc types on a number of errors. Optimize
+ LOCAL24PC check for non-local syms. Don't capitalize error messages.
+ * elf64-ppc.c (ELIMINATE_COPY_RELOCS): Define to zero.
+ (ppc64_elf_relocate_section): Don't deref htab->tls_sec when
+ calculating TLSLD relocs. Report reloc types on a number of errors.
+ Don't capitalize error messages.
+
+2003-03-03 H.J. Lu <hjl@gnu.org>
+
+ * elfxx-ia64.c (USE_BRL): Removed.
+ (oor_ip): Removed.
+
+2003-03-03 J"orn Rennecke <joern.rennecke@superh.com>
+
+ * elf32-sh.c (sh_elf_howto_tab): Make R_SH_IND12W into an ordinary
+ relocation (no special function), and make it non-partial_inplace.
+ (sh_elf_relax_section): When creating a bsr, use a consistent value
+ no matter if the symbol is extern or not; set addend to -4.
+ Don't swap load / non-load instructions for SH4.
+ (sh_elf_relax_delete_bytes): In R_SH_IND12W case, check the offset
+ rather than if the symbol is external to determine if adjusting the
+ offset makes sense. Adjust the addend too if appropriate.
+ (sh_elf_relocate_section): In R_SH_IND12W, don't fiddle with the
+ relocation.
+
+2003-03-03 Nick Clifton <nickc@redhat.com>
+
+ * po/da.po: Installed latest translation.
+
+2003-03-02 Thiemo Seufer <seufer@csv.ica.uni-stuttgart.de>
+
+ * elf32-mips.c (elf_mips_howto_table_rel): Change definition of
+ R_MIPS_PC16 to rightshift 2.
+ (elf_reloc_map mips_reloc_map): Map to rightshifted BFD reloc.
+ (bfd_elf32_bfd_reloc_type_lookup): Support
+ BFD_RELOC_MIPSEMB_16_PCREL_S2.
+ * elf64-mips.c (mips_elf64_howto_table_rel): Change definition of
+ R_MIPS_PC16 to rightshift 2.
+ (mips_elf64_howto_table_rela): Likewise.
+ (mips_reloc_map): Map to rightshifted BFD reloc.
+ * elfn32-mips.c: The same as in elf64-mips.c.
+ * elfxx-mips.c (mips_elf_got_for_ibfd): Typo in comment.
+ (mips_elf_calculate_relocation): Handle rightshifted addends for
+ R_MIPS_PC16.
+ * reloc.c (BFD_RELOC_MIPSEMB_16_PCREL_S2): New BFD relocation for
+ MIPS Embedded PIC. Remove superfluous empty COMMENT.
+ * libbfd.h: Regenerate.
+ * bfd-in2.h: Regenerate.
+
+2003-02-28 Richard Henderson <rth@redhat.com>
+
+ * elfxx-ia64.c (elfNN_ia64_relax_section): Correct bounds
+ for ltoff22x relaxation.
+
+2003-03-01 Alan Modra <amodra@bigpond.net.au>
+
+ * bfd-in.h (_bfd): Don't define.
+ * bfd.c: Rename occurrences of "struct _bfd" to "struct bfd".
+ * syms.c: Likewise.
+ * bfd-in2.h: Regenerate.
+
+2003-02-27 Richard Henderson <rth@redhat.com>
+
+ * elfxx-ia64.c (struct elfNN_ia64_dyn_sym_info): Add want_gotx;
+ (elfNN_ia64_check_relocs): Set it.
+ (allocate_global_data_got): Check it.
+ (allocate_local_got): Likewise.
+ (allocate_dynrel_entries): Likewise.
+ (elfNN_ia64_relax_ldxmov): New.
+ (elfNN_ia64_relax_section): Handle LTOFF22X, LDXMOV.
+ (elfNN_ia64_choose_gp): Split out from ...
+ (elfNN_ia64_final_link): ... here.
+
+2003-02-27 Andrew Cagney <cagney@redhat.com>
+
+ * bfd.c (struct bfd): Rename "struct _bfd".
+ * bfd-in.h: Update copyright.
+ (struct bfd): Rename "struct _bfd".
+ (_bfd): Define for backward compatibility.
+ * bfd-in2.h: Regenerate.
+
+2003-02-25 Alan Modra <amodra@bigpond.net.au>
+
+ * elflink.h (elf_bfd_final_link): Apportion reloc counts to rel_hdr
+ and rel_hdr2 when initially counting input relocs rather than after
+ creating output reloc sections.
+ (elf_link_read_relocs_from_section): Don't abort with wrong reloc
+ sizes.
+
+ * Makefile.am: Run "make dep-am".
+ * Makefile.in: Regenerate.
+
+2003-02-24 Kris Warkentin <kewarken@qnx.com>
+
+ * elf.c (elfcore_read_notes): Add check for QNX style core file.
+ (elfcore_grog_nto_note): New function.
+ (elfcore_grog_nto_gregs): New function.
+ (elfcore_grog_nto_status): New function.
+
+2003-02-24 Alan Modra <amodra@bigpond.net.au>
+
+ * elflink.c (_bfd_elf_create_got_section): Check existing .got
+ section flags before concluding that we've already been called.
+ Don't use register keyword.
+ (_bfd_elf_create_dynamic_sections): Don't use register keyword.
+ (_bfd_elf_create_linker_section): Formatting.
+
+2003-02-20 jmc <jmc@prioris.mini.pw.edu.pl>
+
+ * coff-h8300.c: Fix typo: intial -> initial.
+ * coff-ppc.c: Likewise.
+
+2003-02-20 Alan Modra <amodra@bigpond.net.au>
+
+ * elf32-ppc.c: Formatting.
+ (allocate_dynrelocs): LD and GD relocs against the same sym need
+ separate GOT entries.
+ (ppc_elf_relocate_section): Correct GOT handling for multiple GOT
+ entries per symbol.
+
+2003-02-19 Alan Modra <amodra@bigpond.net.au>
+
+ * elf32-hppa.c (elf32_hppa_gc_sweep_hook): Simplify dynamic reloc
+ removal. Localize vars. Remove unnecessary dynobj test.
+ * elf32-i386 (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Pass SHARED instead
+ of INFO.
+ (allocate_dynrelocs): Adjust WILL_CALL_FINISH_DYNAMIC_SYMBOL uses,
+ and optimize.
+ (elf_i386_relocate_section): Likewise.
+ (elf_i386_gc_sweep_hook): Simplify dyn reloc removal. Localize vars.
+ * elf32-s390.c (elf_s390_gc_sweep_hook): Likewise.
+ * elf32-sh.c (sh_elf_gc_sweep_hook): Likewise.
+ * elf64-s390.c (elf_s390_gc_sweep_hook): Likewise.
+ * elf64-x86-64.c (elf64_x86_64_gc_sweep_hook): Likewise.
+ * elf32-sparc.c (elf32_sparc_gc_sweep_hook): Likewise. Remove
+ local_dynrel for section too. Don't touch HIPLT22, LOPLT10, PCPLT32
+ or PCPLT10 relocs. Don't subtract twice on PLT32 relocs.
+ Formatting.
+
+ * elf64-ppc.c (ELIMINATE_COPY_RELOCS): Define.
+ (ppc64_elf_check_relocs): Use it. Correct comment. Move SEC_ALLOC
+ test.
+ (ppc64_elf_adjust_dynamic_symbol): Use ELIMINATE_COPY_RELOCS.
+ (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Pass SHARED instead of INFO.
+ (allocate_dynrelocs): Adjust WILL_CALL_FINISH_DYNAMIC_SYMBOL uses,
+ and optimize. Use ELIMINATE_COPY_RELOCS.
+ (ppc64_elf_relocate_section): Likewise.
+
+ * elf32-ppc.c (struct ppc_elf_dyn_relocs): Add pc_count field.
+ (ppc_elf_copy_indirect_symbol): Copy pc_count field.
+ (ELIMINATE_COPY_RELOCS): Define.
+ (ppc_elf_adjust_dynamic_symbol): Convert copy relocs to dynamic.
+ (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Pass SHARED instead of INFO.
+ (MUST_BE_DYN_RELOC): Define.
+ (allocate_dynrelocs): Adjust WILL_CALL_FINISH_DYNAMIC_SYMBOL uses,
+ and optimize. Trim dyn_relocs.
+ (ppc_elf_check_relocs): Don't generate dyn_relocs when we know they'll
+ not be used. Do generate dyn_relocs for copy reloc avoidance. Keep
+ track of pc_rel dyn relocs.
+ (ppc_elf_relocate_section): Remove "will_become_local". Adjust
+ WILL_CALL_FINISH_DYNAMIC_SYMBOL use. Trim dyn relocs as per
+ allocate_dynrelocs. Don't recalculate "sec".
+
+2003-02-18 Alan Modra <amodra@bigpond.net.au>
+
+ * elf32-ppc.c (ppc_elf_relocate_section): Remove unnecessary test.
+ * elf64-ppc.c (ppc64_elf_tls_optimize): Decrement tlsld_got.refcount
+ on invalid LD relocs.
+ (allocate_dynrelocs): Invalid LD relocs don't use tlsld_got entry.
+ (ppc64_elf_relocate_section): Unify new handling of LD relocs and
+ tlsld_got entry. Use IS_PPC64_TLS_RELOC.
+
+ * elf32-ppc.h: New file.
+ * elf32-ppc.c: Include elf32-ppc.h.
+ (NOP, CROR_151515, CROR_313131, TP_OFFSET, DTP_OFFSET): Define.
+ (struct ppc_elf_link_hash_entry): Rename "root" to "elf". Adjust uses.
+ Add "tls_mask" field.
+ (TLS_GD, TLS_LD, TLS_TPREL, TLS_DTPREL, TLS_TLS, TLS_TPRELGD): Define.
+ (struct ppc_elf_link_hash_table): Rename "root" to "elf". Adjust uses.
+ Add got, relgot, plt, relplt, dynbss, relbss, dynsbss, relsbss,
+ sdata, sdata2, tls_sec, tls_get_addr, tlsld_got fields.
+ Make use of htab shortcuts throughout file.
+ (ppc_elf_link_hash_newfunc): Init tls_mask field.
+ (ppc_elf_link_hash_table_create): Init new fields.
+ (ppc_elf_copy_indirect_symbol): Copy tls_mask.
+ (ppc_elf_howto_raw): Add tls relocs.
+ (ppc_elf_reloc_type_lookup): Handle them.
+ (ppc_elf_unhandled_reloc): New function.
+ (ppc_elf_create_got): Stash got section pointer in hash table,
+ return status. Make .rela.got too.
+ (ppc_elf_create_dynamic_sections): Stash section pointers in htab.
+ (ppc_elf_adjust_dynamic_symbol): Only set up copy relocs when
+ NON_GOT_REF set. Don't allocate space in .plt here..
+ (allocate_dynrelocs): ..do so here instead, properly ref-counting and
+ not allocating plt entries unnecessarily. Allocate got entries here.
+ (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define.
+ (ppc_elf_size_dynamic_sections): Allocate local got entries. Pass
+ "info" during allocate_dynrelocs hash traversal. Use htab section
+ shortcuts rather than searching for named sections. Get rid of
+ "plt" and "strip" booleans.
+ (update_local_sym_info, bad_shared_reloc): New functions.
+ (ppc_elf_check_relocs): Handle TLS relocs. Move .rela.got creation to
+ ppc_elf_create_got. Don't mark got or plt reloc syms dynamic, do so
+ in allocate_dynreloc. Use update_local_sym_info and bad_shared_reloc.
+ Disallow R_PPC_EMB_RELSDA, R_PPC_EMB_NADDR32, R_PPC_EMB_NADDR16,
+ R_PPC_EMB_NADDR16_LO, R_PPC_EMB_NADDR16_HI and R_PPC_EMB_NADDR16_HA
+ in shared libs. R_PPC_PLTREL32 is a plt reloc too. Refcount all
+ relocs that might use a plt entry. Set NON_GOT_REF too.
+ Enumerate all do-nothing relocs.
+ (ppc_elf_gc_sweep_hook): Simplify removal of dynrelocs. Handle
+ tls relocs and all plt relocs.
+ (ppc_elf_tls_setup, ppc_elf_tls_optimize): New functions.
+ (ppc_elf_finish_dynamic_symbol): Don't build got entries here.
+ (ppc_elf_finish_dynamic_sections): Rewrite tag code using htab
+ shortcuts.
+ (ppc_elf_relocate_section): Tidy. Handle TLS relocs. Use
+ bfd_elf_local_sym_name. Simplify unresolved reloc code. Build got
+ entries and got relocs here. Warn on non-zero got reloc addend.
+ Split out branch taken/not taken reloc code into a separate switch
+ and correct offset calculation. Allow BRTAKEN/BRNTAKEN dynamic relocs.
+ Split out HA reloc adjustments to separate switch statement. Don't
+ warn on reloc overflow if we've already warned about undefined.
+ Don't rebuild sym name when reporting errors. Report all possible
+ errors from _bfd_final_link_relocate.
+ (bfd_elf32_bfd_final_link): Don't define.
+
+2003-02-18 Alan Modra <amodra@bigpond.net.au>
+
+ * elf64-ppc.c (ppc64_elf_relocate_section): Don't init "r". Don't
+ rebuild sym name when reporting errors.
+
+2003-02-17 Nick Clifton <nickc@redhat.com>
+
+ * elflink.h (elf_link_output_extsym): Only check
+ allow_shlib_undefined for shared libraries.
+ * elf32-i386.c (elf_i386_relocate_section): Remove bogus check
+ of allow_shlib_undefined.
+ * elf32-cris.c (cris_elf_relocate_section): Likewise.
+ * elf32-hppa.c (elf32_hppa_relocate_section): Likewise.
+ * elf32-m68k.c (elf_m68k_relocate_section): Likewise.
+ * elf32-ppc.c (ppc_elf_relocate_section): Likewise.
+ * elf32-s390.c (elf_s390_relocate_section): Likewise.
+ * elf32-sh.c (sh_elf_relocate_section): Likewise.
+ * elf32-sparc.c (elf32_sparc_relocate_section): Likewise.
+ * elf32-vax.c (elf_vax_relocate_section): Likewise.
+ * elf64-alpha.c (elf64_alpha_relocate_section): Likewise.
+ * elf64-hppa.c (elf64_hppa_relocate_section): Likewise.
+ * elf64-ppc.c (ppc64_elf_relocate_section): Likewise.
+ * elf64-s390.c (elf_s390_relocate_section): Likewise.
+ * elf64-sparc.c (sparc64_elf_relocate_section): Likewise.
+ * elf64-x86-64.c (elf64_x86_64_relocate_section): Likewise.
+ * elfxx-ia64.c (elfNN_ia64_relocate_section): Likewise.
+ * elfxx-mips.c (_bfd_mips_elf_relocate_section): Likewise.
+
+2003-02-17 Nick Clifton <nickc@redhat.com>
+
+ * elf.c (SEGMENT_AFTER_SEGMENT): Add third parameter - the
+ address field to use in the comparison.
+ (SEGMENT_OVERLAPS): Check that LMAs overlap as well.
+
+2003-02-14 Bob Wilson <bob.wilson@acm.org>
+
+ * elfcore.h (elf_core_file_p): Compare alternate machine codes for ELF
+ backends when checking if the generic ELF target should be used.
+
+ * syms.c (_bfd_stab_section_find_nearest_line): For line number stabs
+ outside of functions, treat values as absolute addresses.
+
+ * bfd.c: Change embedded documentation to use consistent indentation
+ and to split up long lines. Change informal style of description
+ for functions lacking real documentation.
+ * coffcode.h: Break up long lines in embedded documentation.
+ * format.c: Likewise.
+ * targets.c: Likewise.
+ * libcoff.h: Regenerate.
+ * bfd-in2.h: Regenerate.
+
+2003-02-14 Alan Modra <amodra@bigpond.net.au>
+
+ * elf64-ppc.c (ppc64_elf_link_hash_table_create): Init tls_get_addr.
+ (ppc64_elf_copy_indirect_symbol): Merge tls_mask too.
+ (ppc64_elf_gc_sweep_hook): Simplify removal of dyn_relocs.
+ (allocate_dynrelocs): Don't treat undefined and undefweak specially.
+ (ppc_size_one_stub): Fix warning, and tighten plt entry check.
+ (group_sections): Don't share a stub section if stubs are for a large
+ section. Adjust comment.
+ (ppc64_elf_size_stubs): Roughly double the size left for stubs if
+ !stubs_always_before_branch.
+ (ppc64_elf_relocate_section): Initialize tlsld GOT entry once. Don't
+ treat undefined and undefweak specially when processing dyn relocs.
+
+2003-02-13 Jakub Jelinek <jakub@redhat.com>
+
+ * elflink.h (elf_link_add_object_symbols): Handle .symver x, x@FOO.
+
+2003-02-13 Nick Clifton <nickc@redhat.com>
+
+ * elf32-arm.h (elf32_thumb_to_arm_stub): Include section VMAs
+ in computation of offset to insert into BL instruction.
+
+2003-02-11 Uwe Stieber <uwe@wwws.de>
+
+ * config.bfd: Add support for kaOS as cross build target system.
+
+2003-02-11 Alan Modra <amodra@bigpond.net.au>
+
+ * elf64-ppc.c (ppc64_elf_check_relocs): Match versioned
+ .__tls_get_addr too.
+ (ppc64_elf_tls_setup): Ensure cached tls_get_addr is not indirect.
+
+2003-02-10 Kaz kojima <kkojima@rr.iij4u.or.jp>
+
+ * elf32-sh.c (elf_sh_dyn_relocs): Add tls_tpoff32 field.
+ (elf_sh_link_hash_entry): Remove tls_tpoff32 field.
+ (sh_elf_link_hash_newfunc): Remove the initialization of
+ tls_tpoff32 field.
+ (allocate_dynrelocs): Keep dyn_relocs if it includes the entry
+ for which tls_tpoff32 flag is set.
+ (sh_elf_relocate_section): Covert to LE only if the dyn_relocs
+ of the symbol includes the entry matched with the input_section
+ and having tls_tpoff32 flag on. When linking statically, set
+ symbol index of R_SH_TLS_TPOFF32 relocation to zero if the symbol
+ is defined in this executable.
+ (sh_elf_check_relocs): Set tls_tpoff32 flag appropriately.
+
+2003-02-10 Jakub Jelinek <jakub@redhat.com>
+
+ * elf32-s390.c (elf_s390_size_dynamic_sections): Set relocs to TRUE
+ even if there is just non-empty .rela.plt.
+
+2003-02-10 Nick Clifton <nickc@redhat.com>
+
+ * archures.c (bfd_mach_arm_ep9312): Define.
+ * bfd-in2.h: Regenerate.
+ * cpu-arm.c (processors[]): Add ep9312.
+ (bfd_arm_arch): Add ep9312.
+ * elf32-arm.h (elf32_arm_merge_private_data): Update error
+ messages and add test for Maverick floating point support.
+ (elf32_arm_print_private_bfd_data): Handle
+ EF_ARM_MAVERICK_FLOAT flag.
+ (elf32_arm_object_p): New function.
+ (elf_backend_object_p): Define.
+
+2003-02-10 Alan Modra <amodra@bigpond.net.au>
+
+ * elf64-ppc.c: Rename assorted occurrences of tls_type and similar
+ variables, structure fields or function params to tls_mask or
+ similar to better reflect usage.
+ (struct got_entry): Comment.
+ (struct ppc_link_hash_entry): Expand comment, and renumber TLS_*.
+ (get_tls_mask): Rename from get_tls_type.
+
+2003-02-09 Alan Modra <amodra@bigpond.net.au>
+
+ * elf64-ppc.c (TLS_GD_LD): Don't define..
+ (TLS_GD): ..define this instead and update all uses.
+ (TLS_TPRELGD): Define.
+ (ppc64_elf_link_hash_table_create): Tweak initialization of
+ init_refcount and init_offset.
+ (ppc64_elf_check_relocs): Add one extra element to t_symndx array.
+ Mark second slot of GD or LD toc entries.
+ (get_tls_type): Return an int. Distinguish toc GD and LD entries
+ from other tls types.
+ (ppc64_elf_tls_setup): New function, split out from..
+ (ppc64_elf_tls_optimize): ..here. Don't optimize when symbols are
+ defined in a dynamic object. Fix LD optimization. Don't set TLS_TPREL
+ on GD->IE optimization, use TLS_TPRELGD instead. Use get_tls_type
+ return value to properly decide whether toc GD and LD entries can
+ optimize away __tls_get_addr call. Check next reloc after DTPMOD64
+ to determine GD or LD rather than looking at TLS_LD flag. Don't
+ attempt to adjust got entry tls_type here..
+ (allocate_dynrelocs): ..instead, adjust got entry tls_type here, and
+ look for possible merges.
+ (ppc64_elf_size_dynamic_sections): Adjust local got entries for
+ optimization.
+ (ppc64_elf_size_stubs): Tweak __tls_get_addr fudge.
+ (ppc64_elf_relocate_section): Rename some vars to better reflect usage.
+ Make use of return value from get_tls_type to properly detect GD and
+ LD optimizations. Split tlsld/gd hi/ha from lo/ds case. Don't
+ handle tls_get_addr removal when looking at REL24 relocs, do it when
+ looking at the previous reloc. Check reloc after DTPMOD64 to determine
+ GD or LD.
+ * elf64-ppc.h (ppc64_elf_tls_setup): Declare.
+
+2003-02-08 Alan Modra <amodra@bigpond.net.au>
+
+ * elf32-hppa.c (group_sections): Don't share a stub section if
+ stubs are for a large section.
+
+ * elf32-hppa.c (elf32_hppa_size_stubs): Double the size left for
+ stubs if !stubs_always_before_branch.
+
+2003-02-07 Nick Clifton <nickc@redhat.com>
+
+ * elf.c (swap_out_syms): Generate an error message if an
+ equivalent output section cannot be found for a symbol.
+
+2003-02-07 Jakub Jelinek <jakub@redhat.com>
+
+ * elf64-alpha.c (elf64_alpha_relax_section): Don't crash if
+ local_got_entries is NULL.
+
+2003-02-06 Andreas Schwab <schwab@suse.de>
+
+ * elf-eh-frame.c (get_DW_EH_PE_signed): Define.
+ (read_value): Add parameter is_signed, use signed extraction if
+ the value is signed.
+ (_bfd_elf_write_section_eh_frame): Pass signed flag of the
+ encoding to read_value.
+
+2003-02-06 Alan Modra <amodra@bigpond.net.au>
+
+ * elf64-ppc.c (ppc64_elf_copy_indirect_symbol): Don't copy got and
+ plt info when called to transfer weak sym info.
+
+2003-02-05 Alan Modra <amodra@bigpond.net.au>
+
+ * reloc.c: Add PPC and PPC64 TLS relocs.
+ * libbfd.h: Regenerate.
+ * bfd-in2.h: Regenerate.
+ * elf64-ppc.c (TP_OFFSET, DTP_OFFSET): Declare.
+ (ppc64_elf_howto_raw): Add TLS howto's. Adjust R_PPC64_NONE to be
+ against a 32 bit field.
+ (ppc64_elf_reloc_type_lookup): Handle TLS relocs.
+ (_ppc64_elf_section_data): Add t_symndx and comments.
+ (ppc64_elf_section_data): Use elf_section_data macro.
+ (ppc64_elf_new_section_hook): American spelling.
+ (struct got_entry, struct plt_entry): New.
+ (MUST_BE_DYN_RELOC): Rename from IS_ABSOLUTE_RELOC.
+ (struct ppc_stub_hash_entry): Add "addend" field.
+ (struct ppc_link_hash_entry): Add "tls_type".
+ (TLS_TLS, TLS_GD_LD, TLS_LD, TLS_TPREL, TLS_DTPREL,
+ TLS_EXPLICIT): Define.
+ (struct ppc_link_hash_table): Add tls_sec, tls_get_addr, tlsld_got.
+ (link_hash_newfunc): Init new fields.
+ (ppc64_elf_link_hash_table_create): Likewise. Set init_refcount and
+ init_offset to NULL.
+ (ppc64_elf_copy_indirect_symbol): Copy got and plt info. Don't call
+ _bfd_elf_link_hash_copy_indirect, rather insert relevant code from
+ there.
+ (update_local_sym_info, update_plt_info): New functions.
+ (ppc64_elf_check_relocs): Use them. Handle TLS relocs. Adjust GOT
+ handling to use got.glist rather than got.refcount. Likewise for PLT.
+ (ppc64_elf_gc_sweep_hook): Handle TLS relocs, new GOT and PLT lists.
+ (func_desc_adjust): Adjust for new PLT list.
+ (ppc64_elf_adjust_dynamic_symbol): Likewise.
+ (get_sym_h, get_tls_type): New functions.
+ (ppc64_elf_edit_opd): Remove unused variable. Use get_sym_h.
+ (ppc64_elf_tls_optimize): New function.
+ (allocate_dynrelocs): Adjust for new PLT and GOT lists. Allocate
+ TLS relocs.
+ (ppc64_elf_size_dynamic_sections): Likewise.
+ (ppc_type_of_stub): Adjust for new PLT list.
+ (ppc_build_one_stub): Likewise.
+ (ppc64_elf_size_stubs): Likewise. Use get_sym_h. Treat __tls_get_addr
+ calls specially.
+ (ppc64_elf_relocate_section): Adjust for new GOT and PLT lists. Handle
+ TLS relocs. Report local syms using bfd_elf_local_sym_name. Don't
+ init GOT entries that have a reloc. Generate GOT relocs here..
+ (ppc64_elf_finish_dynamic_symbol): ..not here. Adjust for PLT list.
+ * elf64-ppc.h (ppc64_elf_tls_optimize): Declare.
+
+2003-02-04 Andreas Schwab <schwab@suse.de>
+
+ * elf32-m68k.c (elf_m68k_hash_entry): Define.
+ (elf_m68k_link_hash_traverse): Remove.
+ (elf_m68k_link_hash_newfunc): Use struct bfd_hash_entry and
+ elf_m68k_hash_entry instead of struct elf_m68k_link_hash_entry to
+ reduce casting.
+ (elf_m68k_check_relocs): Use elf_m68k_hash_entry instead of
+ casting.
+ (elf_m68k_size_dynamic_sections): Use elf_link_hash_traverse
+ instead of elf_m68k_link_hash_traverse.
+ (elf_m68k_discard_copies): Change first parameter to pointer to
+ struct elf_link_hash_entry and use elf_m68k_hash_entry when struct
+ elf_m68k_link_hash_entry is needed.
+
+2003-02-04 Alan Modra <amodra@bigpond.net.au>
+
+ * elf-bfd.h (struct got_entry, struct plt_entry): Forward declare.
+ (struct elf_link_hash_entry): Add "glist" and "plist" fields to
+ "got" union, and declare as gotplt_union. Use gotplt_uinion for
+ "plt" field.
+ (struct elf_link_hash_table): Make "init_refcount" a gotplt_union.
+ Add "init_offset" field.
+ (struct elf_obj_tdata <local_got>): Add "struct got_entry **" to union.
+ (elf_local_got_ents): Declare.
+ * elf.c (_bfd_elf_link_hash_newfunc): Adjust initialization of "got"
+ and "plt".
+ (_bfd_elf_link_hash_hide_symbol): Use "init_offset".
+ (_bfd_elf_link_hash_table_init): Set "init_offset".
+ * elflink.h (NAME(bfd_elf,size_dynamic_sections)): Set init_refcount
+ from init_offset.
+ (elf_adjust_dynamic_symbol): Set plt and got offsets using init_offset.
+
+ * elf.c (bfd_elf_local_sym_name): Split out from..
+ (group_signature): ..here.
+ * elf-bfd.h (bfd_elf_local_sym_name): Declare.
+
+2003-02-04 Alan Modra <amodra@bigpond.net.au>
+
+ * elf-bfd.h (enum elf_link_info_type): Remove.
+ (struct bfd_elf_section_data): Move sec_info_type, use_rela_p fields
+ to struct sec. Remove linkonce_p field.
+ (elf_linkonce_p): Delete.
+ (elf_discarded_section): Update for sec_info_type change.
+ * section.c (struct sec): Add sec_info_type, use_rela_p, has_tls_reloc,
+ flag11, flag12, flag13, flag14, flag15, flag16, flag20, flag24.
+ (ELF_INFO_TYPE_NONE): Define.
+ (ELF_INFO_TYPE_STABS): Define.
+ (ELF_INFO_TYPE_MERGE): Define.
+ (ELF_INFO_TYPE_EH_FRAME): Define.
+ (ELF_INFO_TYPE_JUST_SYMS): Define.
+ (STD_SECTION): Update struct sec initializer.
+ * ecoff.c (bfd_debug_section): Likewise.
+ * elf.c: Likewise. Update occurrences of sec_info_type and use_rela_p.
+ * elflink.h: Likewise.
+ * elf-eh-frame.c: Likewise.
+ * elf64-alpha.c: Likewise.
+ * elfxx-ia64.c: Likewise.
+ * elfxx-mips.c: Likewise.
+ * bfd-in2.h: Regenerate.
+
+ * elf32-sparc.c (sec_do_relax): Use elf_section_data macro rather than
+ referring to used_by_bfd.
+ * elf64-sparc.c (sec_do_relax): Likewise.
+ * elf64-mmix.c (mmix_elf_section_data): Likewise.
+ * elfxx-mips.c (mips_elf_section_data): Likewise.
+ * ieee.c (ieee_slurp_section_data): Use ieee_per_section macro.
+ (ieee_get_section_contents): Likewise.
+ (ieee_new_section_hook): Formatting.
+ (ieee_canonicalize_reloc): Remove commented out code.
+ * mmo.c (mmo_section_data): Define. Use throughout file.
+ * oasys.c (oasys_get_section_contents): Use oasys_per_section macro.
+
+2003-01-31 Graydon Hoare <graydon@redhat.com>
+
+ * Makefile.am (opncls.lo): Add dependency upon libiberty.h.
+ * Makefile.in: Regenerate.
+ * opncls.c (calc_crc32, get_debug_link_info,
+ seperate_debug_file_exists, find_seperate_debug_file): New
+ internal functions.
+ (bfd_follow_gnu_debuglink): New function. Follow the pointer
+ contained inside a .gnu_debuglink section.
+ * bfd-in2.h: Regenerate.
+
+2003-01-29 Alexandre Oliva <aoliva@redhat.com>
+
+ * elfxx-mips.c (mips_elf_got_entry_hash): Don't dereference
+ entry->abfd when it's NULL.
+
+2003-01-27 Alexandre Oliva <aoliva@redhat.com>
+
+ * elfxx-mips.c (mips_elf_create_dynamic_relocation): Handle
+ _bfd_elf_section_offset returning -2 the same way as -1.
+
+ * elfxx-mips.c (mips_elf_multi_got): New function.
+ (struct mips_got_entry): Make symndx and gotidx signed. Moved
+ addend into union along with address and link hash entry.
+ (struct mips_got_info): Added bfd2got and next.
+ (struct mips_elf_hash_sort_data): Added max_unref_got_dynindx.
+ (mips_elf_got_section, mips_elf_create_got_section): Use
+ SEC_EXCLUDE bit to tell whether we really need the got
+ section. Take boolean arguments to disregard an excluded
+ section, or to create it as excluded. Adjust all callers.
+ Use mips_elf_got_section all over.
+ (mips_elf_local_got_index, mips_elf_got_page,
+ mips_elf_got16_entry): Take input bfd as argument, and pass it
+ on to mips_elf_create_local_got_entry.
+ (mips_elf_global_got_index, mips_elf_create_local_got_entry):
+ Take input bfd as argument, and manage entries in the
+ appropriate GOT.
+ (mips_elf_got_offset_from_index): Take input bfd as argument,
+ and use it to adjust the GP offset of the bfd.
+ (mips_elf_sort_hash_table, mips_elf_sort_hash_table_f): Move
+ unreferenced GOT entries of global symbols to the end.
+ (mips_elf_record_global_got_symbol): Take input bfd as
+ argument. Add entries to the master GOT hash table.
+ (struct mips_elf_bfd2got_hash): New.
+ (struct mips_elf_got_per_bfd_arg): New.
+ (struct mips_elf_set_global_got_offset_arg): New.
+ (mips_elf_hash_bfd_vma, mips_elf_multi_got_entry_hash,
+ mips_elf_multi_got_entry_eq, mips_elf_bfd2got_entry_hash,
+ mips_elf_bfd2got_entry_eq, mips_elf_make_got_per_bfd,
+ mips_elf_merge_gots, mips_elf_set_global_got_offset,
+ mips_elf_resolve_final_got_entry,
+ mips_elf_resolve_final_got_entries, mips_elf_adjust_gp,
+ mips_elf_got_for_ibfd): New functions.
+ (ELF_MIPS_GP_OFFSET): Don't depend on SGI_COMPAT.
+ (MIPS_ELF_GOT_MAX_SIZE): New macro.
+ (STUB_LW): Generate 64-bit stub regardless of SGI_COMPAT.
+ (mips_elf_got_entry_hash): Take new fields into account. Use
+ mips_elf_hash_bfd_vma.
+ (mips_elf_got_entry_eq): Take new fields into account.
+ (mips_elf_create_got_section): Initialize new fields.
+ (mips_elf_calculate_relocation): Pass input_bfd to functions
+ that now take it. Adjust gp for the input_bfd.
+ (mips_elf_allocate_dynamic_relocation,
+ mips_elf_create_dynamic_relocation,
+ _bfd_mips_elf_create_dynamic_sections): Use...
+ (mips_elf_rel_dyn_section): New function. Borrow code from...
+ (_bfd_mips_elf_check_relocs): Pass input_bfd to functions that
+ now take it. Create the got section if needed, even if
+ excluded, before recording a global got symbol. Move some
+ code to...
+ (mips_elf_record_local_got_symbol): New fn.
+ (_bfd_mips_elf_size_dynamic_sections): Disable combreloc.
+ Compute multi-got global entries offsets. Move GOT code to...
+ (_bfd_mips_elf_always_size_sections): Call mips_elf_multi_got
+ if the GOT is too big.
+ (_bfd_mips_elf_finish_dynamic_symbol): Set got entry of
+ undefweak symbol to zero. Generate dynamic relocations for
+ non-primary GOT entries for global symbols.
+ (_bfd_mips_elf_finish_dynamic_sections): Handle multi-got
+ case. Generate dynamic relocations for local got entries.
+ Sort dynamic relocations on N64 too, using...
+ (sort_dynamic_relocs_64): New fns.
+ (_bfd_mips_elf_hide_symbol): Adjust multi-got counters.
+ (_bfd_mips_elf_merge_private_bfd_data): Ignore EF_MIPS_XGOT.
+
+2003-01-27 Alexandre Oliva <aoliva@redhat.com>
+
+ * bfd.c (struct _bfd): Added id field.
+ * opncls.c (_bfd_id_counter): New static variable.
+ (_bfd_new_bfd): Use it.
+ * bfd-in2.h: Rebuilt.
+
+2003-01-25 Alan Modra <amodra@bigpond.net.au>
+
+ * elf32-sparc.c (bfd_elf32_new_section_hook): Define.
+
+2003-01-25 Jakub Jelinek <jakub@redhat.com>
+
+ * elf32-sparc.c (_bfd_sparc_elf_howto_table): Add TLS relocs.
+ (elf32_sparc_rev32_howto): New variable.
+ (sparc_reloc_map): Add TLS relocs.
+ (elf32_sparc_reloc_type_lookup, elf32_sparc_info_to_howto):
+ Handle REV32.
+ (sparc_elf_hix22_reloc, sparc_elf_lox10_reloc, elf32_sparc_mkobject):
+ New functions.
+ (struct elf32_sparc_dyn_relocs, struct elf32_sparc_link_hash_entry,
+ struct elf32_sparc_link_hash_table):
+ New structures.
+ (elf32_sparc_tdata, elf32_sparc_local_got_tls_type,
+ elf32_sparc_hash_table): Define.
+ (link_hash_newfunc, elf32_sparc_link_hash_table_create,
+ create_got_section, elf32_sparc_create_dynamic_sections,
+ elf32_sparc_copy_indirect_symbol, elf32_sparc_tls_transition): New
+ functions.
+ (elf32_sparc_check_relocs): Handle TLS relocs. Add dynamic reloc
+ reference counting.
+ (elf32_sparc_gc_sweep_hook): Likewise.
+ (elf32_sparc_adjust_dynamic_symbol): Likewise.
+ (elf32_sparc_size_dynamic_sections): Likewise.
+ (elf32_sparc_relocate_section): Likewise.
+ (allocate_dynrelocs, readonly_dynrelocs, dtpoff_base, tpoff):
+ New functions.
+ (elf32_sparc_object_p): Allocate backend private object data.
+ (bfd_elf32_bfd_link_hash_table_create,
+ elf_backend_copy_indirect_symbol, bfd_elf32_mkobject,
+ elf_backend_can_refcount): Define.
+ (elf_backend_create_dynamic_sections): Define to
+ elf32_sparc_create_dynamic_sections.
+ * reloc.c: Add SPARC TLS relocs.
+ * bfd-in2.h, libbfd.h: Rebuilt.
+ * elf64-sparc.c (sparc64_elf_howto_table): Add TLS relocs.
+ (sparc_reloc_map): Likewise.
+
+2003-01-24 Martin Schwidefsky <schwidefsky@de.ibm.com>
+
+ * bfd-in2.h: Regenerate.
+ * elf32-s390.c (elf_s390_mkobject, elf_s390_tls_transition,
+ s390_tls_reloc, dtpoff_base, tpoff, invalid_tls_insn): New functions.
+ (elf_howto_table): Add TLS relocs.
+ (elf_s390_reloc_type_lookup): Likewise.
+ (elf_s390_link_hash_entry): Add tls_type.
+ (elf_s390_hash_entry, elf_s390_obj_tdata, elf_s390_local_got_tls_type):
+ New macros.
+ (elf_s390_link_hash_table): Add tls_ldm_got.
+ (link_hash_newfunc): Initialize tls_type.
+ (elf_s390_link_hash_table_create): Initialize refcount of tls_ldm_got.
+ (elf_s390_copy_indirect_symbol): Copy tls_type information.
+ (elf_s390_check_relocs): Support TLS relocs.
+ (elf_s390_gc_sweep_hook): Likewise.
+ (allocate_dynrelocs): Likewise.
+ (elf_s390_size_dynamic_sections): Likewise.
+ (elf_s390_relocate_section): Likewise.
+ (elf_s390_finish_dynamic_symbol): Likewise.
+ (bfd_elf32_mkobject): Define for TLS.
+ * elf64-s390.c: Same changes as for elf32-s390.c.
+ * libbfd.h: Regenerate.
+ * reloc.c: Add s390 TLS relocations.
+
+2003-01-24 Charles Lepple <clepple@ghz.cc>
+
+ * aclocal.m4: Fix name of --enable-install-libbfd switch.
+
+2003-01-23 Nick Clifton <nickc@redhat.com>
+
+ * Add sh2e support:
+ 2002-04-02 Elena Zannoni <ezannoni@redhat.com>
+ * archures.c (bfd_mach_sh2e): Added.
+ * bfd-in2.h: Rebuilt.
+ * cpu-sh.c (arch_info_struct): Added SH2e.
+ * elf32-sh.c (sh_elf_set_mach_from_flags): Handle EF_SH2E.
+
+2003-01-23 Alan Modra <amodra@bigpond.net.au>
+
+ * elf-bfd.h (struct bfd_elf_section_data): Remove tdata. Change
+ dynindx to an int. Rearrange for better packing.
+ * elf.c (_bfd_elf_new_section_hook): Don't alloc if already done.
+ * elf32-mips.c (bfd_elf32_new_section_hook): Define.
+ * elf32-sh64.h: New. Split out from include/elf/sh.h.
+ (struct _sh64_elf_section_data): New struct.
+ (sh64_elf_section_data): Don't dereference sh64_info (was tdata).
+ * elf32-sh64-com.c: Include elf32-sh64.h.
+ * elf32-sh64.c: Likewise.
+ (sh64_elf_new_section_hook): New function.
+ (bfd_elf32_new_section_hook): Define.
+ (sh64_elf_fake_sections): Adjust for sh64_elf_section_data change.
+ (sh64_bfd_elf_copy_private_section_data): Likewise.
+ (sh64_elf_final_write_processing): Likewise.
+ * elf32-sparc.c (struct elf32_sparc_section_data): New.
+ (elf32_sparc_new_section_hook): New function.
+ (SET_SEC_DO_RELAX, SEC_DO_RELAX): Delete.
+ (sec_do_relax): Define.
+ (elf32_sparc_relax_section): Adjust to use sec_do_relax.
+ (elf32_sparc_relocate_section): Likewise.
+ * elf64-mips.c (bfd_elf64_new_section_hook): Define.
+ * elf64-mmix.c (struct _mmix_elf_section_data): New.
+ (mmix_elf_section_data): Define. Use throughout file.
+ (mmix_elf_new_section_hook): New function.
+ (bfd_elf64_new_section_hook): Define.
+ * elf64-ppc.c (struct _ppc64_elf_section_data): New.
+ (ppc64_elf_section_data): Define. Use throughout.
+ (ppc64_elf_new_section_hook): New function.
+ (bfd_elf64_new_section_hook): Define.
+ * elf64-sparc.c (struct sparc64_elf_section_data): New.
+ (sparc64_elf_new_section_hook): New function.
+ (SET_SEC_DO_RELAX, SEC_DO_RELAX): Delete.
+ (sec_do_relax): Define.
+ (sparc64_elf_relax_section): Adjust to use sec_do_relax.
+ (sparc64_elf_relocate_section): Likewise.
+ (bfd_elf64_new_section_hook): Define.
+ * elfn32-mips.c (bfd_elf32_new_section_hook): Define.
+ * elfxx-mips.c (struct _mips_elf_section_data): New.
+ (mips_elf_section_data): Define. Use throughout.
+ (_bfd_mips_elf_new_section_hook): New function.
+ (mips_elf_create_got_section): Don't alloc used_by_bfd.
+ * elfxx-mips.h (_bfd_mips_elf_new_section_hook): Declare.
+ * elfxx-target.h (bfd_elfNN_new_section_hook): Add #ifndef.
+ * Makefile.am: Run "make dep-am".
+ * Makefile.in: Regenerate.
+
+2003-01-21 Richard Henderson <rth@redhat.com>
+
+ * elf64-alpha.c (ALPHA_ELF_LINK_HASH_PLT_LOC): New.
+ (struct alpha_elf_link_hash_entry): Add plt_old_section, plt_old_value.
+ (elf64_alpha_adjust_dynamic_symbol): Set them.
+ (elf64_alpha_size_plt_section_1): Reset them when plt entry removed.
+ (elf64_alpha_relax_tls_get_addr): Handle LDM relocs. Frob the
+ symbol index when relaxing LDM to TPREL.
+ (elf64_alpha_relax_section): Likewise. Allow relaxation of GD
+ relocs, even if the target isn't locally defined.
+ (elf64_alpha_check_relocs): Frob LDM reloc symndx to zero.
+ (elf64_alpha_relocate_section): Likewise. Force TP-relative
+ relocs vs symndx 0 to the tp base.
+
+2003-01-21 Fabio Alemagna <falemagn@aros.org>
+
+ * config.bfd: Handle i[3456]86-*-aros*.
+
+2003-01-21 Andreas Schwab <schwab@suse.de>
+
+ * elf32-ppc.c (struct ppc_elf_dyn_relocs): Define.
+ (struct ppc_elf_link_hash_entry): Define.
+ (ppc_elf_hash_entry): New function.
+ (struct ppc_elf_link_hash_table): Define.
+ (ppc_elf_hash_table): New function.
+ (ppc_elf_link_hash_newfunc): New function.
+ (ppc_elf_link_hash_table_create): New function.
+ (ppc_elf_copy_indirect_symbol): New function.
+ (allocate_dynrelocs): New function.
+ (readonly_dynrelocs): New function.
+ (ppc_elf_size_dynamic_sections): Allocate space for dynamic
+ relocs and determine DT_TEXTREL.
+ (ppc_elf_check_relocs): Don't do that here, just count the
+ dynamic relocs.
+ (ppc_elf_gc_sweep_hook): Discard any dynamic relocs against the
+ removed section.
+ (bfd_elf32_bfd_link_hash_table_create): Define.
+ (elf_backend_copy_indirect_symbol): Define.
+
+2003-01-21 Richard Henderson <rth@redhat.com>
+
+ * elf64-alpha.c (alpha_dynamic_entries_for_reloc): GOTTPREL and
+ TPREL also get a reloc if shared. Remove SREL support.
+ (elf64_alpha_emit_dynrel): New.
+ (elf64_alpha_relocate_section): Use it. Resolve dynamic TPREL
+ and GOTTPREL relocs to local symbols against the tp base.
+ (elf64_alpha_finish_dynamic_symbol): Use elf64_alpha_emit_dynrel.
+
+ * elf64-alpha.c (elf64_alpha_relax_got_load): Decrement got
+ use count before clobbering r_type.
+ (elf64_alpha_relax_tls_get_addr): Don't use pos[1] if insn
+ ordering would mean dataflow inspection is necessary.
+
+2003-01-20 Svein E. Seldal <Svein.Seldal@solidas.com>
+
+ * coffcode.h (coff_set_flags): Added get/set arch hooks.
+
+2003-01-20 Fabio Alemagna <falemagn@aros.org>
+
+ * elf32-sh.c: Treat elfNN_bed like other macros defined in
+ elfxx-target.h and #undef it before #define'ing it.
+ * elf32-i386.c: Likewise.
+ * elf32-sh64.c: Likewise.
+ * elf64-alpha.c: Likewise.
+ * elf64-sh64.c: Likewise.
+
+2003-01-20 Martin Schwidefsky <schwidefsky@de.ibm.com>
+
+ * bfd-in2.h: Regenerate.
+ * elf32-s390.c (elf_s390_adjust_gotplt): New prototype.
+ (elf_howto_table): Rename R_390_GOTOFF to R_390_GOTOFF32. Add
+ R_390_GOTOFF16, R_390_GOTOFF64, R_390_GOTPLT12, R_390_GOTPLT16,
+ R_390_GOTPLT32, R_390_GOTPLT64, R_390_GOTPLTENT, R_390_PLTOFF16,
+ R_390_PLTOFF32 and R_390_PLTOFF64.
+ (elf_s390_reloc_type_lookup): Likewise.
+ (struct elf_s390_link_hash_entry): Add gotplt_refcount to keep track
+ of GOTPLT references to a function.
+ (link_hash_newfunc): Initialize gotplt_refcount.
+ (elf_s390_check_relocs): Move allocation of local_got_refcounts array
+ and creation of the got section out of the main switch. Add support
+ for the gotoff, gotplt and pltoff relocations.
+ (elf_s390_gc_sweep_hook): Add reference counting for gotoff, gotplt
+ and pltoff.
+ (elf_s390_adjust_gotplt): New function.
+ (elf_s390_adjust_dynamic_symbol): Adjust gotplt refcount for removed
+ plt entries.
+ (allocate_dynrelocs): Add comment.
+ (elf_s390_relocate_section): Change r_type to unsigned. Add support
+ for gotoff, gotplt and pltoff relocations.
+ * elf64-s390.c: Same changes as for elf32-s390.c.
+ * libbfd.h: Regenerate.
+ * reloc.c: Add BFD_RELOC_390_GOTOFF64, BFD_RELOC_390_GOTPLT12,
+ BFD_RELOC_390_GOTPLT16, BFD_RELOC_390_GOTPLT32, BFD_RELOC_390_GOTPLT64,
+ BFD_RELOC_390_GOTPLTENT, BFD_RELOC_390_PLTOFF16, BFD_RELOC_390_PLTOFF32
+ and BFD_RELOC_390_PLTOFF64.
+
+2003-01-18 Jakub Jelinek <jakub@redhat.com>
+
+ * elfxx-ia64.c (elfNN_ia64_relocate_section): Handle
+ R_IA64_TPREL64[LM]SB against non-global symbol properly.
+
+2003-01-16 Jakub Jelinek <jakub@redhat.com>
+
+ * elfxx-ia64.c (struct elfNN_ia64_link_hash_table): Add
+ self_dtpmod_done and self_dtpmod_offset.
+ (allocate_global_data_got): Only use one got entry for all
+ dtpmod relocs against local symbols.
+ (allocate_dynrel_entries): Only need .rela.got entry for
+ dtpmod against global symbol.
+ (elfNN_ia64_size_dynamic_sections): Initialize self_dtpmod_offset.
+ Reserve space in .rela.got for the local dtpmod entry.
+ (set_got_entry): Initialize the common local dtpmod .got entry.
+ (elfNN_ia64_relocate_section): Handle R_IA_64_DTPREL64LSB
+ and R_IA_64_DTPREL64MSB.
+
+2003-01-16 Alan Modra <amodra@bigpond.net.au>
+
+ * elf64-ppc.c: Include elf/ppc64.h rather than elf/ppc.h.
+ (R_PPC_*): Rename all occurrences to R_PPC64_*.
+ (R_PPC64_ADDR30): Rename all occurrences to R_PPC64_REL30.
+ (enum elf_ppc_reloc_type): Ditto to enum elf_ppc64_reloc_type.
+ (ppc64_elf_gc_sweep_hook): Handle R_PPC64_REL30 along with other
+ relative relocs, not with absolute ones.
+ * Makefile.am: Run "make dep-am".
+ * Makefile.in: Regenerate.
+ * po/SRC-POTFILES.in: Regenerate.
+
+2003-01-15 Andreas Schwab <schwab@suse.de>
+
+ * elf32-ppc.c (ppc_elf_check_relocs): Don't set DF_TEXTREL for a
+ relocation against a non-allocated readonly section.
+
+2003-01-10 Alan Modra <amodra@bigpond.net.au>
+
+ * elf32-ppc.c (ppc_elf_relocate_section): Adjust addend for GOT16_HA.
+ * elf64-ppc.c (ppc64_elf_relocate_section): Likewise. PLTGOT16_HA too.
+
+2002-01-08 Klee Dienes <kdienes@apple.com>
+
+ * Makefile.am (ALL_MACHINES): Use cpu-msp430.lo, not cpu-msp430.c.
+ (BFD32_BACKENDS): Use elf32-msp430.lo, not elf32-msp430.c.
+ * Makefile.in: Regenerate.
+
+2003-01-08 Alexandre Oliva <aoliva@redhat.com>
+
+ * elfn32-mips.c (prev_reloc_section): New.
+ (GET_RELOC_ADDEND): Use it. Parenthesize macro arguments.
+ (SET_RELOC_ADDEND): Parenthesize macro argument.
+
+2003-01-07 John David Anglin <dave.anglin@nrc.gc.ca>
+
+ * elf32-hppa.c (final_link_relocate): For all DP relative relocations,
+ adjust addil instructions if the symbol has no section.
+
+2003-01-07 DJ Delorie <dj@redhat.com>
+
+ * elf32-xstormy16.c (xstormy16_elf_howto_table): Make REL_12 not
+ partial_inplace.
+
+2003-01-07 Andreas Schwab <schwab@suse.de>
+
+ * elf32-m68k.c (elf_m68k_check_relocs): Don't set DF_TEXTREL for
+ PC relative relocations.
+ (elf_m68k_discard_copies): Set it here instead.
+
+2002-01-02 Ben Elliston <bje@redhat.com>
+ Jeff Johnston <jjohnstn@redhat.com>
+
+ * Makefile.am (ALL_MACHINES): Add cpu-iq2000.lo.
+ (ALL_MACHINES_CFILES): Add cpu-iq2000.c.
+ (BFD32_BACKENDS): Add elf32-iq2000.lo.
+ (BFD32_BACKENDS_CFILES): Add elf32-iq2000.c.
+ (cpu-iq2000.lo): New target.
+ * Makefile.in: Regenerate.
+ * config.bfd: Handle iq2000-*-elf.
+ * archures.c (bfd_architecture): Add bfd_{arch,mach}_iq2000.
+ (bfd_archures_list): Add bfd_iq2000_arch.
+ * configure.in: Handle bfd_elf32_iq2000_vec.
+ * configure: Regenerate.
+ * reloc.c: Add BFD_RELOC_IQ2000_OFFSET_16, BFD_RELOC_IQ2000_OFFSET_21,
+ and BFD_RELOC_IQ2000_UHI16.
+ * targets.c (bfd_elf32_iq2000_vec): Declare.
+ (bfd_target_vector): Add bfd_elf32_iq2000_vec.
+ * elf.c (prep_headers): Set e_machine to EM_IQ2000.
+ * cpu-iq2000.c: New file.
+ * elf32-iq2000.c: Likewise.
+ * libbfd.h: Regenerate.
+ * bfd-in2.h: Likewise.
+
+2003-01-02 Richard Sandiford <rsandifo@redhat.com>
+
+ * elfxx-mips.c: Include libiberty.h.
+ (elf_mips_isa, _bfd_mips_elf_mach_extends_p): Remove.
+ (mips_set_isa_flags): New function, split out from...
+ (_bfd_mips_elf_final_write_processing): ...here. Only call
+ mips_set_isa_flags if the EF_MIPS_MACH bits are clear.
+ (mips_mach_extensions): New array.
+ (mips_32bit_flags_p): New function.
+ (_bfd_mips_elf_merge_private_bfd_data): Rework architecture checks.
+ Use mips_32bit_flags_p to check if one binary is 32-bit and the
+ other is 64-bit. When adopting IBFD's architecture, adopt the
+ bfd_mach as well as the flags.
+
+2003-01-02 Nick Kelsey <nickk@ubicom.com>
+
+ * elf32-ip2k.c: Re-work of linker relaxation code for the ip2k to
+ fix internal errors, fix bad code generation, fix incorrect stabs
+ information, and improve ability to eliminate redundant page
+ instructions. Added code to ip2k_final_link_relocate to self-verify
+ the linker relaxation. Fix formatting problems.
+
+2002-12-30 Chris Demetriou <cgd@broadcom.com>
+
+ * aoutx.h (NAME(aout,machine_type)): Add bfd_mach_mipsisa32r2 case.
+ * archures.c (bfd_mach_mipsisa32r2): New define.
+ * bfd-in2.h: Regenerate.
+ * cpu-mips.c (I_mipsisa32r2): New enum value.
+ (arch_info_struct): Add entry for I_mipsisa32r2.
+ * elfxx-mips.c (elf_mips_isa, _bfd_elf_mips_mach)
+ (_bfd_mips_elf_print_private_bfd_data): Handle E_MIPS_ARCH_32R2.
+ (_bfd_mips_elf_final_write_processing): Add
+ bfd_mach_mipsisa32r2 case.
+ (_bfd_mips_elf_merge_private_bfd_data): Handle merging of
+ binaries marked as using MIPS32 Release 2.
+
+2002-12-30 Dmitry Diky <diwil@mail.ru>
+
+ * Makefile.am: Add msp430 target.
+ * configure.in: Likewise.
+ * Makefile.in: Regenerate.
+ * configure: Regenerate.
+ * archures.c: Add msp430 architecture vector.
+ * config.bfd: Likewise.
+ * reloc.c: Add msp430 relocs.
+ * targets.c: Add msp320 target.
+ * cpu-msp430.c: New file: msp430 cpu detection.
+ * elf32-msp430.c: New file: msp430 reloc processing.
+ * bfd-in2.h: Regenerate.
+ * libbfd.h: Regenerate.
+
+2002-12-28 Jakub Jelinek <jakub@redhat.com>
+
+ * elf.c (elf_sort_sections): Don't reorder .tbss.
+ (assign_file_positions_for_segments): Only adjust off/voff
+ for increased alignment in PT_LOAD or PT_NOTE segment,
+ but adjust p_filesz for .tbss too. in PT_LOAD consider
+ .tbss to have zero memory size.
+ (copy_private_bfd_data) [SECTION_SIZE]: Define.
+ [IS_CONTAINED_BY_VMA, IS_CONTAINED_BY_LMA]: Use it.
+ [INCLUDE_SECTION_IN_SEGMENT]: Only put SHF_TLS sections
+ into PT_TLS segment. Never put SHF_TLS sections in
+ segments other than PT_TLS or PT_LOAD.
+
+ * elf64-alpha.c (elf64_alpha_finish_dynamic_sections): Clear .plt
+ sh_entsize.
+
+2002-12-23 DJ Delorie <dj@redhat.com>
+
+ * coff64-rs6000.c (xcoff64_ppc_relocate_section): Fix logic reversal.
+
+2002-12-23 Alan Modra <amodra@bigpond.net.au>
+
+ * elflink.h (elf_link_output_extsym): Heed strip_discarded.
+
+2002-12-23 Nick Clifton <nickc@redhat.com>
+
+ * archures.c (bfd_arch_get_compatible): Add third parameter
+ 'accept_unknowns'. Only accept unknown format BFDs if
+ accept_unknowns is true, or if the format is "binary".
+ * bfd-in2.h: Regenerate.
+
+2002-12-21 Nick Clifton <nickc@redhat.com>
+
+ * coff-arm.c (coff_arm_relocate_section): Disable WINCE workaround
+ that subtracted 8 from pc relative relocations.
+
+2002-12-20 Kazu Hirata <kazu@cs.umass.edu>
+
+ * coff-h8300.c: Fix comment typos.
+ * coffcode.h: Likewise.
+ * cpu-cris.c: Likewise.
+ * elf32-vax.c: Likewise.
+ * genlink.h: Likewise.
+ * linker.c: Likewise.
+ * som.c: Likewise.
+ * tekhex.c: Likewise.
+ * vms-misc.c: Likewise.
+
+2002-12-20 DJ Delorie <dj@redhat.com>
+
+ * reloc.c: Add BFD_RELOC_XSTORMY16_12.
+ * libbfd.h: Regenerate.
+ * bfd-in2.h: Regenerate.
+ * elf32-xstormy16.c (xstormy16_elf_howto): Add R_XSTORMY16_12.
+ (xstormy16_reloc_map): Add R_XSTORMY16_12.
+
+2002-12-19 Kazu Hirata <kazu@cs.umass.edu>
+
+ * doc/bfdint.texi: Fix typos.
+
+2002-12-20 Paul Eggert <eggert@twinsun.com>
+
+ Port to POSIX 1003.1-2001.
+ * acinclude.m4 (AM_INSTALL_LIBBFD): Do not rely on "test -o".
+ * configure.in (build-warnings): Likewise.
+ (Horrible hacks to build DLLs on Windows): Do not rely on "tail -1".
+ * aclocal.m4: Regenerate.
+ * config.in: Regenerate.
+ * configure: Regenerate.
+
+2002-12-19 Alan Modra <amodra@bigpond.net.au>
+
+ * coff-h8300.c: Include libiberty.h.
+ (h8300_reloc16_extra_cases): Check the hash table creator before
+ referencing h8300 specific fields. Stash the hash table pointer
+ in a local var. Comment typo fixes.
+ (h8300_bfd_link_add_symbols): Likewise.
+
+ * reloc.c (struct reloc_howto_struct): Revise src_mask and
+ dst_mask comments.
+ * bfd-in2.h: Regenerate.
+
+2002-12-18 Alan Modra <amodra@bigpond.net.au>
+
+ * elf32-ppc.c (ppc_elf_relocate_section): Reorganize dynamic reloc
+ code a little. Comment on dynamic relocs against section symbols.
+
+2002-12-17 Roger Sayle <roger@eyesopen.com>
+
+ * configure.host (ia64-*-hpux*): Support 64 bit targets using
+ the HP compiler's "long long".
+
+2002-12-16 Andrew MacLeod <amacleod@redhat.com>
+
+ * elf32-xstormy16.c (xstormy16_elf_howto): Add R_XSTORMY16_LO16
+ and R_XSTORMY16_HI16) howto entries.
+ (xstormy16_reloc_map): Map R_XSTORMY16_{LO,HI}16 to BFD_RELOC_{LO,HI}16.
+ (xstormy16_info_to_howto_rela): Use R_XSTORMY16_GNU_VTINHERIT to
+ determine the start of the second reloc table.
+
+2002-12-16 Nathan Tallent <eraxxon@alumni.rice.edu>
+
+ * ecofflink.c: Fix the reading of the debugging information
+ of Tru64/Alpha binaries that are produced by recent Compaq
+ compilers.
+ (mk_fdrtab): Fix error in creating the FDR (file descriptor)
+ table.
+ (lookup_line): Because of the strange information sometimes
+ generated by Compaq's recent compilers, change how the FDR
+ table is searched so that PDRs (procedure descriptors) are
+ correctly found. Note that this change is really more of a hack;
+ however, I have included extensive documentation as to why
+ this is the best solution short of an extensive rewrite or
+ another hack.
+ (fdrtab_lookup): Add comments to explain the algorithm.
+
+2002-12-12 Alexandre Oliva <aoliva@redhat.com>
+
+ * elf-m10300.c (elf32_mn10300_link_hash_newfunc): Reorder
+ initializers to match struct declaration.
+
+2002-12-12 Alan Modra <amodra@bigpond.net.au>
+
+ * dwarf2.c (comp_unit_contains_address): Comment typo fix.
+ * elf.c (get_program_header_size): Likewise.
+ * elf32-m32r.c (m32r_elf_lo16_reloc): Likewise.
+ (m32r_elf_generic_reloc): Likewise.
+ * elf32-ppc.c (ppc_elf_howto_init): Likewise.
+ * elflink.h (elf_bfd_discard_info): Likewise.
+
+2002-12-12 Alan Modra <amodra@bigpond.net.au>
+
+ * elf32-i386.c (elf_i386_finish_dynamic_sections): Add output_offset
+ to DT_JMPREL. Use srelplt input section size for DT_PLTRELSZ and
+ DT_RELSZ adjustment, not output section. Avoid writing tags when
+ unchanged. Don't assume linker script is sane, adjust DT_REL too.
+ * elf32-hppa.c (elf32_hppa_finish_dynamic_sections): Just use raw
+ size of srelplt for DT_PLTRELSZ. Use srelplt input section size for
+ DT_RELASZ adjustment, not output section. Avoid writing tags when
+ unchanged. Adjust DT_RELA.
+ * elf64-ppc.c (ppc64_elf_finish_dynamic_sections): Tweaks for better
+ formatting. Avoid writing tags when unchanged. Adjust DT_RELA.
+
+2002-12-12 Alexandre Oliva <aoliva@redhat.com>
+
+ * elfxx-mips.c (mips_elf_calculate_relocation): Don't divide
+ addend by 4.
+
+2002-12-12 Alexandre Oliva <aoliva@redhat.com>
+
+ * elfxx-mips.c (struct mips_got_entry): New.
+ (struct mips_got_info): Added got_entries field.
+ (mips_elf_got_entry_hash, mips_elf_got_entry_eq): New functions.
+ (mips_elf_local_got_index, mips_elf_got_page,
+ mips_elf_got16_entry): Re-implement in terms of new...
+ (mips_elf_create_local_got_entry): Rewrite to use got_entries.
+ Change return type.
+ (mips_elf_highest): Warning clean-up.
+ (mips_elf_create_got_section): Initialize got_entries.
+ (_bfd_mips_elf_check_relocs): Use got_entries to estimate
+ local got size.
+ (_bfd_mips_elf_size_dynamic_sections): Do not account for
+ GOT_PAGE entries, since we now reuse GOT16 entries.
+
+2002-12-10 Jason Thorpe <thorpej@wasabisystems.com>
+
+ * aoutx.h (set_section_contents): Allow an otherwise unrepresentable
+ read-only section that lies after .text and before .data to be
+ written into the output file and included in a_text.
+ (translate_to_native_sym_flags): If an otherwise unrepresentable
+ section was merged with .text, convert its symbols to N_TEXT
+ symbols.
+ * libaout.h (aout_section_merge_with_text_p): New macro.
+
+2002-12-08 Alan Modra <amodra@bigpond.net.au>
+
+ * bfd-in.h: Comment typo fix. Formatting.
+ * bfd-in2.h: Regenerate.
+ * coff64-rs6000.c (xcoff64_openr_next_archived_file): Warning fix.
+ * elf32-m68hc12.c (m68hc12_elf_set_mach_from_flags): Prototype.
+ * elf64-mmix.c (mmix_dump_bpo_gregs): Warning fix.
+
+2002-12-05 Richard Henderson <rth@redhat.com>
+
+ * elfxx-ia64.c (elfNN_ia64_relax_section): Handle PCREL21BI.
+ Only send PCREL21B though the plt. Fix installed reloc type.
+ (elfNN_ia64_relocate_section): Give error for dynamic reloc
+ against PCREL22 or PCREL64I; clean up error messages for
+ branch relocs.
+
+2002-12-04 Kevin Buettner <kevinb@redhat.com>
+
+ * elf64-mips.c (elf64_mips_grok_prstatus, elf64_mips_grok_psinfo):
+ New functions.
+ (elf_backend_grok_prstatus, elf_backend_grok_psinfo): Define.
+
+2002-12-04 David Mosberger <davidm@hpl.hp.com>
+
+ * cpu-ia64-opc.c: Add operand constant "ar.csd".
+
+2002-12-04 H.J. Lu <hjl@gnu.org>
+
+ * elfxx-ia64.c (get_local_sym_hash): Use section ID instead of
+ BFD address when constructing local name.
+
+2002-12-04 Andreas Schwab <schwab@suse.de>
+
+ * elf32-m68k.c (struct elf_m68k_link_hash_table): Add sym_sec
+ member.
+ (elf_m68k_link_hash_table_create): Initialize it.
+ (elf_m68k_check_relocs): Handle symbols that are forced to be
+ local due to visibility changes.
+ (elf_m68k_adjust_dynamic_symbol): Likewise.
+ (elf_m68k_size_dynamic_sections): Likewise.
+ (elf_m68k_discard_copies): Likewise.
+ (elf_m68k_relocate_section): Likewise.
+
+2002-12-04 Alan Modra <amodra@bigpond.net.au>
+
+ * elf64-ppc.c (ppc64_elf_edit_opd): Correct typo.
+
+2002-12-04 Alan Modra <amodra@bigpond.net.au>
+
+ * srec.c (srec_write_symbols): Restore '$' prefix to address
+ accidentally removed in 2002-04-04 change.
+ (srec_get_symtab): Use 0 instead of `(long) FALSE'.
+
+2002-12-03 Nick Clifton <nickc@redhat.com>
+
+ * elf32-ppc.c (apuinfo_list_init): New function.
+ (apuinfo_list_add): New function: Add a value to the list.
+ (apuinfo_list_length): New function: Return the number of
+ values on the list.
+ (apuinfo_list_element): New function: Return a value on the
+ list.
+ (apuinfo_list_finish): New function: Free the resources used
+ by the list.
+ (ppc_elf_begin_write_processing): New function. Scan the
+ input bfds for apuinfo sections.
+ (ppc_elf_write_section): New function: Delay the creation of
+ the contents of an apuinfo section in an output bfd.
+ (ppc_elf_final_write_processing): New function. Create the
+ contents of an apuinfo section in an output bfd.
+ (elf_backend_begin_write_processing): Define.
+ (elf_backend_final_write_processing): Define.
+ (elf_backend_write_section): Define.
+
+2002-12-03 Richard Henderson <rth@redhat.com>
+
+ * cpu-ia64-opc.c (elf64_ia64_operands): Add ldxmov entry.
+
+2002-12-01 Stephane Carrez <stcarrez@nerim.fr>
+
+ Fix PR savannah/1417:
+ * elf32-m68hc11.c (m68hc11_elf_relax_delete_bytes): Don't adjust
+ branch if it goes to the start of the deleted region.
+
+2002-12-01 Stephane Carrez <stcarrez@nerim.fr>
+
+ * bfd-in2.h (bfd_mach_m6812): Rebuild.
+ * archures.c (bfd_mach_m6812_default, bfd_mach_m6812,
+ bfd_mach_m6812s): Declare.
+
+ * elf32-m68hc12.c (m68hc12_elf_set_mach_from_flags): New function.
+ (_bfd_m68hc12_elf_set_private_flags): Call it.
+ (_bfd_m68hc12_elf_print_private_bfd_data): Report processor version.
+ (_bfd_m68hc12_elf_merge_private_bfd_data): Merge the flags and
+ report microcontroller incompatibilities (HC12 vs HCS12).
+ (elf_backend_object_p): Update.
+
+2002-11-30 Alan Modra <amodra@bigpond.net.au>
+
+ * bfd-in.h (TRUE_FALSE_ALREADY_DEFINED, BFD_TRUE_FALSE): Delete.
+ (enum bfd_boolean, boolean): Delete.
+ (bfd_boolean): Typedef to an int.
+ (FALSE, TRUE): Define.
+ * aix386-core.c, aix5ppc-core.c, aout-adobe.c, aout-arm.c, aout-cris.c,
+ aout-encap.c, aout-ns32k.c, aout-target.h, aout-tic30.c, aoutf1.h,
+ aoutx.h, archive.c, archive64.c, archures.c, bfd-in.h, bfd.c, bfdwin.c,
+ binary.c, bout.c, cache.c, cisco-core.c, coff-a29k.c, coff-alpha.c,
+ coff-apollo.c, coff-arm.c, coff-aux.c, coff-h8300.c, coff-h8500.c,
+ coff-i386.c, coff-i860.c, coff-i960.c, coff-ia64.c, coff-m68k.c,
+ coff-m88k.c, coff-mcore.c, coff-mips.c, coff-or32.c, coff-ppc.c,
+ coff-rs6000.c, coff-sh.c, coff-sparc.c, coff-stgo32.c, coff-tic30.c,
+ coff-tic4x.c, coff-tic54x.c, coff-tic80.c, coff-w65.c, coff-we32k.c,
+ coff-z8k.c, coff64-rs6000.c, coffcode.h, coffgen.c, cofflink.c,
+ corefile.c, cpu-a29k.c, cpu-alpha.c, cpu-arc.c, cpu-arm.c, cpu-avr.c,
+ cpu-cris.c, cpu-d10v.c, cpu-d30v.c, cpu-dlx.c, cpu-fr30.c, cpu-frv.c,
+ cpu-h8300.c, cpu-h8500.c, cpu-hppa.c, cpu-i370.c, cpu-i386.c,
+ cpu-i860.c, cpu-i960.c, cpu-ia64.c, cpu-ip2k.c, cpu-m10200.c,
+ cpu-m10300.c, cpu-m32r.c, cpu-m68hc11.c, cpu-m68hc12.c, cpu-m68k.c,
+ cpu-m88k.c, cpu-mcore.c, cpu-mips.c, cpu-mmix.c, cpu-ns32k.c,
+ cpu-openrisc.c, cpu-or32.c, cpu-pdp11.c, cpu-pj.c, cpu-powerpc.c,
+ cpu-rs6000.c, cpu-s390.c, cpu-sh.c, cpu-sparc.c, cpu-tic30.c,
+ cpu-tic4x.c, cpu-tic54x.c, cpu-tic80.c, cpu-v850.c, cpu-vax.c,
+ cpu-w65.c, cpu-we32k.c, cpu-xstormy16.c, cpu-z8k.c, dwarf1.c,
+ dwarf2.c, ecoff.c, ecofflink.c, efi-app-ia32.c, efi-app-ia64.c,
+ elf-bfd.h, elf-eh-frame.c, elf-hppa.h, elf-m10200.c, elf-m10300.c,
+ elf-strtab.c, elf.c, elf32-arc.c, elf32-arm.h, elf32-avr.c,
+ elf32-cris.c, elf32-d10v.c, elf32-d30v.c, elf32-dlx.c, elf32-fr30.c,
+ elf32-frv.c, elf32-gen.c, elf32-h8300.c, elf32-hppa.c, elf32-hppa.h,
+ elf32-i370.c, elf32-i386.c, elf32-i860.c, elf32-i960.c, elf32-ip2k.c,
+ elf32-m32r.c, elf32-m68hc11.c, elf32-m68hc12.c, elf32-m68k.c,
+ elf32-mcore.c, elf32-mips.c, elf32-openrisc.c, elf32-or32.c,
+ elf32-pj.c, elf32-ppc.c, elf32-s390.c, elf32-sh.c, elf32-sh64-com.c,
+ elf32-sh64.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c,
+ elf32-xstormy16.c, elf64-alpha.c, elf64-gen.c, elf64-hppa.c,
+ elf64-mips.c, elf64-mmix.c, elf64-ppc.c, elf64-ppc.h, elf64-s390.c,
+ elf64-sh64.c, elf64-sparc.c, elf64-x86-64.c, elfarm-nabi.c,
+ elfarm-oabi.c, elfcode.h, elfcore.h, elflink.c, elflink.h,
+ elfn32-mips.c, elfxx-ia64.c, elfxx-mips.c, elfxx-mips.h,
+ elfxx-target.h, format.c, freebsd.h, genlink.h, hash.c, hp300hpux.c,
+ hppabsd-core.c, hpux-core.c, i386aout.c, i386linux.c, i386lynx.c,
+ i386mach3.c, i386msdos.c, i386os9k.c, ieee.c, ihex.c, irix-core.c,
+ libaout.h, libbfd-in.h, libbfd.c, libcoff-in.h, libecoff.h, libieee.h,
+ libnlm.h, liboasys.h, libpei.h, libxcoff.h, linker.c, lynx-core.c,
+ m68klinux.c, m68klynx.c, mach-o.c, mach-o.h, merge.c, mipsbsd.c,
+ mmo.c, netbsd-core.c, netbsd.h, nlm.c, nlm32-alpha.c, nlm32-i386.c,
+ nlm32-ppc.c, nlm32-sparc.c, nlmcode.h, oasys.c, opncls.c, osf-core.c,
+ pc532-mach.c, pdp11.c, pe-arm.c, pe-i386.c, pe-mcore.c, pe-mips.c,
+ pe-sh.c, peXXigen.c, pef.c, pei-arm.c, pei-i386.c, pei-mcore.c,
+ pei-mips.c, pei-sh.c, peicode.h, ppcboot.c, ptrace-core.c, reloc.c,
+ reloc16.c, riscix.c, rs6000-core.c, sco5-core.c, section.c, simple.c,
+ som.c, som.h, sparclinux.c, sparclynx.c, srec.c, stabs.c, sunos.c,
+ syms.c, targets.c, tekhex.c, ticoff.h, trad-core.c, versados.c,
+ vms-gsd.c, vms-hdr.c, vms-misc.c, vms-tir.c, vms.c, vms.h,
+ xcoff-target.h, xcofflink.c, xsym.c, xsym.h: Replace boolean with
+ bfd_boolean, true with TRUE, false with FALSE. Simplify comparisons
+ of bfd_boolean vars with TRUE/FALSE. Formatting.
+ * bfd-in2.h, libbfd.h, libcoff.h: Regenerate
+
+2002-11-28 Alan Modra <amodra@bigpond.net.au>
+
+ * elf-bfd.h: Replace occurrences of Elf32_Internal_* and
+ Elf64_Internal_* with Elf_Internal_*. Replace Elf_Internal_Rel
+ with Elf_Internal_Rela.
+ * elf-hppa.h, elf-m10200.c, elf-m10300.c, elf32-arc.c, elf32-arm.h,
+ elf32-avr.c, elf32-cris.c, elf32-d10v.c, elf32-d30v.c, elf32-dlx.c,
+ elf32-fr30.c, elf32-frv.c, elf32-gen.c, elf32-h8300.c, elf32-hppa.c,
+ elf32-i370.c, elf32-i386.c, elf32-i860.c, elf32-i960.c, elf32-ip2k.c,
+ elf32-m32r.c, elf32-m68hc11.c, elf32-m68hc12.c, elf32-m68k.c,
+ elf32-mcore.c, elf32-mips.c, elf32-openrisc.c, elf32-or32.c,
+ elf32-ppc.c, elf32-s390.c, elf32-sh.c, elf32-v850.c, elf32-vax.c,
+ elf32-xstormy16.c, elf64-alpha.c, elf64-gen.c, elf64-hppa.c,
+ elf64-mips.c, elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c,
+ elf64-sparc.c, elf64-x86-64.c, elfarm-nabi.c, elfarm-oabi.c,
+ elfcode.h, elflink.h, elfn32-mips.c, elfxx-ia64.c, elfxx-mips.c: Ditto.
+ * elf-hppa.h (elf_hppa_internal_shdr): Delete. Use Elf_Internal_Shdr
+ throughout instead.
+ * elf.c (_bfd_elf_no_info_to_howto_rel): Delete.
+ * elfcode.h (elf_swap_reloca_in): Pass source operand as a bfd_byte *.
+ Remove INLINE keyword.
+ (elf_swap_reloc_in): Likewise. Also clear r_addend.
+ (elf_swap_reloc_out, elf_swap_reloca_out): Pass destination operand
+ as a bfd_byte *.
+ (elf_write_relocs): Consolidate REL and RELA code.
+ (elf_slurp_reloc_table_from_section): Simplify REL code.
+ (NAME(_bfd_elf,size_info)): Populate reloc swap entries.
+ * elf-bfd.h (MAX_INT_RELS_PER_EXT_REL): Define.
+ * elflink.h (elf_link_read_relocs_from_section): Consolidate REL and
+ RELA code.
+ (elf_link_adjust_relocs): Likewise. Don't malloc space for temp
+ reloc array, use a fixed size of MAX_INT_RELS_PER_EXT_REL.
+ (elf_link_output_relocs): Likewise.
+ (elf_reloc_link_order): Likewise.
+ (elf_finish_pointer_linker_section): Likewise.
+ (struct elf_link_sort_rela): Remove union.
+ (elf_link_sort_cmp1): Update to suit.
+ (elf_link_sort_cmp2): Here too.
+ (elf_link_sort_relocs): Consolidate REL and RELA code. Fix memory
+ over-allocation for int_rels_per_ext_rel != 1 case.
+ * elf32-arm.h: Update all bfd_elf32_swap_reloc_out calls.
+ * elf32-i386.c: Likewise.
+ * elf32-cris.c: Likewise for bfd_elf32_swap_reloca_out.
+ * elf32-hppa.c, elf32-i370.c, elf32-m68k.c, elf32-ppc.c, elf32-s390.c,
+ elf32-sh.c, elf32-vax.c, elfxx-mips.c: Likewise.
+ * elf64-alpha.c: Likewise for bfd_elf64_swap_reloca_out.
+ * elf64-hppa.c, elf64-mips.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c,
+ elf64-sparc.c, elf64-x86-64.c: Likewise.
+ * elfxx-ia64.c: Likewise for bfd_elfNN_swap_reloca_out.
+ * elfxx-mips.c (sort_dynamic_relocs): Likewise for
+ bfd_elf32_swap_reloc_in.
+
+ * elf32-arm.h: Update elf32_arm_info_to_howto calls.
+ * elf32-mips.c: Likewise for mips_info_to_howto_rel.
+ (mips_elf64_swap_reloc_in): Zero r_addend.
+ (mips_elf64_be_swap_reloc_in): Likewise.
+ (mips_elf64_slurp_one_reloc_table): Simplify.
+
+ * elf64-alpha.c (alpha_elf_size_info): Populate reloc swap entries.
+ * elf64-hppa.c (hppa64_elf_size_info): Likewise.
+ * elf64-sparc.c (sparc64_elf_size_info): Likewise.
+
+2002-11-28 Kaz Kojima <kkojima@rr.iij4u.or.jp>
+
+ * elf32-sh.c (sh_elf_relocate_section): Don't complain about
+ unresolved debugging relocs in dynamic applications.
+ * elf64-sh64.c (sh_elf64_relocate_section): Likewise.
+
+2002-11-26 Alan Modra <amodra@bigpond.net.au>
+
+ * elf-eh-frame.c (ENSURE_NO_RELOCS): Disregard R_*_NONE relocs.
+ (_bfd_elf_discard_section_eh_frame): Don't discard duplicate CIEs
+ on a relocatable link. Comment typos.
+ * elf.c (_bfd_elf_link_hash_newfunc): Assign elements of structure
+ in the order they are declared. Clear elf_hash_value too.
+ (_bfd_elf_link_hash_table_init): Likewise assign in order. Clear
+ eh_info and tls_segment.
+ * elflink.h (elf_link_input_bfd <emit_relocs>): Keep reloc offsets
+ sorted when discarding relocs by turning them into R_*_NONE.
+
+ * libbfd.c (warn_deprecated): Comment spelling.
+ * po/SRC-POTFILES.in: Regenerate.
+
+2002-11-21 Richard Henderson <rth@redhat.com>
+
+ * elflink.h (elf_link_add_object_symbols): Don't overwrite the
+ arch's st_other bits when merging visibilities.
+ (elf_link_output_extsym): Tidy clearing of visibility field.
+
+2002-11-21 Alan Modra <amodra@bigpond.net.au>
+
+ * coff-mcore.c (SWAP_IN_RELOC_OFFSET): Define.
+ (SWAP_OUT_RELOC_OFFSET): Define.
+
+2002-11-20 Alexandre Oliva <aoliva@redhat.com>
+
+ * elf.c (_bfd_elf_link_hash_table_init): Make sure
+ can_refcount is properly extended to the type of
+ init_refcount.
+
+2002-11-19 Alexandre Oliva <aoliva@redhat.com>
+
+ * elfxx-mips.c (MIPS_RELOC_RELA_P): New macro.
+ (_bfd_mips_elf_relocate_section): Use it.
+
+ * elfxx-mips.c (MNAME): New macro.
+ (_bfd_mips_elf_check_relocs): Use it.
+ (_bfd_mips_elf_discard_info): Likewise.
+ (_bfd_mips_elf_final_link): Likewise.
+
+2002-11-19 Alan Modra <amodra@bigpond.net.au>
+
+ * elf64-ppc.c (ppc64_elf_edit_opd): When deleting relocs, adjust
+ rel_hdr.sh_size too.
+
+2002-11-18 Klee Dienes <kdienes@apple.com>
+
+ * Makefile.am (BFD32_LIBS): Add bfdwin.lo, bfdio.lo.
+ (BFD32_LIBS_CFILES): Add bfdwin.c, bfdio.c.
+ (BFD_H_FILES): Add bfdwin.c, bfdio.c.
+ (LIBBFD_H_FILES): Add bfdwin.c, bfdio.c.
+ Add dependencies for bfdwin.c, bfdio.c.
+ * bfd.c: Remove bfd_get_mtime, bfd_get_size.
+ * libbfd.c: Remove real_read, bfd_bread, _bfd_window_internal,
+ bfd_init_window, bfd_free_window, bfd_get_file_window, bfd_bwrite,
+ bfd_tell, bfd_flush, bfd_stat, bfd_seek.
+ * bfdio.c: New file. Contains real_read, bfd_bread, bfd_write,
+ bfd_tell, bfd_flush, bfd_stat, bfd_seek, bfd_ge_mtime,
+ bfd_get_size (moved from libbfd.c and bfd.c).
+ * bfdwin.c New file. Contains _bfd_window_internal,
+ bfd_init_window, bfd_free_window, bfd_get_file_window (moved from
+ libbfd.c and bfd.c).
+ * po/SRC-POTFILES.in: Regenerate.
+ * po/bfd.pot: Regenerate.
+ * libbfd.h: Regenerate.
+ * bfd-in2.h: Regenerate.
+ * aclocal.m4: Regenerate.
+ * Makefile.in: Regenerate.
+ * configure: Regenerate.
+
+2002-11-18 Klee Dienes <kdienes@apple.com>
+
+ * bfd.c (bfd_preserve_save): Don't zero BFD_IN_MEMORY.
+
+2002-11-15 Kazu Hirata <kazu@cs.umass.edu>
+
+ * coff-h8300.c (h8300_reloc16_estimate): Do not optimize away
+ jsr after a short jump.
+ * elf32-h8300.c (elf32_h8_relax_section): Likewise.
+
+2002-11-15 Klee Dienes <kdienes@apple.com>
+
+ * pef.c (bfd_pef_convert_architecture): Move declaration of
+ ARCH_POWERPC and ARCH_M68K to the start of the function.
+
+2002-11-14 Svein E. Seldal <Svein.Seldal@solidas.com>
+
+ * coff-tic4x.c (tic4x_howto_table): Formatting fixup
+
+2002-11-14 Hans-Peter Nilsson <hp@bitrange.com>
+
+ * elf64-mmix.c (_bfd_mmix_finalize_linker_allocated_gregs):
+ For bpo_gregs_section->contents, allocate _raw_size, not
+ _cooked_size.
+
+2002-11-13 Klee Dienes <kdienes@apple.com>
+
+ * config.bfd: Add entries for powerpc-*-darwin and cousins.
+
+2002-11-13 H.J. Lu <hjl@gnu.org>
+
+ * elfcode.h (elf_object_p): Don't restore abfd->arch_info.
+
+2002-11-13 Klee Dienes <kdienes@apple.com>
+ Alan Modra <amodra@bigpond.net.au>
+
+ * bfd.c (struct bfd_preserve): New.
+ (bfd_preserve_save): New function.
+ (bfd_preserve_restore): Ditto.
+ (bfd_preserve_finish): Ditto.
+ * bfd-in2.h: Regenerate.
+ * mach-o.c: Formatting.
+ (bfd_mach_o_scan_read_symtab_symbol): Make "value" unsigned.
+ (bfd_mach_o_object_p): Use bfd_preserve_save/restore/finish.
+ (bfd_mach_o_core_p): Ditto.
+ (bfd_mach_o_scan): Pass in mdata.
+ * mach-o.h (bfd_mach_o_scan): Update prototype.
+ * pef.c: Formatting.
+ (bfd_pef_object_p): Use bfd_preserve_save/restore/finish.
+ (bfd_pef_xlib_object_p): Ditto.
+ (bfd_pef_scan): Pass in mdata. Move version check to bfd_pef_object_p.
+ * pef.h (bfd_pef_scan): Update prototype.
+ * xsym.c: Formatting, K&R fixes.
+ (bfd_sym_object_p): Use bfd_preserve_save/restore/finish.
+ (bfd_sym_scan): New function split out from bfd_sym_object_p.
+ * xsym.h (bfd_sym_scan): Declare.
+ * elfcode.h (elf_object_p): Use bfd_preserve_save/restore/finish.
+ * elfcore.h (elf_core_file_p): Likewise.
+ * targets.c (_bfd_target_vector): Revert 2002-11-08 change.
+
+2002-11-12 Nick Clifton <nickc@redhat.com>
+
+ * po/da.po: Updated Danish translation.
+
+2002-11-12 Alan Modra <amodra@bigpond.net.au>
+
+ * elflink.h (elf_link_add_object_symbols): Optimize stabs for
+ relocatable link too.
+ (elf_link_input_bfd): When emitting relocs, adjust offsets for
+ eh_frame and stab sections. Zap deleted relocs.
+ (elf_reloc_symbol_deleted_p): Return true for zero r_symndx.
+ (elf_bfd_discard_info): Run for relocatable link too.
+ * elf64-ppc.c (ppc64_elf_edit_opd): Rename from edit_opd. Make global.
+ Handle ld -r case.
+ (ppc64_elf_size_dynamic_sections): Don't call edit_opd from here.
+ * elf64-ppc.h (ppc64_elf_edit_opd): Declare.
+
+ * elf-bfd.h (struct cie_header): Move from elf_eh-frame.c.
+ (struct cie, struct eh_cie_fde, struct eh_frame_sec_info): Likewise.
+ (struct eh_frame_array_ent, struct eh_frame_hdr_info): Likewise.
+ (enum elf_link_info_type): Remove ELF_INFO_TYPE_EH_FRAME_HDR.
+ (struct eh_frame_hdr_info): Add "hdr_sec", remove "split".
+ (struct elf_link_hash_table): Add eh_info.
+ (struct elf_obj_tdata): Change eh_frame_hdr to an asection *.
+ (_bfd_elf_discard_section_eh_frame): Update prototype.
+ (_bfd_elf_discard_section_eh_frame_hdr): Likewise.
+ (_bfd_elf_write_section_eh_frame): Likewise.
+ (_bfd_elf_write_section_eh_frame_hdr): Likewise.
+ * elf-eh-frame.c (_bfd_elf_discard_section_eh_frame): Remove "ehdrsec"
+ param. Get "hdr_info" from link hash table.
+ (_bfd_elf_discard_section_eh_frame_hdr): Remove "sec" param. Get
+ header section from link hash table. Save header section to elf_tdata.
+ (_bfd_elf_maybe_strip_eh_frame_hdr): Remove local "sec". Use
+ header section from link hash table. Don't alloc hdr_info. Clear
+ hdr_sec instead of setting "strip".
+ (_bfd_elf_eh_frame_section_offset): Formatting.
+ (_bfd_elf_write_section_eh_frame): Remove "ehdrsec", add "info" param.
+ Get header section from link hash table.
+ (_bfd_elf_write_section_eh_frame_hdr): Remove "sec", add "info" param.
+ Get header section from link hash table.
+ * elf.c (map_sections_to_segments): Use cached eh_frame_hdr.
+ (get_program_header_size): Likewise.
+ (_bfd_elf_section_offset): Formatting.
+ * elflink.h (elf_link_create_dynamic_sections): Stash eh frame header
+ section pointer in link hash table.
+ (elf_bfd_final_link): Adjust _bfd_elf_write_section_eh_frame_hdr
+ and _bfd_elf_write_section_eh_frame calls. Update comment about
+ eh_frame entries.
+ (elf_bfd_discard_info): Adjust _bfd_elf_discard_section_eh_frame and
+ _bfd_elf_discard_section_eh_frame_hdr calls. Remove "ehdr".
+
+ * po/SRC-POTFILES.in: Regenerate.
+
+ * elf-eh-frame.c (_bfd_elf_discard_section_eh_frame): Don't zero
+ relocs for discarded FDEs. Remove dead code.
+ (_bfd_elf_write_section_eh_frame_hdr): Remove dead code.
+ * elflink.h (elf_bfd_discard_info): Don't save edited relocs.
+ Tidy conditions under which stabs are edited. Formatting.
+ * elf64-sparc.c (sparc64_elf_relocate_section): Ignore overflows
+ from discarded relocs.
+ * elfxx-ia64.c (elfNN_ia64_install_dyn_reloc): Add reloc output
+ section adjustments after testing magic values.
+
+2002-11-12 Thomas Moestl <tmm@FreeBSD.org>
+
+ * elf64-sparc.c (sparc64_elf_adjust_dynamic_symbol): Correct
+ references to large plt symbols.
+
+2002-11-12 Klee Dienes <kdienes@apple.com>
+
+ * mach-o.c (bfd_mach_o_scan_read_thread): Don't re-use 'i' when
+ looking for an unused section name.
+
+2002-11-11 Kazu Hirata <kazu@cs.umass.edu>
+
+ * coff-h8300.c: Fix formatting.
+ * elf32-h8300.c: Likewise.
+ * reloc16.c: Likewise.
+
+2002-11-09 Jeroen Dobbelaere <jeroen.dobbelaere@acunia.com>
+
+ * elf32-arm.h (elf32_arm_size_dynamic_sections): Don't strip output
+ section when dynamic section unused; _bfd_strip_section_from_output
+ instead.
+
+2002-11-08 Alan Modra <amodra@bigpond.net.au>
+
+ * targets.c (_bfd_target_vector): Disable pef_vec, pef_xlib_vec
+ and sym_vec.
+
+ * dwarf2.c: Revert last change.
+
+2002-11-07 Michal Ludvig <mludvig@suse.cz>
+
+ * dwarf2.c (read_indirect_string, read_abbrevs, decode_line_info,
+ _bfd_dwarf2_find_nearest_line): Use
+ bfd_simple_get_relocated_section_contents() instead of
+ bfd_get_section_contents().
+ * reloc.c (bfd_perform_relocation): Add sanity check.
+ * simple.c (simple_get_relocated_section_contents): If the section
+ does not have any relocs associated with it, just return the
+ unadjusted contents.
+
+2002-11-07 Hans-Peter Nilsson <hp@axis.com>
+
+ * elf32-cris.c (cris_elf_relocate_section) <case R_CRIS_16_GOT,
+ case R_CRIS_32_GOT>: Correct test for filling in constant .got
+ contents, enabling for a non-DSO, for symbols defined in the
+ program with --export-dynamic.
+
+2002-11-07 Alan Modra <amodra@bigpond.net.au>
+
+ * elf64-ppc.c: Comment typo fixes.
+ (ppc64_elf_merge_private_bfd_data): Allow BFD_ENDIAN_UNKNOWN input.
+
+2002-11-07 Nick Clifton <nickc@redhat.com>
+
+ * po/da.po: Updated Danish translation.
+
+2002-11-06 Alexandre Oliva <aoliva@redhat.com>
+
+ * elf64-mips.c (mips_elf64_slurp_one_reloc_table): Generate
+ exactly three internal relocs per external reloc. Set reloc_count
+ to the external reloc count.
+
+2002-11-06 Klee Dienes <kdienes@apple.com>
+
+ * coff-stgo32.c (stub_bytes): Mark as const.
+ Fix comment formatting.
+
+2002-11-06 Klee Dienes <kdienes@apple.com>
+
+ * Makefile.am (BFD32_BACKENDS): Add mach-o.lo, pef.lo, and
+ xsym.lo.
+ (BFD32_BACKENDS_CFILES): Add mach-o.c, pef.c, and xsym.c.
+ (SOURCE_HFILES): Add mach-o.h, pef.h, pef-traceback.h, xsym.h
+ * archures.c (enum bfd_architecture): Add bfd_arch_m98k.
+ * bfd.c (struct bfd): Add private data for mach-o, pef, and sym.
+ * targets.c (enum bfd_flavour): Add flavours for mach-o, pef, and
+ sym.
+ (_bfd_target_vector): Add target vectors for mach-o, pef, and sym.
+ * Makefile.in: Regenerate.
+ * doc/Makefile.in: Regenerate.
+ * bfd-in2.h: Regenerate.
+ * xsym.c: New file. Contains support for the Apple/Metrowerks
+ xSYM debugging format.
+ * xsym.h: New file.
+ * pef.c: New file. Contains support for the Apple Code Fragment
+ Manager Preferred Executable Format
+ * pef.h: New file.
+ * pef-traceback.h: New file. Contains support for parsing PowerPC
+ traceback tables as used by PEF executables (and perhaps other
+ systems as well).
+ * mach-o.c: New file. Contains support for the Mach-O object file
+ format.
+ * mach-o.h: New file.
+ * mach-o-target.c: New file. Declares the mach-o targets
+ themselves. Included three times by mach-o.c; each time with a
+ different set of macros set.
+
+2002-11-06 Graeme Peterson <gp@qnx.com>
+
+ * Makefile.am: Remove entries for elf32-qnx.[ch].
+ * Makefile.in: Regenerate.
+ * config.bfd: Change arm-nto to use bfd_elf32_{big|little}arm_vec,
+ ppc-nto to use bfd_elf32_powerpc{le}_vec, sh-nto to use
+ bfd_elf32_sh{l}_vec, and i386-nto to use bfd_elf32_i386_vec.
+ * configure.in: Remove support for bfd_elf32_sh{l}qnx_vec,
+ bfd_elf32_powerpc{le}qnx_vec, bfd_elf32_{big|little}armqnx_vec,
+ and bfd_elf32_i386qnx_vec, and removed elf32-qnx.lo from other targets.
+ bfd_elf32_sh{l}_vec, and i386-nto to use bfd_elf32_i386_vec.
+ * configure: Regenerate.
+ * elf32-qnx.c: Remove.
+ * elf32-qnx.h: Remove.
+ * elf.c: Remove calls to QNX specific set_nonloadable_filepos,
+ is_contained_by_filepos, and copy_private_bfd_data_p.
+ * elf-bfd.h (struct elf_backend_data): Remove set_nonloadable_filepos,
+ is_contained_by_filepos, and copy_private_bfd_data_p.
+ * elf32-i386.c: Remove QNX extended bfd support.
+ * elf32-ppc.c: Remove QNX extended bfd support.
+ * elf32-sh.c: Remove QNX extended bfd support.
+ * elfarm-nabi.c: Remove QNX extended bfd support.
+ * targets.c: Remove qnx vectors.
+ * elfxx-target.h (elf_backend_set_nonloadable_filepos): Remove
+ (elf_backend_is_contained_by_filepos): Remove.
+ (elf_backend_copy_private_bfd_data_p): Remove.
+ * po/SRC-POTFILES.in: Regenerate.
+
+2002-11-06 David O'Brien <obrien@FreeBSD.org>
+ Alan Modra <amodra@bigpond.net.au>
+
+ * elf64-sparc.c (sparc64_elf_relocate_section): Adjust addend of
+ dynamic relocs against section symbols for the output section vma.
+
+2002-11-05 Alan Modra <amodra@bigpond.net.au>
+
+ * elf32-arm.h (t2a1_push_insn, t2a2_ldr_insn, t2a3_mov_insn,
+ t2a4_bx_insn, t2a5_pop_insn, t2a6_bx_insn): Remove.
+
+2002-11-05 Kaz Kojima <kkojima@rr.iij4u.or.jp>
+ Alan Modra <amodra@bigpond.net.au>
+
+ * config.bfd (sh-*-linux*): Use bfd_elf*_sh64*lin_vec as sh64
+ vectors in target_selvecs.
+ (shle-*-netbsdelf*): Use bfd_elf*_sh64*nbsd_vec as sh64 vectors
+ in target_selvecs.
+ (sh-*-netbsdelf*): Likewise.
+ * configure.in (assocvecs): New variable. Handle assocvecs like
+ selvecs.
+ * configure: Regenerate.
+ * format.c (bfd_check_format_matches): Store bfd_target pointers
+ in matching_vector instead of target names. Select first target
+ from bfd_associated_vector that matches a list of ambiguous targets.
+ * targets.c (_bfd_associated_vector): New array.
+ (bfd_associated_vector): New variable.
+ (_bfd_target_vector): Add bfd_elf*_sh64*lin_vec.
+ * libbfd-in.h (bfd_associated_vector): Declare.
+ * libbfd.h: Regenerate.
+
+2002-11-05 Elias Athanasopoulos <eathan@otenet.gr>
+
+ * vms-gsd.c (_bfd_vms_write_gsd): Check that symbol->udata.p is
+ non-NULL before dereferencing.
+
+2002-11-04 Kaz Kojima <kkojima@rr.iij4u.or.jp>
+
+ * vms.c (vms_object_p): Restore the start address when returning
+ NULL.
+
+2002-11-04 Alan Modra <amodra@bigpond.net.au>
+ Hans-Peter Nilsson <hp@axis.com>
+
+ * elflink.h (struct elf_final_link_info): Add shndxbuf_size.
+ (elf_bfd_final_link): Don't bother zeroing symtab_hdr fields.
+ Set up a larger symshndxbuf, and write it out. Free it on
+ exit rather than freeing symbuf twice. Correct section index
+ on output section symbol loop.
+ (elf_link_output_sym): Accumulate symbol extension section
+ indices, reallocating symshndxbuf rather than writing it out.
+ (elf_link_flush_output_syms): Don't flush symshndxbuf.
+ * elf.c (assign_section_numbers): Init i_shdrp to all zero.
+ Use bfd_zalloc to clear i_shdrp[0] too.
+
+2002-11-03 Stephen Clarke <stephen.clarke@earthling.net>
+
+ * elf32-sh64-com.c (sh64_address_in_cranges): Use
+ _raw_size of cranges section if _cooked_size not yet set.
+
+2002-11-03 Hans-Peter Nilsson <hp@axis.com>
+
+ * elf32-v850.c (v850_elf_relax_delete_bytes): Correct parameters
+ for bfd_elf32_swap_symbol_out.
+
+2002-10-31 David O'Brien <obrien@FreeBSD.org>
+
+ * elf-eh-frame.c (_bfd_elf_discard_section_eh_frame): Don't mix
+ signed and unsigned in comparison.
+
+2002-10-30 Daniel Jacobowitz <drow@mvista.com>
+
+ * coffcode.h: Remove extraneous '\'.
+
+2002-10-28 H.J. Lu <hjl@gnu.org>
+
+ * Makefile.am (targets.lo): Depend on Makefile instead of
+ config.status.
+ (archures.lo): Likewise.
+ * Makefile.in: Regenerated.
+
+2002-10-25 Jason Thorpe <thorpej@wasabisystems.com>
+
+ * config.bfd (mips*el-*-netbsd*, mips*-*-netbsd*): Add
+ bfd_elf64_bigmips_vec and bfd_elf64_littlemips_vec to
+ targ_selvecs.
+
+2002-10-25 Jim Wilson <wilson@redhat.com>
+
+ * elf64-sh64.c (sh_elf64_relocate_section): Call
+ _bfd_elf_rela_local_sym. Handle relocs against STT_SECTION symbol
+ of SHF_MERGE section.
+
+2002-10-25 Hans-Peter Nilsson <hp@axis.com>
+
+ * simple.c: Correct placement of ATTRIBUTE_UNUSED.
+
+2002-10-24 John David Anglin <dave@hiauly1.hia.nrc.ca>
+
+ * aoutx.h (NAME(aout,swap_ext_reloc_in)): Cast bytes->r_index to
+ unsigned int. Cast RELOC_BASE10, RELOC_BASE13 and RELOC_BASE22 to
+ unsigned int.
+ (NAME(aout,final_link)): Cast enum used in assignment.
+ (aout_link_write_symbols): Cast enums in comparisons, int values to
+ boolean, enums in assignments to int.
+ (aout_link_input_section_std): Cast rel->r_index to unsigned int.
+ (aout_link_input_section_ext): Likewise. Cast enums used in
+ comparisons with unsigned ints.
+ (aout_link_reloc_link_order): Cast enum to int in assignment.
+ * archive.c (_bfd_generic_read_ar_hdr_mag): Cast result of memchr
+ calls to char *.
+ * bfd-in.h (bfd_set_section_vma): Cast enum true to unsigned int in
+ assignment.
+ * bfd-in2.h (bfd_set_section_vma): Likewise.
+ * bfd.c (bfd_record_phdr): Cast enums in assignments.
+ * binary.c (bfd_alloc): Cast enum to long.
+ * coffgen.c (_bfd_coff_is_local_label_name): Cast return to boolean.
+ * dwarf2.c (read_abbrevs): Add casts to enum types.
+ (read_attribute_value): Likewise.
+ (arange_add): Cast result of bfd_zalloc call.
+ (comp_unit_contains_address): Return true and false.
+ (comp_unit_find_nearest_line): Cast return to boolean.
+ * format.c (bfd_check_format_matches, bfd_set_format): Likewise.
+ * gen-aout.c: define macro '_' if not defined.
+ * libbfd.c (bfd_realloc): Cast malloc and realloc to PTR.
+ (bfd_bwrite): Cast bfd_realloc to bfd_byte *.
+ (bfd_write_bigendian_4byte_int): Cast return to boolean.
+ (bfd_seek): Cast bfd_realloc to bfd_byte *.
+ (bfd_generic_is_local_label_name): Cast return to boolean.
+ * libcoff.h (_bfd_coff_adjust_symndx): Remove extraneous '\'.
+ * linker.c (_bfd_link_hash_newfunc): Cast bfd_hash_allocate result to
+ struct bfd_hash_entry *.
+ (_bfd_generic_link_hash_newfunc): likewise.
+ (_bfd_generic_final_link): Cast enum to unsigned int.
+ * merge.c (sec_merge_emit): Cast return to boolean.
+ (merge_strings): Add casts to const unsigned char *.
+ * reloc.c (bfd_get_reloc_code_name): Cast enums in comparison to int.
+ (bfd_generic_get_relocated_section_content): Cast enum to unsigned int.
+ * section.c (bfd_section_hash_newfunc): Cast bfd_hash_allocate result
+ to struct bfd_hash_entry *.
+ (bfd_set_section_content): Add cast to PTR in comparison.
+ * simple.c (simple_dummy_warning, simple_dummy_undefined_symbol,
+ simple_dummy_reloc_overflow, simple_dummy_reloc_dangerous,
+ simple_dummy_unattached_reloc,
+ bfd_simple_get_relocated_section_contents): Add K&R declarations and
+ function definitions.
+ * srec.c (S3Forced): Initialize to false.
+ (srec_get_symtab): Cast return value from bfd_alloc to asymbol *.
+ * stabs.c (_bfd_link_section_stabs): Cast enum to int in comparisons.
+ (_bfd_discard_section_stabs): Likewise. Also cast return to boolean.
+ * syms.c (bfd_is_undefined_symclass): Cast return to boolean.
+ (_bfd_stab_section_find_nearest_line): Cast enum to bfd_byte in
+ comparisons.
+
+2002-10-23 Jakub Jelinek <jakub@redhat.com>
+
+ * elf64-alpha.c (elf64_alpha_check_relocs): Only put maybe_dynamic
+ relocs into shared lib non-allocated reloc sections.
+
+2002-10-23 Nathan Tallent <eraxxon@alumni.rice.edu>
+
+ * dwarf2.c (add_line_info): Ensure that the line_info_table is
+ sorted even when given an out-of-order line sequence.
+ (lookup_address_in_line_info_table): When an exact VMA match is
+ not found, return line information with the closest VMA.
+
+2002-10-23 Ross Alexander <ross.alexander@uk.neceur.com>
+
+ * elf64-hppa.c: Force DT_FLAGS to always be set. Required by
+ HPUX 11.00 patch PHSS_26559.
+
+2002-10-22 Alexandre Oliva <aoliva@redhat.com>
+
+ * elfxx-mips.c (_bfd_mips_elf_modify_segment_map): Don't move
+ the options section into a separate section unless IRIX 6
+ compatibility is enabled.
+
+2002-10-22 Alexandre Oliva <aoliva@redhat.com>
+
+ * elflink.h (struct elf_link_sort_rela): Turn rel and rela
+ into arrays.
+ (elf_link_sort_cmp1, elf_link_sort_cmp2): Adjust.
+ (elf_link_sort_relocs): Likewise. Take int_rels_per_ext_rel
+ into account.
+ * elfxx-mips.c (mips_elf_create_dynamic_relocation): Compose
+ R_MIPS_REL32 with R_MIPS64 if ABI_64_P.
+
+2002-10-21 Graeme Peterson <gp@qnx.com>
+
+ * targets.c (_bfd_target_vector): Add missing qnx vectors.
+
+2002-10-21 Alan Modra <amodra@bigpond.net.au>
+
+ * targets.c (bfd_target_list): Don't return the default target twice.
+
+2002-10-21 Elias Athanasopoulos <eathan@otenet.gr>
+
+ * archive.c (_bfd_archive_bsd_update_armap_timestamp): Replace
+ perror with bfd_perror.
+
+2002-10-19 H.J. Lu <hjl@gnu.org>
+
+ * elflink.h (elf_link_add_object_symbols): Correctly handle
+ DT_RPATH and DT_RUNPATH.
+
+2002-10-19 Mark Kettenis <kettenis@gnu.org>
+
+ * elf.c (elfcore_grok_note): Fix recognition on NT_PRXFPREG notes.
+
+2002-10-17 Denis Chertykov <denisc@overta.ru>
+
+ * elf32-ip2k.c (ELF_MACHINE_ALT1): Define alternate machine code
+ for ip2k port.
+
+2002-10-17 Alan Modra <amodra@bigpond.net.au>
+
+ * elfxx-target.h (USE_REL): Don't define as 1.
+ * elf32-arm.h (USE_REL): Provide a default define of 0.
+ Use #if rather than #ifdef when testing USE_REL.
+ * elf32-m32r.c: Likewise.
+
+ * elf32-arc.c (USE_REL): Define as 1.
+ * elf32-d10v.c (USE_REL): Likewise.
+ * elf32-m32r.c (USE_REL): Likewise.
+ * elf32-m68hc11.c (USE_REL): Likewise.
+ * elf32-m68hc12.c (USE_REL): Likewise.
+ * elf32-or32.c (USE_REL): Likewise.
+ * elfarm-nabi.c (USE_REL): Likewise.
+
+2002-10-16 Jakub Jelinek <jakub@redhat.com>
+
+ * config.bfd (s390-*-linux*): Add targ64_selvecs.
+ (s390x-*-linux*): Add targ_selvecs.
+
+2002-10-16 Alan Modra <amodra@bigpond.net.au>
+
+ * Makefile.am (BFD32_BACKENDS): Remove elfarmqnx-nabi.lo,
+ elf32-i386-fbsd.lo, elf32-i386qnx.lo, elf32-ppcqnx.lo,
+ elf32-sh-lin.lo, elf32-sh64-lin.lo, elf32-sh-nbsd.lo,
+ elf32-sh64-nbsd.lo, elf32-shqnx.lo. Add elf32-qnx.lo.
+ (BFD32_BACKENDS_CFILES): Likewise for corresponding C files.
+ (BFD64_BACKENDS): Remove elf64-sh64-lin.lo, elf64-sh64-nbsd.lo.
+ (BFD64_BACKENDS_CFILES): Likewise for corresponding C files.
+ (SOURCE_HFILES): Add elf32-qnx.h.
+ (BUILD_HFILES): Add bfdver.h.
+ Run "make dep-am".
+ * Makefile.in: Regenerate.
+ * configure.in Update bfd vector dependencies.
+ * configure: Regenerate.
+ * elf32-i386-fbsd.c: Delete. Move code to elf32-i386.c.
+ * elf32-i386qnx.c: Likewise.
+ * elf32-ppcqnx.c: Delete. Move code to elf32-ppc.c.
+ * elf32-sh-nbsd.c: Delete. Move code to elf32-sh.c.
+ * elf32-sh-lin.c: Likewise.
+ * elf32-shqnx.c: Likewise.
+ * elf32-sh64-lin.c: Delete. Move code to elf32-sh64.c.
+ * elf32-sh64-nbsd.c: Likewise.
+ * elf64-sh64-lin.c: Delete. Move code to elf64-sh64.c.
+ * elf64-sh64-nbsd.c: Likewise.
+ * elfarmqnx-nabi.c: Delete. Move code to elfarm-nabi.c.
+ * elf32-arm.h (ELF_MAXPAGESIZE): Always define.
+ * elf32-i386.c: Remove ELF_ARCH and ELF32_I386_C_INCLUDED tests.
+ * elf32-ppc.c: Remove ELF32_PPC_C_INCLUDED tests.
+ * elf32-qnx.h (elf_backend_set_nonloadable_filepos): Always define.
+ (elf_backend_is_contained_by_filepos): Likewise.
+ (elf_backend_copy_private_bfd_data_p): Likewise.
+ Globalize and move functions to..
+ * elf32-qnx.c: ..here. New file.
+ * elf32-sh.c: Remove ELF_ARCH and ELF32_SH_C_INCLUDED tests. Don't
+ emit target vectors when INCLUDE_SHMEDIA.
+ * elf32-sh64.c: Remove ELF_ARCH test. Move TARGET_* etc. defines to
+ end of file.
+ * elf64-sh64.c: Remove ELF_ARCH test.
+ * elfarm-nabi.c: Remove ELFARM_NABI_C_INCLUDED test.
+ * po/BLD-POTFILES.in: Regenerate.
+ * po/SRC-POTFILES.in: Regenerate.
+
+2002-10-16 Alan Modra <amodra@bigpond.net.au>
+
+ * elflink.h (elf_link_add_object_symbols): Error out on dynamic objects
+ loaded with --just-symbols.
+
+ * elf32-i386qnx.c (TARGET_LITTLE_NAME): Define.
+ * elf32-ppcqnx.c (TARGET_LITTLE_NAME, TARGET_BIG_NAME): Define.
+ * elf32-shqnx.c (TARGET_LITTLE_NAME, TARGET_BIG_NAME): Define.
+ * elfarmqnx-nabi.c (TARGET_LITTLE_NAME, TARGET_BIG_NAME): Define.
+
+2002-10-15 Richard Henderson <rth@redhat.com>
+
+ * Makefile.am (BFD64_BACKENDS): Remove elf64-alpha-fbsd.
+ (BFD64_BACKENDS_CFILES): Likewise.
+ * configure.in (bfd_elf64_alpha_freebsd_vec): Use elf64-alpha.
+ * elf64-alpha-fbsd.c: Remove file, move code ...
+ * elf64-alpha.c: ... here.
+ * Makefile.in, configure: Rebuild.
+
+2002-10-14 Richard Henderson <rth@redhat.com>
+
+ * elf64-alpha.c (elf64_alpha_relocate_section) [BRSGP]: Increment
+ VALUE, not ADDEND.
+
+2002-10-14 Stephen Clarke <stephen.clarke@superh.com>
+
+ * elf32-sh.c (elf_sh_link_hash_entry): Replace
+ datalabel_got_offset with union of datalabel_got
+ offset and refcount.
+ (sh_elf_link_hash_newfunc): Initialize datalabel_got.refcount.
+ (allocate_dynrelocs): Delete unnecessary code for
+ STT_DATALABEL type. Create entry in got for
+ datalabel version of symbol if datalabel_got.refcount > 0.
+ (sh_elf_relocate_section): Use datalabel_got union.
+ (sh_elf_gc_sweep_hook): Pull common code to initialize
+ h and eh out of switch statement. Declare seen_stt_datalabel.
+ Initialize it. Decrement datalabel_got.refcount for
+ got relocs when seen_stt_datalabel is true.
+ Decrement local_got_refcounts entry for datalabel got relocs
+ of local symbols.
+ (sh_elf_copy_indirect_symbol): Copy datalabel_got field over.
+ (sh_elf_check_relocs): Declare seen_stt_datalabel.
+ Initialize it. When seen_stt_datalabel is true, increment
+ datalabel_got refcount rather than got.refcount.
+ (sh_elf_finish_dynamic_symbol): Create relocs to
+ initialize got entry for datalabel version of symbol.
+
+2002-10-14 Alan Modra <amodra@bigpond.net.au>
+
+ * Makefile.am: Run "make dep-am".
+ (BFD_H_FILES): Remove version.h.
+ * bfd-in.h (BFD_VERSION, BFD_VERSION_DATE, BFD_VERSION_STRING): Move..
+ * version.h: ..to here.
+ * configure.in (bfd_version_date): Remove.
+ (AC_OUTPUT): Make bfdver.h from version.h.
+ * bfd.c: #include "bfdver.h".
+ * vms-hdr.c: Likewise.
+ * Makefile.in: Regenerate.
+ * bfd-in2.h: Regenerate.
+ * configure: Regenerate.
+ * po/SRC-POTFILES.in: Regenerate.
+
+2002-10-14 Alan Modra <amodra@bigpond.net.au>
+
+ * archures.c (bfd_mach_i386_i386, bfd_mach_i386_i8086,
+ bfd_mach_i386_i386_intel_syntax, bfd_mach_x86_64,
+ bfd_mach_x86_64_intel_syntax bfd_mach_ppc, bfd_mach_ppc64,
+ bfd_mach_rs6k, bfd_mach_d10v, bfd_mach_sh, bfd_mach_v850,
+ bfd_mach_arc_5, bfd_mach_arc_6, bfd_mach_arc_7, bfd_mach_arc_8,
+ bfd_mach_m32r, bfd_mach_frv, bfd_mach_frvsimple,
+ bfd_mach_ia64_elf64, bfd_mach_ia64_elf32,
+ bfd_mach_ip2022, bfd_mach_ip2022ext,
+ bfd_mach_s390_31, bfd_mach_s390_64, bfd_mach_xstormy16): Renumber.
+ * bfd-in2.h: Regenerate.
+
+2002-10-14 Kaz Kojima <kkojima@rr.iij4u.or.jp>
+
+ * config.bfd (sh*eb-*-linux*, sh*-*-linux*): Add the alternative
+ endian vector to targ_selvecs.
+
+2002-10-13 Alexandre Oliva <aoliva@redhat.com>
+
+ * elfxx-mips.c (mips_elf_calculate_relocation): Take
+ save_addend argument. Don't apply the 32-bit mask to a
+ GPREL32 value if it's to be used in another relocation. Don't
+ use forced-check computation of local_p to decide whether to
+ add gp0 to GPREL16 value. Don't use only the lowest 16 bits
+ of the addend of a non-in-place GPREL16 relocation.
+ (_bfd_mips_elf_relocate_section): Pass use_saved_addend_p to
+ mips_elf_calculate_relocation().
+
+2002-10-12 Stephane Carrez <stcarrez@nerim.fr>
+
+ * elf32-m68hc11.c (m68hc11_elf_relax_section): Don't treat relocs
+ with symbols in other sections if we relaxed something; the sections
+ output offsets must be re-computed before.
+
+2002-10-12 Stephane Carrez <stcarrez@nerim.fr>
+
+ * elf32-m68hc11.c (m68hc11_elf_relax_section): Update symbols
+ handling to use Elf_Internal_Sym.
+ (m68hc11_elf_relax_delete_bytes): Likewise.
+
+2002-10-11 Kaz Kojima <kkojima@rr.iij4u.or.jp>
+
+ * elf32-sh.c (sh_elf_optimized_tls_reloc, sh_elf_mkobject,
+ sh_elf_object_p, dtpoff_base): New functions.
+ (sh_elf_howto_table): Add TLS relocs.
+ (sh_reloc_map): Likewise.
+ (sh_elf_info_to_howto): Support TLS relocs.
+ (elf_sh_link_hash_entry): Add tls_type and tls_tpoff32.
+ (sh_elf_hash_entry, sh_elf_tdata, sh_elf_local_got_tls_type):
+ New macros.
+ (sh_elf_obj_tdata): New.
+ (elf_sh_link_hash_table): Add tls_ldm_got.
+ (sh_elf_link_hash_table_create): Clear refcount of tls_ldm_got.
+ (allocate_dynrelocs): Support TLS relocs.
+ (sh_elf_size_dynamic_sections): Likewise.
+ (sh_elf_relocate_section): Support TLS relocs. Don't try to find
+ .rela.got section when found already. Return false after printing
+ error about unresolvable relocation.
+ (sh_elf_gc_sweep_hook): Support TLS relocs.
+ (sh_elf_check_relocs): Likewise.
+ (sh_elf_finish_dynamic_symbol): Likewise.
+ (bfd_elf32_mkobject, elf_backend_object_p): Define for TLS case.
+ * reloc.c: Add SH TLS relocs.
+ * bfd-in2.h, libbfd.h: Regenerate.
+
+2002-10-11 Daniel Jacobowitz <drow@mvista.com>
+
+ * Makefile.in: Regenerated.
+
+2002-10-11 Daniel Jacobowitz <drow@mvista.com>
+
+ * Makefile.am: Run dep-am.
+ (BFD_H_DEP): Add simple.c and linker.c.
+ (BFD32_LIBS): Add simple.lo.
+ (BFD32_LIBS_CFILES): Add simple.c.
+ * Makefile.in: Regenerated.
+ * bfd-in2.h: Regenerated.
+ * simple.c: New file.
+
+2002-10-11 Alan Modra <amodra@bigpond.net.au>
+
+ * coff-arm.c (record_arm_to_thumb_glue): Avoid type-punned pointers.
+ (record_thumb_to_arm_glue): Likewise.
+ * ecoff.c (ecoff_link_add_externals): Likewise.
+ * elf32-arm.h (record_arm_to_thumb_glue): Likewise.
+ (record_thumb_to_arm_glue): Likewise.
+ * elf32-m32r.c (m32r_elf_add_symbol_hook): Likewise.
+ * elf32-sh.c (sh_elf_create_dynamic_sections): Likewise.
+ * elf32-sh64.c (sh64_elf_add_symbol_hook): Likewise.
+ * elf64-alpha.c (elf64_alpha_create_dynamic_sections): Likewise.
+ * elf64-ppc.c (func_desc_adjust): Likewise.
+ * elf64-sh64.c (sh64_elf64_add_symbol_hook): Likewise.
+ (sh64_elf64_create_dynamic_sections): Likewise.
+ * elflink.c (_bfd_elf_create_got_section): Likewise.
+ (_bfd_elf_create_dynamic_sections): Likewise.
+ (_bfd_elf_create_linker_section): Likewise.
+ * elflink.h (elf_add_default_symbol): Likewise.
+ (elf_link_create_dynamic_sections): Likewise.
+ (NAME(bfd_elf,size_dynamic_sections)): Likewise.
+ * elfxx-ia64.c (elfNN_ia64_aix_add_symbol_hook): Likewise.
+ * elfxx-mips.c (mips_elf_create_got_section): Likewise.
+ (_bfd_mips_elf_add_symbol_hook): Likewise.
+ (_bfd_mips_elf_create_dynamic_sections): Likewise.
+ * linker.c (generic_link_add_symbol_list): Likewise.
+ * xcofflink.c (xcoff_link_add_symbols): Likewise.
+
+ * elfxx-ia64.c (oor_brl, oor_ip): Conditionally define.
+
+ * elf64-ppc.c (edit_opd): Only zero opd syms when function is
+ completely removed. Correct local sym adjustment.
+
+2002-10-10 Stephen Clarke <stephen.clarke@superh.com>
+
+ * elf32-sh.c (elf_sh_pic_plt_entry_be, elf_sh_pic_plt_entry_le):
+ Correct mistake in calculation of address of .got.
+ * elf64-sh64.c (elf_sh64_pic_plt_entry_be,
+ elf_sh64_pic_plt_entry_le): Likewise.
+
+2002-10-09 Richard Shann <richard.shann@superh.com>
+ Stephen Clarke <stephen.clarke@superh.com>
+
+ * Makefile.am: Add entries for elf32-sh64-lin.c and
+ elf64-sh64-lin.c. Regenerate.
+ * Makefile.in: Regenerate.
+ * config.bfd: Change sh64eb-*-linux* and sh64-*-linux*
+ to use sh64 vectors rather than sh vectors.
+ * configure.in: Add bfd_elf32_sh64lin_vec, bfd_elf32_sh64blin_vec,
+ bfd_elf64_sh64lin_vec, bfd_elf64_sh64blin_vec.
+ * configure: Regenerate.
+ * elf32-sh64-lin.c: New file.
+ * elf64-sh64-lin.c: New file.
+ * targets.c: Add bfd_elf32_sh64lin_vec, bfd_elf32_sh64blin_vec,
+ bfd_elf64_sh64lin_vec, bfd_elf64_sh64blin_vec.
+
+2002-10-08 H.J. Lu <hjl@gnu.org>
+
+ * elf32-i386.c (elf_i386_relocate_section): Re-arrange the
+ IE->LE transition for R_386_TLS_IE.
+
+2002-10-08 Alan Modra <amodra@bigpond.net.au>
+
+ * elf64-ppc.c (edit_opd): Correct test for discarded sections.
+
+2002-10-07 Mark Elbrecht <snowball3@softhome.net>
+
+ * cofflink.c (mark_relocs): Don't mark relocations in excluded
+ sections.
+
+2002-10-07 Alan Modra <amodra@bigpond.net.au>
+
+ * elflink.h (elf_link_input_bfd): Remove BFD_VERSION_DATE dependent
+ code.
+
+ * elf64-ppc.c (ppc64_elf_build_stubs): Increment .glink indx.
+
+2002-10-06 Alan Modra <amodra@bigpond.net.au>
+
+ * opncls.c: Formatting.
+ (_bfd_new_bfd): Use a smaller section hash table.
+
+2002-10-05 Alexandre Oliva <aoliva@redhat.com>
+
+ * elfxx-mips.c (mips_elf_create_dynamic_relocation): Set the type
+ of the other two relocations packed with a REL32 to NONE.
+
+2002-10-02 Stephen Clarke <stephen.clarke@superh.com>
+
+ * elf32-sh.c (elf_sh_link_hash_entry): Add gotplt_refcount.
+ (sh_elf_link_hash_newfunc): Initialize it.
+ (allocate_dynrelocs): Transfer gotplt refs from plt.refcount
+ to got.refcount for symbols that are forced local or when
+ we have direct got refs.
+ (sh_elf_gc_sweep_hook): Adjust gotplt_refcount. Use it
+ to correctly adjust got.refcount and plt.refcount.
+ (sh_elf_copy_indirect_symbol): Copy gotplt_refcount across.
+ (sh_elf_check_relocs): Increment gotplt_refcount.
+
+2002-10-01 Jakub Jelinek <jakub@redhat.com>
+
+ * elf32-i386.c (elf_i386_relocate_section): Fix
+ movl foo@indntpoff, %eax IE->LE transition.
+
+2002-10-01 Jakub Jelinek <jakub@redhat.com>
+
+ * elf64-x86-64.c (elf64_x86_64_relocate_section): Change TLSGD
+ sequence and its transitions.
+
+2002-10-01 Jakub Jelinek <jakub@redhat.com>
+
+ * elf32-i386.c (elf_i386_relocate_section): Resolve R_386_TLS_LDO_32
+ to st_value + addend in non-code sections.
+ * elf64-x86-64.c (elf64_x86_64_relocate_section): Resolve
+ R_X86_64_DTPOFF32 to st_value + addend in non-code sections.
+
+2002-09-30 Gavin Romig-Koch <gavin@redhat.com>
+ Ken Raeburn <raeburn@cygnus.com>
+ Aldy Hernandez <aldyh@redhat.com>
+ Eric Christopher <echristo@redhat.com>
+ Richard Sandiford <rsandifo@redhat.com>
+
+ * archures.c (bfd_mach_mips4120, bfd_mach_mips5400): New.
+ (bfd_mach_mips5500): New.
+ * cpu-mips.c (I_mips4120, I_mips5400, I_mips5500): New.
+ (arch_info_struct): Add corresponding entries here.
+ * elfxx-mips.c (_bfd_elf_mips_mach): Handle E_MIPS_MACH_4120,
+ E_MIPS_MACH_5400 and E_MIPS_MACH_5500.
+ (_bfd_mips_elf_final_write_processing): Handle bfd_mach_mips4120,
+ bfd_mach_mips5400 and bfd_mach_mips5500.
+ (_bfd_mips_elf_mach_extends_p): New function.
+ (_bfd_mips_elf_merge_private_bfd_data): Use it to help merge
+ the EF_MIPS_MACH flags.
+ * bfd-in2.h: Regenerate.
+
+2002-09-28 Jason Thorpe <thorpej@wasabisystems.com>
+
+ * elf32-vax.c (elf_vax_size_dynamic_section): Don't strip
+ .got sections.
+
+2002-09-28 Alan Modra <amodra@bigpond.net.au>
+
+ * elf.c (map_sections_to_segments): Correct test for start of
+ writable section in the same page as end of read-only section.
+
+2002-09-27 Matt Thomas <matt@3am-software.com>
+
+ * elf32-vax.c (elf_vax_check_relocs): Remove unused
+ local_got_refcounts usage. Remove allocation of got slot.
+ (elf_vax_gc_sweep_hook): Remove unused local_got_refcounts usage.
+ Remove de-allocation of got slot.
+ (elf_vax_size_dynamic_section): Fix some indentation. Add hash
+ traversal for elf_vax_instantiate_got_entries. Allow empty .got
+ sections to be GC'ed.
+ (elf_vax_instantiate_got_entries): New function.
+ (elf_vax_relocate_section): Simplify R_VAX_GOT32 handling. Remove
+ tests that are now handled by elf_vax_instantiate_got_entries.
+ Assert GOT entry falls within .got section size. Remove redundant
+ comparisions. Fix comments.
+
+2002-09-27 Jakub Jelinek <jakub@redhat.com>
+
+ * reloc.c: Add x86-64 TLS relocs.
+ * bfd-in2.h, libbfd.h: Rebuilt.
+ * elf64-x86-64.c (x86_64_elf_howto): Fix size fields for 32-bit
+ relocs. Add TLS relocs.
+ (x86_64_reloc_map): Add TLS relocs.
+ (elf64_x86_64_info_to_howto): Adjust for added TLS relocs.
+ (struct elf64_x86_64_link_hash_entry): Add tls_type field.
+ (GOT_UNKNOWN, GOT_NORMAL, GOT_TLS_GD, GOT_TLS_IE): Define.
+ (elf64_x86_64_hash_entry): Define.
+ (struct elf64_x86_64_obj_tdata): New.
+ (elf64_x86_64_tdata, elf64_x86_64_local_got_tls_type): Define.
+ (struct elf64_x86_64_link_hash_table): Add tls_ld_got.
+ (link_hash_newfunc): Initialize tls_type.
+ (elf64_x86_64_link_hash_table_create): Initialize tls_ld_got.
+ (elf64_x86_64_copy_indirect_symbol): Swap tls_type if necessary.
+ (elf64_x86_64_mkobject): New.
+ (elf64_x86_64_elf_object_p): Allocate struct elf64_x86_64_obj_tdata.
+ (elf64_x86_64_tls_transition): New.
+ (elf64_x86_64_check_relocs): Add r_type variable and use it.
+ Handle TLS relocs.
+ (elf64_x86_64_gc_sweep_hook): Handle TLS relocs.
+ (allocate_dynrelocs): Allocate GOT space for TLS relocs.
+ (elf64_x86_64_size_dynamic_sections): Likewise.
+ (dtpoff_base, tpoff): New.
+ (elf64_x86_64_relocate_section): Handle TLS relocs.
+ (elf64_x86_64_finish_dynamic_symbol): Only handle non-TLS GOT
+ entries.
+ (bfd_elf64_mkobject): Define.
+
+ * elf32-i386.c (elf_i386_check_relocs) [R_386_TLS_LE]: Set
+ DF_STATIC_TLS if shared.
+
+2002-09-26 Thiemo Seufer <seufer@csv.ica.uni-stuttgart.de>
+
+ * elfxx-mips.c (_bfd_mips_elf_fake_sections): Don't emit unneeded
+ empty relocation sections.
+
+2002-09-26 Alan Modra <amodra@bigpond.net.au>
+
+ * elf64-ppc.c (ppc_build_one_stub): Don't build glink stubs here.
+ (ppc64_elf_build_stubs): Build them here instead.
+
+2002-09-24 Jakub Jelinek <jakub@redhat.com>
+
+ * elf32-sparc.c (elf32_sparc_relocate_section): Put R_SPARC_RELATIVE
+ addend into r_addend, not *r_offset.
+ (elf32_sparc_finish_dynamic_symbol): Likewise.
+ * elf64-sparc.c (sparc64_elf_finish_dynamic_symbol): Clear xword at
+ R_SPARC_RELATIVE's r_offset.
+
+2002-09-23 Nathan Tallent <eraxxon@alumni.rice.edu>
+
+ * dwarf2.c (decode_line_info): Update to correctly decode
+ the (non-standard DWARF2) out-of-order address sequences
+ generated by the Intel C++ 6.0 compiler for ia64-Linux.
+
+2002-09-23 Mark Elbrecht <snowball3@softhome.net>
+
+ * config.bfd: For DJGPP targets, match with any cpu and any machine.
+
+2002-09-23 Alan Modra <amodra@bigpond.net.au>
+
+ * elf-eh-frame.c (_bfd_elf_discard_section_eh_frame): Zero relocs
+ for discarded FDEs. Remove redundant assignment.
+ * elflink.h (elf_bfd_discard_info): Save edited relocs.
+
+2002-09-22 H.J. Lu <hjl@gnu.org>
+
+ * elf64-alpha.c (elf64_alpha_merge_ind_symbols): Don't merge
+ the relocation count between different .reloc sections.
+
+2002-09-21 Alan Modra <amodra@bigpond.net.au>
+
+ * elf32-ppc.c (ppc_elf_relocate_section): Allow ".sbss.*" and
+ ".sdata.*" for R_PPC_SDAREL16, ".sbss2*" and ".sdata2*" for
+ R_PPC_EMB_SDA2REL. Similarly for R_PPC_EMB_SDA21 and
+ R_PPC_EMB_RELSDA.
+
+ * elfcode.h (elf_slurp_reloc_table_from_section): Make "symcount"
+ unsigned. Move "symcount" assignment out of loop.
+ * Makefile.am: Run "make dep-am".
+ * Makefile.in: Regenerate.
+ * configure: Regenerate.
+ * po/SRC-POTFILES.in: Regnerate.
+
+2002-09-19 Nathan Tallent <eraxxon@alumni.rice.edu>
+
+ * dwarf2.c (_bfd_dwarf2_find_nearest_line): If address length is
+ zero, set it to 8 for (non-standard) 64-bit DWARF2 formats
+ (e.g. IRIX64).
+
+2002-09-19 Jakub Jelinek <jakub@redhat.com>
+
+ * elf32-ppc.c (ppc_elf_finish_dynamic_symbol): Clear .got word
+ even if generating R_PPC_RELATIVE reloc.
+ (ppc_elf_relocate_section): Make sure relocation is performed
+ if skip == -2. Clear memory at r_offset when creating dynamic
+ relocation.
+
+2002-09-19 Jakub Jelinek <jakub@redhat.com>
+
+ * reloc.c (BFD_RELOC_386_TLS_TPOFF, BFD_RELOC_386_TLS_IE,
+ BFD_RELOC_386_TLS_GOTIE): Add.
+ * bfd-in2.h, libbfd.h: Rebuilt.
+ * elf32-i386.c (elf_howto_table): Add R_386_TLS_TPOFF, R_386_TLS_IE
+ and R_386_TLS_GOTIE.
+ (elf_i386_reloc_type_lookup): Handle it.
+ (struct elf_i386_link_hash_entry): Change tls_type type to unsigned
+ char instead of enum, change GOT_* into defines.
+ (GOT_TLS_IE_POS, GOT_TLS_IE_NEG, GOT_TLS_IE_BOTH): Define.
+ (elf_i386_tls_transition): Handle R_386_TLS_IE and R_386_TLS_GOTIE.
+ (elf_i386_check_relocs): Likewise. Avoid crash if local symbol is
+ accessed both as normal and TLS symbol. Move R_386_TLS_LDM and
+ R_386_PLT32 cases so that R_386_TLS_IE can fall through.
+ Handle R_386_TLS_LE_32 and R_386_TLS_LE in shared libs.
+ (elf_i386_gc_sweep_hook): Handle R_386_TLS_IE and R_386_TLS_GOTIE.
+ Handle R_386_TLS_LE_32 and R_386_TLS_LE in shared libs.
+ (allocate_dynrelocs): Allocate 2 .got and 2 .rel.got entries if
+ tls_type is GOT_TLS_IE_BOTH.
+ (elf_i386_size_dynamic_sections): Likewise.
+ (elf_i386_relocate_section): Handle R_386_TLS_IE and R_386_TLS_GOTIE.
+ Handle R_386_TLS_LE_32 and R_386_TLS_LE in shared libs.
+ (elf_i386_finish_dynamic_symbol): Use tls_type & GOT_TLS_IE to catch
+ all 4 GOT_TLS_* TLS types.
+
+2002-09-19 Nick Clifton <nickc@redhat.com>
+
+ * elflink.h (elf_fix_symbol_flags): When examining weak symbols,
+ follow indirect links.
+
+2002-09-19 Nathan Tallent <eraxxon@alumni.rice.edu>
+
+ * ecoffswap.h (ecoff_swap_pdr_in) <isym, iline>: Update to
+ correctly sign-extend 32-bit ECOFF null values (0xffffffff, -1)
+ on 64 bit machines.
+ (ecoff_swap_sym_in) <iss>: Likewise.
+ * ecoff.c (_bfd_ecoff_slurp_symbolic_info): Fix error reading
+ ECOFF information: 'ioptMax' refers to the actual *size*
+ of the optimization symtab, not the number of entries.
+
+2002-09-19 Daniel Jacobowitz <drow@mvista.com>
+
+ * elf32-arm.h (elf32_arm_adjust_dynamic_symbol): Update
+ ELF_LINK_HASH_NEEDS_PLT logic.
+
+2002-09-18 Daniel Jacobowitz <drow@mvista.com>
+
+ * elfcode.h (elf_slurp_reloc_table_from_section): Check
+ correct relocation count.
+
+2002-09-17 Daniel Jacobowitz <drow@mvista.com>
+
+ * bfd-in.h (bfd_get_dynamic_symcount): Define.
+ * bfd.c (struct _bfd): Add dynsymcount.
+ * bfd-in2.h: Regenerated.
+ * elf.c (_bfd_elf_canonicalize_dynamic_symtab): Set
+ abfd->dynsymcount.
+ * elfcode.h (elf_slurp_reloc_table_from_section): Check
+ for overflow.
+
+2002-09-17 Stan Cox <scox@redhat.com>
+
+ * elf64-mips.c (mips_elf64_be_swap_reloca_out): Handle type2 and type3.
+ (mips_elf64_final_gp): Don't make up gp value.
+ * elfn32-mips.c (mips_elf_final_gp): Likewise.
+ * elfxx-mips.c (_bfd_mips_elf_final_link): Always create
+ .MIPS.options/.options section.
+
+2002-09-17 David O'Brien <obrien@FreeBSD.org>
+
+ * elf32-i386-fbsd.c: Always label using the EI_OSABI method.
+ It is benign for FreeBSD < 4.1. Minor reformatting.
+ * elf64-alpha-fbsd.c: Likewise.
+
+2002-09-17 Jakub Jelinek <jakub@redhat.com>
+
+ * elf32-i386.c (elf_i386_relocate_section) [R_386_TLS_TPOFF32]: Negate
+ addend.
+
+2002-09-17 Alan Modra <amodra@bigpond.net.au>
+
+ * elf64-alpha.c (alpha_elf_size_info): Make static.
+
+2002-09-17 Svein E. Seldal <Svein.Seldal@solidas.com>
+
+ * coff-tic4x.c: Add function declarations and ATTRIBUTE_UNUSED.
+ * cpu-tic4x.c: Ditto.
+
+2002-09-17 Thiemo Seufer <seufer@csv.ica.uni-stuttgart.de>
+
+ * elf64-mips.c (define elf_backend_ignore_discarded_relocs): Remove
+ duplicate define.
+
+2002-09-16 Bruno Haible <bruno@clisp.org>
+
+ * elf32-i386.c: Don't defined ELF_ARCH etc. if this file is included
+ by a target variant implementation.
+ * elf64-alpha.c: Likewise.
+ * elf32-i386-fbsd.c: New file.
+ * elf64-alpha-fbsd.c: New file.
+ * targets.c: Support bfd_elf32_i386_freebsd_vec and
+ bfd_elf64_alpha_freebsd_vec.
+ * configure.in: Accept the vectors bfd_elf32_i386_freebsd_vec,
+ bfd_elf64_alpha_freebsd_vec.
+ * Makefile.am (BFD32_BACKENDS): Add elf32-i386-fbsd.lo.
+ (BFD32_BACKENDS_CFILES): Add elf32-i386-fbsd.c.
+ (BFD64_BACKENDS): Add elf64-alpha-fbsd.lo.
+ (BFD64_BACKENDS_CFILES): Add elf64-alpha-fbsd.c.
+ (elf32-i386-fbsd.lo, elf64-alpha-fbsd.lo): Add dependencies.
+ * config.bfd: For FreeBSD targets, set targ_defvec to a FreeBSD
+ specific targets. Define OLD_FREEBSD_ABI_LABEL if appropriate.
+
+2002-09-12 Jakub Jelinek <jakub@redhat.com>
+
+ * elf32-i386.c (dtpoff_base, tpoff): Don't crash if tls_segment is
+ NULL.
+ (elf_i386_relocate_section): Return false after printing error about
+ unresolvable relocation.
+
+2002-09-12 Nick Clifton <nickc@redhat.com>
+
+ * elf32-arm.h (elf32_arm_final_link_relocate): Fix handling of
+ R_ARM_THM_PC11.
+
+2002-09-11 Jeffrey Law <law@redhat.com>
+
+ * elf32-h8300.c (elf32_h8_relax_section): Fix typo.
+
+2002-09-11 Andrew Haley <aph@cambridge.redhat.com>
+
+ * elf.c (_bfd_elf_find_nearest_line): Check functionname_ptr and
+ line_ptr before deciding we've found a symbol.
+
+2002-09-11 Nick Clifton <nickc@redhat.com>
+
+ * po/da.po: New Danish translation file.
+ * configure.in (LINGUAS): Add 'da'.
+ * configure: Regenerate.
+
+2002-09-10 Michael Snyder <msnyder@redhat.com>
+
+ * irix-core.c (do_sections, do_sections64): New functions.
+ (irix_core_core_file_p): Call new functions do_sections,
+ do_sections64, depending on corefile (32-bit or 64-bit).
+
+2002-09-09 Richard Henderson <rth@redhat.com>
+
+ * elfxx-ia64.c (elfNN_ia64_relax_section): Handle PCREL21M
+ and PCREL21F like PCREL21B.
+
+2002-09-04 Kevin Buettner <kevinb@redhat.com>
+
+ * config.bfd (mips*-*-irix6*): Add new ABI vectors. Make n32 default
+ vector.
+
+2002-09-02 Nick Clifton <nickc@redhat.com>
+
+ * elf32-v850.c (v850_elf_final_link_relocate): Use helpful
+ names instead of cryptically overloaded bfd_reloc error
+ codes.
+ (v850_elf_relocate_section): Likewise.
+ (v850_elf_relax_section): Replace caching of external symbols
+ with caching of internal symbols obtained from calling
+ bfd_elf_get_elf_syms().
+ Fixup problems with freeing cached allocated memory blocks.
+
+2002-09-02 Alan Modra <amodra@bigpond.net.au>
+
+ * cpu-pj.c (scan_mach, compatible, arch_info_struct): Remove.
+ (bfd_pj_arch): Use bfd_default_scan.
+ * cpu-v850.c (scan): Remove.
+ (N): Use bfd_default_scan.
+ * cpu-z8k.c (scan_mach): Remove.
+ (arch_info_struct, bfd_z8k_arch): Reorganize so that the default is
+ first. Use bfd_default_scan.
+
+ * ecoff.c (_bfd_ecoff_set_arch_mach_hook): Don't use hard-coded
+ bfd_mach constants.
+ (ecoff_get_magic): Likewise.
+ * elf32-v850.c (v850_elf_object_p): Likewise.
+ (v850_elf_final_write_processing): Likewise.
+ * mipsbsd.c (MY(set_arch_mach)): Likewise.
+ (MY(write_object_contents)): Likewise.
+ * coff64-rs6000.c (xcoff64_write_object_contents): Likewise.
+ * coffcode.h (coff_write_object_contents): Likewise.
+ (coff_set_arch_mach_hook): Add comment describing machine == 0.
+ Remove unnecessary "machine" assignments.
+ (coff_write_relocs): Test for the absolute section sym by testing
+ section and flags.
+
+ * aoutx.h (NAME(aout,machine_type)): Recognize bfd_mach_i386_i386
+ and bfd_mach_i386_i386_intel_syntax.
+ * pdp11.c (NAME(aout,machine_type)): Likewise.
+
+2002-08-30 John David Anglin <dave@hiauly1.hia.nrc.ca>
+
+ * bfd-in.h (align_power): Cast constants to bfd_vma type.
+ * bfd-in2.h (align_power): Likewise.
+
+2002-08-30 Alan Modra <amodra@bigpond.net.au>
+
+ * Makefile.am: Run "make dep-am".
+ * Makefile.in: Regenerate.
+
+ * cpu-avr.c (compatible): Don't use hard-coded mach constants.
+ * cpu-powerpc.c (powerpc_compatible): Likewise.
+ * cpu-rs6000.c (rs6000_compatible): Likewise.
+
+2002-08-28 Catherine Moore <clm@redhat.com>
+
+ * elf32-v850.c (v850_elf_reloc_map): Add new relocs.
+ (v850-elf-reloc): Don't resolve pc relative relocs.
+ (v850_elf_ignore_reloc): New routine.
+ (v850_elf_final_link_relocate): Handle new relocs.
+ (v850_elf_relax_delete_bytes ): New routine.
+ (v850_elf_relax_section): New routine.
+ (bfd_elf32_bfd_relax_section): Define.
+ (HOWTO): New entries for new relocs.
+ * reloc.c (BFD_RELOC_V850_LONGCALL): New reloc.
+ (BFD_RELOC_V850_LONGJUMP): New reloc.
+ (BFD_RELOC_V850_ALIGN): New reloc.
+ * archures.c: Remove redundant v850ea architecture.
+ * cpu-v850.c: Remove redundant v850ea support.
+ * libbfd.h: Regenerate.
+ * bfd-in2.h: Regenerated.
+
+2002-08-28 Svein E. Seldal <Svein.Seldal@solidas.com>
+
+ * config.bfd: Add tic4x-*-*coff* and c4x-*-*coff* target.
+ * configure.in: Add tic4x_coff vector files.
+ * configure: Regenerate.
+ * Makefile.am: Add tic4x target.
+ * Makefile.in: Regenerate.
+
+2002-08-27 Michael Hayes <m.hayes@elec.canterbury.ac.nz>
+
+ * archures.c: Add the BFD arch type tic4x.
+ * bfd-in.h: Add BFD_IN_MEMORY flag.
+ * coff-tic4x.c: New file.
+ * coffswap.h (coff_swap_sym_out): Add preadjuster.
+ * cpu-tic4x.c: New file.
+ * targets.c: Added tic4x- in list of xvecs.
+ * ticoff.h: New file.
+ * bfd-in2.h: Regenerate.
+
+2002-08-27 Adam Nemet <anemet@lnxw.com>
+
+ * elf32-arm.h (elf32_arm_finish_dynamic_sections): Set the last
+ bit of DT_INIT and DT_FINI for Thumb functions.
+
+2002-08-26 Alan Modra <amodra@bigpond.net.au>
+
+ * coffcode.h (coff_set_arch_mach_hook): Handle W65MAGIC.
+
+2002-08-26 Alan Modra <amodra@bigpond.net.au>
+
+ * aoutx.h (NAME(aout,reloc_type_lookup)): Handle BFD_RELOC_8.
+
+2002-08-24 Kaz Kojima <kkojima@rr.iij4u.or.jp>
+
+ * elf32-sh.c (sh_elf_copy_indirect_symbol): New.
+ (create_got_section, allocate_dynrelocs, readonly_dynrelocs):
+ Likewise.
+ (struct elf_sh_pcrel_relocs_copied): Removed.
+ (struct elf_sh_dyn_relocs): New.
+ (struct elf_sh_link_hash_entry): Replace pcrel_relocs_copied
+ field with dyn_relocs.
+ (struct elf_sh_link_hash_table): Add short-cuts to get dynamic
+ sections and sym_sec.
+ (sh_elf_link_hash_newfunc): Clear dyn_relocs.
+ (sh_elf_link_hash_table_create): Clear shorts-cuts and sym_sec.
+ (sh_elf_create_dynamic_sections): Use create_got_section instead
+ of _bfd_elf_create_got_section.
+ (sh_elf_check_relocs): Likewise.
+ (sh_elf_create_dynamic_sections): Use short-cuts to the dynamic
+ sections.
+ (sh_elf_adjust_dynamic_symbol, sh_elf_size_dynamic_sections,
+ sh_elf_relocate_section, sh_elf_check_relocs,
+ sh_elf_finish_dynamic_symbol, sh_elf_finish_dynamic_sections):
+ Likewise.
+ (sh_elf_adjust_dynamic_symbol): Handle nocopyreloc. Keep the
+ dynamic relocations and avoiding the copy relocation when we
+ didn't find any dynamic relocations in the section which has
+ contents or is read-only.
+ (WILL_CALL_FINISH_DYNAMIC_SYMBOL): New.
+ (sh_elf_size_dynamic_sections): Don't reset the size of
+ .rela.got section even if dynamic_sections_created flag is off.
+ Don't use sh_elf_discard_copies. Scan all input bfd and use
+ allocate_dynrelocs. Call readonly_dynrelocs to determine
+ whether we need DT_TEXTREL.
+ (sh_elf_adjust_dynamic_symbol): Use plt.refcount to determine
+ whether the symbol was never referred to.
+ (sh_elf_relocate_section): Use WILL_CALL_FINISH_DYNAMIC_SYMBOL.
+ (sh_elf_gc_sweep_hook): Fill with the real sweep function.
+ (sh_elf_check_relocs): Call create_got_section if the short-cut
+ to .got is null. Increment reference counters only instead of
+ allocating space on dynamic sections here. Don't conditionalize
+ uninitialized got.offset value when marking the symbol as a
+ global offset table entry. Keep relocations for symbols satisfied
+ by a dynamic library to avoid copy relocations for the symbol.
+ Set dynobj field of an elf hash table if needed.
+ (sh_elf_finish_dynamic_sections): Handle null section pointer
+ correctly.
+ (elf_backend_copy_indirect_symbol): Defined.
+ (elf_backend_can_refcount): Defined.
+
+2002-08-23 Nick Clifton <nickc@redhat.com>
+
+ * elf-eh-frame.c (_bfd_elf_discard_section_eh_frame): Undo
+ previous change. Add comment explaining why.
+
+2002-08-23 Stephen Clarke <stephen.clarke@superh.com>
+
+ * elf32-sh.c (elf_sh_plt0_entry_be, elf_sh_plt0_entry_le): Copy
+ contents of .got.plt[2] to tr0, not address of .got.plt.
+ (sh_elf_finish_dynamic_symbol): Do not apply GOT_BIAS when
+ patching absolute plt entry. For shmedia plt entry, set bottom bit
+ of branch to plt0 as this is a branch to an shmedia instruction.
+ * elf64-sh64.c (elf_sh64_plt0_entry_be, elf_sh64_plt0_entry_le):
+ Copy contents of .got.plt[2] to tr0, not address of .got.plt.
+ (elf_sh64_plt_entry_be, elf_sh64_plt_entry_le): Use ptrel to
+ branch to plt0.
+ (sh64_elf64_finish_dynamic_symbol): Do not apply GOT_BIAS when
+ patching absolute plt entry. For shmedia plt entry, branch to
+ plt0 is now ptrel, so use relative offset. Set bottom bit of
+ branch target as it is a branch to an shmedia instruction.
+
+2002-08-23 Stephen Clarke <stephen.clarke@superh.com>,
+ Richard Shann <richard.shann@superh.com>
+
+ * elf32-sh.c (sh_elf_finish_dynamic_sections): Set LSB of DT_INIT
+ value if .init is an SHmedia function. Similarly for DT_FINI.
+ * elf64-sh64.c (sh64_elf64_finish_dynamic_sections): Likewise.
+
+2002-08-23 Stephen Clarke <stephen.clarke@superh.com>
+
+ * elf32-sh.c (sh_elf_size_dynamic_sections): Zero initialize
+ dynamic section.
+ * elf64-sh64.c (sh64_elf64_size_dynamic_sections): Likewise.
+
+2002-08-22 Kaz Kojima <kkojima@rr.iij4u.or.jp>
+
+ * elf-eh-frame.c (_bfd_elf_discard_section_eh_frame): Use a simple
+ byte read when reading the return address register column.
+
+2002-08-22 Nick Clifton <nickc@redhat.com>
+
+ * config.bfd: Add powepc64-*-*bsd* target.
+
+2002-08-22 Graeme Peterson <gp@qnx.com>
+
+ * Makefile.am: Add entries for elf32-shqnx.c
+ * Makefile.in: Regenerate.
+ * config.bfd: Add support sh-*-nto* target.
+ * configure.in: Add support for bfd_elf32_sh{l}qnx_vec.
+ * configure: Regenerate.
+ * elf32-qnx.h: Changed typo "elf_i386qnx_*" to "elf_qnx_*" .
+ * elf32-sh.c: Do not include elf32-target.h if
+ ELF32_SH_C_INCLUDED is defined.
+ * elf32-shqnx.c: New file: Support for QNX.
+ * targets.c: Add bfd_elf32_sh{l}qnx_vec.
+
+2002-08-22 Nick Clifton <nickc@redhat.com>
+
+ * po/tr.po: Updated Turkish translation.
+
+ * syms.c (_bfd_generic_read_minisymbols): Set bfd_error if the
+ symbols are not read.
+
+2002-08-22 Alan Modra <amodra@bigpond.net.au>
+
+ * elf32-m68hc11.c: Formatting fixes.
+ (elf32_m68hc11_gc_mark_hook): Correct params. Remove unnecessary test.
+ * elf32-m68hc12.c: Formatting fixes.
+ (elf32_m68hc11_gc_mark_hook): Correct params. Remove unnecessary test.
+
+2002-08-22 Alan Modra <amodra@bigpond.net.au>
+
+ * coff-rs6000.c (rs6000coff_vec <object_flags>): Add SEC_CODE and
+ SEC_DATA.
+ (pmac_xcoff_vec): Likewise.
+ * coff64-rs6000.c (rs6000coff64_vec): Likewise.
+ (aix5coff64_vec): Likewise.
+
+2002-08-22 Alan Modra <amodra@bigpond.net.au>
+
+ * elf-bfd.h (struct elf_backend_data): Add struct elf_backend_data
+ param to elf_backend_copy_indirect_symbol.
+ (_bfd_elf_link_hash_copy_indirect): Likewise.
+ * elflink.h (elf_add_default_symbol, elf_fix_symbol_flags): Adjust
+ calls to copy_indirect_symbol.
+ * elf32-hppa.c (elf32_hppa_copy_indirect_symbol): Likewise.
+ * elf32-i386.c (elf_i386_copy_indirect_symbol): Likewise.
+ * elf32-s390.c (elf_s390_copy_indirect_symbol): Likewise.
+ * elf64-ppc.c (ppc64_elf_copy_indirect_symbol): Likewise.
+ * elf64-s390.c (elf_s390_copy_indirect_symbol): Likewise.
+ * elf64-x86-64.c (elf64_x86_64_copy_indirect_symbol): Likewise.
+ * elfxx-ia64.c (elfNN_ia64_hash_copy_indirect): Likewise.
+ * elfxx-mips.c (_bfd_mips_elf_copy_indirect_symbol): Likewise.
+ * elfxx-mips.h (_bfd_mips_elf_copy_indirect_symbol): Likewise.
+ * elf.c (_bfd_elf_link_hash_copy_indirect): Likewise. Properly
+ test refcounts for "used" values.
+
+2002-08-21 John David Anglin <dave@hiauly1.hia.nrc.ca>
+
+ * elf-eh-frame.c (_bfd_elf_discard_section_eh_frame): Add PARAMS to
+ argument declaration.
+
+2002-08-19 Elena Zannoni <ezannoni@redhat.com>
+
+ * archures.c (bfd_mach_ppc_e500): Added.
+ * bfd-in2.h: Rebuilt.
+ * cpu-powerpc.c (bfd_powerpc_archs): Added e500.
+
+2002-08-19 Alan Modra <amodra@bigpond.net.au>
+
+ * elf32-m68hc12.c (elf_backend_can_gc_sections): False.
+
+2002-08-17 Andrew Cagney <ac131313@redhat.com>
+
+ * elf.c (bfd_elf_get_elf_syms): Change type of `esym' to
+ `bfd_byte'.
+
+2002-08-17 Stan Cox <scox@redhat.com>
+
+ * elfxx-mips.c (_bfd_mips_elf_modify_segment_map): Use the
+ IRIX 6 segment layout for NEWABI.
+
+2002-08-16 Stephen Clarke <stephen.clarke@superh.com>
+
+ * elf32-sh.c (sh_elf_gc_mark_hook): For sh64, skip indirect
+ symbols when looking for section referred to by a relocation.
+ * elf64-sh.c (sh_elf64_gc_mark_hook): Likewise.
+
+2002-08-15 Alan Modra <amodra@bigpond.net.au>
+
+ * elf32-i370.c: Move reloc enum to include/elf/i370.h.
+
+2002-08-15 Hans-Peter Nilsson <hp@axis.com>
+
+ * elf32-cris.c (elf_cris_discard_excess_program_dynamics): Add
+ missing check for whether the symbol is referenced by DSO before
+ unexporting it as an unneeded dynamic symbol.
+
+2002-08-14 H.J. Lu <hjl@gnu.org>
+
+ * libbfd.h: Regenerate.
+
+2002-08-14 H.J. Lu <hjl@gnu.org>
+
+ * config.bfd: Always add 64bit vectors to 32bit Linux/mips.
+
+2002-08-14 Stephane Carrez <stcarrez@nerim.fr>
+
+ * elf32-m68hc11.c (m68hc11_relax_group): New to relax group of
+ instructions.
+ (m68hc11_direct_relax): New to define table of relaxable instructions.
+ (find_relaxable_insn): New, find a relaxable insn.
+ (compare_reloc): New to compare two relocs.
+ (m68hc11_elf_relax_section): New, relax text sections.
+ (m68hc11_elf_relax_delete_bytes): New, delete bytes and adjust branchs.
+ (elf32_m68hc11_check_relocs): New function for GC support.
+ (elf32_m68hc11_relocate_section): New function for GC support.
+ (bfd_elf32_bfd_relax_section): Define to support linker relaxation.
+ (elf_backend_check_relocs): Likewise.
+ (elf_backend_relocate_section): Likewise.
+
+2002-08-13 H.J. Lu <hjl@gnu.org>
+
+ * elflink.h (NAME(bfd_elf,size_dynamic_sections): Don't count
+ definitions in shared objects when checking symbol with
+ undefined version.
+
+2002-08-13 Stephane Carrez <stcarrez@nerim.fr>
+
+ * elf32-m68hc11.c (elf32_m68hc11_gc_mark_hook): New for section GC.
+ (elf32_m68hc11_gc_sweep_hook): Likewise.
+ (elf_backend_gc_mark_hook): Define for GC section support.
+ (elf_backend_gc_sweep_hook): Likewise.
+ (elf_backend_can_gc_sections): Likewise.
+
+ * elf32-m68hc12.c: Likewise.
+
+2002-08-13 Stephane Carrez <stcarrez@nerim.fr>
+
+ * elf32-m68hc11.c (_bfd_m68hc11_elf_print_private_bfd_data): New.
+ (_bfd_m68hc11_elf_merge_private_bfd_data): New function.
+ (_bfd_m68hc11_elf_set_private_flags): New function.
+ Use them to set/check/print ELF flags specific to 68HC11.
+
+ * elf32-m68hc12.c (_bfd_m68hc12_elf_print_private_bfd_data): New.
+ (_bfd_m68hc12_elf_merge_private_bfd_data): New function.
+ (_bfd_m68hc12_elf_set_private_flags): New function.
+ Use them to set/check/print ELF flags specific to 68HC12.
+
+2002-08-13 Stephane Carrez <stcarrez@nerim.fr>
+
+ * elf32-m68hc11.c (elf_m68hc11_howto_table): Add the new relocs;
+ fix masks for PC-rel relocs.
+ (m68hc11_elf_ignore_reloc): New function.
+
+ * elf32-m68hc12.c (m68hc12_elf_special_reloc): New to handle specific
+ 68HC12 banked addressing relocs.
+ (m68hc12_phys_addr): New to compute physical address of banked memory.
+ (m68hc12_phys_page): Likewise for page.
+ (m68hc12_addr_is_banked): New to see if address is in banked area.
+ (elf_m68hc12_howto_table): Add new relocs and rename to xx12.
+
+2002-08-13 Stephane Carrez <stcarrez@nerim.fr>
+
+ * reloc.c (BFD_RELOC_M68HC11_RL_JUMP, BFD_RELOC_M68HC11_RL_GROUP,
+ BFD_RELOC_M68HC11_LO16, BFD_RELOC_M68HC11_PAGE,
+ BFD_RELOC_M68HC11_24): New relocs for 68HC11/68HC12.
+ * bfd-in2.h: Regenerate.
+
+2002-08-12 H.J. Lu <hjl@gnu.org>
+
+ * elflink.h (elf_add_default_symbol): Preserve section across
+ elf_merge_symbol.
+
+2002-08-09 Graeme Peterson <gp@qnx.com>
+
+ * Makefile.am: Add entries for elf32-ppcqnx.c, and add
+ elf32-qnx.h dependency to elfarmqnx-nabi.c and elf32-i386qnx.c.
+ * Makefile.in: Regenerate.
+ * config.bfd: Add support for powerpc{le}-*-nto targets.
+ * configure.in: Add support for bfd_elf32_powerpc{le}qnx_vec.
+ * configure: Regenerate.
+ * elf32-i386qnx.c: Moved backend functions into a QNX specific
+ common file "elf32-qnx.h", and now include that file.
+ * elf32-qnx.h: New file: QNX specific common elf backend.
+ * elf32-ppc.c: Do not include elf32-target.h if
+ ELF32_PPC_C_INCLUDED is defined.
+ * elf32-ppcqnx.c: New file: Support for QNX.
+ * elfarmqnx-nabi.c: Include elf32-qnx.h for qnx elf backend.
+ * targets.c: Add bfd_elf32_powerpc{le}qnx_vec.
+
+2002-08-09 Nick Clifton <nickc@redhat.com>
+
+ * po/sv.po: Updated Swedish translation.
+
+2002-08-09 Thiemo Seufer <seufer@csv.ica.uni-stuttgart.de>
+
+ * elfxx-mips.c (mips_elf_global_got_index): Avoid segfault if
+ g->global_gotsym is NULL.
+
+2002-08-08 H.J. Lu <hjl@gnu.org>
+
+ * elflink.h (elf_add_default_symbol): Don't warn if a definition
+ overrides an indirect versioned symbol.
+
+2002-08-08 Jakub Jelinek <jakub@redhat.com>
+
+ * elf32-i386.c (elf_i386_relocate_section): Fill in proper addend
+ for R_386_TLS_TPOFF32 relocs against symndx 0.
+
+2002-08-07 H.J. Lu <hjl@gnu.org>
+
+ * elflink.h (NAME(bfd_elf,size_dynamic_sections)): Check symbol
+ with undefined version if needed.
+ (elf_link_assign_sym_version): Match a default symbol with a
+ version without definition. No need to hide the default
+ definition separately.
+
+2002-08-08 Alan Modra <amodra@bigpond.net.au>
+
+ * elflink.h (elf_link_output_extsym): Don't output symbols from
+ SEC_EXCLUDE sections.
+
+ * aoutx.h (aout_link_write_symbols): Correct handling of warning syms.
+
+2002-08-07 Alan Modra <amodra@bigpond.net.au>
+
+ * elf64-ppc.c (edit_opd): Arrange to drop symbols for discarded .opd
+ entries.
+
+2002-08-07 Thiemo Seufer <seufer@csv.ica.uni-stuttgart.de>
+
+ * elfxx-mips.c (mips_elf_create_dynamic_relocation): Cast signedness
+ mismatch.
+
+2002-08-07 Thiemo Seufer <seufer@csv.ica.uni-stuttgart.de>
+
+ * elfxx-mips.c (ABI_64_P): Remove superfluous check.
+
+2002-08-07 Thiemo Seufer <seufer@csv.ica.uni-stuttgart.de>
+
+ * elf32-mips.c (mips_reloc_map): Fix typo.
+
+2002-08-06 Alan Modra <amodra@bigpond.net.au>
+
+ * xcofflink.c (xcoff_write_global_symbol): Set n_scnum for abs_section.
+
+2002-08-06 Alan Modra <amodra@bigpond.net.au>
+
+ * elf64-ppc.c (ppc64_elf_howto_raw): Zero all src_mask entries.
+
+2002-08-06 Alan Modra <amodra@bigpond.net.au>
+
+ * libxcoff.h: Use PARAMS on function declarations.
+ * coff-rs6000.c (xcoff_generate_rtinit): Simplify size calc.
+ * coff64-rs6000.c (xcoff64_generate_rtinit): Likewise.
+
+ * coff-rs6000.c: (xcoff_rtype2howto): Don't place reloc address in
+ addend.
+ * coff64-rs6000.c: (xcoff64_rtype2howto): Likewise.
+
+2002-08-06 Alan Modra <amodra@bigpond.net.au>
+
+ * coff-rs6000.c: Formatting fixes.
+ (xcoff_calculate_relocation): Use PARAMS in declaration.
+ (xcoff_complain_overflow): Likewise.
+ (xcoff_ppc_relocate_section): Use old-style function pointer call.
+ (bfd_xcoff_backend_data): Remove useless comments.
+ (rs6000coff_vec): Likewise.
+ (bfd_pmac_xcoff_backend_data): Likewise.
+ (pmac_xcoff_vec): Likewise.
+
+ * coff64-rs6000.c: Formatting fixes.
+ (xcoff64_calculate_relocation): Use PARAMS in declaration.
+ (xcoff64_ppc_relocate_section): Use old-style function pointer call.
+ (bfd_xcoff_backend_data): Remove useless comments.
+ (rs6000coff64_vec): Likewise.
+ (bfd_xcoff_aix5_backend_data): Likewise.
+ (aix5coff64_vec): Likewise.
+
+2002-08-06 Alan Modra <amodra@bigpond.net.au>
+
+ * coff-rs6000.c (xcoff_howto_table): Revert some of last change to
+ mask entries. Use complain_overflow_dont for R_REF.
+ (xcoff_reloc_type_ba): Revert last change.
+ (xcoff_reloc_type_br): Likewise.
+ (xcoff_reloc_type_crel): Likewise.
+ (xcoff_ppc_relocate_section): Likewise.
+ * coff64-rs6000.c (xcoff64_reloc_type_br): Likewise.
+ (xcoff64_ppc_relocate_section): Likewise.
+ (xcoff64_howto_table): Revert some of last change to mask entries.
+ Use complain_overflow_dont for R_REF.
+
+ * coff-rs6000.c (xcoff_howto_table): Fix src_mask entries. Make all
+ relocs with bitsize == 16 have size = 1.
+ (xcoff_reloc_type_ba): Correct src_mask and dst_mask adjustment.
+ (xcoff_reloc_type_br): Likewise.
+ (xcoff_reloc_type_crel): Likewise.
+ (xcoff_ppc_relocate_section): Set up src_mask and dst_mask correctly.
+ * coff64-rs6000.c (xcoff64_reloc_type_br): Correct src_mask and
+ dst_mask adjustment.
+ (xcoff64_ppc_relocate_section): Set up src_mask and dst_mask correctly.
+ (xcoff64_howto_table): Fix src_mask entries. Make all relocs with
+ bitsize == 16 have size = 1.
+
+2002-08-01 Denis Chertykov <denisc@overta.ru>
+
+ * elf32-ip2k.c: Processor manufacturer changed to Ubicom.
+ (struct misc): New field isymbuf. All free_* fields removed.
+ (symbol_value): Pass in internal syms. No need to swap syms in.
+ (ip2k_elf_relax_section): Use bfd_elf_get_elf_syms. Properly free
+ possibly cached info.
+ (tidyup_after_error): Removed.
+ (ip2k_elf_relax_section_pass1): Don't use removed fields of struct
+ misc. Use new field.
+ (adjust_all_relocations): Use internal syms. No need to swap syms
+ in and out.
+ (add_page_insn): Don't use removed fields of struct misc.
+
+2002-08-01 Nick Clifton <nickc@redhat.com>
+
+ * elf32-arm.h: Revert previous delta.
+
+2002-08-01 Nick Clifton <nickc@redhat.com>
+
+ * configure.in (AM_INIT_AUTOMAKE): Bump version number.
+ * configure: Regenerate.
+
+2002-07-31 H.J. Lu <hjl@gnu.org>
+
+ * config.bfd: Add x86-64 vector to Linux/i386 if 64bit BFD is
+ selected.
+
+2002-07-31 H.J. Lu <hjl@gnu.org>
+
+ * config.bfd: Add n32 vectors to 32bit Linux/mips if 64bit BFD
+ is selected.
+
+2002-07-31 Jakub Jelinek <jakub@redhat.com>
+
+ * elf32-i386.c (elf_i386_copy_indirect_symbol): Swap tls_type
+ if _bfd_elf_link_hash_copy_indirect will swap got.refcount.
+
+2002-07-31 Ian Dall <ian@sibyl.beware.dropbear.id.au>
+
+ * cpu-ns32k.c (_bfd_ns32k_put_immdeiate, _bfd_ns32k_get_immediate):
+ There is no 8 byte relocation type for this architecture.
+ (do_ns32k_reloc): Use bfd_vma instead of native types.
+ (bfd_ns32k_put_immediate, _bfd_ns32k_relocate_contents) put_data
+ returns void.
+ (_bfd_ns32k_put_displacement): Don't check for overflow. We can
+ rely on generic code to do that.
+ * aout-ns32k.c (howto_table): Add appropriate overflow detection
+ to all table entries.
+ (_bfd_ns32k_relocate_contents): put_data returns void.
+ * ns32k.h: (_bfd_ns32k_put_displacement, _bfd_ns32k_put_immediate)
+ (_bfd_do_ns32k_reloc_contents): Fix prototypes. put data functions
+ return void.
+
+2002-07-31 Ian Dall <ian@sibyl.beware.dropbear.id.au>
+
+ * aoutx.h (aout_link_check_ar_symbols): Whether to include an
+ archive object is target dependant.
+
+2002-07-31 Adam Nemet <anemet@lnxw.com>
+
+ * elf32-arm.h (ARM_PLT_ENTRY_SIZE): Rename PLT_ENTRY_SIZE.
+ (THUMB_PLT_ENTRY_SIZE): New macro.
+ (PLT_ENTRY_SIZE): Return the appropriate *_PLT_ENTRY_SIZE.
+ (elf32_arm_plt0_entry): Rename PLT_ENTRY_SIZE to
+ ARM_PLT_ENTRY_SIZE.
+ (elf32_arm_plt_entry): Likewise.
+ (elf_backend_plt_header_size): Likewise.
+ (elf32_thumb_plt0_entry): New global.
+ (elf32_arm_finish_dynamic_sections): Use it. Put Thumb entries
+ into .plt.thumb.
+ (elf32_thumb_plt_entry): New global.
+ (elf32_arm_finish_dynamic_symbol): Use it. Use .thumb.plt for
+ Thumb entries. Set the bottom bit of the corresponding GOT entry
+ for a Thumb PLT entry.
+ (struct elf32_arm_plt_entry_info): New structure.
+ (struct elf32_arm_link_hash_entry, plt_info): New member of this
+ type.
+ (elf32_arm_link_hash_newfunc): Initialize new member.
+ (elf32_arm_final_link_relocate, R_ARM_THM_PC22 case): Handle
+ relocations against the PLT.
+ (elf32_arm_check_relocs, case R_ARM_PLT32 case): Set
+ first_rel_type if this is the first time we encounter the symbol.
+ (elf32_arm_check_relocs, case R_ARM_THM_PC22 case): New case.
+ Determine if relocation needs a PLT entry. Set first_rel_type if
+ this is the first time we encounter the symbol
+ (elf32_arm_adjust_dynamic_symbol): Create PLT entries for Thumb
+ functions as well.
+ (elf32_arm_size_dynamic_sections): Handle .plt.thumb like .plt.
+ (elf32_arm_create_dynamic_sections): New function. Create the
+ .plt.thumb section.
+ (elf_backend_create_dynamic_sections): Call it.
+
+2002-07-31 Nick Clifton <nickc@redhat.com>
+
+ * bfd.c (bfd_alt_mach_code): Rename parameter 'index' to
+ 'alternative' in order to avoid shadowing global symbol of the
+ same name.
+ * bfd-in2.h: Regenerate.
+ * libbfd.h: Regenerate.
+ * libcoff.h: Regenerate.
+
+2002-07-31 Thiemo Seufer <seufer@csv.ica.uni-stuttgart.de>
+
+ * Makefile.am: Add n32 ABI support.
+ * Makefile.in: Regenerate.
+ * config.bfd: Add n32 vectors to mips64*-*-linux* targets. Treat 64
+ bit vectors for mips*-*-linux targets as optional.
+ * configure.in: Add n32 ABI vectors.
+ * configure: Regenerate.
+ * elf32-mips.c (mips_elf32_object_p): Reject n32 ABI files.
+ * elfn32-mips.c: New file, n32 ABI support.
+ * targets.c: Add n32 ABI vectors.
+
+2002-07-30 Graeme Peterson <gp@qnx.com>
+
+ * elfarmqnx-nabi.c: New file: Support for QNX.
+ * config.bfd: Add support for arm-*-nto target.
+ * configure.in: Add support for bfd_elf32_{big|little}armqnx_vec.
+ * configure: Regenerate.
+ * Makefile.am: Add entries for elfarmqnx-nabi.c.
+ * Makefile.in: Regenerate.
+ * elf32-arm.h (ELF_MAXPAGESIZE): Do not define if already defined.
+ Do not define global function if ELFARM_NABI_C_INCLUDED is defined.
+ * elfarm-nabi.c: Do not include elf32-arm.h if
+ ELFARM_NABI_C_INCLUDED is defined.
+ * targets.c: Add bfd_elf32_{big|little}armqnx_vec.
+
+2002-07-30 Nick Clifton <nickc@redhat.com>
+
+ * po/sv.po: Updated Swedish translation.
+
+2002-07-30 Jakub Jelinek <jakub@redhat.com>
+
+ * elf.c (elf_fake_sections): Fix up .tbss sh_size and sh_type.
+
+2002-07-30 Alan Modra <amodra@bigpond.net.au>
+
+ * aoutx.h (some_aout_object_p): Clean up tdata properly on error.
+ * archive.c (bfd_generic_archive_p): Likewise.
+ * coff-rs6000.c (_bfd_xcoff_archive_p): Likewise.
+ (_bfd_xcoff_archive_p): Use bfd_scan_vma in place of strtol.
+ * coff64-rs6000.c (xcoff64_slurp_armap): Likewise.
+ (xcoff64_archive_p): Likewise.
+ (xcoff64_openr_next_archived_file): Likewise.
+ (xcoff64_archive_p): Clean up tdata properly on error.
+ * coffgen.c (coff_real_object_p): Likewise.
+ (coff_object_p): Release filehdr and opthdr.
+ * ecoff.c (_bfd_ecoff_archive_p): Clean up tdata properly on error.
+ * ieee.c (ieee_archive_p): Likewise.
+ * ihex.c (ihex_object_p): Likewise.
+ (ihex_mkobject): Always allocate tdata.
+ * peicode.h (pe_ILF_object_p): Release bfd_alloc'd buffer on error.
+ * srec.c (srec_mkobject): Always allocate tdata.
+ (srec_object_p): Clean up tdata properly on error.
+ (symbolsrec_object_p): Likewise.
+ * versados.c (versados_object_p): Likewise.
+ * vms-misc.c (_bfd_vms_get_record): Use bfd_malloc instead of malloc,
+ and bfd_realloc instead of realloc.
+ (add_new_contents): Use bfd_alloc instead of bfd_malloc for sections.
+ * vms.c (vms_initialize): Always allocate tdata. Use bfd_alloc in
+ place of bfd_malloc, simplifying error freeing. Free hash table too.
+ (vms_object_p): Clean up tdata on error.
+ (vms_mkobject): Don't complain on stderr if vms_initialize fails.
+ (vms_close_and_cleanup): Adjust for bfd_alloc use.
+
+2002-07-30 Alan Modra <amodra@bigpond.net.au>
+
+ * elfxx-ia64.c (elfNN_ia64_final_write_processing): Set e_flags.
+
+2002-07-26 Chris Demetriou <cgd@broadcom.com>
+
+ * elfxx-mips.c (_bfd_mips_elf_merge_private_bfd_data): Merge ASE
+ flags into resulting BFD.
+
+2002-07-26 Alan Modra <amodra@bigpond.net.au>
+
+ From John Reiser <jreiser@BitWagon.com>
+ * elf32-i386.c (elf_i386_link_hash_table_create): Clear
+ tls_ldm_got.refcount.
+
+2002-07-25 Thiemo Seufer <seufer@csv.ica.uni-stuttgart.de>
+
+ * elf64-mips.c: Update TODO comment.
+ (mips_elf64_higher_reloc,mips_elf64_highest_reloc,
+ mips_elf64_gprel16_reloca): Remove prototypes.
+ (mips16_jump_reloc,mips16_gprel_reloc): Add functions.
+ (UNUSED_RELOC): Replace by EMPTY_RELOC.
+ (mips_elf64_howto_table_rel): Use special R_MIPS_HI16 handling. Remove
+ wrong comments. Remove disfunctional support of R_MIPS_HIGHER and
+ R_MIPS_HIGHEST.
+ (mips_elf64_howto_table_rela): Fix handling of R_MIPS_GPREL16 and
+ R_MIPS_GOT16. Remove wrong comments.
+ (elf_mips16_jump_howto,elf_mips16_gprel_howto,
+ elf_mips_gnu_vtinherit_howto,elf_mips_gnu_vtentry_howto): New, code
+ from elf32-mips.c.
+ (mips_elf64_hi16_reloc): Fix formatting.
+ (mips_elf64_higher_reloc,mips_elf64_highest_reloc): Remove.
+ (mips_elf64_got16_reloc): Fix formatting. Remove superfluous code.
+ Better comment. Fall back to R_MIPS_GOT_DISP instead of abort().
+ (mips_elf64_gprel16_reloc): Make static. Add check for
+ partial_inplace.
+ (mips_elf64_gprel16_reloca): Remove.
+ (mips_elf64_literal_reloc): New function.
+ (mips_elf64_gprel32_reloc): Fix formatting.
+ (mips_elf64_shift6_reloc): Fix comment. Make static.
+ (mips16_jump_reloc,mips16_gprel_reloc): New functions, code from
+ elf32-mips.c.
+ (elf_reloc_map,mips_reloc_map): New mapping table, similiar as in
+ elf32-mips.c
+ (bfd_elf64_bfd_reloc_type_lookup): Use the mapping table. Enable GNU
+ specific relocations.
+ (mips_elf64_rtype_to_howto): Enable GNU specific relocations.
+ (mips_elf64_object_p): Invert logic to check for SGI-ish ABI.
+ (ELF_MAXPAGESIZE): Add comment.
+
+2002-07-25 Nick Clifton <nickc@redhat.com>
+
+ * po/sv.po: Updated Swedish translation.
+ * po/es.po: Updated Spanish translation.
+ * po/fr.po: Updated French translation.
+
+2002-07-25 Alan Modra <amodra@bigpond.net.au>
+
+ * elf-bfd.h (_bfd_elf32_link_record_local_dynamic_symbol): Define
+ as elf_link_record_local_dynamic_symbol.
+ (_bfd_elf64_link_record_local_dynamic_symbol): Likewise.
+ (elf_link_record_local_dynamic_symbol): Declare. Now returns int.
+ * elflink.h (elf_link_record_local_dynamic_symbol): Move to..
+ * elflink.c: .. here. Use bfd_elf_get_elf_syms. Check whether an
+ attempt is made to record a symbol in a discarded section, and
+ return `2' in that case.
+
+2002-07-24 Nick Clifton <nickc@redhat.com>
+
+ * po/sv.po: Updated Swedish translation.
+ * po/es.po: Updated Spanish translation.
+
+2002-07-23 Alan Modra <amodra@bigpond.net.au>
+
+ * po/SRC-POTFILES.in: Regenerate.
+
+ * elf-hppa.h (elf_hppa_relocate_section): If relocatable, return
+ immediately. Remove code handling relocatable linking.
+ * elf32-avr.c (elf32_avr_relocate_section): Likewise.
+ * elf32-cris.c (cris_elf_relocate_section): Likewise.
+ * elf32-fr30.c (elf32_frv_relocate_section): Likewise.
+ * elf32-frv.c (elf32_frv_relocate_section): Likewise.
+ * elf32-h8300.c (elf32_h8_relocate_section): Likewise.
+ * elf32-hppa.c (elf32_hppa_relocate_section): Likewise.
+ * elf32-ip2k.c (ip2k_elf_relocate_section): Likewise.
+ * elf32-sparc.c (elf32_sparc_relocate_section): Likewise.
+ * elf32-v850.c (v850_elf_relocate_section): Likewise.
+ * elf32-vax.c (elf_vax_relocate_section): Likewise.
+ * elf64-sparc.c (sparc64_elf_relocate_section): Likewise.
+ * elf32-avr.c (elf_backend_rela_normal): Define.
+ * elf32-cris.c: Likewise.
+ * elf32-fr30.c: Likewise.
+ * elf32-frv.c: Likewise.
+ * elf32-h8300.c: Likewise.
+ * elf32-hppa.c: Likewise.
+ * elf32-ip2k.c: Likewise.
+ * elf32-sparc.c: Likewise.
+ * elf32-v850.c: Likewise.
+ * elf32-vax.c: Likewise.
+ * elf64-hppa.c: Likewise.
+ * elf64-sparc.c: Likewise.
+ * elf32-fr30.c (elf32_frv_relocate_section): Edit comment.
+ * elf32-frv.c (elf32_frv_relocate_section): Likewise.
+ * elf32-i860.c (elf32_i860_relocate_section): Likewise.
+ * elf32-ip2k.c (ip2k_elf_relocate_section): Likewise.
+ * elf32-m32r.c (m32r_elf_relocate_section): Likewise.
+ * elf32-openrisc.c (openrisc_elf_relocate_section): Likewise.
+ * elf32-xstormy16.c (xstormy16_elf_relocate_section): Likewise.
+ * elf-m10200.c (USE_RELA): Don't define.
+ * elf-m10300.c: Likewise.
+ * elfarm-oabi.c: Likewise.
+ * elf32-i370.c: Likewise.
+ * elf32-ip2k.c: Likewise.
+ * elf32-m68k.c: Likewise.
+ * elf32-mcore.c: Likewise.
+ * elf32-ppc.c: Likewise.
+ * elf32-s390.c: Likewise.
+ * elf32-vax.c: Likewise.
+ * elf64-ppc.c: Likewise.
+ * elf64-s390.c: Likewise.
+ * elf64-x86-64.c: Likewise.
+ * elfxx-ia64.c: Likewise.
+ * elf32-avr.c (USE_REL): Don't undef.
+ * elf32-ip2k.c: Likewise.
+
+2002-07-23 Nick Clifton <nickc@redhat.com>
+
+ * elf-bfd.h (struct elf_backend_data): Add new bitfield
+ 'want_p_paddr_set_to_zero'.
+ * elfxx-target.h: Set default value for want_p_paddr_set_to_zero
+ to false;
+ * elfxx-ia64.c: Set want_p_paddr_set_zero for HPUX target.
+ * elf.c (copy_private_bfd_data): Test want_p_paddr_set_zero.
+
+2002-07-23 Gabor Keresztfalvi <keresztg@mail.com>
+
+ * nlmcode.h (nlm_swap_auxiliary_headers_out): Swapped the order of
+ the MeSsAgEs and CoPyRiGhT tags to make >=NW4.x NLM loaders to
+ show the Copyright string.
+ Minor formatting tidy ups.
+
+2002-07-23 Nick Clifton <nickc@redhat.com>
+
+ * po/fr.po: Updated French translation.
+ * po/sv.po: Updated Swedish translation.
+
+2002-07-23 Alan Modra <amodra@bigpond.net.au>
+
+ * elflink.h (elf_link_input_bfd): Don't change internal symbols
+ when outputting relocs.
+
+2002-07-20 Jason Thorpe <thorpej@wasabisystems.com>
+
+ * elf64-alpha.c (elf64_alpha_size_dynamic_sections): Only insert
+ DT_PLTGOT into the dynamic section if there is a PLT.
+
+2002-07-19 Thiemo Seufer <seufer@csv.ica.uni-stuttgart.de>
+
+ * elfxx-mips.c (_bfd_mips_elf_discard_info): New function, code from
+ elf32-mips.c.
+ (_bfd_mips_elf_write_section): Likewise.
+ * elfxx-mips.h (_bfd_mips_elf_discard_info): New prototype.
+ (_bfd_mips_elf_write_section): Likewise.
+ * elf32-mips.c (elf32_mips_discard_info): Move to elfxx-mips.c.
+ (elf32_mips_write_section): Likewise.
+ * elf64-mips.c (_bfd_mips_elf_ignore_discarded_relocs): Use it.
+ (_bfd_mips_elf_write_section): Likewise.
+
+2002-07-19 Alan Modra <amodra@bigpond.net.au>
+
+ * elfxx-ia64.c: (elfNN_ia64_modify_segment_map): Properly scan
+ PT_IA_64_UNWIND segments for a given section.
+
+2002-07-17 H.J. Lu <hjl@gnu.org>
+
+ * Makefile.am: Fix a typo.
+ * Makefile.in: Regenerate.
+
+2002-07-15 Denis Chertykov <denisc@overta.ru>
+ Frank Ch. Eigler <fche@redhat.com>
+ Ben Elliston <bje@redhat.com>
+ Alan Lehotsky <alehotsky@cygnus.com>
+ John Healy <jhealy@redhat.com>
+ Graham Stott <grahams@redhat.com>
+ Jeff Johnston <jjohnstn@redhat.com>
+
+ * Makefile.am: Add support for ip2k.
+ * Makefile.in: Regenerate.
+ * doc/Makefile.in: Regenerate.
+ * archures.c: Add support for ip2k.
+ * config.bfd: Add support for ip2k.
+ * configure.in: Add support for ip2k.
+ * configure: Regenerate.
+ * reloc.c: Add support for ip2k.
+ * targets.c: Add support for ip2k.
+ * bfd-in2.h: Regenerate.
+ * libbfd.h: Regenerate.
+ * cpu-ip2k.c: New file.
+ * elf32-ip2k.c: New file.
+
+2002-07-17 Ian Rickards <irickard@arm.com>
+
+ * dwarf2.c (concat_filename): If we can't establish the directory
+ just return the filename.
+
+2002-07-16 Moritz Jodeit <moritz@jodeit.org>
+
+ * peXXigen.c (_bfd_XXi_swap_aouthdr_out): Correct order of memset args.
+
+2002-07-16 Alan Modra <amodra@bigpond.net.au>
+
+ * elflink.h: Formatting fixes, tidy prototypes.
+ (elf_link_assign_sym_version): Move common code out of loop.
+
+2002-07-16 Alan Modra <amodra@bigpond.net.au>
+
+ * elflink.h (elf_link_input_bfd): Don't call reloc_emitter when
+ reloc section size is zero. Correct reloc output location.
+
+2002-07-16 John David Anglin <dave@hiauly1.hia.nrc.ca>
+
+ * elf-hppa.h (elf_hppa_reloc_final_type): Use R_PARISC_PCREL16F as
+ the final type for the e_fsel selector when generating PA2.0W code.
+ (elf_hppa_relocate_insn): Provide support for PA2.0W 16-bit format 1
+ relocations.
+
+2002-07-14 H.J. Lu <hjl@gnu.org>
+
+ * elflink.h (elf_link_assign_sym_version): Hide the default
+ definition if there is a hidden versioned definition.
+
+2002-07-12 Hans-Peter Nilsson <hp@axis.com>
+
+ * elf32-cris.c (cris_elf_relocate_section): Drop nonsensical
+ dynamic reference test in assertion when initializing GOT with
+ static contents. Just assert that there are either no dynamic
+ sections, the symbol is defined in the regular objects or that the
+ symbol is undef weak. Tweak comment.
+ (elf_cris_finish_dynamic_symbol): Emit .got reloc for a program
+ only if the symbol isn't defined in the program and isn't undef
+ weak.
+ (elf_cris_adjust_dynamic_symbol): Simplify condition for getting
+ rid of PLT entry: only do it if the symbol isn't defined in a DSO.
+ When doing so, clear ELF_LINK_HASH_NEEDS_PLT. Tweak comments.
+ (elf_cris_discard_excess_program_dynamics): Don't consider
+ ELF_LINK_HASH_REF_DYNAMIC when omitting .got runtime relocs.
+
+2002-07-11 Alan Modra <amodra@bigpond.net.au>
+
+ * elf32-i386.c (elf_i386_relocate_section): Don't complain about
+ unresolved debugging relocs in dynamic applications.
+ * elf32-s390.c (elf_s390_relocate_section): Likewise.
+ * elf32-sparc.c (elf32_sparc_relocate_section): Likewise.
+ * elf64-ppc.c (ppc64_elf_relocate_section): Likewise.
+ * elf64-s390.c (elf_s390_relocate_section): Likewise.
+ * elf64-sparc.c (sparc64_elf_relocate_section): Likewise.
+ * elf64-x86-64.c (elf64_x86_64_relocate_section): Likewise.
+
+2002-07-10 Alan Modra <amodra@bigpond.net.au>
+
+ * elf64-ppc.c (ONES): Define.
+ (ppc64_elf_howto_table): Use ONES here to avoid warnings. Fill in
+ missing src_mask fields. Tweak R_PPC64_NONE, R_PPC64_COPY. Fill
+ in missing dst_mask fields on R_PPC64_PLT32, R_PPC64_PLTREL32.
+
+ * elf64-ppc.c (ppc64_elf_get_symbol_info): Delete.
+ (ppc64_elf_set_private_flags): Delete.
+ (ppc64_elf_section_from_shdr): Delete.
+ (ppc64_elf_merge_private_bfd_data): Remove flag checking/merging code.
+ (ppc64_elf_fake_sections): Delete.
+ (bfd_elf64_bfd_set_private_flags): Don't define.
+ (bfd_elf64_get_symbol_info): Likewise.
+ (elf_backend_section_from_shdr): Likewise.
+ (elf_backend_fake_sections): Likewise.
+
+2002-07-10 Marco Walther <Marco.Walther@sun.com>
+
+ * elf.c: (assign_section_numbers) Set sh_entsize for .stab only
+ when not already set.
+ * elf64-sparc.c: (sparc64_elf_fake_sections): New function.
+ (elf_backend_fake_sections): Define.
+
+2002-07-10 Alan Modra <amodra@bigpond.net.au>
+
+ * merge.c (_bfd_merge_section): Remove redundant output_section check.
+ Formatting.
+ (_bfd_merge_sections): Don't set SEC_EXCLUDE on unused sections.
+
+2002-07-09 Hans-Peter Nilsson <hp@axis.com>
+
+ * elf32-cris.c (cris_elf_relocate_section): Move sanity-check for
+ NULL sym_hashes to just before use.
+ <case R_CRIS_32_GOTREL>: In test for local symbol, accept also
+ symbol with non-default visibility.
+ <case R_CRIS_32_GOTREL, case R_CRIS_32_PLT_GOTREL>: Ditto.
+ <case R_CRIS_8_PCREL, case R_CRIS_16_PCREL, case R_CRIS_32_PCREL>:
+ Ditto.
+ (cris_elf_gc_sweep_hook): Only decrease h->plt.refcount for
+ symbol with non-default visibility.
+ (cris_elf_check_relocs): At tests for local symbol before
+ increasing h->plt.refcount, also check for non-default
+ visibility. Ditto when checking for local symbol to eliminate
+ pc-relative runtime relocs.
+
+2002-07-08 Alan Modra <amodra@bigpond.net.au>
+
+ * elf.c: Formatting.
+ (IS_SOLARIS_PT_INTERP): Add p_paddr and p_memsz checks.
+ (INCLUDE_SECTION_IN_SEGMENT): Remove IS_SOLARIS_PT_INTERP.
+ (copy_private_bfd_data): Set p_vaddr on broken Solaris PT_INTERP
+ segments.
+
+2002-07-07 Mark Mitchell <mark@codesourcery.com>
+ Alan Modra <amodra@bigpond.net.au>
+
+ * cofflink.c (_bfd_coff_final_link): On PE COFF systems, take into
+ account the impact of relocation count overflow when computing
+ section offsets.
+ * coffcode.h (coff_write_relocs): Use obj_pe when deciding whether
+ or not to apply the PE COFF reloc overflow handling. Fix a
+ fencepost error in deciding whether or not to use that technique.
+
+2002-07-07 Alan Modra <amodra@bigpond.net.au>
+
+ * elf-bfd.h (struct elf_reloc_cookie): Remove locsym_shndx,
+ change type of locsyms.
+ (bfd_elf_get_elf_syms): Declare.
+ * elf.c (bfd_elf_get_elf_syms): New function.
+ (group_signature): Use bfd_elf_get_elf_syms.
+ (bfd_section_from_r_symndx): Likewise.
+ * elfcode.h (elf_slurp_symbol_table): Likewise.
+ * elflink.h (elf_link_is_defined_archive_symbol): Likewise.
+ (elf_link_add_object_symbols): Likewise. Reorganise to increase
+ locality of various data structures. Properly free internal relocs.
+ (elf_bfd_final_link): Properly free internal relocs.
+ (elf_link_check_versioned_symbol): Use bfd_elf_get_elf_syms.
+ (elf_link_input_bfd): Likewise.
+ (elf_gc_mark): Likewise. Properly free internal relocs.
+ (elf_gc_sweep): Properly free internal relocs.
+ (elf_reloc_symbol_deleted_p): No need to swap syms in.
+ (elf_bfd_discard_info): Use bfd_elf_get_elf_syms. Properly free
+ internal relocs.
+ * elf-m10200.c (mn10200_elf_relax_section): Use bfd_elf_get_elf_syms.
+ Properly free possibly cached info.
+ (mn10200_elf_relax_delete_bytes): Remove symbol swapping code.
+ (mn10200_elf_symbol_address_p): Pass in internal syms. Remove
+ symbol swapping code.
+ (mn10200_elf_get_relocated_section_contents): Use bfd_elf_get_elf_syms.
+ Properly free possibly cached info.
+ * elf-m10300.c (mn10300_elf_relax_section): As above for elf-m10200.c.
+ (mn10300_elf_relax_delete_bytes): Likewise.
+ (mn10300_elf_symbol_address_p): Likewise.
+ (mn10300_elf_get_relocated_section_contents): Likewise.
+ * elf32-h8300.c (elf32_h8_relax_section): As above for elf-m10200.c.
+ (elf32_h8_relax_delete_bytes): Likewise.
+ (elf32_h8_symbol_address_p): Likewise.
+ (elf32_h8_get_relocated_section_contents): Likewise.
+ * elf32-m32r.c (m32r_elf_relax_section): As above for elf-m10200.c.
+ (m32r_elf_relax_delete_bytes): Likewise.
+ (m32r_elf_get_relocated_section_contents): Likewise.
+ * elf32-sh.c (sh_elf_reloc_loop): Free section contents using
+ elf_section_data to determine whether cached.
+ (sh_elf_relax_section): As above for elf-m10200.c.
+ (sh_elf_relax_delete_bytes): Likewise.
+ (sh_elf_get_relocated_section_contents): Likewise.
+ * elf32-xstormy16.c (xstormy16_elf_relax_section): As above.
+ * elf64-alpha.c (elf64_alpha_relax_section): As above. Also delay
+ reading of local syms.
+ * elf64-mmix.c (mmix_elf_relax_section): Likewise.
+ * elf64-sh64.c (sh_elf64_get_relocated_section_contents): As above.
+ * elfxx-ia64.c (elfNN_ia64_relax_section): As above.
+ * elfxx-mips.c (_bfd_mips_elf_check_relocs): Properly free internal
+ relocs.
+ * elf32-arm.h (bfd_elf32_arm_process_before_allocation): Properly
+ free internal relocs and section contents. Don't read symbols.
+ * elf32-hppa.c (get_local_syms): Use bfd_elf_get_elf_syms.
+ (elf32_hppa_size_stubs): Don't free local syms.
+ * elf32-m68k.c (bfd_m68k_elf32_create_embedded_relocs): Delay
+ reading of local syms. Use bfd_elf_get_elf_syms. Properly free
+ possibly cached info.
+ * elf32-mips.c (bfd_mips_elf32_create_embedded_relocs): Likewise.
+ * elf64-hppa.c (elf64_hppa_check_relocs): Use bfd_elf_get_elf_syms.
+ * elf64-ppc.c (struct ppc_link_hash_table): Delete bfd_count and
+ all_local_syms.
+ (get_local_syms): Delete function.
+ (edit_opd): Use bfd_elf_get_elf_syms. Free on error exit. Cache
+ on exit.
+ (ppc64_elf_size_stubs): Use bfd_elf_get_elf_syms. Free/cache on exit.
+
+2002-07-05 Jim Wilson <wilson@redhat.com>
+
+ * syms.c (decode_section_type): New.
+ (bfd_decode_symclass): Call decode_section_type.
+
+2002-07-04 Jakub Jelinek <jakub@redhat.com>
+
+ * merge.c (_bfd_merged_section_offset): Avoid accessing byte before
+ section content start.
+ Reported by Michael Schumacher <mike@hightec-rt.com>.
+
+2002-07-04 Alan Modra <amodra@bigpond.net.au>
+
+ * section.c (_bfd_strip_section_from_output): Remove unnecessary
+ link order code. Don't actually remove the output section here;
+ Just set a flag for the linker to do so.
+ * elflink.c (_bfd_elf_link_renumber_dynsyms): Test for removed
+ sections when setting up output section dynsyms.
+
+2002-07-04 Alan Modra <amodra@bigpond.net.au>
+
+ * elflink.h (elf_link_add_object_symbols): Revert 1999-09-02 hpux
+ fudge.
+ * elf.c (bfd_section_from_shdr): Work around broken hpux shared
+ libs here instead.
+
+2002-07-02 Martin Schwidefsky <schwidefsky@de.ibm.com>
+
+ * elf64-s390.c (create_got_section): Set .got section alignment to
+ 8 bytes.
+ (elf_s390_check_relocs): Set .rela.dyn section alignment to 8 bytes.
+
+2002-07-02 Alan Modra <amodra@bigpond.net.au>
+
+ * elf.c (_bfd_elf_reloc_type_class): Fix comment grammar.
+
+2002-07-01 Matt Thomas <matt@3am-software.com>
+
+ * elf32-vax.c (elf32_vax_print_private_bfd_data): Change EF_*
+ to EF_VAX_*.
+
+2002-07-01 Thiemo Seufer <seufer@csv.ica.uni-stuttgart.de>
+
+ * elfxx-mips.c (ABI_64_P): Fix comment.
+ (MIPS_ELF_OPTIONS_SECTION_NAME,MIPS_ELF_STUB_SECTION_NAME): Use the
+ new section names for N64 ABI.
+ (mips_elf_output_extsym): No special _gp_disp handling for NewABI.
+ (mips_elf_calculate_relocation): Code formatting.
+ (mips_elf_create_dynamic_relocation): Likewise.
+ (_bfd_mips_elf_fake_sections): IRIX6 needs this hack, too.
+ (_bfd_mips_elf_size_dynamic_sections): Handle GOT_PAGE for any NewABI.
+ (_bfd_mips_elf_relocate_section): No special handling for R_MIPS_64
+ in any NewABI.
+ (_bfd_mips_elf_finish_dynamic_symbol): No special _gp_disp handling
+ for NewABI.
+ (_bfd_mips_elf_modify_segment_map): Handle any N64 ABI.
+ (_bfd_mips_elf_gc_sweep_hook): NewABI GOT relocs should be handled
+ here, too.
+
+2002-07-01 Andreas Schwab <schwab@suse.de>
+
+ * elf64-x86-64.c (elf64_x86_64_relocate_section): Only convert
+ R_X86_64_64 to R_X86_64_RELATIVE.
+
+2002-07-01 John David Anglin <dave@hiauly1.hia.nrc.ca>
+
+ * vaxbsd.c: New BFD backend for VAX BSD and Ultrix.
+ * Makefile.am (BFD32_BACKENDS, BFD32_BACKENDS_CFILES): Add new backend.
+ Run "make dep-am".
+ * config.bfd (vax-*-bsd* | vax-*-ultrix*): Use vaxbsd_vec instead of
+ host_aout_vec.
+ * configure.in (vaxbsd_vec): Add.
+ * targets.c (vaxbsd_vec): Add.
+ * Makefile.in: Rebuild.
+ * configure: Rebuild.
+ * po/SRC-POTFILES.in: Rebuild.
+
+2002-07-01 Alan Modra <amodra@bigpond.net.au>
+
+ * elflink.h (elf_gc_mark): Pass in the section whose relocs we are
+ examining to gc_mark_hook, rather than the bfd.
+ (elf_gc_sections): Adjust.
+ * elf-bfd.h (struct elf_backend_data <gc_mark_hook>): Likewise.
+ * elf-m10300.c (mn10300_elf_gc_mark_hook): Likewise.
+ * elf32-arm.h (elf32_arm_gc_mark_hook): Likewise.
+ * elf32-avr.c (elf32_avr_gc_mark_hook): Likewise.
+ * elf32-cris.c (cris_elf_gc_mark_hook): Likewise.
+ * elf32-d10v.c (elf32_d10v_gc_mark_hook): Likewise.
+ * elf32-fr30.c (fr30_elf_gc_mark_hook): Likewise.
+ * elf32-hppa.c (elf32_hppa_gc_mark_hook): Likewise.
+ * elf32-i386.c (elf_i386_gc_mark_hook): Likewise.
+ * elf32-m32r.c (m32r_elf_gc_mark_hook): Likewise.
+ * elf32-m68k.c (elf_m68k_gc_mark_hook): Likewise.
+ * elf32-mcore.c (mcore_elf_gc_mark_hook): Likewise.
+ * elf32-openrisc.c (openrisc_elf_gc_mark_hook): Likewise.
+ * elf32-ppc.c (ppc_elf_gc_mark_hook): Likewise.
+ * elf32-s390.c (elf_s390_gc_mark_hook): Likewise.
+ * elf32-sh.c (sh_elf_gc_mark_hook): Likewise.
+ * elf32-sparc.c (elf32_sparc_gc_mark_hook): Likewise.
+ * elf32-v850.c (v850_elf_gc_mark_hook): Likewise.
+ * elf32-vax.c (elf_vax_gc_mark_hook): Likewise.
+ * elf32-xstormy16.c (xstormy16_elf_gc_mark_hook): Likewise.
+ * elf64-mmix.c (mmix_elf_gc_mark_hook): Likewise.
+ * elf64-ppc.c (ppc64_elf_gc_mark_hook): Likewise.
+ * elf64-s390.c (elf_s390_gc_mark_hook): Likewise.
+ * elf64-sh64.c (sh_elf64_gc_mark_hook): Likewise.
+ * elfxx-mips.c (_bfd_mips_elf_gc_mark_hook): Likewise.
+ * elfxx-mips.h (_bfd_mips_elf_gc_mark_hook): Likewise.
+ * elf64-x86-64.c (elf64_x86_64_gc_mark_hook): Likewise.
+ * elf32-frv.c (elf32_frv_gc_mark_hook): Likewise. Also remove
+ redundant local sym tests.
+ * elf64-ppc.c (struct ppc_link_hash_entry): Add is_entry.
+ (link_hash_newfunc): Init is_entry.
+ (ppc64_elf_copy_indirect_symbol): Copy is_entry.
+ (ppc64_elf_link_hash_table_create): Init all_local_syms.
+ (create_linkage_sections): Use bfd_make_section_anyway rather than
+ bfd_make_section.
+ (ppc64_elf_mark_entry_syms): New function.
+ (ppc64_elf_check_relocs): Don't bother testing elf_bad_symtab. Set
+ up opd entry to function section map.
+ (ppc64_elf_gc_mark_hook): Special case opd section relocs, and
+ relocs that reference the opd section.
+ (edit_opd): New function.
+ (ppc64_elf_size_dynamic_sections): Call get_local_syms and edit_opd.
+ (ppc64_elf_setup_section_lists): Don't calculate htab->bfd_count here.
+ (get_local_syms): Do so here. Exit if we already have local syms.
+ Remove bogus comment imported from elf32-hppa.c. Don't attempt to
+ read local syms on non-ELF input.
+ (ppc64_elf_size_stubs): Call _bfd_elf64_link_read_relocs rather
+ than duplicating it's function here. Adjust free of internal
+ relocs to suit.
+ (ppc64_elf_relocate_section): Adjust local syms in opd section.
+ * elf64-ppc.h (ppc64_elf_mark_entry_syms): Declare.
+ * elf32-hppa.c (elf32_hppa_size_stubs): Call
+ _bfd_elf32_link_read_relocs rather than duplicating it's function
+ here. Adjust free of internal relocs to suit.
+
+2002-07-01 Andreas Jaeger <aj@suse.de>
+
+ * elf64-x86-64.c (elf64_x86_64_check_relocs): Certain relocations
+ are not allowed in shared libs code, enforce -fPIC.
+
+2002-06-29 Hans-Peter Nilsson <hp@bitrange.com>
+
+ * mmo.c (mmo_write_loc_chunk): Don't eliminate leading and
+ trailing zero-sequences when there's previous left-over data.
+
+2002-06-27 John David Anglin <dave@hiauly1.hia.nrc.ca>
+
+ * elf64-hppa.c (elf64_hppa_reloc_type_class): New function.
+ (elf64_hppa_finish_dynamic_sections): Check other_rel_sec, dlt_rel_sec
+ and opd_rel_sec in order for starting rela section. Check _raw_size.
+ (elf_backend_reloc_type_class): Define.
+
+2002-06-27 Kevin Buettner <kevinb@redhat.com>
+
+ * dwarf2.c (decode_line_info): Handle older, non-standard, 64-bit
+ DWARF2 formats.
+
+2002-06-27 Alan Modra <amodra@bigpond.net.au>
+
+ * cpu-powerpc.c: Comment on ordering of arch_info.
+ * elf32-ppc.c (ppc_elf_object_p): New function.
+ (elf_backend_object_p): Define.
+ * elf64-ppc.c (ppc64_elf_object_p): New function.
+ (elf_backend_object_p): Define.
+
+2002-06-26 Jason Thorpe <thorpej@wasabisystems.com>
+
+ * configure.in (vax-*-netbsd*): Set COREFILE to netbsd-core.lo.
+ * configure: Regenerate.
+
+2002-06-25 Jason Eckhardt <jle@rice.edu>
+
+ * dwarf2.c (decode_line_info): Check unit->addr_size
+ to read in the proper number of prologue bytes.
+
+2002-06-25 Nick Clifton <nickc@cambridge.redhat.com>
+
+ * config.bfd (powerpc-*-aix5*): Only create a selvecs for
+ aix5coff64_vec if 64-bit bfd support has been enabled.
+ (powerpc64-*-aix5*): Only define if 64-bit bfd support has
+ been enabled.
+
+ * targets.c (_bfd_target_vector[]): Only include
+ aix5coff64_vec if 64-bit bfd support has been enabled.
+
+2002-06-25 Alan Modra <amodra@bigpond.net.au>
+
+ * elf64-ppc.c (ppc_add_stub): Replace strcpy/strncpy with memcpy.
+ * elf32-hppa.c (hppa_add_stub): Likewise.
+ * elflink.c (_bfd_elf_link_record_dynamic_symbol): Likewise.
+ * elflink.h (elf_add_default_symbol): Fix comment typo.
+ (elf_add_default_symbol): Replace strcpy and strncpy with memcpy.
+ (elf_link_add_object_symbols): Likewise.
+ (elf_link_assign_sym_version): Likewise.
+ * hash.c (bfd_hash_lookup): Likewise.
+ * linker.c (_bfd_generic_link_add_one_symbol): Likewise.
+ * section.c (bfd_get_unique_section_name): Likewise.
+ * syms.c (_bfd_stab_section_find_nearest_line): Likewise.
+ * elf.c (_bfd_elf_make_section_from_phdr): Likewise.
+ (assign_section_numbers): Likewise.
+ (_bfd_elfcore_make_pseudosection): Likewise.
+ (elfcore_grok_lwpstatus): Likewise.
+ (elfcore_grok_win32pstatus): Likewise.
+ (elfcore_write_note): Constify input params. Use PTR instead of
+ void *. Include terminating NUL in namesz. Correct padding.
+ Support NULL "name" param. Use memcpy instead of strcpy.
+ (elfcore_write_prpsinfo): Constify input params.
+ (elfcore_write_prstatus): Likewise. Use PTR instead of void *.
+ (elfcore_write_lwpstatus): Likewise.
+ (elfcore_write_pstatus): Likewise.
+ (elfcore_write_prfpreg): Likewise.
+ (elfcore_write_prxfpreg): Likewise.
+ * elf-bfd.h (elfcore_write_note): Update declaration.
+ (elfcore_write_prpsinfo): Likewise.
+ (elfcore_write_prstatus): Likewise.
+ (elfcore_write_pstatus): Likewise.
+ (elfcore_write_prfpreg): Likewise.
+ (elfcore_write_prxfpreg): Likewise.
+ (elfcore_write_lwpstatus): Likewise.
+
+2002-06-25 Jason Eckhardt <jle@rice.edu>
+
+ * ecoff.c (ecoff_set_symbol_info): Set BSF_FUNCTION for
+ symbols of type stProc and stStaticProc.
+
+2002-06-25 Nick Clifton <nickc@redhat.com>
+
+ * ecoff.c: VArious formatting fixes.
+
+2002-06-25 Alan Modra <amodra@bigpond.net.au>
+
+ * coff-rs6000.c (xcoff_generate_rtinit): Fix typo.
+
+2002-06-25 Alan Modra <amodra@bigpond.net.au>
+
+ * aout-adobe.c: Don't compare against "true" or "false.
+ * aout-target.h: Likewise.
+ * aoutx.h: Likewise.
+ * archive.c: Likewise.
+ * bout.c: Likewise.
+ * cache.c: Likewise.
+ * coff-a29k.c: Likewise.
+ * coff-alpha.c: Likewise.
+ * coff-i386.c: Likewise.
+ * coff-mips.c: Likewise.
+ * coff-or32.c: Likewise.
+ * coff64-rs6000.c: Likewise.
+ * coffcode.h: Likewise.
+ * coffgen.c: Likewise.
+ * cpu-ns32k.c: Likewise.
+ * ecoff.c: Likewise.
+ * ecofflink.c: Likewise.
+ * elf.c: Likewise.
+ * elf32-arm.h: Likewise.
+ * elf32-cris.c: Likewise.
+ * elf32-d30v.c: Likewise.
+ * elf32-i386.c: Likewise.
+ * elf32-mcore.c: Likewise.
+ * elf32-ppc.c: Likewise.
+ * elf32-sh.c: Likewise.
+ * elf32-sh64.c: Likewise.
+ * elf32-v850.c: Likewise.
+ * elf64-alpha.c: Likewise.
+ * elf64-sh64.c: Likewise.
+ * elfcode.h: Likewise.
+ * elfcore.h: Likewise.
+ * elflink.h: Likewise.
+ * elfxx-mips.c: Likewise.
+ * i386os9k.c: Likewise.
+ * ieee.c: Likewise.
+ * libbfd.c: Likewise.
+ * linker.c: Likewise.
+ * mmo.c: Likewise.
+ * nlm32-alpha.c: Likewise.
+ * nlm32-i386.c: Likewise.
+ * nlm32-ppc.c: Likewise.
+ * nlm32-sparc.c: Likewise.
+ * nlmcode.h: Likewise.
+ * oasys.c: Likewise.
+ * pdp11.c: Likewise.
+ * peicode.h: Likewise.
+ * reloc.c: Likewise.
+ * som.c: Likewise.
+ * srec.c: Likewise.
+ * tekhex.c: Likewise.
+ * vms.c: Likewise.
+ * xcofflink.c: Likewise.
+ * elf64-sparc.c: Edit comment to not use "== false".
+
+ * aoutf1.h: Don't use "? true : false".
+ * ecoff.c: Likewise.
+ * format.c: Likewise.
+ * ieee.c: Likewise.
+ * linker.c: Likewise.
+ * mmo.c: Likewise.
+ * oasys.c: Likewise.
+
+2002-06-23 H.J. Lu <hjl@gnu.org>
+
+ * elflink.h (elf_link_add_archive_symbols): For the default
+ version, check references with only one `@' first.
+
+2002-06-23 John David Anglin <dave@hiauly1.hia.nrc.ca>
+
+ * elf64-hppa.c (elf64_hppa_mark_milli_and_exported_functions): New
+ function.
+ (allocate_global_data_dlt): Don't add millicode symbols to dynamic
+ symbol table.
+ (allocate_global_data_opd, allocate_dynrel_entries): Likewise.
+ (elf64_hppa_size_dynamic_sections): Revise to use
+ elf64_hppa_mark_milli_and_exported_functions.
+ (elf64_hppa_finish_dynamic_symbol): Remove code to keep millicode
+ symbols out of dynamic symbol table.
+
+2002-06-23 Alan Modra <amodra@bigpond.net.au>
+
+ * Makefile.in: Regenerate.
+ * libbfd.h: Regenerate.
+ * bfd-in2.h: Regenerate.
+ * configure: Regenerate.
+ * po/SRC-POTFILES.in: Regenerate.
+
+ * elflink.h: Comment typo fixes.
+
+2002-06-23 H.J. Lu <hjl@gnu.org>
+
+ * elf-bfd.h (elf_link_loaded_list): New structure.
+ (elf_link_hash_table): Add "loaded".
+ * elf.c (_bfd_elf_link_hash_table_init): Initialize "loaded".
+ * elflink.h (elf_link_check_versioned_symbol): New function.
+ (elf_link_output_extsym): Call elf_link_check_versioned_symbol.
+
+2002-06-19 Nick Clifton <nickc@cambridge.redhat.com>
+
+ * elflink.h (size_dynamic_sections): If the target does not
+ support an ELF style hash table, return true, indicating that
+ nothing needed to be done, rather than false, indicating that the
+ section's size could not be computed.
+
+2002-06-18 Dave Brolley <brolley@redhat.com>
+
+ From Catherine Moore, Michael Meissner, Dave Brolley:
+ * po/SRC-POTFILES.in: Add cpu-frv.c and elf32-frv.c
+ * targets.c: Support bfd_elf32_frv_vec.
+ * reloc.c: Add FRV relocs.
+ * configure.in: Add support for bfd-elf32-frv-vec.
+ * config.bfd (targ_cpu): Add support for frv-*-elf.
+ * archures.c: Add frv arch and machines.
+ * Makefile.am (ALL_MACHINES): Add cpu-frv.lo.
+ (ALL_MACHINES_CFILES): Add cpu-frv.c.
+ (BFD32_BACKENDS): Add elf32-frv.lo.
+ (BFD32_BACKENDS_CFILES): Add elf32-frv.c
+ (cpu-frv.lo): New target.
+ (elf32-frv.lo): New target.
+ * cpu-frv.c: New file.
+ * elf32-frv.c: New file.
+
+2002-06-18 Jakub Jelinek <jakub@redhat.com>
+
+ * elfcode.h (elf_object_p): Sanity check eh_shoff == 0 implies
+ e_shnum == 0.
+ Only read the first section header if e_shoff is non-zero.
+ Don't consider e_shstrndx if there are no sections.
+
+2002-06-17 Tom Rix <trix@redhat.com>
+
+ * elf32-d10v.c (elf_d10v_howto_table): Change R_D10V_10_PCREL_R,
+ R_D10V_10_PCREL_L and R_D10V_18_PCREL to use
+ complain_overflow_bitfield.
+
+2002-06-17 Alan Modra <amodra@bigpond.net.au>
+
+ * opncls.c (bfd_openr): Remove redundant bfd_set_error.
+ (bfd_fdopenr): Likewise.
+ (bfd_openstreamr): Likewise.
+ (bfd_openw): Likewise.
+
+ * targets.c: Sort target vecs.
+ (_bfd_target_vector): Add aix5coff64_vec, bfd_elf32_sh64_vec,
+ bfd_elf32_sh64l_vec, bfd_elf32_sh64lnbsd_vec,
+ bfd_elf32_sh64nbsd_vec, bfd_elf64_sh64_vec, bfd_elf64_sh64l_vec,
+ bfd_elf64_sh64lnbsd_vec, bfd_elf64_sh64nbsd_vec.
+ * configure.in: Sort target vecs. Add m88kmach3_vec.
+ * configure: Regenerate.
+
+2002-06-16 Hans-Peter Nilsson <hp@bitrange.com>
+
+ * elf64-mmix.c (bpo_reloc_request_sort_fn): Use member
+ bpo_reloc_no to break sort order ties, not address of items.
+
+2002-06-16 John David Anglin <dave@hiauly1.hia.nrc.ca>
+
+ * elf-hppa.h (elf_hppa_final_link): Fix formatting in comment.
+ Skip excluded sections in determing __gp value.
+ (elf_hppa_final_link_relocate): Use the symbol's address in
+ R_PARISC_FPTR64 relocations that don't need an opd entry.
+ * elf64-hppa.c (allocate_dynrel_entries): Simplify code.
+ (elf64_hppa_finalize_dynreloc): Likewise.
+ (elf64_hppa_size_dynamic_sections): Move comments and fix typo.
+ (elf64_hppa_finish_dynamic_symbol): Break up assert.
+
+2002-06-14 Sergey Grigoriev <serge@leopold.Physik.Uni-Augsburg.DE>
+
+ * pei-i386.c (COFF_SECTION_ALIGNMENT_ENTRIES): Enable 16 byte
+ alignment for .bss, .data and .text sections so that sse and sse2
+ code will work.
+ * pe-i386.c (COFF_SECTION_ALIGNMENT_ENTRIES): Likewise.
+
+2002-06013 J"orn Rennecke <joern.rennecke@superh.com>
+
+ config.bfd: Add support for sh[1234]l*-*-elf* | sh3el*-*-elf*,
+ sh[1234]*-elf*.
+
+2002-06-12 John David Anglin <dave@hiauly1.hia.nrc.ca>
+
+ * elflink.h (elf_bfd_final_link): Improve error handling for missing
+ dynamic sections.
+
+ * elf64-hppa.c (allocate_global_data_opd): We don't need an opd entry
+ for a symbol that has no output section.
+ (allocate_dynrel_entries): Correct comment.
+ (elf64_hppa_finalize_dynreloc): Likewise. Don't create an opd entry
+ unless we want one.
+ (elf64_hppa_finalize_opd): Prevent segfault if dyn_h is NULL.
+ (elf64_hppa_finalize_dlt): Likewise. Prevent segfault for symbols
+ with no section. Remove unnecessary parentheses.
+
+2002-06-11 Tom Rix <trix@redhat.com>
+
+ * coffcode.h (coff_compute_section_file_positions): Add data
+ section to AIX loader alignment check.
+
+ * coff-rs6000.c (_bfd_xcoff_mkobject): Set default text section
+ alignment to 4 bytes.
+ (_bfd_xcoff_copy_private_bfd_data): Use text and data alignment
+ power accessor macro.
+ (do_shared_object_padding): Remove invalid assertion.
+
+2002-06-10 Richard Sandiford <rsandifo@redhat.com>
+
+ * section.c (_bfd_strip_section_from_output): Set SEC_EXCLUDE
+ for removed output sections.
+
+2002-06-10 Geoffrey Keating <geoffk@redhat.com>
+
+ * merge.c (merge_strings): Use htab_create_alloc with calloc, not
+ htab_alloc.
+ * elf-strtab.c (_bfd_elf_strtab_finalize): Likewise.
+
+2002-06-08 H.J. Lu <hjl@gnu.org>
+
+ * elf.c (copy_private_bfd_data): Don't cast to bfd_size_type to
+ work around a long long bug in gcc 2.96 on mips.
+
+2002-06-08 Jason Thorpe <thorpej@wasabisystems.com>
+
+ * Makefile.am (BFD32_BACKENDS): Add vax1knetbsd.lo.
+ (BFD32_BACKENDS_CFILES): Add vax1knetbsd.c.
+ Regenerate dependency lists.
+ * Makefile.in: Regenerate.
+ * config.bfd (vax-*-netbsdelf*, vax-*-netbsdaout*): Add
+ vax1knetbsd_vec to targ_selvecs.
+ * configure.in: Add vax1knetbsd_vec.
+ * configure: Regenerate.
+ * targets.c (_bfd_target_vector): Add vax1knetbsd_vec.
+ * vax1knetbsd.c: New file.
+ * vaxnetbsd.c: Update copyright years.
+ (TARGET_PAGE_SIZE): Set to 0x1000.
+ (DEFAULT_MID): Set to M_VAX4K_NETBSD.
+
+2002-06-08 Matt Thomas <matt@3am-software.com>
+
+ * libaout.h (enum machine_type): Add M_VAX4K_NETBSD.
+
+2002-06-08 Alan Modra <amodra@bigpond.net.au>
+
+ * elf64-sh64.c (sh64_elf64_link_output_symbol_hook): Make static.
+
+2002-06-08 Alan Modra <amodra@bigpond.net.au>
+
+ * Makefile.am: Run "make dep-am".
+ * Makefile.in: Regenerate.
+
+ * armnetbsd.c: Replace CONST with const.
+ * corefile.c: Likewise.
+ * elf32-dlx.c: Likewise.
+ * elf64-mips.c: Likewise.
+ * mmo.c: Likewise.
+ * ns32knetbsd.c: Likewise.
+
+ * elf64-sparc.c (sparc64_elf_add_symbol_hook): Check the hash
+ table is elf64-sparc.
+
+2002-06-08 Thiemo Seufer <seufer@csv.ica.uni-stuttgart.de>
+
+ * elfxx-mips.c (_bfd_mips_elf_relocate_section): Simplify code.
+ Fix RELA addends to get not shifted in the result. Don't do special
+ handling of R_MIPS_64 for NewABI.
+
+2002-06-07 Alan Modra <amodra@bigpond.net.au>
+
+ * aoutx.h (NAME(aout,slurp_symbol_table)): Use bfd_zmalloc.
+ (NAME(aout,slurp_reloc_table)): Likewise.
+ * coff-mips.c (mips_relax_section): Use bfd_zalloc.
+ * coff-rs6000.c (xcoff_write_armap_big): Use bfd_zmalloc.
+ (xcoff_write_archive_contents_big): Likewise.
+ (xcoff_generate_rtinit): Likewise.
+ (xcoff_generate_rtinit): Likewise, and check error return.
+ * coff64-rs6000.c (xcoff64_generate_rtinit): Likewise.
+ * coffgen.c (coff_section_symbol): Use bfd_zalloc.
+ (coff_get_normalized_symtab): Likewise.
+ (coff_make_empty_symbol): Likewise.
+ (bfd_coff_set_symbol_class): Likewise.
+ * cofflink.c (coff_link_add_symbols): Likewise.
+ * ecoff.c (_bfd_ecoff_make_empty_symbol): Likewise.
+ * ecofflink.c (ecoff_write_shuffle): Use bfd_zmalloc.
+ (bfd_ecoff_write_accumulated_debug): Likewise.
+ * elf64-alpha.c (get_got_entry): Use bfd_zalloc.
+ * i386linux.c (bfd_i386linux_size_dynamic_sections): Likewise.
+ * i386lynx.c (NAME(lynx,slurp_reloc_table)): Use bfd_zmalloc.
+ * ieee.c (do_with_relocs): Use bfd_zalloc.
+ * m68klinux.c (bfd_m68klinux_size_dynamic_sections): Likewise.
+ * pdp11.c (NAME(aout,slurp_symbol_table)): Use bfd_zmalloc.
+ (NAME(aout,slurp_reloc_table)): Likewise.
+ (NAME(aout,squirt_out_relocs)): Don't memset when zalloc'd.
+ * reloc16.c (bfd_coff_reloc16_relax_section): Use bfd_zmalloc.
+ * som.c (som_build_and_write_symbol_table): Likewise.
+ (som_slurp_string_table): Likewise.
+ (som_slurp_symbol_table): Likewise.
+ (som_bfd_ar_write_symbol_stuff): Likewise.
+ * sparclinux.c (bfd_sparclinux_size_dynamic_sections): Use bfd_zalloc.
+ * sunos.c (bfd_sunos_size_dynamic_sections): Likewise.
+ * tekhex.c (find_chunk): Likewise. Get rid of unused "sname".
+ * vms-gsd.c (_bfd_vms_slurp_gsd): Use bfd_zmalloc.
+ * xcofflink.c (xcoff_link_add_symbols): Use bfd_zalloc/bfd_zmalloc.
+
+2002-06-07 Alan Modra <amodra@bigpond.net.au>
+
+ * elf-bfd.h (struct bfd_elf_section_data <group_name>): Replace with
+ "group" union.
+ (elf_group_name): Update.
+ (elf_group_id): Define.
+ (bfd_elf_set_group_contents): Declare.
+ * elf.c (elf_fake_sections): Qualify use of elf_group_name.
+ (set_group_contents): Rename to bfd_elf_set_group_contents. Remove
+ ATTRIBUTE_UNUSED from failedptrarg. If elf_group_id is set, use
+ that sym for the signature.
+ (_bfd_elf_compute_section_file_positions): Don't call
+ set_group_contents for "ld -r" case.
+ (swap_out_syms): Use bfd_zalloc.
+ * elflink.h (elf_link_add_archive_symbols): Likewise.
+ (NAME(bfd_elf,size_dynamic_sections)): Likewise.
+ (elf_bfd_final_link): Call bfd_elf_set_group_contents.
+
+2002-06-07 Alan Modra <amodra@bigpond.net.au>
+
+ * elf64-ppc.c (ppc64_elf_relocate_section): Allow unresolved
+ relocs in opd for non-shared too.
+
+2002-06-06 Jeffrey Law <law@redhat.com>
+
+ * elf32-h8300.c (elf32_h8_relax_section): Ignore uninteresting
+ relocations.
+
+2002-06-06 Nick Clifton <nickc@cambridge.redhat.com>
+
+ * merge.c: Include libiberty.h.
+ * elf-strtab.c: Include libiberty.h.
+
+2002-06-06 Elias Athanasopoulos <eathan@otenet.gr>
+
+ * peXXigen.c (pe_print_idata): Remove unused variable.
+
+2002-06-06 David Heine <dlheine@tensilica.com>
+
+ * elf.c (assign_file_positions_for_segments): Remove unallocated
+ sections from the section to segment mapping for PT_LOAD segments.
+ Update comment about empty loadable segments.
+
+2002-06-06 Richard Sandiford <rsandifo@redhat.com>
+
+ * stabs.c (_bfd_link_section_stabs): Check that the symbol offset
+ is within the .stabstr section.
+
+2002-06-06 Alan Modra <amodra@bigpond.net.au>
+
+ * elf-bfd.h (struct elf_size_info <swap_symbol_in>): Function args
+ are "const PTR", not "const PTR *".
+ (bfd_elf32_swap_symbol_in): Likewise.
+ (bfd_elf64_swap_symbol_in): Likewise.
+ * elfcode.h (elf_swap_symbol_in): Change input args to const PTR.
+ (elf_slurp_symbol_table): Adjust call to elf_swap_symbol_in.
+ * elflink.h (elf_link_is_defined_archive_symbol): Likewise.
+ (elf_link_add_object_symbols): Likewise.
+ (elf_link_record_local_dynamic_symbol): Likewise.
+ (elf_link_input_bfd): Likewise.
+ (elf_gc_mark): Likewise.
+ (elf_reloc_symbol_deleted_p): Likewise.
+ * elf-m10200.c (mn10200_elf_relax_section): Likewise.
+ (mn10200_elf_relax_delete_bytes): Likewise.
+ (mn10200_elf_symbol_address_p): Likewise.
+ (mn10200_elf_get_relocated_section_contents): Likewise.
+ * elf-m10300.c (mn10300_elf_relax_section): Likewise.
+ (mn10300_elf_relax_section): Likewise.
+ (mn10300_elf_relax_delete_bytes): Likewise.
+ (mn10300_elf_symbol_address_p): Likewise.
+ (mn10300_elf_get_relocated_section_contents): Likewise.
+ * elf32-h8300.c (elf32_h8_relax_section): Likewise.
+ (elf32_h8_relax_delete_bytes): Likewise.
+ (elf32_h8_symbol_address_p): Likewise.
+ (elf32_h8_get_relocated_section_contents): Likewise.
+ * elf32-hppa.c (get_local_syms): Likewise.
+ * elf32-m68k.c (bfd_m68k_elf32_create_embedded_relocs): Likewise.
+ * elf32-mips.c (bfd_mips_elf32_create_embedded_relocs): Likewise.
+ * elf32-sh.c (sh_elf_relax_section): Likewise.
+ (sh_elf_relax_delete_bytes): Likewise.
+ (sh_elf_get_relocated_section_contents): Likewise.
+ * elf32-xstormy16.c (xstormy16_elf_relax_section): Likewise.
+ * elf64-alpha.c (elf64_alpha_relax_section): Likewise.
+ * elf64-hppa.c (elf64_hppa_check_relocs): Likewise.
+ * elf64-mmix.c (mmix_elf_relax_section): Likewise.
+ * elf64-ppc.c (get_local_syms): Likewise.
+ * elf64-sh64.c (sh_elf64_get_relocated_section_contents): Likewise.
+ * elfxx-ia64.c (elfNN_ia64_relax_section): Likewise.
+
+2002-06-05 J"orn Rennecke <joern.rennecke@superh.com>
+
+ * config.bfd (sh64l*-*-elf*, shl*-*-elf*): New configurations.
+
+2002-06-05 Alan Modra <amodra@bigpond.net.au>
+
+ * elf.c (group_signature): Swap in the whole symbol, and handle
+ extracting section symbol names.
+ (setup_group): Add comment.
+ (set_group_contents): When called from objcopy or ld, arrange for
+ section contents to be written. Write group member output section
+ indices to allow objcopy to reorganize sections.
+ (_bfd_elf_copy_private_section_data): Copy group info.
+
+ * elf-bfd.h (struct elf_size_info): Add swap_symbol_in field.
+ (bfd_elf32_swap_symbol_in): Update prototype.
+ (bfd_elf64_swap_symbol_in): Likewise.
+ * elfcode.h (elf_swap_symbol_in): Change input args to const PTR *.
+ (elf_slurp_symbol_table): Adjust call to elf_swap_symbol_in.
+ * elflink.h (elf_link_is_defined_archive_symbol): Likewise.
+ (elf_link_add_object_symbols): Likewise.
+ (elf_link_record_local_dynamic_symbol): Likewise.
+ (elf_link_input_bfd): Likewise.
+ (elf_gc_mark): Likewise.
+ (elf_reloc_symbol_deleted_p): Likewise.
+ * elf-m10200.c (mn10200_elf_relax_section): Likewise.
+ (mn10200_elf_relax_delete_bytes): Likewise.
+ (mn10200_elf_symbol_address_p): Likewise.
+ (mn10200_elf_get_relocated_section_contents): Likewise.
+ * elf-m10300.c (mn10300_elf_relax_section): Likewise.
+ (mn10300_elf_relax_section): Likewise.
+ (mn10300_elf_relax_delete_bytes): Likewise.
+ (mn10300_elf_symbol_address_p): Likewise.
+ (mn10300_elf_get_relocated_section_contents): Likewise.
+ * elf32-h8300.c (elf32_h8_relax_section): Likewise.
+ (elf32_h8_relax_delete_bytes): Likewise.
+ (elf32_h8_symbol_address_p): Likewise.
+ (elf32_h8_get_relocated_section_contents): Likewise.
+ * elf32-hppa.c (get_local_syms): Likewise.
+ * elf32-m68k.c (bfd_m68k_elf32_create_embedded_relocs): Likewise.
+ * elf32-mips.c (bfd_mips_elf32_create_embedded_relocs): Likewise.
+ * elf32-sh.c (sh_elf_relax_section): Likewise.
+ (sh_elf_relax_delete_bytes): Likewise.
+ (sh_elf_get_relocated_section_contents): Likewise.
+ * elf32-xstormy16.c (xstormy16_elf_relax_section): Likewise.
+ * elf64-alpha.c (elf64_alpha_relax_section): Likewise.
+ * elf64-hppa.c (elf64_hppa_check_relocs): Likewise.
+ * elf64-mmix.c (mmix_elf_relax_section): Likewise.
+ * elf64-ppc.c (get_local_syms): Likewise.
+ * elf64-sh64.c (sh_elf64_get_relocated_section_contents): Likewise.
+ * elfxx-ia64.c (elfNN_ia64_relax_section): Likewise.
+ * elfcode.h (NAME(_bfd_elf,size_info)): Update initialiser.
+ * elf64-alpha.c (alpha_elf_size_info): Likewise.
+ * elf64-hppa.c (hppa64_elf_size_info): Likewise.
+ * elf64-mips.c (mips_elf64_size_info): Likewise.
+ * elf64-s390.c (s390_elf64_size_info): Likewise.
+ * elf64-sparc.c (sparc64_elf_size_info): Likewise.
+
+2002-06-05 Maciej W. Rozycki <macro@ds2.pg.gda.pl>
+
+ * elf32-mips.c (elf32_mips_ignore_discarded_relocs): Move to...
+ elfxx-mips.c (_bfd_mips_elf_ignore_discarded_relocs): ... here.
+ elf64-mips.c (elf_backend_ignore_discarded_relocs): Use
+ _bfd_mips_elf_ignore_discarded_relocs.
+ elfxx-mips.h (_bfd_mips_elf_ignore_discarded_relocs): Declare.
+
+2002-06-05 H.J. Lu <hjl@gnu.org>
+
+ * elfxx-mips.c (mips_elf_calculate_relocation): Call
+ _bfd_elf_rel_local_sym for STT_SECTION relocations against
+ the SEC_MERGE section.
+
+2002-06-05 Alan Modra <amodra@bigpond.net.au>
+
+ * coff-alpha.c: Update copyright date.
+ * coff-mips.c: Likewise.
+ * xcoff-target.h: Likewise.
+
+ * bfd-in.h: Remove "taken from the source" comment.
+ * libbfd-in.h: Likewise.
+ * libcoff-in.h: Likewise.
+ * bfd-in2.h: Regenerate.
+ * libbfd.h: Regenerate.
+ * libcoff.h: Regenerate.
+
+ * elf.c (bfd_elf_discard_group): Return true.
+ * elf-bfd.h (bfd_elf_discard_group): Declare.
+ * bfd-in.h (bfd_elf_discard_group): Don't declare here.
+ * section.c (bfd_discard_group): Rename to bfd_generic_discard_group.
+ * bfd.c (bfd_discard_group): Define.
+ * targets.c (struct bfd_target): Add _bfd_discard_group.
+ (BFD_JUMP_TABLE_LINK): Here too.
+ * libbfd-in.h (_bfd_nolink_bfd_discard_group): Define.
+ * aout-adobe.c (aout_32_bfd_discard_group): Define.
+ * aout-target.h (MY_bfd_discard_group): Define.
+ * aout-tic30.c (MY_bfd_discard_group): Define.
+ * binary.c (binary_bfd_discard_group): Define.
+ * bout.c (b_out_bfd_discard_group): Define.
+ * coff-alpha.c (_bfd_ecoff_bfd_discard_group): Define.
+ * coffcode.h (coff_bfd_discard_group): Define.
+ * coff-mips.c (_bfd_ecoff_bfd_discard_group): Define.
+ * elfxx-target.h (bfd_elfNN_bfd_discard_group): Define.
+ * i386msdos.c (msdos_bfd_discard_group): Define.
+ * i386os9k.c (os9k_bfd_discard_group): Define.
+ * ieee.c (ieee_bfd_discard_group): Define.
+ * ihex.c (ihex_bfd_discard_group): Define.
+ * mmo.c (mmo_bfd_discard_group): Define.
+ * nlm-target.h (nlm_bfd_discard_group): Define.
+ * oasys.c (oasys_bfd_discard_group): Define.
+ * ppcboot.c (ppcboot_bfd_discard_group): Define.
+ * som.c (som_bfd_discard_group): Define.
+ * srec.c (srec_bfd_discard_group): Define.
+ * tekhex.c (tekhex_bfd_discard_group): Define.
+ * versados.c (versados_bfd_discard_group): Define.
+ * vms.c (vms_bfd_discard_group): Define.
+ * xcoff-target.h (_bfd_xcoff_bfd_discard_group): Define.
+ * coff64-rs6000.c (rs6000coff64_vec): Update initialiser.
+ (aix5coff64_vec): Likewise.
+ * coff-rs6000.c (rs6000coff_vec, pmac_xcoff_vec): Likewise.
+
+2002-06-04 Jason Thorpe <thorpej@wasabisystems.com>
+
+ * Makefile.am (BFD32_BACKENDS): Add elf32-sh64-com.lo.
+ (BFD32_BACKENDS_CFILES): Add elf32-sh64-com.c.
+ (elf32-sh64-com.lo): New dependency list.
+ * Makefile.in: Regenerate.
+ * configure.in (bfd_elf32_sh64_vec, bfd_elf32_sh64l_vec)
+ (bfd_elf32_sh64nbsd_vec, bfd_elf32_sh64lnbsd_vec): Add
+ elf32-sh64-com.lo.
+ * configure: Regenerate.
+ * elf32-sh64.c (sh64_address_in_cranges)
+ (sh64_get_contents_type, sh64_address_is_shmedia): Move to...
+ (crange_qsort_cmpb, crange_qsort_cmpl, crange_bsearch_cmpb):
+ (crange_bsearch_cmpl): Prepend _bfd_sh64_ to name and move to...
+ * elf32-sh64-com.c: ...here. New file.
+
+2002-06-04 Alan Modra <amodra@bigpond.net.au>
+
+ * elf32-openrisc.c (openrisc_elf_gc_mark_hook): Remove
+ ATTRIBUTE_UNUSED on used params.
+ * elf32-vax.c (elf_vax_gc_mark_hook): Remove unnecessary checks
+ before calling bfd_section_from_elf_index on local syms.
+ * elf64-sh64.c (sh_elf64_gc_mark_hook): Likewise.
+
+2002-06-04 Jason Thorpe <thorpej@wasabisystems.com>
+
+ * Makefile.am (BFD32_BACKENDS): Add elf32-sh64-nbsd.lo.
+ (BFD32_BACKENDS_CFILES): Add elf32-sh64-nbsd.c.
+ (BFD64_BACKENDS): Add elf64-sh64-nbsd.lo.
+ (BFD64_BACKENDS_CFILES): Add elf64-sh64-nbsd.c.
+ (elf32-sh64-nbsd.lo, elf64-sh64-nbsd.lo): New rules.
+ * Makefile.in: Regenerate.
+ * config.bfd (sh5le-*-netbsd*, sh5-*-netbsd*, sh64le-*-netbsd*)
+ (sh64-*-netbsd*): New targets.
+ * configure.in: Add bfd_elf32_sh64nbsd_vec, bfd_elf32_sh64lnbsd_vec,
+ bfd_elf64_sh64nbsd_vec, and bfd_elf64_sh64lnbsd_vec.
+ * configure: Regenerate.
+ * elf32-sh64-nbsd.c: New file.
+ * elf64-sh64-nbsd.c: New file.
+ * targets.c: Add extern decls for bfd_elf32_sh64nbsd_vec,
+ bfd_elf32_sh64lnbsd_vec, bfd_elf64_sh64nbsd_vec, and
+ bfd_elf64_sh64lnbsd_vec.
+
+2002-06-04 Alan Modra <amodra@bigpond.net.au>
+
+ * elf.c (setup_group): Set SEC_LINK_ONCE on GRP_COMDAT groups.
+ (bfd_section_from_shdr): Likewise. Set section name of group
+ sections from signature.
+ (group_signature): Split out from setup_group. Ensure symbol table
+ is available.
+ (bfd_elf_discard_group): New function.
+ (_bfd_elf_make_section_from_shdr): Don't set SEC_LINK_ONCE on
+ .gnu.linkonce* sections if they are members of a group.
+ (set_group_contents): Set GRP_COMDAT flag.
+ * section.c (bfd_discard_group): New function.
+ * bfd-in.h (bfd_elf_discard_group): Declare.
+ * bfd-in2.h: Regenerate.
+ * elf-bfd.h (struct bfd_elf_section_data): Add linkonce_p field.
+ (elf_linkonce_p): Define.
+
+2002-06-04 Alan Modra <amodra@bigpond.net.au>
+
+ * elf.c (bfd_section_from_shdr): Make "name" const.
+ * elf-bfd.h (elf_backend_section_from_shdr): Likewise.
+ * elf32-i370.c (i370_elf_section_from_shdr): Likewise.
+ * elf32-ppc.c (ppc_elf_section_from_shdr): Likewise.
+ * elf32-sh64.c (sh64_backend_section_from_shdr): Likewise.
+ * elf32-v850.c (v850_elf_section_from_shdr): Likewise.
+ * elf64-alpha.c (elf64_alpha_section_from_shdr): Likewise.
+ * elf64-hppa.c (elf64_hppa_section_from_shdr): Likewise.
+ * elf64-ppc.c (ppc64_elf_section_from_shdr): Likewise.
+ * elfxx-ia64.c (elfNN_ia64_section_from_shdr): Likewise.
+ * elfxx-mips.c (_bfd_mips_elf_section_from_shdr): Likewise.
+ * elfxx-mips.h (_bfd_mips_elf_section_from_shdr): Likewise.
+
+2002-06-03 Maciej W. Rozycki <macro@ds2.pg.gda.pl>
+
+ * elfxx-mips.c (ABI_64_P): Use backend's data to determine the
+ ABI.
+
+2002-06-02 Kazu Hirata <kazu@cs.umass.edu>
+
+ * elf32-arc.c: Fix formatting.
+ * elf32-arm.h: Likewise.
+ * elf32-cris.c: Likewise.
+ * elf32-dlx.c: Likewise.
+ * elf32-hppa.c: Likewise.
+ * elf32-i386.c: Likewise.
+ * elf32-i386qnx.c: Likewise.
+ * elf32-or32.c: Likewise.
+ * elf32-s390.c: Likewise.
+ * elf32-sh64.c: Likewise.
+ * elf32-vax.c: Likewise.
+ * elf32-xstormy16.c: Likewise.
+ * elf64-alpha.c: Likewise.
+ * elf64-mmix.c: Likewise.
+ * elf64-ppc.c: Likewise.
+ * elf64-s390.c: Likewise.
+ * elf64-sh64.c: Likewise.
+ * elf64-x86-64.c: Likewise.
+
+2002-06-02 Richard Henderson <rth@redhat.com>
+
+ * elf64-alpha.c (elf64_alpha_relocate_section): Don't dereference
+ null when there are no got entries for a symbol.
+ (elf64_alpha_relax_find_tls_segment): Rearrange to avoid
+ uninitialized variable warning.
+
+2002-06-01 Richard Henderson <rth@redhat.com>
+
+ * elf64-alpha.c (elf64_alpha_relax_with_lituse): Don't test for
+ undefined symbols here.
+ (elf64_alpha_relax_section): Do it here. Also test for not
+ defined in the current module.
+ (elf64_alpha_relocate_section_r): Split out of ...
+ (elf64_alpha_relocate_section): ... here. Don't dereference
+ NULL when looking up local got entries.
+
+2002-06-01 Richard Henderson <rth@redhat.com>
+
+ * elf64-alpha.c (elf64_alpha_relax_with_lituse): Reject undefined
+ symbols from JSR relaxation.
+ (elf64_alpha_size_plt_section_1): New.
+ (elf64_alpha_calc_dynrel_sizes): Split out .rela.got bits ...
+ (elf64_alpha_size_rela_got_1): ... here.
+ (elf64_alpha_size_dynamic_sections): Split out .rela.got bits ...
+ (elf64_alpha_size_rela_got_section): ... here.
+ (elf64_alpha_size_plt_section): New.
+ (elf64_alpha_relax_section): Call them.
+ (elf64_alpha_size_got_sections): Remove output_bfd arg.
+ (elf64_alpha_finish_dynamic_symbol): Check gotent use_count.
+
+2002-06-01 Richard Henderson <rth@redhat.com>
+
+ * elf64-alpha.c (alpha_get_dtprel_base, alpha_get_tprel_base): New.
+ (elf64_alpha_relocate_section): Use them. Reject LE TLS relocs
+ in shared libraries. Fix DTPRELHI and TPRELHI value.
+ (INSN_ADDQ, INSN_RDUNIQ): New.
+ (struct alpha_relax_info): Add symtab_hdr, tls_segment, first_gotent.
+ (elf64_alpha_relax_with_lituse): Return boolean. Remove irelend
+ argument. Reject dynamic symbols. Use LITUSE symbolic constants.
+ (elf64_alpha_relax_got_load): Rename from relax_without_lituse.
+ Handle GOTDTPREL and GOTTPREL relocations.
+ (elf64_alpha_relax_gprelhilo): New.
+ (elf64_alpha_relax_tls_get_addr): New.
+ (elf64_alpha_relax_find_tls_segment): New.
+ (elf64_alpha_relax_section): Handle TLS relocations.
+ (ALPHA_ELF_LINK_HASH_TLS_IE): New.
+ (elf64_alpha_check_relocs): Set it.
+
+2002-06-01 Richard Henderson <rth@redhat.com>
+
+ * elf64-alpha.c (elf64_alpha_relax_section): Don't store computed gp.
+
+ * elf64-alpha.c (elf64_alpha_check_relocs): Fix typo on maybe_dynamic
+ check; don't suppress dynamic relocs for non-allocated sections.
+
+ * elf64-alpha.c: Remove dead code.
+
+2002-05-31 Alan Modra <amodra@bigpond.net.au>
+
+ * bfd-in2.h: Regenerate.
+ * libbfd.h: Regenerate.
+ * po/SRC-POTFILES.in: Regenerate.
+
+ * elf64-ppc.c (ppc64_elf_size_dynamic_sections): Don't allocate
+ space for bss .plt.
+
+2002-05-31 Graeme Peterson <gp@qnx.com>
+
+ * Makefile.am (BFD32_BACKENDS): Add elf32-i386qnx.lo.
+ (BFD32_BACKENDS_CFILES): Add elf32-i386qnx.c.
+ Run "make dep-am".
+ * Makefile.in: Regenerate.
+ * config.bfd: Add i[3456]86-*-nto-qnx* support.
+ * configure.in: Add bfd_elf32_i386qnx_vec support.
+ * configure: Regenerate.
+ * elf-bfd.h (struct elf_backend_data): Add set_nonloadable_filepos,
+ is_contained_by_filepos, and copy_private_bfd_data_p.
+ * elf.c (assign_file_positions_for_segments): Call backend
+ set_nonloadable_filepos. Fix non-K&R call to _bfd_error_handler.
+ (IS_CONTAINED_BY_FILEPOS): Define.
+ (INCLUDE_SECTION_IN_SEGMENT): Also test IS_CONTAINED_BY_FILEPOS.
+ (copy_private_bfd_data): Use IS_CONTAINED_BY_FILEPOS. Typo fix.
+ Fix non-K&R call to _bfd_error_handler.
+ (_bfd_elf_copy_private_section_data): Use backend
+ copy_private_bfd_data_p.
+ * elf32-i386.c: Don't include elfxx-target.h when
+ ELF32_I386_C_INCLUDED is defined.
+ * elf32-i386qnx.c: New QNX elf backend file.
+ * elfxx-target.h: Add elf_backend_set_nonloadable_filepos,
+ elf_backend_is_contained_by_filepos, and
+ elf_backend_do_copy_private_bfd_data.
+ * targets.c: Add bfd_target bfd_elf32_i386qnx_vec.
+
+2002-05-31 Alan Modra <amodra@bigpond.net.au>
+
+ * elfarm-oabi.c (bfd_elf32_arm_add_glue_sections_to_bfd): Define.
+ Move other similar defines to start of file.
+
+2002-05-30 Tom Rix <trix@redhat.com>
+
+ * coff-rs6000.c (xcoff_rtype2howto): Handle 16 bit R_RBA.
+ * coff64-rs6000.c (xcoff64_rtype2howto): Same.
+
+2002-05-30 Richard Henderson <rth@redhat.com>
+
+ * elf64-alpha.c (ALPHA_ELF_LINK_HASH_LU_TLSGD,
+ ALPHA_ELF_LINK_HASH_LU_TLSLDM, ALPHA_ELF_LINK_HASH_LU_FUNC): New.
+ (ALPHA_ELF_GOT_ENTRY_RELOCS_DONE): Remove.
+ (ALPHA_ELF_GOT_ENTRY_RELOCS_XLATED): Remove.
+ (struct alpha_elf_got_entry): Add reloc_type, reloc_done, reloc_xlated.
+ (struct alpha_elf_obj_tdata): Rename total_got_entries and
+ n_local_got_entries to total_got_size and local_got_size.
+ (elf64_alpha_howto, elf64_alpha_reloc_map): Update for TLS relocs.
+ (alpha_got_entry_size): New.
+ (elf64_alpha_relax_with_lituse): Use it.
+ (elf64_alpha_relax_without_lituse): Likewise.
+ (MAX_GOT_SIZE): Rename from MAX_GOT_ENTRIES.
+ (get_got_entry): New.
+ (elf64_alpha_check_relocs): Handle TLS relocs. Reorganize.
+ (elf64_alpha_adjust_dynamic_symbol): Test LU_FUNC as a mask.
+ (elf64_alpha_merge_ind_symbols): Check gotent->reloc_type.
+ (elf64_alpha_can_merge_gots, elf64_alpha_merge_gots): Likewise.
+ (elf64_alpha_calc_got_offsets_for_symbol): Use alpha_got_entry_size.
+ (elf64_alpha_calc_got_offsets): Likewise.
+ (alpha_dynamic_entries_for_reloc): New.
+ (elf64_alpha_calc_dynrel_sizes): Use it.
+ (elf64_alpha_size_dynamic_sections): Likewise.
+ (elf64_alpha_relocate_section): Handle TLS relocations.
+ * reloc.c: Add Alpha TLS relocations.
+ * bfd-in2.h, libbfd.h: Rebuild.
+
+2002-05-29 Ralf Habacker <ralf.habacker@freenet.de>
+
+ * peXXigen.c (pe_print_idata): Remove double printed
+ import table lines; add Bound-To comment.
+
+2002-05-29 Matt Thomas <matt@3am-software.com>
+
+ * Makefile.am (BFD32_BACKENDS): Add elf32-vax.lo.
+ (BFD32_BACKENDS_CFILES): Add elf32-vax.c.
+ (elf32-vax.lo): New rule.
+ * Makefile.in: Regenerate.
+ * configure.in (bfd_elf32_vax_vec)
+ (vaxnetbsd_vec): New vectors.
+ * configure: Regenerate.
+ * config.bfd (vax-*-netbsdelf*)
+ (vax-*-netbsdaout*)
+ (vax-*-netbsd*): New targets.
+ * elf32-vax.c: New file.
+ * reloc.c: Add VAX relocations.
+ * bfd-in2.h: Regenerate.
+ * targets.c (_bfd_target_vector): Add bfd_elf32_vax_vec.
+
+2002-05-29 Jason Thorpe <thorpej@wasabisystems.com>
+
+ * config.bfd (arm-*-netbsd*): Add bfd_elf32_littlearm_vec
+ and bfd_elf32_bigarm_vec to targ_selvecs.
+
+2002-05-29 Ralf Habacker <ralf.habacker@freenet.de>
+
+ * peXXigen.c (pe_print_idata): Fix seg faults on printing import tables
+ with auto-imported symbols.
+
+2002-05-29 Adam Nemet <anemet@lnxw.com>
+
+ * elf32-arm.h (bfd_elf32_arm_get_bfd_for_interworking): Don't add glue
+ sections only record bfd.
+ (bfd_elf32_arm_add_glue_sections_to_bfd): New function.
+ * bfd-in.h (bfd_elf32_arm_add_glue_sections_to_bfd): Declare it.
+ * bfd-in2.h: Regenerate.
+
+2002-05-28 Nick Clifton <nickc@cambridge.redhat.com>
+
+ * syms.c (_bfd_stab_section_find_nearest_line): Move
+ declaration and initialisation of saw_line and saw_func out of
+ for loop.
+
+2002-05-29 Alan Modra <amodra@bigpond.net.au>
+
+ * elf64-ppc.c (ppc64_elf_get_symbol_info): New function.
+ (bfd_elf64_get_symbol_info): Define.
+ * elfxx-target.h (bfd_elfNN_get_symbol_info): Only define if undef.
+
+2002-05-29 Andrey Volkov <avolkov@transas.com>
+
+ * cpu-h8300.c: Make default h8300 machine first in machine list.
+
+2002-05-28 Kuang Hwa Lin <kuang@sbcglobal.net>
+
+ * config.bfd: Added DLX configuraton.
+ * Makefile.am: Added DLX configuraton.
+ * configure.in: Added DLX configuraton.
+ * archures.c: Add DLX architecture.
+ * reloc.c: Add DLX relocs.
+ * targets.c: Added DLX target vector.
+ * configure: Regenerate.
+ * Makefile.in: Regenreate.
+ * bfd-in2.h: Regenreate.
+ * elf32-dlx.c: New file: Support DLX target.
+ * cpu-dlx.c: New file: Support DLX target.
+
+2002-05-25 Alan Modra <amodra@bigpond.net.au>
+
+ * elf32-m68k.c (elf32_m68k_print_private_bfd_data): Formatting.
+
+ * elf64-ppc.c (ppc64_elf_copy_indirect_symbol): Revert last change.
+ (ppc64_elf_check_relocs): Don't set up function descriptor symbol
+ strings to point inside function code sym string.
+ (func_desc_adjust): Likewise.
+ (ppc64_elf_hide_symbol): Rewrite code to look up function code sym.
+
+2002-05-24 Michal Ludvig <mludvig@suse.cz>
+
+ * elf64-x86-64.c (elf64_x86_64_grok_prstatus): Added.
+ (elf64_x86_64_grok_psinfo): Added.
+
+2002-05-24 TAMURA Kent <kent@netbsd.org>
+
+ * config.bfd: Add a target for i386-netbsdpe.
+
+2002-05-24 Alan Modra <amodra@bigpond.net.au>
+
+ * elf64-ppc.c (ppc64_elf_copy_indirect_symbol): Don't copy is_func
+ and is_func_descriptor.
+ (func_desc_adjust): Hide function code sym in shared libs unless
+ there is a matching exported function descriptor sym.
+
+2002-05-23 Jakub Jelinek <jakub@redhat.com>
+
+ * elf.c (_bfd_elf_make_section_from_shdr): Set SEC_THREAD_LOCAL
+ for symbols from SHF_TLS section.
+ (_bfd_elf_print_private_bfd_data): Add PT_TLS.
+ (elf_fake_sections): Set SHF_TLS for SEC_THREAD_LOCAL sections.
+ (map_sections_to_segments): Build PT_TLS segment if necessary.
+ (assign_file_positions_for_segments): Likewise.
+ (get_program_header_size): Account for PT_TLS segment.
+ (swap_out_syms): Set type of BSF_THREAD_LOCAL symbols and symbols from
+ SEC_THREAD_LOCAL sections to STT_TLS.
+ * reloc.c: Add 386 and IA-64 TLS relocs.
+ * section.c (SEC_THREAD_LOCAL): Define.
+ (SEC_CONSTRUCTOR_TEXT, SEC_CONSTRUCTOR_DATA, SEC_CONSTRUCTOR_BSS):
+ Remove.
+ * elflink.h (elf_link_add_object_symbols): Support .tcommon.
+ (size_dynamic_sections): If DF_STATIC_TLS, set DF_FLAGS
+ unconditionally.
+ (struct elf_final_link_info): Add first_tls_sec.
+ (elf_bfd_final_link): Set first_tls_sec.
+ Compute elf_hash_table (info)->tls_segment.
+ (elf_link_output_extsym): Handle STT_TLS symbols.
+ (elf_link_input_bfd): Likewise.
+ * syms.c (BSF_THREAD_LOCAL): Define.
+ * bfd-in2.h: Rebuilt.
+ * libbfd.h: Rebuilt.
+ * elf32-i386.c (elf_i386_tls_transition, dtpoff_base, tpoff,
+ elf_i386_mkobject, elf_i386_object_p): New functions.
+ (elf_howto_table): Add TLS relocs.
+ (elf_i386_reloc_type_lookup): Support TLS relocs.
+ (elf_i386_info_to_howto_rel): Likewise.
+ (struct elf_i386_link_hash_entry): Add tls_type.
+ (struct elf_i386_obj_tdata): New.
+ (elf_i386_hash_entry, elf_i386_tdata, elf_i386_local_got_tls_type):
+ New macros.
+ (struct elf_i386_link_hash_table): Add tls_ldm_got.
+ (link_hash_newfunc): Clear tls_type.
+ (elf_i386_check_relocs): Support TLS relocs.
+ (elf_i386_gc_sweep_hook): Likewise.
+ (allocate_dynrelocs): Likewise.
+ (elf_i386_size_dynamic_sections): Likewise.
+ (elf_i386_relocate_section): Likewise.
+ (elf_i386_finish_dynamic_symbol): Likewise.
+ (bfd_elf32_mkobject, elf_backend_object_p): Define.
+ * elfxx-ia64.c (struct elfNN_ia64_dyn_sym_info): Add tprel_offset,
+ dtpmod_offset, dtprel_offset, tprel_done, dtpmod_done, dtprel_done,
+ want_tprel, want_dtpmod, want_dtprel.
+ (elfNN_ia64_tprel_base, elfNN_ia64_dtprel_base): New functions.
+ (ia64_howto_table): Add TLS relocs, rename R_IA64_LTOFF_TP22 to
+ R_IA64_LTOFF_TPREL22.
+ (elf_code_to_howto_index): Add TLS relocs.
+ (elfNN_ia64_check_relocs): Support TLS relocs.
+ (allocate_global_data_got): Account for TLS .got data.
+ (allocate_dynrel_entries): Account for TLS dynamic relocations.
+ (elfNN_ia64_install_value): Supprt TLS relocs.
+ (set_got_entry): Support TLS relocs.
+ (elfNN_ia64_relocate_section): Likewise.
+
+2002-05-23 Nick Clifton <nickc@cambridge.redhat.com>
+
+ * elf32-arm.h (elf32_arm_final_link_relocate): For the Thumb
+ BLX reloc round the relocation up rather than down.
+ * coff-arm.c (coff_arm_relocate_section): Likewise.
+
+2002-05-21 H.J. Lu (hjl@gnu.org)
+
+ * linker.c (_bfd_generic_link_add_one_symbol): Allow multiple
+ definition.
+
+2002-05-22 Alan Modra <amodra@bigpond.net.au>
+
+ * elf64-ppc.c (ppc64_elf_size_stubs): Don't strip .branch_lt.
+ (ppc64_elf_relocate_section): Handle unresolved relocs in opd.
+
+2002-05-22 Alan Modra <amodra@bigpond.net.au>
+
+ * elf64-ppc.c (ppc64_elf_relocate_section): Return false for
+ unresolved relocs.
+ (ppc64_elf_size_dynamic_sections): Check for splt NULL.
+
+2002-05-21 Thiemo Seufer <seufer@csv.ica.uni-stuttgart.de>
+
+ * bfd.c (bfd_get_arch_size): Remove bfd_set_error call for
+ non-ELF targets.
+
+2002-05-21 Thiemo Seufer <seufer@csv.ica.uni-stuttgart.de>
+
+ * elf-bfd.h (elf_backend_emit_relocs): Change prototype to return
+ an error value.
+ * elflink.h (elf_link_output_relocs): Likewise. Improve error message.
+ return with false on error.
+ (elf_link_input_bfd): Check reloc_emitter return value.
+
+2002-05-21 Jason Thorpe <thorpej@wasabisystems.com>
+
+ * config.bfd (armeb-*-netbsdelf*): New target.
+
+2002-05-20 Alan Modra <amodra@bigpond.net.au>
+
+ * elf64-ppc.c (ppc_build_one_stub): Point undefined function syms
+ at the plt call stub.
+
+2002-05-19 Thiemo Seufer <seufer@csv.ica.uni-stuttgart.de>
+
+ * cpu-mips.c (mips_compatible): Don't try to check machine
+ compatibility.
+
+2002-05-18 Tom Rix <trix@redhat.com>
+
+ * coff64-rs6000.c (_bfd_xcoff64_swap_aux_out): Fix C_FILE auxent.
+
+2002-05-17 Alan Modra <amodra@bigpond.net.au>
+
+ * elf64-ppc.c (ppc64_elf_info_to_howto): Formatting.
+ (ppc64_elf_relocate_section): Don't warn about reloc overflow when
+ we've already warned about an undefined symbol. Report more
+ detail on reloc errors.
+
+2002-05-17 Alan Modra <amodra@bigpond.net.au>
+
+ * acinclude.m4 (AM_INSTALL_LIBBFD): New.
+ * configure.in: Invoke AM_INSTALL_LIBBFD.
+ * Makefile.am (install-data-local): Revert 2002-05-13. Move to..
+ (install_libbfd): .. New target.
+ (uninstall_libbfd): Likewise.
+ (install-bfdlibLTLIBRARIES): Likewise.
+ (uninstall-bfdlibLTLIBRARIES): Likewise.
+ (bfdlibdir): New.
+ (bfdincludedir): New.
+ (lib_LTLIBRARIES): Rename to bfdlib_LTLIBRARIES.
+ * aclocal.m4: Regenerate.
+ * configure: Regenerate.
+ * Makefile.in: Regenerate.
+
+2002-05-17 Stuart Balfour <sbalfour@cisco.com>
+
+ * hash.c (bfd_hash_lookup): Remove computation of len from inside
+ hash loop.
+
+2002-05-16 Nick Clifton <nickc@cambridge.redhat.com>
+
+ * config.bfd: Add targets for sh64-linux (little endian and
+ big endian).
+
+2002-05-15 Laurent Pinchart <laurent.pinchart@skynet.be>
+
+ * peXXigen.c (pe_print_idata): Do not assume that the first thunk
+ is located in the same section as the import table. Instead
+ check, and if necessary load the section containing the thunk.
+
+2002-05-15 Nick Clifton <nickc@cambridge.redhat.com>
+
+ * aix5ppc-core.c (xcoff64_core_p): Replace bfd_read with
+ bfd_bread.
+ (xcoff64_core_file_matches_executable_p): Replace bfd_read
+ with bfd_bread.
+
+2002-05-15 Alan Modra <amodra@bigpond.net.au>
+
+ * aix5ppc-core.c: Warning fixes.
+ * aout-adobe.c (aout_32_bfd_link_just_syms): Define.
+ * aout-target.h (MY_bfd_link_just_syms): Define.
+ * aout-tic30.c (MY_bfd_link_just_syms): Define.
+ * bfd.c (bfd_link_just_syms): Define.
+ * binary.c (binary_bfd_link_just_syms): Define.
+ * bout.c (b_out_bfd_link_just_syms): Define.
+ * coff-rs6000.c (rs6000coff_vec, pmac_xcoff_vec): Update initializer.
+ * coff64-rs6000.c (rs6000coff64_vec, aix5coff64_vec): Likewise.
+ * coffcode.h (coff_bfd_link_just_syms): Define.
+ * elf-bfd.h (enum elf_link_info_type): Add ELF_INFO_TYPE_JUST_SYMS.
+ (elf_discarded_section): Check for ELF_INFO_TYPE_JUST_SYMS.
+ (_bfd_elf_link_just_syms): Declare.
+ * elf.c (_bfd_elf_link_just_syms): New function.
+ * elf-eh-frame.c (_bfd_elf_maybe_strip_eh_frame_hdr): Check that
+ sections haven't already been discarded by the linker.
+ * elflink.h (elf_link_add_object_symbols): Likewise for stab
+ sections and SEC_MERGE sections.
+ (elf_bfd_discard_info): Similarly here.
+ * elfxx-target.h (bfd_elfNN_bfd_link_just_syms): Define.
+ * i386msdos.c (msdos_bfd_link_just_syms): Define.
+ * i386os9k.c (os9k_bfd_link_just_syms): Define.
+ * ieee.c (ieee_bfd_link_just_syms): Define.
+ * ihex.c (ihex_bfd_link_just_syms): Define.
+ * libbfd-in.h (_bfd_nolink_bfd_link_just_syms): Define.
+ (_bfd_generic_link_just_syms): Declare.
+ * libecoff.h (_bfd_ecoff_bfd_link_just_syms): Define.
+ * linker.c (_bfd_generic_link_just_syms): New function.
+ * mmo.c (mmo_bfd_link_just_syms): Define.
+ * nlm-target.h (nlm_bfd_link_just_syms): Define.
+ * oasys.c (oasys_bfd_link_just_syms): Define.
+ * ppcboot.c (ppcboot_bfd_link_just_syms): Define.
+ * som.c (som_bfd_link_just_syms): Define.
+ * srec.c (srec_bfd_link_just_syms): Define.
+ * targets.c (struct bfd_target): Add _bfd_link_just_syms.
+ (BFD_JUMP_TABLE_LINK): And here.
+ * tekhex.c (tekhex_bfd_link_just_syms): Define.
+ * versados.c (versados_bfd_link_just_syms): Define.
+ * vms.c (vms_bfd_link_just_syms): Define.
+ * libbfd.h: Regenerate.
+ * bfd-in2.h: Regenerate.
+
+2002-05-15 Thiemo Seufer <seufer@csv.ica.uni-stuttgart.de>
+
+ * elf32-mips.c: Remove superfluous definitions copied from
+ elfxx-mips.c.
+ (bfd_elf32_bigmips_vec,bfd_elf32_littlemips_vec): Use the
+ SGIish vectors to check the special case.
+ (mips_elf_hi16_reloc): Fix comment.
+ (mips_elf_got16_reloc): Likewise.
+ (_bfd_mips_elf32_gprel16_reloc): Likewise.
+ (elf_reloc_map): Code cleanup.
+ (mips_reloc_map): Add comment.
+ (bfd_elf23_bfd_reloc_type_lookup): Code cleanup.
+ (mips_elf32_rtype_to_howto): Likewise.
+ (mips_elf32_discard_info): Likewise.
+ (elf32_mips_irix_compat): Invert logic: Only SGIish vectors
+ lead to IRIX compatibility now.
+
+2002-05-15 Thiemo Seufer <seufer@csv.ica.uni-stuttgart.de>
+
+ * elfxx-mips.c: Call it IRIX, not Irix in comments.
+
+2002-05-13 Jason Thorpe <thorpej@wasabisystems.com>
+
+ * config.bfd (shle-*-netbsdelf*): Add target which includes
+ sh64 support.
+
+2002-05-13 David Edelsohn <edelsohn@gnu.org>
+
+ * configure.in: Revert 2002-04-07. Instead, auto-configure
+ HAVE_ST_C_IMPL.
+ * configure: Regenerate.
+ * config.in: Regenerate.
+ * rs6000-core.c (CNEW_IMPL): Guard use of c_impl with HAVE_ST_C_IMPL
+ or AIX_5_CORE.
+
+2002-05-11 Federico G. Schwindt <fgsch@olimpo.com.br>
+
+ * configure.in (sparc*-*-openbsd*): Support sparc64-openbsd
+ corefiles as well.2
+ * configure: Regenerate.
+
+2002-05-13 Alan Modra <amodra@bigpond.net.au>
+
+ * Makefile.am (install-data-local): Install headers to
+ $(exec_prefix)/include.
+ * Makefile.in: Regenerate.
+
+2002-05-11 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
+ Daniel Jacobowitz <drow@mvista.com>
+
+ * coff-sh.c (sh_reloc_map): Map to R_SH_IMM32 for non-PE. Don't
+ map BFD_RELOC_RVA.
+
+2002-05-11 Federico G. Schwindt <fgsch@olimpo.com.br>
+
+ * config.bfd (alpha*-*-openbsd*, sparc64*-*-openbsd*,
+ hppa*-*-openbsd*): New targets.
+ * configure.in (alpha*-*-openbsd*): Set COREFILE.
+ * configure: Regenerate.
+
+2002-05-10 Tom Rix <trix@redhat.com>
+
+ * coff64-rs6000.c (xcoff64_reloc_type_br): New function for
+ xcoff64_ppc_relocate_section.
+ * coff-rs6000.c : Extern common xcoff_reloc_type functions.
+ * libxcoff.h: Common xcoff_reloc_type function declaration.
+
+2002-05-10 Alan Modra <amodra@bigpond.net.au>
+
+ * elf32-i386.c (elf_i386_relocate_section): Remove overflow checks
+ added in 2002-05-09 commit.
+
+ * elf32-hppa.c (elf32_hppa_size_stubs): Revert part of 2002-05-04,
+ don't look for stubs on all undefined syms.
+
+2002-05-09 Alan Modra <amodra@bigpond.net.au>
+
+ * elf64-ppc.c (RA_REGISTER_MASK, RA_REGISTER_SHIFT): Delete.
+ (ppc64_elf_howto_raw <R_PPC64_RELATIVE>): Not pc_relative or
+ pcrel_offset.
+
+ * elf32-i386.c (elf_howto_table): Comments.
+ (elf_i386_relocate_section): Handle more relocs for relocatable
+ linking and against SEC_MERGE sections.
+
+2002-05-08 Alan Modra <amodra@bigpond.net.au>
+
+ * elf32-ppc.c (ppc_elf_create_got): New function.
+ (ppc_elf_create_dynamic_sections): Call ppc_elf_create_got before
+ _bfd_elf_create_dynamic_sections. Correct .plt flags.
+ (ppc_elf_check_relocs): Use ppc_elf_create_got in place of
+ _bfd_elf_create_got_section.
+
+2002-05-07 Alan Modra <amodra@bigpond.net.au>
+
+ * elf-bfd.h (struct elf_backend_data): Add rela_normal.
+ * elfxx-target.h (elf_backend_rela_normal): Define.
+ (elfNN_bed): Init rela_normal.
+ * elflink.h (elf_link_input_bfd <emit_relocs>): Handle adjustment
+ for section symbols here if rela_normal. Simplify abs section test.
+ * elf-m10200.c (mn10200_elf_relocate_section): If relocatable,
+ return immediately. Remove code handling relocatable linking.
+ * elf-m10300.c (mn10300_elf_relocate_section): Likewise.
+ * elf32-fr30.c (fr30_elf_relocate_section): Likewise.
+ * elf32-i370.c (i370_elf_relocate_section): Likewise.
+ * elf32-i860.c (elf32_i860_relocate_section): Likewise.
+ * elf32-m68k.c (elf_m68k_relocate_section): Likewise.
+ * elf32-mcore.c (mcore_elf_relocate_section): Likewise.
+ * elf32-openrisc.c (openrisc_elf_relocate_section): Likewise.
+ * elf32-ppc.c (ppc_elf_relocate_section): Likewise.
+ * elf32-s390.c (elf_s390_relocate_section): Likewise.
+ * elf32-xstormy16.c (xstormy16_elf_relocate_section): Likewise.
+ * elf64-ppc.c (ppc64_elf_relocate_section): Likewise.
+ * elf64-s390.c (elf_s390_relocate_section): Likewise.
+ * elf64-x86-64.c (elf64_x86_64_relocate_section): Likewise.
+ * elfxx-ia64.c (elfNN_ia64_relocate_section): Likewise.
+ * elf32-arm.h (elf32_arm_relocate_section): Likewise #ifndef USE_REL.
+ * elf32-m32r.c (m32r_elf_relocate_section): Likewise.
+ * elf-m10200.c (elf_backend_rela_normal): Define.
+ * elf-m10300.c (elf_backend_rela_normal): Define.
+ * elf32-fr30.c (elf_backend_rela_normal): Define.
+ * elf32-i370.c (elf_backend_rela_normal): Define.
+ * elf32-i860.c (elf_backend_rela_normal): Define.
+ * elf32-m68k.c (elf_backend_rela_normal): Define.
+ * elf32-mcore.c (elf_backend_rela_normal): Define.
+ * elf32-openrisc.c (elf_backend_rela_normal): Define.
+ * elf32-ppc.c (elf_backend_rela_normal): Define.
+ * elf32-s390.c (elf_backend_rela_normal): Define.
+ * elf32-xstormy16.c (elf_backend_rela_normal): Define.
+ * elf64-ppc.c (elf_backend_rela_normal): Define.
+ * elf64-s390.c (elf_backend_rela_normal): Define.
+ * elf64-x86-64.c (elf_backend_rela_normal): Define.
+ * elfxx-ia64.c (elf_backend_rela_normal): Define.
+ * elf32-arm.h (elf_backend_rela_normal): Define #ifndef USE_REL.
+ * elf32-m32r.c (elf_backend_rela_normal): Likewise.
+
+2002-05-06 Nick Clifton <nickc@cambridge.redhat.com>
+
+ * elf32-arm.h (elf32_arm_final_link_relocate): Convert
+ 'reloc_signed_max' and 'reloc_signed_min' into half-word offsets.
+
+2002-05-06 Alan Modra <amodra@bigpond.net.au>
+
+ * elflink.h (elf_link_input_bfd <emit_relocs>): Adjust r_offset
+ when not relocatable. Fix reloc_emitter call for K&R.
+
+2002-05-04 Alan Modra <amodra@bigpond.net.au>
+
+ * elf64-ppc.c (ppc64_elf_relocate_section): Reinstate code
+ reloading local sym addend mistakenly removed in 2002-05-01 change.
+
+ * dwarf2.c (struct line_head): Make prologue_length a bfd_vma.
+ (read_abbrevs): Change "offset" param to bfd_vma.
+ (parse_comp_unit): Change "version" and addr_size to unsigned ints.
+ Change "abbrev_offset" to bfd_vma.
+ (read_indirect_string): Use correct conversion chars in error
+ message format string, cast bfd_vma's to unsigned long.
+ (read_abbrevs): Likewise.
+ (read_attribute_value): Likewise.
+ (decode_line_info): Likewise.
+ (scan_unit_for_functions): Likewise.
+ (parse_comp_unit): Likewise.
+
+2002-05-04 Tom Rix <trix@redhat.com>
+
+ * coffswap.h (coff_swap_reloc_in): Remove XCOFF support.
+ (coff_swap_reloc_out): Same.
+ * coff-rs6000.c: (xcoff_swap_reloc_in): Moved from coffswap.h.
+ (xcoff_swap_reloc_out): Same.
+ (xcoff_rtype2howto): Renamed from _bfd_xcoff_rtype2howto. Special
+ case some 16 bit relocs. Add reloc value to output.
+ (xcoff_howto_table): Remove 64 bit R_POS, add 16 bit
+ R_RBR. Improve names.
+ (_bfd_xcoff_reloc_type_lookup): Adjust for removal of 64 bit R_POS.
+ (bfd_xcoff_backend_data): Update with new reloc swap names.
+ (bfd_pmac_xcoff_backend_data) : Same.
+ * coff64-rs6000.c: (xcoff64_swap_reloc_in): Moved from coffswap.h.
+ (xcoff64_swap_reloc_out): Same.
+ (xcoff64_rtype2howto): Special case some 16 bit relocs and 32 bit
+ R_POS. Add reloc value to output.
+ (xcoff64_howto_table): Move 64 bit R_POS to first entry. Add 16
+ bit R_RBR. Improve names, masks.
+ (xcoff64_reloc_type_lookup): Adjust for move of 64 bit R_POS.
+ (bfd_xcoff_backend_data): Update with new reloc swap names.
+ (bfd_xcoff_aix5_backend_data) : Same.
+
+2002-05-04 Alan Modra <amodra@bigpond.net.au>
+
+ * elf32-hppa.c (struct elf32_hppa_link_hash_table): Add
+ bfd_count top_index, input_list, all_local_syms.
+ (elf32_hppa_setup_section_lists): New function, split from
+ elf32_hppa_size_stubs.
+ (elf32_hppa_next_input_section): Likewise.
+ (group_sections): Likewise.
+ (get_local_syms): Likewise.
+ (elf32_hppa_size_stubs): Adjust for split out functions. Look for
+ stubs on undefined syms too.
+ (elf32_hppa_set_gp): Use bfd_link_hash* instead of elf_link_hash*.
+ Only access htab elf fields when we have an elf hash table.
+ * elf32-hppa.h (elf32_hppa_setup_section_lists): Declare.
+ (elf32_hppa_next_input_section): Declare.
+
+2002-05-04 Bob Byrnes <byrnes@curl.com>
+
+ * opncls.c (_bfd_new_bfd_contained_in): Check return value of
+ _bfd_new_bfd.
+
+2002-05-03 H.J. Lu (hjl@gnu.org)
+
+ * elfxx-mips.c (mips_elf_link_hash_entry): Add forced_local.
+ (mips_elf_link_hash_newfunc): Initialize forced_local to false.
+ (mips_elf_record_global_got_symbol): Call _bfd_mips_elf_hide_symbol
+ to hide a global symbol.
+ (_bfd_mips_elf_hide_symbol): Return if forced_local is true. Set
+ forced_local to true.
+
+2002-05-02 Richard Henderson <rth@redhat.com>
+
+ * elf64-alpha.c (elf64_alpha_relocate_section): Force relative relocs
+ vs SHN_UNDEF to zero.
+
+2002-05-02 Alan Modra <amodra@bigpond.net.au>
+
+ * elf64-ppc.c (ppc64_elf_howto_raw <R_PPC64_SECTOFF>): Change to a
+ 16 bit reloc.
+ <R_PPC64_SECTOFF_DS>: Likewise.
+ (ppc64_elf_reloc_type_lookup): Map from BFD_RELOC_16_BASEREL to
+ SECTOFF reloc.
+ * elf32-ppc.c (ppc_elf_howto_raw <R_PPC_SECTOFF>): Correct.
+ (ppc_elf_reloc_type_lookup): Map from BFD_RELOC_16_BASEREL to
+ SECTOFF reloc.
+
+ * elf64-ppc.c (ppc64_elf_addr16_ha_reloc): Delete.
+ (ppc64_elf_ha_reloc): New function.
+ (ppc64_elf_brtaken_reloc): New function.
+ (ppc64_elf_sectoff_reloc): New function.
+ (ppc64_elf_sectoff_ha_reloc): New function.
+ (ppc64_elf_toc_reloc): New function.
+ (ppc64_elf_toc_ha_reloc): New function.
+ (ppc64_elf_toc64_reloc): New function.
+ (ppc64_elf_unhandled_reloc): New function.
+ (ppc64_elf_howto_raw): Use the above.
+ <R_PPC64_RELATIVE>: Mark pc_relative, pcrel_offset.
+ <R_PPC64_SECTOFF>: Not pc_relative or pcrel_offset. Fix dst_mask.
+ <R_PPC64_SECTOFF_DS>: Likewise.
+ (IS_ABSOLUTE_RELOC): Update.
+ (struct ppc_link_hash_table): Add have_undefweak.
+ (ppc64_elf_link_hash_table_create): Init.
+ (func_desc_adjust): Set have_undefweak.
+ (ppc64_elf_func_desc_adjust): Call func_desc_adjust earlier. Only
+ add the .sfpr blr when have_undefweak.
+ (ppc64_elf_setup_section_lists): Check hash table flavour.
+ (ppc64_elf_next_input_section): Move output_section->owner test to
+ ppc64elf.em.
+ (ppc64_elf_set_toc): Rename to ppc64_elf_toc, remove info param
+ and relocatable test. Return TOCstart and don't set elf_gp.
+ (ppc64_elf_relocate_section): Correct BRTAKEN/BRNTAKEN branch
+ offset calculation. Add assert on weak sym branch tweaks.
+ * elf64-ppc.h (ppc64_elf_set_toc): Delete.
+ (ppc64_elf_toc): Declare.
+ (ppc64_elf_next_input_section): Update.
+
+2002-05-01 Alan Modra <amodra@bigpond.net.au>
+
+ * syms.c (_bfd_stab_section_find_nearest_line): Don't bomb on NULL
+ file_name.
+
+2002-05-01 Alan Modra <amodra@bigpond.net.au>
+
+ * elf64-ppc.c (CROR_151515, CROR_313131): Define.
+ (ppc64_elf_relocate_section): Use them. Don't look for plt calls
+ on R_PPC64_ADDR24 relocs. Require a nop or no link reg on plt
+ call branches. Correct undefined weak destination.
+ (ppc64_elf_func_desc_adjust): Always create at least one blr in
+ .sfpr, and correct case where either only savef* or restf* is
+ needed.
+
+ Long branch stubs, multiple stub sections.
+ * elf64-ppc.h (ppc64_elf_setup_section_lists): Declare.
+ (ppc64_elf_next_input_section): Declare.
+ * elf64-ppc.c: Move linker-only prototypes.
+ (STUB_SUFFIX): Define.
+ (enum ppc_stub_type): New.
+ (struct ppc_stub_hash_entry): New.
+ (struct ppc_branch_hash_entry): New.
+ (struct ppc_link_hash_entry): Add stub_cache, oh.
+ (struct ppc_link_hash_table): Add stub_hash_table etc. Remove
+ sstub. Add sbrlt, srelbrlt, has_14bit_branch, stub_iteration.
+ Rename plt_overflow to stub_error.
+ (ppc_stub_hash_lookup): Define.
+ (ppc_branch_hash_lookup): Define.
+ (stub_hash_newfunc): New function.
+ (branch_hash_newfunc): New function.
+ (link_hash_newfunc): Init new fields.
+ (ppc64_elf_link_hash_table_create): Likewise.
+ (ppc64_elf_link_hash_table_free): New function.
+ (ppc_stub_name): New function.
+ (ppc_get_stub_entry): New function.
+ (ppc_add_stub): New function.
+ (create_linkage_sections): Use bfd_make_section_anyway. Create
+ .branch_lt and .rela.branch_lt sections. Don't create .stub.
+ (ppc64_elf_check_relocs): Set has_14bit_branch on R_PPC64_REL14*,
+ and set up for plt call stubs. Link func and func desc syms.
+ (ppc64_elf_gc_sweep_hook): Handle REL14* as per REL24.
+ (func_desc_adjust): Avoid hash lookup when func desc sym available
+ via shortcut, and set links when processing.
+ (ppc64_elf_hide_symbol): Likewise.
+ (allocate_dynrelocs): Don't allocate stub section here.
+ (ppc64_elf_size_dynamic_sections): Handle sbrlt and srelbrlt.
+ Remove sstub code.
+ (ppc_type_of_stub): New function.
+ (build_one_stub): Delete.
+ (ppc_build_one_stub): New function.
+ (ppc_size_one_stub): New function.
+ (ppc64_elf_setup_section_lists): New function.
+ (ppc64_elf_next_input_section): New function.
+ (group_sections): New function.
+ (get_local_syms): New function.
+ (ppc64_elf_size_stubs): Rewrite.
+ (ppc64_elf_build_stubs): Rewrite.
+ (ppc64_elf_relocate_section): Look up stub entry for REL24
+ relocs. Don't propagate REL14* to dynamic objects. Look for long
+ branch stubs if REL14* or REL24 relocs won't reach.
+ (bfd_elf64_bfd_link_hash_table_free): Define.
+
+2002-04-30 Mark Mitchell <mark@codesourcery.com>
+
+ * config.bfd: Add support for powerpc-*-windiss.
+
+2002-04-30 Tom Rix <trix@redhat.com>
+
+ * xcofflink.c (xcoff_link_add_symbols): Always copy undef C_EXT
+ symbol names into the hash table.
+
+2002-04-28 Tom Rix <trix@redhat.com>
+
+ * coff-rs6000.c (xcoff_calculate_relocation) : Function table for
+ calulating relocations.
+ (xcoff_complain_overflow) : Function table for relocation errors.
+ (xcoff_ppc_relocate_section): Use relocation and complain function
+ tables.
+ (xcoff_complain_overflow_unsigned_func): New complain function.
+ (xcoff_complain_overflow_signed_func): Same.
+ (xcoff_complain_overflow_bitfield_func): Same.
+ (xcoff_complain_overflow_dont_func): Same.
+ (xcoff_reloc_type_crel): New recot function.
+ (xcoff_reloc_type_br): Same.
+ (xcoff_reloc_type_ba): Same.
+ (xcoff_reloc_type_toc): Same.
+ (xcoff_reloc_type_rel): Same.
+ (xcoff_reloc_type_neg): Same.
+ (xcoff_reloc_type_pos): Same.
+ (xcoff_reloc_type_fail): Same.
+ (xcoff_reloc_type_noop): Same.
+ * libxcoff.h : Declare common parts for xcoff64.
+ * coff64-rs6000.c (xcoff64_ppc_relocate_section): Use relocation
+ and complain function tables.
+
+2002-04-28 Alan Modra <amodra@bigpond.net.au>
+
+ * elf64-x86-64.c (struct elf64_x86_64_dyn_relocs): Comment typo.
+ * elf32-hppa.c (elf32_hppa_final_link): Formatting.
+
+2002-04-26 Alan Modra <amodra@bigpond.net.au>
+
+ * opncls.c (bfd_make_readable): Call bfd_section_list_clear.
+ * xcofflink.c (xcoff_link_add_dynamic_symbols): Likewise.
+
+ * elflink.h (elf_bfd_final_link): Ensure input bfd class is the
+ same as the output before calling elf_link_input_bfd.
+
+ * coffcode.h (coff_compute_section_file_positions): Set
+ section_tail after shuffling section list.
+
+2002-04-24 Christian Groessler <chris@groessler.org>
+
+ * coff-z8k.c (extra_case): Fix R_IMM32 relocations: The
+ addresses are 23bit with a special layout, not plain 32bit
+ values. Prevent relocation of immediate values.
+
+2002-04-24 Chris G. Demetriou <cgd@broadcom.com>
+
+ * elfxx-mips.c (_bfd_mips_elf_print_private_bfd_data): If MDMX or
+ MIPS-16 ASE flags are set, print something to indicate that.
+
+2002-04-23 Alan Modra <amodra@bigpond.net.au>
+
+ * elf32-hppa.c (hppa_type_of_stub): Correct and simplify condition
+ under which a plt call stub is used.
+ (final_link_relocate): Similarly.
+ (allocate_plt_static): Clear h-plabel except when plt entry is
+ exclusively used for a plabel.
+ (allocate_dynrelocs): Use the above to simplify plt sizing.
+ (struct elf32_hppa_link_hash_table): Add has_22bit_branch.
+ (elf32_hppa_link_hash_table_create): Init.
+ (BL22_RP): Define.
+ (hppa_build_one_stub): Use BL22_RP if has_22bit_branch.
+ (elf32_hppa_check_relocs): Set has_22bit_branch.
+
+ * elf32-hppa.c (elf32_hppa_check_relocs): Remove debug message.
+ (final_link_relocate): Likewise.
+
+2002-04-22 Jakub Jelinek <jakub@redhat.com>
+
+ * elf-eh-frame.c (_bfd_elf_discard_section_eh_frame): Don't build
+ search table if some FDE is DW_EH_PE_aligned encoded either.
+ (_bfd_elf_write_section_eh_frame): Handle terminating FDE specially.
+
+2002-04-22 Richard Smith <richard@ex-parrot.com>
+ Jakub Jelinek <jakub@redhat.com>
+
+ * elf-eh-frame.c (struct eh_cie_fde): Add per_encoding_relative.
+ (_bfd_elf_discard_section_eh_frame): Set it for CIEs with pcrel
+ encoded personality.
+ (_bfd_elf_write_section_eh_frame): Adjust pcrel encoded personality
+ for CIE/FDE removal.
+
+2002-04-20 Tom Rix <trix@redhat.com>
+
+ * coff64-rs6000.c (_bfd_xcoff64_swap_aux_in): Fix C_FILE auxent.
+
+2002-04-20 Alan Modra <amodra@bigpond.net.au>
+
+ * archures.c (bfd_lookup_arch): Move the list order comment..
+ (struct bfd_arch_info): ..to where it belongs.
+ * bfd-in2.h: Regenerate.
+
+ * archures.c (bfd_lookup_arch): Add comment on list order.
+ (bfd_default_set_arch_mach): Use bfd_lookup_arch.
+ * cpu-powerpc.c (bfd_powerpc_archs): Re-order so that the default
+ is always at head of list.
+
+2002-04-18 Nick Clifton <nickc@cambridge.redhat.com>
+
+ * coff-arm.c (coff_thumb_pcrel_12, coff_thumb_pcrel_9,
+ insert_thumb_branch, record_thumb_to_arm_glue): Suppress
+ definition of these functions for ARM_WINCE builds as they are
+ not used.
+ (SWAP_IN_RELOC_OFFSET, SWAP_OUT_RELOC_OFFSET): Do not define
+ for ARM_WINCE builds.
+
+2002-04-18 Nick Clifton <nickc@cambridge.redhat.com>
+
+ * coff-arm.c (bfd_arm_process_before_allocation):
+
+2002-04-17 J"orn Rennecke <joern.rennecke@superh.com>
+
+ * cpu-sh.c (scan_mach): Delete.
+ (arch_info_struct): Replace scan_mach with bfd_default_scan.
+ (bfd_sh_arch): Likewise.
+
+2002-04-16 Nick Clifton <nickc@cambridge.redhat.com>
+
+ * ihex.c (ihex_write_object_contents): Fix check for records
+ crossing 64K boundaries.
+
+2002-04-16 Alan Modra <amodra@bigpond.net.au>
+
+ * elf32-m32r.c (m32r_elf_add_symbol_hook): Check the hash table
+ type rather than just assuming entries are ELF.
+ * elf32-sh64.c (sh64_elf_add_symbol_hook): Likewise.
+ * elf64-sh64.c (sh64_elf64_add_symbol_hook): Likewise.
+ * elf64-sparc.c (sparc64_elf_add_symbol_hook): Likewise.
+ * elf64-mmix.c (mmix_elf_add_symbol_hook): Use bfd_link_hash_entry
+ rather than elf_link_hash_entry.
+
+2002-04-15 Richard Henderson <rth@redhat.com>
+
+ * elf32-mips.c (mips_elf32_object_p): Revert 0404 fragment: allow
+ n32 binaries.
+
+2002-04-15 Michael Snyder <msnyder@redhat.com>
+
+ * opncls.c (bfd_close): Write contents if writeable.
+ Minor formatting tidy-ups.
+
+2002-04-15 Alan Modra <amodra@bigpond.net.au>
+
+ * elf32-ppc.c (ppc_elf_add_symbol_hook): Check the hash table type.
+
+2002-04-12 Michael Snyder <msnyder@redhat.com>
+
+ * bfd-in.h (bfd_get_section_lma): New access macro.
+ Minor white-space fix-up.
+
+2002-04-12 Alan Modra <amodra@bigpond.net.au>
+
+ * elf.c (prep_headers): Don't zero EI_OSABI, EI_ABIVERSION or
+ header pad.
+
+2002-04-09 DJ Delorie <dj@redhat.com>
+
+ * elfarm-nabi.c (elf32_arm_howto_table): Fix ABS16 masks.
+
+2002-04-09 Casper S. Hornstrup <chorns@users.sourceforge.net>
+
+ * coffcode.h (coff_read_word): New.
+ (coff_compute_checksum): New.
+ (coff_apply_checksum): New.
+ (coff_write_object_contents): Call coff_apply_checksum () to
+ apply checksum to PE image.
+
+2002-04-08 Randolph Chung <tausq@debian.org>
+
+ * elf32-hppa.c (hppa_unwind_entry_compare): Move to elf-hppa.h.
+ (elf32_hppa_final_link): Split out sorting logic to..
+ * elf-hppa.h (elf_hppa_sort_unwind): ..here.
+ (elf_hppa_final_link): Call elf_hppa_sort_unwind.
+
+2002-04-07 Andrew Cagney <ac131313@redhat.com>
+
+ * configure.in: Add missing ``|'' to powerpc-*-aix4.[4-9]*
+ pattern.
+ * configure: Re-generate.
+
+2002-04-07 Andrew Cagney <ac131313@redhat.com>
+
+ * configure.in: Only define AIX_CORE_DUMPX_CORE when AIX version
+ is greater or equal to 4.3.3.
+ * configure: Regenerate.
+ Fix PR gdb/344.
+
+2002-04-05 Hans-Peter Nilsson <hp@axis.com>
+
+ * elf32-cris.c (cris_elf_howto_table) <R_CRIS_16_PCREL,
+ R_CRIS_32_PCREL>: Fix typo in name.
+ (cris_elf_check_relocs): Always create .rela.got here when
+ R_CRIS_16_GOTPLT or R_CRIS_32_GOTPLT is seen.
+ (elf_cris_adjust_gotplt_to_got): Don't create .rela.got here;
+ assume it's created.
+
+2002-04-04 Daniel Jacobowitz <drow@mvista.com>
+
+ * aout-adobe.c (aout_32_bfd_link_hash_table_free): Define.
+ * aout-target.h (MY_bfd_link_hash_table_free): Conditionally
+ define.
+ * aout-tic30.c (MY_bfd_link_hash_table_free): Likewise.
+ * bfd.c (bfd_link_hash_table_free): Define.
+ * binary.c (binary_bfd_link_hash_table_free): Define.
+ * bout.c (b_out_bfd_link_hash_table_free): Define.
+ * coff-rs6000.c (rs6000coff_vec): Include
+ _bfd_generic_link_hash_table_free.
+ (pmac_xcoff_vec): Likewise.
+ * coff64-rs6000.c (rs6000coff64_vec): Likewise.
+ (aix5coff64_vec): Likewise.
+ * coffcode.h (coff_bfd_link_hash_table_free): Conditionally define.
+ * elf-m10300.c (elf32_mn10300_link_hash_table_free): New function.
+ (bfd_elf32_bfd_link_hash_table_free): Define.
+ * elf32-hppa.c (elf32_hppa_link_hash_table_free): New function.
+ (bfd_elf32_bfd_link_hash_table_free): Define.
+ * elfxx-target.h (bfd_elfNN_bfd_link_hash_table_free): Conditionally
+ define.
+ * i386msdos.c (msdos_bfd_link_hash_table_free): Define.
+ * i386os9k.c (os9k_bfd_link_hash_table_free): Define.
+ * ieee.c (ieee_bfd_link_hash_table_free): Define.
+ * ihex.c (ihex_bfd_link_hash_table_free): Define.
+ * libbfd-in.h (_bfd_nolink_bfd_link_hash_table_free): Define.
+ (_bfd_generic_link_hash_table_free): Add prototype.
+ * libcoff-in.h (_bfd_xcoff_bfd_link_hash_table_free): Add prototype.
+ * libecoff.h (_bfd_ecoff_bfd_link_hash_table_free): Define.
+ * linker.c (_bfd_generic_link_hash_table_free): New function.
+ * mmo.c (mmo_bfd_link_hash_table_free): Define.
+ * nlm-target.h (nlm_bfd_link_hash_table_free): Define.
+ * oasys.c (oasys_bfd_link_hash_table_free): Define.
+ * ppcboot.c (ppcboot_bfd_link_hash_table_free): Define.
+ * som.c (som_bfd_link_hash_table_free): Define.
+ * srec.c (srec_bfd_link_hash_table_free): Define.
+ * tekhex.c (tekhex_bfd_link_hash_table_free): Define.
+ * versados.c (versados_bfd_link_hash_table_free): Define.
+ * vms.c (vms_bfd_link_hash_table_free): New function.
+ * xcofflink.c (_bfd_xcoff_bfd_link_hash_table_free): New function.
+
+ * coff-arm.c (coff_arm_link_hash_table_create): Use bfd_malloc
+ instead of bfd_alloc.
+ * coff-h8300.c (h8300_coff_link_hash_table_create): Likewise.
+ * coff-mcore.c (coff_mcore_link_hash_table_create): Likewise.
+ * coff-ppc.c (ppc_coff_link_hash_table_create): Likewise.
+ * cofflink.c (_bfd_coff_link_hash_table_create): Likewise.
+ * ecoff.c (_bfd_ecoff_bfd_link_hash_table_create): Likewise.
+ * elf-m10300.c (elf32_mn10300_link_hash_table_create): Likewise.
+ * elf.c (_bfd_elf_link_hash_table_create): Likewise.
+ * elf32-arm.h (elf32_arm_link_hash_table_create): Likewise.
+ * elf32-cris.c (elf_cris_link_hash_table_create): Likewise.
+ * elf32-hppa.c (elf32_hppa_link_hash_table_create): Likewise.
+ * elf32-i386.c (elf_i386_link_hash_table_create): Likewise.
+ * elf32-m68k.c (elf_m68k_link_hash_table_create): Likewise.
+ * elf32-s390.c (elf_s390_link_hash_table_create): Likewise.
+ * elf32-sh.c (sh_elf_link_hash_table_create): Likewise.
+ * elf64-alpha.c (elf64_alpha_bfd_link_hash_table_create): Likewise.
+ * elf64-ppc.c (ppc64_elf_link_hash_table_create): Likewise.
+ * elf64-s390.c (elf_s390_link_hash_table_create): Likewise.
+ * elf64-sh64.c (sh64_elf64_link_hash_table_create): Likewise.
+ * elf64-sparc.c (sparc64_elf_bfd_link_hash_table_create): Likewise.
+ * elf64-x86-64.c (elf64_x86_64_link_hash_table_create): Likewise.
+ * elfxx-mips.c (_bfd_mips_elf_link_hash_table_create): Likewise.
+ * linker.c (_bfd_generic_link_hash_table_create): Likewise.
+ * m68klinux.c (linux_link_hash_table_create): Likewise.
+ * sparclinux.c (linux_link_hash_table_create): Likewise.
+ * sunos.c (sunos_link_hash_table_create): Likewise.
+ * xcofflink.c (_bfd_xcoff_bfd_link_hash_table_create): Likewise.
+
+ * targets.c: Add _bfd_link_hash_table_free to xvec.
+
+ * bfd-in2.h: Regenerate.
+ * libbfd.h: Regenerate.
+ * libcoff.h: Regenerate.
+
+2002-04-04 Alan Modra <amodra@bigpond.net.au>
+
+ * dep-in.sed: Cope with absolute paths.
+ * Makefile.am (dep.sed): Subst TOPDIR, and not INCDIR.
+ Run "make dep-am".
+ * Makefile.in: Regenerate.
+ * coff-arm.c: Fix copyright date.
+ * cpu-h8300.c: Likewise.
+ * cpu-i370.c: Likewise.
+ * cpu-s390.c: Likewise.
+ * cpu-mips.c: Likewise.
+ * po/SRC-POTFILES.in: Regenerate.
+
+2002-04-04 Thiemo Seufer <seufer@csv.ica.uni-stuttgart.de>
+
+ * Makefile.am: Add elfxx-mips.c to the known backends.
+ (elf32-mips.lo): remove dependency to coff/external.h.
+ * Makefile.in: Regenerate.
+ * configure.in: Add elfxx-mips.lo to all vectors using elf32-mips.lo
+ Remove elf32-mips.lo from 64 bit vectors. Update dependencies
+ accordingly.
+ * configure: Regenerate.
+ * elf-bfd.h: Move all MIPS ELF specific prototypes to elfxx-mips.h.
+ (irix_compat_t): IRIX compatibility level, moved from elf32-mips.c.
+ (elf_backend_mips_irix_compat, elf_backend_mips_rtype_to_howto): New
+ MIPS specific backend functions.
+ * elf32-mips.c: Moved most code to elfxx-mips.c.
+ (mips_elf_hi16_reloc): Rename from _bfd_mips_elf_hi16_reloc and make
+ static.
+ (mips_elf_lo16_reloc): Likewise, was _bfd_mips_elf_lo16_reloc.
+ (mips_elf_got16_reloc): Likewise, was _bfd_mips_elf_got16_reloc.
+ (mips_elf_gprel32_reloc): Likewise, was _bfd_mips_elf_gprel32_reloc.
+ (mips_elf32_rtype_to_howto): Rename from mips_rtype_to_howto. Changed
+ interface to allow selection of the right REL or RELA howto table.
+ (mips_elf32_object_p): Rename from _bfd_mips_elf_object_p and made
+ static. Let it refuse n32 objects.
+ (elf32_mips_grok_prstatus): Rename from _bfd_elf32_mips_grok_prstatus.
+ (elf32_mips_grok_psinfo): Rename from _bfd_elf32_mips_grok_psinfo.
+ (elf32_mips_discard_info): Rename from _bfd_elf32_mips_discard_info.
+ (elf32_mips_ignore_discarded_relocs): Rename from
+ _bfd_elf32_mips_ignore_discarded_relocs.
+ (elf32_mips_write_section): Rename from _bfd_elf32_mips_write_section.
+ (elf32_mips_irix_compat): New function, replaces IRIX_COMPAT.
+ (elf_mips_howto_table_rela): Remove.
+ * elf64-mips.c: Moved most code to elfxx-mips.c.
+ (bfd_elf64_bfd_reloc_type_lookup): Make static.
+ (mips_elf64_rtype_to_howto): New function.
+ (mips_elf64_object_p): Likewise.
+ (elf64_mips_irix_compat): Likewise.
+ * elfxx-mips.c: New file containing common code merged together from
+ elf32-mips.c and elf64-mips.c.
+ * elfxx-mips.h: New file containing MIPS specific prototypes from
+ elf-bfd.h.
+ * elfxx-target.h: Add handling for elf_backend_mips_irix_compat and
+ elf_backend_mips_rtype_to_howto.
+
+2002-04-04 Alan Modra <amodra@bigpond.net.au>
+
+ * srec.c (MAXCHUNK, Chunk): Revise comments.
+ (srec_write_record): Correct buffer size.
+ (srec_write_header): Do without intermediate buffer.
+ (srec_write_section): Validate Chunk.
+ (srec_write_terminator): Pass NULL instead of dummy buffer.
+ (srec_write_symbols): Pass file and symbol names directly to
+ bfd_bwrite so sprintf won't overflow buffer.
+
+2002-04-03 Jakub Jelinek <jakub@redhat.com>
+
+ * elf32-sparc.c (elf32_sparc_relocate_section): Don't emit dynamic
+ PC relative relocs against hidden symbols.
+ * elf64-sparc.c (sparc64_elf_relocate_section): Likewise.
+
+2002-04-03 Alan Modra <amodra@bigpond.net.au>
+
+ * elf.c (_bfd_elf_make_section_from_shdr): When setting section
+ LMAs, loop over segments until p_vaddr and p_memsz specify an
+ extent enclosing the section.
+
+2002-04-02 Nick Clifton <nickc@cambridge.redhat.com>
+
+ * ihex.c (ihex_write_object_contents): Do not allow records to
+ cross a 64K boundary - wrap if necessary.
+
+2002-04-01 Nathan Williams <nathanw@wasabisystems.com>
+
+ * elf.c (elfcore_netbsd_get_lwpid): Fix off-by-one error
+ which caused the returned LWP ID to always be 0.
+
+2002-04-01 Richard Henderson <rth@redhat.com>
+
+ * elf32-sparc.c (WILL_CALL_FINISH_DYNAMIC_SYMBOL): New.
+ (elf32_sparc_relocate_section): Use it to figure out when to
+ initialize .got entries.
+ * elf64-sparc.c: Similarly.
+
+2002-03-28 Alan Modra <amodra@bigpond.net.au>
+
+ * linker.c (link_action): Ignore duplicate warning syms.
+ (_bfd_generic_link_write_global_symbol): Follow warning symbol link.
+ * elflink.h (elf_adjust_dynstr_offsets): Likewise.
+ (elf_adjust_dynamic_symbol): Likewise.
+ (elf_export_symbol): Likewise.
+ (elf_link_find_version_dependencies): Likewise.
+ (elf_link_assign_sym_version): Likewise.
+ (elf_link_sec_merge_syms): Likewise.
+ (elf_link_output_extsym): Likewise.
+ (elf_gc_sweep_symbol): Likewise.
+ (elf_gc_propagate_vtable_entries_used): Likewise.
+ (elf_gc_smash_unused_vtentry_relocs): Likewise.
+ (elf_gc_allocate_got_offsets): Likewise.
+ (elf_collect_hash_codes): Likewise.
+ * elflink.c (elf_link_renumber_hash_table_dynsyms): Likewise.
+ * elf-hppa.h (elf_hppa_unmark_useless_dynamic_symbols): Likewise.
+ (elf_hppa_remark_useless_dynamic_symbols): Likewise.
+ * elf-m10300.c (elf32_mn10300_finish_hash_table_entry): Likewise.
+ * elf32-arm.h (elf32_arm_discard_copies): Likewise.
+ * elf32-cris.c (elf_cris_adjust_gotplt_to_got): Likewise.
+ (elf_cris_discard_excess_dso_dynamics): Likewise.
+ * elf32-hppa.c (clobber_millicode_symbols): Likewise.
+ (mark_PIC_calls): Likewise.
+ (allocate_plt_static): Likewise.
+ (allocate_dynrelocs): Likewise.
+ (readonly_dynrelocs): Likewise.
+ * elf32-i386.c (allocate_dynrelocs): Likewise.
+ (readonly_dynrelocs): Likewise.
+ * elf32-i370.c (i370_elf_adjust_dynindx): Likewise.
+ * elf32-m68k.c (elf_m68k_discard_copies): Likewise.
+ * elf32-mips.c (mips_elf_output_extsym): Likewise.
+ (mips_elf_sort_hash_table_f): Likewise.
+ (mips_elf_check_mips16_stubs): Likewise.
+ * elf32-s390.c (allocate_dynrelocs): Likewise.
+ (readonly_dynrelocs): Likewise.
+ * elf32-sh.c (sh_elf_discard_copies): Likewise.
+ * elf32-xstormy16.c (xstormy16_relax_plt_check): Likewise.
+ (xstormy16_relax_plt_realloc): Likewise.
+ * elf64-alpha.c (elf64_alpha_calc_got_offsets_for_symbol): Likewise.
+ (elf64_alpha_output_extsym): Likewise.
+ * elf64-hppa.c (elf64_hppa_mark_exported_functions): Likewise.
+ * elf64-mips.c (mips_elf64_sort_hash_table_f): Likewise.
+ (mips_elf64_check_mips16_stubs): Likewise.
+ (mips_elf64_output_extsym): Likewise.
+ * elf64-ppc.c (func_desc_adjust): Likewise.
+ (allocate_dynrelocs): Likewise.
+ (readonly_dynrelocs): Likewise.
+ * elf64-s390.c (allocate_dynrelocs): Likewise.
+ (readonly_dynrelocs): Likewise.
+ * elf64-sh64.c (sh64_elf64_discard_copies): Likewise.
+ * elf64-x86-64.c (allocate_dynrelocs): Likewise.
+ (readonly_dynrelocs): Likewise.
+ * elfxx-ia64.c (elfNN_ia64_global_dyn_sym_thunk): Likewise.
+ * aoutx.h (aout_link_write_other_symbol): Likewise.
+ * cofflink.c (_bfd_coff_write_task_globals): Likewise.
+ (_bfd_coff_write_global_sym): Likewise.
+ * i386linux.c (linux_tally_symbols): Likewise.
+ * m68klinux.c (linux_tally_symbols): Likewise.
+ * sparclinux.c (linux_tally_symbols): Likewise.
+ * pdp11.c (aout_link_write_other_symbol): Likewise.
+ * sunos.c (sunos_scan_dynamic_symbol): Likewise.
+ * xcofflink.c (xcoff_build_ldsyms): Likewise.
+ (xcoff_write_global_symbol): Likewise.
+
+ * cofflink.c (_bfd_coff_final_link): Formatting.
+ * cpu-mips.c (mips_compatible): Make static, prototype.
+ * elf32-i386.c (elf_i386_check_relocs): Formatting.
+ * elf32-sh.c (sh_elf_size_dynamic_sections): Likewise.
+ * elf64-alpha.c (elf64_alpha_output_extsym): Likewise.
+ * elf64-mips.c (mips_elf64_sort_hash_table): Likewise.
+ (mips_elf64_final_link): Likewise.
+ * elflink.h (elf_link_find_version_dependencies): Remove duplicate
+ prototype.
+
+2002-03-27 Nick Clifton <nickc@cambridge.redhat.com>
+
+ * coff-arm.c (SWAP_IN_RELOC_OFFSET): Define.
+ (SWAP_OUT_RELOC_OFFSET): Define.
+
+2002-03-27 Gregory Steuck <greg@nest.cx>
+
+ * elf.c (_bfd_elf_get_symtab_upper_bound): Leave space for
+ terminating NULL if empty symbol table.
+ (_bfd_elf_get_dynamic_symtab_upper_bound): Likewise.
+
+2002-03-26 H.J. Lu (hjl@gnu.org)
+
+ * elflink.h (elf_link_input_bfd): Revert the last change since
+ the gcc exception handling isn't fixed yet.
+
+2002-03-26 H.J. Lu (hjl@gnu.org)
+
+ * elflink.h (elf_link_input_bfd): Complain about relocations
+ against local symbols in discarded sections.
+
+2002-03-26 Alan Modra <amodra@bigpond.net.au>
+
+ * elflink.h (elf_gc_mark): Don't recurse into non-ELF sections.
+
+2002-03-23 Alan Modra <amodra@bigpond.net.au>
+
+ * elf.c (_bfd_elf_make_section_from_shdr): Don't set lma based on
+ section file offset for !SEC_LOAD sections.
+
+2002-03-21 Richard Earnshaw <rearnsha@arm.com>
+
+ * elf32-arm.h (elf32_arm_final_link_relocate <case R_ARM_GOTOFF>,
+ <case R_ARM_GOT>): Handle relocations to Thumb functions.
+
+2002-03-21 Alan Modra <amodra@bigpond.net.au>
+
+ * coff64-rs6000.c (_bfd_xcoff64_put_symbol_name): Prototype.
+ Whitespace changes.
+ * archive.c: Update copyright date.
+ * bfd-in2.h: Regenerate.
+ * libbfd.h: Regenerate.
+ * Makefile.am: Run "make dep-am"
+ * Makefile.in: Regenerate.
+ * po/SRC-POTFILES.in: Regenerate.
+
+2002-03-20 Daniel Jacobowitz <drow@mvista.com>
+
+ * dwarf2.c (struct funcinfo): Move up.
+ (lookup_address_in_function_table): New argument function_ptr.
+ Set it.
+ (lookup_address_in_line_table): New argument function. If function
+ is non-NULL, use it to handle ``addr'' before the first line note of
+ the function.
+ (comp_unit_find_nearest_line): Update and swap calls to
+ lookup_address_in_function_table and lookup_address_in_line_table.
+ * syms.c (_bfd_stab_section_find_nearest_line): Use the first
+ N_SLINE encountered if we see an N_FUN before any N_SLINE.
+
+2002-03-20 Tom Rix <trix@redhat.com>
+
+ * coff-rs6000.c (_bfd_xcoff_stat_arch_elt): Renamed from
+ _bfd_xcoff_generic_stat_arch_elt. Fix format check.
+ * coff64-rs6000.c : Use _bfd_xcoff_stat_arch_elt.
+
+2002-03-19 Tom Rix <trix@redhat.com>
+
+ * xcofflink.c (_bfd_xcoff_bfd_link_add_symbols): Look through all
+ dynamic objects in archives.
+
+2002-03-19 Hans-Peter Nilsson <hp@bitrange.com>
+
+ * elflink.h (NAME(bfd_elf,record_link_assignment)): Don't set
+ STT_NOTYPE symbols to STT_OBJECT.
+
+2002-03-18 Jan Hubicka <jh@suse.cz>
+
+ * cpu-i386.c (bfd_x86_64_arch): Rename to "i386:x86-64"
+
+2002-03-18 Tom Rix <trix@redhat.com>
+
+ * aix5ppc.core.c : New file for AIX 5 64 bit core support.
+ * bfd-in.h : Add bfd_xcoff_ar_archive_set_magic declaration.
+ * coff-rs6000 (do_pad) : New function for archive padding.
+ (do_copy) : New function for object file copying in archives.
+ (do_shared_object_padding) : New function for padding shared
+ objects to their text section alignment in archives.
+ (bfd_xcoff_ar_achive_set_magic) : Stub.
+ (xcoff_write_armap_big) : Use do_copy and do_pad.
+ (xcoff_write_archive_contents_big) : Use do_shared_object_padding,
+ do_copy and do_pad.
+ * coff64-rs6000.c (xcoff64_write_ojbect_contents) : Use
+ bfd_xcoff_magic_number.
+ (xcoff64_bad_format_hook) : New function for _bfd_bad_format_hook
+ fop.
+ (xcoff_backend_data_r) : Use xcoff64_bad_format_hook.
+ (bfd_xcoff_aix5_backend_data) : New Aix 5 backend data.
+ (aix5coff64_vec) : New Aix 5 target aix5coff64-rs6000.
+ * rs6000-core.c : Update copyright date.
+ * xcofflink.c (bfd_xcoff_size_dynamic_sections): Check for NULL
+ csectpp.
+ * coffcode.h (coff_new_section_hook) : Use new accessor macros.
+ (coff_set_arch_mach_hook) : Add Aix 5 U64_TOCMAGIC magic #.
+ (coff_set_flags) : Use bfd_xcoff_magic_number.
+ * libxcoff.h (bfd_xcoff_is_xcoff64): Add U64_TOCMAGIC.
+ * configure.in : Add powerpc-*-aix5 and rs6000-*-aix5 support.
+ * Makefile.am : Same.
+ * config.bfd : Same.
+ * targets.c : Same.
+ * configure : Regnerate.
+ * Makefile.in : Same.
+ * bfd-in2.h : Same.
+
+2002-03-18 Nick Clifton <nickc@cambridge.redhat.com>
+
+ * po/fr.po: Updated version.
+
+2002-03-18 Alan Modra <amodra@bigpond.net.au>
+
+ * libbfd.c (bfd_write_bigendian_4byte_int): Return true iff success.
+ * libbfd.h: Regenerate.
+ * archive.c (coff_write_armap): Pass on failures from
+ bfd_write_bigendian_4byte_int.
+
+2002-03-14 H.J. Lu <hjl@gnu.org>
+
+ * elflink.h (NAME(bfd_elf,size_dynamic_sections)): Set the BFD
+ error to bfd_error_nonrepresentable_section for reinit_array
+ section in DSO.
+
+2002-03-14 Nick Clifton <nickc@cambridge.redhat.com>
+
+ * coffcode.h (coff_slurp_symbol_table): When adding BSF_WEAK flag,
+ OR it in rather than replacing previously selected flags.
+
+ * elfxx-target.h (TARGET_BIG_SYM): Set ar_max_namelen to 15.
+ (TARGET_LITTLE_SYM): Set ar_max_namelen to 15.
+
+2002-03-14 Alan Modra <amodra@bigpond.net.au>
+
+ * cpu-mips.c (mips_compatible): New. Don't check bits_per_word.
+ (N): Use the above.
+ * elflink.h (elf_bfd_final_link): Revert last change. Instead,
+ ensure reloc size matches before calling elf_link_input_bfd.
+ Add an assert to check reloc size when counting output relocs.
+
+2002-03-14 Nick Clifton <nickc@cambridge.redhat.com>
+
+ * mmo.c (mmo_get_loc): Return NULL rather than false.
+
+2002-03-13 Nick Clifton <nickc@cambridge.redhat.com>
+
+ * po/fr.po: Updated version.
+
+2002-03-13 Alan Modra <amodra@bigpond.net.au>
+
+ * archures.c (bfd_default_compatible): Test bits_per_word.
+ * cpu-i386.c (i386_compatible): Remove. Replace occurrences with
+ bfd_default_compatible.
+ * cpu-i370.c (i370_compatible): Likewise.
+ * cpu-sparc.c (sparc_compatible): Likewise.
+ * cpu-h8300.c (compatible): Test in->arch == out->arch.
+
+ * elflink.h: Formatting fixes.
+ (elf_link_output_extsym): Merge undefined and undef weak cases.
+
+ * elflink.h (elf_bfd_final_link): Only call elf_link_input_bfd
+ when word size of input matches output word size.
+
+2002-03-12 Andreas Jaeger <aj@suse.de>
+
+ * cpu-i386.c (i386_compatible): New. Use it instead of
+ bfd_default_compatible.
+
+2002-03-07 H.J. Lu (hjl@gnu.org)
+
+ * coff-sh.c (shcoff_reloc_map): Use bfd_reloc_code_real_type
+ as the type for bfd_reloc_val.
+
+2002-03-05 John David Anglin <dave@hiauly1.hia.nrc.ca>
+
+ * elf-hppa.h (elf_hppa_is_dynamic_loader_symbol): New function.
+ (elf_hppa_relocate_section): Ignore undefined dynamic loader symbols.
+ (elf_hppa_final_link_relocate): Correct relocations for indirect
+ references to local data through the DLT. Fix .opd creation for
+ local symbols using R_PARISC_LTOFF_FPTR32 and R_PARISC_FPTR64
+ relocations. Use e_lsel selector for R_PARISC_DLTIND21L,
+ R_PARISC_LTOFF_FPTR21L and R_PARISC_LTOFF_TP21L as per
+ "Processor-Specific ELF for PA_RISC, Version 1.43" document.
+ Similarly, use e_rsel for DLT and LTOFF 'R' relocations.
+ * elf32-hppa.c (final_link_relocate): Revise relocation selectors
+ as per "Processor-Specific ELF for PA_RISC, Version 1.43" document.
+
+2002-03-05 Jakub Jelinek <jakub@redhat.com>
+
+ * merge.c (_bfd_merge_sections): Don't segfault if there
+ is nothing to merge due to GC.
+
+2002-03-05 Alan Modra <amodra@bigpond.net.au>
+
+ * elf32-hppa.c (clobber_millicode_symbols): Remove hack to keep
+ symbols that have been forced local.
+
+ * elflink.h (elf_bfd_final_link): Call elf_link_output_extsym
+ to output forced local syms for non-shared link.
+ (elf_link_output_extsym): Tweak condition for calling backend
+ adjust_dynamic_symbol so that previous behaviour is kept.
+ Whitespace changes throughout file.
+
+2002-03-04 H.J. Lu <hjl@gnu.org>
+
+ * elf.c (bfd_section_from_shdr): Handle special sections,
+ .init_array, .fini_array and .preinit_array.
+ (elf_fake_sections): Likewise.
+
+ * elflink.h (NAME(bfd_elf,size_dynamic_sections)): Create the
+ DT entry only if the section is in output for .init_array,
+ .fini_array and .preinit_array. Complain about .preinit_array
+ section in DSO.
+ (elf_bfd_final_link): Warn zero size for .init_array,
+ .fini_array and .preinit_array sections.
+
+ * elfxx-ia64.c (elfNN_ia64_section_from_shdr): Remove
+ SHT_INIT_ARRAY, SHT_FINI_ARRAY and SHT_PREINIT_ARRAY.
+ (elfNN_ia64_fake_sections): Remove .init_array, .fini_array and
+ .preinit_array.
+
+2002-03-04 Alan Modra <amodra@bigpond.net.au>
+
+ * configure.in (WIN32LIBADD): Don't eval PICFLAG assignment.
+ * configure: Regenerate.
+
+2002-03-02 Tom Rix <trix@redhat.com>
+
+ * coff64-rs6000.c (xcoff64_howto_table): Replace howto types with
+ symbolic equiv.
+ * coff-rs6000.c (xcoff_howto_table): Same.
+
+2002-03-01 David Mosberger <davidm@hpl.hp.com>
+
+ * elflink.h (size_dynamic_sections): If section named
+ ".preinit_array" exists, create DT_PREINIT_ARRAY and
+ DT_PREINIT_ARRAYSZ entries in dynamic table. Analogously for
+ ".init_array" and ".fini_array".
+ (elf_bfd_final_link): Handle DT_PREINIT_ARRAYSZ, DT_INIT_ARRAYSZ,
+ DT_FINI_ARRAYSZ, DT_PREINIT_ARRAY, DT_INIT_ARRAY, and
+ DT_FINI_ARRAY.
+
+2002-02-26 Andrew Macleod <amacleod@cygnus.com>
+
+ * elflink.h (elf_bfd_final_link): Don't crash on SHN_UNDEF local
+ dynsyms.
+
+2002-02-25 Alan Modra <amodra@bigpond.net.au>
+
+ * elf64-hppa.h: Update copyright date.
+
+ * elf64-ppc.c (ppc64_elf_check_relocs): Warning fix.
+ (ppc64_elf_relocate_section): Don't generate power4 style branch
+ hints for *_BRTAKEN and *_BRNTAKEN relocs.
+
+2002-02-22 Jakub Jelinek <jakub@redhat.com>
+
+ * elf64-sh64.c (sh_elf64_relocate_section): Fix a typo from my
+ last patch.
+ * elf64-x86-64.c (elf64_x86_64_relocate_section): Likewise.
+
+2002-02-21 Andreas Jaeger <aj@suse.de>
+
+ * elf64-x86-64.c: Major rework that introduces all recent changes
+ to the x86-64 backend. Get a closer match to elf32-i386.
+ (struct elf64_x86_64_dyn_relocs): Rename from
+ elf64_x86_64_pcrel_relocs_copied, add additional fields. Change
+ all users.
+ (struct elf64_x86_64_link_hash_table): Add short cuts to some
+ sections.
+ (link_hash_newfunc): Rename from elf64_x86_64_link_hash_newfunc,
+ remove casts, initialize new hash members.
+ (create_got_section): New.
+ (elf64_x86_64_create_dynamic_sections): New.
+ (elf64_x86_64_copy_indirect_symbol): New.
+ (elf64_x86_64_check_relocs): Don't allocate space for dynamic
+ relocs, .got or .relgot here but do it in allocate_dynrelocs.
+ Reference count possible .plt and .got entries. Don't test input
+ section SEC_READONLY here to try to avoid copy relocs, and keep
+ dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set
+ DF_TEXTREL here. Delay setting of variables until needed. Cache
+ pointer to "sreloc" section in elf_section_data. Tweak condition
+ under which .got created. Report files with bad relocation
+ section names.
+ (elf64_x86_64_gc_sweep_hook): Sweep dyn_relocs and local_dynrel.
+ Reference count possible .plt entries. Don't deallocate .got and
+ .relgot space here.
+ (elf64_x86_64_adjust_dynamic_symbol): Handle nocopyreloc. Don't
+ do copy reloc processing for weakdefs. Remove redundant casts and
+ aborts. Delay setting of vars until needed. Move creation of
+ dynamic symbols and allocation of .plt and .rela.plt to
+ allocate_dynrelocs. Replace BFD_ASSERT with abort.
+ (WILL_CALL_FINISH_DYNAMIC_SYMBOL): New.
+ (allocate_dynrelocs): New.
+ (readonly_dynrelocs): New.
+ (elf64_x86_64_size_dynamic_sections): Call readonly_dynrelocs.
+ Allocate space for dyn relocs. Replace BFD_ASSERT with abort.
+ Zero out the dynamic allocated content space.
+ (elf64_x86_64_discard_copies): Removed.
+ (elf64_x86_64_relocate_section): Make use of dynamic section
+ short-cuts. Localise vars, and delay setting. Better error
+ reporting, replace BFD_ASSERT with abort. Check
+ ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the
+ regular object file and tread the weak definition as the normal
+ one. Don't discard relocs for undefweak or undefined symbols and
+ check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy
+ relocs.
+ (elf64_x86_64_finish_dynamic_symbol): Don't copy relocs for
+ symbols that have been forced local. Use same test to decide if
+ we can use a relative reloc for got as relocate_section. Expand
+ SHN_UNDEF comment. Move expressions out of function calls.
+ Replace BFD_ASSERT with abort.
+ (bfd_elf64_bfd_final_link): Removed.
+ (elf_backend_copy_indirect_symbol): Define.
+
+2002-02-20 Tom Rix <trix@redhat.com>
+
+ * coff-rs6000.c (xcoff_howto_table): Add 16 bit R_BA.
+ (_bfd_xcoff_reloc_type_lookup): Use it.
+ * coff64-rs6000.c (xcoff64_howto_table): Same.
+ (xcoff64_reloc_type_lookup): Same.
+
+2002-02-20 Peter Schauer <pes@regent.e-technik.tu-muenchen.de>
+
+ * osf-core.c (osf_core_vec): OSF/1 (Digital Unix) core files are
+ little endian.
+
+2002-02-19 Martin Schwidefsky <schwidefsky@de.ibm.com>
+
+ * archures.c (bfd_mach_s390_esa): Rename to bfd_mach_s390_31.
+ (bfd_mach_s390_esame): Rename to bfd_mach_s390_64.
+ * bfd-in2.h: Regenerate.
+ * cpu-s390.c (arch_info_struct): Use renamed architecture defines.
+ Replace architecture name "s390" with "s390:31-bit" and "s390:esame"
+ with "s390:64-bit".
+ * elf32-s390.c (elf_howto_table): Add 32 bit pc relative relocations.
+ (elf_s390_reloc_type_lookup): Likewise.
+ (elf_s390_check_relocs): Likewise.
+ (elf_s390_gc_sweep_hook): Likewise.
+ (elf_s390_relocate_section): Likewise.
+ (elf_s390_object_p): Use renamed architecture define.
+ * elf64-s390.c (elf_s390_object_p): Use renamed architecture define.
+
+2002-02-19 Frank Ch. Eigler <fche@redhat.com>
+
+ * syms.c (stt[]): Sorted. Added .init/.fini -> "t" mapping.
+
+2002-02-19 Jakub Jelinek <jakub@redhat.com>
+
+ * elf-eh-frame.c (_bfd_elf_discard_section_eh_frame): Enable
+ absptr -> pcrel optimization for shared libs.
+ Only create minimal .eh_frame_hdr if absptr FDE encoding in shared
+ library cannot be converted to pcrel.
+ (_bfd_elf_eh_frame_section_offset): Return -2 if making absptr
+ relative.
+ * elf32-i386.c (elf_i386_relocate_section): If
+ _bfd_elf_section_offset returned -2, skip, but make sure the
+ relocation is installed.
+ * elf32-arm.h (elf32_arm_final_link_relocate): Likewise.
+ * elf32-cris.c (cris_elf_relocate_section): Likewise.
+ * elf32-hppa.c (elf32_hppa_relocate_section): Likewise.
+ * elf32-i370.c (i370_elf_relocate_section): Likewise.
+ * elf32-m68k.c (elf_m68k_relocate_section): Likewise.
+ * elf32-ppc.c (ppc_elf_relocate_section): Likewise.
+ * elf32-s390.c (elf_s390_relocate_section): Likewise.
+ * elf32-sh.c (sh_elf_relocate_section): Likewise.
+ * elf32-sparc.c (elf32_sparc_relocate_section): Likewise.
+ * elf64-ppc.c (ppc64_elf_relocate_section): Likewise.
+ * elf64-s390.c (elf_s390_relocate_section): Likewise.
+ * elf64-sh64.c (sh_elf64_relocate_section): Likewise.
+ * elf64-sparc.c (sparc64_elf_relocate_section): Likewise.
+ * elf64-x86-64.c (elf64_x86_64_relocate_section): Likewise.
+ * elf64-alpha.c (elf64_alpha_relocate_section): Handle
+ _bfd_elf_section_offset returning -2 the same way as -1.
+ * elfxx-ia64.c (elfNN_ia64_install_dyn_reloc): Likewise.
+ * elf32-mips.c (mips_elf_create_dynamic_relocation): Add FIXME
+ and BFD_ASSERT.
+ * elf64-mips.c (mips_elf64_create_dynamic_relocation): Likewise.
+
+2002-02-18 Tom Rix <trix@redhat.com>
+
+ * xcofflink.c (bfd_xcoff_link_gernate_rtinit): Add -brtl support.
+ (bfd_xcoff_size_dynamic_sections): Same.
+ * bfd-in.h (bfd_xcoff_link_generate_rtinit): Same.
+ (bfd_xcoff_size_dynamic_sections): Same.
+ * coff-rs6000.c (xcoff_generate_rtinit): Same.
+ * coff-rs646000.c (xcoff64_generate_rtinit): Same.
+ * libxcoff.h (struct xcoff_backend_data_rec): Same.
+ * xcofflink.c (xcoff_build_ldsyms, xcoff_link_add_symbols): Clean.
+ * bfd-in2.h: Regenerate.
+
+2002-02-18 Alan Modra <amodra@bigpond.net.au>
+
+ * elf64-ppc.c (STFD_FR0_0R1, LFD_FR0_0R1, BLR): Define.
+ (struct ppc_link_hash_table): Add sfpr.
+ (ppc64_elf_link_hash_table_create): Init it.
+ (ppc64_elf_create_dynamic_sections): Split creation of .stub and
+ .glink out to..
+ (create_linkage_sections): ..here. Make .sfpr too.
+ (ppc64_elf_check_relocs): Call create_linkage_sections, and set
+ dynobj early.
+ (MIN_SAVE_FPR, MAX_SAVE_FPR): Define.
+ (ppc64_elf_func_desc_adjust): Look for missing ._savef* and
+ ._restf* functions, and create as needed.
+ (func_desc_adjust): Only force_local for shared libs.
+
+2002-02-18 David O'Brien <obrien@FreeBSD.org>
+
+ * configure.in: Bump version number post 2.12 branching.
+ * configure: Regenerate.
+
+2002-02-17 Hans-Peter Nilsson <hp@bitrange.com>
+
+ * mmo.c: Correct and improve comments.
+ (mmo_write_chunk): Store trailing byte in bfd buffer; don't
+ zero-pad. Use input to fill up non-empty bfd buffer.
+ (mmo_flush_chunk): New function.
+ (mmo_write_loc_chunk): Add parameter last_vmap, all callers
+ changed. Don't emit location specifier if VMA is same as
+ *LAST_VMAP after omitting leading zero contents. Call
+ mmo_flush_chunk before emitting location specifier.
+ (mmo_write_loc_chunk_list): Call mmo_flush_chunk when finished
+ with mmo_write_loc_chunk calls.
+ (mmo_internal_write_section): Call mmo_flush_chunk after
+ mmo_write_chunk.
+ (mmo_write_symbols_and_terminator): Move :Main to first position
+ in symbol array. Add faked one if it does not exist if there are
+ other symbols. Don't add it if there are no symbols at all. Move
+ out test for value of :Main from symbol loop. Rename table
+ fakemain to maintable and variable mainsym to fakemain.
+
+2002-02-15 Richard Henderson <rth@redhat.com>
+
+ * elf64-alpha.c (elf64_alpha_relocate_section) [BRSGP]: A target
+ section with no got matches any got. Simplify error generaion.
+
+2002-02-15 Alan Modra <amodra@bigpond.net.au>
+
+ Support arbitrary length fill patterns.
+ * linker.c (bfd_new_link_order): Zero all fields with bfd_zalloc.
+ (_bfd_default_link_order): Remove bfd_fill_link_order code.
+ Call default_data_link_order.
+ (default_fill_link_order): Delete.
+ (default_data_link_order): New function.
+ * elf32-mips.c (_bfd_mips_elf_final_link): Replace occurrences
+ of bfd_fill_link_order with bfd_data_link_order.
+ * elf64-alpha.c (elf64_alpha_final_link): Likewise.
+ * elf64-mips.c (mips_elf64_final_link): Likewise.
+
+ * bfd.c (bfd_scan_vma): Clamp overflows to max bfd_vma value.
+ Correct value returned in "end" for "0x<non-hex>".
+
+2002-02-14 Nick Clifton <nickc@cambridge.redhat.com>
+
+ * cpu-arm.c (processors): Replace 'arch' field with 'mach'.
+ (scan): Test against 'mach' field in info structure.
+
+2002-02-14 Alan Modra <amodra@bigpond.net.au>
+
+ * elf.c (elf_fake_sections): Use SHT_NOBITS when SEC_NEVER_LOAD.
+
+2002-02-14 Matt Fredette <fredette@netbsd.org>
+
+ * elf32-m68k.c (elf32_m68k_print_private_bfd_data): Recognize
+ EF_M68000.
+
+2002-02-13 Nick Clifton <nickc@cambridge.redhat.com>
+
+ * elf.c (_bfd_elf_make_section_from_shdr): Do not insist on
+ non-zero physical addresses when adjusting the LMAs of new
+ sections.
+
+2002-02-12 John David Anglin <dave@hiauly1.hia.nrc.ca>
+
+ * elf-hppa.h (elf_hppa_reloc_final_type): New function stripped
+ from _bfd_elf_hppa_gen_reloc_type.
+ (_bfd_elf_hppa_gen_reloc_type): Remove duplicate prototype.
+ * elf32-hppa.h (elf32_hppa_reloc_final_type): Add protptype.
+ * elf32-hppa.c: Include elf32-hppa.h before elf-hppa.h.
+ * elf64-hppa.h (elf64_hppa_reloc_final_type): Add protptype.
+
+2002-02-12 Alexandre Oliva <aoliva@redhat.com>
+
+ * elf-m10300.c (mn10300_elf_relax_section): Skip section before
+ loading its contents if there's nothing to do in it.
+
+2002-02-12 Alan Modra <amodra@bigpond.net.au>
+
+ * elf64-ppc.c (ppc64_elf_size_stubs): Correct test for crossing
+ 64k boundary.
+
+ * elf64-ppc.c (ppc64_elf_size_dynamic_sections): Add dynamic
+ DT_PPC64_OPD and DT_PPC64_OPDSZ tags.
+ (ppc64_elf_finish_dynamic_sections): Set values for them.
+
+2002-02-11 Michael Snyder <msnyder@redhat.com>
+
+ * elf-bfd.h (elfcore_write_lwpstatus): Add prototype.
+ * elf.c (elfcore_grok_pstatus): Add prototype.
+ (elfcore_grok_lwpstatus): Add prototype.
+ (elfcore_write_lwpstatus): New function.
+ (elfcore_write_pstatus): Fix typo, eliminate unnecessary memcpy.
+
+2002-02-11 Alexandre Oliva <aoliva@redhat.com>
+
+ * elf32-sh.c: Added missing prototypes.
+ * elf32-sh64.c: Likewise.
+ (sh_elf_align_loads): Mark unused args as such.
+ * elf64-sh64.c: Added missing prototypes.
+ (struct elf_sh64_link_hash_entry): Fix typo.
+ (sh_elf64_relocate_section): Fix info argument passed to
+ _bfd_elf_section_offset.
+
+2002-02-11 Alan Modra <amodra@bigpond.net.au>
+
+ * Makefile.am: "make dep-am".
+ * Makefile.in: Regenerate.
+ * aclocal.m4: Regenerate.
+ * config.in: Regenerate.
+ * configure: Regenerate.
+
+2002-02-10 Daniel Jacobowitz <drow@mvista.com>
+
+ * coff-rs6000.c (xcoff_generate_rtinit): Silence uninitialized
+ variable warnings.
+ * elf32-sh.c (sh_elf_relax_section): Silence signed/unsigned
+ comparison warning.
+ * trad-core.c (trad_unix_core_file_p): Silence pointer/integer
+ cast warnings for the common case.
+
+2002-02-10 Hans-Peter Nilsson <hp@bitrange.com>
+
+ * config.bfd (sh-*-linux*, sh-*-elf* | sh-*-rtemself*): Add sh64
+ vectors.
+ (sh-*-netbsdelf*): New, to trump sh*-*-netbsdelf* and add sh64
+ vectors.
+
+2002-02-09 Richard Henderson <rth@redhat.com>
+
+ * elf64-alpha.c (elf64_alpha_howto): Add R_ALPHA_BRSGP.
+ (elf64_alpha_reloc_map, elf64_alpha_check_relocs): Likewise.
+ (elf64_alpha_relocate_section): Likewise.
+ * reloc.c (BFD_RELOC_ALPHA_BRSGP): New.
+ * bfd-in2.h, libbfd.h: Rebuild.
+
+2002-02-09 Hans-Peter Nilsson <hp@bitrange.com>
+
+ * elf64-mmix.c (_bfd_mmix_finalize_linker_allocated_gregs): Check
+ that base-plus-offset reloc accounting is consistent.
+ (mmix_elf_relax_section): Keep base-plus-offset reloc accounting
+ up to date for undefined symbols.
+
+2002-02-08 Eric Christopher <echristo@redhat.com>
+
+ From Rainer Orth <ro@TechFak.Uni-Bielefeld.DE>
+
+ * elf32-mips.c (_bfd_mips_elf_fake_sections): Don't create .rela
+ sections for the O32 ABI.
+
+2002-02-08 Chris Demetriou <cgd@broadcom.com>
+
+ * elf32-arm.h: Fix formatting of _("...").
+ * elf32-d10v.c: Likewise.
+ * elf32-m68k.c: Likewise.
+ * elf32-mips.c: Likewise.
+
+2002-02-08 Ivan Guzvinec <ivang@opencores.org>
+
+ * coff-or32.c: Fix compile time warning messages.
+
+2002-02-08 Alexandre Oliva <aoliva@redhat.com>
+
+ Contribute sh64-elf.
+ 2002-01-23 Alexandre Oliva <aoliva@redhat.com>
+ * reloc.c (R_SH_GOTPLT32, R_SH_GOT_LOW16, R_SH_GOT_MEDLOW16,
+ R_SH_GOT_MEDHI16, R_SH_GOT_HI16, R_SH_GOTPLT_LOW16,
+ R_SH_GOTPLT_MEDLOW16, R_SH_GOTPLT_MEDHI16, R_SH_GOTPLT_HI16,
+ R_SH_PLT_LOW16, R_SH_PLT_MEDLOW16, R_SH_PLT_MEDHI16,
+ R_SH_PLT_HI16, R_SH_GOTOFF_LOW16, R_SH_GOTOFF_MEDLOW16,
+ R_SH_GOTOFF_MEDHI16, R_SH_GOTOFF_HI16, R_SH_GOTPC_LOW16,
+ R_SH_GOTPC_MEDLOW16, R_SH_GOTPC_MEDHI16, R_SH_GOTPC_HI16,
+ R_SH_GOT10BY4, R_SH_GOTPLT10BY4, R_SH_GOT10BY8, R_SH_GOTPLT10BY8,
+ R_SH_COPY64, R_SH_GLOB_DAT64, R_SH_JMP_SLOT64, R_SH_RELATIVE64):
+ New relocs.
+ * libbfd.h, bfd-in2.h: Rebuilt.
+ * elf32-sh.c (sh_elf_howto_table): Define new relocs.
+ (sh_reloc_map): Map them.
+ (PLT_ENTRY_SIZE, elf_sh_plt0_entry_be, elf_sh_plt0_entry_le,
+ elf_sh_plt_entry_be, elf_sh_plt_entry_le, elf_sh_pic_plt_entry_be,
+ elf_sh_pic_plt_entry_le, elf_sh_plt0_entry, elf_sh_plt_entry,
+ elf_sh_pic_plt_entry, elf_sh_sizeof_plt, elf_sh_plt_plt0_offset,
+ elf_sh_plt0_gotplt_offset, elf_sh_plt_temp_offset,
+ elf_sh_plt_symbol_offset, elf_sh_plt_reloc_offset,
+ movi_shori_putval) [INCLUDE_SHMEDIA]: New.
+ (elf_sh_link_hash_entry) [INCLUDE_SHMEDIA]: Add
+ datalabel_got_offset.
+ (sh_elf_link_hash_newfunc): Initialize it.
+ (sh_elf_relocate_section): Augment the scope of
+ seen_stt_datalabel. Introduce GOTPLT support. Extend GOTPC, PLT,
+ GOT and GOTOFF handling to new SHmedia relocation types. Support
+ GOT_BIAS.
+ (sh_elf_check_relocs): Likewise.
+ (sh_elf_finish_dynamic_symbol) [TARGET_SHMEDIA]: Set up values in
+ PLT entries using movi_shori_putval. Support GOT_BIAS.
+ (sh_elf_finish_dynamic_sections): Likewise.
+ * elf32-sh64.c (shmedia_prepare_reloc): Do not add addend to
+ relocation, it's now done by the caller.
+ (GOT_BIAS): New.
+ * elf64-sh64.c (GOT_BIAS, PLT_ENTRY_SIZE, elf_sh64_sizeof_plt,
+ elf_sh64_plt_plt0_offset, elf_sh64_plt0_gotplt_offset,
+ elf_sh64_plt_temp_offset, elf_sh64_plt_symbol_offset,
+ elf_sh64_plt_reloc_offset, ELF_DYNAMIC_INTERPRETER,
+ elf_sh64_pcrel_relocs_copied, elf_sh64_link_hash_entry,
+ elf_sh64_link_hash_table, sh64_elf64_link_hash_traverse,
+ sh64_elf64_hash_table): New.
+ (sh_elf64_howto_table): Introduce new relocs.
+ (sh_elf64_info_to_howto): Accept new PIC relocs.
+ (sh_elf64_relocate_section): Augment the scope of
+ seen_stt_datalabel. Support new PIC relocs.
+ (sh_elf64_check_relocs): Support new PIC relocs.
+ (elf_sh64_plt0_entry_be, elf_sh64_plt0_entry_le,
+ elf_sh64_plt_entry_be, elf_sh64_plt_entry_le,
+ elf_sh64_pic_plt_entry_be, elf_sh64_pic_plt_entry_le,
+ elf_sh64_plt0_entry, elf_sh64_plt_entry, elf_sh64_pic_plt_entry,
+ sh64_elf64_link_hash_newfunc, sh64_elf64_link_hash_table_create,
+ movi_shori_putval, movi_3shori_putval,
+ sh64_elf64_create_dynamic_sections,
+ sh64_elf64_adjust_dynamic_symbol, sh64_elf64_discard_copies,
+ sh64_elf64_size_dynamic_sections,
+ sh64_elf64_finish_dynamic_symbol,
+ sh64_elf64_finish_dynamic_sections): New.
+ (elf_backend_create_dynamic-sections,
+ bfd_elf64_bfd_link_hash_table_create,
+ elf_backend_adjust_dynamic_symbol,
+ elf_backend_size_dynamic_sections,
+ elf_backend_finish_dynamic_symbol,
+ elf_backend_finish_dynamic_sections, elf_backend_want_got_plt,
+ elf_backend_plt_readonly, elf_backend_want_plt_sym,
+ elf_backend_got_header_size, elf_backend_plt_header_size):
+ Define.
+ 2001-05-16 Alexandre Oliva <aoliva@redhat.com>
+ * elf32-sh.c: Renumbered and renamed some SH5 relocations to
+ match official numbers and names; moved unmaching ones to the
+ range 0xf2-0xff.
+ * elf32-sh64.c, elf64-sh64.c: Likewise.
+ 2001-03-12 DJ Delorie <dj@redhat.com>
+ * elf32-sh.c (sh_elf_relax_section): Don't relax SHmedia
+ sections.
+ 2001-03-12 DJ Delorie <dj@redhat.com>
+ * elf32-sh64.c (shmedia_prepare_reloc): Validate relocs that must
+ be aligned.
+ * elf64-sh64.c (sh_elf64_relocate_section): Ditto.
+ 2001-01-14 Hans-Peter Nilsson <hpn@cygnus.com>
+ * elf32-sh64.c (bfd_elf32_bfd_copy_private_section_data): Define.
+ (sh64_elf_fake_sections): Set type to SHT_SH5_CR_SORTED for a
+ .cranges section with SEC_SORT_ENTRIES set.
+ (sh64_backend_section_from_shdr): Set SEC_SORT_ENTRIES on an
+ incoming sorted .cranges section.
+ (sh64_bfd_elf_copy_private_section_data): New.
+ (sh64_elf_final_write_processing): Only sort .cranges and modify
+ start address if called by linker.
+ 2001-01-08 Ben Elliston <bje@redhat.com>
+ * elf32-sh64.c (sh64_elf_final_write_processing): Activate
+ Hans-Peter Nilsson's set bit 0 patch from 2001-01-06.
+ * elf64-sh64.c (sh64_elf64_final_write_processing): Ditto.
+ 2001-01-06 Hans-Peter Nilsson <hpn@cygnus.com>
+ * elf64-sh64.c (sh_elf64_howto_table): No open brace at start of
+ line. Add comments before all entries.
+ <R_SH_PT_16, R_SH_SHMEDIA_CODE>: Correct and clarify describing
+ comment.
+ (sh_elf64_reloc): Correct head comment.
+ (sh_elf64_relocate_section): Correct spacing.
+ <relocating for a local symbol>: Do not honour STO_SH5_ISA32;
+ instead call reloc_dangerous callback.
+ <case R_SH_SHMEDIA_CODE>: New case.
+ (sh_elf64_gc_mark_hook): Correct spacing.
+ (sh_elf64_check_relocs): Ditto.
+ * elf32-sh64.c (shmedia_prepare_reloc) <case R_SH_SHMEDIA_CODE>:
+ New case.
+ * elf32-sh.c: Correct #endif comments for #ifndef-wrapped
+ functions.
+ (sh_elf_howto_table) <R_SH_PT_16, R_SH_SHMEDIA_CODE>: Correct,
+ clarify describing comment. Add comments before all entries.
+ (sh_elf_relocate_section) <relocating for a local symbol>: Do not
+ honour STO_SH5_ISA32; instead call reloc_dangerous callback.
+ 2001-01-06 Hans-Peter Nilsson <hpn@cygnus.com>
+ Sort .cranges section in final link. Prepare to set bit 0 on
+ entry address.
+ * elf32-sh64.c (struct sh64_find_section_vma_data): New.
+ (sh64_elf_link_output_symbol_hook): Fix typo in prototype.
+ (sh64_elf_set_mach_from_flags): Set SEC_DEBUGGING on incoming
+ .cranges section.
+ (sh64_backend_section_from_shdr): New, to recognize
+ SHT_SH5_CR_SORTED on incoming .cranges section.
+ (elf_backend_section_from_shdr): Define.
+ (sh64_elf_final_write_processing): Sort outgoing .cranges
+ section. (New, temporarily disabled:) Set bit 0 on entry address
+ according to ISA type.
+ (sh64_find_section_for_address): New.
+ (crange_qsort_cmpb, crange_qsort_cmpl, crange_bsearch_cmpb,
+ crange_bsearch_cmpl): Move here from opcodes/sh64-dis.c.
+ (sh64_address_in_cranges): Move here from opcodes/sh64-dis.c. Use
+ bfd_malloc, not xmalloc.
+ (sh64_get_contents_type): Move here from opcodes/sh64-dis.c. Make
+ global.
+ * elf32-sh64.c (sh64_elf64_final_write_processing): New, (but
+ temporarily disabled) setting bit 0 on entry address.
+ (elf_backend_final_write_processing): Define.
+ 2001-01-05 Hans-Peter Nilsson <hpn@cygnus.com>
+ * elf32-sh.c (sh_elf_howto_table) <R_SH_PT_16>: Adjust fields to
+ be a proper relocation for PTA and PTB rather than a marker.
+ <R_SH_IMMU5, R_SH_IMMS6, R_SH_IMMU6, R_SH_IMMS10, R_SH_IMMS10BY2,
+ R_SH_IMMS10BY4, R_SH_IMMS10BY8, R_SH_IMMS16, R_SH_IMMU16,
+ R_SH_IMM_LOW16, R_SH_IMM_LOW16_PCREL, R_SH_IMM_MEDLOW16,
+ R_SH_IMM_MEDLOW16_PCREL, R_SH_IMM_MEDHI16, R_SH_IMM_MEDHI16_PCREL,
+ R_SH_IMM_HI16, R_SH_IMM_HI16_PCREL, R_SH_64, R_SH_64_PCREL>:
+ Zero src_mask.
+ * elf64-sh64.c: Ditto.
+ (sh_elf64_relocate_section) <case R_SH_PT_16>: New case.
+ * elf32-sh64.c: Include opcodes/sh64-opc.h
+ (shmedia_prepare_reloc): Take a bfd_link_info pointer as first
+ argument. Drop const qualifiers from "bfd *" and "bfd_byte *"
+ parameters. No unused parameters. Caller changed.
+ <case R_SH_PT_16>: New case.
+ * Makefile.am (elf32-sh64.lo): Add dependency on sh64-opc.h.
+ * Makefile.in: Regenerate.
+ 2000-12-30 Hans-Peter Nilsson <hpn@cygnus.com>
+ * elf64-sh64.c (sh64_elf64_fake_sections): Set SHF_SH5_ISA32 for
+ all code sections.
+ (sh_elf64_set_mach_from_flags): Change from EF_SH64 to EF_SH5.
+ (sh64_elf_merge_private_data): Ditto.
+ * elf32-sh64.c (sh64_elf_fake_sections): Use sh64_elf_section_data
+ to access stored section flags.
+ (sh64_elf_final_write_processing): Return immediately unless
+ called by linker. Use sh64_elf_section_data (cranges) to get size
+ of linker-generated cranges entries.
+ (sh64_elf_copy_private_data): Add missing "return true".
+ (sh64_elf_set_mach_from_flags): Change from EF_SH64 to EF_SH5.
+ (sh_elf64_merge_private_data): Ditto.
+ 2000-12-19 Hans-Peter Nilsson <hpn@cygnus.com>
+ * elf64-sh64.c (sh64_elf64_fake_sections): New, copy of
+ elf64-sh64.c:sh64_elf_fake_sections.
+ (elf_backend_fake_sections): Define as sh64_elf64_fake_sections.
+ 2000-12-18 Hans-Peter Nilsson <hpn@cygnus.com>
+ * elf32-sh64.c (sh64_elf_copy_private_data_internal): Delete.
+ (sh64_elf_final_write_processing): New.
+ (elf_backend_final_write_processing): Define.
+ (sh64_elf_fake_sections): Get header flags from tdata field.
+ (sh64_elf_copy_private_data): Do not call
+ sh64_elf_copy_private_data_internal, just copy e_flags field.
+ (sh64_elf_merge_private_data): Do not call
+ sh64_elf_copy_private_data_internal.
+ 2000-12-12 Hans-Peter Nilsson <hpn@cygnus.com>
+ Remove EF_SH64_ABI64, let ELF size make difference.
+ Remove SH64-specific BFD section flag.
+ * elf32-sh64.c (sh64_elf_fake_sections): Recognize section as
+ containing SHmedia through elf_section_data (asect)->tdata
+ non-zero, not using a BFD section flag.
+ (sh64_elf_set_mach_from_flags): Don't recognize EF_SH64_ABI64.
+ (sh64_elf_merge_private_data): Similar.
+ (elf_backend_section_flags): Don't define.
+ (sh64_elf_backend_section_flags): Delete.
+ * elf64-sh64.c (sh_elf64_set_mach_from_flags): Recognize EF_SH64,
+ not EF_SH64_ABI64.
+ (sh_elf64_merge_private_data): Similar.
+ * section.c (Section flags definitions): Don't define
+ SEC_SH_ISA_SHMEDIA.
+ (bfd-in2.h): Regenerate.
+ 2000-12-09 Hans-Peter Nilsson <hpn@cygnus.com>
+ Make DataLabel references work with partial linking.
+ * elf32-sh64.c: Fix formatting.
+ (sh64_elf_link_output_symbol_hook): New.
+ (elf_backend_link_output_symbol_hook): Define to
+ sh64_elf_link_output_symbol_hook.
+ (sh64_elf_add_symbol_hook): Make DataLabel symbol just global
+ undefined if partial linking. Adjust sanity check.
+ * elf64-sh64.c (sh64_elf64_link_output_symbol_hook): New.
+ (elf_backend_link_output_symbol_hook): Define to
+ sh64_elf64_link_output_symbol_hook.
+ (sh64_elf64_add_symbol_hook): Make DataLabel symbol just global
+ undefined if partial linking. Adjust sanity check.
+ 2000-12-07 Hans-Peter Nilsson <hpn@cygnus.com>
+ Implement semantics for inter-file DataLabel references.
+ * elf64-sh64.c (DATALABEL_SUFFIX): Define.
+ (sh64_elf64_add_symbol_hook): New.
+ (sh_elf64_relocate_section): If passing an indirect symbol with
+ st_type STT_DATALABEL on the way to a symbol with st_other
+ STO_SH5_ISA32, do not bitor 1 to the relocation.
+ (elf_backend_add_symbol_hook): Define to
+ sh64_elf64_add_symbol_hook.
+ * elf64-sh32.c: Tweak comments.
+ (DATALABEL_SUFFIX): Define.
+ (sh64_elf_add_symbol_hook): New.
+ (elf_backend_add_symbol_hook): Define to sh64_elf_add_symbol_hook.
+ * elf32-sh.c (sh_elf_relocate_section): If passing an indirect
+ symbol with st_type STT_DATALABEL on the way to a symbol with
+ st_other STO_SH5_ISA32, do not bitor 1 to the relocation.
+ 2000-12-05 Hans-Peter Nilsson <hpn@cygnus.com>
+ Pass through STT_DATALABEL.
+ * elf32-sh64.c (sh64_elf_get_symbol_type): New.
+ (elf_backend_get_symbol_type): Define.
+ * elf64-sh64.c (sh64_elf64_get_symbol_type): New.
+ (elf_backend_get_symbol_type): Define.
+ 2000-11-30 Hans-Peter Nilsson <hpn@cygnus.com>
+ * elf32-sh64.c: Tweak comments.
+ (sh64_elf_copy_private_data_internal): Add prototype.
+ (bfd_elf32_bfd_set_private_flags): Define.
+ (sh64_elf_copy_private_data_internal): Compare machine name, not
+ textual BFD target name, to check whether to copy section flag
+ SHF_SH5_ISA32.
+ (sh64_elf_merge_private_data): Validize bfd_get_arch_size.
+ Tweak section-contents-type-mismatch message.
+ (shmedia_prepare_reloc): Add ATTRIBUTE_UNUSED markers.
+ Validize reloc-types.
+ * elf64-sh64.c: New file.
+ * targets.c (bfd_elf64_sh64_vec, bfd_elf64_sh64l_vec): Declare.
+ * Makefile.am (BFD64_BACKENDS): Add elf64-sh64.lo.
+ (BFD64_BACKENDS_CFILES): Add elf64-sh64.c.
+ Regenerate dependencies.
+ * Makefile.in: Regenerate.
+ * config.bfd (sh64-*-elf*): Add bfd_elf64_sh64_vec and
+ bfd_elf64_sh64l_vec.
+ * configure.in: Handle bfd_elf64_sh64_vec and
+ bfd_elf64_sh64l_vec.
+ * configure: Regenerate.
+ * po/POTFILES.in: Regenerate.
+ * po/bfd.pot: Regenerate.
+ 2000-11-29 Hans-Peter Nilsson <hpn@cygnus.com>
+ * elf32-sh64.c (sh64_elf_set_mach_from_flags): Do not recognize
+ anything else but EF_SH64 and EF_SH64_ABI64.
+ (sh64_elf_merge_private_data): Emit error for anything else but
+ EF_SH64 and EF_SH64_ABI64.
+ * config.bfd: Remove bfd_elf32_shblin_vec and bfd_elf32_shlin_vec
+ from targ_selvecs.
+ * configure.in: Add cofflink.lo to bfd_elf32_sh64_vec and
+ bfd_elf32_sh64l_vec as a temporary measure.
+ * configure: Regenerate.
+ 2000-11-27 Hans-Peter Nilsson <hpn@cygnus.com>
+ * cpu-sh.c (arch_info_struct): Include sh5 item
+ unconditionalized.
+ * config.bfd (sh64-*-elf*): Do not set targ_cflags.
+ Add targ_selvecs bfd_elf32_sh_vec, bfd_elf32_shl_vec,
+ bfd_elf32_shblin_vec and bfd_elf32_shlin_vec.
+ * elf32-sh64.c: Tweak comments.
+ (sh64_elf_set_mach_from_flags): Recognize all machine flags that
+ are proper subsets of SH64 as bfd_mach_sh5. Add EF_SH64_ABI64.
+ (sh64_elf_copy_private_data_internal): Wrap long line.
+ (sh64_elf_merge_private_data): Rewrite to allow objects from
+ SH64 subsets to be linked together.
+ (INCLUDE_SHMEDIA): Define.
+ * elf32-sh.c (sh_elf_relocate_section) <local symbol>:
+ Parenthesize plus-expression inside or-expression.
+ <global symbol>: Ditto.
+ (sh_elf_set_mach_from_flags): Remove code refusing
+ deleted EF_SH64_32BIT_ABI flag.
+ 2000-11-26 Hans-Peter Nilsson <hpn@cygnus.com>
+ * elf32-sh.c (sh_elf_howto_table) <R_SH_IMM_LOW16_PCREL,
+ R_SH_IMM_MEDLOW16_PCREL, R_SH_IMM_MEDHI16_PCREL,
+ R_SH_IMM_HI16_PCREL, R_SH_64_PCREL>: Set pcrel_offset to true.
+ (sh_elf_relocate_section) <local symbol>: Or 1 in
+ calculation of relocation if sym->st_other & STO_SH5_ISA32.
+ <global symbol>: Ditto if h->other & STO_SH5_ISA32.
+ * elf32-sh64.c (shmedia_prepare_reloc): Add rel->r_addend to
+ relocation.
+ 2000-11-24 Hans-Peter Nilsson <hpn@cygnus.com>
+ * Makefile.am (BFD32_BACKENDS): Add elf32-sh64.lo.
+ (BFD32_BACKENDS_CFILES): Add elf32-sh64.c.
+ Regenerate dependencies.
+ * Makefile.in: Regenerate.
+ * archures.c: Add bfd_mach_sh5.
+ * config.bfd: Map targ_cpu sh* to bfd_sh_arch.
+ Handle sh64-*-elf*. Set targ_cflags to -DINCLUDE_SHMEDIA.
+ * configure.in: Handle bfd_elf32_sh64_vec and bfd_elf32_sh64l_vec.
+ * configure: Regenerate.
+ * reloc.c (BFD_RELOC_SH_SHMEDIA_CODE, BFD_RELOC_SH_IMMU5,
+ BFD_RELOC_SH_IMMS6, BFD_RELOC_SH_IMMS6BY32, BFD_RELOC_SH_IMMU6,
+ BFD_RELOC_SH_IMMS10, BFD_RELOC_SH_IMMS10BY2,
+ BFD_RELOC_SH_IMMS10BY4, BFD_RELOC_SH_IMMS10BY8,
+ BFD_RELOC_SH_IMMS16, BFD_RELOC_SH_IMMU16, BFD_RELOC_SH_IMM_LOW16,
+ BFD_RELOC_SH_IMM_LOW16_PCREL, BFD_RELOC_SH_IMM_MEDLOW16,
+ BFD_RELOC_SH_IMM_MEDLOW16_PCREL, BFD_RELOC_SH_IMM_MEDHI16,
+ BFD_RELOC_SH_IMM_MEDHI16_PCREL, BFD_RELOC_SH_IMM_HI16,
+ BFD_RELOC_SH_IMM_HI16_PCREL, BFD_RELOC_SH_PT_16): New relocations.
+ * cpu-sh.c [INCLUDE_SHMEDIA] (arch_info_struct): Define and link
+ in item for SH5.
+ * elf32-sh.c [INCLUDE_SHMEDIA] (sh_elf_howto_table): Add howto items
+ for SHmedia relocs.
+ [INCLUDE_SHMEDIA] (sh_rel): Add mappings for SHmedia relocs.
+ [INCLUDE_SHMEDIA] (sh_elf_relocate_section) [default]: Call
+ shmedia_prepare_reloc, goto final_link_relocate if it returns
+ non-zero, else fail as before.
+ (sh_elf_set_mach_from_flags): Provide function only if not defined
+ as macro. Do not recognize objects with EF_SH64_32BIT_ABI set.
+ (sh_elf_set_private_flags): Provide function only if not defined
+ as a macro.
+ (sh_elf_copy_private_data): Similar.
+ (sh_elf_merge_private_data): Similar.
+ * section.c (SEC_SH_ISA_SHMEDIA): New.
+ * targets.c (bfd_elf32_sh64_vec, bfd_elf32_sh64l_vec): Declare.
+ * elf32-sh64.c: New file.
+ * libbfd.h: Regenerate.
+ * bfd-in2.h: Regenerate.
+ * po/POTFILES.in: Regenerate.
+ * po/bfd.pot: Regenerate.
+ * bfd-in2.h: Regenerate.
+ * libbfd.h: Regenerate.
+
+2002-02-07 Daniel Jacobowitz <drow@mvista.com>
+
+ * bfd-in.h: Update <stdbool.h> check to only see if <stdbool.h> has
+ been included, not drag it in.
+ * bfd-in2.h: Regenerate.
+
+2002-02-06 H.J. Lu (hjl@gnu.org)
+
+ * elf32-mips.c (_bfd_mips_elf_merge_private_bfd_data): Update
+ the mach and ISA fields if necessary.
+
+2002-02-06 Nick Clifton <nickc@cambridge.redhat.com>
+
+ * coffcode.h (coff_set_arch_mach_hook): Select the highest known
+ ARM architecture when an F_ARM_5 flag is detected, since we cannot
+ be sure exactly which architecture this represents.
+
+2002-02-05 Nick Clifton <nickc@redhat.com>
+
+ * po/tr.po: Updated translation.
+
+2002-02-05 Alan Modra <amodra@bigpond.net.au>
+
+ From Jimi X <jimix@watson.ibm.com>
+ * archures (bfd_mach_ppc64): Define.
+ (bfd_powerpc_arch): Rename to bfd_powerpc_archs.
+ (bfd_powerpc_arch): Define.
+ * bfd-in2.h: Regenerate.
+ * cpu-powerpc.c (arch_info_struct): Rename to bfd_powerpc_archs.
+ (bfd_powerpc_arch): Move to tail of bfd_powerpc_archs.
+ (bfd_powerpc_archs): Add default powerpc64 arch.
+
+2002-02-05 Alan Modra <amodra@bigpond.net.au>
+
+ * elf64-ppc.c (ppc64_elf_size_dynamic_sections): Check for relocs
+ against section syms in readonly sections. Don't do the global
+ sym check if we find one.
+ * elf64-s390.c (elf_s390_size_dynamic_sections): Likewise.
+ * elf32-hppa.c (elf32_hppa_size_dynamic_sections): Likewise.
+ * elf32-i386.c (elf_i386_size_dynamic_sections): Likewise.
+ * elf32-s390.c (elf_s390_size_dynamic_sections): Likewise.
+ (elf_s390_grok_prstatus): Add missing prototype.
+
+2002-02-04 Hans-Peter Nilsson <hp@bitrange.com>
+
+ * elf64-mmix.c (mmix_dump_bpo_gregs): New function.
+ (mmix_elf_check_common_relocs) <case R_MMIX_BASE_PLUS_OFFSET>:
+ Call bfd_get_section_by_name only once. Initialize
+ bpodata->n_bpo_relocs_this_section.
+ (_bfd_mmix_prepare_linker_allocated_gregs): Remove comment
+ referring to DSOs.
+ (bpo_reloc_request_sort_fn): Don't use difference of values as
+ return-value.
+
+2002-02-02 David O'Brien <obrien@FreeBSD>
+
+ * configure.in: Tweak the FreeBSD 4.x recognition more. Only treat
+ version 4.5 and later the same as 5-CURRENT.
+ * configure: Re-generate.
+
+2002-02-02 Jason Thorpe <thorpej@wasabisystems.com>
+
+ * config.bfd (hppa*-*-netbsd*): New target.
+
+2002-01-31 Philipp Thomas <pthomas@suse.de>
+
+ * coff-arm.c (coff_arm_merge_private_bfd_data): Move ERROR
+ to front of message. Unify messages with elf32-arm.h. Use
+ commas where neccessary.
+ * elf32-arm.h (elf32_arm_merge_private_bfd_data): Use all upcase
+ ERROR in messages. Unify messages with coff-arm.c. Correct
+ VFP/FPA error message.
+ (elf32_arm_print_private_bfd_data): Don't mark APCS-26 and
+ APCS-32 for translation.
+
+2002-02-01 Hans-Peter Nilsson <hp@bitrange.com>
+
+ Perform on-demand global register allocation from
+ R_MMIX_BASE_PLUS_OFFSET relocs.
+ * elf64-mmix.c (struct bpo_reloc_section_info, struct
+ bpo_reloc_request, struct bpo_greg_section_info): New.
+ (mmix_elf_check_common_relocs, mmix_elf_gc_sweep_hook,
+ bpo_reloc_request_sort_fn, mmix_elf_relax_section,
+ _bfd_mmix_check_all_relocs,
+ _bfd_mmix_prepare_linker_allocated_gregs,
+ _bfd_mmix_finalize_linker_allocated_gregs): New functions.
+ (elf_mmix_howto_table): Correct src_mask for most relocs.
+ (mmix_elf_perform_relocation) <case R_MMIX_BASE_PLUS_OFFSET>: New
+ case.
+ (mmix_final_link_relocate) <case R_MMIX_BASE_PLUS_OFFSET>: New
+ case. Fix typo in comment. New label do_mmix_reloc.
+ (mmix_elf_check_relocs): Abuse bfd_link_info member base_file to
+ store first object file with a base-plus-offset reloc. Call
+ mmix_elf_check_common_relocs for the part common with mmo.
+ (mmix_elf_final_link): Write out linker-allocated register
+ contents section.
+ (elf_backend_gc_sweep_hook): Define.
+ (bfd_elf64_bfd_relax_section): Define.
+
+ * mmo.c: Don't include <ctype.h>
+ (mmo_init): Correct init-once logic.
+
+2002-02-01 Tom Rix <trix@redhat.com>
+
+ * config.bfd: Conditionally support <aiaff> for pre AIX 4.3.
+
+2002-02-01 Alan Modra <amodra@bigpond.net.au>
+
+ * Makefile.am: Run "make dep-am"
+ * Makefile.in: Regenerate.
+
+2002-01-31 David O'Brien <obrien@FreeBSD>
+
+ * configure.in: Recognize the differences in core files from FreeBSD
+ 4.{0,1} and later versions of 4.x. This treats 4.2+ the same as
+ 5-CURRENT.
+ * configure: Regenerate.
+
+2002-01-31 Ivan Guzvinec <ivang@opencores.org>
+
+ * coff-or32.c: New file.
+ * cpu-or32.c: New file.
+ * elf32-or32.c: New file.
+ * archures.c: Add support for or32.
+ * targets.c: Add support for or32.
+ * bfd-in2.h: Regenerate.
+ * coffcode.h (coff_set_arch_mach_hook, coff_set_flags,
+ coff_write_object_contents): Add support for or32.
+ * config.bfd: Add target.
+ * configure.in: Add support for or32.
+ * configure: Regenerate.
+ * Makefile.am: Add support for or32.
+ * Makefile.in: Regenerate.
+ * po/SRC-POTFILES.in: Add or32 files.
+ * po/bfd.pot: Regenerate.
+
+2002-01-31 Nick Clifton <nickc@cambridge.redhat.com>
+ Don Lindsay <lindsayd@cisco.com>
+
+ * elf32-mips.c (mips_elf_calculate_relocation): Replace 'return
+ false' with a return of a bfd_reloc_ error code.
+
+2002-01-31 Hans-Peter Nilsson <hp@axis.com>
+
+ * elf32-cris.c (elf_cris_discard_excess_program_dynamics): Don't
+ unexport unreferenced symbols when --export-dynamic. Call
+ _bfd_elf_strtab_delref when unexporting.
+
+2002-01-30 Daniel Jacobowitz <drow@mvista.com>
+
+ * bfd-in.h: Include <stdbool.h> if it is available.
+ * bfd-in2.h: Regenerated.
+
+2002-01-31 Alan Modra <amodra@bigpond.net.au>
+
+ * elf64-ppc.c (func_desc_adjust): STV_PROTECTED functions should
+ not go via the plt.
+
+2002-01-30 Nick Clifton <nickc@cambridge.redhat.com>
+
+ * archures.c: Tidy up formatting of embedded comments.
+ * bfd.c: Tidy up formatting of embedded comments.
+ * bfd-in.h: Fix formatting of comments.
+ * reloc.c: Tidy up formatting of ordinary & embedded comments.
+ * section.c: Tidy up formatting of embedded comments.
+ * syms.c: Tidy up formatting of embedded comments.
+ * targets.c: Tidy up formatting of embedded comments.
+
+ * bfd-in2.h: Regenerate.
+
+2002-01-30 Nick Clifton <nickc@cambridge.redhat.com>
+
+ * vms-tir.c (cmd_name): New function.
+ (tir_cmd_name): New function.
+ (etir_sta, etir_sto, etir_opr, etir_stc): Use cmd_name().
+ (tir_opr, tir_ctl, tir_cmd): use tir_cmd_name().
+ Fix formatting.
+
+ * peXXigen.c (pe_print_idata): Rearrange message to aid in
+ translation.
+ (pe_print_pdata): Rearrange message to aid in translation.
+
+ * libbfd.c (warn_deprecated): Rearrange error message to aid in
+ translation.
+
+ * ihex.c (ihex_write_object_contents): Fix spelling typo.
+
+ * ieee.c (ieee_slurp_external_symbols): Remove spurious space.
+
+ * elf64-sparc.c (sparc64_elf_add_symbol_hook): Rearrange error
+ message to aid in translation.
+
+ * elf64-mmix.c (mmix_final_link_relocate): Rearrange error message
+ to aid in translation.
+
+ * elf32-arm.h (elf32_arm_merge_private_bfd_data): Fix typo.
+
+2002-01-30 Philipp Thomas <pthomas@suse.de>
+
+ * coff-arm.c, elf32-elf.h: Unify messages.
+
+2002-01-30 Nick Clifton <nickc@redhat.com>
+
+ * po/sv.po: Updated translation.
+
+2002-01-30 Philipp Thomas <pthomas@suse.de>
+
+ * dwarf2.c (read_abbrev): Use full section name in error message.
+ (decode_line_info): Likewise.
+
+ * elf.c (_bfd_elf_symbol_from_bfd_symbol): Don't translate debugging
+ message.
+
+2002-01-30 Alan Modra <amodra@bigpond.net.au>
+
+ * elf64-ppc.c (func_desc_adjust): Only provide missing function
+ descriptor symbols for undefined function code syms. Clear
+ ELF_LINK_NON_ELF so that they can stay weak.
+
+2002-01-29 Chris Demetriou <cgd@broadcom.com>
+ Mitch Lichtenberg <mpl@broadcom.com>
+
+ * bfd-in.h (bfd_mips_elf32_create_embedded_relocs): New prototype.
+ * elf32-mips.c (bfd_mips_elf32_create_embedded_relocs): New function
+ to handle 32-bit ELF embedded reloc (ld --embedded-relocs)
+ generation.
+ * bfd-in2.h: Regenerate.
+
+2002-01-29 Chris Demetriou <cgd@broadcom.com>
+
+ * elf32-mips.c: Add additional comments about HI16 relocation
+ processing.
+ (_bfd_mips_elf_hi16_reloc): Don't subtract address here for
+ pc-relative relocations. (Reverts change made on 2001-10-31.)
+ (_bfd_mips_elf_lo16_reloc): Subtract address of LO16 part here
+ for pc-relative relocations.
+ (mips_elf_calculate_relocation): Add a comment about a kludge
+ in the R_MIPS_GNU_REL_HI16 handling.
+ (_bfd_mips_elf_relocate_section): Implement that kludge;
+ adjust pc-relative HI16 relocation for difference in HI16 and
+ LO16 addresses, since it can't easily be done in
+ mips_elf_calculate_relocation.
+
+2002-01-29 Martin Schwidefsky <schwidefsky@de.ibm.com>
+
+ * elf32-i386 (elf_i386_adjust_dynamic_symbol): Do not replace PLT32
+ relocations with PC32 relocations for undefined or weak symbols.
+ * elf32-s390 (elf_i386_adjust_dynamic_symbol): Likewise.
+ * elf64-s390x (elf_i386_adjust_dynamic_symbol): Likewise.
+
+2002-01-28 Jason Thorpe <thorpej@wasabisystems.com>
+
+ * elfcore.h (elf_core_file_p): Improve comment for last change.
+
+2002-01-27 Daniel Jacobowitz <drow@mvista.com>
+
+ * configure: Regenerated.
+
+2002-01-27 Jason Thorpe <thorpej@wasabisystems.com>
+
+ * elfcore.h (elf_core_file_p): Set the machine architecture
+ before processing the program headers.
+
+2002-01-26 Hans-Peter Nilsson <hp@bitrange.com>
+
+ * configure.in <64-bit configuration>: If using gcc, check and
+ emit error for egcs-1.1.2.
+ * configure: Regenerate.
+
+2002-01-26 Egor Duda <deo@logos-m.ru>
+
+ * elf.c (elfcore_grok_win32pstatus): Copy only as much information
+ as possible to avoid stack corruption.
+
+2002-01-26 Richard Henderson <rth@redhat.com>
+
+ * elf64-alpha.c (elf64_alpha_check_relocs): Don't set reltext
+ for non-allocated sections.
+
+2002-01-25 Mark Kettenis <kettenis@gnu.org>
+
+ * elf.c (elfcore_write_prstatus): Make sure we pass the address of
+ prstat.pr_reg even if it is a struct.
+
+2002-01-25 Steve Ellcey <sje@cup.hp.com>
+
+ * elfxx-ia64.c: Reset AIX vector function overrides for HP-UX.
+
+2002-01-25 Philipp Thomas <pthomas@suse.de>
+
+ * coffgen.c (coff_print_symbol): Don't mark info message
+ for translation.
+
+2002-01-25 Nick Clifton <nickc@redhat.com>
+
+ * po/fr.po: Updated translation.
+ * po/es.po: Updated translation.
+
+2002-01-25 Philipp Thomas <pthomas@suse.de>
+
+ * coff-alpha.c (alpha_relocate_section): Unify warning message
+ for GP relative relocations without GP defined.
+ * coff-mips.c (mips_relocate_section): Likewise.
+
+2002-01-25 Alan Modra <amodra@bigpond.net.au>
+
+ * elf-eh-frame.c (_bfd_elf_eh_frame_section_offset): Avoid
+ unsigned overflow when new_offset < old_offset.
+
+2002-01-24 Philipp Thomas <pthomas@suse.de>
+
+ * bfd.c (_bfd_abort): Fix typo.
+
+2002-01-23 Richard Henderson <rth@redhat.com>
+
+ * elf64-alpha.c (elf64_alpha_adjust_dynamic_symbol): Don't suppress
+ plt entries for undefweak symbols.
+
+2002-01-23 Steve Ellcey <sje@cup.hp.com>
+
+ * targets.c (bfd_elf32_ia64_hpux_big_vec): Add to DEFAULT_VECTOR.
+ (bfd_elf64_ia64_hpux_big_vec): Ditto.
+ (bfd_elf32_h8300_vec): Ditto.
+
+2002-01-23 Alan Modra <amodra@bigpond.net.au>
+
+ * elf64-ppc.c: Remove stale part of ABI comment.
+ (NO_OPD_RELOCS): Define.
+ (ppc64_elf_check_relocs): Use it.
+ (ppc64_elf_relocate_section): Here too.
+ (build_one_stub): Don't point function syms at the stub. Instead,
+ hijack plt.offset.
+ (ppc64_elf_relocate_section): Check whether REL24 relocs should
+ really go to the stub. Make all dynamic relocs in opd against
+ locals.
+ (ppc64_elf_finish_dynamic_symbol): Allow for non-standard use of
+ plt.offset.
+
+2002-01-22 Richard Henderson <rth@redhat.com>
+
+ * elf64-alpha.c (INSN_UNOP): Encode with RB as $sp.
+
+2002-01-22 Alan Modra <amodra@bigpond.net.au>
+
+ * elf64-ppc.c (ppc64_elf_finish_dynamic_sections): Correct sign of
+ TOC_BASE_OFF adjustment.
+
+ * Makefile.am: Run "make dep-am".
+ * Makefile.in: Regenerate.
+ * po/SRC-POTFILES.in: Regenerate.
+
+2002-01-22 John David Anglin <dave@hiauly1.hia.nrc.ca>
+
+ * configure.host (hppa*64*-*-hpux*, hppa*64*-*-linux*): Add new
+ host defines.
+
+2002-01-21 Hans-Peter Nilsson <hp@axis.com>
+
+ * elf32-cris.c (cris_elf_relocate_section) <case R_CRIS_32_GOTREL>:
+ Check for and emit error if sgot is NULL at this point.
+
+2002-01-21 Jason Thorpe <thorpej@wasabisystems.com>
+
+ * config.bfd (ia64*-*-netbsd*): New target.
+
+2002-01-21 Thomas Klausner <wiz@danbala.ifoer.tuwien.ac.at>
+
+ * som.c (som_write_space_strings): Comment typo fix.
+
+2002-01-21 Alan Modra <amodra@bigpond.net.au>
+
+ * elf64-ppc.c (struct ppc_link_hash_entry): Add is_func and
+ is_func_descriptor fields.
+ (link_hash_newfunc): Init them.
+ (ppc64_elf_check_relocs): Only R_PPC24_REL24 syms starting with a
+ dot are candidates for plt entries. When processing .opd relocs,
+ set function descriptor strings to point inside function code
+ string, and set new ppc_link_hash_entry fields.
+ (ppc64_elf_gc_sweep_hook): Don't sweep R_PPC64_REL24 relocs.
+ (ppc64_elf_adjust_dynamic_symbol): Remove most code dealing with
+ function descriptors. It's now done in..
+ (func_desc_adjust): New.
+ (ppc64_elf_func_desc_adjust): New.
+ (define elf_backend_always_size_sections): Define.
+ (ppc64_elf_hide_symbol): New.
+ (define elf_backend_hide_symbol): Define.
+ (allocate_dynrelocs): Remove code looking up function descriptors
+ as that has been done earlier.
+ (ppc64_elf_size_dynamic_sections): Use htab shortcut to elf hash
+ table.
+ (ppc64_elf_finish_dynamic_symbol): Likewise. Remove code looking
+ up function descriptor.
+ (build_one_stub): Look up the function code sym. Check for
+ invalid plt offsets.
+ (ppc64_elf_relocate_section): Tweak calls to undefined weak syms.
+ Convert R_PPC64_TOC relocs to R_PPC64_RELATIVE in shared libs.
+
+ * elf-bfd.h (elf_backend_data <elf_backend_hide_symbol>): Add
+ boolean param.
+ (_bfd_elf_link_hash_hide_symbol): Likewise.
+ * elflink.h (elf_link_add_object_symbols): Adjust call to
+ elf_backend_hide_symbol.
+ (elf_fix_symbol_flags): Likewise.
+ (elf_link_assign_sym_version): Likewise. Use bfd_malloc rather
+ than bfd_alloc.
+ * elf.c (_bfd_elf_link_hash_hide_symbol): Add "force_local" param.
+ Set ELF_LINK_FORCED_LOCAL and call _bfd_elf_strtab_delref.
+ * elf32-hppa.c (elf32_hppa_hide_symbol): Likewise.
+ (clobber_millicode_symbols): Adjust to suit new hide_symbol.
+ * elf32-cris.c (elf_cris_hide_symbol): Add "force_local" param
+ and adjust to suit.
+ * elf32-mips.c (_bfd_mips_elf_hide_symbol): Likewise, and call
+ _bfd_elf_link_hash_hide_symbol rather than duplicating code.
+ * elfxx-ia64.c (elfNN_ia64_hash_hide_symbol): Likewise.
+
+2002-01-18 Alan Modra <amodra@bigpond.net.au>
+
+ * elf64-ppc.c (ppc64_elf_adjust_dynamic_symbol): Test for a
+ dynamic function descriptor symbol, not the associated function
+ symbol.
+
+2002-01-17 Eric Christopher <echristo@redhat.com>
+
+ * elf32-mips.c (mips_elf_calculate_relocation): Fix typo.
+
+2002-01-17 Nick Clifton <nickc@cambridge.redhat.com>
+
+ * po/bfd.pot: Regenerate.
+ * po/fr.po: Regenerate.
+
+2002-01-17 Alan Modra <amodra@bigpond.net.au>
+
+ * elf-bfd.h (elf_backend_data <elf_backend_section_from_bfd_section>):
+ Remove "Elf_Internal_Shdr *" param.
+ (_bfd_mips_elf_section_from_bfd_section): Ditto.
+ * elf32-mips.c (_bfd_mips_elf_section_from_bfd_section): Ditto.
+ * elf32-m32r.c (_bfd_m32r_elf_section_from_bfd_section): Ditto.
+ * elf32-v850.c (v850_elf_section_from_bfd_section): Ditto.
+ * elf64-mmix.c (mmix_elf_section_from_bfd_section): Ditto.
+ * elfxx-ia64.c (elfNN_hpux_backend_section_from_bfd_section): Ditto.
+ * elf.c (_bfd_elf_section_from_bfd_section): Allow backend
+ function to override special sections. Remove hdr arg from
+ backend call, and don't loop.
+
+2002-01-16 Eric Christopher <echristo@redhat.com>
+
+ * elf32-mips.c (mips_elf_calculate_relocation): Set require_jalxp
+ on R_MIPS_26 and target is 16bit. Add R_MIPS16_GPREL to list of
+ relocations requiring gp0 and gp.
+
+2002-01-16 Richard Earnshaw <rearnsha@arm.com>
+
+ * elf32-arm.h (elf32_arm_merge_private_bfd_data): Handle
+ EF_ARM_VFP_FLOAT.
+ (elf32_arm_print_private_bfd_data): Likewise.
+
+2002-01-16 Nick Clifton <nickc@cambridge.redhat.com>
+
+ * po/tr.po: Import new version.
+
+2002-01-16 Alan Modra <amodra@bigpond.net.au>
+
+ * elf64-ppc.c (ppc64_elf_howto_raw): Remove stale FIXMEs.
+ (ppc64_elf_reloc_type_lookup): Use proper CTOR reloc.
+ (ORI_R0_R0_0): Correct.
+
+2002-01-16 Alan Modra <amodra@bigpond.net.au>
+
+ * elflink.c (_bfd_elf_create_dynamic_sections): Don't set SEC_CODE
+ when plt_not_loaded.
+ * elf64-ppc.c (ppc64_elf_create_dynamic_sections): No need to
+ clear .plt SEC_CODE here. Create .stub and correct .glink flags.
+ (PLT_INITIAL_ENTRY_SIZE): Set to 24.
+ (ppc64_elf_glink_code): Delete.
+ (PPC64_ELF_GLINK_SIZE): Delete.
+ (ADDIS_R12_R2, STD_R2_40R1, LD_R11_0R12, LD_R2_0R12, MTCTR_R11,
+ BCTR, ADDIS_R12_R12_1, LD_R2_40R1, NOP, LI_R0_0, B_DOT, LIS_R0_0,
+ ORI_R0_R0_0): Define.
+ (PLT_CALL_STUB_SIZE, GLINK_CALL_STUB_SIZE): Define.
+ (struct ppc_link_hash_table): Add sstub and plt_overflow.
+ (ppc64_elf_link_hash_table_create): Init them.
+ (ppc64_elf_check_relocs <R_PPC64_REL24>): Refcount .plt entry.
+ Don't copy to shared lib.
+ (ppc64_elf_check_relocs): Call bfd_set_error on errors.
+ (ppc64_elf_gc_sweep_hook <R_PPC64_REL24>): Sweep plt refcount.
+ (allocate_dynrelocs <plt>): Don't change function sym here. Make
+ room for .stub and .glink code.
+ (ppc64_elf_size_dynamic_sections): Handle .stub. Make entry for
+ DT_PPC64_GLINK.
+ (ppc64_elf_final_link): Rename to ppc64_elf_set_toc. Don't call
+ bfd_elf64_bfd_final_link.
+ (bfd_elf64_bfd_final_link): Don't define.
+ (ppc64_elf_size_stubs): New.
+ (build_plt_stub): New.
+ (build_one_stub): New.
+ (ppc64_elf_build_stubs): New.
+ (ppc64_elf_relocate_section <toc relocs>): Remove assert.
+ (ppc64_elf_relocate_section): Don't copy R_PPC64_REL24 relocs.
+ (ppc64_elf_finish_dynamic_symbol): Don't build stubs here. Set
+ DT_PPC64_GLINK entry. Tweak DT_PLTGOT, DT_JMPREL, DT_PLTRELSZ in
+ case output sections not separate. Adjust DT_RELASZ to not
+ include plt relocs. Set reserved got entry. Set got and plt
+ entry size.
+ (elf_backend_got_header_size): Set to 8.
+ * elf64-ppc.h: New file.
+
+2002-01-16 Alan Modra <amodra@bigpond.net.au>
+
+ * elf32-arm.h (elf32_arm_size_dynamic_sections): When removing
+ sections, use bfd_section_list_remove.
+ * elf32-i370.c (i370_elf_size_dynamic_sections): Likewise.
+ * elflink.h (elf_link_add_object_symbols): When removing all
+ sections, use bfd_section_list_clear.
+
+2002-01-15 Nick Clifton <nickc@cambridge.redhat.com>
+
+ * po/sv.po: New file: Swedish translation.
+ * configure.in (ALL_LINGUAS): Add sv.
+ * configure: Regenerate.
+
+2002-01-15 Jakub Jelinek <jakub@redhat.com>
+
+ * elflink.h (elf_link_input_bfd): Back out 2002-01-07 change.
+ * elf.c (merge_sections_remove_hook): New function.
+ (_bfd_elf_merge_sections): Pass it as 3rd argument to
+ _bfd_merge_sections.
+ * libbfd-in.h (_bfd_merge_sections): Add 3rd argument.
+ * libbfd.h: Rebuilt.
+ * merge.c (_bfd_merge_sections): Add remove_hook argument.
+ Call remove_hook if a SEC_EXCLUDE section is encountered.
+
+2002-01-15 Nick Clifton <nickc@cambridge.redhat.com>
+
+ * elf32-xstormy16.c (xstormy16_reloc_map): Add new field 'table'.
+ (xstormy16_reloc_map): Initialise new field with correct howto
+ table.
+ (xstormy16_reloc_type_lookup): Use 'table' field to locate correct
+ howto entry.
+
+2002-01-10 Michael Snyder <msnyder@redhat.com>
+
+ * elf.c (elfcore_write_prstatus): Use long instead of pid_t;
+ (elfcore_write_pstatus): Use long instead of pid_t;
+ * elf-bfd.h: Change prototypes to use long instead of pid_t;
+
+2002-01-09 Jason Thorpe <thorpej@wasabisystems.com>
+
+ * elf.c: Update copyright years.
+ (elfcore_grok_netbsd_note): Use NT_NETBSDCORE_PROCINFO
+ and NT_NETBSDCORE_FIRSTMACH. Improve a comment.
+
+2002-01-08 Michael Snyder <msnyder@redhat.com>
+
+ Add capability to write corefile note sections, for gdb.
+ * elf.c (elfcore_write_note): New function.
+ (elfcore_write_prpsinfo): New function.
+ (elfcore_write_prstatus): New function.
+ (elfcore_write_pstatus): New function.
+ (elfcore_write_prfpreg): New function.
+ (elfcore_write_prxfpreg): New function.
+ * elf-bfd.h: Add prototypes for above functions.
+
+2002-01-08 Alexandre Oliva <aoliva@redhat.com>
+
+ * elf.c (elf_fake_sections): Propagate errors from
+ elf_backend_fake_section.
+
+2002-01-07 Jason Thorpe <thorpej@wasabisystems.com>
+
+ * Makefile.am (BFD32_BACKENDS): Add elf32-sh-nbsd.lo.
+ (BFD32_BACKENDS_CFILES): Add elf32-sh-nbsd.c.
+ (elf32-sh-nbsd.lo): New rule.
+ * Makefile.in: Regenerate.
+ * config.bfd (sh*le-*-netbsdelf*): New target.
+ (sh*-*-netbsdelf*): New target.
+ * configure.in: Include netbsd-core.lo for native sh*-*-netbsd*.
+ (bfd_elf32_shnbsd_vec): New vector.
+ (bfd_elf32_shlnbsd_vec): New vector.
+ * configure: Regenerate.
+ * elf32-sh-nbsd.c: New file.
+ * targets.c: Update copyright years.
+ (_bfd_target_vector): Add bfd_elf32_shlnbsd_vec and
+ bfd_elf32_shnbsd_vec.
+
+2002-01-07 Aldy Hernandez <aldyh@redhat.com>
+
+ * coff-rs6000.c (READ20): Use bfd_scan_vma.
+
+2002-01-07 Geoffrey Keating <geoffk@redhat.com>
+
+ * elflink.h (elf_link_input_bfd): Don't ask for the merged offset
+ of a symbol in a section that will be deleted.
+
+2002-01-07 Nick Clifton <nickc@cambridge.redhat.com>
+
+ * po/es.po: New file: Spanish translation.
+ * configure.in (ALL_LINGUAS): Add es.
+ * configure: Regenerate.
+
+2002-01-06 Steve Ellcey <sje@cup.hp.com>
+
+ * elfxx-ia64.c (is_unwind_section_name): Add target vector as
+ argument so we can handle HP-UX specially.
+ (elfNN_ia64_hpux_vec): New for use in is_unwind_section_name.
+ (elfNN_hpux_backend_section_from_bfd_section): New for support
+ of SHN_IA_64_ANSI_COMMON.
+ (elfNN_ia64_relax_section): Add support for SHN_IA_64_ANSI_COMMON.
+ (is_unwind_section_name): Add special HP-UX support.
+ (elfNN_ia64_section_from_shdr): Add support for more sections.
+ (elfNN_ia64_fake_sections): Modify is_unwind_section_name call and
+ add support for more sections.
+ (elfNN_ia64_additional_program_headers): Modify
+ is_unwind_section_name call.
+ (elfNN_ia64_modify_segment_map): Remove assumption that there is
+ only one unwind section in segment.
+
+2002-01-06 Alan Modra <amodra@bigpond.net.au>
+
+ * syms.c (_bfd_generic_make_empty_symbol): New function.
+ * libbfd-in.h (_bfd_nosymbols_make_empty_symbol): Define as
+ _bfd_generic_make_empty_symbol.
+ * libbfd.h: Regenerate.
+ * bfd-in2.h: Regenerate.
+ * hppabsd-core.c (hppabsd_core_make_empty_symbol): Delete function.
+ (hppabsd_core_get_symtab_upper_bound): Don't define.
+ (hppabsd_core_get_symtab): Likewise.
+ (hppabsd_core_print_symbol): Likewise.
+ (hppabsd_core_get_symbol_info): Likewise.
+ (hppabsd_core_bfd_is_local_label_name): Likewise.
+ (hppabsd_core_get_lineno): Likewise.
+ (hppabsd_core_find_nearest_line): Likewise.
+ (hppabsd_core_bfd_make_debug_symbol): Likewise.
+ (hppabsd_core_read_minisymbols): Likewise.
+ (hppabsd_core_minisymbol_to_symbol): Likewise.
+ (hppabsd_core_vec): Use BFD_JUMP_TABLE_SYMBOLS (_bfd_nosymbols).
+ Formatting fixes.
+ * hpux-core.c: Similarly.
+ * irix-core.c: Similarly.
+ * osf-core.c: Similarly.
+ * sco5-core.c: Similarly.
+ * binary.c (binary_make_empty_symbol): Remove function, define as
+ _bfd_generic_make_empty_symbol.
+ * ihex.c (ihex_make_empty_symbol): Likewise.
+ * mmo.c (mmo_make_empty_symbol): Likewise.
+ * ppcboot.c (ppcboot_make_empty_symbol): Likewise.
+ * srec.c (srec_make_empty_symbol): Likewise.
+ * versados.c (versados_make_empty_symbol): Likewise.
+ * vms.c (_bfd_vms_make_empty_symbol): Remove.
+ (vms_make_empty_symbol): Define as _bfd_generic_make_empty_symbol.
+ * vms-gsd.c (_bfd_vms_slurp_gsd): Call bfd_make_empty_symbol
+ rather than _bfd_vms_make_empty_symbol.
+ * vms-misc.c (new_symbol): Likewise.
+
+2002-01-05 Alan Modra <amodra@bigpond.net.au>
+
+ * section.c (bfd_section_init): Remove unnecessary initialisations.
+ (bfd_section_list_clear): New function.
+ (bfd_section_list_remove, bfd_section_list_insert): New macros.
+ (_bfd_strip_section_from_output): Use them.
+ * coffcode.h (coff_set_alignment_hook): Likewise.
+ * elf32-mips.c (_bfd_mips_elf_final_link): Likewise.
+ * elf64-mips.c (mips_elf64_final_link): Likewise.
+ * elf64-mmix.c (mmix_elf_final_link): Likewise.
+ * sunos.c (sunos_add_dynamic_symbols): Likewise.
+ * xcofflink.c (_bfd_xcoff_bfd_final_link): Likewise.
+ * bfd-in2.h: Regenerate.
+
+ * netbsd-core.c (netbsd_core_file_p): Use bfd_make_section_anyway
+ rather than doing our own section handling. Clean up after errors
+ with bfd_release and bfd_section_list_clear. Handle unexpected
+ flags.
+ * aoutf1.h (sunos4_core_file_p): Likewise.
+ * aix386-core.c (aix386_core_file_p): Likewise.
+ * cisco-core.c (cisco_core_file_validate): Likewise.
+ * ptrace-core.c (ptrace_unix_core_file_p): Likewise.
+ * trad-core.c (trad_unix_core_file_p): Likewise.
+
+ * hppabsd-core.c (hppabsd_core_core_file_p): Clean up after errors
+ with bfd_release and bfd_section_list_clear.
+ * hpux-core.c (hpux_core_core_file_p): Likewise.
+ * irix-core.c (irix_core_core_file_p): Likewise.
+ * lynx-core.c (lynx_core_file_p): Likewise.
+ * osf-core.c (osf_core_core_file_p): Likewise.
+ * rs6000-core.c (rs6000coff_core_p): Likewise.
+ * sco5-core.c (sco5_core_file_p): Likewise.
+
+ * elf32-mips.c (_bfd_mips_elf_lo16_reloc): Simplify, and perform
+ sign extension adjustments without conditionals.
+
+2002-01-04 Jakub Jelinek <jakub@redhat.com>
+
+ * elf-eh-frame.c (_bfd_elf_write_section_eh_frame): Don't crash if
+ CIE at .eh_frame start is removed due to no FDEs referencing it.
+
+2002-01-04 Jason Thorpe <thorpej@wasabisystems.com>
+
+ * config.bfd (x86_64-*-netbsd*): New target.
+ * configure.in (x86_64-*-netbsd*): Set COREFILE
+ to netbsd-core.lo.
+ * configure: Regenerated.
+
+2002-01-03 Tom Rix <trix@redhat.com>
+
+ * xcofflink.c (_bfd_xcoff_bfd_final_link): Update .pad section ordering
+ for recent bfd_make_section_anyway change.
+
+2002-01-03 Nick Clifton <nickc@cambridge.redhat.com>
+
+ * elf32-arm.h (elf32_arm_final_link_relocate): Handle
+ R_ARM_THM_PC11 reloc.
+
+2002-01-02 Nick Clifton <nickc@cambridge.redhat.com>
+
+ * configure.in (LINGUAS): Add ja.
+ * configure: Regenerate.
+ * po/ja.po: Import from translation project's web site.
+
+2002-01-02 Nick Clifton <nickc@cambridge.redhat.com>
+
+ * elf32-arm.h (elf32_arm_merge_private_bfd_data): Reformat error
+ messages to ease translation into other languages.
+
+For older changes see ChangeLog-0001
+
+Local Variables:
+mode: change-log
+left-margin: 8
+fill-column: 74
+version-control: never
+End:
diff --git a/contrib/binutils/bfd/Makefile.am b/contrib/binutils/bfd/Makefile.am
index 1213897..de811af 100644
--- a/contrib/binutils/bfd/Makefile.am
+++ b/contrib/binutils/bfd/Makefile.am
@@ -28,20 +28,22 @@ BFD_H = bfd.h
# need two copies of the executable, one to download and one for the
# debugger).
BFD32_LIBS = \
- archive.lo archures.lo bfd.lo cache.lo coffgen.lo corefile.lo \
+ 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
+ merge.lo dwarf2.lo simple.lo
BFD64_LIBS = archive64.lo
BFD32_LIBS_CFILES = \
- archive.c archures.c bfd.c cache.c coffgen.c corefile.c \
+ archive.c archures.c bfd.c bfdio.c bfdwin.c \
+ cache.c coffgen.c corefile.c \
format.c init.c libbfd.c opncls.c reloc.c \
section.c syms.c targets.c hash.c linker.c \
srec.c binary.c tekhex.c ihex.c stabs.c stab-syms.c \
- merge.c dwarf2.c
+ merge.c dwarf2.c simple.c
BFD64_LIBS_CFILES = archive64.c
@@ -67,6 +69,8 @@ ALL_MACHINES = \
cpu-i386.lo \
cpu-i860.lo \
cpu-i960.lo \
+ cpu-ip2k.lo \
+ cpu-iq2000.lo \
cpu-m32r.lo \
cpu-m68hc11.lo \
cpu-m68hc12.lo \
@@ -77,6 +81,7 @@ ALL_MACHINES = \
cpu-mcore.lo \
cpu-mips.lo \
cpu-mmix.lo \
+ cpu-msp430.lo \
cpu-or32.lo \
cpu-ns32k.lo \
cpu-openrisc.lo \
@@ -88,6 +93,7 @@ ALL_MACHINES = \
cpu-sh.lo \
cpu-sparc.lo \
cpu-tic30.lo \
+ cpu-tic4x.lo \
cpu-tic54x.lo \
cpu-tic80.lo \
cpu-v850.lo \
@@ -95,6 +101,7 @@ ALL_MACHINES = \
cpu-we32k.lo \
cpu-w65.lo \
cpu-xstormy16.lo \
+ cpu-xtensa.lo \
cpu-z8k.lo
ALL_MACHINES_CFILES = \
@@ -117,6 +124,8 @@ ALL_MACHINES_CFILES = \
cpu-i386.c \
cpu-i860.c \
cpu-i960.c \
+ cpu-ip2k.c \
+ cpu-iq2000.c \
cpu-m32r.c \
cpu-m68hc11.c \
cpu-m68hc12.c \
@@ -127,6 +136,7 @@ ALL_MACHINES_CFILES = \
cpu-mcore.c \
cpu-mips.c \
cpu-mmix.c \
+ cpu-msp430.c \
cpu-or32.c \
cpu-ns32k.c \
cpu-openrisc.c \
@@ -138,6 +148,7 @@ ALL_MACHINES_CFILES = \
cpu-sh.c \
cpu-sparc.c \
cpu-tic30.c \
+ cpu-tic4x.c \
cpu-tic54x.c \
cpu-tic80.c \
cpu-v850.c \
@@ -145,6 +156,7 @@ ALL_MACHINES_CFILES = \
cpu-we32k.c \
cpu-w65.c \
cpu-xstormy16.c \
+ cpu-xtensa.c \
cpu-z8k.c
# The .o files needed by all of the 32 bit vectors that are configured into
@@ -183,6 +195,7 @@ BFD32_BACKENDS = \
coff-stgo32.lo \
coff-svm68k.lo \
coff-tic30.lo \
+ coff-tic4x.lo \
coff-tic54x.lo \
coff-tic80.lo \
coff-u68k.lo \
@@ -195,6 +208,7 @@ BFD32_BACKENDS = \
ecofflink.lo \
efi-app-ia32.lo \
elf.lo \
+ elf32-am33lin.lo \
elf32-arc.lo \
elfarm-oabi.lo \
elfarm-nabi.lo \
@@ -210,13 +224,15 @@ BFD32_BACKENDS = \
elf32-hppa.lo \
elf32-i370.lo \
elf32-i386.lo \
- elf32-i386-fbsd.lo \
elf32-i860.lo \
elf32-i960.lo \
elf32-ia64.lo \
+ elf32-ip2k.lo \
+ elf32-iq2000.lo \
elf32-m32r.lo \
elf32-m68hc11.lo \
elf32-m68hc12.lo \
+ elf32-m68hc1x.lo \
elf32-m68k.lo \
elf32-m88k.lo \
elf-m10200.lo \
@@ -224,21 +240,20 @@ BFD32_BACKENDS = \
elf32-mcore.lo \
elfxx-mips.lo \
elf32-mips.lo \
+ elf32-msp430.lo \
elf32-openrisc.lo \
elf32-or32.lo \
elf32-pj.lo \
elf32-ppc.lo \
elf32-s390.lo \
elf32-sh.lo \
- elf32-sh-lin.lo \
elf32-sh64.lo \
elf32-sh64-com.lo \
- elf32-sh-nbsd.lo \
- elf32-sh64-nbsd.lo \
elf32-sparc.lo \
elf32-v850.lo \
elf32-vax.lo \
elf32-xstormy16.lo \
+ elf32-xtensa.lo \
elf32.lo \
elflink.lo \
elf-strtab.lo \
@@ -264,6 +279,7 @@ BFD32_BACKENDS = \
m68klynx.lo \
m68knetbsd.lo \
m88kmach3.lo \
+ mach-o.lo \
mipsbsd.lo \
newsos3.lo \
nlm.lo \
@@ -275,6 +291,7 @@ BFD32_BACKENDS = \
oasys.lo \
pc532-mach.lo \
pdp11.lo \
+ pef.lo \
pe-arm.lo \
pei-arm.lo \
pe-i386.lo \
@@ -304,7 +321,10 @@ BFD32_BACKENDS = \
vms-hdr.lo \
vms-misc.lo \
vms-tir.lo \
- xcofflink.lo
+ xcofflink.lo \
+ xsym.lo \
+ xtensa-isa.lo \
+ xtensa-modules.lo
BFD32_BACKENDS_CFILES = \
aout-adobe.c \
@@ -340,6 +360,7 @@ BFD32_BACKENDS_CFILES = \
coff-stgo32.c \
coff-svm68k.c \
coff-tic30.c \
+ coff-tic4x.c \
coff-tic54x.c \
coff-tic80.c \
coff-u68k.c \
@@ -352,6 +373,7 @@ BFD32_BACKENDS_CFILES = \
ecofflink.c \
efi-app-ia32.c \
elf.c \
+ elf32-am33lin.c \
elf32-arc.c \
elfarm-oabi.c \
elfarm-nabi.c \
@@ -367,19 +389,22 @@ BFD32_BACKENDS_CFILES = \
elf32-hppa.c \
elf32-i370.c \
elf32-i386.c \
- elf32-i386-fbsd.c \
elf32-i860.c \
elf32-i960.c \
+ elf32-ip2k.c \
+ elf32-iq2000.c \
elf32-m32r.c \
elf32-m68k.c \
elf32-m68hc11.c \
elf32-m68hc12.c \
+ elf32-m68hc1x.c \
elf32-m88k.c \
elf-m10200.c \
elf-m10300.c \
elf32-mcore.c \
elfxx-mips.c \
elf32-mips.c \
+ elf32-msp430.c \
elf32-openrisc.c \
elf32-or32.c \
elf32-pj.c \
@@ -388,13 +413,11 @@ BFD32_BACKENDS_CFILES = \
elf32-sh64-com.c \
elf32-s390.c \
elf32-sh.c \
- elf32-sh-lin.c \
- elf32-sh-nbsd.c \
- elf32-sh64-nbsd.c \
elf32-sparc.c \
elf32-v850.c \
elf32-vax.c \
elf32-xstormy16.c \
+ elf32-xtensa.c \
elf32.c \
elflink.c \
elf-strtab.c \
@@ -420,6 +443,7 @@ BFD32_BACKENDS_CFILES = \
m68klynx.c \
m68knetbsd.c \
m88kmach3.c \
+ mach-o.c \
mipsbsd.c \
newsos3.c \
nlm.c \
@@ -431,6 +455,7 @@ BFD32_BACKENDS_CFILES = \
oasys.c \
pc532-mach.c \
pdp11.c \
+ pef.c \
pe-arm.c \
pei-arm.c \
pe-i386.c \
@@ -459,7 +484,10 @@ BFD32_BACKENDS_CFILES = \
vms-hdr.c \
vms-misc.c \
vms-tir.c \
- xcofflink.c
+ xcofflink.c \
+ xsym.c \
+ xtensa-isa.c \
+ xtensa-modules.c
# The .o files needed by all of the 64 bit vectors that are configured into
# target_vector in targets.c if configured with --enable-targets=all
@@ -473,14 +501,13 @@ BFD64_BACKENDS = \
efi-app-ia64.lo \
elf64-x86-64.lo \
elf64-alpha.lo \
- elf64-alpha-fbsd.lo \
elf64-hppa.lo \
elf64-ia64.lo \
elf64-gen.lo \
+ elfn32-mips.lo \
elf64-mips.lo \
elf64-mmix.lo \
elf64-sh64.lo \
- elf64-sh64-nbsd.lo \
elf64-ppc.lo \
elf64-s390.lo \
elf64-sparc.lo \
@@ -499,15 +526,14 @@ BFD64_BACKENDS_CFILES = \
efi-app-ia64.c \
elf64-x86-64.c \
elf64-alpha.c \
- elf64-alpha-fbsd.c \
elf64-hppa.c \
elf64-gen.c \
+ elfn32-mips.c \
elf64-mips.c \
elf64-mmix.c \
elf64-ppc.c \
elf64-s390.c \
elf64-sh64.c \
- elf64-sh64-nbsd.c \
elf64-sparc.c \
elf64.c \
mmo.c \
@@ -561,16 +587,18 @@ CFILES = $(SOURCE_CFILES) $(BUILD_CFILES)
## This is a list of all .h files which are in the source tree.
SOURCE_HFILES = \
aout-target.h aoutf1.h aoutx.h coffcode.h coffswap.h ecoffswap.h \
- elf-bfd.h elf-hppa.h elf32-arm.h elf32-hppa.h elf64-hppa.h \
- elfcode.h elfcore.h elflink.h freebsd.h genlink.h go32stub.h \
- libaout.h libbfd.h libcoff.h libecoff.h libhppa.h \
- libieee.h libnlm.h liboasys.h libpei.h netbsd.h nlm-target.h \
- nlmcode.h nlmswap.h ns32k.h peicode.h som.h vms.h libxcoff.h \
- xcoff-target.h version.h
+ elf-bfd.h elf-hppa.h elf32-arm.h elf32-hppa.h \
+ elf64-hppa.h elfcode.h elfcore.h \
+ freebsd.h genlink.h go32stub.h \
+ libaout.h libbfd.h libcoff.h libecoff.h libhppa.h libieee.h \
+ libnlm.h liboasys.h libpei.h libxcoff.h mach-o.h \
+ netbsd.h nlm-target.h nlmcode.h nlmswap.h ns32k.h \
+ pef.h pef-traceback.h peicode.h som.h version.h \
+ vms.h xcoff-target.h xsym.h
## ... and all .h files which are in the build tree.
BUILD_HFILES = \
- elf32-target.h elf64-target.h targmatch.h
+ bfdver.h elf32-target.h elf64-target.h targmatch.h
HFILES = $(SOURCE_HFILES) $(BUILD_HFILES)
@@ -578,23 +606,15 @@ SRC_POTFILES = $(SOURCE_CFILES) $(SOURCE_HFILES)
BLD_POTFILES = $(BUILD_CFILES) $(BUILD_HFILES)
po/SRC-POTFILES.in: @MAINT@ Makefile $(SRC_POTFILES)
- for file in $(SRC_POTFILES); do echo $$file; done | sort > tmp.src \
+ for file in $(SRC_POTFILES); do echo $$file; done \
+ | LC_COLLATE= sort > tmp.src \
&& mv tmp.src $(srcdir)/po/SRC-POTFILES.in
po/BLD-POTFILES.in: @MAINT@ Makefile $(BLD_POTFILES)
- for file in $(BLD_POTFILES); do echo $$file; done | sort > tmp.bld \
+ for file in $(BLD_POTFILES); do echo $$file; done \
+ | LC_COLLATE= sort > tmp.bld \
&& mv tmp.bld $(srcdir)/po/BLD-POTFILES.in
-# The following target is retained for upgrade purposes.
-# This target used to exist in older versions of this makefile, and was
-# referenced by <builddir>/po/Makefile (which is created from <srcdir>/po/Make-in)
-# So old versions of <builddir>/po/Makefile will try to regenerate themselves
-# when make is next run, but that dependency cannot be completed without a build
-# of po/POTFILES.in. Hence the presence of this rule. This rule will be deleted
-# once it is no longer needed - probably in the fall of 2001.
-po/POTFILES.in:
-
-
diststuff: info
# Various kinds of .o files to put in libbfd.a:
@@ -653,10 +673,10 @@ targmatch.h: config.bfd targmatch.sed
# When compiling archures.c and targets.c, supply the default target
# info from configure.
-targets.lo: targets.c config.status
+targets.lo: targets.c Makefile
$(LIBTOOL) --mode=compile $(COMPILE) -c $(TDEFAULTS) $(srcdir)/targets.c
-archures.lo: archures.c config.status
+archures.lo: archures.c Makefile
$(LIBTOOL) --mode=compile $(COMPILE) -c $(TDEFAULTS) $(srcdir)/archures.c
elf32-target.h : elfxx-target.h
@@ -788,9 +808,11 @@ stmp-bfd-h: bfd-in3.h
touch stmp-bfd-h
BFD_H_FILES = bfd-in.h init.c opncls.c libbfd.c section.c archures.c \
- reloc.c syms.c bfd.c archive.c corefile.c targets.c format.c version.h
+ reloc.c syms.c bfd.c bfdio.c bfdwin.c \
+ archive.c corefile.c targets.c format.c
BFD64_H_FILES = archive64.c
-LIBBFD_H_FILES = libbfd-in.h init.c libbfd.c cache.c reloc.c archures.c elf.c
+LIBBFD_H_FILES = libbfd-in.h init.c libbfd.c bfdio.c bfdwin.c \
+ cache.c reloc.c archures.c elf.c
LIBCOFF_H_FILES = libcoff-in.h coffcode.h
# Could really use a "copy-if-change"...
@@ -834,8 +856,9 @@ CLEANFILES = bfd.h dep.sed stmp-bfd-h DEP DEPA DEP1 DEP2 libbfd.a stamp-lib \
DISTCLEANFILES = $(BUILD_CFILES) $(BUILD_HFILES)
-# We want to rerun configure if config.bfd or configure.host change.
-config.status: $(srcdir)/configure $(srcdir)/config.bfd $(srcdir)/configure.host
+# We want to rerun configure if config.bfd, configure.host or version.h change.
+config.status: $(srcdir)/configure $(srcdir)/config.bfd \
+ $(srcdir)/configure.host $(srcdir)/version.h
$(SHELL) ./config.status --recheck
# What appears below is generated by a hacked mkdep using gcc -MM.
@@ -845,11 +868,13 @@ config.status: $(srcdir)/configure $(srcdir)/config.bfd $(srcdir)/configure.host
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 $(INCDIR)/filenames.h $(INCDIR)/libiberty.h \
+bfd.lo: bfd.c bfdver.h $(INCDIR)/filenames.h $(INCDIR)/libiberty.h \
$(INCDIR)/safe-ctype.h $(INCDIR)/bfdlink.h $(INCDIR)/coff/internal.h \
$(INCDIR)/coff/sym.h libcoff.h libecoff.h $(INCDIR)/coff/ecoff.h \
elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
$(INCDIR)/elf/external.h
+bfdio.lo: bfdio.c $(INCDIR)/filenames.h
+bfdwin.lo: bfdwin.c $(INCDIR)/filenames.h
cache.lo: cache.c $(INCDIR)/filenames.h
coffgen.lo: coffgen.c $(INCDIR)/filenames.h $(INCDIR)/coff/internal.h \
libcoff.h $(INCDIR)/bfdlink.h
@@ -857,7 +882,8 @@ corefile.lo: corefile.c $(INCDIR)/filenames.h
format.lo: format.c $(INCDIR)/filenames.h
init.lo: init.c $(INCDIR)/filenames.h
libbfd.lo: libbfd.c $(INCDIR)/filenames.h
-opncls.lo: opncls.c $(INCDIR)/filenames.h $(INCDIR)/objalloc.h
+opncls.lo: opncls.c $(INCDIR)/filenames.h $(INCDIR)/objalloc.h \
+ $(INCDIR)/libiberty.h
reloc.lo: reloc.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h
section.lo: section.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h
syms.lo: syms.c $(INCDIR)/filenames.h $(INCDIR)/safe-ctype.h \
@@ -882,11 +908,12 @@ merge.lo: merge.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.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
+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
@@ -903,6 +930,8 @@ 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
@@ -913,6 +942,7 @@ 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
@@ -924,6 +954,7 @@ 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
@@ -931,6 +962,7 @@ 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 \
@@ -993,7 +1025,8 @@ coff-aux.lo: coff-aux.c $(INCDIR)/filenames.h $(INCDIR)/coff/aux-coff.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 coffcode.h coffswap.h
+ $(INCDIR)/coff/internal.h libcoff.h $(INCDIR)/libiberty.h \
+ coffcode.h coffswap.h
coff-h8500.lo: coff-h8500.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
$(INCDIR)/coff/h8500.h $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \
libcoff.h coffcode.h coffswap.h
@@ -1042,6 +1075,9 @@ coff-svm68k.lo: coff-svm68k.c coff-m68k.c $(INCDIR)/filenames.h \
coff-tic30.lo: coff-tic30.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
$(INCDIR)/coff/tic30.h $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \
libcoff.h coffcode.h coffswap.h
+coff-tic4x.lo: coff-tic4x.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
+ $(INCDIR)/coff/tic4x.h $(INCDIR)/coff/ti.h $(INCDIR)/coff/internal.h \
+ libcoff.h coffcode.h coffswap.h
coff-tic54x.lo: coff-tic54x.c $(INCDIR)/filenames.h \
$(INCDIR)/bfdlink.h $(INCDIR)/coff/tic54x.h $(INCDIR)/coff/ti.h \
$(INCDIR)/coff/internal.h libcoff.h coffcode.h coffswap.h
@@ -1061,7 +1097,7 @@ coff-z8k.lo: coff-z8k.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
$(INCDIR)/coff/z8k.h $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \
libcoff.h coffcode.h coffswap.h
cofflink.lo: cofflink.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
- $(INCDIR)/coff/internal.h libcoff.h
+ $(INCDIR)/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
@@ -1081,6 +1117,10 @@ efi-app-ia32.lo: efi-app-ia32.c $(INCDIR)/filenames.h \
elf.lo: elf.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
$(INCDIR)/elf/external.h $(INCDIR)/libiberty.h
+elf32-am33lin.lo: elf32-am33lin.c elf-m10300.c $(INCDIR)/filenames.h \
+ elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
+ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/mn10300.h \
+ $(INCDIR)/elf/reloc-macros.h elf32-target.h
elf32-arc.lo: elf32-arc.c $(INCDIR)/filenames.h elf-bfd.h \
$(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
$(INCDIR)/bfdlink.h $(INCDIR)/elf/arc.h $(INCDIR)/elf/reloc-macros.h \
@@ -1120,7 +1160,7 @@ elf32-fr30.lo: elf32-fr30.c $(INCDIR)/filenames.h elf-bfd.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 \
- elf32-target.h
+ $(INCDIR)/hashtab.h elf32-target.h
elf32-gen.lo: elf32-gen.c $(INCDIR)/filenames.h elf-bfd.h \
$(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
$(INCDIR)/bfdlink.h elf32-target.h
@@ -1134,15 +1174,12 @@ elf32-hppa.lo: elf32-hppa.c $(INCDIR)/filenames.h elf-bfd.h \
libhppa.h elf32-hppa.h elf-hppa.h elf32-target.h
elf32-i370.lo: elf32-i370.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
- $(INCDIR)/elf/external.h $(INCDIR)/elf/i370.h elf32-target.h
+ $(INCDIR)/elf/external.h $(INCDIR)/elf/i370.h $(INCDIR)/elf/reloc-macros.h \
+ elf32-target.h
elf32-i386.lo: elf32-i386.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
$(INCDIR)/elf/external.h $(INCDIR)/elf/i386.h $(INCDIR)/elf/reloc-macros.h \
elf32-target.h
-elf32-i386-fbsd.lo: elf32-i386-fbsd.c elf32-i386.c $(INCDIR)/filenames.h \
- $(INCDIR)/bfdlink.h elf-bfd.h $(INCDIR)/elf/common.h \
- $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/elf/i386.h \
- $(INCDIR)/elf/reloc-macros.h elf32-target.h
elf32-i860.lo: elf32-i860.c $(INCDIR)/filenames.h elf-bfd.h \
$(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
$(INCDIR)/bfdlink.h $(INCDIR)/elf/i860.h $(INCDIR)/elf/reloc-macros.h \
@@ -1151,6 +1188,14 @@ elf32-i960.lo: elf32-i960.c $(INCDIR)/filenames.h elf-bfd.h \
$(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
$(INCDIR)/bfdlink.h $(INCDIR)/elf/i960.h $(INCDIR)/elf/reloc-macros.h \
elf32-target.h
+elf32-ip2k.lo: elf32-ip2k.c $(INCDIR)/filenames.h elf-bfd.h \
+ $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
+ $(INCDIR)/bfdlink.h $(INCDIR)/elf/ip2k.h $(INCDIR)/elf/reloc-macros.h \
+ elf32-target.h
+elf32-iq2000.lo: elf32-iq2000.c $(INCDIR)/filenames.h \
+ elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
+ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/iq2000.h \
+ $(INCDIR)/elf/reloc-macros.h elf32-target.h
elf32-m32r.lo: elf32-m32r.c $(INCDIR)/filenames.h elf-bfd.h \
$(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
$(INCDIR)/bfdlink.h $(INCDIR)/elf/m32r.h $(INCDIR)/elf/reloc-macros.h \
@@ -1160,13 +1205,20 @@ elf32-m68k.lo: elf32-m68k.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
$(INCDIR)/elf/external.h $(INCDIR)/elf/m68k.h $(INCDIR)/elf/reloc-macros.h \
elf32-target.h
elf32-m68hc11.lo: elf32-m68hc11.c $(INCDIR)/filenames.h \
- elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
- $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/m68hc11.h \
- $(INCDIR)/elf/reloc-macros.h elf32-target.h
+ $(INCDIR)/bfdlink.h elf-bfd.h $(INCDIR)/elf/common.h \
+ $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h elf32-m68hc1x.h \
+ $(INCDIR)/elf/m68hc11.h $(INCDIR)/elf/reloc-macros.h \
+ $(INCDIR)/opcode/m68hc11.h elf32-target.h
elf32-m68hc12.lo: elf32-m68hc12.c $(INCDIR)/filenames.h \
- elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
- $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/m68hc11.h \
- $(INCDIR)/elf/reloc-macros.h elf32-target.h
+ $(INCDIR)/bfdlink.h elf-bfd.h $(INCDIR)/elf/common.h \
+ $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h elf32-m68hc1x.h \
+ $(INCDIR)/elf/m68hc11.h $(INCDIR)/elf/reloc-macros.h \
+ $(INCDIR)/opcode/m68hc11.h elf32-target.h
+elf32-m68hc1x.lo: elf32-m68hc1x.c $(INCDIR)/filenames.h \
+ $(INCDIR)/bfdlink.h elf-bfd.h $(INCDIR)/elf/common.h \
+ $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h elf32-m68hc1x.h \
+ $(INCDIR)/elf/m68hc11.h $(INCDIR)/elf/reloc-macros.h \
+ $(INCDIR)/opcode/m68hc11.h
elf32-m88k.lo: elf32-m88k.c $(INCDIR)/filenames.h elf-bfd.h \
$(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
$(INCDIR)/bfdlink.h elf32-target.h
@@ -1181,17 +1233,23 @@ elf32-mcore.lo: elf32-mcore.c $(INCDIR)/filenames.h \
$(INCDIR)/bfdlink.h elf-bfd.h $(INCDIR)/elf/common.h \
$(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/elf/mcore.h \
$(INCDIR)/elf/reloc-macros.h elf32-target.h
-elfxx-mips.lo: elfxx-mips.c $(INCDIR)/filenames.h 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
+elfxx-mips.lo: elfxx-mips.c $(INCDIR)/filenames.h $(INCDIR)/libiberty.h \
+ elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
+ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h elfxx-mips.h \
+ $(INCDIR)/elf/mips.h $(INCDIR)/elf/reloc-macros.h $(INCDIR)/coff/sym.h \
+ $(INCDIR)/coff/symconst.h $(INCDIR)/coff/ecoff.h $(INCDIR)/coff/mips.h \
+ $(INCDIR)/coff/external.h $(INCDIR)/hashtab.h
elf32-mips.lo: elf32-mips.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
genlink.h elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
$(INCDIR)/elf/external.h elfxx-mips.h $(INCDIR)/elf/mips.h \
$(INCDIR)/elf/reloc-macros.h $(INCDIR)/coff/sym.h $(INCDIR)/coff/symconst.h \
$(INCDIR)/coff/internal.h $(INCDIR)/coff/ecoff.h $(INCDIR)/coff/mips.h \
$(INCDIR)/coff/external.h ecoffswap.h elf32-target.h
+elf32-msp430.lo: elf32-msp430.c $(INCDIR)/filenames.h \
+ $(INCDIR)/libiberty.h elf-bfd.h $(INCDIR)/elf/common.h \
+ $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h \
+ $(INCDIR)/elf/msp430.h $(INCDIR)/elf/reloc-macros.h \
+ elf32-target.h
elf32-openrisc.lo: elf32-openrisc.c $(INCDIR)/filenames.h \
elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
$(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/openrisc.h \
@@ -1208,16 +1266,16 @@ elf32-pj.lo: elf32-pj.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.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-target.h
+ elf32-ppc.h elf32-target.h
elf32-sh64.lo: elf32-sh64.c $(INCDIR)/filenames.h elf-bfd.h \
$(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
$(INCDIR)/bfdlink.h $(srcdir)/../opcodes/sh64-opc.h \
- elf32-sh.c $(INCDIR)/elf/sh.h $(INCDIR)/elf/reloc-macros.h \
+ elf32-sh64.h elf32-sh.c $(INCDIR)/elf/sh.h $(INCDIR)/elf/reloc-macros.h \
elf32-target.h
elf32-sh64-com.lo: elf32-sh64-com.c $(INCDIR)/filenames.h \
elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
$(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/sh.h \
- $(INCDIR)/elf/reloc-macros.h $(srcdir)/../opcodes/sh64-opc.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 \
@@ -1226,19 +1284,6 @@ elf32-sh.lo: elf32-sh.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
$(INCDIR)/elf/external.h $(INCDIR)/elf/sh.h $(INCDIR)/elf/reloc-macros.h \
elf32-target.h
-elf32-sh-lin.lo: elf32-sh-lin.c $(INCDIR)/filenames.h \
- $(INCDIR)/elf/internal.h elf-bfd.h $(INCDIR)/elf/common.h \
- $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h elf32-sh.c \
- $(INCDIR)/elf/sh.h $(INCDIR)/elf/reloc-macros.h elf32-target.h
-elf32-sh-nbsd.lo: elf32-sh-nbsd.c elf32-sh.c $(INCDIR)/filenames.h \
- $(INCDIR)/bfdlink.h elf-bfd.h $(INCDIR)/elf/common.h \
- $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/elf/sh.h \
- $(INCDIR)/elf/reloc-macros.h elf32-target.h
-elf32-sh64-nbsd.lo: elf32-sh64-nbsd.c 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-sh.c $(INCDIR)/elf/sh.h \
- $(INCDIR)/elf/reloc-macros.h elf32-target.h
elf32-sparc.lo: elf32-sparc.c $(INCDIR)/filenames.h \
$(INCDIR)/bfdlink.h elf-bfd.h $(INCDIR)/elf/common.h \
$(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/elf/sparc.h \
@@ -1257,13 +1302,18 @@ elf32-xstormy16.lo: elf32-xstormy16.c $(INCDIR)/filenames.h \
$(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/xstormy16.h \
$(INCDIR)/elf/reloc-macros.h $(INCDIR)/libiberty.h \
elf32-target.h
+elf32-xtensa.lo: elf32-xtensa.c $(INCDIR)/filenames.h \
+ $(INCDIR)/bfdlink.h elf-bfd.h $(INCDIR)/elf/common.h \
+ $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/elf/xtensa.h \
+ $(INCDIR)/elf/reloc-macros.h $(INCDIR)/xtensa-isa.h \
+ $(INCDIR)/xtensa-config.h elf32-target.h
elf32.lo: elf32.c elfcode.h $(INCDIR)/filenames.h $(INCDIR)/libiberty.h \
$(INCDIR)/bfdlink.h elf-bfd.h $(INCDIR)/elf/common.h \
$(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h elfcore.h \
- elflink.h
+ $(INCDIR)/safe-ctype.h
elflink.lo: elflink.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
- $(INCDIR)/elf/external.h
+ $(INCDIR)/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
@@ -1333,6 +1383,8 @@ m68knetbsd.lo: m68knetbsd.c netbsd.h $(INCDIR)/filenames.h \
m88kmach3.lo: m88kmach3.c $(INCDIR)/filenames.h libaout.h \
$(INCDIR)/bfdlink.h aout-target.h $(INCDIR)/aout/aout64.h \
$(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h
+mach-o.lo: mach-o.c mach-o.h $(INCDIR)/filenames.h \
+ $(INCDIR)/libiberty.h mach-o-target.c
mipsbsd.lo: mipsbsd.c $(INCDIR)/filenames.h libaout.h \
$(INCDIR)/bfdlink.h aout-target.h $(INCDIR)/aout/aout64.h \
$(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h
@@ -1364,6 +1416,8 @@ pc532-mach.lo: pc532-mach.c $(INCDIR)/filenames.h libaout.h \
pdp11.lo: pdp11.c $(INCDIR)/filenames.h libaout.h $(INCDIR)/bfdlink.h \
aout-target.h $(INCDIR)/aout/aout64.h $(INCDIR)/aout/stab_gnu.h \
$(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h $(INCDIR)/safe-ctype.h
+pef.lo: pef.c $(INCDIR)/safe-ctype.h pef.h pef-traceback.h \
+ $(INCDIR)/filenames.h $(INCDIR)/libiberty.h
pe-arm.lo: pe-arm.c $(INCDIR)/filenames.h coff-arm.c \
$(INCDIR)/coff/arm.h $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \
$(INCDIR)/coff/pe.h libcoff.h $(INCDIR)/bfdlink.h coffcode.h \
@@ -1447,8 +1501,8 @@ vms.lo: vms.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
vms.h
vms-gsd.lo: vms-gsd.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
vms.h
-vms-hdr.lo: vms-hdr.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
- $(INCDIR)/safe-ctype.h vms.h
+vms-hdr.lo: vms-hdr.c bfdver.h $(INCDIR)/filenames.h \
+ $(INCDIR)/bfdlink.h $(INCDIR)/safe-ctype.h vms.h
vms-misc.lo: vms-misc.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
vms.h
vms-tir.lo: vms-tir.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
@@ -1456,6 +1510,11 @@ vms-tir.lo: vms-tir.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
xcofflink.lo: xcofflink.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
$(INCDIR)/coff/internal.h $(INCDIR)/coff/xcoff.h libcoff.h \
libxcoff.h
+xsym.lo: xsym.c xsym.h $(INCDIR)/filenames.h
+xtensa-isa.lo: xtensa-isa.c $(INCDIR)/xtensa-isa.h \
+ $(INCDIR)/xtensa-isa-internal.h
+xtensa-modules.lo: xtensa-modules.c $(INCDIR)/xtensa-isa.h \
+ $(INCDIR)/xtensa-isa-internal.h
aix5ppc-core.lo: aix5ppc-core.c
aout64.lo: aout64.c aoutx.h $(INCDIR)/filenames.h $(INCDIR)/safe-ctype.h \
$(INCDIR)/bfdlink.h libaout.h $(INCDIR)/aout/aout64.h \
@@ -1487,13 +1546,6 @@ elf64-alpha.lo: elf64-alpha.c $(INCDIR)/filenames.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-alpha-fbsd.lo: elf64-alpha-fbsd.c elf64-alpha.c $(INCDIR)/filenames.h \
- elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
- $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/alpha.h \
- $(INCDIR)/elf/reloc-macros.h $(INCDIR)/coff/internal.h \
- $(INCDIR)/coff/sym.h $(INCDIR)/coff/symconst.h $(INCDIR)/coff/ecoff.h \
- $(INCDIR)/coff/alpha.h $(INCDIR)/aout/ar.h libcoff.h \
- libecoff.h ecoffswap.h elf64-target.h
elf64-hppa.lo: elf64-hppa.c $(INCDIR)/alloca-conf.h \
$(INCDIR)/filenames.h elf-bfd.h $(INCDIR)/elf/common.h \
$(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h \
@@ -1502,6 +1554,13 @@ elf64-hppa.lo: elf64-hppa.c $(INCDIR)/alloca-conf.h \
elf64-gen.lo: elf64-gen.c $(INCDIR)/filenames.h elf-bfd.h \
$(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
$(INCDIR)/bfdlink.h elf64-target.h
+elfn32-mips.lo: elfn32-mips.c $(INCDIR)/filenames.h \
+ $(INCDIR)/bfdlink.h genlink.h elf-bfd.h $(INCDIR)/elf/common.h \
+ $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h elfxx-mips.h \
+ $(INCDIR)/elf/mips.h $(INCDIR)/elf/reloc-macros.h $(INCDIR)/coff/sym.h \
+ $(INCDIR)/coff/symconst.h $(INCDIR)/coff/internal.h \
+ $(INCDIR)/coff/ecoff.h $(INCDIR)/coff/mips.h $(INCDIR)/coff/external.h \
+ ecoffswap.h elf32-target.h
elf64-mips.lo: elf64-mips.c $(INCDIR)/filenames.h $(INCDIR)/aout/ar.h \
$(INCDIR)/bfdlink.h genlink.h elf-bfd.h $(INCDIR)/elf/common.h \
$(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h elfxx-mips.h \
@@ -1515,7 +1574,7 @@ elf64-mmix.lo: elf64-mmix.c $(INCDIR)/filenames.h elf-bfd.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/ppc.h $(INCDIR)/elf/reloc-macros.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 \
@@ -1525,10 +1584,6 @@ elf64-sh64.lo: elf64-sh64.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
$(INCDIR)/elf/external.h $(INCDIR)/elf/sh.h $(INCDIR)/elf/reloc-macros.h \
elf64-target.h
-elf64-sh64-nbsd.lo: elf64-sh64-nbsd.c elf64-sh64.c \
- $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h elf-bfd.h \
- $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
- $(INCDIR)/elf/sh.h $(INCDIR)/elf/reloc-macros.h elf64-target.h
elf64-sparc.lo: elf64-sparc.c $(INCDIR)/filenames.h \
elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
$(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/opcode/sparc.h \
@@ -1537,7 +1592,7 @@ elf64-sparc.lo: elf64-sparc.c $(INCDIR)/filenames.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 \
- elflink.h
+ $(INCDIR)/safe-ctype.h
mmo.lo: mmo.c $(INCDIR)/filenames.h $(INCDIR)/libiberty.h \
$(INCDIR)/elf/mmix.h $(INCDIR)/elf/reloc-macros.h $(INCDIR)/opcode/mmix.h
nlm32-alpha.lo: nlm32-alpha.c $(INCDIR)/filenames.h \
@@ -1561,11 +1616,13 @@ 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 elf32-target.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 elf64-target.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
diff --git a/contrib/binutils/bfd/Makefile.in b/contrib/binutils/bfd/Makefile.in
index dd4ff4f..a6685f2 100644
--- a/contrib/binutils/bfd/Makefile.in
+++ b/contrib/binutils/bfd/Makefile.in
@@ -1,6 +1,6 @@
-# Makefile.in generated automatically by automake 1.4 from Makefile.am
+# Makefile.in generated automatically by automake 1.4-p6 from Makefile.am
-# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
+# Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
@@ -68,6 +68,7 @@ AS = @AS@
BFD_HOST_64BIT_LONG = @BFD_HOST_64BIT_LONG@
BFD_HOST_64_BIT = @BFD_HOST_64_BIT@
BFD_HOST_64_BIT_DEFINED = @BFD_HOST_64_BIT_DEFINED@
+BFD_HOST_LONG_LONG = @BFD_HOST_LONG_LONG@
BFD_HOST_U_64_BIT = @BFD_HOST_U_64_BIT@
CATALOGS = @CATALOGS@
CATOBJEXT = @CATOBJEXT@
@@ -115,10 +116,11 @@ WIN32LIBADD = @WIN32LIBADD@
all_backends = @all_backends@
bfd_backends = @bfd_backends@
bfd_default_target_size = @bfd_default_target_size@
+bfd_file_ptr = @bfd_file_ptr@
bfd_libs = @bfd_libs@
bfd_machines = @bfd_machines@
+bfd_ufile_ptr = @bfd_ufile_ptr@
bfd_version = @bfd_version@
-bfd_version_date = @bfd_version_date@
bfd_version_string = @bfd_version_string@
l = @l@
tdefaults = @tdefaults@
@@ -152,21 +154,23 @@ BFD_H = bfd.h
# need two copies of the executable, one to download and one for the
# debugger).
BFD32_LIBS = \
- archive.lo archures.lo bfd.lo cache.lo coffgen.lo corefile.lo \
+ 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
+ merge.lo dwarf2.lo simple.lo
BFD64_LIBS = archive64.lo
BFD32_LIBS_CFILES = \
- archive.c archures.c bfd.c cache.c coffgen.c corefile.c \
+ archive.c archures.c bfd.c bfdio.c bfdwin.c \
+ cache.c coffgen.c corefile.c \
format.c init.c libbfd.c opncls.c reloc.c \
section.c syms.c targets.c hash.c linker.c \
srec.c binary.c tekhex.c ihex.c stabs.c stab-syms.c \
- merge.c dwarf2.c
+ merge.c dwarf2.c simple.c
BFD64_LIBS_CFILES = archive64.c
@@ -193,6 +197,8 @@ ALL_MACHINES = \
cpu-i386.lo \
cpu-i860.lo \
cpu-i960.lo \
+ cpu-ip2k.lo \
+ cpu-iq2000.lo \
cpu-m32r.lo \
cpu-m68hc11.lo \
cpu-m68hc12.lo \
@@ -203,6 +209,7 @@ ALL_MACHINES = \
cpu-mcore.lo \
cpu-mips.lo \
cpu-mmix.lo \
+ cpu-msp430.lo \
cpu-or32.lo \
cpu-ns32k.lo \
cpu-openrisc.lo \
@@ -214,6 +221,7 @@ ALL_MACHINES = \
cpu-sh.lo \
cpu-sparc.lo \
cpu-tic30.lo \
+ cpu-tic4x.lo \
cpu-tic54x.lo \
cpu-tic80.lo \
cpu-v850.lo \
@@ -221,6 +229,7 @@ ALL_MACHINES = \
cpu-we32k.lo \
cpu-w65.lo \
cpu-xstormy16.lo \
+ cpu-xtensa.lo \
cpu-z8k.lo
@@ -244,6 +253,8 @@ ALL_MACHINES_CFILES = \
cpu-i386.c \
cpu-i860.c \
cpu-i960.c \
+ cpu-ip2k.c \
+ cpu-iq2000.c \
cpu-m32r.c \
cpu-m68hc11.c \
cpu-m68hc12.c \
@@ -254,6 +265,7 @@ ALL_MACHINES_CFILES = \
cpu-mcore.c \
cpu-mips.c \
cpu-mmix.c \
+ cpu-msp430.c \
cpu-or32.c \
cpu-ns32k.c \
cpu-openrisc.c \
@@ -265,6 +277,7 @@ ALL_MACHINES_CFILES = \
cpu-sh.c \
cpu-sparc.c \
cpu-tic30.c \
+ cpu-tic4x.c \
cpu-tic54x.c \
cpu-tic80.c \
cpu-v850.c \
@@ -272,6 +285,7 @@ ALL_MACHINES_CFILES = \
cpu-we32k.c \
cpu-w65.c \
cpu-xstormy16.c \
+ cpu-xtensa.c \
cpu-z8k.c
@@ -311,6 +325,7 @@ BFD32_BACKENDS = \
coff-stgo32.lo \
coff-svm68k.lo \
coff-tic30.lo \
+ coff-tic4x.lo \
coff-tic54x.lo \
coff-tic80.lo \
coff-u68k.lo \
@@ -323,6 +338,7 @@ BFD32_BACKENDS = \
ecofflink.lo \
efi-app-ia32.lo \
elf.lo \
+ elf32-am33lin.lo \
elf32-arc.lo \
elfarm-oabi.lo \
elfarm-nabi.lo \
@@ -338,13 +354,15 @@ BFD32_BACKENDS = \
elf32-hppa.lo \
elf32-i370.lo \
elf32-i386.lo \
- elf32-i386-fbsd.lo \
elf32-i860.lo \
elf32-i960.lo \
elf32-ia64.lo \
+ elf32-ip2k.lo \
+ elf32-iq2000.lo \
elf32-m32r.lo \
elf32-m68hc11.lo \
elf32-m68hc12.lo \
+ elf32-m68hc1x.lo \
elf32-m68k.lo \
elf32-m88k.lo \
elf-m10200.lo \
@@ -352,21 +370,20 @@ BFD32_BACKENDS = \
elf32-mcore.lo \
elfxx-mips.lo \
elf32-mips.lo \
+ elf32-msp430.lo \
elf32-openrisc.lo \
elf32-or32.lo \
elf32-pj.lo \
elf32-ppc.lo \
elf32-s390.lo \
elf32-sh.lo \
- elf32-sh-lin.lo \
elf32-sh64.lo \
elf32-sh64-com.lo \
- elf32-sh-nbsd.lo \
- elf32-sh64-nbsd.lo \
elf32-sparc.lo \
elf32-v850.lo \
elf32-vax.lo \
elf32-xstormy16.lo \
+ elf32-xtensa.lo \
elf32.lo \
elflink.lo \
elf-strtab.lo \
@@ -392,6 +409,7 @@ BFD32_BACKENDS = \
m68klynx.lo \
m68knetbsd.lo \
m88kmach3.lo \
+ mach-o.lo \
mipsbsd.lo \
newsos3.lo \
nlm.lo \
@@ -403,6 +421,7 @@ BFD32_BACKENDS = \
oasys.lo \
pc532-mach.lo \
pdp11.lo \
+ pef.lo \
pe-arm.lo \
pei-arm.lo \
pe-i386.lo \
@@ -432,7 +451,10 @@ BFD32_BACKENDS = \
vms-hdr.lo \
vms-misc.lo \
vms-tir.lo \
- xcofflink.lo
+ xcofflink.lo \
+ xsym.lo \
+ xtensa-isa.lo \
+ xtensa-modules.lo
BFD32_BACKENDS_CFILES = \
@@ -469,6 +491,7 @@ BFD32_BACKENDS_CFILES = \
coff-stgo32.c \
coff-svm68k.c \
coff-tic30.c \
+ coff-tic4x.c \
coff-tic54x.c \
coff-tic80.c \
coff-u68k.c \
@@ -481,6 +504,7 @@ BFD32_BACKENDS_CFILES = \
ecofflink.c \
efi-app-ia32.c \
elf.c \
+ elf32-am33lin.c \
elf32-arc.c \
elfarm-oabi.c \
elfarm-nabi.c \
@@ -496,19 +520,22 @@ BFD32_BACKENDS_CFILES = \
elf32-hppa.c \
elf32-i370.c \
elf32-i386.c \
- elf32-i386-fbsd.c \
elf32-i860.c \
elf32-i960.c \
+ elf32-ip2k.c \
+ elf32-iq2000.c \
elf32-m32r.c \
elf32-m68k.c \
elf32-m68hc11.c \
elf32-m68hc12.c \
+ elf32-m68hc1x.c \
elf32-m88k.c \
elf-m10200.c \
elf-m10300.c \
elf32-mcore.c \
elfxx-mips.c \
elf32-mips.c \
+ elf32-msp430.c \
elf32-openrisc.c \
elf32-or32.c \
elf32-pj.c \
@@ -517,13 +544,11 @@ BFD32_BACKENDS_CFILES = \
elf32-sh64-com.c \
elf32-s390.c \
elf32-sh.c \
- elf32-sh-lin.c \
- elf32-sh-nbsd.c \
- elf32-sh64-nbsd.c \
elf32-sparc.c \
elf32-v850.c \
elf32-vax.c \
elf32-xstormy16.c \
+ elf32-xtensa.c \
elf32.c \
elflink.c \
elf-strtab.c \
@@ -549,6 +574,7 @@ BFD32_BACKENDS_CFILES = \
m68klynx.c \
m68knetbsd.c \
m88kmach3.c \
+ mach-o.c \
mipsbsd.c \
newsos3.c \
nlm.c \
@@ -560,6 +586,7 @@ BFD32_BACKENDS_CFILES = \
oasys.c \
pc532-mach.c \
pdp11.c \
+ pef.c \
pe-arm.c \
pei-arm.c \
pe-i386.c \
@@ -588,7 +615,10 @@ BFD32_BACKENDS_CFILES = \
vms-hdr.c \
vms-misc.c \
vms-tir.c \
- xcofflink.c
+ xcofflink.c \
+ xsym.c \
+ xtensa-isa.c \
+ xtensa-modules.c
# The .o files needed by all of the 64 bit vectors that are configured into
@@ -603,14 +633,13 @@ BFD64_BACKENDS = \
efi-app-ia64.lo \
elf64-x86-64.lo \
elf64-alpha.lo \
- elf64-alpha-fbsd.lo \
elf64-hppa.lo \
elf64-ia64.lo \
elf64-gen.lo \
+ elfn32-mips.lo \
elf64-mips.lo \
elf64-mmix.lo \
elf64-sh64.lo \
- elf64-sh64-nbsd.lo \
elf64-ppc.lo \
elf64-s390.lo \
elf64-sparc.lo \
@@ -630,15 +659,14 @@ BFD64_BACKENDS_CFILES = \
efi-app-ia64.c \
elf64-x86-64.c \
elf64-alpha.c \
- elf64-alpha-fbsd.c \
elf64-hppa.c \
elf64-gen.c \
+ elfn32-mips.c \
elf64-mips.c \
elf64-mmix.c \
elf64-ppc.c \
elf64-s390.c \
elf64-sh64.c \
- elf64-sh64-nbsd.c \
elf64-sparc.c \
elf64.c \
mmo.c \
@@ -696,16 +724,18 @@ CFILES = $(SOURCE_CFILES) $(BUILD_CFILES)
SOURCE_HFILES = \
aout-target.h aoutf1.h aoutx.h coffcode.h coffswap.h ecoffswap.h \
- elf-bfd.h elf-hppa.h elf32-arm.h elf32-hppa.h elf64-hppa.h \
- elfcode.h elfcore.h elflink.h freebsd.h genlink.h go32stub.h \
- libaout.h libbfd.h libcoff.h libecoff.h libhppa.h \
- libieee.h libnlm.h liboasys.h libpei.h netbsd.h nlm-target.h \
- nlmcode.h nlmswap.h ns32k.h peicode.h som.h vms.h libxcoff.h \
- xcoff-target.h version.h
+ elf-bfd.h elf-hppa.h elf32-arm.h elf32-hppa.h \
+ elf64-hppa.h elfcode.h elfcore.h \
+ freebsd.h genlink.h go32stub.h \
+ libaout.h libbfd.h libcoff.h libecoff.h libhppa.h libieee.h \
+ libnlm.h liboasys.h libpei.h libxcoff.h mach-o.h \
+ netbsd.h nlm-target.h nlmcode.h nlmswap.h ns32k.h \
+ pef.h pef-traceback.h peicode.h som.h version.h \
+ vms.h xcoff-target.h xsym.h
BUILD_HFILES = \
- elf32-target.h elf64-target.h targmatch.h
+ bfdver.h elf32-target.h elf64-target.h targmatch.h
HFILES = $(SOURCE_HFILES) $(BUILD_HFILES)
@@ -736,10 +766,13 @@ BFD_H_DEPS = $(INCDIR)/ansidecl.h $(INCDIR)/symcat.h
LOCAL_H_DEPS = libbfd.h sysdep.h config.h
BFD_H_FILES = bfd-in.h init.c opncls.c libbfd.c section.c archures.c \
- reloc.c syms.c bfd.c archive.c corefile.c targets.c format.c version.h
+ reloc.c syms.c bfd.c bfdio.c bfdwin.c \
+ archive.c corefile.c targets.c format.c
BFD64_H_FILES = archive64.c
-LIBBFD_H_FILES = libbfd-in.h init.c libbfd.c cache.c reloc.c archures.c elf.c
+LIBBFD_H_FILES = libbfd-in.h init.c libbfd.c bfdio.c bfdwin.c \
+ cache.c reloc.c archures.c elf.c
+
LIBCOFF_H_FILES = libcoff-in.h coffcode.h
MOSTLYCLEANFILES = ofiles stamp-ofiles
@@ -752,7 +785,7 @@ 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
+CONFIG_CLEAN_FILES = bfd-in3.h bfdver.h
LIBRARIES = $(noinst_LIBRARIES)
@@ -764,10 +797,11 @@ libbfd_a_LIBADD =
libbfd_a_OBJECTS =
LTLIBRARIES = $(bfdlib_LTLIBRARIES)
-libbfd_la_OBJECTS = archive.lo archures.lo bfd.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 archive64.lo
+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)
@@ -775,7 +809,7 @@ 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
+configure.in version.h
DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
@@ -829,6 +863,8 @@ distclean-hdr:
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:
@@ -931,7 +967,7 @@ maintainer-clean-recursive:
dot_seen=no; \
rev=''; list='$(SUBDIRS)'; for subdir in $$list; do \
rev="$$subdir $$rev"; \
- test "$$subdir" = "." && dot_seen=yes; \
+ test "$$subdir" != "." || dot_seen=yes; \
done; \
test "$$dot_seen" = "no" && rev=". $$rev"; \
target=`echo $@ | sed s/-recursive//`; \
@@ -1144,22 +1180,15 @@ mostlyclean distclean maintainer-clean
po/SRC-POTFILES.in: @MAINT@ Makefile $(SRC_POTFILES)
- for file in $(SRC_POTFILES); do echo $$file; done | sort > tmp.src \
+ for file in $(SRC_POTFILES); do echo $$file; done \
+ | LC_COLLATE= sort > tmp.src \
&& mv tmp.src $(srcdir)/po/SRC-POTFILES.in
po/BLD-POTFILES.in: @MAINT@ Makefile $(BLD_POTFILES)
- for file in $(BLD_POTFILES); do echo $$file; done | sort > tmp.bld \
+ for file in $(BLD_POTFILES); do echo $$file; done \
+ | LC_COLLATE= sort > tmp.bld \
&& mv tmp.bld $(srcdir)/po/BLD-POTFILES.in
-# The following target is retained for upgrade purposes.
-# This target used to exist in older versions of this makefile, and was
-# referenced by <builddir>/po/Makefile (which is created from <srcdir>/po/Make-in)
-# So old versions of <builddir>/po/Makefile will try to regenerate themselves
-# when make is next run, but that dependency cannot be completed without a build
-# of po/POTFILES.in. Hence the presence of this rule. This rule will be deleted
-# once it is no longer needed - probably in the fall of 2001.
-po/POTFILES.in:
-
diststuff: info
stamp-ofiles: Makefile
@@ -1199,10 +1228,10 @@ targmatch.h: config.bfd targmatch.sed
# When compiling archures.c and targets.c, supply the default target
# info from configure.
-targets.lo: targets.c config.status
+targets.lo: targets.c Makefile
$(LIBTOOL) --mode=compile $(COMPILE) -c $(TDEFAULTS) $(srcdir)/targets.c
-archures.lo: archures.c config.status
+archures.lo: archures.c Makefile
$(LIBTOOL) --mode=compile $(COMPILE) -c $(TDEFAULTS) $(srcdir)/archures.c
elf32-target.h : elfxx-target.h
@@ -1364,8 +1393,9 @@ stmp-lcoff-h: $(LIBCOFF_H_FILES)
$(SHELL) $(srcdir)/../move-if-change libcoff.h-new $(srcdir)/libcoff.h
touch stmp-lcoff-h
-# We want to rerun configure if config.bfd or configure.host change.
-config.status: $(srcdir)/configure $(srcdir)/config.bfd $(srcdir)/configure.host
+# We want to rerun configure if config.bfd, configure.host or version.h change.
+config.status: $(srcdir)/configure $(srcdir)/config.bfd \
+ $(srcdir)/configure.host $(srcdir)/version.h
$(SHELL) ./config.status --recheck
# What appears below is generated by a hacked mkdep using gcc -MM.
@@ -1375,11 +1405,13 @@ config.status: $(srcdir)/configure $(srcdir)/config.bfd $(srcdir)/configure.host
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 $(INCDIR)/filenames.h $(INCDIR)/libiberty.h \
+bfd.lo: bfd.c bfdver.h $(INCDIR)/filenames.h $(INCDIR)/libiberty.h \
$(INCDIR)/safe-ctype.h $(INCDIR)/bfdlink.h $(INCDIR)/coff/internal.h \
$(INCDIR)/coff/sym.h libcoff.h libecoff.h $(INCDIR)/coff/ecoff.h \
elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
$(INCDIR)/elf/external.h
+bfdio.lo: bfdio.c $(INCDIR)/filenames.h
+bfdwin.lo: bfdwin.c $(INCDIR)/filenames.h
cache.lo: cache.c $(INCDIR)/filenames.h
coffgen.lo: coffgen.c $(INCDIR)/filenames.h $(INCDIR)/coff/internal.h \
libcoff.h $(INCDIR)/bfdlink.h
@@ -1387,7 +1419,8 @@ corefile.lo: corefile.c $(INCDIR)/filenames.h
format.lo: format.c $(INCDIR)/filenames.h
init.lo: init.c $(INCDIR)/filenames.h
libbfd.lo: libbfd.c $(INCDIR)/filenames.h
-opncls.lo: opncls.c $(INCDIR)/filenames.h $(INCDIR)/objalloc.h
+opncls.lo: opncls.c $(INCDIR)/filenames.h $(INCDIR)/objalloc.h \
+ $(INCDIR)/libiberty.h
reloc.lo: reloc.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h
section.lo: section.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h
syms.lo: syms.c $(INCDIR)/filenames.h $(INCDIR)/safe-ctype.h \
@@ -1412,11 +1445,12 @@ merge.lo: merge.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.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
+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
@@ -1433,6 +1467,8 @@ 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
@@ -1443,6 +1479,7 @@ 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
@@ -1454,6 +1491,7 @@ 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
@@ -1461,6 +1499,7 @@ 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 \
@@ -1523,7 +1562,8 @@ coff-aux.lo: coff-aux.c $(INCDIR)/filenames.h $(INCDIR)/coff/aux-coff.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 coffcode.h coffswap.h
+ $(INCDIR)/coff/internal.h libcoff.h $(INCDIR)/libiberty.h \
+ coffcode.h coffswap.h
coff-h8500.lo: coff-h8500.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
$(INCDIR)/coff/h8500.h $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \
libcoff.h coffcode.h coffswap.h
@@ -1572,6 +1612,9 @@ coff-svm68k.lo: coff-svm68k.c coff-m68k.c $(INCDIR)/filenames.h \
coff-tic30.lo: coff-tic30.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
$(INCDIR)/coff/tic30.h $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \
libcoff.h coffcode.h coffswap.h
+coff-tic4x.lo: coff-tic4x.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
+ $(INCDIR)/coff/tic4x.h $(INCDIR)/coff/ti.h $(INCDIR)/coff/internal.h \
+ libcoff.h coffcode.h coffswap.h
coff-tic54x.lo: coff-tic54x.c $(INCDIR)/filenames.h \
$(INCDIR)/bfdlink.h $(INCDIR)/coff/tic54x.h $(INCDIR)/coff/ti.h \
$(INCDIR)/coff/internal.h libcoff.h coffcode.h coffswap.h
@@ -1591,7 +1634,7 @@ coff-z8k.lo: coff-z8k.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
$(INCDIR)/coff/z8k.h $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \
libcoff.h coffcode.h coffswap.h
cofflink.lo: cofflink.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
- $(INCDIR)/coff/internal.h libcoff.h
+ $(INCDIR)/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
@@ -1611,6 +1654,10 @@ efi-app-ia32.lo: efi-app-ia32.c $(INCDIR)/filenames.h \
elf.lo: elf.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
$(INCDIR)/elf/external.h $(INCDIR)/libiberty.h
+elf32-am33lin.lo: elf32-am33lin.c elf-m10300.c $(INCDIR)/filenames.h \
+ elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
+ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/mn10300.h \
+ $(INCDIR)/elf/reloc-macros.h elf32-target.h
elf32-arc.lo: elf32-arc.c $(INCDIR)/filenames.h elf-bfd.h \
$(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
$(INCDIR)/bfdlink.h $(INCDIR)/elf/arc.h $(INCDIR)/elf/reloc-macros.h \
@@ -1650,7 +1697,7 @@ elf32-fr30.lo: elf32-fr30.c $(INCDIR)/filenames.h elf-bfd.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 \
- elf32-target.h
+ $(INCDIR)/elf/dwarf2.h $(INCDIR)/hashtab.h elf32-target.h
elf32-gen.lo: elf32-gen.c $(INCDIR)/filenames.h elf-bfd.h \
$(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
$(INCDIR)/bfdlink.h elf32-target.h
@@ -1664,15 +1711,12 @@ elf32-hppa.lo: elf32-hppa.c $(INCDIR)/filenames.h elf-bfd.h \
libhppa.h elf32-hppa.h elf-hppa.h elf32-target.h
elf32-i370.lo: elf32-i370.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
- $(INCDIR)/elf/external.h $(INCDIR)/elf/i370.h elf32-target.h
+ $(INCDIR)/elf/external.h $(INCDIR)/elf/i370.h $(INCDIR)/elf/reloc-macros.h \
+ elf32-target.h
elf32-i386.lo: elf32-i386.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
$(INCDIR)/elf/external.h $(INCDIR)/elf/i386.h $(INCDIR)/elf/reloc-macros.h \
elf32-target.h
-elf32-i386-fbsd.lo: elf32-i386-fbsd.c elf32-i386.c $(INCDIR)/filenames.h \
- $(INCDIR)/bfdlink.h elf-bfd.h $(INCDIR)/elf/common.h \
- $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/elf/i386.h \
- $(INCDIR)/elf/reloc-macros.h elf32-target.h
elf32-i860.lo: elf32-i860.c $(INCDIR)/filenames.h elf-bfd.h \
$(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
$(INCDIR)/bfdlink.h $(INCDIR)/elf/i860.h $(INCDIR)/elf/reloc-macros.h \
@@ -1681,6 +1725,14 @@ elf32-i960.lo: elf32-i960.c $(INCDIR)/filenames.h elf-bfd.h \
$(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
$(INCDIR)/bfdlink.h $(INCDIR)/elf/i960.h $(INCDIR)/elf/reloc-macros.h \
elf32-target.h
+elf32-ip2k.lo: elf32-ip2k.c $(INCDIR)/filenames.h elf-bfd.h \
+ $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
+ $(INCDIR)/bfdlink.h $(INCDIR)/elf/ip2k.h $(INCDIR)/elf/reloc-macros.h \
+ elf32-target.h
+elf32-iq2000.lo: elf32-iq2000.c $(INCDIR)/filenames.h \
+ elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
+ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/iq2000.h \
+ $(INCDIR)/elf/reloc-macros.h elf32-target.h
elf32-m32r.lo: elf32-m32r.c $(INCDIR)/filenames.h elf-bfd.h \
$(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
$(INCDIR)/bfdlink.h $(INCDIR)/elf/m32r.h $(INCDIR)/elf/reloc-macros.h \
@@ -1690,13 +1742,20 @@ elf32-m68k.lo: elf32-m68k.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
$(INCDIR)/elf/external.h $(INCDIR)/elf/m68k.h $(INCDIR)/elf/reloc-macros.h \
elf32-target.h
elf32-m68hc11.lo: elf32-m68hc11.c $(INCDIR)/filenames.h \
- elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
- $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/m68hc11.h \
- $(INCDIR)/elf/reloc-macros.h elf32-target.h
+ $(INCDIR)/bfdlink.h elf-bfd.h $(INCDIR)/elf/common.h \
+ $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h elf32-m68hc1x.h \
+ $(INCDIR)/elf/m68hc11.h $(INCDIR)/elf/reloc-macros.h \
+ $(INCDIR)/opcode/m68hc11.h elf32-target.h
elf32-m68hc12.lo: elf32-m68hc12.c $(INCDIR)/filenames.h \
- elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
- $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/m68hc11.h \
- $(INCDIR)/elf/reloc-macros.h elf32-target.h
+ $(INCDIR)/bfdlink.h elf-bfd.h $(INCDIR)/elf/common.h \
+ $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h elf32-m68hc1x.h \
+ $(INCDIR)/elf/m68hc11.h $(INCDIR)/elf/reloc-macros.h \
+ $(INCDIR)/opcode/m68hc11.h elf32-target.h
+elf32-m68hc1x.lo: elf32-m68hc1x.c $(INCDIR)/filenames.h \
+ $(INCDIR)/bfdlink.h elf-bfd.h $(INCDIR)/elf/common.h \
+ $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h elf32-m68hc1x.h \
+ $(INCDIR)/elf/m68hc11.h $(INCDIR)/elf/reloc-macros.h \
+ $(INCDIR)/opcode/m68hc11.h
elf32-m88k.lo: elf32-m88k.c $(INCDIR)/filenames.h elf-bfd.h \
$(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
$(INCDIR)/bfdlink.h elf32-target.h
@@ -1711,17 +1770,23 @@ elf32-mcore.lo: elf32-mcore.c $(INCDIR)/filenames.h \
$(INCDIR)/bfdlink.h elf-bfd.h $(INCDIR)/elf/common.h \
$(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/elf/mcore.h \
$(INCDIR)/elf/reloc-macros.h elf32-target.h
-elfxx-mips.lo: elfxx-mips.c $(INCDIR)/filenames.h 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
+elfxx-mips.lo: elfxx-mips.c $(INCDIR)/filenames.h $(INCDIR)/libiberty.h \
+ elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
+ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h elfxx-mips.h \
+ $(INCDIR)/elf/mips.h $(INCDIR)/elf/reloc-macros.h $(INCDIR)/coff/sym.h \
+ $(INCDIR)/coff/symconst.h $(INCDIR)/coff/ecoff.h $(INCDIR)/coff/mips.h \
+ $(INCDIR)/coff/external.h $(INCDIR)/hashtab.h
elf32-mips.lo: elf32-mips.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
genlink.h elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
$(INCDIR)/elf/external.h elfxx-mips.h $(INCDIR)/elf/mips.h \
$(INCDIR)/elf/reloc-macros.h $(INCDIR)/coff/sym.h $(INCDIR)/coff/symconst.h \
$(INCDIR)/coff/internal.h $(INCDIR)/coff/ecoff.h $(INCDIR)/coff/mips.h \
$(INCDIR)/coff/external.h ecoffswap.h elf32-target.h
+elf32-msp430.lo: elf32-msp430.c $(INCDIR)/filenames.h \
+ $(INCDIR)/libiberty.h elf-bfd.h $(INCDIR)/elf/common.h \
+ $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h \
+ $(INCDIR)/elf/msp430.h $(INCDIR)/elf/reloc-macros.h \
+ elf32-target.h
elf32-openrisc.lo: elf32-openrisc.c $(INCDIR)/filenames.h \
elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
$(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/openrisc.h \
@@ -1738,16 +1803,16 @@ elf32-pj.lo: elf32-pj.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.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-target.h
+ elf32-ppc.h elf32-target.h
elf32-sh64.lo: elf32-sh64.c $(INCDIR)/filenames.h elf-bfd.h \
$(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
$(INCDIR)/bfdlink.h $(srcdir)/../opcodes/sh64-opc.h \
- elf32-sh.c $(INCDIR)/elf/sh.h $(INCDIR)/elf/reloc-macros.h \
+ elf32-sh64.h elf32-sh.c $(INCDIR)/elf/sh.h $(INCDIR)/elf/reloc-macros.h \
elf32-target.h
elf32-sh64-com.lo: elf32-sh64-com.c $(INCDIR)/filenames.h \
elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
$(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/sh.h \
- $(INCDIR)/elf/reloc-macros.h $(srcdir)/../opcodes/sh64-opc.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 \
@@ -1756,19 +1821,6 @@ elf32-sh.lo: elf32-sh.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
$(INCDIR)/elf/external.h $(INCDIR)/elf/sh.h $(INCDIR)/elf/reloc-macros.h \
elf32-target.h
-elf32-sh-lin.lo: elf32-sh-lin.c $(INCDIR)/filenames.h \
- $(INCDIR)/elf/internal.h elf-bfd.h $(INCDIR)/elf/common.h \
- $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h elf32-sh.c \
- $(INCDIR)/elf/sh.h $(INCDIR)/elf/reloc-macros.h elf32-target.h
-elf32-sh-nbsd.lo: elf32-sh-nbsd.c elf32-sh.c $(INCDIR)/filenames.h \
- $(INCDIR)/bfdlink.h elf-bfd.h $(INCDIR)/elf/common.h \
- $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/elf/sh.h \
- $(INCDIR)/elf/reloc-macros.h elf32-target.h
-elf32-sh64-nbsd.lo: elf32-sh64-nbsd.c 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-sh.c $(INCDIR)/elf/sh.h \
- $(INCDIR)/elf/reloc-macros.h elf32-target.h
elf32-sparc.lo: elf32-sparc.c $(INCDIR)/filenames.h \
$(INCDIR)/bfdlink.h elf-bfd.h $(INCDIR)/elf/common.h \
$(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/elf/sparc.h \
@@ -1787,13 +1839,18 @@ elf32-xstormy16.lo: elf32-xstormy16.c $(INCDIR)/filenames.h \
$(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/xstormy16.h \
$(INCDIR)/elf/reloc-macros.h $(INCDIR)/libiberty.h \
elf32-target.h
+elf32-xtensa.lo: elf32-xtensa.c $(INCDIR)/filenames.h \
+ $(INCDIR)/bfdlink.h elf-bfd.h $(INCDIR)/elf/common.h \
+ $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/elf/xtensa.h \
+ $(INCDIR)/elf/reloc-macros.h $(INCDIR)/xtensa-isa.h \
+ $(INCDIR)/xtensa-config.h elf32-target.h
elf32.lo: elf32.c elfcode.h $(INCDIR)/filenames.h $(INCDIR)/libiberty.h \
$(INCDIR)/bfdlink.h elf-bfd.h $(INCDIR)/elf/common.h \
$(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h elfcore.h \
- elflink.h
+ $(INCDIR)/safe-ctype.h
elflink.lo: elflink.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
- $(INCDIR)/elf/external.h
+ $(INCDIR)/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
@@ -1863,6 +1920,8 @@ m68knetbsd.lo: m68knetbsd.c netbsd.h $(INCDIR)/filenames.h \
m88kmach3.lo: m88kmach3.c $(INCDIR)/filenames.h libaout.h \
$(INCDIR)/bfdlink.h aout-target.h $(INCDIR)/aout/aout64.h \
$(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h
+mach-o.lo: mach-o.c mach-o.h $(INCDIR)/filenames.h \
+ $(INCDIR)/libiberty.h mach-o-target.c
mipsbsd.lo: mipsbsd.c $(INCDIR)/filenames.h libaout.h \
$(INCDIR)/bfdlink.h aout-target.h $(INCDIR)/aout/aout64.h \
$(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h
@@ -1894,6 +1953,8 @@ pc532-mach.lo: pc532-mach.c $(INCDIR)/filenames.h libaout.h \
pdp11.lo: pdp11.c $(INCDIR)/filenames.h libaout.h $(INCDIR)/bfdlink.h \
aout-target.h $(INCDIR)/aout/aout64.h $(INCDIR)/aout/stab_gnu.h \
$(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h $(INCDIR)/safe-ctype.h
+pef.lo: pef.c $(INCDIR)/safe-ctype.h pef.h pef-traceback.h \
+ $(INCDIR)/filenames.h $(INCDIR)/libiberty.h
pe-arm.lo: pe-arm.c $(INCDIR)/filenames.h coff-arm.c \
$(INCDIR)/coff/arm.h $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \
$(INCDIR)/coff/pe.h libcoff.h $(INCDIR)/bfdlink.h coffcode.h \
@@ -1977,8 +2038,8 @@ vms.lo: vms.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
vms.h
vms-gsd.lo: vms-gsd.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
vms.h
-vms-hdr.lo: vms-hdr.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
- $(INCDIR)/safe-ctype.h vms.h
+vms-hdr.lo: vms-hdr.c bfdver.h $(INCDIR)/filenames.h \
+ $(INCDIR)/bfdlink.h $(INCDIR)/safe-ctype.h vms.h
vms-misc.lo: vms-misc.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
vms.h
vms-tir.lo: vms-tir.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
@@ -1986,6 +2047,11 @@ vms-tir.lo: vms-tir.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
xcofflink.lo: xcofflink.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
$(INCDIR)/coff/internal.h $(INCDIR)/coff/xcoff.h libcoff.h \
libxcoff.h
+xsym.lo: xsym.c xsym.h $(INCDIR)/filenames.h
+xtensa-isa.lo: xtensa-isa.c $(INCDIR)/xtensa-isa.h \
+ $(INCDIR)/xtensa-isa-internal.h
+xtensa-modules.lo: xtensa-modules.c $(INCDIR)/xtensa-isa.h \
+ $(INCDIR)/xtensa-isa-internal.h
aix5ppc-core.lo: aix5ppc-core.c
aout64.lo: aout64.c aoutx.h $(INCDIR)/filenames.h $(INCDIR)/safe-ctype.h \
$(INCDIR)/bfdlink.h libaout.h $(INCDIR)/aout/aout64.h \
@@ -2017,13 +2083,6 @@ elf64-alpha.lo: elf64-alpha.c $(INCDIR)/filenames.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-alpha-fbsd.lo: elf64-alpha-fbsd.c elf64-alpha.c $(INCDIR)/filenames.h \
- elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
- $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/alpha.h \
- $(INCDIR)/elf/reloc-macros.h $(INCDIR)/coff/internal.h \
- $(INCDIR)/coff/sym.h $(INCDIR)/coff/symconst.h $(INCDIR)/coff/ecoff.h \
- $(INCDIR)/coff/alpha.h $(INCDIR)/aout/ar.h libcoff.h \
- libecoff.h ecoffswap.h elf64-target.h
elf64-hppa.lo: elf64-hppa.c $(INCDIR)/alloca-conf.h \
$(INCDIR)/filenames.h elf-bfd.h $(INCDIR)/elf/common.h \
$(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h \
@@ -2032,6 +2091,13 @@ elf64-hppa.lo: elf64-hppa.c $(INCDIR)/alloca-conf.h \
elf64-gen.lo: elf64-gen.c $(INCDIR)/filenames.h elf-bfd.h \
$(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
$(INCDIR)/bfdlink.h elf64-target.h
+elfn32-mips.lo: elfn32-mips.c $(INCDIR)/filenames.h \
+ $(INCDIR)/bfdlink.h genlink.h elf-bfd.h $(INCDIR)/elf/common.h \
+ $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h elfxx-mips.h \
+ $(INCDIR)/elf/mips.h $(INCDIR)/elf/reloc-macros.h $(INCDIR)/coff/sym.h \
+ $(INCDIR)/coff/symconst.h $(INCDIR)/coff/internal.h \
+ $(INCDIR)/coff/ecoff.h $(INCDIR)/coff/mips.h $(INCDIR)/coff/external.h \
+ ecoffswap.h elf32-target.h
elf64-mips.lo: elf64-mips.c $(INCDIR)/filenames.h $(INCDIR)/aout/ar.h \
$(INCDIR)/bfdlink.h genlink.h elf-bfd.h $(INCDIR)/elf/common.h \
$(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h elfxx-mips.h \
@@ -2045,7 +2111,7 @@ elf64-mmix.lo: elf64-mmix.c $(INCDIR)/filenames.h elf-bfd.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/ppc.h $(INCDIR)/elf/reloc-macros.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 \
@@ -2055,10 +2121,6 @@ elf64-sh64.lo: elf64-sh64.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
$(INCDIR)/elf/external.h $(INCDIR)/elf/sh.h $(INCDIR)/elf/reloc-macros.h \
elf64-target.h
-elf64-sh64-nbsd.lo: elf64-sh64-nbsd.c elf64-sh64.c \
- $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h elf-bfd.h \
- $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
- $(INCDIR)/elf/sh.h $(INCDIR)/elf/reloc-macros.h elf64-target.h
elf64-sparc.lo: elf64-sparc.c $(INCDIR)/filenames.h \
elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
$(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/opcode/sparc.h \
@@ -2067,7 +2129,7 @@ elf64-sparc.lo: elf64-sparc.c $(INCDIR)/filenames.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 \
- elflink.h
+ $(INCDIR)/safe-ctype.h
mmo.lo: mmo.c $(INCDIR)/filenames.h $(INCDIR)/libiberty.h \
$(INCDIR)/elf/mmix.h $(INCDIR)/elf/reloc-macros.h $(INCDIR)/opcode/mmix.h
nlm32-alpha.lo: nlm32-alpha.c $(INCDIR)/filenames.h \
@@ -2091,11 +2153,13 @@ 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 elf32-target.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 elf64-target.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
diff --git a/contrib/binutils/bfd/acinclude.m4 b/contrib/binutils/bfd/acinclude.m4
index b3c6ccff..63b4bf9 100644
--- a/contrib/binutils/bfd/acinclude.m4
+++ b/contrib/binutils/bfd/acinclude.m4
@@ -1,5 +1,7 @@
+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_DEFUN([BFD_BINARY_FOPEN],
[AC_REQUIRE([AC_CANONICAL_SYSTEM])
case "${host}" in
changequote(,)dnl
@@ -9,7 +11,7 @@ changequote([,])dnl
esac])dnl
dnl Get a default for CC_FOR_BUILD to put into Makefile.
-AC_DEFUN(BFD_CC_FOR_BUILD,
+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
@@ -42,7 +44,7 @@ fi
AC_SUBST(EXEEXT_FOR_BUILD)])dnl
dnl See whether we need a declaration for a function.
-AC_DEFUN(BFD_NEED_DECLARATION,
+AC_DEFUN([BFD_NEED_DECLARATION],
[AC_MSG_CHECKING([whether $1 must be declared])
AC_CACHE_VAL(bfd_cv_decl_needed_$1,
[AC_TRY_COMPILE([
@@ -71,7 +73,7 @@ fi
dnl Check for existence of a type $1 in sys/procfs.h
-AC_DEFUN(BFD_HAVE_SYS_PROCFS_TYPE,
+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([
@@ -91,7 +93,7 @@ AC_DEFUN(BFD_HAVE_SYS_PROCFS_TYPE,
dnl Check for existence of member $2 in type $1 in sys/procfs.h
-AC_DEFUN(BFD_HAVE_SYS_PROCFS_TYPE_MEMBER,
+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([
@@ -127,9 +129,9 @@ AC_SUBST(INTLLIBS)
AC_DEFUN([AM_INSTALL_LIBBFD],
[AC_MSG_CHECKING([whether to install libbfd])
AC_ARG_ENABLE(install-libbfd,
-[ --install-libbfd controls installation of libbfd and related headers],
+[ --enable-install-libbfd controls installation of libbfd and related headers],
install_libbfd_p=$enableval,
- if test "${host}" = "${target}" -o "$enable_shared" = "yes"; then
+ if test "${host}" = "${target}" || test "$enable_shared" = "yes"; then
install_libbfd_p=yes
else
install_libbfd_p=no
diff --git a/contrib/binutils/bfd/aclocal.m4 b/contrib/binutils/bfd/aclocal.m4
index b6dfcbe..9d27670 100644
--- a/contrib/binutils/bfd/aclocal.m4
+++ b/contrib/binutils/bfd/aclocal.m4
@@ -1,4 +1,4 @@
-dnl aclocal.m4 generated automatically by aclocal 1.4-p5
+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
@@ -10,6 +10,8 @@ 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])
@@ -139,9 +141,9 @@ AC_SUBST(INTLLIBS)
AC_DEFUN([AM_INSTALL_LIBBFD],
[AC_MSG_CHECKING([whether to install libbfd])
AC_ARG_ENABLE(install-libbfd,
-[ --install-libbfd controls installation of libbfd and related headers],
+[ --enable-install-libbfd controls installation of libbfd and related headers],
install_libbfd_p=$enableval,
- if test "${host}" = "${target}" -o "$enable_shared" = "yes"; then
+ if test "${host}" = "${target}" || test "$enable_shared" = "yes"; then
install_libbfd_p=yes
else
install_libbfd_p=no
@@ -173,6 +175,33 @@ else
$1_FALSE=
fi])
+# isc-posix.m4 serial 2 (gettext-0.11.2)
+dnl Copyright (C) 1995-2002 Free Software Foundation, Inc.
+dnl This file is free software, distributed under the terms of the GNU
+dnl General Public License. As a special exception to the GNU General
+dnl Public License, this file may be distributed as part of a program
+dnl that contains a configuration script generated by Autoconf, under
+dnl the same distribution terms as the rest of that program.
+
+# This file is not needed with autoconf-2.53 and newer. Remove it in 2005.
+
+# This test replaces the one in autoconf.
+# Currently this macro should have the same name as the autoconf macro
+# because gettext's gettext.m4 (distributed in the automake package)
+# still uses it. Otherwise, the use in gettext.m4 makes autoheader
+# give these diagnostics:
+# configure.in:556: AC_TRY_COMPILE was called before AC_ISC_POSIX
+# configure.in:556: AC_TRY_RUN was called before AC_ISC_POSIX
+
+undefine([AC_ISC_POSIX])
+
+AC_DEFUN([AC_ISC_POSIX],
+ [
+ dnl This test replaces the obsolescent AC_ISC_POSIX kludge.
+ AC_CHECK_LIB(cposix, strerror, [LIBS="$LIBS -lcposix"])
+ ]
+)
+
# Do all the work for Automake. This macro actually does too much --
# some checks are only needed if your package does certain things.
# But this isn't really a big deal.
@@ -183,7 +212,8 @@ dnl Usage:
dnl AM_INIT_AUTOMAKE(package,version, [no-define])
AC_DEFUN([AM_INIT_AUTOMAKE],
-[AC_REQUIRE([AC_PROG_INSTALL])
+[AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
+AC_REQUIRE([AC_PROG_INSTALL])
PACKAGE=[$1]
AC_SUBST(PACKAGE)
VERSION=[$2]
@@ -199,13 +229,42 @@ 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, $missing_dir)
+AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version}, $missing_dir)
AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
-AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir)
+AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version}, $missing_dir)
AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir)
AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir)
AC_REQUIRE([AC_PROG_MAKE_SET])])
+# Copyright 2002 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+
+# AM_AUTOMAKE_VERSION(VERSION)
+# ----------------------------
+# Automake X.Y traces this macro to ensure aclocal.m4 has been
+# generated from the m4 files accompanying Automake X.Y.
+AC_DEFUN([AM_AUTOMAKE_VERSION],[am__api_version="1.4"])
+
+# AM_SET_CURRENT_AUTOMAKE_VERSION
+# -------------------------------
+# Call AM_AUTOMAKE_VERSION so it can be traced.
+# This function is AC_REQUIREd by AC_INIT_AUTOMAKE.
+AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
+ [AM_AUTOMAKE_VERSION([1.4-p6])])
+
#
# Check to make sure that the build environment is sane.
#
diff --git a/contrib/binutils/bfd/aout-arm.c b/contrib/binutils/bfd/aout-arm.c
index b87e09c..38ecfab 100644
--- a/contrib/binutils/bfd/aout-arm.c
+++ b/contrib/binutils/bfd/aout-arm.c
@@ -1,5 +1,5 @@
/* BFD back-end for raw ARM a.out binaries.
- Copyright 1994, 1995, 1997, 1998, 1999, 2000, 2001
+ Copyright 1994, 1995, 1997, 1998, 1999, 2000, 2001, 2002
Free Software Foundation, Inc.
Contributed by Richard Earnshaw (rwe@pegasus.esprit.ec.org)
@@ -22,7 +22,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "bfd.h"
#include "sysdep.h"
-/* Avoid multiple defininitions from aoutx if supporting standarad a.out
+/* Avoid multiple definitions from aoutx if supporting standard a.out
as well as our own. */
/* Do not "beautify" the CONCAT* macro args. Traditional C will not
remove whitespace added here, and thus will fail to concatenate
@@ -54,7 +54,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "libaout.h"
#include "aout/aout64.h"
-static boolean MY(write_object_contents)
+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 **));
@@ -80,28 +80,28 @@ 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),
+ 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)
+ 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)
diff --git a/contrib/binutils/bfd/aout-encap.c b/contrib/binutils/bfd/aout-encap.c
index 84c46c6..96c7082 100644
--- a/contrib/binutils/bfd/aout-encap.c
+++ b/contrib/binutils/bfd/aout-encap.c
@@ -1,5 +1,5 @@
/* BFD back-end for a.out files encapsulated with COFF headers.
- Copyright 1990, 1991, 1994, 1995, 2000, 2001
+ Copyright 1990, 1991, 1994, 1995, 2000, 2001, 2002, 2003
Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@@ -24,7 +24,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#define TARGET_PAGE_SIZE 4096
#define SEGMENT_SIZE TARGET_PAGE_SIZE
#define TEXT_START_ADDR 0
-#define BYTES_IN_WORD 4
#endif
#include "bfd.h"
@@ -123,7 +122,7 @@ encap_real_callback (abfd)
Section contents have already been written. We write the
file header, symbols, and relocation. */
-boolean
+bfd_boolean
encap_write_object_contents (abfd)
bfd *abfd;
{
@@ -230,7 +229,7 @@ encap_write_object_contents (abfd)
text_size -= N_TXTOFF (outheader);
WRITE_HEADERS(abfd, execp);
- return true;
+ return TRUE;
}
#define MY_write_object_content encap_write_object_contents
diff --git a/contrib/binutils/bfd/aout-target.h b/contrib/binutils/bfd/aout-target.h
index b2acc09..d8cad54 100644
--- a/contrib/binutils/bfd/aout-target.h
+++ b/contrib/binutils/bfd/aout-target.h
@@ -1,6 +1,6 @@
/* 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
+ 2000, 2001, 2002, 2003
Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@@ -201,21 +201,21 @@ MY(object_p) (abfd)
#ifndef MY_mkobject
-static boolean MY(mkobject) PARAMS ((bfd *));
+static bfd_boolean MY(mkobject) PARAMS ((bfd *));
-static boolean
+static bfd_boolean
MY(mkobject) (abfd)
bfd *abfd;
{
if (! NAME(aout,mkobject) (abfd))
- return false;
+ 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 TRUE;
}
#define MY_mkobject MY(mkobject)
#endif
@@ -228,10 +228,10 @@ MY(mkobject) (abfd)
section contents, and copy_private_bfd_data is not called until
after the section contents have been set. */
-static boolean MY_bfd_copy_private_section_data
+static bfd_boolean MY_bfd_copy_private_section_data
PARAMS ((bfd *, asection *, bfd *, asection *));
-static boolean
+static bfd_boolean
MY_bfd_copy_private_section_data (ibfd, isec, obfd, osec)
bfd *ibfd;
asection *isec ATTRIBUTE_UNUSED;
@@ -241,7 +241,7 @@ MY_bfd_copy_private_section_data (ibfd, isec, obfd, osec)
if (bfd_get_flavour (ibfd) == bfd_target_aout_flavour
&& bfd_get_flavour (obfd) == bfd_target_aout_flavour)
obj_aout_subformat (obfd) = obj_aout_subformat (ibfd);
- return true;
+ return TRUE;
}
#endif
@@ -251,9 +251,9 @@ MY_bfd_copy_private_section_data (ibfd, isec, obfd, osec)
file header, symbols, and relocation. */
#ifndef MY_write_object_contents
-static boolean MY(write_object_contents) PARAMS ((bfd *));
+static bfd_boolean MY(write_object_contents) PARAMS ((bfd *));
-static boolean
+static bfd_boolean
MY(write_object_contents) (abfd)
bfd *abfd;
{
@@ -264,16 +264,16 @@ MY(write_object_contents) (abfd)
WRITE_HEADERS(abfd, execp);
- return true;
+ return TRUE;
}
#define MY_write_object_contents MY(write_object_contents)
#endif
#ifndef MY_set_sizes
-static boolean MY(set_sizes) PARAMS ((bfd *));
+static bfd_boolean MY(set_sizes) PARAMS ((bfd *));
-static boolean
+static bfd_boolean
MY(set_sizes) (abfd)
bfd *abfd;
{
@@ -287,7 +287,7 @@ MY(set_sizes) (abfd)
#endif
adata(abfd).exec_bytes_size = EXEC_BYTES_SIZE;
- return true;
+ return TRUE;
}
#define MY_set_sizes MY(set_sizes)
#endif
@@ -375,9 +375,9 @@ 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 boolean MY_bfd_final_link PARAMS ((bfd *, struct bfd_link_info *));
+static bfd_boolean MY_bfd_final_link PARAMS ((bfd *, struct bfd_link_info *));
-static boolean
+static bfd_boolean
MY_bfd_final_link (abfd, info)
bfd *abfd;
struct bfd_link_info *info;
@@ -443,7 +443,7 @@ MY_bfd_final_link (abfd, info)
#endif
#ifndef MY_bfd_debug_info_accumulate
#define MY_bfd_debug_info_accumulate \
- (void (*) PARAMS ((bfd*, struct sec *))) bfd_void
+ (void (*) PARAMS ((bfd*, struct bfd_section *))) bfd_void
#endif
#ifndef MY_core_file_failing_command
@@ -470,8 +470,8 @@ MY_bfd_final_link (abfd, info)
#ifndef MY_get_symtab_upper_bound
#define MY_get_symtab_upper_bound NAME(aout,get_symtab_upper_bound)
#endif
-#ifndef MY_get_symtab
-#define MY_get_symtab NAME(aout,get_symtab)
+#ifndef MY_canonicalize_symtab
+#define MY_canonicalize_symtab NAME(aout,canonicalize_symtab)
#endif
#ifndef MY_get_reloc_upper_bound
#define MY_get_reloc_upper_bound NAME(aout,get_reloc_upper_bound)
diff --git a/contrib/binutils/bfd/aoutf1.h b/contrib/binutils/bfd/aoutf1.h
index 80d69d9..352dadf 100644
--- a/contrib/binutils/bfd/aoutf1.h
+++ b/contrib/binutils/bfd/aoutf1.h
@@ -1,6 +1,6 @@
/* A.out "format 1" file handling code for BFD.
Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 2000,
- 2001, 2002
+ 2001, 2002, 2003
Free Software Foundation, Inc.
Written by Cygnus Support.
@@ -75,15 +75,24 @@ The name put into the target vector.
#define sunos_write_object_contents aout_32_sunos4_write_object_contents
#endif
-static 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 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 boolean sunos4_core_file_matches_executable_p PARAMS ((bfd *, bfd *));
-static boolean sunos4_set_sizes PARAMS ((bfd *));
+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
@@ -91,13 +100,13 @@ static boolean sunos4_set_sizes PARAMS ((bfd *));
#define MY_bfd_merge_private_bfd_data sunos_merge_private_bfd_data
-static boolean
+static bfd_boolean
sunos_merge_private_bfd_data (ibfd, obfd)
bfd *ibfd, *obfd;
{
if (bfd_get_flavour (ibfd) != bfd_target_aout_flavour
|| bfd_get_flavour (obfd) != bfd_target_aout_flavour)
- return true;
+ return TRUE;
if (bfd_get_arch (obfd) == bfd_arch_sparc)
{
@@ -105,7 +114,7 @@ sunos_merge_private_bfd_data (ibfd, obfd)
bfd_set_arch_mach (obfd, bfd_arch_sparc, bfd_get_mach (ibfd));
}
- return true;
+ return TRUE;
}
/* This is either sunos_32_set_arch_mach or sunos_64_set_arch_mach,
@@ -207,7 +216,7 @@ choose_reloc_size (abfd)
aout_64_sunos4_write_object_contents or
aout_32_sunos4_write_object_contents, depending upon ARCH_SIZE. */
-static boolean
+static bfd_boolean
sunos_write_object_contents (abfd)
bfd *abfd;
{
@@ -264,7 +273,7 @@ sunos_write_object_contents (abfd)
WRITE_HEADERS (abfd, execp);
- return true;
+ return TRUE;
}
/* core files */
@@ -731,7 +740,7 @@ sunos4_core_file_failing_signal (abfd)
return core_hdr (abfd)->hdr->c_signo;
}
-static boolean
+static bfd_boolean
sunos4_core_file_matches_executable_p (core_bfd, exec_bfd)
bfd *core_bfd;
bfd *exec_bfd;
@@ -739,12 +748,12 @@ sunos4_core_file_matches_executable_p (core_bfd, exec_bfd)
if (core_bfd->xvec != exec_bfd->xvec)
{
bfd_set_error (bfd_error_system_call);
- return false;
+ return FALSE;
}
/* Solaris core files do not include an aouthdr. */
if ((core_hdr (core_bfd)->hdr)->c_len == SOLARIS_BCP_CORE_LEN)
- return true;
+ return TRUE;
return (memcmp ((char *) &((core_hdr (core_bfd)->hdr)->c_aouthdr),
(char *) exec_hdr (exec_bfd),
@@ -752,24 +761,24 @@ sunos4_core_file_matches_executable_p (core_bfd, exec_bfd)
}
#define MY_set_sizes sunos4_set_sizes
-static boolean
+static bfd_boolean
sunos4_set_sizes (abfd)
bfd *abfd;
{
switch (bfd_get_arch (abfd))
{
default:
- return false;
+ return FALSE;
case bfd_arch_sparc:
adata (abfd).page_size = 0x2000;
adata (abfd).segment_size = 0x2000;
adata (abfd).exec_bytes_size = EXEC_BYTES_SIZE;
- return true;
+ return TRUE;
case bfd_arch_m68k:
adata (abfd).page_size = 0x2000;
adata (abfd).segment_size = 0x20000;
adata (abfd).exec_bytes_size = EXEC_BYTES_SIZE;
- return true;
+ return TRUE;
}
}
@@ -825,7 +834,7 @@ 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 sec *))) bfd_void
+ (void (*) PARAMS ((bfd *, struct bfd_section *))) bfd_void
#define MY_core_file_p sunos4_core_file_p
#define MY_write_object_contents NAME(aout,sunos4_write_object_contents)
#define MY_backend_data &sunos4_aout_backend
diff --git a/contrib/binutils/bfd/aoutx.h b/contrib/binutils/bfd/aoutx.h
index 70359d6..3282f87 100644
--- a/contrib/binutils/bfd/aoutx.h
+++ b/contrib/binutils/bfd/aoutx.h
@@ -1,24 +1,24 @@
/* BFD semi-generic back-end for a.out binaries.
Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 2000,
- 2001, 2002
+ 2001, 2002, 2003
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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
/*
SECTION
@@ -105,9 +105,7 @@ DESCRIPTION
in the @file{config/@var{XXX}.mt} file, and modify @file{configure.in}
to use the
@file{@var{XXX}.mt} file (by setting "<<bfd_target=XXX>>") when your
- configuration is selected.
-
-*/
+ configuration is selected. */
/* Some assumptions:
* Any BFD with D_PAGED set is ZMAGIC, and vice versa.
@@ -131,14 +129,18 @@ DESCRIPTION
#include "aout/stab_gnu.h"
#include "aout/ar.h"
-static boolean aout_get_external_symbols PARAMS ((bfd *));
-static boolean translate_from_native_sym_flags
+static bfd_boolean aout_get_external_symbols
+ PARAMS ((bfd *));
+static bfd_boolean translate_from_native_sym_flags
PARAMS ((bfd *, aout_symbol_type *));
-static boolean translate_to_native_sym_flags
+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 *));
+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));
@@ -153,9 +155,8 @@ DESCRIPTION
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.
+ addend. */
-*/
#ifndef CTOR_TABLE_RELOC_HOWTO
#define CTOR_TABLE_RELOC_IDX 2
#define CTOR_TABLE_RELOC_HOWTO(BFD) \
@@ -193,58 +194,59 @@ DESCRIPTION
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). */
-reloc_howto_type howto_table_std[] = {
- /* type rs size bsz pcrel bitpos ovrf sf name part_inpl readmask setmask pcdone */
-HOWTO ( 0, 0, 0, 8, false, 0, complain_overflow_bitfield,0,"8", true, 0x000000ff,0x000000ff, false),
-HOWTO ( 1, 0, 1, 16, false, 0, complain_overflow_bitfield,0,"16", true, 0x0000ffff,0x0000ffff, false),
-HOWTO ( 2, 0, 2, 32, false, 0, complain_overflow_bitfield,0,"32", true, 0xffffffff,0xffffffff, false),
-HOWTO ( 3, 0, 4, 64, false, 0, complain_overflow_bitfield,0,"64", true, 0xdeaddead,0xdeaddead, false),
-HOWTO ( 4, 0, 0, 8, true, 0, complain_overflow_signed, 0,"DISP8", true, 0x000000ff,0x000000ff, false),
-HOWTO ( 5, 0, 1, 16, true, 0, complain_overflow_signed, 0,"DISP16", true, 0x0000ffff,0x0000ffff, false),
-HOWTO ( 6, 0, 2, 32, true, 0, complain_overflow_signed, 0,"DISP32", true, 0xffffffff,0xffffffff, false),
-HOWTO ( 7, 0, 4, 64, true, 0, complain_overflow_signed, 0,"DISP64", true, 0xfeedface,0xfeedface, false),
-HOWTO ( 8, 0, 2, 0, false, 0, complain_overflow_bitfield,0,"GOT_REL", false, 0,0x00000000, false),
-HOWTO ( 9, 0, 1, 16, false, 0, complain_overflow_bitfield,0,"BASE16", false,0xffffffff,0xffffffff, false),
-HOWTO (10, 0, 2, 32, false, 0, complain_overflow_bitfield,0,"BASE32", false,0xffffffff,0xffffffff, false),
+reloc_howto_type howto_table_std[] =
+{
+ /* type rs size bsz pcrel bitpos ovrf sf name part_inpl readmask setmask pcdone. */
+HOWTO ( 0, 0, 0, 8, FALSE, 0, complain_overflow_bitfield,0,"8", TRUE, 0x000000ff,0x000000ff, FALSE),
+HOWTO ( 1, 0, 1, 16, FALSE, 0, complain_overflow_bitfield,0,"16", TRUE, 0x0000ffff,0x0000ffff, FALSE),
+HOWTO ( 2, 0, 2, 32, FALSE, 0, complain_overflow_bitfield,0,"32", TRUE, 0xffffffff,0xffffffff, FALSE),
+HOWTO ( 3, 0, 4, 64, FALSE, 0, complain_overflow_bitfield,0,"64", TRUE, 0xdeaddead,0xdeaddead, FALSE),
+HOWTO ( 4, 0, 0, 8, TRUE, 0, complain_overflow_signed, 0,"DISP8", TRUE, 0x000000ff,0x000000ff, FALSE),
+HOWTO ( 5, 0, 1, 16, TRUE, 0, complain_overflow_signed, 0,"DISP16", TRUE, 0x0000ffff,0x0000ffff, FALSE),
+HOWTO ( 6, 0, 2, 32, TRUE, 0, complain_overflow_signed, 0,"DISP32", TRUE, 0xffffffff,0xffffffff, FALSE),
+HOWTO ( 7, 0, 4, 64, TRUE, 0, complain_overflow_signed, 0,"DISP64", TRUE, 0xfeedface,0xfeedface, FALSE),
+HOWTO ( 8, 0, 2, 0, FALSE, 0, complain_overflow_bitfield,0,"GOT_REL", FALSE, 0,0x00000000, FALSE),
+HOWTO ( 9, 0, 1, 16, FALSE, 0, complain_overflow_bitfield,0,"BASE16", FALSE,0xffffffff,0xffffffff, FALSE),
+HOWTO (10, 0, 2, 32, FALSE, 0, complain_overflow_bitfield,0,"BASE32", FALSE,0xffffffff,0xffffffff, FALSE),
EMPTY_HOWTO (-1),
EMPTY_HOWTO (-1),
EMPTY_HOWTO (-1),
EMPTY_HOWTO (-1),
EMPTY_HOWTO (-1),
- HOWTO (16, 0, 2, 0, false, 0, complain_overflow_bitfield,0,"JMP_TABLE", false, 0,0x00000000, false),
+ HOWTO (16, 0, 2, 0, FALSE, 0, complain_overflow_bitfield,0,"JMP_TABLE", FALSE, 0,0x00000000, FALSE),
EMPTY_HOWTO (-1),
EMPTY_HOWTO (-1),
EMPTY_HOWTO (-1),
@@ -260,7 +262,7 @@ EMPTY_HOWTO (-1),
EMPTY_HOWTO (-1),
EMPTY_HOWTO (-1),
EMPTY_HOWTO (-1),
- HOWTO (32, 0, 2, 0, false, 0, complain_overflow_bitfield,0,"RELATIVE", false, 0,0x00000000, false),
+ HOWTO (32, 0, 2, 0, FALSE, 0, complain_overflow_bitfield,0,"RELATIVE", FALSE, 0,0x00000000, FALSE),
EMPTY_HOWTO (-1),
EMPTY_HOWTO (-1),
EMPTY_HOWTO (-1),
@@ -268,7 +270,7 @@ EMPTY_HOWTO (-1),
EMPTY_HOWTO (-1),
EMPTY_HOWTO (-1),
EMPTY_HOWTO (-1),
- HOWTO (40, 0, 2, 0, false, 0, complain_overflow_bitfield,0,"BASEREL", false, 0,0x00000000, false),
+ HOWTO (40, 0, 2, 0, FALSE, 0, complain_overflow_bitfield,0,"BASEREL", FALSE, 0,0x00000000, FALSE),
};
#define TABLE_SIZE(TABLE) (sizeof (TABLE) / sizeof (TABLE[0]))
@@ -281,6 +283,7 @@ NAME(aout,reloc_type_lookup) (abfd,code)
#define EXT(i, j) case i: return &howto_table_ext[j]
#define STD(i, j) case i: return &howto_table_std[j]
int ext = obj_reloc_entry_size (abfd) == RELOC_EXT_SIZE;
+
if (code == BFD_RELOC_CTOR)
switch (bfd_get_arch_info (abfd)->bits_per_address)
{
@@ -291,6 +294,7 @@ NAME(aout,reloc_type_lookup) (abfd,code)
code = BFD_RELOC_64;
break;
}
+
if (ext)
switch (code)
{
@@ -313,9 +317,10 @@ NAME(aout,reloc_type_lookup) (abfd,code)
default: return (reloc_howto_type *) NULL;
}
else
- /* std relocs */
+ /* std relocs. */
switch (code)
{
+ STD (BFD_RELOC_8, 0);
STD (BFD_RELOC_16, 1);
STD (BFD_RELOC_32, 2);
STD (BFD_RELOC_8_PCREL, 4);
@@ -416,20 +421,20 @@ NAME(aout,swap_exec_header_out) (abfd, execp, raw_bytes)
/* Make all the section for an a.out file. */
-boolean
+bfd_boolean
NAME(aout,make_sections) (abfd)
bfd *abfd;
{
if (obj_textsec (abfd) == (asection *) NULL
&& bfd_make_section (abfd, ".text") == (asection *) NULL)
- return false;
+ return FALSE;
if (obj_datasec (abfd) == (asection *) NULL
&& bfd_make_section (abfd, ".data") == (asection *) NULL)
- return false;
+ return FALSE;
if (obj_bsssec (abfd) == (asection *) NULL
&& bfd_make_section (abfd, ".bss") == (asection *) NULL)
- return false;
- return true;
+ return FALSE;
+ return TRUE;
}
/*
@@ -474,14 +479,15 @@ NAME(aout,some_aout_object_p) (abfd, execp, callback_to_real_object_p)
*abfd->tdata.aout_data = *oldrawptr;
abfd->tdata.aout_data->a.hdr = &rawptr->e;
- *(abfd->tdata.aout_data->a.hdr) = *execp; /* Copy in the internal_exec struct */
+ /* Copy in the internal_exec struct. */
+ *(abfd->tdata.aout_data->a.hdr) = *execp;
execp = abfd->tdata.aout_data->a.hdr;
- /* Set the file flags */
+ /* Set the file flags. */
abfd->flags = BFD_NO_FLAGS;
if (execp->a_drsize || execp->a_trsize)
abfd->flags |= HAS_RELOC;
- /* Setting of EXEC_P has been deferred to the bottom of this function */
+ /* Setting of EXEC_P has been deferred to the bottom of this function. */
if (execp->a_syms)
abfd->flags |= HAS_LINENO | HAS_DEBUG | HAS_SYMS | HAS_LOCALS;
if (N_DYNAMIC (*execp))
@@ -563,18 +569,18 @@ NAME(aout,some_aout_object_p) (abfd, execp, callback_to_real_object_p)
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 */
+ /* Data and bss are already filled in since they're so standard. */
- /* The virtual memory addresses of the sections */
+ /* The virtual memory addresses of the sections. */
obj_textsec (abfd)->vma = N_TXTADDR (*execp);
obj_datasec (abfd)->vma = N_DATADDR (*execp);
obj_bsssec (abfd)->vma = N_BSSADDR (*execp);
- /* The file offsets of the sections */
+ /* 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 */
+ /* The file offsets of the relocation info. */
obj_textsec (abfd)->rel_filepos = N_TRELOFF (*execp);
obj_datasec (abfd)->rel_filepos = N_DRELOFF (*execp);
@@ -669,13 +675,13 @@ FUNCTION
aout_@var{size}_mkobject
SYNOPSIS
- boolean aout_@var{size}_mkobject, (bfd *abfd);
+ bfd_boolean aout_@var{size}_mkobject, (bfd *abfd);
DESCRIPTION
Initialize BFD @var{abfd} for use with a.out files.
*/
-boolean
+bfd_boolean
NAME(aout,mkobject) (abfd)
bfd *abfd;
{
@@ -686,7 +692,7 @@ NAME(aout,mkobject) (abfd)
rawptr = (struct aout_data_struct *) bfd_zalloc (abfd, amt);
if (rawptr == NULL)
- return false;
+ return FALSE;
abfd->tdata.aout_data = rawptr;
exec_hdr (abfd) = &(rawptr->e);
@@ -695,7 +701,7 @@ NAME(aout,mkobject) (abfd)
obj_datasec (abfd) = (asection *) NULL;
obj_bsssec (abfd) = (asection *) NULL;
- return true;
+ return TRUE;
}
/*
@@ -721,12 +727,12 @@ enum machine_type
NAME(aout,machine_type) (arch, machine, unknown)
enum bfd_architecture arch;
unsigned long machine;
- boolean *unknown;
+ bfd_boolean *unknown;
{
enum machine_type arch_flags;
arch_flags = M_UNKNOWN;
- *unknown = true;
+ *unknown = TRUE;
switch (arch)
{
@@ -745,7 +751,7 @@ NAME(aout,machine_type) (arch, machine, unknown)
switch (machine)
{
case 0: arch_flags = M_68010; break;
- case bfd_mach_m68000: arch_flags = M_UNKNOWN; *unknown = false; break;
+ case bfd_mach_m68000: arch_flags = M_UNKNOWN; *unknown = FALSE; break;
case bfd_mach_m68010: arch_flags = M_68010; break;
case bfd_mach_m68020: arch_flags = M_68020; break;
default: arch_flags = M_UNKNOWN; break;
@@ -753,7 +759,9 @@ NAME(aout,machine_type) (arch, machine, unknown)
break;
case bfd_arch_i386:
- if (machine == 0)
+ if (machine == 0
+ || machine == bfd_mach_i386_i386
+ || machine == bfd_mach_i386_i386_intel_syntax)
arch_flags = M_386;
break;
@@ -790,8 +798,10 @@ NAME(aout,machine_type) (arch, machine, unknown)
case bfd_mach_mips12000:
case bfd_mach_mips16:
case bfd_mach_mipsisa32:
+ case bfd_mach_mipsisa32r2:
case bfd_mach_mips5:
case bfd_mach_mipsisa64:
+ case bfd_mach_mipsisa64r2:
case bfd_mach_mips_sb1:
/* FIXME: These should be MIPS3, MIPS4, MIPS16, MIPS32, etc. */
arch_flags = M_MIPS2;
@@ -813,7 +823,7 @@ NAME(aout,machine_type) (arch, machine, unknown)
break;
case bfd_arch_vax:
- *unknown = false;
+ *unknown = FALSE;
break;
case bfd_arch_cris:
@@ -826,7 +836,7 @@ NAME(aout,machine_type) (arch, machine, unknown)
}
if (arch_flags != M_UNKNOWN)
- *unknown = false;
+ *unknown = FALSE;
return arch_flags;
}
@@ -836,7 +846,7 @@ FUNCTION
aout_@var{size}_set_arch_mach
SYNOPSIS
- boolean aout_@var{size}_set_arch_mach,
+ bfd_boolean aout_@var{size}_set_arch_mach,
(bfd *,
enum bfd_architecture arch,
unsigned long machine));
@@ -847,25 +857,25 @@ DESCRIPTION
can support the architecture required.
*/
-boolean
+bfd_boolean
NAME(aout,set_arch_mach) (abfd, arch, machine)
bfd *abfd;
enum bfd_architecture arch;
unsigned long machine;
{
if (! bfd_default_set_arch_mach (abfd, arch, machine))
- return false;
+ return FALSE;
if (arch != bfd_arch_unknown)
{
- boolean unknown;
+ bfd_boolean unknown;
NAME(aout,machine_type) (arch, machine, &unknown);
if (unknown)
- return false;
+ return FALSE;
}
- /* Determine the size of a relocation entry */
+ /* Determine the size of a relocation entry. */
switch (arch)
{
case bfd_arch_sparc:
@@ -903,7 +913,7 @@ adjust_o_magic (abfd, execp)
/* Data. */
if (!obj_datasec (abfd)->user_set_vma)
{
-#if 0 /* ?? Does alignment in the file image really matter? */
+#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;
@@ -1110,7 +1120,7 @@ adjust_n_magic (abfd, execp)
N_SET_MAGIC (*execp, NMAGIC);
}
-boolean
+bfd_boolean
NAME(aout,adjust_sizes_and_vmas) (abfd, text_size, text_end)
bfd *abfd;
bfd_size_type *text_size;
@@ -1119,10 +1129,10 @@ NAME(aout,adjust_sizes_and_vmas) (abfd, text_size, text_end)
struct internal_exec *execp = exec_hdr (abfd);
if (! NAME(aout,make_sections) (abfd))
- return false;
+ return FALSE;
if (adata (abfd).magic != undecided_magic)
- return true;
+ return TRUE;
obj_textsec (abfd)->_raw_size =
align_power (obj_textsec (abfd)->_raw_size,
@@ -1199,7 +1209,7 @@ NAME(aout,adjust_sizes_and_vmas) (abfd, text_size, text_end)
obj_bsssec (abfd)->vma, obj_bsssec (abfd)->_raw_size);
#endif
- return true;
+ return TRUE;
}
/*
@@ -1207,7 +1217,7 @@ FUNCTION
aout_@var{size}_new_section_hook
SYNOPSIS
- boolean aout_@var{size}_new_section_hook,
+ bfd_boolean aout_@var{size}_new_section_hook,
(bfd *abfd,
asection *newsect));
@@ -1215,48 +1225,47 @@ DESCRIPTION
Called by the BFD in response to a @code{bfd_make_section}
request.
*/
-boolean
+bfd_boolean
NAME(aout,new_section_hook) (abfd, newsect)
bfd *abfd;
asection *newsect;
{
- /* align to double at least */
+ /* Align to double at least. */
newsect->alignment_power = bfd_get_arch_info (abfd)->section_align_power;
if (bfd_get_format (abfd) == bfd_object)
- {
- if (obj_textsec (abfd) == NULL && !strcmp (newsect->name, ".text"))
- {
- obj_textsec (abfd)= newsect;
- newsect->target_index = N_TEXT;
- return true;
- }
-
- if (obj_datasec (abfd) == NULL && !strcmp (newsect->name, ".data"))
- {
- obj_datasec (abfd) = newsect;
- newsect->target_index = N_DATA;
- return true;
- }
+ {
+ if (obj_textsec (abfd) == NULL && !strcmp (newsect->name, ".text"))
+ {
+ obj_textsec (abfd)= newsect;
+ newsect->target_index = N_TEXT;
+ return TRUE;
+ }
- if (obj_bsssec (abfd) == NULL && !strcmp (newsect->name, ".bss"))
- {
- obj_bsssec (abfd) = newsect;
- newsect->target_index = N_BSS;
- return true;
- }
+ if (obj_datasec (abfd) == NULL && !strcmp (newsect->name, ".data"))
+ {
+ obj_datasec (abfd) = newsect;
+ newsect->target_index = N_DATA;
+ return TRUE;
+ }
- }
+ if (obj_bsssec (abfd) == NULL && !strcmp (newsect->name, ".bss"))
+ {
+ obj_bsssec (abfd) = newsect;
+ newsect->target_index = N_BSS;
+ return TRUE;
+ }
+ }
- /* We allow more than three sections internally */
- return true;
+ /* We allow more than three sections internally. */
+ return TRUE;
}
-boolean
+bfd_boolean
NAME(aout,set_section_contents) (abfd, section, location, offset, count)
bfd *abfd;
sec_ptr section;
- PTR location;
+ const PTR location;
file_ptr offset;
bfd_size_type count;
{
@@ -1266,38 +1275,44 @@ NAME(aout,set_section_contents) (abfd, section, location, offset, count)
if (! abfd->output_has_begun)
{
if (! NAME(aout,adjust_sizes_and_vmas) (abfd, &text_size, &text_end))
- return false;
+ return FALSE;
}
if (section == obj_bsssec (abfd))
{
bfd_set_error (bfd_error_no_contents);
- return false;
+ return FALSE;
}
if (section != obj_textsec (abfd)
&& section != obj_datasec (abfd))
{
- (*_bfd_error_handler)
- (_("%s: can not represent section `%s' in a.out object file format"),
- bfd_get_filename (abfd), bfd_get_section_name (abfd, section));
- bfd_set_error (bfd_error_nonrepresentable_section);
- return false;
+ if (aout_section_merge_with_text_p (abfd, section))
+ section->filepos = obj_textsec (abfd)->filepos +
+ (section->vma - obj_textsec (abfd)->vma);
+ else
+ {
+ (*_bfd_error_handler)
+ (_("%s: can not represent section `%s' in a.out object file format"),
+ bfd_get_filename (abfd), bfd_get_section_name (abfd, section));
+ bfd_set_error (bfd_error_nonrepresentable_section);
+ return FALSE;
+ }
}
if (count != 0)
{
if (bfd_seek (abfd, section->filepos + offset, SEEK_SET) != 0
|| bfd_bwrite (location, count, abfd) != count)
- return false;
+ return FALSE;
}
- return true;
+ return TRUE;
}
/* Read the external symbols from an a.out file. */
-static boolean
+static bfd_boolean
aout_get_external_symbols (abfd)
bfd *abfd;
{
@@ -1312,8 +1327,8 @@ aout_get_external_symbols (abfd)
#ifdef USE_MMAP
if (! bfd_get_file_window (abfd, obj_sym_filepos (abfd),
exec_hdr (abfd)->a_syms,
- &obj_aout_sym_window (abfd), true))
- return false;
+ &obj_aout_sym_window (abfd), TRUE))
+ return FALSE;
syms = (struct external_nlist *) obj_aout_sym_window (abfd).data;
#else
/* We allocate using malloc to make the values easy to free
@@ -1322,14 +1337,14 @@ aout_get_external_symbols (abfd)
syms = ((struct external_nlist *)
bfd_malloc (count * EXTERNAL_NLIST_SIZE));
if (syms == (struct external_nlist *) NULL && count != 0)
- return false;
+ return FALSE;
amt = exec_hdr (abfd)->a_syms;
if (bfd_seek (abfd, obj_sym_filepos (abfd), SEEK_SET) != 0
|| bfd_bread (syms, amt, abfd) != amt)
{
free (syms);
- return false;
+ return FALSE;
}
#endif
@@ -1348,18 +1363,18 @@ 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)
- return false;
+ return FALSE;
stringsize = GET_WORD (abfd, string_chars);
#ifdef USE_MMAP
if (! bfd_get_file_window (abfd, obj_str_filepos (abfd), stringsize,
- &obj_aout_string_window (abfd), true))
- return false;
+ &obj_aout_string_window (abfd), TRUE))
+ return FALSE;
strings = (char *) obj_aout_string_window (abfd).data;
#else
strings = (char *) bfd_malloc (stringsize + 1);
if (strings == NULL)
- return false;
+ return FALSE;
/* Skip space for the string count in the buffer for convenience
when using indexes. */
@@ -1367,7 +1382,7 @@ aout_get_external_symbols (abfd)
if (bfd_bread (strings + BYTES_IN_WORD, amt, abfd) != amt)
{
free (strings);
- return false;
+ return FALSE;
}
#endif
@@ -1380,7 +1395,7 @@ aout_get_external_symbols (abfd)
obj_aout_external_string_size (abfd) = stringsize;
}
- return true;
+ return TRUE;
}
/* Translate an a.out symbol into a BFD symbol. The desc, other, type
@@ -1388,7 +1403,7 @@ aout_get_external_symbols (abfd)
nlist structure. This function is responsible for setting
symbol->flags and symbol->section, and adjusting symbol->value. */
-static boolean
+static bfd_boolean
translate_from_native_sym_flags (abfd, cache_ptr)
bfd *abfd;
aout_symbol_type *cache_ptr;
@@ -1401,7 +1416,6 @@ translate_from_native_sym_flags (abfd, cache_ptr)
asection *sec;
/* This is a debugging symbol. */
-
cache_ptr->symbol.flags = BSF_DEBUGGING;
/* Work out the symbol section. */
@@ -1426,7 +1440,7 @@ translate_from_native_sym_flags (abfd, cache_ptr)
cache_ptr->symbol.section = sec;
cache_ptr->symbol.value -= sec->vma;
- return true;
+ return TRUE;
}
/* Get the default visibility. This does not apply to all types, so
@@ -1515,18 +1529,18 @@ translate_from_native_sym_flags (abfd, cache_ptr)
amt = strlen (cache_ptr->symbol.name) + 1;
copy = bfd_alloc (abfd, amt);
if (copy == NULL)
- return false;
+ return FALSE;
strcpy (copy, cache_ptr->symbol.name);
section = bfd_make_section (abfd, copy);
if (section == NULL)
- return false;
+ return FALSE;
}
amt = sizeof (arelent_chain);
reloc = (arelent_chain *) bfd_alloc (abfd, amt);
if (reloc == NULL)
- return false;
+ return FALSE;
/* Build a relocation entry for the constructor. */
switch (cache_ptr->type & N_TYPE)
@@ -1639,12 +1653,12 @@ translate_from_native_sym_flags (abfd, cache_ptr)
break;
}
- return true;
+ return TRUE;
}
/* Set the fields of SYM_POINTER according to CACHE_PTR. */
-static boolean
+static bfd_boolean
translate_to_native_sym_flags (abfd, cache_ptr, sym_pointer)
bfd *abfd;
asymbol *cache_ptr;
@@ -1670,7 +1684,7 @@ translate_to_native_sym_flags (abfd, cache_ptr, sym_pointer)
bfd_get_filename (abfd),
cache_ptr->name != NULL ? cache_ptr->name : _("*unknown*"));
bfd_set_error (bfd_error_nonrepresentable_section);
- return false;
+ return FALSE;
}
if (sec->output_section != NULL)
@@ -1695,14 +1709,19 @@ translate_to_native_sym_flags (abfd, cache_ptr, sym_pointer)
sym_pointer->e_type[0] = N_UNDF | N_EXT;
else
{
- (*_bfd_error_handler)
- (_("%s: can not represent section `%s' in a.out object file format"),
- bfd_get_filename (abfd), bfd_get_section_name (abfd, sec));
- bfd_set_error (bfd_error_nonrepresentable_section);
- return false;
+ if (aout_section_merge_with_text_p (abfd, sec))
+ sym_pointer->e_type[0] |= N_TEXT;
+ else
+ {
+ (*_bfd_error_handler)
+ (_("%s: can not represent section `%s' in a.out object file format"),
+ bfd_get_filename (abfd), bfd_get_section_name (abfd, sec));
+ bfd_set_error (bfd_error_nonrepresentable_section);
+ return FALSE;
+ }
}
- /* Turn the symbol from section relative to absolute again */
+ /* Turn the symbol from section relative to absolute again. */
value += sec->vma + off;
if ((cache_ptr->flags & BSF_WARNING) != 0)
@@ -1718,6 +1737,7 @@ translate_to_native_sym_flags (abfd, cache_ptr, sym_pointer)
if ((cache_ptr->flags & BSF_CONSTRUCTOR) != 0)
{
int type = ((aout_symbol_type *) cache_ptr)->type;
+
switch (type)
{
case N_ABS: type = N_SETA; break;
@@ -1746,7 +1766,7 @@ translate_to_native_sym_flags (abfd, cache_ptr, sym_pointer)
PUT_WORD (abfd, value, sym_pointer->e_value);
- return true;
+ return TRUE;
}
/* Native-level interface to symbols. */
@@ -1766,7 +1786,7 @@ NAME(aout,make_empty_symbol) (abfd)
/* Translate a set of internal symbols into external symbols. */
-boolean
+bfd_boolean
NAME(aout,translate_symbol_table) (abfd, in, ext, count, str, strsize, dynamic)
bfd *abfd;
aout_symbol_type *in;
@@ -1774,7 +1794,7 @@ NAME(aout,translate_symbol_table) (abfd, in, ext, count, str, strsize, dynamic)
bfd_size_type count;
char *str;
bfd_size_type strsize;
- boolean dynamic;
+ bfd_boolean dynamic;
{
struct external_nlist *ext_end;
@@ -1796,7 +1816,7 @@ NAME(aout,translate_symbol_table) (abfd, in, ext, count, str, strsize, dynamic)
else if (x < strsize)
in->symbol.name = str + x;
else
- return false;
+ return FALSE;
in->symbol.value = GET_SWORD (abfd, ext->e_value);
in->desc = H_GET_16 (abfd, ext->e_desc);
@@ -1805,20 +1825,20 @@ NAME(aout,translate_symbol_table) (abfd, in, ext, count, str, strsize, dynamic)
in->symbol.udata.p = NULL;
if (! translate_from_native_sym_flags (abfd, in))
- return false;
+ return FALSE;
if (dynamic)
in->symbol.flags |= BSF_DYNAMIC;
}
- return true;
+ return TRUE;
}
/* We read the symbols into a buffer, which is discarded when this
function exits. We read the strings into a buffer large enough to
hold them all plus all the cached symbol entries. */
-boolean
+bfd_boolean
NAME(aout,slurp_symbol_table) (abfd)
bfd *abfd;
{
@@ -1826,20 +1846,20 @@ NAME(aout,slurp_symbol_table) (abfd)
aout_symbol_type *cached;
bfd_size_type cached_size;
- /* If there's no work to be done, don't do any */
+ /* If there's no work to be done, don't do any. */
if (obj_aout_symbols (abfd) != (aout_symbol_type *) NULL)
- return true;
+ return TRUE;
old_external_syms = obj_aout_external_syms (abfd);
if (! aout_get_external_symbols (abfd))
- return false;
+ return FALSE;
cached_size = obj_aout_external_sym_count (abfd);
cached_size *= sizeof (aout_symbol_type);
cached = (aout_symbol_type *) bfd_zmalloc (cached_size);
if (cached == NULL && cached_size != 0)
- return false;
+ return FALSE;
/* Convert from external symbol information to internal. */
if (! (NAME(aout,translate_symbol_table)
@@ -1848,10 +1868,10 @@ NAME(aout,slurp_symbol_table) (abfd)
obj_aout_external_sym_count (abfd),
obj_aout_external_strings (abfd),
obj_aout_external_string_size (abfd),
- false)))
+ FALSE)))
{
free (cached);
- return false;
+ return FALSE;
}
bfd_get_symcount (abfd) = obj_aout_external_sym_count (abfd);
@@ -1873,7 +1893,7 @@ NAME(aout,slurp_symbol_table) (abfd)
obj_aout_external_syms (abfd) = NULL;
}
- return true;
+ return TRUE;
}
/* We use a hash table when writing out symbols so that we only write
@@ -1886,8 +1906,9 @@ NAME(aout,slurp_symbol_table) (abfd)
if BFD_TRADITIONAL_FORMAT is set. */
static bfd_size_type add_to_stringtab
- PARAMS ((bfd *, struct bfd_strtab_hash *, const char *, boolean));
-static boolean emit_stringtab PARAMS ((bfd *, struct bfd_strtab_hash *));
+ 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. */
@@ -1897,9 +1918,9 @@ add_to_stringtab (abfd, tab, str, copy)
bfd *abfd;
struct bfd_strtab_hash *tab;
const char *str;
- boolean copy;
+ bfd_boolean copy;
{
- boolean hash;
+ bfd_boolean hash;
bfd_size_type index;
/* An index of 0 always means the empty string. */
@@ -1908,9 +1929,9 @@ add_to_stringtab (abfd, tab, str, copy)
/* Don't hash if BFD_TRADITIONAL_FORMAT is set, because SunOS dbx
doesn't understand a hashed string table. */
- hash = true;
+ hash = TRUE;
if ((abfd->flags & BFD_TRADITIONAL_FORMAT) != 0)
- hash = false;
+ hash = FALSE;
index = _bfd_stringtab_add (tab, str, hash, copy);
@@ -1927,7 +1948,7 @@ add_to_stringtab (abfd, tab, str, copy)
/* Write out a strtab. ABFD is already at the right location in the
file. */
-static boolean
+static bfd_boolean
emit_stringtab (abfd, tab)
register bfd *abfd;
struct bfd_strtab_hash *tab;
@@ -1938,12 +1959,12 @@ emit_stringtab (abfd, tab)
/* The string table starts with the size. */
PUT_WORD (abfd, _bfd_stringtab_size (tab) + BYTES_IN_WORD, buffer);
if (bfd_bwrite ((PTR) buffer, amt, abfd) != amt)
- return false;
+ return FALSE;
return _bfd_stringtab_emit (abfd, tab);
}
-boolean
+bfd_boolean
NAME(aout,write_syms) (abfd)
bfd *abfd;
{
@@ -1953,7 +1974,7 @@ NAME(aout,write_syms) (abfd)
strtab = _bfd_stringtab_init ();
if (strtab == NULL)
- return false;
+ return FALSE;
for (count = 0; count < bfd_get_symcount (abfd); count++)
{
@@ -1962,7 +1983,7 @@ NAME(aout,write_syms) (abfd)
struct external_nlist nsp;
bfd_size_type amt;
- indx = add_to_stringtab (abfd, strtab, g->name, false);
+ indx = add_to_stringtab (abfd, strtab, g->name, FALSE);
if (indx == (bfd_size_type) -1)
goto error_return;
PUT_WORD (abfd, indx, (bfd_byte *) nsp.e_strx);
@@ -1997,15 +2018,15 @@ NAME(aout,write_syms) (abfd)
_bfd_stringtab_free (strtab);
- return true;
+ return TRUE;
error_return:
_bfd_stringtab_free (strtab);
- return false;
+ return FALSE;
}
long
-NAME(aout,get_symtab) (abfd, location)
+NAME(aout,canonicalize_symtab) (abfd, location)
bfd *abfd;
asymbol **location;
{
@@ -2023,7 +2044,7 @@ NAME(aout,get_symtab) (abfd, location)
return bfd_get_symcount (abfd);
}
-/* Standard reloc stuff */
+/* Standard reloc stuff. */
/* Output standard relocation information to a file in target byte order. */
extern void NAME(aout,swap_std_reloc_out)
@@ -2045,8 +2066,8 @@ NAME(aout,swap_std_reloc_out) (abfd, g, natptr)
PUT_WORD (abfd, g->address, natptr->r_address);
- r_length = g->howto->size ; /* Size as a power of two */
- r_pcrel = (int) g->howto->pc_relative; /* Relative to PC? */
+ r_length = g->howto->size ; /* Size as a power of two. */
+ r_pcrel = (int) g->howto->pc_relative; /* Relative to PC? */
/* XXX This relies on relocs coming from a.out files. */
r_baserel = (g->howto->type & 8) != 0;
r_jmptable = (g->howto->type & 16) != 0;
@@ -2057,43 +2078,41 @@ NAME(aout,swap_std_reloc_out) (abfd, g, natptr)
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)
|| bfd_is_abs_section (output_section)
|| bfd_is_und_section (output_section))
{
if (bfd_abs_section_ptr->symbol == sym)
- {
- /* Whoops, looked like an abs symbol, but is really an offset
- from the abs section */
- r_index = N_ABS;
- r_extern = 0;
- }
+ {
+ /* Whoops, looked like an abs symbol, but is
+ really an offset from the abs section. */
+ r_index = N_ABS;
+ r_extern = 0;
+ }
else
- {
- /* Fill in symbol */
- r_extern = 1;
- r_index = (*(g->sym_ptr_ptr))->KEEPIT;
-
- }
+ {
+ /* Fill in symbol. */
+ r_extern = 1;
+ r_index = (*(g->sym_ptr_ptr))->KEEPIT;
+ }
}
else
{
- /* Just an ordinary section */
+ /* Just an ordinary section. */
r_extern = 0;
r_index = output_section->target_index;
}
- /* now the fun stuff */
+ /* Now the fun stuff. */
if (bfd_header_big_endian (abfd))
{
natptr->r_index[0] = r_index >> 16;
@@ -2120,7 +2139,7 @@ NAME(aout,swap_std_reloc_out) (abfd, g, natptr)
}
}
-/* Extended stuff */
+/* Extended stuff. */
/* Output extended relocation information to a file in target byte order. */
extern void NAME(aout,swap_ext_reloc_out)
@@ -2153,7 +2172,6 @@ NAME(aout,swap_ext_reloc_out) (abfd, g, natptr)
Absolute symbols can come in in two ways, either as an offset
from the abs section, or as a symbol which has an abs value.
check for that here. */
-
if (bfd_is_abs_section (bfd_get_section (sym)))
{
r_extern = 0;
@@ -2170,12 +2188,12 @@ NAME(aout,swap_ext_reloc_out) (abfd, g, natptr)
}
else
{
- /* Just an ordinary section */
+ /* Just an ordinary section. */
r_extern = 0;
r_index = output_section->target_index;
}
- /* now the fun stuff */
+ /* Now the fun stuff. */
if (bfd_header_big_endian (abfd))
{
natptr->r_index[0] = r_index >> 16;
@@ -2256,7 +2274,7 @@ NAME(aout,swap_ext_reloc_in) (abfd, bytes, cache_ptr, symbols, symcount)
cache_ptr->address = (GET_SWORD (abfd, bytes->r_address));
- /* now the fun stuff */
+ /* Now the fun stuff. */
if (bfd_header_big_endian (abfd))
{
r_index = (((unsigned int) bytes->r_index[0] << 16)
@@ -2315,7 +2333,7 @@ NAME(aout,swap_std_reloc_in) (abfd, bytes, cache_ptr, symbols, symcount)
cache_ptr->address = H_GET_32 (abfd, bytes->r_address);
- /* now the fun stuff */
+ /* Now the fun stuff. */
if (bfd_header_big_endian (abfd))
{
r_index = (((unsigned int) bytes->r_index[0] << 16)
@@ -2368,7 +2386,7 @@ NAME(aout,swap_std_reloc_in) (abfd, bytes, cache_ptr, symbols, symcount)
/* Read and swap the relocs for a section. */
-boolean
+bfd_boolean
NAME(aout,slurp_reloc_table) (abfd, asect, symbols)
bfd *abfd;
sec_ptr asect;
@@ -2384,10 +2402,10 @@ NAME(aout,slurp_reloc_table) (abfd, asect, symbols)
bfd_size_type amt;
if (asect->relocation)
- return true;
+ return TRUE;
if (asect->flags & SEC_CONSTRUCTOR)
- return true;
+ return TRUE;
if (asect == obj_datasec (abfd))
reloc_size = exec_hdr (abfd)->a_drsize;
@@ -2398,11 +2416,11 @@ NAME(aout,slurp_reloc_table) (abfd, asect, symbols)
else
{
bfd_set_error (bfd_error_invalid_operation);
- return false;
+ return FALSE;
}
if (bfd_seek (abfd, asect->rel_filepos, SEEK_SET) != 0)
- return false;
+ return FALSE;
each_size = obj_reloc_entry_size (abfd);
@@ -2411,20 +2429,20 @@ NAME(aout,slurp_reloc_table) (abfd, asect, symbols)
amt = count * sizeof (arelent);
reloc_cache = (arelent *) bfd_zmalloc (amt);
if (reloc_cache == NULL && count != 0)
- return false;
+ return FALSE;
relocs = bfd_malloc (reloc_size);
if (relocs == NULL && reloc_size != 0)
{
free (reloc_cache);
- return false;
+ return FALSE;
}
if (bfd_bread (relocs, reloc_size, abfd) != reloc_size)
{
free (relocs);
free (reloc_cache);
- return false;
+ return FALSE;
}
cache_ptr = reloc_cache;
@@ -2450,12 +2468,12 @@ NAME(aout,slurp_reloc_table) (abfd, asect, symbols)
asect->relocation = reloc_cache;
asect->reloc_count = cache_ptr - reloc_cache;
- return true;
+ return TRUE;
}
/* Write out a relocation section into an object file. */
-boolean
+bfd_boolean
NAME(aout,squirt_out_relocs) (abfd, section)
bfd *abfd;
asection *section;
@@ -2468,13 +2486,13 @@ NAME(aout,squirt_out_relocs) (abfd, section)
bfd_size_type natsize;
if (count == 0 || section->orelocation == NULL)
- return true;
+ return TRUE;
each_size = obj_reloc_entry_size (abfd);
natsize = (bfd_size_type) each_size * count;
native = (unsigned char *) bfd_zalloc (abfd, natsize);
if (!native)
- return false;
+ return FALSE;
generic = section->orelocation;
@@ -2498,14 +2516,15 @@ NAME(aout,squirt_out_relocs) (abfd, section)
if (bfd_bwrite ((PTR) native, natsize, abfd) != natsize)
{
bfd_release (abfd, native);
- return false;
+ return FALSE;
}
bfd_release (abfd, native);
- return true;
+ return TRUE;
}
-/* This is stupid. This function should be a boolean predicate */
+/* This is stupid. This function should be a boolean predicate. */
+
long
NAME(aout,canonicalize_reloc) (abfd, section, relptr, symbols)
bfd *abfd;
@@ -2558,10 +2577,9 @@ NAME(aout,get_reloc_upper_bound) (abfd, asect)
bfd_set_error (bfd_error_invalid_operation);
return -1;
}
+
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 *)
@@ -2679,7 +2697,7 @@ NAME(aout,print_symbol) (abfd, afile, symbol, how)
long
NAME(aout,read_minisymbols) (abfd, dynamic, minisymsp, sizep)
bfd *abfd;
- boolean dynamic;
+ bfd_boolean dynamic;
PTR *minisymsp;
unsigned int *sizep;
{
@@ -2715,7 +2733,7 @@ NAME(aout,read_minisymbols) (abfd, dynamic, minisymsp, sizep)
asymbol *
NAME(aout,minisymbol_to_symbol) (abfd, dynamic, minisym, sym)
bfd *abfd;
- boolean dynamic;
+ bfd_boolean dynamic;
const PTR minisym;
asymbol *sym;
{
@@ -2733,19 +2751,17 @@ NAME(aout,minisymbol_to_symbol) (abfd, dynamic, minisym, sym)
(bfd_size_type) 1,
obj_aout_external_strings (abfd),
obj_aout_external_string_size (abfd),
- false)))
+ FALSE)))
return NULL;
return sym;
}
-/*
- provided a BFD, a section and an offset into the section, calculate
- and return the name of the source file and the line nearest to the
- wanted location.
-*/
+/* Provided a BFD, a section and an offset into the section, calculate
+ and return the name of the source file and the line nearest to the
+ wanted location. */
-boolean
+bfd_boolean
NAME(aout,find_nearest_line)
(abfd, section, symbols, offset, filename_ptr, functionname_ptr, line_ptr)
bfd *abfd;
@@ -2756,7 +2772,7 @@ NAME(aout,find_nearest_line)
const char **functionname_ptr;
unsigned int *line_ptr;
{
- /* Run down the file looking for the filename, function and linenumber */
+ /* Run down the file looking for the filename, function and linenumber. */
asymbol **p;
const char *directory_name = NULL;
const char *main_file_name = NULL;
@@ -2772,6 +2788,7 @@ NAME(aout,find_nearest_line)
*filename_ptr = abfd->filename;
*functionname_ptr = 0;
*line_ptr = 0;
+
if (symbols != (asymbol **)NULL)
{
for (p = symbols; *p; p++)
@@ -2859,12 +2876,13 @@ NAME(aout,find_nearest_line)
break;
case N_FUN:
{
- /* We'll keep this if it is nearer than the one we have already */
+ /* We'll keep this if it is nearer than the one we have already. */
if (q->symbol.value >= low_func_vma &&
- q->symbol.value <= offset) {
- low_func_vma = q->symbol.value;
- func = (asymbol *)q;
- }
+ q->symbol.value <= offset)
+ {
+ low_func_vma = q->symbol.value;
+ func = (asymbol *)q;
+ }
else if (q->symbol.value > offset)
goto done;
}
@@ -2886,6 +2904,7 @@ NAME(aout,find_nearest_line)
filelen = 0;
else
filelen = strlen (directory_name) + strlen (main_file_name);
+
if (func == NULL)
funclen = 0;
else
@@ -2893,6 +2912,7 @@ NAME(aout,find_nearest_line)
if (adata (abfd).line_buf != NULL)
free (adata (abfd).line_buf);
+
if (filelen + funclen == 0)
adata (abfd).line_buf = buf = NULL;
else
@@ -2900,7 +2920,7 @@ NAME(aout,find_nearest_line)
buf = (char *) bfd_malloc (filelen + funclen + 3);
adata (abfd).line_buf = buf;
if (buf == NULL)
- return false;
+ return FALSE;
}
if (main_file_name != NULL)
@@ -2930,20 +2950,20 @@ NAME(aout,find_nearest_line)
buf[0] = bfd_get_symbol_leading_char (abfd);
strcpy (buf + 1, function);
}
- /* Have to remove : stuff */
+ /* Have to remove : stuff. */
colon = strchr (buf, ':');
if (colon != NULL)
*colon = '\0';
*functionname_ptr = buf;
}
- return true;
+ return TRUE;
}
int
NAME(aout,sizeof_headers) (abfd, execable)
bfd *abfd;
- boolean execable ATTRIBUTE_UNUSED;
+ bfd_boolean execable ATTRIBUTE_UNUSED;
{
return adata (abfd).exec_bytes_size;
}
@@ -2951,7 +2971,7 @@ NAME(aout,sizeof_headers) (abfd, execable)
/* Free all information we have cached for this BFD. We can always
read it again later if we need it. */
-boolean
+bfd_boolean
NAME(aout,bfd_free_cached_info) (abfd)
bfd *abfd;
{
@@ -2959,7 +2979,7 @@ NAME(aout,bfd_free_cached_info) (abfd)
if (bfd_get_format (abfd) != bfd_object
|| abfd->tdata.aout_data == NULL)
- return true;
+ return TRUE;
#define BFCI_FREE(x) if (x != NULL) { free (x); x = NULL; }
BFCI_FREE (obj_aout_symbols (abfd));
@@ -2976,19 +2996,20 @@ NAME(aout,bfd_free_cached_info) (abfd)
BFCI_FREE (o->relocation);
#undef BFCI_FREE
- return true;
+ return TRUE;
}
/* a.out link code. */
-static boolean aout_link_add_object_symbols
+static bfd_boolean aout_link_add_object_symbols
PARAMS ((bfd *, struct bfd_link_info *));
-static boolean aout_link_check_archive_element
- PARAMS ((bfd *, struct bfd_link_info *, boolean *));
-static boolean aout_link_free_symbols PARAMS ((bfd *));
-static boolean aout_link_check_ar_symbols
- PARAMS ((bfd *, struct bfd_link_info *, boolean *pneeded));
-static boolean aout_link_add_symbols
+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. */
@@ -3016,7 +3037,7 @@ NAME(aout,link_hash_newfunc) (entry, table, string)
if (ret)
{
/* Set local fields. */
- ret->written = false;
+ ret->written = FALSE;
ret->indx = -1;
}
@@ -3025,13 +3046,13 @@ NAME(aout,link_hash_newfunc) (entry, table, string)
/* Initialize an a.out link hash table. */
-boolean
+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 *));
+ struct bfd_hash_entry *(*newfunc)
+ PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *,
+ const char *));
{
return _bfd_link_hash_table_init (&table->root, abfd, newfunc);
}
@@ -3045,9 +3066,10 @@ NAME(aout,link_hash_table_create) (abfd)
struct aout_link_hash_table *ret;
bfd_size_type amt = sizeof (struct aout_link_hash_table);
- ret = (struct aout_link_hash_table *) bfd_alloc (abfd, amt);
+ ret = (struct aout_link_hash_table *) bfd_malloc (amt);
if (ret == NULL)
return (struct bfd_link_hash_table *) NULL;
+
if (! NAME(aout,link_hash_table_init) (ret, abfd,
NAME(aout,link_hash_newfunc)))
{
@@ -3060,7 +3082,7 @@ NAME(aout,link_hash_table_create) (abfd)
/* Given an a.out BFD, add symbols to the global hash table as
appropriate. */
-boolean
+bfd_boolean
NAME(aout,link_add_symbols) (abfd, info)
bfd *abfd;
struct bfd_link_info *info;
@@ -3074,27 +3096,27 @@ NAME(aout,link_add_symbols) (abfd, info)
(abfd, info, aout_link_check_archive_element);
default:
bfd_set_error (bfd_error_wrong_format);
- return false;
+ return FALSE;
}
}
/* Add symbols from an a.out object file. */
-static boolean
+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;
+ return FALSE;
if (! aout_link_add_symbols (abfd, info))
- return false;
+ return FALSE;
if (! info->keep_memory)
{
if (! aout_link_free_symbols (abfd))
- return false;
+ return FALSE;
}
- return true;
+ return TRUE;
}
/* Check a single archive element to see if we need to include it in
@@ -3102,36 +3124,36 @@ aout_link_add_object_symbols (abfd, info)
needed in the link or not. This is called from
_bfd_generic_link_add_archive_symbols. */
-static boolean
+static bfd_boolean
aout_link_check_archive_element (abfd, info, pneeded)
bfd *abfd;
struct bfd_link_info *info;
- boolean *pneeded;
+ bfd_boolean *pneeded;
{
if (! aout_get_external_symbols (abfd))
- return false;
+ return FALSE;
if (! aout_link_check_ar_symbols (abfd, info, pneeded))
- return false;
+ return FALSE;
if (*pneeded)
{
if (! aout_link_add_symbols (abfd, info))
- return false;
+ return FALSE;
}
if (! info->keep_memory || ! *pneeded)
{
if (! aout_link_free_symbols (abfd))
- return false;
+ return FALSE;
}
- return true;
+ return TRUE;
}
/* Free up the internal symbols read from an a.out file. */
-static boolean
+static bfd_boolean
aout_link_free_symbols (abfd)
bfd *abfd;
{
@@ -3153,7 +3175,7 @@ aout_link_free_symbols (abfd)
#endif
obj_aout_external_strings (abfd) = (char *) NULL;
}
- return true;
+ return TRUE;
}
/* Look through the internal symbols to see if this object file should
@@ -3163,17 +3185,17 @@ aout_link_free_symbols (abfd)
known symbol but we do not include the object file in the link
(unless there is some other reason to include it). */
-static boolean
+static bfd_boolean
aout_link_check_ar_symbols (abfd, info, pneeded)
bfd *abfd;
struct bfd_link_info *info;
- boolean *pneeded;
+ bfd_boolean *pneeded;
{
register struct external_nlist *p;
struct external_nlist *pend;
char *strings;
- *pneeded = false;
+ *pneeded = FALSE;
/* Look through all the symbols. */
p = obj_aout_external_syms (abfd);
@@ -3203,7 +3225,7 @@ aout_link_check_ar_symbols (abfd, info, pneeded)
}
name = strings + GET_WORD (abfd, p->e_strx);
- h = bfd_link_hash_lookup (info->hash, name, false, false, true);
+ h = bfd_link_hash_lookup (info->hash, name, FALSE, FALSE, TRUE);
/* We are only interested in symbols that are currently
undefined or common. */
@@ -3224,23 +3246,47 @@ aout_link_check_ar_symbols (abfd, info, pneeded)
{
/* This object file defines this symbol. We must link it
in. This is true regardless of whether the current
- definition of the symbol is undefined or common. If the
- current definition is common, we have a case in which we
- have already seen an object file including
+ definition of the symbol is undefined or common.
+
+ If the current definition is common, we have a case in
+ which we have already seen an object file including:
int a;
- and this object file from the archive includes
+ and this object file from the archive includes:
int a = 5;
- In such a case we must include this object file.
+ In such a case, whether to include this object is target
+ dependant for backward compatibility.
FIXME: The SunOS 4.1.3 linker will pull in the archive
element if the symbol is defined in the .data section,
but not if it is defined in the .text section. That
- seems a bit crazy to me, and I haven't implemented it.
- However, it might be correct. */
+ seems a bit crazy to me, and it has not been implemented
+ yet. However, it might be correct. */
+ if (h->type == bfd_link_hash_common)
+ {
+ int skip = 0;
+
+ switch (info->common_skip_ar_aymbols)
+ {
+ case bfd_link_common_skip_text:
+ skip = (type == (N_TEXT | N_EXT));
+ break;
+ case bfd_link_common_skip_data:
+ skip = (type == (N_DATA | N_EXT));
+ break;
+ default:
+ case bfd_link_common_skip_all:
+ skip = 1;
+ break;
+ }
+
+ if (skip)
+ continue;
+ }
+
if (! (*info->callbacks->add_archive_element) (info, abfd, name))
- return false;
- *pneeded = true;
- return true;
+ return FALSE;
+ *pneeded = TRUE;
+ return TRUE;
}
if (type == (N_UNDF | N_EXT))
@@ -3267,9 +3313,9 @@ aout_link_check_ar_symbols (abfd, info, pneeded)
if (! (*info->callbacks->add_archive_element) (info,
abfd,
name))
- return false;
- *pneeded = true;
- return true;
+ return FALSE;
+ *pneeded = TRUE;
+ return TRUE;
}
/* Turn the current link symbol into a common
symbol. It is already on the undefs list. */
@@ -3278,7 +3324,7 @@ aout_link_check_ar_symbols (abfd, info, pneeded)
bfd_hash_allocate (&info->hash->table,
sizeof (struct bfd_link_hash_common_entry)));
if (h->u.c.p == NULL)
- return false;
+ return FALSE;
h->u.c.size = value;
@@ -3315,33 +3361,32 @@ aout_link_check_ar_symbols (abfd, info, pneeded)
if (h->type == bfd_link_hash_undefined)
{
if (! (*info->callbacks->add_archive_element) (info, abfd, name))
- return false;
- *pneeded = true;
- return true;
+ return FALSE;
+ *pneeded = TRUE;
+ return TRUE;
}
}
}
/* We do not need this object file. */
- return true;
+ return TRUE;
}
/* Add all symbols from an object file to the hash table. */
-static boolean
+static bfd_boolean
aout_link_add_symbols (abfd, info)
bfd *abfd;
struct bfd_link_info *info;
{
- boolean (*add_one_symbol) PARAMS ((struct bfd_link_info *, bfd *,
- const char *, flagword, asection *,
- bfd_vma, const char *, boolean,
- boolean,
- struct bfd_link_hash_entry **));
+ 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;
- boolean copy;
+ bfd_boolean copy;
struct aout_link_hash_entry **sym_hash;
register struct external_nlist *p;
struct external_nlist *pend;
@@ -3351,15 +3396,15 @@ aout_link_add_symbols (abfd, info)
sym_count = obj_aout_external_sym_count (abfd);
strings = obj_aout_external_strings (abfd);
if (info->keep_memory)
- copy = false;
+ copy = FALSE;
else
- copy = true;
+ copy = TRUE;
if (aout_backend_info (abfd)->add_dynamic_symbols != NULL)
{
if (! ((*aout_backend_info (abfd)->add_dynamic_symbols)
(abfd, info, &syms, &sym_count, &strings)))
- return false;
+ return FALSE;
}
/* We keep a list of the linker hash table entries that correspond
@@ -3369,7 +3414,7 @@ aout_link_add_symbols (abfd, info)
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;
+ return FALSE;
obj_aout_sym_hashes (abfd) = sym_hash;
add_one_symbol = aout_backend_info (abfd)->add_one_symbol;
@@ -3515,9 +3560,9 @@ aout_link_add_symbols (abfd, info)
}
if (! ((*add_one_symbol)
- (info, abfd, name, flags, section, value, string, copy, false,
+ (info, abfd, name, flags, section, value, string, copy, FALSE,
(struct bfd_link_hash_entry **) sym_hash)))
- return false;
+ return FALSE;
/* Restrict the maximum alignment of a common symbol based on
the architecture, since a.out has no way to represent
@@ -3543,7 +3588,7 @@ aout_link_add_symbols (abfd, info)
++sym_hash;
}
- return true;
+ return TRUE;
}
/* A hash table used for header files with N_BINCL entries. */
@@ -3606,27 +3651,27 @@ struct aout_final_link_info
static struct bfd_hash_entry *aout_link_includes_newfunc
PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, const char *));
-static boolean aout_link_input_bfd
+static bfd_boolean aout_link_input_bfd
PARAMS ((struct aout_final_link_info *, bfd *input_bfd));
-static boolean aout_link_write_symbols
+static bfd_boolean aout_link_write_symbols
PARAMS ((struct aout_final_link_info *, bfd *input_bfd));
-static boolean aout_link_write_other_symbol
+static bfd_boolean aout_link_write_other_symbol
PARAMS ((struct aout_link_hash_entry *, PTR));
-static boolean aout_link_input_section
+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 boolean aout_link_input_section_std
+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 boolean aout_link_input_section_ext
+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 boolean aout_link_reloc_link_order
+static bfd_boolean aout_link_reloc_link_order
PARAMS ((struct aout_final_link_info *, asection *,
struct bfd_link_order *));
@@ -3669,14 +3714,14 @@ aout_link_includes_newfunc (entry, table, string)
of bfd_link_order structures which list all the input sections for
the output section. */
-boolean
+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;
- boolean includes_hash_initialized = false;
+ bfd_boolean includes_hash_initialized = FALSE;
register bfd *sub;
bfd_size_type trsize, drsize;
bfd_size_type max_contents_size;
@@ -3686,7 +3731,7 @@ NAME(aout,final_link) (abfd, info, callback)
file_ptr text_end;
register struct bfd_link_order *p;
asection *o;
- boolean have_link_order_relocs;
+ bfd_boolean have_link_order_relocs;
if (info->shared)
abfd->flags |= DYNAMIC;
@@ -3702,10 +3747,10 @@ NAME(aout,final_link) (abfd, info, callback)
aout_link_includes_newfunc,
251))
goto error_return;
- includes_hash_initialized = true;
+ includes_hash_initialized = TRUE;
/* Figure out the largest section size. Also, if generating
- relocateable output, count the relocs. */
+ relocatable output, count the relocs. */
trsize = 0;
drsize = 0;
max_contents_size = 0;
@@ -3715,7 +3760,7 @@ NAME(aout,final_link) (abfd, info, callback)
{
bfd_size_type sz;
- if (info->relocateable)
+ if (info->relocatable)
{
if (bfd_get_flavour (sub) == bfd_target_aout_flavour)
{
@@ -3729,7 +3774,7 @@ NAME(aout,final_link) (abfd, info, callback)
work out the number of relocs needed, and then multiply
by the reloc size. */
(*_bfd_error_handler)
- (_("%s: relocateable link from %s to %s not supported"),
+ (_("%s: 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);
@@ -3759,7 +3804,7 @@ NAME(aout,final_link) (abfd, info, callback)
}
}
- if (info->relocateable)
+ if (info->relocatable)
{
if (obj_textsec (abfd) != (asection *) NULL)
trsize += (_bfd_count_link_order_relocs (obj_textsec (abfd)
@@ -3825,7 +3870,7 @@ NAME(aout,final_link) (abfd, info, callback)
struct aout_link_hash_entry *h;
h = aout_link_hash_lookup (aout_hash_table (info), "__DYNAMIC",
- false, false, false);
+ FALSE, FALSE, FALSE);
if (h != NULL)
aout_link_write_other_symbol (h, &aout_info);
}
@@ -3852,7 +3897,7 @@ NAME(aout,final_link) (abfd, info, callback)
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;
+ 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
@@ -3861,13 +3906,11 @@ NAME(aout,final_link) (abfd, info, callback)
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 = (unsigned int) true;
- }
+ if (p->type == bfd_indirect_link_order)
+ p->u.indirect.section->linker_mark = TRUE;
}
- have_link_order_relocs = false;
+ have_link_order_relocs = FALSE;
for (o = abfd->sections; o != (asection *) NULL; o = o->next)
{
for (p = o->link_order_head;
@@ -3885,14 +3928,14 @@ NAME(aout,final_link) (abfd, info, callback)
{
if (! aout_link_input_bfd (&aout_info, input_bfd))
goto error_return;
- input_bfd->output_has_begun = true;
+ 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;
+ have_link_order_relocs = TRUE;
}
else
{
@@ -3952,7 +3995,7 @@ NAME(aout,final_link) (abfd, info, callback)
if (includes_hash_initialized)
{
bfd_hash_table_free (&aout_info.includes.root);
- includes_hash_initialized = false;
+ includes_hash_initialized = FALSE;
}
/* Finish up any dynamic linking we may be doing. */
@@ -3991,7 +4034,7 @@ NAME(aout,final_link) (abfd, info, callback)
goto error_return;
}
- return true;
+ return TRUE;
error_return:
if (aout_info.contents != NULL)
@@ -4004,12 +4047,12 @@ NAME(aout,final_link) (abfd, info, callback)
free (aout_info.output_syms);
if (includes_hash_initialized)
bfd_hash_table_free (&aout_info.includes.root);
- return false;
+ return FALSE;
}
/* Link an a.out input BFD into the output file. */
-static boolean
+static bfd_boolean
aout_link_input_bfd (finfo, input_bfd)
struct aout_final_link_info *finfo;
bfd *input_bfd;
@@ -4027,16 +4070,16 @@ aout_link_input_bfd (finfo, input_bfd)
}
/* Get the symbols. We probably have them already, unless
- finfo->info->keep_memory is false. */
+ finfo->info->keep_memory is FALSE. */
if (! aout_get_external_symbols (input_bfd))
- return false;
+ 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;
+ return FALSE;
/* Relocate and write out the sections. These functions use the
symbol map created by aout_link_write_symbols. The linker_mark
@@ -4048,7 +4091,7 @@ aout_link_input_bfd (finfo, input_bfd)
obj_textsec (input_bfd),
&finfo->treloff,
exec_hdr (input_bfd)->a_trsize))
- return false;
+ return FALSE;
}
if (obj_datasec (input_bfd)->linker_mark)
{
@@ -4056,7 +4099,7 @@ aout_link_input_bfd (finfo, input_bfd)
obj_datasec (input_bfd),
&finfo->dreloff,
exec_hdr (input_bfd)->a_drsize))
- return false;
+ return FALSE;
}
/* If we are not keeping memory, we don't need the symbols any
@@ -4065,16 +4108,16 @@ aout_link_input_bfd (finfo, input_bfd)
if (! finfo->info->keep_memory)
{
if (! aout_link_free_symbols (input_bfd))
- return false;
+ return FALSE;
}
- return true;
+ return TRUE;
}
/* Adjust and write out the symbols for an a.out file. Set the new
symbol indices into a symbol_map. */
-static boolean
+static bfd_boolean
aout_link_write_symbols (finfo, input_bfd)
struct aout_final_link_info *finfo;
bfd *input_bfd;
@@ -4090,8 +4133,8 @@ aout_link_write_symbols (finfo, input_bfd)
struct external_nlist *sym_end;
struct aout_link_hash_entry **sym_hash;
int *symbol_map;
- boolean pass;
- boolean skip_next;
+ bfd_boolean pass;
+ bfd_boolean skip_next;
output_bfd = finfo->output_bfd;
sym_count = obj_aout_external_sym_count (input_bfd);
@@ -4105,16 +4148,16 @@ aout_link_write_symbols (finfo, input_bfd)
if (strip != strip_all
&& (strip != strip_some
|| bfd_hash_lookup (finfo->info->keep_hash, input_bfd->filename,
- false, false) != NULL)
+ 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);
+ input_bfd->filename, FALSE);
if (strtab_index == (bfd_size_type) -1)
- return false;
+ return FALSE;
PUT_WORD (output_bfd, strtab_index, outsym->e_strx);
PUT_WORD (output_bfd,
(bfd_get_section_vma (output_bfd,
@@ -4125,8 +4168,8 @@ aout_link_write_symbols (finfo, input_bfd)
++outsym;
}
- pass = false;
- skip_next = false;
+ 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);
@@ -4137,10 +4180,10 @@ aout_link_write_symbols (finfo, input_bfd)
const char *name;
int type;
struct aout_link_hash_entry *h;
- boolean skip;
+ bfd_boolean skip;
asection *symsec;
bfd_vma val = 0;
- boolean copy;
+ 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
@@ -4164,14 +4207,14 @@ aout_link_write_symbols (finfo, input_bfd)
/* Pass this symbol through. It is the target of an
indirect or warning symbol. */
val = GET_WORD (input_bfd, sym->e_value);
- pass = false;
+ 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;
+ skip_next = FALSE;
continue;
}
else
@@ -4213,34 +4256,34 @@ aout_link_write_symbols (finfo, input_bfd)
{
if ((type & N_TYPE) == N_INDR
|| type == N_WARNING)
- skip_next = true;
+ skip_next = TRUE;
*symbol_map = h->indx;
continue;
}
/* See if we are stripping this symbol. */
- skip = false;
+ skip = FALSE;
switch (strip)
{
case strip_none:
break;
case strip_debugger:
if ((type & N_STAB) != 0)
- skip = true;
+ skip = TRUE;
break;
case strip_some:
- if (bfd_hash_lookup (finfo->info->keep_hash, name, false, false)
+ if (bfd_hash_lookup (finfo->info->keep_hash, name, FALSE, FALSE)
== NULL)
- skip = true;
+ skip = TRUE;
break;
case strip_all:
- skip = true;
+ skip = TRUE;
break;
}
if (skip)
{
if (h != (struct aout_link_hash_entry *) NULL)
- h->written = true;
+ h->written = TRUE;
continue;
}
@@ -4269,7 +4312,7 @@ aout_link_write_symbols (finfo, input_bfd)
the indirect symbol was defined, we output it with
the correct definition so the debugger will
understand it. */
- pass = true;
+ pass = TRUE;
val = GET_WORD (input_bfd, sym->e_value);
symsec = NULL;
}
@@ -4285,7 +4328,7 @@ aout_link_write_symbols (finfo, input_bfd)
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;
+ skip_next = TRUE;
symsec = NULL;
@@ -4377,7 +4420,7 @@ aout_link_write_symbols (finfo, input_bfd)
it is a local symbol see if we should discard it. */
if (h != (struct aout_link_hash_entry *) NULL)
{
- h->written = true;
+ h->written = TRUE;
h->indx = obj_aout_external_sym_count (output_bfd);
}
else if ((type & N_TYPE) != N_SETT
@@ -4393,15 +4436,15 @@ aout_link_write_symbols (finfo, input_bfd)
case discard_l:
if ((type & N_STAB) == 0
&& bfd_is_local_label_name (input_bfd, name))
- skip = true;
+ skip = TRUE;
break;
case discard_all:
- skip = true;
+ skip = TRUE;
break;
}
if (skip)
{
- pass = false;
+ pass = FALSE;
continue;
}
}
@@ -4457,11 +4500,11 @@ aout_link_write_symbols (finfo, input_bfd)
/* If we have already included a header file with the
same value, then replace this one with an N_EXCL
symbol. */
- copy = (boolean) (! finfo->info->keep_memory);
+ copy = (bfd_boolean) (! finfo->info->keep_memory);
incl_entry = aout_link_includes_lookup (&finfo->includes,
- name, true, copy);
+ name, TRUE, copy);
if (incl_entry == NULL)
- return false;
+ return FALSE;
for (t = incl_entry->totals; t != NULL; t = t->next)
if (t->total == val)
break;
@@ -4473,7 +4516,7 @@ aout_link_write_symbols (finfo, input_bfd)
bfd_hash_allocate (&finfo->includes.root,
sizeof *t));
if (t == NULL)
- return false;
+ return FALSE;
t->total = val;
t->next = incl_entry->totals;
incl_entry->totals = t;
@@ -4518,7 +4561,7 @@ aout_link_write_symbols (finfo, input_bfd)
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;
+ copy = FALSE;
if (! finfo->info->keep_memory)
{
/* name points into a string table which we are going to
@@ -4527,12 +4570,12 @@ aout_link_write_symbols (finfo, input_bfd)
if (h != (struct aout_link_hash_entry *) NULL)
name = h->root.root.string;
else
- copy = true;
+ copy = TRUE;
}
strtab_index = add_to_stringtab (output_bfd, finfo->strtab,
name, copy);
if (strtab_index == (bfd_size_type) -1)
- return false;
+ 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);
@@ -4546,22 +4589,22 @@ aout_link_write_symbols (finfo, input_bfd)
bfd_size_type outsym_size;
if (bfd_seek (output_bfd, finfo->symoff, SEEK_SET) != 0)
- return false;
+ 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;
+ return FALSE;
finfo->symoff += outsym_size;
}
- return true;
+ return TRUE;
}
/* Write out a symbol that was not associated with an a.out input
object. */
-static boolean
+static bfd_boolean
aout_link_write_other_symbol (h, data)
struct aout_link_hash_entry *h;
PTR data;
@@ -4578,7 +4621,7 @@ aout_link_write_other_symbol (h, data)
{
h = (struct aout_link_hash_entry *) h->root.u.i.link;
if (h->root.type == bfd_link_hash_new)
- return true;
+ return TRUE;
}
output_bfd = finfo->output_bfd;
@@ -4594,17 +4637,17 @@ aout_link_write_other_symbol (h, data)
}
if (h->written)
- return true;
+ return TRUE;
- h->written = true;
+ h->written = TRUE;
/* An indx of -2 means the symbol must be written. */
if (h->indx != -2
&& (finfo->info->strip == strip_all
|| (finfo->info->strip == strip_some
&& bfd_hash_lookup (finfo->info->keep_hash, h->root.root.string,
- false, false) == NULL)))
- return true;
+ FALSE, FALSE) == NULL)))
+ return TRUE;
switch (h->root.type)
{
@@ -4612,11 +4655,11 @@ aout_link_write_other_symbol (h, data)
case bfd_link_hash_warning:
abort ();
/* Avoid variable not initialized warnings. */
- return true;
+ return TRUE;
case bfd_link_hash_new:
/* This can happen for set symbols when sets are not being
built. */
- return true;
+ return TRUE;
case bfd_link_hash_undefined:
type = N_UNDF | N_EXT;
val = 0;
@@ -4653,14 +4696,14 @@ aout_link_write_other_symbol (h, data)
case bfd_link_hash_indirect:
/* We ignore these symbols, since the indirected symbol is
already in the hash table. */
- return true;
+ return TRUE;
}
H_PUT_8 (output_bfd, type, outsym.e_type);
H_PUT_8 (output_bfd, 0, outsym.e_other);
H_PUT_16 (output_bfd, 0, outsym.e_desc);
indx = add_to_stringtab (output_bfd, finfo->strtab, h->root.root.string,
- false);
+ FALSE);
if (indx == - (bfd_size_type) 1)
{
/* FIXME: No way to handle errors. */
@@ -4681,12 +4724,12 @@ aout_link_write_other_symbol (h, data)
h->indx = obj_aout_external_sym_count (output_bfd);
++obj_aout_external_sym_count (output_bfd);
- return true;
+ return TRUE;
}
/* Link an a.out section into the output file. */
-static boolean
+static bfd_boolean
aout_link_input_section (finfo, input_bfd, input_section, reloff_ptr,
rel_size)
struct aout_final_link_info *finfo;
@@ -4703,7 +4746,7 @@ aout_link_input_section (finfo, input_bfd, input_section, reloff_ptr,
if (! bfd_get_section_contents (input_bfd, input_section,
(PTR) finfo->contents,
(file_ptr) 0, input_size))
- return false;
+ return FALSE;
/* Read in the relocs if we haven't already done it. */
if (aout_section_data (input_section) != NULL
@@ -4716,7 +4759,7 @@ aout_link_input_section (finfo, input_bfd, input_section, reloff_ptr,
{
if (bfd_seek (input_bfd, input_section->rel_filepos, SEEK_SET) != 0
|| bfd_bread (relocs, rel_size, input_bfd) != rel_size)
- return false;
+ return FALSE;
}
}
@@ -4726,14 +4769,14 @@ aout_link_input_section (finfo, input_bfd, input_section, reloff_ptr,
if (! aout_link_input_section_std (finfo, input_bfd, input_section,
(struct reloc_std_external *) relocs,
rel_size, finfo->contents))
- return false;
+ 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;
+ return FALSE;
}
/* Write out the section contents. */
@@ -4742,16 +4785,16 @@ aout_link_input_section (finfo, input_bfd, input_section, reloff_ptr,
(PTR) finfo->contents,
(file_ptr) input_section->output_offset,
input_size))
- return false;
+ return FALSE;
- /* If we are producing relocateable output, the relocs were
+ /* If we are producing relocatable output, the relocs were
modified, and we now write them out. */
- if (finfo->info->relocateable && rel_size > 0)
+ if (finfo->info->relocatable && rel_size > 0)
{
if (bfd_seek (finfo->output_bfd, *reloff_ptr, SEEK_SET) != 0)
- return false;
+ return FALSE;
if (bfd_bwrite (relocs, rel_size, finfo->output_bfd) != rel_size)
- return false;
+ return FALSE;
*reloff_ptr += rel_size;
/* Assert that the relocs have not run into the symbols, and
@@ -4763,7 +4806,7 @@ aout_link_input_section (finfo, input_bfd, input_section, reloff_ptr,
<= obj_datasec (finfo->output_bfd)->rel_filepos)));
}
- return true;
+ return TRUE;
}
/* Get the section corresponding to a reloc index. */
@@ -4793,7 +4836,7 @@ aout_reloc_index_to_section (abfd, indx)
/* Relocate an a.out section using standard a.out relocs. */
-static boolean
+static bfd_boolean
aout_link_input_section_std (finfo, input_bfd, input_section, relocs,
rel_size, contents)
struct aout_final_link_info *finfo;
@@ -4803,13 +4846,12 @@ aout_link_input_section_std (finfo, input_bfd, input_section, relocs,
bfd_size_type rel_size;
bfd_byte *contents;
{
- boolean (*check_dynamic_reloc) PARAMS ((struct bfd_link_info *,
- bfd *, asection *,
- struct aout_link_hash_entry *,
- PTR, bfd_byte *, boolean *,
- bfd_vma *));
+ bfd_boolean (*check_dynamic_reloc)
+ PARAMS ((struct bfd_link_info *, bfd *, asection *,
+ struct aout_link_hash_entry *, PTR, bfd_byte *, bfd_boolean *,
+ bfd_vma *));
bfd *output_bfd;
- boolean relocateable;
+ bfd_boolean relocatable;
struct external_nlist *syms;
char *strings;
struct aout_link_hash_entry **sym_hashes;
@@ -4825,7 +4867,7 @@ aout_link_input_section_std (finfo, input_bfd, input_section, relocs,
BFD_ASSERT (input_bfd->xvec->header_byteorder
== output_bfd->xvec->header_byteorder);
- relocateable = finfo->info->relocateable;
+ relocatable = finfo->info->relocatable;
syms = obj_aout_external_syms (input_bfd);
strings = obj_aout_external_strings (input_bfd);
sym_hashes = obj_aout_sym_hashes (input_bfd);
@@ -4894,9 +4936,9 @@ aout_link_input_section_std (finfo, input_bfd, input_section, relocs,
}
#endif
- if (relocateable)
+ if (relocatable)
{
- /* We are generating a relocateable output file, and must
+ /* We are generating a relocatable output file, and must
modify the reloc accordingly. */
if (r_extern)
{
@@ -4951,10 +4993,10 @@ aout_link_input_section_std (finfo, input_bfd, input_section, relocs,
if (h->indx < 0)
{
h->indx = -2;
- h->written = false;
+ h->written = FALSE;
if (! aout_link_write_other_symbol (h,
(PTR) finfo))
- return false;
+ return FALSE;
}
r_index = h->indx;
}
@@ -4967,7 +5009,7 @@ aout_link_input_section_std (finfo, input_bfd, input_section, relocs,
if (! ((*finfo->info->callbacks->unattached_reloc)
(finfo->info, name, input_bfd, input_section,
r_addr)))
- return false;
+ return FALSE;
r_index = 0;
}
}
@@ -5027,11 +5069,11 @@ aout_link_input_section_std (finfo, input_bfd, input_section, relocs,
}
else
{
- boolean hundef;
+ bfd_boolean hundef;
/* We are generating an executable, and must do a full
relocation. */
- hundef = false;
+ hundef = FALSE;
if (r_extern)
{
@@ -5050,7 +5092,7 @@ aout_link_input_section_std (finfo, input_bfd, input_section, relocs,
relocation = 0;
else
{
- hundef = true;
+ hundef = TRUE;
relocation = 0;
}
}
@@ -5068,12 +5110,12 @@ aout_link_input_section_std (finfo, input_bfd, input_section, relocs,
if (check_dynamic_reloc != NULL)
{
- boolean skip;
+ bfd_boolean skip;
if (! ((*check_dynamic_reloc)
(finfo->info, input_bfd, input_section, h,
(PTR) rel, contents, &skip, &relocation)))
- return false;
+ return FALSE;
if (skip)
continue;
}
@@ -5091,8 +5133,8 @@ aout_link_input_section_std (finfo, input_bfd, input_section, relocs,
name = strings + GET_WORD (input_bfd, syms[r_index].e_strx);
if (! ((*finfo->info->callbacks->undefined_symbol)
(finfo->info, name, input_bfd, input_section,
- r_addr, true)))
- return false;
+ r_addr, TRUE)))
+ return FALSE;
}
r = MY_final_link_relocate (howto,
@@ -5127,19 +5169,19 @@ aout_link_input_section_std (finfo, input_bfd, input_section, relocs,
if (! ((*finfo->info->callbacks->reloc_overflow)
(finfo->info, name, howto->name,
(bfd_vma) 0, input_bfd, input_section, r_addr)))
- return false;
+ return FALSE;
}
break;
}
}
}
- return true;
+ return TRUE;
}
/* Relocate an a.out section using extended a.out relocs. */
-static boolean
+static bfd_boolean
aout_link_input_section_ext (finfo, input_bfd, input_section, relocs,
rel_size, contents)
struct aout_final_link_info *finfo;
@@ -5149,13 +5191,12 @@ aout_link_input_section_ext (finfo, input_bfd, input_section, relocs,
bfd_size_type rel_size;
bfd_byte *contents;
{
- boolean (*check_dynamic_reloc) PARAMS ((struct bfd_link_info *,
- bfd *, asection *,
- struct aout_link_hash_entry *,
- PTR, bfd_byte *, boolean *,
- bfd_vma *));
+ bfd_boolean (*check_dynamic_reloc)
+ PARAMS ((struct bfd_link_info *, bfd *, asection *,
+ struct aout_link_hash_entry *, PTR, bfd_byte *, bfd_boolean *,
+ bfd_vma *));
bfd *output_bfd;
- boolean relocateable;
+ bfd_boolean relocatable;
struct external_nlist *syms;
char *strings;
struct aout_link_hash_entry **sym_hashes;
@@ -5171,7 +5212,7 @@ aout_link_input_section_ext (finfo, input_bfd, input_section, relocs,
BFD_ASSERT (input_bfd->xvec->header_byteorder
== output_bfd->xvec->header_byteorder);
- relocateable = finfo->info->relocateable;
+ relocatable = finfo->info->relocatable;
syms = obj_aout_external_syms (input_bfd);
strings = obj_aout_external_strings (input_bfd);
sym_hashes = obj_aout_sym_hashes (input_bfd);
@@ -5216,9 +5257,9 @@ aout_link_input_section_ext (finfo, input_bfd, input_section, relocs,
BFD_ASSERT (r_type < TABLE_SIZE (howto_table_ext));
- if (relocateable)
+ if (relocatable)
{
- /* We are generating a relocateable output file, and must
+ /* We are generating a relocatable output file, and must
modify the reloc accordingly. */
if (r_extern
|| r_type == (unsigned int) RELOC_BASE10
@@ -5289,10 +5330,10 @@ aout_link_input_section_ext (finfo, input_bfd, input_section, relocs,
if (h->indx < 0)
{
h->indx = -2;
- h->written = false;
+ h->written = FALSE;
if (! aout_link_write_other_symbol (h,
(PTR) finfo))
- return false;
+ return FALSE;
}
r_index = h->indx;
}
@@ -5305,7 +5346,7 @@ aout_link_input_section_ext (finfo, input_bfd, input_section, relocs,
if (! ((*finfo->info->callbacks->unattached_reloc)
(finfo->info, name, input_bfd, input_section,
r_addr)))
- return false;
+ return FALSE;
r_index = 0;
}
}
@@ -5370,12 +5411,12 @@ aout_link_input_section_ext (finfo, input_bfd, input_section, relocs,
}
else
{
- boolean hundef;
+ bfd_boolean hundef;
bfd_reloc_status_type r;
/* We are generating an executable, and must do a full
relocation. */
- hundef = false;
+ hundef = FALSE;
if (r_extern)
{
@@ -5394,7 +5435,7 @@ aout_link_input_section_ext (finfo, input_bfd, input_section, relocs,
relocation = 0;
else
{
- hundef = true;
+ hundef = TRUE;
relocation = 0;
}
}
@@ -5467,12 +5508,12 @@ aout_link_input_section_ext (finfo, input_bfd, input_section, relocs,
if (check_dynamic_reloc != NULL)
{
- boolean skip;
+ bfd_boolean skip;
if (! ((*check_dynamic_reloc)
(finfo->info, input_bfd, input_section, h,
(PTR) rel, contents, &skip, &relocation)))
- return false;
+ return FALSE;
if (skip)
continue;
}
@@ -5494,8 +5535,8 @@ aout_link_input_section_ext (finfo, input_bfd, input_section, relocs,
name = strings + GET_WORD (input_bfd, syms[r_index].e_strx);
if (! ((*finfo->info->callbacks->undefined_symbol)
(finfo->info, name, input_bfd, input_section,
- r_addr, true)))
- return false;
+ r_addr, TRUE)))
+ return FALSE;
}
if (r_type != (unsigned int) RELOC_SPARC_REV32)
@@ -5542,7 +5583,7 @@ aout_link_input_section_ext (finfo, input_bfd, input_section, relocs,
if (! ((*finfo->info->callbacks->reloc_overflow)
(finfo->info, name, howto_table_ext[r_type].name,
r_addend, input_bfd, input_section, r_addr)))
- return false;
+ return FALSE;
}
break;
}
@@ -5550,12 +5591,12 @@ aout_link_input_section_ext (finfo, input_bfd, input_section, relocs,
}
}
- return true;
+ return TRUE;
}
/* Handle a link order which is supposed to generate a reloc. */
-static boolean
+static bfd_boolean
aout_link_reloc_link_order (finfo, o, p)
struct aout_final_link_info *finfo;
asection *o;
@@ -5592,7 +5633,7 @@ aout_link_reloc_link_order (finfo, o, p)
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));
+ pr->u.name, FALSE, FALSE, TRUE));
if (h != (struct aout_link_hash_entry *) NULL
&& h->indx >= 0)
r_index = h->indx;
@@ -5603,9 +5644,9 @@ aout_link_reloc_link_order (finfo, o, p)
here. I don't think that will ever matter for a global
symbol. */
h->indx = -2;
- h->written = false;
+ h->written = FALSE;
if (! aout_link_write_other_symbol (h, (PTR) finfo))
- return false;
+ return FALSE;
r_index = h->indx;
}
else
@@ -5613,7 +5654,7 @@ aout_link_reloc_link_order (finfo, o, p)
if (! ((*finfo->info->callbacks->unattached_reloc)
(finfo->info, pr->u.name, (bfd *) NULL,
(asection *) NULL, (bfd_vma) 0)))
- return false;
+ return FALSE;
r_index = 0;
}
}
@@ -5622,7 +5663,7 @@ aout_link_reloc_link_order (finfo, o, p)
if (howto == 0)
{
bfd_set_error (bfd_error_bad_value);
- return false;
+ return FALSE;
}
if (o == obj_textsec (finfo->output_bfd))
@@ -5692,12 +5733,12 @@ aout_link_reloc_link_order (finfo, o, p)
bfd_size_type size;
bfd_reloc_status_type r;
bfd_byte *buf;
- boolean ok;
+ bfd_boolean ok;
size = bfd_get_reloc_size (howto);
buf = (bfd_byte *) bfd_zmalloc (size);
if (buf == (bfd_byte *) NULL)
- return false;
+ return FALSE;
r = MY_relocate_contents (howto, finfo->output_bfd,
(bfd_vma) pr->addend, buf);
switch (r)
@@ -5718,7 +5759,7 @@ aout_link_reloc_link_order (finfo, o, p)
(asection *) NULL, (bfd_vma) 0)))
{
free (buf);
- return false;
+ return FALSE;
}
break;
}
@@ -5726,7 +5767,7 @@ aout_link_reloc_link_order (finfo, o, p)
(file_ptr) p->offset, size);
free (buf);
if (! ok)
- return false;
+ return FALSE;
}
}
else
@@ -5765,7 +5806,7 @@ aout_link_reloc_link_order (finfo, o, p)
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;
+ return FALSE;
*reloff_ptr += obj_reloc_entry_size (finfo->output_bfd);
@@ -5776,5 +5817,5 @@ aout_link_reloc_link_order (finfo, o, p)
|| (*reloff_ptr
<= obj_datasec (finfo->output_bfd)->rel_filepos)));
- return true;
+ return TRUE;
}
diff --git a/contrib/binutils/bfd/archive.c b/contrib/binutils/bfd/archive.c
index b051e2a..ba6e684 100644
--- a/contrib/binutils/bfd/archive.c
+++ b/contrib/binutils/bfd/archive.c
@@ -1,6 +1,6 @@
/* BFD back-end for archive files (libraries).
Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
- 2000, 2001, 2002
+ 2000, 2001, 2002, 2003
Free Software Foundation, Inc.
Written by Cygnus Support. Mostly Gumby Henkel-Wallace's fault.
@@ -158,27 +158,17 @@ struct ar_cache {
#define ar_maxnamelen(abfd) ((abfd)->xvec->ar_max_namelen)
#define arch_eltdata(bfd) ((struct areltdata *) ((bfd)->arelt_data))
-#define arch_hdr(bfd) ((struct ar_hdr *)arch_eltdata(bfd)->arch_header)
-
-static char *get_extended_arelt_filename PARAMS ((bfd *arch,
- const char *name));
-static boolean do_slurp_bsd_armap PARAMS ((bfd *abfd));
-static boolean do_slurp_coff_armap PARAMS ((bfd *abfd));
-boolean bfd_elf64_archive_slurp_armap PARAMS ((bfd *abfd));
-static const char *normalize PARAMS ((bfd *, const char *file));
-static struct areltdata *bfd_ar_hdr_from_filesystem PARAMS ((bfd *abfd,
- const char *,
- bfd *member));
+#define arch_hdr(bfd) ((struct ar_hdr *) arch_eltdata(bfd)->arch_header)
+
-boolean
-_bfd_generic_mkarchive (abfd)
- bfd *abfd;
+bfd_boolean
+_bfd_generic_mkarchive (bfd *abfd)
{
bfd_size_type amt = sizeof (struct artdata);
- abfd->tdata.aout_ar_data = (struct artdata *) bfd_zalloc (abfd, amt);
+ abfd->tdata.aout_ar_data = bfd_zalloc (abfd, amt);
if (bfd_ardata (abfd) == NULL)
- return false;
+ return FALSE;
bfd_ardata (abfd)->cache = NULL;
bfd_ardata (abfd)->archive_head = NULL;
@@ -186,7 +176,7 @@ _bfd_generic_mkarchive (abfd)
bfd_ardata (abfd)->extended_names = NULL;
bfd_ardata (abfd)->tdata = NULL;
- return true;
+ return TRUE;
}
/*
@@ -194,7 +184,8 @@ FUNCTION
bfd_get_next_mapent
SYNOPSIS
- symindex bfd_get_next_mapent(bfd *abfd, symindex previous, carsym **sym);
+ symindex bfd_get_next_mapent
+ (bfd *abfd, symindex previous, carsym **sym);
DESCRIPTION
Step through archive @var{abfd}'s symbol table (if it
@@ -211,10 +202,7 @@ DESCRIPTION
*/
symindex
-bfd_get_next_mapent (abfd, prev, entry)
- bfd *abfd;
- symindex prev;
- carsym **entry;
+bfd_get_next_mapent (bfd *abfd, symindex prev, carsym **entry)
{
if (!bfd_has_map (abfd))
{
@@ -236,8 +224,7 @@ bfd_get_next_mapent (abfd, prev, entry)
/* To be called by backends only */
bfd *
-_bfd_create_empty_archive_element_shell (obfd)
- bfd *obfd;
+_bfd_create_empty_archive_element_shell (bfd *obfd)
{
return _bfd_new_bfd_contained_in (obfd);
}
@@ -247,27 +234,22 @@ FUNCTION
bfd_set_archive_head
SYNOPSIS
- boolean bfd_set_archive_head(bfd *output, bfd *new_head);
+ bfd_boolean bfd_set_archive_head (bfd *output, bfd *new_head);
DESCRIPTION
Set the head of the chain of
BFDs contained in the archive @var{output} to @var{new_head}.
*/
-boolean
-bfd_set_archive_head (output_archive, new_head)
- bfd *output_archive;
- bfd *new_head;
+bfd_boolean
+bfd_set_archive_head (bfd *output_archive, bfd *new_head)
{
-
output_archive->archive_head = new_head;
- return true;
+ return TRUE;
}
bfd *
-_bfd_look_for_bfd_in_cache (arch_bfd, filepos)
- bfd *arch_bfd;
- file_ptr filepos;
+_bfd_look_for_bfd_in_cache (bfd *arch_bfd, file_ptr filepos)
{
struct ar_cache *current;
@@ -280,20 +262,18 @@ _bfd_look_for_bfd_in_cache (arch_bfd, filepos)
}
/* Kind of stupid to call cons for each one, but we don't do too many */
-boolean
-_bfd_add_bfd_to_archive_cache (arch_bfd, filepos, new_elt)
- bfd *arch_bfd, *new_elt;
- file_ptr filepos;
+bfd_boolean
+_bfd_add_bfd_to_archive_cache (bfd *arch_bfd, file_ptr filepos, bfd *new_elt)
{
bfd_size_type amt = sizeof (struct ar_cache);
- struct ar_cache *new_cache = (struct ar_cache *) bfd_zalloc (arch_bfd, amt);
+ struct ar_cache *new_cache = bfd_zalloc (arch_bfd, amt);
if (new_cache == NULL)
- return false;
+ return FALSE;
new_cache->ptr = filepos;
new_cache->arelt = new_elt;
- new_cache->next = (struct ar_cache *) NULL;
+ new_cache->next = NULL;
if (bfd_ardata (arch_bfd)->cache == NULL)
bfd_ardata (arch_bfd)->cache = new_cache;
else
@@ -305,16 +285,14 @@ _bfd_add_bfd_to_archive_cache (arch_bfd, filepos, new_elt)
current->next = new_cache;
}
- return true;
+ return TRUE;
}
/* The name begins with space. Hence the rest of the name is an index into
the string table. */
static char *
-get_extended_arelt_filename (arch, name)
- bfd *arch;
- const char *name;
+get_extended_arelt_filename (bfd *arch, const char *name)
{
unsigned long index = 0;
@@ -341,20 +319,17 @@ get_extended_arelt_filename (arch, name)
could have been moved arbitrarily.
*/
-PTR
-_bfd_generic_read_ar_hdr (abfd)
- bfd *abfd;
+void *
+_bfd_generic_read_ar_hdr (bfd *abfd)
{
- return _bfd_generic_read_ar_hdr_mag (abfd, (const char *) NULL);
+ return _bfd_generic_read_ar_hdr_mag (abfd, NULL);
}
/* Alpha ECOFF uses an optional different ARFMAG value, so we have a
variant of _bfd_generic_read_ar_hdr which accepts a magic string. */
-PTR
-_bfd_generic_read_ar_hdr_mag (abfd, mag)
- bfd *abfd;
- const char *mag;
+void *
+_bfd_generic_read_ar_hdr_mag (bfd *abfd, const char *mag)
{
struct ar_hdr hdr;
char *hdrp = (char *) &hdr;
@@ -365,8 +340,7 @@ _bfd_generic_read_ar_hdr_mag (abfd, mag)
bfd_size_type allocsize = sizeof (struct areltdata) + sizeof (struct ar_hdr);
char *allocptr = 0;
- if (bfd_bread ((PTR) hdrp, (bfd_size_type) sizeof (struct ar_hdr), abfd)
- != sizeof (struct ar_hdr))
+ if (bfd_bread (hdrp, sizeof (struct ar_hdr), abfd) != sizeof (struct ar_hdr))
{
if (bfd_get_error () != bfd_error_system_call)
bfd_set_error (bfd_error_no_more_archived_files);
@@ -436,12 +410,12 @@ _bfd_generic_read_ar_hdr_mag (abfd, mag)
spaces, so only look for ' ' if we don't find '/'. */
char *e;
- e = (char *) memchr (hdr.ar_name, '\0', ar_maxnamelen (abfd));
+ e = memchr (hdr.ar_name, '\0', ar_maxnamelen (abfd));
if (e == NULL)
{
- e = (char *) memchr (hdr.ar_name, '/', ar_maxnamelen (abfd));
+ e = memchr (hdr.ar_name, '/', ar_maxnamelen (abfd));
if (e == NULL)
- e = (char *) memchr (hdr.ar_name, ' ', ar_maxnamelen (abfd));
+ e = memchr (hdr.ar_name, ' ', ar_maxnamelen (abfd));
}
if (e != NULL)
@@ -466,7 +440,7 @@ _bfd_generic_read_ar_hdr_mag (abfd, mag)
ared = (struct areltdata *) allocptr;
ared->arch_header = allocptr + sizeof (struct areltdata);
- memcpy ((char *) ared->arch_header, (char *) &hdr, sizeof (struct ar_hdr));
+ memcpy (ared->arch_header, &hdr, sizeof (struct ar_hdr));
ared->parsed_size = parsed_size;
if (filename != NULL)
@@ -476,11 +450,11 @@ _bfd_generic_read_ar_hdr_mag (abfd, mag)
ared->filename = allocptr + (sizeof (struct areltdata) +
sizeof (struct ar_hdr));
if (namelen)
- memcpy (ared->filename, hdr.ar_name, (size_t) namelen);
+ memcpy (ared->filename, hdr.ar_name, namelen);
ared->filename[namelen] = '\0';
}
- return (PTR) ared;
+ return ared;
}
/* This is an internal function; it's mainly used when indexing
@@ -488,9 +462,7 @@ _bfd_generic_read_ar_hdr_mag (abfd, mag)
element, since it handles the bookkeeping so nicely for us. */
bfd *
-_bfd_get_elt_at_filepos (archive, filepos)
- bfd *archive;
- file_ptr filepos;
+_bfd_get_elt_at_filepos (bfd *archive, file_ptr filepos)
{
struct areltdata *new_areldata;
bfd *n_nfd;
@@ -502,26 +474,26 @@ _bfd_get_elt_at_filepos (archive, filepos)
if (0 > bfd_seek (archive, filepos, SEEK_SET))
return NULL;
- if ((new_areldata = (struct areltdata *) _bfd_read_ar_hdr (archive)) == NULL)
+ if ((new_areldata = _bfd_read_ar_hdr (archive)) == NULL)
return NULL;
n_nfd = _bfd_create_empty_archive_element_shell (archive);
if (n_nfd == NULL)
{
- bfd_release (archive, (PTR) new_areldata);
+ bfd_release (archive, new_areldata);
return NULL;
}
n_nfd->origin = bfd_tell (archive);
- n_nfd->arelt_data = (PTR) new_areldata;
+ n_nfd->arelt_data = new_areldata;
n_nfd->filename = new_areldata->filename;
if (_bfd_add_bfd_to_archive_cache (archive, filepos, n_nfd))
return n_nfd;
/* Huh? */
- bfd_release (archive, (PTR) n_nfd);
- bfd_release (archive, (PTR) new_areldata);
+ bfd_release (archive, n_nfd);
+ bfd_release (archive, new_areldata);
return NULL;
}
@@ -529,9 +501,7 @@ _bfd_get_elt_at_filepos (archive, filepos)
INDEX. INDEX should have been returned by bfd_get_next_mapent. */
bfd *
-_bfd_generic_get_elt_at_index (abfd, index)
- bfd *abfd;
- symindex index;
+_bfd_generic_get_elt_at_index (bfd *abfd, symindex index)
{
carsym *entry;
@@ -544,7 +514,7 @@ FUNCTION
bfd_openr_next_archived_file
SYNOPSIS
- bfd *bfd_openr_next_archived_file(bfd *archive, bfd *previous);
+ bfd *bfd_openr_next_archived_file (bfd *archive, bfd *previous);
DESCRIPTION
Provided a BFD, @var{archive}, containing an archive and NULL, open
@@ -556,9 +526,7 @@ DESCRIPTION
*/
bfd *
-bfd_openr_next_archived_file (archive, last_file)
- bfd *archive;
- bfd *last_file;
+bfd_openr_next_archived_file (bfd *archive, bfd *last_file)
{
if ((bfd_get_format (archive) != bfd_archive) ||
(archive->direction == write_direction))
@@ -568,15 +536,11 @@ bfd_openr_next_archived_file (archive, last_file)
}
return BFD_SEND (archive,
- openr_next_archived_file,
- (archive,
- last_file));
+ openr_next_archived_file, (archive, last_file));
}
bfd *
-bfd_generic_openr_next_archived_file (archive, last_file)
- bfd *archive;
- bfd *last_file;
+bfd_generic_openr_next_archived_file (bfd *archive, bfd *last_file)
{
file_ptr filestart;
@@ -596,14 +560,13 @@ bfd_generic_openr_next_archived_file (archive, last_file)
}
const bfd_target *
-bfd_generic_archive_p (abfd)
- bfd *abfd;
+bfd_generic_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 (armag, SARMAG, abfd) != SARMAG)
{
if (bfd_get_error () != bfd_error_system_call)
bfd_set_error (bfd_error_wrong_format);
@@ -622,7 +585,7 @@ bfd_generic_archive_p (abfd)
tdata_hold = bfd_ardata (abfd);
amt = sizeof (struct artdata);
- bfd_ardata (abfd) = (struct artdata *) bfd_zalloc (abfd, amt);
+ bfd_ardata (abfd) = bfd_zalloc (abfd, amt);
if (bfd_ardata (abfd) == NULL)
{
bfd_ardata (abfd) = tdata_hold;
@@ -661,13 +624,13 @@ bfd_generic_archive_p (abfd)
normal archive, regardless of the format of the object files.
We do accept an empty archive. */
- first = bfd_openr_next_archived_file (abfd, (bfd *) NULL);
+ first = bfd_openr_next_archived_file (abfd, NULL);
if (first != NULL)
{
- boolean fail;
+ bfd_boolean fail;
- first->target_defaulted = false;
- fail = false;
+ first->target_defaulted = FALSE;
+ fail = FALSE;
if (bfd_check_format (first, bfd_object)
&& first->xvec != abfd->xvec)
{
@@ -676,7 +639,7 @@ bfd_generic_archive_p (abfd)
we have no way to remove it from the archive cache.
It's close to impossible to figure out when we can
release bfd_ardata. FIXME. */
- (void) bfd_close (first);
+ bfd_close (first);
bfd_release (abfd, bfd_ardata (abfd));
#endif
bfd_set_error (bfd_error_wrong_object_format);
@@ -707,11 +670,10 @@ bfd_generic_archive_p (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 boolean
-do_slurp_bsd_armap (abfd)
- bfd *abfd;
+static bfd_boolean
+do_slurp_bsd_armap (bfd *abfd)
{
struct areltdata *mapdata;
unsigned int counter;
@@ -721,23 +683,23 @@ do_slurp_bsd_armap (abfd)
bfd_size_type parsed_size, amt;
carsym *set;
- mapdata = (struct areltdata *) _bfd_read_ar_hdr (abfd);
+ mapdata = _bfd_read_ar_hdr (abfd);
if (mapdata == NULL)
- return false;
+ return FALSE;
parsed_size = mapdata->parsed_size;
- bfd_release (abfd, (PTR) mapdata); /* Don't need it any more. */
+ bfd_release (abfd, mapdata); /* Don't need it any more. */
- raw_armap = (bfd_byte *) bfd_zalloc (abfd, parsed_size);
- if (raw_armap == (bfd_byte *) NULL)
- return false;
+ raw_armap = bfd_zalloc (abfd, parsed_size);
+ if (raw_armap == NULL)
+ return FALSE;
- if (bfd_bread ((PTR) raw_armap, parsed_size, abfd) != parsed_size)
+ if (bfd_bread (raw_armap, parsed_size, abfd) != parsed_size)
{
if (bfd_get_error () != bfd_error_system_call)
bfd_set_error (bfd_error_malformed_archive);
byebye:
- bfd_release (abfd, (PTR) raw_armap);
- return false;
+ bfd_release (abfd, raw_armap);
+ return FALSE;
}
ardata->symdef_count = H_GET_32 (abfd, raw_armap) / BSD_SYMDEF_SIZE;
@@ -755,10 +717,10 @@ do_slurp_bsd_armap (abfd)
stringbase = ((char *) rbase
+ ardata->symdef_count * BSD_SYMDEF_SIZE
+ BSD_STRING_COUNT_SIZE);
- amt = (bfd_size_type) ardata->symdef_count * sizeof (carsym);
- ardata->symdefs = (carsym *) bfd_alloc (abfd, amt);
+ amt = ardata->symdef_count * sizeof (carsym);
+ ardata->symdefs = bfd_alloc (abfd, amt);
if (!ardata->symdefs)
- return false;
+ return FALSE;
for (counter = 0, set = ardata->symdefs;
counter < ardata->symdef_count;
@@ -774,15 +736,14 @@ do_slurp_bsd_armap (abfd)
/* FIXME, we should provide some way to free raw_ardata when
we are done using the strings from it. For now, it seems
to be allocated on an objalloc anyway... */
- bfd_has_map (abfd) = true;
- return true;
+ bfd_has_map (abfd) = TRUE;
+ return TRUE;
}
-/* Returns false on error, true otherwise. */
+/* Returns FALSE on error, TRUE otherwise. */
-static boolean
-do_slurp_coff_armap (abfd)
- bfd *abfd;
+static bfd_boolean
+do_slurp_coff_armap (bfd *abfd)
{
struct areltdata *mapdata;
int *raw_armap, *rawptr;
@@ -792,27 +753,27 @@ do_slurp_coff_armap (abfd)
unsigned int parsed_size;
carsym *carsyms;
bfd_size_type nsymz; /* Number of symbols in armap. */
- bfd_vma (*swap) PARAMS ((const bfd_byte *));
+ bfd_vma (*swap) (const void *);
char int_buf[sizeof (long)];
bfd_size_type carsym_size, ptrsize;
unsigned int i;
- mapdata = (struct areltdata *) _bfd_read_ar_hdr (abfd);
+ mapdata = _bfd_read_ar_hdr (abfd);
if (mapdata == NULL)
- return false;
+ return FALSE;
parsed_size = mapdata->parsed_size;
- bfd_release (abfd, (PTR) mapdata); /* Don't need it any more. */
+ bfd_release (abfd, mapdata); /* Don't need it any more. */
- if (bfd_bread ((PTR) int_buf, (bfd_size_type) 4, abfd) != 4)
+ if (bfd_bread (int_buf, 4, abfd) != 4)
{
if (bfd_get_error () != bfd_error_system_call)
bfd_set_error (bfd_error_malformed_archive);
- return false;
+ return FALSE;
}
/* It seems that all numeric information in a coff archive is always
in big endian format, nomatter the host or target. */
swap = bfd_getb32;
- nsymz = bfd_getb32 ((PTR) int_buf);
+ nsymz = bfd_getb32 (int_buf);
stringsize = parsed_size - (4 * nsymz) - 4;
#if 1
@@ -826,7 +787,7 @@ do_slurp_coff_armap (abfd)
&& bfd_get_flavour (abfd) == bfd_target_coff_flavour)
{
/* This looks dangerous, let's do it the other way around. */
- nsymz = bfd_getl32 ((PTR) int_buf);
+ nsymz = bfd_getl32 (int_buf);
stringsize = parsed_size - (4 * nsymz) - 4;
swap = bfd_getl32;
}
@@ -838,18 +799,18 @@ do_slurp_coff_armap (abfd)
carsym_size = (nsymz * sizeof (carsym));
ptrsize = (4 * nsymz);
- ardata->symdefs = (carsym *) bfd_zalloc (abfd, carsym_size + stringsize + 1);
+ ardata->symdefs = bfd_zalloc (abfd, carsym_size + stringsize + 1);
if (ardata->symdefs == NULL)
- return false;
+ return FALSE;
carsyms = ardata->symdefs;
stringbase = ((char *) ardata->symdefs) + carsym_size;
/* Allocate and read in the raw offsets. */
- raw_armap = (int *) bfd_alloc (abfd, ptrsize);
+ raw_armap = bfd_alloc (abfd, ptrsize);
if (raw_armap == NULL)
goto release_symdefs;
- if (bfd_bread ((PTR) raw_armap, ptrsize, abfd) != ptrsize
- || (bfd_bread ((PTR) stringbase, stringsize, abfd) != stringsize))
+ if (bfd_bread (raw_armap, ptrsize, abfd) != ptrsize
+ || (bfd_bread (stringbase, stringsize, abfd) != stringsize))
{
if (bfd_get_error () != bfd_error_system_call)
bfd_set_error (bfd_error_malformed_archive);
@@ -860,7 +821,7 @@ do_slurp_coff_armap (abfd)
for (i = 0; i < nsymz; i++)
{
rawptr = raw_armap + i;
- carsyms->file_offset = swap ((PTR) rawptr);
+ carsyms->file_offset = swap ((bfd_byte *) rawptr);
carsyms->name = stringbase;
stringbase += strlen (stringbase) + 1;
carsyms++;
@@ -872,15 +833,15 @@ do_slurp_coff_armap (abfd)
/* Pad to an even boundary if you have to. */
ardata->first_file_filepos += (ardata->first_file_filepos) % 2;
- bfd_has_map (abfd) = true;
- bfd_release (abfd, (PTR) raw_armap);
+ bfd_has_map (abfd) = TRUE;
+ bfd_release (abfd, raw_armap);
/* Check for a second archive header (as used by PE). */
{
struct areltdata *tmp;
bfd_seek (abfd, ardata->first_file_filepos, SEEK_SET);
- tmp = (struct areltdata *) _bfd_read_ar_hdr (abfd);
+ tmp = _bfd_read_ar_hdr (abfd);
if (tmp != NULL)
{
if (tmp->arch_header[0] == '/'
@@ -893,32 +854,31 @@ do_slurp_coff_armap (abfd)
}
}
- return true;
+ return TRUE;
release_raw_armap:
- bfd_release (abfd, (PTR) raw_armap);
+ bfd_release (abfd, raw_armap);
release_symdefs:
- bfd_release (abfd, (PTR) (ardata)->symdefs);
- return false;
+ bfd_release (abfd, (ardata)->symdefs);
+ return FALSE;
}
/* This routine can handle either coff-style or bsd-style armaps.
- Returns false on error, true otherwise */
+ Returns FALSE on error, TRUE otherwise */
-boolean
-bfd_slurp_armap (abfd)
- bfd *abfd;
+bfd_boolean
+bfd_slurp_armap (bfd *abfd)
{
char nextname[17];
- int i = bfd_bread ((PTR) nextname, (bfd_size_type) 16, abfd);
+ int i = bfd_bread (nextname, 16, abfd);
if (i == 0)
- return true;
+ return TRUE;
if (i != 16)
- return false;
+ return FALSE;
if (bfd_seek (abfd, (file_ptr) -16, SEEK_CUR) != 0)
- return false;
+ return FALSE;
if (!strncmp (nextname, "__.SYMDEF ", 16)
|| !strncmp (nextname, "__.SYMDEF/ ", 16)) /* old Linux archives */
@@ -929,27 +889,27 @@ bfd_slurp_armap (abfd)
{
/* 64bit ELF (Irix 6) archive. */
#ifdef BFD64
+ extern bfd_boolean bfd_elf64_archive_slurp_armap (bfd *);
return bfd_elf64_archive_slurp_armap (abfd);
#else
bfd_set_error (bfd_error_wrong_format);
- return false;
+ return FALSE;
#endif
}
- bfd_has_map (abfd) = false;
- return true;
+ bfd_has_map (abfd) = FALSE;
+ return TRUE;
}
-/* Returns false on error, true otherwise */
+/* Returns FALSE on error, TRUE otherwise */
/* flavor 2 of a bsd armap, similar to bfd_slurp_bsd_armap except the
header is in a slightly different order and the map name is '/'.
This flavour is used by hp300hpux. */
#define HPUX_SYMDEF_COUNT_SIZE 2
-boolean
-bfd_slurp_bsd_armap_f2 (abfd)
- bfd *abfd;
+bfd_boolean
+bfd_slurp_bsd_armap_f2 (bfd *abfd)
{
struct areltdata *mapdata;
char nextname[17];
@@ -960,16 +920,16 @@ bfd_slurp_bsd_armap_f2 (abfd)
unsigned int stringsize;
bfd_size_type amt;
carsym *set;
- int i = bfd_bread ((PTR) nextname, (bfd_size_type) 16, abfd);
+ int i = bfd_bread (nextname, 16, abfd);
if (i == 0)
- return true;
+ return TRUE;
if (i != 16)
- return false;
+ return FALSE;
/* The archive has at least 16 bytes in it. */
if (bfd_seek (abfd, (file_ptr) -16, SEEK_CUR) != 0)
- return false;
+ return FALSE;
if (!strncmp (nextname, "__.SYMDEF ", 16)
|| !strncmp (nextname, "__.SYMDEF/ ", 16)) /* old Linux archives */
@@ -977,33 +937,33 @@ bfd_slurp_bsd_armap_f2 (abfd)
if (strncmp (nextname, "/ ", 16))
{
- bfd_has_map (abfd) = false;
- return true;
+ bfd_has_map (abfd) = FALSE;
+ return TRUE;
}
- mapdata = (struct areltdata *) _bfd_read_ar_hdr (abfd);
+ mapdata = _bfd_read_ar_hdr (abfd);
if (mapdata == NULL)
- return false;
+ return FALSE;
amt = mapdata->parsed_size;
- raw_armap = (bfd_byte *) bfd_zalloc (abfd, amt);
+ raw_armap = bfd_zalloc (abfd, amt);
if (raw_armap == NULL)
{
byebye:
- bfd_release (abfd, (PTR) mapdata);
- return false;
+ bfd_release (abfd, mapdata);
+ return FALSE;
}
- if (bfd_bread ((PTR) raw_armap, amt, abfd) != amt)
+ if (bfd_bread (raw_armap, amt, abfd) != amt)
{
if (bfd_get_error () != bfd_error_system_call)
bfd_set_error (bfd_error_malformed_archive);
byebyebye:
- bfd_release (abfd, (PTR) raw_armap);
+ bfd_release (abfd, raw_armap);
goto byebye;
}
- ardata->symdef_count = H_GET_16 (abfd, (PTR) raw_armap);
+ ardata->symdef_count = H_GET_16 (abfd, raw_armap);
if (ardata->symdef_count * BSD_SYMDEF_SIZE
> mapdata->parsed_size - HPUX_SYMDEF_COUNT_SIZE)
@@ -1021,10 +981,10 @@ bfd_slurp_bsd_armap_f2 (abfd)
+ HPUX_SYMDEF_COUNT_SIZE
+ BSD_STRING_COUNT_SIZE);
rbase = (bfd_byte *) stringbase + stringsize;
- amt = (bfd_size_type) ardata->symdef_count * BSD_SYMDEF_SIZE;
- ardata->symdefs = (carsym *) bfd_alloc (abfd, amt);
+ amt = ardata->symdef_count * BSD_SYMDEF_SIZE;
+ ardata->symdefs = bfd_alloc (abfd, amt);
if (!ardata->symdefs)
- return false;
+ return FALSE;
for (counter = 0, set = ardata->symdefs;
counter < ardata->symdef_count;
@@ -1040,8 +1000,8 @@ bfd_slurp_bsd_armap_f2 (abfd)
/* FIXME, we should provide some way to free raw_ardata when
we are done using the strings from it. For now, it seems
to be allocated on an objalloc anyway... */
- bfd_has_map (abfd) = true;
- return true;
+ bfd_has_map (abfd) = TRUE;
+ return TRUE;
}
/** Extended name table.
@@ -1054,49 +1014,48 @@ bfd_slurp_bsd_armap_f2 (abfd)
element>. Index is the P.R. of an int (decimal). Data General have
extended the format by using the prefix // for the special element. */
-/* Returns false on error, true otherwise. */
+/* Returns FALSE on error, TRUE otherwise. */
-boolean
-_bfd_slurp_extended_name_table (abfd)
- bfd *abfd;
+bfd_boolean
+_bfd_slurp_extended_name_table (bfd *abfd)
{
char nextname[17];
struct areltdata *namedata;
bfd_size_type amt;
/* FIXME: Formatting sucks here, and in case of failure of BFD_READ,
- we probably don't want to return true. */
+ we probably don't want to return TRUE. */
bfd_seek (abfd, bfd_ardata (abfd)->first_file_filepos, SEEK_SET);
- if (bfd_bread ((PTR) nextname, (bfd_size_type) 16, abfd) == 16)
+ if (bfd_bread (nextname, 16, abfd) == 16)
{
if (bfd_seek (abfd, (file_ptr) -16, SEEK_CUR) != 0)
- return false;
+ return FALSE;
if (strncmp (nextname, "ARFILENAMES/ ", 16) != 0 &&
strncmp (nextname, "// ", 16) != 0)
{
bfd_ardata (abfd)->extended_names = NULL;
- return true;
+ return TRUE;
}
- namedata = (struct areltdata *) _bfd_read_ar_hdr (abfd);
+ namedata = _bfd_read_ar_hdr (abfd);
if (namedata == NULL)
- return false;
+ return FALSE;
amt = namedata->parsed_size;
bfd_ardata (abfd)->extended_names = bfd_zalloc (abfd, amt);
if (bfd_ardata (abfd)->extended_names == NULL)
{
byebye:
- bfd_release (abfd, (PTR) namedata);
- return false;
+ bfd_release (abfd, namedata);
+ return FALSE;
}
- if (bfd_bread ((PTR) bfd_ardata (abfd)->extended_names, amt, abfd) != amt)
+ if (bfd_bread (bfd_ardata (abfd)->extended_names, amt, abfd) != amt)
{
if (bfd_get_error () != bfd_error_system_call)
bfd_set_error (bfd_error_malformed_archive);
- bfd_release (abfd, (PTR) (bfd_ardata (abfd)->extended_names));
+ bfd_release (abfd, (bfd_ardata (abfd)->extended_names));
bfd_ardata (abfd)->extended_names = NULL;
goto byebye;
}
@@ -1129,7 +1088,7 @@ _bfd_slurp_extended_name_table (abfd)
bfd_release (abfd, namedata);
#endif
}
- return true;
+ return TRUE;
}
#ifdef VMS
@@ -1138,9 +1097,7 @@ _bfd_slurp_extended_name_table (abfd)
semicolon. */
static const char *
-normalize (abfd, file)
- bfd *abfd;
- const char *file;
+normalize (bfd *abfd, const char *file)
{
const char *first;
const char *last;
@@ -1161,7 +1118,7 @@ normalize (abfd, file)
first--;
}
- copy = (char *) bfd_alloc (abfd, (bfd_size_type) (last - first + 1));
+ copy = bfd_alloc (abfd, last - first + 1);
if (copy == NULL)
return NULL;
@@ -1173,9 +1130,7 @@ normalize (abfd, file)
#else
static const char *
-normalize (abfd, file)
- bfd *abfd ATTRIBUTE_UNUSED;
- const char *file;
+normalize (bfd *abfd ATTRIBUTE_UNUSED, const char *file)
{
const char *filename = strrchr (file, '/');
@@ -1189,7 +1144,7 @@ normalize (abfd, file)
filename = file + 1;
}
#endif
- if (filename != (char *) NULL)
+ if (filename != NULL)
filename++;
else
filename = file;
@@ -1199,44 +1154,41 @@ normalize (abfd, file)
/* Build a BFD style extended name table. */
-boolean
-_bfd_archive_bsd_construct_extended_name_table (abfd, tabloc, tablen, name)
- bfd *abfd;
- char **tabloc;
- bfd_size_type *tablen;
- const char **name;
+bfd_boolean
+_bfd_archive_bsd_construct_extended_name_table (bfd *abfd,
+ char **tabloc,
+ bfd_size_type *tablen,
+ const char **name)
{
*name = "ARFILENAMES/";
- return _bfd_construct_extended_name_table (abfd, false, tabloc, tablen);
+ return _bfd_construct_extended_name_table (abfd, FALSE, tabloc, tablen);
}
/* Build an SVR4 style extended name table. */
-boolean
-_bfd_archive_coff_construct_extended_name_table (abfd, tabloc, tablen, name)
- bfd *abfd;
- char **tabloc;
- bfd_size_type *tablen;
- const char **name;
+bfd_boolean
+_bfd_archive_coff_construct_extended_name_table (bfd *abfd,
+ char **tabloc,
+ bfd_size_type *tablen,
+ const char **name)
{
*name = "//";
- return _bfd_construct_extended_name_table (abfd, true, tabloc, tablen);
+ return _bfd_construct_extended_name_table (abfd, TRUE, tabloc, tablen);
}
/* Follows archive_head and produces an extended name table if
necessary. Returns (in tabloc) a pointer to an extended name
table, and in tablen the length of the table. If it makes an entry
it clobbers the filename so that the element may be written without
- further massage. Returns true if it ran successfully, false if
+ further massage. Returns TRUE if it ran successfully, FALSE if
something went wrong. A successful return may still involve a
zero-length tablen! */
-boolean
-_bfd_construct_extended_name_table (abfd, trailing_slash, tabloc, tablen)
- bfd *abfd;
- boolean trailing_slash;
- char **tabloc;
- bfd_size_type *tablen;
+bfd_boolean
+_bfd_construct_extended_name_table (bfd *abfd,
+ bfd_boolean trailing_slash,
+ char **tabloc,
+ bfd_size_type *tablen)
{
unsigned int maxname = abfd->xvec->ar_max_namelen;
bfd_size_type total_namelen = 0;
@@ -1253,7 +1205,7 @@ _bfd_construct_extended_name_table (abfd, trailing_slash, tabloc, tablen)
normal = normalize (current, current->filename);
if (normal == NULL)
- return false;
+ return FALSE;
thislen = strlen (normal);
@@ -1289,11 +1241,11 @@ _bfd_construct_extended_name_table (abfd, trailing_slash, tabloc, tablen)
}
if (total_namelen == 0)
- return true;
+ return TRUE;
*tabloc = bfd_zalloc (abfd, total_namelen);
if (*tabloc == NULL)
- return false;
+ return FALSE;
*tablen = total_namelen;
strptr = *tabloc;
@@ -1306,7 +1258,7 @@ _bfd_construct_extended_name_table (abfd, trailing_slash, tabloc, tablen)
normal = normalize (current, current->filename);
if (normal == NULL)
- return false;
+ return FALSE;
thislen = strlen (normal);
if (thislen > maxname)
@@ -1341,7 +1293,7 @@ _bfd_construct_extended_name_table (abfd, trailing_slash, tabloc, tablen)
}
}
- return true;
+ return TRUE;
}
/** A couple of functions for creating ar_hdrs */
@@ -1350,9 +1302,7 @@ _bfd_construct_extended_name_table (abfd, trailing_slash, tabloc, tablen)
/* Function to encode large UID/GID values according to HP. */
static void
-hpux_uid_gid_encode (str, id)
- char str[6];
- long int id;
+hpux_uid_gid_encode (char str[6], long int id)
{
int cnt;
@@ -1378,10 +1328,7 @@ hpux_uid_gid_encode (str, id)
is set, and it's an in-memory bfd, we fake it. */
static struct areltdata *
-bfd_ar_hdr_from_filesystem (abfd, filename, member)
- bfd *abfd;
- const char *filename;
- bfd *member;
+bfd_ar_hdr_from_filesystem (bfd *abfd, const char *filename, bfd *member)
{
struct stat status;
struct areltdata *ared;
@@ -1392,7 +1339,7 @@ bfd_ar_hdr_from_filesystem (abfd, filename, member)
if (member && (member->flags & BFD_IN_MEMORY) != 0)
{
/* Assume we just "made" the member, and fake it. */
- struct bfd_in_memory *bim = (struct bfd_in_memory *) member->iostream;
+ struct bfd_in_memory *bim = member->iostream;
time (&status.st_mtime);
status.st_uid = getuid ();
status.st_gid = getgid ();
@@ -1406,13 +1353,13 @@ bfd_ar_hdr_from_filesystem (abfd, filename, member)
}
amt = sizeof (struct ar_hdr) + sizeof (struct areltdata);
- ared = (struct areltdata *) bfd_zalloc (abfd, amt);
+ ared = bfd_zalloc (abfd, amt);
if (ared == NULL)
return NULL;
hdr = (struct ar_hdr *) (((char *) ared) + sizeof (struct areltdata));
/* ar headers are space padded, not null padded! */
- memset ((PTR) hdr, ' ', sizeof (struct ar_hdr));
+ memset (hdr, ' ', sizeof (struct ar_hdr));
strncpy (hdr->ar_fmag, ARFMAG, 2);
@@ -1458,12 +1405,10 @@ bfd_ar_hdr_from_filesystem (abfd, filename, member)
a strong stomach to write this, and it does, but it takes even a
stronger stomach to try to code around such a thing! */
-struct ar_hdr *bfd_special_undocumented_glue PARAMS ((bfd *, const char *));
+struct ar_hdr *bfd_special_undocumented_glue (bfd *, const char *);
struct ar_hdr *
-bfd_special_undocumented_glue (abfd, filename)
- bfd *abfd;
- const char *filename;
+bfd_special_undocumented_glue (bfd *abfd, const char *filename)
{
struct areltdata *ar_elt = bfd_ar_hdr_from_filesystem (abfd, filename, 0);
if (ar_elt == NULL)
@@ -1474,9 +1419,7 @@ bfd_special_undocumented_glue (abfd, filename)
/* Analogous to stat call. */
int
-bfd_generic_stat_arch_elt (abfd, buf)
- bfd *abfd;
- struct stat *buf;
+bfd_generic_stat_arch_elt (bfd *abfd, struct stat *buf)
{
struct ar_hdr *hdr;
char *aloser;
@@ -1531,10 +1474,7 @@ bfd_generic_stat_arch_elt (abfd, buf)
}
void
-bfd_dont_truncate_arname (abfd, pathname, arhdr)
- bfd *abfd;
- const char *pathname;
- char *arhdr;
+bfd_dont_truncate_arname (bfd *abfd, const char *pathname, char *arhdr)
{
/* FIXME: This interacts unpleasantly with ar's quick-append option.
Fortunately ic960 users will never use that option. Fixing this
@@ -1571,10 +1511,7 @@ bfd_dont_truncate_arname (abfd, pathname, arhdr)
}
void
-bfd_bsd_truncate_arname (abfd, pathname, arhdr)
- bfd *abfd;
- const char *pathname;
- char *arhdr;
+bfd_bsd_truncate_arname (bfd *abfd, const char *pathname, char *arhdr)
{
struct ar_hdr *hdr = (struct ar_hdr *) arhdr;
size_t length;
@@ -1622,10 +1559,7 @@ bfd_bsd_truncate_arname (abfd, pathname, arhdr)
bsd ar. */
void
-bfd_gnu_truncate_arname (abfd, pathname, arhdr)
- bfd *abfd;
- const char *pathname;
- char *arhdr;
+bfd_gnu_truncate_arname (bfd *abfd, const char *pathname, char *arhdr)
{
struct ar_hdr *hdr = (struct ar_hdr *) arhdr;
size_t length;
@@ -1669,16 +1603,16 @@ bfd_gnu_truncate_arname (abfd, pathname, arhdr)
/* The BFD is open for write and has its format set to bfd_archive. */
-boolean
-_bfd_write_archive_contents (arch)
- bfd *arch;
+bfd_boolean
+_bfd_write_archive_contents (bfd *arch)
{
bfd *current;
char *etable = NULL;
bfd_size_type elength = 0;
const char *ename = NULL;
- boolean makemap = bfd_has_map (arch);
- boolean hasobjects = false; /* If no .o's, don't bother to make a map. */
+ bfd_boolean makemap = bfd_has_map (arch);
+ /* If no .o's, don't bother to make a map. */
+ bfd_boolean hasobjects = FALSE;
bfd_size_type wrote;
unsigned int i;
int tries;
@@ -1696,19 +1630,18 @@ _bfd_write_archive_contents (arch)
if (bfd_write_p (current))
{
bfd_set_error (bfd_error_invalid_operation);
- return false;
+ return FALSE;
}
if (!current->arelt_data)
{
current->arelt_data =
- (PTR) bfd_ar_hdr_from_filesystem (arch, current->filename, current);
+ bfd_ar_hdr_from_filesystem (arch, current->filename, current);
if (!current->arelt_data)
- return false;
+ return FALSE;
/* Put in the file name. */
- BFD_SEND (arch, _bfd_truncate_arname, (arch,
- current->filename,
- (char *) arch_hdr (current)));
+ BFD_SEND (arch, _bfd_truncate_arname,
+ (arch, current->filename, (char *) arch_hdr (current)));
}
if (makemap && ! hasobjects)
@@ -1718,35 +1651,35 @@ _bfd_write_archive_contents (arch)
&& ((bfd_get_file_flags (current) & HAS_SYMS))
#endif
)
- hasobjects = true;
+ hasobjects = TRUE;
}
}
if (!BFD_SEND (arch, _bfd_construct_extended_name_table,
(arch, &etable, &elength, &ename)))
- return false;
+ return FALSE;
if (bfd_seek (arch, (file_ptr) 0, SEEK_SET) != 0)
- return false;
+ return FALSE;
#ifdef GNU960
- wrote = bfd_bwrite (BFD_GNU960_ARMAG (arch), (bfd_size_type) SARMAG, arch);
+ wrote = bfd_bwrite (BFD_GNU960_ARMAG (arch), SARMAG, arch);
#else
- wrote = bfd_bwrite (ARMAG, (bfd_size_type) SARMAG, arch);
+ wrote = bfd_bwrite (ARMAG, SARMAG, arch);
#endif
if (wrote != SARMAG)
- return false;
+ return FALSE;
if (makemap && hasobjects)
{
if (! _bfd_compute_and_write_armap (arch, (unsigned int) elength))
- return false;
+ return FALSE;
}
if (elength != 0)
{
struct ar_hdr hdr;
- memset ((char *) (&hdr), 0, sizeof (struct ar_hdr));
+ memset (&hdr, 0, sizeof (struct ar_hdr));
strcpy (hdr.ar_name, ename);
/* Round size up to even number in archive header. */
sprintf (&(hdr.ar_size[0]), "%-10d",
@@ -1755,14 +1688,14 @@ _bfd_write_archive_contents (arch)
for (i = 0; i < sizeof (struct ar_hdr); i++)
if (((char *) (&hdr))[i] == '\0')
(((char *) (&hdr))[i]) = ' ';
- if ((bfd_bwrite ((PTR) &hdr, (bfd_size_type) sizeof (struct ar_hdr), arch)
+ if ((bfd_bwrite (&hdr, sizeof (struct ar_hdr), arch)
!= sizeof (struct ar_hdr))
|| bfd_bwrite (etable, elength, arch) != elength)
- return false;
+ return FALSE;
if ((elength % 2) == 1)
{
- if (bfd_bwrite ("\012", (bfd_size_type) 1, arch) != 1)
- return false;
+ if (bfd_bwrite ("\012", 1, arch) != 1)
+ return FALSE;
}
}
@@ -1773,31 +1706,31 @@ _bfd_write_archive_contents (arch)
struct ar_hdr *hdr = arch_hdr (current);
/* Write ar header. */
- if (bfd_bwrite ((PTR) hdr, (bfd_size_type) sizeof (*hdr), arch)
+ if (bfd_bwrite (hdr, sizeof (*hdr), arch)
!= sizeof (*hdr))
- return false;
+ return FALSE;
if (bfd_seek (current, (file_ptr) 0, SEEK_SET) != 0)
- return false;
+ return FALSE;
while (remaining)
{
unsigned int amt = DEFAULT_BUFFERSIZE;
if (amt > remaining)
amt = remaining;
errno = 0;
- if (bfd_bread (buffer, (bfd_size_type) amt, current) != amt)
+ if (bfd_bread (buffer, amt, current) != amt)
{
if (bfd_get_error () != bfd_error_system_call)
bfd_set_error (bfd_error_malformed_archive);
- return false;
+ return FALSE;
}
- if (bfd_bwrite (buffer, (bfd_size_type) amt, arch) != amt)
- return false;
+ if (bfd_bwrite (buffer, amt, arch) != amt)
+ return FALSE;
remaining -= amt;
}
if ((arelt_size (current) % 2) == 1)
{
- if (bfd_bwrite ("\012", (bfd_size_type) 1, arch) != 1)
- return false;
+ if (bfd_bwrite ("\012", 1, arch) != 1)
+ return FALSE;
}
}
@@ -1820,15 +1753,13 @@ _bfd_write_archive_contents (arch)
while (++tries < 6);
}
- return true;
+ return TRUE;
}
/* Note that the namidx for the first symbol is 0. */
-boolean
-_bfd_compute_and_write_armap (arch, elength)
- bfd *arch;
- unsigned int elength;
+bfd_boolean
+_bfd_compute_and_write_armap (bfd *arch, unsigned int elength)
{
char *first_name = NULL;
bfd *current;
@@ -1839,7 +1770,7 @@ _bfd_compute_and_write_armap (arch, elength)
int stridx = 0; /* string index */
asymbol **syms = NULL;
long syms_max = 0;
- boolean ret;
+ bfd_boolean ret;
bfd_size_type amt;
/* Dunno if this is the best place for this info... */
@@ -1847,14 +1778,14 @@ _bfd_compute_and_write_armap (arch, elength)
elength += sizeof (struct ar_hdr);
elength += elength % 2;
- amt = (bfd_size_type) orl_max * sizeof (struct orl);
- map = (struct orl *) bfd_malloc (amt);
+ amt = orl_max * sizeof (struct orl);
+ map = bfd_malloc (amt);
if (map == NULL)
goto error_return;
/* We put the symbol names on the arch objalloc, and then discard
them when done. */
- first_name = bfd_alloc (arch, (bfd_size_type) 1);
+ first_name = bfd_alloc (arch, 1);
if (first_name == NULL)
goto error_return;
@@ -1865,7 +1796,7 @@ _bfd_compute_and_write_armap (arch, elength)
/* Map over each element. */
for (current = arch->archive_head;
- current != (bfd *) NULL;
+ current != NULL;
current = current->next, elt_no++)
{
if (bfd_check_format (current, bfd_object)
@@ -1886,7 +1817,7 @@ _bfd_compute_and_write_armap (arch, elength)
if (syms_max > 0)
free (syms);
syms_max = storage;
- syms = (asymbol **) bfd_malloc ((bfd_size_type) syms_max);
+ syms = bfd_malloc (syms_max);
if (syms == NULL)
goto error_return;
}
@@ -1914,9 +1845,9 @@ _bfd_compute_and_write_armap (arch, elength)
if (orl_count == orl_max)
{
orl_max *= 2;
- amt = (bfd_size_type) orl_max * sizeof (struct orl);
- new_map = (struct orl *) bfd_realloc (map, amt);
- if (new_map == (struct orl *) NULL)
+ amt = orl_max * sizeof (struct orl);
+ new_map = bfd_realloc (map, amt);
+ if (new_map == NULL)
goto error_return;
map = new_map;
@@ -1924,7 +1855,7 @@ _bfd_compute_and_write_armap (arch, elength)
namelen = strlen (syms[src_count]->name);
amt = sizeof (char *);
- map[orl_count].name = (char **) bfd_alloc (arch, amt);
+ map[orl_count].name = bfd_alloc (arch, amt);
if (map[orl_count].name == NULL)
goto error_return;
*(map[orl_count].name) = bfd_alloc (arch, namelen + 1);
@@ -1968,16 +1899,15 @@ _bfd_compute_and_write_armap (arch, elength)
if (first_name != NULL)
bfd_release (arch, first_name);
- return false;
+ return FALSE;
}
-boolean
-bsd_write_armap (arch, elength, map, orl_count, stridx)
- bfd *arch;
- unsigned int elength;
- struct orl *map;
- unsigned int orl_count;
- int stridx;
+bfd_boolean
+bsd_write_armap (bfd *arch,
+ unsigned int elength,
+ struct orl *map,
+ unsigned int orl_count,
+ int stridx)
{
int padit = stridx & 1;
unsigned int ranlibsize = orl_count * BSD_SYMDEF_SIZE;
@@ -1996,7 +1926,7 @@ bsd_write_armap (arch, elength, map, orl_count, stridx)
firstreal = mapsize + elength + sizeof (struct ar_hdr) + SARMAG;
stat (arch->filename, &statbuf);
- memset ((char *) (&hdr), 0, sizeof (struct ar_hdr));
+ memset (&hdr, 0, sizeof (struct ar_hdr));
sprintf (hdr.ar_name, RANLIBMAG);
/* Remember the timestamp, to keep it holy. But fudge it a little. */
bfd_ardata (arch)->armap_timestamp = statbuf.st_mtime + ARMAP_TIME_OFFSET;
@@ -2010,12 +1940,12 @@ bsd_write_armap (arch, elength, map, orl_count, stridx)
for (i = 0; i < sizeof (struct ar_hdr); i++)
if (((char *) (&hdr))[i] == '\0')
(((char *) (&hdr))[i]) = ' ';
- if (bfd_bwrite ((PTR) &hdr, (bfd_size_type) sizeof (struct ar_hdr), arch)
+ if (bfd_bwrite (&hdr, sizeof (struct ar_hdr), arch)
!= sizeof (struct ar_hdr))
- return false;
+ return FALSE;
H_PUT_32 (arch, ranlibsize, temp);
- if (bfd_bwrite (temp, (bfd_size_type) sizeof (temp), arch) != sizeof (temp))
- return false;
+ if (bfd_bwrite (temp, sizeof (temp), arch) != sizeof (temp))
+ return FALSE;
for (count = 0; count < orl_count; count++)
{
@@ -2035,43 +1965,42 @@ bsd_write_armap (arch, elength, map, orl_count, stridx)
last_elt = current;
H_PUT_32 (arch, map[count].namidx, buf);
H_PUT_32 (arch, firstreal, buf + BSD_SYMDEF_OFFSET_SIZE);
- if (bfd_bwrite (buf, (bfd_size_type) BSD_SYMDEF_SIZE, arch)
+ if (bfd_bwrite (buf, BSD_SYMDEF_SIZE, arch)
!= BSD_SYMDEF_SIZE)
- return false;
+ return FALSE;
}
/* Now write the strings themselves. */
H_PUT_32 (arch, stringsize, temp);
- if (bfd_bwrite (temp, (bfd_size_type) sizeof (temp), arch) != sizeof (temp))
- return false;
+ if (bfd_bwrite (temp, sizeof (temp), arch) != sizeof (temp))
+ return FALSE;
for (count = 0; count < orl_count; count++)
{
size_t len = strlen (*map[count].name) + 1;
- if (bfd_bwrite (*map[count].name, (bfd_size_type) len, arch) != len)
- return false;
+ if (bfd_bwrite (*map[count].name, len, arch) != len)
+ return FALSE;
}
/* The spec sez this should be a newline. But in order to be
bug-compatible for sun's ar we use a null. */
if (padit)
{
- if (bfd_bwrite ("", (bfd_size_type) 1, arch) != 1)
- return false;
+ if (bfd_bwrite ("", 1, arch) != 1)
+ return FALSE;
}
- return true;
+ return TRUE;
}
/* At the end of archive file handling, update the timestamp in the
file, so the linker will accept it.
- Return true if the timestamp was OK, or an unusual problem happened.
- Return false if we updated the timestamp. */
+ Return TRUE if the timestamp was OK, or an unusual problem happened.
+ Return FALSE if we updated the timestamp. */
-boolean
-_bfd_archive_bsd_update_armap_timestamp (arch)
- bfd *arch;
+bfd_boolean
+_bfd_archive_bsd_update_armap_timestamp (bfd *arch)
{
struct stat archstat;
struct ar_hdr hdr;
@@ -2082,14 +2011,14 @@ _bfd_archive_bsd_update_armap_timestamp (arch)
bfd_flush (arch);
if (bfd_stat (arch, &archstat) == -1)
{
- perror (_("Reading archive file mod timestamp"));
+ bfd_perror (_("Reading archive file mod timestamp"));
/* Can't read mod time for some reason. */
- return true;
+ return TRUE;
}
if (archstat.st_mtime <= bfd_ardata (arch)->armap_timestamp)
/* OK by the linker's rules. */
- return true;
+ return TRUE;
/* Update the timestamp. */
bfd_ardata (arch)->armap_timestamp = archstat.st_mtime + ARMAP_TIME_OFFSET;
@@ -2105,18 +2034,17 @@ _bfd_archive_bsd_update_armap_timestamp (arch)
bfd_ardata (arch)->armap_datepos = (SARMAG
+ offsetof (struct ar_hdr, ar_date[0]));
if (bfd_seek (arch, bfd_ardata (arch)->armap_datepos, SEEK_SET) != 0
- || (bfd_bwrite (hdr.ar_date, (bfd_size_type) sizeof (hdr.ar_date), arch)
+ || (bfd_bwrite (hdr.ar_date, sizeof (hdr.ar_date), arch)
!= sizeof (hdr.ar_date)))
{
- /* FIXME: bfd can't call perror. */
- perror (_("Writing updated armap timestamp"));
+ bfd_perror (_("Writing updated armap timestamp"));
/* Some error while writing. */
- return true;
+ return TRUE;
}
/* We updated the timestamp successfully. */
- return false;
+ return FALSE;
}
/* A coff armap looks like :
@@ -2133,13 +2061,12 @@ _bfd_archive_bsd_update_armap_timestamp (arch)
symbol name n-1
*/
-boolean
-coff_write_armap (arch, elength, map, symbol_count, stridx)
- bfd *arch;
- unsigned int elength;
- struct orl *map;
- unsigned int symbol_count;
- int stridx;
+bfd_boolean
+coff_write_armap (bfd *arch,
+ unsigned int elength,
+ struct orl *map,
+ unsigned int symbol_count,
+ int stridx)
{
/* The size of the ranlib is the number of exported symbols in the
archive * the number of bytes in an int, + an int for the count. */
@@ -2162,7 +2089,7 @@ coff_write_armap (arch, elength, map, symbol_count, stridx)
+ sizeof (struct ar_hdr)
+ SARMAG);
- memset ((char *) (&hdr), 0, sizeof (struct ar_hdr));
+ memset (&hdr, 0, sizeof (struct ar_hdr));
hdr.ar_name[0] = '/';
sprintf (hdr.ar_size, "%-10d", (int) mapsize);
sprintf (hdr.ar_date, "%ld", (long) time (NULL));
@@ -2178,12 +2105,12 @@ coff_write_armap (arch, elength, map, symbol_count, stridx)
/* Write the ar header for this item and the number of symbols. */
- if (bfd_bwrite ((PTR) &hdr, (bfd_size_type) sizeof (struct ar_hdr), arch)
+ if (bfd_bwrite (&hdr, sizeof (struct ar_hdr), arch)
!= sizeof (struct ar_hdr))
- return false;
+ return FALSE;
if (!bfd_write_bigendian_4byte_int (arch, symbol_count))
- return false;
+ return FALSE;
/* Two passes, first write the file offsets for each symbol -
remembering that each offset is on a two byte boundary. */
@@ -2193,7 +2120,7 @@ coff_write_armap (arch, elength, map, symbol_count, stridx)
current = arch->archive_head;
count = 0;
- while (current != (bfd *) NULL && count < symbol_count)
+ while (current != NULL && count < symbol_count)
{
/* For each symbol which is used defined in this object, write
out the object file's address in the archive. */
@@ -2201,12 +2128,11 @@ coff_write_armap (arch, elength, map, symbol_count, stridx)
while (count < symbol_count && map[count].u.abfd == current)
{
if (!bfd_write_bigendian_4byte_int (arch, archive_member_file_ptr))
- return false;
+ return FALSE;
count++;
}
/* Add size of this archive entry. */
- archive_member_file_ptr += (arelt_size (current)
- + sizeof (struct ar_hdr));
+ 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;
@@ -2217,17 +2143,17 @@ coff_write_armap (arch, elength, map, symbol_count, stridx)
{
size_t len = strlen (*map[count].name) + 1;
- if (bfd_bwrite (*map[count].name, (bfd_size_type) len, arch) != len)
- return false;
+ if (bfd_bwrite (*map[count].name, len, arch) != len)
+ return FALSE;
}
/* The spec sez this should be a newline. But in order to be
bug-compatible for arc960 we use a null. */
if (padit)
{
- if (bfd_bwrite ("", (bfd_size_type) 1, arch) != 1)
- return false;
+ if (bfd_bwrite ("", 1, arch) != 1)
+ return FALSE;
}
- return true;
+ return TRUE;
}
diff --git a/contrib/binutils/bfd/archive64.c b/contrib/binutils/bfd/archive64.c
index ea94c6a..1b9f5f3 100644
--- a/contrib/binutils/bfd/archive64.c
+++ b/contrib/binutils/bfd/archive64.c
@@ -1,5 +1,5 @@
/* MIPS-specific support for 64-bit ELF
- Copyright 1996, 1997, 1998, 1999, 2000, 2001
+ Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
Free Software Foundation, Inc.
Ian Lance Taylor, Cygnus Support
Linker support added by Mark Mitchell, CodeSourcery, LLC.
@@ -31,15 +31,14 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
/* Irix 6 defines a 64bit archive map format, so that they can
have archives more than 4 GB in size. */
-boolean bfd_elf64_archive_slurp_armap PARAMS ((bfd *));
-boolean bfd_elf64_archive_write_armap
- PARAMS ((bfd *, unsigned int, struct orl *, unsigned int, int));
+bfd_boolean bfd_elf64_archive_slurp_armap (bfd *);
+bfd_boolean bfd_elf64_archive_write_armap
+ (bfd *, unsigned int, struct orl *, unsigned int, int);
/* Read an Irix 6 armap. */
-boolean
-bfd_elf64_archive_slurp_armap (abfd)
- bfd *abfd;
+bfd_boolean
+bfd_elf64_archive_slurp_armap (bfd *abfd)
{
struct artdata *ardata = bfd_ardata (abfd);
char nextname[17];
@@ -56,14 +55,14 @@ bfd_elf64_archive_slurp_armap (abfd)
/* Get the name of the first element. */
arhdrpos = bfd_tell (abfd);
- i = bfd_bread ((PTR) nextname, (bfd_size_type) 16, abfd);
+ i = bfd_bread (nextname, 16, abfd);
if (i == 0)
- return true;
+ return TRUE;
if (i != 16)
- return false;
+ return FALSE;
if (bfd_seek (abfd, (file_ptr) - 16, SEEK_CUR) != 0)
- return false;
+ return FALSE;
/* Archives with traditional armaps are still permitted. */
if (strncmp (nextname, "/ ", 16) == 0)
@@ -71,21 +70,21 @@ bfd_elf64_archive_slurp_armap (abfd)
if (strncmp (nextname, "/SYM64/ ", 16) != 0)
{
- bfd_has_map (abfd) = false;
- return true;
+ bfd_has_map (abfd) = FALSE;
+ return TRUE;
}
mapdata = (struct areltdata *) _bfd_read_ar_hdr (abfd);
if (mapdata == NULL)
- return false;
+ return FALSE;
parsed_size = mapdata->parsed_size;
- bfd_release (abfd, (PTR) mapdata);
+ bfd_release (abfd, mapdata);
- if (bfd_bread (int_buf, (bfd_size_type) 8, abfd) != 8)
+ if (bfd_bread (int_buf, 8, abfd) != 8)
{
if (bfd_get_error () != bfd_error_system_call)
bfd_set_error (bfd_error_malformed_archive);
- return false;
+ return FALSE;
}
nsymz = bfd_getb64 (int_buf);
@@ -95,13 +94,13 @@ bfd_elf64_archive_slurp_armap (abfd)
ptrsize = 8 * nsymz;
amt = carsym_size + stringsize + 1;
- ardata->symdefs = (carsym *) bfd_zalloc (abfd, amt);
+ ardata->symdefs = bfd_zalloc (abfd, amt);
if (ardata->symdefs == NULL)
- return false;
+ return FALSE;
carsyms = ardata->symdefs;
stringbase = ((char *) ardata->symdefs) + carsym_size;
- raw_armap = (bfd_byte *) bfd_alloc (abfd, ptrsize);
+ raw_armap = bfd_alloc (abfd, ptrsize);
if (raw_armap == NULL)
goto release_symdefs;
@@ -127,29 +126,28 @@ bfd_elf64_archive_slurp_armap (abfd)
/* Pad to an even boundary if you have to. */
ardata->first_file_filepos += (ardata->first_file_filepos) % 2;
- bfd_has_map (abfd) = true;
+ bfd_has_map (abfd) = TRUE;
bfd_release (abfd, raw_armap);
- return true;
+ return TRUE;
release_raw_armap:
bfd_release (abfd, raw_armap);
release_symdefs:
bfd_release (abfd, ardata->symdefs);
- return false;
+ return FALSE;
}
/* Write out an Irix 6 armap. The Irix 6 tools are supposed to be
able to handle ordinary ELF armaps, but at least on Irix 6.2 the
linker crashes. */
-boolean
-bfd_elf64_archive_write_armap (arch, elength, map, symbol_count, stridx)
- bfd *arch;
- unsigned int elength;
- struct orl *map;
- unsigned int symbol_count;
- int stridx;
+bfd_boolean
+bfd_elf64_archive_write_armap (bfd *arch,
+ unsigned int elength,
+ struct orl *map,
+ unsigned int symbol_count,
+ int stridx)
{
unsigned int ranlibsize = (symbol_count * 8) + 8;
unsigned int stringsize = stridx;
@@ -171,7 +169,7 @@ bfd_elf64_archive_write_armap (arch, elength, map, symbol_count, stridx)
+ sizeof (struct ar_hdr)
+ SARMAG);
- memset ((char *) (&hdr), 0, sizeof (struct ar_hdr));
+ 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));
@@ -187,13 +185,13 @@ bfd_elf64_archive_write_armap (arch, elength, map, symbol_count, stridx)
/* Write the ar header for this item and the number of symbols */
- if (bfd_bwrite ((PTR) &hdr, (bfd_size_type) sizeof (struct ar_hdr), arch)
+ if (bfd_bwrite (&hdr, sizeof (struct ar_hdr), arch)
!= sizeof (struct ar_hdr))
- return false;
+ return FALSE;
bfd_putb64 ((bfd_vma) symbol_count, buf);
- if (bfd_bwrite (buf, (bfd_size_type) 8, arch) != 8)
- return false;
+ if (bfd_bwrite (buf, 8, arch) != 8)
+ return FALSE;
/* Two passes, first write the file offsets for each symbol -
remembering that each offset is on a two byte boundary. */
@@ -203,7 +201,7 @@ bfd_elf64_archive_write_armap (arch, elength, map, symbol_count, stridx)
current = arch->archive_head;
count = 0;
- while (current != (bfd *) NULL && count < symbol_count)
+ while (current != NULL && count < symbol_count)
{
/* For each symbol which is used defined in this object, write out
the object file's address in the archive */
@@ -211,8 +209,8 @@ bfd_elf64_archive_write_armap (arch, elength, map, symbol_count, stridx)
while (map[count].u.abfd == current)
{
bfd_putb64 ((bfd_vma) archive_member_file_ptr, buf);
- if (bfd_bwrite (buf, (bfd_size_type) 8, arch) != 8)
- return false;
+ if (bfd_bwrite (buf, 8, arch) != 8)
+ return FALSE;
count++;
}
/* Add size of this archive entry */
@@ -228,18 +226,18 @@ bfd_elf64_archive_write_armap (arch, elength, map, symbol_count, stridx)
{
size_t len = strlen (*map[count].name) + 1;
- if (bfd_bwrite (*map[count].name, (bfd_size_type) len, arch) != len)
- return false;
+ if (bfd_bwrite (*map[count].name, len, arch) != len)
+ return FALSE;
}
/* The spec says that this should be padded to an 8 byte boundary.
However, the Irix 6.2 tools do not appear to do this. */
while (padding != 0)
{
- if (bfd_bwrite ("", (bfd_size_type) 1, arch) != 1)
- return false;
+ if (bfd_bwrite ("", 1, arch) != 1)
+ return FALSE;
--padding;
}
- return true;
+ return TRUE;
}
diff --git a/contrib/binutils/bfd/archures.c b/contrib/binutils/bfd/archures.c
index 063e4fb..f8aeeef 100644
--- a/contrib/binutils/bfd/archures.c
+++ b/contrib/binutils/bfd/archures.c
@@ -1,24 +1,24 @@
/* BFD library support routines for architectures.
Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
- 2000, 2001, 2002
+ 2000, 2001, 2002, 2003
Free Software Foundation, Inc.
Hacked by John Gilmore and Steve Chamberlain of Cygnus Support.
-This file is part of BFD, the Binary File Descriptor library.
+ This 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "bfd.h"
#include "sysdep.h"
@@ -84,6 +84,7 @@ DESCRIPTION
.#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.
@@ -129,12 +130,16 @@ DESCRIPTION
.#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
@@ -142,13 +147,15 @@ DESCRIPTION
.#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 0
-.#define bfd_mach_i386_i8086 1
-.#define bfd_mach_i386_i386_intel_syntax 2
-.#define bfd_mach_x86_64 3
-.#define bfd_mach_x86_64_intel_syntax 4
+.#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 *}
@@ -157,15 +164,20 @@ DESCRIPTION
. 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, {* Hitachi H8/300 *}
-.#define bfd_mach_h8300 1
-.#define bfd_mach_h8300h 2
-.#define bfd_mach_h8300s 3
+. 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 0
-.#define bfd_mach_ppc64 1
+.#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
@@ -182,38 +194,52 @@ DESCRIPTION
.#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 0
+.#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 0
+.#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, {* Hitachi H8/500 *}
-. bfd_arch_sh, {* Hitachi SH *}
-.#define bfd_mach_sh 0
+. 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
@@ -224,40 +250,54 @@ DESCRIPTION
.#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 0
+.#define bfd_mach_v850 1
.#define bfd_mach_v850e 'E'
-.#define bfd_mach_v850ea 'A'
+.#define bfd_mach_v850e1 '1'
. bfd_arch_arc, {* ARC Cores *}
-.#define bfd_mach_arc_5 0
-.#define bfd_mach_arc_6 1
-.#define bfd_mach_arc_7 2
-.#define bfd_mach_arc_8 3
-. bfd_arch_m32r, {* Mitsubishi M32R/D *}
-.#define bfd_mach_m32r 0 {* For backwards compatibility. *}
+.#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 0
-.#define bfd_mach_frvsimple 1
+.#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 0
-.#define bfd_mach_ia64_elf32 1
+.#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
@@ -267,12 +307,29 @@ DESCRIPTION
.#define bfd_mach_avr5 5
. bfd_arch_cris, {* Axis CRIS *}
. bfd_arch_s390, {* IBM s390 *}
-.#define bfd_mach_s390_31 0
-.#define bfd_mach_s390_64 1
+.#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 0
+.#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
. };
*/
@@ -296,15 +353,14 @@ DESCRIPTION
. const char *arch_name;
. const char *printable_name;
. unsigned int section_align_power;
-. {* True if this is the default machine for the architecture.
+. {* TRUE if this is the default machine for the architecture.
. The default arch should be the first entry for an arch so that
. all the entries for that arch can be accessed via <<next>>. *}
-. boolean the_default;
+. bfd_boolean the_default;
. const struct bfd_arch_info * (*compatible)
-. PARAMS ((const struct bfd_arch_info *a,
-. const struct bfd_arch_info *b));
+. (const struct bfd_arch_info *a, const struct bfd_arch_info *b);
.
-. boolean (*scan) PARAMS ((const struct bfd_arch_info *, const char *));
+. bfd_boolean (*scan) (const struct bfd_arch_info *, const char *);
.
. const struct bfd_arch_info *next;
.}
@@ -331,6 +387,8 @@ extern const bfd_arch_info_type bfd_i386_arch;
extern const bfd_arch_info_type bfd_i860_arch;
extern const bfd_arch_info_type bfd_i960_arch;
extern const bfd_arch_info_type bfd_ia64_arch;
+extern const bfd_arch_info_type bfd_ip2k_arch;
+extern const bfd_arch_info_type bfd_iq2000_arch;
extern const bfd_arch_info_type bfd_m32r_arch;
extern const bfd_arch_info_type bfd_m68hc11_arch;
extern const bfd_arch_info_type bfd_m68hc12_arch;
@@ -341,6 +399,7 @@ extern const bfd_arch_info_type bfd_mips_arch;
extern const bfd_arch_info_type bfd_mmix_arch;
extern const bfd_arch_info_type bfd_mn10200_arch;
extern const bfd_arch_info_type bfd_mn10300_arch;
+extern const bfd_arch_info_type bfd_msp430_arch;
extern const bfd_arch_info_type bfd_ns32k_arch;
extern const bfd_arch_info_type bfd_openrisc_arch;
extern const bfd_arch_info_type bfd_or32_arch;
@@ -353,6 +412,7 @@ extern const bfd_arch_info_type bfd_s390_arch;
extern const bfd_arch_info_type bfd_sh_arch;
extern const bfd_arch_info_type bfd_sparc_arch;
extern const bfd_arch_info_type bfd_tic30_arch;
+extern const bfd_arch_info_type bfd_tic4x_arch;
extern const bfd_arch_info_type bfd_tic54x_arch;
extern const bfd_arch_info_type bfd_tic80_arch;
extern const bfd_arch_info_type bfd_v850_arch;
@@ -360,6 +420,7 @@ extern const bfd_arch_info_type bfd_vax_arch;
extern const bfd_arch_info_type bfd_we32k_arch;
extern const bfd_arch_info_type bfd_w65_arch;
extern const bfd_arch_info_type bfd_xstormy16_arch;
+extern const bfd_arch_info_type bfd_xtensa_arch;
extern const bfd_arch_info_type bfd_z8k_arch;
static const bfd_arch_info_type * const bfd_archures_list[] =
@@ -386,6 +447,8 @@ static const bfd_arch_info_type * const bfd_archures_list[] =
&bfd_i860_arch,
&bfd_i960_arch,
&bfd_ia64_arch,
+ &bfd_ip2k_arch,
+ &bfd_iq2000_arch,
&bfd_m32r_arch,
&bfd_m68hc11_arch,
&bfd_m68hc12_arch,
@@ -396,6 +459,7 @@ static const bfd_arch_info_type * const bfd_archures_list[] =
&bfd_mmix_arch,
&bfd_mn10200_arch,
&bfd_mn10300_arch,
+ &bfd_msp430_arch,
&bfd_ns32k_arch,
&bfd_openrisc_arch,
&bfd_or32_arch,
@@ -406,6 +470,7 @@ static const bfd_arch_info_type * const bfd_archures_list[] =
&bfd_sh_arch,
&bfd_sparc_arch,
&bfd_tic30_arch,
+ &bfd_tic4x_arch,
&bfd_tic54x_arch,
&bfd_tic80_arch,
&bfd_v850_arch,
@@ -413,6 +478,7 @@ static const bfd_arch_info_type * const bfd_archures_list[] =
&bfd_w65_arch,
&bfd_we32k_arch,
&bfd_xstormy16_arch,
+ &bfd_xtensa_arch,
&bfd_z8k_arch,
#endif
0
@@ -423,7 +489,7 @@ FUNCTION
bfd_printable_name
SYNOPSIS
- const char *bfd_printable_name(bfd *abfd);
+ const char *bfd_printable_name (bfd *abfd);
DESCRIPTION
Return a printable string representing the architecture and machine
@@ -432,8 +498,7 @@ DESCRIPTION
*/
const char *
-bfd_printable_name (abfd)
- bfd *abfd;
+bfd_printable_name (bfd *abfd)
{
return abfd->arch_info->printable_name;
}
@@ -443,7 +508,7 @@ FUNCTION
bfd_scan_arch
SYNOPSIS
- const bfd_arch_info_type *bfd_scan_arch(const char *string);
+ const bfd_arch_info_type *bfd_scan_arch (const char *string);
DESCRIPTION
Figure out if BFD supports any cpu which could be described with
@@ -452,8 +517,7 @@ DESCRIPTION
*/
const bfd_arch_info_type *
-bfd_scan_arch (string)
- const char *string;
+bfd_scan_arch (const char *string)
{
const bfd_arch_info_type * const *app, *ap;
@@ -475,7 +539,7 @@ FUNCTION
bfd_arch_list
SYNOPSIS
- const char **bfd_arch_list(void);
+ const char **bfd_arch_list (void);
DESCRIPTION
Return a freshly malloced NULL-terminated vector of the names
@@ -483,7 +547,7 @@ DESCRIPTION
*/
const char **
-bfd_arch_list ()
+bfd_arch_list (void)
{
int vec_length = 0;
const char **name_ptr;
@@ -503,7 +567,7 @@ bfd_arch_list ()
}
amt = (vec_length + 1) * sizeof (char **);
- name_list = (const char **) bfd_malloc (amt);
+ name_list = bfd_malloc (amt);
if (name_list == NULL)
return NULL;
@@ -528,29 +592,38 @@ FUNCTION
bfd_arch_get_compatible
SYNOPSIS
- const bfd_arch_info_type *bfd_arch_get_compatible(
- const bfd *abfd,
- const bfd *bbfd);
+ const bfd_arch_info_type *bfd_arch_get_compatible
+ (const bfd *abfd, const bfd *bbfd, bfd_boolean accept_unknowns);
DESCRIPTION
- Determine whether two BFDs'
- architectures and machine types are compatible. Calculates
- the lowest common denominator between the two architectures
- and machine types implied by the BFDs and returns a pointer to
- an <<arch_info>> structure describing the compatible machine.
+ Determine whether two BFDs' architectures and machine types
+ are compatible. Calculates the lowest common denominator
+ between the two architectures and machine types implied by
+ the BFDs and returns a pointer to an <<arch_info>> structure
+ describing the compatible machine.
*/
const bfd_arch_info_type *
-bfd_arch_get_compatible (abfd, bbfd)
- const bfd *abfd;
- const bfd *bbfd;
+bfd_arch_get_compatible (const bfd *abfd,
+ const bfd *bbfd,
+ bfd_boolean accept_unknowns)
{
- /* If either architecture is unknown, then all we can do is assume
- the user knows what he's doing. */
- if (abfd->arch_info->arch == bfd_arch_unknown)
- return bbfd->arch_info;
- if (bbfd->arch_info->arch == bfd_arch_unknown)
- return abfd->arch_info;
+ const bfd * ubfd = NULL;
+
+ /* Look for an unknown architecture. */
+ if (((ubfd = abfd) && ubfd->arch_info->arch == bfd_arch_unknown)
+ || ((ubfd = bbfd) && ubfd->arch_info->arch == bfd_arch_unknown))
+ {
+ /* We can allow an unknown architecture if accept_unknowns
+ is true, or if the target is the "binary" format, which
+ has an unknown architecture. Since the binary format can
+ only be set by explicit request from the user, it is safe
+ to assume that they know what they are doing. */
+ if (accept_unknowns
+ || strcmp (bfd_get_target (ubfd), "binary") == 0)
+ return ubfd->arch_info;
+ return NULL;
+ }
/* Otherwise architecture-specific code has to decide. */
return abfd->arch_info->compatible (abfd->arch_info, bbfd->arch_info);
@@ -571,7 +644,7 @@ DESCRIPTION
*/
const bfd_arch_info_type bfd_default_arch_struct = {
- 32, 32, 8, bfd_arch_unknown, 0, "unknown", "unknown", 2, true,
+ 32, 32, 8, bfd_arch_unknown, 0, "unknown", "unknown", 2, TRUE,
bfd_default_compatible,
bfd_default_scan,
0,
@@ -582,16 +655,14 @@ FUNCTION
bfd_set_arch_info
SYNOPSIS
- void bfd_set_arch_info(bfd *abfd, const bfd_arch_info_type *arg);
+ void bfd_set_arch_info (bfd *abfd, const bfd_arch_info_type *arg);
DESCRIPTION
Set the architecture info of @var{abfd} to @var{arg}.
*/
void
-bfd_set_arch_info (abfd, arg)
- bfd *abfd;
- const bfd_arch_info_type *arg;
+bfd_set_arch_info (bfd *abfd, const bfd_arch_info_type *arg)
{
abfd->arch_info = arg;
}
@@ -601,9 +672,8 @@ INTERNAL_FUNCTION
bfd_default_set_arch_mach
SYNOPSIS
- boolean bfd_default_set_arch_mach(bfd *abfd,
- enum bfd_architecture arch,
- unsigned long mach);
+ bfd_boolean bfd_default_set_arch_mach
+ (bfd *abfd, enum bfd_architecture arch, unsigned long mach);
DESCRIPTION
Set the architecture and machine type in BFD @var{abfd}
@@ -612,19 +682,18 @@ DESCRIPTION
pointer.
*/
-boolean
-bfd_default_set_arch_mach (abfd, arch, mach)
- bfd *abfd;
- enum bfd_architecture arch;
- unsigned long mach;
+bfd_boolean
+bfd_default_set_arch_mach (bfd *abfd,
+ enum bfd_architecture arch,
+ unsigned long mach)
{
abfd->arch_info = bfd_lookup_arch (arch, mach);
if (abfd->arch_info != NULL)
- return true;
+ return TRUE;
abfd->arch_info = &bfd_default_arch_struct;
bfd_set_error (bfd_error_bad_value);
- return false;
+ return FALSE;
}
/*
@@ -632,7 +701,7 @@ FUNCTION
bfd_get_arch
SYNOPSIS
- enum bfd_architecture bfd_get_arch(bfd *abfd);
+ enum bfd_architecture bfd_get_arch (bfd *abfd);
DESCRIPTION
Return the enumerated type which describes the BFD @var{abfd}'s
@@ -640,8 +709,7 @@ DESCRIPTION
*/
enum bfd_architecture
-bfd_get_arch (abfd)
- bfd *abfd;
+bfd_get_arch (bfd *abfd)
{
return abfd->arch_info->arch;
}
@@ -651,7 +719,7 @@ FUNCTION
bfd_get_mach
SYNOPSIS
- unsigned long bfd_get_mach(bfd *abfd);
+ unsigned long bfd_get_mach (bfd *abfd);
DESCRIPTION
Return the long type which describes the BFD @var{abfd}'s
@@ -659,8 +727,7 @@ DESCRIPTION
*/
unsigned long
-bfd_get_mach (abfd)
- bfd *abfd;
+bfd_get_mach (bfd *abfd)
{
return abfd->arch_info->mach;
}
@@ -670,7 +737,7 @@ FUNCTION
bfd_arch_bits_per_byte
SYNOPSIS
- unsigned int bfd_arch_bits_per_byte(bfd *abfd);
+ unsigned int bfd_arch_bits_per_byte (bfd *abfd);
DESCRIPTION
Return the number of bits in one of the BFD @var{abfd}'s
@@ -678,8 +745,7 @@ DESCRIPTION
*/
unsigned int
-bfd_arch_bits_per_byte (abfd)
- bfd *abfd;
+bfd_arch_bits_per_byte (bfd *abfd)
{
return abfd->arch_info->bits_per_byte;
}
@@ -689,7 +755,7 @@ FUNCTION
bfd_arch_bits_per_address
SYNOPSIS
- unsigned int bfd_arch_bits_per_address(bfd *abfd);
+ unsigned int bfd_arch_bits_per_address (bfd *abfd);
DESCRIPTION
Return the number of bits in one of the BFD @var{abfd}'s
@@ -697,8 +763,7 @@ DESCRIPTION
*/
unsigned int
-bfd_arch_bits_per_address (abfd)
- bfd *abfd;
+bfd_arch_bits_per_address (bfd *abfd)
{
return abfd->arch_info->bits_per_address;
}
@@ -709,17 +774,15 @@ INTERNAL_FUNCTION
SYNOPSIS
const bfd_arch_info_type *bfd_default_compatible
- (const bfd_arch_info_type *a,
- const bfd_arch_info_type *b);
+ (const bfd_arch_info_type *a, const bfd_arch_info_type *b);
DESCRIPTION
The default function for testing for compatibility.
*/
const bfd_arch_info_type *
-bfd_default_compatible (a, b)
- const bfd_arch_info_type *a;
- const bfd_arch_info_type *b;
+bfd_default_compatible (const bfd_arch_info_type *a,
+ const bfd_arch_info_type *b)
{
if (a->arch != b->arch)
return NULL;
@@ -741,17 +804,16 @@ INTERNAL_FUNCTION
bfd_default_scan
SYNOPSIS
- boolean bfd_default_scan(const struct bfd_arch_info *info, const char *string);
+ bfd_boolean bfd_default_scan
+ (const struct bfd_arch_info *info, const char *string);
DESCRIPTION
The default function for working out whether this is an
architecture hit and a machine hit.
*/
-boolean
-bfd_default_scan (info, string)
- const bfd_arch_info_type *info;
- const char *string;
+bfd_boolean
+bfd_default_scan (const bfd_arch_info_type *info, const char *string)
{
const char *ptr_src;
const char *ptr_tst;
@@ -763,11 +825,11 @@ bfd_default_scan (info, string)
default architecture? */
if (strcasecmp (string, info->arch_name) == 0
&& info->the_default)
- return true;
+ return TRUE;
/* Exact match of the machine name (PRINTABLE_NAME)? */
if (strcasecmp (string, info->printable_name) == 0)
- return true;
+ return TRUE;
/* Given that printable_name contains no colon, attempt to match:
ARCH_NAME [ ":" ] PRINTABLE_NAME? */
@@ -781,13 +843,13 @@ bfd_default_scan (info, string)
{
if (strcasecmp (string + strlen_arch_name + 1,
info->printable_name) == 0)
- return true;
+ return TRUE;
}
else
{
if (strcasecmp (string + strlen_arch_name,
info->printable_name) == 0)
- return true;
+ return TRUE;
}
}
}
@@ -800,11 +862,11 @@ bfd_default_scan (info, string)
if (strncasecmp (string, info->printable_name, colon_index) == 0
&& strcasecmp (string + colon_index,
info->printable_name + colon_index + 1) == 0)
- return true;
+ return TRUE;
}
/* Given that PRINTABLE_NAME has the form: <arch> ":" <mach>; Do not
- attempt to match just <mach>, it could be ambigious. This test
+ attempt to match just <mach>, it could be ambiguous. This test
is left until later. */
/* NOTE: The below is retained for compatibility only. Please do
@@ -903,6 +965,10 @@ bfd_default_scan (info, string)
arch = bfd_arch_m68k;
number = bfd_mach_mcf5407;
break;
+ case 5282:
+ arch = bfd_arch_m68k;
+ number = bfd_mach_mcf528x;
+ break;
case 32000:
arch = bfd_arch_we32k;
@@ -943,16 +1009,16 @@ bfd_default_scan (info, string)
break;
default:
- return false;
+ return FALSE;
}
if (arch != info->arch)
- return false;
+ return FALSE;
if (number != info->mach)
- return false;
+ return FALSE;
- return true;
+ return TRUE;
}
/*
@@ -960,15 +1026,14 @@ FUNCTION
bfd_get_arch_info
SYNOPSIS
- const bfd_arch_info_type * bfd_get_arch_info(bfd *abfd);
+ const bfd_arch_info_type *bfd_get_arch_info (bfd *abfd);
DESCRIPTION
Return the architecture info struct in @var{abfd}.
*/
const bfd_arch_info_type *
-bfd_get_arch_info (abfd)
- bfd *abfd;
+bfd_get_arch_info (bfd *abfd)
{
return abfd->arch_info;
}
@@ -979,21 +1044,17 @@ FUNCTION
SYNOPSIS
const bfd_arch_info_type *bfd_lookup_arch
- (enum bfd_architecture
- arch,
- unsigned long machine);
+ (enum bfd_architecture arch, unsigned long machine);
DESCRIPTION
- Look for the architecure info structure which matches the
+ Look for the architecture info structure which matches the
arguments @var{arch} and @var{machine}. A machine of 0 matches the
machine/architecture structure which marks itself as the
default.
*/
const bfd_arch_info_type *
-bfd_lookup_arch (arch, machine)
- enum bfd_architecture arch;
- unsigned long machine;
+bfd_lookup_arch (enum bfd_architecture arch, unsigned long machine)
{
const bfd_arch_info_type * const *app, *ap;
@@ -1017,7 +1078,7 @@ FUNCTION
SYNOPSIS
const char *bfd_printable_arch_mach
- (enum bfd_architecture arch, unsigned long machine);
+ (enum bfd_architecture arch, unsigned long machine);
DESCRIPTION
Return a printable string representing the architecture and
@@ -1027,9 +1088,7 @@ DESCRIPTION
*/
const char *
-bfd_printable_arch_mach (arch, machine)
- enum bfd_architecture arch;
- unsigned long machine;
+bfd_printable_arch_mach (enum bfd_architecture arch, unsigned long machine)
{
const bfd_arch_info_type *ap = bfd_lookup_arch (arch, machine);
@@ -1043,7 +1102,7 @@ FUNCTION
bfd_octets_per_byte
SYNOPSIS
- unsigned int bfd_octets_per_byte(bfd *abfd);
+ unsigned int bfd_octets_per_byte (bfd *abfd);
DESCRIPTION
Return the number of octets (8-bit quantities) per target byte
@@ -1052,8 +1111,7 @@ DESCRIPTION
*/
unsigned int
-bfd_octets_per_byte (abfd)
- bfd *abfd;
+bfd_octets_per_byte (bfd *abfd)
{
return bfd_arch_mach_octets_per_byte (bfd_get_arch (abfd),
bfd_get_mach (abfd));
@@ -1064,8 +1122,8 @@ FUNCTION
bfd_arch_mach_octets_per_byte
SYNOPSIS
- unsigned int bfd_arch_mach_octets_per_byte(enum bfd_architecture arch,
- unsigned long machine);
+ unsigned int bfd_arch_mach_octets_per_byte
+ (enum bfd_architecture arch, unsigned long machine);
DESCRIPTION
See bfd_octets_per_byte.
@@ -1075,9 +1133,8 @@ DESCRIPTION
*/
unsigned int
-bfd_arch_mach_octets_per_byte (arch, mach)
- enum bfd_architecture arch;
- unsigned long mach;
+bfd_arch_mach_octets_per_byte (enum bfd_architecture arch,
+ unsigned long mach)
{
const bfd_arch_info_type *ap = bfd_lookup_arch (arch, mach);
diff --git a/contrib/binutils/bfd/bfd-in.h b/contrib/binutils/bfd/bfd-in.h
index f0f8cfd..1a5d1ea 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
- Free Software Foundation, Inc.
+
+ Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
+ 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
+
Contributed by Cygnus Support.
This file is part of BFD, the Binary File Descriptor library.
@@ -41,10 +42,6 @@ extern "C" {
#endif
#endif
-#define BFD_VERSION @bfd_version@
-#define BFD_VERSION_DATE @bfd_version_date@
-#define BFD_VERSION_STRING @bfd_version_string@
-
/* The word size used by BFD on the host. This may be 64 with a 32
bit target if the host is 64 bit, or if other 64 bit targets have
been selected with --enable-targets, or if --enable-64-bit-bfd. */
@@ -54,9 +51,12 @@ extern "C" {
#define BFD_DEFAULT_TARGET_SIZE @bfd_default_target_size@
#define BFD_HOST_64BIT_LONG @BFD_HOST_64BIT_LONG@
+#define BFD_HOST_LONG_LONG @BFD_HOST_LONG_LONG@
#if @BFD_HOST_64_BIT_DEFINED@
#define BFD_HOST_64_BIT @BFD_HOST_64_BIT@
#define BFD_HOST_U_64_BIT @BFD_HOST_U_64_BIT@
+typedef BFD_HOST_64_BIT bfd_int64_t;
+typedef BFD_HOST_U_64_BIT bfd_uint64_t;
#endif
#if BFD_ARCH_SIZE >= 64
@@ -72,66 +72,31 @@ extern "C" {
#endif
/* Forward declaration. */
-typedef struct _bfd bfd;
-
-/* To squelch erroneous compiler warnings ("illegal pointer
- combination") from the SVR3 compiler, we would like to typedef
- boolean to int (it doesn't like functions which return boolean.
- Making sure they are never implicitly declared to return int
- doesn't seem to help). But this file is not configured based on
- the host. */
-/* General rules: functions which are boolean return true on success
- and false on failure (unless they're a predicate). -- bfd.doc */
-/* I'm sure this is going to break something and someone is going to
- force me to change it. */
-/* typedef enum boolean {false, true} boolean; */
-/* Yup, SVR4 has a "typedef enum boolean" in <sys/types.h> -fnf */
-/* It gets worse if the host also defines a true/false enum... -sts */
-/* And even worse if your compiler has built-in boolean types... -law */
-/* And even worse if your compiler provides a stdbool.h that conflicts
- with these definitions... gcc 2.95 and later do. If so, it must
- be included first. -drow */
-#if defined (__GNUG__) && (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 6))
-#define TRUE_FALSE_ALREADY_DEFINED
-#else
-#if defined (__bool_true_false_are_defined)
-/* We have <stdbool.h>. */
-#define TRUE_FALSE_ALREADY_DEFINED
-#endif
-#endif
-#ifdef MPW
-/* Pre-emptive strike - get the file with the enum. */
-#include <Types.h>
-#define TRUE_FALSE_ALREADY_DEFINED
-#endif /* MPW */
-#ifndef TRUE_FALSE_ALREADY_DEFINED
-typedef enum bfd_boolean {false, true} boolean;
-#define BFD_TRUE_FALSE
-#else
-/* Use enum names that will appear nowhere else. */
-typedef enum bfd_boolean {bfd_fffalse, bfd_tttrue} boolean;
+typedef struct bfd bfd;
+
+/* Boolean type used in bfd. Too many systems define their own
+ versions of "boolean" for us to safely typedef a "boolean" of
+ our own. Using an enum for "bfd_boolean" has its own set of
+ problems, with strange looking casts required to avoid warnings
+ on some older compilers. Thus we just use an int.
+
+ General rule: Functions which are bfd_boolean return TRUE on
+ success and FALSE on failure (unless they're a predicate). */
+
+typedef int bfd_boolean;
+#undef FALSE
+#undef TRUE
+#define FALSE 0
+#define TRUE 1
+
+#if 0
+/* Poison. */
+#undef false
+#undef true
+#define false dont_use_false_in_bfd
+#define true dont_use_true_in_bfd
#endif
-/* Support for different sizes of target format ints and addresses.
- If the type `long' is at least 64 bits, BFD_HOST_64BIT_LONG will be
- set to 1 above. Otherwise, if gcc is being used, this code will
- use gcc's "long long" type. Otherwise, BFD_HOST_64_BIT must be
- defined above. */
-
-#ifndef BFD_HOST_64_BIT
-# if BFD_HOST_64BIT_LONG
-# define BFD_HOST_64_BIT long
-# define BFD_HOST_U_64_BIT unsigned long
-# else
-# ifdef __GNUC__
-# if __GNUC__ >= 2
-# define BFD_HOST_64_BIT long long
-# define BFD_HOST_U_64_BIT unsigned long long
-# endif /* __GNUC__ >= 2 */
-# endif /* ! defined (__GNUC__) */
-# endif /* ! BFD_HOST_64BIT_LONG */
-#endif /* ! defined (BFD_HOST_64_BIT) */
-
#ifdef BFD64
#ifndef BFD_HOST_64_BIT
@@ -179,19 +144,22 @@ typedef unsigned long bfd_size_type;
#endif /* not BFD64 */
-/* A pointer to a position in a file. */
-/* FIXME: This should be using off_t from <sys/types.h>.
- For now, try to avoid breaking stuff by not including <sys/types.h> here.
- This will break on systems with 64-bit file offsets (e.g. 4.4BSD).
- Probably the best long-term answer is to avoid using file_ptr AND off_t
- in this header file, and to handle this in the BFD implementation
- rather than in its interface. */
-/* typedef off_t file_ptr; */
-typedef bfd_signed_vma file_ptr;
-typedef bfd_vma ufile_ptr;
+#ifndef BFD_HOST_64_BIT
+/* Fall back on a 32 bit type. The idea is to make these types always
+ available for function return types, but in the case that
+ BFD_HOST_64_BIT is undefined such a function should abort or
+ otherwise signal an error. */
+typedef bfd_signed_vma bfd_int64_t;
+typedef bfd_vma bfd_uint64_t;
+#endif
+
+/* An offset into a file. BFD always uses the largest possible offset
+ based on the build time availability of fseek, fseeko, or fseeko64. */
+typedef @bfd_file_ptr@ file_ptr;
+typedef unsigned @bfd_file_ptr@ ufile_ptr;
-extern void bfd_sprintf_vma PARAMS ((bfd *, char *, bfd_vma));
-extern void bfd_fprintf_vma PARAMS ((bfd *, PTR, bfd_vma));
+extern void bfd_sprintf_vma (bfd *, char *, bfd_vma);
+extern void bfd_fprintf_vma (bfd *, void *, bfd_vma);
#define printf_vma(x) fprintf_vma(stdout,x)
#define bfd_printf_vma(abfd,x) bfd_fprintf_vma (abfd,stdout,x)
@@ -204,7 +172,7 @@ typedef unsigned char bfd_byte;
typedef enum bfd_format
{
bfd_unknown = 0, /* File format is unknown. */
- bfd_object, /* Linker/assember/compiler output. */
+ bfd_object, /* Linker/assembler/compiler output. */
bfd_archive, /* Object archive file. */
bfd_core, /* Core dump. */
bfd_type_end /* Marks the end; don't use it! */
@@ -267,6 +235,9 @@ bfd_format;
/* This flag indicates that the BFD contents are actually cached in
memory. If this is set, iostream points to a bfd_in_memory struct. */
#define BFD_IN_MEMORY 0x800
+
+/* The sections in this BFD specify a memory page. */
+#define HAS_LOAD_PAGE 0x1000
/* Symbols and relocation. */
@@ -319,7 +290,7 @@ typedef struct lineno_cache_entry
unsigned int line_number; /* Linenumber from start of function. */
union
{
- struct symbol_cache_entry *sym; /* Function name. */
+ struct bfd_symbol *sym; /* Function name. */
bfd_vma offset; /* Offset into section. */
} u;
}
@@ -330,7 +301,7 @@ alent;
#define align_power(addr, align) \
(((addr) + ((bfd_vma) 1 << (align)) - 1) & ((bfd_vma) -1 << (align)))
-typedef struct sec *sec_ptr;
+typedef struct bfd_section *sec_ptr;
#define bfd_get_section_name(bfd, ptr) ((ptr)->name + 0)
#define bfd_get_section_vma(bfd, ptr) ((ptr)->vma + 0)
@@ -346,9 +317,9 @@ typedef struct sec *sec_ptr;
#define bfd_is_com_section(ptr) (((ptr)->flags & SEC_IS_COMMON) != 0)
-#define bfd_set_section_vma(bfd, ptr, val) (((ptr)->vma = (ptr)->lma = (val)), ((ptr)->user_set_vma = (unsigned int)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)
+#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;
@@ -374,7 +345,7 @@ typedef struct _symbol_info
/* Get the name of a stabs type code. */
-extern const char *bfd_get_stab_name PARAMS ((int));
+extern const char *bfd_get_stab_name (int);
/* Hash table routines. There is no way to free up a hash table. */
@@ -407,75 +378,74 @@ struct bfd_hash_table
built each of which calls the function in the superclass. Thus
each function should be written to allocate a new block of memory
only if the argument is NULL. */
- struct bfd_hash_entry *(*newfunc) PARAMS ((struct bfd_hash_entry *,
- struct bfd_hash_table *,
- const char *));
+ struct bfd_hash_entry *(*newfunc)
+ (struct bfd_hash_entry *, struct bfd_hash_table *, const char *);
/* An objalloc for this hash table. This is a struct objalloc *,
- but we use PTR to avoid requiring the inclusion of objalloc.h. */
- PTR memory;
+ but we use void * to avoid requiring the inclusion of objalloc.h. */
+ void *memory;
};
/* Initialize a hash table. */
-extern boolean bfd_hash_table_init
- PARAMS ((struct bfd_hash_table *,
- struct bfd_hash_entry *(*) (struct bfd_hash_entry *,
- struct bfd_hash_table *,
- const char *)));
+extern bfd_boolean bfd_hash_table_init
+ (struct bfd_hash_table *,
+ struct bfd_hash_entry *(*) (struct bfd_hash_entry *,
+ struct bfd_hash_table *,
+ const char *));
/* Initialize a hash table specifying a size. */
-extern boolean bfd_hash_table_init_n
- PARAMS ((struct bfd_hash_table *,
- struct bfd_hash_entry *(*) (struct bfd_hash_entry *,
- struct bfd_hash_table *,
- const char *),
- unsigned int size));
+extern bfd_boolean bfd_hash_table_init_n
+ (struct bfd_hash_table *,
+ struct bfd_hash_entry *(*) (struct bfd_hash_entry *,
+ struct bfd_hash_table *,
+ const char *),
+ unsigned int size);
/* Free up a hash table. */
-extern void bfd_hash_table_free PARAMS ((struct bfd_hash_table *));
+extern void bfd_hash_table_free
+ (struct bfd_hash_table *);
-/* Look up a string in a hash table. If CREATE is true, a new entry
+/* Look up a string in a hash table. If CREATE is TRUE, a new entry
will be created for this string if one does not already exist. The
- COPY argument must be true if this routine should copy the string
+ COPY argument must be TRUE if this routine should copy the string
into newly allocated memory when adding an entry. */
extern struct bfd_hash_entry *bfd_hash_lookup
- PARAMS ((struct bfd_hash_table *, const char *, boolean create,
- boolean copy));
+ (struct bfd_hash_table *, const char *, bfd_boolean create,
+ bfd_boolean copy);
/* Replace an entry in a hash table. */
extern void bfd_hash_replace
- PARAMS ((struct bfd_hash_table *, struct bfd_hash_entry *old,
- struct bfd_hash_entry *nw));
+ (struct bfd_hash_table *, struct bfd_hash_entry *old,
+ struct bfd_hash_entry *nw);
/* Base method for creating a hash table entry. */
extern struct bfd_hash_entry *bfd_hash_newfunc
- PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *,
- const char *));
+ (struct bfd_hash_entry *, struct bfd_hash_table *, const char *);
/* Grab some space for a hash table entry. */
-extern PTR bfd_hash_allocate PARAMS ((struct bfd_hash_table *,
- unsigned int));
+extern void *bfd_hash_allocate
+ (struct bfd_hash_table *, unsigned int);
/* Traverse a hash table in a random order, calling a function on each
- element. If the function returns false, the traversal stops. The
+ element. If the function returns FALSE, the traversal stops. The
INFO argument is passed to the function. */
-extern void bfd_hash_traverse PARAMS ((struct bfd_hash_table *,
- boolean (*) (struct bfd_hash_entry *,
- PTR),
- PTR info));
+extern void bfd_hash_traverse
+ (struct bfd_hash_table *,
+ bfd_boolean (*) (struct bfd_hash_entry *, void *),
+ void *info);
-#define COFF_SWAP_TABLE (PTR) &bfd_coff_std_swap_table
+#define COFF_SWAP_TABLE (void *) &bfd_coff_std_swap_table
/* User program access to BFD facilities. */
/* Direct I/O routines, for programs which know more about the object
file than BFD does. Use higher level routines if possible. */
-extern bfd_size_type bfd_bread PARAMS ((PTR, bfd_size_type, bfd *));
-extern bfd_size_type bfd_bwrite PARAMS ((const PTR, bfd_size_type, bfd *));
-extern int bfd_seek PARAMS ((bfd *, file_ptr, int));
-extern ufile_ptr bfd_tell PARAMS ((bfd *));
-extern int bfd_flush PARAMS ((bfd *));
-extern int bfd_stat PARAMS ((bfd *, struct stat *));
+extern bfd_size_type bfd_bread (void *, bfd_size_type, bfd *);
+extern bfd_size_type bfd_bwrite (const void *, bfd_size_type, bfd *);
+extern int bfd_seek (bfd *, file_ptr, int);
+extern file_ptr bfd_tell (bfd *);
+extern int bfd_flush (bfd *);
+extern int bfd_stat (bfd *, struct stat *);
/* Deprecated old routines. */
#if __GNUC__
@@ -493,8 +463,7 @@ extern int bfd_stat PARAMS ((bfd *, struct stat *));
(warn_deprecated ("bfd_write", (const char *) 0, 0, (const char *) 0),\
bfd_bwrite ((BUF), (ELTSIZE) * (NITEMS), (ABFD)))
#endif
-extern void warn_deprecated
- PARAMS ((const char *, const char *, int, const char *));
+extern void warn_deprecated (const char *, const char *, int, const char *);
/* Cast from const char * to char * so that caller can assign to
a char * without a warning. */
@@ -530,40 +499,41 @@ extern void warn_deprecated
#define bfd_get_symbol_leading_char(abfd) ((abfd)->xvec->symbol_leading_char)
-#define bfd_set_cacheable(abfd,bool) (((abfd)->cacheable = (boolean) (bool)), true)
+#define bfd_set_cacheable(abfd,bool) (((abfd)->cacheable = bool), TRUE)
-extern boolean bfd_cache_close PARAMS ((bfd *abfd));
+extern bfd_boolean bfd_cache_close
+ (bfd *abfd);
/* NB: This declaration should match the autogenerated one in libbfd.h. */
-extern boolean bfd_record_phdr
- PARAMS ((bfd *, unsigned long, boolean, flagword, boolean, bfd_vma,
- boolean, boolean, unsigned int, struct sec **));
+extern bfd_boolean bfd_record_phdr
+ (bfd *, unsigned long, bfd_boolean, flagword, bfd_boolean, bfd_vma,
+ bfd_boolean, bfd_boolean, unsigned int, struct bfd_section **);
/* Byte swapping routines. */
-bfd_vma bfd_getb64 PARAMS ((const unsigned char *));
-bfd_vma bfd_getl64 PARAMS ((const unsigned char *));
-bfd_signed_vma bfd_getb_signed_64 PARAMS ((const unsigned char *));
-bfd_signed_vma bfd_getl_signed_64 PARAMS ((const unsigned char *));
-bfd_vma bfd_getb32 PARAMS ((const unsigned char *));
-bfd_vma bfd_getl32 PARAMS ((const unsigned char *));
-bfd_signed_vma bfd_getb_signed_32 PARAMS ((const unsigned char *));
-bfd_signed_vma bfd_getl_signed_32 PARAMS ((const unsigned char *));
-bfd_vma bfd_getb16 PARAMS ((const unsigned char *));
-bfd_vma bfd_getl16 PARAMS ((const unsigned char *));
-bfd_signed_vma bfd_getb_signed_16 PARAMS ((const unsigned char *));
-bfd_signed_vma bfd_getl_signed_16 PARAMS ((const unsigned char *));
-void bfd_putb64 PARAMS ((bfd_vma, unsigned char *));
-void bfd_putl64 PARAMS ((bfd_vma, unsigned char *));
-void bfd_putb32 PARAMS ((bfd_vma, unsigned char *));
-void bfd_putl32 PARAMS ((bfd_vma, unsigned char *));
-void bfd_putb16 PARAMS ((bfd_vma, unsigned char *));
-void bfd_putl16 PARAMS ((bfd_vma, unsigned char *));
+bfd_uint64_t bfd_getb64 (const void *);
+bfd_uint64_t bfd_getl64 (const void *);
+bfd_int64_t bfd_getb_signed_64 (const void *);
+bfd_int64_t bfd_getl_signed_64 (const void *);
+bfd_vma bfd_getb32 (const void *);
+bfd_vma bfd_getl32 (const void *);
+bfd_signed_vma bfd_getb_signed_32 (const void *);
+bfd_signed_vma bfd_getl_signed_32 (const void *);
+bfd_vma bfd_getb16 (const void *);
+bfd_vma bfd_getl16 (const void *);
+bfd_signed_vma bfd_getb_signed_16 (const void *);
+bfd_signed_vma bfd_getl_signed_16 (const void *);
+void bfd_putb64 (bfd_uint64_t, void *);
+void bfd_putl64 (bfd_uint64_t, void *);
+void bfd_putb32 (bfd_vma, void *);
+void bfd_putl32 (bfd_vma, void *);
+void bfd_putb16 (bfd_vma, void *);
+void bfd_putl16 (bfd_vma, void *);
/* Byte swapping routines which take size and endiannes as arguments. */
-bfd_vma bfd_get_bits PARAMS ((bfd_byte *, int, boolean));
-void bfd_put_bits PARAMS ((bfd_vma, bfd_byte *, int, boolean));
+bfd_uint64_t bfd_get_bits (const void *, int, bfd_boolean);
+void bfd_put_bits (bfd_uint64_t, void *, int, bfd_boolean);
/* Externally visible ECOFF routines. */
@@ -571,59 +541,54 @@ void bfd_put_bits PARAMS ((bfd_vma, bfd_byte *, int, boolean));
struct ecoff_debug_info;
struct ecoff_debug_swap;
struct ecoff_extr;
-struct symbol_cache_entry;
+struct bfd_symbol;
struct bfd_link_info;
struct bfd_link_hash_entry;
struct bfd_elf_version_tree;
#endif
-extern bfd_vma bfd_ecoff_get_gp_value PARAMS ((bfd * abfd));
-extern boolean bfd_ecoff_set_gp_value PARAMS ((bfd *abfd, bfd_vma gp_value));
-extern boolean bfd_ecoff_set_regmasks
- PARAMS ((bfd *abfd, unsigned long gprmask, unsigned long fprmask,
- unsigned long *cprmask));
-extern PTR bfd_ecoff_debug_init
- PARAMS ((bfd *output_bfd, struct ecoff_debug_info *output_debug,
- const struct ecoff_debug_swap *output_swap,
- struct bfd_link_info *));
+extern bfd_vma bfd_ecoff_get_gp_value
+ (bfd * abfd);
+extern bfd_boolean bfd_ecoff_set_gp_value
+ (bfd *abfd, bfd_vma gp_value);
+extern bfd_boolean bfd_ecoff_set_regmasks
+ (bfd *abfd, unsigned long gprmask, unsigned long fprmask,
+ unsigned long *cprmask);
+extern void *bfd_ecoff_debug_init
+ (bfd *output_bfd, struct ecoff_debug_info *output_debug,
+ const struct ecoff_debug_swap *output_swap, struct bfd_link_info *);
extern void bfd_ecoff_debug_free
- PARAMS ((PTR handle, bfd *output_bfd, struct ecoff_debug_info *output_debug,
- const struct ecoff_debug_swap *output_swap,
- struct bfd_link_info *));
-extern boolean bfd_ecoff_debug_accumulate
- PARAMS ((PTR handle, bfd *output_bfd, struct ecoff_debug_info *output_debug,
- const struct ecoff_debug_swap *output_swap,
- bfd *input_bfd, struct ecoff_debug_info *input_debug,
- const struct ecoff_debug_swap *input_swap,
- struct bfd_link_info *));
-extern boolean bfd_ecoff_debug_accumulate_other
- PARAMS ((PTR handle, bfd *output_bfd, struct ecoff_debug_info *output_debug,
- const struct ecoff_debug_swap *output_swap, bfd *input_bfd,
- struct bfd_link_info *));
-extern boolean bfd_ecoff_debug_externals
- PARAMS ((bfd *abfd, struct ecoff_debug_info *debug,
- const struct ecoff_debug_swap *swap,
- boolean relocateable,
- boolean (*get_extr) (struct symbol_cache_entry *,
- struct ecoff_extr *),
- void (*set_index) (struct symbol_cache_entry *,
- bfd_size_type)));
-extern boolean bfd_ecoff_debug_one_external
- PARAMS ((bfd *abfd, struct ecoff_debug_info *debug,
- const struct ecoff_debug_swap *swap,
- const char *name, struct ecoff_extr *esym));
+ (void *handle, bfd *output_bfd, struct ecoff_debug_info *output_debug,
+ const struct ecoff_debug_swap *output_swap, struct bfd_link_info *);
+extern bfd_boolean bfd_ecoff_debug_accumulate
+ (void *handle, bfd *output_bfd, struct ecoff_debug_info *output_debug,
+ const struct ecoff_debug_swap *output_swap, bfd *input_bfd,
+ struct ecoff_debug_info *input_debug,
+ const struct ecoff_debug_swap *input_swap, struct bfd_link_info *);
+extern bfd_boolean bfd_ecoff_debug_accumulate_other
+ (void *handle, bfd *output_bfd, struct ecoff_debug_info *output_debug,
+ const struct ecoff_debug_swap *output_swap, bfd *input_bfd,
+ struct bfd_link_info *);
+extern bfd_boolean bfd_ecoff_debug_externals
+ (bfd *abfd, struct ecoff_debug_info *debug,
+ const struct ecoff_debug_swap *swap, bfd_boolean relocatable,
+ bfd_boolean (*get_extr) (struct bfd_symbol *, struct ecoff_extr *),
+ void (*set_index) (struct bfd_symbol *, bfd_size_type));
+extern bfd_boolean bfd_ecoff_debug_one_external
+ (bfd *abfd, struct ecoff_debug_info *debug,
+ const struct ecoff_debug_swap *swap, const char *name,
+ struct ecoff_extr *esym);
extern bfd_size_type bfd_ecoff_debug_size
- PARAMS ((bfd *abfd, struct ecoff_debug_info *debug,
- const struct ecoff_debug_swap *swap));
-extern boolean bfd_ecoff_write_debug
- PARAMS ((bfd *abfd, struct ecoff_debug_info *debug,
- const struct ecoff_debug_swap *swap, file_ptr where));
-extern boolean bfd_ecoff_write_accumulated_debug
- PARAMS ((PTR handle, bfd *abfd, struct ecoff_debug_info *debug,
- const struct ecoff_debug_swap *swap,
- struct bfd_link_info *info, file_ptr where));
-extern boolean bfd_mips_ecoff_create_embedded_relocs
- PARAMS ((bfd *, struct bfd_link_info *, struct sec *, struct sec *,
- char **));
+ (bfd *abfd, struct ecoff_debug_info *debug,
+ const struct ecoff_debug_swap *swap);
+extern bfd_boolean bfd_ecoff_write_debug
+ (bfd *abfd, struct ecoff_debug_info *debug,
+ const struct ecoff_debug_swap *swap, file_ptr where);
+extern bfd_boolean bfd_ecoff_write_accumulated_debug
+ (void *handle, bfd *abfd, struct ecoff_debug_info *debug,
+ const struct ecoff_debug_swap *swap,
+ struct bfd_link_info *info, file_ptr where);
+extern bfd_boolean bfd_mips_ecoff_create_embedded_relocs
+ (bfd *, struct bfd_link_info *, struct bfd_section *, struct bfd_section *, char **);
/* Externally visible ELF routines. */
@@ -634,36 +599,37 @@ struct bfd_link_needed_list
const char *name;
};
-extern boolean bfd_elf32_record_link_assignment
- PARAMS ((bfd *, struct bfd_link_info *, const char *, boolean));
-extern boolean bfd_elf64_record_link_assignment
- PARAMS ((bfd *, struct bfd_link_info *, const char *, boolean));
+enum dynamic_lib_link_class {
+ DYN_NORMAL = 0,
+ DYN_AS_NEEDED = 1,
+ DYN_DT_NEEDED = 2
+};
+
+extern bfd_boolean bfd_elf_record_link_assignment
+ (bfd *, struct bfd_link_info *, const char *, bfd_boolean);
extern struct bfd_link_needed_list *bfd_elf_get_needed_list
- PARAMS ((bfd *, struct bfd_link_info *));
-extern boolean bfd_elf_get_bfd_needed_list
- PARAMS ((bfd *, struct bfd_link_needed_list **));
-extern boolean bfd_elf32_size_dynamic_sections
- PARAMS ((bfd *, const char *, const char *, const char *,
- const char * const *, struct bfd_link_info *, struct sec **,
- struct bfd_elf_version_tree *));
-extern boolean bfd_elf64_size_dynamic_sections
- PARAMS ((bfd *, const char *, const char *, const char *,
- const char * const *, struct bfd_link_info *, struct sec **,
- struct bfd_elf_version_tree *));
-extern void bfd_elf_set_dt_needed_name PARAMS ((bfd *, const char *));
-extern void bfd_elf_set_dt_needed_soname PARAMS ((bfd *, const char *));
-extern const char *bfd_elf_get_dt_soname PARAMS ((bfd *));
+ (bfd *, struct bfd_link_info *);
+extern bfd_boolean bfd_elf_get_bfd_needed_list
+ (bfd *, struct bfd_link_needed_list **);
+extern bfd_boolean bfd_elf_size_dynamic_sections
+ (bfd *, const char *, const char *, const char *, const char * const *,
+ struct bfd_link_info *, struct bfd_section **, struct bfd_elf_version_tree *);
+extern void bfd_elf_set_dt_needed_name
+ (bfd *, const char *);
+extern const char *bfd_elf_get_dt_soname
+ (bfd *);
+extern void bfd_elf_set_dyn_lib_class
+ (bfd *, int);
extern struct bfd_link_needed_list *bfd_elf_get_runpath_list
- PARAMS ((bfd *, struct bfd_link_info *));
-extern boolean bfd_elf32_discard_info
- PARAMS ((bfd *, struct bfd_link_info *));
-extern boolean bfd_elf64_discard_info
- PARAMS ((bfd *, struct bfd_link_info *));
+ (bfd *, struct bfd_link_info *);
+extern bfd_boolean bfd_elf_discard_info
+ (bfd *, struct bfd_link_info *);
/* Return an upper bound on the number of bytes required to store a
copy of ABFD's program header table entries. Return -1 if an error
occurs; bfd_get_error will return an appropriate code. */
-extern long bfd_get_elf_phdr_upper_bound PARAMS ((bfd *abfd));
+extern long bfd_get_elf_phdr_upper_bound
+ (bfd *abfd);
/* Copy ABFD's program header table entries to *PHDRS. The entries
will be stored as an array of Elf_Internal_Phdr structures, as
@@ -672,39 +638,58 @@ extern long bfd_get_elf_phdr_upper_bound PARAMS ((bfd *abfd));
Return the number of program header table entries read, or -1 if an
error occurs; bfd_get_error will return an appropriate code. */
-extern int bfd_get_elf_phdrs PARAMS ((bfd *abfd, void *phdrs));
+extern int bfd_get_elf_phdrs
+ (bfd *abfd, void *phdrs);
+
+/* Create a new BFD as if by bfd_openr. Rather than opening a file,
+ reconstruct an ELF file by reading the segments out of remote memory
+ based on the ELF file header at EHDR_VMA and the ELF program headers it
+ points to. If not null, *LOADBASEP is filled in with the difference
+ between the VMAs from which the segments were read, and the VMAs the
+ file headers (and hence BFD's idea of each section's VMA) put them at.
+
+ The function TARGET_READ_MEMORY is called to copy LEN bytes from the
+ remote memory at target address VMA into the local buffer at MYADDR; it
+ should return zero on success or an `errno' code on failure. TEMPL must
+ be a BFD for an ELF target with the word size and byte order found in
+ the remote memory. */
+extern bfd *bfd_elf_bfd_from_remote_memory
+ (bfd *templ, bfd_vma ehdr_vma, bfd_vma *loadbasep,
+ int (*target_read_memory) (bfd_vma vma, char *myaddr, int len));
/* Return the arch_size field of an elf bfd, or -1 if not elf. */
-extern int bfd_get_arch_size PARAMS ((bfd *));
+extern int bfd_get_arch_size
+ (bfd *);
+
+/* Return TRUE if address "naturally" sign extends, or -1 if not elf. */
+extern int bfd_get_sign_extend_vma
+ (bfd *);
-/* Return true if address "naturally" sign extends, or -1 if not elf. */
-extern int bfd_get_sign_extend_vma PARAMS ((bfd *));
+extern struct bfd_section *_bfd_elf_tls_setup
+ (bfd *, struct bfd_link_info *);
-extern boolean bfd_m68k_elf32_create_embedded_relocs
- PARAMS ((bfd *, struct bfd_link_info *, struct sec *, struct sec *,
- char **));
-extern boolean bfd_mips_elf32_create_embedded_relocs
- PARAMS ((bfd *, struct bfd_link_info *, struct sec *, struct sec *,
- char **));
+extern bfd_boolean bfd_m68k_elf32_create_embedded_relocs
+ (bfd *, struct bfd_link_info *, struct bfd_section *, struct bfd_section *, char **);
+extern bfd_boolean bfd_mips_elf32_create_embedded_relocs
+ (bfd *, struct bfd_link_info *, struct bfd_section *, struct bfd_section *, char **);
/* SunOS shared library support routines for the linker. */
extern struct bfd_link_needed_list *bfd_sunos_get_needed_list
- PARAMS ((bfd *, struct bfd_link_info *));
-extern boolean bfd_sunos_record_link_assignment
- PARAMS ((bfd *, struct bfd_link_info *, const char *));
-extern boolean bfd_sunos_size_dynamic_sections
- PARAMS ((bfd *, struct bfd_link_info *, struct sec **, struct sec **,
- struct sec **));
+ (bfd *, struct bfd_link_info *);
+extern bfd_boolean bfd_sunos_record_link_assignment
+ (bfd *, struct bfd_link_info *, const char *);
+extern bfd_boolean bfd_sunos_size_dynamic_sections
+ (bfd *, struct bfd_link_info *, struct bfd_section **, struct bfd_section **, struct bfd_section **);
/* Linux shared library support routines for the linker. */
-extern boolean bfd_i386linux_size_dynamic_sections
- PARAMS ((bfd *, struct bfd_link_info *));
-extern boolean bfd_m68klinux_size_dynamic_sections
- PARAMS ((bfd *, struct bfd_link_info *));
-extern boolean bfd_sparclinux_size_dynamic_sections
- PARAMS ((bfd *, struct bfd_link_info *));
+extern bfd_boolean bfd_i386linux_size_dynamic_sections
+ (bfd *, struct bfd_link_info *);
+extern bfd_boolean bfd_m68klinux_size_dynamic_sections
+ (bfd *, struct bfd_link_info *);
+extern bfd_boolean bfd_sparclinux_size_dynamic_sections
+ (bfd *, struct bfd_link_info *);
/* mmap hacks */
@@ -714,7 +699,7 @@ typedef struct _bfd_window_internal bfd_window_internal;
typedef struct _bfd_window
{
/* What the user asked for. */
- PTR data;
+ void *data;
bfd_size_type size;
/* The actual window used by BFD. Small user-requested read-only
regions sharing a page may share a single window into the object
@@ -726,34 +711,36 @@ typedef struct _bfd_window
}
bfd_window;
-extern void bfd_init_window PARAMS ((bfd_window *));
-extern void bfd_free_window PARAMS ((bfd_window *));
-extern boolean bfd_get_file_window
- PARAMS ((bfd *, file_ptr, bfd_size_type, bfd_window *, boolean));
+extern void bfd_init_window
+ (bfd_window *);
+extern void bfd_free_window
+ (bfd_window *);
+extern bfd_boolean bfd_get_file_window
+ (bfd *, file_ptr, bfd_size_type, bfd_window *, bfd_boolean);
/* XCOFF support routines for the linker. */
-extern boolean bfd_xcoff_link_record_set
- PARAMS ((bfd *, struct bfd_link_info *, struct bfd_link_hash_entry *,
- bfd_size_type));
-extern boolean bfd_xcoff_import_symbol
- PARAMS ((bfd *, struct bfd_link_info *, struct bfd_link_hash_entry *,
- bfd_vma, const char *, const char *, const char *, unsigned int));
-extern boolean bfd_xcoff_export_symbol
- PARAMS ((bfd *, struct bfd_link_info *, struct bfd_link_hash_entry *));
-extern boolean bfd_xcoff_link_count_reloc
- PARAMS ((bfd *, struct bfd_link_info *, const char *));
-extern boolean bfd_xcoff_record_link_assignment
- PARAMS ((bfd *, struct bfd_link_info *, const char *));
-extern boolean bfd_xcoff_size_dynamic_sections
- PARAMS ((bfd *, struct bfd_link_info *, const char *, const char *,
- unsigned long, unsigned long, unsigned long, boolean,
- int, boolean, boolean, struct sec **, boolean));
-extern boolean bfd_xcoff_link_generate_rtinit
- PARAMS ((bfd *, const char *, const char *, boolean));
+extern bfd_boolean bfd_xcoff_link_record_set
+ (bfd *, struct bfd_link_info *, struct bfd_link_hash_entry *, bfd_size_type);
+extern bfd_boolean bfd_xcoff_import_symbol
+ (bfd *, struct bfd_link_info *, struct bfd_link_hash_entry *, bfd_vma,
+ const char *, const char *, const char *, unsigned int);
+extern bfd_boolean bfd_xcoff_export_symbol
+ (bfd *, struct bfd_link_info *, struct bfd_link_hash_entry *);
+extern bfd_boolean bfd_xcoff_link_count_reloc
+ (bfd *, struct bfd_link_info *, const char *);
+extern bfd_boolean bfd_xcoff_record_link_assignment
+ (bfd *, struct bfd_link_info *, const char *);
+extern bfd_boolean bfd_xcoff_size_dynamic_sections
+ (bfd *, struct bfd_link_info *, const char *, const char *,
+ unsigned long, unsigned long, unsigned long, bfd_boolean,
+ int, bfd_boolean, bfd_boolean, struct bfd_section **, bfd_boolean);
+extern bfd_boolean bfd_xcoff_link_generate_rtinit
+ (bfd *, const char *, const char *, bfd_boolean);
/* XCOFF support routines for ar. */
-extern boolean bfd_xcoff_ar_archive_set_magic PARAMS ((bfd *, char *));
+extern bfd_boolean bfd_xcoff_ar_archive_set_magic
+ (bfd *, char *);
/* Externally visible COFF routines. */
@@ -762,56 +749,76 @@ struct internal_syment;
union internal_auxent;
#endif
-extern boolean bfd_coff_get_syment
- PARAMS ((bfd *, struct symbol_cache_entry *, struct internal_syment *));
+extern bfd_boolean bfd_coff_get_syment
+ (bfd *, struct bfd_symbol *, struct internal_syment *);
-extern boolean bfd_coff_get_auxent
- PARAMS ((bfd *, struct symbol_cache_entry *, int, union internal_auxent *));
+extern bfd_boolean bfd_coff_get_auxent
+ (bfd *, struct bfd_symbol *, int, union internal_auxent *);
-extern boolean bfd_coff_set_symbol_class
- PARAMS ((bfd *, struct symbol_cache_entry *, unsigned int));
+extern bfd_boolean bfd_coff_set_symbol_class
+ (bfd *, struct bfd_symbol *, unsigned int);
-extern boolean bfd_m68k_coff_create_embedded_relocs
- PARAMS ((bfd *, struct bfd_link_info *, struct sec *, struct sec *,
- char **));
+extern bfd_boolean bfd_m68k_coff_create_embedded_relocs
+ (bfd *, struct bfd_link_info *, struct bfd_section *, struct bfd_section *, char **);
/* ARM Interworking support. Called from linker. */
-extern boolean bfd_arm_allocate_interworking_sections
- PARAMS ((struct bfd_link_info *));
+extern bfd_boolean bfd_arm_allocate_interworking_sections
+ (struct bfd_link_info *);
-extern boolean bfd_arm_process_before_allocation
- PARAMS ((bfd *, struct bfd_link_info *, int));
+extern bfd_boolean bfd_arm_process_before_allocation
+ (bfd *, struct bfd_link_info *, int);
-extern boolean bfd_arm_get_bfd_for_interworking
- PARAMS ((bfd *, struct bfd_link_info *));
+extern bfd_boolean bfd_arm_get_bfd_for_interworking
+ (bfd *, struct bfd_link_info *);
/* PE ARM Interworking support. Called from linker. */
-extern boolean bfd_arm_pe_allocate_interworking_sections
- PARAMS ((struct bfd_link_info *));
+extern bfd_boolean bfd_arm_pe_allocate_interworking_sections
+ (struct bfd_link_info *);
-extern boolean bfd_arm_pe_process_before_allocation
- PARAMS ((bfd *, struct bfd_link_info *, int));
+extern bfd_boolean bfd_arm_pe_process_before_allocation
+ (bfd *, struct bfd_link_info *, int);
-extern boolean bfd_arm_pe_get_bfd_for_interworking
- PARAMS ((bfd *, struct bfd_link_info *));
+extern bfd_boolean bfd_arm_pe_get_bfd_for_interworking
+ (bfd *, struct bfd_link_info *);
/* ELF ARM Interworking support. Called from linker. */
-extern boolean bfd_elf32_arm_allocate_interworking_sections
- PARAMS ((struct bfd_link_info *));
+extern bfd_boolean bfd_elf32_arm_allocate_interworking_sections
+ (struct bfd_link_info *);
-extern boolean bfd_elf32_arm_process_before_allocation
- PARAMS ((bfd *, struct bfd_link_info *, int));
+extern bfd_boolean bfd_elf32_arm_process_before_allocation
+ (bfd *, struct bfd_link_info *, int);
-extern boolean bfd_elf32_arm_get_bfd_for_interworking
- PARAMS ((bfd *, struct bfd_link_info *));
+extern bfd_boolean bfd_elf32_arm_get_bfd_for_interworking
+ (bfd *, struct bfd_link_info *);
-extern boolean bfd_elf32_arm_add_glue_sections_to_bfd
- PARAMS ((bfd *, struct bfd_link_info *));
+extern bfd_boolean bfd_elf32_arm_add_glue_sections_to_bfd
+ (bfd *, struct bfd_link_info *);
+
+/* ARM Note section processing. */
+extern bfd_boolean bfd_arm_merge_machines
+ (bfd *, bfd *);
+
+extern bfd_boolean bfd_arm_update_notes
+ (bfd *, const char *);
+
+extern unsigned int bfd_arm_get_mach_from_notes
+ (bfd *, const char *);
/* TI COFF load page support. */
extern void bfd_ticoff_set_section_load_page
- PARAMS ((struct sec *, int));
+ (struct bfd_section *, int);
extern int bfd_ticoff_get_section_load_page
- PARAMS ((struct sec *));
+ (struct bfd_section *);
+
+/* H8/300 functions. */
+extern bfd_vma bfd_h8300_pad_address
+ (bfd *, bfd_vma);
+
+/* IA64 Itanium code generation. Called from linker. */
+extern void bfd_elf32_ia64_after_parse
+ (int);
+
+extern void bfd_elf64_ia64_after_parse
+ (int);
diff --git a/contrib/binutils/bfd/bfd-in2.h b/contrib/binutils/bfd/bfd-in2.h
index 13aa0f9..2464d27 100644
--- a/contrib/binutils/bfd/bfd-in2.h
+++ b/contrib/binutils/bfd/bfd-in2.h
@@ -1,13 +1,15 @@
/* DO NOT EDIT! -*- buffer-read-only: t -*- This file is automatically
generated from "bfd-in.h", "init.c", "opncls.c", "libbfd.c",
- "section.c", "archures.c", "reloc.c", "syms.c", "bfd.c", "archive.c",
- "corefile.c", "targets.c" and "format.c".
+ "bfdio.c", "bfdwin.c", "section.c", "archures.c", "reloc.c",
+ "syms.c", "bfd.c", "archive.c", "corefile.c", "targets.c", "format.c",
+ "linker.c" and "simple.c".
Run "make headers" in your build bfd/ to regenerate. */
/* Main header file for the bfd library -- portable access to object files.
- Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
- 2000, 2001, 2002
- Free Software Foundation, Inc.
+
+ Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
+ 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
+
Contributed by Cygnus Support.
This file is part of BFD, the Binary File Descriptor library.
@@ -47,10 +49,6 @@ extern "C" {
#endif
#endif
-#define BFD_VERSION @bfd_version@
-#define BFD_VERSION_DATE @bfd_version_date@
-#define BFD_VERSION_STRING @bfd_version_string@
-
/* The word size used by BFD on the host. This may be 64 with a 32
bit target if the host is 64 bit, or if other 64 bit targets have
been selected with --enable-targets, or if --enable-64-bit-bfd. */
@@ -60,9 +58,12 @@ extern "C" {
#define BFD_DEFAULT_TARGET_SIZE @bfd_default_target_size@
#define BFD_HOST_64BIT_LONG @BFD_HOST_64BIT_LONG@
+#define BFD_HOST_LONG_LONG @BFD_HOST_LONG_LONG@
#if @BFD_HOST_64_BIT_DEFINED@
#define BFD_HOST_64_BIT @BFD_HOST_64_BIT@
#define BFD_HOST_U_64_BIT @BFD_HOST_U_64_BIT@
+typedef BFD_HOST_64_BIT bfd_int64_t;
+typedef BFD_HOST_U_64_BIT bfd_uint64_t;
#endif
#if BFD_ARCH_SIZE >= 64
@@ -78,66 +79,31 @@ extern "C" {
#endif
/* Forward declaration. */
-typedef struct _bfd bfd;
-
-/* To squelch erroneous compiler warnings ("illegal pointer
- combination") from the SVR3 compiler, we would like to typedef
- boolean to int (it doesn't like functions which return boolean.
- Making sure they are never implicitly declared to return int
- doesn't seem to help). But this file is not configured based on
- the host. */
-/* General rules: functions which are boolean return true on success
- and false on failure (unless they're a predicate). -- bfd.doc */
-/* I'm sure this is going to break something and someone is going to
- force me to change it. */
-/* typedef enum boolean {false, true} boolean; */
-/* Yup, SVR4 has a "typedef enum boolean" in <sys/types.h> -fnf */
-/* It gets worse if the host also defines a true/false enum... -sts */
-/* And even worse if your compiler has built-in boolean types... -law */
-/* And even worse if your compiler provides a stdbool.h that conflicts
- with these definitions... gcc 2.95 and later do. If so, it must
- be included first. -drow */
-#if defined (__GNUG__) && (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 6))
-#define TRUE_FALSE_ALREADY_DEFINED
-#else
-#if defined (__bool_true_false_are_defined)
-/* We have <stdbool.h>. */
-#define TRUE_FALSE_ALREADY_DEFINED
-#endif
-#endif
-#ifdef MPW
-/* Pre-emptive strike - get the file with the enum. */
-#include <Types.h>
-#define TRUE_FALSE_ALREADY_DEFINED
-#endif /* MPW */
-#ifndef TRUE_FALSE_ALREADY_DEFINED
-typedef enum bfd_boolean {false, true} boolean;
-#define BFD_TRUE_FALSE
-#else
-/* Use enum names that will appear nowhere else. */
-typedef enum bfd_boolean {bfd_fffalse, bfd_tttrue} boolean;
+typedef struct bfd bfd;
+
+/* Boolean type used in bfd. Too many systems define their own
+ versions of "boolean" for us to safely typedef a "boolean" of
+ our own. Using an enum for "bfd_boolean" has its own set of
+ problems, with strange looking casts required to avoid warnings
+ on some older compilers. Thus we just use an int.
+
+ General rule: Functions which are bfd_boolean return TRUE on
+ success and FALSE on failure (unless they're a predicate). */
+
+typedef int bfd_boolean;
+#undef FALSE
+#undef TRUE
+#define FALSE 0
+#define TRUE 1
+
+#if 0
+/* Poison. */
+#undef false
+#undef true
+#define false dont_use_false_in_bfd
+#define true dont_use_true_in_bfd
#endif
-/* Support for different sizes of target format ints and addresses.
- If the type `long' is at least 64 bits, BFD_HOST_64BIT_LONG will be
- set to 1 above. Otherwise, if gcc is being used, this code will
- use gcc's "long long" type. Otherwise, BFD_HOST_64_BIT must be
- defined above. */
-
-#ifndef BFD_HOST_64_BIT
-# if BFD_HOST_64BIT_LONG
-# define BFD_HOST_64_BIT long
-# define BFD_HOST_U_64_BIT unsigned long
-# else
-# ifdef __GNUC__
-# if __GNUC__ >= 2
-# define BFD_HOST_64_BIT long long
-# define BFD_HOST_U_64_BIT unsigned long long
-# endif /* __GNUC__ >= 2 */
-# endif /* ! defined (__GNUC__) */
-# endif /* ! BFD_HOST_64BIT_LONG */
-#endif /* ! defined (BFD_HOST_64_BIT) */
-
#ifdef BFD64
#ifndef BFD_HOST_64_BIT
@@ -185,19 +151,22 @@ typedef unsigned long bfd_size_type;
#endif /* not BFD64 */
-/* A pointer to a position in a file. */
-/* FIXME: This should be using off_t from <sys/types.h>.
- For now, try to avoid breaking stuff by not including <sys/types.h> here.
- This will break on systems with 64-bit file offsets (e.g. 4.4BSD).
- Probably the best long-term answer is to avoid using file_ptr AND off_t
- in this header file, and to handle this in the BFD implementation
- rather than in its interface. */
-/* typedef off_t file_ptr; */
-typedef bfd_signed_vma file_ptr;
-typedef bfd_vma ufile_ptr;
+#ifndef BFD_HOST_64_BIT
+/* Fall back on a 32 bit type. The idea is to make these types always
+ available for function return types, but in the case that
+ BFD_HOST_64_BIT is undefined such a function should abort or
+ otherwise signal an error. */
+typedef bfd_signed_vma bfd_int64_t;
+typedef bfd_vma bfd_uint64_t;
+#endif
+
+/* An offset into a file. BFD always uses the largest possible offset
+ based on the build time availability of fseek, fseeko, or fseeko64. */
+typedef @bfd_file_ptr@ file_ptr;
+typedef unsigned @bfd_file_ptr@ ufile_ptr;
-extern void bfd_sprintf_vma PARAMS ((bfd *, char *, bfd_vma));
-extern void bfd_fprintf_vma PARAMS ((bfd *, PTR, bfd_vma));
+extern void bfd_sprintf_vma (bfd *, char *, bfd_vma);
+extern void bfd_fprintf_vma (bfd *, void *, bfd_vma);
#define printf_vma(x) fprintf_vma(stdout,x)
#define bfd_printf_vma(abfd,x) bfd_fprintf_vma (abfd,stdout,x)
@@ -210,7 +179,7 @@ typedef unsigned char bfd_byte;
typedef enum bfd_format
{
bfd_unknown = 0, /* File format is unknown. */
- bfd_object, /* Linker/assember/compiler output. */
+ bfd_object, /* Linker/assembler/compiler output. */
bfd_archive, /* Object archive file. */
bfd_core, /* Core dump. */
bfd_type_end /* Marks the end; don't use it! */
@@ -273,6 +242,9 @@ bfd_format;
/* This flag indicates that the BFD contents are actually cached in
memory. If this is set, iostream points to a bfd_in_memory struct. */
#define BFD_IN_MEMORY 0x800
+
+/* The sections in this BFD specify a memory page. */
+#define HAS_LOAD_PAGE 0x1000
/* Symbols and relocation. */
@@ -325,7 +297,7 @@ typedef struct lineno_cache_entry
unsigned int line_number; /* Linenumber from start of function. */
union
{
- struct symbol_cache_entry *sym; /* Function name. */
+ struct bfd_symbol *sym; /* Function name. */
bfd_vma offset; /* Offset into section. */
} u;
}
@@ -336,7 +308,7 @@ alent;
#define align_power(addr, align) \
(((addr) + ((bfd_vma) 1 << (align)) - 1) & ((bfd_vma) -1 << (align)))
-typedef struct sec *sec_ptr;
+typedef struct bfd_section *sec_ptr;
#define bfd_get_section_name(bfd, ptr) ((ptr)->name + 0)
#define bfd_get_section_vma(bfd, ptr) ((ptr)->vma + 0)
@@ -352,9 +324,9 @@ typedef struct sec *sec_ptr;
#define bfd_is_com_section(ptr) (((ptr)->flags & SEC_IS_COMMON) != 0)
-#define bfd_set_section_vma(bfd, ptr, val) (((ptr)->vma = (ptr)->lma = (val)), ((ptr)->user_set_vma = (unsigned int)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)
+#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;
@@ -380,7 +352,7 @@ typedef struct _symbol_info
/* Get the name of a stabs type code. */
-extern const char *bfd_get_stab_name PARAMS ((int));
+extern const char *bfd_get_stab_name (int);
/* Hash table routines. There is no way to free up a hash table. */
@@ -413,75 +385,74 @@ struct bfd_hash_table
built each of which calls the function in the superclass. Thus
each function should be written to allocate a new block of memory
only if the argument is NULL. */
- struct bfd_hash_entry *(*newfunc) PARAMS ((struct bfd_hash_entry *,
- struct bfd_hash_table *,
- const char *));
+ struct bfd_hash_entry *(*newfunc)
+ (struct bfd_hash_entry *, struct bfd_hash_table *, const char *);
/* An objalloc for this hash table. This is a struct objalloc *,
- but we use PTR to avoid requiring the inclusion of objalloc.h. */
- PTR memory;
+ but we use void * to avoid requiring the inclusion of objalloc.h. */
+ void *memory;
};
/* Initialize a hash table. */
-extern boolean bfd_hash_table_init
- PARAMS ((struct bfd_hash_table *,
- struct bfd_hash_entry *(*) (struct bfd_hash_entry *,
- struct bfd_hash_table *,
- const char *)));
+extern bfd_boolean bfd_hash_table_init
+ (struct bfd_hash_table *,
+ struct bfd_hash_entry *(*) (struct bfd_hash_entry *,
+ struct bfd_hash_table *,
+ const char *));
/* Initialize a hash table specifying a size. */
-extern boolean bfd_hash_table_init_n
- PARAMS ((struct bfd_hash_table *,
- struct bfd_hash_entry *(*) (struct bfd_hash_entry *,
- struct bfd_hash_table *,
- const char *),
- unsigned int size));
+extern bfd_boolean bfd_hash_table_init_n
+ (struct bfd_hash_table *,
+ struct bfd_hash_entry *(*) (struct bfd_hash_entry *,
+ struct bfd_hash_table *,
+ const char *),
+ unsigned int size);
/* Free up a hash table. */
-extern void bfd_hash_table_free PARAMS ((struct bfd_hash_table *));
+extern void bfd_hash_table_free
+ (struct bfd_hash_table *);
-/* Look up a string in a hash table. If CREATE is true, a new entry
+/* Look up a string in a hash table. If CREATE is TRUE, a new entry
will be created for this string if one does not already exist. The
- COPY argument must be true if this routine should copy the string
+ COPY argument must be TRUE if this routine should copy the string
into newly allocated memory when adding an entry. */
extern struct bfd_hash_entry *bfd_hash_lookup
- PARAMS ((struct bfd_hash_table *, const char *, boolean create,
- boolean copy));
+ (struct bfd_hash_table *, const char *, bfd_boolean create,
+ bfd_boolean copy);
/* Replace an entry in a hash table. */
extern void bfd_hash_replace
- PARAMS ((struct bfd_hash_table *, struct bfd_hash_entry *old,
- struct bfd_hash_entry *nw));
+ (struct bfd_hash_table *, struct bfd_hash_entry *old,
+ struct bfd_hash_entry *nw);
/* Base method for creating a hash table entry. */
extern struct bfd_hash_entry *bfd_hash_newfunc
- PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *,
- const char *));
+ (struct bfd_hash_entry *, struct bfd_hash_table *, const char *);
/* Grab some space for a hash table entry. */
-extern PTR bfd_hash_allocate PARAMS ((struct bfd_hash_table *,
- unsigned int));
+extern void *bfd_hash_allocate
+ (struct bfd_hash_table *, unsigned int);
/* Traverse a hash table in a random order, calling a function on each
- element. If the function returns false, the traversal stops. The
+ element. If the function returns FALSE, the traversal stops. The
INFO argument is passed to the function. */
-extern void bfd_hash_traverse PARAMS ((struct bfd_hash_table *,
- boolean (*) (struct bfd_hash_entry *,
- PTR),
- PTR info));
+extern void bfd_hash_traverse
+ (struct bfd_hash_table *,
+ bfd_boolean (*) (struct bfd_hash_entry *, void *),
+ void *info);
-#define COFF_SWAP_TABLE (PTR) &bfd_coff_std_swap_table
+#define COFF_SWAP_TABLE (void *) &bfd_coff_std_swap_table
/* User program access to BFD facilities. */
/* Direct I/O routines, for programs which know more about the object
file than BFD does. Use higher level routines if possible. */
-extern bfd_size_type bfd_bread PARAMS ((PTR, bfd_size_type, bfd *));
-extern bfd_size_type bfd_bwrite PARAMS ((const PTR, bfd_size_type, bfd *));
-extern int bfd_seek PARAMS ((bfd *, file_ptr, int));
-extern ufile_ptr bfd_tell PARAMS ((bfd *));
-extern int bfd_flush PARAMS ((bfd *));
-extern int bfd_stat PARAMS ((bfd *, struct stat *));
+extern bfd_size_type bfd_bread (void *, bfd_size_type, bfd *);
+extern bfd_size_type bfd_bwrite (const void *, bfd_size_type, bfd *);
+extern int bfd_seek (bfd *, file_ptr, int);
+extern file_ptr bfd_tell (bfd *);
+extern int bfd_flush (bfd *);
+extern int bfd_stat (bfd *, struct stat *);
/* Deprecated old routines. */
#if __GNUC__
@@ -499,8 +470,7 @@ extern int bfd_stat PARAMS ((bfd *, struct stat *));
(warn_deprecated ("bfd_write", (const char *) 0, 0, (const char *) 0),\
bfd_bwrite ((BUF), (ELTSIZE) * (NITEMS), (ABFD)))
#endif
-extern void warn_deprecated
- PARAMS ((const char *, const char *, int, const char *));
+extern void warn_deprecated (const char *, const char *, int, const char *);
/* Cast from const char * to char * so that caller can assign to
a char * without a warning. */
@@ -536,40 +506,41 @@ extern void warn_deprecated
#define bfd_get_symbol_leading_char(abfd) ((abfd)->xvec->symbol_leading_char)
-#define bfd_set_cacheable(abfd,bool) (((abfd)->cacheable = (boolean) (bool)), true)
+#define bfd_set_cacheable(abfd,bool) (((abfd)->cacheable = bool), TRUE)
-extern boolean bfd_cache_close PARAMS ((bfd *abfd));
+extern bfd_boolean bfd_cache_close
+ (bfd *abfd);
/* NB: This declaration should match the autogenerated one in libbfd.h. */
-extern boolean bfd_record_phdr
- PARAMS ((bfd *, unsigned long, boolean, flagword, boolean, bfd_vma,
- boolean, boolean, unsigned int, struct sec **));
+extern bfd_boolean bfd_record_phdr
+ (bfd *, unsigned long, bfd_boolean, flagword, bfd_boolean, bfd_vma,
+ bfd_boolean, bfd_boolean, unsigned int, struct bfd_section **);
/* Byte swapping routines. */
-bfd_vma bfd_getb64 PARAMS ((const unsigned char *));
-bfd_vma bfd_getl64 PARAMS ((const unsigned char *));
-bfd_signed_vma bfd_getb_signed_64 PARAMS ((const unsigned char *));
-bfd_signed_vma bfd_getl_signed_64 PARAMS ((const unsigned char *));
-bfd_vma bfd_getb32 PARAMS ((const unsigned char *));
-bfd_vma bfd_getl32 PARAMS ((const unsigned char *));
-bfd_signed_vma bfd_getb_signed_32 PARAMS ((const unsigned char *));
-bfd_signed_vma bfd_getl_signed_32 PARAMS ((const unsigned char *));
-bfd_vma bfd_getb16 PARAMS ((const unsigned char *));
-bfd_vma bfd_getl16 PARAMS ((const unsigned char *));
-bfd_signed_vma bfd_getb_signed_16 PARAMS ((const unsigned char *));
-bfd_signed_vma bfd_getl_signed_16 PARAMS ((const unsigned char *));
-void bfd_putb64 PARAMS ((bfd_vma, unsigned char *));
-void bfd_putl64 PARAMS ((bfd_vma, unsigned char *));
-void bfd_putb32 PARAMS ((bfd_vma, unsigned char *));
-void bfd_putl32 PARAMS ((bfd_vma, unsigned char *));
-void bfd_putb16 PARAMS ((bfd_vma, unsigned char *));
-void bfd_putl16 PARAMS ((bfd_vma, unsigned char *));
+bfd_uint64_t bfd_getb64 (const void *);
+bfd_uint64_t bfd_getl64 (const void *);
+bfd_int64_t bfd_getb_signed_64 (const void *);
+bfd_int64_t bfd_getl_signed_64 (const void *);
+bfd_vma bfd_getb32 (const void *);
+bfd_vma bfd_getl32 (const void *);
+bfd_signed_vma bfd_getb_signed_32 (const void *);
+bfd_signed_vma bfd_getl_signed_32 (const void *);
+bfd_vma bfd_getb16 (const void *);
+bfd_vma bfd_getl16 (const void *);
+bfd_signed_vma bfd_getb_signed_16 (const void *);
+bfd_signed_vma bfd_getl_signed_16 (const void *);
+void bfd_putb64 (bfd_uint64_t, void *);
+void bfd_putl64 (bfd_uint64_t, void *);
+void bfd_putb32 (bfd_vma, void *);
+void bfd_putl32 (bfd_vma, void *);
+void bfd_putb16 (bfd_vma, void *);
+void bfd_putl16 (bfd_vma, void *);
/* Byte swapping routines which take size and endiannes as arguments. */
-bfd_vma bfd_get_bits PARAMS ((bfd_byte *, int, boolean));
-void bfd_put_bits PARAMS ((bfd_vma, bfd_byte *, int, boolean));
+bfd_uint64_t bfd_get_bits (const void *, int, bfd_boolean);
+void bfd_put_bits (bfd_uint64_t, void *, int, bfd_boolean);
/* Externally visible ECOFF routines. */
@@ -577,59 +548,54 @@ void bfd_put_bits PARAMS ((bfd_vma, bfd_byte *, int, boolean));
struct ecoff_debug_info;
struct ecoff_debug_swap;
struct ecoff_extr;
-struct symbol_cache_entry;
+struct bfd_symbol;
struct bfd_link_info;
struct bfd_link_hash_entry;
struct bfd_elf_version_tree;
#endif
-extern bfd_vma bfd_ecoff_get_gp_value PARAMS ((bfd * abfd));
-extern boolean bfd_ecoff_set_gp_value PARAMS ((bfd *abfd, bfd_vma gp_value));
-extern boolean bfd_ecoff_set_regmasks
- PARAMS ((bfd *abfd, unsigned long gprmask, unsigned long fprmask,
- unsigned long *cprmask));
-extern PTR bfd_ecoff_debug_init
- PARAMS ((bfd *output_bfd, struct ecoff_debug_info *output_debug,
- const struct ecoff_debug_swap *output_swap,
- struct bfd_link_info *));
+extern bfd_vma bfd_ecoff_get_gp_value
+ (bfd * abfd);
+extern bfd_boolean bfd_ecoff_set_gp_value
+ (bfd *abfd, bfd_vma gp_value);
+extern bfd_boolean bfd_ecoff_set_regmasks
+ (bfd *abfd, unsigned long gprmask, unsigned long fprmask,
+ unsigned long *cprmask);
+extern void *bfd_ecoff_debug_init
+ (bfd *output_bfd, struct ecoff_debug_info *output_debug,
+ const struct ecoff_debug_swap *output_swap, struct bfd_link_info *);
extern void bfd_ecoff_debug_free
- PARAMS ((PTR handle, bfd *output_bfd, struct ecoff_debug_info *output_debug,
- const struct ecoff_debug_swap *output_swap,
- struct bfd_link_info *));
-extern boolean bfd_ecoff_debug_accumulate
- PARAMS ((PTR handle, bfd *output_bfd, struct ecoff_debug_info *output_debug,
- const struct ecoff_debug_swap *output_swap,
- bfd *input_bfd, struct ecoff_debug_info *input_debug,
- const struct ecoff_debug_swap *input_swap,
- struct bfd_link_info *));
-extern boolean bfd_ecoff_debug_accumulate_other
- PARAMS ((PTR handle, bfd *output_bfd, struct ecoff_debug_info *output_debug,
- const struct ecoff_debug_swap *output_swap, bfd *input_bfd,
- struct bfd_link_info *));
-extern boolean bfd_ecoff_debug_externals
- PARAMS ((bfd *abfd, struct ecoff_debug_info *debug,
- const struct ecoff_debug_swap *swap,
- boolean relocateable,
- boolean (*get_extr) (struct symbol_cache_entry *,
- struct ecoff_extr *),
- void (*set_index) (struct symbol_cache_entry *,
- bfd_size_type)));
-extern boolean bfd_ecoff_debug_one_external
- PARAMS ((bfd *abfd, struct ecoff_debug_info *debug,
- const struct ecoff_debug_swap *swap,
- const char *name, struct ecoff_extr *esym));
+ (void *handle, bfd *output_bfd, struct ecoff_debug_info *output_debug,
+ const struct ecoff_debug_swap *output_swap, struct bfd_link_info *);
+extern bfd_boolean bfd_ecoff_debug_accumulate
+ (void *handle, bfd *output_bfd, struct ecoff_debug_info *output_debug,
+ const struct ecoff_debug_swap *output_swap, bfd *input_bfd,
+ struct ecoff_debug_info *input_debug,
+ const struct ecoff_debug_swap *input_swap, struct bfd_link_info *);
+extern bfd_boolean bfd_ecoff_debug_accumulate_other
+ (void *handle, bfd *output_bfd, struct ecoff_debug_info *output_debug,
+ const struct ecoff_debug_swap *output_swap, bfd *input_bfd,
+ struct bfd_link_info *);
+extern bfd_boolean bfd_ecoff_debug_externals
+ (bfd *abfd, struct ecoff_debug_info *debug,
+ const struct ecoff_debug_swap *swap, bfd_boolean relocatable,
+ bfd_boolean (*get_extr) (struct bfd_symbol *, struct ecoff_extr *),
+ void (*set_index) (struct bfd_symbol *, bfd_size_type));
+extern bfd_boolean bfd_ecoff_debug_one_external
+ (bfd *abfd, struct ecoff_debug_info *debug,
+ const struct ecoff_debug_swap *swap, const char *name,
+ struct ecoff_extr *esym);
extern bfd_size_type bfd_ecoff_debug_size
- PARAMS ((bfd *abfd, struct ecoff_debug_info *debug,
- const struct ecoff_debug_swap *swap));
-extern boolean bfd_ecoff_write_debug
- PARAMS ((bfd *abfd, struct ecoff_debug_info *debug,
- const struct ecoff_debug_swap *swap, file_ptr where));
-extern boolean bfd_ecoff_write_accumulated_debug
- PARAMS ((PTR handle, bfd *abfd, struct ecoff_debug_info *debug,
- const struct ecoff_debug_swap *swap,
- struct bfd_link_info *info, file_ptr where));
-extern boolean bfd_mips_ecoff_create_embedded_relocs
- PARAMS ((bfd *, struct bfd_link_info *, struct sec *, struct sec *,
- char **));
+ (bfd *abfd, struct ecoff_debug_info *debug,
+ const struct ecoff_debug_swap *swap);
+extern bfd_boolean bfd_ecoff_write_debug
+ (bfd *abfd, struct ecoff_debug_info *debug,
+ const struct ecoff_debug_swap *swap, file_ptr where);
+extern bfd_boolean bfd_ecoff_write_accumulated_debug
+ (void *handle, bfd *abfd, struct ecoff_debug_info *debug,
+ const struct ecoff_debug_swap *swap,
+ struct bfd_link_info *info, file_ptr where);
+extern bfd_boolean bfd_mips_ecoff_create_embedded_relocs
+ (bfd *, struct bfd_link_info *, struct bfd_section *, struct bfd_section *, char **);
/* Externally visible ELF routines. */
@@ -640,36 +606,37 @@ struct bfd_link_needed_list
const char *name;
};
-extern boolean bfd_elf32_record_link_assignment
- PARAMS ((bfd *, struct bfd_link_info *, const char *, boolean));
-extern boolean bfd_elf64_record_link_assignment
- PARAMS ((bfd *, struct bfd_link_info *, const char *, boolean));
+enum dynamic_lib_link_class {
+ DYN_NORMAL = 0,
+ DYN_AS_NEEDED = 1,
+ DYN_DT_NEEDED = 2
+};
+
+extern bfd_boolean bfd_elf_record_link_assignment
+ (bfd *, struct bfd_link_info *, const char *, bfd_boolean);
extern struct bfd_link_needed_list *bfd_elf_get_needed_list
- PARAMS ((bfd *, struct bfd_link_info *));
-extern boolean bfd_elf_get_bfd_needed_list
- PARAMS ((bfd *, struct bfd_link_needed_list **));
-extern boolean bfd_elf32_size_dynamic_sections
- PARAMS ((bfd *, const char *, const char *, const char *,
- const char * const *, struct bfd_link_info *, struct sec **,
- struct bfd_elf_version_tree *));
-extern boolean bfd_elf64_size_dynamic_sections
- PARAMS ((bfd *, const char *, const char *, const char *,
- const char * const *, struct bfd_link_info *, struct sec **,
- struct bfd_elf_version_tree *));
-extern void bfd_elf_set_dt_needed_name PARAMS ((bfd *, const char *));
-extern void bfd_elf_set_dt_needed_soname PARAMS ((bfd *, const char *));
-extern const char *bfd_elf_get_dt_soname PARAMS ((bfd *));
+ (bfd *, struct bfd_link_info *);
+extern bfd_boolean bfd_elf_get_bfd_needed_list
+ (bfd *, struct bfd_link_needed_list **);
+extern bfd_boolean bfd_elf_size_dynamic_sections
+ (bfd *, const char *, const char *, const char *, const char * const *,
+ struct bfd_link_info *, struct bfd_section **, struct bfd_elf_version_tree *);
+extern void bfd_elf_set_dt_needed_name
+ (bfd *, const char *);
+extern const char *bfd_elf_get_dt_soname
+ (bfd *);
+extern void bfd_elf_set_dyn_lib_class
+ (bfd *, int);
extern struct bfd_link_needed_list *bfd_elf_get_runpath_list
- PARAMS ((bfd *, struct bfd_link_info *));
-extern boolean bfd_elf32_discard_info
- PARAMS ((bfd *, struct bfd_link_info *));
-extern boolean bfd_elf64_discard_info
- PARAMS ((bfd *, struct bfd_link_info *));
+ (bfd *, struct bfd_link_info *);
+extern bfd_boolean bfd_elf_discard_info
+ (bfd *, struct bfd_link_info *);
/* Return an upper bound on the number of bytes required to store a
copy of ABFD's program header table entries. Return -1 if an error
occurs; bfd_get_error will return an appropriate code. */
-extern long bfd_get_elf_phdr_upper_bound PARAMS ((bfd *abfd));
+extern long bfd_get_elf_phdr_upper_bound
+ (bfd *abfd);
/* Copy ABFD's program header table entries to *PHDRS. The entries
will be stored as an array of Elf_Internal_Phdr structures, as
@@ -678,39 +645,58 @@ extern long bfd_get_elf_phdr_upper_bound PARAMS ((bfd *abfd));
Return the number of program header table entries read, or -1 if an
error occurs; bfd_get_error will return an appropriate code. */
-extern int bfd_get_elf_phdrs PARAMS ((bfd *abfd, void *phdrs));
+extern int bfd_get_elf_phdrs
+ (bfd *abfd, void *phdrs);
+
+/* Create a new BFD as if by bfd_openr. Rather than opening a file,
+ reconstruct an ELF file by reading the segments out of remote memory
+ based on the ELF file header at EHDR_VMA and the ELF program headers it
+ points to. If not null, *LOADBASEP is filled in with the difference
+ between the VMAs from which the segments were read, and the VMAs the
+ file headers (and hence BFD's idea of each section's VMA) put them at.
+
+ The function TARGET_READ_MEMORY is called to copy LEN bytes from the
+ remote memory at target address VMA into the local buffer at MYADDR; it
+ should return zero on success or an `errno' code on failure. TEMPL must
+ be a BFD for an ELF target with the word size and byte order found in
+ the remote memory. */
+extern bfd *bfd_elf_bfd_from_remote_memory
+ (bfd *templ, bfd_vma ehdr_vma, bfd_vma *loadbasep,
+ int (*target_read_memory) (bfd_vma vma, char *myaddr, int len));
/* Return the arch_size field of an elf bfd, or -1 if not elf. */
-extern int bfd_get_arch_size PARAMS ((bfd *));
+extern int bfd_get_arch_size
+ (bfd *);
-/* Return true if address "naturally" sign extends, or -1 if not elf. */
-extern int bfd_get_sign_extend_vma PARAMS ((bfd *));
+/* Return TRUE if address "naturally" sign extends, or -1 if not elf. */
+extern int bfd_get_sign_extend_vma
+ (bfd *);
-extern boolean bfd_m68k_elf32_create_embedded_relocs
- PARAMS ((bfd *, struct bfd_link_info *, struct sec *, struct sec *,
- char **));
-extern boolean bfd_mips_elf32_create_embedded_relocs
- PARAMS ((bfd *, struct bfd_link_info *, struct sec *, struct sec *,
- char **));
+extern struct bfd_section *_bfd_elf_tls_setup
+ (bfd *, struct bfd_link_info *);
+
+extern bfd_boolean bfd_m68k_elf32_create_embedded_relocs
+ (bfd *, struct bfd_link_info *, struct bfd_section *, struct bfd_section *, char **);
+extern bfd_boolean bfd_mips_elf32_create_embedded_relocs
+ (bfd *, struct bfd_link_info *, struct bfd_section *, struct bfd_section *, char **);
/* SunOS shared library support routines for the linker. */
extern struct bfd_link_needed_list *bfd_sunos_get_needed_list
- PARAMS ((bfd *, struct bfd_link_info *));
-extern boolean bfd_sunos_record_link_assignment
- PARAMS ((bfd *, struct bfd_link_info *, const char *));
-extern boolean bfd_sunos_size_dynamic_sections
- PARAMS ((bfd *, struct bfd_link_info *, struct sec **, struct sec **,
- struct sec **));
+ (bfd *, struct bfd_link_info *);
+extern bfd_boolean bfd_sunos_record_link_assignment
+ (bfd *, struct bfd_link_info *, const char *);
+extern bfd_boolean bfd_sunos_size_dynamic_sections
+ (bfd *, struct bfd_link_info *, struct bfd_section **, struct bfd_section **, struct bfd_section **);
/* Linux shared library support routines for the linker. */
-extern boolean bfd_i386linux_size_dynamic_sections
- PARAMS ((bfd *, struct bfd_link_info *));
-extern boolean bfd_m68klinux_size_dynamic_sections
- PARAMS ((bfd *, struct bfd_link_info *));
-extern boolean bfd_sparclinux_size_dynamic_sections
- PARAMS ((bfd *, struct bfd_link_info *));
+extern bfd_boolean bfd_i386linux_size_dynamic_sections
+ (bfd *, struct bfd_link_info *);
+extern bfd_boolean bfd_m68klinux_size_dynamic_sections
+ (bfd *, struct bfd_link_info *);
+extern bfd_boolean bfd_sparclinux_size_dynamic_sections
+ (bfd *, struct bfd_link_info *);
/* mmap hacks */
@@ -720,7 +706,7 @@ typedef struct _bfd_window_internal bfd_window_internal;
typedef struct _bfd_window
{
/* What the user asked for. */
- PTR data;
+ void *data;
bfd_size_type size;
/* The actual window used by BFD. Small user-requested read-only
regions sharing a page may share a single window into the object
@@ -732,34 +718,36 @@ typedef struct _bfd_window
}
bfd_window;
-extern void bfd_init_window PARAMS ((bfd_window *));
-extern void bfd_free_window PARAMS ((bfd_window *));
-extern boolean bfd_get_file_window
- PARAMS ((bfd *, file_ptr, bfd_size_type, bfd_window *, boolean));
+extern void bfd_init_window
+ (bfd_window *);
+extern void bfd_free_window
+ (bfd_window *);
+extern bfd_boolean bfd_get_file_window
+ (bfd *, file_ptr, bfd_size_type, bfd_window *, bfd_boolean);
/* XCOFF support routines for the linker. */
-extern boolean bfd_xcoff_link_record_set
- PARAMS ((bfd *, struct bfd_link_info *, struct bfd_link_hash_entry *,
- bfd_size_type));
-extern boolean bfd_xcoff_import_symbol
- PARAMS ((bfd *, struct bfd_link_info *, struct bfd_link_hash_entry *,
- bfd_vma, const char *, const char *, const char *, unsigned int));
-extern boolean bfd_xcoff_export_symbol
- PARAMS ((bfd *, struct bfd_link_info *, struct bfd_link_hash_entry *));
-extern boolean bfd_xcoff_link_count_reloc
- PARAMS ((bfd *, struct bfd_link_info *, const char *));
-extern boolean bfd_xcoff_record_link_assignment
- PARAMS ((bfd *, struct bfd_link_info *, const char *));
-extern boolean bfd_xcoff_size_dynamic_sections
- PARAMS ((bfd *, struct bfd_link_info *, const char *, const char *,
- unsigned long, unsigned long, unsigned long, boolean,
- int, boolean, boolean, struct sec **, boolean));
-extern boolean bfd_xcoff_link_generate_rtinit
- PARAMS ((bfd *, const char *, const char *, boolean));
+extern bfd_boolean bfd_xcoff_link_record_set
+ (bfd *, struct bfd_link_info *, struct bfd_link_hash_entry *, bfd_size_type);
+extern bfd_boolean bfd_xcoff_import_symbol
+ (bfd *, struct bfd_link_info *, struct bfd_link_hash_entry *, bfd_vma,
+ const char *, const char *, const char *, unsigned int);
+extern bfd_boolean bfd_xcoff_export_symbol
+ (bfd *, struct bfd_link_info *, struct bfd_link_hash_entry *);
+extern bfd_boolean bfd_xcoff_link_count_reloc
+ (bfd *, struct bfd_link_info *, const char *);
+extern bfd_boolean bfd_xcoff_record_link_assignment
+ (bfd *, struct bfd_link_info *, const char *);
+extern bfd_boolean bfd_xcoff_size_dynamic_sections
+ (bfd *, struct bfd_link_info *, const char *, const char *,
+ unsigned long, unsigned long, unsigned long, bfd_boolean,
+ int, bfd_boolean, bfd_boolean, struct bfd_section **, bfd_boolean);
+extern bfd_boolean bfd_xcoff_link_generate_rtinit
+ (bfd *, const char *, const char *, bfd_boolean);
/* XCOFF support routines for ar. */
-extern boolean bfd_xcoff_ar_archive_set_magic PARAMS ((bfd *, char *));
+extern bfd_boolean bfd_xcoff_ar_archive_set_magic
+ (bfd *, char *);
/* Externally visible COFF routines. */
@@ -768,144 +756,165 @@ struct internal_syment;
union internal_auxent;
#endif
-extern boolean bfd_coff_get_syment
- PARAMS ((bfd *, struct symbol_cache_entry *, struct internal_syment *));
+extern bfd_boolean bfd_coff_get_syment
+ (bfd *, struct bfd_symbol *, struct internal_syment *);
-extern boolean bfd_coff_get_auxent
- PARAMS ((bfd *, struct symbol_cache_entry *, int, union internal_auxent *));
+extern bfd_boolean bfd_coff_get_auxent
+ (bfd *, struct bfd_symbol *, int, union internal_auxent *);
-extern boolean bfd_coff_set_symbol_class
- PARAMS ((bfd *, struct symbol_cache_entry *, unsigned int));
+extern bfd_boolean bfd_coff_set_symbol_class
+ (bfd *, struct bfd_symbol *, unsigned int);
-extern boolean bfd_m68k_coff_create_embedded_relocs
- PARAMS ((bfd *, struct bfd_link_info *, struct sec *, struct sec *,
- char **));
+extern bfd_boolean bfd_m68k_coff_create_embedded_relocs
+ (bfd *, struct bfd_link_info *, struct bfd_section *, struct bfd_section *, char **);
/* ARM Interworking support. Called from linker. */
-extern boolean bfd_arm_allocate_interworking_sections
- PARAMS ((struct bfd_link_info *));
+extern bfd_boolean bfd_arm_allocate_interworking_sections
+ (struct bfd_link_info *);
-extern boolean bfd_arm_process_before_allocation
- PARAMS ((bfd *, struct bfd_link_info *, int));
+extern bfd_boolean bfd_arm_process_before_allocation
+ (bfd *, struct bfd_link_info *, int);
-extern boolean bfd_arm_get_bfd_for_interworking
- PARAMS ((bfd *, struct bfd_link_info *));
+extern bfd_boolean bfd_arm_get_bfd_for_interworking
+ (bfd *, struct bfd_link_info *);
/* PE ARM Interworking support. Called from linker. */
-extern boolean bfd_arm_pe_allocate_interworking_sections
- PARAMS ((struct bfd_link_info *));
+extern bfd_boolean bfd_arm_pe_allocate_interworking_sections
+ (struct bfd_link_info *);
-extern boolean bfd_arm_pe_process_before_allocation
- PARAMS ((bfd *, struct bfd_link_info *, int));
+extern bfd_boolean bfd_arm_pe_process_before_allocation
+ (bfd *, struct bfd_link_info *, int);
-extern boolean bfd_arm_pe_get_bfd_for_interworking
- PARAMS ((bfd *, struct bfd_link_info *));
+extern bfd_boolean bfd_arm_pe_get_bfd_for_interworking
+ (bfd *, struct bfd_link_info *);
/* ELF ARM Interworking support. Called from linker. */
-extern boolean bfd_elf32_arm_allocate_interworking_sections
- PARAMS ((struct bfd_link_info *));
+extern bfd_boolean bfd_elf32_arm_allocate_interworking_sections
+ (struct bfd_link_info *);
+
+extern bfd_boolean bfd_elf32_arm_process_before_allocation
+ (bfd *, struct bfd_link_info *, int);
+
+extern bfd_boolean bfd_elf32_arm_get_bfd_for_interworking
+ (bfd *, struct bfd_link_info *);
-extern boolean bfd_elf32_arm_process_before_allocation
- PARAMS ((bfd *, struct bfd_link_info *, int));
+extern bfd_boolean bfd_elf32_arm_add_glue_sections_to_bfd
+ (bfd *, struct bfd_link_info *);
-extern boolean bfd_elf32_arm_get_bfd_for_interworking
- PARAMS ((bfd *, struct bfd_link_info *));
+/* ARM Note section processing. */
+extern bfd_boolean bfd_arm_merge_machines
+ (bfd *, bfd *);
-extern boolean bfd_elf32_arm_add_glue_sections_to_bfd
- PARAMS ((bfd *, struct bfd_link_info *));
+extern bfd_boolean bfd_arm_update_notes
+ (bfd *, const char *);
+
+extern unsigned int bfd_arm_get_mach_from_notes
+ (bfd *, const char *);
/* TI COFF load page support. */
extern void bfd_ticoff_set_section_load_page
- PARAMS ((struct sec *, int));
+ (struct bfd_section *, int);
extern int bfd_ticoff_get_section_load_page
- PARAMS ((struct sec *));
+ (struct bfd_section *);
+
+/* H8/300 functions. */
+extern bfd_vma bfd_h8300_pad_address
+ (bfd *, bfd_vma);
+
+/* IA64 Itanium code generation. Called from linker. */
+extern void bfd_elf32_ia64_after_parse
+ (int);
+
+extern void bfd_elf64_ia64_after_parse
+ (int);
/* Extracted from init.c. */
-void
-bfd_init PARAMS ((void));
+void bfd_init (void);
/* Extracted from opncls.c. */
-bfd *
-bfd_openr PARAMS ((const char *filename, const char *target));
+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_fdopenr PARAMS ((const char *filename, const char *target, int fd));
+bfd *bfd_openw (const char *filename, const char *target);
-bfd *
-bfd_openstreamr PARAMS ((const char *, const char *, PTR));
+bfd_boolean bfd_close (bfd *abfd);
-bfd *
-bfd_openw PARAMS ((const char *filename, const char *target));
+bfd_boolean bfd_close_all_done (bfd *);
-boolean
-bfd_close PARAMS ((bfd *abfd));
+bfd *bfd_create (const char *filename, bfd *templ);
-boolean
-bfd_close_all_done PARAMS ((bfd *));
+bfd_boolean bfd_make_writable (bfd *abfd);
-bfd *
-bfd_create PARAMS ((const char *filename, bfd *templ));
+bfd_boolean bfd_make_readable (bfd *abfd);
-boolean
-bfd_make_writable PARAMS ((bfd *abfd));
+unsigned long bfd_calc_gnu_debuglink_crc32
+ (unsigned long crc, const unsigned char *buf, bfd_size_type len);
-boolean
-bfd_make_readable PARAMS ((bfd *abfd));
+char *bfd_follow_gnu_debuglink (bfd *abfd, const char *dir);
+
+struct bfd_section *bfd_create_gnu_debuglink_section
+ (bfd *abfd, const char *filename);
+
+bfd_boolean bfd_fill_in_gnu_debuglink_section
+ (bfd *abfd, struct bfd_section *sect, const char *filename);
/* Extracted from libbfd.c. */
/* Byte swapping macros for user section data. */
#define bfd_put_8(abfd, val, ptr) \
- ((void) (*((unsigned char *) (ptr)) = (unsigned char) (val)))
+ ((void) (*((unsigned char *) (ptr)) = (val) & 0xff))
#define bfd_put_signed_8 \
- bfd_put_8
+ bfd_put_8
#define bfd_get_8(abfd, ptr) \
- (*(unsigned char *) (ptr) & 0xff)
+ (*(unsigned char *) (ptr) & 0xff)
#define bfd_get_signed_8(abfd, ptr) \
- (((*(unsigned char *) (ptr) & 0xff) ^ 0x80) - 0x80)
+ (((*(unsigned char *) (ptr) & 0xff) ^ 0x80) - 0x80)
#define bfd_put_16(abfd, val, ptr) \
- BFD_SEND(abfd, bfd_putx16, ((val),(ptr)))
+ BFD_SEND (abfd, bfd_putx16, ((val),(ptr)))
#define bfd_put_signed_16 \
- bfd_put_16
+ bfd_put_16
#define bfd_get_16(abfd, ptr) \
- BFD_SEND(abfd, bfd_getx16, (ptr))
+ BFD_SEND (abfd, bfd_getx16, (ptr))
#define bfd_get_signed_16(abfd, ptr) \
- BFD_SEND (abfd, bfd_getx_signed_16, (ptr))
+ BFD_SEND (abfd, bfd_getx_signed_16, (ptr))
#define bfd_put_32(abfd, val, ptr) \
- BFD_SEND(abfd, bfd_putx32, ((val),(ptr)))
+ BFD_SEND (abfd, bfd_putx32, ((val),(ptr)))
#define bfd_put_signed_32 \
- bfd_put_32
+ bfd_put_32
#define bfd_get_32(abfd, ptr) \
- BFD_SEND(abfd, bfd_getx32, (ptr))
+ BFD_SEND (abfd, bfd_getx32, (ptr))
#define bfd_get_signed_32(abfd, ptr) \
- BFD_SEND(abfd, bfd_getx_signed_32, (ptr))
+ BFD_SEND (abfd, bfd_getx_signed_32, (ptr))
#define bfd_put_64(abfd, val, ptr) \
- BFD_SEND(abfd, bfd_putx64, ((val), (ptr)))
+ BFD_SEND (abfd, bfd_putx64, ((val), (ptr)))
#define bfd_put_signed_64 \
- bfd_put_64
+ bfd_put_64
#define bfd_get_64(abfd, ptr) \
- BFD_SEND(abfd, bfd_getx64, (ptr))
+ BFD_SEND (abfd, bfd_getx64, (ptr))
#define bfd_get_signed_64(abfd, ptr) \
- BFD_SEND(abfd, bfd_getx_signed_64, (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_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))
+#define bfd_put(bits, abfd, val, ptr) \
+ ((bits) == 8 ? bfd_put_8 (abfd, val, ptr) \
+ : (bits) == 16 ? bfd_put_16 (abfd, val, ptr) \
+ : (bits) == 32 ? bfd_put_32 (abfd, val, ptr) \
+ : (bits) == 64 ? bfd_put_64 (abfd, val, ptr) \
+ : (abort (), (void) 0))
/* Byte swapping macros for file header data. */
@@ -946,54 +955,32 @@ bfd_make_readable PARAMS ((bfd *abfd));
#define bfd_h_get_signed_64(abfd, ptr) \
BFD_SEND (abfd, bfd_h_getx_signed_64, (ptr))
-/* Refinements on the above, which should eventually go away. Save
- cluttering the source with (bfd_vma) and (bfd_byte *) casts. */
-
-#define H_PUT_64(abfd, val, where) \
- bfd_h_put_64 ((abfd), (bfd_vma) (val), (bfd_byte *) (where))
-
-#define H_PUT_32(abfd, val, where) \
- bfd_h_put_32 ((abfd), (bfd_vma) (val), (bfd_byte *) (where))
-
-#define H_PUT_16(abfd, val, where) \
- bfd_h_put_16 ((abfd), (bfd_vma) (val), (bfd_byte *) (where))
-
-#define H_PUT_8 bfd_h_put_8
-
-#define H_PUT_S64(abfd, val, where) \
- bfd_h_put_signed_64 ((abfd), (bfd_vma) (val), (bfd_byte *) (where))
-
-#define H_PUT_S32(abfd, val, where) \
- bfd_h_put_signed_32 ((abfd), (bfd_vma) (val), (bfd_byte *) (where))
-
-#define H_PUT_S16(abfd, val, where) \
- bfd_h_put_signed_16 ((abfd), (bfd_vma) (val), (bfd_byte *) (where))
-
-#define H_PUT_S8 bfd_h_put_signed_8
-
-#define H_GET_64(abfd, where) \
- bfd_h_get_64 ((abfd), (bfd_byte *) (where))
-
-#define H_GET_32(abfd, where) \
- bfd_h_get_32 ((abfd), (bfd_byte *) (where))
-
-#define H_GET_16(abfd, where) \
- bfd_h_get_16 ((abfd), (bfd_byte *) (where))
+/* Aliases for the above, which should eventually go away. */
-#define H_GET_8 bfd_h_get_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_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_S64(abfd, where) \
- bfd_h_get_signed_64 ((abfd), (bfd_byte *) (where))
-#define H_GET_S32(abfd, where) \
- bfd_h_get_signed_32 ((abfd), (bfd_byte *) (where))
-
-#define H_GET_S16(abfd, where) \
- bfd_h_get_signed_16 ((abfd), (bfd_byte *) (where))
-
-#define H_GET_S8 bfd_h_get_signed_8
+/* Extracted from bfdio.c. */
+long bfd_get_mtime (bfd *abfd);
+long bfd_get_size (bfd *abfd);
+/* Extracted from bfdwin.c. */
/* Extracted from section.c. */
/* This structure is used for a comdat section, as in PE. A comdat
section is associated with a particular symbol. When the linker
@@ -1012,7 +999,7 @@ struct bfd_comdat_info
long symbol;
};
-typedef struct sec
+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. */
@@ -1025,7 +1012,7 @@ typedef struct sec
int index;
/* The next section in the list belonging to the BFD, or NULL. */
- struct sec *next;
+ struct bfd_section *next;
/* The field flags contains attributes of the section. Some
flags are read in from the object file, and some are
@@ -1223,10 +1210,39 @@ typedef struct sec
/* A mark flag used by some linker backends for garbage collection. */
unsigned int gc_mark : 1;
- /* Used by the ELF code to mark sections which have been allocated
- to segments. */
+ /* 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
@@ -1262,7 +1278,7 @@ typedef struct sec
bfd_vma output_offset;
/* The output section through which to map on output. */
- struct sec *output_section;
+ 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). */
@@ -1292,7 +1308,7 @@ typedef struct sec
file_ptr line_filepos;
/* Pointer to data for applications. */
- PTR userdata;
+ void *userdata;
/* If the SEC_IN_MEMORY flag is set, this points to the actual
contents. */
@@ -1310,6 +1326,10 @@ typedef struct sec
/* 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;
@@ -1317,7 +1337,7 @@ typedef struct sec
/* What the section number is in the target world. */
int target_index;
- PTR used_by_bfd;
+ void *used_by_bfd;
/* If this is a constructor section then here is a list of the
relocations created to relocate items within it. */
@@ -1327,8 +1347,8 @@ typedef struct sec
bfd *owner;
/* A symbol which points at this section only. */
- struct symbol_cache_entry *symbol;
- struct symbol_cache_entry **symbol_ptr_ptr;
+ struct bfd_symbol *symbol;
+ struct bfd_symbol **symbol_ptr_ptr;
struct bfd_link_order *link_order_head;
struct bfd_link_order *link_order_tail;
@@ -1345,18 +1365,18 @@ typedef struct sec
#define BFD_IND_SECTION_NAME "*IND*"
/* The absolute section. */
-extern const asection bfd_abs_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 const asection bfd_und_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 const asection bfd_com_section;
+extern asection bfd_com_section;
#define bfd_com_section_ptr ((asection *) &bfd_com_section)
/* Pointer to the indirect section. */
-extern const asection bfd_ind_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)
@@ -1366,13 +1386,12 @@ extern const asection bfd_ind_section;
|| ((SEC) == bfd_com_section_ptr) \
|| ((SEC) == bfd_ind_section_ptr))
-extern const struct symbol_cache_entry * const bfd_abs_symbol;
-extern const struct symbol_cache_entry * const bfd_com_symbol;
-extern const struct symbol_cache_entry * const bfd_und_symbol;
-extern const struct symbol_cache_entry * const bfd_ind_symbol;
+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)->reloc_done ? (abort (), (bfd_size_type) 1) \
- : (section)->_raw_size)
+ ((section)->_raw_size)
#define bfd_get_section_size_after_reloc(section) \
((section)->reloc_done ? (section)->_cooked_size \
: (abort (), (bfd_size_type) 1))
@@ -1402,61 +1421,48 @@ extern const struct symbol_cache_entry * const bfd_ind_symbol;
} \
while (0)
-void
-bfd_section_list_clear PARAMS ((bfd *));
+void bfd_section_list_clear (bfd *);
-asection *
-bfd_get_section_by_name PARAMS ((bfd *abfd, const char *name));
+asection *bfd_get_section_by_name (bfd *abfd, const char *name);
-char *
-bfd_get_unique_section_name PARAMS ((bfd *abfd,
- const char *templat,
- int *count));
+char *bfd_get_unique_section_name
+ (bfd *abfd, const char *templat, int *count);
-asection *
-bfd_make_section_old_way PARAMS ((bfd *abfd, const char *name));
+asection *bfd_make_section_old_way (bfd *abfd, const char *name);
-asection *
-bfd_make_section_anyway PARAMS ((bfd *abfd, const char *name));
+asection *bfd_make_section_anyway (bfd *abfd, const char *name);
-asection *
-bfd_make_section PARAMS ((bfd *, const char *name));
+asection *bfd_make_section (bfd *, const char *name);
-boolean
-bfd_set_section_flags PARAMS ((bfd *abfd, asection *sec, flagword flags));
+bfd_boolean bfd_set_section_flags
+ (bfd *abfd, asection *sec, flagword flags);
-void
-bfd_map_over_sections PARAMS ((bfd *abfd,
- void (*func) (bfd *abfd,
- asection *sect,
- PTR obj),
- PTR obj));
+void bfd_map_over_sections
+ (bfd *abfd,
+ void (*func) (bfd *abfd, asection *sect, void *obj),
+ void *obj);
-boolean
-bfd_set_section_size PARAMS ((bfd *abfd, asection *sec, bfd_size_type val));
+bfd_boolean bfd_set_section_size
+ (bfd *abfd, asection *sec, bfd_size_type val);
-boolean
-bfd_set_section_contents PARAMS ((bfd *abfd, asection *section,
- PTR data, file_ptr offset,
- bfd_size_type count));
+bfd_boolean bfd_set_section_contents
+ (bfd *abfd, asection *section, const void *data,
+ file_ptr offset, bfd_size_type count);
-boolean
-bfd_get_section_contents PARAMS ((bfd *abfd, asection *section,
- PTR location, file_ptr offset,
- bfd_size_type count));
+bfd_boolean bfd_get_section_contents
+ (bfd *abfd, asection *section, void *location, file_ptr offset,
+ bfd_size_type count);
-boolean
-bfd_copy_private_section_data PARAMS ((bfd *ibfd, asection *isec,
- bfd *obfd, asection *osec));
+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 PARAMS ((struct bfd_link_info *info, asection *section));
+void _bfd_strip_section_from_output
+ (struct bfd_link_info *info, asection *section);
-boolean
-bfd_generic_discard_group PARAMS ((bfd *abfd, asection *group));
+bfd_boolean bfd_generic_discard_group (bfd *abfd, asection *group);
/* Extracted from archures.c. */
enum bfd_architecture
@@ -1476,6 +1482,7 @@ enum bfd_architecture
#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.
@@ -1521,12 +1528,16 @@ enum bfd_architecture
#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
@@ -1534,13 +1545,15 @@ enum bfd_architecture
#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 0
-#define bfd_mach_i386_i8086 1
-#define bfd_mach_i386_i386_intel_syntax 2
-#define bfd_mach_x86_64 3
-#define bfd_mach_x86_64_intel_syntax 4
+#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 */
@@ -1549,15 +1562,20 @@ enum bfd_architecture
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, /* Hitachi H8/300 */
-#define bfd_mach_h8300 1
-#define bfd_mach_h8300h 2
-#define bfd_mach_h8300s 3
+ 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 0
-#define bfd_mach_ppc64 1
+#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
@@ -1574,38 +1592,52 @@ enum bfd_architecture
#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 0
+#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 0
+#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, /* Hitachi H8/500 */
- bfd_arch_sh, /* Hitachi SH */
-#define bfd_mach_sh 0
+ 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
@@ -1616,40 +1648,54 @@ enum bfd_architecture
#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 0
+#define bfd_mach_v850 1
#define bfd_mach_v850e 'E'
-#define bfd_mach_v850ea 'A'
+#define bfd_mach_v850e1 '1'
bfd_arch_arc, /* ARC Cores */
-#define bfd_mach_arc_5 0
-#define bfd_mach_arc_6 1
-#define bfd_mach_arc_7 2
-#define bfd_mach_arc_8 3
- bfd_arch_m32r, /* Mitsubishi M32R/D */
-#define bfd_mach_m32r 0 /* For backwards compatibility. */
+#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 0
-#define bfd_mach_frvsimple 1
+#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 0
-#define bfd_mach_ia64_elf32 1
+#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
@@ -1659,12 +1705,29 @@ enum bfd_architecture
#define bfd_mach_avr5 5
bfd_arch_cris, /* Axis CRIS */
bfd_arch_s390, /* IBM s390 */
-#define bfd_mach_s390_31 0
-#define bfd_mach_s390_64 1
+#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 0
+#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
};
@@ -1678,66 +1741,50 @@ typedef struct bfd_arch_info
const char *arch_name;
const char *printable_name;
unsigned int section_align_power;
- /* True if this is the default machine for the architecture.
+ /* TRUE if this is the default machine for the architecture.
The default arch should be the first entry for an arch so that
all the entries for that arch can be accessed via <<next>>. */
- boolean the_default;
+ bfd_boolean the_default;
const struct bfd_arch_info * (*compatible)
- PARAMS ((const struct bfd_arch_info *a,
- const struct bfd_arch_info *b));
+ (const struct bfd_arch_info *a, const struct bfd_arch_info *b);
- boolean (*scan) PARAMS ((const struct bfd_arch_info *, const char *));
+ bfd_boolean (*scan) (const struct bfd_arch_info *, const char *);
const struct bfd_arch_info *next;
}
bfd_arch_info_type;
-const char *
-bfd_printable_name PARAMS ((bfd *abfd));
+const char *bfd_printable_name (bfd *abfd);
-const bfd_arch_info_type *
-bfd_scan_arch PARAMS ((const char *string));
+const bfd_arch_info_type *bfd_scan_arch (const char *string);
-const char **
-bfd_arch_list PARAMS ((void));
+const char **bfd_arch_list (void);
-const bfd_arch_info_type *
-bfd_arch_get_compatible PARAMS ((
- const bfd *abfd,
- const bfd *bbfd));
+const bfd_arch_info_type *bfd_arch_get_compatible
+ (const bfd *abfd, const bfd *bbfd, bfd_boolean accept_unknowns);
-void
-bfd_set_arch_info PARAMS ((bfd *abfd, const bfd_arch_info_type *arg));
+void bfd_set_arch_info (bfd *abfd, const bfd_arch_info_type *arg);
-enum bfd_architecture
-bfd_get_arch PARAMS ((bfd *abfd));
+enum bfd_architecture bfd_get_arch (bfd *abfd);
-unsigned long
-bfd_get_mach PARAMS ((bfd *abfd));
+unsigned long bfd_get_mach (bfd *abfd);
-unsigned int
-bfd_arch_bits_per_byte PARAMS ((bfd *abfd));
+unsigned int bfd_arch_bits_per_byte (bfd *abfd);
-unsigned int
-bfd_arch_bits_per_address PARAMS ((bfd *abfd));
+unsigned int bfd_arch_bits_per_address (bfd *abfd);
-const bfd_arch_info_type *
-bfd_get_arch_info PARAMS ((bfd *abfd));
+const bfd_arch_info_type *bfd_get_arch_info (bfd *abfd);
-const bfd_arch_info_type *
-bfd_lookup_arch PARAMS ((enum bfd_architecture
- arch,
- unsigned long machine));
+const bfd_arch_info_type *bfd_lookup_arch
+ (enum bfd_architecture arch, unsigned long machine);
-const char *
-bfd_printable_arch_mach PARAMS ((enum bfd_architecture arch, unsigned long machine));
+const char *bfd_printable_arch_mach
+ (enum bfd_architecture arch, unsigned long machine);
-unsigned int
-bfd_octets_per_byte PARAMS ((bfd *abfd));
+unsigned int bfd_octets_per_byte (bfd *abfd);
-unsigned int
-bfd_arch_mach_octets_per_byte PARAMS ((enum bfd_architecture arch,
- unsigned long machine));
+unsigned int bfd_arch_mach_octets_per_byte
+ (enum bfd_architecture arch, unsigned long machine);
/* Extracted from reloc.c. */
typedef enum bfd_reloc_status
@@ -1775,7 +1822,7 @@ typedef enum bfd_reloc_status
typedef struct reloc_cache_entry
{
/* A pointer into the canonical table of pointers. */
- struct symbol_cache_entry **sym_ptr_ptr;
+ struct bfd_symbol **sym_ptr_ptr;
/* offset in section. */
bfd_size_type address;
@@ -1834,7 +1881,7 @@ struct reloc_howto_struct
data section of the addend. The relocation function will
subtract from the relocation value the address of the location
being relocated. */
- boolean pc_relative;
+ bfd_boolean pc_relative;
/* The bit position of the reloc value in the destination.
The relocated value is left shifted by this amount. */
@@ -1846,11 +1893,11 @@ struct reloc_howto_struct
/* If this field is non null, then the supplied function is
called rather than the normal function. This allows really
- strange relocation methods to be accomodated (e.g., i960 callj
+ strange relocation methods to be accommodated (e.g., i960 callj
instructions). */
bfd_reloc_status_type (*special_function)
- PARAMS ((bfd *, arelent *, struct symbol_cache_entry *, PTR, asection *,
- bfd *, char **));
+ (bfd *, arelent *, struct bfd_symbol *, void *, asection *,
+ bfd *, char **);
/* The textual name of the relocation type. */
char *name;
@@ -1870,21 +1917,20 @@ struct reloc_howto_struct
USE_REL targets set this field to TRUE. Why this is so is peculiar
to each particular target. For relocs that aren't used in partial
links (e.g. GOT stuff) it doesn't matter what this is set to. */
- boolean partial_inplace;
-
- /* The src_mask selects which parts of the read in data
- are to be used in the relocation sum. E.g., if this was an 8 bit
- byte of data which we read and relocated, this would be
- 0x000000ff. When we have relocs which have an addend, such as
- sun4 extended relocs, the value in the offset part of a
- relocating field is garbage so we never use it. In this case
- the mask would be 0x00000000. */
+ 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;
- /* The dst_mask selects which parts of the instruction are replaced
- into the instruction. In most cases src_mask == dst_mask,
- except in the above special case, where dst_mask would be
- 0x000000ff, and src_mask would be 0x00000000. */
+ /* 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
@@ -1893,22 +1939,22 @@ struct reloc_howto_struct
be made just by adding in an ordinary offset (e.g., sun3 a.out).
Some formats leave the displacement part of an instruction
empty (e.g., m88k bcs); this flag signals the fact. */
- boolean pcrel_offset;
+ bfd_boolean pcrel_offset;
};
#define HOWTO(C, R, S, B, P, BI, O, SF, NAME, INPLACE, MASKSRC, MASKDST, PC) \
{ (unsigned) C, R, S, B, P, BI, O, SF, NAME, INPLACE, MASKSRC, MASKDST, PC }
#define NEWHOWTO(FUNCTION, NAME, SIZE, REL, IN) \
HOWTO (0, 0, SIZE, 0, REL, 0, complain_overflow_dont, FUNCTION, \
- NAME, false, 0, 0, IN)
+ NAME, FALSE, 0, 0, IN)
#define EMPTY_HOWTO(C) \
- HOWTO ((C), 0, 0, 0, false, 0, complain_overflow_dont, NULL, \
- NULL, false, 0, 0, false)
+ HOWTO ((C), 0, 0, 0, FALSE, 0, complain_overflow_dont, NULL, \
+ NULL, FALSE, 0, 0, FALSE)
#define HOWTO_PREPARE(relocation, symbol) \
{ \
- if (symbol != (asymbol *) NULL) \
+ if (symbol != NULL) \
{ \
if (bfd_is_com_section (symbol->section)) \
{ \
@@ -1921,8 +1967,7 @@ struct reloc_howto_struct
} \
}
-unsigned int
-bfd_get_reloc_size PARAMS ((reloc_howto_type *));
+unsigned int bfd_get_reloc_size (reloc_howto_type *);
typedef struct relent_chain
{
@@ -1931,27 +1976,27 @@ typedef struct relent_chain
}
arelent_chain;
-bfd_reloc_status_type
-bfd_check_overflow PARAMS ((enum complain_overflow how,
+bfd_reloc_status_type bfd_check_overflow
+ (enum complain_overflow how,
unsigned int bitsize,
unsigned int rightshift,
unsigned int addrsize,
- bfd_vma relocation));
+ bfd_vma relocation);
-bfd_reloc_status_type
-bfd_perform_relocation PARAMS ((bfd *abfd,
+bfd_reloc_status_type bfd_perform_relocation
+ (bfd *abfd,
arelent *reloc_entry,
- PTR data,
+ void *data,
asection *input_section,
bfd *output_bfd,
- char **error_message));
+ char **error_message);
-bfd_reloc_status_type
-bfd_install_relocation PARAMS ((bfd *abfd,
+bfd_reloc_status_type bfd_install_relocation
+ (bfd *abfd,
arelent *reloc_entry,
- PTR data, bfd_vma data_start,
+ void *data, bfd_vma data_start,
asection *input_section,
- char **error_message));
+ char **error_message);
enum bfd_reloc_code_real {
_dummy_first_bfd_reloc_code_real,
@@ -2096,6 +2141,32 @@ relocation types already defined. */
/* SPARC little endian relocation */
BFD_RELOC_SPARC_REV32,
+/* SPARC TLS relocations */
+ BFD_RELOC_SPARC_TLS_GD_HI22,
+ BFD_RELOC_SPARC_TLS_GD_LO10,
+ BFD_RELOC_SPARC_TLS_GD_ADD,
+ BFD_RELOC_SPARC_TLS_GD_CALL,
+ BFD_RELOC_SPARC_TLS_LDM_HI22,
+ BFD_RELOC_SPARC_TLS_LDM_LO10,
+ BFD_RELOC_SPARC_TLS_LDM_ADD,
+ BFD_RELOC_SPARC_TLS_LDM_CALL,
+ BFD_RELOC_SPARC_TLS_LDO_HIX22,
+ BFD_RELOC_SPARC_TLS_LDO_LOX10,
+ BFD_RELOC_SPARC_TLS_LDO_ADD,
+ BFD_RELOC_SPARC_TLS_IE_HI22,
+ BFD_RELOC_SPARC_TLS_IE_LO10,
+ BFD_RELOC_SPARC_TLS_IE_LD,
+ BFD_RELOC_SPARC_TLS_IE_LDX,
+ BFD_RELOC_SPARC_TLS_IE_ADD,
+ BFD_RELOC_SPARC_TLS_LE_HIX22,
+ BFD_RELOC_SPARC_TLS_LE_LOX10,
+ BFD_RELOC_SPARC_TLS_DTPMOD32,
+ BFD_RELOC_SPARC_TLS_DTPMOD64,
+ BFD_RELOC_SPARC_TLS_DTPOFF32,
+ BFD_RELOC_SPARC_TLS_DTPOFF64,
+ BFD_RELOC_SPARC_TLS_TPOFF32,
+ BFD_RELOC_SPARC_TLS_TPOFF64,
+
/* Alpha ECOFF and ELF relocations. Some of these treat the symbol or
"addend" in some special way.
For GPDISP_HI16 ("gpdisp") relocations, the symbol is ignored when
@@ -2161,7 +2232,7 @@ GP register. */
BFD_RELOC_ALPHA_GPREL_LO16,
/* Like BFD_RELOC_23_PCREL_S2, except that the source and target must
-share a common GP, and the target address is adjusted for
+share a common GP, and the target address is adjusted for
STO_ALPHA_STD_GPLOAD. */
BFD_RELOC_ALPHA_BRSGP,
@@ -2234,6 +2305,7 @@ to compensate for the borrow when the low bits are added. */
BFD_RELOC_MIPS_RELGOT,
BFD_RELOC_MIPS_JALR,
+
/* Fujitsu Frv Relocations. */
BFD_RELOC_FRV_LABEL16,
BFD_RELOC_FRV_LABEL24,
@@ -2244,6 +2316,48 @@ to compensate for the borrow when the low bits are added. */
BFD_RELOC_FRV_GPREL32,
BFD_RELOC_FRV_GPRELHI,
BFD_RELOC_FRV_GPRELLO,
+ BFD_RELOC_FRV_GOT12,
+ BFD_RELOC_FRV_GOTHI,
+ BFD_RELOC_FRV_GOTLO,
+ BFD_RELOC_FRV_FUNCDESC,
+ BFD_RELOC_FRV_FUNCDESC_GOT12,
+ BFD_RELOC_FRV_FUNCDESC_GOTHI,
+ BFD_RELOC_FRV_FUNCDESC_GOTLO,
+ BFD_RELOC_FRV_FUNCDESC_VALUE,
+ BFD_RELOC_FRV_FUNCDESC_GOTOFF12,
+ BFD_RELOC_FRV_FUNCDESC_GOTOFFHI,
+ BFD_RELOC_FRV_FUNCDESC_GOTOFFLO,
+ BFD_RELOC_FRV_GOTOFF12,
+ BFD_RELOC_FRV_GOTOFFHI,
+ BFD_RELOC_FRV_GOTOFFLO,
+
+
+/* This is a 24bit GOT-relative reloc for the mn10300. */
+ BFD_RELOC_MN10300_GOTOFF24,
+
+/* This is a 32bit GOT-relative reloc for the mn10300, offset by two bytes
+in the instruction. */
+ BFD_RELOC_MN10300_GOT32,
+
+/* This is a 24bit GOT-relative reloc for the mn10300, offset by two bytes
+in the instruction. */
+ BFD_RELOC_MN10300_GOT24,
+
+/* This is a 16bit GOT-relative reloc for the mn10300, offset by two bytes
+in the instruction. */
+ BFD_RELOC_MN10300_GOT16,
+
+/* Copy symbol at runtime. */
+ BFD_RELOC_MN10300_COPY,
+
+/* Create GOT entry. */
+ BFD_RELOC_MN10300_GLOB_DAT,
+
+/* Create PLT entry. */
+ BFD_RELOC_MN10300_JMP_SLOT,
+
+/* Adjust by program base. */
+ BFD_RELOC_MN10300_RELATIVE,
/* i386/elf relocations */
@@ -2277,6 +2391,14 @@ to compensate for the borrow when the low bits are added. */
BFD_RELOC_X86_64_RELATIVE,
BFD_RELOC_X86_64_GOTPCREL,
BFD_RELOC_X86_64_32S,
+ BFD_RELOC_X86_64_DTPMOD64,
+ BFD_RELOC_X86_64_DTPOFF64,
+ BFD_RELOC_X86_64_TPOFF64,
+ BFD_RELOC_X86_64_TLSGD,
+ BFD_RELOC_X86_64_TLSLD,
+ BFD_RELOC_X86_64_DTPOFF32,
+ BFD_RELOC_X86_64_GOTTPOFF,
+ BFD_RELOC_X86_64_TPOFF32,
/* ns32k relocations */
BFD_RELOC_NS32K_IMM_8,
@@ -2359,10 +2481,52 @@ to compensate for the borrow when the low bits are added. */
BFD_RELOC_PPC64_PLTGOT16_DS,
BFD_RELOC_PPC64_PLTGOT16_LO_DS,
+/* PowerPC and PowerPC64 thread-local storage relocations. */
+ BFD_RELOC_PPC_TLS,
+ BFD_RELOC_PPC_DTPMOD,
+ BFD_RELOC_PPC_TPREL16,
+ BFD_RELOC_PPC_TPREL16_LO,
+ BFD_RELOC_PPC_TPREL16_HI,
+ BFD_RELOC_PPC_TPREL16_HA,
+ BFD_RELOC_PPC_TPREL,
+ BFD_RELOC_PPC_DTPREL16,
+ BFD_RELOC_PPC_DTPREL16_LO,
+ BFD_RELOC_PPC_DTPREL16_HI,
+ BFD_RELOC_PPC_DTPREL16_HA,
+ BFD_RELOC_PPC_DTPREL,
+ BFD_RELOC_PPC_GOT_TLSGD16,
+ BFD_RELOC_PPC_GOT_TLSGD16_LO,
+ BFD_RELOC_PPC_GOT_TLSGD16_HI,
+ BFD_RELOC_PPC_GOT_TLSGD16_HA,
+ BFD_RELOC_PPC_GOT_TLSLD16,
+ BFD_RELOC_PPC_GOT_TLSLD16_LO,
+ BFD_RELOC_PPC_GOT_TLSLD16_HI,
+ BFD_RELOC_PPC_GOT_TLSLD16_HA,
+ BFD_RELOC_PPC_GOT_TPREL16,
+ BFD_RELOC_PPC_GOT_TPREL16_LO,
+ BFD_RELOC_PPC_GOT_TPREL16_HI,
+ BFD_RELOC_PPC_GOT_TPREL16_HA,
+ BFD_RELOC_PPC_GOT_DTPREL16,
+ BFD_RELOC_PPC_GOT_DTPREL16_LO,
+ BFD_RELOC_PPC_GOT_DTPREL16_HI,
+ BFD_RELOC_PPC_GOT_DTPREL16_HA,
+ BFD_RELOC_PPC64_TPREL16_DS,
+ BFD_RELOC_PPC64_TPREL16_LO_DS,
+ BFD_RELOC_PPC64_TPREL16_HIGHER,
+ BFD_RELOC_PPC64_TPREL16_HIGHERA,
+ BFD_RELOC_PPC64_TPREL16_HIGHEST,
+ BFD_RELOC_PPC64_TPREL16_HIGHESTA,
+ BFD_RELOC_PPC64_DTPREL16_DS,
+ BFD_RELOC_PPC64_DTPREL16_LO_DS,
+ BFD_RELOC_PPC64_DTPREL16_HIGHER,
+ BFD_RELOC_PPC64_DTPREL16_HIGHERA,
+ BFD_RELOC_PPC64_DTPREL16_HIGHEST,
+ BFD_RELOC_PPC64_DTPREL16_HIGHESTA,
+
/* IBM 370/390 relocations */
BFD_RELOC_I370_D12,
-/* The type of reloc used to build a contructor table - at the moment
+/* The type of reloc used to build a constructor table - at the moment
probably a 32 bit wide absolute relocation, but the target can choose.
It generally does map to one of the other relocation types. */
BFD_RELOC_CTOR,
@@ -2390,6 +2554,7 @@ field in the instruction. */
BFD_RELOC_ARM_SWI,
BFD_RELOC_ARM_MULTI,
BFD_RELOC_ARM_CP_OFF_IMM,
+ BFD_RELOC_ARM_CP_OFF_IMM_S2,
BFD_RELOC_ARM_ADR_IMM,
BFD_RELOC_ARM_LDR_IMM,
BFD_RELOC_ARM_LITERAL,
@@ -2410,7 +2575,7 @@ field in the instruction. */
BFD_RELOC_ARM_GOTOFF,
BFD_RELOC_ARM_GOTPC,
-/* Hitachi SH relocs. Not all of these appear in object files. */
+/* Renesas / SuperH SH relocs. Not all of these appear in object files. */
BFD_RELOC_SH_PCDISP8BY2,
BFD_RELOC_SH_PCDISP12BY2,
BFD_RELOC_SH_IMM4,
@@ -2485,6 +2650,14 @@ field in the instruction. */
BFD_RELOC_SH_IMM_HI16,
BFD_RELOC_SH_IMM_HI16_PCREL,
BFD_RELOC_SH_PT_16,
+ BFD_RELOC_SH_TLS_GD_32,
+ BFD_RELOC_SH_TLS_LD_32,
+ BFD_RELOC_SH_TLS_LDO_32,
+ BFD_RELOC_SH_TLS_IE_32,
+ BFD_RELOC_SH_TLS_LE_32,
+ BFD_RELOC_SH_TLS_DTPMOD32,
+ BFD_RELOC_SH_TLS_DTPOFF32,
+ BFD_RELOC_SH_TLS_TPOFF32,
/* Thumb 23-, 12- and 9-bit pc-relative branches. The lowest bit must
be zero and is not stored in the instruction. */
@@ -2580,7 +2753,7 @@ of the container. */
/* DLX relocs */
BFD_RELOC_DLX_JMP26,
-/* Mitsubishi M32R relocs.
+/* Renesas M32R (formerly Mitsubishi M32R) relocs.
This is a 24 bit absolute address. */
BFD_RELOC_M32R_24,
@@ -2608,6 +2781,22 @@ used when the lower 16 bits are treated as signed. */
add3, load, and store instructions. */
BFD_RELOC_M32R_SDA16,
+/* For PIC. */
+ BFD_RELOC_M32R_GOT24,
+ BFD_RELOC_M32R_26_PLTREL,
+ BFD_RELOC_M32R_COPY,
+ BFD_RELOC_M32R_GLOB_DAT,
+ BFD_RELOC_M32R_JMP_SLOT,
+ BFD_RELOC_M32R_RELATIVE,
+ BFD_RELOC_M32R_GOTOFF,
+ BFD_RELOC_M32R_GOTPC24,
+ BFD_RELOC_M32R_GOT16_HI_ULO,
+ BFD_RELOC_M32R_GOT16_HI_SLO,
+ BFD_RELOC_M32R_GOT16_LO,
+ BFD_RELOC_M32R_GOTPC_HI_ULO,
+ BFD_RELOC_M32R_GOTPC_HI_SLO,
+ BFD_RELOC_M32R_GOTPC_LO,
+
/* This is a 9-bit reloc */
BFD_RELOC_V850_9_PCREL,
@@ -2650,11 +2839,11 @@ data area pointer. */
BFD_RELOC_V850_TDA_4_4_OFFSET,
/* This is a 16 bit offset from the short data area pointer, with the
-bits placed non-contigously in the instruction. */
+bits placed non-contiguously in the instruction. */
BFD_RELOC_V850_SDA_16_16_SPLIT_OFFSET,
/* This is a 16 bit offset from the zero data area pointer, with the
-bits placed non-contigously in the instruction. */
+bits placed non-contiguously in the instruction. */
BFD_RELOC_V850_ZDA_16_16_SPLIT_OFFSET,
/* This is a 6 bit offset from the call table base pointer. */
@@ -2663,6 +2852,14 @@ bits placed non-contigously in the instruction. */
/* This is a 16 bit offset from the call table base pointer. */
BFD_RELOC_V850_CALLT_16_16_OFFSET,
+/* Used for relaxing indirect function calls. */
+ BFD_RELOC_V850_LONGCALL,
+
+/* Used for relaxing indirect jumps. */
+ BFD_RELOC_V850_LONGJUMP,
+
+/* Used to maintain alignment whilst relaxing. */
+ BFD_RELOC_V850_ALIGN,
/* This is a 32bit pcrel reloc for the mn10300, offset by two bytes in the
instruction. */
@@ -2757,6 +2954,7 @@ short offset into 11 bits. */
BFD_RELOC_MMIX_PUSHJ_1,
BFD_RELOC_MMIX_PUSHJ_2,
BFD_RELOC_MMIX_PUSHJ_3,
+ BFD_RELOC_MMIX_PUSHJ_STUBBABLE,
/* These are relocations for the JMP instruction. */
BFD_RELOC_MMIX_JMP,
@@ -2906,6 +3104,95 @@ into 22 bits. */
/* 32 bit rel. offset to GOT entry. */
BFD_RELOC_390_GOTENT,
+/* 64 bit offset to GOT. */
+ BFD_RELOC_390_GOTOFF64,
+
+/* 12-bit offset to symbol-entry within GOT, with PLT handling. */
+ BFD_RELOC_390_GOTPLT12,
+
+/* 16-bit offset to symbol-entry within GOT, with PLT handling. */
+ BFD_RELOC_390_GOTPLT16,
+
+/* 32-bit offset to symbol-entry within GOT, with PLT handling. */
+ BFD_RELOC_390_GOTPLT32,
+
+/* 64-bit offset to symbol-entry within GOT, with PLT handling. */
+ BFD_RELOC_390_GOTPLT64,
+
+/* 32-bit rel. offset to symbol-entry within GOT, with PLT handling. */
+ BFD_RELOC_390_GOTPLTENT,
+
+/* 16-bit rel. offset from the GOT to a PLT entry. */
+ BFD_RELOC_390_PLTOFF16,
+
+/* 32-bit rel. offset from the GOT to a PLT entry. */
+ BFD_RELOC_390_PLTOFF32,
+
+/* 64-bit rel. offset from the GOT to a PLT entry. */
+ BFD_RELOC_390_PLTOFF64,
+
+/* s390 tls relocations. */
+ BFD_RELOC_390_TLS_LOAD,
+ BFD_RELOC_390_TLS_GDCALL,
+ BFD_RELOC_390_TLS_LDCALL,
+ BFD_RELOC_390_TLS_GD32,
+ BFD_RELOC_390_TLS_GD64,
+ BFD_RELOC_390_TLS_GOTIE12,
+ BFD_RELOC_390_TLS_GOTIE32,
+ BFD_RELOC_390_TLS_GOTIE64,
+ BFD_RELOC_390_TLS_LDM32,
+ BFD_RELOC_390_TLS_LDM64,
+ BFD_RELOC_390_TLS_IE32,
+ BFD_RELOC_390_TLS_IE64,
+ BFD_RELOC_390_TLS_IEENT,
+ BFD_RELOC_390_TLS_LE32,
+ BFD_RELOC_390_TLS_LE64,
+ BFD_RELOC_390_TLS_LDO32,
+ BFD_RELOC_390_TLS_LDO64,
+ BFD_RELOC_390_TLS_DTPMOD,
+ BFD_RELOC_390_TLS_DTPOFF,
+ BFD_RELOC_390_TLS_TPOFF,
+
+/* Long displacement extension. */
+ BFD_RELOC_390_20,
+ BFD_RELOC_390_GOT20,
+ BFD_RELOC_390_GOTPLT20,
+ BFD_RELOC_390_TLS_GOTIE20,
+
+/* Scenix IP2K - 9-bit register number / data address */
+ BFD_RELOC_IP2K_FR9,
+
+/* Scenix IP2K - 4-bit register/data bank number */
+ BFD_RELOC_IP2K_BANK,
+
+/* Scenix IP2K - low 13 bits of instruction word address */
+ BFD_RELOC_IP2K_ADDR16CJP,
+
+/* Scenix IP2K - high 3 bits of instruction word address */
+ BFD_RELOC_IP2K_PAGE3,
+
+/* Scenix IP2K - ext/low/high 8 bits of data address */
+ BFD_RELOC_IP2K_LO8DATA,
+ BFD_RELOC_IP2K_HI8DATA,
+ BFD_RELOC_IP2K_EX8DATA,
+
+/* Scenix IP2K - low/high 8 bits of instruction word address */
+ BFD_RELOC_IP2K_LO8INSN,
+ BFD_RELOC_IP2K_HI8INSN,
+
+/* Scenix IP2K - even/odd PC modifier to modify snb pcl.0 */
+ BFD_RELOC_IP2K_PC_SKIP,
+
+/* Scenix IP2K - 16 bit word address in text section. */
+ BFD_RELOC_IP2K_TEXT,
+
+/* Scenix IP2K - 7-bit sp or dp offset */
+ BFD_RELOC_IP2K_FR_OFFSET,
+
+/* Scenix VPE4K coprocessor - data/insn-space addressing */
+ BFD_RELOC_VPE4KMATH_DATA,
+ BFD_RELOC_VPE4KMATH_INSN,
+
/* These two relocations are used by the linker to determine which of
the entries in a C++ virtual function table are actually used. When
the --gc-sections option is given, the linker will zero out the entries
@@ -2913,7 +3200,7 @@ 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 inheritence tree of a C++ virtual function table. 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.
@@ -3008,17 +3295,52 @@ this offset in the reloc's section offset. */
BFD_RELOC_IA64_LTOFF_DTPREL22,
/* Motorola 68HC11 reloc.
-This is the 8 bits high part of an absolute address. */
+This is the 8 bit high part of an absolute address. */
BFD_RELOC_M68HC11_HI8,
/* Motorola 68HC11 reloc.
-This is the 8 bits low part of an absolute address. */
+This is the 8 bit low part of an absolute address. */
BFD_RELOC_M68HC11_LO8,
/* Motorola 68HC11 reloc.
-This is the 3 bits of a value. */
+This is the 3 bit of a value. */
BFD_RELOC_M68HC11_3B,
+/* Motorola 68HC11 reloc.
+This reloc marks the beginning of a jump/call instruction.
+It is used for linker relaxation to correctly identify beginning
+of instruction and change some branches to use PC-relative
+addressing mode. */
+ BFD_RELOC_M68HC11_RL_JUMP,
+
+/* Motorola 68HC11 reloc.
+This reloc marks a group of several instructions that gcc generates
+and for which the linker relaxation pass can modify and/or remove
+some of them. */
+ BFD_RELOC_M68HC11_RL_GROUP,
+
+/* Motorola 68HC11 reloc.
+This is the 16-bit lower part of an address. It is used for 'call'
+instruction to specify the symbol address without any special
+transformation (due to memory bank window). */
+ BFD_RELOC_M68HC11_LO16,
+
+/* Motorola 68HC11 reloc.
+This is a 8-bit reloc that specifies the page number of an address.
+It is used by 'call' instruction to specify the page number of
+the symbol. */
+ BFD_RELOC_M68HC11_PAGE,
+
+/* Motorola 68HC11 reloc.
+This is a 24-bit reloc that represents the address with a 16-bit
+value and a 8-bit page number. The symbol address is transformed
+to follow the 16K memory bank of 68HC12 (seen as mapped in the window). */
+ BFD_RELOC_M68HC11_24,
+
+/* Motorola 68HC12 reloc.
+This is the 5 bits of a value. */
+ BFD_RELOC_M68HC12_5B,
+
/* These relocs are only used within the CRIS assembler. They are not
(at present) written to any object files. */
BFD_RELOC_CRIS_BDISP8,
@@ -3101,6 +3423,7 @@ This is the 3 bits of a value. */
/* Sony Xstormy16 Relocations. */
BFD_RELOC_XSTORMY16_REL_12,
+ BFD_RELOC_XSTORMY16_12,
BFD_RELOC_XSTORMY16_24,
BFD_RELOC_XSTORMY16_FPTR16,
@@ -3108,17 +3431,60 @@ This is the 3 bits of a value. */
BFD_RELOC_VAX_GLOB_DAT,
BFD_RELOC_VAX_JMP_SLOT,
BFD_RELOC_VAX_RELATIVE,
+
+/* msp430 specific relocation codes */
+ BFD_RELOC_MSP430_10_PCREL,
+ BFD_RELOC_MSP430_16_PCREL,
+ BFD_RELOC_MSP430_16,
+ BFD_RELOC_MSP430_16_PCREL_BYTE,
+ BFD_RELOC_MSP430_16_BYTE,
+
+/* IQ2000 Relocations. */
+ BFD_RELOC_IQ2000_OFFSET_16,
+ BFD_RELOC_IQ2000_OFFSET_21,
+ BFD_RELOC_IQ2000_UHI16,
+
+/* Special Xtensa relocation used only by PLT entries in ELF shared
+objects to indicate that the runtime linker should set the value
+to one of its own internal functions or data structures. */
+ BFD_RELOC_XTENSA_RTLD,
+
+/* Xtensa relocations for ELF shared objects. */
+ BFD_RELOC_XTENSA_GLOB_DAT,
+ BFD_RELOC_XTENSA_JMP_SLOT,
+ BFD_RELOC_XTENSA_RELATIVE,
+
+/* Xtensa relocation used in ELF object files for symbols that may require
+PLT entries. Otherwise, this is just a generic 32-bit relocation. */
+ BFD_RELOC_XTENSA_PLT,
+
+/* Generic Xtensa relocations. Only the operand number is encoded
+in the relocation. The details are determined by extracting the
+instruction opcode. */
+ BFD_RELOC_XTENSA_OP0,
+ BFD_RELOC_XTENSA_OP1,
+ BFD_RELOC_XTENSA_OP2,
+
+/* Xtensa relocation to mark that the assembler expanded the
+instructions from an original target. The expansion size is
+encoded in the reloc size. */
+ BFD_RELOC_XTENSA_ASM_EXPAND,
+
+/* Xtensa relocation to mark that the linker should simplify
+assembler-expanded instructions. This is commonly used
+internally by the linker after analysis of a
+BFD_RELOC_XTENSA_ASM_EXPAND. */
+ BFD_RELOC_XTENSA_ASM_SIMPLIFY,
BFD_RELOC_UNUSED };
typedef enum bfd_reloc_code_real bfd_reloc_code_real_type;
-reloc_howto_type *
-bfd_reloc_type_lookup PARAMS ((bfd *abfd, bfd_reloc_code_real_type code));
+reloc_howto_type *bfd_reloc_type_lookup
+ (bfd *abfd, bfd_reloc_code_real_type code);
-const char *
-bfd_get_reloc_code_name PARAMS ((bfd_reloc_code_real_type code));
+const char *bfd_get_reloc_code_name (bfd_reloc_code_real_type code);
/* Extracted from syms.c. */
-typedef struct symbol_cache_entry
+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
@@ -3129,7 +3495,7 @@ typedef struct symbol_cache_entry
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. */
+ 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. */
@@ -3159,7 +3525,7 @@ typedef struct symbol_cache_entry
<<BSF_LOCAL>>, <<BSF_FORT_COMM>>, <<BSF_UNDEFINED>> or
<<BSF_GLOBAL>>. */
- /* The symbol is a debugging record. The value has an arbitary
+ /* The symbol is a debugging record. The value has an arbitrary
meaning, unless BSF_DEBUGGING_RELOC is also set. */
#define BSF_DEBUGGING 0x08
@@ -3230,12 +3596,12 @@ typedef struct symbol_cache_entry
/* 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 sec *section;
+ struct bfd_section *section;
/* Back end special data. */
union
{
- PTR p;
+ void *p;
bfd_vma i;
}
udata;
@@ -3245,53 +3611,48 @@ asymbol;
#define bfd_get_symtab_upper_bound(abfd) \
BFD_SEND (abfd, _bfd_get_symtab_upper_bound, (abfd))
-boolean
-bfd_is_local_label PARAMS ((bfd *abfd, asymbol *sym));
+bfd_boolean bfd_is_local_label (bfd *abfd, asymbol *sym);
-boolean
-bfd_is_local_label_name PARAMS ((bfd *abfd, const char *name));
+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_SEND (abfd, _bfd_is_local_label_name, (abfd, name))
#define bfd_canonicalize_symtab(abfd, location) \
- BFD_SEND (abfd, _bfd_canonicalize_symtab,\
- (abfd, location))
+ BFD_SEND (abfd, _bfd_canonicalize_symtab, (abfd, location))
-boolean
-bfd_set_symtab PARAMS ((bfd *abfd, asymbol **location, unsigned int count));
+bfd_boolean bfd_set_symtab
+ (bfd *abfd, asymbol **location, unsigned int count);
-void
-bfd_print_symbol_vandf PARAMS ((bfd *abfd, PTR file, asymbol *symbol));
+void bfd_print_symbol_vandf (bfd *abfd, void *file, asymbol *symbol);
#define bfd_make_empty_symbol(abfd) \
- BFD_SEND (abfd, _bfd_make_empty_symbol, (abfd))
+ BFD_SEND (abfd, _bfd_make_empty_symbol, (abfd))
-asymbol *
-_bfd_generic_make_empty_symbol PARAMS ((bfd *));
+asymbol *_bfd_generic_make_empty_symbol (bfd *);
#define bfd_make_debug_symbol(abfd,ptr,size) \
- BFD_SEND (abfd, _bfd_make_debug_symbol, (abfd, ptr, size))
+ BFD_SEND (abfd, _bfd_make_debug_symbol, (abfd, ptr, size))
-int
-bfd_decode_symclass PARAMS ((asymbol *symbol));
+int bfd_decode_symclass (asymbol *symbol);
-boolean
-bfd_is_undefined_symclass PARAMS ((int symclass));
+bfd_boolean bfd_is_undefined_symclass (int symclass);
-void
-bfd_symbol_info PARAMS ((asymbol *symbol, symbol_info *ret));
+void bfd_symbol_info (asymbol *symbol, symbol_info *ret);
-boolean
-bfd_copy_private_symbol_data PARAMS ((bfd *ibfd, asymbol *isym, bfd *obfd, asymbol *osym));
+bfd_boolean bfd_copy_private_symbol_data
+ (bfd *ibfd, asymbol *isym, bfd *obfd, asymbol *osym);
#define bfd_copy_private_symbol_data(ibfd, isymbol, obfd, osymbol) \
- BFD_SEND (obfd, _bfd_copy_private_symbol_data, \
- (ibfd, isymbol, obfd, osymbol))
+ BFD_SEND (obfd, _bfd_copy_private_symbol_data, \
+ (ibfd, isymbol, obfd, osymbol))
/* Extracted from bfd.c. */
-struct _bfd
+struct bfd
{
+ /* A unique identifier of the BFD */
+ unsigned int id;
+
/* The filename the application opened the BFD with. */
const char *filename;
@@ -3305,33 +3666,33 @@ struct _bfd
is the result of an fopen on the filename. However, if the
BFD_IN_MEMORY flag is set, then iostream is actually a pointer
to a bfd_in_memory struct. */
- PTR iostream;
+ void *iostream;
/* Is the file descriptor being cached? That is, can it be closed as
needed, and re-opened when accessed later? */
- boolean cacheable;
+ 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. */
- boolean target_defaulted;
+ bfd_boolean target_defaulted;
/* The caching routines use these to maintain a
least-recently-used list of BFDs. */
- struct _bfd *lru_prev, *lru_next;
+ 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). */
- boolean opened_once;
+ bfd_boolean opened_once;
/* Set if we have a locally maintained mtime value, rather than
getting it from the file each time. */
- boolean mtime_set;
+ bfd_boolean mtime_set;
- /* File modified time, if mtime_set is true. */
+ /* File modified time, if mtime_set is TRUE. */
long mtime;
/* Reserved for an unimplemented file locking extension. */
@@ -3360,16 +3721,16 @@ struct _bfd
/* Remember when output has begun, to stop strange things
from happening. */
- boolean output_has_begun;
+ bfd_boolean output_has_begun;
/* A hash table for section names. */
struct bfd_hash_table section_htab;
/* Pointer to linked list of sections. */
- struct sec *sections;
+ struct bfd_section *sections;
/* The place where we add to the section list. */
- struct sec **section_tail;
+ struct bfd_section **section_tail;
/* The number of sections. */
unsigned int section_count;
@@ -3382,7 +3743,7 @@ struct _bfd
unsigned int symcount;
/* Symbol table for output BFD (with symcount entries). */
- struct symbol_cache_entry **outsymbols;
+ struct bfd_symbol **outsymbols;
/* Used for slurped dynamic symbol tables. */
unsigned int dynsymcount;
@@ -3391,14 +3752,14 @@ struct _bfd
const struct bfd_arch_info *arch_info;
/* Stuff only useful for archives. */
- PTR arelt_data;
- struct _bfd *my_archive; /* The containing archive BFD. */
- struct _bfd *next; /* The next BFD in the archive. */
- struct _bfd *archive_head; /* The first BFD in the archive. */
- boolean has_armap;
+ 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;
+ struct bfd *link_next;
/* A field used by _bfd_generic_link_add_archive_symbols. This will
be used only for archive elements. */
@@ -3436,17 +3797,22 @@ struct _bfd
struct cisco_core_struct *cisco_core_data;
struct versados_data_struct *versados_data;
struct netbsd_core_struct *netbsd_core_data;
- PTR any;
+ 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. */
- PTR usrdata;
+ void *usrdata;
/* Where all the allocated stuff under this BFD goes. This is a
- struct objalloc *, but we use PTR to avoid requiring the inclusion of
- objalloc.h. */
- PTR memory;
+ struct objalloc *, but we use void * to avoid requiring the inclusion
+ of objalloc.h. */
+ void *memory;
};
typedef enum bfd_error
@@ -3474,114 +3840,84 @@ typedef enum bfd_error
}
bfd_error_type;
-bfd_error_type
-bfd_get_error PARAMS ((void));
-
-void
-bfd_set_error PARAMS ((bfd_error_type error_tag));
-
-const char *
-bfd_errmsg PARAMS ((bfd_error_type error_tag));
+bfd_error_type bfd_get_error (void);
-void
-bfd_perror PARAMS ((const char *message));
+void bfd_set_error (bfd_error_type error_tag);
-typedef void (*bfd_error_handler_type) PARAMS ((const char *, ...));
+const char *bfd_errmsg (bfd_error_type error_tag);
-bfd_error_handler_type
-bfd_set_error_handler PARAMS ((bfd_error_handler_type));
+void bfd_perror (const char *message);
-void
-bfd_set_error_program_name PARAMS ((const char *));
+typedef void (*bfd_error_handler_type) (const char *, ...);
-bfd_error_handler_type
-bfd_get_error_handler PARAMS ((void));
+bfd_error_handler_type bfd_set_error_handler (bfd_error_handler_type);
-const char *
-bfd_archive_filename PARAMS ((bfd *));
+void bfd_set_error_program_name (const char *);
-long
-bfd_get_reloc_upper_bound PARAMS ((bfd *abfd, asection *sect));
+bfd_error_handler_type bfd_get_error_handler (void);
-long
-bfd_canonicalize_reloc PARAMS ((bfd *abfd,
- asection *sec,
- arelent **loc,
- asymbol **syms));
+const char *bfd_archive_filename (bfd *);
-void
-bfd_set_reloc PARAMS ((bfd *abfd, asection *sec, arelent **rel, unsigned int count));
+long bfd_get_reloc_upper_bound (bfd *abfd, asection *sect);
-boolean
-bfd_set_file_flags PARAMS ((bfd *abfd, flagword flags));
+long bfd_canonicalize_reloc
+ (bfd *abfd, asection *sec, arelent **loc, asymbol **syms);
-int
-bfd_get_arch_size PARAMS ((bfd *abfd));
+void bfd_set_reloc
+ (bfd *abfd, asection *sec, arelent **rel, unsigned int count);
-int
-bfd_get_sign_extend_vma PARAMS ((bfd *abfd));
+bfd_boolean bfd_set_file_flags (bfd *abfd, flagword flags);
-boolean
-bfd_set_start_address PARAMS ((bfd *abfd, bfd_vma vma));
+int bfd_get_arch_size (bfd *abfd);
-long
-bfd_get_mtime PARAMS ((bfd *abfd));
+int bfd_get_sign_extend_vma (bfd *abfd);
-long
-bfd_get_size PARAMS ((bfd *abfd));
+bfd_boolean bfd_set_start_address (bfd *abfd, bfd_vma vma);
-unsigned int
-bfd_get_gp_size PARAMS ((bfd *abfd));
+unsigned int bfd_get_gp_size (bfd *abfd);
-void
-bfd_set_gp_size PARAMS ((bfd *abfd, unsigned int i));
+void bfd_set_gp_size (bfd *abfd, unsigned int i);
-bfd_vma
-bfd_scan_vma PARAMS ((const char *string, const char **end, int base));
+bfd_vma bfd_scan_vma (const char *string, const char **end, int base);
-boolean
-bfd_copy_private_bfd_data PARAMS ((bfd *ibfd, bfd *obfd));
+bfd_boolean bfd_copy_private_bfd_data (bfd *ibfd, bfd *obfd);
#define bfd_copy_private_bfd_data(ibfd, obfd) \
BFD_SEND (obfd, _bfd_copy_private_bfd_data, \
(ibfd, obfd))
-boolean
-bfd_merge_private_bfd_data PARAMS ((bfd *ibfd, bfd *obfd));
+bfd_boolean bfd_merge_private_bfd_data (bfd *ibfd, bfd *obfd);
#define bfd_merge_private_bfd_data(ibfd, obfd) \
BFD_SEND (obfd, _bfd_merge_private_bfd_data, \
(ibfd, obfd))
-boolean
-bfd_set_private_flags PARAMS ((bfd *abfd, flagword flags));
+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))
+ BFD_SEND (abfd, _bfd_set_private_flags, (abfd, flags))
#define bfd_sizeof_headers(abfd, reloc) \
- BFD_SEND (abfd, _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))
+ BFD_SEND (abfd, _bfd_find_nearest_line, \
+ (abfd, sec, syms, off, file, func, line))
- /* Do these three do anything useful at all, for any back end? */
#define bfd_debug_info_start(abfd) \
- BFD_SEND (abfd, _bfd_debug_info_start, (abfd))
+ BFD_SEND (abfd, _bfd_debug_info_start, (abfd))
#define bfd_debug_info_end(abfd) \
- BFD_SEND (abfd, _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))
-
+ 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))
+ BFD_SEND (abfd, _bfd_stat_arch_elt,(abfd, stat))
#define bfd_update_armap_timestamp(abfd) \
- BFD_SEND (abfd, _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))
+ 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))
@@ -3629,36 +3965,48 @@ bfd_set_private_flags PARAMS ((bfd *abfd, flagword flags));
BFD_SEND (abfd, _bfd_canonicalize_dynamic_reloc, (abfd, arels, asyms))
extern bfd_byte *bfd_get_relocated_section_contents
- PARAMS ((bfd *, struct bfd_link_info *,
- struct bfd_link_order *, bfd_byte *,
- boolean, asymbol **));
+ (bfd *, struct bfd_link_info *, struct bfd_link_order *, bfd_byte *,
+ bfd_boolean, asymbol **);
+
+bfd_boolean bfd_alt_mach_code (bfd *abfd, int alternative);
+
+struct bfd_preserve
+{
+ void *marker;
+ void *tdata;
+ flagword flags;
+ const struct bfd_arch_info *arch_info;
+ struct bfd_section *sections;
+ struct bfd_section **section_tail;
+ unsigned int section_count;
+ struct bfd_hash_table section_htab;
+};
+
+bfd_boolean bfd_preserve_save (bfd *, struct bfd_preserve *);
-boolean
-bfd_alt_mach_code PARAMS ((bfd *abfd, int alternative));
+void bfd_preserve_restore (bfd *, struct bfd_preserve *);
+
+void bfd_preserve_finish (bfd *, struct bfd_preserve *);
/* Extracted from archive.c. */
-symindex
-bfd_get_next_mapent PARAMS ((bfd *abfd, symindex previous, carsym **sym));
+symindex bfd_get_next_mapent
+ (bfd *abfd, symindex previous, carsym **sym);
-boolean
-bfd_set_archive_head PARAMS ((bfd *output, bfd *new_head));
+bfd_boolean bfd_set_archive_head (bfd *output, bfd *new_head);
-bfd *
-bfd_openr_next_archived_file PARAMS ((bfd *archive, bfd *previous));
+bfd *bfd_openr_next_archived_file (bfd *archive, bfd *previous);
/* Extracted from corefile.c. */
-const char *
-bfd_core_file_failing_command PARAMS ((bfd *abfd));
+const char *bfd_core_file_failing_command (bfd *abfd);
-int
-bfd_core_file_failing_signal PARAMS ((bfd *abfd));
+int bfd_core_file_failing_signal (bfd *abfd);
-boolean
-core_file_matches_executable_p PARAMS ((bfd *core_bfd, bfd *exec_bfd));
+bfd_boolean core_file_matches_executable_p
+ (bfd *core_bfd, bfd *exec_bfd);
/* Extracted from targets.c. */
#define BFD_SEND(bfd, message, arglist) \
- ((*((bfd)->xvec->message)) arglist)
+ ((*((bfd)->xvec->message)) arglist)
#ifdef DEBUG_BFD_SEND
#undef BFD_SEND
@@ -3668,7 +4016,7 @@ core_file_matches_executable_p PARAMS ((bfd *core_bfd, bfd *exec_bfd));
(bfd_assert (__FILE__,__LINE__), NULL))
#endif
#define BFD_SEND_FMT(bfd, message, arglist) \
- (((bfd)->xvec->message[(int) ((bfd)->format)]) arglist)
+ (((bfd)->xvec->message[(int) ((bfd)->format)]) arglist)
#ifdef DEBUG_BFD_SEND
#undef BFD_SEND_FMT
@@ -3698,7 +4046,11 @@ enum bfd_flavour
bfd_target_msdos_flavour,
bfd_target_ovax_flavour,
bfd_target_evax_flavour,
- bfd_target_mmo_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 };
@@ -3742,291 +4094,303 @@ typedef struct bfd_target
/* 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_vma (*bfd_getx64) PARAMS ((const bfd_byte *));
- bfd_signed_vma (*bfd_getx_signed_64) PARAMS ((const bfd_byte *));
- void (*bfd_putx64) PARAMS ((bfd_vma, bfd_byte *));
- bfd_vma (*bfd_getx32) PARAMS ((const bfd_byte *));
- bfd_signed_vma (*bfd_getx_signed_32) PARAMS ((const bfd_byte *));
- void (*bfd_putx32) PARAMS ((bfd_vma, bfd_byte *));
- bfd_vma (*bfd_getx16) PARAMS ((const bfd_byte *));
- bfd_signed_vma (*bfd_getx_signed_16) PARAMS ((const bfd_byte *));
- void (*bfd_putx16) PARAMS ((bfd_vma, bfd_byte *));
+ 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_vma (*bfd_h_getx64) PARAMS ((const bfd_byte *));
- bfd_signed_vma (*bfd_h_getx_signed_64) PARAMS ((const bfd_byte *));
- void (*bfd_h_putx64) PARAMS ((bfd_vma, bfd_byte *));
- bfd_vma (*bfd_h_getx32) PARAMS ((const bfd_byte *));
- bfd_signed_vma (*bfd_h_getx_signed_32) PARAMS ((const bfd_byte *));
- void (*bfd_h_putx32) PARAMS ((bfd_vma, bfd_byte *));
- bfd_vma (*bfd_h_getx16) PARAMS ((const bfd_byte *));
- bfd_signed_vma (*bfd_h_getx_signed_16) PARAMS ((const bfd_byte *));
- void (*bfd_h_putx16) PARAMS ((bfd_vma, bfd_byte *));
+ bfd_uint64_t (*bfd_h_getx64) (const void *);
+ bfd_int64_t (*bfd_h_getx_signed_64) (const void *);
+ void (*bfd_h_putx64) (bfd_uint64_t, void *);
+ bfd_vma (*bfd_h_getx32) (const void *);
+ bfd_signed_vma (*bfd_h_getx_signed_32) (const void *);
+ void (*bfd_h_putx32) (bfd_vma, void *);
+ bfd_vma (*bfd_h_getx16) (const void *);
+ bfd_signed_vma (*bfd_h_getx_signed_16) (const void *);
+ void (*bfd_h_putx16) (bfd_vma, void *);
/* Format dependent routines: these are vectors of entry points
within the target vector structure, one for each format to check. */
/* Check the format of a file being read. Return a <<bfd_target *>> or zero. */
- const struct bfd_target *(*_bfd_check_format[bfd_type_end]) PARAMS ((bfd *));
+ const struct bfd_target *(*_bfd_check_format[bfd_type_end]) (bfd *);
/* Set the format of a file being written. */
- boolean (*_bfd_set_format[bfd_type_end]) PARAMS ((bfd *));
+ bfd_boolean (*_bfd_set_format[bfd_type_end]) (bfd *);
/* Write cached information into a file being written, at <<bfd_close>>. */
- boolean (*_bfd_write_contents[bfd_type_end]) PARAMS ((bfd *));
+ bfd_boolean (*_bfd_write_contents[bfd_type_end]) (bfd *);
/* Generic entry points. */
#define BFD_JUMP_TABLE_GENERIC(NAME) \
-CONCAT2 (NAME,_close_and_cleanup), \
-CONCAT2 (NAME,_bfd_free_cached_info), \
-CONCAT2 (NAME,_new_section_hook), \
-CONCAT2 (NAME,_get_section_contents), \
-CONCAT2 (NAME,_get_section_contents_in_window)
+ 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. */
- boolean (*_close_and_cleanup) PARAMS ((bfd *));
+ bfd_boolean (*_close_and_cleanup) (bfd *);
/* Ask the BFD to free all cached information. */
- boolean (*_bfd_free_cached_info) PARAMS ((bfd *));
+ bfd_boolean (*_bfd_free_cached_info) (bfd *);
/* Called when a new section is created. */
- boolean (*_new_section_hook) PARAMS ((bfd *, sec_ptr));
+ bfd_boolean (*_new_section_hook) (bfd *, sec_ptr);
/* Read the contents of a section. */
- boolean (*_bfd_get_section_contents) PARAMS ((bfd *, sec_ptr, PTR,
- file_ptr, bfd_size_type));
- boolean (*_bfd_get_section_contents_in_window)
- PARAMS ((bfd *, sec_ptr, bfd_window *, file_ptr, bfd_size_type));
+ 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) \
-CONCAT2 (NAME,_bfd_copy_private_bfd_data), \
-CONCAT2 (NAME,_bfd_merge_private_bfd_data), \
-CONCAT2 (NAME,_bfd_copy_private_section_data), \
-CONCAT2 (NAME,_bfd_copy_private_symbol_data), \
-CONCAT2 (NAME,_bfd_set_private_flags), \
-CONCAT2 (NAME,_bfd_print_private_bfd_data) \
+ 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. */
- boolean (*_bfd_copy_private_bfd_data) PARAMS ((bfd *, bfd *));
+ 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. */
- boolean (*_bfd_merge_private_bfd_data) PARAMS ((bfd *, bfd *));
+ bfd_boolean (*_bfd_merge_private_bfd_data) (bfd *, bfd *);
/* Called to copy BFD private section data from one object file
to another. */
- boolean (*_bfd_copy_private_section_data) PARAMS ((bfd *, sec_ptr,
- bfd *, sec_ptr));
+ 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. */
- boolean (*_bfd_copy_private_symbol_data) PARAMS ((bfd *, asymbol *,
- bfd *, asymbol *));
+ bfd_boolean (*_bfd_copy_private_symbol_data)
+ (bfd *, asymbol *, bfd *, asymbol *);
/* Called to set private backend flags. */
- boolean (*_bfd_set_private_flags) PARAMS ((bfd *, flagword));
+ bfd_boolean (*_bfd_set_private_flags) (bfd *, flagword);
/* Called to print private BFD data. */
- boolean (*_bfd_print_private_bfd_data) PARAMS ((bfd *, PTR));
+ bfd_boolean (*_bfd_print_private_bfd_data) (bfd *, void *);
/* Core file entry points. */
#define BFD_JUMP_TABLE_CORE(NAME) \
-CONCAT2 (NAME,_core_file_failing_command), \
-CONCAT2 (NAME,_core_file_failing_signal), \
-CONCAT2 (NAME,_core_file_matches_executable_p)
- char * (*_core_file_failing_command) PARAMS ((bfd *));
- int (*_core_file_failing_signal) PARAMS ((bfd *));
- boolean (*_core_file_matches_executable_p) PARAMS ((bfd *, bfd *));
+ 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) \
-CONCAT2 (NAME,_slurp_armap), \
-CONCAT2 (NAME,_slurp_extended_name_table), \
-CONCAT2 (NAME,_construct_extended_name_table), \
-CONCAT2 (NAME,_truncate_arname), \
-CONCAT2 (NAME,_write_armap), \
-CONCAT2 (NAME,_read_ar_hdr), \
-CONCAT2 (NAME,_openr_next_archived_file), \
-CONCAT2 (NAME,_get_elt_at_index), \
-CONCAT2 (NAME,_generic_stat_arch_elt), \
-CONCAT2 (NAME,_update_armap_timestamp)
- boolean (*_bfd_slurp_armap) PARAMS ((bfd *));
- boolean (*_bfd_slurp_extended_name_table) PARAMS ((bfd *));
- boolean (*_bfd_construct_extended_name_table)
- PARAMS ((bfd *, char **, bfd_size_type *, const char **));
- void (*_bfd_truncate_arname) PARAMS ((bfd *, const char *, char *));
- boolean (*write_armap)
- PARAMS ((bfd *, unsigned int, struct orl *, unsigned int, int));
- PTR (*_bfd_read_ar_hdr_fn) PARAMS ((bfd *));
- bfd * (*openr_next_archived_file) PARAMS ((bfd *, bfd *));
-#define bfd_get_elt_at_index(b,i) BFD_SEND(b, _bfd_get_elt_at_index, (b,i))
- bfd * (*_bfd_get_elt_at_index) PARAMS ((bfd *, symindex));
- int (*_bfd_stat_arch_elt) PARAMS ((bfd *, struct stat *));
- boolean (*_bfd_update_armap_timestamp) PARAMS ((bfd *));
+ 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) \
-CONCAT2 (NAME,_get_symtab_upper_bound), \
-CONCAT2 (NAME,_get_symtab), \
-CONCAT2 (NAME,_make_empty_symbol), \
-CONCAT2 (NAME,_print_symbol), \
-CONCAT2 (NAME,_get_symbol_info), \
-CONCAT2 (NAME,_bfd_is_local_label_name), \
-CONCAT2 (NAME,_get_lineno), \
-CONCAT2 (NAME,_find_nearest_line), \
-CONCAT2 (NAME,_bfd_make_debug_symbol), \
-CONCAT2 (NAME,_read_minisymbols), \
-CONCAT2 (NAME,_minisymbol_to_symbol)
- long (*_bfd_get_symtab_upper_bound) PARAMS ((bfd *));
- long (*_bfd_canonicalize_symtab) PARAMS ((bfd *,
- struct symbol_cache_entry **));
- struct symbol_cache_entry *
- (*_bfd_make_empty_symbol) PARAMS ((bfd *));
- void (*_bfd_print_symbol) PARAMS ((bfd *, PTR,
- struct symbol_cache_entry *,
- bfd_print_symbol_type));
-#define bfd_print_symbol(b,p,s,e) BFD_SEND(b, _bfd_print_symbol, (b,p,s,e))
- void (*_bfd_get_symbol_info) PARAMS ((bfd *,
- struct symbol_cache_entry *,
- symbol_info *));
-#define bfd_get_symbol_info(b,p,e) BFD_SEND(b, _bfd_get_symbol_info, (b,p,e))
- boolean (*_bfd_is_local_label_name) PARAMS ((bfd *, const char *));
-
- alent * (*_get_lineno) PARAMS ((bfd *, struct symbol_cache_entry *));
- boolean (*_bfd_find_nearest_line)
- PARAMS ((bfd *, struct sec *, struct symbol_cache_entry **, bfd_vma,
- const char **, const char **, unsigned int *));
+ 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) PARAMS ((bfd *, void *,
- unsigned long size));
+ 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) PARAMS ((bfd *, boolean, PTR *,
- unsigned int *));
+ 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) PARAMS ((bfd *, boolean, const PTR,
- asymbol *));
+ asymbol * (*_minisymbol_to_symbol)
+ (bfd *, bfd_boolean, const void *, asymbol *);
/* Routines for relocs. */
#define BFD_JUMP_TABLE_RELOCS(NAME) \
-CONCAT2 (NAME,_get_reloc_upper_bound), \
-CONCAT2 (NAME,_canonicalize_reloc), \
-CONCAT2 (NAME,_bfd_reloc_type_lookup)
- long (*_get_reloc_upper_bound) PARAMS ((bfd *, sec_ptr));
- long (*_bfd_canonicalize_reloc) PARAMS ((bfd *, sec_ptr, arelent **,
- struct symbol_cache_entry **));
+ 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) PARAMS ((bfd *, bfd_reloc_code_real_type));
+ (*reloc_type_lookup) (bfd *, bfd_reloc_code_real_type);
/* Routines used when writing an object file. */
#define BFD_JUMP_TABLE_WRITE(NAME) \
-CONCAT2 (NAME,_set_arch_mach), \
-CONCAT2 (NAME,_set_section_contents)
- boolean (*_bfd_set_arch_mach) PARAMS ((bfd *, enum bfd_architecture,
- unsigned long));
- boolean (*_bfd_set_section_contents) PARAMS ((bfd *, sec_ptr, PTR,
- file_ptr, bfd_size_type));
+ 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) \
-CONCAT2 (NAME,_sizeof_headers), \
-CONCAT2 (NAME,_bfd_get_relocated_section_contents), \
-CONCAT2 (NAME,_bfd_relax_section), \
-CONCAT2 (NAME,_bfd_link_hash_table_create), \
-CONCAT2 (NAME,_bfd_link_hash_table_free), \
-CONCAT2 (NAME,_bfd_link_add_symbols), \
-CONCAT2 (NAME,_bfd_link_just_syms), \
-CONCAT2 (NAME,_bfd_final_link), \
-CONCAT2 (NAME,_bfd_link_split_section), \
-CONCAT2 (NAME,_bfd_gc_sections), \
-CONCAT2 (NAME,_bfd_merge_sections), \
-CONCAT2 (NAME,_bfd_discard_group)
- int (*_bfd_sizeof_headers) PARAMS ((bfd *, boolean));
- bfd_byte *(*_bfd_get_relocated_section_contents)
- PARAMS ((bfd *, struct bfd_link_info *, struct bfd_link_order *,
- bfd_byte *, boolean, struct symbol_cache_entry **));
-
- boolean (*_bfd_relax_section)
- PARAMS ((bfd *, struct sec *, struct bfd_link_info *, boolean *));
+ 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) PARAMS ((bfd *));
+ 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) PARAMS ((struct bfd_link_hash_table *));
+ void (*_bfd_link_hash_table_free) (struct bfd_link_hash_table *);
/* Add symbols from this object file into the hash table. */
- boolean (*_bfd_link_add_symbols) PARAMS ((bfd *, struct bfd_link_info *));
+ 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) PARAMS ((asection *, struct bfd_link_info *));
+ 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. */
- boolean (*_bfd_final_link) PARAMS ((bfd *, struct bfd_link_info *));
+ bfd_boolean (*_bfd_final_link) (bfd *, struct bfd_link_info *);
/* Should this section be split up into smaller pieces during linking. */
- boolean (*_bfd_link_split_section) PARAMS ((bfd *, struct sec *));
+ bfd_boolean (*_bfd_link_split_section) (bfd *, struct bfd_section *);
/* Remove sections that are not referenced from the output. */
- boolean (*_bfd_gc_sections) PARAMS ((bfd *, struct bfd_link_info *));
+ bfd_boolean (*_bfd_gc_sections) (bfd *, struct bfd_link_info *);
/* Attempt to merge SEC_MERGE sections. */
- boolean (*_bfd_merge_sections) PARAMS ((bfd *, struct bfd_link_info *));
+ bfd_boolean (*_bfd_merge_sections) (bfd *, struct bfd_link_info *);
/* Discard members of a group. */
- boolean (*_bfd_discard_group) PARAMS ((bfd *, struct sec *));
+ bfd_boolean (*_bfd_discard_group) (bfd *, struct bfd_section *);
/* Routines to handle dynamic symbols and relocs. */
#define BFD_JUMP_TABLE_DYNAMIC(NAME) \
-CONCAT2 (NAME,_get_dynamic_symtab_upper_bound), \
-CONCAT2 (NAME,_canonicalize_dynamic_symtab), \
-CONCAT2 (NAME,_get_dynamic_reloc_upper_bound), \
-CONCAT2 (NAME,_canonicalize_dynamic_reloc)
+ 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) PARAMS ((bfd *));
+ long (*_bfd_get_dynamic_symtab_upper_bound) (bfd *);
/* Read in the dynamic symbols. */
- long (*_bfd_canonicalize_dynamic_symtab)
- PARAMS ((bfd *, struct symbol_cache_entry **));
+ 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) PARAMS ((bfd *));
+ long (*_bfd_get_dynamic_reloc_upper_bound) (bfd *);
/* Read in the dynamic relocs. */
- long (*_bfd_canonicalize_dynamic_reloc)
- PARAMS ((bfd *, arelent **, struct symbol_cache_entry **));
+ long (*_bfd_canonicalize_dynamic_reloc)
+ (bfd *, arelent **, struct bfd_symbol **);
/* Opposite endian version of this target. */
const struct bfd_target * alternative_target;
/* Data for use by back-end routines, which isn't
generic enough to belong in this structure. */
- PTR backend_data;
+ const void *backend_data;
} bfd_target;
-boolean
-bfd_set_default_target PARAMS ((const char *name));
+bfd_boolean bfd_set_default_target (const char *name);
-const bfd_target *
-bfd_find_target PARAMS ((const char *target_name, bfd *abfd));
+const bfd_target *bfd_find_target (const char *target_name, bfd *abfd);
-const char **
-bfd_target_list PARAMS ((void));
+const char ** bfd_target_list (void);
-const bfd_target *
-bfd_search_for_target PARAMS ((int (* search_func) (const bfd_target *, void *), void *));
+const bfd_target *bfd_search_for_target
+ (int (*search_func) (const bfd_target *, void *),
+ void *);
/* Extracted from format.c. */
-boolean
-bfd_check_format PARAMS ((bfd *abfd, bfd_format format));
+bfd_boolean bfd_check_format (bfd *abfd, bfd_format format);
+
+bfd_boolean bfd_check_format_matches
+ (bfd *abfd, bfd_format format, char ***matching);
+
+bfd_boolean bfd_set_format (bfd *abfd, bfd_format format);
+
+const char *bfd_format_string (bfd_format format);
-boolean
-bfd_check_format_matches PARAMS ((bfd *abfd, bfd_format format, char ***matching));
+/* Extracted from linker.c. */
+bfd_boolean bfd_link_split_section (bfd *abfd, asection *sec);
-boolean
-bfd_set_format PARAMS ((bfd *abfd, bfd_format format));
+#define bfd_link_split_section(abfd, sec) \
+ BFD_SEND (abfd, _bfd_link_split_section, (abfd, sec))
-const char *
-bfd_format_string PARAMS ((bfd_format format));
+/* Extracted from simple.c. */
+bfd_byte *bfd_simple_get_relocated_section_contents
+ (bfd *abfd, asection *sec, bfd_byte *outbuf, asymbol **symbol_table);
#ifdef __cplusplus
}
diff --git a/contrib/binutils/bfd/bfd.c b/contrib/binutils/bfd/bfd.c
index 8037b12..59e22aa 100644
--- a/contrib/binutils/bfd/bfd.c
+++ b/contrib/binutils/bfd/bfd.c
@@ -1,24 +1,24 @@
/* Generic BFD library interface and support routines.
Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
- 2000, 2001, 2002
+ 2000, 2001, 2002, 2003
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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
/*
SECTION
@@ -34,8 +34,11 @@ SECTION
CODE_FRAGMENT
.
-.struct _bfd
+.struct bfd
.{
+. {* A unique identifier of the BFD *}
+. unsigned int id;
+.
. {* The filename the application opened the BFD with. *}
. const char *filename;
.
@@ -49,33 +52,33 @@ CODE_FRAGMENT
. is the result of an fopen on the filename. However, if the
. BFD_IN_MEMORY flag is set, then iostream is actually a pointer
. to a bfd_in_memory struct. *}
-. PTR iostream;
+. void *iostream;
.
. {* Is the file descriptor being cached? That is, can it be closed as
. needed, and re-opened when accessed later? *}
-. boolean cacheable;
+. 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. *}
-. boolean target_defaulted;
+. bfd_boolean target_defaulted;
.
. {* The caching routines use these to maintain a
. least-recently-used list of BFDs. *}
-. struct _bfd *lru_prev, *lru_next;
+. 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). *}
-. boolean opened_once;
+. bfd_boolean opened_once;
.
. {* Set if we have a locally maintained mtime value, rather than
. getting it from the file each time. *}
-. boolean mtime_set;
+. bfd_boolean mtime_set;
.
-. {* File modified time, if mtime_set is true. *}
+. {* File modified time, if mtime_set is TRUE. *}
. long mtime;
.
. {* Reserved for an unimplemented file locking extension. *}
@@ -104,16 +107,16 @@ CODE_FRAGMENT
.
. {* Remember when output has begun, to stop strange things
. from happening. *}
-. boolean output_has_begun;
+. bfd_boolean output_has_begun;
.
. {* A hash table for section names. *}
. struct bfd_hash_table section_htab;
.
. {* Pointer to linked list of sections. *}
-. struct sec *sections;
+. struct bfd_section *sections;
.
. {* The place where we add to the section list. *}
-. struct sec **section_tail;
+. struct bfd_section **section_tail;
.
. {* The number of sections. *}
. unsigned int section_count;
@@ -126,7 +129,7 @@ CODE_FRAGMENT
. unsigned int symcount;
.
. {* Symbol table for output BFD (with symcount entries). *}
-. struct symbol_cache_entry **outsymbols;
+. struct bfd_symbol **outsymbols;
.
. {* Used for slurped dynamic symbol tables. *}
. unsigned int dynsymcount;
@@ -135,14 +138,14 @@ CODE_FRAGMENT
. const struct bfd_arch_info *arch_info;
.
. {* Stuff only useful for archives. *}
-. PTR arelt_data;
-. struct _bfd *my_archive; {* The containing archive BFD. *}
-. struct _bfd *next; {* The next BFD in the archive. *}
-. struct _bfd *archive_head; {* The first BFD in the archive. *}
-. boolean has_armap;
+. 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;
+. struct bfd *link_next;
.
. {* A field used by _bfd_generic_link_add_archive_symbols. This will
. be used only for archive elements. *}
@@ -180,30 +183,30 @@ CODE_FRAGMENT
. struct cisco_core_struct *cisco_core_data;
. struct versados_data_struct *versados_data;
. struct netbsd_core_struct *netbsd_core_data;
-. PTR any;
+. 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. *}
-. PTR usrdata;
+. void *usrdata;
.
. {* Where all the allocated stuff under this BFD goes. This is a
-. struct objalloc *, but we use PTR to avoid requiring the inclusion of
-. objalloc.h. *}
-. PTR memory;
+. struct objalloc *, but we use void * to avoid requiring the inclusion
+. of objalloc.h. *}
+. void *memory;
.};
.
*/
#include "bfd.h"
+#include "bfdver.h"
#include "sysdep.h"
-
-#ifdef ANSI_PROTOTYPES
#include <stdarg.h>
-#else
-#include <varargs.h>
-#endif
-
#include "libiberty.h"
#include "safe-ctype.h"
#include "bfdlink.h"
@@ -308,7 +311,7 @@ DESCRIPTION
*/
bfd_error_type
-bfd_get_error ()
+bfd_get_error (void)
{
return bfd_error;
}
@@ -325,8 +328,7 @@ DESCRIPTION
*/
void
-bfd_set_error (error_tag)
- bfd_error_type error_tag;
+bfd_set_error (bfd_error_type error_tag)
{
bfd_error = error_tag;
}
@@ -344,8 +346,7 @@ DESCRIPTION
*/
const char *
-bfd_errmsg (error_tag)
- bfd_error_type error_tag;
+bfd_errmsg (bfd_error_type error_tag)
{
#ifndef errno
extern int errno;
@@ -353,11 +354,10 @@ bfd_errmsg (error_tag)
if (error_tag == bfd_error_system_call)
return xstrerror (errno);
- if ((((int) error_tag < (int) bfd_error_no_error) ||
- ((int) error_tag > (int) bfd_error_invalid_error_code)))
- error_tag = bfd_error_invalid_error_code;/* sanity check */
+ if (error_tag > bfd_error_invalid_error_code)
+ error_tag = bfd_error_invalid_error_code; /* sanity check */
- return _(bfd_errmsgs [(int)error_tag]);
+ return _(bfd_errmsgs [error_tag]);
}
/*
@@ -376,12 +376,11 @@ DESCRIPTION
*/
void
-bfd_perror (message)
- const char *message;
+bfd_perror (const char *message)
{
if (bfd_get_error () == bfd_error_system_call)
/* Must be a system error then. */
- perror ((char *)message);
+ perror ((char *) message);
else
{
if (message == NULL || *message == '\0')
@@ -397,13 +396,13 @@ SUBSECTION
Some BFD functions want to print messages describing the
problem. They call a BFD error handler function. This
- function may be overriden by the program.
+ function may be overridden by the program.
The BFD error handler acts like printf.
CODE_FRAGMENT
.
-.typedef void (*bfd_error_handler_type) PARAMS ((const char *, ...));
+.typedef void (*bfd_error_handler_type) (const char *, ...);
.
*/
@@ -413,20 +412,19 @@ static const char *_bfd_error_program_name;
/* This is the default routine to handle BFD error messages. */
-static void _bfd_default_error_handler PARAMS ((const char *s, ...));
-
static void
-_bfd_default_error_handler VPARAMS ((const char *s, ...))
+_bfd_default_error_handler (const char *s, ...)
{
+ va_list p;
+
if (_bfd_error_program_name != NULL)
fprintf (stderr, "%s: ", _bfd_error_program_name);
else
fprintf (stderr, "BFD: ");
- VA_OPEN (p, s);
- VA_FIXEDARG (p, const char *, s);
+ va_start (p, s);
vfprintf (stderr, s, p);
- VA_CLOSE (p);
+ va_end (p);
fprintf (stderr, "\n");
}
@@ -452,8 +450,7 @@ DESCRIPTION
*/
bfd_error_handler_type
-bfd_set_error_handler (pnew)
- bfd_error_handler_type pnew;
+bfd_set_error_handler (bfd_error_handler_type pnew)
{
bfd_error_handler_type pold;
@@ -477,8 +474,7 @@ DESCRIPTION
*/
void
-bfd_set_error_program_name (name)
- const char *name;
+bfd_set_error_program_name (const char *name)
{
_bfd_error_program_name = name;
}
@@ -495,7 +491,7 @@ DESCRIPTION
*/
bfd_error_handler_type
-bfd_get_error_handler ()
+bfd_get_error_handler (void)
{
return _bfd_error_handler;
}
@@ -514,9 +510,11 @@ DESCRIPTION
*/
const char *
-bfd_archive_filename (abfd)
- bfd *abfd;
+bfd_archive_filename (bfd *abfd)
{
+ if (abfd == NULL)
+ return _("<unknown>");
+
if (abfd->my_archive)
{
static size_t curr = 0;
@@ -530,7 +528,7 @@ bfd_archive_filename (abfd)
if (curr)
free (buf);
curr = needed + (needed >> 1);
- buf = bfd_malloc ((bfd_size_type) curr);
+ 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. */
@@ -558,7 +556,7 @@ FUNCTION
bfd_get_reloc_upper_bound
SYNOPSIS
- long bfd_get_reloc_upper_bound(bfd *abfd, asection *sect);
+ long bfd_get_reloc_upper_bound (bfd *abfd, asection *sect);
DESCRIPTION
Return the number of bytes required to store the
@@ -568,9 +566,7 @@ DESCRIPTION
*/
long
-bfd_get_reloc_upper_bound (abfd, asect)
- bfd *abfd;
- sec_ptr asect;
+bfd_get_reloc_upper_bound (bfd *abfd, sec_ptr asect)
{
if (abfd->format != bfd_object)
{
@@ -587,10 +583,7 @@ FUNCTION
SYNOPSIS
long bfd_canonicalize_reloc
- (bfd *abfd,
- asection *sec,
- arelent **loc,
- asymbol **syms);
+ (bfd *abfd, asection *sec, arelent **loc, asymbol **syms);
DESCRIPTION
Call the back end associated with the open BFD
@@ -606,11 +599,10 @@ DESCRIPTION
*/
long
-bfd_canonicalize_reloc (abfd, asect, location, symbols)
- bfd *abfd;
- sec_ptr asect;
- arelent **location;
- asymbol **symbols;
+bfd_canonicalize_reloc (bfd *abfd,
+ sec_ptr asect,
+ arelent **location,
+ asymbol **symbols)
{
if (abfd->format != bfd_object)
{
@@ -638,11 +630,10 @@ DESCRIPTION
*/
void
-bfd_set_reloc (ignore_abfd, asect, location, count)
- bfd *ignore_abfd ATTRIBUTE_UNUSED;
- sec_ptr asect;
- arelent **location;
- unsigned int count;
+bfd_set_reloc (bfd *ignore_abfd ATTRIBUTE_UNUSED,
+ sec_ptr asect,
+ arelent **location,
+ unsigned int count)
{
asect->orelocation = location;
asect->reloc_count = count;
@@ -653,7 +644,7 @@ FUNCTION
bfd_set_file_flags
SYNOPSIS
- boolean bfd_set_file_flags(bfd *abfd, flagword flags);
+ bfd_boolean bfd_set_file_flags (bfd *abfd, flagword flags);
DESCRIPTION
Set the flag word in the BFD @var{abfd} to the value @var{flags}.
@@ -668,37 +659,33 @@ DESCRIPTION
*/
-boolean
-bfd_set_file_flags (abfd, flags)
- bfd *abfd;
- flagword flags;
+bfd_boolean
+bfd_set_file_flags (bfd *abfd, flagword flags)
{
if (abfd->format != bfd_object)
{
bfd_set_error (bfd_error_wrong_format);
- return false;
+ return FALSE;
}
if (bfd_read_p (abfd))
{
bfd_set_error (bfd_error_invalid_operation);
- return false;
+ return FALSE;
}
bfd_get_file_flags (abfd) = flags;
if ((flags & bfd_applicable_file_flags (abfd)) != flags)
{
bfd_set_error (bfd_error_invalid_operation);
- return false;
+ return FALSE;
}
- return true;
+ return TRUE;
}
void
-bfd_assert (file, line)
- const char *file;
- int line;
+bfd_assert (const char *file, int line)
{
(*_bfd_error_handler) (_("BFD %s assertion fail %s:%d"),
BFD_VERSION_STRING, file, line);
@@ -712,10 +699,7 @@ bfd_assert (file, line)
#endif
void
-_bfd_abort (file, line, fn)
- const char *file;
- int line;
- const char *fn;
+_bfd_abort (const char *file, int line, const char *fn)
{
if (fn != NULL)
(*_bfd_error_handler)
@@ -746,11 +730,10 @@ RETURNS
*/
int
-bfd_get_arch_size (abfd)
- bfd *abfd;
+bfd_get_arch_size (bfd *abfd)
{
if (abfd->xvec->flavour == bfd_target_elf_flavour)
- return (get_elf_backend_data (abfd))->s->arch_size;
+ return get_elf_backend_data (abfd)->s->arch_size;
return -1;
}
@@ -777,13 +760,12 @@ RETURNS
*/
int
-bfd_get_sign_extend_vma (abfd)
- bfd *abfd;
+bfd_get_sign_extend_vma (bfd *abfd)
{
char *name;
if (bfd_get_flavour (abfd) == bfd_target_elf_flavour)
- return (get_elf_backend_data (abfd)->sign_extend_vma);
+ return get_elf_backend_data (abfd)->sign_extend_vma;
name = bfd_get_target (abfd);
@@ -804,103 +786,20 @@ FUNCTION
bfd_set_start_address
SYNOPSIS
- boolean bfd_set_start_address(bfd *abfd, bfd_vma vma);
+ bfd_boolean bfd_set_start_address (bfd *abfd, bfd_vma vma);
DESCRIPTION
Make @var{vma} the entry point of output BFD @var{abfd}.
RETURNS
- Returns <<true>> on success, <<false>> otherwise.
+ Returns <<TRUE>> on success, <<FALSE>> otherwise.
*/
-boolean
-bfd_set_start_address (abfd, vma)
- bfd *abfd;
- bfd_vma vma;
+bfd_boolean
+bfd_set_start_address (bfd *abfd, bfd_vma vma)
{
abfd->start_address = vma;
- return true;
-}
-
-/*
-FUNCTION
- bfd_get_mtime
-
-SYNOPSIS
- long bfd_get_mtime(bfd *abfd);
-
-DESCRIPTION
- Return the file modification time (as read from the file system, or
- from the archive header for archive members).
-
-*/
-
-long
-bfd_get_mtime (abfd)
- bfd *abfd;
-{
- FILE *fp;
- struct stat buf;
-
- if (abfd->mtime_set)
- return abfd->mtime;
-
- fp = bfd_cache_lookup (abfd);
- if (0 != fstat (fileno (fp), &buf))
- return 0;
-
- abfd->mtime = buf.st_mtime; /* Save value in case anyone wants it */
- return buf.st_mtime;
-}
-
-/*
-FUNCTION
- bfd_get_size
-
-SYNOPSIS
- long bfd_get_size(bfd *abfd);
-
-DESCRIPTION
- Return the file size (as read from file system) for the file
- associated with BFD @var{abfd}.
-
- The initial motivation for, and use of, this routine is not
- so we can get the exact size of the object the BFD applies to, since
- that might not be generally possible (archive members for example).
- It would be ideal if someone could eventually modify
- it so that such results were guaranteed.
-
- Instead, we want to ask questions like "is this NNN byte sized
- object I'm about to try read from file offset YYY reasonable?"
- As as example of where we might do this, some object formats
- use string tables for which the first <<sizeof (long)>> bytes of the
- table contain the size of the table itself, including the size bytes.
- If an application tries to read what it thinks is one of these
- string tables, without some way to validate the size, and for
- some reason the size is wrong (byte swapping error, wrong location
- for the string table, etc.), the only clue is likely to be a read
- error when it tries to read the table, or a "virtual memory
- exhausted" error when it tries to allocate 15 bazillon bytes
- of space for the 15 bazillon byte table it is about to read.
- This function at least allows us to answer the quesion, "is the
- size reasonable?".
-*/
-
-long
-bfd_get_size (abfd)
- bfd *abfd;
-{
- FILE *fp;
- struct stat buf;
-
- if ((abfd->flags & BFD_IN_MEMORY) != 0)
- return ((struct bfd_in_memory *) abfd->iostream)->size;
-
- fp = bfd_cache_lookup (abfd);
- if (0 != fstat (fileno (fp), & buf))
- return 0;
-
- return buf.st_size;
+ return TRUE;
}
/*
@@ -908,7 +807,7 @@ FUNCTION
bfd_get_gp_size
SYNOPSIS
- unsigned int bfd_get_gp_size(bfd *abfd);
+ unsigned int bfd_get_gp_size (bfd *abfd);
DESCRIPTION
Return the maximum size of objects to be optimized using the GP
@@ -917,8 +816,7 @@ DESCRIPTION
*/
unsigned int
-bfd_get_gp_size (abfd)
- bfd *abfd;
+bfd_get_gp_size (bfd *abfd)
{
if (abfd->format == bfd_object)
{
@@ -935,7 +833,7 @@ FUNCTION
bfd_set_gp_size
SYNOPSIS
- void bfd_set_gp_size(bfd *abfd, unsigned int i);
+ void bfd_set_gp_size (bfd *abfd, unsigned int i);
DESCRIPTION
Set the maximum size of objects to be optimized using the GP
@@ -944,9 +842,7 @@ DESCRIPTION
*/
void
-bfd_set_gp_size (abfd, i)
- bfd *abfd;
- unsigned int i;
+bfd_set_gp_size (bfd *abfd, unsigned int i)
{
/* Don't try to set GP size on an archive or core file! */
if (abfd->format != bfd_object)
@@ -963,9 +859,10 @@ bfd_set_gp_size (abfd, i)
register. */
bfd_vma
-_bfd_get_gp_value (abfd)
- bfd *abfd;
+_bfd_get_gp_value (bfd *abfd)
{
+ if (! abfd)
+ return 0;
if (abfd->format != bfd_object)
return 0;
@@ -980,10 +877,10 @@ _bfd_get_gp_value (abfd)
/* Set the GP value. */
void
-_bfd_set_gp_value (abfd, v)
- bfd *abfd;
- bfd_vma v;
+_bfd_set_gp_value (bfd *abfd, bfd_vma v)
{
+ if (! abfd)
+ BFD_FAIL ();
if (abfd->format != bfd_object)
return;
@@ -998,7 +895,7 @@ FUNCTION
bfd_scan_vma
SYNOPSIS
- bfd_vma bfd_scan_vma(const char *string, const char **end, int base);
+ bfd_vma bfd_scan_vma (const char *string, const char **end, int base);
DESCRIPTION
Convert, like <<strtoul>>, a numerical expression
@@ -1015,10 +912,7 @@ DESCRIPTION
*/
bfd_vma
-bfd_scan_vma (string, end, base)
- const char *string;
- const char **end;
- int base;
+bfd_scan_vma (const char *string, const char **end, int base)
{
bfd_vma value;
bfd_vma cutoff;
@@ -1027,7 +921,12 @@ bfd_scan_vma (string, end, base)
/* Let the host do it if possible. */
if (sizeof (bfd_vma) <= sizeof (unsigned long))
- return (bfd_vma) strtoul (string, (char **) end, base);
+ return strtoul (string, (char **) end, base);
+
+#ifdef HAVE_STRTOULL
+ if (sizeof (bfd_vma) <= sizeof (unsigned long long))
+ return strtoull (string, (char **) end, base);
+#endif
if (base == 0)
{
@@ -1088,11 +987,11 @@ FUNCTION
bfd_copy_private_bfd_data
SYNOPSIS
- boolean bfd_copy_private_bfd_data(bfd *ibfd, bfd *obfd);
+ bfd_boolean bfd_copy_private_bfd_data (bfd *ibfd, bfd *obfd);
DESCRIPTION
Copy private BFD information from the BFD @var{ibfd} to the
- the BFD @var{obfd}. Return <<true>> on success, <<false>> on error.
+ the BFD @var{obfd}. Return <<TRUE>> on success, <<FALSE>> on error.
Possible error returns are:
o <<bfd_error_no_memory>> -
@@ -1109,12 +1008,12 @@ FUNCTION
bfd_merge_private_bfd_data
SYNOPSIS
- boolean bfd_merge_private_bfd_data(bfd *ibfd, bfd *obfd);
+ bfd_boolean bfd_merge_private_bfd_data (bfd *ibfd, bfd *obfd);
DESCRIPTION
Merge private BFD information from the BFD @var{ibfd} to the
- the output file BFD @var{obfd} when linking. Return <<true>>
- on success, <<false>> on error. Possible error returns are:
+ the output file BFD @var{obfd} when linking. Return <<TRUE>>
+ on success, <<FALSE>> on error. Possible error returns are:
o <<bfd_error_no_memory>> -
Not enough memory exists to create private data for @var{obfd}.
@@ -1130,54 +1029,52 @@ FUNCTION
bfd_set_private_flags
SYNOPSIS
- boolean bfd_set_private_flags(bfd *abfd, flagword flags);
+ bfd_boolean bfd_set_private_flags (bfd *abfd, flagword flags);
DESCRIPTION
Set private BFD flag information in the BFD @var{abfd}.
- Return <<true>> on success, <<false>> on error. Possible error
+ Return <<TRUE>> on success, <<FALSE>> on error. Possible error
returns are:
o <<bfd_error_no_memory>> -
Not enough memory exists to create private data for @var{obfd}.
.#define bfd_set_private_flags(abfd, flags) \
-. BFD_SEND (abfd, _bfd_set_private_flags, \
-. (abfd, flags))
+. BFD_SEND (abfd, _bfd_set_private_flags, (abfd, flags))
*/
/*
FUNCTION
- stuff
+ Other functions
DESCRIPTION
- Stuff which should be documented:
+ The following functions exist but have not yet been documented.
.#define bfd_sizeof_headers(abfd, reloc) \
-. BFD_SEND (abfd, _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))
+. BFD_SEND (abfd, _bfd_find_nearest_line, \
+. (abfd, sec, syms, off, file, func, line))
.
-. {* Do these three do anything useful at all, for any back end? *}
.#define bfd_debug_info_start(abfd) \
-. BFD_SEND (abfd, _bfd_debug_info_start, (abfd))
+. BFD_SEND (abfd, _bfd_debug_info_start, (abfd))
.
.#define bfd_debug_info_end(abfd) \
-. BFD_SEND (abfd, _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))
-.
+. 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))
+. BFD_SEND (abfd, _bfd_stat_arch_elt,(abfd, stat))
.
.#define bfd_update_armap_timestamp(abfd) \
-. BFD_SEND (abfd, _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))
+. 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))
@@ -1225,27 +1122,23 @@ DESCRIPTION
. BFD_SEND (abfd, _bfd_canonicalize_dynamic_reloc, (abfd, arels, asyms))
.
.extern bfd_byte *bfd_get_relocated_section_contents
-. PARAMS ((bfd *, struct bfd_link_info *,
-. struct bfd_link_order *, bfd_byte *,
-. boolean, asymbol **));
+. (bfd *, struct bfd_link_info *, struct bfd_link_order *, bfd_byte *,
+. bfd_boolean, asymbol **);
.
*/
bfd_byte *
-bfd_get_relocated_section_contents (abfd, link_info, link_order, data,
- relocateable, symbols)
- bfd *abfd;
- struct bfd_link_info *link_info;
- struct bfd_link_order *link_order;
- bfd_byte *data;
- boolean relocateable;
- asymbol **symbols;
+bfd_get_relocated_section_contents (bfd *abfd,
+ struct bfd_link_info *link_info,
+ struct bfd_link_order *link_order,
+ bfd_byte *data,
+ bfd_boolean relocatable,
+ asymbol **symbols)
{
bfd *abfd2;
- bfd_byte *(*fn) PARAMS ((bfd *, struct bfd_link_info *,
- struct bfd_link_order *, bfd_byte *, boolean,
- asymbol **));
+ bfd_byte *(*fn) (bfd *, struct bfd_link_info *, struct bfd_link_order *,
+ bfd_byte *, bfd_boolean, asymbol **);
if (link_order->type == bfd_indirect_link_order)
{
@@ -1258,45 +1151,43 @@ bfd_get_relocated_section_contents (abfd, link_info, link_order, data,
fn = abfd2->xvec->_bfd_get_relocated_section_contents;
- return (*fn) (abfd, link_info, link_order, data, relocateable, symbols);
+ return (*fn) (abfd, link_info, link_order, data, relocatable, symbols);
}
/* Record information about an ELF program header. */
-boolean
-bfd_record_phdr (abfd, type, flags_valid, flags, at_valid, at,
- includes_filehdr, includes_phdrs, count, secs)
- bfd *abfd;
- unsigned long type;
- boolean flags_valid;
- flagword flags;
- boolean at_valid;
- bfd_vma at;
- boolean includes_filehdr;
- boolean includes_phdrs;
- unsigned int count;
- asection **secs;
+bfd_boolean
+bfd_record_phdr (bfd *abfd,
+ unsigned long type,
+ bfd_boolean flags_valid,
+ flagword flags,
+ bfd_boolean at_valid,
+ bfd_vma at,
+ bfd_boolean includes_filehdr,
+ bfd_boolean includes_phdrs,
+ unsigned int count,
+ asection **secs)
{
struct elf_segment_map *m, **pm;
bfd_size_type amt;
if (bfd_get_flavour (abfd) != bfd_target_elf_flavour)
- return true;
+ return TRUE;
amt = sizeof (struct elf_segment_map);
amt += ((bfd_size_type) count - 1) * sizeof (asection *);
- m = (struct elf_segment_map *) bfd_alloc (abfd, amt);
+ m = bfd_alloc (abfd, amt);
if (m == NULL)
- return false;
+ return FALSE;
m->next = NULL;
m->p_type = type;
m->p_flags = flags;
m->p_paddr = at;
- m->p_flags_valid = (unsigned int) flags_valid;
- m->p_paddr_valid = (unsigned int) at_valid;
- m->includes_filehdr = (unsigned int) includes_filehdr;
- m->includes_phdrs = (unsigned int) includes_phdrs;
+ m->p_flags_valid = flags_valid;
+ m->p_paddr_valid = at_valid;
+ m->includes_filehdr = includes_filehdr;
+ m->includes_phdrs = includes_phdrs;
m->count = count;
if (count > 0)
memcpy (m->sections, secs, count * sizeof (asection *));
@@ -1305,14 +1196,11 @@ bfd_record_phdr (abfd, type, flags_valid, flags, at_valid, at,
;
*pm = m;
- return true;
+ return TRUE;
}
void
-bfd_sprintf_vma (abfd, buf, value)
- bfd *abfd;
- char *buf;
- bfd_vma value;
+bfd_sprintf_vma (bfd *abfd, char *buf, bfd_vma value)
{
if (bfd_get_flavour (abfd) == bfd_target_elf_flavour)
get_elf_backend_data (abfd)->elf_backend_sprintf_vma (abfd, buf, value);
@@ -1321,10 +1209,7 @@ bfd_sprintf_vma (abfd, buf, value)
}
void
-bfd_fprintf_vma (abfd, stream, value)
- bfd *abfd;
- PTR stream;
- bfd_vma value;
+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);
@@ -1337,7 +1222,7 @@ FUNCTION
bfd_alt_mach_code
SYNOPSIS
- boolean bfd_alt_mach_code(bfd *abfd, int alternative);
+ bfd_boolean bfd_alt_mach_code (bfd *abfd, int alternative);
DESCRIPTION
@@ -1348,10 +1233,8 @@ DESCRIPTION
machine codes.
*/
-boolean
-bfd_alt_mach_code (abfd, alternative)
- bfd *abfd;
- int alternative;
+bfd_boolean
+bfd_alt_mach_code (bfd *abfd, int alternative)
{
if (bfd_get_flavour (abfd) == bfd_target_elf_flavour)
{
@@ -1366,23 +1249,144 @@ bfd_alt_mach_code (abfd, alternative)
case 1:
code = get_elf_backend_data (abfd)->elf_machine_alt1;
if (code == 0)
- return false;
+ return FALSE;
break;
case 2:
code = get_elf_backend_data (abfd)->elf_machine_alt2;
if (code == 0)
- return false;
+ return FALSE;
break;
default:
- return false;
+ return FALSE;
}
elf_elfheader (abfd)->e_machine = code;
- return true;
+ return TRUE;
}
- return false;
+ return FALSE;
+}
+
+/*
+CODE_FRAGMENT
+
+.struct bfd_preserve
+.{
+. void *marker;
+. void *tdata;
+. flagword flags;
+. const struct bfd_arch_info *arch_info;
+. struct bfd_section *sections;
+. struct bfd_section **section_tail;
+. unsigned int section_count;
+. struct bfd_hash_table section_htab;
+.};
+.
+*/
+
+/*
+FUNCTION
+ bfd_preserve_save
+
+SYNOPSIS
+ bfd_boolean bfd_preserve_save (bfd *, struct bfd_preserve *);
+
+DESCRIPTION
+ When testing an object for compatibility with a particular
+ target back-end, the back-end object_p function needs to set
+ up certain fields in the bfd on successfully recognizing the
+ object. This typically happens in a piecemeal fashion, with
+ failures possible at many points. On failure, the bfd is
+ supposed to be restored to its initial state, which is
+ virtually impossible. However, restoring a subset of the bfd
+ state works in practice. This function stores the subset and
+ reinitializes the bfd.
+
+*/
+
+bfd_boolean
+bfd_preserve_save (bfd *abfd, struct bfd_preserve *preserve)
+{
+ preserve->tdata = abfd->tdata.any;
+ preserve->arch_info = abfd->arch_info;
+ preserve->flags = abfd->flags;
+ preserve->sections = abfd->sections;
+ preserve->section_tail = abfd->section_tail;
+ preserve->section_count = abfd->section_count;
+ preserve->section_htab = abfd->section_htab;
+
+ if (! bfd_hash_table_init (&abfd->section_htab, bfd_section_hash_newfunc))
+ return FALSE;
+
+ abfd->tdata.any = NULL;
+ abfd->arch_info = &bfd_default_arch_struct;
+ abfd->flags &= BFD_IN_MEMORY;
+ abfd->sections = NULL;
+ abfd->section_tail = &abfd->sections;
+ abfd->section_count = 0;
+
+ return TRUE;
+}
+
+/*
+FUNCTION
+ bfd_preserve_restore
+
+SYNOPSIS
+ void bfd_preserve_restore (bfd *, struct bfd_preserve *);
+
+DESCRIPTION
+ This function restores bfd state saved by bfd_preserve_save.
+ If MARKER is non-NULL in struct bfd_preserve then that block
+ and all subsequently bfd_alloc'd memory is freed.
+
+*/
+
+void
+bfd_preserve_restore (bfd *abfd, struct bfd_preserve *preserve)
+{
+ bfd_hash_table_free (&abfd->section_htab);
+
+ abfd->tdata.any = preserve->tdata;
+ abfd->arch_info = preserve->arch_info;
+ abfd->flags = preserve->flags;
+ abfd->section_htab = preserve->section_htab;
+ abfd->sections = preserve->sections;
+ abfd->section_tail = preserve->section_tail;
+ abfd->section_count = preserve->section_count;
+
+ /* bfd_release frees all memory more recently bfd_alloc'd than
+ its arg, as well as its arg. */
+ if (preserve->marker != NULL)
+ {
+ bfd_release (abfd, preserve->marker);
+ preserve->marker = NULL;
+ }
+}
+
+/*
+FUNCTION
+ bfd_preserve_finish
+
+SYNOPSIS
+ void bfd_preserve_finish (bfd *, struct bfd_preserve *);
+
+DESCRIPTION
+ This function should be called when the bfd state saved by
+ bfd_preserve_save is no longer needed. ie. when the back-end
+ object_p function returns with success.
+
+*/
+
+void
+bfd_preserve_finish (bfd *abfd ATTRIBUTE_UNUSED, struct bfd_preserve *preserve)
+{
+ /* It would be nice to be able to free more memory here, eg. old
+ tdata, but that's not possible since these blocks are sitting
+ inside bfd_alloc'd memory. The section hash is on a separate
+ objalloc. */
+ bfd_hash_table_free (&preserve->section_htab);
}
diff --git a/contrib/binutils/bfd/bfdio.c b/contrib/binutils/bfd/bfdio.c
new file mode 100644
index 0000000..a90cb33
--- /dev/null
+++ b/contrib/binutils/bfd/bfdio.c
@@ -0,0 +1,442 @@
+/* Low-level I/O routines for BFDs.
+
+ Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
+ 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
+
+ Written by Cygnus Support.
+
+This file is part of BFD, the Binary File Descriptor library.
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+
+#include "sysdep.h"
+
+#include "bfd.h"
+#include "libbfd.h"
+
+#include <limits.h>
+
+#ifndef S_IXUSR
+#define S_IXUSR 0100 /* Execute by owner. */
+#endif
+#ifndef S_IXGRP
+#define S_IXGRP 0010 /* Execute by group. */
+#endif
+#ifndef S_IXOTH
+#define S_IXOTH 0001 /* Execute by others. */
+#endif
+
+file_ptr
+real_ftell (FILE *file)
+{
+#if defined (HAVE_FTELLO64)
+ return ftello64 (file);
+#elif defined (HAVE_FTELLO)
+ return ftello (file);
+#else
+ return ftell (file);
+#endif
+}
+
+int
+real_fseek (FILE *file, file_ptr offset, int whence)
+{
+#if defined (HAVE_FSEEKO64)
+ return fseeko64 (file, offset, whence);
+#elif defined (HAVE_FSEEKO)
+ return fseeko (file, offset, whence);
+#else
+ return fseek (file, offset, whence);
+#endif
+}
+
+/* Note that archive entries don't have streams; they share their parent's.
+ This allows someone to play with the iostream behind BFD's back.
+
+ Also, note that the origin pointer points to the beginning of a file's
+ contents (0 for non-archive elements). For archive entries this is the
+ first octet in the file, NOT the beginning of the archive header. */
+
+static size_t
+real_read (void *where, size_t a, size_t b, FILE *file)
+{
+ /* FIXME - this looks like an optimization, but it's really to cover
+ up for a feature of some OSs (not solaris - sigh) that
+ ld/pe-dll.c takes advantage of (apparently) when it creates BFDs
+ internally and tries to link against them. BFD seems to be smart
+ enough to realize there are no symbol records in the "file" that
+ doesn't exist but attempts to read them anyway. On Solaris,
+ attempting to read zero bytes from a NULL file results in a core
+ dump, but on other platforms it just returns zero bytes read.
+ This makes it to something reasonable. - DJ */
+ if (a == 0 || b == 0)
+ return 0;
+
+
+#if defined (__VAX) && defined (VMS)
+ /* Apparently fread on Vax VMS does not keep the record length
+ information. */
+ return read (fileno (file), where, a * b);
+#else
+ return fread (where, a, b, file);
+#endif
+}
+
+/* Return value is amount read. */
+
+bfd_size_type
+bfd_bread (void *ptr, bfd_size_type size, bfd *abfd)
+{
+ size_t nread;
+
+ if ((abfd->flags & BFD_IN_MEMORY) != 0)
+ {
+ struct bfd_in_memory *bim;
+ bfd_size_type get;
+
+ bim = abfd->iostream;
+ get = size;
+ if (abfd->where + get > bim->size)
+ {
+ if (bim->size < (bfd_size_type) abfd->where)
+ get = 0;
+ else
+ get = bim->size - abfd->where;
+ bfd_set_error (bfd_error_file_truncated);
+ }
+ memcpy (ptr, bim->buffer + abfd->where, (size_t) get);
+ abfd->where += get;
+ return get;
+ }
+
+ nread = real_read (ptr, 1, (size_t) size, bfd_cache_lookup (abfd));
+ if (nread != (size_t) -1)
+ abfd->where += nread;
+
+ /* Set bfd_error if we did not read as much data as we expected.
+
+ If the read failed due to an error set the bfd_error_system_call,
+ else set bfd_error_file_truncated.
+
+ A BFD backend may wish to override bfd_error_file_truncated to
+ provide something more useful (eg. no_symbols or wrong_format). */
+ if (nread != size)
+ {
+ if (ferror (bfd_cache_lookup (abfd)))
+ bfd_set_error (bfd_error_system_call);
+ else
+ bfd_set_error (bfd_error_file_truncated);
+ }
+
+ return nread;
+}
+
+bfd_size_type
+bfd_bwrite (const void *ptr, bfd_size_type size, bfd *abfd)
+{
+ size_t nwrote;
+
+ if ((abfd->flags & BFD_IN_MEMORY) != 0)
+ {
+ struct bfd_in_memory *bim = abfd->iostream;
+ size = (size_t) size;
+ if (abfd->where + size > bim->size)
+ {
+ bfd_size_type newsize, oldsize;
+
+ oldsize = (bim->size + 127) & ~(bfd_size_type) 127;
+ bim->size = abfd->where + size;
+ /* Round up to cut down on memory fragmentation */
+ newsize = (bim->size + 127) & ~(bfd_size_type) 127;
+ if (newsize > oldsize)
+ {
+ bim->buffer = bfd_realloc (bim->buffer, newsize);
+ if (bim->buffer == 0)
+ {
+ bim->size = 0;
+ return 0;
+ }
+ }
+ }
+ memcpy (bim->buffer + abfd->where, ptr, (size_t) size);
+ abfd->where += size;
+ return size;
+ }
+
+ nwrote = fwrite (ptr, 1, (size_t) size, bfd_cache_lookup (abfd));
+ if (nwrote != (size_t) -1)
+ abfd->where += nwrote;
+ if (nwrote != size)
+ {
+#ifdef ENOSPC
+ errno = ENOSPC;
+#endif
+ bfd_set_error (bfd_error_system_call);
+ }
+ return nwrote;
+}
+
+file_ptr
+bfd_tell (bfd *abfd)
+{
+ file_ptr ptr;
+
+ if ((abfd->flags & BFD_IN_MEMORY) != 0)
+ return abfd->where;
+
+ ptr = real_ftell (bfd_cache_lookup (abfd));
+
+ if (abfd->my_archive)
+ ptr -= abfd->origin;
+ abfd->where = ptr;
+ return ptr;
+}
+
+int
+bfd_flush (bfd *abfd)
+{
+ if ((abfd->flags & BFD_IN_MEMORY) != 0)
+ return 0;
+ return fflush (bfd_cache_lookup(abfd));
+}
+
+/* Returns 0 for success, negative value for failure (in which case
+ bfd_get_error can retrieve the error code). */
+int
+bfd_stat (bfd *abfd, struct stat *statbuf)
+{
+ FILE *f;
+ int result;
+
+ if ((abfd->flags & BFD_IN_MEMORY) != 0)
+ abort ();
+
+ f = bfd_cache_lookup (abfd);
+ if (f == NULL)
+ {
+ bfd_set_error (bfd_error_system_call);
+ return -1;
+ }
+ result = fstat (fileno (f), statbuf);
+ if (result < 0)
+ bfd_set_error (bfd_error_system_call);
+ return result;
+}
+
+/* Returns 0 for success, nonzero for failure (in which case bfd_get_error
+ can retrieve the error code). */
+
+int
+bfd_seek (bfd *abfd, file_ptr position, int direction)
+{
+ int result;
+ FILE *f;
+ file_ptr file_position;
+ /* For the time being, a BFD may not seek to it's end. The problem
+ is that we don't easily have a way to recognize the end of an
+ element in an archive. */
+
+ BFD_ASSERT (direction == SEEK_SET || direction == SEEK_CUR);
+
+ if (direction == SEEK_CUR && position == 0)
+ return 0;
+
+ if ((abfd->flags & BFD_IN_MEMORY) != 0)
+ {
+ struct bfd_in_memory *bim;
+
+ bim = abfd->iostream;
+
+ if (direction == SEEK_SET)
+ abfd->where = position;
+ else
+ abfd->where += position;
+
+ if (abfd->where > bim->size)
+ {
+ if ((abfd->direction == write_direction) ||
+ (abfd->direction == both_direction))
+ {
+ bfd_size_type newsize, oldsize;
+ oldsize = (bim->size + 127) & ~(bfd_size_type) 127;
+ bim->size = abfd->where;
+ /* Round up to cut down on memory fragmentation */
+ newsize = (bim->size + 127) & ~(bfd_size_type) 127;
+ if (newsize > oldsize)
+ {
+ bim->buffer = bfd_realloc (bim->buffer, newsize);
+ if (bim->buffer == 0)
+ {
+ bim->size = 0;
+ return -1;
+ }
+ }
+ }
+ else
+ {
+ abfd->where = bim->size;
+ bfd_set_error (bfd_error_file_truncated);
+ return -1;
+ }
+ }
+ return 0;
+ }
+
+ if (abfd->format != bfd_archive && abfd->my_archive == 0)
+ {
+#if 0
+ /* Explanation for this code: I'm only about 95+% sure that the above
+ conditions are sufficient and that all i/o calls are properly
+ adjusting the `where' field. So this is sort of an `assert'
+ that the `where' field is correct. If we can go a while without
+ tripping the abort, we can probably safely disable this code,
+ so that the real optimizations happen. */
+ file_ptr where_am_i_now;
+ where_am_i_now = real_ftell (bfd_cache_lookup (abfd));
+ if (abfd->my_archive)
+ where_am_i_now -= abfd->origin;
+ if (where_am_i_now != abfd->where)
+ abort ();
+#endif
+ if (direction == SEEK_SET && (bfd_vma) position == abfd->where)
+ return 0;
+ }
+ else
+ {
+ /* We need something smarter to optimize access to archives.
+ Currently, anything inside an archive is read via the file
+ handle for the archive. Which means that a bfd_seek on one
+ component affects the `current position' in the archive, as
+ well as in any other component.
+
+ It might be sufficient to put a spike through the cache
+ abstraction, and look to the archive for the file position,
+ but I think we should try for something cleaner.
+
+ In the meantime, no optimization for archives. */
+ }
+
+ f = bfd_cache_lookup (abfd);
+ file_position = position;
+ if (direction == SEEK_SET && abfd->my_archive != NULL)
+ file_position += abfd->origin;
+
+ result = real_fseek (f, file_position, direction);
+ if (result != 0)
+ {
+ int hold_errno = errno;
+
+ /* Force redetermination of `where' field. */
+ bfd_tell (abfd);
+
+ /* An EINVAL error probably means that the file offset was
+ absurd. */
+ if (hold_errno == EINVAL)
+ bfd_set_error (bfd_error_file_truncated);
+ else
+ {
+ bfd_set_error (bfd_error_system_call);
+ errno = hold_errno;
+ }
+ }
+ else
+ {
+ /* Adjust `where' field. */
+ if (direction == SEEK_SET)
+ abfd->where = position;
+ else
+ abfd->where += position;
+ }
+ return result;
+}
+
+/*
+FUNCTION
+ bfd_get_mtime
+
+SYNOPSIS
+ long bfd_get_mtime (bfd *abfd);
+
+DESCRIPTION
+ Return the file modification time (as read from the file system, or
+ from the archive header for archive members).
+
+*/
+
+long
+bfd_get_mtime (bfd *abfd)
+{
+ FILE *fp;
+ struct stat buf;
+
+ if (abfd->mtime_set)
+ return abfd->mtime;
+
+ fp = bfd_cache_lookup (abfd);
+ if (0 != fstat (fileno (fp), &buf))
+ return 0;
+
+ abfd->mtime = buf.st_mtime; /* Save value in case anyone wants it */
+ return buf.st_mtime;
+}
+
+/*
+FUNCTION
+ bfd_get_size
+
+SYNOPSIS
+ long bfd_get_size (bfd *abfd);
+
+DESCRIPTION
+ Return the file size (as read from file system) for the file
+ associated with BFD @var{abfd}.
+
+ The initial motivation for, and use of, this routine is not
+ so we can get the exact size of the object the BFD applies to, since
+ that might not be generally possible (archive members for example).
+ It would be ideal if someone could eventually modify
+ it so that such results were guaranteed.
+
+ Instead, we want to ask questions like "is this NNN byte sized
+ object I'm about to try read from file offset YYY reasonable?"
+ As as example of where we might do this, some object formats
+ use string tables for which the first <<sizeof (long)>> bytes of the
+ table contain the size of the table itself, including the size bytes.
+ If an application tries to read what it thinks is one of these
+ string tables, without some way to validate the size, and for
+ some reason the size is wrong (byte swapping error, wrong location
+ for the string table, etc.), the only clue is likely to be a read
+ error when it tries to read the table, or a "virtual memory
+ exhausted" error when it tries to allocate 15 bazillon bytes
+ of space for the 15 bazillon byte table it is about to read.
+ This function at least allows us to answer the question, "is the
+ size reasonable?".
+*/
+
+long
+bfd_get_size (bfd *abfd)
+{
+ FILE *fp;
+ struct stat buf;
+
+ if ((abfd->flags & BFD_IN_MEMORY) != 0)
+ return ((struct bfd_in_memory *) abfd->iostream)->size;
+
+ fp = bfd_cache_lookup (abfd);
+ if (0 != fstat (fileno (fp), & buf))
+ return 0;
+
+ return buf.st_size;
+}
diff --git a/contrib/binutils/bfd/bfdwin.c b/contrib/binutils/bfd/bfdwin.c
new file mode 100644
index 0000000..fb7c967
--- /dev/null
+++ b/contrib/binutils/bfd/bfdwin.c
@@ -0,0 +1,251 @@
+/* Support for memory-mapped windows into a BFD.
+ Copyright 1995, 1996, 2001, 2002, 2003 Free Software Foundation, Inc.
+ Written by Cygnus Support.
+
+This file is part of BFD, the Binary File Descriptor library.
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+
+#include "sysdep.h"
+
+#include "bfd.h"
+#include "libbfd.h"
+
+/* Currently, if USE_MMAP is undefined, none if the window stuff is
+ used. Okay, so it's mis-named. At least the command-line option
+ "--without-mmap" is more obvious than "--without-windows" or some
+ such. */
+
+#ifdef USE_MMAP
+
+#undef HAVE_MPROTECT /* code's not tested yet */
+
+#if HAVE_MMAP || HAVE_MPROTECT || HAVE_MADVISE
+#include <sys/mman.h>
+#endif
+
+#ifndef MAP_FILE
+#define MAP_FILE 0
+#endif
+
+static int debug_windows;
+
+/* The idea behind the next and refcount fields is that one mapped
+ region can suffice for multiple read-only windows or multiple
+ non-overlapping read-write windows. It's not implemented yet
+ though. */
+
+/*
+INTERNAL_DEFINITION
+
+.struct _bfd_window_internal {
+. struct _bfd_window_internal *next;
+. void *data;
+. bfd_size_type size;
+. int refcount : 31; {* should be enough... *}
+. unsigned mapped : 1; {* 1 = mmap, 0 = malloc *}
+.};
+*/
+
+void
+bfd_init_window (bfd_window *windowp)
+{
+ windowp->data = 0;
+ windowp->i = 0;
+ windowp->size = 0;
+}
+
+void
+bfd_free_window (bfd_window *windowp)
+{
+ bfd_window_internal *i = windowp->i;
+ windowp->i = 0;
+ windowp->data = 0;
+ if (i == 0)
+ return;
+ i->refcount--;
+ if (debug_windows)
+ fprintf (stderr, "freeing window @%p<%p,%lx,%p>\n",
+ windowp, windowp->data, windowp->size, windowp->i);
+ if (i->refcount != 0)
+ return;
+
+ if (i->mapped)
+ {
+#ifdef HAVE_MMAP
+ munmap (i->data, i->size);
+ goto no_free;
+#else
+ abort ();
+#endif
+ }
+#ifdef HAVE_MPROTECT
+ mprotect (i->data, i->size, PROT_READ | PROT_WRITE);
+#endif
+ free (i->data);
+#ifdef HAVE_MMAP
+ no_free:
+#endif
+ i->data = 0;
+ /* There should be no more references to i at this point. */
+ free (i);
+}
+
+static int ok_to_map = 1;
+
+bfd_boolean
+bfd_get_file_window (bfd *abfd,
+ file_ptr offset,
+ bfd_size_type size,
+ bfd_window *windowp,
+ bfd_boolean writable)
+{
+ static size_t pagesize;
+ bfd_window_internal *i = windowp->i;
+ bfd_size_type size_to_alloc = size;
+
+ if (debug_windows)
+ fprintf (stderr, "bfd_get_file_window (%p, %6ld, %6ld, %p<%p,%lx,%p>, %d)",
+ abfd, (long) offset, (long) size,
+ windowp, windowp->data, (unsigned long) windowp->size,
+ windowp->i, writable);
+
+ /* Make sure we know the page size, so we can be friendly to mmap. */
+ if (pagesize == 0)
+ pagesize = getpagesize ();
+ if (pagesize == 0)
+ abort ();
+
+ if (i == 0)
+ {
+ i = bfd_zmalloc (sizeof (bfd_window_internal));
+ windowp->i = i;
+ if (i == 0)
+ return FALSE;
+ i->data = 0;
+ }
+#ifdef HAVE_MMAP
+ if (ok_to_map
+ && (i->data == 0 || i->mapped == 1)
+ && (abfd->flags & BFD_IN_MEMORY) == 0)
+ {
+ file_ptr file_offset, offset2;
+ size_t real_size;
+ int fd;
+ FILE *f;
+
+ /* Find the real file and the real offset into it. */
+ while (abfd->my_archive != NULL)
+ {
+ offset += abfd->origin;
+ abfd = abfd->my_archive;
+ }
+ f = bfd_cache_lookup (abfd);
+ fd = fileno (f);
+
+ /* Compute offsets and size for mmap and for the user's data. */
+ offset2 = offset % pagesize;
+ if (offset2 < 0)
+ abort ();
+ file_offset = offset - offset2;
+ real_size = offset + size - file_offset;
+ real_size = real_size + pagesize - 1;
+ real_size -= real_size % pagesize;
+
+ /* If we're re-using a memory region, make sure it's big enough. */
+ if (i->data && i->size < size)
+ {
+ munmap (i->data, i->size);
+ i->data = 0;
+ }
+ i->data = mmap (i->data, real_size,
+ writable ? PROT_WRITE | PROT_READ : PROT_READ,
+ (writable
+ ? MAP_FILE | MAP_PRIVATE
+ : MAP_FILE | MAP_SHARED),
+ fd, file_offset);
+ if (i->data == (void *) -1)
+ {
+ /* An error happened. Report it, or try using malloc, or
+ something. */
+ bfd_set_error (bfd_error_system_call);
+ i->data = 0;
+ windowp->data = 0;
+ if (debug_windows)
+ fprintf (stderr, "\t\tmmap failed!\n");
+ return FALSE;
+ }
+ if (debug_windows)
+ fprintf (stderr, "\n\tmapped %ld at %p, offset is %ld\n",
+ (long) real_size, i->data, (long) offset2);
+ i->size = real_size;
+ windowp->data = (bfd_byte *) i->data + offset2;
+ windowp->size = size;
+ i->mapped = 1;
+ return TRUE;
+ }
+ else if (debug_windows)
+ {
+ if (ok_to_map)
+ fprintf (stderr, _("not mapping: data=%lx mapped=%d\n"),
+ (unsigned long) i->data, (int) i->mapped);
+ else
+ fprintf (stderr, _("not mapping: env var not set\n"));
+ }
+#else
+ ok_to_map = 0;
+#endif
+
+#ifdef HAVE_MPROTECT
+ if (!writable)
+ {
+ size_to_alloc += pagesize - 1;
+ size_to_alloc -= size_to_alloc % pagesize;
+ }
+#endif
+ if (debug_windows)
+ fprintf (stderr, "\n\t%s(%6ld)",
+ i->data ? "realloc" : " malloc", (long) size_to_alloc);
+ i->data = bfd_realloc (i->data, size_to_alloc);
+ if (debug_windows)
+ fprintf (stderr, "\t-> %p\n", i->data);
+ i->refcount = 1;
+ if (i->data == NULL)
+ {
+ if (size_to_alloc == 0)
+ return TRUE;
+ return FALSE;
+ }
+ if (bfd_seek (abfd, offset, SEEK_SET) != 0)
+ return FALSE;
+ i->size = bfd_bread (i->data, size, abfd);
+ if (i->size != size)
+ return FALSE;
+ i->mapped = 0;
+#ifdef HAVE_MPROTECT
+ if (!writable)
+ {
+ if (debug_windows)
+ fprintf (stderr, "\tmprotect (%p, %ld, PROT_READ)\n", i->data,
+ (long) i->size);
+ mprotect (i->data, i->size, PROT_READ);
+ }
+#endif
+ windowp->data = i->data;
+ windowp->size = i->size;
+ return TRUE;
+}
+
+#endif /* USE_MMAP */
diff --git a/contrib/binutils/bfd/binary.c b/contrib/binutils/bfd/binary.c
index 7bddabf..65f46af 100644
--- a/contrib/binutils/bfd/binary.c
+++ b/contrib/binutils/bfd/binary.c
@@ -1,23 +1,23 @@
/* BFD back-end for binary objects.
- Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
+ Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
Free Software Foundation, Inc.
Written by Ian Lance Taylor, Cygnus Support, <ian@cygnus.com>
-This file is part of BFD, the Binary File Descriptor library.
+ This 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
/* This is a BFD backend which may be used to write binary objects.
It may only be used for output, not input. The intention is that
@@ -41,29 +41,30 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
a start symbol, an end symbol, and an absolute length symbol. */
#define BIN_SYMS 3
-static boolean binary_mkobject PARAMS ((bfd *));
+static bfd_boolean binary_mkobject PARAMS ((bfd *));
static const bfd_target *binary_object_p PARAMS ((bfd *));
-static boolean binary_get_section_contents
+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_get_symtab PARAMS ((bfd *, asymbol **));
+static long binary_canonicalize_symtab PARAMS ((bfd *, asymbol **));
static void binary_get_symbol_info PARAMS ((bfd *, asymbol *, symbol_info *));
-static boolean binary_set_section_contents
- PARAMS ((bfd *, asection *, PTR, file_ptr, bfd_size_type));
-static int binary_sizeof_headers PARAMS ((bfd *, boolean));
+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
- to use when creating binary BFDs. */
-enum bfd_architecture bfd_external_binary_architecture = bfd_arch_unknown;
+/* Set by external programs - specifies the BFD architecture and
+ machine number to be uses when creating binary BFDs. */
+enum bfd_architecture bfd_external_binary_architecture = bfd_arch_unknown;
+unsigned long bfd_external_machine = 0;
/* Create a binary object. Invoked via bfd_set_format. */
-static boolean
+static bfd_boolean
binary_mkobject (abfd)
bfd *abfd ATTRIBUTE_UNUSED;
{
- return true;
+ return TRUE;
}
/* Any file may be considered to be a binary file, provided the target
@@ -107,7 +108,8 @@ binary_object_p (abfd)
{
if ((bfd_get_arch_info (abfd)->arch == bfd_arch_unknown)
&& (bfd_external_binary_architecture != bfd_arch_unknown))
- bfd_set_arch_info (abfd, bfd_lookup_arch (bfd_external_binary_architecture, 0));
+ bfd_set_arch_info (abfd, bfd_lookup_arch
+ (bfd_external_binary_architecture, bfd_external_machine));
}
return abfd->xvec;
@@ -119,7 +121,7 @@ binary_object_p (abfd)
/* Get contents of the only section. */
-static boolean
+static bfd_boolean
binary_get_section_contents (abfd, section, location, offset, count)
bfd *abfd;
asection *section ATTRIBUTE_UNUSED;
@@ -129,8 +131,8 @@ binary_get_section_contents (abfd, section, location, offset, count)
{
if (bfd_seek (abfd, offset, SEEK_SET) != 0
|| bfd_bread (location, count, abfd) != count)
- return false;
- return true;
+ return FALSE;
+ return TRUE;
}
/* Return the amount of memory needed to read the symbol table. */
@@ -174,7 +176,7 @@ mangle_name (abfd, suffix)
/* Return the symbol table. */
static long
-binary_get_symtab (abfd, alocation)
+binary_canonicalize_symtab (abfd, alocation)
bfd *abfd;
asymbol **alocation;
{
@@ -185,7 +187,7 @@ binary_get_symtab (abfd, alocation)
syms = (asymbol *) bfd_alloc (abfd, amt);
if (syms == NULL)
- return (long) false;
+ return 0;
/* Start symbol. */
syms[0].the_bfd = abfd;
@@ -250,27 +252,27 @@ binary_get_symbol_info (ignore_abfd, symbol, ret)
/* Write section contents of a binary file. */
-static boolean
+static bfd_boolean
binary_set_section_contents (abfd, sec, data, offset, size)
bfd *abfd;
asection *sec;
- PTR data;
+ const PTR data;
file_ptr offset;
bfd_size_type size;
{
if (size == 0)
- return true;
+ return TRUE;
if (! abfd->output_has_begun)
{
- boolean found_low;
+ bfd_boolean found_low;
bfd_vma low;
asection *s;
/* The lowest section LMA sets the virtual address of the start
of the file. We use this to set the file position of all the
sections. */
- found_low = false;
+ found_low = FALSE;
low = 0;
for (s = abfd->sections; s != NULL; s = s->next)
if (((s->flags
@@ -280,7 +282,7 @@ binary_set_section_contents (abfd, sec, data, offset, size)
&& (! found_low || s->lma < low))
{
low = s->lma;
- found_low = true;
+ found_low = TRUE;
}
for (s = abfd->sections; s != NULL; s = s->next)
@@ -308,16 +310,16 @@ binary_set_section_contents (abfd, sec, data, offset, size)
(unsigned long) s->filepos);
}
- abfd->output_has_begun = true;
+ abfd->output_has_begun = TRUE;
}
/* We don't want to output anything for a section that is neither
loaded nor allocated. The contents of such a section are not
meaningful in the binary format. */
if ((sec->flags & (SEC_LOAD | SEC_ALLOC)) == 0)
- return true;
+ return TRUE;
if ((sec->flags & SEC_NEVER_LOAD) != 0)
- return true;
+ return TRUE;
return _bfd_generic_set_section_contents (abfd, sec, data, offset, size);
}
@@ -327,7 +329,7 @@ binary_set_section_contents (abfd, sec, data, offset, size)
static int
binary_sizeof_headers (abfd, exec)
bfd *abfd ATTRIBUTE_UNUSED;
- boolean exec ATTRIBUTE_UNUSED;
+ bfd_boolean exec ATTRIBUTE_UNUSED;
{
return 0;
}
diff --git a/contrib/binutils/bfd/bout.c b/contrib/binutils/bfd/bout.c
new file mode 100644
index 0000000..a39a9a3
--- /dev/null
+++ b/contrib/binutils/bfd/bout.c
@@ -0,0 +1,1579 @@
+/* BFD back-end for Intel 960 b.out binaries.
+ Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
+ 2000, 2001, 2002, 2003
+ Free Software Foundation, Inc.
+ Written by Cygnus Support.
+
+This file is part of BFD, the Binary File Descriptor library.
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+
+#include "bfd.h"
+#include "sysdep.h"
+#include "libbfd.h"
+#include "bfdlink.h"
+#include "genlink.h"
+#include "bout.h"
+
+#include "aout/stab_gnu.h"
+#include "libaout.h" /* BFD a.out internal data structures. */
+
+static int aligncode
+ PARAMS ((bfd *abfd, asection *input_section, arelent *r,
+ unsigned int shrink));
+static void perform_slip
+ PARAMS ((bfd *abfd, unsigned int slip, asection *input_section,
+ bfd_vma value));
+static bfd_boolean b_out_squirt_out_relocs
+ PARAMS ((bfd *abfd, asection *section));
+static const bfd_target *b_out_callback
+ PARAMS ((bfd *));
+static bfd_reloc_status_type calljx_callback
+ PARAMS ((bfd *, struct bfd_link_info *, arelent *, PTR src, PTR dst,
+ asection *));
+static bfd_reloc_status_type callj_callback
+ PARAMS ((bfd *, struct bfd_link_info *, arelent *, PTR data,
+ unsigned int srcidx, unsigned int dstidx, asection *, bfd_boolean));
+static bfd_vma get_value
+ PARAMS ((arelent *, struct bfd_link_info *, asection *));
+static int abs32code
+ PARAMS ((bfd *, asection *, arelent *, unsigned int,
+ struct bfd_link_info *));
+static bfd_boolean b_out_bfd_relax_section
+ PARAMS ((bfd *, asection *, struct bfd_link_info *, bfd_boolean *));
+static bfd_byte *b_out_bfd_get_relocated_section_contents
+ PARAMS ((bfd *, struct bfd_link_info *, struct bfd_link_order *, bfd_byte *,
+ bfd_boolean, asymbol **));
+static int b_out_sizeof_headers
+ PARAMS ((bfd *, bfd_boolean));
+static bfd_boolean b_out_set_arch_mach
+ PARAMS ((bfd *, enum bfd_architecture, unsigned long));
+static bfd_boolean b_out_set_section_contents
+ PARAMS ((bfd *, asection *, const PTR, file_ptr, bfd_size_type));
+static long b_out_get_reloc_upper_bound
+ PARAMS ((bfd *, sec_ptr));
+static long b_out_canonicalize_reloc
+ PARAMS ((bfd *, sec_ptr, arelent **, asymbol **));
+static bfd_boolean b_out_slurp_reloc_table
+ PARAMS ((bfd *, sec_ptr, asymbol **));
+static reloc_howto_type *b_out_bfd_reloc_type_lookup
+ PARAMS ((bfd *, bfd_reloc_code_real_type));
+static bfd_boolean b_out_write_object_contents
+ PARAMS ((bfd *));
+static int b_out_symbol_cmp
+ PARAMS ((const void *, const void *));
+static bfd_boolean b_out_mkobject
+ PARAMS ((bfd *));
+static const bfd_target *b_out_object_p
+ PARAMS ((bfd *));
+
+void bout_swap_exec_header_in
+ PARAMS ((bfd *, struct external_exec *, struct internal_exec *));
+void bout_swap_exec_header_out
+ PARAMS ((bfd *, struct internal_exec *, struct external_exec *));
+
+/* Swaps the information in an executable header taken from a raw byte
+ stream memory image, into the internal exec_header structure. */
+
+void
+bout_swap_exec_header_in (abfd, raw_bytes, execp)
+ bfd *abfd;
+ struct external_exec *raw_bytes;
+ struct internal_exec *execp;
+{
+ struct external_exec *bytes = (struct external_exec *)raw_bytes;
+
+ /* Now fill in fields in the execp, from the bytes in the raw data. */
+ execp->a_info = H_GET_32 (abfd, bytes->e_info);
+ execp->a_text = GET_WORD (abfd, bytes->e_text);
+ execp->a_data = GET_WORD (abfd, bytes->e_data);
+ execp->a_bss = GET_WORD (abfd, bytes->e_bss);
+ execp->a_syms = GET_WORD (abfd, bytes->e_syms);
+ execp->a_entry = GET_WORD (abfd, bytes->e_entry);
+ execp->a_trsize = GET_WORD (abfd, bytes->e_trsize);
+ execp->a_drsize = GET_WORD (abfd, bytes->e_drsize);
+ execp->a_tload = GET_WORD (abfd, bytes->e_tload);
+ execp->a_dload = GET_WORD (abfd, bytes->e_dload);
+ execp->a_talign = bytes->e_talign[0];
+ execp->a_dalign = bytes->e_dalign[0];
+ execp->a_balign = bytes->e_balign[0];
+ execp->a_relaxable = bytes->e_relaxable[0];
+}
+
+/* Swaps the information in an internal exec header structure into the
+ supplied buffer ready for writing to disk. */
+
+void
+bout_swap_exec_header_out (abfd, execp, raw_bytes)
+ bfd *abfd;
+ struct internal_exec *execp;
+ struct external_exec *raw_bytes;
+{
+ struct external_exec *bytes = (struct external_exec *)raw_bytes;
+
+ /* Now fill in fields in the raw data, from the fields in the exec struct. */
+ H_PUT_32 (abfd, execp->a_info , bytes->e_info);
+ PUT_WORD (abfd, execp->a_text , bytes->e_text);
+ PUT_WORD (abfd, execp->a_data , bytes->e_data);
+ PUT_WORD (abfd, execp->a_bss , bytes->e_bss);
+ PUT_WORD (abfd, execp->a_syms , bytes->e_syms);
+ PUT_WORD (abfd, execp->a_entry , bytes->e_entry);
+ PUT_WORD (abfd, execp->a_trsize, bytes->e_trsize);
+ PUT_WORD (abfd, execp->a_drsize, bytes->e_drsize);
+ PUT_WORD (abfd, execp->a_tload , bytes->e_tload);
+ PUT_WORD (abfd, execp->a_dload , bytes->e_dload);
+ bytes->e_talign[0] = execp->a_talign;
+ bytes->e_dalign[0] = execp->a_dalign;
+ bytes->e_balign[0] = execp->a_balign;
+ bytes->e_relaxable[0] = execp->a_relaxable;
+}
+
+static const bfd_target *
+b_out_object_p (abfd)
+ bfd *abfd;
+{
+ struct internal_exec anexec;
+ struct external_exec exec_bytes;
+ bfd_size_type amt = EXEC_BYTES_SIZE;
+
+ if (bfd_bread ((PTR) &exec_bytes, amt, abfd) != amt)
+ {
+ if (bfd_get_error () != bfd_error_system_call)
+ bfd_set_error (bfd_error_wrong_format);
+ return 0;
+ }
+
+ anexec.a_info = H_GET_32 (abfd, exec_bytes.e_info);
+
+ if (N_BADMAG (anexec))
+ {
+ bfd_set_error (bfd_error_wrong_format);
+ return 0;
+ }
+
+ bout_swap_exec_header_in (abfd, &exec_bytes, &anexec);
+ return aout_32_some_aout_object_p (abfd, &anexec, b_out_callback);
+}
+
+/* Finish up the opening of a b.out file for reading. Fill in all the
+ fields that are not handled by common code. */
+
+static const bfd_target *
+b_out_callback (abfd)
+ bfd *abfd;
+{
+ struct internal_exec *execp = exec_hdr (abfd);
+ unsigned long bss_start;
+
+ /* Architecture and machine type. */
+ bfd_set_arch_mach(abfd,
+ bfd_arch_i960, /* B.out only used on i960 */
+ bfd_mach_i960_core /* Default */
+ );
+
+ /* The positions of the string table and symbol table. */
+ obj_str_filepos (abfd) = N_STROFF (*execp);
+ obj_sym_filepos (abfd) = N_SYMOFF (*execp);
+
+ /* The alignments of the sections. */
+ obj_textsec (abfd)->alignment_power = execp->a_talign;
+ obj_datasec (abfd)->alignment_power = execp->a_dalign;
+ obj_bsssec (abfd)->alignment_power = execp->a_balign;
+
+ /* The starting addresses of the sections. */
+ obj_textsec (abfd)->vma = execp->a_tload;
+ obj_datasec (abfd)->vma = execp->a_dload;
+
+ obj_textsec (abfd)->lma = obj_textsec (abfd)->vma;
+ obj_datasec (abfd)->lma = obj_datasec (abfd)->vma;
+
+ /* And reload the sizes, since the aout module zaps them. */
+ obj_textsec (abfd)->_raw_size = execp->a_text;
+
+ bss_start = execp->a_dload + execp->a_data; /* BSS = end of data section */
+ obj_bsssec (abfd)->vma = align_power (bss_start, execp->a_balign);
+
+ obj_bsssec (abfd)->lma = obj_bsssec (abfd)->vma;
+
+ /* The file positions of the sections. */
+ obj_textsec (abfd)->filepos = N_TXTOFF(*execp);
+ obj_datasec (abfd)->filepos = N_DATOFF(*execp);
+
+ /* The file positions of the relocation info. */
+ obj_textsec (abfd)->rel_filepos = N_TROFF(*execp);
+ obj_datasec (abfd)->rel_filepos = N_DROFF(*execp);
+
+ adata(abfd).page_size = 1; /* Not applicable. */
+ adata(abfd).segment_size = 1; /* Not applicable. */
+ adata(abfd).exec_bytes_size = EXEC_BYTES_SIZE;
+
+ if (execp->a_relaxable)
+ abfd->flags |= BFD_IS_RELAXABLE;
+ return abfd->xvec;
+}
+
+struct bout_data_struct
+ {
+ struct aoutdata a;
+ struct internal_exec e;
+ };
+
+static bfd_boolean
+b_out_mkobject (abfd)
+ bfd *abfd;
+{
+ struct bout_data_struct *rawptr;
+ bfd_size_type amt = sizeof (struct bout_data_struct);
+
+ rawptr = (struct bout_data_struct *) bfd_zalloc (abfd, amt);
+ if (rawptr == NULL)
+ return FALSE;
+
+ abfd->tdata.bout_data = rawptr;
+ exec_hdr (abfd) = &rawptr->e;
+
+ obj_textsec (abfd) = (asection *) NULL;
+ obj_datasec (abfd) = (asection *) NULL;
+ obj_bsssec (abfd) = (asection *) NULL;
+
+ return TRUE;
+}
+
+static int
+b_out_symbol_cmp (a_ptr, b_ptr)
+ const void * a_ptr;
+ const void * b_ptr;
+{
+ struct aout_symbol ** a = (struct aout_symbol **) a_ptr;
+ struct aout_symbol ** b = (struct aout_symbol **) b_ptr;
+ asection *sec;
+ bfd_vma av, bv;
+
+ /* Primary key is address. */
+ sec = bfd_get_section (&(*a)->symbol);
+ av = sec->output_section->vma + sec->output_offset + (*a)->symbol.value;
+ sec = bfd_get_section (&(*b)->symbol);
+ bv = sec->output_section->vma + sec->output_offset + (*b)->symbol.value;
+
+ if (av < bv)
+ return -1;
+ if (av > bv)
+ return 1;
+
+ /* Secondary key puts CALLNAME syms last and BALNAME syms first, so
+ that they have the best chance of being contiguous. */
+ if (IS_BALNAME ((*a)->other) || IS_CALLNAME ((*b)->other))
+ return -1;
+ if (IS_CALLNAME ((*a)->other) || IS_BALNAME ((*b)->other))
+ return 1;
+
+ return 0;
+}
+
+static bfd_boolean
+b_out_write_object_contents (abfd)
+ bfd *abfd;
+{
+ struct external_exec swapped_hdr;
+ bfd_size_type amt;
+
+ if (! aout_32_make_sections (abfd))
+ return FALSE;
+
+ exec_hdr (abfd)->a_info = BMAGIC;
+
+ exec_hdr (abfd)->a_text = obj_textsec (abfd)->_raw_size;
+ exec_hdr (abfd)->a_data = obj_datasec (abfd)->_raw_size;
+ exec_hdr (abfd)->a_bss = obj_bsssec (abfd)->_raw_size;
+ exec_hdr (abfd)->a_syms = bfd_get_symcount (abfd) * sizeof (struct nlist);
+ exec_hdr (abfd)->a_entry = bfd_get_start_address (abfd);
+ exec_hdr (abfd)->a_trsize = ((obj_textsec (abfd)->reloc_count) *
+ sizeof (struct relocation_info));
+ exec_hdr (abfd)->a_drsize = ((obj_datasec (abfd)->reloc_count) *
+ sizeof (struct relocation_info));
+
+ exec_hdr (abfd)->a_talign = obj_textsec (abfd)->alignment_power;
+ exec_hdr (abfd)->a_dalign = obj_datasec (abfd)->alignment_power;
+ exec_hdr (abfd)->a_balign = obj_bsssec (abfd)->alignment_power;
+
+ exec_hdr (abfd)->a_tload = obj_textsec (abfd)->vma;
+ exec_hdr (abfd)->a_dload = obj_datasec (abfd)->vma;
+
+ bout_swap_exec_header_out (abfd, exec_hdr (abfd), &swapped_hdr);
+
+ amt = EXEC_BYTES_SIZE;
+ if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0
+ || bfd_bwrite ((PTR) &swapped_hdr, amt, abfd) != amt)
+ return FALSE;
+
+ /* Now write out reloc info, followed by syms and strings */
+ if (bfd_get_symcount (abfd) != 0)
+ {
+ /* Make sure {CALL,BAL}NAME symbols remain adjacent on output
+ by sorting. This is complicated by the fact that stabs are
+ also ordered. Solve this by shifting all stabs to the end
+ in order, then sorting the rest. */
+
+ asymbol **outsyms, **p, **q;
+
+ outsyms = bfd_get_outsymbols (abfd);
+ p = outsyms + bfd_get_symcount (abfd);
+
+ for (q = p--; p >= outsyms; p--)
+ {
+ if ((*p)->flags & BSF_DEBUGGING)
+ {
+ asymbol *t = *--q;
+ *q = *p;
+ *p = t;
+ }
+ }
+
+ if (q > outsyms)
+ qsort (outsyms, (size_t) (q - outsyms), sizeof (asymbol*),
+ b_out_symbol_cmp);
+
+ /* Back to your regularly scheduled program. */
+ if (bfd_seek (abfd, (file_ptr) (N_SYMOFF(*exec_hdr(abfd))), SEEK_SET)
+ != 0)
+ return FALSE;
+
+ if (! aout_32_write_syms (abfd))
+ return FALSE;
+
+ if (bfd_seek (abfd, (file_ptr) (N_TROFF(*exec_hdr(abfd))), SEEK_SET)
+ != 0)
+ return FALSE;
+
+ if (!b_out_squirt_out_relocs (abfd, obj_textsec (abfd)))
+ return FALSE;
+ if (bfd_seek (abfd, (file_ptr) (N_DROFF(*exec_hdr(abfd))), SEEK_SET)
+ != 0)
+ return FALSE;
+
+ if (!b_out_squirt_out_relocs (abfd, obj_datasec (abfd)))
+ return FALSE;
+ }
+ return TRUE;
+}
+
+/* Some reloc hackery. */
+
+#define CALLS 0x66003800 /* Template for 'calls' instruction */
+#define BAL 0x0b000000 /* Template for 'bal' instruction */
+#define BAL_MASK 0x00ffffff
+#define BALX 0x85f00000 /* Template for 'balx' instruction */
+#define BALX_MASK 0x0007ffff
+#define CALL 0x09000000
+#define PCREL13_MASK 0x1fff
+
+#define output_addr(sec) ((sec)->output_offset+(sec)->output_section->vma)
+
+/* Magic to turn callx into calljx. */
+
+static bfd_reloc_status_type
+calljx_callback (abfd, link_info, reloc_entry, src, dst, input_section)
+ bfd *abfd;
+ struct bfd_link_info *link_info;
+ arelent *reloc_entry;
+ PTR src;
+ PTR dst;
+ asection *input_section;
+{
+ int word = bfd_get_32 (abfd, src);
+ asymbol *symbol_in = *(reloc_entry->sym_ptr_ptr);
+ aout_symbol_type *symbol = aout_symbol (symbol_in);
+ bfd_vma value;
+
+ value = get_value (reloc_entry, link_info, input_section);
+
+ if (IS_CALLNAME (symbol->other))
+ {
+ aout_symbol_type *balsym = symbol+1;
+ int inst = bfd_get_32 (abfd, (bfd_byte *) src-4);
+ /* The next symbol should be an N_BALNAME. */
+ BFD_ASSERT (IS_BALNAME (balsym->other));
+ inst &= BALX_MASK;
+ inst |= BALX;
+ bfd_put_32 (abfd, (bfd_vma) inst, (bfd_byte *) dst-4);
+ symbol = balsym;
+ value = (symbol->symbol.value
+ + output_addr (symbol->symbol.section));
+ }
+
+ word += value + reloc_entry->addend;
+
+ bfd_put_32 (abfd, (bfd_vma) word, dst);
+ return bfd_reloc_ok;
+}
+
+/* Magic to turn call into callj. */
+
+static bfd_reloc_status_type
+callj_callback (abfd, link_info, reloc_entry, data, srcidx, dstidx,
+ input_section, shrinking)
+ bfd *abfd;
+ struct bfd_link_info *link_info;
+ arelent *reloc_entry;
+ PTR data;
+ unsigned int srcidx;
+ unsigned int dstidx;
+ asection *input_section;
+ bfd_boolean shrinking;
+{
+ int word = bfd_get_32 (abfd, (bfd_byte *) data + srcidx);
+ asymbol *symbol_in = *(reloc_entry->sym_ptr_ptr);
+ aout_symbol_type *symbol = aout_symbol (symbol_in);
+ bfd_vma value;
+
+ value = get_value (reloc_entry, link_info, input_section);
+
+ if (IS_OTHER(symbol->other))
+ {
+ /* Call to a system procedure - replace code with system
+ procedure number. */
+ word = CALLS | (symbol->other - 1);
+ }
+ else if (IS_CALLNAME(symbol->other))
+ {
+ aout_symbol_type *balsym = symbol+1;
+
+ /* The next symbol should be an N_BALNAME. */
+ BFD_ASSERT(IS_BALNAME(balsym->other));
+
+ /* We are calling a leaf, so replace the call instruction with a
+ bal. */
+ word = BAL | ((word
+ + output_addr (balsym->symbol.section)
+ + balsym->symbol.value + reloc_entry->addend
+ - dstidx
+ - output_addr (input_section))
+ & BAL_MASK);
+ }
+ else if ((symbol->symbol.flags & BSF_SECTION_SYM) != 0)
+ {
+ /* A callj against a symbol in the same section is a fully
+ resolved relative call. We don't need to do anything here.
+ If the symbol is not in the same section, I'm not sure what
+ to do; fortunately, this case will probably never arise. */
+ BFD_ASSERT (! shrinking);
+ BFD_ASSERT (symbol->symbol.section == input_section);
+ }
+ else
+ {
+ word = CALL | (((word & BAL_MASK)
+ + value
+ + reloc_entry->addend
+ - (shrinking ? dstidx : 0)
+ - output_addr (input_section))
+ & BAL_MASK);
+ }
+ bfd_put_32 (abfd, (bfd_vma) word, (bfd_byte *) data + dstidx);
+ return bfd_reloc_ok;
+}
+
+/* type rshift size bitsize pcrel bitpos absolute overflow check*/
+
+#define ABS32CODE 0
+#define ABS32CODE_SHRUNK 1
+#define PCREL24 2
+#define CALLJ 3
+#define ABS32 4
+#define PCREL13 5
+#define ABS32_MAYBE_RELAXABLE 1
+#define ABS32_WAS_RELAXABLE 2
+
+#define ALIGNER 10
+#define ALIGNDONE 11
+static reloc_howto_type howto_reloc_callj =
+HOWTO(CALLJ, 0, 2, 24, TRUE, 0, complain_overflow_signed, 0,"callj", TRUE, 0x00ffffff, 0x00ffffff,FALSE);
+static reloc_howto_type howto_reloc_abs32 =
+HOWTO(ABS32, 0, 2, 32, FALSE, 0, complain_overflow_bitfield,0,"abs32", TRUE, 0xffffffff,0xffffffff,FALSE);
+static reloc_howto_type howto_reloc_pcrel24 =
+HOWTO(PCREL24, 0, 2, 24, TRUE, 0, complain_overflow_signed,0,"pcrel24", TRUE, 0x00ffffff,0x00ffffff,FALSE);
+
+static reloc_howto_type howto_reloc_pcrel13 =
+HOWTO(PCREL13, 0, 2, 13, TRUE, 0, complain_overflow_signed,0,"pcrel13", TRUE, 0x00001fff,0x00001fff,FALSE);
+
+static reloc_howto_type howto_reloc_abs32codeshrunk =
+HOWTO(ABS32CODE_SHRUNK, 0, 2, 24, TRUE, 0, complain_overflow_signed, 0,"callx->callj", TRUE, 0x00ffffff, 0x00ffffff,FALSE);
+
+static reloc_howto_type howto_reloc_abs32code =
+HOWTO(ABS32CODE, 0, 2, 32, FALSE, 0, complain_overflow_bitfield,0,"callx", TRUE, 0xffffffff,0xffffffff,FALSE);
+
+static reloc_howto_type howto_align_table[] = {
+ HOWTO (ALIGNER, 0, 0x1, 0, FALSE, 0, complain_overflow_dont, 0, "align16", FALSE, 0, 0, FALSE),
+ HOWTO (ALIGNER, 0, 0x3, 0, FALSE, 0, complain_overflow_dont, 0, "align32", FALSE, 0, 0, FALSE),
+ HOWTO (ALIGNER, 0, 0x7, 0, FALSE, 0, complain_overflow_dont, 0, "align64", FALSE, 0, 0, FALSE),
+ HOWTO (ALIGNER, 0, 0xf, 0, FALSE, 0, complain_overflow_dont, 0, "align128", FALSE, 0, 0, FALSE),
+};
+
+static reloc_howto_type howto_done_align_table[] = {
+ HOWTO (ALIGNDONE, 0x1, 0x1, 0, FALSE, 0, complain_overflow_dont, 0, "donealign16", FALSE, 0, 0, FALSE),
+ HOWTO (ALIGNDONE, 0x3, 0x3, 0, FALSE, 0, complain_overflow_dont, 0, "donealign32", FALSE, 0, 0, FALSE),
+ HOWTO (ALIGNDONE, 0x7, 0x7, 0, FALSE, 0, complain_overflow_dont, 0, "donealign64", FALSE, 0, 0, FALSE),
+ HOWTO (ALIGNDONE, 0xf, 0xf, 0, FALSE, 0, complain_overflow_dont, 0, "donealign128", FALSE, 0, 0, FALSE),
+};
+
+static reloc_howto_type *
+b_out_bfd_reloc_type_lookup (abfd, code)
+ bfd *abfd ATTRIBUTE_UNUSED;
+ bfd_reloc_code_real_type code;
+{
+ switch (code)
+ {
+ default:
+ return 0;
+ case BFD_RELOC_I960_CALLJ:
+ return &howto_reloc_callj;
+ case BFD_RELOC_32:
+ case BFD_RELOC_CTOR:
+ return &howto_reloc_abs32;
+ case BFD_RELOC_24_PCREL:
+ return &howto_reloc_pcrel24;
+ }
+}
+
+/* Allocate enough room for all the reloc entries, plus pointers to them all. */
+
+static bfd_boolean
+b_out_slurp_reloc_table (abfd, asect, symbols)
+ bfd *abfd;
+ sec_ptr asect;
+ asymbol **symbols;
+{
+ register struct relocation_info *rptr;
+ unsigned int counter;
+ arelent *cache_ptr;
+ int extern_mask, pcrel_mask, callj_mask, length_shift;
+ int incode_mask;
+ int size_mask;
+ bfd_vma prev_addr = 0;
+ unsigned int count;
+ bfd_size_type reloc_size, amt;
+ struct relocation_info *relocs;
+ arelent *reloc_cache;
+
+ if (asect->relocation)
+ return TRUE;
+
+ if (!aout_32_slurp_symbol_table (abfd))
+ return FALSE;
+
+ if (asect == obj_datasec (abfd))
+ {
+ reloc_size = exec_hdr(abfd)->a_drsize;
+ goto doit;
+ }
+
+ if (asect == obj_textsec (abfd))
+ {
+ reloc_size = exec_hdr(abfd)->a_trsize;
+ goto doit;
+ }
+
+ if (asect == obj_bsssec (abfd))
+ {
+ reloc_size = 0;
+ goto doit;
+ }
+
+ bfd_set_error (bfd_error_invalid_operation);
+ return FALSE;
+
+ doit:
+ if (bfd_seek (abfd, asect->rel_filepos, SEEK_SET) != 0)
+ return FALSE;
+ count = reloc_size / sizeof (struct relocation_info);
+
+ relocs = (struct relocation_info *) bfd_malloc (reloc_size);
+ if (!relocs && reloc_size != 0)
+ return FALSE;
+
+ amt = ((bfd_size_type) count + 1) * sizeof (arelent);
+ reloc_cache = (arelent *) bfd_malloc (amt);
+ if (!reloc_cache)
+ {
+ if (relocs != NULL)
+ free (relocs);
+ return FALSE;
+ }
+
+ if (bfd_bread ((PTR) relocs, reloc_size, abfd) != reloc_size)
+ {
+ free (reloc_cache);
+ if (relocs != NULL)
+ free (relocs);
+ return FALSE;
+ }
+
+ if (bfd_header_big_endian (abfd))
+ {
+ /* Big-endian bit field allocation order. */
+ pcrel_mask = 0x80;
+ extern_mask = 0x10;
+ incode_mask = 0x08;
+ callj_mask = 0x02;
+ size_mask = 0x20;
+ length_shift = 5;
+ }
+ else
+ {
+ /* Little-endian bit field allocation order. */
+ pcrel_mask = 0x01;
+ extern_mask = 0x08;
+ incode_mask = 0x10;
+ callj_mask = 0x40;
+ size_mask = 0x02;
+ length_shift = 1;
+ }
+
+ for (rptr = relocs, cache_ptr = reloc_cache, counter = 0;
+ counter < count;
+ counter++, rptr++, cache_ptr++)
+ {
+ unsigned char *raw = (unsigned char *)rptr;
+ unsigned int symnum;
+
+ cache_ptr->address = H_GET_32 (abfd, raw + 0);
+ cache_ptr->howto = 0;
+
+ if (bfd_header_big_endian (abfd))
+ symnum = (raw[4] << 16) | (raw[5] << 8) | raw[6];
+ else
+ symnum = (raw[6] << 16) | (raw[5] << 8) | raw[4];
+
+ if (raw[7] & extern_mask)
+ {
+ /* If this is set then the r_index is an index into the symbol table;
+ if the bit is not set then r_index contains a section map.
+ We either fill in the sym entry with a pointer to the symbol,
+ or point to the correct section. */
+ cache_ptr->sym_ptr_ptr = symbols + symnum;
+ cache_ptr->addend = 0;
+ }
+ else
+ {
+ /* In a.out symbols are relative to the beginning of the
+ file rather than sections ?
+ (look in translate_from_native_sym_flags)
+ The reloc entry addend has added to it the offset into the
+ file of the data, so subtract the base to make the reloc
+ section relative. */
+ int s;
+
+ /* Sign-extend symnum from 24 bits to whatever host uses. */
+ s = symnum;
+ if (s & (1 << 23))
+ s |= (~0) << 24;
+
+ cache_ptr->sym_ptr_ptr = (asymbol **)NULL;
+ switch (s)
+ {
+ case N_TEXT:
+ case N_TEXT | N_EXT:
+ cache_ptr->sym_ptr_ptr = obj_textsec (abfd)->symbol_ptr_ptr;
+ cache_ptr->addend = - obj_textsec (abfd)->vma;
+ break;
+ case N_DATA:
+ case N_DATA | N_EXT:
+ cache_ptr->sym_ptr_ptr = obj_datasec (abfd)->symbol_ptr_ptr;
+ cache_ptr->addend = - obj_datasec (abfd)->vma;
+ break;
+ case N_BSS:
+ case N_BSS | N_EXT:
+ cache_ptr->sym_ptr_ptr = obj_bsssec (abfd)->symbol_ptr_ptr;
+ cache_ptr->addend = - obj_bsssec (abfd)->vma;
+ break;
+ case N_ABS:
+ case N_ABS | N_EXT:
+ cache_ptr->sym_ptr_ptr = obj_bsssec (abfd)->symbol_ptr_ptr;
+ cache_ptr->addend = 0;
+ break;
+ case -2: /* .align */
+ if (raw[7] & pcrel_mask)
+ {
+ cache_ptr->howto = &howto_align_table[(raw[7] >> length_shift) & 3];
+ cache_ptr->sym_ptr_ptr = bfd_abs_section_ptr->symbol_ptr_ptr;
+ }
+ else
+ {
+ /* .org? */
+ abort ();
+ }
+ cache_ptr->addend = 0;
+ break;
+ default:
+ BFD_ASSERT(0);
+ break;
+ }
+ }
+
+ /* The i960 only has a few relocation types:
+ abs 32-bit and pcrel 24bit. except for callj's! */
+ if (cache_ptr->howto != 0)
+ ;
+ else if (raw[7] & callj_mask)
+ {
+ cache_ptr->howto = &howto_reloc_callj;
+ }
+ else if ( raw[7] & pcrel_mask)
+ {
+ if (raw[7] & size_mask)
+ cache_ptr->howto = &howto_reloc_pcrel13;
+ else
+ cache_ptr->howto = &howto_reloc_pcrel24;
+ }
+ else
+ {
+ if (raw[7] & incode_mask)
+ cache_ptr->howto = &howto_reloc_abs32code;
+ else
+ cache_ptr->howto = &howto_reloc_abs32;
+ }
+
+ if (cache_ptr->address < prev_addr)
+ {
+ /* Ouch! this reloc is out of order, insert into the right place. */
+ arelent tmp;
+ arelent *cursor = cache_ptr-1;
+ bfd_vma stop = cache_ptr->address;
+
+ tmp = *cache_ptr;
+ while (cursor->address > stop && cursor >= reloc_cache)
+ {
+ cursor[1] = cursor[0];
+ cursor--;
+ }
+
+ cursor[1] = tmp;
+ }
+ else
+ {
+ prev_addr = cache_ptr->address;
+ }
+ }
+
+ if (relocs != NULL)
+ free (relocs);
+ asect->relocation = reloc_cache;
+ asect->reloc_count = count;
+
+ return TRUE;
+}
+
+static bfd_boolean
+b_out_squirt_out_relocs (abfd, section)
+ bfd *abfd;
+ asection *section;
+{
+ arelent **generic;
+ int r_extern = 0;
+ int r_idx;
+ int incode_mask;
+ int len_1;
+ unsigned int count = section->reloc_count;
+ struct relocation_info *native, *natptr;
+ bfd_size_type natsize;
+ int extern_mask, pcrel_mask, len_2, callj_mask;
+
+ if (count == 0)
+ return TRUE;
+
+ generic = section->orelocation;
+ natsize = (bfd_size_type) count * sizeof (struct relocation_info);
+ native = ((struct relocation_info *) bfd_malloc (natsize));
+ if (!native && natsize != 0)
+ return FALSE;
+
+ if (bfd_header_big_endian (abfd))
+ {
+ /* Big-endian bit field allocation order. */
+ pcrel_mask = 0x80;
+ extern_mask = 0x10;
+ len_2 = 0x40;
+ len_1 = 0x20;
+ callj_mask = 0x02;
+ incode_mask = 0x08;
+ }
+ else
+ {
+ /* Little-endian bit field allocation order. */
+ pcrel_mask = 0x01;
+ extern_mask = 0x08;
+ len_2 = 0x04;
+ len_1 = 0x02;
+ callj_mask = 0x40;
+ incode_mask = 0x10;
+ }
+
+ for (natptr = native; count > 0; --count, ++natptr, ++generic)
+ {
+ arelent *g = *generic;
+ unsigned char *raw = (unsigned char *)natptr;
+ asymbol *sym = *(g->sym_ptr_ptr);
+ asection *output_section = sym->section->output_section;
+
+ H_PUT_32 (abfd, g->address, raw);
+ /* Find a type in the output format which matches the input howto -
+ at the moment we assume input format == output format FIXME!! */
+ r_idx = 0;
+ /* FIXME: Need callj stuff here, and to check the howto entries to
+ be sure they are real for this architecture. */
+ if (g->howto== &howto_reloc_callj)
+ raw[7] = callj_mask + pcrel_mask + len_2;
+ else if (g->howto == &howto_reloc_pcrel24)
+ raw[7] = pcrel_mask + len_2;
+ else if (g->howto == &howto_reloc_pcrel13)
+ raw[7] = pcrel_mask + len_1;
+ else if (g->howto == &howto_reloc_abs32code)
+ raw[7] = len_2 + incode_mask;
+ else if (g->howto >= howto_align_table
+ && g->howto <= (howto_align_table
+ + sizeof (howto_align_table) / sizeof (howto_align_table[0])
+ - 1))
+ {
+ /* symnum == -2; extern_mask not set, pcrel_mask set. */
+ r_idx = -2;
+ r_extern = 0;
+ raw[7] = (pcrel_mask
+ | ((g->howto - howto_align_table) << 1));
+ }
+ else
+ raw[7] = len_2;
+
+ if (r_idx != 0)
+ /* Already mucked with r_extern, r_idx. */;
+ else if (bfd_is_com_section (output_section)
+ || bfd_is_abs_section (output_section)
+ || bfd_is_und_section (output_section))
+ {
+ if (bfd_abs_section_ptr->symbol == sym)
+ {
+ /* Whoops, looked like an abs symbol, but is really an offset
+ from the abs section. */
+ r_idx = 0;
+ r_extern = 0;
+ }
+ else
+ {
+ /* Fill in symbol. */
+ r_extern = 1;
+ r_idx = (*g->sym_ptr_ptr)->udata.i;
+ }
+ }
+ else
+ {
+ /* Just an ordinary section. */
+ r_extern = 0;
+ r_idx = output_section->target_index;
+ }
+
+ if (bfd_header_big_endian (abfd))
+ {
+ raw[4] = (unsigned char) (r_idx >> 16);
+ raw[5] = (unsigned char) (r_idx >> 8);
+ raw[6] = (unsigned char) (r_idx );
+ }
+ else
+ {
+ raw[6] = (unsigned char) (r_idx >> 16);
+ raw[5] = (unsigned char) (r_idx>> 8);
+ raw[4] = (unsigned char) (r_idx );
+ }
+
+ if (r_extern)
+ raw[7] |= extern_mask;
+ }
+
+ if (bfd_bwrite ((PTR) native, natsize, abfd) != natsize)
+ {
+ free ((PTR)native);
+ return FALSE;
+ }
+
+ free ((PTR)native);
+
+ return TRUE;
+}
+
+/* This is stupid. This function should be a boolean predicate. */
+
+static long
+b_out_canonicalize_reloc (abfd, section, relptr, symbols)
+ bfd *abfd;
+ sec_ptr section;
+ arelent **relptr;
+ asymbol **symbols;
+{
+ arelent *tblptr;
+ unsigned int count;
+
+ if ((section->flags & SEC_CONSTRUCTOR) != 0)
+ {
+ arelent_chain *chain = section->constructor_chain;
+
+ for (count = 0; count < section->reloc_count; count++)
+ {
+ *relptr++ = &chain->relent;
+ chain = chain->next;
+ }
+ }
+ else
+ {
+ if (section->relocation == NULL
+ && ! b_out_slurp_reloc_table (abfd, section, symbols))
+ return -1;
+
+ tblptr = section->relocation;
+ for (count = 0; count++ < section->reloc_count;)
+ *relptr++ = tblptr++;
+ }
+
+ *relptr = NULL;
+
+ return section->reloc_count;
+}
+
+static long
+b_out_get_reloc_upper_bound (abfd, asect)
+ bfd *abfd;
+ sec_ptr asect;
+{
+ if (bfd_get_format (abfd) != bfd_object)
+ {
+ bfd_set_error (bfd_error_invalid_operation);
+ return -1;
+ }
+
+ if (asect->flags & SEC_CONSTRUCTOR)
+ return sizeof (arelent *) * (asect->reloc_count + 1);
+
+ if (asect == obj_datasec (abfd))
+ return (sizeof (arelent *) *
+ ((exec_hdr(abfd)->a_drsize / sizeof (struct relocation_info))
+ +1));
+
+ if (asect == obj_textsec (abfd))
+ return (sizeof (arelent *) *
+ ((exec_hdr(abfd)->a_trsize / sizeof (struct relocation_info))
+ +1));
+
+ if (asect == obj_bsssec (abfd))
+ return 0;
+
+ bfd_set_error (bfd_error_invalid_operation);
+ return -1;
+}
+
+
+static bfd_boolean
+b_out_set_section_contents (abfd, section, location, offset, count)
+ bfd *abfd;
+ asection *section;
+ const PTR location;
+ file_ptr offset;
+ bfd_size_type count;
+{
+ if (! abfd->output_has_begun)
+ {
+ /* Set by bfd.c handler. */
+ if (! aout_32_make_sections (abfd))
+ return FALSE;
+
+ obj_textsec (abfd)->filepos = sizeof (struct internal_exec);
+ obj_datasec(abfd)->filepos = obj_textsec(abfd)->filepos
+ + obj_textsec (abfd)->_raw_size;
+ }
+
+ /* Regardless, once we know what we're doing, we might as well get going. */
+ if (bfd_seek (abfd, section->filepos + offset, SEEK_SET) != 0)
+ return FALSE;
+
+ if (count == 0)
+ return TRUE;
+
+ return bfd_bwrite ((PTR) location, count, abfd) == count;
+}
+
+static bfd_boolean
+b_out_set_arch_mach (abfd, arch, machine)
+ bfd *abfd;
+ enum bfd_architecture arch;
+ unsigned long machine;
+{
+ bfd_default_set_arch_mach(abfd, arch, machine);
+
+ if (arch == bfd_arch_unknown) /* Unknown machine arch is OK. */
+ return TRUE;
+
+ if (arch == bfd_arch_i960) /* i960 default is OK. */
+ switch (machine)
+ {
+ case bfd_mach_i960_core:
+ case bfd_mach_i960_kb_sb:
+ case bfd_mach_i960_mc:
+ case bfd_mach_i960_xa:
+ case bfd_mach_i960_ca:
+ case bfd_mach_i960_ka_sa:
+ case bfd_mach_i960_jx:
+ case bfd_mach_i960_hx:
+ case 0:
+ return TRUE;
+ default:
+ return FALSE;
+ }
+
+ return FALSE;
+}
+
+static int
+b_out_sizeof_headers (ignore_abfd, ignore)
+ bfd *ignore_abfd ATTRIBUTE_UNUSED;
+ bfd_boolean ignore ATTRIBUTE_UNUSED;
+{
+ return sizeof (struct internal_exec);
+}
+
+
+static bfd_vma
+get_value (reloc, link_info, input_section)
+ arelent *reloc;
+ struct bfd_link_info *link_info;
+ asection *input_section;
+{
+ bfd_vma value;
+ asymbol *symbol = *(reloc->sym_ptr_ptr);
+
+ /* A symbol holds a pointer to a section, and an offset from the
+ base of the section. To relocate, we find where the section will
+ live in the output and add that in. */
+ if (bfd_is_und_section (symbol->section))
+ {
+ struct bfd_link_hash_entry *h;
+
+ /* The symbol is undefined in this BFD. Look it up in the
+ global linker hash table. FIXME: This should be changed when
+ we convert b.out to use a specific final_link function and
+ change the interface to bfd_relax_section to not require the
+ generic symbols. */
+ h = bfd_wrapped_link_hash_lookup (input_section->owner, link_info,
+ bfd_asymbol_name (symbol),
+ FALSE, FALSE, TRUE);
+ if (h != (struct bfd_link_hash_entry *) NULL
+ && (h->type == bfd_link_hash_defined
+ || h->type == bfd_link_hash_defweak))
+ value = h->u.def.value + output_addr (h->u.def.section);
+ else if (h != (struct bfd_link_hash_entry *) NULL
+ && h->type == bfd_link_hash_common)
+ value = h->u.c.size;
+ else
+ {
+ if (! ((*link_info->callbacks->undefined_symbol)
+ (link_info, bfd_asymbol_name (symbol),
+ input_section->owner, input_section, reloc->address,
+ TRUE)))
+ abort ();
+ value = 0;
+ }
+ }
+ else
+ {
+ value = symbol->value + output_addr (symbol->section);
+ }
+
+ /* Add the value contained in the relocation. */
+ value += reloc->addend;
+
+ return value;
+}
+
+static void
+perform_slip (abfd, slip, input_section, value)
+ bfd *abfd;
+ unsigned int slip;
+ asection *input_section;
+ bfd_vma value;
+{
+ asymbol **s;
+
+ s = _bfd_generic_link_get_symbols (abfd);
+ BFD_ASSERT (s != (asymbol **) NULL);
+
+ /* Find all symbols past this point, and make them know
+ what's happened. */
+ while (*s)
+ {
+ asymbol *p = *s;
+
+ if (p->section == input_section)
+ {
+ /* This was pointing into this section, so mangle it. */
+ if (p->value > value)
+ {
+ p->value -=slip;
+
+ if (p->udata.p != NULL)
+ {
+ struct generic_link_hash_entry *h;
+
+ h = (struct generic_link_hash_entry *) p->udata.p;
+ BFD_ASSERT (h->root.type == bfd_link_hash_defined);
+ h->root.u.def.value -= slip;
+ BFD_ASSERT (h->root.u.def.value == p->value);
+ }
+ }
+ }
+ s++;
+ }
+}
+
+/* This routine works out if the thing we want to get to can be
+ reached with a 24bit offset instead of a 32 bit one.
+ If it can, then it changes the amode. */
+
+static int
+abs32code (abfd, input_section, r, shrink, link_info)
+ bfd *abfd;
+ asection *input_section;
+ arelent *r;
+ unsigned int shrink;
+ struct bfd_link_info *link_info;
+{
+ bfd_vma value = get_value (r, link_info, input_section);
+ bfd_vma dot = output_addr (input_section) + r->address;
+ bfd_vma gap;
+
+ /* See if the address we're looking at within 2^23 bytes of where
+ we are, if so then we can use a small branch rather than the
+ jump we were going to. */
+ gap = value - (dot - shrink);
+
+ if (-1 << 23 < (long)gap && (long)gap < 1 << 23)
+ {
+ /* Change the reloc type from 32bitcode possible 24, to 24bit
+ possible 32. */
+ r->howto = &howto_reloc_abs32codeshrunk;
+ /* The place to relc moves back by four bytes. */
+ r->address -=4;
+
+ /* This will be four bytes smaller in the long run. */
+ shrink += 4 ;
+ perform_slip (abfd, 4, input_section, r->address-shrink + 4);
+ }
+
+ return shrink;
+}
+
+static int
+aligncode (abfd, input_section, r, shrink)
+ bfd *abfd;
+ asection *input_section;
+ arelent *r;
+ unsigned int shrink;
+{
+ bfd_vma dot = output_addr (input_section) + r->address;
+ bfd_vma gap;
+ bfd_vma old_end;
+ bfd_vma new_end;
+ unsigned int shrink_delta;
+ int size = r->howto->size;
+
+ /* Reduce the size of the alignment so that it's still aligned but
+ smaller - the current size is already the same size as or bigger
+ than the alignment required. */
+
+ /* Calculate the first byte following the padding before we optimize. */
+ old_end = ((dot + size ) & ~size) + size+1;
+ /* Work out where the new end will be - remember that we're smaller
+ than we used to be. */
+ new_end = ((dot - shrink + size) & ~size);
+
+ /* This is the new end. */
+ gap = old_end - ((dot + size) & ~size);
+
+ shrink_delta = (old_end - new_end) - shrink;
+
+ if (shrink_delta)
+ {
+ /* Change the reloc so that it knows how far to align to. */
+ r->howto = howto_done_align_table + (r->howto - howto_align_table);
+
+ /* Encode the stuff into the addend - for future use we need to
+ know how big the reloc used to be. */
+ r->addend = old_end - dot + r->address;
+
+ /* This will be N bytes smaller in the long run, adjust all the symbols. */
+ perform_slip (abfd, shrink_delta, input_section, r->address - shrink);
+ shrink += shrink_delta;
+ }
+
+ return shrink;
+}
+
+static bfd_boolean
+b_out_bfd_relax_section (abfd, i, link_info, again)
+ bfd *abfd;
+ asection *i;
+ struct bfd_link_info *link_info;
+ bfd_boolean *again;
+{
+ /* Get enough memory to hold the stuff. */
+ bfd *input_bfd = i->owner;
+ asection *input_section = i;
+ unsigned int shrink = 0 ;
+ arelent **reloc_vector = NULL;
+ long reloc_size = bfd_get_reloc_upper_bound (input_bfd,
+ input_section);
+
+ if (reloc_size < 0)
+ return FALSE;
+
+ /* We only run this relaxation once. It might work to run it
+ multiple times, but it hasn't been tested. */
+ *again = FALSE;
+
+ if (reloc_size)
+ {
+ long reloc_count;
+
+ reloc_vector = (arelent **) bfd_malloc ((bfd_size_type) reloc_size);
+ if (reloc_vector == NULL && reloc_size != 0)
+ goto error_return;
+
+ /* Get the relocs and think about them. */
+ reloc_count =
+ bfd_canonicalize_reloc (input_bfd, input_section, reloc_vector,
+ _bfd_generic_link_get_symbols (input_bfd));
+ if (reloc_count < 0)
+ goto error_return;
+ if (reloc_count > 0)
+ {
+ arelent **parent;
+
+ for (parent = reloc_vector; *parent; parent++)
+ {
+ arelent *r = *parent;
+
+ switch (r->howto->type)
+ {
+ case ALIGNER:
+ /* An alignment reloc. */
+ shrink = aligncode (abfd, input_section, r, shrink);
+ break;
+ case ABS32CODE:
+ /* A 32bit reloc in an addressing mode. */
+ shrink = abs32code (input_bfd, input_section, r, shrink,
+ link_info);
+ break;
+ case ABS32CODE_SHRUNK:
+ shrink += 4;
+ break;
+ }
+ }
+ }
+ }
+ input_section->_cooked_size = input_section->_raw_size - shrink;
+
+ if (reloc_vector != NULL)
+ free (reloc_vector);
+ return TRUE;
+ error_return:
+ if (reloc_vector != NULL)
+ free (reloc_vector);
+ return FALSE;
+}
+
+static bfd_byte *
+b_out_bfd_get_relocated_section_contents (output_bfd, link_info, link_order,
+ data, relocatable, symbols)
+ bfd *output_bfd;
+ struct bfd_link_info *link_info;
+ struct bfd_link_order *link_order;
+ bfd_byte *data;
+ bfd_boolean relocatable;
+ asymbol **symbols;
+{
+ /* Get enough memory to hold the stuff. */
+ bfd *input_bfd = link_order->u.indirect.section->owner;
+ asection *input_section = link_order->u.indirect.section;
+ long reloc_size = bfd_get_reloc_upper_bound (input_bfd,
+ input_section);
+ arelent **reloc_vector = NULL;
+ long reloc_count;
+
+ if (reloc_size < 0)
+ goto error_return;
+
+ /* If producing relocatable output, don't bother to relax. */
+ if (relocatable)
+ return bfd_generic_get_relocated_section_contents (output_bfd, link_info,
+ link_order,
+ data, relocatable,
+ symbols);
+
+ reloc_vector = (arelent **) bfd_malloc ((bfd_size_type) reloc_size);
+ if (reloc_vector == NULL && reloc_size != 0)
+ goto error_return;
+
+ input_section->reloc_done = 1;
+
+ /* Read in the section. */
+ BFD_ASSERT (bfd_get_section_contents (input_bfd,
+ input_section,
+ data,
+ (bfd_vma) 0,
+ input_section->_raw_size));
+
+ reloc_count = bfd_canonicalize_reloc (input_bfd,
+ input_section,
+ reloc_vector,
+ symbols);
+ if (reloc_count < 0)
+ goto error_return;
+ if (reloc_count > 0)
+ {
+ arelent **parent = reloc_vector;
+ arelent *reloc ;
+ unsigned int dst_address = 0;
+ unsigned int src_address = 0;
+ unsigned int run;
+ unsigned int idx;
+
+ /* Find how long a run we can do. */
+ while (dst_address < link_order->size)
+ {
+ reloc = *parent;
+ if (reloc)
+ {
+ /* Note that the relaxing didn't tie up the addresses in the
+ relocation, so we use the original address to work out the
+ run of non-relocated data. */
+ BFD_ASSERT (reloc->address >= src_address);
+ run = reloc->address - src_address;
+ parent++;
+ }
+ else
+ {
+ run = link_order->size - dst_address;
+ }
+
+ /* Copy the bytes. */
+ for (idx = 0; idx < run; idx++)
+ data[dst_address++] = data[src_address++];
+
+ /* Now do the relocation. */
+ if (reloc)
+ {
+ switch (reloc->howto->type)
+ {
+ case ABS32CODE:
+ calljx_callback (input_bfd, link_info, reloc,
+ src_address + data, dst_address + data,
+ input_section);
+ src_address += 4;
+ dst_address += 4;
+ break;
+ case ABS32:
+ bfd_put_32 (input_bfd,
+ (bfd_get_32 (input_bfd, data + src_address)
+ + get_value (reloc, link_info, input_section)),
+ data + dst_address);
+ src_address += 4;
+ dst_address += 4;
+ break;
+ case CALLJ:
+ callj_callback (input_bfd, link_info, reloc, data,
+ src_address, dst_address, input_section,
+ FALSE);
+ src_address += 4;
+ dst_address += 4;
+ break;
+ case ALIGNDONE:
+ BFD_ASSERT (reloc->addend >= src_address);
+ BFD_ASSERT ((bfd_vma) reloc->addend
+ <= input_section->_raw_size);
+ src_address = reloc->addend;
+ dst_address = ((dst_address + reloc->howto->size)
+ & ~reloc->howto->size);
+ break;
+ case ABS32CODE_SHRUNK:
+ /* This used to be a callx, but we've found out that a
+ callj will reach, so do the right thing. */
+ callj_callback (input_bfd, link_info, reloc, data,
+ src_address + 4, dst_address, input_section,
+ TRUE);
+ dst_address += 4;
+ src_address += 8;
+ break;
+ case PCREL24:
+ {
+ long int word = bfd_get_32 (input_bfd,
+ data + src_address);
+ bfd_vma value;
+
+ value = get_value (reloc, link_info, input_section);
+ word = ((word & ~BAL_MASK)
+ | (((word & BAL_MASK)
+ + value
+ - output_addr (input_section)
+ + reloc->addend)
+ & BAL_MASK));
+
+ bfd_put_32 (input_bfd, (bfd_vma) word, data + dst_address);
+ dst_address += 4;
+ src_address += 4;
+
+ }
+ break;
+ case PCREL13:
+ {
+ long int word = bfd_get_32 (input_bfd,
+ data + src_address);
+ bfd_vma value;
+
+ value = get_value (reloc, link_info, input_section);
+ word = ((word & ~PCREL13_MASK)
+ | (((word & PCREL13_MASK)
+ + value
+ + reloc->addend
+ - output_addr (input_section))
+ & PCREL13_MASK));
+
+ bfd_put_32 (input_bfd, (bfd_vma) word, data + dst_address);
+ dst_address += 4;
+ src_address += 4;
+ }
+ break;
+
+ default:
+ abort ();
+ }
+ }
+ }
+ }
+ if (reloc_vector != NULL)
+ free (reloc_vector);
+ return data;
+ error_return:
+ if (reloc_vector != NULL)
+ free (reloc_vector);
+ return NULL;
+}
+
+
+/* Build the transfer vectors for Big and Little-Endian B.OUT files. */
+
+#define aout_32_bfd_make_debug_symbol _bfd_nosymbols_bfd_make_debug_symbol
+#define aout_32_close_and_cleanup aout_32_bfd_free_cached_info
+
+#define b_out_bfd_link_hash_table_create _bfd_generic_link_hash_table_create
+#define b_out_bfd_link_hash_table_free _bfd_generic_link_hash_table_free
+#define b_out_bfd_link_add_symbols _bfd_generic_link_add_symbols
+#define b_out_bfd_link_just_syms _bfd_generic_link_just_syms
+#define b_out_bfd_final_link _bfd_generic_final_link
+#define b_out_bfd_link_split_section _bfd_generic_link_split_section
+#define b_out_bfd_gc_sections bfd_generic_gc_sections
+#define b_out_bfd_merge_sections bfd_generic_merge_sections
+#define b_out_bfd_discard_group bfd_generic_discard_group
+
+#define aout_32_get_section_contents_in_window \
+ _bfd_generic_get_section_contents_in_window
+
+extern const bfd_target b_out_vec_little_host;
+
+const bfd_target b_out_vec_big_host =
+{
+ "b.out.big", /* name */
+ bfd_target_aout_flavour,
+ BFD_ENDIAN_LITTLE, /* data byte order is little */
+ BFD_ENDIAN_BIG, /* hdr byte order is big */
+ (HAS_RELOC | EXEC_P | /* object flags */
+ HAS_LINENO | HAS_DEBUG |
+ HAS_SYMS | HAS_LOCALS | WP_TEXT | BFD_IS_RELAXABLE ),
+ (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_CODE | SEC_DATA),
+ '_', /* symbol leading char */
+ ' ', /* ar_pad_char */
+ 16, /* ar_max_namelen */
+
+ bfd_getl64, bfd_getl_signed_64, bfd_putl64,
+ bfd_getl32, bfd_getl_signed_32, bfd_putl32,
+ bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* data */
+ bfd_getb64, bfd_getb_signed_64, bfd_putb64,
+ bfd_getb32, bfd_getb_signed_32, bfd_putb32,
+ bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* hdrs */
+ {_bfd_dummy_target, b_out_object_p, /* bfd_check_format */
+ bfd_generic_archive_p, _bfd_dummy_target},
+ {bfd_false, b_out_mkobject, /* bfd_set_format */
+ _bfd_generic_mkarchive, bfd_false},
+ {bfd_false, b_out_write_object_contents, /* bfd_write_contents */
+ _bfd_write_archive_contents, bfd_false},
+
+ BFD_JUMP_TABLE_GENERIC (aout_32),
+ BFD_JUMP_TABLE_COPY (_bfd_generic),
+ BFD_JUMP_TABLE_CORE (_bfd_nocore),
+ BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_bsd),
+ BFD_JUMP_TABLE_SYMBOLS (aout_32),
+ BFD_JUMP_TABLE_RELOCS (b_out),
+ BFD_JUMP_TABLE_WRITE (b_out),
+ BFD_JUMP_TABLE_LINK (b_out),
+ BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
+
+ & b_out_vec_little_host,
+
+ (PTR) 0,
+};
+
+const bfd_target b_out_vec_little_host =
+{
+ "b.out.little", /* name */
+ bfd_target_aout_flavour,
+ BFD_ENDIAN_LITTLE, /* data byte order is little */
+ BFD_ENDIAN_LITTLE, /* header byte order is little */
+ (HAS_RELOC | EXEC_P | /* object flags */
+ HAS_LINENO | HAS_DEBUG |
+ HAS_SYMS | HAS_LOCALS | WP_TEXT | BFD_IS_RELAXABLE ),
+ (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_CODE | SEC_DATA),
+ '_', /* symbol leading char */
+ ' ', /* ar_pad_char */
+ 16, /* ar_max_namelen */
+ bfd_getl64, bfd_getl_signed_64, bfd_putl64,
+ bfd_getl32, bfd_getl_signed_32, bfd_putl32,
+ bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* data */
+ bfd_getl64, bfd_getl_signed_64, bfd_putl64,
+ bfd_getl32, bfd_getl_signed_32, bfd_putl32,
+ bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* hdrs */
+
+ {_bfd_dummy_target, b_out_object_p, /* bfd_check_format */
+ bfd_generic_archive_p, _bfd_dummy_target},
+ {bfd_false, b_out_mkobject, /* bfd_set_format */
+ _bfd_generic_mkarchive, bfd_false},
+ {bfd_false, b_out_write_object_contents, /* bfd_write_contents */
+ _bfd_write_archive_contents, bfd_false},
+
+ BFD_JUMP_TABLE_GENERIC (aout_32),
+ BFD_JUMP_TABLE_COPY (_bfd_generic),
+ BFD_JUMP_TABLE_CORE (_bfd_nocore),
+ BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_bsd),
+ BFD_JUMP_TABLE_SYMBOLS (aout_32),
+ BFD_JUMP_TABLE_RELOCS (b_out),
+ BFD_JUMP_TABLE_WRITE (b_out),
+ BFD_JUMP_TABLE_LINK (b_out),
+ BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
+
+ & b_out_vec_big_host,
+
+ (PTR) 0
+};
diff --git a/contrib/binutils/bfd/cache.c b/contrib/binutils/bfd/cache.c
index df01a1f..7d056ea 100644
--- a/contrib/binutils/bfd/cache.c
+++ b/contrib/binutils/bfd/cache.c
@@ -1,6 +1,8 @@
/* BFD library -- caching of file descriptors.
- Copyright 1990, 1991, 1992, 1993, 1994, 1996, 2000, 2001, 2002
- Free Software Foundation, Inc.
+
+ Copyright 1990, 1991, 1992, 1993, 1994, 1996, 2000, 2001, 2002,
+ 2003, 2004 Free Software Foundation, Inc.
+
Hacked by Steve Chamberlain of Cygnus Support (steve@cygnus.com).
This file is part of BFD, the Binary File Descriptor library.
@@ -40,10 +42,7 @@ SECTION
#include "sysdep.h"
#include "libbfd.h"
-static void insert PARAMS ((bfd *));
-static void snip PARAMS ((bfd *));
-static boolean close_one PARAMS ((void));
-static boolean bfd_cache_delete PARAMS ((bfd *));
+static bfd_boolean bfd_cache_delete (bfd *);
/*
INTERNAL_FUNCTION
@@ -95,9 +94,8 @@ bfd *bfd_last_cache;
/* Insert a BFD into the cache. */
-static INLINE void
-insert (abfd)
- bfd *abfd;
+static void
+insert (bfd *abfd)
{
if (bfd_last_cache == NULL)
{
@@ -116,9 +114,8 @@ insert (abfd)
/* Remove a BFD from the cache. */
-static INLINE void
-snip (abfd)
- bfd *abfd;
+static void
+snip (bfd *abfd)
{
abfd->lru_prev->lru_next = abfd->lru_next;
abfd->lru_next->lru_prev = abfd->lru_prev;
@@ -133,8 +130,8 @@ snip (abfd)
/* We need to open a new file, and the cache is full. Find the least
recently used cacheable BFD and close it. */
-static boolean
-close_one ()
+static bfd_boolean
+close_one (void)
{
register bfd *kill;
@@ -157,27 +154,26 @@ close_one ()
if (kill == NULL)
{
/* There are no open cacheable BFD's. */
- return true;
+ return TRUE;
}
- kill->where = ftell ((FILE *) kill->iostream);
+ kill->where = real_ftell ((FILE *) kill->iostream);
return bfd_cache_delete (kill);
}
/* Close a BFD and remove it from the cache. */
-static boolean
-bfd_cache_delete (abfd)
- bfd *abfd;
+static bfd_boolean
+bfd_cache_delete (bfd *abfd)
{
- boolean ret;
+ bfd_boolean ret;
if (fclose ((FILE *) abfd->iostream) == 0)
- ret = true;
+ ret = TRUE;
else
{
- ret = false;
+ ret = FALSE;
bfd_set_error (bfd_error_system_call);
}
@@ -194,25 +190,24 @@ INTERNAL_FUNCTION
bfd_cache_init
SYNOPSIS
- boolean bfd_cache_init (bfd *abfd);
+ bfd_boolean bfd_cache_init (bfd *abfd);
DESCRIPTION
Add a newly opened BFD to the cache.
*/
-boolean
-bfd_cache_init (abfd)
- bfd *abfd;
+bfd_boolean
+bfd_cache_init (bfd *abfd)
{
BFD_ASSERT (abfd->iostream != NULL);
if (open_files >= BFD_CACHE_MAX_OPEN)
{
if (! close_one ())
- return false;
+ return FALSE;
}
insert (abfd);
++open_files;
- return true;
+ return TRUE;
}
/*
@@ -220,24 +215,23 @@ INTERNAL_FUNCTION
bfd_cache_close
SYNOPSIS
- boolean bfd_cache_close (bfd *abfd);
+ bfd_boolean bfd_cache_close (bfd *abfd);
DESCRIPTION
Remove the BFD @var{abfd} from the cache. If the attached file is open,
then close it too.
RETURNS
- <<false>> is returned if closing the file fails, <<true>> is
+ <<FALSE>> is returned if closing the file fails, <<TRUE>> is
returned if all is well.
*/
-boolean
-bfd_cache_close (abfd)
- bfd *abfd;
+bfd_boolean
+bfd_cache_close (bfd *abfd)
{
if (abfd->iostream == NULL
|| (abfd->flags & BFD_IN_MEMORY) != 0)
- return true;
+ return TRUE;
return bfd_cache_delete (abfd);
}
@@ -247,7 +241,7 @@ INTERNAL_FUNCTION
bfd_open_file
SYNOPSIS
- FILE* bfd_open_file(bfd *abfd);
+ FILE* bfd_open_file (bfd *abfd);
DESCRIPTION
Call the OS to open a file for @var{abfd}. Return the <<FILE *>>
@@ -258,10 +252,9 @@ DESCRIPTION
*/
FILE *
-bfd_open_file (abfd)
- bfd *abfd;
+bfd_open_file (bfd *abfd)
{
- abfd->cacheable = true; /* Allow it to be closed later. */
+ abfd->cacheable = TRUE; /* Allow it to be closed later. */
if (open_files >= BFD_CACHE_MAX_OPEN)
{
@@ -312,7 +305,7 @@ bfd_open_file (abfd)
unlink (abfd->filename);
#endif
abfd->iostream = (PTR) fopen (abfd->filename, FOPEN_WUB);
- abfd->opened_once = true;
+ abfd->opened_once = TRUE;
}
break;
}
@@ -331,7 +324,7 @@ INTERNAL_FUNCTION
bfd_cache_lookup_worker
SYNOPSIS
- FILE *bfd_cache_lookup_worker(bfd *abfd);
+ FILE *bfd_cache_lookup_worker (bfd *abfd);
DESCRIPTION
Called when the macro <<bfd_cache_lookup>> fails to find a
@@ -342,8 +335,7 @@ DESCRIPTION
*/
FILE *
-bfd_cache_lookup_worker (abfd)
- bfd *abfd;
+bfd_cache_lookup_worker (bfd *abfd)
{
if ((abfd->flags & BFD_IN_MEMORY) != 0)
abort ();
@@ -366,7 +358,7 @@ bfd_cache_lookup_worker (abfd)
return NULL;
if (abfd->where != (unsigned long) abfd->where)
return NULL;
- if (fseek ((FILE *) abfd->iostream, (long) abfd->where, SEEK_SET) != 0)
+ if (real_fseek ((FILE *) abfd->iostream, abfd->where, SEEK_SET) != 0)
return NULL;
}
diff --git a/contrib/binutils/bfd/coff-alpha.c b/contrib/binutils/bfd/coff-alpha.c
index 6d5ac17..e9dd416 100644
--- a/contrib/binutils/bfd/coff-alpha.c
+++ b/contrib/binutils/bfd/coff-alpha.c
@@ -1,5 +1,5 @@
/* BFD back-end for ALPHA Extended-Coff files.
- Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
+ Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
Free Software Foundation, Inc.
Modified from coff-mips.c by Steve Chamberlain <sac@cygnus.com> and
Ian Lance Taylor <ian@cygnus.com>.
@@ -35,36 +35,40 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
/* Prototypes for static functions. */
-static const bfd_target *alpha_ecoff_object_p PARAMS ((bfd *));
-static boolean alpha_ecoff_bad_format_hook PARAMS ((bfd *abfd, PTR filehdr));
-static PTR alpha_ecoff_mkobject_hook PARAMS ((bfd *, PTR filehdr, PTR aouthdr));
-static void alpha_ecoff_swap_reloc_in PARAMS ((bfd *, PTR,
- struct internal_reloc *));
-static void alpha_ecoff_swap_reloc_out PARAMS ((bfd *,
- const struct internal_reloc *,
- PTR));
-static void alpha_adjust_reloc_in PARAMS ((bfd *,
- const struct internal_reloc *,
- arelent *));
-static void alpha_adjust_reloc_out PARAMS ((bfd *, const arelent *,
- struct internal_reloc *));
+static const bfd_target *alpha_ecoff_object_p
+ PARAMS ((bfd *));
+static bfd_boolean alpha_ecoff_bad_format_hook
+ PARAMS ((bfd *abfd, PTR filehdr));
+static PTR alpha_ecoff_mkobject_hook
+ PARAMS ((bfd *, PTR filehdr, PTR aouthdr));
+static void alpha_ecoff_swap_reloc_in
+ PARAMS ((bfd *, PTR, struct internal_reloc *));
+static void alpha_ecoff_swap_reloc_out
+ PARAMS ((bfd *, const struct internal_reloc *, PTR));
+static void alpha_adjust_reloc_in
+ PARAMS ((bfd *, const struct internal_reloc *, arelent *));
+static void alpha_adjust_reloc_out
+ PARAMS ((bfd *, const arelent *, struct internal_reloc *));
static reloc_howto_type *alpha_bfd_reloc_type_lookup
- PARAMS ((bfd *, bfd_reloc_code_real_type));
+ PARAMS ((bfd *, bfd_reloc_code_real_type));
static bfd_byte *alpha_ecoff_get_relocated_section_contents
PARAMS ((bfd *abfd, struct bfd_link_info *, struct bfd_link_order *,
- bfd_byte *data, boolean relocateable, asymbol **symbols));
+ bfd_byte *data, bfd_boolean relocatable, asymbol **symbols));
static bfd_vma alpha_convert_external_reloc
PARAMS ((bfd *, struct bfd_link_info *, bfd *, struct external_reloc *,
struct ecoff_link_hash_entry *));
-static boolean alpha_relocate_section PARAMS ((bfd *, struct bfd_link_info *,
- bfd *, asection *,
- bfd_byte *, PTR));
-static boolean alpha_adjust_headers
+static bfd_boolean alpha_relocate_section
+ PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *, PTR));
+static bfd_boolean alpha_adjust_headers
PARAMS ((bfd *, struct internal_filehdr *, struct internal_aouthdr *));
-static PTR alpha_ecoff_read_ar_hdr PARAMS ((bfd *));
-static bfd *alpha_ecoff_get_elt_at_filepos PARAMS ((bfd *, file_ptr));
-static bfd *alpha_ecoff_openr_next_archived_file PARAMS ((bfd *, bfd *));
-static bfd *alpha_ecoff_get_elt_at_index PARAMS ((bfd *, symindex));
+static PTR alpha_ecoff_read_ar_hdr
+ PARAMS ((bfd *));
+static bfd *alpha_ecoff_get_elt_at_filepos
+ PARAMS ((bfd *, file_ptr));
+static bfd *alpha_ecoff_openr_next_archived_file
+ PARAMS ((bfd *, bfd *));
+static bfd *alpha_ecoff_get_elt_at_index
+ PARAMS ((bfd *, symindex));
/* ECOFF has COFF sections, but the debugging information is stored in
a completely different format. ECOFF targets use some of the
@@ -122,9 +126,8 @@ static bfd *alpha_ecoff_get_elt_at_index PARAMS ((bfd *, symindex));
/* How to process the various reloc types. */
-static bfd_reloc_status_type
-reloc_nil PARAMS ((bfd *, arelent *, asymbol *, PTR,
- asection *, bfd *, char **));
+static bfd_reloc_status_type reloc_nil
+ PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
static bfd_reloc_status_type
reloc_nil (abfd, reloc, sym, data, sec, output_bfd, error_message)
@@ -152,45 +155,45 @@ static reloc_howto_type alpha_howto_table[] =
0, /* rightshift */
0, /* size (0 = byte, 1 = short, 2 = long) */
8, /* bitsize */
- true, /* pc_relative */
+ TRUE, /* pc_relative */
0, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
reloc_nil, /* special_function */
"IGNORE", /* name */
- true, /* partial_inplace */
+ TRUE, /* partial_inplace */
0, /* src_mask */
0, /* dst_mask */
- true), /* pcrel_offset */
+ TRUE), /* pcrel_offset */
/* A 32 bit reference to a symbol. */
HOWTO (ALPHA_R_REFLONG, /* type */
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
32, /* bitsize */
- false, /* pc_relative */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
0, /* special_function */
"REFLONG", /* name */
- true, /* partial_inplace */
+ TRUE, /* partial_inplace */
0xffffffff, /* src_mask */
0xffffffff, /* dst_mask */
- false), /* pcrel_offset */
+ FALSE), /* pcrel_offset */
/* A 64 bit reference to a symbol. */
HOWTO (ALPHA_R_REFQUAD, /* type */
0, /* rightshift */
4, /* size (0 = byte, 1 = short, 2 = long) */
64, /* bitsize */
- false, /* pc_relative */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
0, /* special_function */
"REFQUAD", /* name */
- true, /* partial_inplace */
+ TRUE, /* partial_inplace */
MINUS_ONE, /* src_mask */
MINUS_ONE, /* dst_mask */
- false), /* pcrel_offset */
+ FALSE), /* pcrel_offset */
/* A 32 bit GP relative offset. This is just like REFLONG except
that when the value is used the value of the gp register will be
@@ -199,15 +202,15 @@ static reloc_howto_type alpha_howto_table[] =
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
32, /* bitsize */
- false, /* pc_relative */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
0, /* special_function */
"GPREL32", /* name */
- true, /* partial_inplace */
+ TRUE, /* partial_inplace */
0xffffffff, /* src_mask */
0xffffffff, /* dst_mask */
- false), /* pcrel_offset */
+ FALSE), /* pcrel_offset */
/* Used for an instruction that refers to memory off the GP
register. The offset is 16 bits of the 32 bit instruction. This
@@ -216,15 +219,15 @@ static reloc_howto_type alpha_howto_table[] =
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
16, /* bitsize */
- false, /* pc_relative */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_signed, /* complain_on_overflow */
0, /* special_function */
"LITERAL", /* name */
- true, /* partial_inplace */
+ TRUE, /* partial_inplace */
0xffff, /* src_mask */
0xffff, /* dst_mask */
- false), /* pcrel_offset */
+ FALSE), /* pcrel_offset */
/* This reloc only appears immediately following a LITERAL reloc.
It identifies a use of the literal. It seems that the linker can
@@ -239,15 +242,15 @@ static reloc_howto_type alpha_howto_table[] =
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
32, /* bitsize */
- false, /* pc_relative */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
reloc_nil, /* special_function */
"LITUSE", /* name */
- false, /* partial_inplace */
+ FALSE, /* partial_inplace */
0, /* src_mask */
0, /* dst_mask */
- false), /* pcrel_offset */
+ FALSE), /* pcrel_offset */
/* Load the gp register. This is always used for a ldah instruction
which loads the upper 16 bits of the gp register. The next reloc
@@ -264,15 +267,15 @@ static reloc_howto_type alpha_howto_table[] =
16, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
16, /* bitsize */
- true, /* pc_relative */
+ TRUE, /* pc_relative */
0, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
reloc_nil, /* special_function */
"GPDISP", /* name */
- true, /* partial_inplace */
+ TRUE, /* partial_inplace */
0xffff, /* src_mask */
0xffff, /* dst_mask */
- true), /* pcrel_offset */
+ TRUE), /* pcrel_offset */
/* A 21 bit branch. The native assembler generates these for
branches within the text segment, and also fills in the PC
@@ -281,90 +284,90 @@ static reloc_howto_type alpha_howto_table[] =
2, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
21, /* bitsize */
- true, /* pc_relative */
+ TRUE, /* pc_relative */
0, /* bitpos */
complain_overflow_signed, /* complain_on_overflow */
0, /* special_function */
"BRADDR", /* name */
- true, /* partial_inplace */
+ TRUE, /* partial_inplace */
0x1fffff, /* src_mask */
0x1fffff, /* dst_mask */
- false), /* pcrel_offset */
+ FALSE), /* pcrel_offset */
/* A hint for a jump to a register. */
HOWTO (ALPHA_R_HINT, /* type */
2, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
14, /* bitsize */
- true, /* pc_relative */
+ TRUE, /* pc_relative */
0, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
0, /* special_function */
"HINT", /* name */
- true, /* partial_inplace */
+ TRUE, /* partial_inplace */
0x3fff, /* src_mask */
0x3fff, /* dst_mask */
- false), /* pcrel_offset */
+ FALSE), /* pcrel_offset */
/* 16 bit PC relative offset. */
HOWTO (ALPHA_R_SREL16, /* type */
0, /* rightshift */
1, /* size (0 = byte, 1 = short, 2 = long) */
16, /* bitsize */
- true, /* pc_relative */
+ TRUE, /* pc_relative */
0, /* bitpos */
complain_overflow_signed, /* complain_on_overflow */
0, /* special_function */
"SREL16", /* name */
- true, /* partial_inplace */
+ TRUE, /* partial_inplace */
0xffff, /* src_mask */
0xffff, /* dst_mask */
- false), /* pcrel_offset */
+ FALSE), /* pcrel_offset */
/* 32 bit PC relative offset. */
HOWTO (ALPHA_R_SREL32, /* type */
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
32, /* bitsize */
- true, /* pc_relative */
+ TRUE, /* pc_relative */
0, /* bitpos */
complain_overflow_signed, /* complain_on_overflow */
0, /* special_function */
"SREL32", /* name */
- true, /* partial_inplace */
+ TRUE, /* partial_inplace */
0xffffffff, /* src_mask */
0xffffffff, /* dst_mask */
- false), /* pcrel_offset */
+ FALSE), /* pcrel_offset */
/* A 64 bit PC relative offset. */
HOWTO (ALPHA_R_SREL64, /* type */
0, /* rightshift */
4, /* size (0 = byte, 1 = short, 2 = long) */
64, /* bitsize */
- true, /* pc_relative */
+ TRUE, /* pc_relative */
0, /* bitpos */
complain_overflow_signed, /* complain_on_overflow */
0, /* special_function */
"SREL64", /* name */
- true, /* partial_inplace */
+ TRUE, /* partial_inplace */
MINUS_ONE, /* src_mask */
MINUS_ONE, /* dst_mask */
- false), /* pcrel_offset */
+ FALSE), /* pcrel_offset */
/* Push a value on the reloc evaluation stack. */
HOWTO (ALPHA_R_OP_PUSH, /* type */
0, /* rightshift */
0, /* size (0 = byte, 1 = short, 2 = long) */
0, /* bitsize */
- false, /* pc_relative */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
0, /* special_function */
"OP_PUSH", /* name */
- false, /* partial_inplace */
+ FALSE, /* partial_inplace */
0, /* src_mask */
0, /* dst_mask */
- false), /* pcrel_offset */
+ FALSE), /* pcrel_offset */
/* Store the value from the stack at the given address. Store it in
a bitfield of size r_size starting at bit position r_offset. */
@@ -372,15 +375,15 @@ static reloc_howto_type alpha_howto_table[] =
0, /* rightshift */
4, /* size (0 = byte, 1 = short, 2 = long) */
64, /* bitsize */
- false, /* pc_relative */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
0, /* special_function */
"OP_STORE", /* name */
- false, /* partial_inplace */
+ FALSE, /* partial_inplace */
0, /* src_mask */
MINUS_ONE, /* dst_mask */
- false), /* pcrel_offset */
+ FALSE), /* pcrel_offset */
/* Subtract the reloc address from the value on the top of the
relocation stack. */
@@ -388,15 +391,15 @@ static reloc_howto_type alpha_howto_table[] =
0, /* rightshift */
0, /* size (0 = byte, 1 = short, 2 = long) */
0, /* bitsize */
- false, /* pc_relative */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
0, /* special_function */
"OP_PSUB", /* name */
- false, /* partial_inplace */
+ FALSE, /* partial_inplace */
0, /* src_mask */
0, /* dst_mask */
- false), /* pcrel_offset */
+ FALSE), /* pcrel_offset */
/* Shift the value on the top of the relocation stack right by the
given value. */
@@ -404,30 +407,30 @@ static reloc_howto_type alpha_howto_table[] =
0, /* rightshift */
0, /* size (0 = byte, 1 = short, 2 = long) */
0, /* bitsize */
- false, /* pc_relative */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
0, /* special_function */
"OP_PRSHIFT", /* name */
- false, /* partial_inplace */
+ FALSE, /* partial_inplace */
0, /* src_mask */
0, /* dst_mask */
- false), /* pcrel_offset */
+ FALSE), /* pcrel_offset */
/* Adjust the GP value for a new range in the object file. */
HOWTO (ALPHA_R_GPVALUE, /* type */
0, /* rightshift */
0, /* size (0 = byte, 1 = short, 2 = long) */
0, /* bitsize */
- false, /* pc_relative */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
0, /* special_function */
"GPVALUE", /* name */
- false, /* partial_inplace */
+ FALSE, /* partial_inplace */
0, /* src_mask */
0, /* dst_mask */
- false) /* pcrel_offset */
+ FALSE) /* pcrel_offset */
};
/* Recognize an Alpha ECOFF file. */
@@ -471,7 +474,7 @@ alpha_ecoff_object_p (abfd)
/* See whether the magic number matches. */
-static boolean
+static bfd_boolean
alpha_ecoff_bad_format_hook (abfd, filehdr)
bfd *abfd ATTRIBUTE_UNUSED;
PTR filehdr;
@@ -479,9 +482,9 @@ alpha_ecoff_bad_format_hook (abfd, filehdr)
struct internal_filehdr *internal_f = (struct internal_filehdr *) filehdr;
if (ALPHA_ECOFF_BADMAG (*internal_f))
- return false;
+ return FALSE;
- return true;
+ return TRUE;
}
/* This is a hook called by coff_real_object_p to create any backend
@@ -750,12 +753,12 @@ alpha_adjust_reloc_out (abfd, rel, intern)
static bfd_byte *
alpha_ecoff_get_relocated_section_contents (abfd, link_info, link_order,
- data, relocateable, symbols)
+ data, relocatable, symbols)
bfd *abfd;
struct bfd_link_info *link_info;
struct bfd_link_order *link_order;
bfd_byte *data;
- boolean relocateable;
+ bfd_boolean relocatable;
asymbol **symbols;
{
bfd *input_bfd = link_order->u.indirect.section->owner;
@@ -763,9 +766,9 @@ alpha_ecoff_get_relocated_section_contents (abfd, link_info, link_order,
long reloc_size = bfd_get_reloc_upper_bound (input_bfd, input_section);
arelent **reloc_vector = NULL;
long reloc_count;
- bfd *output_bfd = relocateable ? abfd : (bfd *) NULL;
+ bfd *output_bfd = relocatable ? abfd : (bfd *) NULL;
bfd_vma gp;
- boolean gp_undefined;
+ bfd_boolean gp_undefined;
bfd_vma stack[RELOC_STACKSIZE];
int tos = 0;
@@ -781,7 +784,7 @@ alpha_ecoff_get_relocated_section_contents (abfd, link_info, link_order,
/* The section size is not going to change. */
input_section->_cooked_size = input_section->_raw_size;
- input_section->reloc_done = true;
+ input_section->reloc_done = TRUE;
reloc_count = bfd_canonicalize_reloc (input_bfd, input_section,
reloc_vector, symbols);
@@ -791,11 +794,11 @@ alpha_ecoff_get_relocated_section_contents (abfd, link_info, link_order,
goto successful_return;
/* Get the GP value for the output BFD. */
- gp_undefined = false;
+ gp_undefined = FALSE;
gp = _bfd_get_gp_value (abfd);
if (gp == 0)
{
- if (relocateable)
+ if (relocatable)
{
asection *sec;
bfd_vma lo;
@@ -819,11 +822,11 @@ alpha_ecoff_get_relocated_section_contents (abfd, link_info, link_order,
{
struct bfd_link_hash_entry *h;
- h = bfd_link_hash_lookup (link_info->hash, "_gp", false, false,
- true);
+ h = bfd_link_hash_lookup (link_info->hash, "_gp", FALSE, FALSE,
+ TRUE);
if (h == (struct bfd_link_hash_entry *) NULL
|| h->type != bfd_link_hash_defined)
- gp_undefined = true;
+ gp_undefined = TRUE;
else
{
gp = (h->u.def.value
@@ -855,7 +858,7 @@ alpha_ecoff_get_relocated_section_contents (abfd, link_info, link_order,
case ALPHA_R_SREL16:
case ALPHA_R_SREL32:
case ALPHA_R_SREL64:
- if (relocateable
+ if (relocatable
&& ((*rel->sym_ptr_ptr)->flags & BSF_SECTION_SYM) == 0)
{
rel->address += input_section->output_offset;
@@ -988,7 +991,7 @@ alpha_ecoff_get_relocated_section_contents (abfd, link_info, link_order,
asymbol *symbol;
bfd_vma relocation;
- if (relocateable)
+ if (relocatable)
{
rel->address += input_section->output_offset;
break;
@@ -1021,7 +1024,7 @@ alpha_ecoff_get_relocated_section_contents (abfd, link_info, link_order,
bfd_vma val;
int offset, size;
- if (relocateable)
+ if (relocatable)
{
rel->address += input_section->output_offset;
break;
@@ -1048,7 +1051,7 @@ alpha_ecoff_get_relocated_section_contents (abfd, link_info, link_order,
asymbol *symbol;
bfd_vma relocation;
- if (relocateable)
+ if (relocatable)
{
rel->address += input_section->output_offset;
break;
@@ -1081,7 +1084,7 @@ alpha_ecoff_get_relocated_section_contents (abfd, link_info, link_order,
asymbol *symbol;
bfd_vma relocation;
- if (relocateable)
+ if (relocatable)
{
rel->address += input_section->output_offset;
break;
@@ -1111,14 +1114,14 @@ alpha_ecoff_get_relocated_section_contents (abfd, link_info, link_order,
case ALPHA_R_GPVALUE:
/* I really don't know if this does the right thing. */
gp = rel->addend;
- gp_undefined = false;
+ gp_undefined = FALSE;
break;
default:
abort ();
}
- if (relocateable)
+ if (relocatable)
{
asection *os = input_section->output_section;
@@ -1134,7 +1137,7 @@ alpha_ecoff_get_relocated_section_contents (abfd, link_info, link_order,
case bfd_reloc_undefined:
if (! ((*link_info->callbacks->undefined_symbol)
(link_info, bfd_asymbol_name (*rel->sym_ptr_ptr),
- input_bfd, input_section, rel->address, true)))
+ input_bfd, input_section, rel->address, TRUE)))
goto error_return;
break;
case bfd_reloc_dangerous:
@@ -1245,7 +1248,7 @@ alpha_bfd_reloc_type_lookup (abfd, code)
}
/* A helper routine for alpha_relocate_section which converts an
- external reloc when generating relocateable output. Returns the
+ external reloc when generating relocatable output. Returns the
relocation amount. */
static bfd_vma
@@ -1259,7 +1262,7 @@ alpha_convert_external_reloc (output_bfd, info, input_bfd, ext_rel, h)
unsigned long r_symndx;
bfd_vma relocation;
- BFD_ASSERT (info->relocateable);
+ BFD_ASSERT (info->relocatable);
if (h->root.type == bfd_link_hash_defined
|| h->root.type == bfd_link_hash_defweak)
@@ -1365,7 +1368,7 @@ alpha_convert_external_reloc (output_bfd, info, input_bfd, ext_rel, h)
quite similar to get_relocated_section_contents. Perhaps they
could be combined somehow. */
-static boolean
+static bfd_boolean
alpha_relocate_section (output_bfd, info, input_bfd, input_section,
contents, external_relocs)
bfd *output_bfd;
@@ -1378,7 +1381,7 @@ alpha_relocate_section (output_bfd, info, input_bfd, input_section,
asection **symndx_to_section, *lita_sec;
struct ecoff_link_hash_entry **sym_hashes;
bfd_vma gp;
- boolean gp_undefined;
+ bfd_boolean gp_undefined;
bfd_vma stack[RELOC_STACKSIZE];
int tos = 0;
struct external_reloc *ext_rel;
@@ -1394,7 +1397,7 @@ alpha_relocate_section (output_bfd, info, input_bfd, input_section,
amt = NUM_RELOC_SECTIONS * sizeof (asection *);
symndx_to_section = (asection **) bfd_alloc (input_bfd, amt);
if (!symndx_to_section)
- return false;
+ return FALSE;
symndx_to_section[RELOC_SECTION_NONE] = NULL;
symndx_to_section[RELOC_SECTION_TEXT] =
@@ -1440,7 +1443,7 @@ alpha_relocate_section (output_bfd, info, input_bfd, input_section,
lita_sec = symndx_to_section[RELOC_SECTION_LITA];
gp = _bfd_get_gp_value (output_bfd);
- if (! info->relocateable && lita_sec != NULL)
+ if (! info->relocatable && lita_sec != NULL)
{
struct ecoff_section_tdata *lita_sec_data;
@@ -1485,7 +1488,7 @@ alpha_relocate_section (output_bfd, info, input_bfd, input_section,
_("using multiple gp values"),
(char *) NULL, output_bfd,
(asection *) NULL, (bfd_vma) 0);
- ecoff_data (output_bfd)->issued_multiple_gp_warning = true;
+ ecoff_data (output_bfd)->issued_multiple_gp_warning = TRUE;
}
if (lita_vma < gp - 0x8000)
gp = lita_vma + lita_size - 0x8000;
@@ -1515,9 +1518,9 @@ alpha_relocate_section (output_bfd, info, input_bfd, input_section,
int r_extern;
int r_offset;
int r_size;
- boolean relocatep;
- boolean adjust_addrp;
- boolean gp_usedp;
+ bfd_boolean relocatep;
+ bfd_boolean adjust_addrp;
+ bfd_boolean gp_usedp;
bfd_vma addend;
r_vaddr = H_GET_64 (input_bfd, ext_rel->r_vaddr);
@@ -1532,9 +1535,9 @@ alpha_relocate_section (output_bfd, info, input_bfd, input_section,
r_size = ((ext_rel->r_bits[3] & RELOC_BITS3_SIZE_LITTLE)
>> RELOC_BITS3_SIZE_SH_LITTLE);
- relocatep = false;
- adjust_addrp = true;
- gp_usedp = false;
+ relocatep = FALSE;
+ adjust_addrp = TRUE;
+ gp_usedp = FALSE;
addend = 0;
switch (r_type)
@@ -1549,16 +1552,16 @@ alpha_relocate_section (output_bfd, info, input_bfd, input_section,
not otherwise used for anything. For some reason, the
address of the relocation does not appear to include the
section VMA, unlike the other relocation types. */
- if (info->relocateable)
+ if (info->relocatable)
H_PUT_64 (input_bfd, input_section->output_offset + r_vaddr,
ext_rel->r_vaddr);
- adjust_addrp = false;
+ adjust_addrp = FALSE;
break;
case ALPHA_R_REFLONG:
case ALPHA_R_REFQUAD:
case ALPHA_R_HINT:
- relocatep = true;
+ relocatep = TRUE;
break;
case ALPHA_R_BRADDR:
@@ -1567,7 +1570,7 @@ alpha_relocate_section (output_bfd, info, input_bfd, input_section,
case ALPHA_R_SREL64:
if (r_extern)
addend += - (r_vaddr + 4);
- relocatep = true;
+ relocatep = TRUE;
break;
case ALPHA_R_GPREL32:
@@ -1575,9 +1578,9 @@ alpha_relocate_section (output_bfd, info, input_bfd, input_section,
bit offset from the current GP value. We must adjust it
by the different between the original GP value and the
current GP value. */
- relocatep = true;
+ relocatep = TRUE;
addend = ecoff_data (input_bfd)->gp - gp;
- gp_usedp = true;
+ gp_usedp = TRUE;
break;
case ALPHA_R_LITERAL:
@@ -1608,9 +1611,9 @@ alpha_relocate_section (output_bfd, info, input_bfd, input_section,
|| ((insn >> 26) & 0x3f) == 0x28);
}
- relocatep = true;
+ relocatep = TRUE;
addend = ecoff_data (input_bfd)->gp - gp;
- gp_usedp = true;
+ gp_usedp = TRUE;
break;
case ALPHA_R_LITUSE:
@@ -1674,7 +1677,7 @@ alpha_relocate_section (output_bfd, info, input_bfd, input_section,
bfd_put_32 (input_bfd, (bfd_vma) insn2,
contents + r_vaddr - input_section->vma + r_symndx);
- gp_usedp = true;
+ gp_usedp = TRUE;
}
break;
@@ -1702,7 +1705,7 @@ alpha_relocate_section (output_bfd, info, input_bfd, input_section,
if (h == (struct ecoff_link_hash_entry *) NULL)
abort ();
- if (! info->relocateable)
+ if (! info->relocatable)
{
if (h->root.type == bfd_link_hash_defined
|| h->root.type == bfd_link_hash_defweak)
@@ -1717,8 +1720,8 @@ alpha_relocate_section (output_bfd, info, input_bfd, input_section,
relocated. */
if (! ((*info->callbacks->undefined_symbol)
(info, h->root.root.string, input_bfd,
- input_section, (bfd_vma) 0, true)))
- return false;
+ input_section, (bfd_vma) 0, TRUE)))
+ return FALSE;
addend = 0;
}
}
@@ -1734,7 +1737,7 @@ alpha_relocate_section (output_bfd, info, input_bfd, input_section,
if (! ((*info->callbacks->unattached_reloc)
(info, h->root.root.string, input_bfd,
input_section, (bfd_vma) 0)))
- return false;
+ return FALSE;
}
addend = alpha_convert_external_reloc (output_bfd, info,
@@ -1745,7 +1748,7 @@ alpha_relocate_section (output_bfd, info, input_bfd, input_section,
addend += r_vaddr;
- if (info->relocateable)
+ if (info->relocatable)
{
/* Adjust r_vaddr by the addend. */
H_PUT_64 (input_bfd, addend, ext_rel->r_vaddr);
@@ -1774,14 +1777,14 @@ alpha_relocate_section (output_bfd, info, input_bfd, input_section,
}
}
- adjust_addrp = false;
+ adjust_addrp = FALSE;
break;
case ALPHA_R_OP_STORE:
/* Store a value from the reloc stack into a bitfield. If
- we are generating relocateable output, all we do is
+ we are generating relocatable output, all we do is
adjust the address of the reloc. */
- if (! info->relocateable)
+ if (! info->relocatable)
{
bfd_vma mask;
bfd_vma val;
@@ -1811,7 +1814,7 @@ alpha_relocate_section (output_bfd, info, input_bfd, input_section,
case ALPHA_R_GPVALUE:
/* I really don't know if this does the right thing. */
gp = ecoff_data (input_bfd)->gp + r_symndx;
- gp_undefined = false;
+ gp_undefined = FALSE;
break;
}
@@ -1847,9 +1850,9 @@ alpha_relocate_section (output_bfd, info, input_bfd, input_section,
abort ();
}
- if (info->relocateable)
+ if (info->relocatable)
{
- /* We are generating relocateable output, and must
+ /* We are generating relocatable output, and must
convert the existing reloc. */
if (r_extern)
{
@@ -1861,7 +1864,7 @@ alpha_relocate_section (output_bfd, info, input_bfd, input_section,
if (! ((*info->callbacks->unattached_reloc)
(info, h->root.root.string, input_bfd,
input_section, r_vaddr - input_section->vma)))
- return false;
+ return FALSE;
}
relocation = alpha_convert_external_reloc (output_bfd,
@@ -1918,8 +1921,8 @@ alpha_relocate_section (output_bfd, info, input_bfd, input_section,
if (! ((*info->callbacks->undefined_symbol)
(info, h->root.root.string, input_bfd,
input_section,
- r_vaddr - input_section->vma, true)))
- return false;
+ r_vaddr - input_section->vma, TRUE)))
+ return FALSE;
relocation = 0;
}
}
@@ -1965,14 +1968,14 @@ alpha_relocate_section (output_bfd, info, input_bfd, input_section,
(info, name, alpha_howto_table[r_type].name,
(bfd_vma) 0, input_bfd, input_section,
r_vaddr - input_section->vma)))
- return false;
+ return FALSE;
}
break;
}
}
}
- if (info->relocateable && adjust_addrp)
+ if (info->relocatable && adjust_addrp)
{
/* Change the address of the relocation. */
H_PUT_64 (input_bfd,
@@ -1988,24 +1991,24 @@ alpha_relocate_section (output_bfd, info, input_bfd, input_section,
if (! ((*info->callbacks->reloc_dangerous)
(info, _("GP relative relocation used when GP not defined"),
input_bfd, input_section, r_vaddr - input_section->vma)))
- return false;
+ return FALSE;
/* Only give the error once per link. */
gp = 4;
_bfd_set_gp_value (output_bfd, gp);
- gp_undefined = false;
+ gp_undefined = FALSE;
}
}
if (tos != 0)
abort ();
- return true;
+ return TRUE;
}
/* Do final adjustments to the filehdr and the aouthdr. This routine
sets the dynamic bits in the file header. */
-static boolean
+static bfd_boolean
alpha_adjust_headers (abfd, fhdr, ahdr)
bfd *abfd;
struct internal_filehdr *fhdr;
@@ -2015,7 +2018,7 @@ alpha_adjust_headers (abfd, fhdr, ahdr)
fhdr->f_flags |= F_ALPHA_CALL_SHARED;
else if ((abfd->flags & DYNAMIC) != 0)
fhdr->f_flags |= F_ALPHA_SHARABLE;
- return true;
+ return TRUE;
}
/* Archive handling. In OSF/1 (or Digital Unix) v3.2, Digital
@@ -2185,7 +2188,7 @@ alpha_ecoff_get_elt_at_filepos (archive, filepos)
bim->size = size;
bim->buffer = buf;
- nbfd->mtime_set = true;
+ nbfd->mtime_set = TRUE;
nbfd->mtime = strtol (hdr->ar_date, (char **) NULL, 10);
nbfd->flags |= BFD_IN_MEMORY;
@@ -2262,7 +2265,7 @@ static const struct ecoff_backend_data alpha_ecoff_backend_data =
(unsigned (*) PARAMS ((bfd *,PTR,PTR))) bfd_void, /* reloc_out */
alpha_ecoff_swap_filehdr_out, alpha_ecoff_swap_aouthdr_out,
alpha_ecoff_swap_scnhdr_out,
- FILHSZ, AOUTSZ, SCNHSZ, 0, 0, 0, 0, FILNMLEN, true, false, 4, false, 2,
+ FILHSZ, AOUTSZ, SCNHSZ, 0, 0, 0, 0, FILNMLEN, TRUE, FALSE, 4, FALSE, 2,
alpha_ecoff_swap_filehdr_in, alpha_ecoff_swap_aouthdr_in,
alpha_ecoff_swap_scnhdr_in, NULL,
alpha_ecoff_bad_format_hook, _bfd_ecoff_set_arch_mach_hook,
@@ -2278,10 +2281,10 @@ static const struct ecoff_backend_data alpha_ecoff_backend_data =
/* The page boundary used to align sections in a demand-paged
executable file. E.g., 0x1000. */
0x2000,
- /* True if the .rdata section is part of the text segment, as on the
- Alpha. False if .rdata is part of the data segment, as on the
+ /* TRUE if the .rdata section is part of the text segment, as on the
+ Alpha. FALSE if .rdata is part of the data segment, as on the
MIPS. */
- true,
+ TRUE,
/* Bitsize of constructor entries. */
64,
/* Reloc to use for constructor entries. */
diff --git a/contrib/binutils/bfd/coff-arm.c b/contrib/binutils/bfd/coff-arm.c
index 25256a8..e51d07d 100644
--- a/contrib/binutils/bfd/coff-arm.c
+++ b/contrib/binutils/bfd/coff-arm.c
@@ -1,24 +1,24 @@
/* BFD back-end for ARM COFF files.
Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
- 2000, 2001, 2002
+ 2000, 2001, 2002, 2003
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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "bfd.h"
#include "sysdep.h"
@@ -80,7 +80,7 @@ typedef unsigned long int insn32;
typedef unsigned short int insn16;
/* Forward declarations for stupid compilers. */
-static boolean coff_arm_relocate_section
+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
@@ -99,9 +99,9 @@ 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 boolean coff_arm_adjust_symndx
+static bfd_boolean coff_arm_adjust_symndx
PARAMS ((bfd *, struct bfd_link_info *, bfd *,
- asection *, struct internal_reloc *, boolean *));
+ 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 *,
@@ -125,19 +125,19 @@ static void record_thumb_to_arm_glue
PARAMS ((struct bfd_link_info *, struct coff_link_hash_entry *));
#endif
#endif
-static boolean coff_arm_merge_private_bfd_data
+static bfd_boolean coff_arm_merge_private_bfd_data
PARAMS ((bfd *, bfd *));
-static boolean coff_arm_print_private_bfd_data
+static bfd_boolean coff_arm_print_private_bfd_data
PARAMS ((bfd *, PTR));
-static boolean _bfd_coff_arm_set_private_flags
+static bfd_boolean _bfd_coff_arm_set_private_flags
PARAMS ((bfd *, flagword));
-static boolean coff_arm_copy_private_bfd_data
+static bfd_boolean coff_arm_copy_private_bfd_data
PARAMS ((bfd *, bfd *));
-static boolean coff_arm_is_local_label_name
+static bfd_boolean coff_arm_is_local_label_name
PARAMS ((bfd *, const char *));
-static boolean coff_arm_link_output_has_begun
+static bfd_boolean coff_arm_link_output_has_begun
PARAMS ((bfd *, struct coff_final_link_info *));
-static boolean coff_arm_final_link_postscript
+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));
@@ -224,7 +224,7 @@ coff_arm_reloc (abfd, reloc_entry, symbol, data, input_section, output_bfd,
#endif
#ifndef PCRELOFFSET
-#define PCRELOFFSET true
+#define PCRELOFFSET TRUE
#endif
/* These most certainly belong somewhere else. Just had to get rid of
@@ -252,11 +252,11 @@ coff_arm_reloc (abfd, reloc_entry, symbol, data, input_section, output_bfd,
#undef ARM_THUMB12
#undef ARM_26D
+#define ARM_26D 0
#define ARM_32 1
#define ARM_RVA32 2
#define ARM_26 3
#define ARM_THUMB12 4
-#define ARM_26D 5
#define ARM_SECTION 14
#define ARM_SECREL 15
#endif
@@ -264,17 +264,29 @@ coff_arm_reloc (abfd, reloc_entry, symbol, data, input_section, output_bfd,
static reloc_howto_type aoutarm_std_reloc_howto[] =
{
#ifdef ARM_WINCE
- EMPTY_HOWTO (-1),
+ HOWTO (ARM_26D,
+ 2,
+ 2,
+ 24,
+ TRUE,
+ 0,
+ complain_overflow_dont,
+ aoutarm_fix_pcrel_26_done,
+ "ARM_26D",
+ FALSE,
+ 0x00ffffff,
+ 0x0,
+ PCRELOFFSET),
HOWTO (ARM_32,
0,
2,
32,
- false,
+ FALSE,
0,
complain_overflow_bitfield,
coff_arm_reloc,
"ARM_32",
- true,
+ FALSE,
0xffffffff,
0xffffffff,
PCRELOFFSET),
@@ -282,12 +294,12 @@ static reloc_howto_type aoutarm_std_reloc_howto[] =
0,
2,
32,
- false,
+ FALSE,
0,
complain_overflow_bitfield,
coff_arm_reloc,
"ARM_RVA32",
- true,
+ FALSE,
0xffffffff,
0xffffffff,
PCRELOFFSET),
@@ -295,12 +307,12 @@ static reloc_howto_type aoutarm_std_reloc_howto[] =
2,
2,
24,
- true,
+ TRUE,
0,
complain_overflow_signed,
aoutarm_fix_pcrel_26 ,
"ARM_26",
- false,
+ FALSE,
0x00ffffff,
0x00ffffff,
PCRELOFFSET),
@@ -308,28 +320,16 @@ static reloc_howto_type aoutarm_std_reloc_howto[] =
1,
1,
11,
- true,
+ TRUE,
0,
complain_overflow_signed,
coff_thumb_pcrel_12 ,
"ARM_THUMB12",
- false,
+ FALSE,
0x000007ff,
0x000007ff,
PCRELOFFSET),
- HOWTO (ARM_26D,
- 2,
- 2,
- 24,
- false,
- 0,
- complain_overflow_dont,
- aoutarm_fix_pcrel_26_done,
- "ARM_26D",
- true,
- 0x00ffffff,
- 0x0,
- false),
+ EMPTY_HOWTO (-1),
EMPTY_HOWTO (-1),
EMPTY_HOWTO (-1),
EMPTY_HOWTO (-1),
@@ -342,12 +342,12 @@ static reloc_howto_type aoutarm_std_reloc_howto[] =
0,
1,
16,
- false,
+ FALSE,
0,
complain_overflow_bitfield,
coff_arm_reloc,
- "ARM_16",
- true,
+ "ARM_SECTION",
+ FALSE,
0x0000ffff,
0x0000ffff,
PCRELOFFSET),
@@ -355,26 +355,26 @@ static reloc_howto_type aoutarm_std_reloc_howto[] =
0,
2,
32,
- false,
+ FALSE,
0,
complain_overflow_bitfield,
coff_arm_reloc,
- "ARM_32",
- true,
+ "ARM_SECREL",
+ FALSE,
0xffffffff,
0xffffffff,
PCRELOFFSET),
#else /* not ARM_WINCE */
- HOWTO (ARM_8, /* type */
+ HOWTO (ARM_8, /* type */
0, /* rightshift */
0, /* size */
8, /* bitsize */
- false, /* pc_relative */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
- coff_arm_reloc, /* special_function */
+ coff_arm_reloc, /* special_function */
"ARM_8", /* name */
- true, /* partial_inplace */
+ TRUE, /* partial_inplace */
0x000000ff, /* src_mask */
0x000000ff, /* dst_mask */
PCRELOFFSET /* pcrel_offset */),
@@ -382,12 +382,12 @@ static reloc_howto_type aoutarm_std_reloc_howto[] =
0,
1,
16,
- false,
+ FALSE,
0,
complain_overflow_bitfield,
coff_arm_reloc,
"ARM_16",
- true,
+ TRUE,
0x0000ffff,
0x0000ffff,
PCRELOFFSET),
@@ -395,12 +395,12 @@ static reloc_howto_type aoutarm_std_reloc_howto[] =
0,
2,
32,
- false,
+ FALSE,
0,
complain_overflow_bitfield,
coff_arm_reloc,
"ARM_32",
- true,
+ TRUE,
0xffffffff,
0xffffffff,
PCRELOFFSET),
@@ -408,12 +408,12 @@ static reloc_howto_type aoutarm_std_reloc_howto[] =
2,
2,
24,
- true,
+ TRUE,
0,
complain_overflow_signed,
aoutarm_fix_pcrel_26 ,
"ARM_26",
- false,
+ FALSE,
0x00ffffff,
0x00ffffff,
PCRELOFFSET),
@@ -421,92 +421,92 @@ static reloc_howto_type aoutarm_std_reloc_howto[] =
0,
0,
8,
- true,
+ TRUE,
0,
complain_overflow_signed,
coff_arm_reloc,
"ARM_DISP8",
- true,
+ TRUE,
0x000000ff,
0x000000ff,
- true),
+ TRUE),
HOWTO (ARM_DISP16,
0,
1,
16,
- true,
+ TRUE,
0,
complain_overflow_signed,
coff_arm_reloc,
"ARM_DISP16",
- true,
+ TRUE,
0x0000ffff,
0x0000ffff,
- true),
+ TRUE),
HOWTO (ARM_DISP32,
0,
2,
32,
- true,
+ TRUE,
0,
complain_overflow_signed,
coff_arm_reloc,
"ARM_DISP32",
- true,
+ TRUE,
0xffffffff,
0xffffffff,
- true),
+ TRUE),
HOWTO (ARM_26D,
2,
2,
24,
- false,
+ FALSE,
0,
complain_overflow_dont,
aoutarm_fix_pcrel_26_done,
"ARM_26D",
- true,
+ TRUE,
0x00ffffff,
0x0,
- false),
+ FALSE),
/* 8 is unused */
EMPTY_HOWTO (-1),
HOWTO (ARM_NEG16,
0,
-1,
16,
- false,
+ FALSE,
0,
complain_overflow_bitfield,
coff_arm_reloc,
"ARM_NEG16",
- true,
+ TRUE,
0x0000ffff,
0x0000ffff,
- false),
+ FALSE),
HOWTO (ARM_NEG32,
0,
-2,
32,
- false,
+ FALSE,
0,
complain_overflow_bitfield,
coff_arm_reloc,
"ARM_NEG32",
- true,
+ TRUE,
0xffffffff,
0xffffffff,
- false),
+ FALSE),
HOWTO (ARM_RVA32,
0,
2,
32,
- false,
+ FALSE,
0,
complain_overflow_bitfield,
coff_arm_reloc,
"ARM_RVA32",
- true,
+ TRUE,
0xffffffff,
0xffffffff,
PCRELOFFSET),
@@ -514,12 +514,12 @@ static reloc_howto_type aoutarm_std_reloc_howto[] =
1,
1,
8,
- true,
+ TRUE,
0,
complain_overflow_signed,
coff_thumb_pcrel_9 ,
"ARM_THUMB9",
- false,
+ FALSE,
0x000000ff,
0x000000ff,
PCRELOFFSET),
@@ -527,12 +527,12 @@ static reloc_howto_type aoutarm_std_reloc_howto[] =
1,
1,
11,
- true,
+ TRUE,
0,
complain_overflow_signed,
coff_thumb_pcrel_12 ,
"ARM_THUMB12",
- false,
+ FALSE,
0x000007ff,
0x000007ff,
PCRELOFFSET),
@@ -540,12 +540,12 @@ static reloc_howto_type aoutarm_std_reloc_howto[] =
1,
2,
22,
- true,
+ TRUE,
0,
complain_overflow_signed,
coff_thumb_pcrel_23 ,
"ARM_THUMB23",
- false,
+ FALSE,
0x07ff07ff,
0x07ff07ff,
PCRELOFFSET)
@@ -555,11 +555,11 @@ static reloc_howto_type aoutarm_std_reloc_howto[] =
#define NUM_RELOCS NUM_ELEM (aoutarm_std_reloc_howto)
#ifdef COFF_WITH_PE
-static boolean in_reloc_p PARAMS ((bfd *, reloc_howto_type *));
-/* Return true if this relocation should
+static bfd_boolean in_reloc_p PARAMS ((bfd *, reloc_howto_type *));
+/* Return TRUE if this relocation should
appear in the output .reloc section. */
-static boolean
+static bfd_boolean
in_reloc_p (abfd, howto)
bfd * abfd ATTRIBUTE_UNUSED;
reloc_howto_type * howto;
@@ -921,13 +921,13 @@ struct coff_arm_link_hash_table
/* The original coff_link_hash_table structure. MUST be first field. */
struct coff_link_hash_table root;
- /* The size in bytes of the section containg the Thumb-to-ARM glue. */
+ /* 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 containg the ARM-to-Thumb glue. */
+ /* The size in bytes of the section containing the ARM-to-Thumb glue. */
bfd_size_type arm_glue_size;
- /* An arbitary input BFD chosen to hold the glue sections. */
+ /* An arbitrary input BFD chosen to hold the glue sections. */
bfd * bfd_of_glue_owner;
/* Support interworking with old, non-interworking aware ARM code. */
@@ -991,7 +991,7 @@ arm_emit_base_file_entry (info, output_bfd, input_section, reloc_offset)
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 (identifed by
+ 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).
@@ -1059,7 +1059,7 @@ find_thumb_glue (info, name, input_bfd)
sprintf (tmp_name, THUMB2ARM_GLUE_ENTRY_NAME, name);
myh = coff_link_hash_lookup
- (coff_hash_table (info), tmp_name, false, false, true);
+ (coff_hash_table (info), tmp_name, FALSE, FALSE, TRUE);
if (myh == NULL)
/* xgettext:c-format */
@@ -1089,7 +1089,7 @@ find_arm_glue (info, name, input_bfd)
sprintf (tmp_name, ARM2THUMB_GLUE_ENTRY_NAME, name);
myh = coff_link_hash_lookup
- (coff_hash_table (info), tmp_name, false, false, true);
+ (coff_hash_table (info), tmp_name, FALSE, FALSE, TRUE);
if (myh == NULL)
/* xgettext:c-format */
@@ -1188,7 +1188,7 @@ static const insn32 t2a6_bx_insn = 0xe12fff1e;
ARM/Thumb builds. It is only the code marked THUMBEXTENSION that
is different from the original. */
-static boolean
+static bfd_boolean
coff_arm_relocate_section (output_bfd, info, input_bfd, input_section,
contents, relocs, syms, sections)
bfd *output_bfd;
@@ -1244,16 +1244,17 @@ coff_arm_relocate_section (output_bfd, info, input_bfd, input_section,
howto = coff_rtype_to_howto (input_bfd, input_section, rel, h,
sym, &addend);
if (howto == NULL)
- return false;
+ return FALSE;
/* The relocation_section function will skip pcrel_offset relocs
- when doing a relocateable link. However, we want to convert
- ARM26 to ARM26D relocs if possible. We return a fake howto in
+ when doing a relocatable link. However, we want to convert
+ ARM_26 to ARM_26D relocs if possible. We return a fake howto in
this case without pcrel_offset set, and adjust the addend to
- compensate. */
+ compensate. 'partial_inplace' is also set, since we want 'done'
+ relocations to be reflected in section's data. */
if (rel->r_type == ARM_26
&& h != NULL
- && info->relocateable
+ && info->relocatable
&& (h->root.type == bfd_link_hash_defined
|| h->root.type == bfd_link_hash_defweak)
&& (h->root.u.def.section->output_section
@@ -1264,39 +1265,47 @@ coff_arm_relocate_section (output_bfd, info, input_bfd, input_section,
2,
2,
24,
- true,
+ TRUE,
0,
complain_overflow_signed,
aoutarm_fix_pcrel_26 ,
"ARM_26",
- false,
+ TRUE,
0x00ffffff,
0x00ffffff,
- false);
+ FALSE);
addend -= rel->r_vaddr - input_section->vma;
+#ifdef ARM_WINCE
+ /* FIXME: I don't know why, but the hack is necessary for correct
+ generation of bl's instruction offset. */
+ addend -= 8;
+#endif
howto = &fake_arm26_reloc;
}
#ifdef ARM_WINCE
/* MS ARM-CE makes the reloc relative to the opcode's pc, not
the next opcode's pc, so is off by one. */
- if (howto->pc_relative && !info->relocateable)
+#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 relocateable link, then we can just ignore
+ /* If we are doing a relocatable link, then we can just ignore
a PC relative reloc that is pcrel_offset. It will already
- have the correct value. If this is not a relocateable link,
+ have the correct value. If this is not a relocatable link,
then we should ignore the symbol value. */
if (howto->pc_relative && howto->pcrel_offset)
{
- if (info->relocateable)
+ if (info->relocatable)
continue;
/* FIXME - it is not clear which targets need this next test
and which do not. It is known that it is needed for the
VxWorks and EPOC-PE targets, but it is also known that it
- was supressed for other ARM targets. This ought to be
+ was suppressed for other ARM targets. This ought to be
sorted out one day. */
#ifdef ARM_COFF_BUGFIX
/* We must not ignore the symbol value. If the symbol is
@@ -1338,7 +1347,7 @@ coff_arm_relocate_section (output_bfd, info, input_bfd, input_section,
stub generation to the final linker pass. If we fail to
verify that the name is defined, we'll try to build stubs
for an undefined name... */
- if (! info->relocateable
+ if (! info->relocatable
&& ( h->root.type == bfd_link_hash_defined
|| h->root.type == bfd_link_hash_defweak))
{
@@ -1365,7 +1374,7 @@ coff_arm_relocate_section (output_bfd, info, input_bfd, input_section,
myh = find_arm_glue (info, name, input_bfd);
if (myh == NULL)
- return false;
+ return FALSE;
globals = coff_arm_hash_table (info);
@@ -1458,7 +1467,7 @@ coff_arm_relocate_section (output_bfd, info, input_bfd, input_section,
myh = find_thumb_glue (info, name, input_bfd);
if (myh == NULL)
- return false;
+ return FALSE;
globals = coff_arm_hash_table (info);
@@ -1592,12 +1601,12 @@ coff_arm_relocate_section (output_bfd, info, input_bfd, input_section,
+ sec->output_offset);
}
- else if (! info->relocateable)
+ else if (! info->relocatable)
{
if (! ((*info->callbacks->undefined_symbol)
(info, h->root.root.string, input_bfd, input_section,
- rel->r_vaddr - input_section->vma, true)))
- return false;
+ rel->r_vaddr - input_section->vma, TRUE)))
+ return FALSE;
}
}
@@ -1614,7 +1623,7 @@ coff_arm_relocate_section (output_bfd, info, input_bfd, input_section,
rstat = bfd_reloc_ok;
#ifndef ARM_WINCE
/* Only perform this fix during the final link, not a relocatable link. nickc@cygnus.com */
- else if (! info->relocateable
+ else if (! info->relocatable
&& howto->type == ARM_THUMB23)
{
/* This is pretty much a copy of what the default
@@ -1631,18 +1640,18 @@ coff_arm_relocate_section (output_bfd, info, input_bfd, input_section,
rstat = bfd_reloc_outofrange;
else
{
- bfd_vma relocation = val + addend;
- int size = bfd_get_reloc_size (howto);
- boolean overflow = false;
- bfd_byte * location = contents + address;
- bfd_vma x = bfd_get_32 (input_bfd, location);
- bfd_vma src_mask = 0x007FFFFE;
- bfd_signed_vma reloc_signed_max = (1 << (howto->bitsize - 1)) - 1;
- bfd_signed_vma reloc_signed_min = ~reloc_signed_max;
- bfd_vma check;
- bfd_signed_vma signed_check;
- bfd_vma add;
- bfd_signed_vma signed_add;
+ bfd_vma relocation = val + addend;
+ int size = bfd_get_reloc_size (howto);
+ bfd_boolean overflow = FALSE;
+ bfd_byte *location = contents + address;
+ bfd_vma x = bfd_get_32 (input_bfd, location);
+ bfd_vma src_mask = 0x007FFFFE;
+ bfd_signed_vma reloc_signed_max = (1 << (howto->bitsize - 1)) - 1;
+ bfd_signed_vma reloc_signed_min = ~reloc_signed_max;
+ bfd_vma check;
+ bfd_signed_vma signed_check;
+ bfd_vma add;
+ bfd_signed_vma signed_add;
BFD_ASSERT (size == 4);
@@ -1699,7 +1708,7 @@ coff_arm_relocate_section (output_bfd, info, input_bfd, input_section,
/* Assumes two's complement. */
if ( signed_check > reloc_signed_max
|| signed_check < reloc_signed_min)
- overflow = true;
+ overflow = TRUE;
/* Put the relocation into the correct bits.
For a BLX instruction, make sure that the relocation is rounded up
@@ -1731,28 +1740,31 @@ coff_arm_relocate_section (output_bfd, info, input_bfd, input_section,
#endif
else
#endif /* THUMBEXTENSION */
- rstat = _bfd_final_link_relocate (howto, input_bfd, input_section,
- contents,
- rel->r_vaddr - input_section->vma,
- val, addend);
+ if (info->relocatable && ! howto->partial_inplace)
+ rstat = bfd_reloc_ok;
+ else
+ rstat = _bfd_final_link_relocate (howto, input_bfd, input_section,
+ contents,
+ rel->r_vaddr - input_section->vma,
+ val, addend);
#if 1 /* THUMBEXTENSION */
/* FIXME:
Is this the best way to fix up thumb addresses? krk@cygnus.com
Probably not, but it works, and if it works it don't need fixing! nickc@cygnus.com */
/* Only perform this fix during the final link, not a relocatable link. nickc@cygnus.com */
- if (! info->relocateable
+ 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;
+ int patchit = FALSE;
if (h != NULL
&& ( h->class == C_THUMBSTATFUNC
|| h->class == C_THUMBEXTFUNC))
{
- patchit = true;
+ patchit = TRUE;
}
else if (sym != NULL
&& sym->n_scnum > N_UNDEF)
@@ -1761,7 +1773,7 @@ coff_arm_relocate_section (output_bfd, info, input_bfd, input_section,
if ( sym->n_sclass == C_THUMBSTATFUNC
|| sym->n_sclass == C_THUMBEXTFUNC)
- patchit = true;
+ patchit = TRUE;
}
if (patchit)
@@ -1786,7 +1798,7 @@ coff_arm_relocate_section (output_bfd, info, input_bfd, input_section,
bfd_archive_filename (input_bfd),
(unsigned long) rel->r_vaddr,
bfd_get_section_name (input_bfd, input_section));
- return false;
+ return FALSE;
case bfd_reloc_overflow:
{
const char *name;
@@ -1800,23 +1812,23 @@ coff_arm_relocate_section (output_bfd, info, input_bfd, input_section,
{
name = _bfd_coff_internal_syment_name (input_bfd, sym, buf);
if (name == NULL)
- return false;
+ return FALSE;
}
if (! ((*info->callbacks->reloc_overflow)
(info, name, howto->name, (bfd_vma) 0, input_bfd,
input_section, rel->r_vaddr - input_section->vma)))
- return false;
+ return FALSE;
}
}
}
- return true;
+ return TRUE;
}
#ifndef COFF_IMAGE_WITH_PE
-boolean
+bfd_boolean
bfd_arm_allocate_interworking_sections (info)
struct bfd_link_info * info;
{
@@ -1869,7 +1881,7 @@ bfd_arm_allocate_interworking_sections (info)
s->contents = foo;
}
- return true;
+ return TRUE;
}
static void
@@ -1904,7 +1916,7 @@ record_arm_to_thumb_glue (info, h)
sprintf (tmp_name, ARM2THUMB_GLUE_ENTRY_NAME, name);
myh = coff_link_hash_lookup
- (coff_hash_table (info), tmp_name, false, false, true);
+ (coff_hash_table (info), tmp_name, FALSE, FALSE, TRUE);
if (myh != NULL)
{
@@ -1919,7 +1931,7 @@ record_arm_to_thumb_glue (info, h)
bh = NULL;
val = globals->arm_glue_size + 1;
bfd_coff_link_add_one_symbol (info, globals->bfd_of_glue_owner, tmp_name,
- BSF_GLOBAL, s, val, NULL, true, false, &bh);
+ BSF_GLOBAL, s, val, NULL, TRUE, FALSE, &bh);
free (tmp_name);
@@ -1961,7 +1973,7 @@ record_thumb_to_arm_glue (info, h)
sprintf (tmp_name, THUMB2ARM_GLUE_ENTRY_NAME, name);
myh = coff_link_hash_lookup
- (coff_hash_table (info), tmp_name, false, false, true);
+ (coff_hash_table (info), tmp_name, FALSE, FALSE, TRUE);
if (myh != NULL)
{
@@ -1972,7 +1984,7 @@ record_thumb_to_arm_glue (info, h)
bh = NULL;
val = globals->thumb_glue_size + 1;
bfd_coff_link_add_one_symbol (info, globals->bfd_of_glue_owner, tmp_name,
- BSF_GLOBAL, s, val, NULL, true, false, &bh);
+ BSF_GLOBAL, s, val, NULL, TRUE, FALSE, &bh);
/* If we mark it 'thumb', the disassembler will do a better job. */
myh = (struct coff_link_hash_entry *) bh;
@@ -1995,7 +2007,7 @@ record_thumb_to_arm_glue (info, h)
bh = NULL;
val = globals->thumb_glue_size + (globals->support_old_code ? 8 : 4);
bfd_coff_link_add_one_symbol (info, globals->bfd_of_glue_owner, tmp_name,
- BSF_LOCAL, s, val, NULL, true, false, &bh);
+ BSF_LOCAL, s, val, NULL, TRUE, FALSE, &bh);
free (tmp_name);
@@ -2009,7 +2021,7 @@ record_thumb_to_arm_glue (info, h)
This function is called from the linker scripts in ld/emultempl/
{armcoff/pe}.em */
-boolean
+bfd_boolean
bfd_arm_get_bfd_for_interworking (abfd, info)
bfd * abfd;
struct bfd_link_info * info;
@@ -2020,15 +2032,15 @@ bfd_arm_get_bfd_for_interworking (abfd, info)
/* If we are only performing a partial link do not bother
getting a bfd to hold the glue. */
- if (info->relocateable)
- return true;
+ if (info->relocatable)
+ return TRUE;
globals = coff_arm_hash_table (info);
BFD_ASSERT (globals != NULL);
if (globals->bfd_of_glue_owner != NULL)
- return true;
+ return TRUE;
sec = bfd_get_section_by_name (abfd, ARM2THUMB_GLUE_SECTION_NAME);
@@ -2041,7 +2053,7 @@ bfd_arm_get_bfd_for_interworking (abfd, info)
if (sec == NULL
|| ! bfd_set_section_flags (abfd, sec, flags)
|| ! bfd_set_section_alignment (abfd, sec, 2))
- return false;
+ return FALSE;
}
sec = bfd_get_section_by_name (abfd, THUMB2ARM_GLUE_SECTION_NAME);
@@ -2055,16 +2067,16 @@ bfd_arm_get_bfd_for_interworking (abfd, info)
if (sec == NULL
|| ! bfd_set_section_flags (abfd, sec, flags)
|| ! bfd_set_section_alignment (abfd, sec, 2))
- return false;
+ return FALSE;
}
/* Save the bfd for later use. */
globals->bfd_of_glue_owner = abfd;
- return true;
+ return TRUE;
}
-boolean
+bfd_boolean
bfd_arm_process_before_allocation (abfd, info, support_old_code)
bfd * abfd;
struct bfd_link_info * info;
@@ -2075,8 +2087,8 @@ bfd_arm_process_before_allocation (abfd, info, support_old_code)
/* If we are only performing a partial link do not bother
to construct any glue. */
- if (info->relocateable)
- return true;
+ if (info->relocatable)
+ return TRUE;
/* Here we have a bfd that is to be included on the link. We have a hook
to do reloc rummaging, before section sizes are nailed down. */
@@ -2094,7 +2106,7 @@ bfd_arm_process_before_allocation (abfd, info, support_old_code)
sec = abfd->sections;
if (sec == NULL)
- return true;
+ return TRUE;
for (; sec != NULL; sec = sec->next)
{
@@ -2178,7 +2190,7 @@ bfd_arm_process_before_allocation (abfd, info, support_old_code)
}
}
- return true;
+ return TRUE;
}
#endif /* ! defined (COFF_IMAGE_WITH_PE) */
@@ -2195,19 +2207,19 @@ bfd_arm_process_before_allocation (abfd, info, support_old_code)
#define coff_bfd_copy_private_bfd_data coff_arm_copy_private_bfd_data
#define coff_bfd_link_hash_table_create coff_arm_link_hash_table_create
-/* When doing a relocateable link, we want to convert ARM26 relocs
- into ARM26D relocs. */
+/* When doing a relocatable link, we want to convert ARM_26 relocs
+ into ARM_26D relocs. */
-static boolean
+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;
- boolean *adjustedp;
+ bfd_boolean *adjustedp;
{
- if (irel->r_type == 3)
+ if (irel->r_type == ARM_26)
{
struct coff_link_hash_entry *h;
@@ -2216,18 +2228,18 @@ coff_arm_adjust_symndx (obfd, info, ibfd, sec, irel, adjustedp)
&& (h->root.type == bfd_link_hash_defined
|| h->root.type == bfd_link_hash_defweak)
&& h->root.u.def.section->output_section == sec->output_section)
- irel->r_type = 7;
+ irel->r_type = ARM_26D;
}
- *adjustedp = false;
- return true;
+ *adjustedp = FALSE;
+ return TRUE;
}
/* Called when merging the private data areas of two BFDs.
This is important as it allows us to detect if we are
attempting to merge binaries compiled for different ARM
- targets, eg different CPUs or differents APCS's. */
+ targets, eg different CPUs or different APCS's. */
-static boolean
+static bfd_boolean
coff_arm_merge_private_bfd_data (ibfd, obfd)
bfd * ibfd;
bfd * obfd;
@@ -2235,16 +2247,21 @@ coff_arm_merge_private_bfd_data (ibfd, obfd)
BFD_ASSERT (ibfd != NULL && obfd != NULL);
if (ibfd == obfd)
- return true;
+ return TRUE;
/* If the two formats are different we cannot merge anything.
This is not an error, since it is permissable to change the
input and output formats. */
if ( ibfd->xvec->flavour != bfd_target_coff_flavour
|| obfd->xvec->flavour != bfd_target_coff_flavour)
- return true;
+ return TRUE;
+
+ /* Determine what should happen if the input ARM architecture
+ does not match the output ARM architecture. */
+ if (! bfd_arm_merge_machines (ibfd, obfd))
+ return FALSE;
- /* Verify that the APCS is the same for the two BFDs */
+ /* Verify that the APCS is the same for the two BFDs. */
if (APCS_SET (ibfd))
{
if (APCS_SET (obfd))
@@ -2260,7 +2277,7 @@ coff_arm_merge_private_bfd_data (ibfd, obfd)
);
bfd_set_error (bfd_error_wrong_format);
- return false;
+ return FALSE;
}
if (APCS_FLOAT_FLAG (obfd) != APCS_FLOAT_FLAG (ibfd))
@@ -2278,7 +2295,7 @@ coff_arm_merge_private_bfd_data (ibfd, obfd)
bfd_get_filename (obfd));
bfd_set_error (bfd_error_wrong_format);
- return false;
+ return FALSE;
}
if (PIC_FLAG (obfd) != PIC_FLAG (ibfd))
@@ -2295,7 +2312,7 @@ coff_arm_merge_private_bfd_data (ibfd, obfd)
bfd_get_filename (obfd));
bfd_set_error (bfd_error_wrong_format);
- return false;
+ return FALSE;
}
}
else
@@ -2334,12 +2351,12 @@ coff_arm_merge_private_bfd_data (ibfd, obfd)
}
}
- return true;
+ return TRUE;
}
/* Display the flags field. */
-static boolean
+static bfd_boolean
coff_arm_print_private_bfd_data (abfd, ptr)
bfd * abfd;
PTR ptr;
@@ -2353,7 +2370,7 @@ coff_arm_print_private_bfd_data (abfd, ptr)
if (APCS_SET (abfd))
{
- /* xgettext: APCS is ARM Prodecure Call Standard, it should not be translated. */
+ /* xgettext: APCS is ARM Procedure Call Standard, it should not be translated. */
fprintf (file, " [APCS-%d]", APCS_26_FLAG (abfd) ? 26 : 32);
if (APCS_FLOAT_FLAG (abfd))
@@ -2376,7 +2393,7 @@ coff_arm_print_private_bfd_data (abfd, ptr)
fputc ('\n', file);
- return true;
+ return TRUE;
}
/* Copies the given flags into the coff_tdata.flags field.
@@ -2386,7 +2403,7 @@ coff_arm_print_private_bfd_data (abfd, ptr)
Note: Although this function is static, it is explicitly
called from both coffcode.h and peicode.h. */
-static boolean
+static bfd_boolean
_bfd_coff_arm_set_private_flags (abfd, flags)
bfd * abfd;
flagword flags;
@@ -2404,7 +2421,7 @@ _bfd_coff_arm_set_private_flags (abfd, flags)
|| (APCS_FLOAT_FLAG (abfd) != (flags & F_APCS_FLOAT))
|| (PIC_FLAG (abfd) != (flags & F_PIC))
))
- return false;
+ return FALSE;
flag |= (flags & (F_APCS_FLOAT | F_PIC));
@@ -2431,13 +2448,13 @@ _bfd_coff_arm_set_private_flags (abfd, flags)
SET_INTERWORK_FLAG (abfd, flag);
- return true;
+ return TRUE;
}
/* Copy the important parts of the target specific data
from one instance of a BFD to another. */
-static boolean
+static bfd_boolean
coff_arm_copy_private_bfd_data (src, dest)
bfd * src;
bfd * dest;
@@ -2445,12 +2462,12 @@ coff_arm_copy_private_bfd_data (src, dest)
BFD_ASSERT (src != NULL && dest != NULL);
if (src == dest)
- return true;
+ return TRUE;
/* If the destination is not in the same format as the source, do not do
the copy. */
if (src->xvec != dest->xvec)
- return true;
+ return TRUE;
/* copy the flags field */
if (APCS_SET (src))
@@ -2459,13 +2476,13 @@ coff_arm_copy_private_bfd_data (src, dest)
{
/* If the src and dest have different APCS flag bits set, fail. */
if (APCS_26_FLAG (dest) != APCS_26_FLAG (src))
- return false;
+ return FALSE;
if (APCS_FLOAT_FLAG (dest) != APCS_FLOAT_FLAG (src))
- return false;
+ return FALSE;
if (PIC_FLAG (dest) != PIC_FLAG (src))
- return false;
+ return FALSE;
}
else
SET_APCS_FLAGS (dest, APCS_26_FLAG (src) | APCS_FLOAT_FLAG (src)
@@ -2498,7 +2515,7 @@ Warning: Clearing the interworking flag of %s because non-interworking code in %
}
}
- return true;
+ return TRUE;
}
/* Note: the definitions here of LOCAL_LABEL_PREFIX and USER_LABEL_PREIFX
@@ -2513,7 +2530,7 @@ 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 boolean
+static bfd_boolean
coff_arm_is_local_label_name (abfd, name)
bfd * abfd ATTRIBUTE_UNUSED;
const char * name;
@@ -2522,7 +2539,7 @@ coff_arm_is_local_label_name (abfd, name)
if (USER_LABEL_PREFIX[0] != 0)
{
if (strncmp (name, USER_LABEL_PREFIX, strlen (USER_LABEL_PREFIX)) == 0)
- return false;
+ return FALSE;
}
#endif
@@ -2535,7 +2552,7 @@ coff_arm_is_local_label_name (abfd, name)
size_t len = strlen (LOCAL_LABEL_PREFIX);
if (strncmp (name, LOCAL_LABEL_PREFIX, len) != 0)
- return false;
+ return FALSE;
/* Perform the checks below for the rest of the name. */
name += len;
@@ -2553,7 +2570,7 @@ coff_arm_is_local_label_name (abfd, name)
krk@cygnus.com */
-static boolean
+static bfd_boolean
coff_arm_link_output_has_begun (sub, info)
bfd * sub;
struct coff_final_link_info * info;
@@ -2562,7 +2579,7 @@ coff_arm_link_output_has_begun (sub, info)
|| sub == coff_arm_hash_table (info->info)->bfd_of_glue_owner);
}
-static boolean
+static bfd_boolean
coff_arm_final_link_postscript (abfd, pfinfo)
bfd * abfd ATTRIBUTE_UNUSED;
struct coff_final_link_info * pfinfo;
@@ -2576,12 +2593,12 @@ coff_arm_final_link_postscript (abfd, pfinfo)
if (globals->bfd_of_glue_owner != NULL)
{
if (! _bfd_coff_link_input_bfd (pfinfo, globals->bfd_of_glue_owner))
- return false;
+ return FALSE;
- globals->bfd_of_glue_owner->output_has_begun = true;
+ globals->bfd_of_glue_owner->output_has_begun = TRUE;
}
- return true;
+ return bfd_arm_update_notes (abfd, ARM_NOTE_SECTION);
}
#include "coffcode.h"
@@ -2605,9 +2622,9 @@ coff_arm_final_link_postscript (abfd, pfinfo)
#ifndef EXTRA_S_FLAGS
#ifdef COFF_WITH_PE
-#define EXTRA_S_FLAGS (SEC_LINK_ONCE | SEC_LINK_DUPLICATES)
+#define EXTRA_S_FLAGS (SEC_CODE | SEC_LINK_ONCE | SEC_LINK_DUPLICATES)
#else
-#define EXTRA_S_FLAGS 0
+#define EXTRA_S_FLAGS SEC_CODE
#endif
#endif
@@ -2615,5 +2632,5 @@ coff_arm_final_link_postscript (abfd, pfinfo)
extern const bfd_target TARGET_BIG_SYM ;
/* Target vectors. */
-CREATE_LITTLE_COFF_TARGET_VEC (TARGET_LITTLE_SYM, TARGET_LITTLE_NAME, D_PAGED, EXTRA_S_FLAGS, TARGET_UNDERSCORE, & TARGET_BIG_SYM)
-CREATE_BIG_COFF_TARGET_VEC (TARGET_BIG_SYM, TARGET_BIG_NAME, D_PAGED, EXTRA_S_FLAGS, TARGET_UNDERSCORE, & TARGET_LITTLE_SYM)
+CREATE_LITTLE_COFF_TARGET_VEC (TARGET_LITTLE_SYM, TARGET_LITTLE_NAME, D_PAGED, EXTRA_S_FLAGS, TARGET_UNDERSCORE, & TARGET_BIG_SYM, COFF_SWAP_TABLE)
+CREATE_BIG_COFF_TARGET_VEC (TARGET_BIG_SYM, TARGET_BIG_NAME, D_PAGED, EXTRA_S_FLAGS, TARGET_UNDERSCORE, & TARGET_LITTLE_SYM, COFF_SWAP_TABLE)
diff --git a/contrib/binutils/bfd/coff-aux.c b/contrib/binutils/bfd/coff-aux.c
index 53822f0..4d7cde5 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 Free Software Foundation, Inc.
+ Copyright 1996, 1997, 2000, 2002 Free Software Foundation, Inc.
Written by Richard Henderson <rth@tamu.edu>.
This file is part of BFD, the Binary File Descriptor library.
@@ -40,9 +40,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "bfd.h"
#include "sysdep.h"
-static boolean coff_m68k_aux_link_add_one_symbol
+static bfd_boolean coff_m68k_aux_link_add_one_symbol
PARAMS ((struct bfd_link_info *, bfd *, const char *, flagword,
- asection *, bfd_vma, const char *, boolean, boolean,
+ asection *, bfd_vma, const char *, bfd_boolean, bfd_boolean,
struct bfd_link_hash_entry **));
#define coff_link_add_one_symbol coff_m68k_aux_link_add_one_symbol
@@ -56,7 +56,7 @@ static boolean coff_m68k_aux_link_add_one_symbol
shared libraries work here, but can work if you are careful with
what you include in the shared object. */
-static boolean
+static bfd_boolean
coff_m68k_aux_link_add_one_symbol (info, abfd, name, flags, section, value,
string, copy, collect, hashp)
struct bfd_link_info *info;
@@ -66,8 +66,8 @@ coff_m68k_aux_link_add_one_symbol (info, abfd, name, flags, section, value,
asection *section;
bfd_vma value;
const char *string;
- boolean copy;
- boolean collect;
+ bfd_boolean copy;
+ bfd_boolean collect;
struct bfd_link_hash_entry **hashp;
{
struct bfd_link_hash_entry *h;
@@ -86,21 +86,21 @@ coff_m68k_aux_link_add_one_symbol (info, abfd, name, flags, section, value,
}
else
{
- h = bfd_link_hash_lookup (info->hash, name, true, copy, false);
+ h = bfd_link_hash_lookup (info->hash, name, TRUE, copy, FALSE);
if (h == NULL)
{
if (hashp != NULL)
*hashp = NULL;
- return false;
+ return FALSE;
}
}
if (info->notice_hash != (struct bfd_hash_table *) NULL
- && (bfd_hash_lookup (info->notice_hash, name, false, false)
+ && (bfd_hash_lookup (info->notice_hash, name, FALSE, FALSE)
!= (struct bfd_hash_entry *) NULL))
{
if (! (*info->callbacks->notice) (info, name, abfd, section, value))
- return false;
+ return FALSE;
}
if (hashp != (struct bfd_link_hash_entry **) NULL)
@@ -121,10 +121,10 @@ coff_m68k_aux_link_add_one_symbol (info, abfd, name, flags, section, value,
{
h->u.def.section = section;
h->u.def.value = value;
- return true;
+ return TRUE;
}
else if (bfd_is_abs_section (section) && !bfd_is_abs_section (msec))
- return true;
+ return TRUE;
}
}
diff --git a/contrib/binutils/bfd/coff-i386.c b/contrib/binutils/bfd/coff-i386.c
index dbeaef1..a24344a 100644
--- a/contrib/binutils/bfd/coff-i386.c
+++ b/contrib/binutils/bfd/coff-i386.c
@@ -1,6 +1,6 @@
/* BFD back-end for Intel 386 COFF files.
Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
- 2000, 2001, 2002
+ 2000, 2001, 2002, 2003
Free Software Foundation, Inc.
Written by Cygnus Support.
@@ -56,7 +56,7 @@ static reloc_howto_type *coff_i386_reloc_type_lookup
section for a reference to a common symbol is the value itself plus
any desired offset. Ian Taylor, Cygnus Support. */
-/* If we are producing relocateable output, we need to do some
+/* If we are producing relocatable output, we need to do some
adjustments to the object file that are not done by the
bfd_perform_relocation function. This function is called by every
reloc type to make any required adjustments. */
@@ -103,7 +103,7 @@ coff_i386_reloc (abfd, reloc_entry, symbol, data, input_section, output_bfd,
{
/* For some reason bfd_perform_relocation always effectively
ignores the addend for a COFF target when producing
- relocateable output. This seems to be always wrong for 386
+ relocatable output. This seems to be always wrong for 386
COFF, so we handle the addend here instead. */
#ifdef COFF_WITH_PE
if (output_bfd == (bfd *) NULL)
@@ -179,12 +179,12 @@ coff_i386_reloc (abfd, reloc_entry, symbol, data, input_section, output_bfd,
}
#ifdef COFF_WITH_PE
-/* Return true if this relocation should appear in the output .reloc
+/* Return TRUE if this relocation should appear in the output .reloc
section. */
-static boolean in_reloc_p PARAMS ((bfd *, reloc_howto_type *));
+static bfd_boolean in_reloc_p PARAMS ((bfd *, reloc_howto_type *));
-static boolean in_reloc_p (abfd, howto)
+static bfd_boolean in_reloc_p (abfd, howto)
bfd * abfd ATTRIBUTE_UNUSED;
reloc_howto_type *howto;
{
@@ -193,7 +193,7 @@ static boolean in_reloc_p (abfd, howto)
#endif /* COFF_WITH_PE */
#ifndef PCRELOFFSET
-#define PCRELOFFSET false
+#define PCRELOFFSET FALSE
#endif
static reloc_howto_type howto_table[] =
@@ -208,29 +208,29 @@ static reloc_howto_type howto_table[] =
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
32, /* bitsize */
- false, /* pc_relative */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
coff_i386_reloc, /* special_function */
"dir32", /* name */
- true, /* partial_inplace */
+ TRUE, /* partial_inplace */
0xffffffff, /* src_mask */
0xffffffff, /* dst_mask */
- true), /* pcrel_offset */
+ TRUE), /* pcrel_offset */
/* PE IMAGE_REL_I386_DIR32NB relocation (7). */
HOWTO (R_IMAGEBASE, /* type */
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
32, /* bitsize */
- false, /* pc_relative */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
coff_i386_reloc, /* special_function */
"rva32", /* name */
- true, /* partial_inplace */
+ TRUE, /* partial_inplace */
0xffffffff, /* src_mask */
0xffffffff, /* dst_mask */
- false), /* pcrel_offset */
+ FALSE), /* pcrel_offset */
EMPTY_HOWTO (010),
EMPTY_HOWTO (011),
EMPTY_HOWTO (012),
@@ -243,12 +243,12 @@ static reloc_howto_type howto_table[] =
0, /* rightshift */
0, /* size (0 = byte, 1 = short, 2 = long) */
8, /* bitsize */
- false, /* pc_relative */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
coff_i386_reloc, /* special_function */
"8", /* name */
- true, /* partial_inplace */
+ TRUE, /* partial_inplace */
0x000000ff, /* src_mask */
0x000000ff, /* dst_mask */
PCRELOFFSET), /* pcrel_offset */
@@ -257,12 +257,12 @@ static reloc_howto_type howto_table[] =
0, /* rightshift */
1, /* size (0 = byte, 1 = short, 2 = long) */
16, /* bitsize */
- false, /* pc_relative */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
coff_i386_reloc, /* special_function */
"16", /* name */
- true, /* partial_inplace */
+ TRUE, /* partial_inplace */
0x0000ffff, /* src_mask */
0x0000ffff, /* dst_mask */
PCRELOFFSET), /* pcrel_offset */
@@ -271,12 +271,12 @@ static reloc_howto_type howto_table[] =
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
32, /* bitsize */
- false, /* pc_relative */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
coff_i386_reloc, /* special_function */
"32", /* name */
- true, /* partial_inplace */
+ TRUE, /* partial_inplace */
0xffffffff, /* src_mask */
0xffffffff, /* dst_mask */
PCRELOFFSET), /* pcrel_offset */
@@ -285,12 +285,12 @@ static reloc_howto_type howto_table[] =
0, /* rightshift */
0, /* size (0 = byte, 1 = short, 2 = long) */
8, /* bitsize */
- true, /* pc_relative */
+ TRUE, /* pc_relative */
0, /* bitpos */
complain_overflow_signed, /* complain_on_overflow */
coff_i386_reloc, /* special_function */
"DISP8", /* name */
- true, /* partial_inplace */
+ TRUE, /* partial_inplace */
0x000000ff, /* src_mask */
0x000000ff, /* dst_mask */
PCRELOFFSET), /* pcrel_offset */
@@ -299,12 +299,12 @@ static reloc_howto_type howto_table[] =
0, /* rightshift */
1, /* size (0 = byte, 1 = short, 2 = long) */
16, /* bitsize */
- true, /* pc_relative */
+ TRUE, /* pc_relative */
0, /* bitpos */
complain_overflow_signed, /* complain_on_overflow */
coff_i386_reloc, /* special_function */
"DISP16", /* name */
- true, /* partial_inplace */
+ TRUE, /* partial_inplace */
0x0000ffff, /* src_mask */
0x0000ffff, /* dst_mask */
PCRELOFFSET), /* pcrel_offset */
@@ -313,12 +313,12 @@ static reloc_howto_type howto_table[] =
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
32, /* bitsize */
- true, /* pc_relative */
+ TRUE, /* pc_relative */
0, /* bitpos */
complain_overflow_signed, /* complain_on_overflow */
coff_i386_reloc, /* special_function */
"DISP32", /* name */
- true, /* partial_inplace */
+ TRUE, /* partial_inplace */
0xffffffff, /* src_mask */
0xffffffff, /* dst_mask */
PCRELOFFSET) /* pcrel_offset */
@@ -386,13 +386,13 @@ static reloc_howto_type howto_table[] =
/* The PE relocate section routine. The only difference between this
and the regular routine is that we don't want to do anything for a
- relocateable link. */
+ relocatable link. */
-static boolean coff_pe_i386_relocate_section
+static bfd_boolean coff_pe_i386_relocate_section
PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *,
struct internal_reloc *, struct internal_syment *, asection **));
-static boolean
+static bfd_boolean
coff_pe_i386_relocate_section (output_bfd, info, input_bfd,
input_section, contents, relocs, syms,
sections)
@@ -405,8 +405,8 @@ coff_pe_i386_relocate_section (output_bfd, info, input_bfd,
struct internal_syment *syms;
asection **sections;
{
- if (info->relocateable)
- return true;
+ if (info->relocatable)
+ return TRUE;
return _bfd_coff_generic_relocate_section (output_bfd, info, input_bfd,
input_section, contents,
@@ -470,7 +470,7 @@ coff_i386_rtype_to_howto (abfd, sec, rel, h, sym, addendp)
#ifndef COFF_WITH_PE
/* If the output symbol is common (in which case this must be a
- relocateable link), we need to add in the final size of the
+ relocatable link), we need to add in the final size of the
common symbol. */
if (h != NULL && h->root.type == bfd_link_hash_common)
*addendp += h->root.u.c.size;
@@ -539,15 +539,16 @@ coff_i386_reloc_type_lookup (abfd, code)
a leading dot for local labels, so if TARGET_UNDERSCORE is defined
we treat all symbols starting with L as local. */
-static boolean coff_i386_is_local_label_name PARAMS ((bfd *, const char *));
+static bfd_boolean coff_i386_is_local_label_name
+ PARAMS ((bfd *, const char *));
-static boolean
+static bfd_boolean
coff_i386_is_local_label_name (abfd, name)
bfd *abfd;
const char *name;
{
if (name[0] == 'L')
- return true;
+ return TRUE;
return _bfd_coff_is_local_label_name (abfd, name);
}
diff --git a/contrib/binutils/bfd/coff-ia64.c b/contrib/binutils/bfd/coff-ia64.c
index 76d1bf6..2b5b557 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 Free Software Foundation, Inc.
+ Copyright 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
Contributed by David Mosberger <davidm@hpl.hp.com>
This file is part of BFD, the Binary File Descriptor library.
@@ -49,17 +49,17 @@ static reloc_howto_type howto_table[] =
(cache_ptr)->howto = howto_table + (dst)->r_type;
#ifdef COFF_WITH_PE
-/* Return true if this relocation should
+/* Return TRUE if this relocation should
appear in the output .reloc section. */
-static boolean in_reloc_p PARAMS ((bfd *, reloc_howto_type *));
+static bfd_boolean in_reloc_p PARAMS ((bfd *, reloc_howto_type *));
-static boolean
+static bfd_boolean
in_reloc_p(abfd, howto)
bfd * abfd ATTRIBUTE_UNUSED;
reloc_howto_type *howto ATTRIBUTE_UNUSED;
{
- return 0; /* We don't do relocs for now... */
+ return FALSE; /* We don't do relocs for now... */
}
#endif
diff --git a/contrib/binutils/bfd/coff-ppc.c b/contrib/binutils/bfd/coff-ppc.c
index 4f8b15e..c1c2c32 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
+ 2000, 2001, 2002, 2003
Free Software Foundation, Inc.
Original version pieced together by Kim Knuttila (krk@cygnus.com)
@@ -9,30 +9,29 @@
coff files, in particular, those for the rs/6000, alpha, mips, and
intel backends, and the PE work for the arm.
-This file is part of BFD, the Binary File Descriptor library.
+ This 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, 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, 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
/* Current State:
- objdump works
- relocs generated by gas
- ld will link files, but they do not run.
- dlltool will not produce correct output in some .reloc cases, and will
- not produce the right glue code for dll function calls.
-*/
+ not produce the right glue code for dll function calls. */
#include "bfd.h"
#include "sysdep.h"
@@ -54,19 +53,19 @@ Boston, MA 02111-1307, USA. */
/* This file is compiled more than once, but we only compile the
final_link routine once. */
-extern boolean ppc_bfd_coff_final_link
+extern bfd_boolean ppc_bfd_coff_final_link
PARAMS ((bfd *, struct bfd_link_info *));
extern void dump_toc PARAMS ((PTR));
-/* The toc is a set of bfd_vma fields. We use the fact that valid */
-/* addresses are even (i.e. the bit representing "1" is off) to allow */
-/* us to encode a little extra information in the field */
-/* - Unallocated addresses are intialized to 1. */
-/* - Allocated addresses are even numbers. */
-/* The first time we actually write a reference to the toc in the bfd, */
-/* we want to record that fact in a fixup file (if it is asked for), so */
-/* we keep track of whether or not an address has been written by marking */
-/* the low order bit with a "1" upon writing */
+/* The toc is a set of bfd_vma fields. We use the fact that valid
+ addresses are even (i.e. the bit representing "1" is off) to allow
+ us to encode a little extra information in the field
+ - Unallocated addresses are initialized to 1.
+ - Allocated addresses are even numbers.
+ The first time we actually write a reference to the toc in the bfd,
+ we want to record that fact in a fixup file (if it is asked for), so
+ we keep track of whether or not an address has been written by marking
+ the low order bit with a "1" upon writing. */
#define SET_UNALLOCATED(x) ((x) = 1)
#define IS_UNALLOCATED(x) ((x) == 1)
@@ -75,10 +74,10 @@ extern void dump_toc PARAMS ((PTR));
#define MARK_AS_WRITTEN(x) ((x) |= 1)
#define MAKE_ADDR_AGAIN(x) ((x) &= ~1)
-/* Turn on this check if you suspect something amiss in the hash tables */
+/* Turn on this check if you suspect something amiss in the hash tables. */
#ifdef DEBUG_HASH
-/* Need a 7 char string for an eye catcher */
+/* Need a 7 char string for an eye catcher. */
#define EYE "krkjunk"
#define HASH_CHECK_DCL char eye_catcher[8];
@@ -101,17 +100,17 @@ extern void dump_toc PARAMS ((PTR));
#endif
/* In order not to add an int to every hash table item for every coff
- linker, we define our own hash table, derived from the coff one */
+ linker, we define our own hash table, derived from the coff one. */
/* PE linker hash table entries. */
struct ppc_coff_link_hash_entry
{
- struct coff_link_hash_entry root; /* First entry, as required */
+ struct coff_link_hash_entry root; /* First entry, as required. */
/* As we wonder around the relocs, we'll keep the assigned toc_offset
- here */
- bfd_vma toc_offset; /* Our addition, as required */
+ here. */
+ bfd_vma toc_offset; /* Our addition, as required. */
int symbol_is_glue;
unsigned long int glue_insn;
@@ -122,20 +121,20 @@ struct ppc_coff_link_hash_entry
struct ppc_coff_link_hash_table
{
- struct coff_link_hash_table root; /* First entry, as required */
+ struct coff_link_hash_table root; /* First entry, as required. */
};
static struct bfd_hash_entry *ppc_coff_link_hash_newfunc
PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *,
const char *));
-static boolean ppc_coff_link_hash_table_init
+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 boolean coff_ppc_relocate_section
+static bfd_boolean coff_ppc_relocate_section
PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *,
struct internal_reloc *, struct internal_syment *, asection **));
static reloc_howto_type *coff_ppc_rtype_to_howto
@@ -172,11 +171,11 @@ ppc_coff_link_hash_newfunc (entry, table, string)
if (ret)
{
/* Initialize the local fields. */
- SET_UNALLOCATED(ret->toc_offset);
+ SET_UNALLOCATED (ret->toc_offset);
ret->symbol_is_glue = 0;
ret->glue_insn = 0;
- HASH_CHECK_INIT(ret);
+ HASH_CHECK_INIT (ret);
}
return (struct bfd_hash_entry *) ret;
@@ -184,7 +183,7 @@ ppc_coff_link_hash_newfunc (entry, table, string)
/* Initialize a PE linker hash table. */
-static boolean
+static bfd_boolean
ppc_coff_link_hash_table_init (table, abfd, newfunc)
struct ppc_coff_link_hash_table *table;
bfd *abfd;
@@ -216,13 +215,13 @@ ppc_coff_link_hash_table_create (abfd)
return &ret->root.root;
}
-/* Now, tailor coffcode.h to use our hash stuff */
+/* Now, tailor coffcode.h to use our hash stuff. */
#define coff_bfd_link_hash_table_create ppc_coff_link_hash_table_create
-/* The nt loader points the toc register to &toc + 32768, in order to */
-/* use the complete range of a 16-bit displacement. We have to adjust */
-/* for this when we fix up loads displaced off the toc reg. */
+/* The nt loader points the toc register to &toc + 32768, in order to
+ use the complete range of a 16-bit displacement. We have to adjust
+ for this when we fix up loads displaced off the toc reg. */
#define TOC_LOAD_ADJUSTMENT (-32768)
#define TOC_SECTION_NAME ".private.toc"
@@ -234,7 +233,7 @@ ppc_coff_link_hash_table_create (abfd)
from smaller values. Start with zero, widen, *then* decrement. */
#define MINUS_ONE (((bfd_vma)0) - 1)
-/* these should definitely go in a header file somewhere... */
+/* These should definitely go in a header file somewhere... */
/* NOP */
#define IMAGE_REL_PPC_ABSOLUTE 0x0000
@@ -284,31 +283,31 @@ ppc_coff_link_hash_table_create (abfd)
/* va of containing section (limited to 16 bits) */
#define IMAGE_REL_PPC_SECREL16 0x000F
-/* stuff to handle immediate data when the number of bits in the */
-/* data is greater than the number of bits in the immediate field */
-/* We need to do (usually) 32 bit arithmetic on 16 bit chunks */
+/* Stuff to handle immediate data when the number of bits in the
+ data is greater than the number of bits in the immediate field
+ We need to do (usually) 32 bit arithmetic on 16 bit chunks. */
#define IMAGE_REL_PPC_REFHI 0x0010
#define IMAGE_REL_PPC_REFLO 0x0011
#define IMAGE_REL_PPC_PAIR 0x0012
-/* This is essentially the same as tocrel16, with TOCDEFN assumed */
+/* This is essentially the same as tocrel16, with TOCDEFN assumed. */
#define IMAGE_REL_PPC_TOCREL16_DEFN 0x0013
-/* Flag bits in IMAGE_RELOCATION.TYPE */
+/* Flag bits in IMAGE_RELOCATION.TYPE. */
-/* subtract reloc value rather than adding it */
+/* Subtract reloc value rather than adding it. */
#define IMAGE_REL_PPC_NEG 0x0100
-/* fix branch prediction bit to predict branch taken */
+/* Fix branch prediction bit to predict branch taken. */
#define IMAGE_REL_PPC_BRTAKEN 0x0200
-/* fix branch prediction bit to predict branch not taken */
+/* Fix branch prediction bit to predict branch not taken. */
#define IMAGE_REL_PPC_BRNTAKEN 0x0400
-/* toc slot defined in file (or, data in toc) */
+/* TOC slot defined in file (or, data in toc). */
#define IMAGE_REL_PPC_TOCDEFN 0x0800
-/* masks to isolate above values in IMAGE_RELOCATION.Type */
+/* Masks to isolate above values in IMAGE_RELOCATION.Type. */
#define IMAGE_REL_PPC_TYPEMASK 0x00FF
#define IMAGE_REL_PPC_FLAGMASK 0x0F00
@@ -317,7 +316,7 @@ ppc_coff_link_hash_table_create (abfd)
#define EXTRACT_JUNK(x) \
((x) & ~(IMAGE_REL_PPC_TYPEMASK | IMAGE_REL_PPC_FLAGMASK))
-/* static helper functions to make relocation work */
+/* Static helper functions to make relocation work. */
/* (Work In Progress) */
static bfd_reloc_status_type ppc_refhi_reloc PARAMS ((bfd *abfd,
@@ -385,45 +384,40 @@ static bfd_reloc_status_type ppc_imglue_reloc PARAMS ((bfd *abfd,
bfd *output_bfd,
char **error));
-static boolean in_reloc_p PARAMS((bfd *abfd, reloc_howto_type *howto));
+static bfd_boolean in_reloc_p PARAMS((bfd *abfd, reloc_howto_type *howto));
/* FIXME: It'll take a while to get through all of these. I only need a few to
get us started, so those I'll make sure work. Those marked FIXME are either
- completely unverified or have a specific unknown marked in the comment */
-
-/*---------------------------------------------------------------------------*/
-/* */
-/* Relocation entries for Windows/NT on PowerPC. */
-/* */
-/* From the document "" we find the following listed as used relocs: */
-/* */
-/* ABSOLUTE : The noop */
-/* ADDR[64|32|16] : fields that hold addresses in data fields or the */
-/* 16 bit displacement field on a load/store. */
-/* ADDR[24|14] : fields that hold addresses in branch and cond */
-/* branches. These represent [26|16] bit addresses. */
-/* The low order 2 bits are preserved. */
-/* REL[24|14] : branches relative to the Instruction Address */
-/* register. These represent [26|16] bit addresses, */
-/* as before. The instruction field will be zero, and */
-/* the address of the SYM will be inserted at link time. */
-/* TOCREL16 : 16 bit displacement field referring to a slot in */
-/* toc. */
-/* TOCREL14 : 16 bit displacement field, similar to REL14 or ADDR14. */
-/* ADDR32NB : 32 bit address relative to the virtual origin. */
-/* (On the alpha, this is always a linker generated thunk)*/
-/* (i.e. 32bit addr relative to the image base) */
-/* SECREL : The value is relative to the start of the section */
-/* containing the symbol. */
-/* SECTION : access to the header containing the item. Supports the */
-/* codeview debugger. */
-/* */
-/* In particular, note that the document does not indicate that the */
-/* relocations listed in the header file are used. */
-/* */
-/* */
-/* */
-/*---------------------------------------------------------------------------*/
+ completely unverified or have a specific unknown marked in the comment. */
+
+/* Relocation entries for Windows/NT on PowerPC.
+
+ From the document "" we find the following listed as used relocs:
+
+ ABSOLUTE : The noop
+ ADDR[64|32|16] : fields that hold addresses in data fields or the
+ 16 bit displacement field on a load/store.
+ ADDR[24|14] : fields that hold addresses in branch and cond
+ branches. These represent [26|16] bit addresses.
+ The low order 2 bits are preserved.
+ REL[24|14] : branches relative to the Instruction Address
+ register. These represent [26|16] bit addresses,
+ as before. The instruction field will be zero, and
+ the address of the SYM will be inserted at link time.
+ TOCREL16 : 16 bit displacement field referring to a slot in
+ toc.
+ TOCREL14 : 16 bit displacement field, similar to REL14 or ADDR14.
+ ADDR32NB : 32 bit address relative to the virtual origin.
+ (On the alpha, this is always a linker generated thunk)
+ (i.e. 32bit addr relative to the image base)
+ SECREL : The value is relative to the start of the section
+ containing the symbol.
+ SECTION : access to the header containing the item. Supports the
+ codeview debugger.
+
+ In particular, note that the document does not indicate that the
+ relocations listed in the header file are used. */
+
static reloc_howto_type ppc_coff_howto_table[] =
{
@@ -433,15 +427,15 @@ static reloc_howto_type ppc_coff_howto_table[] =
0, /* rightshift */
0, /* size (0 = byte, 1 = short, 2 = long) */
0, /* bitsize */
- false, /* pc_relative */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_dont, /* dont complain_on_overflow */
0, /* special_function */
"ABSOLUTE", /* name */
- false, /* partial_inplace */
+ FALSE, /* partial_inplace */
0x00, /* src_mask */
0x00, /* dst_mask */
- false), /* pcrel_offset */
+ FALSE), /* pcrel_offset */
/* IMAGE_REL_PPC_ADDR64 0x0001 64-bit address */
/* Unused: */
@@ -449,15 +443,15 @@ static reloc_howto_type ppc_coff_howto_table[] =
0, /* rightshift */
3, /* size (0 = byte, 1 = short, 2 = long) */
64, /* bitsize */
- false, /* pc_relative */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
0, /* special_function */
"ADDR64", /* name */
- true, /* partial_inplace */
+ TRUE, /* partial_inplace */
MINUS_ONE, /* src_mask */
MINUS_ONE, /* dst_mask */
- false), /* pcrel_offset */
+ FALSE), /* pcrel_offset */
/* IMAGE_REL_PPC_ADDR32 0x0002 32-bit address */
/* Used: */
@@ -465,15 +459,15 @@ static reloc_howto_type ppc_coff_howto_table[] =
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
32, /* bitsize */
- false, /* pc_relative */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
0, /* special_function */
"ADDR32", /* name */
- true, /* partial_inplace */
+ TRUE, /* partial_inplace */
0xffffffff, /* src_mask */
0xffffffff, /* dst_mask */
- false), /* pcrel_offset */
+ FALSE), /* pcrel_offset */
/* IMAGE_REL_PPC_ADDR24 0x0003 26-bit address, shifted left 2 (branch absolute) */
/* the LI field is in bit 6 through bit 29 is 24 bits, + 2 for the shift */
@@ -484,15 +478,15 @@ static reloc_howto_type ppc_coff_howto_table[] =
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
26, /* bitsize */
- false, /* pc_relative */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
0, /* special_function */
"ADDR24", /* name */
- true, /* partial_inplace */
+ TRUE, /* partial_inplace */
0x07fffffc, /* src_mask */
0x07fffffc, /* dst_mask */
- false), /* pcrel_offset */
+ FALSE), /* pcrel_offset */
/* IMAGE_REL_PPC_ADDR16 0x0004 16-bit address */
/* Used: */
@@ -500,15 +494,15 @@ static reloc_howto_type ppc_coff_howto_table[] =
0, /* rightshift */
1, /* size (0 = byte, 1 = short, 2 = long) */
16, /* bitsize */
- false, /* pc_relative */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_signed, /* complain_on_overflow */
0, /* special_function */
"ADDR16", /* name */
- true, /* partial_inplace */
+ TRUE, /* partial_inplace */
0xffff, /* src_mask */
0xffff, /* dst_mask */
- false), /* pcrel_offset */
+ FALSE), /* pcrel_offset */
/* IMAGE_REL_PPC_ADDR14 0x0005 */
/* 16-bit address, shifted left 2 (load doubleword) */
@@ -518,15 +512,15 @@ static reloc_howto_type ppc_coff_howto_table[] =
1, /* rightshift */
1, /* size (0 = byte, 1 = short, 2 = long) */
16, /* bitsize */
- false, /* pc_relative */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_signed, /* complain_on_overflow */
0, /* special_function */
"ADDR16", /* name */
- true, /* partial_inplace */
+ TRUE, /* partial_inplace */
0xffff, /* src_mask */
0xffff, /* dst_mask */
- false), /* pcrel_offset */
+ FALSE), /* pcrel_offset */
/* IMAGE_REL_PPC_REL24 0x0006 */
/* 26-bit PC-relative offset, shifted left 2 (branch relative) */
@@ -535,15 +529,15 @@ static reloc_howto_type ppc_coff_howto_table[] =
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
26, /* bitsize */
- true, /* pc_relative */
+ TRUE, /* pc_relative */
0, /* bitpos */
complain_overflow_signed, /* complain_on_overflow */
0, /* special_function */
"REL24", /* name */
- true, /* partial_inplace */
+ TRUE, /* partial_inplace */
0x3fffffc, /* src_mask */
0x3fffffc, /* dst_mask */
- false), /* pcrel_offset */
+ FALSE), /* pcrel_offset */
/* IMAGE_REL_PPC_REL14 0x0007 */
/* 16-bit PC-relative offset, shifted left 2 (br cond relative) */
@@ -554,15 +548,15 @@ static reloc_howto_type ppc_coff_howto_table[] =
1, /* rightshift */
1, /* size (0 = byte, 1 = short, 2 = long) */
16, /* bitsize */
- false, /* pc_relative */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_signed, /* complain_on_overflow */
0, /* special_function */
"ADDR16", /* name */
- true, /* partial_inplace */
+ TRUE, /* partial_inplace */
0xffff, /* src_mask */
0xffff, /* dst_mask */
- true), /* pcrel_offset */
+ TRUE), /* pcrel_offset */
/* IMAGE_REL_PPC_TOCREL16 0x0008 */
/* 16-bit offset from TOC base */
@@ -571,15 +565,15 @@ static reloc_howto_type ppc_coff_howto_table[] =
0, /* rightshift */
1, /* size (0 = byte, 1 = short, 2 = long) */
16, /* bitsize */
- false, /* pc_relative */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
ppc_toc16_reloc, /* special_function */
"TOCREL16", /* name */
- false, /* partial_inplace */
+ FALSE, /* partial_inplace */
0xffff, /* src_mask */
0xffff, /* dst_mask */
- false), /* pcrel_offset */
+ FALSE), /* pcrel_offset */
/* IMAGE_REL_PPC_TOCREL14 0x0009 */
/* 16-bit offset from TOC base, shifted left 2 (load doubleword) */
@@ -588,15 +582,15 @@ static reloc_howto_type ppc_coff_howto_table[] =
1, /* rightshift */
1, /* size (0 = byte, 1 = short, 2 = long) */
16, /* bitsize */
- false, /* pc_relative */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_signed, /* complain_on_overflow */
0, /* special_function */
"TOCREL14", /* name */
- false, /* partial_inplace */
+ FALSE, /* partial_inplace */
0xffff, /* src_mask */
0xffff, /* dst_mask */
- false), /* pcrel_offset */
+ FALSE), /* pcrel_offset */
/* IMAGE_REL_PPC_ADDR32NB 0x000A */
/* 32-bit addr w/ image base */
@@ -605,15 +599,15 @@ static reloc_howto_type ppc_coff_howto_table[] =
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
32, /* bitsize */
- false, /* pc_relative */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_signed, /* complain_on_overflow */
0, /* special_function */
"ADDR32NB", /* name */
- true, /* partial_inplace */
+ TRUE, /* partial_inplace */
0xffffffff, /* src_mask */
0xffffffff, /* dst_mask */
- false), /* pcrel_offset */
+ FALSE), /* pcrel_offset */
/* IMAGE_REL_PPC_SECREL 0x000B */
/* va of containing section (as in an image sectionhdr) */
@@ -622,15 +616,15 @@ static reloc_howto_type ppc_coff_howto_table[] =
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
32, /* bitsize */
- false, /* pc_relative */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_signed, /* complain_on_overflow */
ppc_secrel_reloc, /* special_function */
"SECREL", /* name */
- true, /* partial_inplace */
+ TRUE, /* partial_inplace */
0xffffffff, /* src_mask */
0xffffffff, /* dst_mask */
- true), /* pcrel_offset */
+ TRUE), /* pcrel_offset */
/* IMAGE_REL_PPC_SECTION 0x000C */
/* sectionheader number */
@@ -639,15 +633,15 @@ static reloc_howto_type ppc_coff_howto_table[] =
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
32, /* bitsize */
- false, /* pc_relative */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_signed, /* complain_on_overflow */
ppc_section_reloc, /* special_function */
"SECTION", /* name */
- true, /* partial_inplace */
+ TRUE, /* partial_inplace */
0xffffffff, /* src_mask */
0xffffffff, /* dst_mask */
- true), /* pcrel_offset */
+ TRUE), /* pcrel_offset */
/* IMAGE_REL_PPC_IFGLUE 0x000D */
/* substitute TOC restore instruction iff symbol is glue code */
@@ -656,15 +650,15 @@ static reloc_howto_type ppc_coff_howto_table[] =
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
32, /* bitsize */
- false, /* pc_relative */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_signed, /* complain_on_overflow */
0, /* special_function */
"IFGLUE", /* name */
- true, /* partial_inplace */
+ TRUE, /* partial_inplace */
0xffffffff, /* src_mask */
0xffffffff, /* dst_mask */
- false), /* pcrel_offset */
+ FALSE), /* pcrel_offset */
/* IMAGE_REL_PPC_IMGLUE 0x000E */
/* symbol is glue code; virtual address is TOC restore instruction */
@@ -673,15 +667,15 @@ static reloc_howto_type ppc_coff_howto_table[] =
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
32, /* bitsize */
- false, /* pc_relative */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
ppc_imglue_reloc, /* special_function */
"IMGLUE", /* name */
- false, /* partial_inplace */
+ FALSE, /* partial_inplace */
0xffffffff, /* src_mask */
0xffffffff, /* dst_mask */
- false), /* pcrel_offset */
+ FALSE), /* pcrel_offset */
/* IMAGE_REL_PPC_SECREL16 0x000F */
/* va of containing section (limited to 16 bits) */
@@ -690,15 +684,15 @@ static reloc_howto_type ppc_coff_howto_table[] =
0, /* rightshift */
1, /* size (0 = byte, 1 = short, 2 = long) */
16, /* bitsize */
- false, /* pc_relative */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_signed, /* complain_on_overflow */
0, /* special_function */
"SECREL16", /* name */
- true, /* partial_inplace */
+ TRUE, /* partial_inplace */
0xffff, /* src_mask */
0xffff, /* dst_mask */
- true), /* pcrel_offset */
+ TRUE), /* pcrel_offset */
/* IMAGE_REL_PPC_REFHI 0x0010 */
/* Unused: */
@@ -706,15 +700,15 @@ static reloc_howto_type ppc_coff_howto_table[] =
0, /* rightshift */
1, /* size (0 = byte, 1 = short, 2 = long) */
16, /* bitsize */
- false, /* pc_relative */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_signed, /* complain_on_overflow */
ppc_refhi_reloc, /* special_function */
"REFHI", /* name */
- true, /* partial_inplace */
+ TRUE, /* partial_inplace */
0xffffffff, /* src_mask */
0xffffffff, /* dst_mask */
- false), /* pcrel_offset */
+ FALSE), /* pcrel_offset */
/* IMAGE_REL_PPC_REFLO 0x0011 */
/* Unused: */
@@ -722,15 +716,15 @@ static reloc_howto_type ppc_coff_howto_table[] =
0, /* rightshift */
1, /* size (0 = byte, 1 = short, 2 = long) */
16, /* bitsize */
- false, /* pc_relative */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_signed, /* complain_on_overflow */
ppc_refhi_reloc, /* special_function */
"REFLO", /* name */
- true, /* partial_inplace */
+ TRUE, /* partial_inplace */
0xffffffff, /* src_mask */
0xffffffff, /* dst_mask */
- false), /* pcrel_offset */
+ FALSE), /* pcrel_offset */
/* IMAGE_REL_PPC_PAIR 0x0012 */
/* Unused: */
@@ -738,15 +732,15 @@ static reloc_howto_type ppc_coff_howto_table[] =
0, /* rightshift */
1, /* size (0 = byte, 1 = short, 2 = long) */
16, /* bitsize */
- false, /* pc_relative */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_signed, /* complain_on_overflow */
ppc_pair_reloc, /* special_function */
"PAIR", /* name */
- true, /* partial_inplace */
+ TRUE, /* partial_inplace */
0xffffffff, /* src_mask */
0xffffffff, /* dst_mask */
- false), /* pcrel_offset */
+ FALSE), /* pcrel_offset */
/* IMAGE_REL_PPC_TOCREL16_DEFN 0x0013 */
/* 16-bit offset from TOC base, without causing a definition */
@@ -755,19 +749,19 @@ static reloc_howto_type ppc_coff_howto_table[] =
0, /* rightshift */
1, /* size (0 = byte, 1 = short, 2 = long) */
16, /* bitsize */
- false, /* pc_relative */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
0, /* special_function */
"TOCREL16, TOCDEFN", /* name */
- false, /* partial_inplace */
+ FALSE, /* partial_inplace */
0xffff, /* src_mask */
0xffff, /* dst_mask */
- false), /* pcrel_offset */
+ FALSE), /* pcrel_offset */
};
-/* Some really cheezy macros that can be turned on to test stderr :-) */
+/* Some really cheezy macros that can be turned on to test stderr :-) */
#ifdef DEBUG_RELOC
#define UN_IMPL(x) \
@@ -792,16 +786,14 @@ static reloc_howto_type ppc_coff_howto_table[] =
#define n_name _n._n_name
#define n_zeroes _n._n_n._n_zeroes
-#define n_offset _n._n_n._n_offset
-
-*/
+#define n_offset _n._n_n._n_offset */
-#define DUMP_RELOC2(n,r) \
-{ \
- fprintf (stderr,"%s sym %d, r_vaddr %d %s\n", \
- n, r->r_symndx, r->r_vaddr,\
+#define DUMP_RELOC2(n,r) \
+{ \
+ fprintf (stderr,"%s sym %d, r_vaddr %d %s\n", \
+ n, r->r_symndx, r->r_vaddr, \
(((r->r_type) & IMAGE_REL_PPC_TOCDEFN) == 0) \
- ?" ":" TOCDEFN" ); \
+ ?" ":" TOCDEFN" ); \
}
#else
@@ -810,14 +802,13 @@ static reloc_howto_type ppc_coff_howto_table[] =
#define DUMP_RELOC2(n,r)
#endif
-/* toc construction and management routines */
+/* TOC construction and management routines. */
/* This file is compiled twice, and these variables are defined in one
of the compilations. FIXME: This is confusing and weird. Also,
BFD should not use global variables. */
-extern bfd* bfd_of_toc_owner;
+extern bfd * bfd_of_toc_owner;
extern long int global_toc_size;
-
extern long int import_table_size;
extern long int first_thunk_address;
extern long int thunk_size;
@@ -858,7 +849,7 @@ record_toc (toc_section, our_toc_offset, cat, name)
enum ref_category cat;
const char *name;
{
- /* add this entry to our toc addr-offset-name list */
+ /* Add this entry to our toc addr-offset-name list. */
bfd_size_type amt = sizeof (struct list_ele);
struct list_ele *t = (struct list_ele *) bfd_malloc (amt);
@@ -884,13 +875,13 @@ record_toc (toc_section, our_toc_offset, cat, name)
#ifdef COFF_IMAGE_WITH_PE
-static boolean ppc_record_toc_entry
+static bfd_boolean ppc_record_toc_entry
PARAMS ((bfd *, struct bfd_link_info *, asection *, int, enum toc_type));
static void ppc_mark_symbol_as_glue
PARAMS ((bfd *, int, struct internal_reloc *));
-/* record a toc offset against a symbol */
-static boolean
+/* Record a toc offset against a symbol. */
+static bfd_boolean
ppc_record_toc_entry(abfd, info, sec, sym, toc_kind)
bfd *abfd;
struct bfd_link_info *info ATTRIBUTE_UNUSED;
@@ -914,16 +905,19 @@ ppc_record_toc_entry(abfd, info, sec, sym, toc_kind)
if (h == 0)
{
local_syms = obj_coff_local_toc_table(abfd);
+
if (local_syms == 0)
{
unsigned int i;
bfd_size_type amt;
+
/* allocate a table */
amt = (bfd_size_type) obj_raw_syment_count (abfd) * sizeof (int);
local_syms = (int *) bfd_zalloc (abfd, amt);
if (local_syms == 0)
- return false;
+ return FALSE;
obj_coff_local_toc_table (abfd) = local_syms;
+
for (i = 0; i < obj_raw_syment_count (abfd); ++i)
{
SET_UNALLOCATED (local_syms[i]);
@@ -935,12 +929,12 @@ ppc_record_toc_entry(abfd, info, sec, sym, toc_kind)
local_syms[sym] = global_toc_size;
global_toc_size += 4;
- /* The size must fit in a 16bit displacment */
+ /* The size must fit in a 16-bit displacement. */
if (global_toc_size > 65535)
{
(*_bfd_error_handler) (_("TOC overflow"));
bfd_set_error (bfd_error_file_too_big);
- return false;
+ return FALSE;
}
}
}
@@ -948,27 +942,27 @@ ppc_record_toc_entry(abfd, info, sec, sym, toc_kind)
{
name = h->root.root.root.string;
- /* check to see if there's a toc slot allocated. If not, do it
- here. It will be used in relocate_section */
+ /* Check to see if there's a toc slot allocated. If not, do it
+ here. It will be used in relocate_section. */
if (IS_UNALLOCATED(h->toc_offset))
{
h->toc_offset = global_toc_size;
global_toc_size += 4;
- /* The size must fit in a 16bit displacment */
+ /* The size must fit in a 16-bit displacement. */
if (global_toc_size >= 65535)
{
(*_bfd_error_handler) (_("TOC overflow"));
bfd_set_error (bfd_error_file_too_big);
- return false;
+ return FALSE;
}
}
}
- return true;
+ return TRUE;
}
-/* record a toc offset against a symbol */
+/* Record a toc offset against a symbol. */
static void
ppc_mark_symbol_as_glue(abfd, sym, rel)
bfd *abfd;
@@ -989,10 +983,10 @@ ppc_mark_symbol_as_glue(abfd, sym, rel)
#endif /* COFF_IMAGE_WITH_PE */
-/* Return true if this relocation should
+/* Return TRUE if this relocation should
appear in the output .reloc section. */
-static boolean in_reloc_p(abfd, howto)
+static bfd_boolean in_reloc_p(abfd, howto)
bfd * abfd ATTRIBUTE_UNUSED;
reloc_howto_type *howto;
{
@@ -1013,9 +1007,9 @@ static boolean in_reloc_p(abfd, howto)
#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) */
+/* 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,
@@ -1028,9 +1022,9 @@ pe_ppc_reloc (abfd, reloc_entry, symbol_in, data, input_section, output_bfd,
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 boolean part1_consth_active = false;
+ /* 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;
@@ -1041,7 +1035,7 @@ pe_ppc_reloc (abfd, reloc_entry, symbol_in, data, input_section, output_bfd,
if (output_bfd)
{
- /* Partial linking - do nothing */
+ /* Partial linking - do nothing. */
reloc_entry->address += input_section->output_offset;
return bfd_reloc_ok;
}
@@ -1049,10 +1043,10 @@ pe_ppc_reloc (abfd, reloc_entry, symbol_in, data, input_section, output_bfd,
if (symbol_in != NULL
&& bfd_is_und_section (symbol_in->section))
{
- /* Keep the state machine happy in case we're called again */
+ /* Keep the state machine happy in case we're called again. */
if (r_type == IMAGE_REL_PPC_REFHI)
{
- part1_consth_active = true;
+ part1_consth_active = TRUE;
part1_consth_value = 0;
}
return(bfd_reloc_undefined);
@@ -1060,7 +1054,7 @@ pe_ppc_reloc (abfd, reloc_entry, symbol_in, data, input_section, output_bfd,
if ((part1_consth_active) && (r_type != IMAGE_REL_PPC_PAIR))
{
- part1_consth_active = false;
+ part1_consth_active = FALSE;
*error_message = (char *) _("Missing PAIR");
return(bfd_reloc_dangerous);
}
@@ -1074,7 +1068,7 @@ pe_ppc_reloc (abfd, reloc_entry, symbol_in, data, input_section, output_bfd,
/* The reloc processing routine for the optimized COFF linker. */
-static boolean
+static bfd_boolean
coff_ppc_relocate_section (output_bfd, info, input_bfd, input_section,
contents, relocs, syms, sections)
bfd *output_bfd;
@@ -1088,19 +1082,19 @@ coff_ppc_relocate_section (output_bfd, info, input_bfd, input_section,
{
struct internal_reloc *rel;
struct internal_reloc *relend;
- boolean hihalf;
+ bfd_boolean hihalf;
bfd_vma hihalf_val;
asection *toc_section = 0;
bfd_vma relocation;
reloc_howto_type *howto = 0;
- /* If we are performing a relocateable link, we don't need to do a
+ /* If we are performing a relocatable link, we don't need to do a
thing. The caller will take care of adjusting the reloc
addresses and symbol indices. */
- if (info->relocateable)
- return true;
+ if (info->relocatable)
+ return TRUE;
- hihalf = false;
+ hihalf = FALSE;
hihalf_val = 0;
rel = relocs;
@@ -1151,7 +1145,7 @@ coff_ppc_relocate_section (output_bfd, info, input_bfd, input_section,
sec = NULL;
val = 0;
- /* FIXME: PAIR unsupported in the following code */
+ /* FIXME: PAIR unsupported in the following code. */
if (h == NULL)
{
if (symndx == -1)
@@ -1182,14 +1176,14 @@ coff_ppc_relocate_section (output_bfd, info, input_bfd, input_section,
{
if (! ((*info->callbacks->undefined_symbol)
(info, h->root.root.root.string, input_bfd, input_section,
- rel->r_vaddr - input_section->vma, true)))
- return false;
+ rel->r_vaddr - input_section->vma, TRUE)))
+ return FALSE;
}
}
rstat = bfd_reloc_ok;
- /* Each case must do its own relocation, setting rstat appropriately */
+ /* Each case must do its own relocation, setting rstat appropriately. */
switch (r_type)
{
default:
@@ -1197,7 +1191,7 @@ coff_ppc_relocate_section (output_bfd, info, input_bfd, input_section,
(_("%s: unsupported relocation type 0x%02x"),
bfd_archive_filename (input_bfd), r_type);
bfd_set_error (bfd_error_bad_value);
- return false;
+ return FALSE;
case IMAGE_REL_PPC_TOCREL16:
{
bfd_signed_vma our_toc_offset;
@@ -1217,16 +1211,15 @@ coff_ppc_relocate_section (output_bfd, info, input_bfd, input_section,
}
}
- /*
- * Amazing bit tricks present. As we may have seen earlier, we
- * use the 1 bit to tell us whether or not a toc offset has been
- * allocated. Now that they've all been allocated, we will use
- * the 1 bit to tell us if we've written this particular toc
- * entry out.
- */
- fixit = false;
+ /* Amazing bit tricks present. As we may have seen earlier, we
+ use the 1 bit to tell us whether or not a toc offset has been
+ allocated. Now that they've all been allocated, we will use
+ the 1 bit to tell us if we've written this particular toc
+ entry out. */
+ fixit = FALSE;
if (h == 0)
- { /* it is a file local symbol */
+ {
+ /* It is a file local symbol. */
int *local_toc_table;
const char *name;
@@ -1238,15 +1231,14 @@ coff_ppc_relocate_section (output_bfd, info, input_bfd, input_section,
if (IS_WRITTEN(our_toc_offset))
{
- /* if it has been written out, it is marked with the
+ /* If it has been written out, it is marked with the
1 bit. Fix up our offset, but do not write it out
- again.
- */
+ again. */
MAKE_ADDR_AGAIN(our_toc_offset);
}
else
{
- /* write out the toc entry */
+ /* Write out the toc entry. */
record_toc (toc_section, our_toc_offset, priv,
strdup (name));
@@ -1254,7 +1246,7 @@ coff_ppc_relocate_section (output_bfd, info, input_bfd, input_section,
toc_section->contents + our_toc_offset);
MARK_AS_WRITTEN(local_toc_table[symndx]);
- fixit = true;
+ fixit = TRUE;
}
}
else
@@ -1277,13 +1269,12 @@ coff_ppc_relocate_section (output_bfd, info, input_bfd, input_section,
Import Address Table is mapped immediately following
the toc, some trippy library code trying for speed on
dll linkage, takes advantage of that and considers
- the IAT to be part of the toc, thus saving a load.
- */
+ the IAT to be part of the toc, thus saving a load. */
our_toc_offset = val - (toc_section->output_section->vma
+ toc_section->output_offset);
- /* The size must still fit in a 16bit displacment */
+ /* The size must still fit in a 16-bit displacement. */
if ((bfd_vma) our_toc_offset >= 65535)
{
(*_bfd_error_handler)
@@ -1291,18 +1282,17 @@ coff_ppc_relocate_section (output_bfd, info, input_bfd, input_section,
bfd_archive_filename (input_bfd), name,
(unsigned long) our_toc_offset);
bfd_set_error (bfd_error_bad_value);
- return false;
+ return FALSE;
}
record_toc (toc_section, our_toc_offset, pub,
strdup (name));
}
- else if (IS_WRITTEN(our_toc_offset))
+ else if (IS_WRITTEN (our_toc_offset))
{
- /* if it has been written out, it is marked with the
+ /* If it has been written out, it is marked with the
1 bit. Fix up our offset, but do not write it out
- again.
- */
+ again. */
MAKE_ADDR_AGAIN(our_toc_offset);
}
else
@@ -1310,36 +1300,35 @@ coff_ppc_relocate_section (output_bfd, info, input_bfd, input_section,
record_toc(toc_section, our_toc_offset, pub,
strdup (name));
- /* write out the toc entry */
+ /* Write out the toc entry. */
bfd_put_32 (output_bfd, val,
toc_section->contents + our_toc_offset);
MARK_AS_WRITTEN(h->toc_offset);
- /* The tricky part is that this is the address that */
- /* needs a .reloc entry for it */
- fixit = true;
+ /* The tricky part is that this is the address that
+ needs a .reloc entry for it. */
+ fixit = TRUE;
}
}
if (fixit && info->base_file)
{
/* So if this is non pcrelative, and is referenced
- to a section or a common symbol, then it needs a reloc */
+ to a section or a common symbol, then it needs a reloc. */
- /* relocation to a symbol in a section which
+ /* Relocation to a symbol in a section which
isn't absolute - we output the address here
- to a file */
-
+ to a file. */
bfd_vma addr = (toc_section->output_section->vma
+ toc_section->output_offset + our_toc_offset);
- if (coff_data(output_bfd)->pe)
+ if (coff_data (output_bfd)->pe)
addr -= pe_data(output_bfd)->pe_opthdr.ImageBase;
fwrite (&addr, 1,4, (FILE *) info->base_file);
}
- /* FIXME: this test is conservative */
+ /* 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)
{
@@ -1348,24 +1337,24 @@ coff_ppc_relocate_section (output_bfd, info, input_bfd, input_section,
bfd_archive_filename (input_bfd),
(unsigned long) toc_section->_raw_size);
bfd_set_error (bfd_error_bad_value);
- return false;
+ return FALSE;
}
- /* Now we know the relocation for this toc reference */
+ /* Now we know the relocation for this toc reference. */
relocation = our_toc_offset + TOC_LOAD_ADJUSTMENT;
rstat = _bfd_relocate_contents (howto, input_bfd, relocation, loc);
}
break;
case IMAGE_REL_PPC_IFGLUE:
{
- /* To solve this, we need to know whether or not the symbol */
- /* appearing on the call instruction is a glue function or not. */
- /* A glue function must announce itself via a IMGLUE reloc, and */
- /* the reloc contains the required toc restore instruction */
-
+ /* To solve this, we need to know whether or not the symbol
+ appearing on the call instruction is a glue function or not.
+ A glue function must announce itself via a IMGLUE reloc, and
+ the reloc contains the required toc restore instruction. */
bfd_vma x;
const char *my_name;
- DUMP_RELOC2(howto->name, rel);
+
+ DUMP_RELOC2 (howto->name, rel);
if (h != 0)
{
@@ -1379,25 +1368,24 @@ coff_ppc_relocate_section (output_bfd, info, input_bfd, input_section,
}
break;
case IMAGE_REL_PPC_SECREL:
- /* Unimplemented: codeview debugging information */
+ /* Unimplemented: codeview debugging information. */
/* For fast access to the header of the section
containing the item. */
break;
case IMAGE_REL_PPC_SECTION:
- /* Unimplemented: codeview debugging information */
+ /* Unimplemented: codeview debugging information. */
/* Is used to indicate that the value should be relative
to the beginning of the section that contains the
- symbol */
+ symbol. */
break;
case IMAGE_REL_PPC_ABSOLUTE:
{
const char *my_name;
+
if (h == 0)
- my_name = (syms+symndx)->_n._n_name;
+ my_name = (syms+symndx)->_n._n_name;
else
- {
- my_name = h->root.root.root.string;
- }
+ my_name = h->root.root.root.string;
fprintf (stderr,
_("Warning: unsupported reloc %s <file %s, section %s>\n"),
@@ -1413,8 +1401,9 @@ coff_ppc_relocate_section (output_bfd, info, input_bfd, input_section,
case IMAGE_REL_PPC_IMGLUE:
{
/* There is nothing to do now. This reloc was noted in the first
- pass over the relocs, and the glue instruction extracted */
+ pass over the relocs, and the glue instruction extracted. */
const char *my_name;
+
if (h->symbol_is_glue == 1)
break;
my_name = h->root.root.root.string;
@@ -1423,22 +1412,24 @@ coff_ppc_relocate_section (output_bfd, info, input_bfd, input_section,
(_("%s: Out of order IMGLUE reloc for %s"),
bfd_archive_filename (input_bfd), my_name);
bfd_set_error (bfd_error_bad_value);
- return false;
+ return FALSE;
}
case IMAGE_REL_PPC_ADDR32NB:
{
const char *name = 0;
- DUMP_RELOC2(howto->name, rel);
+
+ DUMP_RELOC2 (howto->name, rel);
if (strncmp(".idata$2",input_section->name,8) == 0 && first_thunk_address == 0)
{
- /* set magic values */
+ /* Set magic values. */
int idata5offset;
struct coff_link_hash_entry *myh;
+
myh = coff_link_hash_lookup (coff_hash_table (info),
"__idata5_magic__",
- false, false, true);
+ FALSE, FALSE, TRUE);
first_thunk_address = myh->root.u.def.value +
sec->output_section->vma +
sec->output_offset -
@@ -1447,17 +1438,18 @@ coff_ppc_relocate_section (output_bfd, info, input_bfd, input_section,
idata5offset = myh->root.u.def.value;
myh = coff_link_hash_lookup (coff_hash_table (info),
"__idata6_magic__",
- false, false, true);
+ FALSE, FALSE, TRUE);
thunk_size = myh->root.u.def.value - idata5offset;
myh = coff_link_hash_lookup (coff_hash_table (info),
"__idata4_magic__",
- false, false, true);
+ FALSE, FALSE, TRUE);
import_table_size = myh->root.u.def.value;
}
if (h == 0)
- { /* it is a file local symbol */
+ {
+ /* It is a file local symbol. */
sym = syms + symndx;
name = sym->_n._n_name;
}
@@ -1466,11 +1458,11 @@ coff_ppc_relocate_section (output_bfd, info, input_bfd, input_section,
char *target = 0;
name = h->root.root.root.string;
- if (strcmp(".idata$2", name) == 0)
+ if (strcmp (".idata$2", name) == 0)
target = "__idata2_magic__";
- else if (strcmp(".idata$4", name) == 0)
+ else if (strcmp (".idata$4", name) == 0)
target = "__idata4_magic__";
- else if (strcmp(".idata$5", name) == 0)
+ else if (strcmp (".idata$5", name) == 0)
target = "__idata5_magic__";
if (target != 0)
@@ -1479,7 +1471,7 @@ coff_ppc_relocate_section (output_bfd, info, input_bfd, input_section,
myh = coff_link_hash_lookup (coff_hash_table (info),
target,
- false, false, true);
+ FALSE, FALSE, TRUE);
if (myh == 0)
{
/* Missing magic cookies. Something is very wrong. */
@@ -1493,7 +1485,7 @@ coff_ppc_relocate_section (output_bfd, info, input_bfd, input_section,
int idata5offset;
myh = coff_link_hash_lookup (coff_hash_table (info),
"__idata5_magic__",
- false, false, true);
+ FALSE, FALSE, TRUE);
first_thunk_address = myh->root.u.def.value +
sec->output_section->vma +
sec->output_offset -
@@ -1502,22 +1494,22 @@ coff_ppc_relocate_section (output_bfd, info, input_bfd, input_section,
idata5offset = myh->root.u.def.value;
myh = coff_link_hash_lookup (coff_hash_table (info),
"__idata6_magic__",
- false, false, true);
+ FALSE, FALSE, TRUE);
thunk_size = myh->root.u.def.value - idata5offset;
myh = coff_link_hash_lookup (coff_hash_table (info),
"__idata4_magic__",
- false, false, true);
+ FALSE, FALSE, TRUE);
import_table_size = myh->root.u.def.value;
}
}
}
rstat = _bfd_relocate_contents (howto,
- input_bfd,
- val -
- pe_data(output_bfd)->pe_opthdr.ImageBase,
- loc);
+ input_bfd,
+ val -
+ pe_data (output_bfd)->pe_opthdr.ImageBase,
+ loc);
}
break;
@@ -1542,24 +1534,23 @@ coff_ppc_relocate_section (output_bfd, info, input_bfd, input_section,
break;
}
- if ( info->base_file )
+ if (info->base_file)
{
/* So if this is non pcrelative, and is referenced
- to a section or a common symbol, then it needs a reloc */
- if (sym && pe_data(output_bfd)->in_reloc_p(output_bfd, howto))
+ to a section or a common symbol, then it needs a reloc. */
+ if (sym && pe_data(output_bfd)->in_reloc_p (output_bfd, howto))
{
- /* relocation to a symbol in a section which
+ /* Relocation to a symbol in a section which
isn't absolute - we output the address here
- to a file */
+ to a file. */
bfd_vma addr = rel->r_vaddr
- input_section->vma
+ input_section->output_offset
+ input_section->output_section->vma;
- if (coff_data(output_bfd)->pe)
- {
- addr -= pe_data(output_bfd)->pe_opthdr.ImageBase;
- }
+ if (coff_data (output_bfd)->pe)
+ addr -= pe_data (output_bfd)->pe_opthdr.ImageBase;
+
fwrite (&addr, 1,4, (FILE *) info->base_file);
}
}
@@ -1595,15 +1586,12 @@ coff_ppc_relocate_section (output_bfd, info, input_bfd, input_section,
(info, name, howto->name,
(bfd_vma) 0, input_bfd,
input_section, rel->r_vaddr - input_section->vma)))
- {
- return false;
- }
+ return FALSE;
}
}
-
}
- return true;
+ return TRUE;
}
#ifdef COFF_IMAGE_WITH_PE
@@ -1677,7 +1665,7 @@ dump_toc (vfile)
fprintf (file, "\n");
}
-boolean
+bfd_boolean
ppc_allocate_toc_section (info)
struct bfd_link_info *info ATTRIBUTE_UNUSED;
{
@@ -1686,21 +1674,17 @@ ppc_allocate_toc_section (info)
bfd_size_type amt;
static char test_char = '1';
- if ( global_toc_size == 0 ) /* FIXME: does this get me in trouble? */
- return true;
+ if ( global_toc_size == 0 ) /* FIXME: does this get me in trouble? */
+ return TRUE;
if (bfd_of_toc_owner == 0)
- {
- /* No toc owner? Something is very wrong. */
- abort ();
- }
+ /* No toc owner? Something is very wrong. */
+ abort ();
s = bfd_get_section_by_name ( bfd_of_toc_owner , TOC_SECTION_NAME);
if (s == NULL)
- {
- /* No toc section? Something is very wrong. */
- abort ();
- }
+ /* No toc section? Something is very wrong. */
+ abort ();
amt = global_toc_size;
foo = (bfd_byte *) bfd_alloc (bfd_of_toc_owner, amt);
@@ -1709,10 +1693,10 @@ ppc_allocate_toc_section (info)
s->_raw_size = s->_cooked_size = global_toc_size;
s->contents = foo;
- return true;
+ return TRUE;
}
-boolean
+bfd_boolean
ppc_process_before_allocation (abfd, info)
bfd *abfd;
struct bfd_link_info *info;
@@ -1720,72 +1704,64 @@ ppc_process_before_allocation (abfd, info)
asection *sec;
struct internal_reloc *i, *rel;
- /* here we have a bfd that is to be included on the link. We have a hook
+ /* 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);
- _bfd_coff_get_external_symbols(abfd);
-
- /* rummage around all the relocs and map the toc */
+ /* Rummage around all the relocs and map the toc. */
sec = abfd->sections;
if (sec == 0)
- {
- return true;
- }
+ return TRUE;
for (; sec != 0; sec = sec->next)
- {
- if (sec->reloc_count == 0)
- continue;
+ {
+ if (sec->reloc_count == 0)
+ continue;
- /* load the relocs */
- /* FIXME: there may be a storage leak here */
- i=_bfd_coff_read_internal_relocs(abfd,sec,1,0,0,0);
+ /* load the relocs */
+ /* FIXME: there may be a storage leak here */
+ i=_bfd_coff_read_internal_relocs(abfd,sec,1,0,0,0);
- if (i == 0)
- abort ();
+ if (i == 0)
+ abort ();
- for (rel=i;rel<i+sec->reloc_count;++rel)
- {
- unsigned short r_type = EXTRACT_TYPE (rel->r_type);
- unsigned short r_flags = EXTRACT_FLAGS(rel->r_type);
- boolean ok = true;
+ for (rel = i; rel < i + sec->reloc_count; ++rel)
+ {
+ unsigned short r_type = EXTRACT_TYPE (rel->r_type);
+ unsigned short r_flags = EXTRACT_FLAGS (rel->r_type);
+ bfd_boolean ok = TRUE;
- DUMP_RELOC2(ppc_coff_howto_table[r_type].name, rel);
+ DUMP_RELOC2 (ppc_coff_howto_table[r_type].name, rel);
- switch(r_type)
- {
- case IMAGE_REL_PPC_TOCREL16:
- /* if TOCDEFN is on, ignore as someone else has allocated the
- toc entry */
- if ( (r_flags & IMAGE_REL_PPC_TOCDEFN) != IMAGE_REL_PPC_TOCDEFN )
- ok = ppc_record_toc_entry(abfd, info, sec,
- rel->r_symndx, default_toc);
- if (!ok)
- return false;
- break;
- case IMAGE_REL_PPC_IMGLUE:
- ppc_mark_symbol_as_glue(abfd, rel->r_symndx, rel);
- break;
- default:
- break;
- }
- }
- }
+ switch(r_type)
+ {
+ case IMAGE_REL_PPC_TOCREL16:
+ /* If TOCDEFN is on, ignore as someone else has allocated the
+ toc entry. */
+ if ((r_flags & IMAGE_REL_PPC_TOCDEFN) != IMAGE_REL_PPC_TOCDEFN)
+ ok = ppc_record_toc_entry(abfd, info, sec,
+ rel->r_symndx, default_toc);
+ if (!ok)
+ return FALSE;
+ break;
+ case IMAGE_REL_PPC_IMGLUE:
+ ppc_mark_symbol_as_glue (abfd, rel->r_symndx, rel);
+ break;
+ default:
+ break;
+ }
+ }
+ }
- return true;
+ return TRUE;
}
#endif
static bfd_reloc_status_type
-ppc_refhi_reloc (abfd,
- reloc_entry,
- symbol,
- data,
- input_section,
- output_bfd,
- error_message)
+ppc_refhi_reloc (abfd, reloc_entry, symbol, data,
+ input_section, output_bfd, error_message)
bfd *abfd ATTRIBUTE_UNUSED;
arelent *reloc_entry ATTRIBUTE_UNUSED;
asymbol *symbol ATTRIBUTE_UNUSED;
@@ -1806,13 +1782,8 @@ ppc_refhi_reloc (abfd,
#if 0
static bfd_reloc_status_type
-ppc_reflo_reloc (abfd,
- reloc_entry,
- symbol,
- data,
- input_section,
- output_bfd,
- error_message)
+ppc_reflo_reloc (abfd, reloc_entry, symbol, data,
+ input_section, output_bfd, error_message)
bfd *abfd;
arelent *reloc_entry;
asymbol *symbol;
@@ -1833,13 +1804,8 @@ ppc_reflo_reloc (abfd,
#endif
static bfd_reloc_status_type
-ppc_pair_reloc (abfd,
- reloc_entry,
- symbol,
- data,
- input_section,
- output_bfd,
- error_message)
+ppc_pair_reloc (abfd, reloc_entry, symbol, data,
+ input_section, output_bfd, error_message)
bfd *abfd ATTRIBUTE_UNUSED;
arelent *reloc_entry ATTRIBUTE_UNUSED;
asymbol *symbol ATTRIBUTE_UNUSED;
@@ -1858,13 +1824,8 @@ ppc_pair_reloc (abfd,
}
static bfd_reloc_status_type
-ppc_toc16_reloc (abfd,
- reloc_entry,
- symbol,
- data,
- input_section,
- output_bfd,
- error_message)
+ppc_toc16_reloc (abfd, reloc_entry, symbol, data,
+ input_section, output_bfd, error_message)
bfd *abfd ATTRIBUTE_UNUSED;
arelent *reloc_entry ATTRIBUTE_UNUSED;
asymbol *symbol ATTRIBUTE_UNUSED;
@@ -1873,33 +1834,24 @@ ppc_toc16_reloc (abfd,
bfd *output_bfd;
char **error_message ATTRIBUTE_UNUSED;
{
- UN_IMPL("TOCREL16");
- DUMP_RELOC("TOCREL16",reloc_entry);
+ UN_IMPL ("TOCREL16");
+ DUMP_RELOC ("TOCREL16",reloc_entry);
if (output_bfd == (bfd *) NULL)
- {
- return bfd_reloc_continue;
- }
+ return bfd_reloc_continue;
return bfd_reloc_ok;
}
#if 0
-/* ADDR32NB : 32 bit address relative to the virtual origin. */
-/* (On the alpha, this is always a linker generated thunk)*/
-/* (i.e. 32bit addr relative to the image base) */
-/* */
-/* */
+/* 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)
+ppc_addr32nb_reloc (abfd, reloc_entry, symbol, data,
+ input_section, output_bfd, error_message)
bfd *abfd;
arelent *reloc_entry;
asymbol *symbol;
@@ -1917,13 +1869,8 @@ ppc_addr32nb_reloc (abfd,
#endif
static bfd_reloc_status_type
-ppc_secrel_reloc (abfd,
- reloc_entry,
- symbol,
- data,
- input_section,
- output_bfd,
- error_message)
+ppc_secrel_reloc (abfd, reloc_entry, symbol, data,
+ input_section, output_bfd, error_message)
bfd *abfd ATTRIBUTE_UNUSED;
arelent *reloc_entry ATTRIBUTE_UNUSED;
asymbol *symbol ATTRIBUTE_UNUSED;
@@ -1942,13 +1889,8 @@ ppc_secrel_reloc (abfd,
}
static bfd_reloc_status_type
-ppc_section_reloc (abfd,
- reloc_entry,
- symbol,
- data,
- input_section,
- output_bfd,
- error_message)
+ppc_section_reloc (abfd, reloc_entry, symbol, data,
+ input_section, output_bfd, error_message)
bfd *abfd ATTRIBUTE_UNUSED;
arelent *reloc_entry ATTRIBUTE_UNUSED;
asymbol *symbol ATTRIBUTE_UNUSED;
@@ -1967,13 +1909,8 @@ ppc_section_reloc (abfd,
}
static bfd_reloc_status_type
-ppc_imglue_reloc (abfd,
- reloc_entry,
- symbol,
- data,
- input_section,
- output_bfd,
- error_message)
+ppc_imglue_reloc (abfd, reloc_entry, symbol, data,
+ input_section, output_bfd, error_message)
bfd *abfd ATTRIBUTE_UNUSED;
arelent *reloc_entry ATTRIBUTE_UNUSED;
asymbol *symbol ATTRIBUTE_UNUSED;
@@ -1994,19 +1931,16 @@ ppc_imglue_reloc (abfd,
#define MAX_RELOC_INDEX \
(sizeof (ppc_coff_howto_table) / sizeof (ppc_coff_howto_table[0]) - 1)
-/* FIXME: There is a possiblity that when we read in a reloc from a file,
+/* FIXME: There is a possibility that when we read in a reloc from a file,
that there are some bits encoded in the upper portion of the
- type field. Not yet implemented.
-*/
-static void ppc_coff_rtype2howto PARAMS ((arelent *relent,
- struct internal_reloc *internal));
+ type field. Not yet implemented. */
+static void ppc_coff_rtype2howto PARAMS ((arelent *, struct internal_reloc *));
static void
ppc_coff_rtype2howto (relent, internal)
arelent *relent;
struct internal_reloc *internal;
{
-
/* We can encode one of three things in the type field, aside from the
type:
1. IMAGE_REL_PPC_NEG - indicates the value field is a subtraction
@@ -2015,19 +1949,18 @@ ppc_coff_rtype2howto (relent, internal)
the branch is expected to be taken or not.
3. IMAGE_REL_PPC_TOCDEFN - toc slot definition in the file
For now, we just strip this stuff to find the type, and ignore it other
- than that.
- */
+ than that. */
reloc_howto_type *howto;
unsigned short r_type = EXTRACT_TYPE (internal->r_type);
unsigned short r_flags = EXTRACT_FLAGS(internal->r_type);
unsigned short junk = EXTRACT_JUNK (internal->r_type);
- /* the masking process only slices off the bottom byte for r_type. */
+ /* The masking process only slices off the bottom byte for r_type. */
if ( r_type > MAX_RELOC_INDEX )
abort ();
- /* check for absolute crap */
- if ( junk != 0 )
+ /* Check for absolute crap. */
+ if (junk != 0)
abort ();
switch(r_type)
@@ -2040,15 +1973,15 @@ ppc_coff_rtype2howto (relent, internal)
case IMAGE_REL_PPC_ADDR32NB:
case IMAGE_REL_PPC_SECTION:
case IMAGE_REL_PPC_SECREL:
- DUMP_RELOC2(ppc_coff_howto_table[r_type].name, internal);
+ DUMP_RELOC2 (ppc_coff_howto_table[r_type].name, internal);
howto = ppc_coff_howto_table + r_type;
break;
case IMAGE_REL_PPC_IMGLUE:
- DUMP_RELOC2(ppc_coff_howto_table[r_type].name, internal);
+ DUMP_RELOC2 (ppc_coff_howto_table[r_type].name, internal);
howto = ppc_coff_howto_table + r_type;
break;
case IMAGE_REL_PPC_TOCREL16:
- DUMP_RELOC2(ppc_coff_howto_table[r_type].name, internal);
+ DUMP_RELOC2 (ppc_coff_howto_table[r_type].name, internal);
if (r_flags & IMAGE_REL_PPC_TOCDEFN)
howto = ppc_coff_howto_table + IMAGE_REL_PPC_TOCREL16_DEFN;
else
@@ -2064,7 +1997,6 @@ ppc_coff_rtype2howto (relent, internal)
}
relent->howto = howto;
-
}
static reloc_howto_type *
@@ -2086,19 +2018,18 @@ coff_ppc_rtype_to_howto (abfd, sec, rel, h, sym, addendp)
the branch is expected to be taken or not.
3. IMAGE_REL_PPC_TOCDEFN - toc slot definition in the file
For now, we just strip this stuff to find the type, and ignore it other
- than that.
- */
+ than that. */
- unsigned short r_type = EXTRACT_TYPE (rel->r_type);
- unsigned short r_flags = EXTRACT_FLAGS(rel->r_type);
- unsigned short junk = EXTRACT_JUNK (rel->r_type);
+ unsigned short r_type = EXTRACT_TYPE (rel->r_type);
+ unsigned short r_flags = EXTRACT_FLAGS (rel->r_type);
+ unsigned short junk = EXTRACT_JUNK (rel->r_type);
- /* the masking process only slices off the bottom byte for r_type. */
- if ( r_type > MAX_RELOC_INDEX )
+ /* The masking process only slices off the bottom byte for r_type. */
+ if (r_type > MAX_RELOC_INDEX)
abort ();
- /* check for absolute crap */
- if ( junk != 0 )
+ /* Check for absolute crap. */
+ if (junk != 0)
abort ();
switch(r_type)
@@ -2141,7 +2072,7 @@ coff_ppc_rtype_to_howto (abfd, sec, rel, h, sym, addendp)
return howto;
}
-/* a cheesy little macro to make the code a little more readable */
+/* A cheesy little macro to make the code a little more readable. */
#define HOW2MAP(bfd_rtype,ppc_rtype) \
case bfd_rtype: return &ppc_coff_howto_table[ppc_rtype]
@@ -2167,7 +2098,6 @@ ppc_coff_reloc_type_lookup (abfd, code)
default:
return NULL;
}
- /*NOTREACHED*/
}
#undef HOW2MAP
@@ -2229,8 +2159,7 @@ ppc_coff_reloc_type_lookup (abfd, code)
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.
-*/
+ 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
@@ -2239,21 +2168,19 @@ ppc_coff_swap_sym_in_hook (abfd, ext1, in1)
PTR ext1 ATTRIBUTE_UNUSED;
PTR in1;
{
- struct internal_syment *in = (struct internal_syment *)in1;
+ struct internal_syment * in = (struct internal_syment *)in1;
- if (bfd_of_toc_owner != 0) /* we already have a toc, so go home */
+ if (bfd_of_toc_owner != 0) /* We already have a toc, so go home. */
return;
- if (strcmp(in->_n._n_name, ".toc") == 0)
+ if (strcmp (in->_n._n_name, ".toc") == 0)
{
flagword flags;
register asection *s;
- s = bfd_get_section_by_name ( abfd , TOC_SECTION_NAME);
+ s = bfd_get_section_by_name (abfd, TOC_SECTION_NAME);
if (s != NULL)
- {
- return;
- }
+ return;
flags = SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS | SEC_IN_MEMORY ;
@@ -2262,12 +2189,10 @@ ppc_coff_swap_sym_in_hook (abfd, ext1, in1)
if (s == NULL
|| !bfd_set_section_flags (abfd, s, flags)
|| !bfd_set_section_alignment (abfd, s, 2))
- {
- /* FIXME: set appropriate bfd error */
- abort ();
- }
+ /* FIXME: set appropriate bfd error. */
+ abort ();
- /* save the bfd for later allocation */
+ /* Save the bfd for later allocation. */
bfd_of_toc_owner = abfd;
}
@@ -2278,17 +2203,17 @@ ppc_coff_swap_sym_in_hook (abfd, ext1, in1)
#ifndef COFF_IMAGE_WITH_PE
-static boolean ppc_do_last PARAMS ((bfd *));
+static bfd_boolean ppc_do_last PARAMS ((bfd *));
static bfd *ppc_get_last PARAMS ((void));
-static boolean
+static bfd_boolean
ppc_do_last (abfd)
bfd *abfd;
{
if (abfd == bfd_of_toc_owner)
- return true;
+ return TRUE;
else
- return false;
+ return FALSE;
}
static bfd *
@@ -2297,7 +2222,7 @@ ppc_get_last()
return bfd_of_toc_owner;
}
-/* this piece of machinery exists only to guarantee that the bfd that holds
+/* This piece of machinery exists only to guarantee that the bfd that holds
the toc section is written last.
This does depend on bfd_make_section attaching a new section to the
@@ -2306,19 +2231,18 @@ ppc_get_last()
This is otherwise intended to be functionally the same as
cofflink.c:_bfd_coff_final_link(). It is specifically different only
where the POWERPC_LE_PE macro modifies the code. It is left in as a
- precise form of comment. krk@cygnus.com
-*/
+ precise form of comment. krk@cygnus.com */
/* Do the final link step. */
-boolean
+bfd_boolean
ppc_bfd_coff_final_link (abfd, info)
bfd *abfd;
struct bfd_link_info *info;
{
bfd_size_type symesz;
struct coff_final_link_info finfo;
- boolean debug_merge_allocated;
+ bfd_boolean debug_merge_allocated;
asection *o;
struct bfd_link_order *p;
bfd_size_type max_sym_count;
@@ -2351,7 +2275,7 @@ ppc_bfd_coff_final_link (abfd, info)
finfo.contents = NULL;
finfo.external_relocs = NULL;
finfo.internal_relocs = NULL;
- debug_merge_allocated = false;
+ debug_merge_allocated = FALSE;
coff_data (abfd)->link_info = info;
@@ -2361,13 +2285,13 @@ ppc_bfd_coff_final_link (abfd, info)
if (! coff_debug_merge_hash_table_init (&finfo.debug_merge))
goto error_return;
- debug_merge_allocated = true;
+ debug_merge_allocated = TRUE;
/* Compute the file positions for all the sections. */
if (! abfd->output_has_begun)
{
if (! bfd_coff_compute_section_file_positions (abfd))
- return false;
+ return FALSE;
}
/* Count the line numbers and relocation entries required for the
@@ -2382,9 +2306,9 @@ 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)
{
-
if (p->type == bfd_indirect_link_order)
{
asection *sec;
@@ -2395,13 +2319,13 @@ ppc_bfd_coff_final_link (abfd, info)
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;
+ sec->linker_mark = TRUE;
if (info->strip == strip_none
|| info->strip == strip_some)
o->lineno_count += sec->lineno_count;
- if (info->relocateable)
+ if (info->relocatable)
o->reloc_count += sec->reloc_count;
if (sec->_raw_size > max_contents_size)
@@ -2411,7 +2335,7 @@ ppc_bfd_coff_final_link (abfd, info)
if (sec->reloc_count > max_reloc_count)
max_reloc_count = sec->reloc_count;
}
- else if (info->relocateable
+ else if (info->relocatable
&& (p->type == bfd_section_reloc_link_order
|| p->type == bfd_symbol_reloc_link_order))
++o->reloc_count;
@@ -2426,9 +2350,9 @@ ppc_bfd_coff_final_link (abfd, info)
}
}
- /* If doing a relocateable link, allocate space for the pointers we
+ /* If doing a relocatable link, allocate space for the pointers we
need to keep. */
- if (info->relocateable)
+ if (info->relocatable)
{
unsigned int i;
@@ -2437,8 +2361,10 @@ ppc_bfd_coff_final_link (abfd, info)
amt = abfd->section_count + 1;
amt *= sizeof (struct coff_link_section_info);
finfo.section_info = (struct coff_link_section_info *) bfd_malloc (amt);
+
if (finfo.section_info == NULL)
goto error_return;
+
for (i = 0; i <= abfd->section_count; i++)
{
finfo.section_info[i].relocs = NULL;
@@ -2451,6 +2377,7 @@ ppc_bfd_coff_final_link (abfd, info)
line_filepos = rel_filepos;
linesz = bfd_coff_linesz (abfd);
max_output_reloc_count = 0;
+
for (o = abfd->sections; o != NULL; o = o->next)
{
if (o->lineno_count == 0)
@@ -2474,9 +2401,9 @@ ppc_bfd_coff_final_link (abfd, info)
Because of this problem, we also keep the relocs in
memory until the end of the link. This wastes memory,
- but only when doing a relocateable link, which is not the
+ but only when doing a relocatable link, which is not the
common case. */
- BFD_ASSERT (info->relocateable);
+ BFD_ASSERT (info->relocatable);
amt = o->reloc_count;
amt *= sizeof (struct internal_reloc);
finfo.section_info[o->target_index].relocs =
@@ -2509,7 +2436,7 @@ ppc_bfd_coff_final_link (abfd, info)
{
bfd_size_type sz;
- sub->output_has_begun = false;
+ sub->output_has_begun = FALSE;
sz = obj_raw_syment_count (sub);
if (sz > max_sym_count)
max_sym_count = sz;
@@ -2528,7 +2455,7 @@ ppc_bfd_coff_final_link (abfd, info)
finfo.linenos = (bfd_byte *) bfd_malloc (amt);
finfo.contents = (bfd_byte *) bfd_malloc (max_contents_size);
finfo.external_relocs = (bfd_byte *) bfd_malloc (max_reloc_count * relsz);
- if (! info->relocateable)
+ if (! info->relocatable)
{
amt = max_reloc_count * sizeof (struct internal_reloc);
finfo.internal_relocs = (struct internal_reloc *) bfd_malloc (amt);
@@ -2540,7 +2467,7 @@ ppc_bfd_coff_final_link (abfd, info)
|| (finfo.linenos == NULL && max_lineno_count > 0)
|| (finfo.contents == NULL && max_contents_size > 0)
|| (finfo.external_relocs == NULL && max_reloc_count > 0)
- || (! info->relocateable
+ || (! info->relocatable
&& finfo.internal_relocs == NULL
&& max_reloc_count > 0))
goto error_return;
@@ -2575,7 +2502,7 @@ ppc_bfd_coff_final_link (abfd, info)
{
if (! _bfd_coff_link_input_bfd (&finfo, sub))
goto error_return;
- sub->output_has_begun = true;
+ sub->output_has_begun = TRUE;
}
}
else if (p->type == bfd_section_reloc_link_order
@@ -2600,14 +2527,13 @@ ppc_bfd_coff_final_link (abfd, info)
if (! _bfd_coff_link_input_bfd (&finfo, last_one))
goto error_return;
}
- last_one->output_has_begun = true;
+ last_one->output_has_begun = TRUE;
}
#endif
/* Free up the buffers used by _bfd_coff_link_input_bfd. */
-
coff_debug_merge_hash_table_free (&finfo.debug_merge);
- debug_merge_allocated = false;
+ debug_merge_allocated = FALSE;
if (finfo.internal_syms != NULL)
{
@@ -2659,11 +2585,11 @@ ppc_bfd_coff_final_link (abfd, info)
pos = obj_sym_filepos (abfd) + finfo.last_file_index * symesz;
if (bfd_seek (abfd, pos, SEEK_SET) != 0
|| bfd_bwrite (finfo.outsyms, symesz, abfd) != symesz)
- return false;
+ return FALSE;
}
/* Write out the global symbols. */
- finfo.failed = false;
+ finfo.failed = FALSE;
coff_link_hash_traverse (coff_hash_table (info), _bfd_coff_write_global_sym,
(PTR) &finfo);
if (finfo.failed)
@@ -2676,7 +2602,7 @@ ppc_bfd_coff_final_link (abfd, info)
finfo.outsyms = NULL;
}
- if (info->relocateable)
+ if (info->relocatable)
{
/* Now that we have written out all the global symbols, we know
the symbol indices to use for relocs against them, and we can
@@ -2740,7 +2666,7 @@ ppc_bfd_coff_final_link (abfd, info)
if (coff_hash_table (info)->stab_info != NULL)
{
if (! _bfd_write_stab_strings (abfd, &coff_hash_table (info)->stab_info))
- return false;
+ return FALSE;
}
/* Write out the string table. */
@@ -2750,7 +2676,7 @@ ppc_bfd_coff_final_link (abfd, info)
pos = obj_sym_filepos (abfd) + obj_raw_syment_count (abfd) * symesz;
if (bfd_seek (abfd, pos, SEEK_SET) != 0)
- return false;
+ return FALSE;
#if STRING_SIZE_SIZE == 4
H_PUT_32 (abfd,
@@ -2762,10 +2688,10 @@ ppc_bfd_coff_final_link (abfd, info)
if (bfd_bwrite (strbuf, (bfd_size_type) STRING_SIZE_SIZE, abfd)
!= STRING_SIZE_SIZE)
- return false;
+ return FALSE;
if (! _bfd_stringtab_emit (abfd, finfo.strtab))
- return false;
+ return FALSE;
}
_bfd_stringtab_free (finfo.strtab);
@@ -2774,7 +2700,7 @@ ppc_bfd_coff_final_link (abfd, info)
not try to write out the symbols. */
bfd_get_symcount (abfd) = 0;
- return true;
+ return TRUE;
error_return:
if (debug_merge_allocated)
@@ -2812,7 +2738,7 @@ ppc_bfd_coff_final_link (abfd, info)
free (finfo.internal_relocs);
if (external_relocs != NULL)
free (external_relocs);
- return false;
+ return FALSE;
}
#endif
diff --git a/contrib/binutils/bfd/coff-rs6000.c b/contrib/binutils/bfd/coff-rs6000.c
index 5a0b8aa..56e34e2 100644
--- a/contrib/binutils/bfd/coff-rs6000.c
+++ b/contrib/binutils/bfd/coff-rs6000.c
@@ -1,5 +1,5 @@
/* BFD back-end for IBM RS/6000 "XCOFF" files.
- Copyright 1990-1999, 2000, 2001, 2002
+ Copyright 1990-1999, 2000, 2001, 2002, 2003
Free Software Foundation, Inc.
FIXME: Can someone provide a transliteration of this name into ASCII?
Using the following chars caused a compiler warning on HIUX (so I replaced
@@ -36,29 +36,46 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "libcoff.h"
#include "libxcoff.h"
-extern boolean _bfd_xcoff_mkobject PARAMS ((bfd *));
-extern boolean _bfd_xcoff_copy_private_bfd_data PARAMS ((bfd *, bfd *));
-extern boolean _bfd_xcoff_is_local_label_name PARAMS ((bfd *, const char *));
+extern bfd_boolean _bfd_xcoff_mkobject
+ PARAMS ((bfd *));
+extern bfd_boolean _bfd_xcoff_copy_private_bfd_data
+ PARAMS ((bfd *, bfd *));
+extern bfd_boolean _bfd_xcoff_is_local_label_name
+ PARAMS ((bfd *, const char *));
extern reloc_howto_type *_bfd_xcoff_reloc_type_lookup
PARAMS ((bfd *, bfd_reloc_code_real_type));
-extern boolean _bfd_xcoff_slurp_armap PARAMS ((bfd *));
-extern const bfd_target *_bfd_xcoff_archive_p PARAMS ((bfd *));
-extern PTR _bfd_xcoff_read_ar_hdr PARAMS ((bfd *));
-extern bfd *_bfd_xcoff_openr_next_archived_file PARAMS ((bfd *, bfd *));
-extern int _bfd_xcoff_stat_arch_elt PARAMS ((bfd *, struct stat *));
-extern boolean _bfd_xcoff_write_armap
+extern bfd_boolean _bfd_xcoff_slurp_armap
+ PARAMS ((bfd *));
+extern const bfd_target *_bfd_xcoff_archive_p
+ PARAMS ((bfd *));
+extern PTR _bfd_xcoff_read_ar_hdr
+ PARAMS ((bfd *));
+extern bfd *_bfd_xcoff_openr_next_archived_file
+ PARAMS ((bfd *, bfd *));
+extern int _bfd_xcoff_stat_arch_elt
+ PARAMS ((bfd *, struct stat *));
+extern bfd_boolean _bfd_xcoff_write_armap
PARAMS ((bfd *, unsigned int, struct orl *, unsigned int, int));
-extern boolean _bfd_xcoff_write_archive_contents PARAMS ((bfd *));
-extern int _bfd_xcoff_sizeof_headers PARAMS ((bfd *, boolean));
-extern void _bfd_xcoff_swap_sym_in PARAMS ((bfd *, PTR, PTR));
-extern unsigned int _bfd_xcoff_swap_sym_out PARAMS ((bfd *, PTR, PTR));
-extern void _bfd_xcoff_swap_aux_in PARAMS ((bfd *, PTR, int, int, int, int, PTR));
-extern unsigned int _bfd_xcoff_swap_aux_out PARAMS ((bfd *, PTR, int, int, int, int, PTR));
-static void xcoff_swap_reloc_in PARAMS ((bfd *, PTR, PTR));
-static unsigned int xcoff_swap_reloc_out PARAMS ((bfd *, PTR, PTR));
+extern bfd_boolean _bfd_xcoff_write_archive_contents
+ PARAMS ((bfd *));
+extern int _bfd_xcoff_sizeof_headers
+ PARAMS ((bfd *, bfd_boolean));
+extern void _bfd_xcoff_swap_sym_in
+ PARAMS ((bfd *, PTR, PTR));
+extern unsigned int _bfd_xcoff_swap_sym_out
+ PARAMS ((bfd *, PTR, PTR));
+extern void _bfd_xcoff_swap_aux_in
+ PARAMS ((bfd *, PTR, int, int, int, int, PTR));
+extern unsigned int _bfd_xcoff_swap_aux_out
+ PARAMS ((bfd *, PTR, int, int, int, int, PTR));
+static void xcoff_swap_reloc_in
+ PARAMS ((bfd *, PTR, PTR));
+static unsigned int xcoff_swap_reloc_out
+ PARAMS ((bfd *, PTR, PTR));
/* Forward declare xcoff_rtype2howto for coffcode.h macro. */
-void xcoff_rtype2howto PARAMS ((arelent *, struct internal_reloc *));
+void xcoff_rtype2howto
+ PARAMS ((arelent *, struct internal_reloc *));
/* coffcode.h needs these to be defined. */
#define RS6000COFF_C 1
@@ -82,11 +99,14 @@ void xcoff_rtype2howto PARAMS ((arelent *, struct internal_reloc *));
#define coff_bfd_is_local_label_name _bfd_xcoff_is_local_label_name
#define coff_bfd_reloc_type_lookup _bfd_xcoff_reloc_type_lookup
#ifdef AIX_CORE
-extern const bfd_target * rs6000coff_core_p PARAMS ((bfd *abfd));
-extern boolean rs6000coff_core_file_matches_executable_p
+extern const bfd_target * rs6000coff_core_p
+ PARAMS ((bfd *abfd));
+extern bfd_boolean rs6000coff_core_file_matches_executable_p
PARAMS ((bfd *cbfd, bfd *ebfd));
-extern char *rs6000coff_core_file_failing_command PARAMS ((bfd *abfd));
-extern int rs6000coff_core_file_failing_signal PARAMS ((bfd *abfd));
+extern char *rs6000coff_core_file_failing_command
+ PARAMS ((bfd *abfd));
+extern int rs6000coff_core_file_failing_signal
+ PARAMS ((bfd *abfd));
#define CORE_FILE_P rs6000coff_core_p
#define coff_core_file_failing_command \
rs6000coff_core_file_failing_command
@@ -115,13 +135,16 @@ extern int rs6000coff_core_file_failing_signal PARAMS ((bfd *abfd));
/* The main body of code is in coffcode.h. */
-static const char *normalize_filename PARAMS ((bfd *));
-static boolean xcoff_write_armap_old
+static const char *normalize_filename
+ PARAMS ((bfd *));
+static bfd_boolean xcoff_write_armap_old
PARAMS ((bfd *, unsigned int, struct orl *, unsigned int, int));
-static boolean xcoff_write_armap_big
+static bfd_boolean xcoff_write_armap_big
PARAMS ((bfd *, unsigned int, struct orl *, unsigned int, int));
-static boolean xcoff_write_archive_contents_old PARAMS ((bfd *));
-static boolean xcoff_write_archive_contents_big PARAMS ((bfd *));
+static bfd_boolean xcoff_write_archive_contents_old
+ PARAMS ((bfd *));
+static bfd_boolean xcoff_write_archive_contents_big
+ PARAMS ((bfd *));
static void xcoff_swap_ldhdr_in
PARAMS ((bfd *, const PTR, struct internal_ldhdr *));
static void xcoff_swap_ldhdr_out
@@ -134,72 +157,78 @@ static void xcoff_swap_ldrel_in
PARAMS ((bfd *, const PTR, struct internal_ldrel *));
static void xcoff_swap_ldrel_out
PARAMS ((bfd *, const struct internal_ldrel *, PTR));
-static boolean xcoff_ppc_relocate_section
+static bfd_boolean xcoff_ppc_relocate_section
PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *,
struct internal_reloc *, struct internal_syment *, asection **));
-static boolean _bfd_xcoff_put_ldsymbol_name
+static bfd_boolean _bfd_xcoff_put_ldsymbol_name
PARAMS ((bfd *, struct xcoff_loader_info *, struct internal_ldsym *,
const char *));
static asection *xcoff_create_csect_from_smclas
PARAMS ((bfd *, union internal_auxent *, const char *));
-static boolean xcoff_is_lineno_count_overflow PARAMS ((bfd *, bfd_vma));
-static boolean xcoff_is_reloc_count_overflow PARAMS ((bfd *, bfd_vma));
+static bfd_boolean xcoff_is_lineno_count_overflow
+ PARAMS ((bfd *, bfd_vma));
+static bfd_boolean xcoff_is_reloc_count_overflow
+ PARAMS ((bfd *, bfd_vma));
static bfd_vma xcoff_loader_symbol_offset
PARAMS ((bfd *, struct internal_ldhdr *));
static bfd_vma xcoff_loader_reloc_offset
PARAMS ((bfd *, struct internal_ldhdr *));
-static boolean xcoff_generate_rtinit
- PARAMS((bfd *, const char *, const char *, boolean));
-static boolean do_pad PARAMS((bfd *, unsigned int));
-static boolean do_copy PARAMS((bfd *, bfd *));
-static boolean do_shared_object_padding PARAMS ((bfd *, bfd *, ufile_ptr *, int));
+static bfd_boolean xcoff_generate_rtinit
+ PARAMS ((bfd *, const char *, const char *, bfd_boolean));
+static bfd_boolean do_pad
+ PARAMS ((bfd *, unsigned int));
+static bfd_boolean do_copy
+ PARAMS ((bfd *, bfd *));
+static bfd_boolean do_shared_object_padding
+ PARAMS ((bfd *, bfd *, ufile_ptr *, int));
/* Relocation functions */
-static boolean xcoff_reloc_type_br PARAMS ((XCOFF_RELOC_FUNCTION_ARGS));
+static bfd_boolean xcoff_reloc_type_br
+ PARAMS ((XCOFF_RELOC_FUNCTION_ARGS));
-static boolean xcoff_complain_overflow_dont_func
+static bfd_boolean xcoff_complain_overflow_dont_func
PARAMS ((XCOFF_COMPLAIN_FUNCTION_ARGS));
-static boolean xcoff_complain_overflow_bitfield_func
+static bfd_boolean xcoff_complain_overflow_bitfield_func
PARAMS ((XCOFF_COMPLAIN_FUNCTION_ARGS));
-static boolean xcoff_complain_overflow_signed_func
+static bfd_boolean xcoff_complain_overflow_signed_func
PARAMS ((XCOFF_COMPLAIN_FUNCTION_ARGS));
-static boolean xcoff_complain_overflow_unsigned_func
+static bfd_boolean xcoff_complain_overflow_unsigned_func
PARAMS ((XCOFF_COMPLAIN_FUNCTION_ARGS));
-boolean (*xcoff_calculate_relocation[XCOFF_MAX_CALCULATE_RELOCATION])
+bfd_boolean (*xcoff_calculate_relocation[XCOFF_MAX_CALCULATE_RELOCATION])
PARAMS ((XCOFF_RELOC_FUNCTION_ARGS)) =
{
- xcoff_reloc_type_pos, /* R_POS (0x00) */
- xcoff_reloc_type_neg, /* R_NEG (0x01) */
- xcoff_reloc_type_rel, /* R_REL (0x02) */
- xcoff_reloc_type_toc, /* R_TOC (0x03) */
+ xcoff_reloc_type_pos, /* R_POS (0x00) */
+ xcoff_reloc_type_neg, /* R_NEG (0x01) */
+ xcoff_reloc_type_rel, /* R_REL (0x02) */
+ xcoff_reloc_type_toc, /* R_TOC (0x03) */
xcoff_reloc_type_fail, /* R_RTB (0x04) */
- xcoff_reloc_type_toc, /* R_GL (0x05) */
- xcoff_reloc_type_toc, /* R_TCL (0x06) */
- xcoff_reloc_type_fail, /* (0x07) */
- xcoff_reloc_type_ba, /* R_BA (0x08) */
- xcoff_reloc_type_fail, /* (0x09) */
- xcoff_reloc_type_br, /* R_BR (0x0a) */
- xcoff_reloc_type_fail, /* (0x0b) */
- xcoff_reloc_type_pos, /* R_RL (0x0c) */
- xcoff_reloc_type_pos, /* R_RLA (0x0d) */
- xcoff_reloc_type_fail, /* (0x0e) */
+ xcoff_reloc_type_toc, /* R_GL (0x05) */
+ xcoff_reloc_type_toc, /* R_TCL (0x06) */
+ xcoff_reloc_type_fail, /* (0x07) */
+ xcoff_reloc_type_ba, /* R_BA (0x08) */
+ xcoff_reloc_type_fail, /* (0x09) */
+ xcoff_reloc_type_br, /* R_BR (0x0a) */
+ xcoff_reloc_type_fail, /* (0x0b) */
+ xcoff_reloc_type_pos, /* R_RL (0x0c) */
+ xcoff_reloc_type_pos, /* R_RLA (0x0d) */
+ xcoff_reloc_type_fail, /* (0x0e) */
xcoff_reloc_type_noop, /* R_REF (0x0f) */
- xcoff_reloc_type_fail, /* (0x10) */
- xcoff_reloc_type_fail, /* (0x11) */
- xcoff_reloc_type_toc, /* R_TRL (0x12) */
- xcoff_reloc_type_toc, /* R_TRLA (0x13) */
+ xcoff_reloc_type_fail, /* (0x10) */
+ xcoff_reloc_type_fail, /* (0x11) */
+ xcoff_reloc_type_toc, /* R_TRL (0x12) */
+ xcoff_reloc_type_toc, /* R_TRLA (0x13) */
xcoff_reloc_type_fail, /* R_RRTBI (0x14) */
xcoff_reloc_type_fail, /* R_RRTBA (0x15) */
- xcoff_reloc_type_ba, /* R_CAI (0x16) */
+ xcoff_reloc_type_ba, /* R_CAI (0x16) */
xcoff_reloc_type_crel, /* R_CREL (0x17) */
- xcoff_reloc_type_ba, /* R_RBA (0x18) */
- xcoff_reloc_type_ba, /* R_RBAC (0x19) */
- xcoff_reloc_type_br, /* R_RBR (0x1a) */
- xcoff_reloc_type_ba, /* R_RBRC (0x1b) */
+ xcoff_reloc_type_ba, /* R_RBA (0x18) */
+ xcoff_reloc_type_ba, /* R_RBAC (0x19) */
+ xcoff_reloc_type_br, /* R_RBR (0x1a) */
+ xcoff_reloc_type_ba, /* R_RBRC (0x1b) */
};
-boolean (*xcoff_complain_overflow[XCOFF_MAX_COMPLAIN_OVERFLOW])
+bfd_boolean (*xcoff_complain_overflow[XCOFF_MAX_COMPLAIN_OVERFLOW])
PARAMS ((XCOFF_COMPLAIN_FUNCTION_ARGS)) =
{
xcoff_complain_overflow_dont_func,
@@ -211,7 +240,7 @@ boolean (*xcoff_complain_overflow[XCOFF_MAX_COMPLAIN_OVERFLOW])
/* We use our own tdata type. Its first field is the COFF tdata type,
so the COFF routines are compatible. */
-boolean
+bfd_boolean
_bfd_xcoff_mkobject (abfd)
bfd *abfd;
{
@@ -220,7 +249,7 @@ _bfd_xcoff_mkobject (abfd)
abfd->tdata.xcoff_obj_data = (struct xcoff_tdata *) bfd_zalloc (abfd, amt);
if (abfd->tdata.xcoff_obj_data == NULL)
- return false;
+ return FALSE;
coff = coff_data (abfd);
coff->symbols = (coff_symbol_type *) NULL;
coff->conversion_table = (unsigned int *) NULL;
@@ -239,12 +268,12 @@ _bfd_xcoff_mkobject (abfd)
/* text section alignment is different than the default */
bfd_xcoff_text_align_power (abfd) = 2;
- return true;
+ return TRUE;
}
/* Copy XCOFF data from one BFD to another. */
-boolean
+bfd_boolean
_bfd_xcoff_copy_private_bfd_data (ibfd, obfd)
bfd *ibfd;
bfd *obfd;
@@ -253,7 +282,7 @@ _bfd_xcoff_copy_private_bfd_data (ibfd, obfd)
asection *sec;
if (ibfd->xvec != obfd->xvec)
- return true;
+ return TRUE;
ix = xcoff_data (ibfd);
ox = xcoff_data (obfd);
ox->full_aouthdr = ix->full_aouthdr;
@@ -284,7 +313,7 @@ _bfd_xcoff_copy_private_bfd_data (ibfd, obfd)
ox->cputype = ix->cputype;
ox->maxdata = ix->maxdata;
ox->maxstack = ix->maxstack;
- return true;
+ return TRUE;
}
/* I don't think XCOFF really has a notion of local labels based on
@@ -292,17 +321,17 @@ _bfd_xcoff_copy_private_bfd_data (ibfd, obfd)
The AIX native linker does not have a -X option, and it ignores the
-x option. */
-boolean
+bfd_boolean
_bfd_xcoff_is_local_label_name (abfd, name)
bfd *abfd ATTRIBUTE_UNUSED;
const char *name ATTRIBUTE_UNUSED;
{
- return false;
+ return FALSE;
}
void
_bfd_xcoff_swap_sym_in (abfd, ext1, in1)
- bfd *abfd;
+ bfd *abfd;
PTR ext1;
PTR in1;
{
@@ -311,7 +340,7 @@ _bfd_xcoff_swap_sym_in (abfd, ext1, in1)
if (ext->e.e_name[0] != 0)
{
- memcpy(in->_n._n_name, ext->e.e_name, SYMNMLEN);
+ memcpy (in->_n._n_name, ext->e.e_name, SYMNMLEN);
}
else
{
@@ -328,16 +357,16 @@ _bfd_xcoff_swap_sym_in (abfd, ext1, in1)
unsigned int
_bfd_xcoff_swap_sym_out (abfd, inp, extp)
- bfd *abfd;
- PTR inp;
- PTR extp;
+ bfd *abfd;
+ PTR inp;
+ PTR extp;
{
struct internal_syment *in = (struct internal_syment *)inp;
SYMENT *ext =(SYMENT *)extp;
if (in->_n._n_name[0] != 0)
{
- memcpy(ext->e.e_name, in->_n._n_name, SYMNMLEN);
+ memcpy (ext->e.e_name, in->_n._n_name, SYMNMLEN);
}
else
{
@@ -355,13 +384,13 @@ _bfd_xcoff_swap_sym_out (abfd, inp, extp)
void
_bfd_xcoff_swap_aux_in (abfd, ext1, type, class, indx, numaux, in1)
- bfd *abfd;
- PTR ext1;
- int type;
- int class;
- int indx;
- int numaux;
- PTR in1;
+ bfd *abfd;
+ PTR ext1;
+ int type;
+ int class;
+ int indx;
+ int numaux;
+ PTR in1;
{
AUXENT * ext = (AUXENT *)ext1;
union internal_auxent *in = (union internal_auxent *)in1;
@@ -418,7 +447,7 @@ _bfd_xcoff_swap_aux_in (abfd, ext1, type, class, indx, numaux, in1)
in->x_scn.x_nreloc = H_GET_16 (abfd, ext->x_scn.x_nreloc);
in->x_scn.x_nlinno = H_GET_16 (abfd, ext->x_scn.x_nlinno);
/* PE defines some extra fields; we zero them out for
- safety. */
+ safety. */
in->x_scn.x_checksum = 0;
in->x_scn.x_associated = 0;
in->x_scn.x_comdat = 0;
@@ -468,7 +497,8 @@ _bfd_xcoff_swap_aux_in (abfd, ext1, type, class, indx, numaux, in1)
}
-unsigned int _bfd_xcoff_swap_aux_out PARAMS ((bfd *, PTR, int, int, int, int, PTR));
+unsigned int _bfd_xcoff_swap_aux_out
+ PARAMS ((bfd *, PTR, int, int, int, int, PTR));
unsigned int
_bfd_xcoff_swap_aux_out (abfd, inp, type, class, indx, numaux, extp)
@@ -483,7 +513,7 @@ _bfd_xcoff_swap_aux_out (abfd, inp, type, class, indx, numaux, extp)
union internal_auxent *in = (union internal_auxent *)inp;
AUXENT *ext = (AUXENT *)extp;
- memset((PTR)ext, 0, bfd_coff_auxesz (abfd));
+ memset ((PTR)ext, 0, bfd_coff_auxesz (abfd));
switch (class)
{
case C_FILE:
@@ -578,390 +608,390 @@ end:
reloc_howto_type xcoff_howto_table[] =
{
/* Standard 32 bit relocation. */
- HOWTO (R_POS, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 32, /* bitsize */
- false, /* pc_relative */
- 0, /* bitpos */
+ HOWTO (R_POS, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 32, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
- 0, /* special_function */
- "R_POS", /* name */
- true, /* partial_inplace */
- 0xffffffff, /* src_mask */
- 0xffffffff, /* dst_mask */
- false), /* pcrel_offset */
+ 0, /* special_function */
+ "R_POS", /* name */
+ TRUE, /* partial_inplace */
+ 0xffffffff, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
/* 32 bit relocation, but store negative value. */
- HOWTO (R_NEG, /* type */
- 0, /* rightshift */
- -2, /* size (0 = byte, 1 = short, 2 = long) */
- 32, /* bitsize */
- false, /* pc_relative */
- 0, /* bitpos */
+ HOWTO (R_NEG, /* type */
+ 0, /* rightshift */
+ -2, /* size (0 = byte, 1 = short, 2 = long) */
+ 32, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
- 0, /* special_function */
- "R_NEG", /* name */
- true, /* partial_inplace */
- 0xffffffff, /* src_mask */
- 0xffffffff, /* dst_mask */
- false), /* pcrel_offset */
+ 0, /* special_function */
+ "R_NEG", /* name */
+ TRUE, /* partial_inplace */
+ 0xffffffff, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
/* 32 bit PC relative relocation. */
- HOWTO (R_REL, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 32, /* bitsize */
- true, /* pc_relative */
- 0, /* bitpos */
+ HOWTO (R_REL, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 32, /* bitsize */
+ TRUE, /* pc_relative */
+ 0, /* bitpos */
complain_overflow_signed, /* complain_on_overflow */
- 0, /* special_function */
- "R_REL", /* name */
- true, /* partial_inplace */
- 0xffffffff, /* src_mask */
- 0xffffffff, /* dst_mask */
- false), /* pcrel_offset */
+ 0, /* special_function */
+ "R_REL", /* name */
+ TRUE, /* partial_inplace */
+ 0xffffffff, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
/* 16 bit TOC relative relocation. */
- HOWTO (R_TOC, /* type */
- 0, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- false, /* pc_relative */
- 0, /* bitpos */
+ HOWTO (R_TOC, /* type */
+ 0, /* rightshift */
+ 1, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
- 0, /* special_function */
- "R_TOC", /* name */
- true, /* partial_inplace */
- 0xffff, /* src_mask */
- 0xffff, /* dst_mask */
- false), /* pcrel_offset */
+ 0, /* special_function */
+ "R_TOC", /* name */
+ TRUE, /* partial_inplace */
+ 0xffff, /* src_mask */
+ 0xffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
/* I don't really know what this is. */
- HOWTO (R_RTB, /* type */
- 1, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 32, /* bitsize */
- false, /* pc_relative */
- 0, /* bitpos */
+ HOWTO (R_RTB, /* type */
+ 1, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 32, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
- 0, /* special_function */
- "R_RTB", /* name */
- true, /* partial_inplace */
- 0xffffffff, /* src_mask */
- 0xffffffff, /* dst_mask */
- false), /* pcrel_offset */
+ 0, /* special_function */
+ "R_RTB", /* name */
+ TRUE, /* partial_inplace */
+ 0xffffffff, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
/* External TOC relative symbol. */
- HOWTO (R_GL, /* type */
- 0, /* rightshift */
+ HOWTO (R_GL, /* type */
+ 0, /* rightshift */
1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- false, /* pc_relative */
- 0, /* bitpos */
+ 16, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
- 0, /* special_function */
- "R_GL", /* name */
- true, /* partial_inplace */
- 0xffff, /* src_mask */
- 0xffff, /* dst_mask */
- false), /* pcrel_offset */
-
- /* Local TOC relative symbol. */
- HOWTO (R_TCL, /* type */
- 0, /* rightshift */
+ 0, /* special_function */
+ "R_GL", /* name */
+ TRUE, /* partial_inplace */
+ 0xffff, /* src_mask */
+ 0xffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* Local TOC relative symbol. */
+ HOWTO (R_TCL, /* type */
+ 0, /* rightshift */
1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- false, /* pc_relative */
- 0, /* bitpos */
+ 16, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
- 0, /* special_function */
- "R_TCL", /* name */
- true, /* partial_inplace */
- 0xffff, /* src_mask */
- 0xffff, /* dst_mask */
- false), /* pcrel_offset */
+ 0, /* special_function */
+ "R_TCL", /* name */
+ TRUE, /* partial_inplace */
+ 0xffff, /* src_mask */
+ 0xffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
EMPTY_HOWTO (7),
/* Non modifiable absolute branch. */
- HOWTO (R_BA, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 26, /* bitsize */
- false, /* pc_relative */
- 0, /* bitpos */
+ HOWTO (R_BA, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 26, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
- 0, /* special_function */
- "R_BA_26", /* name */
- true, /* partial_inplace */
+ 0, /* special_function */
+ "R_BA_26", /* name */
+ TRUE, /* partial_inplace */
0x03fffffc, /* src_mask */
0x03fffffc, /* dst_mask */
- false), /* pcrel_offset */
+ FALSE), /* pcrel_offset */
EMPTY_HOWTO (9),
/* Non modifiable relative branch. */
- HOWTO (R_BR, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 26, /* bitsize */
- true, /* pc_relative */
- 0, /* bitpos */
+ HOWTO (R_BR, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 26, /* bitsize */
+ TRUE, /* pc_relative */
+ 0, /* bitpos */
complain_overflow_signed, /* complain_on_overflow */
- 0, /* special_function */
- "R_BR", /* name */
- true, /* partial_inplace */
- 0x3fffffc, /* src_mask */
- 0x3fffffc, /* dst_mask */
- false), /* pcrel_offset */
+ 0, /* special_function */
+ "R_BR", /* name */
+ TRUE, /* partial_inplace */
+ 0x03fffffc, /* src_mask */
+ 0x03fffffc, /* dst_mask */
+ FALSE), /* pcrel_offset */
EMPTY_HOWTO (0xb),
/* Indirect load. */
- HOWTO (R_RL, /* type */
- 0, /* rightshift */
+ HOWTO (R_RL, /* type */
+ 0, /* rightshift */
1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- false, /* pc_relative */
- 0, /* bitpos */
+ 16, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
- 0, /* special_function */
- "R_RL", /* name */
- true, /* partial_inplace */
- 0xffff, /* src_mask */
- 0xffff, /* dst_mask */
- false), /* pcrel_offset */
+ 0, /* special_function */
+ "R_RL", /* name */
+ TRUE, /* partial_inplace */
+ 0xffff, /* src_mask */
+ 0xffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
/* Load address. */
- HOWTO (R_RLA, /* type */
- 0, /* rightshift */
+ HOWTO (R_RLA, /* type */
+ 0, /* rightshift */
1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- false, /* pc_relative */
- 0, /* bitpos */
+ 16, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
- 0, /* special_function */
- "R_RLA", /* name */
- true, /* partial_inplace */
- 0xffff, /* src_mask */
- 0xffff, /* dst_mask */
- false), /* pcrel_offset */
+ 0, /* special_function */
+ "R_RLA", /* name */
+ TRUE, /* partial_inplace */
+ 0xffff, /* src_mask */
+ 0xffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
EMPTY_HOWTO (0xe),
/* Non-relocating reference. */
- HOWTO (R_REF, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 32, /* bitsize */
- false, /* pc_relative */
- 0, /* bitpos */
+ HOWTO (R_REF, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 32, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
- 0, /* special_function */
- "R_REF", /* name */
- false, /* partial_inplace */
- 0, /* src_mask */
- 0, /* dst_mask */
- false), /* pcrel_offset */
+ 0, /* special_function */
+ "R_REF", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0, /* dst_mask */
+ FALSE), /* pcrel_offset */
EMPTY_HOWTO (0x10),
EMPTY_HOWTO (0x11),
/* TOC relative indirect load. */
- HOWTO (R_TRL, /* type */
- 0, /* rightshift */
+ HOWTO (R_TRL, /* type */
+ 0, /* rightshift */
1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- false, /* pc_relative */
- 0, /* bitpos */
+ 16, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
- 0, /* special_function */
- "R_TRL", /* name */
- true, /* partial_inplace */
- 0xffff, /* src_mask */
- 0xffff, /* dst_mask */
- false), /* pcrel_offset */
+ 0, /* special_function */
+ "R_TRL", /* name */
+ TRUE, /* partial_inplace */
+ 0xffff, /* src_mask */
+ 0xffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
/* TOC relative load address. */
- HOWTO (R_TRLA, /* type */
- 0, /* rightshift */
+ HOWTO (R_TRLA, /* type */
+ 0, /* rightshift */
1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- false, /* pc_relative */
- 0, /* bitpos */
+ 16, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
- 0, /* special_function */
- "R_TRLA", /* name */
- true, /* partial_inplace */
- 0xffff, /* src_mask */
- 0xffff, /* dst_mask */
- false), /* pcrel_offset */
+ 0, /* special_function */
+ "R_TRLA", /* name */
+ TRUE, /* partial_inplace */
+ 0xffff, /* src_mask */
+ 0xffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
/* Modifiable relative branch. */
- HOWTO (R_RRTBI, /* type */
- 1, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 32, /* bitsize */
- false, /* pc_relative */
- 0, /* bitpos */
+ HOWTO (R_RRTBI, /* type */
+ 1, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 32, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
- 0, /* special_function */
- "R_RRTBI", /* name */
- true, /* partial_inplace */
- 0xffffffff, /* src_mask */
- 0xffffffff, /* dst_mask */
- false), /* pcrel_offset */
+ 0, /* special_function */
+ "R_RRTBI", /* name */
+ TRUE, /* partial_inplace */
+ 0xffffffff, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
/* Modifiable absolute branch. */
- HOWTO (R_RRTBA, /* type */
- 1, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 32, /* bitsize */
- false, /* pc_relative */
- 0, /* bitpos */
+ HOWTO (R_RRTBA, /* type */
+ 1, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 32, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
- 0, /* special_function */
- "R_RRTBA", /* name */
- true, /* partial_inplace */
- 0xffffffff, /* src_mask */
- 0xffffffff, /* dst_mask */
- false), /* pcrel_offset */
+ 0, /* special_function */
+ "R_RRTBA", /* name */
+ TRUE, /* partial_inplace */
+ 0xffffffff, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
/* Modifiable call absolute indirect. */
- HOWTO (R_CAI, /* type */
- 0, /* rightshift */
+ HOWTO (R_CAI, /* type */
+ 0, /* rightshift */
1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- false, /* pc_relative */
- 0, /* bitpos */
+ 16, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
- 0, /* special_function */
- "R_CAI", /* name */
- true, /* partial_inplace */
- 0xffff, /* src_mask */
- 0xffff, /* dst_mask */
- false), /* pcrel_offset */
+ 0, /* special_function */
+ "R_CAI", /* name */
+ TRUE, /* partial_inplace */
+ 0xffff, /* src_mask */
+ 0xffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
/* Modifiable call relative. */
- HOWTO (R_CREL, /* type */
- 0, /* rightshift */
+ HOWTO (R_CREL, /* type */
+ 0, /* rightshift */
1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- false, /* pc_relative */
- 0, /* bitpos */
+ 16, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
- 0, /* special_function */
- "R_CREL", /* name */
- true, /* partial_inplace */
- 0xffff, /* src_mask */
- 0xffff, /* dst_mask */
- false), /* pcrel_offset */
+ 0, /* special_function */
+ "R_CREL", /* name */
+ TRUE, /* partial_inplace */
+ 0xffff, /* src_mask */
+ 0xffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
/* Modifiable branch absolute. */
- HOWTO (R_RBA, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 26, /* bitsize */
- false, /* pc_relative */
- 0, /* bitpos */
+ HOWTO (R_RBA, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 26, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
- 0, /* special_function */
- "R_RBA", /* name */
- true, /* partial_inplace */
+ 0, /* special_function */
+ "R_RBA", /* name */
+ TRUE, /* partial_inplace */
0x03fffffc, /* src_mask */
0x03fffffc, /* dst_mask */
- false), /* pcrel_offset */
+ FALSE), /* pcrel_offset */
/* Modifiable branch absolute. */
- HOWTO (R_RBAC, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 32, /* bitsize */
- false, /* pc_relative */
- 0, /* bitpos */
+ HOWTO (R_RBAC, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 32, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
- 0, /* special_function */
- "R_RBAC", /* name */
- true, /* partial_inplace */
+ 0, /* special_function */
+ "R_RBAC", /* name */
+ TRUE, /* partial_inplace */
0xffffffff, /* src_mask */
0xffffffff, /* dst_mask */
- false), /* pcrel_offset */
+ FALSE), /* pcrel_offset */
/* Modifiable branch relative. */
- HOWTO (R_RBR, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 26, /* bitsize */
- false, /* pc_relative */
- 0, /* bitpos */
+ HOWTO (R_RBR, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 26, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
complain_overflow_signed, /* complain_on_overflow */
- 0, /* special_function */
- "R_RBR_26", /* name */
- true, /* partial_inplace */
+ 0, /* special_function */
+ "R_RBR_26", /* name */
+ TRUE, /* partial_inplace */
0x03fffffc, /* src_mask */
0x03fffffc, /* dst_mask */
- false), /* pcrel_offset */
+ FALSE), /* pcrel_offset */
/* Modifiable branch absolute. */
- HOWTO (R_RBRC, /* type */
- 0, /* rightshift */
+ HOWTO (R_RBRC, /* type */
+ 0, /* rightshift */
1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- false, /* pc_relative */
- 0, /* bitpos */
+ 16, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
- 0, /* special_function */
- "R_RBRC", /* name */
- true, /* partial_inplace */
- 0xffff, /* src_mask */
- 0xffff, /* dst_mask */
- false), /* pcrel_offset */
+ 0, /* special_function */
+ "R_RBRC", /* name */
+ TRUE, /* partial_inplace */
+ 0xffff, /* src_mask */
+ 0xffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
/* 16 bit Non modifiable absolute branch. */
- HOWTO (R_BA, /* type */
- 0, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- false, /* pc_relative */
- 0, /* bitpos */
+ HOWTO (R_BA, /* type */
+ 0, /* rightshift */
+ 1, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
- 0, /* special_function */
- "R_BA_16", /* name */
- true, /* partial_inplace */
- 0xfffc, /* src_mask */
- 0xfffc, /* dst_mask */
- false), /* pcrel_offset */
+ 0, /* special_function */
+ "R_BA_16", /* name */
+ TRUE, /* partial_inplace */
+ 0xfffc, /* src_mask */
+ 0xfffc, /* dst_mask */
+ FALSE), /* pcrel_offset */
/* Modifiable branch relative. */
- HOWTO (R_RBR, /* type */
- 0, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- false, /* pc_relative */
- 0, /* bitpos */
+ HOWTO (R_RBR, /* type */
+ 0, /* rightshift */
+ 1, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
complain_overflow_signed, /* complain_on_overflow */
- 0, /* special_function */
- "R_RBR_16", /* name */
- true, /* partial_inplace */
- 0xffff, /* src_mask */
- 0xffff, /* dst_mask */
- false), /* pcrel_offset */
+ 0, /* special_function */
+ "R_RBR_16", /* name */
+ TRUE, /* partial_inplace */
+ 0xffff, /* src_mask */
+ 0xffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
/* Modifiable branch relative. */
- HOWTO (R_RBA, /* type */
- 0, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- false, /* pc_relative */
- 0, /* bitpos */
+ HOWTO (R_RBA, /* type */
+ 0, /* rightshift */
+ 1, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
complain_overflow_signed, /* complain_on_overflow */
- 0, /* special_function */
- "R_RBA_16", /* name */
- true, /* partial_inplace */
- 0xffff, /* src_mask */
- 0xffff, /* dst_mask */
- false), /* pcrel_offset */
+ 0, /* special_function */
+ "R_RBA_16", /* name */
+ TRUE, /* partial_inplace */
+ 0xffff, /* src_mask */
+ 0xffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
};
@@ -975,18 +1005,18 @@ xcoff_rtype2howto (relent, internal)
/* Default howto layout works most of the time */
relent->howto = &xcoff_howto_table[internal->r_type];
-
- /* Special case some 16 bit reoloc */
+
+ /* Special case some 16 bit reloc */
if (15 == (internal->r_size & 0x1f))
{
- if (R_BA == internal->r_type)
+ if (R_BA == internal->r_type)
relent->howto = &xcoff_howto_table[0x1c];
- else if (R_RBR == internal->r_type)
+ else if (R_RBR == internal->r_type)
relent->howto = &xcoff_howto_table[0x1d];
- else if (R_RBA == internal->r_type)
+ else if (R_RBA == internal->r_type)
relent->howto = &xcoff_howto_table[0x1e];
}
-
+
/* The r_size field of an XCOFF reloc encodes the bitsize of the
relocation, as well as indicating whether it is signed or not.
Doublecheck that the relocation information gathered from the
@@ -1069,19 +1099,19 @@ _bfd_xcoff_reloc_type_lookup (abfd, code)
/* Set the magic for archive. */
-boolean
+bfd_boolean
bfd_xcoff_ar_archive_set_magic (abfd, magic)
bfd *abfd ATTRIBUTE_UNUSED;
char *magic ATTRIBUTE_UNUSED;
{
/* Not supported yet. */
- return false;
+ return FALSE;
/* bfd_xcoff_archive_set_magic (abfd, magic); */
}
/* Read in the armap of an XCOFF archive. */
-boolean
+bfd_boolean
_bfd_xcoff_slurp_armap (abfd)
bfd *abfd;
{
@@ -1095,8 +1125,8 @@ _bfd_xcoff_slurp_armap (abfd)
if (xcoff_ardata (abfd) == NULL)
{
- bfd_has_map (abfd) = false;
- return true;
+ bfd_has_map (abfd) = FALSE;
+ return TRUE;
}
if (! xcoff_big_format_p (abfd))
@@ -1107,32 +1137,32 @@ _bfd_xcoff_slurp_armap (abfd)
off = strtol (xcoff_ardata (abfd)->symoff, (char **) NULL, 10);
if (off == 0)
{
- bfd_has_map (abfd) = false;
- return true;
+ bfd_has_map (abfd) = FALSE;
+ return TRUE;
}
if (bfd_seek (abfd, off, SEEK_SET) != 0)
- return false;
+ return FALSE;
/* The symbol table starts with a normal archive header. */
if (bfd_bread ((PTR) &hdr, (bfd_size_type) SIZEOF_AR_HDR, abfd)
!= SIZEOF_AR_HDR)
- return false;
+ return FALSE;
/* Skip the name (normally empty). */
namlen = strtol (hdr.namlen, (char **) NULL, 10);
off = ((namlen + 1) & ~ (size_t) 1) + SXCOFFARFMAG;
if (bfd_seek (abfd, off, SEEK_CUR) != 0)
- return false;
+ return FALSE;
sz = strtol (hdr.size, (char **) NULL, 10);
/* Read in the entire symbol table. */
contents = (bfd_byte *) bfd_alloc (abfd, sz);
if (contents == NULL)
- return false;
+ return FALSE;
if (bfd_bread ((PTR) contents, sz, abfd) != sz)
- return false;
+ return FALSE;
/* The symbol table starts with a four byte count. */
c = H_GET_32 (abfd, contents);
@@ -1140,13 +1170,13 @@ _bfd_xcoff_slurp_armap (abfd)
if (c * 4 >= sz)
{
bfd_set_error (bfd_error_bad_value);
- return false;
+ return FALSE;
}
bfd_ardata (abfd)->symdefs =
((carsym *) bfd_alloc (abfd, c * sizeof (carsym)));
if (bfd_ardata (abfd)->symdefs == NULL)
- return false;
+ return FALSE;
/* After the count comes a list of four byte file offsets. */
for (i = 0, arsym = bfd_ardata (abfd)->symdefs, p = contents + 4;
@@ -1162,23 +1192,23 @@ _bfd_xcoff_slurp_armap (abfd)
off = strtol (xcoff_ardata_big (abfd)->symoff, (char **) NULL, 10);
if (off == 0)
{
- bfd_has_map (abfd) = false;
- return true;
+ bfd_has_map (abfd) = FALSE;
+ return TRUE;
}
if (bfd_seek (abfd, off, SEEK_SET) != 0)
- return false;
+ return FALSE;
/* The symbol table starts with a normal archive header. */
if (bfd_bread ((PTR) &hdr, (bfd_size_type) SIZEOF_AR_HDR_BIG, abfd)
!= SIZEOF_AR_HDR_BIG)
- return false;
+ return FALSE;
/* Skip the name (normally empty). */
namlen = strtol (hdr.namlen, (char **) NULL, 10);
off = ((namlen + 1) & ~ (size_t) 1) + SXCOFFARFMAG;
if (bfd_seek (abfd, off, SEEK_CUR) != 0)
- return false;
+ return FALSE;
/* XXX This actually has to be a call to strtoll (at least on 32-bit
machines) since the field width is 20 and there numbers with more
@@ -1188,9 +1218,9 @@ _bfd_xcoff_slurp_armap (abfd)
/* Read in the entire symbol table. */
contents = (bfd_byte *) bfd_alloc (abfd, sz);
if (contents == NULL)
- return false;
+ return FALSE;
if (bfd_bread ((PTR) contents, sz, abfd) != sz)
- return false;
+ return FALSE;
/* The symbol table starts with an eight byte count. */
c = H_GET_64 (abfd, contents);
@@ -1198,13 +1228,13 @@ _bfd_xcoff_slurp_armap (abfd)
if (c * 8 >= sz)
{
bfd_set_error (bfd_error_bad_value);
- return false;
+ return FALSE;
}
bfd_ardata (abfd)->symdefs =
((carsym *) bfd_alloc (abfd, c * sizeof (carsym)));
if (bfd_ardata (abfd)->symdefs == NULL)
- return false;
+ return FALSE;
/* After the count comes a list of eight byte file offsets. */
for (i = 0, arsym = bfd_ardata (abfd)->symdefs, p = contents + 8;
@@ -1222,15 +1252,15 @@ _bfd_xcoff_slurp_armap (abfd)
if (p >= cend)
{
bfd_set_error (bfd_error_bad_value);
- return false;
+ return FALSE;
}
arsym->name = (char *) p;
}
bfd_ardata (abfd)->symdef_count = c;
- bfd_has_map (abfd) = true;
+ bfd_has_map (abfd) = TRUE;
- return true;
+ return TRUE;
}
/* See if this is an XCOFF archive. */
@@ -1545,8 +1575,7 @@ normalize_filename (abfd)
/* Write out an XCOFF armap. */
-/*ARGSUSED*/
-static boolean
+static bfd_boolean
xcoff_write_armap_old (abfd, elength, map, orl_count, stridx)
bfd *abfd;
unsigned int elength ATTRIBUTE_UNUSED;
@@ -1580,11 +1609,11 @@ xcoff_write_armap_old (abfd, elength, map, orl_count, stridx)
!= SIZEOF_AR_HDR
|| (bfd_bwrite (XCOFFARFMAG, (bfd_size_type) SXCOFFARFMAG, abfd)
!= SXCOFFARFMAG))
- return false;
+ return FALSE;
H_PUT_32 (abfd, orl_count, buf);
if (bfd_bwrite (buf, (bfd_size_type) 4, abfd) != 4)
- return false;
+ return FALSE;
sub = abfd->archive_head;
fileoff = SIZEOF_AR_FILE_HDR;
@@ -1597,7 +1626,7 @@ xcoff_write_armap_old (abfd, elength, map, orl_count, stridx)
{
H_PUT_32 (abfd, fileoff, buf);
if (bfd_bwrite (buf, (bfd_size_type) 4, abfd) != 4)
- return false;
+ return FALSE;
++i;
}
namlen = strlen (normalize_filename (sub));
@@ -1618,7 +1647,7 @@ xcoff_write_armap_old (abfd, elength, map, orl_count, stridx)
name = *map[i].name;
namlen = strlen (name);
if (bfd_bwrite (name, (bfd_size_type) (namlen + 1), abfd) != namlen + 1)
- return false;
+ return FALSE;
}
if ((stridx & 1) != 0)
@@ -1627,10 +1656,10 @@ xcoff_write_armap_old (abfd, elength, map, orl_count, stridx)
b = '\0';
if (bfd_bwrite (&b, (bfd_size_type) 1, abfd) != 1)
- return false;
+ return FALSE;
}
- return true;
+ return TRUE;
}
static char buff20[XCOFFARMAGBIG_ELEMENT_SIZE + 1];
@@ -1644,7 +1673,7 @@ static char buff20[XCOFFARMAGBIG_ELEMENT_SIZE + 1];
#define PRINT12(d, v) \
sprintf (buff20, FMT12, (int)(v)), \
- memcpy ((void *) (d), buff20, 12)
+ memcpy ((void *) (d), buff20, 12)
#define PRINT12_OCTAL(d, v) \
sprintf (buff20, FMT12_OCTAL, (unsigned int)(v)), \
@@ -1652,14 +1681,14 @@ static char buff20[XCOFFARMAGBIG_ELEMENT_SIZE + 1];
#define PRINT4(d, v) \
sprintf (buff20, FMT4, (int)(v)), \
- memcpy ((void *) (d), buff20, 4)
+ memcpy ((void *) (d), buff20, 4)
#define READ20(d, v) \
buff20[20] = 0, \
memcpy (buff20, (d), 20), \
(v) = bfd_scan_vma (buff20, (const char **) NULL, 10)
-static boolean
+static bfd_boolean
do_pad (abfd, number)
bfd *abfd;
unsigned int number;
@@ -1668,16 +1697,16 @@ do_pad (abfd, number)
/* Limit pad to <= 4096. */
if (number > 4096)
- return false;
+ return FALSE;
while (number--)
if (bfd_bwrite (&b, (bfd_size_type) 1, abfd) != 1)
- return false;
+ return FALSE;
- return true;
+ return TRUE;
}
-static boolean
+static bfd_boolean
do_copy (out_bfd, in_bfd)
bfd *out_bfd;
bfd *in_bfd;
@@ -1686,7 +1715,7 @@ do_copy (out_bfd, in_bfd)
bfd_byte buffer[DEFAULT_BUFFERSIZE];
if (bfd_seek (in_bfd, (file_ptr) 0, SEEK_SET) != 0)
- return false;
+ return FALSE;
remaining = arelt_size (in_bfd);
@@ -1694,22 +1723,22 @@ do_copy (out_bfd, in_bfd)
{
if (bfd_bread (buffer, DEFAULT_BUFFERSIZE, in_bfd) != DEFAULT_BUFFERSIZE
|| bfd_bwrite (buffer, DEFAULT_BUFFERSIZE, out_bfd) != DEFAULT_BUFFERSIZE)
- return false;
+ return FALSE;
remaining -= DEFAULT_BUFFERSIZE;
}
if (remaining)
{
- if (bfd_bread (buffer, remaining, in_bfd) != remaining
+ if (bfd_bread (buffer, remaining, in_bfd) != remaining
|| bfd_bwrite (buffer, remaining, out_bfd) != remaining)
- return false;
+ return FALSE;
}
- return true;
+ return TRUE;
}
-static boolean
+static bfd_boolean
do_shared_object_padding (out_bfd, in_bfd, offset, ar_header_size)
bfd *out_bfd;
bfd *in_bfd;
@@ -1729,15 +1758,15 @@ do_shared_object_padding (out_bfd, in_bfd, offset, ar_header_size)
pad -= (*offset + ar_header_size) & (pad - 1);
if (! do_pad (out_bfd, pad))
- return false;
+ return FALSE;
*offset += pad;
}
- return true;
+ return TRUE;
}
-static boolean
+static bfd_boolean
xcoff_write_armap_big (abfd, elength, map, orl_count, stridx)
bfd *abfd;
unsigned int elength ATTRIBUTE_UNUSED;
@@ -1751,7 +1780,7 @@ xcoff_write_armap_big (abfd, elength, map, orl_count, stridx)
bfd *current_bfd;
size_t string_length;
ufile_ptr nextoff, prevoff;
-
+
/* First, we look through the symbols and work out which are
from 32-bit objects and which from 64-bit ones. */
sym_32 = sym_64 = str_32 = str_64 = 0;
@@ -1796,50 +1825,50 @@ xcoff_write_armap_big (abfd, elength, map, orl_count, stridx)
BFD_ASSERT (nextoff == bfd_tell (abfd));
- /* Write out the symbol table.
- Layout :
-
+ /* Write out the symbol table.
+ Layout :
+
standard big archive header
- 0x0000 ar_size [0x14]
- 0x0014 ar_nxtmem [0x14]
- 0x0028 ar_prvmem [0x14]
- 0x003C ar_date [0x0C]
- 0x0048 ar_uid [0x0C]
- 0x0054 ar_gid [0x0C]
- 0x0060 ar_mod [0x0C]
- 0x006C ar_namelen[0x04]
- 0x0070 ar_fmag [SXCOFFARFMAG]
-
- Symbol table
- 0x0072 num_syms [0x08], binary
- 0x0078 offsets [0x08 * num_syms], binary
- 0x0086 + 0x08 * num_syms names [??]
- ?? pad to even bytes.
+ 0x0000 ar_size [0x14]
+ 0x0014 ar_nxtmem [0x14]
+ 0x0028 ar_prvmem [0x14]
+ 0x003C ar_date [0x0C]
+ 0x0048 ar_uid [0x0C]
+ 0x0054 ar_gid [0x0C]
+ 0x0060 ar_mod [0x0C]
+ 0x006C ar_namelen[0x04]
+ 0x0070 ar_fmag [SXCOFFARFMAG]
+
+ Symbol table
+ 0x0072 num_syms [0x08], binary
+ 0x0078 offsets [0x08 * num_syms], binary
+ 0x0086 + 0x08 * num_syms names [??]
+ ?? pad to even bytes.
*/
- if (sym_32)
+ if (sym_32)
{
struct xcoff_ar_hdr_big *hdr;
bfd_byte *symbol_table;
bfd_byte *st;
file_ptr fileoff;
- bfd_vma symbol_table_size =
+ bfd_vma symbol_table_size =
SIZEOF_AR_HDR_BIG
+ SXCOFFARFMAG
- + 8
- + 8 * sym_32
+ + 8
+ + 8 * sym_32
+ str_32 + (str_32 & 1);
symbol_table = NULL;
symbol_table = (bfd_byte *) bfd_zmalloc (symbol_table_size);
if (symbol_table == NULL)
- return false;
+ return FALSE;
hdr = (struct xcoff_ar_hdr_big *) symbol_table;
-
+
PRINT20 (hdr->size, 8 + 8 * sym_32 + str_32 + (str_32 & 1));
-
+
if (sym_64)
PRINT20 (hdr->nextoff, nextoff + symbol_table_size);
else
@@ -1858,7 +1887,7 @@ xcoff_write_armap_big (abfd, elength, map, orl_count, stridx)
bfd_h_put_64 (abfd, sym_32, st);
st += 8;
-
+
/* loop over the 32 bit offsets */
current_bfd = abfd->archive_head;
if (current_bfd != NULL)
@@ -1917,27 +1946,27 @@ xcoff_write_armap_big (abfd, elength, map, orl_count, stridx)
prevoff = nextoff;
nextoff = nextoff + symbol_table_size;
}
- else
+ else
PRINT20 (fhdr->symoff, 0);
-
- if (sym_64)
+
+ if (sym_64)
{
struct xcoff_ar_hdr_big *hdr;
bfd_byte *symbol_table;
bfd_byte *st;
file_ptr fileoff;
- bfd_vma symbol_table_size =
+ bfd_vma symbol_table_size =
SIZEOF_AR_HDR_BIG
+ SXCOFFARFMAG
- + 8
- + 8 * sym_64
+ + 8
+ + 8 * sym_64
+ str_64 + (str_64 & 1);
symbol_table = NULL;
symbol_table = (bfd_byte *) bfd_zmalloc (symbol_table_size);
if (symbol_table == NULL)
- return false;
+ return FALSE;
hdr = (struct xcoff_ar_hdr_big *) symbol_table;
@@ -1956,7 +1985,7 @@ xcoff_write_armap_big (abfd, elength, map, orl_count, stridx)
bfd_h_put_64 (abfd, sym_64, st);
st += 8;
-
+
/* loop over the 64 bit offsets */
current_bfd = abfd->archive_head;
if (current_bfd != NULL)
@@ -2014,13 +2043,13 @@ xcoff_write_armap_big (abfd, elength, map, orl_count, stridx)
PRINT20 (fhdr->symoff64, nextoff);
}
- else
+ else
PRINT20 (fhdr->symoff64, 0);
-
- return true;
+
+ return TRUE;
}
-boolean
+bfd_boolean
_bfd_xcoff_write_armap (abfd, elength, map, orl_count, stridx)
bfd *abfd;
unsigned int elength ATTRIBUTE_UNUSED;
@@ -2037,7 +2066,7 @@ _bfd_xcoff_write_armap (abfd, elength, map, orl_count, stridx)
/* Write out an XCOFF archive. We always write an entire archive,
rather than fussing with the freelist and so forth. */
-static boolean
+static bfd_boolean
xcoff_write_archive_contents_old (abfd)
bfd *abfd;
{
@@ -2045,8 +2074,8 @@ xcoff_write_archive_contents_old (abfd)
bfd_size_type count;
bfd_size_type total_namlen;
file_ptr *offsets;
- boolean makemap;
- boolean hasobjects;
+ bfd_boolean makemap;
+ bfd_boolean hasobjects;
ufile_ptr prevoff, nextoff;
bfd *sub;
size_t i;
@@ -2069,13 +2098,13 @@ xcoff_write_archive_contents_old (abfd)
}
offsets = (file_ptr *) bfd_alloc (abfd, count * sizeof (file_ptr));
if (offsets == NULL)
- return false;
+ return FALSE;
if (bfd_seek (abfd, (file_ptr) SIZEOF_AR_FILE_HDR, SEEK_SET) != 0)
- return false;
+ return FALSE;
makemap = bfd_has_map (abfd);
- hasobjects = false;
+ hasobjects = FALSE;
prevoff = 0;
nextoff = SIZEOF_AR_FILE_HDR;
for (sub = abfd->archive_head, i = 0; sub != NULL; sub = sub->next, i++)
@@ -2088,7 +2117,7 @@ xcoff_write_archive_contents_old (abfd)
if (makemap && ! hasobjects)
{
if (bfd_check_format (sub, bfd_object))
- hasobjects = true;
+ hasobjects = TRUE;
}
name = normalize_filename (sub);
@@ -2108,7 +2137,7 @@ xcoff_write_archive_contents_old (abfd)
if (stat (bfd_get_filename (sub), &s) != 0)
{
bfd_set_error (bfd_error_system_call);
- return false;
+ return FALSE;
}
sprintf (ahdrp->size, "%ld", (long) s.st_size);
@@ -2122,7 +2151,7 @@ xcoff_write_archive_contents_old (abfd)
size = sizeof (struct areltdata);
sub->arelt_data = bfd_alloc (sub, size);
if (sub->arelt_data == NULL)
- return false;
+ return FALSE;
}
arch_eltdata (sub)->parsed_size = s.st_size;
@@ -2132,7 +2161,7 @@ xcoff_write_archive_contents_old (abfd)
sprintf (ahdrp->namlen, "%ld", (long) namlen);
/* If the length of the name is odd, we write out the null byte
- after the name as well. */
+ after the name as well. */
namlen = (namlen + 1) &~ (bfd_size_type) 1;
remaining = arelt_size (sub);
@@ -2157,19 +2186,19 @@ xcoff_write_archive_contents_old (abfd)
if ((bfd_bwrite ((PTR) ahdrp, (bfd_size_type) SIZEOF_AR_HDR, abfd)
!= SIZEOF_AR_HDR)
- || (bfd_bwrite ((PTR) name, namlen, abfd) != namlen)
- || (bfd_bwrite ((PTR) XCOFFARFMAG, (bfd_size_type) SXCOFFARFMAG, abfd)
- != SXCOFFARFMAG))
- return false;
+ || bfd_bwrite ((PTR) name, namlen, abfd) != namlen
+ || bfd_bwrite ((PTR) XCOFFARFMAG, (bfd_size_type) SXCOFFARFMAG,
+ abfd) != SXCOFFARFMAG)
+ return FALSE;
if (bfd_seek (sub, (file_ptr) 0, SEEK_SET) != 0)
- return false;
+ return FALSE;
if (! do_copy (abfd, sub))
- return false;
-
+ return FALSE;
+
if (! do_pad (abfd, size & 1))
- return false;
+ return FALSE;
}
sprintf (fhdr.lastmemoff, "%ld", (long) prevoff);
@@ -2213,18 +2242,18 @@ xcoff_write_archive_contents_old (abfd)
!= SIZEOF_AR_HDR)
|| (bfd_bwrite ((PTR) XCOFFARFMAG, (bfd_size_type) SXCOFFARFMAG, abfd)
!= SXCOFFARFMAG))
- return false;
+ return FALSE;
sprintf (decbuf, "%-12ld", (long) count);
if (bfd_bwrite ((PTR) decbuf, (bfd_size_type) XCOFFARMAG_ELEMENT_SIZE, abfd)
!= XCOFFARMAG_ELEMENT_SIZE)
- return false;
+ return FALSE;
for (i = 0; i < (size_t) count; i++)
{
sprintf (decbuf, "%-12ld", (long) offsets[i]);
- if (bfd_bwrite ((PTR) decbuf, (bfd_size_type) XCOFFARMAG_ELEMENT_SIZE,
+ if (bfd_bwrite ((PTR) decbuf, (bfd_size_type) XCOFFARMAG_ELEMENT_SIZE,
abfd) != XCOFFARMAG_ELEMENT_SIZE)
- return false;
+ return FALSE;
}
for (sub = abfd->archive_head; sub != NULL; sub = sub->next)
{
@@ -2234,11 +2263,11 @@ xcoff_write_archive_contents_old (abfd)
name = normalize_filename (sub);
namlen = strlen (name);
if (bfd_bwrite ((PTR) name, namlen + 1, abfd) != namlen + 1)
- return false;
+ return FALSE;
}
if (! do_pad (abfd, size & 1))
- return false;
+ return FALSE;
/* Write out the armap, if appropriate. */
if (! makemap || ! hasobjects)
@@ -2249,7 +2278,7 @@ xcoff_write_archive_contents_old (abfd)
sprintf (fhdr.symoff, "%ld", (long) nextoff);
bfd_ardata (abfd)->tdata = (PTR) &fhdr;
if (! _bfd_compute_and_write_armap (abfd, 0))
- return false;
+ return FALSE;
}
/* Write out the archive file header. */
@@ -2262,12 +2291,12 @@ xcoff_write_archive_contents_old (abfd)
if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0
|| (bfd_bwrite ((PTR) &fhdr, (bfd_size_type) SIZEOF_AR_FILE_HDR, abfd)
!= SIZEOF_AR_FILE_HDR))
- return false;
+ return FALSE;
- return true;
+ return TRUE;
}
-static boolean
+static bfd_boolean
xcoff_write_archive_contents_big (abfd)
bfd *abfd;
{
@@ -2275,8 +2304,8 @@ xcoff_write_archive_contents_big (abfd)
bfd_size_type count;
bfd_size_type total_namlen;
file_ptr *offsets;
- boolean makemap;
- boolean hasobjects;
+ bfd_boolean makemap;
+ bfd_boolean hasobjects;
ufile_ptr prevoff, nextoff;
bfd *current_bfd;
size_t i;
@@ -2289,13 +2318,13 @@ xcoff_write_archive_contents_big (abfd)
memcpy (fhdr.magic, XCOFFARMAGBIG, SXCOFFARMAG);
if (bfd_seek (abfd, (file_ptr) SIZEOF_AR_FILE_HDR_BIG, SEEK_SET) != 0)
- return false;
-
+ return FALSE;
+
/* Calculate count and total_namlen. */
makemap = bfd_has_map (abfd);
- hasobjects = false;
- for (current_bfd = abfd->archive_head, count = 0, total_namlen = 0;
- current_bfd != NULL;
+ hasobjects = FALSE;
+ for (current_bfd = abfd->archive_head, count = 0, total_namlen = 0;
+ current_bfd != NULL;
current_bfd = current_bfd->next, count++)
{
total_namlen += strlen (normalize_filename (current_bfd)) + 1;
@@ -2303,7 +2332,7 @@ xcoff_write_archive_contents_big (abfd)
if (makemap
&& ! hasobjects
&& bfd_check_format (current_bfd, bfd_object))
- hasobjects = true;
+ hasobjects = TRUE;
}
offsets = NULL;
@@ -2311,13 +2340,13 @@ xcoff_write_archive_contents_big (abfd)
{
offsets = (file_ptr *) bfd_malloc (count * sizeof (file_ptr));
if (offsets == NULL)
- return false;
+ return FALSE;
}
prevoff = 0;
nextoff = SIZEOF_AR_FILE_HDR_BIG;
- for (current_bfd = abfd->archive_head, i = 0;
- current_bfd != NULL;
+ for (current_bfd = abfd->archive_head, i = 0;
+ current_bfd != NULL;
current_bfd = current_bfd->next, i++)
{
const char *name;
@@ -2339,12 +2368,12 @@ xcoff_write_archive_contents_big (abfd)
ahdrp = &ahdr;
/* XXX This should actually be a call to stat64 (at least on
- 32-bit machines).
+ 32-bit machines).
XXX This call will fail if the original object is not found. */
if (stat (bfd_get_filename (current_bfd), &s) != 0)
{
bfd_set_error (bfd_error_system_call);
- return false;
+ return FALSE;
}
PRINT20 (ahdrp->size, s.st_size);
@@ -2358,7 +2387,7 @@ xcoff_write_archive_contents_big (abfd)
size = sizeof (struct areltdata);
current_bfd->arelt_data = bfd_alloc (current_bfd, size);
if (current_bfd->arelt_data == NULL)
- return false;
+ return FALSE;
}
arch_eltdata (current_bfd)->parsed_size = s.st_size;
@@ -2368,7 +2397,7 @@ xcoff_write_archive_contents_big (abfd)
PRINT4 (ahdrp->namlen, namlen);
/* If the length of the name is odd, we write out the null byte
- after the name as well. */
+ after the name as well. */
namlen = (namlen + 1) &~ (bfd_size_type) 1;
remaining = arelt_size (current_bfd);
@@ -2383,9 +2412,9 @@ xcoff_write_archive_contents_big (abfd)
Their text section needs to be aligned wrt the archive file position.
This requires extra padding before the archive header. */
if (! do_shared_object_padding (abfd, current_bfd, & nextoff,
- SIZEOF_AR_HDR_BIG + namlen
+ SIZEOF_AR_HDR_BIG + namlen
+ SXCOFFARFMAG))
- return false;
+ return FALSE;
offsets[i] = nextoff;
@@ -2397,18 +2426,18 @@ xcoff_write_archive_contents_big (abfd)
if ((bfd_bwrite ((PTR) ahdrp, (bfd_size_type) SIZEOF_AR_HDR_BIG, abfd)
!= SIZEOF_AR_HDR_BIG)
|| bfd_bwrite ((PTR) name, (bfd_size_type) namlen, abfd) != namlen
- || (bfd_bwrite ((PTR) XCOFFARFMAG, (bfd_size_type) SXCOFFARFMAG,
+ || (bfd_bwrite ((PTR) XCOFFARFMAG, (bfd_size_type) SXCOFFARFMAG,
abfd) != SXCOFFARFMAG))
- return false;
+ return FALSE;
if (bfd_seek (current_bfd, (file_ptr) 0, SEEK_SET) != 0)
- return false;
+ return FALSE;
if (! do_copy (abfd, current_bfd))
- return false;
-
+ return FALSE;
+
if (! do_pad (abfd, size & 1))
- return false;
+ return FALSE;
}
if (count)
@@ -2417,25 +2446,25 @@ xcoff_write_archive_contents_big (abfd)
PRINT20 (fhdr.lastmemoff, prevoff);
}
- /* Write out the member table.
- Layout :
+ /* Write out the member table.
+ Layout :
standard big archive header
- 0x0000 ar_size [0x14]
- 0x0014 ar_nxtmem [0x14]
- 0x0028 ar_prvmem [0x14]
- 0x003C ar_date [0x0C]
- 0x0048 ar_uid [0x0C]
- 0x0054 ar_gid [0x0C]
- 0x0060 ar_mod [0x0C]
- 0x006C ar_namelen[0x04]
- 0x0070 ar_fmag [0x02]
-
- Member table
- 0x0072 count [0x14]
- 0x0086 offsets [0x14 * counts]
- 0x0086 + 0x14 * counts names [??]
- ?? pad to even bytes.
+ 0x0000 ar_size [0x14]
+ 0x0014 ar_nxtmem [0x14]
+ 0x0028 ar_prvmem [0x14]
+ 0x003C ar_date [0x0C]
+ 0x0048 ar_uid [0x0C]
+ 0x0054 ar_gid [0x0C]
+ 0x0060 ar_mod [0x0C]
+ 0x006C ar_namelen[0x04]
+ 0x0070 ar_fmag [0x02]
+
+ Member table
+ 0x0072 count [0x14]
+ 0x0086 offsets [0x14 * counts]
+ 0x0086 + 0x14 * counts names [??]
+ ?? pad to even bytes.
*/
BFD_ASSERT (nextoff == bfd_tell (abfd));
@@ -2450,14 +2479,14 @@ xcoff_write_archive_contents_big (abfd)
member_table = NULL;
member_table = (bfd_byte *) bfd_zmalloc (member_table_size);
if (member_table == NULL)
- return false;
+ return FALSE;
hdr = (struct xcoff_ar_hdr_big *) member_table;
PRINT20 (hdr->size, (XCOFFARMAGBIG_ELEMENT_SIZE
+ count * XCOFFARMAGBIG_ELEMENT_SIZE
+ total_namlen + (total_namlen & 1)));
- if (makemap && hasobjects)
+ if (makemap && hasobjects)
PRINT20 (hdr->nextoff, nextoff + member_table_size);
else
PRINT20 (hdr->nextoff, 0);
@@ -2467,7 +2496,7 @@ xcoff_write_archive_contents_big (abfd)
PRINT12 (hdr->gid, 0);
PRINT12 (hdr->mode, 0);
PRINT4 (hdr->namlen, 0);
-
+
mt = member_table + SIZEOF_AR_HDR_BIG;
memcpy (mt, XCOFFARFMAG, SXCOFFARFMAG);
mt += SXCOFFARFMAG;
@@ -2480,25 +2509,25 @@ xcoff_write_archive_contents_big (abfd)
mt += XCOFFARMAGBIG_ELEMENT_SIZE;
}
- if (count)
+ if (count)
{
free (offsets);
offsets = NULL;
}
- for (current_bfd = abfd->archive_head; current_bfd != NULL;
+ for (current_bfd = abfd->archive_head; current_bfd != NULL;
current_bfd = current_bfd->next)
{
const char *name;
size_t namlen;
name = normalize_filename (current_bfd);
- namlen = sprintf(mt, "%s", name);
+ namlen = sprintf (mt, "%s", name);
mt += namlen + 1;
}
-
+
if (bfd_bwrite (member_table, member_table_size, abfd) != member_table_size)
- return false;
+ return FALSE;
free (member_table);
member_table = NULL;
@@ -2510,7 +2539,7 @@ xcoff_write_archive_contents_big (abfd)
/* Write out the armap, if appropriate. */
- if (! makemap || ! hasobjects)
+ if (! makemap || ! hasobjects)
PRINT20 (fhdr.symoff, 0);
else
{
@@ -2518,23 +2547,23 @@ xcoff_write_archive_contents_big (abfd)
/* Save nextoff in fhdr.symoff so the armap routine can use it. */
PRINT20 (fhdr.symoff, nextoff);
-
+
bfd_ardata (abfd)->tdata = (PTR) &fhdr;
if (! _bfd_compute_and_write_armap (abfd, 0))
- return false;
+ return FALSE;
}
/* Write out the archive file header. */
if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0
- || (bfd_bwrite ((PTR) &fhdr, (bfd_size_type) SIZEOF_AR_FILE_HDR_BIG,
+ || (bfd_bwrite ((PTR) &fhdr, (bfd_size_type) SIZEOF_AR_FILE_HDR_BIG,
abfd) != SIZEOF_AR_FILE_HDR_BIG))
- return false;
-
- return true;
+ return FALSE;
+
+ return TRUE;
}
-boolean
+bfd_boolean
_bfd_xcoff_write_archive_contents (abfd)
bfd *abfd;
{
@@ -2550,7 +2579,7 @@ _bfd_xcoff_write_archive_contents (abfd)
int
_bfd_xcoff_sizeof_headers (abfd, reloc)
bfd *abfd;
- boolean reloc ATTRIBUTE_UNUSED;
+ bfd_boolean reloc ATTRIBUTE_UNUSED;
{
int size;
@@ -2725,8 +2754,8 @@ xcoff_swap_ldrel_out (abfd, src, d)
}
-boolean
-xcoff_reloc_type_noop (input_bfd, input_section, output_bfd, rel, sym, howto,
+bfd_boolean
+xcoff_reloc_type_noop (input_bfd, input_section, output_bfd, rel, sym, howto,
val, addend, relocation, contents)
bfd *input_bfd ATTRIBUTE_UNUSED;
asection *input_section ATTRIBUTE_UNUSED;
@@ -2739,11 +2768,11 @@ xcoff_reloc_type_noop (input_bfd, input_section, output_bfd, rel, sym, howto,
bfd_vma *relocation ATTRIBUTE_UNUSED;
bfd_byte *contents ATTRIBUTE_UNUSED;
{
- return true;
+ return TRUE;
}
-boolean
-xcoff_reloc_type_fail (input_bfd, input_section, output_bfd, rel, sym, howto,
+bfd_boolean
+xcoff_reloc_type_fail (input_bfd, input_section, output_bfd, rel, sym, howto,
val, addend, relocation, contents)
bfd *input_bfd;
asection *input_section ATTRIBUTE_UNUSED;
@@ -2760,11 +2789,11 @@ xcoff_reloc_type_fail (input_bfd, input_section, output_bfd, rel, sym, howto,
(_("%s: unsupported relocation type 0x%02x"),
bfd_get_filename (input_bfd), (unsigned int) rel->r_type);
bfd_set_error (bfd_error_bad_value);
- return false;
+ return FALSE;
}
-boolean
-xcoff_reloc_type_pos (input_bfd, input_section, output_bfd, rel, sym, howto,
+bfd_boolean
+xcoff_reloc_type_pos (input_bfd, input_section, output_bfd, rel, sym, howto,
val, addend, relocation, contents)
bfd *input_bfd ATTRIBUTE_UNUSED;
asection *input_section ATTRIBUTE_UNUSED;
@@ -2778,11 +2807,11 @@ xcoff_reloc_type_pos (input_bfd, input_section, output_bfd, rel, sym, howto,
bfd_byte *contents ATTRIBUTE_UNUSED;
{
*relocation = val + addend;
- return true;
+ return TRUE;
}
-boolean
-xcoff_reloc_type_neg (input_bfd, input_section, output_bfd, rel, sym, howto,
+bfd_boolean
+xcoff_reloc_type_neg (input_bfd, input_section, output_bfd, rel, sym, howto,
val, addend, relocation, contents)
bfd *input_bfd ATTRIBUTE_UNUSED;
asection *input_section ATTRIBUTE_UNUSED;
@@ -2796,11 +2825,11 @@ xcoff_reloc_type_neg (input_bfd, input_section, output_bfd, rel, sym, howto,
bfd_byte *contents ATTRIBUTE_UNUSED;
{
*relocation = addend - val;
- return true;
+ return TRUE;
}
-boolean
-xcoff_reloc_type_rel (input_bfd, input_section, output_bfd, rel, sym, howto,
+bfd_boolean
+xcoff_reloc_type_rel (input_bfd, input_section, output_bfd, rel, sym, howto,
val, addend, relocation, contents)
bfd *input_bfd ATTRIBUTE_UNUSED;
asection *input_section;
@@ -2813,7 +2842,7 @@ xcoff_reloc_type_rel (input_bfd, input_section, output_bfd, rel, sym, howto,
bfd_vma *relocation;
bfd_byte *contents ATTRIBUTE_UNUSED;
{
- howto->pc_relative = true;
+ howto->pc_relative = TRUE;
/* A PC relative reloc includes the section address. */
addend += input_section->vma;
@@ -2821,11 +2850,11 @@ xcoff_reloc_type_rel (input_bfd, input_section, output_bfd, rel, sym, howto,
*relocation = val + addend;
*relocation -= (input_section->output_section->vma
+ input_section->output_offset);
- return true;
+ return TRUE;
}
-boolean
-xcoff_reloc_type_toc (input_bfd, input_section, output_bfd, rel, sym, howto,
+bfd_boolean
+xcoff_reloc_type_toc (input_bfd, input_section, output_bfd, rel, sym, howto,
val, addend, relocation, contents)
bfd *input_bfd;
asection *input_section ATTRIBUTE_UNUSED;
@@ -2840,8 +2869,8 @@ xcoff_reloc_type_toc (input_bfd, input_section, output_bfd, rel, sym, howto,
{
struct xcoff_link_hash_entry *h;
- if (0 > rel->r_symndx)
- return false;
+ if (0 > rel->r_symndx)
+ return FALSE;
h = obj_xcoff_sym_hashes (input_bfd)[rel->r_symndx];
@@ -2854,21 +2883,21 @@ xcoff_reloc_type_toc (input_bfd, input_section, output_bfd, rel, sym, howto,
bfd_get_filename (input_bfd), rel->r_vaddr,
h->root.root.string);
bfd_set_error (bfd_error_bad_value);
- return false;
+ return FALSE;
}
-
+
BFD_ASSERT ((h->flags & XCOFF_SET_TOC) == 0);
val = (h->toc_section->output_section->vma
+ h->toc_section->output_offset);
}
-
+
*relocation = ((val - xcoff_data (output_bfd)->toc)
- (sym->n_value - xcoff_data (input_bfd)->toc));
- return true;
+ return TRUE;
}
-boolean
-xcoff_reloc_type_ba (input_bfd, input_section, output_bfd, rel, sym, howto,
+bfd_boolean
+xcoff_reloc_type_ba (input_bfd, input_section, output_bfd, rel, sym, howto,
val, addend, relocation, contents)
bfd *input_bfd ATTRIBUTE_UNUSED;
asection *input_section ATTRIBUTE_UNUSED;
@@ -2886,11 +2915,11 @@ xcoff_reloc_type_ba (input_bfd, input_section, output_bfd, rel, sym, howto,
*relocation = val + addend;
- return true;
+ return TRUE;
}
-static boolean
-xcoff_reloc_type_br (input_bfd, input_section, output_bfd, rel, sym, howto,
+static bfd_boolean
+xcoff_reloc_type_br (input_bfd, input_section, output_bfd, rel, sym, howto,
val, addend, relocation, contents)
bfd *input_bfd;
asection *input_section;
@@ -2905,8 +2934,8 @@ xcoff_reloc_type_br (input_bfd, input_section, output_bfd, rel, sym, howto,
{
struct xcoff_link_hash_entry *h;
- if (0 > rel->r_symndx)
- return false;
+ if (0 > rel->r_symndx)
+ return FALSE;
h = obj_xcoff_sym_hashes (input_bfd)[rel->r_symndx];
@@ -2917,60 +2946,60 @@ xcoff_reloc_type_br (input_bfd, input_section, output_bfd, rel, sym, howto,
call is followed by a lwz r2,20(r1), but the call is not
going to global linkage code, we can replace the load with a
cror. */
- if (NULL != h
- && bfd_link_hash_defined == h->root.type
+ if (NULL != h
+ && bfd_link_hash_defined == h->root.type
&& (rel->r_vaddr - input_section->vma + 8
<= input_section->_cooked_size))
{
bfd_byte *pnext;
unsigned long next;
-
+
pnext = contents + (rel->r_vaddr - input_section->vma) + 4;
next = bfd_get_32 (input_bfd, pnext);
-
+
/* The _ptrgl function is magic. It is used by the AIX
compiler to call a function through a pointer. */
if (h->smclas == XMC_GL || strcmp (h->root.root.string, "._ptrgl") == 0)
{
- if (next == 0x4def7b82 /* cror 15,15,15 */
- || next == 0x4ffffb82 /* cror 31,31,31 */
- || next == 0x60000000) /* ori r0,r0,0 */
- bfd_put_32 (input_bfd, 0x80410014, pnext); /* lwz r1,20(r1) */
-
+ if (next == 0x4def7b82 /* cror 15,15,15 */
+ || next == 0x4ffffb82 /* cror 31,31,31 */
+ || next == 0x60000000) /* ori r0,r0,0 */
+ bfd_put_32 (input_bfd, 0x80410014, pnext); /* lwz r1,20(r1) */
+
}
else
- {
- if (next == 0x80410014) /* lwz r1,20(r1) */
- bfd_put_32 (input_bfd, 0x60000000, pnext); /* ori r0,r0,0 */
- }
- }
- else if (NULL != h && bfd_link_hash_undefined == h->root.type)
+ {
+ if (next == 0x80410014) /* lwz r1,20(r1) */
+ bfd_put_32 (input_bfd, 0x60000000, pnext); /* ori r0,r0,0 */
+ }
+ }
+ else if (NULL != h && bfd_link_hash_undefined == h->root.type)
{
/* Normally, this relocation is against a defined symbol. In the
case where this is a partial link and the output section offset
- is greater than 2^25, the linker will return an invalid error
+ is greater than 2^25, the linker will return an invalid error
message that the relocation has been truncated. Yes it has been
- truncated but no it not important. For this case, disable the
+ truncated but no it not important. For this case, disable the
overflow checking. */
-
+
howto->complain_on_overflow = complain_overflow_dont;
}
-
- howto->pc_relative = true;
+
+ howto->pc_relative = TRUE;
howto->src_mask &= ~3;
howto->dst_mask = howto->src_mask;
/* A PC relative reloc includes the section address. */
addend += input_section->vma;
-
+
*relocation = val + addend;
*relocation -= (input_section->output_section->vma
+ input_section->output_offset);
- return true;
+ return TRUE;
}
-boolean
-xcoff_reloc_type_crel (input_bfd, input_section, output_bfd, rel, sym, howto,
+bfd_boolean
+xcoff_reloc_type_crel (input_bfd, input_section, output_bfd, rel, sym, howto,
val, addend, relocation, contents)
bfd *input_bfd ATTRIBUTE_UNUSED;
asection *input_section;
@@ -2983,7 +3012,7 @@ xcoff_reloc_type_crel (input_bfd, input_section, output_bfd, rel, sym, howto,
bfd_vma *relocation;
bfd_byte *contents ATTRIBUTE_UNUSED;
{
- howto->pc_relative = true;
+ howto->pc_relative = TRUE;
howto->src_mask &= ~3;
howto->dst_mask = howto->src_mask;
@@ -2993,29 +3022,29 @@ xcoff_reloc_type_crel (input_bfd, input_section, output_bfd, rel, sym, howto,
*relocation = val + addend;
*relocation -= (input_section->output_section->vma
+ input_section->output_offset);
- return true;
+ return TRUE;
}
-static boolean
-xcoff_complain_overflow_dont_func (input_bfd, val, relocation, howto)
+static bfd_boolean
+xcoff_complain_overflow_dont_func (input_bfd, val, relocation, howto)
bfd *input_bfd ATTRIBUTE_UNUSED;
bfd_vma val ATTRIBUTE_UNUSED;
bfd_vma relocation ATTRIBUTE_UNUSED;
struct reloc_howto_struct *howto ATTRIBUTE_UNUSED;
{
- return false;
+ return FALSE;
}
-static boolean
-xcoff_complain_overflow_bitfield_func (input_bfd, val, relocation, howto)
+static bfd_boolean
+xcoff_complain_overflow_bitfield_func (input_bfd, val, relocation, howto)
bfd *input_bfd;
bfd_vma val;
bfd_vma relocation;
- struct reloc_howto_struct *howto;
+ struct reloc_howto_struct *howto;
{
bfd_vma addrmask, fieldmask, signmask, ss;
bfd_vma a, b, sum;
-
+
/* Get the values to be added together. For signed and unsigned
relocations, we assume that all values should be truncated to
the size of an address. For bitfields, all the bits matter.
@@ -3031,7 +3060,7 @@ xcoff_complain_overflow_bitfield_func (input_bfd, val, relocation, howto)
operand. */
a >>= howto->rightshift;
b >>= howto->bitpos;
-
+
/* Bitfields are sometimes used for signed numbers; for
example, a 13-bit field sometimes represents values in
0..8191 and sometimes represents values in -4096..4095.
@@ -3043,7 +3072,7 @@ xcoff_complain_overflow_bitfield_func (input_bfd, val, relocation, howto)
assumed that it was fully sign extended, and we will keep
that assumption. */
signmask = (fieldmask >> 1) + 1;
-
+
if ((a & ~ fieldmask) != 0)
{
/* Some bits out of the field are set. This might not
@@ -3054,12 +3083,12 @@ xcoff_complain_overflow_bitfield_func (input_bfd, val, relocation, howto)
ones, we are OK, assuming a signed bitfield. */
ss = (signmask << howto->rightshift) - 1;
if ((ss | relocation) != ~ (bfd_vma) 0)
- return true;
+ return TRUE;
a &= fieldmask;
}
-
+
/* We just assume (b & ~ fieldmask) == 0. */
-
+
/* We explicitly permit wrap around if this relocation
covers the high bit of an address. The Linux kernel
relies on it, and it is the only way to write assembler
@@ -3067,8 +3096,8 @@ xcoff_complain_overflow_bitfield_func (input_bfd, val, relocation, howto)
away from the location at which it is linked. */
if (howto->bitsize + howto->rightshift
== bfd_arch_bits_per_address (input_bfd))
- return false;
-
+ return FALSE;
+
sum = a + b;
if (sum < a || (sum & ~ fieldmask) != 0)
{
@@ -3076,14 +3105,14 @@ xcoff_complain_overflow_bitfield_func (input_bfd, val, relocation, howto)
for signed operands again. Here is the overflow test
is as for complain_overflow_signed. */
if (((~ (a ^ b)) & (a ^ sum)) & signmask)
- return true;
+ return TRUE;
}
-
- return false;
+
+ return FALSE;
}
-static boolean
-xcoff_complain_overflow_signed_func (input_bfd, val, relocation, howto)
+static bfd_boolean
+xcoff_complain_overflow_signed_func (input_bfd, val, relocation, howto)
bfd *input_bfd;
bfd_vma val;
bfd_vma relocation;
@@ -3091,7 +3120,7 @@ xcoff_complain_overflow_signed_func (input_bfd, val, relocation, howto)
{
bfd_vma addrmask, fieldmask, signmask, ss;
bfd_vma a, b, sum;
-
+
/* Get the values to be added together. For signed and unsigned
relocations, we assume that all values should be truncated to
the size of an address. For bitfields, all the bits matter.
@@ -3102,15 +3131,15 @@ xcoff_complain_overflow_signed_func (input_bfd, val, relocation, howto)
b = val & howto->src_mask;
a = (a & addrmask) >> howto->rightshift;
-
+
/* If any sign bits are set, all sign bits must be set.
That is, A must be a valid negative address after
shifting. */
signmask = ~ (fieldmask >> 1);
ss = a & signmask;
if (ss != 0 && ss != ((addrmask >> howto->rightshift) & signmask))
- return true;
-
+ return TRUE;
+
/* We only need this next bit of code if the sign bit of B
is below the sign bit of A. This would only happen if
SRC_MASK had fewer bits than BITSIZE. Note that if
@@ -3123,12 +3152,12 @@ xcoff_complain_overflow_signed_func (input_bfd, val, relocation, howto)
/* Set all the bits above the sign bit. */
b -= signmask <<= 1;
}
-
+
b = (b & addrmask) >> howto->bitpos;
-
+
/* Now we can do the addition. */
sum = a + b;
-
+
/* See if the result has the correct sign. Bits above the
sign bit are junk now; ignore them. If the sum is
positive, make sure we did not have all negative inputs;
@@ -3139,21 +3168,21 @@ xcoff_complain_overflow_signed_func (input_bfd, val, relocation, howto)
*/
signmask = (fieldmask >> 1) + 1;
if (((~ (a ^ b)) & (a ^ sum)) & signmask)
- return true;
-
- return false;
+ return TRUE;
+
+ return FALSE;
}
-static boolean
-xcoff_complain_overflow_unsigned_func (input_bfd, val, relocation, howto)
+static bfd_boolean
+xcoff_complain_overflow_unsigned_func (input_bfd, val, relocation, howto)
bfd *input_bfd;
bfd_vma val;
bfd_vma relocation;
- struct reloc_howto_struct *howto;
+ struct reloc_howto_struct *howto;
{
bfd_vma addrmask, fieldmask;
bfd_vma a, b, sum;
-
+
/* Get the values to be added together. For signed and unsigned
relocations, we assume that all values should be truncated to
the size of an address. For bitfields, all the bits matter.
@@ -3178,32 +3207,32 @@ xcoff_complain_overflow_unsigned_func (input_bfd, val, relocation, howto)
b = (b & addrmask) >> howto->bitpos;
sum = (a + b) & addrmask;
if ((a | b | sum) & ~ fieldmask)
- return true;
-
- return false;
+ return TRUE;
+
+ return FALSE;
}
/* This is the relocation function for the RS/6000/POWER/PowerPC.
This is currently the only processor which uses XCOFF; I hope that
- will never change.
+ will never change.
I took the relocation type definitions from two documents:
the PowerPC AIX Version 4 Application Binary Interface, First
Edition (April 1992), and the PowerOpen ABI, Big-Endian
32-Bit Hardware Implementation (June 30, 1994). Differences
- between the documents are noted below.
+ between the documents are noted below.
- Unsupported r_type's
+ Unsupported r_type's
R_RTB:
R_RRTBI:
R_RRTBA:
-
+
These relocs are defined by the PowerPC ABI to be
relative branches which use half of the difference
between the symbol and the program counter. I can't
quite figure out when this is useful. These relocs are
- not defined by the PowerOpen ABI.
+ not defined by the PowerOpen ABI.
Supported r_type's
@@ -3211,7 +3240,7 @@ xcoff_complain_overflow_unsigned_func (input_bfd, val, relocation, howto)
Simple positive relocation.
R_NEG:
- Simple negative relocation.
+ Simple negative relocation.
R_REL:
Simple PC relative relocation.
@@ -3229,16 +3258,16 @@ xcoff_complain_overflow_unsigned_func (input_bfd, val, relocation, howto)
R_GL:
GL linkage relocation. The value of this relocation
- is the address of the entry in the TOC section.
+ is the address of the entry in the TOC section.
R_TCL:
Local object TOC address. I can't figure out the
- difference between this and case R_GL.
+ difference between this and case R_GL.
R_TRL:
TOC relative relocation. A TOC relative load instruction
which may be changed to a load address instruction.
- FIXME: We don't currently implement this optimization.
+ FIXME: We don't currently implement this optimization.
R_TRLA:
TOC relative relocation. This is a TOC relative load
@@ -3248,55 +3277,55 @@ xcoff_complain_overflow_unsigned_func (input_bfd, val, relocation, howto)
R_BA:
Absolute branch. We don't want to mess with the lower
- two bits of the instruction.
+ two bits of the instruction.
R_CAI:
The PowerPC ABI defines this as an absolute call which
may be modified to become a relative call. The PowerOpen
- ABI does not define this relocation type.
-
+ ABI does not define this relocation type.
+
R_RBA:
Absolute branch which may be modified to become a
- relative branch.
+ relative branch.
R_RBAC:
The PowerPC ABI defines this as an absolute branch to a
fixed address which may be modified to an absolute branch
to a symbol. The PowerOpen ABI does not define this
- relocation type.
+ relocation type.
R_RBRC:
The PowerPC ABI defines this as an absolute branch to a
fixed address which may be modified to a relative branch.
- The PowerOpen ABI does not define this relocation type.
+ The PowerOpen ABI does not define this relocation type.
R_BR:
Relative branch. We don't want to mess with the lower
- two bits of the instruction.
+ two bits of the instruction.
R_CREL:
The PowerPC ABI defines this as a relative call which may
be modified to become an absolute call. The PowerOpen
- ABI does not define this relocation type.
+ ABI does not define this relocation type.
R_RBR:
A relative branch which may be modified to become an
absolute branch. FIXME: We don't implement this,
although we should for symbols of storage mapping class
- XMC_XO.
+ XMC_XO.
R_RL:
The PowerPC AIX ABI describes this as a load which may be
changed to a load address. The PowerOpen ABI says this
- is the same as case R_POS.
+ is the same as case R_POS.
R_RLA:
The PowerPC AIX ABI describes this as a load address
which may be changed to a load. The PowerOpen ABI says
- this is the same as R_POS.
+ this is the same as R_POS.
*/
-boolean
+bfd_boolean
xcoff_ppc_relocate_section (output_bfd, info, input_bfd,
input_section, contents, relocs, syms,
sections)
@@ -3328,8 +3357,8 @@ xcoff_ppc_relocate_section (output_bfd, info, input_bfd,
bfd_byte *location;
/* Relocation type R_REF is a special relocation type which is
- merely used to prevent garbage collection from occurring for
- the csect including the symbol which it references. */
+ merely used to prevent garbage collection from occurring for
+ the csect including the symbol which it references. */
if (rel->r_type == R_REF)
continue;
@@ -3338,33 +3367,33 @@ xcoff_ppc_relocate_section (output_bfd, info, input_bfd,
howto.rightshift = 0;
howto.bitsize = (rel->r_size & 0x1f) + 1;
howto.size = howto.bitsize > 16 ? 2 : 1;
- howto.pc_relative = false;
+ howto.pc_relative = FALSE;
howto.bitpos = 0;
howto.complain_on_overflow = (rel->r_size & 0x80
? complain_overflow_signed
: complain_overflow_bitfield);
howto.special_function = NULL;
howto.name = "internal";
- howto.partial_inplace = true;
- howto.src_mask = howto.dst_mask = N_ONES(howto.bitsize);
- howto.pcrel_offset = false;
+ howto.partial_inplace = TRUE;
+ howto.src_mask = howto.dst_mask = N_ONES (howto.bitsize);
+ howto.pcrel_offset = FALSE;
/* symbol */
val = 0;
addend = 0;
h = NULL;
sym = NULL;
- symndx = rel->r_symndx;
+ symndx = rel->r_symndx;
- if (-1 != symndx)
+ if (-1 != symndx)
{
asection *sec;
-
+
h = obj_xcoff_sym_hashes (input_bfd)[symndx];
sym = syms + symndx;
addend = - sym->n_value;
-
- if (NULL == h)
+
+ if (NULL == h)
{
sec = sections[symndx];
/* Hack to make sure we use the right TOC anchor value
@@ -3377,32 +3406,32 @@ xcoff_ppc_relocate_section (output_bfd, info, input_bfd,
+ sec->output_offset
+ sym->n_value
- sec->vma);
- }
- else
+ }
+ else
{
- if (h->root.type == bfd_link_hash_defined
- || h->root.type == bfd_link_hash_defweak)
+ if (h->root.type == bfd_link_hash_defined
+ || h->root.type == bfd_link_hash_defweak)
{
sec = h->root.u.def.section;
val = (h->root.u.def.value
+ sec->output_section->vma
+ sec->output_offset);
- }
- else if (h->root.type == bfd_link_hash_common)
+ }
+ else if (h->root.type == bfd_link_hash_common)
{
sec = h->root.u.c.p->section;
val = (sec->output_section->vma
+ sec->output_offset);
-
- }
- else if ((0 == (h->flags & (XCOFF_DEF_DYNAMIC | XCOFF_IMPORT)))
- && ! info->relocateable)
+
+ }
+ else if ((0 == (h->flags & (XCOFF_DEF_DYNAMIC | XCOFF_IMPORT)))
+ && ! info->relocatable)
{
if (! ((*info->callbacks->undefined_symbol)
(info, h->root.root.string, input_bfd, input_section,
- rel->r_vaddr - input_section->vma, true)))
- return false;
-
+ rel->r_vaddr - input_section->vma, TRUE)))
+ return FALSE;
+
/* Don't try to process the reloc. It can't help, and
it may generate another error. */
continue;
@@ -3410,81 +3439,81 @@ xcoff_ppc_relocate_section (output_bfd, info, input_bfd,
}
}
- if (rel->r_type >= XCOFF_MAX_CALCULATE_RELOCATION
+ if (rel->r_type >= XCOFF_MAX_CALCULATE_RELOCATION
|| !((*xcoff_calculate_relocation[rel->r_type])
- (input_bfd, input_section, output_bfd, rel, sym, &howto, val,
- addend, &relocation, contents)))
- return false;
-
+ (input_bfd, input_section, output_bfd, rel, sym, &howto, val,
+ addend, &relocation, contents)))
+ return FALSE;
+
/* address */
address = rel->r_vaddr - input_section->vma;
location = contents + address;
-
+
if (address > input_section->_raw_size)
- abort();
+ abort ();
/* Get the value we are going to relocate. */
if (1 == howto.size)
value_to_relocate = bfd_get_16 (input_bfd, location);
- else
+ else
value_to_relocate = bfd_get_32 (input_bfd, location);
-
- /* overflow.
-
+
+ /* overflow.
+
FIXME: We may drop bits during the addition
which we don't check for. We must either check at every single
operation, which would be tedious, or we must do the computations
in a type larger than bfd_vma, which would be inefficient. */
-
+
if ((unsigned int) howto.complain_on_overflow
>= XCOFF_MAX_COMPLAIN_OVERFLOW)
- abort();
+ abort ();
if (((*xcoff_complain_overflow[howto.complain_on_overflow])
- (input_bfd, value_to_relocate, relocation, &howto)))
+ (input_bfd, value_to_relocate, relocation, &howto)))
{
const char *name;
char buf[SYMNMLEN + 1];
char reloc_type_name[10];
-
- if (symndx == -1)
+
+ if (symndx == -1)
{
name = "*ABS*";
- }
- else if (h != NULL)
+ }
+ else if (h != NULL)
{
name = h->root.root.string;
- }
- else
+ }
+ else
{
name = _bfd_coff_internal_syment_name (input_bfd, sym, buf);
if (name == NULL)
name = "UNKNOWN";
}
sprintf (reloc_type_name, "0x%02x", rel->r_type);
-
+
if (! ((*info->callbacks->reloc_overflow)
(info, name, reloc_type_name, (bfd_vma) 0, input_bfd,
input_section, rel->r_vaddr - input_section->vma)))
- return false;
+ return FALSE;
}
-
+
/* Add RELOCATION to the right bits of VALUE_TO_RELOCATE. */
value_to_relocate = ((value_to_relocate & ~howto.dst_mask)
| (((value_to_relocate & howto.src_mask)
+ relocation) & howto.dst_mask));
-
+
/* Put the value back in the object file. */
if (1 == howto.size)
bfd_put_16 (input_bfd, value_to_relocate, location);
- else
+ else
bfd_put_32 (input_bfd, value_to_relocate, location);
}
- return true;
+ return TRUE;
}
-static boolean
+static bfd_boolean
_bfd_xcoff_put_ldsymbol_name (abfd, ldinfo, ldsym, name)
bfd *abfd ATTRIBUTE_UNUSED;
struct xcoff_loader_info *ldinfo;
@@ -3513,8 +3542,8 @@ _bfd_xcoff_put_ldsymbol_name (abfd, ldinfo, ldsym, name)
bfd_realloc ((PTR) ldinfo->strings, newalc));
if (newstrings == NULL)
{
- ldinfo->failed = true;
- return false;
+ ldinfo->failed = TRUE;
+ return FALSE;
}
ldinfo->string_alc = newalc;
ldinfo->strings = newstrings;
@@ -3528,10 +3557,10 @@ _bfd_xcoff_put_ldsymbol_name (abfd, ldinfo, ldsym, name)
ldinfo->string_size += len + 3;
}
- return true;
+ return TRUE;
}
-static boolean
+static bfd_boolean
_bfd_xcoff_put_symbol_name (bfd *abfd, struct bfd_strtab_hash *strtab,
struct internal_syment *sym,
const char *name)
@@ -3542,19 +3571,19 @@ _bfd_xcoff_put_symbol_name (bfd *abfd, struct bfd_strtab_hash *strtab,
}
else
{
- boolean hash;
+ bfd_boolean hash;
bfd_size_type indx;
- hash = true;
+ hash = TRUE;
if ((abfd->flags & BFD_TRADITIONAL_FORMAT) != 0)
- hash = false;
- indx = _bfd_stringtab_add (strtab, name, hash, false);
+ hash = FALSE;
+ indx = _bfd_stringtab_add (strtab, name, hash, FALSE);
if (indx == (bfd_size_type) -1)
- return false;
+ return FALSE;
sym->_n._n_n._n_zeroes = 0;
sym->_n._n_n._n_offset = STRING_SIZE_SIZE + indx;
}
- return true;
+ return TRUE;
}
static asection *
@@ -3591,26 +3620,26 @@ xcoff_create_csect_from_smclas (abfd, aux, symbol_name)
return return_value;
}
-static boolean
+static bfd_boolean
xcoff_is_lineno_count_overflow (abfd, value)
bfd *abfd ATTRIBUTE_UNUSED;
bfd_vma value;
{
if (0xffff <= value)
- return true;
+ return TRUE;
- return false;
+ return FALSE;
}
-static boolean
+static bfd_boolean
xcoff_is_reloc_count_overflow (abfd, value)
bfd *abfd ATTRIBUTE_UNUSED;
bfd_vma value;
{
if (0xffff <= value)
- return true;
+ return TRUE;
- return false;
+ return FALSE;
}
static bfd_vma
@@ -3618,7 +3647,7 @@ xcoff_loader_symbol_offset (abfd, ldhdr)
bfd *abfd;
struct internal_ldhdr *ldhdr ATTRIBUTE_UNUSED;
{
- return bfd_xcoff_ldhdrsz(abfd);
+ return bfd_xcoff_ldhdrsz (abfd);
}
static bfd_vma
@@ -3629,12 +3658,12 @@ xcoff_loader_reloc_offset (abfd, ldhdr)
return bfd_xcoff_ldhdrsz (abfd) + ldhdr->l_nsyms * bfd_xcoff_ldsymsz (abfd);
}
-static boolean
+static bfd_boolean
xcoff_generate_rtinit (abfd, init, fini, rtld)
bfd *abfd;
const char *init;
const char *fini;
- boolean rtld;
+ bfd_boolean rtld;
{
bfd_byte filehdr_ext[FILHSZ];
bfd_byte scnhdr_ext[SCNHSZ];
@@ -3651,13 +3680,13 @@ xcoff_generate_rtinit (abfd, init, fini, rtld)
struct internal_syment syment;
union internal_auxent auxent;
struct internal_reloc reloc;
-
+
char *data_name = ".data";
char *rtinit_name = "__rtinit";
char *rtld_name = "__rtld";
-
+
if (! bfd_xcoff_rtinit_size (abfd))
- return false;
+ return FALSE;
initsz = (init == NULL ? 0 : 1 + strlen (init));
finisz = (fini == NULL ? 0 : 1 + strlen (fini));
@@ -3666,7 +3695,7 @@ xcoff_generate_rtinit (abfd, init, fini, rtld)
memset (filehdr_ext, 0, FILHSZ);
memset (&filehdr, 0, sizeof (struct internal_filehdr));
filehdr.f_magic = bfd_xcoff_magic_number (abfd);
- filehdr.f_nscns = 1;
+ filehdr.f_nscns = 1;
filehdr.f_timdat = 0;
filehdr.f_nsyms = 0; /* at least 6, no more than 10 */
filehdr.f_symptr = 0; /* set below */
@@ -3687,34 +3716,34 @@ xcoff_generate_rtinit (abfd, init, fini, rtld)
scnhdr.s_nlnno = 0;
scnhdr.s_flags = STYP_DATA;
- /* .data
- 0x0000 0x00000000 : rtl
- 0x0004 0x00000010 : offset to init, or 0
- 0x0008 0x00000028 : offset to fini, or 0
- 0x000C 0x0000000C : size of descriptor
- 0x0010 0x00000000 : init, needs a reloc
- 0x0014 0x00000040 : offset to init name
- 0x0018 0x00000000 : flags, padded to a word
- 0x001C 0x00000000 : empty init
- 0x0020 0x00000000 :
- 0x0024 0x00000000 :
- 0x0028 0x00000000 : fini, needs a reloc
- 0x002C 0x00000??? : offset to fini name
- 0x0030 0x00000000 : flags, padded to a word
- 0x0034 0x00000000 : empty fini
- 0x0038 0x00000000 :
- 0x003C 0x00000000 :
- 0x0040 init name
+ /* .data
+ 0x0000 0x00000000 : rtl
+ 0x0004 0x00000010 : offset to init, or 0
+ 0x0008 0x00000028 : offset to fini, or 0
+ 0x000C 0x0000000C : size of descriptor
+ 0x0010 0x00000000 : init, needs a reloc
+ 0x0014 0x00000040 : offset to init name
+ 0x0018 0x00000000 : flags, padded to a word
+ 0x001C 0x00000000 : empty init
+ 0x0020 0x00000000 :
+ 0x0024 0x00000000 :
+ 0x0028 0x00000000 : fini, needs a reloc
+ 0x002C 0x00000??? : offset to fini name
+ 0x0030 0x00000000 : flags, padded to a word
+ 0x0034 0x00000000 : empty fini
+ 0x0038 0x00000000 :
+ 0x003C 0x00000000 :
+ 0x0040 init name
0x0040 + initsz fini name */
data_buffer_size = 0x0040 + initsz + finisz;
- data_buffer_size += (data_buffer_size & 7) ? 8 - (data_buffer_size & 7) : 0;
+ data_buffer_size = (data_buffer_size + 7) &~ (bfd_size_type) 7;
data_buffer = NULL;
data_buffer = (bfd_byte *) bfd_zmalloc (data_buffer_size);
if (data_buffer == NULL)
- return false;
+ return FALSE;
- if (initsz)
+ if (initsz)
{
val = 0x10;
bfd_h_put_32 (abfd, val, &data_buffer[0x04]);
@@ -3723,7 +3752,7 @@ xcoff_generate_rtinit (abfd, init, fini, rtld)
memcpy (&data_buffer[val], init, initsz);
}
- if (finisz)
+ if (finisz)
{
val = 0x28;
bfd_h_put_32 (abfd, val, &data_buffer[0x08]);
@@ -3739,7 +3768,7 @@ xcoff_generate_rtinit (abfd, init, fini, rtld)
/* string table */
string_table_size = 0;
- if (initsz > 9)
+ if (initsz > 9)
string_table_size += initsz;
if (finisz > 9)
string_table_size += finisz;
@@ -3748,18 +3777,18 @@ xcoff_generate_rtinit (abfd, init, fini, rtld)
string_table_size += 4;
string_table = (bfd_byte *) bfd_zmalloc (string_table_size);
if (string_table == NULL)
- return false;
+ return FALSE;
val = string_table_size;
bfd_h_put_32 (abfd, val, &string_table[0]);
st_tmp = string_table + 4;
}
-
- /* symbols
+
+ /* symbols
0. .data csect
2. __rtinit
- 4. init function
- 6. fini function
+ 4. init function
+ 6. fini function
8. __rtld */
memset (syment_ext, 0, 10 * SYMESZ);
memset (reloc_ext, 0, 3 * RELSZ);
@@ -3774,10 +3803,10 @@ xcoff_generate_rtinit (abfd, init, fini, rtld)
auxent.x_csect.x_scnlen.l = data_buffer_size;
auxent.x_csect.x_smtyp = 3 << 3 | XTY_SD;
auxent.x_csect.x_smclas = XMC_RW;
- bfd_coff_swap_sym_out (abfd, &syment,
+ bfd_coff_swap_sym_out (abfd, &syment,
&syment_ext[filehdr.f_nsyms * SYMESZ]);
- bfd_coff_swap_aux_out (abfd, &auxent, syment.n_type, syment.n_sclass, 0,
- syment.n_numaux,
+ bfd_coff_swap_aux_out (abfd, &auxent, syment.n_type, syment.n_sclass, 0,
+ syment.n_numaux,
&syment_ext[(filehdr.f_nsyms + 1) * SYMESZ]);
filehdr.f_nsyms += 2;
@@ -3790,20 +3819,20 @@ xcoff_generate_rtinit (abfd, init, fini, rtld)
syment.n_numaux = 1;
auxent.x_csect.x_smtyp = XTY_LD;
auxent.x_csect.x_smclas = XMC_RW;
- bfd_coff_swap_sym_out (abfd, &syment,
+ bfd_coff_swap_sym_out (abfd, &syment,
&syment_ext[filehdr.f_nsyms * SYMESZ]);
- bfd_coff_swap_aux_out (abfd, &auxent, syment.n_type, syment.n_sclass, 0,
- syment.n_numaux,
+ bfd_coff_swap_aux_out (abfd, &auxent, syment.n_type, syment.n_sclass, 0,
+ syment.n_numaux,
&syment_ext[(filehdr.f_nsyms + 1) * SYMESZ]);
filehdr.f_nsyms += 2;
/* init */
- if (initsz)
+ if (initsz)
{
memset (&syment, 0, sizeof (struct internal_syment));
memset (&auxent, 0, sizeof (union internal_auxent));
- if (initsz > 9)
+ if (initsz > 9)
{
syment._n._n_n._n_offset = st_tmp - string_table;
memcpy (st_tmp, init, initsz);
@@ -3814,10 +3843,10 @@ xcoff_generate_rtinit (abfd, init, fini, rtld)
syment.n_sclass = C_EXT;
syment.n_numaux = 1;
- bfd_coff_swap_sym_out (abfd, &syment,
+ bfd_coff_swap_sym_out (abfd, &syment,
&syment_ext[filehdr.f_nsyms * SYMESZ]);
- bfd_coff_swap_aux_out (abfd, &auxent, syment.n_type, syment.n_sclass, 0,
- syment.n_numaux,
+ bfd_coff_swap_aux_out (abfd, &auxent, syment.n_type, syment.n_sclass, 0,
+ syment.n_numaux,
&syment_ext[(filehdr.f_nsyms + 1) * SYMESZ]);
/* reloc */
@@ -3831,14 +3860,14 @@ xcoff_generate_rtinit (abfd, init, fini, rtld)
filehdr.f_nsyms += 2;
scnhdr.s_nreloc += 1;
}
-
+
/* fini */
- if (finisz)
+ if (finisz)
{
memset (&syment, 0, sizeof (struct internal_syment));
memset (&auxent, 0, sizeof (union internal_auxent));
- if (finisz > 9)
+ if (finisz > 9)
{
syment._n._n_n._n_offset = st_tmp - string_table;
memcpy (st_tmp, fini, finisz);
@@ -3849,10 +3878,10 @@ xcoff_generate_rtinit (abfd, init, fini, rtld)
syment.n_sclass = C_EXT;
syment.n_numaux = 1;
- bfd_coff_swap_sym_out (abfd, &syment,
+ bfd_coff_swap_sym_out (abfd, &syment,
&syment_ext[filehdr.f_nsyms * SYMESZ]);
- bfd_coff_swap_aux_out (abfd, &auxent, syment.n_type, syment.n_sclass, 0,
- syment.n_numaux,
+ bfd_coff_swap_aux_out (abfd, &auxent, syment.n_type, syment.n_sclass, 0,
+ syment.n_numaux,
&syment_ext[(filehdr.f_nsyms + 1) * SYMESZ]);
/* reloc */
@@ -3861,7 +3890,7 @@ xcoff_generate_rtinit (abfd, init, fini, rtld)
reloc.r_symndx = filehdr.f_nsyms;
reloc.r_type = R_POS;
reloc.r_size = 31;
- bfd_coff_swap_reloc_out (abfd, &reloc,
+ bfd_coff_swap_reloc_out (abfd, &reloc,
&reloc_ext[scnhdr.s_nreloc * RELSZ]);
filehdr.f_nsyms += 2;
@@ -3875,10 +3904,10 @@ xcoff_generate_rtinit (abfd, init, fini, rtld)
memcpy (syment._n._n_name, rtld_name, strlen (rtld_name));
syment.n_sclass = C_EXT;
syment.n_numaux = 1;
- bfd_coff_swap_sym_out (abfd, &syment,
+ bfd_coff_swap_sym_out (abfd, &syment,
&syment_ext[filehdr.f_nsyms * SYMESZ]);
- bfd_coff_swap_aux_out (abfd, &auxent, syment.n_type, syment.n_sclass, 0,
- syment.n_numaux,
+ bfd_coff_swap_aux_out (abfd, &auxent, syment.n_type, syment.n_sclass, 0,
+ syment.n_numaux,
&syment_ext[(filehdr.f_nsyms + 1) * SYMESZ]);
/* reloc */
@@ -3887,7 +3916,7 @@ xcoff_generate_rtinit (abfd, init, fini, rtld)
reloc.r_symndx = filehdr.f_nsyms;
reloc.r_type = R_POS;
reloc.r_size = 31;
- bfd_coff_swap_reloc_out (abfd, &reloc,
+ bfd_coff_swap_reloc_out (abfd, &reloc,
&reloc_ext[scnhdr.s_nreloc * RELSZ]);
filehdr.f_nsyms += 2;
@@ -3909,24 +3938,24 @@ xcoff_generate_rtinit (abfd, init, fini, rtld)
free (data_buffer);
data_buffer = NULL;
- return true;
+ return TRUE;
}
static reloc_howto_type xcoff_dynamic_reloc =
-HOWTO (0, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 32, /* bitsize */
- false, /* pc_relative */
- 0, /* bitpos */
+HOWTO (0, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 32, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
- 0, /* special_function */
- "R_POS", /* name */
- true, /* partial_inplace */
- 0xffffffff, /* src_mask */
- 0xffffffff, /* dst_mask */
- false); /* pcrel_offset */
+ 0, /* special_function */
+ "R_POS", /* name */
+ TRUE, /* partial_inplace */
+ 0xffffffff, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ FALSE); /* pcrel_offset */
/* glink
@@ -3968,11 +3997,11 @@ static const struct xcoff_backend_data_rec bfd_xcoff_backend_data =
RELSZ,
LINESZ,
FILNMLEN,
- true, /* _bfd_coff_long_filenames */
- false, /* _bfd_coff_long_section_names */
+ TRUE, /* _bfd_coff_long_filenames */
+ FALSE, /* _bfd_coff_long_section_names */
3, /* _bfd_coff_default_section_alignment_power */
- false, /* _bfd_coff_force_symnames_in_strings */
- 2, /* _bfd_coff_debug_string_prefix_length */
+ FALSE, /* _bfd_coff_force_symnames_in_strings */
+ 2, /* _bfd_coff_debug_string_prefix_length */
coff_swap_filehdr_in,
coff_swap_aouthdr_in,
coff_swap_scnhdr_in,
@@ -3988,9 +4017,9 @@ static const struct xcoff_backend_data_rec bfd_xcoff_backend_data =
coff_print_aux,
dummy_reloc16_extra_cases,
dummy_reloc16_estimate,
- NULL, /* bfd_coff_sym_is_global */
+ NULL, /* bfd_coff_sym_is_global */
coff_compute_section_file_positions,
- NULL, /* _bfd_coff_start_final_link */
+ NULL, /* _bfd_coff_start_final_link */
xcoff_ppc_relocate_section,
coff_rtype_to_howto,
NULL, /* _bfd_coff_adjust_symndx */
@@ -3999,7 +4028,7 @@ static const struct xcoff_backend_data_rec bfd_xcoff_backend_data =
coff_final_link_postscript
},
- 0x01DF, /* magic number */
+ 0x01DF, /* magic number */
bfd_arch_rs6000,
bfd_mach_rs6k,
@@ -4015,11 +4044,11 @@ static const struct xcoff_backend_data_rec bfd_xcoff_backend_data =
LDHDRSZ,
LDSYMSZ,
LDRELSZ,
- 12, /* _xcoff_function_descriptor_size */
+ 12, /* _xcoff_function_descriptor_size */
SMALL_AOUTSZ,
- /* Versions. */
- 1, /* _xcoff_ldhdr_version */
+ /* Versions. */
+ 1, /* _xcoff_ldhdr_version */
_bfd_xcoff_put_symbol_name,
_bfd_xcoff_put_ldsymbol_name,
@@ -4034,31 +4063,31 @@ static const struct xcoff_backend_data_rec bfd_xcoff_backend_data =
xcoff_loader_reloc_offset,
/* glink. */
- & xcoff_glink_code[0],
+ &xcoff_glink_code[0],
36, /* _xcoff_glink_size */
/* rtinit */
- 64, /* _xcoff_rtinit_size */
+ 64, /* _xcoff_rtinit_size */
xcoff_generate_rtinit,
-};
+ };
/* The transfer vector that leads the outside world to all of the above. */
const bfd_target rs6000coff_vec =
-{
- "aixcoff-rs6000",
- bfd_target_xcoff_flavour,
- BFD_ENDIAN_BIG, /* data byte order is big */
- BFD_ENDIAN_BIG, /* header byte order is big */
+ {
+ "aixcoff-rs6000",
+ bfd_target_xcoff_flavour,
+ BFD_ENDIAN_BIG, /* data byte order is big */
+ BFD_ENDIAN_BIG, /* header byte order is big */
(HAS_RELOC | EXEC_P | HAS_LINENO | HAS_DEBUG | DYNAMIC
| HAS_SYMS | HAS_LOCALS | WP_TEXT),
- (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC),
- 0, /* leading char */
- '/', /* ar_pad_char */
+ SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_CODE | SEC_DATA,
+ 0, /* leading char */
+ '/', /* ar_pad_char */
15, /* ar_max_namelen */
- /* data */
+ /* data */
bfd_getb64,
bfd_getb_signed_64,
bfd_putb64,
@@ -4069,7 +4098,7 @@ const bfd_target rs6000coff_vec =
bfd_getb_signed_16,
bfd_putb16,
- /* hdrs */
+ /* hdrs */
bfd_getb64,
bfd_getb_signed_64,
bfd_putb64,
@@ -4080,51 +4109,51 @@ const bfd_target rs6000coff_vec =
bfd_getb_signed_16,
bfd_putb16,
- { /* bfd_check_format */
- _bfd_dummy_target,
- coff_object_p,
- _bfd_xcoff_archive_p,
- CORE_FILE_P
- },
+ { /* bfd_check_format */
+ _bfd_dummy_target,
+ coff_object_p,
+ _bfd_xcoff_archive_p,
+ CORE_FILE_P
+ },
- { /* bfd_set_format */
- bfd_false,
- coff_mkobject,
- _bfd_generic_mkarchive,
- bfd_false
- },
+ { /* bfd_set_format */
+ bfd_false,
+ coff_mkobject,
+ _bfd_generic_mkarchive,
+ bfd_false
+ },
- {/* bfd_write_contents */
- bfd_false,
- coff_write_object_contents,
- _bfd_xcoff_write_archive_contents,
- bfd_false
- },
+ {/* bfd_write_contents */
+ bfd_false,
+ coff_write_object_contents,
+ _bfd_xcoff_write_archive_contents,
+ bfd_false
+ },
- /* Generic */
+ /* Generic */
bfd_true,
bfd_true,
coff_new_section_hook,
_bfd_generic_get_section_contents,
- _bfd_generic_get_section_contents_in_window,
+ _bfd_generic_get_section_contents_in_window,
- /* Copy */
+ /* Copy */
_bfd_xcoff_copy_private_bfd_data,
- ((boolean (*) (bfd *, bfd *)) bfd_true),
- ((boolean (*) (bfd *, asection *, bfd *, asection *)) bfd_true),
- ((boolean (*) (bfd *, asymbol *, bfd *, asymbol *)) bfd_true),
- ((boolean (*) (bfd *, flagword)) bfd_true),
- ((boolean (*) (bfd *, void * )) bfd_true),
+ ((bfd_boolean (*) (bfd *, bfd *)) bfd_true),
+ ((bfd_boolean (*) (bfd *, asection *, bfd *, asection *)) bfd_true),
+ ((bfd_boolean (*) (bfd *, asymbol *, bfd *, asymbol *)) bfd_true),
+ ((bfd_boolean (*) (bfd *, flagword)) bfd_true),
+ ((bfd_boolean (*) (bfd *, void * )) bfd_true),
- /* Core */
+ /* Core */
coff_core_file_failing_command,
coff_core_file_failing_signal,
- coff_core_file_matches_executable_p,
+ coff_core_file_matches_executable_p,
- /* Archive */
+ /* Archive */
_bfd_xcoff_slurp_armap,
bfd_false,
- ((boolean (*) (bfd *, char **, bfd_size_type *, const char **)) bfd_false),
+ ((bfd_boolean (*) (bfd *, char **, bfd_size_type *, const char **)) bfd_false),
bfd_dont_truncate_arname,
_bfd_xcoff_write_armap,
_bfd_xcoff_read_ar_hdr,
@@ -4133,9 +4162,9 @@ const bfd_target rs6000coff_vec =
_bfd_xcoff_stat_arch_elt,
bfd_true,
- /* Symbols */
+ /* Symbols */
coff_get_symtab_upper_bound,
- coff_get_symtab,
+ coff_canonicalize_symtab,
coff_make_empty_symbol,
coff_print_symbol,
coff_get_symbol_info,
@@ -4146,18 +4175,18 @@ const bfd_target rs6000coff_vec =
_bfd_generic_read_minisymbols,
_bfd_generic_minisymbol_to_symbol,
- /* Reloc */
+ /* Reloc */
coff_get_reloc_upper_bound,
coff_canonicalize_reloc,
_bfd_xcoff_reloc_type_lookup,
- /* Write */
+ /* Write */
coff_set_arch_mach,
coff_set_section_contents,
- /* Link */
+ /* Link */
_bfd_xcoff_sizeof_headers,
- bfd_generic_get_relocated_section_contents,
+ bfd_generic_get_relocated_section_contents,
bfd_generic_relax_section,
_bfd_xcoff_bfd_link_hash_table_create,
_bfd_generic_link_hash_table_free,
@@ -4169,17 +4198,17 @@ const bfd_target rs6000coff_vec =
bfd_generic_merge_sections,
bfd_generic_discard_group,
- /* Dynamic */
- _bfd_xcoff_get_dynamic_symtab_upper_bound,
+ /* Dynamic */
+ _bfd_xcoff_get_dynamic_symtab_upper_bound,
_bfd_xcoff_canonicalize_dynamic_symtab,
_bfd_xcoff_get_dynamic_reloc_upper_bound,
_bfd_xcoff_canonicalize_dynamic_reloc,
- /* Opposite endian version, none exists */
- NULL,
+ /* Opposite endian version, none exists */
+ NULL,
- (void *) &bfd_xcoff_backend_data,
-};
+ (void *) &bfd_xcoff_backend_data,
+ };
/* xcoff-powermac target
Old target.
@@ -4190,7 +4219,7 @@ const bfd_target rs6000coff_vec =
(because that's how they were bootstrapped originally),
but they are always PowerPC architecture. */
static const struct xcoff_backend_data_rec bfd_pmac_xcoff_backend_data =
-{
+ {
{ /* COFF backend, defined in libcoff.h. */
_bfd_xcoff_swap_aux_in,
_bfd_xcoff_swap_sym_in,
@@ -4210,11 +4239,11 @@ static const struct xcoff_backend_data_rec bfd_pmac_xcoff_backend_data =
RELSZ,
LINESZ,
FILNMLEN,
- true, /* _bfd_coff_long_filenames */
- false, /* _bfd_coff_long_section_names */
+ TRUE, /* _bfd_coff_long_filenames */
+ FALSE, /* _bfd_coff_long_section_names */
3, /* _bfd_coff_default_section_alignment_power */
- false, /* _bfd_coff_force_symnames_in_strings */
- 2, /* _bfd_coff_debug_string_prefix_length */
+ FALSE, /* _bfd_coff_force_symnames_in_strings */
+ 2, /* _bfd_coff_debug_string_prefix_length */
coff_swap_filehdr_in,
coff_swap_aouthdr_in,
coff_swap_scnhdr_in,
@@ -4230,18 +4259,18 @@ static const struct xcoff_backend_data_rec bfd_pmac_xcoff_backend_data =
coff_print_aux,
dummy_reloc16_extra_cases,
dummy_reloc16_estimate,
- NULL, /* bfd_coff_sym_is_global */
- coff_compute_section_file_positions,
- NULL, /* _bfd_coff_start_final_link */
+ NULL, /* bfd_coff_sym_is_global */
+ coff_compute_section_file_positions,
+ NULL, /* _bfd_coff_start_final_link */
xcoff_ppc_relocate_section,
coff_rtype_to_howto,
NULL, /* _bfd_coff_adjust_symndx */
_bfd_generic_link_add_one_symbol,
coff_link_output_has_begun,
coff_final_link_postscript
- },
+ },
- 0x01DF, /* magic number */
+ 0x01DF, /* magic number */
bfd_arch_powerpc,
bfd_mach_ppc,
@@ -4257,11 +4286,11 @@ static const struct xcoff_backend_data_rec bfd_pmac_xcoff_backend_data =
LDHDRSZ,
LDSYMSZ,
LDRELSZ,
- 12, /* _xcoff_function_descriptor_size */
+ 12, /* _xcoff_function_descriptor_size */
SMALL_AOUTSZ,
/* Versions. */
- 1, /* _xcoff_ldhdr_version */
+ 1, /* _xcoff_ldhdr_version */
_bfd_xcoff_put_symbol_name,
_bfd_xcoff_put_ldsymbol_name,
@@ -4269,38 +4298,38 @@ static const struct xcoff_backend_data_rec bfd_pmac_xcoff_backend_data =
xcoff_create_csect_from_smclas,
/* Lineno and reloc count overflow. */
- xcoff_is_lineno_count_overflow,
- xcoff_is_reloc_count_overflow,
+ xcoff_is_lineno_count_overflow,
+ xcoff_is_reloc_count_overflow,
- xcoff_loader_symbol_offset,
- xcoff_loader_reloc_offset,
+ xcoff_loader_symbol_offset,
+ xcoff_loader_reloc_offset,
/* glink. */
- &xcoff_glink_code[0],
+ &xcoff_glink_code[0],
36, /* _xcoff_glink_size */
- /* rtinit */
- 0, /* _xcoff_rtinit_size */
+ /* rtinit */
+ 0, /* _xcoff_rtinit_size */
xcoff_generate_rtinit,
-};
+ };
-/* The transfer vector that leads the outside world to all of the above. */
+/* The transfer vector that leads the outside world to all of the above. */
const bfd_target pmac_xcoff_vec =
-{
- "xcoff-powermac",
- bfd_target_xcoff_flavour,
- BFD_ENDIAN_BIG, /* data byte order is big */
- BFD_ENDIAN_BIG, /* header byte order is big */
+ {
+ "xcoff-powermac",
+ bfd_target_xcoff_flavour,
+ BFD_ENDIAN_BIG, /* data byte order is big */
+ BFD_ENDIAN_BIG, /* header byte order is big */
(HAS_RELOC | EXEC_P | HAS_LINENO | HAS_DEBUG | DYNAMIC
| HAS_SYMS | HAS_LOCALS | WP_TEXT),
- (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC),
- 0, /* leading char */
- '/', /* ar_pad_char */
+ SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_CODE | SEC_DATA,
+ 0, /* leading char */
+ '/', /* ar_pad_char */
15, /* ar_max_namelen */
- /* data */
+ /* data */
bfd_getb64,
bfd_getb_signed_64,
bfd_putb64,
@@ -4311,7 +4340,7 @@ const bfd_target pmac_xcoff_vec =
bfd_getb_signed_16,
bfd_putb16,
- /* hdrs */
+ /* hdrs */
bfd_getb64,
bfd_getb_signed_64,
bfd_putb64,
@@ -4322,51 +4351,51 @@ const bfd_target pmac_xcoff_vec =
bfd_getb_signed_16,
bfd_putb16,
- { /* bfd_check_format */
- _bfd_dummy_target,
- coff_object_p,
- _bfd_xcoff_archive_p,
- CORE_FILE_P
- },
+ { /* bfd_check_format */
+ _bfd_dummy_target,
+ coff_object_p,
+ _bfd_xcoff_archive_p,
+ CORE_FILE_P
+ },
- { /* bfd_set_format */
- bfd_false,
- coff_mkobject,
- _bfd_generic_mkarchive,
- bfd_false
- },
+ { /* bfd_set_format */
+ bfd_false,
+ coff_mkobject,
+ _bfd_generic_mkarchive,
+ bfd_false
+ },
- {/* bfd_write_contents */
- bfd_false,
- coff_write_object_contents,
- _bfd_xcoff_write_archive_contents,
- bfd_false
- },
+ {/* bfd_write_contents */
+ bfd_false,
+ coff_write_object_contents,
+ _bfd_xcoff_write_archive_contents,
+ bfd_false
+ },
- /* Generic */
+ /* Generic */
bfd_true,
bfd_true,
coff_new_section_hook,
_bfd_generic_get_section_contents,
- _bfd_generic_get_section_contents_in_window,
+ _bfd_generic_get_section_contents_in_window,
- /* Copy */
+ /* Copy */
_bfd_xcoff_copy_private_bfd_data,
- ((boolean (*) (bfd *, bfd *)) bfd_true),
- ((boolean (*) (bfd *, asection *, bfd *, asection *)) bfd_true),
- ((boolean (*) (bfd *, asymbol *, bfd *, asymbol *)) bfd_true),
- ((boolean (*) (bfd *, flagword)) bfd_true),
- ((boolean (*) (bfd *, void * )) bfd_true),
+ ((bfd_boolean (*) (bfd *, bfd *)) bfd_true),
+ ((bfd_boolean (*) (bfd *, asection *, bfd *, asection *)) bfd_true),
+ ((bfd_boolean (*) (bfd *, asymbol *, bfd *, asymbol *)) bfd_true),
+ ((bfd_boolean (*) (bfd *, flagword)) bfd_true),
+ ((bfd_boolean (*) (bfd *, void * )) bfd_true),
- /* Core */
+ /* Core */
coff_core_file_failing_command,
coff_core_file_failing_signal,
- coff_core_file_matches_executable_p,
+ coff_core_file_matches_executable_p,
- /* Archive */
+ /* Archive */
_bfd_xcoff_slurp_armap,
bfd_false,
- ((boolean (*) (bfd *, char **, bfd_size_type *, const char **)) bfd_false),
+ ((bfd_boolean (*) (bfd *, char **, bfd_size_type *, const char **)) bfd_false),
bfd_dont_truncate_arname,
_bfd_xcoff_write_armap,
_bfd_xcoff_read_ar_hdr,
@@ -4375,9 +4404,9 @@ const bfd_target pmac_xcoff_vec =
_bfd_xcoff_stat_arch_elt,
bfd_true,
- /* Symbols */
+ /* Symbols */
coff_get_symtab_upper_bound,
- coff_get_symtab,
+ coff_canonicalize_symtab,
coff_make_empty_symbol,
coff_print_symbol,
coff_get_symbol_info,
@@ -4388,18 +4417,18 @@ const bfd_target pmac_xcoff_vec =
_bfd_generic_read_minisymbols,
_bfd_generic_minisymbol_to_symbol,
- /* Reloc */
+ /* Reloc */
coff_get_reloc_upper_bound,
coff_canonicalize_reloc,
_bfd_xcoff_reloc_type_lookup,
- /* Write */
+ /* Write */
coff_set_arch_mach,
coff_set_section_contents,
- /* Link */
+ /* Link */
_bfd_xcoff_sizeof_headers,
- bfd_generic_get_relocated_section_contents,
+ bfd_generic_get_relocated_section_contents,
bfd_generic_relax_section,
_bfd_xcoff_bfd_link_hash_table_create,
_bfd_generic_link_hash_table_free,
@@ -4411,14 +4440,14 @@ const bfd_target pmac_xcoff_vec =
bfd_generic_merge_sections,
bfd_generic_discard_group,
- /* Dynamic */
- _bfd_xcoff_get_dynamic_symtab_upper_bound,
+ /* Dynamic */
+ _bfd_xcoff_get_dynamic_symtab_upper_bound,
_bfd_xcoff_canonicalize_dynamic_symtab,
_bfd_xcoff_get_dynamic_reloc_upper_bound,
_bfd_xcoff_canonicalize_dynamic_reloc,
- /* Opposite endian version, none exists */
- NULL,
+ /* Opposite endian version, none exists */
+ NULL,
- (void *) &bfd_pmac_xcoff_backend_data,
-};
+ (void *) &bfd_pmac_xcoff_backend_data,
+ };
diff --git a/contrib/binutils/bfd/coff-sparc.c b/contrib/binutils/bfd/coff-sparc.c
index 35c23df..372b1a7 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
- Free Software Foundation, Inc.
+ Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1999, 2000, 2001,
+ 2002, 2003 Free Software Foundation, Inc.
Written by Cygnus Support.
This file is part of BFD, the Binary File Descriptor library.
@@ -103,30 +103,30 @@ bfd_coff_generic_reloc (abfd, reloc_entry, symbol, data, input_section,
static reloc_howto_type coff_sparc_howto_table[] =
{
- HOWTO(R_SPARC_NONE, 0,0, 0,false,0,complain_overflow_dont, bfd_coff_generic_reloc,"R_SPARC_NONE", false,0,0x00000000,true),
- HOWTO(R_SPARC_8, 0,0, 8,false,0,complain_overflow_bitfield,bfd_coff_generic_reloc,"R_SPARC_8", false,0,0x000000ff,true),
- HOWTO(R_SPARC_16, 0,1,16,false,0,complain_overflow_bitfield,bfd_coff_generic_reloc,"R_SPARC_16", false,0,0x0000ffff,true),
- HOWTO(R_SPARC_32, 0,2,32,false,0,complain_overflow_bitfield,bfd_coff_generic_reloc,"R_SPARC_32", false,0,0xffffffff,true),
- HOWTO(R_SPARC_DISP8, 0,0, 8,true, 0,complain_overflow_signed, bfd_coff_generic_reloc,"R_SPARC_DISP8", false,0,0x000000ff,true),
- HOWTO(R_SPARC_DISP16, 0,1,16,true, 0,complain_overflow_signed, bfd_coff_generic_reloc,"R_SPARC_DISP16", false,0,0x0000ffff,true),
- HOWTO(R_SPARC_DISP32, 0,2,32,true, 0,complain_overflow_signed, bfd_coff_generic_reloc,"R_SPARC_DISP32", false,0,0x00ffffff,true),
- HOWTO(R_SPARC_WDISP30, 2,2,30,true, 0,complain_overflow_signed, bfd_coff_generic_reloc,"R_SPARC_WDISP30", false,0,0x3fffffff,true),
- HOWTO(R_SPARC_WDISP22, 2,2,22,true, 0,complain_overflow_signed, bfd_coff_generic_reloc,"R_SPARC_WDISP22", false,0,0x003fffff,true),
- HOWTO(R_SPARC_HI22, 10,2,22,false,0,complain_overflow_dont, bfd_coff_generic_reloc,"R_SPARC_HI22", false,0,0x003fffff,true),
- HOWTO(R_SPARC_22, 0,2,22,false,0,complain_overflow_bitfield,bfd_coff_generic_reloc,"R_SPARC_22", false,0,0x003fffff,true),
- HOWTO(R_SPARC_13, 0,2,13,false,0,complain_overflow_bitfield,bfd_coff_generic_reloc,"R_SPARC_13", false,0,0x00001fff,true),
- HOWTO(R_SPARC_LO10, 0,2,10,false,0,complain_overflow_dont, bfd_coff_generic_reloc,"R_SPARC_LO10", false,0,0x000003ff,true),
- HOWTO(R_SPARC_GOT10, 0,2,10,false,0,complain_overflow_bitfield,bfd_coff_generic_reloc,"R_SPARC_GOT10", false,0,0x000003ff,true),
- HOWTO(R_SPARC_GOT13, 0,2,13,false,0,complain_overflow_bitfield,bfd_coff_generic_reloc,"R_SPARC_GOT13", false,0,0x00001fff,true),
- HOWTO(R_SPARC_GOT22, 10,2,22,false,0,complain_overflow_bitfield,bfd_coff_generic_reloc,"R_SPARC_GOT22", false,0,0x003fffff,true),
- HOWTO(R_SPARC_PC10, 0,2,10,false,0,complain_overflow_bitfield,bfd_coff_generic_reloc,"R_SPARC_PC10", false,0,0x000003ff,true),
- HOWTO(R_SPARC_PC22, 0,2,22,false,0,complain_overflow_bitfield,bfd_coff_generic_reloc,"R_SPARC_PC22", false,0,0x003fffff,true),
- HOWTO(R_SPARC_WPLT30, 0,0,00,false,0,complain_overflow_dont, bfd_coff_generic_reloc,"R_SPARC_WPLT30", false,0,0x00000000,true),
- HOWTO(R_SPARC_COPY, 0,0,00,false,0,complain_overflow_dont, bfd_coff_generic_reloc,"R_SPARC_COPY", false,0,0x00000000,true),
- HOWTO(R_SPARC_GLOB_DAT,0,0,00,false,0,complain_overflow_dont, bfd_coff_generic_reloc,"R_SPARC_GLOB_DAT",false,0,0x00000000,true),
- HOWTO(R_SPARC_JMP_SLOT,0,0,00,false,0,complain_overflow_dont, bfd_coff_generic_reloc,"R_SPARC_JMP_SLOT",false,0,0x00000000,true),
- HOWTO(R_SPARC_RELATIVE,0,0,00,false,0,complain_overflow_dont, bfd_coff_generic_reloc,"R_SPARC_RELATIVE",false,0,0x00000000,true),
- HOWTO(R_SPARC_UA32, 0,0,00,false,0,complain_overflow_dont, bfd_coff_generic_reloc,"R_SPARC_UA32", false,0,0x00000000,true),
+ HOWTO(R_SPARC_NONE, 0,0, 0,FALSE,0,complain_overflow_dont, bfd_coff_generic_reloc,"R_SPARC_NONE", FALSE,0,0x00000000,TRUE),
+ HOWTO(R_SPARC_8, 0,0, 8,FALSE,0,complain_overflow_bitfield,bfd_coff_generic_reloc,"R_SPARC_8", FALSE,0,0x000000ff,TRUE),
+ HOWTO(R_SPARC_16, 0,1,16,FALSE,0,complain_overflow_bitfield,bfd_coff_generic_reloc,"R_SPARC_16", FALSE,0,0x0000ffff,TRUE),
+ HOWTO(R_SPARC_32, 0,2,32,FALSE,0,complain_overflow_bitfield,bfd_coff_generic_reloc,"R_SPARC_32", FALSE,0,0xffffffff,TRUE),
+ HOWTO(R_SPARC_DISP8, 0,0, 8,TRUE, 0,complain_overflow_signed, bfd_coff_generic_reloc,"R_SPARC_DISP8", FALSE,0,0x000000ff,TRUE),
+ HOWTO(R_SPARC_DISP16, 0,1,16,TRUE, 0,complain_overflow_signed, bfd_coff_generic_reloc,"R_SPARC_DISP16", FALSE,0,0x0000ffff,TRUE),
+ HOWTO(R_SPARC_DISP32, 0,2,32,TRUE, 0,complain_overflow_signed, bfd_coff_generic_reloc,"R_SPARC_DISP32", FALSE,0,0x00ffffff,TRUE),
+ HOWTO(R_SPARC_WDISP30, 2,2,30,TRUE, 0,complain_overflow_signed, bfd_coff_generic_reloc,"R_SPARC_WDISP30", FALSE,0,0x3fffffff,TRUE),
+ HOWTO(R_SPARC_WDISP22, 2,2,22,TRUE, 0,complain_overflow_signed, bfd_coff_generic_reloc,"R_SPARC_WDISP22", FALSE,0,0x003fffff,TRUE),
+ HOWTO(R_SPARC_HI22, 10,2,22,FALSE,0,complain_overflow_dont, bfd_coff_generic_reloc,"R_SPARC_HI22", FALSE,0,0x003fffff,TRUE),
+ HOWTO(R_SPARC_22, 0,2,22,FALSE,0,complain_overflow_bitfield,bfd_coff_generic_reloc,"R_SPARC_22", FALSE,0,0x003fffff,TRUE),
+ HOWTO(R_SPARC_13, 0,2,13,FALSE,0,complain_overflow_bitfield,bfd_coff_generic_reloc,"R_SPARC_13", FALSE,0,0x00001fff,TRUE),
+ HOWTO(R_SPARC_LO10, 0,2,10,FALSE,0,complain_overflow_dont, bfd_coff_generic_reloc,"R_SPARC_LO10", FALSE,0,0x000003ff,TRUE),
+ HOWTO(R_SPARC_GOT10, 0,2,10,FALSE,0,complain_overflow_bitfield,bfd_coff_generic_reloc,"R_SPARC_GOT10", FALSE,0,0x000003ff,TRUE),
+ HOWTO(R_SPARC_GOT13, 0,2,13,FALSE,0,complain_overflow_bitfield,bfd_coff_generic_reloc,"R_SPARC_GOT13", FALSE,0,0x00001fff,TRUE),
+ HOWTO(R_SPARC_GOT22, 10,2,22,FALSE,0,complain_overflow_bitfield,bfd_coff_generic_reloc,"R_SPARC_GOT22", FALSE,0,0x003fffff,TRUE),
+ HOWTO(R_SPARC_PC10, 0,2,10,FALSE,0,complain_overflow_bitfield,bfd_coff_generic_reloc,"R_SPARC_PC10", FALSE,0,0x000003ff,TRUE),
+ HOWTO(R_SPARC_PC22, 0,2,22,FALSE,0,complain_overflow_bitfield,bfd_coff_generic_reloc,"R_SPARC_PC22", FALSE,0,0x003fffff,TRUE),
+ HOWTO(R_SPARC_WPLT30, 0,0,00,FALSE,0,complain_overflow_dont, bfd_coff_generic_reloc,"R_SPARC_WPLT30", FALSE,0,0x00000000,TRUE),
+ HOWTO(R_SPARC_COPY, 0,0,00,FALSE,0,complain_overflow_dont, bfd_coff_generic_reloc,"R_SPARC_COPY", FALSE,0,0x00000000,TRUE),
+ HOWTO(R_SPARC_GLOB_DAT,0,0,00,FALSE,0,complain_overflow_dont, bfd_coff_generic_reloc,"R_SPARC_GLOB_DAT",FALSE,0,0x00000000,TRUE),
+ HOWTO(R_SPARC_JMP_SLOT,0,0,00,FALSE,0,complain_overflow_dont, bfd_coff_generic_reloc,"R_SPARC_JMP_SLOT",FALSE,0,0x00000000,TRUE),
+ HOWTO(R_SPARC_RELATIVE,0,0,00,FALSE,0,complain_overflow_dont, bfd_coff_generic_reloc,"R_SPARC_RELATIVE",FALSE,0,0x00000000,TRUE),
+ HOWTO(R_SPARC_UA32, 0,0,00,FALSE,0,complain_overflow_dont, bfd_coff_generic_reloc,"R_SPARC_UA32", FALSE,0,0x00000000,TRUE),
};
struct coff_reloc_map {
@@ -216,4 +216,4 @@ rtype2howto (cache_ptr, dst)
#define TARGET_NAME "coff-sparc"
#endif
-CREATE_BIG_COFF_TARGET_VEC (TARGET_SYM, TARGET_NAME, D_PAGED, 0, '_', NULL)
+CREATE_BIG_COFF_TARGET_VEC (TARGET_SYM, TARGET_NAME, D_PAGED, 0, '_', NULL, COFF_SWAP_TABLE)
diff --git a/contrib/binutils/bfd/coff64-rs6000.c b/contrib/binutils/bfd/coff64-rs6000.c
index 9372f6b..ec9c695 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
+ Copyright 2000, 2001, 2002, 2003
Free Software Foundation, Inc.
Written Clinton Popetz.
Contributed by Cygnus Support.
@@ -82,39 +82,56 @@
#define coff_SWAP_lineno_in _bfd_xcoff64_swap_lineno_in
#define coff_SWAP_lineno_out _bfd_xcoff64_swap_lineno_out
-static void _bfd_xcoff64_swap_lineno_in PARAMS ((bfd *, PTR, PTR));
-static unsigned int _bfd_xcoff64_swap_lineno_out PARAMS ((bfd *, PTR, PTR));
-static boolean _bfd_xcoff64_put_symbol_name
+static void _bfd_xcoff64_swap_lineno_in
+ PARAMS ((bfd *, PTR, PTR));
+static unsigned int _bfd_xcoff64_swap_lineno_out
+ PARAMS ((bfd *, PTR, PTR));
+static bfd_boolean _bfd_xcoff64_put_symbol_name
PARAMS ((bfd *, struct bfd_strtab_hash *, struct internal_syment *,
const char *));
-static boolean _bfd_xcoff64_put_ldsymbol_name
+static bfd_boolean _bfd_xcoff64_put_ldsymbol_name
PARAMS ((bfd *, struct xcoff_loader_info *, struct internal_ldsym *,
const char *));
-static void _bfd_xcoff64_swap_sym_in PARAMS ((bfd *, PTR, PTR));
-static unsigned int _bfd_xcoff64_swap_sym_out PARAMS ((bfd *, PTR, PTR));
+static void _bfd_xcoff64_swap_sym_in
+ PARAMS ((bfd *, PTR, PTR));
+static unsigned int _bfd_xcoff64_swap_sym_out
+ PARAMS ((bfd *, PTR, PTR));
static void _bfd_xcoff64_swap_aux_in
PARAMS ((bfd *, PTR, int, int, int, int, PTR));
static unsigned int _bfd_xcoff64_swap_aux_out
PARAMS ((bfd *, PTR, int, int, int, int, PTR));
-static void xcoff64_swap_reloc_in PARAMS ((bfd *, PTR, PTR));
-static unsigned int xcoff64_swap_reloc_out PARAMS ((bfd *, PTR, PTR));
-extern boolean _bfd_xcoff_mkobject PARAMS ((bfd *));
-extern boolean _bfd_xcoff_copy_private_bfd_data PARAMS ((bfd *, bfd *));
-extern boolean _bfd_xcoff_is_local_label_name PARAMS ((bfd *, const char *));
+static void xcoff64_swap_reloc_in
+ PARAMS ((bfd *, PTR, PTR));
+static unsigned int xcoff64_swap_reloc_out
+ PARAMS ((bfd *, PTR, PTR));
+extern bfd_boolean _bfd_xcoff_mkobject
+ PARAMS ((bfd *));
+extern bfd_boolean _bfd_xcoff_copy_private_bfd_data
+ PARAMS ((bfd *, bfd *));
+extern bfd_boolean _bfd_xcoff_is_local_label_name
+ PARAMS ((bfd *, const char *));
extern void xcoff64_rtype2howto
PARAMS ((arelent *, struct internal_reloc *));
extern reloc_howto_type * xcoff64_reloc_type_lookup
PARAMS ((bfd *, bfd_reloc_code_real_type));
-extern boolean _bfd_xcoff_slurp_armap PARAMS ((bfd *));
-extern PTR _bfd_xcoff_read_ar_hdr PARAMS ((bfd *));
-extern bfd *_bfd_xcoff_openr_next_archived_file PARAMS ((bfd *, bfd *));
-extern int _bfd_xcoff_stat_arch_elt PARAMS ((bfd *, struct stat *));
-extern boolean _bfd_xcoff_write_armap
+extern bfd_boolean _bfd_xcoff_slurp_armap
+ PARAMS ((bfd *));
+extern PTR _bfd_xcoff_read_ar_hdr
+ PARAMS ((bfd *));
+extern bfd *_bfd_xcoff_openr_next_archived_file
+ PARAMS ((bfd *, bfd *));
+extern int _bfd_xcoff_stat_arch_elt
+ PARAMS ((bfd *, struct stat *));
+extern bfd_boolean _bfd_xcoff_write_armap
PARAMS ((bfd *, unsigned int, struct orl *, unsigned int, int));
-extern boolean _bfd_xcoff_write_archive_contents PARAMS ((bfd *));
-extern int _bfd_xcoff_sizeof_headers PARAMS ((bfd *, boolean));
-extern void _bfd_xcoff_swap_sym_in PARAMS ((bfd *, PTR, PTR));
-extern unsigned int _bfd_xcoff_swap_sym_out PARAMS ((bfd *, PTR, PTR));
+extern 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
@@ -131,61 +148,70 @@ static void xcoff64_swap_ldrel_in
PARAMS ((bfd *, const PTR, struct internal_ldrel *));
static void xcoff64_swap_ldrel_out
PARAMS ((bfd *, const struct internal_ldrel *, PTR d));
-static boolean xcoff64_write_object_contents PARAMS ((bfd *));
-static boolean xcoff64_ppc_relocate_section
+static bfd_boolean xcoff64_write_object_contents
+ PARAMS ((bfd *));
+static bfd_boolean xcoff64_ppc_relocate_section
PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *,
struct internal_reloc *, struct internal_syment *,
asection **));
-static boolean xcoff64_slurp_armap PARAMS ((bfd *));
-static const bfd_target *xcoff64_archive_p PARAMS ((bfd *));
-static bfd *xcoff64_openr_next_archived_file PARAMS ((bfd *, bfd *));
-static int xcoff64_sizeof_headers PARAMS ((bfd *, boolean));
+static bfd_boolean xcoff64_slurp_armap
+ PARAMS ((bfd *));
+static const bfd_target *xcoff64_archive_p
+ PARAMS ((bfd *));
+static bfd *xcoff64_openr_next_archived_file
+ PARAMS ((bfd *, bfd *));
+static int xcoff64_sizeof_headers
+ PARAMS ((bfd *, bfd_boolean));
static asection *xcoff64_create_csect_from_smclas
PARAMS ((bfd *, union internal_auxent *, const char *));
-static boolean xcoff64_is_lineno_count_overflow PARAMS ((bfd *, bfd_vma));
-static boolean xcoff64_is_reloc_count_overflow PARAMS ((bfd *, bfd_vma));
+static bfd_boolean xcoff64_is_lineno_count_overflow
+ PARAMS ((bfd *, bfd_vma));
+static bfd_boolean xcoff64_is_reloc_count_overflow
+ PARAMS ((bfd *, bfd_vma));
static bfd_vma xcoff64_loader_symbol_offset
PARAMS ((bfd *, struct internal_ldhdr *));
static bfd_vma xcoff64_loader_reloc_offset
PARAMS ((bfd *, struct internal_ldhdr *));
-static boolean xcoff64_generate_rtinit
- PARAMS ((bfd *, const char *, const char *, boolean));
-static boolean xcoff64_bad_format_hook PARAMS ((bfd *, PTR ));
+static bfd_boolean xcoff64_generate_rtinit
+ PARAMS ((bfd *, const char *, const char *, bfd_boolean));
+static bfd_boolean xcoff64_bad_format_hook
+ PARAMS ((bfd *, PTR ));
/* Relocation functions */
-static boolean xcoff64_reloc_type_br PARAMS ((XCOFF_RELOC_FUNCTION_ARGS));
+static bfd_boolean xcoff64_reloc_type_br
+ PARAMS ((XCOFF_RELOC_FUNCTION_ARGS));
-boolean (*xcoff64_calculate_relocation[XCOFF_MAX_CALCULATE_RELOCATION])
+bfd_boolean (*xcoff64_calculate_relocation[XCOFF_MAX_CALCULATE_RELOCATION])
PARAMS ((XCOFF_RELOC_FUNCTION_ARGS)) =
{
- xcoff_reloc_type_pos, /* R_POS (0x00) */
- xcoff_reloc_type_neg, /* R_NEG (0x01) */
- xcoff_reloc_type_rel, /* R_REL (0x02) */
- xcoff_reloc_type_toc, /* R_TOC (0x03) */
+ xcoff_reloc_type_pos, /* R_POS (0x00) */
+ xcoff_reloc_type_neg, /* R_NEG (0x01) */
+ xcoff_reloc_type_rel, /* R_REL (0x02) */
+ xcoff_reloc_type_toc, /* R_TOC (0x03) */
xcoff_reloc_type_fail, /* R_RTB (0x04) */
- xcoff_reloc_type_toc, /* R_GL (0x05) */
- xcoff_reloc_type_toc, /* R_TCL (0x06) */
- xcoff_reloc_type_fail, /* (0x07) */
- xcoff_reloc_type_ba, /* R_BA (0x08) */
- xcoff_reloc_type_fail, /* (0x09) */
+ xcoff_reloc_type_toc, /* R_GL (0x05) */
+ xcoff_reloc_type_toc, /* R_TCL (0x06) */
+ xcoff_reloc_type_fail, /* (0x07) */
+ xcoff_reloc_type_ba, /* R_BA (0x08) */
+ xcoff_reloc_type_fail, /* (0x09) */
xcoff64_reloc_type_br, /* R_BR (0x0a) */
- xcoff_reloc_type_fail, /* (0x0b) */
- xcoff_reloc_type_pos, /* R_RL (0x0c) */
- xcoff_reloc_type_pos, /* R_RLA (0x0d) */
- xcoff_reloc_type_fail, /* (0x0e) */
+ xcoff_reloc_type_fail, /* (0x0b) */
+ xcoff_reloc_type_pos, /* R_RL (0x0c) */
+ xcoff_reloc_type_pos, /* R_RLA (0x0d) */
+ xcoff_reloc_type_fail, /* (0x0e) */
xcoff_reloc_type_noop, /* R_REF (0x0f) */
- xcoff_reloc_type_fail, /* (0x10) */
- xcoff_reloc_type_fail, /* (0x11) */
- xcoff_reloc_type_toc, /* R_TRL (0x12) */
- xcoff_reloc_type_toc, /* R_TRLA (0x13) */
+ xcoff_reloc_type_fail, /* (0x10) */
+ xcoff_reloc_type_fail, /* (0x11) */
+ xcoff_reloc_type_toc, /* R_TRL (0x12) */
+ xcoff_reloc_type_toc, /* R_TRLA (0x13) */
xcoff_reloc_type_fail, /* R_RRTBI (0x14) */
xcoff_reloc_type_fail, /* R_RRTBA (0x15) */
- xcoff_reloc_type_ba, /* R_CAI (0x16) */
+ xcoff_reloc_type_ba, /* R_CAI (0x16) */
xcoff_reloc_type_crel, /* R_CREL (0x17) */
- xcoff_reloc_type_ba, /* R_RBA (0x18) */
- xcoff_reloc_type_ba, /* R_RBAC (0x19) */
+ xcoff_reloc_type_ba, /* R_RBA (0x18) */
+ xcoff_reloc_type_ba, /* R_RBAC (0x19) */
xcoff64_reloc_type_br, /* R_RBR (0x1a) */
- xcoff_reloc_type_ba, /* R_RBRC (0x1b) */
+ xcoff_reloc_type_ba, /* R_RBRC (0x1b) */
};
/* coffcode.h needs these to be defined. */
@@ -212,11 +238,14 @@ boolean (*xcoff64_calculate_relocation[XCOFF_MAX_CALCULATE_RELOCATION])
#define coff_bfd_is_local_label_name _bfd_xcoff_is_local_label_name
#define coff_bfd_reloc_type_lookup xcoff64_reloc_type_lookup
#ifdef AIX_CORE
-extern const bfd_target * rs6000coff_core_p PARAMS ((bfd *abfd));
-extern boolean rs6000coff_core_file_matches_executable_p
- PARAMS((bfd *cbfd, bfd *ebfd));
-extern char *rs6000coff_core_file_failing_command PARAMS ((bfd *abfd));
-extern int rs6000coff_core_file_failing_signal PARAMS ((bfd *abfd));
+extern const bfd_target * rs6000coff_core_p
+ PARAMS ((bfd *abfd));
+extern bfd_boolean rs6000coff_core_file_matches_executable_p
+ PARAMS ((bfd *cbfd, bfd *ebfd));
+extern char *rs6000coff_core_file_failing_command
+ PARAMS ((bfd *abfd));
+extern int rs6000coff_core_file_failing_signal
+ PARAMS ((bfd *abfd));
#define CORE_FILE_P rs6000coff_core_p
#define coff_core_file_failing_command \
rs6000coff_core_file_failing_command
@@ -496,33 +525,33 @@ _bfd_xcoff64_swap_aux_out (abfd, inp, type, class, indx, numaux, extp)
return bfd_coff_auxesz (abfd);
}
-static boolean
+static bfd_boolean
_bfd_xcoff64_put_symbol_name (abfd, strtab, sym, name)
bfd *abfd;
struct bfd_strtab_hash *strtab;
struct internal_syment *sym;
const char *name;
{
- boolean hash;
+ bfd_boolean hash;
bfd_size_type indx;
- hash = true;
+ hash = TRUE;
if ((abfd->flags & BFD_TRADITIONAL_FORMAT) != 0)
- hash = false;
+ hash = FALSE;
- indx = _bfd_stringtab_add (strtab, name, hash, false);
+ indx = _bfd_stringtab_add (strtab, name, hash, FALSE);
if (indx == (bfd_size_type) -1)
- return false;
+ return FALSE;
sym->_n._n_n._n_zeroes = 0;
sym->_n._n_n._n_offset = STRING_SIZE_SIZE + indx;
- return true;
+ return TRUE;
}
-static boolean
+static bfd_boolean
_bfd_xcoff64_put_ldsymbol_name (abfd, ldinfo, ldsym, name)
bfd *abfd ATTRIBUTE_UNUSED;
struct xcoff_loader_info *ldinfo;
@@ -547,8 +576,8 @@ _bfd_xcoff64_put_ldsymbol_name (abfd, ldinfo, ldsym, name)
bfd_realloc ((PTR) ldinfo->strings, newalc));
if (newstrings == NULL)
{
- ldinfo->failed = true;
- return false;
+ ldinfo->failed = TRUE;
+ return FALSE;
}
ldinfo->string_alc = newalc;
ldinfo->strings = newstrings;
@@ -561,7 +590,7 @@ _bfd_xcoff64_put_ldsymbol_name (abfd, ldinfo, ldsym, name)
ldsym->_l._l_l._l_offset = ldinfo->string_size + 2;
ldinfo->string_size += len + 3;
- return true;
+ return TRUE;
}
/* Routines to swap information in the XCOFF .loader section. If we
@@ -720,20 +749,20 @@ xcoff64_swap_ldrel_out (abfd, src, d)
bfd_put_32 (abfd, src->l_symndx, dst->l_symndx);
}
-static boolean
+static bfd_boolean
xcoff64_write_object_contents (abfd)
- bfd * abfd;
+ bfd *abfd;
{
asection *current;
- boolean hasrelocs = false;
- boolean haslinno = false;
+ bfd_boolean hasrelocs = FALSE;
+ bfd_boolean haslinno = FALSE;
file_ptr scn_base;
file_ptr reloc_base;
file_ptr lineno_base;
file_ptr sym_base;
unsigned long reloc_size = 0;
unsigned long lnno_size = 0;
- boolean long_section_names;
+ bfd_boolean long_section_names;
asection *text_sec = ((void *) 0);
asection *data_sec = ((void *) 0);
asection *bss_sec = ((void *) 0);
@@ -745,7 +774,7 @@ xcoff64_write_object_contents (abfd)
if (! abfd->output_has_begun)
{
if (! bfd_coff_compute_section_file_positions (abfd))
- return false;
+ return FALSE;
}
/* Work out the size of the reloc and linno areas. */
@@ -801,9 +830,9 @@ xcoff64_write_object_contents (abfd)
internal_f.f_nscns = 0;
if (bfd_seek (abfd, scn_base, SEEK_SET) != 0)
- return false;
+ return FALSE;
- long_section_names = false;
+ long_section_names = FALSE;
for (current = abfd->sections; current != NULL; current = current->next)
{
struct internal_scnhdr section;
@@ -836,9 +865,9 @@ xcoff64_write_object_contents (abfd)
section.s_nlnno = current->lineno_count;
if (current->reloc_count != 0)
- hasrelocs = true;
+ hasrelocs = TRUE;
if (current->lineno_count != 0)
- haslinno = true;
+ haslinno = TRUE;
section.s_flags = sec_to_styp_flags (current->name, current->flags);
@@ -858,7 +887,7 @@ xcoff64_write_object_contents (abfd)
amount = bfd_coff_scnhsz (abfd);
if (bfd_coff_swap_scnhdr_out (abfd, &section, &buff) == 0
|| bfd_bwrite ((PTR) (&buff), amount, abfd) != amount)
- return false;
+ return FALSE;
}
internal_f.f_timdat = 0;
@@ -909,14 +938,14 @@ xcoff64_write_object_contents (abfd)
int firstundef;
if (!coff_renumber_symbols (abfd, &firstundef))
- return false;
+ return FALSE;
coff_mangle_symbols (abfd);
if (! coff_write_symbols (abfd))
- return false;
+ return FALSE;
if (! coff_write_linenumbers (abfd))
- return false;
+ return FALSE;
if (! coff_write_relocs (abfd, firstundef))
- return false;
+ return FALSE;
internal_f.f_symptr = sym_base;
internal_f.f_nsyms = bfd_get_symcount (abfd);
@@ -1014,7 +1043,7 @@ xcoff64_write_object_contents (abfd)
internal_a.o_cputype = 4;
break;
case bfd_arch_powerpc:
- if (bfd_get_mach (abfd) == 0)
+ if (bfd_get_mach (abfd) == bfd_mach_ppc)
internal_a.o_cputype = 3;
else
internal_a.o_cputype = 1;
@@ -1028,7 +1057,7 @@ xcoff64_write_object_contents (abfd)
}
if (bfd_seek (abfd, (file_ptr) 0, 0) != 0)
- return false;
+ return FALSE;
{
char * buff;
@@ -1036,7 +1065,7 @@ xcoff64_write_object_contents (abfd)
buff = bfd_malloc (amount);
if (buff == NULL)
- return false;
+ return FALSE;
bfd_coff_swap_filehdr_out (abfd, (PTR) &internal_f, (PTR) buff);
amount = bfd_bwrite ((PTR) buff, amount, abfd);
@@ -1044,7 +1073,7 @@ xcoff64_write_object_contents (abfd)
free (buff);
if (amount != bfd_coff_filhsz (abfd))
- return false;
+ return FALSE;
}
if (abfd->flags & EXEC_P)
@@ -1054,22 +1083,22 @@ xcoff64_write_object_contents (abfd)
buff = bfd_malloc (amount);
if (buff == NULL)
- return false;
+ return FALSE;
- bfd_coff_swap_aouthdr_out (abfd, (PTR) & internal_a, (PTR) buff);
+ bfd_coff_swap_aouthdr_out (abfd, (PTR) &internal_a, (PTR) buff);
amount = bfd_bwrite ((PTR) buff, amount, abfd);
free (buff);
if (amount != bfd_coff_aoutsz (abfd))
- return false;
+ return FALSE;
}
- return true;
+ return TRUE;
}
-static boolean
-xcoff64_reloc_type_br (input_bfd, input_section, output_bfd, rel, sym, howto,
+static bfd_boolean
+xcoff64_reloc_type_br (input_bfd, input_section, output_bfd, rel, sym, howto,
val, addend, relocation, contents)
bfd *input_bfd;
asection *input_section;
@@ -1084,8 +1113,8 @@ xcoff64_reloc_type_br (input_bfd, input_section, output_bfd, rel, sym, howto,
{
struct xcoff_link_hash_entry *h;
- if (0 > rel->r_symndx)
- return false;
+ if (0 > rel->r_symndx)
+ return FALSE;
h = obj_xcoff_sym_hashes (input_bfd)[rel->r_symndx];
@@ -1096,60 +1125,60 @@ xcoff64_reloc_type_br (input_bfd, input_section, output_bfd, rel, sym, howto,
call is followed by a ld r2,40(r1), but the call is not
going to global linkage code, we can replace the load with a
cror. */
- if (NULL != h
- && bfd_link_hash_defined == h->root.type
+ if (NULL != h
+ && bfd_link_hash_defined == h->root.type
&& (rel->r_vaddr - input_section->vma + 8
<= input_section->_cooked_size))
{
bfd_byte *pnext;
unsigned long next;
-
+
pnext = contents + (rel->r_vaddr - input_section->vma) + 4;
next = bfd_get_32 (input_bfd, pnext);
-
- /* The _ptrgl function is magic. It is used by the AIX compiler to call
+
+ /* The _ptrgl function is magic. It is used by the AIX compiler to call
a function through a pointer. */
- if (h->smclas == XMC_GL || strcmp (h->root.root.string, "._ptrgl") == 0)
+ if (h->smclas == XMC_GL || strcmp (h->root.root.string, "._ptrgl") == 0)
{
- if (next == 0x4def7b82 /* cror 15,15,15 */
- || next == 0x4ffffb82 /* cror 31,31,31 */
- || next == 0x60000000) /* ori r0,r0,0 */
- bfd_put_32 (input_bfd, 0xe8410028, pnext); /* ld r2,40(r1) */
- }
- else
+ if (next == 0x4def7b82 /* cror 15,15,15 */
+ || next == 0x4ffffb82 /* cror 31,31,31 */
+ || next == 0x60000000) /* ori r0,r0,0 */
+ bfd_put_32 (input_bfd, 0xe8410028, pnext); /* ld r2,40(r1) */
+ }
+ else
{
- if (next == 0xe8410028) /* ld r2,40(r1) */
- bfd_put_32 (input_bfd, 0x60000000, pnext); /* ori r0,r0,0 */
+ if (next == 0xe8410028) /* ld r2,40(r1) */
+ bfd_put_32 (input_bfd, 0x60000000, pnext); /* ori r0,r0,0 */
}
- }
- else if (NULL != h && bfd_link_hash_undefined == h->root.type)
+ }
+ else if (NULL != h && bfd_link_hash_undefined == h->root.type)
{
/* Normally, this relocation is against a defined symbol. In the
case where this is a partial link and the output section offset
- is greater than 2^25, the linker will return an invalid error
+ is greater than 2^25, the linker will return an invalid error
message that the relocation has been truncated. Yes it has been
- truncated but no it not important. For this case, disable the
+ truncated but no it not important. For this case, disable the
overflow checking. */
howto->complain_on_overflow = complain_overflow_dont;
}
-
- howto->pc_relative = true;
+
+ howto->pc_relative = TRUE;
howto->src_mask &= ~3;
howto->dst_mask = howto->src_mask;
-
+
/* A PC relative reloc includes the section address. */
addend += input_section->vma;
-
+
*relocation = val + addend;
*relocation -= (input_section->output_section->vma
+ input_section->output_offset);
- return true;
+ return TRUE;
}
/* This is the relocation function for the PowerPC64.
See xcoff_ppc_relocation_section for more information. */
-boolean
+bfd_boolean
xcoff64_ppc_relocate_section (output_bfd, info, input_bfd,
input_section, contents, relocs, syms,
sections)
@@ -1181,8 +1210,8 @@ xcoff64_ppc_relocate_section (output_bfd, info, input_bfd,
bfd_byte *location;
/* Relocation type R_REF is a special relocation type which is
- merely used to prevent garbage collection from occurring for
- the csect including the symbol which it references. */
+ merely used to prevent garbage collection from occurring for
+ the csect including the symbol which it references. */
if (rel->r_type == R_REF)
continue;
@@ -1191,33 +1220,33 @@ xcoff64_ppc_relocate_section (output_bfd, info, input_bfd,
howto.rightshift = 0;
howto.bitsize = (rel->r_size & 0x3f) + 1;
howto.size = howto.bitsize > 16 ? (howto.bitsize > 32 ? 4 : 2) : 1;
- howto.pc_relative = false;
+ howto.pc_relative = FALSE;
howto.bitpos = 0;
howto.complain_on_overflow = (rel->r_size & 0x80
? complain_overflow_signed
: complain_overflow_bitfield);
howto.special_function = NULL;
howto.name = "internal";
- howto.partial_inplace = true;
- howto.src_mask = howto.dst_mask = N_ONES(howto.bitsize);
- howto.pcrel_offset = false;
+ howto.partial_inplace = TRUE;
+ howto.src_mask = howto.dst_mask = N_ONES (howto.bitsize);
+ howto.pcrel_offset = FALSE;
/* symbol */
val = 0;
addend = 0;
h = NULL;
sym = NULL;
- symndx = rel->r_symndx;
+ symndx = rel->r_symndx;
- if (-1 != symndx)
+ if (-1 != symndx)
{
asection *sec;
-
+
h = obj_xcoff_sym_hashes (input_bfd)[symndx];
sym = syms + symndx;
addend = - sym->n_value;
-
- if (NULL == h)
+
+ if (NULL == h)
{
sec = sections[symndx];
/* Hack to make sure we use the right TOC anchor value
@@ -1230,104 +1259,104 @@ xcoff64_ppc_relocate_section (output_bfd, info, input_bfd,
+ sec->output_offset
+ sym->n_value
- sec->vma);
- }
- else
+ }
+ else
{
- if (h->root.type == bfd_link_hash_defined
- || h->root.type == bfd_link_hash_defweak)
+ if (h->root.type == bfd_link_hash_defined
+ || h->root.type == bfd_link_hash_defweak)
{
sec = h->root.u.def.section;
val = (h->root.u.def.value
+ sec->output_section->vma
+ sec->output_offset);
- }
- else if (h->root.type == bfd_link_hash_common)
+ }
+ else if (h->root.type == bfd_link_hash_common)
{
sec = h->root.u.c.p->section;
val = (sec->output_section->vma
+ sec->output_offset);
- }
- else if ((0 == (h->flags & (XCOFF_DEF_DYNAMIC | XCOFF_IMPORT)))
- && ! info->relocateable)
+ }
+ else if ((0 == (h->flags & (XCOFF_DEF_DYNAMIC | XCOFF_IMPORT)))
+ && ! info->relocatable)
{
if (! ((*info->callbacks->undefined_symbol)
(info, h->root.root.string, input_bfd, input_section,
- rel->r_vaddr - input_section->vma, true)))
- return false;
-
+ rel->r_vaddr - input_section->vma, TRUE)))
+ return FALSE;
+
/* Don't try to process the reloc. It can't help, and
it may generate another error. */
continue;
}
}
}
-
- if (rel->r_type >= XCOFF_MAX_CALCULATE_RELOCATION
- || ((*xcoff64_calculate_relocation[rel->r_type])
- (input_bfd, input_section, output_bfd, rel, sym, &howto, val,
- addend, &relocation, contents)))
- return false;
-
+
+ if (rel->r_type >= XCOFF_MAX_CALCULATE_RELOCATION
+ || !((*xcoff64_calculate_relocation[rel->r_type])
+ (input_bfd, input_section, output_bfd, rel, sym, &howto, val,
+ addend, &relocation, contents)))
+ return FALSE;
+
/* address */
address = rel->r_vaddr - input_section->vma;
location = contents + address;
-
+
if (address > input_section->_raw_size)
- abort();
-
+ abort ();
+
/* Get the value we are going to relocate. */
if (1 == howto.size)
value_to_relocate = bfd_get_16 (input_bfd, location);
else if (2 == howto.size)
value_to_relocate = bfd_get_32 (input_bfd, location);
- else
+ else
value_to_relocate = bfd_get_64 (input_bfd, location);
-
- /* overflow.
-
+
+ /* overflow.
+
FIXME: We may drop bits during the addition
which we don't check for. We must either check at every single
operation, which would be tedious, or we must do the computations
in a type larger than bfd_vma, which would be inefficient. */
-
+
if ((unsigned int) howto.complain_on_overflow
>= XCOFF_MAX_COMPLAIN_OVERFLOW)
- abort();
-
+ abort ();
+
if (((*xcoff_complain_overflow[howto.complain_on_overflow])
- (input_bfd, value_to_relocate, relocation, &howto)))
+ (input_bfd, value_to_relocate, relocation, &howto)))
{
const char *name;
char buf[SYMNMLEN + 1];
char reloc_type_name[10];
-
- if (symndx == -1)
+
+ if (symndx == -1)
{
name = "*ABS*";
- }
- else if (h != NULL)
+ }
+ else if (h != NULL)
{
name = h->root.root.string;
- }
- else
+ }
+ else
{
name = _bfd_coff_internal_syment_name (input_bfd, sym, buf);
if (name == NULL)
name = "UNKNOWN";
}
sprintf (reloc_type_name, "0x%02x", rel->r_type);
-
+
if (! ((*info->callbacks->reloc_overflow)
(info, name, reloc_type_name, (bfd_vma) 0, input_bfd,
input_section, rel->r_vaddr - input_section->vma)))
- return false;
+ return FALSE;
}
/* Add RELOCATION to the right bits of VALUE_TO_RELOCATE. */
value_to_relocate = ((value_to_relocate & ~howto.dst_mask)
| (((value_to_relocate & howto.src_mask)
+ relocation) & howto.dst_mask));
-
+
/* Put the value back in the object file. */
if (1 == howto.size)
bfd_put_16 (input_bfd, value_to_relocate, location);
@@ -1335,9 +1364,9 @@ xcoff64_ppc_relocate_section (output_bfd, info, input_bfd,
bfd_put_32 (input_bfd, value_to_relocate, location);
else
bfd_put_64 (input_bfd, value_to_relocate, location);
-
+
}
- return true;
+ return TRUE;
}
@@ -1354,105 +1383,105 @@ reloc_howto_type xcoff64_howto_table[] =
0, /* rightshift */
4, /* size (0 = byte, 1 = short, 2 = long) */
64, /* bitsize */
- false, /* pc_relative */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
0, /* special_function */
"R_POS_64", /* name */
- true, /* partial_inplace */
+ TRUE, /* partial_inplace */
MINUS_ONE, /* src_mask */
MINUS_ONE, /* dst_mask */
- false), /* pcrel_offset */
+ FALSE), /* pcrel_offset */
/* 64 bit relocation, but store negative value. */
HOWTO (R_NEG, /* type */
0, /* rightshift */
-4, /* size (0 = byte, 1 = short, 2 = long) */
64, /* bitsize */
- false, /* pc_relative */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
0, /* special_function */
"R_NEG", /* name */
- true, /* partial_inplace */
+ TRUE, /* partial_inplace */
MINUS_ONE, /* src_mask */
MINUS_ONE, /* dst_mask */
- false), /* pcrel_offset */
+ FALSE), /* pcrel_offset */
/* 32 bit PC relative relocation. */
HOWTO (R_REL, /* type */
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
32, /* bitsize */
- true, /* pc_relative */
+ TRUE, /* pc_relative */
0, /* bitpos */
complain_overflow_signed, /* complain_on_overflow */
0, /* special_function */
"R_REL", /* name */
- true, /* partial_inplace */
+ TRUE, /* partial_inplace */
0xffffffff, /* src_mask */
0xffffffff, /* dst_mask */
- false), /* pcrel_offset */
+ FALSE), /* pcrel_offset */
/* 16 bit TOC relative relocation. */
HOWTO (R_TOC, /* type */
0, /* rightshift */
1, /* size (0 = byte, 1 = short, 2 = long) */
16, /* bitsize */
- false, /* pc_relative */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
0, /* special_function */
"R_TOC", /* name */
- true, /* partial_inplace */
+ TRUE, /* partial_inplace */
0xffff, /* src_mask */
0xffff, /* dst_mask */
- false), /* pcrel_offset */
+ FALSE), /* pcrel_offset */
- /* I don't really know what this is. */
+ /* I don't really know what this is. */
HOWTO (R_RTB, /* type */
1, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
32, /* bitsize */
- false, /* pc_relative */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
0, /* special_function */
"R_RTB", /* name */
- true, /* partial_inplace */
+ TRUE, /* partial_inplace */
0xffffffff, /* src_mask */
0xffffffff, /* dst_mask */
- false), /* pcrel_offset */
+ FALSE), /* pcrel_offset */
/* External TOC relative symbol. */
HOWTO (R_GL, /* type */
0, /* rightshift */
1, /* size (0 = byte, 1 = short, 2 = long) */
16, /* bitsize */
- false, /* pc_relative */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
0, /* special_function */
"R_GL", /* name */
- true, /* partial_inplace */
+ TRUE, /* partial_inplace */
0xffff, /* src_mask */
0xffff, /* dst_mask */
- false), /* pcrel_offset */
+ FALSE), /* pcrel_offset */
/* Local TOC relative symbol. */
HOWTO (R_TCL, /* type */
0, /* rightshift */
1, /* size (0 = byte, 1 = short, 2 = long) */
16, /* bitsize */
- false, /* pc_relative */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
0, /* special_function */
"R_TCL", /* name */
- true, /* partial_inplace */
+ TRUE, /* partial_inplace */
0xffff, /* src_mask */
0xffff, /* dst_mask */
- false), /* pcrel_offset */
+ FALSE), /* pcrel_offset */
EMPTY_HOWTO (7),
@@ -1461,15 +1490,15 @@ reloc_howto_type xcoff64_howto_table[] =
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
26, /* bitsize */
- false, /* pc_relative */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
0, /* special_function */
"R_BA_26", /* name */
- true, /* partial_inplace */
- 0x3fffffc, /* src_mask */
- 0x3fffffc, /* dst_mask */
- false), /* pcrel_offset */
+ TRUE, /* partial_inplace */
+ 0x03fffffc, /* src_mask */
+ 0x03fffffc, /* dst_mask */
+ FALSE), /* pcrel_offset */
EMPTY_HOWTO (9),
@@ -1478,15 +1507,15 @@ reloc_howto_type xcoff64_howto_table[] =
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
26, /* bitsize */
- true, /* pc_relative */
+ TRUE, /* pc_relative */
0, /* bitpos */
complain_overflow_signed, /* complain_on_overflow */
0, /* special_function */
"R_BR", /* name */
- true, /* partial_inplace */
- 0x3fffffc, /* src_mask */
- 0x3fffffc, /* dst_mask */
- false), /* pcrel_offset */
+ TRUE, /* partial_inplace */
+ 0x03fffffc, /* src_mask */
+ 0x03fffffc, /* dst_mask */
+ FALSE), /* pcrel_offset */
EMPTY_HOWTO (0xb),
@@ -1495,47 +1524,47 @@ reloc_howto_type xcoff64_howto_table[] =
0, /* rightshift */
1, /* size (0 = byte, 1 = short, 2 = long) */
16, /* bitsize */
- false, /* pc_relative */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
0, /* special_function */
"R_RL", /* name */
- true, /* partial_inplace */
+ TRUE, /* partial_inplace */
0xffff, /* src_mask */
0xffff, /* dst_mask */
- false), /* pcrel_offset */
+ FALSE), /* pcrel_offset */
/* Load address. */
HOWTO (R_RLA, /* type */
0, /* rightshift */
1, /* size (0 = byte, 1 = short, 2 = long) */
16, /* bitsize */
- false, /* pc_relative */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
0, /* special_function */
"R_RLA", /* name */
- true, /* partial_inplace */
+ TRUE, /* partial_inplace */
0xffff, /* src_mask */
0xffff, /* dst_mask */
- false), /* pcrel_offset */
+ FALSE), /* pcrel_offset */
EMPTY_HOWTO (0xe),
- /* Non-relocating reference. */
+ /* Non-relocating reference. */
HOWTO (R_REF, /* type */
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
32, /* bitsize */
- false, /* pc_relative */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
0, /* special_function */
"R_REF", /* name */
- false, /* partial_inplace */
+ FALSE, /* partial_inplace */
0, /* src_mask */
0, /* dst_mask */
- false), /* pcrel_offset */
+ FALSE), /* pcrel_offset */
EMPTY_HOWTO (0x10),
EMPTY_HOWTO (0x11),
@@ -1545,209 +1574,209 @@ reloc_howto_type xcoff64_howto_table[] =
0, /* rightshift */
1, /* size (0 = byte, 1 = short, 2 = long) */
16, /* bitsize */
- false, /* pc_relative */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
0, /* special_function */
"R_TRL", /* name */
- true, /* partial_inplace */
+ TRUE, /* partial_inplace */
0xffff, /* src_mask */
0xffff, /* dst_mask */
- false), /* pcrel_offset */
+ FALSE), /* pcrel_offset */
/* TOC relative load address. */
HOWTO (R_TRLA, /* type */
0, /* rightshift */
1, /* size (0 = byte, 1 = short, 2 = long) */
16, /* bitsize */
- false, /* pc_relative */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
0, /* special_function */
"R_TRLA", /* name */
- true, /* partial_inplace */
+ TRUE, /* partial_inplace */
0xffff, /* src_mask */
0xffff, /* dst_mask */
- false), /* pcrel_offset */
+ FALSE), /* pcrel_offset */
/* Modifiable relative branch. */
HOWTO (R_RRTBI, /* type */
1, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
32, /* bitsize */
- false, /* pc_relative */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
0, /* special_function */
"R_RRTBI", /* name */
- true, /* partial_inplace */
+ TRUE, /* partial_inplace */
0xffffffff, /* src_mask */
0xffffffff, /* dst_mask */
- false), /* pcrel_offset */
+ FALSE), /* pcrel_offset */
/* Modifiable absolute branch. */
HOWTO (R_RRTBA, /* type */
1, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
32, /* bitsize */
- false, /* pc_relative */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
0, /* special_function */
"R_RRTBA", /* name */
- true, /* partial_inplace */
+ TRUE, /* partial_inplace */
0xffffffff, /* src_mask */
0xffffffff, /* dst_mask */
- false), /* pcrel_offset */
+ FALSE), /* pcrel_offset */
/* Modifiable call absolute indirect. */
HOWTO (R_CAI, /* type */
0, /* rightshift */
1, /* size (0 = byte, 1 = short, 2 = long) */
16, /* bitsize */
- false, /* pc_relative */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
0, /* special_function */
"R_CAI", /* name */
- true, /* partial_inplace */
+ TRUE, /* partial_inplace */
0xffff, /* src_mask */
0xffff, /* dst_mask */
- false), /* pcrel_offset */
+ FALSE), /* pcrel_offset */
- /* Modifiable call relative. */
+ /* Modifiable call relative. */
HOWTO (R_CREL, /* type */
0, /* rightshift */
1, /* size (0 = byte, 1 = short, 2 = long) */
16, /* bitsize */
- false, /* pc_relative */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
0, /* special_function */
"R_CREL", /* name */
- true, /* partial_inplace */
+ TRUE, /* partial_inplace */
0xffff, /* src_mask */
0xffff, /* dst_mask */
- false), /* pcrel_offset */
+ FALSE), /* pcrel_offset */
/* Modifiable branch absolute. */
HOWTO (R_RBA, /* type */
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
26, /* bitsize */
- false, /* pc_relative */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
0, /* special_function */
"R_RBA", /* name */
- true, /* partial_inplace */
+ TRUE, /* partial_inplace */
0x03fffffc, /* src_mask */
0x03fffffc, /* dst_mask */
- false), /* pcrel_offset */
+ FALSE), /* pcrel_offset */
/* Modifiable branch absolute. */
HOWTO (R_RBAC, /* type */
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
32, /* bitsize */
- false, /* pc_relative */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
0, /* special_function */
"R_RBAC", /* name */
- true, /* partial_inplace */
+ TRUE, /* partial_inplace */
0xffffffff, /* src_mask */
0xffffffff, /* dst_mask */
- false), /* pcrel_offset */
+ FALSE), /* pcrel_offset */
/* Modifiable branch relative. */
HOWTO (R_RBR, /* type */
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
26, /* bitsize */
- false, /* pc_relative */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_signed, /* complain_on_overflow */
0, /* special_function */
"R_RBR_26", /* name */
- true, /* partial_inplace */
+ TRUE, /* partial_inplace */
0x03fffffc, /* src_mask */
0x03fffffc, /* dst_mask */
- false), /* pcrel_offset */
+ FALSE), /* pcrel_offset */
/* Modifiable branch absolute. */
HOWTO (R_RBRC, /* type */
0, /* rightshift */
1, /* size (0 = byte, 1 = short, 2 = long) */
16, /* bitsize */
- false, /* pc_relative */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
0, /* special_function */
"R_RBRC", /* name */
- true, /* partial_inplace */
+ TRUE, /* partial_inplace */
0xffff, /* src_mask */
0xffff, /* dst_mask */
- false), /* pcrel_offset */
+ FALSE), /* pcrel_offset */
HOWTO (R_POS, /* type */
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
32, /* bitsize */
- false, /* pc_relative */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
0, /* special_function */
"R_POS_32", /* name */
- true, /* partial_inplace */
+ TRUE, /* partial_inplace */
0xffffffff, /* src_mask */
0xffffffff, /* dst_mask */
- false), /* pcrel_offset */
+ FALSE), /* pcrel_offset */
/* 16 bit Non modifiable absolute branch. */
HOWTO (R_BA, /* type */
0, /* rightshift */
1, /* size (0 = byte, 1 = short, 2 = long) */
16, /* bitsize */
- false, /* pc_relative */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
0, /* special_function */
"R_BA_16", /* name */
- true, /* partial_inplace */
+ TRUE, /* partial_inplace */
0xfffc, /* src_mask */
0xfffc, /* dst_mask */
- false), /* pcrel_offset */
+ FALSE), /* pcrel_offset */
/* Modifiable branch relative. */
- HOWTO (R_RBR, /* type */
- 0, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- false, /* pc_relative */
- 0, /* bitpos */
+ HOWTO (R_RBR, /* type */
+ 0, /* rightshift */
+ 1, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
complain_overflow_signed, /* complain_on_overflow */
- 0, /* special_function */
- "R_RBR_16", /* name */
- true, /* partial_inplace */
- 0xffff, /* src_mask */
- 0xffff, /* dst_mask */
- false), /* pcrel_offset */
+ 0, /* special_function */
+ "R_RBR_16", /* name */
+ TRUE, /* partial_inplace */
+ 0xffff, /* src_mask */
+ 0xffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
/* Modifiable branch absolute. */
HOWTO (R_RBA, /* type */
0, /* rightshift */
1, /* size (0 = byte, 1 = short, 2 = long) */
16, /* bitsize */
- false, /* pc_relative */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
0, /* special_function */
"R_RBA_16", /* name */
- true, /* partial_inplace */
+ TRUE, /* partial_inplace */
0xffff, /* src_mask */
0xffff, /* dst_mask */
- false), /* pcrel_offset */
+ FALSE), /* pcrel_offset */
};
@@ -1761,24 +1790,24 @@ xcoff64_rtype2howto (relent, internal)
/* Default howto layout works most of the time */
relent->howto = &xcoff64_howto_table[internal->r_type];
-
- /* Special case some 16 bit reoloc */
+
+ /* Special case some 16 bit reloc */
if (15 == (internal->r_size & 0x3f))
{
- if (R_BA == internal->r_type)
+ if (R_BA == internal->r_type)
relent->howto = &xcoff64_howto_table[0x1d];
- else if (R_RBR == internal->r_type)
+ else if (R_RBR == internal->r_type)
relent->howto = &xcoff64_howto_table[0x1e];
- else if (R_RBA == internal->r_type)
+ else if (R_RBA == internal->r_type)
relent->howto = &xcoff64_howto_table[0x1f];
}
/* Special case 32 bit */
else if (31 == (internal->r_size & 0x3f))
{
- if (R_POS == internal->r_type)
+ if (R_POS == internal->r_type)
relent->howto = &xcoff64_howto_table[0x1c];
}
-
+
/* The r_size field of an XCOFF reloc encodes the bitsize of the
relocation, as well as indicating whether it is signed or not.
Doublecheck that the relocation information gathered from the
@@ -1817,7 +1846,7 @@ xcoff64_reloc_type_lookup (abfd, code)
/* Read in the armap of an XCOFF archive. */
-static boolean
+static bfd_boolean
xcoff64_slurp_armap (abfd)
bfd *abfd;
{
@@ -1835,40 +1864,40 @@ xcoff64_slurp_armap (abfd)
if (xcoff_ardata (abfd) == NULL)
{
- bfd_has_map (abfd) = false;
- return true;
+ bfd_has_map (abfd) = FALSE;
+ return TRUE;
}
off = bfd_scan_vma (xcoff_ardata_big (abfd)->symoff64,
(const char **) NULL, 10);
if (off == 0)
{
- bfd_has_map (abfd) = false;
- return true;
+ bfd_has_map (abfd) = FALSE;
+ return TRUE;
}
if (bfd_seek (abfd, off, SEEK_SET) != 0)
- return false;
+ return FALSE;
/* The symbol table starts with a normal archive header. */
if (bfd_bread ((PTR) &hdr, (bfd_size_type) SIZEOF_AR_HDR_BIG, abfd)
!= SIZEOF_AR_HDR_BIG)
- return false;
+ return FALSE;
/* Skip the name (normally empty). */
namlen = strtol (hdr.namlen, (char **) NULL, 10);
pos = ((namlen + 1) & ~(size_t) 1) + SXCOFFARFMAG;
if (bfd_seek (abfd, pos, SEEK_CUR) != 0)
- return false;
+ return FALSE;
sz = bfd_scan_vma (hdr.size, (const char **) NULL, 10);
/* Read in the entire symbol table. */
contents = (bfd_byte *) bfd_alloc (abfd, sz);
if (contents == NULL)
- return false;
+ return FALSE;
if (bfd_bread ((PTR) contents, sz, abfd) != sz)
- return false;
+ return FALSE;
/* The symbol table starts with an eight byte count. */
c = H_GET_64 (abfd, contents);
@@ -1876,13 +1905,13 @@ xcoff64_slurp_armap (abfd)
if (c * 8 >= sz)
{
bfd_set_error (bfd_error_bad_value);
- return false;
+ return FALSE;
}
amt = c;
amt *= sizeof (carsym);
bfd_ardata (abfd)->symdefs = (carsym *) bfd_alloc (abfd, amt);
if (bfd_ardata (abfd)->symdefs == NULL)
- return false;
+ return FALSE;
/* After the count comes a list of eight byte file offsets. */
for (i = 0, arsym = bfd_ardata (abfd)->symdefs, p = contents + 8;
@@ -1899,15 +1928,15 @@ xcoff64_slurp_armap (abfd)
if (p >= cend)
{
bfd_set_error (bfd_error_bad_value);
- return false;
+ return FALSE;
}
arsym->name = (char *) p;
}
bfd_ardata (abfd)->symdef_count = c;
- bfd_has_map (abfd) = true;
+ bfd_has_map (abfd) = TRUE;
- return true;
+ return TRUE;
}
@@ -1990,7 +2019,7 @@ xcoff64_openr_next_archived_file (archive, last_file)
bfd *archive;
bfd *last_file;
{
- file_ptr filestart;
+ bfd_vma filestart;
if ((xcoff_ardata (archive) == NULL)
|| ! xcoff_big_format_p (archive))
@@ -2019,17 +2048,16 @@ xcoff64_openr_next_archived_file (archive, last_file)
return NULL;
}
- return _bfd_get_elt_at_filepos (archive, filestart);
+ return _bfd_get_elt_at_filepos (archive, (file_ptr) filestart);
}
/* We can't use the usual coff_sizeof_headers routine, because AIX
always uses an a.out header. */
-/*ARGSUSED*/
static int
xcoff64_sizeof_headers (abfd, reloc)
bfd *abfd;
- boolean reloc ATTRIBUTE_UNUSED;
+ bfd_boolean reloc ATTRIBUTE_UNUSED;
{
int size;
@@ -2085,20 +2113,20 @@ xcoff64_create_csect_from_smclas (abfd, aux, symbol_name)
return return_value;
}
-static boolean
+static bfd_boolean
xcoff64_is_lineno_count_overflow (abfd, value)
bfd *abfd ATTRIBUTE_UNUSED;
bfd_vma value ATTRIBUTE_UNUSED;
{
- return false;
+ return FALSE;
}
-static boolean
+static bfd_boolean
xcoff64_is_reloc_count_overflow (abfd, value)
bfd *abfd ATTRIBUTE_UNUSED;
bfd_vma value ATTRIBUTE_UNUSED;
{
- return false;
+ return FALSE;
}
static bfd_vma
@@ -2117,7 +2145,7 @@ xcoff64_loader_reloc_offset (abfd, ldhdr)
return (ldhdr->l_rldoff);
}
-static boolean
+static bfd_boolean
xcoff64_bad_format_hook (abfd, filehdr)
bfd * abfd;
PTR filehdr;
@@ -2126,20 +2154,20 @@ xcoff64_bad_format_hook (abfd, filehdr)
/* Check flavor first. */
if (bfd_get_flavour (abfd) != bfd_target_xcoff_flavour)
- return false;
+ return FALSE;
if (bfd_xcoff_magic_number (abfd) != internal_f->f_magic)
- return false;
+ return FALSE;
- return true;
+ return TRUE;
}
-static boolean
+static bfd_boolean
xcoff64_generate_rtinit (abfd, init, fini, rtld)
bfd *abfd;
const char *init;
const char *fini;
- boolean rtld;
+ bfd_boolean rtld;
{
bfd_byte filehdr_ext[FILHSZ];
bfd_byte scnhdr_ext[SCNHSZ * 3];
@@ -2166,7 +2194,7 @@ xcoff64_generate_rtinit (abfd, init, fini, rtld)
char *rtld_name = "__rtld";
if (! bfd_xcoff_rtinit_size (abfd))
- return false;
+ return FALSE;
initsz = (init == NULL ? 0 : 1 + strlen (init));
finisz = (fini == NULL ? 0 : 1 + strlen (fini));
@@ -2225,37 +2253,37 @@ xcoff64_generate_rtinit (abfd, init, fini, rtld)
bss_scnhdr.s_flags = STYP_BSS;
/* .data
- 0x0000 0x00000000 : rtl
- 0x0004 0x00000000 :
- 0x0008 0x00000018 : offset to init, or 0
- 0x000C 0x00000038 : offset to fini, or 0
- 0x0010 0x00000010 : size of descriptor
- 0x0014 0x00000000 : pad
- 0x0018 0x00000000 : init, needs a reloc
- 0x001C 0x00000000 :
- 0x0020 0x00000058 : offset to init name
- 0x0024 0x00000000 : flags, padded to a word
- 0x0028 0x00000000 : empty init
- 0x002C 0x00000000 :
- 0x0030 0x00000000 :
- 0x0034 0x00000000 :
- 0x0038 0x00000000 : fini, needs a reloc
- 0x003C 0x00000000 :
- 0x0040 0x00000??? : offset to fini name
- 0x0044 0x00000000 : flags, padded to a word
- 0x0048 0x00000000 : empty fini
- 0x004C 0x00000000 :
- 0x0050 0x00000000 :
- 0x0054 0x00000000 :
- 0x0058 init name
+ 0x0000 0x00000000 : rtl
+ 0x0004 0x00000000 :
+ 0x0008 0x00000018 : offset to init, or 0
+ 0x000C 0x00000038 : offset to fini, or 0
+ 0x0010 0x00000010 : size of descriptor
+ 0x0014 0x00000000 : pad
+ 0x0018 0x00000000 : init, needs a reloc
+ 0x001C 0x00000000 :
+ 0x0020 0x00000058 : offset to init name
+ 0x0024 0x00000000 : flags, padded to a word
+ 0x0028 0x00000000 : empty init
+ 0x002C 0x00000000 :
+ 0x0030 0x00000000 :
+ 0x0034 0x00000000 :
+ 0x0038 0x00000000 : fini, needs a reloc
+ 0x003C 0x00000000 :
+ 0x0040 0x00000??? : offset to fini name
+ 0x0044 0x00000000 : flags, padded to a word
+ 0x0048 0x00000000 : empty fini
+ 0x004C 0x00000000 :
+ 0x0050 0x00000000 :
+ 0x0054 0x00000000 :
+ 0x0058 init name
0x0058 + initsz fini name */
data_buffer_size = 0x0058 + initsz + finisz;
- data_buffer_size += (data_buffer_size & 7) ? 8 - (data_buffer_size & 7) : 0;
+ data_buffer_size = (data_buffer_size + 7) &~ (bfd_size_type) 7;
data_buffer = NULL;
data_buffer = (bfd_byte *) bfd_zmalloc (data_buffer_size);
if (data_buffer == NULL)
- return false;
+ return FALSE;
if (initsz)
{
@@ -2291,7 +2319,7 @@ xcoff64_generate_rtinit (abfd, init, fini, rtld)
string_table = (bfd_byte *) bfd_zmalloc (string_table_size);
if (string_table == NULL)
- return false;
+ return FALSE;
val = string_table_size;
bfd_put_32 (abfd, val, &string_table[0]);
@@ -2455,7 +2483,7 @@ xcoff64_generate_rtinit (abfd, init, fini, rtld)
free (data_buffer);
data_buffer = NULL;
- return true;
+ return TRUE;
}
/* The typical dynamic reloc. */
@@ -2465,15 +2493,15 @@ HOWTO (0, /* type */
0, /* rightshift */
4, /* size (0 = byte, 1 = short, 2 = long) */
64, /* bitsize */
- false, /* pc_relative */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
0, /* special_function */
"R_POS", /* name */
- true, /* partial_inplace */
+ TRUE, /* partial_inplace */
MINUS_ONE, /* src_mask */
MINUS_ONE, /* dst_mask */
- false); /* pcrel_offset */
+ FALSE); /* pcrel_offset */
static unsigned long xcoff64_glink_code[10] =
{
@@ -2490,8 +2518,8 @@ static unsigned long xcoff64_glink_code[10] =
};
static const struct xcoff_backend_data_rec bfd_xcoff_backend_data =
-{
- { /* COFF backend, defined in libcoff.h. */
+ {
+ { /* COFF backend, defined in libcoff.h. */
_bfd_xcoff64_swap_aux_in,
_bfd_xcoff64_swap_sym_in,
_bfd_xcoff64_swap_lineno_in,
@@ -2510,11 +2538,11 @@ static const struct xcoff_backend_data_rec bfd_xcoff_backend_data =
RELSZ,
LINESZ,
FILNMLEN,
- true, /* _bfd_coff_long_filenames */
- false, /* _bfd_coff_long_section_names */
+ TRUE, /* _bfd_coff_long_filenames */
+ FALSE, /* _bfd_coff_long_section_names */
3, /* _bfd_coff_default_section_alignment_power */
- true, /* _bfd_coff_force_symnames_in_strings */
- 4, /* _bfd_coff_debug_string_prefix_length */
+ TRUE, /* _bfd_coff_force_symnames_in_strings */
+ 4, /* _bfd_coff_debug_string_prefix_length */
coff_swap_filehdr_in,
coff_swap_aouthdr_in,
coff_swap_scnhdr_in,
@@ -2530,22 +2558,22 @@ static const struct xcoff_backend_data_rec bfd_xcoff_backend_data =
coff_print_aux,
dummy_reloc16_extra_cases,
dummy_reloc16_estimate,
- NULL, /* bfd_coff_sym_is_global */
- coff_compute_section_file_positions,
- NULL , /* _bfd_coff_start_final_link */
+ NULL, /* bfd_coff_sym_is_global */
+ coff_compute_section_file_positions,
+ NULL, /* _bfd_coff_start_final_link */
xcoff64_ppc_relocate_section,
coff_rtype_to_howto,
NULL, /* _bfd_coff_adjust_symndx */
_bfd_generic_link_add_one_symbol,
coff_link_output_has_begun,
coff_final_link_postscript
- },
+ },
- 0x01EF, /* magic number */
+ 0x01EF, /* magic number */
bfd_arch_powerpc,
bfd_mach_ppc_620,
- /* Function pointers to xcoff specific swap routines. */
+ /* Function pointers to xcoff specific swap routines. */
xcoff64_swap_ldhdr_in,
xcoff64_swap_ldhdr_out,
xcoff64_swap_ldsym_in,
@@ -2553,54 +2581,54 @@ static const struct xcoff_backend_data_rec bfd_xcoff_backend_data =
xcoff64_swap_ldrel_in,
xcoff64_swap_ldrel_out,
- /* Sizes. */
+ /* Sizes. */
LDHDRSZ,
LDSYMSZ,
LDRELSZ,
- 24, /* _xcoff_function_descriptor_size */
- 0, /* _xcoff_small_aout_header_size */
+ 24, /* _xcoff_function_descriptor_size */
+ 0, /* _xcoff_small_aout_header_size */
- /* Versions. */
- 2, /* _xcoff_ldhdr_version */
+ /* Versions. */
+ 2, /* _xcoff_ldhdr_version */
_bfd_xcoff64_put_symbol_name,
_bfd_xcoff64_put_ldsymbol_name,
- &xcoff64_dynamic_reloc,
- xcoff64_create_csect_from_smclas,
+ &xcoff64_dynamic_reloc,
+ xcoff64_create_csect_from_smclas,
- /* Lineno and reloc count overflow. */
- xcoff64_is_lineno_count_overflow,
- xcoff64_is_reloc_count_overflow,
+ /* Lineno and reloc count overflow. */
+ xcoff64_is_lineno_count_overflow,
+ xcoff64_is_reloc_count_overflow,
- xcoff64_loader_symbol_offset,
- xcoff64_loader_reloc_offset,
+ xcoff64_loader_symbol_offset,
+ xcoff64_loader_reloc_offset,
- /* glink. */
- &xcoff64_glink_code[0],
- 40, /* _xcoff_glink_size */
+ /* glink. */
+ &xcoff64_glink_code[0],
+ 40, /* _xcoff_glink_size */
- /* rtinit. */
- 88, /* _xcoff_rtinit_size */
+ /* rtinit. */
+ 88, /* _xcoff_rtinit_size */
xcoff64_generate_rtinit,
-};
+ };
/* The transfer vector that leads the outside world to all of the above. */
const bfd_target rs6000coff64_vec =
-{
- "aixcoff64-rs6000",
- bfd_target_xcoff_flavour,
- BFD_ENDIAN_BIG, /* data byte order is big */
- BFD_ENDIAN_BIG, /* header byte order is big */
+ {
+ "aixcoff64-rs6000",
+ bfd_target_xcoff_flavour,
+ BFD_ENDIAN_BIG, /* data byte order is big */
+ BFD_ENDIAN_BIG, /* header byte order is big */
(HAS_RELOC | EXEC_P | HAS_LINENO | HAS_DEBUG | DYNAMIC
| HAS_SYMS | HAS_LOCALS | WP_TEXT),
- (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC),
- 0, /* leading char */
- '/', /* ar_pad_char */
+ SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_CODE | SEC_DATA,
+ 0, /* leading char */
+ '/', /* ar_pad_char */
15, /* ar_max_namelen */
- /* data */
+ /* data */
bfd_getb64,
bfd_getb_signed_64,
bfd_putb64,
@@ -2611,7 +2639,7 @@ const bfd_target rs6000coff64_vec =
bfd_getb_signed_16,
bfd_putb16,
- /* hdrs */
+ /* hdrs */
bfd_getb64,
bfd_getb_signed_64,
bfd_putb64,
@@ -2622,51 +2650,51 @@ const bfd_target rs6000coff64_vec =
bfd_getb_signed_16,
bfd_putb16,
- { /* bfd_check_format */
- _bfd_dummy_target,
- coff_object_p,
- xcoff64_archive_p,
- CORE_FILE_P
- },
-
- { /* bfd_set_format */
- bfd_false,
- coff_mkobject,
- _bfd_generic_mkarchive,
- bfd_false
- },
-
- {/* bfd_write_contents */
- bfd_false,
- xcoff64_write_object_contents,
- _bfd_xcoff_write_archive_contents,
- bfd_false
- },
-
- /* Generic */
+ { /* bfd_check_format */
+ _bfd_dummy_target,
+ coff_object_p,
+ xcoff64_archive_p,
+ CORE_FILE_P
+ },
+
+ { /* bfd_set_format */
+ bfd_false,
+ coff_mkobject,
+ _bfd_generic_mkarchive,
+ bfd_false
+ },
+
+ {/* bfd_write_contents */
+ bfd_false,
+ xcoff64_write_object_contents,
+ _bfd_xcoff_write_archive_contents,
+ bfd_false
+ },
+
+ /* Generic */
bfd_true,
bfd_true,
coff_new_section_hook,
_bfd_generic_get_section_contents,
- _bfd_generic_get_section_contents_in_window,
+ _bfd_generic_get_section_contents_in_window,
- /* Copy */
+ /* Copy */
_bfd_xcoff_copy_private_bfd_data,
- ((boolean (*) (bfd *, bfd *)) bfd_true),
- ((boolean (*) (bfd *, asection *, bfd *, asection *)) bfd_true),
- ((boolean (*) (bfd *, asymbol *, bfd *, asymbol *)) bfd_true),
- ((boolean (*) (bfd *, flagword)) bfd_true),
- ((boolean (*) (bfd *, void * )) bfd_true),
+ ((bfd_boolean (*) (bfd *, bfd *)) bfd_true),
+ ((bfd_boolean (*) (bfd *, asection *, bfd *, asection *)) bfd_true),
+ ((bfd_boolean (*) (bfd *, asymbol *, bfd *, asymbol *)) bfd_true),
+ ((bfd_boolean (*) (bfd *, flagword)) bfd_true),
+ ((bfd_boolean (*) (bfd *, void * )) bfd_true),
- /* Core */
+ /* Core */
coff_core_file_failing_command,
coff_core_file_failing_signal,
coff_core_file_matches_executable_p,
- /* Archive */
+ /* Archive */
xcoff64_slurp_armap,
bfd_false,
- ((boolean (*) (bfd *, char **, bfd_size_type *, const char **)) bfd_false),
+ ((bfd_boolean (*) (bfd *, char **, bfd_size_type *, const char **)) bfd_false),
bfd_dont_truncate_arname,
_bfd_xcoff_write_armap,
_bfd_xcoff_read_ar_hdr,
@@ -2675,9 +2703,9 @@ const bfd_target rs6000coff64_vec =
_bfd_xcoff_stat_arch_elt,
bfd_true,
- /* Symbols */
+ /* Symbols */
coff_get_symtab_upper_bound,
- coff_get_symtab,
+ coff_canonicalize_symtab,
coff_make_empty_symbol,
coff_print_symbol,
coff_get_symbol_info,
@@ -2688,18 +2716,18 @@ const bfd_target rs6000coff64_vec =
_bfd_generic_read_minisymbols,
_bfd_generic_minisymbol_to_symbol,
- /* Reloc */
+ /* Reloc */
coff_get_reloc_upper_bound,
coff_canonicalize_reloc,
xcoff64_reloc_type_lookup,
- /* Write */
+ /* Write */
coff_set_arch_mach,
coff_set_section_contents,
- /* Link */
+ /* Link */
xcoff64_sizeof_headers,
- bfd_generic_get_relocated_section_contents,
+ bfd_generic_get_relocated_section_contents,
bfd_generic_relax_section,
_bfd_xcoff_bfd_link_hash_table_create,
_bfd_generic_link_hash_table_free,
@@ -2711,27 +2739,31 @@ const bfd_target rs6000coff64_vec =
bfd_generic_merge_sections,
bfd_generic_discard_group,
- /* Dynamic */
- _bfd_xcoff_get_dynamic_symtab_upper_bound,
+ /* Dynamic */
+ _bfd_xcoff_get_dynamic_symtab_upper_bound,
_bfd_xcoff_canonicalize_dynamic_symtab,
_bfd_xcoff_get_dynamic_reloc_upper_bound,
_bfd_xcoff_canonicalize_dynamic_reloc,
- /* Opposite endian version, none exists */
- NULL,
+ /* Opposite endian version, none exists */
+ NULL,
- (void *) &bfd_xcoff_backend_data,
-};
+ (void *) &bfd_xcoff_backend_data,
+ };
-extern const bfd_target *xcoff64_core_p PARAMS ((bfd *));
-extern boolean xcoff64_core_file_matches_executable_p PARAMS((bfd *, bfd *));
-extern char *xcoff64_core_file_failing_command PARAMS ((bfd *));
-extern int xcoff64_core_file_failing_signal PARAMS ((bfd *));
+extern const bfd_target *xcoff64_core_p
+ PARAMS ((bfd *));
+extern bfd_boolean xcoff64_core_file_matches_executable_p
+ PARAMS ((bfd *, bfd *));
+extern char *xcoff64_core_file_failing_command
+ PARAMS ((bfd *));
+extern int xcoff64_core_file_failing_signal
+ PARAMS ((bfd *));
/* AIX 5 */
static const struct xcoff_backend_data_rec bfd_xcoff_aix5_backend_data =
-{
- { /* COFF backend, defined in libcoff.h. */
+ {
+ { /* COFF backend, defined in libcoff.h. */
_bfd_xcoff64_swap_aux_in,
_bfd_xcoff64_swap_sym_in,
_bfd_xcoff64_swap_lineno_in,
@@ -2750,11 +2782,11 @@ static const struct xcoff_backend_data_rec bfd_xcoff_aix5_backend_data =
RELSZ,
LINESZ,
FILNMLEN,
- true, /* _bfd_coff_long_filenames */
- false, /* _bfd_coff_long_section_names */
+ TRUE, /* _bfd_coff_long_filenames */
+ FALSE, /* _bfd_coff_long_section_names */
3, /* _bfd_coff_default_section_alignment_power */
- true, /* _bfd_coff_force_symnames_in_strings */
- 4, /* _bfd_coff_debug_string_prefix_length */
+ TRUE, /* _bfd_coff_force_symnames_in_strings */
+ 4, /* _bfd_coff_debug_string_prefix_length */
coff_swap_filehdr_in,
coff_swap_aouthdr_in,
coff_swap_scnhdr_in,
@@ -2770,22 +2802,22 @@ static const struct xcoff_backend_data_rec bfd_xcoff_aix5_backend_data =
coff_print_aux,
dummy_reloc16_extra_cases,
dummy_reloc16_estimate,
- NULL, /* bfd_coff_sym_is_global */
- coff_compute_section_file_positions,
- NULL , /* _bfd_coff_start_final_link */
+ NULL, /* bfd_coff_sym_is_global */
+ coff_compute_section_file_positions,
+ NULL, /* _bfd_coff_start_final_link */
xcoff64_ppc_relocate_section,
coff_rtype_to_howto,
NULL, /* _bfd_coff_adjust_symndx */
_bfd_generic_link_add_one_symbol,
coff_link_output_has_begun,
coff_final_link_postscript
- },
+ },
- U64_TOCMAGIC, /* magic number */
+ U64_TOCMAGIC, /* magic number */
bfd_arch_powerpc,
bfd_mach_ppc_620,
- /* Function pointers to xcoff specific swap routines. */
+ /* Function pointers to xcoff specific swap routines. */
xcoff64_swap_ldhdr_in,
xcoff64_swap_ldhdr_out,
xcoff64_swap_ldsym_in,
@@ -2793,53 +2825,53 @@ static const struct xcoff_backend_data_rec bfd_xcoff_aix5_backend_data =
xcoff64_swap_ldrel_in,
xcoff64_swap_ldrel_out,
- /* Sizes. */
+ /* Sizes. */
LDHDRSZ,
LDSYMSZ,
LDRELSZ,
- 24, /* _xcoff_function_descriptor_size */
- 0, /* _xcoff_small_aout_header_size */
- /* Versions. */
- 2, /* _xcoff_ldhdr_version */
+ 24, /* _xcoff_function_descriptor_size */
+ 0, /* _xcoff_small_aout_header_size */
+ /* Versions. */
+ 2, /* _xcoff_ldhdr_version */
_bfd_xcoff64_put_symbol_name,
_bfd_xcoff64_put_ldsymbol_name,
- &xcoff64_dynamic_reloc,
- xcoff64_create_csect_from_smclas,
+ &xcoff64_dynamic_reloc,
+ xcoff64_create_csect_from_smclas,
- /* Lineno and reloc count overflow. */
- xcoff64_is_lineno_count_overflow,
- xcoff64_is_reloc_count_overflow,
+ /* Lineno and reloc count overflow. */
+ xcoff64_is_lineno_count_overflow,
+ xcoff64_is_reloc_count_overflow,
- xcoff64_loader_symbol_offset,
- xcoff64_loader_reloc_offset,
+ xcoff64_loader_symbol_offset,
+ xcoff64_loader_reloc_offset,
- /* glink. */
- &xcoff64_glink_code[0],
- 40, /* _xcoff_glink_size */
+ /* glink. */
+ &xcoff64_glink_code[0],
+ 40, /* _xcoff_glink_size */
- /* rtinit. */
- 88, /* _xcoff_rtinit_size */
+ /* rtinit. */
+ 88, /* _xcoff_rtinit_size */
xcoff64_generate_rtinit,
-};
+ };
/* The transfer vector that leads the outside world to all of the above. */
const bfd_target aix5coff64_vec =
-{
- "aix5coff64-rs6000",
- bfd_target_xcoff_flavour,
- BFD_ENDIAN_BIG, /* data byte order is big */
- BFD_ENDIAN_BIG, /* header byte order is big */
+ {
+ "aix5coff64-rs6000",
+ bfd_target_xcoff_flavour,
+ BFD_ENDIAN_BIG, /* data byte order is big */
+ BFD_ENDIAN_BIG, /* header byte order is big */
(HAS_RELOC | EXEC_P | HAS_LINENO | HAS_DEBUG | DYNAMIC
| HAS_SYMS | HAS_LOCALS | WP_TEXT),
- (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC),
- 0, /* leading char */
- '/', /* ar_pad_char */
+ SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_CODE | SEC_DATA,
+ 0, /* leading char */
+ '/', /* ar_pad_char */
15, /* ar_max_namelen */
- /* data */
+ /* data */
bfd_getb64,
bfd_getb_signed_64,
bfd_putb64,
@@ -2850,7 +2882,7 @@ const bfd_target aix5coff64_vec =
bfd_getb_signed_16,
bfd_putb16,
- /* hdrs */
+ /* hdrs */
bfd_getb64,
bfd_getb_signed_64,
bfd_putb64,
@@ -2861,51 +2893,51 @@ const bfd_target aix5coff64_vec =
bfd_getb_signed_16,
bfd_putb16,
- { /* bfd_check_format */
- _bfd_dummy_target,
- coff_object_p,
- xcoff64_archive_p,
- xcoff64_core_p
- },
-
- { /* bfd_set_format */
- bfd_false,
- coff_mkobject,
- _bfd_generic_mkarchive,
- bfd_false
- },
-
- {/* bfd_write_contents */
- bfd_false,
- xcoff64_write_object_contents,
- _bfd_xcoff_write_archive_contents,
- bfd_false
- },
-
- /* Generic */
+ { /* bfd_check_format */
+ _bfd_dummy_target,
+ coff_object_p,
+ xcoff64_archive_p,
+ xcoff64_core_p
+ },
+
+ { /* bfd_set_format */
+ bfd_false,
+ coff_mkobject,
+ _bfd_generic_mkarchive,
+ bfd_false
+ },
+
+ {/* bfd_write_contents */
+ bfd_false,
+ xcoff64_write_object_contents,
+ _bfd_xcoff_write_archive_contents,
+ bfd_false
+ },
+
+ /* Generic */
bfd_true,
bfd_true,
coff_new_section_hook,
_bfd_generic_get_section_contents,
- _bfd_generic_get_section_contents_in_window,
+ _bfd_generic_get_section_contents_in_window,
- /* Copy */
+ /* Copy */
_bfd_xcoff_copy_private_bfd_data,
- ((boolean (*) (bfd *, bfd *)) bfd_true),
- ((boolean (*) (bfd *, asection *, bfd *, asection *)) bfd_true),
- ((boolean (*) (bfd *, asymbol *, bfd *, asymbol *)) bfd_true),
- ((boolean (*) (bfd *, flagword)) bfd_true),
- ((boolean (*) (bfd *, void * )) bfd_true),
+ ((bfd_boolean (*) (bfd *, bfd *)) bfd_true),
+ ((bfd_boolean (*) (bfd *, asection *, bfd *, asection *)) bfd_true),
+ ((bfd_boolean (*) (bfd *, asymbol *, bfd *, asymbol *)) bfd_true),
+ ((bfd_boolean (*) (bfd *, flagword)) bfd_true),
+ ((bfd_boolean (*) (bfd *, void * )) bfd_true),
- /* Core */
+ /* Core */
xcoff64_core_file_failing_command,
xcoff64_core_file_failing_signal,
xcoff64_core_file_matches_executable_p,
- /* Archive */
+ /* Archive */
xcoff64_slurp_armap,
bfd_false,
- ((boolean (*) (bfd *, char **, bfd_size_type *, const char **)) bfd_false),
+ ((bfd_boolean (*) (bfd *, char **, bfd_size_type *, const char **)) bfd_false),
bfd_dont_truncate_arname,
_bfd_xcoff_write_armap,
_bfd_xcoff_read_ar_hdr,
@@ -2914,9 +2946,9 @@ const bfd_target aix5coff64_vec =
_bfd_xcoff_stat_arch_elt,
bfd_true,
- /* Symbols */
+ /* Symbols */
coff_get_symtab_upper_bound,
- coff_get_symtab,
+ coff_canonicalize_symtab,
coff_make_empty_symbol,
coff_print_symbol,
coff_get_symbol_info,
@@ -2927,18 +2959,18 @@ const bfd_target aix5coff64_vec =
_bfd_generic_read_minisymbols,
_bfd_generic_minisymbol_to_symbol,
- /* Reloc */
+ /* Reloc */
coff_get_reloc_upper_bound,
coff_canonicalize_reloc,
xcoff64_reloc_type_lookup,
- /* Write */
+ /* Write */
coff_set_arch_mach,
coff_set_section_contents,
- /* Link */
+ /* Link */
xcoff64_sizeof_headers,
- bfd_generic_get_relocated_section_contents,
+ bfd_generic_get_relocated_section_contents,
bfd_generic_relax_section,
_bfd_xcoff_bfd_link_hash_table_create,
_bfd_generic_link_hash_table_free,
@@ -2950,14 +2982,14 @@ const bfd_target aix5coff64_vec =
bfd_generic_merge_sections,
bfd_generic_discard_group,
- /* Dynamic */
- _bfd_xcoff_get_dynamic_symtab_upper_bound,
+ /* Dynamic */
+ _bfd_xcoff_get_dynamic_symtab_upper_bound,
_bfd_xcoff_canonicalize_dynamic_symtab,
_bfd_xcoff_get_dynamic_reloc_upper_bound,
_bfd_xcoff_canonicalize_dynamic_reloc,
- /* Opposite endian version, none exists. */
- NULL,
+ /* Opposite endian version, none exists. */
+ NULL,
- (void *) & bfd_xcoff_aix5_backend_data,
-};
+ (void *) & bfd_xcoff_aix5_backend_data,
+ };
diff --git a/contrib/binutils/bfd/coffcode.h b/contrib/binutils/bfd/coffcode.h
index 1c02dcb..15d9709 100644
--- a/contrib/binutils/bfd/coffcode.h
+++ b/contrib/binutils/bfd/coffcode.h
@@ -1,24 +1,24 @@
/* 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
+ 2000, 2001, 2002, 2003
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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
/*
Most of this hacked by Steve Chamberlain,
@@ -225,7 +225,7 @@ SUBSUBSECTION
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 hierachy required by coff. It changes each pointer
+ structured hierarchy required by coff. It changes each pointer
to a symbol into the index into the symbol table of the asymbol.
o <<coff_write_symbols>>
@@ -296,7 +296,7 @@ CODE_FRAGMENT
. struct lineno_cache_entry *lineno;
.
. {* Have the line numbers been relocated yet ? *}
-. boolean done_lineno;
+. bfd_boolean done_lineno;
.} coff_symbol_type;
*/
@@ -309,42 +309,64 @@ CODE_FRAGMENT
#define STRING_SIZE_SIZE (4)
-static long sec_to_styp_flags PARAMS ((const char *, flagword));
-static boolean styp_to_sec_flags
+static long sec_to_styp_flags
+ PARAMS ((const char *, flagword));
+static bfd_boolean styp_to_sec_flags
PARAMS ((bfd *, PTR, const char *, asection *, flagword *));
-static boolean coff_bad_format_hook PARAMS ((bfd *, PTR));
+static bfd_boolean coff_bad_format_hook
+ PARAMS ((bfd *, PTR));
static void coff_set_custom_section_alignment
PARAMS ((bfd *, asection *, const struct coff_section_alignment_entry *,
const unsigned int));
-static boolean coff_new_section_hook PARAMS ((bfd *, asection *));
-static boolean coff_set_arch_mach_hook PARAMS ((bfd *, PTR));
-static boolean coff_write_relocs PARAMS ((bfd *, int));
-static boolean coff_set_flags
+static bfd_boolean coff_new_section_hook
+ PARAMS ((bfd *, asection *));
+static bfd_boolean coff_set_arch_mach_hook
+ PARAMS ((bfd *, PTR));
+static bfd_boolean coff_write_relocs
+ PARAMS ((bfd *, int));
+static bfd_boolean coff_set_flags
PARAMS ((bfd *, unsigned int *, unsigned short *));
-static boolean coff_set_arch_mach
+static bfd_boolean coff_set_arch_mach
PARAMS ((bfd *, enum bfd_architecture, unsigned long)) ATTRIBUTE_UNUSED;
-static boolean coff_compute_section_file_positions PARAMS ((bfd *));
-static boolean coff_write_object_contents PARAMS ((bfd *)) ATTRIBUTE_UNUSED;
-static boolean coff_set_section_contents
- PARAMS ((bfd *, asection *, PTR, file_ptr, bfd_size_type));
-static PTR buy_and_read PARAMS ((bfd *, file_ptr, bfd_size_type));
-static boolean coff_slurp_line_table PARAMS ((bfd *, asection *));
-static boolean coff_slurp_symbol_table PARAMS ((bfd *));
+static bfd_boolean coff_compute_section_file_positions
+ PARAMS ((bfd *));
+static bfd_boolean coff_write_object_contents
+ PARAMS ((bfd *)) ATTRIBUTE_UNUSED;
+static bfd_boolean coff_set_section_contents
+ PARAMS ((bfd *, asection *, const PTR, file_ptr, bfd_size_type));
+static PTR buy_and_read
+ PARAMS ((bfd *, file_ptr, bfd_size_type));
+static bfd_boolean coff_slurp_line_table
+ PARAMS ((bfd *, asection *));
+static bfd_boolean coff_slurp_symbol_table
+ PARAMS ((bfd *));
static enum coff_symbol_classification coff_classify_symbol
PARAMS ((bfd *, struct internal_syment *));
-static boolean coff_slurp_reloc_table PARAMS ((bfd *, asection *, asymbol **));
+static bfd_boolean coff_slurp_reloc_table
+ PARAMS ((bfd *, asection *, asymbol **));
static long coff_canonicalize_reloc
PARAMS ((bfd *, asection *, arelent **, asymbol **));
#ifndef coff_mkobject_hook
-static PTR coff_mkobject_hook PARAMS ((bfd *, PTR, PTR));
+static PTR coff_mkobject_hook
+ PARAMS ((bfd *, PTR, PTR));
#endif
#ifdef COFF_WITH_PE
-static flagword handle_COMDAT PARAMS ((bfd *, flagword, PTR, const char *, asection *));
+static flagword handle_COMDAT
+ PARAMS ((bfd *, flagword, PTR, const char *, asection *));
#endif
#ifdef COFF_IMAGE_WITH_PE
-static boolean coff_read_word PARAMS ((bfd *, unsigned int *));
-static unsigned int coff_compute_checksum PARAMS ((bfd *));
-static boolean coff_apply_checksum PARAMS ((bfd *));
+static bfd_boolean coff_read_word
+ PARAMS ((bfd *, unsigned int *));
+static unsigned int coff_compute_checksum
+ PARAMS ((bfd *));
+static bfd_boolean coff_apply_checksum
+ PARAMS ((bfd *));
+#endif
+#ifdef TICOFF
+static bfd_boolean ticoff0_bad_format_hook
+ PARAMS ((bfd *, PTR ));
+static bfd_boolean ticoff1_bad_format_hook
+ PARAMS ((bfd *, PTR ));
#endif
/* void warning(); */
@@ -542,15 +564,15 @@ sec_to_styp_flags (sec_name, sec_flags)
/* 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 */
+ are retained in pei_section_data(abfd, section)->pe_flags. */
- styp_flags |= IMAGE_SCN_MEM_READ; /* always readable. */
+ styp_flags |= IMAGE_SCN_MEM_READ; /* Always readable. */
if ((sec_flags & SEC_READONLY) == 0)
- styp_flags |= IMAGE_SCN_MEM_WRITE; /* Invert READONLY for write */
+ styp_flags |= IMAGE_SCN_MEM_WRITE; /* Invert READONLY for write. */
if (sec_flags & SEC_CODE)
- styp_flags |= IMAGE_SCN_MEM_EXECUTE; /* CODE->EXECUTE */
+ styp_flags |= IMAGE_SCN_MEM_EXECUTE; /* CODE->EXECUTE. */
if (sec_flags & SEC_SHARED)
- styp_flags |= IMAGE_SCN_MEM_SHARED; /* Shared remains meaningful */
+ styp_flags |= IMAGE_SCN_MEM_SHARED; /* Shared remains meaningful. */
return styp_flags;
}
@@ -564,7 +586,7 @@ sec_to_styp_flags (sec_name, sec_flags)
#ifndef COFF_WITH_PE
-static boolean
+static bfd_boolean
styp_to_sec_flags (abfd, hdr, name, section, flags_ptr)
bfd *abfd ATTRIBUTE_UNUSED;
PTR hdr;
@@ -677,12 +699,12 @@ styp_to_sec_flags (abfd, hdr, name, section, flags_ptr)
else
sec_flags |= SEC_ALLOC | SEC_LOAD;
-#ifdef STYP_LIT /* A29k readonly text/data section type */
+#ifdef STYP_LIT /* A29k readonly text/data section type. */
if ((styp_flags & STYP_LIT) == STYP_LIT)
sec_flags = (SEC_LOAD | SEC_ALLOC | SEC_READONLY);
#endif /* STYP_LIT */
-#ifdef STYP_OTHER_LOAD /* Other loaded sections */
+#ifdef STYP_OTHER_LOAD /* Other loaded sections. */
if (styp_flags & STYP_OTHER_LOAD)
sec_flags = (SEC_LOAD | SEC_ALLOC);
#endif /* STYP_SDATA */
@@ -699,10 +721,10 @@ styp_to_sec_flags (abfd, hdr, name, section, flags_ptr)
#endif
if (flags_ptr == NULL)
- return false;
+ return FALSE;
* flags_ptr = sec_flags;
- return true;
+ return TRUE;
}
#else /* COFF_WITH_PE */
@@ -786,7 +808,7 @@ handle_COMDAT (abfd, sec_flags, hdr, name, section)
gas-generated, and look for <something> (whatever
follows the $) as the comdat symbol. */
- /* All 3 branches use this */
+ /* All 3 branches use this. */
symname = _bfd_coff_internal_syment_name (abfd, &isym, buf);
if (symname == NULL)
@@ -914,7 +936,7 @@ handle_COMDAT (abfd, sec_flags, hdr, name, section)
#ifndef TARGET_UNDERSCORE
#define TARGET_UNDERSCORE 0
#endif
- /* Is this the name we're looking for? */
+ /* Is this the name we're looking for ? */
if (strcmp (target_name,
symname + (TARGET_UNDERSCORE ? 1 : 0)) != 0)
{
@@ -973,7 +995,7 @@ handle_COMDAT (abfd, sec_flags, hdr, name, section)
required information. FIXME: Is the COMDAT symbol index used for
any purpose other than objdump? */
-static boolean
+static bfd_boolean
styp_to_sec_flags (abfd, hdr, name, section, flags_ptr)
bfd *abfd;
PTR hdr;
@@ -984,7 +1006,7 @@ styp_to_sec_flags (abfd, hdr, name, section, flags_ptr)
struct internal_scnhdr *internal_s = (struct internal_scnhdr *) hdr;
long styp_flags = internal_s->s_flags;
flagword sec_flags;
- boolean result = true;
+ bfd_boolean result = TRUE;
/* Assume read only unless IMAGE_SCN_MEM_WRITE is specified. */
sec_flags = SEC_READONLY;
@@ -1042,7 +1064,11 @@ styp_to_sec_flags (abfd, hdr, name, section, flags_ptr)
sec_flags &= ~ SEC_READONLY;
break;
case IMAGE_SCN_MEM_DISCARDABLE:
- sec_flags |= SEC_DEBUGGING;
+ /* The MS PE spec sets the DISCARDABLE flag on .reloc sections
+ but we do not want them to be labelled as debug section, since
+ then strip would remove them. */
+ if (strncmp (name, ".reloc", sizeof ".reloc" - 1) != 0)
+ sec_flags |= SEC_DEBUGGING;
break;
case IMAGE_SCN_MEM_SHARED:
sec_flags |= SEC_SHARED;
@@ -1085,7 +1111,7 @@ styp_to_sec_flags (abfd, hdr, name, section, flags_ptr)
(*_bfd_error_handler)
(_("%s (%s): Section flag %s (0x%x) ignored"),
bfd_archive_filename (abfd), name, unhandled, flag);
- result = false;
+ result = FALSE;
}
}
@@ -1173,10 +1199,10 @@ Special entry points for gdb to swap in coff symbol table parts:
. unsigned int _bfd_relsz;
. unsigned int _bfd_linesz;
. unsigned int _bfd_filnmlen;
-. boolean _bfd_coff_long_filenames;
-. boolean _bfd_coff_long_section_names;
+. bfd_boolean _bfd_coff_long_filenames;
+. bfd_boolean _bfd_coff_long_section_names;
. unsigned int _bfd_coff_default_section_alignment_power;
-. boolean _bfd_coff_force_symnames_in_strings;
+. bfd_boolean _bfd_coff_force_symnames_in_strings;
. unsigned int _bfd_coff_debug_string_prefix_length;
.
. void (*_bfd_coff_swap_filehdr_in)
@@ -1191,32 +1217,32 @@ Special entry points for gdb to swap in coff symbol table parts:
. void (*_bfd_coff_swap_reloc_in)
. PARAMS ((bfd *abfd, PTR, PTR));
.
-. boolean (*_bfd_coff_bad_format_hook)
+. bfd_boolean (*_bfd_coff_bad_format_hook)
. PARAMS ((bfd *, PTR));
.
-. boolean (*_bfd_coff_set_arch_mach_hook)
+. bfd_boolean (*_bfd_coff_set_arch_mach_hook)
. PARAMS ((bfd *, PTR));
.
. PTR (*_bfd_coff_mkobject_hook)
. PARAMS ((bfd *, PTR, PTR));
.
-. boolean (*_bfd_styp_to_sec_flags_hook)
+. bfd_boolean (*_bfd_styp_to_sec_flags_hook)
. PARAMS ((bfd *, PTR, const char *, asection *, flagword *));
.
. void (*_bfd_set_alignment_hook)
. PARAMS ((bfd *, asection *, PTR));
.
-. boolean (*_bfd_coff_slurp_symbol_table)
+. bfd_boolean (*_bfd_coff_slurp_symbol_table)
. PARAMS ((bfd *));
.
-. boolean (*_bfd_coff_symname_in_debug)
+. bfd_boolean (*_bfd_coff_symname_in_debug)
. PARAMS ((bfd *, struct internal_syment *));
.
-. boolean (*_bfd_coff_pointerize_aux_hook)
+. bfd_boolean (*_bfd_coff_pointerize_aux_hook)
. PARAMS ((bfd *, combined_entry_type *, combined_entry_type *,
. unsigned int, combined_entry_type *));
.
-. boolean (*_bfd_coff_print_aux)
+. bfd_boolean (*_bfd_coff_print_aux)
. PARAMS ((bfd *, FILE *, combined_entry_type *, combined_entry_type *,
. combined_entry_type *, unsigned int));
.
@@ -1231,13 +1257,13 @@ Special entry points for gdb to swap in coff symbol table parts:
. enum coff_symbol_classification (*_bfd_coff_classify_symbol)
. PARAMS ((bfd *, struct internal_syment *));
.
-. boolean (*_bfd_coff_compute_section_file_positions)
+. bfd_boolean (*_bfd_coff_compute_section_file_positions)
. PARAMS ((bfd *));
.
-. boolean (*_bfd_coff_start_final_link)
+. bfd_boolean (*_bfd_coff_start_final_link)
. PARAMS ((bfd *, struct bfd_link_info *));
.
-. boolean (*_bfd_coff_relocate_section)
+. bfd_boolean (*_bfd_coff_relocate_section)
. PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *,
. struct internal_reloc *, struct internal_syment *, asection **));
.
@@ -1246,19 +1272,19 @@ Special entry points for gdb to swap in coff symbol table parts:
. struct coff_link_hash_entry *, struct internal_syment *,
. bfd_vma *));
.
-. boolean (*_bfd_coff_adjust_symndx)
+. bfd_boolean (*_bfd_coff_adjust_symndx)
. PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *,
-. struct internal_reloc *, boolean *));
+. struct internal_reloc *, bfd_boolean *));
.
-. boolean (*_bfd_coff_link_add_one_symbol)
+. bfd_boolean (*_bfd_coff_link_add_one_symbol)
. PARAMS ((struct bfd_link_info *, bfd *, const char *, flagword,
-. asection *, bfd_vma, const char *, boolean, boolean,
+. asection *, bfd_vma, const char *, bfd_boolean, bfd_boolean,
. struct bfd_link_hash_entry **));
.
-. boolean (*_bfd_coff_link_output_has_begun)
+. bfd_boolean (*_bfd_coff_link_output_has_begun)
. PARAMS ((bfd *, struct coff_final_link_info *));
.
-. boolean (*_bfd_coff_final_link_postscript)
+. bfd_boolean (*_bfd_coff_final_link_postscript)
. PARAMS ((bfd *, struct coff_final_link_info *));
.
.} bfd_coff_backend_data;
@@ -1328,7 +1354,8 @@ Special entry points for gdb to swap in coff symbol table parts:
.#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))
+. ((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)\
@@ -1353,7 +1380,8 @@ Special entry points for gdb to swap in coff symbol table parts:
. ((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)\
+.#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))
.
@@ -1381,7 +1409,8 @@ Special entry points for gdb to swap in coff symbol table parts:
.#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)\
+.#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))
.
@@ -1394,7 +1423,7 @@ Special entry points for gdb to swap in coff symbol table parts:
/* See whether the magic number matches. */
-static boolean
+static bfd_boolean
coff_bad_format_hook (abfd, filehdr)
bfd * abfd ATTRIBUTE_UNUSED;
PTR filehdr;
@@ -1402,24 +1431,53 @@ coff_bad_format_hook (abfd, filehdr)
struct internal_filehdr *internal_f = (struct internal_filehdr *) filehdr;
if (BADMAG (*internal_f))
- return false;
+ return FALSE;
- /* if the optional header is NULL or not the correct size then
+ /* If the optional header is NULL or not the correct size then
quit; the only difference I can see between m88k dgux headers (MC88DMAGIC)
and Intel 960 readwrite headers (I960WRMAGIC) is that the
optional header is of a different size.
But the mips keeps extra stuff in it's opthdr, so dont check
- when doing that
- */
+ when doing that. */
#if defined(M88) || defined(I960)
if (internal_f->f_opthdr != 0 && bfd_coff_aoutsz (abfd) != internal_f->f_opthdr)
- return false;
+ return FALSE;
+#endif
+
+ return TRUE;
+}
+
+#ifdef TICOFF
+static bfd_boolean
+ticoff0_bad_format_hook (abfd, filehdr)
+ bfd *abfd ATTRIBUTE_UNUSED;
+ PTR filehdr;
+{
+ struct internal_filehdr *internal_f = (struct internal_filehdr *) filehdr;
+
+ if (COFF0_BADMAG (*internal_f))
+ return FALSE;
+
+ return TRUE;
+}
#endif
- return true;
+#ifdef TICOFF
+static bfd_boolean
+ticoff1_bad_format_hook (abfd, filehdr)
+ bfd *abfd ATTRIBUTE_UNUSED;
+ PTR filehdr;
+{
+ struct internal_filehdr *internal_f = (struct internal_filehdr *) filehdr;
+
+ if (COFF1_BADMAG (*internal_f))
+ return FALSE;
+
+ return TRUE;
}
+#endif
/* Check whether this section uses an alignment other than the
default. */
@@ -1437,6 +1495,7 @@ coff_set_custom_section_alignment (abfd, section, alignment_table, table_size)
for (i = 0; i < table_size; ++i)
{
const char *secname = bfd_get_section_name (abfd, section);
+
if (alignment_table[i].comparison_length == (unsigned int) -1
? strcmp (alignment_table[i].name, secname) == 0
: strncmp (alignment_table[i].name, secname,
@@ -1487,7 +1546,7 @@ static const unsigned int coff_section_alignment_table_size =
/* Initialize a section structure with information peculiar to this
particular implementation of COFF. */
-static boolean
+static bfd_boolean
coff_new_section_hook (abfd, section)
bfd * abfd;
asection * section;
@@ -1514,10 +1573,10 @@ coff_new_section_hook (abfd, section)
amt = sizeof (combined_entry_type) * 10;
native = (combined_entry_type *) bfd_zalloc (abfd, amt);
if (native == NULL)
- return false;
+ return FALSE;
/* We don't need to set up n_name, n_value, or n_scnum in the native
- symbol information, since they'll be overriden by the BFD symbol
+ symbol information, since they'll be overridden by the BFD symbol
anyhow. However, we do need to set the type and storage class,
in case this symbol winds up getting written out. The value 0
for n_numaux is already correct. */
@@ -1531,7 +1590,7 @@ coff_new_section_hook (abfd, section)
coff_section_alignment_table,
coff_section_alignment_table_size);
- return true;
+ return TRUE;
}
#ifdef COFF_ALIGN_IN_SECTION_HEADER
@@ -1550,13 +1609,13 @@ coff_set_alignment_hook (abfd, section, scnhdr)
unsigned int i;
#ifdef I960
- /* Extract ALIGN from 2**ALIGN stored in section header */
+ /* Extract ALIGN from 2**ALIGN stored in section header. */
for (i = 0; i < 32; i++)
if ((1 << i) >= hdr->s_align)
break;
#endif
#ifdef TIC80COFF
- /* TI tools puts the alignment power in bits 8-11 */
+ /* TI tools puts the alignment power in bits 8-11. */
i = (hdr->s_flags >> 8) & 0xF ;
#endif
#ifdef COFF_DECODE_ALIGNMENT
@@ -1572,7 +1631,7 @@ coff_set_alignment_hook (abfd, section, scnhdr)
#else /* ! COFF_ALIGN_IN_SECTION_HEADER */
#ifdef COFF_WITH_PE
-/* a couple of macros to help setting the alignment power field */
+/* A couple of macros to help setting the alignment power field. */
#define ALIGN_SET(field,x,y) \
if (((field) & IMAGE_SCN_ALIGN_64BYTES) == x )\
{\
@@ -1633,21 +1692,27 @@ coff_set_alignment_hook (abfd, section, scnhdr)
section->lma = hdr->s_vaddr;
- /* check for extended relocs */
+ /* Check for extended relocs. */
if (hdr->s_flags & IMAGE_SCN_LNK_NRELOC_OVFL)
{
struct external_reloc dst;
struct internal_reloc n;
file_ptr oldpos = bfd_tell (abfd);
+ bfd_size_type relsz = bfd_coff_relsz (abfd);
+
bfd_seek (abfd, (file_ptr) hdr->s_relptr, 0);
- if (bfd_bread ((PTR) &dst, (bfd_size_type) bfd_coff_relsz (abfd), abfd)
- != bfd_coff_relsz (abfd))
+ if (bfd_bread ((PTR) &dst, relsz, abfd) != relsz)
return;
coff_swap_reloc_in (abfd, &dst, &n);
bfd_seek (abfd, oldpos, 0);
- section->reloc_count = hdr->s_nreloc = n.r_vaddr;
+ section->reloc_count = hdr->s_nreloc = n.r_vaddr - 1;
+ section->rel_filepos += relsz;
}
+ else if (hdr->s_nreloc == 0xffff)
+ (*_bfd_error_handler)
+ ("%s: warning: claims to have 0xffff relocs, without overflow",
+ bfd_get_filename (abfd));
}
#undef ALIGN_SET
#undef ELIFALIGN_SET
@@ -1703,9 +1768,9 @@ coff_set_alignment_hook (abfd, section, scnhdr)
#ifndef coff_mkobject
-static boolean coff_mkobject PARAMS ((bfd *));
+static bfd_boolean coff_mkobject PARAMS ((bfd *));
-static boolean
+static bfd_boolean
coff_mkobject (abfd)
bfd * abfd;
{
@@ -1714,7 +1779,7 @@ coff_mkobject (abfd)
abfd->tdata.coff_obj_data = (struct coff_tdata *) bfd_zalloc (abfd, amt);
if (abfd->tdata.coff_obj_data == 0)
- return false;
+ return FALSE;
coff = coff_data (abfd);
coff->symbols = (coff_symbol_type *) NULL;
coff->conversion_table = (unsigned int *) NULL;
@@ -1724,11 +1789,12 @@ coff_mkobject (abfd)
/* make_abs_section(abfd);*/
- return true;
+ return TRUE;
}
#endif
/* Create the COFF backend specific information. */
+
#ifndef coff_mkobject_hook
static PTR
coff_mkobject_hook (abfd, filehdr, aouthdr)
@@ -1778,7 +1844,7 @@ coff_mkobject_hook (abfd, filehdr, aouthdr)
# else
xcoff->xcoff64 = 0;
# endif
- xcoff->full_aouthdr = true;
+ xcoff->full_aouthdr = TRUE;
xcoff->toc = internal_a->o_toc;
xcoff->sntoc = internal_a->o_sntoc;
xcoff->snentry = internal_a->o_snentry;
@@ -1815,7 +1881,7 @@ coff_mkobject_hook (abfd, filehdr, aouthdr)
would be target independent and would also be much more successful
at linking together COFF files for different architectures. */
-static boolean
+static bfd_boolean
coff_set_arch_mach_hook (abfd, filehdr)
bfd *abfd;
PTR filehdr;
@@ -1824,6 +1890,7 @@ coff_set_arch_mach_hook (abfd, filehdr)
enum bfd_architecture arch;
struct internal_filehdr *internal_f = (struct internal_filehdr *) filehdr;
+ /* Zero selects the default machine for an arch. */
machine = 0;
switch (internal_f->f_magic)
{
@@ -1831,13 +1898,11 @@ coff_set_arch_mach_hook (abfd, filehdr)
case OR32_MAGIC_BIG:
case OR32_MAGIC_LITTLE:
arch = bfd_arch_or32;
- machine = 0;
break;
#endif
#ifdef PPCMAGIC
case PPCMAGIC:
arch = bfd_arch_powerpc;
- machine = 0; /* what does this mean? (krk) */
break;
#endif
#ifdef I386MAGIC
@@ -1846,20 +1911,17 @@ coff_set_arch_mach_hook (abfd, filehdr)
case I386AIXMAGIC: /* Danbury PS/2 AIX C Compiler */
case LYNXCOFFMAGIC: /* shadows the m68k Lynx number below, sigh */
arch = bfd_arch_i386;
- machine = 0;
break;
#endif
#ifdef IA64MAGIC
case IA64MAGIC:
arch = bfd_arch_ia64;
- machine = 0;
break;
#endif
#ifdef A29K_MAGIC_BIG
case A29K_MAGIC_BIG:
case A29K_MAGIC_LITTLE:
arch = bfd_arch_a29k;
- machine = 0;
break;
#endif
#ifdef ARMMAGIC
@@ -1867,21 +1929,25 @@ coff_set_arch_mach_hook (abfd, filehdr)
case ARMPEMAGIC:
case THUMBPEMAGIC:
arch = bfd_arch_arm;
- switch (internal_f->f_flags & F_ARM_ARCHITECTURE_MASK)
+ machine = bfd_arm_get_mach_from_notes (abfd, ARM_NOTE_SECTION);
+ if (machine == bfd_mach_arm_unknown)
{
- case F_ARM_2: machine = bfd_mach_arm_2; break;
- case F_ARM_2a: machine = bfd_mach_arm_2a; break;
- case F_ARM_3: machine = bfd_mach_arm_3; break;
- default:
- case F_ARM_3M: machine = bfd_mach_arm_3M; break;
- case F_ARM_4: machine = bfd_mach_arm_4; break;
- case F_ARM_4T: machine = bfd_mach_arm_4T; break;
- /* The COFF header does not have enough bits available
- to cover all the different ARM architectures. So
- we interpret F_ARM_5, the highest flag value to mean
- "the highest ARM architecture known to BFD" which is
- currently the XScale. */
- case F_ARM_5: machine = bfd_mach_arm_XScale; break;
+ switch (internal_f->f_flags & F_ARM_ARCHITECTURE_MASK)
+ {
+ case F_ARM_2: machine = bfd_mach_arm_2; break;
+ case F_ARM_2a: machine = bfd_mach_arm_2a; break;
+ case F_ARM_3: machine = bfd_mach_arm_3; break;
+ default:
+ case F_ARM_3M: machine = bfd_mach_arm_3M; break;
+ case F_ARM_4: machine = bfd_mach_arm_4; break;
+ case F_ARM_4T: machine = bfd_mach_arm_4T; break;
+ /* The COFF header does not have enough bits available
+ to cover all the different ARM architectures. So
+ we interpret F_ARM_5, the highest flag value to mean
+ "the highest ARM architecture known to BFD" which is
+ currently the XScale. */
+ case F_ARM_5: machine = bfd_mach_arm_XScale; break;
+ }
}
break;
#endif
@@ -1921,7 +1987,7 @@ coff_set_arch_mach_hook (abfd, filehdr)
machine = bfd_mach_z8002;
break;
default:
- return false;
+ return FALSE;
}
break;
#endif
@@ -2000,7 +2066,7 @@ coff_set_arch_mach_hook (abfd, filehdr)
|| bfd_bread (buf, amt, abfd) != amt)
{
free (buf);
- return false;
+ return FALSE;
}
bfd_coff_swap_sym_in (abfd, (PTR) buf, (PTR) &sym);
if (sym.n_sclass == C_FILE)
@@ -2044,7 +2110,6 @@ coff_set_arch_mach_hook (abfd, filehdr)
#ifdef WE32KMAGIC
case WE32KMAGIC:
arch = bfd_arch_we32k;
- machine = 0;
break;
#endif
@@ -2052,7 +2117,7 @@ coff_set_arch_mach_hook (abfd, filehdr)
case H8300MAGIC:
arch = bfd_arch_h8300;
machine = bfd_mach_h8300;
- /* !! FIXME this probably isn't the right place for this */
+ /* !! FIXME this probably isn't the right place for this. */
abfd->flags |= BFD_IS_RELAXABLE;
break;
#endif
@@ -2061,7 +2126,7 @@ coff_set_arch_mach_hook (abfd, filehdr)
case H8300HMAGIC:
arch = bfd_arch_h8300;
machine = bfd_mach_h8300h;
- /* !! FIXME this probably isn't the right place for this */
+ /* !! FIXME this probably isn't the right place for this. */
abfd->flags |= BFD_IS_RELAXABLE;
break;
#endif
@@ -2070,7 +2135,25 @@ coff_set_arch_mach_hook (abfd, filehdr)
case H8300SMAGIC:
arch = bfd_arch_h8300;
machine = bfd_mach_h8300s;
- /* !! FIXME this probably isn't the right place for this */
+ /* !! FIXME this probably isn't the right place for this. */
+ abfd->flags |= BFD_IS_RELAXABLE;
+ break;
+#endif
+
+#ifdef H8300HNMAGIC
+ case H8300HNMAGIC:
+ arch = bfd_arch_h8300;
+ machine = bfd_mach_h8300hn;
+ /* !! FIXME this probably isn't the right place for this. */
+ abfd->flags |= BFD_IS_RELAXABLE;
+ break;
+#endif
+
+#ifdef H8300SNMAGIC
+ case H8300SNMAGIC:
+ arch = bfd_arch_h8300;
+ machine = bfd_mach_h8300sn;
+ /* !! FIXME this probably isn't the right place for this. */
abfd->flags |= BFD_IS_RELAXABLE;
break;
#endif
@@ -2082,21 +2165,18 @@ coff_set_arch_mach_hook (abfd, filehdr)
case SH_ARCH_MAGIC_WINCE:
#endif
arch = bfd_arch_sh;
- machine = 0;
break;
#endif
#ifdef MIPS_ARCH_MAGIC_WINCE
case MIPS_ARCH_MAGIC_WINCE:
arch = bfd_arch_mips;
- machine = 0;
break;
#endif
#ifdef H8500MAGIC
case H8500MAGIC:
arch = bfd_arch_h8500;
- machine = 0;
break;
#endif
@@ -2106,7 +2186,6 @@ coff_set_arch_mach_hook (abfd, filehdr)
case LYNXCOFFMAGIC:
#endif
arch = bfd_arch_sparc;
- machine = 0;
break;
#endif
@@ -2118,16 +2197,17 @@ coff_set_arch_mach_hook (abfd, filehdr)
#ifdef TICOFF0MAGIC
#ifdef TICOFF_TARGET_ARCH
- /* this TI COFF section should be used by all new TI COFF v0 targets */
+ /* This TI COFF section should be used by all new TI COFF v0 targets. */
case TICOFF0MAGIC:
arch = TICOFF_TARGET_ARCH;
+ machine = TICOFF_TARGET_MACHINE_GET (internal_f->f_flags);
break;
#endif
#endif
#ifdef TICOFF1MAGIC
- /* this TI COFF section should be used by all new TI COFF v1/2 targets */
- /* TI COFF1 and COFF2 use the target_id field to specify which arch */
+ /* This TI COFF section should be used by all new TI COFF v1/2 targets. */
+ /* TI COFF1 and COFF2 use the target_id field to specify which arch. */
case TICOFF1MAGIC:
case TICOFF2MAGIC:
switch (internal_f->f_target_id)
@@ -2135,6 +2215,7 @@ coff_set_arch_mach_hook (abfd, filehdr)
#ifdef TI_TARGET_ID
case TI_TARGET_ID:
arch = TICOFF_TARGET_ARCH;
+ machine = TICOFF_TARGET_MACHINE_GET (internal_f->f_flags);
break;
#endif
default:
@@ -2165,21 +2246,21 @@ coff_set_arch_mach_hook (abfd, filehdr)
break;
#endif
- default: /* Unreadable input file type */
+ default: /* Unreadable input file type. */
arch = bfd_arch_obscure;
break;
}
bfd_default_set_arch_mach (abfd, arch, machine);
- return true;
+ return TRUE;
}
#ifdef SYMNAME_IN_DEBUG
-static boolean symname_in_debug_hook
+static bfd_boolean symname_in_debug_hook
PARAMS ((bfd *, struct internal_syment *));
-static boolean
+static bfd_boolean
symname_in_debug_hook (abfd, sym)
bfd * abfd ATTRIBUTE_UNUSED;
struct internal_syment *sym;
@@ -2190,7 +2271,7 @@ symname_in_debug_hook (abfd, sym)
#else
#define symname_in_debug_hook \
- (boolean (*) PARAMS ((bfd *, struct internal_syment *))) bfd_false
+ (bfd_boolean (*) PARAMS ((bfd *, struct internal_syment *))) bfd_false
#endif
@@ -2202,12 +2283,11 @@ symname_in_debug_hook (abfd, sym)
/* Handle the csect auxent of a C_EXT or C_HIDEXT symbol. */
-static boolean coff_pointerize_aux_hook
+static bfd_boolean coff_pointerize_aux_hook
PARAMS ((bfd *, combined_entry_type *, combined_entry_type *,
unsigned int, combined_entry_type *));
-/*ARGSUSED*/
-static boolean
+static bfd_boolean
coff_pointerize_aux_hook (abfd, table_base, symbol, indaux, aux)
bfd *abfd ATTRIBUTE_UNUSED;
combined_entry_type *table_base;
@@ -2227,14 +2307,14 @@ coff_pointerize_aux_hook (abfd, table_base, symbol, indaux, aux)
aux->fix_scnlen = 1;
}
- /* Return true to indicate that the caller should not do any
+ /* Return TRUE to indicate that the caller should not do any
further work on this auxent. */
- return true;
+ return TRUE;
}
- /* Return false to indicate that this auxent should be handled by
+ /* Return FALSE to indicate that this auxent should be handled by
the caller. */
- return false;
+ return FALSE;
}
#else
@@ -2242,12 +2322,11 @@ coff_pointerize_aux_hook (abfd, table_base, symbol, indaux, aux)
/* We don't want to pointerize bal entries. */
-static boolean coff_pointerize_aux_hook
+static bfd_boolean coff_pointerize_aux_hook
PARAMS ((bfd *, combined_entry_type *, combined_entry_type *,
unsigned int, combined_entry_type *));
-/*ARGSUSED*/
-static boolean
+static bfd_boolean
coff_pointerize_aux_hook (abfd, table_base, symbol, indaux, aux)
bfd *abfd ATTRIBUTE_UNUSED;
combined_entry_type *table_base ATTRIBUTE_UNUSED;
@@ -2255,7 +2334,7 @@ coff_pointerize_aux_hook (abfd, table_base, symbol, indaux, aux)
unsigned int indaux;
combined_entry_type *aux ATTRIBUTE_UNUSED;
{
- /* Return true if we don't want to pointerize this aux entry, which
+ /* Return TRUE if we don't want to pointerize this aux entry, which
is the case for the lastfirst aux entry for a C_LEAFPROC symbol. */
return (indaux == 1
&& (symbol->u.syment.n_sclass == C_LEAFPROC
@@ -2270,13 +2349,13 @@ coff_pointerize_aux_hook (abfd, table_base, symbol, indaux, aux)
#endif /* ! I960 */
#endif /* ! RS6000COFF_C */
-/* Print an aux entry. This returns true if it has printed it. */
+/* Print an aux entry. This returns TRUE if it has printed it. */
-static boolean coff_print_aux
+static bfd_boolean coff_print_aux
PARAMS ((bfd *, FILE *, combined_entry_type *, combined_entry_type *,
combined_entry_type *, unsigned int));
-static boolean
+static bfd_boolean
coff_print_aux (abfd, file, table_base, symbol, aux, indaux)
bfd *abfd ATTRIBUTE_UNUSED;
FILE *file ATTRIBUTE_UNUSED;
@@ -2323,12 +2402,12 @@ coff_print_aux (abfd, file, table_base, symbol, aux, indaux)
(unsigned int) aux->u.auxent.x_csect.x_smclas,
aux->u.auxent.x_csect.x_stab,
(unsigned int) aux->u.auxent.x_csect.x_snstab);
- return true;
+ return TRUE;
}
#endif
- /* Return false to indicate that no special action was taken. */
- return false;
+ /* Return FALSE to indicate that no special action was taken. */
+ return FALSE;
}
/*
@@ -2351,7 +2430,7 @@ SUBSUBSECTION
static int compare_arelent_ptr PARAMS ((const PTR, const PTR));
-/* AUX's ld wants relocations to be sorted */
+/* AUX's ld wants relocations to be sorted. */
static int
compare_arelent_ptr (x, y)
const PTR x;
@@ -2367,7 +2446,7 @@ compare_arelent_ptr (x, y)
#endif /* TARG_AUX */
-static boolean
+static bfd_boolean
coff_write_relocs (abfd, first_undef)
bfd * abfd;
int first_undef;
@@ -2384,34 +2463,35 @@ coff_write_relocs (abfd, first_undef)
p = s->orelocation;
#else
{
- /* sort relocations before we write them out */
+ /* Sort relocations before we write them out. */
bfd_size_type amt;
amt = s->reloc_count;
amt *= sizeof (arelent *);
p = (arelent **) bfd_malloc (amt);
if (p == NULL && s->reloc_count > 0)
- return false;
+ return FALSE;
memcpy (p, s->orelocation, (size_t) amt);
qsort (p, s->reloc_count, sizeof (arelent *), compare_arelent_ptr);
}
#endif
if (bfd_seek (abfd, s->rel_filepos, SEEK_SET) != 0)
- return false;
+ return FALSE;
#ifdef COFF_WITH_PE
if (obj_pe (abfd) && s->reloc_count >= 0xffff)
{
- /* encode real count here as first reloc */
+ /* Encode real count here as first reloc. */
struct internal_reloc n;
+
memset ((PTR) & n, 0, sizeof (n));
- /* add one to count *this* reloc (grr) */
+ /* Add one to count *this* reloc (grr). */
n.r_vaddr = s->reloc_count + 1;
coff_swap_reloc_out (abfd, &n, &dst);
if (bfd_bwrite ((PTR) & dst, (bfd_size_type) bfd_coff_relsz (abfd),
abfd) != bfd_coff_relsz (abfd))
- return false;
+ return FALSE;
}
#endif
@@ -2419,6 +2499,7 @@ coff_write_relocs (abfd, first_undef)
{
struct internal_reloc n;
arelent *q = p[i];
+
memset ((PTR) & n, 0, sizeof (n));
/* Now we've renumbered the symbols we know where the
@@ -2436,11 +2517,13 @@ coff_write_relocs (abfd, first_undef)
int j;
const char *sname = q->sym_ptr_ptr[0]->name;
asymbol **outsyms = abfd->outsymbols;
+
for (j = first_undef; outsyms[j]; j++)
{
const char *intable = outsyms[j]->name;
+
if (strcmp (intable, sname) == 0) {
- /* got a hit, so repoint the reloc */
+ /* Got a hit, so repoint the reloc. */
q->sym_ptr_ptr = outsyms + j;
break;
}
@@ -2462,7 +2545,8 @@ coff_write_relocs (abfd, first_undef)
#ifdef SECTION_RELATIVE_ABSOLUTE_SYMBOL_P
if (SECTION_RELATIVE_ABSOLUTE_SYMBOL_P (q,s))
#else
- if (q->sym_ptr_ptr == bfd_abs_section_ptr->symbol_ptr_ptr)
+ if ((*q->sym_ptr_ptr)->section == bfd_abs_section_ptr
+ && ((*q->sym_ptr_ptr)->flags & BSF_SECTION_SYM) != 0)
#endif
/* This is a relocation relative to the absolute symbol. */
n.r_symndx = -1;
@@ -2482,15 +2566,16 @@ coff_write_relocs (abfd, first_undef)
#endif
#ifdef SELECT_RELOC
- /* Work out reloc type from what is required */
+ /* Work out reloc type from what is required. */
SELECT_RELOC (n, q->howto);
#else
n.r_type = q->howto->type;
#endif
coff_swap_reloc_out (abfd, &n, &dst);
+
if (bfd_bwrite ((PTR) & dst, (bfd_size_type) bfd_coff_relsz (abfd),
abfd) != bfd_coff_relsz (abfd))
- return false;
+ return FALSE;
}
#ifdef TARG_AUX
@@ -2499,13 +2584,13 @@ coff_write_relocs (abfd, first_undef)
#endif
}
- return true;
+ return TRUE;
}
/* Set flags and magic number of a coff file from architecture and machine
- type. Result is true if we can represent the arch&type, false if not. */
+ type. Result is TRUE if we can represent the arch&type, FALSE if not. */
-static boolean
+static bfd_boolean
coff_set_flags (abfd, magicp, flagsp)
bfd * abfd;
unsigned int *magicp ATTRIBUTE_UNUSED;
@@ -2525,9 +2610,9 @@ coff_set_flags (abfd, magicp, flagsp)
*flagsp = F_Z8002;
break;
default:
- return false;
+ return FALSE;
}
- return true;
+ return TRUE;
#endif
#ifdef I960ROMAGIC
@@ -2567,10 +2652,10 @@ coff_set_flags (abfd, magicp, flagsp)
flags = F_I960HX;
break;
default:
- return false;
+ return FALSE;
}
*flagsp = flags;
- return true;
+ return TRUE;
}
break;
#endif
@@ -2578,17 +2663,17 @@ coff_set_flags (abfd, magicp, flagsp)
#ifdef TIC30MAGIC
case bfd_arch_tic30:
*magicp = TIC30MAGIC;
- return true;
+ return TRUE;
#endif
#ifdef TICOFF_DEFAULT_MAGIC
case TICOFF_TARGET_ARCH:
- /* if there's no indication of which version we want, use the default */
+ /* If there's no indication of which version we want, use the default. */
if (!abfd->xvec )
*magicp = TICOFF_DEFAULT_MAGIC;
else
{
- /* we may want to output in a different COFF version */
+ /* We may want to output in a different COFF version. */
switch (abfd->xvec->name[4])
{
case '0':
@@ -2601,16 +2686,17 @@ coff_set_flags (abfd, magicp, flagsp)
*magicp = TICOFF2MAGIC;
break;
default:
- return false;
+ return FALSE;
}
}
- return true;
+ TICOFF_TARGET_MACHINE_SET (flagsp, bfd_get_mach (abfd));
+ return TRUE;
#endif
#ifdef TIC80_ARCH_MAGIC
case bfd_arch_tic80:
*magicp = TIC80_ARCH_MAGIC;
- return true;
+ return TRUE;
#endif
#ifdef ARMMAGIC
case bfd_arch_arm:
@@ -2648,12 +2734,12 @@ coff_set_flags (abfd, magicp, flagsp)
case bfd_mach_arm_5TE: * flagsp |= F_ARM_5; break;
case bfd_mach_arm_XScale: * flagsp |= F_ARM_5; break;
}
- return true;
+ return TRUE;
#endif
#ifdef PPCMAGIC
case bfd_arch_powerpc:
*magicp = PPCMAGIC;
- return true;
+ return TRUE;
break;
#endif
#ifdef I386MAGIC
@@ -2663,19 +2749,19 @@ coff_set_flags (abfd, magicp, flagsp)
/* Just overwrite the usual value if we're doing Lynx. */
*magicp = LYNXCOFFMAGIC;
#endif
- return true;
+ return TRUE;
break;
#endif
#ifdef I860MAGIC
case bfd_arch_i860:
*magicp = I860MAGIC;
- return true;
+ return TRUE;
break;
#endif
#ifdef IA64MAGIC
case bfd_arch_ia64:
*magicp = IA64MAGIC;
- return true;
+ return TRUE;
break;
#endif
#ifdef MC68MAGIC
@@ -2694,14 +2780,14 @@ coff_set_flags (abfd, magicp, flagsp)
/* Just overwrite the usual value if we're doing Lynx. */
*magicp = LYNXCOFFMAGIC;
#endif
- return true;
+ return TRUE;
break;
#endif
#ifdef MC88MAGIC
case bfd_arch_m88k:
*magicp = MC88OMAGIC;
- return true;
+ return TRUE;
break;
#endif
#ifdef H8300MAGIC
@@ -2710,13 +2796,19 @@ coff_set_flags (abfd, magicp, flagsp)
{
case bfd_mach_h8300:
*magicp = H8300MAGIC;
- return true;
+ return TRUE;
case bfd_mach_h8300h:
*magicp = H8300HMAGIC;
- return true;
+ return TRUE;
case bfd_mach_h8300s:
*magicp = H8300SMAGIC;
- return true;
+ return TRUE;
+ case bfd_mach_h8300hn:
+ *magicp = H8300HNMAGIC;
+ return TRUE;
+ case bfd_mach_h8300sn:
+ *magicp = H8300SNMAGIC;
+ return TRUE;
}
break;
#endif
@@ -2731,14 +2823,14 @@ coff_set_flags (abfd, magicp, flagsp)
else
*magicp = SH_ARCH_MAGIC_LITTLE;
#endif
- return true;
+ return TRUE;
break;
#endif
#ifdef MIPS_ARCH_MAGIC_WINCE
case bfd_arch_mips:
*magicp = MIPS_ARCH_MAGIC_WINCE;
- return true;
+ return TRUE;
break;
#endif
@@ -2749,14 +2841,14 @@ coff_set_flags (abfd, magicp, flagsp)
/* Just overwrite the usual value if we're doing Lynx. */
*magicp = LYNXCOFFMAGIC;
#endif
- return true;
+ return TRUE;
break;
#endif
#ifdef H8500MAGIC
case bfd_arch_h8500:
*magicp = H8500MAGIC;
- return true;
+ return TRUE;
break;
#endif
#ifdef A29K_MAGIC_BIG
@@ -2765,14 +2857,14 @@ coff_set_flags (abfd, magicp, flagsp)
*magicp = A29K_MAGIC_BIG;
else
*magicp = A29K_MAGIC_LITTLE;
- return true;
+ return TRUE;
break;
#endif
#ifdef WE32KMAGIC
case bfd_arch_we32k:
*magicp = WE32KMAGIC;
- return true;
+ return TRUE;
break;
#endif
@@ -2783,20 +2875,20 @@ coff_set_flags (abfd, magicp, flagsp)
#endif
BFD_ASSERT (bfd_get_flavour (abfd) == bfd_target_xcoff_flavour);
*magicp = bfd_xcoff_magic_number (abfd);
- return true;
+ return TRUE;
break;
#endif
#ifdef MCOREMAGIC
case bfd_arch_mcore:
* magicp = MCOREMAGIC;
- return true;
+ return TRUE;
#endif
#ifdef W65MAGIC
case bfd_arch_w65:
*magicp = W65MAGIC;
- return true;
+ return TRUE;
#endif
#ifdef OR32_MAGIC_BIG
@@ -2805,19 +2897,19 @@ coff_set_flags (abfd, magicp, flagsp)
* magicp = OR32_MAGIC_BIG;
else
* magicp = OR32_MAGIC_LITTLE;
- return true;
+ return TRUE;
#endif
default: /* Unknown architecture. */
- /* Fall through to "return false" below, to avoid
+ /* Fall through to "return FALSE" below, to avoid
"statement never reached" errors on the one below. */
break;
}
- return false;
+ return FALSE;
}
-static boolean
+static bfd_boolean
coff_set_arch_mach (abfd, arch, machine)
bfd * abfd;
enum bfd_architecture arch;
@@ -2827,13 +2919,13 @@ coff_set_arch_mach (abfd, arch, machine)
unsigned short dummy2;
if (! bfd_default_set_arch_mach (abfd, arch, machine))
- return false;
+ return FALSE;
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
@@ -2870,14 +2962,14 @@ sort_by_secaddr (arg1, arg2)
#undef ALIGN_SECTIONS_IN_FILE
#endif
-static boolean
+static bfd_boolean
coff_compute_section_file_positions (abfd)
bfd * abfd;
{
asection *current;
asection *previous = (asection *) NULL;
file_ptr sofar = bfd_coff_filhsz (abfd);
- boolean align_adjust;
+ bfd_boolean align_adjust;
#ifdef ALIGN_SECTIONS_IN_FILE
file_ptr old_sofar;
#endif
@@ -2926,6 +3018,11 @@ coff_compute_section_file_positions (abfd)
if (coff_data (abfd)->link_info)
{
page_size = pe_data (abfd)->pe_opthdr.FileAlignment;
+
+ /* If no file alignment has been set, default to one.
+ This repairs 'ld -r' for arm-wince-pe target. */
+ if (page_size == 0)
+ page_size = 1;
}
else
page_size = PE_DEF_FILE_ALIGNMENT;
@@ -2983,7 +3080,7 @@ coff_compute_section_file_positions (abfd)
amt = sizeof (struct asection *) * (count + 1);
section_list = bfd_malloc (amt);
if (section_list == NULL)
- return false;
+ return FALSE;
i = 0;
for (current = abfd->sections; current != NULL; current = current->next)
@@ -3036,7 +3133,7 @@ coff_compute_section_file_positions (abfd)
}
#endif /* ! COFF_IMAGE_WITH_PE */
- align_adjust = false;
+ align_adjust = FALSE;
for (current = abfd->sections;
current != (asection *) NULL;
current = current->next)
@@ -3049,7 +3146,7 @@ coff_compute_section_file_positions (abfd)
bfd_size_type amt = sizeof (struct coff_section_tdata);
current->used_by_bfd = (PTR) bfd_zalloc (abfd, amt);
if (current->used_by_bfd == NULL)
- return false;
+ return FALSE;
}
if (pei_section_data (abfd, current) == NULL)
{
@@ -3057,7 +3154,7 @@ coff_compute_section_file_positions (abfd)
coff_section_data (abfd, current)->tdata
= (PTR) bfd_zalloc (abfd, amt);
if (coff_section_data (abfd, current)->tdata == NULL)
- return false;
+ return FALSE;
}
if (pei_section_data (abfd, current)->virt_size == 0)
pei_section_data (abfd, current)->virt_size = current->_raw_size;
@@ -3080,21 +3177,21 @@ coff_compute_section_file_positions (abfd)
#ifdef ALIGN_SECTIONS_IN_FILE
if ((abfd->flags & EXEC_P) != 0)
{
- /* make sure this section is aligned on the right boundary - by
- padding the previous section up if necessary */
+ /* Make sure this section is aligned on the right boundary - by
+ padding the previous section up if necessary. */
old_sofar = sofar;
#ifdef RS6000COFF_C
/* AIX loader checks the text section alignment of (vma - filepos)
So even though the filepos may be aligned wrt the o_algntext, for
- AIX executables, this check fails. This shows up when an native
+ AIX executables, this check fails. This shows up when a native
AIX executable is stripped with gnu strip because the default vma
of native is 0x10000150 but default for gnu is 0x10000140. Gnu
- stripped gnu excutable passes this check because the filepos is
+ stripped gnu excutable passes this check because the filepos is
0x0140. This problem also show up with 64 bit shared objects. The
data section must also be aligned. */
- if (!strcmp (current->name, _TEXT)
- || !strcmp (current->name, _DATA))
+ if (!strcmp (current->name, _TEXT)
+ || !strcmp (current->name, _DATA))
{
bfd_vma pad;
bfd_vma align;
@@ -3103,8 +3200,8 @@ coff_compute_section_file_positions (abfd)
align = 1 << current->alignment_power;
pad = abs (current->vma - sofar) % align;
-
- if (pad)
+
+ if (pad)
{
pad = align - pad;
sofar += pad;
@@ -3117,9 +3214,7 @@ coff_compute_section_file_positions (abfd)
}
#endif
if (previous != (asection *) NULL)
- {
- previous->_raw_size += sofar - old_sofar;
- }
+ previous->_raw_size += sofar - old_sofar;
}
#endif
@@ -3141,7 +3236,7 @@ coff_compute_section_file_positions (abfd)
sofar += current->_raw_size;
#ifdef ALIGN_SECTIONS_IN_FILE
- /* make sure that this section is of the right size too */
+ /* Make sure that this section is of the right size too. */
if ((abfd->flags & EXEC_P) == 0)
{
bfd_size_type old_size;
@@ -3166,7 +3261,7 @@ coff_compute_section_file_positions (abfd)
_raw_size, in case the caller only writes out data to the
unaligned _raw_size. */
if (pei_section_data (abfd, current)->virt_size < current->_raw_size)
- align_adjust = true;
+ align_adjust = TRUE;
#endif
#ifdef _LIB
@@ -3192,7 +3287,7 @@ coff_compute_section_file_positions (abfd)
b = 0;
if (bfd_seek (abfd, sofar - 1, SEEK_SET) != 0
|| bfd_bwrite (&b, (bfd_size_type) 1, abfd) != 1)
- return false;
+ return FALSE;
}
/* Make sure the relocations are aligned. We don't need to make
@@ -3201,9 +3296,9 @@ coff_compute_section_file_positions (abfd)
sofar = BFD_ALIGN (sofar, 1 << COFF_DEFAULT_SECTION_ALIGNMENT_POWER);
obj_relocbase (abfd) = sofar;
- abfd->output_has_begun = true;
+ abfd->output_has_begun = TRUE;
- return true;
+ return TRUE;
}
#if 0
@@ -3215,7 +3310,7 @@ coff_compute_section_file_positions (abfd)
/* 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 boolean
+static bfd_boolean
coff_add_missing_symbols (abfd)
bfd *abfd;
{
@@ -3230,10 +3325,11 @@ coff_add_missing_symbols (abfd)
{
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 */
+ /* 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;
@@ -3259,19 +3355,19 @@ coff_add_missing_symbols (abfd)
need_file = 0;
if (!need_text && !need_data && !need_bss && !need_file)
- return true;
+ 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;
+ return FALSE;
memcpy (sympp2, sympp, i * sizeof (asymbol *));
+
if (need_file)
- {
- /* @@ Generate fake .file symbol, in sympp2[i], and increment i. */
- abort ();
- }
+ /* @@ Generate fake .file symbol, in sympp2[i], and increment i. */
+ abort ();
+
if (need_text)
sympp2[i++] = coff_section_symbol (abfd, _TEXT);
if (need_data)
@@ -3280,7 +3376,7 @@ coff_add_missing_symbols (abfd)
sympp2[i++] = coff_section_symbol (abfd, _BSS);
BFD_ASSERT (i == nsyms);
bfd_set_symtab (abfd, sympp2, nsyms);
- return true;
+ return TRUE;
}
#endif /* 0 */
@@ -3290,7 +3386,7 @@ coff_add_missing_symbols (abfd)
static unsigned int pelength;
static unsigned int peheader;
-static boolean
+static bfd_boolean
coff_read_word (abfd, value)
bfd *abfd;
unsigned int *value;
@@ -3302,7 +3398,7 @@ coff_read_word (abfd, value)
if (status < 1)
{
*value = 0;
- return false;
+ return FALSE;
}
if (status == 1)
@@ -3312,14 +3408,14 @@ coff_read_word (abfd, value)
pelength += (unsigned int) status;
- return true;
+ return TRUE;
}
static unsigned int
coff_compute_checksum (abfd)
bfd *abfd;
{
- boolean more_data;
+ bfd_boolean more_data;
file_ptr filepos;
unsigned int value;
unsigned int total;
@@ -3343,7 +3439,7 @@ coff_compute_checksum (abfd)
return (0xffff & (total + (total >> 0x10)));
}
-static boolean
+static bfd_boolean
coff_apply_checksum (abfd)
bfd *abfd;
{
@@ -3351,51 +3447,51 @@ coff_apply_checksum (abfd)
unsigned int checksum = 0;
if (bfd_seek (abfd, 0x3c, SEEK_SET) != 0)
- return false;
+ return FALSE;
if (!coff_read_word (abfd, &peheader))
- return false;
+ return FALSE;
if (bfd_seek (abfd, peheader + 0x58, SEEK_SET) != 0)
- return false;
+ return FALSE;
checksum = 0;
bfd_bwrite (&checksum, (bfd_size_type) 4, abfd);
if (bfd_seek (abfd, peheader, SEEK_SET) != 0)
- return false;
+ return FALSE;
computed = coff_compute_checksum (abfd);
checksum = computed + pelength;
if (bfd_seek (abfd, peheader + 0x58, SEEK_SET) != 0)
- return false;
+ return FALSE;
bfd_bwrite (&checksum, (bfd_size_type) 4, abfd);
- return true;
+ return TRUE;
}
#endif /* COFF_IMAGE_WITH_PE */
/* SUPPRESS 558 */
/* SUPPRESS 529 */
-static boolean
+static bfd_boolean
coff_write_object_contents (abfd)
bfd * abfd;
{
asection *current;
- boolean hasrelocs = false;
- boolean haslinno = false;
- boolean hasdebug = false;
+ bfd_boolean hasrelocs = FALSE;
+ bfd_boolean haslinno = FALSE;
+ bfd_boolean hasdebug = FALSE;
file_ptr scn_base;
file_ptr reloc_base;
file_ptr lineno_base;
file_ptr sym_base;
unsigned long reloc_size = 0, reloc_count = 0;
unsigned long lnno_size = 0;
- boolean long_section_names;
+ bfd_boolean long_section_names;
asection *text_sec = NULL;
asection *data_sec = NULL;
asection *bss_sec = NULL;
@@ -3408,25 +3504,25 @@ coff_write_object_contents (abfd)
bfd_set_error (bfd_error_system_call);
/* Make a pass through the symbol table to count line number entries and
- put them into the correct asections */
+ put them into the correct asections. */
lnno_size = coff_count_linenumbers (abfd) * bfd_coff_linesz (abfd);
if (! abfd->output_has_begun)
{
if (! coff_compute_section_file_positions (abfd))
- return false;
+ return FALSE;
}
reloc_base = obj_relocbase (abfd);
- /* Work out the size of the reloc and linno areas */
+ /* Work out the size of the reloc and linno areas. */
for (current = abfd->sections; current != NULL; current =
current->next)
{
#ifdef COFF_WITH_PE
- /* we store the actual reloc count in the first reloc's addr */
+ /* We store the actual reloc count in the first reloc's addr. */
if (obj_pe (abfd) && current->reloc_count >= 0xffff)
reloc_count ++;
#endif
@@ -3438,7 +3534,7 @@ coff_write_object_contents (abfd)
lineno_base = reloc_base + reloc_size;
sym_base = lineno_base + lnno_size;
- /* Indicate in each section->line_filepos its actual file address */
+ /* Indicate in each section->line_filepos its actual file address. */
for (current = abfd->sections; current != NULL; current =
current->next)
{
@@ -3457,7 +3553,7 @@ coff_write_object_contents (abfd)
current->rel_filepos = reloc_base;
reloc_base += current->reloc_count * bfd_coff_relsz (abfd);
#ifdef COFF_WITH_PE
- /* extra reloc to hold real count */
+ /* Extra reloc to hold real count. */
if (obj_pe (abfd) && current->reloc_count >= 0xffff)
reloc_base += bfd_coff_relsz (abfd);
#endif
@@ -3487,21 +3583,21 @@ coff_write_object_contents (abfd)
}
if (bfd_seek (abfd, scn_base, SEEK_SET) != 0)
- return false;
+ return FALSE;
- long_section_names = false;
+ long_section_names = FALSE;
for (current = abfd->sections;
current != NULL;
current = current->next)
{
struct internal_scnhdr section;
- boolean is_reloc_section = false;
+ bfd_boolean is_reloc_section = FALSE;
#ifdef COFF_IMAGE_WITH_PE
if (strcmp (current->name, ".reloc") == 0)
{
- is_reloc_section = true;
- hasrelocs = true;
+ is_reloc_section = TRUE;
+ hasrelocs = TRUE;
pe_data (abfd)->has_reloc_section = 1;
}
#endif
@@ -3522,7 +3618,7 @@ coff_write_object_contents (abfd)
memset (section.s_name, 0, SCNNMLEN);
sprintf (section.s_name, "/%lu", (unsigned long) string_size);
string_size += len + 1;
- long_section_names = true;
+ long_section_names = TRUE;
}
}
#endif
@@ -3553,19 +3649,14 @@ coff_write_object_contents (abfd)
section.s_paddr = 0;
#endif
- /*
- If this section has no size or is unloadable then the scnptr
- will be 0 too
- */
+ /* If this section has no size or is unloadable then the scnptr
+ will be 0 too. */
if (current->_raw_size == 0 ||
(current->flags & (SEC_LOAD | SEC_HAS_CONTENTS)) == 0)
- {
- section.s_scnptr = 0;
- }
+ section.s_scnptr = 0;
else
- {
- section.s_scnptr = current->filepos;
- }
+ section.s_scnptr = current->filepos;
+
section.s_relptr = current->rel_filepos;
section.s_lnnoptr = current->line_filepos;
section.s_nreloc = current->reloc_count;
@@ -3573,13 +3664,13 @@ coff_write_object_contents (abfd)
#ifndef COFF_IMAGE_WITH_PE
/* In PEI, relocs come in the .reloc section. */
if (current->reloc_count != 0)
- hasrelocs = true;
+ hasrelocs = TRUE;
#endif
if (current->lineno_count != 0)
- haslinno = true;
+ haslinno = TRUE;
if ((current->flags & SEC_DEBUGGING) != 0
&& ! is_reloc_section)
- hasdebug = true;
+ hasdebug = TRUE;
#ifdef RS6000COFF_C
#ifndef XCOFF64
@@ -3595,17 +3686,11 @@ coff_write_object_contents (abfd)
section.s_flags = sec_to_styp_flags (current->name, current->flags);
if (!strcmp (current->name, _TEXT))
- {
- text_sec = current;
- }
+ text_sec = current;
else if (!strcmp (current->name, _DATA))
- {
- data_sec = current;
- }
+ data_sec = current;
else if (!strcmp (current->name, _BSS))
- {
- bss_sec = current;
- }
+ bss_sec = current;
#ifdef I960
section.s_align = (current->alignment_power
@@ -3613,7 +3698,7 @@ coff_write_object_contents (abfd)
: 0);
#endif
#ifdef TIC80COFF
- /* TI COFF puts the alignment power in bits 8-11 of the flags */
+ /* TI COFF puts the alignment power in bits 8-11 of the flags. */
section.s_flags |= (current->alignment_power & 0xF) << 8;
#endif
#ifdef COFF_ENCODE_ALIGNMENT
@@ -3636,7 +3721,7 @@ coff_write_object_contents (abfd)
if (coff_swap_scnhdr_out (abfd, &section, &buff) == 0
|| bfd_bwrite ((PTR) &buff, amt, abfd) != amt)
- return false;
+ return FALSE;
}
#ifdef COFF_WITH_PE
@@ -3760,7 +3845,7 @@ coff_write_object_contents (abfd)
amt = bfd_coff_scnhsz (abfd);
if (coff_swap_scnhdr_out (abfd, &scnhdr, &buff) == 0
|| bfd_bwrite ((PTR) &buff, amt, abfd) != amt)
- return false;
+ return FALSE;
}
}
#endif
@@ -3770,14 +3855,11 @@ coff_write_object_contents (abfd)
/* Don't include the internal abs section in the section count */
- /*
- We will NOT put a fucking timestamp in the header here. Every time you
+ /* We will NOT put a fucking timestamp in the header here. Every time you
put it back, I will come in and take it out again. I'm sorry. This
field does not belong here. We fill it with a 0 so it compares the
- same but is not a reasonable time. -- gnu@cygnus.com
- */
+ same but is not a reasonable time. -- gnu@cygnus.com */
internal_f.f_timdat = 0;
-
internal_f.f_flags = 0;
if (abfd->flags & EXEC_P)
@@ -3806,7 +3888,9 @@ coff_write_object_contents (abfd)
internal_f.f_flags |= IMAGE_FILE_DEBUG_STRIPPED;
#endif
-#ifndef COFF_WITH_PE
+#ifdef COFF_WITH_PE
+ internal_f.f_flags |= IMAGE_FILE_32BIT_MACHINE;
+#else
if (bfd_little_endian (abfd))
internal_f.f_flags |= F_AR32WR;
else
@@ -3814,18 +3898,16 @@ coff_write_object_contents (abfd)
#endif
#ifdef TI_TARGET_ID
- /* target id is used in TI COFF v1 and later; COFF0 won't use this field,
- but it doesn't hurt to set it internally */
+ /* Target id is used in TI COFF v1 and later; COFF0 won't use this field,
+ but it doesn't hurt to set it internally. */
internal_f.f_target_id = TI_TARGET_ID;
#endif
#ifdef TIC80_TARGET_ID
internal_f.f_target_id = TIC80_TARGET_ID;
#endif
- /*
- FIXME, should do something about the other byte orders and
- architectures.
- */
+ /* FIXME, should do something about the other byte orders and
+ architectures. */
#ifdef RS6000COFF_C
if ((abfd->flags & DYNAMIC) != 0)
@@ -3836,11 +3918,11 @@ coff_write_object_contents (abfd)
memset (&internal_a, 0, sizeof internal_a);
- /* Set up architecture-dependent stuff */
-
+ /* Set up architecture-dependent stuff. */
{
unsigned int magic = 0;
unsigned short flags = 0;
+
coff_set_flags (abfd, &magic, &flags);
internal_f.f_magic = magic;
internal_f.f_flags |= flags;
@@ -3849,14 +3931,13 @@ coff_write_object_contents (abfd)
#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.
- */
+ 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 */
+ internal_a.magic = SHMAGIC; /* Shared magic. */
else
#endif /* ULTRA3 */
- internal_a.magic = NMAGIC; /* Assume separate i/d */
+ internal_a.magic = NMAGIC; /* Assume separate i/d. */
#define __A_MAGIC_SET__
#endif /* A29K */
#ifdef TICOFF_AOUT_MAGIC
@@ -3971,7 +4052,7 @@ coff_write_object_contents (abfd)
/* FIXME: Does anybody ever set this to another value? */
internal_a.vstamp = 0;
- /* Now should write relocs, strings, syms */
+ /* Now should write relocs, strings, syms. */
obj_sym_filepos (abfd) = sym_base;
if (bfd_get_symcount (abfd) != 0)
@@ -3979,17 +4060,17 @@ coff_write_object_contents (abfd)
int firstundef;
#if 0
if (!coff_add_missing_symbols (abfd))
- return false;
+ return FALSE;
#endif
if (!coff_renumber_symbols (abfd, &firstundef))
- return false;
+ return FALSE;
coff_mangle_symbols (abfd);
if (! coff_write_symbols (abfd))
- return false;
+ return FALSE;
if (! coff_write_linenumbers (abfd))
- return false;
+ return FALSE;
if (! coff_write_relocs (abfd, firstundef))
- return false;
+ return FALSE;
}
#ifdef COFF_LONG_SECTION_NAMES
else if (long_section_names && ! obj_coff_strings_written (abfd))
@@ -3997,7 +4078,7 @@ coff_write_object_contents (abfd)
/* If we have long section names we have to write out the string
table even if there are no symbols. */
if (! coff_write_symbols (abfd))
- return false;
+ return FALSE;
}
#endif
#ifdef COFF_IMAGE_WITH_PE
@@ -4013,7 +4094,7 @@ coff_write_object_contents (abfd)
(file_ptr) BFD_ALIGN (sym_base, COFF_PAGE_SIZE) - 1,
SEEK_SET) != 0
|| bfd_bwrite (&b, (bfd_size_type) 1, abfd) != 1)
- return false;
+ return FALSE;
}
#endif
#endif
@@ -4116,7 +4197,7 @@ coff_write_object_contents (abfd)
internal_a.o_cputype = 4;
break;
case bfd_arch_powerpc:
- if (bfd_get_mach (abfd) == 0)
+ if (bfd_get_mach (abfd) == bfd_mach_ppc)
internal_a.o_cputype = 3;
else
internal_a.o_cputype = 1;
@@ -4132,7 +4213,7 @@ coff_write_object_contents (abfd)
/* now write them */
if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0)
- return false;
+ return FALSE;
{
char * buff;
@@ -4140,7 +4221,7 @@ coff_write_object_contents (abfd)
buff = bfd_malloc (amount);
if (buff == NULL)
- return false;
+ return FALSE;
bfd_coff_swap_filehdr_out (abfd, (PTR) &internal_f, (PTR) buff);
amount = bfd_bwrite ((PTR) buff, amount, abfd);
@@ -4148,19 +4229,19 @@ coff_write_object_contents (abfd)
free (buff);
if (amount != bfd_coff_filhsz (abfd))
- return false;
+ return FALSE;
}
if (abfd->flags & EXEC_P)
{
/* Note that peicode.h fills in a PEAOUTHDR, not an AOUTHDR.
- include/coff/pe.h sets AOUTSZ == sizeof (PEAOUTHDR)) */
+ include/coff/pe.h sets AOUTSZ == sizeof (PEAOUTHDR)). */
char * buff;
bfd_size_type amount = bfd_coff_aoutsz (abfd);
buff = bfd_malloc (amount);
if (buff == NULL)
- return false;
+ return FALSE;
coff_swap_aouthdr_out (abfd, (PTR) &internal_a, (PTR) buff);
amount = bfd_bwrite ((PTR) buff, amount, abfd);
@@ -4168,11 +4249,11 @@ coff_write_object_contents (abfd)
free (buff);
if (amount != bfd_coff_aoutsz (abfd))
- return false;
+ return FALSE;
#ifdef COFF_IMAGE_WITH_PE
if (! coff_apply_checksum (abfd))
- return false;
+ return FALSE;
#endif
}
#ifdef RS6000COFF_C
@@ -4188,25 +4269,25 @@ coff_write_object_contents (abfd)
else
size = SMALL_AOUTSZ;
if (bfd_bwrite ((PTR) &buff, (bfd_size_type) size, abfd) != size)
- return false;
+ return FALSE;
}
#endif
- return true;
+ return TRUE;
}
-static boolean
+static bfd_boolean
coff_set_section_contents (abfd, section, location, offset, count)
bfd * abfd;
sec_ptr section;
- PTR location;
+ const PTR location;
file_ptr offset;
bfd_size_type count;
{
- if (! abfd->output_has_begun) /* set by bfd.c handler */
+ if (! abfd->output_has_begun) /* Set by bfd.c handler. */
{
if (! coff_compute_section_file_positions (abfd))
- return false;
+ return FALSE;
}
#if defined(_LIB) && !defined(TARG_AUX)
@@ -4230,7 +4311,7 @@ coff_set_section_contents (abfd, section, location, offset, count)
code has been tested on ISC 4.1 by me, and on SCO by Robert Lipe
<robertl@arnet.com> (Thanks!).
- Gvran Uddeborg <gvran@uddeborg.pp.se> */
+ Gvran Uddeborg <gvran@uddeborg.pp.se>. */
if (strcmp (section->name, _LIB) == 0)
{
@@ -4252,18 +4333,18 @@ coff_set_section_contents (abfd, section, location, offset, count)
/* Don't write out bss sections - one way to do this is to
see if the filepos has not been set. */
if (section->filepos == 0)
- return true;
+ return TRUE;
if (bfd_seek (abfd, section->filepos + offset, SEEK_SET) != 0)
- return false;
+ return FALSE;
if (count == 0)
- return true;
+ return TRUE;
return bfd_bwrite (location, count, abfd) == count;
}
#if 0
-static boolean
+static bfd_boolean
coff_close_and_cleanup (abfd)
bfd *abfd;
{
@@ -4272,19 +4353,19 @@ coff_close_and_cleanup (abfd)
{
case bfd_archive:
if (!_bfd_write_archive_contents (abfd))
- return false;
+ return FALSE;
break;
case bfd_object:
if (!coff_write_object_contents (abfd))
- return false;
+ return FALSE;
break;
default:
bfd_set_error (bfd_error_invalid_operation);
- return false;
+ return FALSE;
}
/* We depend on bfd_close to free all the memory on the objalloc. */
- return true;
+ return TRUE;
}
#endif
@@ -4328,7 +4409,7 @@ SUBSUBSECTION
*/
-static boolean
+static bfd_boolean
coff_slurp_line_table (abfd, asect)
bfd *abfd;
asection *asect;
@@ -4341,10 +4422,17 @@ coff_slurp_line_table (abfd, asect)
amt = (bfd_size_type) bfd_coff_linesz (abfd) * asect->lineno_count;
native_lineno = (LINENO *) buy_and_read (abfd, asect->line_filepos, amt);
+ if (native_lineno == NULL)
+ {
+ (*_bfd_error_handler)
+ (_("%s: warning: line number table read failed"),
+ bfd_archive_filename (abfd));
+ return FALSE;
+ }
amt = ((bfd_size_type) asect->lineno_count + 1) * sizeof (alent);
lineno_cache = (alent *) bfd_alloc (abfd, amt);
if (lineno_cache == NULL)
- return false;
+ return FALSE;
else
{
unsigned int counter = 0;
@@ -4354,16 +4442,17 @@ coff_slurp_line_table (abfd, asect)
while (counter < asect->lineno_count)
{
struct internal_lineno dst;
+
bfd_coff_swap_lineno_in (abfd, src, &dst);
cache_ptr->line_number = dst.l_lnno;
if (cache_ptr->line_number == 0)
{
- boolean warned;
+ bfd_boolean warned;
bfd_signed_vma symndx;
coff_symbol_type *sym;
- warned = false;
+ warned = FALSE;
symndx = dst.l_addr.l_symndx;
if (symndx < 0
|| (bfd_vma) symndx >= obj_raw_syment_count (abfd))
@@ -4372,7 +4461,7 @@ coff_slurp_line_table (abfd, asect)
(_("%s: warning: illegal symbol index %ld in line numbers"),
bfd_archive_filename (abfd), dst.l_addr.l_symndx);
symndx = 0;
- warned = true;
+ warned = TRUE;
}
/* FIXME: We should not be casting between ints and
pointers like this. */
@@ -4404,14 +4493,14 @@ coff_slurp_line_table (abfd, asect)
}
asect->lineno = lineno_cache;
/* FIXME, free native_lineno here, or use alloca or something. */
- return true;
+ return TRUE;
}
/* Slurp in the symbol table, converting it to generic form. Note
that if coff_relocate_section is defined, the linker will read
symbols via coff_link_add_symbols, rather than via this routine. */
-static boolean
+static bfd_boolean
coff_slurp_symbol_table (abfd)
bfd * abfd;
{
@@ -4419,36 +4508,34 @@ coff_slurp_symbol_table (abfd)
coff_symbol_type *cached_area;
unsigned int *table_ptr;
bfd_size_type amt;
-
unsigned int number_of_symbols = 0;
if (obj_symbols (abfd))
- return true;
+ return TRUE;
- /* Read in the symbol table */
+ /* Read in the symbol table. */
if ((native_symbols = coff_get_normalized_symtab (abfd)) == NULL)
- {
- return (false);
- } /* on error */
+ return FALSE;
- /* Allocate enough room for all the symbols in cached form */
+ /* Allocate enough room for all the symbols in cached form. */
amt = obj_raw_syment_count (abfd);
amt *= sizeof (coff_symbol_type);
cached_area = (coff_symbol_type *) bfd_alloc (abfd, amt);
if (cached_area == NULL)
- return false;
+ return FALSE;
amt = obj_raw_syment_count (abfd);
amt *= sizeof (unsigned int);
table_ptr = (unsigned int *) bfd_alloc (abfd, amt);
if (table_ptr == NULL)
- return false;
+ return FALSE;
else
{
coff_symbol_type *dst = cached_area;
unsigned int last_native_index = obj_raw_syment_count (abfd);
unsigned int this_index = 0;
+
while (this_index < last_native_index)
{
combined_entry_type *src = native_symbols + this_index;
@@ -4461,7 +4548,7 @@ coff_slurp_symbol_table (abfd)
dst->symbol.section = coff_section_from_bfd_index (abfd,
src->u.syment.n_scnum);
dst->symbol.flags = 0;
- dst->done_lineno = false;
+ dst->done_lineno = FALSE;
switch (src->u.syment.n_sclass)
{
@@ -4472,8 +4559,7 @@ coff_slurp_symbol_table (abfd)
dst->symbol.flags = BSF_EXPORT | BSF_GLOBAL;
dst->symbol.flags |= BSF_NOT_AT_END | BSF_FUNCTION;
#endif
- /* Fall through to next case */
-
+ /* Fall through to next case. */
#endif
case C_EXT:
@@ -4486,10 +4572,10 @@ coff_slurp_symbol_table (abfd)
case C_HIDEXT:
#endif
#ifdef C_SYSTEM
- case C_SYSTEM: /* System Wide variable */
+ case C_SYSTEM: /* System Wide variable. */
#endif
#ifdef COFF_WITH_PE
- /* In PE, 0x68 (104) denotes a section symbol */
+ /* In PE, 0x68 (104) denotes a section symbol. */
case C_SECTION:
/* In PE, 0x69 (105) denotes a weak external symbol. */
case C_NT_WEAK:
@@ -4563,16 +4649,16 @@ coff_slurp_symbol_table (abfd)
break;
- case C_STAT: /* static */
+ case C_STAT: /* Static. */
#ifdef I960
- case C_LEAFSTAT: /* static leaf procedure */
+ case C_LEAFSTAT: /* Static leaf procedure. */
#endif
#if defined ARM
- case C_THUMBSTAT: /* Thumb static */
- case C_THUMBLABEL: /* Thumb label */
- case C_THUMBSTATFUNC:/* Thumb static function */
+ case C_THUMBSTAT: /* Thumb static. */
+ case C_THUMBLABEL: /* Thumb label. */
+ case C_THUMBSTATFUNC:/* Thumb static function. */
#endif
- case C_LABEL: /* label */
+ case C_LABEL: /* Label. */
if (src->u.syment.n_scnum == N_DEBUG)
dst->symbol.flags = BSF_DEBUGGING;
else
@@ -4595,35 +4681,35 @@ coff_slurp_symbol_table (abfd)
dst->symbol.value = src->u.syment.n_value;
break;
- case C_MOS: /* member of structure */
- case C_EOS: /* end of structure */
-#ifdef NOTDEF /* C_AUTOARG has the same value */
+ 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 */
+ case C_GLBLREG: /* A29k-specific storage class. */
#endif
#endif
- case C_REGPARM: /* register parameter */
- case C_REG: /* register variable */
- /* C_AUTOARG conflictes with TI COFF C_UEXT */
+ case C_REGPARM: /* Register parameter. */
+ case C_REG: /* register variable. */
+ /* C_AUTOARG conflicts with TI COFF C_UEXT. */
#if !defined (TIC80COFF) && !defined (TICOFF)
#ifdef C_AUTOARG
- case C_AUTOARG: /* 960-specific storage class */
+ case C_AUTOARG: /* 960-specific storage class. */
#endif
#endif
- case C_TPDEF: /* type definition */
+ case C_TPDEF: /* Type definition. */
case C_ARG:
- case C_AUTO: /* automatic variable */
- case C_FIELD: /* bit field */
- case C_ENTAG: /* enumeration tag */
- case C_MOE: /* member of enumeration */
- case C_MOU: /* member of union */
- case C_UNTAG: /* union tag */
+ case C_AUTO: /* Automatic variable. */
+ case C_FIELD: /* Bit field. */
+ case C_ENTAG: /* Enumeration tag. */
+ case C_MOE: /* Member of enumeration. */
+ case C_MOU: /* Member of union. */
+ case C_UNTAG: /* Union tag. */
dst->symbol.flags = BSF_DEBUGGING;
dst->symbol.value = (src->u.syment.n_value);
break;
- case C_FILE: /* file name */
- case C_STRTAG: /* structure tag */
+ case C_FILE: /* File name. */
+ case C_STRTAG: /* Structure tag. */
#ifdef RS6000COFF_C
case C_GSYM:
case C_LSYM:
@@ -4631,7 +4717,9 @@ coff_slurp_symbol_table (abfd)
case C_RSYM:
case C_RPSYM:
case C_STSYM:
+ case C_TCSYM:
case C_BCOMM:
+ case C_ECOML:
case C_ECOMM:
case C_DECL:
case C_ENTRY:
@@ -4643,8 +4731,8 @@ coff_slurp_symbol_table (abfd)
break;
#ifdef RS6000COFF_C
- case C_BINCL: /* beginning of include file */
- case C_EINCL: /* ending of include file */
+ case C_BINCL: /* Beginning of include file. */
+ case C_EINCL: /* Ending of include file. */
/* The value is actually a pointer into the line numbers
of the file. We locate the line number entry, and
set the section to the section which contains it, and
@@ -4685,9 +4773,9 @@ coff_slurp_symbol_table (abfd)
break;
#endif
- case C_BLOCK: /* ".bb" or ".eb" */
- case C_FCN: /* ".bf" or ".ef" (or PE ".lf") */
- case C_EFCN: /* physical end of function */
+ case C_BLOCK: /* ".bb" or ".eb". */
+ case C_FCN: /* ".bf" or ".ef" (or PE ".lf"). */
+ case C_EFCN: /* Physical end of function. */
#if defined COFF_WITH_PE
/* PE sets the symbol to a value relative to the start
of the section. */
@@ -4709,7 +4797,7 @@ coff_slurp_symbol_table (abfd)
#endif
break;
- case C_STATLAB: /* Static load time label */
+ case C_STATLAB: /* Static load time label. */
dst->symbol.value = src->u.syment.n_value;
dst->symbol.flags = BSF_GLOBAL;
break;
@@ -4722,22 +4810,22 @@ coff_slurp_symbol_table (abfd)
&& src->u.syment.n_scnum == 0)
break;
/* Fall through. */
- case C_EXTDEF: /* external definition */
- case C_ULABEL: /* undefined label */
- case C_USTATIC: /* undefined static */
+ case C_EXTDEF: /* External definition. */
+ case C_ULABEL: /* Undefined label. */
+ case C_USTATIC: /* Undefined static. */
#ifndef COFF_WITH_PE
/* C_LINE in regular coff is 0x68. NT has taken over this storage
- class to represent a section symbol */
- case C_LINE: /* line # reformatted as symbol table entry */
+ class to represent a section symbol. */
+ case C_LINE: /* line # reformatted as symbol table entry. */
/* NT uses 0x67 for a weak symbol, not C_ALIAS. */
- case C_ALIAS: /* duplicate tag */
+ case C_ALIAS: /* Duplicate tag. */
#endif
- /* New storage classes for TI COFF */
+ /* New storage classes for TI COFF. */
#if defined(TIC80COFF) || defined(TICOFF)
- case C_UEXT: /* Tentative external definition */
+ case C_UEXT: /* Tentative external definition. */
#endif
- case C_EXTLAB: /* External load time label */
- case C_HIDDEN: /* ext symbol in dmert public lib */
+ case C_EXTLAB: /* External load time label. */
+ case C_HIDDEN: /* Ext symbol in dmert public lib. */
default:
(*_bfd_error_handler)
(_("%s: Unrecognized storage class %d for %s symbol `%s'"),
@@ -4757,17 +4845,18 @@ coff_slurp_symbol_table (abfd)
this_index += (src->u.syment.n_numaux) + 1;
dst++;
number_of_symbols++;
- } /* walk the native symtab */
- } /* bfdize the native symtab */
+ }
+ }
obj_symbols (abfd) = cached_area;
obj_raw_syments (abfd) = native_symbols;
bfd_get_symcount (abfd) = number_of_symbols;
obj_convert (abfd) = table_ptr;
- /* Slurp the line tables for each section too */
+ /* Slurp the line tables for each section too. */
{
asection *p;
+
p = abfd->sections;
while (p)
{
@@ -4775,7 +4864,8 @@ coff_slurp_symbol_table (abfd)
p = p->next;
}
}
- return true;
+
+ return TRUE;
} /* coff_slurp_symbol_table() */
/* Classify a COFF symbol. A couple of targets have globally visible
@@ -4927,7 +5017,7 @@ SUBSUBSECTION
}
#endif
-static boolean
+static bfd_boolean
coff_slurp_reloc_table (abfd, asect, symbols)
bfd * abfd;
sec_ptr asect;
@@ -4940,20 +5030,20 @@ coff_slurp_reloc_table (abfd, asect, symbols)
bfd_size_type amt;
if (asect->relocation)
- return true;
+ return TRUE;
if (asect->reloc_count == 0)
- return true;
+ return TRUE;
if (asect->flags & SEC_CONSTRUCTOR)
- return true;
+ return TRUE;
if (!coff_slurp_symbol_table (abfd))
- return false;
+ return FALSE;
amt = (bfd_size_type) bfd_coff_relsz (abfd) * asect->reloc_count;
native_relocs = (RELOC *) buy_and_read (abfd, asect->rel_filepos, amt);
amt = (bfd_size_type) asect->reloc_count * sizeof (arelent);
reloc_cache = (arelent *) bfd_alloc (abfd, amt);
if (reloc_cache == NULL)
- return false;
+ return FALSE;
for (idx = 0; idx < asect->reloc_count; idx++)
{
@@ -5001,15 +5091,15 @@ coff_slurp_reloc_table (abfd, asect, symbols)
refering to the symbols in the raw data have not been
modified, so we have to have a negative addend to compensate.
- Note that symbols which used to be common must be left alone */
+ Note that symbols which used to be common must be left alone. */
- /* Calculate any reloc addend by looking at the symbol */
+ /* Calculate any reloc addend by looking at the symbol. */
CALC_ADDEND (abfd, ptr, dst, cache_ptr);
cache_ptr->address -= asect->vma;
/* !! cache_ptr->section = (asection *) NULL;*/
- /* Fill in the cache_ptr->howto field from dst.r_type */
+ /* Fill in the cache_ptr->howto field from dst.r_type. */
RTYPE2HOWTO (cache_ptr, &dst);
#endif /* RELOC_PROCESSING */
@@ -5019,12 +5109,12 @@ coff_slurp_reloc_table (abfd, asect, symbols)
(_("%s: illegal relocation type %d at address 0x%lx"),
bfd_archive_filename (abfd), dst.r_type, (long) dst.r_vaddr);
bfd_set_error (bfd_error_bad_value);
- return false;
+ return FALSE;
}
}
asect->relocation = reloc_cache;
- return true;
+ return TRUE;
}
#ifndef coff_rtype_to_howto
@@ -5041,7 +5131,6 @@ static reloc_howto_type *coff_rtype_to_howto
struct coff_link_hash_entry *, struct internal_syment *,
bfd_vma *));
-/*ARGSUSED*/
static reloc_howto_type *
coff_rtype_to_howto (abfd, sec, rel, h, sym, addendp)
bfd *abfd ATTRIBUTE_UNUSED;
@@ -5077,16 +5166,16 @@ coff_canonicalize_reloc (abfd, section, relptr, symbols)
if (section->flags & SEC_CONSTRUCTOR)
{
- /* this section has relocs made up by us, they are not in the
- file, so take them out of their chain and place them into
- the data area provided */
+ /* This section has relocs made up by us, they are not in the
+ file, so take them out of their chain and place them into
+ the data area provided. */
arelent_chain *chain = section->constructor_chain;
+
for (count = 0; count < section->reloc_count; count++)
{
*relptr++ = &chain->relent;
chain = chain->next;
}
-
}
else
{
@@ -5201,10 +5290,10 @@ dummy_reloc16_extra_cases (abfd, link_info, link_order, reloc, data, src_ptr,
#ifndef coff_link_output_has_begun
-static boolean coff_link_output_has_begun
+static bfd_boolean coff_link_output_has_begun
PARAMS ((bfd *, struct coff_final_link_info *));
-static boolean
+static bfd_boolean
coff_link_output_has_begun (abfd, info)
bfd * abfd;
struct coff_final_link_info * info ATTRIBUTE_UNUSED;
@@ -5215,15 +5304,15 @@ coff_link_output_has_begun (abfd, info)
#ifndef coff_final_link_postscript
-static boolean coff_final_link_postscript
+static bfd_boolean coff_final_link_postscript
PARAMS ((bfd *, struct coff_final_link_info *));
-static boolean
+static bfd_boolean
coff_final_link_postscript (abfd, pfinfo)
bfd * abfd ATTRIBUTE_UNUSED;
struct coff_final_link_info * pfinfo ATTRIBUTE_UNUSED;
{
- return true;
+ return TRUE;
}
#endif
@@ -5279,20 +5368,20 @@ static const bfd_coff_backend_data bfd_coff_std_swap_table =
coff_SWAP_scnhdr_out,
FILHSZ, AOUTSZ, SCNHSZ, SYMESZ, AUXESZ, RELSZ, LINESZ, FILNMLEN,
#ifdef COFF_LONG_FILENAMES
- true,
+ TRUE,
#else
- false,
+ FALSE,
#endif
#ifdef COFF_LONG_SECTION_NAMES
- true,
+ TRUE,
#else
- false,
+ FALSE,
#endif
COFF_DEFAULT_SECTION_ALIGNMENT_POWER,
#ifdef COFF_FORCE_SYMBOLS_IN_STRINGS
- true,
+ TRUE,
#else
- false,
+ FALSE,
#endif
#ifdef COFF_DEBUG_STRING_WIDE_PREFIX
4,
@@ -5310,6 +5399,92 @@ static const bfd_coff_backend_data bfd_coff_std_swap_table =
coff_link_output_has_begun, coff_final_link_postscript
};
+#ifdef TICOFF
+/* COFF0 differs in file/section header size and relocation entry size. */
+static const bfd_coff_backend_data ticoff0_swap_table =
+{
+ coff_SWAP_aux_in, coff_SWAP_sym_in, coff_SWAP_lineno_in,
+ coff_SWAP_aux_out, coff_SWAP_sym_out,
+ coff_SWAP_lineno_out, coff_SWAP_reloc_out,
+ coff_SWAP_filehdr_out, coff_SWAP_aouthdr_out,
+ coff_SWAP_scnhdr_out,
+ FILHSZ_V0, AOUTSZ, SCNHSZ_V01, SYMESZ, AUXESZ, RELSZ_V0, LINESZ, FILNMLEN,
+#ifdef COFF_LONG_FILENAMES
+ TRUE,
+#else
+ FALSE,
+#endif
+#ifdef COFF_LONG_SECTION_NAMES
+ TRUE,
+#else
+ FALSE,
+#endif
+ COFF_DEFAULT_SECTION_ALIGNMENT_POWER,
+#ifdef COFF_FORCE_SYMBOLS_IN_STRINGS
+ TRUE,
+#else
+ FALSE,
+#endif
+#ifdef COFF_DEBUG_STRING_WIDE_PREFIX
+ 4,
+#else
+ 2,
+#endif
+ coff_SWAP_filehdr_in, coff_SWAP_aouthdr_in, coff_SWAP_scnhdr_in,
+ coff_SWAP_reloc_in, ticoff0_bad_format_hook, coff_set_arch_mach_hook,
+ coff_mkobject_hook, styp_to_sec_flags, coff_set_alignment_hook,
+ coff_slurp_symbol_table, symname_in_debug_hook, coff_pointerize_aux_hook,
+ coff_print_aux, coff_reloc16_extra_cases, coff_reloc16_estimate,
+ coff_classify_symbol, coff_compute_section_file_positions,
+ coff_start_final_link, coff_relocate_section, coff_rtype_to_howto,
+ coff_adjust_symndx, coff_link_add_one_symbol,
+ coff_link_output_has_begun, coff_final_link_postscript
+};
+#endif
+
+#ifdef TICOFF
+/* COFF1 differs in section header size. */
+static const bfd_coff_backend_data ticoff1_swap_table =
+{
+ coff_SWAP_aux_in, coff_SWAP_sym_in, coff_SWAP_lineno_in,
+ coff_SWAP_aux_out, coff_SWAP_sym_out,
+ coff_SWAP_lineno_out, coff_SWAP_reloc_out,
+ coff_SWAP_filehdr_out, coff_SWAP_aouthdr_out,
+ coff_SWAP_scnhdr_out,
+ FILHSZ, AOUTSZ, SCNHSZ_V01, SYMESZ, AUXESZ, RELSZ, LINESZ, FILNMLEN,
+#ifdef COFF_LONG_FILENAMES
+ TRUE,
+#else
+ FALSE,
+#endif
+#ifdef COFF_LONG_SECTION_NAMES
+ TRUE,
+#else
+ FALSE,
+#endif
+ COFF_DEFAULT_SECTION_ALIGNMENT_POWER,
+#ifdef COFF_FORCE_SYMBOLS_IN_STRINGS
+ TRUE,
+#else
+ FALSE,
+#endif
+#ifdef COFF_DEBUG_STRING_WIDE_PREFIX
+ 4,
+#else
+ 2,
+#endif
+ coff_SWAP_filehdr_in, coff_SWAP_aouthdr_in, coff_SWAP_scnhdr_in,
+ coff_SWAP_reloc_in, ticoff1_bad_format_hook, coff_set_arch_mach_hook,
+ coff_mkobject_hook, styp_to_sec_flags, coff_set_alignment_hook,
+ coff_slurp_symbol_table, symname_in_debug_hook, coff_pointerize_aux_hook,
+ coff_print_aux, coff_reloc16_extra_cases, coff_reloc16_estimate,
+ coff_classify_symbol, coff_compute_section_file_positions,
+ coff_start_final_link, coff_relocate_section, coff_rtype_to_howto,
+ coff_adjust_symndx, coff_link_add_one_symbol,
+ coff_link_output_has_begun, coff_final_link_postscript
+};
+#endif
+
#ifndef coff_close_and_cleanup
#define coff_close_and_cleanup _bfd_generic_close_and_cleanup
#endif
@@ -5385,7 +5560,7 @@ static const bfd_coff_backend_data bfd_coff_std_swap_table =
#define coff_bfd_discard_group bfd_generic_discard_group
#endif
-#define CREATE_BIG_COFF_TARGET_VEC(VAR, NAME, EXTRA_O_FLAGS, EXTRA_S_FLAGS, UNDER, ALTERNATIVE) \
+#define CREATE_BIG_COFF_TARGET_VEC(VAR, NAME, EXTRA_O_FLAGS, EXTRA_S_FLAGS, UNDER, ALTERNATIVE, SWAP_TABLE) \
const bfd_target VAR = \
{ \
NAME , \
@@ -5432,10 +5607,60 @@ const bfd_target VAR = \
\
ALTERNATIVE, \
\
- COFF_SWAP_TABLE \
+ SWAP_TABLE \
+};
+
+#define CREATE_BIGHDR_COFF_TARGET_VEC(VAR, NAME, EXTRA_O_FLAGS, EXTRA_S_FLAGS, UNDER, ALTERNATIVE, SWAP_TABLE) \
+const bfd_target VAR = \
+{ \
+ NAME , \
+ bfd_target_coff_flavour, \
+ BFD_ENDIAN_LITTLE, /* data byte order is little */ \
+ BFD_ENDIAN_BIG, /* header byte order is big */ \
+ /* object flags */ \
+ (HAS_RELOC | EXEC_P | HAS_LINENO | HAS_DEBUG | \
+ HAS_SYMS | HAS_LOCALS | WP_TEXT | EXTRA_O_FLAGS), \
+ /* section flags */ \
+ (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC | EXTRA_S_FLAGS),\
+ UNDER, /* leading symbol underscore */ \
+ '/', /* ar_pad_char */ \
+ 15, /* ar_max_namelen */ \
+ \
+ /* Data conversion functions. */ \
+ bfd_getb64, bfd_getb_signed_64, bfd_putb64, \
+ bfd_getb32, bfd_getb_signed_32, bfd_putb32, \
+ bfd_getb16, bfd_getb_signed_16, bfd_putb16, \
+ \
+ /* Header conversion functions. */ \
+ bfd_getb64, bfd_getb_signed_64, bfd_putb64, \
+ bfd_getb32, bfd_getb_signed_32, bfd_putb32, \
+ bfd_getb16, bfd_getb_signed_16, bfd_putb16, \
+ \
+ /* bfd_check_format */ \
+ { _bfd_dummy_target, coff_object_p, bfd_generic_archive_p, \
+ _bfd_dummy_target }, \
+ /* bfd_set_format */ \
+ { bfd_false, coff_mkobject, _bfd_generic_mkarchive, bfd_false }, \
+ /* bfd_write_contents */ \
+ { bfd_false, coff_write_object_contents, _bfd_write_archive_contents, \
+ bfd_false }, \
+ \
+ BFD_JUMP_TABLE_GENERIC (coff), \
+ BFD_JUMP_TABLE_COPY (coff), \
+ BFD_JUMP_TABLE_CORE (_bfd_nocore), \
+ BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff), \
+ BFD_JUMP_TABLE_SYMBOLS (coff), \
+ BFD_JUMP_TABLE_RELOCS (coff), \
+ BFD_JUMP_TABLE_WRITE (coff), \
+ BFD_JUMP_TABLE_LINK (coff), \
+ BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic), \
+ \
+ ALTERNATIVE, \
+ \
+ SWAP_TABLE \
};
-#define CREATE_LITTLE_COFF_TARGET_VEC(VAR, NAME, EXTRA_O_FLAGS, EXTRA_S_FLAGS, UNDER, ALTERNATIVE) \
+#define CREATE_LITTLE_COFF_TARGET_VEC(VAR, NAME, EXTRA_O_FLAGS, EXTRA_S_FLAGS, UNDER, ALTERNATIVE, SWAP_TABLE) \
const bfd_target VAR = \
{ \
NAME , \
@@ -5480,5 +5705,5 @@ const bfd_target VAR = \
\
ALTERNATIVE, \
\
- COFF_SWAP_TABLE \
+ SWAP_TABLE \
};
diff --git a/contrib/binutils/bfd/coffgen.c b/contrib/binutils/bfd/coffgen.c
index 21589c6..a712b4b 100644
--- a/contrib/binutils/bfd/coffgen.c
+++ b/contrib/binutils/bfd/coffgen.c
@@ -1,6 +1,6 @@
/* Support for the generic parts of COFF, for BFD.
Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
- 2000, 2001, 2002
+ 2000, 2001, 2002, 2003
Free Software Foundation, Inc.
Written by Cygnus Support.
@@ -46,19 +46,19 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
static void coff_fix_symbol_name
PARAMS ((bfd *, asymbol *, combined_entry_type *, bfd_size_type *,
asection **, bfd_size_type *));
-static boolean coff_write_symbol
+static bfd_boolean coff_write_symbol
PARAMS ((bfd *, asymbol *, combined_entry_type *, bfd_vma *,
bfd_size_type *, asection **, bfd_size_type *));
-static boolean coff_write_alien_symbol
+static bfd_boolean coff_write_alien_symbol
PARAMS ((bfd *, asymbol *, bfd_vma *, bfd_size_type *,
asection **, bfd_size_type *));
-static boolean coff_write_native_symbol
+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 boolean make_a_section_from_file
+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 *,
@@ -74,7 +74,7 @@ static char *copy_name
/* 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 boolean
+static bfd_boolean
make_a_section_from_file (abfd, hdr, target_index)
bfd *abfd;
struct internal_scnhdr *hdr;
@@ -82,7 +82,7 @@ make_a_section_from_file (abfd, hdr, target_index)
{
asection *return_section;
char *name;
- boolean result = true;
+ bfd_boolean result = TRUE;
flagword flags;
name = NULL;
@@ -103,14 +103,14 @@ make_a_section_from_file (abfd, hdr, target_index)
{
strings = _bfd_coff_read_string_table (abfd);
if (strings == NULL)
- return false;
+ return FALSE;
/* FIXME: For extra safety, we should make sure that
strindex does not run us past the end, but right now we
don't know the length of the string table. */
strings += strindex;
name = bfd_alloc (abfd, (bfd_size_type) strlen (strings) + 1);
if (name == NULL)
- return false;
+ return FALSE;
strcpy (name, strings);
}
}
@@ -120,14 +120,14 @@ make_a_section_from_file (abfd, hdr, target_index)
/* Assorted wastage to null-terminate the name, thanks AT&T! */
name = bfd_alloc (abfd, (bfd_size_type) sizeof (hdr->s_name) + 1);
if (name == NULL)
- return false;
+ return FALSE;
strncpy (name, (char *) &hdr->s_name[0], sizeof (hdr->s_name));
name[sizeof (hdr->s_name)] = 0;
}
return_section = bfd_make_section_anyway (abfd, name);
if (return_section == NULL)
- return false;
+ return FALSE;
return_section->vma = hdr->s_vaddr;
return_section->lma = hdr->s_paddr;
@@ -147,7 +147,7 @@ make_a_section_from_file (abfd, hdr, target_index)
if (! bfd_coff_styp_to_sec_flags_hook (abfd, hdr, name, return_section,
& flags))
- result = false;
+ result = FALSE;
return_section->flags = flags;
@@ -226,7 +226,7 @@ coff_real_object_p (abfd, nscns, internal_f, internal_a)
if (! bfd_coff_set_arch_mach_hook (abfd, (PTR) internal_f))
goto fail;
- /* Now copy data as required; construct all asections etc */
+ /* Now copy data as required; construct all asections etc. */
if (nscns != 0)
{
unsigned int i;
@@ -241,8 +241,6 @@ coff_real_object_p (abfd, nscns, internal_f, internal_a)
}
}
- /* make_abs_section (abfd); */
-
return abfd->xvec;
fail:
@@ -331,7 +329,7 @@ coff_section_from_bfd_index (abfd, index)
bfd *abfd;
int index;
{
- struct sec *answer = abfd->sections;
+ struct bfd_section *answer = abfd->sections;
if (index == N_ABS)
return bfd_abs_section_ptr;
@@ -367,7 +365,7 @@ coff_get_symtab_upper_bound (abfd)
/* Canonicalize a COFF symbol table. */
long
-coff_get_symtab (abfd, alocation)
+coff_canonicalize_symtab (abfd, alocation)
bfd *abfd;
asymbol **alocation;
{
@@ -423,12 +421,12 @@ _bfd_coff_internal_syment_name (abfd, sym, buf)
}
/* Read in and swap the relocs. This returns a buffer holding the
- relocs for section SEC in file ABFD. If CACHE is true and
+ relocs for section SEC in file ABFD. If CACHE is TRUE and
INTERNAL_RELOCS is NULL, the relocs read in will be saved in case
the function is called again. If EXTERNAL_RELOCS is not NULL, it
is a buffer large enough to hold the unswapped relocs. If
INTERNAL_RELOCS is not NULL, it is a buffer large enough to hold
- the swapped relocs. If REQUIRE_INTERNAL is true, then the return
+ the swapped relocs. If REQUIRE_INTERNAL is TRUE, then the return
value must be INTERNAL_RELOCS. The function returns NULL on error. */
struct internal_reloc *
@@ -436,9 +434,9 @@ _bfd_coff_read_internal_relocs (abfd, sec, cache, external_relocs,
require_internal, internal_relocs)
bfd *abfd;
asection *sec;
- boolean cache;
+ bfd_boolean cache;
bfd_byte *external_relocs;
- boolean require_internal;
+ bfd_boolean require_internal;
struct internal_reloc *internal_relocs;
{
bfd_size_type relsz;
@@ -565,7 +563,7 @@ coff_count_linenumbers (abfd)
do
{
asection * sec = q->symbol.section->output_section;
-
+
/* Do not try to update fields in read-only sections. */
if (! bfd_is_const_section (sec))
sec->lineno_count ++;
@@ -656,7 +654,7 @@ fixup_symbol_value (abfd, coff_symbol_ptr, syment)
chain, and that the last one points to the first external symbol. We
do that here too. */
-boolean
+bfd_boolean
coff_renumber_symbols (bfd_ptr, first_undef)
bfd *bfd_ptr;
int *first_undef;
@@ -685,7 +683,7 @@ coff_renumber_symbols (bfd_ptr, first_undef)
amt = sizeof (asymbol *) * ((bfd_size_type) symbol_count + 1);
newsyms = (asymbol **) bfd_alloc (bfd_ptr, amt);
if (!newsyms)
- return false;
+ return FALSE;
bfd_ptr->outsymbols = newsyms;
for (i = 0; i < symbol_count; i++)
if ((symbol_ptr_ptr[i]->flags & BSF_NOT_AT_END) != 0
@@ -748,7 +746,7 @@ coff_renumber_symbols (bfd_ptr, first_undef)
}
obj_conv_table_size (bfd_ptr) = native_index;
- return true;
+ return TRUE;
}
/* Run thorough the symbol table again, and fix it so that all
@@ -943,7 +941,7 @@ coff_fix_symbol_name (abfd, symbol, native, string_size_p,
/* Write a symbol out to a COFF file. */
-static boolean
+static bfd_boolean
coff_write_symbol (abfd, symbol, native, written, string_size_p,
debug_string_section_p, debug_string_size_p)
bfd *abfd;
@@ -988,10 +986,10 @@ coff_write_symbol (abfd, symbol, native, written, string_size_p,
symesz = bfd_coff_symesz (abfd);
buf = bfd_alloc (abfd, symesz);
if (!buf)
- return false;
+ return FALSE;
bfd_coff_swap_sym_out (abfd, &native->u.syment, buf);
if (bfd_bwrite (buf, symesz, abfd) != symesz)
- return false;
+ return FALSE;
bfd_release (abfd, buf);
if (native->u.syment.n_numaux > 0)
@@ -1002,7 +1000,7 @@ coff_write_symbol (abfd, symbol, native, written, string_size_p,
auxesz = bfd_coff_auxesz (abfd);
buf = bfd_alloc (abfd, auxesz);
if (!buf)
- return false;
+ return FALSE;
for (j = 0; j < native->u.syment.n_numaux; j++)
{
bfd_coff_swap_aux_out (abfd,
@@ -1013,7 +1011,7 @@ coff_write_symbol (abfd, symbol, native, written, string_size_p,
native->u.syment.n_numaux,
buf);
if (bfd_bwrite (buf, auxesz, abfd) != auxesz)
- return false;
+ return FALSE;
}
bfd_release (abfd, buf);
}
@@ -1022,14 +1020,14 @@ coff_write_symbol (abfd, symbol, native, written, string_size_p,
set_index (symbol, *written);
*written += numaux + 1;
- return true;
+ return TRUE;
}
/* Write out a symbol to a COFF file that does not come from a COFF
file originally. This symbol may have been created by the linker,
or we may be linking a non COFF file to a COFF file. */
-static boolean
+static bfd_boolean
coff_write_alien_symbol (abfd, symbol, written, string_size_p,
debug_string_section_p, debug_string_size_p)
bfd *abfd;
@@ -1062,7 +1060,7 @@ coff_write_alien_symbol (abfd, symbol, written, string_size_p,
format. So, we just ignore them. We must clobber the symbol
name to keep it from being put in the string table. */
symbol->name = "";
- return true;
+ return TRUE;
}
else
{
@@ -1097,7 +1095,7 @@ coff_write_alien_symbol (abfd, symbol, written, string_size_p,
/* Write a native symbol to a COFF file. */
-static boolean
+static bfd_boolean
coff_write_native_symbol (abfd, symbol, written, string_size_p,
debug_string_section_p, debug_string_size_p)
bfd *abfd;
@@ -1153,7 +1151,7 @@ coff_write_native_symbol (abfd, symbol, written, string_size_p,
#endif
count++;
}
- symbol->done_lineno = true;
+ symbol->done_lineno = TRUE;
if (! bfd_is_const_section (symbol->symbol.section->output_section))
symbol->symbol.section->output_section->moving_line_filepos +=
@@ -1167,7 +1165,7 @@ coff_write_native_symbol (abfd, symbol, written, string_size_p,
/* Write out the COFF symbols. */
-boolean
+bfd_boolean
coff_write_symbols (abfd)
bfd *abfd;
{
@@ -1203,7 +1201,7 @@ coff_write_symbols (abfd)
/* Seek to the right place */
if (bfd_seek (abfd, obj_sym_filepos (abfd), SEEK_SET) != 0)
- return false;
+ return FALSE;
/* Output all the symbols we have */
@@ -1219,14 +1217,14 @@ coff_write_symbols (abfd)
if (!coff_write_alien_symbol (abfd, symbol, &written, &string_size,
&debug_string_section,
&debug_string_size))
- return false;
+ return FALSE;
}
else
{
if (!coff_write_native_symbol (abfd, c_symbol, &written,
&string_size, &debug_string_section,
&debug_string_size))
- return false;
+ return FALSE;
}
}
@@ -1246,7 +1244,7 @@ coff_write_symbols (abfd)
#endif
if (bfd_bwrite ((PTR) buffer, (bfd_size_type) sizeof (buffer), abfd)
!= sizeof (buffer))
- return false;
+ return FALSE;
/* Handle long section names. This code must handle section
names just as they are handled in coff_write_object_contents. */
@@ -1263,7 +1261,7 @@ coff_write_symbols (abfd)
{
if (bfd_bwrite (o->name, (bfd_size_type) (len + 1), abfd)
!= len + 1)
- return false;
+ return FALSE;
}
}
}
@@ -1304,7 +1302,7 @@ coff_write_symbols (abfd)
if (bfd_coff_force_symnames_in_strings (abfd))
{
if (bfd_bwrite (".file", (bfd_size_type) 6, abfd) != 6)
- return false;
+ return FALSE;
}
maxlen = bfd_coff_filnmlen (abfd);
}
@@ -1315,7 +1313,7 @@ coff_write_symbols (abfd)
{
if (bfd_bwrite ((PTR) (q->name), (bfd_size_type) name_length + 1,
abfd) != name_length + 1)
- return false;
+ return FALSE;
}
}
}
@@ -1334,7 +1332,7 @@ coff_write_symbols (abfd)
#endif
if (bfd_bwrite ((PTR) buffer, (bfd_size_type) STRING_SIZE_SIZE, abfd)
!= STRING_SIZE_SIZE)
- return false;
+ return FALSE;
}
/* Make sure the .debug section was created to be the correct size.
@@ -1348,10 +1346,10 @@ coff_write_symbols (abfd)
1 << debug_string_section->alignment_power)
== bfd_section_size (abfd, debug_string_section))));
- return true;
+ return TRUE;
}
-boolean
+bfd_boolean
coff_write_linenumbers (abfd)
bfd *abfd;
{
@@ -1362,14 +1360,14 @@ coff_write_linenumbers (abfd)
linesz = bfd_coff_linesz (abfd);
buff = bfd_alloc (abfd, linesz);
if (!buff)
- return false;
+ return FALSE;
for (s = abfd->sections; s != (asection *) NULL; s = s->next)
{
if (s->lineno_count)
{
asymbol **q = abfd->outsymbols;
if (bfd_seek (abfd, s->line_filepos, SEEK_SET) != 0)
- return false;
+ return FALSE;
/* Find all the linenumbers in this section */
while (*q)
{
@@ -1389,7 +1387,7 @@ coff_write_linenumbers (abfd)
bfd_coff_swap_lineno_out (abfd, &out, buff);
if (bfd_bwrite (buff, (bfd_size_type) linesz, abfd)
!= linesz)
- return false;
+ return FALSE;
l++;
while (l->line_number)
{
@@ -1398,7 +1396,7 @@ coff_write_linenumbers (abfd)
bfd_coff_swap_lineno_out (abfd, &out, buff);
if (bfd_bwrite (buff, (bfd_size_type) linesz, abfd)
!= linesz)
- return false;
+ return FALSE;
l++;
}
}
@@ -1408,7 +1406,7 @@ coff_write_linenumbers (abfd)
}
}
bfd_release (abfd, buff);
- return true;
+ return TRUE;
}
alent *
@@ -1585,7 +1583,7 @@ copy_name (abfd, name, maxlen)
/* Read in the external symbols. */
-boolean
+bfd_boolean
_bfd_coff_get_external_symbols (abfd)
bfd *abfd;
{
@@ -1594,7 +1592,7 @@ _bfd_coff_get_external_symbols (abfd)
PTR syms;
if (obj_coff_external_syms (abfd) != NULL)
- return true;
+ return TRUE;
symesz = bfd_coff_symesz (abfd);
@@ -1602,19 +1600,19 @@ _bfd_coff_get_external_symbols (abfd)
syms = (PTR) bfd_malloc (size);
if (syms == NULL && size != 0)
- return false;
+ return FALSE;
if (bfd_seek (abfd, obj_sym_filepos (abfd), SEEK_SET) != 0
|| bfd_bread (syms, size, abfd) != size)
{
if (syms != NULL)
free (syms);
- return false;
+ return FALSE;
}
obj_coff_external_syms (abfd) = syms;
- return true;
+ return TRUE;
}
/* Read in the external strings. The strings are not loaded until
@@ -1689,7 +1687,7 @@ _bfd_coff_read_string_table (abfd)
/* Free up the external symbols and strings read from a COFF file. */
-boolean
+bfd_boolean
_bfd_coff_free_symbols (abfd)
bfd *abfd;
{
@@ -1705,7 +1703,7 @@ _bfd_coff_free_symbols (abfd)
free (obj_coff_strings (abfd));
obj_coff_strings (abfd) = NULL;
}
- return true;
+ return TRUE;
}
/* Read a symbol table into freshly bfd_allocated memory, swap it, and
@@ -1777,7 +1775,7 @@ coff_get_normalized_symtab (abfd)
}
/* Free the raw symbols, but not the strings (if we have them). */
- obj_coff_keep_strings (abfd) = true;
+ obj_coff_keep_strings (abfd) = TRUE;
if (! _bfd_coff_free_symbols (abfd))
return NULL;
@@ -1909,7 +1907,7 @@ coff_make_empty_symbol (abfd)
new->symbol.section = 0;
new->native = 0;
new->lineno = (alent *) NULL;
- new->done_lineno = false;
+ new->done_lineno = FALSE;
new->symbol.the_bfd = abfd;
return &new->symbol;
}
@@ -1935,7 +1933,7 @@ coff_bfd_make_debug_symbol (abfd, ptr, sz)
new->symbol.section = bfd_abs_section_ptr;
new->symbol.flags = BSF_DEBUGGING;
new->lineno = (alent *) NULL;
- new->done_lineno = false;
+ new->done_lineno = FALSE;
new->symbol.the_bfd = abfd;
return &new->symbol;
}
@@ -1957,7 +1955,7 @@ coff_get_symbol_info (abfd, symbol, ret)
/* Return the COFF syment for a symbol. */
-boolean
+bfd_boolean
bfd_coff_get_syment (abfd, symbol, psyment)
bfd *abfd;
asymbol *symbol;
@@ -1969,7 +1967,7 @@ bfd_coff_get_syment (abfd, symbol, psyment)
if (csym == NULL || csym->native == NULL)
{
bfd_set_error (bfd_error_invalid_operation);
- return false;
+ return FALSE;
}
*psyment = csym->native->u.syment;
@@ -1980,12 +1978,12 @@ bfd_coff_get_syment (abfd, symbol, psyment)
/* FIXME: We should handle fix_line here. */
- return true;
+ return TRUE;
}
/* Return the COFF auxent for a symbol. */
-boolean
+bfd_boolean
bfd_coff_get_auxent (abfd, symbol, indx, pauxent)
bfd *abfd;
asymbol *symbol;
@@ -2002,7 +2000,7 @@ bfd_coff_get_auxent (abfd, symbol, indx, pauxent)
|| indx >= csym->native->u.syment.n_numaux)
{
bfd_set_error (bfd_error_invalid_operation);
- return false;
+ return FALSE;
}
ent = csym->native + indx + 1;
@@ -2024,7 +2022,7 @@ bfd_coff_get_auxent (abfd, symbol, indx, pauxent)
((combined_entry_type *) pauxent->x_csect.x_scnlen.p
- obj_raw_syments (abfd));
- return true;
+ return TRUE;
}
/* Print out information about COFF symbol. */
@@ -2191,19 +2189,19 @@ coff_print_symbol (abfd, filep, symbol, how)
function for the is_local_label_name entry point, but some may
override it. */
-boolean
+bfd_boolean
_bfd_coff_is_local_label_name (abfd, name)
bfd *abfd ATTRIBUTE_UNUSED;
const char *name;
{
- return (boolean) (name[0] == '.' && name[1] == 'L');
+ return name[0] == '.' && name[1] == 'L';
}
/* Provided a BFD, a section and an offset (in bytes, not octets) into the
section, calculate and return the name of the source file and the line
nearest to the wanted location. */
-boolean
+bfd_boolean
coff_find_nearest_line (abfd, section, symbols, offset, filename_ptr,
functionname_ptr, line_ptr)
bfd *abfd;
@@ -2214,7 +2212,7 @@ coff_find_nearest_line (abfd, section, symbols, offset, filename_ptr,
const char **functionname_ptr;
unsigned int *line_ptr;
{
- boolean found;
+ bfd_boolean found;
unsigned int i;
unsigned int line_base;
coff_data_type *cof = coff_data (abfd);
@@ -2231,17 +2229,17 @@ coff_find_nearest_line (abfd, section, symbols, offset, filename_ptr,
&found, filename_ptr,
functionname_ptr, line_ptr,
&coff_data(abfd)->line_info))
- return false;
+ return FALSE;
if (found)
- return true;
+ return TRUE;
/* Also try examining DWARF2 debugging information. */
if (_bfd_dwarf2_find_nearest_line (abfd, section, symbols, offset,
filename_ptr, functionname_ptr,
line_ptr, 0,
&coff_data(abfd)->dwarf2_find_line_info))
- return true;
+ return TRUE;
*filename_ptr = 0;
*functionname_ptr = 0;
@@ -2249,15 +2247,15 @@ coff_find_nearest_line (abfd, section, symbols, offset, filename_ptr,
/* Don't try and find line numbers in a non coff file */
if (!bfd_family_coff (abfd))
- return false;
+ return FALSE;
if (cof == NULL)
- return false;
+ return FALSE;
/* Find the first C_FILE symbol. */
p = cof->raw_syments;
if (!p)
- return false;
+ return FALSE;
pend = p + cof->raw_syment_count;
while (p < pend)
@@ -2410,13 +2408,13 @@ coff_find_nearest_line (abfd, section, symbols, offset, filename_ptr,
sec_data->line_base = line_base;
}
- return true;
+ return TRUE;
}
int
coff_sizeof_headers (abfd, reloc)
bfd *abfd;
- boolean reloc;
+ bfd_boolean reloc;
{
size_t size;
@@ -2434,7 +2432,7 @@ coff_sizeof_headers (abfd, reloc)
}
/* Change the class of a coff symbol held by BFD. */
-boolean
+bfd_boolean
bfd_coff_set_symbol_class (abfd, symbol, class)
bfd * abfd;
asymbol * symbol;
@@ -2446,7 +2444,7 @@ bfd_coff_set_symbol_class (abfd, symbol, class)
if (csym == NULL)
{
bfd_set_error (bfd_error_invalid_operation);
- return false;
+ return FALSE;
}
else if (csym->native == NULL)
{
@@ -2460,7 +2458,7 @@ bfd_coff_set_symbol_class (abfd, symbol, class)
native = (combined_entry_type *) bfd_zalloc (abfd, amt);
if (native == NULL)
- return false;
+ return FALSE;
native->u.syment.n_type = T_NULL;
native->u.syment.n_sclass = class;
@@ -2496,5 +2494,5 @@ bfd_coff_set_symbol_class (abfd, symbol, class)
csym->native->u.syment.n_sclass = class;
}
- return true;
+ return TRUE;
}
diff --git a/contrib/binutils/bfd/cofflink.c b/contrib/binutils/bfd/cofflink.c
index c1302ee..4ad566c 100644
--- a/contrib/binutils/bfd/cofflink.c
+++ b/contrib/binutils/bfd/cofflink.c
@@ -1,23 +1,23 @@
/* COFF specific linker code.
- Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
+ Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
Free Software Foundation, Inc.
Written by Ian Lance Taylor, Cygnus Support.
-This file is part of BFD, the Binary File Descriptor library.
+ This 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
/* This file contains the COFF backend linker code. */
@@ -27,26 +27,18 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "libbfd.h"
#include "coff/internal.h"
#include "libcoff.h"
+#include "safe-ctype.h"
-static boolean coff_link_add_object_symbols
- PARAMS ((bfd *, struct bfd_link_info *));
-static boolean coff_link_check_archive_element
- PARAMS ((bfd *, struct bfd_link_info *, boolean *));
-static boolean coff_link_check_ar_symbols
- PARAMS ((bfd *, struct bfd_link_info *, boolean *));
-static boolean coff_link_add_symbols PARAMS ((bfd *, struct bfd_link_info *));
-static char *dores_com PARAMS ((char *, bfd *, int));
-static char *get_name PARAMS ((char *, char **));
-static int process_embedded_commands
- PARAMS ((bfd *, struct bfd_link_info *, bfd *));
-static void mark_relocs PARAMS ((struct coff_final_link_info *, bfd *));
-
-/* Return true if SYM is a weak, external symbol. */
+static bfd_boolean coff_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info);
+static bfd_boolean coff_link_check_archive_element (bfd *abfd, struct bfd_link_info *info, bfd_boolean *pneeded);
+static bfd_boolean coff_link_add_symbols (bfd *abfd, struct bfd_link_info *info);
+
+/* Return TRUE if SYM is a weak, external symbol. */
#define IS_WEAK_EXTERNAL(abfd, sym) \
((sym).n_sclass == C_WEAKEXT \
|| (obj_pe (abfd) && (sym).n_sclass == C_NT_WEAK))
-/* Return true if SYM is an external symbol. */
+/* Return TRUE if SYM is an external symbol. */
#define IS_EXTERNAL(abfd, sym) \
((sym).n_sclass == C_EXT || IS_WEAK_EXTERNAL (abfd, sym))
@@ -63,10 +55,9 @@ static void mark_relocs PARAMS ((struct coff_final_link_info *, bfd *));
/* Create an entry in a COFF linker hash table. */
struct bfd_hash_entry *
-_bfd_coff_link_hash_newfunc (entry, table, string)
- struct bfd_hash_entry *entry;
- struct bfd_hash_table *table;
- const char *string;
+_bfd_coff_link_hash_newfunc (struct bfd_hash_entry *entry,
+ struct bfd_hash_table *table,
+ const char *string)
{
struct coff_link_hash_entry *ret = (struct coff_link_hash_entry *) entry;
@@ -98,13 +89,12 @@ _bfd_coff_link_hash_newfunc (entry, table, string)
/* Initialize a COFF linker hash table. */
-boolean
-_bfd_coff_link_hash_table_init (table, abfd, newfunc)
- struct coff_link_hash_table *table;
- bfd *abfd;
- struct bfd_hash_entry *(*newfunc) PARAMS ((struct bfd_hash_entry *,
- struct bfd_hash_table *,
- const char *));
+bfd_boolean
+_bfd_coff_link_hash_table_init (struct coff_link_hash_table *table,
+ bfd *abfd,
+ struct bfd_hash_entry *(*newfunc) (struct bfd_hash_entry *,
+ struct bfd_hash_table *,
+ const char *))
{
table->stab_info = NULL;
return _bfd_link_hash_table_init (&table->root, abfd, newfunc);
@@ -113,15 +103,15 @@ _bfd_coff_link_hash_table_init (table, abfd, newfunc)
/* Create a COFF linker hash table. */
struct bfd_link_hash_table *
-_bfd_coff_link_hash_table_create (abfd)
- bfd *abfd;
+_bfd_coff_link_hash_table_create (bfd *abfd)
{
struct coff_link_hash_table *ret;
bfd_size_type amt = sizeof (struct coff_link_hash_table);
- ret = (struct coff_link_hash_table *) bfd_malloc (amt);
+ ret = bfd_malloc (amt);
if (ret == NULL)
return NULL;
+
if (! _bfd_coff_link_hash_table_init (ret, abfd,
_bfd_coff_link_hash_newfunc))
{
@@ -134,10 +124,9 @@ _bfd_coff_link_hash_table_create (abfd)
/* Create an entry in a COFF debug merge hash table. */
struct bfd_hash_entry *
-_bfd_coff_debug_merge_hash_newfunc (entry, table, string)
- struct bfd_hash_entry *entry;
- struct bfd_hash_table *table;
- const char *string;
+_bfd_coff_debug_merge_hash_newfunc (struct bfd_hash_entry *entry,
+ struct bfd_hash_table *table,
+ const char *string)
{
struct coff_debug_merge_hash_entry *ret =
(struct coff_debug_merge_hash_entry *) entry;
@@ -166,90 +155,52 @@ _bfd_coff_debug_merge_hash_newfunc (entry, table, string)
/* Given a COFF BFD, add symbols to the global hash table as
appropriate. */
-boolean
-_bfd_coff_link_add_symbols (abfd, info)
- bfd *abfd;
- struct bfd_link_info *info;
+bfd_boolean
+_bfd_coff_link_add_symbols (bfd *abfd, struct bfd_link_info *info)
{
switch (bfd_get_format (abfd))
{
case bfd_object:
return coff_link_add_object_symbols (abfd, info);
case bfd_archive:
- return (_bfd_generic_link_add_archive_symbols
- (abfd, info, coff_link_check_archive_element));
+ return _bfd_generic_link_add_archive_symbols
+ (abfd, info, coff_link_check_archive_element);
default:
bfd_set_error (bfd_error_wrong_format);
- return false;
+ return FALSE;
}
}
/* Add symbols from a COFF object file. */
-static boolean
-coff_link_add_object_symbols (abfd, info)
- bfd *abfd;
- struct bfd_link_info *info;
+static bfd_boolean
+coff_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info)
{
if (! _bfd_coff_get_external_symbols (abfd))
- return false;
+ return FALSE;
if (! coff_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 boolean
-coff_link_check_archive_element (abfd, info, pneeded)
- bfd *abfd;
- struct bfd_link_info *info;
- boolean *pneeded;
-{
- if (! _bfd_coff_get_external_symbols (abfd))
- return false;
+ return FALSE;
- if (! coff_link_check_ar_symbols (abfd, info, pneeded))
- return false;
-
- if (*pneeded)
- {
- if (! coff_link_add_symbols (abfd, info))
- return false;
- }
-
- if (! info->keep_memory || ! *pneeded)
- {
- if (! _bfd_coff_free_symbols (abfd))
- return false;
- }
+ if (! info->keep_memory
+ && ! _bfd_coff_free_symbols (abfd))
+ return FALSE;
- return true;
+ return TRUE;
}
/* Look through the symbols to see if this object file should be
included in the link. */
-static boolean
-coff_link_check_ar_symbols (abfd, info, pneeded)
- bfd *abfd;
- struct bfd_link_info *info;
- boolean *pneeded;
+static bfd_boolean
+coff_link_check_ar_symbols (bfd *abfd,
+ struct bfd_link_info *info,
+ bfd_boolean *pneeded)
{
bfd_size_type symesz;
bfd_byte *esym;
bfd_byte *esym_end;
- *pneeded = false;
+ *pneeded = FALSE;
symesz = bfd_coff_symesz (abfd);
esym = (bfd_byte *) obj_coff_external_syms (abfd);
@@ -259,7 +210,7 @@ coff_link_check_ar_symbols (abfd, info, pneeded)
struct internal_syment sym;
enum coff_symbol_classification classification;
- bfd_coff_swap_sym_in (abfd, (PTR) esym, (PTR) &sym);
+ bfd_coff_swap_sym_in (abfd, esym, &sym);
classification = bfd_coff_classify_symbol (abfd, &sym);
if (classification == COFF_SYMBOL_GLOBAL
@@ -271,22 +222,17 @@ coff_link_check_ar_symbols (abfd, info, pneeded)
/* 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);
+ return FALSE;
+ h = bfd_link_hash_lookup (info->hash, name, FALSE, FALSE, TRUE);
+
+ /* Auto import. */
+ if (!h
+ && info->pei386_auto_import
+ && !strncmp (name,"__imp_", 6))
+ h = bfd_link_hash_lookup (info->hash, name + 6, FALSE, FALSE, TRUE);
- /* auto import */
- if (!h && info->pei386_auto_import)
- {
- if (!strncmp (name,"__imp_", 6))
- {
- h =
- bfd_link_hash_lookup (info->hash, name + 6, false, false,
- true);
- }
- }
/* We are only interested in symbols that are currently
undefined. If a symbol is currently known to be common,
COFF linkers do not bring in an object file which defines
@@ -295,9 +241,9 @@ coff_link_check_ar_symbols (abfd, info, pneeded)
&& h->type == bfd_link_hash_undefined)
{
if (! (*info->callbacks->add_archive_element) (info, abfd, name))
- return false;
- *pneeded = true;
- return true;
+ return FALSE;
+ *pneeded = TRUE;
+ return TRUE;
}
}
@@ -305,21 +251,47 @@ coff_link_check_ar_symbols (abfd, info, pneeded)
}
/* We do not need this object file. */
- return true;
+ return TRUE;
+}
+
+/* Check a single archive element to see if we need to include it in
+ the link. *PNEEDED is set according to whether this element is
+ needed in the link or not. This is called via
+ _bfd_generic_link_add_archive_symbols. */
+
+static bfd_boolean
+coff_link_check_archive_element (bfd *abfd,
+ struct bfd_link_info *info,
+ bfd_boolean *pneeded)
+{
+ if (! _bfd_coff_get_external_symbols (abfd))
+ return FALSE;
+
+ if (! coff_link_check_ar_symbols (abfd, info, pneeded))
+ return FALSE;
+
+ if (*pneeded
+ && ! coff_link_add_symbols (abfd, info))
+ return FALSE;
+
+ if ((! info->keep_memory || ! *pneeded)
+ && ! _bfd_coff_free_symbols (abfd))
+ return FALSE;
+
+ return TRUE;
}
/* Add all the symbols from an object file to the hash table. */
-static boolean
-coff_link_add_symbols (abfd, info)
- bfd *abfd;
- struct bfd_link_info *info;
+static bfd_boolean
+coff_link_add_symbols (bfd *abfd,
+ struct bfd_link_info *info)
{
unsigned int n_tmask = coff_data (abfd)->local_n_tmask;
unsigned int n_btshft = coff_data (abfd)->local_n_btshft;
unsigned int n_btmask = coff_data (abfd)->local_n_btmask;
- boolean keep_syms;
- boolean default_copy;
+ bfd_boolean keep_syms;
+ bfd_boolean default_copy;
bfd_size_type symcount;
struct coff_link_hash_entry **sym_hash;
bfd_size_type symesz;
@@ -330,19 +302,19 @@ coff_link_add_symbols (abfd, info)
/* Keep the symbols during this function, in case the linker needs
to read the generic symbols in order to report an error message. */
keep_syms = obj_coff_keep_syms (abfd);
- obj_coff_keep_syms (abfd) = true;
+ obj_coff_keep_syms (abfd) = TRUE;
if (info->keep_memory)
- default_copy = false;
+ default_copy = FALSE;
else
- default_copy = true;
+ default_copy = TRUE;
symcount = obj_raw_syment_count (abfd);
/* We keep a list of the linker hash table entries that correspond
to particular symbols. */
amt = symcount * sizeof (struct coff_link_hash_entry *);
- sym_hash = (struct coff_link_hash_entry **) bfd_zalloc (abfd, amt);
+ sym_hash = bfd_zalloc (abfd, amt);
if (sym_hash == NULL && symcount != 0)
goto error_return;
obj_coff_sym_hashes (abfd) = sym_hash;
@@ -355,9 +327,9 @@ coff_link_add_symbols (abfd, info)
{
struct internal_syment sym;
enum coff_symbol_classification classification;
- boolean copy;
+ bfd_boolean copy;
- bfd_coff_swap_sym_in (abfd, (PTR) esym, (PTR) &sym);
+ bfd_coff_swap_sym_in (abfd, esym, &sym);
classification = bfd_coff_classify_symbol (abfd, &sym);
if (classification != COFF_SYMBOL_LOCAL)
@@ -367,7 +339,7 @@ coff_link_add_symbols (abfd, info)
flagword flags;
asection *section;
bfd_vma value;
- boolean addit;
+ bfd_boolean addit;
/* This symbol is externally visible. */
@@ -380,7 +352,7 @@ coff_link_add_symbols (abfd, info)
copy = default_copy;
if (sym._n._n_n._n_zeroes != 0
|| sym._n._n_n._n_offset == 0)
- copy = true;
+ copy = TRUE;
value = sym.n_value;
@@ -415,7 +387,7 @@ coff_link_add_symbols (abfd, info)
if (IS_WEAK_EXTERNAL (abfd, sym))
flags = BSF_WEAK;
- addit = true;
+ addit = TRUE;
/* In the PE format, section symbols actually refer to the
start of the output section. We handle them specially
@@ -423,7 +395,7 @@ coff_link_add_symbols (abfd, info)
if (obj_pe (abfd) && (flags & BSF_SECTION_SYM) != 0)
{
*sym_hash = coff_link_hash_lookup (coff_hash_table (info),
- name, false, copy, false);
+ name, FALSE, copy, FALSE);
if (*sym_hash != NULL)
{
if (((*sym_hash)->coff_link_hash_flags
@@ -434,7 +406,7 @@ coff_link_add_symbols (abfd, info)
("Warning: symbol `%s' is both section and non-section",
name);
- addit = false;
+ addit = FALSE;
}
}
@@ -469,20 +441,20 @@ coff_link_add_symbols (abfd, info)
{
if (*sym_hash == NULL)
*sym_hash = coff_link_hash_lookup (coff_hash_table (info),
- name, false, copy, false);
+ name, FALSE, copy, FALSE);
if (*sym_hash != NULL
&& (*sym_hash)->root.type == bfd_link_hash_defined
&& (*sym_hash)->root.u.def.section->comdat != NULL
&& strcmp ((*sym_hash)->root.u.def.section->comdat->name,
section->comdat->name) == 0)
- addit = false;
+ addit = FALSE;
}
if (addit)
{
if (! (bfd_coff_link_add_one_symbol
(info, abfd, name, flags, section, value,
- (const char *) NULL, copy, false,
+ (const char *) NULL, copy, FALSE,
(struct bfd_link_hash_entry **) sym_hash)))
goto error_return;
}
@@ -560,9 +532,9 @@ coff_link_add_symbols (abfd, info)
for (i = 0, eaux = esym + symesz, iaux = alloc;
i < sym.n_numaux;
i++, eaux += symesz, iaux++)
- bfd_coff_swap_aux_in (abfd, (PTR) eaux, sym.n_type,
+ bfd_coff_swap_aux_in (abfd, eaux, sym.n_type,
sym.n_sclass, (int) i,
- sym.n_numaux, (PTR) iaux);
+ sym.n_numaux, iaux);
(*sym_hash)->aux = alloc;
}
}
@@ -578,7 +550,6 @@ coff_link_add_symbols (abfd, info)
FIXME: This is not at all the right place to do this.
For example, it won't help objdump. This needs to be
done when we swap in the section header. */
-
BFD_ASSERT ((*sym_hash)->numaux == 1);
if (section->_raw_size == 0)
section->_raw_size = (*sym_hash)->aux[0].x_scn.x_scnlen;
@@ -593,30 +564,35 @@ coff_link_add_symbols (abfd, info)
sym_hash += sym.n_numaux + 1;
}
- /* If this is a non-traditional, non-relocateable link, try to
+ /* If this is a non-traditional, non-relocatable link, try to
optimize the handling of any .stab/.stabstr sections. */
- if (! info->relocateable
+ if (! info->relocatable
&& ! info->traditional_format
&& info->hash->creator->flavour == bfd_get_flavour (abfd)
&& (info->strip != strip_all && info->strip != strip_debugger))
{
- asection *stab, *stabstr;
+ asection *stabstr;
- stab = bfd_get_section_by_name (abfd, ".stab");
- if (stab != NULL)
- {
- stabstr = bfd_get_section_by_name (abfd, ".stabstr");
+ stabstr = bfd_get_section_by_name (abfd, ".stabstr");
- if (stabstr != NULL)
+ if (stabstr != NULL)
+ {
+ bfd_size_type string_offset = 0;
+ asection *stab;
+
+ for (stab = abfd->sections; stab; stab = stab->next)
+ if (strncmp (".stab", stab->name, 5) == 0
+ && (!stab->name[5]
+ || (stab->name[5] == '.' && ISDIGIT (stab->name[6]))))
{
struct coff_link_hash_table *table;
- struct coff_section_tdata *secdata;
-
- secdata = coff_section_data (abfd, stab);
+ struct coff_section_tdata *secdata
+ = coff_section_data (abfd, stab);
+
if (secdata == NULL)
{
amt = sizeof (struct coff_section_tdata);
- stab->used_by_bfd = (PTR) bfd_zalloc (abfd, amt);
+ stab->used_by_bfd = bfd_zalloc (abfd, amt);
if (stab->used_by_bfd == NULL)
goto error_return;
secdata = coff_section_data (abfd, stab);
@@ -626,7 +602,8 @@ coff_link_add_symbols (abfd, info)
if (! _bfd_link_section_stabs (abfd, &table->stab_info,
stab, stabstr,
- &secdata->stab_info))
+ &secdata->stab_info,
+ &string_offset))
goto error_return;
}
}
@@ -634,24 +611,23 @@ coff_link_add_symbols (abfd, info)
obj_coff_keep_syms (abfd) = keep_syms;
- return true;
+ return TRUE;
error_return:
obj_coff_keep_syms (abfd) = keep_syms;
- return false;
+ return FALSE;
}
/* Do the final link step. */
-boolean
-_bfd_coff_final_link (abfd, info)
- bfd *abfd;
- struct bfd_link_info *info;
+bfd_boolean
+_bfd_coff_final_link (bfd *abfd,
+ struct bfd_link_info *info)
{
bfd_size_type symesz;
struct coff_final_link_info finfo;
- boolean debug_merge_allocated;
- boolean long_section_names;
+ bfd_boolean debug_merge_allocated;
+ bfd_boolean long_section_names;
asection *o;
struct bfd_link_order *p;
bfd_size_type max_sym_count;
@@ -684,8 +660,8 @@ _bfd_coff_final_link (abfd, info)
finfo.contents = NULL;
finfo.external_relocs = NULL;
finfo.internal_relocs = NULL;
- finfo.global_to_static = false;
- debug_merge_allocated = false;
+ finfo.global_to_static = FALSE;
+ debug_merge_allocated = FALSE;
coff_data (abfd)->link_info = info;
@@ -695,7 +671,7 @@ _bfd_coff_final_link (abfd, info)
if (! coff_debug_merge_hash_table_init (&finfo.debug_merge))
goto error_return;
- debug_merge_allocated = true;
+ debug_merge_allocated = TRUE;
/* Compute the file positions for all the sections. */
if (! abfd->output_has_begun)
@@ -712,7 +688,7 @@ _bfd_coff_final_link (abfd, info)
max_lineno_count = 0;
max_reloc_count = 0;
- long_section_names = false;
+ long_section_names = FALSE;
for (o = abfd->sections; o != NULL; o = o->next)
{
o->reloc_count = 0;
@@ -729,13 +705,13 @@ _bfd_coff_final_link (abfd, info)
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;
+ sec->linker_mark = TRUE;
if (info->strip == strip_none
|| info->strip == strip_some)
o->lineno_count += sec->lineno_count;
- if (info->relocateable)
+ if (info->relocatable)
o->reloc_count += sec->reloc_count;
if (sec->_raw_size > max_contents_size)
@@ -745,7 +721,7 @@ _bfd_coff_final_link (abfd, info)
if (sec->reloc_count > max_reloc_count)
max_reloc_count = sec->reloc_count;
}
- else if (info->relocateable
+ else if (info->relocatable
&& (p->type == bfd_section_reloc_link_order
|| p->type == bfd_symbol_reloc_link_order))
++o->reloc_count;
@@ -770,17 +746,17 @@ _bfd_coff_final_link (abfd, info)
table. This must correspond to the code in
coff_write_object_contents which puts the string index
into the s_name field of the section header. That is why
- we pass hash as false. */
- if (_bfd_stringtab_add (finfo.strtab, o->name, false, false)
+ we pass hash as FALSE. */
+ if (_bfd_stringtab_add (finfo.strtab, o->name, FALSE, FALSE)
== (bfd_size_type) -1)
goto error_return;
- long_section_names = true;
+ long_section_names = TRUE;
}
}
- /* If doing a relocateable link, allocate space for the pointers we
+ /* If doing a relocatable link, allocate space for the pointers we
need to keep. */
- if (info->relocateable)
+ if (info->relocatable)
{
unsigned int i;
@@ -788,7 +764,7 @@ _bfd_coff_final_link (abfd, info)
the target_index fields are 1 based. */
amt = abfd->section_count + 1;
amt *= sizeof (struct coff_link_section_info);
- finfo.section_info = (struct coff_link_section_info *) bfd_malloc (amt);
+ finfo.section_info = bfd_malloc (amt);
if (finfo.section_info == NULL)
goto error_return;
for (i = 0; i <= abfd->section_count; i++)
@@ -826,17 +802,15 @@ _bfd_coff_final_link (abfd, info)
Because of this problem, we also keep the relocs in
memory until the end of the link. This wastes memory,
- but only when doing a relocateable link, which is not the
+ but only when doing a relocatable link, which is not the
common case. */
- BFD_ASSERT (info->relocateable);
+ BFD_ASSERT (info->relocatable);
amt = o->reloc_count;
amt *= sizeof (struct internal_reloc);
- finfo.section_info[o->target_index].relocs =
- (struct internal_reloc *) bfd_malloc (amt);
+ finfo.section_info[o->target_index].relocs = bfd_malloc (amt);
amt = o->reloc_count;
amt *= sizeof (struct coff_link_hash_entry *);
- finfo.section_info[o->target_index].rel_hashes =
- (struct coff_link_hash_entry **) bfd_malloc (amt);
+ 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;
@@ -861,7 +835,7 @@ _bfd_coff_final_link (abfd, info)
{
size_t sz;
- sub->output_has_begun = false;
+ sub->output_has_begun = FALSE;
sz = obj_raw_syment_count (sub);
if (sz > max_sym_count)
max_sym_count = sz;
@@ -869,21 +843,21 @@ _bfd_coff_final_link (abfd, info)
/* Allocate some buffers used while linking. */
amt = max_sym_count * sizeof (struct internal_syment);
- finfo.internal_syms = (struct internal_syment *) bfd_malloc (amt);
+ finfo.internal_syms = bfd_malloc (amt);
amt = max_sym_count * sizeof (asection *);
- finfo.sec_ptrs = (asection **) bfd_malloc (amt);
+ finfo.sec_ptrs = bfd_malloc (amt);
amt = max_sym_count * sizeof (long);
- finfo.sym_indices = (long *) bfd_malloc (amt);
- finfo.outsyms = (bfd_byte *) bfd_malloc ((max_sym_count + 1) * symesz);
+ finfo.sym_indices = bfd_malloc (amt);
+ finfo.outsyms = bfd_malloc ((max_sym_count + 1) * symesz);
amt = max_lineno_count * bfd_coff_linesz (abfd);
- finfo.linenos = (bfd_byte *) bfd_malloc (amt);
- finfo.contents = (bfd_byte *) bfd_malloc (max_contents_size);
+ finfo.linenos = bfd_malloc (amt);
+ finfo.contents = bfd_malloc (max_contents_size);
amt = max_reloc_count * relsz;
- finfo.external_relocs = (bfd_byte *) bfd_malloc (amt);
- if (! info->relocateable)
+ finfo.external_relocs = bfd_malloc (amt);
+ if (! info->relocatable)
{
amt = max_reloc_count * sizeof (struct internal_reloc);
- finfo.internal_relocs = (struct internal_reloc *) bfd_malloc (amt);
+ finfo.internal_relocs = bfd_malloc (amt);
}
if ((finfo.internal_syms == NULL && max_sym_count > 0)
|| (finfo.sec_ptrs == NULL && max_sym_count > 0)
@@ -892,7 +866,7 @@ _bfd_coff_final_link (abfd, info)
|| (finfo.linenos == NULL && max_lineno_count > 0)
|| (finfo.contents == NULL && max_contents_size > 0)
|| (finfo.external_relocs == NULL && max_reloc_count > 0)
- || (! info->relocateable
+ || (! info->relocatable
&& finfo.internal_relocs == NULL
&& max_reloc_count > 0))
goto error_return;
@@ -922,7 +896,7 @@ _bfd_coff_final_link (abfd, info)
{
if (! _bfd_coff_link_input_bfd (&finfo, sub))
goto error_return;
- sub->output_has_begun = true;
+ sub->output_has_begun = TRUE;
}
}
else if (p->type == bfd_section_reloc_link_order
@@ -945,7 +919,7 @@ _bfd_coff_final_link (abfd, info)
/* Free up the buffers used by _bfd_coff_link_input_bfd. */
coff_debug_merge_hash_table_free (&finfo.debug_merge);
- debug_merge_allocated = false;
+ debug_merge_allocated = FALSE;
if (finfo.internal_syms != NULL)
{
@@ -992,13 +966,13 @@ _bfd_coff_final_link (abfd, info)
file_ptr pos;
finfo.last_file.n_value = obj_raw_syment_count (abfd);
- bfd_coff_swap_sym_out (abfd, (PTR) &finfo.last_file,
- (PTR) finfo.outsyms);
+ bfd_coff_swap_sym_out (abfd, &finfo.last_file,
+ finfo.outsyms);
pos = obj_sym_filepos (abfd) + finfo.last_file_index * symesz;
if (bfd_seek (abfd, pos, SEEK_SET) != 0
|| bfd_bwrite (finfo.outsyms, symesz, abfd) != symesz)
- return false;
+ return FALSE;
}
/* If doing task linking (ld --task-link) then make a pass through the
@@ -1006,19 +980,17 @@ _bfd_coff_final_link (abfd, info)
static. */
if (info->task_link)
{
- finfo.failed = false;
+ finfo.failed = FALSE;
coff_link_hash_traverse (coff_hash_table (info),
- _bfd_coff_write_task_globals,
- (PTR) &finfo);
+ _bfd_coff_write_task_globals, &finfo);
if (finfo.failed)
goto error_return;
}
/* Write out the global symbols. */
- finfo.failed = false;
+ finfo.failed = FALSE;
coff_link_hash_traverse (coff_hash_table (info),
- _bfd_coff_write_global_sym,
- (PTR) &finfo);
+ _bfd_coff_write_global_sym, &finfo);
if (finfo.failed)
goto error_return;
@@ -1029,13 +1001,13 @@ _bfd_coff_final_link (abfd, info)
finfo.outsyms = NULL;
}
- if (info->relocateable && max_output_reloc_count > 0)
+ if (info->relocatable && max_output_reloc_count > 0)
{
/* Now that we have written out all the global symbols, we know
the symbol indices to use for relocs against them, and we can
finally write out the relocs. */
amt = max_output_reloc_count * relsz;
- external_relocs = (bfd_byte *) bfd_malloc (amt);
+ external_relocs = bfd_malloc (amt);
if (external_relocs == NULL)
goto error_return;
@@ -1060,13 +1032,30 @@ _bfd_coff_final_link (abfd, info)
BFD_ASSERT ((*rel_hash)->indx >= 0);
irel->r_symndx = (*rel_hash)->indx;
}
- bfd_coff_swap_reloc_out (abfd, (PTR) irel, (PTR) erel);
+ bfd_coff_swap_reloc_out (abfd, irel, erel);
}
- if (bfd_seek (abfd, o->rel_filepos, SEEK_SET) != 0
- || (bfd_bwrite ((PTR) external_relocs,
- (bfd_size_type) relsz * o->reloc_count, abfd)
- != (bfd_size_type) relsz * o->reloc_count))
+ if (bfd_seek (abfd, o->rel_filepos, SEEK_SET) != 0)
+ goto error_return;
+ if (obj_pe (abfd) && o->reloc_count >= 0xffff)
+ {
+ /* In PE COFF, write the count of relocs as the first
+ reloc. The header overflow bit will be set
+ elsewhere. */
+ struct internal_reloc incount;
+ bfd_byte *excount = (bfd_byte *)bfd_malloc (relsz);
+
+ memset (&incount, 0, sizeof (incount));
+ incount.r_vaddr = o->reloc_count + 1;
+ bfd_coff_swap_reloc_out (abfd, (PTR) &incount, (PTR) excount);
+ if (bfd_bwrite (excount, relsz, abfd) != relsz)
+ /* We'll leak, but it's an error anyway. */
+ goto error_return;
+ free (excount);
+ }
+ if (bfd_bwrite (external_relocs,
+ (bfd_size_type) relsz * o->reloc_count, abfd)
+ != (bfd_size_type) relsz * o->reloc_count)
goto error_return;
}
@@ -1094,7 +1083,7 @@ _bfd_coff_final_link (abfd, info)
if (coff_hash_table (info)->stab_info != NULL)
{
if (! _bfd_write_stab_strings (abfd, &coff_hash_table (info)->stab_info))
- return false;
+ return FALSE;
}
/* Write out the string table. */
@@ -1104,7 +1093,7 @@ _bfd_coff_final_link (abfd, info)
pos = obj_sym_filepos (abfd) + obj_raw_syment_count (abfd) * symesz;
if (bfd_seek (abfd, pos, SEEK_SET) != 0)
- return false;
+ return FALSE;
#if STRING_SIZE_SIZE == 4
H_PUT_32 (abfd,
@@ -1116,12 +1105,12 @@ _bfd_coff_final_link (abfd, info)
if (bfd_bwrite (strbuf, (bfd_size_type) STRING_SIZE_SIZE, abfd)
!= STRING_SIZE_SIZE)
- return false;
+ return FALSE;
if (! _bfd_stringtab_emit (abfd, finfo.strtab))
- return false;
+ return FALSE;
- obj_coff_strings_written (abfd) = true;
+ obj_coff_strings_written (abfd) = TRUE;
}
_bfd_stringtab_free (finfo.strtab);
@@ -1130,7 +1119,7 @@ _bfd_coff_final_link (abfd, info)
not try to write out the symbols. */
bfd_get_symcount (abfd) = 0;
- return true;
+ return TRUE;
error_return:
if (debug_merge_allocated)
@@ -1168,20 +1157,18 @@ _bfd_coff_final_link (abfd, info)
free (finfo.internal_relocs);
if (external_relocs != NULL)
free (external_relocs);
- return false;
+ return FALSE;
}
-/* parse out a -heap <reserved>,<commit> line */
+/* Parse out a -heap <reserved>,<commit> line. */
static char *
-dores_com (ptr, output_bfd, heap)
- char *ptr;
- bfd *output_bfd;
- int heap;
+dores_com (char *ptr, bfd *output_bfd, int heap)
{
if (coff_data(output_bfd)->pe)
{
int val = strtoul (ptr, &ptr, 0);
+
if (heap)
pe_data(output_bfd)->pe_opthdr.SizeOfHeapReserve = val;
else
@@ -1199,9 +1186,8 @@ dores_com (ptr, output_bfd, heap)
return ptr;
}
-static char *get_name(ptr, dst)
-char *ptr;
-char **dst;
+static char *
+get_name (char *ptr, char **dst)
{
while (*ptr == ' ')
ptr++;
@@ -1212,85 +1198,89 @@ char **dst;
return ptr+1;
}
-/* Process any magic embedded commands in a section called .drectve */
+/* Process any magic embedded commands in a section called .drectve. */
static int
-process_embedded_commands (output_bfd, info, abfd)
- bfd *output_bfd;
- struct bfd_link_info *info ATTRIBUTE_UNUSED;
- bfd *abfd;
+process_embedded_commands (bfd *output_bfd,
+ struct bfd_link_info *info ATTRIBUTE_UNUSED,
+ bfd *abfd)
{
asection *sec = bfd_get_section_by_name (abfd, ".drectve");
char *s;
char *e;
char *copy;
+
if (!sec)
return 1;
copy = bfd_malloc (sec->_raw_size);
if (!copy)
return 0;
- if (! bfd_get_section_contents(abfd, sec, copy, (bfd_vma) 0, sec->_raw_size))
+
+ if (! bfd_get_section_contents (abfd, sec, copy, (bfd_vma) 0, sec->_raw_size))
{
free (copy);
return 0;
}
e = copy + sec->_raw_size;
+
for (s = copy; s < e ; )
{
- if (s[0]!= '-') {
- s++;
- continue;
- }
+ if (s[0]!= '-')
+ {
+ s++;
+ continue;
+ }
if (strncmp (s,"-attr", 5) == 0)
{
char *name;
char *attribs;
asection *asec;
-
int loop = 1;
int had_write = 0;
int had_read = 0;
int had_exec= 0;
int had_shared= 0;
+
s += 5;
- s = get_name(s, &name);
- s = get_name(s, &attribs);
- while (loop) {
- switch (*attribs++)
- {
- case 'W':
- had_write = 1;
- break;
- case 'R':
- had_read = 1;
- break;
- case 'S':
- had_shared = 1;
- break;
- case 'X':
- had_exec = 1;
- break;
- default:
- loop = 0;
- }
- }
+ s = get_name (s, &name);
+ s = get_name (s, &attribs);
+
+ while (loop)
+ {
+ switch (*attribs++)
+ {
+ case 'W':
+ had_write = 1;
+ break;
+ case 'R':
+ had_read = 1;
+ break;
+ case 'S':
+ had_shared = 1;
+ break;
+ case 'X':
+ had_exec = 1;
+ break;
+ default:
+ loop = 0;
+ }
+ }
asec = bfd_get_section_by_name (abfd, name);
- if (asec) {
- if (had_exec)
- asec->flags |= SEC_CODE;
- if (!had_write)
- asec->flags |= SEC_READONLY;
- }
+ if (asec)
+ {
+ if (had_exec)
+ asec->flags |= SEC_CODE;
+ if (!had_write)
+ asec->flags |= SEC_READONLY;
+ }
}
else if (strncmp (s,"-heap", 5) == 0)
- {
- s = dores_com (s+5, output_bfd, 1);
- }
+ s = dores_com (s+5, output_bfd, 1);
+
else if (strncmp (s,"-stack", 6) == 0)
- {
- s = dores_com (s+6, output_bfd, 0);
- }
+ s = dores_com (s+6, output_bfd, 0);
+
else
s++;
}
@@ -1301,13 +1291,10 @@ process_embedded_commands (output_bfd, info, abfd)
/* Place a marker against all symbols which are used by relocations.
This marker can be picked up by the 'do we skip this symbol ?'
loop in _bfd_coff_link_input_bfd() and used to prevent skipping
- that symbol.
- */
+ that symbol. */
static void
-mark_relocs (finfo, input_bfd)
- struct coff_final_link_info * finfo;
- bfd * input_bfd;
+mark_relocs (struct coff_final_link_info *finfo, bfd *input_bfd)
{
asection * a;
@@ -1328,10 +1315,10 @@ mark_relocs (finfo, input_bfd)
/* Read in the relocs. */
internal_relocs = _bfd_coff_read_internal_relocs
- (input_bfd, a, false,
+ (input_bfd, a, FALSE,
finfo->external_relocs,
- finfo->info->relocateable,
- (finfo->info->relocateable
+ finfo->info->relocatable,
+ (finfo->info->relocatable
? (finfo->section_info[ a->output_section->target_index ].relocs + a->output_section->reloc_count)
: finfo->internal_relocs)
);
@@ -1345,35 +1332,30 @@ mark_relocs (finfo, input_bfd)
/* Place a mark in the sym_indices array (whose entries have
been initialised to 0) for all of the symbols that are used
in the relocation table. This will then be picked up in the
- skip/don't pass */
-
+ skip/don't-skip pass. */
for (; irel < irelend; irel++)
- {
- finfo->sym_indices[ irel->r_symndx ] = -1;
- }
+ finfo->sym_indices[ irel->r_symndx ] = -1;
}
}
/* Link an input file into the linker output file. This function
handles all the sections and relocations of the input file at once. */
-boolean
-_bfd_coff_link_input_bfd (finfo, input_bfd)
- struct coff_final_link_info *finfo;
- bfd *input_bfd;
+bfd_boolean
+_bfd_coff_link_input_bfd (struct coff_final_link_info *finfo, bfd *input_bfd)
{
unsigned int n_tmask = coff_data (input_bfd)->local_n_tmask;
unsigned int n_btshft = coff_data (input_bfd)->local_n_btshft;
#if 0
unsigned int n_btmask = coff_data (input_bfd)->local_n_btmask;
#endif
- boolean (*adjust_symndx) PARAMS ((bfd *, struct bfd_link_info *, bfd *,
- asection *, struct internal_reloc *,
- boolean *));
+ bfd_boolean (*adjust_symndx)
+ (bfd *, struct bfd_link_info *, bfd *, asection *,
+ struct internal_reloc *, bfd_boolean *);
bfd *output_bfd;
const char *strings;
bfd_size_type syment_base;
- boolean copy, hash;
+ bfd_boolean copy, hash;
bfd_size_type isymesz;
bfd_size_type osymesz;
bfd_size_type linesz;
@@ -1397,15 +1379,15 @@ _bfd_coff_link_input_bfd (finfo, input_bfd)
linesz = bfd_coff_linesz (input_bfd);
BFD_ASSERT (linesz == bfd_coff_linesz (output_bfd));
- copy = false;
+ copy = FALSE;
if (! finfo->info->keep_memory)
- copy = true;
- hash = true;
+ copy = TRUE;
+ hash = TRUE;
if ((output_bfd->flags & BFD_TRADITIONAL_FORMAT) != 0)
- hash = false;
+ hash = FALSE;
if (! _bfd_coff_get_external_symbols (input_bfd))
- return false;
+ return FALSE;
esym = (bfd_byte *) obj_coff_external_syms (input_bfd);
esym_end = esym + obj_raw_syment_count (input_bfd) * isymesz;
@@ -1415,20 +1397,18 @@ _bfd_coff_link_input_bfd (finfo, input_bfd)
output_index = syment_base;
outsym = finfo->outsyms;
- if (coff_data (output_bfd)->pe)
- {
- if (! process_embedded_commands (output_bfd, finfo->info, input_bfd))
- return false;
- }
+ if (coff_data (output_bfd)->pe
+ && ! process_embedded_commands (output_bfd, finfo->info, input_bfd))
+ return FALSE;
- /* If we are going to perform relocations and also strip/discard some symbols
- then we must make sure that we do not strip/discard those symbols that are
- going to be involved in the relocations */
+ /* If we are going to perform relocations and also strip/discard some
+ symbols then we must make sure that we do not strip/discard those
+ symbols that are going to be involved in the relocations. */
if (( finfo->info->strip != strip_none
|| finfo->info->discard != discard_none)
- && finfo->info->relocateable)
+ && finfo->info->relocatable)
{
- /* mark the symbol array as 'not-used' */
+ /* Mark the symbol array as 'not-used'. */
memset (indexp, 0, obj_raw_syment_count (input_bfd) * sizeof * indexp);
mark_relocs (finfo, input_bfd);
@@ -1438,12 +1418,12 @@ _bfd_coff_link_input_bfd (finfo, input_bfd)
{
struct internal_syment isym;
enum coff_symbol_classification classification;
- boolean skip;
- boolean global;
- boolean dont_skip_symbol;
+ bfd_boolean skip;
+ bfd_boolean global;
+ bfd_boolean dont_skip_symbol;
int add;
- bfd_coff_swap_sym_in (input_bfd, (PTR) esym, (PTR) isymp);
+ bfd_coff_swap_sym_in (input_bfd, esym, isymp);
/* Make a copy of *isymp so that the relocate_section function
always sees the original values. This is more reliable than
@@ -1473,20 +1453,20 @@ _bfd_coff_link_input_bfd (finfo, input_bfd)
relocation. */
if ((finfo->info->strip != strip_none
|| finfo->info->discard != discard_none)
- && finfo->info->relocateable)
+ && finfo->info->relocatable)
dont_skip_symbol = *indexp;
else
- dont_skip_symbol = false;
+ dont_skip_symbol = FALSE;
*indexp = -1;
- skip = false;
- global = false;
+ skip = FALSE;
+ global = FALSE;
add = 1 + isym.n_numaux;
/* If we are stripping all symbols, we want to skip this one. */
if (finfo->info->strip == strip_all && ! dont_skip_symbol)
- skip = true;
+ skip = TRUE;
if (! skip)
{
@@ -1501,22 +1481,22 @@ _bfd_coff_link_input_bfd (finfo, input_bfd)
end of the symbol table, so skip them for now.
Locally defined function symbols, however, are an
exception, and are not moved to the end. */
- global = true;
+ global = TRUE;
if (! ISFCN (isym.n_type))
- skip = true;
+ skip = TRUE;
break;
case COFF_SYMBOL_UNDEFINED:
/* Undefined symbols are left for the end. */
- global = true;
- skip = true;
+ global = TRUE;
+ skip = TRUE;
break;
case COFF_SYMBOL_LOCAL:
/* This is a local symbol. Skip it if we are discarding
local symbols. */
if (finfo->info->discard == discard_all && ! dont_skip_symbol)
- skip = true;
+ skip = TRUE;
break;
}
}
@@ -1525,13 +1505,12 @@ _bfd_coff_link_input_bfd (finfo, input_bfd)
/* Skip section symbols for sections which are not going to be
emitted. */
if (!skip
+ && dont_skip_symbol == 0
&& isym.n_sclass == C_STAT
&& isym.n_type == T_NULL
- && isym.n_numaux > 0)
- {
- if ((*secpp)->output_section == bfd_abs_section_ptr)
- skip = true;
- }
+ && isym.n_numaux > 0
+ && (*secpp)->output_section == bfd_abs_section_ptr)
+ skip = TRUE;
#endif
/* If we stripping debugging symbols, and this is a debugging
@@ -1552,7 +1531,7 @@ _bfd_coff_link_input_bfd (finfo, input_bfd)
|| isym.n_sclass == C_REGPARM
|| isym.n_sclass == C_FIELD
|| isym.n_sclass == C_EOS))))
- skip = true;
+ skip = TRUE;
/* If some symbols are stripped based on the name, work out the
name and decide whether to skip this symbol. */
@@ -1565,16 +1544,16 @@ _bfd_coff_link_input_bfd (finfo, input_bfd)
name = _bfd_coff_internal_syment_name (input_bfd, &isym, buf);
if (name == NULL)
- return false;
+ return FALSE;
if (! dont_skip_symbol
&& ((finfo->info->strip == strip_some
- && (bfd_hash_lookup (finfo->info->keep_hash, name, false,
- false) == NULL))
+ && (bfd_hash_lookup (finfo->info->keep_hash, name, FALSE,
+ FALSE) == NULL))
|| (! global
&& finfo->info->discard == discard_l
&& bfd_is_local_label_name (input_bfd, name))))
- skip = true;
+ skip = TRUE;
}
/* If this is an enum, struct, or union tag, see if we have
@@ -1598,7 +1577,7 @@ _bfd_coff_link_input_bfd (finfo, input_bfd)
name = _bfd_coff_internal_syment_name (input_bfd, &isym, buf);
if (name == NULL)
- return false;
+ return FALSE;
/* Ignore fake names invented by compiler; treat them all as
the same name. */
@@ -1608,24 +1587,24 @@ _bfd_coff_link_input_bfd (finfo, input_bfd)
name = "";
mh = coff_debug_merge_hash_lookup (&finfo->debug_merge, name,
- true, true);
+ TRUE, TRUE);
if (mh == NULL)
- return false;
+ return FALSE;
/* Allocate memory to hold type information. If this turns
out to be a duplicate, we pass this address to
bfd_release. */
amt = sizeof (struct coff_debug_merge_type);
- mt = (struct coff_debug_merge_type *) bfd_alloc (input_bfd, amt);
+ mt = bfd_alloc (input_bfd, amt);
if (mt == NULL)
- return false;
+ return FALSE;
mt->class = isym.n_sclass;
/* Pick up the aux entry, which points to the end of the tag
entries. */
- bfd_coff_swap_aux_in (input_bfd, (PTR) (esym + isymesz),
+ bfd_coff_swap_aux_in (input_bfd, (esym + isymesz),
isym.n_type, isym.n_sclass, 0, isym.n_numaux,
- (PTR) &aux);
+ &aux);
/* Gather the elements. */
epp = &mt->elements;
@@ -1640,23 +1619,22 @@ _bfd_coff_link_input_bfd (finfo, input_bfd)
char elebuf[SYMNMLEN + 1];
char *name_copy;
- bfd_coff_swap_sym_in (input_bfd, (PTR) esl, (PTR) islp);
+ bfd_coff_swap_sym_in (input_bfd, esl, islp);
amt = sizeof (struct coff_debug_merge_element);
- *epp = ((struct coff_debug_merge_element *)
- bfd_alloc (input_bfd, amt));
+ *epp = bfd_alloc (input_bfd, amt);
if (*epp == NULL)
- return false;
+ return FALSE;
elename = _bfd_coff_internal_syment_name (input_bfd, islp,
elebuf);
if (elename == NULL)
- return false;
+ return FALSE;
amt = strlen (elename) + 1;
- name_copy = (char *) bfd_alloc (input_bfd, amt);
+ name_copy = bfd_alloc (input_bfd, amt);
if (name_copy == NULL)
- return false;
+ return FALSE;
strcpy (name_copy, elename);
(*epp)->name = name_copy;
@@ -1669,16 +1647,15 @@ _bfd_coff_link_input_bfd (finfo, input_bfd)
union internal_auxent eleaux;
long indx;
- bfd_coff_swap_aux_in (input_bfd, (PTR) (esl + isymesz),
+ bfd_coff_swap_aux_in (input_bfd, (esl + isymesz),
islp->n_type, islp->n_sclass, 0,
- islp->n_numaux, (PTR) &eleaux);
+ islp->n_numaux, &eleaux);
indx = eleaux.x_sym.x_tagndx.l;
/* FIXME: If this tagndx entry refers to a symbol
defined later in this file, we just ignore it.
Handling this correctly would be tedious, and may
not be required. */
-
if (indx > 0
&& (indx
< ((esym -
@@ -1701,7 +1678,7 @@ _bfd_coff_link_input_bfd (finfo, input_bfd)
type. We always output the type if it has no elements,
for simplicity. */
if (mt->elements == NULL)
- bfd_release (input_bfd, (PTR) mt);
+ bfd_release (input_bfd, mt);
else
{
struct coff_debug_merge_type *mtl;
@@ -1737,10 +1714,10 @@ _bfd_coff_link_input_bfd (finfo, input_bfd)
else
{
/* This is a redefinition which can be merged. */
- bfd_release (input_bfd, (PTR) mt);
+ bfd_release (input_bfd, mt);
*indexp = mtl->indx;
add = (eslend - esym) / isymesz;
- skip = true;
+ skip = TRUE;
}
}
}
@@ -1761,13 +1738,12 @@ _bfd_coff_link_input_bfd (finfo, input_bfd)
bfd_coff_symname_in_debug. That is only true for
XCOFF, and XCOFF requires different linking code
anyhow. */
- name = _bfd_coff_internal_syment_name (input_bfd, &isym,
- (char *) NULL);
+ name = _bfd_coff_internal_syment_name (input_bfd, &isym, NULL);
if (name == NULL)
- return false;
+ return FALSE;
indx = _bfd_stringtab_add (finfo->strtab, name, hash, copy);
if (indx == (bfd_size_type) -1)
- return false;
+ return FALSE;
isym._n._n_n._n_offset = STRING_SIZE_SIZE + indx;
}
@@ -1835,7 +1811,6 @@ _bfd_coff_link_input_bfd (finfo, input_bfd)
it). We try to get this right, below, just before we
write the symbols out, but in the general case we may
have to write the symbol out twice. */
-
if (finfo->last_file_index != -1
&& finfo->last_file.n_value != (bfd_vma) output_index)
{
@@ -1846,11 +1821,11 @@ _bfd_coff_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
- + ((finfo->last_file_index
- - syment_base)
- * osymesz)));
+ &finfo->last_file,
+ (finfo->outsyms
+ + ((finfo->last_file_index
+ - syment_base)
+ * osymesz)));
}
else
{
@@ -1860,13 +1835,12 @@ _bfd_coff_link_input_bfd (finfo, input_bfd)
symbol. We need to write it out again. We
borrow *outsym temporarily. */
bfd_coff_swap_sym_out (output_bfd,
- (PTR) &finfo->last_file,
- (PTR) outsym);
+ &finfo->last_file, outsym);
pos = obj_sym_filepos (output_bfd);
pos += finfo->last_file_index * osymesz;
if (bfd_seek (output_bfd, pos, SEEK_SET) != 0
|| bfd_bwrite (outsym, osymesz, output_bfd) != osymesz)
- return false;
+ return FALSE;
}
}
@@ -1881,8 +1855,7 @@ _bfd_coff_link_input_bfd (finfo, input_bfd)
isym.n_sclass = C_STAT;
/* Output the symbol. */
-
- bfd_coff_swap_sym_out (output_bfd, (PTR) &isym, (PTR) outsym);
+ bfd_coff_swap_sym_out (output_bfd, &isym, outsym);
*indexp = output_index;
@@ -1899,7 +1872,7 @@ _bfd_coff_link_input_bfd (finfo, input_bfd)
/* This can happen if there were errors earlier in
the link. */
bfd_set_error (bfd_error_bad_value);
- return false;
+ return FALSE;
}
h->indx = output_index;
}
@@ -1922,13 +1895,13 @@ _bfd_coff_link_input_bfd (finfo, input_bfd)
/* Fix up the aux entries. This must be done in a separate pass,
because we don't know the correct symbol indices until we have
already decided which symbols we are going to keep. */
-
esym = (bfd_byte *) obj_coff_external_syms (input_bfd);
esym_end = esym + obj_raw_syment_count (input_bfd) * isymesz;
isymp = finfo->internal_syms;
indexp = finfo->sym_indices;
sym_hash = obj_coff_sym_hashes (input_bfd);
outsym = finfo->outsyms;
+
while (esym < esym_end)
{
int add;
@@ -1973,9 +1946,8 @@ _bfd_coff_link_input_bfd (finfo, input_bfd)
auxp = h->aux + i;
else
{
- bfd_coff_swap_aux_in (input_bfd, (PTR) esym, isymp->n_type,
- isymp->n_sclass, i, isymp->n_numaux,
- (PTR) &aux);
+ bfd_coff_swap_aux_in (input_bfd, esym, isymp->n_type,
+ isymp->n_sclass, i, isymp->n_numaux, &aux);
auxp = &aux;
}
@@ -1995,13 +1967,13 @@ _bfd_coff_link_input_bfd (finfo, input_bfd)
{
strings = _bfd_coff_read_string_table (input_bfd);
if (strings == NULL)
- return false;
+ return FALSE;
}
filename = strings + auxp->x_file.x_n.x_offset;
indx = _bfd_stringtab_add (finfo->strtab, filename,
hash, copy);
if (indx == (bfd_size_type) -1)
- return false;
+ return FALSE;
auxp->x_file.x_n.x_offset = STRING_SIZE_SIZE + indx;
}
}
@@ -2068,18 +2040,19 @@ _bfd_coff_link_input_bfd (finfo, input_bfd)
if ((bfd_size_type) finfo->last_bf_index
>= syment_base)
{
- PTR auxout;
+ void *auxout;
/* The last .bf symbol is in this input
file. This will only happen if the
assembler did not set up the .bf
endndx symbols correctly. */
- auxout = (PTR) (finfo->outsyms
- + ((finfo->last_bf_index
- - syment_base)
- * osymesz));
+ auxout = (finfo->outsyms
+ + ((finfo->last_bf_index
+ - syment_base)
+ * osymesz));
+
bfd_coff_swap_aux_out (output_bfd,
- (PTR) &finfo->last_bf,
+ &finfo->last_bf,
isymp->n_type,
isymp->n_sclass,
0, isymp->n_numaux,
@@ -2095,17 +2068,17 @@ _bfd_coff_link_input_bfd (finfo, input_bfd)
temporarily. FIXME: This case should
be made faster. */
bfd_coff_swap_aux_out (output_bfd,
- (PTR) &finfo->last_bf,
+ &finfo->last_bf,
isymp->n_type,
isymp->n_sclass,
0, isymp->n_numaux,
- (PTR) outsym);
+ outsym);
pos = obj_sym_filepos (output_bfd);
pos += finfo->last_bf_index * osymesz;
if (bfd_seek (output_bfd, pos, SEEK_SET) != 0
|| (bfd_bwrite (outsym, osymesz, output_bfd)
!= osymesz))
- return false;
+ return FALSE;
}
}
@@ -2126,9 +2099,9 @@ _bfd_coff_link_input_bfd (finfo, input_bfd)
if (h == NULL)
{
- bfd_coff_swap_aux_out (output_bfd, (PTR) auxp, isymp->n_type,
+ bfd_coff_swap_aux_out (output_bfd, auxp, isymp->n_type,
isymp->n_sclass, i, isymp->n_numaux,
- (PTR) outsym);
+ outsym);
outsym += osymesz;
}
@@ -2151,7 +2124,7 @@ _bfd_coff_link_input_bfd (finfo, input_bfd)
bfd_byte *eline;
bfd_byte *elineend;
bfd_byte *oeline;
- boolean skipping;
+ bfd_boolean skipping;
file_ptr pos;
bfd_size_type amt;
@@ -2171,18 +2144,18 @@ _bfd_coff_link_input_bfd (finfo, input_bfd)
if (bfd_seek (input_bfd, o->line_filepos, SEEK_SET) != 0
|| bfd_bread (finfo->linenos, linesz * o->lineno_count,
input_bfd) != linesz * o->lineno_count)
- return false;
+ return FALSE;
offset = o->output_section->vma + o->output_offset - o->vma;
eline = finfo->linenos;
oeline = finfo->linenos;
elineend = eline + linesz * o->lineno_count;
- skipping = false;
+ skipping = FALSE;
for (; eline < elineend; eline += linesz)
{
struct internal_lineno iline;
- bfd_coff_swap_lineno_in (input_bfd, (PTR) eline, (PTR) &iline);
+ bfd_coff_swap_lineno_in (input_bfd, eline, &iline);
if (iline.l_lnno != 0)
iline.l_addr.l_paddr += offset;
@@ -2203,7 +2176,7 @@ _bfd_coff_link_input_bfd (finfo, input_bfd)
with symbol #0) will fail. We can't regain
the space in the output file, but at least
they're dense. */
- skipping = true;
+ skipping = TRUE;
}
else
{
@@ -2218,32 +2191,31 @@ _bfd_coff_link_input_bfd (finfo, input_bfd)
of the line numbers rather than an absolute
file index. */
bfd_coff_swap_sym_in (output_bfd,
- (PTR) (finfo->outsyms
- + ((indx - syment_base)
- * osymesz)),
- (PTR) &is);
+ (finfo->outsyms
+ + ((indx - syment_base)
+ * osymesz)), &is);
if ((ISFCN (is.n_type)
|| is.n_sclass == C_BLOCK)
&& is.n_numaux >= 1)
{
- PTR auxptr;
+ void *auxptr;
- auxptr = (PTR) (finfo->outsyms
- + ((indx - syment_base + 1)
- * osymesz));
+ auxptr = (finfo->outsyms
+ + ((indx - syment_base + 1)
+ * osymesz));
bfd_coff_swap_aux_in (output_bfd, auxptr,
is.n_type, is.n_sclass,
- 0, is.n_numaux, (PTR) &ia);
+ 0, is.n_numaux, &ia);
ia.x_sym.x_fcnary.x_fcn.x_lnnoptr =
(o->output_section->line_filepos
+ o->output_section->lineno_count * linesz
+ eline - finfo->linenos);
- bfd_coff_swap_aux_out (output_bfd, (PTR) &ia,
+ bfd_coff_swap_aux_out (output_bfd, &ia,
is.n_type, is.n_sclass, 0,
is.n_numaux, auxptr);
}
- skipping = false;
+ skipping = FALSE;
}
iline.l_addr.l_symndx = indx;
@@ -2251,8 +2223,7 @@ _bfd_coff_link_input_bfd (finfo, input_bfd)
if (!skipping)
{
- bfd_coff_swap_lineno_out (output_bfd, (PTR) &iline,
- (PTR) oeline);
+ bfd_coff_swap_lineno_out (output_bfd, &iline, oeline);
oeline += linesz;
}
}
@@ -2262,7 +2233,7 @@ _bfd_coff_link_input_bfd (finfo, input_bfd)
amt = oeline - finfo->linenos;
if (bfd_seek (output_bfd, pos, SEEK_SET) != 0
|| bfd_bwrite (finfo->linenos, amt, output_bfd) != amt)
- return false;
+ return FALSE;
o->output_section->lineno_count += amt / linesz;
}
@@ -2276,10 +2247,10 @@ _bfd_coff_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
- + ((finfo->last_file_index - syment_base)
- * osymesz)));
+ bfd_coff_swap_sym_out (output_bfd, &finfo->last_file,
+ (finfo->outsyms
+ + ((finfo->last_file_index - syment_base)
+ * osymesz)));
}
/* Write the modified symbols to the output file. */
@@ -2292,7 +2263,7 @@ _bfd_coff_link_input_bfd (finfo, input_bfd)
amt = outsym - finfo->outsyms;
if (bfd_seek (output_bfd, pos, SEEK_SET) != 0
|| bfd_bwrite (finfo->outsyms, amt, output_bfd) != amt)
- return false;
+ return FALSE;
BFD_ASSERT ((obj_raw_syment_count (output_bfd)
+ (outsym - finfo->outsyms) / osymesz)
@@ -2309,10 +2280,8 @@ _bfd_coff_link_input_bfd (finfo, input_bfd)
struct coff_section_tdata *secdata;
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->flags & SEC_RELOC) == 0))
@@ -2325,7 +2294,7 @@ _bfd_coff_link_input_bfd (finfo, input_bfd)
bfd_archive_filename (input_bfd),
bfd_get_section_name (input_bfd, o)));
bfd_set_error (bfd_error_no_contents);
- return false;
+ return FALSE;
}
continue;
@@ -2338,7 +2307,7 @@ _bfd_coff_link_input_bfd (finfo, input_bfd)
{
if (! bfd_get_section_contents (input_bfd, o, finfo->contents,
(file_ptr) 0, o->_raw_size))
- return false;
+ return FALSE;
contents = finfo->contents;
}
@@ -2351,14 +2320,14 @@ _bfd_coff_link_input_bfd (finfo, input_bfd)
/* Read in the relocs. */
target_index = o->output_section->target_index;
internal_relocs = (_bfd_coff_read_internal_relocs
- (input_bfd, o, false, finfo->external_relocs,
- finfo->info->relocateable,
- (finfo->info->relocateable
+ (input_bfd, o, FALSE, finfo->external_relocs,
+ finfo->info->relocatable,
+ (finfo->info->relocatable
? (finfo->section_info[target_index].relocs
+ o->output_section->reloc_count)
: finfo->internal_relocs)));
if (internal_relocs == NULL)
- return false;
+ return FALSE;
/* Call processor specific code to relocate the section
contents. */
@@ -2368,9 +2337,9 @@ _bfd_coff_link_input_bfd (finfo, input_bfd)
internal_relocs,
finfo->internal_syms,
finfo->sec_ptrs))
- return false;
+ return FALSE;
- if (finfo->info->relocateable)
+ if (finfo->info->relocatable)
{
bfd_vma offset;
struct internal_reloc *irelend;
@@ -2384,12 +2353,11 @@ _bfd_coff_link_input_bfd (finfo, input_bfd)
for (; irel < irelend; irel++, rel_hash++)
{
struct coff_link_hash_entry *h;
- boolean adjusted;
+ bfd_boolean adjusted;
*rel_hash = NULL;
/* Adjust the reloc address and symbol index. */
-
irel->r_vaddr += offset;
if (irel->r_symndx == -1)
@@ -2400,7 +2368,7 @@ _bfd_coff_link_input_bfd (finfo, input_bfd)
if (! (*adjust_symndx) (output_bfd, finfo->info,
input_bfd, o, irel,
&adjusted))
- return false;
+ return FALSE;
if (adjusted)
continue;
}
@@ -2440,18 +2408,17 @@ _bfd_coff_link_input_bfd (finfo, input_bfd)
stripping. This should have been handled
by the 'dont_skip_symbol' code in the while
loop at the top of this function. */
-
is = finfo->internal_syms + irel->r_symndx;
name = (_bfd_coff_internal_syment_name
(input_bfd, is, buf));
if (name == NULL)
- return false;
+ return FALSE;
if (! ((*finfo->info->callbacks->unattached_reloc)
(finfo->info, name, input_bfd, o,
irel->r_vaddr)))
- return false;
+ return FALSE;
}
}
}
@@ -2468,32 +2435,28 @@ _bfd_coff_link_input_bfd (finfo, input_bfd)
? o->_cooked_size : o->_raw_size);
if (! bfd_set_section_contents (output_bfd, o->output_section,
contents, loc, amt))
- return false;
+ return FALSE;
}
else
{
if (! (_bfd_write_section_stabs
(output_bfd, &coff_hash_table (finfo->info)->stab_info,
o, &secdata->stab_info, contents)))
- return false;
+ return FALSE;
}
}
- if (! finfo->info->keep_memory)
- {
- if (! _bfd_coff_free_symbols (input_bfd))
- return false;
- }
+ if (! finfo->info->keep_memory
+ && ! _bfd_coff_free_symbols (input_bfd))
+ return FALSE;
- return true;
+ return TRUE;
}
/* Write out a global symbol. Called via coff_link_hash_traverse. */
-boolean
-_bfd_coff_write_global_sym (h, data)
- struct coff_link_hash_entry *h;
- PTR data;
+bfd_boolean
+_bfd_coff_write_global_sym (struct coff_link_hash_entry *h, void *data)
{
struct coff_final_link_info *finfo = (struct coff_final_link_info *) data;
bfd *output_bfd;
@@ -2508,19 +2471,19 @@ _bfd_coff_write_global_sym (h, data)
{
h = (struct coff_link_hash_entry *) h->root.u.i.link;
if (h->root.type == bfd_link_hash_new)
- return true;
+ return TRUE;
}
if (h->indx >= 0)
- return true;
+ return TRUE;
if (h->indx != -2
&& (finfo->info->strip == strip_all
|| (finfo->info->strip == strip_some
&& (bfd_hash_lookup (finfo->info->keep_hash,
- h->root.root.string, false, false)
+ h->root.root.string, FALSE, FALSE)
== NULL))))
- return true;
+ return TRUE;
switch (h->root.type)
{
@@ -2528,7 +2491,7 @@ _bfd_coff_write_global_sym (h, data)
case bfd_link_hash_new:
case bfd_link_hash_warning:
abort ();
- return false;
+ return FALSE;
case bfd_link_hash_undefined:
case bfd_link_hash_undefweak:
@@ -2560,25 +2523,25 @@ _bfd_coff_write_global_sym (h, data)
case bfd_link_hash_indirect:
/* Just ignore these. They can't be handled anyhow. */
- return true;
+ return TRUE;
}
if (strlen (h->root.root.string) <= SYMNMLEN)
strncpy (isym._n._n_name, h->root.root.string, SYMNMLEN);
else
{
- boolean hash;
+ bfd_boolean hash;
bfd_size_type indx;
- hash = true;
+ hash = TRUE;
if ((output_bfd->flags & BFD_TRADITIONAL_FORMAT) != 0)
- hash = false;
+ hash = FALSE;
indx = _bfd_stringtab_add (finfo->strtab, h->root.root.string, hash,
- false);
+ FALSE);
if (indx == (bfd_size_type) -1)
{
- finfo->failed = true;
- return false;
+ finfo->failed = TRUE;
+ return FALSE;
}
isym._n._n_n._n_zeroes = 0;
isym._n._n_n._n_offset = STRING_SIZE_SIZE + indx;
@@ -2597,22 +2560,22 @@ _bfd_coff_write_global_sym (h, data)
if (finfo->global_to_static)
{
if (! IS_EXTERNAL (output_bfd, isym))
- return true;
+ return TRUE;
isym.n_sclass = C_STAT;
}
- /* When a weak symbol is not overriden by a strong one,
+ /* When a weak symbol is not overridden by a strong one,
turn it into an external symbol when not building a
- shared or relocateable object. */
+ shared or relocatable object. */
if (! finfo->info->shared
- && ! finfo->info->relocateable
+ && ! finfo->info->relocatable
&& IS_WEAK_EXTERNAL (finfo->output_bfd, isym))
isym.n_sclass = C_EXT;
isym.n_numaux = h->numaux;
- bfd_coff_swap_sym_out (output_bfd, (PTR) &isym, (PTR) finfo->outsyms);
+ bfd_coff_swap_sym_out (output_bfd, &isym, finfo->outsyms);
symesz = bfd_coff_symesz (output_bfd);
@@ -2621,8 +2584,8 @@ _bfd_coff_write_global_sym (h, data)
if (bfd_seek (output_bfd, pos, SEEK_SET) != 0
|| bfd_bwrite (finfo->outsyms, symesz, output_bfd) != symesz)
{
- finfo->failed = true;
- return false;
+ finfo->failed = TRUE;
+ return FALSE;
}
h->indx = obj_raw_syment_count (output_bfd);
@@ -2659,10 +2622,9 @@ _bfd_coff_write_global_sym (h, data)
/* For PE, an overflow on the final link reportedly does
not matter. FIXME: Why not? */
-
if (sec->reloc_count > 0xffff
&& (! obj_pe (output_bfd)
- || finfo->info->relocateable))
+ || finfo->info->relocatable))
(*_bfd_error_handler)
(_("%s: %s: reloc overflow: 0x%lx > 0xffff"),
bfd_get_filename (output_bfd),
@@ -2671,7 +2633,7 @@ _bfd_coff_write_global_sym (h, data)
if (sec->lineno_count > 0xffff
&& (! obj_pe (output_bfd)
- || finfo->info->relocateable))
+ || finfo->info->relocatable))
(*_bfd_error_handler)
(_("%s: warning: %s: line number overflow: 0x%lx > 0xffff"),
bfd_get_filename (output_bfd),
@@ -2686,32 +2648,30 @@ _bfd_coff_write_global_sym (h, data)
}
}
- bfd_coff_swap_aux_out (output_bfd, (PTR) auxp, isym.n_type,
+ bfd_coff_swap_aux_out (output_bfd, auxp, isym.n_type,
isym.n_sclass, (int) i, isym.n_numaux,
- (PTR) finfo->outsyms);
+ finfo->outsyms);
if (bfd_bwrite (finfo->outsyms, symesz, output_bfd) != symesz)
{
- finfo->failed = true;
- return false;
+ finfo->failed = TRUE;
+ return FALSE;
}
++obj_raw_syment_count (output_bfd);
}
- return true;
+ return TRUE;
}
/* Write out task global symbols, converting them to statics. Called
via coff_link_hash_traverse. Calls bfd_coff_write_global_sym to do
the dirty work, if the symbol we are processing needs conversion. */
-boolean
-_bfd_coff_write_task_globals (h, data)
- struct coff_link_hash_entry *h;
- PTR data;
+bfd_boolean
+_bfd_coff_write_task_globals (struct coff_link_hash_entry *h, void *data)
{
struct coff_final_link_info *finfo = (struct coff_final_link_info *) data;
- boolean rtnval = true;
- boolean save_global_to_static;
+ bfd_boolean rtnval = TRUE;
+ bfd_boolean save_global_to_static;
if (h->root.type == bfd_link_hash_warning)
h = (struct coff_link_hash_entry *) h->root.u.i.link;
@@ -2723,7 +2683,7 @@ _bfd_coff_write_task_globals (h, data)
case bfd_link_hash_defined:
case bfd_link_hash_defweak:
save_global_to_static = finfo->global_to_static;
- finfo->global_to_static = true;
+ finfo->global_to_static = TRUE;
rtnval = _bfd_coff_write_global_sym (h, data);
finfo->global_to_static = save_global_to_static;
break;
@@ -2736,12 +2696,11 @@ _bfd_coff_write_task_globals (h, data)
/* Handle a link order which is supposed to generate a reloc. */
-boolean
-_bfd_coff_reloc_link_order (output_bfd, finfo, output_section, link_order)
- bfd *output_bfd;
- struct coff_final_link_info *finfo;
- asection *output_section;
- struct bfd_link_order *link_order;
+bfd_boolean
+_bfd_coff_reloc_link_order (bfd *output_bfd,
+ struct coff_final_link_info *finfo,
+ asection *output_section,
+ struct bfd_link_order *link_order)
{
reloc_howto_type *howto;
struct internal_reloc *irel;
@@ -2751,7 +2710,7 @@ _bfd_coff_reloc_link_order (output_bfd, finfo, output_section, link_order)
if (howto == NULL)
{
bfd_set_error (bfd_error_bad_value);
- return false;
+ return FALSE;
}
if (link_order->u.reloc.p->addend != 0)
@@ -2759,13 +2718,13 @@ _bfd_coff_reloc_link_order (output_bfd, finfo, output_section, link_order)
bfd_size_type size;
bfd_byte *buf;
bfd_reloc_status_type rstat;
- boolean ok;
+ bfd_boolean ok;
file_ptr loc;
size = bfd_get_reloc_size (howto);
- buf = (bfd_byte *) bfd_zmalloc (size);
+ buf = bfd_zmalloc (size);
if (buf == NULL)
- return false;
+ return FALSE;
rstat = _bfd_relocate_contents (howto, output_bfd,
(bfd_vma) link_order->u.reloc.p->addend,\
@@ -2788,21 +2747,20 @@ _bfd_coff_reloc_link_order (output_bfd, finfo, output_section, link_order)
(bfd *) NULL, (asection *) NULL, (bfd_vma) 0)))
{
free (buf);
- return false;
+ return FALSE;
}
break;
}
loc = link_order->offset * bfd_octets_per_byte (output_bfd);
- ok = bfd_set_section_contents (output_bfd, output_section, (PTR) buf,
+ ok = bfd_set_section_contents (output_bfd, output_section, buf,
loc, size);
free (buf);
if (! ok)
- return false;
+ return FALSE;
}
/* Store the reloc information in the right place. It will get
swapped and written out at the end of the final_link routine. */
-
irel = (finfo->section_info[output_section->target_index].relocs
+ output_section->reloc_count);
rel_hash_ptr = (finfo->section_info[output_section->target_index].rel_hashes
@@ -2830,7 +2788,7 @@ _bfd_coff_reloc_link_order (output_bfd, finfo, output_section, link_order)
h = ((struct coff_link_hash_entry *)
bfd_wrapped_link_hash_lookup (output_bfd, finfo->info,
link_order->u.reloc.p->u.name,
- false, false, true));
+ FALSE, FALSE, TRUE));
if (h != NULL)
{
if (h->indx >= 0)
@@ -2849,7 +2807,7 @@ _bfd_coff_reloc_link_order (output_bfd, finfo, output_section, link_order)
if (! ((*finfo->info->callbacks->unattached_reloc)
(finfo->info, link_order->u.reloc.p->u.name, (bfd *) NULL,
(asection *) NULL, (bfd_vma) 0)))
- return false;
+ return FALSE;
irel->r_symndx = 0;
}
}
@@ -2861,27 +2819,23 @@ _bfd_coff_reloc_link_order (output_bfd, finfo, output_section, link_order)
routines anyhow. r_extern is only used for ECOFF. */
/* FIXME: What is the right value for r_offset? Is zero OK? */
-
++output_section->reloc_count;
- return true;
+ return TRUE;
}
/* A basic reloc handling routine which may be used by processors with
simple relocs. */
-boolean
-_bfd_coff_generic_relocate_section (output_bfd, info, input_bfd,
- input_section, contents, relocs, syms,
- sections)
- bfd *output_bfd;
- struct bfd_link_info *info;
- bfd *input_bfd;
- asection *input_section;
- bfd_byte *contents;
- struct internal_reloc *relocs;
- struct internal_syment *syms;
- asection **sections;
+bfd_boolean
+_bfd_coff_generic_relocate_section (bfd *output_bfd,
+ struct bfd_link_info *info,
+ bfd *input_bfd,
+ asection *input_section,
+ bfd_byte *contents,
+ struct internal_reloc *relocs,
+ struct internal_syment *syms,
+ asection **sections)
{
struct internal_reloc *rel;
struct internal_reloc *relend;
@@ -2911,7 +2865,7 @@ _bfd_coff_generic_relocate_section (output_bfd, info, input_bfd,
(*_bfd_error_handler)
("%s: illegal symbol index %ld in relocs",
bfd_archive_filename (input_bfd), symndx);
- return false;
+ return FALSE;
}
else
{
@@ -2923,7 +2877,6 @@ _bfd_coff_generic_relocate_section (output_bfd, info, input_bfd,
size of the symbol is included in the section contents, or it
is not. We assume that the size is not included, and force
the rtype_to_howto function to adjust the addend as needed. */
-
if (sym != NULL && sym->n_scnum != 0)
addend = - sym->n_value;
else
@@ -2932,15 +2885,15 @@ _bfd_coff_generic_relocate_section (output_bfd, info, input_bfd,
howto = bfd_coff_rtype_to_howto (input_bfd, input_section, rel, h,
sym, &addend);
if (howto == NULL)
- return false;
+ return FALSE;
- /* If we are doing a relocateable link, then we can just ignore
+ /* If we are doing a relocatable link, then we can just ignore
a PC relative reloc that is pcrel_offset. It will already
- have the correct value. If this is not a relocateable link,
+ have the correct value. If this is not a relocatable link,
then we should ignore the symbol value. */
if (howto->pc_relative && howto->pcrel_offset)
{
- if (info->relocateable)
+ if (info->relocatable)
continue;
if (sym != NULL && sym->n_scnum != 0)
addend += sym->n_value;
@@ -2983,12 +2936,12 @@ _bfd_coff_generic_relocate_section (output_bfd, info, input_bfd,
else if (h->root.type == bfd_link_hash_undefweak)
val = 0;
- else if (! info->relocateable)
+ else if (! info->relocatable)
{
if (! ((*info->callbacks->undefined_symbol)
(info, h->root.root.string, input_bfd, input_section,
- rel->r_vaddr - input_section->vma, true)))
- return false;
+ rel->r_vaddr - input_section->vma, TRUE)))
+ return FALSE;
}
}
@@ -3013,7 +2966,7 @@ _bfd_coff_generic_relocate_section (output_bfd, info, input_bfd,
!= sizeof (long))
{
bfd_set_error (bfd_error_system_call);
- return false;
+ return FALSE;
}
}
}
@@ -3035,7 +2988,7 @@ _bfd_coff_generic_relocate_section (output_bfd, info, input_bfd,
bfd_archive_filename (input_bfd),
(unsigned long) rel->r_vaddr,
bfd_get_section_name (input_bfd, input_section));
- return false;
+ return FALSE;
case bfd_reloc_overflow:
{
const char *name;
@@ -3049,15 +3002,15 @@ _bfd_coff_generic_relocate_section (output_bfd, info, input_bfd,
{
name = _bfd_coff_internal_syment_name (input_bfd, sym, buf);
if (name == NULL)
- return false;
+ return FALSE;
}
if (! ((*info->callbacks->reloc_overflow)
(info, name, howto->name, (bfd_vma) 0, input_bfd,
input_section, rel->r_vaddr - input_section->vma)))
- return false;
+ return FALSE;
}
}
}
- return true;
+ return TRUE;
}
diff --git a/contrib/binutils/bfd/coffswap.h b/contrib/binutils/bfd/coffswap.h
index cd147c5..5f23ecc 100644
--- a/contrib/binutils/bfd/coffswap.h
+++ b/contrib/binutils/bfd/coffswap.h
@@ -1,24 +1,24 @@
/* Generic COFF swapping routines, for BFD.
Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1999, 2000,
- 2001
+ 2001, 2002
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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
/* This file contains routines used to swap COFF data. It is a header
file because the details of swapping depend on the details of the
@@ -381,7 +381,12 @@ coff_swap_sym_out (abfd, inp, extp)
{
struct internal_syment *in = (struct internal_syment *) inp;
SYMENT *ext =(SYMENT *) extp;
- if(in->_n._n_name[0] == 0)
+
+#ifdef COFF_ADJUST_SYM_OUT_PRE
+ COFF_ADJUST_SYM_OUT_PRE (abfd, inp, extp);
+#endif
+
+ if (in->_n._n_name[0] == 0)
{
H_PUT_32 (abfd, 0, ext->e.e.e_zeroes);
H_PUT_32 (abfd, in->_n._n_n._n_offset, ext->e.e.e_offset);
@@ -391,11 +396,13 @@ coff_swap_sym_out (abfd, inp, extp)
#if SYMNMLEN != E_SYMNMLEN
-> Error, we need to cope with truncating or extending SYMNMLEN!;
#else
- memcpy(ext->e.e_name, in->_n._n_name, SYMNMLEN);
+ memcpy (ext->e.e_name, in->_n._n_name, SYMNMLEN);
#endif
}
+
H_PUT_32 (abfd, in->n_value, ext->e_value);
H_PUT_16 (abfd, in->n_scnum, ext->e_scnum);
+
if (sizeof (ext->e_type) == 2)
{
H_PUT_16 (abfd, in->n_type, ext->e_type);
@@ -404,11 +411,14 @@ coff_swap_sym_out (abfd, inp, extp)
{
H_PUT_32 (abfd, in->n_type, ext->e_type);
}
+
H_PUT_8 (abfd, in->n_sclass, ext->e_sclass);
H_PUT_8 (abfd, in->n_numaux, ext->e_numaux);
+
#ifdef COFF_ADJUST_SYM_OUT_POST
COFF_ADJUST_SYM_OUT_POST (abfd, inp, extp);
#endif
+
return SYMESZ;
}
@@ -428,6 +438,7 @@ coff_swap_aux_in (abfd, ext1, type, class, indx, numaux, in1)
#ifdef COFF_ADJUST_AUX_IN_PRE
COFF_ADJUST_AUX_IN_PRE (abfd, ext1, type, class, indx, numaux, in1);
#endif
+
switch (class)
{
case C_FILE:
@@ -448,9 +459,7 @@ coff_swap_aux_in (abfd, ext1, type, class, indx, numaux, in1)
numaux * sizeof (AUXENT));
}
else
- {
- memcpy (in->x_file.x_fname, ext->x_file.x_fname, FILNMLEN);
- }
+ memcpy (in->x_file.x_fname, ext->x_file.x_fname, FILNMLEN);
#endif
}
goto end;
@@ -502,7 +511,7 @@ coff_swap_aux_in (abfd, ext1, type, class, indx, numaux, in1)
H_GET_16 (abfd, ext->x_sym.x_fcnary.x_ary.x_dimen[3]);
}
- if (ISFCN(type))
+ if (ISFCN (type))
{
in->x_sym.x_misc.x_fsize = H_GET_32 (abfd, ext->x_sym.x_misc.x_fsize);
}
@@ -535,7 +544,9 @@ coff_swap_aux_out (abfd, inp, type, class, indx, numaux, 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 ((PTR)ext, 0, AUXESZ);
+
switch (class)
{
case C_FILE:
@@ -681,29 +692,29 @@ coff_swap_aouthdr_in (abfd, aouthdr_ext1, aouthdr_int1)
#else
aouthdr_int->o_toc = H_GET_32 (abfd, aouthdr_ext->o_toc);
#endif
- aouthdr_int->o_snentry = H_GET_16 (abfd, aouthdr_ext->o_snentry);
- aouthdr_int->o_sntext = H_GET_16 (abfd, aouthdr_ext->o_sntext);
- aouthdr_int->o_sndata = H_GET_16 (abfd, aouthdr_ext->o_sndata);
- aouthdr_int->o_sntoc = H_GET_16 (abfd, aouthdr_ext->o_sntoc);
+ aouthdr_int->o_snentry = H_GET_16 (abfd, aouthdr_ext->o_snentry);
+ aouthdr_int->o_sntext = H_GET_16 (abfd, aouthdr_ext->o_sntext);
+ aouthdr_int->o_sndata = H_GET_16 (abfd, aouthdr_ext->o_sndata);
+ aouthdr_int->o_sntoc = H_GET_16 (abfd, aouthdr_ext->o_sntoc);
aouthdr_int->o_snloader = H_GET_16 (abfd, aouthdr_ext->o_snloader);
- aouthdr_int->o_snbss = H_GET_16 (abfd, aouthdr_ext->o_snbss);
+ aouthdr_int->o_snbss = H_GET_16 (abfd, aouthdr_ext->o_snbss);
aouthdr_int->o_algntext = H_GET_16 (abfd, aouthdr_ext->o_algntext);
aouthdr_int->o_algndata = H_GET_16 (abfd, aouthdr_ext->o_algndata);
- aouthdr_int->o_modtype = H_GET_16 (abfd, aouthdr_ext->o_modtype);
- aouthdr_int->o_cputype = H_GET_16 (abfd, aouthdr_ext->o_cputype);
+ aouthdr_int->o_modtype = H_GET_16 (abfd, aouthdr_ext->o_modtype);
+ aouthdr_int->o_cputype = H_GET_16 (abfd, aouthdr_ext->o_cputype);
#ifdef XCOFF64
aouthdr_int->o_maxstack = H_GET_64 (abfd, aouthdr_ext->o_maxstack);
- aouthdr_int->o_maxdata = H_GET_64 (abfd, aouthdr_ext->o_maxdata);
+ aouthdr_int->o_maxdata = H_GET_64 (abfd, aouthdr_ext->o_maxdata);
#else
aouthdr_int->o_maxstack = H_GET_32 (abfd, aouthdr_ext->o_maxstack);
- aouthdr_int->o_maxdata = H_GET_32 (abfd, aouthdr_ext->o_maxdata);
+ aouthdr_int->o_maxdata = H_GET_32 (abfd, aouthdr_ext->o_maxdata);
#endif
#endif
#ifdef MIPSECOFF
- aouthdr_int->bss_start = H_GET_32 (abfd, aouthdr_ext->bss_start);
- aouthdr_int->gp_value = H_GET_32 (abfd, aouthdr_ext->gp_value);
- aouthdr_int->gprmask = H_GET_32 (abfd, aouthdr_ext->gprmask);
+ aouthdr_int->bss_start = H_GET_32 (abfd, aouthdr_ext->bss_start);
+ aouthdr_int->gp_value = H_GET_32 (abfd, aouthdr_ext->gp_value);
+ aouthdr_int->gprmask = H_GET_32 (abfd, aouthdr_ext->gprmask);
aouthdr_int->cprmask[0] = H_GET_32 (abfd, aouthdr_ext->cprmask[0]);
aouthdr_int->cprmask[1] = H_GET_32 (abfd, aouthdr_ext->cprmask[1]);
aouthdr_int->cprmask[2] = H_GET_32 (abfd, aouthdr_ext->cprmask[2]);
@@ -712,9 +723,9 @@ coff_swap_aouthdr_in (abfd, aouthdr_ext1, aouthdr_int1)
#ifdef ALPHAECOFF
aouthdr_int->bss_start = H_GET_64 (abfd, aouthdr_ext->bss_start);
- aouthdr_int->gp_value = H_GET_64 (abfd, aouthdr_ext->gp_value);
- aouthdr_int->gprmask = H_GET_32 (abfd, aouthdr_ext->gprmask);
- aouthdr_int->fprmask = H_GET_32 (abfd, aouthdr_ext->fprmask);
+ aouthdr_int->gp_value = H_GET_64 (abfd, aouthdr_ext->gp_value);
+ aouthdr_int->gprmask = H_GET_32 (abfd, aouthdr_ext->gprmask);
+ aouthdr_int->fprmask = H_GET_32 (abfd, aouthdr_ext->fprmask);
#endif
}
@@ -807,7 +818,8 @@ coff_swap_scnhdr_in (abfd, ext, in)
#ifdef COFF_ADJUST_SCNHDR_IN_PRE
COFF_ADJUST_SCNHDR_IN_PRE (abfd, ext, in);
#endif
- memcpy(scnhdr_int->s_name, scnhdr_ext->s_name, sizeof (scnhdr_int->s_name));
+ 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);
@@ -866,6 +878,7 @@ coff_swap_scnhdr_out (abfd, in, out)
buf, scnhdr_int->s_nlnno);
PUT_SCNHDR_NLNNO (abfd, 0xffff, scnhdr_ext->s_nlnno);
}
+
if (scnhdr_int->s_nreloc <= MAX_SCNHDR_NRELOC)
PUT_SCNHDR_NRELOC (abfd, scnhdr_int->s_nreloc, scnhdr_ext->s_nreloc);
else
diff --git a/contrib/binutils/bfd/config.bfd b/contrib/binutils/bfd/config.bfd
index 2e9d7fa..1428831 100755
--- a/contrib/binutils/bfd/config.bfd
+++ b/contrib/binutils/bfd/config.bfd
@@ -29,15 +29,30 @@ targ64_selvecs=
targ_cflags=
targ_underscore=no
+# Catch obsolete configurations.
+case $targ in
+ vax-*-vms* \
+ )
+ if test "x$enable_obsolete" != xyes; then
+ echo "*** Configuration $targ is obsolete." >&2
+ echo "*** Specify --enable-obsolete to build it anyway." >&2
+ echo "*** Support will be REMOVED in the next major release of BINUTILS," >&2
+ echo "*** unless a maintainer comes forward." >&2
+ exit 1
+ fi;;
+esac
+
+
targ_cpu=`echo $targ | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
case "${targ_cpu}" in
alpha*) targ_archs=bfd_alpha_arch ;;
arm*) targ_archs=bfd_arm_arch ;;
c30*) targ_archs=bfd_tic30_arch ;;
+c4x*) targ_archs=bfd_tic4x_arch ;;
c54x*) targ_archs=bfd_tic54x_arch ;;
dlx*) targ_archs=bfd_dlx_arch ;;
hppa*) targ_archs=bfd_hppa_arch ;;
-i[3456]86) targ_archs=bfd_i386_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" ;;
@@ -57,7 +72,9 @@ thumb*) targ_archs=bfd_arm_arch ;;
v850*) targ_archs=bfd_v850_arch ;;
x86_64) targ_archs=bfd_i386_arch ;;
xscale*) targ_archs=bfd_arm_arch ;;
+xtensa*) targ_archs=bfd_xtensa_arch ;;
z8k*) targ_archs=bfd_z8k_arch ;;
+am33_2.0) targ_archs=bfd_mn10300_arch ;;
*) targ_archs=bfd_${targ_cpu}_arch ;;
esac
@@ -66,11 +83,29 @@ esac
# Make sure that the left side always has two dashes. Otherwise you
# can get spurious matches. Even for unambiguous cases, do this as a
# convention, else the table becomes a real mess to understand and maintain.
+#
+# Keep obsolete entries above the START comment, to keep them out of
+# targmatch.h.
case "${targ}" in
+ mips*-dec-bsd*)
+ echo "This target is obsolete and has been removed."
+ exit 1
+ ;;
+
+ mips*-*-mach3*)
+ echo "This target is obsolete and has been removed."
+ exit 1
+ ;;
+
+ mips*-*-pe*)
+ echo "This target is obsolete and has been removed."
+ exit 1
+ ;;
+
# START OF targmatch.h
#ifdef BFD64
- alpha*-*-freebsd*)
+ alpha*-*-freebsd* | alpha*-*-kfreebsd*-gnu)
targ_defvec=bfd_elf64_alpha_freebsd_vec
targ_selvecs=ecoffalpha_little_vec
# FreeBSD <= 4.0 supports only the old nonstandard way of ABI labelling.
@@ -101,11 +136,7 @@ case "${targ}" in
alpha*-*-*)
targ_defvec=ecoffalpha_little_vec
;;
- ia64*-*-aix*)
- targ_defvec=bfd_elf64_ia64_aix_little_vec
- targ_selvecs="bfd_elf64_ia64_aix_big_vec bfd_efi_app_ia64_vec"
- ;;
- ia64*-*-freebsd* | ia64*-*-netbsd* | ia64*-*-linux-gnu* | ia64*-*-elf*)
+ ia64*-*-freebsd* | ia64*-*-netbsd* | ia64*-*-linux-gnu* | ia64*-*-elf* | ia64*-*-kfreebsd*-gnu)
targ_defvec=bfd_elf64_ia64_little_vec
targ_selvecs="bfd_elf64_ia64_big_vec bfd_efi_app_ia64_vec"
;;
@@ -113,12 +144,15 @@ case "${targ}" in
targ_defvec=bfd_elf32_ia64_hpux_big_vec
targ_selvecs="bfd_elf64_ia64_hpux_big_vec"
;;
- sparc64-*-freebsd* | sparc64-*-netbsd* | sparc64-*-openbsd*)
+ sparc64-*-freebsd* | sparc64-*-netbsd* | sparc64-*-openbsd* | sparc64-*-kfreebsd*-gnu)
targ_defvec=bfd_elf64_sparc_vec
targ_selvecs="bfd_elf32_sparc_vec sunos_big_vec"
;;
#endif /* BFD64 */
+ am33_2.0-*-linux*)
+ targ_defvec=bfd_elf32_am33lin_vec
+ ;;
arc-*-elf*)
targ_defvec=bfd_elf32_littlearc_vec
targ_selvecs=bfd_elf32_bigarc_vec
@@ -136,6 +170,11 @@ case "${targ}" in
targ_defvec=armnetbsd_vec
targ_selvecs="bfd_elf32_littlearm_vec bfd_elf32_bigarm_vec"
targ_underscore=yes
+ targ_cflags=-D__QNXTARGET__
+ ;;
+ arm-*-nto* | nto*arm*)
+ targ_defvec=bfd_elf32_littlearm_vec
+ targ_selvecs=bfd_elf32_bigarm_vec
;;
arm-*-riscix*)
targ_defvec=riscix_vec
@@ -150,7 +189,7 @@ case "${targ}" in
targ_defvec=armpe_little_vec
targ_selvecs="armpe_little_vec armpe_big_vec armpei_little_vec armpei_big_vec"
targ_underscore=no
- targ_cflags=-DARM_WINCE
+ targ_cflags="-DARM_WINCE -DARM_COFF_BUGFIX"
;;
arm-*-pe*)
targ_defvec=armpe_little_vec
@@ -165,12 +204,6 @@ case "${targ}" in
targ_defvec=aout_arm_big_vec
targ_selvecs=aout_arm_little_vec
;;
- arm-*-vxworks*)
- targ_defvec=armcoff_little_vec
- targ_selvecs=armcoff_big_vec
- targ_underscore=yes
- targ_cflags=-DARM_COFF_BUGFIX
- ;;
arm-*-coff)
targ_defvec=armcoff_little_vec
targ_selvecs=armcoff_big_vec
@@ -184,7 +217,12 @@ 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-*-kaos* | strongarm-*-kaos*)
+ targ_defvec=bfd_elf32_littlearm_vec
+ targ_selvecs=bfd_elf32_bigarm_vec
+ ;;
+ arm-*-elf | arm-*-freebsd* | arm*-*-linux-gnu* | arm*-*-conix* | \
+ arm*-*-uclinux* | arm-*-kfreebsd*-gnu | arm-*-vxworks)
targ_defvec=bfd_elf32_littlearm_vec
targ_selvecs=bfd_elf32_bigarm_vec
;;
@@ -261,6 +299,12 @@ case "${targ}" in
targ_defvec=tic30_coff_vec
;;
+ c4x-*-*coff* | tic4x-*-*coff* | tic4x-*-rtems*)
+ targ_defvec=tic4x_coff1_vec
+ targ_selvecs="tic4x_coff1_beh_vec tic4x_coff2_vec tic4x_coff2_beh_vec tic4x_coff0_vec tic4x_coff0_beh_vec"
+ targ_underscore=yes
+ ;;
+
c54x*-*-*coff* | tic54x-*-*coff*)
targ_defvec=tic54x_coff1_vec
targ_selvecs="tic54x_coff1_beh_vec tic54x_coff2_vec tic54x_coff2_beh_vec tic54x_coff0_vec tic54x_coff0_beh_vec"
@@ -292,8 +336,13 @@ case "${targ}" in
frv-*-elf)
targ_defvec=bfd_elf32_frv_vec
+ targ_selvecs=bfd_elf32_frvfdpic_vec
;;
+ frv-*-*linux*)
+ targ_defvec=bfd_elf32_frvfdpic_vec
+ targ_selvecs=bfd_elf32_frv_vec
+ ;;
h8300*-*-elf)
targ_defvec=bfd_elf32_h8300_vec
@@ -322,11 +371,11 @@ case "${targ}" in
;;
#endif
- hppa*-*-linux-gnu*)
+ hppa*-*-linux-gnu* | hppa*-*-netbsd*)
targ_defvec=bfd_elf32_hppa_linux_vec
targ_selvecs=bfd_elf32_hppa_vec
;;
- hppa*-*-*elf* | hppa*-*-lites* | hppa*-*-netbsd* | hppa*-*-sysv4* | hppa*-*-rtems* | hppa*-*-openbsd*)
+ hppa*-*-*elf* | hppa*-*-lites* | hppa*-*-sysv4* | hppa*-*-rtems* | hppa*-*-openbsd*)
targ_defvec=bfd_elf32_hppa_vec
targ_selvecs=bfd_elf32_hppa_linux_vec
;;
@@ -349,94 +398,113 @@ case "${targ}" in
targ_defvec=bfd_elf32_i370_vec
targ_selvecs="bfd_elf32_i370_vec"
;;
- i[3456]86-*-sco3.2v5*coff)
+ i[3-7]86-*-sco3.2v5*coff)
targ_defvec=i386coff_vec
targ_selvecs=bfd_elf32_i386_vec
;;
- i[3456]86-*-sysv4* | i[3456]86-*-unixware* | i[3456]86-*-solaris2* | \
- i[3456]86-*-elf | i[3456]86-*-sco3.2v5* | \
- i[3456]86-*-dgux* | i[3456]86-*-sysv5*)
+ i[3-7]86-*-sysv4* | i[3-7]86-*-unixware* | i[3-7]86-*-solaris2* | \
+ i[3-7]86-*-elf | i[3-7]86-*-sco3.2v5* | \
+ i[3-7]86-*-dgux* | i[3-7]86-*-sysv5*)
targ_defvec=bfd_elf32_i386_vec
targ_selvecs=i386coff_vec
;;
- i[3456]86-*-nto*)
+ i[3-7]86-*-kaos*)
+ targ_defvec=bfd_elf32_i386_vec
+ targ_selvecs=bfd_elf32_i386_vec
+ ;;
+ i[3-7]86-*-nto*)
targ_defvec=bfd_elf32_i386_vec
targ_selvecs=i386coff_vec
;;
- i[3456]86-*-chorus*)
+ i[3-7]86-*-aros*)
+ targ_defvec=bfd_elf32_i386_vec
+ ;;
+ i[3-7]86-*-chorus*)
targ_defvec=bfd_elf32_i386_vec
;;
*-*-msdosdjgpp* | *-*-go32* | *-go32-rtems* )
targ_defvec=go32coff_vec
targ_selvecs="go32stubbedcoff_vec i386aout_vec"
;;
- i[3456]86-*-sysv* | i[3456]86-*-isc* | i[3456]86-*-sco* | i[3456]86-*-coff | \
- i[3456]86-*-aix*)
+ i[3-7]86-*-sysv* | i[3-7]86-*-isc* | i[3-7]86-*-sco* | i[3-7]86-*-coff | \
+ i[3-7]86-*-aix*)
targ_defvec=i386coff_vec
;;
- i[3456]86*-*-rtemscoff*)
+ i[3-7]86*-*-rtemscoff*)
targ_defvec=i386coff_vec
targ_selvecs="bfd_elf32_i386_vec i386aout_vec"
;;
- i[3456]86-*-rtemself* | i[3456]86-*-rtems*)
+ i[3-7]86-*-rtemself* | i[3-7]86-*-rtems*)
targ_defvec=bfd_elf32_i386_vec
targ_selvecs="i386coff_vec i386aout_vec"
;;
- i[3456]86-sequent-bsd*)
+ i[3-7]86-*-darwin* | i[3-7]86-*-macos10* | i[3-7]86-*-rhapsody*)
+ targ_defvec=mach_o_le_vec
+ targ_selvecs="mach_o_le_vec mach_o_be_vec mach_o_fat_vec pef_vec pef_xlib_vec sym_vec"
+ targ_archs="bfd_i386_arch bfd_powerpc_arch bfd_rs6000_arch"
+ ;;
+ i[3-7]86-sequent-bsd*)
targ_defvec=i386dynix_vec
targ_underscore=yes
;;
- i[3456]86-*-bsd*)
+ i[3-7]86-*-bsd*)
targ_defvec=i386bsd_vec
targ_underscore=yes
;;
- i[3456]86-*-freebsdaout* | i[3456]86-*-freebsd[12].* | \
- i[3456]86-*-freebsd[12])
+ i[3-7]86-*-freebsdaout* | i[3-7]86-*-freebsd[12].* | \
+ i[3-7]86-*-freebsd[12])
targ_defvec=i386freebsd_vec
targ_selvecs=i386bsd_vec
targ_underscore=yes
;;
- i[3456]86-*-freebsd*)
+ i[3-7]86-*-freebsd* | i[3-7]86-*-kfreebsd*-gnu)
targ_defvec=bfd_elf32_i386_freebsd_vec
targ_selvecs=i386coff_vec
# FreeBSD <= 4.0 supports only the old nonstandard way of ABI labelling.
case "${targ}" in
- i[3456]86-*-freebsd3* | i[3456]86-*-freebsd4 | i[3456]86-*-freebsd4.0*)
+ i[3-7]86-*-freebsd3* | i[3-7]86-*-freebsd4 | i[3-7]86-*-freebsd4.0*)
targ_cflags=-DOLD_FREEBSD_ABI_LABEL ;;
esac
;;
- i[3456]86-*-netbsdelf*)
+ i[3-7]86-*-netbsdelf* | i[3-7]86-*-netbsd*-gnu* | i[3-7]86-*-knetbsd*-gnu)
targ_defvec=bfd_elf32_i386_vec
targ_selvecs=i386netbsd_vec
+ targ64_selvecs=bfd_elf64_x86_64_vec
;;
- i[3456]86-*-netbsdpe*)
+ i[3-7]86-*-netbsdpe*)
targ_defvec=i386pe_vec
targ_selvecs="i386pe_vec i386pei_vec bfd_elf32_i386_vec"
;;
- i[3456]86-*-netbsdaout* | i[3456]86-*-netbsd* | i[3456]86-*-openbsd*)
+ i[3-7]86-*-netbsdaout* | i[3-7]86-*-netbsd* | \
+ i[3-7]86-*-openbsd[0-2].* | i[3-7]86-*-openbsd3.[0-3])
targ_defvec=i386netbsd_vec
targ_selvecs="bfd_elf32_i386_vec i386bsd_vec"
targ_underscore=yes
;;
- i[3456]86-*-netware*)
+ i[3-7]86-*-openbsd*)
+ targ_defvec=bfd_elf32_i386_vec
+ targ_selvecs=i386netbsd_vec
+ ;;
+ i[3-7]86-*-netware*)
targ_defvec=bfd_elf32_i386_vec
targ_selvecs="nlm32_i386_vec i386coff_vec i386aout_vec"
;;
- i[3456]86-*-linux*aout*)
+ i[3-7]86-*-linux*aout*)
targ_defvec=i386linux_vec
targ_selvecs=bfd_elf32_i386_vec
targ_underscore=yes
;;
- i[3456]86-*-linux-gnu*)
+ i[3-7]86-*-linux-gnu*)
targ_defvec=bfd_elf32_i386_vec
targ_selvecs="i386linux_vec bfd_efi_app_ia32_vec"
+ targ64_selvecs=bfd_elf64_x86_64_vec
;;
#ifdef BFD64
- x86_64-*-freebsd*)
+ x86_64-*-freebsd* | x86_64-*-kfreebsd*-gnu)
targ_defvec=bfd_elf64_x86_64_vec
targ_selvecs="bfd_elf32_i386_vec i386coff_vec bfd_efi_app_ia32_vec"
;;
- x86_64-*-netbsd*)
+ x86_64-*-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"
;;
@@ -445,58 +513,58 @@ case "${targ}" in
targ_selvecs="bfd_elf32_i386_vec i386linux_vec bfd_efi_app_ia32_vec"
;;
#endif
- i[3456]86-*-lynxos*)
+ i[3-7]86-*-lynxos*)
targ_defvec=i386lynx_coff_vec
targ_selvecs=i386lynx_aout_vec
;;
- i[3456]86-*-gnu*)
+ i[3-7]86-*-gnu*)
targ_defvec=bfd_elf32_i386_vec
;;
- i[3456]86-*-mach* | i[3456]86-*-osf1mk*)
+ i[3-7]86-*-mach* | i[3-7]86-*-osf1mk*)
targ_defvec=i386mach3_vec
targ_cflags=-DSTAT_FOR_EXEC
targ_underscore=yes
;;
- i[3456]86-*-os9k)
+ i[3-7]86-*-os9k)
targ_defvec=i386os9k_vec
;;
- i[3456]86-*-msdos*)
+ i[3-7]86-*-msdos*)
targ_defvec=i386aout_vec
targ_selvecs=i386msdos_vec
;;
- i[3456]86-*-moss*)
+ i[3-7]86-*-moss*)
targ_defvec=bfd_elf32_i386_vec
targ_selvecs="i386msdos_vec i386aout_vec"
;;
- i[3456]86-*-beospe*)
+ i[3-7]86-*-beospe*)
targ_defvec=i386pe_vec
targ_selvecs="i386pe_vec i386pei_vec"
;;
- i[3456]86-*-beoself* | i[3456]86-*-beos*)
+ i[3-7]86-*-beoself* | i[3-7]86-*-beos*)
targ_defvec=bfd_elf32_i386_vec
targ_selvecs="i386pe_vec i386pei_vec"
;;
- i[3456]86-*-interix*)
+ i[3-7]86-*-interix*)
targ_defvec=i386pei_vec
targ_selvecs="i386pe_vec"
# FIXME: This should eventually be checked at runtime.
targ_cflags=-DSTRICT_PE_FORMAT
;;
- i[3456]86-*-mingw32* | i[3456]86-*-cygwin* | i[3456]86-*-winnt | i[3456]86-*-pe)
+ i[3-7]86-*-mingw32* | i[3-7]86-*-cygwin* | i[3-7]86-*-winnt | i[3-7]86-*-pe)
targ_defvec=i386pe_vec
targ_selvecs="i386pe_vec i386pei_vec bfd_elf32_i386_vec"
;;
- i[3456]86-none-*)
+ i[3-7]86-none-*)
targ_defvec=i386coff_vec
;;
- i[3456]86-*-aout* | i[3456]86*-*-vsta*)
+ i[3-7]86-*-aout* | i[3-7]86*-*-vsta*)
targ_defvec=i386aout_vec
;;
- i[3456]86-*-vxworks*)
- targ_defvec=i386aout_vec
+ i[3-7]86-*-vxworks)
+ targ_defvec=bfd_elf32_i386_vec
targ_underscore=yes
;;
- i[3456]86-*-chaos)
+ i[3-7]86-*-chaos)
targ_defvec=bfd_elf32_i386_vec
targ_selfvecs=i386chaos_vec
;;
@@ -532,6 +600,29 @@ case "${targ}" in
targ_selvecs="icoff_little_vec icoff_big_vec"
;;
+ ip2k-*-elf)
+ targ_defvec=bfd_elf32_ip2k_vec
+ ;;
+
+ iq2000-*-elf)
+ targ_defvec=bfd_elf32_iq2000_vec
+ ;;
+
+ m32r*le-*-linux*)
+ targ_defvec=bfd_elf32_m32rlelin_vec
+ targ_selvecs="bfd_elf32_m32rlin_vec bfd_elf32_m32rlelin_vec"
+ ;;
+
+ m32r*-*-linux*)
+ targ_defvec=bfd_elf32_m32rlin_vec
+ targ_selvecs="bfd_elf32_m32rlin_vec bfd_elf32_m32rlelin_vec"
+ ;;
+
+ m32r*le-*-*)
+ targ_defvec=bfd_elf32_m32rle_vec
+ targ_selvecs="bfd_elf32_m32r_vec bfd_elf32_m32rle_vec"
+ ;;
+
m32r-*-*)
targ_defvec=bfd_elf32_m32r_vec
;;
@@ -571,7 +662,7 @@ case "${targ}" in
targ_defvec=m68kcoff_vec
targ_selvecs="m68kcoff_vec versados_vec ieee_vec aout0_big_vec"
;;
- m68*-*-elf* | m68*-*-sysv4*)
+ m68*-*-elf* | m68*-*-sysv4* | m68*-*-uclinux*)
targ_defvec=bfd_elf32_m68k_vec
targ_selvecs="m68kcoff_vec ieee_vec"
;;
@@ -675,19 +766,11 @@ case "${targ}" in
;;
mips*el-*-netbsd*)
targ_defvec=bfd_elf32_littlemips_vec
- targ_selvecs="bfd_elf32_bigmips_vec ecoff_little_vec ecoff_big_vec"
+ targ_selvecs="bfd_elf32_bigmips_vec bfd_elf64_bigmips_vec bfd_elf64_littlemips_vec ecoff_little_vec ecoff_big_vec"
;;
mips*-*-netbsd*)
targ_defvec=bfd_elf32_bigmips_vec
- targ_selvecs="bfd_elf32_littlemips_vec ecoff_big_vec ecoff_little_vec"
- ;;
- mips*-dec-bsd*)
- targ_defvec=aout_mips_little_vec
- targ_underscore=yes
- ;;
- mips*-dec-mach3*)
- targ_defvec=aout_mips_little_vec
- targ_cflags=-DSTAT_FOR_EXEC
+ targ_selvecs="bfd_elf32_littlemips_vec bfd_elf64_bigmips_vec bfd_elf64_littlemips_vec ecoff_big_vec ecoff_little_vec"
;;
mips*-dec-* | mips*el-*-ecoff*)
targ_defvec=ecoff_little_vec
@@ -699,8 +782,8 @@ case "${targ}" in
;;
#ifdef BFD64
mips*-*-irix6*)
- targ_defvec=bfd_elf32_bigmips_vec
- targ_selvecs="bfd_elf32_littlemips_vec bfd_elf64_bigmips_vec bfd_elf64_littlemips_vec"
+ targ_defvec=bfd_elf32_nbigmips_vec
+ targ_selvecs="bfd_elf32_nlittlemips_vec bfd_elf32_bigmips_vec bfd_elf32_littlemips_vec bfd_elf64_bigmips_vec bfd_elf64_littlemips_vec"
;;
#endif
mips*-*-irix5*)
@@ -715,15 +798,6 @@ case "${targ}" in
targ_defvec=ecoff_biglittle_vec
targ_selvecs="ecoff_little_vec ecoff_big_vec"
;;
- mips*-*-mach3*)
- targ_defvec=aout_mips_little_vec
- targ_cflags=-DSTAT_FOR_EXEC
- ;;
- mips*-*-pe*)
- targ_defvec=mipslpe_vec
- targ_selvecs="mipslpei_vec mipslpei_vec ecoff_little_vec ecoff_big_vec"
- targ_underscore=yes
- ;;
mips*-*-sysv4*)
targ_defvec=bfd_elf32_tradbigmips_vec
targ_selvecs="bfd_elf32_tradlittlemips_vec ecoff_big_vec ecoff_little_vec"
@@ -736,7 +810,7 @@ case "${targ}" in
targ_defvec=bfd_elf32_littlemips_vec
targ_selvecs="bfd_elf32_bigmips_vec bfd_elf64_bigmips_vec bfd_elf64_littlemips_vec"
;;
- mips*-*-elf* | mips*-*-rtems* | mips*-*-vxworks*)
+ mips*-*-elf* | mips*-*-rtems* | mips*-*-vxworks | mips*-*-windiss)
targ_defvec=bfd_elf32_bigmips_vec
targ_selvecs="bfd_elf32_littlemips_vec bfd_elf64_bigmips_vec bfd_elf64_littlemips_vec"
;;
@@ -754,21 +828,23 @@ case "${targ}" in
;;
#ifdef BFD64
mips64*el-*-linux*)
- targ_defvec=bfd_elf32_tradlittlemips_vec
- targ_selvecs="bfd_elf32_tradbigmips_vec bfd_elf64_tradlittlemips_vec bfd_elf64_tradbigmips_vec"
+ targ_defvec=bfd_elf32_ntradlittlemips_vec
+ targ_selvecs="bfd_elf32_ntradbigmips_vec bfd_elf32_tradlittlemips_vec bfd_elf32_tradbigmips_vec bfd_elf64_tradlittlemips_vec bfd_elf64_tradbigmips_vec"
;;
mips64*-*-linux*)
- targ_defvec=bfd_elf32_tradbigmips_vec
- targ_selvecs="bfd_elf32_tradlittlemips_vec bfd_elf64_tradbigmips_vec bfd_elf64_tradlittlemips_vec"
+ targ_defvec=bfd_elf32_ntradbigmips_vec
+ targ_selvecs="bfd_elf32_ntradlittlemips_vec bfd_elf32_tradbigmips_vec bfd_elf32_tradlittlemips_vec bfd_elf64_tradbigmips_vec bfd_elf64_tradlittlemips_vec"
;;
#endif
mips*el-*-linux*)
targ_defvec=bfd_elf32_tradlittlemips_vec
- targ_selvecs="bfd_elf32_tradbigmips_vec bfd_elf64_tradlittlemips_vec bfd_elf64_tradbigmips_vec ecoff_little_vec ecoff_big_vec"
+ targ_selvecs="bfd_elf32_tradbigmips_vec ecoff_little_vec ecoff_big_vec bfd_elf32_ntradlittlemips_vec bfd_elf64_tradlittlemips_vec bfd_elf32_ntradbigmips_vec bfd_elf64_tradbigmips_vec"
+ want64=true
;;
mips*-*-linux*)
targ_defvec=bfd_elf32_tradbigmips_vec
- targ_selvecs="bfd_elf32_tradlittlemips_vec bfd_elf64_tradbigmips_vec bfd_elf64_tradlittlemips_vec ecoff_big_vec ecoff_little_vec"
+ targ_selvecs="bfd_elf32_tradlittlemips_vec ecoff_big_vec ecoff_little_vec bfd_elf32_ntradbigmips_vec bfd_elf64_tradbigmips_vec bfd_elf32_ntradlittlemips_vec bfd_elf64_tradlittlemips_vec"
+ want64=true
;;
#ifdef BFD64
mmix-*-*)
@@ -782,6 +858,11 @@ case "${targ}" in
mn10300-*-*)
targ_defvec=bfd_elf32_mn10300_vec
+ targ_underscore=yes
+ ;;
+
+ msp430-*-*)
+ targ_defvec=bfd_elf32_msp430_vec
;;
ns32k-pc532-mach* | ns32k-pc532-ux*)
@@ -797,12 +878,12 @@ case "${targ}" in
targ_defvec=bfd_elf32_openrisc_vec
;;
- or32-*-coff | or32-*-rtems*)
+ or32-*-coff)
targ_defvec=or32coff_big_vec
targ_underscore=yes
;;
- or32-*-elf)
+ or32-*-elf | or32-*-rtems*)
targ_defvec=bfd_elf32_or32_big_vec
;;
@@ -821,13 +902,27 @@ case "${targ}" in
targ_selvecs="bfd_elf32_pjl_vec bfd_elf32_pj_vec bfd_elf32_i386_vec"
;;
+ powerpc-*-aix5.[01])
+ targ_defvec=rs6000coff_vec
+ targ_selvecs="aix5coff64_vec"
+ want64=true
+ ;;
+#ifdef BFD64
+ powerpc64-*-aix5.[01])
+ targ_defvec=aix5coff64_vec
+ targ_selvecs="rs6000coff_vec"
+ want64=true
+ ;;
+#endif
powerpc-*-aix5*)
+ targ_cflags=-DAIX_WEAK_SUPPORT
targ_defvec=rs6000coff_vec
targ_selvecs="aix5coff64_vec"
want64=true
;;
#ifdef BFD64
powerpc64-*-aix5*)
+ targ_cflags=-DAIX_WEAK_SUPPORT
targ_defvec=aix5coff64_vec
targ_selvecs="rs6000coff_vec"
want64=true
@@ -840,7 +935,6 @@ case "${targ}" in
case "${targ}" in
*-*-aix4.[3456789]* | *-*-aix[56789]*)
want64=true;;
-
*)
targ_cflags=-DSMALL_ARCHIVE;;
esac
@@ -850,7 +944,8 @@ case "${targ}" in
targ_defvec=rs6000coff64_vec
targ_selvecs=rs6000coff_vec
;;
- powerpc64-*-elf* | powerpc-*-elf64* | powerpc64-*-linux*)
+ 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"
;;
@@ -866,6 +961,16 @@ case "${targ}" in
targ_selvecs="rs6000coff_vec bfd_elf32_powerpcle_vec ppcboot_vec"
targ64_selvecs="bfd_elf64_powerpc_vec bfd_elf64_powerpcle_vec"
;;
+ powerpc-*-kaos*)
+ targ_defvec=bfd_elf32_powerpc_vec
+ targ_selvecs="bfd_elf32_powerpcle_vec ppcboot_vec"
+ targ64_selvecs="bfd_elf64_powerpc_vec bfd_elf64_powerpcle_vec"
+ ;;
+ powerpc-*-darwin* | powerpc-*-macos10* | powerpc-*-rhapsody*)
+ targ_defvec=mach_o_be_vec
+ targ_selvecs="mach_o_be_vec mach_o_le_vec mach_o_fat_vec pef_vec pef_xlib_vec sym_vec"
+ targ_archs="bfd_powerpc_arch bfd_rs6000_arch bfd_i386_arch"
+ ;;
powerpc-*-macos* | powerpc-*-mpw*)
targ_defvec=pmac_xcoff_vec
;;
@@ -873,6 +978,14 @@ case "${targ}" in
targ_defvec=bfd_elf32_powerpc_vec
targ_selvecs="nlm32_powerpc_vec rs6000coff_vec"
;;
+ powerpc-*-nto*)
+ targ_defvec=bfd_elf32_powerpc_vec
+ targ_selvecs="rs6000coff_vec bfd_elf32_powerpcle_vec ppcboot_vec"
+ ;;
+ powerpcle-*-nto*)
+ targ_defvec=bfd_elf32_powerpcle_vec
+ targ_selvecs="rs6000coff_vec bfd_elf32_powerpc_vec ppcboot_vec"
+ ;;
powerpcle-*-elf* | powerpcle-*-sysv4* | powerpcle-*-eabi* | \
powerpcle-*-solaris2* | powerpcle-*-linux-gnu* | powerpcle-*-vxworks* |\
powerpcle-*-rtems*)
@@ -880,7 +993,6 @@ case "${targ}" in
targ_selvecs="rs6000coff_vec bfd_elf32_powerpc_vec ppcboot_vec"
targ64_selvecs="bfd_elf64_powerpc_vec bfd_elf64_powerpcle_vec"
;;
-
powerpcle-*-pe | powerpcle-*-winnt* | powerpcle-*-cygwin*)
targ_defvec=bfd_powerpcle_pe_vec
targ_selvecs="bfd_powerpcle_pei_vec bfd_powerpc_pei_vec bfd_powerpcle_pe_vec bfd_powerpc_pe_vec"
@@ -909,12 +1021,12 @@ case "${targ}" in
targ_underscore=yes
;;
sh64eb-*-linux*)
- targ_defvec=bfd_elf32_shblin_vec
- targ_selvecs="bfd_elf32_shblin_vec bfd_elf32_sh64_vec bfd_elf64_sh64_vec bfd_elf32_sh_vec"
+ targ_defvec=bfd_elf32_sh64blin_vec
+ targ_selvecs="bfd_elf32_sh64lin_vec bfd_elf64_sh64blin_vec bfd_elf64_sh64lin_vec bfd_elf32_shblin_vec bfd_elf32_shlin_vec"
;;
sh64-*-linux*)
- targ_defvec=bfd_elf32_shlin_vec
- targ_selvecs="bfd_elf32_shlin_vec bfd_elf32_sh64l_vec bfd_elf64_sh64l_vec bfd_elf32_shl_vec"
+ targ_defvec=bfd_elf32_sh64lin_vec
+ targ_selvecs="bfd_elf32_sh64blin_vec bfd_elf64_sh64lin_vec bfd_elf64_sh64blin_vec bfd_elf32_shlin_vec bfd_elf32_shblin_vec"
;;
#endif /* BFD64 */
@@ -922,7 +1034,7 @@ case "${targ}" in
targ_defvec=bfd_elf32_shblin_vec
targ_selvecs=bfd_elf32_shlin_vec
#ifdef BFD64
- targ_selvecs="${targ_selvecs} bfd_elf32_sh64_vec bfd_elf32_sh64l_vec bfd_elf64_sh64_vec bfd_elf64_sh64l_vec"
+ targ_selvecs="${targ_selvecs} bfd_elf32_sh64lin_vec bfd_elf32_sh64blin_vec bfd_elf64_sh64lin_vec bfd_elf64_sh64blin_vec"
#endif
;;
sh*eb-*-linux*)
@@ -954,30 +1066,25 @@ case "${targ}" in
;;
#endif
- shle-*-netbsdelf*)
+ 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_sh64_vec bfd_elf32_sh64l_vec bfd_elf64_sh64_vec bfd_elf64_sh64l_vec"
+ targ_selvecs="${targ_selvecs} bfd_elf32_sh64lnbsd_vec bfd_elf32_sh64nbsd_vec bfd_elf64_sh64lnbsd_vec bfd_elf64_sh64nbsd_vec"
#endif
;;
- sh*le-*-netbsdelf*)
- targ_defvec=bfd_elf32_shlnbsd_vec
- targ_selvecs="bfd_elf32_shnbsd_vec shcoff_vec shlcoff_vec"
- ;;
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_sh64_vec bfd_elf32_sh64l_vec bfd_elf64_sh64_vec bfd_elf64_sh64l_vec"
+ targ_selvecs="${targ_selvecs} bfd_elf32_sh64lnbsd_vec bfd_elf32_sh64nbsd_vec bfd_elf64_sh64lnbsd_vec bfd_elf64_sh64nbsd_vec"
#endif
;;
sh*-*-netbsdelf*)
targ_defvec=bfd_elf32_shnbsd_vec
targ_selvecs="bfd_elf32_shlnbsd_vec shcoff_vec shlcoff_vec"
;;
-
- shl*-*-elf* | sh[1234]l*-*-elf* | sh3el*-*-elf*)
+ shl*-*-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
@@ -985,7 +1092,12 @@ case "${targ}" in
#endif
targ_underscore=yes
;;
- sh-*-elf* | sh[1234]*-elf* | sh-*-rtemself*)
+ sh-*-rtemscoff*)
+ targ_defvec=shcoff_vec
+ targ_selvecs="shcoff_vec shlcoff_vec shcoff_small_vec shlcoff_small_vec"
+ targ_underscore=yes
+ ;;
+ sh-*-elf* | sh[1234]*-elf* | sh-*-rtems* | sh-*-kaos*)
targ_defvec=bfd_elf32_sh_vec
targ_selvecs="bfd_elf32_shl_vec shcoff_vec shlcoff_vec shcoff_small_vec shlcoff_small_vec"
#ifdef BFD64
@@ -993,12 +1105,25 @@ case "${targ}" in
#endif
targ_underscore=yes
;;
+ sh-*-nto*)
+ targ_defvec=bfd_elf32_sh_vec
+ targ_selvecs="bfd_elf32_shl_vec shcoff_vec shlcoff_vec shcoff_small_vec shlcoff_small_vec"
+ targ_underscore=yes
+ ;;
sh-*-pe)
targ_defvec=shlpe_vec
targ_selvecs="shlpe_vec shlpei_vec"
targ_underscore=yes
;;
- sh-*-* | sh-*-rtems*)
+ sh-*-vxworks)
+ targ_defvec=bfd_elf32_sh_vec
+ targ_selvecs="bfd_elf32_shl_vec"
+ # FIXME None of the following are actually used on this target, but
+ # they're necessary for coff-sh.c (which is unconditionally used) to be
+ # compiled correctly.
+ targ_selvecs="$targ_selvecs shcoff_vec shlcoff_vec shcoff_small_vec shlcoff_small_vec"
+ ;;
+ sh-*-*)
targ_defvec=shcoff_vec
targ_selvecs="shcoff_vec shlcoff_vec shcoff_small_vec shlcoff_small_vec"
targ_underscore=yes
@@ -1041,10 +1166,14 @@ case "${targ}" in
targ_selvecs=bfd_elf32_sparc_vec
targ_underscore=yes
;;
- sparc-*-openbsd*)
+ sparc-*-openbsd[0-2].* | sparc-*-openbsd3.[0-1])
targ_defvec=sparcnetbsd_vec
targ_underscore=yes
;;
+ sparc-*-openbsd*)
+ targ_defvec=bfd_elf32_sparc_vec
+ targ_selvecs=sparcnetbsd_vec
+ ;;
sparc-*-elf* | sparc-*-solaris2.[0-6] | sparc-*-solaris2.[0-6].*)
targ_defvec=bfd_elf32_sparc_vec
targ_selvecs=sunos_big_vec
@@ -1105,7 +1234,6 @@ case "${targ}" in
targ_underscore=yes
;;
-
v850-*-*)
targ_defvec=bfd_elf32_v850_vec
;;
@@ -1132,6 +1260,15 @@ case "${targ}" in
targ_underscore=yes
;;
+ vax-*-openbsd*)
+ targ_defvec=vaxnetbsd_vec
+ targ_underscore=yes
+ ;;
+
+ vax-*-linux-gnu*)
+ targ_defvec=bfd_elf32_vax_vec
+ ;;
+
vax*-*-*vms*)
targ_defvec=vms_vax_vec
;;
@@ -1148,6 +1285,11 @@ case "${targ}" in
targ_defvec=bfd_elf32_xstormy16_vec
;;
+ xtensa-*-*)
+ targ_defvec=bfd_elf32_xtensa_le_vec
+ targ_selvecs=bfd_elf32_xtensa_be_vec
+ ;;
+
z8k*-*-*)
targ_defvec=z8kcoff_vec
targ_underscore=yes
@@ -1190,7 +1332,7 @@ esac
# to be used on an arbitrary ELF file for anything other than
# relocation information.
case "${targ_defvec} ${targ_selvecs}" in
- *bfd_elf64*)
+ *bfd_elf64* | *bfd_elf32_n*mips*)
targ_selvecs="${targ_selvecs} bfd_elf64_little_generic_vec bfd_elf64_big_generic_vec bfd_elf32_little_generic_vec bfd_elf32_big_generic_vec"
;;
*bfd_elf32*)
diff --git a/contrib/binutils/bfd/config.in b/contrib/binutils/bfd/config.in
index d13d196..ef9eca4 100644
--- a/contrib/binutils/bfd/config.in
+++ b/contrib/binutils/bfd/config.in
@@ -1,4 +1,4 @@
-/* config.in. Generated automatically from configure.in by autoheader 2.13. */
+/* config.in. Generated automatically from configure.in by autoheader. */
/* Define if using alloca.c. */
#undef C_ALLOCA
@@ -25,9 +25,6 @@
/* Define to `long' if <sys/types.h> doesn't define. */
#undef off_t
-/* Define if you need to in order for stat and other things to work. */
-#undef _POSIX_SOURCE
-
/* Define to `unsigned' if <sys/types.h> doesn't define. */
#undef size_t
@@ -64,6 +61,18 @@
/* Define if you have the fdopen function. */
#undef HAVE_FDOPEN
+/* Define if you have the fseeko function. */
+#undef HAVE_FSEEKO
+
+/* Define if you have the fseeko64 function. */
+#undef HAVE_FSEEKO64
+
+/* Define if you have the ftello function. */
+#undef HAVE_FTELLO
+
+/* Define if you have the ftello64 function. */
+#undef HAVE_FTELLO64
+
/* Define if you have the getcwd function. */
#undef HAVE_GETCWD
@@ -106,6 +115,9 @@
/* Define if you have the strchr function. */
#undef HAVE_STRCHR
+/* Define if you have the strtoull function. */
+#undef HAVE_STRTOULL
+
/* Define if you have the sysconf function. */
#undef HAVE_SYSCONF
@@ -190,6 +202,12 @@
/* Define as 1 if you have gettext and don't want to use GNU gettext. */
#undef HAVE_GETTEXT
+/* The number of bytes in type long long */
+#undef SIZEOF_LONG_LONG
+
+/* The number of bytes in type long */
+#undef SIZEOF_LONG
+
/* Use b modifier when opening binary files? */
#undef USE_BINARY_FOPEN
@@ -262,6 +280,9 @@
/* Name of host specific header file to include in trad-core.c. */
#undef TRAD_HEADER
+/* The number of bytes in type off_t */
+#undef SIZEOF_OFF_T
+
/* Use mmap if it's available? */
#undef USE_MMAP
diff --git a/contrib/binutils/bfd/configure b/contrib/binutils/bfd/configure
index 2eca955..49516021 100755
--- a/contrib/binutils/bfd/configure
+++ b/contrib/binutils/bfd/configure
@@ -37,7 +37,7 @@ 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
- --install-libbfd controls installation of libbfd and related headers"
+ --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
@@ -723,250 +723,51 @@ test "$host_alias" != "$target_alias" &&
NONENONEs,x,x, &&
program_prefix=${target_alias}-
-# 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:730: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- if test -n "$CC"; then
- ac_cv_prog_CC="$CC" # Let the user override the test.
-else
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
- ac_dummy="$PATH"
- for ac_dir in $ac_dummy; do
- test -z "$ac_dir" && ac_dir=.
- if test -f $ac_dir/$ac_word; then
- ac_cv_prog_CC="gcc"
- break
- fi
- done
- IFS="$ac_save_ifs"
-fi
-fi
-CC="$ac_cv_prog_CC"
-if test -n "$CC"; then
- echo "$ac_t""$CC" 1>&6
-else
- echo "$ac_t""no" 1>&6
-fi
-if test -z "$CC"; then
- # Extract the first word of "cc", so it can be a program name with args.
-set dummy cc; ac_word=$2
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:760: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- if test -n "$CC"; then
- ac_cv_prog_CC="$CC" # Let the user override the test.
-else
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
- ac_prog_rejected=no
- ac_dummy="$PATH"
- for ac_dir in $ac_dummy; do
- test -z "$ac_dir" && ac_dir=.
- if test -f $ac_dir/$ac_word; then
- if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then
- ac_prog_rejected=yes
- continue
- fi
- ac_cv_prog_CC="cc"
- break
- fi
- done
- IFS="$ac_save_ifs"
-if test $ac_prog_rejected = yes; then
- # We found a bogon in the path, so make sure we never use it.
- set dummy $ac_cv_prog_CC
- shift
- if test $# -gt 0; then
- # We chose a different compiler from the bogus one.
- # However, it has the same basename, so the bogon will be chosen
- # first if we set CC to just the basename; use the full file name.
- shift
- set dummy "$ac_dir/$ac_word" "$@"
- shift
- ac_cv_prog_CC="$@"
- fi
-fi
-fi
-fi
-CC="$ac_cv_prog_CC"
-if test -n "$CC"; then
- echo "$ac_t""$CC" 1>&6
-else
- echo "$ac_t""no" 1>&6
-fi
-
- if test -z "$CC"; then
- case "`uname -s`" in
- *win32* | *WIN32*)
- # Extract the first word of "cl", so it can be a program name with args.
-set dummy cl; ac_word=$2
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:811: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
+ echo $ac_n "checking for strerror in -lcposix""... $ac_c" 1>&6
+echo "configure:729: checking for strerror in -lcposix" >&5
+ac_lib_var=`echo cposix'_'strerror | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
- if test -n "$CC"; then
- ac_cv_prog_CC="$CC" # Let the user override the test.
-else
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
- ac_dummy="$PATH"
- for ac_dir in $ac_dummy; do
- test -z "$ac_dir" && ac_dir=.
- if test -f $ac_dir/$ac_word; then
- ac_cv_prog_CC="cl"
- break
- fi
- done
- IFS="$ac_save_ifs"
-fi
-fi
-CC="$ac_cv_prog_CC"
-if test -n "$CC"; then
- echo "$ac_t""$CC" 1>&6
-else
- echo "$ac_t""no" 1>&6
-fi
- ;;
- esac
- fi
- test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; }
-fi
-
-echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
-echo "configure:843: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
-
-ac_ext=c
-# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
-ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
-cross_compiling=$ac_cv_prog_cc_cross
-
-cat > conftest.$ac_ext << EOF
-
-#line 854 "configure"
+ 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();
-main(){return(0);}
+int main() {
+strerror()
+; return 0; }
EOF
-if { (eval echo configure:859: \"$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
+if { (eval echo configure:748: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=yes"
else
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
- 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:885: 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:890: 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:899: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
- ac_cv_prog_gcc=yes
-else
- ac_cv_prog_gcc=no
-fi
-fi
-
-echo "$ac_t""$ac_cv_prog_gcc" 1>&6
-
-if test $ac_cv_prog_gcc = yes; then
- GCC=yes
-else
- GCC=
-fi
-
-ac_test_CFLAGS="${CFLAGS+set}"
-ac_save_CFLAGS="$CFLAGS"
-CFLAGS=
-echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
-echo "configure:918: 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
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=no"
fi
rm -f conftest*
+LIBS="$ac_save_LIBS"
fi
-
-echo "$ac_t""$ac_cv_prog_cc_g" 1>&6
-if test "$ac_test_CFLAGS" = set; then
- CFLAGS="$ac_save_CFLAGS"
-elif test $ac_cv_prog_cc_g = yes; then
- if test "$GCC" = yes; then
- CFLAGS="-g -O2"
- else
- CFLAGS="-g"
- fi
-else
- if test "$GCC" = yes; then
- CFLAGS="-O2"
- else
- CFLAGS=
- fi
-fi
-
-echo $ac_n "checking for POSIXized ISC""... $ac_c" 1>&6
-echo "configure:950: checking for POSIXized ISC" >&5
-if test -d /etc/conf/kconfig.d &&
- grep _POSIX_VERSION /usr/include/sys/unistd.h >/dev/null 2>&1
-then
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
echo "$ac_t""yes" 1>&6
- ISC=yes # If later tests want to check for ISC.
- cat >> confdefs.h <<\EOF
-#define _POSIX_SOURCE 1
-EOF
-
- if test "$GCC" = yes; then
- CC="$CC -posix"
- else
- CC="$CC -Xp"
- fi
+ LIBS="$LIBS -lcposix"
else
echo "$ac_t""no" 1>&6
- ISC=
fi
+
+
+am__api_version="1.4"
# Find a good install program. We prefer a C program (faster),
# so one script is as good as another. But avoid the broken or
# incompatible versions:
@@ -979,7 +780,7 @@ fi
# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
# ./install, which can be erroneously created by make from ./install.sh.
echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6
-echo "configure:983: checking for a BSD compatible install" >&5
+echo "configure:784: checking for a BSD compatible install" >&5
if test -z "$INSTALL"; then
if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -1032,7 +833,7 @@ test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}'
test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
echo $ac_n "checking whether build environment is sane""... $ac_c" 1>&6
-echo "configure:1036: checking whether build environment is sane" >&5
+echo "configure:837: checking whether build environment is sane" >&5
# Just in case
sleep 1
echo timestamp > conftestfile
@@ -1089,7 +890,7 @@ test "$program_suffix" != NONE &&
test "$program_transform_name" = "" && program_transform_name="s,x,x,"
echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6
-echo "configure:1093: checking whether ${MAKE-make} sets \${MAKE}" >&5
+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
@@ -1118,7 +919,7 @@ fi
PACKAGE=bfd
-VERSION=2.13.1
+VERSION=2.15
if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then
{ echo "configure: error: source directory already configured; run "make distclean" there first" 1>&2; exit 1; }
@@ -1134,21 +935,21 @@ EOF
missing_dir=`cd $ac_aux_dir && pwd`
-echo $ac_n "checking for working aclocal""... $ac_c" 1>&6
-echo "configure:1139: checking for working aclocal" >&5
+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 --version) < /dev/null > /dev/null 2>&1; then
- ACLOCAL=aclocal
+if (aclocal-${am__api_version} --version) < /dev/null > /dev/null 2>&1; then
+ ACLOCAL=aclocal-${am__api_version}
echo "$ac_t""found" 1>&6
else
- ACLOCAL="$missing_dir/missing aclocal"
+ ACLOCAL="$missing_dir/missing aclocal-${am__api_version}"
echo "$ac_t""missing" 1>&6
fi
echo $ac_n "checking for working autoconf""... $ac_c" 1>&6
-echo "configure:1152: checking for working autoconf" >&5
+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.
@@ -1160,21 +961,21 @@ else
echo "$ac_t""missing" 1>&6
fi
-echo $ac_n "checking for working automake""... $ac_c" 1>&6
-echo "configure:1165: checking for working automake" >&5
+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 --version) < /dev/null > /dev/null 2>&1; then
- AUTOMAKE=automake
+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"
+ AUTOMAKE="$missing_dir/missing automake-${am__api_version}"
echo "$ac_t""missing" 1>&6
fi
echo $ac_n "checking for working autoheader""... $ac_c" 1>&6
-echo "configure:1178: checking for working autoheader" >&5
+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.
@@ -1187,7 +988,7 @@ else
fi
echo $ac_n "checking for working makeinfo""... $ac_c" 1>&6
-echo "configure:1191: checking for working makeinfo" >&5
+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.
@@ -1201,19 +1002,18 @@ fi
# Uncomment the next line to remove the date from the reported bfd version
-# is_release=y
+#is_release=y
bfd_version=`echo "${VERSION}" | sed -e 's/\([^\.]*\)\.*\([^\.]*\)\.*\([^\.]*\)\.*\([^\.]*\)\.*\([^\.]*\).*/\1.00\2.00\3.00\4.00\5/' -e 's/\([^\.]*\)\..*\(..\)\..*\(..\)\..*\(..\)\..*\(..\)$/\1\2\3\4\5/'`
bfd_version_string="\"${VERSION}\""
-bfd_version_date=`sed -e 's/.*DATE //' < ${srcdir}/version.h`
if test x${is_release} = x; then
+ bfd_version_date=`sed -n -e 's/.*DATE //p' < ${srcdir}/version.h`
bfd_version_string="\"${VERSION} ${bfd_version_date}\""
fi
-
if test $host != $build; then
ac_tool_prefix=${host_alias}-
else
@@ -1223,7 +1023,7 @@ fi
# Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args.
set dummy ${ac_tool_prefix}ar; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1227: checking for $ac_word" >&5
+echo "configure:1027: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_AR'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1255,7 +1055,7 @@ fi
# Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args.
set dummy ${ac_tool_prefix}ranlib; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1259: checking for $ac_word" >&5
+echo "configure:1059: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1287,7 +1087,7 @@ if test -n "$ac_tool_prefix"; then
# Extract the first word of "ranlib", so it can be a program name with args.
set dummy ranlib; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1291: checking for $ac_word" >&5
+echo "configure:1091: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1390,6 +1190,228 @@ else
enable_fast_install=yes
fi
+# Extract the first word of "gcc", so it can be a program name with args.
+set dummy gcc; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:1197: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
+ ac_dummy="$PATH"
+ for ac_dir in $ac_dummy; do
+ test -z "$ac_dir" && ac_dir=.
+ if test -f $ac_dir/$ac_word; then
+ ac_cv_prog_CC="gcc"
+ break
+ fi
+ done
+ IFS="$ac_save_ifs"
+fi
+fi
+CC="$ac_cv_prog_CC"
+if test -n "$CC"; then
+ echo "$ac_t""$CC" 1>&6
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+if test -z "$CC"; then
+ # Extract the first word of "cc", so it can be a program name with args.
+set dummy cc; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:1227: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
+ ac_prog_rejected=no
+ ac_dummy="$PATH"
+ for ac_dir in $ac_dummy; do
+ test -z "$ac_dir" && ac_dir=.
+ if test -f $ac_dir/$ac_word; then
+ if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then
+ ac_prog_rejected=yes
+ continue
+ fi
+ ac_cv_prog_CC="cc"
+ break
+ fi
+ done
+ IFS="$ac_save_ifs"
+if test $ac_prog_rejected = yes; then
+ # We found a bogon in the path, so make sure we never use it.
+ set dummy $ac_cv_prog_CC
+ shift
+ if test $# -gt 0; then
+ # We chose a different compiler from the bogus one.
+ # However, it has the same basename, so the bogon will be chosen
+ # first if we set CC to just the basename; use the full file name.
+ shift
+ set dummy "$ac_dir/$ac_word" "$@"
+ shift
+ ac_cv_prog_CC="$@"
+ fi
+fi
+fi
+fi
+CC="$ac_cv_prog_CC"
+if test -n "$CC"; then
+ echo "$ac_t""$CC" 1>&6
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+ if test -z "$CC"; then
+ case "`uname -s`" in
+ *win32* | *WIN32*)
+ # Extract the first word of "cl", so it can be a program name with args.
+set dummy cl; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:1278: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
+ ac_dummy="$PATH"
+ for ac_dir in $ac_dummy; do
+ test -z "$ac_dir" && ac_dir=.
+ if test -f $ac_dir/$ac_word; then
+ ac_cv_prog_CC="cl"
+ break
+ fi
+ done
+ IFS="$ac_save_ifs"
+fi
+fi
+CC="$ac_cv_prog_CC"
+if test -n "$CC"; then
+ echo "$ac_t""$CC" 1>&6
+else
+ echo "$ac_t""no" 1>&6
+fi
+ ;;
+ esac
+ fi
+ test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; }
+fi
+
+echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
+echo "configure:1310: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
+
+ac_ext=c
+# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
+ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
+cross_compiling=$ac_cv_prog_cc_cross
+
+cat > conftest.$ac_ext << EOF
+
+#line 1321 "configure"
+#include "confdefs.h"
+
+main(){return(0);}
+EOF
+if { (eval echo configure:1326: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ ac_cv_prog_cc_works=yes
+ # If we can't run a trivial program, we are probably using a cross compiler.
+ if (./conftest; exit) 2>/dev/null; then
+ ac_cv_prog_cc_cross=no
+ else
+ ac_cv_prog_cc_cross=yes
+ fi
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ ac_cv_prog_cc_works=no
+fi
+rm -fr conftest*
+ac_ext=c
+# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
+ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
+cross_compiling=$ac_cv_prog_cc_cross
+
+echo "$ac_t""$ac_cv_prog_cc_works" 1>&6
+if test $ac_cv_prog_cc_works = no; then
+ { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; }
+fi
+echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
+echo "configure:1352: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
+echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6
+cross_compiling=$ac_cv_prog_cc_cross
+
+echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6
+echo "configure:1357: checking whether we are using GNU C" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.c <<EOF
+#ifdef __GNUC__
+ yes;
+#endif
+EOF
+if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1366: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
+ ac_cv_prog_gcc=yes
+else
+ ac_cv_prog_gcc=no
+fi
+fi
+
+echo "$ac_t""$ac_cv_prog_gcc" 1>&6
+
+if test $ac_cv_prog_gcc = yes; then
+ GCC=yes
+else
+ GCC=
+fi
+
+ac_test_CFLAGS="${CFLAGS+set}"
+ac_save_CFLAGS="$CFLAGS"
+CFLAGS=
+echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
+echo "configure:1385: checking whether ${CC-cc} accepts -g" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ echo 'void f(){}' > conftest.c
+if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then
+ ac_cv_prog_cc_g=yes
+else
+ ac_cv_prog_cc_g=no
+fi
+rm -f conftest*
+
+fi
+
+echo "$ac_t""$ac_cv_prog_cc_g" 1>&6
+if test "$ac_test_CFLAGS" = set; then
+ CFLAGS="$ac_save_CFLAGS"
+elif test $ac_cv_prog_cc_g = yes; then
+ if test "$GCC" = yes; then
+ CFLAGS="-g -O2"
+ else
+ CFLAGS="-g"
+ fi
+else
+ if test "$GCC" = yes; then
+ CFLAGS="-O2"
+ else
+ CFLAGS=
+ fi
+fi
+
# Check whether --with-gnu-ld or --without-gnu-ld was given.
if test "${with_gnu_ld+set}" = set; then
withval="$with_gnu_ld"
@@ -1402,7 +1424,7 @@ ac_prog=ld
if test "$GCC" = yes; then
# Check if gcc -print-prog-name=ld gives a path.
echo $ac_n "checking for ld used by GCC""... $ac_c" 1>&6
-echo "configure:1406: checking for ld used by GCC" >&5
+echo "configure:1428: checking for ld used by GCC" >&5
case $host in
*-*-mingw*)
# gcc leaves a trailing carriage return which upsets mingw
@@ -1432,10 +1454,10 @@ echo "configure:1406: 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:1436: checking for GNU ld" >&5
+echo "configure:1458: checking for GNU ld" >&5
else
echo $ac_n "checking for non-GNU ld""... $ac_c" 1>&6
-echo "configure:1439: checking for non-GNU ld" >&5
+echo "configure:1461: checking for non-GNU ld" >&5
fi
if eval "test \"`echo '$''{'lt_cv_path_LD'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -1470,7 +1492,7 @@ else
fi
test -z "$LD" && { echo "configure: error: no acceptable ld found in \$PATH" 1>&2; exit 1; }
echo $ac_n "checking if the linker ($LD) is GNU ld""... $ac_c" 1>&6
-echo "configure:1474: checking if the linker ($LD) is GNU ld" >&5
+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
@@ -1487,7 +1509,7 @@ with_gnu_ld=$lt_cv_prog_gnu_ld
echo $ac_n "checking for $LD option to reload object files""... $ac_c" 1>&6
-echo "configure:1491: checking for $LD option to reload object files" >&5
+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
@@ -1499,7 +1521,7 @@ reload_flag=$lt_cv_ld_reload_flag
test -n "$reload_flag" && reload_flag=" $reload_flag"
echo $ac_n "checking for BSD-compatible nm""... $ac_c" 1>&6
-echo "configure:1503: checking for BSD-compatible nm" >&5
+echo "configure:1525: checking for BSD-compatible nm" >&5
if eval "test \"`echo '$''{'lt_cv_path_NM'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1537,7 +1559,7 @@ NM="$lt_cv_path_NM"
echo "$ac_t""$NM" 1>&6
echo $ac_n "checking whether ln -s works""... $ac_c" 1>&6
-echo "configure:1541: checking whether ln -s works" >&5
+echo "configure:1563: checking whether ln -s works" >&5
if eval "test \"`echo '$''{'ac_cv_prog_LN_S'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1558,7 +1580,7 @@ else
fi
echo $ac_n "checking how to recognise dependant libraries""... $ac_c" 1>&6
-echo "configure:1562: checking how to recognise dependant libraries" >&5
+echo "configure:1584: checking how to recognise dependant libraries" >&5
if eval "test \"`echo '$''{'lt_cv_deplibs_check_method'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1668,7 +1690,7 @@ irix5* | irix6*)
# This must be Linux ELF.
linux-gnu*)
case $host_cpu in
- alpha* | hppa* | i*86 | powerpc* | sparc* | ia64* )
+ 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
@@ -1731,13 +1753,13 @@ file_magic_cmd=$lt_cv_file_magic_cmd
deplibs_check_method=$lt_cv_deplibs_check_method
echo $ac_n "checking for object suffix""... $ac_c" 1>&6
-echo "configure:1735: checking for object suffix" >&5
+echo "configure:1757: checking for object suffix" >&5
if eval "test \"`echo '$''{'ac_cv_objext'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
rm -f conftest*
echo 'int i = 1;' > conftest.$ac_ext
-if { (eval echo configure:1741: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+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) ;;
@@ -1757,7 +1779,7 @@ ac_objext=$ac_cv_objext
echo $ac_n "checking for executable suffix""... $ac_c" 1>&6
-echo "configure:1761: checking for executable suffix" >&5
+echo "configure:1783: checking for executable suffix" >&5
if eval "test \"`echo '$''{'ac_cv_exeext'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1767,10 +1789,10 @@ else
rm -f conftest*
echo 'int main () { return 0; }' > conftest.$ac_ext
ac_cv_exeext=
- if { (eval echo configure:1771: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
+ if { (eval echo configure:1793: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
for file in conftest.*; do
case $file in
- *.$ac_ext | *.c | *.o | *.obj) ;;
+ *.c | *.o | *.obj) ;;
*) ac_cv_exeext=`echo $file | sed -e s/conftest//` ;;
esac
done
@@ -1794,7 +1816,7 @@ case $deplibs_check_method in
file_magic*)
if test "$file_magic_cmd" = '$MAGIC_CMD'; then
echo $ac_n "checking for ${ac_tool_prefix}file""... $ac_c" 1>&6
-echo "configure:1798: checking for ${ac_tool_prefix}file" >&5
+echo "configure:1820: checking for ${ac_tool_prefix}file" >&5
if eval "test \"`echo '$''{'lt_cv_path_MAGIC_CMD'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1856,7 +1878,7 @@ fi
if test -z "$lt_cv_path_MAGIC_CMD"; then
if test -n "$ac_tool_prefix"; then
echo $ac_n "checking for file""... $ac_c" 1>&6
-echo "configure:1860: checking for file" >&5
+echo "configure:1882: checking for file" >&5
if eval "test \"`echo '$''{'lt_cv_path_MAGIC_CMD'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1927,7 +1949,7 @@ esac
# Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args.
set dummy ${ac_tool_prefix}ranlib; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1931: checking for $ac_word" >&5
+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
@@ -1959,7 +1981,7 @@ if test -n "$ac_tool_prefix"; then
# Extract the first word of "ranlib", so it can be a program name with args.
set dummy ranlib; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1963: checking for $ac_word" >&5
+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
@@ -1994,7 +2016,7 @@ fi
# Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args.
set dummy ${ac_tool_prefix}strip; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1998: checking for $ac_word" >&5
+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
@@ -2026,7 +2048,7 @@ if test -n "$ac_tool_prefix"; then
# Extract the first word of "strip", so it can be a program name with args.
set dummy strip; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:2030: checking for $ac_word" >&5
+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
@@ -2093,8 +2115,21 @@ test x"$pic_mode" = xno && libtool_flags="$libtool_flags --prefer-non-pic"
case $host in
*-*-irix6*)
# Find out which ABI we are using.
- echo '#line 2097 "configure"' > conftest.$ac_ext
- if { (eval echo configure:2098: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ echo '#line 2119 "configure"' > conftest.$ac_ext
+ if { (eval echo configure:2120: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ if test "$lt_cv_prog_gnu_ld" = yes; then
+ case `/usr/bin/file conftest.$ac_objext` in
+ *32-bit*)
+ LD="${LD-ld} -melf32bsmip"
+ ;;
+ *N32*)
+ LD="${LD-ld} -melf32bmipn32"
+ ;;
+ *64-bit*)
+ LD="${LD-ld} -melf64bmip"
+ ;;
+ esac
+ else
case `/usr/bin/file conftest.$ac_objext` in
*32-bit*)
LD="${LD-ld} -32"
@@ -2106,6 +2141,7 @@ case $host in
LD="${LD-ld} -64"
;;
esac
+ fi
fi
rm -rf conftest*
;;
@@ -2113,7 +2149,7 @@ case $host in
ia64-*-hpux*)
# Find out which ABI we are using.
echo 'int i;' > conftest.$ac_ext
- if { (eval echo configure:2117: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ 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"
@@ -2131,7 +2167,7 @@ ia64-*-hpux*)
SAVE_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -belf"
echo $ac_n "checking whether the C compiler needs -belf""... $ac_c" 1>&6
-echo "configure:2135: checking whether the C compiler needs -belf" >&5
+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
@@ -2144,14 +2180,14 @@ ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$a
cross_compiling=$ac_cv_prog_cc_cross
cat > conftest.$ac_ext <<EOF
-#line 2148 "configure"
+#line 2184 "configure"
#include "confdefs.h"
int main() {
; return 0; }
EOF
-if { (eval echo configure:2155: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2191: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
lt_cv_cc_needs_belf=yes
else
@@ -2327,7 +2363,7 @@ if test x"$silent" != x"yes" && test x"$build_warnings" != x""; then
fi
fi
WARN_CFLAGS=""
-if test "x${build_warnings}" != x -a "x$GCC" = xyes ; then
+if test "x${build_warnings}" != x && test "x$GCC" = xyes ; then
WARN_CFLAGS="${build_warnings}"
fi
@@ -2341,7 +2377,7 @@ if test -z "$target" ; then
fi
echo $ac_n "checking whether to enable maintainer-specific portions of Makefiles""... $ac_c" 1>&6
-echo "configure:2345: checking whether to enable maintainer-specific portions of Makefiles" >&5
+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"
@@ -2364,13 +2400,13 @@ fi
echo $ac_n "checking whether to install libbfd""... $ac_c" 1>&6
-echo "configure:2368: checking whether to install libbfd" >&5
+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}" -o "$enable_shared" = "yes"; then
+ if test "${host}" = "${target}" || test "$enable_shared" = "yes"; then
install_libbfd_p=yes
else
install_libbfd_p=no
@@ -2401,7 +2437,7 @@ fi
echo $ac_n "checking for executable suffix""... $ac_c" 1>&6
-echo "configure:2405: checking for executable suffix" >&5
+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
@@ -2411,10 +2447,10 @@ else
rm -f conftest*
echo 'int main () { return 0; }' > conftest.$ac_ext
ac_cv_exeext=
- if { (eval echo configure:2415: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
+ if { (eval echo configure:2451: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
for file in conftest.*; do
case $file in
- *.$ac_ext | *.c | *.o | *.obj) ;;
+ *.c | *.o | *.obj) ;;
*) ac_cv_exeext=`echo $file | sed -e s/conftest//` ;;
esac
done
@@ -2441,7 +2477,7 @@ bfd_default_target_size=32
# Extract the first word of "gcc", so it can be a program name with args.
set dummy gcc; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:2445: checking for $ac_word" >&5
+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
@@ -2471,7 +2507,7 @@ if test -z "$CC"; then
# Extract the first word of "cc", so it can be a program name with args.
set dummy cc; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:2475: checking for $ac_word" >&5
+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
@@ -2522,7 +2558,7 @@ fi
# Extract the first word of "cl", so it can be a program name with args.
set dummy cl; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:2526: checking for $ac_word" >&5
+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
@@ -2554,7 +2590,7 @@ fi
fi
echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
-echo "configure:2558: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
+echo "configure:2594: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
ac_ext=c
# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
@@ -2565,12 +2601,12 @@ cross_compiling=$ac_cv_prog_cc_cross
cat > conftest.$ac_ext << EOF
-#line 2569 "configure"
+#line 2605 "configure"
#include "confdefs.h"
main(){return(0);}
EOF
-if { (eval echo configure:2574: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+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
@@ -2596,12 +2632,12 @@ if test $ac_cv_prog_cc_works = no; then
{ echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; }
fi
echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
-echo "configure:2600: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
+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:2605: checking whether we are using GNU C" >&5
+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
@@ -2610,7 +2646,7 @@ else
yes;
#endif
EOF
-if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:2614: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
+if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure: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
@@ -2629,7 +2665,7 @@ ac_test_CFLAGS="${CFLAGS+set}"
ac_save_CFLAGS="$CFLAGS"
CFLAGS=
echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
-echo "configure:2633: checking whether ${CC-cc} accepts -g" >&5
+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
@@ -2661,9 +2697,9 @@ else
fi
-ALL_LINGUAS="fr tr ja es sv da"
+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:2667: checking how to run the C preprocessor" >&5
+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=
@@ -2678,13 +2714,13 @@ else
# On the NeXT, cc -E runs the code through the compiler's parser,
# not just through cpp.
cat > conftest.$ac_ext <<EOF
-#line 2682 "configure"
+#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:2688: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (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
:
@@ -2695,13 +2731,13 @@ else
rm -rf conftest*
CPP="${CC-cc} -E -traditional-cpp"
cat > conftest.$ac_ext <<EOF
-#line 2699 "configure"
+#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:2705: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (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
:
@@ -2712,13 +2748,13 @@ else
rm -rf conftest*
CPP="${CC-cc} -nologo -E"
cat > conftest.$ac_ext <<EOF
-#line 2716 "configure"
+#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:2722: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (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
:
@@ -2745,7 +2781,7 @@ echo "$ac_t""$CPP" 1>&6
# Extract the first word of "ranlib", so it can be a program name with args.
set dummy ranlib; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:2749: checking for $ac_word" >&5
+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
@@ -2773,12 +2809,12 @@ else
fi
echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6
-echo "configure:2777: checking for ANSI C header files" >&5
+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 2782 "configure"
+#line 2818 "configure"
#include "confdefs.h"
#include <stdlib.h>
#include <stdarg.h>
@@ -2786,7 +2822,7 @@ else
#include <float.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2790: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (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*
@@ -2803,7 +2839,7 @@ rm -f conftest*
if test $ac_cv_header_stdc = yes; then
# SunOS 4.x string.h does not declare mem*, contrary to ANSI.
cat > conftest.$ac_ext <<EOF
-#line 2807 "configure"
+#line 2843 "configure"
#include "confdefs.h"
#include <string.h>
EOF
@@ -2821,7 +2857,7 @@ fi
if test $ac_cv_header_stdc = yes; then
# ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
cat > conftest.$ac_ext <<EOF
-#line 2825 "configure"
+#line 2861 "configure"
#include "confdefs.h"
#include <stdlib.h>
EOF
@@ -2842,7 +2878,7 @@ if test "$cross_compiling" = yes; then
:
else
cat > conftest.$ac_ext <<EOF
-#line 2846 "configure"
+#line 2882 "configure"
#include "confdefs.h"
#include <ctype.h>
#define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
@@ -2853,7 +2889,7 @@ if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2);
exit (0); }
EOF
-if { (eval echo configure:2857: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+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
@@ -2877,12 +2913,12 @@ EOF
fi
echo $ac_n "checking for working const""... $ac_c" 1>&6
-echo "configure:2881: checking for working const" >&5
+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 2886 "configure"
+#line 2922 "configure"
#include "confdefs.h"
int main() {
@@ -2931,7 +2967,7 @@ ccp = (char const *const *) p;
; return 0; }
EOF
-if { (eval echo configure:2935: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:2971: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_c_const=yes
else
@@ -2952,21 +2988,21 @@ EOF
fi
echo $ac_n "checking for inline""... $ac_c" 1>&6
-echo "configure:2956: checking for inline" >&5
+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 2963 "configure"
+#line 2999 "configure"
#include "confdefs.h"
int main() {
} $ac_kw foo() {
; return 0; }
EOF
-if { (eval echo configure:2970: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+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
@@ -2992,12 +3028,12 @@ EOF
esac
echo $ac_n "checking for off_t""... $ac_c" 1>&6
-echo "configure:2996: checking for off_t" >&5
+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 3001 "configure"
+#line 3037 "configure"
#include "confdefs.h"
#include <sys/types.h>
#if STDC_HEADERS
@@ -3025,12 +3061,12 @@ EOF
fi
echo $ac_n "checking for size_t""... $ac_c" 1>&6
-echo "configure:3029: checking for size_t" >&5
+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 3034 "configure"
+#line 3070 "configure"
#include "confdefs.h"
#include <sys/types.h>
#if STDC_HEADERS
@@ -3060,19 +3096,19 @@ fi
# The Ultrix 4.2 mips builtin alloca declared by alloca.h only works
# for constant arguments. Useless!
echo $ac_n "checking for working alloca.h""... $ac_c" 1>&6
-echo "configure:3064: checking for working alloca.h" >&5
+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 3069 "configure"
+#line 3105 "configure"
#include "confdefs.h"
#include <alloca.h>
int main() {
char *p = alloca(2 * sizeof(int));
; return 0; }
EOF
-if { (eval echo configure:3076: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+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
@@ -3093,12 +3129,12 @@ EOF
fi
echo $ac_n "checking for alloca""... $ac_c" 1>&6
-echo "configure:3097: checking for alloca" >&5
+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 3102 "configure"
+#line 3138 "configure"
#include "confdefs.h"
#ifdef __GNUC__
@@ -3126,7 +3162,7 @@ int main() {
char *p = (char *) alloca(1);
; return 0; }
EOF
-if { (eval echo configure:3130: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3166: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
ac_cv_func_alloca_works=yes
else
@@ -3158,12 +3194,12 @@ EOF
echo $ac_n "checking whether alloca needs Cray hooks""... $ac_c" 1>&6
-echo "configure:3162: checking whether alloca needs Cray hooks" >&5
+echo "configure:3198: checking whether alloca needs Cray hooks" >&5
if eval "test \"`echo '$''{'ac_cv_os_cray'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 3167 "configure"
+#line 3203 "configure"
#include "confdefs.h"
#if defined(CRAY) && ! defined(CRAY2)
webecray
@@ -3188,12 +3224,12 @@ 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:3192: checking for $ac_func" >&5
+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 3197 "configure"
+#line 3233 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -3216,7 +3252,7 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:3220: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+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
@@ -3243,7 +3279,7 @@ done
fi
echo $ac_n "checking stack direction for C alloca""... $ac_c" 1>&6
-echo "configure:3247: checking stack direction for C alloca" >&5
+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
@@ -3251,7 +3287,7 @@ else
ac_cv_c_stack_direction=0
else
cat > conftest.$ac_ext <<EOF
-#line 3255 "configure"
+#line 3291 "configure"
#include "confdefs.h"
find_stack_direction ()
{
@@ -3270,7 +3306,7 @@ main ()
exit (find_stack_direction() < 0);
}
EOF
-if { (eval echo configure:3274: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:3310: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
ac_cv_c_stack_direction=1
else
@@ -3291,21 +3327,21 @@ EOF
fi
-for ac_hdr in unistd.h
+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:3299: checking for $ac_hdr" >&5
+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 3304 "configure"
+#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:3309: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (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*
@@ -3334,12 +3370,12 @@ done
for ac_func in getpagesize
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:3338: checking for $ac_func" >&5
+echo "configure:3374: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 3343 "configure"
+#line 3379 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -3362,7 +3398,7 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:3366: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+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
@@ -3387,7 +3423,7 @@ fi
done
echo $ac_n "checking for working mmap""... $ac_c" 1>&6
-echo "configure:3391: checking for working mmap" >&5
+echo "configure:3427: checking for working mmap" >&5
if eval "test \"`echo '$''{'ac_cv_func_mmap_fixed_mapped'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -3395,7 +3431,7 @@ else
ac_cv_func_mmap_fixed_mapped=no
else
cat > conftest.$ac_ext <<EOF
-#line 3399 "configure"
+#line 3435 "configure"
#include "confdefs.h"
/* Thanks to Mike Haertel and Jim Avera for this test.
@@ -3423,11 +3459,24 @@ else
#include <fcntl.h>
#include <sys/mman.h>
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_STDLIB_H
+# include <stdlib.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
/* This mess was copied from the GNU getpagesize.h. */
#ifndef HAVE_GETPAGESIZE
-# ifdef HAVE_UNISTD_H
-# include <unistd.h>
-# endif
/* Assume that all systems that can run configure have sys/param.h. */
# ifndef HAVE_SYS_PARAM_H
@@ -3535,7 +3584,7 @@ main()
}
EOF
-if { (eval echo configure:3539: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+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
@@ -3563,17 +3612,17 @@ unistd.h values.h sys/param.h
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:3567: checking for $ac_hdr" >&5
+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 3572 "configure"
+#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:3577: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (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*
@@ -3603,12 +3652,12 @@ done
__argz_count __argz_stringify __argz_next
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:3607: checking for $ac_func" >&5
+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 3612 "configure"
+#line 3661 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -3631,7 +3680,7 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:3635: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+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
@@ -3660,12 +3709,12 @@ done
for ac_func in stpcpy
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:3664: checking for $ac_func" >&5
+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 3669 "configure"
+#line 3718 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -3688,7 +3737,7 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:3692: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+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
@@ -3722,19 +3771,19 @@ EOF
if test $ac_cv_header_locale_h = yes; then
echo $ac_n "checking for LC_MESSAGES""... $ac_c" 1>&6
-echo "configure:3726: checking for LC_MESSAGES" >&5
+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 3731 "configure"
+#line 3780 "configure"
#include "confdefs.h"
#include <locale.h>
int main() {
return LC_MESSAGES
; return 0; }
EOF
-if { (eval echo configure:3738: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+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
@@ -3755,7 +3804,7 @@ EOF
fi
fi
echo $ac_n "checking whether NLS is requested""... $ac_c" 1>&6
-echo "configure:3759: checking whether NLS is requested" >&5
+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"
@@ -3775,7 +3824,7 @@ fi
EOF
echo $ac_n "checking whether included gettext is requested""... $ac_c" 1>&6
-echo "configure:3779: checking whether included gettext is requested" >&5
+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"
@@ -3794,17 +3843,17 @@ fi
ac_safe=`echo "libintl.h" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for libintl.h""... $ac_c" 1>&6
-echo "configure:3798: checking for libintl.h" >&5
+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 3803 "configure"
+#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:3808: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (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*
@@ -3821,19 +3870,19 @@ fi
if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
echo "$ac_t""yes" 1>&6
echo $ac_n "checking for gettext in libc""... $ac_c" 1>&6
-echo "configure:3825: checking for gettext in libc" >&5
+echo "configure:3874: checking for gettext in libc" >&5
if eval "test \"`echo '$''{'gt_cv_func_gettext_libc'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 3830 "configure"
+#line 3879 "configure"
#include "confdefs.h"
#include <libintl.h>
int main() {
return (int) gettext ("")
; return 0; }
EOF
-if { (eval echo configure:3837: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3886: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
gt_cv_func_gettext_libc=yes
else
@@ -3849,7 +3898,7 @@ echo "$ac_t""$gt_cv_func_gettext_libc" 1>&6
if test "$gt_cv_func_gettext_libc" != "yes"; then
echo $ac_n "checking for bindtextdomain in -lintl""... $ac_c" 1>&6
-echo "configure:3853: checking for bindtextdomain in -lintl" >&5
+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
@@ -3857,7 +3906,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lintl $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 3861 "configure"
+#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
@@ -3868,7 +3917,7 @@ int main() {
bindtextdomain()
; return 0; }
EOF
-if { (eval echo configure:3872: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+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
@@ -3884,19 +3933,19 @@ fi
if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
echo "$ac_t""yes" 1>&6
echo $ac_n "checking for gettext in libintl""... $ac_c" 1>&6
-echo "configure:3888: checking for gettext in libintl" >&5
+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 3893 "configure"
+#line 3942 "configure"
#include "confdefs.h"
int main() {
return (int) gettext ("")
; return 0; }
EOF
-if { (eval echo configure:3900: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+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
@@ -3924,7 +3973,7 @@ EOF
# Extract the first word of "msgfmt", so it can be a program name with args.
set dummy msgfmt; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:3928: checking for $ac_word" >&5
+echo "configure:3977: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_path_MSGFMT'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -3958,12 +4007,12 @@ fi
for ac_func in dcgettext
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:3962: checking for $ac_func" >&5
+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 3967 "configure"
+#line 4016 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -3986,7 +4035,7 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:3990: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+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
@@ -4013,7 +4062,7 @@ done
# Extract the first word of "gmsgfmt", so it can be a program name with args.
set dummy gmsgfmt; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:4017: checking for $ac_word" >&5
+echo "configure:4066: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_path_GMSGFMT'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -4049,7 +4098,7 @@ fi
# Extract the first word of "xgettext", so it can be a program name with args.
set dummy xgettext; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:4053: checking for $ac_word" >&5
+echo "configure:4102: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_path_XGETTEXT'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -4081,7 +4130,7 @@ else
fi
cat > conftest.$ac_ext <<EOF
-#line 4085 "configure"
+#line 4134 "configure"
#include "confdefs.h"
int main() {
@@ -4089,7 +4138,7 @@ extern int _nl_msg_cat_cntr;
return _nl_msg_cat_cntr
; return 0; }
EOF
-if { (eval echo configure:4093: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+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
@@ -4121,7 +4170,7 @@ fi
# Extract the first word of "msgfmt", so it can be a program name with args.
set dummy msgfmt; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:4125: checking for $ac_word" >&5
+echo "configure:4174: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_path_MSGFMT'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -4155,7 +4204,7 @@ fi
# Extract the first word of "gmsgfmt", so it can be a program name with args.
set dummy gmsgfmt; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:4159: checking for $ac_word" >&5
+echo "configure:4208: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_path_GMSGFMT'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -4191,7 +4240,7 @@ fi
# Extract the first word of "xgettext", so it can be a program name with args.
set dummy xgettext; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:4195: checking for $ac_word" >&5
+echo "configure:4244: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_path_XGETTEXT'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -4281,7 +4330,7 @@ fi
LINGUAS=
else
echo $ac_n "checking for catalogs to be installed""... $ac_c" 1>&6
-echo "configure:4285: checking for catalogs to be installed" >&5
+echo "configure:4334: checking for catalogs to be installed" >&5
NEW_LINGUAS=
for lang in ${LINGUAS=$ALL_LINGUAS}; do
case "$ALL_LINGUAS" in
@@ -4309,17 +4358,17 @@ echo "configure:4285: checking for catalogs to be installed" >&5
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:4313: checking for linux/version.h" >&5
+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 4318 "configure"
+#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:4323: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (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*
@@ -4397,7 +4446,7 @@ fi
# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
# ./install, which can be erroneously created by make from ./install.sh.
echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6
-echo "configure:4401: checking for a BSD compatible install" >&5
+echo "configure:4450: checking for a BSD compatible install" >&5
if test -z "$INSTALL"; then
if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -4451,21 +4500,141 @@ test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
BFD_HOST_64BIT_LONG=0
+BFD_HOST_LONG_LONG=0
BFD_HOST_64_BIT_DEFINED=0
BFD_HOST_64_BIT=
BFD_HOST_U_64_BIT=
-if test "x${HOST_64BIT_TYPE}" = "xlong"; then
+
+echo $ac_n "checking for long long""... $ac_c" 1>&6
+echo "configure:4510: checking for long long" >&5
+if eval "test \"`echo '$''{'bfd_cv_has_long_long'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 4515 "configure"
+#include "confdefs.h"
+
+int main() {
+unsigned long long ll = 18446744073709551615ULL;
+; return 0; }
+EOF
+if { (eval echo configure:4522: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ bfd_cv_has_long_long=yes
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ bfd_cv_has_long_long=no
+fi
+rm -f conftest*
+fi
+
+echo "$ac_t""$bfd_cv_has_long_long" 1>&6
+if test $bfd_cv_has_long_long = yes; then
+ BFD_HOST_LONG_LONG=1
+ echo $ac_n "checking size of long long""... $ac_c" 1>&6
+echo "configure:4538: checking size of long long" >&5
+if eval "test \"`echo '$''{'ac_cv_sizeof_long_long'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ for ac_size in 4 8 1 2 16 12 ; do # List sizes in rough order of prevalence.
+ cat > conftest.$ac_ext <<EOF
+#line 4544 "configure"
+#include "confdefs.h"
+#include "confdefs.h"
+#include <sys/types.h>
+
+
+int main() {
+switch (0) case 0: case (sizeof (long long) == $ac_size):;
+; return 0; }
+EOF
+if { (eval echo configure:4554: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ ac_cv_sizeof_long_long=$ac_size
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+fi
+rm -f conftest*
+ if test x$ac_cv_sizeof_long_long != x ; then break; fi
+done
+
+fi
+
+if test x$ac_cv_sizeof_long_long = x ; then
+ { echo "configure: error: cannot determine a size for long long" 1>&2; exit 1; }
+fi
+echo "$ac_t""$ac_cv_sizeof_long_long" 1>&6
+cat >> confdefs.h <<EOF
+#define SIZEOF_LONG_LONG $ac_cv_sizeof_long_long
+EOF
+
+
+fi
+
+echo $ac_n "checking size of long""... $ac_c" 1>&6
+echo "configure:4579: checking size of long" >&5
+if eval "test \"`echo '$''{'ac_cv_sizeof_long'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ for ac_size in 4 8 1 2 16 12 ; do # List sizes in rough order of prevalence.
+ cat > conftest.$ac_ext <<EOF
+#line 4585 "configure"
+#include "confdefs.h"
+#include "confdefs.h"
+#include <sys/types.h>
+
+
+int main() {
+switch (0) case 0: case (sizeof (long) == $ac_size):;
+; return 0; }
+EOF
+if { (eval echo configure:4595: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ ac_cv_sizeof_long=$ac_size
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+fi
+rm -f conftest*
+ if test x$ac_cv_sizeof_long != x ; then break; fi
+done
+
+fi
+
+if test x$ac_cv_sizeof_long = x ; then
+ { echo "configure: error: cannot determine a size for long" 1>&2; exit 1; }
+fi
+echo "$ac_t""$ac_cv_sizeof_long" 1>&6
+cat >> confdefs.h <<EOF
+#define SIZEOF_LONG $ac_cv_sizeof_long
+EOF
+
+
+if test "x${ac_cv_sizeof_long}" = "x8"; then
+ host64=true
BFD_HOST_64BIT_LONG=1
-elif test "x${HOST_64BIT_TYPE}" != "x"; then
+ test -n "${HOST_64BIT_TYPE}" || HOST_64BIT_TYPE="long"
+ test -n "${HOST_U_64BIT_TYPE}" || HOST_U_64BIT_TYPE="unsigned long"
+elif test "x${ac_cv_sizeof_long_long}" = "x8"; then
+ test -n "${HOST_64BIT_TYPE}" || HOST_64BIT_TYPE="long long"
+ test -n "${HOST_U_64BIT_TYPE}" || HOST_U_64BIT_TYPE="unsigned long long"
+fi
+
+if test -n "${HOST_64BIT_TYPE}" -a -n "${HOST_U_64BIT_TYPE}"; then
BFD_HOST_64_BIT_DEFINED=1
- BFD_HOST_64_BIT=${HOST_64BIT_TYPE}
- BFD_HOST_U_64_BIT=${HOST_U_64BIT_TYPE}
+ BFD_HOST_64_BIT="${HOST_64BIT_TYPE}"
+ BFD_HOST_U_64_BIT="${HOST_U_64BIT_TYPE}"
fi
+
+
# Put a plausible default for CC_FOR_BUILD in Makefile.
if test -z "$CC_FOR_BUILD"; then
if test "x$cross_compiling" = "xno"; then
@@ -4480,7 +4649,7 @@ 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:4484: checking for build system executable suffix" >&5
+echo "configure:4653: checking for build system executable suffix" >&5
if eval "test \"`echo '$''{'bfd_cv_build_exeext'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -4508,17 +4677,17 @@ for ac_hdr in stddef.h string.h strings.h stdlib.h time.h unistd.h
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:4512: checking for $ac_hdr" >&5
+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 4517 "configure"
+#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:4522: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (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*
@@ -4548,17 +4717,17 @@ for ac_hdr in fcntl.h sys/file.h sys/time.h
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:4552: checking for $ac_hdr" >&5
+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 4557 "configure"
+#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:4562: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (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*
@@ -4585,12 +4754,12 @@ fi
done
echo $ac_n "checking whether time.h and sys/time.h may both be included""... $ac_c" 1>&6
-echo "configure:4589: checking whether time.h and sys/time.h may both be included" >&5
+echo "configure:4758: checking whether time.h and sys/time.h may both be included" >&5
if eval "test \"`echo '$''{'ac_cv_header_time'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 4594 "configure"
+#line 4763 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <sys/time.h>
@@ -4599,7 +4768,7 @@ int main() {
struct tm *tp;
; return 0; }
EOF
-if { (eval echo configure:4603: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4772: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_header_time=yes
else
@@ -4624,12 +4793,12 @@ 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:4628: checking for $ac_hdr that defines DIR" >&5
+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 4633 "configure"
+#line 4802 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <$ac_hdr>
@@ -4637,7 +4806,7 @@ int main() {
DIR *dirp = 0;
; return 0; }
EOF
-if { (eval echo configure:4641: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+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
@@ -4662,7 +4831,7 @@ done
# Two versions of opendir et al. are in -ldir and -lx on SCO Xenix.
if test $ac_header_dirent = dirent.h; then
echo $ac_n "checking for opendir in -ldir""... $ac_c" 1>&6
-echo "configure:4666: checking for opendir in -ldir" >&5
+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
@@ -4670,7 +4839,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-ldir $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 4674 "configure"
+#line 4843 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
@@ -4681,7 +4850,7 @@ int main() {
opendir()
; return 0; }
EOF
-if { (eval echo configure:4685: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+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
@@ -4703,7 +4872,7 @@ fi
else
echo $ac_n "checking for opendir in -lx""... $ac_c" 1>&6
-echo "configure:4707: checking for opendir in -lx" >&5
+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
@@ -4711,7 +4880,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lx $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 4715 "configure"
+#line 4884 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
@@ -4722,7 +4891,7 @@ int main() {
opendir()
; return 0; }
EOF
-if { (eval echo configure:4726: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+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
@@ -4747,12 +4916,12 @@ fi
for ac_func in fcntl getpagesize setitimer sysconf fdopen getuid getgid
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:4751: checking for $ac_func" >&5
+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 4756 "configure"
+#line 4925 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -4775,7 +4944,62 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:4779: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4948: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_func_$ac_func=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_func_$ac_func=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+ cat >> confdefs.h <<EOF
+#define $ac_tr_func 1
+EOF
+
+else
+ echo "$ac_t""no" 1>&6
+fi
+done
+
+for ac_func in strtoull
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:4975: checking for $ac_func" >&5
+if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 4980 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char $ac_func(); below. */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char $ac_func();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+ to always fail with ENOSYS. Some functions are actually named
+ something starting with __ and the normal name is an alias. */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+$ac_func();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:5003: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@@ -4810,12 +5034,12 @@ EOF
esac
echo $ac_n "checking whether strstr must be declared""... $ac_c" 1>&6
-echo "configure:4814: checking whether strstr must be declared" >&5
+echo "configure:5038: checking whether strstr must be declared" >&5
if eval "test \"`echo '$''{'bfd_cv_decl_needed_strstr'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 4819 "configure"
+#line 5043 "configure"
#include "confdefs.h"
#include <stdio.h>
@@ -4836,7 +5060,7 @@ int main() {
char *(*pfn) = (char *(*)) strstr
; return 0; }
EOF
-if { (eval echo configure:4840: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:5064: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
bfd_cv_decl_needed_strstr=no
else
@@ -4857,12 +5081,12 @@ EOF
fi
echo $ac_n "checking whether malloc must be declared""... $ac_c" 1>&6
-echo "configure:4861: checking whether malloc must be declared" >&5
+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 4866 "configure"
+#line 5090 "configure"
#include "confdefs.h"
#include <stdio.h>
@@ -4883,7 +5107,7 @@ int main() {
char *(*pfn) = (char *(*)) malloc
; return 0; }
EOF
-if { (eval echo configure:4887: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+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
@@ -4904,12 +5128,12 @@ EOF
fi
echo $ac_n "checking whether realloc must be declared""... $ac_c" 1>&6
-echo "configure:4908: checking whether realloc must be declared" >&5
+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 4913 "configure"
+#line 5137 "configure"
#include "confdefs.h"
#include <stdio.h>
@@ -4930,7 +5154,7 @@ int main() {
char *(*pfn) = (char *(*)) realloc
; return 0; }
EOF
-if { (eval echo configure:4934: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+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
@@ -4951,12 +5175,12 @@ EOF
fi
echo $ac_n "checking whether free must be declared""... $ac_c" 1>&6
-echo "configure:4955: checking whether free must be declared" >&5
+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 4960 "configure"
+#line 5184 "configure"
#include "confdefs.h"
#include <stdio.h>
@@ -4977,7 +5201,7 @@ int main() {
char *(*pfn) = (char *(*)) free
; return 0; }
EOF
-if { (eval echo configure:4981: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:5205: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
bfd_cv_decl_needed_free=no
else
@@ -4998,12 +5222,12 @@ EOF
fi
echo $ac_n "checking whether getenv must be declared""... $ac_c" 1>&6
-echo "configure:5002: checking whether getenv must be declared" >&5
+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 5007 "configure"
+#line 5231 "configure"
#include "confdefs.h"
#include <stdio.h>
@@ -5024,7 +5248,7 @@ int main() {
char *(*pfn) = (char *(*)) getenv
; return 0; }
EOF
-if { (eval echo configure:5028: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+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
@@ -5051,7 +5275,7 @@ COREFLAG=
TRAD_HEADER=
if test "${target}" = "${host}"; then
case "${host}" in
- alpha*-*-freebsd*)
+ alpha*-*-freebsd* | alpha*-*-kfreebsd*-gnu)
COREFILE=''
;;
alpha*-*-linux-gnu*)
@@ -5062,7 +5286,8 @@ if test "${target}" = "${host}"; then
COREFILE=netbsd-core.lo
;;
alpha*-*-*) COREFILE=osf-core.lo ;;
- arm-*-freebsd*) COREFILE='' ;;
+ arm-*-freebsd* | arm-*-kfreebsd*-gnu)
+ COREFILE='' ;;
arm-*-netbsd*) COREFILE=netbsd-core.lo ;;
arm-*-riscix) COREFILE=trad-core.lo ;;
hppa*-*-hpux*) COREFILE=hpux-core.lo ;;
@@ -5075,62 +5300,54 @@ if test "${target}" = "${host}"; then
TRAD_HEADER='"hosts/i370linux.h"'
;;
- i[3456]86-sequent-bsd*)
+ i[3-7]86-sequent-bsd*)
COREFILE=trad-core.lo
TRAD_HEADER='"hosts/symmetry.h"'
;;
- i[3456]86-sequent-sysv4*) ;;
- i[3456]86-sequent-sysv*)
+ i[3-7]86-sequent-sysv4*) ;;
+ i[3-7]86-sequent-sysv*)
COREFILE=trad-core.lo
TRAD_HEADER='"hosts/symmetry.h"'
;;
- i[3456]86-*-bsdi)
+ i[3-7]86-*-bsdi)
COREFILE=
;;
- i[3456]86-*-bsd* | i[34567]86-*-freebsd[123] | i[34567]86-*-freebsd[123]\.* | i[34567]86-*-freebsd4\.[01234]* | i[34567]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-*-freebsd*aout*)
COREFILE=trad-core.lo
TRAD_HEADER='"hosts/i386bsd.h"'
;;
- i[3456]86-*-freebsd*)
+ i[3-7]86-*-freebsd* | i[3-7]86-*-kfreebsd*-gnu)
COREFILE=''
TRAD_HEADER='"hosts/i386bsd.h"'
;;
- i[3456]86-*-netbsd* | i[3456]86-*-openbsd*)
+ i[3-7]86-*-netbsd* | i[3-7]86-*-knetbsd*-gnu | i[3-7]86-*-openbsd*)
COREFILE=netbsd-core.lo
;;
- i[3456]86-esix-sysv3*)
+ i[3-7]86-esix-sysv3*)
COREFILE=trad-core.lo
TRAD_HEADER='"hosts/esix.h"'
;;
- i[3456]86-*-sco3.2v5*)
+ i[3-7]86-*-sco3.2v5*)
COREFILE=sco5-core.lo
;;
- i[3456]86-*-sco* | i[3456]86-*-isc*)
+ i[3-7]86-*-sco* | i[3-7]86-*-isc*)
COREFILE=trad-core.lo
TRAD_HEADER='"hosts/i386sco.h"'
;;
- i[3456]86-*-mach3*)
+ i[3-7]86-*-mach3*)
COREFILE=trad-core.lo
TRAD_HEADER='"hosts/i386mach3.h"'
;;
- i[3456]86-*-linux-gnu*)
+ i[3-7]86-*-linux-gnu*)
COREFILE=trad-core.lo
TRAD_HEADER='"hosts/i386linux.h"'
;;
- i[3456]86-*-isc*) COREFILE=trad-core.lo ;;
- i[3456]86-*-aix*) COREFILE=aix386-core.lo ;;
+ i[3-7]86-*-isc*) COREFILE=trad-core.lo ;;
+ i[3-7]86-*-aix*) COREFILE=aix386-core.lo ;;
i860-*-mach3* | i860-*-osf1*)
COREFILE=trad-core.lo
TRAD_HEADER='"hosts/i860mach3.h"'
;;
- mips-dec-bsd*)
- COREFILE=trad-core.lo
- TRAD_HEADER='"hosts/mipsbsd.h"'
- ;;
- mips-dec-mach3*)
- COREFILE=trad-core.lo
- TRAD_HEADER='"hosts/mipsmach3.h"'
- ;;
mips-*-netbsd* | mips*-*-openbsd*)
COREFILE=netbsd-core.lo
;;
@@ -5141,10 +5358,6 @@ if test "${target}" = "${host}"; then
mips-sgi-irix4*) COREFILE=irix-core.lo ;;
mips-sgi-irix5*) COREFILE=irix-core.lo ;;
mips-sgi-irix6*) COREFILE=irix-core.lo ;;
- mips-*-mach3*)
- COREFILE=trad-core.lo
- TRAD_HEADER='"hosts/mipsmach3.h"'
- ;;
mips-*-sysv4*) ;;
mips-*-sysv* | mips-*-riscos*)
COREFILE=trad-core.lo
@@ -5211,16 +5424,16 @@ if test "${target}" = "${host}"; then
# 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:5215: checking for c_impl in struct core_dumpx" >&5
+echo "configure:5428: checking for c_impl in struct core_dumpx" >&5
cat > conftest.$ac_ext <<EOF
-#line 5217 "configure"
+#line 5430 "configure"
#include "confdefs.h"
#include <core.h>
int main() {
struct core_dumpx c; c.c_impl = 0;
; return 0; }
EOF
-if { (eval echo configure:5224: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:5437: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
cat >> confdefs.h <<\EOF
#define HAVE_ST_C_IMPL 1
@@ -5240,7 +5453,8 @@ rm -f conftest*
powerpc-*-aix4*) COREFILE=rs6000-core.lo ;;
powerpc-*-aix*) COREFILE=rs6000-core.lo ;;
powerpc-*-beos*) ;;
- powerpc-*-freebsd*) COREFILE='' ;;
+ powerpc-*-freebsd* | powerpc-*-kfreebsd*-gnu)
+ COREFILE='' ;;
powerpc-*-netbsd*) COREFILE=netbsd-core.lo ;;
powerpc-*-*bsd*) COREFILE=netbsd-core.lo ;;
s390*-*-*) COREFILE=trad-core.lo ;;
@@ -5252,7 +5466,9 @@ rm -f conftest*
COREFILE=trad-core.lo
TRAD_HEADER='"hosts/tahoe.h"'
;;
- vax-*-netbsd*) COREFILE=netbsd-core.lo ;;
+ vax-*-netbsd* | vax-*-openbsd*)
+ COREFILE=netbsd-core.lo
+ ;;
vax-*-ultrix2*)
COREFILE=trad-core.lo
TRAD_HEADER='"hosts/vaxult2.h"'
@@ -5261,11 +5477,17 @@ rm -f conftest*
COREFILE=trad-core.lo
TRAD_HEADER='"hosts/vaxult2.h"'
;;
+ vax-*-linux-gnu*)
+ COREFILE=trad-core.lo
+ TRAD_HEADER='"hosts/vaxlinux.h"'
+ ;;
vax-*-*)
COREFILE=trad-core.lo
TRAD_HEADER='"hosts/vaxbsd.h"'
;;
- x86_64-*-netbsd*) COREFILE=netbsd-core.lo ;;
+ x86_64-*-netbsd* | x86_64-*-openbsd*)
+ COREFILE=netbsd-core.lo
+ ;;
esac
case "$COREFILE" in
@@ -5288,17 +5510,17 @@ rm -f conftest*
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:5292: checking for $ac_hdr" >&5
+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 5297 "configure"
+#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:5302: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (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*
@@ -5326,12 +5548,12 @@ done
if test "$ac_cv_header_sys_procfs_h" = yes; then
echo $ac_n "checking for prstatus_t in sys/procfs.h""... $ac_c" 1>&6
-echo "configure:5330: checking for prstatus_t in sys/procfs.h" >&5
+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 5335 "configure"
+#line 5557 "configure"
#include "confdefs.h"
#define _SYSCALL32
@@ -5340,7 +5562,7 @@ int main() {
prstatus_t avar
; return 0; }
EOF
-if { (eval echo configure:5344: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:5566: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
bfd_cv_have_sys_procfs_type_prstatus_t=yes
else
@@ -5362,12 +5584,12 @@ EOF
echo "$ac_t""$bfd_cv_have_sys_procfs_type_prstatus_t" 1>&6
echo $ac_n "checking for prstatus32_t in sys/procfs.h""... $ac_c" 1>&6
-echo "configure:5366: checking for prstatus32_t in sys/procfs.h" >&5
+echo "configure:5588: checking for prstatus32_t in sys/procfs.h" >&5
if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_prstatus32_t'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 5371 "configure"
+#line 5593 "configure"
#include "confdefs.h"
#define _SYSCALL32
@@ -5376,7 +5598,7 @@ int main() {
prstatus32_t avar
; return 0; }
EOF
-if { (eval echo configure:5380: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:5602: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
bfd_cv_have_sys_procfs_type_prstatus32_t=yes
else
@@ -5398,12 +5620,12 @@ EOF
echo "$ac_t""$bfd_cv_have_sys_procfs_type_prstatus32_t" 1>&6
echo $ac_n "checking for prstatus_t.pr_who in sys/procfs.h""... $ac_c" 1>&6
-echo "configure:5402: checking for prstatus_t.pr_who in sys/procfs.h" >&5
+echo "configure:5624: checking for prstatus_t.pr_who in sys/procfs.h" >&5
if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_member_prstatus_t_pr_who'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 5407 "configure"
+#line 5629 "configure"
#include "confdefs.h"
#define _SYSCALL32
@@ -5412,7 +5634,7 @@ int main() {
prstatus_t avar; void* aref = (void*) &avar.pr_who
; return 0; }
EOF
-if { (eval echo configure:5416: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:5638: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
bfd_cv_have_sys_procfs_type_member_prstatus_t_pr_who=yes
else
@@ -5434,12 +5656,12 @@ EOF
echo "$ac_t""$bfd_cv_have_sys_procfs_type_member_prstatus_t_pr_who" 1>&6
echo $ac_n "checking for prstatus32_t.pr_who in sys/procfs.h""... $ac_c" 1>&6
-echo "configure:5438: checking for prstatus32_t.pr_who in sys/procfs.h" >&5
+echo "configure:5660: checking for prstatus32_t.pr_who in sys/procfs.h" >&5
if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_member_prstatus32_t_pr_who'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 5443 "configure"
+#line 5665 "configure"
#include "confdefs.h"
#define _SYSCALL32
@@ -5448,7 +5670,7 @@ int main() {
prstatus32_t avar; void* aref = (void*) &avar.pr_who
; return 0; }
EOF
-if { (eval echo configure:5452: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:5674: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
bfd_cv_have_sys_procfs_type_member_prstatus32_t_pr_who=yes
else
@@ -5470,12 +5692,12 @@ EOF
echo "$ac_t""$bfd_cv_have_sys_procfs_type_member_prstatus32_t_pr_who" 1>&6
echo $ac_n "checking for pstatus_t in sys/procfs.h""... $ac_c" 1>&6
-echo "configure:5474: checking for pstatus_t in sys/procfs.h" >&5
+echo "configure:5696: checking for pstatus_t in sys/procfs.h" >&5
if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_pstatus_t'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 5479 "configure"
+#line 5701 "configure"
#include "confdefs.h"
#define _SYSCALL32
@@ -5484,7 +5706,7 @@ int main() {
pstatus_t avar
; return 0; }
EOF
-if { (eval echo configure:5488: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:5710: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
bfd_cv_have_sys_procfs_type_pstatus_t=yes
else
@@ -5506,12 +5728,12 @@ EOF
echo "$ac_t""$bfd_cv_have_sys_procfs_type_pstatus_t" 1>&6
echo $ac_n "checking for pxstatus_t in sys/procfs.h""... $ac_c" 1>&6
-echo "configure:5510: checking for pxstatus_t in sys/procfs.h" >&5
+echo "configure:5732: checking for pxstatus_t in sys/procfs.h" >&5
if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_pxstatus_t'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 5515 "configure"
+#line 5737 "configure"
#include "confdefs.h"
#define _SYSCALL32
@@ -5520,7 +5742,7 @@ int main() {
pxstatus_t avar
; return 0; }
EOF
-if { (eval echo configure:5524: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:5746: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
bfd_cv_have_sys_procfs_type_pxstatus_t=yes
else
@@ -5542,12 +5764,12 @@ EOF
echo "$ac_t""$bfd_cv_have_sys_procfs_type_pxstatus_t" 1>&6
echo $ac_n "checking for pstatus32_t in sys/procfs.h""... $ac_c" 1>&6
-echo "configure:5546: checking for pstatus32_t in sys/procfs.h" >&5
+echo "configure:5768: checking for pstatus32_t in sys/procfs.h" >&5
if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_pstatus32_t'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 5551 "configure"
+#line 5773 "configure"
#include "confdefs.h"
#define _SYSCALL32
@@ -5556,7 +5778,7 @@ int main() {
pstatus32_t avar
; return 0; }
EOF
-if { (eval echo configure:5560: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:5782: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
bfd_cv_have_sys_procfs_type_pstatus32_t=yes
else
@@ -5578,12 +5800,12 @@ EOF
echo "$ac_t""$bfd_cv_have_sys_procfs_type_pstatus32_t" 1>&6
echo $ac_n "checking for prpsinfo_t in sys/procfs.h""... $ac_c" 1>&6
-echo "configure:5582: checking for prpsinfo_t in sys/procfs.h" >&5
+echo "configure:5804: checking for prpsinfo_t in sys/procfs.h" >&5
if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_prpsinfo_t'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 5587 "configure"
+#line 5809 "configure"
#include "confdefs.h"
#define _SYSCALL32
@@ -5592,7 +5814,7 @@ int main() {
prpsinfo_t avar
; return 0; }
EOF
-if { (eval echo configure:5596: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:5818: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
bfd_cv_have_sys_procfs_type_prpsinfo_t=yes
else
@@ -5614,12 +5836,12 @@ EOF
echo "$ac_t""$bfd_cv_have_sys_procfs_type_prpsinfo_t" 1>&6
echo $ac_n "checking for prpsinfo32_t in sys/procfs.h""... $ac_c" 1>&6
-echo "configure:5618: checking for prpsinfo32_t in sys/procfs.h" >&5
+echo "configure:5840: checking for prpsinfo32_t in sys/procfs.h" >&5
if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_prpsinfo32_t'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 5623 "configure"
+#line 5845 "configure"
#include "confdefs.h"
#define _SYSCALL32
@@ -5628,7 +5850,7 @@ int main() {
prpsinfo32_t avar
; return 0; }
EOF
-if { (eval echo configure:5632: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:5854: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
bfd_cv_have_sys_procfs_type_prpsinfo32_t=yes
else
@@ -5650,12 +5872,12 @@ EOF
echo "$ac_t""$bfd_cv_have_sys_procfs_type_prpsinfo32_t" 1>&6
echo $ac_n "checking for psinfo_t in sys/procfs.h""... $ac_c" 1>&6
-echo "configure:5654: checking for psinfo_t in sys/procfs.h" >&5
+echo "configure:5876: checking for psinfo_t in sys/procfs.h" >&5
if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_psinfo_t'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 5659 "configure"
+#line 5881 "configure"
#include "confdefs.h"
#define _SYSCALL32
@@ -5664,7 +5886,7 @@ int main() {
psinfo_t avar
; return 0; }
EOF
-if { (eval echo configure:5668: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:5890: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
bfd_cv_have_sys_procfs_type_psinfo_t=yes
else
@@ -5686,12 +5908,12 @@ EOF
echo "$ac_t""$bfd_cv_have_sys_procfs_type_psinfo_t" 1>&6
echo $ac_n "checking for psinfo32_t in sys/procfs.h""... $ac_c" 1>&6
-echo "configure:5690: checking for psinfo32_t in sys/procfs.h" >&5
+echo "configure:5912: checking for psinfo32_t in sys/procfs.h" >&5
if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_psinfo32_t'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 5695 "configure"
+#line 5917 "configure"
#include "confdefs.h"
#define _SYSCALL32
@@ -5700,7 +5922,7 @@ int main() {
psinfo32_t avar
; return 0; }
EOF
-if { (eval echo configure:5704: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:5926: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
bfd_cv_have_sys_procfs_type_psinfo32_t=yes
else
@@ -5722,12 +5944,12 @@ EOF
echo "$ac_t""$bfd_cv_have_sys_procfs_type_psinfo32_t" 1>&6
echo $ac_n "checking for lwpstatus_t in sys/procfs.h""... $ac_c" 1>&6
-echo "configure:5726: checking for lwpstatus_t in sys/procfs.h" >&5
+echo "configure:5948: checking for lwpstatus_t in sys/procfs.h" >&5
if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_lwpstatus_t'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 5731 "configure"
+#line 5953 "configure"
#include "confdefs.h"
#define _SYSCALL32
@@ -5736,7 +5958,7 @@ int main() {
lwpstatus_t avar
; return 0; }
EOF
-if { (eval echo configure:5740: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:5962: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
bfd_cv_have_sys_procfs_type_lwpstatus_t=yes
else
@@ -5758,12 +5980,12 @@ EOF
echo "$ac_t""$bfd_cv_have_sys_procfs_type_lwpstatus_t" 1>&6
echo $ac_n "checking for lwpxstatus_t in sys/procfs.h""... $ac_c" 1>&6
-echo "configure:5762: checking for lwpxstatus_t in sys/procfs.h" >&5
+echo "configure:5984: checking for lwpxstatus_t in sys/procfs.h" >&5
if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_lwpxstatus_t'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 5767 "configure"
+#line 5989 "configure"
#include "confdefs.h"
#define _SYSCALL32
@@ -5772,7 +5994,7 @@ int main() {
lwpxstatus_t avar
; return 0; }
EOF
-if { (eval echo configure:5776: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:5998: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
bfd_cv_have_sys_procfs_type_lwpxstatus_t=yes
else
@@ -5794,12 +6016,12 @@ EOF
echo "$ac_t""$bfd_cv_have_sys_procfs_type_lwpxstatus_t" 1>&6
echo $ac_n "checking for lwpstatus_t.pr_context in sys/procfs.h""... $ac_c" 1>&6
-echo "configure:5798: checking for lwpstatus_t.pr_context in sys/procfs.h" >&5
+echo "configure:6020: checking for lwpstatus_t.pr_context in sys/procfs.h" >&5
if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_member_lwpstatus_t_pr_context'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 5803 "configure"
+#line 6025 "configure"
#include "confdefs.h"
#define _SYSCALL32
@@ -5808,7 +6030,7 @@ int main() {
lwpstatus_t avar; void* aref = (void*) &avar.pr_context
; return 0; }
EOF
-if { (eval echo configure:5812: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:6034: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
bfd_cv_have_sys_procfs_type_member_lwpstatus_t_pr_context=yes
else
@@ -5830,12 +6052,12 @@ EOF
echo "$ac_t""$bfd_cv_have_sys_procfs_type_member_lwpstatus_t_pr_context" 1>&6
echo $ac_n "checking for lwpstatus_t.pr_reg in sys/procfs.h""... $ac_c" 1>&6
-echo "configure:5834: checking for lwpstatus_t.pr_reg in sys/procfs.h" >&5
+echo "configure:6056: checking for lwpstatus_t.pr_reg in sys/procfs.h" >&5
if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_member_lwpstatus_t_pr_reg'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 5839 "configure"
+#line 6061 "configure"
#include "confdefs.h"
#define _SYSCALL32
@@ -5844,7 +6066,7 @@ int main() {
lwpstatus_t avar; void* aref = (void*) &avar.pr_reg
; return 0; }
EOF
-if { (eval echo configure:5848: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:6070: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
bfd_cv_have_sys_procfs_type_member_lwpstatus_t_pr_reg=yes
else
@@ -5866,12 +6088,12 @@ EOF
echo "$ac_t""$bfd_cv_have_sys_procfs_type_member_lwpstatus_t_pr_reg" 1>&6
echo $ac_n "checking for win32_pstatus_t in sys/procfs.h""... $ac_c" 1>&6
-echo "configure:5870: checking for win32_pstatus_t in sys/procfs.h" >&5
+echo "configure:6092: checking for win32_pstatus_t in sys/procfs.h" >&5
if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_win32_pstatus_t'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 5875 "configure"
+#line 6097 "configure"
#include "confdefs.h"
#define _SYSCALL32
@@ -5880,7 +6102,7 @@ int main() {
win32_pstatus_t avar
; return 0; }
EOF
-if { (eval echo configure:5884: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:6106: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
bfd_cv_have_sys_procfs_type_win32_pstatus_t=yes
else
@@ -5933,7 +6155,7 @@ case "${host}" in
fi
;;
*)
- x=`sed -n -e 's/^[ ]*PICFLAG[ ]*=[ ]*//p' < ../libiberty/Makefile | tail -1`
+ x=`sed -n -e 's/^[ ]*PICFLAG[ ]*=[ ]*//p' < ../libiberty/Makefile | sed -n '$p'`
if test -n "$x"; then
WIN32LIBADD="-L../libiberty/pic -liberty"
fi
@@ -5963,12 +6185,14 @@ fi
all_targets=false
defvec=
selvecs=
+assocvecs=
selarchs=
TDEFINES=
for targ in $target $canon_targets
do
if test "x$targ" = "xall"; then
all_targets=true
+ assocvecs="$assocvecs $targ_defvec $targ_selvecs"
else
. $srcdir/config.bfd
if test "x$targ" = "x$target"; then
@@ -5999,6 +6223,17 @@ done
selvecs="$f"
+# uniq the associated vectors in all the configured targets.
+f=""
+for i in $assocvecs ; do
+ case " $f " in
+ *" $i "*) ;;
+ *) f="$f $i" ;;
+ esac
+done
+assocvecs="$f"
+
+
# uniq the architectures in all the configured targets.
f=""
for i in $selarchs ; do
@@ -6027,8 +6262,6 @@ do
aout0_big_vec) tb="$tb aout0.lo aout32.lo" ;;
aout_arm_big_vec) tb="$tb aout-arm.lo aout32.lo" ;;
aout_arm_little_vec) tb="$tb aout-arm.lo aout32.lo" ;;
- aout_mips_big_vec) tb="$tb mipsbsd.lo aout32.lo" ;;
- aout_mips_little_vec) tb="$tb mipsbsd.lo aout32.lo" ;;
apollocoff_vec) tb="$tb coff-apollo.lo" ;;
arm_epoc_pe_big_vec) tb="$tb epoc-pe-arm.lo peigen.lo cofflink.lo " ;;
arm_epoc_pe_little_vec) tb="$tb epoc-pe-arm.lo peigen.lo cofflink.lo " ;;
@@ -6045,6 +6278,7 @@ do
b_out_vec_little_host) tb="$tb bout.lo aout32.lo" ;;
bfd_efi_app_ia32_vec) tb="$tb efi-app-ia32.lo peigen.lo cofflink.lo" ;;
bfd_efi_app_ia64_vec) tb="$tb efi-app-ia64.lo pepigen.lo cofflink.lo"; target_size=64 ;;
+ bfd_elf32_am33lin_vec) tb="$tb elf32-am33lin.lo elf32.lo $elf" ;;
bfd_elf32_avr_vec) tb="$tb elf32-avr.lo elf32.lo $elf" ;;
bfd_elf32_big_generic_vec) tb="$tb elf32-gen.lo elf32.lo $elf" ;;
bfd_elf32_bigarc_vec) tb="$tb elf32-arc.lo elf32.lo $elf" ;;
@@ -6057,31 +6291,42 @@ do
bfd_elf32_dlx_big_vec) tb="$tb elf32-dlx.lo elf32.lo $elf" ;;
bfd_elf32_fr30_vec) tb="$tb elf32-fr30.lo elf32.lo $elf" ;;
bfd_elf32_frv_vec) tb="$tb elf32-frv.lo elf32.lo $elf" ;;
+ bfd_elf32_frvfdpic_vec) tb="$tb elf32-frv.lo elf32.lo $elf" ;;
bfd_elf32_h8300_vec) tb="$tb elf32-h8300.lo elf32.lo $elf" ;;
bfd_elf32_hppa_linux_vec) tb="$tb elf32-hppa.lo elf32.lo $elf" ;;
bfd_elf32_hppa_vec) tb="$tb elf32-hppa.lo elf32.lo $elf" ;;
bfd_elf32_i370_vec) tb="$tb elf32-i370.lo elf32.lo $elf" ;;
- bfd_elf32_i386_freebsd_vec) tb="$tb elf32-i386-fbsd.lo elf32.lo $elf" ;;
+ bfd_elf32_i386_freebsd_vec) tb="$tb elf32-i386.lo elf32.lo $elf" ;;
bfd_elf32_i386_vec) tb="$tb elf32-i386.lo elf32.lo $elf" ;;
bfd_elf32_i860_little_vec) tb="$tb elf32-i860.lo elf32.lo $elf" ;;
bfd_elf32_i860_vec) tb="$tb elf32-i860.lo elf32.lo $elf" ;;
bfd_elf32_i960_vec) tb="$tb elf32-i960.lo elf32.lo $elf" ;;
bfd_elf32_ia64_big_vec) tb="$tb elf32-ia64.lo elf32.lo $elf" ;;
bfd_elf32_ia64_hpux_big_vec) tb="$tb elf32-ia64.lo elf32.lo $elf";;
+ bfd_elf32_ip2k_vec) tb="$tb elf32-ip2k.lo elf32.lo $elf" ;;
+ bfd_elf32_iq2000_vec) tb="$tb elf32-iq2000.lo elf32.lo $elf" ;;
bfd_elf32_little_generic_vec) tb="$tb elf32-gen.lo elf32.lo $elf" ;;
bfd_elf32_littlearc_vec) tb="$tb elf32-arc.lo elf32.lo $elf" ;;
bfd_elf32_littlearm_oabi_vec) tb="$tb elfarm-oabi.lo elf32.lo $elf" ;;
bfd_elf32_littlearm_vec) tb="$tb elfarm-nabi.lo elf32.lo $elf" ;;
bfd_elf32_littlemips_vec) tb="$tb elf32-mips.lo elfxx-mips.lo elf32.lo $elf ecofflink.lo" ;;
bfd_elf32_m32r_vec) tb="$tb elf32-m32r.lo elf32.lo $elf" ;;
- bfd_elf32_m68hc11_vec) tb="$tb elf32-m68hc11.lo elf32.lo $elf" ;;
- bfd_elf32_m68hc12_vec) tb="$tb elf32-m68hc12.lo elf32.lo $elf" ;;
+ bfd_elf32_m32rle_vec) tb="$tb elf32-m32r.lo elf32.lo $elf" ;;
+ bfd_elf32_m32rlin_vec) tb="$tb elf32-m32r.lo elf32.lo $elf" ;;
+ bfd_elf32_m32rlelin_vec) tb="$tb elf32-m32r.lo elf32.lo $elf" ;;
+ bfd_elf32_m68hc11_vec) tb="$tb elf32-m68hc11.lo elf32-m68hc1x.lo elf32.lo $elf" ;;
+ bfd_elf32_m68hc12_vec) tb="$tb elf32-m68hc12.lo elf32-m68hc1x.lo elf32.lo $elf" ;;
bfd_elf32_m68k_vec) tb="$tb elf32-m68k.lo elf32.lo $elf" ;;
bfd_elf32_m88k_vec) tb="$tb elf32-m88k.lo elf32.lo $elf" ;;
bfd_elf32_mcore_big_vec) tb="$tb elf32-mcore.lo elf32.lo $elf" ;;
bfd_elf32_mcore_little_vec) tb="$tb elf32-mcore.lo elf32.lo $elf" ;;
bfd_elf32_mn10200_vec) tb="$tb elf-m10200.lo elf32.lo $elf" ;;
bfd_elf32_mn10300_vec) tb="$tb elf-m10300.lo elf32.lo $elf" ;;
+ bfd_elf32_msp430_vec) tb="$tb elf32-msp430.lo elf32.lo $elf" ;;
+ bfd_elf32_nbigmips_vec) tb="$tb elfn32-mips.lo elfxx-mips.lo elf32.lo $elf ecofflink.lo"; target_size=64 ;;
+ bfd_elf32_nlittlemips_vec) tb="$tb elfn32-mips.lo elfxx-mips.lo elf32.lo $elf ecofflink.lo"; target_size=64 ;;
+ bfd_elf32_ntradbigmips_vec) tb="$tb elfn32-mips.lo elfxx-mips.lo elf32.lo $elf ecofflink.lo"; target_size=64 ;;
+ bfd_elf32_ntradlittlemips_vec) tb="$tb elfn32-mips.lo elfxx-mips.lo elf32.lo $elf ecofflink.lo"; target_size=64 ;;
bfd_elf32_openrisc_vec) tb="$tb elf32-openrisc.lo elf32.lo $elf" ;;
bfd_elf32_or32_big_vec) tb="$tb elf32-or32.lo elf32.lo $elf" ;;
bfd_elf32_pj_vec) tb="$tb elf32-pj.lo elf32.lo $elf";;
@@ -6094,14 +6339,16 @@ do
# 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_sh64lnbsd_vec) tb="$tb elf32-sh64-nbsd.lo elf32-sh64-com.lo elf32.lo $elf cofflink.lo" ;;
- bfd_elf32_sh64nbsd_vec) tb="$tb elf32-sh64-nbsd.lo elf32-sh64-com.lo elf32.lo $elf cofflink.lo" ;;
+ 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-lin.lo elf32.lo $elf coff-sh.lo cofflink.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-lin.lo elf32.lo $elf coff-sh.lo cofflink.lo" ;;
- bfd_elf32_shlnbsd_vec) tb="$tb elf32-sh-nbsd.lo elf32.lo $elf coff-sh.lo cofflink.lo" ;;
- bfd_elf32_shnbsd_vec) tb="$tb elf32-sh-nbsd.lo elf32.lo $elf coff-sh.lo cofflink.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" ;;
@@ -6109,14 +6356,14 @@ do
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_elf64_alpha_freebsd_vec) tb="$tb elf64-alpha-fbsd.lo elf64.lo $elf"; target_size=64 ;;
+ bfd_elf32_xtensa_le_vec) tb="$tb xtensa-isa.lo xtensa-modules.lo elf32-xtensa.lo elf32.lo $elf" ;;
+ bfd_elf32_xtensa_be_vec) tb="$tb xtensa-isa.lo xtensa-modules.lo elf32-xtensa.lo elf32.lo $elf" ;;
+ bfd_elf64_alpha_freebsd_vec) tb="$tb elf64-alpha.lo elf64.lo $elf"; target_size=64 ;;
bfd_elf64_alpha_vec) tb="$tb elf64-alpha.lo elf64.lo $elf"; target_size=64 ;;
bfd_elf64_big_generic_vec) tb="$tb elf64-gen.lo elf64.lo $elf"; target_size=64 ;;
bfd_elf64_bigmips_vec) tb="$tb elf64-mips.lo elf64.lo elfxx-mips.lo elf32.lo $elf ecofflink.lo"; target_size=64 ;;
bfd_elf64_hppa_linux_vec) tb="$tb elf64-hppa.lo elf64.lo $elf"; target_size=64 ;;
bfd_elf64_hppa_vec) tb="$tb elf64-hppa.lo elf64.lo $elf"; target_size=64 ;;
- bfd_elf64_ia64_aix_big_vec) tb="$tb elf64-ia64.lo elf64.lo $elf"; target_size=64 ;;
- bfd_elf64_ia64_aix_little_vec) tb="$tb elf64-ia64.lo elf64.lo $elf"; target_size=64 ;;
bfd_elf64_ia64_big_vec) tb="$tb elf64-ia64.lo elf64.lo $elf"; target_size=64 ;;
bfd_elf64_ia64_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 ;;
@@ -6128,8 +6375,10 @@ do
bfd_elf64_s390_vec) tb="$tb elf64-s390.lo elf64.lo $elf"; target_size=64 ;;
bfd_elf64_sh64_vec) tb="$tb elf64-sh64.lo elf64.lo $elf" target_size=64 ;;
bfd_elf64_sh64l_vec) tb="$tb elf64-sh64.lo elf64.lo $elf" target_size=64 ;;
- bfd_elf64_sh64lnbsd_vec) tb="$tb elf64-sh64-nbsd.lo elf64.lo $elf" target_size=64 ;;
- bfd_elf64_sh64nbsd_vec) tb="$tb elf64-sh64-nbsd.lo elf64.lo $elf" target_size=64 ;;
+ bfd_elf64_sh64lin_vec) tb="$tb elf64-sh64.lo elf64.lo $elf" target_size=64 ;;
+ bfd_elf64_sh64blin_vec) tb="$tb elf64-sh64.lo elf64.lo $elf" target_size=64 ;;
+ bfd_elf64_sh64lnbsd_vec) tb="$tb elf64-sh64.lo elf64.lo $elf" target_size=64 ;;
+ bfd_elf64_sh64nbsd_vec) tb="$tb elf64-sh64.lo elf64.lo $elf" target_size=64 ;;
bfd_elf64_sparc_vec) tb="$tb elf64-sparc.lo elf64.lo $elf"; target_size=64 ;;
bfd_elf64_tradbigmips_vec) tb="$tb elf64-mips.lo elf64.lo elfxx-mips.lo elf32.lo $elf ecofflink.lo"; target_size=64 ;;
bfd_elf64_tradlittlemips_vec) tb="$tb elf64-mips.lo elf64.lo elfxx-mips.lo elf32.lo $elf ecofflink.lo"; target_size=64 ;;
@@ -6181,6 +6430,9 @@ do
m68ksysvcoff_vec) tb="$tb coff-svm68k.lo cofflink.lo" ;;
m88kbcs_vec) tb="$tb coff-m88k.lo" ;;
m88kmach3_vec) tb="$tb m88kmach3.lo aout32.lo" ;;
+ mach_o_be_vec) tb="$tb mach-o.lo" ;;
+ mach_o_le_vec) tb="$tb mach-o.lo" ;;
+ mach_o_fat_vec) tb="$tb mach-o.lo" ;;
mcore_pe_big_vec) tb="$tb pe-mcore.lo peigen.lo cofflink.lo" ;;
mcore_pe_little_vec) tb="$tb pe-mcore.lo peigen.lo cofflink.lo" ;;
mcore_pei_big_vec) tb="$tb pei-mcore.lo peigen.lo cofflink.lo" ;;
@@ -6195,6 +6447,8 @@ do
or32coff_big_vec) tb="$tb coff-or32.lo cofflink.lo" ;;
pc532machaout_vec) tb="$tb pc532-mach.lo aout-ns32k.lo" ;;
pc532netbsd_vec) tb="$tb ns32knetbsd.lo aout-ns32k.lo" ;;
+ pef_vec) tb="$tb pef.lo" ;;
+ pef_xlib_vec) tb="$tb pef.lo" ;;
pdp11_aout_vec) tb="$tb pdp11.lo" ;;
pmac_xcoff_vec) tb="$tb coff-rs6000.lo xcofflink.lo" ;;
ppcboot_vec) tb="$tb ppcboot.lo" ;;
@@ -6215,8 +6469,15 @@ do
sparclynx_coff_vec) tb="$tb cf-sparclynx.lo lynx-core.lo" ;;
sparcnetbsd_vec) tb="$tb sparcnetbsd.lo aout32.lo" ;;
sunos_big_vec) tb="$tb sunos.lo aout32.lo" ;;
+ sym_vec) tb="$tb xsym.lo" ;;
tic30_aout_vec) tb="$tb aout-tic30.lo" ;;
tic30_coff_vec) tb="$tb coff-tic30.lo" ;;
+ tic4x_coff0_vec) tb="$tb coff-tic4x.lo" ;;
+ tic4x_coff0_beh_vec) tb="$tb coff-tic4x.lo" ;;
+ tic4x_coff1_vec) tb="$tb coff-tic4x.lo" ;;
+ tic4x_coff1_beh_vec) tb="$tb coff-tic4x.lo" ;;
+ tic4x_coff2_vec) tb="$tb coff-tic4x.lo" ;;
+ tic4x_coff2_beh_vec) tb="$tb coff-tic4x.lo" ;;
tic54x_coff0_beh_vec) tb="$tb coff-tic54x.lo" ;;
tic54x_coff0_vec) tb="$tb coff-tic54x.lo" ;;
tic54x_coff1_beh_vec) tb="$tb coff-tic54x.lo" ;;
@@ -6286,9 +6547,12 @@ if test x${all_targets} = xtrue ; then
selvecs=
havevecs=
selarchs=
+ test -n "$assocvecs" &&
+ assocvecs=`echo $assocvecs | sed -e 's/^/\&/' -e 's/ \(.\)/,\&\1/g'`
else # all_targets is true
# Only set these if they will be nonempty, for the clever echo.
havevecs=
+ assocvecs=
test -n "$selvecs" &&
havevecs=`echo $selvecs | sed -e 's/^/-DHAVE_/' -e 's/ \(.\)/ -DHAVE_\1/g'`
test -n "$selvecs" &&
@@ -6302,17 +6566,17 @@ case ${host64}-${target64}-${want64} in
wordsize=64
bfd_libs='$(BFD64_LIBS) $(BFD32_LIBS)'
all_backends='$(BFD64_BACKENDS) $(BFD32_BACKENDS)'
- if test -z "$GCC" && test "$BFD_HOST_64BIT_LONG" = "0" && test "$BFD_HOST_64_BIT_DEFINED" = "0"; then
+ if test $BFD_HOST_64_BIT_DEFINED = 0; then
echo "configure: warning: You have requested a 64 bit BFD configuration, but" 1>&2
echo "configure: warning: your compiler may not have a 64 bit integral type" 1>&2
fi
if test -n "$GCC" ; then
bad_64bit_gcc=no;
echo $ac_n "checking for gcc version with buggy 64-bit support""... $ac_c" 1>&6
-echo "configure:6313: checking for gcc version with buggy 64-bit support" >&5
+echo "configure:6577: checking for gcc version with buggy 64-bit support" >&5
# Add more tests for gcc versions with non-working 64-bit support here.
cat > conftest.$ac_ext <<EOF
-#line 6316 "configure"
+#line 6580 "configure"
#include "confdefs.h"
:__GNUC__:__GNUC_MINOR__:__i386__:
EOF
@@ -6346,28 +6610,144 @@ esac
+# Determine the host dependant file_ptr a.k.a. off_t type. In order
+# prefer: off64_t - if ftello64 and fseeko64, off_t - if ftello and
+# fseeko, long. This assumes that sizeof off_t is .ge. sizeof long.
+# Hopefully a reasonable assumption since fseeko et.al. should be
+# upward compatible.
+for ac_func in ftello ftello64 fseeko fseeko64
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:6622: checking for $ac_func" >&5
+if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 6627 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char $ac_func(); below. */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char $ac_func();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+ to always fail with ENOSYS. Some functions are actually named
+ something starting with __ and the normal name is an alias. */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+$ac_func();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:6650: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_func_$ac_func=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_func_$ac_func=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+ cat >> confdefs.h <<EOF
+#define $ac_tr_func 1
+EOF
+
+else
+ echo "$ac_t""no" 1>&6
+fi
+done
+
+if test x"$ac_cv_func_ftello" = xyes -a x"$ac_cv_func_fseeko" = xyes; then
+ echo $ac_n "checking size of off_t""... $ac_c" 1>&6
+echo "configure:6676: checking size of off_t" >&5
+if eval "test \"`echo '$''{'ac_cv_sizeof_off_t'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ for ac_size in 4 8 1 2 16 12 ; do # List sizes in rough order of prevalence.
+ cat > conftest.$ac_ext <<EOF
+#line 6682 "configure"
+#include "confdefs.h"
+#include "confdefs.h"
+#include <sys/types.h>
+
+
+int main() {
+switch (0) case 0: case (sizeof (off_t) == $ac_size):;
+; return 0; }
+EOF
+if { (eval echo configure:6692: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ ac_cv_sizeof_off_t=$ac_size
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+fi
+rm -f conftest*
+ if test x$ac_cv_sizeof_off_t != x ; then break; fi
+done
+
+fi
+
+if test x$ac_cv_sizeof_off_t = x ; then
+ { echo "configure: error: cannot determine a size for off_t" 1>&2; exit 1; }
+fi
+echo "$ac_t""$ac_cv_sizeof_off_t" 1>&6
+cat >> confdefs.h <<EOF
+#define SIZEOF_OFF_T $ac_cv_sizeof_off_t
+EOF
+
+
+fi
+echo $ac_n "checking file_ptr type""... $ac_c" 1>&6
+echo "configure:6716: checking file_ptr type" >&5
+bfd_file_ptr="long"
+bfd_ufile_ptr="unsigned long"
+if test x"$ac_cv_func_ftello64" = xyes -a x"$ac_cv_func_fseeko64" = xyes \
+ -o x"${ac_cv_sizeof_off_t}" = x8; then
+ bfd_file_ptr=BFD_HOST_64_BIT
+ bfd_ufile_ptr=BFD_HOST_U_64_BIT
+fi
+echo "$ac_t""$bfd_file_ptr" 1>&6
+
+
+
+
tdefaults=""
test -n "${defvec}" && tdefaults="${tdefaults} -DDEFAULT_VECTOR=${defvec}"
test -n "${selvecs}" && tdefaults="${tdefaults} -DSELECT_VECS='${selvecs}'"
+test -n "${assocvecs}" && tdefaults="${tdefaults} -DASSOCIATED_VECS='${assocvecs}'"
test -n "${selarchs}" && tdefaults="${tdefaults} -DSELECT_ARCHITECTURES='${selarchs}'"
test -n "${havevecs}" && tdefaults="${tdefaults} ${havevecs}"
-for ac_hdr in unistd.h
+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:6361: checking for $ac_hdr" >&5
+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 6366 "configure"
+#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:6371: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (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*
@@ -6396,12 +6776,12 @@ done
for ac_func in getpagesize
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:6400: checking for $ac_func" >&5
+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 6405 "configure"
+#line 6785 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -6424,7 +6804,7 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:6428: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+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
@@ -6449,7 +6829,7 @@ fi
done
echo $ac_n "checking for working mmap""... $ac_c" 1>&6
-echo "configure:6453: checking for working mmap" >&5
+echo "configure:6833: checking for working mmap" >&5
if eval "test \"`echo '$''{'ac_cv_func_mmap_fixed_mapped'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -6457,7 +6837,7 @@ else
ac_cv_func_mmap_fixed_mapped=no
else
cat > conftest.$ac_ext <<EOF
-#line 6461 "configure"
+#line 6841 "configure"
#include "confdefs.h"
/* Thanks to Mike Haertel and Jim Avera for this test.
@@ -6485,11 +6865,24 @@ else
#include <fcntl.h>
#include <sys/mman.h>
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_STDLIB_H
+# include <stdlib.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
/* This mess was copied from the GNU getpagesize.h. */
#ifndef HAVE_GETPAGESIZE
-# ifdef HAVE_UNISTD_H
-# include <unistd.h>
-# endif
/* Assume that all systems that can run configure have sys/param.h. */
# ifndef HAVE_SYS_PARAM_H
@@ -6597,7 +6990,7 @@ main()
}
EOF
-if { (eval echo configure:6601: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:6994: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
ac_cv_func_mmap_fixed_mapped=yes
else
@@ -6622,12 +7015,12 @@ fi
for ac_func in madvise mprotect
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:6626: checking for $ac_func" >&5
+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 6631 "configure"
+#line 7024 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -6650,7 +7043,7 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:6654: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+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
@@ -6783,7 +7176,7 @@ done
ac_given_srcdir=$srcdir
ac_given_INSTALL="$INSTALL"
-trap 'rm -fr `echo "Makefile doc/Makefile bfd-in3.h:bfd-in2.h po/Makefile.in:po/Make-in config.h:config.in" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15
+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
@@ -6830,7 +7223,6 @@ 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%@CC@%$CC%g
s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g
s%@INSTALL_SCRIPT@%$INSTALL_SCRIPT%g
s%@INSTALL_DATA@%$INSTALL_DATA%g
@@ -6843,10 +7235,10 @@ s%@AUTOHEADER@%$AUTOHEADER%g
s%@MAKEINFO@%$MAKEINFO%g
s%@SET_MAKE@%$SET_MAKE%g
s%@bfd_version@%$bfd_version%g
-s%@bfd_version_date@%$bfd_version_date%g
s%@bfd_version_string@%$bfd_version_string%g
s%@AR@%$AR%g
s%@RANLIB@%$RANLIB%g
+s%@CC@%$CC%g
s%@LN_S@%$LN_S%g
s%@OBJEXT@%$OBJEXT%g
s%@EXEEXT@%$EXEEXT%g
@@ -6884,6 +7276,7 @@ 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
@@ -6900,6 +7293,8 @@ 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
@@ -6942,7 +7337,7 @@ EOF
cat >> $CONFIG_STATUS <<EOF
-CONFIG_FILES=\${CONFIG_FILES-"Makefile doc/Makefile bfd-in3.h:bfd-in2.h po/Makefile.in:po/Make-in"}
+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
diff --git a/contrib/binutils/bfd/configure.host b/contrib/binutils/bfd/configure.host
index 207e4c0..024ed62 100644
--- a/contrib/binutils/bfd/configure.host
+++ b/contrib/binutils/bfd/configure.host
@@ -19,51 +19,39 @@ HOST_U_64BIT_TYPE=
case "${host}" in
-alpha*-*-*) host64=true; HOST_64BIT_TYPE=long ;;
-
-hppa*64*-*-hpux*) HDEFINES=-DHOST_HPPAHPUX;
- host64=true; HOST_64BIT_TYPE=long ;;
-hppa*-*-hpux*) HDEFINES=-DHOST_HPPAHPUX ;;
+hppa*-*-hpux*) # HP/UX's ftello64 et.al. declarations are only
+ # visible when _LARGEFILE64_SOURCE is defined.
+ # Without those declarations, real_ftell et.al.
+ # get mis-compiled.
+ HDEFINES="-DHOST_HPPAHPUX -D_LARGEFILE64_SOURCE" ;;
hppa*-*-hiux*) HDEFINES=-DHOST_HPPAHPUX ;;
-hppa*64*-*-linux*) host64=true; HOST_64BIT_TYPE=long ;;
hppa*-*-mpeix*) HDEFINES=-DHOST_HPPAMPEIX ;;
hppa*-*-bsd*) HDEFINES=-DHOST_HPPABSD ;;
hppa*-*-osf*) HDEFINES=-DHOST_HPPAOSF ;;
-ia64-*-linux*) host64=true; HOST_64BIT_TYPE=long ;;
-ia64-*-aix*) host64=true; HOST_64BIT_TYPE=long ;;
+ia64-*-*) host64=true;;
+
+# Workaround for limitations on win9x where file contents are
+# not zero'd out if you seek past the end and then write.
+i[3-7]86-*-mingw32*) HDEFINES=-D__USE_MINGW_FSEEK;;
-i[3456]86-sequent-bsd*) HDEFINES=-Dshared=genshared ;;
-i[3456]86-sequent-sysv4*) ;;
-i[3456]86-sequent-sysv*) HDEFINES=-Dshared=genshared ;;
+i[3-7]86-sequent-bsd*) HDEFINES=-Dshared=genshared ;;
+i[3-7]86-sequent-sysv4*) ;;
+i[3-7]86-sequent-sysv*) HDEFINES=-Dshared=genshared ;;
mips*-*-netbsd*) ;;
mips*-*-openbsd*) ;;
mips*-dec-*) HDEFINES="-G 4" ;;
mips*-sgi-irix3*) HDEFINES="-G 4" ;;
mips*-sgi-irix4*) HDEFINES="-G 4" ;;
-mips*-sgi-irix6*) host64=true
- HOST_64BIT_TYPE="long long";
- HOST_U_64BIT_TYPE="unsigned long long";
- ;;
-mips64*-*-linux*) host64=true
- HOST_64BIT_TYPE="long long";
- HOST_U_64BIT_TYPE="unsigned long long";
- ;;
+mips*-sgi-irix6*) host64=true;;
+mips64*-*-linux*) host64=true;;
mips*-*-sysv4*) ;;
mips*-*-sysv*) HDEFINES="-G 4" ;;
mips*-*-riscos*) HDEFINES="-G 4" ;;
m68*-hp-hpux*) HDEFINES=-DHOST_HP300HPUX ;;
-*-*-aix*) HOST_64BIT_TYPE="long long"
- HOST_U_64BIT_TYPE="unsigned long long"
- ;;
-
-*-*-solaris*) HOST_64BIT_TYPE="long long"
- HOST_U_64BIT_TYPE="unsigned long long"
- ;;
-
*-*-windows*)
HOST_64BIT_TYPE=__int64
HOST_U_64BIT_TYPE="unsigned __int64"
diff --git a/contrib/binutils/bfd/configure.in b/contrib/binutils/bfd/configure.in
index 4db2520..837b753 100644
--- a/contrib/binutils/bfd/configure.in
+++ b/contrib/binutils/bfd/configure.in
@@ -7,26 +7,20 @@ AC_INIT(libbfd.c)
AC_CANONICAL_SYSTEM
AC_ISC_POSIX
-AM_INIT_AUTOMAKE(bfd, 2.13.1)
+AM_INIT_AUTOMAKE(bfd, 2.15)
# Uncomment the next line to remove the date from the reported bfd version
-# is_release=y
+#is_release=y
changequote(,)dnl
bfd_version=`echo "${VERSION}" | sed -e 's/\([^\.]*\)\.*\([^\.]*\)\.*\([^\.]*\)\.*\([^\.]*\)\.*\([^\.]*\).*/\1.00\2.00\3.00\4.00\5/' -e 's/\([^\.]*\)\..*\(..\)\..*\(..\)\..*\(..\)\..*\(..\)$/\1\2\3\4\5/'`
changequote([,])dnl
bfd_version_string="\"${VERSION}\""
-bfd_version_date=`sed -e 's/.*DATE //' < ${srcdir}/version.h`
if test x${is_release} = x; then
-dnl Sad, but we can't use XSTRING here to pick up the date from version.h
-dnl because traditional C doesn't allow it.
+ bfd_version_date=`sed -n -e 's/.*DATE //p' < ${srcdir}/version.h`
bfd_version_string="\"${VERSION} ${bfd_version_date}\""
fi
-dnl Since we need to edit bfd-in3.h to get the date for bfd_version_string,
-dnl we may as well substitute for bfd_version_date too. That way we don't
-dnl need to #include version.h
AC_SUBST(bfd_version)
-AC_SUBST(bfd_version_date)
AC_SUBST(bfd_version_string)
dnl These must be called before AM_PROG_LIBTOOL, because it may want
@@ -86,7 +80,7 @@ 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 -a "x$GCC" = xyes ; then
+if test "x${build_warnings}" != x && test "x$GCC" = xyes ; then
WARN_CFLAGS="${build_warnings}"
fi
AC_SUBST(WARN_CFLAGS)
@@ -109,7 +103,7 @@ bfd_default_target_size=32
AC_PROG_CC
-ALL_LINGUAS="fr tr ja es sv da"
+ALL_LINGUAS="fr tr ja es sv da zh_CN ro"
CY_GNU_GETTEXT
# Permit host specific settings.
@@ -119,17 +113,41 @@ AC_SUBST(HDEFINES)
AC_PROG_INSTALL
BFD_HOST_64BIT_LONG=0
+BFD_HOST_LONG_LONG=0
BFD_HOST_64_BIT_DEFINED=0
BFD_HOST_64_BIT=
BFD_HOST_U_64_BIT=
-if test "x${HOST_64BIT_TYPE}" = "xlong"; then
+
+AC_MSG_CHECKING([for long long])
+AC_CACHE_VAL(bfd_cv_has_long_long,
+[AC_TRY_COMPILE(,
+[unsigned long long ll = 18446744073709551615ULL;],
+bfd_cv_has_long_long=yes, bfd_cv_has_long_long=no)])
+AC_MSG_RESULT($bfd_cv_has_long_long)
+if test $bfd_cv_has_long_long = yes; then
+ BFD_HOST_LONG_LONG=1
+ AC_COMPILE_CHECK_SIZEOF(long long)
+fi
+
+AC_COMPILE_CHECK_SIZEOF(long)
+if test "x${ac_cv_sizeof_long}" = "x8"; then
+ host64=true
BFD_HOST_64BIT_LONG=1
-elif test "x${HOST_64BIT_TYPE}" != "x"; then
+ test -n "${HOST_64BIT_TYPE}" || HOST_64BIT_TYPE="long"
+ test -n "${HOST_U_64BIT_TYPE}" || HOST_U_64BIT_TYPE="unsigned long"
+elif test "x${ac_cv_sizeof_long_long}" = "x8"; then
+ test -n "${HOST_64BIT_TYPE}" || HOST_64BIT_TYPE="long long"
+ test -n "${HOST_U_64BIT_TYPE}" || HOST_U_64BIT_TYPE="unsigned long long"
+fi
+
+if test -n "${HOST_64BIT_TYPE}" -a -n "${HOST_U_64BIT_TYPE}"; then
BFD_HOST_64_BIT_DEFINED=1
- BFD_HOST_64_BIT=${HOST_64BIT_TYPE}
- BFD_HOST_U_64_BIT=${HOST_U_64BIT_TYPE}
+ BFD_HOST_64_BIT="${HOST_64BIT_TYPE}"
+ BFD_HOST_U_64_BIT="${HOST_U_64BIT_TYPE}"
fi
+
AC_SUBST(BFD_HOST_64BIT_LONG)
+AC_SUBST(BFD_HOST_LONG_LONG)
AC_SUBST(BFD_HOST_64_BIT_DEFINED)
AC_SUBST(BFD_HOST_64_BIT)
AC_SUBST(BFD_HOST_U_64_BIT)
@@ -141,6 +159,7 @@ AC_CHECK_HEADERS(fcntl.h sys/file.h sys/time.h)
AC_HEADER_TIME
AC_HEADER_DIRENT
AC_CHECK_FUNCS(fcntl getpagesize setitimer sysconf fdopen getuid getgid)
+AC_CHECK_FUNCS(strtoull)
BFD_BINARY_FOPEN
@@ -156,7 +175,7 @@ COREFLAG=
TRAD_HEADER=
if test "${target}" = "${host}"; then
case "${host}" in
- alpha*-*-freebsd*)
+ alpha*-*-freebsd* | alpha*-*-kfreebsd*-gnu)
COREFILE=''
;;
alpha*-*-linux-gnu*)
@@ -167,7 +186,8 @@ if test "${target}" = "${host}"; then
COREFILE=netbsd-core.lo
;;
alpha*-*-*) COREFILE=osf-core.lo ;;
- arm-*-freebsd*) COREFILE='' ;;
+ arm-*-freebsd* | arm-*-kfreebsd*-gnu)
+ COREFILE='' ;;
arm-*-netbsd*) COREFILE=netbsd-core.lo ;;
arm-*-riscix) COREFILE=trad-core.lo ;;
hppa*-*-hpux*) COREFILE=hpux-core.lo ;;
@@ -181,85 +201,77 @@ if test "${target}" = "${host}"; then
;;
changequote(,)dnl
- i[3456]86-sequent-bsd*)
+ i[3-7]86-sequent-bsd*)
changequote([,])dnl
COREFILE=trad-core.lo
TRAD_HEADER='"hosts/symmetry.h"'
;;
changequote(,)dnl
- i[3456]86-sequent-sysv4*) ;;
- i[3456]86-sequent-sysv*)
+ i[3-7]86-sequent-sysv4*) ;;
+ i[3-7]86-sequent-sysv*)
changequote([,])dnl
COREFILE=trad-core.lo
TRAD_HEADER='"hosts/symmetry.h"'
;;
changequote(,)dnl
- i[3456]86-*-bsdi)
+ i[3-7]86-*-bsdi)
changequote([,])dnl
COREFILE=
;;
changequote(,)dnl
- i[3456]86-*-bsd* | i[34567]86-*-freebsd[123] | i[34567]86-*-freebsd[123]\.* | i[34567]86-*-freebsd4\.[01234]* | i[34567]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-*-freebsd*aout*)
changequote([,])dnl
COREFILE=trad-core.lo
TRAD_HEADER='"hosts/i386bsd.h"'
;;
changequote(,)dnl
- i[3456]86-*-freebsd*)
+ i[3-7]86-*-freebsd* | i[3-7]86-*-kfreebsd*-gnu)
changequote([,])dnl
COREFILE=''
TRAD_HEADER='"hosts/i386bsd.h"'
;;
changequote(,)dnl
- i[3456]86-*-netbsd* | i[3456]86-*-openbsd*)
+ i[3-7]86-*-netbsd* | i[3-7]86-*-knetbsd*-gnu | i[3-7]86-*-openbsd*)
changequote([,])dnl
COREFILE=netbsd-core.lo
;;
changequote(,)dnl
- i[3456]86-esix-sysv3*)
+ i[3-7]86-esix-sysv3*)
changequote([,])dnl
COREFILE=trad-core.lo
TRAD_HEADER='"hosts/esix.h"'
;;
changequote(,)dnl
- i[3456]86-*-sco3.2v5*)
+ i[3-7]86-*-sco3.2v5*)
changequote([,])dnl
COREFILE=sco5-core.lo
;;
changequote(,)dnl
- i[3456]86-*-sco* | i[3456]86-*-isc*)
+ i[3-7]86-*-sco* | i[3-7]86-*-isc*)
changequote([,])dnl
COREFILE=trad-core.lo
TRAD_HEADER='"hosts/i386sco.h"'
;;
changequote(,)dnl
- i[3456]86-*-mach3*)
+ i[3-7]86-*-mach3*)
changequote([,])dnl
COREFILE=trad-core.lo
TRAD_HEADER='"hosts/i386mach3.h"'
;;
changequote(,)dnl
- i[3456]86-*-linux-gnu*)
+ i[3-7]86-*-linux-gnu*)
changequote([,])dnl
COREFILE=trad-core.lo
TRAD_HEADER='"hosts/i386linux.h"'
;;
changequote(,)dnl
- i[3456]86-*-isc*) COREFILE=trad-core.lo ;;
- i[3456]86-*-aix*) COREFILE=aix386-core.lo ;;
+ i[3-7]86-*-isc*) COREFILE=trad-core.lo ;;
+ i[3-7]86-*-aix*) COREFILE=aix386-core.lo ;;
changequote([,])dnl
i860-*-mach3* | i860-*-osf1*)
COREFILE=trad-core.lo
TRAD_HEADER='"hosts/i860mach3.h"'
;;
- mips-dec-bsd*)
- COREFILE=trad-core.lo
- TRAD_HEADER='"hosts/mipsbsd.h"'
- ;;
- mips-dec-mach3*)
- COREFILE=trad-core.lo
- TRAD_HEADER='"hosts/mipsmach3.h"'
- ;;
mips-*-netbsd* | mips*-*-openbsd*)
COREFILE=netbsd-core.lo
;;
@@ -270,10 +282,6 @@ changequote([,])dnl
mips-sgi-irix4*) COREFILE=irix-core.lo ;;
mips-sgi-irix5*) COREFILE=irix-core.lo ;;
mips-sgi-irix6*) COREFILE=irix-core.lo ;;
- mips-*-mach3*)
- COREFILE=trad-core.lo
- TRAD_HEADER='"hosts/mipsmach3.h"'
- ;;
mips-*-sysv4*) ;;
mips-*-sysv* | mips-*-riscos*)
COREFILE=trad-core.lo
@@ -353,7 +361,8 @@ changequote([,])dnl
powerpc-*-aix4*) COREFILE=rs6000-core.lo ;;
powerpc-*-aix*) COREFILE=rs6000-core.lo ;;
powerpc-*-beos*) ;;
- powerpc-*-freebsd*) COREFILE='' ;;
+ powerpc-*-freebsd* | powerpc-*-kfreebsd*-gnu)
+ COREFILE='' ;;
powerpc-*-netbsd*) COREFILE=netbsd-core.lo ;;
powerpc-*-*bsd*) COREFILE=netbsd-core.lo ;;
s390*-*-*) COREFILE=trad-core.lo ;;
@@ -365,7 +374,9 @@ changequote([,])dnl
COREFILE=trad-core.lo
TRAD_HEADER='"hosts/tahoe.h"'
;;
- vax-*-netbsd*) COREFILE=netbsd-core.lo ;;
+ vax-*-netbsd* | vax-*-openbsd*)
+ COREFILE=netbsd-core.lo
+ ;;
vax-*-ultrix2*)
COREFILE=trad-core.lo
TRAD_HEADER='"hosts/vaxult2.h"'
@@ -374,11 +385,17 @@ changequote([,])dnl
COREFILE=trad-core.lo
TRAD_HEADER='"hosts/vaxult2.h"'
;;
+ vax-*-linux-gnu*)
+ COREFILE=trad-core.lo
+ TRAD_HEADER='"hosts/vaxlinux.h"'
+ ;;
vax-*-*)
COREFILE=trad-core.lo
TRAD_HEADER='"hosts/vaxbsd.h"'
;;
- x86_64-*-netbsd*) COREFILE=netbsd-core.lo ;;
+ x86_64-*-netbsd* | x86_64-*-openbsd*)
+ COREFILE=netbsd-core.lo
+ ;;
esac
case "$COREFILE" in
@@ -446,7 +463,7 @@ case "${host}" in
;;
*)
changequote(,)dnl
- x=`sed -n -e 's/^[ ]*PICFLAG[ ]*=[ ]*//p' < ../libiberty/Makefile | tail -1`
+ x=`sed -n -e 's/^[ ]*PICFLAG[ ]*=[ ]*//p' < ../libiberty/Makefile | sed -n '$p'`
changequote([,])dnl
if test -n "$x"; then
WIN32LIBADD="-L../libiberty/pic -liberty"
@@ -477,12 +494,14 @@ fi
all_targets=false
defvec=
selvecs=
+assocvecs=
selarchs=
TDEFINES=
for targ in $target $canon_targets
do
if test "x$targ" = "xall"; then
all_targets=true
+ assocvecs="$assocvecs $targ_defvec $targ_selvecs"
else
. $srcdir/config.bfd
if test "x$targ" = "x$target"; then
@@ -513,6 +532,17 @@ done
selvecs="$f"
+# uniq the associated vectors in all the configured targets.
+f=""
+for i in $assocvecs ; do
+ case " $f " in
+ *" $i "*) ;;
+ *) f="$f $i" ;;
+ esac
+done
+assocvecs="$f"
+
+
# uniq the architectures in all the configured targets.
f=""
for i in $selarchs ; do
@@ -541,8 +571,6 @@ do
aout0_big_vec) tb="$tb aout0.lo aout32.lo" ;;
aout_arm_big_vec) tb="$tb aout-arm.lo aout32.lo" ;;
aout_arm_little_vec) tb="$tb aout-arm.lo aout32.lo" ;;
- aout_mips_big_vec) tb="$tb mipsbsd.lo aout32.lo" ;;
- aout_mips_little_vec) tb="$tb mipsbsd.lo aout32.lo" ;;
apollocoff_vec) tb="$tb coff-apollo.lo" ;;
arm_epoc_pe_big_vec) tb="$tb epoc-pe-arm.lo peigen.lo cofflink.lo " ;;
arm_epoc_pe_little_vec) tb="$tb epoc-pe-arm.lo peigen.lo cofflink.lo " ;;
@@ -559,6 +587,7 @@ do
b_out_vec_little_host) tb="$tb bout.lo aout32.lo" ;;
bfd_efi_app_ia32_vec) tb="$tb efi-app-ia32.lo peigen.lo cofflink.lo" ;;
bfd_efi_app_ia64_vec) tb="$tb efi-app-ia64.lo pepigen.lo cofflink.lo"; target_size=64 ;;
+ bfd_elf32_am33lin_vec) tb="$tb elf32-am33lin.lo elf32.lo $elf" ;;
bfd_elf32_avr_vec) tb="$tb elf32-avr.lo elf32.lo $elf" ;;
bfd_elf32_big_generic_vec) tb="$tb elf32-gen.lo elf32.lo $elf" ;;
bfd_elf32_bigarc_vec) tb="$tb elf32-arc.lo elf32.lo $elf" ;;
@@ -571,31 +600,42 @@ do
bfd_elf32_dlx_big_vec) tb="$tb elf32-dlx.lo elf32.lo $elf" ;;
bfd_elf32_fr30_vec) tb="$tb elf32-fr30.lo elf32.lo $elf" ;;
bfd_elf32_frv_vec) tb="$tb elf32-frv.lo elf32.lo $elf" ;;
+ bfd_elf32_frvfdpic_vec) tb="$tb elf32-frv.lo elf32.lo $elf" ;;
bfd_elf32_h8300_vec) tb="$tb elf32-h8300.lo elf32.lo $elf" ;;
bfd_elf32_hppa_linux_vec) tb="$tb elf32-hppa.lo elf32.lo $elf" ;;
bfd_elf32_hppa_vec) tb="$tb elf32-hppa.lo elf32.lo $elf" ;;
bfd_elf32_i370_vec) tb="$tb elf32-i370.lo elf32.lo $elf" ;;
- bfd_elf32_i386_freebsd_vec) tb="$tb elf32-i386-fbsd.lo elf32.lo $elf" ;;
+ bfd_elf32_i386_freebsd_vec) tb="$tb elf32-i386.lo elf32.lo $elf" ;;
bfd_elf32_i386_vec) tb="$tb elf32-i386.lo elf32.lo $elf" ;;
bfd_elf32_i860_little_vec) tb="$tb elf32-i860.lo elf32.lo $elf" ;;
bfd_elf32_i860_vec) tb="$tb elf32-i860.lo elf32.lo $elf" ;;
bfd_elf32_i960_vec) tb="$tb elf32-i960.lo elf32.lo $elf" ;;
bfd_elf32_ia64_big_vec) tb="$tb elf32-ia64.lo elf32.lo $elf" ;;
bfd_elf32_ia64_hpux_big_vec) tb="$tb elf32-ia64.lo elf32.lo $elf";;
+ bfd_elf32_ip2k_vec) tb="$tb elf32-ip2k.lo elf32.lo $elf" ;;
+ bfd_elf32_iq2000_vec) tb="$tb elf32-iq2000.lo elf32.lo $elf" ;;
bfd_elf32_little_generic_vec) tb="$tb elf32-gen.lo elf32.lo $elf" ;;
bfd_elf32_littlearc_vec) tb="$tb elf32-arc.lo elf32.lo $elf" ;;
bfd_elf32_littlearm_oabi_vec) tb="$tb elfarm-oabi.lo elf32.lo $elf" ;;
bfd_elf32_littlearm_vec) tb="$tb elfarm-nabi.lo elf32.lo $elf" ;;
bfd_elf32_littlemips_vec) tb="$tb elf32-mips.lo elfxx-mips.lo elf32.lo $elf ecofflink.lo" ;;
bfd_elf32_m32r_vec) tb="$tb elf32-m32r.lo elf32.lo $elf" ;;
- bfd_elf32_m68hc11_vec) tb="$tb elf32-m68hc11.lo elf32.lo $elf" ;;
- bfd_elf32_m68hc12_vec) tb="$tb elf32-m68hc12.lo elf32.lo $elf" ;;
+ bfd_elf32_m32rle_vec) tb="$tb elf32-m32r.lo elf32.lo $elf" ;;
+ bfd_elf32_m32rlin_vec) tb="$tb elf32-m32r.lo elf32.lo $elf" ;;
+ bfd_elf32_m32rlelin_vec) tb="$tb elf32-m32r.lo elf32.lo $elf" ;;
+ bfd_elf32_m68hc11_vec) tb="$tb elf32-m68hc11.lo elf32-m68hc1x.lo elf32.lo $elf" ;;
+ bfd_elf32_m68hc12_vec) tb="$tb elf32-m68hc12.lo elf32-m68hc1x.lo elf32.lo $elf" ;;
bfd_elf32_m68k_vec) tb="$tb elf32-m68k.lo elf32.lo $elf" ;;
bfd_elf32_m88k_vec) tb="$tb elf32-m88k.lo elf32.lo $elf" ;;
bfd_elf32_mcore_big_vec) tb="$tb elf32-mcore.lo elf32.lo $elf" ;;
bfd_elf32_mcore_little_vec) tb="$tb elf32-mcore.lo elf32.lo $elf" ;;
bfd_elf32_mn10200_vec) tb="$tb elf-m10200.lo elf32.lo $elf" ;;
bfd_elf32_mn10300_vec) tb="$tb elf-m10300.lo elf32.lo $elf" ;;
+ bfd_elf32_msp430_vec) tb="$tb elf32-msp430.lo elf32.lo $elf" ;;
+ bfd_elf32_nbigmips_vec) tb="$tb elfn32-mips.lo elfxx-mips.lo elf32.lo $elf ecofflink.lo"; target_size=64 ;;
+ bfd_elf32_nlittlemips_vec) tb="$tb elfn32-mips.lo elfxx-mips.lo elf32.lo $elf ecofflink.lo"; target_size=64 ;;
+ bfd_elf32_ntradbigmips_vec) tb="$tb elfn32-mips.lo elfxx-mips.lo elf32.lo $elf ecofflink.lo"; target_size=64 ;;
+ bfd_elf32_ntradlittlemips_vec) tb="$tb elfn32-mips.lo elfxx-mips.lo elf32.lo $elf ecofflink.lo"; target_size=64 ;;
bfd_elf32_openrisc_vec) tb="$tb elf32-openrisc.lo elf32.lo $elf" ;;
bfd_elf32_or32_big_vec) tb="$tb elf32-or32.lo elf32.lo $elf" ;;
bfd_elf32_pj_vec) tb="$tb elf32-pj.lo elf32.lo $elf";;
@@ -608,14 +648,16 @@ do
# 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_sh64lnbsd_vec) tb="$tb elf32-sh64-nbsd.lo elf32-sh64-com.lo elf32.lo $elf cofflink.lo" ;;
- bfd_elf32_sh64nbsd_vec) tb="$tb elf32-sh64-nbsd.lo elf32-sh64-com.lo elf32.lo $elf cofflink.lo" ;;
+ 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-lin.lo elf32.lo $elf coff-sh.lo cofflink.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-lin.lo elf32.lo $elf coff-sh.lo cofflink.lo" ;;
- bfd_elf32_shlnbsd_vec) tb="$tb elf32-sh-nbsd.lo elf32.lo $elf coff-sh.lo cofflink.lo" ;;
- bfd_elf32_shnbsd_vec) tb="$tb elf32-sh-nbsd.lo elf32.lo $elf coff-sh.lo cofflink.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" ;;
@@ -623,14 +665,14 @@ do
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_elf64_alpha_freebsd_vec) tb="$tb elf64-alpha-fbsd.lo elf64.lo $elf"; target_size=64 ;;
+ bfd_elf32_xtensa_le_vec) tb="$tb xtensa-isa.lo xtensa-modules.lo elf32-xtensa.lo elf32.lo $elf" ;;
+ bfd_elf32_xtensa_be_vec) tb="$tb xtensa-isa.lo xtensa-modules.lo elf32-xtensa.lo elf32.lo $elf" ;;
+ bfd_elf64_alpha_freebsd_vec) tb="$tb elf64-alpha.lo elf64.lo $elf"; target_size=64 ;;
bfd_elf64_alpha_vec) tb="$tb elf64-alpha.lo elf64.lo $elf"; target_size=64 ;;
bfd_elf64_big_generic_vec) tb="$tb elf64-gen.lo elf64.lo $elf"; target_size=64 ;;
bfd_elf64_bigmips_vec) tb="$tb elf64-mips.lo elf64.lo elfxx-mips.lo elf32.lo $elf ecofflink.lo"; target_size=64 ;;
bfd_elf64_hppa_linux_vec) tb="$tb elf64-hppa.lo elf64.lo $elf"; target_size=64 ;;
bfd_elf64_hppa_vec) tb="$tb elf64-hppa.lo elf64.lo $elf"; target_size=64 ;;
- bfd_elf64_ia64_aix_big_vec) tb="$tb elf64-ia64.lo elf64.lo $elf"; target_size=64 ;;
- bfd_elf64_ia64_aix_little_vec) tb="$tb elf64-ia64.lo elf64.lo $elf"; target_size=64 ;;
bfd_elf64_ia64_big_vec) tb="$tb elf64-ia64.lo elf64.lo $elf"; target_size=64 ;;
bfd_elf64_ia64_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 ;;
@@ -642,8 +684,10 @@ do
bfd_elf64_s390_vec) tb="$tb elf64-s390.lo elf64.lo $elf"; target_size=64 ;;
bfd_elf64_sh64_vec) tb="$tb elf64-sh64.lo elf64.lo $elf" target_size=64 ;;
bfd_elf64_sh64l_vec) tb="$tb elf64-sh64.lo elf64.lo $elf" target_size=64 ;;
- bfd_elf64_sh64lnbsd_vec) tb="$tb elf64-sh64-nbsd.lo elf64.lo $elf" target_size=64 ;;
- bfd_elf64_sh64nbsd_vec) tb="$tb elf64-sh64-nbsd.lo elf64.lo $elf" target_size=64 ;;
+ bfd_elf64_sh64lin_vec) tb="$tb elf64-sh64.lo elf64.lo $elf" target_size=64 ;;
+ bfd_elf64_sh64blin_vec) tb="$tb elf64-sh64.lo elf64.lo $elf" target_size=64 ;;
+ bfd_elf64_sh64lnbsd_vec) tb="$tb elf64-sh64.lo elf64.lo $elf" target_size=64 ;;
+ bfd_elf64_sh64nbsd_vec) tb="$tb elf64-sh64.lo elf64.lo $elf" target_size=64 ;;
bfd_elf64_sparc_vec) tb="$tb elf64-sparc.lo elf64.lo $elf"; target_size=64 ;;
bfd_elf64_tradbigmips_vec) tb="$tb elf64-mips.lo elf64.lo elfxx-mips.lo elf32.lo $elf ecofflink.lo"; target_size=64 ;;
bfd_elf64_tradlittlemips_vec) tb="$tb elf64-mips.lo elf64.lo elfxx-mips.lo elf32.lo $elf ecofflink.lo"; target_size=64 ;;
@@ -695,6 +739,9 @@ do
m68ksysvcoff_vec) tb="$tb coff-svm68k.lo cofflink.lo" ;;
m88kbcs_vec) tb="$tb coff-m88k.lo" ;;
m88kmach3_vec) tb="$tb m88kmach3.lo aout32.lo" ;;
+ mach_o_be_vec) tb="$tb mach-o.lo" ;;
+ mach_o_le_vec) tb="$tb mach-o.lo" ;;
+ mach_o_fat_vec) tb="$tb mach-o.lo" ;;
mcore_pe_big_vec) tb="$tb pe-mcore.lo peigen.lo cofflink.lo" ;;
mcore_pe_little_vec) tb="$tb pe-mcore.lo peigen.lo cofflink.lo" ;;
mcore_pei_big_vec) tb="$tb pei-mcore.lo peigen.lo cofflink.lo" ;;
@@ -709,6 +756,8 @@ do
or32coff_big_vec) tb="$tb coff-or32.lo cofflink.lo" ;;
pc532machaout_vec) tb="$tb pc532-mach.lo aout-ns32k.lo" ;;
pc532netbsd_vec) tb="$tb ns32knetbsd.lo aout-ns32k.lo" ;;
+ pef_vec) tb="$tb pef.lo" ;;
+ pef_xlib_vec) tb="$tb pef.lo" ;;
pdp11_aout_vec) tb="$tb pdp11.lo" ;;
pmac_xcoff_vec) tb="$tb coff-rs6000.lo xcofflink.lo" ;;
ppcboot_vec) tb="$tb ppcboot.lo" ;;
@@ -729,8 +778,15 @@ do
sparclynx_coff_vec) tb="$tb cf-sparclynx.lo lynx-core.lo" ;;
sparcnetbsd_vec) tb="$tb sparcnetbsd.lo aout32.lo" ;;
sunos_big_vec) tb="$tb sunos.lo aout32.lo" ;;
+ sym_vec) tb="$tb xsym.lo" ;;
tic30_aout_vec) tb="$tb aout-tic30.lo" ;;
tic30_coff_vec) tb="$tb coff-tic30.lo" ;;
+ tic4x_coff0_vec) tb="$tb coff-tic4x.lo" ;;
+ tic4x_coff0_beh_vec) tb="$tb coff-tic4x.lo" ;;
+ tic4x_coff1_vec) tb="$tb coff-tic4x.lo" ;;
+ tic4x_coff1_beh_vec) tb="$tb coff-tic4x.lo" ;;
+ tic4x_coff2_vec) tb="$tb coff-tic4x.lo" ;;
+ tic4x_coff2_beh_vec) tb="$tb coff-tic4x.lo" ;;
tic54x_coff0_beh_vec) tb="$tb coff-tic54x.lo" ;;
tic54x_coff0_vec) tb="$tb coff-tic54x.lo" ;;
tic54x_coff1_beh_vec) tb="$tb coff-tic54x.lo" ;;
@@ -800,9 +856,12 @@ if test x${all_targets} = xtrue ; then
selvecs=
havevecs=
selarchs=
+ test -n "$assocvecs" &&
+ assocvecs=`echo $assocvecs | sed -e 's/^/\&/' -e 's/ \(.\)/,\&\1/g'`
else # all_targets is true
# Only set these if they will be nonempty, for the clever echo.
havevecs=
+ assocvecs=
test -n "$selvecs" &&
havevecs=`echo $selvecs | sed -e 's/^/-DHAVE_/' -e 's/ \(.\)/ -DHAVE_\1/g'`
test -n "$selvecs" &&
@@ -816,7 +875,7 @@ case ${host64}-${target64}-${want64} in
wordsize=64
bfd_libs='$(BFD64_LIBS) $(BFD32_LIBS)'
all_backends='$(BFD64_BACKENDS) $(BFD32_BACKENDS)'
- if test -z "$GCC" && test "$BFD_HOST_64BIT_LONG" = "0" && test "$BFD_HOST_64_BIT_DEFINED" = "0"; then
+ if test $BFD_HOST_64_BIT_DEFINED = 0; then
AC_MSG_WARN([You have requested a 64 bit BFD configuration, but])
AC_MSG_WARN([your compiler may not have a 64 bit integral type])
fi
@@ -847,9 +906,32 @@ AC_SUBST(bfd_backends)
AC_SUBST(bfd_machines)
AC_SUBST(bfd_default_target_size)
+# Determine the host dependant file_ptr a.k.a. off_t type. In order
+# prefer: off64_t - if ftello64 and fseeko64, off_t - if ftello and
+# fseeko, long. This assumes that sizeof off_t is .ge. sizeof long.
+# Hopefully a reasonable assumption since fseeko et.al. should be
+# upward compatible.
+AC_CHECK_FUNCS(ftello ftello64 fseeko fseeko64)
+if test x"$ac_cv_func_ftello" = xyes -a x"$ac_cv_func_fseeko" = xyes; then
+ AC_COMPILE_CHECK_SIZEOF(off_t)
+fi
+AC_MSG_CHECKING([file_ptr type])
+bfd_file_ptr="long"
+bfd_ufile_ptr="unsigned long"
+if test x"$ac_cv_func_ftello64" = xyes -a x"$ac_cv_func_fseeko64" = xyes \
+ -o x"${ac_cv_sizeof_off_t}" = x8; then
+ bfd_file_ptr=BFD_HOST_64_BIT
+ bfd_ufile_ptr=BFD_HOST_U_64_BIT
+fi
+AC_MSG_RESULT($bfd_file_ptr)
+AC_SUBST(bfd_file_ptr)
+AC_SUBST(bfd_ufile_ptr)
+
+
tdefaults=""
test -n "${defvec}" && tdefaults="${tdefaults} -DDEFAULT_VECTOR=${defvec}"
test -n "${selvecs}" && tdefaults="${tdefaults} -DSELECT_VECS='${selvecs}'"
+test -n "${assocvecs}" && tdefaults="${tdefaults} -DASSOCIATED_VECS='${assocvecs}'"
test -n "${selarchs}" && tdefaults="${tdefaults} -DSELECT_ARCHITECTURES='${selarchs}'"
test -n "${havevecs}" && tdefaults="${tdefaults} ${havevecs}"
AC_SUBST(tdefaults)
@@ -862,6 +944,6 @@ 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 po/Makefile.in:po/Make-in,
+AC_OUTPUT(Makefile doc/Makefile bfd-in3.h:bfd-in2.h bfdver.h:version.h po/Makefile.in:po/Make-in,
[sed -e '/SRC-POTFILES =/r po/SRC-POTFILES' -e '/BLD-POTFILES =/r po/BLD-POTFILES' po/Makefile.in > po/Makefile])
diff --git a/contrib/binutils/bfd/corefile.c b/contrib/binutils/bfd/corefile.c
index 2414225..8af4f45 100644
--- a/contrib/binutils/bfd/corefile.c
+++ b/contrib/binutils/bfd/corefile.c
@@ -1,5 +1,5 @@
/* Core file generic interface routines for BFD.
- Copyright 1990, 1991, 1992, 1993, 1994, 2000, 2001, 2002
+ Copyright 1990, 1991, 1992, 1993, 1994, 2000, 2001, 2002, 2003
Free Software Foundation, Inc.
Written by Cygnus Support.
@@ -36,7 +36,7 @@ FUNCTION
bfd_core_file_failing_command
SYNOPSIS
- const char *bfd_core_file_failing_command(bfd *abfd);
+ const char *bfd_core_file_failing_command (bfd *abfd);
DESCRIPTION
Return a read-only string explaining which program was running
@@ -45,13 +45,13 @@ DESCRIPTION
*/
const char *
-bfd_core_file_failing_command (abfd)
- bfd *abfd;
+bfd_core_file_failing_command (bfd *abfd)
{
- if (abfd->format != bfd_core) {
- bfd_set_error (bfd_error_invalid_operation);
- return NULL;
- }
+ if (abfd->format != bfd_core)
+ {
+ bfd_set_error (bfd_error_invalid_operation);
+ return NULL;
+ }
return BFD_SEND (abfd, _core_file_failing_command, (abfd));
}
@@ -60,7 +60,7 @@ FUNCTION
bfd_core_file_failing_signal
SYNOPSIS
- int bfd_core_file_failing_signal(bfd *abfd);
+ int bfd_core_file_failing_signal (bfd *abfd);
DESCRIPTION
Returns the signal number which caused the core dump which
@@ -68,13 +68,13 @@ DESCRIPTION
*/
int
-bfd_core_file_failing_signal (abfd)
- bfd *abfd;
+bfd_core_file_failing_signal (bfd *abfd)
{
- if (abfd->format != bfd_core) {
- bfd_set_error (bfd_error_invalid_operation);
- return 0;
- }
+ if (abfd->format != bfd_core)
+ {
+ bfd_set_error (bfd_error_invalid_operation);
+ return 0;
+ }
return BFD_SEND (abfd, _core_file_failing_signal, (abfd));
}
@@ -83,23 +83,24 @@ FUNCTION
core_file_matches_executable_p
SYNOPSIS
- boolean core_file_matches_executable_p
- (bfd *core_bfd, bfd *exec_bfd);
+ bfd_boolean core_file_matches_executable_p
+ (bfd *core_bfd, bfd *exec_bfd);
DESCRIPTION
- Return <<true>> if the core file attached to @var{core_bfd}
+ Return <<TRUE>> if the core file attached to @var{core_bfd}
was generated by a run of the executable file attached to
- @var{exec_bfd}, <<false>> otherwise.
+ @var{exec_bfd}, <<FALSE>> otherwise.
*/
-boolean
-core_file_matches_executable_p (core_bfd, exec_bfd)
- bfd *core_bfd, *exec_bfd;
-{
- if ((core_bfd->format != bfd_core) || (exec_bfd->format != bfd_object)) {
- bfd_set_error (bfd_error_wrong_format);
- return false;
- }
- return BFD_SEND (core_bfd, _core_file_matches_executable_p,
- (core_bfd, exec_bfd));
+bfd_boolean
+core_file_matches_executable_p (bfd *core_bfd, bfd *exec_bfd)
+{
+ if (core_bfd->format != bfd_core || exec_bfd->format != bfd_object)
+ {
+ bfd_set_error (bfd_error_wrong_format);
+ return FALSE;
+ }
+
+ return BFD_SEND (core_bfd, _core_file_matches_executable_p,
+ (core_bfd, exec_bfd));
}
diff --git a/contrib/binutils/bfd/cpu-alpha.c b/contrib/binutils/bfd/cpu-alpha.c
index 93fc69c..c593fc3 100644
--- a/contrib/binutils/bfd/cpu-alpha.c
+++ b/contrib/binutils/bfd/cpu-alpha.c
@@ -1,5 +1,5 @@
/* BFD support for the Alpha architecture.
- Copyright 1992, 1993, 1998, 2000 Free Software Foundation, Inc.
+ Copyright 1992, 1993, 1998, 2000, 2002 Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@@ -39,13 +39,13 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#define NN(index) (&arch_info_struct[index])
-/* These exist only so that we can resonably disassemble PALcode. */
+/* These exist only so that we can reasonably disassemble PALcode. */
static const bfd_arch_info_type arch_info_struct[] =
{
- N (64, 64, bfd_mach_alpha_ev4, "alpha:ev4", false, NN(1)),
- N (64, 64, bfd_mach_alpha_ev5, "alpha:ev5", false, NN(2)),
- N (64, 64, bfd_mach_alpha_ev6, "alpha:ev6", false, 0),
+ N (64, 64, bfd_mach_alpha_ev4, "alpha:ev4", FALSE, NN(1)),
+ N (64, 64, bfd_mach_alpha_ev5, "alpha:ev5", FALSE, NN(2)),
+ N (64, 64, bfd_mach_alpha_ev6, "alpha:ev6", FALSE, 0),
};
const bfd_arch_info_type bfd_alpha_arch =
- N (64, 64, 0, "alpha", true, NN(0));
+ N (64, 64, 0, "alpha", TRUE, NN(0));
diff --git a/contrib/binutils/bfd/cpu-arc.c b/contrib/binutils/bfd/cpu-arc.c
index 204eb48..c69df0e 100644
--- a/contrib/binutils/bfd/cpu-arc.c
+++ b/contrib/binutils/bfd/cpu-arc.c
@@ -1,5 +1,5 @@
/* BFD support for the ARC processor
- Copyright 1994, 1995, 1997, 2001 Free Software Foundation, Inc.
+ Copyright 1994, 1995, 1997, 2001, 2002 Free Software Foundation, Inc.
Contributed by Doug Evans (dje@cygnus.com).
This file is part of BFD, the Binary File Descriptor library.
@@ -40,15 +40,15 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
static const bfd_arch_info_type arch_info_struct[] =
{
- ARC ( bfd_mach_arc_5, "arc5", false, &arch_info_struct[1] ),
- ARC ( bfd_mach_arc_5, "base", false, &arch_info_struct[2] ),
- ARC ( bfd_mach_arc_6, "arc6", false, &arch_info_struct[3] ),
- ARC ( bfd_mach_arc_7, "arc7", false, &arch_info_struct[4] ),
- ARC ( bfd_mach_arc_8, "arc8", false, NULL ),
+ ARC ( bfd_mach_arc_5, "arc5", FALSE, &arch_info_struct[1] ),
+ ARC ( bfd_mach_arc_5, "base", FALSE, &arch_info_struct[2] ),
+ ARC ( bfd_mach_arc_6, "arc6", FALSE, &arch_info_struct[3] ),
+ ARC ( bfd_mach_arc_7, "arc7", FALSE, &arch_info_struct[4] ),
+ ARC ( bfd_mach_arc_8, "arc8", FALSE, NULL ),
};
const bfd_arch_info_type bfd_arc_arch =
- ARC ( bfd_mach_arc_6, "arc", true, &arch_info_struct[0] );
+ ARC ( bfd_mach_arc_6, "arc", TRUE, &arch_info_struct[0] );
/* Utility routines. */
diff --git a/contrib/binutils/bfd/cpu-arm.c b/contrib/binutils/bfd/cpu-arm.c
index 9faf648..17889f3 100644
--- a/contrib/binutils/bfd/cpu-arm.c
+++ b/contrib/binutils/bfd/cpu-arm.c
@@ -1,5 +1,5 @@
/* BFD support for the ARM processor
- Copyright 1994, 1997, 1999, 2000, 2002 Free Software Foundation, Inc.
+ Copyright 1994, 1997, 1999, 2000, 2002, 2003 Free Software Foundation, Inc.
Contributed by Richard Earnshaw (rwe@pegasus.esprit.ec.org)
This file is part of BFD, the Binary File Descriptor library.
@@ -21,11 +21,14 @@
#include "bfd.h"
#include "sysdep.h"
#include "libbfd.h"
+#include "libiberty.h"
static const bfd_arch_info_type * compatible
PARAMS ((const bfd_arch_info_type *, const bfd_arch_info_type *));
-static boolean scan
+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
@@ -95,10 +98,12 @@ processors[] =
{ bfd_mach_arm_4, "strongarm"},
{ bfd_mach_arm_4, "strongarm110" },
{ bfd_mach_arm_4, "strongarm1100" },
- { bfd_mach_arm_XScale, "xscale" }
+ { bfd_mach_arm_XScale, "xscale" },
+ { bfd_mach_arm_ep9312, "ep9312" },
+ { bfd_mach_arm_iWMMXt, "iwmmxt" }
};
-static boolean
+static bfd_boolean
scan (info, string)
const struct bfd_arch_info * info;
const char * string;
@@ -107,7 +112,7 @@ scan (info, string)
/* First test for an exact match. */
if (strcasecmp (string, info->printable_name) == 0)
- return true;
+ return TRUE;
/* Next check for a processor name instead of an Architecture name. */
for (i = sizeof (processors) / sizeof (processors[0]); i--;)
@@ -117,13 +122,13 @@ scan (info, string)
}
if (i != -1 && info->mach == processors [i].mach)
- return true;
+ return TRUE;
/* Finally check for the default architecture. */
if (strcasecmp (string, "arm") == 0)
return info->the_default;
- return false;
+ return FALSE;
}
#define N(number, print, default, next) \
@@ -131,17 +136,292 @@ scan (info, string)
static const bfd_arch_info_type arch_info_struct[] =
{
- N (bfd_mach_arm_2, "armv2", false, & arch_info_struct[1]),
- N (bfd_mach_arm_2a, "armv2a", false, & arch_info_struct[2]),
- N (bfd_mach_arm_3, "armv3", false, & arch_info_struct[3]),
- N (bfd_mach_arm_3M, "armv3m", false, & arch_info_struct[4]),
- N (bfd_mach_arm_4, "armv4", false, & arch_info_struct[5]),
- N (bfd_mach_arm_4T, "armv4t", false, & arch_info_struct[6]),
- N (bfd_mach_arm_5, "armv5", false, & arch_info_struct[7]),
- N (bfd_mach_arm_5T, "armv5t", false, & arch_info_struct[8]),
- N (bfd_mach_arm_5TE, "armv5te", false, & arch_info_struct[9]),
- N (bfd_mach_arm_XScale, "xscale", false, NULL)
+ N (bfd_mach_arm_2, "armv2", FALSE, & arch_info_struct[1]),
+ N (bfd_mach_arm_2a, "armv2a", FALSE, & arch_info_struct[2]),
+ N (bfd_mach_arm_3, "armv3", FALSE, & arch_info_struct[3]),
+ N (bfd_mach_arm_3M, "armv3m", FALSE, & arch_info_struct[4]),
+ N (bfd_mach_arm_4, "armv4", FALSE, & arch_info_struct[5]),
+ N (bfd_mach_arm_4T, "armv4t", FALSE, & arch_info_struct[6]),
+ N (bfd_mach_arm_5, "armv5", FALSE, & arch_info_struct[7]),
+ N (bfd_mach_arm_5T, "armv5t", FALSE, & arch_info_struct[8]),
+ N (bfd_mach_arm_5TE, "armv5te", FALSE, & arch_info_struct[9]),
+ N (bfd_mach_arm_XScale, "xscale", FALSE, & arch_info_struct[10]),
+ N (bfd_mach_arm_ep9312, "ep9312", FALSE, & arch_info_struct[11]),
+ N (bfd_mach_arm_iWMMXt,"iwmmxt", FALSE, NULL)
};
const bfd_arch_info_type bfd_arm_arch =
- N (0, "arm", true, & arch_info_struct[0]);
+ N (0, "arm", TRUE, & arch_info_struct[0]);
+
+/* Support functions used by both the COFF and ELF versions of the ARM port. */
+
+/* Handle the merging of the 'machine' settings of input file IBFD
+ and an output file OBFD. These values actually represent the
+ different possible ARM architecture variants.
+ Returns TRUE if they were merged successfully or FALSE otherwise. */
+
+bfd_boolean
+bfd_arm_merge_machines (ibfd, obfd)
+ bfd * ibfd;
+ bfd * obfd;
+{
+ unsigned int in = bfd_get_mach (ibfd);
+ unsigned int out = bfd_get_mach (obfd);
+
+ /* If the output architecture is unknown, we now have a value to set. */
+ if (out == bfd_mach_arm_unknown)
+ bfd_set_arch_mach (obfd, bfd_arch_arm, in);
+
+ /* If the input architecture is unknown,
+ then so must be the output architecture. */
+ else if (in == bfd_mach_arm_unknown)
+ /* FIXME: We ought to have some way to
+ override this on the command line. */
+ bfd_set_arch_mach (obfd, bfd_arch_arm, bfd_mach_arm_unknown);
+
+ /* If they are the same then nothing needs to be done. */
+ else if (out == in)
+ ;
+
+ /* Otherwise the general principle that a earlier architecture can be
+ linked with a later architecture to produce a binary that will execute
+ on the later architecture.
+
+ We fail however if we attempt to link a Cirrus EP9312 binary with an
+ Intel XScale binary, since these architecture have co-processors which
+ will not both be present on the same physical hardware. */
+ else if (in == bfd_mach_arm_ep9312
+ && (out == bfd_mach_arm_XScale || out == bfd_mach_arm_iWMMXt))
+ {
+ _bfd_error_handler (_("\
+ERROR: %s is compiled for the EP9312, whereas %s is compiled for XScale"),
+ bfd_archive_filename (ibfd),
+ bfd_get_filename (obfd));
+ bfd_set_error (bfd_error_wrong_format);
+ return FALSE;
+ }
+ else if (out == bfd_mach_arm_ep9312
+ && (in == bfd_mach_arm_XScale || in == bfd_mach_arm_iWMMXt))
+ {
+ _bfd_error_handler (_("\
+ERROR: %s is compiled for the EP9312, whereas %s is compiled for XScale"),
+ bfd_archive_filename (obfd),
+ bfd_get_filename (ibfd));
+ bfd_set_error (bfd_error_wrong_format);
+ return FALSE;
+ }
+ else if (in > out)
+ bfd_set_arch_mach (obfd, bfd_arch_arm, in);
+ /* else
+ Nothing to do. */
+
+ return TRUE;
+}
+
+typedef struct
+{
+ unsigned char namesz[4]; /* Size of entry's owner string. */
+ unsigned char descsz[4]; /* Size of the note descriptor. */
+ unsigned char type[4]; /* Interpretation of the descriptor. */
+ char name[1]; /* Start of the name+desc data. */
+} arm_Note;
+
+static bfd_boolean
+arm_check_note (abfd, buffer, buffer_size, expected_name, description_return)
+ bfd * abfd;
+ char * buffer;
+ bfd_size_type buffer_size;
+ const char * expected_name;
+ char ** description_return;
+{
+ unsigned long namesz;
+ unsigned long descsz;
+ unsigned long type;
+ char * descr;
+
+ if (buffer_size < offsetof (arm_Note, name))
+ return FALSE;
+
+ /* We have to extract the values this way to allow for a
+ host whose endian-ness is different from the target. */
+ namesz = bfd_get_32 (abfd, buffer);
+ descsz = bfd_get_32 (abfd, buffer + offsetof (arm_Note, descsz));
+ type = bfd_get_32 (abfd, buffer + offsetof (arm_Note, type));
+ descr = buffer + offsetof (arm_Note, name);
+
+ /* Check for buffer overflow. */
+ if (namesz + descsz + offsetof (arm_Note, name) > buffer_size)
+ return FALSE;
+
+ if (expected_name == NULL)
+ {
+ if (namesz != 0)
+ return FALSE;
+ }
+ else
+ {
+ if (namesz != ((strlen (expected_name) + 1 + 3) & ~3))
+ return FALSE;
+
+ if (strcmp (descr, expected_name) != 0)
+ return FALSE;
+
+ descr += (namesz + 3) & ~3;
+ }
+
+ /* FIXME: We should probably check the type as well. */
+
+ if (description_return != NULL)
+ * description_return = descr;
+
+ return TRUE;
+}
+
+#define NOTE_ARCH_STRING "arch: "
+
+bfd_boolean
+bfd_arm_update_notes (abfd, note_section)
+ bfd * abfd;
+ const char * note_section;
+{
+ asection * arm_arch_section;
+ bfd_size_type buffer_size;
+ char * buffer;
+ char * arch_string;
+ char * expected;
+
+ /* Look for a note section. If one is present check the architecture
+ string encoded in it, and set it to the current architecture if it is
+ different. */
+ arm_arch_section = bfd_get_section_by_name (abfd, note_section);
+
+ if (arm_arch_section == NULL)
+ return TRUE;
+
+ buffer_size = arm_arch_section->_raw_size;
+ if (buffer_size == 0)
+ return FALSE;
+
+ buffer = bfd_malloc (buffer_size);
+ if (buffer == NULL)
+ return FALSE;
+
+ if (! bfd_get_section_contents (abfd, arm_arch_section, buffer,
+ (file_ptr) 0, buffer_size))
+ goto FAIL;
+
+ /* Parse the note. */
+ if (! arm_check_note (abfd, buffer, buffer_size, NOTE_ARCH_STRING, & arch_string))
+ goto FAIL;
+
+ /* Check the architecture in the note against the architecture of the bfd. */
+ switch (bfd_get_mach (abfd))
+ {
+ default:
+ case bfd_mach_arm_unknown: expected = "unknown"; break;
+ case bfd_mach_arm_2: expected = "armv2"; break;
+ case bfd_mach_arm_2a: expected = "armv2a"; break;
+ case bfd_mach_arm_3: expected = "armv3"; break;
+ case bfd_mach_arm_3M: expected = "armv3M"; break;
+ case bfd_mach_arm_4: expected = "armv4"; break;
+ case bfd_mach_arm_4T: expected = "armv4t"; break;
+ case bfd_mach_arm_5: expected = "armv5"; break;
+ case bfd_mach_arm_5T: expected = "armv5t"; break;
+ case bfd_mach_arm_5TE: expected = "armv5te"; break;
+ case bfd_mach_arm_XScale: expected = "XScale"; break;
+ case bfd_mach_arm_ep9312: expected = "ep9312"; break;
+ case bfd_mach_arm_iWMMXt: expected = "iWMMXt"; break;
+ }
+
+ if (strcmp (arch_string, expected) != 0)
+ {
+ strcpy (buffer + offsetof (arm_Note, name) + ((strlen (NOTE_ARCH_STRING) + 3) & ~3), expected);
+
+ if (! bfd_set_section_contents (abfd, arm_arch_section, buffer,
+ (file_ptr) 0, buffer_size))
+ {
+ (*_bfd_error_handler)
+ (_("warning: unable to update contents of %s section in %s"),
+ note_section, bfd_get_filename (abfd));
+ goto FAIL;
+ }
+ }
+
+ free (buffer);
+ return TRUE;
+
+ FAIL:
+ free (buffer);
+ return FALSE;
+}
+
+
+static struct
+{
+ const char * string;
+ unsigned int mach;
+}
+architectures[] =
+{
+ { "armv2", bfd_mach_arm_2 },
+ { "armv2a", bfd_mach_arm_2a },
+ { "armv3", bfd_mach_arm_3 },
+ { "armv3M", bfd_mach_arm_3M },
+ { "armv4", bfd_mach_arm_4 },
+ { "armv4t", bfd_mach_arm_4T },
+ { "armv5", bfd_mach_arm_5 },
+ { "armv5t", bfd_mach_arm_5T },
+ { "armv5te", bfd_mach_arm_5TE },
+ { "XScale", bfd_mach_arm_XScale },
+ { "ep9312", bfd_mach_arm_ep9312 },
+ { "iWMMXt", bfd_mach_arm_iWMMXt }
+};
+
+/* Extract the machine number stored in a note section. */
+unsigned int
+bfd_arm_get_mach_from_notes (abfd, note_section)
+ bfd * abfd;
+ const char * note_section;
+{
+ asection * arm_arch_section;
+ bfd_size_type buffer_size;
+ char * buffer;
+ char * arch_string;
+ int i;
+
+ /* Look for a note section. If one is present check the architecture
+ string encoded in it, and set it to the current architecture if it is
+ different. */
+ arm_arch_section = bfd_get_section_by_name (abfd, note_section);
+
+ if (arm_arch_section == NULL)
+ return bfd_mach_arm_unknown;
+
+ buffer_size = arm_arch_section->_raw_size;
+ if (buffer_size == 0)
+ return bfd_mach_arm_unknown;
+
+ buffer = bfd_malloc (buffer_size);
+ if (buffer == NULL)
+ return bfd_mach_arm_unknown;
+
+ if (! bfd_get_section_contents (abfd, arm_arch_section, buffer,
+ (file_ptr) 0, buffer_size))
+ goto FAIL;
+
+ /* Parse the note. */
+ if (! arm_check_note (abfd, buffer, buffer_size, NOTE_ARCH_STRING, & arch_string))
+ goto FAIL;
+
+ /* Interpret the architecture string. */
+ for (i = ARRAY_SIZE (architectures); i--;)
+ if (strcmp (arch_string, architectures[i].string) == 0)
+ {
+ free (buffer);
+ return architectures[i].mach;
+ }
+
+ FAIL:
+ free (buffer);
+ return bfd_mach_arm_unknown;
+}
diff --git a/contrib/binutils/bfd/cpu-i386.c b/contrib/binutils/bfd/cpu-i386.c
index f492827..272c719 100644
--- a/contrib/binutils/bfd/cpu-i386.c
+++ b/contrib/binutils/bfd/cpu-i386.c
@@ -32,7 +32,7 @@ const bfd_arch_info_type bfd_i386_arch_intel_syntax =
"i386:intel",
"i386:intel",
3,
- true,
+ TRUE,
bfd_default_compatible,
bfd_default_scan ,
0,
@@ -47,7 +47,7 @@ const bfd_arch_info_type bfd_x86_64_arch_intel_syntax =
"i386:intel",
"i386:x86-64:intel",
3,
- true,
+ TRUE,
bfd_default_compatible,
bfd_default_scan ,
&bfd_i386_arch_intel_syntax,
@@ -62,7 +62,7 @@ static const bfd_arch_info_type i8086_arch =
"i8086",
"i8086",
3,
- false,
+ FALSE,
bfd_default_compatible,
bfd_default_scan ,
&bfd_x86_64_arch_intel_syntax,
@@ -78,7 +78,7 @@ const bfd_arch_info_type bfd_x86_64_arch =
"i386",
"i386:x86-64",
3,
- true,
+ TRUE,
bfd_default_compatible,
bfd_default_scan ,
&i8086_arch,
@@ -94,7 +94,7 @@ const bfd_arch_info_type bfd_i386_arch =
"i386",
"i386",
3,
- true,
+ TRUE,
bfd_default_compatible,
bfd_default_scan ,
&bfd_x86_64_arch
diff --git a/contrib/binutils/bfd/cpu-ia64-opc.c b/contrib/binutils/bfd/cpu-ia64-opc.c
index a228b1c..740c2ee 100644
--- a/contrib/binutils/bfd/cpu-ia64-opc.c
+++ b/contrib/binutils/bfd/cpu-ia64-opc.c
@@ -1,4 +1,5 @@
-/* Copyright 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
+/* Copyright 1998, 1999, 2000, 2001, 2002, 2003
+ Free Software Foundation, Inc.
Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
This file is part of BFD, the Binary File Descriptor library.
@@ -161,8 +162,8 @@ static const char*
ext_imms_scaled (const struct ia64_operand *self, ia64_insn code,
ia64_insn *valuep, int scale)
{
- int i, bits = 0, total = 0, shift;
- BFD_HOST_64_BIT val = 0;
+ int i, bits = 0, total = 0;
+ BFD_HOST_64_BIT val = 0, sign;
for (i = 0; i < NELEMS (self->field) && self->field[i].bits; ++i)
{
@@ -172,8 +173,8 @@ ext_imms_scaled (const struct ia64_operand *self, ia64_insn code,
total += bits;
}
/* sign extend: */
- shift = 8*sizeof (val) - total;
- val = (val << shift) >> shift;
+ sign = (BFD_HOST_64_BIT) 1 << (total - 1);
+ val = (val ^ sign) - sign;
*valuep = (val << scale);
return 0;
@@ -188,10 +189,7 @@ ins_imms (const struct ia64_operand *self, ia64_insn value, ia64_insn *code)
static const char*
ins_immsu4 (const struct ia64_operand *self, ia64_insn value, ia64_insn *code)
{
- if (value == (BFD_HOST_U_64_BIT) 0x100000000)
- value = 0;
- else
- value = (((BFD_HOST_64_BIT)value << 32) >> 32);
+ value = ((value & 0xffffffff) ^ 0x80000000) - 0x80000000;
return ins_imms_scaled (self, value, code, 0);
}
@@ -213,10 +211,7 @@ static const char*
ins_immsm1u4 (const struct ia64_operand *self, ia64_insn value,
ia64_insn *code)
{
- if (value == (BFD_HOST_U_64_BIT) 0x100000000)
- value = 0;
- else
- value = (((BFD_HOST_64_BIT)value << 32) >> 32);
+ value = ((value & 0xffffffff) ^ 0x80000000) - 0x80000000;
--value;
return ins_imms_scaled (self, value, code, 0);
@@ -418,6 +413,7 @@ const struct ia64_operand elf64_ia64_operands[IA64_OPND_COUNT] =
{
/* constants: */
{ CST, ins_const, ext_const, "NIL", {{ 0, 0}}, 0, "<none>" },
+ { CST, ins_const, ext_const, "ar.csd", {{ 0, 0}}, 0, "ar.csd" },
{ CST, ins_const, ext_const, "ar.ccv", {{ 0, 0}}, 0, "ar.ccv" },
{ CST, ins_const, ext_const, "ar.pfs", {{ 0, 0}}, 0, "ar.pfs" },
{ CST, ins_const, ext_const, "1", {{ 0, 0}}, 0, "1" },
@@ -586,4 +582,7 @@ const struct ia64_operand elf64_ia64_operands[IA64_OPND_COUNT] =
"a branch target" },
{ REL, ins_rsvd, ext_rsvd, 0, {{0, 0}}, 0, /* TGT64 */
"a branch target" },
+
+ { ABS, ins_const, ext_const, 0, {{0, 0}}, 0, /* LDXMOV */
+ "ldxmov target" },
};
diff --git a/contrib/binutils/bfd/cpu-ia64.c b/contrib/binutils/bfd/cpu-ia64.c
index 1f36568..2185241 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 Free Software Foundation, Inc.
+ Copyright 1998, 1999, 2000, 2002 Free Software Foundation, Inc.
Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
This file is part of BFD, the Binary File Descriptor library.
@@ -32,7 +32,7 @@ const bfd_arch_info_type bfd_ia64_elf32_arch =
"ia64",
"ia64-elf32",
3, /* log2 of section alignment */
- true, /* the one and only */
+ TRUE, /* the one and only */
bfd_default_compatible,
bfd_default_scan ,
0,
@@ -48,7 +48,7 @@ const bfd_arch_info_type bfd_ia64_arch =
"ia64",
"ia64-elf64",
3, /* log2 of section alignment */
- true, /* the one and only */
+ TRUE, /* the one and only */
bfd_default_compatible,
bfd_default_scan ,
&bfd_ia64_elf32_arch,
diff --git a/contrib/binutils/bfd/cpu-powerpc.c b/contrib/binutils/bfd/cpu-powerpc.c
index 5523669..a4e72d5 100644
--- a/contrib/binutils/bfd/cpu-powerpc.c
+++ b/contrib/binutils/bfd/cpu-powerpc.c
@@ -41,7 +41,7 @@ powerpc_compatible (a,b)
case bfd_arch_powerpc:
return bfd_default_compatible (a, b);
case bfd_arch_rs6000:
- if (a->mach == 0)
+ if (b->mach == bfd_mach_rs6k)
return a;
return NULL;
}
@@ -61,7 +61,7 @@ const bfd_arch_info_type bfd_powerpc_archs[] =
"powerpc",
"powerpc:common64",
3,
- true, /* default for 64 bit target */
+ TRUE, /* default for 64 bit target */
powerpc_compatible,
bfd_default_scan,
&bfd_powerpc_archs[1]
@@ -77,7 +77,7 @@ const bfd_arch_info_type bfd_powerpc_archs[] =
"powerpc",
"powerpc:common",
3,
- false,
+ FALSE,
powerpc_compatible,
bfd_default_scan,
&bfd_powerpc_archs[2],
@@ -93,7 +93,7 @@ const bfd_arch_info_type bfd_powerpc_archs[] =
"powerpc",
"powerpc:common",
3,
- true, /* default for 32 bit target */
+ TRUE, /* default for 32 bit target */
powerpc_compatible,
bfd_default_scan,
&bfd_powerpc_archs[1],
@@ -109,7 +109,7 @@ const bfd_arch_info_type bfd_powerpc_archs[] =
"powerpc",
"powerpc:common64",
3,
- false,
+ FALSE,
powerpc_compatible,
bfd_default_scan,
&bfd_powerpc_archs[2]
@@ -124,7 +124,7 @@ const bfd_arch_info_type bfd_powerpc_archs[] =
"powerpc",
"powerpc:603",
3,
- false, /* not the default */
+ FALSE, /* not the default */
powerpc_compatible,
bfd_default_scan,
&bfd_powerpc_archs[3]
@@ -138,7 +138,7 @@ const bfd_arch_info_type bfd_powerpc_archs[] =
"powerpc",
"powerpc:EC603e",
3,
- false, /* not the default */
+ FALSE, /* not the default */
powerpc_compatible,
bfd_default_scan,
&bfd_powerpc_archs[4]
@@ -152,7 +152,7 @@ const bfd_arch_info_type bfd_powerpc_archs[] =
"powerpc",
"powerpc:604",
3,
- false, /* not the default */
+ FALSE, /* not the default */
powerpc_compatible,
bfd_default_scan,
&bfd_powerpc_archs[5]
@@ -166,7 +166,7 @@ const bfd_arch_info_type bfd_powerpc_archs[] =
"powerpc",
"powerpc:403",
3,
- false, /* not the default */
+ FALSE, /* not the default */
powerpc_compatible,
bfd_default_scan,
&bfd_powerpc_archs[6]
@@ -180,7 +180,7 @@ const bfd_arch_info_type bfd_powerpc_archs[] =
"powerpc",
"powerpc:601",
3,
- false, /* not the default */
+ FALSE, /* not the default */
powerpc_compatible,
bfd_default_scan,
&bfd_powerpc_archs[7]
@@ -194,7 +194,7 @@ const bfd_arch_info_type bfd_powerpc_archs[] =
"powerpc",
"powerpc:620",
3,
- false, /* not the default */
+ FALSE, /* not the default */
powerpc_compatible,
bfd_default_scan,
&bfd_powerpc_archs[8]
@@ -208,7 +208,7 @@ const bfd_arch_info_type bfd_powerpc_archs[] =
"powerpc",
"powerpc:630",
3,
- false, /* not the default */
+ FALSE, /* not the default */
powerpc_compatible,
bfd_default_scan,
&bfd_powerpc_archs[9]
@@ -222,7 +222,7 @@ const bfd_arch_info_type bfd_powerpc_archs[] =
"powerpc",
"powerpc:a35",
3,
- false, /* not the default */
+ FALSE, /* not the default */
powerpc_compatible,
bfd_default_scan,
&bfd_powerpc_archs[10]
@@ -236,7 +236,7 @@ const bfd_arch_info_type bfd_powerpc_archs[] =
"powerpc",
"powerpc:rs64ii",
3,
- false, /* not the default */
+ FALSE, /* not the default */
powerpc_compatible,
bfd_default_scan,
&bfd_powerpc_archs[11]
@@ -250,7 +250,7 @@ const bfd_arch_info_type bfd_powerpc_archs[] =
"powerpc",
"powerpc:rs64iii",
3,
- false, /* not the default */
+ FALSE, /* not the default */
powerpc_compatible,
bfd_default_scan,
&bfd_powerpc_archs[12]
@@ -264,12 +264,26 @@ const bfd_arch_info_type bfd_powerpc_archs[] =
"powerpc",
"powerpc:7400",
3,
- false, /* not the default */
+ FALSE, /* not the default */
powerpc_compatible,
bfd_default_scan,
&bfd_powerpc_archs[13]
},
{
+ 32, /* 32 bits in a word */
+ 32, /* 32 bits in an address */
+ 8, /* 8 bits in a byte */
+ bfd_arch_powerpc,
+ bfd_mach_ppc_e500,
+ "powerpc",
+ "powerpc:e500",
+ 3,
+ FALSE,
+ powerpc_compatible,
+ bfd_default_scan,
+ &bfd_powerpc_archs[14]
+ },
+ {
32, /* 32 bits in a word */
32, /* 32 bits in an address */
8, /* 8 bits in a byte */
@@ -278,7 +292,7 @@ const bfd_arch_info_type bfd_powerpc_archs[] =
"powerpc",
"powerpc:MPC8XX",
3,
- false, /* not the default */
+ 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 89b9230..d94921f 100644
--- a/contrib/binutils/bfd/cpu-rs6000.c
+++ b/contrib/binutils/bfd/cpu-rs6000.c
@@ -1,5 +1,6 @@
/* BFD back-end for rs6000 support
- Copyright 1990, 1991, 1993, 1995, 2000 Free Software Foundation, Inc.
+ Copyright 1990, 1991, 1993, 1995, 2000, 2002, 2003
+ Free Software Foundation, Inc.
FIXME: Can someone provide a transliteration of this name into ASCII?
Using the following chars caused a compiler warning on HIUX (so I replaced
them with octal escapes), and isn't useful without an understanding of what
@@ -46,7 +47,7 @@ rs6000_compatible (a,b)
case bfd_arch_rs6000:
return bfd_default_compatible (a, b);
case bfd_arch_powerpc:
- if (b->mach == 0)
+ if (a->mach == bfd_mach_rs6k)
return b;
return NULL;
}
@@ -64,7 +65,7 @@ static const bfd_arch_info_type arch_info_struct[] =
"rs6000",
"rs6000:rs1",
3,
- false, /* not the default */
+ FALSE, /* not the default */
rs6000_compatible,
bfd_default_scan,
&arch_info_struct[1]
@@ -78,7 +79,7 @@ static const bfd_arch_info_type arch_info_struct[] =
"rs6000",
"rs6000:rsc",
3,
- false, /* not the default */
+ FALSE, /* not the default */
rs6000_compatible,
bfd_default_scan,
&arch_info_struct[2]
@@ -92,7 +93,7 @@ static const bfd_arch_info_type arch_info_struct[] =
"rs6000",
"rs6000:rs2",
3,
- false, /* not the default */
+ FALSE, /* not the default */
rs6000_compatible,
bfd_default_scan,
0
@@ -109,7 +110,7 @@ const bfd_arch_info_type bfd_rs6000_arch =
"rs6000",
"rs6000:6000",
3,
- true, /* the default */
+ TRUE, /* the default */
rs6000_compatible,
bfd_default_scan,
&arch_info_struct[0]
diff --git a/contrib/binutils/bfd/cpu-s390.c b/contrib/binutils/bfd/cpu-s390.c
index ac0d45e..66fd246 100644
--- a/contrib/binutils/bfd/cpu-s390.c
+++ b/contrib/binutils/bfd/cpu-s390.c
@@ -33,7 +33,7 @@ const bfd_arch_info_type bfd_s390_64_arch =
"s390",
"s390:64-bit",
3, /* section alignment power */
- true, /* the default */
+ TRUE, /* the default */
bfd_default_compatible,
bfd_default_scan,
NULL
@@ -49,7 +49,7 @@ const bfd_arch_info_type bfd_s390_arch =
"s390",
"s390:31-bit",
3, /* section alignment power */
- true, /* the default */
+ TRUE, /* the default */
bfd_default_compatible,
bfd_default_scan,
&bfd_s390_64_arch
diff --git a/contrib/binutils/bfd/cpu-sparc.c b/contrib/binutils/bfd/cpu-sparc.c
index e3b8ecb..3c0eae5 100644
--- a/contrib/binutils/bfd/cpu-sparc.c
+++ b/contrib/binutils/bfd/cpu-sparc.c
@@ -33,7 +33,7 @@ static const bfd_arch_info_type arch_info_struct[] =
"sparc",
"sparc:sparclet",
3,
- false,
+ FALSE,
bfd_default_compatible,
bfd_default_scan,
&arch_info_struct[1],
@@ -47,7 +47,7 @@ static const bfd_arch_info_type arch_info_struct[] =
"sparc",
"sparc:sparclite",
3,
- false,
+ FALSE,
bfd_default_compatible,
bfd_default_scan,
&arch_info_struct[2],
@@ -61,7 +61,7 @@ static const bfd_arch_info_type arch_info_struct[] =
"sparc",
"sparc:v8plus",
3,
- false,
+ FALSE,
bfd_default_compatible,
bfd_default_scan,
&arch_info_struct[3],
@@ -75,7 +75,7 @@ static const bfd_arch_info_type arch_info_struct[] =
"sparc",
"sparc:v8plusa",
3,
- false,
+ FALSE,
bfd_default_compatible,
bfd_default_scan,
&arch_info_struct[4],
@@ -89,7 +89,7 @@ static const bfd_arch_info_type arch_info_struct[] =
"sparc",
"sparc:sparclite_le",
3,
- false,
+ FALSE,
bfd_default_compatible,
bfd_default_scan,
&arch_info_struct[5],
@@ -103,7 +103,7 @@ static const bfd_arch_info_type arch_info_struct[] =
"sparc",
"sparc:v9",
3,
- false,
+ FALSE,
bfd_default_compatible,
bfd_default_scan,
&arch_info_struct[6],
@@ -117,7 +117,7 @@ static const bfd_arch_info_type arch_info_struct[] =
"sparc",
"sparc:v9a",
3,
- false,
+ FALSE,
bfd_default_compatible,
bfd_default_scan,
&arch_info_struct[7],
@@ -131,7 +131,7 @@ static const bfd_arch_info_type arch_info_struct[] =
"sparc",
"sparc:v8plusb",
3,
- false,
+ FALSE,
bfd_default_compatible,
bfd_default_scan,
&arch_info_struct[8],
@@ -145,7 +145,7 @@ static const bfd_arch_info_type arch_info_struct[] =
"sparc",
"sparc:v9b",
3,
- false,
+ FALSE,
bfd_default_compatible,
bfd_default_scan,
0,
@@ -162,7 +162,7 @@ const bfd_arch_info_type bfd_sparc_arch =
"sparc",
"sparc",
3,
- true, /* the default */
+ TRUE, /* the default */
bfd_default_compatible,
bfd_default_scan,
&arch_info_struct[0],
diff --git a/contrib/binutils/bfd/dep-in.sed b/contrib/binutils/bfd/dep-in.sed
index ce8b79b..90a2e6a 100644
--- a/contrib/binutils/bfd/dep-in.sed
+++ b/contrib/binutils/bfd/dep-in.sed
@@ -18,6 +18,7 @@ s! config.h!!g
s! \$(INCDIR)/fopen-[^ ]*\.h!!g
s! \$(INCDIR)/ansidecl\.h!!g
s! \$(INCDIR)/symcat\.h!!g
+s! \.\./intl/libintl\.h!!g
s/\\\n */ /g
diff --git a/contrib/binutils/bfd/doc/ChangeLog b/contrib/binutils/bfd/doc/ChangeLog
index 3d1e30a..fc06933 100644
--- a/contrib/binutils/bfd/doc/ChangeLog
+++ b/contrib/binutils/bfd/doc/ChangeLog
@@ -1,550 +1,14 @@
-2002-09-23 Daniel Jacobowitz <drow@mvista.com>
+2004-04-08 Alan Modra <amodra@bigpond.net.au>
- Merge from mainline:
- 2002-08-28 John David Anglin <dave@hiauly1.hia.nrc.ca>
- * chew.c (paramstuff, outputdots, perform, bang and usage): Remove
- void from function definitions.
-
-2002-08-13 Alan Modra <amodra@bigpond.net.au>
-
- * header.sed: Strip tabs.
-
-2002-06-08 Alan Modra <amodra@bigpond.net.au>
-
- * Makefile.am: Fix quote style in last change.
- * Makefile.in: Regenerate.
-
-2002-06-07 Alan Modra <amodra@bigpond.net.au>
-
- * Makefile.am (libbfd.h): Don't use "echo -n".
- (libcoff.h, bfd.h): Likewise.
- * Makefile.in: Regenerate.
-
-2002-06-06 Lars Brinkhoff <lars@nocrew.org>
-
- * bfdint.texi: Change registry@sco.com to registry@caldera.com.
-
-2002-06-05 Alan Modra <amodra@bigpond.net.au>
-
- * Makefile.am (libbfd.h): Add "Extracted from.." comment.
- (libcoff.h, bfd.h): Likewise.
- * Makefile.in: Regenerate.
-
-2002-05-25 Alan Modra <amodra@bigpond.net.au>
-
- * chew.c: Use #include "" instead of <> for local header files.
-
-2002-04-20 Alan Modra <amodra@bigpond.net.au>
-
- * Makefile.in: Regenerate.
-
-2002-02-11 Alan Modra <amodra@bigpond.net.au>
-
- * Makefile.in: Regenerate.
-
-2002-02-01 Alan Modra <amodra@bigpond.net.au>
-
- * chew.c (WORD): Eliminate.
-
-2002-01-31 Ivan Guzvinec <ivang@opencores.org>
-
- * Makefile.in: Regenerate.
-
-2002-01-31 Alan Modra <amodra@bigpond.net.au>
-
- * chew.c (courierize): Don't modify @command params.
-
-2002-01-30 Nick Clifton <nickc@cambridge.redhat.com>
-
- * proto.str (ENUMDOC): Place two spaces between the end of
- the text and the closing comment marker.
-
-2001-10-30 Hans-Peter Nilsson <hp@bitrange.com>
-
- * bfdint.texi (BFD target vector miscellaneous): Add
- bfd_target_mmo_flavour.
- * bfd.texinfo (BFD back ends): Add entry for mmo.
- * Makefile.am (DOCFILES): Add mmo.texi.
- (SRCDOC): Add mmo.c.
- (s-mmo, mmo.texi): New rules.
-
-2001-10-29 Kazu Hirata <kazu@hxi.com>
-
- * bfdsumm.texi: Fix a typo.
-
-2001-10-26 Nick Clifton <nickc@cambridge.redhat.com>
-
- * bfd.texinfo: Change footer to refer to FSF. Change subtitle
- to refer to original creation date.
-
-2002-01-26 Hans-Peter Nilsson <hp@bitrange.com>
-
- * Makefile.am (install): Depend on install-info.
- * Makefile.in: Regenerate.
-
-2001-10-03 Alan Modra <amodra@bigpond.net.au>
-
- * Makefile.am (BFD_H_DEP): Add ../version.h.
- * Makefile.in: Regenerate.
-
-2001-10-02 Alan Modra <amodra@bigpond.net.au>
-
- * Makefile.in: Regenerate.
-
-2001-10-01 Alan Modra <amodra@bigpond.net.au>
-
- * header.sed: New file, adds header to generated files.
- * Makefile.am: Rewrite rules generating libbfd.h, libcoff.h and
- bfd.h, using above. Add missing elf.c dependecy for libbfd.h.
- * Makefile.in: Regenerate.
-
-2001-09-21 Alan Modra <amodra@bigpond.net.au>
-
- * Makefile.in: Regenerate.
-
-2001-09-18 Alan Modra <amodra@bigpond.net.au>
-
- * bfdint.texi: Replace reference to bfd_read with bfd_bread.
- Likewise for bfd_write.
-
-2001-07-24 Alan Modra <amodra@bigpond.net.au>
-
- * Makefile.in: Regenerate.
-
-2001-06-21 Hans-Peter Nilsson <hp@axis.com>
-
- * bfdint.texi (BFD relocation functions) <different formats>:
- Mention that the GNU linker is aware of input-output format
- restrictions when generating relocatable output. Make new
- paragraph for final-link case.
- (BFD target vector swap): Fix typo.
-
-2001-01-25 Kazu Hirata <kazu@hxi.com>
-
- * chew.c: Do not output trailing whitespaces in type and
- functionname. Update copyright.
-
-2001-01-24 Kazu Hirata <kazu@hxi.com>
-
- * chew.c: Do not output a trailing whitespace.
-
-2000-11-06 Nick Clifton <nickc@redhat.com>
-
- * bfd.texinfo: Add GNU Free Documentation License.
-
-2000-07-09 Alan Modra <alan@linuxcare.com.au>
-
- * Makefile.in: Regenerate.
-
-2000-07-08 Alan Modra <alan@linuxcare.com.au>
-
- * chew.c (outputdots): Don't add a space before `/*'.
- (courierize): Likewise.
-
-Wed May 24 12:03:25 2000 Hans-Peter Nilsson <hp@axis.com>
-
- * bfdint.texi (BFD ELF processor required): Add paragraph about
- target necessities for readelf.
-
-2000-04-30 Ben Elliston <bje@redhat.com>
-
- * bfdint.texi (BFD generated files): Fix another typo.
-
-2000-04-17 Ben Elliston <bje@redhat.com>
-
- * bfdint.texi (BFD_JUMP_TABLE macros): Fix typo.
-
-Fri Apr 7 17:54:38 2000 Andrew Cagney <cagney@b1.cygnus.com>
-
- * Makefile.in: Rebuild with current autoconf/automake.
-
-Thu Feb 4 23:21:36 1999 Ian Lance Taylor <ian@cygnus.com>
-
- * Makefile.in: Rebuild with current autoconf/automake.
-
-Thu Jul 23 09:36:44 1998 Nick Clifton <nickc@cygnus.com>
-
- * bfdint.texi (BFD ELF processor required): Add paragraph
- describing the necessity to create "include/elf/CPU.h".
-
-Thu May 7 14:45:43 1998 Ian Lance Taylor <ian@cygnus.com>
-
- * Makefile.am (chew.o): Add -I options for intl srcdir and
- objdir.
- * Makefile.in: Rebuild.
-
-Mon Apr 27 20:19:24 1998 Ian Lance Taylor <ian@cygnus.com>
-
- * bfdint.texi: New file.
- * Makefile.am (noinst_TEXINFOS): New variable.
- * Makefile.in: Rebuild.
-
-Mon Apr 13 16:48:56 1998 Ian Lance Taylor <ian@cygnus.com>
-
- * Makefile.in: Rebuild.
-
-Mon Apr 6 14:06:55 1998 Ian Lance Taylor <ian@cygnus.com>
-
- * Makefile.am (STAGESTUFF): Remove variable.
- (CLEANFILES): Don't remove $(STAGESTUFF).
- (DISTCLEANFILES, MAINTAINERCLEANFILES): New variables.
- * Makefile.in: Rebuild.
-
-Fri Mar 27 16:25:25 1998 Ian Lance Taylor <ian@cygnus.com>
-
- * chew.c (skip_white_and_starts): Remove unused declaration.
- (skip_white_and_stars): Add casts to avoid warnings.
- (skip_trailing_newlines, paramstuff, courierize): Likewise.
- (bulletize, do_fancy_stuff, iscommand): Likewise.
- (kill_bogus_lines, nextword, main): Likewise.
- (manglecomments): Comment out.
- (outputdots, kill_bogus_lines): Remove unused local variables.
- (perform, compile): Likewise.
- (courierize): Fully parenthesize expression.
- (copy_past_newline): Declare return value.
- (print): Change printf format string.
- (main): Call usage for an unrecognized option.
-
-Fri Feb 13 14:37:14 1998 Ian Lance Taylor <ian@cygnus.com>
-
- * Makefile.am (AUTOMAKE_OPTIONS): Define.
- * Makefile.in: Rebuild.
-
-Mon Jan 26 15:38:36 1998 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
-
- * doc.str (bodytext): Don't output @* at the end.
- * chew.c (kill_bogus_lines): Make sure that a period at the
- beginning is recognized.
- (indent): Don't put indentation at the end.
- (copy_past_newline): Expand tabs.
- * Makefile.am (s-reloc, s-syms): Depend on doc.str.
- * Makefile.in: Rebuild.
-
-Wed Oct 1 14:41:28 1997 Ian Lance Taylor <ian@cygnus.com>
-
- * Makefile.am (libbfd.h): Don't use cpu-h8300.c, cpu-i960.c, or
- elfcode.h as input files; they don't contribute anything.
- * Makefile.in: Rebuild.
-
-Fri Aug 15 04:55:15 1997 Doug Evans <dje@canuck.cygnus.com>
-
- * Makefile.am (libbfd.h, libcoff.h): Invoke $(MKDOC) as ./$(MKDOC).
- * Makefile.in: Rebuild.
-
-Fri Aug 1 12:59:58 1997 Ian Lance Taylor <ian@cygnus.com>
-
- * Makefile.am (CC_FOR_BUILD): Don't set explicitly.
- * Makefile.in: Rebuild.
-
-Thu Jul 31 20:00:12 1997 Ian Lance Taylor <ian@cygnus.com>
-
- * Makefile.am: New file, based on old Makefile.in.
- * Makefile.in: Now built with automake.
-
-Tue Jul 22 14:44:00 1997 Robert Hoehne <robert.hoehne@Mathematik.TU-Chemnitz.DE>
-
- * Makefile.in: Change stamp-* files to s-* files. Use bfdt.texi
- rather than bfd.texi.
- (DOCFILES): Change bfd.texi to bfdt.texi.
- * bfd.texinfo: Include bfdt.texi, not bfd.texi.
-
-Mon Jun 16 15:33:15 1997 Ian Lance Taylor <ian@cygnus.com>
-
- * Makefile.in (CC, CFLAGS): Substitute from configure script.
- From Jeff Makey <jeff@cts.com>.
-
-Tue Apr 15 12:37:41 1997 Ian Lance Taylor <ian@cygnus.com>
-
- * Makefile.in (install-info): Use mkinstalldirs to build
- $(infodir).
-
-Tue Apr 8 12:49:46 1997 Ian Lance Taylor <ian@cygnus.com>
-
- * Makefile.in (install-info): Permit info files to be in srcdir.
- (stamp-*): Add a stamp-X target for each X.texi target.
- (*.texi): Just depend upon stamp-X.
- (clean): Remove stamp-*.
- (distclean): Depend upon mostlyclean. Remove stamp-*. Don't
- remove $(DOCFILES).
-
-Mon Apr 7 15:23:26 1997 Ian Lance Taylor <ian@cygnus.com>
-
- * Makefile.in (distclean): Don't remove *.info files.
-
-Thu Feb 13 20:50:02 1997 Klaus Kaempf (kkaempf@progis.de)
-
- * makefile.vms: New file.
-
-Tue Jun 18 18:32:28 1996 Ian Lance Taylor <ian@cygnus.com>
-
- * chew.c (kill_bogus_lines): Reset sl when not at the start of a
- line. From Uwe Ohse <uwe@tirka.gun.de>.
-
-Tue Jan 30 14:10:46 1996 Ian Lance Taylor <ian@cygnus.com>
-
- From Ronald F. Guilmette <rfg@monkeys.com>:
- * Makefile.in (libbfd.h): Depend upon proto.str.
- (libcoff.h, bfd.h): Likewise.
-
-Fri Nov 3 14:46:48 1995 Fred Fish <fnf@cygnus.com>
-
- * Makefile.in (SRCDOC, SRCPROT, core.texi, bfd.h): Use corefile.c,
- renamed from core.c.
-
-Wed Nov 1 14:28:23 1995 Manfred Hollstein KS/EF4A 60/1F/110 #40283 <manfred@lts.sel.alcatel.de>
-
- * chew.c: Include <ctype.h>.
-
-Fri Oct 6 16:23:34 1995 Ken Raeburn <raeburn@cygnus.com>
-
- Mon Sep 25 22:49:32 1995 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
-
- * Makefile.in (Makefile): Only remake this Makefile.
-
-Wed Oct 4 15:51:05 1995 Ken Raeburn <raeburn@cygnus.com>
-
- * chew.c: Include <stdio.h>.
-
-Tue Sep 12 18:14:50 1995 Ian Lance Taylor <ian@cygnus.com>
-
- * Makefile.in (maintainer-clean): New target.
-
-Thu Aug 31 12:18:43 1995 Ian Lance Taylor <ian@cygnus.com>
-
- * Makefile.in (bfd.h): Add additional #endif at end of bfd.h if
- __cplusplus is defined.
-
-Tue Nov 29 16:13:34 1994 Doug Evans <dje@canuck.cygnus.com>
-
- * chew.c (write_buffer): New argument `f', all callers changed.
- (stdout, stderr, print, drop, idrop): New forth words.
- * proto.str (COMMENT): New command.
- * doc.str (COMMENT): Likewise.
-
-Mon Sep 12 11:44:17 1994 Ian Lance Taylor (ian@sanguine.cygnus.com)
-
- * Makefile.in (DOCFILES): Remove ctor.texi.
- (IPROTOS): Remove ctor.ip.
- (SRCIPROT): Remove $(srcdir)/../ctor.c.
- (ctor.texi): Remove target.
- (libbfd.h): Remove dependency on $(srcdir)/../ctor.c. Remove
- $(MKDOC) run on $(srcdir)/../ctor.c.
- * bfd.texinfo (Constructors): Remove section.
-
-Fri Sep 2 13:33:44 1994 Ken Raeburn (raeburn@cujo.cygnus.com)
-
- * chew.c: Include assert.h. Added prototypes for most functions.
- Changed most uses of int to long. Do bounds checking on the
- stacks. Added comment at the beginning documenting most of the
- intrinsics. Lots of whitespace changes. Re-ordered some
- functions.
- (die, check_range, icheck_range): New functions.
- (strip_trailing_newlines, print_stack_level): New functions.
- (translatecomments): Don't insert tab before "/*".
- (iscommand): Minimum command length is now 4.
- (nextword): Handle some \-sequences.
- (push_addr): Deleted.
- (main): Add new intrinsics strip_trailing_newlines and
- print_stack_level. Complain at end if stack contains more than
- one element, or less.
- (remchar): Make sure the string is not empty before chopping off a
- character.
-
- * doc.str, proto.str: Handle new commands SENUM, ENUM, ENUMX,
- ENUMEQ, ENUMEQX, ENUMDOC.
-
-Wed Jan 12 18:37:12 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
-
- * bfd.texinfo: Added Linker Functions node.
- * Makefile.in (DOCFILES): Added linker.texi.
- (SRCDOC): Added linker.c.
- (linker.texi): New target.
-
-Tue Jan 4 10:52:56 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
-
- * chew.c: Don't rely on a correct declaration of exit.
- (chew_exit): New function which just calls exit.
- (main): Use it.
-
-Mon Jan 3 11:40:40 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
-
- * bfd.texinfo: Added Hash Tables node.
- * Makefile.in (DOCFILES): Added hash.texi.
- (SRCDOC): Added hash.c.
- (hash.texi): New target.
-
-Thu Dec 30 16:57:04 1993 Ken Raeburn (raeburn@cujo.cygnus.com)
-
- * Makefile.in: Delete all references to seclet.c, since it's just
- been deleted. Don't mention hash.c, linker.c, or genlink.h yet,
- since they don't contain documentation yet (hint, hint!).
-
-Fri Nov 5 10:58:53 1993 David J. Mackenzie (djm@thepub.cygnus.com)
-
- * bfd.texinfo: Small cleanups.
-
-Fri Nov 19 03:46:11 1993 Ken Raeburn (raeburn@cambridge.cygnus.com)
-
- * Makefile.in (archures.texi): Depends on $(MKDOC).
-
-Tue Aug 10 14:22:39 1993 Ken Raeburn (raeburn@cambridge.cygnus.com)
-
- * bfd.texinfo (BFD back end): Don't include elfcode.texi, since
- it's empty now and that triggers a makeinfo bug.
-
-Mon Aug 9 16:27:30 1993 Ken Raeburn (raeburn@cambridge.cygnus.com)
-
- * bfd.texinfo (BFD back end): New section on ELF, includes
- elf.texi and elfcode.texi.
- * Makefile.in (DOCFILES): Include elf.texi, elfcode.texi.
- (SRCDOC): Include elfcode.h, elf.c.
- (elf.texi, elfcode.texi): New intermediate targets.
-
-Thu Jun 24 13:48:13 1993 David J. Mackenzie (djm@thepub.cygnus.com)
-
- * Makefile.in (.c.o, chew.o): Put CFLAGS last.
- * bfdsumm.texi: New file, broken out of bfd.texinfo, to share
- with ld.texinfo.
-
-Mon Jun 14 12:07:07 1993 david d `zoo' zuhn (zoo at rtl.cygnus.com)
-
- * Makefile.in (install-info): remove parentdir cruft,
-
-Wed Jun 9 16:00:32 1993 Jim Kingdon (kingdon@cygnus.com)
-
- * Makefile.in (mostlyclean): Remove chew.o.
-
-Tue May 25 14:46:58 1993 Ken Raeburn (raeburn@cambridge.cygnus.com)
-
- * Makefile.in (libbfd.h): Use elfcode.h, not elf32.c.
-
-Mon May 24 15:50:07 1993 Ken Raeburn (raeburn@cygnus.com)
-
- * chew.c (compile): Add a couple of missing casts.
-
-Wed May 12 14:45:14 1993 Ian Lance Taylor (ian@cygnus.com)
-
- * Makefile.in (CC_FOR_BUILD): New variable, define to be $(CC).
- (chew.o, $(MKDOC)): Build using CC_FOR_BUILD rather than CC, since
- it must run on the build machine.
-
-Tue Apr 6 22:38:10 1993 John Gilmore (gnu@cygnus.com)
-
- * Makefile.in (chew): Don't compile from .c to executable in a
- single step; it puts a temporary .o filename into the executable,
- which makes multi-stage comparisons fail. Compile chew.c to
- chew.o, and link that, which makes identical executables every time.
-
-Wed Mar 24 17:26:29 1993 david d `zoo' zuhn (zoo at poseidon.cygnus.com)
-
- * Makefile.in: fix typo (bfd.texinfo not bfd.texino)
-
-Fri Mar 19 01:13:00 1993 Ken Raeburn (raeburn@kr-pc.cygnus.com)
-
- * bfd.texinfo: Since BFD version number has been bumped, do same
- to "version number" on title page, and elsewhere. Should be
- fixed to extract real version number.
-
-Tue Mar 16 12:15:13 1993 Per Bothner (bothner@rtl.cygnus.com)
-
- * Makefile.in: Add *clean rules.
-
-Mon Jan 11 18:43:56 1993 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
-
- * Makefile.in (libbfd.h): Removed duplicate init.c and libbfd.c.
- Added seclet.c.
- (bfd.h): Added dependency on bfd.c and seclet.c. Added seclet.c
- to build.
-
-Thu Dec 17 19:35:43 1992 david d `zoo' zuhn (zoo at cirdan.cygnus.com)
-
- * Makefile.in: added dvi target, define and use $(TEXI2DVI)
-
-Thu Dec 3 17:42:48 1992 Ken Raeburn (raeburn@cambridge.cygnus.com)
-
- * Makefile.in (TEXIDIR): New variable.
- (bfd.dvi): Look for bfd.texinfo in $(srcdir). Generate index.
-
- * bfd.texinfo: Minor doc fixes.
-
-Thu Nov 5 03:13:55 1992 John Gilmore (gnu@cygnus.com)
-
- Cleanup: Replace all uses of EXFUN in the BFD sources, with PARAMS.
-
- * chew.c (exfunstuff): Eliminate.
- (paramstuff): Replace exfunstuff with function to generate PARAMS.
- * proto.str: Use paramstuff rather than exfunstuff.
-
-Mon Aug 17 12:40:32 1992 Steve Chamberlain (sac@thepub.cygnus.com)
-
- * chew.c: various patches provided by Howard Chu.
-
-Fri Jun 19 18:59:54 1992 John Gilmore (gnu at cygnus.com)
-
- * Makefile.in (libbfd.h): Add elf.c as a source of prototypes.
-
-Mon May 11 18:55:59 1992 John Gilmore (gnu at cygnus.com)
-
- * chew.c: exit() should be declared by config files, not by
- portable source code. Its type could be int or void function.
-
-Mon May 4 13:45:57 1992 K. Richard Pixley (rich@rtl.cygnus.com)
-
- * Makefile.in: another CFLAGS correction.
-
-Tue Apr 28 10:21:32 1992 K. Richard Pixley (rich@rtl.cygnus.com)
-
- * Makefile.in: Do the CFLAGS thing.
-
-Fri Apr 10 22:34:52 1992 Fred Fish (fnf@cygnus.com)
-
- * Makefile.in (MINUS_G): Add macro and default to -g.
-
-Fri Mar 6 18:53:18 1992 Steve Chamberlain (sac@thepub.cygnus.com)
-
- * chew.c: now has -w switch turn on warnings
-
-Wed Feb 26 18:04:40 1992 K. Richard Pixley (rich@cygnus.com)
-
- * Makefile.in, configure.in: removed traces of namesubdir,
- -subdirs, $(subdir), $(unsubdir), some rcs triggers. Forced
- copyrights to '92, changed some from Cygnus to FSF.
-
-Tue Dec 10 22:11:05 1991 K. Richard Pixley (rich at rtl.cygnus.com)
-
- * Makefile.in: build chew into the current directory. Complete
- the MKDOC macro transition.
-
-Tue Dec 10 08:26:28 1991 Steve Chamberlain (sac at rtl.cygnus.com)
-
- * chew.c: don't core dump when can't open file
- * Makefile.in: get proto.str from the right place when built in
- odd directories
-
-Tue Dec 10 04:07:25 1991 K. Richard Pixley (rich at rtl.cygnus.com)
-
- * Makefile.in: infodir belongs in datadir.
-
-Sat Dec 7 17:01:23 1991 Steve Chamberlain (sac at rtl.cygnus.com)
-
- * chew.c: Much modified
- * proto.str, doc.str: New files for extracting to product
- prototypes and documents respectively.
-
-
-Fri Dec 6 22:57:12 1991 K. Richard Pixley (rich at rtl.cygnus.com)
-
- * Makefile.in: added standards.text support, host/site/target
- inclusion hooks, install using INSTALL_DATA rather than cp,
- don't echo on install.
-
-Thu Dec 5 22:46:17 1991 K. Richard Pixley (rich at rtl.cygnus.com)
-
- * Makefile.in: idestdir and ddestdir go away. Added copyrights
- and shift gpl to v2. Added ChangeLog if it didn't exist. docdir
- and mandir now keyed off datadir by default.
+ Apply from mainline.
+ 2004-03-27 Alan Modra <amodra@bigpond.net.au>
+ * bfdint.texi: Remove all mention of elflink.h.
+For older changes see ChangeLog-9103
Local Variables:
+mode: change-log
+left-margin: 8
+fill-column: 74
version-control: never
End:
diff --git a/contrib/binutils/bfd/doc/ChangeLog-9103 b/contrib/binutils/bfd/doc/ChangeLog-9103
new file mode 100644
index 0000000..3636ed8
--- /dev/null
+++ b/contrib/binutils/bfd/doc/ChangeLog-9103
@@ -0,0 +1,594 @@
+2003-10-15 Andrew Cagney <cagney@redhat.com>
+
+ * bfdint.texi (BFD target vector symbols): Rename _get_symtab to
+ _canonicalize_symtab.
+
+2003-10-08 David Taylor <dtaylor@emc.com>
+
+ * bfd.texinfo: Remove spurious backslash.
+
+2003-07-04 Josh Baratz <baratz@intersystems.com>
+
+ * Makefile.am (MKDOC rule): Add $(CFLAGS) in case it contains
+ CC_FOR_BUILD specific switches.
+ * Makefile.in: Regenerate.
+
+2003-06-29 Alan Modra <amodra@bigpond.net.au>
+
+ * chew.c (paramstuff): Don't emit PARAMS.
+
+2003-02-12 Bob Wilson <bob.wilson@acm.org>
+
+ * bfd.texinfo: Fix quotes for texinfo. Make section title
+ capitalization more consistent. Use @example instead of @lisp.
+ Replace FDL appendix with include of fdl.texi.
+ * fdl.texi: New file.
+
+2002-11-18 Klee Dienes <kdienes@apple.com>
+
+ * Makefile.am (DOCFILES): Add bfdwin.texi, bfdio.texi.
+ (PROTOS): Add bfdio.p, bfdwin.p.
+ (SRCDOC): Add bfdio.c, bfdwin.c.
+ (SRCPROT): Add bfdio.c, bfdwin.c.
+ (SRCIPROT): Add bfdio.c, bfdwin.c.
+ (LIBBFD_H_DEP): Add bfdio.c, bfdwin.c.
+ (BFD_H_DEP): Add bfdio.c, bfdwin.c.
+ Add rules for bfdio.texi, bfdwin.text.
+ * bfd.texinfo: Include bfdio.texi.
+
+2002-10-14 Alan Modra <amodra@bigpond.net.au>
+
+ * Makefile.in: Regenerate.
+
+2002-10-11 Daniel Jacobowitz <drow@mvista.com>
+
+ * Makefile.in: Regenerated.
+
+2002-08-29 John David Anglin <dave@hiauly1.hia.nrc.ca>
+
+ * chew.c (paramstuff, outputdots, perform, bang and usage): Remove
+ void from function definitions.
+
+2002-08-13 Alan Modra <amodra@bigpond.net.au>
+
+ * header.sed: Strip tabs.
+
+2002-06-08 Alan Modra <amodra@bigpond.net.au>
+
+ * Makefile.am: Fix quote style in last change.
+ * Makefile.in: Regenerate.
+
+2002-06-07 Alan Modra <amodra@bigpond.net.au>
+
+ * Makefile.am (libbfd.h): Don't use "echo -n".
+ (libcoff.h, bfd.h): Likewise.
+ * Makefile.in: Regenerate.
+
+2002-06-06 Lars Brinkhoff <lars@nocrew.org>
+
+ * bfdint.texi: Change registry@sco.com to registry@caldera.com.
+
+2002-06-05 Alan Modra <amodra@bigpond.net.au>
+
+ * Makefile.am (libbfd.h): Add "Extracted from.." comment.
+ (libcoff.h, bfd.h): Likewise.
+ * Makefile.in: Regenerate.
+
+2002-05-25 Alan Modra <amodra@bigpond.net.au>
+
+ * chew.c: Use #include "" instead of <> for local header files.
+
+2002-04-20 Alan Modra <amodra@bigpond.net.au>
+
+ * Makefile.in: Regenerate.
+
+2002-02-11 Alan Modra <amodra@bigpond.net.au>
+
+ * Makefile.in: Regenerate.
+
+2002-02-01 Alan Modra <amodra@bigpond.net.au>
+
+ * chew.c (WORD): Eliminate.
+
+2002-01-31 Ivan Guzvinec <ivang@opencores.org>
+
+ * Makefile.in: Regenerate.
+
+2002-01-31 Alan Modra <amodra@bigpond.net.au>
+
+ * chew.c (courierize): Don't modify @command params.
+
+2002-01-30 Nick Clifton <nickc@cambridge.redhat.com>
+
+ * proto.str (ENUMDOC): Place two spaces between the end of
+ the text and the closing comment marker.
+
+2001-10-30 Hans-Peter Nilsson <hp@bitrange.com>
+
+ * bfdint.texi (BFD target vector miscellaneous): Add
+ bfd_target_mmo_flavour.
+ * bfd.texinfo (BFD back ends): Add entry for mmo.
+ * Makefile.am (DOCFILES): Add mmo.texi.
+ (SRCDOC): Add mmo.c.
+ (s-mmo, mmo.texi): New rules.
+
+2001-10-29 Kazu Hirata <kazu@hxi.com>
+
+ * bfdsumm.texi: Fix a typo.
+
+2001-10-26 Nick Clifton <nickc@cambridge.redhat.com>
+
+ * bfd.texinfo: Change footer to refer to FSF. Change subtitle
+ to refer to original creation date.
+
+2002-01-26 Hans-Peter Nilsson <hp@bitrange.com>
+
+ * Makefile.am (install): Depend on install-info.
+ * Makefile.in: Regenerate.
+
+2001-10-03 Alan Modra <amodra@bigpond.net.au>
+
+ * Makefile.am (BFD_H_DEP): Add ../version.h.
+ * Makefile.in: Regenerate.
+
+2001-10-02 Alan Modra <amodra@bigpond.net.au>
+
+ * Makefile.in: Regenerate.
+
+2001-10-01 Alan Modra <amodra@bigpond.net.au>
+
+ * header.sed: New file, adds header to generated files.
+ * Makefile.am: Rewrite rules generating libbfd.h, libcoff.h and
+ bfd.h, using above. Add missing elf.c dependecy for libbfd.h.
+ * Makefile.in: Regenerate.
+
+2001-09-21 Alan Modra <amodra@bigpond.net.au>
+
+ * Makefile.in: Regenerate.
+
+2001-09-18 Alan Modra <amodra@bigpond.net.au>
+
+ * bfdint.texi: Replace reference to bfd_read with bfd_bread.
+ Likewise for bfd_write.
+
+2001-07-24 Alan Modra <amodra@bigpond.net.au>
+
+ * Makefile.in: Regenerate.
+
+2001-06-21 Hans-Peter Nilsson <hp@axis.com>
+
+ * bfdint.texi (BFD relocation functions) <different formats>:
+ Mention that the GNU linker is aware of input-output format
+ restrictions when generating relocatable output. Make new
+ paragraph for final-link case.
+ (BFD target vector swap): Fix typo.
+
+2001-01-25 Kazu Hirata <kazu@hxi.com>
+
+ * chew.c: Do not output trailing whitespaces in type and
+ functionname. Update copyright.
+
+2001-01-24 Kazu Hirata <kazu@hxi.com>
+
+ * chew.c: Do not output a trailing whitespace.
+
+2000-11-06 Nick Clifton <nickc@redhat.com>
+
+ * bfd.texinfo: Add GNU Free Documentation License.
+
+2000-07-09 Alan Modra <alan@linuxcare.com.au>
+
+ * Makefile.in: Regenerate.
+
+2000-07-08 Alan Modra <alan@linuxcare.com.au>
+
+ * chew.c (outputdots): Don't add a space before `/*'.
+ (courierize): Likewise.
+
+Wed May 24 12:03:25 2000 Hans-Peter Nilsson <hp@axis.com>
+
+ * bfdint.texi (BFD ELF processor required): Add paragraph about
+ target necessities for readelf.
+
+2000-04-30 Ben Elliston <bje@redhat.com>
+
+ * bfdint.texi (BFD generated files): Fix another typo.
+
+2000-04-17 Ben Elliston <bje@redhat.com>
+
+ * bfdint.texi (BFD_JUMP_TABLE macros): Fix typo.
+
+2000-04-07 Andrew Cagney <cagney@b1.cygnus.com>
+
+ * Makefile.in: Rebuild with current autoconf/automake.
+
+1999-02-04 Ian Lance Taylor <ian@cygnus.com>
+
+ * Makefile.in: Rebuild with current autoconf/automake.
+
+1998-07-23 Nick Clifton <nickc@cygnus.com>
+
+ * bfdint.texi (BFD ELF processor required): Add paragraph
+ describing the necessity to create "include/elf/CPU.h".
+
+1998-05-07 Ian Lance Taylor <ian@cygnus.com>
+
+ * Makefile.am (chew.o): Add -I options for intl srcdir and
+ objdir.
+ * Makefile.in: Rebuild.
+
+1998-04-27 Ian Lance Taylor <ian@cygnus.com>
+
+ * bfdint.texi: New file.
+ * Makefile.am (noinst_TEXINFOS): New variable.
+ * Makefile.in: Rebuild.
+
+1998-04-13 Ian Lance Taylor <ian@cygnus.com>
+
+ * Makefile.in: Rebuild.
+
+1998-04-06 Ian Lance Taylor <ian@cygnus.com>
+
+ * Makefile.am (STAGESTUFF): Remove variable.
+ (CLEANFILES): Don't remove $(STAGESTUFF).
+ (DISTCLEANFILES, MAINTAINERCLEANFILES): New variables.
+ * Makefile.in: Rebuild.
+
+1998-03-27 Ian Lance Taylor <ian@cygnus.com>
+
+ * chew.c (skip_white_and_starts): Remove unused declaration.
+ (skip_white_and_stars): Add casts to avoid warnings.
+ (skip_trailing_newlines, paramstuff, courierize): Likewise.
+ (bulletize, do_fancy_stuff, iscommand): Likewise.
+ (kill_bogus_lines, nextword, main): Likewise.
+ (manglecomments): Comment out.
+ (outputdots, kill_bogus_lines): Remove unused local variables.
+ (perform, compile): Likewise.
+ (courierize): Fully parenthesize expression.
+ (copy_past_newline): Declare return value.
+ (print): Change printf format string.
+ (main): Call usage for an unrecognized option.
+
+1998-02-13 Ian Lance Taylor <ian@cygnus.com>
+
+ * Makefile.am (AUTOMAKE_OPTIONS): Define.
+ * Makefile.in: Rebuild.
+
+1998-01-26 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
+
+ * doc.str (bodytext): Don't output @* at the end.
+ * chew.c (kill_bogus_lines): Make sure that a period at the
+ beginning is recognized.
+ (indent): Don't put indentation at the end.
+ (copy_past_newline): Expand tabs.
+ * Makefile.am (s-reloc, s-syms): Depend on doc.str.
+ * Makefile.in: Rebuild.
+
+1997-10-01 Ian Lance Taylor <ian@cygnus.com>
+
+ * Makefile.am (libbfd.h): Don't use cpu-h8300.c, cpu-i960.c, or
+ elfcode.h as input files; they don't contribute anything.
+ * Makefile.in: Rebuild.
+
+1997-08-15 Doug Evans <dje@canuck.cygnus.com>
+
+ * Makefile.am (libbfd.h, libcoff.h): Invoke $(MKDOC) as ./$(MKDOC).
+ * Makefile.in: Rebuild.
+
+1997-08-01 Ian Lance Taylor <ian@cygnus.com>
+
+ * Makefile.am (CC_FOR_BUILD): Don't set explicitly.
+ * Makefile.in: Rebuild.
+
+1997-07-31 Ian Lance Taylor <ian@cygnus.com>
+
+ * Makefile.am: New file, based on old Makefile.in.
+ * Makefile.in: Now built with automake.
+
+1997-07-22 Robert Hoehne <robert.hoehne@Mathematik.TU-Chemnitz.DE>
+
+ * Makefile.in: Change stamp-* files to s-* files. Use bfdt.texi
+ rather than bfd.texi.
+ (DOCFILES): Change bfd.texi to bfdt.texi.
+ * bfd.texinfo: Include bfdt.texi, not bfd.texi.
+
+1997-06-16 Ian Lance Taylor <ian@cygnus.com>
+
+ * Makefile.in (CC, CFLAGS): Substitute from configure script.
+ From Jeff Makey <jeff@cts.com>.
+
+1997-04-15 Ian Lance Taylor <ian@cygnus.com>
+
+ * Makefile.in (install-info): Use mkinstalldirs to build
+ $(infodir).
+
+1997-04-08 Ian Lance Taylor <ian@cygnus.com>
+
+ * Makefile.in (install-info): Permit info files to be in srcdir.
+ (stamp-*): Add a stamp-X target for each X.texi target.
+ (*.texi): Just depend upon stamp-X.
+ (clean): Remove stamp-*.
+ (distclean): Depend upon mostlyclean. Remove stamp-*. Don't
+ remove $(DOCFILES).
+
+1997-04-07 Ian Lance Taylor <ian@cygnus.com>
+
+ * Makefile.in (distclean): Don't remove *.info files.
+
+1997-02-13 Klaus Kaempf (kkaempf@progis.de)
+
+ * makefile.vms: New file.
+
+1996-06-18 Ian Lance Taylor <ian@cygnus.com>
+
+ * chew.c (kill_bogus_lines): Reset sl when not at the start of a
+ line. From Uwe Ohse <uwe@tirka.gun.de>.
+
+1996-01-30 Ian Lance Taylor <ian@cygnus.com>
+
+ From Ronald F. Guilmette <rfg@monkeys.com>:
+ * Makefile.in (libbfd.h): Depend upon proto.str.
+ (libcoff.h, bfd.h): Likewise.
+
+1995-11-03 Fred Fish <fnf@cygnus.com>
+
+ * Makefile.in (SRCDOC, SRCPROT, core.texi, bfd.h): Use corefile.c,
+ renamed from core.c.
+
+1995-11-01 Manfred Hollstein KS/EF4A 60/1F/110 #40283 <manfred@lts.sel.alcatel.de>
+
+ * chew.c: Include <ctype.h>.
+
+1995-10-06 Ken Raeburn <raeburn@cygnus.com>
+
+ Mon Sep 25 22:49:32 1995 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
+
+ * Makefile.in (Makefile): Only remake this Makefile.
+
+1995-10-04 Ken Raeburn <raeburn@cygnus.com>
+
+ * chew.c: Include <stdio.h>.
+
+1995-09-12 Ian Lance Taylor <ian@cygnus.com>
+
+ * Makefile.in (maintainer-clean): New target.
+
+1995-08-31 Ian Lance Taylor <ian@cygnus.com>
+
+ * Makefile.in (bfd.h): Add additional #endif at end of bfd.h if
+ __cplusplus is defined.
+
+1994-11-29 Doug Evans <dje@canuck.cygnus.com>
+
+ * chew.c (write_buffer): New argument `f', all callers changed.
+ (stdout, stderr, print, drop, idrop): New forth words.
+ * proto.str (COMMENT): New command.
+ * doc.str (COMMENT): Likewise.
+
+1994-09-12 Ian Lance Taylor (ian@sanguine.cygnus.com)
+
+ * Makefile.in (DOCFILES): Remove ctor.texi.
+ (IPROTOS): Remove ctor.ip.
+ (SRCIPROT): Remove $(srcdir)/../ctor.c.
+ (ctor.texi): Remove target.
+ (libbfd.h): Remove dependency on $(srcdir)/../ctor.c. Remove
+ $(MKDOC) run on $(srcdir)/../ctor.c.
+ * bfd.texinfo (Constructors): Remove section.
+
+1994-09-02 Ken Raeburn (raeburn@cujo.cygnus.com)
+
+ * chew.c: Include assert.h. Added prototypes for most functions.
+ Changed most uses of int to long. Do bounds checking on the
+ stacks. Added comment at the beginning documenting most of the
+ intrinsics. Lots of whitespace changes. Re-ordered some
+ functions.
+ (die, check_range, icheck_range): New functions.
+ (strip_trailing_newlines, print_stack_level): New functions.
+ (translatecomments): Don't insert tab before "/*".
+ (iscommand): Minimum command length is now 4.
+ (nextword): Handle some \-sequences.
+ (push_addr): Deleted.
+ (main): Add new intrinsics strip_trailing_newlines and
+ print_stack_level. Complain at end if stack contains more than
+ one element, or less.
+ (remchar): Make sure the string is not empty before chopping off a
+ character.
+
+ * doc.str, proto.str: Handle new commands SENUM, ENUM, ENUMX,
+ ENUMEQ, ENUMEQX, ENUMDOC.
+
+1994-01-12 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
+
+ * bfd.texinfo: Added Linker Functions node.
+ * Makefile.in (DOCFILES): Added linker.texi.
+ (SRCDOC): Added linker.c.
+ (linker.texi): New target.
+
+1994-01-04 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
+
+ * chew.c: Don't rely on a correct declaration of exit.
+ (chew_exit): New function which just calls exit.
+ (main): Use it.
+
+1994-01-03 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
+
+ * bfd.texinfo: Added Hash Tables node.
+ * Makefile.in (DOCFILES): Added hash.texi.
+ (SRCDOC): Added hash.c.
+ (hash.texi): New target.
+
+1993-12-30 Ken Raeburn (raeburn@cujo.cygnus.com)
+
+ * Makefile.in: Delete all references to seclet.c, since it's just
+ been deleted. Don't mention hash.c, linker.c, or genlink.h yet,
+ since they don't contain documentation yet (hint, hint!).
+
+1993-11-05 David J. Mackenzie (djm@thepub.cygnus.com)
+
+ * bfd.texinfo: Small cleanups.
+
+1993-11-19 Ken Raeburn (raeburn@cambridge.cygnus.com)
+
+ * Makefile.in (archures.texi): Depends on $(MKDOC).
+
+1993-08-10 Ken Raeburn (raeburn@cambridge.cygnus.com)
+
+ * bfd.texinfo (BFD back end): Don't include elfcode.texi, since
+ it's empty now and that triggers a makeinfo bug.
+
+1993-08-09 Ken Raeburn (raeburn@cambridge.cygnus.com)
+
+ * bfd.texinfo (BFD back end): New section on ELF, includes
+ elf.texi and elfcode.texi.
+ * Makefile.in (DOCFILES): Include elf.texi, elfcode.texi.
+ (SRCDOC): Include elfcode.h, elf.c.
+ (elf.texi, elfcode.texi): New intermediate targets.
+
+1993-06-24 David J. Mackenzie (djm@thepub.cygnus.com)
+
+ * Makefile.in (.c.o, chew.o): Put CFLAGS last.
+ * bfdsumm.texi: New file, broken out of bfd.texinfo, to share
+ with ld.texinfo.
+
+1993-06-14 david d `zoo' zuhn (zoo at rtl.cygnus.com)
+
+ * Makefile.in (install-info): remove parentdir cruft,
+
+1993-06-09 Jim Kingdon (kingdon@cygnus.com)
+
+ * Makefile.in (mostlyclean): Remove chew.o.
+
+1993-05-25 Ken Raeburn (raeburn@cambridge.cygnus.com)
+
+ * Makefile.in (libbfd.h): Use elfcode.h, not elf32.c.
+
+1993-05-24 Ken Raeburn (raeburn@cygnus.com)
+
+ * chew.c (compile): Add a couple of missing casts.
+
+1993-05-12 Ian Lance Taylor (ian@cygnus.com)
+
+ * Makefile.in (CC_FOR_BUILD): New variable, define to be $(CC).
+ (chew.o, $(MKDOC)): Build using CC_FOR_BUILD rather than CC, since
+ it must run on the build machine.
+
+1993-04-07 John Gilmore (gnu@cygnus.com)
+
+ * Makefile.in (chew): Don't compile from .c to executable in a
+ single step; it puts a temporary .o filename into the executable,
+ which makes multi-stage comparisons fail. Compile chew.c to
+ chew.o, and link that, which makes identical executables every time.
+
+1993-03-24 david d `zoo' zuhn (zoo at poseidon.cygnus.com)
+
+ * Makefile.in: fix typo (bfd.texinfo not bfd.texino)
+
+1993-03-19 Ken Raeburn (raeburn@kr-pc.cygnus.com)
+
+ * bfd.texinfo: Since BFD version number has been bumped, do same
+ to "version number" on title page, and elsewhere. Should be
+ fixed to extract real version number.
+
+1993-03-16 Per Bothner (bothner@rtl.cygnus.com)
+
+ * Makefile.in: Add *clean rules.
+
+1993-01-11 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
+
+ * Makefile.in (libbfd.h): Removed duplicate init.c and libbfd.c.
+ Added seclet.c.
+ (bfd.h): Added dependency on bfd.c and seclet.c. Added seclet.c
+ to build.
+
+1992-12-17 david d `zoo' zuhn (zoo at cirdan.cygnus.com)
+
+ * Makefile.in: added dvi target, define and use $(TEXI2DVI)
+
+1992-12-03 Ken Raeburn (raeburn@cambridge.cygnus.com)
+
+ * Makefile.in (TEXIDIR): New variable.
+ (bfd.dvi): Look for bfd.texinfo in $(srcdir). Generate index.
+
+ * bfd.texinfo: Minor doc fixes.
+
+1992-11-05 John Gilmore (gnu@cygnus.com)
+
+ Cleanup: Replace all uses of EXFUN in the BFD sources, with PARAMS.
+
+ * chew.c (exfunstuff): Eliminate.
+ (paramstuff): Replace exfunstuff with function to generate PARAMS.
+ * proto.str: Use paramstuff rather than exfunstuff.
+
+1992-08-17 Steve Chamberlain (sac@thepub.cygnus.com)
+
+ * chew.c: various patches provided by Howard Chu.
+
+1992-06-19 John Gilmore (gnu at cygnus.com)
+
+ * Makefile.in (libbfd.h): Add elf.c as a source of prototypes.
+
+1992-05-11 John Gilmore (gnu at cygnus.com)
+
+ * chew.c: exit() should be declared by config files, not by
+ portable source code. Its type could be int or void function.
+
+1992-05-04 K. Richard Pixley (rich@rtl.cygnus.com)
+
+ * Makefile.in: another CFLAGS correction.
+
+1992-04-28 K. Richard Pixley (rich@rtl.cygnus.com)
+
+ * Makefile.in: Do the CFLAGS thing.
+
+1992-04-11 Fred Fish (fnf@cygnus.com)
+
+ * Makefile.in (MINUS_G): Add macro and default to -g.
+
+1992-03-06 Steve Chamberlain (sac@thepub.cygnus.com)
+
+ * chew.c: now has -w switch turn on warnings
+
+1992-02-26 K. Richard Pixley (rich@cygnus.com)
+
+ * Makefile.in, configure.in: removed traces of namesubdir,
+ -subdirs, $(subdir), $(unsubdir), some rcs triggers. Forced
+ copyrights to '92, changed some from Cygnus to FSF.
+
+1991-12-10 K. Richard Pixley (rich at rtl.cygnus.com)
+
+ * Makefile.in: build chew into the current directory. Complete
+ the MKDOC macro transition.
+
+1991-12-10 Steve Chamberlain (sac at rtl.cygnus.com)
+
+ * chew.c: don't core dump when can't open file
+ * Makefile.in: get proto.str from the right place when built in
+ odd directories
+
+1991-12-10 K. Richard Pixley (rich at rtl.cygnus.com)
+
+ * Makefile.in: infodir belongs in datadir.
+
+1991-12-07 Steve Chamberlain (sac at rtl.cygnus.com)
+
+ * chew.c: Much modified
+ * proto.str, doc.str: New files for extracting to product
+ prototypes and documents respectively.
+
+
+1991-12-06 K. Richard Pixley (rich at rtl.cygnus.com)
+
+ * Makefile.in: added standards.text support, host/site/target
+ inclusion hooks, install using INSTALL_DATA rather than cp,
+ don't echo on install.
+
+1991-12-05 K. Richard Pixley (rich at rtl.cygnus.com)
+
+ * Makefile.in: idestdir and ddestdir go away. Added copyrights
+ and shift gpl to v2. Added ChangeLog if it didn't exist. docdir
+ and mandir now keyed off datadir by default.
+
+
+Local Variables:
+version-control: never
+End:
diff --git a/contrib/binutils/bfd/doc/Makefile.am b/contrib/binutils/bfd/doc/Makefile.am
index 0787143..4aaa341 100644
--- a/contrib/binutils/bfd/doc/Makefile.am
+++ b/contrib/binutils/bfd/doc/Makefile.am
@@ -4,13 +4,15 @@ AUTOMAKE_OPTIONS = cygnus
DOCFILES = aoutx.texi archive.texi archures.texi \
bfdt.texi cache.texi coffcode.texi \
- core.texi elf.texi elfcode.texi format.texi libbfd.texi \
+ core.texi elf.texi elfcode.texi format.texi \
+ libbfd.texi bfdwin.texi bfdio.texi \
opncls.texi reloc.texi section.texi \
syms.texi targets.texi init.texi hash.texi linker.texi \
mmo.texi
PROTOS = archive.p archures.p bfd.p \
core.p format.p \
+ bfdio.p bfdwin.p \
libbfd.p opncls.p reloc.p \
section.p syms.p targets.p \
format.p core.p init.p
@@ -22,6 +24,7 @@ IPROTOS = cache.ip libbfd.ip reloc.ip init.ip archures.ip coffcode.ip
# you don't need these three:
SRCDOC = $(srcdir)/../aoutx.h $(srcdir)/../archive.c \
$(srcdir)/../archures.c $(srcdir)/../bfd.c \
+ $(srcdir)/../bfdio.c $(srcdir)/../bfdwin.c \
$(srcdir)/../cache.c $(srcdir)/../coffcode.h \
$(srcdir)/../corefile.c $(srcdir)/../elf.c \
$(srcdir)/../elfcode.h $(srcdir)/../format.c \
@@ -34,11 +37,13 @@ SRCDOC = $(srcdir)/../aoutx.h $(srcdir)/../archive.c \
SRCPROT = $(srcdir)/../archive.c $(srcdir)/../archures.c \
$(srcdir)/../bfd.c $(srcdir)/../coffcode.h $(srcdir)/../corefile.c \
$(srcdir)/../format.c $(srcdir)/../libbfd.c \
+ $(srcdir)/../bfdio.c $(srcdir)/../bfdwin.c \
$(srcdir)/../opncls.c $(srcdir)/../reloc.c \
$(srcdir)/../section.c $(srcdir)/../syms.c \
$(srcdir)/../targets.c $(srcdir)/../init.c
SRCIPROT = $(srcdir)/../cache.c $(srcdir)/../libbfd.c \
+ $(srcdir)/../bfdio.c $(srcdir)/../bfdwin.c \
$(srcdir)/../reloc.c $(srcdir)/../cpu-h8300.c \
$(srcdir)/../cpu-i960.c $(srcdir)/../archures.c \
$(srcdir)/../init.c
@@ -50,7 +55,7 @@ info_TEXINFOS = bfd.texinfo
MKDOC = chew$(EXEEXT_FOR_BUILD)
$(MKDOC): chew.o
- $(CC_FOR_BUILD) -o $(MKDOC) chew.o $(LOADLIBES) $(LDFLAGS)
+ $(CC_FOR_BUILD) -o $(MKDOC) chew.o $(CFLAGS) $(LOADLIBES) $(LDFLAGS)
chew.o: chew.c
$(CC_FOR_BUILD) -c -I.. -I$(srcdir)/.. -I$(srcdir)/../../include -I$(srcdir)/../../intl -I../../intl $(H_CFLAGS) $(CFLAGS) $(srcdir)/chew.c
@@ -143,6 +148,18 @@ s-libbfd: $(MKDOC) $(srcdir)/../libbfd.c $(srcdir)/doc.str
touch s-libbfd
libbfd.texi: s-libbfd
+s-bfdio: $(MKDOC) $(srcdir)/../bfdio.c $(srcdir)/doc.str
+ ./$(MKDOC) -f $(srcdir)/doc.str < $(srcdir)/../bfdio.c >bfdio.tmp
+ $(srcdir)/../../move-if-change bfdio.tmp bfdio.texi
+ touch s-bfdio
+bfdio.texi: s-bfdio
+
+s-bfdwin: $(MKDOC) $(srcdir)/../bfdwin.c $(srcdir)/doc.str
+ ./$(MKDOC) -f $(srcdir)/doc.str < $(srcdir)/../bfdwin.c >bfdwin.tmp
+ $(srcdir)/../../move-if-change bfdwin.tmp bfdwin.texi
+ touch s-bfdwin
+bfdwin.texi: s-bfdwin
+
s-opncls: $(MKDOC) $(srcdir)/../opncls.c $(srcdir)/doc.str
./$(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../opncls.c >opncls.tmp
$(srcdir)/../../move-if-change opncls.tmp opncls.texi
@@ -195,6 +212,8 @@ LIBBFD_H_DEP = \
$(srcdir)/../libbfd-in.h \
$(srcdir)/../init.c \
$(srcdir)/../libbfd.c \
+ $(srcdir)/../bfdio.c \
+ $(srcdir)/../bfdwin.c \
$(srcdir)/../cache.c \
$(srcdir)/../reloc.c \
$(srcdir)/../archures.c \
@@ -239,6 +258,8 @@ BFD_H_DEP = \
$(srcdir)/../init.c \
$(srcdir)/../opncls.c \
$(srcdir)/../libbfd.c \
+ $(srcdir)/../bfdio.c \
+ $(srcdir)/../bfdwin.c \
$(srcdir)/../section.c \
$(srcdir)/../archures.c \
$(srcdir)/../reloc.c \
@@ -248,6 +269,8 @@ BFD_H_DEP = \
$(srcdir)/../corefile.c \
$(srcdir)/../targets.c \
$(srcdir)/../format.c \
+ $(srcdir)/../linker.c \
+ $(srcdir)/../simple.c \
$(srcdir)/header.sed \
$(srcdir)/proto.str \
$(srcdir)/../version.h \
diff --git a/contrib/binutils/bfd/doc/Makefile.in b/contrib/binutils/bfd/doc/Makefile.in
index f35cc9a..85d6427 100644
--- a/contrib/binutils/bfd/doc/Makefile.in
+++ b/contrib/binutils/bfd/doc/Makefile.in
@@ -1,6 +1,6 @@
-# Makefile.in generated automatically by automake 1.4 from Makefile.am
+# Makefile.in generated automatically by automake 1.4-p6 from Makefile.am
-# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
+# Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
@@ -68,6 +68,7 @@ AS = @AS@
BFD_HOST_64BIT_LONG = @BFD_HOST_64BIT_LONG@
BFD_HOST_64_BIT = @BFD_HOST_64_BIT@
BFD_HOST_64_BIT_DEFINED = @BFD_HOST_64_BIT_DEFINED@
+BFD_HOST_LONG_LONG = @BFD_HOST_LONG_LONG@
BFD_HOST_U_64_BIT = @BFD_HOST_U_64_BIT@
CATALOGS = @CATALOGS@
CATOBJEXT = @CATOBJEXT@
@@ -116,10 +117,11 @@ WIN32LIBADD = @WIN32LIBADD@
all_backends = @all_backends@
bfd_backends = @bfd_backends@
bfd_default_target_size = @bfd_default_target_size@
+bfd_file_ptr = @bfd_file_ptr@
bfd_libs = @bfd_libs@
bfd_machines = @bfd_machines@
+bfd_ufile_ptr = @bfd_ufile_ptr@
bfd_version = @bfd_version@
-bfd_version_date = @bfd_version_date@
bfd_version_string = @bfd_version_string@
bfdincludedir = @bfdincludedir@
bfdlibdir = @bfdlibdir@
@@ -131,7 +133,8 @@ AUTOMAKE_OPTIONS = cygnus
DOCFILES = aoutx.texi archive.texi archures.texi \
bfdt.texi cache.texi coffcode.texi \
- core.texi elf.texi elfcode.texi format.texi libbfd.texi \
+ 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
@@ -139,6 +142,7 @@ DOCFILES = aoutx.texi archive.texi archures.texi \
PROTOS = archive.p archures.p bfd.p \
core.p format.p \
+ bfdio.p bfdwin.p \
libbfd.p opncls.p reloc.p \
section.p syms.p targets.p \
format.p core.p init.p
@@ -151,6 +155,7 @@ IPROTOS = cache.ip libbfd.ip reloc.ip init.ip archures.ip coffcode.ip
# you don't need these three:
SRCDOC = $(srcdir)/../aoutx.h $(srcdir)/../archive.c \
$(srcdir)/../archures.c $(srcdir)/../bfd.c \
+ $(srcdir)/../bfdio.c $(srcdir)/../bfdwin.c \
$(srcdir)/../cache.c $(srcdir)/../coffcode.h \
$(srcdir)/../corefile.c $(srcdir)/../elf.c \
$(srcdir)/../elfcode.h $(srcdir)/../format.c \
@@ -164,12 +169,14 @@ SRCDOC = $(srcdir)/../aoutx.h $(srcdir)/../archive.c \
SRCPROT = $(srcdir)/../archive.c $(srcdir)/../archures.c \
$(srcdir)/../bfd.c $(srcdir)/../coffcode.h $(srcdir)/../corefile.c \
$(srcdir)/../format.c $(srcdir)/../libbfd.c \
+ $(srcdir)/../bfdio.c $(srcdir)/../bfdwin.c \
$(srcdir)/../opncls.c $(srcdir)/../reloc.c \
$(srcdir)/../section.c $(srcdir)/../syms.c \
$(srcdir)/../targets.c $(srcdir)/../init.c
SRCIPROT = $(srcdir)/../cache.c $(srcdir)/../libbfd.c \
+ $(srcdir)/../bfdio.c $(srcdir)/../bfdwin.c \
$(srcdir)/../reloc.c $(srcdir)/../cpu-h8300.c \
$(srcdir)/../cpu-i960.c $(srcdir)/../archures.c \
$(srcdir)/../init.c
@@ -185,6 +192,8 @@ LIBBFD_H_DEP = \
$(srcdir)/../libbfd-in.h \
$(srcdir)/../init.c \
$(srcdir)/../libbfd.c \
+ $(srcdir)/../bfdio.c \
+ $(srcdir)/../bfdwin.c \
$(srcdir)/../cache.c \
$(srcdir)/../reloc.c \
$(srcdir)/../archures.c \
@@ -207,6 +216,8 @@ BFD_H_DEP = \
$(srcdir)/../init.c \
$(srcdir)/../opncls.c \
$(srcdir)/../libbfd.c \
+ $(srcdir)/../bfdio.c \
+ $(srcdir)/../bfdwin.c \
$(srcdir)/../section.c \
$(srcdir)/../archures.c \
$(srcdir)/../reloc.c \
@@ -216,6 +227,8 @@ BFD_H_DEP = \
$(srcdir)/../corefile.c \
$(srcdir)/../targets.c \
$(srcdir)/../format.c \
+ $(srcdir)/../linker.c \
+ $(srcdir)/../simple.c \
$(srcdir)/header.sed \
$(srcdir)/proto.str \
$(srcdir)/../version.h \
@@ -330,7 +343,7 @@ uninstall-info:
else ii=; fi; \
list='$(INFO_DEPS)'; \
for file in $$list; do \
- test -z "$ii" \
+ test -z "$$ii" \
|| install-info --info-dir=$(DESTDIR)$(infodir) --remove $$file; \
done
@$(NORMAL_UNINSTALL)
@@ -459,7 +472,7 @@ mostlyclean distclean maintainer-clean
$(MKDOC): chew.o
- $(CC_FOR_BUILD) -o $(MKDOC) chew.o $(LOADLIBES) $(LDFLAGS)
+ $(CC_FOR_BUILD) -o $(MKDOC) chew.o $(CFLAGS) $(LOADLIBES) $(LDFLAGS)
chew.o: chew.c
$(CC_FOR_BUILD) -c -I.. -I$(srcdir)/.. -I$(srcdir)/../../include -I$(srcdir)/../../intl -I../../intl $(H_CFLAGS) $(CFLAGS) $(srcdir)/chew.c
@@ -552,6 +565,18 @@ s-libbfd: $(MKDOC) $(srcdir)/../libbfd.c $(srcdir)/doc.str
touch s-libbfd
libbfd.texi: s-libbfd
+s-bfdio: $(MKDOC) $(srcdir)/../bfdio.c $(srcdir)/doc.str
+ ./$(MKDOC) -f $(srcdir)/doc.str < $(srcdir)/../bfdio.c >bfdio.tmp
+ $(srcdir)/../../move-if-change bfdio.tmp bfdio.texi
+ touch s-bfdio
+bfdio.texi: s-bfdio
+
+s-bfdwin: $(MKDOC) $(srcdir)/../bfdwin.c $(srcdir)/doc.str
+ ./$(MKDOC) -f $(srcdir)/doc.str < $(srcdir)/../bfdwin.c >bfdwin.tmp
+ $(srcdir)/../../move-if-change bfdwin.tmp bfdwin.texi
+ touch s-bfdwin
+bfdwin.texi: s-bfdwin
+
s-opncls: $(MKDOC) $(srcdir)/../opncls.c $(srcdir)/doc.str
./$(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../opncls.c >opncls.tmp
$(srcdir)/../../move-if-change opncls.tmp opncls.texi
diff --git a/contrib/binutils/bfd/doc/aoutx.texi b/contrib/binutils/bfd/doc/aoutx.texi
index d99fd05..0c4167b 100644
--- a/contrib/binutils/bfd/doc/aoutx.texi
+++ b/contrib/binutils/bfd/doc/aoutx.texi
@@ -161,7 +161,7 @@ handle any last-minute setup.
@subsubsection @code{aout_@var{size}_mkobject}
@strong{Synopsis}
@example
-boolean aout_@var{size}_mkobject, (bfd *abfd);
+bfd_boolean aout_@var{size}_mkobject, (bfd *abfd);
@end example
@strong{Description}@*
Initialize BFD @var{abfd} for use with a.out files.
@@ -187,7 +187,7 @@ is always understood.
@subsubsection @code{aout_@var{size}_set_arch_mach}
@strong{Synopsis}
@example
-boolean aout_@var{size}_set_arch_mach,
+bfd_boolean aout_@var{size}_set_arch_mach,
(bfd *,
enum bfd_architecture arch,
unsigned long machine));
@@ -201,7 +201,7 @@ can support the architecture required.
@subsubsection @code{aout_@var{size}_new_section_hook}
@strong{Synopsis}
@example
-boolean aout_@var{size}_new_section_hook,
+bfd_boolean aout_@var{size}_new_section_hook,
(bfd *abfd,
asection *newsect));
@end example
diff --git a/contrib/binutils/bfd/doc/archive.texi b/contrib/binutils/bfd/doc/archive.texi
index 7e91a16..e20906a 100644
--- a/contrib/binutils/bfd/doc/archive.texi
+++ b/contrib/binutils/bfd/doc/archive.texi
@@ -54,7 +54,8 @@ Archives are supported in BFD in @code{archive.c}.
@subsubsection @code{bfd_get_next_mapent}
@strong{Synopsis}
@example
-symindex bfd_get_next_mapent(bfd *abfd, symindex previous, carsym **sym);
+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
@@ -73,7 +74,7 @@ user-visible element is its name, a null-terminated string.
@subsubsection @code{bfd_set_archive_head}
@strong{Synopsis}
@example
-boolean bfd_set_archive_head(bfd *output, bfd *new_head);
+bfd_boolean bfd_set_archive_head (bfd *output, bfd *new_head);
@end example
@strong{Description}@*
Set the head of the chain of
@@ -83,7 +84,7 @@ BFDs contained in the archive @var{output} to @var{new_head}.
@subsubsection @code{bfd_openr_next_archived_file}
@strong{Synopsis}
@example
-bfd *bfd_openr_next_archived_file(bfd *archive, bfd *previous);
+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
diff --git a/contrib/binutils/bfd/doc/archures.texi b/contrib/binutils/bfd/doc/archures.texi
index 0faf97d..06ee6d3 100644
--- a/contrib/binutils/bfd/doc/archures.texi
+++ b/contrib/binutils/bfd/doc/archures.texi
@@ -50,6 +50,7 @@ enum bfd_architecture
#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.
@@ -95,12 +96,16 @@ enum bfd_architecture
#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
@@ -108,13 +113,15 @@ enum bfd_architecture
#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 0
-#define bfd_mach_i386_i8086 1
-#define bfd_mach_i386_i386_intel_syntax 2
-#define bfd_mach_x86_64 3
-#define bfd_mach_x86_64_intel_syntax 4
+#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 */
@@ -123,15 +130,20 @@ enum bfd_architecture
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, /* Hitachi H8/300 */
-#define bfd_mach_h8300 1
-#define bfd_mach_h8300h 2
-#define bfd_mach_h8300s 3
+ 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 0
-#define bfd_mach_ppc64 1
+#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
@@ -148,38 +160,52 @@ enum bfd_architecture
#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 0
+#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 0
+#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, /* Hitachi H8/500 */
- bfd_arch_sh, /* Hitachi SH */
-#define bfd_mach_sh 0
+ 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
@@ -190,40 +216,54 @@ enum bfd_architecture
#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 0
+#define bfd_mach_v850 1
#define bfd_mach_v850e 'E'
-#define bfd_mach_v850ea 'A'
+#define bfd_mach_v850e1 '1'
bfd_arch_arc, /* ARC Cores */
-#define bfd_mach_arc_5 0
-#define bfd_mach_arc_6 1
-#define bfd_mach_arc_7 2
-#define bfd_mach_arc_8 3
- bfd_arch_m32r, /* Mitsubishi M32R/D */
-#define bfd_mach_m32r 0 /* For backwards compatibility. */
+#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 0
-#define bfd_mach_frvsimple 1
+#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 0
-#define bfd_mach_ia64_elf32 1
+#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
@@ -233,12 +273,29 @@ enum bfd_architecture
#define bfd_mach_avr5 5
bfd_arch_cris, /* Axis CRIS */
bfd_arch_s390, /* IBM s390 */
-#define bfd_mach_s390_31 0
-#define bfd_mach_s390_64 1
+#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 0
+#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
@@ -261,15 +318,14 @@ typedef struct bfd_arch_info
const char *arch_name;
const char *printable_name;
unsigned int section_align_power;
- /* True if this is the default machine for the architecture.
+ /* 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}. */
- boolean the_default;
+ bfd_boolean the_default;
const struct bfd_arch_info * (*compatible)
- PARAMS ((const struct bfd_arch_info *a,
- const struct bfd_arch_info *b));
+ (const struct bfd_arch_info *a, const struct bfd_arch_info *b);
- boolean (*scan) PARAMS ((const struct bfd_arch_info *, const char *));
+ bfd_boolean (*scan) (const struct bfd_arch_info *, const char *);
const struct bfd_arch_info *next;
@}
@@ -281,7 +337,7 @@ bfd_arch_info_type;
@subsubsection @code{bfd_printable_name}
@strong{Synopsis}
@example
-const char *bfd_printable_name(bfd *abfd);
+const char *bfd_printable_name (bfd *abfd);
@end example
@strong{Description}@*
Return a printable string representing the architecture and machine
@@ -291,7 +347,7 @@ from the pointer to the architecture info structure.
@subsubsection @code{bfd_scan_arch}
@strong{Synopsis}
@example
-const bfd_arch_info_type *bfd_scan_arch(const char *string);
+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
@@ -302,7 +358,7 @@ structure if a machine is found, otherwise NULL.
@subsubsection @code{bfd_arch_list}
@strong{Synopsis}
@example
-const char **bfd_arch_list(void);
+const char **bfd_arch_list (void);
@end example
@strong{Description}@*
Return a freshly malloced NULL-terminated vector of the names
@@ -312,16 +368,15 @@ of all the valid BFD architectures. Do not modify the names.
@subsubsection @code{bfd_arch_get_compatible}
@strong{Synopsis}
@example
-const bfd_arch_info_type *bfd_arch_get_compatible(
- const bfd *abfd,
- const bfd *bbfd);
+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.
+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}
@@ -339,7 +394,7 @@ extern const bfd_arch_info_type bfd_default_arch_struct;
@subsubsection @code{bfd_set_arch_info}
@strong{Synopsis}
@example
-void bfd_set_arch_info(bfd *abfd, const bfd_arch_info_type *arg);
+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}.
@@ -348,9 +403,8 @@ Set the architecture info of @var{abfd} to @var{arg}.
@subsubsection @code{bfd_default_set_arch_mach}
@strong{Synopsis}
@example
-boolean bfd_default_set_arch_mach(bfd *abfd,
- enum bfd_architecture arch,
- unsigned long mach);
+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}
@@ -362,7 +416,7 @@ pointer.
@subsubsection @code{bfd_get_arch}
@strong{Synopsis}
@example
-enum bfd_architecture bfd_get_arch(bfd *abfd);
+enum bfd_architecture bfd_get_arch (bfd *abfd);
@end example
@strong{Description}@*
Return the enumerated type which describes the BFD @var{abfd}'s
@@ -372,7 +426,7 @@ architecture.
@subsubsection @code{bfd_get_mach}
@strong{Synopsis}
@example
-unsigned long bfd_get_mach(bfd *abfd);
+unsigned long bfd_get_mach (bfd *abfd);
@end example
@strong{Description}@*
Return the long type which describes the BFD @var{abfd}'s
@@ -382,7 +436,7 @@ machine.
@subsubsection @code{bfd_arch_bits_per_byte}
@strong{Synopsis}
@example
-unsigned int bfd_arch_bits_per_byte(bfd *abfd);
+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
@@ -392,7 +446,7 @@ architecture's bytes.
@subsubsection @code{bfd_arch_bits_per_address}
@strong{Synopsis}
@example
-unsigned int bfd_arch_bits_per_address(bfd *abfd);
+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
@@ -403,8 +457,7 @@ architecture's addresses.
@strong{Synopsis}
@example
const bfd_arch_info_type *bfd_default_compatible
- (const bfd_arch_info_type *a,
- const bfd_arch_info_type *b);
+ (const bfd_arch_info_type *a, const bfd_arch_info_type *b);
@end example
@strong{Description}@*
The default function for testing for compatibility.
@@ -413,7 +466,8 @@ The default function for testing for compatibility.
@subsubsection @code{bfd_default_scan}
@strong{Synopsis}
@example
-boolean bfd_default_scan(const struct bfd_arch_info *info, const char *string);
+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
@@ -423,7 +477,7 @@ architecture hit and a machine hit.
@subsubsection @code{bfd_get_arch_info}
@strong{Synopsis}
@example
-const bfd_arch_info_type * bfd_get_arch_info(bfd *abfd);
+const bfd_arch_info_type *bfd_get_arch_info (bfd *abfd);
@end example
@strong{Description}@*
Return the architecture info struct in @var{abfd}.
@@ -433,12 +487,10 @@ Return the architecture info struct in @var{abfd}.
@strong{Synopsis}
@example
const bfd_arch_info_type *bfd_lookup_arch
- (enum bfd_architecture
- arch,
- unsigned long machine);
+ (enum bfd_architecture arch, unsigned long machine);
@end example
@strong{Description}@*
-Look for the architecure info structure which matches the
+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.
@@ -460,7 +512,7 @@ This routine is depreciated.
@subsubsection @code{bfd_octets_per_byte}
@strong{Synopsis}
@example
-unsigned int bfd_octets_per_byte(bfd *abfd);
+unsigned int bfd_octets_per_byte (bfd *abfd);
@end example
@strong{Description}@*
Return the number of octets (8-bit quantities) per target byte
@@ -471,8 +523,8 @@ DSP targets have 16, 32, or even 48 bits 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);
+unsigned int bfd_arch_mach_octets_per_byte
+ (enum bfd_architecture arch, unsigned long machine);
@end example
@strong{Description}@*
See bfd_octets_per_byte.
diff --git a/contrib/binutils/bfd/doc/bfd.texinfo b/contrib/binutils/bfd/doc/bfd.texinfo
index 380501e..3ed4194 100644
--- a/contrib/binutils/bfd/doc/bfd.texinfo
+++ b/contrib/binutils/bfd/doc/bfd.texinfo
@@ -1,6 +1,6 @@
\input texinfo.tex
@setfilename bfd.info
-@c Copyright 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1997, 2000
+@c Copyright 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1997, 2000, 2003
@c Free Software Foundation, Inc.
@c
@tex
@@ -30,14 +30,14 @@ END-INFO-DIR-ENTRY
@ifinfo
This file documents the BFD library.
-Copyright (C) 1991, 2000, 2001 Free Software Foundation, Inc.
+Copyright (C) 1991, 2000, 2001, 2003 Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.1
or any later version published by the Free Software Foundation;
with no Invariant Sections, with no Front-Cover Texts, and with no
Back-Cover Texts. A copy of the license is included in the
- section entitled "GNU Free Documentation License".
+ section entitled ``GNU Free Documentation License''.
@ignore
Permission is granted to process this file through Tex and print the
@@ -64,7 +64,7 @@ notice identical to this one except for the removal of this paragraph
@tex
\def\$#1${{#1}} % Kluge: collect RCS revision info without $...$
-\xdef\manvers{\$Revision: 1.5 $} % For use in headers, footers too
+\xdef\manvers{1.5} % For use in headers, footers too
{\parskip=0pt
\hfill Free Software Foundation\par
\hfill sac\@www.gnu.org\par
@@ -75,14 +75,14 @@ notice identical to this one except for the removal of this paragraph
@end tex
@vskip 0pt plus 1filll
-Copyright @copyright{} 1991, 2001 Free Software Foundation, Inc.
+Copyright @copyright{} 1991, 2001, 2003 Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.1
or any later version published by the Free Software Foundation;
with no Invariant Sections, with no Front-Cover Texts, and with no
Back-Cover Texts. A copy of the license is included in the
- section entitled "GNU Free Documentation License".
+ section entitled ``GNU Free Documentation License''.
@end titlepage
@end iftex
@@ -170,17 +170,17 @@ For example, this sequence does what you would probably expect:
return the number of sections in an object file attached to a BFD
@code{abfd}.
-@lisp
+@example
@c @cartouche
#include "bfd.h"
-unsigned int number_of_sections(abfd)
+unsigned int number_of_sections (abfd)
bfd *abfd;
@{
- return bfd_count_sections(abfd);
+ return bfd_count_sections (abfd);
@}
@c @end cartouche
-@end lisp
+@end example
The abstraction used within BFD is that an object file has:
@@ -205,8 +205,9 @@ IEEE-695.
@include bfdsumm.texi
@node BFD front end, BFD back ends, Overview, Top
-@chapter BFD front end
+@chapter BFD Front End
@include bfdt.texi
+@include bfdio.texi
@menu
* Memory Usage::
@@ -227,7 +228,7 @@ IEEE-695.
@end menu
@node Memory Usage, Initialization, BFD front end, BFD front end
-@section Memory usage
+@section Memory Usage
BFD keeps all of its internal structures in obstacks. There is one obstack
per open BFD file, into which the current state is stored. When a BFD is
closed, the obstack is deleted, and so everything which has been
@@ -323,370 +324,9 @@ All of BFD lives in one directory.
@include mmo.texi
@node GNU Free Documentation License, Index, BFD back ends, Top
-@chapter GNU Free Documentation License
-@cindex GNU Free Documentation License
-
- GNU Free Documentation License
-
- Version 1.1, March 2000
-
- Copyright (C) 2000 Free Software Foundation, Inc.
- 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
-
-0. PREAMBLE
-
-The purpose of this License is to make a manual, textbook, or other
-written document "free" in the sense of freedom: to assure everyone
-the effective freedom to copy and redistribute it, with or without
-modifying it, either commercially or noncommercially. Secondarily,
-this License preserves for the author and publisher a way to get
-credit for their work, while not being considered responsible for
-modifications made by others.
-
-This License is a kind of "copyleft", which means that derivative
-works of the document must themselves be free in the same sense. It
-complements the GNU General Public License, which is a copyleft
-license designed for free software.
-
-We have designed this License in order to use it for manuals for free
-software, because free software needs free documentation: a free
-program should come with manuals providing the same freedoms that the
-software does. But this License is not limited to software manuals;
-it can be used for any textual work, regardless of subject matter or
-whether it is published as a printed book. We recommend this License
-principally for works whose purpose is instruction or reference.
-
-
-1. APPLICABILITY AND DEFINITIONS
-
-This License applies to any manual or other work that contains a
-notice placed by the copyright holder saying it can be distributed
-under the terms of this License. The "Document", below, refers to any
-such manual or work. Any member of the public is a licensee, and is
-addressed as "you".
-
-A "Modified Version" of the Document means any work containing the
-Document or a portion of it, either copied verbatim, or with
-modifications and/or translated into another language.
-
-A "Secondary Section" is a named appendix or a front-matter section of
-the Document that deals exclusively with the relationship of the
-publishers or authors of the Document to the Document's overall subject
-(or to related matters) and contains nothing that could fall directly
-within that overall subject. (For example, if the Document is in part a
-textbook of mathematics, a Secondary Section may not explain any
-mathematics.) The relationship could be a matter of historical
-connection with the subject or with related matters, or of legal,
-commercial, philosophical, ethical or political position regarding
-them.
-
-The "Invariant Sections" are certain Secondary Sections whose titles
-are designated, as being those of Invariant Sections, in the notice
-that says that the Document is released under this License.
-
-The "Cover Texts" are certain short passages of text that are listed,
-as Front-Cover Texts or Back-Cover Texts, in the notice that says that
-the Document is released under this License.
-
-A "Transparent" copy of the Document means a machine-readable copy,
-represented in a format whose specification is available to the
-general public, whose contents can be viewed and edited directly and
-straightforwardly with generic text editors or (for images composed of
-pixels) generic paint programs or (for drawings) some widely available
-drawing editor, and that is suitable for input to text formatters or
-for automatic translation to a variety of formats suitable for input
-to text formatters. A copy made in an otherwise Transparent file
-format whose markup has been designed to thwart or discourage
-subsequent modification by readers is not Transparent. A copy that is
-not "Transparent" is called "Opaque".
-
-Examples of suitable formats for Transparent copies include plain
-ASCII without markup, Texinfo input format, LaTeX input format, SGML
-or XML using a publicly available DTD, and standard-conforming simple
-HTML designed for human modification. Opaque formats include
-PostScript, PDF, proprietary formats that can be read and edited only
-by proprietary word processors, SGML or XML for which the DTD and/or
-processing tools are not generally available, and the
-machine-generated HTML produced by some word processors for output
-purposes only.
-
-The "Title Page" means, for a printed book, the title page itself,
-plus such following pages as are needed to hold, legibly, the material
-this License requires to appear in the title page. For works in
-formats which do not have any title page as such, "Title Page" means
-the text near the most prominent appearance of the work's title,
-preceding the beginning of the body of the text.
-
-
-2. VERBATIM COPYING
-
-You may copy and distribute the Document in any medium, either
-commercially or noncommercially, provided that this License, the
-copyright notices, and the license notice saying this License applies
-to the Document are reproduced in all copies, and that you add no other
-conditions whatsoever to those of this License. You may not use
-technical measures to obstruct or control the reading or further
-copying of the copies you make or distribute. However, you may accept
-compensation in exchange for copies. If you distribute a large enough
-number of copies you must also follow the conditions in section 3.
-
-You may also lend copies, under the same conditions stated above, and
-you may publicly display copies.
-
-
-3. COPYING IN QUANTITY
-
-If you publish printed copies of the Document numbering more than 100,
-and the Document's license notice requires Cover Texts, you must enclose
-the copies in covers that carry, clearly and legibly, all these Cover
-Texts: Front-Cover Texts on the front cover, and Back-Cover Texts on
-the back cover. Both covers must also clearly and legibly identify
-you as the publisher of these copies. The front cover must present
-the full title with all words of the title equally prominent and
-visible. You may add other material on the covers in addition.
-Copying with changes limited to the covers, as long as they preserve
-the title of the Document and satisfy these conditions, can be treated
-as verbatim copying in other respects.
-
-If the required texts for either cover are too voluminous to fit
-legibly, you should put the first ones listed (as many as fit
-reasonably) on the actual cover, and continue the rest onto adjacent
-pages.
-
-If you publish or distribute Opaque copies of the Document numbering
-more than 100, you must either include a machine-readable Transparent
-copy along with each Opaque copy, or state in or with each Opaque copy
-a publicly-accessible computer-network location containing a complete
-Transparent copy of the Document, free of added material, which the
-general network-using public has access to download anonymously at no
-charge using public-standard network protocols. If you use the latter
-option, you must take reasonably prudent steps, when you begin
-distribution of Opaque copies in quantity, to ensure that this
-Transparent copy will remain thus accessible at the stated location
-until at least one year after the last time you distribute an Opaque
-copy (directly or through your agents or retailers) of that edition to
-the public.
-
-It is requested, but not required, that you contact the authors of the
-Document well before redistributing any large number of copies, to give
-them a chance to provide you with an updated version of the Document.
-
-
-4. MODIFICATIONS
-
-You may copy and distribute a Modified Version of the Document under
-the conditions of sections 2 and 3 above, provided that you release
-the Modified Version under precisely this License, with the Modified
-Version filling the role of the Document, thus licensing distribution
-and modification of the Modified Version to whoever possesses a copy
-of it. In addition, you must do these things in the Modified Version:
-
-A. Use in the Title Page (and on the covers, if any) a title distinct
- from that of the Document, and from those of previous versions
- (which should, if there were any, be listed in the History section
- of the Document). You may use the same title as a previous version
- if the original publisher of that version gives permission.
-B. List on the Title Page, as authors, one or more persons or entities
- responsible for authorship of the modifications in the Modified
- Version, together with at least five of the principal authors of the
- Document (all of its principal authors, if it has less than five).
-C. State on the Title page the name of the publisher of the
- Modified Version, as the publisher.
-D. Preserve all the copyright notices of the Document.
-E. Add an appropriate copyright notice for your modifications
- adjacent to the other copyright notices.
-F. Include, immediately after the copyright notices, a license notice
- giving the public permission to use the Modified Version under the
- terms of this License, in the form shown in the Addendum below.
-G. Preserve in that license notice the full lists of Invariant Sections
- and required Cover Texts given in the Document's license notice.
-H. Include an unaltered copy of this License.
-I. Preserve the section entitled "History", and its title, and add to
- it an item stating at least the title, year, new authors, and
- publisher of the Modified Version as given on the Title Page. If
- there is no section entitled "History" in the Document, create one
- stating the title, year, authors, and publisher of the Document as
- given on its Title Page, then add an item describing the Modified
- Version as stated in the previous sentence.
-J. Preserve the network location, if any, given in the Document for
- public access to a Transparent copy of the Document, and likewise
- the network locations given in the Document for previous versions
- it was based on. These may be placed in the "History" section.
- You may omit a network location for a work that was published at
- least four years before the Document itself, or if the original
- publisher of the version it refers to gives permission.
-K. In any section entitled "Acknowledgements" or "Dedications",
- preserve the section's title, and preserve in the section all the
- substance and tone of each of the contributor acknowledgements
- and/or dedications given therein.
-L. Preserve all the Invariant Sections of the Document,
- unaltered in their text and in their titles. Section numbers
- or the equivalent are not considered part of the section titles.
-M. Delete any section entitled "Endorsements". Such a section
- may not be included in the Modified Version.
-N. Do not retitle any existing section as "Endorsements"
- or to conflict in title with any Invariant Section.
-
-If the Modified Version includes new front-matter sections or
-appendices that qualify as Secondary Sections and contain no material
-copied from the Document, you may at your option designate some or all
-of these sections as invariant. To do this, add their titles to the
-list of Invariant Sections in the Modified Version's license notice.
-These titles must be distinct from any other section titles.
-
-You may add a section entitled "Endorsements", provided it contains
-nothing but endorsements of your Modified Version by various
-parties--for example, statements of peer review or that the text has
-been approved by an organization as the authoritative definition of a
-standard.
-
-You may add a passage of up to five words as a Front-Cover Text, and a
-passage of up to 25 words as a Back-Cover Text, to the end of the list
-of Cover Texts in the Modified Version. Only one passage of
-Front-Cover Text and one of Back-Cover Text may be added by (or
-through arrangements made by) any one entity. If the Document already
-includes a cover text for the same cover, previously added by you or
-by arrangement made by the same entity you are acting on behalf of,
-you may not add another; but you may replace the old one, on explicit
-permission from the previous publisher that added the old one.
-
-The author(s) and publisher(s) of the Document do not by this License
-give permission to use their names for publicity for or to assert or
-imply endorsement of any Modified Version.
-
-
-5. COMBINING DOCUMENTS
-
-You may combine the Document with other documents released under this
-License, under the terms defined in section 4 above for modified
-versions, provided that you include in the combination all of the
-Invariant Sections of all of the original documents, unmodified, and
-list them all as Invariant Sections of your combined work in its
-license notice.
-
-The combined work need only contain one copy of this License, and
-multiple identical Invariant Sections may be replaced with a single
-copy. If there are multiple Invariant Sections with the same name but
-different contents, make the title of each such section unique by
-adding at the end of it, in parentheses, the name of the original
-author or publisher of that section if known, or else a unique number.
-Make the same adjustment to the section titles in the list of
-Invariant Sections in the license notice of the combined work.
-
-In the combination, you must combine any sections entitled "History"
-in the various original documents, forming one section entitled
-"History"; likewise combine any sections entitled "Acknowledgements",
-and any sections entitled "Dedications". You must delete all sections
-entitled "Endorsements."
-
-
-6. COLLECTIONS OF DOCUMENTS
-
-You may make a collection consisting of the Document and other documents
-released under this License, and replace the individual copies of this
-License in the various documents with a single copy that is included in
-the collection, provided that you follow the rules of this License for
-verbatim copying of each of the documents in all other respects.
-
-You may extract a single document from such a collection, and distribute
-it individually under this License, provided you insert a copy of this
-License into the extracted document, and follow this License in all
-other respects regarding verbatim copying of that document.
-
-
-7. AGGREGATION WITH INDEPENDENT WORKS
-
-A compilation of the Document or its derivatives with other separate
-and independent documents or works, in or on a volume of a storage or
-distribution medium, does not as a whole count as a Modified Version
-of the Document, provided no compilation copyright is claimed for the
-compilation. Such a compilation is called an "aggregate", and this
-License does not apply to the other self-contained works thus compiled
-with the Document, on account of their being thus compiled, if they
-are not themselves derivative works of the Document.
-
-If the Cover Text requirement of section 3 is applicable to these
-copies of the Document, then if the Document is less than one quarter
-of the entire aggregate, the Document's Cover Texts may be placed on
-covers that surround only the Document within the aggregate.
-Otherwise they must appear on covers around the whole aggregate.
-
-
-8. TRANSLATION
-
-Translation is considered a kind of modification, so you may
-distribute translations of the Document under the terms of section 4.
-Replacing Invariant Sections with translations requires special
-permission from their copyright holders, but you may include
-translations of some or all Invariant Sections in addition to the
-original versions of these Invariant Sections. You may include a
-translation of this License provided that you also include the
-original English version of this License. In case of a disagreement
-between the translation and the original English version of this
-License, the original English version will prevail.
-
-
-9. TERMINATION
-
-You may not copy, modify, sublicense, or distribute the Document except
-as expressly provided for under this License. Any other attempt to
-copy, modify, sublicense or distribute the Document is void, and will
-automatically terminate your rights under this License. However,
-parties who have received copies, or rights, from you under this
-License will not have their licenses terminated so long as such
-parties remain in full compliance.
-
-
-10. FUTURE REVISIONS OF THIS LICENSE
-
-The Free Software Foundation may publish new, revised versions
-of the GNU Free Documentation License from time to time. Such new
-versions will be similar in spirit to the present version, but may
-differ in detail to address new problems or concerns. See
-http://www.gnu.org/copyleft/.
-
-Each version of the License is given a distinguishing version number.
-If the Document specifies that a particular numbered version of this
-License "or any later version" applies to it, you have the option of
-following the terms and conditions either of that specified version or
-of any later version that has been published (not as a draft) by the
-Free Software Foundation. If the Document does not specify a version
-number of this License, you may choose any version ever published (not
-as a draft) by the Free Software Foundation.
-
-
-ADDENDUM: How to use this License for your documents
-
-To use this License in a document you have written, include a copy of
-the License in the document and put the following copyright and
-license notices just after the title page:
-
-@smallexample
- Copyright (c) YEAR YOUR NAME.
- Permission is granted to copy, distribute and/or modify this document
- under the terms of the GNU Free Documentation License, Version 1.1
- or any later version published by the Free Software Foundation;
- with the Invariant Sections being LIST THEIR TITLES, with the
- Front-Cover Texts being LIST, and with the Back-Cover Texts being LIST.
- A copy of the license is included in the section entitled "GNU
- Free Documentation License".
-@end smallexample
-
-If you have no Invariant Sections, write "with no Invariant Sections"
-instead of saying which ones are invariant. If you have no
-Front-Cover Texts, write "no Front-Cover Texts" instead of
-"Front-Cover Texts being LIST"; likewise for Back-Cover Texts.
-
-If your document contains nontrivial examples of program code, we
-recommend releasing these examples in parallel under your choice of
-free software license, such as the GNU General Public License,
-to permit their use in free software.
-
-@node Index, , GNU Free Documentation License , Top
+@include fdl.texi
+
+@node Index, , GNU Free Documentation License, Top
@unnumbered Index
@printindex cp
diff --git a/contrib/binutils/bfd/doc/bfdint.texi b/contrib/binutils/bfd/doc/bfdint.texi
index d2996dc..95c0096 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
+@c 2000, 2001, 2002, 2003
@c Free Software Foundation, Inc.
@setfilename bfdint.info
@@ -694,7 +694,7 @@ information in BFD private data. This is called via
@samp{bfd_get_symtab_upper_bound}. The corresponding field in the
target vector is named @samp{_bfd_get_symtab_upper_bound}.
-@item _get_symtab
+@item _canonicalize_symtab
Read in the symbol table. This is called via
@samp{bfd_canonicalize_symtab}. The corresponding field in the target
vector is named @samp{_bfd_canonicalize_symtab}.
@@ -835,7 +835,7 @@ corresponding field in the target vector is named
@item _bfd_get_relocated_section_contents
Read the contents of a section and apply the relocation information.
-This handles both a final link and a relocateable link; in the latter
+This handles both a final link and a relocatable link; in the latter
case, it adjust the relocation information as well. This is called via
@samp{bfd_get_relocated_section_contents}. Most targets implement it by
calling @samp{bfd_generic_get_relocated_section_contents}.
@@ -1073,11 +1073,6 @@ sizes.
Like @file{elfcode.h}, but for functions that are specific to ELF core
files. This is included only by @file{elfcode.h}.
-@item elflink.h
-@cindex @file{elflink.h}
-Like @file{elfcode.h}, but for functions used by the ELF linker. This
-is included only by @file{elfcode.h}.
-
@item elfxx-target.h
@cindex @file{elfxx-target.h}
This file is the source for the generated files @file{elf32-target.h}
@@ -1169,7 +1164,7 @@ allocate space in a different section and use the offset within that
section as the value to store. In the IEEE object file format,
relocations may involve arbitrary expressions.
-When doing a relocateable link, the linker may or may not have to do
+When doing a relocatable link, the linker may or may not have to do
anything with a relocation, depending upon the definition of the
relocation. Simple relocations generally do not require any special
action.
@@ -1240,9 +1235,9 @@ existing target, you need to do the following:
@itemize @bullet
@item
Make sure you clearly understand what the contents of the section should
-look like after assembly, after a relocateable link, and after a final
+look like after assembly, after a relocatable link, and after a final
link. Make sure you clearly understand the operations the linker must
-perform during a relocateable link and during a final link.
+perform during a relocatable link and during a final link.
@item
Write a howto structure for the relocation. The howto structure is
@@ -1257,7 +1252,7 @@ call @samp{bfd_install_relocation}, so your howto structure has to be
able to handle that. You may need to set the @samp{special_function}
field to handle assembly correctly. Be careful to ensure that any code
you write to handle the assembler will also work correctly when doing a
-relocateable link. For example, see @samp{bfd_elf_generic_reloc}.
+relocatable link. For example, see @samp{bfd_elf_generic_reloc}.
@item
Test the assembler. Consider the cases of relocation against an
@@ -1271,14 +1266,14 @@ If your target uses the new linker, which is recommended, add any
required handling to the target specific relocation function. In simple
cases this will just involve a call to @samp{_bfd_final_link_relocate}
or @samp{_bfd_relocate_contents}, depending upon the definition of the
-relocation and whether the link is relocateable or not.
+relocation and whether the link is relocatable or not.
@item
Test the linker. Test the case of a final link. If the relocation can
overflow, use a linker script to force an overflow and make sure the
-error is reported correctly. Test a relocateable link, whether the
-symbol is defined or undefined in the relocateable output. For both the
-final and relocateable link, test the case when the symbol is a common
+error is reported correctly. Test a relocatable link, whether the
+symbol is defined or undefined in the relocatable output. For both the
+final and relocatable link, test the case when the symbol is a common
symbol, when the symbol looked like a common symbol but became a defined
symbol, when the symbol is defined in a different object file, and when
the symbol is defined in the same object file.
@@ -1291,7 +1286,7 @@ thing for the relocation. You may need to set the
doing a link in which the output object file format is S-records.
@item
-Using the linker to generate relocateable output in a different object
+Using the linker to generate relocatable output in a different object
file format is impossible in the general case, so you generally don't
have to worry about that. The GNU linker makes sure to stop that from
happening when an input file in a different format has relocations.
@@ -1350,7 +1345,7 @@ howto structure. Some mechanism would be used to determine which type
of howto structure was being used by a particular format.
The new howto structure would clearly define the relocation behaviour in
-the case of an assembly, a relocateable link, and a final link. At
+the case of an assembly, a relocatable link, and a final link. At
least one special function would be defined as an escape, and it might
make sense to define more.
@@ -1482,8 +1477,7 @@ external data. @file{elfcode.h} is compiled twice, once via
@file{elfcode.h} includes functions to swap the ELF structures in and
out of external form, as well as a few more complex functions.
-Linker support is found in @file{elflink.c} and @file{elflink.h}. The
-latter file is compiled twice, for both 32 and 64 bit support. The
+Linker support is found in @file{elflink.c}. The
linker support is only used if the processor specific file defines
@samp{elf_backend_relocate_section}, which is required to relocate the
section contents. If that macro is not defined, the generic linker code
@@ -1566,7 +1560,7 @@ relocations. @samp{Rela} relocations will require more space in object
files (but not in executables, except when using dynamic linking).
However, this is outweighed by the simplicity of addend handling when
using @samp{Rela} relocations. With @samp{Rel} relocations, the addend
-must be stored in the section contents, which makes relocateable links
+must be stored in the section contents, which makes relocatable links
more complex.
For example, consider C code like @code{i = a[1000];} where @samp{a} is
@@ -1578,7 +1572,7 @@ relocations, that addend must be stored in the instructions themselves.
If you are adding support for a RISC chip which uses two or more
instructions to load an address, then the addend may not fit in a single
instruction, and will have to be somehow split among the instructions.
-This makes linking awkward, particularly when doing a relocateable link
+This makes linking awkward, particularly when doing a relocatable link
in which the addend may have to be updated. It can be done---the MIPS
ELF support does it---but it should be avoided when possible.
@@ -1611,7 +1605,7 @@ called @file{@var{cpu}.h}. This file should define any target specific
information which may be needed outside of the BFD code. In particular
it should use the @samp{START_RELOC_NUMBERS}, @samp{RELOC_NUMBER},
@samp{FAKE_RELOC}, @samp{EMPTY_RELOC} and @samp{END_RELOC_NUMBERS}
-macros to create a table mapping the number used to indentify a
+macros to create a table mapping the number used to identify a
relocation to a name describing that relocation.
While not a BFD component, you probably also want to make the binutils
@@ -1645,7 +1639,7 @@ information, and modify the section contents according to the relocation
information. In simple cases, this is little more than a loop over the
relocations which computes the value of each relocation and calls
@samp{_bfd_final_link_relocate}. The function must check for a
-relocateable link, and in that case normally needs to do nothing other
+relocatable link, and in that case normally needs to do nothing other
than adjust the addend for relocations against a section symbol.
The complex cases generally have to do with dynamic linker support. GOT
@@ -1788,7 +1782,7 @@ The implementation within BFD of a particular object file format. The
set of functions which appear in a particular target vector.
@item BFD
-The BFD library itself. Also, each object file, archive, or exectable
+The BFD library itself. Also, each object file, archive, or executable
opened by the BFD library has the type @samp{bfd *}, and is sometimes
referred to as a bfd.
diff --git a/contrib/binutils/bfd/doc/bfdio.texi b/contrib/binutils/bfd/doc/bfdio.texi
new file mode 100644
index 0000000..b8c79d3
--- /dev/null
+++ b/contrib/binutils/bfd/doc/bfdio.texi
@@ -0,0 +1,41 @@
+@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
index 46bb61a..74cace4 100644
--- a/contrib/binutils/bfd/doc/bfdt.texi
+++ b/contrib/binutils/bfd/doc/bfdt.texi
@@ -10,8 +10,11 @@ to the rest of the data.
@example
-struct _bfd
+struct bfd
@{
+ /* A unique identifier of the BFD */
+ unsigned int id;
+
/* The filename the application opened the BFD with. */
const char *filename;
@@ -25,33 +28,33 @@ struct _bfd
is the result of an fopen on the filename. However, if the
BFD_IN_MEMORY flag is set, then iostream is actually a pointer
to a bfd_in_memory struct. */
- PTR iostream;
+ void *iostream;
/* Is the file descriptor being cached? That is, can it be closed as
needed, and re-opened when accessed later? */
- boolean cacheable;
+ 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. */
- boolean target_defaulted;
+ bfd_boolean target_defaulted;
/* The caching routines use these to maintain a
least-recently-used list of BFDs. */
- struct _bfd *lru_prev, *lru_next;
+ 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). */
- boolean opened_once;
+ bfd_boolean opened_once;
/* Set if we have a locally maintained mtime value, rather than
getting it from the file each time. */
- boolean mtime_set;
+ bfd_boolean mtime_set;
- /* File modified time, if mtime_set is true. */
+ /* File modified time, if mtime_set is TRUE. */
long mtime;
/* Reserved for an unimplemented file locking extension. */
@@ -80,16 +83,16 @@ struct _bfd
/* Remember when output has begun, to stop strange things
from happening. */
- boolean output_has_begun;
+ bfd_boolean output_has_begun;
/* A hash table for section names. */
struct bfd_hash_table section_htab;
/* Pointer to linked list of sections. */
- struct sec *sections;
+ struct bfd_section *sections;
/* The place where we add to the section list. */
- struct sec **section_tail;
+ struct bfd_section **section_tail;
/* The number of sections. */
unsigned int section_count;
@@ -102,7 +105,7 @@ struct _bfd
unsigned int symcount;
/* Symbol table for output BFD (with symcount entries). */
- struct symbol_cache_entry **outsymbols;
+ struct bfd_symbol **outsymbols;
/* Used for slurped dynamic symbol tables. */
unsigned int dynsymcount;
@@ -111,14 +114,14 @@ struct _bfd
const struct bfd_arch_info *arch_info;
/* Stuff only useful for archives. */
- PTR arelt_data;
- struct _bfd *my_archive; /* The containing archive BFD. */
- struct _bfd *next; /* The next BFD in the archive. */
- struct _bfd *archive_head; /* The first BFD in the archive. */
- boolean has_armap;
+ 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;
+ struct bfd *link_next;
/* A field used by _bfd_generic_link_add_archive_symbols. This will
be used only for archive elements. */
@@ -156,17 +159,22 @@ struct _bfd
struct cisco_core_struct *cisco_core_data;
struct versados_data_struct *versados_data;
struct netbsd_core_struct *netbsd_core_data;
- PTR any;
+ 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. */
- PTR usrdata;
+ void *usrdata;
/* Where all the allocated stuff under this BFD goes. This is a
- struct objalloc *, but we use PTR to avoid requiring the inclusion of
- objalloc.h. */
- PTR memory;
+ struct objalloc *, but we use void * to avoid requiring the inclusion
+ of objalloc.h. */
+ void *memory;
@};
@end example
@@ -258,14 +266,14 @@ by @var{message}, a colon, and a space. It is followed by a newline.
@subsection BFD error handler
Some BFD functions want to print messages describing the
problem. They call a BFD error handler function. This
-function may be overriden by the program.
+function may be overridden by the program.
The BFD error handler acts like printf.
@example
-typedef void (*bfd_error_handler_type) PARAMS ((const char *, ...));
+typedef void (*bfd_error_handler_type) (const char *, ...);
@end example
@findex bfd_set_error_handler
@@ -317,7 +325,7 @@ returns the file name.
@subsubsection @code{bfd_get_reloc_upper_bound}
@strong{Synopsis}
@example
-long bfd_get_reloc_upper_bound(bfd *abfd, asection *sect);
+long bfd_get_reloc_upper_bound (bfd *abfd, asection *sect);
@end example
@strong{Description}@*
Return the number of bytes required to store the
@@ -329,10 +337,7 @@ attached to bfd @var{abfd}. If an error occurs, return -1.
@strong{Synopsis}
@example
long bfd_canonicalize_reloc
- (bfd *abfd,
- asection *sec,
- arelent **loc,
- asymbol **syms);
+ (bfd *abfd, asection *sec, arelent **loc, asymbol **syms);
@end example
@strong{Description}@*
Call the back end associated with the open BFD
@@ -362,7 +367,7 @@ The argument @var{abfd} is ignored.
@subsubsection @code{bfd_set_file_flags}
@strong{Synopsis}
@example
-boolean bfd_set_file_flags(bfd *abfd, flagword flags);
+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}.
@@ -418,60 +423,19 @@ not sign extend addresses, and @code{-1} otherwise.
@subsubsection @code{bfd_set_start_address}
@strong{Synopsis}
@example
-boolean bfd_set_start_address(bfd *abfd, bfd_vma vma);
+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_mtime
-@subsubsection @code{bfd_get_mtime}
-@strong{Synopsis}
-@example
-long bfd_get_mtime(bfd *abfd);
-@end example
-@strong{Description}@*
-Return the file modification time (as read from the file system, or
-from the archive header for archive members).
-
-@findex bfd_get_size
-@subsubsection @code{bfd_get_size}
-@strong{Synopsis}
-@example
-long bfd_get_size(bfd *abfd);
-@end example
-@strong{Description}@*
-Return the file size (as read from file system) for the file
-associated with BFD @var{abfd}.
-
-The initial motivation for, and use of, this routine is not
-so we can get the exact size of the object the BFD applies to, since
-that might not be generally possible (archive members for example).
-It would be ideal if someone could eventually modify
-it so that such results were guaranteed.
-
-Instead, we want to ask questions like "is this NNN byte sized
-object I'm about to try read from file offset YYY reasonable?"
-As as example of where we might do this, some object formats
-use string tables for which the first @code{sizeof (long)} bytes of the
-table contain the size of the table itself, including the size bytes.
-If an application tries to read what it thinks is one of these
-string tables, without some way to validate the size, and for
-some reason the size is wrong (byte swapping error, wrong location
-for the string table, etc.), the only clue is likely to be a read
-error when it tries to read the table, or a "virtual memory
-exhausted" error when it tries to allocate 15 bazillon bytes
-of space for the 15 bazillon byte table it is about to read.
-This function at least allows us to answer the quesion, "is the
-size reasonable?".
+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);
+unsigned int bfd_get_gp_size (bfd *abfd);
@end example
@strong{Description}@*
Return the maximum size of objects to be optimized using the GP
@@ -482,7 +446,7 @@ argument to the compiler, assembler or linker.
@subsubsection @code{bfd_set_gp_size}
@strong{Synopsis}
@example
-void bfd_set_gp_size(bfd *abfd, unsigned int i);
+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
@@ -493,7 +457,7 @@ the @code{-G} argument to the compiler, assembler or linker.
@subsubsection @code{bfd_scan_vma}
@strong{Synopsis}
@example
-bfd_vma bfd_scan_vma(const char *string, const char **end, int base);
+bfd_vma bfd_scan_vma (const char *string, const char **end, int base);
@end example
@strong{Description}@*
Convert, like @code{strtoul}, a numerical expression
@@ -512,11 +476,11 @@ returned.
@subsubsection @code{bfd_copy_private_bfd_data}
@strong{Synopsis}
@example
-boolean bfd_copy_private_bfd_data(bfd *ibfd, bfd *obfd);
+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.
+the BFD @var{obfd}. Return @code{TRUE} on success, @code{FALSE} on error.
Possible error returns are:
@itemize @bullet
@@ -535,12 +499,12 @@ Not enough memory exists to create private data for @var{obfd}.
@subsubsection @code{bfd_merge_private_bfd_data}
@strong{Synopsis}
@example
-boolean bfd_merge_private_bfd_data(bfd *ibfd, bfd *obfd);
+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:
+the output file BFD @var{obfd} when linking. Return @code{TRUE}
+on success, @code{FALSE} on error. Possible error returns are:
@itemize @bullet
@@ -558,11 +522,11 @@ Not enough memory exists to create private data for @var{obfd}.
@subsubsection @code{bfd_set_private_flags}
@strong{Synopsis}
@example
-boolean bfd_set_private_flags(bfd *abfd, flagword flags);
+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
+Return @code{TRUE} on success, @code{FALSE} on error. Possible error
returns are:
@itemize @bullet
@@ -573,40 +537,38 @@ 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))
+ BFD_SEND (abfd, _bfd_set_private_flags, (abfd, flags))
@end example
-@findex stuff
-@subsubsection @code{stuff}
+@findex Other functions
+@subsubsection @code{Other functions}
@strong{Description}@*
-Stuff which should be documented:
+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))
+ 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))
+ BFD_SEND (abfd, _bfd_find_nearest_line, \
+ (abfd, sec, syms, off, file, func, line))
- /* Do these three do anything useful at all, for any back end? */
#define bfd_debug_info_start(abfd) \
- BFD_SEND (abfd, _bfd_debug_info_start, (abfd))
+ BFD_SEND (abfd, _bfd_debug_info_start, (abfd))
#define bfd_debug_info_end(abfd) \
- BFD_SEND (abfd, _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))
-
+ 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))
+ BFD_SEND (abfd, _bfd_stat_arch_elt,(abfd, stat))
#define bfd_update_armap_timestamp(abfd) \
- BFD_SEND (abfd, _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))
+ 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))
@@ -654,9 +616,8 @@ Stuff which should be documented:
BFD_SEND (abfd, _bfd_canonicalize_dynamic_reloc, (abfd, arels, asyms))
extern bfd_byte *bfd_get_relocated_section_contents
- PARAMS ((bfd *, struct bfd_link_info *,
- struct bfd_link_order *, bfd_byte *,
- boolean, asymbol **));
+ (bfd *, struct bfd_link_info *, struct bfd_link_order *, bfd_byte *,
+ bfd_boolean, asymbol **);
@end example
@@ -664,7 +625,7 @@ extern bfd_byte *bfd_get_relocated_section_contents
@subsubsection @code{bfd_alt_mach_code}
@strong{Synopsis}
@example
-boolean bfd_alt_mach_code(bfd *abfd, int alternative);
+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
@@ -673,3 +634,57 @@ 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
new file mode 100644
index 0000000..b1fd7d5
--- /dev/null
+++ b/contrib/binutils/bfd/doc/bfdwin.texi
@@ -0,0 +1,2 @@
+@findex
+@subsubsection @code{}
diff --git a/contrib/binutils/bfd/doc/cache.texi b/contrib/binutils/bfd/doc/cache.texi
index 56d1f18..2bc3696 100644
--- a/contrib/binutils/bfd/doc/cache.texi
+++ b/contrib/binutils/bfd/doc/cache.texi
@@ -48,7 +48,7 @@ otherwise, it has to perform the complicated lookup function.
@subsubsection @code{bfd_cache_init}
@strong{Synopsis}
@example
-boolean bfd_cache_init (bfd *abfd);
+bfd_boolean bfd_cache_init (bfd *abfd);
@end example
@strong{Description}@*
Add a newly opened BFD to the cache.
@@ -57,21 +57,21 @@ Add a newly opened BFD to the cache.
@subsubsection @code{bfd_cache_close}
@strong{Synopsis}
@example
-boolean bfd_cache_close (bfd *abfd);
+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
+@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);
+FILE* bfd_open_file (bfd *abfd);
@end example
@strong{Description}@*
Call the OS to open a file for @var{abfd}. Return the @code{FILE *}
@@ -84,7 +84,7 @@ cache, so it won't have to be removed from it.
@subsubsection @code{bfd_cache_lookup_worker}
@strong{Synopsis}
@example
-FILE *bfd_cache_lookup_worker(bfd *abfd);
+FILE *bfd_cache_lookup_worker (bfd *abfd);
@end example
@strong{Description}@*
Called when the macro @code{bfd_cache_lookup} fails to find a
diff --git a/contrib/binutils/bfd/doc/chew.c b/contrib/binutils/bfd/doc/chew.c
index bdf76e4..7c060da 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
+ 2002, 2003
Free Software Foundation, Inc.
Contributed by steve chamberlain @cygnus
@@ -494,8 +494,11 @@ paramstuff ()
string_type out;
init_string (&out);
+#define NO_PARAMS 1
+
/* Make sure that it's not already param'd or proto'd. */
- if (find (tos, "PARAMS") || find (tos, "PROTO") || !find (tos, "("))
+ if (NO_PARAMS
+ || find (tos, "PARAMS") || find (tos, "PROTO") || !find (tos, "("))
{
catstr (&out, tos);
}
diff --git a/contrib/binutils/bfd/doc/coffcode.texi b/contrib/binutils/bfd/doc/coffcode.texi
index 473747e..f9e15a6 100644
--- a/contrib/binutils/bfd/doc/coffcode.texi
+++ b/contrib/binutils/bfd/doc/coffcode.texi
@@ -188,7 +188,7 @@ section. This transformation uses the
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 hierachy required by coff. It changes each pointer
+structured hierarchy required by coff. It changes each pointer
to a symbol into the index into the symbol table of the asymbol.
@itemize @bullet
@@ -259,7 +259,7 @@ typedef struct coff_symbol_struct
struct lineno_cache_entry *lineno;
/* Have the line numbers been relocated yet ? */
- boolean done_lineno;
+ bfd_boolean done_lineno;
@} coff_symbol_type;
@end example
@findex bfd_coff_backend_data
@@ -325,10 +325,10 @@ typedef struct
unsigned int _bfd_relsz;
unsigned int _bfd_linesz;
unsigned int _bfd_filnmlen;
- boolean _bfd_coff_long_filenames;
- boolean _bfd_coff_long_section_names;
+ bfd_boolean _bfd_coff_long_filenames;
+ bfd_boolean _bfd_coff_long_section_names;
unsigned int _bfd_coff_default_section_alignment_power;
- boolean _bfd_coff_force_symnames_in_strings;
+ bfd_boolean _bfd_coff_force_symnames_in_strings;
unsigned int _bfd_coff_debug_string_prefix_length;
void (*_bfd_coff_swap_filehdr_in)
@@ -343,32 +343,32 @@ typedef struct
void (*_bfd_coff_swap_reloc_in)
PARAMS ((bfd *abfd, PTR, PTR));
- boolean (*_bfd_coff_bad_format_hook)
+ bfd_boolean (*_bfd_coff_bad_format_hook)
PARAMS ((bfd *, PTR));
- boolean (*_bfd_coff_set_arch_mach_hook)
+ bfd_boolean (*_bfd_coff_set_arch_mach_hook)
PARAMS ((bfd *, PTR));
PTR (*_bfd_coff_mkobject_hook)
PARAMS ((bfd *, PTR, PTR));
- boolean (*_bfd_styp_to_sec_flags_hook)
+ bfd_boolean (*_bfd_styp_to_sec_flags_hook)
PARAMS ((bfd *, PTR, const char *, asection *, flagword *));
void (*_bfd_set_alignment_hook)
PARAMS ((bfd *, asection *, PTR));
- boolean (*_bfd_coff_slurp_symbol_table)
+ bfd_boolean (*_bfd_coff_slurp_symbol_table)
PARAMS ((bfd *));
- boolean (*_bfd_coff_symname_in_debug)
+ bfd_boolean (*_bfd_coff_symname_in_debug)
PARAMS ((bfd *, struct internal_syment *));
- boolean (*_bfd_coff_pointerize_aux_hook)
+ bfd_boolean (*_bfd_coff_pointerize_aux_hook)
PARAMS ((bfd *, combined_entry_type *, combined_entry_type *,
unsigned int, combined_entry_type *));
- boolean (*_bfd_coff_print_aux)
+ bfd_boolean (*_bfd_coff_print_aux)
PARAMS ((bfd *, FILE *, combined_entry_type *, combined_entry_type *,
combined_entry_type *, unsigned int));
@@ -383,13 +383,13 @@ typedef struct
enum coff_symbol_classification (*_bfd_coff_classify_symbol)
PARAMS ((bfd *, struct internal_syment *));
- boolean (*_bfd_coff_compute_section_file_positions)
+ bfd_boolean (*_bfd_coff_compute_section_file_positions)
PARAMS ((bfd *));
- boolean (*_bfd_coff_start_final_link)
+ bfd_boolean (*_bfd_coff_start_final_link)
PARAMS ((bfd *, struct bfd_link_info *));
- boolean (*_bfd_coff_relocate_section)
+ bfd_boolean (*_bfd_coff_relocate_section)
PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *,
struct internal_reloc *, struct internal_syment *, asection **));
@@ -398,19 +398,19 @@ typedef struct
struct coff_link_hash_entry *, struct internal_syment *,
bfd_vma *));
- boolean (*_bfd_coff_adjust_symndx)
+ bfd_boolean (*_bfd_coff_adjust_symndx)
PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *,
- struct internal_reloc *, boolean *));
+ struct internal_reloc *, bfd_boolean *));
- boolean (*_bfd_coff_link_add_one_symbol)
+ bfd_boolean (*_bfd_coff_link_add_one_symbol)
PARAMS ((struct bfd_link_info *, bfd *, const char *, flagword,
- asection *, bfd_vma, const char *, boolean, boolean,
+ asection *, bfd_vma, const char *, bfd_boolean, bfd_boolean,
struct bfd_link_hash_entry **));
- boolean (*_bfd_coff_link_output_has_begun)
+ bfd_boolean (*_bfd_coff_link_output_has_begun)
PARAMS ((bfd *, struct coff_final_link_info *));
- boolean (*_bfd_coff_final_link_postscript)
+ bfd_boolean (*_bfd_coff_final_link_postscript)
PARAMS ((bfd *, struct coff_final_link_info *));
@} bfd_coff_backend_data;
@@ -480,7 +480,8 @@ typedef struct
#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))
+ ((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)\
@@ -505,7 +506,8 @@ typedef struct
((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)\
+#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))
@@ -533,7 +535,8 @@ typedef struct
#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)\
+#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))
diff --git a/contrib/binutils/bfd/doc/core.texi b/contrib/binutils/bfd/doc/core.texi
index 08a8c25..e45759c 100644
--- a/contrib/binutils/bfd/doc/core.texi
+++ b/contrib/binutils/bfd/doc/core.texi
@@ -8,7 +8,7 @@ These are functions pertaining to core files.
@subsubsection @code{bfd_core_file_failing_command}
@strong{Synopsis}
@example
-const char *bfd_core_file_failing_command(bfd *abfd);
+const char *bfd_core_file_failing_command (bfd *abfd);
@end example
@strong{Description}@*
Return a read-only string explaining which program was running
@@ -18,7 +18,7 @@ when it failed and produced the core file @var{abfd}.
@subsubsection @code{bfd_core_file_failing_signal}
@strong{Synopsis}
@example
-int bfd_core_file_failing_signal(bfd *abfd);
+int bfd_core_file_failing_signal (bfd *abfd);
@end example
@strong{Description}@*
Returns the signal number which caused the core dump which
@@ -28,11 +28,11 @@ generated the file the BFD @var{abfd} is attached to.
@subsubsection @code{core_file_matches_executable_p}
@strong{Synopsis}
@example
-boolean core_file_matches_executable_p
+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}
+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.
+@var{exec_bfd}, @code{FALSE} otherwise.
diff --git a/contrib/binutils/bfd/doc/fdl.texi b/contrib/binutils/bfd/doc/fdl.texi
new file mode 100644
index 0000000..176233c
--- /dev/null
+++ b/contrib/binutils/bfd/doc/fdl.texi
@@ -0,0 +1,366 @@
+@c -*-texinfo-*-
+@appendix GNU Free Documentation License
+@center Version 1.1, March 2000
+
+@display
+Copyright (C) 2000, Free Software Foundation, Inc.
+59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+Everyone is permitted to copy and distribute verbatim copies
+of this license document, but changing it is not allowed.
+@end display
+@sp 1
+@enumerate 0
+@item
+PREAMBLE
+
+The purpose of this License is to make a manual, textbook, or other
+written document ``free'' in the sense of freedom: to assure everyone
+the effective freedom to copy and redistribute it, with or without
+modifying it, either commercially or noncommercially. Secondarily,
+this License preserves for the author and publisher a way to get
+credit for their work, while not being considered responsible for
+modifications made by others.
+
+This License is a kind of ``copyleft'', which means that derivative
+works of the document must themselves be free in the same sense. It
+complements the GNU General Public License, which is a copyleft
+license designed for free software.
+
+We have designed this License in order to use it for manuals for free
+software, because free software needs free documentation: a free
+program should come with manuals providing the same freedoms that the
+software does. But this License is not limited to software manuals;
+it can be used for any textual work, regardless of subject matter or
+whether it is published as a printed book. We recommend this License
+principally for works whose purpose is instruction or reference.
+
+@sp 1
+@item
+APPLICABILITY AND DEFINITIONS
+
+This License applies to any manual or other work that contains a
+notice placed by the copyright holder saying it can be distributed
+under the terms of this License. The ``Document'', below, refers to any
+such manual or work. Any member of the public is a licensee, and is
+addressed as ``you.''
+
+A ``Modified Version'' of the Document means any work containing the
+Document or a portion of it, either copied verbatim, or with
+modifications and/or translated into another language.
+
+A ``Secondary Section'' is a named appendix or a front-matter section of
+the Document that deals exclusively with the relationship of the
+publishers or authors of the Document to the Document's overall subject
+(or to related matters) and contains nothing that could fall directly
+within that overall subject. (For example, if the Document is in part a
+textbook of mathematics, a Secondary Section may not explain any
+mathematics.) The relationship could be a matter of historical
+connection with the subject or with related matters, or of legal,
+commercial, philosophical, ethical or political position regarding
+them.
+
+The ``Invariant Sections'' are certain Secondary Sections whose titles
+are designated, as being those of Invariant Sections, in the notice
+that says that the Document is released under this License.
+
+The ``Cover Texts'' are certain short passages of text that are listed,
+as Front-Cover Texts or Back-Cover Texts, in the notice that says that
+the Document is released under this License.
+
+A ``Transparent'' copy of the Document means a machine-readable copy,
+represented in a format whose specification is available to the
+general public, whose contents can be viewed and edited directly and
+straightforwardly with generic text editors or (for images composed of
+pixels) generic paint programs or (for drawings) some widely available
+drawing editor, and that is suitable for input to text formatters or
+for automatic translation to a variety of formats suitable for input
+to text formatters. A copy made in an otherwise Transparent file
+format whose markup has been designed to thwart or discourage
+subsequent modification by readers is not Transparent. A copy that is
+not ``Transparent'' is called ``Opaque.''
+
+Examples of suitable formats for Transparent copies include plain
+ASCII without markup, Texinfo input format, LaTeX input format, SGML
+or XML using a publicly available DTD, and standard-conforming simple
+HTML designed for human modification. Opaque formats include
+PostScript, PDF, proprietary formats that can be read and edited only
+by proprietary word processors, SGML or XML for which the DTD and/or
+processing tools are not generally available, and the
+machine-generated HTML produced by some word processors for output
+purposes only.
+
+The ``Title Page'' means, for a printed book, the title page itself,
+plus such following pages as are needed to hold, legibly, the material
+this License requires to appear in the title page. For works in
+formats which do not have any title page as such, ``Title Page'' means
+the text near the most prominent appearance of the work's title,
+preceding the beginning of the body of the text.
+@sp 1
+@item
+VERBATIM COPYING
+
+You may copy and distribute the Document in any medium, either
+commercially or noncommercially, provided that this License, the
+copyright notices, and the license notice saying this License applies
+to the Document are reproduced in all copies, and that you add no other
+conditions whatsoever to those of this License. You may not use
+technical measures to obstruct or control the reading or further
+copying of the copies you make or distribute. However, you may accept
+compensation in exchange for copies. If you distribute a large enough
+number of copies you must also follow the conditions in section 3.
+
+You may also lend copies, under the same conditions stated above, and
+you may publicly display copies.
+@sp 1
+@item
+COPYING IN QUANTITY
+
+If you publish printed copies of the Document numbering more than 100,
+and the Document's license notice requires Cover Texts, you must enclose
+the copies in covers that carry, clearly and legibly, all these Cover
+Texts: Front-Cover Texts on the front cover, and Back-Cover Texts on
+the back cover. Both covers must also clearly and legibly identify
+you as the publisher of these copies. The front cover must present
+the full title with all words of the title equally prominent and
+visible. You may add other material on the covers in addition.
+Copying with changes limited to the covers, as long as they preserve
+the title of the Document and satisfy these conditions, can be treated
+as verbatim copying in other respects.
+
+If the required texts for either cover are too voluminous to fit
+legibly, you should put the first ones listed (as many as fit
+reasonably) on the actual cover, and continue the rest onto adjacent
+pages.
+
+If you publish or distribute Opaque copies of the Document numbering
+more than 100, you must either include a machine-readable Transparent
+copy along with each Opaque copy, or state in or with each Opaque copy
+a publicly-accessible computer-network location containing a complete
+Transparent copy of the Document, free of added material, which the
+general network-using public has access to download anonymously at no
+charge using public-standard network protocols. If you use the latter
+option, you must take reasonably prudent steps, when you begin
+distribution of Opaque copies in quantity, to ensure that this
+Transparent copy will remain thus accessible at the stated location
+until at least one year after the last time you distribute an Opaque
+copy (directly or through your agents or retailers) of that edition to
+the public.
+
+It is requested, but not required, that you contact the authors of the
+Document well before redistributing any large number of copies, to give
+them a chance to provide you with an updated version of the Document.
+@sp 1
+@item
+MODIFICATIONS
+
+You may copy and distribute a Modified Version of the Document under
+the conditions of sections 2 and 3 above, provided that you release
+the Modified Version under precisely this License, with the Modified
+Version filling the role of the Document, thus licensing distribution
+and modification of the Modified Version to whoever possesses a copy
+of it. In addition, you must do these things in the Modified Version:
+
+A. Use in the Title Page (and on the covers, if any) a title distinct
+ from that of the Document, and from those of previous versions
+ (which should, if there were any, be listed in the History section
+ of the Document). You may use the same title as a previous version
+ if the original publisher of that version gives permission.@*
+B. List on the Title Page, as authors, one or more persons or entities
+ responsible for authorship of the modifications in the Modified
+ Version, together with at least five of the principal authors of the
+ Document (all of its principal authors, if it has less than five).@*
+C. State on the Title page the name of the publisher of the
+ Modified Version, as the publisher.@*
+D. Preserve all the copyright notices of the Document.@*
+E. Add an appropriate copyright notice for your modifications
+ adjacent to the other copyright notices.@*
+F. Include, immediately after the copyright notices, a license notice
+ giving the public permission to use the Modified Version under the
+ terms of this License, in the form shown in the Addendum below.@*
+G. Preserve in that license notice the full lists of Invariant Sections
+ and required Cover Texts given in the Document's license notice.@*
+H. Include an unaltered copy of this License.@*
+I. Preserve the section entitled ``History'', and its title, and add to
+ it an item stating at least the title, year, new authors, and
+ publisher of the Modified Version as given on the Title Page. If
+ there is no section entitled ``History'' in the Document, create one
+ stating the title, year, authors, and publisher of the Document as
+ given on its Title Page, then add an item describing the Modified
+ Version as stated in the previous sentence.@*
+J. Preserve the network location, if any, given in the Document for
+ public access to a Transparent copy of the Document, and likewise
+ the network locations given in the Document for previous versions
+ it was based on. These may be placed in the ``History'' section.
+ You may omit a network location for a work that was published at
+ least four years before the Document itself, or if the original
+ publisher of the version it refers to gives permission.@*
+K. In any section entitled ``Acknowledgements'' or ``Dedications'',
+ preserve the section's title, and preserve in the section all the
+ substance and tone of each of the contributor acknowledgements
+ and/or dedications given therein.@*
+L. Preserve all the Invariant Sections of the Document,
+ unaltered in their text and in their titles. Section numbers
+ or the equivalent are not considered part of the section titles.@*
+M. Delete any section entitled ``Endorsements.'' Such a section
+ may not be included in the Modified Version.@*
+N. Do not retitle any existing section as ``Endorsements''
+ or to conflict in title with any Invariant Section.@*
+@sp 1
+If the Modified Version includes new front-matter sections or
+appendices that qualify as Secondary Sections and contain no material
+copied from the Document, you may at your option designate some or all
+of these sections as invariant. To do this, add their titles to the
+list of Invariant Sections in the Modified Version's license notice.
+These titles must be distinct from any other section titles.
+
+You may add a section entitled ``Endorsements'', provided it contains
+nothing but endorsements of your Modified Version by various
+parties--for example, statements of peer review or that the text has
+been approved by an organization as the authoritative definition of a
+standard.
+
+You may add a passage of up to five words as a Front-Cover Text, and a
+passage of up to 25 words as a Back-Cover Text, to the end of the list
+of Cover Texts in the Modified Version. Only one passage of
+Front-Cover Text and one of Back-Cover Text may be added by (or
+through arrangements made by) any one entity. If the Document already
+includes a cover text for the same cover, previously added by you or
+by arrangement made by the same entity you are acting on behalf of,
+you may not add another; but you may replace the old one, on explicit
+permission from the previous publisher that added the old one.
+
+The author(s) and publisher(s) of the Document do not by this License
+give permission to use their names for publicity for or to assert or
+imply endorsement of any Modified Version.
+@sp 1
+@item
+COMBINING DOCUMENTS
+
+You may combine the Document with other documents released under this
+License, under the terms defined in section 4 above for modified
+versions, provided that you include in the combination all of the
+Invariant Sections of all of the original documents, unmodified, and
+list them all as Invariant Sections of your combined work in its
+license notice.
+
+The combined work need only contain one copy of this License, and
+multiple identical Invariant Sections may be replaced with a single
+copy. If there are multiple Invariant Sections with the same name but
+different contents, make the title of each such section unique by
+adding at the end of it, in parentheses, the name of the original
+author or publisher of that section if known, or else a unique number.
+Make the same adjustment to the section titles in the list of
+Invariant Sections in the license notice of the combined work.
+
+In the combination, you must combine any sections entitled ``History''
+in the various original documents, forming one section entitled
+``History''; likewise combine any sections entitled ``Acknowledgements'',
+and any sections entitled ``Dedications.'' You must delete all sections
+entitled ``Endorsements.''
+@sp 1
+@item
+COLLECTIONS OF DOCUMENTS
+
+You may make a collection consisting of the Document and other documents
+released under this License, and replace the individual copies of this
+License in the various documents with a single copy that is included in
+the collection, provided that you follow the rules of this License for
+verbatim copying of each of the documents in all other respects.
+
+You may extract a single document from such a collection, and distribute
+it individually under this License, provided you insert a copy of this
+License into the extracted document, and follow this License in all
+other respects regarding verbatim copying of that document.
+@sp 1
+@item
+AGGREGATION WITH INDEPENDENT WORKS
+
+A compilation of the Document or its derivatives with other separate
+and independent documents or works, in or on a volume of a storage or
+distribution medium, does not as a whole count as a Modified Version
+of the Document, provided no compilation copyright is claimed for the
+compilation. Such a compilation is called an ``aggregate'', and this
+License does not apply to the other self-contained works thus compiled
+with the Document, on account of their being thus compiled, if they
+are not themselves derivative works of the Document.
+
+If the Cover Text requirement of section 3 is applicable to these
+copies of the Document, then if the Document is less than one quarter
+of the entire aggregate, the Document's Cover Texts may be placed on
+covers that surround only the Document within the aggregate.
+Otherwise they must appear on covers around the whole aggregate.
+@sp 1
+@item
+TRANSLATION
+
+Translation is considered a kind of modification, so you may
+distribute translations of the Document under the terms of section 4.
+Replacing Invariant Sections with translations requires special
+permission from their copyright holders, but you may include
+translations of some or all Invariant Sections in addition to the
+original versions of these Invariant Sections. You may include a
+translation of this License provided that you also include the
+original English version of this License. In case of a disagreement
+between the translation and the original English version of this
+License, the original English version will prevail.
+@sp 1
+@item
+TERMINATION
+
+You may not copy, modify, sublicense, or distribute the Document except
+as expressly provided for under this License. Any other attempt to
+copy, modify, sublicense or distribute the Document is void, and will
+automatically terminate your rights under this License. However,
+parties who have received copies, or rights, from you under this
+License will not have their licenses terminated so long as such
+parties remain in full compliance.
+@sp 1
+@item
+FUTURE REVISIONS OF THIS LICENSE
+
+The Free Software Foundation may publish new, revised versions
+of the GNU Free Documentation License from time to time. Such new
+versions will be similar in spirit to the present version, but may
+differ in detail to address new problems or concerns. See
+http://www.gnu.org/copyleft/.
+
+Each version of the License is given a distinguishing version number.
+If the Document specifies that a particular numbered version of this
+License ``or any later version'' applies to it, you have the option of
+following the terms and conditions either of that specified version or
+of any later version that has been published (not as a draft) by the
+Free Software Foundation. If the Document does not specify a version
+number of this License, you may choose any version ever published (not
+as a draft) by the Free Software Foundation.
+
+@end enumerate
+
+@unnumberedsec ADDENDUM: How to use this License for your documents
+
+To use this License in a document you have written, include a copy of
+the License in the document and put the following copyright and
+license notices just after the title page:
+
+@smallexample
+@group
+Copyright (C) @var{year} @var{your name}.
+Permission is granted to copy, distribute and/or modify this document
+under the terms of the GNU Free Documentation License, Version 1.1
+or any later version published by the Free Software Foundation;
+with the Invariant Sections being @var{list their titles}, with the
+Front-Cover Texts being @var{list}, and with the Back-Cover Texts being @var{list}.
+A copy of the license is included in the section entitled "GNU
+Free Documentation License."
+@end group
+@end smallexample
+
+If you have no Invariant Sections, write ``with no Invariant Sections''
+instead of saying which ones are invariant. If you have no
+Front-Cover Texts, write ``no Front-Cover Texts'' instead of
+``Front-Cover Texts being @var{list}''; likewise for Back-Cover Texts.
+
+If your document contains nontrivial examples of program code, we
+recommend releasing these examples in parallel under your choice of
+free software license, such as the GNU General Public License,
+to permit their use in free software.
diff --git a/contrib/binutils/bfd/doc/format.texi b/contrib/binutils/bfd/doc/format.texi
index d64bba1..32a1d75 100644
--- a/contrib/binutils/bfd/doc/format.texi
+++ b/contrib/binutils/bfd/doc/format.texi
@@ -27,7 +27,7 @@ The BFD contains the result of an executable core dump.
@subsubsection @code{bfd_check_format}
@strong{Synopsis}
@example
-boolean bfd_check_format(bfd *abfd, bfd_format format);
+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
@@ -42,7 +42,7 @@ 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}
+The function returns @code{TRUE} on success, otherwise @code{FALSE}
with one of the following error codes:
@itemize @bullet
@@ -70,10 +70,11 @@ more than one backend recognised the file format.
@subsubsection @code{bfd_check_format_matches}
@strong{Synopsis}
@example
-boolean bfd_check_format_matches(bfd *abfd, bfd_format format, char ***matching);
+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
+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,
@@ -87,7 +88,7 @@ should free it.
@subsubsection @code{bfd_set_format}
@strong{Synopsis}
@example
-boolean bfd_set_format(bfd *abfd, bfd_format format);
+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
@@ -99,7 +100,7 @@ is not open for writing, then an error occurs.
@subsubsection @code{bfd_format_string}
@strong{Synopsis}
@example
-const char *bfd_format_string(bfd_format format);
+const char *bfd_format_string (bfd_format format);
@end example
@strong{Description}@*
Return a pointer to a const string
diff --git a/contrib/binutils/bfd/doc/hash.texi b/contrib/binutils/bfd/doc/hash.texi
index eb87273..3e7372c 100644
--- a/contrib/binutils/bfd/doc/hash.texi
+++ b/contrib/binutils/bfd/doc/hash.texi
@@ -35,7 +35,7 @@ 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
+@code{bfd_hash_table_init} returns @code{FALSE} if some sort of
error occurs.
@findex bfd_hash_newfunc
@@ -61,24 +61,24 @@ been allocated for a hash table. This will not free up the
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}
+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
+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
+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
+@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.
@@ -95,7 +95,7 @@ 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
+@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
diff --git a/contrib/binutils/bfd/doc/init.texi b/contrib/binutils/bfd/doc/init.texi
index e561a77..0905f6b 100644
--- a/contrib/binutils/bfd/doc/init.texi
+++ b/contrib/binutils/bfd/doc/init.texi
@@ -5,7 +5,7 @@ These are the functions that handle initializing a BFD.
@subsubsection @code{bfd_init}
@strong{Synopsis}
@example
-void bfd_init(void);
+void bfd_init (void);
@end example
@strong{Description}@*
This routine must be called before any other BFD function to
diff --git a/contrib/binutils/bfd/doc/libbfd.texi b/contrib/binutils/bfd/doc/libbfd.texi
index b28650f..5c9ced0 100644
--- a/contrib/binutils/bfd/doc/libbfd.texi
+++ b/contrib/binutils/bfd/doc/libbfd.texi
@@ -10,7 +10,7 @@ completeness.
@subsubsection @code{bfd_write_bigendian_4byte_int}
@strong{Synopsis}
@example
-boolean bfd_write_bigendian_4byte_int (bfd *, unsigned int);
+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
@@ -43,54 +43,54 @@ To detect calling these with less than a @code{bfd_vma}, use
/* Byte swapping macros for user section data. */
#define bfd_put_8(abfd, val, ptr) \
- ((void) (*((unsigned char *) (ptr)) = (unsigned char) (val)))
+ ((void) (*((unsigned char *) (ptr)) = (val) & 0xff))
#define bfd_put_signed_8 \
- bfd_put_8
+ bfd_put_8
#define bfd_get_8(abfd, ptr) \
- (*(unsigned char *) (ptr) & 0xff)
+ (*(unsigned char *) (ptr) & 0xff)
#define bfd_get_signed_8(abfd, ptr) \
- (((*(unsigned char *) (ptr) & 0xff) ^ 0x80) - 0x80)
+ (((*(unsigned char *) (ptr) & 0xff) ^ 0x80) - 0x80)
#define bfd_put_16(abfd, val, ptr) \
- BFD_SEND(abfd, bfd_putx16, ((val),(ptr)))
+ BFD_SEND (abfd, bfd_putx16, ((val),(ptr)))
#define bfd_put_signed_16 \
- bfd_put_16
+ bfd_put_16
#define bfd_get_16(abfd, ptr) \
- BFD_SEND(abfd, bfd_getx16, (ptr))
+ BFD_SEND (abfd, bfd_getx16, (ptr))
#define bfd_get_signed_16(abfd, ptr) \
- BFD_SEND (abfd, bfd_getx_signed_16, (ptr))
+ BFD_SEND (abfd, bfd_getx_signed_16, (ptr))
#define bfd_put_32(abfd, val, ptr) \
- BFD_SEND(abfd, bfd_putx32, ((val),(ptr)))
+ BFD_SEND (abfd, bfd_putx32, ((val),(ptr)))
#define bfd_put_signed_32 \
- bfd_put_32
+ bfd_put_32
#define bfd_get_32(abfd, ptr) \
- BFD_SEND(abfd, bfd_getx32, (ptr))
+ BFD_SEND (abfd, bfd_getx32, (ptr))
#define bfd_get_signed_32(abfd, ptr) \
- BFD_SEND(abfd, bfd_getx_signed_32, (ptr))
+ BFD_SEND (abfd, bfd_getx_signed_32, (ptr))
#define bfd_put_64(abfd, val, ptr) \
- BFD_SEND(abfd, bfd_putx64, ((val), (ptr)))
+ BFD_SEND (abfd, bfd_putx64, ((val), (ptr)))
#define bfd_put_signed_64 \
- bfd_put_64
+ bfd_put_64
#define bfd_get_64(abfd, ptr) \
- BFD_SEND(abfd, bfd_getx64, (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))
+ 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
@@ -142,52 +142,24 @@ order and their data in little endian order.
#define bfd_h_get_signed_64(abfd, ptr) \
BFD_SEND (abfd, bfd_h_getx_signed_64, (ptr))
-/* Refinements on the above, which should eventually go away. Save
- cluttering the source with (bfd_vma) and (bfd_byte *) casts. */
-
-#define H_PUT_64(abfd, val, where) \
- bfd_h_put_64 ((abfd), (bfd_vma) (val), (bfd_byte *) (where))
-
-#define H_PUT_32(abfd, val, where) \
- bfd_h_put_32 ((abfd), (bfd_vma) (val), (bfd_byte *) (where))
-
-#define H_PUT_16(abfd, val, where) \
- bfd_h_put_16 ((abfd), (bfd_vma) (val), (bfd_byte *) (where))
-
-#define H_PUT_8 bfd_h_put_8
-
-#define H_PUT_S64(abfd, val, where) \
- bfd_h_put_signed_64 ((abfd), (bfd_vma) (val), (bfd_byte *) (where))
-
-#define H_PUT_S32(abfd, val, where) \
- bfd_h_put_signed_32 ((abfd), (bfd_vma) (val), (bfd_byte *) (where))
-
-#define H_PUT_S16(abfd, val, where) \
- bfd_h_put_signed_16 ((abfd), (bfd_vma) (val), (bfd_byte *) (where))
-
-#define H_PUT_S8 bfd_h_put_signed_8
-
-#define H_GET_64(abfd, where) \
- bfd_h_get_64 ((abfd), (bfd_byte *) (where))
-
-#define H_GET_32(abfd, where) \
- bfd_h_get_32 ((abfd), (bfd_byte *) (where))
-
-#define H_GET_16(abfd, where) \
- bfd_h_get_16 ((abfd), (bfd_byte *) (where))
-
-#define H_GET_8 bfd_h_get_8
-
-#define H_GET_S64(abfd, where) \
- bfd_h_get_signed_64 ((abfd), (bfd_byte *) (where))
-
-#define H_GET_S32(abfd, where) \
- bfd_h_get_signed_32 ((abfd), (bfd_byte *) (where))
-
-#define H_GET_S16(abfd, where) \
- bfd_h_get_signed_16 ((abfd), (bfd_byte *) (where))
-
-#define H_GET_S8 bfd_h_get_signed_8
+/* 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
diff --git a/contrib/binutils/bfd/doc/linker.texi b/contrib/binutils/bfd/doc/linker.texi
index 5105cc7..f2e2bc1 100644
--- a/contrib/binutils/bfd/doc/linker.texi
+++ b/contrib/binutils/bfd/doc/linker.texi
@@ -55,7 +55,7 @@ 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 relocateable
+(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
@@ -158,7 +158,7 @@ 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
+@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
@@ -229,7 +229,7 @@ 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 relocateable output, it must
+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.
@@ -266,7 +266,7 @@ 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 relocateable object file.
+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
@@ -285,7 +285,7 @@ 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 relocateable link, the
+section contents. If performing a relocatable link, the
relocs themselves must also be modified and written out.
@findex _bfd_relocate_contents
@@ -352,7 +352,7 @@ file at the end of @code{NAME(aout,final_link)}.
@subsubsection @code{bfd_link_split_section}
@strong{Synopsis}
@example
-boolean bfd_link_split_section(bfd *abfd, asection *sec);
+bfd_boolean bfd_link_split_section (bfd *abfd, asection *sec);
@end example
@strong{Description}@*
Return nonzero if @var{sec} should be split during a
diff --git a/contrib/binutils/bfd/doc/mmo.texi b/contrib/binutils/bfd/doc/mmo.texi
new file mode 100644
index 0000000..c308952
--- /dev/null
+++ b/contrib/binutils/bfd/doc/mmo.texi
@@ -0,0 +1,365 @@
+@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
index 6c778f9..8cd2ab9 100644
--- a/contrib/binutils/bfd/doc/opncls.texi
+++ b/contrib/binutils/bfd/doc/opncls.texi
@@ -5,7 +5,7 @@
@subsubsection @code{bfd_openr}
@strong{Synopsis}
@example
-bfd *bfd_openr(const char *filename, const char *target);
+bfd *bfd_openr (const char *filename, const char *target);
@end example
@strong{Description}@*
Open the file @var{filename} (using @code{fopen}) with the target
@@ -15,37 +15,38 @@ 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.
+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);
+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.
+@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.
+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.
-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 cacheing; 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}.
+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 *, PTR);
+bfd *bfd_openstreamr (const char *, const char *, void *);
@end example
@strong{Description}@*
Open a BFD for read access on an existing stdio stream. When
@@ -55,7 +56,7 @@ the BFD is passed to @code{bfd_close}, the stream will be closed.
@subsubsection @code{bfd_openw}
@strong{Synopsis}
@example
-bfd *bfd_openw(const char *filename, const char *target);
+bfd *bfd_openw (const char *filename, const char *target);
@end example
@strong{Description}@*
Create a BFD, associated with file @var{filename}, using the
@@ -68,13 +69,13 @@ Possible errors are @code{bfd_error_system_call}, @code{bfd_error_no_memory},
@subsubsection @code{bfd_close}
@strong{Synopsis}
@example
-boolean bfd_close(bfd *abfd);
+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.
+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.
@@ -82,19 +83,19 @@ 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}.
+@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
-boolean bfd_close_all_done(bfd *);
+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.
+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.
@@ -102,25 +103,24 @@ 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}.
+@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);
+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}.
+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
-boolean bfd_make_writable(bfd *abfd);
+bfd_boolean bfd_make_writable (bfd *abfd);
@end example
@strong{Description}@*
Takes a BFD as created by @code{bfd_create} and converts it
@@ -129,13 +129,13 @@ 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}.
+@code{TRUE} is returned if all is ok, otherwise @code{FALSE}.
@findex bfd_make_readable
@subsubsection @code{bfd_make_readable}
@strong{Synopsis}
@example
-boolean bfd_make_readable(bfd *abfd);
+bfd_boolean bfd_make_readable (bfd *abfd);
@end example
@strong{Description}@*
Takes a BFD as created by @code{bfd_create} and
@@ -145,15 +145,121 @@ contents out to the memory buffer, then reversing the
direction.
@strong{Returns}@*
-@code{true} is returned if all is ok, otherwise @code{false}.
+@code{TRUE} is returned if all is ok, otherwise @code{FALSE}.
@findex bfd_alloc
@subsubsection @code{bfd_alloc}
@strong{Synopsis}
@example
-PTR bfd_alloc (bfd *abfd, size_t wanted);
+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
index 1ebd430..9253a33 100644
--- a/contrib/binutils/bfd/doc/reloc.texi
+++ b/contrib/binutils/bfd/doc/reloc.texi
@@ -60,7 +60,7 @@ typedef enum bfd_reloc_status
typedef struct reloc_cache_entry
@{
/* A pointer into the canonical table of pointers. */
- struct symbol_cache_entry **sym_ptr_ptr;
+ struct bfd_symbol **sym_ptr_ptr;
/* offset in section. */
bfd_size_type address;
@@ -84,15 +84,16 @@ Here is a description of each of the fields within an @code{arelent}:
@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{get_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.
+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
@@ -254,7 +255,7 @@ information that libbfd needs to know to tie up a back end's data.
@example
-struct symbol_cache_entry; /* Forward declaration. */
+struct bfd_symbol; /* Forward declaration. */
struct reloc_howto_struct
@{
@@ -283,7 +284,7 @@ struct reloc_howto_struct
data section of the addend. The relocation function will
subtract from the relocation value the address of the location
being relocated. */
- boolean pc_relative;
+ bfd_boolean pc_relative;
/* The bit position of the reloc value in the destination.
The relocated value is left shifted by this amount. */
@@ -295,11 +296,11 @@ struct reloc_howto_struct
/* If this field is non null, then the supplied function is
called rather than the normal function. This allows really
- strange relocation methods to be accomodated (e.g., i960 callj
+ strange relocation methods to be accommodated (e.g., i960 callj
instructions). */
bfd_reloc_status_type (*special_function)
- PARAMS ((bfd *, arelent *, struct symbol_cache_entry *, PTR, asection *,
- bfd *, char **));
+ (bfd *, arelent *, struct bfd_symbol *, void *, asection *,
+ bfd *, char **);
/* The textual name of the relocation type. */
char *name;
@@ -319,21 +320,20 @@ struct reloc_howto_struct
USE_REL targets set this field to TRUE. Why this is so is peculiar
to each particular target. For relocs that aren't used in partial
links (e.g. GOT stuff) it doesn't matter what this is set to. */
- boolean partial_inplace;
-
- /* The src_mask selects which parts of the read in data
- are to be used in the relocation sum. E.g., if this was an 8 bit
- byte of data which we read and relocated, this would be
- 0x000000ff. When we have relocs which have an addend, such as
- sun4 extended relocs, the value in the offset part of a
- relocating field is garbage so we never use it. In this case
- the mask would be 0x00000000. */
+ 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;
- /* The dst_mask selects which parts of the instruction are replaced
- into the instruction. In most cases src_mask == dst_mask,
- except in the above special case, where dst_mask would be
- 0x000000ff, and src_mask would be 0x00000000. */
+ /* 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
@@ -342,7 +342,7 @@ struct reloc_howto_struct
be made just by adding in an ordinary offset (e.g., sun3 a.out).
Some formats leave the displacement part of an instruction
empty (e.g., m88k bcs); this flag signals the fact. */
- boolean pcrel_offset;
+ bfd_boolean pcrel_offset;
@};
@end example
@@ -361,7 +361,7 @@ 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)
+ NAME, FALSE, 0, 0, IN)
@end example
@@ -369,8 +369,8 @@ moment, we are compatible, so do it this way.
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)
+ HOWTO ((C), 0, 0, 0, FALSE, 0, complain_overflow_dont, NULL, \
+ NULL, FALSE, 0, 0, FALSE)
@end example
@@ -379,7 +379,7 @@ Helper routine to turn a symbol into a relocation value.
@example
#define HOWTO_PREPARE(relocation, symbol) \
@{ \
- if (symbol != (asymbol *) NULL) \
+ if (symbol != NULL) \
@{ \
if (bfd_is_com_section (symbol->section)) \
@{ \
@@ -422,8 +422,7 @@ arelent_chain;
@subsubsection @code{bfd_check_overflow}
@strong{Synopsis}
@example
-bfd_reloc_status_type
-bfd_check_overflow
+bfd_reloc_status_type bfd_check_overflow
(enum complain_overflow how,
unsigned int bitsize,
unsigned int rightshift,
@@ -441,11 +440,10 @@ Perform overflow checking on @var{relocation} which has
@subsubsection @code{bfd_perform_relocation}
@strong{Synopsis}
@example
-bfd_reloc_status_type
-bfd_perform_relocation
+bfd_reloc_status_type bfd_perform_relocation
(bfd *abfd,
arelent *reloc_entry,
- PTR data,
+ void *data,
asection *input_section,
bfd *output_bfd,
char **error_message);
@@ -470,11 +468,10 @@ this return @code{bfd_reloc_dangerous}.
@subsubsection @code{bfd_install_relocation}
@strong{Synopsis}
@example
-bfd_reloc_status_type
-bfd_install_relocation
+bfd_reloc_status_type bfd_install_relocation
(bfd *abfd,
arelent *reloc_entry,
- PTR data, bfd_vma data_start,
+ void *data, bfd_vma data_start,
asection *input_section,
char **error_message);
@end example
@@ -647,6 +644,32 @@ SPARC64 relocations
@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.
@@ -713,7 +736,7 @@ 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
+share a common GP, and the target address is adjusted for
STO_ALPHA_STD_GPLOAD.
@end deffn
@deffn {} BFD_RELOC_ALPHA_TLSGD
@@ -783,6 +806,8 @@ Relocation against a MIPS literal section.
@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
@@ -792,9 +817,48 @@ Relocation against a MIPS literal section.
@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
-MIPS ELF relocations.
+@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
@@ -826,6 +890,14 @@ i386/elf relocations
@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
@@ -909,11 +981,53 @@ Picojava relocs. Not all of these appear in object files.
@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 contructor table - at the moment
+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
@@ -938,6 +1052,7 @@ field in the instruction.
@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
@@ -1034,7 +1149,15 @@ These relocs are only used within the ARM assembler. They are not
@deffnx {} BFD_RELOC_SH_IMM_HI16
@deffnx {} BFD_RELOC_SH_IMM_HI16_PCREL
@deffnx {} BFD_RELOC_SH_PT_16
-Hitachi SH relocs. Not all of these appear in object files.
+@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
@@ -1131,7 +1254,7 @@ DLX relocs
DLX relocs
@end deffn
@deffn {} BFD_RELOC_M32R_24
-Mitsubishi M32R relocs.
+Renesas M32R (formerly Mitsubishi M32R) relocs.
This is a 24 bit absolute address.
@end deffn
@deffn {} BFD_RELOC_M32R_10_PCREL
@@ -1158,6 +1281,22 @@ This is a 16-bit reloc containing the lower 16 bits of an address.
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
@@ -1201,11 +1340,11 @@ 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-contigously in the instruction.
+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-contigously in the instruction.
+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.
@@ -1213,6 +1352,15 @@ This is a 6 bit offset from the call table base pointer.
@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.
@@ -1305,6 +1453,7 @@ These are relocations for a conditional branch instruction.
@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
@@ -1455,6 +1604,95 @@ PC relative 32 bit shifted by 1.
@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
@@ -1464,7 +1702,7 @@ 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 inheritence tree of a C++ virtual function table. 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.
@@ -1558,15 +1796,50 @@ Intel IA64 Relocations.
@end deffn
@deffn {} BFD_RELOC_M68HC11_HI8
Motorola 68HC11 reloc.
-This is the 8 bits high part of an absolute address.
+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 bits low part of an absolute address.
+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 bits of a value.
+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
@@ -1649,6 +1922,7 @@ OpenRISC Relocations.
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.
@@ -1658,6 +1932,50 @@ Sony Xstormy16 Relocations.
@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
@@ -1667,8 +1985,8 @@ typedef enum bfd_reloc_code_real bfd_reloc_code_real_type;
@subsubsection @code{bfd_reloc_type_lookup}
@strong{Synopsis}
@example
-reloc_howto_type *
-bfd_reloc_type_lookup (bfd *abfd, bfd_reloc_code_real_type code);
+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
@@ -1699,21 +2017,22 @@ Useful mainly for printing error messages.
@subsubsection @code{bfd_generic_relax_section}
@strong{Synopsis}
@example
-boolean bfd_generic_relax_section
+bfd_boolean bfd_generic_relax_section
(bfd *abfd,
asection *section,
struct bfd_link_info *,
- boolean *);
+ bfd_boolean *);
@end example
@strong{Description}@*
Provides default handling for relaxing for back ends which
-don't do relaxing -- i.e., does nothing.
+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
-boolean bfd_generic_gc_sections
+bfd_boolean bfd_generic_gc_sections
(bfd *, struct bfd_link_info *);
@end example
@strong{Description}@*
@@ -1724,7 +2043,7 @@ don't do section gc -- i.e., does nothing.
@subsubsection @code{bfd_generic_merge_sections}
@strong{Synopsis}
@example
-boolean bfd_generic_merge_sections
+bfd_boolean bfd_generic_merge_sections
(bfd *, struct bfd_link_info *);
@end example
@strong{Description}@*
@@ -1735,12 +2054,12 @@ which don't have SEC_MERGE support -- i.e., does nothing.
@subsubsection @code{bfd_generic_get_relocated_section_contents}
@strong{Synopsis}
@example
-bfd_byte *
-bfd_generic_get_relocated_section_contents (bfd *abfd,
+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,
- boolean relocateable,
+ bfd_boolean relocatable,
asymbol **symbols);
@end example
@strong{Description}@*
diff --git a/contrib/binutils/bfd/doc/section.texi b/contrib/binutils/bfd/doc/section.texi
index 971fd04..b1501f9 100644
--- a/contrib/binutils/bfd/doc/section.texi
+++ b/contrib/binutils/bfd/doc/section.texi
@@ -124,7 +124,7 @@ struct bfd_comdat_info
long symbol;
@};
-typedef struct sec
+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. */
@@ -137,7 +137,7 @@ typedef struct sec
int index;
/* The next section in the list belonging to the BFD, or NULL. */
- struct sec *next;
+ struct bfd_section *next;
/* The field flags contains attributes of the section. Some
flags are read in from the object file, and some are
@@ -335,10 +335,39 @@ typedef struct sec
/* A mark flag used by some linker backends for garbage collection. */
unsigned int gc_mark : 1;
- /* Used by the ELF code to mark sections which have been allocated
- to segments. */
+ /* 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
@@ -374,7 +403,7 @@ typedef struct sec
bfd_vma output_offset;
/* The output section through which to map on output. */
- struct sec *output_section;
+ 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). */
@@ -404,7 +433,7 @@ typedef struct sec
file_ptr line_filepos;
/* Pointer to data for applications. */
- PTR userdata;
+ void *userdata;
/* If the SEC_IN_MEMORY flag is set, this points to the actual
contents. */
@@ -422,6 +451,10 @@ typedef struct sec
/* 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;
@@ -429,7 +462,7 @@ typedef struct sec
/* What the section number is in the target world. */
int target_index;
- PTR used_by_bfd;
+ void *used_by_bfd;
/* If this is a constructor section then here is a list of the
relocations created to relocate items within it. */
@@ -439,8 +472,8 @@ typedef struct sec
bfd *owner;
/* A symbol which points at this section only. */
- struct symbol_cache_entry *symbol;
- struct symbol_cache_entry **symbol_ptr_ptr;
+ struct bfd_symbol *symbol;
+ struct bfd_symbol **symbol_ptr_ptr;
struct bfd_link_order *link_order_head;
struct bfd_link_order *link_order_tail;
@@ -457,18 +490,18 @@ typedef struct sec
#define BFD_IND_SECTION_NAME "*IND*"
/* The absolute section. */
-extern const asection bfd_abs_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 const asection bfd_und_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 const asection bfd_com_section;
+extern asection bfd_com_section;
#define bfd_com_section_ptr ((asection *) &bfd_com_section)
/* Pointer to the indirect section. */
-extern const asection bfd_ind_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)
@@ -478,13 +511,12 @@ extern const asection bfd_ind_section;
|| ((SEC) == bfd_com_section_ptr) \
|| ((SEC) == bfd_ind_section_ptr))
-extern const struct symbol_cache_entry * const bfd_abs_symbol;
-extern const struct symbol_cache_entry * const bfd_com_symbol;
-extern const struct symbol_cache_entry * const bfd_und_symbol;
-extern const struct symbol_cache_entry * const bfd_ind_symbol;
+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)->reloc_done ? (abort (), (bfd_size_type) 1) \
- : (section)->_raw_size)
+ ((section)->_raw_size)
#define bfd_get_section_size_after_reloc(section) \
((section)->reloc_done ? (section)->_cooked_size \
: (abort (), (bfd_size_type) 1))
@@ -534,7 +566,7 @@ hash table entries.
@subsubsection @code{bfd_get_section_by_name}
@strong{Synopsis}
@example
-asection *bfd_get_section_by_name(bfd *abfd, const char *name);
+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
@@ -550,9 +582,8 @@ or something else) for each section.
@subsubsection @code{bfd_get_unique_section_name}
@strong{Synopsis}
@example
-char *bfd_get_unique_section_name(bfd *abfd,
- const char *templat,
- int *count);
+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
@@ -565,7 +596,7 @@ pointed to by @var{count} will be incremented in this case.
@subsubsection @code{bfd_make_section_old_way}
@strong{Synopsis}
@example
-asection *bfd_make_section_old_way(bfd *abfd, const char *name);
+asection *bfd_make_section_old_way (bfd *abfd, const char *name);
@end example
@strong{Description}@*
Create a new empty section called @var{name}
@@ -592,7 +623,7 @@ If memory allocation fails.
@subsubsection @code{bfd_make_section_anyway}
@strong{Synopsis}
@example
-asection *bfd_make_section_anyway(bfd *abfd, const char *name);
+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
@@ -612,7 +643,7 @@ Return @code{NULL} and set @code{bfd_error} on error; possible errors are:
@subsubsection @code{bfd_make_section}
@strong{Synopsis}
@example
-asection *bfd_make_section(bfd *, const char *name);
+asection *bfd_make_section (bfd *, const char *name);
@end example
@strong{Description}@*
Like @code{bfd_make_section_anyway}, but return @code{NULL} (without calling
@@ -624,12 +655,13 @@ section named @var{name}. If there is an error, return @code{NULL} and set
@subsubsection @code{bfd_set_section_flags}
@strong{Synopsis}
@example
-boolean bfd_set_section_flags(bfd *abfd, asection *sec, flagword flags);
+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:
+@var{abfd} to the value @var{flags}. Return @code{TRUE} on success,
+@code{FALSE} on error. Possible error returns are:
@itemize @bullet
@@ -644,11 +676,10 @@ have the @code{SEC_HAS_CONTENTS} field set.
@subsubsection @code{bfd_map_over_sections}
@strong{Synopsis}
@example
-void bfd_map_over_sections(bfd *abfd,
- void (*func) (bfd *abfd,
- asection *sect,
- PTR obj),
- PTR obj);
+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
@@ -656,27 +687,28 @@ 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);
+ func (abfd, the_section, obj);
@end example
-This is the prefered method for iterating over sections; an
+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, ...)
+ func (abfd, p, ...)
@end example
@findex bfd_set_section_size
@subsubsection @code{bfd_set_section_size}
@strong{Synopsis}
@example
-boolean bfd_set_section_size(bfd *abfd, asection *sec, bfd_size_type val);
+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}.
+ok, then @code{TRUE} is returned, else @code{FALSE}.
Possible error returns:
@itemize @bullet
@@ -690,9 +722,9 @@ Writing has started to the BFD, so setting the size is invalid.
@subsubsection @code{bfd_set_section_contents}
@strong{Synopsis}
@example
-boolean bfd_set_section_contents (bfd *abfd, asection *section,
- PTR data, file_ptr offset,
- bfd_size_type count);
+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
@@ -700,7 +732,7 @@ Sets the contents of the section @var{section} in BFD
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
+Normally @code{TRUE} is returned, else @code{FALSE}. Possible error
returns are:
@itemize @bullet
@@ -718,8 +750,8 @@ This routine is front end to the back end function
@subsubsection @code{bfd_get_section_contents}
@strong{Synopsis}
@example
-boolean bfd_get_section_contents (bfd *abfd, asection *section,
- PTR location, file_ptr offset,
+bfd_boolean bfd_get_section_contents
+ (bfd *abfd, asection *section, void *location, file_ptr offset,
bfd_size_type count);
@end example
@strong{Description}@*
@@ -731,20 +763,20 @@ 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}.
+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
-boolean bfd_copy_private_section_data (bfd *ibfd, asection *isec,
- bfd *obfd, asection *osec);
+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
+Return @code{TRUE} on success, @code{FALSE} on error. Possible error
returns are:
@itemize @bullet
@@ -778,7 +810,7 @@ to remove sections.
@subsubsection @code{bfd_generic_discard_group}
@strong{Synopsis}
@example
-boolean bfd_generic_discard_group (bfd *abfd, asection *group);
+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
index cb29e7d..415d156 100644
--- a/contrib/binutils/bfd/doc/syms.texi
+++ b/contrib/binutils/bfd/doc/syms.texi
@@ -47,10 +47,10 @@ excerpt from an application which reads the symbol table:
if (storage_needed < 0)
FAIL
- if (storage_needed == 0) @{
- return ;
- @}
- symbol_table = (asymbol **) xmalloc (storage_needed);
+ if (storage_needed == 0)
+ return;
+
+ symbol_table = xmalloc (storage_needed);
...
number_of_symbols =
bfd_canonicalize_symtab (abfd, symbol_table);
@@ -58,9 +58,8 @@ excerpt from an application which reads the symbol table:
if (number_of_symbols < 0)
FAIL
- for (i = 0; i < number_of_symbols; i++) @{
- process_symbol (symbol_table[i]);
- @}
+ 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
@@ -80,25 +79,26 @@ example showing the creation of a symbol table with only one element:
@example
#include "bfd.h"
- main()
+ 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);
+ 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->section = bfd_make_section_old_way (abfd, ".text");
new->flags = BSF_GLOBAL;
new->value = 0x12345;
ptrs[0] = new;
- ptrs[1] = (asymbol *)0;
+ ptrs[1] = 0;
- bfd_set_symtab(abfd, ptrs, 1);
- bfd_close(abfd);
+ bfd_set_symtab (abfd, ptrs, 1);
+ bfd_close (abfd);
+ return 0;
@}
./makesym
@@ -106,9 +106,9 @@ example showing the creation of a symbol table with only one element:
00012345 A dummy_symbol
@end example
-Many formats cannot represent arbitary symbol information; for
+Many formats cannot represent arbitrary symbol information; for
instance, the @code{a.out} object format does not allow an
-arbitary number of sections. A symbol pointing to a section
+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.
@@ -139,7 +139,7 @@ An @code{asymbol} has the form:
@example
-typedef struct symbol_cache_entry
+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
@@ -150,7 +150,7 @@ typedef struct symbol_cache_entry
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. */
+ 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. */
@@ -180,7 +180,7 @@ typedef struct symbol_cache_entry
@code{BSF_LOCAL}, @code{BSF_FORT_COMM}, @code{BSF_UNDEFINED} or
@code{BSF_GLOBAL}. */
- /* The symbol is a debugging record. The value has an arbitary
+ /* The symbol is a debugging record. The value has an arbitrary
meaning, unless BSF_DEBUGGING_RELOC is also set. */
#define BSF_DEBUGGING 0x08
@@ -251,12 +251,12 @@ typedef struct symbol_cache_entry
/* 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 sec *section;
+ struct bfd_section *section;
/* Back end special data. */
union
@{
- PTR p;
+ void *p;
bfd_vma i;
@}
udata;
@@ -286,26 +286,26 @@ the BFD, then return 0. If an error occurs, return -1.
@subsubsection @code{bfd_is_local_label}
@strong{Synopsis}
@example
-boolean bfd_is_local_label(bfd *abfd, asymbol *sym);
+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.
+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
-boolean bfd_is_local_label_name(bfd *abfd, const char *name);
+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
+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
+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))
+ BFD_SEND (abfd, _bfd_is_local_label_name, (abfd, name))
@end example
@@ -319,8 +319,7 @@ 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))
+ BFD_SEND (abfd, _bfd_canonicalize_symtab, (abfd, location))
@end example
@@ -328,7 +327,8 @@ including the NULL.
@subsubsection @code{bfd_set_symtab}
@strong{Synopsis}
@example
-boolean bfd_set_symtab (bfd *abfd, asymbol **location, unsigned int count);
+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,
@@ -339,7 +339,7 @@ will be written.
@subsubsection @code{bfd_print_symbol_vandf}
@strong{Synopsis}
@example
-void bfd_print_symbol_vandf(bfd *abfd, PTR file, asymbol *symbol);
+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
@@ -357,7 +357,7 @@ information surrounding the @code{asymbol}. Building your own
information, and will cause problems later on.
@example
#define bfd_make_empty_symbol(abfd) \
- BFD_SEND (abfd, _bfd_make_empty_symbol, (abfd))
+ BFD_SEND (abfd, _bfd_make_empty_symbol, (abfd))
@end example
@@ -381,7 +381,7 @@ 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))
+ BFD_SEND (abfd, _bfd_make_debug_symbol, (abfd, ptr, size))
@end example
@@ -393,7 +393,7 @@ class of @var{symbol}, or '?' for an unknown class.
@strong{Synopsis}
@example
-int bfd_decode_symclass(asymbol *symbol);
+int bfd_decode_symclass (asymbol *symbol);
@end example
@findex bfd_is_undefined_symclass
@subsubsection @code{bfd_is_undefined_symclass}
@@ -404,7 +404,7 @@ Returns zero otherwise.
@strong{Synopsis}
@example
-boolean bfd_is_undefined_symclass (int symclass);
+bfd_boolean bfd_is_undefined_symclass (int symclass);
@end example
@findex bfd_symbol_info
@subsubsection @code{bfd_symbol_info}
@@ -415,18 +415,19 @@ calling this function.
@strong{Synopsis}
@example
-void bfd_symbol_info(asymbol *symbol, symbol_info *ret);
+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
-boolean bfd_copy_private_symbol_data(bfd *ibfd, asymbol *isym, bfd *obfd, asymbol *osym);
+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
+Return @code{TRUE} on success, @code{FALSE} on error. Possible error
returns are:
@itemize @bullet
@@ -437,8 +438,8 @@ 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))
+ 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
index 5b8d2b8..9b499cf 100644
--- a/contrib/binutils/bfd/doc/targets.texi
+++ b/contrib/binutils/bfd/doc/targets.texi
@@ -2,7 +2,7 @@
@strong{Description}@*
-Each port of BFD to a different machine requries the creation
+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
@@ -50,7 +50,7 @@ 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.
+@code{bfd_check_format} returns @code{TRUE} when the caller guesses right.
@menu
* bfd_target::
@end menu
@@ -79,7 +79,7 @@ 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)
+ ((*((bfd)->xvec->message)) arglist)
#ifdef DEBUG_BFD_SEND
#undef BFD_SEND
@@ -92,7 +92,7 @@ someone wants to fix this and not break the above, please do.
For operations which index on the BFD format:
@example
#define BFD_SEND_FMT(bfd, message, arglist) \
- (((bfd)->xvec->message[(int) ((bfd)->format)]) arglist)
+ (((bfd)->xvec->message[(int) ((bfd)->format)]) arglist)
#ifdef DEBUG_BFD_SEND
#undef BFD_SEND_FMT
@@ -132,7 +132,11 @@ enum bfd_flavour
bfd_target_msdos_flavour,
bfd_target_ovax_flavour,
bfd_target_evax_flavour,
- bfd_target_mmo_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 @};
@@ -176,38 +180,38 @@ typedef struct bfd_target
/* 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_vma (*bfd_getx64) PARAMS ((const bfd_byte *));
- bfd_signed_vma (*bfd_getx_signed_64) PARAMS ((const bfd_byte *));
- void (*bfd_putx64) PARAMS ((bfd_vma, bfd_byte *));
- bfd_vma (*bfd_getx32) PARAMS ((const bfd_byte *));
- bfd_signed_vma (*bfd_getx_signed_32) PARAMS ((const bfd_byte *));
- void (*bfd_putx32) PARAMS ((bfd_vma, bfd_byte *));
- bfd_vma (*bfd_getx16) PARAMS ((const bfd_byte *));
- bfd_signed_vma (*bfd_getx_signed_16) PARAMS ((const bfd_byte *));
- void (*bfd_putx16) PARAMS ((bfd_vma, bfd_byte *));
+ 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_vma (*bfd_h_getx64) PARAMS ((const bfd_byte *));
- bfd_signed_vma (*bfd_h_getx_signed_64) PARAMS ((const bfd_byte *));
- void (*bfd_h_putx64) PARAMS ((bfd_vma, bfd_byte *));
- bfd_vma (*bfd_h_getx32) PARAMS ((const bfd_byte *));
- bfd_signed_vma (*bfd_h_getx_signed_32) PARAMS ((const bfd_byte *));
- void (*bfd_h_putx32) PARAMS ((bfd_vma, bfd_byte *));
- bfd_vma (*bfd_h_getx16) PARAMS ((const bfd_byte *));
- bfd_signed_vma (*bfd_h_getx_signed_16) PARAMS ((const bfd_byte *));
- void (*bfd_h_putx16) PARAMS ((bfd_vma, bfd_byte *));
+ 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]) PARAMS ((bfd *));
+ const struct bfd_target *(*_bfd_check_format[bfd_type_end]) (bfd *);
/* Set the format of a file being written. */
- boolean (*_bfd_set_format[bfd_type_end]) PARAMS ((bfd *));
+ bfd_boolean (*_bfd_set_format[bfd_type_end]) (bfd *);
/* Write cached information into a file being written, at @code{bfd_close}. */
- boolean (*_bfd_write_contents[bfd_type_end]) PARAMS ((bfd *));
+ bfd_boolean (*_bfd_write_contents[bfd_type_end]) (bfd *);
@end example
The general target vector. These vectors are initialized using the
@@ -215,227 +219,229 @@ BFD_JUMP_TABLE macros.
@example
/* Generic entry points. */
-@end example
-Do not "beautify" the CONCAT* macro args. Traditional C will not
-remove whitespace added here, and thus will fail to concatenate
-the tokens.
-@example
#define BFD_JUMP_TABLE_GENERIC(NAME) \
-CONCAT2 (NAME,_close_and_cleanup), \
-CONCAT2 (NAME,_bfd_free_cached_info), \
-CONCAT2 (NAME,_new_section_hook), \
-CONCAT2 (NAME,_get_section_contents), \
-CONCAT2 (NAME,_get_section_contents_in_window)
+ 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. */
- boolean (*_close_and_cleanup) PARAMS ((bfd *));
+ bfd_boolean (*_close_and_cleanup) (bfd *);
/* Ask the BFD to free all cached information. */
- boolean (*_bfd_free_cached_info) PARAMS ((bfd *));
+ bfd_boolean (*_bfd_free_cached_info) (bfd *);
/* Called when a new section is created. */
- boolean (*_new_section_hook) PARAMS ((bfd *, sec_ptr));
+ bfd_boolean (*_new_section_hook) (bfd *, sec_ptr);
/* Read the contents of a section. */
- boolean (*_bfd_get_section_contents) PARAMS ((bfd *, sec_ptr, PTR,
- file_ptr, bfd_size_type));
- boolean (*_bfd_get_section_contents_in_window)
- PARAMS ((bfd *, sec_ptr, bfd_window *, file_ptr, bfd_size_type));
+ 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) \
-CONCAT2 (NAME,_bfd_copy_private_bfd_data), \
-CONCAT2 (NAME,_bfd_merge_private_bfd_data), \
-CONCAT2 (NAME,_bfd_copy_private_section_data), \
-CONCAT2 (NAME,_bfd_copy_private_symbol_data), \
-CONCAT2 (NAME,_bfd_set_private_flags), \
-CONCAT2 (NAME,_bfd_print_private_bfd_data) \
+ 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. */
- boolean (*_bfd_copy_private_bfd_data) PARAMS ((bfd *, bfd *));
+ 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. */
- boolean (*_bfd_merge_private_bfd_data) PARAMS ((bfd *, bfd *));
+ bfd_boolean (*_bfd_merge_private_bfd_data) (bfd *, bfd *);
/* Called to copy BFD private section data from one object file
to another. */
- boolean (*_bfd_copy_private_section_data) PARAMS ((bfd *, sec_ptr,
- bfd *, sec_ptr));
+ 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. */
- boolean (*_bfd_copy_private_symbol_data) PARAMS ((bfd *, asymbol *,
- bfd *, asymbol *));
+ bfd_boolean (*_bfd_copy_private_symbol_data)
+ (bfd *, asymbol *, bfd *, asymbol *);
/* Called to set private backend flags. */
- boolean (*_bfd_set_private_flags) PARAMS ((bfd *, flagword));
+ bfd_boolean (*_bfd_set_private_flags) (bfd *, flagword);
/* Called to print private BFD data. */
- boolean (*_bfd_print_private_bfd_data) PARAMS ((bfd *, PTR));
+ bfd_boolean (*_bfd_print_private_bfd_data) (bfd *, void *);
/* Core file entry points. */
#define BFD_JUMP_TABLE_CORE(NAME) \
-CONCAT2 (NAME,_core_file_failing_command), \
-CONCAT2 (NAME,_core_file_failing_signal), \
-CONCAT2 (NAME,_core_file_matches_executable_p)
- char * (*_core_file_failing_command) PARAMS ((bfd *));
- int (*_core_file_failing_signal) PARAMS ((bfd *));
- boolean (*_core_file_matches_executable_p) PARAMS ((bfd *, bfd *));
+ 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) \
-CONCAT2 (NAME,_slurp_armap), \
-CONCAT2 (NAME,_slurp_extended_name_table), \
-CONCAT2 (NAME,_construct_extended_name_table), \
-CONCAT2 (NAME,_truncate_arname), \
-CONCAT2 (NAME,_write_armap), \
-CONCAT2 (NAME,_read_ar_hdr), \
-CONCAT2 (NAME,_openr_next_archived_file), \
-CONCAT2 (NAME,_get_elt_at_index), \
-CONCAT2 (NAME,_generic_stat_arch_elt), \
-CONCAT2 (NAME,_update_armap_timestamp)
- boolean (*_bfd_slurp_armap) PARAMS ((bfd *));
- boolean (*_bfd_slurp_extended_name_table) PARAMS ((bfd *));
- boolean (*_bfd_construct_extended_name_table)
- PARAMS ((bfd *, char **, bfd_size_type *, const char **));
- void (*_bfd_truncate_arname) PARAMS ((bfd *, const char *, char *));
- boolean (*write_armap)
- PARAMS ((bfd *, unsigned int, struct orl *, unsigned int, int));
- PTR (*_bfd_read_ar_hdr_fn) PARAMS ((bfd *));
- bfd * (*openr_next_archived_file) PARAMS ((bfd *, bfd *));
-#define bfd_get_elt_at_index(b,i) BFD_SEND(b, _bfd_get_elt_at_index, (b,i))
- bfd * (*_bfd_get_elt_at_index) PARAMS ((bfd *, symindex));
- int (*_bfd_stat_arch_elt) PARAMS ((bfd *, struct stat *));
- boolean (*_bfd_update_armap_timestamp) PARAMS ((bfd *));
+ 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) \
-CONCAT2 (NAME,_get_symtab_upper_bound), \
-CONCAT2 (NAME,_get_symtab), \
-CONCAT2 (NAME,_make_empty_symbol), \
-CONCAT2 (NAME,_print_symbol), \
-CONCAT2 (NAME,_get_symbol_info), \
-CONCAT2 (NAME,_bfd_is_local_label_name), \
-CONCAT2 (NAME,_get_lineno), \
-CONCAT2 (NAME,_find_nearest_line), \
-CONCAT2 (NAME,_bfd_make_debug_symbol), \
-CONCAT2 (NAME,_read_minisymbols), \
-CONCAT2 (NAME,_minisymbol_to_symbol)
- long (*_bfd_get_symtab_upper_bound) PARAMS ((bfd *));
- long (*_bfd_canonicalize_symtab) PARAMS ((bfd *,
- struct symbol_cache_entry **));
- struct symbol_cache_entry *
- (*_bfd_make_empty_symbol) PARAMS ((bfd *));
- void (*_bfd_print_symbol) PARAMS ((bfd *, PTR,
- struct symbol_cache_entry *,
- bfd_print_symbol_type));
-#define bfd_print_symbol(b,p,s,e) BFD_SEND(b, _bfd_print_symbol, (b,p,s,e))
- void (*_bfd_get_symbol_info) PARAMS ((bfd *,
- struct symbol_cache_entry *,
- symbol_info *));
-#define bfd_get_symbol_info(b,p,e) BFD_SEND(b, _bfd_get_symbol_info, (b,p,e))
- boolean (*_bfd_is_local_label_name) PARAMS ((bfd *, const char *));
-
- alent * (*_get_lineno) PARAMS ((bfd *, struct symbol_cache_entry *));
- boolean (*_bfd_find_nearest_line)
- PARAMS ((bfd *, struct sec *, struct symbol_cache_entry **, bfd_vma,
- const char **, const char **, unsigned int *));
+ 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) PARAMS ((bfd *, void *,
- unsigned long size));
+ 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) PARAMS ((bfd *, boolean, PTR *,
- unsigned int *));
+ 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) PARAMS ((bfd *, boolean, const PTR,
- asymbol *));
+ asymbol * (*_minisymbol_to_symbol)
+ (bfd *, bfd_boolean, const void *, asymbol *);
/* Routines for relocs. */
#define BFD_JUMP_TABLE_RELOCS(NAME) \
-CONCAT2 (NAME,_get_reloc_upper_bound), \
-CONCAT2 (NAME,_canonicalize_reloc), \
-CONCAT2 (NAME,_bfd_reloc_type_lookup)
- long (*_get_reloc_upper_bound) PARAMS ((bfd *, sec_ptr));
- long (*_bfd_canonicalize_reloc) PARAMS ((bfd *, sec_ptr, arelent **,
- struct symbol_cache_entry **));
+ 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) PARAMS ((bfd *, bfd_reloc_code_real_type));
+ (*reloc_type_lookup) (bfd *, bfd_reloc_code_real_type);
/* Routines used when writing an object file. */
#define BFD_JUMP_TABLE_WRITE(NAME) \
-CONCAT2 (NAME,_set_arch_mach), \
-CONCAT2 (NAME,_set_section_contents)
- boolean (*_bfd_set_arch_mach) PARAMS ((bfd *, enum bfd_architecture,
- unsigned long));
- boolean (*_bfd_set_section_contents) PARAMS ((bfd *, sec_ptr, PTR,
- file_ptr, bfd_size_type));
+ 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) \
-CONCAT2 (NAME,_sizeof_headers), \
-CONCAT2 (NAME,_bfd_get_relocated_section_contents), \
-CONCAT2 (NAME,_bfd_relax_section), \
-CONCAT2 (NAME,_bfd_link_hash_table_create), \
-CONCAT2 (NAME,_bfd_link_hash_table_free), \
-CONCAT2 (NAME,_bfd_link_add_symbols), \
-CONCAT2 (NAME,_bfd_link_just_syms), \
-CONCAT2 (NAME,_bfd_final_link), \
-CONCAT2 (NAME,_bfd_link_split_section), \
-CONCAT2 (NAME,_bfd_gc_sections), \
-CONCAT2 (NAME,_bfd_merge_sections), \
-CONCAT2 (NAME,_bfd_discard_group)
- int (*_bfd_sizeof_headers) PARAMS ((bfd *, boolean));
- bfd_byte *(*_bfd_get_relocated_section_contents)
- PARAMS ((bfd *, struct bfd_link_info *, struct bfd_link_order *,
- bfd_byte *, boolean, struct symbol_cache_entry **));
-
- boolean (*_bfd_relax_section)
- PARAMS ((bfd *, struct sec *, struct bfd_link_info *, boolean *));
+ 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) PARAMS ((bfd *));
+ 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) PARAMS ((struct bfd_link_hash_table *));
+ void (*_bfd_link_hash_table_free) (struct bfd_link_hash_table *);
/* Add symbols from this object file into the hash table. */
- boolean (*_bfd_link_add_symbols) PARAMS ((bfd *, struct bfd_link_info *));
+ 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) PARAMS ((asection *, struct bfd_link_info *));
+ 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. */
- boolean (*_bfd_final_link) PARAMS ((bfd *, struct bfd_link_info *));
+ bfd_boolean (*_bfd_final_link) (bfd *, struct bfd_link_info *);
/* Should this section be split up into smaller pieces during linking. */
- boolean (*_bfd_link_split_section) PARAMS ((bfd *, struct sec *));
+ bfd_boolean (*_bfd_link_split_section) (bfd *, struct bfd_section *);
/* Remove sections that are not referenced from the output. */
- boolean (*_bfd_gc_sections) PARAMS ((bfd *, struct bfd_link_info *));
+ bfd_boolean (*_bfd_gc_sections) (bfd *, struct bfd_link_info *);
/* Attempt to merge SEC_MERGE sections. */
- boolean (*_bfd_merge_sections) PARAMS ((bfd *, struct bfd_link_info *));
+ bfd_boolean (*_bfd_merge_sections) (bfd *, struct bfd_link_info *);
/* Discard members of a group. */
- boolean (*_bfd_discard_group) PARAMS ((bfd *, struct sec *));
+ bfd_boolean (*_bfd_discard_group) (bfd *, struct bfd_section *);
/* Routines to handle dynamic symbols and relocs. */
#define BFD_JUMP_TABLE_DYNAMIC(NAME) \
-CONCAT2 (NAME,_get_dynamic_symtab_upper_bound), \
-CONCAT2 (NAME,_canonicalize_dynamic_symtab), \
-CONCAT2 (NAME,_get_dynamic_reloc_upper_bound), \
-CONCAT2 (NAME,_canonicalize_dynamic_reloc)
+ 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) PARAMS ((bfd *));
+ long (*_bfd_get_dynamic_symtab_upper_bound) (bfd *);
/* Read in the dynamic symbols. */
- long (*_bfd_canonicalize_dynamic_symtab)
- PARAMS ((bfd *, struct symbol_cache_entry **));
+ 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) PARAMS ((bfd *));
+ long (*_bfd_get_dynamic_reloc_upper_bound) (bfd *);
/* Read in the dynamic relocs. */
- long (*_bfd_canonicalize_dynamic_reloc)
- PARAMS ((bfd *, arelent **, struct symbol_cache_entry **));
+ 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
@@ -449,7 +455,7 @@ to find an alternative output format that is suitable.
/* Data for use by back-end routines, which isn't
generic enough to belong in this structure. */
- PTR backend_data;
+ const void *backend_data;
@} bfd_target;
@@ -459,7 +465,7 @@ to find an alternative output format that is suitable.
@subsubsection @code{bfd_set_default_target}
@strong{Synopsis}
@example
-boolean bfd_set_default_target (const char *name);
+bfd_boolean bfd_set_default_target (const char *name);
@end example
@strong{Description}@*
Set the default target vector to use when recognizing a BFD.
@@ -470,7 +476,7 @@ name or a configuration triplet.
@subsubsection @code{bfd_find_target}
@strong{Synopsis}
@example
-const bfd_target *bfd_find_target(const char *target_name, bfd *abfd);
+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
@@ -487,7 +493,7 @@ targets to find the one that matches the file being read.
@subsubsection @code{bfd_target_list}
@strong{Synopsis}
@example
-const char **bfd_target_list(void);
+const char ** bfd_target_list (void);
@end example
@strong{Description}@*
Return a freshly malloced NULL-terminated
@@ -498,7 +504,9 @@ modify the names.
@subsubsection @code{bfd_seach_for_target}
@strong{Synopsis}
@example
-const bfd_target * bfd_search_for_target (int (* search_func) (const bfd_target *, void *), void *);
+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
diff --git a/contrib/binutils/bfd/dwarf1.c b/contrib/binutils/bfd/dwarf1.c
index 6531986..1047ebf 100644
--- a/contrib/binutils/bfd/dwarf1.c
+++ b/contrib/binutils/bfd/dwarf1.c
@@ -1,5 +1,5 @@
/* DWARF 1 find nearest line (_bfd_dwarf1_find_nearest_line).
- Copyright 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
+ Copyright 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
Written by Gavin Romig-Koch of Cygnus Solutions (gavin@cygnus.com).
@@ -126,15 +126,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_unit *alloc_dwarf1_unit
+ PARAMS ((struct dwarf1_debug *));
static struct dwarf1_func *alloc_dwarf1_func
PARAMS ((struct dwarf1_debug *, struct dwarf1_unit *));
-static boolean parse_die PARAMS ((bfd *, struct die_info *, char *, char *));
-static boolean parse_line_table
+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 boolean parse_functions_in_unit
+static bfd_boolean parse_functions_in_unit
PARAMS ((struct dwarf1_debug *, struct dwarf1_unit *));
-static boolean dwarf1_unit_find_nearest_line
+static bfd_boolean dwarf1_unit_find_nearest_line
PARAMS ((struct dwarf1_debug *, struct dwarf1_unit *, unsigned long,
const char **, const char **, unsigned int *));
@@ -176,9 +178,9 @@ alloc_dwarf1_func (stash, aUnit)
'abfd' must be the bfd from which the section that 'aDiePtr'
points to was pulled from.
- Return false if the die is invalidly formatted; true otherwise. */
+ Return FALSE if the die is invalidly formatted; TRUE otherwise. */
-static boolean
+static bfd_boolean
parse_die (abfd, aDieInfo, aDiePtr, aDiePtrEnd)
bfd* abfd;
struct die_info* aDieInfo;
@@ -195,12 +197,12 @@ parse_die (abfd, aDieInfo, aDiePtr, aDiePtrEnd)
xptr += 4;
if (aDieInfo->length == 0
|| (this_die + aDieInfo->length) >= aDiePtrEnd)
- return false;
+ return FALSE;
if (aDieInfo->length < 6)
{
/* Just padding bytes. */
aDieInfo->tag = TAG_padding;
- return true;
+ return TRUE;
}
/* Then the tag. */
@@ -259,14 +261,14 @@ parse_die (abfd, aDieInfo, aDiePtr, aDiePtrEnd)
}
}
- return true;
+ return TRUE;
}
/* Parse a dwarf1 line number table for 'aUnit->stmt_list_offset'
- into 'aUnit->linenumber_table'. Return false if an error
- occurs; true otherwise. */
+ into 'aUnit->linenumber_table'. Return FALSE if an error
+ occurs; TRUE otherwise. */
-static boolean
+static bfd_boolean
parse_line_table (stash, aUnit)
struct dwarf1_debug* stash;
struct dwarf1_unit* aUnit;
@@ -281,19 +283,19 @@ parse_line_table (stash, aUnit)
msec = bfd_get_section_by_name (stash->abfd, ".line");
if (! msec)
- return false;
+ return FALSE;
size = bfd_get_section_size_before_reloc (msec);
stash->line_section = (char *) bfd_alloc (stash->abfd, size);
if (! stash->line_section)
- return false;
+ return FALSE;
if (! bfd_get_section_contents (stash->abfd, msec, stash->line_section,
(bfd_vma) 0, size))
{
stash->line_section = 0;
- return false;
+ return FALSE;
}
stash->line_section_end = stash->line_section + size;
@@ -341,15 +343,15 @@ parse_line_table (stash, aUnit)
}
}
- return true;
+ return TRUE;
}
/* Parse each function die in a compilation unit 'aUnit'.
The first child die of 'aUnit' should be in 'aUnit->first_child',
the result is placed in 'aUnit->func_list'.
- Return false if error; true otherwise. */
+ Return FALSE if error; TRUE otherwise. */
-static boolean
+static bfd_boolean
parse_functions_in_unit (stash, aUnit)
struct dwarf1_debug* stash;
struct dwarf1_unit* aUnit;
@@ -365,7 +367,7 @@ parse_functions_in_unit (stash, aUnit)
if (! parse_die (stash->abfd, &eachDieInfo, eachDie,
stash->debug_section_end))
- return false;
+ return FALSE;
if (eachDieInfo.tag == TAG_global_subroutine
|| eachDieInfo.tag == TAG_subroutine
@@ -386,13 +388,13 @@ parse_functions_in_unit (stash, aUnit)
break;
}
- return true;
+ return TRUE;
}
/* Find the nearest line to 'addr' in 'aUnit'.
Return whether we found the line (or a function) without error. */
-static boolean
+static bfd_boolean
dwarf1_unit_find_nearest_line (stash, aUnit, addr,
filename_ptr, functionname_ptr,
linenumber_ptr)
@@ -403,8 +405,8 @@ dwarf1_unit_find_nearest_line (stash, aUnit, addr,
const char **functionname_ptr;
unsigned int *linenumber_ptr;
{
- int line_p = false;
- int func_p = false;
+ int line_p = FALSE;
+ int func_p = FALSE;
if (aUnit->low_pc <= addr && addr < aUnit->high_pc)
{
@@ -416,13 +418,13 @@ dwarf1_unit_find_nearest_line (stash, aUnit, addr,
if (! aUnit->linenumber_table)
{
if (! parse_line_table (stash, aUnit))
- return false;
+ return FALSE;
}
if (! aUnit->func_list)
{
if (! parse_functions_in_unit (stash, aUnit))
- return false;
+ return FALSE;
}
for (i = 0; i < aUnit->line_count; i++)
@@ -432,7 +434,7 @@ dwarf1_unit_find_nearest_line (stash, aUnit, addr,
{
*filename_ptr = aUnit->name;
*linenumber_ptr = aUnit->linenumber_table[i].linenumber;
- line_p = true;
+ line_p = TRUE;
break;
}
}
@@ -445,7 +447,7 @@ dwarf1_unit_find_nearest_line (stash, aUnit, addr,
&& addr < eachFunc->high_pc)
{
*functionname_ptr = eachFunc->name;
- func_p = true;
+ func_p = TRUE;
break;
}
}
@@ -456,9 +458,9 @@ dwarf1_unit_find_nearest_line (stash, aUnit, addr,
}
/* The DWARF 1 version of find_nearest line.
- Return true if the line is found without error. */
+ Return TRUE if the line is found without error. */
-boolean
+bfd_boolean
_bfd_dwarf1_find_nearest_line (abfd, section, symbols, offset,
filename_ptr, functionname_ptr, linenumber_ptr)
bfd *abfd;
@@ -489,7 +491,7 @@ _bfd_dwarf1_find_nearest_line (abfd, section, symbols, offset,
= (struct dwarf1_debug *) bfd_zalloc (abfd, size);
if (! stash)
- return false;
+ return FALSE;
msec = bfd_get_section_by_name (abfd, ".debug");
if (! msec)
@@ -497,20 +499,20 @@ _bfd_dwarf1_find_nearest_line (abfd, section, symbols, offset,
/* 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;
+ return FALSE;
}
size = bfd_get_section_size_before_reloc (msec);
stash->debug_section = (char *) bfd_alloc (abfd, size);
if (! stash->debug_section)
- return false;
+ return FALSE;
if (! bfd_get_section_contents (abfd, msec, stash->debug_section,
(bfd_vma) 0, size))
{
stash->debug_section = 0;
- return false;
+ return FALSE;
}
stash->debug_section_end = stash->debug_section + size;
@@ -522,7 +524,7 @@ _bfd_dwarf1_find_nearest_line (abfd, section, symbols, offset,
or that an error occured while setting up the stash. */
if (! stash->debug_section)
- return false;
+ return FALSE;
/* Look at the previously parsed units to see if any contain
the addr. */
@@ -541,7 +543,7 @@ _bfd_dwarf1_find_nearest_line (abfd, section, symbols, offset,
if (! parse_die (stash->abfd, &aDieInfo, stash->currentDie,
stash->debug_section_end))
- return false;
+ return FALSE;
if (aDieInfo.tag == TAG_compile_unit)
{
@@ -578,7 +580,7 @@ _bfd_dwarf1_find_nearest_line (abfd, section, symbols, offset,
stash->currentDie += aDieInfo.length;
}
- return false;
+ return FALSE;
}
/* EOF */
diff --git a/contrib/binutils/bfd/dwarf2.c b/contrib/binutils/bfd/dwarf2.c
index 0639826..6182ea9 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
- Free Software Foundation, Inc.
+ Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
+ 2004 Free Software Foundation, Inc.
Adapted from gdb/dwarf2read.c by Gavin Koch of Cygnus Solutions
(gavin@cygnus.com).
@@ -61,21 +61,12 @@ struct attribute
{
char *str;
struct dwarf_block *blk;
- unsigned int unsnd;
- int snd;
- bfd_vma addr;
+ bfd_uint64_t val;
+ bfd_int64_t sval;
}
u;
};
-/* Get at parts of an attribute structure. */
-
-#define DW_STRING(attr) ((attr)->u.str)
-#define DW_UNSND(attr) ((attr)->u.unsnd)
-#define DW_BLOCK(attr) ((attr)->u.blk)
-#define DW_SND(attr) ((attr)->u.snd)
-#define DW_ADDR(attr) ((attr)->u.addr)
-
/* Blocks are a bunch of untyped bytes. */
struct dwarf_block
{
@@ -157,7 +148,7 @@ struct comp_unit
/* The DW_AT_comp_dir attribute. */
char* comp_dir;
- /* True if there is a line number table associated with this comp. unit. */
+ /* TRUE if there is a line number table associated with this comp. unit. */
int stmtlist;
/* The offset into .debug_line of the line number table. */
@@ -209,53 +200,6 @@ struct attr_abbrev
#define ATTR_ALLOC_CHUNK 4
#endif
-static unsigned int read_1_byte PARAMS ((bfd *, char *));
-static int read_1_signed_byte PARAMS ((bfd *, char *));
-static unsigned int read_2_bytes PARAMS ((bfd *, char *));
-static unsigned int read_4_bytes PARAMS ((bfd *, char *));
-static bfd_vma read_8_bytes PARAMS ((bfd *, char *));
-static char *read_n_bytes PARAMS ((bfd *, char *, unsigned int));
-static char *read_string PARAMS ((bfd *, char *, unsigned int *));
-static char *read_indirect_string PARAMS ((struct comp_unit *, char *, unsigned int *));
-static unsigned int read_unsigned_leb128
- PARAMS ((bfd *, char *, unsigned int *));
-static int read_signed_leb128
- PARAMS ((bfd *, char *, unsigned int *));
-static bfd_vma read_address PARAMS ((struct comp_unit *, char *));
-static struct abbrev_info *lookup_abbrev
- PARAMS ((unsigned int, struct abbrev_info **));
-static struct abbrev_info **read_abbrevs
- PARAMS ((bfd *, bfd_vma, struct dwarf2_debug *));
-static char *read_attribute
- PARAMS ((struct attribute *, struct attr_abbrev *,
- struct comp_unit *, char *));
-static char *read_attribute_value
- PARAMS ((struct attribute *, unsigned,
- struct comp_unit *, char *));
-static void add_line_info
- PARAMS ((struct line_info_table *, bfd_vma, char *,
- unsigned int, unsigned int, int));
-static char *concat_filename PARAMS ((struct line_info_table *, unsigned int));
-static void arange_add PARAMS ((struct comp_unit *, bfd_vma, bfd_vma));
-static struct line_info_table *decode_line_info
- PARAMS ((struct comp_unit *, struct dwarf2_debug *));
-static boolean lookup_address_in_line_info_table
- PARAMS ((struct line_info_table *, bfd_vma, struct funcinfo *,
- const char **, unsigned int *));
-static boolean lookup_address_in_function_table
- PARAMS ((struct funcinfo *, bfd_vma, struct funcinfo **, const char **));
-static boolean scan_unit_for_functions PARAMS ((struct comp_unit *));
-static bfd_vma find_rela_addend
- PARAMS ((bfd *, asection *, bfd_size_type, asymbol**));
-static struct comp_unit *parse_comp_unit
- PARAMS ((bfd *, struct dwarf2_debug *, bfd_vma, unsigned int));
-static boolean comp_unit_contains_address
- PARAMS ((struct comp_unit *, bfd_vma));
-static boolean comp_unit_find_nearest_line
- PARAMS ((struct comp_unit *, bfd_vma, const char **, const char **,
- unsigned int *, struct dwarf2_debug *));
-static asection *find_debug_info PARAMS ((bfd *, asection *));
-
/* VERBATIM
The following function up to the END VERBATIM mark are
copied directly from dwarf2read.c. */
@@ -263,74 +207,39 @@ static asection *find_debug_info PARAMS ((bfd *, asection *));
/* Read dwarf information from a buffer. */
static unsigned int
-read_1_byte (abfd, buf)
- bfd *abfd ATTRIBUTE_UNUSED;
- char *buf;
+read_1_byte (bfd *abfd ATTRIBUTE_UNUSED, char *buf)
{
- return bfd_get_8 (abfd, (bfd_byte *) buf);
+ return bfd_get_8 (abfd, buf);
}
static int
-read_1_signed_byte (abfd, buf)
- bfd *abfd ATTRIBUTE_UNUSED;
- char *buf;
+read_1_signed_byte (bfd *abfd ATTRIBUTE_UNUSED, char *buf)
{
- return bfd_get_signed_8 (abfd, (bfd_byte *) buf);
+ return bfd_get_signed_8 (abfd, buf);
}
static unsigned int
-read_2_bytes (abfd, buf)
- bfd *abfd;
- char *buf;
+read_2_bytes (bfd *abfd, char *buf)
{
- return bfd_get_16 (abfd, (bfd_byte *) buf);
+ return bfd_get_16 (abfd, buf);
}
-#if 0 /* This is not used. */
-
-static int
-read_2_signed_bytes (abfd, buf)
- bfd *abfd;
- char *buf;
-{
- return bfd_get_signed_16 (abfd, (bfd_byte *) buf);
-}
-
-#endif
-
static unsigned int
-read_4_bytes (abfd, buf)
- bfd *abfd;
- char *buf;
-{
- return bfd_get_32 (abfd, (bfd_byte *) buf);
-}
-
-#if 0 /* This is not used. */
-
-static int
-read_4_signed_bytes (abfd, buf)
- bfd *abfd;
- char *buf;
+read_4_bytes (bfd *abfd, char *buf)
{
- return bfd_get_signed_32 (abfd, (bfd_byte *) buf);
+ return bfd_get_32 (abfd, buf);
}
-#endif
-
-static bfd_vma
-read_8_bytes (abfd, buf)
- bfd *abfd;
- char *buf;
+static bfd_uint64_t
+read_8_bytes (bfd *abfd, char *buf)
{
- return bfd_get_64 (abfd, (bfd_byte *) buf);
+ return bfd_get_64 (abfd, buf);
}
static char *
-read_n_bytes (abfd, buf, size)
- bfd *abfd ATTRIBUTE_UNUSED;
- char *buf;
- unsigned int size ATTRIBUTE_UNUSED;
+read_n_bytes (bfd *abfd ATTRIBUTE_UNUSED,
+ char *buf,
+ unsigned int size ATTRIBUTE_UNUSED)
{
/* If the size of a host char is 8 bits, we can return a pointer
to the buffer, otherwise we have to copy the data to a buffer
@@ -339,10 +248,9 @@ read_n_bytes (abfd, buf, size)
}
static char *
-read_string (abfd, buf, bytes_read_ptr)
- bfd *abfd ATTRIBUTE_UNUSED;
- char *buf;
- unsigned int *bytes_read_ptr;
+read_string (bfd *abfd ATTRIBUTE_UNUSED,
+ char *buf,
+ unsigned int *bytes_read_ptr)
{
/* Return a pointer to the embedded string. */
if (*buf == '\0')
@@ -356,12 +264,11 @@ read_string (abfd, buf, bytes_read_ptr)
}
static char *
-read_indirect_string (unit, buf, bytes_read_ptr)
- struct comp_unit* unit;
- char *buf;
- unsigned int *bytes_read_ptr;
+read_indirect_string (struct comp_unit* unit,
+ char *buf,
+ unsigned int *bytes_read_ptr)
{
- bfd_vma offset;
+ bfd_uint64_t offset;
struct dwarf2_debug *stash = unit->stash;
if (unit->offset_size == 4)
@@ -385,12 +292,12 @@ read_indirect_string (unit, buf, bytes_read_ptr)
}
stash->dwarf_str_size = msec->_raw_size;
- stash->dwarf_str_buffer = (char*) bfd_alloc (abfd, msec->_raw_size);
+ stash->dwarf_str_buffer = bfd_alloc (abfd, msec->_raw_size);
if (! stash->dwarf_abbrev_buffer)
return NULL;
if (! bfd_get_section_contents (abfd, msec, stash->dwarf_str_buffer,
- (bfd_vma) 0, msec->_raw_size))
+ 0, msec->_raw_size))
return NULL;
}
@@ -409,10 +316,9 @@ read_indirect_string (unit, buf, bytes_read_ptr)
}
static unsigned int
-read_unsigned_leb128 (abfd, buf, bytes_read_ptr)
- bfd *abfd ATTRIBUTE_UNUSED;
- char *buf;
- unsigned int *bytes_read_ptr;
+read_unsigned_leb128 (bfd *abfd ATTRIBUTE_UNUSED,
+ char *buf,
+ unsigned int *bytes_read_ptr)
{
unsigned int result;
unsigned int num_read;
@@ -425,7 +331,7 @@ read_unsigned_leb128 (abfd, buf, bytes_read_ptr)
do
{
- byte = bfd_get_8 (abfd, (bfd_byte *) buf);
+ byte = bfd_get_8 (abfd, buf);
buf ++;
num_read ++;
result |= ((byte & 0x7f) << shift);
@@ -439,10 +345,9 @@ read_unsigned_leb128 (abfd, buf, bytes_read_ptr)
}
static int
-read_signed_leb128 (abfd, buf, bytes_read_ptr)
- bfd *abfd ATTRIBUTE_UNUSED;
- char *buf;
- unsigned int * bytes_read_ptr;
+read_signed_leb128 (bfd *abfd ATTRIBUTE_UNUSED,
+ char *buf,
+ unsigned int * bytes_read_ptr)
{
int result;
int shift;
@@ -455,7 +360,7 @@ read_signed_leb128 (abfd, buf, bytes_read_ptr)
do
{
- byte = bfd_get_8 (abfd, (bfd_byte *) buf);
+ byte = bfd_get_8 (abfd, buf);
buf ++;
num_read ++;
result |= ((byte & 0x7f) << shift);
@@ -473,19 +378,17 @@ read_signed_leb128 (abfd, buf, bytes_read_ptr)
/* END VERBATIM */
-static bfd_vma
-read_address (unit, buf)
- struct comp_unit* unit;
- char *buf;
+static bfd_uint64_t
+read_address (struct comp_unit *unit, char *buf)
{
switch (unit->addr_size)
{
case 8:
- return bfd_get_64 (unit->abfd, (bfd_byte *) buf);
+ return bfd_get_64 (unit->abfd, buf);
case 4:
- return bfd_get_32 (unit->abfd, (bfd_byte *) buf);
+ return bfd_get_32 (unit->abfd, buf);
case 2:
- return bfd_get_16 (unit->abfd, (bfd_byte *) buf);
+ return bfd_get_16 (unit->abfd, buf);
default:
abort ();
}
@@ -494,9 +397,7 @@ read_address (unit, buf)
/* Lookup an abbrev_info structure in the abbrev hash table. */
static struct abbrev_info *
-lookup_abbrev (number,abbrevs)
- unsigned int number;
- struct abbrev_info **abbrevs;
+lookup_abbrev (unsigned int number, struct abbrev_info **abbrevs)
{
unsigned int hash_number;
struct abbrev_info *abbrev;
@@ -521,10 +422,7 @@ lookup_abbrev (number,abbrevs)
in a hash table. */
static struct abbrev_info**
-read_abbrevs (abfd, offset, stash)
- bfd * abfd;
- bfd_vma offset;
- struct dwarf2_debug *stash;
+read_abbrevs (bfd *abfd, bfd_uint64_t offset, struct dwarf2_debug *stash)
{
struct abbrev_info **abbrevs;
char *abbrev_ptr;
@@ -546,13 +444,11 @@ read_abbrevs (abfd, offset, stash)
}
stash->dwarf_abbrev_size = msec->_raw_size;
- stash->dwarf_abbrev_buffer = (char*) bfd_alloc (abfd, msec->_raw_size);
+ stash->dwarf_abbrev_buffer
+ = bfd_simple_get_relocated_section_contents (abfd, msec, NULL,
+ stash->syms);
if (! stash->dwarf_abbrev_buffer)
return 0;
-
- if (! bfd_get_section_contents (abfd, msec, stash->dwarf_abbrev_buffer,
- (bfd_vma) 0, msec->_raw_size))
- return 0;
}
if (offset >= stash->dwarf_abbrev_size)
@@ -564,7 +460,7 @@ read_abbrevs (abfd, offset, stash)
}
amt = sizeof (struct abbrev_info*) * ABBREV_HASH_SIZE;
- abbrevs = (struct abbrev_info**) bfd_zalloc (abfd, amt);
+ abbrevs = bfd_zalloc (abfd, amt);
abbrev_ptr = stash->dwarf_abbrev_buffer + offset;
abbrev_number = read_unsigned_leb128 (abfd, abbrev_ptr, &bytes_read);
@@ -574,7 +470,7 @@ read_abbrevs (abfd, offset, stash)
while (abbrev_number)
{
amt = sizeof (struct abbrev_info);
- cur_abbrev = (struct abbrev_info *) bfd_zalloc (abfd, amt);
+ cur_abbrev = bfd_zalloc (abfd, amt);
/* Read in abbrev header. */
cur_abbrev->number = abbrev_number;
@@ -596,8 +492,7 @@ read_abbrevs (abfd, offset, stash)
{
amt = cur_abbrev->num_attrs + ATTR_ALLOC_CHUNK;
amt *= sizeof (struct attr_abbrev);
- cur_abbrev->attrs = ((struct attr_abbrev *)
- bfd_realloc (cur_abbrev->attrs, amt));
+ cur_abbrev->attrs = bfd_realloc (cur_abbrev->attrs, amt);
if (! cur_abbrev->attrs)
return 0;
}
@@ -638,11 +533,10 @@ read_abbrevs (abfd, offset, stash)
/* Read an attribute value described by an attribute form. */
static char *
-read_attribute_value (attr, form, unit, info_ptr)
- struct attribute *attr;
- unsigned form;
- struct comp_unit *unit;
- char *info_ptr;
+read_attribute_value (struct attribute *attr,
+ unsigned form,
+ struct comp_unit *unit,
+ char *info_ptr)
{
bfd *abfd = unit->abfd;
unsigned int bytes_read;
@@ -654,101 +548,101 @@ read_attribute_value (attr, form, unit, info_ptr)
switch (form)
{
case DW_FORM_addr:
- /* FIXME: DWARF3 draft sais DW_FORM_ref_addr is offset_size. */
+ /* FIXME: DWARF3 draft says DW_FORM_ref_addr is offset_size. */
case DW_FORM_ref_addr:
- DW_ADDR (attr) = read_address (unit, info_ptr);
+ attr->u.val = read_address (unit, info_ptr);
info_ptr += unit->addr_size;
break;
case DW_FORM_block2:
amt = sizeof (struct dwarf_block);
- blk = (struct dwarf_block *) bfd_alloc (abfd, amt);
+ blk = bfd_alloc (abfd, amt);
blk->size = read_2_bytes (abfd, info_ptr);
info_ptr += 2;
blk->data = read_n_bytes (abfd, info_ptr, blk->size);
info_ptr += blk->size;
- DW_BLOCK (attr) = blk;
+ attr->u.blk = blk;
break;
case DW_FORM_block4:
amt = sizeof (struct dwarf_block);
- blk = (struct dwarf_block *) bfd_alloc (abfd, amt);
+ blk = bfd_alloc (abfd, amt);
blk->size = read_4_bytes (abfd, info_ptr);
info_ptr += 4;
blk->data = read_n_bytes (abfd, info_ptr, blk->size);
info_ptr += blk->size;
- DW_BLOCK (attr) = blk;
+ attr->u.blk = blk;
break;
case DW_FORM_data2:
- DW_UNSND (attr) = read_2_bytes (abfd, info_ptr);
+ attr->u.val = read_2_bytes (abfd, info_ptr);
info_ptr += 2;
break;
case DW_FORM_data4:
- DW_UNSND (attr) = read_4_bytes (abfd, info_ptr);
+ attr->u.val = read_4_bytes (abfd, info_ptr);
info_ptr += 4;
break;
case DW_FORM_data8:
- DW_UNSND (attr) = read_8_bytes (abfd, info_ptr);
+ attr->u.val = read_8_bytes (abfd, info_ptr);
info_ptr += 8;
break;
case DW_FORM_string:
- DW_STRING (attr) = read_string (abfd, info_ptr, &bytes_read);
+ attr->u.str = read_string (abfd, info_ptr, &bytes_read);
info_ptr += bytes_read;
break;
case DW_FORM_strp:
- DW_STRING (attr) = read_indirect_string (unit, info_ptr, &bytes_read);
+ attr->u.str = read_indirect_string (unit, info_ptr, &bytes_read);
info_ptr += bytes_read;
break;
case DW_FORM_block:
amt = sizeof (struct dwarf_block);
- blk = (struct dwarf_block *) bfd_alloc (abfd, amt);
+ blk = bfd_alloc (abfd, amt);
blk->size = read_unsigned_leb128 (abfd, info_ptr, &bytes_read);
info_ptr += bytes_read;
blk->data = read_n_bytes (abfd, info_ptr, blk->size);
info_ptr += blk->size;
- DW_BLOCK (attr) = blk;
+ attr->u.blk = blk;
break;
case DW_FORM_block1:
amt = sizeof (struct dwarf_block);
- blk = (struct dwarf_block *) bfd_alloc (abfd, amt);
+ blk = bfd_alloc (abfd, amt);
blk->size = read_1_byte (abfd, info_ptr);
info_ptr += 1;
blk->data = read_n_bytes (abfd, info_ptr, blk->size);
info_ptr += blk->size;
- DW_BLOCK (attr) = blk;
+ attr->u.blk = blk;
break;
case DW_FORM_data1:
- DW_UNSND (attr) = read_1_byte (abfd, info_ptr);
+ attr->u.val = read_1_byte (abfd, info_ptr);
info_ptr += 1;
break;
case DW_FORM_flag:
- DW_UNSND (attr) = read_1_byte (abfd, info_ptr);
+ attr->u.val = read_1_byte (abfd, info_ptr);
info_ptr += 1;
break;
case DW_FORM_sdata:
- DW_SND (attr) = read_signed_leb128 (abfd, info_ptr, &bytes_read);
+ attr->u.sval = read_signed_leb128 (abfd, info_ptr, &bytes_read);
info_ptr += bytes_read;
break;
case DW_FORM_udata:
- DW_UNSND (attr) = read_unsigned_leb128 (abfd, info_ptr, &bytes_read);
+ attr->u.val = read_unsigned_leb128 (abfd, info_ptr, &bytes_read);
info_ptr += bytes_read;
break;
case DW_FORM_ref1:
- DW_UNSND (attr) = read_1_byte (abfd, info_ptr);
+ attr->u.val = read_1_byte (abfd, info_ptr);
info_ptr += 1;
break;
case DW_FORM_ref2:
- DW_UNSND (attr) = read_2_bytes (abfd, info_ptr);
+ attr->u.val = read_2_bytes (abfd, info_ptr);
info_ptr += 2;
break;
case DW_FORM_ref4:
- DW_UNSND (attr) = read_4_bytes (abfd, info_ptr);
+ attr->u.val = read_4_bytes (abfd, info_ptr);
info_ptr += 4;
break;
case DW_FORM_ref8:
- DW_UNSND (attr) = read_8_bytes (abfd, info_ptr);
+ attr->u.val = read_8_bytes (abfd, info_ptr);
info_ptr += 8;
break;
case DW_FORM_ref_udata:
- DW_UNSND (attr) = read_unsigned_leb128 (abfd, info_ptr, &bytes_read);
+ attr->u.val = read_unsigned_leb128 (abfd, info_ptr, &bytes_read);
info_ptr += bytes_read;
break;
case DW_FORM_indirect:
@@ -767,11 +661,10 @@ read_attribute_value (attr, form, unit, info_ptr)
/* Read an attribute described by an abbreviated attribute. */
static char *
-read_attribute (attr, abbrev, unit, info_ptr)
- struct attribute *attr;
- struct attr_abbrev *abbrev;
- struct comp_unit *unit;
- char *info_ptr;
+read_attribute (struct attribute *attr,
+ struct attr_abbrev *abbrev,
+ struct comp_unit *unit,
+ char *info_ptr)
{
attr->name = abbrev->name;
info_ptr = read_attribute_value (attr, abbrev->form, unit, info_ptr);
@@ -821,22 +714,21 @@ struct funcinfo
bfd_vma high;
};
-/* add_line_info: adds a new entry to the line_info list in the
- line_info_table, ensuring that the list is sorted. Note that the
- line_info list is sorted from highest to lowest VMA (with possible
- duplicates); that is, line_info->prev_line always accesses an equal
- or smaller VMA. */
+/* Adds a new entry to the line_info list in the line_info_table, ensuring
+ that the list is sorted. Note that the line_info list is sorted from
+ highest to lowest VMA (with possible duplicates); that is,
+ line_info->prev_line always accesses an equal or smaller VMA. */
+
static void
-add_line_info (table, address, filename, line, column, end_sequence)
- struct line_info_table* table;
- bfd_vma address;
- char* filename;
- unsigned int line;
- unsigned int column;
- int end_sequence;
+add_line_info (struct line_info_table *table,
+ bfd_vma address,
+ char *filename,
+ unsigned int line,
+ unsigned int column,
+ int end_sequence)
{
bfd_size_type amt = sizeof (struct line_info);
- struct line_info* info = (struct line_info*) bfd_alloc (table->abfd, amt);
+ struct line_info* info = bfd_alloc (table->abfd, amt);
/* Find the correct location for 'info'. Normally we will receive
new line_info data 1) in order and 2) with increasing VMAs.
@@ -905,16 +797,26 @@ add_line_info (table, address, filename, line, column, end_sequence)
/* Set member data of 'info'. */
info->address = address;
- info->filename = filename;
info->line = line;
info->column = column;
info->end_sequence = end_sequence;
+
+ if (filename && filename[0])
+ {
+ info->filename = bfd_alloc (table->abfd, strlen (filename) + 1);
+ if (info->filename)
+ strcpy (info->filename, filename);
+ }
+ else
+ info->filename = NULL;
}
+/* Extract a fully qualified filename from a line info table.
+ The returned string has been malloc'ed and it is the caller's
+ responsibility to free it. */
+
static char *
-concat_filename (table, file)
- struct line_info_table* table;
- unsigned int file;
+concat_filename (struct line_info_table *table, unsigned int file)
{
char* filename;
@@ -922,32 +824,36 @@ concat_filename (table, file)
{
(*_bfd_error_handler)
(_("Dwarf Error: mangled line number section (bad file number)."));
- return "<unknown>";
+ return strdup ("<unknown>");
}
filename = table->files[file - 1].name;
- if (IS_ABSOLUTE_PATH(filename))
- return filename;
- else
+
+ if (! IS_ABSOLUTE_PATH (filename))
{
char* dirname = (table->files[file - 1].dir
? table->dirs[table->files[file - 1].dir - 1]
: table->comp_dir);
- /* Not all tools set DW_AT_comp_dir, so dirname may be unknown. The
- best we can do is return the filename part. */
- if (dirname == NULL)
- return filename;
- else
- return (char*) concat (dirname, "/", filename, NULL);
+ /* Not all tools set DW_AT_comp_dir, so dirname may be unknown.
+ The best we can do is return the filename part. */
+ if (dirname != NULL)
+ {
+ unsigned int len = strlen (dirname) + strlen (filename) + 2;
+ char * name;
+
+ name = bfd_malloc (len);
+ if (name)
+ sprintf (name, "%s/%s", dirname, filename);
+ return name;
+ }
}
+
+ return strdup (filename);
}
static void
-arange_add (unit, low_pc, high_pc)
- struct comp_unit *unit;
- bfd_vma low_pc;
- bfd_vma high_pc;
+arange_add (struct comp_unit *unit, bfd_vma low_pc, bfd_vma high_pc)
{
struct arange *arange;
@@ -980,8 +886,7 @@ arange_add (unit, low_pc, high_pc)
}
/* Need to allocate a new arange and insert it into the arange list. */
- arange = (struct arange *)
- bfd_zalloc (unit->abfd, (bfd_size_type) sizeof (*arange));
+ arange = bfd_zalloc (unit->abfd, sizeof (*arange));
arange->low = low_pc;
arange->high = high_pc;
@@ -992,9 +897,7 @@ arange_add (unit, low_pc, high_pc)
/* Decode the line number information for UNIT. */
static struct line_info_table*
-decode_line_info (unit, stash)
- struct comp_unit *unit;
- struct dwarf2_debug *stash;
+decode_line_info (struct comp_unit *unit, struct dwarf2_debug *stash)
{
bfd *abfd = unit->abfd;
struct line_info_table* table;
@@ -1019,21 +922,15 @@ decode_line_info (unit, stash)
}
stash->dwarf_line_size = msec->_raw_size;
- stash->dwarf_line_buffer = (char *) bfd_alloc (abfd, msec->_raw_size);
+ stash->dwarf_line_buffer
+ = bfd_simple_get_relocated_section_contents (abfd, msec, NULL,
+ stash->syms);
if (! stash->dwarf_line_buffer)
return 0;
-
- if (! bfd_get_section_contents (abfd, msec, stash->dwarf_line_buffer,
- (bfd_vma) 0, msec->_raw_size))
- return 0;
-
- /* FIXME: We ought to apply the relocs against this section before
- we process it... */
}
- /* Since we are using un-relocated data, it is possible to get a bad value
- for the line_offset. Validate it here so that we won't get a segfault
- below. */
+ /* It is possible to get a bad value for the line_offset. Validate
+ it here so that we won't get a segfault below. */
if (unit->line_offset >= stash->dwarf_line_size)
{
(*_bfd_error_handler) (_("Dwarf Error: Line offset (%lu) greater than or equal to .debug_line size (%lu)."),
@@ -1043,7 +940,7 @@ decode_line_info (unit, stash)
}
amt = sizeof (struct line_info_table);
- table = (struct line_info_table*) bfd_alloc (abfd, amt);
+ table = bfd_alloc (abfd, amt);
table->abfd = abfd;
table->comp_dir = unit->comp_dir;
@@ -1095,7 +992,7 @@ decode_line_info (unit, stash)
lh.opcode_base = read_1_byte (abfd, line_ptr);
line_ptr += 1;
amt = lh.opcode_base * sizeof (unsigned char);
- lh.standard_opcode_lengths = (unsigned char *) bfd_alloc (abfd, amt);
+ lh.standard_opcode_lengths = bfd_alloc (abfd, amt);
lh.standard_opcode_lengths[0] = 1;
@@ -1114,7 +1011,7 @@ decode_line_info (unit, stash)
{
amt = table->num_dirs + DIR_ALLOC_CHUNK;
amt *= sizeof (char *);
- table->dirs = (char **) bfd_realloc (table->dirs, amt);
+ table->dirs = bfd_realloc (table->dirs, amt);
if (! table->dirs)
return 0;
}
@@ -1133,7 +1030,7 @@ decode_line_info (unit, stash)
{
amt = table->num_files + FILE_ALLOC_CHUNK;
amt *= sizeof (struct fileinfo);
- table->files = (struct fileinfo *) bfd_realloc (table->files, amt);
+ table->files = bfd_realloc (table->files, amt);
if (! table->files)
return 0;
}
@@ -1158,7 +1055,7 @@ decode_line_info (unit, stash)
{
/* State machine registers. */
bfd_vma address = 0;
- char * filename = concat_filename (table, 1);
+ char * filename = table->num_files ? concat_filename (table, 1) : NULL;
unsigned int line = 1;
unsigned int column = 0;
int is_stmt = lh.default_is_stmt;
@@ -1224,8 +1121,7 @@ decode_line_info (unit, stash)
{
amt = table->num_files + FILE_ALLOC_CHUNK;
amt *= sizeof (struct fileinfo);
- table->files =
- (struct fileinfo *) bfd_realloc (table->files, amt);
+ table->files = bfd_realloc (table->files, amt);
if (! table->files)
return 0;
}
@@ -1272,6 +1168,8 @@ decode_line_info (unit, stash)
based, the references are 1 based. */
file = read_unsigned_leb128 (abfd, line_ptr, &bytes_read);
line_ptr += bytes_read;
+ if (filename)
+ free (filename);
filename = concat_filename (table, file);
break;
}
@@ -1296,6 +1194,7 @@ decode_line_info (unit, stash)
default:
{
int i;
+
/* Unknown standard opcode, ignore it. */
for (i = 0; i < lh.standard_opcode_lengths[op_code]; i++)
{
@@ -1305,23 +1204,24 @@ decode_line_info (unit, stash)
}
}
}
+
+ if (filename)
+ free (filename);
}
return table;
}
-/* If ADDR is within TABLE set the output parameters and return true,
- otherwise return false. The output parameters, FILENAME_PTR and
+/* If ADDR is within TABLE set the output parameters and return TRUE,
+ otherwise return FALSE. The output parameters, FILENAME_PTR and
LINENUMBER_PTR, are pointers to the objects to be filled in. */
-static boolean
-lookup_address_in_line_info_table (table, addr, function, filename_ptr,
- linenumber_ptr)
- struct line_info_table* table;
- bfd_vma addr;
- struct funcinfo *function;
- const char **filename_ptr;
- unsigned int *linenumber_ptr;
+static bfd_boolean
+lookup_address_in_line_info_table (struct line_info_table *table,
+ bfd_vma addr,
+ struct funcinfo *function,
+ const char **filename_ptr,
+ unsigned int *linenumber_ptr)
{
/* Note: table->last_line should be a descendingly sorted list. */
struct line_info* next_line = table->last_line;
@@ -1329,7 +1229,7 @@ lookup_address_in_line_info_table (table, addr, function, filename_ptr,
*filename_ptr = NULL;
if (!next_line)
- return false;
+ return FALSE;
each_line = next_line->prev_line;
@@ -1343,10 +1243,10 @@ lookup_address_in_line_info_table (table, addr, function, filename_ptr,
/* If we have an address match, save this info. This allows us
to return as good as results as possible for strange debugging
info. */
- boolean addr_match = false;
+ bfd_boolean addr_match = FALSE;
if (each_line->address <= addr && addr <= next_line->address)
{
- addr_match = true;
+ addr_match = TRUE;
/* If this line appears to span functions, and addr is in the
later function, return the first line of that function instead
@@ -1367,7 +1267,7 @@ lookup_address_in_line_info_table (table, addr, function, filename_ptr,
}
if (addr_match && !each_line->end_sequence)
- return true; /* we have definitely found what we want */
+ return TRUE; /* we have definitely found what we want */
next_line = each_line;
each_line = each_line->prev_line;
@@ -1383,23 +1283,21 @@ lookup_address_in_line_info_table (table, addr, function, filename_ptr,
{
*filename_ptr = next_line->filename;
*linenumber_ptr = next_line->line;
- return true;
+ return TRUE;
}
- return false;
+ return FALSE;
}
/* 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. */
-static boolean
-lookup_address_in_function_table (table, addr, function_ptr,
- functionname_ptr)
- struct funcinfo* table;
- bfd_vma addr;
- struct funcinfo** function_ptr;
- const char **functionname_ptr;
+static bfd_boolean
+lookup_address_in_function_table (struct funcinfo *table,
+ bfd_vma addr,
+ struct funcinfo **function_ptr,
+ const char **functionname_ptr)
{
struct funcinfo* each_func;
@@ -1411,11 +1309,11 @@ lookup_address_in_function_table (table, addr, function_ptr,
{
*functionname_ptr = each_func->name;
*function_ptr = each_func;
- return true;
+ return TRUE;
}
}
- return false;
+ return FALSE;
}
/* DWARF2 Compilation unit functions. */
@@ -1423,9 +1321,8 @@ lookup_address_in_function_table (table, addr, function_ptr,
/* Scan over each die in a comp. unit looking for functions to add
to the function table. */
-static boolean
-scan_unit_for_functions (unit)
- struct comp_unit *unit;
+static bfd_boolean
+scan_unit_for_functions (struct comp_unit *unit)
{
bfd *abfd = unit->abfd;
char *info_ptr = unit->first_child_die_ptr;
@@ -1454,13 +1351,13 @@ scan_unit_for_functions (unit)
(*_bfd_error_handler) (_("Dwarf Error: Could not find abbrev number %u."),
abbrev_number);
bfd_set_error (bfd_error_bad_value);
- return false;
+ return FALSE;
}
if (abbrev->tag == DW_TAG_subprogram)
{
bfd_size_type amt = sizeof (struct funcinfo);
- func = (struct funcinfo *) bfd_zalloc (abfd, amt);
+ func = bfd_zalloc (abfd, amt);
func->prev_func = unit->function_table;
unit->function_table = func;
}
@@ -1477,23 +1374,23 @@ scan_unit_for_functions (unit)
{
case DW_AT_name:
- name = DW_STRING (&attr);
+ name = attr.u.str;
/* Prefer DW_AT_MIPS_linkage_name over DW_AT_name. */
if (func->name == NULL)
- func->name = DW_STRING (&attr);
+ func->name = attr.u.str;
break;
case DW_AT_MIPS_linkage_name:
- func->name = DW_STRING (&attr);
+ func->name = attr.u.str;
break;
case DW_AT_low_pc:
- func->low = DW_ADDR (&attr);
+ func->low = attr.u.val;
break;
case DW_AT_high_pc:
- func->high = DW_ADDR (&attr);
+ func->high = attr.u.val;
break;
default:
@@ -1505,7 +1402,7 @@ scan_unit_for_functions (unit)
switch (attr.name)
{
case DW_AT_name:
- name = DW_STRING (&attr);
+ name = attr.u.str;
break;
default:
@@ -1518,66 +1415,12 @@ scan_unit_for_functions (unit)
nesting_level++;
}
- return true;
-}
-
-/* Look for a RELA relocation to be applied on OFFSET of section SEC,
- and return the addend if such a relocation is found. Since this is
- only used to find relocations referring to the .debug_abbrev
- section, we make sure the relocation refers to this section, but
- this is not strictly necessary, and it can probably be safely
- removed if needed. However, it is important to note that this
- function only returns the addend, it doesn't serve the purpose of
- applying a generic relocation.
-
- If no suitable relocation is found, or if it is not a real RELA
- relocation, this function returns 0. */
-
-static bfd_vma
-find_rela_addend (abfd, sec, offset, syms)
- bfd* abfd;
- asection* sec;
- bfd_size_type offset;
- asymbol** syms;
-{
- long reloc_size = bfd_get_reloc_upper_bound (abfd, sec);
- arelent **relocs = NULL;
- long reloc_count, relc;
-
- if (reloc_size <= 0)
- return 0;
-
- relocs = (arelent **) bfd_malloc ((bfd_size_type) reloc_size);
- if (relocs == NULL)
- return 0;
-
- reloc_count = bfd_canonicalize_reloc (abfd, sec, relocs, syms);
-
- if (reloc_count <= 0)
- {
- free (relocs);
- return 0;
- }
-
- for (relc = 0; relc < reloc_count; relc++)
- if (relocs[relc]->address == offset
- && (*relocs[relc]->sym_ptr_ptr)->flags & BSF_SECTION_SYM
- && strcmp ((*relocs[relc]->sym_ptr_ptr)->name,
- ".debug_abbrev") == 0)
- {
- bfd_vma addend = (relocs[relc]->howto->partial_inplace
- ? 0 : relocs[relc]->addend);
- free (relocs);
- return addend;
- }
-
- free (relocs);
- return 0;
+ return TRUE;
}
/* Parse a DWARF2 compilation unit starting at INFO_PTR. This
includes the compilation unit header that proceeds the DIE's, but
- does not include the length field that preceeds each compilation
+ does not include the length field that precedes each compilation
unit header. END_PTR points one past the end of this comp unit.
OFFSET_SIZE is the size of DWARF2 offsets (either 4 or 8 bytes).
@@ -1585,15 +1428,14 @@ find_rela_addend (abfd, sec, offset, syms)
to get to the line number information for the compilation unit. */
static struct comp_unit *
-parse_comp_unit (abfd, stash, unit_length, offset_size)
- bfd* abfd;
- struct dwarf2_debug *stash;
- bfd_vma unit_length;
- unsigned int offset_size;
+parse_comp_unit (bfd *abfd,
+ struct dwarf2_debug *stash,
+ bfd_vma unit_length,
+ unsigned int offset_size)
{
struct comp_unit* unit;
unsigned int version;
- bfd_vma abbrev_offset = 0;
+ bfd_uint64_t abbrev_offset = 0;
unsigned int addr_size;
struct abbrev_info** abbrevs;
unsigned int abbrev_number, bytes_read, i;
@@ -1602,7 +1444,6 @@ parse_comp_unit (abfd, stash, unit_length, offset_size)
char *info_ptr = stash->info_ptr;
char *end_ptr = info_ptr + unit_length;
bfd_size_type amt;
- bfd_size_type off;
version = read_2_bytes (abfd, info_ptr);
info_ptr += 2;
@@ -1611,12 +1452,6 @@ parse_comp_unit (abfd, stash, unit_length, offset_size)
abbrev_offset = read_4_bytes (abfd, info_ptr);
else
abbrev_offset = read_8_bytes (abfd, info_ptr);
- /* The abbrev offset is generally a relocation pointing to
- .debug_abbrev+offset. On RELA targets, we have to find the
- relocation and extract the addend to obtain the actual
- abbrev_offset, so do it here. */
- off = info_ptr - stash->sec_info_ptr;
- abbrev_offset += find_rela_addend (abfd, stash->sec, off, stash->syms);
info_ptr += offset_size;
addr_size = read_1_byte (abfd, info_ptr);
info_ptr += 1;
@@ -1669,7 +1504,7 @@ parse_comp_unit (abfd, stash, unit_length, offset_size)
}
amt = sizeof (struct comp_unit);
- unit = (struct comp_unit*) bfd_zalloc (abfd, amt);
+ unit = bfd_zalloc (abfd, amt);
unit->abfd = abfd;
unit->addr_size = addr_size;
unit->offset_size = offset_size;
@@ -1687,29 +1522,29 @@ parse_comp_unit (abfd, stash, unit_length, offset_size)
{
case DW_AT_stmt_list:
unit->stmtlist = 1;
- unit->line_offset = DW_UNSND (&attr);
+ unit->line_offset = attr.u.val;
break;
case DW_AT_name:
- unit->name = DW_STRING (&attr);
+ unit->name = attr.u.str;
break;
case DW_AT_low_pc:
- unit->arange.low = DW_ADDR (&attr);
+ unit->arange.low = attr.u.val;
break;
case DW_AT_high_pc:
- unit->arange.high = DW_ADDR (&attr);
+ unit->arange.high = attr.u.val;
break;
case DW_AT_comp_dir:
{
- char* comp_dir = DW_STRING (&attr);
+ char* comp_dir = attr.u.str;
if (comp_dir)
{
/* Irix 6.2 native cc prepends <machine>.: to the compilation
directory, get rid of it. */
- char *cp = (char*) strchr (comp_dir, ':');
+ char *cp = strchr (comp_dir, ':');
if (cp && cp != comp_dir && cp[-1] == '.' && cp[1] == '/')
comp_dir = cp + 1;
@@ -1727,28 +1562,26 @@ parse_comp_unit (abfd, stash, unit_length, offset_size)
return unit;
}
-/* Return true if UNIT contains the address given by ADDR. */
+/* Return TRUE if UNIT contains the address given by ADDR. */
-static boolean
-comp_unit_contains_address (unit, addr)
- struct comp_unit* unit;
- bfd_vma addr;
+static bfd_boolean
+comp_unit_contains_address (struct comp_unit *unit, bfd_vma addr)
{
struct arange *arange;
if (unit->error)
- return false;
+ return FALSE;
arange = &unit->arange;
do
{
if (addr >= arange->low && addr < arange->high)
- return true;
+ return TRUE;
arange = arange->next;
}
while (arange);
- return false;
+ return FALSE;
}
/* If UNIT contains ADDR, set the output parameters to the values for
@@ -1756,32 +1589,30 @@ comp_unit_contains_address (unit, addr)
FUNCTIONNAME_PTR, and LINENUMBER_PTR, are pointers to the objects
to be filled in.
- Return true of UNIT contains ADDR, and no errors were encountered;
- false otherwise. */
-
-static boolean
-comp_unit_find_nearest_line (unit, addr, filename_ptr, functionname_ptr,
- linenumber_ptr, stash)
- struct comp_unit* unit;
- bfd_vma addr;
- const char **filename_ptr;
- const char **functionname_ptr;
- unsigned int *linenumber_ptr;
- struct dwarf2_debug *stash;
+ Return TRUE if UNIT contains ADDR, and no errors were encountered;
+ FALSE otherwise. */
+
+static bfd_boolean
+comp_unit_find_nearest_line (struct comp_unit *unit,
+ bfd_vma addr,
+ const char **filename_ptr,
+ const char **functionname_ptr,
+ unsigned int *linenumber_ptr,
+ struct dwarf2_debug *stash)
{
- boolean line_p;
- boolean func_p;
+ bfd_boolean line_p;
+ bfd_boolean func_p;
struct funcinfo *function;
if (unit->error)
- return false;
+ return FALSE;
if (! unit->line_table)
{
if (! unit->stmtlist)
{
unit->error = 1;
- return false;
+ return FALSE;
}
unit->line_table = decode_line_info (unit, stash);
@@ -1789,14 +1620,14 @@ comp_unit_find_nearest_line (unit, addr, filename_ptr, functionname_ptr,
if (! unit->line_table)
{
unit->error = 1;
- return false;
+ return FALSE;
}
if (unit->first_child_die_ptr < unit->end_ptr
&& ! scan_unit_for_functions (unit))
{
unit->error = 1;
- return false;
+ return FALSE;
}
}
@@ -1806,7 +1637,7 @@ comp_unit_find_nearest_line (unit, addr, filename_ptr, functionname_ptr,
line_p = lookup_address_in_line_info_table (unit->line_table, addr,
function, filename_ptr,
linenumber_ptr);
- return (boolean) (line_p || func_p);
+ return line_p || func_p;
}
/* Locate a section in a BFD containing debugging info. The search starts
@@ -1822,9 +1653,7 @@ comp_unit_find_nearest_line (unit, addr, filename_ptr, functionname_ptr,
#define GNU_LINKONCE_INFO ".gnu.linkonce.wi."
static asection *
-find_debug_info (abfd, after_sec)
- bfd * abfd;
- asection * after_sec;
+find_debug_info (bfd *abfd, asection *after_sec)
{
asection * msec;
@@ -1847,25 +1676,22 @@ find_debug_info (abfd, after_sec)
return NULL;
}
-/* The DWARF2 version of find_nearest line. Return true if the line
+/* 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. */
-boolean
-_bfd_dwarf2_find_nearest_line (abfd, section, symbols, offset,
- filename_ptr, functionname_ptr,
- linenumber_ptr, addr_size, pinfo)
- 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;
- PTR *pinfo;
+bfd_boolean
+_bfd_dwarf2_find_nearest_line (bfd *abfd,
+ asection *section,
+ asymbol **symbols,
+ bfd_vma offset,
+ const char **filename_ptr,
+ const char **functionname_ptr,
+ unsigned int *linenumber_ptr,
+ unsigned int addr_size,
+ void **pinfo)
{
/* Read each compilation unit from the section .debug_info, and check
to see if it contains the address we are searching for. If yes,
@@ -1875,7 +1701,7 @@ _bfd_dwarf2_find_nearest_line (abfd, section, symbols, offset,
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 = (struct dwarf2_debug *) *pinfo;
+ struct dwarf2_debug *stash = *pinfo;
/* What address are we looking for? */
bfd_vma addr = offset + section->vma;
@@ -1899,18 +1725,18 @@ _bfd_dwarf2_find_nearest_line (abfd, section, symbols, offset,
asection *msec;
bfd_size_type amt = sizeof (struct dwarf2_debug);
- stash = (struct dwarf2_debug*) bfd_zalloc (abfd, amt);
+ stash = bfd_zalloc (abfd, amt);
if (! stash)
- return false;
+ return FALSE;
- *pinfo = (PTR) stash;
+ *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;
+ return FALSE;
/* There can be more than one DWARF2 info section in a BFD these days.
Read them all in and produce one large stash. We do this in two
@@ -1920,9 +1746,9 @@ _bfd_dwarf2_find_nearest_line (abfd, section, symbols, offset,
for (total_size = 0; msec; msec = find_debug_info (abfd, msec))
total_size += msec->_raw_size;
- stash->info_ptr = (char *) bfd_alloc (abfd, total_size);
+ stash->info_ptr = bfd_alloc (abfd, total_size);
if (stash->info_ptr == NULL)
- return false;
+ return FALSE;
stash->info_ptr_end = stash->info_ptr;
@@ -1939,8 +1765,8 @@ _bfd_dwarf2_find_nearest_line (abfd, section, symbols, offset,
start = stash->info_ptr_end - stash->info_ptr;
- if (! bfd_get_section_contents (abfd, msec, stash->info_ptr + start,
- (bfd_vma) 0, size))
+ if ((bfd_simple_get_relocated_section_contents
+ (abfd, msec, stash->info_ptr + start, symbols)) == NULL)
continue;
stash->info_ptr_end = stash->info_ptr + start + size;
@@ -1953,25 +1779,10 @@ _bfd_dwarf2_find_nearest_line (abfd, section, symbols, offset,
stash->syms = symbols;
}
- /* FIXME: There is a problem with the contents of the
- .debug_info section. The 'low' and 'high' addresses of the
- comp_units are computed by relocs against symbols in the
- .text segment. We need these addresses in order to determine
- the nearest line number, and so we have to resolve the
- relocs. There is a similar problem when the .debug_line
- section is processed as well (e.g., there may be relocs
- against the operand of the DW_LNE_set_address operator).
-
- Unfortunately getting hold of the reloc information is hard...
-
- For now, this means that disassembling object files (as
- opposed to fully executables) does not always work as well as
- we would like. */
-
/* 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;
+ return FALSE;
/* Check the previously read comp. units first. */
for (each = stash->all_comp_units; each; each = each->next_unit)
@@ -1984,29 +1795,37 @@ _bfd_dwarf2_find_nearest_line (abfd, section, symbols, offset,
while (stash->info_ptr < stash->info_ptr_end)
{
bfd_vma length;
- boolean found;
+ bfd_boolean found;
unsigned int offset_size = addr_size;
- if (addr_size == 4)
+ length = read_4_bytes (abfd, stash->info_ptr);
+ /* A 0xffffff length is the DWARF3 way of indicating we use
+ 64-bit offsets, instead of 32-bit offsets. */
+ if (length == 0xffffffff)
{
- length = read_4_bytes (abfd, stash->info_ptr);
- if (length == 0xffffffff)
- {
- offset_size = 8;
- length = read_8_bytes (abfd, stash->info_ptr + 4);
- stash->info_ptr += 8;
- }
- else if (length == 0)
- {
- /* Handle (non-standard) 64-bit DWARF2 formats. */
- offset_size = 8;
- length = read_4_bytes (abfd, stash->info_ptr + 4);
- stash->info_ptr += 4;
- }
+ offset_size = 8;
+ length = read_8_bytes (abfd, stash->info_ptr + 4);
+ stash->info_ptr += 12;
+ }
+ /* A zero length is the IRIX way of indicating 64-bit offsets,
+ mostly because the 64-bit length will generally fit in 32
+ bits, and the endianness helps. */
+ else if (length == 0)
+ {
+ offset_size = 8;
+ length = read_4_bytes (abfd, stash->info_ptr + 4);
+ stash->info_ptr += 8;
+ }
+ /* In the absence of the hints above, we assume addr_size-sized
+ offsets, for backward-compatibility with pre-DWARF3 64-bit
+ platforms. */
+ else if (addr_size == 8)
+ {
+ length = read_8_bytes (abfd, stash->info_ptr);
+ stash->info_ptr += 8;
}
else
- length = read_8_bytes (abfd, stash->info_ptr);
- stash->info_ptr += addr_size;
+ stash->info_ptr += 4;
if (length > 0)
{
@@ -2034,10 +1853,10 @@ _bfd_dwarf2_find_nearest_line (abfd, section, symbols, offset,
{
if (comp_unit_contains_address (each, addr))
return comp_unit_find_nearest_line (each, addr,
- filename_ptr,
- functionname_ptr,
- linenumber_ptr,
- stash);
+ filename_ptr,
+ functionname_ptr,
+ linenumber_ptr,
+ stash);
}
else
{
@@ -2047,11 +1866,11 @@ _bfd_dwarf2_find_nearest_line (abfd, section, symbols, offset,
linenumber_ptr,
stash);
if (found)
- return true;
+ return TRUE;
}
}
}
}
- return false;
+ return FALSE;
}
diff --git a/contrib/binutils/bfd/ecoff.c b/contrib/binutils/bfd/ecoff.c
index ed10850..cfc5ae1 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
- Free Software Foundation, Inc.
+ Copyright 1990, 1991, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
+ 2002, 2003 Free Software Foundation, Inc.
Original version by Per Bothner.
Full support added by Ian Lance Taylor, ian@cygnus.com.
@@ -46,19 +46,32 @@
/* Prototypes for static functions. */
-static int ecoff_get_magic PARAMS ((bfd *));
-static long ecoff_sec_to_styp_flags PARAMS ((const char *, flagword));
-static boolean ecoff_slurp_symbolic_header PARAMS ((bfd *));
-static 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 boolean ecoff_slurp_reloc_table PARAMS ((bfd *, asection *, asymbol **));
-static int ecoff_sort_hdrs PARAMS ((const PTR, const PTR));
-static boolean ecoff_compute_section_file_positions PARAMS ((bfd *));
-static bfd_size_type ecoff_compute_reloc_file_positions PARAMS ((bfd *));
-static boolean ecoff_get_extr PARAMS ((asymbol *, EXTR *));
-static void ecoff_set_index PARAMS ((asymbol *, bfd_size_type));
-static unsigned int ecoff_armap_hash PARAMS ((const char *, unsigned int *, unsigned int, unsigned int));
+static int ecoff_get_magic
+ PARAMS ((bfd *));
+static long ecoff_sec_to_styp_flags
+ PARAMS ((const char *, flagword));
+static bfd_boolean ecoff_slurp_symbolic_header
+ PARAMS ((bfd *));
+static bfd_boolean ecoff_set_symbol_info
+ PARAMS ((bfd *, SYMR *, asymbol *, int, int));
+static void ecoff_emit_aggregate
+ PARAMS ((bfd *, FDR *, char *, RNDXR *, long, const char *));
+static char *ecoff_type_to_string
+ PARAMS ((bfd *, FDR *, unsigned int));
+static bfd_boolean ecoff_slurp_reloc_table
+ PARAMS ((bfd *, asection *, asymbol **));
+static int ecoff_sort_hdrs
+ PARAMS ((const PTR, const PTR));
+static bfd_boolean ecoff_compute_section_file_positions
+ PARAMS ((bfd *));
+static bfd_size_type ecoff_compute_reloc_file_positions
+ PARAMS ((bfd *));
+static bfd_boolean ecoff_get_extr
+ PARAMS ((asymbol *, EXTR *));
+static void ecoff_set_index
+ PARAMS ((asymbol *, bfd_size_type));
+static unsigned int ecoff_armap_hash
+ PARAMS ((const char *, unsigned int *, unsigned int, unsigned int));
/* This stuff is somewhat copied from coffcode.h. */
@@ -68,6 +81,12 @@ static asection bfd_debug_section =
"*DEBUG*", 0, 0, NULL, 0, 0, 0,
/* linker_mark, linker_has_input, gc_mark, segment_mark, */
0, 0, 0, 0,
+ /* 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, */
@@ -76,21 +95,21 @@ static asection bfd_debug_section =
NULL, NULL, 0, 0, 0,
/* line_filepos, userdata, contents, lineno, lineno_count, */
0, NULL, NULL, NULL, 0,
- /* entsize, comdat, moving_line_filepos, */
- 0, 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 symbol_cache_entry *) NULL,
+ (struct bfd_symbol *) NULL,
/* symbol_ptr_ptr, */
- (struct symbol_cache_entry **) NULL,
+ (struct bfd_symbol **) NULL,
/* link_order_head, link_order_tail */
NULL, NULL
};
/* Create an ECOFF object. */
-boolean
+bfd_boolean
_bfd_ecoff_mkobject (abfd)
bfd *abfd;
{
@@ -98,9 +117,9 @@ _bfd_ecoff_mkobject (abfd)
abfd->tdata.ecoff_obj_data = (struct ecoff_tdata *) bfd_zalloc (abfd, amt);
if (abfd->tdata.ecoff_obj_data == NULL)
- return false;
+ return FALSE;
- return true;
+ return TRUE;
}
/* This is a hook called by coff_real_object_p to create any backend
@@ -151,7 +170,7 @@ _bfd_ecoff_mkobject_hook (abfd, filehdr, aouthdr)
/* Initialize a new section. */
-boolean
+bfd_boolean
_bfd_ecoff_new_section_hook (abfd, section)
bfd *abfd ATTRIBUTE_UNUSED;
asection *section;
@@ -182,7 +201,7 @@ _bfd_ecoff_new_section_hook (abfd, section)
uncertain about .init on some systems and I don't know how shared
libraries work. */
- return true;
+ return TRUE;
}
/* Determine the machine architecture and type. This is called from
@@ -190,7 +209,7 @@ _bfd_ecoff_new_section_hook (abfd, section)
below. This could be an ECOFF backend routine, with one version
for each target, but there aren't all that many ECOFF targets. */
-boolean
+bfd_boolean
_bfd_ecoff_set_arch_mach_hook (abfd, filehdr)
bfd *abfd;
PTR filehdr;
@@ -205,21 +224,21 @@ _bfd_ecoff_set_arch_mach_hook (abfd, filehdr)
case MIPS_MAGIC_LITTLE:
case MIPS_MAGIC_BIG:
arch = bfd_arch_mips;
- mach = 3000;
+ mach = bfd_mach_mips3000;
break;
case MIPS_MAGIC_LITTLE2:
case MIPS_MAGIC_BIG2:
/* MIPS ISA level 2: the r6000. */
arch = bfd_arch_mips;
- mach = 6000;
+ mach = bfd_mach_mips6000;
break;
case MIPS_MAGIC_LITTLE3:
case MIPS_MAGIC_BIG3:
/* MIPS ISA level 3: the r4000. */
arch = bfd_arch_mips;
- mach = 4000;
+ mach = bfd_mach_mips4000;
break;
case ALPHA_MAGIC:
@@ -252,17 +271,17 @@ ecoff_get_magic (abfd)
{
default:
case 0:
- case 3000:
+ case bfd_mach_mips3000:
big = MIPS_MAGIC_BIG;
little = MIPS_MAGIC_LITTLE;
break;
- case 6000:
+ case bfd_mach_mips6000:
big = MIPS_MAGIC_BIG2;
little = MIPS_MAGIC_LITTLE2;
break;
- case 4000:
+ case bfd_mach_mips4000:
big = MIPS_MAGIC_BIG3;
little = MIPS_MAGIC_LITTLE3;
break;
@@ -360,7 +379,7 @@ ecoff_sec_to_styp_flags (name, flags)
/* Get the BFD flags to use for a section. */
-boolean
+bfd_boolean
_bfd_ecoff_styp_to_sec_flags (abfd, hdr, name, section, flags_ptr)
bfd *abfd ATTRIBUTE_UNUSED;
PTR hdr;
@@ -425,12 +444,12 @@ _bfd_ecoff_styp_to_sec_flags (abfd, hdr, name, section, flags_ptr)
sec_flags |= SEC_ALLOC | SEC_LOAD;
* flags_ptr = sec_flags;
- return true;
+ return TRUE;
}
/* Read in the symbolic header for an ECOFF object file. */
-static boolean
+static bfd_boolean
ecoff_slurp_symbolic_header (abfd)
bfd *abfd;
{
@@ -442,13 +461,13 @@ ecoff_slurp_symbolic_header (abfd)
/* See if we've already read it in. */
if (ecoff_data (abfd)->debug_info.symbolic_header.magic ==
backend->debug_swap.sym_magic)
- return true;
+ return TRUE;
/* See whether there is a symbolic header. */
if (ecoff_data (abfd)->sym_filepos == 0)
{
bfd_get_symcount (abfd) = 0;
- return true;
+ return TRUE;
}
/* At this point bfd_get_symcount (abfd) holds the number of symbols
@@ -459,7 +478,7 @@ ecoff_slurp_symbolic_header (abfd)
if (bfd_get_symcount (abfd) != external_hdr_size)
{
bfd_set_error (bfd_error_bad_value);
- return false;
+ return FALSE;
}
/* Read the symbolic information header. */
@@ -485,18 +504,18 @@ ecoff_slurp_symbolic_header (abfd)
if (raw != NULL)
free (raw);
- return true;
+ return TRUE;
error_return:
if (raw != NULL)
free (raw);
- return false;
+ return FALSE;
}
/* Read in and swap the important symbolic information for an ECOFF
object file. This is called by gdb via the read_debug_info entry
point in the backend structure. */
-boolean
+bfd_boolean
_bfd_ecoff_slurp_symbolic_info (abfd, ignore, debug)
bfd *abfd;
asection *ignore ATTRIBUTE_UNUSED;
@@ -521,15 +540,15 @@ _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)
- return true;
+ return TRUE;
if (ecoff_data (abfd)->sym_filepos == 0)
{
bfd_get_symcount (abfd) = 0;
- return true;
+ return TRUE;
}
if (! ecoff_slurp_symbolic_header (abfd))
- return false;
+ return FALSE;
internal_symhdr = &debug->symbolic_header;
@@ -569,11 +588,11 @@ _bfd_ecoff_slurp_symbolic_info (abfd, ignore, debug)
if (raw_size == 0)
{
ecoff_data (abfd)->sym_filepos = 0;
- return true;
+ return TRUE;
}
raw = (PTR) bfd_alloc (abfd, raw_size);
if (raw == NULL)
- return false;
+ return FALSE;
pos = ecoff_data (abfd)->sym_filepos;
pos += backend->debug_swap.external_hdr_size;
@@ -581,7 +600,7 @@ _bfd_ecoff_slurp_symbolic_info (abfd, ignore, debug)
|| bfd_bread (raw, raw_size, abfd) != raw_size)
{
bfd_release (abfd, raw);
- return false;
+ return FALSE;
}
ecoff_data (abfd)->raw_syments = raw;
@@ -620,7 +639,7 @@ _bfd_ecoff_slurp_symbolic_info (abfd, ignore, debug)
amt *= sizeof (struct fdr);
debug->fdr = (struct fdr *) bfd_alloc (abfd, amt);
if (debug->fdr == NULL)
- return false;
+ return FALSE;
external_fdr_size = backend->debug_swap.external_fdr_size;
fdr_ptr = debug->fdr;
fraw_src = (char *) debug->external_fdr;
@@ -628,7 +647,7 @@ _bfd_ecoff_slurp_symbolic_info (abfd, ignore, debug)
for (; fraw_src < fraw_end; fraw_src += external_fdr_size, fdr_ptr++)
(*backend->debug_swap.swap_fdr_in) (abfd, (PTR) fraw_src, fdr_ptr);
- return true;
+ return TRUE;
}
/* ECOFF symbol table routines. The ECOFF symbol table is described
@@ -657,7 +676,7 @@ _bfd_ecoff_make_empty_symbol (abfd)
return (asymbol *) NULL;
new->symbol.section = (asection *) NULL;
new->fdr = (FDR *) NULL;
- new->local = false;
+ new->local = FALSE;
new->native = NULL;
new->symbol.the_bfd = abfd;
return &new->symbol;
@@ -665,7 +684,7 @@ _bfd_ecoff_make_empty_symbol (abfd)
/* Set the BFD flags and section for an ECOFF symbol. */
-static boolean
+static bfd_boolean
ecoff_set_symbol_info (abfd, ecoff_sym, asym, ext, weak)
bfd *abfd;
SYMR *ecoff_sym;
@@ -691,12 +710,12 @@ ecoff_set_symbol_info (abfd, ecoff_sym, asym, ext, weak)
if (ECOFF_IS_STAB (ecoff_sym))
{
asym->flags = BSF_DEBUGGING;
- return true;
+ return TRUE;
}
break;
default:
asym->flags = BSF_DEBUGGING;
- return true;
+ return TRUE;
}
if (weak)
@@ -877,7 +896,7 @@ ecoff_set_symbol_info (abfd, ecoff_sym, asym, ext, weak)
amt = strlen (name) + 1;
copy = (char *) bfd_alloc (abfd, amt);
if (!copy)
- return false;
+ return FALSE;
strcpy (copy, name);
section = bfd_make_section (abfd, copy);
}
@@ -886,7 +905,7 @@ ecoff_set_symbol_info (abfd, ecoff_sym, asym, ext, weak)
amt = sizeof (arelent_chain);
reloc_chain = (arelent_chain *) bfd_alloc (abfd, amt);
if (!reloc_chain)
- return false;
+ return FALSE;
reloc_chain->relent.sym_ptr_ptr =
bfd_get_section (asym)->symbol_ptr_ptr;
reloc_chain->relent.address = section->_raw_size;
@@ -919,12 +938,12 @@ ecoff_set_symbol_info (abfd, ecoff_sym, asym, ext, weak)
break;
}
}
- return true;
+ return TRUE;
}
/* Read an ECOFF symbol table. */
-boolean
+bfd_boolean
_bfd_ecoff_slurp_symbol_table (abfd)
bfd *abfd;
{
@@ -947,20 +966,20 @@ _bfd_ecoff_slurp_symbol_table (abfd)
/* If we've already read in the symbol table, do nothing. */
if (ecoff_data (abfd)->canonical_symbols != NULL)
- return true;
+ return TRUE;
/* Get the symbolic information. */
if (! _bfd_ecoff_slurp_symbolic_info (abfd, (asection *) NULL,
&ecoff_data (abfd)->debug_info))
- return false;
+ return FALSE;
if (bfd_get_symcount (abfd) == 0)
- return true;
+ return TRUE;
internal_size = bfd_get_symcount (abfd);
internal_size *= sizeof (ecoff_symbol_type);
internal = (ecoff_symbol_type *) bfd_alloc (abfd, internal_size);
if (internal == NULL)
- return false;
+ return FALSE;
internal_ptr = internal;
eraw_src = (char *) ecoff_data (abfd)->debug_info.external_ext;
@@ -977,14 +996,14 @@ _bfd_ecoff_slurp_symbol_table (abfd)
if (!ecoff_set_symbol_info (abfd, &internal_esym.asym,
&internal_ptr->symbol, 1,
internal_esym.weakext))
- return false;
+ return FALSE;
/* The alpha uses a negative ifd field for section symbols. */
if (internal_esym.ifd >= 0)
internal_ptr->fdr = (ecoff_data (abfd)->debug_info.fdr
+ internal_esym.ifd);
else
internal_ptr->fdr = NULL;
- internal_ptr->local = false;
+ internal_ptr->local = FALSE;
internal_ptr->native = (PTR) eraw_src;
}
@@ -1012,16 +1031,16 @@ _bfd_ecoff_slurp_symbol_table (abfd)
+ internal_sym.iss);
if (!ecoff_set_symbol_info (abfd, &internal_sym,
&internal_ptr->symbol, 0, 0))
- return false;
+ return FALSE;
internal_ptr->fdr = fdr_ptr;
- internal_ptr->local = true;
+ internal_ptr->local = TRUE;
internal_ptr->native = (PTR) lraw_src;
}
}
ecoff_data (abfd)->canonical_symbols = internal;
- return true;
+ return TRUE;
}
/* Return the amount of space needed for the canonical symbols. */
@@ -1043,7 +1062,7 @@ _bfd_ecoff_get_symtab_upper_bound (abfd)
/* Get the canonical symbols. */
long
-_bfd_ecoff_get_symtab (abfd, alocation)
+_bfd_ecoff_canonicalize_symtab (abfd, alocation)
bfd *abfd;
asymbol **alocation;
{
@@ -1443,7 +1462,7 @@ _bfd_ecoff_get_symbol_info (abfd, symbol, ret)
/* Return whether this is a local label. */
-boolean
+bfd_boolean
_bfd_ecoff_bfd_is_local_label_name (abfd, name)
bfd *abfd ATTRIBUTE_UNUSED;
const char *name;
@@ -1642,7 +1661,7 @@ _bfd_ecoff_print_symbol (abfd, filep, symbol, how)
/* Read in the relocs for a section. */
-static boolean
+static bfd_boolean
ecoff_slurp_reloc_table (abfd, section, symbols)
bfd *abfd;
asection *section;
@@ -1659,10 +1678,10 @@ ecoff_slurp_reloc_table (abfd, section, symbols)
if (section->relocation != (arelent *) NULL
|| section->reloc_count == 0
|| (section->flags & SEC_CONSTRUCTOR) != 0)
- return true;
+ return TRUE;
if (! _bfd_ecoff_slurp_symbol_table (abfd))
- return false;
+ return FALSE;
amt = section->reloc_count;
amt *= sizeof (arelent);
@@ -1673,11 +1692,11 @@ ecoff_slurp_reloc_table (abfd, section, symbols)
external_relocs = (char *) bfd_alloc (abfd, amt);
if (internal_relocs == (arelent *) NULL
|| external_relocs == (char *) NULL)
- return false;
+ return FALSE;
if (bfd_seek (abfd, section->rel_filepos, SEEK_SET) != 0)
- return false;
+ return FALSE;
if (bfd_bread (external_relocs, amt, abfd) != amt)
- return false;
+ return FALSE;
for (i = 0, rptr = internal_relocs; i < section->reloc_count; i++, rptr++)
{
@@ -1747,7 +1766,7 @@ ecoff_slurp_reloc_table (abfd, section, symbols)
section->relocation = internal_relocs;
- return true;
+ return TRUE;
}
/* Get a canonical list of relocs. */
@@ -1795,7 +1814,7 @@ _bfd_ecoff_canonicalize_reloc (abfd, section, relptr, symbols)
and return the name of the source file and the line nearest to the
wanted location. */
-boolean
+bfd_boolean
_bfd_ecoff_find_nearest_line (abfd, section, ignore_symbols, offset,
filename_ptr, functionname_ptr, retline_ptr)
bfd *abfd;
@@ -1814,7 +1833,7 @@ _bfd_ecoff_find_nearest_line (abfd, section, ignore_symbols, offset,
/* Make sure we have the FDR's. */
if (! _bfd_ecoff_slurp_symbolic_info (abfd, (asection *) NULL, debug_info)
|| bfd_get_symcount (abfd) == 0)
- return false;
+ return FALSE;
if (ecoff_data (abfd)->find_line_info == NULL)
{
@@ -1822,7 +1841,7 @@ _bfd_ecoff_find_nearest_line (abfd, section, ignore_symbols, offset,
ecoff_data (abfd)->find_line_info
= (struct ecoff_find_line *) bfd_zalloc (abfd, amt);
if (ecoff_data (abfd)->find_line_info == NULL)
- return false;
+ return FALSE;
}
line_info = ecoff_data (abfd)->find_line_info;
@@ -1844,7 +1863,7 @@ _bfd_ecoff_find_nearest_line (abfd, section, ignore_symbols, offset,
the symbol table, so this function only handles the other debugging
information. */
-boolean
+bfd_boolean
_bfd_ecoff_bfd_copy_private_bfd_data (ibfd, obfd)
bfd *ibfd;
bfd *obfd;
@@ -1854,13 +1873,13 @@ _bfd_ecoff_bfd_copy_private_bfd_data (ibfd, obfd)
register int i;
asymbol **sym_ptr_ptr;
size_t c;
- boolean local;
+ bfd_boolean local;
/* We only want to copy information over if both BFD's use ECOFF
format. */
if (bfd_get_flavour (ibfd) != bfd_target_ecoff_flavour
|| bfd_get_flavour (obfd) != bfd_target_ecoff_flavour)
- return true;
+ return TRUE;
/* Copy the GP value and the register masks. */
ecoff_data (obfd)->gp = ecoff_data (ibfd)->gp;
@@ -1876,15 +1895,15 @@ _bfd_ecoff_bfd_copy_private_bfd_data (ibfd, obfd)
c = bfd_get_symcount (obfd);
sym_ptr_ptr = bfd_get_outsymbols (obfd);
if (c == 0 || sym_ptr_ptr == (asymbol **) NULL)
- return true;
+ return TRUE;
/* See if there are any local symbols. */
- local = false;
+ local = FALSE;
for (; c > 0; c--, sym_ptr_ptr++)
{
if (ecoffsymbol (*sym_ptr_ptr)->local)
{
- local = true;
+ local = TRUE;
break;
}
}
@@ -1947,14 +1966,14 @@ _bfd_ecoff_bfd_copy_private_bfd_data (ibfd, obfd)
}
}
- return true;
+ return TRUE;
}
/* Set the architecture. The supported architecture is stored in the
backend pointer. We always set the architecture anyhow, since many
callers ignore the return value. */
-boolean
+bfd_boolean
_bfd_ecoff_set_arch_mach (abfd, arch, machine)
bfd *abfd;
enum bfd_architecture arch;
@@ -1969,7 +1988,7 @@ _bfd_ecoff_set_arch_mach (abfd, arch, machine)
int
_bfd_ecoff_sizeof_headers (abfd, reloc)
bfd *abfd;
- boolean reloc ATTRIBUTE_UNUSED;
+ bfd_boolean reloc ATTRIBUTE_UNUSED;
{
asection *current;
int c;
@@ -1989,7 +2008,7 @@ _bfd_ecoff_sizeof_headers (abfd, reloc)
/* Get the contents of a section. */
-boolean
+bfd_boolean
_bfd_ecoff_get_section_contents (abfd, section, location, offset, count)
bfd *abfd;
asection *section;
@@ -2033,7 +2052,7 @@ ecoff_sort_hdrs (arg1, arg2)
/* Calculate the file position for each section, and set
reloc_filepos. */
-static boolean
+static bfd_boolean
ecoff_compute_section_file_positions (abfd)
bfd *abfd;
{
@@ -2042,12 +2061,12 @@ ecoff_compute_section_file_positions (abfd)
asection *current;
unsigned int i;
file_ptr old_sofar;
- boolean rdata_in_text;
- boolean first_data, first_nonalloc;
+ bfd_boolean rdata_in_text;
+ bfd_boolean first_data, first_nonalloc;
const bfd_vma round = ecoff_backend (abfd)->round;
bfd_size_type amt;
- sofar = _bfd_ecoff_sizeof_headers (abfd, false);
+ sofar = _bfd_ecoff_sizeof_headers (abfd, FALSE);
file_sofar = sofar;
/* Sort the sections by VMA. */
@@ -2055,7 +2074,7 @@ ecoff_compute_section_file_positions (abfd)
amt *= sizeof (asection *);
sorted_hdrs = (asection **) bfd_malloc (amt);
if (sorted_hdrs == NULL)
- return false;
+ return FALSE;
for (current = abfd->sections, i = 0;
current != NULL;
current = current->next, i++)
@@ -2079,15 +2098,15 @@ ecoff_compute_section_file_positions (abfd)
&& strcmp (current->name, _PDATA) != 0
&& strcmp (current->name, _RCONST) != 0)
{
- rdata_in_text = false;
+ rdata_in_text = FALSE;
break;
}
}
}
ecoff_data (abfd)->rdata_in_text = rdata_in_text;
- first_data = true;
- first_nonalloc = true;
+ first_data = TRUE;
+ first_nonalloc = TRUE;
for (i = 0; i < abfd->section_count; i++)
{
unsigned int alignment_power;
@@ -2120,7 +2139,7 @@ ecoff_compute_section_file_positions (abfd)
{
sofar = (sofar + round - 1) &~ (round - 1);
file_sofar = (file_sofar + round - 1) &~ (round - 1);
- first_data = false;
+ first_data = FALSE;
}
else if (strcmp (current->name, _LIB) == 0)
{
@@ -2138,7 +2157,7 @@ ecoff_compute_section_file_positions (abfd)
/* Skip up to the next page for an unallocated section, such
as the .comment section on the Alpha. This leaves room
for the .bss section. */
- first_nonalloc = false;
+ first_nonalloc = FALSE;
sofar = (sofar + round - 1) &~ (round - 1);
file_sofar = (file_sofar + round - 1) &~ (round - 1);
}
@@ -2177,7 +2196,7 @@ ecoff_compute_section_file_positions (abfd)
ecoff_data (abfd)->reloc_filepos = file_sofar;
- return true;
+ return TRUE;
}
/* Determine the location of the relocs for all the sections in the
@@ -2199,7 +2218,7 @@ ecoff_compute_reloc_file_positions (abfd)
{
if (! ecoff_compute_section_file_positions (abfd))
abort ();
- abfd->output_has_begun = true;
+ abfd->output_has_begun = TRUE;
}
reloc_base = ecoff_data (abfd)->reloc_filepos;
@@ -2239,22 +2258,22 @@ ecoff_compute_reloc_file_positions (abfd)
/* Set the contents of a section. */
-boolean
+bfd_boolean
_bfd_ecoff_set_section_contents (abfd, section, location, offset, count)
bfd *abfd;
asection *section;
- PTR location;
+ const PTR location;
file_ptr offset;
bfd_size_type count;
{
file_ptr pos;
/* This must be done first, because bfd_set_section_contents is
- going to set output_has_begun to true. */
+ going to set output_has_begun to TRUE. */
if (! abfd->output_has_begun)
{
if (! ecoff_compute_section_file_positions (abfd))
- return false;
+ return FALSE;
}
/* Handle the .lib section specially so that Irix 4 shared libraries
@@ -2275,14 +2294,14 @@ _bfd_ecoff_set_section_contents (abfd, section, location, offset, count)
}
if (count == 0)
- return true;
+ return TRUE;
pos = section->filepos + offset;
if (bfd_seek (abfd, pos, SEEK_SET) != 0
|| bfd_bwrite (location, count, abfd) != count)
- return false;
+ return FALSE;
- return true;
+ return TRUE;
}
/* Get the GP value for an ECOFF file. This is a hook used by
@@ -2305,7 +2324,7 @@ bfd_ecoff_get_gp_value (abfd)
/* Set the GP value for an ECOFF file. This is a hook used by the
assembler. */
-boolean
+bfd_boolean
bfd_ecoff_set_gp_value (abfd, gp_value)
bfd *abfd;
bfd_vma gp_value;
@@ -2314,18 +2333,18 @@ bfd_ecoff_set_gp_value (abfd, gp_value)
|| bfd_get_format (abfd) != bfd_object)
{
bfd_set_error (bfd_error_invalid_operation);
- return false;
+ return FALSE;
}
ecoff_data (abfd)->gp = gp_value;
- return true;
+ return TRUE;
}
/* Set the register masks for an ECOFF file. This is a hook used by
the assembler. */
-boolean
+bfd_boolean
bfd_ecoff_set_regmasks (abfd, gprmask, fprmask, cprmask)
bfd *abfd;
unsigned long gprmask;
@@ -2338,7 +2357,7 @@ bfd_ecoff_set_regmasks (abfd, gprmask, fprmask, cprmask)
|| bfd_get_format (abfd) != bfd_object)
{
bfd_set_error (bfd_error_invalid_operation);
- return false;
+ return FALSE;
}
tdata = ecoff_data (abfd);
@@ -2352,13 +2371,13 @@ bfd_ecoff_set_regmasks (abfd, gprmask, fprmask, cprmask)
tdata->cprmask[i] = cprmask[i];
}
- return true;
+ return TRUE;
}
/* Get ECOFF EXTR information for an external symbol. This function
is passed to bfd_ecoff_debug_externals. */
-static boolean
+static bfd_boolean
ecoff_get_extr (sym, esym)
asymbol *sym;
EXTR *esym;
@@ -2373,7 +2392,7 @@ ecoff_get_extr (sym, esym)
if ((sym->flags & BSF_DEBUGGING) != 0
|| (sym->flags & BSF_LOCAL) != 0
|| (sym->flags & BSF_SECTION_SYM) != 0)
- return false;
+ return FALSE;
esym->jmptbl = 0;
esym->cobol_main = 0;
@@ -2385,13 +2404,13 @@ ecoff_get_extr (sym, esym)
esym->asym.sc = scAbs;
esym->asym.reserved = 0;
esym->asym.index = indexNil;
- return true;
+ return TRUE;
}
ecoff_sym_ptr = ecoffsymbol (sym);
if (ecoff_sym_ptr->local)
- return false;
+ return FALSE;
input_bfd = bfd_asymbol_bfd (sym);
(*(ecoff_backend (input_bfd)->debug_swap.swap_ext_in))
@@ -2417,7 +2436,7 @@ ecoff_get_extr (sym, esym)
esym->ifd = input_debug->ifdmap[esym->ifd];
}
- return true;
+ return TRUE;
}
/* Set the external symbol index. This routine is passed to
@@ -2433,7 +2452,7 @@ ecoff_set_index (sym, indx)
/* Write out an ECOFF file. */
-boolean
+bfd_boolean
_bfd_ecoff_write_object_contents (abfd)
bfd *abfd;
{
@@ -2445,13 +2464,11 @@ _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)
+ PARAMS ((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)
+ PARAMS ((bfd *, const struct internal_reloc *, PTR))
= backend->swap_reloc_out;
struct ecoff_debug_info * const debug = &ecoff_data (abfd)->debug_info;
HDRR * const symhdr = &debug->symbolic_header;
@@ -2460,10 +2477,10 @@ _bfd_ecoff_write_object_contents (abfd)
bfd_size_type reloc_size;
bfd_size_type text_size;
bfd_vma text_start;
- boolean set_text_start;
+ bfd_boolean set_text_start;
bfd_size_type data_size;
bfd_vma data_start;
- boolean set_data_start;
+ bfd_boolean set_data_start;
bfd_size_type bss_size;
PTR buff = NULL;
PTR reloc_buff = NULL;
@@ -2485,14 +2502,14 @@ _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, FALSE);
else
text_size = 0;
text_start = 0;
- set_text_start = false;
+ set_text_start = FALSE;
data_size = 0;
data_start = 0;
- set_data_start = false;
+ set_data_start = FALSE;
bss_size = 0;
/* Write section headers to the file. */
@@ -2588,7 +2605,7 @@ _bfd_ecoff_write_object_contents (abfd)
if (! set_text_start || text_start > vma)
{
text_start = vma;
- set_text_start = true;
+ set_text_start = TRUE;
}
}
else if ((section.s_flags & STYP_RDATA) != 0
@@ -2604,7 +2621,7 @@ _bfd_ecoff_write_object_contents (abfd)
if (! set_data_start || data_start > vma)
{
data_start = vma;
- set_data_start = true;
+ set_data_start = TRUE;
}
}
else if ((section.s_flags & STYP_BSS) != 0
@@ -2870,13 +2887,13 @@ _bfd_ecoff_write_object_contents (abfd)
bfd_release (abfd, reloc_buff);
if (buff != NULL)
free (buff);
- return true;
+ return TRUE;
error_return:
if (reloc_buff != NULL)
bfd_release (abfd, reloc_buff);
if (buff != NULL)
free (buff);
- return false;
+ return FALSE;
}
/* Archive handling. ECOFF uses what appears to be a unique type of
@@ -2949,7 +2966,7 @@ ecoff_armap_hash (s, rehash, size, hlog)
/* Read in the armap. */
-boolean
+bfd_boolean
_bfd_ecoff_slurp_armap (abfd)
bfd *abfd;
{
@@ -2968,12 +2985,12 @@ _bfd_ecoff_slurp_armap (abfd)
/* Get the name of the first element. */
i = bfd_bread ((PTR) nextname, (bfd_size_type) 16, abfd);
if (i == 0)
- return true;
+ return TRUE;
if (i != 16)
- return false;
+ return FALSE;
if (bfd_seek (abfd, (file_ptr) -16, SEEK_CUR) != 0)
- return false;
+ return FALSE;
/* Irix 4.0.5F apparently can use either an ECOFF armap or a
standard COFF armap. We could move the ECOFF armap stuff into
@@ -2995,8 +3012,8 @@ _bfd_ecoff_slurp_armap (abfd)
|| strncmp (nextname + ARMAP_END_INDEX,
ARMAP_END, sizeof ARMAP_END - 1) != 0)
{
- bfd_has_map (abfd) = false;
- return true;
+ bfd_has_map (abfd) = FALSE;
+ return TRUE;
}
/* Make sure we have the right byte ordering. */
@@ -3006,27 +3023,27 @@ _bfd_ecoff_slurp_armap (abfd)
^ (bfd_big_endian (abfd))))
{
bfd_set_error (bfd_error_wrong_format);
- return false;
+ return FALSE;
}
/* Read in the armap. */
ardata = bfd_ardata (abfd);
mapdata = (struct areltdata *) _bfd_read_ar_hdr (abfd);
if (mapdata == (struct areltdata *) NULL)
- return false;
+ return FALSE;
parsed_size = mapdata->parsed_size;
bfd_release (abfd, (PTR) mapdata);
raw_armap = (char *) bfd_alloc (abfd, parsed_size);
if (raw_armap == (char *) NULL)
- return false;
+ return FALSE;
if (bfd_bread ((PTR) raw_armap, parsed_size, abfd) != parsed_size)
{
if (bfd_get_error () != bfd_error_system_call)
bfd_set_error (bfd_error_malformed_archive);
bfd_release (abfd, (PTR) raw_armap);
- return false;
+ return FALSE;
}
ardata->tdata = (PTR) raw_armap;
@@ -3086,7 +3103,7 @@ _bfd_ecoff_slurp_armap (abfd)
amt *= sizeof (struct symdef);
symdef_ptr = (struct symdef *) bfd_alloc (abfd, amt);
if (!symdef_ptr)
- return false;
+ return FALSE;
ardata->symdefs = (carsym *) symdef_ptr;
@@ -3108,14 +3125,14 @@ _bfd_ecoff_slurp_armap (abfd)
/* Pad to an even boundary. */
ardata->first_file_filepos += ardata->first_file_filepos % 2;
- bfd_has_map (abfd) = true;
+ bfd_has_map (abfd) = TRUE;
- return true;
+ return TRUE;
}
/* Write out an armap. */
-boolean
+bfd_boolean
_bfd_ecoff_write_armap (abfd, elength, map, orl_count, stridx)
bfd *abfd;
unsigned int elength;
@@ -3199,15 +3216,15 @@ _bfd_ecoff_write_armap (abfd, elength, map, orl_count, stridx)
if (bfd_bwrite ((PTR) &hdr, (bfd_size_type) sizeof (struct ar_hdr), abfd)
!= sizeof (struct ar_hdr))
- return false;
+ return FALSE;
H_PUT_32 (abfd, hashsize, temp);
if (bfd_bwrite ((PTR) temp, (bfd_size_type) 4, abfd) != 4)
- return false;
+ return FALSE;
hashtable = (bfd_byte *) bfd_zalloc (abfd, symdefsize);
if (!hashtable)
- return false;
+ return FALSE;
current = abfd->archive_head;
last_elt = current;
@@ -3252,21 +3269,21 @@ _bfd_ecoff_write_armap (abfd, elength, map, orl_count, stridx)
}
if (bfd_bwrite ((PTR) hashtable, symdefsize, abfd) != symdefsize)
- return false;
+ return FALSE;
bfd_release (abfd, hashtable);
/* Now write the strings. */
H_PUT_32 (abfd, stringsize, temp);
if (bfd_bwrite ((PTR) temp, (bfd_size_type) 4, abfd) != 4)
- return false;
+ return FALSE;
for (i = 0; i < orl_count; i++)
{
bfd_size_type len;
len = strlen (*map[i].name) + 1;
if (bfd_bwrite ((PTR) (*map[i].name), len, abfd) != len)
- return false;
+ return FALSE;
}
/* The spec sez this should be a newline. But in order to be
@@ -3274,10 +3291,10 @@ _bfd_ecoff_write_armap (abfd, elength, map, orl_count, stridx)
if (padit)
{
if (bfd_bwrite ("", (bfd_size_type) 1, abfd) != 1)
- return false;
+ return FALSE;
}
- return true;
+ return TRUE;
}
/* See whether this BFD is an archive. If it is, read in the armap
@@ -3343,7 +3360,7 @@ _bfd_ecoff_archive_p (abfd)
first = bfd_openr_next_archived_file (abfd, (bfd *) NULL);
if (first != NULL)
{
- first->target_defaulted = false;
+ first->target_defaulted = FALSE;
if (bfd_check_format (first, bfd_object)
&& first->xvec != abfd->xvec)
{
@@ -3372,13 +3389,13 @@ static struct bfd_hash_entry *ecoff_link_hash_newfunc
PARAMS ((struct bfd_hash_entry *entry,
struct bfd_hash_table *table,
const char *string));
-static boolean ecoff_link_add_archive_symbols
+static bfd_boolean ecoff_link_add_archive_symbols
PARAMS ((bfd *, struct bfd_link_info *));
-static boolean ecoff_link_check_archive_element
- PARAMS ((bfd *, struct bfd_link_info *, boolean *pneeded));
-static boolean ecoff_link_add_object_symbols
+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 boolean ecoff_link_add_externals
+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. */
@@ -3449,7 +3466,7 @@ _bfd_ecoff_bfd_link_hash_table_create (abfd)
#define ecoff_link_hash_traverse(table, func, info) \
(bfd_link_hash_traverse \
(&(table)->root, \
- (boolean (*) PARAMS ((struct bfd_link_hash_entry *, PTR))) (func), \
+ (bfd_boolean (*) PARAMS ((struct bfd_link_hash_entry *, PTR))) (func), \
(info)))
/* Get the ECOFF link hash table from the info structure. This is
@@ -3460,7 +3477,7 @@ _bfd_ecoff_bfd_link_hash_table_create (abfd)
/* Given an ECOFF BFD, add symbols to the global hash table as
appropriate. */
-boolean
+bfd_boolean
_bfd_ecoff_bfd_link_add_symbols (abfd, info)
bfd *abfd;
struct bfd_link_info *info;
@@ -3473,7 +3490,7 @@ _bfd_ecoff_bfd_link_add_symbols (abfd, info)
return ecoff_link_add_archive_symbols (abfd, info);
default:
bfd_set_error (bfd_error_wrong_format);
- return false;
+ return FALSE;
}
}
@@ -3484,7 +3501,7 @@ _bfd_ecoff_bfd_link_add_symbols (abfd, info)
already have a hash table, so there is no reason to construct
another one. */
-static boolean
+static bfd_boolean
ecoff_link_add_archive_symbols (abfd, info)
bfd *abfd;
struct bfd_link_info *info;
@@ -3502,9 +3519,9 @@ ecoff_link_add_archive_symbols (abfd, info)
{
/* An empty archive is a special case. */
if (bfd_openr_next_archived_file (abfd, (bfd *) NULL) == NULL)
- return true;
+ return TRUE;
bfd_set_error (bfd_error_no_armap);
- return false;
+ return FALSE;
}
/* If we don't have any raw data for this archive, as can happen on
@@ -3549,9 +3566,9 @@ ecoff_link_add_archive_symbols (abfd, info)
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)->next;
+ *pundef = (*pundef)->und_next;
else
- pundef = &(*pundef)->next;
+ pundef = &(*pundef)->und_next;
continue;
}
@@ -3561,7 +3578,7 @@ ecoff_link_add_archive_symbols (abfd, info)
other object format. */
if (h->type != bfd_link_hash_undefined)
{
- pundef = &(*pundef)->next;
+ pundef = &(*pundef)->und_next;
continue;
}
@@ -3573,7 +3590,7 @@ ecoff_link_add_archive_symbols (abfd, info)
if (file_offset == 0)
{
/* Nothing in this slot. */
- pundef = &(*pundef)->next;
+ pundef = &(*pundef)->und_next;
continue;
}
@@ -3582,10 +3599,10 @@ ecoff_link_add_archive_symbols (abfd, info)
|| strcmp (name, h->root.string) != 0)
{
unsigned int srch;
- boolean found;
+ bfd_boolean found;
/* That was the wrong symbol. Try rehashing. */
- found = false;
+ found = FALSE;
for (srch = (hash + rehash) & (armap_count - 1);
srch != hash;
srch = (srch + rehash) & (armap_count - 1))
@@ -3597,14 +3614,14 @@ ecoff_link_add_archive_symbols (abfd, info)
if (name[0] == h->root.string[0]
&& strcmp (name, h->root.string) == 0)
{
- found = true;
+ found = TRUE;
break;
}
}
if (! found)
{
- pundef = &(*pundef)->next;
+ pundef = &(*pundef)->und_next;
continue;
}
@@ -3613,33 +3630,33 @@ ecoff_link_add_archive_symbols (abfd, info)
element = (*backend->get_elt_at_filepos) (abfd, (file_ptr) file_offset);
if (element == (bfd *) NULL)
- return false;
+ return FALSE;
if (! bfd_check_format (element, bfd_object))
- return false;
+ 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;
+ return FALSE;
if (! ecoff_link_add_object_symbols (element, info))
- return false;
+ return FALSE;
- pundef = &(*pundef)->next;
+ pundef = &(*pundef)->und_next;
}
- return true;
+ return TRUE;
}
/* This is called if we used _bfd_generic_link_add_archive_symbols
because we were not dealing with an ECOFF archive. */
-static boolean
+static bfd_boolean
ecoff_link_check_archive_element (abfd, info, pneeded)
bfd *abfd;
struct bfd_link_info *info;
- boolean *pneeded;
+ bfd_boolean *pneeded;
{
const struct ecoff_backend_data * const backend = ecoff_backend (abfd);
void (* const swap_ext_in) PARAMS ((bfd *, PTR, EXTR *))
@@ -3652,7 +3669,7 @@ ecoff_link_check_archive_element (abfd, info, pneeded)
char *ext_ptr;
char *ext_end;
- *pneeded = false;
+ *pneeded = FALSE;
if (! ecoff_slurp_symbolic_header (abfd))
goto error_return;
@@ -3690,7 +3707,7 @@ ecoff_link_check_archive_element (abfd, info, pneeded)
for (; ext_ptr < ext_end; ext_ptr += external_ext_size)
{
EXTR esym;
- boolean def;
+ bfd_boolean def;
const char *name;
struct bfd_link_hash_entry *h;
@@ -3716,10 +3733,10 @@ ecoff_link_check_archive_element (abfd, info, pneeded)
case scInit:
case scFini:
case scRConst:
- def = true;
+ def = TRUE;
break;
default:
- def = false;
+ def = FALSE;
break;
}
@@ -3727,7 +3744,7 @@ ecoff_link_check_archive_element (abfd, info, pneeded)
continue;
name = ssext + esym.asym.iss;
- h = bfd_link_hash_lookup (info->hash, name, false, false, true);
+ 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. */
@@ -3741,7 +3758,7 @@ ecoff_link_check_archive_element (abfd, info, pneeded)
if (! ecoff_link_add_externals (abfd, info, external_ext, ssext))
goto error_return;
- *pneeded = true;
+ *pneeded = TRUE;
goto successful_return;
}
@@ -3750,19 +3767,19 @@ ecoff_link_check_archive_element (abfd, info, pneeded)
free (external_ext);
if (ssext != NULL)
free (ssext);
- return true;
+ return TRUE;
error_return:
if (external_ext != NULL)
free (external_ext);
if (ssext != NULL)
free (ssext);
- return false;
+ return FALSE;
}
/* Add symbols from an ECOFF object file to the global linker hash
table. */
-static boolean
+static bfd_boolean
ecoff_link_add_object_symbols (abfd, info)
bfd *abfd;
struct bfd_link_info *info;
@@ -3772,14 +3789,14 @@ ecoff_link_add_object_symbols (abfd, info)
PTR external_ext = NULL;
bfd_size_type esize;
char *ssext = NULL;
- boolean result;
+ bfd_boolean result;
if (! ecoff_slurp_symbolic_header (abfd))
- return false;
+ return FALSE;
/* If there are no symbols, we don't want it. */
if (bfd_get_symcount (abfd) == 0)
- return true;
+ return TRUE;
symhdr = &ecoff_data (abfd)->debug_info.symbolic_header;
@@ -3816,7 +3833,7 @@ ecoff_link_add_object_symbols (abfd, info)
free (ssext);
if (external_ext != NULL)
free (external_ext);
- return false;
+ return FALSE;
}
/* Add the external symbols of an object file to the global linker
@@ -3825,7 +3842,7 @@ ecoff_link_add_object_symbols (abfd, info)
explicitly save any information we may need later on in the link.
We do not want to read the external symbol information again. */
-static boolean
+static bfd_boolean
ecoff_link_add_externals (abfd, info, external_ext, ssext)
bfd *abfd;
struct bfd_link_info *info;
@@ -3848,7 +3865,7 @@ ecoff_link_add_externals (abfd, info, external_ext, ssext)
amt *= sizeof (struct bfd_link_hash_entry *);
sym_hash = (struct bfd_link_hash_entry **) bfd_alloc (abfd, amt);
if (!sym_hash)
- return false;
+ return FALSE;
ecoff_data (abfd)->sym_hashes = (struct ecoff_link_hash_entry **) sym_hash;
ext_ptr = (char *) external_ext;
@@ -3856,7 +3873,7 @@ ecoff_link_add_externals (abfd, info, external_ext, ssext)
for (; ext_ptr < ext_end; ext_ptr += external_ext_size, sym_hash++)
{
EXTR esym;
- boolean skip;
+ bfd_boolean skip;
bfd_vma value;
asection *section;
const char *name;
@@ -3867,7 +3884,7 @@ ecoff_link_add_externals (abfd, info, external_ext, ssext)
(*swap_ext_in) (abfd, (PTR) ext_ptr, &esym);
/* Skip debugging symbols. */
- skip = false;
+ skip = FALSE;
switch (esym.asym.st)
{
case stGlobal:
@@ -3877,7 +3894,7 @@ ecoff_link_add_externals (abfd, info, external_ext, ssext)
case stStaticProc:
break;
default:
- skip = true;
+ skip = TRUE;
break;
}
@@ -3983,8 +4000,8 @@ 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)))
- return false;
+ section, value, (const char *) NULL, TRUE, TRUE, sym_hash)))
+ return FALSE;
h = (struct ecoff_link_hash_entry *) *sym_hash;
@@ -4024,20 +4041,20 @@ ecoff_link_add_externals (abfd, info, external_ext, ssext)
}
}
- return true;
+ return TRUE;
}
/* ECOFF final link routines. */
-static boolean ecoff_final_link_debug_accumulate
+static bfd_boolean ecoff_final_link_debug_accumulate
PARAMS ((bfd *output_bfd, bfd *input_bfd, struct bfd_link_info *,
PTR handle));
-static boolean ecoff_link_write_external
+static bfd_boolean ecoff_link_write_external
PARAMS ((struct ecoff_link_hash_entry *, PTR));
-static boolean ecoff_indirect_link_order
+static bfd_boolean ecoff_indirect_link_order
PARAMS ((bfd *, struct bfd_link_info *, asection *,
struct bfd_link_order *));
-static boolean ecoff_reloc_link_order
+static bfd_boolean ecoff_reloc_link_order
PARAMS ((bfd *, struct bfd_link_info *, asection *,
struct bfd_link_order *));
@@ -4054,7 +4071,7 @@ struct extsym_info
processes all the link order information. This may cause it to
close and reopen some input BFDs; I'll see how bad this is. */
-boolean
+bfd_boolean
_bfd_ecoff_bfd_final_link (abfd, info)
bfd *abfd;
struct bfd_link_info *info;
@@ -4101,18 +4118,18 @@ _bfd_ecoff_bfd_final_link (abfd, info)
handle = bfd_ecoff_debug_init (abfd, debug, &backend->debug_swap, info);
if (handle == (PTR) NULL)
- return false;
+ return FALSE;
/* Accumulate the debugging symbols from each input BFD. */
for (input_bfd = info->input_bfds;
input_bfd != (bfd *) NULL;
input_bfd = input_bfd->link_next)
{
- boolean ret;
+ bfd_boolean ret;
if (bfd_get_flavour (input_bfd) == bfd_target_ecoff_flavour)
{
- /* Abitrarily set the symbolic header vstamp to the vstamp
+ /* Arbitrarily set the symbolic header vstamp to the vstamp
of the first object file in the link. */
if (symhdr->vstamp == 0)
symhdr->vstamp
@@ -4125,7 +4142,7 @@ _bfd_ecoff_bfd_final_link (abfd, info)
debug, &backend->debug_swap,
input_bfd, info);
if (! ret)
- return false;
+ return FALSE;
/* Combine the register masks. */
ecoff_data (abfd)->gprmask |= ecoff_data (input_bfd)->gprmask;
@@ -4143,7 +4160,7 @@ _bfd_ecoff_bfd_final_link (abfd, info)
ecoff_link_write_external,
(PTR) &einfo);
- if (info->relocateable)
+ 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
@@ -4169,11 +4186,11 @@ _bfd_ecoff_bfd_final_link (abfd, info)
if (! bfd_ecoff_write_accumulated_debug (handle, abfd, debug,
&backend->debug_swap, info,
ecoff_data (abfd)->sym_filepos))
- return false;
+ return FALSE;
bfd_ecoff_debug_free (handle, abfd, debug, &backend->debug_swap, info);
- if (info->relocateable)
+ 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
@@ -4187,13 +4204,13 @@ _bfd_ecoff_bfd_final_link (abfd, info)
{
struct bfd_link_hash_entry *h;
- h = bfd_link_hash_lookup (info->hash, "_gp", false, false, true);
+ 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->relocateable)
+ else if (info->relocatable)
{
bfd_vma lo;
@@ -4230,34 +4247,34 @@ _bfd_ecoff_bfd_final_link (abfd, info)
== bfd_target_ecoff_flavour))
{
if (! ecoff_indirect_link_order (abfd, info, o, p))
- return false;
+ 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;
+ return FALSE;
}
else
{
if (! _bfd_default_link_order (abfd, info, o, p))
- return false;
+ return FALSE;
}
}
}
bfd_get_symcount (abfd) = symhdr->iextMax + symhdr->isymMax;
- ecoff_data (abfd)->linker = true;
+ ecoff_data (abfd)->linker = TRUE;
- return true;
+ return TRUE;
}
/* Accumulate the debugging information for an input BFD into the
output BFD. This must read in the symbolic information of the
input BFD. */
-static boolean
+static bfd_boolean
ecoff_final_link_debug_accumulate (output_bfd, input_bfd, info, handle)
bfd *output_bfd;
bfd *input_bfd;
@@ -4268,7 +4285,7 @@ ecoff_final_link_debug_accumulate (output_bfd, input_bfd, info, handle)
const struct ecoff_debug_swap * const swap =
&ecoff_backend (input_bfd)->debug_swap;
HDRR *symhdr = &debug->symbolic_header;
- boolean ret;
+ bfd_boolean ret;
#define READ(ptr, offset, count, size, type) \
if (symhdr->count == 0) \
@@ -4279,13 +4296,13 @@ ecoff_final_link_debug_accumulate (output_bfd, input_bfd, info, handle)
debug->ptr = (type) bfd_malloc (amt); \
if (debug->ptr == NULL) \
{ \
- ret = false; \
+ ret = FALSE; \
goto return_something; \
} \
if (bfd_seek (input_bfd, (file_ptr) symhdr->offset, SEEK_SET) != 0 \
|| bfd_bread (debug->ptr, amt, input_bfd) != amt) \
{ \
- ret = false; \
+ ret = FALSE; \
goto return_something; \
} \
}
@@ -4356,37 +4373,37 @@ ecoff_final_link_debug_accumulate (output_bfd, input_bfd, info, handle)
/* Put out information for an external symbol. These come only from
the hash table. */
-static boolean
+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;
- boolean strip;
+ 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;
+ 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;
+ 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;
+ FALSE, FALSE) == NULL))
+ strip = TRUE;
else
- strip = false;
+ strip = FALSE;
if (strip || h->written)
- return true;
+ return TRUE;
if (h->abfd == (bfd *) NULL)
{
@@ -4484,7 +4501,7 @@ ecoff_link_write_external (h, data)
case bfd_link_hash_indirect:
/* We ignore these symbols, since the indirected symbol is
already in the hash table. */
- return true;
+ return TRUE;
}
/* bfd_ecoff_debug_one_external uses iextMax to keep track of the
@@ -4500,7 +4517,7 @@ ecoff_link_write_external (h, data)
/* Relocate and write an ECOFF section into an ECOFF output file. */
-static boolean
+static bfd_boolean
ecoff_indirect_link_order (output_bfd, info, output_section, link_order)
bfd *output_bfd;
struct bfd_link_info *info;
@@ -4521,7 +4538,7 @@ ecoff_indirect_link_order (output_bfd, info, output_section, link_order)
BFD_ASSERT ((output_section->flags & SEC_HAS_CONTENTS) != 0);
if (link_order->size == 0)
- return true;
+ return TRUE;
input_section = link_order->u.indirect.section;
input_bfd = input_section->owner;
@@ -4591,11 +4608,11 @@ ecoff_indirect_link_order (output_bfd, info, output_section, link_order)
cooked_size))
goto error_return;
- /* If we are producing relocateable output, the relocs were
+ /* If we are producing relocatable output, the relocs were
modified, and we write them out now. We use the reloc_count
field of output_section to keep track of the number of relocs we
have output so far. */
- if (info->relocateable)
+ if (info->relocatable)
{
file_ptr pos = (output_section->rel_filepos
+ output_section->reloc_count * external_reloc_size);
@@ -4610,14 +4627,14 @@ ecoff_indirect_link_order (output_bfd, info, output_section, link_order)
free (contents);
if (external_relocs != NULL && section_tdata == NULL)
free (external_relocs);
- return true;
+ return TRUE;
error_return:
if (contents != NULL)
free (contents);
if (external_relocs != NULL && section_tdata == NULL)
free (external_relocs);
- return false;
+ return FALSE;
}
/* Generate a reloc when linking an ECOFF file. This is a reloc
@@ -4625,7 +4642,7 @@ ecoff_indirect_link_order (output_bfd, info, output_section, link_order)
is used to build constructor and destructor tables when linking
with -Ur. */
-static boolean
+static bfd_boolean
ecoff_reloc_link_order (output_bfd, info, output_section, link_order)
bfd *output_bfd;
struct bfd_link_info *info;
@@ -4639,7 +4656,7 @@ ecoff_reloc_link_order (output_bfd, info, output_section, link_order)
struct internal_reloc in;
bfd_size_type external_reloc_size;
bfd_byte *rbuf;
- boolean ok;
+ bfd_boolean ok;
file_ptr pos;
type = link_order->type;
@@ -4654,7 +4671,7 @@ ecoff_reloc_link_order (output_bfd, info, output_section, link_order)
if (rel.howto == 0)
{
bfd_set_error (bfd_error_bad_value);
- return false;
+ return FALSE;
}
if (type == bfd_section_reloc_link_order)
@@ -4670,7 +4687,7 @@ ecoff_reloc_link_order (output_bfd, info, output_section, link_order)
actually against the section. */
h = bfd_wrapped_link_hash_lookup (output_bfd, info,
link_order->u.reloc.p->u.name,
- false, false, false);
+ FALSE, FALSE, FALSE);
if (h != NULL
&& (h->type == bfd_link_hash_defined
|| h->type == bfd_link_hash_defweak))
@@ -4704,7 +4721,7 @@ ecoff_reloc_link_order (output_bfd, info, output_section, link_order)
size = bfd_get_reloc_size (rel.howto);
buf = (bfd_byte *) bfd_zmalloc (size);
if (buf == (bfd_byte *) NULL)
- return false;
+ return FALSE;
rstat = _bfd_relocate_contents (rel.howto, output_bfd,
(bfd_vma) addend, buf);
switch (rstat)
@@ -4724,7 +4741,7 @@ ecoff_reloc_link_order (output_bfd, info, output_section, link_order)
(asection *) NULL, (bfd_vma) 0)))
{
free (buf);
- return false;
+ return FALSE;
}
break;
}
@@ -4732,7 +4749,7 @@ ecoff_reloc_link_order (output_bfd, info, output_section, link_order)
(file_ptr) link_order->offset, size);
free (buf);
if (! ok)
- return false;
+ return FALSE;
}
rel.addend = 0;
@@ -4749,7 +4766,7 @@ ecoff_reloc_link_order (output_bfd, info, output_section, link_order)
h = ((struct ecoff_link_hash_entry *)
bfd_wrapped_link_hash_lookup (output_bfd, info,
link_order->u.reloc.p->u.name,
- false, false, true));
+ FALSE, FALSE, TRUE));
if (h != (struct ecoff_link_hash_entry *) NULL
&& h->indx != -1)
in.r_symndx = h->indx;
@@ -4758,7 +4775,7 @@ ecoff_reloc_link_order (output_bfd, info, output_section, link_order)
if (! ((*info->callbacks->unattached_reloc)
(info, link_order->u.reloc.p->u.name, (bfd *) NULL,
(asection *) NULL, (bfd_vma) 0)))
- return false;
+ return FALSE;
in.r_symndx = 0;
}
in.r_extern = 1;
@@ -4810,7 +4827,7 @@ ecoff_reloc_link_order (output_bfd, info, output_section, link_order)
external_reloc_size = ecoff_backend (output_bfd)->external_reloc_size;
rbuf = (bfd_byte *) bfd_malloc (external_reloc_size);
if (rbuf == (bfd_byte *) NULL)
- return false;
+ return FALSE;
(*ecoff_backend (output_bfd)->swap_reloc_out) (output_bfd, &in, (PTR) rbuf);
diff --git a/contrib/binutils/bfd/ecofflink.c b/contrib/binutils/bfd/ecofflink.c
index 5b854af..9e23848 100644
--- a/contrib/binutils/bfd/ecofflink.c
+++ b/contrib/binutils/bfd/ecofflink.c
@@ -1,23 +1,23 @@
/* Routines to link ECOFF debugging information.
- Copyright 1993, 1994, 1995, 1996, 1997, 2000, 2001, 2002
+ Copyright 1993, 1994, 1995, 1996, 1997, 2000, 2001, 2002, 2003
Free Software Foundation, Inc.
Written by Ian Lance Taylor, Cygnus Support, <ian@cygnus.com>.
-This file is part of BFD, the Binary File Descriptor library.
+ This 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "bfd.h"
#include "sysdep.h"
@@ -32,24 +32,25 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "libcoff.h"
#include "libecoff.h"
-static boolean ecoff_add_bytes PARAMS ((char **buf, char **bufend,
- size_t need));
+static bfd_boolean ecoff_add_bytes
+ PARAMS ((char **buf, char **bufend, size_t need));
static struct bfd_hash_entry *string_hash_newfunc
PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *,
const char *));
-static void ecoff_align_debug PARAMS ((bfd *abfd,
- struct ecoff_debug_info *debug,
- const struct ecoff_debug_swap *swap));
-static boolean ecoff_write_symhdr PARAMS ((bfd *, struct ecoff_debug_info *,
- const struct ecoff_debug_swap *,
- file_ptr where));
-static int cmp_fdrtab_entry PARAMS ((const PTR, const PTR));
-static boolean mk_fdrtab PARAMS ((bfd *,
- struct ecoff_debug_info * const,
- const struct ecoff_debug_swap * const,
- struct ecoff_find_line *));
-static long fdrtab_lookup PARAMS ((struct ecoff_find_line *, bfd_vma));
-static boolean lookup_line
+static void ecoff_align_debug
+ PARAMS ((bfd *abfd, struct ecoff_debug_info *debug,
+ const struct ecoff_debug_swap *swap));
+static bfd_boolean ecoff_write_symhdr
+ PARAMS ((bfd *, struct ecoff_debug_info *, const struct ecoff_debug_swap *,
+ file_ptr where));
+static int cmp_fdrtab_entry
+ PARAMS ((const PTR, const PTR));
+static bfd_boolean mk_fdrtab
+ PARAMS ((bfd *, struct ecoff_debug_info * const,
+ const struct ecoff_debug_swap * const, struct ecoff_find_line *));
+static long fdrtab_lookup
+ PARAMS ((struct ecoff_find_line *, bfd_vma));
+static bfd_boolean lookup_line
PARAMS ((bfd *, struct ecoff_debug_info * const,
const struct ecoff_debug_swap * const, struct ecoff_find_line *));
@@ -253,7 +254,7 @@ _bfd_ecoff_swap_rndx_out (bigend, intern_copy, ext)
/* Add bytes to a buffer. Return success. */
-static boolean
+static bfd_boolean
ecoff_add_bytes (buf, bufend, need)
char **buf;
char **bufend;
@@ -274,10 +275,10 @@ ecoff_add_bytes (buf, bufend, need)
}
newbuf = (char *) bfd_realloc (*buf, (bfd_size_type) have + want);
if (newbuf == NULL)
- return false;
+ return FALSE;
*buf = newbuf;
*bufend = *buf + have + want;
- return true;
+ return TRUE;
}
/* We keep a hash table which maps strings to numbers. We use it to
@@ -347,7 +348,7 @@ struct shuffle
/* The length of the information. */
unsigned long size;
/* Whether this information comes from a file or not. */
- boolean filep;
+ bfd_boolean filep;
union
{
struct
@@ -400,12 +401,11 @@ struct accumulate
/* Add a file entry to a shuffle list. */
-static boolean add_file_shuffle PARAMS ((struct accumulate *,
- struct shuffle **,
- struct shuffle **, bfd *, file_ptr,
- unsigned long));
+static bfd_boolean add_file_shuffle
+ PARAMS ((struct accumulate *, struct shuffle **, struct shuffle **,
+ bfd *, file_ptr, unsigned long));
-static boolean
+static bfd_boolean
add_file_shuffle (ainfo, head, tail, input_bfd, offset, size)
struct accumulate *ainfo;
struct shuffle **head;
@@ -425,7 +425,7 @@ add_file_shuffle (ainfo, head, tail, input_bfd, offset, size)
(*tail)->size += size;
if ((*tail)->size > ainfo->largest_file_shuffle)
ainfo->largest_file_shuffle = (*tail)->size;
- return true;
+ return TRUE;
}
n = (struct shuffle *) objalloc_alloc (ainfo->memory,
@@ -433,11 +433,11 @@ add_file_shuffle (ainfo, head, tail, input_bfd, offset, size)
if (!n)
{
bfd_set_error (bfd_error_no_memory);
- return false;
+ return FALSE;
}
n->next = NULL;
n->size = size;
- n->filep = true;
+ n->filep = TRUE;
n->u.file.input_bfd = input_bfd;
n->u.file.offset = offset;
if (*head == (struct shuffle *) NULL)
@@ -447,17 +447,16 @@ add_file_shuffle (ainfo, head, tail, input_bfd, offset, size)
*tail = n;
if (size > ainfo->largest_file_shuffle)
ainfo->largest_file_shuffle = size;
- return true;
+ return TRUE;
}
/* Add a memory entry to a shuffle list. */
-static boolean add_memory_shuffle PARAMS ((struct accumulate *,
- struct shuffle **head,
- struct shuffle **tail,
- bfd_byte *data, unsigned long size));
+static bfd_boolean add_memory_shuffle
+ PARAMS ((struct accumulate *, struct shuffle **head, struct shuffle **tail,
+ bfd_byte *data, unsigned long size));
-static boolean
+static bfd_boolean
add_memory_shuffle (ainfo, head, tail, data, size)
struct accumulate *ainfo;
struct shuffle **head;
@@ -472,18 +471,18 @@ add_memory_shuffle (ainfo, head, tail, data, size)
if (!n)
{
bfd_set_error (bfd_error_no_memory);
- return false;
+ return FALSE;
}
n->next = NULL;
n->size = size;
- n->filep = false;
+ n->filep = FALSE;
n->u.memory = (PTR) data;
if (*head == (struct shuffle *) NULL)
*head = n;
if (*tail != (struct shuffle *) NULL)
(*tail)->next = n;
*tail = n;
- return true;
+ return TRUE;
}
/* Initialize the FDR hash table. This returns a handle which is then
@@ -527,7 +526,7 @@ bfd_ecoff_debug_init (output_bfd, output_debug, output_swap, info)
ainfo->largest_file_shuffle = 0;
- if (! info->relocateable)
+ if (! info->relocatable)
{
if (! bfd_hash_table_init (&ainfo->str_hash.table, string_hash_newfunc))
return NULL;
@@ -560,7 +559,7 @@ bfd_ecoff_debug_free (handle, output_bfd, output_debug, output_swap, info)
bfd_hash_table_free (&ainfo->fdr_hash.table);
- if (! info->relocateable)
+ if (! info->relocatable)
bfd_hash_table_free (&ainfo->str_hash.table);
objalloc_free (ainfo->memory);
@@ -576,7 +575,7 @@ bfd_ecoff_debug_free (handle, output_bfd, output_debug, output_swap, info)
linker information structure. HANDLE is returned by
bfd_ecoff_debug_init. */
-boolean
+bfd_boolean
bfd_ecoff_debug_accumulate (handle, output_bfd, output_debug, output_swap,
input_bfd, input_debug, input_swap,
info)
@@ -672,10 +671,10 @@ bfd_ecoff_debug_accumulate (handle, output_bfd, output_debug, output_swap,
if (!input_debug->ifdmap || !rfd_out)
{
bfd_set_error (bfd_error_no_memory);
- return false;
+ return FALSE;
}
if (!add_memory_shuffle (ainfo, &ainfo->rfd, &ainfo->rfd_end, rfd_out, sz))
- return false;
+ return FALSE;
copied = 0;
@@ -716,13 +715,13 @@ bfd_ecoff_debug_accumulate (handle, output_bfd, output_debug, output_swap,
lookup = (char *) bfd_malloc ((bfd_size_type) strlen (name) + 20);
if (lookup == NULL)
- return false;
+ return FALSE;
sprintf (lookup, "%s %lx %lx", name, fdr.csym, fdr.caux);
- fh = string_hash_lookup (&ainfo->fdr_hash, lookup, true, true);
+ fh = string_hash_lookup (&ainfo->fdr_hash, lookup, TRUE, TRUE);
free (lookup);
if (fh == (struct string_hash_entry *) NULL)
- return false;
+ return FALSE;
if (fh->val != -1)
{
@@ -773,10 +772,10 @@ bfd_ecoff_debug_accumulate (handle, output_bfd, output_debug, output_swap,
if (!fdr_out)
{
bfd_set_error (bfd_error_no_memory);
- return false;
+ return FALSE;
}
if (!add_memory_shuffle (ainfo, &ainfo->fdr, &ainfo->fdr_end, fdr_out, sz))
- return false;
+ return FALSE;
for (fdr_ptr = fdr_start, i = 0;
fdr_ptr < fdr_end;
fdr_ptr += fdr_add, i++)
@@ -786,7 +785,7 @@ bfd_ecoff_debug_accumulate (handle, output_bfd, output_debug, output_swap,
bfd_byte *sym_out;
bfd_byte *lraw_src;
bfd_byte *lraw_end;
- boolean fgotfilename;
+ bfd_boolean fgotfilename;
if (input_debug->ifdmap[i] < output_symhdr->ifdMax)
{
@@ -822,17 +821,17 @@ bfd_ecoff_debug_accumulate (handle, output_bfd, output_debug, output_swap,
/* Swap in the local symbols, adjust their values, and swap them
out again. */
- fgotfilename = false;
+ fgotfilename = FALSE;
sz = fdr.csym * external_sym_size;
sym_out = (bfd_byte *) objalloc_alloc (ainfo->memory, sz);
if (!sym_out)
{
bfd_set_error (bfd_error_no_memory);
- return false;
+ return FALSE;
}
if (!add_memory_shuffle (ainfo, &ainfo->sym, &ainfo->sym_end, sym_out,
sz))
- return false;
+ return FALSE;
lraw_src = ((bfd_byte *) input_debug->external_sym
+ fdr.isymBase * input_swap->external_sym_size);
lraw_end = lraw_src + fdr.csym * input_swap->external_sym_size;
@@ -880,17 +879,17 @@ bfd_ecoff_debug_accumulate (handle, output_bfd, output_debug, output_swap,
/* If we are doing a final link, we hash all the strings in
the local symbol table together. This reduces the amount
of space required by debugging information. We don't do
- this when performing a relocateable link because it would
+ this when performing a relocatable link because it would
prevent us from easily merging different FDR's. */
- if (! info->relocateable)
+ if (! info->relocatable)
{
- boolean ffilename;
+ bfd_boolean ffilename;
const char *name;
if (! fgotfilename && internal_sym.iss == fdr.rss)
- ffilename = true;
+ ffilename = TRUE;
else
- ffilename = false;
+ ffilename = FALSE;
/* Hash the name into the string table. */
name = input_debug->ss + fdr.issBase + internal_sym.iss;
@@ -900,9 +899,9 @@ bfd_ecoff_debug_accumulate (handle, output_bfd, output_debug, output_swap,
{
struct string_hash_entry *sh;
- sh = string_hash_lookup (&ainfo->str_hash, name, true, true);
+ sh = string_hash_lookup (&ainfo->str_hash, name, TRUE, TRUE);
if (sh == (struct string_hash_entry *) NULL)
- return false;
+ return FALSE;
if (sh->val == -1)
{
sh->val = output_symhdr->issMax;
@@ -920,7 +919,7 @@ bfd_ecoff_debug_accumulate (handle, output_bfd, output_debug, output_swap,
if (ffilename)
{
fdr.rss = internal_sym.iss;
- fgotfilename = true;
+ fgotfilename = TRUE;
}
}
@@ -942,7 +941,7 @@ bfd_ecoff_debug_accumulate (handle, output_bfd, output_debug, output_swap,
file_ptr pos = input_symhdr->cbLineOffset + fdr.cbLineOffset;
if (!add_file_shuffle (ainfo, &ainfo->line, &ainfo->line_end,
input_bfd, pos, (unsigned long) fdr.cbLine))
- return false;
+ return FALSE;
fdr.ilineBase = output_symhdr->ilineMax;
fdr.cbLineOffset = output_symhdr->cbLine;
output_symhdr->ilineMax += fdr.cline;
@@ -955,11 +954,11 @@ bfd_ecoff_debug_accumulate (handle, output_bfd, output_debug, output_swap,
if (!add_file_shuffle (ainfo, &ainfo->aux, &ainfo->aux_end,
input_bfd, pos,
fdr.caux * sizeof (union aux_ext)))
- return false;
+ return FALSE;
fdr.iauxBase = output_symhdr->iauxMax;
output_symhdr->iauxMax += fdr.caux;
}
- if (! info->relocateable)
+ if (! info->relocatable)
{
/* When are are hashing strings, we lie about the number of
@@ -974,7 +973,7 @@ bfd_ecoff_debug_accumulate (handle, output_bfd, output_debug, output_swap,
file_ptr pos = input_symhdr->cbSsOffset + fdr.issBase;
if (!add_file_shuffle (ainfo, &ainfo->ss, &ainfo->ss_end,
input_bfd, pos, (unsigned long) fdr.cbSs))
- return false;
+ return FALSE;
fdr.issBase = output_symhdr->issMax;
output_symhdr->issMax += fdr.cbSs;
}
@@ -994,7 +993,7 @@ bfd_ecoff_debug_accumulate (handle, output_bfd, output_debug, output_swap,
unsigned long size = fdr.cpd * external_pdr_size;
if (!add_file_shuffle (ainfo, &ainfo->pdr, &ainfo->pdr_end,
input_bfd, pos, size))
- return false;
+ return FALSE;
}
BFD_ASSERT (external_opt_size == input_swap->external_opt_size);
if (fdr.copt > 0)
@@ -1004,7 +1003,7 @@ bfd_ecoff_debug_accumulate (handle, output_bfd, output_debug, output_swap,
unsigned long size = fdr.copt * external_opt_size;
if (!add_file_shuffle (ainfo, &ainfo->opt, &ainfo->opt_end,
input_bfd, pos, size))
- return false;
+ return FALSE;
}
}
else
@@ -1027,11 +1026,11 @@ bfd_ecoff_debug_accumulate (handle, output_bfd, output_debug, output_swap,
if (!out)
{
bfd_set_error (bfd_error_no_memory);
- return false;
+ return FALSE;
}
if (!add_memory_shuffle (ainfo, &ainfo->pdr, &ainfo->pdr_end, out,
sz))
- return false;
+ return FALSE;
for (; in < end; in += insz, out += outsz)
{
PDR pdr;
@@ -1068,11 +1067,11 @@ bfd_ecoff_debug_accumulate (handle, output_bfd, output_debug, output_swap,
if (!out)
{
bfd_set_error (bfd_error_no_memory);
- return false;
+ return FALSE;
}
if (!add_memory_shuffle (ainfo, &ainfo->opt, &ainfo->opt_end, out,
sz))
- return false;
+ return FALSE;
for (; in < end; in += insz, out += outsz)
{
OPTR opt;
@@ -1104,16 +1103,15 @@ bfd_ecoff_debug_accumulate (handle, output_bfd, output_debug, output_swap,
++output_symhdr->ifdMax;
}
- return true;
+ return TRUE;
}
/* Add a string to the debugging information we are accumulating.
Return the offset from the fdr string base. */
-static long ecoff_add_string PARAMS ((struct accumulate *,
- struct bfd_link_info *,
- struct ecoff_debug_info *,
- FDR *fdr, const char *string));
+static long ecoff_add_string
+ PARAMS ((struct accumulate *, struct bfd_link_info *,
+ struct ecoff_debug_info *, FDR *fdr, const char *string));
static long
ecoff_add_string (ainfo, info, debug, fdr, string)
@@ -1129,7 +1127,7 @@ ecoff_add_string (ainfo, info, debug, fdr, string)
symhdr = &debug->symbolic_header;
len = strlen (string);
- if (info->relocateable)
+ if (info->relocatable)
{
if (!add_memory_shuffle (ainfo, &ainfo->ss, &ainfo->ss_end, (PTR) string,
len + 1))
@@ -1142,7 +1140,7 @@ ecoff_add_string (ainfo, info, debug, fdr, string)
{
struct string_hash_entry *sh;
- sh = string_hash_lookup (&ainfo->str_hash, string, true, true);
+ sh = string_hash_lookup (&ainfo->str_hash, string, TRUE, TRUE);
if (sh == (struct string_hash_entry *) NULL)
return -1;
if (sh->val == -1)
@@ -1164,7 +1162,7 @@ ecoff_add_string (ainfo, info, debug, fdr, string)
/* Add debugging information from a non-ECOFF file. */
-boolean
+bfd_boolean
bfd_ecoff_debug_accumulate_other (handle, output_bfd, output_debug,
output_swap, input_bfd, info)
PTR handle;
@@ -1203,19 +1201,19 @@ bfd_ecoff_debug_accumulate_other (handle, output_bfd, output_debug,
fdr.rss = ecoff_add_string (ainfo, info, output_debug, &fdr,
bfd_archive_filename (input_bfd));
if (fdr.rss == -1)
- return false;
+ return FALSE;
fdr.isymBase = output_symhdr->isymMax;
/* Get the local symbols from the input BFD. */
symsize = bfd_get_symtab_upper_bound (input_bfd);
if (symsize < 0)
- return false;
+ return FALSE;
symbols = (asymbol **) bfd_alloc (output_bfd, (bfd_size_type) symsize);
if (symbols == (asymbol **) NULL)
- return false;
+ return FALSE;
symcount = bfd_canonicalize_symtab (input_bfd, symbols);
if (symcount < 0)
- return false;
+ return FALSE;
sym_end = symbols + symcount;
/* Handle the local symbols. Any external symbols are handled
@@ -1233,7 +1231,7 @@ bfd_ecoff_debug_accumulate_other (handle, output_bfd, output_debug,
(*sym_ptr)->name);
if (internal_sym.iss == -1)
- return false;
+ return FALSE;
if (bfd_is_com_section ((*sym_ptr)->section)
|| bfd_is_und_section ((*sym_ptr)->section))
internal_sym.value = (*sym_ptr)->value;
@@ -1250,7 +1248,7 @@ bfd_ecoff_debug_accumulate_other (handle, output_bfd, output_debug,
if (!external_sym)
{
bfd_set_error (bfd_error_no_memory);
- return false;
+ return FALSE;
}
(*swap_sym_out) (output_bfd, &internal_sym, external_sym);
add_memory_shuffle (ainfo, &ainfo->sym, &ainfo->sym_end,
@@ -1271,7 +1269,7 @@ bfd_ecoff_debug_accumulate_other (handle, output_bfd, output_debug,
if (!external_fdr)
{
bfd_set_error (bfd_error_no_memory);
- return false;
+ return FALSE;
}
(*output_swap->swap_fdr_out) (output_bfd, &fdr, external_fdr);
add_memory_shuffle (ainfo, &ainfo->fdr, &ainfo->fdr_end,
@@ -1280,7 +1278,7 @@ bfd_ecoff_debug_accumulate_other (handle, output_bfd, output_debug,
++output_symhdr->ifdMax;
- return true;
+ return TRUE;
}
/* Set up ECOFF debugging information for the external symbols.
@@ -1288,14 +1286,14 @@ bfd_ecoff_debug_accumulate_other (handle, output_bfd, output_debug,
probably be changed to use a shuffle structure. The assembler uses
this interface, so that must be changed to do something else. */
-boolean
-bfd_ecoff_debug_externals (abfd, debug, swap, relocateable, get_extr,
+bfd_boolean
+bfd_ecoff_debug_externals (abfd, debug, swap, relocatable, get_extr,
set_index)
bfd *abfd;
struct ecoff_debug_info *debug;
const struct ecoff_debug_swap *swap;
- boolean relocateable;
- boolean (*get_extr) PARAMS ((asymbol *, EXTR *));
+ bfd_boolean relocatable;
+ bfd_boolean (*get_extr) PARAMS ((asymbol *, EXTR *));
void (*set_index) PARAMS ((asymbol *, bfd_size_type));
{
HDRR * const symhdr = &debug->symbolic_header;
@@ -1304,7 +1302,7 @@ bfd_ecoff_debug_externals (abfd, debug, swap, relocateable, get_extr,
sym_ptr_ptr = bfd_get_outsymbols (abfd);
if (sym_ptr_ptr == NULL)
- return true;
+ return TRUE;
for (c = bfd_get_symcount (abfd); c > 0; c--, sym_ptr_ptr++)
{
@@ -1319,7 +1317,7 @@ bfd_ecoff_debug_externals (abfd, debug, swap, relocateable, get_extr,
/* If we're producing an executable, move common symbols into
bss. */
- if (! relocateable)
+ if (! relocatable)
{
if (esym.asym.sc == scCommon)
esym.asym.sc = scBss;
@@ -1349,15 +1347,15 @@ bfd_ecoff_debug_externals (abfd, debug, swap, relocateable, get_extr,
if (! bfd_ecoff_debug_one_external (abfd, debug, swap,
sym_ptr->name, &esym))
- return false;
+ return FALSE;
}
- return true;
+ return TRUE;
}
/* Add a single external symbol to the debugging information. */
-boolean
+bfd_boolean
bfd_ecoff_debug_one_external (abfd, debug, swap, name, esym)
bfd *abfd;
struct ecoff_debug_info *debug;
@@ -1379,7 +1377,7 @@ bfd_ecoff_debug_one_external (abfd, debug, swap, name, esym)
if (! ecoff_add_bytes ((char **) &debug->ssext,
(char **) &debug->ssext_end,
symhdr->issExtMax + namelen + 1))
- return false;
+ return FALSE;
}
if ((size_t) ((char *) debug->external_ext_end
- (char *) debug->external_ext)
@@ -1388,7 +1386,7 @@ bfd_ecoff_debug_one_external (abfd, debug, swap, name, esym)
if (! ecoff_add_bytes ((char **) &debug->external_ext,
(char **) &debug->external_ext_end,
(symhdr->iextMax + 1) * (size_t) external_ext_size))
- return false;
+ return FALSE;
}
esym->asym.iss = symhdr->issExtMax;
@@ -1402,7 +1400,7 @@ bfd_ecoff_debug_one_external (abfd, debug, swap, name, esym)
strcpy (debug->ssext + symhdr->issExtMax, name);
symhdr->issExtMax += namelen + 1;
- return true;
+ return TRUE;
}
/* Align the ECOFF debugging information. */
@@ -1503,7 +1501,7 @@ bfd_ecoff_debug_size (abfd, debug, swap)
going to be placed at. This assumes that the counts are set
correctly. */
-static boolean
+static bfd_boolean
ecoff_write_symhdr (abfd, debug, swap, where)
bfd *abfd;
struct ecoff_debug_info *debug;
@@ -1517,7 +1515,7 @@ ecoff_write_symhdr (abfd, debug, swap, where)
/* Go to the right location in the file. */
if (bfd_seek (abfd, where, SEEK_SET) != 0)
- return false;
+ return FALSE;
where += swap->external_hdr_size;
@@ -1557,11 +1555,11 @@ ecoff_write_symhdr (abfd, debug, swap, where)
if (buff != NULL)
free (buff);
- return true;
+ return TRUE;
error_return:
if (buff != NULL)
free (buff);
- return false;
+ return FALSE;
}
/* Write out the ECOFF debugging information. This function assumes
@@ -1570,7 +1568,7 @@ ecoff_write_symhdr (abfd, debug, swap, where)
information to. This function fills in the file offsets in the
symbolic header. */
-boolean
+bfd_boolean
bfd_ecoff_write_debug (abfd, debug, swap, where)
bfd *abfd;
struct ecoff_debug_info *debug;
@@ -1580,14 +1578,14 @@ bfd_ecoff_write_debug (abfd, debug, swap, where)
HDRR * const symhdr = &debug->symbolic_header;
if (! ecoff_write_symhdr (abfd, debug, swap, where))
- return false;
+ return FALSE;
#define WRITE(ptr, count, size, offset) \
BFD_ASSERT (symhdr->offset == 0 \
|| (bfd_vma) bfd_tell (abfd) == symhdr->offset); \
if (bfd_bwrite ((PTR) debug->ptr, (bfd_size_type) size * symhdr->count, abfd)\
!= size * symhdr->count) \
- return false;
+ return FALSE;
WRITE (line, cbLine, sizeof (unsigned char), cbLineOffset);
WRITE (external_dnr, idnMax, swap->external_dnr_size, cbDnOffset);
@@ -1603,16 +1601,16 @@ bfd_ecoff_write_debug (abfd, debug, swap, where)
WRITE (external_ext, iextMax, swap->external_ext_size, cbExtOffset);
#undef WRITE
- return true;
+ return TRUE;
}
/* Write out a shuffle list. */
-static boolean ecoff_write_shuffle PARAMS ((bfd *,
- const struct ecoff_debug_swap *,
- struct shuffle *, PTR space));
+static bfd_boolean ecoff_write_shuffle
+ PARAMS ((bfd *, const struct ecoff_debug_swap *, struct shuffle *,
+ PTR space));
-static boolean
+static bfd_boolean
ecoff_write_shuffle (abfd, swap, shuffle, space)
bfd *abfd;
const struct ecoff_debug_swap *swap;
@@ -1629,7 +1627,7 @@ ecoff_write_shuffle (abfd, swap, shuffle, space)
{
if (bfd_bwrite (l->u.memory, (bfd_size_type) l->size, abfd)
!= l->size)
- return false;
+ return FALSE;
}
else
{
@@ -1637,7 +1635,7 @@ ecoff_write_shuffle (abfd, swap, shuffle, space)
|| bfd_bread (space, (bfd_size_type) l->size,
l->u.file.input_bfd) != l->size
|| bfd_bwrite (space, (bfd_size_type) l->size, abfd) != l->size)
- return false;
+ return FALSE;
}
total += l->size;
}
@@ -1650,23 +1648,23 @@ ecoff_write_shuffle (abfd, swap, shuffle, space)
i = swap->debug_align - (total & (swap->debug_align - 1));
s = (bfd_byte *) bfd_zmalloc ((bfd_size_type) i);
if (s == NULL && i != 0)
- return false;
+ return FALSE;
if (bfd_bwrite ((PTR) s, (bfd_size_type) i, abfd) != i)
{
free (s);
- return false;
+ return FALSE;
}
free (s);
}
- return true;
+ return TRUE;
}
/* Write out debugging information using accumulated linker
information. */
-boolean
+bfd_boolean
bfd_ecoff_write_accumulated_debug (handle, abfd, debug, swap, info, where)
PTR handle;
bfd *abfd;
@@ -1696,7 +1694,7 @@ bfd_ecoff_write_accumulated_debug (handle, abfd, debug, swap, info, where)
/* The string table is written out from the hash table if this is a
final link. */
- if (info->relocateable)
+ if (info->relocatable)
{
BFD_ASSERT (ainfo->ss_hash == (struct string_hash_entry *) NULL);
if (! ecoff_write_shuffle (abfd, swap, ainfo->ss, space))
@@ -1784,12 +1782,12 @@ bfd_ecoff_write_accumulated_debug (handle, abfd, debug, swap, info, where)
if (space != NULL)
free (space);
- return true;
+ return TRUE;
error_return:
if (space != NULL)
free (space);
- return false;
+ return FALSE;
}
/* Handle the find_nearest_line function for both ECOFF and MIPS ELF
@@ -1820,7 +1818,7 @@ cmp_fdrtab_entry (leftp, rightp)
table will be sorted by address so we can look it up via binary
search. */
-static boolean
+static bfd_boolean
mk_fdrtab (abfd, debug_info, debug_swap, line_info)
bfd *abfd;
struct ecoff_debug_info * const debug_info;
@@ -1831,27 +1829,26 @@ mk_fdrtab (abfd, debug_info, debug_swap, line_info)
FDR *fdr_ptr;
FDR *fdr_start;
FDR *fdr_end;
- boolean stabs;
+ bfd_boolean stabs;
long len;
bfd_size_type amt;
fdr_start = debug_info->fdr;
fdr_end = fdr_start + debug_info->symbolic_header.ifdMax;
- /* First, let's see how long the table needs to be: */
+ /* First, let's see how long the table needs to be. */
for (len = 0, fdr_ptr = fdr_start; fdr_ptr < fdr_end; fdr_ptr++)
{
- if (fdr_ptr->cpd == 0) /* skip FDRs that have no PDRs */
+ if (fdr_ptr->cpd == 0) /* Skip FDRs that have no PDRs. */
continue;
++len;
}
- /* Now, create and fill in the table: */
-
+ /* Now, create and fill in the table. */
amt = (bfd_size_type) len * sizeof (struct ecoff_fdrtab_entry);
line_info->fdrtab = (struct ecoff_fdrtab_entry*) bfd_zalloc (abfd, amt);
if (line_info->fdrtab == NULL)
- return false;
+ return FALSE;
line_info->fdrtab_len = len;
tab = line_info->fdrtab;
@@ -1863,39 +1860,53 @@ mk_fdrtab (abfd, debug_info, debug_swap, line_info)
/* Check whether this file has stabs debugging information. In
a file with stabs debugging information, the second local
symbol is named @stabs. */
- stabs = false;
+ stabs = FALSE;
if (fdr_ptr->csym >= 2)
{
char *sym_ptr;
SYMR sym;
sym_ptr = ((char *) debug_info->external_sym
- + (fdr_ptr->isymBase + 1)*debug_swap->external_sym_size);
+ + (fdr_ptr->isymBase + 1) * debug_swap->external_sym_size);
(*debug_swap->swap_sym_in) (abfd, sym_ptr, &sym);
if (strcmp (debug_info->ss + fdr_ptr->issBase + sym.iss,
STABS_SYMBOL) == 0)
- stabs = true;
+ stabs = TRUE;
}
if (!stabs)
{
- 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);
+ /* eraxxon: There are at least two problems with this computation:
+ 1) PDRs do *not* contain offsets but full vma's; and typically the
+ address of the first PDR is the address of the FDR, which will
+ make (most) of the results of the original computation 0!
+ 2) Once in a wacky while, the Compaq compiler generated PDR
+ addresses do not equal the FDR vma, but they (the PDR address)
+ are still vma's and not offsets. Cf. comments in
+ 'lookup_line'. */
+#if 0
+ bfd_size_type external_pdr_size;
+ char *pdr_ptr;
+ PDR pdr;
+
+ external_pdr_size = debug_swap->external_pdr_size;
+
+ pdr_ptr = ((char *) debug_info->external_pdr
+ + fdr_ptr->ipdFirst * external_pdr_size);
+ (*debug_swap->swap_pdr_in) (abfd, (PTR) pdr_ptr, &pdr);
+ /* The address of the first PDR is the offset of that
+ procedure relative to the beginning of file FDR. */
+ tab->base_addr = fdr_ptr->adr - pdr.adr;
+#else
/* The address of the first PDR is the offset of that
procedure relative to the beginning of file FDR. */
- tab->base_addr = fdr_ptr->adr - pdr.adr;
+ tab->base_addr = fdr_ptr->adr;
+#endif
}
else
{
/* XXX I don't know about stabs, so this is a guess
- (davidm@cs.arizona.edu): */
+ (davidm@cs.arizona.edu). */
tab->base_addr = fdr_ptr->adr;
}
tab->fdr = fdr_ptr;
@@ -1909,7 +1920,7 @@ mk_fdrtab (abfd, debug_info, debug_swap, line_info)
qsort ((PTR) line_info->fdrtab, (size_t) len,
sizeof (struct ecoff_fdrtab_entry), cmp_fdrtab_entry);
- return true;
+ return TRUE;
}
/* Return index of first FDR that covers to OFFSET. */
@@ -1939,14 +1950,22 @@ fdrtab_lookup (line_info, offset)
else
low = mid + 1;
}
+
+ /* eraxxon: at this point 'offset' is either lower than the lowest entry or
+ higher than the highest entry. In the former case high = low = mid = 0;
+ we want to return -1. In the latter case, low = high and mid = low - 1;
+ we want to return the index of the highest entry. Only in former case
+ will the following 'catch-all' test be true. */
++mid;
- /* last entry is catch-all for all higher addresses: */
+ /* Last entry is catch-all for all higher addresses. */
if (offset < tab[mid].base_addr)
return -1;
find_min:
+ /* eraxxon: There may be multiple FDRs in the table with the
+ same base_addr; make sure that we are at the first one. */
while (mid > 0 && tab[mid - 1].base_addr == tab[mid].base_addr)
--mid;
@@ -1956,7 +1975,7 @@ fdrtab_lookup (line_info, offset)
/* Look up a line given an address, storing the information in
LINE_INFO->cache. */
-static boolean
+static bfd_boolean
lookup_line (abfd, debug_info, debug_swap, line_info)
bfd *abfd;
struct ecoff_debug_info * const debug_info;
@@ -1965,30 +1984,101 @@ lookup_line (abfd, debug_info, debug_swap, line_info)
{
struct ecoff_fdrtab_entry *tab;
bfd_vma offset;
- boolean stabs;
+ bfd_boolean stabs;
FDR *fdr_ptr;
int i;
+ /* eraxxon: note that 'offset' is the full vma, not a section offset. */
offset = line_info->cache.start;
/* Build FDR table (sorted by object file's base-address) if we
don't have it already. */
if (line_info->fdrtab == NULL
&& !mk_fdrtab (abfd, debug_info, debug_swap, line_info))
- return false;
+ return FALSE;
tab = line_info->fdrtab;
- /* find first FDR for address OFFSET */
+ /* Find first FDR for address OFFSET. */
i = fdrtab_lookup (line_info, offset);
if (i < 0)
- return false; /* no FDR, no fun... */
+ return FALSE; /* no FDR, no fun... */
+
+ /* eraxxon: 'fdrtab_lookup' doesn't give what we want, at least for Compaq's
+ C++ compiler 6.2. Consider three FDRs with starting addresses of x, y,
+ and z, respectively, such that x < y < z. Assume further that
+ y < 'offset' < z. It is possible at times that the PDR for 'offset' is
+ associated with FDR x and *not* with FDR y. Erg!!
+
+ From a binary dump of my C++ test case 'moo' using Compaq's coffobjanl
+ (output format has been edited for our purposes):
+
+ FDR [2]: (main.C): First instruction: 0x12000207c <x>
+ PDR [5] for File [2]: LoopTest__Xv <0x1200020a0> (a)
+ PDR [7] for File [2]: foo__Xv <0x120002168>
+ FDR [1]: (-1): First instruction: 0x1200020e8 <y>
+ PDR [3] for File [1]: <0x120001ad0> (b)
+ FDR [6]: (-1): First instruction: 0x1200026f0 <z>
+
+ (a) In the case of PDR5, the vma is such that the first few instructions
+ of the procedure can be found. But since the size of this procedure is
+ 160b, the vma will soon cross into the 'address space' of FDR1 and no
+ debugging info will be found. How repugnant!
+
+ (b) It is also possible for a PDR to have a *lower* vma than its associated
+ FDR; see FDR1 and PDR3. Gross!
+
+ Since the FDRs that are causing so much havok (in this case) 1) do not
+ describe actual files (fdr.rss == -1), and 2) contain only compiler
+ generated routines, I thought a simple fix would be to exclude them from
+ the FDR table in 'mk_fdrtab'. But, besides not knowing for certain
+ whether this would be correct, it creates an additional problem. If we
+ happen to ask for source file info on a compiler generated (procedure)
+ symbol -- which is still in the symbol table -- the result can be
+ information from a real procedure! This is because compiler generated
+ procedures with vma's higher than the last FDR in the fdr table will be
+ associated with a PDR from this FDR, specifically the PDR with the
+ highest vma. This wasn't a problem before, because each procedure had a
+ PDR. (Yes, this problem could be eliminated if we kept the size of the
+ last PDR around, but things are already getting ugly).
+
+ Probably, a better solution would be to have a sorted PDR table. Each
+ PDR would have a pointer to its FDR so file information could still be
+ obtained. A FDR table could still be constructed if necessary -- since
+ it only contains pointers, not much extra memory would be used -- but
+ the PDR table would be searched to locate debugging info.
+
+ There is still at least one remaining issue. Sometimes a FDR can have a
+ bogus name, but contain PDRs that should belong to another FDR with a
+ real name. E.g:
+
+ FDR [3]: 0000000120001b50 (/home/.../Array.H~alt~deccxx_5E5A62AD)
+ PDR [a] for File [3]: 0000000120001b50
+ PDR [b] for File [3]: 0000000120001cf0
+ PDR [c] for File [3]: 0000000120001dc8
+ PDR [d] for File [3]: 0000000120001e40
+ PDR [e] for File [3]: 0000000120001eb8
+ PDR [f] for File [3]: 0000000120001f4c
+ FDR [4]: 0000000120001b50 (/home/.../Array.H)
+
+ Here, FDR4 has the correct name, but should (seemingly) contain PDRa-f.
+ The symbol table for PDR4 does contain symbols for PDRa-f, but so does
+ the symbol table for FDR3. However the former is different; perhaps this
+ can be detected easily. (I'm not sure at this point.) This problem only
+ seems to be associated with files with templates. I am assuming the idea
+ is that there is a 'fake' FDR (with PDRs) for each differently typed set
+ of templates that must be generated. Currently, FDR4 is completely
+ excluded from the FDR table in 'mk_fdrtab' because it contains no PDRs.
+
+ Since I don't have time to prepare a real fix for this right now, be
+ prepared for 'A Horrible Hack' to force the inspection of all non-stabs
+ FDRs. It's coming... */
fdr_ptr = tab[i].fdr;
/* Check whether this file has stabs debugging information. In a
file with stabs debugging information, the second local symbol is
named @stabs. */
- stabs = false;
+ stabs = FALSE;
if (fdr_ptr->csym >= 2)
{
char *sym_ptr;
@@ -1999,7 +2089,7 @@ lookup_line (abfd, debug_info, debug_swap, line_info)
(*debug_swap->swap_sym_in) (abfd, sym_ptr, &sym);
if (strcmp (debug_info->ss + fdr_ptr->issBase + sym.iss,
STABS_SYMBOL) == 0)
- stabs = true;
+ stabs = TRUE;
}
if (!stabs)
@@ -2008,7 +2098,7 @@ lookup_line (abfd, debug_info, debug_swap, line_info)
char *pdr_ptr;
char *best_pdr = NULL;
FDR *best_fdr;
- bfd_vma best_dist = ~(bfd_vma) 0;
+ bfd_signed_vma best_dist = -1;
PDR pdr;
unsigned char *line_ptr;
unsigned char *line_end;
@@ -2070,14 +2160,29 @@ lookup_line (abfd, debug_info, debug_swap, line_info)
considerably, which is undesirable. */
external_pdr_size = debug_swap->external_pdr_size;
- /* Make offset relative to object file's start-address: */
+#if 0 /* eraxxon: PDR addresses (pdr.adr) are not relative to FDRs!
+ Leave 'offset' alone. */
+ /* Make offset relative to object file's start-address. */
offset -= tab[i].base_addr;
+#endif
+ /* eraxxon: The Horrible Hack: Because of the problems above, set 'i'
+ to 0 so we look through all FDRs.
+
+ Because FDR's without any symbols are assumed to be non-stabs,
+ searching through all FDRs may cause the following code to try to
+ read stabs FDRs as ECOFF ones. However, I don't think this will
+ harm anything. */
+ i = 0;
+
/* Search FDR list starting at tab[i] for the PDR that best matches
OFFSET. Normally, the FDR list is only one entry long. */
best_fdr = NULL;
do
{
- bfd_vma dist, min_dist = 0;
+ /* eraxxon: 'dist' and 'min_dist' can be negative now
+ because we iterate over every FDR rather than just ones
+ with a base address less than or equal to 'offset'. */
+ bfd_signed_vma dist = -1, min_dist = -1;
char *pdr_hold;
char *pdr_end;
@@ -2100,7 +2205,10 @@ lookup_line (abfd, debug_info, debug_swap, line_info)
if (offset >= (pdr.adr - 0x10 * pdr.prof))
{
dist = offset - (pdr.adr - 0x10 * pdr.prof);
- if (!pdr_hold || dist < min_dist)
+
+ /* eraxxon: 'dist' can be negative now. Note that
+ 'min_dist' can be negative if 'pdr_hold' below is NULL. */
+ if (!pdr_hold || (dist >= 0 && dist < min_dist))
{
min_dist = dist;
pdr_hold = pdr_ptr;
@@ -2108,21 +2216,22 @@ lookup_line (abfd, debug_info, debug_swap, line_info)
}
}
- if (!best_pdr || min_dist < best_dist)
+ if (!best_pdr || (min_dist >= 0 && min_dist < best_dist))
{
- best_dist = min_dist;
+ best_dist = (bfd_vma) min_dist;
best_fdr = fdr_ptr;
best_pdr = pdr_hold;
}
- /* continue looping until base_addr of next entry is different: */
+ /* Continue looping until base_addr of next entry is different. */
}
- while (++i < line_info->fdrtab_len
- && tab[i].base_addr == tab[i - 1].base_addr);
+ /* eraxxon: We want to iterate over all FDRs.
+ See previous comment about 'fdrtab_lookup'. */
+ while (++i < line_info->fdrtab_len);
if (!best_fdr || !best_pdr)
- return false; /* shouldn't happen... */
+ return FALSE; /* Shouldn't happen... */
- /* phew, finally we got something that we can hold onto: */
+ /* Phew, finally we got something that we can hold onto. */
fdr_ptr = best_fdr;
pdr_ptr = best_pdr;
(*debug_swap->swap_pdr_in) (abfd, (PTR) pdr_ptr, &pdr);
@@ -2132,7 +2241,7 @@ lookup_line (abfd, debug_info, debug_swap, line_info)
number entries. */
line_end = debug_info->line + fdr_ptr->cbLineOffset + fdr_ptr->cbLine;
- /* Make offset relative to procedure entry: */
+ /* Make offset relative to procedure entry. */
offset -= pdr.adr - 0x10 * pdr.prof;
lineno = pdr.lnLow;
line_ptr = debug_info->line + fdr_ptr->cbLineOffset + pdr.cbLineOffset;
@@ -2213,8 +2322,8 @@ lookup_line (abfd, debug_info, debug_swap, line_info)
const char *line_file_name;
bfd_vma low_func_vma;
bfd_vma low_line_vma;
- boolean past_line;
- boolean past_fn;
+ bfd_boolean past_line;
+ bfd_boolean past_fn;
char *sym_ptr, *sym_ptr_end;
size_t len, funclen;
char *buffer = NULL;
@@ -2240,8 +2349,8 @@ lookup_line (abfd, debug_info, debug_swap, line_info)
line_file_name = NULL;
low_func_vma = 0;
low_line_vma = 0;
- past_line = false;
- past_fn = false;
+ past_line = FALSE;
+ past_fn = FALSE;
external_sym_size = debug_swap->external_sym_size;
@@ -2291,7 +2400,7 @@ lookup_line (abfd, debug_info, debug_swap, line_info)
case N_FUN:
if (sym.value > offset)
- past_fn = true;
+ past_fn = TRUE;
else if (sym.value >= low_func_vma)
{
low_func_vma = sym.value;
@@ -2304,7 +2413,7 @@ lookup_line (abfd, debug_info, debug_swap, line_info)
else if (sym.st == stLabel && sym.index != indexNil)
{
if (sym.value > offset)
- past_line = true;
+ past_line = TRUE;
else if (sym.value >= low_line_vma)
{
low_line_vma = sym.value;
@@ -2336,7 +2445,7 @@ lookup_line (abfd, debug_info, debug_swap, line_info)
free (line_info->find_buffer);
buffer = (char *) bfd_malloc ((bfd_size_type) len);
if (buffer == NULL)
- return false;
+ return FALSE;
line_info->find_buffer = buffer;
}
@@ -2364,12 +2473,12 @@ lookup_line (abfd, debug_info, debug_swap, line_info)
}
}
- return true;
+ return TRUE;
}
/* Do the work of find_nearest_line. */
-boolean
+bfd_boolean
_bfd_ecoff_locate_line (abfd, section, offset, debug_info, debug_swap,
line_info, filename_ptr, functionname_ptr, retline_ptr)
bfd *abfd;
@@ -2395,7 +2504,7 @@ _bfd_ecoff_locate_line (abfd, section, offset, debug_info, debug_swap,
if (! lookup_line (abfd, debug_info, debug_swap, line_info))
{
line_info->cache.sect = NULL;
- return false;
+ return FALSE;
}
}
@@ -2403,7 +2512,7 @@ _bfd_ecoff_locate_line (abfd, section, offset, debug_info, debug_swap,
*functionname_ptr = line_info->cache.functionname;
*retline_ptr = line_info->cache.line_num;
- return true;
+ return TRUE;
}
/* These routines copy symbolic information into a memory buffer.
@@ -2416,9 +2525,10 @@ _bfd_ecoff_locate_line (abfd, section, offset, debug_info, debug_swap,
/* Collect a shuffle into a memory buffer. */
-static boolean ecoff_collect_shuffle PARAMS ((struct shuffle *, bfd_byte *));
+static bfd_boolean ecoff_collect_shuffle
+ PARAMS ((struct shuffle *, bfd_byte *));
-static boolean
+static bfd_boolean
ecoff_collect_shuffle (l, buff)
struct shuffle *l;
bfd_byte *buff;
@@ -2435,18 +2545,18 @@ ecoff_collect_shuffle (l, buff)
if (bfd_seek (l->u.file.input_bfd, l->u.file.offset, SEEK_SET) != 0
|| (bfd_bread (buff, (bfd_size_type) l->size, l->u.file.input_bfd)
!= l->size))
- return false;
+ return FALSE;
}
total += l->size;
buff += l->size;
}
- return true;
+ return TRUE;
}
/* Copy PDR information into a memory buffer. */
-boolean
+bfd_boolean
_bfd_ecoff_get_accumulated_pdr (handle, buff)
PTR handle;
bfd_byte *buff;
@@ -2458,7 +2568,7 @@ _bfd_ecoff_get_accumulated_pdr (handle, buff)
/* Copy symbol information into a memory buffer. */
-boolean
+bfd_boolean
_bfd_ecoff_get_accumulated_sym (handle, buff)
PTR handle;
bfd_byte *buff;
@@ -2470,7 +2580,7 @@ _bfd_ecoff_get_accumulated_sym (handle, buff)
/* Copy the string table into a memory buffer. */
-boolean
+bfd_boolean
_bfd_ecoff_get_accumulated_ss (handle, buff)
PTR handle;
bfd_byte *buff;
@@ -2497,5 +2607,5 @@ _bfd_ecoff_get_accumulated_ss (handle, buff)
buff += len + 1;
}
- return true;
+ return TRUE;
}
diff --git a/contrib/binutils/bfd/ecoffswap.h b/contrib/binutils/bfd/ecoffswap.h
index 24627d0..7ea0394 100644
--- a/contrib/binutils/bfd/ecoffswap.h
+++ b/contrib/binutils/bfd/ecoffswap.h
@@ -1,23 +1,23 @@
/* Generic ECOFF swapping routines, for BFD.
- Copyright 1992, 1993, 1994, 1995, 1996, 2000, 2001
+ Copyright 1992, 1993, 1994, 1995, 1996, 2000, 2001, 2002
Free Software Foundation, Inc.
Written by Cygnus Support.
-This file is part of BFD, the Binary File Descriptor library.
+ This 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
/* NOTE: This is a header file, but it contains executable routines.
This is done this way because these routines are substantially
@@ -220,7 +220,7 @@ ecoff_swap_fdr_in (abfd, ext_copy, intern)
intern->rfdBase = H_GET_32 (abfd, ext->f_rfdBase);
intern->crfd = H_GET_32 (abfd, ext->f_crfd);
- /* now the fun stuff... */
+ /* Now the fun stuff... */
if (bfd_header_big_endian (abfd))
{
intern->lang = ((ext->f_bits1[0] & FDR_BITS1_LANG_BIG)
@@ -263,7 +263,8 @@ ecoff_swap_fdr_out (abfd, intern_copy, ext_ptr)
struct fdr_ext *ext = (struct fdr_ext *) ext_ptr;
FDR intern[1];
- *intern = *intern_copy; /* Make it reasonable to do in-place. */
+ /* Make it reasonable to do in-place. */
+ *intern = *intern_copy;
ECOFF_PUT_OFF (abfd, intern->adr, ext->f_adr);
H_PUT_32 (abfd, intern->rss, ext->f_rss);
@@ -288,7 +289,7 @@ ecoff_swap_fdr_out (abfd, intern_copy, ext_ptr)
H_PUT_32 (abfd, intern->rfdBase, ext->f_rfdBase);
H_PUT_32 (abfd, intern->crfd, ext->f_crfd);
- /* now the fun stuff... */
+ /* Now the fun stuff... */
if (bfd_header_big_endian (abfd))
{
ext->f_bits1[0] = (((intern->lang << FDR_BITS1_LANG_SH_BIG)
@@ -355,6 +356,11 @@ ecoff_swap_pdr_in (abfd, ext_copy, intern)
intern->cbLineOffset = ECOFF_GET_OFF (abfd, ext->p_cbLineOffset);
#if defined (ECOFF_64) || defined (ECOFF_SIGNED_64)
+ if (intern->isym == (signed long) 0xffffffff)
+ intern->isym = -1;
+ if (intern->iline == (signed long) 0xffffffff)
+ intern->iline = -1;
+
intern->gp_prologue = H_GET_8 (abfd, ext->p_gp_prologue);
if (bfd_header_big_endian (abfd))
{
@@ -396,7 +402,8 @@ ecoff_swap_pdr_out (abfd, intern_copy, ext_ptr)
struct pdr_ext *ext = (struct pdr_ext *) ext_ptr;
PDR intern[1];
- *intern = *intern_copy; /* Make it reasonable to do in-place. */
+ /* 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);
@@ -494,7 +501,8 @@ ecoff_swap_pdr_out (abfd, intern_copy, ext_ptr)
struct pdr_ext *ext = (struct pdr_ext *) ext_ptr;
PDR intern[1];
- *intern = *intern_copy; /* Make it reasonable to do in-place. */
+ /* 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);
@@ -533,33 +541,41 @@ ecoff_swap_sym_in (abfd, ext_copy, intern)
intern->iss = H_GET_32 (abfd, ext->s_iss);
intern->value = ECOFF_GET_OFF (abfd, ext->s_value);
- /* now the fun stuff... */
- if (bfd_header_big_endian (abfd)) {
- intern->st = (ext->s_bits1[0] & SYM_BITS1_ST_BIG)
- >> SYM_BITS1_ST_SH_BIG;
- intern->sc = ((ext->s_bits1[0] & SYM_BITS1_SC_BIG)
- << SYM_BITS1_SC_SH_LEFT_BIG)
- | ((ext->s_bits2[0] & SYM_BITS2_SC_BIG)
- >> SYM_BITS2_SC_SH_BIG);
- intern->reserved = 0 != (ext->s_bits2[0] & SYM_BITS2_RESERVED_BIG);
- intern->index = ((ext->s_bits2[0] & SYM_BITS2_INDEX_BIG)
- << SYM_BITS2_INDEX_SH_LEFT_BIG)
- | (ext->s_bits3[0] << SYM_BITS3_INDEX_SH_LEFT_BIG)
- | (ext->s_bits4[0] << SYM_BITS4_INDEX_SH_LEFT_BIG);
- } else {
- intern->st = (ext->s_bits1[0] & SYM_BITS1_ST_LITTLE)
- >> SYM_BITS1_ST_SH_LITTLE;
- intern->sc = ((ext->s_bits1[0] & SYM_BITS1_SC_LITTLE)
- >> SYM_BITS1_SC_SH_LITTLE)
- | ((ext->s_bits2[0] & SYM_BITS2_SC_LITTLE)
- << SYM_BITS2_SC_SH_LEFT_LITTLE);
- intern->reserved = 0 != (ext->s_bits2[0] & SYM_BITS2_RESERVED_LITTLE);
- intern->index = ((ext->s_bits2[0] & SYM_BITS2_INDEX_LITTLE)
- >> SYM_BITS2_INDEX_SH_LITTLE)
- | (ext->s_bits3[0] << SYM_BITS3_INDEX_SH_LEFT_LITTLE)
- | ((unsigned int) ext->s_bits4[0]
- << SYM_BITS4_INDEX_SH_LEFT_LITTLE);
- }
+#if defined (ECOFF_64) || defined (ECOFF_SIGNED_64)
+ if (intern->iss == (signed long) 0xffffffff)
+ intern->iss = -1;
+#endif
+
+ /* Now the fun stuff... */
+ if (bfd_header_big_endian (abfd))
+ {
+ intern->st = (ext->s_bits1[0] & SYM_BITS1_ST_BIG)
+ >> SYM_BITS1_ST_SH_BIG;
+ intern->sc = ((ext->s_bits1[0] & SYM_BITS1_SC_BIG)
+ << SYM_BITS1_SC_SH_LEFT_BIG)
+ | ((ext->s_bits2[0] & SYM_BITS2_SC_BIG)
+ >> SYM_BITS2_SC_SH_BIG);
+ intern->reserved = 0 != (ext->s_bits2[0] & SYM_BITS2_RESERVED_BIG);
+ intern->index = ((ext->s_bits2[0] & SYM_BITS2_INDEX_BIG)
+ << SYM_BITS2_INDEX_SH_LEFT_BIG)
+ | (ext->s_bits3[0] << SYM_BITS3_INDEX_SH_LEFT_BIG)
+ | (ext->s_bits4[0] << SYM_BITS4_INDEX_SH_LEFT_BIG);
+ }
+ else
+ {
+ intern->st = (ext->s_bits1[0] & SYM_BITS1_ST_LITTLE)
+ >> SYM_BITS1_ST_SH_LITTLE;
+ intern->sc = ((ext->s_bits1[0] & SYM_BITS1_SC_LITTLE)
+ >> SYM_BITS1_SC_SH_LITTLE)
+ | ((ext->s_bits2[0] & SYM_BITS2_SC_LITTLE)
+ << SYM_BITS2_SC_SH_LEFT_LITTLE);
+ intern->reserved = 0 != (ext->s_bits2[0] & SYM_BITS2_RESERVED_LITTLE);
+ intern->index = ((ext->s_bits2[0] & SYM_BITS2_INDEX_LITTLE)
+ >> SYM_BITS2_INDEX_SH_LITTLE)
+ | (ext->s_bits3[0] << SYM_BITS3_INDEX_SH_LEFT_LITTLE)
+ | ((unsigned int) ext->s_bits4[0]
+ << SYM_BITS4_INDEX_SH_LEFT_LITTLE);
+ }
#ifdef TEST
if (memcmp ((char *)ext, (char *)intern, sizeof (*intern)) != 0)
@@ -578,37 +594,41 @@ ecoff_swap_sym_out (abfd, intern_copy, ext_ptr)
struct sym_ext *ext = (struct sym_ext *) ext_ptr;
SYMR intern[1];
- *intern = *intern_copy; /* Make it reasonable to do in-place. */
+ /* Make it reasonable to do in-place. */
+ *intern = *intern_copy;
H_PUT_32 (abfd, intern->iss, ext->s_iss);
ECOFF_PUT_OFF (abfd, intern->value, ext->s_value);
- /* now the fun stuff... */
- if (bfd_header_big_endian (abfd)) {
- ext->s_bits1[0] = (((intern->st << SYM_BITS1_ST_SH_BIG)
- & SYM_BITS1_ST_BIG)
- | ((intern->sc >> SYM_BITS1_SC_SH_LEFT_BIG)
- & SYM_BITS1_SC_BIG));
- ext->s_bits2[0] = (((intern->sc << SYM_BITS2_SC_SH_BIG)
- & SYM_BITS2_SC_BIG)
- | (intern->reserved ? SYM_BITS2_RESERVED_BIG : 0)
- | ((intern->index >> SYM_BITS2_INDEX_SH_LEFT_BIG)
- & SYM_BITS2_INDEX_BIG));
- ext->s_bits3[0] = (intern->index >> SYM_BITS3_INDEX_SH_LEFT_BIG) & 0xff;
- ext->s_bits4[0] = (intern->index >> SYM_BITS4_INDEX_SH_LEFT_BIG) & 0xff;
- } else {
- ext->s_bits1[0] = (((intern->st << SYM_BITS1_ST_SH_LITTLE)
- & SYM_BITS1_ST_LITTLE)
- | ((intern->sc << SYM_BITS1_SC_SH_LITTLE)
- & SYM_BITS1_SC_LITTLE));
- ext->s_bits2[0] = (((intern->sc >> SYM_BITS2_SC_SH_LEFT_LITTLE)
- & SYM_BITS2_SC_LITTLE)
- | (intern->reserved ? SYM_BITS2_RESERVED_LITTLE : 0)
- | ((intern->index << SYM_BITS2_INDEX_SH_LITTLE)
- & SYM_BITS2_INDEX_LITTLE));
- ext->s_bits3[0] = (intern->index >> SYM_BITS3_INDEX_SH_LEFT_LITTLE) & 0xff;
- ext->s_bits4[0] = (intern->index >> SYM_BITS4_INDEX_SH_LEFT_LITTLE) & 0xff;
- }
+ /* Now the fun stuff... */
+ if (bfd_header_big_endian (abfd))
+ {
+ ext->s_bits1[0] = (((intern->st << SYM_BITS1_ST_SH_BIG)
+ & SYM_BITS1_ST_BIG)
+ | ((intern->sc >> SYM_BITS1_SC_SH_LEFT_BIG)
+ & SYM_BITS1_SC_BIG));
+ ext->s_bits2[0] = (((intern->sc << SYM_BITS2_SC_SH_BIG)
+ & SYM_BITS2_SC_BIG)
+ | (intern->reserved ? SYM_BITS2_RESERVED_BIG : 0)
+ | ((intern->index >> SYM_BITS2_INDEX_SH_LEFT_BIG)
+ & SYM_BITS2_INDEX_BIG));
+ ext->s_bits3[0] = (intern->index >> SYM_BITS3_INDEX_SH_LEFT_BIG) & 0xff;
+ ext->s_bits4[0] = (intern->index >> SYM_BITS4_INDEX_SH_LEFT_BIG) & 0xff;
+ }
+ else
+ {
+ ext->s_bits1[0] = (((intern->st << SYM_BITS1_ST_SH_LITTLE)
+ & SYM_BITS1_ST_LITTLE)
+ | ((intern->sc << SYM_BITS1_SC_SH_LITTLE)
+ & SYM_BITS1_SC_LITTLE));
+ ext->s_bits2[0] = (((intern->sc >> SYM_BITS2_SC_SH_LEFT_LITTLE)
+ & SYM_BITS2_SC_LITTLE)
+ | (intern->reserved ? SYM_BITS2_RESERVED_LITTLE : 0)
+ | ((intern->index << SYM_BITS2_INDEX_SH_LITTLE)
+ & SYM_BITS2_INDEX_LITTLE));
+ ext->s_bits3[0] = (intern->index >> SYM_BITS3_INDEX_SH_LEFT_LITTLE) & 0xff;
+ ext->s_bits4[0] = (intern->index >> SYM_BITS4_INDEX_SH_LEFT_LITTLE) & 0xff;
+ }
#ifdef TEST
if (memcmp ((char *)ext, (char *)intern, sizeof (*intern)) != 0)
@@ -628,23 +648,26 @@ ecoff_swap_ext_in (abfd, ext_copy, intern)
*ext = *(struct ext_ext *) ext_copy;
- /* now the fun stuff... */
- if (bfd_header_big_endian (abfd)) {
- intern->jmptbl = 0 != (ext->es_bits1[0] & EXT_BITS1_JMPTBL_BIG);
- intern->cobol_main = 0 != (ext->es_bits1[0] & EXT_BITS1_COBOL_MAIN_BIG);
- intern->weakext = 0 != (ext->es_bits1[0] & EXT_BITS1_WEAKEXT_BIG);
- } else {
- intern->jmptbl = 0 != (ext->es_bits1[0] & EXT_BITS1_JMPTBL_LITTLE);
- intern->cobol_main = 0 != (ext->es_bits1[0] & EXT_BITS1_COBOL_MAIN_LITTLE);
- intern->weakext = 0 != (ext->es_bits1[0] & EXT_BITS1_WEAKEXT_LITTLE);
- }
+ /* Now the fun stuff... */
+ if (bfd_header_big_endian (abfd))
+ {
+ intern->jmptbl = 0 != (ext->es_bits1[0] & EXT_BITS1_JMPTBL_BIG);
+ intern->cobol_main = 0 != (ext->es_bits1[0] & EXT_BITS1_COBOL_MAIN_BIG);
+ intern->weakext = 0 != (ext->es_bits1[0] & EXT_BITS1_WEAKEXT_BIG);
+ }
+ else
+ {
+ intern->jmptbl = 0 != (ext->es_bits1[0] & EXT_BITS1_JMPTBL_LITTLE);
+ intern->cobol_main = 0 != (ext->es_bits1[0] & EXT_BITS1_COBOL_MAIN_LITTLE);
+ intern->weakext = 0 != (ext->es_bits1[0] & EXT_BITS1_WEAKEXT_LITTLE);
+ }
intern->reserved = 0;
#if defined (ECOFF_32) || defined (ECOFF_SIGNED_32)
- intern->ifd = H_GET_S16 (abfd, ext->es_ifd);
+ intern->ifd = H_GET_S16 (abfd, ext->es_ifd);
#endif
#if defined (ECOFF_64) || defined (ECOFF_SIGNED_64)
- intern->ifd = H_GET_S32 (abfd, ext->es_ifd);
+ intern->ifd = H_GET_S32 (abfd, ext->es_ifd);
#endif
ecoff_swap_sym_in (abfd, &ext->es_asym, &intern->asym);
@@ -666,28 +689,32 @@ ecoff_swap_ext_out (abfd, intern_copy, ext_ptr)
struct ext_ext *ext = (struct ext_ext *) ext_ptr;
EXTR intern[1];
- *intern = *intern_copy; /* Make it reasonable to do in-place. */
+ /* Make it reasonable to do in-place. */
+ *intern = *intern_copy;
- /* now the fun stuff... */
- if (bfd_header_big_endian (abfd)) {
- ext->es_bits1[0] = ((intern->jmptbl ? EXT_BITS1_JMPTBL_BIG : 0)
- | (intern->cobol_main ? EXT_BITS1_COBOL_MAIN_BIG : 0)
- | (intern->weakext ? EXT_BITS1_WEAKEXT_BIG : 0));
- ext->es_bits2[0] = 0;
+ /* Now the fun stuff... */
+ if (bfd_header_big_endian (abfd))
+ {
+ ext->es_bits1[0] = ((intern->jmptbl ? EXT_BITS1_JMPTBL_BIG : 0)
+ | (intern->cobol_main ? EXT_BITS1_COBOL_MAIN_BIG : 0)
+ | (intern->weakext ? EXT_BITS1_WEAKEXT_BIG : 0));
+ ext->es_bits2[0] = 0;
#if defined (ECOFF_64) || defined (ECOFF_SIGNED_64)
- ext->es_bits2[1] = 0;
- ext->es_bits2[2] = 0;
-#endif
- } else {
- ext->es_bits1[0] = ((intern->jmptbl ? EXT_BITS1_JMPTBL_LITTLE : 0)
- | (intern->cobol_main ? EXT_BITS1_COBOL_MAIN_LITTLE : 0)
- | (intern->weakext ? EXT_BITS1_WEAKEXT_LITTLE : 0));
- ext->es_bits2[0] = 0;
+ ext->es_bits2[1] = 0;
+ ext->es_bits2[2] = 0;
+#endif
+ }
+ else
+ {
+ ext->es_bits1[0] = ((intern->jmptbl ? EXT_BITS1_JMPTBL_LITTLE : 0)
+ | (intern->cobol_main ? EXT_BITS1_COBOL_MAIN_LITTLE : 0)
+ | (intern->weakext ? EXT_BITS1_WEAKEXT_LITTLE : 0));
+ ext->es_bits2[0] = 0;
#if defined (ECOFF_64) || defined (ECOFF_SIGNED_64)
- ext->es_bits2[1] = 0;
- ext->es_bits2[2] = 0;
+ ext->es_bits2[1] = 0;
+ ext->es_bits2[2] = 0;
#endif
- }
+ }
#if defined (ECOFF_32) || defined (ECOFF_SIGNED_32)
H_PUT_S16 (abfd, intern->ifd, ext->es_ifd);
@@ -792,7 +819,8 @@ ecoff_swap_opt_out (abfd, intern_copy, ext_ptr)
struct opt_ext *ext = (struct opt_ext *) ext_ptr;
OPTR intern[1];
- *intern = *intern_copy; /* Make it reasonable to do in-place. */
+ /* Make it reasonable to do in-place. */
+ *intern = *intern_copy;
if (bfd_header_big_endian (abfd))
{
@@ -852,7 +880,8 @@ ecoff_swap_dnr_out (abfd, intern_copy, ext_ptr)
struct dnr_ext *ext = (struct dnr_ext *) ext_ptr;
DNR intern[1];
- *intern = *intern_copy; /* Make it reasonable to do in-place. */
+ /* Make it reasonable to do in-place. */
+ *intern = *intern_copy;
H_PUT_32 (abfd, intern->rfd, ext->d_rfd);
H_PUT_32 (abfd, intern->index, ext->d_index);
diff --git a/contrib/binutils/bfd/efi-app-ia32.c b/contrib/binutils/bfd/efi-app-ia32.c
index 8519f99..92a17ef 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 Free Software Foundation, Inc.
+ Copyright 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
Contributed by David Mosberger <davidm@hpl.hp.com>
This file is part of BFD, the Binary File Descriptor library.
@@ -25,7 +25,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#define TARGET_NAME "efi-app-ia32"
#define COFF_IMAGE_WITH_PE
#define COFF_WITH_PE
-#define PCRELOFFSET true
+#define PCRELOFFSET TRUE
#define TARGET_UNDERSCORE '_'
#define COFF_LONG_SECTION_NAMES
#define PEI_TARGET_SUBSYSTEM IMAGE_SUBSYSTEM_EFI_APPLICATION
diff --git a/contrib/binutils/bfd/efi-app-ia64.c b/contrib/binutils/bfd/efi-app-ia64.c
index 6104568..c7e9bcf 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 Free Software Foundation, Inc.
+ Copyright 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
Contributed by David Mosberger <davidm@hpl.hp.com>
This file is part of BFD, the Binary File Descriptor library.
@@ -26,7 +26,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#define COFF_IMAGE_WITH_PE
#define COFF_WITH_PE
#define COFF_WITH_pep
-#define PCRELOFFSET true
+#define PCRELOFFSET TRUE
#define TARGET_UNDERSCORE '_'
#define COFF_LONG_SECTION_NAMES
#define PEI_TARGET_SUBSYSTEM IMAGE_SUBSYSTEM_EFI_APPLICATION
diff --git a/contrib/binutils/bfd/elf-bfd.h b/contrib/binutils/bfd/elf-bfd.h
index 9417623..110dd69 100644
--- a/contrib/binutils/bfd/elf-bfd.h
+++ b/contrib/binutils/bfd/elf-bfd.h
@@ -1,23 +1,23 @@
/* BFD back-end data structures for ELF files.
Copyright 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
- 2002 Free Software Foundation, Inc.
+ 2002, 2003, 2004 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#ifndef _LIBELF_H_
#define _LIBELF_H_ 1
@@ -33,20 +33,17 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#define NUM_SHDR_ENTRIES(shdr) ((shdr)->sh_size / (shdr)->sh_entsize)
/* If size isn't specified as 64 or 32, NAME macro should fail. */
-/* Do not "beautify" the CONCAT* macro args. Traditional C will not
- remove whitespace added here, and thus will fail to concatenate
- the tokens. */
#ifndef NAME
-#if ARCH_SIZE==64
-#define NAME(x,y) CONCAT4 (x,64,_,y)
+#if ARCH_SIZE == 64
+#define NAME(x, y) x ## 64 ## _ ## y
#endif
-#if ARCH_SIZE==32
-#define NAME(x,y) CONCAT4 (x,32,_,y)
+#if ARCH_SIZE == 32
+#define NAME(x, y) x ## 32 ## _ ## y
#endif
#endif
#ifndef NAME
-#define NAME(x,y) CONCAT4 (x,NOSIZE,_,y)
+#define NAME(x, y) x ## NOSIZE ## _ ## y
#endif
#define ElfNAME(X) NAME(Elf,X)
@@ -67,8 +64,8 @@ typedef struct
union
{
unsigned int hppa_arg_reloc;
- PTR mips_extr;
- PTR any;
+ void *mips_extr;
+ void *any;
}
tc_data;
@@ -80,6 +77,8 @@ typedef struct
} elf_symbol_type;
struct elf_strtab_hash;
+struct got_entry;
+struct plt_entry;
/* ELF linker hash table entries. */
@@ -116,11 +115,6 @@ struct elf_link_hash_entry
one. Otherwise it is NULL. */
struct elf_link_hash_entry *weakdef;
- /* 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. */
- struct elf_linker_section_pointers *linker_section_pointer;
-
/* Version information. */
union
{
@@ -139,30 +133,30 @@ struct elf_link_hash_entry
and track a size while the symbol is still undefined. It is indexed
via offset/sizeof(target_void_pointer). */
size_t vtable_entries_size;
- boolean *vtable_entries_used;
+ 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. We use a union and two names primarily to document
- the intent of any particular piece of code. The field should be
- used as a count until size_dynamic_sections, at which point the
- contents of the .got is fixed. Afterward, if this field is -1,
- then the symbol does not require a global offset table entry. */
- union
+ final offset. Two schemes are supported: The first assumes that
+ a symbol may only have one GOT entry, and uses REFCOUNT until
+ size_dynamic_sections, at which point the contents of the .got is
+ fixed. Afterward, if OFFSET is -1, then the symbol does not
+ require a global offset table entry. The second scheme allows
+ multiple GOT entries per symbol, managed via a linked list
+ pointed to by GLIST. */
+ union gotplt_union
{
bfd_signed_vma refcount;
bfd_vma offset;
+ struct got_entry *glist;
+ struct plt_entry *plist;
} got;
/* Same, but tracks a procedure linkage table entry. */
- union
- {
- bfd_signed_vma refcount;
- bfd_vma offset;
- } plt;
+ union gotplt_union plt;
/* Symbol size. */
bfd_size_type size;
@@ -202,8 +196,28 @@ struct elf_link_hash_entry
/* Symbol is referenced by a non-GOT/non-PLT relocation. This is
not currently set by all the backends. */
#define ELF_LINK_NON_GOT_REF 010000
+ /* Symbol has a definition in a shared object. */
+#define ELF_LINK_DYNAMIC_DEF 020000
+ /* Symbol is weak in all shared objects. */
+#define ELF_LINK_DYNAMIC_WEAK 040000
+ /* Symbol is referenced with a relocation where C/C++ pointer equality
+ matters. */
+#define ELF_LINK_POINTER_EQUALITY_NEEDED 0100000
};
+/* Will references to this symbol always reference the symbol
+ in this object? STV_PROTECTED is excluded from the visibility test
+ here so that function pointer comparisons work properly. Since
+ function symbols not defined in an app are set to their .plt entry,
+ it's necessary for shared libs to also reference the .plt even
+ though the symbol is really local to the shared lib. */
+#define SYMBOL_REFERENCES_LOCAL(INFO, H) \
+ _bfd_elf_symbol_refs_local_p (H, INFO, 0)
+
+/* Will _calls_ to this symbol always call the version in this object? */
+#define SYMBOL_CALLS_LOCAL(INFO, H) \
+ _bfd_elf_symbol_refs_local_p (H, INFO, 1)
+
/* Records local symbols to be emitted in the dynamic symbol table. */
struct elf_link_local_dynamic_entry
@@ -229,23 +243,73 @@ struct elf_link_loaded_list
bfd *abfd;
};
-enum elf_link_info_type
+/* Structures used by the eh_frame optimization code. */
+struct cie_header
{
- ELF_INFO_TYPE_NONE,
- ELF_INFO_TYPE_STABS,
- ELF_INFO_TYPE_MERGE,
- ELF_INFO_TYPE_EH_FRAME,
- ELF_INFO_TYPE_EH_FRAME_HDR,
- ELF_INFO_TYPE_JUST_SYMS,
- ELF_INFO_TYPE_LAST
+ unsigned int length;
+ unsigned int id;
};
-/* Cached start, size and alignment of PT_TLS segment. */
-struct elf_link_tls_segment
+struct cie
{
- bfd_vma start;
- bfd_size_type size;
- unsigned int align;
+ struct cie_header hdr;
+ unsigned char version;
+ unsigned char augmentation[20];
+ unsigned int code_align;
+ int data_align;
+ unsigned int ra_column;
+ unsigned int augmentation_size;
+ struct elf_link_hash_entry *personality;
+ unsigned char per_encoding;
+ unsigned char lsda_encoding;
+ unsigned char fde_encoding;
+ unsigned char initial_insn_length;
+ unsigned char make_relative;
+ unsigned char make_lsda_relative;
+ unsigned char initial_instructions[50];
+};
+
+struct eh_cie_fde
+{
+ unsigned int offset;
+ unsigned int size;
+ asection *sec;
+ unsigned int new_offset;
+ unsigned char fde_encoding;
+ unsigned char lsda_encoding;
+ unsigned char lsda_offset;
+ unsigned char cie : 1;
+ unsigned char removed : 1;
+ unsigned char make_relative : 1;
+ unsigned char make_lsda_relative : 1;
+ unsigned char per_encoding_relative : 1;
+};
+
+struct eh_frame_sec_info
+{
+ unsigned int count;
+ unsigned int alloced;
+ struct eh_cie_fde entry[1];
+};
+
+struct eh_frame_array_ent
+{
+ bfd_vma initial_loc;
+ bfd_vma fde;
+};
+
+struct eh_frame_hdr_info
+{
+ struct cie last_cie;
+ asection *last_cie_sec;
+ asection *hdr_sec;
+ unsigned int last_cie_offset;
+ unsigned int fde_count, array_count;
+ struct eh_frame_array_ent *array;
+ /* TRUE if .eh_frame_hdr should contain the sorted search table.
+ We build it if we successfully read all .eh_frame input sections
+ and recognize them. */
+ bfd_boolean table;
};
/* ELF linker hash table. */
@@ -256,7 +320,7 @@ struct elf_link_hash_table
/* Whether we have created the special dynamic sections required
when linking against or generating a shared object. */
- boolean dynamic_sections_created;
+ bfd_boolean dynamic_sections_created;
/* The BFD used to hold special sections created by the linker.
This will be the first BFD found which requires these sections to
@@ -265,9 +329,13 @@ 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 -1 in size_dynamic_sections
- when the values may be offsets. */
- bfd_signed_vma init_refcount;
+ the values are refcounts. Set to init_offset in
+ size_dynamic_sections when the values may be offsets. */
+ union gotplt_union init_refcount;
+
+ /* The value to use for got.refcount/offset and plt.refcount/offset
+ when the values may be offsets. Normally (bfd_vma) -1. */
+ union gotplt_union init_offset;
/* The number of symbols found in the link which must be put into
the .dynsym section. */
@@ -289,10 +357,13 @@ struct elf_link_hash_table
struct elf_link_hash_entry *hgot;
/* A pointer to information used to link stabs in sections. */
- PTR stab_info;
+ void *stab_info;
/* A pointer to information used to merge SEC_MERGE sections. */
- PTR merge_info;
+ void *merge_info;
+
+ /* Used by eh_frame code when editing .eh_frame. */
+ struct eh_frame_hdr_info eh_info;
/* A linked list of local symbols to be added to .dynsym. */
struct elf_link_local_dynamic_entry *dynlocal;
@@ -301,8 +372,9 @@ struct elf_link_hash_table
objects included in the link. */
struct bfd_link_needed_list *runpath;
- /* Cached start, size and alignment of PT_TLS segment. */
- struct elf_link_tls_segment *tls_segment;
+ /* Cached first output tls section and size of PT_TLS segment. */
+ asection *tls_sec;
+ bfd_size_type tls_size;
/* A linked list of BFD's loaded in the link. */
struct elf_link_loaded_list *loaded;
@@ -320,16 +392,16 @@ struct elf_link_hash_table
#define elf_link_hash_traverse(table, func, info) \
(bfd_link_hash_traverse \
(&(table)->root, \
- (boolean (*) PARAMS ((struct bfd_link_hash_entry *, PTR))) (func), \
+ (bfd_boolean (*) (struct bfd_link_hash_entry *, void *)) (func), \
(info)))
/* Get the ELF linker hash table from a link_info structure. */
#define elf_hash_table(p) ((struct elf_link_hash_table *) ((p)->hash))
-/* Returns true if the hash table is a struct elf_link_hash_table. */
-#define is_elf_hash_table(p) \
- ((p)->hash->type == bfd_link_elf_hash_table)
+/* Returns TRUE if the hash table is a struct elf_link_hash_table. */
+#define is_elf_hash_table(htab) \
+ (((struct bfd_link_hash_table *) (htab))->type == bfd_link_elf_hash_table)
/* Used by bfd_section_from_r_symndx to cache a small number of local
symbol to section mappings. */
@@ -353,52 +425,50 @@ struct elf_size_info {
/* The number of internal relocations to allocate per external
relocation entry. */
unsigned char int_rels_per_ext_rel;
+ /* We use some fixed size arrays. This should be large enough to
+ handle all back-ends. */
+#define MAX_INT_RELS_PER_EXT_REL 3
- unsigned char arch_size, file_align;
+ unsigned char arch_size, log_file_align;
unsigned char elfclass, ev_current;
int (*write_out_phdrs)
- PARAMS ((bfd *, const Elf_Internal_Phdr *, unsigned int));
- boolean (*write_shdrs_and_ehdr)
- PARAMS ((bfd *));
+ (bfd *, const Elf_Internal_Phdr *, unsigned int);
+ bfd_boolean
+ (*write_shdrs_and_ehdr) (bfd *);
void (*write_relocs)
- PARAMS ((bfd *, asection *, PTR));
+ (bfd *, asection *, void *);
void (*swap_symbol_in)
- PARAMS ((bfd *, const PTR, const PTR, Elf_Internal_Sym *));
+ (bfd *, const void *, const void *, Elf_Internal_Sym *);
void (*swap_symbol_out)
- PARAMS ((bfd *, const Elf_Internal_Sym *, PTR, PTR));
- boolean (*slurp_reloc_table)
- PARAMS ((bfd *, asection *, asymbol **, boolean));
+ (bfd *, const Elf_Internal_Sym *, void *, void *);
+ bfd_boolean (*slurp_reloc_table)
+ (bfd *, asection *, asymbol **, bfd_boolean);
long (*slurp_symbol_table)
- PARAMS ((bfd *, asymbol **, boolean));
+ (bfd *, asymbol **, bfd_boolean);
void (*swap_dyn_in)
- PARAMS ((bfd *, const PTR, Elf_Internal_Dyn *));
+ (bfd *, const void *, Elf_Internal_Dyn *);
void (*swap_dyn_out)
- PARAMS ((bfd *, const Elf_Internal_Dyn *, PTR));
+ (bfd *, const Elf_Internal_Dyn *, void *);
- /* This function, if defined, is called to swap in a REL
- relocation. If an external relocation corresponds to more than
- one internal relocation, then all relocations are swapped in at
- once. */
+ /* This function is called to swap in a REL relocation. If an
+ external relocation corresponds to more than one internal
+ relocation, then all relocations are swapped in at once. */
void (*swap_reloc_in)
- PARAMS ((bfd *, const bfd_byte *, Elf_Internal_Rel *));
+ (bfd *, const bfd_byte *, Elf_Internal_Rela *);
- /* This function, if defined, is called to swap out a REL
- relocation. */
+ /* This function is called to swap out a REL relocation. */
void (*swap_reloc_out)
- PARAMS ((bfd *, const Elf_Internal_Rel *, bfd_byte *));
+ (bfd *, const Elf_Internal_Rela *, bfd_byte *);
- /* This function, if defined, is called to swap in a RELA
- relocation. If an external relocation corresponds to more than
- one internal relocation, then all relocations are swapped in at
- once. */
+ /* This function is called to swap in a RELA relocation. If an
+ external relocation corresponds to more than one internal
+ relocation, then all relocations are swapped in at once. */
void (*swap_reloca_in)
- PARAMS ((bfd *, const bfd_byte *, Elf_Internal_Rela *));
+ (bfd *, const bfd_byte *, Elf_Internal_Rela *);
- /* This function, if defined, is called to swap out a RELA
- relocation. */
+ /* This function is called to swap out a RELA relocation. */
void (*swap_reloca_out)
- PARAMS ((bfd *, const Elf_Internal_Rela *, bfd_byte *));
-
+ (bfd *, const Elf_Internal_Rela *, bfd_byte *);
};
#define elf_symbol_from(ABFD,S) \
@@ -422,7 +492,8 @@ struct elf_reloc_cookie
size_t locsymcount;
size_t extsymoff;
struct elf_link_hash_entry **sym_hashes;
- boolean bad_symtab;
+ int r_sym_shift;
+ bfd_boolean bad_symtab;
};
/* The level of IRIX compatibility we're striving for. */
@@ -433,6 +504,22 @@ typedef enum {
ict_irix6
} irix_compat_t;
+/* Mapping of ELF section names and types. */
+struct bfd_elf_special_section
+{
+ const char *prefix;
+ int prefix_length;
+ /* 0 means name must match PREFIX exactly.
+ -1 means name must start with PREFIX followed by an arbitrary string.
+ -2 means name must match PREFIX exactly or consist of PREFIX followed
+ by a dot then anything.
+ > 0 means name must start with the first PREFIX_LENGTH chars of
+ PREFIX and finish with the last SUFFIX_LENGTH chars of PREFIX. */
+ int suffix_length;
+ int type;
+ int attr;
+};
+
struct elf_backend_data
{
/* The architecture for this backend. */
@@ -447,20 +534,20 @@ struct elf_backend_data
/* A function to translate an ELF RELA relocation to a BFD arelent
structure. */
void (*elf_info_to_howto)
- PARAMS ((bfd *, arelent *, Elf_Internal_Rela *));
+ (bfd *, arelent *, Elf_Internal_Rela *);
/* A function to translate an ELF REL relocation to a BFD arelent
structure. */
void (*elf_info_to_howto_rel)
- PARAMS ((bfd *, arelent *, Elf_Internal_Rel *));
+ (bfd *, arelent *, Elf_Internal_Rela *);
/* A function to determine whether a symbol is global when
partitioning the symbol table into local and global symbols.
This should be NULL for most targets, in which case the correct
thing will be done. MIPS ELF, at least on the Irix 5, has
special requirements. */
- boolean (*elf_backend_sym_is_global)
- PARAMS ((bfd *, asymbol *));
+ bfd_boolean (*elf_backend_sym_is_global)
+ (bfd *, asymbol *);
/* The remaining functions are hooks which are called only if they
are not NULL. */
@@ -469,61 +556,66 @@ struct elf_backend_data
particular BFD format is relevant for an object file, and to
permit the backend to set any global information it wishes. When
this is called elf_elfheader is set, but anything else should be
- used with caution. If this returns false, the check_format
+ used with caution. If this returns FALSE, the check_format
routine will return a bfd_error_wrong_format error. */
- boolean (*elf_backend_object_p)
- PARAMS ((bfd *));
+ bfd_boolean (*elf_backend_object_p)
+ (bfd *);
/* A function to do additional symbol processing when reading the
ELF symbol table. This is where any processor-specific special
section indices are handled. */
void (*elf_backend_symbol_processing)
- PARAMS ((bfd *, asymbol *));
+ (bfd *, asymbol *);
/* A function to do additional symbol processing after reading the
entire ELF symbol table. */
- boolean (*elf_backend_symbol_table_processing)
- PARAMS ((bfd *, elf_symbol_type *, unsigned int));
+ bfd_boolean (*elf_backend_symbol_table_processing)
+ (bfd *, elf_symbol_type *, unsigned int);
/* A function to set the type of the info field. Processor-specific
types should be handled here. */
int (*elf_backend_get_symbol_type)
- PARAMS (( Elf_Internal_Sym *, int));
+ (Elf_Internal_Sym *, int);
+
+ /* Return true if local section symbols should have a non-null st_name.
+ NULL implies false. */
+ bfd_boolean (*elf_backend_name_local_section_symbols)
+ (bfd *);
/* A function to do additional processing on the ELF section header
just before writing it out. This is used to set the flags and
type fields for some sections, or to actually write out data for
unusual sections. */
- boolean (*elf_backend_section_processing)
- PARAMS ((bfd *, Elf32_Internal_Shdr *));
+ bfd_boolean (*elf_backend_section_processing)
+ (bfd *, Elf_Internal_Shdr *);
/* A function to handle unusual section types when creating BFD
sections from ELF sections. */
- boolean (*elf_backend_section_from_shdr)
- PARAMS ((bfd *, Elf32_Internal_Shdr *, const char *));
+ bfd_boolean (*elf_backend_section_from_shdr)
+ (bfd *, Elf_Internal_Shdr *, const char *);
/* A function to convert machine dependent section header flags to
BFD internal section header flags. */
- boolean (*elf_backend_section_flags)
- PARAMS ((flagword *, Elf32_Internal_Shdr *));
+ bfd_boolean (*elf_backend_section_flags)
+ (flagword *, Elf_Internal_Shdr *);
/* A function to handle unusual program segment types when creating BFD
sections from ELF program segments. */
- boolean (*elf_backend_section_from_phdr)
- PARAMS ((bfd *, Elf32_Internal_Phdr *, int));
+ bfd_boolean (*elf_backend_section_from_phdr)
+ (bfd *, Elf_Internal_Phdr *, int);
/* A function to set up the ELF section header for a BFD section in
preparation for writing it out. This is where the flags and type
fields are set for unusual sections. */
- boolean (*elf_backend_fake_sections)
- PARAMS ((bfd *, Elf32_Internal_Shdr *, asection *));
+ bfd_boolean (*elf_backend_fake_sections)
+ (bfd *, Elf_Internal_Shdr *, asection *);
/* A function to get the ELF section index for a BFD section. If
- this returns true, the section was found. If it is a normal ELF
+ this returns TRUE, the section was found. If it is a normal ELF
section, *RETVAL should be left unchanged. If it is not a normal
ELF section *RETVAL should be set to the SHN_xxxx index. */
- boolean (*elf_backend_section_from_bfd_section)
- PARAMS ((bfd *, asection *, int *retval));
+ bfd_boolean (*elf_backend_section_from_bfd_section)
+ (bfd *, asection *, int *retval);
/* If this field is not NULL, it is called by the add_symbols phase
of a link just before adding a symbol to the global linker hash
@@ -533,16 +625,15 @@ struct elf_backend_data
handling all processor dependent symbol bindings and section
indices, and must set at least *FLAGS and *SEC for each processor
dependent case; failure to do so will cause a link error. */
- boolean (*elf_add_symbol_hook)
- PARAMS ((bfd *abfd, struct bfd_link_info *info,
- const Elf_Internal_Sym *, const char **name,
- flagword *flags, asection **sec, bfd_vma *value));
+ bfd_boolean (*elf_add_symbol_hook)
+ (bfd *abfd, struct bfd_link_info *info, Elf_Internal_Sym *,
+ const char **name, flagword *flags, asection **sec, bfd_vma *value);
/* If this field is not NULL, it is called by the elf_link_output_sym
phase of a link for each symbol which will appear in the object file. */
- boolean (*elf_backend_link_output_symbol_hook)
- PARAMS ((bfd *, struct bfd_link_info *info, const char *,
- Elf_Internal_Sym *, asection *));
+ bfd_boolean (*elf_backend_link_output_symbol_hook)
+ (struct bfd_link_info *info, const char *, Elf_Internal_Sym *,
+ asection *, struct elf_link_hash_entry *);
/* The CREATE_DYNAMIC_SECTIONS function is called by the ELF backend
linker the first time it encounters a dynamic object in the link.
@@ -552,8 +643,8 @@ struct elf_backend_data
created, and this function may modify the section flags if
desired. This function will normally create the .got and .plt
sections, but different backends have different requirements. */
- boolean (*elf_backend_create_dynamic_sections)
- PARAMS ((bfd *abfd, struct bfd_link_info *info));
+ bfd_boolean (*elf_backend_create_dynamic_sections)
+ (bfd *abfd, struct bfd_link_info *info);
/* The CHECK_RELOCS function is called by the add_symbols phase of
the ELF backend linker. It is called once for each section with
@@ -565,9 +656,9 @@ struct elf_backend_data
relocs are always passed as Rela structures; if the section
actually uses Rel structures, the r_addend field will always be
zero. */
- boolean (*check_relocs)
- PARAMS ((bfd *abfd, struct bfd_link_info *info, asection *o,
- const Elf_Internal_Rela *relocs));
+ bfd_boolean (*check_relocs)
+ (bfd *abfd, struct bfd_link_info *info, asection *o,
+ const Elf_Internal_Rela *relocs);
/* The ADJUST_DYNAMIC_SYMBOL function is called by the ELF backend
linker for every symbol which is defined by a dynamic object and
@@ -581,15 +672,15 @@ struct elf_backend_data
the link can deal with. This will normally involve adding an
entry to the .plt or .got or some such section, and setting the
symbol to point to that. */
- boolean (*elf_backend_adjust_dynamic_symbol)
- PARAMS ((struct bfd_link_info *info, struct elf_link_hash_entry *h));
+ bfd_boolean (*elf_backend_adjust_dynamic_symbol)
+ (struct bfd_link_info *info, struct elf_link_hash_entry *h);
/* The ALWAYS_SIZE_SECTIONS function is called by the backend linker
after all the linker input files have been seen but before the
section sizes have been set. This is called after
ADJUST_DYNAMIC_SYMBOL, but before SIZE_DYNAMIC_SECTIONS. */
- boolean (*elf_backend_always_size_sections)
- PARAMS ((bfd *output_bfd, struct bfd_link_info *info));
+ bfd_boolean (*elf_backend_always_size_sections)
+ (bfd *output_bfd, struct bfd_link_info *info);
/* The SIZE_DYNAMIC_SECTIONS function is called by the ELF backend
linker after all the linker input files have been seen but before
@@ -601,8 +692,8 @@ struct elf_backend_data
.dynstr and .hash sections. This function must handle the
.interp section and any sections created by the
CREATE_DYNAMIC_SECTIONS entry point. */
- boolean (*elf_backend_size_dynamic_sections)
- PARAMS ((bfd *output_bfd, struct bfd_link_info *info));
+ bfd_boolean (*elf_backend_size_dynamic_sections)
+ (bfd *output_bfd, struct bfd_link_info *info);
/* The RELOCATE_SECTION function is called by the ELF backend linker
to handle the relocations for a section.
@@ -613,7 +704,7 @@ struct elf_backend_data
This function is responsible for adjust the section contents as
necessary, and (if using Rela relocs and generating a
- relocateable output file) adjusting the reloc addend as
+ relocatable output file) adjusting the reloc addend as
necessary.
This function does not have to worry about setting the reloc
@@ -627,16 +718,15 @@ struct elf_backend_data
The global hash table entry for the global symbols can be found
via elf_sym_hashes (input_bfd).
- When generating relocateable output, this function must handle
+ 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. */
- boolean (*elf_backend_relocate_section)
- PARAMS ((bfd *output_bfd, struct bfd_link_info *info,
- bfd *input_bfd, asection *input_section, bfd_byte *contents,
- Elf_Internal_Rela *relocs, Elf_Internal_Sym *local_syms,
- asection **local_sections));
+ bfd_boolean (*elf_backend_relocate_section)
+ (bfd *output_bfd, struct bfd_link_info *info, bfd *input_bfd,
+ asection *input_section, bfd_byte *contents, Elf_Internal_Rela *relocs,
+ Elf_Internal_Sym *local_syms, asection **local_sections);
/* The FINISH_DYNAMIC_SYMBOL function is called by the ELF backend
linker just before it writes a symbol out to the .dynsym section.
@@ -645,71 +735,72 @@ struct elf_backend_data
dynamic sections. Note that FINISH_DYNAMIC_SYMBOL is called on
all .dynsym symbols, while ADJUST_DYNAMIC_SYMBOL is only called
on those symbols which are defined by a dynamic object. */
- boolean (*elf_backend_finish_dynamic_symbol)
- PARAMS ((bfd *output_bfd, struct bfd_link_info *info,
- struct elf_link_hash_entry *h, Elf_Internal_Sym *sym));
+ bfd_boolean (*elf_backend_finish_dynamic_symbol)
+ (bfd *output_bfd, struct bfd_link_info *info,
+ struct elf_link_hash_entry *h, Elf_Internal_Sym *sym);
/* The FINISH_DYNAMIC_SECTIONS function is called by the ELF backend
linker just before it writes all the dynamic sections out to the
output file. The FINISH_DYNAMIC_SYMBOL will have been called on
all dynamic symbols. */
- boolean (*elf_backend_finish_dynamic_sections)
- PARAMS ((bfd *output_bfd, struct bfd_link_info *info));
+ bfd_boolean (*elf_backend_finish_dynamic_sections)
+ (bfd *output_bfd, struct bfd_link_info *info);
/* A function to do any beginning processing needed for the ELF file
before building the ELF headers and computing file positions. */
void (*elf_backend_begin_write_processing)
- PARAMS ((bfd *, struct bfd_link_info *));
+ (bfd *, struct bfd_link_info *);
/* A function to do any final processing needed for the ELF file
- before writing it out. The LINKER argument is true if this BFD
+ before writing it out. The LINKER argument is TRUE if this BFD
was created by the ELF backend linker. */
void (*elf_backend_final_write_processing)
- PARAMS ((bfd *, boolean linker));
+ (bfd *, bfd_boolean linker);
/* This function is called by get_program_header_size. It should
return the number of additional program segments which this BFD
will need. It should return -1 on error. */
int (*elf_backend_additional_program_headers)
- PARAMS ((bfd *));
+ (bfd *);
/* This function is called to modify an existing segment map in a
backend specific fashion. */
- boolean (*elf_backend_modify_segment_map)
- PARAMS ((bfd *));
+ bfd_boolean (*elf_backend_modify_segment_map)
+ (bfd *, struct bfd_link_info *);
/* This function is called during section gc to discover the section a
particular relocation refers to. */
asection * (*gc_mark_hook)
- PARAMS ((asection *sec, struct bfd_link_info *, Elf_Internal_Rela *,
- struct elf_link_hash_entry *h, Elf_Internal_Sym *));
+ (asection *sec, struct bfd_link_info *, Elf_Internal_Rela *,
+ struct elf_link_hash_entry *h, Elf_Internal_Sym *);
/* This function, if defined, is called during the sweep phase of gc
in order that a backend might update any data structures it might
be maintaining. */
- boolean (*gc_sweep_hook)
- PARAMS ((bfd *abfd, struct bfd_link_info *info, asection *o,
- const Elf_Internal_Rela *relocs));
+ bfd_boolean (*gc_sweep_hook)
+ (bfd *abfd, struct bfd_link_info *info, asection *o,
+ const Elf_Internal_Rela *relocs);
/* This function, if defined, is called after the ELF headers have
been created. This allows for things like the OS and ABI versions
to be changed. */
void (*elf_backend_post_process_headers)
- PARAMS ((bfd *, struct bfd_link_info *));
+ (bfd *, struct bfd_link_info *);
/* This function, if defined, prints a symbol to file and returns the
name of the symbol to be printed. It should return NULL to fall
back to default symbol printing. */
const char *(*elf_backend_print_symbol_all)
- PARAMS ((bfd *, PTR, asymbol *));
+ (bfd *, void *, asymbol *);
/* This function, if defined, is called after all local symbols and
- global symbols converted to locals are emited into the symtab
+ global symbols converted to locals are emitted into the symtab
section. It allows the backend to emit special global symbols
not handled in the hash table. */
- boolean (*elf_backend_output_arch_syms)
- PARAMS ((bfd *, struct bfd_link_info *, PTR,
- boolean (*) (PTR, const char *, Elf_Internal_Sym *, asection *)));
+ bfd_boolean (*elf_backend_output_arch_syms)
+ (bfd *, struct bfd_link_info *, void *,
+ bfd_boolean (*) (void *, const char *, Elf_Internal_Sym *, asection *,
+ struct elf_link_hash_entry *));
/* Copy any information related to dynamic linking from a pre-existing
symbol to a newly created symbol. Also called to copy flags and
@@ -717,94 +808,125 @@ struct elf_backend_data
newly created and plt/got refcounts and dynamic indices should not
be copied. */
void (*elf_backend_copy_indirect_symbol)
- PARAMS ((struct elf_backend_data *, struct elf_link_hash_entry *,
- struct elf_link_hash_entry *));
+ (const struct elf_backend_data *, struct elf_link_hash_entry *,
+ struct elf_link_hash_entry *);
/* Modify any information related to dynamic linking such that the
symbol is not exported. */
void (*elf_backend_hide_symbol)
- PARAMS ((struct bfd_link_info *, struct elf_link_hash_entry *, boolean));
+ (struct bfd_link_info *, struct elf_link_hash_entry *, bfd_boolean);
+
+ /* Merge the backend specific symbol attribute. */
+ void (*elf_backend_merge_symbol_attribute)
+ (struct elf_link_hash_entry *, const Elf_Internal_Sym *, bfd_boolean,
+ bfd_boolean);
/* Emit relocations. Overrides default routine for emitting relocs,
except during a relocatable link, or if all relocs are being emitted. */
- boolean (*elf_backend_emit_relocs)
- PARAMS ((bfd *, asection *, Elf_Internal_Shdr *, Elf_Internal_Rela *));
+ bfd_boolean (*elf_backend_emit_relocs)
+ (bfd *, asection *, Elf_Internal_Shdr *, Elf_Internal_Rela *);
/* Count relocations. Not called for relocatable links
or if all relocs are being preserved in the output. */
unsigned int (*elf_backend_count_relocs)
- PARAMS ((asection *, Elf_Internal_Rela *));
+ (asection *, Elf_Internal_Rela *);
/* This function, if defined, is called when an NT_PRSTATUS note is found
in a core file. */
- boolean (*elf_backend_grok_prstatus)
- PARAMS ((bfd *, Elf_Internal_Note *));
+ 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. */
- boolean (*elf_backend_grok_psinfo)
- PARAMS ((bfd *, Elf_Internal_Note *));
+ bfd_boolean (*elf_backend_grok_psinfo)
+ (bfd *, Elf_Internal_Note *);
/* Functions to print VMAs. Special code to handle 64 bit ELF files. */
void (* elf_backend_sprintf_vma)
- PARAMS ((bfd *, char *, bfd_vma));
+ (bfd *, char *, bfd_vma);
void (* elf_backend_fprintf_vma)
- PARAMS ((bfd *, PTR, bfd_vma));
+ (bfd *, void *, bfd_vma);
/* This function returns class of a reloc type. */
enum elf_reloc_type_class (*elf_backend_reloc_type_class)
- PARAMS ((const Elf_Internal_Rela *));
+ (const Elf_Internal_Rela *);
/* This function, if defined, removes information about discarded functions
from other sections which mention them. */
- boolean (*elf_backend_discard_info)
- PARAMS ((bfd *, struct elf_reloc_cookie *, struct bfd_link_info *));
+ bfd_boolean (*elf_backend_discard_info)
+ (bfd *, struct elf_reloc_cookie *, struct bfd_link_info *);
/* This function, if defined, signals that the function above has removed
the discarded relocations for this section. */
- boolean (*elf_backend_ignore_discarded_relocs)
- PARAMS ((asection *));
+ bfd_boolean (*elf_backend_ignore_discarded_relocs)
+ (asection *);
+
+ /* These functions tell elf-eh-frame whether to attempt to turn
+ absolute or lsda encodings into pc-relative ones. The default
+ definition enables these transformations. */
+ bfd_boolean (*elf_backend_can_make_relative_eh_frame)
+ (bfd *, struct bfd_link_info *, asection *);
+ bfd_boolean (*elf_backend_can_make_lsda_relative_eh_frame)
+ (bfd *, struct bfd_link_info *, asection *);
+
+ /* This function returns an encoding after computing the encoded
+ value (and storing it in ENCODED) for the given OFFSET into OSEC,
+ to be stored in at LOC_OFFSET into the LOC_SEC input section.
+ The default definition chooses a 32-bit PC-relative encoding. */
+ bfd_byte (*elf_backend_encode_eh_address)
+ (bfd *abfd, struct bfd_link_info *info,
+ asection *osec, bfd_vma offset,
+ asection *loc_sec, bfd_vma loc_offset,
+ bfd_vma *encoded);
/* This function, if defined, may write out the given section.
- Returns true if it did so and false if the caller should. */
- boolean (*elf_backend_write_section)
- PARAMS ((bfd *, asection *, bfd_byte *));
+ Returns TRUE if it did so and FALSE if the caller should. */
+ bfd_boolean (*elf_backend_write_section)
+ (bfd *, asection *, bfd_byte *);
/* The level of IRIX compatibility we're striving for.
MIPS ELF specific function. */
irix_compat_t (*elf_backend_mips_irix_compat)
- PARAMS ((bfd *));
+ (bfd *);
reloc_howto_type *(*elf_backend_mips_rtype_to_howto)
- PARAMS ((unsigned int, boolean));
+ (unsigned int, bfd_boolean);
/* The swapping table to use when dealing with ECOFF information.
Used for the MIPS ELF .mdebug section. */
const struct ecoff_debug_swap *elf_backend_ecoff_debug_swap;
+ /* This function implements `bfd_elf_bfd_from_remote_memory';
+ see elf.c, elfcode.h. */
+ bfd *(*elf_backend_bfd_from_remote_memory)
+ (bfd *templ, bfd_vma ehdr_vma, bfd_vma *loadbasep,
+ int (*target_read_memory) (bfd_vma vma, char *myaddr, int len));
+
/* Alternate EM_xxxx machine codes for this backend. */
int elf_machine_alt1;
int elf_machine_alt2;
const struct elf_size_info *s;
+ /* An array of target specific special section map. */
+ const struct bfd_elf_special_section *special_sections;
+
/* offset of the _GLOBAL_OFFSET_TABLE_ symbol from the start of the
.got section */
bfd_vma got_symbol_offset;
- /* The size in bytes of the headers for the GOT and PLT. This includes
- the so-called reserved entries on some systems. */
+ /* 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;
- bfd_vma plt_header_size;
- /* This is true if the linker should act like collect and gather
- global constructors and destructors by name. This is true for
+ /* This is TRUE if the linker should act like collect and gather
+ global constructors and destructors by name. This is TRUE for
MIPS ELF because the Irix 5 tools can not handle the .init
section. */
unsigned collect : 1;
- /* This is true if the linker should ignore changes to the type of a
- symbol. This is true for MIPS ELF because some Irix 5 objects
+ /* This is TRUE if the linker should ignore changes to the type of a
+ symbol. This is TRUE for MIPS ELF because some Irix 5 objects
record undefined functions as STT_OBJECT although the definitions
are STT_FUNC. */
unsigned type_change_ok : 1;
@@ -831,7 +953,7 @@ struct elf_backend_data
backend relocate_section routine for relocatable linking. */
unsigned rela_normal : 1;
- /* True if addresses "naturally" sign extend. This is used when
+ /* TRUE if addresses "naturally" sign extend. This is used when
swapping in from Elf32 when BFD64. */
unsigned sign_extend_vma : 1;
@@ -872,13 +994,6 @@ struct bfd_elf_section_data
/* The number of relocations currently assigned to REL_HDR2. */
unsigned int rel_count2;
- /* A pointer to a linked list tracking dynamic relocs copied for
- local symbols. */
- PTR local_dynrel;
-
- /* A pointer to the bfd section used for dynamic relocs. */
- asection *sreloc;
-
/* The ELF section number of this section. Only used for an output
file. */
int this_idx;
@@ -891,6 +1006,12 @@ struct bfd_elf_section_data
REL_HDR2 if any. Only used for an output file. */
int rel_idx2;
+ /* Used by the backend linker when generating a shared library to
+ record the dynamic symbol index for a section symbol
+ corresponding to this section. A value of 0 means that there is
+ no dynamic symbol for this section. */
+ int dynindx;
+
/* Used by the backend linker to store the symbol hash table entries
associated with relocs against global symbols. */
struct elf_link_hash_entry **rel_hashes;
@@ -900,101 +1021,85 @@ struct bfd_elf_section_data
pointer may be NULL. It is used by the backend linker. */
Elf_Internal_Rela *relocs;
- /* Used by the backend linker when generating a shared library to
- record the dynamic symbol index for a section symbol
- corresponding to this section. A value of 0 means that there is
- no dynamic symbol for this section. */
- long dynindx;
-
- /* A pointer used for various section optimizations. */
- PTR sec_info;
+ /* A pointer to a linked list tracking dynamic relocs copied for
+ local symbols. */
+ void *local_dynrel;
- /* Type of that information. */
- enum elf_link_info_type sec_info_type;
+ /* A pointer to the bfd section used for dynamic relocs. */
+ asection *sreloc;
union {
/* Group name, if this section is a member of a group. */
const char *name;
/* Group signature sym, if this is the SHT_GROUP section. */
- struct symbol_cache_entry *id;
+ struct bfd_symbol *id;
} group;
/* A linked list of sections in the group. Circular when used by
the linker. */
asection *next_in_group;
- /* A pointer available for the processor specific ELF backend. */
- PTR tdata;
-
- /* Nonzero if this section uses RELA relocations, rather than REL. */
- unsigned int use_rela_p:1;
-
- /* Nonzero when a group is COMDAT. */
- unsigned int linkonce_p:1;
+ /* A pointer used for various section optimizations. */
+ void *sec_info;
};
#define elf_section_data(sec) ((struct bfd_elf_section_data*)sec->used_by_bfd)
+#define elf_section_type(sec) (elf_section_data(sec)->this_hdr.sh_type)
+#define elf_section_flags(sec) (elf_section_data(sec)->this_hdr.sh_flags)
#define elf_group_name(sec) (elf_section_data(sec)->group.name)
#define elf_group_id(sec) (elf_section_data(sec)->group.id)
#define elf_next_in_group(sec) (elf_section_data(sec)->next_in_group)
-#define elf_linkonce_p(sec) (elf_section_data(sec)->linkonce_p)
-/* Return true if section has been discarded. */
-#define elf_discarded_section(sec) \
- (!bfd_is_abs_section(sec) \
- && bfd_is_abs_section((sec)->output_section) \
- && elf_section_data (sec)->sec_info_type != ELF_INFO_TYPE_MERGE \
- && elf_section_data (sec)->sec_info_type != ELF_INFO_TYPE_JUST_SYMS)
+/* Return TRUE if section has been discarded. */
+#define elf_discarded_section(sec) \
+ (!bfd_is_abs_section (sec) \
+ && bfd_is_abs_section ((sec)->output_section) \
+ && sec->sec_info_type != ELF_INFO_TYPE_MERGE \
+ && sec->sec_info_type != ELF_INFO_TYPE_JUST_SYMS)
#define get_elf_backend_data(abfd) \
- ((struct elf_backend_data *) (abfd)->xvec->backend_data)
+ ((const struct elf_backend_data *) (abfd)->xvec->backend_data)
-/* Enumeration to specify the special section. */
-typedef enum elf_linker_section_enum
+/* This struct is used to pass information to routines called via
+ elf_link_hash_traverse which must return failure. */
+
+struct elf_info_failed
{
- LINKER_SECTION_UNKNOWN, /* not used */
- LINKER_SECTION_GOT, /* .got section for global offset pointers */
- LINKER_SECTION_PLT, /* .plt section for generated procedure stubs */
- LINKER_SECTION_SDATA, /* .sdata/.sbss section for PowerPC */
- LINKER_SECTION_SDATA2, /* .sdata2/.sbss2 section for PowerPC */
- LINKER_SECTION_MAX /* # of linker sections */
-} elf_linker_section_enum_t;
+ bfd_boolean failed;
+ struct bfd_link_info *info;
+ struct bfd_elf_version_tree *verdefs;
+};
-/* Sections created by the linker. */
+/* This structure is used to pass information to
+ _bfd_elf_link_assign_sym_version. */
-typedef struct elf_linker_section
+struct elf_assign_sym_version_info
{
- char *name; /* name of the section */
- char *rel_name; /* name of the associated .rel{,a}. section */
- char *bss_name; /* name of a related .bss section */
- char *sym_name; /* name of symbol to reference this section */
- asection *section; /* pointer to the section */
- asection *bss_section; /* pointer to the bss section associated with this */
- asection *rel_section; /* pointer to the relocations needed for this section */
- struct elf_link_hash_entry *sym_hash; /* pointer to the created symbol hash value */
- bfd_vma initial_size; /* initial size before any linker generated allocations */
- bfd_vma sym_offset; /* offset of symbol from beginning of section */
- bfd_vma hole_size; /* size of reserved address hole in allocation */
- bfd_vma hole_offset; /* current offset for the hole */
- bfd_vma max_hole_offset; /* maximum offset for the hole */
- elf_linker_section_enum_t which; /* which section this is */
- boolean hole_written_p; /* whether the hole has been initialized */
- unsigned int alignment; /* alignment for the section */
- flagword flags; /* flags to use to create the section */
-} 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
+ /* Output BFD. */
+ bfd *output_bfd;
+ /* General link information. */
+ struct bfd_link_info *info;
+ /* Version tree. */
+ struct bfd_elf_version_tree *verdefs;
+ /* Whether we had a failure. */
+ bfd_boolean failed;
+};
+
+/* This structure is used to pass information to
+ _bfd_elf_link_find_version_dependencies. */
+
+struct elf_find_verdep_info
{
- struct elf_linker_section_pointers *next; /* next allocated pointer for this symbol */
- bfd_vma offset; /* offset of pointer from beginning of section */
- bfd_vma addend; /* addend used */
- elf_linker_section_enum_t which; /* which linker section this is */
- boolean written_address_p; /* whether address was written yet */
-} elf_linker_section_pointers_t;
+ /* Output BFD. */
+ bfd *output_bfd;
+ /* General link information. */
+ struct bfd_link_info *info;
+ /* The number of dependencies. */
+ unsigned int vers;
+ /* Whether we had a failure. */
+ bfd_boolean failed;
+};
/* Some private data is stashed away for future use using the tdata pointer
in the bfd structure. */
@@ -1025,18 +1130,9 @@ struct elf_obj_tdata
unsigned int symtab_shndx_section;
unsigned int dynversym_section, dynverdef_section, dynverref_section;
file_ptr next_file_pos;
-#if 0
- /* we don't need these inside bfd anymore, and I think
- these weren't used outside bfd. */
- void *prstatus; /* The raw /proc prstatus structure */
- void *prpsinfo; /* The raw /proc prpsinfo structure */
-#endif
bfd_vma gp; /* The gp value */
unsigned int gp_size; /* The gp size */
- Elf_Internal_Shdr **group_sect_ptr;
- int num_group;
-
/* Information grabbed from an elf core file. */
int core_signal;
int core_pid;
@@ -1044,32 +1140,21 @@ struct elf_obj_tdata
char* core_program;
char* core_command;
- /* This is set to true if the object was created by the backend
- linker. */
- boolean linker;
-
/* A mapping from external symbols to entries in the linker hash
table, used when linking. This is indexed by the symbol index
minus the sh_info field of the symbol table header. */
struct elf_link_hash_entry **sym_hashes;
- /* A mapping from local symbols to offsets into the global offset
- table, used when linking. This is indexed by the symbol index.
- Like for the globals, we use a union and two names primarily to
- document the intent of any particular piece of code. The field
- should be used as a count until size_dynamic_sections, at which
- point the contents of the .got is fixed. Afterward, if an entry
- is -1, then the symbol does not require a global offset table entry. */
+ /* Track usage and final offsets of GOT entries for local symbols.
+ This array is indexed by symbol index. Elements are used
+ identically to "got" in struct elf_link_hash_entry. */
union
{
bfd_signed_vma *refcounts;
bfd_vma *offsets;
+ struct got_entry **ents;
} local_got;
- /* 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;
-
/* The linker ELF emulation code needs to let the backend ELF linker
know what filename should be used for a dynamic object if the
dynamic object is found using a search. The emulation code then
@@ -1080,26 +1165,11 @@ struct elf_obj_tdata
one. */
const char *dt_name;
- /* When a reference in a regular object is resolved by a shared
- object is loaded into via the DT_NEEDED entries by the linker
- ELF emulation code, we need to add the shared object to the
- DT_NEEDED list of the resulting binary to indicate the dependency
- as if the -l option is passed to the linker. This field holds the
- name of the loaded shared object. */
- const char *dt_soname;
-
- /* Irix 5 often screws up the symbol table, sorting local symbols
- after global symbols. This flag is set if the symbol table in
- this BFD appears to be screwed up. If it is, we ignore the
- sh_info field in the symbol table header, and always read all the
- symbols. */
- boolean bad_symtab;
-
/* Records the result of `get_program_header_size'. */
bfd_size_type program_header_size;
/* Used by find_nearest_line entry point. */
- PTR line_info;
+ void *line_info;
/* Used by MIPS ELF find_nearest_line entry point. The structure
could be included directly in this one, but there's no point to
@@ -1111,19 +1181,19 @@ struct elf_obj_tdata
struct dwarf1_debug *dwarf1_find_line_info;
/* A place to stash dwarf2 info for this bfd. */
- PTR dwarf2_find_line_info;
+ void *dwarf2_find_line_info;
/* An array of stub sections indexed by symbol number, used by the
MIPS ELF linker. FIXME: We should figure out some way to only
include this field for a MIPS ELF target. */
asection **local_stubs;
- /* Used to determine if the e_flags field has been initialized */
- boolean flags_init;
-
/* Used to determine if PT_GNU_EH_FRAME segment header should be
created. */
- boolean eh_frame_hdr;
+ asection *eh_frame_hdr;
+
+ Elf_Internal_Shdr **group_sect_ptr;
+ int num_group;
/* Number of symbol version definitions we are about to emit. */
unsigned int cverdefs;
@@ -1131,21 +1201,40 @@ struct elf_obj_tdata
/* Number of symbol version references we are about to emit. */
unsigned int cverrefs;
+ /* Segment flags for the PT_GNU_STACK segment. */
+ unsigned int stack_flags;
+
/* Symbol version definitions in external objects. */
Elf_Internal_Verdef *verdef;
/* Symbol version references to external objects. */
Elf_Internal_Verneed *verref;
- /* Linker sections that we are interested in. */
- struct elf_linker_section *linker_section[ (int)LINKER_SECTION_MAX ];
-
/* The Irix 5 support uses two virtual sections, which represent
text/data symbols defined in dynamic objects. */
asymbol *elf_data_symbol;
asymbol *elf_text_symbol;
asection *elf_data_section;
asection *elf_text_section;
+
+ /* Whether a dyanmic object was specified normally on the linker
+ command line, or was specified when --as-needed was in effect,
+ or was found via a DT_NEEDED entry. */
+ enum dynamic_lib_link_class dyn_lib_class;
+
+ /* This is set to TRUE if the object was created by the backend
+ linker. */
+ bfd_boolean linker;
+
+ /* Irix 5 often screws up the symbol table, sorting local symbols
+ after global symbols. This flag is set if the symbol table in
+ this BFD appears to be screwed up. If it is, we ignore the
+ sh_info field in the symbol table header, and always read all the
+ symbols. */
+ bfd_boolean bad_symtab;
+
+ /* Used to determine if the e_flags field has been initialized */
+ bfd_boolean flags_init;
};
#define elf_tdata(bfd) ((bfd) -> tdata.elf_obj_data)
@@ -1170,439 +1259,504 @@ struct elf_obj_tdata
#define elf_sym_hashes(bfd) (elf_tdata(bfd) -> sym_hashes)
#define elf_local_got_refcounts(bfd) (elf_tdata(bfd) -> local_got.refcounts)
#define elf_local_got_offsets(bfd) (elf_tdata(bfd) -> local_got.offsets)
-#define elf_local_ptr_offsets(bfd) (elf_tdata(bfd) -> linker_section_pointers)
+#define elf_local_got_ents(bfd) (elf_tdata(bfd) -> local_got.ents)
#define elf_dt_name(bfd) (elf_tdata(bfd) -> dt_name)
-#define elf_dt_soname(bfd) (elf_tdata(bfd) -> dt_soname)
+#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_linker_section(bfd,n) (elf_tdata(bfd) -> linker_section[(int)n])
extern void _bfd_elf_swap_verdef_in
- PARAMS ((bfd *, const Elf_External_Verdef *, Elf_Internal_Verdef *));
+ (bfd *, const Elf_External_Verdef *, Elf_Internal_Verdef *);
extern void _bfd_elf_swap_verdef_out
- PARAMS ((bfd *, const Elf_Internal_Verdef *, Elf_External_Verdef *));
+ (bfd *, const Elf_Internal_Verdef *, Elf_External_Verdef *);
extern void _bfd_elf_swap_verdaux_in
- PARAMS ((bfd *, const Elf_External_Verdaux *, Elf_Internal_Verdaux *));
+ (bfd *, const Elf_External_Verdaux *, Elf_Internal_Verdaux *);
extern void _bfd_elf_swap_verdaux_out
- PARAMS ((bfd *, const Elf_Internal_Verdaux *, Elf_External_Verdaux *));
+ (bfd *, const Elf_Internal_Verdaux *, Elf_External_Verdaux *);
extern void _bfd_elf_swap_verneed_in
- PARAMS ((bfd *, const Elf_External_Verneed *, Elf_Internal_Verneed *));
+ (bfd *, const Elf_External_Verneed *, Elf_Internal_Verneed *);
extern void _bfd_elf_swap_verneed_out
- PARAMS ((bfd *, const Elf_Internal_Verneed *, Elf_External_Verneed *));
+ (bfd *, const Elf_Internal_Verneed *, Elf_External_Verneed *);
extern void _bfd_elf_swap_vernaux_in
- PARAMS ((bfd *, const Elf_External_Vernaux *, Elf_Internal_Vernaux *));
+ (bfd *, const Elf_External_Vernaux *, Elf_Internal_Vernaux *);
extern void _bfd_elf_swap_vernaux_out
- PARAMS ((bfd *, const Elf_Internal_Vernaux *, Elf_External_Vernaux *));
+ (bfd *, const Elf_Internal_Vernaux *, Elf_External_Vernaux *);
extern void _bfd_elf_swap_versym_in
- PARAMS ((bfd *, const Elf_External_Versym *, Elf_Internal_Versym *));
+ (bfd *, const Elf_External_Versym *, Elf_Internal_Versym *);
extern void _bfd_elf_swap_versym_out
- PARAMS ((bfd *, const Elf_Internal_Versym *, Elf_External_Versym *));
+ (bfd *, const Elf_Internal_Versym *, Elf_External_Versym *);
extern int _bfd_elf_section_from_bfd_section
- PARAMS ((bfd *, asection *));
+ (bfd *, asection *);
extern char *bfd_elf_string_from_elf_section
- PARAMS ((bfd *, unsigned, unsigned));
+ (bfd *, unsigned, unsigned);
extern char *bfd_elf_get_str_section
- PARAMS ((bfd *, unsigned));
+ (bfd *, unsigned);
extern Elf_Internal_Sym *bfd_elf_get_elf_syms
- PARAMS ((bfd *, Elf_Internal_Shdr *, size_t, size_t,
- Elf_Internal_Sym *, PTR, Elf_External_Sym_Shndx *));
-
-extern boolean _bfd_elf_copy_private_bfd_data
- PARAMS ((bfd *, bfd *));
-extern boolean _bfd_elf_print_private_bfd_data
- PARAMS ((bfd *, PTR));
+ (bfd *, Elf_Internal_Shdr *, size_t, size_t, Elf_Internal_Sym *, void *,
+ Elf_External_Sym_Shndx *);
+extern const char *bfd_elf_local_sym_name
+ (bfd *, Elf_Internal_Sym *);
+
+extern bfd_boolean _bfd_elf_copy_private_bfd_data
+ (bfd *, bfd *);
+extern bfd_boolean _bfd_elf_print_private_bfd_data
+ (bfd *, void *);
extern void bfd_elf_print_symbol
- PARAMS ((bfd *, PTR, asymbol *, bfd_print_symbol_type));
+ (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)
-
-#define bfd_elf32_print_symbol bfd_elf_print_symbol
-#define bfd_elf64_print_symbol bfd_elf_print_symbol
+ bfd_elf_string_from_elf_section (abfd, elf_elfheader(abfd)->e_shstrndx, \
+ strindex)
extern void _bfd_elf_sprintf_vma
- PARAMS ((bfd *, char *, bfd_vma));
+ (bfd *, char *, bfd_vma);
extern void _bfd_elf_fprintf_vma
- PARAMS ((bfd *, PTR, bfd_vma));
+ (bfd *, void *, bfd_vma);
+
+extern bfd_byte _bfd_elf_encode_eh_address
+ (bfd *abfd, struct bfd_link_info *info, asection *osec, bfd_vma offset,
+ asection *loc_sec, bfd_vma loc_offset, bfd_vma *encoded);
+extern bfd_boolean _bfd_elf_can_make_relative
+ (bfd *input_bfd, struct bfd_link_info *info, asection *eh_frame_section);
extern enum elf_reloc_type_class _bfd_elf_reloc_type_class
- PARAMS ((const Elf_Internal_Rela *));
+ (const Elf_Internal_Rela *);
extern bfd_vma _bfd_elf_rela_local_sym
- PARAMS ((bfd *, Elf_Internal_Sym *, asection *, Elf_Internal_Rela *));
+ (bfd *, Elf_Internal_Sym *, asection **, Elf_Internal_Rela *);
extern bfd_vma _bfd_elf_rel_local_sym
- PARAMS ((bfd *, Elf_Internal_Sym *, asection **, bfd_vma));
+ (bfd *, Elf_Internal_Sym *, asection **, bfd_vma);
extern bfd_vma _bfd_elf_section_offset
- PARAMS ((bfd *, struct bfd_link_info *, asection *, bfd_vma));
+ (bfd *, struct bfd_link_info *, asection *, bfd_vma);
extern unsigned long bfd_elf_hash
- PARAMS ((const char *));
+ (const char *);
extern bfd_reloc_status_type bfd_elf_generic_reloc
- PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
-extern boolean bfd_elf_mkobject
- PARAMS ((bfd *));
-extern boolean bfd_elf_mkcorefile
- PARAMS ((bfd *));
+ (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **);
+extern bfd_boolean bfd_elf_mkobject
+ (bfd *);
+extern bfd_boolean bfd_elf_mkcorefile
+ (bfd *);
extern Elf_Internal_Shdr *bfd_elf_find_section
- PARAMS ((bfd *, char *));
-extern boolean _bfd_elf_make_section_from_shdr
- PARAMS ((bfd *, Elf_Internal_Shdr *, const char *));
-extern boolean _bfd_elf_make_section_from_phdr
- PARAMS ((bfd *, Elf_Internal_Phdr *, int, const char *));
+ (bfd *, char *);
+extern bfd_boolean _bfd_elf_make_section_from_shdr
+ (bfd *, Elf_Internal_Shdr *, const char *);
+extern bfd_boolean _bfd_elf_make_section_from_phdr
+ (bfd *, Elf_Internal_Phdr *, int, const char *);
extern struct bfd_hash_entry *_bfd_elf_link_hash_newfunc
- PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, const char *));
+ (struct bfd_hash_entry *, struct bfd_hash_table *, const char *);
extern struct bfd_link_hash_table *_bfd_elf_link_hash_table_create
- PARAMS ((bfd *));
+ (bfd *);
extern void _bfd_elf_link_hash_copy_indirect
- PARAMS ((struct elf_backend_data *, struct elf_link_hash_entry *,
- struct elf_link_hash_entry *));
+ (const struct elf_backend_data *, struct elf_link_hash_entry *,
+ struct elf_link_hash_entry *);
extern void _bfd_elf_link_hash_hide_symbol
- PARAMS ((struct bfd_link_info *, struct elf_link_hash_entry *, boolean));
-extern boolean _bfd_elf_link_hash_table_init
- PARAMS ((struct elf_link_hash_table *, bfd *,
- struct bfd_hash_entry *(*) (struct bfd_hash_entry *,
- struct bfd_hash_table *,
- const char *)));
-extern boolean _bfd_elf_slurp_version_tables
- PARAMS ((bfd *));
-extern boolean _bfd_elf_merge_sections
- PARAMS ((bfd *, struct bfd_link_info *));
-extern boolean bfd_elf_discard_group
- PARAMS ((bfd *, struct sec *));
+ (struct bfd_link_info *, struct elf_link_hash_entry *, bfd_boolean);
+extern bfd_boolean _bfd_elf_link_hash_table_init
+ (struct elf_link_hash_table *, bfd *,
+ struct bfd_hash_entry *(*)
+ (struct bfd_hash_entry *, struct bfd_hash_table *, const char *));
+extern bfd_boolean _bfd_elf_slurp_version_tables
+ (bfd *);
+extern bfd_boolean _bfd_elf_merge_sections
+ (bfd *, struct bfd_link_info *);
+extern bfd_boolean bfd_elf_discard_group
+ (bfd *, struct bfd_section *);
extern void bfd_elf_set_group_contents
- PARAMS ((bfd *, asection *, PTR));
+ (bfd *, asection *, void *);
extern void _bfd_elf_link_just_syms
- PARAMS ((asection *, struct bfd_link_info *));
-extern boolean _bfd_elf_copy_private_symbol_data
- PARAMS ((bfd *, asymbol *, bfd *, asymbol *));
-extern boolean _bfd_elf_copy_private_section_data
- PARAMS ((bfd *, asection *, bfd *, asection *));
-extern boolean _bfd_elf_write_object_contents
- PARAMS ((bfd *));
-extern boolean _bfd_elf_write_corefile_contents
- PARAMS ((bfd *));
-extern boolean _bfd_elf_set_section_contents
- PARAMS ((bfd *, sec_ptr, PTR, file_ptr, bfd_size_type));
+ (asection *, struct bfd_link_info *);
+extern bfd_boolean _bfd_elf_copy_private_symbol_data
+ (bfd *, asymbol *, bfd *, asymbol *);
+extern bfd_boolean _bfd_elf_copy_private_section_data
+ (bfd *, asection *, bfd *, asection *);
+extern bfd_boolean _bfd_elf_write_object_contents
+ (bfd *);
+extern bfd_boolean _bfd_elf_write_corefile_contents
+ (bfd *);
+extern bfd_boolean _bfd_elf_set_section_contents
+ (bfd *, sec_ptr, const void *, file_ptr, bfd_size_type);
extern long _bfd_elf_get_symtab_upper_bound
- PARAMS ((bfd *));
-extern long _bfd_elf_get_symtab
- PARAMS ((bfd *, asymbol **));
+ (bfd *);
+extern long _bfd_elf_canonicalize_symtab
+ (bfd *, asymbol **);
extern long _bfd_elf_get_dynamic_symtab_upper_bound
- PARAMS ((bfd *));
+ (bfd *);
extern long _bfd_elf_canonicalize_dynamic_symtab
- PARAMS ((bfd *, asymbol **));
+ (bfd *, asymbol **);
extern long _bfd_elf_get_reloc_upper_bound
- PARAMS ((bfd *, sec_ptr));
+ (bfd *, sec_ptr);
extern long _bfd_elf_canonicalize_reloc
- PARAMS ((bfd *, sec_ptr, arelent **, asymbol **));
+ (bfd *, sec_ptr, arelent **, asymbol **);
extern long _bfd_elf_get_dynamic_reloc_upper_bound
- PARAMS ((bfd *));
+ (bfd *);
extern long _bfd_elf_canonicalize_dynamic_reloc
- PARAMS ((bfd *, arelent **, asymbol **));
+ (bfd *, arelent **, asymbol **);
extern asymbol *_bfd_elf_make_empty_symbol
- PARAMS ((bfd *));
+ (bfd *);
extern void _bfd_elf_get_symbol_info
- PARAMS ((bfd *, asymbol *, symbol_info *));
-extern boolean _bfd_elf_is_local_label_name
- PARAMS ((bfd *, const char *));
+ (bfd *, asymbol *, symbol_info *);
+extern bfd_boolean _bfd_elf_is_local_label_name
+ (bfd *, const char *);
extern alent *_bfd_elf_get_lineno
- PARAMS ((bfd *, asymbol *));
-extern boolean _bfd_elf_set_arch_mach
- PARAMS ((bfd *, enum bfd_architecture, unsigned long));
-extern boolean _bfd_elf_find_nearest_line
- PARAMS ((bfd *, asection *, asymbol **, bfd_vma, const char **,
- const char **, unsigned int *));
+ (bfd *, asymbol *);
+extern bfd_boolean _bfd_elf_set_arch_mach
+ (bfd *, enum bfd_architecture, unsigned long);
+extern bfd_boolean _bfd_elf_find_nearest_line
+ (bfd *, asection *, asymbol **, bfd_vma, const char **, const char **,
+ unsigned int *);
#define _bfd_elf_read_minisymbols _bfd_generic_read_minisymbols
#define _bfd_elf_minisymbol_to_symbol _bfd_generic_minisymbol_to_symbol
extern int _bfd_elf_sizeof_headers
- PARAMS ((bfd *, boolean));
-extern boolean _bfd_elf_new_section_hook
- PARAMS ((bfd *, asection *));
-extern boolean _bfd_elf_init_reloc_shdr
- PARAMS ((bfd *, Elf_Internal_Shdr *, asection *, boolean));
+ (bfd *, bfd_boolean);
+extern bfd_boolean _bfd_elf_new_section_hook
+ (bfd *, asection *);
+extern bfd_boolean _bfd_elf_init_reloc_shdr
+ (bfd *, Elf_Internal_Shdr *, asection *, bfd_boolean);
+extern const struct bfd_elf_special_section *_bfd_elf_get_sec_type_attr
+ (bfd *, const char *);
/* If the target doesn't have reloc handling written yet: */
extern void _bfd_elf_no_info_to_howto
- PARAMS ((bfd *, arelent *, Elf_Internal_Rela *));
+ (bfd *, arelent *, Elf_Internal_Rela *);
-extern boolean bfd_section_from_shdr
- PARAMS ((bfd *, unsigned int shindex));
-extern boolean bfd_section_from_phdr
- PARAMS ((bfd *, Elf_Internal_Phdr *, int));
+extern bfd_boolean bfd_section_from_shdr
+ (bfd *, unsigned int shindex);
+extern bfd_boolean bfd_section_from_phdr
+ (bfd *, Elf_Internal_Phdr *, int);
extern int _bfd_elf_symbol_from_bfd_symbol
- PARAMS ((bfd *, asymbol **));
+ (bfd *, asymbol **);
extern asection *bfd_section_from_r_symndx
- PARAMS ((bfd *, struct sym_sec_cache *, asection *, unsigned long));
+ (bfd *, struct sym_sec_cache *, asection *, unsigned long);
extern asection *bfd_section_from_elf_index
- PARAMS ((bfd *, unsigned int));
-extern boolean _bfd_elf_create_dynamic_sections
- PARAMS ((bfd *, struct bfd_link_info *));
+ (bfd *, unsigned int);
extern struct bfd_strtab_hash *_bfd_elf_stringtab_init
- PARAMS ((void));
+ (void);
extern struct elf_strtab_hash * _bfd_elf_strtab_init
- PARAMS ((void));
+ (void);
extern void _bfd_elf_strtab_free
- PARAMS ((struct elf_strtab_hash *));
+ (struct elf_strtab_hash *);
extern bfd_size_type _bfd_elf_strtab_add
- PARAMS ((struct elf_strtab_hash *, const char *, boolean));
+ (struct elf_strtab_hash *, const char *, bfd_boolean);
extern void _bfd_elf_strtab_addref
- PARAMS ((struct elf_strtab_hash *, bfd_size_type));
+ (struct elf_strtab_hash *, bfd_size_type);
extern void _bfd_elf_strtab_delref
- PARAMS ((struct elf_strtab_hash *, bfd_size_type));
+ (struct elf_strtab_hash *, bfd_size_type);
extern void _bfd_elf_strtab_clear_all_refs
- PARAMS ((struct elf_strtab_hash *));
+ (struct elf_strtab_hash *);
extern bfd_size_type _bfd_elf_strtab_size
- PARAMS ((struct elf_strtab_hash *));
+ (struct elf_strtab_hash *);
extern bfd_size_type _bfd_elf_strtab_offset
- PARAMS ((struct elf_strtab_hash *, bfd_size_type));
-extern boolean _bfd_elf_strtab_emit
- PARAMS ((bfd *, struct elf_strtab_hash *));
+ (struct elf_strtab_hash *, bfd_size_type);
+extern bfd_boolean _bfd_elf_strtab_emit
+ (bfd *, struct elf_strtab_hash *);
extern void _bfd_elf_strtab_finalize
- PARAMS ((struct elf_strtab_hash *));
+ (struct elf_strtab_hash *);
-extern boolean _bfd_elf_discard_section_eh_frame
- PARAMS ((bfd *, struct bfd_link_info *, asection *, asection *,
- boolean (*) (bfd_vma, PTR), struct elf_reloc_cookie *));
-extern boolean _bfd_elf_discard_section_eh_frame_hdr
- PARAMS ((bfd *, struct bfd_link_info *, asection *));
+extern bfd_boolean _bfd_elf_discard_section_eh_frame
+ (bfd *, struct bfd_link_info *, asection *,
+ bfd_boolean (*) (bfd_vma, void *), struct elf_reloc_cookie *);
+extern bfd_boolean _bfd_elf_discard_section_eh_frame_hdr
+ (bfd *, struct bfd_link_info *);
extern bfd_vma _bfd_elf_eh_frame_section_offset
- PARAMS ((bfd *, asection *, bfd_vma));
-extern boolean _bfd_elf_write_section_eh_frame
- PARAMS ((bfd *, asection *, asection *, bfd_byte *));
-extern boolean _bfd_elf_write_section_eh_frame_hdr
- PARAMS ((bfd *, asection *));
-extern boolean _bfd_elf_maybe_strip_eh_frame_hdr
- PARAMS ((struct bfd_link_info *));
-
-extern boolean _bfd_elf_link_record_dynamic_symbol
- PARAMS ((struct bfd_link_info *, struct elf_link_hash_entry *));
+ (bfd *, asection *, bfd_vma);
+extern bfd_boolean _bfd_elf_write_section_eh_frame
+ (bfd *, struct bfd_link_info *, asection *, bfd_byte *);
+extern bfd_boolean _bfd_elf_write_section_eh_frame_hdr
+ (bfd *, struct bfd_link_info *);
+extern bfd_boolean _bfd_elf_maybe_strip_eh_frame_hdr
+ (struct bfd_link_info *);
+
+extern bfd_boolean _bfd_elf_merge_symbol
+ (bfd *, struct bfd_link_info *, const char *, Elf_Internal_Sym *,
+ asection **, bfd_vma *, struct elf_link_hash_entry **, bfd_boolean *,
+ bfd_boolean *, bfd_boolean *, bfd_boolean *);
+
+extern bfd_boolean _bfd_elf_add_default_symbol
+ (bfd *, struct bfd_link_info *, struct elf_link_hash_entry *,
+ const char *, Elf_Internal_Sym *, asection **, bfd_vma *,
+ bfd_boolean *, bfd_boolean);
+
+extern bfd_boolean _bfd_elf_export_symbol
+ (struct elf_link_hash_entry *, void *);
+
+extern bfd_boolean _bfd_elf_link_find_version_dependencies
+ (struct elf_link_hash_entry *, void *);
+
+extern bfd_boolean _bfd_elf_link_assign_sym_version
+ (struct elf_link_hash_entry *, void *);
+
extern long _bfd_elf_link_lookup_local_dynindx
- PARAMS ((struct bfd_link_info *, bfd *, long));
-extern boolean _bfd_elf_compute_section_file_positions
- PARAMS ((bfd *, struct bfd_link_info *));
+ (struct bfd_link_info *, bfd *, long);
+extern bfd_boolean _bfd_elf_compute_section_file_positions
+ (bfd *, struct bfd_link_info *);
extern void _bfd_elf_assign_file_positions_for_relocs
- PARAMS ((bfd *));
+ (bfd *);
extern file_ptr _bfd_elf_assign_file_position_for_section
- PARAMS ((Elf_Internal_Shdr *, file_ptr, boolean));
+ (Elf_Internal_Shdr *, file_ptr, bfd_boolean);
-extern boolean _bfd_elf_validate_reloc
- PARAMS ((bfd *, arelent *));
+extern bfd_boolean _bfd_elf_validate_reloc
+ (bfd *, arelent *);
-extern boolean _bfd_elf_create_dynamic_sections
- PARAMS ((bfd *, struct bfd_link_info *));
-extern boolean _bfd_elf_create_got_section
- PARAMS ((bfd *, struct bfd_link_info *));
+extern bfd_boolean _bfd_elf_link_create_dynamic_sections
+ (bfd *, struct bfd_link_info *);
+extern bfd_boolean _bfd_elf_create_dynamic_sections
+ (bfd *, struct bfd_link_info *);
+extern bfd_boolean _bfd_elf_create_got_section
+ (bfd *, struct bfd_link_info *);
extern unsigned long _bfd_elf_link_renumber_dynsyms
- PARAMS ((bfd *, struct bfd_link_info *));
+ (bfd *, struct bfd_link_info *);
-extern boolean _bfd_elfcore_make_pseudosection
- PARAMS ((bfd *, char *, size_t, ufile_ptr));
+extern bfd_boolean _bfd_elfcore_make_pseudosection
+ (bfd *, char *, size_t, ufile_ptr);
extern char *_bfd_elfcore_strndup
- PARAMS ((bfd *, char *, size_t));
+ (bfd *, char *, size_t);
-extern elf_linker_section_t *_bfd_elf_create_linker_section
- PARAMS ((bfd *, struct bfd_link_info *, enum elf_linker_section_enum,
- elf_linker_section_t *));
+extern Elf_Internal_Rela *_bfd_elf_link_read_relocs
+ (bfd *, asection *, void *, Elf_Internal_Rela *, bfd_boolean);
-extern elf_linker_section_pointers_t *_bfd_elf_find_pointer_linker_section
- PARAMS ((elf_linker_section_pointers_t *, bfd_vma,
- elf_linker_section_enum_t));
+extern bfd_boolean _bfd_elf_link_size_reloc_section
+ (bfd *, Elf_Internal_Shdr *, asection *);
-extern boolean bfd_elf32_create_pointer_linker_section
- PARAMS ((bfd *, struct bfd_link_info *, elf_linker_section_t *,
- struct elf_link_hash_entry *, const Elf32_Internal_Rela *));
+extern bfd_boolean _bfd_elf_link_output_relocs
+ (bfd *, asection *, Elf_Internal_Shdr *, Elf_Internal_Rela *);
-extern bfd_vma bfd_elf32_finish_pointer_linker_section
- PARAMS ((bfd *, bfd *, struct bfd_link_info *, elf_linker_section_t *,
- struct elf_link_hash_entry *, bfd_vma,
- const Elf32_Internal_Rela *, int));
+extern bfd_boolean _bfd_elf_fix_symbol_flags
+ (struct elf_link_hash_entry *, struct elf_info_failed *);
-extern boolean bfd_elf64_create_pointer_linker_section
- PARAMS ((bfd *, struct bfd_link_info *, elf_linker_section_t *,
- struct elf_link_hash_entry *, const Elf64_Internal_Rela *));
+extern bfd_boolean _bfd_elf_adjust_dynamic_symbol
+ (struct elf_link_hash_entry *, void *);
-extern bfd_vma bfd_elf64_finish_pointer_linker_section
- PARAMS ((bfd *, bfd *, struct bfd_link_info *, elf_linker_section_t *,
- struct elf_link_hash_entry *, bfd_vma,
- const Elf64_Internal_Rela *, int));
+extern bfd_boolean _bfd_elf_link_sec_merge_syms
+ (struct elf_link_hash_entry *, void *);
-extern boolean _bfd_elf_make_linker_section_rela
- PARAMS ((bfd *, elf_linker_section_t *, int));
+extern bfd_boolean _bfd_elf_dynamic_symbol_p
+ (struct elf_link_hash_entry *, struct bfd_link_info *, bfd_boolean);
+
+extern bfd_boolean _bfd_elf_symbol_refs_local_p
+ (struct elf_link_hash_entry *, struct bfd_link_info *, bfd_boolean);
extern const bfd_target *bfd_elf32_object_p
- PARAMS ((bfd *));
+ (bfd *);
extern const bfd_target *bfd_elf32_core_file_p
- PARAMS ((bfd *));
+ (bfd *);
extern char *bfd_elf32_core_file_failing_command
- PARAMS ((bfd *));
+ (bfd *);
extern int bfd_elf32_core_file_failing_signal
- PARAMS ((bfd *));
-extern boolean bfd_elf32_core_file_matches_executable_p
- PARAMS ((bfd *, bfd *));
-
-extern boolean bfd_elf32_bfd_link_add_symbols
- PARAMS ((bfd *, struct bfd_link_info *));
-extern boolean bfd_elf32_bfd_final_link
- PARAMS ((bfd *, struct bfd_link_info *));
+ (bfd *);
+extern bfd_boolean bfd_elf32_core_file_matches_executable_p
+ (bfd *, bfd *);
extern void bfd_elf32_swap_symbol_in
- PARAMS ((bfd *, const PTR, const PTR, Elf_Internal_Sym *));
+ (bfd *, const void *, const void *, Elf_Internal_Sym *);
extern void bfd_elf32_swap_symbol_out
- PARAMS ((bfd *, const Elf_Internal_Sym *, PTR, PTR));
+ (bfd *, const Elf_Internal_Sym *, void *, void *);
extern void bfd_elf32_swap_reloc_in
- PARAMS ((bfd *, const Elf32_External_Rel *, Elf_Internal_Rel *));
+ (bfd *, const bfd_byte *, Elf_Internal_Rela *);
extern void bfd_elf32_swap_reloc_out
- PARAMS ((bfd *, const Elf_Internal_Rel *, Elf32_External_Rel *));
+ (bfd *, const Elf_Internal_Rela *, bfd_byte *);
extern void bfd_elf32_swap_reloca_in
- PARAMS ((bfd *, const Elf32_External_Rela *, Elf_Internal_Rela *));
+ (bfd *, const bfd_byte *, Elf_Internal_Rela *);
extern void bfd_elf32_swap_reloca_out
- PARAMS ((bfd *, const Elf_Internal_Rela *, Elf32_External_Rela *));
+ (bfd *, const Elf_Internal_Rela *, bfd_byte *);
extern void bfd_elf32_swap_phdr_in
- PARAMS ((bfd *, const Elf32_External_Phdr *, Elf_Internal_Phdr *));
+ (bfd *, const Elf32_External_Phdr *, Elf_Internal_Phdr *);
extern void bfd_elf32_swap_phdr_out
- PARAMS ((bfd *, const Elf_Internal_Phdr *, Elf32_External_Phdr *));
+ (bfd *, const Elf_Internal_Phdr *, Elf32_External_Phdr *);
extern void bfd_elf32_swap_dyn_in
- PARAMS ((bfd *, const PTR, Elf_Internal_Dyn *));
+ (bfd *, const void *, Elf_Internal_Dyn *);
extern void bfd_elf32_swap_dyn_out
- PARAMS ((bfd *, const Elf_Internal_Dyn *, PTR));
+ (bfd *, const Elf_Internal_Dyn *, void *);
extern long bfd_elf32_slurp_symbol_table
- PARAMS ((bfd *, asymbol **, boolean));
-extern boolean bfd_elf32_write_shdrs_and_ehdr
- PARAMS ((bfd *));
+ (bfd *, asymbol **, bfd_boolean);
+extern bfd_boolean bfd_elf32_write_shdrs_and_ehdr
+ (bfd *);
extern int bfd_elf32_write_out_phdrs
- PARAMS ((bfd *, const Elf_Internal_Phdr *, unsigned int));
+ (bfd *, const Elf_Internal_Phdr *, unsigned int);
extern void bfd_elf32_write_relocs
- PARAMS ((bfd *, asection *, PTR));
-extern boolean bfd_elf32_slurp_reloc_table
- PARAMS ((bfd *, asection *, asymbol **, boolean));
-extern boolean bfd_elf32_add_dynamic_entry
- PARAMS ((struct bfd_link_info *, bfd_vma, bfd_vma));
-extern boolean bfd_elf32_link_create_dynamic_sections
- PARAMS ((bfd *, struct bfd_link_info *));
-extern Elf_Internal_Rela *_bfd_elf32_link_read_relocs
- PARAMS ((bfd *, asection *, PTR, Elf_Internal_Rela *, boolean));
+ (bfd *, asection *, void *);
+extern bfd_boolean bfd_elf32_slurp_reloc_table
+ (bfd *, asection *, asymbol **, bfd_boolean);
extern const bfd_target *bfd_elf64_object_p
- PARAMS ((bfd *));
+ (bfd *);
extern const bfd_target *bfd_elf64_core_file_p
- PARAMS ((bfd *));
+ (bfd *);
extern char *bfd_elf64_core_file_failing_command
- PARAMS ((bfd *));
+ (bfd *);
extern int bfd_elf64_core_file_failing_signal
- PARAMS ((bfd *));
-extern boolean bfd_elf64_core_file_matches_executable_p
- PARAMS ((bfd *, bfd *));
-extern boolean bfd_elf64_bfd_link_add_symbols
- PARAMS ((bfd *, struct bfd_link_info *));
-extern boolean bfd_elf64_bfd_final_link
- PARAMS ((bfd *, struct bfd_link_info *));
+ (bfd *);
+extern bfd_boolean bfd_elf64_core_file_matches_executable_p
+ (bfd *, bfd *);
extern void bfd_elf64_swap_symbol_in
- PARAMS ((bfd *, const PTR, const PTR, Elf_Internal_Sym *));
+ (bfd *, const void *, const void *, Elf_Internal_Sym *);
extern void bfd_elf64_swap_symbol_out
- PARAMS ((bfd *, const Elf_Internal_Sym *, PTR, PTR));
+ (bfd *, const Elf_Internal_Sym *, void *, void *);
extern void bfd_elf64_swap_reloc_in
- PARAMS ((bfd *, const Elf64_External_Rel *, Elf_Internal_Rel *));
+ (bfd *, const bfd_byte *, Elf_Internal_Rela *);
extern void bfd_elf64_swap_reloc_out
- PARAMS ((bfd *, const Elf_Internal_Rel *, Elf64_External_Rel *));
+ (bfd *, const Elf_Internal_Rela *, bfd_byte *);
extern void bfd_elf64_swap_reloca_in
- PARAMS ((bfd *, const Elf64_External_Rela *, Elf_Internal_Rela *));
+ (bfd *, const bfd_byte *, Elf_Internal_Rela *);
extern void bfd_elf64_swap_reloca_out
- PARAMS ((bfd *, const Elf_Internal_Rela *, Elf64_External_Rela *));
+ (bfd *, const Elf_Internal_Rela *, bfd_byte *);
extern void bfd_elf64_swap_phdr_in
- PARAMS ((bfd *, const Elf64_External_Phdr *, Elf_Internal_Phdr *));
+ (bfd *, const Elf64_External_Phdr *, Elf_Internal_Phdr *);
extern void bfd_elf64_swap_phdr_out
- PARAMS ((bfd *, const Elf_Internal_Phdr *, Elf64_External_Phdr *));
+ (bfd *, const Elf_Internal_Phdr *, Elf64_External_Phdr *);
extern void bfd_elf64_swap_dyn_in
- PARAMS ((bfd *, const PTR, Elf_Internal_Dyn *));
+ (bfd *, const void *, Elf_Internal_Dyn *);
extern void bfd_elf64_swap_dyn_out
- PARAMS ((bfd *, const Elf_Internal_Dyn *, PTR));
+ (bfd *, const Elf_Internal_Dyn *, void *);
extern long bfd_elf64_slurp_symbol_table
- PARAMS ((bfd *, asymbol **, boolean));
-extern boolean bfd_elf64_write_shdrs_and_ehdr
- PARAMS ((bfd *));
+ (bfd *, asymbol **, bfd_boolean);
+extern bfd_boolean bfd_elf64_write_shdrs_and_ehdr
+ (bfd *);
extern int bfd_elf64_write_out_phdrs
- PARAMS ((bfd *, const Elf_Internal_Phdr *, unsigned int));
+ (bfd *, const Elf_Internal_Phdr *, unsigned int);
extern void bfd_elf64_write_relocs
- PARAMS ((bfd *, asection *, PTR));
-extern boolean bfd_elf64_slurp_reloc_table
- PARAMS ((bfd *, asection *, asymbol **, boolean));
-extern boolean bfd_elf64_add_dynamic_entry
- PARAMS ((struct bfd_link_info *, bfd_vma, bfd_vma));
-extern boolean bfd_elf64_link_create_dynamic_sections
- PARAMS ((bfd *, struct bfd_link_info *));
-extern Elf_Internal_Rela *_bfd_elf64_link_read_relocs
- PARAMS ((bfd *, asection *, PTR, Elf_Internal_Rela *, boolean));
-
-#define bfd_elf32_link_record_dynamic_symbol \
- _bfd_elf_link_record_dynamic_symbol
-#define bfd_elf64_link_record_dynamic_symbol \
- _bfd_elf_link_record_dynamic_symbol
-
-extern int elf_link_record_local_dynamic_symbol
- PARAMS ((struct bfd_link_info *, bfd *, long));
-#define _bfd_elf32_link_record_local_dynamic_symbol \
- elf_link_record_local_dynamic_symbol
-#define _bfd_elf64_link_record_local_dynamic_symbol \
- elf_link_record_local_dynamic_symbol
-
-extern boolean _bfd_elf_close_and_cleanup
- PARAMS ((bfd *));
+ (bfd *, asection *, void *);
+extern bfd_boolean bfd_elf64_slurp_reloc_table
+ (bfd *, asection *, asymbol **, bfd_boolean);
+
+extern bfd_boolean bfd_elf_link_add_symbols
+ (bfd *, struct bfd_link_info *);
+extern bfd_boolean _bfd_elf_add_dynamic_entry
+ (struct bfd_link_info *, bfd_vma, bfd_vma);
+
+extern bfd_boolean bfd_elf_link_record_dynamic_symbol
+ (struct bfd_link_info *, struct elf_link_hash_entry *);
+
+extern int bfd_elf_link_record_local_dynamic_symbol
+ (struct bfd_link_info *, bfd *, long);
+
+extern bfd_boolean _bfd_elf_close_and_cleanup
+ (bfd *);
extern bfd_reloc_status_type _bfd_elf_rel_vtable_reloc_fn
- PARAMS ((bfd *, arelent *, struct symbol_cache_entry *, PTR,
- asection *, bfd *, char **));
-
-extern boolean _bfd_elf32_gc_sections
- PARAMS ((bfd *, struct bfd_link_info *));
-extern boolean _bfd_elf32_gc_common_finalize_got_offsets
- PARAMS ((bfd *, struct bfd_link_info *));
-extern boolean _bfd_elf32_gc_common_final_link
- PARAMS ((bfd *, struct bfd_link_info *));
-extern boolean _bfd_elf32_gc_record_vtinherit
- PARAMS ((bfd *, asection *, struct elf_link_hash_entry *, bfd_vma));
-extern boolean _bfd_elf32_gc_record_vtentry
- PARAMS ((bfd *, asection *, struct elf_link_hash_entry *, bfd_vma));
-
-extern boolean _bfd_elf64_gc_sections
- PARAMS ((bfd *, struct bfd_link_info *));
-extern boolean _bfd_elf64_gc_common_finalize_got_offsets
- PARAMS ((bfd *, struct bfd_link_info *));
-extern boolean _bfd_elf64_gc_common_final_link
- PARAMS ((bfd *, struct bfd_link_info *));
-extern boolean _bfd_elf64_gc_record_vtinherit
- PARAMS ((bfd *, asection *, struct elf_link_hash_entry *, bfd_vma));
-extern boolean _bfd_elf64_gc_record_vtentry
- PARAMS ((bfd *, asection *, struct elf_link_hash_entry *, bfd_vma));
-
-extern boolean _bfd_elf32_reloc_symbol_deleted_p
- PARAMS ((bfd_vma, PTR));
-extern boolean _bfd_elf64_reloc_symbol_deleted_p
- PARAMS ((bfd_vma, PTR));
+ (bfd *, arelent *, struct bfd_symbol *, void *,
+ asection *, bfd *, char **);
+
+extern bfd_boolean bfd_elf_final_link
+ (bfd *, struct bfd_link_info *);
+
+extern bfd_boolean bfd_elf_gc_sections
+ (bfd *, struct bfd_link_info *);
+
+extern bfd_boolean bfd_elf_gc_record_vtinherit
+ (bfd *, asection *, struct elf_link_hash_entry *, bfd_vma);
+
+extern bfd_boolean bfd_elf_gc_record_vtentry
+ (bfd *, asection *, struct elf_link_hash_entry *, bfd_vma);
+
+extern bfd_boolean bfd_elf_gc_common_finalize_got_offsets
+ (bfd *, struct bfd_link_info *);
+
+extern bfd_boolean bfd_elf_gc_common_final_link
+ (bfd *, struct bfd_link_info *);
+
+extern bfd_boolean bfd_elf_reloc_symbol_deleted_p
+ (bfd_vma, void *);
/* Exported interface for writing elf corefile notes. */
extern char *elfcore_write_note
- PARAMS ((bfd *, char *, int *, const char *, int, const PTR, int));
+ (bfd *, char *, int *, const char *, int, const void *, int);
extern char *elfcore_write_prpsinfo
- PARAMS ((bfd *, char *, int *, const char *, const char *));
+ (bfd *, char *, int *, const char *, const char *);
extern char *elfcore_write_prstatus
- PARAMS ((bfd *, char *, int *, long, int, const PTR));
+ (bfd *, char *, int *, long, int, const void *);
extern char * elfcore_write_pstatus
- PARAMS ((bfd *, char *, int *, long, int, const PTR));
+ (bfd *, char *, int *, long, int, const void *);
extern char *elfcore_write_prfpreg
- PARAMS ((bfd *, char *, int *, const PTR, int));
+ (bfd *, char *, int *, const void *, int);
extern char *elfcore_write_prxfpreg
- PARAMS ((bfd *, char *, int *, const PTR, int));
+ (bfd *, char *, int *, const void *, int);
extern char *elfcore_write_lwpstatus
- PARAMS ((bfd *, char *, int *, long, int, const PTR));
+ (bfd *, char *, int *, long, int, const void *);
+
+extern bfd *_bfd_elf32_bfd_from_remote_memory
+ (bfd *templ, bfd_vma ehdr_vma, bfd_vma *loadbasep,
+ int (*target_read_memory) (bfd_vma, char *, int));
+extern bfd *_bfd_elf64_bfd_from_remote_memory
+ (bfd *templ, bfd_vma ehdr_vma, bfd_vma *loadbasep,
+ int (*target_read_memory) (bfd_vma, char *, int));
/* SH ELF specific routine. */
-extern boolean _sh_elf_set_mach_from_flags
- PARAMS ((bfd *));
+extern bfd_boolean _sh_elf_set_mach_from_flags
+ (bfd *);
+
+/* This is the condition under which finish_dynamic_symbol will be called.
+ If our finish_dynamic_symbol isn't called, we'll need to do something
+ about initializing any .plt and .got entries in relocate_section. */
+#define WILL_CALL_FINISH_DYNAMIC_SYMBOL(DYN, SHARED, H) \
+ ((DYN) \
+ && ((SHARED) \
+ || ((H)->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0) \
+ && ((H)->dynindx != -1 \
+ || ((H)->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) != 0))
+
+/* This macro is to avoid lots of duplicated code in the body
+ of xxx_relocate_section() in the various elfxx-xxxx.c files. */
+#define RELOC_FOR_GLOBAL_SYMBOL(info, input_bfd, input_section, rel, \
+ r_symndx, symtab_hdr, sym_hashes, \
+ h, sec, relocation, \
+ unresolved_reloc, warned) \
+ do \
+ { \
+ /* It seems this can happen with erroneous or unsupported \
+ input (mixing a.out and elf in an archive, for example.) */ \
+ if (sym_hashes == NULL) \
+ return FALSE; \
+ \
+ h = sym_hashes[r_symndx - symtab_hdr->sh_info]; \
+ \
+ while (h->root.type == bfd_link_hash_indirect \
+ || h->root.type == bfd_link_hash_warning) \
+ h = (struct elf_link_hash_entry *) h->root.u.i.link; \
+ \
+ warned = FALSE; \
+ unresolved_reloc = FALSE; \
+ relocation = 0; \
+ if (h->root.type == bfd_link_hash_defined \
+ || h->root.type == bfd_link_hash_defweak) \
+ { \
+ sec = h->root.u.def.section; \
+ if (sec == NULL \
+ || sec->output_section == NULL) \
+ /* Set a flag that will be cleared later if we find a \
+ relocation value for this symbol. output_section \
+ is typically NULL for symbols satisfied by a shared \
+ library. */ \
+ unresolved_reloc = TRUE; \
+ else \
+ relocation = (h->root.u.def.value \
+ + sec->output_section->vma \
+ + sec->output_offset); \
+ } \
+ else if (h->root.type == bfd_link_hash_undefweak) \
+ ; \
+ else if (info->unresolved_syms_in_objects == RM_IGNORE \
+ && ELF_ST_VISIBILITY (h->other) == STV_DEFAULT) \
+ ; \
+ else \
+ { \
+ bfd_boolean err; \
+ err = (info->unresolved_syms_in_objects == RM_GENERATE_ERROR \
+ || ELF_ST_VISIBILITY (h->other) != STV_DEFAULT); \
+ if (!info->callbacks->undefined_symbol (info, \
+ h->root.root.string, \
+ input_bfd, \
+ input_section, \
+ rel->r_offset, err)) \
+ return FALSE; \
+ warned = TRUE; \
+ } \
+ } \
+ while (0)
#endif /* _LIBELF_H_ */
diff --git a/contrib/binutils/bfd/elf-eh-frame.c b/contrib/binutils/bfd/elf-eh-frame.c
index 62226c5..d3777b4 100644
--- a/contrib/binutils/bfd/elf-eh-frame.c
+++ b/contrib/binutils/bfd/elf-eh-frame.c
@@ -1,22 +1,22 @@
/* .eh_frame section optimization.
- Copyright 2001, 2002 Free Software Foundation, Inc.
+ Copyright 2001, 2002, 2003 Free Software Foundation, Inc.
Written by Jakub Jelinek <jakub@redhat.com>.
-This file is part of BFD, the Binary File Descriptor library.
+ This 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "bfd.h"
#include "sysdep.h"
@@ -26,129 +26,44 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#define EH_FRAME_HDR_SIZE 8
-struct cie_header
-{
- unsigned int length;
- unsigned int id;
-};
-
-struct cie
-{
- struct cie_header hdr;
- unsigned char version;
- unsigned char augmentation[20];
- unsigned int code_align;
- int data_align;
- unsigned int ra_column;
- unsigned int augmentation_size;
- struct elf_link_hash_entry *personality;
- unsigned char per_encoding;
- unsigned char lsda_encoding;
- unsigned char fde_encoding;
- unsigned char initial_insn_length;
- unsigned char make_relative;
- unsigned char make_lsda_relative;
- unsigned char initial_instructions[50];
-};
-
-struct eh_cie_fde
-{
- unsigned int offset;
- unsigned int size;
- asection *sec;
- unsigned int new_offset;
- unsigned char fde_encoding;
- unsigned char lsda_encoding;
- unsigned char lsda_offset;
- unsigned char cie : 1;
- unsigned char removed : 1;
- unsigned char make_relative : 1;
- unsigned char make_lsda_relative : 1;
- unsigned char per_encoding_relative : 1;
-};
-
-struct eh_frame_sec_info
-{
- unsigned int count;
- unsigned int alloced;
- struct eh_cie_fde entry[1];
-};
-
-struct eh_frame_array_ent
-{
- bfd_vma initial_loc;
- bfd_vma fde;
-};
-
-struct eh_frame_hdr_info
-{
- struct cie last_cie;
- asection *last_cie_sec;
- 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. */
- boolean table;
- boolean strip;
-};
-
-static bfd_vma read_unsigned_leb128
- PARAMS ((bfd *, char *, unsigned int *));
-static bfd_signed_vma read_signed_leb128
- PARAMS ((bfd *, char *, unsigned int *));
-static int get_DW_EH_PE_width
- PARAMS ((int, int));
-static bfd_vma read_value
- PARAMS ((bfd *, bfd_byte *, int));
-static void write_value
- PARAMS ((bfd *, bfd_byte *, bfd_vma, int));
-static int cie_compare
- PARAMS ((struct cie *, struct cie *));
-static int vma_compare
- PARAMS ((const PTR a, const PTR b));
-
/* Helper function for reading uleb128 encoded data. */
static bfd_vma
-read_unsigned_leb128 (abfd, buf, bytes_read_ptr)
- bfd *abfd ATTRIBUTE_UNUSED;
- char *buf;
- unsigned int *bytes_read_ptr;
+read_unsigned_leb128 (bfd *abfd ATTRIBUTE_UNUSED,
+ char *buf,
+ unsigned int *bytes_read_ptr)
{
- bfd_vma result;
- unsigned int num_read;
- int shift;
+ bfd_vma result;
+ unsigned int num_read;
+ int shift;
unsigned char byte;
- result = 0;
- shift = 0;
+ result = 0;
+ shift = 0;
num_read = 0;
do
{
byte = bfd_get_8 (abfd, (bfd_byte *) buf);
- buf ++;
- num_read ++;
+ buf++;
+ num_read++;
result |= (((bfd_vma) byte & 0x7f) << shift);
shift += 7;
}
while (byte & 0x80);
- * bytes_read_ptr = num_read;
+ *bytes_read_ptr = num_read;
return result;
}
/* Helper function for reading sleb128 encoded data. */
static bfd_signed_vma
-read_signed_leb128 (abfd, buf, bytes_read_ptr)
- bfd *abfd ATTRIBUTE_UNUSED;
- char *buf;
- unsigned int * bytes_read_ptr;
+read_signed_leb128 (bfd *abfd ATTRIBUTE_UNUSED,
+ char *buf,
+ unsigned int * bytes_read_ptr)
{
- bfd_vma result;
- int shift;
- int num_read;
+ bfd_vma result;
+ int shift;
+ int num_read;
unsigned char byte;
result = 0;
@@ -165,7 +80,7 @@ read_signed_leb128 (abfd, buf, bytes_read_ptr)
while (byte & 0x80);
if (byte & 0x40)
result |= (((bfd_vma) -1) << (shift - 7)) << 7;
- * bytes_read_ptr = num_read;
+ *bytes_read_ptr = num_read;
return result;
}
@@ -188,8 +103,7 @@ while (0)
/* Return 0 if either encoding is variable width, or not yet known to bfd. */
static
-int get_DW_EH_PE_width (encoding, ptr_size)
- int encoding, ptr_size;
+int get_DW_EH_PE_width (int encoding, int ptr_size)
{
/* DW_EH_PE_ values of 0x60 and 0x70 weren't defined at the time .eh_frame
was added to bfd. */
@@ -209,35 +123,47 @@ int get_DW_EH_PE_width (encoding, ptr_size)
return 0;
}
+#define get_DW_EH_PE_signed(encoding) (((encoding) & DW_EH_PE_signed) != 0)
+
/* Read a width sized value from memory. */
static bfd_vma
-read_value (abfd, buf, width)
- bfd *abfd;
- bfd_byte *buf;
- int width;
+read_value (bfd *abfd, bfd_byte *buf, int width, int is_signed)
{
bfd_vma value;
switch (width)
{
- case 2: value = bfd_get_16 (abfd, buf); break;
- case 4: value = bfd_get_32 (abfd, buf); break;
- case 8: value = bfd_get_64 (abfd, buf); break;
- default: BFD_FAIL (); return 0;
+ case 2:
+ if (is_signed)
+ value = bfd_get_signed_16 (abfd, buf);
+ else
+ value = bfd_get_16 (abfd, buf);
+ break;
+ case 4:
+ if (is_signed)
+ value = bfd_get_signed_32 (abfd, buf);
+ else
+ value = bfd_get_32 (abfd, buf);
+ break;
+ case 8:
+ if (is_signed)
+ value = bfd_get_signed_64 (abfd, buf);
+ else
+ value = bfd_get_64 (abfd, buf);
+ break;
+ default:
+ BFD_FAIL ();
+ return 0;
}
return value;
}
-
+
/* Store a width sized value to memory. */
static void
-write_value (abfd, buf, value, width)
- bfd *abfd;
- bfd_byte *buf;
- bfd_vma value;
- int width;
+write_value (bfd *abfd, bfd_byte *buf, bfd_vma value, int width)
{
switch (width)
{
@@ -251,8 +177,7 @@ write_value (abfd, buf, value, width)
/* Return zero if C1 and C2 CIEs can be merged. */
static
-int cie_compare (c1, c2)
- struct cie *c1, *c2;
+int cie_compare (struct cie *c1, struct cie *c2)
{
if (c1->hdr.length == c2->hdr.length
&& c1->version == c2->version
@@ -266,8 +191,7 @@ int cie_compare (c1, c2)
&& c1->per_encoding == c2->per_encoding
&& c1->lsda_encoding == c2->lsda_encoding
&& c1->fde_encoding == c2->fde_encoding
- && (c1->initial_insn_length
- == c2->initial_insn_length)
+ && c1->initial_insn_length == c2->initial_insn_length
&& memcmp (c1->initial_instructions,
c2->initial_instructions,
c1->initial_insn_length) == 0)
@@ -278,35 +202,32 @@ int cie_compare (c1, c2)
/* This function is called for each input file before the .eh_frame
section is relocated. It discards duplicate CIEs and FDEs for discarded
- functions. The function returns true iff any entries have been
+ functions. The function returns TRUE iff any entries have been
deleted. */
-boolean
-_bfd_elf_discard_section_eh_frame (abfd, info, sec, ehdrsec,
- reloc_symbol_deleted_p, cookie)
- bfd *abfd;
- struct bfd_link_info *info;
- asection *sec, *ehdrsec;
- boolean (*reloc_symbol_deleted_p) (bfd_vma, PTR);
- struct elf_reloc_cookie *cookie;
+bfd_boolean
+_bfd_elf_discard_section_eh_frame
+ (bfd *abfd, struct bfd_link_info *info, asection *sec,
+ bfd_boolean (*reloc_symbol_deleted_p) (bfd_vma, void *),
+ struct elf_reloc_cookie *cookie)
{
bfd_byte *ehbuf = NULL, *buf;
bfd_byte *last_cie, *last_fde;
struct cie_header hdr;
struct cie cie;
+ struct elf_link_hash_table *htab;
struct eh_frame_hdr_info *hdr_info;
struct eh_frame_sec_info *sec_info = NULL;
unsigned int leb128_tmp;
unsigned int cie_usage_count, last_cie_ndx, i, offset;
unsigned int make_relative, make_lsda_relative;
- Elf_Internal_Rela *rel;
bfd_size_type new_size;
unsigned int ptr_size;
if (sec->_raw_size == 0)
{
/* This file does not contain .eh_frame information. */
- return false;
+ return FALSE;
}
if ((sec->output_section != NULL
@@ -314,22 +235,19 @@ _bfd_elf_discard_section_eh_frame (abfd, info, sec, ehdrsec,
{
/* At least one of the sections is being discarded from the
link, so we should just ignore them. */
- return false;
+ return FALSE;
}
- BFD_ASSERT (elf_section_data (ehdrsec)->sec_info_type
- == ELF_INFO_TYPE_EH_FRAME_HDR);
- hdr_info = (struct eh_frame_hdr_info *)
- elf_section_data (ehdrsec)->sec_info;
+ htab = elf_hash_table (info);
+ hdr_info = &htab->eh_info;
/* Read the frame unwind information from abfd. */
- ehbuf = (bfd_byte *) bfd_malloc (sec->_raw_size);
+ ehbuf = bfd_malloc (sec->_raw_size);
if (ehbuf == NULL)
goto free_no_table;
- if (! bfd_get_section_contents (abfd, sec, ehbuf, (bfd_vma) 0,
- sec->_raw_size))
+ if (! bfd_get_section_contents (abfd, sec, ehbuf, 0, sec->_raw_size))
goto free_no_table;
if (sec->_raw_size >= 4
@@ -338,7 +256,7 @@ _bfd_elf_discard_section_eh_frame (abfd, info, sec, ehdrsec,
{
/* Empty .eh_frame section. */
free (ehbuf);
- return false;
+ return FALSE;
}
/* If .eh_frame section size doesn't fit into int, we cannot handle
@@ -365,7 +283,8 @@ _bfd_elf_discard_section_eh_frame (abfd, info, sec, ehdrsec,
#define ENSURE_NO_RELOCS(buf) \
if (cookie->rel < cookie->relend \
&& (cookie->rel->r_offset \
- < (bfd_size_type) ((buf) - ehbuf))) \
+ < (bfd_size_type) ((buf) - ehbuf)) \
+ && cookie->rel->r_info != 0) \
goto free_no_table
#define SKIP_RELOCS(buf) \
@@ -448,11 +367,15 @@ _bfd_elf_discard_section_eh_frame (abfd, info, sec, ehdrsec,
/* CIE */
if (last_cie != NULL)
{
- /* Now check if this CIE is identical to 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
- that. */
- if (cie_compare (&cie, &hdr_info->last_cie) == 0
+ /* 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;
@@ -506,6 +429,11 @@ _bfd_elf_discard_section_eh_frame (abfd, info, sec, ehdrsec,
}
read_uleb128 (cie.code_align, buf);
read_sleb128 (cie.data_align, buf);
+ /* Note - in DWARF2 the return address column is an unsigned byte.
+ In DWARF3 it is a ULEB128. We are following DWARF3. For most
+ ports this will not matter as the value will be less than 128.
+ For the others (eg FRV, SH, MMIX, IA64) they need a fixed GCC
+ which conforms to the DWARF3 standard. */
read_uleb128 (cie.ra_column, buf);
ENSURE_NO_RELOCS (buf);
cie.lsda_encoding = DW_EH_PE_omit;
@@ -550,10 +478,9 @@ _bfd_elf_discard_section_eh_frame (abfd, info, sec, ehdrsec,
+ ((buf - ehbuf + per_width - 1)
& ~((bfd_size_type) per_width - 1)));
ENSURE_NO_RELOCS (buf);
- rel = GET_RELOC (buf);
/* Ensure we have a reloc here, against
a global symbol. */
- if (rel != NULL)
+ if (GET_RELOC (buf) != NULL)
{
unsigned long r_symndx;
@@ -591,10 +518,16 @@ _bfd_elf_discard_section_eh_frame (abfd, info, sec, ehdrsec,
/* For shared libraries, try to get rid of as many RELATIVE relocs
as possible. */
if (info->shared
+ && (get_elf_backend_data (abfd)
+ ->elf_backend_can_make_relative_eh_frame
+ (abfd, info, sec))
&& (cie.fde_encoding & 0xf0) == DW_EH_PE_absptr)
cie.make_relative = 1;
if (info->shared
+ && (get_elf_backend_data (abfd)
+ ->elf_backend_can_make_lsda_relative_eh_frame
+ (abfd, info, sec))
&& (cie.lsda_encoding & 0xf0) == DW_EH_PE_absptr)
cie.make_lsda_relative = 1;
@@ -621,17 +554,15 @@ _bfd_elf_discard_section_eh_frame (abfd, info, sec, ehdrsec,
goto free_no_table;
ENSURE_NO_RELOCS (buf);
- rel = GET_RELOC (buf);
- if (rel == NULL)
+ if (GET_RELOC (buf) == NULL)
/* This should not happen. */
goto free_no_table;
if ((*reloc_symbol_deleted_p) (buf - ehbuf, cookie))
{
- /* This is a FDE against discarded section, it should
+ /* 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;
- memset (rel, 0, sizeof (*rel));
}
else
{
@@ -640,16 +571,15 @@ _bfd_elf_discard_section_eh_frame (abfd, info, sec, ehdrsec,
&& cie.make_relative == 0)
|| (cie.fde_encoding & 0xf0) == DW_EH_PE_aligned))
{
- /* If shared library uses absolute pointers
+ /* 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;
+ hdr_info->table = FALSE;
}
cie_usage_count++;
hdr_info->fde_count++;
}
- cookie->rel = rel;
if (cie.lsda_encoding != DW_EH_PE_omit)
{
unsigned int dummy;
@@ -672,7 +602,7 @@ _bfd_elf_discard_section_eh_frame (abfd, info, sec, ehdrsec,
}
elf_section_data (sec)->sec_info = sec_info;
- elf_section_data (sec)->sec_info_type = ELF_INFO_TYPE_EH_FRAME;
+ sec->sec_info_type = ELF_INFO_TYPE_EH_FRAME;
/* Ok, now we can assign new offsets. */
offset = 0;
@@ -730,47 +660,36 @@ free_no_table:
free (ehbuf);
if (sec_info)
free (sec_info);
- hdr_info->table = false;
+ hdr_info->table = FALSE;
hdr_info->last_cie.hdr.length = 0;
- return false;
+ return FALSE;
}
/* This function is called for .eh_frame_hdr section after
_bfd_elf_discard_section_eh_frame has been called on all .eh_frame
input sections. It finalizes the size of .eh_frame_hdr section. */
-boolean
-_bfd_elf_discard_section_eh_frame_hdr (abfd, info, sec)
- bfd *abfd;
- struct bfd_link_info *info;
- asection *sec;
+bfd_boolean
+_bfd_elf_discard_section_eh_frame_hdr (bfd *abfd, struct bfd_link_info *info)
{
+ struct elf_link_hash_table *htab;
struct eh_frame_hdr_info *hdr_info;
- unsigned int ptr_size;
-
- ptr_size = (elf_elfheader (abfd)->e_ident[EI_CLASS]
- == ELFCLASS64) ? 8 : 4;
+ asection *sec;
- if ((elf_section_data (sec)->sec_info_type
- != ELF_INFO_TYPE_EH_FRAME_HDR)
- || ! info->eh_frame_hdr)
- {
- _bfd_strip_section_from_output (info, sec);
- return false;
- }
+ htab = elf_hash_table (info);
+ hdr_info = &htab->eh_info;
+ sec = hdr_info->hdr_sec;
+ if (sec == NULL)
+ return FALSE;
- hdr_info = (struct eh_frame_hdr_info *)
- elf_section_data (sec)->sec_info;
- if (hdr_info->strip)
- return false;
sec->_cooked_size = EH_FRAME_HDR_SIZE;
if (hdr_info->table)
sec->_cooked_size += 4 + hdr_info->fde_count * 8;
/* Request program headers to be recalculated. */
elf_tdata (abfd)->program_header_size = 0;
- elf_tdata (abfd)->eh_frame_hdr = true;
- return true;
+ elf_tdata (abfd)->eh_frame_hdr = sec;
+ return TRUE;
}
/* This function is called from size_dynamic_sections.
@@ -778,25 +697,24 @@ _bfd_elf_discard_section_eh_frame_hdr (abfd, info, sec)
because later on it is too late for calling _bfd_strip_section_from_output,
since dynamic symbol table has been sized. */
-boolean
-_bfd_elf_maybe_strip_eh_frame_hdr (info)
- struct bfd_link_info *info;
+bfd_boolean
+_bfd_elf_maybe_strip_eh_frame_hdr (struct bfd_link_info *info)
{
- asection *sec, *o;
+ asection *o;
bfd *abfd;
+ struct elf_link_hash_table *htab;
struct eh_frame_hdr_info *hdr_info;
- sec = bfd_get_section_by_name (elf_hash_table (info)->dynobj, ".eh_frame_hdr");
- if (sec == NULL || bfd_is_abs_section (sec->output_section))
- return true;
-
- hdr_info
- = bfd_zmalloc (sizeof (struct eh_frame_hdr_info));
- if (hdr_info == NULL)
- return false;
+ htab = elf_hash_table (info);
+ hdr_info = &htab->eh_info;
+ if (hdr_info->hdr_sec == NULL)
+ return TRUE;
- elf_section_data (sec)->sec_info = hdr_info;
- elf_section_data (sec)->sec_info_type = ELF_INFO_TYPE_EH_FRAME_HDR;
+ if (bfd_is_abs_section (hdr_info->hdr_sec->output_section))
+ {
+ hdr_info->hdr_sec = NULL;
+ return TRUE;
+ }
abfd = NULL;
if (info->eh_frame_hdr)
@@ -811,12 +729,13 @@ _bfd_elf_maybe_strip_eh_frame_hdr (info)
if (abfd == NULL)
{
- _bfd_strip_section_from_output (info, sec);
- hdr_info->strip = true;
+ _bfd_strip_section_from_output (info, hdr_info->hdr_sec);
+ hdr_info->hdr_sec = NULL;
+ return TRUE;
}
- else
- hdr_info->table = true;
- return true;
+
+ hdr_info->table = TRUE;
+ return TRUE;
}
/* Adjust an address in the .eh_frame section. Given OFFSET within
@@ -825,18 +744,16 @@ _bfd_elf_maybe_strip_eh_frame_hdr (info)
or to offset with dynamic relocation which is no longer needed. */
bfd_vma
-_bfd_elf_eh_frame_section_offset (output_bfd, sec, offset)
- bfd *output_bfd ATTRIBUTE_UNUSED;
- asection *sec;
- bfd_vma offset;
+_bfd_elf_eh_frame_section_offset (bfd *output_bfd ATTRIBUTE_UNUSED,
+ asection *sec,
+ bfd_vma offset)
{
struct eh_frame_sec_info *sec_info;
unsigned int lo, hi, mid;
- if (elf_section_data (sec)->sec_info_type != ELF_INFO_TYPE_EH_FRAME)
+ if (sec->sec_info_type != ELF_INFO_TYPE_EH_FRAME)
return offset;
- sec_info = (struct eh_frame_sec_info *)
- elf_section_data (sec)->sec_info;
+ sec_info = elf_section_data (sec)->sec_info;
if (offset >= sec->_raw_size)
return offset - (sec->_cooked_size - sec->_raw_size);
@@ -873,9 +790,8 @@ _bfd_elf_eh_frame_section_offset (output_bfd, sec, offset)
for run-time relocation against LSDA field. */
if (sec_info->entry[mid].make_lsda_relative
&& ! sec_info->entry[mid].cie
- && (offset
- == (sec_info->entry[mid].offset + 8
- + sec_info->entry[mid].lsda_offset)))
+ && (offset == (sec_info->entry[mid].offset + 8
+ + sec_info->entry[mid].lsda_offset)))
return (bfd_vma) -2;
return (offset + sec_info->entry[mid].new_offset
@@ -885,13 +801,14 @@ _bfd_elf_eh_frame_section_offset (output_bfd, sec, offset)
/* Write out .eh_frame section. This is called with the relocated
contents. */
-boolean
-_bfd_elf_write_section_eh_frame (abfd, sec, ehdrsec, contents)
- bfd *abfd;
- asection *sec, *ehdrsec;
- bfd_byte *contents;
+bfd_boolean
+_bfd_elf_write_section_eh_frame (bfd *abfd,
+ struct bfd_link_info *info,
+ asection *sec,
+ bfd_byte *contents)
{
struct eh_frame_sec_info *sec_info;
+ struct elf_link_hash_table *htab;
struct eh_frame_hdr_info *hdr_info;
unsigned int i;
bfd_byte *p, *buf;
@@ -902,26 +819,17 @@ _bfd_elf_write_section_eh_frame (abfd, sec, ehdrsec, contents)
ptr_size = (elf_elfheader (sec->owner)->e_ident[EI_CLASS]
== ELFCLASS64) ? 8 : 4;
- if (elf_section_data (sec)->sec_info_type != ELF_INFO_TYPE_EH_FRAME)
- return bfd_set_section_contents (abfd, sec->output_section,
- contents,
- (file_ptr) sec->output_offset,
- sec->_raw_size);
- sec_info = (struct eh_frame_sec_info *)
- elf_section_data (sec)->sec_info;
- hdr_info = NULL;
- if (ehdrsec
- && (elf_section_data (ehdrsec)->sec_info_type
- == ELF_INFO_TYPE_EH_FRAME_HDR))
- {
- hdr_info = (struct eh_frame_hdr_info *)
- elf_section_data (ehdrsec)->sec_info;
- if (hdr_info->table && hdr_info->array == NULL)
- hdr_info->array
- = bfd_malloc (hdr_info->fde_count * sizeof(*hdr_info->array));
- if (hdr_info->array == NULL)
- hdr_info = NULL;
- }
+ if (sec->sec_info_type != ELF_INFO_TYPE_EH_FRAME)
+ return bfd_set_section_contents (abfd, sec->output_section, contents,
+ sec->output_offset, sec->_raw_size);
+ sec_info = elf_section_data (sec)->sec_info;
+ htab = elf_hash_table (info);
+ hdr_info = &htab->eh_info;
+ if (hdr_info->table && hdr_info->array == NULL)
+ hdr_info->array
+ = bfd_malloc (hdr_info->fde_count * sizeof(*hdr_info->array));
+ if (hdr_info->array == NULL)
+ hdr_info = NULL;
p = contents;
for (i = 0; i < sec_info->count; ++i)
@@ -1005,7 +913,9 @@ _bfd_elf_write_section_eh_frame (abfd, sec, ehdrsec, contents)
{
bfd_vma value;
- value = read_value (abfd, buf, per_width);
+ 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);
@@ -1034,14 +944,16 @@ _bfd_elf_write_section_eh_frame (abfd, sec, ehdrsec, contents)
unsigned int width;
buf = contents + sec_info->entry[i].offset;
- /* Skip length. */
+ /* Skip length. */
buf += 4;
bfd_put_32 (abfd,
sec_info->entry[i].new_offset + 4 - cie_offset, buf);
buf += 4;
width = get_DW_EH_PE_width (sec_info->entry[i].fde_encoding,
ptr_size);
- address = value = read_value (abfd, buf, width);
+ address = value = read_value (abfd, buf, width,
+ get_DW_EH_PE_signed
+ (sec_info->entry[i].fde_encoding));
if (value)
{
switch (sec_info->entry[i].fde_encoding & 0xf0)
@@ -1085,7 +997,9 @@ _bfd_elf_write_section_eh_frame (abfd, sec, ehdrsec, contents)
buf += sec_info->entry[i].lsda_offset;
width = get_DW_EH_PE_width (sec_info->entry[i].lsda_encoding,
ptr_size);
- value = read_value (abfd, buf, width);
+ value = read_value (abfd, buf, width,
+ get_DW_EH_PE_signed
+ (sec_info->entry[i].lsda_encoding));
if (value)
{
if ((sec_info->entry[i].lsda_encoding & 0xf0)
@@ -1121,6 +1035,42 @@ _bfd_elf_write_section_eh_frame (abfd, sec, ehdrsec, contents)
and 3xDW_CFA_nop as pad */
p += 16;
}
+ else
+ {
+ unsigned int alignment = 1 << sec->alignment_power;
+ unsigned int pad = sec->_cooked_size % alignment;
+
+ /* Don't pad beyond the raw size of the output section. It
+ can happen at the last input section. */
+ if (pad
+ && ((sec->output_offset + sec->_cooked_size + pad)
+ <= sec->output_section->_raw_size))
+ {
+ /* Find the last CIE/FDE. */
+ for (i = sec_info->count - 1; i > 0; i--)
+ if (! sec_info->entry[i].removed)
+ break;
+
+ /* The size of the last CIE/FDE must be at least 4. */
+ if (sec_info->entry[i].removed
+ || sec_info->entry[i].size < 4)
+ abort ();
+
+ pad = alignment - pad;
+
+ buf = contents + sec_info->entry[i].new_offset;
+
+ /* Update length. */
+ sec_info->entry[i].size += pad;
+ bfd_put_32 (abfd, sec_info->entry[i].size - 4, buf);
+
+ /* Pad it with DW_CFA_nop */
+ memset (p, 0, pad);
+ p += pad;
+
+ sec->_cooked_size += pad;
+ }
+ }
BFD_ASSERT ((bfd_size_type) (p - contents) == sec->_cooked_size);
@@ -1133,12 +1083,10 @@ _bfd_elf_write_section_eh_frame (abfd, sec, ehdrsec, contents)
VMA of FDE initial location. */
static int
-vma_compare (a, b)
- const PTR a;
- const PTR b;
+vma_compare (const void *a, const void *b)
{
- struct eh_frame_array_ent *p = (struct eh_frame_array_ent *) a;
- struct eh_frame_array_ent *q = (struct eh_frame_array_ent *) b;
+ const struct eh_frame_array_ent *p = a;
+ const struct eh_frame_array_ent *q = b;
if (p->initial_loc > q->initial_loc)
return 1;
if (p->initial_loc < q->initial_loc)
@@ -1166,55 +1114,58 @@ vma_compare (a, b)
fde_count x [encoded] initial_loc, fde
(array of encoded pairs containing
FDE initial_location field and FDE address,
- sorted by increasing initial_loc) */
+ sorted by increasing initial_loc). */
-boolean
-_bfd_elf_write_section_eh_frame_hdr (abfd, sec)
- bfd *abfd;
- asection *sec;
+bfd_boolean
+_bfd_elf_write_section_eh_frame_hdr (bfd *abfd, struct bfd_link_info *info)
{
+ struct elf_link_hash_table *htab;
struct eh_frame_hdr_info *hdr_info;
- unsigned int ptr_size;
+ asection *sec;
bfd_byte *contents;
asection *eh_frame_sec;
bfd_size_type size;
+ bfd_boolean retval;
+ bfd_vma encoded_eh_frame;
- ptr_size = (elf_elfheader (sec->owner)->e_ident[EI_CLASS]
- == ELFCLASS64) ? 8 : 4;
-
- BFD_ASSERT (elf_section_data (sec)->sec_info_type
- == ELF_INFO_TYPE_EH_FRAME_HDR);
- hdr_info = (struct eh_frame_hdr_info *)
- elf_section_data (sec)->sec_info;
- if (hdr_info->strip)
- return true;
+ htab = elf_hash_table (info);
+ hdr_info = &htab->eh_info;
+ sec = hdr_info->hdr_sec;
+ if (sec == NULL)
+ return TRUE;
size = EH_FRAME_HDR_SIZE;
if (hdr_info->array && hdr_info->array_count == hdr_info->fde_count)
size += 4 + hdr_info->fde_count * 8;
contents = bfd_malloc (size);
if (contents == NULL)
- return false;
+ return FALSE;
eh_frame_sec = bfd_get_section_by_name (abfd, ".eh_frame");
if (eh_frame_sec == NULL)
- return false;
+ {
+ free (contents);
+ return FALSE;
+ }
memset (contents, 0, EH_FRAME_HDR_SIZE);
- contents[0] = 1; /* Version */
- contents[1] = DW_EH_PE_pcrel | DW_EH_PE_sdata4; /* .eh_frame offset */
+ contents[0] = 1; /* Version. */
+ contents[1] = get_elf_backend_data (abfd)->elf_backend_encode_eh_address
+ (abfd, info, eh_frame_sec, 0, sec, 4,
+ &encoded_eh_frame); /* .eh_frame offset. */
+
if (hdr_info->array && hdr_info->array_count == hdr_info->fde_count)
{
- contents[2] = DW_EH_PE_udata4; /* FDE count encoding */
- contents[3] = DW_EH_PE_datarel | DW_EH_PE_sdata4; /* search table enc */
+ contents[2] = DW_EH_PE_udata4; /* FDE count encoding. */
+ contents[3] = DW_EH_PE_datarel | DW_EH_PE_sdata4; /* Search table enc. */
}
else
{
contents[2] = DW_EH_PE_omit;
contents[3] = DW_EH_PE_omit;
}
- bfd_put_32 (abfd, eh_frame_sec->vma - sec->output_section->vma - 4,
- contents + 4);
+ bfd_put_32 (abfd, encoded_eh_frame, contents + 4);
+
if (contents[2] != DW_EH_PE_omit)
{
unsigned int i;
@@ -1234,7 +1185,35 @@ _bfd_elf_write_section_eh_frame_hdr (abfd, sec)
}
}
- return bfd_set_section_contents (abfd, sec->output_section,
- contents, (file_ptr) sec->output_offset,
- sec->_cooked_size);
+ retval = bfd_set_section_contents (abfd, sec->output_section,
+ contents, (file_ptr) sec->output_offset,
+ sec->_cooked_size);
+ free (contents);
+ return retval;
+}
+
+/* Decide whether we can use a PC-relative encoding within the given
+ EH frame section. This is the default implementation. */
+
+bfd_boolean
+_bfd_elf_can_make_relative (bfd *input_bfd ATTRIBUTE_UNUSED,
+ struct bfd_link_info *info ATTRIBUTE_UNUSED,
+ asection *eh_frame_section ATTRIBUTE_UNUSED)
+{
+ return TRUE;
+}
+
+/* Select an encoding for the given address. Preference is given to
+ PC-relative addressing modes. */
+
+bfd_byte
+_bfd_elf_encode_eh_address (bfd *abfd ATTRIBUTE_UNUSED,
+ struct bfd_link_info *info ATTRIBUTE_UNUSED,
+ asection *osec, bfd_vma offset,
+ asection *loc_sec, bfd_vma loc_offset,
+ bfd_vma *encoded)
+{
+ *encoded = osec->vma + offset -
+ (loc_sec->output_section->vma + loc_sec->output_offset + loc_offset);
+ return DW_EH_PE_pcrel | DW_EH_PE_sdata4;
}
diff --git a/contrib/binutils/bfd/elf-strtab.c b/contrib/binutils/bfd/elf-strtab.c
index 7a993c2..673b9d7 100644
--- a/contrib/binutils/bfd/elf-strtab.c
+++ b/contrib/binutils/bfd/elf-strtab.c
@@ -1,5 +1,5 @@
/* ELF strtab with GC and suffix merging support.
- Copyright 2001, 2002 Free Software Foundation, Inc.
+ Copyright 2001, 2002, 2003 Free Software Foundation, Inc.
Written by Jakub Jelinek <jakub@redhat.com>.
This file is part of BFD, the Binary File Descriptor library.
@@ -30,15 +30,14 @@
struct elf_strtab_hash_entry
{
struct bfd_hash_entry root;
- /* Length of this entry. */
- unsigned int len;
+ /* Length of this entry. This includes the zero terminator. */
+ int len;
unsigned int refcount;
union {
/* Index within the merged section. */
bfd_size_type index;
- /* Entry this is a suffix of (if len is 0). */
+ /* Entry this is a suffix of (if len < 0). */
struct elf_strtab_hash_entry *suffix;
- struct elf_strtab_hash_entry *next;
} u;
};
@@ -57,53 +56,46 @@ struct elf_strtab_hash
struct elf_strtab_hash_entry **array;
};
-static struct bfd_hash_entry *elf_strtab_hash_newfunc
- PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, const char *));
-static int cmplengthentry PARAMS ((const PTR, const PTR));
-static int last4_eq PARAMS ((const PTR, const PTR));
-
/* Routine to create an entry in a section merge hashtab. */
static struct bfd_hash_entry *
-elf_strtab_hash_newfunc (entry, table, string)
- struct bfd_hash_entry *entry;
- struct bfd_hash_table *table;
- const char *string;
+elf_strtab_hash_newfunc (struct bfd_hash_entry *entry,
+ struct bfd_hash_table *table,
+ const char *string)
{
- struct elf_strtab_hash_entry *ret = (struct elf_strtab_hash_entry *) entry;
-
/* Allocate the structure if it has not already been allocated by a
subclass. */
- if (ret == (struct elf_strtab_hash_entry *) NULL)
- ret = ((struct elf_strtab_hash_entry *)
- bfd_hash_allocate (table, sizeof (struct elf_strtab_hash_entry)));
- if (ret == (struct elf_strtab_hash_entry *) NULL)
+ if (entry == NULL)
+ entry = bfd_hash_allocate (table, sizeof (struct elf_strtab_hash_entry));
+ if (entry == NULL)
return NULL;
/* Call the allocation method of the superclass. */
- ret = ((struct elf_strtab_hash_entry *)
- bfd_hash_newfunc ((struct bfd_hash_entry *) ret, table, string));
+ entry = bfd_hash_newfunc (entry, table, string);
- if (ret)
+ if (entry)
{
/* Initialize the local fields. */
+ struct elf_strtab_hash_entry *ret;
+
+ ret = (struct elf_strtab_hash_entry *) entry;
ret->u.index = -1;
ret->refcount = 0;
ret->len = 0;
}
- return (struct bfd_hash_entry *)ret;
+ return entry;
}
/* Create a new hash table. */
struct elf_strtab_hash *
-_bfd_elf_strtab_init ()
+_bfd_elf_strtab_init (void)
{
struct elf_strtab_hash *table;
bfd_size_type amt = sizeof (struct elf_strtab_hash);
- table = (struct elf_strtab_hash *) bfd_malloc (amt);
+ table = bfd_malloc (amt);
if (table == NULL)
return NULL;
@@ -117,8 +109,7 @@ _bfd_elf_strtab_init ()
table->size = 1;
table->alloced = 64;
amt = sizeof (struct elf_strtab_hasn_entry *);
- table->array = (struct elf_strtab_hash_entry **)
- bfd_malloc (table->alloced * amt);
+ table->array = bfd_malloc (table->alloced * amt);
if (table->array == NULL)
{
free (table);
@@ -133,8 +124,7 @@ _bfd_elf_strtab_init ()
/* Free a strtab. */
void
-_bfd_elf_strtab_free (tab)
- struct elf_strtab_hash *tab;
+_bfd_elf_strtab_free (struct elf_strtab_hash *tab)
{
bfd_hash_table_free (&tab->table);
free (tab->array);
@@ -145,10 +135,9 @@ _bfd_elf_strtab_free (tab)
already present. */
bfd_size_type
-_bfd_elf_strtab_add (tab, str, copy)
- struct elf_strtab_hash *tab;
- const char *str;
- boolean copy;
+_bfd_elf_strtab_add (struct elf_strtab_hash *tab,
+ const char *str,
+ bfd_boolean copy)
{
register struct elf_strtab_hash_entry *entry;
@@ -159,7 +148,7 @@ _bfd_elf_strtab_add (tab, str, copy)
BFD_ASSERT (tab->sec_size == 0);
entry = (struct elf_strtab_hash_entry *)
- bfd_hash_lookup (&tab->table, str, true, copy);
+ bfd_hash_lookup (&tab->table, str, TRUE, copy);
if (entry == NULL)
return (bfd_size_type) -1;
@@ -168,12 +157,13 @@ _bfd_elf_strtab_add (tab, str, copy)
if (entry->len == 0)
{
entry->len = strlen (str) + 1;
+ /* 2G strings lose. */
+ BFD_ASSERT (entry->len > 0);
if (tab->size == tab->alloced)
{
bfd_size_type amt = sizeof (struct elf_strtab_hash_entry *);
tab->alloced *= 2;
- tab->array = (struct elf_strtab_hash_entry **)
- bfd_realloc (tab->array, tab->alloced * amt);
+ tab->array = bfd_realloc (tab->array, tab->alloced * amt);
if (tab->array == NULL)
return (bfd_size_type) -1;
}
@@ -185,9 +175,7 @@ _bfd_elf_strtab_add (tab, str, copy)
}
void
-_bfd_elf_strtab_addref (tab, idx)
- struct elf_strtab_hash *tab;
- bfd_size_type idx;
+_bfd_elf_strtab_addref (struct elf_strtab_hash *tab, bfd_size_type idx)
{
if (idx == 0 || idx == (bfd_size_type) -1)
return;
@@ -197,9 +185,7 @@ _bfd_elf_strtab_addref (tab, idx)
}
void
-_bfd_elf_strtab_delref (tab, idx)
- struct elf_strtab_hash *tab;
- bfd_size_type idx;
+_bfd_elf_strtab_delref (struct elf_strtab_hash *tab, bfd_size_type idx)
{
if (idx == 0 || idx == (bfd_size_type) -1)
return;
@@ -210,8 +196,7 @@ _bfd_elf_strtab_delref (tab, idx)
}
void
-_bfd_elf_strtab_clear_all_refs (tab)
- struct elf_strtab_hash *tab;
+_bfd_elf_strtab_clear_all_refs (struct elf_strtab_hash *tab)
{
bfd_size_type idx;
@@ -220,16 +205,13 @@ _bfd_elf_strtab_clear_all_refs (tab)
}
bfd_size_type
-_bfd_elf_strtab_size (tab)
- struct elf_strtab_hash *tab;
+_bfd_elf_strtab_size (struct elf_strtab_hash *tab)
{
return tab->sec_size ? tab->sec_size : tab->size;
}
bfd_size_type
-_bfd_elf_strtab_offset (tab, idx)
- struct elf_strtab_hash *tab;
- bfd_size_type idx;
+_bfd_elf_strtab_offset (struct elf_strtab_hash *tab, bfd_size_type idx)
{
struct elf_strtab_hash_entry *entry;
@@ -243,88 +225,80 @@ _bfd_elf_strtab_offset (tab, idx)
return tab->array[idx]->u.index;
}
-boolean
-_bfd_elf_strtab_emit (abfd, tab)
- register bfd *abfd;
- struct elf_strtab_hash *tab;
+bfd_boolean
+_bfd_elf_strtab_emit (register bfd *abfd, struct elf_strtab_hash *tab)
{
bfd_size_type off = 1, i;
if (bfd_bwrite ("", 1, abfd) != 1)
- return false;
+ return FALSE;
for (i = 1; i < tab->size; ++i)
{
register const char *str;
- register size_t len;
+ register unsigned int len;
- str = tab->array[i]->root.string;
- len = tab->array[i]->len;
BFD_ASSERT (tab->array[i]->refcount == 0);
- if (len == 0)
+ len = tab->array[i]->len;
+ if ((int) len < 0)
continue;
- if (bfd_bwrite ((PTR) str, (bfd_size_type) len, abfd) != len)
- return false;
+ str = tab->array[i]->root.string;
+ if (bfd_bwrite (str, len, abfd) != len)
+ return FALSE;
off += len;
}
BFD_ASSERT (off == tab->sec_size);
- return true;
+ return TRUE;
}
-/* Compare two elf_strtab_hash_entry structures. This is called via qsort. */
+/* Compare two elf_strtab_hash_entry structures. Called via qsort. */
static int
-cmplengthentry (a, b)
- const PTR a;
- const PTR b;
+strrevcmp (const void *a, const void *b)
{
- struct elf_strtab_hash_entry * A = *(struct elf_strtab_hash_entry **) a;
- struct elf_strtab_hash_entry * B = *(struct elf_strtab_hash_entry **) b;
-
- if (A->len < B->len)
- return 1;
- else if (A->len > B->len)
- return -1;
-
- return memcmp (A->root.string, B->root.string, A->len);
+ struct elf_strtab_hash_entry *A = *(struct elf_strtab_hash_entry **) a;
+ struct elf_strtab_hash_entry *B = *(struct elf_strtab_hash_entry **) b;
+ unsigned int lenA = A->len;
+ unsigned int lenB = B->len;
+ const unsigned char *s = A->root.string + lenA - 1;
+ const unsigned char *t = B->root.string + lenB - 1;
+ int l = lenA < lenB ? lenA : lenB;
+
+ while (l)
+ {
+ if (*s != *t)
+ return (int) *s - (int) *t;
+ s--;
+ t--;
+ l--;
+ }
+ return lenA - lenB;
}
-static int
-last4_eq (a, b)
- const PTR a;
- const PTR b;
+static inline int
+is_suffix (const struct elf_strtab_hash_entry *A,
+ const struct elf_strtab_hash_entry *B)
{
- struct elf_strtab_hash_entry * A = (struct elf_strtab_hash_entry *) a;
- struct elf_strtab_hash_entry * B = (struct elf_strtab_hash_entry *) b;
-
- if (memcmp (A->root.string + A->len - 5, B->root.string + B->len - 5, 4)
- != 0)
- /* This was a hashtable collision. */
- return 0;
-
if (A->len <= B->len)
/* B cannot be a suffix of A unless A is equal to B, which is guaranteed
not to be equal by the hash table. */
return 0;
return memcmp (A->root.string + (A->len - B->len),
- B->root.string, B->len - 5) == 0;
+ B->root.string, B->len - 1) == 0;
}
/* This function assigns final string table offsets for used strings,
merging strings matching suffixes of longer strings if possible. */
void
-_bfd_elf_strtab_finalize (tab)
- struct elf_strtab_hash *tab;
+_bfd_elf_strtab_finalize (struct elf_strtab_hash *tab)
{
- struct elf_strtab_hash_entry **array, **a, **end, *e;
- htab_t last4tab = NULL;
+ struct elf_strtab_hash_entry **array, **a, *e;
bfd_size_type size, amt;
- struct elf_strtab_hash_entry *last[256], **last_ptr[256];
/* GCC 2.91.66 (egcs-1.1.2) on i386 miscompiles this function when i is
a 64-bit bfd_size_type: a 64-bit target or --enable-64-bit-bfd.
@@ -332,105 +306,71 @@ _bfd_elf_strtab_finalize (tab)
cycles. */
size_t i;
- /* Now sort the strings by length, longest first. */
- array = NULL;
+ /* Sort the strings by suffix and length. */
amt = tab->size * sizeof (struct elf_strtab_hash_entry *);
- array = (struct elf_strtab_hash_entry **) bfd_malloc (amt);
+ array = bfd_malloc (amt);
if (array == NULL)
goto alloc_failure;
- memset (last, 0, sizeof (last));
- for (i = 0; i < 256; ++i)
- last_ptr[i] = &last[i];
for (i = 1, a = array; i < tab->size; ++i)
- if (tab->array[i]->refcount)
- *a++ = tab->array[i];
- else
- tab->array[i]->len = 0;
+ {
+ e = tab->array[i];
+ if (e->refcount)
+ {
+ *a++ = e;
+ /* Adjust the length to not include the zero terminator. */
+ e->len -= 1;
+ }
+ else
+ e->len = 0;
+ }
size = a - array;
+ if (size != 0)
+ {
+ qsort (array, size, sizeof (struct elf_strtab_hash_entry *), strrevcmp);
- qsort (array, size, sizeof (struct elf_strtab_hash_entry *), cmplengthentry);
+ /* Loop over the sorted array and merge suffixes. Start from the
+ end because we want eg.
- last4tab = htab_create_alloc (size * 4, NULL, last4_eq, NULL, calloc, free);
- if (last4tab == NULL)
- goto alloc_failure;
+ s1 -> "d"
+ s2 -> "bcd"
+ s3 -> "abcd"
- /* Now insert the strings into hash tables (strings with last 4 characters
- and strings with last character equal), look for longer strings which
- we're suffix of. */
- for (a = array, end = array + size; a < end; a++)
- {
- register hashval_t hash;
- unsigned int c;
- unsigned int j;
- const unsigned char *s;
- PTR *p;
-
- e = *a;
- if (e->len > 4)
- {
- s = e->root.string + e->len - 1;
- hash = 0;
- for (j = 0; j < 4; j++)
- {
- c = *--s;
- hash += c + (c << 17);
- hash ^= hash >> 2;
- }
- p = htab_find_slot_with_hash (last4tab, e, hash, INSERT);
- if (p == NULL)
- goto alloc_failure;
- if (*p)
- {
- struct elf_strtab_hash_entry *ent;
+ to end up as
- ent = (struct elf_strtab_hash_entry *) *p;
- e->u.suffix = ent;
- e->len = 0;
- continue;
- }
- else
- *p = (PTR) e;
- }
- else
- {
- struct elf_strtab_hash_entry *tem;
+ s3 -> "abcd"
+ s2 _____^
+ s1 _______^
- c = e->root.string[e->len - 2] & 0xff;
+ ie. we don't want s1 pointing into the old s2. */
+ e = *--a;
+ e->len += 1;
+ while (--a >= array)
+ {
+ struct elf_strtab_hash_entry *cmp = *a;
- for (tem = last[c]; tem; tem = tem->u.next)
- if (tem->len > e->len
- && memcmp (tem->root.string + (tem->len - e->len),
- e->root.string, e->len - 1) == 0)
- break;
- if (tem)
+ cmp->len += 1;
+ if (is_suffix (e, cmp))
{
- e->u.suffix = tem;
- e->len = 0;
- continue;
+ cmp->u.suffix = e;
+ cmp->len = -cmp->len;
}
+ else
+ e = cmp;
}
-
- c = e->root.string[e->len - 2] & 0xff;
- /* Put longest strings first. */
- *last_ptr[c] = e;
- last_ptr[c] = &e->u.next;
- e->u.next = NULL;
}
alloc_failure:
if (array)
free (array);
- if (last4tab)
- htab_delete (last4tab);
- /* Now assign positions to the strings we want to keep. */
+ /* Assign positions to the strings we want to keep. */
size = 1;
for (i = 1; i < tab->size; ++i)
{
e = tab->array[i];
- if (e->refcount && e->len)
+ if (e->refcount && e->len > 0)
{
e->u.index = size;
size += e->len;
@@ -439,12 +379,11 @@ alloc_failure:
tab->sec_size = size;
- /* And now adjust the rest. */
+ /* Adjust the rest. */
for (i = 1; i < tab->size; ++i)
{
e = tab->array[i];
- if (e->refcount && ! e->len)
- e->u.index = e->u.suffix->u.index
- + (e->u.suffix->len - strlen (e->root.string) - 1);
+ if (e->refcount && e->len < 0)
+ e->u.index = e->u.suffix->u.index + (e->u.suffix->len + e->len);
}
}
diff --git a/contrib/binutils/bfd/elf.c b/contrib/binutils/bfd/elf.c
index 6a3a78e..a14fd35 100644
--- a/contrib/binutils/bfd/elf.c
+++ b/contrib/binutils/bfd/elf.c
@@ -1,22 +1,23 @@
/* ELF executable support for BFD.
- Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
- Free Software Foundation, Inc.
-This file is part of BFD, the Binary File Descriptor library.
+ Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
+ 2002, 2003, 2004 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 of the License, or
-(at your option) any later version.
+ This file is part of BFD, the Binary File Descriptor library.
-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 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.
-You should have received a copy of the GNU General Public 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
/* SECTION
@@ -40,40 +41,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "elf-bfd.h"
#include "libiberty.h"
-static INLINE struct elf_segment_map *make_mapping
- PARAMS ((bfd *, asection **, unsigned int, unsigned int, boolean));
-static boolean map_sections_to_segments PARAMS ((bfd *));
-static int elf_sort_sections PARAMS ((const PTR, const PTR));
-static boolean assign_file_positions_for_segments PARAMS ((bfd *));
-static boolean assign_file_positions_except_relocs PARAMS ((bfd *));
-static boolean prep_headers PARAMS ((bfd *));
-static boolean swap_out_syms PARAMS ((bfd *, struct bfd_strtab_hash **, int));
-static boolean copy_private_bfd_data PARAMS ((bfd *, bfd *));
-static char *elf_read PARAMS ((bfd *, file_ptr, bfd_size_type));
-static const char *group_signature PARAMS ((bfd *, Elf_Internal_Shdr *));
-static boolean setup_group PARAMS ((bfd *, Elf_Internal_Shdr *, asection *));
-static void merge_sections_remove_hook PARAMS ((bfd *, asection *));
-static void elf_fake_sections PARAMS ((bfd *, asection *, PTR));
-static boolean assign_section_numbers PARAMS ((bfd *));
-static INLINE int sym_is_global PARAMS ((bfd *, asymbol *));
-static boolean elf_map_symbols PARAMS ((bfd *));
-static bfd_size_type get_program_header_size PARAMS ((bfd *));
-static boolean elfcore_read_notes PARAMS ((bfd *, file_ptr, bfd_size_type));
-static boolean elf_find_function PARAMS ((bfd *, asection *, asymbol **,
- bfd_vma, const char **,
- const char **));
-static int elfcore_make_pid PARAMS ((bfd *));
-static boolean elfcore_maybe_make_sect PARAMS ((bfd *, char *, asection *));
-static boolean elfcore_make_note_pseudosection PARAMS ((bfd *, char *,
- Elf_Internal_Note *));
-static boolean elfcore_grok_prfpreg PARAMS ((bfd *, Elf_Internal_Note *));
-static boolean elfcore_grok_prxfpreg PARAMS ((bfd *, Elf_Internal_Note *));
-static boolean elfcore_grok_note PARAMS ((bfd *, Elf_Internal_Note *));
-
-static boolean elfcore_netbsd_get_lwpid PARAMS ((Elf_Internal_Note *, int *));
-static boolean elfcore_grok_netbsd_procinfo PARAMS ((bfd *,
- Elf_Internal_Note *));
-static boolean elfcore_grok_netbsd_note PARAMS ((bfd *, Elf_Internal_Note *));
+static int elf_sort_sections (const void *, const void *);
+static bfd_boolean assign_file_positions_except_relocs (bfd *, struct bfd_link_info *);
+static bfd_boolean prep_headers (bfd *);
+static bfd_boolean swap_out_syms (bfd *, struct bfd_strtab_hash **, int) ;
+static bfd_boolean elfcore_read_notes (bfd *, file_ptr, bfd_size_type) ;
/* Swap version information in and out. The version information is
currently size independent. If that ever changes, this code will
@@ -82,10 +54,9 @@ static boolean elfcore_grok_netbsd_note PARAMS ((bfd *, Elf_Internal_Note *));
/* Swap in a Verdef structure. */
void
-_bfd_elf_swap_verdef_in (abfd, src, dst)
- bfd *abfd;
- const Elf_External_Verdef *src;
- Elf_Internal_Verdef *dst;
+_bfd_elf_swap_verdef_in (bfd *abfd,
+ const Elf_External_Verdef *src,
+ Elf_Internal_Verdef *dst)
{
dst->vd_version = H_GET_16 (abfd, src->vd_version);
dst->vd_flags = H_GET_16 (abfd, src->vd_flags);
@@ -99,10 +70,9 @@ _bfd_elf_swap_verdef_in (abfd, src, dst)
/* Swap out a Verdef structure. */
void
-_bfd_elf_swap_verdef_out (abfd, src, dst)
- bfd *abfd;
- const Elf_Internal_Verdef *src;
- Elf_External_Verdef *dst;
+_bfd_elf_swap_verdef_out (bfd *abfd,
+ const Elf_Internal_Verdef *src,
+ Elf_External_Verdef *dst)
{
H_PUT_16 (abfd, src->vd_version, dst->vd_version);
H_PUT_16 (abfd, src->vd_flags, dst->vd_flags);
@@ -116,10 +86,9 @@ _bfd_elf_swap_verdef_out (abfd, src, dst)
/* Swap in a Verdaux structure. */
void
-_bfd_elf_swap_verdaux_in (abfd, src, dst)
- bfd *abfd;
- const Elf_External_Verdaux *src;
- Elf_Internal_Verdaux *dst;
+_bfd_elf_swap_verdaux_in (bfd *abfd,
+ const Elf_External_Verdaux *src,
+ Elf_Internal_Verdaux *dst)
{
dst->vda_name = H_GET_32 (abfd, src->vda_name);
dst->vda_next = H_GET_32 (abfd, src->vda_next);
@@ -128,10 +97,9 @@ _bfd_elf_swap_verdaux_in (abfd, src, dst)
/* Swap out a Verdaux structure. */
void
-_bfd_elf_swap_verdaux_out (abfd, src, dst)
- bfd *abfd;
- const Elf_Internal_Verdaux *src;
- Elf_External_Verdaux *dst;
+_bfd_elf_swap_verdaux_out (bfd *abfd,
+ const Elf_Internal_Verdaux *src,
+ Elf_External_Verdaux *dst)
{
H_PUT_32 (abfd, src->vda_name, dst->vda_name);
H_PUT_32 (abfd, src->vda_next, dst->vda_next);
@@ -140,10 +108,9 @@ _bfd_elf_swap_verdaux_out (abfd, src, dst)
/* Swap in a Verneed structure. */
void
-_bfd_elf_swap_verneed_in (abfd, src, dst)
- bfd *abfd;
- const Elf_External_Verneed *src;
- Elf_Internal_Verneed *dst;
+_bfd_elf_swap_verneed_in (bfd *abfd,
+ const Elf_External_Verneed *src,
+ Elf_Internal_Verneed *dst)
{
dst->vn_version = H_GET_16 (abfd, src->vn_version);
dst->vn_cnt = H_GET_16 (abfd, src->vn_cnt);
@@ -155,10 +122,9 @@ _bfd_elf_swap_verneed_in (abfd, src, dst)
/* Swap out a Verneed structure. */
void
-_bfd_elf_swap_verneed_out (abfd, src, dst)
- bfd *abfd;
- const Elf_Internal_Verneed *src;
- Elf_External_Verneed *dst;
+_bfd_elf_swap_verneed_out (bfd *abfd,
+ const Elf_Internal_Verneed *src,
+ Elf_External_Verneed *dst)
{
H_PUT_16 (abfd, src->vn_version, dst->vn_version);
H_PUT_16 (abfd, src->vn_cnt, dst->vn_cnt);
@@ -170,10 +136,9 @@ _bfd_elf_swap_verneed_out (abfd, src, dst)
/* Swap in a Vernaux structure. */
void
-_bfd_elf_swap_vernaux_in (abfd, src, dst)
- bfd *abfd;
- const Elf_External_Vernaux *src;
- Elf_Internal_Vernaux *dst;
+_bfd_elf_swap_vernaux_in (bfd *abfd,
+ const Elf_External_Vernaux *src,
+ Elf_Internal_Vernaux *dst)
{
dst->vna_hash = H_GET_32 (abfd, src->vna_hash);
dst->vna_flags = H_GET_16 (abfd, src->vna_flags);
@@ -185,10 +150,9 @@ _bfd_elf_swap_vernaux_in (abfd, src, dst)
/* Swap out a Vernaux structure. */
void
-_bfd_elf_swap_vernaux_out (abfd, src, dst)
- bfd *abfd;
- const Elf_Internal_Vernaux *src;
- Elf_External_Vernaux *dst;
+_bfd_elf_swap_vernaux_out (bfd *abfd,
+ const Elf_Internal_Vernaux *src,
+ Elf_External_Vernaux *dst)
{
H_PUT_32 (abfd, src->vna_hash, dst->vna_hash);
H_PUT_16 (abfd, src->vna_flags, dst->vna_flags);
@@ -200,10 +164,9 @@ _bfd_elf_swap_vernaux_out (abfd, src, dst)
/* Swap in a Versym structure. */
void
-_bfd_elf_swap_versym_in (abfd, src, dst)
- bfd *abfd;
- const Elf_External_Versym *src;
- Elf_Internal_Versym *dst;
+_bfd_elf_swap_versym_in (bfd *abfd,
+ const Elf_External_Versym *src,
+ Elf_Internal_Versym *dst)
{
dst->vs_vers = H_GET_16 (abfd, src->vs_vers);
}
@@ -211,10 +174,9 @@ _bfd_elf_swap_versym_in (abfd, src, dst)
/* Swap out a Versym structure. */
void
-_bfd_elf_swap_versym_out (abfd, src, dst)
- bfd *abfd;
- const Elf_Internal_Versym *src;
- Elf_External_Versym *dst;
+_bfd_elf_swap_versym_out (bfd *abfd,
+ const Elf_Internal_Versym *src,
+ Elf_External_Versym *dst)
{
H_PUT_16 (abfd, src->vs_vers, dst->vs_vers);
}
@@ -223,8 +185,7 @@ _bfd_elf_swap_versym_out (abfd, src, dst)
cause invalid hash tables to be generated. */
unsigned long
-bfd_elf_hash (namearg)
- const char *namearg;
+bfd_elf_hash (const char *namearg)
{
const unsigned char *name = (const unsigned char *) namearg;
unsigned long h = 0;
@@ -242,7 +203,7 @@ bfd_elf_hash (namearg)
h ^= g;
}
}
- return h;
+ return h & 0xffffffff;
}
/* Read a specified number of bytes at a specified offset in an ELF
@@ -250,10 +211,7 @@ bfd_elf_hash (namearg)
buffer. */
static char *
-elf_read (abfd, offset, size)
- bfd *abfd;
- file_ptr offset;
- bfd_size_type size;
+elf_read (bfd *abfd, file_ptr offset, bfd_size_type size)
{
char *buf;
@@ -261,7 +219,7 @@ elf_read (abfd, offset, size)
return NULL;
if (bfd_seek (abfd, offset, SEEK_SET) != 0)
return NULL;
- if (bfd_bread ((PTR) buf, size, abfd) != size)
+ if (bfd_bread (buf, size, abfd) != size)
{
if (bfd_get_error () != bfd_error_system_call)
bfd_set_error (bfd_error_file_truncated);
@@ -270,34 +228,29 @@ elf_read (abfd, offset, size)
return buf;
}
-boolean
-bfd_elf_mkobject (abfd)
- bfd *abfd;
+bfd_boolean
+bfd_elf_mkobject (bfd *abfd)
{
/* This just does initialization. */
/* coff_mkobject zalloc's space for tdata.coff_obj_data ... */
- bfd_size_type amt = sizeof (struct elf_obj_tdata);
- elf_tdata (abfd) = (struct elf_obj_tdata *) bfd_zalloc (abfd, amt);
+ elf_tdata (abfd) = bfd_zalloc (abfd, sizeof (struct elf_obj_tdata));
if (elf_tdata (abfd) == 0)
- return false;
+ return FALSE;
/* Since everything is done at close time, do we need any
initialization? */
- return true;
+ return TRUE;
}
-boolean
-bfd_elf_mkcorefile (abfd)
- bfd *abfd;
+bfd_boolean
+bfd_elf_mkcorefile (bfd *abfd)
{
/* I think this can be done just like an object file. */
return bfd_elf_mkobject (abfd);
}
char *
-bfd_elf_get_str_section (abfd, shindex)
- bfd *abfd;
- unsigned int shindex;
+bfd_elf_get_str_section (bfd *abfd, unsigned int shindex)
{
Elf_Internal_Shdr **i_shdrp;
char *shstrtab = NULL;
@@ -315,16 +268,15 @@ bfd_elf_get_str_section (abfd, shindex)
offset = i_shdrp[shindex]->sh_offset;
shstrtabsize = i_shdrp[shindex]->sh_size;
shstrtab = elf_read (abfd, offset, shstrtabsize);
- i_shdrp[shindex]->contents = (PTR) shstrtab;
+ i_shdrp[shindex]->contents = shstrtab;
}
return shstrtab;
}
char *
-bfd_elf_string_from_elf_section (abfd, shindex, strindex)
- bfd *abfd;
- unsigned int shindex;
- unsigned int strindex;
+bfd_elf_string_from_elf_section (bfd *abfd,
+ unsigned int shindex,
+ unsigned int strindex)
{
Elf_Internal_Shdr *hdr;
@@ -359,24 +311,22 @@ bfd_elf_string_from_elf_section (abfd, shindex, strindex)
symbols, and symbol section index extensions, respectively. */
Elf_Internal_Sym *
-bfd_elf_get_elf_syms (ibfd, symtab_hdr, symcount, symoffset,
- intsym_buf, extsym_buf, extshndx_buf)
- bfd *ibfd;
- Elf_Internal_Shdr *symtab_hdr;
- size_t symcount;
- size_t symoffset;
- Elf_Internal_Sym *intsym_buf;
- PTR extsym_buf;
- Elf_External_Sym_Shndx *extshndx_buf;
+bfd_elf_get_elf_syms (bfd *ibfd,
+ Elf_Internal_Shdr *symtab_hdr,
+ size_t symcount,
+ size_t symoffset,
+ Elf_Internal_Sym *intsym_buf,
+ void *extsym_buf,
+ Elf_External_Sym_Shndx *extshndx_buf)
{
Elf_Internal_Shdr *shndx_hdr;
- PTR alloc_ext;
+ void *alloc_ext;
const bfd_byte *esym;
Elf_External_Sym_Shndx *alloc_extshndx;
Elf_External_Sym_Shndx *shndx;
Elf_Internal_Sym *isym;
Elf_Internal_Sym *isymend;
- struct elf_backend_data *bed;
+ const struct elf_backend_data *bed;
size_t extsym_size;
bfd_size_type amt;
file_ptr pos;
@@ -417,7 +367,7 @@ bfd_elf_get_elf_syms (ibfd, symtab_hdr, symcount, symoffset,
pos = shndx_hdr->sh_offset + symoffset * sizeof (Elf_External_Sym_Shndx);
if (extshndx_buf == NULL)
{
- alloc_extshndx = (Elf_External_Sym_Shndx *) bfd_malloc (amt);
+ alloc_extshndx = bfd_malloc (amt);
extshndx_buf = alloc_extshndx;
}
if (extshndx_buf == NULL
@@ -432,7 +382,7 @@ bfd_elf_get_elf_syms (ibfd, symtab_hdr, symcount, symoffset,
if (intsym_buf == NULL)
{
bfd_size_type amt = symcount * sizeof (Elf_Internal_Sym);
- intsym_buf = (Elf_Internal_Sym *) bfd_malloc (amt);
+ intsym_buf = bfd_malloc (amt);
if (intsym_buf == NULL)
goto out;
}
@@ -442,7 +392,7 @@ bfd_elf_get_elf_syms (ibfd, symtab_hdr, symcount, symoffset,
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, (const PTR) shndx, isym);
+ (*bed->s->swap_symbol_in) (ibfd, esym, shndx, isym);
out:
if (alloc_ext != NULL)
@@ -453,6 +403,21 @@ bfd_elf_get_elf_syms (ibfd, symtab_hdr, symcount, symoffset,
return intsym_buf;
}
+/* Look up a symbol name. */
+const char *
+bfd_elf_local_sym_name (bfd *abfd, Elf_Internal_Sym *isym)
+{
+ unsigned int iname = isym->st_name;
+ unsigned int shindex = elf_tdata (abfd)->symtab_hdr.sh_link;
+ if (iname == 0 && ELF_ST_TYPE (isym->st_info) == STT_SECTION)
+ {
+ iname = elf_elfsections (abfd)[isym->st_shndx]->sh_name;
+ shindex = elf_elfheader (abfd)->e_shstrndx;
+ }
+
+ return bfd_elf_string_from_elf_section (abfd, shindex, iname);
+}
+
/* Elf_Internal_Shdr->contents is an array of these for SHT_GROUP
sections. The first element is the flags, the rest are section
pointers. */
@@ -466,16 +431,12 @@ typedef union elf_internal_group {
signature just a string? */
static const char *
-group_signature (abfd, ghdr)
- bfd *abfd;
- Elf_Internal_Shdr *ghdr;
+group_signature (bfd *abfd, Elf_Internal_Shdr *ghdr)
{
Elf_Internal_Shdr *hdr;
unsigned char esym[sizeof (Elf64_External_Sym)];
Elf_External_Sym_Shndx eshndx;
Elf_Internal_Sym isym;
- unsigned int iname;
- unsigned int shindex;
/* First we need to ensure the symbol table is available. */
if (! bfd_section_from_shdr (abfd, ghdr->sh_link))
@@ -487,25 +448,13 @@ group_signature (abfd, ghdr)
&isym, esym, &eshndx) == NULL)
return NULL;
- /* Look up the symbol name. */
- iname = isym.st_name;
- shindex = hdr->sh_link;
- if (iname == 0 && ELF_ST_TYPE (isym.st_info) == STT_SECTION)
- {
- iname = elf_elfsections (abfd)[isym.st_shndx]->sh_name;
- shindex = elf_elfheader (abfd)->e_shstrndx;
- }
-
- return bfd_elf_string_from_elf_section (abfd, shindex, iname);
+ return bfd_elf_local_sym_name (abfd, &isym);
}
/* Set next_in_group list pointer, and group name for NEWSECT. */
-static boolean
-setup_group (abfd, hdr, newsect)
- bfd *abfd;
- Elf_Internal_Shdr *hdr;
- asection *newsect;
+static bfd_boolean
+setup_group (bfd *abfd, Elf_Internal_Shdr *hdr, asection *newsect)
{
unsigned int num_group = elf_tdata (abfd)->num_group;
@@ -537,7 +486,7 @@ setup_group (abfd, hdr, newsect)
bfd_size_type amt = num_group * sizeof (Elf_Internal_Shdr *);
elf_tdata (abfd)->group_sect_ptr = bfd_alloc (abfd, amt);
if (elf_tdata (abfd)->group_sect_ptr == NULL)
- return false;
+ return FALSE;
num_group = 0;
for (i = 0; i < shnum; i++)
@@ -560,7 +509,7 @@ setup_group (abfd, hdr, newsect)
|| bfd_seek (abfd, shdr->sh_offset, SEEK_SET) != 0
|| (bfd_bread (shdr->contents, shdr->sh_size, abfd)
!= shdr->sh_size))
- return false;
+ return FALSE;
/* Translate raw contents, a flag word followed by an
array of elf section indices all in target byte order,
@@ -637,7 +586,7 @@ setup_group (abfd, hdr, newsect)
gname = group_signature (abfd, shdr);
if (gname == NULL)
- return false;
+ return FALSE;
elf_group_name (newsect) = gname;
/* Start a circular list with one element. */
@@ -660,13 +609,11 @@ setup_group (abfd, hdr, newsect)
(*_bfd_error_handler) (_("%s: no group info for section %s"),
bfd_archive_filename (abfd), newsect->name);
}
- return true;
+ return TRUE;
}
-boolean
-bfd_elf_discard_group (abfd, group)
- bfd *abfd ATTRIBUTE_UNUSED;
- asection *group;
+bfd_boolean
+bfd_elf_discard_group (bfd *abfd ATTRIBUTE_UNUSED, asection *group)
{
asection *first = elf_next_in_group (group);
asection *s = first;
@@ -679,32 +626,35 @@ bfd_elf_discard_group (abfd, group)
if (s == first)
break;
}
- return true;
+ return TRUE;
}
/* Make a BFD section from an ELF section. We store a pointer to the
BFD section in the bfd_section field of the header. */
-boolean
-_bfd_elf_make_section_from_shdr (abfd, hdr, name)
- bfd *abfd;
- Elf_Internal_Shdr *hdr;
- const char *name;
+bfd_boolean
+_bfd_elf_make_section_from_shdr (bfd *abfd,
+ Elf_Internal_Shdr *hdr,
+ const char *name)
{
asection *newsect;
flagword flags;
- struct elf_backend_data *bed;
+ const struct elf_backend_data *bed;
if (hdr->bfd_section != NULL)
{
BFD_ASSERT (strcmp (name,
bfd_get_section_name (abfd, hdr->bfd_section)) == 0);
- return true;
+ return TRUE;
}
newsect = bfd_make_section_anyway (abfd, name);
if (newsect == NULL)
- return false;
+ return FALSE;
+
+ /* Always use the real type/flags. */
+ elf_section_type (newsect) = hdr->sh_type;
+ elf_section_flags (newsect) = hdr->sh_flags;
newsect->filepos = hdr->sh_offset;
@@ -712,7 +662,7 @@ _bfd_elf_make_section_from_shdr (abfd, hdr, name)
|| ! bfd_set_section_size (abfd, newsect, hdr->sh_size)
|| ! bfd_set_section_alignment (abfd, newsect,
bfd_log2 ((bfd_vma) hdr->sh_addralign)))
- return false;
+ return FALSE;
flags = SEC_NO_FLAGS;
if (hdr->sh_type != SHT_NOBITS)
@@ -740,7 +690,7 @@ _bfd_elf_make_section_from_shdr (abfd, hdr, name)
}
if (hdr->sh_flags & SHF_GROUP)
if (!setup_group (abfd, hdr, newsect))
- return false;
+ return FALSE;
if ((hdr->sh_flags & SHF_TLS) != 0)
flags |= SEC_THREAD_LOCAL;
@@ -777,10 +727,10 @@ _bfd_elf_make_section_from_shdr (abfd, hdr, name)
bed = get_elf_backend_data (abfd);
if (bed->elf_backend_section_flags)
if (! bed->elf_backend_section_flags (&flags, hdr))
- return false;
+ return FALSE;
if (! bfd_set_section_flags (abfd, newsect, flags))
- return false;
+ return FALSE;
if ((flags & SEC_ALLOC) != 0)
{
@@ -851,7 +801,7 @@ _bfd_elf_make_section_from_shdr (abfd, hdr, name)
hdr->bfd_section = newsect;
elf_section_data (newsect)->this_hdr = *hdr;
- return true;
+ return TRUE;
}
/*
@@ -870,9 +820,7 @@ DESCRIPTION
*/
struct elf_internal_shdr *
-bfd_elf_find_section (abfd, name)
- bfd *abfd;
- char *name;
+bfd_elf_find_section (bfd *abfd, char *name)
{
Elf_Internal_Shdr **i_shdrp;
char *shstrtab;
@@ -901,7 +849,7 @@ const char *const bfd_elf_section_type_names[] = {
"SHT_NOBITS", "SHT_REL", "SHT_SHLIB", "SHT_DYNSYM",
};
-/* ELF relocs are against symbols. If we are producing relocateable
+/* ELF relocs are against symbols. If we are producing relocatable
output, and the reloc is against an external symbol, and nothing
has given us any additional addend, the resulting reloc will also
be against the same symbol. In such a case, we don't want to
@@ -909,25 +857,18 @@ const char *const bfd_elf_section_type_names[] = {
all be done at final link time. Rather than put special case code
into bfd_perform_relocation, all the reloc types use this howto
function. It just short circuits the reloc if producing
- relocateable output against an external symbol. */
+ relocatable output against an external symbol. */
bfd_reloc_status_type
-bfd_elf_generic_reloc (abfd,
- reloc_entry,
- symbol,
- data,
- input_section,
- output_bfd,
- error_message)
- bfd *abfd ATTRIBUTE_UNUSED;
- arelent *reloc_entry;
- asymbol *symbol;
- PTR data ATTRIBUTE_UNUSED;
- asection *input_section;
- bfd *output_bfd;
- char **error_message ATTRIBUTE_UNUSED;
-{
- if (output_bfd != (bfd *) NULL
+bfd_elf_generic_reloc (bfd *abfd ATTRIBUTE_UNUSED,
+ arelent *reloc_entry,
+ asymbol *symbol,
+ void *data ATTRIBUTE_UNUSED,
+ asection *input_section,
+ bfd *output_bfd,
+ char **error_message ATTRIBUTE_UNUSED)
+{
+ if (output_bfd != NULL
&& (symbol->flags & BSF_SECTION_SYM) == 0
&& (! reloc_entry->howto->partial_inplace
|| reloc_entry->addend == 0))
@@ -942,56 +883,46 @@ bfd_elf_generic_reloc (abfd,
/* Make sure sec_info_type is cleared if sec_info is cleared too. */
static void
-merge_sections_remove_hook (abfd, sec)
- bfd *abfd ATTRIBUTE_UNUSED;
- asection *sec;
+merge_sections_remove_hook (bfd *abfd ATTRIBUTE_UNUSED,
+ asection *sec)
{
- struct bfd_elf_section_data *sec_data;
-
- sec_data = elf_section_data (sec);
- BFD_ASSERT (sec_data->sec_info_type == ELF_INFO_TYPE_MERGE);
- sec_data->sec_info_type = ELF_INFO_TYPE_NONE;
+ BFD_ASSERT (sec->sec_info_type == ELF_INFO_TYPE_MERGE);
+ sec->sec_info_type = ELF_INFO_TYPE_NONE;
}
/* Finish SHF_MERGE section merging. */
-boolean
-_bfd_elf_merge_sections (abfd, info)
- bfd *abfd;
- struct bfd_link_info *info;
+bfd_boolean
+_bfd_elf_merge_sections (bfd *abfd, struct bfd_link_info *info)
{
- if (!is_elf_hash_table (info))
- return false;
+ if (!is_elf_hash_table (info->hash))
+ return FALSE;
if (elf_hash_table (info)->merge_info)
_bfd_merge_sections (abfd, elf_hash_table (info)->merge_info,
merge_sections_remove_hook);
- return true;
+ return TRUE;
}
void
-_bfd_elf_link_just_syms (sec, info)
- asection *sec;
- struct bfd_link_info *info;
+_bfd_elf_link_just_syms (asection *sec, struct bfd_link_info *info)
{
sec->output_section = bfd_abs_section_ptr;
sec->output_offset = sec->vma;
- if (!is_elf_hash_table (info))
+ if (!is_elf_hash_table (info->hash))
return;
- elf_section_data (sec)->sec_info_type = ELF_INFO_TYPE_JUST_SYMS;
+ sec->sec_info_type = ELF_INFO_TYPE_JUST_SYMS;
}
/* Copy the program header and other data from one object module to
another. */
-boolean
-_bfd_elf_copy_private_bfd_data (ibfd, obfd)
- bfd *ibfd;
- bfd *obfd;
+bfd_boolean
+_bfd_elf_copy_private_bfd_data (bfd *ibfd, bfd *obfd)
{
if (bfd_get_flavour (ibfd) != bfd_target_elf_flavour
|| bfd_get_flavour (obfd) != bfd_target_elf_flavour)
- return true;
+ return TRUE;
BFD_ASSERT (!elf_flags_init (obfd)
|| (elf_elfheader (obfd)->e_flags
@@ -999,18 +930,16 @@ _bfd_elf_copy_private_bfd_data (ibfd, obfd)
elf_gp (obfd) = elf_gp (ibfd);
elf_elfheader (obfd)->e_flags = elf_elfheader (ibfd)->e_flags;
- elf_flags_init (obfd) = true;
- return true;
+ elf_flags_init (obfd) = TRUE;
+ return TRUE;
}
/* Print out the program headers. */
-boolean
-_bfd_elf_print_private_bfd_data (abfd, farg)
- bfd *abfd;
- PTR farg;
+bfd_boolean
+_bfd_elf_print_private_bfd_data (bfd *abfd, void *farg)
{
- FILE *f = (FILE *) farg;
+ FILE *f = farg;
Elf_Internal_Phdr *p;
asection *s;
bfd_byte *dynbuf = NULL;
@@ -1038,6 +967,7 @@ _bfd_elf_print_private_bfd_data (abfd, farg)
case PT_PHDR: pt = "PHDR"; break;
case PT_TLS: pt = "TLS"; break;
case PT_GNU_EH_FRAME: pt = "EH_FRAME"; break;
+ case PT_GNU_STACK: pt = "STACK"; break;
default: sprintf (buf, "0x%lx", p->p_type); pt = buf; break;
}
fprintf (f, "%8s off 0x", pt);
@@ -1068,15 +998,14 @@ _bfd_elf_print_private_bfd_data (abfd, farg)
unsigned long shlink;
bfd_byte *extdyn, *extdynend;
size_t extdynsize;
- void (*swap_dyn_in) PARAMS ((bfd *, const PTR, Elf_Internal_Dyn *));
+ void (*swap_dyn_in) (bfd *, const void *, Elf_Internal_Dyn *);
fprintf (f, _("\nDynamic Section:\n"));
- dynbuf = (bfd_byte *) bfd_malloc (s->_raw_size);
+ dynbuf = 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))
+ if (! bfd_get_section_contents (abfd, s, dynbuf, 0, s->_raw_size))
goto error_return;
elfsec = _bfd_elf_section_from_bfd_section (abfd, s);
@@ -1094,14 +1023,14 @@ _bfd_elf_print_private_bfd_data (abfd, farg)
Elf_Internal_Dyn dyn;
const char *name;
char ab[20];
- boolean stringp;
+ bfd_boolean stringp;
- (*swap_dyn_in) (abfd, (PTR) extdyn, &dyn);
+ (*swap_dyn_in) (abfd, extdyn, &dyn);
if (dyn.d_tag == DT_NULL)
break;
- stringp = false;
+ stringp = FALSE;
switch (dyn.d_tag)
{
default:
@@ -1109,7 +1038,7 @@ _bfd_elf_print_private_bfd_data (abfd, farg)
name = ab;
break;
- case DT_NEEDED: name = "NEEDED"; stringp = true; break;
+ case DT_NEEDED: name = "NEEDED"; stringp = TRUE; break;
case DT_PLTRELSZ: name = "PLTRELSZ"; break;
case DT_PLTGOT: name = "PLTGOT"; break;
case DT_HASH: name = "HASH"; break;
@@ -1122,8 +1051,8 @@ _bfd_elf_print_private_bfd_data (abfd, farg)
case DT_SYMENT: name = "SYMENT"; break;
case DT_INIT: name = "INIT"; break;
case DT_FINI: name = "FINI"; break;
- case DT_SONAME: name = "SONAME"; stringp = true; break;
- case DT_RPATH: name = "RPATH"; stringp = true; break;
+ case DT_SONAME: name = "SONAME"; stringp = TRUE; break;
+ case DT_RPATH: name = "RPATH"; stringp = TRUE; break;
case DT_SYMBOLIC: name = "SYMBOLIC"; break;
case DT_REL: name = "REL"; break;
case DT_RELSZ: name = "RELSZ"; break;
@@ -1137,7 +1066,7 @@ _bfd_elf_print_private_bfd_data (abfd, farg)
case DT_FINI_ARRAY: name = "FINI_ARRAY"; break;
case DT_INIT_ARRAYSZ: name = "INIT_ARRAYSZ"; break;
case DT_FINI_ARRAYSZ: name = "FINI_ARRAYSZ"; break;
- case DT_RUNPATH: name = "RUNPATH"; stringp = true; break;
+ case DT_RUNPATH: name = "RUNPATH"; stringp = TRUE; break;
case DT_FLAGS: name = "FLAGS"; break;
case DT_PREINIT_ARRAY: name = "PREINIT_ARRAY"; break;
case DT_PREINIT_ARRAYSZ: name = "PREINIT_ARRAYSZ"; break;
@@ -1149,9 +1078,9 @@ _bfd_elf_print_private_bfd_data (abfd, farg)
case DT_POSFLAG_1: name = "POSFLAG_1"; break;
case DT_SYMINSZ: name = "SYMINSZ"; break;
case DT_SYMINENT: name = "SYMINENT"; break;
- case DT_CONFIG: name = "CONFIG"; stringp = true; break;
- case DT_DEPAUDIT: name = "DEPAUDIT"; stringp = true; break;
- case DT_AUDIT: name = "AUDIT"; stringp = true; break;
+ case DT_CONFIG: name = "CONFIG"; stringp = TRUE; break;
+ case DT_DEPAUDIT: name = "DEPAUDIT"; stringp = TRUE; break;
+ case DT_AUDIT: name = "AUDIT"; stringp = TRUE; break;
case DT_PLTPAD: name = "PLTPAD"; break;
case DT_MOVETAB: name = "MOVETAB"; break;
case DT_SYMINFO: name = "SYMINFO"; break;
@@ -1163,9 +1092,9 @@ _bfd_elf_print_private_bfd_data (abfd, farg)
case DT_VERDEFNUM: name = "VERDEFNUM"; break;
case DT_VERNEED: name = "VERNEED"; break;
case DT_VERNEEDNUM: name = "VERNEEDNUM"; break;
- case DT_AUXILIARY: name = "AUXILIARY"; stringp = true; break;
+ case DT_AUXILIARY: name = "AUXILIARY"; stringp = TRUE; break;
case DT_USED: name = "USED"; break;
- case DT_FILTER: name = "FILTER"; stringp = true; break;
+ case DT_FILTER: name = "FILTER"; stringp = TRUE; break;
}
fprintf (f, " %-11s ", name);
@@ -1192,7 +1121,7 @@ _bfd_elf_print_private_bfd_data (abfd, farg)
|| (elf_dynverref (abfd) != 0 && elf_tdata (abfd)->verref == NULL))
{
if (! _bfd_elf_slurp_version_tables (abfd))
- return false;
+ return FALSE;
}
if (elf_dynverdef (abfd) != 0)
@@ -1234,24 +1163,23 @@ _bfd_elf_print_private_bfd_data (abfd, farg)
}
}
- return true;
+ return TRUE;
error_return:
if (dynbuf != NULL)
free (dynbuf);
- return false;
+ return FALSE;
}
/* Display ELF-specific fields of a symbol. */
void
-bfd_elf_print_symbol (abfd, filep, symbol, how)
- bfd *abfd;
- PTR filep;
- asymbol *symbol;
- bfd_print_symbol_type how;
+bfd_elf_print_symbol (bfd *abfd,
+ void *filep,
+ asymbol *symbol,
+ bfd_print_symbol_type how)
{
- FILE *file = (FILE *) filep;
+ FILE *file = filep;
switch (how)
{
case bfd_print_symbol_name:
@@ -1266,7 +1194,7 @@ bfd_elf_print_symbol (abfd, filep, symbol, how)
{
const char *section_name;
const char *name = NULL;
- struct elf_backend_data *bed;
+ const struct elf_backend_data *bed;
unsigned char st_other;
bfd_vma val;
@@ -1279,7 +1207,7 @@ bfd_elf_print_symbol (abfd, filep, symbol, how)
if (name == NULL)
{
name = symbol->name;
- bfd_print_symbol_vandf (abfd, (PTR) file, symbol);
+ bfd_print_symbol_vandf (abfd, file, symbol);
}
fprintf (file, " %s\t", section_name);
@@ -1368,10 +1296,9 @@ bfd_elf_print_symbol (abfd, filep, symbol, how)
/* Create an entry in an ELF linker hash table. */
struct bfd_hash_entry *
-_bfd_elf_link_hash_newfunc (entry, table, string)
- struct bfd_hash_entry *entry;
- struct bfd_hash_table *table;
- const char *string;
+_bfd_elf_link_hash_newfunc (struct bfd_hash_entry *entry,
+ struct bfd_hash_table *table,
+ const char *string)
{
/* Allocate the structure if it has not already been allocated by a
subclass. */
@@ -1391,17 +1318,17 @@ _bfd_elf_link_hash_newfunc (entry, table, string)
/* Set local fields. */
ret->indx = -1;
- ret->size = 0;
ret->dynindx = -1;
ret->dynstr_index = 0;
+ ret->elf_hash_value = 0;
ret->weakdef = NULL;
- ret->got.refcount = htab->init_refcount;
- ret->plt.refcount = htab->init_refcount;
- ret->linker_section_pointer = NULL;
ret->verinfo.verdef = NULL;
- ret->vtable_entries_used = NULL;
ret->vtable_entries_size = 0;
+ ret->vtable_entries_used = NULL;
ret->vtable_parent = NULL;
+ ret->got = htab->init_refcount;
+ ret->plt = htab->init_refcount;
+ ret->size = 0;
ret->type = STT_NOTYPE;
ret->other = 0;
/* Assume that we have been called by a non-ELF symbol reader.
@@ -1418,9 +1345,9 @@ _bfd_elf_link_hash_newfunc (entry, table, string)
old indirect symbol. Also used for copying flags to a weakdef. */
void
-_bfd_elf_link_hash_copy_indirect (bed, dir, ind)
- struct elf_backend_data *bed;
- struct elf_link_hash_entry *dir, *ind;
+_bfd_elf_link_hash_copy_indirect (const struct elf_backend_data *bed,
+ struct elf_link_hash_entry *dir,
+ struct elf_link_hash_entry *ind)
{
bfd_signed_vma tmp;
bfd_signed_vma lowest_valid = bed->can_refcount;
@@ -1428,12 +1355,13 @@ _bfd_elf_link_hash_copy_indirect (bed, dir, ind)
/* 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));
+ dir->elf_link_hash_flags
+ |= ind->elf_link_hash_flags & (ELF_LINK_HASH_REF_DYNAMIC
+ | ELF_LINK_HASH_REF_REGULAR
+ | ELF_LINK_HASH_REF_REGULAR_NONWEAK
+ | ELF_LINK_NON_GOT_REF
+ | ELF_LINK_HASH_NEEDS_PLT
+ | ELF_LINK_POINTER_EQUALITY_NEEDED);
if (ind->root.type != bfd_link_hash_indirect)
return;
@@ -1470,12 +1398,11 @@ _bfd_elf_link_hash_copy_indirect (bed, dir, ind)
}
void
-_bfd_elf_link_hash_hide_symbol (info, h, force_local)
- struct bfd_link_info *info;
- struct elf_link_hash_entry *h;
- boolean force_local;
+_bfd_elf_link_hash_hide_symbol (struct bfd_link_info *info,
+ struct elf_link_hash_entry *h,
+ bfd_boolean force_local)
{
- h->plt.offset = (bfd_vma) -1;
+ h->plt = elf_hash_table (info)->init_offset;
h->elf_link_hash_flags &= ~ELF_LINK_HASH_NEEDS_PLT;
if (force_local)
{
@@ -1491,31 +1418,39 @@ _bfd_elf_link_hash_hide_symbol (info, h, force_local)
/* Initialize an ELF linker hash table. */
-boolean
-_bfd_elf_link_hash_table_init (table, abfd, newfunc)
- struct elf_link_hash_table *table;
- bfd *abfd;
- struct bfd_hash_entry *(*newfunc) PARAMS ((struct bfd_hash_entry *,
- struct bfd_hash_table *,
- const char *));
+bfd_boolean
+_bfd_elf_link_hash_table_init
+ (struct elf_link_hash_table *table,
+ bfd *abfd,
+ struct bfd_hash_entry *(*newfunc) (struct bfd_hash_entry *,
+ struct bfd_hash_table *,
+ const char *))
{
- boolean ret;
+ bfd_boolean ret;
- table->dynamic_sections_created = false;
+ table->dynamic_sections_created = FALSE;
table->dynobj = NULL;
- table->init_refcount = get_elf_backend_data (abfd)->can_refcount - 1;
+ /* Make sure can_refcount is extended to the width and signedness of
+ init_refcount before we subtract one from it. */
+ table->init_refcount.refcount = get_elf_backend_data (abfd)->can_refcount;
+ table->init_refcount.refcount -= 1;
+ table->init_offset.offset = -(bfd_vma) 1;
/* The first dynamic symbol is a dummy. */
table->dynsymcount = 1;
table->dynstr = NULL;
table->bucketcount = 0;
table->needed = NULL;
- table->runpath = NULL;
- table->loaded = NULL;
table->hgot = NULL;
table->stab_info = NULL;
table->merge_info = NULL;
+ memset (&table->eh_info, 0, sizeof (table->eh_info));
table->dynlocal = NULL;
- ret = _bfd_link_hash_table_init (& table->root, abfd, newfunc);
+ table->runpath = NULL;
+ table->tls_sec = NULL;
+ table->tls_size = 0;
+ table->loaded = NULL;
+
+ ret = _bfd_link_hash_table_init (&table->root, abfd, newfunc);
table->root.type = bfd_link_elf_hash_table;
return ret;
@@ -1524,14 +1459,13 @@ _bfd_elf_link_hash_table_init (table, abfd, newfunc)
/* Create an ELF linker hash table. */
struct bfd_link_hash_table *
-_bfd_elf_link_hash_table_create (abfd)
- bfd *abfd;
+_bfd_elf_link_hash_table_create (bfd *abfd)
{
struct elf_link_hash_table *ret;
bfd_size_type amt = sizeof (struct elf_link_hash_table);
- ret = (struct elf_link_hash_table *) bfd_malloc (amt);
- if (ret == (struct elf_link_hash_table *) NULL)
+ ret = bfd_malloc (amt);
+ if (ret == NULL)
return NULL;
if (! _bfd_elf_link_hash_table_init (ret, abfd, _bfd_elf_link_hash_newfunc))
@@ -1545,13 +1479,10 @@ _bfd_elf_link_hash_table_create (abfd)
/* This is a hook for the ELF emulation code in the generic linker to
tell the backend linker what file name to use for the DT_NEEDED
- entry for a dynamic object. The generic linker passes name as an
- empty string to indicate that no DT_NEEDED entry should be made. */
+ entry for a dynamic object. */
void
-bfd_elf_set_dt_needed_name (abfd, name)
- bfd *abfd;
- const char *name;
+bfd_elf_set_dt_needed_name (bfd *abfd, const char *name)
{
if (bfd_get_flavour (abfd) == bfd_target_elf_flavour
&& bfd_get_format (abfd) == bfd_object)
@@ -1559,24 +1490,21 @@ bfd_elf_set_dt_needed_name (abfd, name)
}
void
-bfd_elf_set_dt_needed_soname (abfd, name)
- bfd *abfd;
- const char *name;
+bfd_elf_set_dyn_lib_class (bfd *abfd, int lib_class)
{
if (bfd_get_flavour (abfd) == bfd_target_elf_flavour
&& bfd_get_format (abfd) == bfd_object)
- elf_dt_soname (abfd) = name;
+ elf_dyn_lib_class (abfd) = lib_class;
}
/* Get the list of DT_NEEDED entries for a link. This is a hook for
the linker ELF emulation code. */
struct bfd_link_needed_list *
-bfd_elf_get_needed_list (abfd, info)
- bfd *abfd ATTRIBUTE_UNUSED;
- struct bfd_link_info *info;
+bfd_elf_get_needed_list (bfd *abfd ATTRIBUTE_UNUSED,
+ struct bfd_link_info *info)
{
- if (info->hash->creator->flavour != bfd_target_elf_flavour)
+ if (! is_elf_hash_table (info->hash))
return NULL;
return elf_hash_table (info)->needed;
}
@@ -1585,11 +1513,10 @@ bfd_elf_get_needed_list (abfd, info)
hook for the linker ELF emulation code. */
struct bfd_link_needed_list *
-bfd_elf_get_runpath_list (abfd, info)
- bfd *abfd ATTRIBUTE_UNUSED;
- struct bfd_link_info *info;
+bfd_elf_get_runpath_list (bfd *abfd ATTRIBUTE_UNUSED,
+ struct bfd_link_info *info)
{
- if (info->hash->creator->flavour != bfd_target_elf_flavour)
+ if (! is_elf_hash_table (info->hash))
return NULL;
return elf_hash_table (info)->runpath;
}
@@ -1599,8 +1526,7 @@ bfd_elf_get_runpath_list (abfd, info)
passed to bfd_elf_set_dt_needed_name, or it is the filename. */
const char *
-bfd_elf_get_dt_soname (abfd)
- bfd *abfd;
+bfd_elf_get_dt_soname (bfd *abfd)
{
if (bfd_get_flavour (abfd) == bfd_target_elf_flavour
&& bfd_get_format (abfd) == bfd_object)
@@ -1611,10 +1537,9 @@ bfd_elf_get_dt_soname (abfd)
/* Get the list of DT_NEEDED entries from a BFD. This is a hook for
the ELF linker emulation code. */
-boolean
-bfd_elf_get_bfd_needed_list (abfd, pneeded)
- bfd *abfd;
- struct bfd_link_needed_list **pneeded;
+bfd_boolean
+bfd_elf_get_bfd_needed_list (bfd *abfd,
+ struct bfd_link_needed_list **pneeded)
{
asection *s;
bfd_byte *dynbuf = NULL;
@@ -1622,24 +1547,23 @@ bfd_elf_get_bfd_needed_list (abfd, pneeded)
unsigned long shlink;
bfd_byte *extdyn, *extdynend;
size_t extdynsize;
- void (*swap_dyn_in) PARAMS ((bfd *, const PTR, Elf_Internal_Dyn *));
+ void (*swap_dyn_in) (bfd *, const void *, Elf_Internal_Dyn *);
*pneeded = NULL;
if (bfd_get_flavour (abfd) != bfd_target_elf_flavour
|| bfd_get_format (abfd) != bfd_object)
- return true;
+ return TRUE;
s = bfd_get_section_by_name (abfd, ".dynamic");
if (s == NULL || s->_raw_size == 0)
- return true;
+ return TRUE;
- dynbuf = (bfd_byte *) bfd_malloc (s->_raw_size);
+ dynbuf = 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))
+ if (! bfd_get_section_contents (abfd, s, dynbuf, 0, s->_raw_size))
goto error_return;
elfsec = _bfd_elf_section_from_bfd_section (abfd, s);
@@ -1657,7 +1581,7 @@ bfd_elf_get_bfd_needed_list (abfd, pneeded)
{
Elf_Internal_Dyn dyn;
- (*swap_dyn_in) (abfd, (PTR) extdyn, &dyn);
+ (*swap_dyn_in) (abfd, extdyn, &dyn);
if (dyn.d_tag == DT_NULL)
break;
@@ -1674,7 +1598,7 @@ bfd_elf_get_bfd_needed_list (abfd, pneeded)
goto error_return;
amt = sizeof *l;
- l = (struct bfd_link_needed_list *) bfd_alloc (abfd, amt);
+ l = bfd_alloc (abfd, amt);
if (l == NULL)
goto error_return;
@@ -1687,18 +1611,18 @@ bfd_elf_get_bfd_needed_list (abfd, pneeded)
free (dynbuf);
- return true;
+ return TRUE;
error_return:
if (dynbuf != NULL)
free (dynbuf);
- return false;
+ return FALSE;
}
/* Allocate an ELF string table--force the first byte to be zero. */
struct bfd_strtab_hash *
-_bfd_elf_stringtab_init ()
+_bfd_elf_stringtab_init (void)
{
struct bfd_strtab_hash *ret;
@@ -1707,7 +1631,7 @@ _bfd_elf_stringtab_init ()
{
bfd_size_type loc;
- loc = _bfd_stringtab_add (ret, "", true, false);
+ loc = _bfd_stringtab_add (ret, "", TRUE, FALSE);
BFD_ASSERT (loc == 0 || loc == (bfd_size_type) -1);
if (loc == (bfd_size_type) -1)
{
@@ -1722,14 +1646,12 @@ _bfd_elf_stringtab_init ()
/* Create a new bfd section from an ELF section header. */
-boolean
-bfd_section_from_shdr (abfd, shindex)
- bfd *abfd;
- unsigned int shindex;
+bfd_boolean
+bfd_section_from_shdr (bfd *abfd, unsigned int shindex)
{
Elf_Internal_Shdr *hdr = elf_elfsections (abfd)[shindex];
Elf_Internal_Ehdr *ehdr = elf_elfheader (abfd);
- struct elf_backend_data *bed = get_elf_backend_data (abfd);
+ const struct elf_backend_data *bed = get_elf_backend_data (abfd);
const char *name;
name = elf_string_from_elf_strtab (abfd, hdr->sh_name);
@@ -1738,7 +1660,7 @@ bfd_section_from_shdr (abfd, shindex)
{
case SHT_NULL:
/* Inactive section. Throw it away. */
- return true;
+ return TRUE;
case SHT_PROGBITS: /* Normal section with contents. */
case SHT_NOBITS: /* .bss section. */
@@ -1751,7 +1673,7 @@ bfd_section_from_shdr (abfd, shindex)
case SHT_DYNAMIC: /* Dynamic linking information. */
if (! _bfd_elf_make_section_from_shdr (abfd, hdr, name))
- return false;
+ return FALSE;
if (elf_elfsections (abfd)[hdr->sh_link]->sh_type != SHT_STRTAB)
{
Elf_Internal_Shdr *dynsymhdr;
@@ -1784,7 +1706,7 @@ bfd_section_from_shdr (abfd, shindex)
case SHT_SYMTAB: /* A symbol table */
if (elf_onesymtab (abfd) == shindex)
- return true;
+ return TRUE;
BFD_ASSERT (hdr->sh_entsize == bed->s->sizeof_sym);
BFD_ASSERT (elf_onesymtab (abfd) == 0);
@@ -1797,18 +1719,18 @@ bfd_section_from_shdr (abfd, shindex)
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 relocateable object file, which would confuse the
+ set in a relocatable object file, which would confuse the
linker. */
if ((hdr->sh_flags & SHF_ALLOC) != 0
&& (abfd->flags & DYNAMIC) != 0
&& ! _bfd_elf_make_section_from_shdr (abfd, hdr, name))
- return false;
+ return FALSE;
- return true;
+ return TRUE;
case SHT_DYNSYM: /* A dynamic symbol table */
if (elf_dynsymtab (abfd) == shindex)
- return true;
+ return TRUE;
BFD_ASSERT (hdr->sh_entsize == bed->s->sizeof_sym);
BFD_ASSERT (elf_dynsymtab (abfd) == 0);
@@ -1823,26 +1745,26 @@ bfd_section_from_shdr (abfd, shindex)
case SHT_SYMTAB_SHNDX: /* Symbol section indices when >64k sections */
if (elf_symtab_shndx (abfd) == shindex)
- return true;
+ return TRUE;
/* Get the associated symbol table. */
if (! bfd_section_from_shdr (abfd, hdr->sh_link)
|| hdr->sh_link != elf_onesymtab (abfd))
- return false;
+ return FALSE;
elf_symtab_shndx (abfd) = shindex;
elf_tdata (abfd)->symtab_shndx_hdr = *hdr;
elf_elfsections (abfd)[shindex] = &elf_tdata (abfd)->symtab_shndx_hdr;
- return true;
+ return TRUE;
case SHT_STRTAB: /* A string table */
if (hdr->bfd_section != NULL)
- return true;
+ return TRUE;
if (ehdr->e_shstrndx == shindex)
{
elf_tdata (abfd)->shstrtab_hdr = *hdr;
elf_elfsections (abfd)[shindex] = &elf_tdata (abfd)->shstrtab_hdr;
- return true;
+ return TRUE;
}
{
unsigned int i, num_sec;
@@ -1854,13 +1776,13 @@ bfd_section_from_shdr (abfd, shindex)
if (hdr2->sh_link == shindex)
{
if (! bfd_section_from_shdr (abfd, i))
- return false;
+ return FALSE;
if (elf_onesymtab (abfd) == i)
{
elf_tdata (abfd)->strtab_hdr = *hdr;
elf_elfsections (abfd)[shindex] =
&elf_tdata (abfd)->strtab_hdr;
- return true;
+ return TRUE;
}
if (elf_dynsymtab (abfd) == i)
{
@@ -1940,7 +1862,7 @@ bfd_section_from_shdr (abfd, shindex)
/* Get the symbol table. */
if (elf_elfsections (abfd)[hdr->sh_link]->sh_type == SHT_SYMTAB
&& ! bfd_section_from_shdr (abfd, hdr->sh_link))
- return false;
+ return FALSE;
/* If this reloc section does not use the main symbol table we
don't treat it as a reloc section. BFD can't adequately
@@ -1952,10 +1874,10 @@ bfd_section_from_shdr (abfd, shindex)
return _bfd_elf_make_section_from_shdr (abfd, hdr, name);
if (! bfd_section_from_shdr (abfd, hdr->sh_info))
- return false;
+ return FALSE;
target_sect = bfd_section_from_elf_index (abfd, hdr->sh_info);
if (target_sect == NULL)
- return false;
+ return FALSE;
if ((target_sect->flags & SEC_RELOC) == 0
|| target_sect->reloc_count == 0)
@@ -1965,7 +1887,7 @@ bfd_section_from_shdr (abfd, shindex)
bfd_size_type amt;
BFD_ASSERT (elf_section_data (target_sect)->rel_hdr2 == NULL);
amt = sizeof (*hdr2);
- hdr2 = (Elf_Internal_Shdr *) bfd_alloc (abfd, amt);
+ hdr2 = bfd_alloc (abfd, amt);
elf_section_data (target_sect)->rel_hdr2 = hdr2;
}
*hdr2 = *hdr;
@@ -1977,10 +1899,9 @@ bfd_section_from_shdr (abfd, shindex)
/* In the section to which the relocations apply, mark whether
its relocations are of the REL or RELA variety. */
if (hdr->sh_size != 0)
- elf_section_data (target_sect)->use_rela_p
- = (hdr->sh_type == SHT_RELA);
+ target_sect->use_rela_p = hdr->sh_type == SHT_RELA;
abfd->flags |= HAS_RELOC;
- return true;
+ return TRUE;
}
break;
@@ -2003,7 +1924,7 @@ bfd_section_from_shdr (abfd, shindex)
break;
case SHT_SHLIB:
- return true;
+ return TRUE;
case SHT_GROUP:
/* We need a BFD section for objcopy and relocatable linking,
@@ -2011,9 +1932,9 @@ bfd_section_from_shdr (abfd, shindex)
name. */
name = group_signature (abfd, hdr);
if (name == NULL)
- return false;
+ return FALSE;
if (!_bfd_elf_make_section_from_shdr (abfd, hdr, name))
- return false;
+ return FALSE;
if (hdr->contents != NULL)
{
Elf_Internal_Group *idx = (Elf_Internal_Group *) hdr->contents;
@@ -2043,18 +1964,17 @@ bfd_section_from_shdr (abfd, shindex)
break;
}
- return true;
+ return TRUE;
}
/* Return the section for the local symbol specified by ABFD, R_SYMNDX.
Return SEC for sections that have no elf section, and NULL on error. */
asection *
-bfd_section_from_r_symndx (abfd, cache, sec, r_symndx)
- bfd *abfd;
- struct sym_sec_cache *cache;
- asection *sec;
- unsigned long r_symndx;
+bfd_section_from_r_symndx (bfd *abfd,
+ struct sym_sec_cache *cache,
+ asection *sec,
+ unsigned long r_symndx)
{
Elf_Internal_Shdr *symtab_hdr;
unsigned char esym[sizeof (Elf64_External_Sym)];
@@ -2077,7 +1997,8 @@ bfd_section_from_r_symndx (abfd, cache, sec, r_symndx)
}
cache->indx[ent] = r_symndx;
cache->sec[ent] = sec;
- if (isym.st_shndx < SHN_LORESERVE || isym.st_shndx > SHN_HIRESERVE)
+ if ((isym.st_shndx != SHN_UNDEF && isym.st_shndx < SHN_LORESERVE)
+ || isym.st_shndx > SHN_HIRESERVE)
{
asection *s;
s = bfd_section_from_elf_index (abfd, isym.st_shndx);
@@ -2091,33 +2012,149 @@ bfd_section_from_r_symndx (abfd, cache, sec, r_symndx)
section. */
asection *
-bfd_section_from_elf_index (abfd, index)
- bfd *abfd;
- unsigned int index;
+bfd_section_from_elf_index (bfd *abfd, unsigned int index)
{
if (index >= elf_numsections (abfd))
return NULL;
return elf_elfsections (abfd)[index]->bfd_section;
}
-boolean
-_bfd_elf_new_section_hook (abfd, sec)
- bfd *abfd;
- asection *sec;
+static struct bfd_elf_special_section const special_sections[] =
+{
+ { ".bss", 4, -2, SHT_NOBITS, SHF_ALLOC + SHF_WRITE },
+ { ".comment", 8, 0, SHT_PROGBITS, 0 },
+ { ".data", 5, -2, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE },
+ { ".data1", 6, 0, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE },
+ { ".debug", 6, 0, SHT_PROGBITS, 0 },
+ { ".fini", 5, 0, SHT_PROGBITS, SHF_ALLOC + SHF_EXECINSTR },
+ { ".init", 5, 0, SHT_PROGBITS, SHF_ALLOC + SHF_EXECINSTR },
+ { ".line", 5, 0, SHT_PROGBITS, 0 },
+ { ".rodata", 7, -2, SHT_PROGBITS, SHF_ALLOC },
+ { ".rodata1", 8, 0, SHT_PROGBITS, SHF_ALLOC },
+ { ".tbss", 5, -2, SHT_NOBITS, SHF_ALLOC + SHF_WRITE + SHF_TLS },
+ { ".tdata", 6, -2, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE + SHF_TLS },
+ { ".text", 5, -2, SHT_PROGBITS, SHF_ALLOC + SHF_EXECINSTR },
+ { ".init_array", 11, 0, SHT_INIT_ARRAY, SHF_ALLOC + SHF_WRITE },
+ { ".fini_array", 11, 0, SHT_FINI_ARRAY, SHF_ALLOC + SHF_WRITE },
+ { ".preinit_array", 14, 0, SHT_PREINIT_ARRAY, SHF_ALLOC + SHF_WRITE },
+ { ".debug_line", 11, 0, SHT_PROGBITS, 0 },
+ { ".debug_info", 11, 0, SHT_PROGBITS, 0 },
+ { ".debug_abbrev", 13, 0, SHT_PROGBITS, 0 },
+ { ".debug_aranges", 14, 0, SHT_PROGBITS, 0 },
+ { ".dynamic", 8, 0, SHT_DYNAMIC, SHF_ALLOC },
+ { ".dynstr", 7, 0, SHT_STRTAB, SHF_ALLOC },
+ { ".dynsym", 7, 0, SHT_DYNSYM, SHF_ALLOC },
+ { ".got", 4, 0, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE },
+ { ".hash", 5, 0, SHT_HASH, SHF_ALLOC },
+ { ".interp", 7, 0, SHT_PROGBITS, 0 },
+ { ".plt", 4, 0, SHT_PROGBITS, SHF_ALLOC + SHF_EXECINSTR },
+ { ".shstrtab", 9, 0, SHT_STRTAB, 0 },
+ { ".strtab", 7, 0, SHT_STRTAB, 0 },
+ { ".symtab", 7, 0, SHT_SYMTAB, 0 },
+ { ".gnu.version", 12, 0, SHT_GNU_versym, 0 },
+ { ".gnu.version_d", 14, 0, SHT_GNU_verdef, 0 },
+ { ".gnu.version_r", 14, 0, SHT_GNU_verneed, 0 },
+ { ".note", 5, -1, SHT_NOTE, 0 },
+ { ".rela", 5, -1, SHT_RELA, 0 },
+ { ".rel", 4, -1, SHT_REL, 0 },
+ { ".stabstr", 5, 3, SHT_STRTAB, 0 },
+ { NULL, 0, 0, 0, 0 }
+};
+
+static const struct bfd_elf_special_section *
+get_special_section (const char *name,
+ const struct bfd_elf_special_section *special_sections,
+ unsigned int rela)
+{
+ int i;
+ int len = strlen (name);
+
+ for (i = 0; special_sections[i].prefix != NULL; i++)
+ {
+ int suffix_len;
+ int prefix_len = special_sections[i].prefix_length;
+
+ if (len < prefix_len)
+ continue;
+ if (memcmp (name, special_sections[i].prefix, prefix_len) != 0)
+ continue;
+
+ suffix_len = special_sections[i].suffix_length;
+ if (suffix_len <= 0)
+ {
+ if (name[prefix_len] != 0)
+ {
+ if (suffix_len == 0)
+ continue;
+ if (name[prefix_len] != '.'
+ && (suffix_len == -2
+ || (rela && special_sections[i].type == SHT_REL)))
+ continue;
+ }
+ }
+ else
+ {
+ if (len < prefix_len + suffix_len)
+ continue;
+ if (memcmp (name + len - suffix_len,
+ special_sections[i].prefix + prefix_len,
+ suffix_len) != 0)
+ continue;
+ }
+ return &special_sections[i];
+ }
+
+ return NULL;
+}
+
+const struct bfd_elf_special_section *
+_bfd_elf_get_sec_type_attr (bfd *abfd, const char *name)
+{
+ const struct elf_backend_data *bed = get_elf_backend_data (abfd);
+ const struct bfd_elf_special_section *ssect = NULL;
+
+ /* See if this is one of the special sections. */
+ if (name)
+ {
+ unsigned int rela = bed->default_use_rela_p;
+
+ if (bed->special_sections)
+ ssect = get_special_section (name, bed->special_sections, rela);
+
+ if (! ssect)
+ ssect = get_special_section (name, special_sections, rela);
+ }
+
+ return ssect;
+}
+
+bfd_boolean
+_bfd_elf_new_section_hook (bfd *abfd, asection *sec)
{
struct bfd_elf_section_data *sdata;
- bfd_size_type amt = sizeof (*sdata);
+ const struct bfd_elf_special_section *ssect;
- sdata = (struct bfd_elf_section_data *) bfd_zalloc (abfd, amt);
- if (!sdata)
- return false;
- sec->used_by_bfd = (PTR) sdata;
+ sdata = (struct bfd_elf_section_data *) sec->used_by_bfd;
+ if (sdata == NULL)
+ {
+ sdata = bfd_zalloc (abfd, sizeof (*sdata));
+ if (sdata == NULL)
+ return FALSE;
+ sec->used_by_bfd = sdata;
+ }
+
+ elf_section_type (sec) = SHT_NULL;
+ ssect = _bfd_elf_get_sec_type_attr (abfd, sec->name);
+ if (ssect != NULL)
+ {
+ elf_section_type (sec) = ssect->type;
+ elf_section_flags (sec) = ssect->attr;
+ }
/* Indicate whether or not this section should use RELA relocations. */
- sdata->use_rela_p
- = get_elf_backend_data (abfd)->default_use_rela_p;
+ sec->use_rela_p = get_elf_backend_data (abfd)->default_use_rela_p;
- return true;
+ return TRUE;
}
/* Create a new bfd section from an ELF program header.
@@ -2142,12 +2179,11 @@ _bfd_elf_new_section_hook (abfd, sec)
*/
-boolean
-_bfd_elf_make_section_from_phdr (abfd, hdr, index, typename)
- bfd *abfd;
- Elf_Internal_Phdr *hdr;
- int index;
- const char *typename;
+bfd_boolean
+_bfd_elf_make_section_from_phdr (bfd *abfd,
+ Elf_Internal_Phdr *hdr,
+ int index,
+ const char *typename)
{
asection *newsect;
char *name;
@@ -2160,18 +2196,19 @@ _bfd_elf_make_section_from_phdr (abfd, hdr, index, typename)
&& (hdr->p_memsz > hdr->p_filesz));
sprintf (namebuf, "%s%d%s", typename, index, split ? "a" : "");
len = strlen (namebuf) + 1;
- name = bfd_alloc (abfd, (bfd_size_type) len);
+ name = bfd_alloc (abfd, len);
if (!name)
- return false;
+ return FALSE;
memcpy (name, namebuf, len);
newsect = bfd_make_section (abfd, name);
if (newsect == NULL)
- return false;
+ return FALSE;
newsect->vma = hdr->p_vaddr;
newsect->lma = hdr->p_paddr;
newsect->_raw_size = hdr->p_filesz;
newsect->filepos = hdr->p_offset;
newsect->flags |= SEC_HAS_CONTENTS;
+ newsect->alignment_power = bfd_log2 (hdr->p_align);
if (hdr->p_type == PT_LOAD)
{
newsect->flags |= SEC_ALLOC;
@@ -2192,13 +2229,13 @@ _bfd_elf_make_section_from_phdr (abfd, hdr, index, typename)
{
sprintf (namebuf, "%s%db", typename, index);
len = strlen (namebuf) + 1;
- name = bfd_alloc (abfd, (bfd_size_type) len);
+ name = bfd_alloc (abfd, len);
if (!name)
- return false;
+ return FALSE;
memcpy (name, namebuf, len);
newsect = bfd_make_section (abfd, name);
if (newsect == NULL)
- return false;
+ 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;
@@ -2212,16 +2249,13 @@ _bfd_elf_make_section_from_phdr (abfd, hdr, index, typename)
newsect->flags |= SEC_READONLY;
}
- return true;
+ return TRUE;
}
-boolean
-bfd_section_from_phdr (abfd, hdr, index)
- bfd *abfd;
- Elf_Internal_Phdr *hdr;
- int index;
+bfd_boolean
+bfd_section_from_phdr (bfd *abfd, Elf_Internal_Phdr *hdr, int index)
{
- struct elf_backend_data *bed;
+ const struct elf_backend_data *bed;
switch (hdr->p_type)
{
@@ -2239,10 +2273,10 @@ bfd_section_from_phdr (abfd, hdr, index)
case PT_NOTE:
if (! _bfd_elf_make_section_from_phdr (abfd, hdr, index, "note"))
- return false;
- if (! elfcore_read_notes (abfd, (file_ptr) hdr->p_offset, hdr->p_filesz))
- return false;
- return true;
+ return FALSE;
+ if (! elfcore_read_notes (abfd, hdr->p_offset, hdr->p_filesz))
+ return FALSE;
+ return TRUE;
case PT_SHLIB:
return _bfd_elf_make_section_from_phdr (abfd, hdr, index, "shlib");
@@ -2250,6 +2284,13 @@ bfd_section_from_phdr (abfd, hdr, index)
case PT_PHDR:
return _bfd_elf_make_section_from_phdr (abfd, hdr, index, "phdr");
+ case PT_GNU_EH_FRAME:
+ return _bfd_elf_make_section_from_phdr (abfd, hdr, index,
+ "eh_frame_hdr");
+
+ case PT_GNU_STACK:
+ return _bfd_elf_make_section_from_phdr (abfd, hdr, index, "stack");
+
default:
/* Check for any processor-specific program segment types.
If no handler for them, default to making "segment" sections. */
@@ -2262,52 +2303,48 @@ bfd_section_from_phdr (abfd, hdr, index)
}
/* Initialize REL_HDR, the section-header for new section, containing
- relocations against ASECT. If USE_RELA_P is true, we use RELA
+ relocations against ASECT. If USE_RELA_P is TRUE, we use RELA
relocations; otherwise, we use REL relocations. */
-boolean
-_bfd_elf_init_reloc_shdr (abfd, rel_hdr, asect, use_rela_p)
- bfd *abfd;
- Elf_Internal_Shdr *rel_hdr;
- asection *asect;
- boolean use_rela_p;
+bfd_boolean
+_bfd_elf_init_reloc_shdr (bfd *abfd,
+ Elf_Internal_Shdr *rel_hdr,
+ asection *asect,
+ bfd_boolean use_rela_p)
{
char *name;
- struct elf_backend_data *bed = get_elf_backend_data (abfd);
+ const struct elf_backend_data *bed = get_elf_backend_data (abfd);
bfd_size_type amt = sizeof ".rela" + strlen (asect->name);
name = bfd_alloc (abfd, amt);
if (name == NULL)
- return false;
+ return FALSE;
sprintf (name, "%s%s", use_rela_p ? ".rela" : ".rel", asect->name);
rel_hdr->sh_name =
(unsigned int) _bfd_elf_strtab_add (elf_shstrtab (abfd), name,
- false);
+ FALSE);
if (rel_hdr->sh_name == (unsigned int) -1)
- return false;
+ return FALSE;
rel_hdr->sh_type = use_rela_p ? SHT_RELA : SHT_REL;
rel_hdr->sh_entsize = (use_rela_p
? bed->s->sizeof_rela
: bed->s->sizeof_rel);
- rel_hdr->sh_addralign = bed->s->file_align;
+ rel_hdr->sh_addralign = 1 << bed->s->log_file_align;
rel_hdr->sh_flags = 0;
rel_hdr->sh_addr = 0;
rel_hdr->sh_size = 0;
rel_hdr->sh_offset = 0;
- return true;
+ return TRUE;
}
/* Set up an ELF internal section header for a section. */
static void
-elf_fake_sections (abfd, asect, failedptrarg)
- bfd *abfd;
- asection *asect;
- PTR failedptrarg;
+elf_fake_sections (bfd *abfd, asection *asect, void *failedptrarg)
{
- struct elf_backend_data *bed = get_elf_backend_data (abfd);
- boolean *failedptr = (boolean *) failedptrarg;
+ const struct elf_backend_data *bed = get_elf_backend_data (abfd);
+ bfd_boolean *failedptr = failedptrarg;
Elf_Internal_Shdr *this_hdr;
if (*failedptr)
@@ -2319,11 +2356,11 @@ elf_fake_sections (abfd, asect, failedptrarg)
this_hdr = &elf_section_data (asect)->this_hdr;
- this_hdr->sh_name = (unsigned long) _bfd_elf_strtab_add (elf_shstrtab (abfd),
- asect->name, false);
- if (this_hdr->sh_name == (unsigned long) -1)
+ this_hdr->sh_name = (unsigned int) _bfd_elf_strtab_add (elf_shstrtab (abfd),
+ asect->name, FALSE);
+ if (this_hdr->sh_name == (unsigned int) -1)
{
- *failedptr = true;
+ *failedptr = TRUE;
return;
}
@@ -2345,55 +2382,59 @@ elf_fake_sections (abfd, asect, failedptrarg)
this_hdr->bfd_section = asect;
this_hdr->contents = NULL;
- /* FIXME: This should not be based on section names. */
- if (strcmp (asect->name, ".dynstr") == 0)
- this_hdr->sh_type = SHT_STRTAB;
- else if (strcmp (asect->name, ".hash") == 0)
+ /* If the section type is unspecified, we set it based on
+ asect->flags. */
+ if (this_hdr->sh_type == SHT_NULL)
{
- this_hdr->sh_type = SHT_HASH;
- this_hdr->sh_entsize = bed->s->sizeof_hash_entry;
+ 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;
}
- else if (strcmp (asect->name, ".dynsym") == 0)
+
+ switch (this_hdr->sh_type)
{
- this_hdr->sh_type = SHT_DYNSYM;
+ default:
+ break;
+
+ case SHT_STRTAB:
+ case SHT_INIT_ARRAY:
+ case SHT_FINI_ARRAY:
+ case SHT_PREINIT_ARRAY:
+ case SHT_NOTE:
+ case SHT_NOBITS:
+ case SHT_PROGBITS:
+ break;
+
+ case SHT_HASH:
+ this_hdr->sh_entsize = bed->s->sizeof_hash_entry;
+ break;
+
+ case SHT_DYNSYM:
this_hdr->sh_entsize = bed->s->sizeof_sym;
- }
- else if (strcmp (asect->name, ".dynamic") == 0)
- {
- this_hdr->sh_type = SHT_DYNAMIC;
+ break;
+
+ case SHT_DYNAMIC:
this_hdr->sh_entsize = bed->s->sizeof_dyn;
- }
- else if (strncmp (asect->name, ".rela", 5) == 0
- && get_elf_backend_data (abfd)->may_use_rela_p)
- {
- this_hdr->sh_type = SHT_RELA;
- this_hdr->sh_entsize = bed->s->sizeof_rela;
- }
- else if (strncmp (asect->name, ".rel", 4) == 0
- && get_elf_backend_data (abfd)->may_use_rel_p)
- {
- this_hdr->sh_type = SHT_REL;
- this_hdr->sh_entsize = bed->s->sizeof_rel;
- }
- else if (strcmp (asect->name, ".init_array") == 0)
- this_hdr->sh_type = SHT_INIT_ARRAY;
- else if (strcmp (asect->name, ".fini_array") == 0)
- this_hdr->sh_type = SHT_FINI_ARRAY;
- else if (strcmp (asect->name, ".preinit_array") == 0)
- this_hdr->sh_type = SHT_PREINIT_ARRAY;
- else if (strncmp (asect->name, ".note", 5) == 0)
- this_hdr->sh_type = SHT_NOTE;
- else if (strncmp (asect->name, ".stab", 5) == 0
- && strcmp (asect->name + strlen (asect->name) - 3, "str") == 0)
- this_hdr->sh_type = SHT_STRTAB;
- else if (strcmp (asect->name, ".gnu.version") == 0)
- {
- this_hdr->sh_type = SHT_GNU_versym;
+ break;
+
+ case SHT_RELA:
+ if (get_elf_backend_data (abfd)->may_use_rela_p)
+ this_hdr->sh_entsize = bed->s->sizeof_rela;
+ break;
+
+ case SHT_REL:
+ if (get_elf_backend_data (abfd)->may_use_rel_p)
+ this_hdr->sh_entsize = bed->s->sizeof_rel;
+ break;
+
+ case SHT_GNU_versym:
this_hdr->sh_entsize = sizeof (Elf_External_Versym);
- }
- else if (strcmp (asect->name, ".gnu.version_d") == 0)
- {
- this_hdr->sh_type = SHT_GNU_verdef;
+ break;
+
+ case SHT_GNU_verdef:
this_hdr->sh_entsize = 0;
/* objcopy or strip will copy over sh_info, but may not set
cverdefs. The linker will set cverdefs, but sh_info will be
@@ -2403,10 +2444,9 @@ elf_fake_sections (abfd, asect, failedptrarg)
else
BFD_ASSERT (elf_tdata (abfd)->cverdefs == 0
|| this_hdr->sh_info == elf_tdata (abfd)->cverdefs);
- }
- else if (strcmp (asect->name, ".gnu.version_r") == 0)
- {
- this_hdr->sh_type = SHT_GNU_verneed;
+ break;
+
+ case SHT_GNU_verneed:
this_hdr->sh_entsize = 0;
/* objcopy or strip will copy over sh_info, but may not set
cverrefs. The linker will set cverrefs, but sh_info will be
@@ -2416,18 +2456,12 @@ elf_fake_sections (abfd, asect, failedptrarg)
else
BFD_ASSERT (elf_tdata (abfd)->cverrefs == 0
|| this_hdr->sh_info == elf_tdata (abfd)->cverrefs);
- }
- else if ((asect->flags & SEC_GROUP) != 0)
- {
- this_hdr->sh_type = SHT_GROUP;
+ break;
+
+ case SHT_GROUP:
this_hdr->sh_entsize = 4;
+ break;
}
- 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;
if ((asect->flags & SEC_ALLOC) != 0)
this_hdr->sh_flags |= SHF_ALLOC;
@@ -2450,7 +2484,7 @@ elf_fake_sections (abfd, asect, failedptrarg)
if (asect->_raw_size == 0 && (asect->flags & SEC_HAS_CONTENTS) == 0)
{
struct bfd_link_order *o;
-
+
this_hdr->sh_size = 0;
for (o = asect->link_order_head; o != NULL; o = o->next)
if (this_hdr->sh_size < o->offset + o->size)
@@ -2463,7 +2497,7 @@ elf_fake_sections (abfd, asect, failedptrarg)
/* Check for processor-specific section types. */
if (bed->elf_backend_fake_sections
&& !(*bed->elf_backend_fake_sections) (abfd, this_hdr, asect))
- *failedptr = true;
+ *failedptr = TRUE;
/* If the section has relocs, set up a section header for the
SHT_REL[A] section. If two relocation sections are required for
@@ -2473,24 +2507,21 @@ elf_fake_sections (abfd, asect, failedptrarg)
&& !_bfd_elf_init_reloc_shdr (abfd,
&elf_section_data (asect)->rel_hdr,
asect,
- elf_section_data (asect)->use_rela_p))
- *failedptr = true;
+ asect->use_rela_p))
+ *failedptr = TRUE;
}
/* Fill in the contents of a SHT_GROUP section. */
void
-bfd_elf_set_group_contents (abfd, sec, failedptrarg)
- bfd *abfd;
- asection *sec;
- PTR failedptrarg;
+bfd_elf_set_group_contents (bfd *abfd, asection *sec, void *failedptrarg)
{
- boolean *failedptr = (boolean *) failedptrarg;
+ bfd_boolean *failedptr = failedptrarg;
unsigned long symindx;
asection *elt, *first;
unsigned char *loc;
struct bfd_link_order *l;
- boolean gas;
+ bfd_boolean gas;
if (elf_section_data (sec)->this_hdr.sh_type != SHT_GROUP
|| *failedptr)
@@ -2512,17 +2543,17 @@ bfd_elf_set_group_contents (abfd, sec, failedptrarg)
elf_section_data (sec)->this_hdr.sh_info = symindx;
/* The contents won't be allocated for "ld -r" or objcopy. */
- gas = true;
+ gas = TRUE;
if (sec->contents == NULL)
{
- gas = false;
+ gas = FALSE;
sec->contents = bfd_alloc (abfd, sec->_raw_size);
/* Arrange for the section to be written out. */
elf_section_data (sec)->this_hdr.contents = sec->contents;
if (sec->contents == NULL)
{
- *failedptr = true;
+ *failedptr = TRUE;
return;
}
}
@@ -2588,9 +2619,8 @@ bfd_elf_set_group_contents (abfd, sec, failedptrarg)
too. The link/info pointers for the standard section types are filled
in here too, while we're at it. */
-static boolean
-assign_section_numbers (abfd)
- bfd *abfd;
+static bfd_boolean
+assign_section_numbers (bfd *abfd)
{
struct elf_obj_tdata *t = elf_tdata (abfd);
asection *sec;
@@ -2650,9 +2680,9 @@ assign_section_numbers (abfd)
t->symtab_shndx_section = section_number++;
t->symtab_shndx_hdr.sh_name
= (unsigned int) _bfd_elf_strtab_add (elf_shstrtab (abfd),
- ".symtab_shndx", false);
+ ".symtab_shndx", FALSE);
if (t->symtab_shndx_hdr.sh_name == (unsigned int) -1)
- return false;
+ return FALSE;
}
if (section_number == SHN_LORESERVE)
section_number += SHN_HIRESERVE + 1 - SHN_LORESERVE;
@@ -2671,18 +2701,17 @@ assign_section_numbers (abfd)
/* Set up the list of section header pointers, in agreement with the
indices. */
amt = section_number * sizeof (Elf_Internal_Shdr *);
- i_shdrp = (Elf_Internal_Shdr **) bfd_alloc (abfd, amt);
+ i_shdrp = bfd_zalloc (abfd, amt);
if (i_shdrp == NULL)
- return false;
+ return FALSE;
amt = sizeof (Elf_Internal_Shdr);
- i_shdrp[0] = (Elf_Internal_Shdr *) bfd_alloc (abfd, amt);
+ i_shdrp[0] = bfd_zalloc (abfd, amt);
if (i_shdrp[0] == NULL)
{
bfd_release (abfd, i_shdrp);
- return false;
+ return FALSE;
}
- memset (i_shdrp[0], 0, sizeof (Elf_Internal_Shdr));
elf_elfsections (abfd) = i_shdrp;
@@ -2763,9 +2792,9 @@ assign_section_numbers (abfd)
char *alc;
len = strlen (sec->name);
- alc = (char *) bfd_malloc ((bfd_size_type) (len - 2));
+ alc = bfd_malloc (len - 2);
if (alc == NULL)
- return false;
+ return FALSE;
memcpy (alc, sec->name, len - 3);
alc[len - 3] = '\0';
s = bfd_get_section_by_name (abfd, alc);
@@ -2814,30 +2843,27 @@ assign_section_numbers (abfd)
else
i_shdrp[secn]->sh_name = _bfd_elf_strtab_offset (elf_shstrtab (abfd),
i_shdrp[secn]->sh_name);
- return true;
+ return TRUE;
}
/* Map symbol from it's internal number to the external number, moving
all local symbols to be at the head of the list. */
-static INLINE int
-sym_is_global (abfd, sym)
- bfd *abfd;
- asymbol *sym;
+static int
+sym_is_global (bfd *abfd, asymbol *sym)
{
/* If the backend has a special mapping, use it. */
- if (get_elf_backend_data (abfd)->elf_backend_sym_is_global)
- return ((*get_elf_backend_data (abfd)->elf_backend_sym_is_global)
- (abfd, sym));
+ const struct elf_backend_data *bed = get_elf_backend_data (abfd);
+ if (bed->elf_backend_sym_is_global)
+ return (*bed->elf_backend_sym_is_global) (abfd, sym);
return ((sym->flags & (BSF_GLOBAL | BSF_WEAK)) != 0
|| bfd_is_und_section (bfd_get_section (sym))
|| bfd_is_com_section (bfd_get_section (sym)));
}
-static boolean
-elf_map_symbols (abfd)
- bfd *abfd;
+static bfd_boolean
+elf_map_symbols (bfd *abfd)
{
unsigned int symcount = bfd_get_symcount (abfd);
asymbol **syms = bfd_get_outsymbols (abfd);
@@ -2865,9 +2891,9 @@ elf_map_symbols (abfd)
max_index++;
amt = max_index * sizeof (asymbol *);
- sect_syms = (asymbol **) bfd_zalloc (abfd, amt);
+ sect_syms = bfd_zalloc (abfd, amt);
if (sect_syms == NULL)
- return false;
+ return FALSE;
elf_section_syms (abfd) = sect_syms;
elf_num_section_syms (abfd) = max_index;
@@ -2939,10 +2965,10 @@ elf_map_symbols (abfd)
/* Now sort the symbols so the local symbols are first. */
amt = (num_locals + num_globals) * sizeof (asymbol *);
- new_syms = (asymbol **) bfd_alloc (abfd, amt);
+ new_syms = bfd_alloc (abfd, amt);
if (new_syms == NULL)
- return false;
+ return FALSE;
for (idx = 0; idx < symcount; idx++)
{
@@ -2977,17 +3003,14 @@ elf_map_symbols (abfd)
elf_num_locals (abfd) = num_locals;
elf_num_globals (abfd) = num_globals;
- return true;
+ return TRUE;
}
/* Align to the maximum file alignment that could be required for any
ELF data structure. */
-static INLINE file_ptr align_file_position PARAMS ((file_ptr, int));
-static INLINE file_ptr
-align_file_position (off, align)
- file_ptr off;
- int align;
+static inline file_ptr
+align_file_position (file_ptr off, int align)
{
return (off + align - 1) & ~(align - 1);
}
@@ -2995,11 +3018,10 @@ align_file_position (off, align)
/* Assign a file position to a section, optionally aligning to the
required section alignment. */
-INLINE file_ptr
-_bfd_elf_assign_file_position_for_section (i_shdrp, offset, align)
- Elf_Internal_Shdr *i_shdrp;
- file_ptr offset;
- boolean align;
+file_ptr
+_bfd_elf_assign_file_position_for_section (Elf_Internal_Shdr *i_shdrp,
+ file_ptr offset,
+ bfd_boolean align)
{
if (align)
{
@@ -3021,37 +3043,36 @@ _bfd_elf_assign_file_position_for_section (i_shdrp, offset, align)
otherwise prepare to begin writing out the ELF file. If LINK_INFO
is not NULL, this is being called by the ELF backend linker. */
-boolean
-_bfd_elf_compute_section_file_positions (abfd, link_info)
- bfd *abfd;
- struct bfd_link_info *link_info;
+bfd_boolean
+_bfd_elf_compute_section_file_positions (bfd *abfd,
+ struct bfd_link_info *link_info)
{
- struct elf_backend_data *bed = get_elf_backend_data (abfd);
- boolean failed;
+ const struct elf_backend_data *bed = get_elf_backend_data (abfd);
+ bfd_boolean failed;
struct bfd_strtab_hash *strtab;
Elf_Internal_Shdr *shstrtab_hdr;
if (abfd->output_has_begun)
- return true;
+ return TRUE;
/* Do any elf backend specific processing first. */
if (bed->elf_backend_begin_write_processing)
(*bed->elf_backend_begin_write_processing) (abfd, link_info);
if (! prep_headers (abfd))
- return false;
+ return FALSE;
/* Post process the headers if necessary. */
if (bed->elf_backend_post_process_headers)
(*bed->elf_backend_post_process_headers) (abfd, link_info);
- failed = false;
+ failed = FALSE;
bfd_map_over_sections (abfd, elf_fake_sections, &failed);
if (failed)
- return false;
+ return FALSE;
if (!assign_section_numbers (abfd))
- return false;
+ return FALSE;
/* The backend linker builds symbol table information itself. */
if (link_info == NULL && bfd_get_symcount (abfd) > 0)
@@ -3060,14 +3081,14 @@ _bfd_elf_compute_section_file_positions (abfd, link_info)
int relocatable_p = ! (abfd->flags & (EXEC_P | DYNAMIC));
if (! swap_out_syms (abfd, &strtab, relocatable_p))
- return false;
+ return FALSE;
}
if (link_info == NULL)
{
bfd_map_over_sections (abfd, bfd_elf_set_group_contents, &failed);
if (failed)
- return false;
+ return FALSE;
}
shstrtab_hdr = &elf_tdata (abfd)->shstrtab_hdr;
@@ -3082,8 +3103,8 @@ _bfd_elf_compute_section_file_positions (abfd, link_info)
/* sh_offset is set in assign_file_positions_except_relocs. */
shstrtab_hdr->sh_addralign = 1;
- if (!assign_file_positions_except_relocs (abfd))
- return false;
+ if (!assign_file_positions_except_relocs (abfd, link_info))
+ return FALSE;
if (link_info == NULL && bfd_get_symcount (abfd) > 0)
{
@@ -3093,14 +3114,14 @@ _bfd_elf_compute_section_file_positions (abfd, link_info)
off = elf_tdata (abfd)->next_file_pos;
hdr = &elf_tdata (abfd)->symtab_hdr;
- off = _bfd_elf_assign_file_position_for_section (hdr, off, true);
+ off = _bfd_elf_assign_file_position_for_section (hdr, off, TRUE);
hdr = &elf_tdata (abfd)->symtab_shndx_hdr;
if (hdr->sh_size != 0)
- off = _bfd_elf_assign_file_position_for_section (hdr, off, true);
+ off = _bfd_elf_assign_file_position_for_section (hdr, off, TRUE);
hdr = &elf_tdata (abfd)->strtab_hdr;
- off = _bfd_elf_assign_file_position_for_section (hdr, off, true);
+ off = _bfd_elf_assign_file_position_for_section (hdr, off, TRUE);
elf_tdata (abfd)->next_file_pos = off;
@@ -3108,24 +3129,23 @@ _bfd_elf_compute_section_file_positions (abfd, link_info)
out. */
if (bfd_seek (abfd, hdr->sh_offset, SEEK_SET) != 0
|| ! _bfd_stringtab_emit (abfd, strtab))
- return false;
+ return FALSE;
_bfd_stringtab_free (strtab);
}
- abfd->output_has_begun = true;
+ abfd->output_has_begun = TRUE;
- return true;
+ return TRUE;
}
/* Create a mapping from a set of sections to a program segment. */
-static INLINE struct elf_segment_map *
-make_mapping (abfd, sections, from, to, phdr)
- bfd *abfd;
- asection **sections;
- unsigned int from;
- unsigned int to;
- boolean phdr;
+static struct elf_segment_map *
+make_mapping (bfd *abfd,
+ asection **sections,
+ unsigned int from,
+ unsigned int to,
+ bfd_boolean phdr)
{
struct elf_segment_map *m;
unsigned int i;
@@ -3134,7 +3154,7 @@ make_mapping (abfd, sections, from, to, phdr)
amt = sizeof (struct elf_segment_map);
amt += (to - from - 1) * sizeof (asection *);
- m = (struct elf_segment_map *) bfd_zalloc (abfd, amt);
+ m = bfd_zalloc (abfd, amt);
if (m == NULL)
return NULL;
m->next = NULL;
@@ -3155,9 +3175,8 @@ make_mapping (abfd, sections, from, to, phdr)
/* Set up a mapping from BFD sections to program segments. */
-static boolean
-map_sections_to_segments (abfd)
- bfd *abfd;
+static bfd_boolean
+map_sections_to_segments (bfd *abfd)
{
asection **sections = NULL;
asection *s;
@@ -3167,26 +3186,27 @@ map_sections_to_segments (abfd)
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;
- boolean phdr_in_segment = true;
- boolean writable;
+ 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;
+ return TRUE;
if (bfd_count_sections (abfd) == 0)
- return true;
+ return TRUE;
/* Select the allocated sections, and sort them. */
amt = bfd_count_sections (abfd) * sizeof (asection *);
- sections = (asection **) bfd_malloc (amt);
+ sections = bfd_malloc (amt);
if (sections == NULL)
goto error_return;
@@ -3216,7 +3236,7 @@ map_sections_to_segments (abfd)
if (s != NULL && (s->flags & SEC_LOAD) != 0)
{
amt = sizeof (struct elf_segment_map);
- m = (struct elf_segment_map *) bfd_zalloc (abfd, amt);
+ m = bfd_zalloc (abfd, amt);
if (m == NULL)
goto error_return;
m->next = NULL;
@@ -3230,7 +3250,7 @@ map_sections_to_segments (abfd)
pm = &m->next;
amt = sizeof (struct elf_segment_map);
- m = (struct elf_segment_map *) bfd_zalloc (abfd, amt);
+ m = bfd_zalloc (abfd, amt);
if (m == NULL)
goto error_return;
m->next = NULL;
@@ -3246,9 +3266,10 @@ map_sections_to_segments (abfd)
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;
+ writable = FALSE;
dynsec = bfd_get_section_by_name (abfd, ".dynamic");
if (dynsec != NULL
&& (dynsec->flags & SEC_LOAD) == 0)
@@ -3268,13 +3289,13 @@ map_sections_to_segments (abfd)
if ((abfd->flags & D_PAGED) == 0
|| sections[0]->lma < phdr_size
|| sections[0]->lma % maxpagesize < phdr_size % maxpagesize)
- phdr_in_segment = false;
+ phdr_in_segment = FALSE;
}
for (i = 0, hdrpp = sections; i < count; i++, hdrpp++)
{
asection *hdr;
- boolean new_segment;
+ bfd_boolean new_segment;
hdr = *hdrpp;
@@ -3285,39 +3306,40 @@ map_sections_to_segments (abfd)
{
/* 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;
+ 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;
+ new_segment = TRUE;
}
- else if (BFD_ALIGN (last_hdr->lma + last_hdr->_raw_size, maxpagesize)
+ 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;
+ new_segment = TRUE;
}
- else if ((last_hdr->flags & SEC_LOAD) == 0
- && (hdr->flags & SEC_LOAD) != 0)
+ 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. */
- new_segment = true;
+ 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;
+ new_segment = FALSE;
}
else if (! writable
&& (hdr->flags & SEC_READONLY) == 0
- && (((last_hdr->lma + last_hdr->_raw_size - 1)
+ && (((last_hdr->lma + last_size - 1)
& ~(maxpagesize - 1))
!= (hdr->lma & ~(maxpagesize - 1))))
{
@@ -3328,19 +3350,24 @@ map_sections_to_segments (abfd)
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;
+ new_segment = TRUE;
}
else
{
/* Otherwise, we can use the same segment. */
- new_segment = false;
+ new_segment = FALSE;
}
if (! new_segment)
{
if ((hdr->flags & SEC_READONLY) == 0)
- writable = true;
+ writable = TRUE;
last_hdr = hdr;
+ /* .tbss sections effectively have zero size. */
+ if ((hdr->flags & (SEC_THREAD_LOCAL | SEC_LOAD)) != SEC_THREAD_LOCAL)
+ last_size = hdr->_raw_size;
+ else
+ last_size = 0;
continue;
}
@@ -3355,13 +3382,18 @@ map_sections_to_segments (abfd)
pm = &m->next;
if ((hdr->flags & SEC_READONLY) == 0)
- writable = true;
+ writable = TRUE;
else
- writable = false;
+ writable = FALSE;
last_hdr = hdr;
+ /* .tbss sections effectively have zero size. */
+ if ((hdr->flags & (SEC_THREAD_LOCAL | SEC_LOAD)) != SEC_THREAD_LOCAL)
+ last_size = hdr->_raw_size;
+ else
+ last_size = 0;
phdr_index = i;
- phdr_in_segment = false;
+ phdr_in_segment = FALSE;
}
/* Create a final PT_LOAD program segment. */
@@ -3379,7 +3411,7 @@ map_sections_to_segments (abfd)
if (dynsec != NULL)
{
amt = sizeof (struct elf_segment_map);
- m = (struct elf_segment_map *) bfd_zalloc (abfd, amt);
+ m = bfd_zalloc (abfd, amt);
if (m == NULL)
goto error_return;
m->next = NULL;
@@ -3402,7 +3434,7 @@ map_sections_to_segments (abfd)
&& strncmp (s->name, ".note", 5) == 0)
{
amt = sizeof (struct elf_segment_map);
- m = (struct elf_segment_map *) bfd_zalloc (abfd, amt);
+ m = bfd_zalloc (abfd, amt);
if (m == NULL)
goto error_return;
m->next = NULL;
@@ -3428,7 +3460,7 @@ map_sections_to_segments (abfd)
amt = sizeof (struct elf_segment_map);
amt += (tls_count - 1) * sizeof (asection *);
- m = (struct elf_segment_map *) bfd_zalloc (abfd, amt);
+ m = bfd_zalloc (abfd, amt);
if (m == NULL)
goto error_return;
m->next = NULL;
@@ -3450,19 +3482,33 @@ map_sections_to_segments (abfd)
/* If there is a .eh_frame_hdr section, throw in a PT_GNU_EH_FRAME
segment. */
- eh_frame_hdr = NULL;
- if (elf_tdata (abfd)->eh_frame_hdr)
- eh_frame_hdr = bfd_get_section_by_name (abfd, ".eh_frame_hdr");
- if (eh_frame_hdr != NULL && (eh_frame_hdr->flags & SEC_LOAD))
+ 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 = (struct elf_segment_map *) bfd_zalloc (abfd, amt);
+ 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;
+ m->sections[0] = eh_frame_hdr->output_section;
+
+ *pm = m;
+ pm = &m->next;
+ }
+
+ if (elf_tdata (abfd)->stack_flags)
+ {
+ amt = sizeof (struct elf_segment_map);
+ m = bfd_zalloc (abfd, amt);
+ if (m == NULL)
+ goto error_return;
+ m->next = NULL;
+ m->p_type = PT_GNU_STACK;
+ m->p_flags = elf_tdata (abfd)->stack_flags;
+ m->p_flags_valid = 1;
*pm = m;
pm = &m->next;
@@ -3472,23 +3518,22 @@ map_sections_to_segments (abfd)
sections = NULL;
elf_tdata (abfd)->segment_map = mfirst;
- return true;
+ return TRUE;
error_return:
if (sections != NULL)
free (sections);
- return false;
+ return FALSE;
}
/* Sort sections by address. */
static int
-elf_sort_sections (arg1, arg2)
- const PTR arg1;
- const PTR arg2;
+elf_sort_sections (const void *arg1, const void *arg2)
{
const asection *sec1 = *(const asection **) arg1;
const asection *sec2 = *(const asection **) arg2;
+ bfd_size_type size1, size2;
/* Sort by LMA first, since this is the address used to
place the section into a segment. */
@@ -3506,7 +3551,7 @@ elf_sort_sections (arg1, arg2)
/* Put !SEC_LOAD sections after SEC_LOAD ones. */
-#define TOEND(x) (((x)->flags & SEC_LOAD) == 0)
+#define TOEND(x) (((x)->flags & (SEC_LOAD | SEC_THREAD_LOCAL)) == 0)
if (TOEND (sec1))
{
@@ -3528,21 +3573,52 @@ elf_sort_sections (arg1, arg2)
/* Sort by size, to put zero sized sections
before others at the same address. */
- if (sec1->_raw_size < sec2->_raw_size)
+ size1 = (sec1->flags & SEC_LOAD) ? sec1->_raw_size : 0;
+ size2 = (sec2->flags & SEC_LOAD) ? sec2->_raw_size : 0;
+
+ if (size1 < size2)
return -1;
- if (sec1->_raw_size > sec2->_raw_size)
+ if (size1 > size2)
return 1;
return sec1->target_index - sec2->target_index;
}
+/* Ian Lance Taylor writes:
+
+ We shouldn't be using % with a negative signed number. That's just
+ not good. We have to make sure either that the number is not
+ negative, or that the number has an unsigned type. When the types
+ are all the same size they wind up as unsigned. When file_ptr is a
+ larger signed type, the arithmetic winds up as signed long long,
+ which is wrong.
+
+ What we're trying to say here is something like ``increase OFF by
+ the least amount that will cause it to be equal to the VMA modulo
+ the page size.'' */
+/* In other words, something like:
+
+ vma_offset = m->sections[0]->vma % bed->maxpagesize;
+ off_offset = off % bed->maxpagesize;
+ if (vma_offset < off_offset)
+ adjustment = vma_offset + bed->maxpagesize - off_offset;
+ else
+ adjustment = vma_offset - off_offset;
+
+ which can can be collapsed into the expression below. */
+
+static file_ptr
+vma_page_aligned_bias (bfd_vma vma, ufile_ptr off, bfd_vma maxpagesize)
+{
+ return ((vma - off) % maxpagesize);
+}
+
/* Assign file positions to the sections based on the mapping from
sections to segments. This function also sets up some fields in
the file header, and writes out the program headers. */
-static boolean
-assign_file_positions_for_segments (abfd)
- bfd *abfd;
+static bfd_boolean
+assign_file_positions_for_segments (bfd *abfd, struct bfd_link_info *link_info)
{
const struct elf_backend_data *bed = get_elf_backend_data (abfd);
unsigned int count;
@@ -3558,7 +3634,7 @@ assign_file_positions_for_segments (abfd)
if (elf_tdata (abfd)->segment_map == NULL)
{
if (! map_sections_to_segments (abfd))
- return false;
+ return FALSE;
}
else
{
@@ -3594,8 +3670,8 @@ assign_file_positions_for_segments (abfd)
if (bed->elf_backend_modify_segment_map)
{
- if (! (*bed->elf_backend_modify_segment_map) (abfd))
- return false;
+ if (! (*bed->elf_backend_modify_segment_map) (abfd, link_info))
+ return FALSE;
}
count = 0;
@@ -3607,7 +3683,7 @@ assign_file_positions_for_segments (abfd)
elf_elfheader (abfd)->e_phnum = count;
if (count == 0)
- return true;
+ return TRUE;
/* If we already counted the number of program segments, make sure
that we allocated enough space. This happens when SIZEOF_HEADERS
@@ -3619,16 +3695,16 @@ assign_file_positions_for_segments (abfd)
(_("%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;
+ return FALSE;
}
if (alloc == 0)
alloc = count;
amt = alloc * sizeof (Elf_Internal_Phdr);
- phdrs = (Elf_Internal_Phdr *) bfd_alloc (abfd, amt);
+ phdrs = bfd_alloc (abfd, amt);
if (phdrs == NULL)
- return false;
+ return FALSE;
off = bed->s->sizeof_ehdr;
off += alloc * bed->s->sizeof_phdr;
@@ -3664,7 +3740,8 @@ assign_file_positions_for_segments (abfd)
&& (m->sections[0]->flags & SEC_ALLOC) != 0)
{
if ((abfd->flags & D_PAGED) != 0)
- off += (m->sections[0]->vma - off) % bed->maxpagesize;
+ off += vma_page_aligned_bias (m->sections[0]->vma, off,
+ bed->maxpagesize);
else
{
bfd_size_type align;
@@ -3679,7 +3756,8 @@ assign_file_positions_for_segments (abfd)
align = secalign;
}
- off += (m->sections[0]->vma - off) % (1 << align);
+ off += vma_page_aligned_bias (m->sections[0]->vma, off,
+ 1 << align);
}
}
@@ -3699,7 +3777,7 @@ assign_file_positions_for_segments (abfd)
&& (abfd->flags & D_PAGED) != 0)
p->p_align = bed->maxpagesize;
else if (m->count == 0)
- p->p_align = bed->s->file_align;
+ p->p_align = 1 << bed->s->log_file_align;
else
p->p_align = 0;
@@ -3724,7 +3802,7 @@ assign_file_positions_for_segments (abfd)
(_("%s: Not enough room for program headers, try linking with -N"),
bfd_get_filename (abfd));
bfd_set_error (bfd_error_bad_value);
- return false;
+ return FALSE;
}
p->p_vaddr -= off;
@@ -3811,9 +3889,15 @@ assign_file_positions_for_segments (abfd)
bfd_vma adjust = sec->lma - (p->p_paddr + p->p_memsz);
p->p_memsz += adjust;
- off += adjust;
- voff += adjust;
- if ((flags & SEC_LOAD) != 0)
+ if (p->p_type == PT_LOAD
+ || (p->p_type == PT_NOTE
+ && bfd_get_format (abfd) == bfd_core))
+ {
+ off += adjust;
+ voff += adjust;
+ }
+ if ((flags & SEC_LOAD) != 0
+ || (flags & SEC_THREAD_LOCAL) != 0)
p->p_filesz += adjust;
}
@@ -3835,9 +3919,11 @@ assign_file_positions_for_segments (abfd)
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 = (sec->vma - voff) % bed->maxpagesize;
+ adjust = vma_page_aligned_bias (sec->vma, voff,
+ bed->maxpagesize);
else
- adjust = (sec->vma - voff) % align;
+ adjust = vma_page_aligned_bias (sec->vma, voff,
+ align);
}
else
adjust = 0;
@@ -3851,7 +3937,7 @@ Error: First section in segment (%s) starts at 0x%x whereas the segment starts a
bfd_section_name (abfd, sec),
sec->lma,
p->p_paddr);
- return false;
+ return FALSE;
}
p->p_memsz += adjust;
off += adjust;
@@ -3870,7 +3956,9 @@ Error: First section in segment (%s) starts at 0x%x whereas the segment starts a
|| (flags & SEC_HAS_CONTENTS) != 0)
off += sec->_raw_size;
- if ((flags & SEC_ALLOC) != 0)
+ if ((flags & SEC_ALLOC) != 0
+ && ((flags & SEC_LOAD) != 0
+ || (flags & SEC_THREAD_LOCAL) == 0))
voff += sec->_raw_size;
}
@@ -3897,6 +3985,9 @@ Error: First section in segment (%s) starts at 0x%x whereas the segment starts a
}
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)
@@ -3974,9 +4065,9 @@ Error: First section in segment (%s) starts at 0x%x whereas the segment starts a
/* 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 FALSE;
- return true;
+ return TRUE;
}
/* Get the size of the program header.
@@ -3991,12 +4082,11 @@ Error: First section in segment (%s) starts at 0x%x whereas the segment starts a
will be two segments. */
static bfd_size_type
-get_program_header_size (abfd)
- bfd *abfd;
+get_program_header_size (bfd *abfd)
{
size_t segs;
asection *s;
- struct elf_backend_data *bed = get_elf_backend_data (abfd);
+ const struct elf_backend_data *bed = get_elf_backend_data (abfd);
/* We can't return a different result each time we're called. */
if (elf_tdata (abfd)->program_header_size != 0)
@@ -4033,13 +4123,18 @@ get_program_header_size (abfd)
++segs;
}
- if (elf_tdata (abfd)->eh_frame_hdr
- && bfd_get_section_by_name (abfd, ".eh_frame_hdr") != NULL)
+ 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
@@ -4086,16 +4181,16 @@ get_program_header_size (abfd)
We also don't set the positions of the .symtab and .strtab here. */
-static boolean
-assign_file_positions_except_relocs (abfd)
- bfd *abfd;
+static bfd_boolean
+assign_file_positions_except_relocs (bfd *abfd,
+ struct bfd_link_info *link_info)
{
struct elf_obj_tdata * const tdata = elf_tdata (abfd);
Elf_Internal_Ehdr * const i_ehdrp = elf_elfheader (abfd);
Elf_Internal_Shdr ** const i_shdrpp = elf_elfsections (abfd);
unsigned int num_sec = elf_numsections (abfd);
file_ptr off;
- struct elf_backend_data *bed = get_elf_backend_data (abfd);
+ const struct elf_backend_data *bed = get_elf_backend_data (abfd);
if ((abfd->flags & (EXEC_P | DYNAMIC)) == 0
&& bfd_get_format (abfd) != bfd_core)
@@ -4123,7 +4218,7 @@ assign_file_positions_except_relocs (abfd)
hdr->sh_offset = -1;
}
else
- off = _bfd_elf_assign_file_position_for_section (hdr, off, true);
+ off = _bfd_elf_assign_file_position_for_section (hdr, off, TRUE);
if (i == SHN_LORESERVE - 1)
{
@@ -4139,8 +4234,8 @@ assign_file_positions_except_relocs (abfd)
/* Assign file positions for the loaded sections based on the
assignment of sections to segments. */
- if (! assign_file_positions_for_segments (abfd))
- return false;
+ if (! assign_file_positions_for_segments (abfd, link_info))
+ return FALSE;
/* Assign file positions for the other sections. */
@@ -4162,20 +4257,20 @@ assign_file_positions_except_relocs (abfd)
? "*unknown*"
: hdr->bfd_section->name)));
if ((abfd->flags & D_PAGED) != 0)
- off += (hdr->sh_addr - off) % bed->maxpagesize;
+ off += vma_page_aligned_bias (hdr->sh_addr, off,
+ bed->maxpagesize);
else
- off += (hdr->sh_addr - off) % hdr->sh_addralign;
+ off += vma_page_aligned_bias (hdr->sh_addr, off,
+ hdr->sh_addralign);
off = _bfd_elf_assign_file_position_for_section (hdr, off,
- false);
+ FALSE);
}
- else if (hdr->sh_type == SHT_REL
- || hdr->sh_type == SHT_RELA
- || hdr == i_shdrpp[tdata->symtab_section]
+ 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);
+ off = _bfd_elf_assign_file_position_for_section (hdr, off, TRUE);
if (i == SHN_LORESERVE - 1)
{
@@ -4186,31 +4281,30 @@ assign_file_positions_except_relocs (abfd)
}
/* Place the section headers. */
- off = align_file_position (off, bed->s->file_align);
+ off = align_file_position (off, 1 << bed->s->log_file_align);
i_ehdrp->e_shoff = off;
off += i_ehdrp->e_shnum * i_ehdrp->e_shentsize;
elf_tdata (abfd)->next_file_pos = off;
- return true;
+ return TRUE;
}
-static boolean
-prep_headers (abfd)
- bfd *abfd;
+static bfd_boolean
+prep_headers (bfd *abfd)
{
Elf_Internal_Ehdr *i_ehdrp; /* Elf file header, internal form */
Elf_Internal_Phdr *i_phdrp = 0; /* Program header table, internal form */
Elf_Internal_Shdr **i_shdrp; /* Section header table, internal form */
struct elf_strtab_hash *shstrtab;
- struct elf_backend_data *bed = get_elf_backend_data (abfd);
+ const struct elf_backend_data *bed = get_elf_backend_data (abfd);
i_ehdrp = elf_elfheader (abfd);
i_shdrp = elf_elfsections (abfd);
shstrtab = _bfd_elf_strtab_init ();
if (shstrtab == NULL)
- return false;
+ return FALSE;
elf_shstrtab (abfd) = shstrtab;
@@ -4248,11 +4342,8 @@ prep_headers (abfd)
Such need can generally be supplied by replacing the tests for
e_machine with the conditions used to determine it. */
default:
- if (get_elf_backend_data (abfd) != NULL)
- i_ehdrp->e_machine = get_elf_backend_data (abfd)->elf_machine_code;
- else
- i_ehdrp->e_machine = EM_NONE;
- }
+ i_ehdrp->e_machine = bed->elf_machine_code;
+ }
i_ehdrp->e_version = bed->s->ev_current;
i_ehdrp->e_ehsize = bed->s->sizeof_ehdr;
@@ -4288,25 +4379,24 @@ prep_headers (abfd)
}
elf_tdata (abfd)->symtab_hdr.sh_name =
- (unsigned int) _bfd_elf_strtab_add (shstrtab, ".symtab", false);
+ (unsigned int) _bfd_elf_strtab_add (shstrtab, ".symtab", FALSE);
elf_tdata (abfd)->strtab_hdr.sh_name =
- (unsigned int) _bfd_elf_strtab_add (shstrtab, ".strtab", false);
+ (unsigned int) _bfd_elf_strtab_add (shstrtab, ".strtab", FALSE);
elf_tdata (abfd)->shstrtab_hdr.sh_name =
- (unsigned int) _bfd_elf_strtab_add (shstrtab, ".shstrtab", false);
+ (unsigned int) _bfd_elf_strtab_add (shstrtab, ".shstrtab", FALSE);
if (elf_tdata (abfd)->symtab_hdr.sh_name == (unsigned int) -1
|| elf_tdata (abfd)->symtab_hdr.sh_name == (unsigned int) -1
|| elf_tdata (abfd)->shstrtab_hdr.sh_name == (unsigned int) -1)
- return false;
+ return FALSE;
- return true;
+ return TRUE;
}
/* Assign file positions for all the reloc sections which are not part
of the loadable file image. */
void
-_bfd_elf_assign_file_positions_for_relocs (abfd)
- bfd *abfd;
+_bfd_elf_assign_file_positions_for_relocs (bfd *abfd)
{
file_ptr off;
unsigned int i, num_sec;
@@ -4322,34 +4412,32 @@ _bfd_elf_assign_file_positions_for_relocs (abfd)
shdrp = *shdrpp;
if ((shdrp->sh_type == SHT_REL || shdrp->sh_type == SHT_RELA)
&& shdrp->sh_offset == -1)
- off = _bfd_elf_assign_file_position_for_section (shdrp, off, true);
+ off = _bfd_elf_assign_file_position_for_section (shdrp, off, TRUE);
}
elf_tdata (abfd)->next_file_pos = off;
}
-boolean
-_bfd_elf_write_object_contents (abfd)
- bfd *abfd;
+bfd_boolean
+_bfd_elf_write_object_contents (bfd *abfd)
{
- struct elf_backend_data *bed = get_elf_backend_data (abfd);
+ const struct elf_backend_data *bed = get_elf_backend_data (abfd);
Elf_Internal_Ehdr *i_ehdrp;
Elf_Internal_Shdr **i_shdrp;
- boolean failed;
+ bfd_boolean failed;
unsigned int count, num_sec;
if (! abfd->output_has_begun
- && ! _bfd_elf_compute_section_file_positions
- (abfd, (struct bfd_link_info *) NULL))
- return false;
+ && ! _bfd_elf_compute_section_file_positions (abfd, NULL))
+ return FALSE;
i_shdrp = elf_elfsections (abfd);
i_ehdrp = elf_elfheader (abfd);
- failed = false;
+ failed = FALSE;
bfd_map_over_sections (abfd, bed->s->write_relocs, &failed);
if (failed)
- return false;
+ return FALSE;
_bfd_elf_assign_file_positions_for_relocs (abfd);
@@ -4365,7 +4453,7 @@ _bfd_elf_write_object_contents (abfd)
if (bfd_seek (abfd, i_shdrp[count]->sh_offset, SEEK_SET) != 0
|| bfd_bwrite (i_shdrp[count]->contents, amt, abfd) != amt)
- return false;
+ return FALSE;
}
if (count == SHN_LORESERVE - 1)
count += SHN_HIRESERVE + 1 - SHN_LORESERVE;
@@ -4374,7 +4462,7 @@ _bfd_elf_write_object_contents (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)))
- return false;
+ return FALSE;
if (bed->elf_backend_final_write_processing)
(*bed->elf_backend_final_write_processing) (abfd,
@@ -4383,9 +4471,8 @@ _bfd_elf_write_object_contents (abfd)
return bed->s->write_shdrs_and_ehdr (abfd);
}
-boolean
-_bfd_elf_write_corefile_contents (abfd)
- bfd *abfd;
+bfd_boolean
+_bfd_elf_write_corefile_contents (bfd *abfd)
{
/* Hopefully this can be done just like an object file. */
return _bfd_elf_write_object_contents (abfd);
@@ -4394,11 +4481,9 @@ _bfd_elf_write_corefile_contents (abfd)
/* Given a section, search the header to find them. */
int
-_bfd_elf_section_from_bfd_section (abfd, asect)
- bfd *abfd;
- struct sec *asect;
+_bfd_elf_section_from_bfd_section (bfd *abfd, struct bfd_section *asect)
{
- struct elf_backend_data *bed;
+ const struct elf_backend_data *bed;
int index;
if (elf_section_data (asect) != NULL
@@ -4445,9 +4530,7 @@ _bfd_elf_section_from_bfd_section (abfd, asect)
on error. */
int
-_bfd_elf_symbol_from_bfd_symbol (abfd, asym_ptr_ptr)
- bfd *abfd;
- asymbol **asym_ptr_ptr;
+_bfd_elf_symbol_from_bfd_symbol (bfd *abfd, asymbol **asym_ptr_ptr)
{
asymbol *asym_ptr = *asym_ptr_ptr;
int idx;
@@ -4501,31 +4584,29 @@ _bfd_elf_symbol_from_bfd_symbol (abfd, asym_ptr_ptr)
/* Copy private BFD data. This copies any program header information. */
-static boolean
-copy_private_bfd_data (ibfd, obfd)
- bfd *ibfd;
- bfd *obfd;
-{
- Elf_Internal_Ehdr * iehdr;
- struct elf_segment_map * map;
- struct elf_segment_map * map_first;
- struct elf_segment_map ** pointer_to_map;
- Elf_Internal_Phdr * segment;
- asection * section;
- unsigned int i;
- unsigned int num_segments;
- boolean phdr_included = false;
- bfd_vma maxpagesize;
- struct elf_segment_map * phdr_adjust_seg = NULL;
- unsigned int phdr_adjust_num = 0;
- struct elf_backend_data * bed;
+static bfd_boolean
+copy_private_bfd_data (bfd *ibfd, bfd *obfd)
+{
+ Elf_Internal_Ehdr *iehdr;
+ struct elf_segment_map *map;
+ struct elf_segment_map *map_first;
+ struct elf_segment_map **pointer_to_map;
+ Elf_Internal_Phdr *segment;
+ asection *section;
+ unsigned int i;
+ unsigned int num_segments;
+ bfd_boolean phdr_included = FALSE;
+ bfd_vma maxpagesize;
+ struct elf_segment_map *phdr_adjust_seg = NULL;
+ unsigned int phdr_adjust_num = 0;
+ const struct elf_backend_data *bed;
if (bfd_get_flavour (ibfd) != bfd_target_elf_flavour
|| bfd_get_flavour (obfd) != bfd_target_elf_flavour)
- return true;
+ return TRUE;
if (elf_tdata (ibfd)->phdr == NULL)
- return true;
+ return TRUE;
bed = get_elf_backend_data (ibfd);
iehdr = elf_elfheader (ibfd);
@@ -4541,18 +4622,23 @@ copy_private_bfd_data (ibfd, obfd)
(start + (segment->p_memsz > segment->p_filesz \
? segment->p_memsz : segment->p_filesz))
- /* Returns true if the given section is contained within
+#define SECTION_SIZE(section, segment) \
+ (((section->flags & (SEC_HAS_CONTENTS | SEC_THREAD_LOCAL)) \
+ != SEC_THREAD_LOCAL || segment->p_type == PT_TLS) \
+ ? section->_raw_size : 0)
+
+ /* Returns TRUE if the given section is contained within
the given segment. VMA addresses are compared. */
#define IS_CONTAINED_BY_VMA(section, segment) \
(section->vma >= segment->p_vaddr \
- && (section->vma + section->_raw_size \
+ && (section->vma + SECTION_SIZE (section, segment) \
<= (SEGMENT_END (segment, segment->p_vaddr))))
- /* Returns true if the given section is contained within
+ /* Returns TRUE if the given section is contained within
the given segment. LMA addresses are compared. */
#define IS_CONTAINED_BY_LMA(section, segment, base) \
(section->lma >= base \
- && (section->lma + section->_raw_size \
+ && (section->lma + SECTION_SIZE (section, segment) \
<= SEGMENT_END (segment, base)))
/* Special case: corefile "NOTE" section containing regs, prpsinfo etc. */
@@ -4584,7 +4670,10 @@ copy_private_bfd_data (ibfd, obfd)
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. */
+ 4. The section has not already been allocated to a previous segment.
+ 5. PT_GNU_STACK segments do not include any sections.
+ 6. PT_TLS segment includes only SHF_TLS sections.
+ 7. SHF_TLS sections are only in PT_TLS or PT_LOAD segments. */
#define INCLUDE_SECTION_IN_SEGMENT(section, segment, bed) \
((((segment->p_paddr \
? IS_CONTAINED_BY_LMA (section, segment, segment->p_paddr) \
@@ -4592,20 +4681,33 @@ copy_private_bfd_data (ibfd, obfd)
&& (section->flags & SEC_ALLOC) != 0) \
|| IS_COREFILE_NOTE (segment, section)) \
&& section->output_section != NULL \
+ && segment->p_type != PT_GNU_STACK \
+ && (segment->p_type != PT_TLS \
+ || (section->flags & SEC_THREAD_LOCAL)) \
+ && (segment->p_type == PT_LOAD \
+ || segment->p_type == PT_TLS \
+ || (section->flags & SEC_THREAD_LOCAL) == 0) \
&& ! section->segment_mark)
- /* Returns true iff seg1 starts after the end of seg2. */
-#define SEGMENT_AFTER_SEGMENT(seg1, seg2) \
- (seg1->p_vaddr >= SEGMENT_END (seg2, seg2->p_vaddr))
+ /* Returns TRUE iff seg1 starts after the end of seg2. */
+#define SEGMENT_AFTER_SEGMENT(seg1, seg2, field) \
+ (seg1->field >= SEGMENT_END (seg2, seg2->field))
- /* Returns true iff seg1 and seg2 overlap. */
+ /* Returns TRUE iff seg1 and seg2 overlap. Segments overlap iff both
+ their VMA address ranges and their LMA address ranges overlap.
+ It is possible to have overlapping VMA ranges without overlapping LMA
+ ranges. RedBoot images for example can have both .data and .bss mapped
+ to the same VMA range, but with the .data section mapped to a different
+ LMA. */
#define SEGMENT_OVERLAPS(seg1, seg2) \
- (!(SEGMENT_AFTER_SEGMENT (seg1, seg2) \
- || SEGMENT_AFTER_SEGMENT (seg2, seg1)))
+ ( !(SEGMENT_AFTER_SEGMENT (seg1, seg2, p_vaddr) \
+ || SEGMENT_AFTER_SEGMENT (seg2, seg1, p_vaddr)) \
+ && !(SEGMENT_AFTER_SEGMENT (seg1, seg2, p_paddr) \
+ || SEGMENT_AFTER_SEGMENT (seg2, seg1, p_paddr)))
/* Initialise the segment mark field. */
for (section = ibfd->sections; section != NULL; section = section->next)
- section->segment_mark = false;
+ section->segment_mark = FALSE;
/* Scan through the segments specified in the program header
of the input BFD. For this first scan we look for overlaps
@@ -4623,7 +4725,7 @@ copy_private_bfd_data (ibfd, obfd)
if (IS_SOLARIS_PT_INTERP (segment, section))
{
/* Mininal change so that the normal section to segment
- assigment code will work. */
+ assignment code will work. */
segment->p_vaddr = section->vma;
break;
}
@@ -4699,18 +4801,19 @@ copy_private_bfd_data (ibfd, obfd)
continue;
/* Compute how many sections might be placed into this segment. */
- section_count = 0;
- for (section = ibfd->sections; section != NULL; section = section->next)
+ for (section = ibfd->sections, section_count = 0;
+ section != NULL;
+ section = section->next)
if (INCLUDE_SECTION_IN_SEGMENT (section, segment, bed))
++section_count;
- /* Allocate a segment map big enough to contain all of the
- sections we have selected. */
+ /* 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 = (struct elf_segment_map *) bfd_alloc (obfd, amt);
+ map = bfd_alloc (obfd, amt);
if (map == NULL)
- return false;
+ return FALSE;
/* Initialise the fields of the segment map. Default to
using the physical address of the segment in the input BFD. */
@@ -4737,7 +4840,7 @@ copy_private_bfd_data (ibfd, obfd)
+ iehdr->e_phnum * iehdr->e_phentsize)));
if (segment->p_type == PT_LOAD && map->includes_phdrs)
- phdr_included = true;
+ phdr_included = TRUE;
}
if (section_count == 0)
@@ -4777,7 +4880,7 @@ copy_private_bfd_data (ibfd, obfd)
and possibly its LMA changed, and a new segment or segments will
have to be created to contain the other sections.
- 4. The sections have been moved, but not be the same amount.
+ 4. The sections have been moved, but not by the same amount.
In this case we can change the segment's LMA to match the LMA
of the first section and we will have to create a new segment
or segments to contain the other sections.
@@ -4789,9 +4892,9 @@ copy_private_bfd_data (ibfd, 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 = (asection **) bfd_malloc (amt);
+ sections = bfd_malloc (amt);
if (sections == NULL)
- return false;
+ return FALSE;
/* Step One: Scan for segment vs section LMA conflicts.
Also add the sections to the section array allocated above.
@@ -4972,7 +5075,7 @@ copy_private_bfd_data (ibfd, obfd)
map->sections[map->count++] = output_section;
++isec;
sections[j] = NULL;
- section->segment_mark = true;
+ section->segment_mark = TRUE;
}
else if (suggested_lma == 0)
suggested_lma = output_section->lma;
@@ -4991,9 +5094,12 @@ copy_private_bfd_data (ibfd, obfd)
and carry on looping. */
amt = sizeof (struct elf_segment_map);
amt += ((bfd_size_type) section_count - 1) * sizeof (asection *);
- map = (struct elf_segment_map *) bfd_alloc (obfd, amt);
+ map = bfd_alloc (obfd, amt);
if (map == NULL)
- return false;
+ {
+ free (sections);
+ return FALSE;
+ }
/* Initialise the fields of the segment map. Set the physical
physical address to the LMA of the first section that has
@@ -5021,10 +5127,8 @@ copy_private_bfd_data (ibfd, obfd)
if (map->p_paddr != 0)
break;
if (map == NULL)
- {
- for (map = map_first; map != NULL; map = map->next)
- map->p_paddr_valid = 0;
- }
+ for (map = map_first; map != NULL; map = map->next)
+ map->p_paddr_valid = 0;
elf_tdata (obfd)->segment_map = map_first;
@@ -5069,6 +5173,7 @@ copy_private_bfd_data (ibfd, obfd)
#endif
#undef SEGMENT_END
+#undef SECTION_SIZE
#undef IS_CONTAINED_BY_VMA
#undef IS_CONTAINED_BY_LMA
#undef IS_COREFILE_NOTE
@@ -5076,24 +5181,23 @@ copy_private_bfd_data (ibfd, obfd)
#undef INCLUDE_SECTION_IN_SEGMENT
#undef SEGMENT_AFTER_SEGMENT
#undef SEGMENT_OVERLAPS
- return true;
+ return TRUE;
}
/* Copy private section information. This copies over the entsize
field, and sometimes the info field. */
-boolean
-_bfd_elf_copy_private_section_data (ibfd, isec, obfd, osec)
- bfd *ibfd;
- asection *isec;
- bfd *obfd;
- asection *osec;
+bfd_boolean
+_bfd_elf_copy_private_section_data (bfd *ibfd,
+ asection *isec,
+ bfd *obfd,
+ asection *osec)
{
Elf_Internal_Shdr *ihdr, *ohdr;
if (ibfd->xvec->flavour != bfd_target_elf_flavour
|| obfd->xvec->flavour != bfd_target_elf_flavour)
- return true;
+ return TRUE;
if (elf_tdata (obfd)->segment_map == NULL && elf_tdata (ibfd)->phdr != NULL)
{
@@ -5109,7 +5213,7 @@ _bfd_elf_copy_private_section_data (ibfd, isec, obfd, osec)
if (s == NULL)
{
if (! copy_private_bfd_data (ibfd, obfd))
- return false;
+ return FALSE;
}
}
@@ -5130,10 +5234,9 @@ _bfd_elf_copy_private_section_data (ibfd, isec, obfd, osec)
elf_next_in_group (osec) = elf_next_in_group (isec);
elf_group_name (osec) = elf_group_name (isec);
- elf_section_data (osec)->use_rela_p
- = elf_section_data (isec)->use_rela_p;
+ osec->use_rela_p = isec->use_rela_p;
- return true;
+ return TRUE;
}
/* Copy private symbol information. If this symbol is in a section
@@ -5148,18 +5251,17 @@ _bfd_elf_copy_private_section_data (ibfd, isec, obfd, osec)
#define MAP_SHSTRTAB (SHN_HIOS + 4)
#define MAP_SYM_SHNDX (SHN_HIOS + 5)
-boolean
-_bfd_elf_copy_private_symbol_data (ibfd, isymarg, obfd, osymarg)
- bfd *ibfd;
- asymbol *isymarg;
- bfd *obfd;
- asymbol *osymarg;
+bfd_boolean
+_bfd_elf_copy_private_symbol_data (bfd *ibfd,
+ asymbol *isymarg,
+ bfd *obfd,
+ asymbol *osymarg)
{
elf_symbol_type *isym, *osym;
if (bfd_get_flavour (ibfd) != bfd_target_elf_flavour
|| bfd_get_flavour (obfd) != bfd_target_elf_flavour)
- return true;
+ return TRUE;
isym = elf_symbol_from (ibfd, isymarg);
osym = elf_symbol_from (obfd, osymarg);
@@ -5184,18 +5286,17 @@ _bfd_elf_copy_private_symbol_data (ibfd, isymarg, obfd, osymarg)
osym->internal_elf_sym.st_shndx = shndx;
}
- return true;
+ return TRUE;
}
/* Swap out the symbols. */
-static boolean
-swap_out_syms (abfd, sttp, relocatable_p)
- bfd *abfd;
- struct bfd_strtab_hash **sttp;
- int relocatable_p;
+static bfd_boolean
+swap_out_syms (bfd *abfd,
+ struct bfd_strtab_hash **sttp,
+ int relocatable_p)
{
- struct elf_backend_data *bed;
+ const struct elf_backend_data *bed;
int symcount;
asymbol **syms;
struct bfd_strtab_hash *stt;
@@ -5206,14 +5307,15 @@ swap_out_syms (abfd, sttp, relocatable_p)
char *outbound_shndx;
int idx;
bfd_size_type amt;
+ bfd_boolean name_local_sections;
if (!elf_map_symbols (abfd))
- return false;
+ return FALSE;
/* Dump out the symtabs. */
stt = _bfd_elf_stringtab_init ();
if (stt == NULL)
- return false;
+ return FALSE;
bed = get_elf_backend_data (abfd);
symcount = bfd_get_symcount (abfd);
@@ -5222,7 +5324,7 @@ swap_out_syms (abfd, sttp, relocatable_p)
symtab_hdr->sh_entsize = bed->s->sizeof_sym;
symtab_hdr->sh_size = symtab_hdr->sh_entsize * (symcount + 1);
symtab_hdr->sh_info = elf_num_locals (abfd) + 1;
- symtab_hdr->sh_addralign = bed->s->file_align;
+ symtab_hdr->sh_addralign = 1 << bed->s->log_file_align;
symstrtab_hdr = &elf_tdata (abfd)->strtab_hdr;
symstrtab_hdr->sh_type = SHT_STRTAB;
@@ -5230,8 +5332,11 @@ swap_out_syms (abfd, sttp, relocatable_p)
amt = (bfd_size_type) (1 + symcount) * bed->s->sizeof_sym;
outbound_syms = bfd_alloc (abfd, amt);
if (outbound_syms == NULL)
- return false;
- symtab_hdr->contents = (PTR) outbound_syms;
+ {
+ _bfd_stringtab_free (stt);
+ return FALSE;
+ }
+ symtab_hdr->contents = outbound_syms;
outbound_shndx = NULL;
symtab_shndx_hdr = &elf_tdata (abfd)->symtab_shndx_hdr;
@@ -5240,7 +5345,11 @@ swap_out_syms (abfd, sttp, relocatable_p)
amt = (bfd_size_type) (1 + symcount) * sizeof (Elf_External_Sym_Shndx);
outbound_shndx = bfd_zalloc (abfd, amt);
if (outbound_shndx == NULL)
- return false;
+ {
+ _bfd_stringtab_free (stt);
+ return FALSE;
+ }
+
symtab_shndx_hdr->contents = outbound_shndx;
symtab_shndx_hdr->sh_type = SHT_SYMTAB_SHNDX;
symtab_shndx_hdr->sh_size = amt;
@@ -5248,7 +5357,7 @@ swap_out_syms (abfd, sttp, relocatable_p)
symtab_shndx_hdr->sh_entsize = sizeof (Elf_External_Sym_Shndx);
}
- /* now generate the data (for "contents") */
+ /* Now generate the data (for "contents"). */
{
/* Fill in zeroth symbol and swap it out. */
Elf_Internal_Sym sym;
@@ -5264,6 +5373,10 @@ swap_out_syms (abfd, sttp, relocatable_p)
outbound_shndx += sizeof (Elf_External_Sym_Shndx);
}
+ name_local_sections
+ = (bed->elf_backend_name_local_section_symbols
+ && bed->elf_backend_name_local_section_symbols (abfd));
+
syms = bfd_get_outsymbols (abfd);
for (idx = 0; idx < symcount; idx++)
{
@@ -5273,7 +5386,8 @@ swap_out_syms (abfd, sttp, relocatable_p)
flagword flags = syms[idx]->flags;
int type;
- if ((flags & (BSF_SECTION_SYM | BSF_GLOBAL)) == BSF_SECTION_SYM)
+ if (!name_local_sections
+ && (flags & (BSF_SECTION_SYM | BSF_GLOBAL)) == BSF_SECTION_SYM)
{
/* Local section symbols have no name. */
sym.st_name = 0;
@@ -5282,9 +5396,12 @@ swap_out_syms (abfd, sttp, relocatable_p)
{
sym.st_name = (unsigned long) _bfd_stringtab_add (stt,
syms[idx]->name,
- true, false);
+ TRUE, FALSE);
if (sym.st_name == (unsigned long) -1)
- return false;
+ {
+ _bfd_stringtab_free (stt);
+ return FALSE;
+ }
}
type_ptr = elf_symbol_from (abfd, syms[idx]);
@@ -5314,6 +5431,7 @@ swap_out_syms (abfd, sttp, relocatable_p)
value += sec->output_offset;
sec = sec->output_section;
}
+
/* Don't add in the section vma for relocatable output. */
if (! relocatable_p)
value += sec->vma;
@@ -5365,7 +5483,17 @@ swap_out_syms (abfd, sttp, relocatable_p)
section of a symbol to be a section that is
actually in the output file. */
sec2 = bfd_get_section_by_name (abfd, sec->name);
- BFD_ASSERT (sec2 != 0);
+ if (sec2 == NULL)
+ {
+ _bfd_error_handler (_("\
+Unable to find equivalent output section for symbol '%s' from section '%s'"),
+ syms[idx]->name ? syms[idx]->name : "<Local sym>",
+ sec->name);
+ bfd_set_error (bfd_error_invalid_operation);
+ _bfd_stringtab_free (stt);
+ return FALSE;
+ }
+
shndx = _bfd_elf_section_from_bfd_section (abfd, sec2);
BFD_ASSERT (shndx != -1);
}
@@ -5386,7 +5514,7 @@ swap_out_syms (abfd, sttp, relocatable_p)
if (syms[idx]->section->flags & SEC_THREAD_LOCAL)
type = STT_TLS;
- /* Processor-specific types */
+ /* Processor-specific types. */
if (type_ptr != NULL
&& bed->elf_backend_get_symbol_type)
type = ((*bed->elf_backend_get_symbol_type)
@@ -5444,7 +5572,7 @@ swap_out_syms (abfd, sttp, relocatable_p)
symstrtab_hdr->sh_info = 0;
symstrtab_hdr->sh_addralign = 1;
- return true;
+ return TRUE;
}
/* Return the number of bytes required to hold the symtab vector.
@@ -5454,8 +5582,7 @@ swap_out_syms (abfd, sttp, relocatable_p)
always has a dummy entry as symbol #0, so it ends up even. */
long
-_bfd_elf_get_symtab_upper_bound (abfd)
- bfd *abfd;
+_bfd_elf_get_symtab_upper_bound (bfd *abfd)
{
long symcount;
long symtab_size;
@@ -5470,8 +5597,7 @@ _bfd_elf_get_symtab_upper_bound (abfd)
}
long
-_bfd_elf_get_dynamic_symtab_upper_bound (abfd)
- bfd *abfd;
+_bfd_elf_get_dynamic_symtab_upper_bound (bfd *abfd)
{
long symcount;
long symtab_size;
@@ -5492,9 +5618,8 @@ _bfd_elf_get_dynamic_symtab_upper_bound (abfd)
}
long
-_bfd_elf_get_reloc_upper_bound (abfd, asect)
- bfd *abfd ATTRIBUTE_UNUSED;
- sec_ptr asect;
+_bfd_elf_get_reloc_upper_bound (bfd *abfd ATTRIBUTE_UNUSED,
+ sec_ptr asect)
{
return (asect->reloc_count + 1) * sizeof (arelent *);
}
@@ -5502,17 +5627,16 @@ _bfd_elf_get_reloc_upper_bound (abfd, asect)
/* Canonicalize the relocs. */
long
-_bfd_elf_canonicalize_reloc (abfd, section, relptr, symbols)
- bfd *abfd;
- sec_ptr section;
- arelent **relptr;
- asymbol **symbols;
+_bfd_elf_canonicalize_reloc (bfd *abfd,
+ sec_ptr section,
+ arelent **relptr,
+ asymbol **symbols)
{
arelent *tblptr;
unsigned int i;
- struct elf_backend_data *bed = get_elf_backend_data (abfd);
+ const struct elf_backend_data *bed = get_elf_backend_data (abfd);
- if (! bed->s->slurp_reloc_table (abfd, section, symbols, false))
+ if (! bed->s->slurp_reloc_table (abfd, section, symbols, FALSE))
return -1;
tblptr = section->relocation;
@@ -5525,12 +5649,10 @@ _bfd_elf_canonicalize_reloc (abfd, section, relptr, symbols)
}
long
-_bfd_elf_get_symtab (abfd, alocation)
- bfd *abfd;
- asymbol **alocation;
+_bfd_elf_canonicalize_symtab (bfd *abfd, asymbol **allocation)
{
- struct elf_backend_data *bed = get_elf_backend_data (abfd);
- long symcount = bed->s->slurp_symbol_table (abfd, alocation, false);
+ const struct elf_backend_data *bed = get_elf_backend_data (abfd);
+ long symcount = bed->s->slurp_symbol_table (abfd, allocation, FALSE);
if (symcount >= 0)
bfd_get_symcount (abfd) = symcount;
@@ -5538,12 +5660,11 @@ _bfd_elf_get_symtab (abfd, alocation)
}
long
-_bfd_elf_canonicalize_dynamic_symtab (abfd, alocation)
- bfd *abfd;
- asymbol **alocation;
+_bfd_elf_canonicalize_dynamic_symtab (bfd *abfd,
+ asymbol **allocation)
{
- struct elf_backend_data *bed = get_elf_backend_data (abfd);
- long symcount = bed->s->slurp_symbol_table (abfd, alocation, true);
+ const struct elf_backend_data *bed = get_elf_backend_data (abfd);
+ long symcount = bed->s->slurp_symbol_table (abfd, allocation, TRUE);
if (symcount >= 0)
bfd_get_dynamic_symcount (abfd) = symcount;
@@ -5556,8 +5677,7 @@ _bfd_elf_canonicalize_dynamic_symtab (abfd, alocation)
considered to be a dynamic reloc section. */
long
-_bfd_elf_get_dynamic_reloc_upper_bound (abfd)
- bfd *abfd;
+_bfd_elf_get_dynamic_reloc_upper_bound (bfd *abfd)
{
long ret;
asection *s;
@@ -5589,12 +5709,11 @@ _bfd_elf_get_dynamic_reloc_upper_bound (abfd)
section. */
long
-_bfd_elf_canonicalize_dynamic_reloc (abfd, storage, syms)
- bfd *abfd;
- arelent **storage;
- asymbol **syms;
+_bfd_elf_canonicalize_dynamic_reloc (bfd *abfd,
+ arelent **storage,
+ asymbol **syms)
{
- boolean (*slurp_relocs) PARAMS ((bfd *, asection *, asymbol **, boolean));
+ bfd_boolean (*slurp_relocs) (bfd *, asection *, asymbol **, bfd_boolean);
asection *s;
long ret;
@@ -5615,7 +5734,7 @@ _bfd_elf_canonicalize_dynamic_reloc (abfd, storage, syms)
arelent *p;
long count, i;
- if (! (*slurp_relocs) (abfd, s, syms, true))
+ if (! (*slurp_relocs) (abfd, s, syms, TRUE))
return -1;
count = s->_raw_size / elf_section_data (s)->this_hdr.sh_entsize;
p = s->relocation;
@@ -5632,9 +5751,8 @@ _bfd_elf_canonicalize_dynamic_reloc (abfd, storage, syms)
/* Read in the version information. */
-boolean
-_bfd_elf_slurp_version_tables (abfd)
- bfd *abfd;
+bfd_boolean
+_bfd_elf_slurp_version_tables (bfd *abfd)
{
bfd_byte *contents = NULL;
bfd_size_type amt;
@@ -5651,11 +5769,11 @@ _bfd_elf_slurp_version_tables (abfd)
hdr = &elf_tdata (abfd)->dynverdef_hdr;
- contents = (bfd_byte *) bfd_malloc (hdr->sh_size);
+ contents = bfd_malloc (hdr->sh_size);
if (contents == NULL)
goto error_return;
if (bfd_seek (abfd, hdr->sh_offset, SEEK_SET) != 0
- || bfd_bread ((PTR) contents, hdr->sh_size, abfd) != hdr->sh_size)
+ || bfd_bread (contents, hdr->sh_size, abfd) != hdr->sh_size)
goto error_return;
/* We know the number of entries in the section but not the maximum
@@ -5675,7 +5793,7 @@ _bfd_elf_slurp_version_tables (abfd)
}
amt = (bfd_size_type) maxidx * sizeof (Elf_Internal_Verdef);
- elf_tdata (abfd)->verdef = (Elf_Internal_Verdef *) bfd_zalloc (abfd, amt);
+ elf_tdata (abfd)->verdef = bfd_zalloc (abfd, amt);
if (elf_tdata (abfd)->verdef == NULL)
goto error_return;
@@ -5697,7 +5815,7 @@ _bfd_elf_slurp_version_tables (abfd)
iverdef->vd_bfd = abfd;
amt = (bfd_size_type) iverdef->vd_cnt * sizeof (Elf_Internal_Verdaux);
- iverdef->vd_auxptr = (Elf_Internal_Verdaux *) bfd_alloc (abfd, amt);
+ iverdef->vd_auxptr = bfd_alloc (abfd, amt);
if (iverdef->vd_auxptr == NULL)
goto error_return;
@@ -5748,18 +5866,17 @@ _bfd_elf_slurp_version_tables (abfd)
hdr = &elf_tdata (abfd)->dynverref_hdr;
amt = (bfd_size_type) hdr->sh_info * sizeof (Elf_Internal_Verneed);
- elf_tdata (abfd)->verref =
- (Elf_Internal_Verneed *) bfd_zalloc (abfd, amt);
+ elf_tdata (abfd)->verref = bfd_zalloc (abfd, amt);
if (elf_tdata (abfd)->verref == NULL)
goto error_return;
elf_tdata (abfd)->cverrefs = hdr->sh_info;
- contents = (bfd_byte *) bfd_malloc (hdr->sh_size);
+ contents = bfd_malloc (hdr->sh_size);
if (contents == NULL)
goto error_return;
if (bfd_seek (abfd, hdr->sh_offset, SEEK_SET) != 0
- || bfd_bread ((PTR) contents, hdr->sh_size, abfd) != hdr->sh_size)
+ || bfd_bread (contents, hdr->sh_size, abfd) != hdr->sh_size)
goto error_return;
everneed = (Elf_External_Verneed *) contents;
@@ -5782,7 +5899,7 @@ _bfd_elf_slurp_version_tables (abfd)
amt = iverneed->vn_cnt;
amt *= sizeof (Elf_Internal_Vernaux);
- iverneed->vn_auxptr = (Elf_Internal_Vernaux *) bfd_alloc (abfd, amt);
+ iverneed->vn_auxptr = bfd_alloc (abfd, amt);
evernaux = ((Elf_External_Vernaux *)
((bfd_byte *) everneed + iverneed->vn_aux));
@@ -5819,22 +5936,21 @@ _bfd_elf_slurp_version_tables (abfd)
contents = NULL;
}
- return true;
+ return TRUE;
error_return:
- if (contents == NULL)
+ if (contents != NULL)
free (contents);
- return false;
+ return FALSE;
}
asymbol *
-_bfd_elf_make_empty_symbol (abfd)
- bfd *abfd;
+_bfd_elf_make_empty_symbol (bfd *abfd)
{
elf_symbol_type *newsym;
bfd_size_type amt = sizeof (elf_symbol_type);
- newsym = (elf_symbol_type *) bfd_zalloc (abfd, amt);
+ newsym = bfd_zalloc (abfd, amt);
if (!newsym)
return NULL;
else
@@ -5845,10 +5961,9 @@ _bfd_elf_make_empty_symbol (abfd)
}
void
-_bfd_elf_get_symbol_info (ignore_abfd, symbol, ret)
- bfd *ignore_abfd ATTRIBUTE_UNUSED;
- asymbol *symbol;
- symbol_info *ret;
+_bfd_elf_get_symbol_info (bfd *abfd ATTRIBUTE_UNUSED,
+ asymbol *symbol,
+ symbol_info *ret)
{
bfd_symbol_info (symbol, ret);
}
@@ -5857,19 +5972,18 @@ _bfd_elf_get_symbol_info (ignore_abfd, symbol, ret)
use this function for the is_local_label_name entry point, but some
override it. */
-boolean
-_bfd_elf_is_local_label_name (abfd, name)
- bfd *abfd ATTRIBUTE_UNUSED;
- const char *name;
+bfd_boolean
+_bfd_elf_is_local_label_name (bfd *abfd ATTRIBUTE_UNUSED,
+ const char *name)
{
/* Normal local symbols start with ``.L''. */
if (name[0] == '.' && name[1] == 'L')
- return true;
+ return TRUE;
/* At least some SVR4 compilers (e.g., UnixWare 2.1 cc) generate
DWARF debugging symbols starting with ``..''. */
if (name[0] == '.' && name[1] == '.')
- return true;
+ return TRUE;
/* gcc will sometimes generate symbols beginning with ``_.L_'' when
emitting DWARF debugging output. I suspect this is actually a
@@ -5878,32 +5992,30 @@ _bfd_elf_is_local_label_name (abfd, name)
underscore to be emitted on some ELF targets). For ease of use,
we treat such symbols as local. */
if (name[0] == '_' && name[1] == '.' && name[2] == 'L' && name[3] == '_')
- return true;
+ return TRUE;
- return false;
+ return FALSE;
}
alent *
-_bfd_elf_get_lineno (ignore_abfd, symbol)
- bfd *ignore_abfd ATTRIBUTE_UNUSED;
- asymbol *symbol ATTRIBUTE_UNUSED;
+_bfd_elf_get_lineno (bfd *abfd ATTRIBUTE_UNUSED,
+ asymbol *symbol ATTRIBUTE_UNUSED)
{
abort ();
return NULL;
}
-boolean
-_bfd_elf_set_arch_mach (abfd, arch, machine)
- bfd *abfd;
- enum bfd_architecture arch;
- unsigned long machine;
+bfd_boolean
+_bfd_elf_set_arch_mach (bfd *abfd,
+ enum bfd_architecture arch,
+ unsigned long machine)
{
/* If this isn't the right architecture for this backend, and this
isn't the generic backend, fail. */
if (arch != get_elf_backend_data (abfd)->arch
&& arch != bfd_arch_unknown
&& get_elf_backend_data (abfd)->arch != bfd_arch_unknown)
- return false;
+ return FALSE;
return bfd_default_set_arch_mach (abfd, arch, machine);
}
@@ -5911,15 +6023,13 @@ _bfd_elf_set_arch_mach (abfd, arch, machine)
/* Find the function to a particular section and offset,
for error reporting. */
-static boolean
-elf_find_function (abfd, section, symbols, offset,
- filename_ptr, functionname_ptr)
- bfd *abfd ATTRIBUTE_UNUSED;
- asection *section;
- asymbol **symbols;
- bfd_vma offset;
- const char **filename_ptr;
- const char **functionname_ptr;
+static bfd_boolean
+elf_find_function (bfd *abfd ATTRIBUTE_UNUSED,
+ asection *section,
+ asymbol **symbols,
+ bfd_vma offset,
+ const char **filename_ptr,
+ const char **functionname_ptr)
{
const char *filename;
asymbol *func;
@@ -5960,31 +6070,29 @@ elf_find_function (abfd, section, symbols, offset,
}
if (func == NULL)
- return false;
+ return FALSE;
if (filename_ptr)
*filename_ptr = filename;
if (functionname_ptr)
*functionname_ptr = bfd_asymbol_name (func);
- return true;
+ return TRUE;
}
/* Find the nearest line to a particular section and offset,
for error reporting. */
-boolean
-_bfd_elf_find_nearest_line (abfd, section, symbols, offset,
- filename_ptr, functionname_ptr, line_ptr)
- bfd *abfd;
- asection *section;
- asymbol **symbols;
- bfd_vma offset;
- const char **filename_ptr;
- const char **functionname_ptr;
- unsigned int *line_ptr;
+bfd_boolean
+_bfd_elf_find_nearest_line (bfd *abfd,
+ asection *section,
+ asymbol **symbols,
+ bfd_vma offset,
+ const char **filename_ptr,
+ const char **functionname_ptr,
+ unsigned int *line_ptr)
{
- boolean found;
+ bfd_boolean found;
if (_bfd_dwarf1_find_nearest_line (abfd, section, symbols, offset,
filename_ptr, functionname_ptr,
@@ -5995,7 +6103,7 @@ _bfd_elf_find_nearest_line (abfd, section, symbols, offset,
*filename_ptr ? NULL : filename_ptr,
functionname_ptr);
- return true;
+ return TRUE;
}
if (_bfd_dwarf2_find_nearest_line (abfd, section, symbols, offset,
@@ -6008,32 +6116,30 @@ _bfd_elf_find_nearest_line (abfd, section, symbols, offset,
*filename_ptr ? NULL : filename_ptr,
functionname_ptr);
- return true;
+ 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;
+ return FALSE;
if (found && (*functionname_ptr || *line_ptr))
- return true;
+ return TRUE;
if (symbols == NULL)
- return false;
+ return FALSE;
if (! elf_find_function (abfd, section, symbols, offset,
filename_ptr, functionname_ptr))
- return false;
+ return FALSE;
*line_ptr = 0;
- return true;
+ return TRUE;
}
int
-_bfd_elf_sizeof_headers (abfd, reloc)
- bfd *abfd;
- boolean reloc;
+_bfd_elf_sizeof_headers (bfd *abfd, bfd_boolean reloc)
{
int ret;
@@ -6043,57 +6149,41 @@ _bfd_elf_sizeof_headers (abfd, reloc)
return ret;
}
-boolean
-_bfd_elf_set_section_contents (abfd, section, location, offset, count)
- bfd *abfd;
- sec_ptr section;
- PTR location;
- file_ptr offset;
- bfd_size_type count;
+bfd_boolean
+_bfd_elf_set_section_contents (bfd *abfd,
+ sec_ptr section,
+ const void *location,
+ file_ptr offset,
+ bfd_size_type count)
{
Elf_Internal_Shdr *hdr;
bfd_signed_vma pos;
if (! abfd->output_has_begun
- && ! (_bfd_elf_compute_section_file_positions
- (abfd, (struct bfd_link_info *) NULL)))
- return false;
+ && ! _bfd_elf_compute_section_file_positions (abfd, NULL))
+ return FALSE;
hdr = &elf_section_data (section)->this_hdr;
pos = hdr->sh_offset + offset;
if (bfd_seek (abfd, pos, SEEK_SET) != 0
|| bfd_bwrite (location, count, abfd) != count)
- return false;
+ return FALSE;
- return true;
-}
-
-void
-_bfd_elf_no_info_to_howto (abfd, cache_ptr, dst)
- bfd *abfd ATTRIBUTE_UNUSED;
- arelent *cache_ptr ATTRIBUTE_UNUSED;
- Elf_Internal_Rela *dst ATTRIBUTE_UNUSED;
-{
- abort ();
+ return TRUE;
}
-#if 0
void
-_bfd_elf_no_info_to_howto_rel (abfd, cache_ptr, dst)
- bfd *abfd;
- arelent *cache_ptr;
- Elf_Internal_Rel *dst;
+_bfd_elf_no_info_to_howto (bfd *abfd ATTRIBUTE_UNUSED,
+ arelent *cache_ptr ATTRIBUTE_UNUSED,
+ Elf_Internal_Rela *dst ATTRIBUTE_UNUSED)
{
abort ();
}
-#endif
/* Try to convert a non-ELF reloc into an ELF one. */
-boolean
-_bfd_elf_validate_reloc (abfd, areloc)
- bfd *abfd;
- arelent *areloc;
+bfd_boolean
+_bfd_elf_validate_reloc (bfd *abfd, arelent *areloc)
{
/* Check whether we really have an ELF howto. */
@@ -6176,19 +6266,18 @@ _bfd_elf_validate_reloc (abfd, areloc)
goto fail;
}
- return true;
+ return TRUE;
fail:
(*_bfd_error_handler)
(_("%s: unsupported relocation type %s"),
bfd_archive_filename (abfd), areloc->howto->name);
bfd_set_error (bfd_error_bad_value);
- return false;
+ return FALSE;
}
-boolean
-_bfd_elf_close_and_cleanup (abfd)
- bfd *abfd;
+bfd_boolean
+_bfd_elf_close_and_cleanup (bfd *abfd)
{
if (bfd_get_format (abfd) == bfd_object)
{
@@ -6205,14 +6294,11 @@ _bfd_elf_close_and_cleanup (abfd)
this reloc. */
bfd_reloc_status_type
-_bfd_elf_rel_vtable_reloc_fn (abfd, re, symbol, data, is, obfd, errmsg)
- bfd *abfd ATTRIBUTE_UNUSED;
- arelent *re ATTRIBUTE_UNUSED;
- struct symbol_cache_entry *symbol ATTRIBUTE_UNUSED;
- PTR data ATTRIBUTE_UNUSED;
- asection *is ATTRIBUTE_UNUSED;
- bfd *obfd ATTRIBUTE_UNUSED;
- char **errmsg ATTRIBUTE_UNUSED;
+_bfd_elf_rel_vtable_reloc_fn
+ (bfd *abfd ATTRIBUTE_UNUSED, arelent *re ATTRIBUTE_UNUSED,
+ struct bfd_symbol *symbol ATTRIBUTE_UNUSED,
+ void *data ATTRIBUTE_UNUSED, asection *is ATTRIBUTE_UNUSED,
+ bfd *obfd ATTRIBUTE_UNUSED, char **errmsg ATTRIBUTE_UNUSED)
{
return bfd_reloc_ok;
}
@@ -6229,8 +6315,7 @@ _bfd_elf_rel_vtable_reloc_fn (abfd, re, symbol, data, is, obfd, errmsg)
/* FIXME: this is kinda wrong, but it's what gdb wants. */
static int
-elfcore_make_pid (abfd)
- bfd *abfd;
+elfcore_make_pid (bfd *abfd)
{
return ((elf_tdata (abfd)->core_lwpid << 16)
+ (elf_tdata (abfd)->core_pid));
@@ -6241,26 +6326,23 @@ elfcore_make_pid (abfd)
reference to NAME, so you shouldn't deallocate or
overwrite it. */
-static boolean
-elfcore_maybe_make_sect (abfd, name, sect)
- bfd *abfd;
- char *name;
- asection *sect;
+static bfd_boolean
+elfcore_maybe_make_sect (bfd *abfd, char *name, asection *sect)
{
asection *sect2;
if (bfd_get_section_by_name (abfd, name) != NULL)
- return true;
+ return TRUE;
sect2 = bfd_make_section (abfd, name);
if (sect2 == NULL)
- return false;
+ return FALSE;
sect2->_raw_size = sect->_raw_size;
sect2->filepos = sect->filepos;
sect2->flags = sect->flags;
sect2->alignment_power = sect->alignment_power;
- return true;
+ return TRUE;
}
/* Create a pseudosection containing SIZE bytes at FILEPOS. This
@@ -6270,12 +6352,11 @@ elfcore_maybe_make_sect (abfd, name, sect)
- For the multi-threaded case, a section named "NAME/PID", where
PID is elfcore_make_pid (abfd).
Both pseudosections have identical contents. */
-boolean
-_bfd_elfcore_make_pseudosection (abfd, name, size, filepos)
- bfd *abfd;
- char *name;
- size_t size;
- ufile_ptr filepos;
+bfd_boolean
+_bfd_elfcore_make_pseudosection (bfd *abfd,
+ char *name,
+ size_t size,
+ ufile_ptr filepos)
{
char buf[100];
char *threaded_name;
@@ -6286,14 +6367,14 @@ _bfd_elfcore_make_pseudosection (abfd, name, size, filepos)
sprintf (buf, "%s/%d", name, elfcore_make_pid (abfd));
len = strlen (buf) + 1;
- threaded_name = bfd_alloc (abfd, (bfd_size_type) len);
+ threaded_name = bfd_alloc (abfd, len);
if (threaded_name == NULL)
- return false;
+ return FALSE;
memcpy (threaded_name, buf, len);
- sect = bfd_make_section (abfd, threaded_name);
+ sect = bfd_make_section_anyway (abfd, threaded_name);
if (sect == NULL)
- return false;
+ return FALSE;
sect->_raw_size = size;
sect->filepos = filepos;
sect->flags = SEC_HAS_CONTENTS;
@@ -6309,12 +6390,9 @@ _bfd_elfcore_make_pseudosection (abfd, name, size, filepos)
*/
#if defined (HAVE_PRSTATUS_T)
-static boolean elfcore_grok_prstatus PARAMS ((bfd *, Elf_Internal_Note *));
-static boolean
-elfcore_grok_prstatus (abfd, note)
- bfd *abfd;
- Elf_Internal_Note *note;
+static bfd_boolean
+elfcore_grok_prstatus (bfd *abfd, Elf_Internal_Note *note)
{
size_t raw_size;
int offset;
@@ -6374,7 +6452,7 @@ elfcore_grok_prstatus (abfd, note)
{
/* Fail - we don't know how to handle any other
note size (ie. data object type). */
- return true;
+ return TRUE;
}
/* Make a ".reg/999" section and a ".reg" section. */
@@ -6384,11 +6462,10 @@ elfcore_grok_prstatus (abfd, note)
#endif /* defined (HAVE_PRSTATUS_T) */
/* Create a pseudosection containing the exact contents of NOTE. */
-static boolean
-elfcore_make_note_pseudosection (abfd, name, note)
- bfd *abfd;
- char *name;
- Elf_Internal_Note *note;
+static bfd_boolean
+elfcore_make_note_pseudosection (bfd *abfd,
+ char *name,
+ Elf_Internal_Note *note)
{
return _bfd_elfcore_make_pseudosection (abfd, name,
note->descsz, note->descpos);
@@ -6398,10 +6475,8 @@ elfcore_make_note_pseudosection (abfd, name, note)
but it doesn't matter, because we don't have to pick this
data structure apart. */
-static boolean
-elfcore_grok_prfpreg (abfd, note)
- bfd *abfd;
- Elf_Internal_Note *note;
+static bfd_boolean
+elfcore_grok_prfpreg (bfd *abfd, Elf_Internal_Note *note)
{
return elfcore_make_note_pseudosection (abfd, ".reg2", note);
}
@@ -6410,10 +6485,8 @@ elfcore_grok_prfpreg (abfd, note)
type of 5 (NT_PRXFPREG). Just include the whole note's contents
literally. */
-static boolean
-elfcore_grok_prxfpreg (abfd, note)
- bfd *abfd;
- Elf_Internal_Note *note;
+static bfd_boolean
+elfcore_grok_prxfpreg (bfd *abfd, Elf_Internal_Note *note)
{
return elfcore_make_note_pseudosection (abfd, ".reg-xfp", note);
}
@@ -6437,10 +6510,7 @@ typedef psinfo32_t elfcore_psinfo32_t;
the copy will always have a terminating '\0'. */
char *
-_bfd_elfcore_strndup (abfd, start, max)
- bfd *abfd;
- char *start;
- size_t max;
+_bfd_elfcore_strndup (bfd *abfd, char *start, size_t max)
{
char *dups;
char *end = memchr (start, '\0', max);
@@ -6451,7 +6521,7 @@ _bfd_elfcore_strndup (abfd, start, max)
else
len = end - start;
- dups = bfd_alloc (abfd, (bfd_size_type) len + 1);
+ dups = bfd_alloc (abfd, len + 1);
if (dups == NULL)
return NULL;
@@ -6462,12 +6532,8 @@ _bfd_elfcore_strndup (abfd, start, max)
}
#if defined (HAVE_PRPSINFO_T) || defined (HAVE_PSINFO_T)
-static boolean elfcore_grok_psinfo PARAMS ((bfd *, Elf_Internal_Note *));
-
-static boolean
-elfcore_grok_psinfo (abfd, note)
- bfd *abfd;
- Elf_Internal_Note *note;
+static bfd_boolean
+elfcore_grok_psinfo (bfd *abfd, Elf_Internal_Note *note)
{
if (note->descsz == sizeof (elfcore_psinfo_t))
{
@@ -6505,7 +6571,7 @@ elfcore_grok_psinfo (abfd, note)
{
/* Fail - we don't know how to handle any other
note size (ie. data object type). */
- return true;
+ return TRUE;
}
/* Note that for some reason, a spurious space is tacked
@@ -6520,17 +6586,13 @@ elfcore_grok_psinfo (abfd, note)
command[n - 1] = '\0';
}
- return true;
+ return TRUE;
}
#endif /* defined (HAVE_PRPSINFO_T) || defined (HAVE_PSINFO_T) */
#if defined (HAVE_PSTATUS_T)
-static boolean elfcore_grok_pstatus PARAMS ((bfd *, Elf_Internal_Note *));
-
-static boolean
-elfcore_grok_pstatus (abfd, note)
- bfd *abfd;
- Elf_Internal_Note *note;
+static bfd_boolean
+elfcore_grok_pstatus (bfd *abfd, Elf_Internal_Note *note)
{
if (note->descsz == sizeof (pstatus_t)
#if defined (HAVE_PXSTATUS_T)
@@ -6559,17 +6621,13 @@ elfcore_grok_pstatus (abfd, note)
lwpstatus_t in pstat.pr_lwp, but we'll catch it all in an
NT_LWPSTATUS note, presumably. */
- return true;
+ return TRUE;
}
#endif /* defined (HAVE_PSTATUS_T) */
#if defined (HAVE_LWPSTATUS_T)
-static boolean elfcore_grok_lwpstatus PARAMS ((bfd *, Elf_Internal_Note *));
-
-static boolean
-elfcore_grok_lwpstatus (abfd, note)
- bfd *abfd;
- Elf_Internal_Note *note;
+static bfd_boolean
+elfcore_grok_lwpstatus (bfd *abfd, Elf_Internal_Note *note)
{
lwpstatus_t lwpstat;
char buf[100];
@@ -6582,7 +6640,7 @@ elfcore_grok_lwpstatus (abfd, note)
&& note->descsz != sizeof (lwpxstatus_t)
#endif
)
- return true;
+ return TRUE;
memcpy (&lwpstat, note->descdata, sizeof (lwpstat));
@@ -6593,14 +6651,14 @@ elfcore_grok_lwpstatus (abfd, note)
sprintf (buf, ".reg/%d", elfcore_make_pid (abfd));
len = strlen (buf) + 1;
- name = bfd_alloc (abfd, (bfd_size_type) len);
+ name = bfd_alloc (abfd, len);
if (name == NULL)
- return false;
+ return FALSE;
memcpy (name, buf, len);
- sect = bfd_make_section (abfd, name);
+ sect = bfd_make_section_anyway (abfd, name);
if (sect == NULL)
- return false;
+ return FALSE;
#if defined (HAVE_LWPSTATUS_T_PR_CONTEXT)
sect->_raw_size = sizeof (lwpstat.pr_context.uc_mcontext.gregs);
@@ -6617,20 +6675,20 @@ elfcore_grok_lwpstatus (abfd, note)
sect->alignment_power = 2;
if (!elfcore_maybe_make_sect (abfd, ".reg", sect))
- return false;
+ return FALSE;
/* Make a ".reg2/999" section */
sprintf (buf, ".reg2/%d", elfcore_make_pid (abfd));
len = strlen (buf) + 1;
- name = bfd_alloc (abfd, (bfd_size_type) len);
+ name = bfd_alloc (abfd, len);
if (name == NULL)
- return false;
+ return FALSE;
memcpy (name, buf, len);
- sect = bfd_make_section (abfd, name);
+ sect = bfd_make_section_anyway (abfd, name);
if (sect == NULL)
- return false;
+ return FALSE;
#if defined (HAVE_LWPSTATUS_T_PR_CONTEXT)
sect->_raw_size = sizeof (lwpstat.pr_context.uc_mcontext.fpregs);
@@ -6651,10 +6709,8 @@ elfcore_grok_lwpstatus (abfd, note)
#endif /* defined (HAVE_LWPSTATUS_T) */
#if defined (HAVE_WIN32_PSTATUS_T)
-static boolean
-elfcore_grok_win32pstatus (abfd, note)
- bfd *abfd;
- Elf_Internal_Note *note;
+static bfd_boolean
+elfcore_grok_win32pstatus (bfd *abfd, Elf_Internal_Note *note)
{
char buf[30];
char *name;
@@ -6663,7 +6719,7 @@ elfcore_grok_win32pstatus (abfd, note)
win32_pstatus_t pstatus;
if (note->descsz < sizeof (pstatus))
- return true;
+ return TRUE;
memcpy (&pstatus, note->descdata, sizeof (pstatus));
@@ -6680,15 +6736,15 @@ elfcore_grok_win32pstatus (abfd, note)
sprintf (buf, ".reg/%d", pstatus.data.thread_info.tid);
len = strlen (buf) + 1;
- name = bfd_alloc (abfd, (bfd_size_type) len);
+ name = bfd_alloc (abfd, len);
if (name == NULL)
- return false;
+ return FALSE;
memcpy (name, buf, len);
- sect = bfd_make_section (abfd, name);
+ sect = bfd_make_section_anyway (abfd, name);
if (sect == NULL)
- return false;
+ return FALSE;
sect->_raw_size = sizeof (pstatus.data.thread_info.thread_context);
sect->filepos = (note->descpos
@@ -6699,7 +6755,7 @@ elfcore_grok_win32pstatus (abfd, note)
if (pstatus.data.thread_info.is_active_thread)
if (! elfcore_maybe_make_sect (abfd, ".reg", sect))
- return false;
+ return FALSE;
break;
case NOTE_INFO_MODULE:
@@ -6707,16 +6763,16 @@ elfcore_grok_win32pstatus (abfd, note)
sprintf (buf, ".module/%08x", pstatus.data.module_info.base_address);
len = strlen (buf) + 1;
- name = bfd_alloc (abfd, (bfd_size_type) len);
+ name = bfd_alloc (abfd, len);
if (name == NULL)
- return false;
+ return FALSE;
memcpy (name, buf, len);
- sect = bfd_make_section (abfd, name);
+ sect = bfd_make_section_anyway (abfd, name);
if (sect == NULL)
- return false;
+ return FALSE;
sect->_raw_size = note->descsz;
sect->filepos = note->descpos;
@@ -6725,33 +6781,31 @@ elfcore_grok_win32pstatus (abfd, note)
break;
default:
- return true;
+ return TRUE;
}
- return true;
+ return TRUE;
}
#endif /* HAVE_WIN32_PSTATUS_T */
-static boolean
-elfcore_grok_note (abfd, note)
- bfd *abfd;
- Elf_Internal_Note *note;
+static bfd_boolean
+elfcore_grok_note (bfd *abfd, Elf_Internal_Note *note)
{
- struct elf_backend_data *bed = get_elf_backend_data (abfd);
+ const struct elf_backend_data *bed = get_elf_backend_data (abfd);
switch (note->type)
{
default:
- return true;
+ return TRUE;
case NT_PRSTATUS:
if (bed->elf_backend_grok_prstatus)
if ((*bed->elf_backend_grok_prstatus) (abfd, note))
- return true;
+ return TRUE;
#if defined (HAVE_PRSTATUS_T)
return elfcore_grok_prstatus (abfd, note);
#else
- return true;
+ return TRUE;
#endif
#if defined (HAVE_PSTATUS_T)
@@ -6773,29 +6827,41 @@ elfcore_grok_note (abfd, note)
#endif
case NT_PRXFPREG: /* Linux SSE extension */
- if (note->namesz == 5
- && ! strcmp (note->namedata, "LINUX"))
+ if (note->namesz == 6
+ && strcmp (note->namedata, "LINUX") == 0)
return elfcore_grok_prxfpreg (abfd, note);
else
- return true;
+ return TRUE;
case NT_PRPSINFO:
case NT_PSINFO:
if (bed->elf_backend_grok_psinfo)
if ((*bed->elf_backend_grok_psinfo) (abfd, note))
- return true;
+ return TRUE;
#if defined (HAVE_PRPSINFO_T) || defined (HAVE_PSINFO_T)
return elfcore_grok_psinfo (abfd, note);
#else
- return true;
+ return TRUE;
#endif
+
+ case NT_AUXV:
+ {
+ asection *sect = bfd_make_section_anyway (abfd, ".auxv");
+
+ if (sect == NULL)
+ return FALSE;
+ sect->_raw_size = note->descsz;
+ sect->filepos = note->descpos;
+ sect->flags = SEC_HAS_CONTENTS;
+ sect->alignment_power = 1 + bfd_get_arch_size (abfd) / 32;
+
+ return TRUE;
+ }
}
}
-static boolean
-elfcore_netbsd_get_lwpid (note, lwpidp)
- Elf_Internal_Note *note;
- int *lwpidp;
+static bfd_boolean
+elfcore_netbsd_get_lwpid (Elf_Internal_Note *note, int *lwpidp)
{
char *cp;
@@ -6803,15 +6869,13 @@ elfcore_netbsd_get_lwpid (note, lwpidp)
if (cp != NULL)
{
*lwpidp = atoi(cp + 1);
- return true;
+ return TRUE;
}
- return false;
+ return FALSE;
}
-static boolean
-elfcore_grok_netbsd_procinfo (abfd, note)
- bfd *abfd;
- Elf_Internal_Note *note;
+static bfd_boolean
+elfcore_grok_netbsd_procinfo (bfd *abfd, Elf_Internal_Note *note)
{
/* Signal number at offset 0x08. */
@@ -6826,13 +6890,12 @@ elfcore_grok_netbsd_procinfo (abfd, note)
elf_tdata (abfd)->core_command
= _bfd_elfcore_strndup (abfd, note->descdata + 0x7c, 31);
- return true;
+ return elfcore_make_note_pseudosection (abfd, ".note.netbsdcore.procinfo",
+ note);
}
-static boolean
-elfcore_grok_netbsd_note (abfd, note)
- bfd *abfd;
- Elf_Internal_Note *note;
+static bfd_boolean
+elfcore_grok_netbsd_note (bfd *abfd, Elf_Internal_Note *note)
{
int lwp;
@@ -6855,7 +6918,7 @@ elfcore_grok_netbsd_note (abfd, note)
understand it. */
if (note->type < NT_NETBSDCORE_FIRSTMACH)
- return true;
+ return TRUE;
switch (bfd_get_arch (abfd))
@@ -6874,7 +6937,7 @@ elfcore_grok_netbsd_note (abfd, note)
return elfcore_make_note_pseudosection (abfd, ".reg2", note);
default:
- return true;
+ return TRUE;
}
/* On all other arch's, PT_GETREGS == mach+1 and
@@ -6890,12 +6953,118 @@ elfcore_grok_netbsd_note (abfd, note)
return elfcore_make_note_pseudosection (abfd, ".reg2", note);
default:
- return true;
+ return TRUE;
}
}
/* NOTREACHED */
}
+static bfd_boolean
+elfcore_grok_nto_status (bfd *abfd, Elf_Internal_Note *note, pid_t *tid)
+{
+ void *ddata = note->descdata;
+ char buf[100];
+ char *name;
+ asection *sect;
+ short sig;
+ unsigned flags;
+
+ /* nto_procfs_status 'pid' field is at offset 0. */
+ elf_tdata (abfd)->core_pid = bfd_get_32 (abfd, (bfd_byte *) ddata);
+
+ /* nto_procfs_status 'tid' field is at offset 4. Pass it back. */
+ *tid = bfd_get_32 (abfd, (bfd_byte *) ddata + 4);
+
+ /* nto_procfs_status 'flags' field is at offset 8. */
+ flags = bfd_get_32 (abfd, (bfd_byte *) ddata + 8);
+
+ /* nto_procfs_status 'what' field is at offset 14. */
+ if ((sig = bfd_get_16 (abfd, (bfd_byte *) ddata + 14)) > 0)
+ {
+ elf_tdata (abfd)->core_signal = sig;
+ elf_tdata (abfd)->core_lwpid = *tid;
+ }
+
+ /* _DEBUG_FLAG_CURTID (current thread) is 0x80. Some cores
+ do not come from signals so we make sure we set the current
+ thread just in case. */
+ if (flags & 0x00000080)
+ elf_tdata (abfd)->core_lwpid = *tid;
+
+ /* Make a ".qnx_core_status/%d" section. */
+ sprintf (buf, ".qnx_core_status/%d", *tid);
+
+ name = bfd_alloc (abfd, strlen (buf) + 1);
+ if (name == NULL)
+ return FALSE;
+ strcpy (name, buf);
+
+ sect = bfd_make_section_anyway (abfd, name);
+ if (sect == NULL)
+ return FALSE;
+
+ sect->_raw_size = note->descsz;
+ sect->filepos = note->descpos;
+ sect->flags = SEC_HAS_CONTENTS;
+ sect->alignment_power = 2;
+
+ return (elfcore_maybe_make_sect (abfd, ".qnx_core_status", sect));
+}
+
+static bfd_boolean
+elfcore_grok_nto_gregs (bfd *abfd, Elf_Internal_Note *note, pid_t tid)
+{
+ char buf[100];
+ char *name;
+ asection *sect;
+
+ /* Make a ".reg/%d" section. */
+ sprintf (buf, ".reg/%d", tid);
+
+ name = bfd_alloc (abfd, strlen (buf) + 1);
+ if (name == NULL)
+ return FALSE;
+ strcpy (name, buf);
+
+ sect = bfd_make_section_anyway (abfd, name);
+ if (sect == NULL)
+ return FALSE;
+
+ sect->_raw_size = note->descsz;
+ sect->filepos = note->descpos;
+ sect->flags = SEC_HAS_CONTENTS;
+ sect->alignment_power = 2;
+
+ /* This is the current thread. */
+ if (elf_tdata (abfd)->core_lwpid == tid)
+ return elfcore_maybe_make_sect (abfd, ".reg", sect);
+
+ return TRUE;
+}
+
+#define BFD_QNT_CORE_INFO 7
+#define BFD_QNT_CORE_STATUS 8
+#define BFD_QNT_CORE_GREG 9
+#define BFD_QNT_CORE_FPREG 10
+
+static bfd_boolean
+elfcore_grok_nto_note (bfd *abfd, Elf_Internal_Note *note)
+{
+ /* Every GREG section has a STATUS section before it. Store the
+ tid from the previous call to pass down to the next gregs
+ function. */
+ static pid_t tid = 1;
+
+ switch (note->type)
+ {
+ case BFD_QNT_CORE_INFO: return elfcore_make_note_pseudosection (abfd, ".qnx_core_info", note);
+ case BFD_QNT_CORE_STATUS: return elfcore_grok_nto_status (abfd, note, &tid);
+ case BFD_QNT_CORE_GREG: return elfcore_grok_nto_gregs (abfd, note, tid);
+ case BFD_QNT_CORE_FPREG: return elfcore_grok_prfpreg (abfd, note);
+ default: return TRUE;
+ }
+}
+
/* Function: elfcore_write_note
Inputs:
@@ -6909,14 +7078,13 @@ elfcore_grok_netbsd_note (abfd, note)
End of buffer containing note. */
char *
-elfcore_write_note (abfd, buf, bufsiz, name, type, input, size)
- bfd *abfd;
- char *buf;
- int *bufsiz;
- const char *name;
- int type;
- const PTR input;
- int size;
+elfcore_write_note (bfd *abfd,
+ char *buf,
+ int *bufsiz,
+ const char *name,
+ int type,
+ const void *input,
+ int size)
{
Elf_External_Note *xnp;
size_t namesz;
@@ -6928,14 +7096,14 @@ elfcore_write_note (abfd, buf, bufsiz, name, type, input, size)
pad = 0;
if (name != NULL)
{
- struct elf_backend_data *bed;
+ const struct elf_backend_data *bed;
namesz = strlen (name) + 1;
bed = get_elf_backend_data (abfd);
- pad = -namesz & (bed->s->file_align - 1);
+ pad = -namesz & ((1 << bed->s->log_file_align) - 1);
}
- newspace = sizeof (Elf_External_Note) - 1 + namesz + pad + size;
+ newspace = 12 + namesz + pad + size;
p = realloc (buf, *bufsiz + newspace);
dest = p + *bufsiz;
@@ -6961,12 +7129,11 @@ elfcore_write_note (abfd, buf, bufsiz, name, type, input, size)
#if defined (HAVE_PRPSINFO_T) || defined (HAVE_PSINFO_T)
char *
-elfcore_write_prpsinfo (abfd, buf, bufsiz, fname, psargs)
- bfd *abfd;
- char *buf;
- int *bufsiz;
- const char *fname;
- const char *psargs;
+elfcore_write_prpsinfo (bfd *abfd,
+ char *buf,
+ int *bufsiz,
+ const char *fname,
+ const char *psargs)
{
int note_type;
char *note_name = "CORE";
@@ -6989,13 +7156,12 @@ elfcore_write_prpsinfo (abfd, buf, bufsiz, fname, psargs)
#if defined (HAVE_PRSTATUS_T)
char *
-elfcore_write_prstatus (abfd, buf, bufsiz, pid, cursig, gregs)
- bfd *abfd;
- char *buf;
- int *bufsiz;
- long pid;
- int cursig;
- const PTR gregs;
+elfcore_write_prstatus (bfd *abfd,
+ char *buf,
+ int *bufsiz,
+ long pid,
+ int cursig,
+ const void *gregs)
{
prstatus_t prstat;
char *note_name = "CORE";
@@ -7011,13 +7177,12 @@ elfcore_write_prstatus (abfd, buf, bufsiz, pid, cursig, gregs)
#if defined (HAVE_LWPSTATUS_T)
char *
-elfcore_write_lwpstatus (abfd, buf, bufsiz, pid, cursig, gregs)
- bfd *abfd;
- char *buf;
- int *bufsiz;
- long pid;
- int cursig;
- const PTR gregs;
+elfcore_write_lwpstatus (bfd *abfd,
+ char *buf,
+ int *bufsiz,
+ long pid,
+ int cursig,
+ const void *gregs)
{
lwpstatus_t lwpstat;
char *note_name = "CORE";
@@ -7043,13 +7208,12 @@ elfcore_write_lwpstatus (abfd, buf, bufsiz, pid, cursig, gregs)
#if defined (HAVE_PSTATUS_T)
char *
-elfcore_write_pstatus (abfd, buf, bufsiz, pid, cursig, gregs)
- bfd *abfd;
- char *buf;
- int *bufsiz;
- long pid;
- int cursig;
- const PTR gregs;
+elfcore_write_pstatus (bfd *abfd,
+ char *buf,
+ int *bufsiz,
+ long pid,
+ int cursig,
+ const void *gregs)
{
pstatus_t pstat;
char *note_name = "CORE";
@@ -7063,12 +7227,11 @@ elfcore_write_pstatus (abfd, buf, bufsiz, pid, cursig, gregs)
#endif /* HAVE_PSTATUS_T */
char *
-elfcore_write_prfpreg (abfd, buf, bufsiz, fpregs, size)
- bfd *abfd;
- char *buf;
- int *bufsiz;
- const PTR fpregs;
- int size;
+elfcore_write_prfpreg (bfd *abfd,
+ char *buf,
+ int *bufsiz,
+ const void *fpregs,
+ int size)
{
char *note_name = "CORE";
return elfcore_write_note (abfd, buf, bufsiz,
@@ -7076,42 +7239,38 @@ elfcore_write_prfpreg (abfd, buf, bufsiz, fpregs, size)
}
char *
-elfcore_write_prxfpreg (abfd, buf, bufsiz, xfpregs, size)
- bfd *abfd;
- char *buf;
- int *bufsiz;
- const PTR xfpregs;
- int size;
+elfcore_write_prxfpreg (bfd *abfd,
+ char *buf,
+ int *bufsiz,
+ const void *xfpregs,
+ int size)
{
char *note_name = "LINUX";
return elfcore_write_note (abfd, buf, bufsiz,
note_name, NT_PRXFPREG, xfpregs, size);
}
-static boolean
-elfcore_read_notes (abfd, offset, size)
- bfd *abfd;
- file_ptr offset;
- bfd_size_type size;
+static bfd_boolean
+elfcore_read_notes (bfd *abfd, file_ptr offset, bfd_size_type size)
{
char *buf;
char *p;
if (size <= 0)
- return true;
+ return TRUE;
if (bfd_seek (abfd, offset, SEEK_SET) != 0)
- return false;
+ return FALSE;
buf = bfd_malloc (size);
if (buf == NULL)
- return false;
+ return FALSE;
if (bfd_bread (buf, size, abfd) != size)
{
error:
free (buf);
- return false;
+ return FALSE;
}
p = buf;
@@ -7135,6 +7294,11 @@ elfcore_read_notes (abfd, offset, size)
if (! elfcore_grok_netbsd_note (abfd, &in))
goto error;
}
+ else if (strncmp (in.namedata, "QNX", 3) == 0)
+ {
+ if (! elfcore_grok_nto_note (abfd, &in))
+ goto error;
+ }
else
{
if (! elfcore_grok_note (abfd, &in))
@@ -7145,7 +7309,7 @@ elfcore_read_notes (abfd, offset, size)
}
free (buf);
- return true;
+ return TRUE;
}
/* Providing external access to the ELF program header table. */
@@ -7155,8 +7319,7 @@ elfcore_read_notes (abfd, offset, size)
occurs; bfd_get_error will return an appropriate code. */
long
-bfd_get_elf_phdr_upper_bound (abfd)
- bfd *abfd;
+bfd_get_elf_phdr_upper_bound (bfd *abfd)
{
if (abfd->xvec->flavour != bfd_target_elf_flavour)
{
@@ -7176,9 +7339,7 @@ bfd_get_elf_phdr_upper_bound (abfd)
error occurs; bfd_get_error will return an appropriate code. */
int
-bfd_get_elf_phdrs (abfd, phdrs)
- bfd *abfd;
- void *phdrs;
+bfd_get_elf_phdrs (bfd *abfd, void *phdrs)
{
int num_phdrs;
@@ -7196,10 +7357,7 @@ bfd_get_elf_phdrs (abfd, phdrs)
}
void
-_bfd_elf_sprintf_vma (abfd, buf, value)
- bfd *abfd ATTRIBUTE_UNUSED;
- char *buf;
- bfd_vma value;
+_bfd_elf_sprintf_vma (bfd *abfd ATTRIBUTE_UNUSED, char *buf, bfd_vma value)
{
#ifdef BFD64
Elf_Internal_Ehdr *i_ehdrp; /* Elf file header, internal form */
@@ -7227,10 +7385,7 @@ _bfd_elf_sprintf_vma (abfd, buf, value)
}
void
-_bfd_elf_fprintf_vma (abfd, stream, value)
- bfd *abfd ATTRIBUTE_UNUSED;
- PTR stream;
- bfd_vma value;
+_bfd_elf_fprintf_vma (bfd *abfd ATTRIBUTE_UNUSED, void *stream, bfd_vma value)
{
#ifdef BFD64
Elf_Internal_Ehdr *i_ehdrp; /* Elf file header, internal form */
@@ -7259,8 +7414,7 @@ _bfd_elf_fprintf_vma (abfd, stream, value)
}
enum elf_reloc_type_class
-_bfd_elf_reloc_type_class (rela)
- const Elf_Internal_Rela *rela ATTRIBUTE_UNUSED;
+_bfd_elf_reloc_type_class (const Elf_Internal_Rela *rela ATTRIBUTE_UNUSED)
{
return reloc_class_normal;
}
@@ -7269,12 +7423,12 @@ _bfd_elf_reloc_type_class (rela)
relocation against a local symbol. */
bfd_vma
-_bfd_elf_rela_local_sym (abfd, sym, sec, rel)
- bfd *abfd;
- Elf_Internal_Sym *sym;
- asection *sec;
- Elf_Internal_Rela *rel;
+_bfd_elf_rela_local_sym (bfd *abfd,
+ Elf_Internal_Sym *sym,
+ asection **psec,
+ Elf_Internal_Rela *rel)
{
+ asection *sec = *psec;
bfd_vma relocation;
relocation = (sec->output_section->vma
@@ -7282,58 +7436,78 @@ _bfd_elf_rela_local_sym (abfd, sym, sec, rel)
+ sym->st_value);
if ((sec->flags & SEC_MERGE)
&& ELF_ST_TYPE (sym->st_info) == STT_SECTION
- && elf_section_data (sec)->sec_info_type == ELF_INFO_TYPE_MERGE)
+ && sec->sec_info_type == ELF_INFO_TYPE_MERGE)
{
- asection *msec;
-
- msec = sec;
rel->r_addend =
- _bfd_merged_section_offset (abfd, &msec,
+ _bfd_merged_section_offset (abfd, psec,
elf_section_data (sec)->sec_info,
sym->st_value + rel->r_addend,
- (bfd_vma) 0)
- - relocation;
- rel->r_addend += msec->output_section->vma + msec->output_offset;
+ 0);
+ sec = *psec;
+ rel->r_addend -= relocation;
+ rel->r_addend += sec->output_section->vma + sec->output_offset;
}
return relocation;
}
bfd_vma
-_bfd_elf_rel_local_sym (abfd, sym, psec, addend)
- bfd *abfd;
- Elf_Internal_Sym *sym;
- asection **psec;
- bfd_vma addend;
+_bfd_elf_rel_local_sym (bfd *abfd,
+ Elf_Internal_Sym *sym,
+ asection **psec,
+ bfd_vma addend)
{
asection *sec = *psec;
- if (elf_section_data (sec)->sec_info_type != ELF_INFO_TYPE_MERGE)
+ if (sec->sec_info_type != ELF_INFO_TYPE_MERGE)
return sym->st_value + addend;
return _bfd_merged_section_offset (abfd, psec,
elf_section_data (sec)->sec_info,
- sym->st_value + addend, (bfd_vma) 0);
+ sym->st_value + addend, 0);
}
bfd_vma
-_bfd_elf_section_offset (abfd, info, sec, offset)
- bfd *abfd;
- struct bfd_link_info *info;
- asection *sec;
- bfd_vma offset;
+_bfd_elf_section_offset (bfd *abfd,
+ struct bfd_link_info *info,
+ asection *sec,
+ bfd_vma offset)
{
struct bfd_elf_section_data *sec_data;
sec_data = elf_section_data (sec);
- switch (sec_data->sec_info_type)
+ 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 (abfd,
+ &elf_hash_table (info)->merge_info,
+ sec, &sec_data->sec_info, offset);
case ELF_INFO_TYPE_EH_FRAME:
return _bfd_elf_eh_frame_section_offset (abfd, sec, offset);
default:
return offset;
}
}
+
+/* Create a new BFD as if by bfd_openr. Rather than opening a file,
+ reconstruct an ELF file by reading the segments out of remote memory
+ based on the ELF file header at EHDR_VMA and the ELF program headers it
+ points to. If not null, *LOADBASEP is filled in with the difference
+ between the VMAs from which the segments were read, and the VMAs the
+ file headers (and hence BFD's idea of each section's VMA) put them at.
+
+ The function TARGET_READ_MEMORY is called to copy LEN bytes from the
+ remote memory at target address VMA into the local buffer at MYADDR; it
+ should return zero on success or an `errno' code on failure. TEMPL must
+ be a BFD for an ELF target with the word size and byte order found in
+ the remote memory. */
+
+bfd *
+bfd_elf_bfd_from_remote_memory
+ (bfd *templ,
+ bfd_vma ehdr_vma,
+ bfd_vma *loadbasep,
+ int (*target_read_memory) (bfd_vma, char *, int))
+{
+ return (*get_elf_backend_data (templ)->elf_backend_bfd_from_remote_memory)
+ (templ, ehdr_vma, loadbasep, target_read_memory);
+}
diff --git a/contrib/binutils/bfd/elf32-arc.c b/contrib/binutils/bfd/elf32-arc.c
index ff5c5f4..27c1639 100644
--- a/contrib/binutils/bfd/elf32-arc.c
+++ b/contrib/binutils/bfd/elf32-arc.c
@@ -1,5 +1,6 @@
/* ARC-specific support for 32-bit ELF
- Copyright 1994, 1995, 1997, 1999, 2001 Free Software Foundation, Inc.
+ Copyright 1994, 1995, 1997, 1999, 2001, 2002
+ Free Software Foundation, Inc.
Contributed by Doug Evans (dje@cygnus.com).
This file is part of BFD, the Binary File Descriptor library.
@@ -28,18 +29,18 @@
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 *, Elf32_Internal_Rel *));
-static boolean arc_elf_object_p
+ PARAMS ((bfd *, arelent *, Elf_Internal_Rela *));
+static bfd_boolean arc_elf_object_p
PARAMS ((bfd *));
static void arc_elf_final_write_processing
- PARAMS ((bfd *, boolean));
+ 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
+#define USE_REL 1
static reloc_howto_type elf_arc_howto_table[] =
{
@@ -48,60 +49,60 @@ static reloc_howto_type elf_arc_howto_table[] =
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
32, /* bitsize */
- false, /* pc_relative */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_ARC_NONE", /* name */
- true, /* partial_inplace */
+ TRUE, /* partial_inplace */
0, /* src_mask */
0, /* dst_mask */
- false), /* pcrel_offset */
+ 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 */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_ARC_32", /* name */
- true, /* partial_inplace */
+ TRUE, /* partial_inplace */
0xffffffff, /* src_mask */
0xffffffff, /* dst_mask */
- false), /* pcrel_offset */
+ 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 */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_ARC_B26", /* name */
- true, /* partial_inplace */
+ TRUE, /* partial_inplace */
0x00ffffff, /* src_mask */
0x00ffffff, /* dst_mask */
- false), /* pcrel_offset */
+ 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 */
+ 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 */
+ TRUE, /* partial_inplace */
0x07ffff80, /* src_mask */
0x07ffff80, /* dst_mask */
- false), /* pcrel_offset */
+ FALSE), /* pcrel_offset */
};
/* Map BFD reloc types to ARC ELF reloc types. */
@@ -141,7 +142,7 @@ static void
arc_info_to_howto_rel (abfd, cache_ptr, dst)
bfd *abfd ATTRIBUTE_UNUSED;
arelent *cache_ptr;
- Elf32_Internal_Rel *dst;
+ Elf_Internal_Rela *dst;
{
unsigned int r_type;
@@ -152,7 +153,7 @@ arc_info_to_howto_rel (abfd, cache_ptr, dst)
/* Set the right machine number for an ARC ELF file. */
-static boolean
+static bfd_boolean
arc_elf_object_p (abfd)
bfd *abfd;
{
@@ -188,7 +189,7 @@ arc_elf_object_p (abfd)
static void
arc_elf_final_write_processing (abfd, linker)
bfd *abfd;
- boolean linker ATTRIBUTE_UNUSED;
+ bfd_boolean linker ATTRIBUTE_UNUSED;
{
unsigned long val;
@@ -225,7 +226,7 @@ arc_elf_b22_pcrel (abfd, reloc_entry, symbol, data, input_section,
{
/* 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
+ 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)
diff --git a/contrib/binutils/bfd/elf32-arm.h b/contrib/binutils/bfd/elf32-arm.h
index bb193ab..8c1acc0 100644
--- a/contrib/binutils/bfd/elf32-arm.h
+++ b/contrib/binutils/bfd/elf32-arm.h
@@ -1,5 +1,6 @@
/* 32-bit ELF support for ARM
- Copyright 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
+ Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2004
+ Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@@ -17,16 +18,20 @@
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 boolean elf32_arm_set_private_flags
+static bfd_boolean elf32_arm_set_private_flags
PARAMS ((bfd *, flagword));
-static boolean elf32_arm_copy_private_bfd_data
+static bfd_boolean elf32_arm_copy_private_bfd_data
PARAMS ((bfd *, bfd *));
-static boolean elf32_arm_merge_private_bfd_data
+static bfd_boolean elf32_arm_merge_private_bfd_data
PARAMS ((bfd *, bfd *));
-static boolean elf32_arm_print_private_bfd_data
+static bfd_boolean elf32_arm_print_private_bfd_data
PARAMS ((bfd *, PTR));
static int elf32_arm_get_symbol_type
PARAMS (( Elf_Internal_Sym *, int));
@@ -42,10 +47,6 @@ 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 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 *));
static void elf32_arm_post_process_headers
PARAMS ((bfd *, struct bfd_link_info *));
static int elf32_arm_to_thumb_stub
@@ -54,45 +55,60 @@ static int elf32_arm_to_thumb_stub
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 boolean elf32_arm_relocate_section
+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 boolean elf32_arm_gc_sweep_hook
+static bfd_boolean elf32_arm_gc_sweep_hook
PARAMS ((bfd *, struct bfd_link_info *, asection *,
const Elf_Internal_Rela *));
-static boolean elf32_arm_check_relocs
+static bfd_boolean elf32_arm_check_relocs
PARAMS ((bfd *, struct bfd_link_info *, asection *,
const Elf_Internal_Rela *));
-static boolean elf32_arm_find_nearest_line
+static bfd_boolean elf32_arm_find_nearest_line
PARAMS ((bfd *, asection *, asymbol **, bfd_vma, const char **,
const char **, unsigned int *));
-static boolean elf32_arm_adjust_dynamic_symbol
+static bfd_boolean elf32_arm_adjust_dynamic_symbol
PARAMS ((struct bfd_link_info *, struct elf_link_hash_entry *));
-static boolean elf32_arm_size_dynamic_sections
+static bfd_boolean elf32_arm_size_dynamic_sections
PARAMS ((bfd *, struct bfd_link_info *));
-static boolean elf32_arm_finish_dynamic_symbol
+static bfd_boolean elf32_arm_finish_dynamic_symbol
PARAMS ((bfd *, struct bfd_link_info *, struct elf_link_hash_entry *,
Elf_Internal_Sym *));
-static boolean elf32_arm_finish_dynamic_sections
+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 *));
-#ifdef USE_REL
+#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 *));
-boolean bfd_elf32_arm_allocate_interworking_sections
+#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 *));
-boolean bfd_elf32_arm_get_bfd_for_interworking
+bfd_boolean bfd_elf32_arm_get_bfd_for_interworking
PARAMS ((bfd *, struct bfd_link_info *));
-boolean bfd_elf32_arm_process_before_allocation
+bfd_boolean bfd_elf32_arm_process_before_allocation
PARAMS ((bfd *, struct bfd_link_info *, int));
-static enum elf_reloc_type_class elf32_arm_reloc_type_class
- PARAMS ((const Elf_Internal_Rela *));
+#endif
+
#define INTERWORK_FLAG(abfd) (elf_elfheader (abfd)->e_flags & EF_ARM_INTERWORK)
@@ -110,6 +126,12 @@ static enum elf_reloc_type_class elf32_arm_reloc_type_class
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
@@ -117,23 +139,56 @@ static enum elf_reloc_type_class elf32_arm_reloc_type_class
this. It is set up so that any shared library function that is
called before the relocation has been set up calls the dynamic
linker first. */
-static const bfd_vma elf32_arm_plt0_entry [PLT_ENTRY_SIZE / 4] =
+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]! */
- 0xe59fe010, /* ldr lr, [pc, #16] */
- 0xe08fe00e, /* add lr, pc, lr */
- 0xe5bef008 /* ldr pc, [lr, #8]! */
+ 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] =
- {
- 0xe59fc004, /* ldr ip, [pc, #4] */
- 0xe08fc00c, /* add ip, pc, ip */
- 0xe59cf000, /* ldr pc, [ip] */
- 0x00000000 /* offset to symbol in got */
- };
+ {
+ 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
@@ -143,10 +198,10 @@ static const bfd_vma elf32_arm_plt_entry [PLT_ENTRY_SIZE / 4] =
/* This structure keeps track of the number of PC relative relocs we
have copied for a given symbol. */
-struct elf32_arm_pcrel_relocs_copied
+struct elf32_arm_relocs_copied
{
/* Next section. */
- struct elf32_arm_pcrel_relocs_copied * next;
+ struct elf32_arm_relocs_copied * next;
/* A section in dynobj. */
asection * section;
/* Number of relocs copied in this section. */
@@ -159,18 +214,14 @@ struct elf32_arm_link_hash_entry
struct elf_link_hash_entry root;
/* Number of PC relative relocs copied for this symbol. */
- struct elf32_arm_pcrel_relocs_copied * pcrel_relocs_copied;
+ struct elf32_arm_relocs_copied * relocs_copied;
};
-/* Declare this now that the above structures are defined. */
-static boolean elf32_arm_discard_copies
- PARAMS ((struct elf32_arm_link_hash_entry *, PTR));
-
/* Traverse an arm ELF linker hash table. */
#define elf32_arm_link_hash_traverse(table, func, info) \
(elf_link_hash_traverse \
(&(table)->root, \
- (boolean (*) PARAMS ((struct elf_link_hash_entry *, PTR))) (func), \
+ (bfd_boolean (*) PARAMS ((struct elf_link_hash_entry *, PTR))) (func), \
(info)))
/* Get the ARM elf linker hash table from a link_info structure. */
@@ -183,18 +234,30 @@ struct elf32_arm_link_hash_table
/* The main hash table. */
struct elf_link_hash_table root;
- /* The size in bytes of the section containg the Thumb-to-ARM glue. */
+ /* 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 containg the ARM-to-Thumb glue. */
+ /* The size in bytes of the section containing the ARM-to-Thumb glue. */
bfd_size_type arm_glue_size;
- /* An arbitary input BFD chosen to hold the glue sections. */
+ /* 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. */
@@ -222,11 +285,120 @@ elf32_arm_link_hash_newfunc (entry, table, string)
_bfd_elf_link_hash_newfunc ((struct bfd_hash_entry *) ret,
table, string));
if (ret != (struct elf32_arm_link_hash_entry *) NULL)
- ret->pcrel_relocs_copied = 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 *
@@ -247,10 +419,18 @@ elf32_arm_link_hash_table_create (abfd)
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;
}
@@ -278,7 +458,7 @@ find_thumb_glue (link_info, name, input_bfd)
sprintf (tmp_name, THUMB2ARM_GLUE_ENTRY_NAME, name);
hash = elf_link_hash_lookup
- (&(hash_table)->root, tmp_name, false, false, true);
+ (&(hash_table)->root, tmp_name, FALSE, FALSE, TRUE);
if (hash == NULL)
/* xgettext:c-format */
@@ -313,7 +493,7 @@ find_arm_glue (link_info, name, input_bfd)
sprintf (tmp_name, ARM2THUMB_GLUE_ENTRY_NAME, name);
myh = elf_link_hash_lookup
- (&(hash_table)->root, tmp_name, false, false, true);
+ (&(hash_table)->root, tmp_name, FALSE, FALSE, TRUE);
if (myh == NULL)
/* xgettext:c-format */
@@ -360,14 +540,8 @@ static const insn16 t2a1_bx_pc_insn = 0x4778;
static const insn16 t2a2_noop_insn = 0x46c0;
static const insn32 t2a3_b_insn = 0xea000000;
-static const insn16 t2a1_push_insn = 0xb540;
-static const insn16 t2a2_ldr_insn = 0x4e03;
-static const insn16 t2a3_mov_insn = 0x46fe;
-static const insn16 t2a4_bx_insn = 0x4730;
-static const insn32 t2a5_pop_insn = 0xe8bd4040;
-static const insn32 t2a6_bx_insn = 0xe12fff1e;
-
-boolean
+#ifndef ELFARM_NABI_C_INCLUDED
+bfd_boolean
bfd_elf32_arm_allocate_interworking_sections (info)
struct bfd_link_info * info;
{
@@ -411,7 +585,7 @@ bfd_elf32_arm_allocate_interworking_sections (info)
s->contents = foo;
}
- return true;
+ return TRUE;
}
static void
@@ -445,7 +619,7 @@ record_arm_to_thumb_glue (link_info, h)
sprintf (tmp_name, ARM2THUMB_GLUE_ENTRY_NAME, name);
myh = elf_link_hash_lookup
- (&(globals)->root, tmp_name, false, false, true);
+ (&(globals)->root, tmp_name, FALSE, FALSE, TRUE);
if (myh != NULL)
{
@@ -461,7 +635,7 @@ record_arm_to_thumb_glue (link_info, h)
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);
+ NULL, TRUE, FALSE, &bh);
free (tmp_name);
@@ -502,7 +676,7 @@ record_thumb_to_arm_glue (link_info, h)
sprintf (tmp_name, THUMB2ARM_GLUE_ENTRY_NAME, name);
myh = elf_link_hash_lookup
- (&(hash_table)->root, tmp_name, false, false, true);
+ (&(hash_table)->root, tmp_name, FALSE, FALSE, TRUE);
if (myh != NULL)
{
@@ -515,7 +689,7 @@ record_thumb_to_arm_glue (link_info, h)
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);
+ NULL, TRUE, FALSE, &bh);
/* If we mark it 'Thumb', the disassembler will do a better job. */
myh = (struct elf_link_hash_entry *) bh;
@@ -539,7 +713,7 @@ record_thumb_to_arm_glue (link_info, h)
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);
+ NULL, TRUE, FALSE, &bh);
free (tmp_name);
@@ -551,7 +725,7 @@ record_thumb_to_arm_glue (link_info, h)
/* Add the glue sections to ABFD. This function is called from the
linker scripts in ld/emultempl/{armelf}.em. */
-boolean
+bfd_boolean
bfd_elf32_arm_add_glue_sections_to_bfd (abfd, info)
bfd *abfd;
struct bfd_link_info *info;
@@ -561,8 +735,8 @@ bfd_elf32_arm_add_glue_sections_to_bfd (abfd, info)
/* If we are only performing a partial
link do not bother adding the glue. */
- if (info->relocateable)
- return true;
+ if (info->relocatable)
+ return TRUE;
sec = bfd_get_section_by_name (abfd, ARM2THUMB_GLUE_SECTION_NAME);
@@ -578,7 +752,7 @@ bfd_elf32_arm_add_glue_sections_to_bfd (abfd, info)
if (sec == NULL
|| !bfd_set_section_flags (abfd, sec, flags)
|| !bfd_set_section_alignment (abfd, sec, 2))
- return false;
+ 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. */
@@ -596,19 +770,19 @@ bfd_elf32_arm_add_glue_sections_to_bfd (abfd, info)
if (sec == NULL
|| !bfd_set_section_flags (abfd, sec, flags)
|| !bfd_set_section_alignment (abfd, sec, 2))
- return false;
+ return FALSE;
sec->gc_mark = 1;
}
- return true;
+ 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 */
-boolean
+bfd_boolean
bfd_elf32_arm_get_bfd_for_interworking (abfd, info)
bfd *abfd;
struct bfd_link_info *info;
@@ -617,23 +791,23 @@ bfd_elf32_arm_get_bfd_for_interworking (abfd, info)
/* If we are only performing a partial link
do not bother getting a bfd to hold the glue. */
- if (info->relocateable)
- return true;
+ if (info->relocatable)
+ return TRUE;
globals = elf32_arm_hash_table (info);
BFD_ASSERT (globals != NULL);
if (globals->bfd_of_glue_owner != NULL)
- return true;
+ return TRUE;
/* Save the bfd for later use. */
globals->bfd_of_glue_owner = abfd;
- return true;
+ return TRUE;
}
-boolean
+bfd_boolean
bfd_elf32_arm_process_before_allocation (abfd, link_info, no_pipeline_knowledge)
bfd *abfd;
struct bfd_link_info *link_info;
@@ -649,8 +823,8 @@ bfd_elf32_arm_process_before_allocation (abfd, link_info, no_pipeline_knowledge)
/* If we are only performing a partial link do not bother
to construct any glue. */
- if (link_info->relocateable)
- return true;
+ 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. */
@@ -665,7 +839,7 @@ bfd_elf32_arm_process_before_allocation (abfd, link_info, no_pipeline_knowledge)
sec = abfd->sections;
if (sec == NULL)
- return true;
+ return TRUE;
for (; sec != NULL; sec = sec->next)
{
@@ -676,8 +850,8 @@ bfd_elf32_arm_process_before_allocation (abfd, link_info, no_pipeline_knowledge)
/* Load the relocs. */
internal_relocs
- = _bfd_elf32_link_read_relocs (abfd, sec, (PTR) NULL,
- (Elf_Internal_Rela *) NULL, false);
+ = _bfd_elf_link_read_relocs (abfd, sec, (PTR) NULL,
+ (Elf_Internal_Rela *) NULL, FALSE);
if (internal_relocs == NULL)
goto error_return;
@@ -768,7 +942,7 @@ bfd_elf32_arm_process_before_allocation (abfd, link_info, no_pipeline_knowledge)
internal_relocs = NULL;
}
- return true;
+ return TRUE;
error_return:
if (contents != NULL
@@ -778,8 +952,9 @@ error_return:
&& elf_section_data (sec)->relocs != internal_relocs)
free (internal_relocs);
- return false;
+ 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
@@ -788,7 +963,7 @@ error_return:
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 (identifed by
+ 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).
@@ -862,7 +1037,7 @@ elf32_thumb_to_arm_stub (info, name, input_bfd, output_bfd, input_section,
myh = find_thumb_glue (info, name, input_bfd);
if (myh == NULL)
- return false;
+ return FALSE;
globals = elf32_arm_hash_table (info);
@@ -891,7 +1066,7 @@ elf32_thumb_to_arm_stub (info, name, input_bfd, output_bfd, input_section,
(_(" first occurrence: %s: thumb call to arm"),
bfd_archive_filename (input_bfd));
- return false;
+ return FALSE;
}
--my_offset;
@@ -925,13 +1100,16 @@ elf32_thumb_to_arm_stub (info, name, input_bfd, output_bfd, input_section,
BFD_ASSERT (my_offset <= globals->thumb_glue_size);
- /* Now go back and fix up the original BL insn to point
- to here. */
- ret_offset = (s->output_offset
- + my_offset
- - (input_section->output_offset
- + offset + addend)
- - 8);
+ /* 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);
@@ -940,7 +1118,7 @@ elf32_thumb_to_arm_stub (info, name, input_bfd, output_bfd, input_section,
(bfd_vma) insert_thumb_branch (tmp, ret_offset),
hit_data - input_section->vma);
- return true;
+ return TRUE;
}
/* Arm code calling a Thumb function. */
@@ -968,7 +1146,7 @@ elf32_arm_to_thumb_stub (info, name, input_bfd, output_bfd, input_section,
myh = find_arm_glue (info, name, input_bfd);
if (myh == NULL)
- return false;
+ return FALSE;
globals = elf32_arm_hash_table (info);
@@ -1028,7 +1206,7 @@ elf32_arm_to_thumb_stub (info, name, input_bfd, output_bfd, input_section,
bfd_put_32 (output_bfd, (bfd_vma) tmp, hit_data - input_section->vma);
- return true;
+ return TRUE;
}
/* Perform a relocation as part of a final link. */
@@ -1089,7 +1267,7 @@ elf32_arm_final_link_relocate (howto, input_bfd, output_bfd,
local_got_offsets = elf_local_got_offsets (input_bfd);
r_symndx = ELF32_R_SYM (rel->r_info);
-#ifdef USE_REL
+#if USE_REL
addend = bfd_get_32 (input_bfd, hit_data) & howto->src_mask;
if (addend & ((howto->src_mask + 1) >> 1))
@@ -1115,19 +1293,50 @@ elf32_arm_final_link_relocate (howto, input_bfd, output_bfd,
#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
- && r_symndx != 0
- && (r_type != R_ARM_PC24
- || (h != NULL
- && h->dynindx != -1
- && (! info->symbolic
- || (h->elf_link_hash_flags
- & ELF_LINK_HASH_DEF_REGULAR) == 0))))
+ && (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_Rel outrel;
- boolean skip, relocate;
+ Elf_Internal_Rela outrel;
+ bfd_byte *loc;
+ bfd_boolean skip, relocate;
if (sreloc == NULL)
{
@@ -1149,52 +1358,38 @@ elf32_arm_final_link_relocate (howto, input_bfd, output_bfd,
BFD_ASSERT (sreloc != NULL);
}
- skip = false;
- relocate = false;
+ 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;
+ skip = TRUE;
else if (outrel.r_offset == (bfd_vma) -2)
- skip = true, relocate = true;
+ 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 (r_type == R_ARM_PC24)
- {
- BFD_ASSERT (h != NULL && h->dynindx != -1);
- if ((input_section->flags & SEC_ALLOC) == 0)
- relocate = true;
- outrel.r_info = ELF32_R_INFO (h->dynindx, R_ARM_PC24);
- }
+ 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
{
- if (h == NULL
- || ((info->symbolic || h->dynindx == -1)
- && (h->elf_link_hash_flags
- & ELF_LINK_HASH_DEF_REGULAR) != 0))
- {
- relocate = true;
- outrel.r_info = ELF32_R_INFO (0, R_ARM_RELATIVE);
- }
- else
- {
- BFD_ASSERT (h->dynindx != -1);
- if ((input_section->flags & SEC_ALLOC) == 0)
- relocate = true;
- outrel.r_info = ELF32_R_INFO (h->dynindx, R_ARM_ABS32);
- }
+ /* This symbol is local, or marked to become local. */
+ relocate = TRUE;
+ outrel.r_info = ELF32_R_INFO (0, R_ARM_RELATIVE);
}
- bfd_elf32_swap_reloc_out (output_bfd, &outrel,
- (((Elf32_External_Rel *)
- sreloc->contents)
- + sreloc->reloc_count));
- ++sreloc->reloc_count;
+ 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
@@ -1212,6 +1407,7 @@ elf32_arm_final_link_relocate (howto, input_bfd, output_bfd,
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)
{
@@ -1365,7 +1561,7 @@ elf32_arm_final_link_relocate (howto, input_bfd, output_bfd,
case R_ARM_THM_ABS5:
/* Support ldr and str instructions for the thumb. */
-#ifdef USE_REL
+#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. */
@@ -1388,16 +1584,16 @@ elf32_arm_final_link_relocate (howto, input_bfd, output_bfd,
case R_ARM_THM_PC22:
/* Thumb BL (branch long instruction). */
{
- bfd_vma relocation;
- 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_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_vma check;
bfd_signed_vma signed_check;
-#ifdef USE_REL
+#if USE_REL
/* Need to refetch the addend and squish the two 11 bit pieces
together. */
{
@@ -1471,7 +1667,7 @@ elf32_arm_final_link_relocate (howto, input_bfd, output_bfd,
/* Assumes two's complement. */
if (signed_check > reloc_signed_max || signed_check < reloc_signed_min)
- overflow = true;
+ overflow = TRUE;
#ifndef OLD_ARM_ABI
if (r_type == R_ARM_THM_XPC22
@@ -1497,33 +1693,36 @@ elf32_arm_final_link_relocate (howto, input_bfd, output_bfd,
case R_ARM_THM_PC11:
/* Thumb B (branch) instruction). */
{
- bfd_vma relocation;
+ 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_vma check;
bfd_signed_vma signed_check;
-#ifdef USE_REL
+#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;
+ 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 + addend;
+ 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);
-
+ 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);
@@ -1596,13 +1795,17 @@ elf32_arm_final_link_relocate (howto, input_bfd, output_bfd,
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 (!elf_hash_table (info)->dynamic_sections_created ||
- (info->shared && (info->symbolic || h->dynindx == -1)
- && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR)))
+ 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
@@ -1652,7 +1855,8 @@ elf32_arm_final_link_relocate (howto, input_bfd, output_bfd,
if (info->shared)
{
asection * srelgot;
- Elf_Internal_Rel outrel;
+ Elf_Internal_Rela outrel;
+ bfd_byte *loc;
srelgot = bfd_get_section_by_name (dynobj, ".rel.got");
BFD_ASSERT (srelgot != NULL);
@@ -1661,11 +1865,9 @@ elf32_arm_final_link_relocate (howto, input_bfd, output_bfd,
+ sgot->output_offset
+ off);
outrel.r_info = ELF32_R_INFO (0, R_ARM_RELATIVE);
- bfd_elf32_swap_reloc_out (output_bfd, &outrel,
- (((Elf32_External_Rel *)
- srelgot->contents)
- + srelgot->reloc_count));
- ++srelgot->reloc_count;
+ 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;
@@ -1678,36 +1880,6 @@ elf32_arm_final_link_relocate (howto, input_bfd, output_bfd,
contents, rel->r_offset, value,
(bfd_vma) 0);
- case R_ARM_PLT32:
- /* Relocation is to the entry for this symbol in the
- procedure linkage table. */
-
- /* Resolve a PLT32 reloc against a local symbol directly,
- without using the procedure linkage table. */
- if (h == NULL)
- return _bfd_final_link_relocate (howto, input_bfd, input_section,
- contents, rel->r_offset, value,
- (bfd_vma) 0);
-
- if (h->plt.offset == (bfd_vma) -1)
- /* We didn't make a PLT entry for this symbol. This
- happens when statically linking PIC code, or when
- using -Bsymbolic. */
- return _bfd_final_link_relocate (howto, input_bfd, input_section,
- contents, rel->r_offset, value,
- (bfd_vma) 0);
-
- BFD_ASSERT(splt != NULL);
- if (splt == NULL)
- return bfd_reloc_notsupported;
-
- 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);
-
case R_ARM_SBREL32:
return bfd_reloc_notsupported;
@@ -1737,7 +1909,7 @@ elf32_arm_final_link_relocate (howto, input_bfd, output_bfd,
}
}
-#ifdef USE_REL
+#if USE_REL
/* Add INCREMENT to the reloc (of type HOWTO) at ADDRESS. */
static void
arm_add_to_rel (abfd, address, howto, increment)
@@ -1811,27 +1983,27 @@ arm_add_to_rel (abfd, address, howto, increment)
#endif /* USE_REL */
/* Relocate an ARM ELF section. */
-static boolean
+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;
+ 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;
-
-#ifndef USE_REL
- if (info->relocateable)
- return true;
+ 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;
@@ -1858,18 +2030,13 @@ elf32_arm_relocate_section (output_bfd, info, input_bfd, input_section,
|| r_type == R_ARM_GNU_VTINHERIT)
continue;
-#ifdef USE_REL
- elf32_arm_info_to_howto (input_bfd, & bfd_reloc,
- (Elf_Internal_Rel *) rel);
-#else
elf32_arm_info_to_howto (input_bfd, & bfd_reloc, rel);
-#endif
howto = bfd_reloc.howto;
-#ifdef USE_REL
- if (info->relocateable)
+#if USE_REL
+ if (info->relocatable)
{
- /* This is a relocateable link. We don't have to change
+ /* This is a relocatable link. We don't have to change
anything, unless the reloc is against a section symbol,
in which case we have to adjust according to where the
section symbol winds up in the output section. */
@@ -1899,7 +2066,7 @@ elf32_arm_relocate_section (output_bfd, info, input_bfd, input_section,
{
sym = local_syms + r_symndx;
sec = local_sections[r_symndx];
-#ifdef USE_REL
+#if USE_REL
relocation = (sec->output_section->vma
+ sec->output_offset
+ sym->st_value);
@@ -1916,7 +2083,7 @@ elf32_arm_relocate_section (output_bfd, info, input_bfd, input_section,
bfd_archive_filename (input_bfd),
bfd_get_section_name (input_bfd, input_section),
(long) rel->r_offset, howto->name);
- return false;
+ return FALSE;
}
value = bfd_get_32 (input_bfd, contents + rel->r_offset);
@@ -1940,24 +2107,21 @@ elf32_arm_relocate_section (output_bfd, info, input_bfd, input_section,
bfd_put_32 (input_bfd, value, contents + rel->r_offset);
}
#else
- relocation = _bfd_elf_rela_local_sym (output_bfd, sym, sec, rel);
+ relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel);
#endif
}
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;
-
- if ( h->root.type == bfd_link_hash_defined
- || h->root.type == bfd_link_hash_defweak)
+ 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)
{
- int relocation_needed = 1;
-
- sec = h->root.u.def.section;
-
/* In these cases, we don't need the relocation value.
We check specially because in some obscure cases
sec->output_section will be NULL. */
@@ -1966,11 +2130,14 @@ elf32_arm_relocate_section (output_bfd, info, input_bfd, input_section,
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)
+ (!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
@@ -1980,63 +2147,34 @@ elf32_arm_relocate_section (output_bfd, info, input_bfd, input_section,
&& (h->elf_link_hash_flags
& ELF_LINK_HASH_DEF_DYNAMIC) != 0))
)
- relocation_needed = 0;
+ relocation = 0;
break;
case R_ARM_GOTPC:
- relocation_needed = 0;
+ relocation = 0;
break;
case R_ARM_GOT32:
- if (elf_hash_table(info)->dynamic_sections_created
- && (!info->shared
+ 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_needed = 0;
- break;
-
- case R_ARM_PLT32:
- if (h->plt.offset != (bfd_vma)-1)
- relocation_needed = 0;
+ || (h->elf_link_hash_flags
+ & ELF_LINK_HASH_DEF_REGULAR) == 0))
+ relocation = 0;
break;
default:
- if (sec->output_section == NULL)
- {
- (*_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));
- relocation_needed = 0;
- }
+ 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 (relocation_needed)
- relocation = h->root.u.def.value
- + sec->output_section->vma
- + sec->output_offset;
- else
- relocation = 0;
- }
- else if (h->root.type == bfd_link_hash_undefweak)
- relocation = 0;
- else if (info->shared && !info->symbolic
- && !info->no_undefined
- && ELF_ST_VISIBILITY (h->other) == STV_DEFAULT)
- relocation = 0;
- else
- {
- if (!((*info->callbacks->undefined_symbol)
- (info, h->root.root.string, input_bfd,
- input_section, rel->r_offset,
- (!info->shared || info->no_undefined
- || ELF_ST_VISIBILITY (h->other)))))
- return false;
- relocation = 0;
}
}
@@ -2071,14 +2209,14 @@ elf32_arm_relocate_section (output_bfd, info, input_bfd, input_section,
&& (!((*info->callbacks->reloc_overflow)
(info, name, howto->name, (bfd_vma) 0,
input_bfd, input_section, rel->r_offset))))
- return false;
+ return FALSE;
break;
case bfd_reloc_undefined:
if (!((*info->callbacks->undefined_symbol)
(info, name, input_bfd, input_section,
- rel->r_offset, true)))
- return false;
+ rel->r_offset, TRUE)))
+ return FALSE;
break;
case bfd_reloc_outofrange:
@@ -2101,17 +2239,39 @@ elf32_arm_relocate_section (output_bfd, info, input_bfd, input_section,
if (!((*info->callbacks->warning)
(info, msg, name, input_bfd, input_section,
rel->r_offset)))
- return false;
+ return FALSE;
break;
}
}
}
- return true;
+ 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 boolean
+static bfd_boolean
elf32_arm_set_private_flags (abfd, flags)
bfd *abfd;
flagword flags;
@@ -2134,15 +2294,15 @@ Warning: Clearing the interworking flag of %s due to outside request"),
else
{
elf_elfheader (abfd)->e_flags = flags;
- elf_flags_init (abfd) = true;
+ elf_flags_init (abfd) = TRUE;
}
- return true;
+ return TRUE;
}
/* Copy backend specific data from one object module to another. */
-static boolean
+static bfd_boolean
elf32_arm_copy_private_bfd_data (ibfd, obfd)
bfd *ibfd;
bfd *obfd;
@@ -2152,7 +2312,7 @@ elf32_arm_copy_private_bfd_data (ibfd, obfd)
if ( bfd_get_flavour (ibfd) != bfd_target_elf_flavour
|| bfd_get_flavour (obfd) != bfd_target_elf_flavour)
- return true;
+ return TRUE;
in_flags = elf_elfheader (ibfd)->e_flags;
out_flags = elf_elfheader (obfd)->e_flags;
@@ -2163,11 +2323,11 @@ elf32_arm_copy_private_bfd_data (ibfd, obfd)
{
/* Cannot mix APCS26 and APCS32 code. */
if ((in_flags & EF_ARM_APCS_26) != (out_flags & EF_ARM_APCS_26))
- return false;
+ 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;
+ return FALSE;
/* If the src and dest have different interworking flags
then turn off the interworking bit. */
@@ -2188,32 +2348,31 @@ Warning: Clearing the interworking flag of %s because non-interworking code in %
}
elf_elfheader (obfd)->e_flags = in_flags;
- elf_flags_init (obfd) = true;
+ elf_flags_init (obfd) = TRUE;
- return true;
+ return TRUE;
}
/* Merge backend specific data from an object file to the output
object file when linking. */
-static boolean
+static bfd_boolean
elf32_arm_merge_private_bfd_data (ibfd, obfd)
bfd * ibfd;
bfd * obfd;
{
flagword out_flags;
flagword in_flags;
- boolean flags_compatible = true;
- boolean null_input_bfd = true;
+ bfd_boolean flags_compatible = TRUE;
asection *sec;
/* Check if we have the same endianess. */
if (! _bfd_generic_verify_endian_match (ibfd, obfd))
- return false;
+ return FALSE;
if ( bfd_get_flavour (ibfd) != bfd_target_elf_flavour
|| bfd_get_flavour (obfd) != bfd_target_elf_flavour)
- return true;
+ return TRUE;
/* The input BFD must have had its flags initialised. */
/* The following seems bogus to me -- The flags are initialized in
@@ -2234,37 +2393,61 @@ elf32_arm_merge_private_bfd_data (ibfd, obfd)
to the default values. */
if (bfd_get_arch_info (ibfd)->the_default
&& elf_elfheader (ibfd)->e_flags == 0)
- return true;
+ return TRUE;
- elf_flags_init (obfd) = 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;
+ 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. */
- for (sec = ibfd->sections; sec != NULL; sec = sec->next)
+ 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))
{
- /* Ignore synthetic glue sections. */
- if (strcmp (sec->name, ".glue_7")
- && strcmp (sec->name, ".glue_7t"))
+ bfd_boolean null_input_bfd = TRUE;
+ bfd_boolean only_data_sections = TRUE;
+
+ for (sec = ibfd->sections; sec != NULL; sec = sec->next)
{
- null_input_bfd = false;
- break;
+ /* 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;
}
- if (null_input_bfd)
- return true;
/* Complain about various flag mismatches. */
if (EF_ARM_EABI_VERSION (in_flags) != EF_ARM_EABI_VERSION (out_flags))
@@ -2275,7 +2458,7 @@ ERROR: %s is compiled for EABI version %d, whereas %s is compiled for version %d
(in_flags & EF_ARM_EABIMASK) >> 24,
bfd_get_filename (obfd),
(out_flags & EF_ARM_EABIMASK) >> 24);
- return false;
+ return FALSE;
}
/* Not sure what needs to be checked for EABI versions >= 1. */
@@ -2289,7 +2472,7 @@ ERROR: %s is compiled for APCS-%d, whereas target %s uses APCS-%d"),
in_flags & EF_ARM_APCS_26 ? 26 : 32,
bfd_get_filename (obfd),
out_flags & EF_ARM_APCS_26 ? 26 : 32);
- flags_compatible = false;
+ flags_compatible = FALSE;
}
if ((in_flags & EF_ARM_APCS_FLOAT) != (out_flags & EF_ARM_APCS_FLOAT))
@@ -2305,23 +2488,39 @@ ERROR: %s passes floats in integer registers, whereas %s passes them in float re
bfd_archive_filename (ibfd),
bfd_get_filename (obfd));
- flags_compatible = false;
+ 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 uses FPA instructions"),
+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 uses FPA instructions, whereas %s uses VFP instructions"),
+ERROR: %s does not use Maverick instructions, whereas %s does"),
bfd_archive_filename (ibfd),
bfd_get_filename (obfd));
- flags_compatible = false;
+ flags_compatible = FALSE;
}
#ifdef EF_ARM_SOFT_FLOAT
@@ -2346,7 +2545,7 @@ ERROR: %s uses hardware FP, whereas %s uses software FP"),
bfd_archive_filename (ibfd),
bfd_get_filename (obfd));
- flags_compatible = false;
+ flags_compatible = FALSE;
}
}
#endif
@@ -2376,7 +2575,7 @@ Warning: %s does not support interworking, whereas %s does"),
/* Display the flags field. */
-static boolean
+static bfd_boolean
elf32_arm_print_private_bfd_data (abfd, ptr)
bfd *abfd;
PTR ptr;
@@ -2399,7 +2598,7 @@ elf32_arm_print_private_bfd_data (abfd, ptr)
switch (EF_ARM_EABI_VERSION (flags))
{
case EF_ARM_EABI_UNKNOWN:
- /* The following flag bits are GNU extenstions and not part of the
+ /* 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)
@@ -2412,6 +2611,8 @@ elf32_arm_print_private_bfd_data (abfd, ptr)
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]"));
@@ -2432,7 +2633,8 @@ elf32_arm_print_private_bfd_data (abfd, ptr)
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_SOFT_FLOAT | EF_ARM_VFP_FLOAT
+ | EF_ARM_MAVERICK_FLOAT);
break;
case EF_ARM_EABI_VER1:
@@ -2484,7 +2686,7 @@ elf32_arm_print_private_bfd_data (abfd, ptr)
fputc ('\n', file);
- return true;
+ return TRUE;
}
static int
@@ -2552,39 +2754,110 @@ elf32_arm_gc_mark_hook (sec, info, rel, h, sym)
/* Update the got entry reference counts for the section being removed. */
-static boolean
+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;
{
- /* We don't support garbage collection of GOT and PLT relocs yet. */
- return true;
+ 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 boolean
+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;
+ 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 * sgot, *srelgot, *sreloc;
- bfd_vma * local_got_offsets;
+ 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->relocateable)
- return true;
+ if (info->relocatable)
+ return TRUE;
- sgot = srelgot = sreloc = NULL;
+ htab = elf32_arm_hash_table (info);
+ sreloc = NULL;
dynobj = elf_hash_table (info)->dynobj;
local_got_offsets = elf_local_got_offsets (abfd);
@@ -2609,126 +2882,75 @@ elf32_arm_check_relocs (abfd, info, sec, relocs)
else
h = sym_hashes[r_symndx - symtab_hdr->sh_info];
- /* Some relocs require a global offset table. */
- if (dynobj == NULL)
- {
- switch (ELF32_R_TYPE (rel->r_info))
- {
- case R_ARM_GOT32:
- case R_ARM_GOTOFF:
- case R_ARM_GOTPC:
- elf_hash_table (info)->dynobj = dynobj = abfd;
- if (! _bfd_elf_create_got_section (dynobj, info))
- return false;
- break;
-
- default:
- break;
- }
- }
-
switch (ELF32_R_TYPE (rel->r_info))
{
case R_ARM_GOT32:
/* This symbol requires a global offset table entry. */
- if (sgot == NULL)
- {
- sgot = bfd_get_section_by_name (dynobj, ".got");
- BFD_ASSERT (sgot != NULL);
- }
-
- /* Get the got relocation section if necessary. */
- if (srelgot == NULL
- && (h != NULL || info->shared))
- {
- srelgot = bfd_get_section_by_name (dynobj, ".rel.got");
-
- /* If no got relocation section, make one and initialize. */
- if (srelgot == NULL)
- {
- srelgot = bfd_make_section (dynobj, ".rel.got");
- if (srelgot == NULL
- || ! bfd_set_section_flags (dynobj, srelgot,
- (SEC_ALLOC
- | SEC_LOAD
- | SEC_HAS_CONTENTS
- | SEC_IN_MEMORY
- | SEC_LINKER_CREATED
- | SEC_READONLY))
- || ! bfd_set_section_alignment (dynobj, srelgot, 2))
- return false;
- }
- }
-
if (h != NULL)
{
- if (h->got.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_elf32_link_record_dynamic_symbol (info, h))
- return false;
-
- srelgot->_raw_size += sizeof (Elf32_External_Rel);
+ h->got.refcount++;
}
else
{
- /* This is a global offset table entry for a local
- symbol. */
- if (local_got_offsets == NULL)
+ 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;
- 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;
+ 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;
}
-
- 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_ARM_RELATIVE reloc so that the dynamic
- linker can adjust this GOT entry. */
- srelgot->_raw_size += sizeof (Elf32_External_Rel);
+ local_got_refcounts[r_symndx] += 1;
}
-
- sgot->_raw_size += 4;
break;
- case R_ARM_PLT32:
- /* This symbol requires a procedure linkage table entry. We
- actually build the entry in adjust_dynamic_symbol,
- because this might be a case of linking PIC code which is
- never referenced by a dynamic object, in which case we
- don't need to generate a procedure linkage table entry
- after all. */
-
- /* If this is a local symbol, we resolve it directly without
- creating a procedure linkage table entry. */
- if (h == NULL)
- continue;
-
- h->elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_PLT;
+ 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
@@ -2740,14 +2962,19 @@ elf32_arm_check_relocs (abfd, info, sec, relocs)
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
- pcrel_relocs_copied field of the hash table entry. */
+ relocs_copied field of the hash table entry. */
if (info->shared
- && (ELF32_R_TYPE (rel->r_info) != R_ARM_PC24
- || (h != NULL
- && (! info->symbolic
- || (h->elf_link_hash_flags
- & ELF_LINK_HASH_DEF_REGULAR) == 0))))
+ && (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. */
@@ -2760,7 +2987,7 @@ elf32_arm_check_relocs (abfd, info, sec, relocs)
elf_elfheader (abfd)->e_shstrndx,
elf_section_data (sec)->rel_hdr.sh_name));
if (name == NULL)
- return false;
+ return FALSE;
BFD_ASSERT (strncmp (name, ".rel", 4) == 0
&& strcmp (bfd_get_section_name (abfd, sec),
@@ -2779,107 +3006,110 @@ elf32_arm_check_relocs (abfd, info, sec, relocs)
if (sreloc == NULL
|| ! bfd_set_section_flags (dynobj, sreloc, flags)
|| ! bfd_set_section_alignment (dynobj, sreloc, 2))
- return false;
+ return FALSE;
}
- if (sec->flags & SEC_READONLY)
- info->flags |= DF_TEXTREL;
+
+ elf_section_data (sec)->sreloc = sreloc;
}
- sreloc->_raw_size += sizeof (Elf32_External_Rel);
- /* If we are linking with -Bsymbolic, and this is a
- global symbol, we count the number of PC relative
- relocations we have entered for this symbol, so that
- we can discard them again if the symbol is later
- defined by a regular object. Note that this function
- is only called if we are using an elf_i386 linker
- hash table, which means that h is really a pointer to
- an elf_i386_link_hash_entry. */
- if (h != NULL && info->symbolic
- && ELF32_R_TYPE (rel->r_info) == R_ARM_PC24)
+ /* If this is a global symbol, we count the number of
+ relocations we need for this symbol. */
+ if (h != NULL)
{
- struct elf32_arm_link_hash_entry * eh;
- struct elf32_arm_pcrel_relocs_copied * p;
-
- eh = (struct elf32_arm_link_hash_entry *) h;
-
- for (p = eh->pcrel_relocs_copied; p != NULL; p = p->next)
- if (p->section == sreloc)
- break;
-
+ 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)
- {
- p = ((struct elf32_arm_pcrel_relocs_copied *)
- bfd_alloc (dynobj, (bfd_size_type) sizeof * p));
- if (p == NULL)
- return false;
- p->next = eh->pcrel_relocs_copied;
- eh->pcrel_relocs_copied = p;
- p->section = sreloc;
- p->count = 0;
- }
-
- ++p->count;
+ 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_elf32_gc_record_vtinherit (abfd, sec, h, rel->r_offset))
- return false;
+ 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_elf32_gc_record_vtentry (abfd, sec, h, rel->r_offset))
- return false;
+ if (!bfd_elf_gc_record_vtentry (abfd, sec, h, rel->r_offset))
+ return FALSE;
break;
}
}
- return true;
+ 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 boolean
+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 *abfd;
+ asection *section;
+ asymbol **symbols;
+ bfd_vma offset;
+ const char **filename_ptr;
+ const char **functionname_ptr;
+ unsigned int *line_ptr;
{
- boolean found;
- const char * filename;
- asymbol * func;
- bfd_vma low_func;
- asymbol ** p;
+ 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;
+ 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;
+ return FALSE;
if (found)
- return true;
+ return TRUE;
if (symbols == NULL)
- return false;
+ return FALSE;
filename = NULL;
func = NULL;
@@ -2916,13 +3146,13 @@ elf32_arm_find_nearest_line
}
if (func == NULL)
- return false;
+ return FALSE;
*filename_ptr = filename;
*functionname_ptr = bfd_asymbol_name (func);
*line_ptr = 0;
- return true;
+ return TRUE;
}
/* Adjust a symbol defined by a dynamic object and referenced by a
@@ -2931,7 +3161,7 @@ elf32_arm_find_nearest_line
change the definition to something the rest of the link can
understand. */
-static boolean
+static bfd_boolean
elf32_arm_adjust_dynamic_symbol (info, h)
struct bfd_link_info * info;
struct elf_link_hash_entry * h;
@@ -2959,71 +3189,29 @@ elf32_arm_adjust_dynamic_symbol (info, h)
if (h->type == STT_FUNC
|| (h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT) != 0)
{
- /* If we link a program (not a DSO), we'll get rid of unnecessary
- PLT entries; we point to the actual symbols -- even for pic
- relocs, because a program built with -fpic should have the same
- result as one built without -fpic, specifically considering weak
- symbols.
- FIXME: m68k and i386 differ here, for unclear reasons. */
- if (! info->shared
- && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) == 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 not defined by a dynamic object.
- In such a case, we don't actually need to build a
- procedure linkage table, and we can just do a PC32 reloc
- instead. */
- BFD_ASSERT ((h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT) != 0);
+ 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;
- }
-
- /* Make sure this symbol is output as a dynamic symbol. */
- if (h->dynindx == -1)
- {
- if (! bfd_elf32_link_record_dynamic_symbol (info, h))
- return false;
- }
-
- s = bfd_get_section_by_name (dynobj, ".plt");
- BFD_ASSERT (s != NULL);
-
- /* If this is the first .plt entry, make room for the special
- first entry. */
- if (s->_raw_size == 0)
- s->_raw_size += PLT_ENTRY_SIZE;
-
- /* If this 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 = s->_raw_size;
}
- h->plt.offset = s->_raw_size;
-
- /* Make room for this entry. */
- s->_raw_size += PLT_ENTRY_SIZE;
-
- /* We also need to make an entry in the .got.plt section, which
- will be placed in the .got section by the linker script. */
- s = bfd_get_section_by_name (dynobj, ".got.plt");
- BFD_ASSERT (s != NULL);
- s->_raw_size += 4;
-
- /* We also need to make an entry in the .rel.plt section. */
-
- s = bfd_get_section_by_name (dynobj, ".rel.plt");
- BFD_ASSERT (s != NULL);
- s->_raw_size += sizeof (Elf32_External_Rel);
-
- return true;
+ 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
@@ -3034,7 +3222,7 @@ elf32_arm_adjust_dynamic_symbol (info, h)
|| 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;
+ return TRUE;
}
/* This is a reference to a symbol defined by a dynamic object which
@@ -3045,7 +3233,7 @@ elf32_arm_adjust_dynamic_symbol (info, h)
For such cases we need not do anything here; the relocations will
be handled correctly by relocate_section. */
if (info->shared)
- return true;
+ 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
@@ -3085,7 +3273,7 @@ elf32_arm_adjust_dynamic_symbol (info, h)
if (power_of_two > bfd_get_section_alignment (dynobj, s))
{
if (! bfd_set_section_alignment (dynobj, s, power_of_two))
- return false;
+ return FALSE;
}
/* Define the symbol as being at this point in the section. */
@@ -3095,28 +3283,202 @@ elf32_arm_adjust_dynamic_symbol (info, h)
/* Increment the section size to make room for the symbol. */
s->_raw_size += h->size;
- return true;
+ 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 boolean
+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;
- boolean plt;
- boolean relocs;
+ 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->shared)
+ if (info->executable)
{
s = bfd_get_section_by_name (dynobj, ".interp");
BFD_ASSERT (s != NULL);
@@ -3124,36 +3486,84 @@ elf32_arm_size_dynamic_sections (output_bfd, info)
s->contents = (unsigned char *) ELF_DYNAMIC_INTERPRETER;
}
}
- else
+
+ /* Set up .got offsets for local syms, and space for local dynamic
+ relocs. */
+ for (ibfd = info->input_bfds; ibfd != NULL; ibfd = ibfd->link_next)
{
- /* We may have created entries in the .rel.got section.
- However, if we are not creating the dynamic sections, we will
- not actually use these entries. Reset the size of .rel.got,
- which will cause it to get stripped from the output file
- below. */
- s = bfd_get_section_by_name (dynobj, ".rel.got");
- if (s != NULL)
- s->_raw_size = 0;
+ 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;
+ }
}
- /* If this is a -Bsymbolic shared link, then we need to discard all
- PC relative relocs against symbols defined in a regular object.
- We allocated space for them in the check_relocs routine, but we
- will not fill them in in the relocate_section routine. */
- if (info->shared && info->symbolic)
- elf32_arm_link_hash_traverse (elf32_arm_hash_table (info),
- elf32_arm_discard_copies,
- (PTR) NULL);
+ /* 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;
+ plt = FALSE;
+ relocs = FALSE;
for (s = dynobj->sections; s != NULL; s = s->next)
{
const char * name;
- boolean strip;
+ bfd_boolean strip;
if ((s->flags & SEC_LINKER_CREATED) == 0)
continue;
@@ -3162,7 +3572,7 @@ elf32_arm_size_dynamic_sections (output_bfd, info)
of the dynobj section names depend upon the input files. */
name = bfd_get_section_name (dynobj, s);
- strip = false;
+ strip = FALSE;
if (strcmp (name, ".plt") == 0)
{
@@ -3170,12 +3580,12 @@ elf32_arm_size_dynamic_sections (output_bfd, info)
{
/* Strip this section if we don't need it; see the
comment below. */
- strip = true;
+ strip = TRUE;
}
else
{
/* Remember whether there is a PLT. */
- plt = true;
+ plt = TRUE;
}
}
else if (strncmp (name, ".rel", 4) == 0)
@@ -3191,14 +3601,14 @@ elf32_arm_size_dynamic_sections (output_bfd, info)
adjust_dynamic_symbol is called, and it is that
function which decides whether anything needs to go
into these sections. */
- strip = true;
+ strip = TRUE;
}
else
{
/* Remember whether there are any reloc sections other
than .rel.plt. */
if (strcmp (name, ".rel.plt") != 0)
- relocs = true;
+ relocs = TRUE;
/* We use the reloc_count field as a counter if we need
to copy relocs into the output file. */
@@ -3213,26 +3623,14 @@ elf32_arm_size_dynamic_sections (output_bfd, info)
if (strip)
{
- asection ** spp;
-
- for (spp = &s->output_section->owner->sections;
- *spp != NULL;
- spp = &(*spp)->next)
- {
- if (*spp == s->output_section)
- {
- bfd_section_list_remove (s->output_section->owner, spp);
- --s->output_section->owner->section_count;
- break;
- }
- }
+ _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;
+ return FALSE;
}
if (elf_hash_table (info)->dynamic_sections_created)
@@ -3243,12 +3641,12 @@ elf32_arm_size_dynamic_sections (output_bfd, info)
the .dynamic section. The DT_DEBUG entry is filled in by the
dynamic linker and used by the debugger. */
#define add_dynamic_entry(TAG, VAL) \
- bfd_elf32_add_dynamic_entry (info, (bfd_vma) (TAG), (bfd_vma) (VAL))
+ _bfd_elf_add_dynamic_entry (info, TAG, VAL)
if (!info->shared)
{
if (!add_dynamic_entry (DT_DEBUG, 0))
- return false;
+ return FALSE;
}
if (plt)
@@ -3257,7 +3655,7 @@ elf32_arm_size_dynamic_sections (output_bfd, info)
|| !add_dynamic_entry (DT_PLTRELSZ, 0)
|| !add_dynamic_entry (DT_PLTREL, DT_REL)
|| !add_dynamic_entry (DT_JMPREL, 0))
- return false;
+ return FALSE;
}
if (relocs)
@@ -3265,52 +3663,25 @@ elf32_arm_size_dynamic_sections (output_bfd, info)
if ( !add_dynamic_entry (DT_REL, 0)
|| !add_dynamic_entry (DT_RELSZ, 0)
|| !add_dynamic_entry (DT_RELENT, sizeof (Elf32_External_Rel)))
- return false;
+ return FALSE;
}
if ((info->flags & DF_TEXTREL) != 0)
{
if (!add_dynamic_entry (DT_TEXTREL, 0))
- return false;
+ return FALSE;
info->flags |= DF_TEXTREL;
}
}
#undef add_synamic_entry
- return true;
-}
-
-/* This function is called via elf32_arm_link_hash_traverse if we are
- creating a shared object with -Bsymbolic. It discards the space
- allocated to copy PC relative relocs against symbols which are
- defined in regular objects. We allocated space for them in the
- check_relocs routine, but we won't fill them in in the
- relocate_section routine. */
-
-static boolean
-elf32_arm_discard_copies (h, ignore)
- struct elf32_arm_link_hash_entry * h;
- PTR ignore ATTRIBUTE_UNUSED;
-{
- struct elf32_arm_pcrel_relocs_copied * s;
-
- if (h->root.root.type == bfd_link_hash_warning)
- h = (struct elf32_arm_link_hash_entry *) h->root.root.u.i.link;
-
- /* We only discard relocs for symbols defined in a regular object. */
- if ((h->root.elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0)
- return true;
-
- for (s = h->pcrel_relocs_copied; s != NULL; s = s->next)
- s->section->_raw_size -= s->count * sizeof (Elf32_External_Rel);
-
- return true;
+ return TRUE;
}
/* Finish up dynamic symbol handling. We set the contents of various
dynamic sections here. */
-static boolean
+static bfd_boolean
elf32_arm_finish_dynamic_symbol (output_bfd, info, h, sym)
bfd * output_bfd;
struct bfd_link_info * info;
@@ -3328,7 +3699,9 @@ elf32_arm_finish_dynamic_symbol (output_bfd, info, h, sym)
asection * srel;
bfd_vma plt_index;
bfd_vma got_offset;
- Elf_Internal_Rel rel;
+ Elf_Internal_Rela rel;
+ bfd_byte *loc;
+ bfd_vma got_displacement;
/* This symbol has an entry in the procedure linkage table. Set
it up. */
@@ -3344,43 +3717,50 @@ elf32_arm_finish_dynamic_symbol (output_bfd, info, h, sym)
corresponds to this symbol. This is the index of this symbol
in all the symbols for which we are making plt entries. The
first entry in the procedure linkage table is reserved. */
- plt_index = h->plt.offset / PLT_ENTRY_SIZE - 1;
+ 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],
+ 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],
+ 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],
+ bfd_put_32 (output_bfd, elf32_arm_plt_entry[2] | (got_displacement & 0x00000fff),
splt->contents + h->plt.offset + 8);
- bfd_put_32 (output_bfd,
- (sgot->output_section->vma
- + sgot->output_offset
- + got_offset
- - splt->output_section->vma
- - splt->output_offset
- - h->plt.offset - 12),
- splt->contents + h->plt.offset + 12);
+#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);
- bfd_elf32_swap_reloc_out (output_bfd, &rel,
- ((Elf32_External_Rel *) srel->contents
- + plt_index));
+ 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)
{
@@ -3401,7 +3781,8 @@ elf32_arm_finish_dynamic_symbol (output_bfd, info, h, sym)
{
asection * sgot;
asection * srel;
- Elf_Internal_Rel rel;
+ Elf_Internal_Rela rel;
+ bfd_byte *loc;
/* This symbol has an entry in the global offset table. Set it
up. */
@@ -3413,30 +3794,33 @@ elf32_arm_finish_dynamic_symbol (output_bfd, info, h, sym)
+ 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. The entry in
- the global offset table will already have been initialized in
- the relocate_section function. */
+ /* If this is a static link, or it is a -Bsymbolic link and the
+ symbol is defined locally or was forced to be local because
+ of a version file, we just want to emit a RELATIVE reloc.
+ The entry in the global offset table will already have been
+ initialized in the relocate_section function. */
if (info->shared
- && (info->symbolic || h->dynindx == -1)
- && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR))
- rel.r_info = ELF32_R_INFO (0, R_ARM_RELATIVE);
+ && 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);
}
- bfd_elf32_swap_reloc_out (output_bfd, &rel,
- ((Elf32_External_Rel *) srel->contents
- + srel->reloc_count));
- ++srel->reloc_count;
+ 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_Rel rel;
+ Elf_Internal_Rela rel;
+ bfd_byte *loc;
/* This symbol needs a copy reloc. Set it up. */
BFD_ASSERT (h->dynindx != -1
@@ -3451,10 +3835,8 @@ elf32_arm_finish_dynamic_symbol (output_bfd, info, h, sym)
+ 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);
- bfd_elf32_swap_reloc_out (output_bfd, &rel,
- ((Elf32_External_Rel *) s->contents
- + s->reloc_count));
- ++s->reloc_count;
+ 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. */
@@ -3462,12 +3844,12 @@ elf32_arm_finish_dynamic_symbol (output_bfd, info, h, sym)
|| strcmp (h->root.root.string, "_GLOBAL_OFFSET_TABLE_") == 0)
sym->st_shndx = SHN_ABS;
- return true;
+ return TRUE;
}
/* Finish up the dynamic sections. */
-static boolean
+static bfd_boolean
elf32_arm_finish_dynamic_sections (output_bfd, info)
bfd * output_bfd;
struct bfd_link_info * info;
@@ -3548,16 +3930,57 @@ elf32_arm_finish_dynamic_sections (output_bfd, info)
}
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
@@ -3580,7 +4003,7 @@ elf32_arm_finish_dynamic_sections (output_bfd, info)
elf_section_data (sgot->output_section)->this_hdr.sh_entsize = 4;
- return true;
+ return TRUE;
}
static void
@@ -3613,10 +4036,37 @@ elf32_arm_reloc_type_class (rela)
}
}
+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
@@ -3632,22 +4082,27 @@ elf32_arm_reloc_type_class (rela)
#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 _bfd_elf_create_dynamic_sections
+#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
-#ifndef USE_REL
+#if !USE_REL
#define elf_backend_rela_normal 1
#endif
#define elf_backend_got_header_size 12
-#define elf_backend_plt_header_size PLT_ENTRY_SIZE
#include "elf32-target.h"
+
diff --git a/contrib/binutils/bfd/elf32-gen.c b/contrib/binutils/bfd/elf32-gen.c
index 58b5fc6..f2edf69 100644
--- a/contrib/binutils/bfd/elf32-gen.c
+++ b/contrib/binutils/bfd/elf32-gen.c
@@ -1,5 +1,6 @@
/* Generic support for 32-bit ELF
- Copyright 1993, 1995, 1998, 1999, 2001 Free Software Foundation, Inc.
+ Copyright 1993, 1995, 1998, 1999, 2001, 2002, 2004
+ Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@@ -30,28 +31,28 @@ static reloc_howto_type dummy =
0, /* rightshift */
0, /* size (0 = byte, 1 = short, 2 = long) */
0, /* bitsize */
- false, /* pc_relative */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
NULL, /* special_function */
"UNKNOWN", /* name */
- false, /* partial_inplace */
+ FALSE, /* partial_inplace */
0, /* src_mask */
0, /* dst_mask */
- false); /* pcrel_offset */
+ FALSE); /* pcrel_offset */
static void elf_generic_info_to_howto
- PARAMS ((bfd *, arelent *, Elf32_Internal_Rela *));
+ PARAMS ((bfd *, arelent *, Elf_Internal_Rela *));
static void elf_generic_info_to_howto_rel
- PARAMS ((bfd *, arelent *, Elf32_Internal_Rel *));
-static boolean elf32_generic_link_add_symbols
+ 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;
- Elf32_Internal_Rela *elf_reloc ATTRIBUTE_UNUSED;
+ Elf_Internal_Rela *elf_reloc ATTRIBUTE_UNUSED;
{
bfd_reloc->howto = &dummy;
}
@@ -60,12 +61,12 @@ static void
elf_generic_info_to_howto_rel (abfd, bfd_reloc, elf_reloc)
bfd *abfd ATTRIBUTE_UNUSED;
arelent *bfd_reloc;
- Elf32_Internal_Rel *elf_reloc ATTRIBUTE_UNUSED;
+ Elf_Internal_Rela *elf_reloc ATTRIBUTE_UNUSED;
{
bfd_reloc->howto = &dummy;
}
-static boolean
+static bfd_boolean
elf32_generic_link_add_symbols (abfd, info)
bfd *abfd;
struct bfd_link_info *info;
@@ -84,10 +85,10 @@ elf32_generic_link_add_symbols (abfd, info)
ehdrp->e_machine);
bfd_set_error (bfd_error_wrong_format);
- return false;
+ return FALSE;
}
- return bfd_elf32_bfd_link_add_symbols (abfd, info);
+ return bfd_elf_link_add_symbols (abfd, info);
}
#define TARGET_LITTLE_SYM bfd_elf32_little_generic_vec
diff --git a/contrib/binutils/bfd/elf32-i386.c b/contrib/binutils/bfd/elf32-i386.c
index 51765ab..7b173e4 100644
--- a/contrib/binutils/bfd/elf32-i386.c
+++ b/contrib/binutils/bfd/elf32-i386.c
@@ -1,22 +1,22 @@
/* Intel 80386/80486-specific support for 32-bit ELF
- Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
- Free Software Foundation, Inc.
+ Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+ 2003, 2004 Free Software Foundation, Inc.
-This file is part of BFD, the Binary File Descriptor library.
+ This 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "bfd.h"
#include "sysdep.h"
@@ -24,345 +24,280 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "libbfd.h"
#include "elf-bfd.h"
-static reloc_howto_type *elf_i386_reloc_type_lookup
- PARAMS ((bfd *, bfd_reloc_code_real_type));
-static void elf_i386_info_to_howto
- PARAMS ((bfd *, arelent *, Elf32_Internal_Rela *));
-static void elf_i386_info_to_howto_rel
- PARAMS ((bfd *, arelent *, Elf32_Internal_Rel *));
-static boolean elf_i386_is_local_label_name
- PARAMS ((bfd *, const char *));
-static boolean elf_i386_grok_prstatus
- PARAMS ((bfd *abfd, Elf_Internal_Note *note));
-static boolean elf_i386_grok_psinfo
- PARAMS ((bfd *abfd, Elf_Internal_Note *note));
-static struct bfd_hash_entry *link_hash_newfunc
- PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, const char *));
-static struct bfd_link_hash_table *elf_i386_link_hash_table_create
- PARAMS ((bfd *));
-static boolean create_got_section
- PARAMS((bfd *, struct bfd_link_info *));
-static boolean elf_i386_create_dynamic_sections
- PARAMS((bfd *, struct bfd_link_info *));
-static void elf_i386_copy_indirect_symbol
- PARAMS ((struct elf_backend_data *, struct elf_link_hash_entry *,
- struct elf_link_hash_entry *));
-static int elf_i386_tls_transition
- PARAMS ((struct bfd_link_info *, int, int));
-
-static boolean elf_i386_mkobject
- PARAMS((bfd *));
-static boolean elf_i386_object_p
- PARAMS((bfd *));
-static boolean elf_i386_check_relocs
- PARAMS ((bfd *, struct bfd_link_info *, asection *,
- const Elf_Internal_Rela *));
-static asection *elf_i386_gc_mark_hook
- PARAMS ((asection *, struct bfd_link_info *, Elf_Internal_Rela *,
- struct elf_link_hash_entry *, Elf_Internal_Sym *));
-static boolean elf_i386_gc_sweep_hook
- PARAMS ((bfd *, struct bfd_link_info *, asection *,
- const Elf_Internal_Rela *));
-static boolean elf_i386_adjust_dynamic_symbol
- PARAMS ((struct bfd_link_info *, struct elf_link_hash_entry *));
-static boolean allocate_dynrelocs
- PARAMS ((struct elf_link_hash_entry *, PTR));
-static boolean readonly_dynrelocs
- PARAMS ((struct elf_link_hash_entry *, PTR));
-static boolean elf_i386_fake_sections
- PARAMS ((bfd *, Elf32_Internal_Shdr *, asection *));
-static boolean elf_i386_size_dynamic_sections
- PARAMS ((bfd *, struct bfd_link_info *));
-static bfd_vma dtpoff_base
- PARAMS ((struct bfd_link_info *));
-static bfd_vma tpoff
- PARAMS ((struct bfd_link_info *, bfd_vma));
-static boolean elf_i386_relocate_section
- PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *,
- Elf_Internal_Rela *, Elf_Internal_Sym *, asection **));
-static boolean elf_i386_finish_dynamic_symbol
- PARAMS ((bfd *, struct bfd_link_info *, struct elf_link_hash_entry *,
- Elf_Internal_Sym *));
-static enum elf_reloc_type_class elf_i386_reloc_type_class
- PARAMS ((const Elf_Internal_Rela *));
-static boolean elf_i386_finish_dynamic_sections
- PARAMS ((bfd *, struct bfd_link_info *));
-
-#define USE_REL 1 /* 386 uses REL relocations instead of RELA */
+/* 386 uses REL relocations instead of RELA. */
+#define USE_REL 1
#include "elf/i386.h"
static reloc_howto_type elf_howto_table[]=
{
- HOWTO(R_386_NONE, 0, 0, 0, false, 0, complain_overflow_bitfield,
+ HOWTO(R_386_NONE, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_386_NONE",
- true, 0x00000000, 0x00000000, false),
- HOWTO(R_386_32, 0, 2, 32, false, 0, complain_overflow_bitfield,
+ TRUE, 0x00000000, 0x00000000, FALSE),
+ HOWTO(R_386_32, 0, 2, 32, FALSE, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_386_32",
- true, 0xffffffff, 0xffffffff, false),
- HOWTO(R_386_PC32, 0, 2, 32, true, 0, complain_overflow_bitfield,
+ TRUE, 0xffffffff, 0xffffffff, FALSE),
+ HOWTO(R_386_PC32, 0, 2, 32, TRUE, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_386_PC32",
- true, 0xffffffff, 0xffffffff, true),
- HOWTO(R_386_GOT32, 0, 2, 32, false, 0, complain_overflow_bitfield,
+ TRUE, 0xffffffff, 0xffffffff, TRUE),
+ HOWTO(R_386_GOT32, 0, 2, 32, FALSE, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_386_GOT32",
- true, 0xffffffff, 0xffffffff, false),
- HOWTO(R_386_PLT32, 0, 2, 32, true, 0, complain_overflow_bitfield,
+ TRUE, 0xffffffff, 0xffffffff, FALSE),
+ HOWTO(R_386_PLT32, 0, 2, 32, TRUE, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_386_PLT32",
- true, 0xffffffff, 0xffffffff, true),
- HOWTO(R_386_COPY, 0, 2, 32, false, 0, complain_overflow_bitfield,
+ TRUE, 0xffffffff, 0xffffffff, TRUE),
+ HOWTO(R_386_COPY, 0, 2, 32, FALSE, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_386_COPY",
- true, 0xffffffff, 0xffffffff, false),
- HOWTO(R_386_GLOB_DAT, 0, 2, 32, false, 0, complain_overflow_bitfield,
+ TRUE, 0xffffffff, 0xffffffff, FALSE),
+ HOWTO(R_386_GLOB_DAT, 0, 2, 32, FALSE, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_386_GLOB_DAT",
- true, 0xffffffff, 0xffffffff, false),
- HOWTO(R_386_JUMP_SLOT, 0, 2, 32, false, 0, complain_overflow_bitfield,
+ TRUE, 0xffffffff, 0xffffffff, FALSE),
+ HOWTO(R_386_JUMP_SLOT, 0, 2, 32, FALSE, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_386_JUMP_SLOT",
- true, 0xffffffff, 0xffffffff, false),
- HOWTO(R_386_RELATIVE, 0, 2, 32, false, 0, complain_overflow_bitfield,
+ TRUE, 0xffffffff, 0xffffffff, FALSE),
+ HOWTO(R_386_RELATIVE, 0, 2, 32, FALSE, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_386_RELATIVE",
- true, 0xffffffff, 0xffffffff, false),
- HOWTO(R_386_GOTOFF, 0, 2, 32, false, 0, complain_overflow_bitfield,
+ TRUE, 0xffffffff, 0xffffffff, FALSE),
+ HOWTO(R_386_GOTOFF, 0, 2, 32, FALSE, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_386_GOTOFF",
- true, 0xffffffff, 0xffffffff, false),
- HOWTO(R_386_GOTPC, 0, 2, 32, true, 0, complain_overflow_bitfield,
+ TRUE, 0xffffffff, 0xffffffff, FALSE),
+ HOWTO(R_386_GOTPC, 0, 2, 32, TRUE, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_386_GOTPC",
- true, 0xffffffff, 0xffffffff, true),
+ TRUE, 0xffffffff, 0xffffffff, TRUE),
/* We have a gap in the reloc numbers here.
R_386_standard counts the number up to this point, and
R_386_ext_offset is the value to subtract from a reloc type of
R_386_16 thru R_386_PC8 to form an index into this table. */
-#define R_386_standard ((unsigned int) R_386_GOTPC + 1)
-#define R_386_ext_offset ((unsigned int) R_386_TLS_TPOFF - R_386_standard)
+#define R_386_standard (R_386_GOTPC + 1)
+#define R_386_ext_offset (R_386_TLS_TPOFF - R_386_standard)
/* These relocs are a GNU extension. */
- HOWTO(R_386_TLS_TPOFF, 0, 2, 32, false, 0, complain_overflow_bitfield,
+ HOWTO(R_386_TLS_TPOFF, 0, 2, 32, FALSE, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_386_TLS_TPOFF",
- true, 0xffffffff, 0xffffffff, false),
- HOWTO(R_386_TLS_IE, 0, 2, 32, false, 0, complain_overflow_bitfield,
+ TRUE, 0xffffffff, 0xffffffff, FALSE),
+ HOWTO(R_386_TLS_IE, 0, 2, 32, FALSE, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_386_TLS_IE",
- true, 0xffffffff, 0xffffffff, false),
- HOWTO(R_386_TLS_GOTIE, 0, 2, 32, false, 0, complain_overflow_bitfield,
+ TRUE, 0xffffffff, 0xffffffff, FALSE),
+ HOWTO(R_386_TLS_GOTIE, 0, 2, 32, FALSE, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_386_TLS_GOTIE",
- true, 0xffffffff, 0xffffffff, false),
- HOWTO(R_386_TLS_LE, 0, 2, 32, false, 0, complain_overflow_bitfield,
+ TRUE, 0xffffffff, 0xffffffff, FALSE),
+ HOWTO(R_386_TLS_LE, 0, 2, 32, FALSE, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_386_TLS_LE",
- true, 0xffffffff, 0xffffffff, false),
- HOWTO(R_386_TLS_GD, 0, 2, 32, false, 0, complain_overflow_bitfield,
+ TRUE, 0xffffffff, 0xffffffff, FALSE),
+ HOWTO(R_386_TLS_GD, 0, 2, 32, FALSE, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_386_TLS_GD",
- true, 0xffffffff, 0xffffffff, false),
- HOWTO(R_386_TLS_LDM, 0, 2, 32, false, 0, complain_overflow_bitfield,
+ TRUE, 0xffffffff, 0xffffffff, FALSE),
+ HOWTO(R_386_TLS_LDM, 0, 2, 32, FALSE, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_386_TLS_LDM",
- true, 0xffffffff, 0xffffffff, false),
- HOWTO(R_386_16, 0, 1, 16, false, 0, complain_overflow_bitfield,
+ TRUE, 0xffffffff, 0xffffffff, FALSE),
+ HOWTO(R_386_16, 0, 1, 16, FALSE, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_386_16",
- true, 0xffff, 0xffff, false),
- HOWTO(R_386_PC16, 0, 1, 16, true, 0, complain_overflow_bitfield,
+ TRUE, 0xffff, 0xffff, FALSE),
+ HOWTO(R_386_PC16, 0, 1, 16, TRUE, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_386_PC16",
- true, 0xffff, 0xffff, true),
- HOWTO(R_386_8, 0, 0, 8, false, 0, complain_overflow_bitfield,
+ TRUE, 0xffff, 0xffff, TRUE),
+ HOWTO(R_386_8, 0, 0, 8, FALSE, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_386_8",
- true, 0xff, 0xff, false),
- HOWTO(R_386_PC8, 0, 0, 8, true, 0, complain_overflow_signed,
+ TRUE, 0xff, 0xff, FALSE),
+ HOWTO(R_386_PC8, 0, 0, 8, TRUE, 0, complain_overflow_signed,
bfd_elf_generic_reloc, "R_386_PC8",
- true, 0xff, 0xff, true),
+ TRUE, 0xff, 0xff, TRUE),
-#define R_386_ext ((unsigned int) R_386_PC8 + 1 - R_386_ext_offset)
-#define R_386_tls_offset ((unsigned int) R_386_TLS_LDO_32 - R_386_ext)
+#define R_386_ext (R_386_PC8 + 1 - R_386_ext_offset)
+#define R_386_tls_offset (R_386_TLS_LDO_32 - R_386_ext)
/* These are common with Solaris TLS implementation. */
- HOWTO(R_386_TLS_LDO_32, 0, 2, 32, false, 0, complain_overflow_bitfield,
+ HOWTO(R_386_TLS_LDO_32, 0, 2, 32, FALSE, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_386_TLS_LDO_32",
- true, 0xffffffff, 0xffffffff, false),
- HOWTO(R_386_TLS_IE_32, 0, 2, 32, false, 0, complain_overflow_bitfield,
+ TRUE, 0xffffffff, 0xffffffff, FALSE),
+ HOWTO(R_386_TLS_IE_32, 0, 2, 32, FALSE, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_386_TLS_IE_32",
- true, 0xffffffff, 0xffffffff, false),
- HOWTO(R_386_TLS_LE_32, 0, 2, 32, false, 0, complain_overflow_bitfield,
+ TRUE, 0xffffffff, 0xffffffff, FALSE),
+ HOWTO(R_386_TLS_LE_32, 0, 2, 32, FALSE, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_386_TLS_LE_32",
- true, 0xffffffff, 0xffffffff, false),
- HOWTO(R_386_TLS_DTPMOD32, 0, 2, 32, false, 0, complain_overflow_bitfield,
+ TRUE, 0xffffffff, 0xffffffff, FALSE),
+ HOWTO(R_386_TLS_DTPMOD32, 0, 2, 32, FALSE, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_386_TLS_DTPMOD32",
- true, 0xffffffff, 0xffffffff, false),
- HOWTO(R_386_TLS_DTPOFF32, 0, 2, 32, false, 0, complain_overflow_bitfield,
+ TRUE, 0xffffffff, 0xffffffff, FALSE),
+ HOWTO(R_386_TLS_DTPOFF32, 0, 2, 32, FALSE, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_386_TLS_DTPOFF32",
- true, 0xffffffff, 0xffffffff, false),
- HOWTO(R_386_TLS_TPOFF32, 0, 2, 32, false, 0, complain_overflow_bitfield,
+ TRUE, 0xffffffff, 0xffffffff, FALSE),
+ HOWTO(R_386_TLS_TPOFF32, 0, 2, 32, FALSE, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_386_TLS_TPOFF32",
- true, 0xffffffff, 0xffffffff, false),
+ TRUE, 0xffffffff, 0xffffffff, FALSE),
/* Another gap. */
-#define R_386_tls ((unsigned int) R_386_TLS_TPOFF32 + 1 - R_386_tls_offset)
-#define R_386_vt_offset ((unsigned int) R_386_GNU_VTINHERIT - R_386_tls)
+#define R_386_tls (R_386_TLS_TPOFF32 + 1 - R_386_tls_offset)
+#define R_386_vt_offset (R_386_GNU_VTINHERIT - R_386_tls)
/* GNU extension to record C++ vtable hierarchy. */
HOWTO (R_386_GNU_VTINHERIT, /* type */
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
0, /* bitsize */
- false, /* pc_relative */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
NULL, /* special_function */
"R_386_GNU_VTINHERIT", /* name */
- false, /* partial_inplace */
+ FALSE, /* partial_inplace */
0, /* src_mask */
0, /* dst_mask */
- false), /* pcrel_offset */
+ FALSE), /* pcrel_offset */
/* GNU extension to record C++ vtable member usage. */
HOWTO (R_386_GNU_VTENTRY, /* type */
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
0, /* bitsize */
- false, /* pc_relative */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
_bfd_elf_rel_vtable_reloc_fn, /* special_function */
"R_386_GNU_VTENTRY", /* name */
- false, /* partial_inplace */
+ FALSE, /* partial_inplace */
0, /* src_mask */
0, /* dst_mask */
- false) /* pcrel_offset */
+ FALSE) /* pcrel_offset */
-#define R_386_vt ((unsigned int) R_386_GNU_VTENTRY + 1 - R_386_vt_offset)
+#define R_386_vt (R_386_GNU_VTENTRY + 1 - R_386_vt_offset)
};
#ifdef DEBUG_GEN_RELOC
-#define TRACE(str) fprintf (stderr, "i386 bfd reloc lookup %d (%s)\n", code, str)
+#define TRACE(str) \
+ fprintf (stderr, "i386 bfd reloc lookup %d (%s)\n", code, str)
#else
#define TRACE(str)
#endif
static reloc_howto_type *
-elf_i386_reloc_type_lookup (abfd, code)
- bfd *abfd ATTRIBUTE_UNUSED;
- bfd_reloc_code_real_type code;
+elf_i386_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED,
+ bfd_reloc_code_real_type code)
{
switch (code)
{
case BFD_RELOC_NONE:
TRACE ("BFD_RELOC_NONE");
- return &elf_howto_table[(unsigned int) R_386_NONE ];
+ return &elf_howto_table[R_386_NONE];
case BFD_RELOC_32:
TRACE ("BFD_RELOC_32");
- return &elf_howto_table[(unsigned int) R_386_32 ];
+ return &elf_howto_table[R_386_32];
case BFD_RELOC_CTOR:
TRACE ("BFD_RELOC_CTOR");
- return &elf_howto_table[(unsigned int) R_386_32 ];
+ return &elf_howto_table[R_386_32];
case BFD_RELOC_32_PCREL:
TRACE ("BFD_RELOC_PC32");
- return &elf_howto_table[(unsigned int) R_386_PC32 ];
+ return &elf_howto_table[R_386_PC32];
case BFD_RELOC_386_GOT32:
TRACE ("BFD_RELOC_386_GOT32");
- return &elf_howto_table[(unsigned int) R_386_GOT32 ];
+ return &elf_howto_table[R_386_GOT32];
case BFD_RELOC_386_PLT32:
TRACE ("BFD_RELOC_386_PLT32");
- return &elf_howto_table[(unsigned int) R_386_PLT32 ];
+ return &elf_howto_table[R_386_PLT32];
case BFD_RELOC_386_COPY:
TRACE ("BFD_RELOC_386_COPY");
- return &elf_howto_table[(unsigned int) R_386_COPY ];
+ return &elf_howto_table[R_386_COPY];
case BFD_RELOC_386_GLOB_DAT:
TRACE ("BFD_RELOC_386_GLOB_DAT");
- return &elf_howto_table[(unsigned int) R_386_GLOB_DAT ];
+ return &elf_howto_table[R_386_GLOB_DAT];
case BFD_RELOC_386_JUMP_SLOT:
TRACE ("BFD_RELOC_386_JUMP_SLOT");
- return &elf_howto_table[(unsigned int) R_386_JUMP_SLOT ];
+ return &elf_howto_table[R_386_JUMP_SLOT];
case BFD_RELOC_386_RELATIVE:
TRACE ("BFD_RELOC_386_RELATIVE");
- return &elf_howto_table[(unsigned int) R_386_RELATIVE ];
+ return &elf_howto_table[R_386_RELATIVE];
case BFD_RELOC_386_GOTOFF:
TRACE ("BFD_RELOC_386_GOTOFF");
- return &elf_howto_table[(unsigned int) R_386_GOTOFF ];
+ return &elf_howto_table[R_386_GOTOFF];
case BFD_RELOC_386_GOTPC:
TRACE ("BFD_RELOC_386_GOTPC");
- return &elf_howto_table[(unsigned int) R_386_GOTPC ];
+ return &elf_howto_table[R_386_GOTPC];
/* These relocs are a GNU extension. */
case BFD_RELOC_386_TLS_TPOFF:
TRACE ("BFD_RELOC_386_TLS_TPOFF");
- return &elf_howto_table[(unsigned int) R_386_TLS_TPOFF - R_386_ext_offset];
+ return &elf_howto_table[R_386_TLS_TPOFF - R_386_ext_offset];
case BFD_RELOC_386_TLS_IE:
TRACE ("BFD_RELOC_386_TLS_IE");
- return &elf_howto_table[(unsigned int) R_386_TLS_IE - R_386_ext_offset];
+ return &elf_howto_table[R_386_TLS_IE - R_386_ext_offset];
case BFD_RELOC_386_TLS_GOTIE:
TRACE ("BFD_RELOC_386_TLS_GOTIE");
- return &elf_howto_table[(unsigned int) R_386_TLS_GOTIE - R_386_ext_offset];
+ return &elf_howto_table[R_386_TLS_GOTIE - R_386_ext_offset];
case BFD_RELOC_386_TLS_LE:
TRACE ("BFD_RELOC_386_TLS_LE");
- return &elf_howto_table[(unsigned int) R_386_TLS_LE - R_386_ext_offset];
+ return &elf_howto_table[R_386_TLS_LE - R_386_ext_offset];
case BFD_RELOC_386_TLS_GD:
TRACE ("BFD_RELOC_386_TLS_GD");
- return &elf_howto_table[(unsigned int) R_386_TLS_GD - R_386_ext_offset];
+ return &elf_howto_table[R_386_TLS_GD - R_386_ext_offset];
case BFD_RELOC_386_TLS_LDM:
TRACE ("BFD_RELOC_386_TLS_LDM");
- return &elf_howto_table[(unsigned int) R_386_TLS_LDM - R_386_ext_offset];
+ return &elf_howto_table[R_386_TLS_LDM - R_386_ext_offset];
case BFD_RELOC_16:
TRACE ("BFD_RELOC_16");
- return &elf_howto_table[(unsigned int) R_386_16 - R_386_ext_offset];
+ return &elf_howto_table[R_386_16 - R_386_ext_offset];
case BFD_RELOC_16_PCREL:
TRACE ("BFD_RELOC_16_PCREL");
- return &elf_howto_table[(unsigned int) R_386_PC16 - R_386_ext_offset];
+ return &elf_howto_table[R_386_PC16 - R_386_ext_offset];
case BFD_RELOC_8:
TRACE ("BFD_RELOC_8");
- return &elf_howto_table[(unsigned int) R_386_8 - R_386_ext_offset];
+ return &elf_howto_table[R_386_8 - R_386_ext_offset];
case BFD_RELOC_8_PCREL:
TRACE ("BFD_RELOC_8_PCREL");
- return &elf_howto_table[(unsigned int) R_386_PC8 - R_386_ext_offset];
+ return &elf_howto_table[R_386_PC8 - R_386_ext_offset];
/* Common with Sun TLS implementation. */
case BFD_RELOC_386_TLS_LDO_32:
TRACE ("BFD_RELOC_386_TLS_LDO_32");
- return &elf_howto_table[(unsigned int) R_386_TLS_LDO_32 - R_386_tls_offset];
+ return &elf_howto_table[R_386_TLS_LDO_32 - R_386_tls_offset];
case BFD_RELOC_386_TLS_IE_32:
TRACE ("BFD_RELOC_386_TLS_IE_32");
- return &elf_howto_table[(unsigned int) R_386_TLS_IE_32 - R_386_tls_offset];
+ return &elf_howto_table[R_386_TLS_IE_32 - R_386_tls_offset];
case BFD_RELOC_386_TLS_LE_32:
TRACE ("BFD_RELOC_386_TLS_LE_32");
- return &elf_howto_table[(unsigned int) R_386_TLS_LE_32 - R_386_tls_offset];
+ return &elf_howto_table[R_386_TLS_LE_32 - R_386_tls_offset];
case BFD_RELOC_386_TLS_DTPMOD32:
TRACE ("BFD_RELOC_386_TLS_DTPMOD32");
- return &elf_howto_table[(unsigned int) R_386_TLS_DTPMOD32 - R_386_tls_offset];
+ return &elf_howto_table[R_386_TLS_DTPMOD32 - R_386_tls_offset];
case BFD_RELOC_386_TLS_DTPOFF32:
TRACE ("BFD_RELOC_386_TLS_DTPOFF32");
- return &elf_howto_table[(unsigned int) R_386_TLS_DTPOFF32 - R_386_tls_offset];
+ return &elf_howto_table[R_386_TLS_DTPOFF32 - R_386_tls_offset];
case BFD_RELOC_386_TLS_TPOFF32:
TRACE ("BFD_RELOC_386_TLS_TPOFF32");
- return &elf_howto_table[(unsigned int) R_386_TLS_TPOFF32 - R_386_tls_offset];
+ return &elf_howto_table[R_386_TLS_TPOFF32 - R_386_tls_offset];
case BFD_RELOC_VTABLE_INHERIT:
TRACE ("BFD_RELOC_VTABLE_INHERIT");
- return &elf_howto_table[(unsigned int) R_386_GNU_VTINHERIT
- - R_386_vt_offset];
+ return &elf_howto_table[R_386_GNU_VTINHERIT - R_386_vt_offset];
case BFD_RELOC_VTABLE_ENTRY:
TRACE ("BFD_RELOC_VTABLE_ENTRY");
- return &elf_howto_table[(unsigned int) R_386_GNU_VTENTRY
- - R_386_vt_offset];
+ return &elf_howto_table[R_386_GNU_VTENTRY - R_386_vt_offset];
default:
break;
@@ -373,19 +308,9 @@ elf_i386_reloc_type_lookup (abfd, code)
}
static void
-elf_i386_info_to_howto (abfd, cache_ptr, dst)
- bfd *abfd ATTRIBUTE_UNUSED;
- arelent *cache_ptr ATTRIBUTE_UNUSED;
- Elf32_Internal_Rela *dst ATTRIBUTE_UNUSED;
-{
- abort ();
-}
-
-static void
-elf_i386_info_to_howto_rel (abfd, cache_ptr, dst)
- bfd *abfd ATTRIBUTE_UNUSED;
- arelent *cache_ptr;
- Elf32_Internal_Rel *dst;
+elf_i386_info_to_howto_rel (bfd *abfd ATTRIBUTE_UNUSED,
+ arelent *cache_ptr,
+ Elf_Internal_Rela *dst)
{
unsigned int r_type = ELF32_R_TYPE (dst->r_info);
unsigned int indx;
@@ -400,7 +325,7 @@ elf_i386_info_to_howto_rel (abfd, cache_ptr, dst)
{
(*_bfd_error_handler) (_("%s: invalid relocation type %d"),
bfd_archive_filename (abfd), (int) r_type);
- indx = (unsigned int) R_386_NONE;
+ indx = R_386_NONE;
}
cache_ptr->howto = &elf_howto_table[indx];
}
@@ -411,43 +336,60 @@ elf_i386_info_to_howto_rel (abfd, cache_ptr, dst)
If so, we should move the .X recognition into
_bfd_elf_is_local_label_name. */
-static boolean
-elf_i386_is_local_label_name (abfd, name)
- bfd *abfd;
- const char *name;
+static bfd_boolean
+elf_i386_is_local_label_name (bfd *abfd, const char *name)
{
if (name[0] == '.' && name[1] == 'X')
- return true;
+ return TRUE;
return _bfd_elf_is_local_label_name (abfd, name);
}
/* Support for core dump NOTE sections. */
-static boolean
-elf_i386_grok_prstatus (abfd, note)
- bfd *abfd;
- Elf_Internal_Note *note;
+
+static bfd_boolean
+elf_i386_grok_prstatus (bfd *abfd, Elf_Internal_Note *note)
{
int offset;
size_t raw_size;
- switch (note->descsz)
+ if (note->namesz == 8 && strcmp (note->namedata, "FreeBSD") == 0)
{
- default:
- return false;
+ int pr_version = bfd_get_32 (abfd, note->descdata);
- case 144: /* Linux/i386 */
- /* pr_cursig */
- elf_tdata (abfd)->core_signal = bfd_get_16 (abfd, note->descdata + 12);
+ if (pr_version != 1)
+ return FALSE;
- /* pr_pid */
- elf_tdata (abfd)->core_pid = bfd_get_32 (abfd, note->descdata + 24);
+ /* pr_cursig */
+ elf_tdata (abfd)->core_signal = bfd_get_32 (abfd, note->descdata + 20);
- /* pr_reg */
- offset = 72;
- raw_size = 68;
+ /* pr_pid */
+ elf_tdata (abfd)->core_pid = bfd_get_32 (abfd, note->descdata + 24);
- break;
+ /* pr_reg */
+ offset = 28;
+ raw_size = bfd_get_32 (abfd, note->descdata + 8);
+ }
+ else
+ {
+ switch (note->descsz)
+ {
+ default:
+ return FALSE;
+
+ case 144: /* Linux/i386 */
+ /* pr_cursig */
+ elf_tdata (abfd)->core_signal = bfd_get_16 (abfd, note->descdata + 12);
+
+ /* pr_pid */
+ elf_tdata (abfd)->core_pid = bfd_get_32 (abfd, note->descdata + 24);
+
+ /* pr_reg */
+ offset = 72;
+ raw_size = 68;
+
+ break;
+ }
}
/* Make a ".reg/999" section. */
@@ -455,27 +397,39 @@ elf_i386_grok_prstatus (abfd, note)
raw_size, note->descpos + offset);
}
-static boolean
-elf_i386_grok_psinfo (abfd, note)
- bfd *abfd;
- Elf_Internal_Note *note;
+static bfd_boolean
+elf_i386_grok_psinfo (bfd *abfd, Elf_Internal_Note *note)
{
- switch (note->descsz)
+ if (note->namesz == 8 && strcmp (note->namedata, "FreeBSD") == 0)
+ {
+ int pr_version = bfd_get_32 (abfd, note->descdata);
+
+ if (pr_version != 1)
+ return FALSE;
+
+ elf_tdata (abfd)->core_program
+ = _bfd_elfcore_strndup (abfd, note->descdata + 8, 17);
+ elf_tdata (abfd)->core_command
+ = _bfd_elfcore_strndup (abfd, note->descdata + 25, 81);
+ }
+ else
{
- default:
- return false;
-
- case 124: /* Linux/i386 elf_prpsinfo */
- elf_tdata (abfd)->core_program
- = _bfd_elfcore_strndup (abfd, note->descdata + 28, 16);
- elf_tdata (abfd)->core_command
- = _bfd_elfcore_strndup (abfd, note->descdata + 44, 80);
+ switch (note->descsz)
+ {
+ default:
+ return FALSE;
+
+ case 124: /* Linux/i386 elf_prpsinfo. */
+ elf_tdata (abfd)->core_program
+ = _bfd_elfcore_strndup (abfd, note->descdata + 28, 16);
+ elf_tdata (abfd)->core_command
+ = _bfd_elfcore_strndup (abfd, note->descdata + 44, 80);
+ }
}
/* Note that for some reason, a spurious space is tacked
onto the end of the args in some (at least one anyway)
implementations, so strip it off if it exists. */
-
{
char *command = elf_tdata (abfd)->core_command;
int n = strlen (command);
@@ -484,7 +438,7 @@ elf_i386_grok_psinfo (abfd, note)
command[n - 1] = '\0';
}
- return true;
+ return TRUE;
}
/* Functions for the i386 ELF linker.
@@ -506,6 +460,12 @@ elf_i386_grok_psinfo (abfd, note)
#define ELF_DYNAMIC_INTERPRETER "/usr/lib/libc.so.1"
+/* If ELIMINATE_COPY_RELOCS is non-zero, the linker will try to avoid
+ copying dynamic variables from a shared lib into an app's dynbss
+ section, and instead use a dynamic relocation to point into the
+ shared lib. */
+#define ELIMINATE_COPY_RELOCS 1
+
/* The size in bytes of an entry in the procedure linkage table. */
#define PLT_ENTRY_SIZE 16
@@ -611,30 +571,14 @@ struct elf_i386_obj_tdata
#define elf_i386_local_got_tls_type(abfd) \
(elf_i386_tdata (abfd)->local_got_tls_type)
-static boolean
-elf_i386_mkobject (abfd)
- bfd *abfd;
+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;
-}
-
-static boolean
-elf_i386_object_p (abfd)
- bfd *abfd;
-{
- /* Allocate our special target data. */
- struct elf_i386_obj_tdata *new_tdata;
- bfd_size_type amt = sizeof (struct elf_i386_obj_tdata);
- new_tdata = bfd_zalloc (abfd, amt);
- if (new_tdata == NULL)
- return false;
- new_tdata->root = *abfd->tdata.elf_obj_data;
- abfd->tdata.any = new_tdata;
- return true;
+ return FALSE;
+ return TRUE;
}
/* i386 ELF linker hash table. */
@@ -669,10 +613,9 @@ struct elf_i386_link_hash_table
/* 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;
+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. */
@@ -701,13 +644,12 @@ link_hash_newfunc (entry, table, string)
/* Create an i386 ELF linker hash table. */
static struct bfd_link_hash_table *
-elf_i386_link_hash_table_create (abfd)
- bfd *abfd;
+elf_i386_link_hash_table_create (bfd *abfd)
{
struct elf_i386_link_hash_table *ret;
bfd_size_type amt = sizeof (struct elf_i386_link_hash_table);
- ret = (struct elf_i386_link_hash_table *) bfd_malloc (amt);
+ ret = bfd_malloc (amt);
if (ret == NULL)
return NULL;
@@ -733,15 +675,13 @@ elf_i386_link_hash_table_create (abfd)
/* Create .got, .gotplt, and .rel.got sections in DYNOBJ, and set up
shortcuts to them in our hash table. */
-static boolean
-create_got_section (dynobj, info)
- bfd *dynobj;
- struct bfd_link_info *info;
+static bfd_boolean
+create_got_section (bfd *dynobj, struct bfd_link_info *info)
{
struct elf_i386_link_hash_table *htab;
if (! _bfd_elf_create_got_section (dynobj, info))
- return false;
+ return FALSE;
htab = elf_i386_hash_table (info);
htab->sgot = bfd_get_section_by_name (dynobj, ".got");
@@ -756,27 +696,25 @@ create_got_section (dynobj, info)
| SEC_IN_MEMORY | SEC_LINKER_CREATED
| SEC_READONLY))
|| ! bfd_set_section_alignment (dynobj, htab->srelgot, 2))
- return false;
- return true;
+ 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 boolean
-elf_i386_create_dynamic_sections (dynobj, info)
- bfd *dynobj;
- struct bfd_link_info *info;
+static bfd_boolean
+elf_i386_create_dynamic_sections (bfd *dynobj, struct bfd_link_info *info)
{
struct elf_i386_link_hash_table *htab;
htab = elf_i386_hash_table (info);
if (!htab->sgot && !create_got_section (dynobj, info))
- return false;
+ return FALSE;
if (!_bfd_elf_create_dynamic_sections (dynobj, info))
- return false;
+ return FALSE;
htab->splt = bfd_get_section_by_name (dynobj, ".plt");
htab->srelplt = bfd_get_section_by_name (dynobj, ".rel.plt");
@@ -788,15 +726,15 @@ elf_i386_create_dynamic_sections (dynobj, info)
|| (!info->shared && !htab->srelbss))
abort ();
- return true;
+ return TRUE;
}
/* Copy the extra info we tack onto an elf_link_hash_entry. */
static void
-elf_i386_copy_indirect_symbol (bed, dir, ind)
- struct elf_backend_data *bed;
- struct elf_link_hash_entry *dir, *ind;
+elf_i386_copy_indirect_symbol (const struct elf_backend_data *bed,
+ struct elf_link_hash_entry *dir,
+ struct elf_link_hash_entry *ind)
{
struct elf_i386_link_hash_entry *edir, *eind;
@@ -843,14 +781,25 @@ elf_i386_copy_indirect_symbol (bed, dir, ind)
edir->tls_type = eind->tls_type;
eind->tls_type = GOT_UNKNOWN;
}
- _bfd_elf_link_hash_copy_indirect (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
+ | ELF_LINK_POINTER_EQUALITY_NEEDED));
+ else
+ _bfd_elf_link_hash_copy_indirect (bed, dir, ind);
}
static int
-elf_i386_tls_transition (info, r_type, is_local)
- struct bfd_link_info *info;
- int r_type;
- int is_local;
+elf_i386_tls_transition (struct bfd_link_info *info, int r_type, int is_local)
{
if (info->shared)
return r_type;
@@ -878,12 +827,11 @@ elf_i386_tls_transition (info, r_type, is_local)
calculate needed space in the global offset table, procedure linkage
table, and dynamic reloc sections. */
-static boolean
-elf_i386_check_relocs (abfd, info, sec, relocs)
- bfd *abfd;
- struct bfd_link_info *info;
- asection *sec;
- const Elf_Internal_Rela *relocs;
+static bfd_boolean
+elf_i386_check_relocs (bfd *abfd,
+ struct bfd_link_info *info,
+ asection *sec,
+ const Elf_Internal_Rela *relocs)
{
struct elf_i386_link_hash_table *htab;
Elf_Internal_Shdr *symtab_hdr;
@@ -892,8 +840,8 @@ elf_i386_check_relocs (abfd, info, sec, relocs)
const Elf_Internal_Rela *rel_end;
asection *sreloc;
- if (info->relocateable)
- return true;
+ if (info->relocatable)
+ return TRUE;
htab = elf_i386_hash_table (info);
symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
@@ -916,7 +864,7 @@ elf_i386_check_relocs (abfd, info, sec, relocs)
(*_bfd_error_handler) (_("%s: bad symbol index: %d"),
bfd_archive_filename (abfd),
r_symndx);
- return false;
+ return FALSE;
}
if (r_symndx < symtab_hdr->sh_info)
@@ -997,10 +945,9 @@ elf_i386_check_relocs (abfd, info, sec, relocs)
size = symtab_hdr->sh_info;
size *= (sizeof (bfd_signed_vma) + sizeof(char));
- local_got_refcounts = ((bfd_signed_vma *)
- bfd_zalloc (abfd, size));
+ local_got_refcounts = bfd_zalloc (abfd, size);
if (local_got_refcounts == NULL)
- return false;
+ return FALSE;
elf_local_got_refcounts (abfd) = local_got_refcounts;
elf_i386_local_got_tls_type (abfd)
= (char *) (local_got_refcounts + symtab_hdr->sh_info);
@@ -1022,10 +969,11 @@ elf_i386_check_relocs (abfd, info, sec, relocs)
else
{
(*_bfd_error_handler)
- (_("%s: `%s' accessed both as normal and thread local symbol"),
+ (_("%s: `%s' accessed both as normal and "
+ "thread local symbol"),
bfd_archive_filename (abfd),
h ? h->root.root.string : "<local>");
- return false;
+ return FALSE;
}
}
@@ -1047,7 +995,7 @@ elf_i386_check_relocs (abfd, info, sec, relocs)
if (htab->elf.dynobj == NULL)
htab->elf.dynobj = abfd;
if (!create_got_section (htab->elf.dynobj, info))
- return false;
+ return FALSE;
}
if (r_type != R_386_TLS_IE)
break;
@@ -1057,7 +1005,8 @@ elf_i386_check_relocs (abfd, info, sec, relocs)
case R_386_TLS_LE:
if (!info->shared)
break;
- /* Fall through */
+ info->flags |= DF_STATIC_TLS;
+ /* Fall through */
case R_386_32:
case R_386_PC32:
@@ -1074,6 +1023,8 @@ elf_i386_check_relocs (abfd, info, sec, relocs)
/* We may need a .plt entry if the function this reloc
refers to is in a shared lib. */
h->plt.refcount += 1;
+ if (r_type != R_386_PC32)
+ h->elf_link_hash_flags |= ELF_LINK_POINTER_EQUALITY_NEEDED;
}
/* If we are creating a shared library, and this is a reloc
@@ -1105,7 +1056,8 @@ elf_i386_check_relocs (abfd, info, sec, relocs)
|| h->root.type == bfd_link_hash_defweak
|| (h->elf_link_hash_flags
& ELF_LINK_HASH_DEF_REGULAR) == 0))))
- || (!info->shared
+ || (ELIMINATE_COPY_RELOCS
+ && !info->shared
&& (sec->flags & SEC_ALLOC) != 0
&& h != NULL
&& (h->root.type == bfd_link_hash_defweak
@@ -1127,7 +1079,7 @@ elf_i386_check_relocs (abfd, info, sec, relocs)
name = bfd_elf_string_from_elf_section (abfd, strndx, shnam);
if (name == NULL)
- return false;
+ return FALSE;
if (strncmp (name, ".rel", 4) != 0
|| strcmp (bfd_get_section_name (abfd, sec),
@@ -1155,7 +1107,7 @@ elf_i386_check_relocs (abfd, info, sec, relocs)
if (sreloc == NULL
|| ! bfd_set_section_flags (dynobj, sreloc, flags)
|| ! bfd_set_section_alignment (dynobj, sreloc, 2))
- return false;
+ return FALSE;
}
elf_section_data (sec)->sreloc = sreloc;
}
@@ -1176,7 +1128,7 @@ elf_i386_check_relocs (abfd, info, sec, relocs)
s = bfd_section_from_r_symndx (abfd, &htab->sym_sec,
sec, r_symndx);
if (s == NULL)
- return false;
+ return FALSE;
head = ((struct elf_i386_dyn_relocs **)
&elf_section_data (s)->local_dynrel);
@@ -1186,10 +1138,9 @@ elf_i386_check_relocs (abfd, info, sec, relocs)
if (p == NULL || p->sec != sec)
{
bfd_size_type amt = sizeof *p;
- p = ((struct elf_i386_dyn_relocs *)
- bfd_alloc (htab->elf.dynobj, amt));
+ p = bfd_alloc (htab->elf.dynobj, amt);
if (p == NULL)
- return false;
+ return FALSE;
p->next = *head;
*head = p;
p->sec = sec;
@@ -1206,15 +1157,15 @@ elf_i386_check_relocs (abfd, info, sec, relocs)
/* This relocation describes the C++ object vtable hierarchy.
Reconstruct it for later use during GC. */
case R_386_GNU_VTINHERIT:
- if (!_bfd_elf32_gc_record_vtinherit (abfd, sec, h, rel->r_offset))
- return false;
+ if (!bfd_elf_gc_record_vtinherit (abfd, sec, h, rel->r_offset))
+ return FALSE;
break;
/* This relocation describes which C++ vtable entries are actually
used. Record for later use during GC. */
case R_386_GNU_VTENTRY:
- if (!_bfd_elf32_gc_record_vtentry (abfd, sec, h, rel->r_offset))
- return false;
+ if (!bfd_elf_gc_record_vtentry (abfd, sec, h, rel->r_offset))
+ return FALSE;
break;
default:
@@ -1222,19 +1173,18 @@ elf_i386_check_relocs (abfd, info, sec, relocs)
}
}
- return true;
+ return TRUE;
}
/* Return the section that should be marked against GC for a given
relocation. */
static asection *
-elf_i386_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_i386_gc_mark_hook (asection *sec,
+ struct bfd_link_info *info ATTRIBUTE_UNUSED,
+ Elf_Internal_Rela *rel,
+ struct elf_link_hash_entry *h,
+ Elf_Internal_Sym *sym)
{
if (h != NULL)
{
@@ -1267,20 +1217,16 @@ elf_i386_gc_mark_hook (sec, info, rel, h, sym)
/* Update the got entry reference counts for the section being removed. */
-static boolean
-elf_i386_gc_sweep_hook (abfd, info, sec, relocs)
- bfd *abfd;
- struct bfd_link_info *info;
- asection *sec;
- const Elf_Internal_Rela *relocs;
+static bfd_boolean
+elf_i386_gc_sweep_hook (bfd *abfd,
+ struct bfd_link_info *info,
+ asection *sec,
+ const Elf_Internal_Rela *relocs)
{
Elf_Internal_Shdr *symtab_hdr;
struct elf_link_hash_entry **sym_hashes;
bfd_signed_vma *local_got_refcounts;
const Elf_Internal_Rela *rel, *relend;
- unsigned long r_symndx;
- int r_type;
- struct elf_link_hash_entry *h;
elf_section_data (sec)->local_dynrel = NULL;
@@ -1290,87 +1236,76 @@ elf_i386_gc_sweep_hook (abfd, info, sec, relocs)
relend = relocs + sec->reloc_count;
for (rel = relocs; rel < relend; rel++)
- switch ((r_type = elf_i386_tls_transition (info,
- ELF32_R_TYPE (rel->r_info),
- ELF32_R_SYM (rel->r_info)
- >= symtab_hdr->sh_info)))
- {
- case R_386_TLS_LDM:
- if (elf_i386_hash_table (info)->tls_ldm_got.refcount > 0)
- elf_i386_hash_table (info)->tls_ldm_got.refcount -= 1;
- break;
-
- case R_386_TLS_GD:
- case R_386_TLS_IE_32:
- case R_386_TLS_IE:
- case R_386_TLS_GOTIE:
- case R_386_GOT32:
- 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;
- }
- if (r_type != R_386_TLS_IE)
- break;
- /* Fall through */
+ {
+ unsigned long r_symndx;
+ unsigned int r_type;
+ struct elf_link_hash_entry *h = NULL;
- case R_386_TLS_LE_32:
- case R_386_TLS_LE:
- if (!info->shared)
- break;
- /* Fall through */
+ r_symndx = ELF32_R_SYM (rel->r_info);
+ if (r_symndx >= symtab_hdr->sh_info)
+ {
+ struct elf_i386_link_hash_entry *eh;
+ struct elf_i386_dyn_relocs **pp;
+ struct elf_i386_dyn_relocs *p;
- case R_386_32:
- case R_386_PC32:
- r_symndx = ELF32_R_SYM (rel->r_info);
- if (r_symndx >= symtab_hdr->sh_info)
- {
- struct elf_i386_link_hash_entry *eh;
- struct elf_i386_dyn_relocs **pp;
- struct elf_i386_dyn_relocs *p;
+ h = sym_hashes[r_symndx - symtab_hdr->sh_info];
+ eh = (struct elf_i386_link_hash_entry *) h;
- h = sym_hashes[r_symndx - symtab_hdr->sh_info];
+ for (pp = &eh->dyn_relocs; (p = *pp) != NULL; pp = &p->next)
+ if (p->sec == sec)
+ {
+ /* Everything must go for SEC. */
+ *pp = p->next;
+ break;
+ }
+ }
- if (!info->shared && h->plt.refcount > 0)
- h->plt.refcount -= 1;
+ r_type = ELF32_R_TYPE (rel->r_info);
+ r_type = elf_i386_tls_transition (info, r_type, h != NULL);
+ switch (r_type)
+ {
+ case R_386_TLS_LDM:
+ if (elf_i386_hash_table (info)->tls_ldm_got.refcount > 0)
+ elf_i386_hash_table (info)->tls_ldm_got.refcount -= 1;
+ break;
- eh = (struct elf_i386_link_hash_entry *) h;
+ case R_386_TLS_GD:
+ case R_386_TLS_IE_32:
+ case R_386_TLS_IE:
+ case R_386_TLS_GOTIE:
+ case R_386_GOT32:
+ if (h != NULL)
+ {
+ if (h->got.refcount > 0)
+ h->got.refcount -= 1;
+ }
+ else if (local_got_refcounts != NULL)
+ {
+ if (local_got_refcounts[r_symndx] > 0)
+ local_got_refcounts[r_symndx] -= 1;
+ }
+ break;
- for (pp = &eh->dyn_relocs; (p = *pp) != NULL; pp = &p->next)
- if (p->sec == sec)
- {
- if (ELF32_R_TYPE (rel->r_info) == R_386_PC32)
- p->pc_count -= 1;
- p->count -= 1;
- if (p->count == 0)
- *pp = p->next;
- break;
- }
- }
- break;
+ case R_386_32:
+ case R_386_PC32:
+ if (info->shared)
+ break;
+ /* Fall through */
- case R_386_PLT32:
- 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->plt.refcount > 0)
- h->plt.refcount -= 1;
- }
- break;
+ case R_386_PLT32:
+ if (h != NULL)
+ {
+ if (h->plt.refcount > 0)
+ h->plt.refcount -= 1;
+ }
+ break;
- default:
- break;
- }
+ default:
+ break;
+ }
+ }
- return true;
+ return TRUE;
}
/* Adjust a symbol defined by a dynamic object and referenced by a
@@ -1379,14 +1314,11 @@ elf_i386_gc_sweep_hook (abfd, info, sec, relocs)
change the definition to something the rest of the link can
understand. */
-static boolean
-elf_i386_adjust_dynamic_symbol (info, h)
- struct bfd_link_info *info;
- struct elf_link_hash_entry *h;
+static bfd_boolean
+elf_i386_adjust_dynamic_symbol (struct bfd_link_info *info,
+ struct elf_link_hash_entry *h)
{
struct elf_i386_link_hash_table *htab;
- struct elf_i386_link_hash_entry * eh;
- struct elf_i386_dyn_relocs *p;
asection *s;
unsigned int power_of_two;
@@ -1397,11 +1329,9 @@ elf_i386_adjust_dynamic_symbol (info, h)
|| (h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT) != 0)
{
if (h->plt.refcount <= 0
- || (! info->shared
- && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) == 0
- && (h->elf_link_hash_flags & ELF_LINK_HASH_REF_DYNAMIC) == 0
- && h->root.type != bfd_link_hash_undefweak
- && h->root.type != bfd_link_hash_undefined))
+ || 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
@@ -1412,7 +1342,7 @@ elf_i386_adjust_dynamic_symbol (info, h)
h->elf_link_hash_flags &= ~ELF_LINK_HASH_NEEDS_PLT;
}
- return true;
+ return TRUE;
}
else
/* It's possible that we incorrectly decided a .plt reloc was
@@ -1431,7 +1361,11 @@ elf_i386_adjust_dynamic_symbol (info, h)
|| h->weakdef->root.type == bfd_link_hash_defweak);
h->root.u.def.section = h->weakdef->root.u.def.section;
h->root.u.def.value = h->weakdef->root.u.def.value;
- return true;
+ if (ELIMINATE_COPY_RELOCS || info->nocopyreloc)
+ h->elf_link_hash_flags
+ = ((h->elf_link_hash_flags & ~ELF_LINK_NON_GOT_REF)
+ | (h->weakdef->elf_link_hash_flags & ELF_LINK_NON_GOT_REF));
+ return TRUE;
}
/* This is a reference to a symbol defined by a dynamic object which
@@ -1442,34 +1376,40 @@ elf_i386_adjust_dynamic_symbol (info, h)
For such cases we need not do anything here; the relocations will
be handled correctly by relocate_section. */
if (info->shared)
- return true;
+ 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;
+ return TRUE;
/* If -z nocopyreloc was given, we won't generate them either. */
if (info->nocopyreloc)
{
h->elf_link_hash_flags &= ~ELF_LINK_NON_GOT_REF;
- return true;
+ return TRUE;
}
- eh = (struct elf_i386_link_hash_entry *) h;
- for (p = eh->dyn_relocs; p != NULL; p = p->next)
+ if (ELIMINATE_COPY_RELOCS)
{
- s = p->sec->output_section;
- if (s != NULL && (s->flags & SEC_READONLY) != 0)
- break;
- }
+ struct elf_i386_link_hash_entry * eh;
+ struct elf_i386_dyn_relocs *p;
- /* 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;
+ eh = (struct elf_i386_link_hash_entry *) h;
+ for (p = eh->dyn_relocs; p != NULL; p = p->next)
+ {
+ s = p->sec->output_section;
+ if (s != NULL && (s->flags & SEC_READONLY) != 0)
+ break;
+ }
+
+ /* If we didn't find any dynamic relocs in read-only sections, then
+ we'll be keeping the dynamic relocs and avoiding the copy reloc. */
+ if (p == NULL)
+ {
+ h->elf_link_hash_flags &= ~ELF_LINK_NON_GOT_REF;
+ return TRUE;
+ }
}
/* We must allocate the symbol in our .dynbss section, which will
@@ -1505,7 +1445,7 @@ elf_i386_adjust_dynamic_symbol (info, h)
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;
+ return FALSE;
}
/* Define the symbol as being at this point in the section. */
@@ -1515,27 +1455,14 @@ elf_i386_adjust_dynamic_symbol (info, h)
/* Increment the section size to make room for the symbol. */
s->_raw_size += h->size;
- return true;
+ return TRUE;
}
-/* This is the condition under which elf_i386_finish_dynamic_symbol
- will be called from elflink.h. If elflink.h doesn't call our
- finish_dynamic_symbol routine, we'll need to do something about
- initializing any .plt and .got entries in elf_i386_relocate_section. */
-#define WILL_CALL_FINISH_DYNAMIC_SYMBOL(DYN, INFO, H) \
- ((DYN) \
- && ((INFO)->shared \
- || ((H)->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0) \
- && ((H)->dynindx != -1 \
- || ((H)->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) != 0))
-
/* Allocate space in .plt, .got and associated reloc sections for
dynamic relocs. */
-static boolean
-allocate_dynrelocs (h, inf)
- struct elf_link_hash_entry *h;
- PTR inf;
+static bfd_boolean
+allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf)
{
struct bfd_link_info *info;
struct elf_i386_link_hash_table *htab;
@@ -1543,7 +1470,7 @@ allocate_dynrelocs (h, inf)
struct elf_i386_dyn_relocs *p;
if (h->root.type == bfd_link_hash_indirect)
- return true;
+ return TRUE;
if (h->root.type == bfd_link_hash_warning)
/* When warning symbols are created, they **replace** the "real"
@@ -1562,11 +1489,12 @@ allocate_dynrelocs (h, inf)
if (h->dynindx == -1
&& (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0)
{
- if (! bfd_elf32_link_record_dynamic_symbol (info, h))
- return false;
+ if (! bfd_elf_link_record_dynamic_symbol (info, h))
+ return FALSE;
}
- if (WILL_CALL_FINISH_DYNAMIC_SYMBOL (1, info, h))
+ if (info->shared
+ || WILL_CALL_FINISH_DYNAMIC_SYMBOL (1, 0, h))
{
asection *s = htab->splt;
@@ -1621,7 +1549,7 @@ allocate_dynrelocs (h, inf)
else if (h->got.refcount > 0)
{
asection *s;
- boolean dyn;
+ bfd_boolean dyn;
int tls_type = elf_i386_hash_entry(h)->tls_type;
/* Make sure this symbol is output as a dynamic symbol.
@@ -1629,8 +1557,8 @@ allocate_dynrelocs (h, inf)
if (h->dynindx == -1
&& (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0)
{
- if (! bfd_elf32_link_record_dynamic_symbol (info, h))
- return false;
+ if (! bfd_elf_link_record_dynamic_symbol (info, h))
+ return FALSE;
}
s = htab->sgot;
@@ -1652,7 +1580,10 @@ allocate_dynrelocs (h, inf)
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 (WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, info, h))
+ else if ((ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
+ || h->root.type != bfd_link_hash_undefweak)
+ && (info->shared
+ || WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, 0, h)))
htab->srelgot->_raw_size += sizeof (Elf32_External_Rel);
}
else
@@ -1660,7 +1591,7 @@ allocate_dynrelocs (h, inf)
eh = (struct elf_i386_link_hash_entry *) h;
if (eh->dyn_relocs == NULL)
- return true;
+ return TRUE;
/* In the shared -Bsymbolic case, discard space allocated for
dynamic pc-relative relocs against symbols which turn out to be
@@ -1670,9 +1601,13 @@ allocate_dynrelocs (h, inf)
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))
+ /* The only reloc that uses pc_count is R_386_PC32, which will
+ appear on a call or on something like ".long foo - .". We
+ want calls to protected symbols to resolve directly to the
+ function rather than going via the plt. If people want
+ function pointer comparisons to work as expected then they
+ should avoid writing assembly like ".long foo - .". */
+ if (SYMBOL_CALLS_LOCAL (info, h))
{
struct elf_i386_dyn_relocs **pp;
@@ -1686,8 +1621,14 @@ allocate_dynrelocs (h, inf)
pp = &p->next;
}
}
+
+ /* Also discard relocs on undefined weak syms with non-default
+ visibility. */
+ if (ELF_ST_VISIBILITY (h->other) != STV_DEFAULT
+ && h->root.type == bfd_link_hash_undefweak)
+ eh->dyn_relocs = NULL;
}
- else
+ 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
@@ -1705,8 +1646,8 @@ allocate_dynrelocs (h, inf)
if (h->dynindx == -1
&& (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0)
{
- if (! bfd_elf32_link_record_dynamic_symbol (info, h))
- return false;
+ if (! bfd_elf_link_record_dynamic_symbol (info, h))
+ return FALSE;
}
/* If that succeeded, we know we'll be keeping all the
@@ -1727,15 +1668,13 @@ allocate_dynrelocs (h, inf)
sreloc->_raw_size += p->count * sizeof (Elf32_External_Rel);
}
- return true;
+ return TRUE;
}
/* Find any dynamic relocs that apply to read-only sections. */
-static boolean
-readonly_dynrelocs (h, inf)
- struct elf_link_hash_entry *h;
- PTR inf;
+static bfd_boolean
+readonly_dynrelocs (struct elf_link_hash_entry *h, void *inf)
{
struct elf_i386_link_hash_entry *eh;
struct elf_i386_dyn_relocs *p;
@@ -1755,23 +1694,22 @@ readonly_dynrelocs (h, inf)
info->flags |= DF_TEXTREL;
/* Not an error, just cut short the traversal. */
- return false;
+ return FALSE;
}
}
- return true;
+ return TRUE;
}
/* Set the sizes of the dynamic sections. */
-static boolean
-elf_i386_size_dynamic_sections (output_bfd, info)
- bfd *output_bfd ATTRIBUTE_UNUSED;
- struct bfd_link_info *info;
+static bfd_boolean
+elf_i386_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
+ struct bfd_link_info *info)
{
struct elf_i386_link_hash_table *htab;
bfd *dynobj;
asection *s;
- boolean relocs;
+ bfd_boolean relocs;
bfd *ibfd;
htab = elf_i386_hash_table (info);
@@ -1782,7 +1720,7 @@ elf_i386_size_dynamic_sections (output_bfd, info)
if (htab->elf.dynamic_sections_created)
{
/* Set the contents of the .interp section to the interpreter. */
- if (! info->shared)
+ if (info->executable)
{
s = bfd_get_section_by_name (dynobj, ".interp");
if (s == NULL)
@@ -1884,7 +1822,7 @@ elf_i386_size_dynamic_sections (output_bfd, info)
/* We now have determined the sizes of the various dynamic sections.
Allocate memory for them. */
- relocs = false;
+ relocs = FALSE;
for (s = dynobj->sections; s != NULL; s = s->next)
{
if ((s->flags & SEC_LINKER_CREATED) == 0)
@@ -1900,7 +1838,7 @@ elf_i386_size_dynamic_sections (output_bfd, info)
else if (strncmp (bfd_get_section_name (dynobj, s), ".rel", 4) == 0)
{
if (s->_raw_size != 0 && s != htab->srelplt)
- relocs = true;
+ relocs = TRUE;
/* We use the reloc_count field as a counter if we need
to copy relocs into the output file. */
@@ -1933,9 +1871,9 @@ elf_i386_size_dynamic_sections (output_bfd, info)
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_byte *) bfd_zalloc (dynobj, s->_raw_size);
+ s->contents = bfd_zalloc (dynobj, s->_raw_size);
if (s->contents == NULL)
- return false;
+ return FALSE;
}
if (htab->elf.dynamic_sections_created)
@@ -1946,12 +1884,12 @@ elf_i386_size_dynamic_sections (output_bfd, info)
the .dynamic section. The DT_DEBUG entry is filled in by the
dynamic linker and used by the debugger. */
#define add_dynamic_entry(TAG, VAL) \
- bfd_elf32_add_dynamic_entry (info, (bfd_vma) (TAG), (bfd_vma) (VAL))
+ _bfd_elf_add_dynamic_entry (info, TAG, VAL)
- if (! info->shared)
+ if (info->executable)
{
if (!add_dynamic_entry (DT_DEBUG, 0))
- return false;
+ return FALSE;
}
if (htab->splt->_raw_size != 0)
@@ -1960,7 +1898,7 @@ elf_i386_size_dynamic_sections (output_bfd, info)
|| !add_dynamic_entry (DT_PLTRELSZ, 0)
|| !add_dynamic_entry (DT_PLTREL, DT_REL)
|| !add_dynamic_entry (DT_JMPREL, 0))
- return false;
+ return FALSE;
}
if (relocs)
@@ -1968,7 +1906,7 @@ elf_i386_size_dynamic_sections (output_bfd, info)
if (!add_dynamic_entry (DT_REL, 0)
|| !add_dynamic_entry (DT_RELSZ, 0)
|| !add_dynamic_entry (DT_RELENT, sizeof (Elf32_External_Rel)))
- return false;
+ return FALSE;
/* If any dynamic relocs apply to a read-only section,
then we need a DT_TEXTREL entry. */
@@ -1979,23 +1917,22 @@ elf_i386_size_dynamic_sections (output_bfd, info)
if ((info->flags & DF_TEXTREL) != 0)
{
if (!add_dynamic_entry (DT_TEXTREL, 0))
- return false;
+ return FALSE;
}
}
}
#undef add_dynamic_entry
- return 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. */
-static boolean
-elf_i386_fake_sections (abfd, hdr, sec)
- bfd *abfd ATTRIBUTE_UNUSED;
- Elf32_Internal_Shdr *hdr;
- asection *sec;
+static bfd_boolean
+elf_i386_fake_sections (bfd *abfd ATTRIBUTE_UNUSED,
+ Elf_Internal_Shdr *hdr,
+ asection *sec)
{
register const char *name;
@@ -2020,7 +1957,7 @@ elf_i386_fake_sections (abfd, hdr, sec)
if (strcmp (name, ".reloc") == 0)
hdr->sh_type = SHT_PROGBITS;
- return true;
+ return TRUE;
}
/* Return the base VMA address which should be subtracted from real addresses
@@ -2028,46 +1965,39 @@ elf_i386_fake_sections (abfd, hdr, sec)
This is PT_TLS segment p_vaddr. */
static bfd_vma
-dtpoff_base (info)
- struct bfd_link_info *info;
+dtpoff_base (struct bfd_link_info *info)
{
- /* If tls_segment is NULL, we should have signalled an error already. */
- if (elf_hash_table (info)->tls_segment == NULL)
+ /* 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_segment->start;
+ 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;
+tpoff (struct bfd_link_info *info, bfd_vma address)
{
- struct elf_link_tls_segment *tls_segment
- = elf_hash_table (info)->tls_segment;
+ struct elf_link_hash_table *htab = elf_hash_table (info);
- /* If tls_segment is NULL, we should have signalled an error already. */
- if (tls_segment == NULL)
+ /* If tls_sec is NULL, we should have signalled an error already. */
+ if (htab->tls_sec == NULL)
return 0;
- return (align_power (tls_segment->size, tls_segment->align)
- + tls_segment->start - address);
+ return htab->tls_size + htab->tls_sec->vma - address;
}
/* Relocate an i386 ELF section. */
-static boolean
-elf_i386_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;
+static bfd_boolean
+elf_i386_relocate_section (bfd *output_bfd,
+ struct bfd_link_info *info,
+ bfd *input_bfd,
+ asection *input_section,
+ bfd_byte *contents,
+ Elf_Internal_Rela *relocs,
+ Elf_Internal_Sym *local_syms,
+ asection **local_sections)
{
struct elf_i386_link_hash_table *htab;
Elf_Internal_Shdr *symtab_hdr;
@@ -2093,30 +2023,30 @@ elf_i386_relocate_section (output_bfd, info, input_bfd, input_section,
asection *sec;
bfd_vma off;
bfd_vma relocation;
- boolean unresolved_reloc;
+ bfd_boolean unresolved_reloc;
bfd_reloc_status_type r;
unsigned int indx;
int tls_type;
r_type = ELF32_R_TYPE (rel->r_info);
- if (r_type == (int) R_386_GNU_VTINHERIT
- || r_type == (int) R_386_GNU_VTENTRY)
+ if (r_type == R_386_GNU_VTINHERIT
+ || r_type == R_386_GNU_VTENTRY)
continue;
- if ((indx = (unsigned) r_type) >= R_386_standard
+ if ((indx = r_type) >= R_386_standard
&& ((indx = r_type - R_386_ext_offset) - R_386_standard
>= R_386_ext - R_386_standard)
&& ((indx = r_type - R_386_tls_offset) - R_386_ext
>= R_386_tls - R_386_ext))
{
bfd_set_error (bfd_error_bad_value);
- return false;
+ return FALSE;
}
howto = elf_howto_table + indx;
r_symndx = ELF32_R_SYM (rel->r_info);
- if (info->relocateable)
+ if (info->relocatable)
{
bfd_vma val;
bfd_byte *where;
@@ -2163,7 +2093,7 @@ elf_i386_relocate_section (output_bfd, info, input_bfd, input_section,
h = NULL;
sym = NULL;
sec = NULL;
- unresolved_reloc = false;
+ unresolved_reloc = FALSE;
if (r_symndx < symtab_hdr->sh_info)
{
sym = local_syms + r_symndx;
@@ -2236,43 +2166,12 @@ elf_i386_relocate_section (output_bfd, info, input_bfd, input_section,
}
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;
+ bfd_boolean warned;
- relocation = 0;
- if (h->root.type == bfd_link_hash_defined
- || h->root.type == bfd_link_hash_defweak)
- {
- sec = h->root.u.def.section;
- if (sec->output_section == NULL)
- /* Set a flag that will be cleared later if we find a
- relocation value for this symbol. output_section
- is typically NULL for symbols satisfied by a shared
- library. */
- unresolved_reloc = true;
- else
- relocation = (h->root.u.def.value
- + sec->output_section->vma
- + sec->output_offset);
- }
- else if (h->root.type == bfd_link_hash_undefweak)
- ;
- else if (info->shared
- && (!info->symbolic || info->allow_shlib_undefined)
- && !info->no_undefined
- && ELF_ST_VISIBILITY (h->other) == STV_DEFAULT)
- ;
- else
- {
- if (! ((*info->callbacks->undefined_symbol)
- (info, h->root.root.string, input_bfd,
- input_section, rel->r_offset,
- (!info->shared || info->no_undefined
- || ELF_ST_VISIBILITY (h->other)))))
- return false;
- }
+ 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)
@@ -2285,16 +2184,15 @@ elf_i386_relocate_section (output_bfd, info, input_bfd, input_section,
if (h != NULL)
{
- boolean dyn;
+ bfd_boolean dyn;
off = h->got.offset;
dyn = htab->elf.dynamic_sections_created;
- if (! WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, info, h)
+ 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)))
+ && 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
@@ -2318,7 +2216,7 @@ elf_i386_relocate_section (output_bfd, info, input_bfd, input_section,
}
}
else
- unresolved_reloc = false;
+ unresolved_reloc = FALSE;
}
else
{
@@ -2339,20 +2237,20 @@ elf_i386_relocate_section (output_bfd, info, input_bfd, input_section,
if (info->shared)
{
- asection *srelgot;
- Elf_Internal_Rel outrel;
- Elf32_External_Rel *loc;
+ asection *s;
+ Elf_Internal_Rela outrel;
+ bfd_byte *loc;
- srelgot = htab->srelgot;
- if (srelgot == NULL)
+ s = htab->srelgot;
+ if (s == NULL)
abort ();
outrel.r_offset = (htab->sgot->output_section->vma
+ htab->sgot->output_offset
+ off);
outrel.r_info = ELF32_R_INFO (0, R_386_RELATIVE);
- loc = (Elf32_External_Rel *) srelgot->contents;
- loc += srelgot->reloc_count++;
+ loc = s->contents;
+ loc += s->reloc_count++ * sizeof (Elf32_External_Rel);
bfd_elf32_swap_reloc_out (output_bfd, &outrel, loc);
}
@@ -2381,7 +2279,7 @@ elf_i386_relocate_section (output_bfd, info, input_bfd, input_section,
case R_386_GOTPC:
/* Use global offset table as symbol value. */
relocation = htab->sgot->output_section->vma;
- unresolved_reloc = false;
+ unresolved_reloc = FALSE;
break;
case R_386_PLT32:
@@ -2405,7 +2303,7 @@ elf_i386_relocate_section (output_bfd, info, input_bfd, input_section,
relocation = (htab->splt->output_section->vma
+ htab->splt->output_offset
+ h->plt.offset);
- unresolved_reloc = false;
+ unresolved_reloc = FALSE;
break;
case R_386_32:
@@ -2418,13 +2316,13 @@ elf_i386_relocate_section (output_bfd, info, input_bfd, input_section,
break;
if ((info->shared
+ && (h == NULL
+ || ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
+ || h->root.type != bfd_link_hash_undefweak)
&& (r_type != R_386_PC32
- || (h != NULL
- && h->dynindx != -1
- && (! info->symbolic
- || (h->elf_link_hash_flags
- & ELF_LINK_HASH_DEF_REGULAR) == 0))))
- || (!info->shared
+ || !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
@@ -2435,25 +2333,25 @@ elf_i386_relocate_section (output_bfd, info, input_bfd, input_section,
|| h->root.type == bfd_link_hash_undefweak
|| h->root.type == bfd_link_hash_undefined)))
{
- Elf_Internal_Rel outrel;
- boolean skip, relocate;
+ Elf_Internal_Rela outrel;
+ bfd_byte *loc;
+ bfd_boolean skip, relocate;
asection *sreloc;
- Elf32_External_Rel *loc;
/* When generating a shared object, these relocations
are copied into the output file to be resolved at run
time. */
- skip = false;
- relocate = false;
+ 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;
+ skip = TRUE;
else if (outrel.r_offset == (bfd_vma) -2)
- skip = true, relocate = true;
+ skip = TRUE, relocate = TRUE;
outrel.r_offset += (input_section->output_section->vma
+ input_section->output_offset);
@@ -2470,7 +2368,7 @@ elf_i386_relocate_section (output_bfd, info, input_bfd, input_section,
else
{
/* This symbol is local, or marked to become local. */
- relocate = true;
+ relocate = TRUE;
outrel.r_info = ELF32_R_INFO (0, R_386_RELATIVE);
}
@@ -2478,8 +2376,8 @@ elf_i386_relocate_section (output_bfd, info, input_bfd, input_section,
if (sreloc == NULL)
abort ();
- loc = (Elf32_External_Rel *) sreloc->contents;
- loc += sreloc->reloc_count++;
+ 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
@@ -2494,9 +2392,9 @@ elf_i386_relocate_section (output_bfd, info, input_bfd, input_section,
case R_386_TLS_IE:
if (info->shared)
{
- Elf_Internal_Rel outrel;
+ Elf_Internal_Rela outrel;
+ bfd_byte *loc;
asection *sreloc;
- Elf32_External_Rel *loc;
outrel.r_offset = rel->r_offset
+ input_section->output_section->vma
@@ -2505,8 +2403,8 @@ elf_i386_relocate_section (output_bfd, info, input_bfd, input_section,
sreloc = elf_section_data (input_section)->sreloc;
if (sreloc == NULL)
abort ();
- loc = (Elf32_External_Rel *) sreloc->contents;
- loc += sreloc->reloc_count++;
+ loc = sreloc->contents;
+ loc += sreloc->reloc_count++ * sizeof (Elf32_External_Rel);
bfd_elf32_swap_reloc_out (output_bfd, &outrel, loc);
}
/* Fall through */
@@ -2619,14 +2517,16 @@ elf_i386_relocate_section (output_bfd, info, input_bfd, input_section,
if (val == 0xa1)
{
/* movl foo, %eax. */
- bfd_put_8 (output_bfd, 0xb8, contents + rel->r_offset - 1);
+ bfd_put_8 (output_bfd, 0xb8,
+ contents + rel->r_offset - 1);
}
else
{
BFD_ASSERT (rel->r_offset >= 2);
- type = bfd_get_8 (input_bfd, contents + rel->r_offset - 2);
+ type = bfd_get_8 (input_bfd,
+ contents + rel->r_offset - 2);
switch (type)
- {
+ {
case 0x8b:
/* movl */
BFD_ASSERT ((val & 0xc7) == 0x05);
@@ -2648,7 +2548,7 @@ elf_i386_relocate_section (output_bfd, info, input_bfd, input_section,
default:
BFD_FAIL ();
break;
- }
+ }
}
bfd_put_32 (output_bfd, -tpoff (info, relocation),
contents + rel->r_offset);
@@ -2723,10 +2623,10 @@ elf_i386_relocate_section (output_bfd, info, input_bfd, input_section,
if ((off & 1) != 0)
off &= ~1;
- else
+ else
{
- Elf_Internal_Rel outrel;
- Elf32_External_Rel *loc;
+ Elf_Internal_Rela outrel;
+ bfd_byte *loc;
int dr_type, indx;
if (htab->srelgot == NULL)
@@ -2752,8 +2652,8 @@ elf_i386_relocate_section (output_bfd, info, input_bfd, input_section,
bfd_put_32 (output_bfd, 0,
htab->sgot->contents + off);
outrel.r_info = ELF32_R_INFO (indx, dr_type);
- loc = (Elf32_External_Rel *) htab->srelgot->contents;
- loc += htab->srelgot->reloc_count++;
+ loc = htab->srelgot->contents;
+ loc += htab->srelgot->reloc_count++ * sizeof (Elf32_External_Rel);
bfd_elf32_swap_reloc_out (output_bfd, &outrel, loc);
if (r_type == R_386_TLS_GD)
@@ -2773,9 +2673,8 @@ elf_i386_relocate_section (output_bfd, info, input_bfd, input_section,
R_386_TLS_DTPOFF32);
outrel.r_offset += 4;
htab->srelgot->reloc_count++;
- loc++;
- bfd_elf32_swap_reloc_out (output_bfd, &outrel,
- loc);
+ loc += sizeof (Elf32_External_Rel);
+ bfd_elf32_swap_reloc_out (output_bfd, &outrel, loc);
}
}
else if (tls_type == GOT_TLS_IE_BOTH)
@@ -2786,7 +2685,7 @@ elf_i386_relocate_section (output_bfd, info, input_bfd, input_section,
outrel.r_info = ELF32_R_INFO (indx, R_386_TLS_TPOFF);
outrel.r_offset += 4;
htab->srelgot->reloc_count++;
- loc++;
+ loc += sizeof (Elf32_External_Rel);
bfd_elf32_swap_reloc_out (output_bfd, &outrel, loc);
}
@@ -2806,7 +2705,7 @@ elf_i386_relocate_section (output_bfd, info, input_bfd, input_section,
relocation += 4;
if (r_type == R_386_TLS_IE)
relocation += htab->sgot->output_section->vma;
- unresolved_reloc = false;
+ unresolved_reloc = FALSE;
}
else
{
@@ -2905,8 +2804,8 @@ elf_i386_relocate_section (output_bfd, info, input_bfd, input_section,
off &= ~1;
else
{
- Elf_Internal_Rel outrel;
- Elf32_External_Rel *loc;
+ Elf_Internal_Rela outrel;
+ bfd_byte *loc;
if (htab->srelgot == NULL)
abort ();
@@ -2919,17 +2818,17 @@ elf_i386_relocate_section (output_bfd, info, input_bfd, input_section,
bfd_put_32 (output_bfd, 0,
htab->sgot->contents + off + 4);
outrel.r_info = ELF32_R_INFO (0, R_386_TLS_DTPMOD32);
- loc = (Elf32_External_Rel *) htab->srelgot->contents;
- loc += htab->srelgot->reloc_count++;
+ loc = htab->srelgot->contents;
+ loc += htab->srelgot->reloc_count++ * sizeof (Elf32_External_Rel);
bfd_elf32_swap_reloc_out (output_bfd, &outrel, loc);
htab->tls_ldm_got.offset |= 1;
}
relocation = htab->sgot->output_offset + off;
- unresolved_reloc = false;
+ unresolved_reloc = FALSE;
break;
case R_386_TLS_LDO_32:
- if (info->shared)
+ if (info->shared || (input_section->flags & SEC_CODE) == 0)
relocation -= dtpoff_base (info);
else
/* When converting LDO to LE, we must negate. */
@@ -2940,9 +2839,9 @@ elf_i386_relocate_section (output_bfd, info, input_bfd, input_section,
case R_386_TLS_LE:
if (info->shared)
{
- Elf_Internal_Rel outrel;
+ Elf_Internal_Rela outrel;
asection *sreloc;
- Elf32_External_Rel *loc;
+ bfd_byte *loc;
int indx;
outrel.r_offset = rel->r_offset
@@ -2959,8 +2858,8 @@ elf_i386_relocate_section (output_bfd, info, input_bfd, input_section,
sreloc = elf_section_data (input_section)->sreloc;
if (sreloc == NULL)
abort ();
- loc = (Elf32_External_Rel *) sreloc->contents;
- loc += sreloc->reloc_count++;
+ loc = sreloc->contents;
+ loc += sreloc->reloc_count++ * sizeof (Elf32_External_Rel);
bfd_elf32_swap_reloc_out (output_bfd, &outrel, loc);
if (indx)
continue;
@@ -2992,12 +2891,12 @@ elf_i386_relocate_section (output_bfd, info, input_bfd, input_section,
bfd_get_section_name (input_bfd, input_section),
(long) rel->r_offset,
h->root.root.string);
- return false;
+ return FALSE;
}
r = _bfd_final_link_relocate (howto, input_bfd, input_section,
contents, rel->r_offset,
- relocation, (bfd_vma) 0);
+ relocation, 0);
if (r != bfd_reloc_ok)
{
@@ -3011,7 +2910,7 @@ elf_i386_relocate_section (output_bfd, info, input_bfd, input_section,
symtab_hdr->sh_link,
sym->st_name);
if (name == NULL)
- return false;
+ return FALSE;
if (*name == '\0')
name = bfd_section_name (input_bfd, sec);
}
@@ -3019,9 +2918,9 @@ elf_i386_relocate_section (output_bfd, info, input_bfd, input_section,
if (r == bfd_reloc_overflow)
{
if (! ((*info->callbacks->reloc_overflow)
- (info, name, howto->name, (bfd_vma) 0,
+ (info, name, howto->name, 0,
input_bfd, input_section, rel->r_offset)))
- return false;
+ return FALSE;
}
else
{
@@ -3030,23 +2929,22 @@ elf_i386_relocate_section (output_bfd, info, input_bfd, input_section,
bfd_archive_filename (input_bfd),
bfd_get_section_name (input_bfd, input_section),
(long) rel->r_offset, name, (int) r);
- return false;
+ return FALSE;
}
}
}
- return true;
+ return TRUE;
}
/* Finish up dynamic symbol handling. We set the contents of various
dynamic sections here. */
-static boolean
-elf_i386_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;
+static bfd_boolean
+elf_i386_finish_dynamic_symbol (bfd *output_bfd,
+ struct bfd_link_info *info,
+ struct elf_link_hash_entry *h,
+ Elf_Internal_Sym *sym)
{
struct elf_i386_link_hash_table *htab;
@@ -3056,8 +2954,8 @@ elf_i386_finish_dynamic_symbol (output_bfd, info, h, sym)
{
bfd_vma plt_index;
bfd_vma got_offset;
- Elf_Internal_Rel rel;
- Elf32_External_Rel *loc;
+ Elf_Internal_Rela rel;
+ bfd_byte *loc;
/* This symbol has an entry in the procedure linkage table. Set
it up. */
@@ -3116,17 +3014,22 @@ elf_i386_finish_dynamic_symbol (output_bfd, info, h, sym)
+ htab->sgotplt->output_offset
+ got_offset);
rel.r_info = ELF32_R_INFO (h->dynindx, R_386_JUMP_SLOT);
- loc = (Elf32_External_Rel *) htab->srelplt->contents + plt_index;
+ loc = htab->srelplt->contents + plt_index * sizeof (Elf32_External_Rel);
bfd_elf32_swap_reloc_out (output_bfd, &rel, loc);
if ((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0)
{
/* Mark the symbol as undefined, rather than as defined in
- the .plt section. Leave the value 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->elf_link_hash_flags & ELF_LINK_POINTER_EQUALITY_NEEDED) == 0)
+ sym->st_value = 0;
}
}
@@ -3134,8 +3037,8 @@ elf_i386_finish_dynamic_symbol (output_bfd, info, h, sym)
&& elf_i386_hash_entry(h)->tls_type != GOT_TLS_GD
&& (elf_i386_hash_entry(h)->tls_type & GOT_TLS_IE) == 0)
{
- Elf_Internal_Rel rel;
- Elf32_External_Rel *loc;
+ Elf_Internal_Rela rel;
+ bfd_byte *loc;
/* This symbol has an entry in the global offset table. Set it
up. */
@@ -3153,10 +3056,7 @@ elf_i386_finish_dynamic_symbol (output_bfd, info, h, sym)
The entry in the global offset table will already have been
initialized in the relocate_section function. */
if (info->shared
- && (info->symbolic
- || h->dynindx == -1
- || (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL))
- && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR))
+ && SYMBOL_REFERENCES_LOCAL (info, h))
{
BFD_ASSERT((h->got.offset & 1) != 0);
rel.r_info = ELF32_R_INFO (0, R_386_RELATIVE);
@@ -3169,15 +3069,15 @@ elf_i386_finish_dynamic_symbol (output_bfd, info, h, sym)
rel.r_info = ELF32_R_INFO (h->dynindx, R_386_GLOB_DAT);
}
- loc = (Elf32_External_Rel *) htab->srelgot->contents;
- loc += htab->srelgot->reloc_count++;
+ loc = htab->srelgot->contents;
+ loc += htab->srelgot->reloc_count++ * sizeof (Elf32_External_Rel);
bfd_elf32_swap_reloc_out (output_bfd, &rel, loc);
}
if ((h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_COPY) != 0)
{
- Elf_Internal_Rel rel;
- Elf32_External_Rel *loc;
+ Elf_Internal_Rela rel;
+ bfd_byte *loc;
/* This symbol needs a copy reloc. Set it up. */
@@ -3191,8 +3091,8 @@ elf_i386_finish_dynamic_symbol (output_bfd, info, h, sym)
+ h->root.u.def.section->output_section->vma
+ h->root.u.def.section->output_offset);
rel.r_info = ELF32_R_INFO (h->dynindx, R_386_COPY);
- loc = (Elf32_External_Rel *) htab->srelbss->contents;
- loc += htab->srelbss->reloc_count++;
+ loc = htab->srelbss->contents;
+ loc += htab->srelbss->reloc_count++ * sizeof (Elf32_External_Rel);
bfd_elf32_swap_reloc_out (output_bfd, &rel, loc);
}
@@ -3201,17 +3101,16 @@ elf_i386_finish_dynamic_symbol (output_bfd, info, h, sym)
|| strcmp (h->root.root.string, "_GLOBAL_OFFSET_TABLE_") == 0)
sym->st_shndx = SHN_ABS;
- return true;
+ return TRUE;
}
/* Used to decide how to sort relocs in an optimal manner for the
dynamic linker, before writing them out. */
static enum elf_reloc_type_class
-elf_i386_reloc_type_class (rela)
- const Elf_Internal_Rela *rela;
+elf_i386_reloc_type_class (const Elf_Internal_Rela *rela)
{
- switch ((int) ELF32_R_TYPE (rela->r_info))
+ switch (ELF32_R_TYPE (rela->r_info))
{
case R_386_RELATIVE:
return reloc_class_relative;
@@ -3226,10 +3125,9 @@ elf_i386_reloc_type_class (rela)
/* Finish up the dynamic sections. */
-static boolean
-elf_i386_finish_dynamic_sections (output_bfd, info)
- bfd *output_bfd;
- struct bfd_link_info *info;
+static bfd_boolean
+elf_i386_finish_dynamic_sections (bfd *output_bfd,
+ struct bfd_link_info *info)
{
struct elf_i386_link_hash_table *htab;
bfd *dynobj;
@@ -3265,15 +3163,13 @@ elf_i386_finish_dynamic_sections (output_bfd, info)
break;
case DT_JMPREL:
- dyn.d_un.d_ptr = htab->srelplt->output_section->vma;
+ s = htab->srelplt;
+ dyn.d_un.d_ptr = s->output_section->vma + s->output_offset;
break;
case DT_PLTRELSZ:
- s = htab->srelplt->output_section;
- if (s->_cooked_size != 0)
- dyn.d_un.d_val = s->_cooked_size;
- else
- dyn.d_un.d_val = s->_raw_size;
+ s = htab->srelplt;
+ dyn.d_un.d_val = s->_raw_size;
break;
case DT_RELSZ:
@@ -3282,18 +3178,23 @@ elf_i386_finish_dynamic_sections (output_bfd, info)
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. */
- 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;
- }
+ here to make it not include the JMPREL relocs. */
+ s = htab->srelplt;
+ if (s == NULL)
+ continue;
+ dyn.d_un.d_val -= s->_raw_size;
+ break;
+
+ case DT_REL:
+ /* We may not be using the standard ELF linker script.
+ If .rel.plt is the first .rel section, we adjust
+ DT_REL to not include it. */
+ s = htab->srelplt;
+ if (s == NULL)
+ continue;
+ if (dyn.d_un.d_ptr != s->output_section->vma + s->output_offset)
+ continue;
+ dyn.d_un.d_ptr += s->_raw_size;
break;
}
@@ -3335,25 +3236,23 @@ elf_i386_finish_dynamic_sections (output_bfd, info)
if (htab->sgotplt->_raw_size > 0)
{
bfd_put_32 (output_bfd,
- (sdyn == NULL ? (bfd_vma) 0
+ (sdyn == NULL ? 0
: sdyn->output_section->vma + sdyn->output_offset),
htab->sgotplt->contents);
- bfd_put_32 (output_bfd, (bfd_vma) 0, htab->sgotplt->contents + 4);
- bfd_put_32 (output_bfd, (bfd_vma) 0, htab->sgotplt->contents + 8);
+ bfd_put_32 (output_bfd, 0, htab->sgotplt->contents + 4);
+ bfd_put_32 (output_bfd, 0, htab->sgotplt->contents + 8);
}
elf_section_data (htab->sgotplt->output_section)->this_hdr.sh_entsize = 4;
}
- return true;
+ return TRUE;
}
-#ifndef ELF_ARCH
#define TARGET_LITTLE_SYM bfd_elf32_i386_vec
#define TARGET_LITTLE_NAME "elf32-i386"
#define ELF_ARCH bfd_arch_i386
#define ELF_MACHINE_CODE EM_386
#define ELF_MAXPAGESIZE 0x1000
-#endif /* ELF_ARCH */
#define elf_backend_can_gc_sections 1
#define elf_backend_can_refcount 1
@@ -3361,13 +3260,12 @@ elf_i386_finish_dynamic_sections (output_bfd, info)
#define elf_backend_plt_readonly 1
#define elf_backend_want_plt_sym 0
#define elf_backend_got_header_size 12
-#define elf_backend_plt_header_size PLT_ENTRY_SIZE
-#define elf_info_to_howto elf_i386_info_to_howto
+/* Support RELA for objdump of prelink objects. */
+#define elf_info_to_howto elf_i386_info_to_howto_rel
#define elf_info_to_howto_rel elf_i386_info_to_howto_rel
#define bfd_elf32_mkobject elf_i386_mkobject
-#define elf_backend_object_p elf_i386_object_p
#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
@@ -3389,3 +3287,37 @@ elf_i386_finish_dynamic_sections (output_bfd, info)
#define elf_backend_size_dynamic_sections elf_i386_size_dynamic_sections
#include "elf32-target.h"
+
+/* FreeBSD support. */
+
+#undef TARGET_LITTLE_SYM
+#define TARGET_LITTLE_SYM bfd_elf32_i386_freebsd_vec
+#undef TARGET_LITTLE_NAME
+#define TARGET_LITTLE_NAME "elf32-i386-freebsd"
+
+/* The kernel recognizes executables as valid only if they carry a
+ "FreeBSD" label in the ELF header. So we put this label on all
+ executables and (for simplicity) also all other object files. */
+
+static void
+elf_i386_post_process_headers (bfd *abfd,
+ struct bfd_link_info *info ATTRIBUTE_UNUSED)
+{
+ Elf_Internal_Ehdr *i_ehdrp;
+
+ i_ehdrp = elf_elfheader (abfd);
+
+ /* Put an ABI label supported by FreeBSD >= 4.1. */
+ i_ehdrp->e_ident[EI_OSABI] = ELFOSABI_FREEBSD;
+#ifdef OLD_FREEBSD_ABI_LABEL
+ /* The ABI label supported by FreeBSD <= 4.0 is quite nonstandard. */
+ memcpy (&i_ehdrp->e_ident[EI_ABIVERSION], "FreeBSD", 8);
+#endif
+}
+
+#undef elf_backend_post_process_headers
+#define elf_backend_post_process_headers elf_i386_post_process_headers
+#undef elf32_bed
+#define elf32_bed elf32_i386_fbsd_bed
+
+#include "elf32-target.h"
diff --git a/contrib/binutils/bfd/elf32-ppc.c b/contrib/binutils/bfd/elf32-ppc.c
index 9abdf61..4eb08ad 100644
--- a/contrib/binutils/bfd/elf32-ppc.c
+++ b/contrib/binutils/bfd/elf32-ppc.c
@@ -1,23 +1,24 @@
/* PowerPC-specific support for 32-bit ELF
- Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
- Free Software Foundation, Inc.
+ Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
+ 2004 Free Software Foundation, Inc.
Written by Ian Lance Taylor, Cygnus Support.
-This file is part of BFD, the Binary File Descriptor library.
+ This 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., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
/* This file is based on a preliminary PowerPC ELF ABI. The
information may not match the final PowerPC ELF ABI. It includes
@@ -30,100 +31,24 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "libbfd.h"
#include "elf-bfd.h"
#include "elf/ppc.h"
+#include "elf32-ppc.h"
-#define USE_RELA /* we want RELA relocations, not REL */
+/* RELA relocations are used here. */
-static reloc_howto_type *ppc_elf_reloc_type_lookup
- PARAMS ((bfd *abfd, bfd_reloc_code_real_type code));
-static void ppc_elf_info_to_howto
- PARAMS ((bfd *abfd, arelent *cache_ptr, Elf32_Internal_Rela *dst));
-static void ppc_elf_howto_init PARAMS ((void));
-static int ppc_elf_sort_rela PARAMS ((const PTR, const PTR));
-static boolean ppc_elf_relax_section
- PARAMS ((bfd *, asection *, struct bfd_link_info *, boolean *));
static bfd_reloc_status_type ppc_elf_addr16_ha_reloc
- PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
-static boolean ppc_elf_object_p PARAMS ((bfd *));
-static boolean ppc_elf_set_private_flags PARAMS ((bfd *, flagword));
-static boolean ppc_elf_merge_private_bfd_data PARAMS ((bfd *, bfd *));
-
-static int ppc_elf_additional_program_headers PARAMS ((bfd *));
-static boolean ppc_elf_modify_segment_map PARAMS ((bfd *));
-
-static asection *ppc_elf_create_got
- PARAMS ((bfd *, struct bfd_link_info *));
-static boolean ppc_elf_create_dynamic_sections
- PARAMS ((bfd *, struct bfd_link_info *));
-
-static boolean ppc_elf_section_from_shdr PARAMS ((bfd *,
- Elf32_Internal_Shdr *,
- const char *));
-static boolean ppc_elf_fake_sections
- PARAMS ((bfd *, Elf32_Internal_Shdr *, asection *));
-
-static elf_linker_section_t *ppc_elf_create_linker_section
- PARAMS ((bfd *abfd,
- struct bfd_link_info *info,
- enum elf_linker_section_enum));
-
-static boolean ppc_elf_check_relocs PARAMS ((bfd *,
- struct bfd_link_info *,
- asection *,
- const Elf_Internal_Rela *));
-
-static asection * ppc_elf_gc_mark_hook PARAMS ((asection *sec,
- struct bfd_link_info *info,
- Elf_Internal_Rela *rel,
- struct elf_link_hash_entry *h,
- Elf_Internal_Sym *sym));
-
-static boolean ppc_elf_gc_sweep_hook PARAMS ((bfd *abfd,
- struct bfd_link_info *info,
- asection *sec,
- const Elf_Internal_Rela *relocs));
-
-static boolean ppc_elf_adjust_dynamic_symbol PARAMS ((struct bfd_link_info *,
- struct elf_link_hash_entry *));
-
-static boolean ppc_elf_size_dynamic_sections PARAMS ((bfd *, struct bfd_link_info *));
-
-static boolean ppc_elf_relocate_section PARAMS ((bfd *,
- struct bfd_link_info *info,
- bfd *,
- asection *,
- bfd_byte *,
- Elf_Internal_Rela *relocs,
- Elf_Internal_Sym *local_syms,
- asection **));
-
-static boolean ppc_elf_add_symbol_hook PARAMS ((bfd *,
- struct bfd_link_info *,
- const Elf_Internal_Sym *,
- const char **,
- flagword *,
- asection **,
- bfd_vma *));
-
-static boolean ppc_elf_finish_dynamic_symbol PARAMS ((bfd *,
- struct bfd_link_info *,
- struct elf_link_hash_entry *,
- Elf_Internal_Sym *));
-
-static boolean ppc_elf_finish_dynamic_sections PARAMS ((bfd *, struct bfd_link_info *));
-static enum elf_reloc_type_class ppc_elf_reloc_type_class
- PARAMS ((const Elf_Internal_Rela *));
-static boolean ppc_elf_grok_prstatus
- PARAMS ((bfd *abfd, Elf_Internal_Note *note));
-static boolean ppc_elf_grok_psinfo
- PARAMS ((bfd *abfd, Elf_Internal_Note *note));
-
-#define BRANCH_PREDICT_BIT 0x200000 /* branch prediction bit for branch taken relocs */
-#define RA_REGISTER_MASK 0x001f0000 /* mask to set RA in memory instructions */
-#define RA_REGISTER_SHIFT 16 /* value to shift register by to insert RA */
+ (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **);
+static bfd_reloc_status_type ppc_elf_unhandled_reloc
+ (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **);
+
+/* Branch prediction bit for branch taken relocs. */
+#define BRANCH_PREDICT_BIT 0x200000
+/* Mask to set RA in memory instructions. */
+#define RA_REGISTER_MASK 0x001f0000
+/* Value to shift register by to insert RA. */
+#define RA_REGISTER_SHIFT 16
/* The name of the dynamic interpreter. This is put in the .interp
section. */
-
#define ELF_DYNAMIC_INTERPRETER "/usr/lib/ld.so.1"
/* The size in bytes of an entry in the procedure linkage table. */
@@ -135,25 +60,289 @@ static boolean ppc_elf_grok_psinfo
/* The number of single-slot PLT entries (the rest use two slots). */
#define PLT_NUM_SINGLE_ENTRIES 8192
-/* Will references to this symbol always reference the symbol
- in this object? */
-#define SYMBOL_REFERENCES_LOCAL(INFO, H) \
- ((! INFO->shared \
- || INFO->symbolic \
- || H->dynindx == -1 \
- || 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)
-
-/* Will _calls_ to this symbol always call the version in this object? */
-#define SYMBOL_CALLS_LOCAL(INFO, H) \
- ((! INFO->shared \
- || INFO->symbolic \
- || H->dynindx == -1 \
- || ELF_ST_VISIBILITY (H->other) != STV_DEFAULT) \
- && (H->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) != 0)
+/* Some nop instructions. */
+#define NOP 0x60000000
+#define CROR_151515 0x4def7b82
+#define CROR_313131 0x4ffffb82
+
+/* Offset of tp and dtp pointers from start of TLS block. */
+#define TP_OFFSET 0x7000
+#define DTP_OFFSET 0x8000
+
+
+/* Enumeration to specify the special section. */
+enum elf_linker_section_enum
+{
+ LINKER_SECTION_SDATA,
+ LINKER_SECTION_SDATA2
+};
+
+/* Sections created by the linker. */
+
+typedef struct elf_linker_section
+{
+ /* pointer to the section */
+ asection *section;
+ /* pointer to the relocations needed for this section */
+ asection *rel_section;
+ /* pointer to the created symbol hash value */
+ struct elf_link_hash_entry *sym_hash;
+ /* offset of symbol from beginning of section */
+ bfd_vma sym_offset;
+} elf_linker_section_t;
+
+/* Linked list of allocated pointer entries. This hangs off of the
+ symbol lists, and provides allows us to return different pointers,
+ based on different addend's. */
+
+typedef struct elf_linker_section_pointers
+{
+ /* next allocated pointer for this symbol */
+ struct elf_linker_section_pointers *next;
+ /* offset of pointer from beginning of section */
+ bfd_vma offset;
+ /* addend used */
+ bfd_vma addend;
+ /* which linker section this is */
+ elf_linker_section_t *lsect;
+ /* whether address was written yet */
+ bfd_boolean written_address_p;
+} elf_linker_section_pointers_t;
+
+struct ppc_elf_obj_tdata
+{
+ struct elf_obj_tdata elf;
+
+ /* A mapping from local symbols to offsets into the various linker
+ sections added. This is index by the symbol index. */
+ elf_linker_section_pointers_t **linker_section_pointers;
+};
+
+#define ppc_elf_tdata(bfd) \
+ ((struct ppc_elf_obj_tdata *) (bfd)->tdata.any)
+
+#define elf_local_ptr_offsets(bfd) \
+ (ppc_elf_tdata (bfd)->linker_section_pointers)
+
+/* Override the generic function because we store some extras. */
+
+static bfd_boolean
+ppc_elf_mkobject (bfd *abfd)
+{
+ bfd_size_type amt = sizeof (struct ppc_elf_obj_tdata);
+ abfd->tdata.any = bfd_zalloc (abfd, amt);
+ if (abfd->tdata.any == NULL)
+ return FALSE;
+ return TRUE;
+}
+
+/* The PPC linker needs to keep track of the number of relocs that it
+ decides to copy as dynamic relocs in check_relocs for each symbol.
+ This is so that it can later discard them if they are found to be
+ unnecessary. We store the information in a field extending the
+ regular ELF linker hash table. */
+
+struct ppc_elf_dyn_relocs
+{
+ struct ppc_elf_dyn_relocs *next;
+
+ /* The input section of the reloc. */
+ asection *sec;
+
+ /* Total number of relocs copied for the input section. */
+ bfd_size_type count;
+
+ /* Number of pc-relative relocs copied for the input section. */
+ bfd_size_type pc_count;
+};
+
+/* PPC ELF linker hash entry. */
+
+struct ppc_elf_link_hash_entry
+{
+ struct elf_link_hash_entry elf;
+
+ /* If this symbol is used in the linker created sections, the processor
+ specific backend uses this field to map the field into the offset
+ from the beginning of the section. */
+ elf_linker_section_pointers_t *linker_section_pointer;
+
+ /* Track dynamic relocs copied for this symbol. */
+ struct ppc_elf_dyn_relocs *dyn_relocs;
+
+ /* Contexts in which symbol is used in the GOT (or TOC).
+ TLS_GD .. TLS_TLS bits are or'd into the mask as the
+ corresponding relocs are encountered during check_relocs.
+ tls_optimize clears TLS_GD .. TLS_TPREL when optimizing to
+ indicate the corresponding GOT entry type is not needed. */
+#define TLS_GD 1 /* GD reloc. */
+#define TLS_LD 2 /* LD reloc. */
+#define TLS_TPREL 4 /* TPREL reloc, => IE. */
+#define TLS_DTPREL 8 /* DTPREL reloc, => LD. */
+#define TLS_TLS 16 /* Any TLS reloc. */
+#define TLS_TPRELGD 32 /* TPREL reloc resulting from GD->IE. */
+ char tls_mask;
+};
+
+#define ppc_elf_hash_entry(ent) ((struct ppc_elf_link_hash_entry *) (ent))
+
+/* PPC ELF linker hash table. */
+
+struct ppc_elf_link_hash_table
+{
+ struct elf_link_hash_table elf;
+
+ /* Short-cuts to get to dynamic linker sections. */
+ asection *got;
+ asection *relgot;
+ asection *plt;
+ asection *relplt;
+ asection *dynbss;
+ asection *relbss;
+ asection *dynsbss;
+ asection *relsbss;
+ elf_linker_section_t *sdata;
+ elf_linker_section_t *sdata2;
+ asection *sbss;
+
+ /* Shortcut to .__tls_get_addr. */
+ struct elf_link_hash_entry *tls_get_addr;
+
+ /* TLS local dynamic got entry handling. */
+ union {
+ bfd_signed_vma refcount;
+ bfd_vma offset;
+ } tlsld_got;
+
+ /* Small local sym to section mapping cache. */
+ struct sym_sec_cache sym_sec;
+};
+
+/* Get the PPC ELF linker hash table from a link_info structure. */
+
+#define ppc_elf_hash_table(p) \
+ ((struct ppc_elf_link_hash_table *) (p)->hash)
+
+/* Create an entry in a PPC ELF linker hash table. */
+
+static struct bfd_hash_entry *
+ppc_elf_link_hash_newfunc (struct bfd_hash_entry *entry,
+ struct bfd_hash_table *table,
+ const char *string)
+{
+ /* Allocate the structure if it has not already been allocated by a
+ subclass. */
+ if (entry == NULL)
+ {
+ entry = bfd_hash_allocate (table,
+ sizeof (struct ppc_elf_link_hash_entry));
+ if (entry == NULL)
+ return entry;
+ }
+
+ /* Call the allocation method of the superclass. */
+ entry = _bfd_elf_link_hash_newfunc (entry, table, string);
+ if (entry != NULL)
+ {
+ ppc_elf_hash_entry (entry)->linker_section_pointer = NULL;
+ ppc_elf_hash_entry (entry)->dyn_relocs = NULL;
+ ppc_elf_hash_entry (entry)->tls_mask = 0;
+ }
+
+ return entry;
+}
+
+/* Create a PPC ELF linker hash table. */
+
+static struct bfd_link_hash_table *
+ppc_elf_link_hash_table_create (bfd *abfd)
+{
+ struct ppc_elf_link_hash_table *ret;
+
+ ret = bfd_zmalloc (sizeof (struct ppc_elf_link_hash_table));
+ if (ret == NULL)
+ return NULL;
+
+ if (! _bfd_elf_link_hash_table_init (&ret->elf, abfd,
+ ppc_elf_link_hash_newfunc))
+ {
+ free (ret);
+ return NULL;
+ }
+
+ return &ret->elf.root;
+}
+
+/* If ELIMINATE_COPY_RELOCS is non-zero, the linker will try to avoid
+ copying dynamic variables from a shared lib into an app's dynbss
+ section, and instead use a dynamic relocation to point into the
+ shared lib. */
+#define ELIMINATE_COPY_RELOCS 1
+
+/* Copy the extra info we tack onto an elf_link_hash_entry. */
+
+static void
+ppc_elf_copy_indirect_symbol (const struct elf_backend_data *bed,
+ struct elf_link_hash_entry *dir,
+ struct elf_link_hash_entry *ind)
+{
+ struct ppc_elf_link_hash_entry *edir, *eind;
+
+ edir = (struct ppc_elf_link_hash_entry *) dir;
+ eind = (struct ppc_elf_link_hash_entry *) ind;
+
+ if (eind->dyn_relocs != NULL)
+ {
+ if (edir->dyn_relocs != NULL)
+ {
+ struct ppc_elf_dyn_relocs **pp;
+ struct ppc_elf_dyn_relocs *p;
+
+ if (ind->root.type == bfd_link_hash_indirect)
+ abort ();
+
+ /* Add reloc counts against the weak sym to the strong sym
+ list. Merge any entries against the same section. */
+ for (pp = &eind->dyn_relocs; (p = *pp) != NULL; )
+ {
+ struct ppc_elf_dyn_relocs *q;
+
+ for (q = edir->dyn_relocs; q != NULL; q = q->next)
+ if (q->sec == p->sec)
+ {
+ q->pc_count += p->pc_count;
+ q->count += p->count;
+ *pp = p->next;
+ break;
+ }
+ if (q == NULL)
+ pp = &p->next;
+ }
+ *pp = edir->dyn_relocs;
+ }
+
+ edir->dyn_relocs = eind->dyn_relocs;
+ eind->dyn_relocs = NULL;
+ }
+
+ edir->tls_mask |= eind->tls_mask;
+
+ if (ELIMINATE_COPY_RELOCS
+ && ind->root.type != bfd_link_hash_indirect
+ && (dir->elf_link_hash_flags & ELF_LINK_HASH_DYNAMIC_ADJUSTED) != 0)
+ /* If called to transfer flags for a weakdef during processing
+ of elf_adjust_dynamic_symbol, don't copy ELF_LINK_NON_GOT_REF.
+ We clear it ourselves for ELIMINATE_COPY_RELOCS. */
+ dir->elf_link_hash_flags |=
+ (ind->elf_link_hash_flags & (ELF_LINK_HASH_REF_DYNAMIC
+ | ELF_LINK_HASH_REF_REGULAR
+ | ELF_LINK_HASH_REF_REGULAR_NONWEAK
+ | ELF_LINK_HASH_NEEDS_PLT));
+ else
+ _bfd_elf_link_hash_copy_indirect (bed, dir, ind);
+}
-static reloc_howto_type *ppc_elf_howto_table[(int) R_PPC_max];
+static reloc_howto_type *ppc_elf_howto_table[R_PPC_max];
static reloc_howto_type ppc_elf_howto_raw[] = {
/* This reloc does nothing. */
@@ -161,30 +350,30 @@ static reloc_howto_type ppc_elf_howto_raw[] = {
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
32, /* bitsize */
- false, /* pc_relative */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_PPC_NONE", /* name */
- false, /* partial_inplace */
+ FALSE, /* partial_inplace */
0, /* src_mask */
0, /* dst_mask */
- false), /* pcrel_offset */
+ FALSE), /* pcrel_offset */
/* A standard 32 bit relocation. */
HOWTO (R_PPC_ADDR32, /* type */
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
32, /* bitsize */
- false, /* pc_relative */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_PPC_ADDR32", /* name */
- false, /* partial_inplace */
+ FALSE, /* partial_inplace */
0, /* src_mask */
0xffffffff, /* dst_mask */
- false), /* pcrel_offset */
+ FALSE), /* pcrel_offset */
/* An absolute 26 bit branch; the lower two bits must be zero.
FIXME: we don't check that, we just clear them. */
@@ -192,60 +381,60 @@ static reloc_howto_type ppc_elf_howto_raw[] = {
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
26, /* bitsize */
- false, /* pc_relative */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_PPC_ADDR24", /* name */
- false, /* partial_inplace */
+ FALSE, /* partial_inplace */
0, /* src_mask */
0x3fffffc, /* dst_mask */
- false), /* pcrel_offset */
+ FALSE), /* pcrel_offset */
/* A standard 16 bit relocation. */
HOWTO (R_PPC_ADDR16, /* type */
0, /* rightshift */
1, /* size (0 = byte, 1 = short, 2 = long) */
16, /* bitsize */
- false, /* pc_relative */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_PPC_ADDR16", /* name */
- false, /* partial_inplace */
+ FALSE, /* partial_inplace */
0, /* src_mask */
0xffff, /* dst_mask */
- false), /* pcrel_offset */
+ FALSE), /* pcrel_offset */
/* A 16 bit relocation without overflow. */
HOWTO (R_PPC_ADDR16_LO, /* type */
0, /* rightshift */
1, /* size (0 = byte, 1 = short, 2 = long) */
16, /* bitsize */
- false, /* pc_relative */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_dont,/* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_PPC_ADDR16_LO", /* name */
- false, /* partial_inplace */
+ FALSE, /* partial_inplace */
0, /* src_mask */
0xffff, /* dst_mask */
- false), /* pcrel_offset */
+ FALSE), /* pcrel_offset */
/* The high order 16 bits of an address. */
HOWTO (R_PPC_ADDR16_HI, /* type */
16, /* rightshift */
1, /* size (0 = byte, 1 = short, 2 = long) */
16, /* bitsize */
- false, /* pc_relative */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_PPC_ADDR16_HI", /* name */
- false, /* partial_inplace */
+ FALSE, /* partial_inplace */
0, /* src_mask */
0xffff, /* dst_mask */
- false), /* pcrel_offset */
+ FALSE), /* pcrel_offset */
/* The high order 16 bits of an address, plus 1 if the contents of
the low 16 bits, treated as a signed number, is negative. */
@@ -253,15 +442,15 @@ static reloc_howto_type ppc_elf_howto_raw[] = {
16, /* rightshift */
1, /* size (0 = byte, 1 = short, 2 = long) */
16, /* bitsize */
- false, /* pc_relative */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
ppc_elf_addr16_ha_reloc, /* special_function */
"R_PPC_ADDR16_HA", /* name */
- false, /* partial_inplace */
+ FALSE, /* partial_inplace */
0, /* src_mask */
0xffff, /* dst_mask */
- false), /* pcrel_offset */
+ FALSE), /* pcrel_offset */
/* An absolute 16 bit branch; the lower two bits must be zero.
FIXME: we don't check that, we just clear them. */
@@ -269,15 +458,15 @@ static reloc_howto_type ppc_elf_howto_raw[] = {
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
16, /* bitsize */
- false, /* pc_relative */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_PPC_ADDR14", /* name */
- false, /* partial_inplace */
+ FALSE, /* partial_inplace */
0, /* src_mask */
0xfffc, /* dst_mask */
- false), /* pcrel_offset */
+ FALSE), /* pcrel_offset */
/* An absolute 16 bit branch, for which bit 10 should be set to
indicate that the branch is expected to be taken. The lower two
@@ -286,15 +475,15 @@ static reloc_howto_type ppc_elf_howto_raw[] = {
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
16, /* bitsize */
- false, /* pc_relative */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_PPC_ADDR14_BRTAKEN",/* name */
- false, /* partial_inplace */
+ FALSE, /* partial_inplace */
0, /* src_mask */
0xfffc, /* dst_mask */
- false), /* pcrel_offset */
+ FALSE), /* pcrel_offset */
/* An absolute 16 bit branch, for which bit 10 should be set to
indicate that the branch is not expected to be taken. The lower
@@ -303,45 +492,45 @@ static reloc_howto_type ppc_elf_howto_raw[] = {
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
16, /* bitsize */
- false, /* pc_relative */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_PPC_ADDR14_BRNTAKEN",/* name */
- false, /* partial_inplace */
+ FALSE, /* partial_inplace */
0, /* src_mask */
0xfffc, /* dst_mask */
- false), /* pcrel_offset */
+ FALSE), /* pcrel_offset */
/* A relative 26 bit branch; the lower two bits must be zero. */
HOWTO (R_PPC_REL24, /* type */
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
26, /* bitsize */
- true, /* pc_relative */
+ TRUE, /* pc_relative */
0, /* bitpos */
complain_overflow_signed, /* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_PPC_REL24", /* name */
- false, /* partial_inplace */
+ FALSE, /* partial_inplace */
0, /* src_mask */
0x3fffffc, /* dst_mask */
- true), /* pcrel_offset */
+ TRUE), /* pcrel_offset */
/* A relative 16 bit branch; the lower two bits must be zero. */
HOWTO (R_PPC_REL14, /* type */
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
16, /* bitsize */
- true, /* pc_relative */
+ TRUE, /* pc_relative */
0, /* bitpos */
complain_overflow_signed, /* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_PPC_REL14", /* name */
- false, /* partial_inplace */
+ FALSE, /* partial_inplace */
0, /* src_mask */
0xfffc, /* dst_mask */
- true), /* pcrel_offset */
+ TRUE), /* pcrel_offset */
/* A relative 16 bit branch. Bit 10 should be set to indicate that
the branch is expected to be taken. The lower two bits must be
@@ -350,15 +539,15 @@ static reloc_howto_type ppc_elf_howto_raw[] = {
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
16, /* bitsize */
- true, /* pc_relative */
+ TRUE, /* pc_relative */
0, /* bitpos */
complain_overflow_signed, /* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_PPC_REL14_BRTAKEN", /* name */
- false, /* partial_inplace */
+ FALSE, /* partial_inplace */
0, /* src_mask */
0xfffc, /* dst_mask */
- true), /* pcrel_offset */
+ TRUE), /* pcrel_offset */
/* A relative 16 bit branch. Bit 10 should be set to indicate that
the branch is not expected to be taken. The lower two bits must
@@ -367,15 +556,15 @@ static reloc_howto_type ppc_elf_howto_raw[] = {
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
16, /* bitsize */
- true, /* pc_relative */
+ TRUE, /* pc_relative */
0, /* bitpos */
complain_overflow_signed, /* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_PPC_REL14_BRNTAKEN",/* name */
- false, /* partial_inplace */
+ FALSE, /* partial_inplace */
0, /* src_mask */
0xfffc, /* dst_mask */
- true), /* pcrel_offset */
+ TRUE), /* pcrel_offset */
/* Like R_PPC_ADDR16, but referring to the GOT table entry for the
symbol. */
@@ -383,15 +572,15 @@ static reloc_howto_type ppc_elf_howto_raw[] = {
0, /* rightshift */
1, /* size (0 = byte, 1 = short, 2 = long) */
16, /* bitsize */
- false, /* pc_relative */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_signed, /* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_PPC_GOT16", /* name */
- false, /* partial_inplace */
+ FALSE, /* partial_inplace */
0, /* src_mask */
0xffff, /* dst_mask */
- false), /* pcrel_offset */
+ FALSE), /* pcrel_offset */
/* Like R_PPC_ADDR16_LO, but referring to the GOT table entry for
the symbol. */
@@ -399,15 +588,15 @@ static reloc_howto_type ppc_elf_howto_raw[] = {
0, /* rightshift */
1, /* size (0 = byte, 1 = short, 2 = long) */
16, /* bitsize */
- false, /* pc_relative */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_PPC_GOT16_LO", /* name */
- false, /* partial_inplace */
+ FALSE, /* partial_inplace */
0, /* src_mask */
0xffff, /* dst_mask */
- false), /* pcrel_offset */
+ FALSE), /* pcrel_offset */
/* Like R_PPC_ADDR16_HI, but referring to the GOT table entry for
the symbol. */
@@ -415,15 +604,15 @@ static reloc_howto_type ppc_elf_howto_raw[] = {
16, /* rightshift */
1, /* size (0 = byte, 1 = short, 2 = long) */
16, /* bitsize */
- false, /* pc_relative */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_PPC_GOT16_HI", /* name */
- false, /* partial_inplace */
+ FALSE, /* partial_inplace */
0, /* src_mask */
0xffff, /* dst_mask */
- false), /* pcrel_offset */
+ FALSE), /* pcrel_offset */
/* Like R_PPC_ADDR16_HA, but referring to the GOT table entry for
the symbol. */
@@ -431,15 +620,15 @@ static reloc_howto_type ppc_elf_howto_raw[] = {
16, /* rightshift */
1, /* size (0 = byte, 1 = short, 2 = long) */
16, /* bitsize */
- false, /* pc_relative */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
ppc_elf_addr16_ha_reloc, /* special_function */
"R_PPC_GOT16_HA", /* name */
- false, /* partial_inplace */
+ FALSE, /* partial_inplace */
0, /* src_mask */
0xffff, /* dst_mask */
- false), /* pcrel_offset */
+ FALSE), /* pcrel_offset */
/* Like R_PPC_REL24, but referring to the procedure linkage table
entry for the symbol. */
@@ -447,15 +636,15 @@ static reloc_howto_type ppc_elf_howto_raw[] = {
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
26, /* bitsize */
- true, /* pc_relative */
+ TRUE, /* pc_relative */
0, /* bitpos */
complain_overflow_signed, /* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_PPC_PLTREL24", /* name */
- false, /* partial_inplace */
+ FALSE, /* partial_inplace */
0, /* src_mask */
0x3fffffc, /* dst_mask */
- true), /* pcrel_offset */
+ TRUE), /* pcrel_offset */
/* This is used only by the dynamic linker. The symbol should exist
both in the object being run and in some shared library. The
@@ -466,15 +655,15 @@ static reloc_howto_type ppc_elf_howto_raw[] = {
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
32, /* bitsize */
- false, /* pc_relative */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_PPC_COPY", /* name */
- false, /* partial_inplace */
+ FALSE, /* partial_inplace */
0, /* src_mask */
0, /* dst_mask */
- false), /* pcrel_offset */
+ FALSE), /* pcrel_offset */
/* Like R_PPC_ADDR32, but used when setting global offset table
entries. */
@@ -482,30 +671,30 @@ static reloc_howto_type ppc_elf_howto_raw[] = {
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
32, /* bitsize */
- false, /* pc_relative */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_PPC_GLOB_DAT", /* name */
- false, /* partial_inplace */
+ FALSE, /* partial_inplace */
0, /* src_mask */
0xffffffff, /* dst_mask */
- false), /* pcrel_offset */
+ FALSE), /* pcrel_offset */
/* Marks a procedure linkage table entry for a symbol. */
HOWTO (R_PPC_JMP_SLOT, /* type */
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
32, /* bitsize */
- false, /* pc_relative */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_PPC_JMP_SLOT", /* name */
- false, /* partial_inplace */
+ FALSE, /* partial_inplace */
0, /* src_mask */
0, /* dst_mask */
- false), /* pcrel_offset */
+ FALSE), /* pcrel_offset */
/* Used only by the dynamic linker. When the object is run, this
longword is set to the load address of the object, plus the
@@ -514,15 +703,15 @@ static reloc_howto_type ppc_elf_howto_raw[] = {
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
32, /* bitsize */
- false, /* pc_relative */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_PPC_RELATIVE", /* name */
- false, /* partial_inplace */
+ FALSE, /* partial_inplace */
0, /* src_mask */
0xffffffff, /* dst_mask */
- false), /* pcrel_offset */
+ FALSE), /* pcrel_offset */
/* Like R_PPC_REL24, but uses the value of the symbol within the
object rather than the final value. Normally used for
@@ -531,60 +720,60 @@ static reloc_howto_type ppc_elf_howto_raw[] = {
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
26, /* bitsize */
- true, /* pc_relative */
+ TRUE, /* pc_relative */
0, /* bitpos */
complain_overflow_signed, /* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_PPC_LOCAL24PC", /* name */
- false, /* partial_inplace */
+ FALSE, /* partial_inplace */
0, /* src_mask */
0x3fffffc, /* dst_mask */
- true), /* pcrel_offset */
+ TRUE), /* pcrel_offset */
/* Like R_PPC_ADDR32, but may be unaligned. */
HOWTO (R_PPC_UADDR32, /* type */
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
32, /* bitsize */
- false, /* pc_relative */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_PPC_UADDR32", /* name */
- false, /* partial_inplace */
+ FALSE, /* partial_inplace */
0, /* src_mask */
0xffffffff, /* dst_mask */
- false), /* pcrel_offset */
+ FALSE), /* pcrel_offset */
/* Like R_PPC_ADDR16, but may be unaligned. */
HOWTO (R_PPC_UADDR16, /* type */
0, /* rightshift */
1, /* size (0 = byte, 1 = short, 2 = long) */
16, /* bitsize */
- false, /* pc_relative */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_PPC_UADDR16", /* name */
- false, /* partial_inplace */
+ FALSE, /* partial_inplace */
0, /* src_mask */
0xffff, /* dst_mask */
- false), /* pcrel_offset */
+ FALSE), /* pcrel_offset */
/* 32-bit PC relative */
HOWTO (R_PPC_REL32, /* type */
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
32, /* bitsize */
- true, /* pc_relative */
+ TRUE, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_PPC_REL32", /* name */
- false, /* partial_inplace */
+ FALSE, /* partial_inplace */
0, /* src_mask */
0xffffffff, /* dst_mask */
- true), /* pcrel_offset */
+ TRUE), /* pcrel_offset */
/* 32-bit relocation to the symbol's procedure linkage table.
FIXME: not supported. */
@@ -592,15 +781,15 @@ static reloc_howto_type ppc_elf_howto_raw[] = {
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
32, /* bitsize */
- false, /* pc_relative */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_PPC_PLT32", /* name */
- false, /* partial_inplace */
+ FALSE, /* partial_inplace */
0, /* src_mask */
0, /* dst_mask */
- false), /* pcrel_offset */
+ FALSE), /* pcrel_offset */
/* 32-bit PC relative relocation to the symbol's procedure linkage table.
FIXME: not supported. */
@@ -608,15 +797,15 @@ static reloc_howto_type ppc_elf_howto_raw[] = {
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
32, /* bitsize */
- true, /* pc_relative */
+ TRUE, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_PPC_PLTREL32", /* name */
- false, /* partial_inplace */
+ FALSE, /* partial_inplace */
0, /* src_mask */
0, /* dst_mask */
- true), /* pcrel_offset */
+ TRUE), /* pcrel_offset */
/* Like R_PPC_ADDR16_LO, but referring to the PLT table entry for
the symbol. */
@@ -624,15 +813,15 @@ static reloc_howto_type ppc_elf_howto_raw[] = {
0, /* rightshift */
1, /* size (0 = byte, 1 = short, 2 = long) */
16, /* bitsize */
- false, /* pc_relative */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_PPC_PLT16_LO", /* name */
- false, /* partial_inplace */
+ FALSE, /* partial_inplace */
0, /* src_mask */
0xffff, /* dst_mask */
- false), /* pcrel_offset */
+ FALSE), /* pcrel_offset */
/* Like R_PPC_ADDR16_HI, but referring to the PLT table entry for
the symbol. */
@@ -640,15 +829,15 @@ static reloc_howto_type ppc_elf_howto_raw[] = {
16, /* rightshift */
1, /* size (0 = byte, 1 = short, 2 = long) */
16, /* bitsize */
- false, /* pc_relative */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_PPC_PLT16_HI", /* name */
- false, /* partial_inplace */
+ FALSE, /* partial_inplace */
0, /* src_mask */
0xffff, /* dst_mask */
- false), /* pcrel_offset */
+ FALSE), /* pcrel_offset */
/* Like R_PPC_ADDR16_HA, but referring to the PLT table entry for
the symbol. */
@@ -656,15 +845,15 @@ static reloc_howto_type ppc_elf_howto_raw[] = {
16, /* rightshift */
1, /* size (0 = byte, 1 = short, 2 = long) */
16, /* bitsize */
- false, /* pc_relative */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
ppc_elf_addr16_ha_reloc, /* special_function */
"R_PPC_PLT16_HA", /* name */
- false, /* partial_inplace */
+ FALSE, /* partial_inplace */
0, /* src_mask */
0xffff, /* dst_mask */
- false), /* pcrel_offset */
+ FALSE), /* pcrel_offset */
/* A sign-extended 16 bit value relative to _SDA_BASE_, for use with
small data items. */
@@ -672,138 +861,568 @@ static reloc_howto_type ppc_elf_howto_raw[] = {
0, /* rightshift */
1, /* size (0 = byte, 1 = short, 2 = long) */
16, /* bitsize */
- false, /* pc_relative */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_signed, /* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_PPC_SDAREL16", /* name */
- false, /* partial_inplace */
+ FALSE, /* partial_inplace */
0, /* src_mask */
0xffff, /* dst_mask */
- false), /* pcrel_offset */
+ FALSE), /* pcrel_offset */
/* 16-bit section relative relocation. */
HOWTO (R_PPC_SECTOFF, /* type */
0, /* rightshift */
1, /* size (0 = byte, 1 = short, 2 = long) */
16, /* bitsize */
- false, /* pc_relative */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_PPC_SECTOFF", /* name */
- false, /* partial_inplace */
+ FALSE, /* partial_inplace */
0, /* src_mask */
0xffff, /* dst_mask */
- false), /* pcrel_offset */
+ FALSE), /* pcrel_offset */
/* 16-bit lower half section relative relocation. */
HOWTO (R_PPC_SECTOFF_LO, /* type */
0, /* rightshift */
1, /* size (0 = byte, 1 = short, 2 = long) */
16, /* bitsize */
- false, /* pc_relative */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_PPC_SECTOFF_LO", /* name */
- false, /* partial_inplace */
+ FALSE, /* partial_inplace */
0, /* src_mask */
0xffff, /* dst_mask */
- false), /* pcrel_offset */
+ FALSE), /* pcrel_offset */
/* 16-bit upper half section relative relocation. */
HOWTO (R_PPC_SECTOFF_HI, /* type */
16, /* rightshift */
1, /* size (0 = byte, 1 = short, 2 = long) */
16, /* bitsize */
- false, /* pc_relative */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_PPC_SECTOFF_HI", /* name */
- false, /* partial_inplace */
+ FALSE, /* partial_inplace */
0, /* src_mask */
0xffff, /* dst_mask */
- false), /* pcrel_offset */
+ FALSE), /* pcrel_offset */
/* 16-bit upper half adjusted section relative relocation. */
HOWTO (R_PPC_SECTOFF_HA, /* type */
16, /* rightshift */
1, /* size (0 = byte, 1 = short, 2 = long) */
16, /* bitsize */
- false, /* pc_relative */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
ppc_elf_addr16_ha_reloc, /* special_function */
"R_PPC_SECTOFF_HA", /* name */
- false, /* partial_inplace */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0xffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* Marker reloc for TLS. */
+ HOWTO (R_PPC_TLS,
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 32, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_PPC_TLS", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* Computes the load module index of the load module that contains the
+ definition of its TLS sym. */
+ HOWTO (R_PPC_DTPMOD32,
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 32, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ ppc_elf_unhandled_reloc, /* special_function */
+ "R_PPC_DTPMOD32", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* Computes a dtv-relative displacement, the difference between the value
+ of sym+add and the base address of the thread-local storage block that
+ contains the definition of sym, minus 0x8000. */
+ HOWTO (R_PPC_DTPREL32,
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 32, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ ppc_elf_unhandled_reloc, /* special_function */
+ "R_PPC_DTPREL32", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* A 16 bit dtprel reloc. */
+ HOWTO (R_PPC_DTPREL16,
+ 0, /* rightshift */
+ 1, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_signed, /* complain_on_overflow */
+ ppc_elf_unhandled_reloc, /* special_function */
+ "R_PPC_DTPREL16", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0xffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* Like DTPREL16, but no overflow. */
+ HOWTO (R_PPC_DTPREL16_LO,
+ 0, /* rightshift */
+ 1, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ ppc_elf_unhandled_reloc, /* special_function */
+ "R_PPC_DTPREL16_LO", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0xffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* Like DTPREL16_LO, but next higher group of 16 bits. */
+ HOWTO (R_PPC_DTPREL16_HI,
+ 16, /* rightshift */
+ 1, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ ppc_elf_unhandled_reloc, /* special_function */
+ "R_PPC_DTPREL16_HI", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0xffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* Like DTPREL16_HI, but adjust for low 16 bits. */
+ HOWTO (R_PPC_DTPREL16_HA,
+ 16, /* rightshift */
+ 1, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ ppc_elf_unhandled_reloc, /* special_function */
+ "R_PPC_DTPREL16_HA", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0xffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* Computes a tp-relative displacement, the difference between the value of
+ sym+add and the value of the thread pointer (r13). */
+ HOWTO (R_PPC_TPREL32,
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 32, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ ppc_elf_unhandled_reloc, /* special_function */
+ "R_PPC_TPREL32", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* A 16 bit tprel reloc. */
+ HOWTO (R_PPC_TPREL16,
+ 0, /* rightshift */
+ 1, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_signed, /* complain_on_overflow */
+ ppc_elf_unhandled_reloc, /* special_function */
+ "R_PPC_TPREL16", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0xffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* Like TPREL16, but no overflow. */
+ HOWTO (R_PPC_TPREL16_LO,
+ 0, /* rightshift */
+ 1, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ ppc_elf_unhandled_reloc, /* special_function */
+ "R_PPC_TPREL16_LO", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0xffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* Like TPREL16_LO, but next higher group of 16 bits. */
+ HOWTO (R_PPC_TPREL16_HI,
+ 16, /* rightshift */
+ 1, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ ppc_elf_unhandled_reloc, /* special_function */
+ "R_PPC_TPREL16_HI", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0xffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* Like TPREL16_HI, but adjust for low 16 bits. */
+ HOWTO (R_PPC_TPREL16_HA,
+ 16, /* rightshift */
+ 1, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ ppc_elf_unhandled_reloc, /* special_function */
+ "R_PPC_TPREL16_HA", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0xffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* Allocates two contiguous entries in the GOT to hold a tls_index structure,
+ with values (sym+add)@dtpmod and (sym+add)@dtprel, and computes the offset
+ to the first entry. */
+ HOWTO (R_PPC_GOT_TLSGD16,
+ 0, /* rightshift */
+ 1, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_signed, /* complain_on_overflow */
+ ppc_elf_unhandled_reloc, /* special_function */
+ "R_PPC_GOT_TLSGD16", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0xffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* Like GOT_TLSGD16, but no overflow. */
+ HOWTO (R_PPC_GOT_TLSGD16_LO,
+ 0, /* rightshift */
+ 1, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ ppc_elf_unhandled_reloc, /* special_function */
+ "R_PPC_GOT_TLSGD16_LO", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0xffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* Like GOT_TLSGD16_LO, but next higher group of 16 bits. */
+ HOWTO (R_PPC_GOT_TLSGD16_HI,
+ 16, /* rightshift */
+ 1, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ ppc_elf_unhandled_reloc, /* special_function */
+ "R_PPC_GOT_TLSGD16_HI", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0xffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* Like GOT_TLSGD16_HI, but adjust for low 16 bits. */
+ HOWTO (R_PPC_GOT_TLSGD16_HA,
+ 16, /* rightshift */
+ 1, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ ppc_elf_unhandled_reloc, /* special_function */
+ "R_PPC_GOT_TLSGD16_HA", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0xffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* Allocates two contiguous entries in the GOT to hold a tls_index structure,
+ with values (sym+add)@dtpmod and zero, and computes the offset to the
+ first entry. */
+ HOWTO (R_PPC_GOT_TLSLD16,
+ 0, /* rightshift */
+ 1, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_signed, /* complain_on_overflow */
+ ppc_elf_unhandled_reloc, /* special_function */
+ "R_PPC_GOT_TLSLD16", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0xffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* Like GOT_TLSLD16, but no overflow. */
+ HOWTO (R_PPC_GOT_TLSLD16_LO,
+ 0, /* rightshift */
+ 1, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ ppc_elf_unhandled_reloc, /* special_function */
+ "R_PPC_GOT_TLSLD16_LO", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0xffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* Like GOT_TLSLD16_LO, but next higher group of 16 bits. */
+ HOWTO (R_PPC_GOT_TLSLD16_HI,
+ 16, /* rightshift */
+ 1, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ ppc_elf_unhandled_reloc, /* special_function */
+ "R_PPC_GOT_TLSLD16_HI", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0xffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* Like GOT_TLSLD16_HI, but adjust for low 16 bits. */
+ HOWTO (R_PPC_GOT_TLSLD16_HA,
+ 16, /* rightshift */
+ 1, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ ppc_elf_unhandled_reloc, /* special_function */
+ "R_PPC_GOT_TLSLD16_HA", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0xffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* Allocates an entry in the GOT with value (sym+add)@dtprel, and computes
+ the offset to the entry. */
+ HOWTO (R_PPC_GOT_DTPREL16,
+ 0, /* rightshift */
+ 1, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_signed, /* complain_on_overflow */
+ ppc_elf_unhandled_reloc, /* special_function */
+ "R_PPC_GOT_DTPREL16", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0xffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* Like GOT_DTPREL16, but no overflow. */
+ HOWTO (R_PPC_GOT_DTPREL16_LO,
+ 0, /* rightshift */
+ 1, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ ppc_elf_unhandled_reloc, /* special_function */
+ "R_PPC_GOT_DTPREL16_LO", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0xffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* Like GOT_DTPREL16_LO, but next higher group of 16 bits. */
+ HOWTO (R_PPC_GOT_DTPREL16_HI,
+ 16, /* rightshift */
+ 1, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ ppc_elf_unhandled_reloc, /* special_function */
+ "R_PPC_GOT_DTPREL16_HI", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0xffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* Like GOT_DTPREL16_HI, but adjust for low 16 bits. */
+ HOWTO (R_PPC_GOT_DTPREL16_HA,
+ 16, /* rightshift */
+ 1, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ ppc_elf_unhandled_reloc, /* special_function */
+ "R_PPC_GOT_DTPREL16_HA", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0xffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* Allocates an entry in the GOT with value (sym+add)@tprel, and computes the
+ offset to the entry. */
+ HOWTO (R_PPC_GOT_TPREL16,
+ 0, /* rightshift */
+ 1, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_signed, /* complain_on_overflow */
+ ppc_elf_unhandled_reloc, /* special_function */
+ "R_PPC_GOT_TPREL16", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0xffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* Like GOT_TPREL16, but no overflow. */
+ HOWTO (R_PPC_GOT_TPREL16_LO,
+ 0, /* rightshift */
+ 1, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ ppc_elf_unhandled_reloc, /* special_function */
+ "R_PPC_GOT_TPREL16_LO", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0xffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* Like GOT_TPREL16_LO, but next higher group of 16 bits. */
+ HOWTO (R_PPC_GOT_TPREL16_HI,
+ 16, /* rightshift */
+ 1, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ ppc_elf_unhandled_reloc, /* special_function */
+ "R_PPC_GOT_TPREL16_HI", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0xffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* Like GOT_TPREL16_HI, but adjust for low 16 bits. */
+ HOWTO (R_PPC_GOT_TPREL16_HA,
+ 16, /* rightshift */
+ 1, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ ppc_elf_unhandled_reloc, /* special_function */
+ "R_PPC_GOT_TPREL16_HA", /* name */
+ FALSE, /* partial_inplace */
0, /* src_mask */
0xffff, /* dst_mask */
- false), /* pcrel_offset */
+ FALSE), /* pcrel_offset */
/* The remaining relocs are from the Embedded ELF ABI, and are not
in the SVR4 ELF ABI. */
- /* 32 bit value resulting from the addend minus the symbol */
+ /* 32 bit value resulting from the addend minus the symbol. */
HOWTO (R_PPC_EMB_NADDR32, /* type */
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
32, /* bitsize */
- false, /* pc_relative */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_PPC_EMB_NADDR32", /* name */
- false, /* partial_inplace */
+ FALSE, /* partial_inplace */
0, /* src_mask */
0xffffffff, /* dst_mask */
- false), /* pcrel_offset */
+ FALSE), /* pcrel_offset */
- /* 16 bit value resulting from the addend minus the symbol */
+ /* 16 bit value resulting from the addend minus the symbol. */
HOWTO (R_PPC_EMB_NADDR16, /* type */
0, /* rightshift */
1, /* size (0 = byte, 1 = short, 2 = long) */
16, /* bitsize */
- false, /* pc_relative */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_PPC_EMB_NADDR16", /* name */
- false, /* partial_inplace */
+ FALSE, /* partial_inplace */
0, /* src_mask */
0xffff, /* dst_mask */
- false), /* pcrel_offset */
+ FALSE), /* pcrel_offset */
- /* 16 bit value resulting from the addend minus the symbol */
+ /* 16 bit value resulting from the addend minus the symbol. */
HOWTO (R_PPC_EMB_NADDR16_LO, /* type */
0, /* rightshift */
1, /* size (0 = byte, 1 = short, 2 = long) */
16, /* bitsize */
- false, /* pc_relative */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_dont,/* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_PPC_EMB_ADDR16_LO", /* name */
- false, /* partial_inplace */
+ FALSE, /* partial_inplace */
0, /* src_mask */
0xffff, /* dst_mask */
- false), /* pcrel_offset */
+ FALSE), /* pcrel_offset */
- /* The high order 16 bits of the addend minus the symbol */
+ /* The high order 16 bits of the addend minus the symbol. */
HOWTO (R_PPC_EMB_NADDR16_HI, /* type */
16, /* rightshift */
1, /* size (0 = byte, 1 = short, 2 = long) */
16, /* bitsize */
- false, /* pc_relative */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_PPC_EMB_NADDR16_HI", /* name */
- false, /* partial_inplace */
+ FALSE, /* partial_inplace */
0, /* src_mask */
0xffff, /* dst_mask */
- false), /* pcrel_offset */
+ FALSE), /* pcrel_offset */
/* The high order 16 bits of the result of the addend minus the address,
plus 1 if the contents of the low 16 bits, treated as a signed number,
@@ -812,49 +1431,49 @@ static reloc_howto_type ppc_elf_howto_raw[] = {
16, /* rightshift */
1, /* size (0 = byte, 1 = short, 2 = long) */
16, /* bitsize */
- false, /* pc_relative */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
ppc_elf_addr16_ha_reloc, /* special_function */
"R_PPC_EMB_NADDR16_HA", /* name */
- false, /* partial_inplace */
+ FALSE, /* partial_inplace */
0, /* src_mask */
0xffff, /* dst_mask */
- false), /* pcrel_offset */
+ FALSE), /* pcrel_offset */
/* 16 bit value resulting from allocating a 4 byte word to hold an
address in the .sdata section, and returning the offset from
- _SDA_BASE_ for that relocation */
+ _SDA_BASE_ for that relocation. */
HOWTO (R_PPC_EMB_SDAI16, /* type */
0, /* rightshift */
1, /* size (0 = byte, 1 = short, 2 = long) */
16, /* bitsize */
- false, /* pc_relative */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_PPC_EMB_SDAI16", /* name */
- false, /* partial_inplace */
+ FALSE, /* partial_inplace */
0, /* src_mask */
0xffff, /* dst_mask */
- false), /* pcrel_offset */
+ FALSE), /* pcrel_offset */
/* 16 bit value resulting from allocating a 4 byte word to hold an
address in the .sdata2 section, and returning the offset from
- _SDA2_BASE_ for that relocation */
+ _SDA2_BASE_ for that relocation. */
HOWTO (R_PPC_EMB_SDA2I16, /* type */
0, /* rightshift */
1, /* size (0 = byte, 1 = short, 2 = long) */
16, /* bitsize */
- false, /* pc_relative */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_PPC_EMB_SDA2I16", /* name */
- false, /* partial_inplace */
+ FALSE, /* partial_inplace */
0, /* src_mask */
0xffff, /* dst_mask */
- false), /* pcrel_offset */
+ FALSE), /* pcrel_offset */
/* A sign-extended 16 bit value relative to _SDA2_BASE_, for use with
small data items. */
@@ -862,15 +1481,15 @@ static reloc_howto_type ppc_elf_howto_raw[] = {
0, /* rightshift */
1, /* size (0 = byte, 1 = short, 2 = long) */
16, /* bitsize */
- false, /* pc_relative */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_signed, /* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_PPC_EMB_SDA2REL", /* name */
- false, /* partial_inplace */
+ FALSE, /* partial_inplace */
0, /* src_mask */
0xffff, /* dst_mask */
- false), /* pcrel_offset */
+ FALSE), /* pcrel_offset */
/* Relocate against either _SDA_BASE_ or _SDA2_BASE_, filling in the 16 bit
signed offset from the appropriate base, and filling in the register
@@ -879,15 +1498,15 @@ static reloc_howto_type ppc_elf_howto_raw[] = {
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
16, /* bitsize */
- false, /* pc_relative */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_signed, /* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_PPC_EMB_SDA21", /* name */
- false, /* partial_inplace */
+ FALSE, /* partial_inplace */
0, /* src_mask */
0xffff, /* dst_mask */
- false), /* pcrel_offset */
+ FALSE), /* pcrel_offset */
/* Relocation not handled: R_PPC_EMB_MRKREF */
/* Relocation not handled: R_PPC_EMB_RELSEC16 */
@@ -903,440 +1522,594 @@ static reloc_howto_type ppc_elf_howto_raw[] = {
0, /* rightshift */
1, /* size (0 = byte, 1 = short, 2 = long) */
16, /* bitsize */
- true, /* pc_relative */
+ TRUE, /* pc_relative */
0, /* bitpos */
complain_overflow_signed, /* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_PPC_EMB_RELSDA", /* name */
- false, /* partial_inplace */
+ FALSE, /* partial_inplace */
0, /* src_mask */
0xffff, /* dst_mask */
- false), /* pcrel_offset */
+ FALSE), /* pcrel_offset */
+
+ /* Phony relocs to handle branch stubs. */
+ HOWTO (R_PPC_RELAX32, /* type */
+ 0, /* rightshift */
+ 0, /* size */
+ 0, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_PPC_RELAX32", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0, /* dst_mask */
+ FALSE), /* pcrel_offset */
- /* GNU extension to record C++ vtable hierarchy */
+ HOWTO (R_PPC_RELAX32PC, /* type */
+ 0, /* rightshift */
+ 0, /* size */
+ 0, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_PPC_RELAX32PC", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* GNU extension to record C++ vtable hierarchy. */
HOWTO (R_PPC_GNU_VTINHERIT, /* type */
0, /* rightshift */
0, /* size (0 = byte, 1 = short, 2 = long) */
0, /* bitsize */
- false, /* pc_relative */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
NULL, /* special_function */
"R_PPC_GNU_VTINHERIT", /* name */
- false, /* partial_inplace */
+ FALSE, /* partial_inplace */
0, /* src_mask */
0, /* dst_mask */
- false), /* pcrel_offset */
+ FALSE), /* pcrel_offset */
- /* GNU extension to record C++ vtable member usage */
+ /* GNU extension to record C++ vtable member usage. */
HOWTO (R_PPC_GNU_VTENTRY, /* type */
0, /* rightshift */
0, /* size (0 = byte, 1 = short, 2 = long) */
0, /* bitsize */
- false, /* pc_relative */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
NULL, /* special_function */
"R_PPC_GNU_VTENTRY", /* name */
- false, /* partial_inplace */
+ FALSE, /* partial_inplace */
0, /* src_mask */
0, /* dst_mask */
- false), /* pcrel_offset */
+ FALSE), /* pcrel_offset */
- /* Phony reloc to handle AIX style TOC entries */
+ /* Phony reloc to handle AIX style TOC entries. */
HOWTO (R_PPC_TOC16, /* type */
0, /* rightshift */
1, /* size (0 = byte, 1 = short, 2 = long) */
16, /* bitsize */
- false, /* pc_relative */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_signed, /* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_PPC_TOC16", /* name */
- false, /* partial_inplace */
+ FALSE, /* partial_inplace */
0, /* src_mask */
0xffff, /* dst_mask */
- false), /* pcrel_offset */
+ FALSE), /* pcrel_offset */
};
/* Initialize the ppc_elf_howto_table, so that linear accesses can be done. */
static void
-ppc_elf_howto_init ()
+ppc_elf_howto_init (void)
{
unsigned int i, type;
- for (i = 0; i < sizeof (ppc_elf_howto_raw) / sizeof (ppc_elf_howto_raw[0]); i++)
+ for (i = 0;
+ i < sizeof (ppc_elf_howto_raw) / sizeof (ppc_elf_howto_raw[0]);
+ i++)
{
type = ppc_elf_howto_raw[i].type;
- BFD_ASSERT (type < sizeof (ppc_elf_howto_table) / sizeof (ppc_elf_howto_table[0]));
+ if (type >= (sizeof (ppc_elf_howto_table)
+ / sizeof (ppc_elf_howto_table[0])))
+ abort ();
ppc_elf_howto_table[type] = &ppc_elf_howto_raw[i];
}
}
-/* This function handles relaxing for the PPC with option --mpc860c0[=<n>].
-
- The MPC860, revision C0 or earlier contains a bug in the die.
- If all of the following conditions are true, the next instruction
- to be executed *may* be treated as a no-op.
- 1/ A forward branch is executed.
- 2/ The branch is predicted as not taken.
- 3/ The branch is taken.
- 4/ The branch is located in the last 5 words of a page.
- (The EOP limit is 5 by default but may be specified as any value from 1-10.)
-
- Our software solution is to detect these problematic branches in a
- linker pass and modify them as follows:
- 1/ Unconditional branches - Since these are always predicted taken,
- there is no problem and no action is required.
- 2/ Conditional backward branches - No problem, no action required.
- 3/ Conditional forward branches - Ensure that the "inverse prediction
- bit" is set (ensure it is predicted taken).
- 4/ Conditional register branches - Ensure that the "y bit" is set
- (ensure it is predicted taken).
-*/
-
-/* Sort sections by address. */
+#define ARRAY_SIZE(a) (sizeof (a) / sizeof ((a)[0]))
-static int
-ppc_elf_sort_rela (arg1, arg2)
- const PTR arg1;
- const PTR arg2;
-{
- const Elf_Internal_Rela **rela1 = (const Elf_Internal_Rela**) arg1;
- const Elf_Internal_Rela **rela2 = (const Elf_Internal_Rela**) arg2;
-
- /* Sort by offset. */
- return ((*rela1)->r_offset - (*rela2)->r_offset);
-}
-
-static boolean
-ppc_elf_relax_section (abfd, isec, link_info, again)
- bfd *abfd;
- asection *isec;
- struct bfd_link_info *link_info;
- boolean *again;
+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)
{
-#define PAGESIZE 0x1000
+ struct one_fixup
+ {
+ struct one_fixup *next;
+ asection *tsec;
+ bfd_vma toff;
+ bfd_vma trampoff;
+ };
+ Elf_Internal_Shdr *symtab_hdr;
bfd_byte *contents = NULL;
- bfd_byte *free_contents = NULL;
+ Elf_Internal_Sym *isymbuf = NULL;
Elf_Internal_Rela *internal_relocs = NULL;
- Elf_Internal_Rela *free_relocs = NULL;
- Elf_Internal_Rela **rela_comb = NULL;
- int comb_curr, comb_count;
+ 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;
- /* We never have to do this more than once per input section. */
- *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;
+ isec->_cooked_size = isec->_raw_size;
- /* We're only interested in text sections which overlap the
- troublesome area at the end of a page. */
- if (link_info->mpc860c0 && (isec->flags & SEC_CODE) && isec->_cooked_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
{
- bfd_vma dot, end_page, end_section;
- boolean section_modified;
+ /* Go get them off disk. */
+ contents = bfd_malloc (isec->_raw_size);
+ if (contents == NULL)
+ goto error_return;
- /* 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;
+ 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
{
- /* Go get them off disk. */
- contents = (bfd_byte *) bfd_malloc (isec->_raw_size);
- if (contents == NULL)
- goto error_return;
- free_contents = contents;
-
- if (! bfd_get_section_contents (abfd, isec, contents,
- (file_ptr) 0, isec->_raw_size))
- goto error_return;
- }
-
- comb_curr = 0;
- comb_count = 0;
- if (isec->reloc_count)
- {
- unsigned n;
- bfd_size_type amt;
-
- /* Get a copy of the native relocations. */
- internal_relocs = _bfd_elf32_link_read_relocs (
- abfd, isec, (PTR) NULL, (Elf_Internal_Rela *) NULL,
- link_info->keep_memory);
- if (internal_relocs == NULL)
- goto error_return;
- if (! link_info->keep_memory)
- free_relocs = internal_relocs;
-
- /* Setup a faster access method for the reloc info we need. */
- amt = isec->reloc_count;
- amt *= sizeof (Elf_Internal_Rela*);
- rela_comb = (Elf_Internal_Rela**) bfd_malloc (amt);
- if (rela_comb == NULL)
- goto error_return;
- for (n = 0; n < isec->reloc_count; ++n)
- {
- long r_type;
-
- r_type = ELF32_R_TYPE (internal_relocs[n].r_info);
- if (r_type < 0 || r_type >= (int) R_PPC_max)
- goto error_return;
-
- /* Prologue constants are sometimes present in the ".text"
- sections and they can be identified by their associated relocation.
- We don't want to process those words and some others which
- can also be identified by their relocations. However, not all
- conditional branches will have a relocation so we will
- only ignore words that 1) have a reloc, and 2) the reloc
- is not applicable to a conditional branch.
- The array rela_comb is built here for use in the EOP scan loop. */
- switch (r_type)
- {
- case R_PPC_ADDR14_BRNTAKEN: /* absolute, predicted not taken */
- case R_PPC_REL14: /* relative cond. br. */
- case R_PPC_REL14_BRNTAKEN: /* rel. cond. br., predicted not taken */
- /* We should check the instruction. */
- break;
- default:
- /* The word is not a conditional branch - ignore it. */
- rela_comb[comb_count++] = &internal_relocs[n];
- break;
- }
- }
- if (comb_count > 1)
- qsort (rela_comb, (size_t) comb_count, sizeof (int), ppc_elf_sort_rela);
- }
-
- /* Enumerate each EOP region that overlaps this section. */
- end_section = isec->vma + isec->_cooked_size;
- dot = end_page = (isec->vma | (PAGESIZE - 1)) + 1;
- dot -= link_info->mpc860c0;
- section_modified = false;
- if (dot < isec->vma) /* Increment the start position if this section */
- dot = isec->vma; /* begins in the middle of its first EOP region. */
- for (;
- dot < end_section;
- dot += PAGESIZE, end_page += PAGESIZE)
- {
-
- /* Check each word in this EOP region. */
- for (; dot < end_page; dot += 4)
- {
- bfd_vma isec_offset;
- unsigned long insn;
- boolean skip, modified;
-
- /* Don't process this word if there is a relocation for it and
- the relocation indicates the word is not a conditional branch. */
- skip = false;
- isec_offset = dot - isec->vma;
- for (; comb_curr<comb_count; ++comb_curr)
- {
- bfd_vma r_offset;
-
- r_offset = rela_comb[comb_curr]->r_offset;
- if (r_offset >= isec_offset)
- {
- if (r_offset == isec_offset) skip = true;
- break;
- }
- }
- if (skip) continue;
-
- /* Check the current word for a problematic conditional branch. */
-#define BO0(insn) ((insn) & 0x02000000)
-#define BO2(insn) ((insn) & 0x00800000)
-#define BO4(insn) ((insn) & 0x00200000)
- insn = (unsigned long) bfd_get_32 (abfd, contents + isec_offset);
- modified = false;
- if ((insn & 0xFc000000) == 0x40000000)
- {
- /* Instruction is BCx */
- if ((!BO0(insn) || !BO2(insn)) && !BO4(insn))
- {
- bfd_vma target;
- /* This branch is predicted as "normal".
- If this is a forward branch, it is problematic. */
-
- target = insn & 0x0000Fffc; /*extract*/
- target = (target ^ 0x8000) - 0x8000; /*sign extend*/
- if ((insn & 0x00000002) == 0)
- target += dot; /*convert to abs*/
- if (target > dot)
- {
- insn |= 0x00200000; /* set the prediction bit */
- modified = true;
- }
- }
- }
- else if ((insn & 0xFc00Fffe) == 0x4c000420)
- {
- /* Instruction is BCCTRx */
- if ((!BO0(insn) || !BO2(insn)) && !BO4(insn))
- {
- /* This branch is predicted as not-taken.
- If this is a forward branch, it is problematic.
- Since we can't tell statically if it will branch forward,
- always set the prediction bit. */
- insn |= 0x00200000; /* set the prediction bit */
- modified = true;
- }
- }
- else if ((insn & 0xFc00Fffe) == 0x4c000020)
- {
- /* Instruction is BCLRx */
- if ((!BO0(insn) || !BO2(insn)) && !BO4(insn))
- {
- /* This branch is predicted as not-taken.
- If this is a forward branch, it is problematic.
- Since we can't tell statically if it will branch forward,
- always set the prediction bit. */
- insn |= 0x00200000; /* set the prediction bit */
- modified = true;
- }
- }
-#undef BO0
-#undef BO2
-#undef BO4
- if (modified)
- {
- bfd_put_32 (abfd, (bfd_vma) insn, contents + isec_offset);
- section_modified = true;
- }
- }
- }
- if (section_modified)
+ /* 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)
{
- elf_section_data (isec)->this_hdr.contents = contents;
- free_contents = 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;
}
}
- if (rela_comb != NULL)
+ /* Write out the trampolines. */
+ changed = fixups != NULL;
+ if (fixups != NULL)
{
- free (rela_comb);
- rela_comb = 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 (free_relocs != NULL)
+ if (isymbuf != NULL
+ && symtab_hdr->contents != (unsigned char *) isymbuf)
{
- free (free_relocs);
- free_relocs = NULL;
+ if (! link_info->keep_memory)
+ free (isymbuf);
+ else
+ {
+ /* Cache the symbols for elf_link_input_bfd. */
+ symtab_hdr->contents = (unsigned char *) isymbuf;
+ }
}
- if (free_contents != NULL)
+ if (contents != NULL
+ && elf_section_data (isec)->this_hdr.contents != contents)
{
- if (! link_info->keep_memory)
- free (free_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;
}
- free_contents = NULL;
}
- return true;
+ if (elf_section_data (isec)->relocs != internal_relocs)
+ {
+ if (!changed)
+ free (internal_relocs);
+ else
+ elf_section_data (isec)->relocs = internal_relocs;
+ }
-error_return:
- if (rela_comb != NULL)
- free (rela_comb);
- if (free_relocs != NULL)
- free (free_relocs);
- if (free_contents != NULL)
- free (free_contents);
- return false;
+ *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 (abfd, code)
- bfd *abfd ATTRIBUTE_UNUSED;
- bfd_reloc_code_real_type code;
+ppc_elf_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED,
+ bfd_reloc_code_real_type code)
{
- enum elf_ppc_reloc_type ppc_reloc = R_PPC_NONE;
+ enum elf_ppc_reloc_type r;
+ /* Initialize howto table if not already done. */
if (!ppc_elf_howto_table[R_PPC_ADDR32])
- /* Initialize howto table if needed. */
ppc_elf_howto_init ();
- switch ((int) code)
+ switch (code)
{
default:
- return (reloc_howto_type *) NULL;
-
- case BFD_RELOC_NONE: ppc_reloc = R_PPC_NONE; break;
- case BFD_RELOC_32: ppc_reloc = R_PPC_ADDR32; break;
- case BFD_RELOC_PPC_BA26: ppc_reloc = R_PPC_ADDR24; break;
- case BFD_RELOC_16: ppc_reloc = R_PPC_ADDR16; break;
- case BFD_RELOC_LO16: ppc_reloc = R_PPC_ADDR16_LO; break;
- case BFD_RELOC_HI16: ppc_reloc = R_PPC_ADDR16_HI; break;
- case BFD_RELOC_HI16_S: ppc_reloc = R_PPC_ADDR16_HA; break;
- case BFD_RELOC_PPC_BA16: ppc_reloc = R_PPC_ADDR14; break;
- case BFD_RELOC_PPC_BA16_BRTAKEN: ppc_reloc = R_PPC_ADDR14_BRTAKEN; break;
- case BFD_RELOC_PPC_BA16_BRNTAKEN: ppc_reloc = R_PPC_ADDR14_BRNTAKEN; break;
- case BFD_RELOC_PPC_B26: ppc_reloc = R_PPC_REL24; break;
- case BFD_RELOC_PPC_B16: ppc_reloc = R_PPC_REL14; break;
- case BFD_RELOC_PPC_B16_BRTAKEN: ppc_reloc = R_PPC_REL14_BRTAKEN; break;
- case BFD_RELOC_PPC_B16_BRNTAKEN: ppc_reloc = R_PPC_REL14_BRNTAKEN; break;
- case BFD_RELOC_16_GOTOFF: ppc_reloc = R_PPC_GOT16; break;
- case BFD_RELOC_LO16_GOTOFF: ppc_reloc = R_PPC_GOT16_LO; break;
- case BFD_RELOC_HI16_GOTOFF: ppc_reloc = R_PPC_GOT16_HI; break;
- case BFD_RELOC_HI16_S_GOTOFF: ppc_reloc = R_PPC_GOT16_HA; break;
- case BFD_RELOC_24_PLT_PCREL: ppc_reloc = R_PPC_PLTREL24; break;
- case BFD_RELOC_PPC_COPY: ppc_reloc = R_PPC_COPY; break;
- case BFD_RELOC_PPC_GLOB_DAT: ppc_reloc = R_PPC_GLOB_DAT; break;
- case BFD_RELOC_PPC_LOCAL24PC: ppc_reloc = R_PPC_LOCAL24PC; break;
- case BFD_RELOC_32_PCREL: ppc_reloc = R_PPC_REL32; break;
- case BFD_RELOC_32_PLTOFF: ppc_reloc = R_PPC_PLT32; break;
- case BFD_RELOC_32_PLT_PCREL: ppc_reloc = R_PPC_PLTREL32; break;
- case BFD_RELOC_LO16_PLTOFF: ppc_reloc = R_PPC_PLT16_LO; break;
- case BFD_RELOC_HI16_PLTOFF: ppc_reloc = R_PPC_PLT16_HI; break;
- case BFD_RELOC_HI16_S_PLTOFF: ppc_reloc = R_PPC_PLT16_HA; break;
- case BFD_RELOC_GPREL16: ppc_reloc = R_PPC_SDAREL16; break;
- case BFD_RELOC_16_BASEREL: ppc_reloc = R_PPC_SECTOFF; break;
- case BFD_RELOC_LO16_BASEREL: ppc_reloc = R_PPC_SECTOFF_LO; break;
- case BFD_RELOC_HI16_BASEREL: ppc_reloc = R_PPC_SECTOFF_HI; break;
- case BFD_RELOC_HI16_S_BASEREL: ppc_reloc = R_PPC_SECTOFF_HA; break;
- case BFD_RELOC_CTOR: ppc_reloc = R_PPC_ADDR32; break;
- case BFD_RELOC_PPC_TOC16: ppc_reloc = R_PPC_TOC16; break;
- case BFD_RELOC_PPC_EMB_NADDR32: ppc_reloc = R_PPC_EMB_NADDR32; break;
- case BFD_RELOC_PPC_EMB_NADDR16: ppc_reloc = R_PPC_EMB_NADDR16; break;
- case BFD_RELOC_PPC_EMB_NADDR16_LO: ppc_reloc = R_PPC_EMB_NADDR16_LO; break;
- case BFD_RELOC_PPC_EMB_NADDR16_HI: ppc_reloc = R_PPC_EMB_NADDR16_HI; break;
- case BFD_RELOC_PPC_EMB_NADDR16_HA: ppc_reloc = R_PPC_EMB_NADDR16_HA; break;
- case BFD_RELOC_PPC_EMB_SDAI16: ppc_reloc = R_PPC_EMB_SDAI16; break;
- case BFD_RELOC_PPC_EMB_SDA2I16: ppc_reloc = R_PPC_EMB_SDA2I16; break;
- case BFD_RELOC_PPC_EMB_SDA2REL: ppc_reloc = R_PPC_EMB_SDA2REL; break;
- case BFD_RELOC_PPC_EMB_SDA21: ppc_reloc = R_PPC_EMB_SDA21; break;
- case BFD_RELOC_PPC_EMB_MRKREF: ppc_reloc = R_PPC_EMB_MRKREF; break;
- case BFD_RELOC_PPC_EMB_RELSEC16: ppc_reloc = R_PPC_EMB_RELSEC16; break;
- case BFD_RELOC_PPC_EMB_RELST_LO: ppc_reloc = R_PPC_EMB_RELST_LO; break;
- case BFD_RELOC_PPC_EMB_RELST_HI: ppc_reloc = R_PPC_EMB_RELST_HI; break;
- case BFD_RELOC_PPC_EMB_RELST_HA: ppc_reloc = R_PPC_EMB_RELST_HA; break;
- case BFD_RELOC_PPC_EMB_BIT_FLD: ppc_reloc = R_PPC_EMB_BIT_FLD; break;
- case BFD_RELOC_PPC_EMB_RELSDA: ppc_reloc = R_PPC_EMB_RELSDA; break;
- case BFD_RELOC_VTABLE_INHERIT: ppc_reloc = R_PPC_GNU_VTINHERIT; break;
- case BFD_RELOC_VTABLE_ENTRY: ppc_reloc = R_PPC_GNU_VTENTRY; break;
- }
-
- return ppc_elf_howto_table[(int) ppc_reloc];
+ return NULL;
+
+ case BFD_RELOC_NONE: r = R_PPC_NONE; break;
+ case BFD_RELOC_32: r = R_PPC_ADDR32; break;
+ case BFD_RELOC_PPC_BA26: r = R_PPC_ADDR24; break;
+ case BFD_RELOC_16: r = R_PPC_ADDR16; break;
+ case BFD_RELOC_LO16: r = R_PPC_ADDR16_LO; break;
+ case BFD_RELOC_HI16: r = R_PPC_ADDR16_HI; break;
+ case BFD_RELOC_HI16_S: r = R_PPC_ADDR16_HA; break;
+ case BFD_RELOC_PPC_BA16: r = R_PPC_ADDR14; break;
+ case BFD_RELOC_PPC_BA16_BRTAKEN: r = R_PPC_ADDR14_BRTAKEN; break;
+ case BFD_RELOC_PPC_BA16_BRNTAKEN: r = R_PPC_ADDR14_BRNTAKEN; break;
+ case BFD_RELOC_PPC_B26: r = R_PPC_REL24; break;
+ case BFD_RELOC_PPC_B16: r = R_PPC_REL14; break;
+ case BFD_RELOC_PPC_B16_BRTAKEN: r = R_PPC_REL14_BRTAKEN; break;
+ case BFD_RELOC_PPC_B16_BRNTAKEN: r = R_PPC_REL14_BRNTAKEN; break;
+ case BFD_RELOC_16_GOTOFF: r = R_PPC_GOT16; break;
+ case BFD_RELOC_LO16_GOTOFF: r = R_PPC_GOT16_LO; break;
+ case BFD_RELOC_HI16_GOTOFF: r = R_PPC_GOT16_HI; break;
+ case BFD_RELOC_HI16_S_GOTOFF: r = R_PPC_GOT16_HA; break;
+ case BFD_RELOC_24_PLT_PCREL: r = R_PPC_PLTREL24; break;
+ case BFD_RELOC_PPC_COPY: r = R_PPC_COPY; break;
+ case BFD_RELOC_PPC_GLOB_DAT: r = R_PPC_GLOB_DAT; break;
+ case BFD_RELOC_PPC_LOCAL24PC: r = R_PPC_LOCAL24PC; break;
+ case BFD_RELOC_32_PCREL: r = R_PPC_REL32; break;
+ case BFD_RELOC_32_PLTOFF: r = R_PPC_PLT32; break;
+ case BFD_RELOC_32_PLT_PCREL: r = R_PPC_PLTREL32; break;
+ case BFD_RELOC_LO16_PLTOFF: r = R_PPC_PLT16_LO; break;
+ case BFD_RELOC_HI16_PLTOFF: r = R_PPC_PLT16_HI; break;
+ case BFD_RELOC_HI16_S_PLTOFF: r = R_PPC_PLT16_HA; break;
+ case BFD_RELOC_GPREL16: r = R_PPC_SDAREL16; break;
+ case BFD_RELOC_16_BASEREL: r = R_PPC_SECTOFF; break;
+ case BFD_RELOC_LO16_BASEREL: r = R_PPC_SECTOFF_LO; break;
+ case BFD_RELOC_HI16_BASEREL: r = R_PPC_SECTOFF_HI; break;
+ case BFD_RELOC_HI16_S_BASEREL: r = R_PPC_SECTOFF_HA; break;
+ case BFD_RELOC_CTOR: r = R_PPC_ADDR32; break;
+ case BFD_RELOC_PPC_TOC16: r = R_PPC_TOC16; break;
+ case BFD_RELOC_PPC_TLS: r = R_PPC_TLS; break;
+ case BFD_RELOC_PPC_DTPMOD: r = R_PPC_DTPMOD32; break;
+ case BFD_RELOC_PPC_TPREL16: r = R_PPC_TPREL16; break;
+ case BFD_RELOC_PPC_TPREL16_LO: r = R_PPC_TPREL16_LO; break;
+ case BFD_RELOC_PPC_TPREL16_HI: r = R_PPC_TPREL16_HI; break;
+ case BFD_RELOC_PPC_TPREL16_HA: r = R_PPC_TPREL16_HA; break;
+ case BFD_RELOC_PPC_TPREL: r = R_PPC_TPREL32; break;
+ case BFD_RELOC_PPC_DTPREL16: r = R_PPC_DTPREL16; break;
+ case BFD_RELOC_PPC_DTPREL16_LO: r = R_PPC_DTPREL16_LO; break;
+ case BFD_RELOC_PPC_DTPREL16_HI: r = R_PPC_DTPREL16_HI; break;
+ case BFD_RELOC_PPC_DTPREL16_HA: r = R_PPC_DTPREL16_HA; break;
+ case BFD_RELOC_PPC_DTPREL: r = R_PPC_DTPREL32; break;
+ case BFD_RELOC_PPC_GOT_TLSGD16: r = R_PPC_GOT_TLSGD16; break;
+ case BFD_RELOC_PPC_GOT_TLSGD16_LO: r = R_PPC_GOT_TLSGD16_LO; break;
+ case BFD_RELOC_PPC_GOT_TLSGD16_HI: r = R_PPC_GOT_TLSGD16_HI; break;
+ case BFD_RELOC_PPC_GOT_TLSGD16_HA: r = R_PPC_GOT_TLSGD16_HA; break;
+ case BFD_RELOC_PPC_GOT_TLSLD16: r = R_PPC_GOT_TLSLD16; break;
+ case BFD_RELOC_PPC_GOT_TLSLD16_LO: r = R_PPC_GOT_TLSLD16_LO; break;
+ case BFD_RELOC_PPC_GOT_TLSLD16_HI: r = R_PPC_GOT_TLSLD16_HI; break;
+ case BFD_RELOC_PPC_GOT_TLSLD16_HA: r = R_PPC_GOT_TLSLD16_HA; break;
+ case BFD_RELOC_PPC_GOT_TPREL16: r = R_PPC_GOT_TPREL16; break;
+ case BFD_RELOC_PPC_GOT_TPREL16_LO: r = R_PPC_GOT_TPREL16_LO; break;
+ case BFD_RELOC_PPC_GOT_TPREL16_HI: r = R_PPC_GOT_TPREL16_HI; break;
+ case BFD_RELOC_PPC_GOT_TPREL16_HA: r = R_PPC_GOT_TPREL16_HA; break;
+ case BFD_RELOC_PPC_GOT_DTPREL16: r = R_PPC_GOT_DTPREL16; break;
+ case BFD_RELOC_PPC_GOT_DTPREL16_LO: r = R_PPC_GOT_DTPREL16_LO; break;
+ case BFD_RELOC_PPC_GOT_DTPREL16_HI: r = R_PPC_GOT_DTPREL16_HI; break;
+ case BFD_RELOC_PPC_GOT_DTPREL16_HA: r = R_PPC_GOT_DTPREL16_HA; break;
+ case BFD_RELOC_PPC_EMB_NADDR32: r = R_PPC_EMB_NADDR32; break;
+ case BFD_RELOC_PPC_EMB_NADDR16: r = R_PPC_EMB_NADDR16; break;
+ case BFD_RELOC_PPC_EMB_NADDR16_LO: r = R_PPC_EMB_NADDR16_LO; break;
+ case BFD_RELOC_PPC_EMB_NADDR16_HI: r = R_PPC_EMB_NADDR16_HI; break;
+ case BFD_RELOC_PPC_EMB_NADDR16_HA: r = R_PPC_EMB_NADDR16_HA; break;
+ case BFD_RELOC_PPC_EMB_SDAI16: r = R_PPC_EMB_SDAI16; break;
+ case BFD_RELOC_PPC_EMB_SDA2I16: r = R_PPC_EMB_SDA2I16; break;
+ case BFD_RELOC_PPC_EMB_SDA2REL: r = R_PPC_EMB_SDA2REL; break;
+ case BFD_RELOC_PPC_EMB_SDA21: r = R_PPC_EMB_SDA21; break;
+ case BFD_RELOC_PPC_EMB_MRKREF: r = R_PPC_EMB_MRKREF; break;
+ case BFD_RELOC_PPC_EMB_RELSEC16: r = R_PPC_EMB_RELSEC16; break;
+ case BFD_RELOC_PPC_EMB_RELST_LO: r = R_PPC_EMB_RELST_LO; break;
+ case BFD_RELOC_PPC_EMB_RELST_HI: r = R_PPC_EMB_RELST_HI; break;
+ case BFD_RELOC_PPC_EMB_RELST_HA: r = R_PPC_EMB_RELST_HA; break;
+ case BFD_RELOC_PPC_EMB_BIT_FLD: r = R_PPC_EMB_BIT_FLD; break;
+ case BFD_RELOC_PPC_EMB_RELSDA: r = R_PPC_EMB_RELSDA; break;
+ case BFD_RELOC_VTABLE_INHERIT: r = R_PPC_GNU_VTINHERIT; break;
+ case BFD_RELOC_VTABLE_ENTRY: r = R_PPC_GNU_VTENTRY; break;
+ }
+
+ return ppc_elf_howto_table[r];
};
/* Set the howto pointer for a PowerPC ELF reloc. */
static void
-ppc_elf_info_to_howto (abfd, cache_ptr, dst)
- bfd *abfd ATTRIBUTE_UNUSED;
- arelent *cache_ptr;
- Elf32_Internal_Rela *dst;
+ppc_elf_info_to_howto (bfd *abfd ATTRIBUTE_UNUSED,
+ arelent *cache_ptr,
+ Elf_Internal_Rela *dst)
{
+ /* Initialize howto table if not already done. */
if (!ppc_elf_howto_table[R_PPC_ADDR32])
- /* Initialize howto table if needed. */
ppc_elf_howto_init ();
BFD_ASSERT (ELF32_R_TYPE (dst->r_info) < (unsigned int) R_PPC_max);
@@ -1346,15 +2119,13 @@ ppc_elf_info_to_howto (abfd, cache_ptr, dst)
/* Handle the R_PPC_ADDR16_HA reloc. */
static bfd_reloc_status_type
-ppc_elf_addr16_ha_reloc (abfd, reloc_entry, symbol, data, input_section,
- output_bfd, error_message)
- bfd *abfd ATTRIBUTE_UNUSED;
- arelent *reloc_entry;
- asymbol *symbol;
- PTR data ATTRIBUTE_UNUSED;
- asection *input_section;
- bfd *output_bfd;
- char **error_message ATTRIBUTE_UNUSED;
+ppc_elf_addr16_ha_reloc (bfd *abfd ATTRIBUTE_UNUSED,
+ arelent *reloc_entry,
+ asymbol *symbol,
+ void *data ATTRIBUTE_UNUSED,
+ asection *input_section,
+ bfd *output_bfd,
+ char **error_message ATTRIBUTE_UNUSED)
{
bfd_vma relocation;
@@ -1381,12 +2152,37 @@ ppc_elf_addr16_ha_reloc (abfd, reloc_entry, symbol, data, input_section,
return bfd_reloc_continue;
}
+static bfd_reloc_status_type
+ppc_elf_unhandled_reloc (bfd *abfd,
+ arelent *reloc_entry,
+ asymbol *symbol,
+ void *data,
+ asection *input_section,
+ bfd *output_bfd,
+ char **error_message)
+{
+ /* If this is a relocatable link (output_bfd test tells us), just
+ call the generic function. Any adjustment will be done at final
+ link time. */
+ if (output_bfd != NULL)
+ return bfd_elf_generic_reloc (abfd, reloc_entry, symbol, data,
+ input_section, output_bfd, error_message);
+
+ if (error_message != NULL)
+ {
+ static char buf[60];
+ sprintf (buf, _("generic linker can't handle %s"),
+ reloc_entry->howto->name);
+ *error_message = buf;
+ }
+ return bfd_reloc_dangerous;
+}
+
/* Fix bad default arch selected for a 32 bit input bfd when the
default is 64 bit. */
-static boolean
-ppc_elf_object_p (abfd)
- bfd *abfd;
+static bfd_boolean
+ppc_elf_object_p (bfd *abfd)
{
if (abfd->arch_info->the_default && abfd->arch_info->bits_per_word == 64)
{
@@ -1399,73 +2195,75 @@ ppc_elf_object_p (abfd)
BFD_ASSERT (abfd->arch_info->bits_per_word == 32);
}
}
- return true;
+ return TRUE;
}
/* Function to set whether a module needs the -mrelocatable bit set. */
-static boolean
-ppc_elf_set_private_flags (abfd, flags)
- bfd *abfd;
- flagword flags;
+static bfd_boolean
+ppc_elf_set_private_flags (bfd *abfd, flagword flags)
{
BFD_ASSERT (!elf_flags_init (abfd)
|| elf_elfheader (abfd)->e_flags == flags);
elf_elfheader (abfd)->e_flags = flags;
- elf_flags_init (abfd) = true;
- return true;
+ elf_flags_init (abfd) = TRUE;
+ return TRUE;
}
/* Merge backend specific data from an object file to the output
- object file when linking */
-static boolean
-ppc_elf_merge_private_bfd_data (ibfd, obfd)
- bfd *ibfd;
- bfd *obfd;
+ object file when linking. */
+
+static bfd_boolean
+ppc_elf_merge_private_bfd_data (bfd *ibfd, bfd *obfd)
{
flagword old_flags;
flagword new_flags;
- boolean error;
+ bfd_boolean error;
- /* Check if we have the same endianess */
+ /* Check if we have the same endianess. */
if (! _bfd_generic_verify_endian_match (ibfd, obfd))
- return false;
+ return FALSE;
if (bfd_get_flavour (ibfd) != bfd_target_elf_flavour
|| bfd_get_flavour (obfd) != bfd_target_elf_flavour)
- return true;
+ return TRUE;
new_flags = elf_elfheader (ibfd)->e_flags;
old_flags = elf_elfheader (obfd)->e_flags;
- if (!elf_flags_init (obfd)) /* First call, no flags set */
+ if (!elf_flags_init (obfd))
{
- elf_flags_init (obfd) = true;
+ /* First call, no flags set. */
+ elf_flags_init (obfd) = TRUE;
elf_elfheader (obfd)->e_flags = new_flags;
}
- else if (new_flags == old_flags) /* Compatible flags are ok */
+ /* Compatible flags are ok. */
+ else if (new_flags == old_flags)
;
- else /* Incompatible flags */
+ /* Incompatible flags. */
+ else
{
- /* Warn about -mrelocatable mismatch. Allow -mrelocatable-lib to be linked
- with either. */
- error = false;
+ /* 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;
+ error = TRUE;
(*_bfd_error_handler)
- (_("%s: compiled with -mrelocatable and linked with modules compiled normally"),
+ (_("%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;
+ error = TRUE;
(*_bfd_error_handler)
- (_("%s: compiled normally and linked with modules compiled with -mrelocatable"),
+ (_("%s: compiled normally and linked with "
+ "modules compiled with -mrelocatable"),
bfd_archive_filename (ibfd));
}
@@ -1474,51 +2272,50 @@ ppc_elf_merge_private_bfd_data (ibfd, obfd)
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. */
+ but each input file is either -mrelocatable or -mrelocatable-lib. */
if (! (elf_elfheader (obfd)->e_flags & EF_PPC_RELOCATABLE_LIB)
&& (new_flags & (EF_PPC_RELOCATABLE_LIB | EF_PPC_RELOCATABLE))
&& (old_flags & (EF_PPC_RELOCATABLE_LIB | EF_PPC_RELOCATABLE)))
elf_elfheader (obfd)->e_flags |= EF_PPC_RELOCATABLE;
- /* Do not warn about eabi vs. V.4 mismatch, just or in the bit if any module uses it */
+ /* Do not warn about eabi vs. V.4 mismatch, just or in the bit if
+ any module uses it. */
elf_elfheader (obfd)->e_flags |= (new_flags & EF_PPC_EMB);
- new_flags &= ~ (EF_PPC_RELOCATABLE | EF_PPC_RELOCATABLE_LIB | EF_PPC_EMB);
- old_flags &= ~ (EF_PPC_RELOCATABLE | EF_PPC_RELOCATABLE_LIB | EF_PPC_EMB);
+ 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 */
+ /* Warn about any other mismatches. */
if (new_flags != old_flags)
{
- error = true;
+ error = TRUE;
(*_bfd_error_handler)
- (_("%s: uses different e_flags (0x%lx) fields than previous modules (0x%lx)"),
+ (_("%s: uses different e_flags (0x%lx) fields "
+ "than previous modules (0x%lx)"),
bfd_archive_filename (ibfd), (long) new_flags, (long) old_flags);
}
if (error)
{
bfd_set_error (bfd_error_bad_value);
- return false;
+ return FALSE;
}
}
- return true;
+ return TRUE;
}
/* Handle a PowerPC specific section when reading an object file. This
is called when elfcode.h finds a section with an unknown type. */
-static boolean
-ppc_elf_section_from_shdr (abfd, hdr, name)
- bfd *abfd;
- Elf32_Internal_Shdr *hdr;
- const char *name;
+static bfd_boolean
+ppc_elf_section_from_shdr (bfd *abfd, Elf_Internal_Shdr *hdr, const char *name)
{
asection *newsect;
flagword flags;
if (! _bfd_elf_make_section_from_shdr (abfd, hdr, name))
- return false;
+ return FALSE;
newsect = hdr->bfd_section;
flags = bfd_get_section_flags (abfd, newsect);
@@ -1529,16 +2326,15 @@ ppc_elf_section_from_shdr (abfd, hdr, name)
flags |= SEC_SORT_ENTRIES;
bfd_set_section_flags (abfd, newsect, flags);
- return true;
+ return TRUE;
}
/* Set up any other section flags and such that may be necessary. */
-static boolean
-ppc_elf_fake_sections (abfd, shdr, asect)
- bfd *abfd ATTRIBUTE_UNUSED;
- Elf32_Internal_Shdr *shdr;
- asection *asect;
+static bfd_boolean
+ppc_elf_fake_sections (bfd *abfd ATTRIBUTE_UNUSED,
+ Elf_Internal_Shdr *shdr,
+ asection *asect)
{
if ((asect->flags & SEC_EXCLUDE) != 0)
shdr->sh_flags |= SHF_EXCLUDE;
@@ -1546,75 +2342,363 @@ ppc_elf_fake_sections (abfd, shdr, asect)
if ((asect->flags & SEC_SORT_ENTRIES) != 0)
shdr->sh_type = SHT_ORDERED;
- return true;
+ return TRUE;
+}
+
+/* Find a linker generated pointer with a given addend and type. */
+
+static elf_linker_section_pointers_t *
+elf_find_pointer_linker_section
+ (elf_linker_section_pointers_t *linker_pointers,
+ bfd_vma addend,
+ elf_linker_section_t *lsect)
+{
+ for ( ; linker_pointers != NULL; linker_pointers = linker_pointers->next)
+ if (lsect == linker_pointers->lsect && addend == linker_pointers->addend)
+ return linker_pointers;
+
+ return NULL;
+}
+
+/* Allocate a pointer to live in a linker created section. */
+
+static bfd_boolean
+elf_create_pointer_linker_section (bfd *abfd,
+ struct bfd_link_info *info,
+ elf_linker_section_t *lsect,
+ struct elf_link_hash_entry *h,
+ const Elf_Internal_Rela *rel)
+{
+ elf_linker_section_pointers_t **ptr_linker_section_ptr = NULL;
+ elf_linker_section_pointers_t *linker_section_ptr;
+ unsigned long r_symndx = ELF32_R_SYM (rel->r_info);
+ bfd_size_type amt;
+
+ BFD_ASSERT (lsect != NULL);
+
+ /* Is this a global symbol? */
+ if (h != NULL)
+ {
+ struct ppc_elf_link_hash_entry *eh;
+
+ /* Has this symbol already been allocated? If so, our work is done. */
+ eh = (struct ppc_elf_link_hash_entry *) h;
+ if (elf_find_pointer_linker_section (eh->linker_section_pointer,
+ rel->r_addend,
+ lsect))
+ return TRUE;
+
+ ptr_linker_section_ptr = &eh->linker_section_pointer;
+ /* Make sure this symbol is output as a dynamic symbol. */
+ if (h->dynindx == -1)
+ {
+ if (! bfd_elf_link_record_dynamic_symbol (info, h))
+ return FALSE;
+ }
+
+ if (lsect->rel_section)
+ lsect->rel_section->_raw_size += sizeof (Elf32_External_Rela);
+ }
+ else
+ {
+ /* Allocation of a pointer to a local symbol. */
+ elf_linker_section_pointers_t **ptr = elf_local_ptr_offsets (abfd);
+
+ /* Allocate a table to hold the local symbols if first time. */
+ if (!ptr)
+ {
+ unsigned int num_symbols = elf_tdata (abfd)->symtab_hdr.sh_info;
+
+ amt = num_symbols;
+ amt *= sizeof (elf_linker_section_pointers_t *);
+ ptr = bfd_zalloc (abfd, amt);
+
+ if (!ptr)
+ return FALSE;
+
+ elf_local_ptr_offsets (abfd) = ptr;
+ }
+
+ /* Has this symbol already been allocated? If so, our work is done. */
+ if (elf_find_pointer_linker_section (ptr[r_symndx],
+ rel->r_addend,
+ lsect))
+ return TRUE;
+
+ ptr_linker_section_ptr = &ptr[r_symndx];
+
+ if (info->shared)
+ {
+ /* If we are generating a shared object, we need to
+ output a R_<xxx>_RELATIVE reloc so that the
+ dynamic linker can adjust this GOT entry. */
+ BFD_ASSERT (lsect->rel_section != NULL);
+ lsect->rel_section->_raw_size += sizeof (Elf32_External_Rela);
+ }
+ }
+
+ /* Allocate space for a pointer in the linker section, and allocate
+ a new pointer record from internal memory. */
+ BFD_ASSERT (ptr_linker_section_ptr != NULL);
+ amt = sizeof (elf_linker_section_pointers_t);
+ linker_section_ptr = bfd_alloc (abfd, amt);
+
+ if (!linker_section_ptr)
+ return FALSE;
+
+ linker_section_ptr->next = *ptr_linker_section_ptr;
+ linker_section_ptr->addend = rel->r_addend;
+ linker_section_ptr->lsect = lsect;
+ linker_section_ptr->written_address_p = FALSE;
+ *ptr_linker_section_ptr = linker_section_ptr;
+
+ linker_section_ptr->offset = lsect->section->_raw_size;
+ lsect->section->_raw_size += 4;
+
+#ifdef DEBUG
+ fprintf (stderr,
+ "Create pointer in linker section %s, offset = %ld, section size = %ld\n",
+ lsect->name, (long) linker_section_ptr->offset,
+ (long) lsect->section->_raw_size);
+#endif
+
+ return TRUE;
+}
+
+#define bfd_put_ptr(BFD, VAL, ADDR) bfd_put_32 (BFD, VAL, ADDR)
+
+/* Fill in the address for a pointer generated in a linker section. */
+
+static bfd_vma
+elf_finish_pointer_linker_section (bfd *output_bfd,
+ bfd *input_bfd,
+ struct bfd_link_info *info,
+ elf_linker_section_t *lsect,
+ struct elf_link_hash_entry *h,
+ bfd_vma relocation,
+ const Elf_Internal_Rela *rel,
+ int relative_reloc)
+{
+ elf_linker_section_pointers_t *linker_section_ptr;
+
+ BFD_ASSERT (lsect != NULL);
+
+ if (h != NULL)
+ {
+ /* Handle global symbol. */
+ struct ppc_elf_link_hash_entry *eh;
+
+ eh = (struct ppc_elf_link_hash_entry *) h;
+ linker_section_ptr
+ = elf_find_pointer_linker_section (eh->linker_section_pointer,
+ rel->r_addend,
+ lsect);
+
+ BFD_ASSERT (linker_section_ptr != NULL);
+
+ if (! elf_hash_table (info)->dynamic_sections_created
+ || (info->shared
+ && info->symbolic
+ && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR)))
+ {
+ /* This is actually a static link, or it is a
+ -Bsymbolic link and the symbol is defined
+ locally. We must initialize this entry in the
+ global section.
+
+ When doing a dynamic link, we create a .rela.<xxx>
+ relocation entry to initialize the value. This
+ is done in the finish_dynamic_symbol routine. */
+ if (!linker_section_ptr->written_address_p)
+ {
+ linker_section_ptr->written_address_p = TRUE;
+ bfd_put_ptr (output_bfd,
+ relocation + linker_section_ptr->addend,
+ (lsect->section->contents
+ + linker_section_ptr->offset));
+ }
+ }
+ }
+ else
+ {
+ /* Handle local symbol. */
+ unsigned long r_symndx = ELF32_R_SYM (rel->r_info);
+ BFD_ASSERT (elf_local_ptr_offsets (input_bfd) != NULL);
+ BFD_ASSERT (elf_local_ptr_offsets (input_bfd)[r_symndx] != NULL);
+ linker_section_ptr = (elf_find_pointer_linker_section
+ (elf_local_ptr_offsets (input_bfd)[r_symndx],
+ rel->r_addend,
+ lsect));
+
+ BFD_ASSERT (linker_section_ptr != NULL);
+
+ /* Write out pointer if it hasn't been rewritten out before. */
+ if (!linker_section_ptr->written_address_p)
+ {
+ linker_section_ptr->written_address_p = TRUE;
+ bfd_put_ptr (output_bfd, relocation + linker_section_ptr->addend,
+ lsect->section->contents + linker_section_ptr->offset);
+
+ if (info->shared)
+ {
+ /* We need to generate a relative reloc for the dynamic
+ linker. */
+
+ asection *srel = lsect->rel_section;
+ Elf_Internal_Rela outrel[MAX_INT_RELS_PER_EXT_REL];
+ bfd_byte *erel;
+ const struct elf_backend_data *bed;
+ unsigned int i;
+
+ BFD_ASSERT (srel != NULL);
+
+ bed = get_elf_backend_data (output_bfd);
+ for (i = 0; i < bed->s->int_rels_per_ext_rel; i++)
+ {
+ outrel[i].r_offset = (lsect->section->output_section->vma
+ + lsect->section->output_offset
+ + linker_section_ptr->offset);
+ outrel[i].r_info = 0;
+ outrel[i].r_addend = 0;
+ }
+ outrel[0].r_info = ELF32_R_INFO (0, relative_reloc);
+ erel = lsect->section->contents;
+ erel += (elf_section_data (lsect->section)->rel_count++
+ * sizeof (Elf32_External_Rela));
+ bfd_elf32_swap_reloca_out (output_bfd, outrel, erel);
+ }
+ }
+ }
+
+ relocation = (lsect->section->output_offset
+ + linker_section_ptr->offset
+ - lsect->sym_offset);
+
+#ifdef DEBUG
+ fprintf (stderr,
+ "Finish pointer in linker section %s, offset = %ld (0x%lx)\n",
+ lsect->name, (long) relocation, (long) relocation);
+#endif
+
+ /* Subtract out the addend, because it will get added back in by the normal
+ processing. */
+ return relocation - linker_section_ptr->addend;
}
/* Create a special linker section */
static elf_linker_section_t *
-ppc_elf_create_linker_section (abfd, info, which)
- bfd *abfd;
- struct bfd_link_info *info;
- enum elf_linker_section_enum which;
+ppc_elf_create_linker_section (bfd *abfd,
+ struct bfd_link_info *info,
+ enum elf_linker_section_enum which)
{
- bfd *dynobj = elf_hash_table (info)->dynobj;
elf_linker_section_t *lsect;
+ struct ppc_elf_link_hash_table *htab = ppc_elf_hash_table (info);
+ asection *s;
+ bfd_size_type amt;
+ flagword flags;
+ const char *name;
+ const char *rel_name;
+ const char *sym_name;
+ bfd_vma sym_offset;
+
+ /* Both of these sections are (technically) created by the user
+ putting data in them, so they shouldn't be marked
+ SEC_LINKER_CREATED.
+
+ The linker creates them so it has somewhere to attach their
+ respective symbols. In fact, if they were empty it would
+ be OK to leave the symbol set to 0 (or any random number), because
+ the appropriate register should never be used. */
+ flags = SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS | SEC_IN_MEMORY;
+ sym_offset = 32768;
+
+ switch (which)
+ {
+ default:
+ abort ();
+ return NULL;
+
+ case LINKER_SECTION_SDATA: /* .sdata/.sbss section */
+ name = ".sdata";
+ rel_name = ".rela.sdata";
+ sym_name = "_SDA_BASE_";
+ break;
+
+ case LINKER_SECTION_SDATA2: /* .sdata2/.sbss2 section */
+ name = ".sdata2";
+ rel_name = ".rela.sdata2";
+ sym_name = "_SDA2_BASE_";
+ flags |= SEC_READONLY;
+ break;
+ }
- /* Record the first bfd section that needs the special section */
- if (!dynobj)
- dynobj = elf_hash_table (info)->dynobj = abfd;
+ /* Record the first bfd that needs the special sections. */
+ if (!htab->elf.dynobj)
+ htab->elf.dynobj = abfd;
- /* If this is the first time, create the section */
- lsect = elf_linker_section (dynobj, which);
- if (!lsect)
+ amt = sizeof (elf_linker_section_t);
+ lsect = bfd_zalloc (htab->elf.dynobj, amt);
+
+ lsect->sym_offset = sym_offset;
+
+ /* See if the sections already exist. */
+ s = bfd_get_section_by_name (htab->elf.dynobj, name);
+ if (s == NULL || (s->flags & flags) != flags)
{
- elf_linker_section_t defaults;
- static elf_linker_section_t zero_section;
+ 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;
- defaults = zero_section;
- defaults.which = which;
- defaults.hole_written_p = false;
- defaults.alignment = 2;
+ if (bfd_get_section_alignment (htab->elf.dynobj, s) < 2
+ && !bfd_set_section_alignment (htab->elf.dynobj, s, 2))
+ return NULL;
- /* Both of these sections are (technically) created by the user
- putting data in them, so they shouldn't be marked
- SEC_LINKER_CREATED.
+ s->_raw_size = align_power (s->_raw_size, 2);
- 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. */
- defaults.flags = (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS
- | SEC_IN_MEMORY);
+#ifdef DEBUG
+ fprintf (stderr, "Creating section %s, current size = %ld\n",
+ name, (long) s->_raw_size);
+#endif
- switch (which)
- {
- default:
- (*_bfd_error_handler) (_("%s: Unknown special linker type %d"),
- bfd_get_filename (abfd),
- (int) which);
+ if (sym_name)
+ {
+ struct elf_link_hash_entry *h;
+ struct bfd_link_hash_entry *bh;
- bfd_set_error (bfd_error_bad_value);
- return (elf_linker_section_t *) 0;
-
- case LINKER_SECTION_SDATA: /* .sdata/.sbss section */
- defaults.name = ".sdata";
- defaults.rel_name = ".rela.sdata";
- defaults.bss_name = ".sbss";
- defaults.sym_name = "_SDA_BASE_";
- defaults.sym_offset = 32768;
- break;
+#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);
- case LINKER_SECTION_SDATA2: /* .sdata2/.sbss2 section */
- defaults.name = ".sdata2";
- defaults.rel_name = ".rela.sdata2";
- defaults.bss_name = ".sbss2";
- defaults.sym_name = "_SDA2_BASE_";
- defaults.sym_offset = 32768;
- defaults.flags |= SEC_READONLY;
- break;
- }
+ 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;
- lsect = _bfd_elf_create_linker_section (abfd, info, which, &defaults);
+ h->type = STT_OBJECT;
+ lsect->sym_hash = h;
+
+ if (info->shared
+ && ! bfd_elf_link_record_dynamic_symbol (info, h))
+ return NULL;
+ }
+
+ if (info->shared)
+ {
+ s = bfd_make_section_anyway (htab->elf.dynobj, rel_name);
+ lsect->rel_section = s;
+ flags = (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS | SEC_IN_MEMORY
+ | SEC_LINKER_CREATED | SEC_READONLY);
+ if (s == NULL
+ || ! bfd_set_section_flags (htab->elf.dynobj, s, flags)
+ || ! bfd_set_section_alignment (htab->elf.dynobj, s, 2))
+ return NULL;
}
return lsect;
@@ -1624,8 +2708,7 @@ ppc_elf_create_linker_section (abfd, info, which)
need to bump up the number of section headers. */
static int
-ppc_elf_additional_program_headers (abfd)
- bfd *abfd;
+ppc_elf_additional_program_headers (bfd *abfd)
{
asection *s;
int ret;
@@ -1649,73 +2732,88 @@ ppc_elf_additional_program_headers (abfd)
/* Modify the segment map if needed. */
-static boolean
-ppc_elf_modify_segment_map (abfd)
- bfd *abfd ATTRIBUTE_UNUSED;
+static bfd_boolean
+ppc_elf_modify_segment_map (bfd *abfd ATTRIBUTE_UNUSED,
+ struct bfd_link_info *info ATTRIBUTE_UNUSED)
{
- return true;
+ return TRUE;
}
/* The powerpc .got has a blrl instruction in it. Mark it executable. */
-static asection *
-ppc_elf_create_got (abfd, info)
- bfd *abfd;
- struct bfd_link_info *info;
+static bfd_boolean
+ppc_elf_create_got (bfd *abfd, struct bfd_link_info *info)
{
- register asection *s;
+ struct ppc_elf_link_hash_table *htab;
+ asection *s;
flagword flags;
if (!_bfd_elf_create_got_section (abfd, info))
- return NULL;
+ return FALSE;
- s = bfd_get_section_by_name (abfd, ".got");
+ htab = ppc_elf_hash_table (info);
+ htab->got = s = bfd_get_section_by_name (abfd, ".got");
if (s == NULL)
abort ();
flags = (SEC_ALLOC | SEC_LOAD | SEC_CODE | SEC_HAS_CONTENTS | SEC_IN_MEMORY
| SEC_LINKER_CREATED);
if (!bfd_set_section_flags (abfd, s, flags))
- return NULL;
- return s;
+ return FALSE;
+
+ htab->relgot = bfd_make_section (abfd, ".rela.got");
+ if (!htab->relgot
+ || ! bfd_set_section_flags (abfd, htab->relgot,
+ (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS
+ | SEC_IN_MEMORY | SEC_LINKER_CREATED
+ | SEC_READONLY))
+ || ! bfd_set_section_alignment (abfd, htab->relgot, 2))
+ return FALSE;
+
+ return TRUE;
}
/* We have to create .dynsbss and .rela.sbss here so that they get mapped
to output sections (just like _bfd_elf_create_dynamic_sections has
to create .dynbss and .rela.bss). */
-static boolean
-ppc_elf_create_dynamic_sections (abfd, info)
- bfd *abfd;
- struct bfd_link_info *info;
+static bfd_boolean
+ppc_elf_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info)
{
- register asection *s;
+ struct ppc_elf_link_hash_table *htab;
+ asection *s;
flagword flags;
- if (!ppc_elf_create_got (abfd, info))
- return false;
+ htab = ppc_elf_hash_table (info);
+
+ if (htab->got == NULL
+ && !ppc_elf_create_got (abfd, info))
+ return FALSE;
if (!_bfd_elf_create_dynamic_sections (abfd, info))
- return false;
+ return FALSE;
flags = (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS | SEC_IN_MEMORY
| SEC_LINKER_CREATED);
- s = bfd_make_section (abfd, ".dynsbss");
+ htab->dynbss = bfd_get_section_by_name (abfd, ".dynbss");
+ htab->dynsbss = s = bfd_make_section (abfd, ".dynsbss");
if (s == NULL
|| ! bfd_set_section_flags (abfd, s, SEC_ALLOC))
- return false;
+ return FALSE;
if (! info->shared)
{
- s = bfd_make_section (abfd, ".rela.sbss");
+ htab->relbss = bfd_get_section_by_name (abfd, ".rela.bss");
+ htab->relsbss = s = bfd_make_section (abfd, ".rela.sbss");
if (s == NULL
|| ! bfd_set_section_flags (abfd, s, flags | SEC_READONLY)
|| ! bfd_set_section_alignment (abfd, s, 2))
- return false;
+ return FALSE;
}
- s = bfd_get_section_by_name (abfd, ".plt");
+ htab->relplt = bfd_get_section_by_name (abfd, ".rela.plt");
+ htab->plt = s = bfd_get_section_by_name (abfd, ".plt");
if (s == NULL)
abort ();
@@ -1729,22 +2827,22 @@ ppc_elf_create_dynamic_sections (abfd, info)
change the definition to something the rest of the link can
understand. */
-static boolean
-ppc_elf_adjust_dynamic_symbol (info, h)
- struct bfd_link_info *info;
- struct elf_link_hash_entry *h;
+static bfd_boolean
+ppc_elf_adjust_dynamic_symbol (struct bfd_link_info *info,
+ struct elf_link_hash_entry *h)
{
- bfd *dynobj = elf_hash_table (info)->dynobj;
+ struct ppc_elf_link_hash_table *htab;
asection *s;
unsigned int power_of_two;
- bfd_vma plt_offset;
#ifdef DEBUG
- fprintf (stderr, "ppc_elf_adjust_dynamic_symbol called for %s\n", h->root.root.string);
+ 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. */
- BFD_ASSERT (dynobj != NULL
+ 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
@@ -1754,86 +2852,31 @@ ppc_elf_adjust_dynamic_symbol (info, h)
&& (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. */
+ /* Deal with function syms. */
if (h->type == STT_FUNC
|| (h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT) != 0)
{
- if (! elf_hash_table (info)->dynamic_sections_created
- || SYMBOL_CALLS_LOCAL (info, h)
- || (info->shared && h->plt.refcount <= 0))
+ /* Clear procedure linkage table information for any symbol that
+ won't need a .plt entry. */
+ if (h->plt.refcount <= 0
+ || SYMBOL_CALLS_LOCAL (info, h)
+ || (ELF_ST_VISIBILITY (h->other) != STV_DEFAULT
+ && h->root.type == bfd_link_hash_undefweak))
{
/* A PLT entry is not required/allowed when:
1. We are not using ld.so; because then the PLT entry
- can't be set up, so we can't use one.
+ 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. We know for certain that a call to this symbol
- will go to this object.
+ 2. GC has rendered the entry unused.
- 3. GC has rendered the entry unused.
- Note, however, that in an executable all references to the
- symbol go to the PLT, so we can't turn it off in that case.
- ??? The correct thing to do here is to reference count
- all uses of the symbol, not just those to the GOT or PLT. */
+ 3. We know for certain that a call to this symbol
+ will go to this object, or will remain undefined. */
h->plt.offset = (bfd_vma) -1;
h->elf_link_hash_flags &= ~ELF_LINK_HASH_NEEDS_PLT;
- return true;
- }
-
- /* Make sure this symbol is output as a dynamic symbol. */
- if (h->dynindx == -1)
- {
- if (! bfd_elf32_link_record_dynamic_symbol (info, h))
- return false;
- }
- BFD_ASSERT (h->dynindx != -1);
-
- s = bfd_get_section_by_name (dynobj, ".plt");
- BFD_ASSERT (s != NULL);
-
- /* 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. */
- 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 = plt_offset;
}
-
- h->plt.offset = plt_offset;
-
- /* Make room for this entry. After the 8192nd entry, room
- for two entries is allocated. */
- if ((s->_raw_size - PLT_INITIAL_ENTRY_SIZE) / PLT_ENTRY_SIZE
- >= PLT_NUM_SINGLE_ENTRIES)
- s->_raw_size += 2 * PLT_ENTRY_SIZE;
- else
- 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 (Elf32_External_Rela);
-
- return true;
+ return TRUE;
}
else
h->plt.offset = (bfd_vma) -1;
@@ -1847,7 +2890,11 @@ ppc_elf_adjust_dynamic_symbol (info, h)
|| h->weakdef->root.type == bfd_link_hash_defweak);
h->root.u.def.section = h->weakdef->root.u.def.section;
h->root.u.def.value = h->weakdef->root.u.def.value;
- return true;
+ if (ELIMINATE_COPY_RELOCS)
+ h->elf_link_hash_flags
+ = ((h->elf_link_hash_flags & ~ELF_LINK_NON_GOT_REF)
+ | (h->weakdef->elf_link_hash_flags & ELF_LINK_NON_GOT_REF));
+ return TRUE;
}
/* This is a reference to a symbol defined by a dynamic object which
@@ -1858,7 +2905,31 @@ ppc_elf_adjust_dynamic_symbol (info, h)
For such cases we need not do anything here; the relocations will
be handled correctly by relocate_section. */
if (info->shared)
- return true;
+ return TRUE;
+
+ /* If there are no references to this symbol that do not use the
+ GOT, we don't need to generate a copy reloc. */
+ if ((h->elf_link_hash_flags & ELF_LINK_NON_GOT_REF) == 0)
+ return TRUE;
+
+ if (ELIMINATE_COPY_RELOCS)
+ {
+ struct ppc_elf_dyn_relocs *p;
+ for (p = ppc_elf_hash_entry (h)->dyn_relocs; p != NULL; p = p->next)
+ {
+ s = p->sec->output_section;
+ if (s != NULL && (s->flags & SEC_READONLY) != 0)
+ break;
+ }
+
+ /* If we didn't find any dynamic relocs in read-only sections, then
+ we'll be keeping the dynamic relocs and avoiding the copy reloc. */
+ if (p == NULL)
+ {
+ h->elf_link_hash_flags &= ~ELF_LINK_NON_GOT_REF;
+ return TRUE;
+ }
+ }
/* We must allocate the symbol in our .dynbss section, which will
become part of the .bss section of the executable. There will be
@@ -1874,10 +2945,10 @@ ppc_elf_adjust_dynamic_symbol (info, h)
allocate it in .sbss. FIXME: It would be better to do this if and
only if there were actually SDAREL relocs for that symbol. */
- if (h->size <= elf_gp_size (dynobj))
- s = bfd_get_section_by_name (dynobj, ".dynsbss");
+ if (h->size <= elf_gp_size (htab->elf.dynobj))
+ s = htab->dynsbss;
else
- s = bfd_get_section_by_name (dynobj, ".dynbss");
+ s = htab->dynbss;
BFD_ASSERT (s != NULL);
/* We must generate a R_PPC_COPY reloc to tell the dynamic linker to
@@ -1888,10 +2959,10 @@ ppc_elf_adjust_dynamic_symbol (info, h)
{
asection *srel;
- if (h->size <= elf_gp_size (dynobj))
- srel = bfd_get_section_by_name (dynobj, ".rela.sbss");
+ if (h->size <= elf_gp_size (htab->elf.dynobj))
+ srel = htab->relsbss;
else
- srel = bfd_get_section_by_name (dynobj, ".rela.bss");
+ srel = htab->relbss;
BFD_ASSERT (srel != NULL);
srel->_raw_size += sizeof (Elf32_External_Rela);
h->elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_COPY;
@@ -1906,10 +2977,10 @@ ppc_elf_adjust_dynamic_symbol (info, h)
/* 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 (power_of_two > bfd_get_section_alignment (htab->elf.dynobj, s))
{
- if (! bfd_set_section_alignment (dynobj, s, power_of_two))
- return false;
+ 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. */
@@ -1919,93 +2990,426 @@ ppc_elf_adjust_dynamic_symbol (info, h)
/* Increment the section size to make room for the symbol. */
s->_raw_size += h->size;
- return true;
+ return TRUE;
}
+/* Of those relocs that might be copied as dynamic relocs, this macro
+ selects those that must be copied when linking a shared library,
+ even when the symbol is local. */
+
+#define MUST_BE_DYN_RELOC(RTYPE) \
+ ((RTYPE) != R_PPC_REL24 \
+ && (RTYPE) != R_PPC_REL14 \
+ && (RTYPE) != R_PPC_REL14_BRTAKEN \
+ && (RTYPE) != R_PPC_REL14_BRNTAKEN \
+ && (RTYPE) != R_PPC_REL32)
+
+/* Allocate space in associated reloc sections for dynamic relocs. */
+
+static bfd_boolean
+allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf)
+{
+ struct bfd_link_info *info = inf;
+ struct ppc_elf_link_hash_entry *eh;
+ struct ppc_elf_link_hash_table *htab;
+ struct ppc_elf_dyn_relocs *p;
+
+ if (h->root.type == bfd_link_hash_indirect)
+ return TRUE;
+
+ if (h->root.type == bfd_link_hash_warning)
+ /* When warning symbols are created, they **replace** the "real"
+ entry in the hash table, thus we never get to see the real
+ symbol in a hash traversal. So look at it now. */
+ h = (struct elf_link_hash_entry *) h->root.u.i.link;
+
+ htab = ppc_elf_hash_table (info);
+ if (htab->elf.dynamic_sections_created
+ && h->plt.refcount > 0)
+ {
+ /* Make sure this symbol is output as a dynamic symbol. */
+ if (h->dynindx == -1
+ && (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0)
+ {
+ if (! bfd_elf_link_record_dynamic_symbol (info, h))
+ return FALSE;
+ }
+
+ if (info->shared
+ || WILL_CALL_FINISH_DYNAMIC_SYMBOL (1, 0, h))
+ {
+ asection *s = htab->plt;
+
+ /* If this is the first .plt entry, make room for the special
+ first entry. */
+ if (s->_raw_size == 0)
+ s->_raw_size += PLT_INITIAL_ENTRY_SIZE;
+
+ /* The PowerPC PLT is actually composed of two parts, the
+ first part is 2 words (for a load and a jump), and then
+ there is a remaining word available at the end. */
+ h->plt.offset = (PLT_INITIAL_ENTRY_SIZE
+ + (PLT_SLOT_SIZE
+ * ((s->_raw_size - PLT_INITIAL_ENTRY_SIZE)
+ / PLT_ENTRY_SIZE)));
+
+ /* If this symbol is not defined in a regular file, and we
+ are not generating a shared library, then set the symbol
+ to this location in the .plt. This is required to make
+ function pointers compare as equal between the normal
+ executable and the shared library. */
+ if (! info->shared
+ && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0)
+ {
+ h->root.u.def.section = s;
+ h->root.u.def.value = h->plt.offset;
+ }
+
+ /* Make room for this entry. After the 8192nd entry, room
+ for two entries is allocated. */
+ s->_raw_size += PLT_ENTRY_SIZE;
+ if ((s->_raw_size - PLT_INITIAL_ENTRY_SIZE) / PLT_ENTRY_SIZE
+ > PLT_NUM_SINGLE_ENTRIES)
+ s->_raw_size += PLT_ENTRY_SIZE;
+
+ /* We also need to make an entry in the .rela.plt section. */
+ htab->relplt->_raw_size += sizeof (Elf32_External_Rela);
+ }
+ else
+ {
+ h->plt.offset = (bfd_vma) -1;
+ h->elf_link_hash_flags &= ~ELF_LINK_HASH_NEEDS_PLT;
+ }
+ }
+ else
+ {
+ h->plt.offset = (bfd_vma) -1;
+ h->elf_link_hash_flags &= ~ELF_LINK_HASH_NEEDS_PLT;
+ }
+
+ eh = (struct ppc_elf_link_hash_entry *) h;
+ if (eh->elf.got.refcount > 0)
+ {
+ /* Make sure this symbol is output as a dynamic symbol. */
+ if (eh->elf.dynindx == -1
+ && (eh->elf.elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0)
+ {
+ if (!bfd_elf_link_record_dynamic_symbol (info, &eh->elf))
+ return FALSE;
+ }
+
+ if (eh->tls_mask == (TLS_TLS | TLS_LD)
+ && !(eh->elf.elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC))
+ /* If just an LD reloc, we'll just use htab->tlsld_got.offset. */
+ eh->elf.got.offset = (bfd_vma) -1;
+ else
+ {
+ bfd_boolean dyn;
+ eh->elf.got.offset = htab->got->_raw_size;
+ if ((eh->tls_mask & TLS_TLS) != 0)
+ {
+ if ((eh->tls_mask & TLS_LD) != 0)
+ htab->got->_raw_size += 8;
+ if ((eh->tls_mask & TLS_GD) != 0)
+ htab->got->_raw_size += 8;
+ if ((eh->tls_mask & (TLS_TPREL | TLS_TPRELGD)) != 0)
+ htab->got->_raw_size += 4;
+ if ((eh->tls_mask & TLS_DTPREL) != 0)
+ htab->got->_raw_size += 4;
+ }
+ else
+ htab->got->_raw_size += 4;
+ dyn = htab->elf.dynamic_sections_created;
+ if ((info->shared
+ || WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, 0, &eh->elf))
+ && (ELF_ST_VISIBILITY (eh->elf.other) == STV_DEFAULT
+ || eh->elf.root.type != bfd_link_hash_undefweak))
+ {
+ /* All the entries we allocated need relocs. */
+ htab->relgot->_raw_size
+ += ((htab->got->_raw_size - eh->elf.got.offset) / 4
+ * sizeof (Elf32_External_Rela));
+ /* Except LD only needs one. */
+ if ((eh->tls_mask & TLS_LD) != 0)
+ htab->relgot->_raw_size -= sizeof (Elf32_External_Rela);
+ }
+ }
+ }
+ else
+ eh->elf.got.offset = (bfd_vma) -1;
+
+ if (eh->dyn_relocs == NULL)
+ return TRUE;
+
+ /* In the shared -Bsymbolic case, discard space allocated for
+ dynamic pc-relative relocs against symbols which turn out to be
+ defined in regular objects. For the normal shared case, discard
+ space for relocs that have become local due to symbol visibility
+ changes. */
+
+ if (info->shared)
+ {
+ /* Relocs that use pc_count are those that appear on a call insn,
+ or certain REL relocs (see MUST_BE_DYN_RELOC) that can be
+ generated via assembly. We want calls to protected symbols to
+ resolve directly to the function rather than going via the plt.
+ If people want function pointer comparisons to work as expected
+ then they should avoid writing weird assembly. */
+ if (SYMBOL_CALLS_LOCAL (info, h))
+ {
+ struct ppc_elf_dyn_relocs **pp;
+
+ for (pp = &eh->dyn_relocs; (p = *pp) != NULL; )
+ {
+ p->count -= p->pc_count;
+ p->pc_count = 0;
+ if (p->count == 0)
+ *pp = p->next;
+ else
+ pp = &p->next;
+ }
+ }
+
+ /* Also discard relocs on undefined weak syms with non-default
+ visibility. */
+ if (ELF_ST_VISIBILITY (h->other) != STV_DEFAULT
+ && h->root.type == bfd_link_hash_undefweak)
+ eh->dyn_relocs = NULL;
+
+ /* Make sure undefined weak symbols are output as a dynamic symbol
+ in PIEs. */
+ if (info->pie
+ && eh->dyn_relocs != NULL
+ && h->dynindx == -1
+ && h->root.type == bfd_link_hash_undefweak
+ && (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0)
+ {
+ if (! bfd_elf_link_record_dynamic_symbol (info, h))
+ return FALSE;
+ }
+ }
+ else if (ELIMINATE_COPY_RELOCS)
+ {
+ /* For the non-shared case, discard space for relocs against
+ symbols which turn out to need copy relocs or are not
+ dynamic. */
+
+ if ((h->elf_link_hash_flags & ELF_LINK_NON_GOT_REF) == 0
+ && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) != 0
+ && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0)
+ {
+ /* Make sure this symbol is output as a dynamic symbol.
+ Undefined weak syms won't yet be marked as dynamic. */
+ if (h->dynindx == -1
+ && (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0)
+ {
+ if (! bfd_elf_link_record_dynamic_symbol (info, h))
+ return FALSE;
+ }
+
+ /* If that succeeded, we know we'll be keeping all the
+ relocs. */
+ if (h->dynindx != -1)
+ goto keep;
+ }
+
+ eh->dyn_relocs = NULL;
+
+ keep: ;
+ }
+
+ /* Finally, allocate space. */
+ for (p = eh->dyn_relocs; p != NULL; p = p->next)
+ {
+ asection *sreloc = elf_section_data (p->sec)->sreloc;
+ sreloc->_raw_size += p->count * sizeof (Elf32_External_Rela);
+ }
+
+ return TRUE;
+}
+
+/* Find any dynamic relocs that apply to read-only sections. */
+
+static bfd_boolean
+readonly_dynrelocs (struct elf_link_hash_entry *h, void *info)
+{
+ struct ppc_elf_dyn_relocs *p;
+
+ if (h->root.type == bfd_link_hash_indirect)
+ return TRUE;
+
+ if (h->root.type == bfd_link_hash_warning)
+ h = (struct elf_link_hash_entry *) h->root.u.i.link;
+
+ for (p = ppc_elf_hash_entry (h)->dyn_relocs; p != NULL; p = p->next)
+ {
+ asection *s = p->sec->output_section;
+
+ if (s != NULL
+ && ((s->flags & (SEC_READONLY | SEC_ALLOC))
+ == (SEC_READONLY | SEC_ALLOC)))
+ {
+ ((struct bfd_link_info *) info)->flags |= DF_TEXTREL;
+
+ /* Not an error, just cut short the traversal. */
+ return FALSE;
+ }
+ }
+ return TRUE;
+}
+
/* Set the sizes of the dynamic sections. */
-static boolean
-ppc_elf_size_dynamic_sections (output_bfd, info)
- bfd *output_bfd ATTRIBUTE_UNUSED;
- struct bfd_link_info *info;
+static bfd_boolean
+ppc_elf_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
+ struct bfd_link_info *info)
{
- bfd *dynobj;
+ struct ppc_elf_link_hash_table *htab;
asection *s;
- boolean plt;
- boolean relocs;
+ bfd_boolean relocs;
+ bfd *ibfd;
#ifdef DEBUG
fprintf (stderr, "ppc_elf_size_dynamic_sections called\n");
#endif
- dynobj = elf_hash_table (info)->dynobj;
- BFD_ASSERT (dynobj != NULL);
+ htab = ppc_elf_hash_table (info);
+ BFD_ASSERT (htab->elf.dynobj != NULL);
if (elf_hash_table (info)->dynamic_sections_created)
{
/* Set the contents of the .interp section to the interpreter. */
- if (! info->shared)
+ if (info->executable)
{
- s = bfd_get_section_by_name (dynobj, ".interp");
+ s = bfd_get_section_by_name (htab->elf.dynobj, ".interp");
BFD_ASSERT (s != NULL);
s->_raw_size = sizeof ELF_DYNAMIC_INTERPRETER;
s->contents = (unsigned char *) ELF_DYNAMIC_INTERPRETER;
}
}
+
+ if (htab->tlsld_got.refcount > 0)
+ {
+ htab->tlsld_got.offset = htab->got->_raw_size;
+ htab->got->_raw_size += 8;
+ if (info->shared)
+ htab->relgot->_raw_size += sizeof (Elf32_External_Rela);
+ }
else
+ htab->tlsld_got.offset = (bfd_vma) -1;
+
+ /* Set up .got offsets for local syms, and space for local dynamic
+ relocs. */
+ for (ibfd = info->input_bfds; ibfd != NULL; ibfd = ibfd->link_next)
{
- /* We may have created entries in the .rela.got, .rela.sdata, and
- .rela.sdata2 sections. However, if we are not creating the
- dynamic sections, we will not actually use these entries. Reset
- the size of .rela.got, et al, which will cause it to get
- stripped from the output file below. */
- static char *rela_sections[] = { ".rela.got", ".rela.sdata",
- ".rela.sdata2", ".rela.sbss",
- (char *) 0 };
- char **p;
+ bfd_signed_vma *local_got;
+ bfd_signed_vma *end_local_got;
+ char *lgot_masks;
+ bfd_size_type locsymcount;
+ Elf_Internal_Shdr *symtab_hdr;
+ asection *srel;
+
+ if (bfd_get_flavour (ibfd) != bfd_target_elf_flavour)
+ continue;
- for (p = rela_sections; *p != (char *) 0; p++)
+ for (s = ibfd->sections; s != NULL; s = s->next)
{
- s = bfd_get_section_by_name (dynobj, *p);
- if (s != NULL)
- s->_raw_size = 0;
+ 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;
}
- /* 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;
- boolean strip;
+ /* Allocate space for global sym dynamic relocs. */
+ elf_link_hash_traverse (elf_hash_table (info), allocate_dynrelocs, info);
+ /* We've now determined the sizes of the various dynamic sections.
+ Allocate memory for them. */
+ relocs = FALSE;
+ for (s = htab->elf.dynobj->sections; s != NULL; s = s->next)
+ {
if ((s->flags & SEC_LINKER_CREATED) == 0)
continue;
- /* It's OK to base decisions on the section name, because none
- of the dynobj section names depend upon the input files. */
- name = bfd_get_section_name (dynobj, s);
-
- strip = false;
-
- if (strcmp (name, ".plt") == 0)
+ if (s == htab->plt
+ || s == htab->got
+ || (htab->sdata != NULL && s == htab->sdata->section)
+ || (htab->sdata2 != NULL && s == htab->sdata2->section))
{
- if (s->_raw_size == 0)
- {
- /* Strip this section if we don't need it; see the
- comment below. */
- strip = true;
- }
- else
- {
- /* Remember whether there is a PLT. */
- plt = true;
- }
+ /* Strip this section if we don't need it; see the
+ comment below. */
}
- else if (strncmp (name, ".rela", 5) == 0)
+ else if (strncmp (bfd_get_section_name (dynobj, s), ".rela", 5) == 0)
{
if (s->_raw_size == 0)
{
@@ -2018,39 +3422,36 @@ ppc_elf_size_dynamic_sections (output_bfd, info)
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 relocation sections. */
- relocs = true;
+ relocs = TRUE;
/* We use the reloc_count field as a counter if we need
to copy relocs into the output file. */
s->reloc_count = 0;
}
}
- else if (strcmp (name, ".got") != 0
- && strcmp (name, ".sdata") != 0
- && strcmp (name, ".sdata2") != 0)
+ else
{
/* It's not one of our sections, so don't allocate space. */
continue;
}
- if (strip)
+ if (s->_raw_size == 0)
{
_bfd_strip_section_from_output (info, s);
continue;
}
/* 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;
+ s->contents = bfd_zalloc (htab->elf.dynobj, s->_raw_size);
+ if (s->contents == NULL)
+ return FALSE;
}
- if (elf_hash_table (info)->dynamic_sections_created)
+ 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
@@ -2058,21 +3459,21 @@ ppc_elf_size_dynamic_sections (output_bfd, info)
the .dynamic section. The DT_DEBUG entry is filled in by the
dynamic linker and used by the debugger. */
#define add_dynamic_entry(TAG, VAL) \
- bfd_elf32_add_dynamic_entry (info, (bfd_vma) (TAG), (bfd_vma) (VAL))
+ _bfd_elf_add_dynamic_entry (info, TAG, VAL)
- if (!info->shared)
+ if (info->executable)
{
if (!add_dynamic_entry (DT_DEBUG, 0))
- return false;
+ return FALSE;
}
- if (plt)
+ 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;
+ return FALSE;
}
if (relocs)
@@ -2080,46 +3481,81 @@ ppc_elf_size_dynamic_sections (output_bfd, info)
if (!add_dynamic_entry (DT_RELA, 0)
|| !add_dynamic_entry (DT_RELASZ, 0)
|| !add_dynamic_entry (DT_RELAENT, sizeof (Elf32_External_Rela)))
- return false;
+ 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;
- info->flags |= DF_TEXTREL;
+ return FALSE;
}
}
#undef add_dynamic_entry
- return true;
+ return TRUE;
}
+static bfd_boolean
+update_local_sym_info (bfd *abfd,
+ Elf_Internal_Shdr *symtab_hdr,
+ unsigned long r_symndx,
+ int tls_type)
+{
+ bfd_signed_vma *local_got_refcounts = elf_local_got_refcounts (abfd);
+ char *local_got_tls_masks;
+
+ if (local_got_refcounts == NULL)
+ {
+ bfd_size_type size = symtab_hdr->sh_info;
+
+ size *= sizeof (*local_got_refcounts) + sizeof (*local_got_tls_masks);
+ local_got_refcounts = bfd_zalloc (abfd, size);
+ if (local_got_refcounts == NULL)
+ return FALSE;
+ elf_local_got_refcounts (abfd) = local_got_refcounts;
+ }
+
+ local_got_refcounts[r_symndx] += 1;
+ local_got_tls_masks = (char *) (local_got_refcounts + symtab_hdr->sh_info);
+ local_got_tls_masks[r_symndx] |= tls_type;
+ return TRUE;
+}
+
+static void
+bad_shared_reloc (bfd *abfd, enum elf_ppc_reloc_type r_type)
+{
+ (*_bfd_error_handler)
+ (_("%s: relocation %s cannot be used when making a shared object"),
+ bfd_archive_filename (abfd),
+ ppc_elf_howto_table[r_type]->name);
+ bfd_set_error (bfd_error_bad_value);
+}
+
/* Look through the relocs for a section during the first phase, and
allocate space in the global offset table or procedure linkage
table. */
-static boolean
-ppc_elf_check_relocs (abfd, info, sec, relocs)
- bfd *abfd;
- struct bfd_link_info *info;
- asection *sec;
- const Elf_Internal_Rela *relocs;
+static bfd_boolean
+ppc_elf_check_relocs (bfd *abfd,
+ struct bfd_link_info *info,
+ asection *sec,
+ const Elf_Internal_Rela *relocs)
{
- bfd *dynobj;
+ struct ppc_elf_link_hash_table *htab;
Elf_Internal_Shdr *symtab_hdr;
- struct elf_link_hash_entry **sym_hashes, **sym_hashes_end;
+ struct elf_link_hash_entry **sym_hashes;
const Elf_Internal_Rela *rel;
const Elf_Internal_Rela *rel_end;
- bfd_signed_vma *local_got_refcounts;
- elf_linker_section_t *sdata;
- elf_linker_section_t *sdata2;
asection *sreloc;
- asection *sgot = NULL;
- asection *srelgot = NULL;
- if (info->relocateable)
- return true;
+ if (info->relocatable)
+ return TRUE;
#ifdef DEBUG
fprintf (stderr, "ppc_elf_check_relocs called for section %s in %s\n",
@@ -2127,39 +3563,40 @@ ppc_elf_check_relocs (abfd, info, sec, relocs)
bfd_archive_filename (abfd));
#endif
+ /* Initialize howto table if not already done. */
+ if (!ppc_elf_howto_table[R_PPC_ADDR32])
+ ppc_elf_howto_init ();
+
/* Create the linker generated sections all the time so that the
special symbols are created. */
-
- if ((sdata = elf_linker_section (abfd, LINKER_SECTION_SDATA)) == NULL)
+ htab = ppc_elf_hash_table (info);
+ if (htab->sdata == NULL)
{
- sdata = ppc_elf_create_linker_section (abfd, info, LINKER_SECTION_SDATA);
- if (!sdata)
- return false;
+ htab->sdata = ppc_elf_create_linker_section (abfd, info,
+ LINKER_SECTION_SDATA);
+ if (htab->sdata == NULL)
+ return FALSE;
}
- if ((sdata2 = elf_linker_section (abfd, LINKER_SECTION_SDATA2)) == NULL)
+ if (htab->sdata2 == NULL)
{
- sdata2 = ppc_elf_create_linker_section (abfd, info, LINKER_SECTION_SDATA2);
- if (!sdata2)
- return false;
+ htab->sdata2 = ppc_elf_create_linker_section (abfd, info,
+ LINKER_SECTION_SDATA2);
+ if (htab->sdata2 == NULL)
+ return FALSE;
}
- dynobj = elf_hash_table (info)->dynobj;
symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
- local_got_refcounts = elf_local_got_refcounts (abfd);
-
sym_hashes = elf_sym_hashes (abfd);
- sym_hashes_end = sym_hashes + symtab_hdr->sh_size/sizeof (Elf32_External_Sym);
- if (!elf_bad_symtab (abfd))
- sym_hashes_end -= symtab_hdr->sh_info;
-
sreloc = NULL;
rel_end = relocs + sec->reloc_count;
for (rel = relocs; rel < rel_end; rel++)
{
unsigned long r_symndx;
+ enum elf_ppc_reloc_type r_type;
struct elf_link_hash_entry *h;
+ int tls_type = 0;
r_symndx = ELF32_R_SYM (rel->r_info);
if (r_symndx < symtab_hdr->sh_info)
@@ -2172,182 +3609,118 @@ ppc_elf_check_relocs (abfd, info, sec, relocs)
startup code. */
if (h && strcmp (h->root.root.string, "_GLOBAL_OFFSET_TABLE_") == 0)
{
- if (sgot == NULL)
+ if (htab->got == NULL)
{
- if (dynobj == NULL)
- elf_hash_table (info)->dynobj = dynobj = abfd;
- sgot = ppc_elf_create_got (dynobj, info);
- if (sgot == NULL)
- return false;
+ if (htab->elf.dynobj == NULL)
+ htab->elf.dynobj = abfd;
+ if (!ppc_elf_create_got (htab->elf.dynobj, info))
+ return FALSE;
}
}
- switch (ELF32_R_TYPE (rel->r_info))
+ r_type = ELF32_R_TYPE (rel->r_info);
+ switch (r_type)
{
- /* GOT16 relocations */
+ case R_PPC_GOT_TLSLD16:
+ case R_PPC_GOT_TLSLD16_LO:
+ case R_PPC_GOT_TLSLD16_HI:
+ case R_PPC_GOT_TLSLD16_HA:
+ htab->tlsld_got.refcount += 1;
+ tls_type = TLS_TLS | TLS_LD;
+ goto dogottls;
+
+ case R_PPC_GOT_TLSGD16:
+ case R_PPC_GOT_TLSGD16_LO:
+ case R_PPC_GOT_TLSGD16_HI:
+ case R_PPC_GOT_TLSGD16_HA:
+ tls_type = TLS_TLS | TLS_GD;
+ goto dogottls;
+
+ case R_PPC_GOT_TPREL16:
+ case R_PPC_GOT_TPREL16_LO:
+ case R_PPC_GOT_TPREL16_HI:
+ case R_PPC_GOT_TPREL16_HA:
+ if (info->shared)
+ info->flags |= DF_STATIC_TLS;
+ tls_type = TLS_TLS | TLS_TPREL;
+ goto dogottls;
+
+ case R_PPC_GOT_DTPREL16:
+ case R_PPC_GOT_DTPREL16_LO:
+ case R_PPC_GOT_DTPREL16_HI:
+ case R_PPC_GOT_DTPREL16_HA:
+ tls_type = TLS_TLS | TLS_DTPREL;
+ dogottls:
+ sec->has_tls_reloc = 1;
+ /* Fall thru */
+
+ /* GOT16 relocations */
case R_PPC_GOT16:
case R_PPC_GOT16_LO:
case R_PPC_GOT16_HI:
case R_PPC_GOT16_HA:
/* This symbol requires a global offset table entry. */
-
- if (sgot == NULL)
- {
- if (dynobj == NULL)
- elf_hash_table (info)->dynobj = dynobj = abfd;
- sgot = ppc_elf_create_got (dynobj, info);
- if (sgot == NULL)
- return false;
- }
-
- if (srelgot == NULL
- && (h != NULL || info->shared))
+ if (htab->got == NULL)
{
- srelgot = bfd_get_section_by_name (dynobj, ".rela.got");
- if (srelgot == NULL)
- {
- srelgot = bfd_make_section (dynobj, ".rela.got");
- if (srelgot == NULL
- || ! bfd_set_section_flags (dynobj, srelgot,
- (SEC_ALLOC
- | SEC_LOAD
- | SEC_HAS_CONTENTS
- | SEC_IN_MEMORY
- | SEC_LINKER_CREATED
- | SEC_READONLY))
- || ! bfd_set_section_alignment (dynobj, srelgot, 2))
- return false;
- }
+ if (htab->elf.dynobj == NULL)
+ htab->elf.dynobj = abfd;
+ if (!ppc_elf_create_got (htab->elf.dynobj, info))
+ return FALSE;
}
-
if (h != NULL)
{
- if (h->got.refcount == 0)
- {
- /* Make sure this symbol is output as a dynamic symbol. */
- if (h->dynindx == -1)
- if (!bfd_elf32_link_record_dynamic_symbol (info, h))
- return false;
-
- /* Allocate space in the .got. */
- sgot->_raw_size += 4;
- /* Allocate relocation space. */
- srelgot->_raw_size += sizeof (Elf32_External_Rela);
- }
- h->got.refcount++;
+ h->got.refcount += 1;
+ ppc_elf_hash_entry (h)->tls_mask |= tls_type;
}
else
- {
- /* This is a global offset table entry for a local symbol. */
- if (local_got_refcounts == NULL)
- {
- bfd_size_type size;
-
- size = symtab_hdr->sh_info;
- size *= sizeof (bfd_signed_vma);
- local_got_refcounts
- = (bfd_signed_vma *) bfd_zalloc (abfd, size);
- if (local_got_refcounts == NULL)
- return false;
- elf_local_got_refcounts (abfd) = local_got_refcounts;
- }
- if (local_got_refcounts[r_symndx] == 0)
- {
- sgot->_raw_size += 4;
-
- /* If we are generating a shared object, we need to
- output a R_PPC_RELATIVE reloc so that the
- dynamic linker can adjust this GOT entry. */
- if (info->shared)
- srelgot->_raw_size += sizeof (Elf32_External_Rela);
- }
- local_got_refcounts[r_symndx]++;
- }
+ /* This is a global offset table entry for a local symbol. */
+ if (!update_local_sym_info (abfd, symtab_hdr, r_symndx, tls_type))
+ return FALSE;
break;
- /* Indirect .sdata relocation */
+ /* Indirect .sdata relocation. */
case R_PPC_EMB_SDAI16:
if (info->shared)
{
- ((*_bfd_error_handler)
- (_("%s: relocation %s cannot be used when making a shared object"),
- bfd_archive_filename (abfd), "R_PPC_EMB_SDAI16"));
- return false;
- }
-
- if (srelgot == NULL && (h != NULL || info->shared))
- {
- srelgot = bfd_get_section_by_name (dynobj, ".rela.got");
- if (srelgot == NULL)
- {
- srelgot = bfd_make_section (dynobj, ".rela.got");
- if (srelgot == NULL
- || ! bfd_set_section_flags (dynobj, srelgot,
- (SEC_ALLOC
- | SEC_LOAD
- | SEC_HAS_CONTENTS
- | SEC_IN_MEMORY
- | SEC_LINKER_CREATED
- | SEC_READONLY))
- || ! bfd_set_section_alignment (dynobj, srelgot, 2))
- return false;
- }
+ bad_shared_reloc (abfd, r_type);
+ return FALSE;
}
-
- if (!bfd_elf32_create_pointer_linker_section (abfd, info, sdata, h, rel))
- return false;
-
+ if (!elf_create_pointer_linker_section (abfd, info,
+ htab->sdata, h, rel))
+ return FALSE;
break;
- /* Indirect .sdata2 relocation */
+ /* Indirect .sdata2 relocation. */
case R_PPC_EMB_SDA2I16:
if (info->shared)
{
- ((*_bfd_error_handler)
- (_("%s: relocation %s cannot be used when making a shared object"),
- bfd_archive_filename (abfd), "R_PPC_EMB_SDA2I16"));
- return false;
- }
-
- if (srelgot == NULL && (h != NULL || info->shared))
- {
- srelgot = bfd_get_section_by_name (dynobj, ".rela.got");
- if (srelgot == NULL)
- {
- srelgot = bfd_make_section (dynobj, ".rela.got");
- if (srelgot == NULL
- || ! bfd_set_section_flags (dynobj, srelgot,
- (SEC_ALLOC
- | SEC_LOAD
- | SEC_HAS_CONTENTS
- | SEC_IN_MEMORY
- | SEC_LINKER_CREATED
- | SEC_READONLY))
- || ! bfd_set_section_alignment (dynobj, srelgot, 2))
- return false;
- }
+ bad_shared_reloc (abfd, r_type);
+ return FALSE;
}
-
- if (!bfd_elf32_create_pointer_linker_section (abfd, info, sdata2, h, rel))
- return false;
-
+ if (!elf_create_pointer_linker_section (abfd, info,
+ htab->sdata2, h, rel))
+ return FALSE;
break;
case R_PPC_SDAREL16:
case R_PPC_EMB_SDA2REL:
case R_PPC_EMB_SDA21:
+ case R_PPC_EMB_RELSDA:
+ case R_PPC_EMB_NADDR32:
+ case R_PPC_EMB_NADDR16:
+ case R_PPC_EMB_NADDR16_LO:
+ case R_PPC_EMB_NADDR16_HI:
+ case R_PPC_EMB_NADDR16_HA:
if (info->shared)
{
- ((*_bfd_error_handler)
- (_("%s: relocation %s cannot be used when making a shared object"),
- bfd_archive_filename (abfd),
- ppc_elf_howto_table[(int) ELF32_R_TYPE (rel->r_info)]->name));
- return false;
+ bad_shared_reloc (abfd, r_type);
+ return FALSE;
}
break;
case R_PPC_PLT32:
case R_PPC_PLTREL24:
+ case R_PPC_PLTREL32:
case R_PPC_PLT16_LO:
case R_PPC_PLT16_HI:
case R_PPC_PLT16_HA:
@@ -2355,25 +3728,25 @@ ppc_elf_check_relocs (abfd, info, sec, relocs)
fprintf (stderr, "Reloc requires a PLT entry\n");
#endif
/* 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. */
+ actually build the entry in finish_dynamic_symbol,
+ because this might be a case of linking PIC code without
+ linking in any dynamic objects, in which case we don't
+ need to generate a procedure linkage table after all. */
if (h == NULL)
{
/* It does not make sense to have a procedure linkage
- table entry for a local symbol. */
+ table entry for a local symbol. */
+ (*_bfd_error_handler) (_("%s(%s+0x%lx): %s reloc against "
+ "local symbol"),
+ bfd_archive_filename (abfd),
+ sec->name,
+ (long) rel->r_offset,
+ ppc_elf_howto_table[r_type]->name);
bfd_set_error (bfd_error_bad_value);
- return false;
+ return FALSE;
}
- /* Make sure this symbol is output as a dynamic symbol. */
- if (h->dynindx == -1)
- {
- if (! bfd_elf32_link_record_dynamic_symbol (info, h))
- return false;
- }
h->elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_PLT;
h->plt.refcount++;
break;
@@ -2385,26 +3758,73 @@ ppc_elf_check_relocs (abfd, info, sec, relocs)
case R_PPC_SECTOFF_LO:
case R_PPC_SECTOFF_HI:
case R_PPC_SECTOFF_HA:
+ case R_PPC_DTPREL16:
+ case R_PPC_DTPREL16_LO:
+ case R_PPC_DTPREL16_HI:
+ case R_PPC_DTPREL16_HA:
+ case R_PPC_TOC16:
+ break;
+
+ /* This are just markers. */
+ case R_PPC_TLS:
+ case R_PPC_EMB_MRKREF:
+ case R_PPC_NONE:
+ case R_PPC_max:
+ break;
+
+ /* These should only appear in dynamic objects. */
+ case R_PPC_COPY:
+ case R_PPC_GLOB_DAT:
+ case R_PPC_JMP_SLOT:
+ case R_PPC_RELATIVE:
break;
- /* This refers only to functions defined in the shared library */
+ /* These aren't handled yet. We'll report an error later. */
+ case R_PPC_ADDR30:
+ case R_PPC_EMB_RELSEC16:
+ case R_PPC_EMB_RELST_LO:
+ case R_PPC_EMB_RELST_HI:
+ case R_PPC_EMB_RELST_HA:
+ case R_PPC_EMB_BIT_FLD:
+ break;
+
+ /* This refers only to functions defined in the shared library. */
case R_PPC_LOCAL24PC:
break;
/* This relocation describes the C++ object vtable hierarchy.
Reconstruct it for later use during GC. */
case R_PPC_GNU_VTINHERIT:
- if (!_bfd_elf32_gc_record_vtinherit (abfd, sec, h, rel->r_offset))
- return false;
+ if (!bfd_elf_gc_record_vtinherit (abfd, sec, h, rel->r_offset))
+ return FALSE;
break;
/* This relocation describes which C++ vtable entries are actually
used. Record for later use during GC. */
case R_PPC_GNU_VTENTRY:
- if (!_bfd_elf32_gc_record_vtentry (abfd, sec, h, rel->r_addend))
- return false;
+ if (!bfd_elf_gc_record_vtentry (abfd, sec, h, rel->r_addend))
+ return FALSE;
break;
+ /* We shouldn't really be seeing these. */
+ case R_PPC_TPREL32:
+ if (info->shared)
+ info->flags |= DF_STATIC_TLS;
+ goto dodyn;
+
+ /* Nor these. */
+ case R_PPC_DTPMOD32:
+ case R_PPC_DTPREL32:
+ goto dodyn;
+
+ case R_PPC_TPREL16:
+ case R_PPC_TPREL16_LO:
+ case R_PPC_TPREL16_HI:
+ case R_PPC_TPREL16_HA:
+ if (info->shared)
+ info->flags |= DF_STATIC_TLS;
+ goto dodyn;
+
/* When creating a shared object, we must copy these
relocs into the output file. We create a reloc
section in dynobj and make room for the reloc. */
@@ -2414,17 +3834,77 @@ ppc_elf_check_relocs (abfd, info, sec, relocs)
case R_PPC_REL14_BRNTAKEN:
case R_PPC_REL32:
if (h == NULL
- || strcmp (h->root.root.string, "_GLOBAL_OFFSET_TABLE_") == 0
- || SYMBOL_REFERENCES_LOCAL (info, h))
+ || strcmp (h->root.root.string, "_GLOBAL_OFFSET_TABLE_") == 0)
break;
/* fall through */
- default:
- if (info->shared)
+ case R_PPC_ADDR32:
+ case R_PPC_ADDR24:
+ case R_PPC_ADDR16:
+ case R_PPC_ADDR16_LO:
+ case R_PPC_ADDR16_HI:
+ case R_PPC_ADDR16_HA:
+ case R_PPC_ADDR14:
+ case R_PPC_ADDR14_BRTAKEN:
+ case R_PPC_ADDR14_BRNTAKEN:
+ case R_PPC_UADDR32:
+ case R_PPC_UADDR16:
+ if (h != NULL && !info->shared)
+ {
+ /* We may need a plt entry if the symbol turns out to be
+ a function defined in a dynamic object. */
+ h->plt.refcount++;
+
+ /* We may need a copy reloc too. */
+ h->elf_link_hash_flags |= ELF_LINK_NON_GOT_REF;
+ }
+
+ dodyn:
+ /* If we are creating a shared library, and this is a reloc
+ against a global symbol, or a non PC relative reloc
+ against a local symbol, then we need to copy the reloc
+ into the shared library. However, if we are linking with
+ -Bsymbolic, we do not need to copy a reloc against a
+ global symbol which is defined in an object we are
+ including in the link (i.e., DEF_REGULAR is set). At
+ this point we have not seen all the input files, so it is
+ possible that DEF_REGULAR is not set now but will be set
+ later (it is never cleared). In case of a weak definition,
+ DEF_REGULAR may be cleared later by a strong definition in
+ a shared library. We account for that possibility below by
+ storing information in the dyn_relocs field of the hash
+ table entry. A similar situation occurs when creating
+ shared libraries and symbol visibility changes render the
+ symbol local.
+
+ If on the other hand, we are creating an executable, we
+ may need to keep relocations for symbols satisfied by a
+ dynamic library if we manage to avoid copy relocs for the
+ symbol. */
+ if ((info->shared
+ && (MUST_BE_DYN_RELOC (r_type)
+ || (h != NULL
+ && (! info->symbolic
+ || h->root.type == bfd_link_hash_defweak
+ || (h->elf_link_hash_flags
+ & ELF_LINK_HASH_DEF_REGULAR) == 0))))
+ || (ELIMINATE_COPY_RELOCS
+ && !info->shared
+ && (sec->flags & SEC_ALLOC) != 0
+ && h != NULL
+ && (h->root.type == bfd_link_hash_defweak
+ || (h->elf_link_hash_flags
+ & ELF_LINK_HASH_DEF_REGULAR) == 0)))
{
+ struct ppc_elf_dyn_relocs *p;
+ struct ppc_elf_dyn_relocs **head;
+
#ifdef DEBUG
- fprintf (stderr, "ppc_elf_check_relocs need to create relocation for %s\n",
- (h && h->root.root.string) ? h->root.root.string : "<unknown>");
+ fprintf (stderr,
+ "ppc_elf_check_relocs needs to "
+ "create relocation for %s\n",
+ (h && h->root.root.string
+ ? h->root.root.string : "<unknown>"));
#endif
if (sreloc == NULL)
{
@@ -2435,58 +3915,88 @@ ppc_elf_check_relocs (abfd, info, sec, relocs)
elf_elfheader (abfd)->e_shstrndx,
elf_section_data (sec)->rel_hdr.sh_name));
if (name == NULL)
- return false;
+ 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);
+ sreloc = bfd_get_section_by_name (htab->elf.dynobj, name);
if (sreloc == NULL)
{
flagword flags;
- sreloc = bfd_make_section (dynobj, name);
+ sreloc = bfd_make_section (htab->elf.dynobj, name);
flags = (SEC_HAS_CONTENTS | SEC_READONLY
| SEC_IN_MEMORY | SEC_LINKER_CREATED);
if ((sec->flags & SEC_ALLOC) != 0)
flags |= SEC_ALLOC | SEC_LOAD;
if (sreloc == NULL
- || ! bfd_set_section_flags (dynobj, sreloc, flags)
- || ! bfd_set_section_alignment (dynobj, sreloc, 2))
- return false;
+ || ! bfd_set_section_flags (htab->elf.dynobj,
+ sreloc, flags)
+ || ! bfd_set_section_alignment (htab->elf.dynobj,
+ sreloc, 2))
+ return FALSE;
}
- if (sec->flags & SEC_READONLY)
- info->flags |= DF_TEXTREL;
+ elf_section_data (sec)->sreloc = sreloc;
}
- sreloc->_raw_size += sizeof (Elf32_External_Rela);
+ /* If this is a global symbol, we count the number of
+ relocations we need for this symbol. */
+ if (h != NULL)
+ {
+ head = &ppc_elf_hash_entry (h)->dyn_relocs;
+ }
+ else
+ {
+ /* Track dynamic relocs needed for local syms too.
+ We really need local syms available to do this
+ easily. Oh well. */
+
+ asection *s;
+ s = bfd_section_from_r_symndx (abfd, &htab->sym_sec,
+ sec, r_symndx);
+ if (s == NULL)
+ return FALSE;
+
+ head = ((struct ppc_elf_dyn_relocs **)
+ &elf_section_data (s)->local_dynrel);
+ }
- /* FIXME: We should here do what the m68k and i386
- backends do: if the reloc is pc-relative, record it
- in case it turns out that the reloc is unnecessary
- because the symbol is forced local by versioning or
- we are linking with -Bdynamic. Fortunately this
- case is not frequent. */
+ p = *head;
+ if (p == NULL || p->sec != sec)
+ {
+ p = bfd_alloc (htab->elf.dynobj, sizeof *p);
+ if (p == NULL)
+ return FALSE;
+ p->next = *head;
+ *head = p;
+ p->sec = sec;
+ p->count = 0;
+ p->pc_count = 0;
+ }
+
+ p->count += 1;
+ if (!MUST_BE_DYN_RELOC (r_type))
+ p->pc_count += 1;
}
break;
}
}
- return true;
+ return TRUE;
}
/* Return the section that should be marked against GC for a given
relocation. */
static asection *
-ppc_elf_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;
+ppc_elf_gc_mark_hook (asection *sec,
+ struct bfd_link_info *info ATTRIBUTE_UNUSED,
+ Elf_Internal_Rela *rel,
+ struct elf_link_hash_entry *h,
+ Elf_Internal_Sym *sym)
{
if (h != NULL)
{
@@ -2517,153 +4027,401 @@ ppc_elf_gc_mark_hook (sec, info, rel, h, sym)
return NULL;
}
-/* Update the got entry reference counts for the section being removed. */
+/* Update the got, plt and dynamic reloc reference counts for the
+ section being removed. */
-static boolean
-ppc_elf_gc_sweep_hook (abfd, info, sec, relocs)
- bfd *abfd;
- struct bfd_link_info *info ATTRIBUTE_UNUSED;
- asection *sec;
- const Elf_Internal_Rela *relocs;
+static bfd_boolean
+ppc_elf_gc_sweep_hook (bfd *abfd,
+ struct bfd_link_info *info,
+ asection *sec,
+ const Elf_Internal_Rela *relocs)
{
+ struct ppc_elf_link_hash_table *htab;
Elf_Internal_Shdr *symtab_hdr;
struct elf_link_hash_entry **sym_hashes;
bfd_signed_vma *local_got_refcounts;
const Elf_Internal_Rela *rel, *relend;
- unsigned long r_symndx;
- struct elf_link_hash_entry *h;
+ elf_section_data (sec)->local_dynrel = NULL;
+
+ htab = ppc_elf_hash_table (info);
symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
sym_hashes = elf_sym_hashes (abfd);
local_got_refcounts = elf_local_got_refcounts (abfd);
relend = relocs + sec->reloc_count;
for (rel = relocs; rel < relend; rel++)
- switch (ELF32_R_TYPE (rel->r_info))
- {
- case R_PPC_GOT16:
- case R_PPC_GOT16_LO:
- case R_PPC_GOT16_HI:
- case R_PPC_GOT16_HA:
- 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--;
- }
- else if (local_got_refcounts != NULL)
- {
- if (local_got_refcounts[r_symndx] > 0)
- local_got_refcounts[r_symndx]--;
- }
- break;
-
- case R_PPC_PLT32:
- case R_PPC_PLTREL24:
- case R_PPC_PLT16_LO:
- case R_PPC_PLT16_HI:
- case R_PPC_PLT16_HA:
- r_symndx = ELF32_R_SYM (rel->r_info);
- if (r_symndx >= symtab_hdr->sh_info)
+ {
+ unsigned long r_symndx;
+ enum elf_ppc_reloc_type r_type;
+ struct elf_link_hash_entry *h = NULL;
+
+ r_symndx = ELF32_R_SYM (rel->r_info);
+ if (r_symndx >= symtab_hdr->sh_info)
+ {
+ struct ppc_elf_dyn_relocs **pp, *p;
+ struct ppc_elf_link_hash_entry *eh;
+
+ h = sym_hashes[r_symndx - symtab_hdr->sh_info];
+ eh = (struct ppc_elf_link_hash_entry *) h;
+
+ for (pp = &eh->dyn_relocs; (p = *pp) != NULL; pp = &p->next)
+ if (p->sec == sec)
+ {
+ /* Everything must go for SEC. */
+ *pp = p->next;
+ break;
+ }
+ }
+
+ r_type = ELF32_R_TYPE (rel->r_info);
+ switch (r_type)
+ {
+ case R_PPC_GOT_TLSLD16:
+ case R_PPC_GOT_TLSLD16_LO:
+ case R_PPC_GOT_TLSLD16_HI:
+ case R_PPC_GOT_TLSLD16_HA:
+ htab->tlsld_got.refcount -= 1;
+ /* Fall thru */
+
+ case R_PPC_GOT_TLSGD16:
+ case R_PPC_GOT_TLSGD16_LO:
+ case R_PPC_GOT_TLSGD16_HI:
+ case R_PPC_GOT_TLSGD16_HA:
+ case R_PPC_GOT_TPREL16:
+ case R_PPC_GOT_TPREL16_LO:
+ case R_PPC_GOT_TPREL16_HI:
+ case R_PPC_GOT_TPREL16_HA:
+ case R_PPC_GOT_DTPREL16:
+ case R_PPC_GOT_DTPREL16_LO:
+ case R_PPC_GOT_DTPREL16_HI:
+ case R_PPC_GOT_DTPREL16_HA:
+ case R_PPC_GOT16:
+ case R_PPC_GOT16_LO:
+ case R_PPC_GOT16_HI:
+ case R_PPC_GOT16_HA:
+ if (h != NULL)
+ {
+ if (h->got.refcount > 0)
+ h->got.refcount--;
+ }
+ else if (local_got_refcounts != NULL)
+ {
+ if (local_got_refcounts[r_symndx] > 0)
+ local_got_refcounts[r_symndx]--;
+ }
+ break;
+
+ case R_PPC_REL24:
+ case R_PPC_REL14:
+ case R_PPC_REL14_BRTAKEN:
+ case R_PPC_REL14_BRNTAKEN:
+ case R_PPC_REL32:
+ if (h == NULL
+ || strcmp (h->root.root.string, "_GLOBAL_OFFSET_TABLE_") == 0)
+ break;
+ /* Fall thru */
+
+ case R_PPC_ADDR32:
+ case R_PPC_ADDR24:
+ case R_PPC_ADDR16:
+ case R_PPC_ADDR16_LO:
+ case R_PPC_ADDR16_HI:
+ case R_PPC_ADDR16_HA:
+ case R_PPC_ADDR14:
+ case R_PPC_ADDR14_BRTAKEN:
+ case R_PPC_ADDR14_BRNTAKEN:
+ case R_PPC_UADDR32:
+ case R_PPC_UADDR16:
+ case R_PPC_PLT32:
+ case R_PPC_PLTREL24:
+ case R_PPC_PLT16_LO:
+ case R_PPC_PLT16_HI:
+ case R_PPC_PLT16_HA:
+ if (h != NULL)
+ {
+ if (h->plt.refcount > 0)
+ h->plt.refcount--;
+ }
+ break;
+
+ default:
+ break;
+ }
+ }
+ return TRUE;
+}
+
+/* Set htab->tls_get_addr and call the generic ELF tls_setup function. */
+
+asection *
+ppc_elf_tls_setup (bfd *obfd, struct bfd_link_info *info)
+{
+ struct ppc_elf_link_hash_table *htab;
+
+ htab = ppc_elf_hash_table (info);
+ htab->tls_get_addr = elf_link_hash_lookup (&htab->elf, "__tls_get_addr",
+ FALSE, FALSE, TRUE);
+
+ return _bfd_elf_tls_setup (obfd, info);
+}
+
+/* Run through all the TLS relocs looking for optimization
+ opportunities. */
+
+bfd_boolean
+ppc_elf_tls_optimize (bfd *obfd ATTRIBUTE_UNUSED,
+ struct bfd_link_info *info)
+{
+ bfd *ibfd;
+ asection *sec;
+ struct ppc_elf_link_hash_table *htab;
+
+ if (info->relocatable || info->shared)
+ return TRUE;
+
+ htab = ppc_elf_hash_table (info);
+ for (ibfd = info->input_bfds; ibfd != NULL; ibfd = ibfd->link_next)
+ {
+ Elf_Internal_Sym *locsyms = NULL;
+ Elf_Internal_Shdr *symtab_hdr = &elf_tdata (ibfd)->symtab_hdr;
+
+ for (sec = ibfd->sections; sec != NULL; sec = sec->next)
+ if (sec->has_tls_reloc && !bfd_is_abs_section (sec->output_section))
{
- h = sym_hashes[r_symndx - symtab_hdr->sh_info];
- if (h->plt.refcount > 0)
- h->plt.refcount--;
- }
- break;
+ Elf_Internal_Rela *relstart, *rel, *relend;
+ int expecting_tls_get_addr;
+
+ /* Read the relocations. */
+ relstart = _bfd_elf_link_read_relocs (ibfd, sec, NULL, NULL,
+ info->keep_memory);
+ if (relstart == NULL)
+ return FALSE;
+
+ expecting_tls_get_addr = 0;
+ relend = relstart + sec->reloc_count;
+ for (rel = relstart; rel < relend; rel++)
+ {
+ enum elf_ppc_reloc_type r_type;
+ unsigned long r_symndx;
+ struct elf_link_hash_entry *h = NULL;
+ char *tls_mask;
+ char tls_set, tls_clear;
+ bfd_boolean is_local;
+
+ r_symndx = ELF32_R_SYM (rel->r_info);
+ if (r_symndx >= symtab_hdr->sh_info)
+ {
+ struct elf_link_hash_entry **sym_hashes;
+
+ sym_hashes = elf_sym_hashes (ibfd);
+ h = sym_hashes[r_symndx - symtab_hdr->sh_info];
+ while (h->root.type == bfd_link_hash_indirect
+ || h->root.type == bfd_link_hash_warning)
+ h = (struct elf_link_hash_entry *) h->root.u.i.link;
+ }
+
+ is_local = FALSE;
+ if (h == NULL
+ || !(h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC))
+ is_local = TRUE;
+
+ r_type = ELF32_R_TYPE (rel->r_info);
+ switch (r_type)
+ {
+ case R_PPC_GOT_TLSLD16:
+ case R_PPC_GOT_TLSLD16_LO:
+ case R_PPC_GOT_TLSLD16_HI:
+ case R_PPC_GOT_TLSLD16_HA:
+ /* These relocs should never be against a symbol
+ defined in a shared lib. Leave them alone if
+ that turns out to be the case. */
+ expecting_tls_get_addr = 0;
+ htab->tlsld_got.refcount -= 1;
+ if (!is_local)
+ continue;
+
+ /* LD -> LE */
+ tls_set = 0;
+ tls_clear = TLS_LD;
+ expecting_tls_get_addr = 1;
+ break;
+
+ case R_PPC_GOT_TLSGD16:
+ case R_PPC_GOT_TLSGD16_LO:
+ case R_PPC_GOT_TLSGD16_HI:
+ case R_PPC_GOT_TLSGD16_HA:
+ if (is_local)
+ /* GD -> LE */
+ tls_set = 0;
+ else
+ /* GD -> IE */
+ tls_set = TLS_TLS | TLS_TPRELGD;
+ tls_clear = TLS_GD;
+ expecting_tls_get_addr = 1;
+ break;
+
+ case R_PPC_GOT_TPREL16:
+ case R_PPC_GOT_TPREL16_LO:
+ case R_PPC_GOT_TPREL16_HI:
+ case R_PPC_GOT_TPREL16_HA:
+ expecting_tls_get_addr = 0;
+ if (is_local)
+ {
+ /* IE -> LE */
+ tls_set = 0;
+ tls_clear = TLS_TPREL;
+ break;
+ }
+ else
+ continue;
+
+ case R_PPC_REL14:
+ case R_PPC_REL14_BRTAKEN:
+ case R_PPC_REL14_BRNTAKEN:
+ case R_PPC_REL24:
+ if (expecting_tls_get_addr
+ && h != NULL
+ && h == htab->tls_get_addr)
+ {
+ if (h->plt.refcount > 0)
+ h->plt.refcount -= 1;
+ }
+ expecting_tls_get_addr = 0;
+ continue;
+
+ default:
+ expecting_tls_get_addr = 0;
+ continue;
+ }
+
+ if (h != NULL)
+ {
+ if (tls_set == 0)
+ {
+ /* We managed to get rid of a got entry. */
+ if (h->got.refcount > 0)
+ h->got.refcount -= 1;
+ }
+ tls_mask = &ppc_elf_hash_entry (h)->tls_mask;
+ }
+ else
+ {
+ Elf_Internal_Sym *sym;
+ bfd_signed_vma *lgot_refs;
+ char *lgot_masks;
+
+ if (locsyms == NULL)
+ {
+ locsyms = (Elf_Internal_Sym *) symtab_hdr->contents;
+ if (locsyms == NULL)
+ locsyms = bfd_elf_get_elf_syms (ibfd, symtab_hdr,
+ symtab_hdr->sh_info,
+ 0, NULL, NULL, NULL);
+ if (locsyms == NULL)
+ {
+ if (elf_section_data (sec)->relocs != relstart)
+ free (relstart);
+ return FALSE;
+ }
+ }
+ sym = locsyms + r_symndx;
+ lgot_refs = elf_local_got_refcounts (ibfd);
+ if (lgot_refs == NULL)
+ abort ();
+ if (tls_set == 0)
+ {
+ /* We managed to get rid of a got entry. */
+ if (lgot_refs[r_symndx] > 0)
+ lgot_refs[r_symndx] -= 1;
+ }
+ lgot_masks = (char *) (lgot_refs + symtab_hdr->sh_info);
+ tls_mask = &lgot_masks[r_symndx];
+ }
+
+ *tls_mask |= tls_set;
+ *tls_mask &= ~tls_clear;
+ }
- default:
- break;
- }
+ if (elf_section_data (sec)->relocs != relstart)
+ free (relstart);
+ }
- return true;
+ if (locsyms != NULL
+ && (symtab_hdr->contents != (unsigned char *) locsyms))
+ {
+ if (!info->keep_memory)
+ free (locsyms);
+ else
+ symtab_hdr->contents = (unsigned char *) locsyms;
+ }
+ }
+ return TRUE;
}
/* Hook called by the linker routine which adds symbols from an object
file. We use it to put .comm items in .sbss, and not .bss. */
-static boolean
-ppc_elf_add_symbol_hook (abfd, info, sym, namep, flagsp, secp, valp)
- bfd *abfd;
- struct bfd_link_info *info;
- const Elf_Internal_Sym *sym;
- const char **namep ATTRIBUTE_UNUSED;
- flagword *flagsp ATTRIBUTE_UNUSED;
- asection **secp;
- bfd_vma *valp;
+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->relocateable
+ && !info->relocatable
&& sym->st_size <= elf_gp_size (abfd)
- && info->hash->creator->flavour == bfd_target_elf_flavour)
+ && (info->hash->creator == abfd->xvec
+ || info->hash->creator == abfd->xvec->alternative_target))
{
/* Common symbols less than or equal to -G nn bytes are automatically
- put into .sdata. */
- elf_linker_section_t *sdata
- = ppc_elf_create_linker_section (abfd, info, LINKER_SECTION_SDATA);
-
- if (!sdata->bss_section)
- {
- bfd_size_type amt;
-
- /* We don't go through bfd_make_section, because we don't
- want to attach this common section to DYNOBJ. The linker
- will move the symbols to the appropriate output section
- when it defines common symbols. */
- amt = sizeof (asection);
- sdata->bss_section = (asection *) bfd_zalloc (abfd, amt);
- if (sdata->bss_section == NULL)
- return false;
- sdata->bss_section->name = sdata->bss_name;
- sdata->bss_section->flags = SEC_IS_COMMON;
- sdata->bss_section->output_section = sdata->bss_section;
- amt = sizeof (asymbol);
- sdata->bss_section->symbol = (asymbol *) bfd_zalloc (abfd, amt);
- amt = sizeof (asymbol *);
- sdata->bss_section->symbol_ptr_ptr =
- (asymbol **) bfd_zalloc (abfd, amt);
- if (sdata->bss_section->symbol == NULL
- || sdata->bss_section->symbol_ptr_ptr == NULL)
- return false;
- sdata->bss_section->symbol->name = sdata->bss_name;
- sdata->bss_section->symbol->flags = BSF_SECTION_SYM;
- sdata->bss_section->symbol->section = sdata->bss_section;
- *sdata->bss_section->symbol_ptr_ptr = sdata->bss_section->symbol;
- }
-
- *secp = sdata->bss_section;
+ put into .sbss. */
+ struct ppc_elf_link_hash_table *htab;
+
+ htab = ppc_elf_hash_table (info);
+ if (htab->sbss == NULL)
+ {
+ flagword flags = SEC_IS_COMMON;
+
+ htab->sbss = bfd_make_section_anyway (abfd, ".sbss");
+ if (htab->sbss == NULL
+ || ! bfd_set_section_flags (abfd, htab->sbss, flags))
+ return FALSE;
+ }
+
+ *secp = htab->sbss;
*valp = sym->st_size;
}
- return true;
+ return TRUE;
}
/* Finish up dynamic symbol handling. We set the contents of various
dynamic sections here. */
-static boolean
-ppc_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;
+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)
{
- bfd *dynobj;
+ struct ppc_elf_link_hash_table *htab;
#ifdef DEBUG
fprintf (stderr, "ppc_elf_finish_dynamic_symbol called for %s",
h->root.root.string);
#endif
- dynobj = elf_hash_table (info)->dynobj;
- BFD_ASSERT (dynobj != NULL);
+ htab = ppc_elf_hash_table (info);
+ BFD_ASSERT (htab->elf.dynobj != NULL);
if (h->plt.offset != (bfd_vma) -1)
{
- asection *splt;
- asection *srela;
Elf_Internal_Rela rela;
+ bfd_byte *loc;
bfd_vma reloc_index;
#ifdef DEBUG
@@ -2671,20 +4429,17 @@ ppc_elf_finish_dynamic_symbol (output_bfd, info, h, sym)
#endif
/* This symbol has an entry in the procedure linkage table. Set
- it up. */
+ 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);
+ BFD_ASSERT (htab->plt != NULL && htab->relplt != NULL);
/* We don't need to fill in the .plt. The ppc dynamic linker
will fill it in. */
/* Fill in the entry in the .rela.plt section. */
- rela.r_offset = (splt->output_section->vma
- + splt->output_offset
+ 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;
@@ -2692,9 +4447,9 @@ ppc_elf_finish_dynamic_symbol (output_bfd, info, h, sym)
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;
- bfd_elf32_swap_reloca_out (output_bfd, &rela,
- ((Elf32_External_Rela *) srela->contents
- + reloc_index));
+ loc = (htab->relplt->contents
+ + reloc_index * sizeof (Elf32_External_Rela));
+ bfd_elf32_swap_reloca_out (output_bfd, &rela, loc);
if ((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0)
{
@@ -2711,53 +4466,11 @@ ppc_elf_finish_dynamic_symbol (output_bfd, info, h, sym)
}
}
- if (h->got.offset != (bfd_vma) -1)
- {
- asection *sgot;
- asection *srela;
- Elf_Internal_Rela rela;
-
- /* This symbol has an entry in the global offset table. Set it
- up. */
-
- sgot = bfd_get_section_by_name (dynobj, ".got");
- srela = bfd_get_section_by_name (dynobj, ".rela.got");
- BFD_ASSERT (sgot != NULL && srela != NULL);
-
- rela.r_offset = (sgot->output_section->vma
- + sgot->output_offset
- + (h->got.offset &~ (bfd_vma) 1));
-
- /* If this is a -Bsymbolic link, and the symbol is defined
- locally, we just want to emit a RELATIVE reloc. The entry in
- the global offset table will already have been initialized in
- the relocate_section function. */
- if (info->shared
- && SYMBOL_REFERENCES_LOCAL (info, h))
- {
- rela.r_info = ELF32_R_INFO (0, R_PPC_RELATIVE);
- rela.r_addend = (h->root.u.def.value
- + h->root.u.def.section->output_section->vma
- + h->root.u.def.section->output_offset);
- }
- else
- {
- BFD_ASSERT ((h->got.offset & 1) == 0);
- rela.r_info = ELF32_R_INFO (h->dynindx, R_PPC_GLOB_DAT);
- rela.r_addend = 0;
- }
-
- bfd_put_32 (output_bfd, (bfd_vma) 0, sgot->contents + h->got.offset);
- bfd_elf32_swap_reloca_out (output_bfd, &rela,
- ((Elf32_External_Rela *) srela->contents
- + srela->reloc_count));
- ++srela->reloc_count;
- }
-
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. */
@@ -2767,12 +4480,10 @@ ppc_elf_finish_dynamic_symbol (output_bfd, info, h, sym)
BFD_ASSERT (h->dynindx != -1);
- if (h->size <= elf_gp_size (dynobj))
- s = bfd_get_section_by_name (h->root.u.def.section->owner,
- ".rela.sbss");
+ if (h->size <= elf_gp_size (htab->elf.dynobj))
+ s = htab->relsbss;
else
- s = bfd_get_section_by_name (h->root.u.def.section->owner,
- ".rela.bss");
+ s = htab->relbss;
BFD_ASSERT (s != NULL);
rela.r_offset = (h->root.u.def.value
@@ -2780,10 +4491,8 @@ ppc_elf_finish_dynamic_symbol (output_bfd, info, h, sym)
+ h->root.u.def.section->output_offset);
rela.r_info = ELF32_R_INFO (h->dynindx, R_PPC_COPY);
rela.r_addend = 0;
- bfd_elf32_swap_reloca_out (output_bfd, &rela,
- ((Elf32_External_Rela *) s->contents
- + s->reloc_count));
- ++s->reloc_count;
+ loc = s->contents + s->reloc_count++ * sizeof (Elf32_External_Rela);
+ bfd_elf32_swap_reloca_out (output_bfd, &rela, loc);
}
#ifdef DEBUG
@@ -2796,94 +4505,82 @@ ppc_elf_finish_dynamic_symbol (output_bfd, info, h, sym)
|| strcmp (h->root.root.string, "_PROCEDURE_LINKAGE_TABLE_") == 0)
sym->st_shndx = SHN_ABS;
- return true;
+ return TRUE;
}
/* Finish up the dynamic sections. */
-static boolean
-ppc_elf_finish_dynamic_sections (output_bfd, info)
- bfd *output_bfd;
- struct bfd_link_info *info;
+static bfd_boolean
+ppc_elf_finish_dynamic_sections (bfd *output_bfd,
+ struct bfd_link_info *info)
{
asection *sdyn;
- bfd *dynobj = elf_hash_table (info)->dynobj;
- asection *sgot = bfd_get_section_by_name (dynobj, ".got");
+ struct ppc_elf_link_hash_table *htab;
#ifdef DEBUG
fprintf (stderr, "ppc_elf_finish_dynamic_sections called\n");
#endif
- sdyn = bfd_get_section_by_name (dynobj, ".dynamic");
+ htab = ppc_elf_hash_table (info);
+ sdyn = bfd_get_section_by_name (htab->elf.dynobj, ".dynamic");
- if (elf_hash_table (info)->dynamic_sections_created)
+ if (htab->elf.dynamic_sections_created)
{
- asection *splt;
Elf32_External_Dyn *dyncon, *dynconend;
- splt = bfd_get_section_by_name (dynobj, ".plt");
- BFD_ASSERT (splt != NULL && sdyn != NULL);
+ BFD_ASSERT (htab->plt != NULL && sdyn != NULL);
dyncon = (Elf32_External_Dyn *) sdyn->contents;
dynconend = (Elf32_External_Dyn *) (sdyn->contents + sdyn->_raw_size);
for (; dyncon < dynconend; dyncon++)
{
Elf_Internal_Dyn dyn;
- const char *name;
- boolean size;
+ asection *s;
- bfd_elf32_swap_dyn_in (dynobj, dyncon, &dyn);
+ bfd_elf32_swap_dyn_in (htab->elf.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;
- }
+ case DT_PLTGOT:
+ s = htab->plt;
+ dyn.d_un.d_ptr = s->output_section->vma + s->output_offset;
+ break;
- if (name != NULL)
- {
- asection *s;
+ case DT_PLTRELSZ:
+ dyn.d_un.d_val = htab->relplt->_raw_size;
+ break;
- 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);
+ case DT_JMPREL:
+ s = htab->relplt;
+ dyn.d_un.d_ptr = s->output_section->vma + s->output_offset;
+ break;
+
+ default:
+ continue;
}
+
+ bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon);
}
}
/* Add a blrl instruction at _GLOBAL_OFFSET_TABLE_-4 so that a function can
easily find the address of the _GLOBAL_OFFSET_TABLE_. */
- if (sgot)
+ if (htab->got)
{
- unsigned char *contents = sgot->contents;
- bfd_put_32 (output_bfd, (bfd_vma) 0x4e800021 /* blrl */, contents);
+ unsigned char *contents = htab->got->contents;
+ bfd_put_32 (output_bfd, 0x4e800021 /* blrl */, contents);
if (sdyn == NULL)
- bfd_put_32 (output_bfd, (bfd_vma) 0, contents+4);
+ bfd_put_32 (output_bfd, 0, contents + 4);
else
bfd_put_32 (output_bfd,
sdyn->output_section->vma + sdyn->output_offset,
- contents+4);
+ contents + 4);
- elf_section_data (sgot->output_section)->this_hdr.sh_entsize = 4;
+ elf_section_data (htab->got->output_section)->this_hdr.sh_entsize = 4;
}
- return true;
+ return TRUE;
}
/* The RELOCATE_SECTION function is called by the ELF backend linker
@@ -2895,7 +4592,7 @@ ppc_elf_finish_dynamic_sections (output_bfd, info)
This function is responsible for adjust the section contents as
necessary, and (if using Rela relocs and generating a
- relocateable output file) adjusting the reloc addend as
+ relocatable output file) adjusting the reloc addend as
necessary.
This function does not have to worry about setting the reloc
@@ -2909,289 +4606,711 @@ ppc_elf_finish_dynamic_sections (output_bfd, info)
The global hash table entry for the global symbols can be found
via elf_sym_hashes (input_bfd).
- When generating relocateable output, this function must handle
+ 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 boolean
-ppc_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;
+static bfd_boolean
+ppc_elf_relocate_section (bfd *output_bfd,
+ struct bfd_link_info *info,
+ bfd *input_bfd,
+ asection *input_section,
+ bfd_byte *contents,
+ Elf_Internal_Rela *relocs,
+ Elf_Internal_Sym *local_syms,
+ asection **local_sections)
{
- Elf_Internal_Shdr *symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr;
- struct elf_link_hash_entry **sym_hashes = elf_sym_hashes (input_bfd);
- bfd *dynobj = elf_hash_table (info)->dynobj;
- elf_linker_section_t *sdata = (dynobj) ? elf_linker_section (dynobj, LINKER_SECTION_SDATA) : NULL;
- elf_linker_section_t *sdata2 = (dynobj) ? elf_linker_section (dynobj, LINKER_SECTION_SDATA2) : NULL;
- Elf_Internal_Rela *rel = relocs;
- Elf_Internal_Rela *relend = relocs + input_section->reloc_count;
- asection *sreloc = NULL;
- asection *splt;
- asection *sgot;
+ Elf_Internal_Shdr *symtab_hdr;
+ struct elf_link_hash_entry **sym_hashes;
+ struct ppc_elf_link_hash_table *htab;
+ Elf_Internal_Rela *rel;
+ Elf_Internal_Rela *relend;
+ Elf_Internal_Rela outrel;
+ bfd_byte *loc;
+ asection *sreloc = NULL;
bfd_vma *local_got_offsets;
- boolean ret = true;
- long insn;
+ bfd_boolean ret = TRUE;
#ifdef DEBUG
- fprintf (stderr, "ppc_elf_relocate_section called for %s section %s, %ld relocations%s\n",
+ 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->relocateable) ? " (relocatable)" : "");
+ (info->relocatable) ? " (relocatable)" : "");
#endif
- if (info->relocateable)
- return true;
+ if (info->relocatable)
+ return TRUE;
+ /* Initialize howto table if not already done. */
if (!ppc_elf_howto_table[R_PPC_ADDR32])
- /* Initialize howto table if needed. */
ppc_elf_howto_init ();
+ htab = ppc_elf_hash_table (info);
local_got_offsets = elf_local_got_offsets (input_bfd);
-
- splt = sgot = NULL;
- if (dynobj != NULL)
- {
- splt = bfd_get_section_by_name (dynobj, ".plt");
- sgot = bfd_get_section_by_name (dynobj, ".got");
- }
-
+ symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr;
+ sym_hashes = elf_sym_hashes (input_bfd);
+ rel = relocs;
+ relend = relocs + input_section->reloc_count;
for (; rel < relend; rel++)
{
- enum elf_ppc_reloc_type r_type = (enum elf_ppc_reloc_type)ELF32_R_TYPE (rel->r_info);
- bfd_vma offset = rel->r_offset;
- bfd_vma addend = rel->r_addend;
- bfd_reloc_status_type r = bfd_reloc_other;
- Elf_Internal_Sym *sym = (Elf_Internal_Sym *) 0;
- asection *sec = (asection *) 0;
- struct elf_link_hash_entry *h = (struct elf_link_hash_entry *) 0;
- const char *sym_name = (const char *) 0;
+ enum elf_ppc_reloc_type r_type;
+ bfd_vma addend;
+ bfd_reloc_status_type r;
+ Elf_Internal_Sym *sym;
+ asection *sec;
+ struct elf_link_hash_entry *h;
+ const char *sym_name;
reloc_howto_type *howto;
unsigned long r_symndx;
bfd_vma relocation;
- int will_become_local;
-
- /* Unknown relocation handling */
- if ((unsigned) r_type >= (unsigned) R_PPC_max
- || !ppc_elf_howto_table[(int) r_type])
- {
- (*_bfd_error_handler) (_("%s: unknown relocation type %d"),
- bfd_archive_filename (input_bfd),
- (int) r_type);
-
- bfd_set_error (bfd_error_bad_value);
- ret = false;
- continue;
- }
-
- howto = ppc_elf_howto_table[(int) r_type];
+ bfd_vma branch_bit, insn, from;
+ bfd_boolean unresolved_reloc;
+ bfd_boolean warned;
+ unsigned int tls_type, tls_mask, tls_gd;
+
+ r_type = ELF32_R_TYPE (rel->r_info);
+ sym = NULL;
+ sec = NULL;
+ h = NULL;
+ unresolved_reloc = FALSE;
+ warned = FALSE;
r_symndx = ELF32_R_SYM (rel->r_info);
if (r_symndx < symtab_hdr->sh_info)
{
sym = local_syms + r_symndx;
sec = local_sections[r_symndx];
- sym_name = "<local symbol>";
+ sym_name = bfd_elf_local_sym_name (input_bfd, sym);
- relocation = _bfd_elf_rela_local_sym (output_bfd, sym, sec, rel);
- addend = rel->r_addend;
- /* Relocs to local symbols are always resolved. */
- will_become_local = 1;
+ relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel);
}
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;
+ 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;
+ }
- /* Can this relocation be resolved immediately? */
- will_become_local = SYMBOL_REFERENCES_LOCAL (info, h);
+ /* TLS optimizations. Replace instruction sequences and relocs
+ based on information we collected in tls_optimize. We edit
+ RELOCS so that --emit-relocs will output something sensible
+ for the final instruction stream. */
+ tls_mask = 0;
+ tls_gd = 0;
+ if (IS_PPC_TLS_RELOC (r_type))
+ {
+ if (h != NULL)
+ tls_mask = ((struct ppc_elf_link_hash_entry *) h)->tls_mask;
+ else if (local_got_offsets != NULL)
+ {
+ char *lgot_masks;
+ lgot_masks = (char *) (local_got_offsets + symtab_hdr->sh_info);
+ tls_mask = lgot_masks[r_symndx];
+ }
+ }
- if (h->root.type == bfd_link_hash_defined
- || h->root.type == bfd_link_hash_defweak)
+ /* Ensure reloc mapping code below stays sane. */
+ if ((R_PPC_GOT_TLSLD16 & 3) != (R_PPC_GOT_TLSGD16 & 3)
+ || (R_PPC_GOT_TLSLD16_LO & 3) != (R_PPC_GOT_TLSGD16_LO & 3)
+ || (R_PPC_GOT_TLSLD16_HI & 3) != (R_PPC_GOT_TLSGD16_HI & 3)
+ || (R_PPC_GOT_TLSLD16_HA & 3) != (R_PPC_GOT_TLSGD16_HA & 3)
+ || (R_PPC_GOT_TLSLD16 & 3) != (R_PPC_GOT_TPREL16 & 3)
+ || (R_PPC_GOT_TLSLD16_LO & 3) != (R_PPC_GOT_TPREL16_LO & 3)
+ || (R_PPC_GOT_TLSLD16_HI & 3) != (R_PPC_GOT_TPREL16_HI & 3)
+ || (R_PPC_GOT_TLSLD16_HA & 3) != (R_PPC_GOT_TPREL16_HA & 3))
+ abort ();
+ switch (r_type)
+ {
+ default:
+ break;
+
+ case R_PPC_GOT_TPREL16:
+ case R_PPC_GOT_TPREL16_LO:
+ if (tls_mask != 0
+ && (tls_mask & TLS_TPREL) == 0)
{
- sec = h->root.u.def.section;
- if (((r_type == R_PPC_PLT32
- || r_type == R_PPC_PLTREL24)
- && splt != NULL
- && h->plt.offset != (bfd_vma) -1)
- || (r_type == R_PPC_LOCAL24PC
- && sec->output_section == NULL)
- || ((r_type == R_PPC_GOT16
- || r_type == R_PPC_GOT16_LO
- || r_type == R_PPC_GOT16_HI
- || r_type == R_PPC_GOT16_HA)
- && elf_hash_table (info)->dynamic_sections_created
- && (! info->shared || ! will_become_local))
- || (info->shared
- && ! will_become_local
- && ((input_section->flags & SEC_ALLOC) != 0
- /* Testing SEC_DEBUGGING here may be wrong.
- It's here to avoid a crash when
- generating a shared library with DWARF
- debugging information. */
- || ((input_section->flags & SEC_DEBUGGING) != 0
- && (h->elf_link_hash_flags
- & ELF_LINK_HASH_DEF_DYNAMIC) != 0))
- && (r_type == R_PPC_ADDR32
- || r_type == R_PPC_ADDR24
- || r_type == R_PPC_ADDR16
- || r_type == R_PPC_ADDR16_LO
- || r_type == R_PPC_ADDR16_HI
- || r_type == R_PPC_ADDR16_HA
- || r_type == R_PPC_ADDR14
- || r_type == R_PPC_ADDR14_BRTAKEN
- || r_type == R_PPC_ADDR14_BRNTAKEN
- || r_type == R_PPC_COPY
- || r_type == R_PPC_GLOB_DAT
- || r_type == R_PPC_JMP_SLOT
- || r_type == R_PPC_UADDR32
- || r_type == R_PPC_UADDR16
- || r_type == R_PPC_SDAREL16
- || r_type == R_PPC_EMB_NADDR32
- || r_type == R_PPC_EMB_NADDR16
- || r_type == R_PPC_EMB_NADDR16_LO
- || r_type == R_PPC_EMB_NADDR16_HI
- || r_type == R_PPC_EMB_NADDR16_HA
- || r_type == R_PPC_EMB_SDAI16
- || r_type == R_PPC_EMB_SDA2I16
- || r_type == R_PPC_EMB_SDA2REL
- || r_type == R_PPC_EMB_SDA21
- || r_type == R_PPC_EMB_MRKREF
- || r_type == R_PPC_EMB_BIT_FLD
- || r_type == R_PPC_EMB_RELSDA
- || ((r_type == R_PPC_REL24
- || r_type == R_PPC_REL32
- || r_type == R_PPC_REL14
- || r_type == R_PPC_REL14_BRTAKEN
- || r_type == R_PPC_REL14_BRNTAKEN
- || r_type == R_PPC_RELATIVE)
- && strcmp (h->root.root.string,
- "_GLOBAL_OFFSET_TABLE_") != 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. */
- relocation = 0;
- }
- else if (sec->output_section == NULL)
+ bfd_vma insn;
+ insn = bfd_get_32 (output_bfd, contents + rel->r_offset - 2);
+ insn &= 31 << 21;
+ insn |= 0x3c020000; /* addis 0,2,0 */
+ bfd_put_32 (output_bfd, insn, contents + rel->r_offset - 2);
+ r_type = R_PPC_TPREL16_HA;
+ rel->r_info = ELF32_R_INFO (r_symndx, r_type);
+ }
+ break;
+
+ case R_PPC_TLS:
+ if (tls_mask != 0
+ && (tls_mask & TLS_TPREL) == 0)
+ {
+ bfd_vma insn, rtra;
+ insn = bfd_get_32 (output_bfd, contents + rel->r_offset);
+ if ((insn & ((31 << 26) | (31 << 11)))
+ == ((31 << 26) | (2 << 11)))
+ rtra = insn & ((1 << 26) - (1 << 16));
+ else if ((insn & ((31 << 26) | (31 << 16)))
+ == ((31 << 26) | (2 << 16)))
+ rtra = (insn & (31 << 21)) | ((insn & (31 << 11)) << 5);
+ else
+ abort ();
+ if ((insn & ((1 << 11) - (1 << 1))) == 266 << 1)
+ /* add -> addi. */
+ insn = 14 << 26;
+ else if ((insn & (31 << 1)) == 23 << 1
+ && ((insn & (31 << 6)) < 14 << 6
+ || ((insn & (31 << 6)) >= 16 << 6
+ && (insn & (31 << 6)) < 24 << 6)))
+ /* load and store indexed -> dform. */
+ insn = (32 | ((insn >> 6) & 31)) << 26;
+ else if ((insn & (31 << 1)) == 21 << 1
+ && (insn & (0x1a << 6)) == 0)
+ /* ldx, ldux, stdx, stdux -> ld, ldu, std, stdu. */
+ insn = (((58 | ((insn >> 6) & 4)) << 26)
+ | ((insn >> 6) & 1));
+ else if ((insn & (31 << 1)) == 21 << 1
+ && (insn & ((1 << 11) - (1 << 1))) == 341 << 1)
+ /* lwax -> lwa. */
+ insn = (58 << 26) | 2;
+ else
+ abort ();
+ insn |= rtra;
+ bfd_put_32 (output_bfd, insn, contents + rel->r_offset);
+ r_type = R_PPC_TPREL16_LO;
+ rel->r_info = ELF32_R_INFO (r_symndx, r_type);
+ /* Was PPC_TLS which sits on insn boundary, now
+ PPC_TPREL16_LO which is at insn+2. */
+ rel->r_offset += 2;
+ }
+ break;
+
+ case R_PPC_GOT_TLSGD16_HI:
+ case R_PPC_GOT_TLSGD16_HA:
+ tls_gd = TLS_TPRELGD;
+ if (tls_mask != 0 && (tls_mask & TLS_GD) == 0)
+ goto tls_gdld_hi;
+ break;
+
+ case R_PPC_GOT_TLSLD16_HI:
+ case R_PPC_GOT_TLSLD16_HA:
+ if (tls_mask != 0 && (tls_mask & TLS_LD) == 0)
+ {
+ tls_gdld_hi:
+ if ((tls_mask & tls_gd) != 0)
+ r_type = (((r_type - (R_PPC_GOT_TLSGD16 & 3)) & 3)
+ + R_PPC_GOT_TPREL16);
+ else
{
- (*_bfd_error_handler)
- (_("%s: warning: unresolvable relocation against symbol `%s' from %s section"),
- bfd_archive_filename (input_bfd), h->root.root.string,
- bfd_get_section_name (input_bfd, input_section));
- relocation = 0;
+ bfd_put_32 (output_bfd, NOP, contents + rel->r_offset);
+ rel->r_offset -= 2;
+ r_type = R_PPC_NONE;
}
- else
- relocation = (h->root.u.def.value
- + sec->output_section->vma
- + sec->output_offset);
+ rel->r_info = ELF32_R_INFO (r_symndx, r_type);
}
- else if (h->root.type == bfd_link_hash_undefweak)
- relocation = 0;
- else if (info->shared
- && (!info->symbolic || info->allow_shlib_undefined)
- && !info->no_undefined
- && ELF_ST_VISIBILITY (h->other) == STV_DEFAULT)
- relocation = 0;
- else
+ break;
+
+ case R_PPC_GOT_TLSGD16:
+ case R_PPC_GOT_TLSGD16_LO:
+ tls_gd = TLS_TPRELGD;
+ if (tls_mask != 0 && (tls_mask & TLS_GD) == 0)
+ goto tls_get_addr_check;
+ break;
+
+ case R_PPC_GOT_TLSLD16:
+ case R_PPC_GOT_TLSLD16_LO:
+ if (tls_mask != 0 && (tls_mask & TLS_LD) == 0)
{
- if (! (*info->callbacks->undefined_symbol) (info,
- h->root.root.string,
- input_bfd,
- input_section,
- rel->r_offset,
- (!info->shared
- || info->no_undefined
- || ELF_ST_VISIBILITY (h->other))))
- return false;
- relocation = 0;
+ tls_get_addr_check:
+ if (rel + 1 < relend)
+ {
+ enum elf_ppc_reloc_type r_type2;
+ unsigned long r_symndx2;
+ struct elf_link_hash_entry *h2;
+ bfd_vma insn1, insn2;
+ bfd_vma offset;
+
+ /* The next instruction should be a call to
+ __tls_get_addr. Peek at the reloc to be sure. */
+ r_type2 = ELF32_R_TYPE (rel[1].r_info);
+ r_symndx2 = ELF32_R_SYM (rel[1].r_info);
+ if (r_symndx2 < symtab_hdr->sh_info
+ || (r_type2 != R_PPC_REL14
+ && r_type2 != R_PPC_REL14_BRTAKEN
+ && r_type2 != R_PPC_REL14_BRNTAKEN
+ && r_type2 != R_PPC_REL24
+ && r_type2 != R_PPC_PLTREL24))
+ break;
+
+ h2 = sym_hashes[r_symndx2 - symtab_hdr->sh_info];
+ while (h2->root.type == bfd_link_hash_indirect
+ || h2->root.type == bfd_link_hash_warning)
+ h2 = (struct elf_link_hash_entry *) h2->root.u.i.link;
+ if (h2 == NULL || h2 != htab->tls_get_addr)
+ break;
+
+ /* OK, it checks out. Replace the call. */
+ offset = rel[1].r_offset;
+ insn1 = bfd_get_32 (output_bfd,
+ contents + rel->r_offset - 2);
+ if ((tls_mask & tls_gd) != 0)
+ {
+ /* IE */
+ insn1 &= (1 << 26) - 1;
+ insn1 |= 32 << 26; /* lwz */
+ insn2 = 0x7c631214; /* add 3,3,2 */
+ rel[1].r_info = ELF32_R_INFO (r_symndx2, R_PPC_NONE);
+ r_type = (((r_type - (R_PPC_GOT_TLSGD16 & 3)) & 3)
+ + R_PPC_GOT_TPREL16);
+ rel->r_info = ELF32_R_INFO (r_symndx, r_type);
+ }
+ else
+ {
+ /* LE */
+ insn1 = 0x3c620000; /* addis 3,2,0 */
+ insn2 = 0x38630000; /* addi 3,3,0 */
+ if (tls_gd == 0)
+ {
+ /* Was an LD reloc. */
+ r_symndx = 0;
+ rel->r_addend = htab->elf.tls_sec->vma + DTP_OFFSET;
+ rel[1].r_addend = htab->elf.tls_sec->vma + DTP_OFFSET;
+ }
+ r_type = R_PPC_TPREL16_HA;
+ rel->r_info = ELF32_R_INFO (r_symndx, r_type);
+ rel[1].r_info = ELF32_R_INFO (r_symndx,
+ R_PPC_TPREL16_LO);
+ rel[1].r_offset += 2;
+ }
+ bfd_put_32 (output_bfd, insn1, contents + rel->r_offset - 2);
+ bfd_put_32 (output_bfd, insn2, contents + offset);
+ if (tls_gd == 0)
+ {
+ /* We changed the symbol on an LD reloc. Start over
+ in order to get h, sym, sec etc. right. */
+ rel--;
+ continue;
+ }
+ }
}
+ break;
}
- switch ((int) r_type)
+ /* Handle other relocations that tweak non-addend part of insn. */
+ branch_bit = 0;
+ 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);
+ break;
+
+ /* Branch taken prediction relocations. */
+ case R_PPC_ADDR14_BRTAKEN:
+ case R_PPC_REL14_BRTAKEN:
+ branch_bit = BRANCH_PREDICT_BIT;
+ /* Fall thru */
+
+ /* Branch not taken prediction relocations. */
+ case R_PPC_ADDR14_BRNTAKEN:
+ case R_PPC_REL14_BRNTAKEN:
+ insn = bfd_get_32 (output_bfd, contents + rel->r_offset);
+ insn &= ~BRANCH_PREDICT_BIT;
+ insn |= branch_bit;
+
+ from = (rel->r_offset
+ + input_section->output_offset
+ + input_section->output_section->vma);
+
+ /* Invert 'y' bit if not the default. */
+ if ((bfd_signed_vma) (relocation + rel->r_addend - from) < 0)
+ insn ^= BRANCH_PREDICT_BIT;
+
+ bfd_put_32 (output_bfd, insn, contents + rel->r_offset);
+ break;
+ }
+
+ addend = rel->r_addend;
+ tls_type = 0;
+ howto = NULL;
+ if (r_type < R_PPC_max)
+ howto = ppc_elf_howto_table[r_type];
+ switch (r_type)
+ {
+ default:
+ (*_bfd_error_handler)
+ (_("%s: unknown relocation type %d for symbol %s"),
+ bfd_archive_filename (input_bfd), (int) r_type, sym_name);
bfd_set_error (bfd_error_bad_value);
- ret = false;
+ ret = FALSE;
continue;
- case (int) R_PPC_NONE:
+ case R_PPC_NONE:
+ case R_PPC_TLS:
+ case R_PPC_EMB_MRKREF:
+ case R_PPC_GNU_VTINHERIT:
+ case R_PPC_GNU_VTENTRY:
continue;
+ /* GOT16 relocations. Like an ADDR16 using the symbol's
+ address in the GOT as relocation value instead of the
+ symbol's value itself. Also, create a GOT entry for the
+ symbol and put the symbol value there. */
+ case R_PPC_GOT_TLSGD16:
+ case R_PPC_GOT_TLSGD16_LO:
+ case R_PPC_GOT_TLSGD16_HI:
+ case R_PPC_GOT_TLSGD16_HA:
+ tls_type = TLS_TLS | TLS_GD;
+ goto dogot;
+
+ case R_PPC_GOT_TLSLD16:
+ case R_PPC_GOT_TLSLD16_LO:
+ case R_PPC_GOT_TLSLD16_HI:
+ case R_PPC_GOT_TLSLD16_HA:
+ tls_type = TLS_TLS | TLS_LD;
+ goto dogot;
+
+ case R_PPC_GOT_TPREL16:
+ case R_PPC_GOT_TPREL16_LO:
+ case R_PPC_GOT_TPREL16_HI:
+ case R_PPC_GOT_TPREL16_HA:
+ tls_type = TLS_TLS | TLS_TPREL;
+ goto dogot;
+
+ case R_PPC_GOT_DTPREL16:
+ case R_PPC_GOT_DTPREL16_LO:
+ case R_PPC_GOT_DTPREL16_HI:
+ case R_PPC_GOT_DTPREL16_HA:
+ tls_type = TLS_TLS | TLS_DTPREL;
+ goto dogot;
+
+ case R_PPC_GOT16:
+ case R_PPC_GOT16_LO:
+ case R_PPC_GOT16_HI:
+ case R_PPC_GOT16_HA:
+ dogot:
+ {
+ /* Relocation is to the entry for this symbol in the global
+ offset table. */
+ bfd_vma off;
+ bfd_vma *offp;
+ unsigned long indx;
+
+ if (htab->got == NULL)
+ abort ();
+
+ indx = 0;
+ if (tls_type == (TLS_TLS | TLS_LD)
+ && (h == NULL
+ || !(h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC)))
+ offp = &htab->tlsld_got.offset;
+ else if (h != NULL)
+ {
+ bfd_boolean dyn;
+ dyn = htab->elf.dynamic_sections_created;
+ if (! WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, info->shared, h)
+ || (info->shared
+ && SYMBOL_REFERENCES_LOCAL (info, h)))
+ /* This is actually a static link, or it is a
+ -Bsymbolic link and the symbol is defined
+ locally, or the symbol was forced to be local
+ because of a version file. */
+ ;
+ else
+ {
+ indx = h->dynindx;
+ unresolved_reloc = FALSE;
+ }
+ offp = &h->got.offset;
+ }
+ else
+ {
+ if (local_got_offsets == NULL)
+ abort ();
+ offp = &local_got_offsets[r_symndx];
+ }
+
+ /* The offset must always be a multiple of 4. We use the
+ least significant bit to record whether we have already
+ processed this entry. */
+ off = *offp;
+ if ((off & 1) != 0)
+ off &= ~1;
+ else
+ {
+ unsigned int tls_m = (tls_mask
+ & (TLS_LD | TLS_GD | TLS_DTPREL
+ | TLS_TPREL | TLS_TPRELGD));
+
+ if (offp == &htab->tlsld_got.offset)
+ tls_m = TLS_LD;
+ else if (h == NULL
+ || !(h->elf_link_hash_flags
+ & ELF_LINK_HASH_DEF_DYNAMIC))
+ tls_m &= ~TLS_LD;
+
+ /* We might have multiple got entries for this sym.
+ Initialize them all. */
+ do
+ {
+ int tls_ty = 0;
+
+ if ((tls_m & TLS_LD) != 0)
+ {
+ tls_ty = TLS_TLS | TLS_LD;
+ tls_m &= ~TLS_LD;
+ }
+ else if ((tls_m & TLS_GD) != 0)
+ {
+ tls_ty = TLS_TLS | TLS_GD;
+ tls_m &= ~TLS_GD;
+ }
+ else if ((tls_m & TLS_DTPREL) != 0)
+ {
+ tls_ty = TLS_TLS | TLS_DTPREL;
+ tls_m &= ~TLS_DTPREL;
+ }
+ else if ((tls_m & (TLS_TPREL | TLS_TPRELGD)) != 0)
+ {
+ tls_ty = TLS_TLS | TLS_TPREL;
+ tls_m = 0;
+ }
+
+ /* Generate relocs for the dynamic linker. */
+ if ((info->shared || indx != 0)
+ && (h == NULL
+ || ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
+ || h->root.type != bfd_link_hash_undefweak))
+ {
+ outrel.r_offset = (htab->got->output_section->vma
+ + htab->got->output_offset
+ + off);
+ outrel.r_addend = 0;
+ if (tls_ty & (TLS_LD | TLS_GD))
+ {
+ outrel.r_info = ELF32_R_INFO (indx, R_PPC_DTPMOD32);
+ if (tls_ty == (TLS_TLS | TLS_GD))
+ {
+ loc = htab->relgot->contents;
+ loc += (htab->relgot->reloc_count++
+ * sizeof (Elf32_External_Rela));
+ bfd_elf32_swap_reloca_out (output_bfd,
+ &outrel, loc);
+ outrel.r_offset += 4;
+ outrel.r_info
+ = ELF32_R_INFO (indx, R_PPC_DTPREL32);
+ }
+ }
+ else if (tls_ty == (TLS_TLS | TLS_DTPREL))
+ outrel.r_info = ELF32_R_INFO (indx, R_PPC_DTPREL32);
+ else if (tls_ty == (TLS_TLS | TLS_TPREL))
+ outrel.r_info = ELF32_R_INFO (indx, R_PPC_TPREL32);
+ else if (indx == 0)
+ outrel.r_info = ELF32_R_INFO (indx, R_PPC_RELATIVE);
+ else
+ outrel.r_info = ELF32_R_INFO (indx, R_PPC_GLOB_DAT);
+ if (indx == 0)
+ {
+ outrel.r_addend += relocation;
+ if (tls_ty & (TLS_GD | TLS_DTPREL | TLS_TPREL))
+ outrel.r_addend -= htab->elf.tls_sec->vma;
+ }
+ loc = htab->relgot->contents;
+ loc += (htab->relgot->reloc_count++
+ * sizeof (Elf32_External_Rela));
+ bfd_elf32_swap_reloca_out (output_bfd, &outrel, loc);
+ }
+
+ /* Init the .got section contents if we're not
+ emitting a reloc. */
+ else
+ {
+ bfd_vma value = relocation;
+
+ if (tls_ty == (TLS_TLS | TLS_LD))
+ value = 1;
+ else if (tls_ty != 0)
+ {
+ value -= htab->elf.tls_sec->vma + DTP_OFFSET;
+ if (tls_ty == (TLS_TLS | TLS_TPREL))
+ value += DTP_OFFSET - TP_OFFSET;
+
+ if (tls_ty == (TLS_TLS | TLS_GD))
+ {
+ bfd_put_32 (output_bfd, value,
+ htab->got->contents + off + 4);
+ value = 1;
+ }
+ }
+ bfd_put_32 (output_bfd, value,
+ htab->got->contents + off);
+ }
+
+ off += 4;
+ if (tls_ty & (TLS_LD | TLS_GD))
+ off += 4;
+ }
+ while (tls_m != 0);
+
+ off = *offp;
+ *offp = off | 1;
+ }
+
+ if (off >= (bfd_vma) -2)
+ abort ();
+
+ if ((tls_type & TLS_TLS) != 0)
+ {
+ if (tls_type != (TLS_TLS | TLS_LD))
+ {
+ if ((tls_mask & TLS_LD) != 0
+ && !(h == NULL
+ || !(h->elf_link_hash_flags
+ & ELF_LINK_HASH_DEF_DYNAMIC)))
+ off += 8;
+ if (tls_type != (TLS_TLS | TLS_GD))
+ {
+ if ((tls_mask & TLS_GD) != 0)
+ off += 8;
+ if (tls_type != (TLS_TLS | TLS_DTPREL))
+ {
+ if ((tls_mask & TLS_DTPREL) != 0)
+ off += 4;
+ }
+ }
+ }
+ }
+
+ relocation = htab->got->output_offset + off - 4;
+
+ /* Addends on got relocations don't make much sense.
+ x+off@got is actually x@got+off, and since the got is
+ generated by a hash table traversal, the value in the
+ got at entry m+n bears little relation to the entry m. */
+ if (addend != 0)
+ (*_bfd_error_handler)
+ (_("%s(%s+0x%lx): non-zero addend on %s reloc against `%s'"),
+ bfd_archive_filename (input_bfd),
+ bfd_get_section_name (input_bfd, input_section),
+ (long) rel->r_offset,
+ howto->name,
+ sym_name);
+ }
+ break;
+
/* Relocations that need no special processing. */
- case (int) R_PPC_LOCAL24PC:
+ case R_PPC_LOCAL24PC:
/* It makes no sense to point a local relocation
at a symbol not in this object. */
- if (h != NULL
- && (h->root.type == bfd_link_hash_defined
- || h->root.type == bfd_link_hash_defweak)
- && sec->output_section == NULL)
+ if (unresolved_reloc)
{
if (! (*info->callbacks->undefined_symbol) (info,
h->root.root.string,
input_bfd,
input_section,
rel->r_offset,
- true))
- return false;
+ TRUE))
+ return FALSE;
continue;
}
break;
- /* Relocations that may need to be propagated if this is a shared
- object. */
- case (int) R_PPC_REL24:
- case (int) R_PPC_REL32:
- case (int) R_PPC_REL14:
+ case R_PPC_DTPREL16:
+ case R_PPC_DTPREL16_LO:
+ case R_PPC_DTPREL16_HI:
+ case R_PPC_DTPREL16_HA:
+ addend -= htab->elf.tls_sec->vma + DTP_OFFSET;
+ break;
+
+ /* Relocations that may need to be propagated if this is a shared
+ object. */
+ case R_PPC_TPREL16:
+ case R_PPC_TPREL16_LO:
+ case R_PPC_TPREL16_HI:
+ case R_PPC_TPREL16_HA:
+ addend -= htab->elf.tls_sec->vma + TP_OFFSET;
+ /* The TPREL16 relocs shouldn't really be used in shared
+ libs as they will result in DT_TEXTREL being set, but
+ support them anyway. */
+ goto dodyn;
+
+ case R_PPC_TPREL32:
+ addend -= htab->elf.tls_sec->vma + TP_OFFSET;
+ goto dodyn;
+
+ case R_PPC_DTPREL32:
+ addend -= htab->elf.tls_sec->vma + DTP_OFFSET;
+ goto dodyn;
+
+ case R_PPC_DTPMOD32:
+ relocation = 1;
+ addend = 0;
+ goto dodyn;
+
+ case R_PPC_REL24:
+ case R_PPC_REL32:
+ case R_PPC_REL14:
+ case R_PPC_REL14_BRTAKEN:
+ case R_PPC_REL14_BRNTAKEN:
/* If these relocations are not to a named symbol, they can be
handled right here, no need to bother the dynamic linker. */
- if (h == NULL
- || strcmp (h->root.root.string, "_GLOBAL_OFFSET_TABLE_") == 0
- || SYMBOL_REFERENCES_LOCAL (info, h))
+ if (SYMBOL_REFERENCES_LOCAL (info, h)
+ || strcmp (h->root.root.string, "_GLOBAL_OFFSET_TABLE_") == 0)
break;
- /* fall through */
-
- /* Relocations that always need to be propagated if this is a shared
- object. */
- case (int) R_PPC_ADDR32:
- case (int) R_PPC_ADDR24:
- case (int) R_PPC_ADDR16:
- case (int) R_PPC_ADDR16_LO:
- case (int) R_PPC_ADDR16_HI:
- case (int) R_PPC_ADDR16_HA:
- case (int) R_PPC_ADDR14:
- case (int) R_PPC_UADDR32:
- case (int) R_PPC_UADDR16:
- if (info->shared && r_symndx != 0)
+ /* fall through */
+
+ /* Relocations that always need to be propagated if this is a shared
+ object. */
+ case R_PPC_ADDR32:
+ case R_PPC_ADDR24:
+ case R_PPC_ADDR16:
+ case R_PPC_ADDR16_LO:
+ case R_PPC_ADDR16_HI:
+ case R_PPC_ADDR16_HA:
+ case R_PPC_ADDR14:
+ case R_PPC_ADDR14_BRTAKEN:
+ case R_PPC_ADDR14_BRNTAKEN:
+ case R_PPC_UADDR32:
+ case R_PPC_UADDR16:
+ /* r_symndx will be zero only for relocs against symbols
+ from removed linkonce sections, or sections discarded by
+ a linker script. */
+ dodyn:
+ if (r_symndx == 0)
+ break;
+ /* Fall thru. */
+
+ if ((info->shared
+ && (h == NULL
+ || ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
+ || h->root.type != bfd_link_hash_undefweak)
+ && (MUST_BE_DYN_RELOC (r_type)
+ || !SYMBOL_CALLS_LOCAL (info, h)))
+ || (ELIMINATE_COPY_RELOCS
+ && !info->shared
+ && (input_section->flags & SEC_ALLOC) != 0
+ && h != NULL
+ && h->dynindx != -1
+ && (h->elf_link_hash_flags & ELF_LINK_NON_GOT_REF) == 0
+ && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) != 0
+ && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0))
{
- Elf_Internal_Rela outrel;
int skip;
#ifdef DEBUG
- fprintf (stderr, "ppc_elf_relocate_section need to create relocation for %s\n",
- (h && h->root.root.string) ? h->root.root.string : "<unknown>");
+ fprintf (stderr, "ppc_elf_relocate_section needs to "
+ "create relocation for %s\n",
+ (h && h->root.root.string
+ ? h->root.root.string : "<unknown>"));
#endif
/* When generating a shared object, these relocations
- are copied into the output file to be resolved at run
- time. */
-
+ are copied into the output file to be resolved at run
+ time. */
if (sreloc == NULL)
{
const char *name;
@@ -3201,14 +5320,14 @@ ppc_elf_relocate_section (output_bfd, info, input_bfd, input_section,
elf_elfheader (input_bfd)->e_shstrndx,
elf_section_data (input_section)->rel_hdr.sh_name));
if (name == NULL)
- return false;
+ 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);
+ sreloc = bfd_get_section_by_name (htab->elf.dynobj, name);
BFD_ASSERT (sreloc != NULL);
}
@@ -3225,67 +5344,56 @@ ppc_elf_relocate_section (output_bfd, info, input_bfd, input_section,
if (skip)
memset (&outrel, 0, sizeof outrel);
- /* h->dynindx may be -1 if this symbol was marked to
- become local. */
- else if (! will_become_local)
+ else if (!SYMBOL_REFERENCES_LOCAL (info, h))
{
+ unresolved_reloc = FALSE;
outrel.r_info = ELF32_R_INFO (h->dynindx, r_type);
outrel.r_addend = rel->r_addend;
}
else
{
+ outrel.r_addend = relocation + rel->r_addend;
+
if (r_type == R_PPC_ADDR32)
- {
- outrel.r_info = ELF32_R_INFO (0, R_PPC_RELATIVE);
- outrel.r_addend = relocation + rel->r_addend;
- }
+ outrel.r_info = ELF32_R_INFO (0, R_PPC_RELATIVE);
else
{
long indx;
- if (h == NULL)
- sec = local_sections[r_symndx];
- else
- {
- BFD_ASSERT (h->root.type == bfd_link_hash_defined
- || (h->root.type
- == bfd_link_hash_defweak));
- sec = h->root.u.def.section;
- }
- if (sec != NULL && bfd_is_abs_section (sec))
+ if (bfd_is_abs_section (sec))
indx = 0;
else if (sec == NULL || sec->owner == NULL)
{
bfd_set_error (bfd_error_bad_value);
- return false;
+ return FALSE;
}
else
{
asection *osec;
+ /* We are turning this relocation into one
+ against a section symbol. It would be
+ proper to subtract the symbol's value,
+ osec->vma, from the emitted reloc addend,
+ but ld.so expects buggy relocs. */
osec = sec->output_section;
indx = elf_section_data (osec)->dynindx;
BFD_ASSERT (indx > 0);
#ifdef DEBUG
if (indx <= 0)
- {
- printf ("indx=%d section=%s flags=%08x name=%s\n",
- indx, osec->name, osec->flags,
- h->root.root.string);
- }
+ printf ("indx=%d section=%s flags=%08x name=%s\n",
+ indx, osec->name, osec->flags,
+ h->root.root.string);
#endif
}
outrel.r_info = ELF32_R_INFO (indx, r_type);
- outrel.r_addend = relocation + rel->r_addend;
}
}
- bfd_elf32_swap_reloca_out (output_bfd, &outrel,
- (((Elf32_External_Rela *)
- sreloc->contents)
- + sreloc->reloc_count));
- ++sreloc->reloc_count;
+ loc = sreloc->contents;
+ loc += sreloc->reloc_count++ * sizeof (Elf32_External_Rela);
+ bfd_elf32_swap_reloca_out (output_bfd, &outrel, loc);
if (skip == -1)
continue;
@@ -3301,252 +5409,175 @@ ppc_elf_relocate_section (output_bfd, info, input_bfd, input_section,
break;
}
}
-
- /* Arithmetic adjust relocations that aren't going into a
- shared object. */
- if (r_type == R_PPC_ADDR16_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). */
- && sec != NULL)
- {
- addend += ((relocation + addend) & 0x8000) << 1;
- }
break;
- /* branch taken prediction relocations */
- case (int) R_PPC_ADDR14_BRTAKEN:
- case (int) R_PPC_REL14_BRTAKEN:
- insn = bfd_get_32 (output_bfd, contents + offset);
- if ((relocation - offset) & 0x8000)
- insn &= ~BRANCH_PREDICT_BIT;
- else
- insn |= BRANCH_PREDICT_BIT;
- bfd_put_32 (output_bfd, (bfd_vma) insn, contents + offset);
- break;
-
- /* branch not taken predicition relocations */
- case (int) R_PPC_ADDR14_BRNTAKEN:
- case (int) R_PPC_REL14_BRNTAKEN:
- insn = bfd_get_32 (output_bfd, contents + offset);
- if ((relocation - offset) & 0x8000)
- insn |= BRANCH_PREDICT_BIT;
- else
- insn &= ~BRANCH_PREDICT_BIT;
- bfd_put_32 (output_bfd, (bfd_vma) insn, contents + offset);
- break;
-
- /* GOT16 relocations */
- case (int) R_PPC_GOT16:
- case (int) R_PPC_GOT16_LO:
- case (int) R_PPC_GOT16_HI:
- case (int) R_PPC_GOT16_HA:
- /* Relocation is to the entry for this symbol in the global
- offset table. */
- BFD_ASSERT (sgot != NULL);
-
- if (h != NULL)
- {
- bfd_vma off;
-
- off = h->got.offset;
- BFD_ASSERT (off != (bfd_vma) -1);
-
- if (! elf_hash_table (info)->dynamic_sections_created
- || (info->shared
- && SYMBOL_REFERENCES_LOCAL (info, h)))
- {
- /* This is actually a static link, or it is a
- -Bsymbolic link and the symbol is defined
- locally. 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,
- sgot->contents + off);
- h->got.offset |= 1;
- }
- }
-
- relocation = sgot->output_offset + off - 4;
- }
- else
- {
- bfd_vma off;
+ case R_PPC_RELAX32PC:
+ relocation -= (input_section->output_section->vma
+ + input_section->output_offset
+ + rel->r_offset - 4);
+ /* Fall thru */
+ case R_PPC_RELAX32:
+ {
+ unsigned long t0;
+ unsigned long t1;
- BFD_ASSERT (local_got_offsets != NULL
- && local_got_offsets[r_symndx] != (bfd_vma) -1);
+ t0 = bfd_get_32 (output_bfd, contents + rel->r_offset);
+ t1 = bfd_get_32 (output_bfd, contents + rel->r_offset + 4);
- off = local_got_offsets[r_symndx];
+ /* We're clearing the bits for R_PPC_ADDR16_HA
+ and R_PPC_ADDR16_LO here. */
+ t0 &= ~0xffff;
+ t1 &= ~0xffff;
- /* 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
- {
+ /* t0 is HA, t1 is LO */
+ relocation += addend;
+ t0 |= ((relocation + 0x8000) >> 16) & 0xffff;
+ t1 |= relocation & 0xffff;
- if (info->shared)
- {
- asection *srelgot;
- Elf_Internal_Rela outrel;
-
- /* We need to generate a R_PPC_RELATIVE reloc
- for the dynamic linker. */
- srelgot = bfd_get_section_by_name (dynobj, ".rela.got");
- BFD_ASSERT (srelgot != NULL);
-
- outrel.r_offset = (sgot->output_section->vma
- + sgot->output_offset
- + off);
- outrel.r_info = ELF32_R_INFO (0, R_PPC_RELATIVE);
- outrel.r_addend = relocation;
- bfd_elf32_swap_reloca_out (output_bfd, &outrel,
- (((Elf32_External_Rela *)
- srelgot->contents)
- + srelgot->reloc_count));
- ++srelgot->reloc_count;
- relocation = 0;
- }
-
- bfd_put_32 (output_bfd, relocation, sgot->contents + off);
- local_got_offsets[r_symndx] |= 1;
- }
-
- relocation = sgot->output_offset + off - 4;
- }
- break;
+ bfd_put_32 (output_bfd, t0, contents + rel->r_offset);
+ bfd_put_32 (output_bfd, t1, contents + rel->r_offset + 4);
+ }
+ continue;
- /* Indirect .sdata relocation */
- case (int) R_PPC_EMB_SDAI16:
- BFD_ASSERT (sdata != NULL);
- relocation = bfd_elf32_finish_pointer_linker_section (output_bfd, input_bfd, info,
- sdata, h, relocation, rel,
- R_PPC_RELATIVE);
+ /* Indirect .sdata relocation. */
+ case R_PPC_EMB_SDAI16:
+ BFD_ASSERT (htab->sdata != NULL);
+ relocation
+ = elf_finish_pointer_linker_section (output_bfd, input_bfd, info,
+ htab->sdata, h, relocation,
+ rel, R_PPC_RELATIVE);
break;
- /* Indirect .sdata2 relocation */
- case (int) R_PPC_EMB_SDA2I16:
- BFD_ASSERT (sdata2 != NULL);
- relocation = bfd_elf32_finish_pointer_linker_section (output_bfd, input_bfd, info,
- sdata2, h, relocation, rel,
- R_PPC_RELATIVE);
+ /* Indirect .sdata2 relocation. */
+ case R_PPC_EMB_SDA2I16:
+ BFD_ASSERT (htab->sdata2 != NULL);
+ relocation
+ = elf_finish_pointer_linker_section (output_bfd, input_bfd, info,
+ htab->sdata2, h, relocation,
+ rel, R_PPC_RELATIVE);
break;
- /* Handle the TOC16 reloc. We want to use the offset within the .got
- section, not the actual VMA. This is appropriate when generating
- an embedded ELF object, for which the .got section acts like the
- AIX .toc section. */
- case (int) R_PPC_TOC16: /* phony GOT16 relocations */
- BFD_ASSERT (sec != (asection *) 0);
+ /* Handle the TOC16 reloc. We want to use the offset within the .got
+ section, not the actual VMA. This is appropriate when generating
+ an embedded ELF object, for which the .got section acts like the
+ AIX .toc section. */
+ case R_PPC_TOC16: /* phony GOT16 relocations */
+ BFD_ASSERT (sec != NULL);
BFD_ASSERT (bfd_is_und_section (sec)
|| strcmp (bfd_get_section_name (abfd, sec), ".got") == 0
|| strcmp (bfd_get_section_name (abfd, sec), ".cgot") == 0)
- addend -= sec->output_section->vma + sec->output_offset + 0x8000;
+ addend -= sec->output_section->vma + sec->output_offset + 0x8000;
break;
- case (int) R_PPC_PLTREL24:
+ case R_PPC_PLTREL24:
/* Relocation is to the entry for this symbol in the
- procedure linkage table. */
+ procedure linkage table. */
BFD_ASSERT (h != NULL);
if (h->plt.offset == (bfd_vma) -1
- || splt == 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. */
+ happens when statically linking PIC code, or when
+ using -Bsymbolic. */
break;
}
- relocation = (splt->output_section->vma
- + splt->output_offset
+ unresolved_reloc = FALSE;
+ relocation = (htab->plt->output_section->vma
+ + htab->plt->output_offset
+ h->plt.offset);
break;
- /* relocate against _SDA_BASE_ */
- case (int) R_PPC_SDAREL16:
+ /* Relocate against _SDA_BASE_. */
+ case R_PPC_SDAREL16:
{
const char *name;
+ const struct elf_link_hash_entry *sh;
- BFD_ASSERT (sec != (asection *) 0);
+ BFD_ASSERT (sec != NULL);
name = bfd_get_section_name (abfd, sec->output_section);
- if (strcmp (name, ".sdata") != 0
- && strcmp (name, ".sbss") != 0)
+ if (! ((strncmp (name, ".sdata", 6) == 0
+ && (name[6] == 0 || name[6] == '.'))
+ || (strncmp (name, ".sbss", 5) == 0
+ && (name[5] == 0 || name[5] == '.'))))
{
- (*_bfd_error_handler) (_("%s: The target (%s) of a %s relocation is in the wrong output section (%s)"),
- bfd_archive_filename (input_bfd),
- sym_name,
- ppc_elf_howto_table[(int) r_type]->name,
- name);
+ (*_bfd_error_handler)
+ (_("%s: the target (%s) of a %s relocation is "
+ "in the wrong output section (%s)"),
+ bfd_archive_filename (input_bfd),
+ sym_name,
+ howto->name,
+ name);
}
- addend -= (sdata->sym_hash->root.u.def.value
- + sdata->sym_hash->root.u.def.section->output_section->vma
- + sdata->sym_hash->root.u.def.section->output_offset);
+ sh = htab->sdata->sym_hash;
+ addend -= (sh->root.u.def.value
+ + sh->root.u.def.section->output_section->vma
+ + sh->root.u.def.section->output_offset);
}
break;
- /* relocate against _SDA2_BASE_ */
- case (int) R_PPC_EMB_SDA2REL:
+ /* Relocate against _SDA2_BASE_. */
+ case R_PPC_EMB_SDA2REL:
{
const char *name;
+ const struct elf_link_hash_entry *sh;
- BFD_ASSERT (sec != (asection *) 0);
+ BFD_ASSERT (sec != NULL);
name = bfd_get_section_name (abfd, sec->output_section);
- if (strcmp (name, ".sdata2") != 0 && strcmp (name, ".sbss2") != 0)
+ if (! (strncmp (name, ".sdata2", 7) == 0
+ || strncmp (name, ".sbss2", 6) == 0))
{
- (*_bfd_error_handler) (_("%s: The target (%s) of a %s relocation is in the wrong output section (%s)"),
- bfd_archive_filename (input_bfd),
- sym_name,
- ppc_elf_howto_table[(int) r_type]->name,
- name);
+ (*_bfd_error_handler)
+ (_("%s: the target (%s) of a %s relocation is "
+ "in the wrong output section (%s)"),
+ bfd_archive_filename (input_bfd),
+ sym_name,
+ howto->name,
+ name);
bfd_set_error (bfd_error_bad_value);
- ret = false;
+ ret = FALSE;
continue;
}
- addend -= (sdata2->sym_hash->root.u.def.value
- + sdata2->sym_hash->root.u.def.section->output_section->vma
- + sdata2->sym_hash->root.u.def.section->output_offset);
+ sh = htab->sdata2->sym_hash;
+ addend -= (sh->root.u.def.value
+ + sh->root.u.def.section->output_section->vma
+ + sh->root.u.def.section->output_offset);
}
break;
- /* relocate against either _SDA_BASE_, _SDA2_BASE_, or 0 */
- case (int) R_PPC_EMB_SDA21:
- case (int) R_PPC_EMB_RELSDA:
+ /* Relocate against either _SDA_BASE_, _SDA2_BASE_, or 0. */
+ case R_PPC_EMB_SDA21:
+ case R_PPC_EMB_RELSDA:
{
const char *name;
+ const struct elf_link_hash_entry *sh;
int reg;
- BFD_ASSERT (sec != (asection *) 0);
+ BFD_ASSERT (sec != NULL);
name = bfd_get_section_name (abfd, sec->output_section);
- if (strcmp (name, ".sdata") == 0 || strcmp (name, ".sbss") == 0)
+ if (((strncmp (name, ".sdata", 6) == 0
+ && (name[6] == 0 || name[6] == '.'))
+ || (strncmp (name, ".sbss", 5) == 0
+ && (name[5] == 0 || name[5] == '.'))))
{
reg = 13;
- addend -= (sdata->sym_hash->root.u.def.value
- + sdata->sym_hash->root.u.def.section->output_section->vma
- + sdata->sym_hash->root.u.def.section->output_offset);
+ sh = htab->sdata->sym_hash;
+ addend -= (sh->root.u.def.value
+ + sh->root.u.def.section->output_section->vma
+ + sh->root.u.def.section->output_offset);
}
- else if (strcmp (name, ".sdata2") == 0
- || strcmp (name, ".sbss2") == 0)
+ else if (strncmp (name, ".sdata2", 7) == 0
+ || strncmp (name, ".sbss2", 6) == 0)
{
reg = 2;
- addend -= (sdata2->sym_hash->root.u.def.value
- + sdata2->sym_hash->root.u.def.section->output_section->vma
- + sdata2->sym_hash->root.u.def.section->output_offset);
+ sh = htab->sdata2->sym_hash;
+ addend -= (sh->root.u.def.value
+ + sh->root.u.def.section->output_section->vma
+ + sh->root.u.def.section->output_offset);
}
else if (strcmp (name, ".PPC.EMB.sdata0") == 0
@@ -3557,114 +5588,144 @@ ppc_elf_relocate_section (output_bfd, info, input_bfd, input_section,
else
{
- (*_bfd_error_handler) (_("%s: The target (%s) of a %s relocation is in the wrong output section (%s)"),
- bfd_archive_filename (input_bfd),
- sym_name,
- ppc_elf_howto_table[(int) r_type]->name,
- name);
+ (*_bfd_error_handler)
+ (_("%s: the target (%s) of a %s relocation is "
+ "in the wrong output section (%s)"),
+ bfd_archive_filename (input_bfd),
+ sym_name,
+ howto->name,
+ name);
bfd_set_error (bfd_error_bad_value);
- ret = false;
+ ret = FALSE;
continue;
}
if (r_type == R_PPC_EMB_SDA21)
{ /* fill in register field */
- insn = bfd_get_32 (output_bfd, contents + offset);
+ insn = bfd_get_32 (output_bfd, contents + rel->r_offset);
insn = (insn & ~RA_REGISTER_MASK) | (reg << RA_REGISTER_SHIFT);
- bfd_put_32 (output_bfd, (bfd_vma) insn, contents + offset);
+ bfd_put_32 (output_bfd, insn, contents + rel->r_offset);
}
}
break;
- /* Relocate against the beginning of the section */
- case (int) R_PPC_SECTOFF:
- case (int) R_PPC_SECTOFF_LO:
- case (int) R_PPC_SECTOFF_HI:
- BFD_ASSERT (sec != (asection *) 0);
- addend -= sec->output_section->vma;
- break;
-
- case (int) R_PPC_SECTOFF_HA:
- BFD_ASSERT (sec != (asection *) 0);
+ /* Relocate against the beginning of the section. */
+ case R_PPC_SECTOFF:
+ case R_PPC_SECTOFF_LO:
+ case R_PPC_SECTOFF_HI:
+ case R_PPC_SECTOFF_HA:
+ BFD_ASSERT (sec != NULL);
addend -= sec->output_section->vma;
- addend += ((relocation + addend) & 0x8000) << 1;
- break;
-
- /* Negative relocations */
- case (int) R_PPC_EMB_NADDR32:
- case (int) R_PPC_EMB_NADDR16:
- case (int) R_PPC_EMB_NADDR16_LO:
- case (int) R_PPC_EMB_NADDR16_HI:
- addend -= 2 * relocation;
break;
- case (int) R_PPC_EMB_NADDR16_HA:
+ /* Negative relocations. */
+ case R_PPC_EMB_NADDR32:
+ case R_PPC_EMB_NADDR16:
+ case R_PPC_EMB_NADDR16_LO:
+ case R_PPC_EMB_NADDR16_HI:
+ case R_PPC_EMB_NADDR16_HA:
addend -= 2 * relocation;
- addend += ((relocation + addend) & 0x8000) << 1;
break;
- /* NOP relocation that prevents garbage collecting linkers from omitting a
- reference. */
- case (int) R_PPC_EMB_MRKREF:
- continue;
-
- case (int) R_PPC_COPY:
- case (int) R_PPC_GLOB_DAT:
- case (int) R_PPC_JMP_SLOT:
- case (int) R_PPC_RELATIVE:
- case (int) R_PPC_PLT32:
- case (int) R_PPC_PLTREL32:
- case (int) R_PPC_PLT16_LO:
- case (int) R_PPC_PLT16_HI:
- case (int) R_PPC_PLT16_HA:
- case (int) R_PPC_EMB_RELSEC16:
- case (int) R_PPC_EMB_RELST_LO:
- case (int) R_PPC_EMB_RELST_HI:
- case (int) R_PPC_EMB_RELST_HA:
- case (int) R_PPC_EMB_BIT_FLD:
- (*_bfd_error_handler) (_("%s: Relocation %s is not yet supported for symbol %s."),
- bfd_archive_filename (input_bfd),
- ppc_elf_howto_table[(int) r_type]->name,
- sym_name);
+ case R_PPC_COPY:
+ case R_PPC_GLOB_DAT:
+ case R_PPC_JMP_SLOT:
+ case R_PPC_RELATIVE:
+ case R_PPC_PLT32:
+ case R_PPC_PLTREL32:
+ case R_PPC_PLT16_LO:
+ case R_PPC_PLT16_HI:
+ case R_PPC_PLT16_HA:
+ case R_PPC_ADDR30:
+ case R_PPC_EMB_RELSEC16:
+ case R_PPC_EMB_RELST_LO:
+ case R_PPC_EMB_RELST_HI:
+ case R_PPC_EMB_RELST_HA:
+ case R_PPC_EMB_BIT_FLD:
+ (*_bfd_error_handler)
+ (_("%s: relocation %s is not yet supported for symbol %s."),
+ bfd_archive_filename (input_bfd),
+ howto->name,
+ sym_name);
bfd_set_error (bfd_error_invalid_operation);
- ret = false;
+ ret = FALSE;
continue;
+ }
- case (int) R_PPC_GNU_VTINHERIT:
- case (int) R_PPC_GNU_VTENTRY:
- /* These are no-ops in the end. */
- continue;
+ /* Do any further special processing. */
+ switch (r_type)
+ {
+ default:
+ break;
+
+ case R_PPC_ADDR16_HA:
+ case R_PPC_GOT16_HA:
+ case R_PPC_PLT16_HA:
+ case R_PPC_SECTOFF_HA:
+ case R_PPC_TPREL16_HA:
+ case R_PPC_DTPREL16_HA:
+ case R_PPC_GOT_TLSGD16_HA:
+ case R_PPC_GOT_TLSLD16_HA:
+ case R_PPC_GOT_TPREL16_HA:
+ case R_PPC_GOT_DTPREL16_HA:
+ case R_PPC_EMB_NADDR16_HA:
+ case R_PPC_EMB_RELST_HA:
+ /* It's just possible that this symbol is a weak symbol
+ that's not actually defined anywhere. In that case,
+ 'sec' would be NULL, and we should leave the symbol
+ alone (it will be set to zero elsewhere in the link). */
+ if (sec != NULL)
+ /* Add 0x10000 if sign bit in 0:15 is set.
+ Bits 0:15 are not used. */
+ addend += 0x8000;
+ break;
}
#ifdef DEBUG
- fprintf (stderr, "\ttype = %s (%d), name = %s, symbol index = %ld, offset = %ld, addend = %ld\n",
+ fprintf (stderr, "\ttype = %s (%d), name = %s, symbol index = %ld, "
+ "offset = %ld, addend = %ld\n",
howto->name,
(int) r_type,
sym_name,
r_symndx,
- (long) offset,
+ (long) rel->r_offset,
(long) addend);
#endif
+ if (unresolved_reloc
+ && !((input_section->flags & SEC_DEBUGGING) != 0
+ && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) != 0))
+ {
+ (*_bfd_error_handler)
+ (_("%s(%s+0x%lx): unresolvable %s relocation against symbol `%s'"),
+ bfd_archive_filename (input_bfd),
+ bfd_get_section_name (input_bfd, input_section),
+ (long) rel->r_offset,
+ howto->name,
+ sym_name);
+ ret = FALSE;
+ }
+
r = _bfd_final_link_relocate (howto,
input_bfd,
input_section,
contents,
- offset,
+ rel->r_offset,
relocation,
addend);
- if (r == bfd_reloc_ok)
- ;
- else if (r == bfd_reloc_overflow)
+ if (r != bfd_reloc_ok)
{
- const char *name;
-
- if (h != NULL)
+ if (sym_name == NULL)
+ sym_name = "(null)";
+ if (r == bfd_reloc_overflow)
{
- if (h->root.type == bfd_link_hash_undefweak
+ if (warned)
+ continue;
+ if (h != NULL
+ && h->root.type == bfd_link_hash_undefweak
&& howto->pc_relative)
{
/* Assume this is a call protected by other code that
@@ -3676,30 +5737,25 @@ ppc_elf_relocate_section (output_bfd, info, input_bfd, input_section,
continue;
}
- name = h->root.root.string;
+ if (! (*info->callbacks->reloc_overflow) (info,
+ sym_name,
+ howto->name,
+ rel->r_addend,
+ input_bfd,
+ input_section,
+ rel->r_offset))
+ return FALSE;
}
else
{
- name = bfd_elf_string_from_elf_section (input_bfd,
- symtab_hdr->sh_link,
- sym->st_name);
- if (name == NULL)
- continue;
- if (*name == '\0')
- name = bfd_section_name (input_bfd, sec);
+ (*_bfd_error_handler)
+ (_("%s(%s+0x%lx): %s reloc against `%s': error %d"),
+ bfd_archive_filename (input_bfd),
+ bfd_get_section_name (input_bfd, input_section),
+ (long) rel->r_offset, howto->name, sym_name, (int) r);
+ ret = FALSE;
}
-
- if (! (*info->callbacks->reloc_overflow) (info,
- name,
- howto->name,
- (bfd_vma) 0,
- input_bfd,
- input_section,
- offset))
- return false;
}
- else
- ret = false;
}
#ifdef DEBUG
@@ -3710,10 +5766,9 @@ ppc_elf_relocate_section (output_bfd, info, input_bfd, input_section,
}
static enum elf_reloc_type_class
-ppc_elf_reloc_type_class (rela)
- const Elf_Internal_Rela *rela;
+ppc_elf_reloc_type_class (const Elf_Internal_Rela *rela)
{
- switch ((int) ELF32_R_TYPE (rela->r_info))
+ switch (ELF32_R_TYPE (rela->r_info))
{
case R_PPC_RELATIVE:
return reloc_class_relative;
@@ -3728,32 +5783,31 @@ ppc_elf_reloc_type_class (rela)
}
}
-/* Support for core dump NOTE sections */
-static boolean
-ppc_elf_grok_prstatus (abfd, note)
- bfd *abfd;
- Elf_Internal_Note *note;
+/* Support for core dump NOTE sections. */
+
+static bfd_boolean
+ppc_elf_grok_prstatus (bfd *abfd, Elf_Internal_Note *note)
{
int offset;
unsigned int raw_size;
switch (note->descsz)
{
- default:
- return false;
+ default:
+ return FALSE;
- case 268: /* Linux/PPC */
- /* pr_cursig */
- elf_tdata (abfd)->core_signal = bfd_get_16 (abfd, note->descdata + 12);
+ case 268: /* Linux/PPC. */
+ /* pr_cursig */
+ elf_tdata (abfd)->core_signal = bfd_get_16 (abfd, note->descdata + 12);
- /* pr_pid */
- elf_tdata (abfd)->core_pid = bfd_get_32 (abfd, note->descdata + 24);
+ /* pr_pid */
+ elf_tdata (abfd)->core_pid = bfd_get_32 (abfd, note->descdata + 24);
- /* pr_reg */
- offset = 72;
- raw_size = 192;
+ /* pr_reg */
+ offset = 72;
+ raw_size = 192;
- break;
+ break;
}
/* Make a ".reg/999" section. */
@@ -3761,21 +5815,19 @@ ppc_elf_grok_prstatus (abfd, note)
raw_size, note->descpos + offset);
}
-static boolean
-ppc_elf_grok_psinfo (abfd, note)
- bfd *abfd;
- Elf_Internal_Note *note;
+static bfd_boolean
+ppc_elf_grok_psinfo (bfd *abfd, Elf_Internal_Note *note)
{
switch (note->descsz)
{
- default:
- return false;
+ default:
+ return FALSE;
- case 128: /* Linux/PPC elf_prpsinfo */
- elf_tdata (abfd)->core_program
- = _bfd_elfcore_strndup (abfd, note->descdata + 32, 16);
- elf_tdata (abfd)->core_command
- = _bfd_elfcore_strndup (abfd, note->descdata + 48, 80);
+ case 128: /* Linux/PPC elf_prpsinfo. */
+ elf_tdata (abfd)->core_program
+ = _bfd_elfcore_strndup (abfd, note->descdata + 32, 16);
+ elf_tdata (abfd)->core_command
+ = _bfd_elfcore_strndup (abfd, note->descdata + 48, 80);
}
/* Note that for some reason, a spurious space is tacked
@@ -3790,16 +5842,322 @@ ppc_elf_grok_psinfo (abfd, note)
command[n - 1] = '\0';
}
- return true;
+ return TRUE;
}
+/* Very simple linked list structure for recording apuinfo values. */
+typedef struct apuinfo_list
+{
+ struct apuinfo_list *next;
+ unsigned long value;
+}
+apuinfo_list;
+
+static apuinfo_list *head;
+
+
+static void
+apuinfo_list_init (void)
+{
+ head = NULL;
+}
+
+static void
+apuinfo_list_add (unsigned long value)
+{
+ apuinfo_list *entry = head;
+
+ while (entry != NULL)
+ {
+ if (entry->value == value)
+ return;
+ entry = entry->next;
+ }
+
+ entry = bfd_malloc (sizeof (* entry));
+ if (entry == NULL)
+ return;
+
+ entry->value = value;
+ entry->next = head;
+ head = entry;
+}
+
+static unsigned
+apuinfo_list_length (void)
+{
+ apuinfo_list *entry;
+ unsigned long count;
+
+ for (entry = head, count = 0;
+ entry;
+ entry = entry->next)
+ ++ count;
+
+ return count;
+}
+
+static inline unsigned long
+apuinfo_list_element (unsigned long number)
+{
+ apuinfo_list * entry;
+
+ for (entry = head;
+ entry && number --;
+ entry = entry->next)
+ ;
+
+ return entry ? entry->value : 0;
+}
+
+static void
+apuinfo_list_finish (void)
+{
+ apuinfo_list *entry;
+
+ for (entry = head; entry;)
+ {
+ apuinfo_list *next = entry->next;
+ free (entry);
+ entry = next;
+ }
+
+ head = NULL;
+}
+
+#define APUINFO_SECTION_NAME ".PPC.EMB.apuinfo"
+#define APUINFO_LABEL "APUinfo"
+
+/* Scan the input BFDs and create a linked list of
+ the APUinfo values that will need to be emitted. */
+
+static void
+ppc_elf_begin_write_processing (bfd *abfd, struct bfd_link_info *link_info)
+{
+ bfd *ibfd;
+ asection *asec;
+ char *buffer;
+ unsigned num_input_sections;
+ bfd_size_type output_section_size;
+ unsigned i;
+ unsigned num_entries;
+ unsigned long offset;
+ unsigned long length;
+ const char *error_message = NULL;
+
+ if (link_info == NULL)
+ return;
+
+ /* Scan the input bfds, looking for apuinfo sections. */
+ num_input_sections = 0;
+ output_section_size = 0;
+
+ for (ibfd = link_info->input_bfds; ibfd; ibfd = ibfd->link_next)
+ {
+ asec = bfd_get_section_by_name (ibfd, APUINFO_SECTION_NAME);
+ if (asec)
+ {
+ ++ num_input_sections;
+ output_section_size += asec->_raw_size;
+ }
+ }
+
+ /* We need at least one input sections
+ in order to make merging worthwhile. */
+ if (num_input_sections < 1)
+ return;
+
+ /* Just make sure that the output section exists as well. */
+ asec = bfd_get_section_by_name (abfd, APUINFO_SECTION_NAME);
+ if (asec == NULL)
+ return;
+
+ /* Allocate a buffer for the contents of the input sections. */
+ buffer = bfd_malloc (output_section_size);
+ if (buffer == NULL)
+ return;
+
+ offset = 0;
+ apuinfo_list_init ();
+
+ /* Read in the input sections contents. */
+ for (ibfd = link_info->input_bfds; ibfd; ibfd = ibfd->link_next)
+ {
+ unsigned long datum;
+ char *ptr;
+
+ asec = bfd_get_section_by_name (ibfd, APUINFO_SECTION_NAME);
+ if (asec == NULL)
+ continue;
+
+ length = asec->_raw_size;
+ if (length < 24)
+ {
+ error_message = _("corrupt or empty %s section in %s");
+ goto fail;
+ }
+
+ if (bfd_seek (ibfd, asec->filepos, SEEK_SET) != 0
+ || (bfd_bread (buffer + offset, length, ibfd) != length))
+ {
+ error_message = _("unable to read in %s section from %s");
+ goto fail;
+ }
+
+ /* Process the contents of the section. */
+ ptr = buffer + offset;
+ error_message = _("corrupt %s section in %s");
+
+ /* Verify the contents of the header. Note - we have to
+ extract the values this way in order to allow for a
+ host whose endian-ness is different from the target. */
+ datum = bfd_get_32 (ibfd, ptr);
+ if (datum != sizeof APUINFO_LABEL)
+ goto fail;
+
+ datum = bfd_get_32 (ibfd, ptr + 8);
+ if (datum != 0x2)
+ goto fail;
+
+ if (strcmp (ptr + 12, APUINFO_LABEL) != 0)
+ goto fail;
+
+ /* Get the number of bytes used for apuinfo entries. */
+ datum = bfd_get_32 (ibfd, ptr + 4);
+ if (datum + 20 != length)
+ goto fail;
+
+ /* Make sure that we do not run off the end of the section. */
+ if (offset + length > output_section_size)
+ goto fail;
+
+ /* Scan the apuinfo section, building a list of apuinfo numbers. */
+ for (i = 0; i < datum; i += 4)
+ apuinfo_list_add (bfd_get_32 (ibfd, ptr + 20 + i));
+
+ /* Update the offset. */
+ offset += length;
+ }
+
+ error_message = NULL;
+
+ /* Compute the size of the output section. */
+ num_entries = apuinfo_list_length ();
+ output_section_size = 20 + num_entries * 4;
+
+ asec = bfd_get_section_by_name (abfd, APUINFO_SECTION_NAME);
+
+ if (! bfd_set_section_size (abfd, asec, output_section_size))
+ ibfd = abfd,
+ error_message = _("warning: unable to set size of %s section in %s");
+
+ fail:
+ free (buffer);
+
+ if (error_message)
+ (*_bfd_error_handler) (error_message, APUINFO_SECTION_NAME,
+ bfd_archive_filename (ibfd));
+}
+
+
+/* Prevent the output section from accumulating the input sections'
+ contents. We have already stored this in our linked list structure. */
+
+static bfd_boolean
+ppc_elf_write_section (bfd *abfd ATTRIBUTE_UNUSED,
+ asection *asec,
+ bfd_byte *contents ATTRIBUTE_UNUSED)
+{
+ return (apuinfo_list_length ()
+ && strcmp (asec->name, APUINFO_SECTION_NAME) == 0);
+}
+
+
+/* Finally we can generate the output section. */
+
+static void
+ppc_elf_final_write_processing (bfd *abfd, bfd_boolean linker ATTRIBUTE_UNUSED)
+{
+ bfd_byte *buffer;
+ asection *asec;
+ unsigned i;
+ unsigned num_entries;
+ bfd_size_type length;
+
+ asec = bfd_get_section_by_name (abfd, APUINFO_SECTION_NAME);
+ if (asec == NULL)
+ return;
+
+ if (apuinfo_list_length () == 0)
+ return;
+
+ length = asec->_raw_size;
+ if (length < 20)
+ return;
+
+ buffer = bfd_malloc (length);
+ if (buffer == NULL)
+ {
+ (*_bfd_error_handler)
+ (_("failed to allocate space for new APUinfo section."));
+ return;
+ }
+
+ /* Create the apuinfo header. */
+ num_entries = apuinfo_list_length ();
+ bfd_put_32 (abfd, sizeof APUINFO_LABEL, buffer);
+ bfd_put_32 (abfd, num_entries * 4, buffer + 4);
+ bfd_put_32 (abfd, 0x2, buffer + 8);
+ strcpy (buffer + 12, APUINFO_LABEL);
+
+ length = 20;
+ for (i = 0; i < num_entries; i++)
+ {
+ bfd_put_32 (abfd, apuinfo_list_element (i), buffer + length);
+ length += 4;
+ }
+
+ if (length != asec->_raw_size)
+ (*_bfd_error_handler) (_("failed to compute new APUinfo section."));
+
+ if (! bfd_set_section_contents (abfd, asec, buffer, (file_ptr) 0, length))
+ (*_bfd_error_handler) (_("failed to install new APUinfo section."));
+
+ free (buffer);
+
+ apuinfo_list_finish ();
+}
+
+/* Add extra PPC sections -- Note, for now, make .sbss2 and
+ .PPC.EMB.sbss0 a normal section, and not a bss section so
+ that the linker doesn't crater when trying to make more than
+ 2 sections. */
+
+static struct bfd_elf_special_section const ppc_elf_special_sections[]=
+{
+ { ".tags", 5, 0, SHT_ORDERED, SHF_ALLOC },
+ { ".sdata", 6, -2, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE },
+ { ".sbss", 5, -2, SHT_NOBITS, SHF_ALLOC + SHF_WRITE },
+ { ".sdata2", 7, -2, SHT_PROGBITS, SHF_ALLOC },
+ { ".sbss2", 6, -2, SHT_PROGBITS, SHF_ALLOC },
+ { ".PPC.EMB.apuinfo", 16, 0, SHT_NOTE, 0 },
+ { ".PPC.EMB.sdata0", 15, 0, SHT_PROGBITS, SHF_ALLOC },
+ { ".PPC.EMB.sbss0", 14, 0, SHT_PROGBITS, SHF_ALLOC },
+ { ".plt", 4, 0, SHT_NOBITS, SHF_ALLOC + SHF_EXECINSTR },
+ { NULL, 0, 0, 0, 0 }
+};
+
#define TARGET_LITTLE_SYM bfd_elf32_powerpcle_vec
#define TARGET_LITTLE_NAME "elf32-powerpcle"
#define TARGET_BIG_SYM bfd_elf32_powerpc_vec
#define TARGET_BIG_NAME "elf32-powerpc"
#define ELF_ARCH bfd_arch_powerpc
#define ELF_MACHINE_CODE EM_PPC
+#ifdef __QNXTARGET__
+#define ELF_MAXPAGESIZE 0x1000
+#else
#define ELF_MAXPAGESIZE 0x10000
+#endif
#define elf_info_to_howto ppc_elf_info_to_howto
#ifdef EM_CYGNUS_POWERPC
@@ -3815,14 +6173,14 @@ ppc_elf_grok_psinfo (abfd, note)
#define elf_backend_can_gc_sections 1
#define elf_backend_can_refcount 1
#define elf_backend_got_header_size 12
-#define elf_backend_plt_header_size PLT_INITIAL_ENTRY_SIZE
#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_relax_section ppc_elf_relax_section
#define bfd_elf32_bfd_reloc_type_lookup ppc_elf_reloc_type_lookup
#define bfd_elf32_bfd_set_private_flags ppc_elf_set_private_flags
-#define bfd_elf32_bfd_final_link _bfd_elf32_gc_common_final_link
+#define bfd_elf32_bfd_link_hash_table_create ppc_elf_link_hash_table_create
#define elf_backend_object_p ppc_elf_object_p
#define elf_backend_gc_mark_hook ppc_elf_gc_mark_hook
@@ -3831,6 +6189,7 @@ ppc_elf_grok_psinfo (abfd, note)
#define elf_backend_relocate_section ppc_elf_relocate_section
#define elf_backend_create_dynamic_sections ppc_elf_create_dynamic_sections
#define elf_backend_check_relocs ppc_elf_check_relocs
+#define elf_backend_copy_indirect_symbol ppc_elf_copy_indirect_symbol
#define elf_backend_adjust_dynamic_symbol ppc_elf_adjust_dynamic_symbol
#define elf_backend_add_symbol_hook ppc_elf_add_symbol_hook
#define elf_backend_size_dynamic_sections ppc_elf_size_dynamic_sections
@@ -3842,5 +6201,9 @@ ppc_elf_grok_psinfo (abfd, note)
#define elf_backend_grok_prstatus ppc_elf_grok_prstatus
#define elf_backend_grok_psinfo ppc_elf_grok_psinfo
#define elf_backend_reloc_type_class ppc_elf_reloc_type_class
+#define elf_backend_begin_write_processing ppc_elf_begin_write_processing
+#define elf_backend_final_write_processing ppc_elf_final_write_processing
+#define elf_backend_write_section ppc_elf_write_section
+#define elf_backend_special_sections ppc_elf_special_sections
#include "elf32-target.h"
diff --git a/contrib/binutils/bfd/elf32-s390.c b/contrib/binutils/bfd/elf32-s390.c
index b7e2189..074c108 100644
--- a/contrib/binutils/bfd/elf32-s390.c
+++ b/contrib/binutils/bfd/elf32-s390.c
@@ -1,5 +1,5 @@
/* IBM S/390-specific support for 32-bit ELF
- Copyright 2000, 2001, 2002 Free Software Foundation, Inc.
+ Copyright 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
Contributed by Carl B. Pedersen and Martin Schwidefsky.
This file is part of BFD, the Binary File Descriptor library.
@@ -29,50 +29,67 @@ static reloc_howto_type *elf_s390_reloc_type_lookup
PARAMS ((bfd *, bfd_reloc_code_real_type));
static void elf_s390_info_to_howto
PARAMS ((bfd *, arelent *, Elf_Internal_Rela *));
-static boolean elf_s390_is_local_label_name
+static bfd_boolean elf_s390_is_local_label_name
PARAMS ((bfd *, const char *));
static struct bfd_hash_entry *link_hash_newfunc
PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, const char *));
static struct bfd_link_hash_table *elf_s390_link_hash_table_create
PARAMS ((bfd *));
-static boolean create_got_section
+static bfd_boolean create_got_section
PARAMS((bfd *, struct bfd_link_info *));
-static boolean elf_s390_create_dynamic_sections
+static bfd_boolean elf_s390_create_dynamic_sections
PARAMS((bfd *, struct bfd_link_info *));
static void elf_s390_copy_indirect_symbol
- PARAMS ((struct elf_backend_data *, struct elf_link_hash_entry *,
+ PARAMS ((const struct elf_backend_data *, struct elf_link_hash_entry *,
struct elf_link_hash_entry *));
-static boolean elf_s390_check_relocs
+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 boolean elf_s390_gc_sweep_hook
+static bfd_boolean elf_s390_gc_sweep_hook
PARAMS ((bfd *, struct bfd_link_info *, asection *,
const Elf_Internal_Rela *));
-static boolean elf_s390_adjust_dynamic_symbol
+struct elf_s390_link_hash_entry;
+static void elf_s390_adjust_gotplt
+ PARAMS ((struct elf_s390_link_hash_entry *));
+static bfd_boolean elf_s390_adjust_dynamic_symbol
PARAMS ((struct bfd_link_info *, struct elf_link_hash_entry *));
-static boolean allocate_dynrelocs
+static bfd_boolean allocate_dynrelocs
PARAMS ((struct elf_link_hash_entry *, PTR));
-static boolean readonly_dynrelocs
+static bfd_boolean readonly_dynrelocs
PARAMS ((struct elf_link_hash_entry *, PTR));
-static boolean elf_s390_size_dynamic_sections
+static bfd_boolean elf_s390_size_dynamic_sections
PARAMS ((bfd *, struct bfd_link_info *));
-static boolean elf_s390_relocate_section
+static bfd_boolean elf_s390_relocate_section
PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *,
Elf_Internal_Rela *, Elf_Internal_Sym *, asection **));
-static boolean elf_s390_finish_dynamic_symbol
+static bfd_boolean elf_s390_finish_dynamic_symbol
PARAMS ((bfd *, struct bfd_link_info *, struct elf_link_hash_entry *,
Elf_Internal_Sym *));
static enum elf_reloc_type_class elf_s390_reloc_type_class
PARAMS ((const Elf_Internal_Rela *));
-static boolean elf_s390_finish_dynamic_sections
+static bfd_boolean elf_s390_finish_dynamic_sections
PARAMS ((bfd *, struct bfd_link_info *));
-static boolean elf_s390_object_p PARAMS ((bfd *));
-static boolean elf_s390_grok_prstatus PARAMS ((bfd *, Elf_Internal_Note *));
-
-#define USE_RELA 1 /* We want RELA relocations, not REL. */
+static bfd_boolean elf_s390_mkobject
+ PARAMS ((bfd *));
+static bfd_boolean elf_s390_object_p
+ PARAMS ((bfd *));
+static bfd_boolean elf_s390_grok_prstatus
+ PARAMS ((bfd *, Elf_Internal_Note *));
+static int elf_s390_tls_transition
+ PARAMS ((struct bfd_link_info *, int, int));
+static bfd_reloc_status_type s390_tls_reloc
+ PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
+static bfd_vma dtpoff_base
+ PARAMS ((struct bfd_link_info *));
+static bfd_vma tpoff
+ PARAMS ((struct bfd_link_info *, bfd_vma));
+static void invalid_tls_insn
+ PARAMS ((bfd *, asection *, Elf_Internal_Rela *));
+static bfd_reloc_status_type s390_elf_ldisp_reloc
+ PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
#include "elf/s390.h"
@@ -84,45 +101,130 @@ static reloc_howto_type elf_howto_table[] =
0, /* rightshift */
0, /* size (0 = byte, 1 = short, 2 = long) */
0, /* bitsize */
- false, /* pc_relative */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_390_NONE", /* name */
- false, /* partial_inplace */
+ FALSE, /* partial_inplace */
0, /* src_mask */
0, /* dst_mask */
- false), /* pcrel_offset */
-
- HOWTO(R_390_8, 0, 0, 8, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_390_8", false, 0,0x000000ff, false),
- HOWTO(R_390_12, 0, 1, 12, false, 0, complain_overflow_dont, bfd_elf_generic_reloc, "R_390_12", false, 0,0x00000fff, false),
- HOWTO(R_390_16, 0, 1, 16, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_390_16", false, 0,0x0000ffff, false),
- HOWTO(R_390_32, 0, 2, 32, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_390_32", false, 0,0xffffffff, false),
- HOWTO(R_390_PC32, 0, 2, 32, true, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_390_PC32", false, 0,0xffffffff, true),
- HOWTO(R_390_GOT12, 0, 1, 12, false, 0, complain_overflow_dont, bfd_elf_generic_reloc, "R_390_GOT12", false, 0,0x00000fff, false),
- HOWTO(R_390_GOT32, 0, 2, 32, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_390_GOT32", false, 0,0xffffffff, false),
- HOWTO(R_390_PLT32, 0, 2, 32, true, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_390_PLT32", false, 0,0xffffffff, true),
- HOWTO(R_390_COPY, 0, 2, 32, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_390_COPY", false, 0,0xffffffff, false),
- HOWTO(R_390_GLOB_DAT, 0, 2, 32, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_390_GLOB_DAT",false, 0,0xffffffff, false),
- HOWTO(R_390_JMP_SLOT, 0, 2, 32, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_390_JMP_SLOT",false, 0,0xffffffff, false),
- HOWTO(R_390_RELATIVE, 0, 2, 32, true, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_390_RELATIVE",false, 0,0xffffffff, false),
- HOWTO(R_390_GOTOFF, 0, 2, 32, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_390_GOTOFF", false, 0,0xffffffff, false),
- HOWTO(R_390_GOTPC, 0, 2, 32, true, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_390_GOTPC", false, 0,0xffffffff, true),
- HOWTO(R_390_GOT16, 0, 1, 16, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_390_GOT16", false, 0,0x0000ffff, false),
- HOWTO(R_390_PC16, 0, 1, 16, true, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_390_PC16", false, 0,0x0000ffff, true),
- HOWTO(R_390_PC16DBL, 1, 1, 16, true, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_390_PC16DBL", false, 0,0x0000ffff, true),
- HOWTO(R_390_PLT16DBL, 1, 1, 16, true, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_390_PLT16DBL", false, 0,0x0000ffff, true),
- HOWTO(R_390_PC32DBL, 1, 2, 32, true, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_390_PC32DBL", false, 0,0xffffffff, true),
- HOWTO(R_390_PLT32DBL, 1, 2, 32, true, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_390_PLT32DBL", false, 0,0xffffffff, true),
- HOWTO(R_390_GOTPCDBL, 1, 2, 32, true, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_390_GOTPCDBL", false, 0,0xffffffff, true),
- HOWTO(R_390_GOTENT, 1, 2, 32, true, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_390_GOTENT", false, 0,0xffffffff, true),
+ FALSE), /* pcrel_offset */
+
+ HOWTO(R_390_8, 0, 0, 8, FALSE, 0, complain_overflow_bitfield,
+ bfd_elf_generic_reloc, "R_390_8", FALSE, 0,0x000000ff, FALSE),
+ HOWTO(R_390_12, 0, 1, 12, FALSE, 0, complain_overflow_dont,
+ bfd_elf_generic_reloc, "R_390_12", FALSE, 0,0x00000fff, FALSE),
+ HOWTO(R_390_16, 0, 1, 16, FALSE, 0, complain_overflow_bitfield,
+ bfd_elf_generic_reloc, "R_390_16", FALSE, 0,0x0000ffff, FALSE),
+ HOWTO(R_390_32, 0, 2, 32, FALSE, 0, complain_overflow_bitfield,
+ bfd_elf_generic_reloc, "R_390_32", FALSE, 0,0xffffffff, FALSE),
+ HOWTO(R_390_PC32, 0, 2, 32, TRUE, 0, complain_overflow_bitfield,
+ bfd_elf_generic_reloc, "R_390_PC32", FALSE, 0,0xffffffff, TRUE),
+ HOWTO(R_390_GOT12, 0, 1, 12, FALSE, 0, complain_overflow_bitfield,
+ bfd_elf_generic_reloc, "R_390_GOT12", FALSE, 0,0x00000fff, FALSE),
+ HOWTO(R_390_GOT32, 0, 2, 32, FALSE, 0, complain_overflow_bitfield,
+ bfd_elf_generic_reloc, "R_390_GOT32", FALSE, 0,0xffffffff, FALSE),
+ HOWTO(R_390_PLT32, 0, 2, 32, TRUE, 0, complain_overflow_bitfield,
+ bfd_elf_generic_reloc, "R_390_PLT32", FALSE, 0,0xffffffff, TRUE),
+ HOWTO(R_390_COPY, 0, 2, 32, FALSE, 0, complain_overflow_bitfield,
+ bfd_elf_generic_reloc, "R_390_COPY", FALSE, 0,0xffffffff, FALSE),
+ HOWTO(R_390_GLOB_DAT, 0, 2, 32, FALSE, 0, complain_overflow_bitfield,
+ bfd_elf_generic_reloc, "R_390_GLOB_DAT", FALSE, 0,0xffffffff, FALSE),
+ HOWTO(R_390_JMP_SLOT, 0, 2, 32, FALSE, 0, complain_overflow_bitfield,
+ bfd_elf_generic_reloc, "R_390_JMP_SLOT", FALSE, 0,0xffffffff, FALSE),
+ HOWTO(R_390_RELATIVE, 0, 2, 32, TRUE, 0, complain_overflow_bitfield,
+ bfd_elf_generic_reloc, "R_390_RELATIVE", FALSE, 0,0xffffffff, FALSE),
+ HOWTO(R_390_GOTOFF32, 0, 2, 32, FALSE, 0, complain_overflow_bitfield,
+ bfd_elf_generic_reloc, "R_390_GOTOFF32", FALSE, 0,0xffffffff, FALSE),
+ HOWTO(R_390_GOTPC, 0, 2, 32, TRUE, 0, complain_overflow_bitfield,
+ bfd_elf_generic_reloc, "R_390_GOTPC", FALSE, 0,0xffffffff, TRUE),
+ HOWTO(R_390_GOT16, 0, 1, 16, FALSE, 0, complain_overflow_bitfield,
+ bfd_elf_generic_reloc, "R_390_GOT16", FALSE, 0,0x0000ffff, FALSE),
+ HOWTO(R_390_PC16, 0, 1, 16, TRUE, 0, complain_overflow_bitfield,
+ bfd_elf_generic_reloc, "R_390_PC16", FALSE, 0,0x0000ffff, TRUE),
+ HOWTO(R_390_PC16DBL, 1, 1, 16, TRUE, 0, complain_overflow_bitfield,
+ bfd_elf_generic_reloc, "R_390_PC16DBL", FALSE, 0,0x0000ffff, TRUE),
+ HOWTO(R_390_PLT16DBL, 1, 1, 16, TRUE, 0, complain_overflow_bitfield,
+ bfd_elf_generic_reloc, "R_390_PLT16DBL", FALSE, 0,0x0000ffff, TRUE),
+ HOWTO(R_390_PC32DBL, 1, 2, 32, TRUE, 0, complain_overflow_bitfield,
+ bfd_elf_generic_reloc, "R_390_PC32DBL", FALSE, 0,0xffffffff, TRUE),
+ HOWTO(R_390_PLT32DBL, 1, 2, 32, TRUE, 0, complain_overflow_bitfield,
+ bfd_elf_generic_reloc, "R_390_PLT32DBL", FALSE, 0,0xffffffff, TRUE),
+ HOWTO(R_390_GOTPCDBL, 1, 2, 32, TRUE, 0, complain_overflow_bitfield,
+ bfd_elf_generic_reloc, "R_390_GOTPCDBL", FALSE, 0,0xffffffff, TRUE),
+ EMPTY_HOWTO (R_390_64), /* Empty entry for R_390_64. */
+ EMPTY_HOWTO (R_390_PC64), /* Empty entry for R_390_PC64. */
+ EMPTY_HOWTO (R_390_GOT64), /* Empty entry for R_390_GOT64. */
+ EMPTY_HOWTO (R_390_PLT64), /* Empty entry for R_390_PLT64. */
+ HOWTO(R_390_GOTENT, 1, 2, 32, TRUE, 0, complain_overflow_bitfield,
+ bfd_elf_generic_reloc, "R_390_GOTENT", FALSE, 0,0xffffffff, TRUE),
+ HOWTO(R_390_GOTOFF16, 0, 1, 16, FALSE, 0, complain_overflow_bitfield,
+ bfd_elf_generic_reloc, "R_390_GOTOFF16", FALSE, 0,0x0000ffff, FALSE),
+ EMPTY_HOWTO (R_390_GOTOFF64), /* Empty entry for R_390_GOTOFF64. */
+ HOWTO(R_390_GOTPLT12, 0, 1, 12, FALSE, 0, complain_overflow_dont,
+ bfd_elf_generic_reloc, "R_390_GOTPLT12", FALSE, 0,0x00000fff, FALSE),
+ HOWTO(R_390_GOTPLT16, 0, 1, 16, FALSE, 0, complain_overflow_bitfield,
+ bfd_elf_generic_reloc, "R_390_GOTPLT16", FALSE, 0,0x0000ffff, FALSE),
+ HOWTO(R_390_GOTPLT32, 0, 2, 32, FALSE, 0, complain_overflow_bitfield,
+ bfd_elf_generic_reloc, "R_390_GOTPLT32", FALSE, 0,0xffffffff, FALSE),
+ EMPTY_HOWTO (R_390_GOTPLT64), /* Empty entry for R_390_GOTPLT64. */
+ HOWTO(R_390_GOTPLTENT, 1, 2, 32, TRUE, 0, complain_overflow_bitfield,
+ bfd_elf_generic_reloc, "R_390_GOTPLTENT",FALSE, 0,0xffffffff, TRUE),
+ HOWTO(R_390_PLTOFF16, 0, 1, 16, FALSE, 0, complain_overflow_bitfield,
+ bfd_elf_generic_reloc, "R_390_PLTOFF16", FALSE, 0,0x0000ffff, FALSE),
+ HOWTO(R_390_PLTOFF32, 0, 2, 32, FALSE, 0, complain_overflow_bitfield,
+ bfd_elf_generic_reloc, "R_390_PLTOFF32", FALSE, 0,0xffffffff, FALSE),
+ EMPTY_HOWTO (R_390_PLTOFF64), /* Empty entry for R_390_PLTOFF64. */
+ HOWTO(R_390_TLS_LOAD, 0, 0, 0, FALSE, 0, complain_overflow_dont,
+ s390_tls_reloc, "R_390_TLS_LOAD", FALSE, 0, 0, FALSE),
+ HOWTO(R_390_TLS_GDCALL, 0, 0, 0, FALSE, 0, complain_overflow_dont,
+ s390_tls_reloc, "R_390_TLS_GDCALL", FALSE, 0, 0, FALSE),
+ HOWTO(R_390_TLS_LDCALL, 0, 0, 0, FALSE, 0, complain_overflow_dont,
+ s390_tls_reloc, "R_390_TLS_LDCALL", FALSE, 0, 0, FALSE),
+ HOWTO(R_390_TLS_GD32, 0, 2, 32, FALSE, 0, complain_overflow_bitfield,
+ bfd_elf_generic_reloc, "R_390_TLS_GD32", FALSE, 0, 0xffffffff, FALSE),
+ EMPTY_HOWTO (R_390_TLS_GD64), /* Empty entry for R_390_TLS_GD64. */
+ HOWTO(R_390_TLS_GOTIE12, 0, 1, 12, FALSE, 0, complain_overflow_dont,
+ bfd_elf_generic_reloc, "R_390_TLS_GOTIE12", FALSE, 0, 0x00000fff, FALSE),
+ HOWTO(R_390_TLS_GOTIE32, 0, 2, 32, FALSE, 0, complain_overflow_bitfield,
+ bfd_elf_generic_reloc, "R_390_TLS_GOTIE32", FALSE, 0, 0xffffffff, FALSE),
+ EMPTY_HOWTO (R_390_TLS_GOTIE64), /* Empty entry for R_390_TLS_GOTIE64. */
+ HOWTO(R_390_TLS_LDM32, 0, 2, 32, FALSE, 0, complain_overflow_bitfield,
+ bfd_elf_generic_reloc, "R_390_TLS_LDM32", FALSE, 0, 0xffffffff, FALSE),
+ EMPTY_HOWTO (R_390_TLS_LDM64), /* Empty entry for R_390_TLS_LDM64. */
+ HOWTO(R_390_TLS_IE32, 0, 2, 32, FALSE, 0, complain_overflow_bitfield,
+ bfd_elf_generic_reloc, "R_390_TLS_IE32", FALSE, 0, 0xffffffff, FALSE),
+ EMPTY_HOWTO (R_390_TLS_IE64), /* Empty entry for R_390_TLS_IE64. */
+ HOWTO(R_390_TLS_IEENT, 1, 2, 32, TRUE, 0, complain_overflow_bitfield,
+ bfd_elf_generic_reloc, "R_390_TLS_IEENT", FALSE, 0, 0xffffffff, TRUE),
+ HOWTO(R_390_TLS_LE32, 0, 2, 32, FALSE, 0, complain_overflow_bitfield,
+ bfd_elf_generic_reloc, "R_390_TLS_LE32", FALSE, 0, 0xffffffff, FALSE),
+ EMPTY_HOWTO (R_390_TLS_LE64), /* Empty entry for R_390_TLS_LE64. */
+ HOWTO(R_390_TLS_LDO32, 0, 2, 32, FALSE, 0, complain_overflow_bitfield,
+ bfd_elf_generic_reloc, "R_390_TLS_LDO32", FALSE, 0, 0xffffffff, FALSE),
+ EMPTY_HOWTO (R_390_TLS_LDO64), /* Empty entry for R_390_TLS_LDO64. */
+ HOWTO(R_390_TLS_DTPMOD, 0, 2, 32, FALSE, 0, complain_overflow_bitfield,
+ bfd_elf_generic_reloc, "R_390_TLS_DTPMOD", FALSE, 0, 0xffffffff, FALSE),
+ HOWTO(R_390_TLS_DTPOFF, 0, 2, 32, FALSE, 0, complain_overflow_bitfield,
+ bfd_elf_generic_reloc, "R_390_TLS_DTPOFF", FALSE, 0, 0xffffffff, FALSE),
+ HOWTO(R_390_TLS_TPOFF, 0, 2, 32, FALSE, 0, complain_overflow_bitfield,
+ bfd_elf_generic_reloc, "R_390_TLS_TPOFF", FALSE, 0, 0xffffffff, FALSE),
+ HOWTO(R_390_20, 0, 2, 20, FALSE, 8, complain_overflow_dont,
+ s390_elf_ldisp_reloc, "R_390_20", FALSE, 0,0x0fffff00, FALSE),
+ HOWTO(R_390_GOT20, 0, 2, 20, FALSE, 8, complain_overflow_dont,
+ s390_elf_ldisp_reloc, "R_390_GOT20", FALSE, 0,0x0fffff00, FALSE),
+ HOWTO(R_390_GOTPLT20, 0, 2, 20, FALSE, 8, complain_overflow_dont,
+ s390_elf_ldisp_reloc, "R_390_GOTPLT20", FALSE, 0,0x0fffff00, FALSE),
+ HOWTO(R_390_TLS_GOTIE20, 0, 2, 20, FALSE, 8, complain_overflow_dont,
+ s390_elf_ldisp_reloc, "R_390_TLS_GOTIE20", FALSE, 0,0x0fffff00, FALSE),
};
/* GNU extension to record C++ vtable hierarchy. */
static reloc_howto_type elf32_s390_vtinherit_howto =
- HOWTO (R_390_GNU_VTINHERIT, 0,2,0,false,0,complain_overflow_dont, NULL, "R_390_GNU_VTINHERIT", false,0, 0, false);
+ HOWTO (R_390_GNU_VTINHERIT, 0,2,0,FALSE,0,complain_overflow_dont, NULL, "R_390_GNU_VTINHERIT", FALSE,0, 0, FALSE);
static reloc_howto_type elf32_s390_vtentry_howto =
- HOWTO (R_390_GNU_VTENTRY, 0,2,0,false,0,complain_overflow_dont, _bfd_elf_rel_vtable_reloc_fn,"R_390_GNU_VTENTRY", false,0,0, false);
+ HOWTO (R_390_GNU_VTENTRY, 0,2,0,FALSE,0,complain_overflow_dont, _bfd_elf_rel_vtable_reloc_fn,"R_390_GNU_VTENTRY", FALSE,0,0, FALSE);
static reloc_howto_type *
elf_s390_reloc_type_lookup (abfd, code)
@@ -160,7 +262,7 @@ elf_s390_reloc_type_lookup (abfd, code)
case BFD_RELOC_390_RELATIVE:
return &elf_howto_table[(int) R_390_RELATIVE];
case BFD_RELOC_32_GOTOFF:
- return &elf_howto_table[(int) R_390_GOTOFF];
+ return &elf_howto_table[(int) R_390_GOTOFF32];
case BFD_RELOC_390_GOTPC:
return &elf_howto_table[(int) R_390_GOTPC];
case BFD_RELOC_390_GOT16:
@@ -179,6 +281,56 @@ elf_s390_reloc_type_lookup (abfd, code)
return &elf_howto_table[(int) R_390_GOTPCDBL];
case BFD_RELOC_390_GOTENT:
return &elf_howto_table[(int) R_390_GOTENT];
+ case BFD_RELOC_16_GOTOFF:
+ return &elf_howto_table[(int) R_390_GOTOFF16];
+ case BFD_RELOC_390_GOTPLT12:
+ return &elf_howto_table[(int) R_390_GOTPLT12];
+ case BFD_RELOC_390_GOTPLT16:
+ return &elf_howto_table[(int) R_390_GOTPLT16];
+ case BFD_RELOC_390_GOTPLT32:
+ return &elf_howto_table[(int) R_390_GOTPLT32];
+ case BFD_RELOC_390_GOTPLTENT:
+ return &elf_howto_table[(int) R_390_GOTPLTENT];
+ case BFD_RELOC_390_PLTOFF16:
+ return &elf_howto_table[(int) R_390_PLTOFF16];
+ case BFD_RELOC_390_PLTOFF32:
+ return &elf_howto_table[(int) R_390_PLTOFF32];
+ case BFD_RELOC_390_TLS_LOAD:
+ return &elf_howto_table[(int) R_390_TLS_LOAD];
+ case BFD_RELOC_390_TLS_GDCALL:
+ return &elf_howto_table[(int) R_390_TLS_GDCALL];
+ case BFD_RELOC_390_TLS_LDCALL:
+ return &elf_howto_table[(int) R_390_TLS_LDCALL];
+ case BFD_RELOC_390_TLS_GD32:
+ return &elf_howto_table[(int) R_390_TLS_GD32];
+ case BFD_RELOC_390_TLS_GOTIE12:
+ return &elf_howto_table[(int) R_390_TLS_GOTIE12];
+ case BFD_RELOC_390_TLS_GOTIE32:
+ return &elf_howto_table[(int) R_390_TLS_GOTIE32];
+ case BFD_RELOC_390_TLS_LDM32:
+ return &elf_howto_table[(int) R_390_TLS_LDM32];
+ case BFD_RELOC_390_TLS_IE32:
+ return &elf_howto_table[(int) R_390_TLS_IE32];
+ case BFD_RELOC_390_TLS_IEENT:
+ return &elf_howto_table[(int) R_390_TLS_IEENT];
+ case BFD_RELOC_390_TLS_LE32:
+ return &elf_howto_table[(int) R_390_TLS_LE32];
+ case BFD_RELOC_390_TLS_LDO32:
+ return &elf_howto_table[(int) R_390_TLS_LDO32];
+ case BFD_RELOC_390_TLS_DTPMOD:
+ return &elf_howto_table[(int) R_390_TLS_DTPMOD];
+ case BFD_RELOC_390_TLS_DTPOFF:
+ return &elf_howto_table[(int) R_390_TLS_DTPOFF];
+ case BFD_RELOC_390_TLS_TPOFF:
+ return &elf_howto_table[(int) R_390_TLS_TPOFF];
+ case BFD_RELOC_390_20:
+ return &elf_howto_table[(int) R_390_20];
+ case BFD_RELOC_390_GOT20:
+ return &elf_howto_table[(int) R_390_GOT20];
+ case BFD_RELOC_390_GOTPLT20:
+ return &elf_howto_table[(int) R_390_GOTPLT20];
+ case BFD_RELOC_390_TLS_GOTIE20:
+ return &elf_howto_table[(int) R_390_TLS_GOTIE20];
case BFD_RELOC_VTABLE_INHERIT:
return &elf32_s390_vtinherit_howto;
case BFD_RELOC_VTABLE_ENTRY:
@@ -214,13 +366,83 @@ elf_s390_info_to_howto (abfd, cache_ptr, dst)
}
}
-static boolean
+/* A relocation function which doesn't do anything. */
+static bfd_reloc_status_type
+s390_tls_reloc (abfd, reloc_entry, symbol, data, input_section,
+ output_bfd, error_message)
+ bfd *abfd ATTRIBUTE_UNUSED;
+ arelent *reloc_entry;
+ asymbol *symbol ATTRIBUTE_UNUSED;
+ PTR data ATTRIBUTE_UNUSED;
+ asection *input_section;
+ bfd *output_bfd;
+ char **error_message ATTRIBUTE_UNUSED;
+{
+ if (output_bfd)
+ reloc_entry->address += input_section->output_offset;
+ return bfd_reloc_ok;
+}
+
+/* Handle the large displacement relocs. */
+static bfd_reloc_status_type
+s390_elf_ldisp_reloc (abfd, reloc_entry, symbol, data, input_section,
+ output_bfd, error_message)
+ bfd *abfd ATTRIBUTE_UNUSED;
+ arelent *reloc_entry;
+ asymbol *symbol;
+ PTR data ATTRIBUTE_UNUSED;
+ asection *input_section;
+ bfd *output_bfd;
+ char **error_message ATTRIBUTE_UNUSED;
+{
+ reloc_howto_type *howto = reloc_entry->howto;
+ bfd_vma relocation;
+ bfd_vma insn;
+
+ if (output_bfd != (bfd *) NULL
+ && (symbol->flags & BSF_SECTION_SYM) == 0
+ && (! howto->partial_inplace
+ || reloc_entry->addend == 0))
+ {
+ reloc_entry->address += input_section->output_offset;
+ return bfd_reloc_ok;
+ }
+
+ if (output_bfd != NULL)
+ return bfd_reloc_continue;
+
+ if (reloc_entry->address > input_section->_cooked_size)
+ return bfd_reloc_outofrange;
+
+ relocation = (symbol->value
+ + symbol->section->output_section->vma
+ + symbol->section->output_offset);
+ relocation += reloc_entry->addend;
+ if (howto->pc_relative)
+ {
+ relocation -= (input_section->output_section->vma
+ + input_section->output_offset);
+ relocation -= reloc_entry->address;
+ }
+
+ insn = bfd_get_32 (abfd, (bfd_byte *) data + reloc_entry->address);
+ insn |= (relocation & 0xfff) << 16 | (relocation & 0xff000) >> 4;
+ bfd_put_32 (abfd, insn, (bfd_byte *) data + reloc_entry->address);
+
+ if ((bfd_signed_vma) relocation < - 0x80000
+ || (bfd_signed_vma) relocation > 0x7ffff)
+ return bfd_reloc_overflow;
+ else
+ return bfd_reloc_ok;
+}
+
+static bfd_boolean
elf_s390_is_local_label_name (abfd, name)
bfd *abfd;
const char *name;
{
if (name[0] == '.' && (name[1] == 'X' || name[1] == 'L'))
- return true;
+ return TRUE;
return _bfd_elf_is_local_label_name (abfd, name);
}
@@ -232,6 +454,12 @@ elf_s390_is_local_label_name (abfd, name)
#define ELF_DYNAMIC_INTERPRETER "/usr/lib/ld.so.1"
+/* If ELIMINATE_COPY_RELOCS is non-zero, the linker will try to avoid
+ copying dynamic variables from a shared lib into an app's dynbss
+ section, and instead use a dynamic relocation to point into the
+ shared lib. */
+#define ELIMINATE_COPY_RELOCS 1
+
/* The size in bytes of the first entry in the procedure linkage table. */
#define PLT_FIRST_ENTRY_SIZE 32
/* The size in bytes of an entry in the procedure linkage table. */
@@ -256,7 +484,7 @@ elf_s390_is_local_label_name (abfd, name)
Word 1 is a pointer to a structure describing the object
Word 2 is used to point to the loader entry address.
- The code for position independand PLT entries looks like this:
+ The code for position independent PLT entries looks like this:
r12 holds addr of the current GOT at entry to the PLT
@@ -413,8 +641,54 @@ struct elf_s390_link_hash_entry
/* Track dynamic relocs copied for this symbol. */
struct elf_s390_dyn_relocs *dyn_relocs;
+
+ /* Number of GOTPLT references for a function. */
+ bfd_signed_vma gotplt_refcount;
+
+#define GOT_UNKNOWN 0
+#define GOT_NORMAL 1
+#define GOT_TLS_GD 2
+#define GOT_TLS_IE 3
+#define GOT_TLS_IE_NLT 4
+ unsigned char tls_type;
};
+#define elf_s390_hash_entry(ent) \
+ ((struct elf_s390_link_hash_entry *)(ent))
+
+struct elf_s390_obj_tdata
+{
+ struct elf_obj_tdata root;
+
+ /* tls_type for each local got entry. */
+ char *local_got_tls_type;
+};
+
+#define elf_s390_tdata(abfd) \
+ ((struct elf_s390_obj_tdata *) (abfd)->tdata.any)
+
+#define elf_s390_local_got_tls_type(abfd) \
+ (elf_s390_tdata (abfd)->local_got_tls_type)
+
+static bfd_boolean
+elf_s390_mkobject (abfd)
+ bfd *abfd;
+{
+ bfd_size_type amt = sizeof (struct elf_s390_obj_tdata);
+ abfd->tdata.any = bfd_zalloc (abfd, amt);
+ if (abfd->tdata.any == NULL)
+ return FALSE;
+ return TRUE;
+}
+
+static bfd_boolean
+elf_s390_object_p (abfd)
+ bfd *abfd;
+{
+ /* Set the right machine number for an s390 elf32 file. */
+ return bfd_default_set_arch_mach (abfd, bfd_arch_s390, bfd_mach_s390_31);
+}
+
/* s390 ELF linker hash table. */
struct elf_s390_link_hash_table
@@ -430,6 +704,11 @@ struct elf_s390_link_hash_table
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;
};
@@ -465,6 +744,8 @@ link_hash_newfunc (entry, table, string)
eh = (struct elf_s390_link_hash_entry *) entry;
eh->dyn_relocs = NULL;
+ eh->gotplt_refcount = 0;
+ eh->tls_type = GOT_UNKNOWN;
}
return entry;
@@ -496,6 +777,7 @@ elf_s390_link_hash_table_create (abfd)
ret->srelplt = NULL;
ret->sdynbss = NULL;
ret->srelbss = NULL;
+ ret->tls_ldm_got.refcount = 0;
ret->sym_sec.abfd = NULL;
return &ret->elf.root;
@@ -504,7 +786,7 @@ elf_s390_link_hash_table_create (abfd)
/* Create .got, .gotplt, and .rela.got sections in DYNOBJ, and set up
shortcuts to them in our hash table. */
-static boolean
+static bfd_boolean
create_got_section (dynobj, info)
bfd *dynobj;
struct bfd_link_info *info;
@@ -512,7 +794,7 @@ create_got_section (dynobj, info)
struct elf_s390_link_hash_table *htab;
if (! _bfd_elf_create_got_section (dynobj, info))
- return false;
+ return FALSE;
htab = elf_s390_hash_table (info);
htab->sgot = bfd_get_section_by_name (dynobj, ".got");
@@ -527,15 +809,15 @@ create_got_section (dynobj, info)
| SEC_IN_MEMORY | SEC_LINKER_CREATED
| SEC_READONLY))
|| ! bfd_set_section_alignment (dynobj, htab->srelgot, 2))
- return false;
- return true;
+ return FALSE;
+ return TRUE;
}
/* Create .plt, .rela.plt, .got, .got.plt, .rela.got, .dynbss, and
.rela.bss sections in DYNOBJ, and set up shortcuts to them in our
hash table. */
-static boolean
+static bfd_boolean
elf_s390_create_dynamic_sections (dynobj, info)
bfd *dynobj;
struct bfd_link_info *info;
@@ -544,10 +826,10 @@ elf_s390_create_dynamic_sections (dynobj, info)
htab = elf_s390_hash_table (info);
if (!htab->sgot && !create_got_section (dynobj, info))
- return false;
+ return FALSE;
if (!_bfd_elf_create_dynamic_sections (dynobj, info))
- return false;
+ return FALSE;
htab->splt = bfd_get_section_by_name (dynobj, ".plt");
htab->srelplt = bfd_get_section_by_name (dynobj, ".rela.plt");
@@ -559,14 +841,14 @@ elf_s390_create_dynamic_sections (dynobj, info)
|| (!info->shared && !htab->srelbss))
abort ();
- return true;
+ return TRUE;
}
/* Copy the extra info we tack onto an elf_link_hash_entry. */
static void
elf_s390_copy_indirect_symbol (bed, dir, ind)
- struct elf_backend_data *bed;
+ const struct elf_backend_data *bed;
struct elf_link_hash_entry *dir, *ind;
{
struct elf_s390_link_hash_entry *edir, *eind;
@@ -608,14 +890,60 @@ elf_s390_copy_indirect_symbol (bed, dir, ind)
eind->dyn_relocs = NULL;
}
- _bfd_elf_link_hash_copy_indirect (bed, dir, ind);
+ if (ind->root.type == bfd_link_hash_indirect
+ && dir->got.refcount <= 0)
+ {
+ edir->tls_type = eind->tls_type;
+ eind->tls_type = GOT_UNKNOWN;
+ }
+
+ if (ELIMINATE_COPY_RELOCS
+ && ind->root.type != bfd_link_hash_indirect
+ && (dir->elf_link_hash_flags & ELF_LINK_HASH_DYNAMIC_ADJUSTED) != 0)
+ /* If called to transfer flags for a weakdef during processing
+ of elf_adjust_dynamic_symbol, don't copy ELF_LINK_NON_GOT_REF.
+ We clear it ourselves for ELIMINATE_COPY_RELOCS. */
+ dir->elf_link_hash_flags |=
+ (ind->elf_link_hash_flags & (ELF_LINK_HASH_REF_DYNAMIC
+ | ELF_LINK_HASH_REF_REGULAR
+ | ELF_LINK_HASH_REF_REGULAR_NONWEAK
+ | ELF_LINK_HASH_NEEDS_PLT));
+ else
+ _bfd_elf_link_hash_copy_indirect (bed, dir, ind);
+}
+
+static int
+elf_s390_tls_transition (info, r_type, is_local)
+ struct bfd_link_info *info;
+ int r_type;
+ int is_local;
+{
+ if (info->shared)
+ return r_type;
+
+ switch (r_type)
+ {
+ case R_390_TLS_GD32:
+ case R_390_TLS_IE32:
+ if (is_local)
+ return R_390_TLS_LE32;
+ return R_390_TLS_IE32;
+ case R_390_TLS_GOTIE32:
+ if (is_local)
+ return R_390_TLS_LE32;
+ return R_390_TLS_GOTIE32;
+ case R_390_TLS_LDM32:
+ return R_390_TLS_LE32;
+ }
+
+ return r_type;
}
/* Look through the relocs for a section during the first phase, and
allocate space in the global offset table or procedure linkage
table. */
-static boolean
+static bfd_boolean
elf_s390_check_relocs (abfd, info, sec, relocs)
bfd *abfd;
struct bfd_link_info *info;
@@ -628,19 +956,23 @@ elf_s390_check_relocs (abfd, info, sec, relocs)
const Elf_Internal_Rela *rel;
const Elf_Internal_Rela *rel_end;
asection *sreloc;
+ bfd_signed_vma *local_got_refcounts;
+ int tls_type, old_tls_type;
- if (info->relocateable)
- return true;
+ if (info->relocatable)
+ return TRUE;
htab = elf_s390_hash_table (info);
symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
sym_hashes = elf_sym_hashes (abfd);
+ local_got_refcounts = elf_local_got_refcounts (abfd);
sreloc = NULL;
rel_end = relocs + sec->reloc_count;
for (rel = relocs; rel < rel_end; rel++)
{
+ unsigned int r_type;
unsigned long r_symndx;
struct elf_link_hash_entry *h;
@@ -651,7 +983,7 @@ elf_s390_check_relocs (abfd, info, sec, relocs)
(*_bfd_error_handler) (_("%s: bad symbol index: %d"),
bfd_archive_filename (abfd),
r_symndx);
- return false;
+ return FALSE;
}
if (r_symndx < symtab_hdr->sh_info)
@@ -659,40 +991,48 @@ elf_s390_check_relocs (abfd, info, sec, relocs)
else
h = sym_hashes[r_symndx - symtab_hdr->sh_info];
- switch (ELF32_R_TYPE (rel->r_info))
+ /* Create got section and local_got_refcounts array if they
+ are needed. */
+ r_type = elf_s390_tls_transition (info,
+ ELF32_R_TYPE (rel->r_info),
+ h == NULL);
+ switch (r_type)
{
case R_390_GOT12:
- case R_390_GOT16:
+ case R_390_GOT16:
+ case R_390_GOT20:
case R_390_GOT32:
case R_390_GOTENT:
- /* This symbol requires a global offset table entry. */
- if (h != NULL)
- {
- h->got.refcount += 1;
- }
- else
+ case R_390_GOTPLT12:
+ case R_390_GOTPLT16:
+ case R_390_GOTPLT20:
+ case R_390_GOTPLT32:
+ case R_390_GOTPLTENT:
+ case R_390_TLS_GD32:
+ case R_390_TLS_GOTIE12:
+ case R_390_TLS_GOTIE20:
+ case R_390_TLS_GOTIE32:
+ case R_390_TLS_IEENT:
+ case R_390_TLS_IE32:
+ case R_390_TLS_LDM32:
+ if (h == NULL
+ && local_got_refcounts == NULL)
{
- bfd_signed_vma *local_got_refcounts;
+ bfd_size_type size;
- /* This is a global offset table entry for a local symbol. */
- local_got_refcounts = elf_local_got_refcounts (abfd);
+ 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)
- {
- bfd_size_type size;
-
- size = symtab_hdr->sh_info;
- size *= sizeof (bfd_signed_vma);
- local_got_refcounts = ((bfd_signed_vma *)
- bfd_zalloc (abfd, size));
- if (local_got_refcounts == NULL)
- return false;
- elf_local_got_refcounts (abfd) = local_got_refcounts;
- }
- local_got_refcounts[r_symndx] += 1;
+ return FALSE;
+ elf_local_got_refcounts (abfd) = local_got_refcounts;
+ elf_s390_local_got_tls_type (abfd)
+ = (char *) (local_got_refcounts + symtab_hdr->sh_info);
}
- /* Fall through */
-
- case R_390_GOTOFF:
+ /* Fall through. */
+ case R_390_GOTOFF16:
+ case R_390_GOTOFF32:
case R_390_GOTPC:
case R_390_GOTPCDBL:
if (htab->sgot == NULL)
@@ -700,34 +1040,155 @@ elf_s390_check_relocs (abfd, info, sec, relocs)
if (htab->elf.dynobj == NULL)
htab->elf.dynobj = abfd;
if (!create_got_section (htab->elf.dynobj, info))
- return false;
+ return FALSE;
}
+ }
+
+ switch (r_type)
+ {
+ case R_390_GOTOFF16:
+ case R_390_GOTOFF32:
+ case R_390_GOTPC:
+ case R_390_GOTPCDBL:
+ /* Got is created, nothing to be done. */
break;
- case R_390_PLT16DBL:
- case R_390_PLT32DBL:
+ case R_390_PLT16DBL:
+ case R_390_PLT32DBL:
case R_390_PLT32:
+ case R_390_PLTOFF16:
+ case R_390_PLTOFF32:
/* This symbol requires a procedure linkage table entry. We
- actually build the entry in adjust_dynamic_symbol,
- because this might be a case of linking PIC code which is
- never referenced by a dynamic object, in which case we
- don't need to generate a procedure linkage table entry
- after all. */
+ actually build the entry in adjust_dynamic_symbol,
+ because this might be a case of linking PIC code which is
+ never referenced by a dynamic object, in which case we
+ don't need to generate a procedure linkage table entry
+ after all. */
/* If this is a local symbol, we resolve it directly without
- creating a procedure linkage table entry. */
- if (h == NULL)
- continue;
+ creating a procedure linkage table entry. */
+ if (h != NULL)
+ {
+ h->elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_PLT;
+ h->plt.refcount += 1;
+ }
+ break;
- h->elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_PLT;
- h->plt.refcount += 1;
+ case R_390_GOTPLT12:
+ case R_390_GOTPLT16:
+ case R_390_GOTPLT20:
+ case R_390_GOTPLT32:
+ case R_390_GOTPLTENT:
+ /* This symbol requires either a procedure linkage table entry
+ or an entry in the local got. We actually build the entry
+ in adjust_dynamic_symbol because whether this is really a
+ global reference can change and with it the fact if we have
+ to create a plt entry or a local got entry. To be able to
+ make a once global symbol a local one we have to keep track
+ of the number of gotplt references that exist for this
+ symbol. */
+ if (h != NULL)
+ {
+ ((struct elf_s390_link_hash_entry *) h)->gotplt_refcount++;
+ h->elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_PLT;
+ h->plt.refcount += 1;
+ }
+ else
+ local_got_refcounts[r_symndx] += 1;
+ break;
+
+ case R_390_TLS_LDM32:
+ htab->tls_ldm_got.refcount += 1;
break;
- case R_390_8:
- case R_390_16:
+ case R_390_TLS_IE32:
+ case R_390_TLS_GOTIE12:
+ case R_390_TLS_GOTIE20:
+ case R_390_TLS_GOTIE32:
+ case R_390_TLS_IEENT:
+ if (info->shared)
+ info->flags |= DF_STATIC_TLS;
+ /* Fall through. */
+
+ case R_390_GOT12:
+ case R_390_GOT16:
+ case R_390_GOT20:
+ case R_390_GOT32:
+ case R_390_GOTENT:
+ case R_390_TLS_GD32:
+ /* This symbol requires a global offset table entry. */
+ switch (r_type)
+ {
+ default:
+ case R_390_GOT12:
+ case R_390_GOT16:
+ case R_390_GOT20:
+ case R_390_GOT32:
+ case R_390_GOTENT:
+ tls_type = GOT_NORMAL;
+ break;
+ case R_390_TLS_GD32:
+ tls_type = GOT_TLS_GD;
+ break;
+ case R_390_TLS_IE32:
+ case R_390_TLS_GOTIE32:
+ tls_type = GOT_TLS_IE;
+ break;
+ case R_390_TLS_GOTIE12:
+ case R_390_TLS_GOTIE20:
+ case R_390_TLS_IEENT:
+ tls_type = GOT_TLS_IE_NLT;
+ break;
+ }
+
+ if (h != NULL)
+ {
+ h->got.refcount += 1;
+ old_tls_type = elf_s390_hash_entry(h)->tls_type;
+ }
+ else
+ {
+ local_got_refcounts[r_symndx] += 1;
+ old_tls_type = elf_s390_local_got_tls_type (abfd) [r_symndx];
+ }
+ /* If a TLS symbol is accessed using IE at least once,
+ there is no point to use dynamic model for it. */
+ if (old_tls_type != tls_type && old_tls_type != GOT_UNKNOWN)
+ {
+ if (old_tls_type == GOT_NORMAL || tls_type == GOT_NORMAL)
+ {
+ (*_bfd_error_handler)
+ (_("%s: `%s' accessed both as normal and thread local symbol"),
+ bfd_archive_filename (abfd), h->root.root.string);
+ return FALSE;
+ }
+ if (old_tls_type > tls_type)
+ tls_type = old_tls_type;
+ }
+
+ if (old_tls_type != tls_type)
+ {
+ if (h != NULL)
+ elf_s390_hash_entry (h)->tls_type = tls_type;
+ else
+ elf_s390_local_got_tls_type (abfd) [r_symndx] = tls_type;
+ }
+
+ if (r_type != R_390_TLS_IE32)
+ break;
+ /* Fall through. */
+
+ case R_390_TLS_LE32:
+ if (!info->shared)
+ break;
+ info->flags |= DF_STATIC_TLS;
+ /* Fall through. */
+
+ case R_390_8:
+ case R_390_16:
case R_390_32:
- case R_390_PC16:
- case R_390_PC16DBL:
+ case R_390_PC16:
+ case R_390_PC16DBL:
case R_390_PC32DBL:
case R_390_PC32:
if (h != NULL && !info->shared)
@@ -777,7 +1238,8 @@ elf_s390_check_relocs (abfd, info, sec, relocs)
|| h->root.type == bfd_link_hash_defweak
|| (h->elf_link_hash_flags
& ELF_LINK_HASH_DEF_REGULAR) == 0))))
- || (!info->shared
+ || (ELIMINATE_COPY_RELOCS
+ && !info->shared
&& (sec->flags & SEC_ALLOC) != 0
&& h != NULL
&& (h->root.type == bfd_link_hash_defweak
@@ -800,7 +1262,7 @@ elf_s390_check_relocs (abfd, info, sec, relocs)
elf_elfheader (abfd)->e_shstrndx,
elf_section_data (sec)->rel_hdr.sh_name));
if (name == NULL)
- return false;
+ return FALSE;
if (strncmp (name, ".rela", 5) != 0
|| strcmp (bfd_get_section_name (abfd, sec),
@@ -828,7 +1290,7 @@ elf_s390_check_relocs (abfd, info, sec, relocs)
if (sreloc == NULL
|| ! bfd_set_section_flags (dynobj, sreloc, flags)
|| ! bfd_set_section_alignment (dynobj, sreloc, 2))
- return false;
+ return FALSE;
}
elf_section_data (sec)->sreloc = sreloc;
}
@@ -844,12 +1306,12 @@ elf_s390_check_relocs (abfd, info, sec, relocs)
/* 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;
+ return FALSE;
head = ((struct elf_s390_dyn_relocs **)
&elf_section_data (s)->local_dynrel);
@@ -859,10 +1321,11 @@ elf_s390_check_relocs (abfd, info, sec, relocs)
if (p == NULL || p->sec != sec)
{
bfd_size_type amt = sizeof *p;
+
p = ((struct elf_s390_dyn_relocs *)
bfd_alloc (htab->elf.dynobj, amt));
if (p == NULL)
- return false;
+ return FALSE;
p->next = *head;
*head = p;
p->sec = sec;
@@ -881,24 +1344,24 @@ elf_s390_check_relocs (abfd, info, sec, relocs)
/* This relocation describes the C++ object vtable hierarchy.
Reconstruct it for later use during GC. */
- case R_390_GNU_VTINHERIT:
- if (!_bfd_elf32_gc_record_vtinherit (abfd, sec, h, rel->r_offset))
- return false;
- break;
+ case R_390_GNU_VTINHERIT:
+ if (!bfd_elf_gc_record_vtinherit (abfd, sec, h, rel->r_offset))
+ return FALSE;
+ break;
/* This relocation describes which C++ vtable entries are actually
used. Record for later use during GC. */
- case R_390_GNU_VTENTRY:
- if (!_bfd_elf32_gc_record_vtentry (abfd, sec, h, rel->r_addend))
- return false;
- break;
+ case R_390_GNU_VTENTRY:
+ if (!bfd_elf_gc_record_vtentry (abfd, sec, h, rel->r_addend))
+ return FALSE;
+ break;
default:
break;
}
}
- return true;
+ return TRUE;
}
/* Return the section that should be marked against GC for a given
@@ -943,7 +1406,7 @@ elf_s390_gc_mark_hook (sec, info, rel, h, sym)
/* Update the got entry reference counts for the section being removed. */
-static boolean
+static bfd_boolean
elf_s390_gc_sweep_hook (abfd, info, sec, relocs)
bfd *abfd;
struct bfd_link_info *info;
@@ -954,8 +1417,6 @@ elf_s390_gc_sweep_hook (abfd, info, sec, relocs)
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;
@@ -965,84 +1426,140 @@ elf_s390_gc_sweep_hook (abfd, info, sec, relocs)
relend = relocs + sec->reloc_count;
for (rel = relocs; rel < relend; rel++)
- switch (ELF32_R_TYPE (rel->r_info))
- {
- case R_390_GOT12:
- case R_390_GOT16:
- case R_390_GOT32:
- case R_390_GOTOFF:
- case R_390_GOTPC:
- case R_390_GOTPCDBL:
- case R_390_GOTENT:
- 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;
+ {
+ unsigned long r_symndx;
+ unsigned int r_type;
+ struct elf_link_hash_entry *h = NULL;
+
+ r_symndx = ELF32_R_SYM (rel->r_info);
+ if (r_symndx >= symtab_hdr->sh_info)
+ {
+ struct elf_s390_link_hash_entry *eh;
+ struct elf_s390_dyn_relocs **pp;
+ struct elf_s390_dyn_relocs *p;
- case R_390_8:
- case R_390_12:
- case R_390_16:
- case R_390_32:
- case R_390_PC16:
- case R_390_PC16DBL:
- case R_390_PC32DBL:
- case R_390_PC32:
- r_symndx = ELF32_R_SYM (rel->r_info);
- if (r_symndx >= symtab_hdr->sh_info)
- {
- struct elf_s390_link_hash_entry *eh;
- struct elf_s390_dyn_relocs **pp;
- struct elf_s390_dyn_relocs *p;
-
- h = sym_hashes[r_symndx - symtab_hdr->sh_info];
-
- if (!info->shared && h->plt.refcount > 0)
- h->plt.refcount -= 1;
-
- eh = (struct elf_s390_link_hash_entry *) h;
-
- for (pp = &eh->dyn_relocs; (p = *pp) != NULL; pp = &p->next)
- if (p->sec == sec)
+ h = sym_hashes[r_symndx - symtab_hdr->sh_info];
+ eh = (struct elf_s390_link_hash_entry *) h;
+
+ for (pp = &eh->dyn_relocs; (p = *pp) != NULL; pp = &p->next)
+ if (p->sec == sec)
+ {
+ /* Everything must go for SEC. */
+ *pp = p->next;
+ break;
+ }
+ }
+
+ r_type = ELF32_R_TYPE (rel->r_info);
+ r_type = elf_s390_tls_transition (info, r_type, h != NULL);
+ switch (r_type)
+ {
+ case R_390_TLS_LDM32:
+ if (elf_s390_hash_table (info)->tls_ldm_got.refcount > 0)
+ elf_s390_hash_table (info)->tls_ldm_got.refcount -= 1;
+ break;
+
+ case R_390_TLS_GD32:
+ case R_390_TLS_IE32:
+ case R_390_TLS_GOTIE12:
+ case R_390_TLS_GOTIE20:
+ case R_390_TLS_GOTIE32:
+ case R_390_TLS_IEENT:
+ case R_390_GOT12:
+ case R_390_GOT16:
+ case R_390_GOT20:
+ case R_390_GOT32:
+ case R_390_GOTOFF16:
+ case R_390_GOTOFF32:
+ case R_390_GOTPC:
+ case R_390_GOTPCDBL:
+ case R_390_GOTENT:
+ if (h != NULL)
+ {
+ if (h->got.refcount > 0)
+ h->got.refcount -= 1;
+ }
+ else if (local_got_refcounts != NULL)
+ {
+ if (local_got_refcounts[r_symndx] > 0)
+ local_got_refcounts[r_symndx] -= 1;
+ }
+ break;
+
+ case R_390_8:
+ case R_390_12:
+ case R_390_16:
+ case R_390_20:
+ case R_390_32:
+ case R_390_PC16:
+ case R_390_PC16DBL:
+ case R_390_PC32DBL:
+ case R_390_PC32:
+ if (info->shared)
+ break;
+ /* Fall through. */
+
+ case R_390_PLT16DBL:
+ case R_390_PLT32DBL:
+ case R_390_PLT32:
+ case R_390_PLTOFF16:
+ case R_390_PLTOFF32:
+ if (h != NULL)
+ {
+ if (h->plt.refcount > 0)
+ h->plt.refcount -= 1;
+ }
+ break;
+
+ case R_390_GOTPLT12:
+ case R_390_GOTPLT16:
+ case R_390_GOTPLT20:
+ case R_390_GOTPLT32:
+ case R_390_GOTPLTENT:
+ if (h != NULL)
+ {
+ if (h->plt.refcount > 0)
{
- if (ELF32_R_TYPE (rel->r_info) == R_390_PC16
- || ELF32_R_TYPE (rel->r_info) == R_390_PC16DBL
- || ELF32_R_TYPE (rel->r_info) == R_390_PC32DBL
- || ELF32_R_TYPE (rel->r_info) == R_390_PC32)
- p->pc_count -= 1;
- p->count -= 1;
- if (p->count == 0)
- *pp = p->next;
- break;
+ ((struct elf_s390_link_hash_entry *) h)->gotplt_refcount--;
+ h->plt.refcount -= 1;
}
- }
- break;
+ }
+ else if (local_got_refcounts != NULL)
+ {
+ if (local_got_refcounts[r_symndx] > 0)
+ local_got_refcounts[r_symndx] -= 1;
+ }
+ break;
- case R_390_PLT16DBL:
- case R_390_PLT32DBL:
- case R_390_PLT32:
- 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->plt.refcount > 0)
- h->plt.refcount -= 1;
- }
- break;
+ default:
+ break;
+ }
+ }
- default:
- break;
- }
+ return TRUE;
+}
+
+/* Make sure we emit a GOT entry if the symbol was supposed to have a PLT
+ entry but we found we will not create any. Called when we find we will
+ not have any PLT for this symbol, by for example
+ elf_s390_adjust_dynamic_symbol when we're doing a proper dynamic link,
+ or elf_s390_size_dynamic_sections if no dynamic sections will be
+ created (we're only linking static objects). */
+
+static void
+elf_s390_adjust_gotplt (h)
+ struct elf_s390_link_hash_entry *h;
+{
+ if (h->elf.root.type == bfd_link_hash_warning)
+ h = (struct elf_s390_link_hash_entry *) h->elf.root.u.i.link;
- return true;
+ if (h->gotplt_refcount <= 0)
+ return;
+
+ /* We simply add the number of gotplt references to the number
+ * of got references for this symbol. */
+ h->elf.got.refcount += h->gotplt_refcount;
+ h->gotplt_refcount = -1;
}
/* Adjust a symbol defined by a dynamic object and referenced by a
@@ -1051,14 +1568,12 @@ elf_s390_gc_sweep_hook (abfd, info, sec, relocs)
change the definition to something the rest of the link can
understand. */
-static boolean
+static bfd_boolean
elf_s390_adjust_dynamic_symbol (info, h)
struct bfd_link_info *info;
struct elf_link_hash_entry *h;
{
struct elf_s390_link_hash_table *htab;
- struct elf_s390_link_hash_entry * eh;
- struct elf_s390_dyn_relocs *p;
asection *s;
unsigned int power_of_two;
@@ -1076,15 +1591,16 @@ elf_s390_adjust_dynamic_symbol (info, h)
&& h->root.type != bfd_link_hash_undefined))
{
/* This case can occur if we saw a PLT32 reloc in an input
- file, but the symbol was never referred to by a dynamic
- object, or if all references were garbage collected. In
+ file, but the symbol was never referred to by a dynamic
+ object, or if all references were garbage collected. In
such a case, we don't actually need to build a procedure
linkage table, and we can just do a PC32 reloc instead. */
h->plt.offset = (bfd_vma) -1;
h->elf_link_hash_flags &= ~ELF_LINK_HASH_NEEDS_PLT;
+ elf_s390_adjust_gotplt((struct elf_s390_link_hash_entry *) h);
}
- return true;
+ return TRUE;
}
else
/* It's possible that we incorrectly decided a .plt reloc was
@@ -1103,7 +1619,11 @@ elf_s390_adjust_dynamic_symbol (info, h)
|| h->weakdef->root.type == bfd_link_hash_defweak);
h->root.u.def.section = h->weakdef->root.u.def.section;
h->root.u.def.value = h->weakdef->root.u.def.value;
- return true;
+ if (ELIMINATE_COPY_RELOCS || info->nocopyreloc)
+ h->elf_link_hash_flags
+ = ((h->elf_link_hash_flags & ~ELF_LINK_NON_GOT_REF)
+ | (h->weakdef->elf_link_hash_flags & ELF_LINK_NON_GOT_REF));
+ return TRUE;
}
/* This is a reference to a symbol defined by a dynamic object which
@@ -1114,34 +1634,40 @@ elf_s390_adjust_dynamic_symbol (info, h)
For such cases we need not do anything here; the relocations will
be handled correctly by relocate_section. */
if (info->shared)
- return true;
+ 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;
+ return TRUE;
/* If -z nocopyreloc was given, we won't generate them either. */
if (info->nocopyreloc)
{
h->elf_link_hash_flags &= ~ELF_LINK_NON_GOT_REF;
- return true;
+ return TRUE;
}
- eh = (struct elf_s390_link_hash_entry *) h;
- for (p = eh->dyn_relocs; p != NULL; p = p->next)
+ if (ELIMINATE_COPY_RELOCS)
{
- s = p->sec->output_section;
- if (s != NULL && (s->flags & SEC_READONLY) != 0)
- break;
- }
+ struct elf_s390_link_hash_entry * eh;
+ struct elf_s390_dyn_relocs *p;
- /* 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;
+ eh = (struct elf_s390_link_hash_entry *) h;
+ for (p = eh->dyn_relocs; p != NULL; p = p->next)
+ {
+ s = p->sec->output_section;
+ if (s != NULL && (s->flags & SEC_READONLY) != 0)
+ break;
+ }
+
+ /* If we didn't find any dynamic relocs in read-only sections, then
+ we'll be keeping the dynamic relocs and avoiding the copy reloc. */
+ if (p == NULL)
+ {
+ h->elf_link_hash_flags &= ~ELF_LINK_NON_GOT_REF;
+ return TRUE;
+ }
}
/* We must allocate the symbol in our .dynbss section, which will
@@ -1177,7 +1703,7 @@ elf_s390_adjust_dynamic_symbol (info, h)
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;
+ return FALSE;
}
/* Define the symbol as being at this point in the section. */
@@ -1187,24 +1713,13 @@ elf_s390_adjust_dynamic_symbol (info, h)
/* Increment the section size to make room for the symbol. */
s->_raw_size += h->size;
- return true;
+ return TRUE;
}
-/* This is the condition under which elf_s390_finish_dynamic_symbol
- will be called from elflink.h. If elflink.h doesn't call our
- finish_dynamic_symbol routine, we'll need to do something about
- initializing any .plt and .got entries in elf_s390_relocate_section. */
-#define WILL_CALL_FINISH_DYNAMIC_SYMBOL(DYN, INFO, H) \
- ((DYN) \
- && ((INFO)->shared \
- || ((H)->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0) \
- && ((H)->dynindx != -1 \
- || ((H)->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) != 0))
-
/* Allocate space in .plt, .got and associated reloc sections for
dynamic relocs. */
-static boolean
+static bfd_boolean
allocate_dynrelocs (h, inf)
struct elf_link_hash_entry *h;
PTR inf;
@@ -1215,27 +1730,33 @@ allocate_dynrelocs (h, inf)
struct elf_s390_dyn_relocs *p;
if (h->root.type == bfd_link_hash_indirect)
- return true;
+ return TRUE;
if (h->root.type == bfd_link_hash_warning)
+ /* When warning symbols are created, they **replace** the "real"
+ entry in the hash table, thus we never get to see the real
+ symbol in a hash traversal. So look at it now. */
h = (struct elf_link_hash_entry *) h->root.u.i.link;
info = (struct bfd_link_info *) inf;
htab = elf_s390_hash_table (info);
if (htab->elf.dynamic_sections_created
- && h->plt.refcount > 0)
+ && h->plt.refcount > 0
+ && (ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
+ || h->root.type != bfd_link_hash_undefweak))
{
/* Make sure this symbol is output as a dynamic symbol.
Undefined weak syms won't yet be marked as dynamic. */
if (h->dynindx == -1
&& (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0)
{
- if (! bfd_elf32_link_record_dynamic_symbol (info, h))
- return false;
+ if (! bfd_elf_link_record_dynamic_symbol (info, h))
+ return FALSE;
}
- if (WILL_CALL_FINISH_DYNAMIC_SYMBOL (1, info, h))
+ if (info->shared
+ || WILL_CALL_FINISH_DYNAMIC_SYMBOL (1, 0, h))
{
asection *s = htab->splt;
@@ -1272,33 +1793,69 @@ allocate_dynrelocs (h, inf)
{
h->plt.offset = (bfd_vma) -1;
h->elf_link_hash_flags &= ~ELF_LINK_HASH_NEEDS_PLT;
+ elf_s390_adjust_gotplt((struct elf_s390_link_hash_entry *) h);
}
}
else
{
h->plt.offset = (bfd_vma) -1;
h->elf_link_hash_flags &= ~ELF_LINK_HASH_NEEDS_PLT;
+ elf_s390_adjust_gotplt((struct elf_s390_link_hash_entry *) h);
}
- if (h->got.refcount > 0)
+ /* If R_390_TLS_{IE32,GOTIE32,GOTIE12,IEENT} symbol is now local to
+ the binary, we can optimize a bit. IE32 and GOTIE32 get converted
+ to R_390_TLS_LE32 requiring no TLS entry. For GOTIE12 and IEENT
+ we can save the dynamic TLS relocation. */
+ if (h->got.refcount > 0
+ && !info->shared
+ && h->dynindx == -1
+ && elf_s390_hash_entry(h)->tls_type >= GOT_TLS_IE)
{
+ if (elf_s390_hash_entry(h)->tls_type == GOT_TLS_IE_NLT)
+ /* For the GOTIE access without a literal pool entry the offset has
+ to be stored somewhere. The immediate value in the instruction
+ is not bit enough so the value is stored in the got. */
+ {
+ h->got.offset = htab->sgot->_raw_size;
+ htab->sgot->_raw_size += GOT_ENTRY_SIZE;
+ }
+ else
+ h->got.offset = (bfd_vma) -1;
+ }
+ else if (h->got.refcount > 0)
+ {
asection *s;
- boolean dyn;
+ bfd_boolean dyn;
+ int tls_type = elf_s390_hash_entry(h)->tls_type;
/* Make sure this symbol is output as a dynamic symbol.
Undefined weak syms won't yet be marked as dynamic. */
if (h->dynindx == -1
&& (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0)
{
- if (! bfd_elf32_link_record_dynamic_symbol (info, h))
- return false;
+ if (! bfd_elf_link_record_dynamic_symbol (info, h))
+ return FALSE;
}
s = htab->sgot;
h->got.offset = s->_raw_size;
s->_raw_size += GOT_ENTRY_SIZE;
+ /* R_390_TLS_GD32 needs 2 consecutive GOT slots. */
+ if (tls_type == GOT_TLS_GD)
+ s->_raw_size += GOT_ENTRY_SIZE;
dyn = htab->elf.dynamic_sections_created;
- if (WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, info, h))
+ /* R_390_TLS_IE32 needs one dynamic relocation,
+ R_390_TLS_GD32 needs one if local symbol and two if global. */
+ if ((tls_type == GOT_TLS_GD && h->dynindx == -1)
+ || tls_type >= GOT_TLS_IE)
+ htab->srelgot->_raw_size += sizeof (Elf32_External_Rela);
+ else if (tls_type == GOT_TLS_GD)
+ htab->srelgot->_raw_size += 2 * sizeof (Elf32_External_Rela);
+ else if ((ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
+ || h->root.type != bfd_link_hash_undefweak)
+ && (info->shared
+ || WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, 0, h)))
htab->srelgot->_raw_size += sizeof (Elf32_External_Rela);
}
else
@@ -1306,7 +1863,7 @@ allocate_dynrelocs (h, inf)
eh = (struct elf_s390_link_hash_entry *) h;
if (eh->dyn_relocs == NULL)
- return true;
+ return TRUE;
/* In the shared -Bsymbolic case, discard space allocated for
dynamic pc-relative relocs against symbols which turn out to be
@@ -1316,9 +1873,7 @@ allocate_dynrelocs (h, inf)
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))
+ if (SYMBOL_REFERENCES_LOCAL (info, h))
{
struct elf_s390_dyn_relocs **pp;
@@ -1332,8 +1887,14 @@ allocate_dynrelocs (h, inf)
pp = &p->next;
}
}
+
+ /* Also discard relocs on undefined weak syms with non-default
+ visibility. */
+ if (ELF_ST_VISIBILITY (h->other) != STV_DEFAULT
+ && h->root.type == bfd_link_hash_undefweak)
+ eh->dyn_relocs = NULL;
}
- else
+ 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
@@ -1351,8 +1912,8 @@ allocate_dynrelocs (h, inf)
if (h->dynindx == -1
&& (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0)
{
- if (! bfd_elf32_link_record_dynamic_symbol (info, h))
- return false;
+ if (! bfd_elf_link_record_dynamic_symbol (info, h))
+ return FALSE;
}
/* If that succeeded, we know we'll be keeping all the
@@ -1370,15 +1931,16 @@ 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 (Elf32_External_Rela);
}
- return true;
+ return TRUE;
}
/* Find any dynamic relocs that apply to read-only sections. */
-static boolean
+static bfd_boolean
readonly_dynrelocs (h, inf)
struct elf_link_hash_entry *h;
PTR inf;
@@ -1401,15 +1963,15 @@ readonly_dynrelocs (h, inf)
info->flags |= DF_TEXTREL;
/* Not an error, just cut short the traversal. */
- return false;
+ return FALSE;
}
}
- return true;
+ return TRUE;
}
/* Set the sizes of the dynamic sections. */
-static boolean
+static bfd_boolean
elf_s390_size_dynamic_sections (output_bfd, info)
bfd *output_bfd ATTRIBUTE_UNUSED;
struct bfd_link_info *info;
@@ -1417,7 +1979,7 @@ elf_s390_size_dynamic_sections (output_bfd, info)
struct elf_s390_link_hash_table *htab;
bfd *dynobj;
asection *s;
- boolean relocs;
+ bfd_boolean relocs;
bfd *ibfd;
htab = elf_s390_hash_table (info);
@@ -1428,7 +1990,7 @@ elf_s390_size_dynamic_sections (output_bfd, info)
if (htab->elf.dynamic_sections_created)
{
/* Set the contents of the .interp section to the interpreter. */
- if (! info->shared)
+ if (info->executable)
{
s = bfd_get_section_by_name (dynobj, ".interp");
if (s == NULL)
@@ -1444,6 +2006,7 @@ elf_s390_size_dynamic_sections (output_bfd, info)
{
bfd_signed_vma *local_got;
bfd_signed_vma *end_local_got;
+ char *local_tls_type;
bfd_size_type locsymcount;
Elf_Internal_Shdr *symtab_hdr;
asection *srela;
@@ -1485,14 +2048,17 @@ elf_s390_size_dynamic_sections (output_bfd, info)
symtab_hdr = &elf_tdata (ibfd)->symtab_hdr;
locsymcount = symtab_hdr->sh_info;
end_local_got = local_got + locsymcount;
+ local_tls_type = elf_s390_local_got_tls_type (ibfd);
s = htab->sgot;
srela = htab->srelgot;
- for (; local_got < end_local_got; ++local_got)
+ for (; local_got < end_local_got; ++local_got, ++local_tls_type)
{
if (*local_got > 0)
{
*local_got = s->_raw_size;
s->_raw_size += GOT_ENTRY_SIZE;
+ if (*local_tls_type == GOT_TLS_GD)
+ s->_raw_size += GOT_ENTRY_SIZE;
if (info->shared)
srela->_raw_size += sizeof (Elf32_External_Rela);
}
@@ -1501,13 +2067,24 @@ elf_s390_size_dynamic_sections (output_bfd, info)
}
}
+ if (htab->tls_ldm_got.refcount > 0)
+ {
+ /* Allocate 2 got entries and 1 dynamic reloc for R_390_TLS_LDM32
+ relocs. */
+ htab->tls_ldm_got.offset = htab->sgot->_raw_size;
+ htab->sgot->_raw_size += 2 * GOT_ENTRY_SIZE;
+ htab->srelgot->_raw_size += sizeof (Elf32_External_Rela);
+ }
+ else
+ htab->tls_ldm_got.offset = -1;
+
/* Allocate global sym .plt and .got entries, and space for global
sym dynamic relocs. */
elf_link_hash_traverse (&htab->elf, allocate_dynrelocs, (PTR) info);
/* We now have determined the sizes of the various dynamic sections.
Allocate memory for them. */
- relocs = false;
+ relocs = FALSE;
for (s = dynobj->sections; s != NULL; s = s->next)
{
if ((s->flags & SEC_LINKER_CREATED) == 0)
@@ -1522,8 +2099,8 @@ elf_s390_size_dynamic_sections (output_bfd, info)
}
else if (strncmp (bfd_get_section_name (dynobj, s), ".rela", 5) == 0)
{
- if (s->_raw_size != 0 && s != htab->srelplt)
- relocs = true;
+ if (s->_raw_size != 0)
+ relocs = TRUE;
/* We use the reloc_count field as a counter if we need
to copy relocs into the output file. */
@@ -1558,7 +2135,7 @@ elf_s390_size_dynamic_sections (output_bfd, info)
of garbage. */
s->contents = (bfd_byte *) bfd_zalloc (dynobj, s->_raw_size);
if (s->contents == NULL)
- return false;
+ return FALSE;
}
if (htab->elf.dynamic_sections_created)
@@ -1569,12 +2146,12 @@ elf_s390_size_dynamic_sections (output_bfd, info)
the .dynamic section. The DT_DEBUG entry is filled in by the
dynamic linker and used by the debugger. */
#define add_dynamic_entry(TAG, VAL) \
- bfd_elf32_add_dynamic_entry (info, (bfd_vma) (TAG), (bfd_vma) (VAL))
+ _bfd_elf_add_dynamic_entry (info, TAG, VAL)
- if (! info->shared)
+ if (info->executable)
{
if (!add_dynamic_entry (DT_DEBUG, 0))
- return false;
+ return FALSE;
}
if (htab->splt->_raw_size != 0)
@@ -1583,15 +2160,15 @@ elf_s390_size_dynamic_sections (output_bfd, info)
|| !add_dynamic_entry (DT_PLTRELSZ, 0)
|| !add_dynamic_entry (DT_PLTREL, DT_RELA)
|| !add_dynamic_entry (DT_JMPREL, 0))
- return false;
+ 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 (!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. */
@@ -1602,18 +2179,68 @@ elf_s390_size_dynamic_sections (output_bfd, info)
if ((info->flags & DF_TEXTREL) != 0)
{
if (!add_dynamic_entry (DT_TEXTREL, 0))
- return false;
+ return FALSE;
}
}
}
#undef add_dynamic_entry
- return 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. */
+
+static bfd_vma
+dtpoff_base (info)
+ struct bfd_link_info *info;
+{
+ /* If tls_sec is NULL, we should have signalled an error already. */
+ if (elf_hash_table (info)->tls_sec == NULL)
+ return 0;
+ return elf_hash_table (info)->tls_sec->vma;
+}
+
+/* Return the relocation value for @tpoff relocation
+ if STT_TLS virtual address is ADDRESS. */
+
+static bfd_vma
+tpoff (info, address)
+ struct bfd_link_info *info;
+ bfd_vma address;
+{
+ struct elf_link_hash_table *htab = elf_hash_table (info);
+
+ /* If tls_sec is NULL, we should have signalled an error already. */
+ if (htab->tls_sec == NULL)
+ return 0;
+ return htab->tls_size + htab->tls_sec->vma - address;
+}
+
+/* Complain if TLS instruction relocation is against an invalid
+ instruction. */
+
+static void
+invalid_tls_insn (input_bfd, input_section, rel)
+ bfd *input_bfd;
+ asection *input_section;
+ Elf_Internal_Rela *rel;
+{
+ reloc_howto_type *howto;
+
+ howto = elf_howto_table + ELF32_R_TYPE (rel->r_info);
+ (*_bfd_error_handler)
+ (_("%s(%s+0x%lx): invalid instruction for TLS relocation %s"),
+ bfd_archive_filename (input_bfd),
+ bfd_get_section_name (input_bfd, input_section),
+ (long) rel->r_offset,
+ howto->name);
}
/* Relocate a 390 ELF section. */
-static boolean
+static bfd_boolean
elf_s390_relocate_section (output_bfd, info, input_bfd, input_section,
contents, relocs, local_syms, local_sections)
bfd *output_bfd;
@@ -1632,8 +2259,8 @@ elf_s390_relocate_section (output_bfd, info, input_bfd, input_section,
Elf_Internal_Rela *rel;
Elf_Internal_Rela *relend;
- if (info->relocateable)
- return true;
+ if (info->relocatable)
+ return TRUE;
htab = elf_s390_hash_table (info);
symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr;
@@ -1644,7 +2271,7 @@ elf_s390_relocate_section (output_bfd, info, input_bfd, input_section,
relend = relocs + input_section->reloc_count;
for (; rel < relend; rel++)
{
- int r_type;
+ unsigned int r_type;
reloc_howto_type *howto;
unsigned long r_symndx;
struct elf_link_hash_entry *h;
@@ -1652,250 +2279,279 @@ elf_s390_relocate_section (output_bfd, info, input_bfd, input_section,
asection *sec;
bfd_vma off;
bfd_vma relocation;
- boolean unresolved_reloc;
+ bfd_boolean unresolved_reloc;
bfd_reloc_status_type r;
+ int tls_type;
r_type = ELF32_R_TYPE (rel->r_info);
if (r_type == (int) R_390_GNU_VTINHERIT
- || r_type == (int) R_390_GNU_VTENTRY)
- continue;
- if (r_type < 0 || r_type >= (int) R_390_max)
+ || r_type == (int) R_390_GNU_VTENTRY)
+ continue;
+ if (r_type >= (int) R_390_max)
{
bfd_set_error (bfd_error_bad_value);
- return false;
+ return FALSE;
}
howto = elf_howto_table + r_type;
r_symndx = ELF32_R_SYM (rel->r_info);
+
+ /* This is a final link. */
h = NULL;
sym = NULL;
sec = NULL;
- unresolved_reloc = false;
+ 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);
+ relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel);
}
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;
+ bfd_boolean warned ATTRIBUTE_UNUSED;
- if (h->root.type == bfd_link_hash_defined
- || h->root.type == bfd_link_hash_defweak)
- {
- sec = h->root.u.def.section;
- if (sec->output_section == NULL)
- {
- /* Set a flag that will be cleared later if we find a
- relocation value for this symbol. output_section
- is typically NULL for symbols satisfied by a shared
- library. */
- unresolved_reloc = true;
- relocation = 0;
- }
- else
- relocation = (h->root.u.def.value
- + sec->output_section->vma
- + sec->output_offset);
- }
- else if (h->root.type == bfd_link_hash_undefweak)
- relocation = 0;
- else if (info->shared
- && (!info->symbolic || info->allow_shlib_undefined)
- && !info->no_undefined
- && ELF_ST_VISIBILITY (h->other) == STV_DEFAULT)
- relocation = 0;
- else
- {
- if (! ((*info->callbacks->undefined_symbol)
- (info, h->root.root.string, input_bfd,
- input_section, rel->r_offset,
- (!info->shared || info->no_undefined
- || ELF_ST_VISIBILITY (h->other)))))
- return false;
- relocation = 0;
- }
+ RELOC_FOR_GLOBAL_SYMBOL (info, input_bfd, input_section, rel,
+ r_symndx, symtab_hdr, sym_hashes,
+ h, sec, relocation,
+ unresolved_reloc, warned);
}
switch (r_type)
{
- case R_390_GOT12:
- case R_390_GOT16:
- case R_390_GOT32:
+ case R_390_GOTPLT12:
+ case R_390_GOTPLT16:
+ case R_390_GOTPLT20:
+ case R_390_GOTPLT32:
+ case R_390_GOTPLTENT:
+ /* There are three cases for a GOTPLT relocation. 1) The
+ relocation is against the jump slot entry of a plt that
+ will get emitted to the output file. 2) The relocation
+ is against the jump slot of a plt entry that has been
+ removed. elf_s390_adjust_gotplt has created a GOT entry
+ as replacement. 3) The relocation is against a local symbol.
+ Cases 2) and 3) are the same as the GOT relocation code
+ so we just have to test for case 1 and fall through for
+ the other two. */
+ if (h != NULL && h->plt.offset != (bfd_vma) -1)
+ {
+ bfd_vma plt_index;
+
+ /* Calc. index no.
+ Current offset - size first entry / entry size. */
+ plt_index = (h->plt.offset - PLT_FIRST_ENTRY_SIZE) /
+ PLT_ENTRY_SIZE;
+
+ /* Offset in GOT is PLT index plus GOT headers(3) times 4,
+ addr & GOT addr. */
+ relocation = (plt_index + 3) * GOT_ENTRY_SIZE;
+ unresolved_reloc = FALSE;
+
+ if (r_type == R_390_GOTPLTENT)
+ relocation += htab->sgot->output_section->vma;
+ break;
+ }
+ /* Fall through. */
+
+ case R_390_GOT12:
+ case R_390_GOT16:
+ case R_390_GOT20:
+ case R_390_GOT32:
case R_390_GOTENT:
- /* Relocation is to the entry for this symbol in the global
- offset table. */
+ /* Relocation is to the entry for this symbol in the global
+ offset table. */
if (htab->sgot == NULL)
abort ();
- if (h != NULL)
- {
- boolean dyn;
+ if (h != NULL)
+ {
+ bfd_boolean dyn;
- off = h->got.offset;
+ off = h->got.offset;
dyn = htab->elf.dynamic_sections_created;
- if (! WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, info, h)
- || (info->shared
- && (info->symbolic
+ 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 2, we use the
- least significant bit to record whether we have
- initialized it already.
-
- When doing a dynamic link, we create a .rel.got
- relocation entry to initialize the value. This
- is done in the finish_dynamic_symbol routine. */
- if ((off & 1) != 0)
- off &= ~1;
- else
- {
+ && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR))
+ || (ELF_ST_VISIBILITY (h->other)
+ && h->root.type == bfd_link_hash_undefweak))
+ {
+ /* This is actually a static link, or it is a
+ -Bsymbolic link and the symbol is defined
+ locally, or the symbol was forced to be local
+ because of a version file. We must initialize
+ this entry in the global offset table. Since the
+ offset must always be a multiple of 2, we use the
+ least significant bit to record whether we have
+ initialized it already.
+
+ When doing a dynamic link, we create a .rel.got
+ relocation entry to initialize the value. This
+ is done in the finish_dynamic_symbol routine. */
+ if ((off & 1) != 0)
+ off &= ~1;
+ else
+ {
bfd_put_32 (output_bfd, relocation,
htab->sgot->contents + off);
- h->got.offset |= 1;
- }
- }
+ h->got.offset |= 1;
+ }
+ }
else
- unresolved_reloc = false;
- }
- else
- {
+ unresolved_reloc = FALSE;
+ }
+ else
+ {
if (local_got_offsets == NULL)
abort ();
- off = local_got_offsets[r_symndx];
+ off = local_got_offsets[r_symndx];
- /* The offset must always be a multiple of 4. We use
- the least significant bit to record whether we have
- already generated the necessary reloc. */
- if ((off & 1) != 0)
- off &= ~1;
- else
- {
- bfd_put_32 (output_bfd, relocation,
+ /* The offset must always be a multiple of 4. We use
+ the least significant bit to record whether we have
+ already generated the necessary reloc. */
+ if ((off & 1) != 0)
+ off &= ~1;
+ else
+ {
+ bfd_put_32 (output_bfd, relocation,
htab->sgot->contents + off);
- if (info->shared)
- {
- asection *srelgot;
- Elf_Internal_Rela outrel;
- Elf32_External_Rela *loc;
+ if (info->shared)
+ {
+ asection *srelgot;
+ Elf_Internal_Rela outrel;
+ bfd_byte *loc;
- srelgot = htab->srelgot;
+ srelgot = htab->srelgot;
if (srelgot == NULL)
abort ();
- outrel.r_offset = (htab->sgot->output_section->vma
- + htab->sgot->output_offset
- + off);
- outrel.r_info = ELF32_R_INFO (0, R_390_RELATIVE);
+ outrel.r_offset = (htab->sgot->output_section->vma
+ + htab->sgot->output_offset
+ + off);
+ outrel.r_info = ELF32_R_INFO (0, R_390_RELATIVE);
outrel.r_addend = relocation;
- loc = (Elf32_External_Rela *) srelgot->contents;
- loc += srelgot->reloc_count++;
- bfd_elf32_swap_reloca_out (output_bfd, &outrel, loc);
- }
+ loc = srelgot->contents;
+ loc += srelgot->reloc_count++ * sizeof (Elf32_External_Rela);
+ bfd_elf32_swap_reloca_out (output_bfd, &outrel, loc);
+ }
- local_got_offsets[r_symndx] |= 1;
- }
- }
+ local_got_offsets[r_symndx] |= 1;
+ }
+ }
if (off >= (bfd_vma) -2)
abort ();
relocation = htab->sgot->output_offset + off;
- /*
- * For @GOTENT the relocation is against the offset between
- * the instruction and the symbols entry in the GOT and not
- * between the start of the GOT and the symbols entry. We
- * add the vma of the GOT to get the correct value.
- */
- if (r_type == R_390_GOTENT)
+ /* For @GOTENT the relocation is against the offset between
+ the instruction and the symbols entry in the GOT and not
+ between the start of the GOT and the symbols entry. We
+ add the vma of the GOT to get the correct value. */
+ if ( r_type == R_390_GOTENT
+ || r_type == R_390_GOTPLTENT)
relocation += htab->sgot->output_section->vma;
- break;
-
- case R_390_GOTOFF:
- /* Relocation is relative to the start of the global offset
- table. */
+ break;
- /* Note that sgot->output_offset is not involved in this
- calculation. We always want the start of .got. If we
- defined _GLOBAL_OFFSET_TABLE in a different way, as is
- permitted by the ABI, we might have to change this
- calculation. */
- relocation -= htab->sgot->output_section->vma;
- break;
+ case R_390_GOTOFF16:
+ case R_390_GOTOFF32:
+ /* Relocation is relative to the start of the global offset
+ table. */
+
+ /* Note that sgot->output_offset is not involved in this
+ calculation. We always want the start of .got. If we
+ defined _GLOBAL_OFFSET_TABLE in a different way, as is
+ permitted by the ABI, we might have to change this
+ calculation. */
+ relocation -= htab->sgot->output_section->vma;
+ break;
- case R_390_GOTPC:
+ case R_390_GOTPC:
case R_390_GOTPCDBL:
- /* Use global offset table as symbol value. */
- relocation = htab->sgot->output_section->vma;
- unresolved_reloc = false;
- break;
-
- case R_390_PLT16DBL:
- case R_390_PLT32DBL:
- case R_390_PLT32:
- /* Relocation is to the entry for this symbol in the
- procedure linkage table. */
-
- /* Resolve a PLT32 reloc against a local symbol directly,
- without using the procedure linkage table. */
- if (h == NULL)
- break;
-
- if (h->plt.offset == (bfd_vma) -1
+ /* Use global offset table as symbol value. */
+ relocation = htab->sgot->output_section->vma;
+ unresolved_reloc = FALSE;
+ break;
+
+ case R_390_PLT16DBL:
+ case R_390_PLT32DBL:
+ case R_390_PLT32:
+ /* Relocation is to the entry for this symbol in the
+ procedure linkage table. */
+
+ /* Resolve a PLT32 reloc against a local symbol directly,
+ without using the procedure linkage table. */
+ if (h == NULL)
+ break;
+
+ if (h->plt.offset == (bfd_vma) -1
|| htab->splt == NULL)
- {
- /* We didn't make a PLT entry for this symbol. This
- happens when statically linking PIC code, or when
- using -Bsymbolic. */
- break;
- }
-
- relocation = (htab->splt->output_section->vma
- + htab->splt->output_offset
- + h->plt.offset);
- unresolved_reloc = false;
- break;
-
- case R_390_8:
- case R_390_16:
- case R_390_32:
- case R_390_PC16:
- case R_390_PC16DBL:
- case R_390_PC32DBL:
- case R_390_PC32:
+ {
+ /* We didn't make a PLT entry for this symbol. This
+ happens when statically linking PIC code, or when
+ using -Bsymbolic. */
+ break;
+ }
+
+ relocation = (htab->splt->output_section->vma
+ + htab->splt->output_offset
+ + h->plt.offset);
+ unresolved_reloc = FALSE;
+ break;
+
+ case R_390_PLTOFF16:
+ case R_390_PLTOFF32:
+ /* Relocation is to the entry for this symbol in the
+ procedure linkage table relative to the start of the GOT. */
+
+ /* For local symbols or if we didn't make a PLT entry for
+ this symbol resolve the symbol directly. */
+ if ( h == NULL
+ || h->plt.offset == (bfd_vma) -1
+ || htab->splt == NULL)
+ {
+ relocation -= htab->sgot->output_section->vma;
+ break;
+ }
+
+ relocation = (htab->splt->output_section->vma
+ + htab->splt->output_offset
+ + h->plt.offset
+ - htab->sgot->output_section->vma);
+ unresolved_reloc = FALSE;
+ break;
+
+ case R_390_8:
+ case R_390_16:
+ case R_390_32:
+ case R_390_PC16:
+ case R_390_PC16DBL:
+ case R_390_PC32DBL:
+ case R_390_PC32:
/* r_symndx will be zero only for relocs against symbols
from removed linkonce sections, or sections discarded by
a linker script. */
- if (r_symndx == 0
- || (input_section->flags & SEC_ALLOC) == 0)
+ if (r_symndx == 0
+ || (input_section->flags & SEC_ALLOC) == 0)
break;
- if ((info->shared
+ if ((info->shared
+ && (h == NULL
+ || ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
+ || h->root.type != bfd_link_hash_undefweak)
&& ((r_type != R_390_PC16
&& r_type != R_390_PC16DBL
&& r_type != R_390_PC32DBL
&& r_type != R_390_PC32)
|| (h != NULL
- && h->dynindx != -1
- && (! info->symbolic
- || (h->elf_link_hash_flags
- & ELF_LINK_HASH_DEF_REGULAR) == 0))))
- || (!info->shared
+ && !SYMBOL_REFERENCES_LOCAL (info, h))))
+ || (ELIMINATE_COPY_RELOCS
+ && !info->shared
&& h != NULL
&& h->dynindx != -1
&& (h->elf_link_hash_flags & ELF_LINK_NON_GOT_REF) == 0
@@ -1905,32 +2561,32 @@ elf_s390_relocate_section (output_bfd, info, input_bfd, input_section,
& ELF_LINK_HASH_DEF_REGULAR) == 0)
|| h->root.type == bfd_link_hash_undefweak
|| h->root.type == bfd_link_hash_undefined)))
- {
- Elf_Internal_Rela outrel;
- boolean skip, relocate;
+ {
+ Elf_Internal_Rela outrel;
+ bfd_boolean skip, relocate;
asection *sreloc;
- Elf32_External_Rela *loc;
+ bfd_byte *loc;
/* When generating a shared object, these relocations
are copied into the output file to be resolved at run
time. */
- skip = false;
- relocate = false;
+ 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;
+ 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);
+ skip = TRUE, relocate = TRUE;
+ outrel.r_offset += (input_section->output_section->vma
+ + input_section->output_offset);
- if (skip)
+ if (skip)
memset (&outrel, 0, sizeof outrel);
- else if (h != NULL
+ else if (h != NULL
&& h->dynindx != -1
&& (r_type == R_390_PC16
|| r_type == R_390_PC16DBL
@@ -1940,35 +2596,392 @@ elf_s390_relocate_section (output_bfd, info, input_bfd, input_section,
|| !info->symbolic
|| (h->elf_link_hash_flags
& ELF_LINK_HASH_DEF_REGULAR) == 0))
- {
- outrel.r_info = ELF32_R_INFO (h->dynindx, r_type);
+ {
+ outrel.r_info = ELF32_R_INFO (h->dynindx, r_type);
outrel.r_addend = rel->r_addend;
- }
- else
- {
+ }
+ else
+ {
/* This symbol is local, or marked to become local. */
- relocate = true;
- outrel.r_info = ELF32_R_INFO (0, R_390_RELATIVE);
outrel.r_addend = relocation + rel->r_addend;
- }
+ if (r_type == R_390_32)
+ {
+ relocate = TRUE;
+ outrel.r_info = ELF32_R_INFO (0, R_390_RELATIVE);
+ }
+ else
+ {
+ long sindx;
+
+ if (bfd_is_abs_section (sec))
+ sindx = 0;
+ else if (sec == NULL || sec->owner == NULL)
+ {
+ bfd_set_error(bfd_error_bad_value);
+ return FALSE;
+ }
+ else
+ {
+ asection *osec;
+
+ osec = sec->output_section;
+ sindx = elf_section_data (osec)->dynindx;
+ BFD_ASSERT (sindx > 0);
+
+ /* We are turning this relocation into one
+ against a section symbol, so subtract out
+ the output section's address but not the
+ offset of the input section in the output
+ section. */
+
+ outrel.r_addend -= osec->vma;
+ }
+ outrel.r_info = ELF32_R_INFO (sindx, r_type);
+ }
+ }
sreloc = elf_section_data (input_section)->sreloc;
if (sreloc == NULL)
abort ();
- loc = (Elf32_External_Rela *) sreloc->contents;
- loc += sreloc->reloc_count++;
+ loc = sreloc->contents;
+ loc += sreloc->reloc_count++ * sizeof (Elf32_External_Rela);
bfd_elf32_swap_reloca_out (output_bfd, &outrel, loc);
- /* If this reloc is against an external symbol, we do
- not want to fiddle with the addend. Otherwise, we
- need to include the symbol value so that it becomes
- an addend for the dynamic reloc. */
- if (! relocate)
- continue;
- }
+ /* If this reloc is against an external symbol, we do
+ not want to fiddle with the addend. Otherwise, we
+ need to include the symbol value so that it becomes
+ an addend for the dynamic reloc. */
+ if (! relocate)
+ continue;
+ }
break;
+ /* Relocations for tls literal pool entries. */
+ case R_390_TLS_IE32:
+ if (info->shared)
+ {
+ Elf_Internal_Rela outrel;
+ asection *sreloc;
+ bfd_byte *loc;
+
+ outrel.r_offset = rel->r_offset
+ + input_section->output_section->vma
+ + input_section->output_offset;
+ outrel.r_info = ELF32_R_INFO (0, R_390_RELATIVE);
+ sreloc = elf_section_data (input_section)->sreloc;
+ if (sreloc == NULL)
+ abort ();
+ loc = sreloc->contents;
+ loc += sreloc->reloc_count++ * sizeof (Elf32_External_Rela);
+ bfd_elf32_swap_reloc_out (output_bfd, &outrel, loc);
+ }
+ /* Fall through. */
+
+ case R_390_TLS_GD32:
+ case R_390_TLS_GOTIE32:
+ r_type = elf_s390_tls_transition (info, r_type, h == NULL);
+ tls_type = GOT_UNKNOWN;
+ if (h == NULL && local_got_offsets)
+ tls_type = elf_s390_local_got_tls_type (input_bfd) [r_symndx];
+ else if (h != NULL)
+ {
+ tls_type = elf_s390_hash_entry(h)->tls_type;
+ if (!info->shared && h->dynindx == -1 && tls_type >= GOT_TLS_IE)
+ r_type = R_390_TLS_LE32;
+ }
+ if (r_type == R_390_TLS_GD32 && tls_type >= GOT_TLS_IE)
+ r_type = R_390_TLS_IE32;
+
+ if (r_type == R_390_TLS_LE32)
+ {
+ /* This relocation gets optimized away by the local exec
+ access optimization. */
+ BFD_ASSERT (! unresolved_reloc);
+ bfd_put_32 (output_bfd, -tpoff (info, relocation),
+ contents + rel->r_offset);
+ continue;
+ }
+
+ if (htab->sgot == NULL)
+ abort ();
+
+ if (h != NULL)
+ off = h->got.offset;
+ else
+ {
+ if (local_got_offsets == NULL)
+ abort ();
+
+ off = local_got_offsets[r_symndx];
+ }
+
+ emit_tls_relocs:
+
+ if ((off & 1) != 0)
+ off &= ~1;
+ else
+ {
+ Elf_Internal_Rela outrel;
+ bfd_byte *loc;
+ int dr_type, indx;
+
+ if (htab->srelgot == NULL)
+ abort ();
+
+ outrel.r_offset = (htab->sgot->output_section->vma
+ + htab->sgot->output_offset + off);
+
+ indx = h && h->dynindx != -1 ? h->dynindx : 0;
+ if (r_type == R_390_TLS_GD32)
+ dr_type = R_390_TLS_DTPMOD;
+ else
+ dr_type = R_390_TLS_TPOFF;
+ if (dr_type == R_390_TLS_TPOFF && indx == 0)
+ outrel.r_addend = relocation - dtpoff_base (info);
+ else
+ outrel.r_addend = 0;
+ outrel.r_info = ELF32_R_INFO (indx, dr_type);
+ loc = htab->srelgot->contents;
+ loc += htab->srelgot->reloc_count++
+ * sizeof (Elf32_External_Rela);
+ bfd_elf32_swap_reloca_out (output_bfd, &outrel, loc);
+
+ if (r_type == R_390_TLS_GD32)
+ {
+ if (indx == 0)
+ {
+ BFD_ASSERT (! unresolved_reloc);
+ bfd_put_32 (output_bfd,
+ relocation - dtpoff_base (info),
+ htab->sgot->contents + off + GOT_ENTRY_SIZE);
+ }
+ else
+ {
+ outrel.r_info = ELF32_R_INFO (indx, R_390_TLS_DTPOFF);
+ outrel.r_offset += GOT_ENTRY_SIZE;
+ outrel.r_addend = 0;
+ htab->srelgot->reloc_count++;
+ loc += sizeof (Elf32_External_Rela);
+ bfd_elf32_swap_reloca_out (output_bfd, &outrel, loc);
+ }
+ }
+
+ if (h != NULL)
+ h->got.offset |= 1;
+ else
+ local_got_offsets[r_symndx] |= 1;
+ }
+
+ if (off >= (bfd_vma) -2)
+ abort ();
+ if (r_type == ELF32_R_TYPE (rel->r_info))
+ {
+ relocation = htab->sgot->output_offset + off;
+ if (r_type == R_390_TLS_IE32 || r_type == R_390_TLS_IEENT)
+ relocation += htab->sgot->output_section->vma;
+ unresolved_reloc = FALSE;
+ }
+ else
+ {
+ bfd_put_32 (output_bfd, htab->sgot->output_offset + off,
+ contents + rel->r_offset);
+ continue;
+ }
+ break;
+
+ case R_390_TLS_GOTIE12:
+ case R_390_TLS_GOTIE20:
+ case R_390_TLS_IEENT:
+ if (h == NULL)
+ {
+ if (local_got_offsets == NULL)
+ abort();
+ off = local_got_offsets[r_symndx];
+ if (info->shared)
+ goto emit_tls_relocs;
+ }
+ else
+ {
+ off = h->got.offset;
+ tls_type = elf_s390_hash_entry(h)->tls_type;
+ if (info->shared || h->dynindx != -1 || tls_type < GOT_TLS_IE)
+ goto emit_tls_relocs;
+ }
+
+ if (htab->sgot == NULL)
+ abort ();
+
+ BFD_ASSERT (! unresolved_reloc);
+ bfd_put_32 (output_bfd, -tpoff (info, relocation),
+ htab->sgot->contents + off);
+ relocation = htab->sgot->output_offset + off;
+ if (r_type == R_390_TLS_IEENT)
+ relocation += htab->sgot->output_section->vma;
+ unresolved_reloc = FALSE;
+ break;
+
+ case R_390_TLS_LDM32:
+ if (! info->shared)
+ /* The literal pool entry this relocation refers to gets ignored
+ by the optimized code of the local exec model. Do nothing
+ and the value will turn out zero. */
+ continue;
+
+ if (htab->sgot == NULL)
+ abort ();
+
+ off = htab->tls_ldm_got.offset;
+ if (off & 1)
+ off &= ~1;
+ else
+ {
+ Elf_Internal_Rela outrel;
+ bfd_byte *loc;
+
+ if (htab->srelgot == NULL)
+ abort ();
+
+ outrel.r_offset = (htab->sgot->output_section->vma
+ + htab->sgot->output_offset + off);
+
+ bfd_put_32 (output_bfd, 0,
+ htab->sgot->contents + off + GOT_ENTRY_SIZE);
+ outrel.r_info = ELF32_R_INFO (0, R_390_TLS_DTPMOD);
+ outrel.r_addend = 0;
+ loc = htab->srelgot->contents;
+ loc += htab->srelgot->reloc_count++
+ * sizeof (Elf32_External_Rela);
+ bfd_elf32_swap_reloca_out (output_bfd, &outrel, loc);
+ htab->tls_ldm_got.offset |= 1;
+ }
+ relocation = htab->sgot->output_offset + off;
+ unresolved_reloc = FALSE;
+ break;
+
+ case R_390_TLS_LE32:
+ if (info->shared)
+ {
+ /* Linking a shared library with non-fpic code requires
+ a R_390_TLS_TPOFF relocation. */
+ Elf_Internal_Rela outrel;
+ asection *sreloc;
+ bfd_byte *loc;
+ int indx;
+
+ outrel.r_offset = rel->r_offset
+ + input_section->output_section->vma
+ + input_section->output_offset;
+ if (h != NULL && h->dynindx != -1)
+ indx = h->dynindx;
+ else
+ indx = 0;
+ outrel.r_info = ELF32_R_INFO (indx, R_390_TLS_TPOFF);
+ if (indx == 0)
+ outrel.r_addend = relocation - dtpoff_base (info);
+ else
+ outrel.r_addend = 0;
+ sreloc = elf_section_data (input_section)->sreloc;
+ if (sreloc == NULL)
+ abort ();
+ loc = sreloc->contents;
+ loc += sreloc->reloc_count++ * sizeof (Elf32_External_Rela);
+ bfd_elf32_swap_reloca_out (output_bfd, &outrel, loc);
+ }
+ else
+ {
+ BFD_ASSERT (! unresolved_reloc);
+ bfd_put_32 (output_bfd, -tpoff (info, relocation),
+ contents + rel->r_offset);
+ }
+ continue;
+
+ case R_390_TLS_LDO32:
+ if (info->shared || (input_section->flags & SEC_CODE) == 0)
+ relocation -= dtpoff_base (info);
+ else
+ /* When converting LDO to LE, we must negate. */
+ relocation = -tpoff (info, relocation);
+ break;
+
+ /* Relocations for tls instructions. */
+ case R_390_TLS_LOAD:
+ case R_390_TLS_GDCALL:
+ case R_390_TLS_LDCALL:
+ tls_type = GOT_UNKNOWN;
+ if (h == NULL && local_got_offsets)
+ tls_type = elf_s390_local_got_tls_type (input_bfd) [r_symndx];
+ else if (h != NULL)
+ tls_type = elf_s390_hash_entry(h)->tls_type;
+
+ if (tls_type == GOT_TLS_GD)
+ continue;
+
+ if (r_type == R_390_TLS_LOAD)
+ {
+ if (!info->shared && (h == NULL || h->dynindx == -1))
+ {
+ /* IE->LE transition. Four valid cases:
+ l %rx,0(0,%ry) -> lr %rx,%ry + bcr 0,0
+ l %rx,0(%ry,0) -> lr %rx,%ry + bcr 0,0
+ l %rx,0(%ry,%r12) -> lr %rx,%ry + bcr 0,0
+ l %rx,0(%r12,%ry) -> lr %rx,%ry + bcr 0,0 */
+ unsigned int insn, ry;
+
+ insn = bfd_get_32 (input_bfd, contents + rel->r_offset);
+ ry = 0;
+ if ((insn & 0xff00f000) == 0x58000000)
+ /* l %rx,0(%ry,0) -> lr %rx,%ry + bcr 0,0 */
+ ry = (insn & 0x000f0000);
+ else if ((insn & 0xff0f0000) == 0x58000000)
+ /* l %rx,0(0,%ry) -> lr %rx,%ry + bcr 0,0 */
+ ry = (insn & 0x0000f000) << 4;
+ else if ((insn & 0xff00f000) == 0x5800c000)
+ /* l %rx,0(%ry,%r12) -> lr %rx,%ry + bcr 0,0 */
+ ry = (insn & 0x000f0000);
+ else if ((insn & 0xff0f0000) == 0x580c0000)
+ /* l %rx,0(%r12,%ry) -> lr %rx,%ry + bcr 0,0 */
+ ry = (insn & 0x0000f000) << 4;
+ else
+ invalid_tls_insn (input_bfd, input_section, rel);
+ insn = 0x18000700 | (insn & 0x00f00000) | ry;
+ bfd_put_32 (output_bfd, insn, contents + rel->r_offset);
+ }
+ }
+ else if (r_type == R_390_TLS_GDCALL)
+ {
+ unsigned int insn;
+
+ insn = bfd_get_32 (input_bfd, contents + rel->r_offset);
+ if ((insn & 0xff000fff) != 0x4d000000)
+ invalid_tls_insn (input_bfd, input_section, rel);
+ if (!info->shared && (h == NULL || h->dynindx == -1))
+ /* GD->LE transition.
+ bas %r14,0(%rx,%r13) -> bc 0,0 */
+ insn = 0x47000000;
+ else
+ /* GD->IE transition.
+ bas %r14,0(%rx,%r13) -> l %r2,0(%r2,%r12) */
+ insn = 0x5822c000;
+ bfd_put_32 (output_bfd, insn, contents + rel->r_offset);
+ }
+ else if (r_type == R_390_TLS_LDCALL)
+ {
+ if (!info->shared)
+ {
+ unsigned int insn;
+
+ insn = bfd_get_32 (input_bfd, contents + rel->r_offset);
+ if ((insn & 0xff000fff) != 0x4d000000)
+ invalid_tls_insn (input_bfd, input_section, rel);
+ /* LD->LE transition.
+ bas %r14,0(%rx,%r13) -> bc 0,0 */
+ insn = 0x47000000;
+ bfd_put_32 (output_bfd, insn, contents + rel->r_offset);
+ }
+ }
+ continue;
+
default:
break;
}
@@ -1986,9 +2999,21 @@ elf_s390_relocate_section (output_bfd, info, input_bfd, input_section,
(long) rel->r_offset,
h->root.root.string);
- r = _bfd_final_link_relocate (howto, input_bfd, input_section,
- contents, rel->r_offset,
- relocation, rel->r_addend);
+ if (r_type == R_390_20
+ || r_type == R_390_GOT20
+ || r_type == R_390_GOTPLT20
+ || r_type == R_390_TLS_GOTIE20)
+ {
+ relocation += rel->r_addend;
+ relocation = (relocation&0xfff) << 8 | (relocation&0xff000) >> 12;
+ r = _bfd_final_link_relocate (howto, input_bfd, input_section,
+ contents, rel->r_offset,
+ relocation, 0);
+ }
+ else
+ r = _bfd_final_link_relocate (howto, input_bfd, input_section,
+ contents, rel->r_offset,
+ relocation, rel->r_addend);
if (r != bfd_reloc_ok)
{
@@ -2002,7 +3027,7 @@ elf_s390_relocate_section (output_bfd, info, input_bfd, input_section,
symtab_hdr->sh_link,
sym->st_name);
if (name == NULL)
- return false;
+ return FALSE;
if (*name == '\0')
name = bfd_section_name (input_bfd, sec);
}
@@ -2013,7 +3038,7 @@ 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)))
- return false;
+ return FALSE;
}
else
{
@@ -2022,18 +3047,18 @@ elf_s390_relocate_section (output_bfd, info, input_bfd, input_section,
bfd_archive_filename (input_bfd),
bfd_get_section_name (input_bfd, input_section),
(long) rel->r_offset, name, (int) r);
- return false;
+ return FALSE;
}
}
}
- return true;
+ return TRUE;
}
/* Finish up dynamic symbol handling. We set the contents of various
dynamic sections here. */
-static boolean
+static bfd_boolean
elf_s390_finish_dynamic_symbol (output_bfd, info, h, sym)
bfd *output_bfd;
struct bfd_link_info *info;
@@ -2049,12 +3074,11 @@ elf_s390_finish_dynamic_symbol (output_bfd, info, h, sym)
bfd_vma plt_index;
bfd_vma got_offset;
Elf_Internal_Rela rela;
- Elf32_External_Rela *loc;
+ bfd_byte *loc;
bfd_vma relative_offset;
/* This symbol has an entry in the procedure linkage table. Set
- it up. */
-
+ it up. */
if (h->dynindx == -1
|| htab->splt == NULL
|| htab->sgotplt == NULL
@@ -2062,26 +3086,26 @@ elf_s390_finish_dynamic_symbol (output_bfd, info, h, sym)
abort ();
/* Calc. index no.
- Current offset - size first entry / entry size. */
+ Current offset - size first entry / entry size. */
plt_index = (h->plt.offset - PLT_FIRST_ENTRY_SIZE) / PLT_ENTRY_SIZE;
/* Offset in GOT is PLT index plus GOT headers(3) times 4,
- addr & GOT addr. */
+ addr & GOT addr. */
got_offset = (plt_index + 3) * GOT_ENTRY_SIZE;
/* S390 uses halfwords for relative branch calc! */
relative_offset = - ((PLT_FIRST_ENTRY_SIZE +
- (PLT_ENTRY_SIZE * plt_index) + 18) / 2);
+ (PLT_ENTRY_SIZE * plt_index) + 18) / 2);
/* If offset is > 32768, branch to a previous branch
- 390 can only handle +-64 K jumps. */
+ 390 can only handle +-64 K jumps. */
if ( -32768 > (int) relative_offset )
- relative_offset =
- -(unsigned) (((65536 / PLT_ENTRY_SIZE - 1) * PLT_ENTRY_SIZE) / 2);
+ relative_offset
+ = -(unsigned) (((65536 / PLT_ENTRY_SIZE - 1) * PLT_ENTRY_SIZE) / 2);
/* Fill in the entry in the procedure linkage table. */
if (!info->shared)
{
- bfd_put_32 (output_bfd, (bfd_vma) PLT_ENTRY_WORD0,
+ bfd_put_32 (output_bfd, (bfd_vma) PLT_ENTRY_WORD0,
htab->splt->contents + h->plt.offset);
bfd_put_32 (output_bfd, (bfd_vma) PLT_ENTRY_WORD1,
htab->splt->contents + h->plt.offset + 4);
@@ -2152,10 +3176,10 @@ elf_s390_finish_dynamic_symbol (output_bfd, info, h, sym)
}
/* Insert offset into reloc. table here. */
bfd_put_32 (output_bfd, plt_index * sizeof (Elf32_External_Rela),
- htab->splt->contents + h->plt.offset + 28);
+ htab->splt->contents + h->plt.offset + 28);
/* Fill in the entry in the global offset table.
- Points to instruction after GOT offset. */
+ Points to instruction after GOT offset. */
bfd_put_32 (output_bfd,
(htab->splt->output_section->vma
+ htab->splt->output_offset
@@ -2169,7 +3193,7 @@ elf_s390_finish_dynamic_symbol (output_bfd, info, h, sym)
+ got_offset);
rela.r_info = ELF32_R_INFO (h->dynindx, R_390_JMP_SLOT);
rela.r_addend = 0;
- loc = (Elf32_External_Rela *) htab->srelplt->contents + plt_index;
+ 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)
@@ -2183,13 +3207,16 @@ elf_s390_finish_dynamic_symbol (output_bfd, info, h, sym)
}
}
- if (h->got.offset != (bfd_vma) -1)
+ if (h->got.offset != (bfd_vma) -1
+ && elf_s390_hash_entry(h)->tls_type != GOT_TLS_GD
+ && elf_s390_hash_entry(h)->tls_type != GOT_TLS_IE
+ && elf_s390_hash_entry(h)->tls_type != GOT_TLS_IE_NLT)
{
Elf_Internal_Rela rela;
- Elf32_External_Rela *loc;
+ bfd_byte *loc;
/* This symbol has an entry in the global offset table. Set it
- up. */
+ up. */
if (htab->sgot == NULL || htab->srelgot == NULL)
abort ();
@@ -2212,26 +3239,26 @@ elf_s390_finish_dynamic_symbol (output_bfd, info, h, sym)
BFD_ASSERT((h->got.offset & 1) != 0);
rela.r_info = ELF32_R_INFO (0, R_390_RELATIVE);
rela.r_addend = (h->root.u.def.value
- + h->root.u.def.section->output_section->vma
- + h->root.u.def.section->output_offset);
- }
+ + h->root.u.def.section->output_section->vma
+ + h->root.u.def.section->output_offset);
+ }
else
{
BFD_ASSERT((h->got.offset & 1) == 0);
bfd_put_32 (output_bfd, (bfd_vma) 0, htab->sgot->contents + h->got.offset);
rela.r_info = ELF32_R_INFO (h->dynindx, R_390_GLOB_DAT);
- rela.r_addend = 0;
- }
+ rela.r_addend = 0;
+ }
- loc = (Elf32_External_Rela *) htab->srelgot->contents;
- loc += htab->srelgot->reloc_count++;
+ loc = htab->srelgot->contents;
+ loc += htab->srelgot->reloc_count++ * sizeof (Elf32_External_Rela);
bfd_elf32_swap_reloca_out (output_bfd, &rela, loc);
}
if ((h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_COPY) != 0)
{
Elf_Internal_Rela rela;
- Elf32_External_Rela *loc;
+ bfd_byte *loc;
/* This symbols needs a copy reloc. Set it up. */
@@ -2246,8 +3273,8 @@ elf_s390_finish_dynamic_symbol (output_bfd, info, h, sym)
+ h->root.u.def.section->output_offset);
rela.r_info = ELF32_R_INFO (h->dynindx, R_390_COPY);
rela.r_addend = 0;
- loc = (Elf32_External_Rela *) htab->srelbss->contents;
- loc += htab->srelbss->reloc_count++;
+ loc = htab->srelbss->contents;
+ loc += htab->srelbss->reloc_count++ * sizeof (Elf32_External_Rela);
bfd_elf32_swap_reloca_out (output_bfd, &rela, loc);
}
@@ -2257,7 +3284,7 @@ elf_s390_finish_dynamic_symbol (output_bfd, info, h, sym)
|| strcmp (h->root.root.string, "_PROCEDURE_LINKAGE_TABLE_") == 0)
sym->st_shndx = SHN_ABS;
- return true;
+ return TRUE;
}
/* Used to decide how to sort relocs in an optimal manner for the
@@ -2282,7 +3309,7 @@ elf_s390_reloc_type_class (rela)
/* Finish up the dynamic sections. */
-static boolean
+static bfd_boolean
elf_s390_finish_dynamic_sections (output_bfd, info)
bfd *output_bfd;
struct bfd_link_info *info;
@@ -2339,39 +3366,39 @@ 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)
{
- memset (htab->splt->contents, 0, PLT_FIRST_ENTRY_SIZE);
- if (info->shared)
+ memset (htab->splt->contents, 0, PLT_FIRST_ENTRY_SIZE);
+ if (info->shared)
{
bfd_put_32 (output_bfd, (bfd_vma) PLT_PIC_FIRST_ENTRY_WORD0,
- htab->splt->contents );
+ htab->splt->contents );
bfd_put_32 (output_bfd, (bfd_vma) PLT_PIC_FIRST_ENTRY_WORD1,
- htab->splt->contents +4 );
+ htab->splt->contents +4 );
bfd_put_32 (output_bfd, (bfd_vma) PLT_PIC_FIRST_ENTRY_WORD2,
- htab->splt->contents +8 );
+ htab->splt->contents +8 );
bfd_put_32 (output_bfd, (bfd_vma) PLT_PIC_FIRST_ENTRY_WORD3,
- htab->splt->contents +12 );
+ htab->splt->contents +12 );
bfd_put_32 (output_bfd, (bfd_vma) PLT_PIC_FIRST_ENTRY_WORD4,
- htab->splt->contents +16 );
- }
- else
- {
- bfd_put_32 (output_bfd, (bfd_vma)PLT_FIRST_ENTRY_WORD0,
- htab->splt->contents );
- bfd_put_32 (output_bfd, (bfd_vma) PLT_FIRST_ENTRY_WORD1,
- htab->splt->contents +4 );
- bfd_put_32 (output_bfd, (bfd_vma) PLT_FIRST_ENTRY_WORD2,
- htab->splt->contents +8 );
- bfd_put_32 (output_bfd, (bfd_vma) PLT_FIRST_ENTRY_WORD3,
- htab->splt->contents +12 );
- bfd_put_32 (output_bfd, (bfd_vma) PLT_FIRST_ENTRY_WORD4,
- htab->splt->contents +16 );
- bfd_put_32 (output_bfd, (bfd_vma) PLT_FIRST_ENTRY_WORD5,
- htab->splt->contents +20 );
- bfd_put_32 (output_bfd,
- htab->sgotplt->output_section->vma
+ htab->splt->contents +16 );
+ }
+ else
+ {
+ bfd_put_32 (output_bfd, (bfd_vma)PLT_FIRST_ENTRY_WORD0,
+ htab->splt->contents );
+ bfd_put_32 (output_bfd, (bfd_vma) PLT_FIRST_ENTRY_WORD1,
+ htab->splt->contents +4 );
+ bfd_put_32 (output_bfd, (bfd_vma) PLT_FIRST_ENTRY_WORD2,
+ htab->splt->contents +8 );
+ bfd_put_32 (output_bfd, (bfd_vma) PLT_FIRST_ENTRY_WORD3,
+ htab->splt->contents +12 );
+ bfd_put_32 (output_bfd, (bfd_vma) PLT_FIRST_ENTRY_WORD4,
+ htab->splt->contents +16 );
+ bfd_put_32 (output_bfd, (bfd_vma) PLT_FIRST_ENTRY_WORD5,
+ htab->splt->contents +20 );
+ bfd_put_32 (output_bfd,
+ htab->sgotplt->output_section->vma
+ htab->sgotplt->output_offset,
- htab->splt->contents + 24);
- }
+ htab->splt->contents + 24);
+ }
elf_section_data (htab->splt->output_section)
->this_hdr.sh_entsize = 4;
}
@@ -2396,17 +3423,10 @@ elf_s390_finish_dynamic_sections (output_bfd, info)
elf_section_data (htab->sgotplt->output_section)
->this_hdr.sh_entsize = 4;
}
- return true;
-}
-
-static boolean
-elf_s390_object_p (abfd)
- bfd *abfd;
-{
- return bfd_default_set_arch_mach (abfd, bfd_arch_s390, bfd_mach_s390_31);
+ return TRUE;
}
-static boolean
+static bfd_boolean
elf_s390_grok_prstatus (abfd, note)
bfd * abfd;
Elf_Internal_Note * note;
@@ -2417,7 +3437,7 @@ elf_s390_grok_prstatus (abfd, note)
switch (note->descsz)
{
default:
- return false;
+ return FALSE;
case 224: /* S/390 Linux. */
/* pr_cursig */
@@ -2450,29 +3470,29 @@ elf_s390_grok_prstatus (abfd, note)
#define elf_backend_plt_readonly 1
#define elf_backend_want_plt_sym 0
#define elf_backend_got_header_size 12
-#define elf_backend_plt_header_size PLT_ENTRY_SIZE
#define elf_backend_rela_normal 1
-#define elf_info_to_howto elf_s390_info_to_howto
+#define elf_info_to_howto elf_s390_info_to_howto
#define bfd_elf32_bfd_is_local_label_name elf_s390_is_local_label_name
#define bfd_elf32_bfd_link_hash_table_create elf_s390_link_hash_table_create
#define bfd_elf32_bfd_reloc_type_lookup elf_s390_reloc_type_lookup
#define elf_backend_adjust_dynamic_symbol elf_s390_adjust_dynamic_symbol
-#define elf_backend_check_relocs elf_s390_check_relocs
+#define elf_backend_check_relocs elf_s390_check_relocs
#define elf_backend_copy_indirect_symbol elf_s390_copy_indirect_symbol
#define elf_backend_create_dynamic_sections elf_s390_create_dynamic_sections
#define elf_backend_finish_dynamic_sections elf_s390_finish_dynamic_sections
#define elf_backend_finish_dynamic_symbol elf_s390_finish_dynamic_symbol
-#define elf_backend_gc_mark_hook elf_s390_gc_mark_hook
-#define elf_backend_gc_sweep_hook elf_s390_gc_sweep_hook
+#define elf_backend_gc_mark_hook elf_s390_gc_mark_hook
+#define elf_backend_gc_sweep_hook elf_s390_gc_sweep_hook
#define elf_backend_reloc_type_class elf_s390_reloc_type_class
-#define elf_backend_relocate_section elf_s390_relocate_section
+#define elf_backend_relocate_section elf_s390_relocate_section
#define elf_backend_size_dynamic_sections elf_s390_size_dynamic_sections
#define elf_backend_reloc_type_class elf_s390_reloc_type_class
#define elf_backend_grok_prstatus elf_s390_grok_prstatus
-#define elf_backend_object_p elf_s390_object_p
+#define bfd_elf32_mkobject elf_s390_mkobject
+#define elf_backend_object_p elf_s390_object_p
#include "elf32-target.h"
diff --git a/contrib/binutils/bfd/elf32-sparc.c b/contrib/binutils/bfd/elf32-sparc.c
index b6cf7eb..0f94f5f 100644
--- a/contrib/binutils/bfd/elf32-sparc.c
+++ b/contrib/binutils/bfd/elf32-sparc.c
@@ -1,22 +1,22 @@
/* SPARC-specific support for 32-bit ELF
- Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
- Free Software Foundation, Inc.
+ Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+ 2003, 2004 Free Software Foundation, Inc.
-This file is part of BFD, the Binary File Descriptor library.
+ This 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "bfd.h"
#include "sysdep.h"
@@ -30,34 +30,61 @@ 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 boolean elf32_sparc_check_relocs
+static bfd_boolean elf32_sparc_check_relocs
PARAMS ((bfd *, struct bfd_link_info *, asection *,
const Elf_Internal_Rela *));
-static boolean elf32_sparc_adjust_dynamic_symbol
+static bfd_boolean elf32_sparc_adjust_dynamic_symbol
PARAMS ((struct bfd_link_info *, struct elf_link_hash_entry *));
-static boolean elf32_sparc_size_dynamic_sections
+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 boolean elf32_sparc_relax_section
- PARAMS ((bfd *, asection *, struct bfd_link_info *, boolean *));
-static boolean elf32_sparc_relocate_section
+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 boolean elf32_sparc_finish_dynamic_symbol
+static bfd_boolean elf32_sparc_finish_dynamic_symbol
PARAMS ((bfd *, struct bfd_link_info *, struct elf_link_hash_entry *,
Elf_Internal_Sym *));
-static boolean elf32_sparc_finish_dynamic_sections
+static bfd_boolean elf32_sparc_finish_dynamic_sections
PARAMS ((bfd *, struct bfd_link_info *));
-static boolean elf32_sparc_merge_private_bfd_data PARAMS ((bfd *, bfd *));
-static boolean elf32_sparc_object_p
+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 *, boolean));
+ 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 boolean elf32_sparc_gc_sweep_hook
+static bfd_boolean elf32_sparc_gc_sweep_hook
PARAMS ((bfd *, struct bfd_link_info *, asection *,
const Elf_Internal_Rela *));
@@ -67,75 +94,104 @@ 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),
+ 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),
+ 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_REV32, 0,2,32,false,0,complain_overflow_bitfield,bfd_elf_generic_reloc, "R_SPARC_REV32", false,0,0xffffffff,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_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);
+ 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);
+ 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;
@@ -187,9 +243,33 @@ static const struct elf_reloc_map sparc_reloc_map[] =
{ BFD_RELOC_SPARC_7, R_SPARC_7 },
{ BFD_RELOC_SPARC_5, R_SPARC_5 },
{ BFD_RELOC_SPARC_6, R_SPARC_6 },
- { BFD_RELOC_SPARC_REV32, R_SPARC_REV32 },
+ { 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 *
@@ -207,12 +287,18 @@ elf32_sparc_reloc_type_lookup (abfd, code)
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];
- }
+ 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;
@@ -237,6 +323,10 @@ elf32_sparc_info_to_howto (abfd, cache_ptr, dst)
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)];
@@ -319,6 +409,127 @@ sparc_elf_wdisp16_reloc (abfd,
else
return bfd_reloc_ok;
}
+
+/* Handle the HIX22 reloc. */
+
+static bfd_reloc_status_type
+sparc_elf_hix22_reloc (abfd,
+ reloc_entry,
+ symbol,
+ data,
+ input_section,
+ output_bfd,
+ error_message)
+ bfd *abfd;
+ arelent *reloc_entry;
+ asymbol *symbol;
+ PTR data;
+ asection *input_section;
+ bfd *output_bfd;
+ char **error_message ATTRIBUTE_UNUSED;
+{
+ bfd_vma relocation;
+ bfd_vma insn;
+
+ if (output_bfd != (bfd *) NULL
+ && (symbol->flags & BSF_SECTION_SYM) == 0)
+ {
+ reloc_entry->address += input_section->output_offset;
+ return bfd_reloc_ok;
+ }
+
+ if (output_bfd != NULL)
+ return bfd_reloc_continue;
+
+ if (reloc_entry->address > input_section->_cooked_size)
+ return bfd_reloc_outofrange;
+
+ relocation = (symbol->value
+ + symbol->section->output_section->vma
+ + symbol->section->output_offset);
+ relocation += reloc_entry->addend;
+ insn = bfd_get_32 (abfd, (bfd_byte *) data + reloc_entry->address);
+
+ insn = (insn &~ (bfd_vma) 0x3fffff) | (((~relocation) >> 10) & 0x3fffff);
+ bfd_put_32 (abfd, insn, (bfd_byte *) data + reloc_entry->address);
+
+ return bfd_reloc_ok;
+}
+
+/* Handle the LOX10 reloc. */
+
+static bfd_reloc_status_type
+sparc_elf_lox10_reloc (abfd,
+ reloc_entry,
+ symbol,
+ data,
+ input_section,
+ output_bfd,
+ error_message)
+ bfd *abfd;
+ arelent *reloc_entry;
+ asymbol *symbol;
+ PTR data;
+ asection *input_section;
+ bfd *output_bfd;
+ char **error_message ATTRIBUTE_UNUSED;
+{
+ bfd_vma relocation;
+ bfd_vma insn;
+
+ if (output_bfd != (bfd *) NULL
+ && (symbol->flags & BSF_SECTION_SYM) == 0)
+ {
+ reloc_entry->address += input_section->output_offset;
+ return bfd_reloc_ok;
+ }
+
+ if (output_bfd != NULL)
+ return bfd_reloc_continue;
+
+ if (reloc_entry->address > input_section->_cooked_size)
+ return bfd_reloc_outofrange;
+
+ relocation = (symbol->value
+ + symbol->section->output_section->vma
+ + symbol->section->output_offset);
+ relocation += reloc_entry->addend;
+ insn = bfd_get_32 (abfd, (bfd_byte *) data + reloc_entry->address);
+
+ insn = (insn &~ (bfd_vma) 0x1fff) | 0x1c00 | (relocation & 0x3ff);
+ bfd_put_32 (abfd, insn, (bfd_byte *) data + reloc_entry->address);
+
+ return bfd_reloc_ok;
+}
+
+/* Support for core dump NOTE sections. */
+
+static bfd_boolean
+elf32_sparc_grok_psinfo (bfd *abfd, Elf_Internal_Note *note)
+{
+ switch (note->descsz)
+ {
+ default:
+ return FALSE;
+
+ case 260: /* Solaris prpsinfo_t. */
+ elf_tdata (abfd)->core_program
+ = _bfd_elfcore_strndup (abfd, note->descdata + 84, 16);
+ elf_tdata (abfd)->core_command
+ = _bfd_elfcore_strndup (abfd, note->descdata + 100, 80);
+ break;
+
+ case 336: /* Solaris psinfo_t. */
+ elf_tdata (abfd)->core_program
+ = _bfd_elfcore_strndup (abfd, note->descdata + 88, 16);
+ elf_tdata (abfd)->core_command
+ = _bfd_elfcore_strndup (abfd, note->descdata + 104, 80);
+ break;
+ }
+
+ return TRUE;
+}
+
/* Functions for the SPARC ELF linker. */
@@ -347,185 +558,553 @@ sparc_elf_wdisp16_reloc (abfd,
/* 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 boolean
+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;
{
- bfd *dynobj;
+ 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 *sgot;
- asection *srelgot;
asection *sreloc;
+ bfd_boolean checked_tlsgd = FALSE;
- if (info->relocateable)
- return true;
+ if (info->relocatable)
+ return TRUE;
- dynobj = elf_hash_table (info)->dynobj;
+ 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);
- sgot = NULL;
- srelgot = NULL;
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];
- switch (ELF32_R_TYPE (rel->r_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;
- if (dynobj == NULL)
- {
- /* Create the .got section. */
- elf_hash_table (info)->dynobj = dynobj = abfd;
- if (! _bfd_elf_create_got_section (dynobj, info))
- return false;
- }
+ 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 (sgot == NULL)
- {
- sgot = bfd_get_section_by_name (dynobj, ".got");
- BFD_ASSERT (sgot != NULL);
- }
+ if (h != NULL)
+ {
+ h->got.refcount += 1;
+ old_tls_type = elf32_sparc_hash_entry(h)->tls_type;
+ }
+ else
+ {
+ bfd_signed_vma *local_got_refcounts;
- if (srelgot == NULL
- && (h != NULL || info->shared))
- {
- srelgot = bfd_get_section_by_name (dynobj, ".rela.got");
- if (srelgot == NULL)
- {
- srelgot = bfd_make_section (dynobj, ".rela.got");
- if (srelgot == NULL
- || ! bfd_set_section_flags (dynobj, srelgot,
- (SEC_ALLOC
- | SEC_LOAD
- | SEC_HAS_CONTENTS
- | SEC_IN_MEMORY
- | SEC_LINKER_CREATED
- | SEC_READONLY))
- || ! bfd_set_section_alignment (dynobj, srelgot, 2))
- return false;
- }
- }
+ /* 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 (h != NULL)
- {
- if (h->got.offset != (bfd_vma) -1)
- {
- /* We have already allocated space in the .got. */
- break;
- }
- h->got.offset = sgot->_raw_size;
+ /* 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;
+ }
+ }
- /* Make sure this symbol is output as a dynamic symbol. */
- if (h->dynindx == -1)
- {
- if (! bfd_elf32_link_record_dynamic_symbol (info, h))
- 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;
+ }
+ }
- srelgot->_raw_size += sizeof (Elf32_External_Rela);
- }
- else
+ if (htab->sgot == NULL)
{
- /* 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 (Elf32_External_Rela);
- }
+ if (htab->elf.dynobj == NULL)
+ htab->elf.dynobj = abfd;
+ if (!create_got_section (htab->elf.dynobj, info))
+ return FALSE;
}
-
- sgot->_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 (sgot->_raw_size >= 0x1000
- && elf_hash_table (info)->hgot->root.u.def.value == 0)
- elf_hash_table (info)->hgot->root.u.def.value = 0x1000;
-
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. */
+ 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_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;
}
- /* Make sure this symbol is output as a dynamic symbol. */
- if (h->dynindx == -1)
- {
- if (! bfd_elf32_link_record_dynamic_symbol (info, h))
- return false;
- }
-
h->elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_PLT;
- if (ELF32_R_TYPE (rel->r_info) != R_SPARC_WPLT30)
+ if (ELF32_R_TYPE (rel->r_info) == R_SPARC_PLT32)
goto r_sparc_plt32;
+ h->plt.refcount += 1;
break;
case R_SPARC_PC10:
@@ -537,6 +1116,7 @@ elf32_sparc_check_relocs (abfd, info, sec, relocs)
&& strcmp (h->root.root.string, "_GLOBAL_OFFSET_TABLE_") == 0)
break;
/* Fall through. */
+
case R_SPARC_DISP8:
case R_SPARC_DISP16:
case R_SPARC_DISP32:
@@ -544,23 +1124,6 @@ elf32_sparc_check_relocs (abfd, info, sec, relocs)
case R_SPARC_WDISP22:
case R_SPARC_WDISP19:
case R_SPARC_WDISP16:
- if (h != NULL)
- h->elf_link_hash_flags |= ELF_LINK_NON_GOT_REF;
-
- /* If we are linking with -Bsymbolic, we do not need to copy
- a PC relative reloc against a global symbol which is
- defined in an object we are including in the link (i.e.,
- DEF_REGULAR is set). FIXME: 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). This needs to be handled as in
- elf32-i386.c. */
- if (h == NULL
- || (info->symbolic
- && (h->elf_link_hash_flags
- & ELF_LINK_HASH_DEF_REGULAR) != 0))
- break;
- /* Fall through. */
case R_SPARC_8:
case R_SPARC_16:
case R_SPARC_32:
@@ -574,26 +1137,75 @@ elf32_sparc_check_relocs (abfd, info, sec, relocs)
h->elf_link_hash_flags |= ELF_LINK_NON_GOT_REF;
r_sparc_plt32:
- if (info->shared && (sec->flags & SEC_ALLOC))
+ 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. */
+ 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;
+ 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)
{
@@ -607,33 +1219,69 @@ elf32_sparc_check_relocs (abfd, info, sec, relocs)
if (sreloc == NULL
|| ! bfd_set_section_flags (dynobj, sreloc, flags)
|| ! bfd_set_section_alignment (dynobj, sreloc, 2))
- return false;
+ return FALSE;
}
- if (sec->flags & SEC_READONLY)
- info->flags |= DF_TEXTREL;
+ 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;
}
- sreloc->_raw_size += sizeof (Elf32_External_Rela);
+ 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_elf32_gc_record_vtinherit (abfd, sec, h, rel->r_offset))
- return false;
- 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_elf32_gc_record_vtentry (abfd, sec, h, rel->r_addend))
- 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;
+ return TRUE;
}
static asection *
@@ -650,21 +1298,21 @@ elf32_sparc_gc_mark_hook (sec, info, rel, h, sym)
{
case R_SPARC_GNU_VTINHERIT:
case R_SPARC_GNU_VTENTRY:
- break;
+ break;
default:
- switch (h->root.type)
- {
- case bfd_link_hash_defined:
- case bfd_link_hash_defweak:
- return h->root.u.def.section;
+ 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;
+ case bfd_link_hash_common:
+ return h->root.u.c.p->section;
default:
break;
- }
+ }
}
}
else
@@ -674,20 +1322,19 @@ elf32_sparc_gc_mark_hook (sec, info, rel, h, sym)
}
/* Update the got entry reference counts for the section being removed. */
-static boolean
+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;
- 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);
@@ -695,44 +1342,100 @@ elf32_sparc_gc_sweep_hook (abfd, info, sec, relocs)
relend = relocs + sec->reloc_count;
for (rel = relocs; rel < relend; rel++)
- switch (ELF32_R_TYPE (rel->r_info))
- {
- case R_SPARC_GOT10:
- case R_SPARC_GOT13:
- case R_SPARC_GOT22:
- 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--;
- }
- else
- {
- if (local_got_refcounts[r_symndx] > 0)
- local_got_refcounts[r_symndx]--;
- }
- break;
-
- case R_SPARC_PLT32:
- case R_SPARC_HIPLT22:
- case R_SPARC_LOPLT10:
- case R_SPARC_PCPLT32:
- case R_SPARC_PCPLT10:
- 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->plt.refcount > 0)
- h->plt.refcount--;
- }
- break;
+ {
+ unsigned long r_symndx;
+ unsigned int r_type;
+ struct elf_link_hash_entry *h = NULL;
- default:
- break;
- }
+ 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;
+ return TRUE;
}
/* Adjust a symbol defined by a dynamic object and referenced by a
@@ -741,19 +1444,21 @@ elf32_sparc_gc_sweep_hook (abfd, info, sec, relocs)
change the definition to something the rest of the link can
understand. */
-static boolean
+static bfd_boolean
elf32_sparc_adjust_dynamic_symbol (info, h)
struct bfd_link_info *info;
struct elf_link_hash_entry *h;
{
- bfd *dynobj;
+ 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;
- dynobj = elf_hash_table (info)->dynobj;
+ htab = elf32_sparc_hash_table (info);
/* Make sure we know what is going on here. */
- BFD_ASSERT (dynobj != NULL
+ BFD_ASSERT (htab->elf.dynobj != NULL
&& ((h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT)
|| h->weakdef != NULL
|| ((h->elf_link_hash_flags
@@ -777,64 +1482,26 @@ elf32_sparc_adjust_dynamic_symbol (info, h)
|| h->root.type == bfd_link_hash_defweak)
&& (h->root.u.def.section->flags & SEC_CODE) != 0))
{
- if (! elf_hash_table (info)->dynamic_sections_created
- || ((!info->shared || info->symbolic || h->dynindx == -1)
- && (h->elf_link_hash_flags
- & ELF_LINK_HASH_DEF_REGULAR) != 0))
+ 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 none of the input files were dynamic objects.
- Or, when linking the main application or a -Bsymbolic
- shared library against PIC code. Or when a global symbol
- has been made private, e.g. via versioning.
-
- In these cases we know what value the symbol will resolve
- to, so we don't actually need to build a procedure linkage
- table, and we can just do a WDISP30 reloc instead. */
-
+ 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;
}
- s = bfd_get_section_by_name (dynobj, ".plt");
- BFD_ASSERT (s != NULL);
-
- /* 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;
- }
-
- /* 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 = s->_raw_size;
- }
-
- h->plt.offset = s->_raw_size;
-
- /* 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 (Elf32_External_Rela);
-
- return true;
+ 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
@@ -845,7 +1512,7 @@ elf32_sparc_adjust_dynamic_symbol (info, h)
|| 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;
+ return TRUE;
}
/* This is a reference to a symbol defined by a dynamic object which
@@ -856,12 +1523,28 @@ elf32_sparc_adjust_dynamic_symbol (info, h)
For such cases we need not do anything here; the relocations will
be handled correctly by relocate_section. */
if (info->shared)
- return true;
+ 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;
+ 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
@@ -873,20 +1556,13 @@ elf32_sparc_adjust_dynamic_symbol (info, h)
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 (Elf32_External_Rela);
+ htab->srelbss->_raw_size += sizeof (Elf32_External_Rela);
h->elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_COPY;
}
@@ -897,12 +1573,13 @@ elf32_sparc_adjust_dynamic_symbol (info, h)
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;
+ return FALSE;
}
/* Define the symbol as being at this point in the section. */
@@ -912,60 +1589,372 @@ elf32_sparc_adjust_dynamic_symbol (info, h)
/* Increment the section size to make room for the symbol. */
s->_raw_size += h->size;
- return true;
+ 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 boolean
+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;
- boolean relplt;
+ bfd *ibfd;
- dynobj = elf_hash_table (info)->dynobj;
+ 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->shared)
+ 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;
}
+ }
- /* Make space for the trailing nop in .plt. */
- s = bfd_get_section_by_name (dynobj, ".plt");
- BFD_ASSERT (s != NULL);
- if (s->_raw_size > 0)
- s->_raw_size += 4;
+ /* 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)
{
- /* 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;
+ /* 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. */
- relplt = false;
for (s = dynobj->sections; s != NULL; s = s->next)
{
const char *name;
- boolean strip;
+ bfd_boolean strip = FALSE;
if ((s->flags & SEC_LINKER_CREATED) == 0)
continue;
@@ -974,8 +1963,6 @@ elf32_sparc_size_dynamic_sections (output_bfd, info)
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)
@@ -989,20 +1976,16 @@ elf32_sparc_size_dynamic_sections (output_bfd, info)
adjust_dynamic_symbol is called, and it is that
function which decides whether anything needs to go
into these sections. */
- strip = true;
+ 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
- && strcmp (name, ".got") != 0)
+ else if (s != htab->splt && s != htab->sgot)
{
/* It's not one of our sections, so don't allocate space. */
continue;
@@ -1022,7 +2005,7 @@ elf32_sparc_size_dynamic_sections (output_bfd, info)
contents to zero. */
s->contents = (bfd_byte *) bfd_zalloc (dynobj, s->_raw_size);
if (s->contents == NULL && s->_raw_size != 0)
- return false;
+ return FALSE;
}
if (elf_hash_table (info)->dynamic_sections_created)
@@ -1033,68 +2016,115 @@ elf32_sparc_size_dynamic_sections (output_bfd, info)
the .dynamic section. The DT_DEBUG entry is filled in by the
dynamic linker and used by the debugger. */
#define add_dynamic_entry(TAG, VAL) \
- bfd_elf32_add_dynamic_entry (info, (bfd_vma) (TAG), (bfd_vma) (VAL))
+ _bfd_elf_add_dynamic_entry (info, TAG, VAL)
- if (!info->shared)
+ if (info->executable)
{
if (!add_dynamic_entry (DT_DEBUG, 0))
- return false;
+ return FALSE;
}
- if (relplt)
+ 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;
+ 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;
+ 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;
+ return FALSE;
}
}
#undef add_dynamic_entry
- return true;
+ return TRUE;
}
-#define SET_SEC_DO_RELAX(section) do { elf_section_data(section)->tdata = (void *)1; } while (0)
-#define SEC_DO_RELAX(section) (elf_section_data(section)->tdata == (void *)1)
+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 boolean
+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;
- boolean *again;
+ 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;
{
- *again = false;
- SET_SEC_DO_RELAX (section);
- return true;
+ /* 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;
}
-/* This is the condition under which finish_dynamic_symbol will be called
- from elflink.h. If elflink.h doesn't call our finish_dynamic_symbol
- routine, we'll need to do something about initializing any .plt and .got
- entries in relocate_section. */
-#define WILL_CALL_FINISH_DYNAMIC_SYMBOL(DYN, INFO, H) \
- ((DYN) \
- && ((INFO)->shared \
- || ((H)->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0) \
- && ((H)->dynindx != -1 \
- || ((H)->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) != 0))
+/* 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 boolean
+static bfd_boolean
elf32_sparc_relocate_section (output_bfd, info, input_bfd, input_section,
contents, relocs, local_syms, local_sections)
bfd *output_bfd;
@@ -1106,18 +2136,19 @@ elf32_sparc_relocate_section (output_bfd, info, input_bfd, input_section,
Elf_Internal_Sym *local_syms;
asection **local_sections;
{
- bfd *dynobj;
+ 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 *sgot;
- asection *splt;
asection *sreloc;
Elf_Internal_Rela *rel;
Elf_Internal_Rela *relend;
- dynobj = elf_hash_table (info)->dynobj;
+ 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);
@@ -1127,15 +2158,13 @@ elf32_sparc_relocate_section (output_bfd, info, input_bfd, input_section,
else
got_base = elf_hash_table (info)->hgot->root.u.def.value;
- sgot = NULL;
- splt = NULL;
- sreloc = NULL;
+ sreloc = elf_section_data (input_section)->sreloc;
rel = relocs;
relend = relocs + input_section->reloc_count;
for (; rel < relend; rel++)
{
- int r_type;
+ int r_type, tls_type;
reloc_howto_type *howto;
unsigned long r_symndx;
struct elf_link_hash_entry *h;
@@ -1143,93 +2172,42 @@ elf32_sparc_relocate_section (output_bfd, info, input_bfd, input_section,
asection *sec;
bfd_vma relocation, off;
bfd_reloc_status_type r;
- boolean is_plt = false;
- boolean unresolved_reloc;
+ 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;
+ || 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;
+ return FALSE;
}
howto = _bfd_sparc_elf_howto_table + r_type;
- r_symndx = ELF32_R_SYM (rel->r_info);
-
- if (info->relocateable)
- {
- /* This is a relocateable 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];
- rel->r_addend += sec->output_offset + sym->st_value;
- }
- }
-
- continue;
- }
-
/* This is a final link. */
+ r_symndx = ELF32_R_SYM (rel->r_info);
h = NULL;
sym = NULL;
sec = NULL;
- unresolved_reloc = false;
+ 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);
+ relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel);
}
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;
+ bfd_boolean warned ATTRIBUTE_UNUSED;
- relocation = 0;
- if (h->root.type == bfd_link_hash_defined
- || h->root.type == bfd_link_hash_defweak)
- {
- sec = h->root.u.def.section;
- if (sec->output_section == NULL)
- /* Set a flag that will be cleared later if we find a
- relocation value for this symbol. output_section
- is typically NULL for symbols satisfied by a shared
- library. */
- unresolved_reloc = true;
- else
- relocation = (h->root.u.def.value
- + sec->output_section->vma
- + sec->output_offset);
- }
- else if (h->root.type == bfd_link_hash_undefweak)
- ;
- else if (info->shared
- && (!info->symbolic || info->allow_shlib_undefined)
- && !info->no_undefined
- && ELF_ST_VISIBILITY (h->other) == STV_DEFAULT)
- ;
- else
- {
- if (! ((*info->callbacks->undefined_symbol)
- (info, h->root.root.string, input_bfd,
- input_section, rel->r_offset,
- (!info->shared || info->no_undefined
- || ELF_ST_VISIBILITY (h->other)))))
- return false;
- }
+ 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)
@@ -1238,22 +2216,19 @@ elf32_sparc_relocate_section (output_bfd, info, input_bfd, input_section,
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);
- }
+ offset table. */
+ if (htab->sgot == NULL)
+ abort ();
if (h != NULL)
{
- boolean dyn;
+ 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, h)
+ if (! WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, info->shared, h)
|| (info->shared
&& (info->symbolic
|| h->dynindx == -1
@@ -1261,13 +2236,13 @@ elf32_sparc_relocate_section (output_bfd, info, input_bfd, input_section,
&& (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.
+ -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
@@ -1277,12 +2252,12 @@ elf32_sparc_relocate_section (output_bfd, info, input_bfd, input_section,
else
{
bfd_put_32 (output_bfd, relocation,
- sgot->contents + off);
+ htab->sgot->contents + off);
h->got.offset |= 1;
}
}
else
- unresolved_reloc = false;
+ unresolved_reloc = FALSE;
}
else
{
@@ -1301,32 +2276,32 @@ elf32_sparc_relocate_section (output_bfd, info, input_bfd, input_section,
if (info->shared)
{
- asection *srelgot;
+ asection *s;
Elf_Internal_Rela outrel;
+ bfd_byte *loc;
/* We need to generate a R_SPARC_RELATIVE reloc
for the dynamic linker. */
- srelgot = bfd_get_section_by_name (dynobj, ".rela.got");
- BFD_ASSERT (srelgot != NULL);
+ s = htab->srelgot;
+ BFD_ASSERT (s != NULL);
- outrel.r_offset = (sgot->output_section->vma
- + sgot->output_offset
+ outrel.r_offset = (htab->sgot->output_section->vma
+ + htab->sgot->output_offset
+ off);
outrel.r_info = ELF32_R_INFO (0, R_SPARC_RELATIVE);
outrel.r_addend = relocation;
relocation = 0;
- bfd_elf32_swap_reloca_out (output_bfd, &outrel,
- (((Elf32_External_Rela *)
- srelgot->contents)
- + srelgot->reloc_count));
- ++srelgot->reloc_count;
+ 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, sgot->contents + off);
+ bfd_put_32 (output_bfd, relocation,
+ htab->sgot->contents + off);
local_got_offsets[r_symndx] |= 1;
}
}
- relocation = sgot->output_offset + off - got_base;
+ relocation = htab->sgot->output_offset + off - got_base;
break;
case R_SPARC_PLT32:
@@ -1337,8 +2312,9 @@ elf32_sparc_relocate_section (output_bfd, info, input_bfd, input_section,
}
/* Fall through. */
case R_SPARC_WPLT30:
+ r_sparc_wplt30:
/* Relocation is to the entry for this symbol in the
- procedure linkage table. */
+ procedure linkage table. */
/* The Solaris native assembler will generate a WPLT30 reloc
for a local symbol if you assemble a call from one
@@ -1347,28 +2323,22 @@ elf32_sparc_relocate_section (output_bfd, info, input_bfd, input_section,
if (h == NULL)
break;
- if (h->plt.offset == (bfd_vma) -1)
+ 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. */
+ happens when statically linking PIC code, or when
+ using -Bsymbolic. */
break;
}
- if (splt == NULL)
- {
- splt = bfd_get_section_by_name (dynobj, ".plt");
- BFD_ASSERT (splt != NULL);
- }
-
- relocation = (splt->output_section->vma
- + splt->output_offset
+ relocation = (htab->splt->output_section->vma
+ + htab->splt->output_offset
+ h->plt.offset);
- unresolved_reloc = false;
+ unresolved_reloc = FALSE;
if (r_type == R_SPARC_PLT32)
{
r_type = R_SPARC_32;
- is_plt = true;
+ is_plt = TRUE;
goto r_sparc_plt32;
}
break;
@@ -1386,12 +2356,6 @@ elf32_sparc_relocate_section (output_bfd, info, input_bfd, input_section,
case R_SPARC_WDISP22:
case R_SPARC_WDISP19:
case R_SPARC_WDISP16:
- if (h == NULL
- || (info->symbolic
- && (h->elf_link_hash_flags
- & ELF_LINK_HASH_DEF_REGULAR) != 0))
- break;
- /* Fall through. */
case R_SPARC_8:
case R_SPARC_16:
case R_SPARC_32:
@@ -1402,46 +2366,50 @@ elf32_sparc_relocate_section (output_bfd, info, input_bfd, input_section,
case R_SPARC_UA16:
case R_SPARC_UA32:
r_sparc_plt32:
- if (info->shared
- && r_symndx != 0
- && (input_section->flags & SEC_ALLOC))
+ /* 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;
- boolean skip, relocate = false;
+ 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. */
+ are copied into the output file to be resolved at run
+ time. */
- if (sreloc == NULL)
- {
- const char *name;
-
- name = (bfd_elf_string_from_elf_section
- (input_bfd,
- elf_elfheader (input_bfd)->e_shstrndx,
- elf_section_data (input_section)->rel_hdr.sh_name));
- if (name == NULL)
- return false;
+ BFD_ASSERT (sreloc != NULL);
- 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;
+ 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;
+ skip = TRUE;
else if (outrel.r_offset == (bfd_vma) -2)
- skip = true, relocate = true;
+ skip = TRUE, relocate = TRUE;
outrel.r_offset += (input_section->output_section->vma
+ input_section->output_offset);
@@ -1474,14 +2442,14 @@ elf32_sparc_relocate_section (output_bfd, info, input_bfd, input_section,
FIXME: Add code tracking needed dynamic relocs as
e.g. i386 has. */
if (h->dynindx == -1)
- skip = true, relocate = true;
+ 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. */
+ become local. */
else if (h != NULL && ! is_plt
&& ((! info->symbolic && h->dynindx != -1)
|| (h->elf_link_hash_flags
@@ -1503,22 +2471,14 @@ elf32_sparc_relocate_section (output_bfd, info, input_bfd, input_section,
long indx;
if (is_plt)
- sec = splt;
- else if (h == NULL)
- sec = local_sections[r_symndx];
- else
- {
- BFD_ASSERT (h->root.type == bfd_link_hash_defined
- || (h->root.type
- == bfd_link_hash_defweak));
- sec = h->root.u.def.section;
- }
- if (sec != NULL && bfd_is_abs_section (sec))
+ 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;
+ return FALSE;
}
else
{
@@ -1536,7 +2496,7 @@ elf32_sparc_relocate_section (output_bfd, info, input_bfd, input_section,
(_("%s: probably compiled without -fPIC?"),
bfd_archive_filename (input_bfd));
bfd_set_error (bfd_error_bad_value);
- return false;
+ return FALSE;
}
}
@@ -1545,19 +2505,341 @@ elf32_sparc_relocate_section (output_bfd, info, input_bfd, input_section,
}
}
- bfd_elf32_swap_reloca_out (output_bfd, &outrel,
- (((Elf32_External_Rela *)
- sreloc->contents)
- + sreloc->reloc_count));
- ++sreloc->reloc_count;
+ 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. */
+ 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;
}
@@ -1607,8 +2889,35 @@ elf32_sparc_relocate_section (output_bfd, info, input_bfd, input_section,
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)
+ && sec_do_relax (input_section)
&& rel->r_offset + 4 < input_section->_raw_size)
{
#define G0 0
@@ -1721,27 +3030,27 @@ elf32_sparc_relocate_section (output_bfd, info, input_bfd, input_section,
symtab_hdr->sh_link,
sym->st_name);
if (name == NULL)
- return false;
+ 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;
+ return FALSE;
}
break;
}
}
}
- return true;
+ return TRUE;
}
/* Finish up dynamic symbol handling. We set the contents of various
dynamic sections here. */
-static boolean
+static bfd_boolean
elf32_sparc_finish_dynamic_symbol (output_bfd, info, h, sym)
bfd *output_bfd;
struct bfd_link_info *info;
@@ -1749,22 +3058,25 @@ elf32_sparc_finish_dynamic_symbol (output_bfd, info, h, sym)
Elf_Internal_Sym *sym;
{
bfd *dynobj;
+ struct elf32_sparc_link_hash_table *htab;
- dynobj = elf_hash_table (info)->dynobj;
+ 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. */
+ it up. */
BFD_ASSERT (h->dynindx != -1);
- splt = bfd_get_section_by_name (dynobj, ".plt");
- srela = bfd_get_section_by_name (dynobj, ".rela.plt");
+ splt = htab->splt;
+ srela = htab->srelplt;
BFD_ASSERT (splt != NULL && srela != NULL);
/* Fill in the entry in the procedure linkage table. */
@@ -1784,9 +3096,9 @@ elf32_sparc_finish_dynamic_symbol (output_bfd, info, h, sym)
+ h->plt.offset);
rela.r_info = ELF32_R_INFO (h->dynindx, R_SPARC_JMP_SLOT);
rela.r_addend = 0;
- bfd_elf32_swap_reloca_out (output_bfd, &rela,
- ((Elf32_External_Rela *) srela->contents
- + h->plt.offset / PLT_ENTRY_SIZE - 4));
+ 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)
{
@@ -1803,17 +3115,20 @@ elf32_sparc_finish_dynamic_symbol (output_bfd, info, h, sym)
}
}
- if (h->got.offset != (bfd_vma) -1)
+ 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. */
+ up. */
- sgot = bfd_get_section_by_name (dynobj, ".got");
- srela = bfd_get_section_by_name (dynobj, ".rela.got");
+ sgot = htab->sgot;
+ srela = htab->srelgot;
BFD_ASSERT (sgot != NULL && srela != NULL);
rela.r_offset = (sgot->output_section->vma
@@ -1843,16 +3158,16 @@ elf32_sparc_finish_dynamic_symbol (output_bfd, info, h, sym)
bfd_put_32 (output_bfd, (bfd_vma) 0,
sgot->contents + (h->got.offset &~ (bfd_vma) 1));
- bfd_elf32_swap_reloca_out (output_bfd, &rela,
- ((Elf32_External_Rela *) srela->contents
- + srela->reloc_count));
- ++srela->reloc_count;
+ 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. */
@@ -1867,10 +3182,8 @@ elf32_sparc_finish_dynamic_symbol (output_bfd, info, h, sym)
+ h->root.u.def.section->output_offset);
rela.r_info = ELF32_R_INFO (h->dynindx, R_SPARC_COPY);
rela.r_addend = 0;
- bfd_elf32_swap_reloca_out (output_bfd, &rela,
- ((Elf32_External_Rela *) s->contents
- + s->reloc_count));
- ++s->reloc_count;
+ 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. */
@@ -1879,21 +3192,22 @@ elf32_sparc_finish_dynamic_symbol (output_bfd, info, h, sym)
|| strcmp (h->root.root.string, "_PROCEDURE_LINKAGE_TABLE_") == 0)
sym->st_shndx = SHN_ABS;
- return true;
+ return TRUE;
}
/* Finish up the dynamic sections. */
-static boolean
+static bfd_boolean
elf32_sparc_finish_dynamic_sections (output_bfd, info)
bfd *output_bfd;
struct bfd_link_info *info;
{
bfd *dynobj;
asection *sdyn;
- asection *sgot;
+ struct elf32_sparc_link_hash_table *htab;
- dynobj = elf_hash_table (info)->dynobj;
+ htab = elf32_sparc_hash_table (info);
+ dynobj = htab->elf.dynobj;
sdyn = bfd_get_section_by_name (dynobj, ".dynamic");
@@ -1911,16 +3225,16 @@ elf32_sparc_finish_dynamic_sections (output_bfd, info)
{
Elf_Internal_Dyn dyn;
const char *name;
- boolean size;
+ 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;
+ 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)
@@ -1955,27 +3269,25 @@ elf32_sparc_finish_dynamic_sections (output_bfd, info)
splt->contents + splt->_raw_size - 4);
}
- elf_section_data (splt->output_section)->this_hdr.sh_entsize =
- PLT_ENTRY_SIZE;
+ 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. */
- sgot = bfd_get_section_by_name (dynobj, ".got");
- BFD_ASSERT (sgot != NULL);
- if (sgot->_raw_size > 0)
+ if (htab->sgot && htab->sgot->_raw_size > 0)
{
if (sdyn == NULL)
- bfd_put_32 (output_bfd, (bfd_vma) 0, sgot->contents);
+ bfd_put_32 (output_bfd, (bfd_vma) 0, htab->sgot->contents);
else
bfd_put_32 (output_bfd,
sdyn->output_section->vma + sdyn->output_offset,
- sgot->contents);
+ htab->sgot->contents);
}
- elf_section_data (sgot->output_section)->this_hdr.sh_entsize = 4;
+ if (htab->sgot)
+ elf_section_data (htab->sgot->output_section)->this_hdr.sh_entsize = 4;
- return true;
+ return TRUE;
}
/* Functions for dealing with the e_flags field.
@@ -1988,24 +3300,24 @@ elf32_sparc_finish_dynamic_sections (output_bfd, info)
/* Merge backend specific data from an object file to the output
object file when linking. */
-static boolean
+static bfd_boolean
elf32_sparc_merge_private_bfd_data (ibfd, obfd)
bfd *ibfd;
bfd *obfd;
{
- boolean error;
+ bfd_boolean error;
/* FIXME: This should not be static. */
static unsigned long previous_ibfd_e_flags = (unsigned long) -1;
if (bfd_get_flavour (ibfd) != bfd_target_elf_flavour
|| bfd_get_flavour (obfd) != bfd_target_elf_flavour)
- return true;
+ return TRUE;
- error = false;
+ error = FALSE;
if (bfd_get_mach (ibfd) >= bfd_mach_sparc_v9)
{
- error = true;
+ error = TRUE;
(*_bfd_error_handler)
(_("%s: compiled for a 64 bit system and target is 32 bit"),
bfd_archive_filename (ibfd));
@@ -2023,22 +3335,22 @@ elf32_sparc_merge_private_bfd_data (ibfd, obfd)
(*_bfd_error_handler)
(_("%s: linking little endian files with big endian files"),
bfd_archive_filename (ibfd));
- error = true;
+ error = TRUE;
}
previous_ibfd_e_flags = elf_elfheader (ibfd)->e_flags & EF_SPARC_LEDATA;
if (error)
{
bfd_set_error (bfd_error_bad_value);
- return false;
+ return FALSE;
}
- return true;
+ return TRUE;
}
/* Set the right machine number. */
-static boolean
+static bfd_boolean
elf32_sparc_object_p (abfd)
bfd *abfd;
{
@@ -2054,7 +3366,7 @@ elf32_sparc_object_p (abfd)
return bfd_default_set_arch_mach (abfd, bfd_arch_sparc,
bfd_mach_sparc_v8plus);
else
- return false;
+ return FALSE;
}
else if (elf_elfheader (abfd)->e_flags & EF_SPARC_LEDATA)
return bfd_default_set_arch_mach (abfd, bfd_arch_sparc,
@@ -2069,7 +3381,7 @@ elf32_sparc_object_p (abfd)
static void
elf32_sparc_final_write_processing (abfd, linker)
bfd *abfd;
- boolean linker ATTRIBUTE_UNUSED;
+ bfd_boolean linker ATTRIBUTE_UNUSED;
{
switch (bfd_get_mach (abfd))
{
@@ -2126,10 +3438,15 @@ elf32_sparc_reloc_type_class (rela)
#define ELF_MAXPAGESIZE 0x10000
#define bfd_elf32_bfd_reloc_type_lookup elf32_sparc_reloc_type_lookup
+#define bfd_elf32_bfd_link_hash_table_create \
+ elf32_sparc_link_hash_table_create
#define bfd_elf32_bfd_relax_section elf32_sparc_relax_section
+#define bfd_elf32_new_section_hook elf32_sparc_new_section_hook
#define elf_info_to_howto elf32_sparc_info_to_howto
+#define elf_backend_copy_indirect_symbol \
+ elf32_sparc_copy_indirect_symbol
#define elf_backend_create_dynamic_sections \
- _bfd_elf_create_dynamic_sections
+ elf32_sparc_create_dynamic_sections
#define elf_backend_check_relocs elf32_sparc_check_relocs
#define elf_backend_adjust_dynamic_symbol \
elf32_sparc_adjust_dynamic_symbol
@@ -2142,18 +3459,21 @@ elf32_sparc_reloc_type_class (rela)
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_mark_hook elf32_sparc_gc_mark_hook
#define elf_backend_gc_sweep_hook elf32_sparc_gc_sweep_hook
+#define elf_backend_grok_psinfo elf32_sparc_grok_psinfo
#define elf_backend_reloc_type_class elf32_sparc_reloc_type_class
#define elf_backend_can_gc_sections 1
+#define elf_backend_can_refcount 1
#define elf_backend_want_got_plt 0
#define elf_backend_plt_readonly 0
#define elf_backend_want_plt_sym 1
#define elf_backend_got_header_size 4
-#define elf_backend_plt_header_size (4*PLT_ENTRY_SIZE)
+#define elf_backend_rela_normal 1
#include "elf32-target.h"
diff --git a/contrib/binutils/bfd/elf64-alpha.c b/contrib/binutils/bfd/elf64-alpha.c
index 7397ed1..2d4715b 100644
--- a/contrib/binutils/bfd/elf64-alpha.c
+++ b/contrib/binutils/bfd/elf64-alpha.c
@@ -1,23 +1,23 @@
/* Alpha specific support for 64-bit ELF
- Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002
+ Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004
Free Software Foundation, Inc.
Contributed by Richard Henderson <rth@tamu.edu>.
-This file is part of BFD, the Binary File Descriptor library.
+ This 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
/* We need a published ABI spec for this. Until one comes out, don't
assume this'll remain unchanged forever. */
@@ -47,108 +47,112 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#define ECOFF_64
#include "ecoffswap.h"
-static int alpha_elf_dynamic_symbol_p
- PARAMS((struct elf_link_hash_entry *, struct bfd_link_info *));
+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 *));
+ 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 *));
+ PARAMS ((bfd *));
static bfd_reloc_status_type elf64_alpha_reloc_nil
- PARAMS((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
+ 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 **));
+ 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 *));
+ 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 **));
+ 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));
+ PARAMS ((bfd *, bfd_reloc_code_real_type));
static void elf64_alpha_info_to_howto
- PARAMS((bfd *, arelent *, Elf64_Internal_Rela *));
-
-static boolean elf64_alpha_mkobject
- PARAMS((bfd *));
-static boolean elf64_alpha_object_p
- PARAMS((bfd *));
-static boolean elf64_alpha_section_from_shdr
- PARAMS((bfd *, Elf64_Internal_Shdr *, const char *));
-static boolean elf64_alpha_section_flags
- PARAMS((flagword *, Elf64_Internal_Shdr *));
-static boolean elf64_alpha_fake_sections
- PARAMS((bfd *, Elf64_Internal_Shdr *, asection *));
-static boolean elf64_alpha_create_got_section
- PARAMS((bfd *, struct bfd_link_info *));
-static boolean elf64_alpha_create_dynamic_sections
- PARAMS((bfd *, struct bfd_link_info *));
-
-static boolean elf64_alpha_read_ecoff_info
- PARAMS((bfd *, asection *, struct ecoff_debug_info *));
-static boolean elf64_alpha_is_local_label_name
- PARAMS((bfd *, const char *));
-static boolean elf64_alpha_find_nearest_line
- PARAMS((bfd *, asection *, asymbol **, bfd_vma, const char **,
- const char **, unsigned int *));
+ PARAMS ((bfd *, arelent *, Elf_Internal_Rela *));
+
+static bfd_boolean elf64_alpha_mkobject
+ PARAMS ((bfd *));
+static bfd_boolean elf64_alpha_object_p
+ PARAMS ((bfd *));
+static bfd_boolean elf64_alpha_section_from_shdr
+ PARAMS ((bfd *, Elf_Internal_Shdr *, const char *));
+static bfd_boolean elf64_alpha_section_flags
+ PARAMS ((flagword *, Elf_Internal_Shdr *));
+static bfd_boolean elf64_alpha_fake_sections
+ PARAMS ((bfd *, Elf_Internal_Shdr *, asection *));
+static bfd_boolean elf64_alpha_create_got_section
+ PARAMS ((bfd *, struct bfd_link_info *));
+static bfd_boolean elf64_alpha_create_dynamic_sections
+ PARAMS ((bfd *, struct bfd_link_info *));
+
+static bfd_boolean elf64_alpha_read_ecoff_info
+ PARAMS ((bfd *, asection *, struct ecoff_debug_info *));
+static bfd_boolean elf64_alpha_is_local_label_name
+ PARAMS ((bfd *, const char *));
+static bfd_boolean elf64_alpha_find_nearest_line
+ PARAMS ((bfd *, asection *, asymbol **, bfd_vma, const char **,
+ const char **, unsigned int *));
#if defined(__STDC__) || defined(ALMOST_STDC)
struct alpha_elf_link_hash_entry;
#endif
-static boolean elf64_alpha_output_extsym
- PARAMS((struct alpha_elf_link_hash_entry *, PTR));
+static bfd_boolean elf64_alpha_output_extsym
+ PARAMS ((struct alpha_elf_link_hash_entry *, PTR));
-static boolean elf64_alpha_can_merge_gots
- PARAMS((bfd *, bfd *));
+static bfd_boolean elf64_alpha_can_merge_gots
+ PARAMS ((bfd *, bfd *));
static void elf64_alpha_merge_gots
- PARAMS((bfd *, bfd *));
-static boolean elf64_alpha_calc_got_offsets_for_symbol
+ 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 boolean elf64_alpha_size_got_sections
+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 boolean elf64_alpha_size_plt_section
+static bfd_boolean elf64_alpha_size_plt_section
PARAMS ((struct bfd_link_info *));
-static boolean elf64_alpha_size_plt_section_1
+static bfd_boolean elf64_alpha_size_plt_section_1
PARAMS ((struct alpha_elf_link_hash_entry *, PTR));
-static boolean elf64_alpha_always_size_sections
+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 boolean elf64_alpha_calc_dynrel_sizes
+static bfd_boolean elf64_alpha_calc_dynrel_sizes
PARAMS ((struct alpha_elf_link_hash_entry *, struct bfd_link_info *));
-static boolean elf64_alpha_size_rela_got_section
+static bfd_boolean elf64_alpha_size_rela_got_section
PARAMS ((struct bfd_link_info *));
-static boolean elf64_alpha_size_rela_got_1
+static bfd_boolean elf64_alpha_size_rela_got_1
PARAMS ((struct alpha_elf_link_hash_entry *, struct bfd_link_info *));
-static boolean elf64_alpha_add_symbol_hook
- PARAMS ((bfd *, struct bfd_link_info *, const Elf_Internal_Sym *,
+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 boolean elf64_alpha_check_relocs
- PARAMS((bfd *, struct bfd_link_info *, asection *sec,
+static bfd_boolean elf64_alpha_check_relocs
+ PARAMS ((bfd *, struct bfd_link_info *, asection *sec,
const Elf_Internal_Rela *));
-static boolean elf64_alpha_adjust_dynamic_symbol
- PARAMS((struct bfd_link_info *, struct elf_link_hash_entry *));
-static boolean elf64_alpha_size_dynamic_sections
- PARAMS((bfd *, struct bfd_link_info *));
-static boolean elf64_alpha_relocate_section_r
- PARAMS((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *,
- Elf_Internal_Rela *, Elf_Internal_Sym *, asection **));
-static boolean elf64_alpha_relocate_section
- PARAMS((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *,
+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 boolean elf64_alpha_finish_dynamic_symbol
- PARAMS((bfd *, struct bfd_link_info *, struct elf_link_hash_entry *,
- Elf_Internal_Sym *));
-static boolean elf64_alpha_finish_dynamic_sections
- PARAMS((bfd *, struct bfd_link_info *));
-static boolean elf64_alpha_final_link
- PARAMS((bfd *, struct bfd_link_info *));
-static boolean elf64_alpha_merge_ind_symbols
- PARAMS((struct alpha_elf_link_hash_entry *, PTR));
+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
@@ -173,19 +177,24 @@ struct alpha_elf_link_hash_entry
#define ALPHA_ELF_LINK_HASH_LU_TLSLDM 0x20
#define ALPHA_ELF_LINK_HASH_LU_FUNC 0x38
#define ALPHA_ELF_LINK_HASH_TLS_IE 0x40
+#define ALPHA_ELF_LINK_HASH_PLT_LOC 0x80
+
+ /* Used to undo the localization of a plt symbol. */
+ asection *plt_old_section;
+ bfd_vma plt_old_value;
/* Used to implement multiple .got subsections. */
struct alpha_elf_got_entry
{
struct alpha_elf_got_entry *next;
- /* which .got subsection? */
+ /* Which .got subsection? */
bfd *gotobj;
- /* the addend in effect for this entry. */
+ /* The addend in effect for this entry. */
bfd_vma addend;
- /* the .got offset for this entry. */
+ /* The .got offset for this entry. */
int got_offset;
/* How many references to this entry? */
@@ -204,22 +213,22 @@ struct alpha_elf_link_hash_entry
unsigned char reloc_xlated;
} *got_entries;
- /* used to count non-got, non-plt relocations for delayed sizing
+ /* Used to count non-got, non-plt relocations for delayed sizing
of relocation sections. */
struct alpha_elf_reloc_entry
{
struct alpha_elf_reloc_entry *next;
- /* which .reloc section? */
+ /* Which .reloc section? */
asection *srel;
- /* what kind of relocation? */
+ /* What kind of relocation? */
unsigned int rtype;
- /* is this against read-only section? */
+ /* Is this against read-only section? */
unsigned int reltext : 1;
- /* how many did we find? */
+ /* How many did we find? */
unsigned long count;
} *reloc_entries;
};
@@ -247,7 +256,7 @@ struct alpha_elf_link_hash_table
#define alpha_elf_link_hash_traverse(table, func, info) \
(elf_link_hash_traverse \
(&(table)->root, \
- (boolean (*) PARAMS ((struct elf_link_hash_entry *, PTR))) (func), \
+ (bfd_boolean (*) PARAMS ((struct elf_link_hash_entry *, PTR))) (func), \
(info)))
/* Get the Alpha ELF linker hash table from a link_info structure. */
@@ -260,47 +269,17 @@ struct alpha_elf_link_hash_table
#define alpha_elf_sym_hashes(abfd) \
((struct alpha_elf_link_hash_entry **)elf_sym_hashes(abfd))
-/* Should we do dynamic things to this symbol? */
+/* Should we do dynamic things to this symbol? This differs from the
+ generic version in that we never need to consider function pointer
+ equality wrt PLT entries -- we don't create a PLT entry if a symbol's
+ address is ever taken. */
-static int
+static inline bfd_boolean
alpha_elf_dynamic_symbol_p (h, info)
struct elf_link_hash_entry *h;
struct bfd_link_info *info;
{
- if (h == NULL)
- return false;
-
- while (h->root.type == bfd_link_hash_indirect
- || h->root.type == bfd_link_hash_warning)
- h = (struct elf_link_hash_entry *) h->root.u.i.link;
-
- if (h->dynindx == -1)
- return false;
-
- if (h->root.type == bfd_link_hash_undefweak
- || h->root.type == bfd_link_hash_defweak)
- return true;
-
- switch (ELF_ST_VISIBILITY (h->other))
- {
- case STV_DEFAULT:
- break;
- case STV_HIDDEN:
- case STV_INTERNAL:
- return false;
- case STV_PROTECTED:
- if (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR)
- return false;
- break;
- }
-
- if ((info->shared && !info->symbolic)
- || ((h->elf_link_hash_flags
- & (ELF_LINK_HASH_DEF_DYNAMIC | ELF_LINK_HASH_REF_REGULAR))
- == (ELF_LINK_HASH_DEF_DYNAMIC | ELF_LINK_HASH_REF_REGULAR)))
- return true;
-
- return false;
+ return _bfd_elf_dynamic_symbol_p (h, info, 0);
}
/* Create an entry in a Alpha ELF linker hash table. */
@@ -399,30 +378,21 @@ struct alpha_elf_obj_tdata
#define alpha_elf_tdata(abfd) \
((struct alpha_elf_obj_tdata *) (abfd)->tdata.any)
-static boolean
+static bfd_boolean
elf64_alpha_mkobject (abfd)
bfd *abfd;
{
bfd_size_type amt = sizeof (struct alpha_elf_obj_tdata);
abfd->tdata.any = bfd_zalloc (abfd, amt);
if (abfd->tdata.any == NULL)
- return false;
- return true;
+ return FALSE;
+ return TRUE;
}
-static boolean
+static bfd_boolean
elf64_alpha_object_p (abfd)
bfd *abfd;
{
- /* Allocate our special target data. */
- struct alpha_elf_obj_tdata *new_tdata;
- bfd_size_type amt = sizeof (struct alpha_elf_obj_tdata);
- new_tdata = bfd_zalloc (abfd, amt);
- if (new_tdata == NULL)
- return false;
- new_tdata->root = *abfd->tdata.elf_obj_data;
- abfd->tdata.any = new_tdata;
-
/* Set the right machine number for an Alpha ELF file. */
return bfd_default_set_arch_mach (abfd, bfd_arch_alpha, 0);
}
@@ -440,45 +410,45 @@ static reloc_howto_type elf64_alpha_howto_table[] =
0, /* rightshift */
0, /* size (0 = byte, 1 = short, 2 = long) */
8, /* bitsize */
- true, /* pc_relative */
+ TRUE, /* pc_relative */
0, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
elf64_alpha_reloc_nil, /* special_function */
"NONE", /* name */
- false, /* partial_inplace */
+ FALSE, /* partial_inplace */
0, /* src_mask */
0, /* dst_mask */
- true), /* pcrel_offset */
+ TRUE), /* pcrel_offset */
/* A 32 bit reference to a symbol. */
HOWTO (R_ALPHA_REFLONG, /* type */
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
32, /* bitsize */
- false, /* pc_relative */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
0, /* special_function */
"REFLONG", /* name */
- false, /* partial_inplace */
+ FALSE, /* partial_inplace */
0xffffffff, /* src_mask */
0xffffffff, /* dst_mask */
- false), /* pcrel_offset */
+ FALSE), /* pcrel_offset */
/* A 64 bit reference to a symbol. */
HOWTO (R_ALPHA_REFQUAD, /* type */
0, /* rightshift */
4, /* size (0 = byte, 1 = short, 2 = long) */
64, /* bitsize */
- false, /* pc_relative */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
0, /* special_function */
"REFQUAD", /* name */
- false, /* partial_inplace */
+ FALSE, /* partial_inplace */
MINUS_ONE, /* src_mask */
MINUS_ONE, /* dst_mask */
- false), /* pcrel_offset */
+ FALSE), /* pcrel_offset */
/* A 32 bit GP relative offset. This is just like REFLONG except
that when the value is used the value of the gp register will be
@@ -487,30 +457,30 @@ static reloc_howto_type elf64_alpha_howto_table[] =
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
32, /* bitsize */
- false, /* pc_relative */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
0, /* special_function */
"GPREL32", /* name */
- false, /* partial_inplace */
+ FALSE, /* partial_inplace */
0xffffffff, /* src_mask */
0xffffffff, /* dst_mask */
- false), /* pcrel_offset */
+ FALSE), /* pcrel_offset */
/* Used for an instruction that refers to memory off the GP register. */
HOWTO (R_ALPHA_LITERAL, /* type */
0, /* rightshift */
1, /* size (0 = byte, 1 = short, 2 = long) */
16, /* bitsize */
- false, /* pc_relative */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_signed, /* complain_on_overflow */
0, /* special_function */
"ELF_LITERAL", /* name */
- false, /* partial_inplace */
+ FALSE, /* partial_inplace */
0xffff, /* src_mask */
0xffff, /* dst_mask */
- false), /* pcrel_offset */
+ FALSE), /* pcrel_offset */
/* This reloc only appears immediately following an ELF_LITERAL reloc.
It identifies a use of the literal. The symbol index is special:
@@ -523,15 +493,15 @@ static reloc_howto_type elf64_alpha_howto_table[] =
0, /* rightshift */
1, /* size (0 = byte, 1 = short, 2 = long) */
32, /* bitsize */
- false, /* pc_relative */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
elf64_alpha_reloc_nil, /* special_function */
"LITUSE", /* name */
- false, /* partial_inplace */
+ FALSE, /* partial_inplace */
0, /* src_mask */
0, /* dst_mask */
- false), /* pcrel_offset */
+ FALSE), /* pcrel_offset */
/* Load the gp register. This is always used for a ldah instruction
which loads the upper 16 bits of the gp register. The symbol
@@ -553,90 +523,90 @@ static reloc_howto_type elf64_alpha_howto_table[] =
16, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
16, /* bitsize */
- false, /* pc_relative */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
elf64_alpha_reloc_gpdisp, /* special_function */
"GPDISP", /* name */
- false, /* partial_inplace */
+ FALSE, /* partial_inplace */
0xffff, /* src_mask */
0xffff, /* dst_mask */
- true), /* pcrel_offset */
+ TRUE), /* pcrel_offset */
/* A 21 bit branch. */
HOWTO (R_ALPHA_BRADDR, /* type */
2, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
21, /* bitsize */
- true, /* pc_relative */
+ TRUE, /* pc_relative */
0, /* bitpos */
complain_overflow_signed, /* complain_on_overflow */
0, /* special_function */
"BRADDR", /* name */
- false, /* partial_inplace */
+ FALSE, /* partial_inplace */
0x1fffff, /* src_mask */
0x1fffff, /* dst_mask */
- true), /* pcrel_offset */
+ TRUE), /* pcrel_offset */
/* A hint for a jump to a register. */
HOWTO (R_ALPHA_HINT, /* type */
2, /* rightshift */
1, /* size (0 = byte, 1 = short, 2 = long) */
14, /* bitsize */
- true, /* pc_relative */
+ TRUE, /* pc_relative */
0, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
0, /* special_function */
"HINT", /* name */
- false, /* partial_inplace */
+ FALSE, /* partial_inplace */
0x3fff, /* src_mask */
0x3fff, /* dst_mask */
- true), /* pcrel_offset */
+ TRUE), /* pcrel_offset */
/* 16 bit PC relative offset. */
HOWTO (R_ALPHA_SREL16, /* type */
0, /* rightshift */
1, /* size (0 = byte, 1 = short, 2 = long) */
16, /* bitsize */
- true, /* pc_relative */
+ TRUE, /* pc_relative */
0, /* bitpos */
complain_overflow_signed, /* complain_on_overflow */
0, /* special_function */
"SREL16", /* name */
- false, /* partial_inplace */
+ FALSE, /* partial_inplace */
0xffff, /* src_mask */
0xffff, /* dst_mask */
- true), /* pcrel_offset */
+ TRUE), /* pcrel_offset */
/* 32 bit PC relative offset. */
HOWTO (R_ALPHA_SREL32, /* type */
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
32, /* bitsize */
- true, /* pc_relative */
+ TRUE, /* pc_relative */
0, /* bitpos */
complain_overflow_signed, /* complain_on_overflow */
0, /* special_function */
"SREL32", /* name */
- false, /* partial_inplace */
+ FALSE, /* partial_inplace */
0xffffffff, /* src_mask */
0xffffffff, /* dst_mask */
- true), /* pcrel_offset */
+ TRUE), /* pcrel_offset */
/* A 64 bit PC relative offset. */
HOWTO (R_ALPHA_SREL64, /* type */
0, /* rightshift */
4, /* size (0 = byte, 1 = short, 2 = long) */
64, /* bitsize */
- true, /* pc_relative */
+ TRUE, /* pc_relative */
0, /* bitpos */
complain_overflow_signed, /* complain_on_overflow */
0, /* special_function */
"SREL64", /* name */
- false, /* partial_inplace */
+ FALSE, /* partial_inplace */
MINUS_ONE, /* src_mask */
MINUS_ONE, /* dst_mask */
- true), /* pcrel_offset */
+ TRUE), /* pcrel_offset */
/* Skip 12 - 16; deprecated ECOFF relocs. */
SKIP_HOWTO (12),
@@ -650,45 +620,45 @@ static reloc_howto_type elf64_alpha_howto_table[] =
0, /* rightshift */
1, /* size (0 = byte, 1 = short, 2 = long) */
16, /* bitsize */
- false, /* pc_relative */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_signed, /* complain_on_overflow */
0, /* special_function */
"GPRELHIGH", /* name */
- false, /* partial_inplace */
+ FALSE, /* partial_inplace */
0xffff, /* src_mask */
0xffff, /* dst_mask */
- false), /* pcrel_offset */
+ FALSE), /* pcrel_offset */
/* The low 16 bits of the displacement from GP to the target. */
HOWTO (R_ALPHA_GPRELLOW,
0, /* rightshift */
1, /* size (0 = byte, 1 = short, 2 = long) */
16, /* bitsize */
- false, /* pc_relative */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
0, /* special_function */
"GPRELLOW", /* name */
- false, /* partial_inplace */
+ FALSE, /* partial_inplace */
0xffff, /* src_mask */
0xffff, /* dst_mask */
- false), /* pcrel_offset */
+ FALSE), /* pcrel_offset */
/* A 16-bit displacement from the GP to the target. */
HOWTO (R_ALPHA_GPREL16,
0, /* rightshift */
1, /* size (0 = byte, 1 = short, 2 = long) */
16, /* bitsize */
- false, /* pc_relative */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_signed, /* complain_on_overflow */
0, /* special_function */
"GPREL16", /* name */
- false, /* partial_inplace */
+ FALSE, /* partial_inplace */
0xffff, /* src_mask */
0xffff, /* dst_mask */
- false), /* pcrel_offset */
+ FALSE), /* pcrel_offset */
/* Skip 20 - 23; deprecated ECOFF relocs. */
SKIP_HOWTO (20),
@@ -706,120 +676,120 @@ static reloc_howto_type elf64_alpha_howto_table[] =
0,
0,
0,
- false,
+ FALSE,
0,
complain_overflow_dont,
bfd_elf_generic_reloc,
"COPY",
- false,
+ FALSE,
0,
0,
- true),
+ TRUE),
/* A dynamic relocation for a .got entry. */
HOWTO (R_ALPHA_GLOB_DAT,
0,
0,
0,
- false,
+ FALSE,
0,
complain_overflow_dont,
bfd_elf_generic_reloc,
"GLOB_DAT",
- false,
+ FALSE,
0,
0,
- true),
+ TRUE),
/* A dynamic relocation for a .plt entry. */
HOWTO (R_ALPHA_JMP_SLOT,
0,
0,
0,
- false,
+ FALSE,
0,
complain_overflow_dont,
bfd_elf_generic_reloc,
"JMP_SLOT",
- false,
+ FALSE,
0,
0,
- true),
+ TRUE),
/* A dynamic relocation to add the base of the DSO to a 64-bit field. */
HOWTO (R_ALPHA_RELATIVE,
0,
0,
0,
- false,
+ FALSE,
0,
complain_overflow_dont,
bfd_elf_generic_reloc,
"RELATIVE",
- false,
+ FALSE,
0,
0,
- true),
+ TRUE),
/* A 21 bit branch that adjusts for gp loads. */
HOWTO (R_ALPHA_BRSGP, /* type */
2, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
21, /* bitsize */
- true, /* pc_relative */
+ TRUE, /* pc_relative */
0, /* bitpos */
complain_overflow_signed, /* complain_on_overflow */
0, /* special_function */
"BRSGP", /* name */
- false, /* partial_inplace */
+ FALSE, /* partial_inplace */
0x1fffff, /* src_mask */
0x1fffff, /* dst_mask */
- true), /* pcrel_offset */
+ TRUE), /* pcrel_offset */
/* Creates a tls_index for the symbol in the got. */
HOWTO (R_ALPHA_TLSGD, /* type */
0, /* rightshift */
1, /* size (0 = byte, 1 = short, 2 = long) */
16, /* bitsize */
- false, /* pc_relative */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_signed, /* complain_on_overflow */
0, /* special_function */
"TLSGD", /* name */
- false, /* partial_inplace */
+ FALSE, /* partial_inplace */
0xffff, /* src_mask */
0xffff, /* dst_mask */
- false), /* pcrel_offset */
+ FALSE), /* pcrel_offset */
/* Creates a tls_index for the (current) module in the got. */
HOWTO (R_ALPHA_TLSLDM, /* type */
0, /* rightshift */
1, /* size (0 = byte, 1 = short, 2 = long) */
16, /* bitsize */
- false, /* pc_relative */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_signed, /* complain_on_overflow */
0, /* special_function */
"TLSLDM", /* name */
- false, /* partial_inplace */
+ FALSE, /* partial_inplace */
0xffff, /* src_mask */
0xffff, /* dst_mask */
- false), /* pcrel_offset */
+ FALSE), /* pcrel_offset */
/* A dynamic relocation for a DTP module entry. */
HOWTO (R_ALPHA_DTPMOD64, /* type */
0, /* rightshift */
4, /* size (0 = byte, 1 = short, 2 = long) */
64, /* bitsize */
- false, /* pc_relative */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
0, /* special_function */
"DTPMOD64", /* name */
- false, /* partial_inplace */
+ FALSE, /* partial_inplace */
MINUS_ONE, /* src_mask */
MINUS_ONE, /* dst_mask */
- false), /* pcrel_offset */
+ FALSE), /* pcrel_offset */
/* Creates a 64-bit offset in the got for the displacement
from DTP to the target. */
@@ -827,75 +797,75 @@ static reloc_howto_type elf64_alpha_howto_table[] =
0, /* rightshift */
1, /* size (0 = byte, 1 = short, 2 = long) */
16, /* bitsize */
- false, /* pc_relative */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_signed, /* complain_on_overflow */
0, /* special_function */
"GOTDTPREL", /* name */
- false, /* partial_inplace */
+ FALSE, /* partial_inplace */
0xffff, /* src_mask */
0xffff, /* dst_mask */
- false), /* pcrel_offset */
+ FALSE), /* pcrel_offset */
/* A dynamic relocation for a displacement from DTP to the target. */
HOWTO (R_ALPHA_DTPREL64, /* type */
0, /* rightshift */
4, /* size (0 = byte, 1 = short, 2 = long) */
64, /* bitsize */
- false, /* pc_relative */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
0, /* special_function */
"DTPREL64", /* name */
- false, /* partial_inplace */
+ FALSE, /* partial_inplace */
MINUS_ONE, /* src_mask */
MINUS_ONE, /* dst_mask */
- false), /* pcrel_offset */
+ FALSE), /* pcrel_offset */
/* The high 16 bits of the displacement from DTP to the target. */
HOWTO (R_ALPHA_DTPRELHI, /* type */
0, /* rightshift */
1, /* size (0 = byte, 1 = short, 2 = long) */
16, /* bitsize */
- false, /* pc_relative */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_signed, /* complain_on_overflow */
0, /* special_function */
"DTPRELHI", /* name */
- false, /* partial_inplace */
+ FALSE, /* partial_inplace */
0xffff, /* src_mask */
0xffff, /* dst_mask */
- false), /* pcrel_offset */
+ FALSE), /* pcrel_offset */
/* The low 16 bits of the displacement from DTP to the target. */
HOWTO (R_ALPHA_DTPRELLO, /* type */
0, /* rightshift */
1, /* size (0 = byte, 1 = short, 2 = long) */
16, /* bitsize */
- false, /* pc_relative */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
0, /* special_function */
"DTPRELLO", /* name */
- false, /* partial_inplace */
+ FALSE, /* partial_inplace */
0xffff, /* src_mask */
0xffff, /* dst_mask */
- false), /* pcrel_offset */
+ FALSE), /* pcrel_offset */
/* A 16-bit displacement from DTP to the target. */
HOWTO (R_ALPHA_DTPREL16, /* type */
0, /* rightshift */
1, /* size (0 = byte, 1 = short, 2 = long) */
16, /* bitsize */
- false, /* pc_relative */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_signed, /* complain_on_overflow */
0, /* special_function */
"DTPREL16", /* name */
- false, /* partial_inplace */
+ FALSE, /* partial_inplace */
0xffff, /* src_mask */
0xffff, /* dst_mask */
- false), /* pcrel_offset */
+ FALSE), /* pcrel_offset */
/* Creates a 64-bit offset in the got for the displacement
from TP to the target. */
@@ -903,75 +873,75 @@ static reloc_howto_type elf64_alpha_howto_table[] =
0, /* rightshift */
1, /* size (0 = byte, 1 = short, 2 = long) */
16, /* bitsize */
- false, /* pc_relative */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_signed, /* complain_on_overflow */
0, /* special_function */
"GOTTPREL", /* name */
- false, /* partial_inplace */
+ FALSE, /* partial_inplace */
0xffff, /* src_mask */
0xffff, /* dst_mask */
- false), /* pcrel_offset */
+ FALSE), /* pcrel_offset */
/* A dynamic relocation for a displacement from TP to the target. */
HOWTO (R_ALPHA_TPREL64, /* type */
0, /* rightshift */
4, /* size (0 = byte, 1 = short, 2 = long) */
64, /* bitsize */
- false, /* pc_relative */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
0, /* special_function */
"TPREL64", /* name */
- false, /* partial_inplace */
+ FALSE, /* partial_inplace */
MINUS_ONE, /* src_mask */
MINUS_ONE, /* dst_mask */
- false), /* pcrel_offset */
+ FALSE), /* pcrel_offset */
/* The high 16 bits of the displacement from TP to the target. */
HOWTO (R_ALPHA_TPRELHI, /* type */
0, /* rightshift */
1, /* size (0 = byte, 1 = short, 2 = long) */
16, /* bitsize */
- false, /* pc_relative */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_signed, /* complain_on_overflow */
0, /* special_function */
"TPRELHI", /* name */
- false, /* partial_inplace */
+ FALSE, /* partial_inplace */
0xffff, /* src_mask */
0xffff, /* dst_mask */
- false), /* pcrel_offset */
+ FALSE), /* pcrel_offset */
/* The low 16 bits of the displacement from TP to the target. */
HOWTO (R_ALPHA_TPRELLO, /* type */
0, /* rightshift */
1, /* size (0 = byte, 1 = short, 2 = long) */
16, /* bitsize */
- false, /* pc_relative */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
0, /* special_function */
"TPRELLO", /* name */
- false, /* partial_inplace */
+ FALSE, /* partial_inplace */
0xffff, /* src_mask */
0xffff, /* dst_mask */
- false), /* pcrel_offset */
+ FALSE), /* pcrel_offset */
/* A 16-bit displacement from TP to the target. */
HOWTO (R_ALPHA_TPREL16, /* type */
0, /* rightshift */
1, /* size (0 = byte, 1 = short, 2 = long) */
16, /* bitsize */
- false, /* pc_relative */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_signed, /* complain_on_overflow */
0, /* special_function */
"TPREL16", /* name */
- false, /* partial_inplace */
+ FALSE, /* partial_inplace */
0xffff, /* src_mask */
0xffff, /* dst_mask */
- false), /* pcrel_offset */
+ FALSE), /* pcrel_offset */
};
/* A relocation function which doesn't do anything. */
@@ -1165,7 +1135,7 @@ static void
elf64_alpha_info_to_howto (abfd, cache_ptr, dst)
bfd *abfd ATTRIBUTE_UNUSED;
arelent *cache_ptr;
- Elf64_Internal_Rela *dst;
+ Elf_Internal_Rela *dst;
{
unsigned r_type;
@@ -1179,13 +1149,15 @@ elf64_alpha_info_to_howto (abfd, cache_ptr, dst)
(r_type == R_ALPHA_TLSGD || r_type == R_ALPHA_TLSLDM ? 16 : 8)
/* This is PT_TLS segment p_vaddr. */
-#define alpha_get_dtprel_base(tlss) \
- ((tlss)->start)
+#define alpha_get_dtprel_base(info) \
+ (elf_hash_table (info)->tls_sec->vma)
/* Main program TLS (whose template starts at PT_TLS p_vaddr)
is assigned offset round(16, PT_TLS p_align). */
-#define alpha_get_tprel_base(tlss) \
- ((tlss)->start - align_power ((bfd_vma) 16, (tlss)->align))
+#define alpha_get_tprel_base(info) \
+ (elf_hash_table (info)->tls_sec->vma \
+ - align_power ((bfd_vma) 16, \
+ elf_hash_table (info)->tls_sec->alignment_power))
/* These functions do relaxation for Alpha ELF.
@@ -1219,37 +1191,34 @@ struct alpha_relax_info
Elf_Internal_Shdr *symtab_hdr;
Elf_Internal_Rela *relocs, *relend;
struct bfd_link_info *link_info;
- struct elf_link_tls_segment *tls_segment;
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;
- boolean changed_contents;
- boolean changed_relocs;
+ bfd_boolean changed_contents;
+ bfd_boolean changed_relocs;
unsigned char other;
};
-static boolean elf64_alpha_relax_with_lituse
+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 boolean elf64_alpha_relax_got_load
+static bfd_boolean elf64_alpha_relax_got_load
PARAMS((struct alpha_relax_info *info, bfd_vma symval,
Elf_Internal_Rela *irel, unsigned long));
-static boolean elf64_alpha_relax_gprelhilo
+static bfd_boolean elf64_alpha_relax_gprelhilo
PARAMS((struct alpha_relax_info *info, bfd_vma symval,
- Elf_Internal_Rela *irel, boolean));
-static boolean elf64_alpha_relax_tls_get_addr
+ 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, boolean));
-static struct elf_link_tls_segment *elf64_alpha_relax_find_tls_segment
- PARAMS((struct alpha_relax_info *, struct elf_link_tls_segment *));
-static boolean elf64_alpha_relax_section
+ Elf_Internal_Rela *irel, bfd_boolean));
+static bfd_boolean elf64_alpha_relax_section
PARAMS((bfd *abfd, asection *sec, struct bfd_link_info *link_info,
- boolean *again));
+ bfd_boolean *again));
static Elf_Internal_Rela *
elf64_alpha_find_reloc_at_ofs (rel, relend, offset, type)
@@ -1267,7 +1236,7 @@ elf64_alpha_find_reloc_at_ofs (rel, relend, offset, type)
return NULL;
}
-static boolean
+static bfd_boolean
elf64_alpha_relax_with_lituse (info, symval, irel)
struct alpha_relax_info *info;
bfd_vma symval;
@@ -1276,10 +1245,10 @@ elf64_alpha_relax_with_lituse (info, symval, irel)
Elf_Internal_Rela *urel, *irelend = info->relend;
int flags, count, i;
bfd_signed_vma disp;
- boolean fits16;
- boolean fits32;
- boolean lit_reused = false;
- boolean all_optimized = true;
+ 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);
@@ -1289,12 +1258,12 @@ elf64_alpha_relax_with_lituse (info, symval, irel)
("%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;
+ return TRUE;
}
/* Can't relax dynamic symbols. */
if (alpha_elf_dynamic_symbol_p (&info->h->root, info->link_info))
- return true;
+ return TRUE;
/* Summarize how this particular LITERAL is used. */
for (urel = irel+1, flags = count = 0; urel < irelend; ++urel, ++count)
@@ -1322,7 +1291,7 @@ elf64_alpha_relax_with_lituse (info, symval, irel)
default:
/* This type is really just a placeholder to note that all
uses cannot be optimized, but to still allow some. */
- all_optimized = false;
+ all_optimized = FALSE;
break;
case LITUSE_ALPHA_BASE:
@@ -1348,11 +1317,11 @@ elf64_alpha_relax_with_lituse (info, symval, irel)
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;
+ info->changed_relocs = TRUE;
bfd_put_32 (info->abfd, (bfd_vma) insn,
info->contents + urel->r_offset);
- info->changed_contents = true;
+ info->changed_contents = TRUE;
}
/* If all mem+byte, we can optimize 32-bit mem displacements. */
@@ -1365,16 +1334,16 @@ elf64_alpha_relax_with_lituse (info, symval, irel)
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;
+ 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;
+ info->changed_relocs = TRUE;
}
else
- all_optimized = false;
+ all_optimized = FALSE;
break;
case LITUSE_ALPHA_BYTOFF:
@@ -1388,11 +1357,11 @@ elf64_alpha_relax_with_lituse (info, symval, irel)
urel->r_info = ELF64_R_INFO (0, R_ALPHA_NONE);
urel->r_addend = 0;
- info->changed_relocs = true;
+ info->changed_relocs = TRUE;
bfd_put_32 (info->abfd, (bfd_vma) insn,
info->contents + urel->r_offset);
- info->changed_contents = true;
+ info->changed_contents = TRUE;
break;
case LITUSE_ALPHA_JSR:
@@ -1426,7 +1395,7 @@ elf64_alpha_relax_with_lituse (info, symval, irel)
if (optdest)
urel->r_addend += optdest - symval;
else
- all_optimized = false;
+ all_optimized = FALSE;
bfd_put_32 (info->abfd, (bfd_vma) insn,
info->contents + urel->r_offset);
@@ -1438,11 +1407,11 @@ elf64_alpha_relax_with_lituse (info, symval, irel)
if (xrel)
xrel->r_info = ELF64_R_INFO (0, R_ALPHA_NONE);
- info->changed_contents = true;
- info->changed_relocs = true;
+ info->changed_contents = TRUE;
+ info->changed_relocs = TRUE;
}
else
- all_optimized = false;
+ 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. */
@@ -1470,8 +1439,8 @@ elf64_alpha_relax_with_lituse (info, symval, irel)
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;
+ info->changed_contents = TRUE;
+ info->changed_relocs = TRUE;
}
}
}
@@ -1499,15 +1468,15 @@ elf64_alpha_relax_with_lituse (info, symval, irel)
if (!lit_reused)
{
irel->r_info = ELF64_R_INFO (0, R_ALPHA_NONE);
- info->changed_relocs = true;
+ info->changed_relocs = TRUE;
bfd_put_32 (info->abfd, (bfd_vma) INSN_UNOP,
info->contents + irel->r_offset);
- info->changed_contents = true;
+ info->changed_contents = TRUE;
}
}
- return true;
+ return TRUE;
}
static bfd_vma
@@ -1545,7 +1514,7 @@ elf64_alpha_relax_opt_call (info, symval)
}
else
{
- tsec_relocs = (_bfd_elf64_link_read_relocs
+ tsec_relocs = (_bfd_elf_link_read_relocs
(info->abfd, info->tsec, (PTR) NULL,
(Elf_Internal_Rela *) NULL,
info->link_info->keep_memory));
@@ -1582,7 +1551,7 @@ elf64_alpha_relax_opt_call (info, symval)
return symval + 8;
}
-static boolean
+static bfd_boolean
elf64_alpha_relax_got_load (info, symval, irel, r_type)
struct alpha_relax_info *info;
bfd_vma symval;
@@ -1602,16 +1571,16 @@ elf64_alpha_relax_got_load (info, symval, irel, r_type)
("%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;
+ return TRUE;
}
/* Can't relax dynamic symbols. */
if (alpha_elf_dynamic_symbol_p (&info->h->root, info->link_info))
- return true;
+ return TRUE;
/* Can't use local-exec relocations in shared libraries. */
if (r_type == R_ALPHA_GOTTPREL && info->link_info->shared)
- return true;
+ return TRUE;
if (r_type == R_ALPHA_LITERAL)
disp = symval - info->gp;
@@ -1619,14 +1588,14 @@ elf64_alpha_relax_got_load (info, symval, irel, r_type)
{
bfd_vma dtp_base, tp_base;
- BFD_ASSERT (info->tls_segment != NULL);
- dtp_base = alpha_get_dtprel_base (info->tls_segment);
- tp_base = alpha_get_tprel_base (info->tls_segment);
+ 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;
+ 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. */
@@ -1635,8 +1604,19 @@ elf64_alpha_relax_got_load (info, symval, irel, r_type)
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;
+ 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:
@@ -1650,21 +1630,11 @@ elf64_alpha_relax_got_load (info, symval, irel, r_type)
break;
default:
BFD_ASSERT (0);
- return false;
+ return FALSE;
}
irel->r_info = ELF64_R_INFO (ELF64_R_SYM (irel->r_info), r_type);
- info->changed_relocs = 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;
- }
+ info->changed_relocs = TRUE;
/* ??? Search forward through this basic block looking for insns
that use the target register. Stop after an insn modifying the
@@ -1679,15 +1649,15 @@ elf64_alpha_relax_got_load (info, symval, irel, r_type)
This would mean that we'd have to _add_ relocations, the pain of
which gives one pause. */
- return true;
+ return TRUE;
}
-static boolean
+static bfd_boolean
elf64_alpha_relax_gprelhilo (info, symval, irel, hi)
struct alpha_relax_info *info;
bfd_vma symval;
Elf_Internal_Rela *irel;
- boolean hi;
+ bfd_boolean hi;
{
unsigned int insn;
bfd_signed_vma disp;
@@ -1703,22 +1673,22 @@ elf64_alpha_relax_gprelhilo (info, symval, irel, hi)
which would indeed be the most efficient way to implement this. */
- return true;
+ return TRUE;
disp = symval - info->gp;
if (disp < -0x8000 || disp >= 0x8000)
- return true;
+ return TRUE;
if (hi)
{
/* Nop out the high instruction. */
bfd_put_32 (info->abfd, (bfd_vma) INSN_UNOP, pos);
- info->changed_contents = true;
+ info->changed_contents = TRUE;
irel->r_info = ELF64_R_INFO (0, R_ALPHA_NONE);
irel->r_addend = 0;
- info->changed_relocs = true;
+ info->changed_relocs = TRUE;
}
else
{
@@ -1727,35 +1697,31 @@ elf64_alpha_relax_gprelhilo (info, symval, irel, hi)
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;
+ info->changed_contents = TRUE;
irel->r_info = ELF64_R_INFO (ELF64_R_SYM (irel->r_info),
R_ALPHA_GPREL16);
- info->changed_relocs = true;
+ info->changed_relocs = TRUE;
}
- return true;
+ return TRUE;
}
-static boolean
+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;
- boolean is_gd;
+ bfd_boolean is_gd;
{
bfd_byte *pos[5];
unsigned int insn;
Elf_Internal_Rela *gpdisp, *hint;
- boolean dynamic, use_gottprel;
+ bfd_boolean dynamic, use_gottprel, pos1_unusable;
+ unsigned long new_symndx;
dynamic = alpha_elf_dynamic_symbol_p (&info->h->root, info->link_info);
- /* ??? For LD relaxation, we need a symbol referencing the beginning
- of the TLS segment. */
- if (!is_gd)
- return true;
-
/* 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))
@@ -1769,39 +1735,44 @@ elf64_alpha_relax_tls_get_addr (info, symval, irel, is_gd)
/* Otherwise we must be building an executable to do anything. */
else if (info->link_info->shared)
- return true;
+ 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;
+ 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;
+ 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;
+ 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;
- /* Only positions 0 and 1 are allowed to be out of order. */
- if (pos[1] < pos[0])
+ /* 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;
}
- if (pos[1] >= pos[2] || pos[2] >= pos[3] || pos[3] >= pos[4])
- return true;
+ 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. */
@@ -1855,7 +1826,8 @@ elf64_alpha_relax_tls_get_addr (info, symval, irel, is_gd)
as appropriate. */
- use_gottprel = false;
+ use_gottprel = FALSE;
+ new_symndx = is_gd ? ELF64_R_SYM (irel->r_info) : 0;
switch (!dynamic && !info->link_info->shared)
{
case 1:
@@ -1863,8 +1835,8 @@ elf64_alpha_relax_tls_get_addr (info, symval, irel, is_gd)
bfd_vma tp_base;
bfd_signed_vma disp;
- BFD_ASSERT (info->tls_segment != NULL);
- tp_base = alpha_get_tprel_base (info->tls_segment);
+ 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)
@@ -1874,13 +1846,13 @@ elf64_alpha_relax_tls_get_addr (info, symval, irel, is_gd)
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 (ELF64_R_SYM (irel->r_info),
- R_ALPHA_TPREL16);
+ 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)
+ && 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]);
@@ -1888,26 +1860,23 @@ elf64_alpha_relax_tls_get_addr (info, symval, irel, is_gd)
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 (ELF64_R_SYM (irel->r_info),
- R_ALPHA_TPRELHI);
+ 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 (ELF64_R_SYM (irel->r_info),
- R_ALPHA_TPRELLO);
+ irel[1].r_info = ELF64_R_INFO (new_symndx, R_ALPHA_TPRELLO);
break;
}
}
/* FALLTHRU */
default:
- use_gottprel = true;
+ 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 (ELF64_R_SYM (irel->r_info),
- R_ALPHA_GOTTPREL);
+ irel[0].r_info = ELF64_R_INFO (new_symndx, R_ALPHA_GOTTPREL);
irel[1].r_info = ELF64_R_INFO (0, R_ALPHA_NONE);
break;
}
@@ -1927,8 +1896,8 @@ elf64_alpha_relax_tls_get_addr (info, symval, irel, is_gd)
if (hint)
hint->r_info = ELF64_R_INFO (0, R_ALPHA_NONE);
- info->changed_contents = true;
- info->changed_relocs = true;
+ info->changed_contents = TRUE;
+ info->changed_relocs = TRUE;
/* Reduce the use count on the TLSGD/TLSLDM relocation. */
if (--info->gotent->use_count == 0)
@@ -1962,7 +1931,7 @@ elf64_alpha_relax_tls_get_addr (info, symval, irel, is_gd)
tprel_gotent = (struct alpha_elf_got_entry *)
bfd_alloc (info->abfd, sizeof (struct alpha_elf_got_entry));
if (!tprel_gotent)
- return false;
+ return FALSE;
tprel_gotent->next = *info->first_gotent;
*info->first_gotent = tprel_gotent;
@@ -1979,62 +1948,15 @@ elf64_alpha_relax_tls_get_addr (info, symval, irel, is_gd)
}
}
- return true;
+ return TRUE;
}
-static struct elf_link_tls_segment *
-elf64_alpha_relax_find_tls_segment (info, seg)
- struct alpha_relax_info *info;
- struct elf_link_tls_segment *seg;
-{
- bfd *output_bfd = info->sec->output_section->owner;
- asection *o;
- unsigned int align;
- bfd_vma base, end;
-
- for (o = output_bfd->sections; o ; o = o->next)
- if ((o->flags & SEC_THREAD_LOCAL) != 0
- && (o->flags & SEC_LOAD) != 0)
- break;
- if (!o)
- return NULL;
-
- base = o->vma;
- align = 0;
-
- do
- {
- bfd_vma size;
-
- if (bfd_get_section_alignment (output_bfd, o) > align)
- align = bfd_get_section_alignment (output_bfd, o);
-
- size = o->_raw_size;
- if (size == 0 && (o->flags & SEC_HAS_CONTENTS) == 0)
- {
- struct bfd_link_order *lo;
- for (lo = o->link_order_head; lo ; lo = lo->next)
- if (size < lo->offset + lo->size)
- size = lo->offset + lo->size;
- }
- end = o->vma + size;
- o = o->next;
- }
- while (o && (o->flags & SEC_THREAD_LOCAL));
-
- seg->start = base;
- seg->size = end - base;
- seg->align = align;
-
- return seg;
-}
-
-static boolean
+static bfd_boolean
elf64_alpha_relax_section (abfd, sec, link_info, again)
bfd *abfd;
asection *sec;
struct bfd_link_info *link_info;
- boolean *again;
+ bfd_boolean *again;
{
Elf_Internal_Shdr *symtab_hdr;
Elf_Internal_Rela *internal_relocs;
@@ -2042,15 +1964,14 @@ elf64_alpha_relax_section (abfd, sec, link_info, again)
Elf_Internal_Sym *isymbuf = NULL;
struct alpha_elf_got_entry **local_got_entries;
struct alpha_relax_info info;
- struct elf_link_tls_segment tls_segment;
/* We are not currently changing any sizes, so only one pass. */
- *again = false;
+ *again = FALSE;
- if (link_info->relocateable
+ if (link_info->relocatable
|| (sec->flags & SEC_RELOC) == 0
|| sec->reloc_count == 0)
- return true;
+ return TRUE;
/* If this is the first time we have been called for this section,
initialize the cooked size. */
@@ -2061,11 +1982,11 @@ elf64_alpha_relax_section (abfd, sec, link_info, again)
local_got_entries = alpha_elf_tdata(abfd)->local_got_entries;
/* Load the relocations for this section. */
- internal_relocs = (_bfd_elf64_link_read_relocs
+ 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;
+ return FALSE;
memset(&info, 0, sizeof (info));
info.abfd = abfd;
@@ -2100,16 +2021,12 @@ elf64_alpha_relax_section (abfd, sec, link_info, again)
goto error_return;
}
- /* Compute the TLS segment information. The version normally found in
- elf_hash_table (link_info)->tls_segment isn't built until final_link.
- ??? Probably should look into extracting this into a common function. */
- info.tls_segment = elf64_alpha_relax_find_tls_segment (&info, &tls_segment);
-
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)
@@ -2120,14 +2037,20 @@ elf64_alpha_relax_section (abfd, sec, link_info, again)
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 (ELF64_R_SYM (irel->r_info) < symtab_hdr->sh_info)
+ if (r_symndx < symtab_hdr->sh_info)
{
/* A local symbol. */
Elf_Internal_Sym *isym;
@@ -2144,27 +2067,44 @@ elf64_alpha_relax_section (abfd, sec, link_info, again)
goto error_return;
}
- isym = isymbuf + ELF64_R_SYM (irel->r_info);
- 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;
+ 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
- info.tsec = bfd_section_from_elf_index (abfd, isym->st_shndx);
+ {
+ 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;
- info.first_gotent = &local_got_entries[ELF64_R_SYM(irel->r_info)];
- symval = isym->st_value;
+ 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 = ELF64_R_SYM (irel->r_info) - symtab_hdr->sh_info;
+ indx = r_symndx - symtab_hdr->sh_info;
h = alpha_elf_sym_hashes (abfd)[indx];
BFD_ASSERT (h != NULL);
@@ -2180,13 +2120,23 @@ elf64_alpha_relax_section (abfd, sec, link_info, again)
/* 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))
- continue;
+ {
+ /* 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.tsec = h->root.root.u.def.section;
info.other = h->root.other;
info.first_gotent = &h->got_entries;
- symval = h->root.root.u.def.value;
}
/* Search for the got entry to be used by this relocation. */
@@ -2246,11 +2196,11 @@ elf64_alpha_relax_section (abfd, sec, link_info, again)
}
if (!elf64_alpha_size_plt_section (link_info))
- return false;
+ return FALSE;
if (!elf64_alpha_size_got_sections (link_info))
- return false;
+ return FALSE;
if (!elf64_alpha_size_rela_got_section (link_info))
- return false;
+ return FALSE;
if (isymbuf != NULL
&& symtab_hdr->contents != (unsigned char *) isymbuf)
@@ -2286,7 +2236,7 @@ elf64_alpha_relax_section (abfd, sec, link_info, again)
*again = info.changed_contents || info.changed_relocs;
- return true;
+ return TRUE;
error_return:
if (isymbuf != NULL
@@ -2298,7 +2248,7 @@ elf64_alpha_relax_section (abfd, sec, link_info, again)
if (internal_relocs != NULL
&& elf_section_data (sec)->relocs != internal_relocs)
free (internal_relocs);
- return false;
+ return FALSE;
}
/* PLT/GOT Stuff */
@@ -2322,10 +2272,10 @@ elf64_alpha_relax_section (abfd, sec, link_info, again)
FIXME: We need to handle the SHF_ALPHA_GPREL flag, but I'm not sure
how to. */
-static boolean
+static bfd_boolean
elf64_alpha_section_from_shdr (abfd, hdr, name)
bfd *abfd;
- Elf64_Internal_Shdr *hdr;
+ Elf_Internal_Shdr *hdr;
const char *name;
{
asection *newsect;
@@ -2339,14 +2289,14 @@ elf64_alpha_section_from_shdr (abfd, hdr, name)
{
case SHT_ALPHA_DEBUG:
if (strcmp (name, ".mdebug") != 0)
- return false;
+ return FALSE;
break;
default:
- return false;
+ return FALSE;
}
if (! _bfd_elf_make_section_from_shdr (abfd, hdr, name))
- return false;
+ return FALSE;
newsect = hdr->bfd_section;
if (hdr->sh_type == SHT_ALPHA_DEBUG)
@@ -2354,32 +2304,32 @@ elf64_alpha_section_from_shdr (abfd, hdr, name)
if (! bfd_set_section_flags (abfd, newsect,
(bfd_get_section_flags (abfd, newsect)
| SEC_DEBUGGING)))
- return false;
+ return FALSE;
}
- return true;
+ return TRUE;
}
/* Convert Alpha specific section flags to bfd internal section flags. */
-static boolean
+static bfd_boolean
elf64_alpha_section_flags (flags, hdr)
flagword *flags;
- Elf64_Internal_Shdr *hdr;
+ Elf_Internal_Shdr *hdr;
{
if (hdr->sh_flags & SHF_ALPHA_GPREL)
*flags |= SEC_SMALL_DATA;
- return true;
+ return TRUE;
}
/* Set the correct type for an Alpha ELF section. We do this by the
section name, which is a hack, but ought to work. */
-static boolean
+static bfd_boolean
elf64_alpha_fake_sections (abfd, hdr, sec)
bfd *abfd;
- Elf64_Internal_Shdr *hdr;
+ Elf_Internal_Shdr *hdr;
asection *sec;
{
register const char *name;
@@ -2403,24 +2353,24 @@ elf64_alpha_fake_sections (abfd, hdr, sec)
|| strcmp (name, ".lit8") == 0)
hdr->sh_flags |= SHF_ALPHA_GPREL;
- return true;
+ return TRUE;
}
/* Hook called by the linker routine which adds symbols from an object
file. We use it to put .comm items in .sbss, and not .bss. */
-static boolean
+static bfd_boolean
elf64_alpha_add_symbol_hook (abfd, info, sym, namep, flagsp, secp, valp)
bfd *abfd;
struct bfd_link_info *info;
- const Elf_Internal_Sym *sym;
+ 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->relocateable
+ && !info->relocatable
&& sym->st_size <= elf_gp_size (abfd))
{
/* Common symbols less than or equal to -G nn bytes are
@@ -2435,27 +2385,32 @@ elf64_alpha_add_symbol_hook (abfd, info, sym, namep, flagsp, secp, valp)
|| !bfd_set_section_flags (abfd, scomm, (SEC_ALLOC
| SEC_IS_COMMON
| SEC_LINKER_CREATED)))
- return false;
+ return FALSE;
}
*secp = scomm;
*valp = sym->st_size;
}
- return true;
+ return TRUE;
}
/* Create the .got section. */
-static boolean
+static bfd_boolean
elf64_alpha_create_got_section(abfd, info)
bfd *abfd;
struct bfd_link_info *info ATTRIBUTE_UNUSED;
{
asection *s;
- if (bfd_get_section_by_name (abfd, ".got"))
- return true;
+ if ((s = bfd_get_section_by_name (abfd, ".got")))
+ {
+ /* Check for a non-linker created .got? */
+ if (alpha_elf_tdata (abfd)->got == NULL)
+ alpha_elf_tdata (abfd)->got = s;
+ return TRUE;
+ }
s = bfd_make_section (abfd, ".got");
if (s == NULL
@@ -2464,16 +2419,16 @@ elf64_alpha_create_got_section(abfd, info)
| SEC_IN_MEMORY
| SEC_LINKER_CREATED))
|| !bfd_set_section_alignment (abfd, s, 3))
- return false;
+ return FALSE;
alpha_elf_tdata (abfd)->got = s;
- return true;
+ return TRUE;
}
/* Create all the dynamic sections. */
-static boolean
+static bfd_boolean
elf64_alpha_create_dynamic_sections (abfd, info)
bfd *abfd;
struct bfd_link_info *info;
@@ -2492,23 +2447,23 @@ elf64_alpha_create_dynamic_sections (abfd, info)
| SEC_LINKER_CREATED
| SEC_CODE))
|| ! bfd_set_section_alignment (abfd, s, 3))
- return false;
+ 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,
+ (bfd_vma) 0, (const char *) NULL, FALSE,
get_elf_backend_data (abfd)->collect, &bh)))
- return false;
+ 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;
+ && ! bfd_elf_link_record_dynamic_symbol (info, h))
+ return FALSE;
s = bfd_make_section (abfd, ".rela.plt");
if (s == NULL
@@ -2518,13 +2473,13 @@ elf64_alpha_create_dynamic_sections (abfd, info)
| SEC_LINKER_CREATED
| SEC_READONLY))
|| ! bfd_set_section_alignment (abfd, s, 3))
- return false;
+ 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;
+ return FALSE;
s = bfd_make_section(abfd, ".rela.got");
if (s == NULL
@@ -2534,7 +2489,7 @@ elf64_alpha_create_dynamic_sections (abfd, info)
| SEC_LINKER_CREATED
| SEC_READONLY))
|| !bfd_set_section_alignment (abfd, s, 3))
- return false;
+ return FALSE;
/* Define the symbol _GLOBAL_OFFSET_TABLE_ at the start of the
dynobj's .got section. We don't do this in the linker script
@@ -2544,25 +2499,25 @@ elf64_alpha_create_dynamic_sections (abfd, info)
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;
+ 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;
+ && ! bfd_elf_link_record_dynamic_symbol (info, h))
+ return FALSE;
elf_hash_table (info)->hgot = h;
- return true;
+ return TRUE;
}
/* Read ECOFF debugging information from a .mdebug section into a
ecoff_debug_info structure. */
-static boolean
+static bfd_boolean
elf64_alpha_read_ecoff_info (abfd, section, debug)
bfd *abfd;
asection *section;
@@ -2619,7 +2574,7 @@ elf64_alpha_read_ecoff_info (abfd, section, debug)
debug->fdr = NULL;
debug->adjust = NULL;
- return true;
+ return TRUE;
error_return:
if (ext_hdr != NULL)
@@ -2646,12 +2601,12 @@ elf64_alpha_read_ecoff_info (abfd, section, debug)
free (debug->external_rfd);
if (debug->external_ext != NULL)
free (debug->external_ext);
- return false;
+ return FALSE;
}
/* Alpha ELF local labels start with '$'. */
-static boolean
+static bfd_boolean
elf64_alpha_is_local_label_name (abfd, name)
bfd *abfd ATTRIBUTE_UNUSED;
const char *name;
@@ -2670,7 +2625,7 @@ struct mips_elf_find_line
struct ecoff_find_line i;
};
-static boolean
+static bfd_boolean
elf64_alpha_find_nearest_line (abfd, section, symbols, offset, filename_ptr,
functionname_ptr, line_ptr)
bfd *abfd;
@@ -2687,7 +2642,7 @@ elf64_alpha_find_nearest_line (abfd, section, symbols, offset, filename_ptr,
filename_ptr, functionname_ptr,
line_ptr, 0,
&elf_tdata (abfd)->dwarf2_find_line_info))
- return true;
+ return TRUE;
msec = bfd_get_section_by_name (abfd, ".mdebug");
if (msec != NULL)
@@ -2717,13 +2672,13 @@ elf64_alpha_find_nearest_line (abfd, section, symbols, offset, filename_ptr,
if (fi == NULL)
{
msec->flags = origflags;
- return false;
+ return FALSE;
}
if (!elf64_alpha_read_ecoff_info (abfd, msec, &fi->d))
{
msec->flags = origflags;
- return false;
+ return FALSE;
}
/* Swap in the FDR information. */
@@ -2732,7 +2687,7 @@ elf64_alpha_find_nearest_line (abfd, section, symbols, offset, filename_ptr,
if (fi->d.fdr == NULL)
{
msec->flags = origflags;
- return false;
+ return FALSE;
}
external_fdr_size = swap->external_fdr_size;
fdr_ptr = fi->d.fdr;
@@ -2757,7 +2712,7 @@ elf64_alpha_find_nearest_line (abfd, section, symbols, offset, filename_ptr,
line_ptr))
{
msec->flags = origflags;
- return true;
+ return TRUE;
}
msec->flags = origflags;
@@ -2778,39 +2733,39 @@ struct extsym_info
struct bfd_link_info *info;
struct ecoff_debug_info *debug;
const struct ecoff_debug_swap *swap;
- boolean failed;
+ bfd_boolean failed;
};
-static boolean
+static bfd_boolean
elf64_alpha_output_extsym (h, data)
struct alpha_elf_link_hash_entry *h;
PTR data;
{
struct extsym_info *einfo = (struct extsym_info *) data;
- boolean strip;
+ bfd_boolean strip;
asection *sec, *output_section;
if (h->root.root.type == bfd_link_hash_warning)
h = (struct alpha_elf_link_hash_entry *) h->root.root.u.i.link;
if (h->root.indx == -2)
- strip = false;
+ strip = FALSE;
else if (((h->root.elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) != 0
|| (h->root.elf_link_hash_flags & ELF_LINK_HASH_REF_DYNAMIC) != 0)
&& (h->root.elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0
&& (h->root.elf_link_hash_flags & ELF_LINK_HASH_REF_REGULAR) == 0)
- strip = true;
+ strip = TRUE;
else if (einfo->info->strip == strip_all
|| (einfo->info->strip == strip_some
&& bfd_hash_lookup (einfo->info->keep_hash,
h->root.root.root.string,
- false, false) == NULL))
- strip = true;
+ FALSE, FALSE) == NULL))
+ strip = TRUE;
else
- strip = false;
+ strip = FALSE;
if (strip)
- return true;
+ return TRUE;
if (h->esym.ifd == -2)
{
@@ -2908,11 +2863,11 @@ elf64_alpha_output_extsym (h, data)
h->root.root.root.string,
&h->esym))
{
- einfo->failed = true;
- return false;
+ einfo->failed = TRUE;
+ return FALSE;
}
- return true;
+ return TRUE;
}
/* Search for and possibly create a got entry. */
@@ -2996,7 +2951,7 @@ get_got_entry (abfd, h, r_type, r_symndx, r_addend)
/* Handle dynamic relocations when doing an Alpha ELF link. */
-static boolean
+static bfd_boolean
elf64_alpha_check_relocs (abfd, info, sec, relocs)
bfd *abfd;
struct bfd_link_info *info;
@@ -3009,11 +2964,11 @@ 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;
- boolean got_created;
+ bfd_boolean got_created;
bfd_size_type amt;
- if (info->relocateable)
- return true;
+ if (info->relocatable)
+ return TRUE;
dynobj = elf_hash_table(info)->dynobj;
if (dynobj == NULL)
@@ -3023,7 +2978,7 @@ 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;
+ got_created = FALSE;
relend = relocs + sec->reloc_count;
for (rel = relocs; rel < relend; ++rel)
@@ -3037,7 +2992,7 @@ elf64_alpha_check_relocs (abfd, info, sec, relocs)
unsigned long r_symndx, r_type;
struct alpha_elf_link_hash_entry *h;
unsigned int gotent_flags;
- boolean maybe_dynamic;
+ bfd_boolean maybe_dynamic;
unsigned int need;
bfd_vma addend;
@@ -3059,12 +3014,12 @@ elf64_alpha_check_relocs (abfd, info, sec, relocs)
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;
+ maybe_dynamic = FALSE;
if (h && ((info->shared
- && (!info->symbolic || info->allow_shlib_undefined))
+ && (!info->symbolic || info->unresolved_syms_in_shared_libs == RM_IGNORE))
|| ! (h->root.elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR)
|| h->root.root.type == bfd_link_hash_defweak))
- maybe_dynamic = true;
+ maybe_dynamic = TRUE;
need = 0;
gotent_flags = 0;
@@ -3104,8 +3059,15 @@ elf64_alpha_check_relocs (abfd, info, sec, relocs)
need = NEED_DYNREL;
break;
- case R_ALPHA_TLSGD:
case R_ALPHA_TLSLDM:
+ /* The symbol for a TLSLDM reloc is ignored. Collapse the
+ reloc to the 0 symbol so that they all match. */
+ r_symndx = 0;
+ h = 0;
+ maybe_dynamic = FALSE;
+ /* FALLTHRU */
+
+ case R_ALPHA_TLSGD:
case R_ALPHA_GOTDTPREL:
need = NEED_GOT | NEED_GOT_ENTRY;
break;
@@ -3130,7 +3092,7 @@ elf64_alpha_check_relocs (abfd, info, sec, relocs)
if (!got_created)
{
if (!elf64_alpha_create_got_section (abfd, info))
- return false;
+ return FALSE;
/* Make sure the object's gotobj is set to itself so
that we default to every object with its own .got.
@@ -3148,7 +3110,7 @@ elf64_alpha_check_relocs (abfd, info, sec, relocs)
gotent = get_got_entry (abfd, h, r_type, r_symndx, addend);
if (!gotent)
- return false;
+ return FALSE;
if (gotent_flags)
{
@@ -3176,7 +3138,7 @@ elf64_alpha_check_relocs (abfd, info, sec, relocs)
(abfd, elf_elfheader(abfd)->e_shstrndx,
elf_section_data(sec)->rel_hdr.sh_name));
if (rel_sec_name == NULL)
- return false;
+ return FALSE;
BFD_ASSERT (strncmp (rel_sec_name, ".rela", 5) == 0
&& strcmp (bfd_get_section_name (abfd, sec),
@@ -3202,7 +3164,7 @@ elf64_alpha_check_relocs (abfd, info, sec, relocs)
if (sreloc == NULL
|| !bfd_set_section_flags (dynobj, sreloc, flags)
|| !bfd_set_section_alignment (dynobj, sreloc, 3))
- return false;
+ return FALSE;
}
}
@@ -3225,7 +3187,7 @@ elf64_alpha_check_relocs (abfd, info, sec, relocs)
amt = sizeof (struct alpha_elf_reloc_entry);
rent = (struct alpha_elf_reloc_entry *) bfd_alloc (abfd, amt);
if (!rent)
- return false;
+ return FALSE;
rent->srel = sreloc;
rent->rtype = r_type;
@@ -3251,7 +3213,7 @@ elf64_alpha_check_relocs (abfd, info, sec, relocs)
}
}
- return true;
+ return TRUE;
}
/* Adjust a symbol defined by a dynamic object and referenced by a
@@ -3260,7 +3222,7 @@ elf64_alpha_check_relocs (abfd, info, sec, relocs)
change the definition to something the rest of the link can
understand. */
-static boolean
+static bfd_boolean
elf64_alpha_adjust_dynamic_symbol (info, h)
struct bfd_link_info *info;
struct elf_link_hash_entry *h;
@@ -3291,7 +3253,7 @@ elf64_alpha_adjust_dynamic_symbol (info, h)
s = bfd_get_section_by_name(dynobj, ".plt");
if (!s && !elf64_alpha_create_dynamic_sections (dynobj, info))
- return false;
+ return FALSE;
/* The first bit of the .plt is reserved. */
if (s->_raw_size == 0)
@@ -3307,6 +3269,9 @@ elf64_alpha_adjust_dynamic_symbol (info, h)
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;
}
@@ -3316,7 +3281,7 @@ elf64_alpha_adjust_dynamic_symbol (info, h)
BFD_ASSERT (s != NULL);
s->_raw_size += sizeof (Elf64_External_Rela);
- return true;
+ return TRUE;
}
else
h->elf_link_hash_flags &= ~ELF_LINK_HASH_NEEDS_PLT;
@@ -3330,7 +3295,7 @@ elf64_alpha_adjust_dynamic_symbol (info, h)
|| 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;
+ return TRUE;
}
/* This is a reference to a symbol defined by a dynamic object which
@@ -3338,14 +3303,14 @@ elf64_alpha_adjust_dynamic_symbol (info, h)
symbols even in regular objects, does not need the hackery of a
.dynbss section and COPY dynamic relocations. */
- return true;
+ return TRUE;
}
/* Symbol versioning can create new symbols, and make our old symbols
indirect to the new ones. Consolidate the got and reloc information
in these situations. */
-static boolean
+static bfd_boolean
elf64_alpha_merge_ind_symbols (hi, dummy)
struct alpha_elf_link_hash_entry *hi;
PTR dummy ATTRIBUTE_UNUSED;
@@ -3353,7 +3318,7 @@ elf64_alpha_merge_ind_symbols (hi, dummy)
struct alpha_elf_link_hash_entry *hs;
if (hi->root.root.type != bfd_link_hash_indirect)
- return true;
+ return TRUE;
hs = hi;
do {
hs = (struct alpha_elf_link_hash_entry *)hs->root.root.u.i.link;
@@ -3416,12 +3381,12 @@ elf64_alpha_merge_ind_symbols (hi, dummy)
}
hi->reloc_entries = NULL;
- return true;
+ return TRUE;
}
/* Is it possible to merge two object file's .got tables? */
-static boolean
+static bfd_boolean
elf64_alpha_can_merge_gots (a, b)
bfd *a, *b;
{
@@ -3430,11 +3395,11 @@ elf64_alpha_can_merge_gots (a, b)
/* Trivial quick fallout test. */
if (total + alpha_elf_tdata (b)->total_got_size <= MAX_GOT_SIZE)
- return true;
+ return TRUE;
/* By their nature, local .got entries cannot be merged. */
if ((total += alpha_elf_tdata (b)->local_got_size) > MAX_GOT_SIZE)
- return false;
+ return FALSE;
/* Failing the common trivial comparison, we must effectively
perform the merge. Not actually performing the merge means that
@@ -3471,13 +3436,13 @@ elf64_alpha_can_merge_gots (a, b)
total += alpha_got_entry_size (be->reloc_type);
if (total > MAX_GOT_SIZE)
- return false;
+ return FALSE;
global_found:;
}
}
}
- return true;
+ return TRUE;
}
/* Actually merge two .got tables. */
@@ -3577,11 +3542,12 @@ elf64_alpha_merge_gots (a, b)
/* Calculate the offsets for the got entries. */
-static boolean
+static bfd_boolean
elf64_alpha_calc_got_offsets_for_symbol (h, arg)
struct alpha_elf_link_hash_entry *h;
PTR arg ATTRIBUTE_UNUSED;
{
+ bfd_boolean result = TRUE;
struct alpha_elf_got_entry *gotent;
if (h->root.root.type == bfd_link_hash_warning)
@@ -3590,14 +3556,23 @@ elf64_alpha_calc_got_offsets_for_symbol (h, arg)
for (gotent = h->got_entries; gotent; gotent = gotent->next)
if (gotent->use_count > 0)
{
- bfd_size_type *plge
- = &alpha_elf_tdata (gotent->gotobj)->got->_raw_size;
+ struct alpha_elf_obj_tdata *td;
+ bfd_size_type *plge;
+ td = alpha_elf_tdata (gotent->gotobj);
+ if (td == NULL)
+ {
+ _bfd_error_handler (_("Symbol %s has no GOT subsection for offset 0x%x"),
+ h->root.root.root.string, gotent->got_offset);
+ result = FALSE;
+ continue;
+ }
+ plge = &td->got->_raw_size;
gotent->got_offset = *plge;
*plge += alpha_got_entry_size (gotent->reloc_type);
}
- return true;
+ return result;
}
static void
@@ -3647,7 +3622,7 @@ elf64_alpha_calc_got_offsets (info)
/* Constructs the gots. */
-static boolean
+static bfd_boolean
elf64_alpha_size_got_sections (info)
struct bfd_link_info *info;
{
@@ -3666,7 +3641,7 @@ elf64_alpha_size_got_sections (info)
if (this_got == NULL)
continue;
- /* We are assuming no merging has yet ocurred. */
+ /* We are assuming no merging has yet occurred. */
BFD_ASSERT (this_got == i);
if (alpha_elf_tdata (this_got)->total_got_size > MAX_GOT_SIZE)
@@ -3676,7 +3651,7 @@ elf64_alpha_size_got_sections (info)
(_("%s: .got subsegment exceeds 64K (size %d)"),
bfd_archive_filename (i),
alpha_elf_tdata (this_got)->total_got_size);
- return false;
+ return FALSE;
}
if (got_list == NULL)
@@ -3688,7 +3663,7 @@ elf64_alpha_size_got_sections (info)
/* Strange degenerate case of no got references. */
if (got_list == NULL)
- return true;
+ return TRUE;
alpha_elf_hash_table (info)->got_list = got_list;
@@ -3719,13 +3694,13 @@ elf64_alpha_size_got_sections (info)
if (1 || something_changed)
elf64_alpha_calc_got_offsets (info);
- return true;
+ return TRUE;
}
/* Called from relax_section to rebuild the PLT in light of
potential changes in the function's status. */
-static boolean
+static bfd_boolean
elf64_alpha_size_plt_section (info)
struct bfd_link_info *info;
{
@@ -3736,7 +3711,7 @@ elf64_alpha_size_plt_section (info)
dynobj = elf_hash_table(info)->dynobj;
splt = bfd_get_section_by_name(dynobj, ".plt");
if (splt == NULL)
- return true;
+ return TRUE;
splt->_raw_size = 0;
@@ -3754,10 +3729,10 @@ elf64_alpha_size_plt_section (info)
spltrel->_raw_size = entries * sizeof (Elf64_External_Rela);
spltrel->_cooked_size = spltrel->_raw_size;
- return true;
+ return TRUE;
}
-static boolean
+static bfd_boolean
elf64_alpha_size_plt_section_1 (h, data)
struct alpha_elf_link_hash_entry *h;
PTR data;
@@ -3767,7 +3742,7 @@ elf64_alpha_size_plt_section_1 (h, data)
/* 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;
+ return TRUE;
/* There must still be a LITERAL got entry for the function. */
for (gotent = h->got_entries; gotent ; gotent = gotent->next)
@@ -3788,20 +3763,28 @@ elf64_alpha_size_plt_section_1 (h, data)
{
h->root.elf_link_hash_flags &= ~ELF_LINK_HASH_NEEDS_PLT;
h->root.plt.offset = -1;
+
+ /* Undo the definition frobbing begun in adjust_dynamic_symbol. */
+ if (h->flags & ALPHA_ELF_LINK_HASH_PLT_LOC)
+ {
+ h->root.root.u.def.section = h->plt_old_section;
+ h->root.root.u.def.value = h->plt_old_value;
+ h->flags &= ~ALPHA_ELF_LINK_HASH_PLT_LOC;
+ }
}
- return true;
+ return TRUE;
}
-static boolean
+static bfd_boolean
elf64_alpha_always_size_sections (output_bfd, info)
bfd *output_bfd ATTRIBUTE_UNUSED;
struct bfd_link_info *info;
{
bfd *i;
- if (info->relocateable)
- return true;
+ if (info->relocatable)
+ return TRUE;
/* First, take care of the indirect symbols created by versioning. */
alpha_elf_link_hash_traverse (alpha_elf_hash_table (info),
@@ -3809,7 +3792,7 @@ elf64_alpha_always_size_sections (output_bfd, info)
NULL);
if (!elf64_alpha_size_got_sections (info))
- return false;
+ return FALSE;
/* Allocate space for all of the .got subsections. */
i = alpha_elf_hash_table (info)->got_list;
@@ -3820,11 +3803,11 @@ elf64_alpha_always_size_sections (output_bfd, info)
{
s->contents = (bfd_byte *) bfd_zalloc (i, s->_raw_size);
if (s->contents == NULL)
- return false;
+ return FALSE;
}
}
- return true;
+ return TRUE;
}
/* The number of dynamic relocations required by a static relocation. */
@@ -3841,18 +3824,16 @@ alpha_dynamic_entries_for_reloc (r_type, dynamic, shared)
case R_ALPHA_TLSLDM:
return shared;
case R_ALPHA_LITERAL:
+ case R_ALPHA_GOTTPREL:
return dynamic || shared;
case R_ALPHA_GOTDTPREL:
- case R_ALPHA_GOTTPREL:
return dynamic;
/* May appear in data sections. */
case R_ALPHA_REFLONG:
case R_ALPHA_REFQUAD:
- return dynamic || shared;
- case R_ALPHA_SREL64:
case R_ALPHA_TPREL64:
- return dynamic;
+ return dynamic || shared;
/* Everything else is illegal. We'll issue an error during
relocate_section. */
@@ -3863,12 +3844,12 @@ alpha_dynamic_entries_for_reloc (r_type, dynamic, shared)
/* Work out the sizes of the dynamic relocation entries. */
-static boolean
+static bfd_boolean
elf64_alpha_calc_dynrel_sizes (h, info)
struct alpha_elf_link_hash_entry *h;
struct bfd_link_info *info;
{
- boolean dynamic;
+ bfd_boolean dynamic;
struct alpha_elf_reloc_entry *relent;
unsigned long entries;
@@ -3911,12 +3892,12 @@ elf64_alpha_calc_dynrel_sizes (h, info)
}
}
- return true;
+ return TRUE;
}
/* Set the sizes of the dynamic relocation sections. */
-static boolean
+static bfd_boolean
elf64_alpha_size_rela_got_section (info)
struct bfd_link_info *info;
{
@@ -3956,7 +3937,7 @@ elf64_alpha_size_rela_got_section (info)
if (!srel)
{
BFD_ASSERT (entries == 0);
- return true;
+ return TRUE;
}
srel->_raw_size = sizeof (Elf64_External_Rela) * entries;
@@ -3966,18 +3947,18 @@ elf64_alpha_size_rela_got_section (info)
srel->_cooked_size = srel->_raw_size;
- return true;
+ return TRUE;
}
/* Subroutine of elf64_alpha_size_rela_got_section for doing the
global symbols. */
-static boolean
+static bfd_boolean
elf64_alpha_size_rela_got_1 (h, info)
struct alpha_elf_link_hash_entry *h;
struct bfd_link_info *info;
{
- boolean dynamic;
+ bfd_boolean dynamic;
struct alpha_elf_got_entry *gotent;
unsigned long entries;
@@ -4009,19 +3990,19 @@ elf64_alpha_size_rela_got_1 (h, info)
srel->_raw_size += sizeof (Elf64_External_Rela) * entries;
}
- return true;
+ return TRUE;
}
/* Set the sizes of the dynamic sections. */
-static boolean
+static bfd_boolean
elf64_alpha_size_dynamic_sections (output_bfd, info)
bfd *output_bfd ATTRIBUTE_UNUSED;
struct bfd_link_info *info;
{
bfd *dynobj;
asection *s;
- boolean relplt;
+ bfd_boolean relplt;
dynobj = elf_hash_table(info)->dynobj;
BFD_ASSERT(dynobj != NULL);
@@ -4029,7 +4010,7 @@ elf64_alpha_size_dynamic_sections (output_bfd, info)
if (elf_hash_table (info)->dynamic_sections_created)
{
/* Set the contents of the .interp section to the interpreter. */
- if (!info->shared)
+ if (info->executable)
{
s = bfd_get_section_by_name (dynobj, ".interp");
BFD_ASSERT (s != NULL);
@@ -4051,11 +4032,11 @@ elf64_alpha_size_dynamic_sections (output_bfd, info)
/* The check_relocs and adjust_dynamic_symbol entry points have
determined the sizes of the various dynamic sections. Allocate
memory for them. */
- relplt = false;
+ relplt = FALSE;
for (s = dynobj->sections; s != NULL; s = s->next)
{
const char *name;
- boolean strip;
+ bfd_boolean strip;
if (!(s->flags & SEC_LINKER_CREATED))
continue;
@@ -4072,7 +4053,7 @@ elf64_alpha_size_dynamic_sections (output_bfd, info)
it is that function which decides whether anything needs to
go into these sections. */
- strip = false;
+ strip = FALSE;
if (strncmp (name, ".rela", 5) == 0)
{
@@ -4081,7 +4062,7 @@ elf64_alpha_size_dynamic_sections (output_bfd, info)
if (!strip)
{
if (strcmp(name, ".rela.plt") == 0)
- relplt = true;
+ relplt = TRUE;
/* We use the reloc_count field as a counter if we need
to copy relocs into the output file. */
@@ -4101,7 +4082,7 @@ elf64_alpha_size_dynamic_sections (output_bfd, info)
/* 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;
+ return FALSE;
}
}
@@ -4113,12 +4094,12 @@ elf64_alpha_size_dynamic_sections (output_bfd, info)
the .dynamic section. The DT_DEBUG entry is filled in by the
dynamic linker and used by the debugger. */
#define add_dynamic_entry(TAG, VAL) \
- bfd_elf64_add_dynamic_entry (info, (bfd_vma) (TAG), (bfd_vma) (VAL))
+ _bfd_elf_add_dynamic_entry (info, TAG, VAL)
- if (!info->shared)
+ if (info->executable)
{
if (!add_dynamic_entry (DT_DEBUG, 0))
- return false;
+ return FALSE;
}
if (relplt)
@@ -4127,23 +4108,55 @@ elf64_alpha_size_dynamic_sections (output_bfd, info)
|| !add_dynamic_entry (DT_PLTRELSZ, 0)
|| !add_dynamic_entry (DT_PLTREL, DT_RELA)
|| !add_dynamic_entry (DT_JMPREL, 0))
- return false;
+ 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;
+ return FALSE;
if (info->flags & DF_TEXTREL)
{
if (!add_dynamic_entry (DT_TEXTREL, 0))
- return false;
+ return FALSE;
}
}
#undef add_dynamic_entry
- return true;
+ return TRUE;
+}
+
+/* Emit a dynamic relocation for (DYNINDX, RTYPE, ADDEND) at (SEC, OFFSET)
+ into the next available slot in SREL. */
+
+static void
+elf64_alpha_emit_dynrel (abfd, info, sec, srel, offset, dynindx, rtype, addend)
+ bfd *abfd;
+ struct bfd_link_info *info;
+ asection *sec, *srel;
+ bfd_vma offset, addend;
+ long dynindx, rtype;
+{
+ Elf_Internal_Rela outrel;
+ bfd_byte *loc;
+
+ BFD_ASSERT (srel != NULL);
+
+ outrel.r_info = ELF64_R_INFO (dynindx, rtype);
+ outrel.r_addend = addend;
+
+ offset = _bfd_elf_section_offset (abfd, info, sec, offset);
+ if ((offset | 1) != (bfd_vma) -1)
+ outrel.r_offset = sec->output_section->vma + sec->output_offset + offset;
+ else
+ memset (&outrel, 0, sizeof (outrel));
+
+ loc = srel->contents;
+ loc += srel->reloc_count++ * sizeof (Elf64_External_Rela);
+ bfd_elf64_swap_reloca_out (abfd, &outrel, loc);
+ BFD_ASSERT (sizeof (Elf64_External_Rela) * srel->reloc_count
+ <= srel->_cooked_size);
}
/* Relocate an Alpha ELF section for a relocatable link.
@@ -4152,7 +4165,7 @@ elf64_alpha_size_dynamic_sections (output_bfd, info)
symbol, in which case we have to adjust according to where the section
symbol winds up in the output section. */
-static boolean
+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;
@@ -4167,7 +4180,7 @@ elf64_alpha_relocate_section_r (output_bfd, info, input_bfd, input_section,
unsigned long symtab_hdr_sh_info;
Elf_Internal_Rela *rel;
Elf_Internal_Rela *relend;
- boolean ret_val = true;
+ bfd_boolean ret_val = TRUE;
symtab_hdr_sh_info = elf_tdata (input_bfd)->symtab_hdr.sh_info;
@@ -4186,7 +4199,7 @@ elf64_alpha_relocate_section_r (output_bfd, info, input_bfd, input_section,
(_("%s: unknown relocation type %d"),
bfd_archive_filename (input_bfd), (int)r_type);
bfd_set_error (bfd_error_bad_value);
- ret_val = false;
+ ret_val = FALSE;
continue;
}
@@ -4213,7 +4226,7 @@ elf64_alpha_relocate_section_r (output_bfd, info, input_bfd, input_section,
/* Relocate an Alpha ELF section. */
-static boolean
+static bfd_boolean
elf64_alpha_relocate_section (output_bfd, info, input_bfd, input_section,
contents, relocs, local_syms, local_sections)
bfd *output_bfd;
@@ -4228,23 +4241,22 @@ elf64_alpha_relocate_section (output_bfd, info, input_bfd, input_section,
Elf_Internal_Shdr *symtab_hdr;
Elf_Internal_Rela *rel;
Elf_Internal_Rela *relend;
- struct elf_link_tls_segment *tls_segment;
asection *sgot, *srel, *srelgot;
bfd *dynobj, *gotobj;
bfd_vma gp, tp_base, dtp_base;
struct alpha_elf_got_entry **local_got_entries;
- boolean ret_val;
+ bfd_boolean ret_val;
const char *section_name;
/* Handle relocatable links with a smaller loop. */
- if (info->relocateable)
+ if (info->relocatable)
return elf64_alpha_relocate_section_r (output_bfd, info, input_bfd,
input_section, contents, relocs,
local_syms, local_sections);
/* This is a final link. */
- ret_val = true;
+ ret_val = TRUE;
symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr;
@@ -4282,11 +4294,10 @@ elf64_alpha_relocate_section (output_bfd, info, input_bfd, input_section,
local_got_entries = alpha_elf_tdata(input_bfd)->local_got_entries;
- tls_segment = elf_hash_table (info)->tls_segment;
- if (tls_segment)
+ if (elf_hash_table (info)->tls_sec != NULL)
{
- dtp_base = alpha_get_dtprel_base (tls_segment);
- tp_base = alpha_get_tprel_base (tls_segment);
+ dtp_base = alpha_get_dtprel_base (info);
+ tp_base = alpha_get_tprel_base (info);
}
else
dtp_base = tp_base = 0;
@@ -4303,8 +4314,8 @@ elf64_alpha_relocate_section (output_bfd, info, input_bfd, input_section,
asection *sec = NULL;
bfd_vma value;
bfd_vma addend;
- boolean dynamic_symbol_p;
- boolean undef_weak_ref = false;
+ bfd_boolean dynamic_symbol_p;
+ bfd_boolean undef_weak_ref = FALSE;
unsigned long r_type;
r_type = ELF64_R_TYPE(rel->r_info);
@@ -4314,18 +4325,37 @@ elf64_alpha_relocate_section (output_bfd, info, input_bfd, input_section,
(_("%s: unknown relocation type %d"),
bfd_archive_filename (input_bfd), (int)r_type);
bfd_set_error (bfd_error_bad_value);
- ret_val = false;
+ ret_val = FALSE;
continue;
}
howto = elf64_alpha_howto_table + r_type;
r_symndx = ELF64_R_SYM(rel->r_info);
+ /* The symbol for a TLSLDM reloc is ignored. Collapse the
+ reloc to the 0 symbol so that they all match. */
+ if (r_type == R_ALPHA_TLSLDM)
+ r_symndx = 0;
+
if (r_symndx < symtab_hdr->sh_info)
{
+ asection *msec;
sym = local_syms + r_symndx;
sec = local_sections[r_symndx];
- value = _bfd_elf_rela_local_sym (output_bfd, sym, sec, rel);
+ msec = sec;
+ value = _bfd_elf_rela_local_sym (output_bfd, sym, &msec, rel);
+
+ /* If this is a tp-relative relocation against sym 0,
+ this is hackery from relax_section. Force the value to
+ be the tls base. */
+ if (r_symndx == 0
+ && (r_type == R_ALPHA_TLSLDM
+ || r_type == R_ALPHA_GOTTPREL
+ || r_type == R_ALPHA_TPREL64
+ || r_type == R_ALPHA_TPRELHI
+ || r_type == R_ALPHA_TPRELLO
+ || r_type == R_ALPHA_TPREL16))
+ value = tp_base;
if (local_got_entries)
gotent = local_got_entries[r_symndx];
@@ -4336,13 +4366,11 @@ elf64_alpha_relocate_section (output_bfd, info, input_bfd, input_section,
unless it has been done already. */
if ((sec->flags & SEC_MERGE)
&& ELF_ST_TYPE (sym->st_info) == STT_SECTION
- && (elf_section_data (sec)->sec_info_type
- == ELF_INFO_TYPE_MERGE)
+ && sec->sec_info_type == ELF_INFO_TYPE_MERGE
&& gotent
&& !gotent->reloc_xlated)
{
struct alpha_elf_got_entry *ent;
- asection *msec;
for (ent = gotent; ent; ent = ent->next)
{
@@ -4364,54 +4392,29 @@ elf64_alpha_relocate_section (output_bfd, info, input_bfd, input_section,
}
}
- dynamic_symbol_p = false;
+ dynamic_symbol_p = FALSE;
}
else
{
- h = alpha_elf_sym_hashes (input_bfd)[r_symndx - symtab_hdr->sh_info];
+ bfd_boolean warned;
+ bfd_boolean unresolved_reloc;
+ struct elf_link_hash_entry *hh;
+ struct elf_link_hash_entry **sym_hashes = elf_sym_hashes (input_bfd);
- 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;
+ RELOC_FOR_GLOBAL_SYMBOL (info, input_bfd, input_section, rel,
+ r_symndx, symtab_hdr, sym_hashes,
+ hh, sec, value,
+ unresolved_reloc, warned);
- value = 0;
- if (h->root.root.type == bfd_link_hash_defined
- || h->root.root.type == bfd_link_hash_defweak)
- {
- sec = h->root.root.u.def.section;
-
- /* Detect the cases that sym_sec->output_section is
- expected to be NULL -- all cases in which the symbol
- is defined in another shared module. This includes
- PLT relocs for which we've created a PLT entry and
- other relocs for which we're prepared to create
- dynamic relocations. */
- /* ??? Just accept it NULL and continue. */
-
- if (sec->output_section != NULL)
- value = (h->root.root.u.def.value
- + sec->output_section->vma
- + sec->output_offset);
- }
- else if (h->root.root.type == bfd_link_hash_undefweak)
- undef_weak_ref = true;
- else if (info->shared
- && (!info->symbolic || info->allow_shlib_undefined)
- && !info->no_undefined
- && ELF_ST_VISIBILITY (h->root.other) == STV_DEFAULT)
- ;
- else
- {
- if (!((*info->callbacks->undefined_symbol)
- (info, h->root.root.root.string, input_bfd,
- input_section, rel->r_offset,
- (!info->shared || info->no_undefined
- || ELF_ST_VISIBILITY (h->root.other)))))
- return false;
- ret_val = false;
- continue;
- }
+ if (warned)
+ continue;
+
+ if (value == 0
+ && ! unresolved_reloc
+ && hh->root.type == bfd_link_hash_undefweak)
+ undef_weak_ref = TRUE;
+ h = (struct alpha_elf_link_hash_entry *) hh;
dynamic_symbol_p = alpha_elf_dynamic_symbol_p (&h->root, info);
gotent = h->got_entries;
}
@@ -4463,25 +4466,9 @@ elf64_alpha_relocate_section (output_bfd, info, input_bfd, input_section,
RELATIVE reloc, otherwise it will be handled in
finish_dynamic_symbol. */
if (info->shared && !dynamic_symbol_p)
- {
- Elf_Internal_Rela outrel;
-
- BFD_ASSERT(srelgot != NULL);
-
- outrel.r_offset = (sgot->output_section->vma
- + sgot->output_offset
- + gotent->got_offset);
- outrel.r_info = ELF64_R_INFO (0, R_ALPHA_RELATIVE);
- outrel.r_addend = value;
-
- bfd_elf64_swap_reloca_out (output_bfd, &outrel,
- ((Elf64_External_Rela *)
- srelgot->contents)
- + srelgot->reloc_count++);
- BFD_ASSERT (sizeof (Elf64_External_Rela)
- * srelgot->reloc_count
- <= srelgot->_cooked_size);
- }
+ elf64_alpha_emit_dynrel (output_bfd, info, sgot, srelgot,
+ gotent->got_offset, 0,
+ R_ALPHA_RELATIVE, value);
}
value = (sgot->output_section->vma
@@ -4490,15 +4477,27 @@ elf64_alpha_relocate_section (output_bfd, info, input_bfd, input_section,
value -= gp;
goto default_reloc;
- case R_ALPHA_GPREL16:
case R_ALPHA_GPREL32:
+ /* If the target section was a removed linkonce section,
+ r_symndx will be zero. In this case, assume that the
+ switch will not be used, so don't fill it in. If we
+ do nothing here, we'll get relocation truncated messages,
+ due to the placement of the application above 4GB. */
+ if (r_symndx == 0)
+ {
+ r = bfd_reloc_ok;
+ break;
+ }
+ /* FALLTHRU */
+
+ case R_ALPHA_GPREL16:
case R_ALPHA_GPRELLOW:
if (dynamic_symbol_p)
{
(*_bfd_error_handler)
(_("%s: gp-relative relocation against dynamic symbol %s"),
bfd_archive_filename (input_bfd), h->root.root.root.string);
- ret_val = false;
+ ret_val = FALSE;
}
BFD_ASSERT(gp != 0);
value -= gp;
@@ -4510,7 +4509,7 @@ elf64_alpha_relocate_section (output_bfd, info, input_bfd, input_section,
(*_bfd_error_handler)
(_("%s: gp-relative relocation against dynamic symbol %s"),
bfd_archive_filename (input_bfd), h->root.root.root.string);
- ret_val = false;
+ ret_val = FALSE;
}
BFD_ASSERT(gp != 0);
value -= gp;
@@ -4536,7 +4535,7 @@ elf64_alpha_relocate_section (output_bfd, info, input_bfd, input_section,
(*_bfd_error_handler)
(_("%s: pc-relative relocation against dynamic symbol %s"),
bfd_archive_filename (input_bfd), h->root.root.root.string);
- ret_val = false;
+ ret_val = FALSE;
}
/* The regular PC-relative stuff measures from the start of
the instruction rather than the end. */
@@ -4564,7 +4563,7 @@ elf64_alpha_relocate_section (output_bfd, info, input_bfd, input_section,
(*_bfd_error_handler)
(_("%s: change in gp: BRSGP %s"),
bfd_archive_filename (input_bfd), h->root.root.root.string);
- ret_val = false;
+ ret_val = FALSE;
}
/* The symbol should be marked either NOPV or STD_GPLOAD. */
@@ -4594,7 +4593,7 @@ elf64_alpha_relocate_section (output_bfd, info, input_bfd, input_section,
(*_bfd_error_handler)
(_("%s: !samegp reloc against symbol without .prologue: %s"),
bfd_archive_filename (input_bfd), name);
- ret_val = false;
+ ret_val = FALSE;
break;
}
@@ -4606,7 +4605,8 @@ elf64_alpha_relocate_section (output_bfd, info, input_bfd, input_section,
case R_ALPHA_DTPREL64:
case R_ALPHA_TPREL64:
{
- Elf_Internal_Rela outrel;
+ long dynindx, dyntype = r_type;
+ bfd_vma dynaddend;
/* Careful here to remember RELATIVE relocations for global
variables for symbolic shared objects. */
@@ -4614,21 +4614,26 @@ elf64_alpha_relocate_section (output_bfd, info, input_bfd, input_section,
if (dynamic_symbol_p)
{
BFD_ASSERT(h->root.dynindx != -1);
- outrel.r_info = ELF64_R_INFO (h->root.dynindx, r_type);
- outrel.r_addend = addend;
+ dynindx = h->root.dynindx;
+ dynaddend = addend;
addend = 0, value = 0;
}
else if (r_type == R_ALPHA_DTPREL64)
{
- BFD_ASSERT(tls_segment != NULL);
+ BFD_ASSERT (elf_hash_table (info)->tls_sec != NULL);
value -= dtp_base;
goto default_reloc;
}
else if (r_type == R_ALPHA_TPREL64)
{
- BFD_ASSERT(tls_segment != NULL);
- value -= dtp_base;
- goto default_reloc;
+ BFD_ASSERT (elf_hash_table (info)->tls_sec != NULL);
+ if (!info->shared)
+ {
+ value -= tp_base;
+ goto default_reloc;
+ }
+ dynindx = 0;
+ dynaddend = value - dtp_base;
}
else if (info->shared
&& r_symndx != 0
@@ -4640,31 +4645,18 @@ elf64_alpha_relocate_section (output_bfd, info, input_bfd, input_section,
(_("%s: unhandled dynamic relocation against %s"),
bfd_archive_filename (input_bfd),
h->root.root.root.string);
- ret_val = false;
+ ret_val = FALSE;
}
- outrel.r_info = ELF64_R_INFO (0, R_ALPHA_RELATIVE);
- outrel.r_addend = value;
+ dynindx = 0;
+ dyntype = R_ALPHA_RELATIVE;
+ dynaddend = value;
}
else
goto default_reloc;
- BFD_ASSERT(srel != NULL);
-
- outrel.r_offset =
- _bfd_elf_section_offset (output_bfd, info, input_section,
- rel->r_offset);
- if ((outrel.r_offset | 1) != (bfd_vma) -1)
- outrel.r_offset += (input_section->output_section->vma
- + input_section->output_offset);
- else
- memset (&outrel, 0, sizeof outrel);
-
- bfd_elf64_swap_reloca_out (output_bfd, &outrel,
- ((Elf64_External_Rela *)
- srel->contents)
- + srel->reloc_count++);
- BFD_ASSERT (sizeof (Elf64_External_Rela) * srel->reloc_count
- <= srel->_cooked_size);
+ elf64_alpha_emit_dynrel (output_bfd, info, input_section,
+ srel, rel->r_offset, dynindx,
+ dyntype, dynaddend);
}
goto default_reloc;
@@ -4676,7 +4668,7 @@ elf64_alpha_relocate_section (output_bfd, info, input_bfd, input_section,
(*_bfd_error_handler)
(_("%s: pc-relative relocation against dynamic symbol %s"),
bfd_archive_filename (input_bfd), h->root.root.root.string);
- ret_val = false;
+ ret_val = FALSE;
}
/* ??? .eh_frame references to discarded sections will be smashed
@@ -4706,32 +4698,15 @@ elf64_alpha_relocate_section (output_bfd, info, input_bfd, input_section,
DTPMOD64 reloc, otherwise it will be handled in
finish_dynamic_symbol. */
if (info->shared && !dynamic_symbol_p)
- {
- Elf_Internal_Rela outrel;
-
- BFD_ASSERT(srelgot != NULL);
-
- outrel.r_offset = (sgot->output_section->vma
- + sgot->output_offset
- + gotent->got_offset);
- /* ??? Proper dynindx here. */
- outrel.r_info = ELF64_R_INFO (0, R_ALPHA_DTPMOD64);
- outrel.r_addend = 0;
-
- bfd_elf64_swap_reloca_out (output_bfd, &outrel,
- ((Elf64_External_Rela *)
- srelgot->contents)
- + srelgot->reloc_count++);
- BFD_ASSERT (sizeof (Elf64_External_Rela)
- * srelgot->reloc_count
- <= srelgot->_cooked_size);
- }
+ elf64_alpha_emit_dynrel (output_bfd, info, sgot, srelgot,
+ gotent->got_offset, 0,
+ R_ALPHA_DTPMOD64, 0);
if (dynamic_symbol_p || r_type == R_ALPHA_TLSLDM)
value = 0;
else
{
- BFD_ASSERT(tls_segment != NULL);
+ BFD_ASSERT (elf_hash_table (info)->tls_sec != NULL);
value -= dtp_base;
}
bfd_put_64 (output_bfd, value,
@@ -4752,9 +4727,9 @@ elf64_alpha_relocate_section (output_bfd, info, input_bfd, input_section,
(*_bfd_error_handler)
(_("%s: dtp-relative relocation against dynamic symbol %s"),
bfd_archive_filename (input_bfd), h->root.root.root.string);
- ret_val = false;
+ ret_val = FALSE;
}
- BFD_ASSERT(tls_segment != NULL);
+ BFD_ASSERT (elf_hash_table (info)->tls_sec != NULL);
value -= dtp_base;
if (r_type == R_ALPHA_DTPRELHI)
value = ((bfd_signed_vma) value >> 16) + ((value >> 15) & 1);
@@ -4768,16 +4743,16 @@ elf64_alpha_relocate_section (output_bfd, info, input_bfd, input_section,
(*_bfd_error_handler)
(_("%s: TLS local exec code cannot be linked into shared objects"),
bfd_archive_filename (input_bfd));
- ret_val = false;
+ ret_val = FALSE;
}
else if (dynamic_symbol_p)
{
(*_bfd_error_handler)
(_("%s: tp-relative relocation against dynamic symbol %s"),
bfd_archive_filename (input_bfd), h->root.root.root.string);
- ret_val = false;
+ ret_val = FALSE;
}
- BFD_ASSERT(tls_segment != NULL);
+ BFD_ASSERT (elf_hash_table (info)->tls_sec != NULL);
value -= tp_base;
if (r_type == R_ALPHA_TPRELHI)
value = ((bfd_signed_vma) value >> 16) + ((value >> 15) & 1);
@@ -4798,8 +4773,19 @@ elf64_alpha_relocate_section (output_bfd, info, input_bfd, input_section,
value = 0;
else
{
- BFD_ASSERT(tls_segment != NULL);
- value -= (r_type == R_ALPHA_GOTDTPREL ? dtp_base : tp_base);
+ BFD_ASSERT (elf_hash_table (info)->tls_sec != NULL);
+ if (r_type == R_ALPHA_GOTDTPREL)
+ value -= dtp_base;
+ else if (!info->shared)
+ value -= tp_base;
+ else
+ {
+ elf64_alpha_emit_dynrel (output_bfd, info, sgot, srelgot,
+ gotent->got_offset, 0,
+ R_ALPHA_TPREL64,
+ value - dtp_base);
+ value = 0;
+ }
}
bfd_put_64 (output_bfd, value,
sgot->contents + gotent->got_offset);
@@ -4843,14 +4829,14 @@ elf64_alpha_relocate_section (output_bfd, info, input_bfd, input_section,
name = (bfd_elf_string_from_elf_section
(input_bfd, symtab_hdr->sh_link, sym->st_name));
if (name == NULL)
- return false;
+ return FALSE;
if (*name == '\0')
name = bfd_section_name (input_bfd, sec);
}
if (! ((*info->callbacks->reloc_overflow)
(info, name, howto->name, (bfd_vma) 0,
input_bfd, input_section, rel->r_offset)))
- ret_val = false;
+ ret_val = FALSE;
}
break;
@@ -4866,7 +4852,7 @@ elf64_alpha_relocate_section (output_bfd, info, input_bfd, input_section,
/* Finish up dynamic symbol handling. We set the contents of various
dynamic sections here. */
-static boolean
+static bfd_boolean
elf64_alpha_finish_dynamic_symbol (output_bfd, info, h, sym)
bfd *output_bfd;
struct bfd_link_info *info;
@@ -4880,6 +4866,7 @@ elf64_alpha_finish_dynamic_symbol (output_bfd, info, h, sym)
/* Fill in the .plt entry for this symbol. */
asection *splt, *sgot, *srel;
Elf_Internal_Rela outrel;
+ bfd_byte *loc;
bfd_vma got_addr, plt_addr;
bfd_vma plt_index;
struct alpha_elf_got_entry *gotent;
@@ -4925,9 +4912,8 @@ elf64_alpha_finish_dynamic_symbol (output_bfd, info, h, sym)
outrel.r_info = ELF64_R_INFO(h->dynindx, R_ALPHA_JMP_SLOT);
outrel.r_addend = 0;
- bfd_elf64_swap_reloca_out (output_bfd, &outrel,
- ((Elf64_External_Rela *)srel->contents
- + plt_index));
+ loc = srel->contents + plt_index * sizeof (Elf64_External_Rela);
+ bfd_elf64_swap_reloca_out (output_bfd, &outrel, loc);
if (!(h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR))
{
@@ -4956,20 +4942,9 @@ elf64_alpha_finish_dynamic_symbol (output_bfd, info, h, sym)
sgot->contents + gotent->got_offset);
if (info->shared)
- {
- outrel.r_offset = (sgot->output_section->vma
- + sgot->output_offset
- + gotent->got_offset);
- outrel.r_info = ELF64_R_INFO(0, R_ALPHA_RELATIVE);
- outrel.r_addend = plt_addr;
-
- bfd_elf64_swap_reloca_out (output_bfd, &outrel,
- ((Elf64_External_Rela *)
- srel->contents)
- + srel->reloc_count++);
- BFD_ASSERT (sizeof (Elf64_External_Rela) * srel->reloc_count
- <= srel->_cooked_size);
- }
+ elf64_alpha_emit_dynrel (output_bfd, info, sgot, srel,
+ gotent->got_offset, 0,
+ R_ALPHA_RELATIVE, plt_addr);
gotent = gotent->next;
}
@@ -4980,7 +4955,6 @@ elf64_alpha_finish_dynamic_symbol (output_bfd, info, h, sym)
{
/* Fill in the dynamic relocations for this symbol's .got entries. */
asection *srel;
- Elf_Internal_Rela outrel;
struct alpha_elf_got_entry *gotent;
srel = bfd_get_section_by_name (dynobj, ".rela.got");
@@ -4991,15 +4965,12 @@ elf64_alpha_finish_dynamic_symbol (output_bfd, info, h, sym)
gotent = gotent->next)
{
asection *sgot;
- int r_type;
+ long r_type;
if (gotent->use_count == 0)
continue;
sgot = alpha_elf_tdata (gotent->gotobj)->got;
- outrel.r_offset = (sgot->output_section->vma
- + sgot->output_offset
- + gotent->got_offset);
r_type = gotent->reloc_type;
switch (r_type)
@@ -5021,25 +4992,14 @@ elf64_alpha_finish_dynamic_symbol (output_bfd, info, h, sym)
abort ();
}
- outrel.r_info = ELF64_R_INFO (h->dynindx, r_type);
- outrel.r_addend = gotent->addend;
-
- bfd_elf64_swap_reloca_out (output_bfd, &outrel,
- ((Elf64_External_Rela *)srel->contents
- + srel->reloc_count++));
+ elf64_alpha_emit_dynrel (output_bfd, info, sgot, srel,
+ gotent->got_offset, h->dynindx,
+ r_type, gotent->addend);
if (gotent->reloc_type == R_ALPHA_TLSGD)
- {
- outrel.r_offset += 8;
- outrel.r_info = ELF64_R_INFO (h->dynindx, R_ALPHA_DTPREL64);
-
- bfd_elf64_swap_reloca_out (output_bfd, &outrel,
- ((Elf64_External_Rela *)srel->contents
- + srel->reloc_count++));
- }
-
- BFD_ASSERT (sizeof (Elf64_External_Rela) * srel->reloc_count
- <= srel->_cooked_size);
+ elf64_alpha_emit_dynrel (output_bfd, info, sgot, srel,
+ gotent->got_offset + 8, h->dynindx,
+ R_ALPHA_DTPREL64, gotent->addend);
}
}
@@ -5049,12 +5009,12 @@ elf64_alpha_finish_dynamic_symbol (output_bfd, info, h, sym)
|| strcmp (h->root.root.string, "_PROCEDURE_LINKAGE_TABLE_") == 0)
sym->st_shndx = SHN_ABS;
- return true;
+ return TRUE;
}
/* Finish up the dynamic sections. */
-static boolean
+static bfd_boolean
elf64_alpha_finish_dynamic_sections (output_bfd, info)
bfd *output_bfd;
struct bfd_link_info *info;
@@ -5124,7 +5084,7 @@ elf64_alpha_finish_dynamic_sections (output_bfd, info)
bfd_elf64_swap_dyn_out (output_bfd, &dyn, dyncon);
}
- /* Initialize the PLT0 entry */
+ /* Initialize the PLT0 entry. */
if (splt->_raw_size > 0)
{
bfd_put_32 (output_bfd, PLT_HEADER_WORD1, splt->contents);
@@ -5136,19 +5096,18 @@ elf64_alpha_finish_dynamic_sections (output_bfd, info)
bfd_put_64 (output_bfd, (bfd_vma) 0, splt->contents + 16);
bfd_put_64 (output_bfd, (bfd_vma) 0, splt->contents + 24);
- elf_section_data (splt->output_section)->this_hdr.sh_entsize =
- PLT_HEADER_SIZE;
+ elf_section_data (splt->output_section)->this_hdr.sh_entsize = 0;
}
}
- return true;
+ return TRUE;
}
/* We need to use a special link routine to handle the .mdebug section.
We need to merge all instances of these sections together, not write
them all out sequentially. */
-static boolean
+static bfd_boolean
elf64_alpha_final_link (abfd, info)
bfd *abfd;
struct bfd_link_info *info;
@@ -5205,7 +5164,7 @@ elf64_alpha_final_link (abfd, info)
mdebug_handle = bfd_ecoff_debug_init (abfd, &debug, swap, info);
if (mdebug_handle == (PTR) NULL)
- return false;
+ return FALSE;
if (1)
{
@@ -5244,7 +5203,7 @@ elf64_alpha_final_link (abfd, info)
if (! bfd_ecoff_debug_one_external (abfd, &debug, swap,
name[i], &esym))
- return false;
+ return FALSE;
}
}
@@ -5289,12 +5248,12 @@ elf64_alpha_final_link (abfd, info)
ecoff_debug_info structure, so we do that now. */
if (!elf64_alpha_read_ecoff_info (input_bfd, input_section,
&input_debug))
- return false;
+ return FALSE;
if (! (bfd_ecoff_debug_accumulate
(mdebug_handle, abfd, &debug, swap, input_bfd,
&input_debug, input_swap, info)))
- return false;
+ return FALSE;
/* Loop through the external symbols. For each one with
interesting information, try to find the symbol in
@@ -5320,7 +5279,7 @@ elf64_alpha_final_link (abfd, info)
name = input_debug.ssext + ext.asym.iss;
h = alpha_elf_link_hash_lookup (alpha_elf_hash_table (info),
- name, false, false, true);
+ name, FALSE, FALSE, TRUE);
if (h == NULL || h->esym.ifd != -2)
continue;
@@ -5357,12 +5316,12 @@ elf64_alpha_final_link (abfd, info)
einfo.info = info;
einfo.debug = &debug;
einfo.swap = swap;
- einfo.failed = false;
+ einfo.failed = FALSE;
elf_link_hash_traverse (elf_hash_table (info),
elf64_alpha_output_extsym,
(PTR) &einfo);
if (einfo.failed)
- return false;
+ return FALSE;
/* Set the size of the .mdebug section. */
o->_raw_size = bfd_ecoff_debug_size (abfd, &debug, swap);
@@ -5376,8 +5335,8 @@ elf64_alpha_final_link (abfd, info)
}
/* Invoke the regular ELF backend linker to do all the work. */
- if (! bfd_elf64_bfd_final_link (abfd, info))
- return false;
+ if (! bfd_elf_final_link (abfd, info))
+ return FALSE;
/* Now write out the computed sections. */
@@ -5399,7 +5358,7 @@ elf64_alpha_final_link (abfd, info)
sgot->contents,
(file_ptr) sgot->output_offset,
sgot->_raw_size))
- return false;
+ return FALSE;
}
}
@@ -5409,12 +5368,12 @@ elf64_alpha_final_link (abfd, info)
if (! bfd_ecoff_write_accumulated_debug (mdebug_handle, abfd, &debug,
swap, info,
mdebug_sec->filepos))
- return false;
+ return FALSE;
bfd_ecoff_debug_free (mdebug_handle, abfd, &debug, swap, info);
}
- return true;
+ return TRUE;
}
static enum elf_reloc_type_class
@@ -5434,6 +5393,13 @@ elf64_alpha_reloc_type_class (rela)
}
}
+static struct bfd_elf_special_section const elf64_alpha_special_sections[]=
+{
+ { ".sdata", 6, -2, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE + SHF_ALPHA_GPREL },
+ { ".sbss", 5, -2, SHT_NOBITS, SHF_ALLOC + SHF_WRITE + SHF_ALPHA_GPREL },
+ { NULL, 0, 0, 0, 0 }
+};
+
/* ECOFF swapping routines. These are used when dealing with the
.mdebug section, which is in the ECOFF debugging format. Copied
from elf32-mips.c. */
@@ -5493,7 +5459,7 @@ static const struct elf_size_info alpha_elf_size_info =
sizeof (Elf_External_Note),
8,
1,
- 64, 8,
+ 64, 3,
ELFCLASS64, EV_CURRENT,
bfd_elf64_write_out_phdrs,
bfd_elf64_write_shdrs_and_ehdr,
@@ -5504,19 +5470,17 @@ static const struct elf_size_info alpha_elf_size_info =
bfd_elf64_slurp_symbol_table,
bfd_elf64_swap_dyn_in,
bfd_elf64_swap_dyn_out,
- NULL,
- NULL,
- NULL,
- NULL
+ bfd_elf64_swap_reloc_in,
+ bfd_elf64_swap_reloc_out,
+ bfd_elf64_swap_reloca_in,
+ bfd_elf64_swap_reloca_out
};
-#ifndef ELF_ARCH
#define TARGET_LITTLE_SYM bfd_elf64_alpha_vec
#define TARGET_LITTLE_NAME "elf64-alpha"
#define ELF_ARCH bfd_arch_alpha
#define ELF_MACHINE_CODE EM_ALPHA
#define ELF_MAXPAGESIZE 0x10000
-#endif /* ELF_ARCH */
#define bfd_elf64_bfd_link_hash_table_create \
elf64_alpha_bfd_link_hash_table_create
@@ -5574,11 +5538,53 @@ static const struct elf_size_info alpha_elf_size_info =
#define elf_backend_size_info \
alpha_elf_size_info
+#define elf_backend_special_sections \
+ elf64_alpha_special_sections
+
/* A few constants that determine how the .plt section is set up. */
#define elf_backend_want_got_plt 0
#define elf_backend_plt_readonly 0
#define elf_backend_want_plt_sym 1
#define elf_backend_got_header_size 0
-#define elf_backend_plt_header_size PLT_HEADER_SIZE
+
+#include "elf64-target.h"
+
+/* FreeBSD support. */
+
+#undef TARGET_LITTLE_SYM
+#define TARGET_LITTLE_SYM bfd_elf64_alpha_freebsd_vec
+#undef TARGET_LITTLE_NAME
+#define TARGET_LITTLE_NAME "elf64-alpha-freebsd"
+
+/* The kernel recognizes executables as valid only if they carry a
+ "FreeBSD" label in the ELF header. So we put this label on all
+ executables and (for simplicity) also all other object files. */
+
+static void elf64_alpha_fbsd_post_process_headers
+ PARAMS ((bfd *, struct bfd_link_info *));
+
+static void
+elf64_alpha_fbsd_post_process_headers (abfd, link_info)
+ bfd * abfd;
+ struct bfd_link_info * link_info ATTRIBUTE_UNUSED;
+{
+ Elf_Internal_Ehdr * i_ehdrp; /* ELF file header, internal form. */
+
+ i_ehdrp = elf_elfheader (abfd);
+
+ /* Put an ABI label supported by FreeBSD >= 4.1. */
+ i_ehdrp->e_ident[EI_OSABI] = ELFOSABI_FREEBSD;
+#ifdef OLD_FREEBSD_ABI_LABEL
+ /* The ABI label supported by FreeBSD <= 4.0 is quite nonstandard. */
+ memcpy (&i_ehdrp->e_ident[EI_ABIVERSION], "FreeBSD", 8);
+#endif
+}
+
+#undef elf_backend_post_process_headers
+#define elf_backend_post_process_headers \
+ elf64_alpha_fbsd_post_process_headers
+
+#undef elf64_bed
+#define elf64_bed elf64_alpha_fbsd_bed
#include "elf64-target.h"
diff --git a/contrib/binutils/bfd/elf64-gen.c b/contrib/binutils/bfd/elf64-gen.c
index a58f6ac..be1dc3e 100644
--- a/contrib/binutils/bfd/elf64-gen.c
+++ b/contrib/binutils/bfd/elf64-gen.c
@@ -1,5 +1,6 @@
/* Generic support for 64-bit ELF
- Copyright 1993, 1995, 1998, 1999, 2001 Free Software Foundation, Inc.
+ Copyright 1993, 1995, 1998, 1999, 2001, 2002, 2004
+ Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@@ -30,28 +31,28 @@ static reloc_howto_type dummy =
0, /* rightshift */
0, /* size (0 = byte, 1 = short, 2 = long) */
0, /* bitsize */
- false, /* pc_relative */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
NULL, /* special_function */
"UNKNOWN", /* name */
- false, /* partial_inplace */
+ FALSE, /* partial_inplace */
0, /* src_mask */
0, /* dst_mask */
- false); /* pcrel_offset */
+ FALSE); /* pcrel_offset */
static void elf_generic_info_to_howto
- PARAMS ((bfd *, arelent *, Elf64_Internal_Rela *));
+ PARAMS ((bfd *, arelent *, Elf_Internal_Rela *));
static void elf_generic_info_to_howto_rel
- PARAMS ((bfd *, arelent *, Elf64_Internal_Rel *));
-static boolean elf64_generic_link_add_symbols
+ 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;
- Elf64_Internal_Rela *elf_reloc ATTRIBUTE_UNUSED;
+ Elf_Internal_Rela *elf_reloc ATTRIBUTE_UNUSED;
{
bfd_reloc->howto = &dummy;
}
@@ -60,12 +61,12 @@ static void
elf_generic_info_to_howto_rel (abfd, bfd_reloc, elf_reloc)
bfd *abfd ATTRIBUTE_UNUSED;
arelent *bfd_reloc;
- Elf64_Internal_Rel *elf_reloc ATTRIBUTE_UNUSED;
+ Elf_Internal_Rela *elf_reloc ATTRIBUTE_UNUSED;
{
bfd_reloc->howto = &dummy;
}
-static boolean
+static bfd_boolean
elf64_generic_link_add_symbols (abfd, info)
bfd *abfd;
struct bfd_link_info *info;
@@ -84,10 +85,10 @@ elf64_generic_link_add_symbols (abfd, info)
ehdrp->e_machine);
bfd_set_error (bfd_error_wrong_format);
- return false;
+ return FALSE;
}
- return bfd_elf64_bfd_link_add_symbols (abfd, info);
+ return bfd_elf_link_add_symbols (abfd, info);
}
#define TARGET_LITTLE_SYM bfd_elf64_little_generic_vec
diff --git a/contrib/binutils/bfd/elf64-ppc.c b/contrib/binutils/bfd/elf64-ppc.c
index c512636..a0d81d0 100644
--- a/contrib/binutils/bfd/elf64-ppc.c
+++ b/contrib/binutils/bfd/elf64-ppc.c
@@ -1,66 +1,102 @@
/* PowerPC64-specific support for 64-bit ELF.
- Copyright 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
+ Copyright 1999, 2000, 2001, 2002, 2003, 2004
+ Free Software Foundation, Inc.
Written by Linus Nordberg, Swox AB <info@swox.com>,
based on elf32-ppc.c by Ian Lance Taylor.
+ Largely rewritten by Alan Modra <amodra@bigpond.net.au>
-This file is part of BFD, the Binary File Descriptor library.
+ This 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.,
+ 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-/* This file is based on the 64-bit PowerPC ELF ABI. It is also based
- on the file elf32-ppc.c. */
+/* The 64-bit PowerPC ELF ABI may be found at
+ http://www.linuxbase.org/spec/ELF/ppc64/PPC-elf64abi.txt, and
+ http://www.linuxbase.org/spec/ELF/ppc64/spec/book1.html */
#include "bfd.h"
#include "sysdep.h"
#include "bfdlink.h"
#include "libbfd.h"
#include "elf-bfd.h"
-#include "elf/ppc.h"
+#include "elf/ppc64.h"
#include "elf64-ppc.h"
-#define USE_RELA /* we want RELA relocations, not REL. */
-
-
-static void ppc_howto_init
- PARAMS ((void));
-static reloc_howto_type *ppc64_elf_reloc_type_lookup
- PARAMS ((bfd *abfd, bfd_reloc_code_real_type code));
-static void ppc64_elf_info_to_howto
- PARAMS ((bfd *abfd, arelent *cache_ptr, Elf64_Internal_Rela *dst));
static bfd_reloc_status_type ppc64_elf_ha_reloc
- PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
+ (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **);
static bfd_reloc_status_type ppc64_elf_brtaken_reloc
- PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
+ (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **);
static bfd_reloc_status_type ppc64_elf_sectoff_reloc
- PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
+ (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **);
static bfd_reloc_status_type ppc64_elf_sectoff_ha_reloc
- PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
+ (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **);
static bfd_reloc_status_type ppc64_elf_toc_reloc
- PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
+ (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **);
static bfd_reloc_status_type ppc64_elf_toc_ha_reloc
- PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
+ (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **);
static bfd_reloc_status_type ppc64_elf_toc64_reloc
- PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
+ (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **);
static bfd_reloc_status_type ppc64_elf_unhandled_reloc
- PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
-static boolean ppc64_elf_object_p
- PARAMS ((bfd *));
-static boolean ppc64_elf_merge_private_bfd_data
- PARAMS ((bfd *, bfd *));
+ (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **);
+#define TARGET_LITTLE_SYM bfd_elf64_powerpcle_vec
+#define TARGET_LITTLE_NAME "elf64-powerpcle"
+#define TARGET_BIG_SYM bfd_elf64_powerpc_vec
+#define TARGET_BIG_NAME "elf64-powerpc"
+#define ELF_ARCH bfd_arch_powerpc
+#define ELF_MACHINE_CODE EM_PPC64
+#define ELF_MAXPAGESIZE 0x10000
+#define elf_info_to_howto ppc64_elf_info_to_howto
+
+#define elf_backend_want_got_sym 0
+#define elf_backend_want_plt_sym 0
+#define elf_backend_plt_alignment 3
+#define elf_backend_plt_not_loaded 1
+#define elf_backend_got_symbol_offset 0
+#define elf_backend_got_header_size 8
+#define elf_backend_can_gc_sections 1
+#define elf_backend_can_refcount 1
+#define elf_backend_rela_normal 1
+
+#define bfd_elf64_mkobject ppc64_elf_mkobject
+#define bfd_elf64_bfd_reloc_type_lookup ppc64_elf_reloc_type_lookup
+#define bfd_elf64_bfd_merge_private_bfd_data ppc64_elf_merge_private_bfd_data
+#define bfd_elf64_new_section_hook ppc64_elf_new_section_hook
+#define bfd_elf64_bfd_link_hash_table_create ppc64_elf_link_hash_table_create
+#define bfd_elf64_bfd_link_hash_table_free ppc64_elf_link_hash_table_free
+
+#define elf_backend_object_p ppc64_elf_object_p
+#define elf_backend_grok_prstatus ppc64_elf_grok_prstatus
+#define elf_backend_grok_psinfo ppc64_elf_grok_psinfo
+#define elf_backend_create_dynamic_sections ppc64_elf_create_dynamic_sections
+#define elf_backend_copy_indirect_symbol ppc64_elf_copy_indirect_symbol
+#define elf_backend_add_symbol_hook ppc64_elf_add_symbol_hook
+#define elf_backend_check_relocs ppc64_elf_check_relocs
+#define elf_backend_gc_mark_hook ppc64_elf_gc_mark_hook
+#define elf_backend_gc_sweep_hook ppc64_elf_gc_sweep_hook
+#define elf_backend_adjust_dynamic_symbol ppc64_elf_adjust_dynamic_symbol
+#define elf_backend_hide_symbol ppc64_elf_hide_symbol
+#define elf_backend_always_size_sections ppc64_elf_func_desc_adjust
+#define elf_backend_size_dynamic_sections ppc64_elf_size_dynamic_sections
+#define elf_backend_relocate_section ppc64_elf_relocate_section
+#define elf_backend_finish_dynamic_symbol ppc64_elf_finish_dynamic_symbol
+#define elf_backend_reloc_type_class ppc64_elf_reloc_type_class
+#define elf_backend_finish_dynamic_sections ppc64_elf_finish_dynamic_sections
+#define elf_backend_link_output_symbol_hook ppc64_elf_output_symbol_hook
+#define elf_backend_special_sections ppc64_elf_special_sections
+
/* The name of the dynamic interpreter. This is put in the .interp
section. */
#define ELF_DYNAMIC_INTERPRETER "/usr/lib/ld.so.1"
@@ -72,9 +108,16 @@ static boolean ppc64_elf_merge_private_bfd_data
#define PLT_INITIAL_ENTRY_SIZE PLT_ENTRY_SIZE
/* TOC base pointers offset from start of TOC. */
-#define TOC_BASE_OFF (0x8000)
+#define TOC_BASE_OFF 0x8000
+
+/* Offset of tp and dtp pointers from start of TLS block. */
+#define TP_OFFSET 0x7000
+#define DTP_OFFSET 0x8000
-/* .plt call stub instructions. */
+/* .plt call stub instructions. The normal stub is like this, but
+ sometimes the .plt entry crosses a 64k boundary and we need to
+ insert an addis to adjust r12. */
+#define PLT_CALL_STUB_SIZE (7*4)
#define ADDIS_R12_R2 0x3d820000 /* addis %r12,%r2,xxx@ha */
#define STD_R2_40R1 0xf8410028 /* std %r2,40(%r1) */
#define LD_R11_0R12 0xe96c0000 /* ld %r11,xxx+0@l(%r12) */
@@ -83,19 +126,31 @@ static boolean ppc64_elf_merge_private_bfd_data
/* ld %r11,xxx+16@l(%r12) */
#define BCTR 0x4e800420 /* bctr */
-/* The normal stub is this size. */
-#define PLT_CALL_STUB_SIZE (7*4)
-
-/* But sometimes the .plt entry crosses a 64k boundary, and we need
- to adjust the high word with this insn. */
-#define ADDIS_R12_R12_1 0x3d8c0001 /* addis %r12,%r12,1 */
-
-/* The .glink fixup call stub is the same as the .plt call stub, but
- the first instruction restores r2, and the std is omitted. */
-#define LD_R2_40R1 0xe8410028 /* ld %r2,40(%r1) */
-/* Always allow this much space. */
-#define GLINK_CALL_STUB_SIZE (8*4)
+#define ADDIS_R2_R2 0x3c420000 /* addis %r2,%r2,off@ha */
+#define ADDI_R2_R2 0x38420000 /* addi %r2,%r2,off@l */
+
+#define LD_R2_40R1 0xe8410028 /* ld %r2,40(%r1) */
+
+/* glink call stub instructions. We enter with the index in R0, and the
+ address of glink entry in CTR. From that, we can calculate PLT0. */
+#define GLINK_CALL_STUB_SIZE (16*4)
+#define MFCTR_R12 0x7d8902a6 /* mfctr %r12 */
+#define SLDI_R11_R0_3 0x780b1f24 /* sldi %r11,%r0,3 */
+#define ADDIC_R2_R0_32K 0x34408000 /* addic. %r2,%r0,-32768 */
+#define SUB_R12_R12_R11 0x7d8b6050 /* sub %r12,%r12,%r11 */
+#define SRADI_R2_R2_63 0x7c42fe76 /* sradi %r2,%r2,63 */
+#define SLDI_R11_R0_2 0x780b1764 /* sldi %r11,%r0,2 */
+#define AND_R2_R2_R11 0x7c425838 /* and %r2,%r2,%r11 */
+ /* sub %r12,%r12,%r11 */
+#define ADD_R12_R12_R2 0x7d8c1214 /* add %r12,%r12,%r2 */
+#define ADDIS_R12_R12 0x3d8c0000 /* addis %r12,%r12,xxx@ha */
+ /* ld %r11,xxx@l(%r12) */
+#define ADDI_R12_R12 0x398c0000 /* addi %r12,%r12,xxx@l */
+ /* ld %r2,8(%r12) */
+ /* mtctr %r11 */
+ /* ld %r11,16(%r12) */
+ /* bctr */
/* Pad with this. */
#define NOP 0x60000000
@@ -127,40 +182,40 @@ static boolean ppc64_elf_merge_private_bfd_data
#endif
#define ONES(n) (((bfd_vma) 1 << ((n) - 1) << 1) - 1)
-
+
/* Relocation HOWTO's. */
-static reloc_howto_type *ppc64_elf_howto_table[(int) R_PPC_max];
+static reloc_howto_type *ppc64_elf_howto_table[(int) R_PPC64_max];
static reloc_howto_type ppc64_elf_howto_raw[] = {
/* This reloc does nothing. */
HOWTO (R_PPC64_NONE, /* type */
0, /* rightshift */
- 0, /* size (0 = byte, 1 = short, 2 = long) */
- 8, /* bitsize */
- false, /* pc_relative */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 32, /* bitsize */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_PPC64_NONE", /* name */
- false, /* partial_inplace */
+ FALSE, /* partial_inplace */
0, /* src_mask */
0, /* dst_mask */
- false), /* pcrel_offset */
+ FALSE), /* pcrel_offset */
/* A standard 32 bit relocation. */
HOWTO (R_PPC64_ADDR32, /* type */
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
32, /* bitsize */
- false, /* pc_relative */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_PPC64_ADDR32", /* name */
- false, /* partial_inplace */
+ FALSE, /* partial_inplace */
0, /* src_mask */
0xffffffff, /* dst_mask */
- false), /* pcrel_offset */
+ FALSE), /* pcrel_offset */
/* An absolute 26 bit branch; the lower two bits must be zero.
FIXME: we don't check that, we just clear them. */
@@ -168,60 +223,60 @@ static reloc_howto_type ppc64_elf_howto_raw[] = {
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
26, /* bitsize */
- false, /* pc_relative */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_PPC64_ADDR24", /* name */
- false, /* partial_inplace */
+ FALSE, /* partial_inplace */
0, /* src_mask */
0x03fffffc, /* dst_mask */
- false), /* pcrel_offset */
+ FALSE), /* pcrel_offset */
/* A standard 16 bit relocation. */
HOWTO (R_PPC64_ADDR16, /* type */
0, /* rightshift */
1, /* size (0 = byte, 1 = short, 2 = long) */
16, /* bitsize */
- false, /* pc_relative */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_PPC64_ADDR16", /* name */
- false, /* partial_inplace */
+ FALSE, /* partial_inplace */
0, /* src_mask */
0xffff, /* dst_mask */
- false), /* pcrel_offset */
+ FALSE), /* pcrel_offset */
/* A 16 bit relocation without overflow. */
HOWTO (R_PPC64_ADDR16_LO, /* type */
0, /* rightshift */
1, /* size (0 = byte, 1 = short, 2 = long) */
16, /* bitsize */
- false, /* pc_relative */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_dont,/* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_PPC64_ADDR16_LO", /* name */
- false, /* partial_inplace */
+ FALSE, /* partial_inplace */
0, /* src_mask */
0xffff, /* dst_mask */
- false), /* pcrel_offset */
+ FALSE), /* pcrel_offset */
/* Bits 16-31 of an address. */
HOWTO (R_PPC64_ADDR16_HI, /* type */
16, /* rightshift */
1, /* size (0 = byte, 1 = short, 2 = long) */
16, /* bitsize */
- false, /* pc_relative */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_PPC64_ADDR16_HI", /* name */
- false, /* partial_inplace */
+ FALSE, /* partial_inplace */
0, /* src_mask */
0xffff, /* dst_mask */
- false), /* pcrel_offset */
+ FALSE), /* pcrel_offset */
/* Bits 16-31 of an address, plus 1 if the contents of the low 16
bits, treated as a signed number, is negative. */
@@ -229,15 +284,15 @@ static reloc_howto_type ppc64_elf_howto_raw[] = {
16, /* rightshift */
1, /* size (0 = byte, 1 = short, 2 = long) */
16, /* bitsize */
- false, /* pc_relative */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
ppc64_elf_ha_reloc, /* special_function */
"R_PPC64_ADDR16_HA", /* name */
- false, /* partial_inplace */
+ FALSE, /* partial_inplace */
0, /* src_mask */
0xffff, /* dst_mask */
- false), /* pcrel_offset */
+ FALSE), /* pcrel_offset */
/* An absolute 16 bit branch; the lower two bits must be zero.
FIXME: we don't check that, we just clear them. */
@@ -245,15 +300,15 @@ static reloc_howto_type ppc64_elf_howto_raw[] = {
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
16, /* bitsize */
- false, /* pc_relative */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_PPC64_ADDR14", /* name */
- false, /* partial_inplace */
+ FALSE, /* partial_inplace */
0, /* src_mask */
0x0000fffc, /* dst_mask */
- false), /* pcrel_offset */
+ FALSE), /* pcrel_offset */
/* An absolute 16 bit branch, for which bit 10 should be set to
indicate that the branch is expected to be taken. The lower two
@@ -262,15 +317,15 @@ static reloc_howto_type ppc64_elf_howto_raw[] = {
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
16, /* bitsize */
- false, /* pc_relative */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
ppc64_elf_brtaken_reloc, /* special_function */
"R_PPC64_ADDR14_BRTAKEN",/* name */
- false, /* partial_inplace */
+ FALSE, /* partial_inplace */
0, /* src_mask */
0x0000fffc, /* dst_mask */
- false), /* pcrel_offset */
+ FALSE), /* pcrel_offset */
/* An absolute 16 bit branch, for which bit 10 should be set to
indicate that the branch is not expected to be taken. The lower
@@ -279,45 +334,45 @@ static reloc_howto_type ppc64_elf_howto_raw[] = {
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
16, /* bitsize */
- false, /* pc_relative */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
ppc64_elf_brtaken_reloc, /* special_function */
"R_PPC64_ADDR14_BRNTAKEN",/* name */
- false, /* partial_inplace */
+ FALSE, /* partial_inplace */
0, /* src_mask */
0x0000fffc, /* dst_mask */
- false), /* pcrel_offset */
+ FALSE), /* pcrel_offset */
/* A relative 26 bit branch; the lower two bits must be zero. */
HOWTO (R_PPC64_REL24, /* type */
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
26, /* bitsize */
- true, /* pc_relative */
+ TRUE, /* pc_relative */
0, /* bitpos */
complain_overflow_signed, /* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_PPC64_REL24", /* name */
- false, /* partial_inplace */
+ FALSE, /* partial_inplace */
0, /* src_mask */
0x03fffffc, /* dst_mask */
- true), /* pcrel_offset */
+ TRUE), /* pcrel_offset */
/* A relative 16 bit branch; the lower two bits must be zero. */
HOWTO (R_PPC64_REL14, /* type */
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
16, /* bitsize */
- true, /* pc_relative */
+ TRUE, /* pc_relative */
0, /* bitpos */
complain_overflow_signed, /* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_PPC64_REL14", /* name */
- false, /* partial_inplace */
+ FALSE, /* partial_inplace */
0, /* src_mask */
0x0000fffc, /* dst_mask */
- true), /* pcrel_offset */
+ TRUE), /* pcrel_offset */
/* A relative 16 bit branch. Bit 10 should be set to indicate that
the branch is expected to be taken. The lower two bits must be
@@ -326,15 +381,15 @@ static reloc_howto_type ppc64_elf_howto_raw[] = {
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
16, /* bitsize */
- true, /* pc_relative */
+ TRUE, /* pc_relative */
0, /* bitpos */
complain_overflow_signed, /* complain_on_overflow */
ppc64_elf_brtaken_reloc, /* special_function */
"R_PPC64_REL14_BRTAKEN", /* name */
- false, /* partial_inplace */
+ FALSE, /* partial_inplace */
0, /* src_mask */
0x0000fffc, /* dst_mask */
- true), /* pcrel_offset */
+ TRUE), /* pcrel_offset */
/* A relative 16 bit branch. Bit 10 should be set to indicate that
the branch is not expected to be taken. The lower two bits must
@@ -343,15 +398,15 @@ static reloc_howto_type ppc64_elf_howto_raw[] = {
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
16, /* bitsize */
- true, /* pc_relative */
+ TRUE, /* pc_relative */
0, /* bitpos */
complain_overflow_signed, /* complain_on_overflow */
ppc64_elf_brtaken_reloc, /* special_function */
"R_PPC64_REL14_BRNTAKEN",/* name */
- false, /* partial_inplace */
+ FALSE, /* partial_inplace */
0, /* src_mask */
0x0000fffc, /* dst_mask */
- true), /* pcrel_offset */
+ TRUE), /* pcrel_offset */
/* Like R_PPC64_ADDR16, but referring to the GOT table entry for the
symbol. */
@@ -359,15 +414,15 @@ static reloc_howto_type ppc64_elf_howto_raw[] = {
0, /* rightshift */
1, /* size (0 = byte, 1 = short, 2 = long) */
16, /* bitsize */
- false, /* pc_relative */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_signed, /* complain_on_overflow */
ppc64_elf_unhandled_reloc, /* special_function */
"R_PPC64_GOT16", /* name */
- false, /* partial_inplace */
+ FALSE, /* partial_inplace */
0, /* src_mask */
0xffff, /* dst_mask */
- false), /* pcrel_offset */
+ FALSE), /* pcrel_offset */
/* Like R_PPC64_ADDR16_LO, but referring to the GOT table entry for
the symbol. */
@@ -375,15 +430,15 @@ static reloc_howto_type ppc64_elf_howto_raw[] = {
0, /* rightshift */
1, /* size (0 = byte, 1 = short, 2 = long) */
16, /* bitsize */
- false, /* pc_relative */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
ppc64_elf_unhandled_reloc, /* special_function */
"R_PPC64_GOT16_LO", /* name */
- false, /* partial_inplace */
+ FALSE, /* partial_inplace */
0, /* src_mask */
0xffff, /* dst_mask */
- false), /* pcrel_offset */
+ FALSE), /* pcrel_offset */
/* Like R_PPC64_ADDR16_HI, but referring to the GOT table entry for
the symbol. */
@@ -391,15 +446,15 @@ static reloc_howto_type ppc64_elf_howto_raw[] = {
16, /* rightshift */
1, /* size (0 = byte, 1 = short, 2 = long) */
16, /* bitsize */
- false, /* pc_relative */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_dont,/* complain_on_overflow */
ppc64_elf_unhandled_reloc, /* special_function */
"R_PPC64_GOT16_HI", /* name */
- false, /* partial_inplace */
+ FALSE, /* partial_inplace */
0, /* src_mask */
0xffff, /* dst_mask */
- false), /* pcrel_offset */
+ FALSE), /* pcrel_offset */
/* Like R_PPC64_ADDR16_HA, but referring to the GOT table entry for
the symbol. */
@@ -407,15 +462,15 @@ static reloc_howto_type ppc64_elf_howto_raw[] = {
16, /* rightshift */
1, /* size (0 = byte, 1 = short, 2 = long) */
16, /* bitsize */
- false, /* pc_relative */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_dont,/* complain_on_overflow */
ppc64_elf_unhandled_reloc, /* special_function */
"R_PPC64_GOT16_HA", /* name */
- false, /* partial_inplace */
+ FALSE, /* partial_inplace */
0, /* src_mask */
0xffff, /* dst_mask */
- false), /* pcrel_offset */
+ FALSE), /* pcrel_offset */
/* This is used only by the dynamic linker. The symbol should exist
both in the object being run and in some shared library. The
@@ -426,15 +481,15 @@ static reloc_howto_type ppc64_elf_howto_raw[] = {
0, /* rightshift */
0, /* this one is variable size */
0, /* bitsize */
- false, /* pc_relative */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
ppc64_elf_unhandled_reloc, /* special_function */
"R_PPC64_COPY", /* name */
- false, /* partial_inplace */
+ FALSE, /* partial_inplace */
0, /* src_mask */
0, /* dst_mask */
- false), /* pcrel_offset */
+ FALSE), /* pcrel_offset */
/* Like R_PPC64_ADDR64, but used when setting global offset table
entries. */
@@ -442,15 +497,15 @@ static reloc_howto_type ppc64_elf_howto_raw[] = {
0, /* rightshift */
4, /* size (0=byte, 1=short, 2=long, 4=64 bits) */
64, /* bitsize */
- false, /* pc_relative */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
ppc64_elf_unhandled_reloc, /* special_function */
"R_PPC64_GLOB_DAT", /* name */
- false, /* partial_inplace */
+ FALSE, /* partial_inplace */
0, /* src_mask */
ONES (64), /* dst_mask */
- false), /* pcrel_offset */
+ FALSE), /* pcrel_offset */
/* Created by the link editor. Marks a procedure linkage table
entry for a symbol. */
@@ -458,15 +513,15 @@ static reloc_howto_type ppc64_elf_howto_raw[] = {
0, /* rightshift */
0, /* size (0 = byte, 1 = short, 2 = long) */
0, /* bitsize */
- false, /* pc_relative */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
ppc64_elf_unhandled_reloc, /* special_function */
"R_PPC64_JMP_SLOT", /* name */
- false, /* partial_inplace */
+ FALSE, /* partial_inplace */
0, /* src_mask */
0, /* dst_mask */
- false), /* pcrel_offset */
+ FALSE), /* pcrel_offset */
/* Used only by the dynamic linker. When the object is run, this
doubleword64 is set to the load address of the object, plus the
@@ -475,76 +530,76 @@ static reloc_howto_type ppc64_elf_howto_raw[] = {
0, /* rightshift */
4, /* size (0=byte, 1=short, 2=long, 4=64 bits) */
64, /* bitsize */
- false, /* pc_relative */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_PPC64_RELATIVE", /* name */
- false, /* partial_inplace */
+ FALSE, /* partial_inplace */
0, /* src_mask */
ONES (64), /* dst_mask */
- false), /* pcrel_offset */
+ FALSE), /* pcrel_offset */
/* Like R_PPC64_ADDR32, but may be unaligned. */
HOWTO (R_PPC64_UADDR32, /* type */
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
32, /* bitsize */
- false, /* pc_relative */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_PPC64_UADDR32", /* name */
- false, /* partial_inplace */
+ FALSE, /* partial_inplace */
0, /* src_mask */
0xffffffff, /* dst_mask */
- false), /* pcrel_offset */
+ FALSE), /* pcrel_offset */
/* Like R_PPC64_ADDR16, but may be unaligned. */
HOWTO (R_PPC64_UADDR16, /* type */
0, /* rightshift */
1, /* size (0 = byte, 1 = short, 2 = long) */
16, /* bitsize */
- false, /* pc_relative */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_PPC64_UADDR16", /* name */
- false, /* partial_inplace */
+ FALSE, /* partial_inplace */
0, /* src_mask */
0xffff, /* dst_mask */
- false), /* pcrel_offset */
+ FALSE), /* pcrel_offset */
/* 32-bit PC relative. */
HOWTO (R_PPC64_REL32, /* type */
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
32, /* bitsize */
- true, /* pc_relative */
+ TRUE, /* pc_relative */
0, /* bitpos */
/* FIXME: Verify. Was complain_overflow_bitfield. */
complain_overflow_signed, /* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_PPC64_REL32", /* name */
- false, /* partial_inplace */
+ FALSE, /* partial_inplace */
0, /* src_mask */
0xffffffff, /* dst_mask */
- true), /* pcrel_offset */
+ TRUE), /* pcrel_offset */
/* 32-bit relocation to the symbol's procedure linkage table. */
HOWTO (R_PPC64_PLT32, /* type */
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
32, /* bitsize */
- false, /* pc_relative */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
ppc64_elf_unhandled_reloc, /* special_function */
"R_PPC64_PLT32", /* name */
- false, /* partial_inplace */
+ FALSE, /* partial_inplace */
0, /* src_mask */
0xffffffff, /* dst_mask */
- false), /* pcrel_offset */
+ FALSE), /* pcrel_offset */
/* 32-bit PC relative relocation to the symbol's procedure linkage table.
FIXME: R_PPC64_PLTREL32 not supported. */
@@ -552,15 +607,15 @@ static reloc_howto_type ppc64_elf_howto_raw[] = {
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
32, /* bitsize */
- true, /* pc_relative */
+ TRUE, /* pc_relative */
0, /* bitpos */
complain_overflow_signed, /* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_PPC64_PLTREL32", /* name */
- false, /* partial_inplace */
+ FALSE, /* partial_inplace */
0, /* src_mask */
0xffffffff, /* dst_mask */
- true), /* pcrel_offset */
+ TRUE), /* pcrel_offset */
/* Like R_PPC64_ADDR16_LO, but referring to the PLT table entry for
the symbol. */
@@ -568,15 +623,15 @@ static reloc_howto_type ppc64_elf_howto_raw[] = {
0, /* rightshift */
1, /* size (0 = byte, 1 = short, 2 = long) */
16, /* bitsize */
- false, /* pc_relative */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
ppc64_elf_unhandled_reloc, /* special_function */
"R_PPC64_PLT16_LO", /* name */
- false, /* partial_inplace */
+ FALSE, /* partial_inplace */
0, /* src_mask */
0xffff, /* dst_mask */
- false), /* pcrel_offset */
+ FALSE), /* pcrel_offset */
/* Like R_PPC64_ADDR16_HI, but referring to the PLT table entry for
the symbol. */
@@ -584,15 +639,15 @@ static reloc_howto_type ppc64_elf_howto_raw[] = {
16, /* rightshift */
1, /* size (0 = byte, 1 = short, 2 = long) */
16, /* bitsize */
- false, /* pc_relative */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
ppc64_elf_unhandled_reloc, /* special_function */
"R_PPC64_PLT16_HI", /* name */
- false, /* partial_inplace */
+ FALSE, /* partial_inplace */
0, /* src_mask */
0xffff, /* dst_mask */
- false), /* pcrel_offset */
+ FALSE), /* pcrel_offset */
/* Like R_PPC64_ADDR16_HA, but referring to the PLT table entry for
the symbol. */
@@ -600,91 +655,90 @@ static reloc_howto_type ppc64_elf_howto_raw[] = {
16, /* rightshift */
1, /* size (0 = byte, 1 = short, 2 = long) */
16, /* bitsize */
- false, /* pc_relative */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
ppc64_elf_unhandled_reloc, /* special_function */
"R_PPC64_PLT16_HA", /* name */
- false, /* partial_inplace */
+ FALSE, /* partial_inplace */
0, /* src_mask */
0xffff, /* dst_mask */
- false), /* pcrel_offset */
+ FALSE), /* pcrel_offset */
/* 16-bit section relative relocation. */
HOWTO (R_PPC64_SECTOFF, /* type */
0, /* rightshift */
1, /* size (0 = byte, 1 = short, 2 = long) */
16, /* bitsize */
- false, /* pc_relative */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
ppc64_elf_sectoff_reloc, /* special_function */
"R_PPC64_SECTOFF", /* name */
- false, /* partial_inplace */
+ FALSE, /* partial_inplace */
0, /* src_mask */
0xffff, /* dst_mask */
- false), /* pcrel_offset */
+ FALSE), /* pcrel_offset */
/* Like R_PPC64_SECTOFF, but no overflow warning. */
HOWTO (R_PPC64_SECTOFF_LO, /* type */
0, /* rightshift */
1, /* size (0 = byte, 1 = short, 2 = long) */
16, /* bitsize */
- false, /* pc_relative */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
ppc64_elf_sectoff_reloc, /* special_function */
"R_PPC64_SECTOFF_LO", /* name */
- false, /* partial_inplace */
+ FALSE, /* partial_inplace */
0, /* src_mask */
0xffff, /* dst_mask */
- false), /* pcrel_offset */
+ FALSE), /* pcrel_offset */
/* 16-bit upper half section relative relocation. */
HOWTO (R_PPC64_SECTOFF_HI, /* type */
16, /* rightshift */
1, /* size (0 = byte, 1 = short, 2 = long) */
16, /* bitsize */
- false, /* pc_relative */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
ppc64_elf_sectoff_reloc, /* special_function */
"R_PPC64_SECTOFF_HI", /* name */
- false, /* partial_inplace */
+ FALSE, /* partial_inplace */
0, /* src_mask */
0xffff, /* dst_mask */
- false), /* pcrel_offset */
+ FALSE), /* pcrel_offset */
/* 16-bit upper half adjusted section relative relocation. */
HOWTO (R_PPC64_SECTOFF_HA, /* type */
16, /* rightshift */
1, /* size (0 = byte, 1 = short, 2 = long) */
16, /* bitsize */
- false, /* pc_relative */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
ppc64_elf_sectoff_ha_reloc, /* special_function */
"R_PPC64_SECTOFF_HA", /* name */
- false, /* partial_inplace */
+ FALSE, /* partial_inplace */
0, /* src_mask */
0xffff, /* dst_mask */
- false), /* pcrel_offset */
+ FALSE), /* pcrel_offset */
- /* Like R_PPC64_REL24 without touching the two least significant
- bits. Should have been named R_PPC64_REL30! */
- HOWTO (R_PPC64_ADDR30, /* type */
+ /* Like R_PPC64_REL24 without touching the two least significant bits. */
+ HOWTO (R_PPC64_REL30, /* type */
2, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
30, /* bitsize */
- true, /* pc_relative */
+ TRUE, /* pc_relative */
0, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
- "R_PPC64_ADDR30", /* name */
- false, /* partial_inplace */
+ "R_PPC64_REL30", /* name */
+ FALSE, /* partial_inplace */
0, /* src_mask */
0xfffffffc, /* dst_mask */
- true), /* pcrel_offset */
+ TRUE), /* pcrel_offset */
/* Relocs in the 64-bit PowerPC ELF ABI, not in the 32-bit ABI. */
@@ -693,30 +747,30 @@ static reloc_howto_type ppc64_elf_howto_raw[] = {
0, /* rightshift */
4, /* size (0=byte, 1=short, 2=long, 4=64 bits) */
64, /* bitsize */
- false, /* pc_relative */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_PPC64_ADDR64", /* name */
- false, /* partial_inplace */
+ FALSE, /* partial_inplace */
0, /* src_mask */
ONES (64), /* dst_mask */
- false), /* pcrel_offset */
+ FALSE), /* pcrel_offset */
/* The bits 32-47 of an address. */
HOWTO (R_PPC64_ADDR16_HIGHER, /* type */
32, /* rightshift */
1, /* size (0 = byte, 1 = short, 2 = long) */
16, /* bitsize */
- false, /* pc_relative */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_PPC64_ADDR16_HIGHER", /* name */
- false, /* partial_inplace */
+ FALSE, /* partial_inplace */
0, /* src_mask */
0xffff, /* dst_mask */
- false), /* pcrel_offset */
+ FALSE), /* pcrel_offset */
/* The bits 32-47 of an address, plus 1 if the contents of the low
16 bits, treated as a signed number, is negative. */
@@ -724,30 +778,30 @@ static reloc_howto_type ppc64_elf_howto_raw[] = {
32, /* rightshift */
1, /* size (0 = byte, 1 = short, 2 = long) */
16, /* bitsize */
- false, /* pc_relative */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
ppc64_elf_ha_reloc, /* special_function */
"R_PPC64_ADDR16_HIGHERA", /* name */
- false, /* partial_inplace */
+ FALSE, /* partial_inplace */
0, /* src_mask */
0xffff, /* dst_mask */
- false), /* pcrel_offset */
+ FALSE), /* pcrel_offset */
/* The bits 48-63 of an address. */
HOWTO (R_PPC64_ADDR16_HIGHEST,/* type */
48, /* rightshift */
1, /* size (0 = byte, 1 = short, 2 = long) */
16, /* bitsize */
- false, /* pc_relative */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_PPC64_ADDR16_HIGHEST", /* name */
- false, /* partial_inplace */
+ FALSE, /* partial_inplace */
0, /* src_mask */
0xffff, /* dst_mask */
- false), /* pcrel_offset */
+ FALSE), /* pcrel_offset */
/* The bits 48-63 of an address, plus 1 if the contents of the low
16 bits, treated as a signed number, is negative. */
@@ -755,60 +809,60 @@ static reloc_howto_type ppc64_elf_howto_raw[] = {
48, /* rightshift */
1, /* size (0 = byte, 1 = short, 2 = long) */
16, /* bitsize */
- false, /* pc_relative */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
ppc64_elf_ha_reloc, /* special_function */
"R_PPC64_ADDR16_HIGHESTA", /* name */
- false, /* partial_inplace */
+ FALSE, /* partial_inplace */
0, /* src_mask */
0xffff, /* dst_mask */
- false), /* pcrel_offset */
+ FALSE), /* pcrel_offset */
/* Like ADDR64, but may be unaligned. */
HOWTO (R_PPC64_UADDR64, /* type */
0, /* rightshift */
4, /* size (0=byte, 1=short, 2=long, 4=64 bits) */
64, /* bitsize */
- false, /* pc_relative */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_PPC64_UADDR64", /* name */
- false, /* partial_inplace */
+ FALSE, /* partial_inplace */
0, /* src_mask */
ONES (64), /* dst_mask */
- false), /* pcrel_offset */
+ FALSE), /* pcrel_offset */
/* 64-bit relative relocation. */
HOWTO (R_PPC64_REL64, /* type */
0, /* rightshift */
4, /* size (0=byte, 1=short, 2=long, 4=64 bits) */
64, /* bitsize */
- true, /* pc_relative */
+ TRUE, /* pc_relative */
0, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_PPC64_REL64", /* name */
- false, /* partial_inplace */
+ FALSE, /* partial_inplace */
0, /* src_mask */
ONES (64), /* dst_mask */
- true), /* pcrel_offset */
+ TRUE), /* pcrel_offset */
/* 64-bit relocation to the symbol's procedure linkage table. */
HOWTO (R_PPC64_PLT64, /* type */
0, /* rightshift */
4, /* size (0=byte, 1=short, 2=long, 4=64 bits) */
64, /* bitsize */
- false, /* pc_relative */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
ppc64_elf_unhandled_reloc, /* special_function */
"R_PPC64_PLT64", /* name */
- false, /* partial_inplace */
+ FALSE, /* partial_inplace */
0, /* src_mask */
ONES (64), /* dst_mask */
- false), /* pcrel_offset */
+ FALSE), /* pcrel_offset */
/* 64-bit PC relative relocation to the symbol's procedure linkage
table. */
@@ -817,15 +871,15 @@ static reloc_howto_type ppc64_elf_howto_raw[] = {
0, /* rightshift */
4, /* size (0=byte, 1=short, 2=long, 4=64 bits) */
64, /* bitsize */
- true, /* pc_relative */
+ TRUE, /* pc_relative */
0, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
ppc64_elf_unhandled_reloc, /* special_function */
"R_PPC64_PLTREL64", /* name */
- false, /* partial_inplace */
+ FALSE, /* partial_inplace */
0, /* src_mask */
ONES (64), /* dst_mask */
- true), /* pcrel_offset */
+ TRUE), /* pcrel_offset */
/* 16 bit TOC-relative relocation. */
@@ -834,15 +888,15 @@ static reloc_howto_type ppc64_elf_howto_raw[] = {
0, /* rightshift */
1, /* size (0 = byte, 1 = short, 2 = long) */
16, /* bitsize */
- false, /* pc_relative */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_signed, /* complain_on_overflow */
ppc64_elf_toc_reloc, /* special_function */
"R_PPC64_TOC16", /* name */
- false, /* partial_inplace */
+ FALSE, /* partial_inplace */
0, /* src_mask */
0xffff, /* dst_mask */
- false), /* pcrel_offset */
+ FALSE), /* pcrel_offset */
/* 16 bit TOC-relative relocation without overflow. */
@@ -851,15 +905,15 @@ static reloc_howto_type ppc64_elf_howto_raw[] = {
0, /* rightshift */
1, /* size (0 = byte, 1 = short, 2 = long) */
16, /* bitsize */
- false, /* pc_relative */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
ppc64_elf_toc_reloc, /* special_function */
"R_PPC64_TOC16_LO", /* name */
- false, /* partial_inplace */
+ FALSE, /* partial_inplace */
0, /* src_mask */
0xffff, /* dst_mask */
- false), /* pcrel_offset */
+ FALSE), /* pcrel_offset */
/* 16 bit TOC-relative relocation, high 16 bits. */
@@ -868,15 +922,15 @@ static reloc_howto_type ppc64_elf_howto_raw[] = {
16, /* rightshift */
1, /* size (0 = byte, 1 = short, 2 = long) */
16, /* bitsize */
- false, /* pc_relative */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
ppc64_elf_toc_reloc, /* special_function */
"R_PPC64_TOC16_HI", /* name */
- false, /* partial_inplace */
+ FALSE, /* partial_inplace */
0, /* src_mask */
0xffff, /* dst_mask */
- false), /* pcrel_offset */
+ FALSE), /* pcrel_offset */
/* 16 bit TOC-relative relocation, high 16 bits, plus 1 if the
contents of the low 16 bits, treated as a signed number, is
@@ -887,15 +941,15 @@ static reloc_howto_type ppc64_elf_howto_raw[] = {
16, /* rightshift */
1, /* size (0 = byte, 1 = short, 2 = long) */
16, /* bitsize */
- false, /* pc_relative */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
ppc64_elf_toc_ha_reloc, /* special_function */
"R_PPC64_TOC16_HA", /* name */
- false, /* partial_inplace */
+ FALSE, /* partial_inplace */
0, /* src_mask */
0xffff, /* dst_mask */
- false), /* pcrel_offset */
+ FALSE), /* pcrel_offset */
/* 64-bit relocation; insert value of TOC base (.TOC.). */
@@ -904,15 +958,15 @@ static reloc_howto_type ppc64_elf_howto_raw[] = {
0, /* rightshift */
4, /* size (0=byte, 1=short, 2=long, 4=64 bits) */
64, /* bitsize */
- false, /* pc_relative */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
ppc64_elf_toc64_reloc, /* special_function */
"R_PPC64_TOC", /* name */
- false, /* partial_inplace */
+ FALSE, /* partial_inplace */
0, /* src_mask */
ONES (64), /* dst_mask */
- false), /* pcrel_offset */
+ FALSE), /* pcrel_offset */
/* Like R_PPC64_GOT16, but also informs the link editor that the
value to relocate may (!) refer to a PLT entry which the link
@@ -927,15 +981,15 @@ static reloc_howto_type ppc64_elf_howto_raw[] = {
0, /* rightshift */
1, /* size (0 = byte, 1 = short, 2 = long) */
16, /* bitsize */
- false, /* pc_relative */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_signed, /* complain_on_overflow */
ppc64_elf_unhandled_reloc, /* special_function */
"R_PPC64_PLTGOT16", /* name */
- false, /* partial_inplace */
+ FALSE, /* partial_inplace */
0, /* src_mask */
0xffff, /* dst_mask */
- false), /* pcrel_offset */
+ FALSE), /* pcrel_offset */
/* Like R_PPC64_PLTGOT16, but without overflow. */
/* FIXME: R_PPC64_PLTGOT16_LO not implemented. */
@@ -943,15 +997,15 @@ static reloc_howto_type ppc64_elf_howto_raw[] = {
0, /* rightshift */
1, /* size (0 = byte, 1 = short, 2 = long) */
16, /* bitsize */
- false, /* pc_relative */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
ppc64_elf_unhandled_reloc, /* special_function */
"R_PPC64_PLTGOT16_LO", /* name */
- false, /* partial_inplace */
+ FALSE, /* partial_inplace */
0, /* src_mask */
0xffff, /* dst_mask */
- false), /* pcrel_offset */
+ FALSE), /* pcrel_offset */
/* Like R_PPC64_PLT_GOT16, but using bits 16-31 of the address. */
/* FIXME: R_PPC64_PLTGOT16_HI not implemented. */
@@ -959,15 +1013,15 @@ static reloc_howto_type ppc64_elf_howto_raw[] = {
16, /* rightshift */
1, /* size (0 = byte, 1 = short, 2 = long) */
16, /* bitsize */
- false, /* pc_relative */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
ppc64_elf_unhandled_reloc, /* special_function */
"R_PPC64_PLTGOT16_HI", /* name */
- false, /* partial_inplace */
+ FALSE, /* partial_inplace */
0, /* src_mask */
0xffff, /* dst_mask */
- false), /* pcrel_offset */
+ FALSE), /* pcrel_offset */
/* Like R_PPC64_PLT_GOT16, but using bits 16-31 of the address, plus
1 if the contents of the low 16 bits, treated as a signed number,
@@ -977,150 +1031,150 @@ static reloc_howto_type ppc64_elf_howto_raw[] = {
16, /* rightshift */
1, /* size (0 = byte, 1 = short, 2 = long) */
16, /* bitsize */
- false, /* pc_relative */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_dont,/* complain_on_overflow */
ppc64_elf_unhandled_reloc, /* special_function */
"R_PPC64_PLTGOT16_HA", /* name */
- false, /* partial_inplace */
+ FALSE, /* partial_inplace */
0, /* src_mask */
0xffff, /* dst_mask */
- false), /* pcrel_offset */
+ FALSE), /* pcrel_offset */
/* Like R_PPC64_ADDR16, but for instructions with a DS field. */
HOWTO (R_PPC64_ADDR16_DS, /* type */
0, /* rightshift */
1, /* size (0 = byte, 1 = short, 2 = long) */
16, /* bitsize */
- false, /* pc_relative */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_PPC64_ADDR16_DS", /* name */
- false, /* partial_inplace */
+ FALSE, /* partial_inplace */
0, /* src_mask */
0xfffc, /* dst_mask */
- false), /* pcrel_offset */
+ FALSE), /* pcrel_offset */
/* Like R_PPC64_ADDR16_LO, but for instructions with a DS field. */
HOWTO (R_PPC64_ADDR16_LO_DS, /* type */
0, /* rightshift */
1, /* size (0 = byte, 1 = short, 2 = long) */
16, /* bitsize */
- false, /* pc_relative */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_dont,/* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_PPC64_ADDR16_LO_DS",/* name */
- false, /* partial_inplace */
+ FALSE, /* partial_inplace */
0, /* src_mask */
0xfffc, /* dst_mask */
- false), /* pcrel_offset */
+ FALSE), /* pcrel_offset */
/* Like R_PPC64_GOT16, but for instructions with a DS field. */
HOWTO (R_PPC64_GOT16_DS, /* type */
0, /* rightshift */
1, /* size (0 = byte, 1 = short, 2 = long) */
16, /* bitsize */
- false, /* pc_relative */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_signed, /* complain_on_overflow */
ppc64_elf_unhandled_reloc, /* special_function */
"R_PPC64_GOT16_DS", /* name */
- false, /* partial_inplace */
+ FALSE, /* partial_inplace */
0, /* src_mask */
0xfffc, /* dst_mask */
- false), /* pcrel_offset */
+ FALSE), /* pcrel_offset */
/* Like R_PPC64_GOT16_LO, but for instructions with a DS field. */
HOWTO (R_PPC64_GOT16_LO_DS, /* type */
0, /* rightshift */
1, /* size (0 = byte, 1 = short, 2 = long) */
16, /* bitsize */
- false, /* pc_relative */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
ppc64_elf_unhandled_reloc, /* special_function */
"R_PPC64_GOT16_LO_DS", /* name */
- false, /* partial_inplace */
+ FALSE, /* partial_inplace */
0, /* src_mask */
0xfffc, /* dst_mask */
- false), /* pcrel_offset */
+ FALSE), /* pcrel_offset */
/* Like R_PPC64_PLT16_LO, but for instructions with a DS field. */
HOWTO (R_PPC64_PLT16_LO_DS, /* type */
0, /* rightshift */
1, /* size (0 = byte, 1 = short, 2 = long) */
16, /* bitsize */
- false, /* pc_relative */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
ppc64_elf_unhandled_reloc, /* special_function */
"R_PPC64_PLT16_LO_DS", /* name */
- false, /* partial_inplace */
+ FALSE, /* partial_inplace */
0, /* src_mask */
0xfffc, /* dst_mask */
- false), /* pcrel_offset */
+ FALSE), /* pcrel_offset */
/* Like R_PPC64_SECTOFF, but for instructions with a DS field. */
HOWTO (R_PPC64_SECTOFF_DS, /* type */
0, /* rightshift */
1, /* size (0 = byte, 1 = short, 2 = long) */
16, /* bitsize */
- false, /* pc_relative */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
ppc64_elf_sectoff_reloc, /* special_function */
"R_PPC64_SECTOFF_DS", /* name */
- false, /* partial_inplace */
+ FALSE, /* partial_inplace */
0, /* src_mask */
0xfffc, /* dst_mask */
- false), /* pcrel_offset */
+ FALSE), /* pcrel_offset */
/* Like R_PPC64_SECTOFF_LO, but for instructions with a DS field. */
HOWTO (R_PPC64_SECTOFF_LO_DS, /* type */
0, /* rightshift */
1, /* size (0 = byte, 1 = short, 2 = long) */
16, /* bitsize */
- false, /* pc_relative */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
ppc64_elf_sectoff_reloc, /* special_function */
"R_PPC64_SECTOFF_LO_DS",/* name */
- false, /* partial_inplace */
+ FALSE, /* partial_inplace */
0, /* src_mask */
0xfffc, /* dst_mask */
- false), /* pcrel_offset */
+ FALSE), /* pcrel_offset */
/* Like R_PPC64_TOC16, but for instructions with a DS field. */
HOWTO (R_PPC64_TOC16_DS, /* type */
0, /* rightshift */
1, /* size (0 = byte, 1 = short, 2 = long) */
16, /* bitsize */
- false, /* pc_relative */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_signed, /* complain_on_overflow */
ppc64_elf_toc_reloc, /* special_function */
"R_PPC64_TOC16_DS", /* name */
- false, /* partial_inplace */
+ FALSE, /* partial_inplace */
0, /* src_mask */
0xfffc, /* dst_mask */
- false), /* pcrel_offset */
+ FALSE), /* pcrel_offset */
/* Like R_PPC64_TOC16_LO, but for instructions with a DS field. */
HOWTO (R_PPC64_TOC16_LO_DS, /* type */
0, /* rightshift */
1, /* size (0 = byte, 1 = short, 2 = long) */
16, /* bitsize */
- false, /* pc_relative */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
ppc64_elf_toc_reloc, /* special_function */
"R_PPC64_TOC16_LO_DS", /* name */
- false, /* partial_inplace */
+ FALSE, /* partial_inplace */
0, /* src_mask */
0xfffc, /* dst_mask */
- false), /* pcrel_offset */
+ FALSE), /* pcrel_offset */
/* Like R_PPC64_PLTGOT16, but for instructions with a DS field. */
/* FIXME: R_PPC64_PLTGOT16_DS not implemented. */
@@ -1128,15 +1182,15 @@ static reloc_howto_type ppc64_elf_howto_raw[] = {
0, /* rightshift */
1, /* size (0 = byte, 1 = short, 2 = long) */
16, /* bitsize */
- false, /* pc_relative */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_signed, /* complain_on_overflow */
ppc64_elf_unhandled_reloc, /* special_function */
"R_PPC64_PLTGOT16_DS", /* name */
- false, /* partial_inplace */
+ FALSE, /* partial_inplace */
0, /* src_mask */
0xfffc, /* dst_mask */
- false), /* pcrel_offset */
+ FALSE), /* pcrel_offset */
/* Like R_PPC64_PLTGOT16_LO, but for instructions with a DS field. */
/* FIXME: R_PPC64_PLTGOT16_LO not implemented. */
@@ -1144,45 +1198,655 @@ static reloc_howto_type ppc64_elf_howto_raw[] = {
0, /* rightshift */
1, /* size (0 = byte, 1 = short, 2 = long) */
16, /* bitsize */
- false, /* pc_relative */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
ppc64_elf_unhandled_reloc, /* special_function */
"R_PPC64_PLTGOT16_LO_DS",/* name */
- false, /* partial_inplace */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0xfffc, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* Marker reloc for TLS. */
+ HOWTO (R_PPC64_TLS,
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 32, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_PPC64_TLS", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* Computes the load module index of the load module that contains the
+ definition of its TLS sym. */
+ HOWTO (R_PPC64_DTPMOD64,
+ 0, /* rightshift */
+ 4, /* size (0 = byte, 1 = short, 2 = long) */
+ 64, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ ppc64_elf_unhandled_reloc, /* special_function */
+ "R_PPC64_DTPMOD64", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ ONES (64), /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* Computes a dtv-relative displacement, the difference between the value
+ of sym+add and the base address of the thread-local storage block that
+ contains the definition of sym, minus 0x8000. */
+ HOWTO (R_PPC64_DTPREL64,
+ 0, /* rightshift */
+ 4, /* size (0 = byte, 1 = short, 2 = long) */
+ 64, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ ppc64_elf_unhandled_reloc, /* special_function */
+ "R_PPC64_DTPREL64", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ ONES (64), /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* A 16 bit dtprel reloc. */
+ HOWTO (R_PPC64_DTPREL16,
+ 0, /* rightshift */
+ 1, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_signed, /* complain_on_overflow */
+ ppc64_elf_unhandled_reloc, /* special_function */
+ "R_PPC64_DTPREL16", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0xffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* Like DTPREL16, but no overflow. */
+ HOWTO (R_PPC64_DTPREL16_LO,
+ 0, /* rightshift */
+ 1, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ ppc64_elf_unhandled_reloc, /* special_function */
+ "R_PPC64_DTPREL16_LO", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0xffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* Like DTPREL16_LO, but next higher group of 16 bits. */
+ HOWTO (R_PPC64_DTPREL16_HI,
+ 16, /* rightshift */
+ 1, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ ppc64_elf_unhandled_reloc, /* special_function */
+ "R_PPC64_DTPREL16_HI", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0xffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* Like DTPREL16_HI, but adjust for low 16 bits. */
+ HOWTO (R_PPC64_DTPREL16_HA,
+ 16, /* rightshift */
+ 1, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ ppc64_elf_unhandled_reloc, /* special_function */
+ "R_PPC64_DTPREL16_HA", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0xffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* Like DTPREL16_HI, but next higher group of 16 bits. */
+ HOWTO (R_PPC64_DTPREL16_HIGHER,
+ 32, /* rightshift */
+ 1, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ ppc64_elf_unhandled_reloc, /* special_function */
+ "R_PPC64_DTPREL16_HIGHER", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0xffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* Like DTPREL16_HIGHER, but adjust for low 16 bits. */
+ HOWTO (R_PPC64_DTPREL16_HIGHERA,
+ 32, /* rightshift */
+ 1, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ ppc64_elf_unhandled_reloc, /* special_function */
+ "R_PPC64_DTPREL16_HIGHERA", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0xffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* Like DTPREL16_HIGHER, but next higher group of 16 bits. */
+ HOWTO (R_PPC64_DTPREL16_HIGHEST,
+ 48, /* rightshift */
+ 1, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ ppc64_elf_unhandled_reloc, /* special_function */
+ "R_PPC64_DTPREL16_HIGHEST", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0xffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* Like DTPREL16_HIGHEST, but adjust for low 16 bits. */
+ HOWTO (R_PPC64_DTPREL16_HIGHESTA,
+ 48, /* rightshift */
+ 1, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ ppc64_elf_unhandled_reloc, /* special_function */
+ "R_PPC64_DTPREL16_HIGHESTA", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0xffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* Like DTPREL16, but for insns with a DS field. */
+ HOWTO (R_PPC64_DTPREL16_DS,
+ 0, /* rightshift */
+ 1, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_signed, /* complain_on_overflow */
+ ppc64_elf_unhandled_reloc, /* special_function */
+ "R_PPC64_DTPREL16_DS", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0xfffc, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* Like DTPREL16_DS, but no overflow. */
+ HOWTO (R_PPC64_DTPREL16_LO_DS,
+ 0, /* rightshift */
+ 1, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ ppc64_elf_unhandled_reloc, /* special_function */
+ "R_PPC64_DTPREL16_LO_DS", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0xfffc, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* Computes a tp-relative displacement, the difference between the value of
+ sym+add and the value of the thread pointer (r13). */
+ HOWTO (R_PPC64_TPREL64,
+ 0, /* rightshift */
+ 4, /* size (0 = byte, 1 = short, 2 = long) */
+ 64, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ ppc64_elf_unhandled_reloc, /* special_function */
+ "R_PPC64_TPREL64", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ ONES (64), /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* A 16 bit tprel reloc. */
+ HOWTO (R_PPC64_TPREL16,
+ 0, /* rightshift */
+ 1, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_signed, /* complain_on_overflow */
+ ppc64_elf_unhandled_reloc, /* special_function */
+ "R_PPC64_TPREL16", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0xffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* Like TPREL16, but no overflow. */
+ HOWTO (R_PPC64_TPREL16_LO,
+ 0, /* rightshift */
+ 1, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ ppc64_elf_unhandled_reloc, /* special_function */
+ "R_PPC64_TPREL16_LO", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0xffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* Like TPREL16_LO, but next higher group of 16 bits. */
+ HOWTO (R_PPC64_TPREL16_HI,
+ 16, /* rightshift */
+ 1, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ ppc64_elf_unhandled_reloc, /* special_function */
+ "R_PPC64_TPREL16_HI", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0xffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* Like TPREL16_HI, but adjust for low 16 bits. */
+ HOWTO (R_PPC64_TPREL16_HA,
+ 16, /* rightshift */
+ 1, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ ppc64_elf_unhandled_reloc, /* special_function */
+ "R_PPC64_TPREL16_HA", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0xffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* Like TPREL16_HI, but next higher group of 16 bits. */
+ HOWTO (R_PPC64_TPREL16_HIGHER,
+ 32, /* rightshift */
+ 1, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ ppc64_elf_unhandled_reloc, /* special_function */
+ "R_PPC64_TPREL16_HIGHER", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0xffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* Like TPREL16_HIGHER, but adjust for low 16 bits. */
+ HOWTO (R_PPC64_TPREL16_HIGHERA,
+ 32, /* rightshift */
+ 1, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ ppc64_elf_unhandled_reloc, /* special_function */
+ "R_PPC64_TPREL16_HIGHERA", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0xffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* Like TPREL16_HIGHER, but next higher group of 16 bits. */
+ HOWTO (R_PPC64_TPREL16_HIGHEST,
+ 48, /* rightshift */
+ 1, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ ppc64_elf_unhandled_reloc, /* special_function */
+ "R_PPC64_TPREL16_HIGHEST", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0xffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* Like TPREL16_HIGHEST, but adjust for low 16 bits. */
+ HOWTO (R_PPC64_TPREL16_HIGHESTA,
+ 48, /* rightshift */
+ 1, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ ppc64_elf_unhandled_reloc, /* special_function */
+ "R_PPC64_TPREL16_HIGHESTA", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0xffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* Like TPREL16, but for insns with a DS field. */
+ HOWTO (R_PPC64_TPREL16_DS,
+ 0, /* rightshift */
+ 1, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_signed, /* complain_on_overflow */
+ ppc64_elf_unhandled_reloc, /* special_function */
+ "R_PPC64_TPREL16_DS", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0xfffc, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* Like TPREL16_DS, but no overflow. */
+ HOWTO (R_PPC64_TPREL16_LO_DS,
+ 0, /* rightshift */
+ 1, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ ppc64_elf_unhandled_reloc, /* special_function */
+ "R_PPC64_TPREL16_LO_DS", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0xfffc, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* Allocates two contiguous entries in the GOT to hold a tls_index structure,
+ with values (sym+add)@dtpmod and (sym+add)@dtprel, and computes the offset
+ to the first entry relative to the TOC base (r2). */
+ HOWTO (R_PPC64_GOT_TLSGD16,
+ 0, /* rightshift */
+ 1, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_signed, /* complain_on_overflow */
+ ppc64_elf_unhandled_reloc, /* special_function */
+ "R_PPC64_GOT_TLSGD16", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0xffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* Like GOT_TLSGD16, but no overflow. */
+ HOWTO (R_PPC64_GOT_TLSGD16_LO,
+ 0, /* rightshift */
+ 1, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ ppc64_elf_unhandled_reloc, /* special_function */
+ "R_PPC64_GOT_TLSGD16_LO", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0xffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* Like GOT_TLSGD16_LO, but next higher group of 16 bits. */
+ HOWTO (R_PPC64_GOT_TLSGD16_HI,
+ 16, /* rightshift */
+ 1, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ ppc64_elf_unhandled_reloc, /* special_function */
+ "R_PPC64_GOT_TLSGD16_HI", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0xffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* Like GOT_TLSGD16_HI, but adjust for low 16 bits. */
+ HOWTO (R_PPC64_GOT_TLSGD16_HA,
+ 16, /* rightshift */
+ 1, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ ppc64_elf_unhandled_reloc, /* special_function */
+ "R_PPC64_GOT_TLSGD16_HA", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0xffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* Allocates two contiguous entries in the GOT to hold a tls_index structure,
+ with values (sym+add)@dtpmod and zero, and computes the offset to the
+ first entry relative to the TOC base (r2). */
+ HOWTO (R_PPC64_GOT_TLSLD16,
+ 0, /* rightshift */
+ 1, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_signed, /* complain_on_overflow */
+ ppc64_elf_unhandled_reloc, /* special_function */
+ "R_PPC64_GOT_TLSLD16", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0xffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* Like GOT_TLSLD16, but no overflow. */
+ HOWTO (R_PPC64_GOT_TLSLD16_LO,
+ 0, /* rightshift */
+ 1, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ ppc64_elf_unhandled_reloc, /* special_function */
+ "R_PPC64_GOT_TLSLD16_LO", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0xffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* Like GOT_TLSLD16_LO, but next higher group of 16 bits. */
+ HOWTO (R_PPC64_GOT_TLSLD16_HI,
+ 16, /* rightshift */
+ 1, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ ppc64_elf_unhandled_reloc, /* special_function */
+ "R_PPC64_GOT_TLSLD16_HI", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0xffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* Like GOT_TLSLD16_HI, but adjust for low 16 bits. */
+ HOWTO (R_PPC64_GOT_TLSLD16_HA,
+ 16, /* rightshift */
+ 1, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ ppc64_elf_unhandled_reloc, /* special_function */
+ "R_PPC64_GOT_TLSLD16_HA", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0xffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* Allocates an entry in the GOT with value (sym+add)@dtprel, and computes
+ the offset to the entry relative to the TOC base (r2). */
+ HOWTO (R_PPC64_GOT_DTPREL16_DS,
+ 0, /* rightshift */
+ 1, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_signed, /* complain_on_overflow */
+ ppc64_elf_unhandled_reloc, /* special_function */
+ "R_PPC64_GOT_DTPREL16_DS", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0xfffc, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* Like GOT_DTPREL16_DS, but no overflow. */
+ HOWTO (R_PPC64_GOT_DTPREL16_LO_DS,
+ 0, /* rightshift */
+ 1, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ ppc64_elf_unhandled_reloc, /* special_function */
+ "R_PPC64_GOT_DTPREL16_LO_DS", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0xfffc, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* Like GOT_DTPREL16_LO_DS, but next higher group of 16 bits. */
+ HOWTO (R_PPC64_GOT_DTPREL16_HI,
+ 16, /* rightshift */
+ 1, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ ppc64_elf_unhandled_reloc, /* special_function */
+ "R_PPC64_GOT_DTPREL16_HI", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0xffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* Like GOT_DTPREL16_HI, but adjust for low 16 bits. */
+ HOWTO (R_PPC64_GOT_DTPREL16_HA,
+ 16, /* rightshift */
+ 1, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ ppc64_elf_unhandled_reloc, /* special_function */
+ "R_PPC64_GOT_DTPREL16_HA", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0xffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* Allocates an entry in the GOT with value (sym+add)@tprel, and computes the
+ offset to the entry relative to the TOC base (r2). */
+ HOWTO (R_PPC64_GOT_TPREL16_DS,
+ 0, /* rightshift */
+ 1, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_signed, /* complain_on_overflow */
+ ppc64_elf_unhandled_reloc, /* special_function */
+ "R_PPC64_GOT_TPREL16_DS", /* name */
+ FALSE, /* partial_inplace */
0, /* src_mask */
0xfffc, /* dst_mask */
- false), /* pcrel_offset */
+ FALSE), /* pcrel_offset */
+
+ /* Like GOT_TPREL16_DS, but no overflow. */
+ HOWTO (R_PPC64_GOT_TPREL16_LO_DS,
+ 0, /* rightshift */
+ 1, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ ppc64_elf_unhandled_reloc, /* special_function */
+ "R_PPC64_GOT_TPREL16_LO_DS", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0xfffc, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* Like GOT_TPREL16_LO_DS, but next higher group of 16 bits. */
+ HOWTO (R_PPC64_GOT_TPREL16_HI,
+ 16, /* rightshift */
+ 1, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ ppc64_elf_unhandled_reloc, /* special_function */
+ "R_PPC64_GOT_TPREL16_HI", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0xffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* Like GOT_TPREL16_HI, but adjust for low 16 bits. */
+ HOWTO (R_PPC64_GOT_TPREL16_HA,
+ 16, /* rightshift */
+ 1, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ ppc64_elf_unhandled_reloc, /* special_function */
+ "R_PPC64_GOT_TPREL16_HA", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0xffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
/* GNU extension to record C++ vtable hierarchy. */
HOWTO (R_PPC64_GNU_VTINHERIT, /* type */
0, /* rightshift */
0, /* size (0 = byte, 1 = short, 2 = long) */
0, /* bitsize */
- false, /* pc_relative */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
NULL, /* special_function */
"R_PPC64_GNU_VTINHERIT", /* name */
- false, /* partial_inplace */
+ FALSE, /* partial_inplace */
0, /* src_mask */
0, /* dst_mask */
- false), /* pcrel_offset */
+ FALSE), /* pcrel_offset */
/* GNU extension to record C++ vtable member usage. */
HOWTO (R_PPC64_GNU_VTENTRY, /* type */
0, /* rightshift */
0, /* size (0 = byte, 1 = short, 2 = long) */
0, /* bitsize */
- false, /* pc_relative */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
NULL, /* special_function */
"R_PPC64_GNU_VTENTRY", /* name */
- false, /* partial_inplace */
+ FALSE, /* partial_inplace */
0, /* src_mask */
0, /* dst_mask */
- false), /* pcrel_offset */
+ FALSE), /* pcrel_offset */
};
@@ -1190,7 +1854,7 @@ static reloc_howto_type ppc64_elf_howto_raw[] = {
be done. */
static void
-ppc_howto_init ()
+ppc_howto_init (void)
{
unsigned int i, type;
@@ -1206,155 +1870,232 @@ ppc_howto_init ()
}
static reloc_howto_type *
-ppc64_elf_reloc_type_lookup (abfd, code)
- bfd *abfd ATTRIBUTE_UNUSED;
- bfd_reloc_code_real_type code;
+ppc64_elf_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED,
+ bfd_reloc_code_real_type code)
{
- enum elf_ppc_reloc_type ppc_reloc = R_PPC_NONE;
+ enum elf_ppc64_reloc_type r = R_PPC64_NONE;
if (!ppc64_elf_howto_table[R_PPC64_ADDR32])
/* Initialize howto table if needed. */
ppc_howto_init ();
- switch ((int) code)
+ switch (code)
{
default:
- return (reloc_howto_type *) NULL;
+ return NULL;
- case BFD_RELOC_NONE: ppc_reloc = R_PPC64_NONE;
+ case BFD_RELOC_NONE: r = R_PPC64_NONE;
+ break;
+ case BFD_RELOC_32: r = R_PPC64_ADDR32;
+ break;
+ case BFD_RELOC_PPC_BA26: r = R_PPC64_ADDR24;
+ break;
+ case BFD_RELOC_16: r = R_PPC64_ADDR16;
+ break;
+ case BFD_RELOC_LO16: r = R_PPC64_ADDR16_LO;
+ break;
+ case BFD_RELOC_HI16: r = R_PPC64_ADDR16_HI;
+ break;
+ case BFD_RELOC_HI16_S: r = R_PPC64_ADDR16_HA;
+ break;
+ case BFD_RELOC_PPC_BA16: r = R_PPC64_ADDR14;
+ break;
+ case BFD_RELOC_PPC_BA16_BRTAKEN: r = R_PPC64_ADDR14_BRTAKEN;
+ break;
+ case BFD_RELOC_PPC_BA16_BRNTAKEN: r = R_PPC64_ADDR14_BRNTAKEN;
+ break;
+ case BFD_RELOC_PPC_B26: r = R_PPC64_REL24;
+ break;
+ case BFD_RELOC_PPC_B16: r = R_PPC64_REL14;
+ break;
+ case BFD_RELOC_PPC_B16_BRTAKEN: r = R_PPC64_REL14_BRTAKEN;
+ break;
+ case BFD_RELOC_PPC_B16_BRNTAKEN: r = R_PPC64_REL14_BRNTAKEN;
+ break;
+ case BFD_RELOC_16_GOTOFF: r = R_PPC64_GOT16;
+ break;
+ case BFD_RELOC_LO16_GOTOFF: r = R_PPC64_GOT16_LO;
+ break;
+ case BFD_RELOC_HI16_GOTOFF: r = R_PPC64_GOT16_HI;
+ break;
+ case BFD_RELOC_HI16_S_GOTOFF: r = R_PPC64_GOT16_HA;
+ break;
+ case BFD_RELOC_PPC_COPY: r = R_PPC64_COPY;
+ break;
+ case BFD_RELOC_PPC_GLOB_DAT: r = R_PPC64_GLOB_DAT;
+ break;
+ case BFD_RELOC_32_PCREL: r = R_PPC64_REL32;
+ break;
+ case BFD_RELOC_32_PLTOFF: r = R_PPC64_PLT32;
+ break;
+ case BFD_RELOC_32_PLT_PCREL: r = R_PPC64_PLTREL32;
+ break;
+ case BFD_RELOC_LO16_PLTOFF: r = R_PPC64_PLT16_LO;
+ break;
+ case BFD_RELOC_HI16_PLTOFF: r = R_PPC64_PLT16_HI;
+ break;
+ case BFD_RELOC_HI16_S_PLTOFF: r = R_PPC64_PLT16_HA;
+ break;
+ case BFD_RELOC_16_BASEREL: r = R_PPC64_SECTOFF;
+ break;
+ case BFD_RELOC_LO16_BASEREL: r = R_PPC64_SECTOFF_LO;
+ break;
+ case BFD_RELOC_HI16_BASEREL: r = R_PPC64_SECTOFF_HI;
+ break;
+ case BFD_RELOC_HI16_S_BASEREL: r = R_PPC64_SECTOFF_HA;
break;
- case BFD_RELOC_32: ppc_reloc = R_PPC64_ADDR32;
+ case BFD_RELOC_CTOR: r = R_PPC64_ADDR64;
break;
- case BFD_RELOC_PPC_BA26: ppc_reloc = R_PPC64_ADDR24;
+ case BFD_RELOC_64: r = R_PPC64_ADDR64;
break;
- case BFD_RELOC_16: ppc_reloc = R_PPC64_ADDR16;
+ case BFD_RELOC_PPC64_HIGHER: r = R_PPC64_ADDR16_HIGHER;
break;
- case BFD_RELOC_LO16: ppc_reloc = R_PPC64_ADDR16_LO;
+ case BFD_RELOC_PPC64_HIGHER_S: r = R_PPC64_ADDR16_HIGHERA;
break;
- case BFD_RELOC_HI16: ppc_reloc = R_PPC64_ADDR16_HI;
+ case BFD_RELOC_PPC64_HIGHEST: r = R_PPC64_ADDR16_HIGHEST;
break;
- case BFD_RELOC_HI16_S: ppc_reloc = R_PPC64_ADDR16_HA;
+ case BFD_RELOC_PPC64_HIGHEST_S: r = R_PPC64_ADDR16_HIGHESTA;
break;
- case BFD_RELOC_PPC_BA16: ppc_reloc = R_PPC64_ADDR14;
+ case BFD_RELOC_64_PCREL: r = R_PPC64_REL64;
break;
- case BFD_RELOC_PPC_BA16_BRTAKEN: ppc_reloc = R_PPC64_ADDR14_BRTAKEN;
+ case BFD_RELOC_64_PLTOFF: r = R_PPC64_PLT64;
break;
- case BFD_RELOC_PPC_BA16_BRNTAKEN: ppc_reloc = R_PPC64_ADDR14_BRNTAKEN;
+ case BFD_RELOC_64_PLT_PCREL: r = R_PPC64_PLTREL64;
break;
- case BFD_RELOC_PPC_B26: ppc_reloc = R_PPC64_REL24;
+ case BFD_RELOC_PPC_TOC16: r = R_PPC64_TOC16;
break;
- case BFD_RELOC_PPC_B16: ppc_reloc = R_PPC64_REL14;
+ case BFD_RELOC_PPC64_TOC16_LO: r = R_PPC64_TOC16_LO;
break;
- case BFD_RELOC_PPC_B16_BRTAKEN: ppc_reloc = R_PPC64_REL14_BRTAKEN;
+ case BFD_RELOC_PPC64_TOC16_HI: r = R_PPC64_TOC16_HI;
break;
- case BFD_RELOC_PPC_B16_BRNTAKEN: ppc_reloc = R_PPC64_REL14_BRNTAKEN;
+ case BFD_RELOC_PPC64_TOC16_HA: r = R_PPC64_TOC16_HA;
break;
- case BFD_RELOC_16_GOTOFF: ppc_reloc = R_PPC64_GOT16;
+ case BFD_RELOC_PPC64_TOC: r = R_PPC64_TOC;
break;
- case BFD_RELOC_LO16_GOTOFF: ppc_reloc = R_PPC64_GOT16_LO;
+ case BFD_RELOC_PPC64_PLTGOT16: r = R_PPC64_PLTGOT16;
break;
- case BFD_RELOC_HI16_GOTOFF: ppc_reloc = R_PPC64_GOT16_HI;
+ case BFD_RELOC_PPC64_PLTGOT16_LO: r = R_PPC64_PLTGOT16_LO;
break;
- case BFD_RELOC_HI16_S_GOTOFF: ppc_reloc = R_PPC64_GOT16_HA;
+ case BFD_RELOC_PPC64_PLTGOT16_HI: r = R_PPC64_PLTGOT16_HI;
break;
- case BFD_RELOC_PPC_COPY: ppc_reloc = R_PPC64_COPY;
+ case BFD_RELOC_PPC64_PLTGOT16_HA: r = R_PPC64_PLTGOT16_HA;
break;
- case BFD_RELOC_PPC_GLOB_DAT: ppc_reloc = R_PPC64_GLOB_DAT;
+ case BFD_RELOC_PPC64_ADDR16_DS: r = R_PPC64_ADDR16_DS;
break;
- case BFD_RELOC_32_PCREL: ppc_reloc = R_PPC64_REL32;
+ case BFD_RELOC_PPC64_ADDR16_LO_DS: r = R_PPC64_ADDR16_LO_DS;
break;
- case BFD_RELOC_32_PLTOFF: ppc_reloc = R_PPC64_PLT32;
+ case BFD_RELOC_PPC64_GOT16_DS: r = R_PPC64_GOT16_DS;
break;
- case BFD_RELOC_32_PLT_PCREL: ppc_reloc = R_PPC64_PLTREL32;
+ case BFD_RELOC_PPC64_GOT16_LO_DS: r = R_PPC64_GOT16_LO_DS;
break;
- case BFD_RELOC_LO16_PLTOFF: ppc_reloc = R_PPC64_PLT16_LO;
+ case BFD_RELOC_PPC64_PLT16_LO_DS: r = R_PPC64_PLT16_LO_DS;
break;
- case BFD_RELOC_HI16_PLTOFF: ppc_reloc = R_PPC64_PLT16_HI;
+ case BFD_RELOC_PPC64_SECTOFF_DS: r = R_PPC64_SECTOFF_DS;
break;
- case BFD_RELOC_HI16_S_PLTOFF: ppc_reloc = R_PPC64_PLT16_HA;
+ case BFD_RELOC_PPC64_SECTOFF_LO_DS: r = R_PPC64_SECTOFF_LO_DS;
break;
- case BFD_RELOC_16_BASEREL: ppc_reloc = R_PPC64_SECTOFF;
+ case BFD_RELOC_PPC64_TOC16_DS: r = R_PPC64_TOC16_DS;
break;
- case BFD_RELOC_LO16_BASEREL: ppc_reloc = R_PPC64_SECTOFF_LO;
+ case BFD_RELOC_PPC64_TOC16_LO_DS: r = R_PPC64_TOC16_LO_DS;
break;
- case BFD_RELOC_HI16_BASEREL: ppc_reloc = R_PPC64_SECTOFF_HI;
+ case BFD_RELOC_PPC64_PLTGOT16_DS: r = R_PPC64_PLTGOT16_DS;
break;
- case BFD_RELOC_HI16_S_BASEREL: ppc_reloc = R_PPC64_SECTOFF_HA;
+ case BFD_RELOC_PPC64_PLTGOT16_LO_DS: r = R_PPC64_PLTGOT16_LO_DS;
break;
- case BFD_RELOC_CTOR: ppc_reloc = R_PPC64_ADDR64;
+ case BFD_RELOC_PPC_TLS: r = R_PPC64_TLS;
break;
- case BFD_RELOC_64: ppc_reloc = R_PPC64_ADDR64;
+ case BFD_RELOC_PPC_DTPMOD: r = R_PPC64_DTPMOD64;
break;
- case BFD_RELOC_PPC64_HIGHER: ppc_reloc = R_PPC64_ADDR16_HIGHER;
+ case BFD_RELOC_PPC_TPREL16: r = R_PPC64_TPREL16;
break;
- case BFD_RELOC_PPC64_HIGHER_S: ppc_reloc = R_PPC64_ADDR16_HIGHERA;
+ case BFD_RELOC_PPC_TPREL16_LO: r = R_PPC64_TPREL16_LO;
break;
- case BFD_RELOC_PPC64_HIGHEST: ppc_reloc = R_PPC64_ADDR16_HIGHEST;
+ case BFD_RELOC_PPC_TPREL16_HI: r = R_PPC64_TPREL16_HI;
break;
- case BFD_RELOC_PPC64_HIGHEST_S: ppc_reloc = R_PPC64_ADDR16_HIGHESTA;
+ case BFD_RELOC_PPC_TPREL16_HA: r = R_PPC64_TPREL16_HA;
break;
- case BFD_RELOC_64_PCREL: ppc_reloc = R_PPC64_REL64;
+ case BFD_RELOC_PPC_TPREL: r = R_PPC64_TPREL64;
break;
- case BFD_RELOC_64_PLTOFF: ppc_reloc = R_PPC64_PLT64;
+ case BFD_RELOC_PPC_DTPREL16: r = R_PPC64_DTPREL16;
break;
- case BFD_RELOC_64_PLT_PCREL: ppc_reloc = R_PPC64_PLTREL64;
+ case BFD_RELOC_PPC_DTPREL16_LO: r = R_PPC64_DTPREL16_LO;
break;
- case BFD_RELOC_PPC_TOC16: ppc_reloc = R_PPC64_TOC16;
+ case BFD_RELOC_PPC_DTPREL16_HI: r = R_PPC64_DTPREL16_HI;
break;
- case BFD_RELOC_PPC64_TOC16_LO: ppc_reloc = R_PPC64_TOC16_LO;
+ case BFD_RELOC_PPC_DTPREL16_HA: r = R_PPC64_DTPREL16_HA;
break;
- case BFD_RELOC_PPC64_TOC16_HI: ppc_reloc = R_PPC64_TOC16_HI;
+ case BFD_RELOC_PPC_DTPREL: r = R_PPC64_DTPREL64;
break;
- case BFD_RELOC_PPC64_TOC16_HA: ppc_reloc = R_PPC64_TOC16_HA;
+ case BFD_RELOC_PPC_GOT_TLSGD16: r = R_PPC64_GOT_TLSGD16;
break;
- case BFD_RELOC_PPC64_TOC: ppc_reloc = R_PPC64_TOC;
+ case BFD_RELOC_PPC_GOT_TLSGD16_LO: r = R_PPC64_GOT_TLSGD16_LO;
break;
- case BFD_RELOC_PPC64_PLTGOT16: ppc_reloc = R_PPC64_PLTGOT16;
+ case BFD_RELOC_PPC_GOT_TLSGD16_HI: r = R_PPC64_GOT_TLSGD16_HI;
break;
- case BFD_RELOC_PPC64_PLTGOT16_LO: ppc_reloc = R_PPC64_PLTGOT16_LO;
+ case BFD_RELOC_PPC_GOT_TLSGD16_HA: r = R_PPC64_GOT_TLSGD16_HA;
break;
- case BFD_RELOC_PPC64_PLTGOT16_HI: ppc_reloc = R_PPC64_PLTGOT16_HI;
+ case BFD_RELOC_PPC_GOT_TLSLD16: r = R_PPC64_GOT_TLSLD16;
break;
- case BFD_RELOC_PPC64_PLTGOT16_HA: ppc_reloc = R_PPC64_PLTGOT16_HA;
+ case BFD_RELOC_PPC_GOT_TLSLD16_LO: r = R_PPC64_GOT_TLSLD16_LO;
break;
- case BFD_RELOC_PPC64_ADDR16_DS: ppc_reloc = R_PPC64_ADDR16_DS;
+ case BFD_RELOC_PPC_GOT_TLSLD16_HI: r = R_PPC64_GOT_TLSLD16_HI;
break;
- case BFD_RELOC_PPC64_ADDR16_LO_DS: ppc_reloc = R_PPC64_ADDR16_LO_DS;
+ case BFD_RELOC_PPC_GOT_TLSLD16_HA: r = R_PPC64_GOT_TLSLD16_HA;
break;
- case BFD_RELOC_PPC64_GOT16_DS: ppc_reloc = R_PPC64_GOT16_DS;
+ case BFD_RELOC_PPC_GOT_TPREL16: r = R_PPC64_GOT_TPREL16_DS;
break;
- case BFD_RELOC_PPC64_GOT16_LO_DS: ppc_reloc = R_PPC64_GOT16_LO_DS;
+ case BFD_RELOC_PPC_GOT_TPREL16_LO: r = R_PPC64_GOT_TPREL16_LO_DS;
break;
- case BFD_RELOC_PPC64_PLT16_LO_DS: ppc_reloc = R_PPC64_PLT16_LO_DS;
+ case BFD_RELOC_PPC_GOT_TPREL16_HI: r = R_PPC64_GOT_TPREL16_HI;
break;
- case BFD_RELOC_PPC64_SECTOFF_DS: ppc_reloc = R_PPC64_SECTOFF_DS;
+ case BFD_RELOC_PPC_GOT_TPREL16_HA: r = R_PPC64_GOT_TPREL16_HA;
break;
- case BFD_RELOC_PPC64_SECTOFF_LO_DS: ppc_reloc = R_PPC64_SECTOFF_LO_DS;
+ case BFD_RELOC_PPC_GOT_DTPREL16: r = R_PPC64_GOT_DTPREL16_DS;
break;
- case BFD_RELOC_PPC64_TOC16_DS: ppc_reloc = R_PPC64_TOC16_DS;
+ case BFD_RELOC_PPC_GOT_DTPREL16_LO: r = R_PPC64_GOT_DTPREL16_LO_DS;
break;
- case BFD_RELOC_PPC64_TOC16_LO_DS: ppc_reloc = R_PPC64_TOC16_LO_DS;
+ case BFD_RELOC_PPC_GOT_DTPREL16_HI: r = R_PPC64_GOT_DTPREL16_HI;
break;
- case BFD_RELOC_PPC64_PLTGOT16_DS: ppc_reloc = R_PPC64_PLTGOT16_DS;
+ case BFD_RELOC_PPC_GOT_DTPREL16_HA: r = R_PPC64_GOT_DTPREL16_HA;
break;
- case BFD_RELOC_PPC64_PLTGOT16_LO_DS: ppc_reloc = R_PPC64_PLTGOT16_LO_DS;
+ case BFD_RELOC_PPC64_TPREL16_DS: r = R_PPC64_TPREL16_DS;
break;
- case BFD_RELOC_VTABLE_INHERIT: ppc_reloc = R_PPC64_GNU_VTINHERIT;
+ case BFD_RELOC_PPC64_TPREL16_LO_DS: r = R_PPC64_TPREL16_LO_DS;
break;
- case BFD_RELOC_VTABLE_ENTRY: ppc_reloc = R_PPC64_GNU_VTENTRY;
+ case BFD_RELOC_PPC64_TPREL16_HIGHER: r = R_PPC64_TPREL16_HIGHER;
+ break;
+ case BFD_RELOC_PPC64_TPREL16_HIGHERA: r = R_PPC64_TPREL16_HIGHERA;
+ break;
+ case BFD_RELOC_PPC64_TPREL16_HIGHEST: r = R_PPC64_TPREL16_HIGHEST;
+ break;
+ case BFD_RELOC_PPC64_TPREL16_HIGHESTA: r = R_PPC64_TPREL16_HIGHESTA;
+ break;
+ case BFD_RELOC_PPC64_DTPREL16_DS: r = R_PPC64_DTPREL16_DS;
+ break;
+ case BFD_RELOC_PPC64_DTPREL16_LO_DS: r = R_PPC64_DTPREL16_LO_DS;
+ break;
+ case BFD_RELOC_PPC64_DTPREL16_HIGHER: r = R_PPC64_DTPREL16_HIGHER;
+ break;
+ case BFD_RELOC_PPC64_DTPREL16_HIGHERA: r = R_PPC64_DTPREL16_HIGHERA;
+ break;
+ case BFD_RELOC_PPC64_DTPREL16_HIGHEST: r = R_PPC64_DTPREL16_HIGHEST;
+ break;
+ case BFD_RELOC_PPC64_DTPREL16_HIGHESTA: r = R_PPC64_DTPREL16_HIGHESTA;
+ break;
+ case BFD_RELOC_VTABLE_INHERIT: r = R_PPC64_GNU_VTINHERIT;
+ break;
+ case BFD_RELOC_VTABLE_ENTRY: r = R_PPC64_GNU_VTENTRY;
break;
}
- return ppc64_elf_howto_table[(int) ppc_reloc];
+ return ppc64_elf_howto_table[r];
};
/* Set the howto pointer for a PowerPC ELF reloc. */
static void
-ppc64_elf_info_to_howto (abfd, cache_ptr, dst)
- bfd *abfd ATTRIBUTE_UNUSED;
- arelent *cache_ptr;
- Elf64_Internal_Rela *dst;
+ppc64_elf_info_to_howto (bfd *abfd ATTRIBUTE_UNUSED, arelent *cache_ptr,
+ Elf_Internal_Rela *dst)
{
unsigned int type;
@@ -1368,18 +2109,12 @@ ppc64_elf_info_to_howto (abfd, cache_ptr, dst)
cache_ptr->howto = ppc64_elf_howto_table[type];
}
-/* Handle the R_PPC_ADDR16_HA and similar relocs. */
+/* Handle the R_PPC64_ADDR16_HA and similar relocs. */
static bfd_reloc_status_type
-ppc64_elf_ha_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;
+ppc64_elf_ha_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol,
+ void *data, asection *input_section,
+ bfd *output_bfd, char **error_message)
{
/* If this is a relocatable link (output_bfd test tells us), just
call the generic function. Any adjustment will be done at final
@@ -1396,21 +2131,15 @@ ppc64_elf_ha_reloc (abfd, reloc_entry, symbol, data,
}
static bfd_reloc_status_type
-ppc64_elf_brtaken_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;
+ppc64_elf_brtaken_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol,
+ void *data, asection *input_section,
+ bfd *output_bfd, char **error_message)
{
long insn;
- enum elf_ppc_reloc_type r_type;
+ enum elf_ppc64_reloc_type r_type;
bfd_size_type octets;
/* Disabled until we sort out how ld should choose 'y' vs 'at'. */
- boolean is_power4 = false;
+ bfd_boolean is_power4 = FALSE;
/* If this is a relocatable link (output_bfd test tells us), just
call the generic function. Any adjustment will be done at final
@@ -1422,7 +2151,7 @@ ppc64_elf_brtaken_reloc (abfd, reloc_entry, symbol, data,
octets = reloc_entry->address * bfd_octets_per_byte (abfd);
insn = bfd_get_32 (abfd, (bfd_byte *) data + octets);
insn &= ~(0x01 << 21);
- r_type = (enum elf_ppc_reloc_type) reloc_entry->howto->type;
+ r_type = reloc_entry->howto->type;
if (r_type == R_PPC64_ADDR14_BRTAKEN
|| r_type == R_PPC64_REL14_BRTAKEN)
insn |= 0x01 << 21; /* 'y' or 't' bit, lowest bit of BO field. */
@@ -1458,20 +2187,14 @@ ppc64_elf_brtaken_reloc (abfd, reloc_entry, symbol, data,
if ((bfd_signed_vma) (target - from) < 0)
insn ^= 0x01 << 21;
}
- bfd_put_32 (abfd, (bfd_vma) insn, (bfd_byte *) data + octets);
+ bfd_put_32 (abfd, insn, (bfd_byte *) data + octets);
return bfd_reloc_continue;
}
static bfd_reloc_status_type
-ppc64_elf_sectoff_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;
+ppc64_elf_sectoff_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol,
+ void *data, asection *input_section,
+ bfd *output_bfd, char **error_message)
{
/* If this is a relocatable link (output_bfd test tells us), just
call the generic function. Any adjustment will be done at final
@@ -1486,15 +2209,9 @@ ppc64_elf_sectoff_reloc (abfd, reloc_entry, symbol, data,
}
static bfd_reloc_status_type
-ppc64_elf_sectoff_ha_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;
+ppc64_elf_sectoff_ha_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol,
+ void *data, asection *input_section,
+ bfd *output_bfd, char **error_message)
{
/* If this is a relocatable link (output_bfd test tells us), just
call the generic function. Any adjustment will be done at final
@@ -1512,15 +2229,9 @@ ppc64_elf_sectoff_ha_reloc (abfd, reloc_entry, symbol, data,
}
static bfd_reloc_status_type
-ppc64_elf_toc_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;
+ppc64_elf_toc_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol,
+ void *data, asection *input_section,
+ bfd *output_bfd, char **error_message)
{
bfd_vma TOCstart;
@@ -1541,15 +2252,9 @@ ppc64_elf_toc_reloc (abfd, reloc_entry, symbol, data,
}
static bfd_reloc_status_type
-ppc64_elf_toc_ha_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;
+ppc64_elf_toc_ha_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol,
+ void *data, asection *input_section,
+ bfd *output_bfd, char **error_message)
{
bfd_vma TOCstart;
@@ -1573,15 +2278,9 @@ ppc64_elf_toc_ha_reloc (abfd, reloc_entry, symbol, data,
}
static bfd_reloc_status_type
-ppc64_elf_toc64_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;
+ppc64_elf_toc64_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol,
+ void *data, asection *input_section,
+ bfd *output_bfd, char **error_message)
{
bfd_vma TOCstart;
bfd_size_type octets;
@@ -1603,15 +2302,9 @@ ppc64_elf_toc64_reloc (abfd, reloc_entry, symbol, data,
}
static bfd_reloc_status_type
-ppc64_elf_unhandled_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;
+ppc64_elf_unhandled_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol,
+ void *data, asection *input_section,
+ bfd *output_bfd, char **error_message)
{
/* If this is a relocatable link (output_bfd test tells us), just
call the generic function. Any adjustment will be done at final
@@ -1630,12 +2323,45 @@ ppc64_elf_unhandled_reloc (abfd, reloc_entry, symbol, data,
return bfd_reloc_dangerous;
}
+struct ppc64_elf_obj_tdata
+{
+ struct elf_obj_tdata elf;
+
+ /* Shortcuts to dynamic linker sections. */
+ asection *got;
+ asection *relgot;
+
+ /* TLS local dynamic got entry handling. Suppose for multiple GOT
+ sections means we potentially need one of these for each input bfd. */
+ union {
+ bfd_signed_vma refcount;
+ bfd_vma offset;
+ } tlsld_got;
+};
+
+#define ppc64_elf_tdata(bfd) \
+ ((struct ppc64_elf_obj_tdata *) (bfd)->tdata.any)
+
+#define ppc64_tlsld_got(bfd) \
+ (&ppc64_elf_tdata (bfd)->tlsld_got)
+
+/* Override the generic function because we store some extras. */
+
+static bfd_boolean
+ppc64_elf_mkobject (bfd *abfd)
+{
+ bfd_size_type amt = sizeof (struct ppc64_elf_obj_tdata);
+ abfd->tdata.any = bfd_zalloc (abfd, amt);
+ if (abfd->tdata.any == NULL)
+ return FALSE;
+ return TRUE;
+}
+
/* Fix bad default arch selected for a 64 bit input bfd when the
default is 32 bit. */
-static boolean
-ppc64_elf_object_p (abfd)
- bfd *abfd;
+static bfd_boolean
+ppc64_elf_object_p (bfd *abfd)
{
if (abfd->arch_info->the_default && abfd->arch_info->bits_per_word == 32)
{
@@ -1648,16 +2374,53 @@ ppc64_elf_object_p (abfd)
BFD_ASSERT (abfd->arch_info->bits_per_word == 64);
}
}
- return true;
+ return TRUE;
+}
+
+/* Support for core dump NOTE sections. */
+
+static bfd_boolean
+ppc64_elf_grok_prstatus (bfd *abfd, Elf_Internal_Note *note)
+{
+ size_t offset, raw_size;
+
+ if (note->descsz != 504)
+ return FALSE;
+
+ /* pr_cursig */
+ elf_tdata (abfd)->core_signal = bfd_get_16 (abfd, note->descdata + 12);
+
+ /* pr_pid */
+ elf_tdata (abfd)->core_pid = bfd_get_32 (abfd, note->descdata + 32);
+
+ /* pr_reg */
+ offset = 112;
+ raw_size = 384;
+
+ /* Make a ".reg/999" section. */
+ return _bfd_elfcore_make_pseudosection (abfd, ".reg",
+ raw_size, note->descpos + offset);
+}
+
+static bfd_boolean
+ppc64_elf_grok_psinfo (bfd *abfd, Elf_Internal_Note *note)
+{
+ if (note->descsz != 136)
+ return FALSE;
+
+ elf_tdata (abfd)->core_program
+ = _bfd_elfcore_strndup (abfd, note->descdata + 40, 16);
+ elf_tdata (abfd)->core_command
+ = _bfd_elfcore_strndup (abfd, note->descdata + 56, 80);
+
+ return TRUE;
}
/* Merge backend specific data from an object file to the output
object file when linking. */
-static boolean
-ppc64_elf_merge_private_bfd_data (ibfd, obfd)
- bfd *ibfd;
- bfd *obfd;
+static bfd_boolean
+ppc64_elf_merge_private_bfd_data (bfd *ibfd, bfd *obfd)
{
/* Check if we have the same endianess. */
if (ibfd->xvec->byteorder != obfd->xvec->byteorder
@@ -1667,17 +2430,67 @@ ppc64_elf_merge_private_bfd_data (ibfd, obfd)
const char *msg;
if (bfd_big_endian (ibfd))
- msg = _("%s: compiled for a big endian system and target is little endian");
+ msg = _("%s: compiled for a big endian system "
+ "and target is little endian");
else
- msg = _("%s: compiled for a little endian system and target is big endian");
+ msg = _("%s: compiled for a little endian system "
+ "and target is big endian");
(*_bfd_error_handler) (msg, bfd_archive_filename (ibfd));
bfd_set_error (bfd_error_wrong_format);
- return false;
+ return FALSE;
}
- return true;
+ return TRUE;
+}
+
+/* Add extra PPC sections. */
+
+static struct bfd_elf_special_section const ppc64_elf_special_sections[]=
+{
+ { ".sdata", 6, -2, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE },
+ { ".sbss", 5, -2, SHT_NOBITS, SHF_ALLOC + SHF_WRITE },
+ { ".plt", 4, 0, SHT_NOBITS, 0 },
+ { ".toc", 4, 0, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE },
+ { ".toc1", 5, 0, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE },
+ { ".tocbss", 7, 0, SHT_NOBITS, SHF_ALLOC + SHF_WRITE },
+ { NULL, 0, 0, 0, 0 }
+};
+
+struct _ppc64_elf_section_data
+{
+ struct bfd_elf_section_data elf;
+
+ /* An array with one entry for each opd function descriptor. */
+ union
+ {
+ /* Points to the function code section for local opd entries. */
+ asection **func_sec;
+ /* After editing .opd, adjust references to opd local syms. */
+ long *adjust;
+ } opd;
+
+ /* An array for toc sections, indexed by offset/8.
+ Specifies the relocation symbol index used at a given toc offset. */
+ unsigned *t_symndx;
+};
+
+#define ppc64_elf_section_data(sec) \
+ ((struct _ppc64_elf_section_data *) elf_section_data (sec))
+
+static bfd_boolean
+ppc64_elf_new_section_hook (bfd *abfd, asection *sec)
+{
+ struct _ppc64_elf_section_data *sdata;
+ bfd_size_type amt = sizeof (*sdata);
+
+ sdata = bfd_zalloc (abfd, amt);
+ if (sdata == NULL)
+ return FALSE;
+ sec->used_by_bfd = sdata;
+
+ return _bfd_elf_new_section_hook (abfd, sec);
}
/* The following functions are specific to the ELF linker, while
@@ -1720,7 +2533,7 @@ ppc64_elf_merge_private_bfd_data (ibfd, obfd)
.
. .foo_stub:
. addis 12,2,Lfoo@toc@ha # in practice, the call stub
- . addi 12,12,Lfoo@toc@l # is slightly optimised, but
+ . addi 12,12,Lfoo@toc@l # is slightly optimized, but
. std 2,40(1) # this is the general idea
. ld 11,0(12)
. ld 2,8(12)
@@ -1768,13 +2581,74 @@ struct ppc_dyn_relocs
bfd_size_type pc_count;
};
+/* Track GOT entries needed for a given symbol. We might need more
+ than one got entry per symbol. */
+struct got_entry
+{
+ struct got_entry *next;
+
+ /* The symbol addend that we'll be placing in the GOT. */
+ bfd_vma addend;
+
+ /* Unlike other ELF targets, we use separate GOT entries for the same
+ symbol referenced from different input files. This is to support
+ automatic multiple TOC/GOT sections, where the TOC base can vary
+ from one input file to another.
+
+ Point to the BFD owning this GOT entry. */
+ bfd *owner;
+
+ /* Zero for non-tls entries, or TLS_TLS and one of TLS_GD, TLS_LD,
+ TLS_TPREL or TLS_DTPREL for tls entries. */
+ char tls_type;
+
+ /* Reference count until size_dynamic_sections, GOT offset thereafter. */
+ union
+ {
+ bfd_signed_vma refcount;
+ bfd_vma offset;
+ } got;
+};
+
+/* The same for PLT. */
+struct plt_entry
+{
+ struct plt_entry *next;
+
+ bfd_vma addend;
+
+ union
+ {
+ bfd_signed_vma refcount;
+ bfd_vma offset;
+ } plt;
+};
+
/* Of those relocs that might be copied as dynamic relocs, this macro
- selects between relative and absolute types. */
+ selects those that must be copied when linking a shared library,
+ even when the symbol is local. */
-#define IS_ABSOLUTE_RELOC(RTYPE) \
+#define MUST_BE_DYN_RELOC(RTYPE) \
((RTYPE) != R_PPC64_REL32 \
&& (RTYPE) != R_PPC64_REL64 \
- && (RTYPE) != R_PPC64_ADDR30)
+ && (RTYPE) != R_PPC64_REL30)
+
+/* If ELIMINATE_COPY_RELOCS is non-zero, the linker will try to avoid
+ copying dynamic variables from a shared lib into an app's dynbss
+ section, and instead use a dynamic relocation to point into the
+ shared lib. With code that gcc generates, it's vital that this be
+ enabled; In the PowerPC64 ABI, the address of a function is actually
+ the address of a function descriptor, which resides in the .opd
+ section. gcc uses the descriptor directly rather than going via the
+ GOT as some other ABI's do, which means that initialized function
+ pointers must reference the descriptor. Thus, a function pointer
+ initialized to the address of a function in a shared library will
+ either require a copy reloc, or a dynamic reloc. Using a copy reloc
+ redefines the function descriptor symbol to point to the copy. This
+ presents a problem as a plt entry for that function is also
+ initialized from the function descriptor symbol and the copy reloc
+ may not be initialized first. */
+#define ELIMINATE_COPY_RELOCS 1
/* Section name for stubs is the associated section name plus this
string. */
@@ -1803,12 +2677,31 @@ struct ppc_dyn_relocs
. mtctr %r11
. ld %r11,xxx+16@toc@l(%r12)
. bctr
+
+ ppc_stub_long_branch and ppc_stub_plt_branch may also have additional
+ code to adjust the value and save r2 to support multiple toc sections.
+ A ppc_stub_long_branch with an r2 offset looks like:
+ . std %r2,40(%r1)
+ . addis %r2,%r2,off@ha
+ . addi %r2,%r2,off@l
+ . b dest
+
+ A ppc_stub_plt_branch with an r2 offset looks like:
+ . std %r2,40(%r1)
+ . addis %r12,%r2,xxx@toc@ha
+ . ld %r11,xxx@toc@l(%r12)
+ . addis %r2,%r2,off@ha
+ . addi %r2,%r2,off@l
+ . mtctr %r11
+ . bctr
*/
enum ppc_stub_type {
ppc_stub_none,
ppc_stub_long_branch,
+ ppc_stub_long_branch_r2off,
ppc_stub_plt_branch,
+ ppc_stub_plt_branch_r2off,
ppc_stub_plt_call
};
@@ -1817,6 +2710,8 @@ struct ppc_stub_hash_entry {
/* Base hash table entry structure. */
struct bfd_hash_entry root;
+ enum ppc_stub_type stub_type;
+
/* The stub section. */
asection *stub_sec;
@@ -1828,11 +2723,12 @@ struct ppc_stub_hash_entry {
bfd_vma target_value;
asection *target_section;
- enum ppc_stub_type stub_type;
-
/* The symbol table entry, if any, that this was derived from. */
struct ppc_link_hash_entry *h;
+ /* And the reloc addend that this was derived from. */
+ bfd_vma addend;
+
/* Where this stub is being called from, or, in the case of combined
stub sections, the first input section in the group. */
asection *id_sec;
@@ -1868,6 +2764,26 @@ struct ppc_link_hash_entry
unsigned int is_func:1;
unsigned int is_func_descriptor:1;
unsigned int is_entry:1;
+
+ /* Whether global opd sym has been adjusted or not. */
+ unsigned int adjust_done:1;
+
+ /* Contexts in which symbol is used in the GOT (or TOC).
+ TLS_GD .. TLS_EXPLICIT bits are or'd into the mask as the
+ corresponding relocs are encountered during check_relocs.
+ tls_optimize clears TLS_GD .. TLS_TPREL when optimizing to
+ indicate the corresponding GOT entry type is not needed.
+ tls_optimize may also set TLS_TPRELGD when a GD reloc turns into
+ a TPREL one. We use a separate flag rather than setting TPREL
+ just for convenience in distinguishing the two cases. */
+#define TLS_GD 1 /* GD reloc. */
+#define TLS_LD 2 /* LD reloc. */
+#define TLS_TPREL 4 /* TPREL reloc, => IE. */
+#define TLS_DTPREL 8 /* DTPREL reloc, => LD. */
+#define TLS_TLS 16 /* Any TLS reloc. */
+#define TLS_EXPLICIT 32 /* Marks TOC section TLS relocs. */
+#define TLS_TPRELGD 64 /* TPREL reloc resulting from GD->IE. */
+ char tls_mask;
};
/* ppc64 ELF linker hash table. */
@@ -1886,8 +2802,8 @@ struct ppc_link_hash_table
bfd *stub_bfd;
/* Linker call-backs. */
- asection * (*add_stub_section) PARAMS ((const char *, asection *));
- void (*layout_sections_again) PARAMS ((void));
+ asection * (*add_stub_section) (const char *, asection *);
+ void (*layout_sections_again) (void);
/* Array to keep track of which stub sections have been created, and
information on stub grouping. */
@@ -1896,23 +2812,45 @@ struct ppc_link_hash_table
asection *link_sec;
/* The stub section. */
asection *stub_sec;
+ /* Along with elf_gp, specifies the TOC pointer used in this group. */
+ bfd_vma toc_off;
} *stub_group;
- /* Assorted information used by ppc64_elf_size_stubs. */
+ /* Support for multiple toc sections. */
+ unsigned int no_multi_toc;
+ unsigned int multi_toc_needed;
+
+ /* Temp used when calculating TOC pointers. */
+ bfd_vma toc_curr;
+
+ /* Highest input section id. */
+ int top_id;
+
+ /* Highest output section index. */
int top_index;
+
+ /* List of input sections for each output section. */
asection **input_list;
/* Short-cuts to get to dynamic linker sections. */
- asection *sgot;
- asection *srelgot;
- asection *splt;
- asection *srelplt;
- asection *sdynbss;
- asection *srelbss;
- asection *sglink;
+ asection *got;
+ asection *plt;
+ asection *relplt;
+ asection *dynbss;
+ asection *relbss;
+ asection *glink;
asection *sfpr;
- asection *sbrlt;
- asection *srelbrlt;
+ asection *brlt;
+ asection *relbrlt;
+
+ /* Shortcut to .__tls_get_addr. */
+ struct elf_link_hash_entry *tls_get_addr;
+
+ /* Statistics. */
+ unsigned long stub_count[ppc_stub_plt_call];
+
+ /* Set if we should emit symbols for stubs. */
+ unsigned int emit_stub_syms;
/* Set on error. */
unsigned int stub_error;
@@ -1931,81 +2869,6 @@ struct ppc_link_hash_table
struct sym_sec_cache sym_sec;
};
-static struct bfd_hash_entry *stub_hash_newfunc
- PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, const char *));
-static struct bfd_hash_entry *branch_hash_newfunc
- PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, const char *));
-static struct bfd_hash_entry *link_hash_newfunc
- PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, const char *));
-static struct bfd_link_hash_table *ppc64_elf_link_hash_table_create
- PARAMS ((bfd *));
-static void ppc64_elf_link_hash_table_free
- PARAMS ((struct bfd_link_hash_table *));
-static char *ppc_stub_name
- PARAMS ((const asection *, const asection *,
- const struct ppc_link_hash_entry *, const Elf_Internal_Rela *));
-static struct ppc_stub_hash_entry *ppc_get_stub_entry
- PARAMS ((const asection *, const asection *, struct elf_link_hash_entry *,
- const Elf_Internal_Rela *, struct ppc_link_hash_table *));
-static struct ppc_stub_hash_entry *ppc_add_stub
- PARAMS ((const char *, asection *, struct ppc_link_hash_table *));
-static boolean create_linkage_sections
- PARAMS ((bfd *, struct bfd_link_info *));
-static boolean create_got_section
- PARAMS ((bfd *, struct bfd_link_info *));
-static boolean ppc64_elf_create_dynamic_sections
- PARAMS ((bfd *, struct bfd_link_info *));
-static void ppc64_elf_copy_indirect_symbol
- PARAMS ((struct elf_backend_data *, struct elf_link_hash_entry *,
- struct elf_link_hash_entry *));
-static boolean ppc64_elf_check_relocs
- PARAMS ((bfd *, struct bfd_link_info *, asection *,
- const Elf_Internal_Rela *));
-static asection * ppc64_elf_gc_mark_hook
- PARAMS ((asection *, struct bfd_link_info *, Elf_Internal_Rela *,
- struct elf_link_hash_entry *, Elf_Internal_Sym *));
-static boolean ppc64_elf_gc_sweep_hook
- PARAMS ((bfd *, struct bfd_link_info *, asection *,
- const Elf_Internal_Rela *));
-static boolean func_desc_adjust
- PARAMS ((struct elf_link_hash_entry *, PTR));
-static boolean ppc64_elf_func_desc_adjust
- PARAMS ((bfd *, struct bfd_link_info *));
-static boolean ppc64_elf_adjust_dynamic_symbol
- PARAMS ((struct bfd_link_info *, struct elf_link_hash_entry *));
-static void ppc64_elf_hide_symbol
- PARAMS ((struct bfd_link_info *, struct elf_link_hash_entry *, boolean));
-static boolean edit_opd
- PARAMS ((bfd *, struct bfd_link_info *));
-static boolean allocate_dynrelocs
- PARAMS ((struct elf_link_hash_entry *, PTR));
-static boolean readonly_dynrelocs
- PARAMS ((struct elf_link_hash_entry *, PTR));
-static enum elf_reloc_type_class ppc64_elf_reloc_type_class
- PARAMS ((const Elf_Internal_Rela *));
-static boolean ppc64_elf_size_dynamic_sections
- PARAMS ((bfd *, struct bfd_link_info *));
-static INLINE enum ppc_stub_type ppc_type_of_stub
- PARAMS ((asection *, const Elf_Internal_Rela *,
- struct ppc_link_hash_entry **, bfd_vma));
-static bfd_byte *build_plt_stub
- PARAMS ((bfd *, bfd_byte *, int, int));
-static boolean ppc_build_one_stub
- PARAMS ((struct bfd_hash_entry *, PTR));
-static boolean ppc_size_one_stub
- PARAMS ((struct bfd_hash_entry *, PTR));
-static void group_sections
- PARAMS ((struct ppc_link_hash_table *, bfd_size_type, boolean));
-static boolean ppc64_elf_relocate_section
- PARAMS ((bfd *, struct bfd_link_info *info, bfd *, asection *, bfd_byte *,
- Elf_Internal_Rela *relocs, Elf_Internal_Sym *local_syms,
- asection **));
-static boolean ppc64_elf_finish_dynamic_symbol
- PARAMS ((bfd *, struct bfd_link_info *, struct elf_link_hash_entry *,
- Elf_Internal_Sym *));
-static boolean ppc64_elf_finish_dynamic_sections
- PARAMS ((bfd *, struct bfd_link_info *));
-
/* Get the ppc64 ELF linker hash table from a link_info structure. */
#define ppc_hash_table(p) \
@@ -2022,10 +2885,9 @@ static boolean ppc64_elf_finish_dynamic_sections
/* Create an entry in the stub hash table. */
static struct bfd_hash_entry *
-stub_hash_newfunc (entry, table, string)
- struct bfd_hash_entry *entry;
- struct bfd_hash_table *table;
- const char *string;
+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. */
@@ -2044,11 +2906,11 @@ stub_hash_newfunc (entry, table, string)
/* Initialize the local fields. */
eh = (struct ppc_stub_hash_entry *) entry;
+ eh->stub_type = ppc_stub_none;
eh->stub_sec = NULL;
eh->stub_offset = 0;
eh->target_value = 0;
eh->target_section = NULL;
- eh->stub_type = ppc_stub_none;
eh->h = NULL;
eh->id_sec = NULL;
}
@@ -2059,10 +2921,9 @@ stub_hash_newfunc (entry, table, string)
/* Create an entry in the branch hash table. */
static struct bfd_hash_entry *
-branch_hash_newfunc (entry, table, string)
- struct bfd_hash_entry *entry;
- struct bfd_hash_table *table;
- const char *string;
+branch_hash_newfunc (struct bfd_hash_entry *entry,
+ struct bfd_hash_table *table,
+ const char *string)
{
/* Allocate the structure if it has not already been allocated by a
subclass. */
@@ -2091,10 +2952,9 @@ branch_hash_newfunc (entry, table, string)
/* Create an entry in a ppc64 ELF linker hash table. */
static struct bfd_hash_entry *
-link_hash_newfunc (entry, table, string)
- struct bfd_hash_entry *entry;
- struct bfd_hash_table *table;
- const char *string;
+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. */
@@ -2117,6 +2977,8 @@ link_hash_newfunc (entry, table, string)
eh->is_func = 0;
eh->is_func_descriptor = 0;
eh->is_entry = 0;
+ eh->adjust_done = 0;
+ eh->tls_mask = 0;
}
return entry;
@@ -2125,13 +2987,12 @@ link_hash_newfunc (entry, table, string)
/* Create a ppc64 ELF linker hash table. */
static struct bfd_link_hash_table *
-ppc64_elf_link_hash_table_create (abfd)
- bfd *abfd;
+ppc64_elf_link_hash_table_create (bfd *abfd)
{
struct ppc_link_hash_table *htab;
bfd_size_type amt = sizeof (struct ppc_link_hash_table);
- htab = (struct ppc_link_hash_table *) bfd_malloc (amt);
+ htab = bfd_zmalloc (amt);
if (htab == NULL)
return NULL;
@@ -2149,25 +3010,14 @@ ppc64_elf_link_hash_table_create (abfd)
if (!bfd_hash_table_init (&htab->branch_hash_table, branch_hash_newfunc))
return NULL;
- htab->stub_bfd = NULL;
- htab->add_stub_section = NULL;
- htab->layout_sections_again = NULL;
- htab->stub_group = NULL;
- htab->sgot = NULL;
- htab->srelgot = NULL;
- htab->splt = NULL;
- htab->srelplt = NULL;
- htab->sdynbss = NULL;
- htab->srelbss = NULL;
- htab->sglink = NULL;
- htab->sfpr = NULL;
- htab->sbrlt = NULL;
- htab->srelbrlt = NULL;
- htab->stub_error = 0;
- htab->has_14bit_branch = 0;
- htab->have_undefweak = 0;
- htab->stub_iteration = 0;
- htab->sym_sec.abfd = NULL;
+ /* Initializing two fields of the union is just cosmetic. We really
+ only care about glist, but when compiled on a 32-bit host the
+ bfd_vma fields are larger. Setting the bfd_vma to zero makes
+ debugger inspection of these fields look nicer. */
+ htab->elf.init_refcount.refcount = 0;
+ htab->elf.init_refcount.glist = NULL;
+ htab->elf.init_offset.offset = 0;
+ htab->elf.init_offset.glist = NULL;
return &htab->elf.root;
}
@@ -2175,8 +3025,7 @@ ppc64_elf_link_hash_table_create (abfd)
/* Free the derived linker hash table. */
static void
-ppc64_elf_link_hash_table_free (hash)
- struct bfd_link_hash_table *hash;
+ppc64_elf_link_hash_table_free (struct bfd_link_hash_table *hash)
{
struct ppc_link_hash_table *ret = (struct ppc_link_hash_table *) hash;
@@ -2185,14 +3034,30 @@ ppc64_elf_link_hash_table_free (hash)
_bfd_generic_link_hash_table_free (hash);
}
+/* Satisfy the ELF linker by filling in some fields in our fake bfd. */
+
+void
+ppc64_elf_init_stub_bfd (bfd *abfd, struct bfd_link_info *info)
+{
+ struct ppc_link_hash_table *htab;
+
+ elf_elfheader (abfd)->e_ident[EI_CLASS] = ELFCLASS64;
+
+/* Always hook our dynamic sections into the first bfd, which is the
+ linker created stub bfd. This ensures that the GOT header is at
+ the start of the output TOC section. */
+ htab = ppc_hash_table (info);
+ htab->stub_bfd = abfd;
+ htab->elf.dynobj = abfd;
+}
+
/* Build a name for an entry in the stub hash table. */
static char *
-ppc_stub_name (input_section, sym_sec, h, rel)
- const asection *input_section;
- const asection *sym_sec;
- const struct ppc_link_hash_entry *h;
- const Elf_Internal_Rela *rel;
+ppc_stub_name (const asection *input_section,
+ const asection *sym_sec,
+ const struct ppc_link_hash_entry *h,
+ const Elf_Internal_Rela *rel)
{
char *stub_name;
bfd_size_type len;
@@ -2208,7 +3073,7 @@ ppc_stub_name (input_section, sym_sec, h, rel)
stub_name = bfd_malloc (len);
if (stub_name != NULL)
{
- sprintf (stub_name, "%08x_%s+%x",
+ sprintf (stub_name, "%08x.%s+%x",
input_section->id & 0xffffffff,
h->elf.root.root.string,
(int) rel->r_addend & 0xffffffff);
@@ -2216,11 +3081,11 @@ ppc_stub_name (input_section, sym_sec, h, rel)
}
else
{
- len = 8 + 1 + 8 + 1 + 8 + 1 + 16 + 1;
+ 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",
+ sprintf (stub_name, "%08x.%x:%x+%x",
input_section->id & 0xffffffff,
sym_sec->id & 0xffffffff,
(int) ELF64_R_SYM (rel->r_info) & 0xffffffff,
@@ -2234,12 +3099,11 @@ ppc_stub_name (input_section, sym_sec, h, rel)
creating the stub name takes a bit of time. */
static struct ppc_stub_hash_entry *
-ppc_get_stub_entry (input_section, sym_sec, hash, rel, htab)
- const asection *input_section;
- const asection *sym_sec;
- struct elf_link_hash_entry *hash;
- const Elf_Internal_Rela *rel;
- struct ppc_link_hash_table *htab;
+ppc_get_stub_entry (const asection *input_section,
+ const asection *sym_sec,
+ struct elf_link_hash_entry *hash,
+ const Elf_Internal_Rela *rel,
+ struct ppc_link_hash_table *htab)
{
struct ppc_stub_hash_entry *stub_entry;
struct ppc_link_hash_entry *h = (struct ppc_link_hash_entry *) hash;
@@ -2267,7 +3131,7 @@ ppc_get_stub_entry (input_section, sym_sec, hash, rel, htab)
return NULL;
stub_entry = ppc_stub_hash_lookup (&htab->stub_hash_table,
- stub_name, false, false);
+ stub_name, FALSE, FALSE);
if (h != NULL)
h->stub_cache = stub_entry;
@@ -2281,10 +3145,9 @@ ppc_get_stub_entry (input_section, sym_sec, hash, rel, htab)
stub entry are initialised. */
static struct ppc_stub_hash_entry *
-ppc_add_stub (stub_name, section, htab)
- const char *stub_name;
- asection *section;
- struct ppc_link_hash_table *htab;
+ppc_add_stub (const char *stub_name,
+ asection *section,
+ struct ppc_link_hash_table *htab)
{
asection *link_sec;
asection *stub_sec;
@@ -2319,7 +3182,7 @@ ppc_add_stub (stub_name, section, htab)
/* Enter this entry into the linker stub hash table. */
stub_entry = ppc_stub_hash_lookup (&htab->stub_hash_table, stub_name,
- true, false);
+ TRUE, FALSE);
if (stub_entry == NULL)
{
(*_bfd_error_handler) (_("%s: cannot create stub entry %s"),
@@ -2336,10 +3199,8 @@ ppc_add_stub (stub_name, section, htab)
/* Create sections for linker generated code. */
-static boolean
-create_linkage_sections (dynobj, info)
- bfd *dynobj;
- struct bfd_link_info *info;
+static bfd_boolean
+create_linkage_sections (bfd *dynobj, struct bfd_link_info *info)
{
struct ppc_link_hash_table *htab;
flagword flags;
@@ -2353,107 +3214,118 @@ create_linkage_sections (dynobj, info)
if (htab->sfpr == NULL
|| ! bfd_set_section_flags (dynobj, htab->sfpr, flags)
|| ! bfd_set_section_alignment (dynobj, htab->sfpr, 2))
- return false;
+ return FALSE;
/* Create .glink for lazy dynamic linking support. */
- htab->sglink = bfd_make_section_anyway (dynobj, ".glink");
- if (htab->sglink == NULL
- || ! bfd_set_section_flags (dynobj, htab->sglink, flags)
- || ! bfd_set_section_alignment (dynobj, htab->sglink, 2))
- return false;
+ htab->glink = bfd_make_section_anyway (dynobj, ".glink");
+ if (htab->glink == NULL
+ || ! bfd_set_section_flags (dynobj, htab->glink, flags)
+ || ! bfd_set_section_alignment (dynobj, htab->glink, 2))
+ return FALSE;
/* Create .branch_lt for plt_branch stubs. */
flags = (SEC_ALLOC | SEC_LOAD
| SEC_HAS_CONTENTS | SEC_IN_MEMORY | SEC_LINKER_CREATED);
- htab->sbrlt = bfd_make_section_anyway (dynobj, ".branch_lt");
- if (htab->sbrlt == NULL
- || ! bfd_set_section_flags (dynobj, htab->sbrlt, flags)
- || ! bfd_set_section_alignment (dynobj, htab->sbrlt, 3))
- return false;
+ htab->brlt = bfd_make_section_anyway (dynobj, ".branch_lt");
+ if (htab->brlt == NULL
+ || ! bfd_set_section_flags (dynobj, htab->brlt, flags)
+ || ! bfd_set_section_alignment (dynobj, htab->brlt, 3))
+ return FALSE;
if (info->shared)
{
flags = (SEC_ALLOC | SEC_LOAD | SEC_READONLY
| SEC_HAS_CONTENTS | SEC_IN_MEMORY | SEC_LINKER_CREATED);
- htab->srelbrlt = bfd_make_section_anyway (dynobj, ".rela.branch_lt");
- if (!htab->srelbrlt
- || ! bfd_set_section_flags (dynobj, htab->srelbrlt, flags)
- || ! bfd_set_section_alignment (dynobj, htab->srelbrlt, 3))
- return false;
+ htab->relbrlt = bfd_make_section_anyway (dynobj, ".rela.branch_lt");
+ if (!htab->relbrlt
+ || ! bfd_set_section_flags (dynobj, htab->relbrlt, flags)
+ || ! bfd_set_section_alignment (dynobj, htab->relbrlt, 3))
+ return FALSE;
}
- return true;
+ return TRUE;
}
-/* Create .got and .rela.got sections in DYNOBJ, and set up
- shortcuts to them in our hash table. */
+/* Create .got and .rela.got sections in ABFD, and .got in dynobj if
+ not already done. */
-static boolean
-create_got_section (dynobj, info)
- bfd *dynobj;
- struct bfd_link_info *info;
+static bfd_boolean
+create_got_section (bfd *abfd, struct bfd_link_info *info)
{
- struct ppc_link_hash_table *htab;
+ asection *got, *relgot;
+ flagword flags;
+ struct ppc_link_hash_table *htab = ppc_hash_table (info);
- if (! _bfd_elf_create_got_section (dynobj, info))
- return false;
+ if (!htab->got)
+ {
+ if (! _bfd_elf_create_got_section (htab->elf.dynobj, info))
+ return FALSE;
- htab = ppc_hash_table (info);
- htab->sgot = bfd_get_section_by_name (dynobj, ".got");
- if (!htab->sgot)
- abort ();
+ htab->got = bfd_get_section_by_name (htab->elf.dynobj, ".got");
+ if (!htab->got)
+ abort ();
+ }
+
+ flags = (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS | SEC_IN_MEMORY
+ | SEC_LINKER_CREATED);
+
+ got = bfd_make_section (abfd, ".got");
+ if (!got
+ || !bfd_set_section_flags (abfd, got, flags)
+ || !bfd_set_section_alignment (abfd, got, 3))
+ return FALSE;
+
+ relgot = bfd_make_section (abfd, ".rela.got");
+ if (!relgot
+ || ! bfd_set_section_flags (abfd, relgot, flags | SEC_READONLY)
+ || ! bfd_set_section_alignment (abfd, relgot, 3))
+ return FALSE;
- htab->srelgot = bfd_make_section (dynobj, ".rela.got");
- if (!htab->srelgot
- || ! bfd_set_section_flags (dynobj, htab->srelgot,
- (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS
- | SEC_IN_MEMORY | SEC_LINKER_CREATED
- | SEC_READONLY))
- || ! bfd_set_section_alignment (dynobj, htab->srelgot, 3))
- return false;
- return true;
+ ppc64_elf_tdata (abfd)->got = got;
+ ppc64_elf_tdata (abfd)->relgot = relgot;
+ return TRUE;
}
/* Create the dynamic sections, and set up shortcuts. */
-static boolean
-ppc64_elf_create_dynamic_sections (dynobj, info)
- bfd *dynobj;
- struct bfd_link_info *info;
+static bfd_boolean
+ppc64_elf_create_dynamic_sections (bfd *dynobj, struct bfd_link_info *info)
{
struct ppc_link_hash_table *htab;
- htab = ppc_hash_table (info);
- if (!htab->sgot && !create_got_section (dynobj, info))
- return false;
-
if (!_bfd_elf_create_dynamic_sections (dynobj, info))
- return false;
+ 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");
+ htab = ppc_hash_table (info);
+ if (!htab->got)
+ htab->got = bfd_get_section_by_name (dynobj, ".got");
+ htab->plt = bfd_get_section_by_name (dynobj, ".plt");
+ htab->relplt = bfd_get_section_by_name (dynobj, ".rela.plt");
+ htab->dynbss = bfd_get_section_by_name (dynobj, ".dynbss");
if (!info->shared)
- htab->srelbss = bfd_get_section_by_name (dynobj, ".rela.bss");
+ htab->relbss = bfd_get_section_by_name (dynobj, ".rela.bss");
- if (!htab->splt || !htab->srelplt || !htab->sdynbss
- || (!info->shared && !htab->srelbss))
+ if (!htab->got || !htab->plt || !htab->relplt || !htab->dynbss
+ || (!info->shared && !htab->relbss))
abort ();
- return true;
+ return TRUE;
}
/* Copy the extra info we tack onto an elf_link_hash_entry. */
static void
-ppc64_elf_copy_indirect_symbol (bed, dir, ind)
- struct elf_backend_data *bed;
- struct elf_link_hash_entry *dir, *ind;
+ppc64_elf_copy_indirect_symbol
+ (const struct elf_backend_data *bed ATTRIBUTE_UNUSED,
+ struct elf_link_hash_entry *dir,
+ struct elf_link_hash_entry *ind)
{
struct ppc_link_hash_entry *edir, *eind;
+ flagword mask;
edir = (struct ppc_link_hash_entry *) dir;
eind = (struct ppc_link_hash_entry *) ind;
+ /* Copy over any dynamic relocs we may have on the indirect sym. */
if (eind->dyn_relocs != NULL)
{
if (edir->dyn_relocs != NULL)
@@ -2461,7 +3333,7 @@ ppc64_elf_copy_indirect_symbol (bed, dir, ind)
struct ppc_dyn_relocs **pp;
struct ppc_dyn_relocs *p;
- if (ind->root.type == bfd_link_hash_indirect)
+ if (eind->elf.root.type == bfd_link_hash_indirect)
abort ();
/* Add reloc counts against the weak sym to the strong sym
@@ -2491,16 +3363,102 @@ ppc64_elf_copy_indirect_symbol (bed, dir, ind)
edir->is_func |= eind->is_func;
edir->is_func_descriptor |= eind->is_func_descriptor;
edir->is_entry |= eind->is_entry;
+ edir->tls_mask |= eind->tls_mask;
+
+ mask = (ELF_LINK_HASH_REF_DYNAMIC | ELF_LINK_HASH_REF_REGULAR
+ | ELF_LINK_HASH_REF_REGULAR_NONWEAK | ELF_LINK_NON_GOT_REF
+ | ELF_LINK_HASH_NEEDS_PLT);
+ /* If called to transfer flags for a weakdef during processing
+ of elf_adjust_dynamic_symbol, don't copy ELF_LINK_NON_GOT_REF.
+ We clear it ourselves for ELIMINATE_COPY_RELOCS. */
+ if (ELIMINATE_COPY_RELOCS
+ && eind->elf.root.type != bfd_link_hash_indirect
+ && (edir->elf.elf_link_hash_flags & ELF_LINK_HASH_DYNAMIC_ADJUSTED) != 0)
+ mask &= ~ELF_LINK_NON_GOT_REF;
+
+ edir->elf.elf_link_hash_flags |= eind->elf.elf_link_hash_flags & mask;
+
+ /* If we were called to copy over info for a weak sym, that's all. */
+ if (eind->elf.root.type != bfd_link_hash_indirect)
+ return;
+
+ /* Copy over got entries that we may have already seen to the
+ symbol which just became indirect. */
+ if (eind->elf.got.glist != NULL)
+ {
+ if (edir->elf.got.glist != NULL)
+ {
+ struct got_entry **entp;
+ struct got_entry *ent;
+
+ for (entp = &eind->elf.got.glist; (ent = *entp) != NULL; )
+ {
+ struct got_entry *dent;
+
+ for (dent = edir->elf.got.glist; dent != NULL; dent = dent->next)
+ if (dent->addend == ent->addend
+ && dent->owner == ent->owner
+ && dent->tls_type == ent->tls_type)
+ {
+ dent->got.refcount += ent->got.refcount;
+ *entp = ent->next;
+ break;
+ }
+ if (dent == NULL)
+ entp = &ent->next;
+ }
+ *entp = edir->elf.got.glist;
+ }
+
+ edir->elf.got.glist = eind->elf.got.glist;
+ eind->elf.got.glist = NULL;
+ }
+
+ /* And plt entries. */
+ if (eind->elf.plt.plist != NULL)
+ {
+ if (edir->elf.plt.plist != NULL)
+ {
+ struct plt_entry **entp;
+ struct plt_entry *ent;
+
+ for (entp = &eind->elf.plt.plist; (ent = *entp) != NULL; )
+ {
+ struct plt_entry *dent;
+
+ for (dent = edir->elf.plt.plist; dent != NULL; dent = dent->next)
+ if (dent->addend == ent->addend)
+ {
+ dent->plt.refcount += ent->plt.refcount;
+ *entp = ent->next;
+ break;
+ }
+ if (dent == NULL)
+ entp = &ent->next;
+ }
+ *entp = edir->elf.plt.plist;
+ }
+
+ edir->elf.plt.plist = eind->elf.plt.plist;
+ eind->elf.plt.plist = NULL;
+ }
- _bfd_elf_link_hash_copy_indirect (bed, dir, ind);
+ if (edir->elf.dynindx == -1)
+ {
+ edir->elf.dynindx = eind->elf.dynindx;
+ edir->elf.dynstr_index = eind->elf.dynstr_index;
+ eind->elf.dynindx = -1;
+ eind->elf.dynstr_index = 0;
+ }
+ else
+ BFD_ASSERT (eind->elf.dynindx == -1);
}
/* Set a flag, used by ppc64_elf_gc_mark_hook, on the entry symbol and
symbols undefined on the command-line. */
-boolean
-ppc64_elf_mark_entry_syms (info)
- struct bfd_link_info *info;
+bfd_boolean
+ppc64_elf_mark_entry_syms (struct bfd_link_info *info)
{
struct ppc_link_hash_table *htab;
struct bfd_sym_chain *sym;
@@ -2510,23 +3468,134 @@ ppc64_elf_mark_entry_syms (info)
{
struct elf_link_hash_entry *h;
- h = elf_link_hash_lookup (&htab->elf, sym->name, false, false, false);
+ h = elf_link_hash_lookup (&htab->elf, sym->name, FALSE, FALSE, FALSE);
if (h != NULL)
((struct ppc_link_hash_entry *) h)->is_entry = 1;
}
- return true;
+ return TRUE;
+}
+
+/* Hack symbols defined in .opd sections to be function type. */
+
+static bfd_boolean
+ppc64_elf_add_symbol_hook (bfd *ibfd ATTRIBUTE_UNUSED,
+ struct bfd_link_info *info ATTRIBUTE_UNUSED,
+ Elf_Internal_Sym *isym,
+ const char **name ATTRIBUTE_UNUSED,
+ flagword *flags ATTRIBUTE_UNUSED,
+ asection **sec,
+ bfd_vma *value ATTRIBUTE_UNUSED)
+{
+ if (strcmp (bfd_get_section_name (ibfd, *sec), ".opd") == 0)
+ isym->st_info = ELF_ST_INFO (ELF_ST_BIND (isym->st_info), STT_FUNC);
+ return TRUE;
+}
+
+static bfd_boolean
+update_local_sym_info (bfd *abfd, Elf_Internal_Shdr *symtab_hdr,
+ unsigned long r_symndx, bfd_vma r_addend, int tls_type)
+{
+ struct got_entry **local_got_ents = elf_local_got_ents (abfd);
+ char *local_got_tls_masks;
+
+ if (local_got_ents == NULL)
+ {
+ bfd_size_type size = symtab_hdr->sh_info;
+
+ size *= sizeof (*local_got_ents) + sizeof (*local_got_tls_masks);
+ local_got_ents = bfd_zalloc (abfd, size);
+ if (local_got_ents == NULL)
+ return FALSE;
+ elf_local_got_ents (abfd) = local_got_ents;
+ }
+
+ if ((tls_type & TLS_EXPLICIT) == 0)
+ {
+ struct got_entry *ent;
+
+ for (ent = local_got_ents[r_symndx]; ent != NULL; ent = ent->next)
+ if (ent->addend == r_addend
+ && ent->owner == abfd
+ && ent->tls_type == tls_type)
+ break;
+ if (ent == NULL)
+ {
+ bfd_size_type amt = sizeof (*ent);
+ ent = bfd_alloc (abfd, amt);
+ if (ent == NULL)
+ return FALSE;
+ ent->next = local_got_ents[r_symndx];
+ ent->addend = r_addend;
+ ent->owner = abfd;
+ ent->tls_type = tls_type;
+ ent->got.refcount = 0;
+ local_got_ents[r_symndx] = ent;
+ }
+ ent->got.refcount += 1;
+ }
+
+ local_got_tls_masks = (char *) (local_got_ents + symtab_hdr->sh_info);
+ local_got_tls_masks[r_symndx] |= tls_type;
+ return TRUE;
+}
+
+static bfd_boolean
+update_plt_info (bfd *abfd, struct ppc_link_hash_entry *eh, bfd_vma addend)
+{
+ struct plt_entry *ent;
+
+ for (ent = eh->elf.plt.plist; ent != NULL; ent = ent->next)
+ if (ent->addend == addend)
+ break;
+ if (ent == NULL)
+ {
+ bfd_size_type amt = sizeof (*ent);
+ ent = bfd_alloc (abfd, amt);
+ if (ent == NULL)
+ return FALSE;
+ ent->next = eh->elf.plt.plist;
+ ent->addend = addend;
+ ent->plt.refcount = 0;
+ eh->elf.plt.plist = ent;
+ }
+ ent->plt.refcount += 1;
+ eh->elf.elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_PLT;
+ eh->is_func = 1;
+ return TRUE;
+}
+
+/* Find the function descriptor hash entry from the given function code
+ hash entry FH. Link the entries via their OH fields. */
+static struct ppc_link_hash_entry *
+get_fdh (struct ppc_link_hash_entry *fh, struct ppc_link_hash_table *htab)
+{
+ struct ppc_link_hash_entry *fdh = (struct ppc_link_hash_entry *) fh->oh;
+
+ if (fdh == NULL)
+ {
+ const char *fd_name = fh->elf.root.root.string + 1;
+
+ fdh = (struct ppc_link_hash_entry *)
+ elf_link_hash_lookup (&htab->elf, fd_name, FALSE, FALSE, FALSE);
+ if (fdh != NULL)
+ {
+ fdh->is_func_descriptor = 1;
+ fdh->oh = &fh->elf;
+ fh->is_func = 1;
+ fh->oh = &fdh->elf;
+ }
+ }
+
+ return fdh;
}
/* Look through the relocs for a section during the first phase, and
calculate needed space in the global offset table, procedure
linkage table, and dynamic reloc sections. */
-static boolean
-ppc64_elf_check_relocs (abfd, info, sec, relocs)
- bfd *abfd;
- struct bfd_link_info *info;
- asection *sec;
- const Elf_Internal_Rela *relocs;
+static bfd_boolean
+ppc64_elf_check_relocs (bfd *abfd, struct bfd_link_info *info,
+ asection *sec, const Elf_Internal_Rela *relocs)
{
struct ppc_link_hash_table *htab;
Elf_Internal_Shdr *symtab_hdr;
@@ -2536,8 +3605,17 @@ ppc64_elf_check_relocs (abfd, info, sec, relocs)
asection *sreloc;
asection **opd_sym_map;
- if (info->relocateable)
- return true;
+ if (info->relocatable)
+ return TRUE;
+
+ /* Don't do anything special with non-loaded, non-alloced sections.
+ In particular, any relocs in such sections should not affect GOT
+ and PLT reference counting (ie. we don't allow them to create GOT
+ or PLT entries), there's no possibility or desire to optimize TLS
+ relocs, and there's not much point in propagating relocs to shared
+ libs that the dynamic linker won't relocate. */
+ if ((sec->flags & SEC_ALLOC) == 0)
+ return TRUE;
htab = ppc_hash_table (info);
symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
@@ -2567,24 +3645,23 @@ ppc64_elf_check_relocs (abfd, info, sec, relocs)
bfd_size_type amt;
amt = sec->_raw_size * sizeof (union opd_info) / 24;
- opd_sym_map = (asection **) bfd_zalloc (abfd, amt);
+ opd_sym_map = bfd_zalloc (abfd, amt);
if (opd_sym_map == NULL)
- return false;
- elf_section_data (sec)->tdata = opd_sym_map;
+ return FALSE;
+ ppc64_elf_section_data (sec)->opd.func_sec = opd_sym_map;
}
- if (htab->elf.dynobj == NULL)
- htab->elf.dynobj = abfd;
if (htab->sfpr == NULL
&& !create_linkage_sections (htab->elf.dynobj, info))
- return false;
+ return FALSE;
rel_end = relocs + sec->reloc_count;
for (rel = relocs; rel < rel_end; rel++)
{
unsigned long r_symndx;
struct elf_link_hash_entry *h;
- enum elf_ppc_reloc_type r_type;
+ enum elf_ppc64_reloc_type r_type;
+ int tls_type = 0;
r_symndx = ELF64_R_SYM (rel->r_info);
if (r_symndx < symtab_hdr->sh_info)
@@ -2592,46 +3669,86 @@ ppc64_elf_check_relocs (abfd, info, sec, relocs)
else
h = sym_hashes[r_symndx - symtab_hdr->sh_info];
- r_type = (enum elf_ppc_reloc_type) ELF64_R_TYPE (rel->r_info);
+ r_type = ELF64_R_TYPE (rel->r_info);
switch (r_type)
{
- /* GOT16 relocations */
+ case R_PPC64_GOT_TLSLD16:
+ case R_PPC64_GOT_TLSLD16_LO:
+ case R_PPC64_GOT_TLSLD16_HI:
+ case R_PPC64_GOT_TLSLD16_HA:
+ ppc64_tlsld_got (abfd)->refcount += 1;
+ tls_type = TLS_TLS | TLS_LD;
+ goto dogottls;
+
+ case R_PPC64_GOT_TLSGD16:
+ case R_PPC64_GOT_TLSGD16_LO:
+ case R_PPC64_GOT_TLSGD16_HI:
+ case R_PPC64_GOT_TLSGD16_HA:
+ tls_type = TLS_TLS | TLS_GD;
+ goto dogottls;
+
+ case R_PPC64_GOT_TPREL16_DS:
+ case R_PPC64_GOT_TPREL16_LO_DS:
+ case R_PPC64_GOT_TPREL16_HI:
+ case R_PPC64_GOT_TPREL16_HA:
+ if (info->shared)
+ info->flags |= DF_STATIC_TLS;
+ tls_type = TLS_TLS | TLS_TPREL;
+ goto dogottls;
+
+ case R_PPC64_GOT_DTPREL16_DS:
+ case R_PPC64_GOT_DTPREL16_LO_DS:
+ case R_PPC64_GOT_DTPREL16_HI:
+ case R_PPC64_GOT_DTPREL16_HA:
+ tls_type = TLS_TLS | TLS_DTPREL;
+ dogottls:
+ sec->has_tls_reloc = 1;
+ /* Fall thru */
+
case R_PPC64_GOT16:
case R_PPC64_GOT16_DS:
case R_PPC64_GOT16_HA:
case R_PPC64_GOT16_HI:
case R_PPC64_GOT16_LO:
case R_PPC64_GOT16_LO_DS:
-
/* This symbol requires a global offset table entry. */
- if (htab->sgot == NULL
- && !create_got_section (htab->elf.dynobj, info))
- return false;
+ sec->has_gp_reloc = 1;
+ if (ppc64_elf_tdata (abfd)->got == NULL
+ && !create_got_section (abfd, info))
+ return FALSE;
if (h != NULL)
{
- h->got.refcount += 1;
- }
- else
- {
- bfd_signed_vma *local_got_refcounts;
+ struct ppc_link_hash_entry *eh;
+ struct got_entry *ent;
- /* This is a global offset table entry for a local symbol. */
- local_got_refcounts = elf_local_got_refcounts (abfd);
- if (local_got_refcounts == NULL)
+ eh = (struct ppc_link_hash_entry *) h;
+ for (ent = eh->elf.got.glist; ent != NULL; ent = ent->next)
+ if (ent->addend == rel->r_addend
+ && ent->owner == abfd
+ && ent->tls_type == tls_type)
+ break;
+ if (ent == NULL)
{
- bfd_size_type size;
-
- size = symtab_hdr->sh_info;
- size *= sizeof (bfd_signed_vma);
- local_got_refcounts = ((bfd_signed_vma *)
- bfd_zalloc (abfd, size));
- if (local_got_refcounts == NULL)
- return false;
- elf_local_got_refcounts (abfd) = local_got_refcounts;
+ bfd_size_type amt = sizeof (*ent);
+ ent = bfd_alloc (abfd, amt);
+ if (ent == NULL)
+ return FALSE;
+ ent->next = eh->elf.got.glist;
+ ent->addend = rel->r_addend;
+ ent->owner = abfd;
+ ent->tls_type = tls_type;
+ ent->got.refcount = 0;
+ eh->elf.got.glist = ent;
}
- local_got_refcounts[r_symndx] += 1;
+ ent->got.refcount += 1;
+ eh->tls_mask |= tls_type;
}
+ else
+ /* This is a global offset table entry for a local symbol. */
+ if (!update_local_sym_info (abfd, symtab_hdr, r_symndx,
+ rel->r_addend, tls_type))
+ return FALSE;
break;
case R_PPC64_PLT16_HA:
@@ -2649,12 +3766,12 @@ ppc64_elf_check_relocs (abfd, info, sec, relocs)
/* 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;
+ return FALSE;
}
-
- h->elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_PLT;
- h->plt.refcount += 1;
- ((struct ppc_link_hash_entry *) h)->is_func = 1;
+ else
+ if (!update_plt_info (abfd, (struct ppc_link_hash_entry *) h,
+ rel->r_addend))
+ return FALSE;
break;
/* The following relocations don't need to propagate the
@@ -2666,26 +3783,40 @@ ppc64_elf_check_relocs (abfd, info, sec, relocs)
case R_PPC64_SECTOFF_HA:
case R_PPC64_SECTOFF_DS:
case R_PPC64_SECTOFF_LO_DS:
+ case R_PPC64_DTPREL16:
+ case R_PPC64_DTPREL16_LO:
+ case R_PPC64_DTPREL16_HI:
+ case R_PPC64_DTPREL16_HA:
+ case R_PPC64_DTPREL16_DS:
+ case R_PPC64_DTPREL16_LO_DS:
+ case R_PPC64_DTPREL16_HIGHER:
+ case R_PPC64_DTPREL16_HIGHERA:
+ case R_PPC64_DTPREL16_HIGHEST:
+ case R_PPC64_DTPREL16_HIGHESTA:
+ break;
+
+ /* Nor do these. */
case R_PPC64_TOC16:
case R_PPC64_TOC16_LO:
case R_PPC64_TOC16_HI:
case R_PPC64_TOC16_HA:
case R_PPC64_TOC16_DS:
case R_PPC64_TOC16_LO_DS:
+ sec->has_gp_reloc = 1;
break;
/* This relocation describes the C++ object vtable hierarchy.
Reconstruct it for later use during GC. */
case R_PPC64_GNU_VTINHERIT:
- if (!_bfd_elf64_gc_record_vtinherit (abfd, sec, h, rel->r_offset))
- return false;
+ if (!bfd_elf_gc_record_vtinherit (abfd, sec, h, rel->r_offset))
+ return FALSE;
break;
/* This relocation describes which C++ vtable entries are actually
used. Record for later use during GC. */
case R_PPC64_GNU_VTENTRY:
- if (!_bfd_elf64_gc_record_vtentry (abfd, sec, h, rel->r_addend))
- return false;
+ if (!bfd_elf_gc_record_vtentry (abfd, sec, h, rel->r_addend))
+ return FALSE;
break;
case R_PPC64_REL14:
@@ -2701,9 +3832,92 @@ ppc64_elf_check_relocs (abfd, info, sec, relocs)
{
/* We may need a .plt entry if the function this reloc
refers to is in a shared lib. */
- h->elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_PLT;
- h->plt.refcount += 1;
- ((struct ppc_link_hash_entry *) h)->is_func = 1;
+ if (!update_plt_info (abfd, (struct ppc_link_hash_entry *) h,
+ rel->r_addend))
+ return FALSE;
+ if (h == htab->tls_get_addr)
+ sec->has_tls_reloc = 1;
+ else if ((strncmp (h->root.root.string, ".__tls_get_addr", 15)
+ == 0)
+ && (h->root.root.string[15] == 0
+ || h->root.root.string[15] == '@'))
+ {
+ htab->tls_get_addr = h;
+ sec->has_tls_reloc = 1;
+ }
+ }
+ break;
+
+ case R_PPC64_TPREL64:
+ tls_type = TLS_EXPLICIT | TLS_TLS | TLS_TPREL;
+ if (info->shared)
+ info->flags |= DF_STATIC_TLS;
+ goto dotlstoc;
+
+ case R_PPC64_DTPMOD64:
+ if (rel + 1 < rel_end
+ && rel[1].r_info == ELF64_R_INFO (r_symndx, R_PPC64_DTPREL64)
+ && rel[1].r_offset == rel->r_offset + 8)
+ tls_type = TLS_EXPLICIT | TLS_TLS | TLS_GD;
+ else
+ tls_type = TLS_EXPLICIT | TLS_TLS | TLS_LD;
+ goto dotlstoc;
+
+ case R_PPC64_DTPREL64:
+ tls_type = TLS_EXPLICIT | TLS_TLS | TLS_DTPREL;
+ if (rel != relocs
+ && rel[-1].r_info == ELF64_R_INFO (r_symndx, R_PPC64_DTPMOD64)
+ && rel[-1].r_offset == rel->r_offset - 8)
+ /* This is the second reloc of a dtpmod, dtprel pair.
+ Don't mark with TLS_DTPREL. */
+ goto dodyn;
+
+ dotlstoc:
+ sec->has_tls_reloc = 1;
+ if (h != NULL)
+ {
+ struct ppc_link_hash_entry *eh;
+ eh = (struct ppc_link_hash_entry *) h;
+ eh->tls_mask |= tls_type;
+ }
+ else
+ if (!update_local_sym_info (abfd, symtab_hdr, r_symndx,
+ rel->r_addend, tls_type))
+ return FALSE;
+
+ if (ppc64_elf_section_data (sec)->t_symndx == NULL)
+ {
+ /* One extra to simplify get_tls_mask. */
+ bfd_size_type amt = sec->_raw_size * sizeof (unsigned) / 8 + 1;
+ ppc64_elf_section_data (sec)->t_symndx = bfd_zalloc (abfd, amt);
+ if (ppc64_elf_section_data (sec)->t_symndx == NULL)
+ return FALSE;
+ }
+ BFD_ASSERT (rel->r_offset % 8 == 0);
+ ppc64_elf_section_data (sec)->t_symndx[rel->r_offset / 8] = r_symndx;
+
+ /* Mark the second slot of a GD or LD entry.
+ -1 to indicate GD and -2 to indicate LD. */
+ if (tls_type == (TLS_EXPLICIT | TLS_TLS | TLS_GD))
+ ppc64_elf_section_data (sec)->t_symndx[rel->r_offset / 8 + 1] = -1;
+ else if (tls_type == (TLS_EXPLICIT | TLS_TLS | TLS_LD))
+ ppc64_elf_section_data (sec)->t_symndx[rel->r_offset / 8 + 1] = -2;
+ goto dodyn;
+
+ case R_PPC64_TPREL16:
+ case R_PPC64_TPREL16_LO:
+ case R_PPC64_TPREL16_HI:
+ case R_PPC64_TPREL16_HA:
+ case R_PPC64_TPREL16_DS:
+ case R_PPC64_TPREL16_LO_DS:
+ case R_PPC64_TPREL16_HIGHER:
+ case R_PPC64_TPREL16_HIGHERA:
+ case R_PPC64_TPREL16_HIGHEST:
+ case R_PPC64_TPREL16_HIGHESTA:
+ if (info->shared)
+ {
+ info->flags |= DF_STATIC_TLS;
+ goto dodyn;
}
break;
@@ -2712,38 +3926,27 @@ ppc64_elf_check_relocs (abfd, info, sec, relocs)
&& h != NULL
&& h->root.root.string[0] == '.'
&& h->root.root.string[1] != 0)
- {
- struct elf_link_hash_entry *fdh;
+ get_fdh ((struct ppc_link_hash_entry *) h, htab);
- fdh = elf_link_hash_lookup (&htab->elf, h->root.root.string + 1,
- false, false, false);
- if (fdh != NULL)
- {
- ((struct ppc_link_hash_entry *) fdh)->is_func_descriptor = 1;
- ((struct ppc_link_hash_entry *) fdh)->oh = h;
- ((struct ppc_link_hash_entry *) h)->is_func = 1;
- ((struct ppc_link_hash_entry *) h)->oh = fdh;
- }
- }
if (opd_sym_map != NULL
&& h == NULL
&& rel + 1 < rel_end
- && ((enum elf_ppc_reloc_type) ELF64_R_TYPE ((rel + 1)->r_info)
- == R_PPC64_TOC))
+ && ELF64_R_TYPE ((rel + 1)->r_info) == R_PPC64_TOC)
{
asection *s;
s = bfd_section_from_r_symndx (abfd, &htab->sym_sec, sec,
r_symndx);
if (s == NULL)
- return false;
+ return FALSE;
else if (s != sec)
opd_sym_map[rel->r_offset / 24] = s;
}
/* Fall through. */
- case R_PPC64_REL64:
+ 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:
@@ -2758,12 +3961,15 @@ ppc64_elf_check_relocs (abfd, info, sec, relocs)
case R_PPC64_ADDR16_LO:
case R_PPC64_ADDR16_LO_DS:
case R_PPC64_ADDR24:
- case R_PPC64_ADDR30:
case R_PPC64_ADDR32:
case R_PPC64_UADDR16:
case R_PPC64_UADDR32:
case R_PPC64_UADDR64:
case R_PPC64_TOC:
+ if (h != NULL && !info->shared)
+ /* We may need a copy reloc. */
+ h->elf_link_hash_flags |= ELF_LINK_NON_GOT_REF;
+
/* Don't propagate .opd relocs. */
if (NO_OPD_RELOCS && opd_sym_map != NULL)
break;
@@ -2780,7 +3986,7 @@ ppc64_elf_check_relocs (abfd, info, sec, relocs)
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
+ storing information in the dyn_relocs field of the hash
table entry. A similar situation occurs when creating
shared libraries and symbol visibility changes render the
symbol local.
@@ -2789,16 +3995,16 @@ ppc64_elf_check_relocs (abfd, info, sec, relocs)
may need to keep relocations for symbols satisfied by a
dynamic library if we manage to avoid copy relocs for the
symbol. */
+ dodyn:
if ((info->shared
- && (sec->flags & SEC_ALLOC) != 0
- && (IS_ABSOLUTE_RELOC (r_type)
+ && (MUST_BE_DYN_RELOC (r_type)
|| (h != NULL
&& (! info->symbolic
|| h->root.type == bfd_link_hash_defweak
|| (h->elf_link_hash_flags
& ELF_LINK_HASH_DEF_REGULAR) == 0))))
- || (!info->shared
- && (sec->flags & SEC_ALLOC) != 0
+ || (ELIMINATE_COPY_RELOCS
+ && !info->shared
&& h != NULL
&& (h->root.type == bfd_link_hash_defweak
|| (h->elf_link_hash_flags
@@ -2820,7 +4026,7 @@ ppc64_elf_check_relocs (abfd, info, sec, relocs)
elf_elfheader (abfd)->e_shstrndx,
elf_section_data (sec)->rel_hdr.sh_name));
if (name == NULL)
- return false;
+ return FALSE;
if (strncmp (name, ".rela", 5) != 0
|| strcmp (bfd_get_section_name (abfd, sec),
@@ -2846,7 +4052,7 @@ ppc64_elf_check_relocs (abfd, info, sec, relocs)
if (sreloc == NULL
|| ! bfd_set_section_flags (dynobj, sreloc, flags)
|| ! bfd_set_section_alignment (dynobj, sreloc, 3))
- return false;
+ return FALSE;
}
elf_section_data (sec)->sreloc = sreloc;
}
@@ -2867,7 +4073,7 @@ ppc64_elf_check_relocs (abfd, info, sec, relocs)
s = bfd_section_from_r_symndx (abfd, &htab->sym_sec,
sec, r_symndx);
if (s == NULL)
- return false;
+ return FALSE;
head = ((struct ppc_dyn_relocs **)
&elf_section_data (s)->local_dynrel);
@@ -2876,11 +4082,9 @@ ppc64_elf_check_relocs (abfd, info, sec, relocs)
p = *head;
if (p == NULL || p->sec != sec)
{
- p = ((struct ppc_dyn_relocs *)
- bfd_alloc (htab->elf.dynobj,
- (bfd_size_type) sizeof *p));
+ p = bfd_alloc (htab->elf.dynobj, sizeof *p);
if (p == NULL)
- return false;
+ return FALSE;
p->next = *head;
*head = p;
p->sec = sec;
@@ -2889,7 +4093,7 @@ ppc64_elf_check_relocs (abfd, info, sec, relocs)
}
p->count += 1;
- if (!IS_ABSOLUTE_RELOC (r_type))
+ if (!MUST_BE_DYN_RELOC (r_type))
p->pc_count += 1;
}
break;
@@ -2899,28 +4103,27 @@ ppc64_elf_check_relocs (abfd, info, sec, relocs)
}
}
- return true;
+ return TRUE;
}
/* Return the section that should be marked against GC for a given
relocation. */
static asection *
-ppc64_elf_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;
+ppc64_elf_gc_mark_hook (asection *sec,
+ struct bfd_link_info *info ATTRIBUTE_UNUSED,
+ Elf_Internal_Rela *rel,
+ struct elf_link_hash_entry *h,
+ Elf_Internal_Sym *sym)
{
asection *rsec = NULL;
if (h != NULL)
{
- enum elf_ppc_reloc_type r_type;
+ enum elf_ppc64_reloc_type r_type;
struct ppc_link_hash_entry *fdh;
- r_type = (enum elf_ppc_reloc_type) ELF64_R_TYPE (rel->r_info);
+ r_type = ELF64_R_TYPE (rel->r_info);
switch (r_type)
{
case R_PPC64_GNU_VTINHERIT:
@@ -2942,10 +4145,10 @@ ppc64_elf_gc_mark_hook (sec, info, rel, h, sym)
/* 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. */
+ sections, as all functions are referenced in .opd. */
else if ((fdh->oh != NULL
&& ((struct ppc_link_hash_entry *) fdh->oh)->is_entry)
- || elf_section_data (sec)->tdata == NULL)
+ || ppc64_elf_section_data (sec)->opd.func_sec == NULL)
rsec = h->root.u.def.section;
break;
@@ -2963,10 +4166,10 @@ ppc64_elf_gc_mark_hook (sec, info, rel, h, sym)
asection **opd_sym_section;
rsec = bfd_section_from_elf_index (sec->owner, sym->st_shndx);
- opd_sym_section = (asection **) elf_section_data (rsec)->tdata;
+ opd_sym_section = ppc64_elf_section_data (rsec)->opd.func_sec;
if (opd_sym_section != NULL)
rsec = opd_sym_section[sym->st_value / 24];
- else if (elf_section_data (sec)->tdata != NULL)
+ else if (ppc64_elf_section_data (sec)->opd.func_sec != NULL)
rsec = NULL;
}
@@ -2976,52 +4179,110 @@ ppc64_elf_gc_mark_hook (sec, info, rel, h, sym)
/* Update the .got, .plt. and dynamic reloc reference counts for the
section being removed. */
-static boolean
-ppc64_elf_gc_sweep_hook (abfd, info, sec, relocs)
- bfd *abfd;
- struct bfd_link_info *info ATTRIBUTE_UNUSED;
- asection *sec;
- const Elf_Internal_Rela *relocs;
+static bfd_boolean
+ppc64_elf_gc_sweep_hook (bfd *abfd, struct bfd_link_info *info,
+ asection *sec, const Elf_Internal_Rela *relocs)
{
+ struct ppc_link_hash_table *htab;
Elf_Internal_Shdr *symtab_hdr;
struct elf_link_hash_entry **sym_hashes;
- bfd_signed_vma *local_got_refcounts;
+ struct got_entry **local_got_ents;
const Elf_Internal_Rela *rel, *relend;
+ if ((sec->flags & SEC_ALLOC) == 0)
+ return TRUE;
+
elf_section_data (sec)->local_dynrel = NULL;
+ htab = ppc_hash_table (info);
symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
sym_hashes = elf_sym_hashes (abfd);
- local_got_refcounts = elf_local_got_refcounts (abfd);
+ local_got_ents = elf_local_got_ents (abfd);
relend = relocs + sec->reloc_count;
for (rel = relocs; rel < relend; rel++)
{
unsigned long r_symndx;
- enum elf_ppc_reloc_type r_type;
- struct elf_link_hash_entry *h;
+ enum elf_ppc64_reloc_type r_type;
+ struct elf_link_hash_entry *h = NULL;
+ char tls_type = 0;
r_symndx = ELF64_R_SYM (rel->r_info);
- r_type = (enum elf_ppc_reloc_type) ELF64_R_TYPE (rel->r_info);
+ r_type = ELF64_R_TYPE (rel->r_info);
+ if (r_symndx >= symtab_hdr->sh_info)
+ {
+ struct ppc_link_hash_entry *eh;
+ struct ppc_dyn_relocs **pp;
+ struct ppc_dyn_relocs *p;
+
+ h = sym_hashes[r_symndx - symtab_hdr->sh_info];
+ eh = (struct ppc_link_hash_entry *) h;
+
+ for (pp = &eh->dyn_relocs; (p = *pp) != NULL; pp = &p->next)
+ if (p->sec == sec)
+ {
+ /* Everything must go for SEC. */
+ *pp = p->next;
+ break;
+ }
+ }
+
switch (r_type)
{
+ case R_PPC64_GOT_TLSLD16:
+ case R_PPC64_GOT_TLSLD16_LO:
+ case R_PPC64_GOT_TLSLD16_HI:
+ case R_PPC64_GOT_TLSLD16_HA:
+ ppc64_tlsld_got (abfd)->refcount -= 1;
+ tls_type = TLS_TLS | TLS_LD;
+ goto dogot;
+
+ case R_PPC64_GOT_TLSGD16:
+ case R_PPC64_GOT_TLSGD16_LO:
+ case R_PPC64_GOT_TLSGD16_HI:
+ case R_PPC64_GOT_TLSGD16_HA:
+ tls_type = TLS_TLS | TLS_GD;
+ goto dogot;
+
+ case R_PPC64_GOT_TPREL16_DS:
+ case R_PPC64_GOT_TPREL16_LO_DS:
+ case R_PPC64_GOT_TPREL16_HI:
+ case R_PPC64_GOT_TPREL16_HA:
+ tls_type = TLS_TLS | TLS_TPREL;
+ goto dogot;
+
+ case R_PPC64_GOT_DTPREL16_DS:
+ case R_PPC64_GOT_DTPREL16_LO_DS:
+ case R_PPC64_GOT_DTPREL16_HI:
+ case R_PPC64_GOT_DTPREL16_HA:
+ tls_type = TLS_TLS | TLS_DTPREL;
+ goto dogot;
+
case R_PPC64_GOT16:
case R_PPC64_GOT16_DS:
case R_PPC64_GOT16_HA:
case R_PPC64_GOT16_HI:
case R_PPC64_GOT16_LO:
case R_PPC64_GOT16_LO_DS:
- if (r_symndx >= symtab_hdr->sh_info)
- {
- h = sym_hashes[r_symndx - symtab_hdr->sh_info];
- if (h->got.refcount > 0)
- h->got.refcount--;
- }
- else
- {
- if (local_got_refcounts[r_symndx] > 0)
- local_got_refcounts[r_symndx]--;
- }
+ dogot:
+ {
+ struct got_entry *ent;
+
+ if (h != NULL)
+ ent = h->got.glist;
+ else
+ ent = local_got_ents[r_symndx];
+
+ for (; ent != NULL; ent = ent->next)
+ if (ent->addend == rel->r_addend
+ && ent->owner == abfd
+ && ent->tls_type == tls_type)
+ break;
+ if (ent == NULL)
+ abort ();
+ if (ent->got.refcount > 0)
+ ent->got.refcount -= 1;
+ }
break;
case R_PPC64_PLT16_HA:
@@ -3029,87 +4290,21 @@ ppc64_elf_gc_sweep_hook (abfd, info, sec, relocs)
case R_PPC64_PLT16_LO:
case R_PPC64_PLT32:
case R_PPC64_PLT64:
- if (r_symndx >= symtab_hdr->sh_info)
- {
- h = sym_hashes[r_symndx - symtab_hdr->sh_info];
- if (h->plt.refcount > 0)
- h->plt.refcount--;
- }
- break;
-
case R_PPC64_REL14:
case R_PPC64_REL14_BRNTAKEN:
case R_PPC64_REL14_BRTAKEN:
case R_PPC64_REL24:
- if (r_symndx >= symtab_hdr->sh_info)
- {
- h = sym_hashes[r_symndx - symtab_hdr->sh_info];
- if (h->plt.refcount > 0)
- h->plt.refcount--;
- }
- break;
-
- case R_PPC64_REL32:
- case R_PPC64_REL64:
- if (r_symndx >= symtab_hdr->sh_info)
- {
- struct ppc_link_hash_entry *eh;
- struct ppc_dyn_relocs **pp;
- struct ppc_dyn_relocs *p;
-
- h = sym_hashes[r_symndx - symtab_hdr->sh_info];
- eh = (struct ppc_link_hash_entry *) h;
-
- for (pp = &eh->dyn_relocs; (p = *pp) != NULL; pp = &p->next)
- if (p->sec == sec)
- {
- p->pc_count -= 1;
- p->count -= 1;
- if (p->count == 0)
- *pp = p->next;
- break;
- }
- }
- break;
-
- case R_PPC64_ADDR14:
- case R_PPC64_ADDR14_BRNTAKEN:
- case R_PPC64_ADDR14_BRTAKEN:
- case R_PPC64_ADDR16:
- case R_PPC64_ADDR16_DS:
- case R_PPC64_ADDR16_HA:
- case R_PPC64_ADDR16_HI:
- case R_PPC64_ADDR16_HIGHER:
- case R_PPC64_ADDR16_HIGHERA:
- case R_PPC64_ADDR16_HIGHEST:
- case R_PPC64_ADDR16_HIGHESTA:
- case R_PPC64_ADDR16_LO:
- case R_PPC64_ADDR16_LO_DS:
- case R_PPC64_ADDR24:
- case R_PPC64_ADDR30:
- case R_PPC64_ADDR32:
- case R_PPC64_ADDR64:
- case R_PPC64_UADDR16:
- case R_PPC64_UADDR32:
- case R_PPC64_UADDR64:
- case R_PPC64_TOC:
- if (r_symndx >= symtab_hdr->sh_info)
+ if (h != NULL)
{
- struct ppc_link_hash_entry *eh;
- struct ppc_dyn_relocs **pp;
- struct ppc_dyn_relocs *p;
-
- h = sym_hashes[r_symndx - symtab_hdr->sh_info];
- eh = (struct ppc_link_hash_entry *) h;
+ struct plt_entry *ent;
- for (pp = &eh->dyn_relocs; (p = *pp) != NULL; pp = &p->next)
- if (p->sec == sec)
- {
- p->count -= 1;
- if (p->count == 0)
- *pp = p->next;
- break;
- }
+ for (ent = h->plt.plist; ent != NULL; ent = ent->next)
+ if (ent->addend == rel->r_addend)
+ break;
+ if (ent == NULL)
+ abort ();
+ if (ent->plt.refcount > 0)
+ ent->plt.refcount -= 1;
}
break;
@@ -3117,124 +4312,131 @@ ppc64_elf_gc_sweep_hook (abfd, info, sec, relocs)
break;
}
}
- return true;
+ return TRUE;
}
/* Called via elf_link_hash_traverse to transfer dynamic linking
information on function code symbol entries to their corresponding
function descriptor symbol entries. */
-static boolean
-func_desc_adjust (h, inf)
- struct elf_link_hash_entry *h;
- PTR inf;
+static bfd_boolean
+func_desc_adjust (struct elf_link_hash_entry *h, void *inf)
{
struct bfd_link_info *info;
struct ppc_link_hash_table *htab;
+ struct plt_entry *ent;
+ struct ppc_link_hash_entry *fh;
+ struct ppc_link_hash_entry *fdh;
+ bfd_boolean force_local;
- if (h->root.type == bfd_link_hash_indirect)
- return true;
+ fh = (struct ppc_link_hash_entry *) h;
+ if (fh->elf.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 (fh->elf.root.type == bfd_link_hash_warning)
+ fh = (struct ppc_link_hash_entry *) fh->elf.root.u.i.link;
- info = (struct bfd_link_info *) inf;
+ info = inf;
htab = ppc_hash_table (info);
/* If this is a function code symbol, transfer dynamic linking
information to the function descriptor symbol. */
- if (!((struct ppc_link_hash_entry *) h)->is_func)
- return true;
+ if (!fh->is_func)
+ return TRUE;
- if (h->root.type == bfd_link_hash_undefweak
- && (h->elf_link_hash_flags & ELF_LINK_HASH_REF_REGULAR))
- htab->have_undefweak = 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;
- if (h->plt.refcount > 0
- && h->root.root.string[0] == '.'
- && h->root.root.string[1] != '\0')
+ for (ent = fh->elf.plt.plist; ent != NULL; ent = ent->next)
+ if (ent->plt.refcount > 0)
+ break;
+ if (ent == NULL
+ || fh->elf.root.root.string[0] != '.'
+ || fh->elf.root.root.string[1] == '\0')
+ return TRUE;
+
+ /* Find the corresponding function descriptor symbol. Create it
+ as undefined if necessary. */
+
+ fdh = get_fdh (fh, htab);
+ if (fdh != NULL)
+ while (fdh->elf.root.type == bfd_link_hash_indirect
+ || fdh->elf.root.type == bfd_link_hash_warning)
+ fdh = (struct ppc_link_hash_entry *) fdh->elf.root.u.i.link;
+
+ if (fdh == NULL
+ && info->shared
+ && (fh->elf.root.type == bfd_link_hash_undefined
+ || fh->elf.root.type == bfd_link_hash_undefweak))
{
- struct elf_link_hash_entry *fdh = ((struct ppc_link_hash_entry *) h)->oh;
- boolean force_local;
-
- /* Find the corresponding function descriptor symbol. Create it
- as undefined if necessary. */
-
- if (fdh == NULL)
- fdh = elf_link_hash_lookup (&htab->elf, h->root.root.string + 1,
- false, false, true);
-
- if (fdh == NULL
- && info->shared
- && (h->root.type == bfd_link_hash_undefined
- || h->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)))
{
- bfd *abfd;
- asymbol *newsym;
- struct bfd_link_hash_entry *bh;
-
- abfd = h->root.u.undef.abfd;
- newsym = bfd_make_empty_symbol (abfd);
- newsym->name = h->root.root.string + 1;
- newsym->section = bfd_und_section_ptr;
- newsym->value = 0;
- newsym->flags = BSF_OBJECT;
- if (h->root.type == bfd_link_hash_undefweak)
- newsym->flags |= BSF_WEAK;
-
- bh = &fdh->root;
- if ( !(_bfd_generic_link_add_one_symbol
- (info, abfd, newsym->name, newsym->flags,
- newsym->section, newsym->value, NULL, false, false, &bh)))
- {
- return false;
- }
- fdh = (struct elf_link_hash_entry *) bh;
- fdh->elf_link_hash_flags &= ~ELF_LINK_NON_ELF;
+ return FALSE;
}
+ fdh = (struct ppc_link_hash_entry *) bh;
+ fdh->elf.elf_link_hash_flags &= ~ELF_LINK_NON_ELF;
+ fdh->elf.size = 24;
+ fdh->elf.type = STT_OBJECT;
+ }
- if (fdh != NULL
- && (fdh->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0
- && (info->shared
- || (fdh->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) != 0
- || (fdh->elf_link_hash_flags & ELF_LINK_HASH_REF_DYNAMIC) != 0))
+ if (fdh != NULL
+ && (fdh->elf.elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0
+ && (info->shared
+ || (fdh->elf.elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) != 0
+ || (fdh->elf.elf_link_hash_flags & ELF_LINK_HASH_REF_DYNAMIC) != 0
+ || (fdh->elf.root.type == bfd_link_hash_undefweak
+ && ELF_ST_VISIBILITY (fdh->elf.other) == STV_DEFAULT)))
+ {
+ if (fdh->elf.dynindx == -1)
+ if (! bfd_elf_link_record_dynamic_symbol (info, &fdh->elf))
+ return FALSE;
+ fdh->elf.elf_link_hash_flags
+ |= (fh->elf.elf_link_hash_flags & (ELF_LINK_HASH_REF_REGULAR
+ | ELF_LINK_HASH_REF_DYNAMIC
+ | ELF_LINK_HASH_REF_REGULAR_NONWEAK
+ | ELF_LINK_NON_GOT_REF));
+ if (ELF_ST_VISIBILITY (fh->elf.other) == STV_DEFAULT)
{
- if (fdh->dynindx == -1)
- if (! bfd_elf64_link_record_dynamic_symbol (info, fdh))
- return false;
- fdh->elf_link_hash_flags |= (h->elf_link_hash_flags
- & (ELF_LINK_HASH_REF_REGULAR
- | ELF_LINK_HASH_REF_DYNAMIC
- | ELF_LINK_HASH_REF_REGULAR_NONWEAK
- | ELF_LINK_NON_GOT_REF));
- if (ELF_ST_VISIBILITY (h->other) == STV_DEFAULT)
- {
- fdh->plt.refcount = h->plt.refcount;
- fdh->elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_PLT;
- }
- ((struct ppc_link_hash_entry *) fdh)->is_func_descriptor = 1;
- ((struct ppc_link_hash_entry *) fdh)->oh = h;
- ((struct ppc_link_hash_entry *) h)->oh = fdh;
+ fdh->elf.plt.plist = fh->elf.plt.plist;
+ fdh->elf.elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_PLT;
}
-
- /* Now that the info is on the function descriptor, clear the
- function code sym info. Any function code syms for which we
- don't have a definition in a regular file, we force local.
- This prevents a shared library from exporting syms that have
- been imported from another library. Function code syms that
- are really in the library we must leave global to prevent the
- linker dragging in a definition from a static library. */
- force_local = (info->shared
- && ((h->elf_link_hash_flags
- & ELF_LINK_HASH_DEF_REGULAR) == 0
- || fdh == NULL
- || (fdh->elf_link_hash_flags
- & ELF_LINK_HASH_DEF_REGULAR) == 0
- || (fdh->elf_link_hash_flags
- & ELF_LINK_FORCED_LOCAL) != 0));
- _bfd_elf_link_hash_hide_symbol (info, h, force_local);
+ fdh->is_func_descriptor = 1;
+ fdh->oh = &fh->elf;
+ fh->oh = &fdh->elf;
}
- return true;
+ /* Now that the info is on the function descriptor, clear the
+ function code sym info. Any function code syms for which we
+ don't have a definition in a regular file, we force local.
+ This prevents a shared library from exporting syms that have
+ been imported from another library. Function code syms that
+ are really in the library we must leave global to prevent the
+ linker dragging in a definition from a static library. */
+ force_local
+ = (info->shared
+ && ((fh->elf.elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0
+ || fdh == NULL
+ || (fdh->elf.elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0
+ || (fdh->elf.elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) != 0));
+ _bfd_elf_link_hash_hide_symbol (info, &fh->elf, force_local);
+
+ return TRUE;
}
#define MIN_SAVE_FPR 14
@@ -3244,10 +4446,9 @@ func_desc_adjust (h, inf)
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 boolean
-ppc64_elf_func_desc_adjust (obfd, info)
- bfd *obfd ATTRIBUTE_UNUSED;
- struct bfd_link_info *info;
+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;
@@ -3261,7 +4462,7 @@ ppc64_elf_func_desc_adjust (obfd, info)
if (htab->sfpr == NULL)
/* We don't have any relocs. */
- return true;
+ return TRUE;
/* First provide any missing ._savef* and ._restf* functions. */
memcpy (sym, "._savef14", 10);
@@ -3269,9 +4470,9 @@ ppc64_elf_func_desc_adjust (obfd, info)
{
sym[7] = i / 10 + '0';
sym[8] = i % 10 + '0';
- h = elf_link_hash_lookup (&htab->elf, sym, false, false, true);
+ h = elf_link_hash_lookup (&htab->elf, sym, FALSE, FALSE, TRUE);
if (h != NULL
- && h->root.type == bfd_link_hash_undefined)
+ && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0)
{
if (lowest_savef > i)
lowest_savef = i;
@@ -3280,7 +4481,7 @@ ppc64_elf_func_desc_adjust (obfd, info)
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, info->shared);
+ _bfd_elf_link_hash_hide_symbol (info, h, TRUE);
}
}
@@ -3289,9 +4490,9 @@ ppc64_elf_func_desc_adjust (obfd, info)
{
sym[7] = i / 10 + '0';
sym[8] = i % 10 + '0';
- h = elf_link_hash_lookup (&htab->elf, sym, false, false, true);
+ h = elf_link_hash_lookup (&htab->elf, sym, FALSE, FALSE, TRUE);
if (h != NULL
- && h->root.type == bfd_link_hash_undefined)
+ && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0)
{
if (lowest_restf > i)
lowest_restf = i;
@@ -3301,11 +4502,11 @@ ppc64_elf_func_desc_adjust (obfd, info)
+ (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, info->shared);
+ _bfd_elf_link_hash_hide_symbol (info, h, TRUE);
}
}
- elf_link_hash_traverse (&htab->elf, func_desc_adjust, (PTR) info);
+ 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);
@@ -3315,15 +4516,15 @@ ppc64_elf_func_desc_adjust (obfd, info)
if (!htab->have_undefweak)
{
_bfd_strip_section_from_output (info, htab->sfpr);
- return true;
+ return TRUE;
}
htab->sfpr->_raw_size = 4;
}
- p = (bfd_byte *) bfd_alloc (htab->elf.dynobj, htab->sfpr->_raw_size);
+ p = bfd_alloc (htab->elf.dynobj, htab->sfpr->_raw_size);
if (p == NULL)
- return false;
+ return FALSE;
htab->sfpr->contents = p;
for (i = lowest_savef; i <= MAX_SAVE_FPR; i++)
@@ -3352,7 +4553,7 @@ ppc64_elf_func_desc_adjust (obfd, info)
bfd_put_32 (htab->elf.dynobj, BLR, p);
}
- return true;
+ return TRUE;
}
/* Adjust a symbol defined by a dynamic object and referenced by a
@@ -3361,14 +4562,11 @@ ppc64_elf_func_desc_adjust (obfd, info)
change the definition to something the rest of the link can
understand. */
-static boolean
-ppc64_elf_adjust_dynamic_symbol (info, h)
- struct bfd_link_info *info;
- struct elf_link_hash_entry *h;
+static bfd_boolean
+ppc64_elf_adjust_dynamic_symbol (struct bfd_link_info *info,
+ struct elf_link_hash_entry *h)
{
struct ppc_link_hash_table *htab;
- struct ppc_link_hash_entry * eh;
- struct ppc_dyn_relocs *p;
asection *s;
unsigned int power_of_two;
@@ -3380,20 +4578,22 @@ ppc64_elf_adjust_dynamic_symbol (info, h)
{
/* Clear procedure linkage table information for any symbol that
won't need a .plt entry. */
+ struct plt_entry *ent;
+ for (ent = h->plt.plist; ent != NULL; ent = ent->next)
+ if (ent->plt.refcount > 0)
+ break;
if (!((struct ppc_link_hash_entry *) h)->is_func_descriptor
- || h->plt.refcount <= 0
- || (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) != 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))
+ || ent == NULL
+ || SYMBOL_CALLS_LOCAL (info, h)
+ || (ELF_ST_VISIBILITY (h->other) != STV_DEFAULT
+ && h->root.type == bfd_link_hash_undefweak))
{
- h->plt.offset = (bfd_vma) -1;
+ h->plt.plist = NULL;
h->elf_link_hash_flags &= ~ELF_LINK_HASH_NEEDS_PLT;
}
- return true;
}
else
- h->plt.offset = (bfd_vma) -1;
+ 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
@@ -3404,40 +4604,63 @@ ppc64_elf_adjust_dynamic_symbol (info, h)
|| h->weakdef->root.type == bfd_link_hash_defweak);
h->root.u.def.section = h->weakdef->root.u.def.section;
h->root.u.def.value = h->weakdef->root.u.def.value;
- return true;
+ if (ELIMINATE_COPY_RELOCS)
+ h->elf_link_hash_flags
+ = ((h->elf_link_hash_flags & ~ELF_LINK_NON_GOT_REF)
+ | (h->weakdef->elf_link_hash_flags & ELF_LINK_NON_GOT_REF));
+ return TRUE;
}
- /* This is a reference to a symbol defined by a dynamic object which
- is not a function. */
-
/* If we are creating a shared library, we must presume that the
only references to the symbol are via the global offset table.
For such cases we need not do anything here; the relocations will
be handled correctly by relocate_section. */
if (info->shared)
- return true;
+ 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;
+ return TRUE;
- eh = (struct ppc_link_hash_entry *) h;
- for (p = eh->dyn_relocs; p != NULL; p = p->next)
+ if (ELIMINATE_COPY_RELOCS)
{
- s = p->sec->output_section;
- if (s != NULL && (s->flags & SEC_READONLY) != 0)
- break;
+ struct ppc_link_hash_entry * eh;
+ struct ppc_dyn_relocs *p;
+
+ eh = (struct ppc_link_hash_entry *) h;
+ for (p = eh->dyn_relocs; p != NULL; p = p->next)
+ {
+ s = p->sec->output_section;
+ if (s != NULL && (s->flags & SEC_READONLY) != 0)
+ break;
+ }
+
+ /* If we didn't find any dynamic relocs in read-only sections, then
+ we'll be keeping the dynamic relocs and avoiding the copy reloc. */
+ if (p == NULL)
+ {
+ h->elf_link_hash_flags &= ~ELF_LINK_NON_GOT_REF;
+ return TRUE;
+ }
}
- /* If 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 (h->plt.plist != NULL)
{
- h->elf_link_hash_flags &= ~ELF_LINK_NON_GOT_REF;
- return true;
+ /* We should never get here, but unfortunately there are versions
+ of gcc out there that improperly (for this ABI) put initialized
+ function pointers, vtable refs and suchlike in read-only
+ sections. Allow them to proceed, but warn that this might
+ break at runtime. */
+ (*_bfd_error_handler)
+ (_("copy reloc against `%s' requires lazy plt linking; "
+ "avoid setting LD_BIND_NOW=1 or upgrade gcc"),
+ h->root.root.string);
}
+ /* This is a reference to a symbol defined by a dynamic object which
+ is not a function. */
+
/* We must allocate the symbol in our .dynbss section, which will
become part of the .bss section of the executable. There will be
an entry for this symbol in the .dynsym section. The dynamic
@@ -3448,13 +4671,13 @@ ppc64_elf_adjust_dynamic_symbol (info, h)
both the dynamic object and the regular object will refer to the
same memory location for the variable. */
- /* 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
+ /* We must generate a R_PPC64_COPY reloc to tell the dynamic linker
+ to copy the initial value out of the dynamic object and into the
runtime process image. We need to remember the offset into the
.rela.bss section we are going to use. */
if ((h->root.u.def.section->flags & SEC_ALLOC) != 0)
{
- htab->srelbss->_raw_size += sizeof (Elf64_External_Rela);
+ htab->relbss->_raw_size += sizeof (Elf64_External_Rela);
h->elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_COPY;
}
@@ -3465,12 +4688,12 @@ ppc64_elf_adjust_dynamic_symbol (info, h)
power_of_two = 4;
/* Apply the required alignment. */
- s = htab->sdynbss;
+ 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;
+ return FALSE;
}
/* Define the symbol as being at this point in the section. */
@@ -3480,16 +4703,15 @@ ppc64_elf_adjust_dynamic_symbol (info, h)
/* Increment the section size to make room for the symbol. */
s->_raw_size += h->size;
- return true;
+ return TRUE;
}
/* If given a function descriptor symbol, hide both the function code
sym and the descriptor. */
static void
-ppc64_elf_hide_symbol (info, h, force_local)
- struct bfd_link_info *info;
- struct elf_link_hash_entry *h;
- boolean force_local;
+ppc64_elf_hide_symbol (struct bfd_link_info *info,
+ struct elf_link_hash_entry *h,
+ bfd_boolean force_local)
{
_bfd_elf_link_hash_hide_symbol (info, h, force_local);
@@ -3516,7 +4738,7 @@ ppc64_elf_hide_symbol (info, h, force_local)
save = *p;
*(char *) p = '.';
htab = ppc_hash_table (info);
- fh = elf_link_hash_lookup (&htab->elf, p, false, false, false);
+ fh = elf_link_hash_lookup (&htab->elf, p, FALSE, FALSE, FALSE);
*(char *) p = save;
/* Unfortunately, if it so happens that the string we were
@@ -3529,7 +4751,7 @@ ppc64_elf_hide_symbol (info, h, force_local)
while (q >= h->root.root.string && *q == *p)
--q, --p;
if (q < h->root.root.string && *p == '.')
- fh = elf_link_hash_lookup (&htab->elf, p, false, false, false);
+ fh = elf_link_hash_lookup (&htab->elf, p, FALSE, FALSE, FALSE);
}
if (fh != NULL)
{
@@ -3542,17 +4764,197 @@ ppc64_elf_hide_symbol (info, h, force_local)
}
}
-static boolean
-edit_opd (obfd, info)
- bfd *obfd;
- struct bfd_link_info *info;
+static bfd_boolean
+get_sym_h (struct elf_link_hash_entry **hp, Elf_Internal_Sym **symp,
+ asection **symsecp, char **tls_maskp, Elf_Internal_Sym **locsymsp,
+ unsigned long r_symndx, bfd *ibfd)
+{
+ Elf_Internal_Shdr *symtab_hdr = &elf_tdata (ibfd)->symtab_hdr;
+
+ if (r_symndx >= symtab_hdr->sh_info)
+ {
+ struct elf_link_hash_entry **sym_hashes = elf_sym_hashes (ibfd);
+ struct elf_link_hash_entry *h;
+
+ h = sym_hashes[r_symndx - symtab_hdr->sh_info];
+ while (h->root.type == bfd_link_hash_indirect
+ || h->root.type == bfd_link_hash_warning)
+ h = (struct elf_link_hash_entry *) h->root.u.i.link;
+
+ if (hp != NULL)
+ *hp = h;
+
+ if (symp != NULL)
+ *symp = NULL;
+
+ if (symsecp != NULL)
+ {
+ asection *symsec = NULL;
+ if (h->root.type == bfd_link_hash_defined
+ || h->root.type == bfd_link_hash_defweak)
+ symsec = h->root.u.def.section;
+ *symsecp = symsec;
+ }
+
+ if (tls_maskp != NULL)
+ {
+ struct ppc_link_hash_entry *eh;
+
+ eh = (struct ppc_link_hash_entry *) h;
+ *tls_maskp = &eh->tls_mask;
+ }
+ }
+ else
+ {
+ Elf_Internal_Sym *sym;
+ Elf_Internal_Sym *locsyms = *locsymsp;
+
+ if (locsyms == NULL)
+ {
+ locsyms = (Elf_Internal_Sym *) symtab_hdr->contents;
+ if (locsyms == NULL)
+ locsyms = bfd_elf_get_elf_syms (ibfd, symtab_hdr,
+ symtab_hdr->sh_info,
+ 0, NULL, NULL, NULL);
+ if (locsyms == NULL)
+ return FALSE;
+ *locsymsp = locsyms;
+ }
+ sym = locsyms + r_symndx;
+
+ if (hp != NULL)
+ *hp = NULL;
+
+ if (symp != NULL)
+ *symp = sym;
+
+ if (symsecp != NULL)
+ {
+ asection *symsec = NULL;
+ if ((sym->st_shndx != SHN_UNDEF
+ && sym->st_shndx < SHN_LORESERVE)
+ || sym->st_shndx > SHN_HIRESERVE)
+ symsec = bfd_section_from_elf_index (ibfd, sym->st_shndx);
+ *symsecp = symsec;
+ }
+
+ if (tls_maskp != NULL)
+ {
+ struct got_entry **lgot_ents;
+ char *tls_mask;
+
+ tls_mask = NULL;
+ lgot_ents = elf_local_got_ents (ibfd);
+ if (lgot_ents != NULL)
+ {
+ char *lgot_masks = (char *) (lgot_ents + symtab_hdr->sh_info);
+ tls_mask = &lgot_masks[r_symndx];
+ }
+ *tls_maskp = tls_mask;
+ }
+ }
+ return TRUE;
+}
+
+/* Returns TLS_MASKP for the given REL symbol. Function return is 0 on
+ error, 2 on a toc GD type suitable for optimization, 3 on a toc LD
+ type suitable for optimization, and 1 otherwise. */
+
+static int
+get_tls_mask (char **tls_maskp, unsigned long *toc_symndx,
+ Elf_Internal_Sym **locsymsp,
+ const Elf_Internal_Rela *rel, bfd *ibfd)
+{
+ unsigned long r_symndx;
+ int next_r;
+ struct elf_link_hash_entry *h;
+ Elf_Internal_Sym *sym;
+ asection *sec;
+ bfd_vma off;
+
+ r_symndx = ELF64_R_SYM (rel->r_info);
+ if (!get_sym_h (&h, &sym, &sec, tls_maskp, locsymsp, r_symndx, ibfd))
+ return 0;
+
+ if ((*tls_maskp != NULL && **tls_maskp != 0)
+ || sec == NULL
+ || ppc64_elf_section_data (sec)->t_symndx == NULL)
+ return 1;
+
+ /* Look inside a TOC section too. */
+ if (h != NULL)
+ {
+ BFD_ASSERT (h->root.type == bfd_link_hash_defined);
+ off = h->root.u.def.value;
+ }
+ else
+ off = sym->st_value;
+ off += rel->r_addend;
+ BFD_ASSERT (off % 8 == 0);
+ r_symndx = ppc64_elf_section_data (sec)->t_symndx[off / 8];
+ next_r = ppc64_elf_section_data (sec)->t_symndx[off / 8 + 1];
+ if (!get_sym_h (&h, &sym, &sec, tls_maskp, locsymsp, r_symndx, ibfd))
+ return 0;
+ if (toc_symndx != NULL)
+ *toc_symndx = r_symndx;
+ if ((h == NULL
+ || ((h->root.type == bfd_link_hash_defined
+ || h->root.type == bfd_link_hash_defweak)
+ && !(h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC)))
+ && (next_r == -1 || next_r == -2))
+ return 1 - next_r;
+ return 1;
+}
+
+/* Adjust all global syms defined in opd sections. In gcc generated
+ code these will already have been done, but I suppose we have to
+ cater for all sorts of hand written assembly. */
+
+static bfd_boolean
+adjust_opd_syms (struct elf_link_hash_entry *h, void *inf ATTRIBUTE_UNUSED)
+{
+ struct ppc_link_hash_entry *eh;
+ asection *sym_sec;
+ long *opd_adjust;
+
+ if (h->root.type == bfd_link_hash_indirect)
+ return TRUE;
+
+ if (h->root.type == bfd_link_hash_warning)
+ h = (struct elf_link_hash_entry *) h->root.u.i.link;
+
+ if (h->root.type != bfd_link_hash_defined
+ && h->root.type != bfd_link_hash_defweak)
+ return TRUE;
+
+ eh = (struct ppc_link_hash_entry *) h;
+ if (eh->adjust_done)
+ return TRUE;
+
+ sym_sec = eh->elf.root.u.def.section;
+ if (sym_sec != NULL
+ && elf_section_data (sym_sec) != NULL
+ && (opd_adjust = ppc64_elf_section_data (sym_sec)->opd.adjust) != NULL)
+ {
+ eh->elf.root.u.def.value += opd_adjust[eh->elf.root.u.def.value / 24];
+ eh->adjust_done = 1;
+ }
+ return TRUE;
+}
+
+/* Remove unused Official Procedure Descriptor entries. Currently we
+ only remove those associated with functions in discarded link-once
+ sections, or weakly defined functions that have been overridden. It
+ would be possible to remove many more entries for statically linked
+ applications. */
+
+bfd_boolean
+ppc64_elf_edit_opd (bfd *obfd, struct bfd_link_info *info)
{
bfd *ibfd;
- unsigned int bfd_indx;
+ bfd_boolean some_edited = FALSE;
- for (bfd_indx = 0, ibfd = info->input_bfds;
- ibfd != NULL;
- ibfd = ibfd->link_next, bfd_indx++)
+ for (ibfd = info->input_bfds; ibfd != NULL; ibfd = ibfd->link_next)
{
asection *sec;
Elf_Internal_Rela *relstart, *rel, *relend;
@@ -3560,16 +4962,24 @@ edit_opd (obfd, info)
Elf_Internal_Sym *local_syms;
struct elf_link_hash_entry **sym_hashes;
bfd_vma offset;
+ bfd_size_type amt;
long *adjust;
- boolean need_edit;
+ bfd_boolean need_edit;
sec = bfd_get_section_by_name (ibfd, ".opd");
if (sec == NULL)
continue;
- adjust = (long *) elf_section_data (sec)->tdata;
- BFD_ASSERT (adjust != NULL);
- memset (adjust, 0, (size_t) sec->_raw_size * sizeof (long) / 24);
+ amt = sec->_raw_size * sizeof (long) / 24;
+ adjust = ppc64_elf_section_data (sec)->opd.adjust;
+ if (adjust == NULL)
+ {
+ /* Must be a ld -r link. ie. check_relocs hasn't been
+ called. */
+ adjust = bfd_zalloc (obfd, amt);
+ ppc64_elf_section_data (sec)->opd.adjust = adjust;
+ }
+ memset (adjust, 0, amt);
if (sec->output_section == bfd_abs_section_ptr)
continue;
@@ -3583,20 +4993,19 @@ edit_opd (obfd, info)
sym_hashes = elf_sym_hashes (ibfd);
/* Read the relocations. */
- relstart = _bfd_elf64_link_read_relocs (obfd, sec, (PTR) NULL,
- (Elf_Internal_Rela *) NULL,
- info->keep_memory);
+ relstart = _bfd_elf_link_read_relocs (ibfd, sec, NULL, NULL,
+ info->keep_memory);
if (relstart == NULL)
- return false;
+ return FALSE;
/* First run through the relocs to check they are sane, and to
determine whether we need to edit this opd section. */
- need_edit = false;
+ need_edit = FALSE;
offset = 0;
relend = relstart + sec->reloc_count;
- for (rel = relstart; rel < relend; rel++)
+ for (rel = relstart; rel < relend; )
{
- enum elf_ppc_reloc_type r_type;
+ enum elf_ppc64_reloc_type r_type;
unsigned long r_symndx;
asection *sym_sec;
struct elf_link_hash_entry *h;
@@ -3605,79 +5014,50 @@ edit_opd (obfd, info)
/* .opd contains a regular array of 24 byte entries. We're
only interested in the reloc pointing to a function entry
point. */
- r_type = (enum elf_ppc_reloc_type) ELF64_R_TYPE (rel->r_info);
- if (r_type == R_PPC64_TOC)
- continue;
-
- if (r_type != R_PPC64_ADDR64)
- {
- (*_bfd_error_handler)
- (_("%s: unexpected reloc type %u in .opd section"),
- bfd_archive_filename (ibfd), r_type);
- need_edit = false;
- break;
- }
-
- if (rel + 1 >= relend)
- continue;
- r_type = (enum elf_ppc_reloc_type) ELF64_R_TYPE ((rel + 1)->r_info);
- if (r_type != R_PPC64_TOC)
- continue;
-
- if (rel->r_offset != offset)
+ if (rel->r_offset != offset
+ || rel + 1 >= relend
+ || (rel + 1)->r_offset != offset + 8)
{
/* If someone messes with .opd alignment then after a
"ld -r" we might have padding in the middle of .opd.
Also, there's nothing to prevent someone putting
something silly in .opd with the assembler. No .opd
- optimization for them! */
+ optimization for them! */
(*_bfd_error_handler)
(_("%s: .opd is not a regular array of opd entries"),
bfd_archive_filename (ibfd));
- need_edit = false;
+ need_edit = FALSE;
break;
}
- r_symndx = ELF64_R_SYM (rel->r_info);
- sym_sec = NULL;
- h = NULL;
- sym = NULL;
- if (r_symndx >= symtab_hdr->sh_info)
+ if ((r_type = ELF64_R_TYPE (rel->r_info)) != R_PPC64_ADDR64
+ || (r_type = ELF64_R_TYPE ((rel + 1)->r_info)) != R_PPC64_TOC)
{
- 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)
- sym_sec = h->root.u.def.section;
- }
- else
- {
- if (local_syms == NULL)
- {
- local_syms = (Elf_Internal_Sym *) symtab_hdr->contents;
- if (local_syms == NULL)
- local_syms = bfd_elf_get_elf_syms (ibfd, symtab_hdr,
- symtab_hdr->sh_info, 0,
- NULL, NULL, NULL);
- if (local_syms == NULL)
- goto error_free_rel;
- }
- sym = local_syms + r_symndx;
- if ((sym->st_shndx != SHN_UNDEF
- && sym->st_shndx < SHN_LORESERVE)
- || sym->st_shndx > SHN_HIRESERVE)
- sym_sec = bfd_section_from_elf_index (ibfd, sym->st_shndx);
+ (*_bfd_error_handler)
+ (_("%s: unexpected reloc type %u in .opd section"),
+ bfd_archive_filename (ibfd), r_type);
+ need_edit = FALSE;
+ break;
}
+ r_symndx = ELF64_R_SYM (rel->r_info);
+ if (!get_sym_h (&h, &sym, &sym_sec, NULL, &local_syms,
+ r_symndx, ibfd))
+ goto error_ret;
+
if (sym_sec == NULL || sym_sec->owner == NULL)
{
+ const char *sym_name;
+ if (h != NULL)
+ sym_name = h->root.root.string;
+ else
+ sym_name = bfd_elf_local_sym_name (ibfd, sym);
+
(*_bfd_error_handler)
(_("%s: undefined sym `%s' in .opd section"),
bfd_archive_filename (ibfd),
- h != NULL ? h->root.root.string : "<local symbol>");
- need_edit = false;
+ sym_name);
+ need_edit = FALSE;
break;
}
@@ -3690,16 +5070,21 @@ edit_opd (obfd, info)
which we test for via the output_section. */
if (sym_sec->owner != ibfd
|| sym_sec->output_section == bfd_abs_section_ptr)
- need_edit = true;
+ need_edit = TRUE;
offset += 24;
+ rel += 2;
+ /* Allow for the possibility of a reloc on the third word. */
+ if (rel < relend
+ && rel->r_offset == offset - 8)
+ rel += 1;
}
if (need_edit)
{
Elf_Internal_Rela *write_rel;
bfd_byte *rptr, *wptr;
- boolean skip;
+ bfd_boolean skip;
/* This seems a waste of time as input .opd sections are all
zeros as generated by gcc, but I suppose there's no reason
@@ -3709,16 +5094,16 @@ edit_opd (obfd, info)
{
bfd_byte *loc = bfd_alloc (ibfd, sec->_raw_size);
if (loc == NULL
- || !bfd_get_section_contents (ibfd, sec, loc, (bfd_vma) 0,
+ || !bfd_get_section_contents (ibfd, sec, loc, 0,
sec->_raw_size))
{
+ error_ret:
if (local_syms != NULL
&& symtab_hdr->contents != (unsigned char *) local_syms)
free (local_syms);
- error_free_rel:
if (elf_section_data (sec)->relocs != relstart)
free (relstart);
- return false;
+ return FALSE;
}
sec->contents = loc;
sec->flags |= (SEC_IN_MEMORY | SEC_HAS_CONTENTS);
@@ -3729,40 +5114,26 @@ edit_opd (obfd, info)
wptr = sec->contents;
rptr = sec->contents;
write_rel = relstart;
- skip = false;
+ skip = FALSE;
offset = 0;
for (rel = relstart; rel < relend; rel++)
{
+ unsigned long r_symndx;
+ asection *sym_sec;
+ struct elf_link_hash_entry *h;
+ Elf_Internal_Sym *sym;
+
+ r_symndx = ELF64_R_SYM (rel->r_info);
+ if (!get_sym_h (&h, &sym, &sym_sec, NULL, &local_syms,
+ r_symndx, ibfd))
+ goto error_ret;
+
if (rel->r_offset == offset)
{
- unsigned long r_symndx;
- asection *sym_sec;
- struct elf_link_hash_entry *h;
- Elf_Internal_Sym *sym;
-
- r_symndx = ELF64_R_SYM (rel->r_info);
- sym_sec = NULL;
- h = NULL;
- sym = NULL;
- 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;
- if (h->root.type == bfd_link_hash_defined
- || h->root.type == bfd_link_hash_defweak)
- sym_sec = h->root.u.def.section;
- }
- else
- {
- sym = local_syms + r_symndx;
- if ((sym->st_shndx != SHN_UNDEF
- && sym->st_shndx < SHN_LORESERVE)
- || sym->st_shndx > SHN_HIRESERVE)
- sym_sec = bfd_section_from_elf_index (ibfd,
- sym->st_shndx);
- }
+ struct ppc_link_hash_entry *fdh = NULL;
+ if (h != NULL)
+ fdh = get_fdh ((struct ppc_link_hash_entry *) h,
+ ppc_hash_table (info));
skip = (sym_sec->owner != ibfd
|| sym_sec->output_section == bfd_abs_section_ptr);
@@ -3772,14 +5143,8 @@ edit_opd (obfd, info)
{
/* Arrange for the function descriptor sym
to be dropped. */
- struct elf_link_hash_entry *fdh;
- struct ppc_link_hash_entry *fh;
-
- fh = (struct ppc_link_hash_entry *) h;
- BFD_ASSERT (fh->is_func);
- fdh = fh->oh;
- fdh->root.u.def.value = 0;
- fdh->root.u.def.section = sym_sec;
+ fdh->elf.root.u.def.value = 0;
+ fdh->elf.root.u.def.section = sym_sec;
}
}
else
@@ -3788,29 +5153,25 @@ edit_opd (obfd, info)
if (h != NULL)
{
- /* Redefine the function descriptor symbol
- to this location in the opd section.
- We've checked above that opd relocs are
- ordered. */
- struct elf_link_hash_entry *fdh;
- struct ppc_link_hash_entry *fh;
-
- fh = (struct ppc_link_hash_entry *) h;
- BFD_ASSERT (fh->is_func);
- fdh = fh->oh;
- fdh->root.u.def.value = wptr - sec->contents;
- }
- else
- {
- /* Local syms are a bit tricky. We could
- tweak them as they can be cached, but
- we'd need to look through the local syms
- for the function descriptor sym which we
- don't have at the moment. So keep an
- array of adjustments. */
- adjust[rel->r_offset / 24] = wptr - rptr;
+ /* Redefine the function descriptor symbol to
+ this location in the opd section. It is
+ necessary to update the value here rather
+ than using an array of adjustments as we do
+ for local symbols, because various places
+ in the generic ELF code use the value
+ stored in u.def.value. */
+ fdh->elf.root.u.def.value = wptr - sec->contents;
+ fdh->adjust_done = 1;
}
+ /* Local syms are a bit tricky. We could
+ tweak them as they can be cached, but
+ we'd need to look through the local syms
+ for the function descriptor sym which we
+ don't have at the moment. So keep an
+ array of adjustments. */
+ adjust[rel->r_offset / 24] = wptr - rptr;
+
if (wptr != rptr)
memcpy (wptr, rptr, 24);
wptr += 24;
@@ -3819,11 +5180,41 @@ edit_opd (obfd, info)
offset += 24;
}
- /* 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. */
- if (!skip)
+ if (skip)
{
+ BFD_ASSERT (MUST_BE_DYN_RELOC (ELF64_R_TYPE (rel->r_info)));
+ if (info->shared)
+ {
+ /* We won't be needing dynamic relocs here. */
+ struct ppc_dyn_relocs **pp;
+ struct ppc_dyn_relocs *p;
+
+ if (h != NULL)
+ pp = &((struct ppc_link_hash_entry *) h)->dyn_relocs;
+ else if (sym_sec != NULL)
+ pp = ((struct ppc_dyn_relocs **)
+ &elf_section_data (sym_sec)->local_dynrel);
+ else
+ pp = ((struct ppc_dyn_relocs **)
+ &elf_section_data (sec)->local_dynrel);
+ while ((p = *pp) != NULL)
+ {
+ if (p->sec == sec)
+ {
+ p->count -= 1;
+ if (p->count == 0)
+ *pp = p->next;
+ break;
+ }
+ pp = &p->next;
+ }
+ }
+ }
+ else
+ {
+ /* We need to adjust any reloc offsets to point to the
+ new opd entries. While we're at it, we may as well
+ remove redundant relocs. */
rel->r_offset += wptr - rptr;
if (write_rel != rel)
memcpy (write_rel, rel, sizeof (*rel));
@@ -3833,6 +5224,12 @@ edit_opd (obfd, info)
sec->_cooked_size = wptr - sec->contents;
sec->reloc_count = write_rel - relstart;
+ /* Fudge the size too, as this is used later in
+ elf_bfd_final_link if we are emitting relocs. */
+ elf_section_data (sec)->rel_hdr.sh_size
+ = sec->reloc_count * elf_section_data (sec)->rel_hdr.sh_entsize;
+ BFD_ASSERT (elf_section_data (sec)->rel_hdr2 == NULL);
+ some_edited = TRUE;
}
else if (elf_section_data (sec)->relocs != relstart)
free (relstart);
@@ -3847,36 +5244,351 @@ edit_opd (obfd, info)
}
}
- return true;
+ if (some_edited)
+ elf_link_hash_traverse (elf_hash_table (info), adjust_opd_syms, NULL);
+
+ return TRUE;
+}
+
+/* Set htab->tls_get_addr and call the generic ELF tls_setup function. */
+
+asection *
+ppc64_elf_tls_setup (bfd *obfd, struct bfd_link_info *info)
+{
+ struct ppc_link_hash_table *htab;
+
+ htab = ppc_hash_table (info);
+ if (htab->tls_get_addr != NULL)
+ {
+ struct elf_link_hash_entry *h = htab->tls_get_addr;
+
+ while (h->root.type == bfd_link_hash_indirect
+ || h->root.type == bfd_link_hash_warning)
+ h = (struct elf_link_hash_entry *) h->root.u.i.link;
+
+ htab->tls_get_addr = h;
+ }
+
+ return _bfd_elf_tls_setup (obfd, info);
+}
+
+/* Run through all the TLS relocs looking for optimization
+ opportunities. The linker has been hacked (see ppc64elf.em) to do
+ a preliminary section layout so that we know the TLS segment
+ offsets. We can't optimize earlier because some optimizations need
+ to know the tp offset, and we need to optimize before allocating
+ dynamic relocations. */
+
+bfd_boolean
+ppc64_elf_tls_optimize (bfd *obfd ATTRIBUTE_UNUSED, struct bfd_link_info *info)
+{
+ bfd *ibfd;
+ asection *sec;
+ struct ppc_link_hash_table *htab;
+
+ if (info->relocatable || info->shared)
+ return TRUE;
+
+ htab = ppc_hash_table (info);
+ for (ibfd = info->input_bfds; ibfd != NULL; ibfd = ibfd->link_next)
+ {
+ Elf_Internal_Sym *locsyms = NULL;
+
+ for (sec = ibfd->sections; sec != NULL; sec = sec->next)
+ if (sec->has_tls_reloc && !bfd_is_abs_section (sec->output_section))
+ {
+ Elf_Internal_Rela *relstart, *rel, *relend;
+ int expecting_tls_get_addr;
+
+ /* Read the relocations. */
+ relstart = _bfd_elf_link_read_relocs (ibfd, sec, NULL, NULL,
+ info->keep_memory);
+ if (relstart == NULL)
+ return FALSE;
+
+ expecting_tls_get_addr = 0;
+ relend = relstart + sec->reloc_count;
+ for (rel = relstart; rel < relend; rel++)
+ {
+ enum elf_ppc64_reloc_type r_type;
+ unsigned long r_symndx;
+ struct elf_link_hash_entry *h;
+ Elf_Internal_Sym *sym;
+ asection *sym_sec;
+ char *tls_mask;
+ char tls_set, tls_clear, tls_type = 0;
+ bfd_vma value;
+ bfd_boolean ok_tprel, is_local;
+
+ r_symndx = ELF64_R_SYM (rel->r_info);
+ if (!get_sym_h (&h, &sym, &sym_sec, &tls_mask, &locsyms,
+ r_symndx, ibfd))
+ {
+ err_free_rel:
+ if (elf_section_data (sec)->relocs != relstart)
+ free (relstart);
+ if (locsyms != NULL
+ && (elf_tdata (ibfd)->symtab_hdr.contents
+ != (unsigned char *) locsyms))
+ free (locsyms);
+ return FALSE;
+ }
+
+ if (h != NULL)
+ {
+ if (h->root.type != bfd_link_hash_defined
+ && h->root.type != bfd_link_hash_defweak)
+ continue;
+ value = h->root.u.def.value;
+ }
+ else
+ {
+ value = sym->st_value;
+
+ if (elf_section_data (sym_sec) != NULL)
+ {
+ long *adjust;
+ adjust = ppc64_elf_section_data (sym_sec)->opd.adjust;
+ if (adjust != NULL)
+ value += adjust[value / 24];
+ }
+ }
+
+ ok_tprel = FALSE;
+ is_local = FALSE;
+ if (h == NULL
+ || !(h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC))
+ {
+ is_local = TRUE;
+ value += sym_sec->output_offset;
+ value += sym_sec->output_section->vma;
+ value -= htab->elf.tls_sec->vma;
+ ok_tprel = (value + TP_OFFSET + ((bfd_vma) 1 << 31)
+ < (bfd_vma) 1 << 32);
+ }
+
+ r_type = ELF64_R_TYPE (rel->r_info);
+ switch (r_type)
+ {
+ case R_PPC64_GOT_TLSLD16:
+ case R_PPC64_GOT_TLSLD16_LO:
+ case R_PPC64_GOT_TLSLD16_HI:
+ case R_PPC64_GOT_TLSLD16_HA:
+ /* These relocs should never be against a symbol
+ defined in a shared lib. Leave them alone if
+ that turns out to be the case. */
+ ppc64_tlsld_got (ibfd)->refcount -= 1;
+ if (!is_local)
+ continue;
+
+ /* LD -> LE */
+ tls_set = 0;
+ tls_clear = TLS_LD;
+ tls_type = TLS_TLS | TLS_LD;
+ expecting_tls_get_addr = 1;
+ break;
+
+ case R_PPC64_GOT_TLSGD16:
+ case R_PPC64_GOT_TLSGD16_LO:
+ case R_PPC64_GOT_TLSGD16_HI:
+ case R_PPC64_GOT_TLSGD16_HA:
+ if (ok_tprel)
+ /* GD -> LE */
+ tls_set = 0;
+ else
+ /* GD -> IE */
+ tls_set = TLS_TLS | TLS_TPRELGD;
+ tls_clear = TLS_GD;
+ tls_type = TLS_TLS | TLS_GD;
+ expecting_tls_get_addr = 1;
+ break;
+
+ case R_PPC64_GOT_TPREL16_DS:
+ case R_PPC64_GOT_TPREL16_LO_DS:
+ case R_PPC64_GOT_TPREL16_HI:
+ case R_PPC64_GOT_TPREL16_HA:
+ expecting_tls_get_addr = 0;
+ if (ok_tprel)
+ {
+ /* IE -> LE */
+ tls_set = 0;
+ tls_clear = TLS_TPREL;
+ tls_type = TLS_TLS | TLS_TPREL;
+ break;
+ }
+ else
+ continue;
+
+ case R_PPC64_REL14:
+ case R_PPC64_REL14_BRTAKEN:
+ case R_PPC64_REL14_BRNTAKEN:
+ case R_PPC64_REL24:
+ if (h != NULL
+ && h == htab->tls_get_addr)
+ {
+ if (!expecting_tls_get_addr
+ && rel != relstart
+ && ((ELF64_R_TYPE (rel[-1].r_info)
+ == R_PPC64_TOC16)
+ || (ELF64_R_TYPE (rel[-1].r_info)
+ == R_PPC64_TOC16_LO)))
+ {
+ /* Check for toc tls entries. */
+ char *toc_tls;
+ int retval;
+
+ retval = get_tls_mask (&toc_tls, NULL, &locsyms,
+ rel - 1, ibfd);
+ if (retval == 0)
+ goto err_free_rel;
+ if (toc_tls != NULL)
+ expecting_tls_get_addr = retval > 1;
+ }
+
+ if (expecting_tls_get_addr)
+ {
+ struct plt_entry *ent;
+ for (ent = h->plt.plist; ent; ent = ent->next)
+ if (ent->addend == 0)
+ {
+ if (ent->plt.refcount > 0)
+ ent->plt.refcount -= 1;
+ break;
+ }
+ }
+ }
+ expecting_tls_get_addr = 0;
+ continue;
+
+ case R_PPC64_TPREL64:
+ expecting_tls_get_addr = 0;
+ if (ok_tprel)
+ {
+ /* IE -> LE */
+ tls_set = TLS_EXPLICIT;
+ tls_clear = TLS_TPREL;
+ break;
+ }
+ else
+ continue;
+
+ case R_PPC64_DTPMOD64:
+ expecting_tls_get_addr = 0;
+ if (rel + 1 < relend
+ && (rel[1].r_info
+ == ELF64_R_INFO (r_symndx, R_PPC64_DTPREL64))
+ && rel[1].r_offset == rel->r_offset + 8)
+ {
+ if (ok_tprel)
+ /* GD -> LE */
+ tls_set = TLS_EXPLICIT | TLS_GD;
+ else
+ /* GD -> IE */
+ tls_set = TLS_EXPLICIT | TLS_GD | TLS_TPRELGD;
+ tls_clear = TLS_GD;
+ }
+ else
+ {
+ if (!is_local)
+ continue;
+
+ /* LD -> LE */
+ tls_set = TLS_EXPLICIT;
+ tls_clear = TLS_LD;
+ }
+ break;
+
+ default:
+ expecting_tls_get_addr = 0;
+ continue;
+ }
+
+ if ((tls_set & TLS_EXPLICIT) == 0)
+ {
+ struct got_entry *ent;
+
+ /* Adjust got entry for this reloc. */
+ if (h != NULL)
+ ent = h->got.glist;
+ else
+ ent = elf_local_got_ents (ibfd)[r_symndx];
+
+ for (; ent != NULL; ent = ent->next)
+ if (ent->addend == rel->r_addend
+ && ent->owner == ibfd
+ && ent->tls_type == tls_type)
+ break;
+ if (ent == NULL)
+ abort ();
+
+ if (tls_set == 0)
+ {
+ /* We managed to get rid of a got entry. */
+ if (ent->got.refcount > 0)
+ ent->got.refcount -= 1;
+ }
+ }
+ else if (h != NULL)
+ {
+ struct ppc_link_hash_entry * eh;
+ struct ppc_dyn_relocs **pp;
+ struct ppc_dyn_relocs *p;
+
+ /* Adjust dynamic relocs. */
+ eh = (struct ppc_link_hash_entry *) h;
+ for (pp = &eh->dyn_relocs;
+ (p = *pp) != NULL;
+ pp = &p->next)
+ if (p->sec == sec)
+ {
+ /* If we got rid of a DTPMOD/DTPREL reloc
+ pair then we'll lose one or two dyn
+ relocs. */
+ if (tls_set == (TLS_EXPLICIT | TLS_GD))
+ p->count -= 1;
+ p->count -= 1;
+ if (p->count == 0)
+ *pp = p->next;
+ break;
+ }
+ }
+
+ *tls_mask |= tls_set;
+ *tls_mask &= ~tls_clear;
+ }
+
+ if (elf_section_data (sec)->relocs != relstart)
+ free (relstart);
+ }
+
+ if (locsyms != NULL
+ && (elf_tdata (ibfd)->symtab_hdr.contents
+ != (unsigned char *) locsyms))
+ {
+ if (!info->keep_memory)
+ free (locsyms);
+ else
+ elf_tdata (ibfd)->symtab_hdr.contents = (unsigned char *) locsyms;
+ }
+ }
+ return TRUE;
}
-
-/* This is the condition under which ppc64_elf_finish_dynamic_symbol
- will be called from elflink.h. If elflink.h doesn't call our
- finish_dynamic_symbol routine, we'll need to do something about
- initializing any .plt and .got entries in ppc64_elf_relocate_section. */
-#define WILL_CALL_FINISH_DYNAMIC_SYMBOL(DYN, INFO, H) \
- ((DYN) \
- && ((INFO)->shared \
- || ((H)->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0) \
- && ((H)->dynindx != -1 \
- || ((H)->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) != 0))
/* Allocate space in .plt, .got and associated reloc sections for
dynamic relocs. */
-static boolean
-allocate_dynrelocs (h, inf)
- struct elf_link_hash_entry *h;
- PTR inf;
+static bfd_boolean
+allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf)
{
struct bfd_link_info *info;
struct ppc_link_hash_table *htab;
asection *s;
struct ppc_link_hash_entry *eh;
struct ppc_dyn_relocs *p;
+ struct got_entry *gent;
if (h->root.type == bfd_link_hash_indirect)
- return true;
+ return TRUE;
if (h->root.type == bfd_link_hash_warning)
h = (struct elf_link_hash_entry *) h->root.u.i.link;
@@ -3885,75 +5597,122 @@ allocate_dynrelocs (h, inf)
htab = ppc_hash_table (info);
if (htab->elf.dynamic_sections_created
- && h->plt.refcount > 0
- && h->dynindx != -1)
+ && h->dynindx != -1
+ && WILL_CALL_FINISH_DYNAMIC_SYMBOL (1, info->shared, h))
{
- BFD_ASSERT (((struct ppc_link_hash_entry *) h)->is_func_descriptor);
-
- if (WILL_CALL_FINISH_DYNAMIC_SYMBOL (1, info, h))
- {
- /* If this is the first .plt entry, make room for the special
- first entry. */
- s = htab->splt;
- if (s->_raw_size == 0)
- s->_raw_size += PLT_INITIAL_ENTRY_SIZE;
-
- h->plt.offset = s->_raw_size;
-
- /* Make room for this entry. */
- s->_raw_size += PLT_ENTRY_SIZE;
-
- /* Make room for the .glink code. */
- s = htab->sglink;
- if (s->_raw_size == 0)
- s->_raw_size += GLINK_CALL_STUB_SIZE;
- /* We need bigger stubs past index 32767. */
- if (s->_raw_size >= GLINK_CALL_STUB_SIZE + 32768*2*4)
- s->_raw_size += 4;
- s->_raw_size += 2*4;
-
- /* We also need to make an entry in the .rela.plt section. */
- s = htab->srelplt;
- s->_raw_size += sizeof (Elf64_External_Rela);
- }
- else
+ struct plt_entry *pent;
+ bfd_boolean doneone = FALSE;
+ for (pent = h->plt.plist; pent != NULL; pent = pent->next)
+ if (pent->plt.refcount > 0)
+ {
+ BFD_ASSERT (((struct ppc_link_hash_entry *) h)->is_func_descriptor);
+
+ /* If this is the first .plt entry, make room for the special
+ first entry. */
+ s = htab->plt;
+ if (s->_raw_size == 0)
+ s->_raw_size += PLT_INITIAL_ENTRY_SIZE;
+
+ pent->plt.offset = s->_raw_size;
+
+ /* Make room for this entry. */
+ s->_raw_size += PLT_ENTRY_SIZE;
+
+ /* Make room for the .glink code. */
+ s = htab->glink;
+ if (s->_raw_size == 0)
+ s->_raw_size += GLINK_CALL_STUB_SIZE;
+ /* We need bigger stubs past index 32767. */
+ if (s->_raw_size >= GLINK_CALL_STUB_SIZE + 32768*2*4)
+ s->_raw_size += 4;
+ s->_raw_size += 2*4;
+
+ /* We also need to make an entry in the .rela.plt section. */
+ s = htab->relplt;
+ s->_raw_size += sizeof (Elf64_External_Rela);
+ doneone = TRUE;
+ }
+ else
+ pent->plt.offset = (bfd_vma) -1;
+ if (!doneone)
{
- h->plt.offset = (bfd_vma) -1;
+ h->plt.plist = NULL;
h->elf_link_hash_flags &= ~ELF_LINK_HASH_NEEDS_PLT;
}
}
else
{
- h->plt.offset = (bfd_vma) -1;
+ h->plt.plist = NULL;
h->elf_link_hash_flags &= ~ELF_LINK_HASH_NEEDS_PLT;
}
- if (h->got.refcount > 0)
- {
- boolean dyn;
-
- /* Make sure this symbol is output as a dynamic symbol.
- Undefined weak syms won't yet be marked as dynamic. */
- if (h->dynindx == -1
- && (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0)
+ eh = (struct ppc_link_hash_entry *) h;
+ /* Run through the TLS GD got entries first if we're changing them
+ to TPREL. */
+ if ((eh->tls_mask & TLS_TPRELGD) != 0)
+ for (gent = h->got.glist; gent != NULL; gent = gent->next)
+ if (gent->got.refcount > 0
+ && (gent->tls_type & TLS_GD) != 0)
{
- if (! bfd_elf64_link_record_dynamic_symbol (info, h))
- return false;
+ /* This was a GD entry that has been converted to TPREL. If
+ there happens to be a TPREL entry we can use that one. */
+ struct got_entry *ent;
+ for (ent = h->got.glist; ent != NULL; ent = ent->next)
+ if (ent->got.refcount > 0
+ && (ent->tls_type & TLS_TPREL) != 0
+ && ent->addend == gent->addend
+ && ent->owner == gent->owner)
+ {
+ gent->got.refcount = 0;
+ break;
+ }
+
+ /* If not, then we'll be using our own TPREL entry. */
+ if (gent->got.refcount != 0)
+ gent->tls_type = TLS_TLS | TLS_TPREL;
}
- s = htab->sgot;
- h->got.offset = s->_raw_size;
- s->_raw_size += 8;
- dyn = htab->elf.dynamic_sections_created;
- if (WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, info, h))
- htab->srelgot->_raw_size += sizeof (Elf64_External_Rela);
- }
- else
- h->got.offset = (bfd_vma) -1;
+ for (gent = h->got.glist; gent != NULL; gent = gent->next)
+ if (gent->got.refcount > 0)
+ {
+ bfd_boolean dyn;
+
+ /* Make sure this symbol is output as a dynamic symbol.
+ Undefined weak syms won't yet be marked as dynamic,
+ nor will all TLS symbols. */
+ if (h->dynindx == -1
+ && (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0)
+ {
+ if (! bfd_elf_link_record_dynamic_symbol (info, h))
+ return FALSE;
+ }
+
+ if ((gent->tls_type & TLS_LD) != 0
+ && !(h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC))
+ {
+ gent->got.offset = ppc64_tlsld_got (gent->owner)->offset;
+ continue;
+ }
+
+ s = ppc64_elf_tdata (gent->owner)->got;
+ gent->got.offset = s->_raw_size;
+ s->_raw_size
+ += (gent->tls_type & eh->tls_mask & (TLS_GD | TLS_LD)) ? 16 : 8;
+ dyn = htab->elf.dynamic_sections_created;
+ if ((info->shared
+ || WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, 0, h))
+ && (ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
+ || h->root.type != bfd_link_hash_undefweak))
+ ppc64_elf_tdata (gent->owner)->relgot->_raw_size
+ += (gent->tls_type & eh->tls_mask & TLS_GD
+ ? 2 * sizeof (Elf64_External_Rela)
+ : sizeof (Elf64_External_Rela));
+ }
+ else
+ gent->got.offset = (bfd_vma) -1;
- eh = (struct ppc_link_hash_entry *) h;
if (eh->dyn_relocs == NULL)
- return true;
+ return TRUE;
/* In the shared -Bsymbolic case, discard space allocated for
dynamic pc-relative relocs against symbols which turn out to be
@@ -3963,9 +5722,13 @@ allocate_dynrelocs (h, inf)
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))
+ /* Relocs that use pc_count are those that appear on a call insn,
+ or certain REL relocs (see MUST_BE_DYN_RELOC) that can be
+ generated via assembly. We want calls to protected symbols to
+ resolve directly to the function rather than going via the plt.
+ If people want function pointer comparisons to work as expected
+ then they should avoid writing weird assembly. */
+ if (SYMBOL_CALLS_LOCAL (info, h))
{
struct ppc_dyn_relocs **pp;
@@ -3979,27 +5742,30 @@ allocate_dynrelocs (h, inf)
pp = &p->next;
}
}
+
+ /* Also discard relocs on undefined weak syms with non-default
+ visibility. */
+ if (ELF_ST_VISIBILITY (h->other) != STV_DEFAULT
+ && h->root.type == bfd_link_hash_undefweak)
+ eh->dyn_relocs = NULL;
}
- else
+ else if (ELIMINATE_COPY_RELOCS)
{
/* For the non-shared case, discard space for relocs against
symbols which turn out to need copy relocs or are not
dynamic. */
if ((h->elf_link_hash_flags & ELF_LINK_NON_GOT_REF) == 0
- && (((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) != 0
- && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0)
- || (htab->elf.dynamic_sections_created
- && (h->root.type == bfd_link_hash_undefweak
- || h->root.type == bfd_link_hash_undefined))))
+ && (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_elf64_link_record_dynamic_symbol (info, h))
- return false;
+ if (! bfd_elf_link_record_dynamic_symbol (info, h))
+ return FALSE;
}
/* If that succeeded, we know we'll be keeping all the
@@ -4020,15 +5786,13 @@ allocate_dynrelocs (h, inf)
sreloc->_raw_size += p->count * sizeof (Elf64_External_Rela);
}
- return true;
+ return TRUE;
}
/* Find any dynamic relocs that apply to read-only sections. */
-static boolean
-readonly_dynrelocs (h, inf)
- struct elf_link_hash_entry *h;
- PTR inf;
+static bfd_boolean
+readonly_dynrelocs (struct elf_link_hash_entry *h, void *inf)
{
struct ppc_link_hash_entry *eh;
struct ppc_dyn_relocs *p;
@@ -4043,28 +5807,27 @@ readonly_dynrelocs (h, inf)
if (s != NULL && (s->flags & SEC_READONLY) != 0)
{
- struct bfd_link_info *info = (struct bfd_link_info *) inf;
+ struct bfd_link_info *info = inf;
info->flags |= DF_TEXTREL;
/* Not an error, just cut short the traversal. */
- return false;
+ return FALSE;
}
}
- return true;
+ return TRUE;
}
/* Set the sizes of the dynamic sections. */
-static boolean
-ppc64_elf_size_dynamic_sections (output_bfd, info)
- bfd *output_bfd ATTRIBUTE_UNUSED;
- struct bfd_link_info *info;
+static bfd_boolean
+ppc64_elf_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
+ struct bfd_link_info *info)
{
struct ppc_link_hash_table *htab;
bfd *dynobj;
asection *s;
- boolean relocs;
+ bfd_boolean relocs;
bfd *ibfd;
htab = ppc_hash_table (info);
@@ -4075,7 +5838,7 @@ ppc64_elf_size_dynamic_sections (output_bfd, info)
if (htab->elf.dynamic_sections_created)
{
/* Set the contents of the .interp section to the interpreter. */
- if (! info->shared)
+ if (info->executable)
{
s = bfd_get_section_by_name (dynobj, ".interp");
if (s == NULL)
@@ -4089,8 +5852,9 @@ ppc64_elf_size_dynamic_sections (output_bfd, info)
relocs. */
for (ibfd = info->input_bfds; ibfd != NULL; ibfd = ibfd->link_next)
{
- bfd_signed_vma *local_got;
- bfd_signed_vma *end_local_got;
+ struct got_entry **lgot_ents;
+ struct got_entry **end_lgot_ents;
+ char *lgot_masks;
bfd_size_type locsymcount;
Elf_Internal_Shdr *symtab_hdr;
asection *srel;
@@ -4098,6 +5862,20 @@ ppc64_elf_size_dynamic_sections (output_bfd, info)
if (bfd_get_flavour (ibfd) != bfd_target_elf_flavour)
continue;
+ if (ppc64_tlsld_got (ibfd)->refcount > 0)
+ {
+ s = ppc64_elf_tdata (ibfd)->got;
+ ppc64_tlsld_got (ibfd)->offset = s->_raw_size;
+ s->_raw_size += 16;
+ if (info->shared)
+ {
+ srel = ppc64_elf_tdata (ibfd)->relgot;
+ srel->_raw_size += sizeof (Elf64_External_Rela);
+ }
+ }
+ else
+ ppc64_tlsld_got (ibfd)->offset = (bfd_vma) -1;
+
for (s = ibfd->sections; s != NULL; s = s->next)
{
struct ppc_dyn_relocs *p;
@@ -4125,50 +5903,78 @@ ppc64_elf_size_dynamic_sections (output_bfd, info)
}
}
- local_got = elf_local_got_refcounts (ibfd);
- if (!local_got)
+ lgot_ents = elf_local_got_ents (ibfd);
+ if (!lgot_ents)
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)
+ end_lgot_ents = lgot_ents + locsymcount;
+ lgot_masks = (char *) end_lgot_ents;
+ s = ppc64_elf_tdata (ibfd)->got;
+ srel = ppc64_elf_tdata (ibfd)->relgot;
+ for (; lgot_ents < end_lgot_ents; ++lgot_ents, ++lgot_masks)
{
- if (*local_got > 0)
- {
- *local_got = s->_raw_size;
- s->_raw_size += 8;
- if (info->shared)
- srel->_raw_size += sizeof (Elf64_External_Rela);
- }
- else
- *local_got = (bfd_vma) -1;
+ struct got_entry *ent;
+
+ for (ent = *lgot_ents; ent != NULL; ent = ent->next)
+ if (ent->got.refcount > 0)
+ {
+ if ((ent->tls_type & *lgot_masks & TLS_LD) != 0)
+ {
+ if (ppc64_tlsld_got (ibfd)->offset == (bfd_vma) -1)
+ {
+ ppc64_tlsld_got (ibfd)->offset = s->_raw_size;
+ s->_raw_size += 16;
+ if (info->shared)
+ srel->_raw_size += sizeof (Elf64_External_Rela);
+ }
+ ent->got.offset = ppc64_tlsld_got (ibfd)->offset;
+ }
+ else
+ {
+ ent->got.offset = s->_raw_size;
+ if ((ent->tls_type & *lgot_masks & TLS_GD) != 0)
+ {
+ s->_raw_size += 16;
+ if (info->shared)
+ srel->_raw_size += 2 * sizeof (Elf64_External_Rela);
+ }
+ else
+ {
+ s->_raw_size += 8;
+ if (info->shared)
+ srel->_raw_size += sizeof (Elf64_External_Rela);
+ }
+ }
+ }
+ else
+ ent->got.offset = (bfd_vma) -1;
}
}
- if (!edit_opd (output_bfd, info))
- return false;
-
/* Allocate global sym .plt and .got entries, and space for global
sym dynamic relocs. */
- elf_link_hash_traverse (&htab->elf, allocate_dynrelocs, (PTR) info);
+ elf_link_hash_traverse (&htab->elf, allocate_dynrelocs, info);
/* We now have determined the sizes of the various dynamic sections.
Allocate memory for them. */
- relocs = false;
+ relocs = FALSE;
for (s = dynobj->sections; s != NULL; s = s->next)
{
if ((s->flags & SEC_LINKER_CREATED) == 0)
continue;
- if (s == htab->sbrlt || s == htab->srelbrlt)
+ /* 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->splt
- || s == htab->sgot
- || s == htab->sglink)
+ else if (s == htab->got
+ || s == htab->plt
+ || s == htab->glink)
{
/* Strip this section if we don't need it; see the
comment below. */
@@ -4189,8 +5995,8 @@ ppc64_elf_size_dynamic_sections (output_bfd, info)
}
else
{
- if (s != htab->srelplt)
- relocs = true;
+ if (s != htab->relplt)
+ relocs = TRUE;
/* We use the reloc_count field as a counter if we need
to copy relocs into the output file. */
@@ -4210,17 +6016,51 @@ ppc64_elf_size_dynamic_sections (output_bfd, info)
}
/* .plt is in the bss section. We don't initialise it. */
- if ((s->flags & SEC_LOAD) == 0)
+ if (s == htab->plt)
continue;
/* Allocate memory for the section contents. We use bfd_zalloc
here in case unused entries are not reclaimed before the
section's contents are written out. This should not happen,
- but this way if it does, we get a R_PPC64_NONE reloc instead
- of garbage. */
- s->contents = (bfd_byte *) bfd_zalloc (dynobj, s->_raw_size);
+ but this way if it does we get a R_PPC64_NONE reloc in .rela
+ sections instead of garbage.
+ We also rely on the section contents being zero when writing
+ the GOT. */
+ s->contents = bfd_zalloc (dynobj, s->_raw_size);
if (s->contents == NULL)
- return false;
+ return FALSE;
+ }
+
+ for (ibfd = info->input_bfds; ibfd != NULL; ibfd = ibfd->link_next)
+ {
+ s = ppc64_elf_tdata (ibfd)->got;
+ if (s != NULL && s != htab->got)
+ {
+ s->_cooked_size = 0;
+ if (s->_raw_size == 0)
+ _bfd_strip_section_from_output (info, s);
+ else
+ {
+ s->contents = bfd_zalloc (ibfd, s->_raw_size);
+ if (s->contents == NULL)
+ return FALSE;
+ }
+ }
+ s = ppc64_elf_tdata (ibfd)->relgot;
+ if (s != NULL)
+ {
+ s->_cooked_size = 0;
+ if (s->_raw_size == 0)
+ _bfd_strip_section_from_output (info, s);
+ else
+ {
+ s->contents = bfd_zalloc (ibfd, s->_raw_size);
+ if (s->contents == NULL)
+ return FALSE;
+ relocs = TRUE;
+ s->reloc_count = 0;
+ }
+ }
}
if (htab->elf.dynamic_sections_created)
@@ -4231,29 +6071,29 @@ ppc64_elf_size_dynamic_sections (output_bfd, info)
the .dynamic section. The DT_DEBUG entry is filled in by the
dynamic linker and used by the debugger. */
#define add_dynamic_entry(TAG, VAL) \
- bfd_elf64_add_dynamic_entry (info, (bfd_vma) (TAG), (bfd_vma) (VAL))
+ _bfd_elf_add_dynamic_entry (info, TAG, VAL)
- if (!info->shared)
+ if (info->executable)
{
if (!add_dynamic_entry (DT_DEBUG, 0))
- return false;
+ return FALSE;
}
- if (htab->splt != NULL && htab->splt->_raw_size != 0)
+ if (htab->plt != NULL && htab->plt->_raw_size != 0)
{
if (!add_dynamic_entry (DT_PLTGOT, 0)
|| !add_dynamic_entry (DT_PLTRELSZ, 0)
|| !add_dynamic_entry (DT_PLTREL, DT_RELA)
|| !add_dynamic_entry (DT_JMPREL, 0)
|| !add_dynamic_entry (DT_PPC64_GLINK, 0))
- return false;
+ return FALSE;
}
if (NO_OPD_RELOCS)
{
if (!add_dynamic_entry (DT_PPC64_OPD, 0)
|| !add_dynamic_entry (DT_PPC64_OPDSZ, 0))
- return false;
+ return FALSE;
}
if (relocs)
@@ -4261,53 +6101,57 @@ ppc64_elf_size_dynamic_sections (output_bfd, info)
if (!add_dynamic_entry (DT_RELA, 0)
|| !add_dynamic_entry (DT_RELASZ, 0)
|| !add_dynamic_entry (DT_RELAENT, sizeof (Elf64_External_Rela)))
- return false;
+ 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);
+ elf_link_hash_traverse (&htab->elf, readonly_dynrelocs, info);
if ((info->flags & DF_TEXTREL) != 0)
{
if (!add_dynamic_entry (DT_TEXTREL, 0))
- return false;
+ return FALSE;
}
}
}
#undef add_dynamic_entry
- return true;
+ return TRUE;
}
/* Determine the type of stub needed, if any, for a call. */
-static INLINE enum ppc_stub_type
-ppc_type_of_stub (input_sec, rel, hash, destination)
- asection *input_sec;
- const Elf_Internal_Rela *rel;
- struct ppc_link_hash_entry **hash;
- bfd_vma destination;
+static inline enum ppc_stub_type
+ppc_type_of_stub (asection *input_sec,
+ const Elf_Internal_Rela *rel,
+ struct ppc_link_hash_entry **hash,
+ bfd_vma destination)
{
struct ppc_link_hash_entry *h = *hash;
bfd_vma location;
bfd_vma branch_offset;
bfd_vma max_branch_offset;
- unsigned int r_type;
+ enum elf_ppc64_reloc_type r_type;
if (h != NULL)
{
if (h->oh != NULL
- && h->oh->plt.offset != (bfd_vma) -1
&& h->oh->dynindx != -1)
{
- *hash = (struct ppc_link_hash_entry *) h->oh;
- return ppc_stub_plt_call;
+ struct plt_entry *ent;
+ for (ent = h->oh->plt.plist; ent != NULL; ent = ent->next)
+ if (ent->addend == rel->r_addend
+ && ent->plt.offset != (bfd_vma) -1)
+ {
+ *hash = (struct ppc_link_hash_entry *) h->oh;
+ return ppc_stub_plt_call;
+ }
}
- if (h->elf.root.type == bfd_link_hash_undefweak
- || h->elf.root.type == bfd_link_hash_undefined)
+ if (!(h->elf.root.type == bfd_link_hash_defined
+ || h->elf.root.type == bfd_link_hash_defweak)
+ || h->elf.root.u.def.section->output_section == NULL)
return ppc_stub_none;
}
@@ -4321,7 +6165,7 @@ ppc_type_of_stub (input_sec, rel, hash, destination)
/* Determine if a long branch stub is needed. */
max_branch_offset = 1 << 25;
- if (r_type != (unsigned int) R_PPC64_REL24)
+ if (r_type != R_PPC64_REL24)
max_branch_offset = 1 << 15;
if (branch_offset + max_branch_offset >= 2 * max_branch_offset)
@@ -4334,29 +6178,22 @@ ppc_type_of_stub (input_sec, rel, hash, destination)
/* Build a .plt call stub. */
-static bfd_byte *
-build_plt_stub (obfd, p, offset, glink)
- bfd *obfd;
- bfd_byte *p;
- int offset;
- int glink;
+static inline bfd_byte *
+build_plt_stub (bfd *obfd, bfd_byte *p, int offset)
{
#define PPC_LO(v) ((v) & 0xffff)
#define PPC_HI(v) (((v) >> 16) & 0xffff)
#define PPC_HA(v) PPC_HI ((v) + 0x8000)
- if (glink)
- bfd_put_32 (obfd, LD_R2_40R1, p), p += 4;
bfd_put_32 (obfd, ADDIS_R12_R2 | PPC_HA (offset), p), p += 4;
- if (!glink)
- bfd_put_32 (obfd, STD_R2_40R1, p), p += 4;
+ bfd_put_32 (obfd, STD_R2_40R1, p), p += 4;
bfd_put_32 (obfd, LD_R11_0R12 | PPC_LO (offset), p), p += 4;
if (PPC_HA (offset + 8) != PPC_HA (offset))
- bfd_put_32 (obfd, ADDIS_R12_R12_1, p), p += 4;
+ bfd_put_32 (obfd, ADDIS_R12_R12 | 1, p), p += 4;
offset += 8;
bfd_put_32 (obfd, LD_R2_0R12 | PPC_LO (offset), p), p += 4;
if (PPC_HA (offset + 8) != PPC_HA (offset))
- bfd_put_32 (obfd, ADDIS_R12_R12_1, p), p += 4;
+ bfd_put_32 (obfd, ADDIS_R12_R12 | 1, p), p += 4;
offset += 8;
bfd_put_32 (obfd, MTCTR_R11, p), p += 4;
bfd_put_32 (obfd, LD_R11_0R12 | PPC_LO (offset), p), p += 4;
@@ -4364,39 +6201,35 @@ build_plt_stub (obfd, p, offset, glink)
return p;
}
-static boolean
-ppc_build_one_stub (gen_entry, in_arg)
- struct bfd_hash_entry *gen_entry;
- PTR in_arg;
+static bfd_boolean
+ppc_build_one_stub (struct bfd_hash_entry *gen_entry, void *in_arg)
{
struct ppc_stub_hash_entry *stub_entry;
struct ppc_branch_hash_entry *br_entry;
struct bfd_link_info *info;
struct ppc_link_hash_table *htab;
- asection *stub_sec;
- bfd *stub_bfd;
bfd_byte *loc;
bfd_byte *p;
unsigned int indx;
+ struct plt_entry *ent;
bfd_vma off;
int size;
/* Massage our args to the form they really have. */
stub_entry = (struct ppc_stub_hash_entry *) gen_entry;
- info = (struct bfd_link_info *) in_arg;
+ info = in_arg;
htab = ppc_hash_table (info);
- stub_sec = stub_entry->stub_sec;
/* Make a note of the offset within the stubs for this entry. */
- stub_entry->stub_offset = stub_sec->_cooked_size;
- loc = stub_sec->contents + stub_entry->stub_offset;
-
- stub_bfd = stub_sec->owner;
+ stub_entry->stub_offset = stub_entry->stub_sec->_cooked_size;
+ loc = stub_entry->stub_sec->contents + stub_entry->stub_offset;
+ htab->stub_count[stub_entry->stub_type - 1] += 1;
switch (stub_entry->stub_type)
{
case ppc_stub_long_branch:
+ case ppc_stub_long_branch_r2off:
/* Branches are relative. This is where we are going to. */
off = (stub_entry->target_value
+ stub_entry->target_section->output_offset
@@ -4404,73 +6237,113 @@ ppc_build_one_stub (gen_entry, in_arg)
/* And this is where we are coming from. */
off -= (stub_entry->stub_offset
- + stub_sec->output_offset
- + stub_sec->output_section->vma);
+ + stub_entry->stub_sec->output_offset
+ + stub_entry->stub_sec->output_section->vma);
- BFD_ASSERT (off + (1 << 25) < (bfd_vma) (1 << 26));
+ if (stub_entry->stub_type != ppc_stub_long_branch_r2off)
+ size = 4;
+ else
+ {
+ bfd_vma r2off;
+
+ r2off = (htab->stub_group[stub_entry->target_section->id].toc_off
+ - htab->stub_group[stub_entry->id_sec->id].toc_off);
+ bfd_put_32 (htab->stub_bfd, STD_R2_40R1, loc);
+ loc += 4;
+ bfd_put_32 (htab->stub_bfd, ADDIS_R2_R2 | PPC_HA (r2off), loc);
+ loc += 4;
+ bfd_put_32 (htab->stub_bfd, ADDI_R2_R2 | PPC_LO (r2off), loc);
+ loc += 4;
+ off -= 12;
+ size = 16;
+ }
+ bfd_put_32 (htab->stub_bfd, B_DOT | (off & 0x3fffffc), loc);
- bfd_put_32 (stub_bfd, (bfd_vma) B_DOT | (off & 0x3fffffc), loc);
- size = 4;
+ BFD_ASSERT (off + (1 << 25) < (bfd_vma) (1 << 26));
break;
case ppc_stub_plt_branch:
+ case ppc_stub_plt_branch_r2off:
br_entry = ppc_branch_hash_lookup (&htab->branch_hash_table,
stub_entry->root.string + 9,
- false, false);
+ FALSE, FALSE);
if (br_entry == NULL)
{
(*_bfd_error_handler) (_("can't find branch stub `%s'"),
stub_entry->root.string + 9);
- htab->stub_error = true;
- return false;
+ htab->stub_error = TRUE;
+ return FALSE;
}
off = (stub_entry->target_value
+ stub_entry->target_section->output_offset
+ stub_entry->target_section->output_section->vma);
- bfd_put_64 (htab->sbrlt->owner, off,
- htab->sbrlt->contents + br_entry->offset);
+ bfd_put_64 (htab->brlt->owner, off,
+ htab->brlt->contents + br_entry->offset);
if (info->shared)
{
/* Create a reloc for the branch lookup table entry. */
Elf_Internal_Rela rela;
- Elf64_External_Rela *r;
+ bfd_byte *rl;
rela.r_offset = (br_entry->offset
- + htab->sbrlt->output_offset
- + htab->sbrlt->output_section->vma);
+ + htab->brlt->output_offset
+ + htab->brlt->output_section->vma);
rela.r_info = ELF64_R_INFO (0, R_PPC64_RELATIVE);
rela.r_addend = off;
- r = (Elf64_External_Rela *) htab->srelbrlt->contents;
- r += htab->srelbrlt->reloc_count++;
- bfd_elf64_swap_reloca_out (htab->srelbrlt->owner, &rela, r);
+ rl = htab->relbrlt->contents;
+ rl += htab->relbrlt->reloc_count++ * sizeof (Elf64_External_Rela);
+ bfd_elf64_swap_reloca_out (htab->relbrlt->owner, &rela, rl);
}
off = (br_entry->offset
- + htab->sbrlt->output_offset
- + htab->sbrlt->output_section->vma
- - elf_gp (htab->sbrlt->output_section->owner)
- - TOC_BASE_OFF);
+ + htab->brlt->output_offset
+ + htab->brlt->output_section->vma
+ - elf_gp (htab->brlt->output_section->owner)
+ - htab->stub_group[stub_entry->id_sec->id].toc_off);
- if (off + 0x80000000 > 0xffffffff || (off & 7) != 0)
+ if (off + 0x80008000 > 0xffffffff || (off & 7) != 0)
{
(*_bfd_error_handler)
(_("linkage table error against `%s'"),
stub_entry->root.string);
bfd_set_error (bfd_error_bad_value);
- htab->stub_error = true;
- return false;
+ htab->stub_error = TRUE;
+ return FALSE;
}
indx = off;
- bfd_put_32 (stub_bfd, (bfd_vma) ADDIS_R12_R2 | PPC_HA (indx), loc);
- bfd_put_32 (stub_bfd, (bfd_vma) LD_R11_0R12 | PPC_LO (indx), loc + 4);
- bfd_put_32 (stub_bfd, (bfd_vma) MTCTR_R11, loc + 8);
- bfd_put_32 (stub_bfd, (bfd_vma) BCTR, loc + 12);
- size = 16;
+ if (stub_entry->stub_type != ppc_stub_plt_branch_r2off)
+ {
+ bfd_put_32 (htab->stub_bfd, ADDIS_R12_R2 | PPC_HA (indx), loc);
+ loc += 4;
+ bfd_put_32 (htab->stub_bfd, LD_R11_0R12 | PPC_LO (indx), loc);
+ size = 16;
+ }
+ else
+ {
+ bfd_vma r2off;
+
+ r2off = (htab->stub_group[stub_entry->target_section->id].toc_off
+ - htab->stub_group[stub_entry->id_sec->id].toc_off);
+ bfd_put_32 (htab->stub_bfd, STD_R2_40R1, loc);
+ loc += 4;
+ bfd_put_32 (htab->stub_bfd, ADDIS_R12_R2 | PPC_HA (indx), loc);
+ loc += 4;
+ bfd_put_32 (htab->stub_bfd, LD_R11_0R12 | PPC_LO (indx), loc);
+ loc += 4;
+ bfd_put_32 (htab->stub_bfd, ADDIS_R2_R2 | PPC_HA (r2off), loc);
+ loc += 4;
+ bfd_put_32 (htab->stub_bfd, ADDI_R2_R2 | PPC_LO (r2off), loc);
+ size = 28;
+ }
+ loc += 4;
+ bfd_put_32 (htab->stub_bfd, MTCTR_R11, loc);
+ loc += 4;
+ bfd_put_32 (htab->stub_bfd, BCTR, loc);
break;
case ppc_stub_plt_call:
@@ -4482,82 +6355,122 @@ ppc_build_one_stub (gen_entry, in_arg)
{
/* 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. */
+ defined somewhere. Maybe defining the symbol in the stub
+ section is a silly idea. If we didn't do this, htab->top_id
+ could disappear. */
stub_entry->h->oh->root.type = bfd_link_hash_defined;
stub_entry->h->oh->root.u.def.section = stub_entry->stub_sec;
stub_entry->h->oh->root.u.def.value = stub_entry->stub_offset;
}
/* Now build the stub. */
- off = stub_entry->h->elf.plt.offset;
+ off = (bfd_vma) -1;
+ for (ent = stub_entry->h->elf.plt.plist; ent != NULL; ent = ent->next)
+ if (ent->addend == stub_entry->addend)
+ {
+ off = ent->plt.offset;
+ break;
+ }
if (off >= (bfd_vma) -2)
abort ();
off &= ~ (bfd_vma) 1;
- off += (htab->splt->output_offset
- + htab->splt->output_section->vma
- - elf_gp (htab->splt->output_section->owner)
- - TOC_BASE_OFF);
+ off += (htab->plt->output_offset
+ + htab->plt->output_section->vma
+ - elf_gp (htab->plt->output_section->owner)
+ - htab->stub_group[stub_entry->id_sec->id].toc_off);
- if (off + 0x80000000 > 0xffffffff || (off & 7) != 0)
+ if (off + 0x80008000 > 0xffffffff || (off & 7) != 0)
{
(*_bfd_error_handler)
(_("linkage table error against `%s'"),
stub_entry->h->elf.root.root.string);
bfd_set_error (bfd_error_bad_value);
- htab->stub_error = true;
- return false;
+ htab->stub_error = TRUE;
+ return FALSE;
}
- p = build_plt_stub (stub_bfd, loc, (int) off, 0);
+ p = build_plt_stub (htab->stub_bfd, loc, off);
size = p - loc;
break;
default:
BFD_FAIL ();
- return false;
+ return FALSE;
+ }
+
+ stub_entry->stub_sec->_cooked_size += size;
+
+ if (htab->emit_stub_syms
+ && !(stub_entry->stub_type == ppc_stub_plt_call
+ && stub_entry->h->oh->root.type == bfd_link_hash_defined
+ && stub_entry->h->oh->root.u.def.section == stub_entry->stub_sec
+ && stub_entry->h->oh->root.u.def.value == stub_entry->stub_offset))
+ {
+ struct elf_link_hash_entry *h;
+ h = elf_link_hash_lookup (&htab->elf, stub_entry->root.string,
+ TRUE, FALSE, FALSE);
+ if (h == NULL)
+ return FALSE;
+ if (h->root.type == bfd_link_hash_new)
+ {
+ h->root.type = bfd_link_hash_defined;
+ h->root.u.def.section = stub_entry->stub_sec;
+ h->root.u.def.value = stub_entry->stub_offset;
+ h->elf_link_hash_flags = (ELF_LINK_HASH_REF_REGULAR
+ | ELF_LINK_HASH_DEF_REGULAR
+ | ELF_LINK_HASH_REF_REGULAR_NONWEAK
+ | ELF_LINK_FORCED_LOCAL);
+ }
}
- stub_sec->_cooked_size += size;
- return true;
+ return TRUE;
}
/* As above, but don't actually build the stub. Just bump offset so
we know stub section sizes, and select plt_branch stubs where
long_branch stubs won't do. */
-static boolean
-ppc_size_one_stub (gen_entry, in_arg)
- struct bfd_hash_entry *gen_entry;
- PTR in_arg;
+static bfd_boolean
+ppc_size_one_stub (struct bfd_hash_entry *gen_entry, void *in_arg)
{
struct ppc_stub_hash_entry *stub_entry;
+ struct bfd_link_info *info;
struct ppc_link_hash_table *htab;
bfd_vma off;
int size;
/* Massage our args to the form they really have. */
stub_entry = (struct ppc_stub_hash_entry *) gen_entry;
- htab = (struct ppc_link_hash_table *) in_arg;
+ info = in_arg;
+
+ htab = ppc_hash_table (info);
if (stub_entry->stub_type == ppc_stub_plt_call)
{
- off = stub_entry->h->elf.plt.offset & ~(bfd_vma) 1;
- off += (htab->splt->output_offset
- + htab->splt->output_section->vma
- - elf_gp (htab->splt->output_section->owner)
- - TOC_BASE_OFF);
-
- size = 28;
- if (PPC_HA ((int) off + 16) != PPC_HA ((int) off))
+ struct plt_entry *ent;
+ off = (bfd_vma) -1;
+ for (ent = stub_entry->h->elf.plt.plist; ent != NULL; ent = ent->next)
+ if (ent->addend == stub_entry->addend)
+ {
+ off = ent->plt.offset & ~(bfd_vma) 1;
+ break;
+ }
+ if (off >= (bfd_vma) -2)
+ abort ();
+ off += (htab->plt->output_offset
+ + htab->plt->output_section->vma
+ - elf_gp (htab->plt->output_section->owner)
+ - htab->stub_group[stub_entry->id_sec->id].toc_off);
+
+ size = PLT_CALL_STUB_SIZE;
+ if (PPC_HA (off + 16) != PPC_HA (off))
size += 4;
}
else
{
- /* ppc_stub_long_branch or ppc_stub_plt_branch. */
- stub_entry->stub_type = ppc_stub_long_branch;
- size = 4;
-
+ /* ppc_stub_long_branch or ppc_stub_plt_branch, or their r2off
+ variants. */
off = (stub_entry->target_value
+ stub_entry->target_section->output_offset
+ stub_entry->target_section->output_section->vma);
@@ -4565,34 +6478,53 @@ ppc_size_one_stub (gen_entry, in_arg)
+ stub_entry->stub_sec->output_offset
+ stub_entry->stub_sec->output_section->vma);
+ /* Reset the stub type from the plt variant in case we now
+ can reach with a shorter stub. */
+ if (stub_entry->stub_type >= ppc_stub_plt_branch)
+ stub_entry->stub_type += ppc_stub_long_branch - ppc_stub_plt_branch;
+
+ size = 4;
+ if (stub_entry->stub_type == ppc_stub_long_branch_r2off)
+ {
+ off -= 12;
+ size = 16;
+ }
+
+ /* If the branch offset if too big, use a ppc_stub_plt_branch. */
if (off + (1 << 25) >= (bfd_vma) (1 << 26))
{
struct ppc_branch_hash_entry *br_entry;
br_entry = ppc_branch_hash_lookup (&htab->branch_hash_table,
stub_entry->root.string + 9,
- true, false);
+ TRUE, FALSE);
if (br_entry == NULL)
{
(*_bfd_error_handler) (_("can't build branch stub `%s'"),
stub_entry->root.string + 9);
- htab->stub_error = true;
- return false;
+ htab->stub_error = TRUE;
+ return FALSE;
}
if (br_entry->iter != htab->stub_iteration)
{
br_entry->iter = htab->stub_iteration;
- br_entry->offset = htab->sbrlt->_raw_size;
- htab->sbrlt->_raw_size += 8;
+ br_entry->offset = htab->brlt->_raw_size;
+ htab->brlt->_raw_size += 8;
+
+ if (info->shared)
+ htab->relbrlt->_raw_size += sizeof (Elf64_External_Rela);
}
- stub_entry->stub_type = ppc_stub_plt_branch;
+
+ stub_entry->stub_type += ppc_stub_plt_branch - ppc_stub_long_branch;
size = 16;
+ if (stub_entry->stub_type != ppc_stub_plt_branch)
+ size = 28;
}
}
stub_entry->stub_sec->_raw_size += size;
- return true;
+ return TRUE;
}
/* Set up various things so that we can make a list of input sections
@@ -4600,23 +6532,20 @@ ppc_size_one_stub (gen_entry, in_arg)
0 when no stubs will be needed, and 1 on success. */
int
-ppc64_elf_setup_section_lists (output_bfd, info)
- bfd *output_bfd;
- struct bfd_link_info *info;
+ppc64_elf_setup_section_lists (bfd *output_bfd, struct bfd_link_info *info)
{
bfd *input_bfd;
- int top_id, top_index;
+ int top_id, top_index, id;
asection *section;
- asection **input_list, **list;
+ asection **input_list;
bfd_size_type amt;
struct ppc_link_hash_table *htab = ppc_hash_table (info);
- if (htab->elf.root.creator->flavour != bfd_target_elf_flavour
- || htab->sbrlt == NULL)
+ if (htab->brlt == NULL)
return 0;
/* Find the top input section id. */
- for (input_bfd = info->input_bfds, top_id = 0;
+ for (input_bfd = info->input_bfds, top_id = 3;
input_bfd != NULL;
input_bfd = input_bfd->link_next)
{
@@ -4629,11 +6558,18 @@ ppc64_elf_setup_section_lists (output_bfd, info)
}
}
+ htab->top_id = top_id;
amt = sizeof (struct map_stub) * (top_id + 1);
- htab->stub_group = (struct map_stub *) bfd_zmalloc (amt);
+ htab->stub_group = bfd_zmalloc (amt);
if (htab->stub_group == NULL)
return -1;
+ /* Set toc_off for com, und, abs and ind sections. */
+ for (id = 0; id < 3; id++)
+ htab->stub_group[id].toc_off = TOC_BASE_OFF;
+
+ elf_gp (output_bfd) = htab->toc_curr = ppc64_elf_toc (output_bfd);
+
/* We can't use output_bfd->section_count here to find the top output
section index as some sections may have been removed, and
_bfd_strip_section_from_output doesn't renumber the indices. */
@@ -4647,27 +6583,114 @@ ppc64_elf_setup_section_lists (output_bfd, info)
htab->top_index = top_index;
amt = sizeof (asection *) * (top_index + 1);
- input_list = (asection **) bfd_malloc (amt);
+ input_list = bfd_zmalloc (amt);
htab->input_list = input_list;
if (input_list == NULL)
return -1;
- /* For sections we aren't interested in, mark their entries with a
- value we can check later. */
- list = input_list + top_index;
- do
- *list = bfd_abs_section_ptr;
- while (list-- != input_list);
+ return 1;
+}
- for (section = output_bfd->sections;
- section != NULL;
- section = section->next)
+/* The linker repeatedly calls this function for each TOC input section
+ and linker generated GOT section. Group input bfds such that the toc
+ within a group is less than 64k in size. Will break with cute linker
+ scripts that play games with dot in the output toc section. */
+
+void
+ppc64_elf_next_toc_section (struct bfd_link_info *info, asection *isec)
+{
+ struct ppc_link_hash_table *htab = ppc_hash_table (info);
+
+ if (!htab->no_multi_toc)
{
- if ((section->flags & SEC_CODE) != 0)
- input_list[section->index] = NULL;
+ bfd_vma addr = isec->output_offset + isec->output_section->vma;
+ bfd_vma off = addr - htab->toc_curr;
+ if (off + isec->_raw_size > 0x10000)
+ {
+ htab->toc_curr = addr;
+ htab->multi_toc_needed = 1;
+ }
+ elf_gp (isec->owner) = (htab->toc_curr
+ - elf_gp (isec->output_section->owner)
+ + TOC_BASE_OFF);
}
+}
- return 1;
+/* Called after the last call to the above function. */
+
+void
+ppc64_elf_reinit_toc (bfd *output_bfd ATTRIBUTE_UNUSED,
+ struct bfd_link_info *info)
+{
+ struct ppc_link_hash_table *htab = ppc_hash_table (info);
+
+ /* toc_curr tracks the TOC offset used for code sections below in
+ ppc64_elf_next_input_section. Start off at 0x8000. */
+ htab->toc_curr = TOC_BASE_OFF;
+}
+
+/* No toc references were found in ISEC. If the code in ISEC makes no
+ calls, then there's no need to use toc adjusting stubs when branching
+ into ISEC. Actually, indirect calls from ISEC are OK as they will
+ load r2. */
+
+static int
+toc_adjusting_stub_needed (struct bfd_link_info *info, asection *isec)
+{
+ bfd_byte *contents;
+ bfd_size_type i;
+ int ret;
+ int branch_ok;
+
+ /* We know none of our code bearing sections will need toc stubs. */
+ if ((isec->flags & SEC_LINKER_CREATED) != 0)
+ return 0;
+
+ if (isec->_raw_size == 0)
+ return 0;
+
+ /* Hack for linux kernel. .fixup contains branches, but only back to
+ the function that hit an exception. */
+ branch_ok = strcmp (isec->name, ".fixup") == 0;
+
+ contents = elf_section_data (isec)->this_hdr.contents;
+ if (contents == NULL)
+ {
+ contents = bfd_malloc (isec->_raw_size);
+ if (contents == NULL)
+ return -1;
+ if (! bfd_get_section_contents (isec->owner, isec, contents,
+ 0, isec->_raw_size))
+ {
+ free (contents);
+ return -1;
+ }
+ if (info->keep_memory)
+ elf_section_data (isec)->this_hdr.contents = contents;
+ }
+
+ /* Code scan, because we don't necessarily have relocs on calls to
+ static functions. */
+ ret = 0;
+ for (i = 0; i < isec->_raw_size; i += 4)
+ {
+ unsigned long insn = bfd_get_32 (isec->owner, contents + i);
+ /* Is this a branch? */
+ if ((insn & (0x3f << 26)) == (18 << 26)
+ /* If branch and link, it's a function call. */
+ && ((insn & 1) != 0
+ /* Sibling calls use a plain branch. I don't know a way
+ of deciding whether a branch is really a sibling call. */
+ || !branch_ok))
+ {
+ ret = 1;
+ break;
+ }
+ }
+
+ if (elf_section_data (isec)->this_hdr.contents != contents)
+ free (contents);
+ return ret;
}
/* The linker repeatedly calls this function for each input section,
@@ -4675,26 +6698,43 @@ ppc64_elf_setup_section_lists (output_bfd, info)
Build lists of input sections to determine groupings between which
we may insert linker stubs. */
-void
-ppc64_elf_next_input_section (info, isec)
- struct bfd_link_info *info;
- asection *isec;
+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->index <= htab->top_index)
+ if ((isec->output_section->flags & SEC_CODE) != 0
+ && isec->output_section->index <= htab->top_index)
{
asection **list = htab->input_list + isec->output_section->index;
- if (*list != bfd_abs_section_ptr)
- {
- /* Steal the link_sec pointer for our list. */
+ /* Steal the link_sec pointer for our list. */
#define PREV_SEC(sec) (htab->stub_group[(sec)->id].link_sec)
- /* This happens to make the list in reverse order,
- which is what we want. */
- PREV_SEC (isec) = *list;
- *list = isec;
- }
+ /* This happens to make the list in reverse order,
+ which is what we want. */
+ PREV_SEC (isec) = *list;
+ *list = isec;
}
+
+ /* If a code section has a function that uses the TOC then we need
+ to use the right TOC (obviously). Also, make sure that .opd gets
+ the correct TOC value for R_PPC64_TOC relocs that don't have or
+ can't find their function symbol (shouldn't ever happen now). */
+ if (isec->has_gp_reloc || (isec->flags & SEC_CODE) == 0)
+ {
+ if (elf_gp (isec->owner) != 0)
+ htab->toc_curr = elf_gp (isec->owner);
+ }
+ else if ((ret = toc_adjusting_stub_needed (info, isec)) < 0)
+ return FALSE;
+ else
+ isec->has_gp_reloc = ret;
+
+ /* Functions that don't use the TOC can belong in any TOC group.
+ Use the last TOC base. This happens to make _init and _fini
+ pasting work. */
+ htab->stub_group[isec->id].toc_off = htab->toc_curr;
+ return TRUE;
}
/* See whether we can group stub sections together. Grouping stub
@@ -4705,31 +6745,34 @@ ppc64_elf_next_input_section (info, isec)
the middle of a function is not a good idea. */
static void
-group_sections (htab, stub_group_size, stubs_always_before_branch)
- struct ppc_link_hash_table *htab;
- bfd_size_type stub_group_size;
- boolean stubs_always_before_branch;
+group_sections (struct ppc_link_hash_table *htab,
+ bfd_size_type stub_group_size,
+ bfd_boolean stubs_always_before_branch)
{
asection **list = htab->input_list + htab->top_index;
do
{
asection *tail = *list;
- if (tail == bfd_abs_section_ptr)
- continue;
while (tail != NULL)
{
asection *curr;
asection *prev;
bfd_size_type total;
+ bfd_boolean big_sec;
+ bfd_vma curr_toc;
curr = tail;
if (tail->_cooked_size)
total = tail->_cooked_size;
else
total = tail->_raw_size;
+ big_sec = total >= stub_group_size;
+ curr_toc = htab->stub_group[tail->id].toc_off;
+
while ((prev = PREV_SEC (curr)) != NULL
&& ((total += curr->output_offset - prev->output_offset)
- < stub_group_size))
+ < stub_group_size)
+ && htab->stub_group[prev->id].toc_off == curr_toc)
curr = prev;
/* OK, the size from the start of CURR to the end is less
@@ -4741,7 +6784,7 @@ group_sections (htab, stub_group_size, stubs_always_before_branch)
section size. That's a little tricky, and this way will
only break if stubs added make the total size more than
2^25, ie. for the default stub_group_size, if stubs total
- more than 2834432 bytes, or over 100000 plt call stubs. */
+ more than 2097152 bytes, or nearly 75000 plt call stubs. */
do
{
prev = PREV_SEC (tail);
@@ -4751,13 +6794,17 @@ group_sections (htab, stub_group_size, stubs_always_before_branch)
while (tail != curr && (tail = prev) != NULL);
/* But wait, there's more! Input sections up to stub_group_size
- bytes before the stub section can be handled by it too. */
- if (!stubs_always_before_branch)
+ bytes before the stub section can be handled by it too.
+ Don't do this if we have a really large section after the
+ stubs, as adding more stubs increases the chance that
+ branches may not reach into the stub section. */
+ if (!stubs_always_before_branch && !big_sec)
{
total = 0;
while (prev != NULL
&& ((total += tail->output_offset - prev->output_offset)
- < stub_group_size))
+ < stub_group_size)
+ && htab->stub_group[prev->id].toc_off == curr_toc)
{
tail = prev;
prev = PREV_SEC (tail);
@@ -4778,22 +6825,18 @@ group_sections (htab, stub_group_size, stubs_always_before_branch)
PC-relative calls to a target that is unreachable with a "bl"
instruction. */
-boolean
-ppc64_elf_size_stubs (output_bfd, stub_bfd, info, group_size,
- add_stub_section, layout_sections_again)
- bfd *output_bfd;
- bfd *stub_bfd;
- struct bfd_link_info *info;
- bfd_signed_vma group_size;
- asection * (*add_stub_section) PARAMS ((const char *, asection *));
- void (*layout_sections_again) PARAMS ((void));
+bfd_boolean
+ppc64_elf_size_stubs (bfd *output_bfd,
+ struct bfd_link_info *info,
+ bfd_signed_vma group_size,
+ asection *(*add_stub_section) (const char *, asection *),
+ void (*layout_sections_again) (void))
{
bfd_size_type stub_group_size;
- boolean stubs_always_before_branch;
+ bfd_boolean stubs_always_before_branch;
struct ppc_link_hash_table *htab = ppc_hash_table (info);
/* Stash our params away. */
- htab->stub_bfd = stub_bfd;
htab->add_stub_section = add_stub_section;
htab->layout_sections_again = layout_sections_again;
stubs_always_before_branch = group_size < 0;
@@ -4804,9 +6847,18 @@ ppc64_elf_size_stubs (output_bfd, stub_bfd, info, group_size,
if (stub_group_size == 1)
{
/* Default values. */
- stub_group_size = 30720000;
- if (htab->has_14bit_branch)
- stub_group_size = 30000;
+ 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);
@@ -4816,10 +6868,10 @@ ppc64_elf_size_stubs (output_bfd, stub_bfd, info, group_size,
bfd *input_bfd;
unsigned int bfd_indx;
asection *stub_sec;
- boolean stub_changed;
+ bfd_boolean stub_changed;
htab->stub_iteration += 1;
- stub_changed = false;
+ stub_changed = FALSE;
for (input_bfd = info->input_bfds, bfd_indx = 0;
input_bfd != NULL;
@@ -4855,9 +6907,8 @@ ppc64_elf_size_stubs (output_bfd, stub_bfd, info, group_size,
/* Get the relocs. */
internal_relocs
- = _bfd_elf64_link_read_relocs (input_bfd, section, NULL,
- (Elf_Internal_Rela *) NULL,
- info->keep_memory);
+ = _bfd_elf_link_read_relocs (input_bfd, section, NULL, NULL,
+ info->keep_memory);
if (internal_relocs == NULL)
goto error_ret_free_local;
@@ -4866,61 +6917,47 @@ ppc64_elf_size_stubs (output_bfd, stub_bfd, info, group_size,
irelaend = irela + section->reloc_count;
for (; irela < irelaend; irela++)
{
- unsigned int r_type, r_indx;
+ enum elf_ppc64_reloc_type r_type;
+ unsigned int r_indx;
enum ppc_stub_type stub_type;
struct ppc_stub_hash_entry *stub_entry;
asection *sym_sec;
bfd_vma sym_value;
bfd_vma destination;
struct ppc_link_hash_entry *hash;
+ struct elf_link_hash_entry *h;
+ Elf_Internal_Sym *sym;
char *stub_name;
const asection *id_sec;
r_type = ELF64_R_TYPE (irela->r_info);
r_indx = ELF64_R_SYM (irela->r_info);
- if (r_type >= (unsigned int) R_PPC_max)
+ if (r_type >= R_PPC64_max)
{
bfd_set_error (bfd_error_bad_value);
goto error_ret_free_internal;
}
/* Only look for stubs on branch instructions. */
- if (r_type != (unsigned int) R_PPC64_REL24
- && r_type != (unsigned int) R_PPC64_REL14
- && r_type != (unsigned int) R_PPC64_REL14_BRTAKEN
- && r_type != (unsigned int) R_PPC64_REL14_BRNTAKEN)
+ if (r_type != R_PPC64_REL24
+ && r_type != R_PPC64_REL14
+ && r_type != R_PPC64_REL14_BRTAKEN
+ && r_type != R_PPC64_REL14_BRNTAKEN)
continue;
/* Now determine the call target, its name, value,
section. */
- sym_sec = NULL;
- sym_value = 0;
destination = 0;
- hash = NULL;
- if (r_indx < symtab_hdr->sh_info)
+ if (!get_sym_h (&h, &sym, &sym_sec, NULL, &local_syms,
+ r_indx, input_bfd))
+ goto error_ret_free_internal;
+ hash = (struct ppc_link_hash_entry *) h;
+
+ if (hash == NULL)
{
/* It's a local symbol. */
- Elf_Internal_Sym *sym;
- Elf_Internal_Shdr *hdr;
-
- if (local_syms == NULL)
- {
- local_syms
- = (Elf_Internal_Sym *) symtab_hdr->contents;
- if (local_syms == NULL)
- local_syms
- = bfd_elf_get_elf_syms (input_bfd, symtab_hdr,
- symtab_hdr->sh_info, 0,
- NULL, NULL, NULL);
- if (local_syms == NULL)
- goto error_ret_free_internal;
- }
- sym = local_syms + r_indx;
- hdr = elf_elfsections (input_bfd)[sym->st_shndx];
- sym_sec = hdr->bfd_section;
- if (ELF_ST_TYPE (sym->st_info) != STT_SECTION)
- sym_value = sym->st_value;
+ sym_value = sym->st_value;
destination = (sym_value + irela->r_addend
+ sym_sec->output_offset
+ sym_sec->output_section->vma);
@@ -4928,21 +6965,10 @@ ppc64_elf_size_stubs (output_bfd, stub_bfd, info, group_size,
else
{
/* It's an external symbol. */
- int e_indx;
-
- e_indx = r_indx - symtab_hdr->sh_info;
- hash = ((struct ppc_link_hash_entry *)
- elf_sym_hashes (input_bfd)[e_indx]);
-
- while (hash->elf.root.type == bfd_link_hash_indirect
- || hash->elf.root.type == bfd_link_hash_warning)
- hash = ((struct ppc_link_hash_entry *)
- hash->elf.root.u.i.link);
-
+ sym_value = 0;
if (hash->elf.root.type == bfd_link_hash_defined
|| hash->elf.root.type == bfd_link_hash_defweak)
{
- sym_sec = hash->elf.root.u.def.section;
sym_value = hash->elf.root.u.def.value;
if (sym_sec->output_section != NULL)
destination = (sym_value + irela->r_addend
@@ -4963,9 +6989,44 @@ ppc64_elf_size_stubs (output_bfd, stub_bfd, info, group_size,
/* Determine what (if any) linker stub is needed. */
stub_type = ppc_type_of_stub (section, irela, &hash,
destination);
+
+ if (stub_type != ppc_stub_plt_call)
+ {
+ /* Check whether we need a TOC adjusting stub.
+ Since the linker pastes together pieces from
+ different object files when creating the
+ _init and _fini functions, it may be that a
+ call to what looks like a local sym is in
+ fact a call needing a TOC adjustment. */
+ if (sym_sec != NULL
+ && sym_sec->output_section != NULL
+ && (htab->stub_group[sym_sec->id].toc_off
+ != htab->stub_group[section->id].toc_off)
+ && sym_sec->has_gp_reloc
+ && section->has_gp_reloc)
+ stub_type = ppc_stub_long_branch_r2off;
+ }
+
if (stub_type == ppc_stub_none)
continue;
+ /* __tls_get_addr calls might be eliminated. */
+ if (stub_type != ppc_stub_plt_call
+ && hash != NULL
+ && &hash->elf == htab->tls_get_addr
+ && section->has_tls_reloc
+ && irela != internal_relocs)
+ {
+ /* Get tls info. */
+ char *tls_mask;
+
+ if (!get_tls_mask (&tls_mask, NULL, &local_syms,
+ irela - 1, input_bfd))
+ goto error_ret_free_internal;
+ if (*tls_mask != 0)
+ continue;
+ }
+
/* Support for grouping stub sections. */
id_sec = htab->stub_group[section->id].link_sec;
@@ -4975,7 +7036,7 @@ ppc64_elf_size_stubs (output_bfd, stub_bfd, info, group_size,
goto error_ret_free_internal;
stub_entry = ppc_stub_hash_lookup (&htab->stub_hash_table,
- stub_name, false, false);
+ stub_name, FALSE, FALSE);
if (stub_entry != NULL)
{
/* The proper stub has already been created. */
@@ -4995,14 +7056,15 @@ ppc64_elf_size_stubs (output_bfd, stub_bfd, info, group_size,
&& (symtab_hdr->contents
!= (unsigned char *) local_syms))
free (local_syms);
- return false;
+ return FALSE;
}
+ stub_entry->stub_type = stub_type;
stub_entry->target_value = sym_value;
stub_entry->target_section = sym_sec;
- stub_entry->stub_type = stub_type;
stub_entry->h = hash;
- stub_changed = true;
+ stub_entry->addend = irela->r_addend;
+ stub_changed = TRUE;
}
/* We're done with the internal relocs, free them. */
@@ -5028,14 +7090,20 @@ ppc64_elf_size_stubs (output_bfd, stub_bfd, info, group_size,
for (stub_sec = htab->stub_bfd->sections;
stub_sec != NULL;
stub_sec = stub_sec->next)
+ if ((stub_sec->flags & SEC_LINKER_CREATED) == 0)
+ {
+ stub_sec->_raw_size = 0;
+ stub_sec->_cooked_size = 0;
+ }
+ htab->brlt->_raw_size = 0;
+ htab->brlt->_cooked_size = 0;
+ if (info->shared)
{
- stub_sec->_raw_size = 0;
- stub_sec->_cooked_size = 0;
+ htab->relbrlt->_raw_size = 0;
+ htab->relbrlt->_cooked_size = 0;
}
- htab->sbrlt->_raw_size = 0;
- htab->sbrlt->_cooked_size = 0;
- bfd_hash_traverse (&htab->stub_hash_table, ppc_size_one_stub, htab);
+ bfd_hash_traverse (&htab->stub_hash_table, ppc_size_one_stub, info);
/* Ask the linker to do its stuff. */
(*htab->layout_sections_again) ();
@@ -5046,15 +7114,14 @@ ppc64_elf_size_stubs (output_bfd, stub_bfd, info, group_size,
the dynamic symbol table is corrupted since the section symbol
for the stripped section isn't written. */
- return true;
+ return TRUE;
}
/* Called after we have determined section placement. If sections
move, we'll be called again. Provide a value for TOCstart. */
bfd_vma
-ppc64_elf_toc (obfd)
- bfd *obfd;
+ppc64_elf_toc (bfd *obfd)
{
asection *s;
bfd_vma TOCstart;
@@ -5110,79 +7177,141 @@ ppc64_elf_toc (obfd)
The stubs are kept in a hash table attached to the main linker
hash table. This function is called via gldelf64ppc_finish. */
-boolean
-ppc64_elf_build_stubs (info)
- struct bfd_link_info *info;
+bfd_boolean
+ppc64_elf_build_stubs (bfd_boolean emit_stub_syms,
+ struct bfd_link_info *info,
+ char **stats)
{
struct ppc_link_hash_table *htab = ppc_hash_table (info);
asection *stub_sec;
- bfd_vma plt_r2;
bfd_byte *p;
+ int stub_sec_count = 0;
+ htab->emit_stub_syms = emit_stub_syms;
for (stub_sec = htab->stub_bfd->sections;
stub_sec != NULL;
stub_sec = stub_sec->next)
- {
- bfd_size_type size;
+ if ((stub_sec->flags & SEC_LINKER_CREATED) == 0)
+ {
+ bfd_size_type size;
- /* Allocate memory to hold the linker stubs. */
- size = stub_sec->_raw_size;
- if (size != 0)
- {
- stub_sec->contents = (bfd_byte *) bfd_zalloc (htab->stub_bfd, size);
- if (stub_sec->contents == NULL)
- return false;
- }
- stub_sec->_cooked_size = 0;
- }
+ /* Allocate memory to hold the linker stubs. */
+ size = stub_sec->_raw_size;
+ if (size != 0)
+ {
+ stub_sec->contents = bfd_zalloc (htab->stub_bfd, size);
+ if (stub_sec->contents == NULL)
+ return FALSE;
+ }
+ stub_sec->_cooked_size = 0;
+ }
- if (htab->splt != NULL)
+ if (htab->plt != NULL)
{
unsigned int indx;
+ bfd_vma plt0;
/* Build the .glink plt call stub. */
- plt_r2 = (htab->splt->output_offset
- + htab->splt->output_section->vma
- - elf_gp (htab->splt->output_section->owner)
- - TOC_BASE_OFF);
- p = htab->sglink->contents;
- p = build_plt_stub (htab->sglink->owner, p, (int) plt_r2, 1);
- while (p < htab->sglink->contents + GLINK_CALL_STUB_SIZE)
+ 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_put_32 (htab->sglink->owner, NOP, p);
- p += 4;
+ (*_bfd_error_handler) (_(".glink and .plt too far apart"));
+ bfd_set_error (bfd_error_bad_value);
+ return FALSE;
}
+ if (htab->emit_stub_syms)
+ {
+ struct elf_link_hash_entry *h;
+ h = elf_link_hash_lookup (&htab->elf, "__glink", TRUE, FALSE, FALSE);
+ if (h == NULL)
+ return FALSE;
+ if (h->root.type == bfd_link_hash_new)
+ {
+ h->root.type = bfd_link_hash_defined;
+ h->root.u.def.section = htab->glink;
+ h->root.u.def.value = 0;
+ h->elf_link_hash_flags = (ELF_LINK_HASH_REF_REGULAR
+ | ELF_LINK_HASH_DEF_REGULAR
+ | ELF_LINK_HASH_REF_REGULAR_NONWEAK
+ | ELF_LINK_FORCED_LOCAL);
+ }
+ }
+ p = htab->glink->contents;
+ bfd_put_32 (htab->glink->owner, MFCTR_R12, p);
+ p += 4;
+ bfd_put_32 (htab->glink->owner, SLDI_R11_R0_3, p);
+ p += 4;
+ bfd_put_32 (htab->glink->owner, ADDIC_R2_R0_32K, p);
+ p += 4;
+ bfd_put_32 (htab->glink->owner, SUB_R12_R12_R11, p);
+ p += 4;
+ bfd_put_32 (htab->glink->owner, SRADI_R2_R2_63, p);
+ p += 4;
+ bfd_put_32 (htab->glink->owner, SLDI_R11_R0_2, p);
+ p += 4;
+ bfd_put_32 (htab->glink->owner, AND_R2_R2_R11, p);
+ p += 4;
+ bfd_put_32 (htab->glink->owner, SUB_R12_R12_R11, p);
+ p += 4;
+ bfd_put_32 (htab->glink->owner, ADD_R12_R12_R2, p);
+ p += 4;
+ bfd_put_32 (htab->glink->owner, ADDIS_R12_R12 | PPC_HA (plt0), p);
+ p += 4;
+ bfd_put_32 (htab->glink->owner, LD_R11_0R12 | PPC_LO (plt0), p);
+ p += 4;
+ bfd_put_32 (htab->glink->owner, ADDI_R12_R12 | PPC_LO (plt0), p);
+ p += 4;
+ bfd_put_32 (htab->glink->owner, LD_R2_0R12 | 8, p);
+ p += 4;
+ bfd_put_32 (htab->glink->owner, MTCTR_R11, p);
+ p += 4;
+ bfd_put_32 (htab->glink->owner, LD_R11_0R12 | 16, p);
+ p += 4;
+ bfd_put_32 (htab->glink->owner, BCTR, p);
+ p += 4;
+
/* Build the .glink lazy link call stubs. */
indx = 0;
- while (p < htab->sglink->contents + htab->sglink->_raw_size)
+ while (p < htab->glink->contents + htab->glink->_raw_size)
{
if (indx < 0x8000)
{
- bfd_put_32 (htab->sglink->owner, LI_R0_0 | indx, p);
+ bfd_put_32 (htab->glink->owner, LI_R0_0 | indx, p);
p += 4;
}
else
{
- bfd_put_32 (htab->sglink->owner, LIS_R0_0 | PPC_HI (indx), p);
+ bfd_put_32 (htab->glink->owner, LIS_R0_0 | PPC_HI (indx), p);
p += 4;
- bfd_put_32 (htab->sglink->owner, ORI_R0_R0_0 | PPC_LO (indx), p);
+ bfd_put_32 (htab->glink->owner, ORI_R0_R0_0 | PPC_LO (indx), p);
p += 4;
}
- bfd_put_32 (htab->sglink->owner,
- B_DOT | ((htab->sglink->contents - p) & 0x3fffffc), p);
+ bfd_put_32 (htab->glink->owner,
+ B_DOT | ((htab->glink->contents - p) & 0x3fffffc), p);
indx++;
p += 4;
}
- htab->sglink->_cooked_size = p - htab->sglink->contents;
+ htab->glink->_cooked_size = p - htab->glink->contents;
}
- if (htab->sbrlt->_raw_size != 0)
+ if (htab->brlt->_raw_size != 0)
+ {
+ htab->brlt->contents = bfd_zalloc (htab->brlt->owner,
+ htab->brlt->_raw_size);
+ if (htab->brlt->contents == NULL)
+ return FALSE;
+ }
+ if (info->shared && htab->relbrlt->_raw_size != 0)
{
- htab->sbrlt->contents = (bfd_byte *) bfd_zalloc (htab->sbrlt->owner,
- htab->sbrlt->_raw_size);
- if (htab->sbrlt->contents == NULL)
- return false;
+ htab->relbrlt->contents = bfd_zalloc (htab->relbrlt->owner,
+ htab->relbrlt->_raw_size);
+ if (htab->relbrlt->contents == NULL)
+ return FALSE;
}
/* Build the stubs as directed by the stub hash table. */
@@ -5191,19 +7320,43 @@ ppc64_elf_build_stubs (info)
for (stub_sec = htab->stub_bfd->sections;
stub_sec != NULL;
stub_sec = stub_sec->next)
- {
- if (stub_sec->_raw_size != stub_sec->_cooked_size)
- break;
- }
+ if ((stub_sec->flags & SEC_LINKER_CREATED) == 0)
+ {
+ stub_sec_count += 1;
+ if (stub_sec->_raw_size != stub_sec->_cooked_size)
+ break;
+ }
if (stub_sec != NULL
- || htab->sglink->_raw_size != htab->sglink->_cooked_size)
+ || htab->glink->_raw_size != htab->glink->_cooked_size)
{
- htab->stub_error = true;
+ htab->stub_error = TRUE;
(*_bfd_error_handler) (_("stubs don't match calculated size"));
}
- return !htab->stub_error;
+ if (htab->stub_error)
+ return FALSE;
+
+ if (stats != NULL)
+ {
+ *stats = bfd_malloc (500);
+ if (*stats == NULL)
+ return FALSE;
+
+ sprintf (*stats, _("linker stubs in %u groups\n"
+ " branch %lu\n"
+ " toc adjust %lu\n"
+ " long branch %lu\n"
+ " long toc adj %lu\n"
+ " plt call %lu"),
+ stub_sec_count,
+ htab->stub_count[ppc_stub_long_branch - 1],
+ htab->stub_count[ppc_stub_long_branch_r2off - 1],
+ htab->stub_count[ppc_stub_plt_branch - 1],
+ htab->stub_count[ppc_stub_plt_branch_r2off - 1],
+ htab->stub_count[ppc_stub_plt_call - 1]);
+ }
+ return TRUE;
}
/* The RELOCATE_SECTION function is called by the ELF backend linker
@@ -5215,7 +7368,7 @@ ppc64_elf_build_stubs (info)
This function is responsible for adjust the section contents as
necessary, and (if using Rela relocs and generating a
- relocateable output file) adjusting the reloc addend as
+ relocatable output file) adjusting the reloc addend as
necessary.
This function does not have to worry about setting the reloc
@@ -5229,56 +7382,55 @@ ppc64_elf_build_stubs (info)
The global hash table entry for the global symbols can be found
via elf_sym_hashes (input_bfd).
- When generating relocateable output, this function must handle
+ 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 boolean
-ppc64_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;
+static bfd_boolean
+ppc64_elf_relocate_section (bfd *output_bfd,
+ struct bfd_link_info *info,
+ bfd *input_bfd,
+ asection *input_section,
+ bfd_byte *contents,
+ Elf_Internal_Rela *relocs,
+ Elf_Internal_Sym *local_syms,
+ asection **local_sections)
{
struct ppc_link_hash_table *htab;
Elf_Internal_Shdr *symtab_hdr;
struct elf_link_hash_entry **sym_hashes;
Elf_Internal_Rela *rel;
Elf_Internal_Rela *relend;
- bfd_vma *local_got_offsets;
+ Elf_Internal_Rela outrel;
+ bfd_byte *loc;
+ struct got_entry **local_got_ents;
bfd_vma TOCstart;
- boolean ret = true;
- boolean is_opd;
+ bfd_boolean ret = TRUE;
+ bfd_boolean is_opd;
/* Disabled until we sort out how ld should choose 'y' vs 'at'. */
- boolean is_power4 = false;
+ bfd_boolean is_power4 = FALSE;
- if (info->relocateable)
- return true;
+ if (info->relocatable)
+ return TRUE;
/* Initialize howto table if needed. */
if (!ppc64_elf_howto_table[R_PPC64_ADDR32])
ppc_howto_init ();
htab = ppc_hash_table (info);
- local_got_offsets = elf_local_got_offsets (input_bfd);
+ 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 = elf_section_data (input_section)->tdata != NULL;
+ is_opd = ppc64_elf_section_data (input_section)->opd.adjust != NULL;
rel = relocs;
relend = relocs + input_section->reloc_count;
for (; rel < relend; rel++)
{
- enum elf_ppc_reloc_type r_type;
- bfd_vma offset;
+ enum elf_ppc64_reloc_type r_type;
bfd_vma addend;
bfd_reloc_status_type r;
Elf_Internal_Sym *sym;
@@ -5286,96 +7438,420 @@ ppc64_elf_relocate_section (output_bfd, info, input_bfd, input_section,
struct elf_link_hash_entry *h;
struct elf_link_hash_entry *fdh;
const char *sym_name;
- unsigned long r_symndx;
+ unsigned long r_symndx, toc_symndx;
+ char tls_mask, tls_gd, tls_type;
+ char sym_type;
bfd_vma relocation;
- boolean unresolved_reloc;
- boolean warned;
- long insn;
+ bfd_boolean unresolved_reloc;
+ bfd_boolean warned;
+ unsigned long insn, mask;
struct ppc_stub_hash_entry *stub_entry;
bfd_vma max_br_offset;
bfd_vma from;
- r_type = (enum elf_ppc_reloc_type) ELF64_R_TYPE (rel->r_info);
+ r_type = ELF64_R_TYPE (rel->r_info);
r_symndx = ELF64_R_SYM (rel->r_info);
- offset = rel->r_offset;
- addend = rel->r_addend;
- r = bfd_reloc_other;
- sym = (Elf_Internal_Sym *) 0;
- sec = (asection *) 0;
- h = (struct elf_link_hash_entry *) 0;
- sym_name = (const char *) 0;
- unresolved_reloc = false;
- warned = false;
-
- if (r_type == R_PPC64_TOC)
- {
- /* Relocation value is TOC base. Symbol is ignored. */
- relocation = TOCstart + TOC_BASE_OFF;
- }
- else if (r_symndx < symtab_hdr->sh_info)
+
+ /* For old style R_PPC64_TOC relocs with a zero symbol, use the
+ symbol of the previous ADDR64 reloc. The symbol gives us the
+ proper TOC base to use. */
+ if (rel->r_info == ELF64_R_INFO (0, R_PPC64_TOC)
+ && rel != relocs
+ && ELF64_R_TYPE (rel[-1].r_info) == R_PPC64_ADDR64
+ && is_opd)
+ r_symndx = ELF64_R_SYM (rel[-1].r_info);
+
+ sym = NULL;
+ sec = NULL;
+ h = NULL;
+ sym_name = NULL;
+ unresolved_reloc = FALSE;
+ warned = FALSE;
+
+ if (r_symndx < symtab_hdr->sh_info)
{
/* It's a local symbol. */
sym = local_syms + r_symndx;
sec = local_sections[r_symndx];
- sym_name = "<local symbol>";
-
- relocation = _bfd_elf_rela_local_sym (output_bfd, sym, sec, rel);
- /* rel may have changed, update our copy of addend. */
- addend = rel->r_addend;
-
+ sym_name = bfd_elf_local_sym_name (input_bfd, sym);
+ sym_type = ELF64_ST_TYPE (sym->st_info);
+ relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel);
if (elf_section_data (sec) != NULL)
{
long *opd_sym_adjust;
- opd_sym_adjust = (long *) elf_section_data (sec)->tdata;
- if (opd_sym_adjust != NULL && sym->st_value % 24 == 0)
+ opd_sym_adjust = ppc64_elf_section_data (sec)->opd.adjust;
+ if (opd_sym_adjust != NULL)
relocation += opd_sym_adjust[sym->st_value / 24];
}
}
else
{
- /* It's a global symbol. */
- 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;
+ 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;
- relocation = 0;
- if (h->root.type == bfd_link_hash_defined
+ sym_type = h->type;
+ }
+
+ /* TLS optimizations. Replace instruction sequences and relocs
+ based on information we collected in tls_optimize. We edit
+ RELOCS so that --emit-relocs will output something sensible
+ for the final instruction stream. */
+ tls_mask = 0;
+ tls_gd = 0;
+ toc_symndx = 0;
+ if (IS_PPC64_TLS_RELOC (r_type))
+ {
+ if (h != NULL)
+ tls_mask = ((struct ppc_link_hash_entry *) h)->tls_mask;
+ else if (local_got_ents != NULL)
+ {
+ char *lgot_masks;
+ lgot_masks = (char *) (local_got_ents + symtab_hdr->sh_info);
+ tls_mask = lgot_masks[r_symndx];
+ }
+ if (tls_mask == 0 && r_type == R_PPC64_TLS)
+ {
+ /* Check for toc tls entries. */
+ char *toc_tls;
+
+ if (!get_tls_mask (&toc_tls, &toc_symndx, &local_syms,
+ rel, input_bfd))
+ return FALSE;
+
+ if (toc_tls)
+ tls_mask = *toc_tls;
+ }
+ }
+
+ /* Check that tls relocs are used with tls syms, and non-tls
+ relocs are used with non-tls syms. */
+ if (r_symndx != 0
+ && r_type != R_PPC64_NONE
+ && (h == NULL
+ || h->root.type == bfd_link_hash_defined
|| h->root.type == bfd_link_hash_defweak)
+ && IS_PPC64_TLS_RELOC (r_type) != (sym_type == STT_TLS))
+ {
+ if (r_type == R_PPC64_TLS && tls_mask != 0)
+ /* R_PPC64_TLS is OK against a symbol in the TOC. */
+ ;
+ else
+ (*_bfd_error_handler)
+ (sym_type == STT_TLS
+ ? _("%s(%s+0x%lx): %s used with TLS symbol %s")
+ : _("%s(%s+0x%lx): %s used with non-TLS symbol %s"),
+ bfd_archive_filename (input_bfd),
+ input_section->name,
+ (long) rel->r_offset,
+ ppc64_elf_howto_table[r_type]->name,
+ sym_name);
+ }
+
+ /* Ensure reloc mapping code below stays sane. */
+ if (R_PPC64_TOC16_LO_DS != R_PPC64_TOC16_DS + 1
+ || R_PPC64_TOC16_LO != R_PPC64_TOC16 + 1
+ || (R_PPC64_GOT_TLSLD16 & 3) != (R_PPC64_GOT_TLSGD16 & 3)
+ || (R_PPC64_GOT_TLSLD16_LO & 3) != (R_PPC64_GOT_TLSGD16_LO & 3)
+ || (R_PPC64_GOT_TLSLD16_HI & 3) != (R_PPC64_GOT_TLSGD16_HI & 3)
+ || (R_PPC64_GOT_TLSLD16_HA & 3) != (R_PPC64_GOT_TLSGD16_HA & 3)
+ || (R_PPC64_GOT_TLSLD16 & 3) != (R_PPC64_GOT_TPREL16_DS & 3)
+ || (R_PPC64_GOT_TLSLD16_LO & 3) != (R_PPC64_GOT_TPREL16_LO_DS & 3)
+ || (R_PPC64_GOT_TLSLD16_HI & 3) != (R_PPC64_GOT_TPREL16_HI & 3)
+ || (R_PPC64_GOT_TLSLD16_HA & 3) != (R_PPC64_GOT_TPREL16_HA & 3))
+ abort ();
+
+ switch (r_type)
+ {
+ default:
+ break;
+
+ case R_PPC64_TOC16:
+ case R_PPC64_TOC16_LO:
+ case R_PPC64_TOC16_DS:
+ case R_PPC64_TOC16_LO_DS:
+ {
+ /* Check for toc tls entries. */
+ char *toc_tls;
+ int retval;
+
+ retval = get_tls_mask (&toc_tls, &toc_symndx, &local_syms,
+ rel, input_bfd);
+ if (retval == 0)
+ return FALSE;
+
+ if (toc_tls)
+ {
+ tls_mask = *toc_tls;
+ if (r_type == R_PPC64_TOC16_DS
+ || r_type == R_PPC64_TOC16_LO_DS)
+ {
+ if (tls_mask != 0
+ && (tls_mask & (TLS_DTPREL | TLS_TPREL)) == 0)
+ goto toctprel;
+ }
+ else
+ {
+ /* If we found a GD reloc pair, then we might be
+ doing a GD->IE transition. */
+ if (retval == 2)
+ {
+ tls_gd = TLS_TPRELGD;
+ if (tls_mask != 0 && (tls_mask & TLS_GD) == 0)
+ goto tls_get_addr_check;
+ }
+ else if (retval == 3)
+ {
+ if (tls_mask != 0 && (tls_mask & TLS_LD) == 0)
+ goto tls_get_addr_check;
+ }
+ }
+ }
+ }
+ break;
+
+ case R_PPC64_GOT_TPREL16_DS:
+ case R_PPC64_GOT_TPREL16_LO_DS:
+ if (tls_mask != 0
+ && (tls_mask & TLS_TPREL) == 0)
{
- sec = h->root.u.def.section;
- if (sec->output_section == NULL)
- /* Set a flag that will be cleared later if we find a
- relocation value for this symbol. output_section
- is typically NULL for symbols satisfied by a shared
- library. */
- unresolved_reloc = true;
+ toctprel:
+ insn = bfd_get_32 (output_bfd, contents + rel->r_offset - 2);
+ insn &= 31 << 21;
+ insn |= 0x3c0d0000; /* addis 0,13,0 */
+ bfd_put_32 (output_bfd, insn, contents + rel->r_offset - 2);
+ r_type = R_PPC64_TPREL16_HA;
+ if (toc_symndx != 0)
+ {
+ rel->r_info = ELF64_R_INFO (toc_symndx, r_type);
+ /* We changed the symbol. Start over in order to
+ get h, sym, sec etc. right. */
+ rel--;
+ continue;
+ }
else
- relocation = (h->root.u.def.value
- + sec->output_section->vma
- + sec->output_offset);
+ rel->r_info = ELF64_R_INFO (r_symndx, r_type);
+ }
+ break;
+
+ case R_PPC64_TLS:
+ if (tls_mask != 0
+ && (tls_mask & TLS_TPREL) == 0)
+ {
+ bfd_vma rtra;
+ insn = bfd_get_32 (output_bfd, contents + rel->r_offset);
+ if ((insn & ((0x3f << 26) | (31 << 11)))
+ == ((31 << 26) | (13 << 11)))
+ rtra = insn & ((1 << 26) - (1 << 16));
+ else if ((insn & ((0x3f << 26) | (31 << 16)))
+ == ((31 << 26) | (13 << 16)))
+ rtra = (insn & (31 << 21)) | ((insn & (31 << 11)) << 5);
+ else
+ abort ();
+ if ((insn & ((1 << 11) - (1 << 1))) == 266 << 1)
+ /* add -> addi. */
+ insn = 14 << 26;
+ else if ((insn & (31 << 1)) == 23 << 1
+ && ((insn & (31 << 6)) < 14 << 6
+ || ((insn & (31 << 6)) >= 16 << 6
+ && (insn & (31 << 6)) < 24 << 6)))
+ /* load and store indexed -> dform. */
+ insn = (32 | ((insn >> 6) & 31)) << 26;
+ else if ((insn & (31 << 1)) == 21 << 1
+ && (insn & (0x1a << 6)) == 0)
+ /* ldx, ldux, stdx, stdux -> ld, ldu, std, stdu. */
+ insn = (((58 | ((insn >> 6) & 4)) << 26)
+ | ((insn >> 6) & 1));
+ else if ((insn & (31 << 1)) == 21 << 1
+ && (insn & ((1 << 11) - (1 << 1))) == 341 << 1)
+ /* lwax -> lwa. */
+ insn = (58 << 26) | 2;
+ else
+ abort ();
+ insn |= rtra;
+ bfd_put_32 (output_bfd, insn, contents + rel->r_offset);
+ /* Was PPC64_TLS which sits on insn boundary, now
+ PPC64_TPREL16_LO which is at insn+2. */
+ rel->r_offset += 2;
+ r_type = R_PPC64_TPREL16_LO;
+ if (toc_symndx != 0)
+ {
+ rel->r_info = ELF64_R_INFO (toc_symndx, r_type);
+ /* We changed the symbol. Start over in order to
+ get h, sym, sec etc. right. */
+ rel--;
+ continue;
+ }
+ else
+ rel->r_info = ELF64_R_INFO (r_symndx, r_type);
+ }
+ break;
+
+ case R_PPC64_GOT_TLSGD16_HI:
+ case R_PPC64_GOT_TLSGD16_HA:
+ tls_gd = TLS_TPRELGD;
+ if (tls_mask != 0 && (tls_mask & TLS_GD) == 0)
+ goto tls_gdld_hi;
+ break;
+
+ case R_PPC64_GOT_TLSLD16_HI:
+ case R_PPC64_GOT_TLSLD16_HA:
+ if (tls_mask != 0 && (tls_mask & TLS_LD) == 0)
+ {
+ tls_gdld_hi:
+ if ((tls_mask & tls_gd) != 0)
+ r_type = (((r_type - (R_PPC64_GOT_TLSGD16 & 3)) & 3)
+ + R_PPC64_GOT_TPREL16_DS);
+ else
+ {
+ bfd_put_32 (output_bfd, NOP, contents + rel->r_offset);
+ rel->r_offset -= 2;
+ r_type = R_PPC64_NONE;
+ }
+ rel->r_info = ELF64_R_INFO (r_symndx, r_type);
+ }
+ break;
+
+ case R_PPC64_GOT_TLSGD16:
+ case R_PPC64_GOT_TLSGD16_LO:
+ tls_gd = TLS_TPRELGD;
+ if (tls_mask != 0 && (tls_mask & TLS_GD) == 0)
+ goto tls_get_addr_check;
+ break;
+
+ case R_PPC64_GOT_TLSLD16:
+ case R_PPC64_GOT_TLSLD16_LO:
+ if (tls_mask != 0 && (tls_mask & TLS_LD) == 0)
+ {
+ tls_get_addr_check:
+ if (rel + 1 < relend)
+ {
+ enum elf_ppc64_reloc_type r_type2;
+ unsigned long r_symndx2;
+ struct elf_link_hash_entry *h2;
+ bfd_vma insn1, insn2, insn3;
+ bfd_vma offset;
+
+ /* The next instruction should be a call to
+ __tls_get_addr. Peek at the reloc to be sure. */
+ r_type2 = ELF64_R_TYPE (rel[1].r_info);
+ r_symndx2 = ELF64_R_SYM (rel[1].r_info);
+ if (r_symndx2 < symtab_hdr->sh_info
+ || (r_type2 != R_PPC64_REL14
+ && r_type2 != R_PPC64_REL14_BRTAKEN
+ && r_type2 != R_PPC64_REL14_BRNTAKEN
+ && r_type2 != R_PPC64_REL24))
+ break;
+
+ h2 = sym_hashes[r_symndx2 - symtab_hdr->sh_info];
+ while (h2->root.type == bfd_link_hash_indirect
+ || h2->root.type == bfd_link_hash_warning)
+ h2 = (struct elf_link_hash_entry *) h2->root.u.i.link;
+ if (h2 == NULL || h2 != htab->tls_get_addr)
+ break;
+
+ /* OK, it checks out. Replace the call. */
+ offset = rel[1].r_offset;
+ insn1 = bfd_get_32 (output_bfd,
+ contents + rel->r_offset - 2);
+ insn3 = bfd_get_32 (output_bfd,
+ contents + offset + 4);
+ if ((tls_mask & tls_gd) != 0)
+ {
+ /* IE */
+ insn1 &= (1 << 26) - (1 << 2);
+ insn1 |= 58 << 26; /* ld */
+ insn2 = 0x7c636a14; /* add 3,3,13 */
+ rel[1].r_info = ELF64_R_INFO (r_symndx2, R_PPC64_NONE);
+ if ((tls_mask & TLS_EXPLICIT) == 0)
+ r_type = (((r_type - (R_PPC64_GOT_TLSGD16 & 3)) & 3)
+ + R_PPC64_GOT_TPREL16_DS);
+ else
+ r_type += R_PPC64_TOC16_DS - R_PPC64_TOC16;
+ rel->r_info = ELF64_R_INFO (r_symndx, r_type);
+ }
+ else
+ {
+ /* LE */
+ insn1 = 0x3c6d0000; /* addis 3,13,0 */
+ insn2 = 0x38630000; /* addi 3,3,0 */
+ if (tls_gd == 0)
+ {
+ /* Was an LD reloc. */
+ r_symndx = 0;
+ rel->r_addend = htab->elf.tls_sec->vma + DTP_OFFSET;
+ rel[1].r_addend = htab->elf.tls_sec->vma + DTP_OFFSET;
+ }
+ else if (toc_symndx != 0)
+ r_symndx = toc_symndx;
+ r_type = R_PPC64_TPREL16_HA;
+ rel->r_info = ELF64_R_INFO (r_symndx, r_type);
+ rel[1].r_info = ELF64_R_INFO (r_symndx,
+ R_PPC64_TPREL16_LO);
+ rel[1].r_offset += 2;
+ }
+ if (insn3 == NOP
+ || insn3 == CROR_151515 || insn3 == CROR_313131)
+ {
+ insn3 = insn2;
+ insn2 = NOP;
+ rel[1].r_offset += 4;
+ }
+ bfd_put_32 (output_bfd, insn1, contents + rel->r_offset - 2);
+ bfd_put_32 (output_bfd, insn2, contents + offset);
+ bfd_put_32 (output_bfd, insn3, contents + offset + 4);
+ if (tls_gd == 0 || toc_symndx != 0)
+ {
+ /* We changed the symbol. Start over in order
+ to get h, sym, sec etc. right. */
+ rel--;
+ continue;
+ }
+ }
+ }
+ break;
+
+ case R_PPC64_DTPMOD64:
+ if (rel + 1 < relend
+ && rel[1].r_info == ELF64_R_INFO (r_symndx, R_PPC64_DTPREL64)
+ && rel[1].r_offset == rel->r_offset + 8)
+ {
+ if ((tls_mask & TLS_GD) == 0)
+ {
+ rel[1].r_info = ELF64_R_INFO (r_symndx, R_PPC64_NONE);
+ if ((tls_mask & TLS_TPRELGD) != 0)
+ r_type = R_PPC64_TPREL64;
+ else
+ {
+ bfd_put_64 (output_bfd, 1, contents + rel->r_offset);
+ r_type = R_PPC64_NONE;
+ }
+ rel->r_info = ELF64_R_INFO (r_symndx, r_type);
+ }
}
- else if (h->root.type == bfd_link_hash_undefweak)
- ;
- else if (info->shared
- && (!info->symbolic || info->allow_shlib_undefined)
- && !info->no_undefined
- && ELF_ST_VISIBILITY (h->other) == STV_DEFAULT)
- ;
else
{
- if (! ((*info->callbacks->undefined_symbol)
- (info, h->root.root.string, input_bfd, input_section,
- offset, (!info->shared
- || info->no_undefined
- || ELF_ST_VISIBILITY (h->other)))))
- return false;
- warned = true;
+ if ((tls_mask & TLS_LD) == 0)
+ {
+ bfd_put_64 (output_bfd, 1, contents + rel->r_offset);
+ r_type = R_PPC64_NONE;
+ rel->r_info = ELF64_R_INFO (r_symndx, r_type);
+ }
}
+ break;
+
+ case R_PPC64_TPREL64:
+ if ((tls_mask & TLS_TPREL) == 0)
+ {
+ r_type = R_PPC64_NONE;
+ rel->r_info = ELF64_R_INFO (r_symndx, r_type);
+ }
+ break;
}
- /* First handle relocations that tweak non-addend part of insn. */
+ /* Handle other relocations that tweak non-addend part of insn. */
insn = 0;
switch (r_type)
{
@@ -5391,7 +7867,8 @@ ppc64_elf_relocate_section (output_bfd, info, input_bfd, input_section,
/* Branch not taken prediction relocations. */
case R_PPC64_ADDR14_BRNTAKEN:
case R_PPC64_REL14_BRNTAKEN:
- insn |= bfd_get_32 (output_bfd, contents + offset) & ~(0x01 << 21);
+ 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
@@ -5406,51 +7883,97 @@ ppc64_elf_relocate_section (output_bfd, info, input_bfd, input_section,
}
else
{
- from = (offset
+ 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 + addend - from) < 0)
+ if ((bfd_signed_vma) (relocation + rel->r_addend - from) < 0)
insn ^= 0x01 << 21;
}
- bfd_put_32 (output_bfd, (bfd_vma) insn, contents + offset);
+ bfd_put_32 (output_bfd, insn, contents + rel->r_offset);
break;
case R_PPC64_REL24:
- /* A REL24 branching to a linkage function is followed by a
- nop. We replace the nop with a ld in order to restore
- the TOC base pointer. Only calls to shared objects need
- to alter the TOC base. These are recognized by their
- need for a PLT entry. */
- if (h != NULL
- && (fdh = ((struct ppc_link_hash_entry *) h)->oh) != NULL
- && fdh->plt.offset != (bfd_vma) -1
+ /* Calls to functions with a different TOC, such as calls to
+ shared objects, need to alter the TOC pointer. This is
+ done using a linkage stub. A REL24 branching to these
+ linkage stubs needs to be followed by a nop, as the nop
+ will be replaced with an instruction to restore the TOC
+ base pointer. */
+ if (((h != NULL
+ && (fdh = ((struct ppc_link_hash_entry *) h)->oh) != NULL
+ && fdh->plt.plist != NULL)
+ || ((fdh = h, sec) != NULL
+ && sec->output_section != NULL
+ && (htab->stub_group[sec->id].toc_off
+ != htab->stub_group[input_section->id].toc_off)))
&& (stub_entry = ppc_get_stub_entry (input_section, sec, fdh,
- rel, htab)) != NULL)
+ rel, htab)) != NULL
+ && (stub_entry->stub_type == ppc_stub_plt_call
+ || stub_entry->stub_type == ppc_stub_plt_branch_r2off
+ || stub_entry->stub_type == ppc_stub_long_branch_r2off))
{
- boolean can_plt_call = 0;
+ bfd_boolean can_plt_call = 0;
- if (offset + 8 <= input_section->_cooked_size)
+ if (rel->r_offset + 8 <= input_section->_cooked_size)
{
- insn = bfd_get_32 (input_bfd, contents + offset + 4);
+ insn = bfd_get_32 (input_bfd, contents + rel->r_offset + 4);
if (insn == NOP
|| insn == CROR_151515 || insn == CROR_313131)
{
- bfd_put_32 (input_bfd, (bfd_vma) LD_R2_40R1,
- contents + offset + 4);
+ bfd_put_32 (input_bfd, LD_R2_40R1,
+ contents + rel->r_offset + 4);
can_plt_call = 1;
}
}
if (!can_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 + offset);
- if ((insn & 1) == 0)
- can_plt_call = 1;
+ if (stub_entry->stub_type == ppc_stub_plt_call)
+ {
+ /* If this is a plain branch rather than a branch
+ and link, don't require a nop. */
+ insn = bfd_get_32 (input_bfd, contents + rel->r_offset);
+ if ((insn & 1) == 0)
+ can_plt_call = 1;
+ }
+ else if (h != NULL
+ && strcmp (h->root.root.string,
+ ".__libc_start_main") == 0)
+ {
+ /* Allow crt1 branch to go via a toc adjusting stub. */
+ can_plt_call = 1;
+ }
+ else
+ {
+ if (strcmp (input_section->output_section->name,
+ ".init") == 0
+ || strcmp (input_section->output_section->name,
+ ".fini") == 0)
+ (*_bfd_error_handler)
+ (_("%s(%s+0x%lx): automatic multiple TOCs "
+ "not supported using your crt files; "
+ "recompile with -mminimal-toc or upgrade gcc"),
+ bfd_archive_filename (input_bfd),
+ input_section->name,
+ (long) rel->r_offset);
+ else
+ (*_bfd_error_handler)
+ (_("%s(%s+0x%lx): sibling call optimization to `%s' "
+ "does not allow automatic multiple TOCs; "
+ "recompile with -mminimal-toc or "
+ "-fno-optimize-sibling-calls, "
+ "or make `%s' extern"),
+ bfd_archive_filename (input_bfd),
+ input_section->name,
+ (long) rel->r_offset,
+ sym_name,
+ sym_name);
+ bfd_set_error (bfd_error_bad_value);
+ ret = FALSE;
+ }
}
if (can_plt_call)
@@ -5458,15 +7981,15 @@ ppc64_elf_relocate_section (output_bfd, info, input_bfd, input_section,
relocation = (stub_entry->stub_offset
+ stub_entry->stub_sec->output_offset
+ stub_entry->stub_sec->output_section->vma);
- addend = 0;
- unresolved_reloc = false;
+ if (stub_entry->stub_type == ppc_stub_plt_call)
+ unresolved_reloc = FALSE;
}
}
if (h != NULL
&& h->root.type == bfd_link_hash_undefweak
&& relocation == 0
- && addend == 0)
+ && rel->r_addend == 0)
{
/* Tweak calls to undefined weak functions to point at a
blr. We can thus call a weak function without first
@@ -5476,7 +7999,7 @@ ppc64_elf_relocate_section (output_bfd, info, input_bfd, input_section,
relocation = (htab->sfpr->_raw_size - 4
+ htab->sfpr->output_offset
+ htab->sfpr->output_section->vma);
- from = (offset
+ from = (rel->r_offset
+ input_section->output_offset
+ input_section->output_section->vma);
@@ -5490,6 +8013,8 @@ ppc64_elf_relocate_section (output_bfd, info, input_bfd, input_section,
}
/* Set `addend'. */
+ tls_type = 0;
+ addend = rel->r_addend;
switch (r_type)
{
default:
@@ -5498,116 +8023,211 @@ ppc64_elf_relocate_section (output_bfd, info, input_bfd, input_section,
bfd_archive_filename (input_bfd), (int) r_type, sym_name);
bfd_set_error (bfd_error_bad_value);
- ret = false;
+ ret = FALSE;
continue;
case R_PPC64_NONE:
- case R_PPC_GNU_VTINHERIT:
- case R_PPC_GNU_VTENTRY:
+ case R_PPC64_TLS:
+ case R_PPC64_GNU_VTINHERIT:
+ case R_PPC64_GNU_VTENTRY:
continue;
/* GOT16 relocations. Like an ADDR16 using the symbol's
address in the GOT as relocation value instead of the
- symbols value itself. Also, create a GOT entry for the
+ symbol's value itself. Also, create a GOT entry for the
symbol and put the symbol value there. */
+ case R_PPC64_GOT_TLSGD16:
+ case R_PPC64_GOT_TLSGD16_LO:
+ case R_PPC64_GOT_TLSGD16_HI:
+ case R_PPC64_GOT_TLSGD16_HA:
+ tls_type = TLS_TLS | TLS_GD;
+ goto dogot;
+
+ case R_PPC64_GOT_TLSLD16:
+ case R_PPC64_GOT_TLSLD16_LO:
+ case R_PPC64_GOT_TLSLD16_HI:
+ case R_PPC64_GOT_TLSLD16_HA:
+ tls_type = TLS_TLS | TLS_LD;
+ goto dogot;
+
+ case R_PPC64_GOT_TPREL16_DS:
+ case R_PPC64_GOT_TPREL16_LO_DS:
+ case R_PPC64_GOT_TPREL16_HI:
+ case R_PPC64_GOT_TPREL16_HA:
+ tls_type = TLS_TLS | TLS_TPREL;
+ goto dogot;
+
+ case R_PPC64_GOT_DTPREL16_DS:
+ case R_PPC64_GOT_DTPREL16_LO_DS:
+ case R_PPC64_GOT_DTPREL16_HI:
+ case R_PPC64_GOT_DTPREL16_HA:
+ tls_type = TLS_TLS | TLS_DTPREL;
+ goto dogot;
+
case R_PPC64_GOT16:
case R_PPC64_GOT16_LO:
case R_PPC64_GOT16_HI:
case R_PPC64_GOT16_HA:
case R_PPC64_GOT16_DS:
case R_PPC64_GOT16_LO_DS:
+ dogot:
{
/* Relocation is to the entry for this symbol in the global
offset table. */
+ asection *got;
+ bfd_vma *offp;
bfd_vma off;
+ unsigned long indx = 0;
- if (htab->sgot == NULL)
- abort ();
-
- if (h != NULL)
+ if (tls_type == (TLS_TLS | TLS_LD)
+ && (h == NULL
+ || !(h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC)))
+ offp = &ppc64_tlsld_got (input_bfd)->offset;
+ else
{
- boolean dyn;
-
- off = h->got.offset;
- dyn = htab->elf.dynamic_sections_created;
- if (! WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, info, h)
- || (info->shared
- && (info->symbolic
- || h->dynindx == -1
- || (h->elf_link_hash_flags
- & ELF_LINK_FORCED_LOCAL))
- && (h->elf_link_hash_flags
- & ELF_LINK_HASH_DEF_REGULAR)))
+ struct got_entry *ent;
+
+ if (h != NULL)
{
- /* 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 .rel.got
- relocation entry to initialize the value. This
- is done in the finish_dynamic_symbol routine. */
- if ((off & 1) != 0)
- off &= ~1;
+ bfd_boolean dyn = htab->elf.dynamic_sections_created;
+ if (!WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, info->shared, h)
+ || (info->shared
+ && SYMBOL_REFERENCES_LOCAL (info, h)))
+ /* This is actually a static link, or it is a
+ -Bsymbolic link and the symbol is defined
+ locally, or the symbol was forced to be local
+ because of a version file. */
+ ;
else
{
- bfd_put_64 (output_bfd, relocation,
- htab->sgot->contents + off);
- h->got.offset |= 1;
+ indx = h->dynindx;
+ unresolved_reloc = FALSE;
}
+ ent = h->got.glist;
}
else
- unresolved_reloc = false;
+ {
+ if (local_got_ents == NULL)
+ abort ();
+ ent = local_got_ents[r_symndx];
+ }
+
+ for (; ent != NULL; ent = ent->next)
+ if (ent->addend == rel->r_addend
+ && ent->owner == input_bfd
+ && ent->tls_type == tls_type)
+ break;
+ if (ent == NULL)
+ abort ();
+ offp = &ent->got.offset;
}
+
+ got = ppc64_elf_tdata (input_bfd)->got;
+ if (got == NULL)
+ abort ();
+
+ /* The offset must always be a multiple of 8. We use the
+ least significant bit to record whether we have already
+ processed this entry. */
+ off = *offp;
+ if ((off & 1) != 0)
+ off &= ~1;
else
{
- if (local_got_offsets == NULL)
- abort ();
+ /* Generate relocs for the dynamic linker, except in
+ the case of TLSLD where we'll use one entry per
+ module. */
+ asection *relgot = ppc64_elf_tdata (input_bfd)->relgot;
+
+ *offp = off | 1;
+ if ((info->shared || indx != 0)
+ && (h == NULL
+ || ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
+ || h->root.type != bfd_link_hash_undefweak))
+ {
+ outrel.r_offset = (got->output_section->vma
+ + got->output_offset
+ + off);
+ outrel.r_addend = rel->r_addend;
+ if (tls_type & (TLS_LD | TLS_GD))
+ {
+ outrel.r_addend = 0;
+ outrel.r_info = ELF64_R_INFO (indx, R_PPC64_DTPMOD64);
+ if (tls_type == (TLS_TLS | TLS_GD))
+ {
+ loc = relgot->contents;
+ loc += (relgot->reloc_count++
+ * sizeof (Elf64_External_Rela));
+ bfd_elf64_swap_reloca_out (output_bfd,
+ &outrel, loc);
+ outrel.r_offset += 8;
+ outrel.r_addend = rel->r_addend;
+ outrel.r_info
+ = ELF64_R_INFO (indx, R_PPC64_DTPREL64);
+ }
+ }
+ else if (tls_type == (TLS_TLS | TLS_DTPREL))
+ outrel.r_info = ELF64_R_INFO (indx, R_PPC64_DTPREL64);
+ else if (tls_type == (TLS_TLS | TLS_TPREL))
+ outrel.r_info = ELF64_R_INFO (indx, R_PPC64_TPREL64);
+ else if (indx == 0)
+ {
+ outrel.r_info = ELF64_R_INFO (indx, R_PPC64_RELATIVE);
- off = local_got_offsets[r_symndx];
+ /* Write the .got section contents for the sake
+ of prelink. */
+ loc = got->contents + off;
+ bfd_put_64 (output_bfd, outrel.r_addend + relocation,
+ loc);
+ }
+ else
+ outrel.r_info = ELF64_R_INFO (indx, R_PPC64_GLOB_DAT);
- /* 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;
+ if (indx == 0 && tls_type != (TLS_TLS | TLS_LD))
+ {
+ outrel.r_addend += relocation;
+ if (tls_type & (TLS_GD | TLS_DTPREL | TLS_TPREL))
+ outrel.r_addend -= htab->elf.tls_sec->vma;
+ }
+ loc = relgot->contents;
+ loc += (relgot->reloc_count++
+ * sizeof (Elf64_External_Rela));
+ bfd_elf64_swap_reloca_out (output_bfd, &outrel, loc);
+ }
+
+ /* Init the .got section contents here if we're not
+ emitting a reloc. */
else
{
- bfd_put_64 (output_bfd, relocation,
- htab->sgot->contents + off);
-
- if (info->shared)
+ relocation += rel->r_addend;
+ if (tls_type == (TLS_TLS | TLS_LD))
+ relocation = 1;
+ else if (tls_type != 0)
{
- Elf_Internal_Rela outrel;
- Elf64_External_Rela *loc;
-
- /* We need to generate a R_PPC64_RELATIVE reloc
- for the dynamic linker. */
- outrel.r_offset = (htab->sgot->output_section->vma
- + htab->sgot->output_offset
- + off);
- outrel.r_info = ELF64_R_INFO (0, R_PPC64_RELATIVE);
- outrel.r_addend = relocation;
- loc = (Elf64_External_Rela *) htab->srelgot->contents;
- loc += htab->srelgot->reloc_count++;
- bfd_elf64_swap_reloca_out (output_bfd, &outrel, loc);
+ relocation -= htab->elf.tls_sec->vma + DTP_OFFSET;
+ if (tls_type == (TLS_TLS | TLS_TPREL))
+ relocation += DTP_OFFSET - TP_OFFSET;
+
+ if (tls_type == (TLS_TLS | TLS_GD))
+ {
+ bfd_put_64 (output_bfd, relocation,
+ got->contents + off + 8);
+ relocation = 1;
+ }
}
- local_got_offsets[r_symndx] |= 1;
+ bfd_put_64 (output_bfd, relocation,
+ got->contents + off);
}
}
if (off >= (bfd_vma) -2)
abort ();
- relocation = htab->sgot->output_offset + off;
+ relocation = got->output_offset + off;
/* TOC base (r2) is TOC start plus 0x8000. */
- addend -= TOC_BASE_OFF;
+ addend = -TOC_BASE_OFF;
}
break;
@@ -5624,21 +8244,38 @@ ppc64_elf_relocate_section (output_bfd, info, input_bfd, input_section,
if (h == NULL)
break;
- if (h->plt.offset == (bfd_vma) -1
- || htab->splt == NULL)
+ /* It's possible that we didn't make a PLT entry for this
+ symbol. This happens when statically linking PIC code,
+ or when using -Bsymbolic. Go find a match if there is a
+ PLT entry. */
+ if (htab->plt != NULL)
{
- /* We didn't make a PLT entry for this symbol. This
- happens when statically linking PIC code, or when
- using -Bsymbolic. */
- break;
+ struct plt_entry *ent;
+ for (ent = h->plt.plist; ent != NULL; ent = ent->next)
+ if (ent->addend == rel->r_addend
+ && ent->plt.offset != (bfd_vma) -1)
+ {
+ relocation = (htab->plt->output_section->vma
+ + htab->plt->output_offset
+ + ent->plt.offset);
+ unresolved_reloc = FALSE;
+ }
}
-
- relocation = (htab->splt->output_section->vma
- + htab->splt->output_offset
- + h->plt.offset);
- unresolved_reloc = false;
break;
+ case R_PPC64_TOC:
+ /* Relocation value is TOC base. */
+ relocation = TOCstart;
+ if (r_symndx == 0)
+ relocation += htab->stub_group[input_section->id].toc_off;
+ else if (unresolved_reloc)
+ ;
+ else if (sec != NULL && sec->id <= htab->top_id)
+ relocation += htab->stub_group[sec->id].toc_off;
+ else
+ unresolved_reloc = TRUE;
+ goto dodyn2;
+
/* TOC16 relocs. We want the offset relative to the TOC base,
which is the address of the start of the TOC plus 0x8000.
The TOC consists of sections .got, .toc, .tocbss, and .plt,
@@ -5649,7 +8286,7 @@ ppc64_elf_relocate_section (output_bfd, info, input_bfd, input_section,
case R_PPC64_TOC16_DS:
case R_PPC64_TOC16_LO_DS:
case R_PPC64_TOC16_HA:
- addend -= TOCstart + TOC_BASE_OFF;
+ addend -= TOCstart + htab->stub_group[input_section->id].toc_off;
break;
/* Relocate against the beginning of the section. */
@@ -5659,7 +8296,7 @@ ppc64_elf_relocate_section (output_bfd, info, input_bfd, input_section,
case R_PPC64_SECTOFF_DS:
case R_PPC64_SECTOFF_LO_DS:
case R_PPC64_SECTOFF_HA:
- if (sec != (asection *) 0)
+ if (sec != NULL)
addend -= sec->output_section->vma;
break;
@@ -5669,8 +8306,53 @@ ppc64_elf_relocate_section (output_bfd, info, input_bfd, input_section,
case R_PPC64_REL24:
break;
+ case R_PPC64_TPREL16:
+ case R_PPC64_TPREL16_LO:
+ case R_PPC64_TPREL16_HI:
+ case R_PPC64_TPREL16_HA:
+ case R_PPC64_TPREL16_DS:
+ case R_PPC64_TPREL16_LO_DS:
+ case R_PPC64_TPREL16_HIGHER:
+ case R_PPC64_TPREL16_HIGHERA:
+ case R_PPC64_TPREL16_HIGHEST:
+ case R_PPC64_TPREL16_HIGHESTA:
+ addend -= htab->elf.tls_sec->vma + TP_OFFSET;
+ if (info->shared)
+ /* The TPREL16 relocs shouldn't really be used in shared
+ libs as they will result in DT_TEXTREL being set, but
+ support them anyway. */
+ goto dodyn;
+ break;
+
+ case R_PPC64_DTPREL16:
+ case R_PPC64_DTPREL16_LO:
+ case R_PPC64_DTPREL16_HI:
+ case R_PPC64_DTPREL16_HA:
+ case R_PPC64_DTPREL16_DS:
+ case R_PPC64_DTPREL16_LO_DS:
+ case R_PPC64_DTPREL16_HIGHER:
+ case R_PPC64_DTPREL16_HIGHERA:
+ case R_PPC64_DTPREL16_HIGHEST:
+ case R_PPC64_DTPREL16_HIGHESTA:
+ addend -= htab->elf.tls_sec->vma + DTP_OFFSET;
+ break;
+
+ case R_PPC64_DTPMOD64:
+ relocation = 1;
+ addend = 0;
+ goto dodyn;
+
+ case R_PPC64_TPREL64:
+ addend -= htab->elf.tls_sec->vma + TP_OFFSET;
+ goto dodyn;
+
+ case R_PPC64_DTPREL64:
+ addend -= htab->elf.tls_sec->vma + DTP_OFFSET;
+ /* Fall thru */
+
/* Relocations that may need to be propagated if this is a
dynamic object. */
+ case R_PPC64_REL30:
case R_PPC64_REL32:
case R_PPC64_REL64:
case R_PPC64_ADDR14:
@@ -5687,7 +8369,6 @@ ppc64_elf_relocate_section (output_bfd, info, input_bfd, input_section,
case R_PPC64_ADDR16_LO:
case R_PPC64_ADDR16_LO_DS:
case R_PPC64_ADDR24:
- case R_PPC64_ADDR30:
case R_PPC64_ADDR32:
case R_PPC64_ADDR64:
case R_PPC64_UADDR16:
@@ -5696,11 +8377,12 @@ ppc64_elf_relocate_section (output_bfd, info, input_bfd, input_section,
/* 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. */
- case R_PPC64_TOC:
+ dodyn2:
if ((input_section->flags & SEC_ALLOC) == 0)
break;
@@ -5708,56 +8390,59 @@ ppc64_elf_relocate_section (output_bfd, info, input_bfd, input_section,
break;
if ((info->shared
- && (IS_ABSOLUTE_RELOC (r_type)
- || (h != NULL
- && h->dynindx != -1
- && (! info->symbolic
- || (h->elf_link_hash_flags
- & ELF_LINK_HASH_DEF_REGULAR) == 0))))
- || (!info->shared
+ && (h == NULL
+ || ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
+ || h->root.type != bfd_link_hash_undefweak)
+ && (MUST_BE_DYN_RELOC (r_type)
+ || !SYMBOL_CALLS_LOCAL (info, h)))
+ || (ELIMINATE_COPY_RELOCS
+ && !info->shared
&& h != NULL
&& h->dynindx != -1
&& (h->elf_link_hash_flags & ELF_LINK_NON_GOT_REF) == 0
- && (((h->elf_link_hash_flags
- & ELF_LINK_HASH_DEF_DYNAMIC) != 0
- && (h->elf_link_hash_flags
- & ELF_LINK_HASH_DEF_REGULAR) == 0)
- || h->root.type == bfd_link_hash_undefweak
- || h->root.type == bfd_link_hash_undefined)))
+ && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) != 0
+ && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0))
{
Elf_Internal_Rela outrel;
- boolean skip, relocate;
+ bfd_boolean skip, relocate;
asection *sreloc;
- Elf64_External_Rela *loc;
+ bfd_byte *loc;
+ bfd_vma out_off;
/* When generating a dynamic object, these relocations
are copied into the output file to be resolved at run
time. */
- skip = false;
- relocate = false;
-
- 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);
- outrel.r_addend = addend;
+ skip = FALSE;
+ relocate = FALSE;
+
+ out_off = _bfd_elf_section_offset (output_bfd, info,
+ input_section, rel->r_offset);
+ if (out_off == (bfd_vma) -1)
+ skip = TRUE;
+ else if (out_off == (bfd_vma) -2)
+ skip = TRUE, relocate = TRUE;
+ out_off += (input_section->output_section->vma
+ + input_section->output_offset);
+ outrel.r_offset = out_off;
+ outrel.r_addend = rel->r_addend;
+
+ /* Optimize unaligned reloc use. */
+ if ((r_type == R_PPC64_ADDR64 && (out_off & 7) != 0)
+ || (r_type == R_PPC64_UADDR64 && (out_off & 7) == 0))
+ r_type ^= R_PPC64_ADDR64 ^ R_PPC64_UADDR64;
+ else if ((r_type == R_PPC64_ADDR32 && (out_off & 3) != 0)
+ || (r_type == R_PPC64_UADDR32 && (out_off & 3) == 0))
+ r_type ^= R_PPC64_ADDR32 ^ R_PPC64_UADDR32;
+ else if ((r_type == R_PPC64_ADDR16 && (out_off & 1) != 0)
+ || (r_type == R_PPC64_UADDR16 && (out_off & 1) == 0))
+ r_type ^= R_PPC64_ADDR16 ^ R_PPC64_UADDR16;
if (skip)
memset (&outrel, 0, sizeof outrel);
- else if (h != NULL
- && h->dynindx != -1
+ else if (!SYMBOL_REFERENCES_LOCAL (info, h)
&& !is_opd
- && (!IS_ABSOLUTE_RELOC (r_type)
- || !info->shared
- || !info->symbolic
- || (h->elf_link_hash_flags
- & ELF_LINK_HASH_DEF_REGULAR) == 0))
+ && r_type != R_PPC64_TOC)
outrel.r_info = ELF64_R_INFO (h->dynindx, r_type);
else
{
@@ -5765,7 +8450,6 @@ ppc64_elf_relocate_section (output_bfd, info, input_bfd, input_section,
or this is an opd section reloc which must point
at a local function. */
outrel.r_addend += relocation;
- relocate = true;
if (r_type == R_PPC64_ADDR64 || r_type == R_PPC64_TOC)
{
if (is_opd && h != NULL)
@@ -5780,9 +8464,15 @@ ppc64_elf_relocate_section (output_bfd, info, input_bfd, input_section,
bug in binutils handling of weak syms.)
In these cases we won't use the opd
entry in this lib. */
- unresolved_reloc = false;
+ unresolved_reloc = FALSE;
}
outrel.r_info = ELF64_R_INFO (0, R_PPC64_RELATIVE);
+
+ /* We need to relocate .opd contents for ld.so.
+ Prelink also wants simple and consistent rules
+ for relocs. This make all RELATIVE relocs have
+ *r_offset equal to r_addend. */
+ relocate = TRUE;
}
else
{
@@ -5793,7 +8483,7 @@ ppc64_elf_relocate_section (output_bfd, info, input_bfd, input_section,
else if (sec == NULL || sec->owner == NULL)
{
bfd_set_error (bfd_error_bad_value);
- return false;
+ return FALSE;
}
else
{
@@ -5818,15 +8508,35 @@ ppc64_elf_relocate_section (output_bfd, info, input_bfd, input_section,
if (sreloc == NULL)
abort ();
- loc = (Elf64_External_Rela *) sreloc->contents;
- loc += sreloc->reloc_count++;
+ loc = sreloc->contents;
+ loc += sreloc->reloc_count++ * sizeof (Elf64_External_Rela);
bfd_elf64_swap_reloca_out (output_bfd, &outrel, loc);
/* If this reloc is against an external symbol, it will
be computed at runtime, so there's no need to do
- anything now. */
+ anything now. However, for the sake of prelink ensure
+ that the section contents are a known value. */
if (! relocate)
- continue;
+ {
+ unresolved_reloc = FALSE;
+ /* The value chosen here is quite arbitrary as ld.so
+ ignores section contents except for the special
+ case of .opd where the contents might be accessed
+ before relocation. Choose zero, as that won't
+ cause reloc overflow. */
+ relocation = 0;
+ addend = 0;
+ /* Use *r_offset == r_addend for R_PPC64_ADDR64 relocs
+ to improve backward compatibility with older
+ versions of ld. */
+ if (r_type == R_PPC64_ADDR64)
+ addend = outrel.r_addend;
+ /* Adjust pc_relative relocs to have zero in *r_offset. */
+ else if (ppc64_elf_howto_table[r_type]->pc_relative)
+ addend = (input_section->output_section->vma
+ + input_section->output_offset
+ + rel->r_offset);
+ }
}
break;
@@ -5836,7 +8546,7 @@ ppc64_elf_relocate_section (output_bfd, info, input_bfd, input_section,
case R_PPC64_RELATIVE:
/* We shouldn't ever see these dynamic relocs in relocatable
files. */
- /* Fall thru */
+ /* Fall through. */
case R_PPC64_PLTGOT16:
case R_PPC64_PLTGOT16_DS:
@@ -5849,12 +8559,12 @@ ppc64_elf_relocate_section (output_bfd, info, input_bfd, input_section,
/* These ones haven't been implemented yet. */
(*_bfd_error_handler)
- (_("%s: Relocation %s is not supported for symbol %s."),
+ (_("%s: relocation %s is not supported for symbol %s."),
bfd_archive_filename (input_bfd),
- ppc64_elf_howto_table[(int) r_type]->name, sym_name);
+ ppc64_elf_howto_table[r_type]->name, sym_name);
bfd_set_error (bfd_error_invalid_operation);
- ret = false;
+ ret = FALSE;
continue;
}
@@ -5867,16 +8577,33 @@ ppc64_elf_relocate_section (output_bfd, info, input_bfd, input_section,
case R_PPC64_ADDR16_HA:
case R_PPC64_ADDR16_HIGHERA:
case R_PPC64_ADDR16_HIGHESTA:
+ case R_PPC64_GOT16_HA:
+ case R_PPC64_PLTGOT16_HA:
case R_PPC64_PLT16_HA:
case R_PPC64_TOC16_HA:
case R_PPC64_SECTOFF_HA:
+ case R_PPC64_TPREL16_HA:
+ case R_PPC64_DTPREL16_HA:
+ case R_PPC64_GOT_TLSGD16_HA:
+ case R_PPC64_GOT_TLSLD16_HA:
+ case R_PPC64_GOT_TPREL16_HA:
+ case R_PPC64_GOT_DTPREL16_HA:
+ case R_PPC64_TPREL16_HIGHER:
+ case R_PPC64_TPREL16_HIGHERA:
+ case R_PPC64_TPREL16_HIGHEST:
+ case R_PPC64_TPREL16_HIGHESTA:
+ case R_PPC64_DTPREL16_HIGHER:
+ case R_PPC64_DTPREL16_HIGHERA:
+ case R_PPC64_DTPREL16_HIGHEST:
+ case R_PPC64_DTPREL16_HIGHESTA:
/* It's just possible that this symbol is a weak symbol
that's not actually defined anywhere. In that case,
'sec' would be NULL, and we should leave the symbol
alone (it will be set to zero elsewhere in the link). */
if (sec != NULL)
- /* Add 0x10000 if sign bit in 0:15 is set. */
- addend += ((relocation + addend) & 0x8000) << 1;
+ /* Add 0x10000 if sign bit in 0:15 is set.
+ Bits 0:15 are not used. */
+ addend += 0x8000;
break;
case R_PPC64_ADDR16_DS:
@@ -5890,14 +8617,33 @@ ppc64_elf_relocate_section (output_bfd, info, input_bfd, input_section,
case R_PPC64_TOC16_LO_DS:
case R_PPC64_PLTGOT16_DS:
case R_PPC64_PLTGOT16_LO_DS:
- if (((relocation + addend) & 3) != 0)
+ case R_PPC64_GOT_TPREL16_DS:
+ case R_PPC64_GOT_TPREL16_LO_DS:
+ case R_PPC64_GOT_DTPREL16_DS:
+ case R_PPC64_GOT_DTPREL16_LO_DS:
+ case R_PPC64_TPREL16_DS:
+ case R_PPC64_TPREL16_LO_DS:
+ case R_PPC64_DTPREL16_DS:
+ case R_PPC64_DTPREL16_LO_DS:
+ insn = bfd_get_32 (input_bfd, contents + (rel->r_offset & ~3));
+ mask = 3;
+ /* If this reloc is against an lq insn, then the value must be
+ a multiple of 16. This is somewhat of a hack, but the
+ "correct" way to do this by defining _DQ forms of all the
+ _DS relocs bloats all reloc switches in this file. It
+ doesn't seem to make much sense to use any of these relocs
+ in data, so testing the insn should be safe. */
+ if ((insn & (0x3f << 26)) == (56u << 26))
+ mask = 15;
+ if (((relocation + addend) & mask) != 0)
{
(*_bfd_error_handler)
- (_("%s: error: relocation %s not a multiple of 4"),
+ (_("%s: error: relocation %s not a multiple of %d"),
bfd_archive_filename (input_bfd),
- ppc64_elf_howto_table[(int) r_type]->name);
+ ppc64_elf_howto_table[r_type]->name,
+ mask + 1);
bfd_set_error (bfd_error_bad_value);
- ret = false;
+ ret = FALSE;
continue;
}
break;
@@ -5912,12 +8658,18 @@ ppc64_elf_relocate_section (output_bfd, info, input_bfd, input_section,
max_br_offset = 1 << 25;
branch_check:
- /* If the branch is out of reach, then redirect the
- call to the local stub for this function. */
- from = (offset
+ /* 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
+ 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)
{
@@ -5939,30 +8691,34 @@ ppc64_elf_relocate_section (output_bfd, info, input_bfd, input_section,
&& (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) != 0))
{
(*_bfd_error_handler)
- (_("%s(%s+0x%lx): unresolvable relocation against symbol `%s'"),
+ (_("%s(%s+0x%lx): unresolvable %s relocation against symbol `%s'"),
bfd_archive_filename (input_bfd),
bfd_get_section_name (input_bfd, input_section),
(long) rel->r_offset,
+ ppc64_elf_howto_table[(int) r_type]->name,
h->root.root.string);
- ret = false;
+ ret = FALSE;
}
r = _bfd_final_link_relocate (ppc64_elf_howto_table[(int) r_type],
input_bfd,
input_section,
contents,
- offset,
+ rel->r_offset,
relocation,
addend);
if (r != bfd_reloc_ok)
{
- const char *name;
-
- if (h != NULL)
+ if (sym_name == NULL)
+ sym_name = "(null)";
+ if (r == bfd_reloc_overflow)
{
- if (h->root.type == bfd_link_hash_undefweak
- && ppc64_elf_howto_table[(int) r_type]->pc_relative)
+ if (warned)
+ continue;
+ if (h != NULL
+ && h->root.type == bfd_link_hash_undefweak
+ && ppc64_elf_howto_table[r_type]->pc_relative)
{
/* Assume this is a call protected by other code that
detects the symbol is undefined. If this is the case,
@@ -5973,36 +8729,22 @@ ppc64_elf_relocate_section (output_bfd, info, input_bfd, input_section,
continue;
}
- 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)
- continue;
- if (*name == '\0')
- name = bfd_section_name (input_bfd, sec);
- }
-
- if (r == bfd_reloc_overflow)
- {
- if (warned)
- continue;
if (!((*info->callbacks->reloc_overflow)
- (info, name, ppc64_elf_howto_table[(int) r_type]->name,
- rel->r_addend, input_bfd, input_section, offset)))
- return false;
+ (info, sym_name, ppc64_elf_howto_table[r_type]->name,
+ rel->r_addend, input_bfd, input_section, rel->r_offset)))
+ return FALSE;
}
else
{
(*_bfd_error_handler)
- (_("%s(%s+0x%lx): reloc against `%s': error %d"),
+ (_("%s(%s+0x%lx): %s reloc against `%s': error %d"),
bfd_archive_filename (input_bfd),
bfd_get_section_name (input_bfd, input_section),
- (long) rel->r_offset, name, (int) r);
- ret = false;
+ (long) rel->r_offset,
+ ppc64_elf_howto_table[r_type]->name,
+ sym_name,
+ (int) r);
+ ret = FALSE;
}
}
}
@@ -6010,15 +8752,40 @@ ppc64_elf_relocate_section (output_bfd, info, input_bfd, input_section,
return ret;
}
+/* Adjust the value of any local symbols in opd sections. */
+
+static bfd_boolean
+ppc64_elf_output_symbol_hook (struct bfd_link_info *info,
+ const char *name ATTRIBUTE_UNUSED,
+ Elf_Internal_Sym *elfsym,
+ asection *input_sec,
+ struct elf_link_hash_entry *h)
+{
+ long *adjust;
+ bfd_vma value;
+
+ if (h != NULL
+ || input_sec == NULL
+ || ppc64_elf_section_data (input_sec) == NULL
+ || (adjust = ppc64_elf_section_data (input_sec)->opd.adjust) == NULL)
+ return TRUE;
+
+ value = elfsym->st_value - input_sec->output_offset;
+ if (!info->relocatable)
+ value -= input_sec->output_section->vma;
+
+ elfsym->st_value += adjust[value / 24];
+ return TRUE;
+}
+
/* Finish up dynamic symbol handling. We set the contents of various
dynamic sections here. */
-static boolean
-ppc64_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;
+static bfd_boolean
+ppc64_elf_finish_dynamic_symbol (bfd *output_bfd,
+ struct bfd_link_info *info,
+ struct elf_link_hash_entry *h,
+ Elf_Internal_Sym *sym)
{
struct ppc_link_hash_table *htab;
bfd *dynobj;
@@ -6026,91 +8793,49 @@ ppc64_elf_finish_dynamic_symbol (output_bfd, info, h, sym)
htab = ppc_hash_table (info);
dynobj = htab->elf.dynobj;
- if (h->plt.offset != (bfd_vma) -1
- && ((struct ppc_link_hash_entry *) h)->is_func_descriptor)
- {
- Elf_Internal_Rela rela;
- Elf64_External_Rela *loc;
-
- /* This symbol has an entry in the procedure linkage table. Set
- it up. */
-
- if (htab->splt == NULL
- || htab->srelplt == NULL
- || htab->sglink == NULL)
- abort ();
-
- /* Create a JMP_SLOT reloc to inform the dynamic linker to
- fill in the PLT entry. */
-
- rela.r_offset = (htab->splt->output_section->vma
- + htab->splt->output_offset
- + h->plt.offset);
- rela.r_info = ELF64_R_INFO (h->dynindx, R_PPC64_JMP_SLOT);
- rela.r_addend = 0;
-
- loc = (Elf64_External_Rela *) htab->srelplt->contents;
- loc += (h->plt.offset - PLT_INITIAL_ENTRY_SIZE) / PLT_ENTRY_SIZE;
- bfd_elf64_swap_reloca_out (output_bfd, &rela, loc);
- }
-
- if (h->got.offset != (bfd_vma) -1)
+ if (((struct ppc_link_hash_entry *) h)->is_func_descriptor)
{
+ struct plt_entry *ent;
Elf_Internal_Rela rela;
- Elf64_External_Rela *loc;
+ bfd_byte *loc;
- /* This symbol has an entry in the global offset table. Set it
- up. */
-
- if (htab->sgot == NULL || htab->srelgot == NULL)
- abort ();
+ 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. */
- rela.r_offset = (htab->sgot->output_section->vma
- + htab->sgot->output_offset
- + (h->got.offset &~ (bfd_vma) 1));
-
- /* If this is a static link, or it is a -Bsymbolic link and the
- symbol is defined locally or was forced to be local because
- of a version file, we just want to emit a RELATIVE reloc.
- The entry in the global offset table will already have been
- initialized in the relocate_section function. */
- if (info->shared
- && (info->symbolic
- || h->dynindx == -1
- || (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL))
- && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR))
- {
- BFD_ASSERT((h->got.offset & 1) != 0);
- rela.r_info = ELF64_R_INFO (0, R_PPC64_RELATIVE);
- rela.r_addend = (h->root.u.def.value
- + h->root.u.def.section->output_section->vma
- + h->root.u.def.section->output_offset);
- }
- else
- {
- BFD_ASSERT ((h->got.offset & 1) == 0);
- bfd_put_64 (output_bfd, (bfd_vma) 0,
- htab->sgot->contents + h->got.offset);
- rela.r_info = ELF64_R_INFO (h->dynindx, R_PPC64_GLOB_DAT);
- rela.r_addend = 0;
- }
+ if (htab->plt == NULL
+ || htab->relplt == NULL
+ || htab->glink == NULL)
+ abort ();
- loc = (Elf64_External_Rela *) htab->srelgot->contents;
- loc += htab->srelgot->reloc_count++;
- bfd_elf64_swap_reloca_out (output_bfd, &rela, loc);
+ /* Create a JMP_SLOT reloc to inform the dynamic linker to
+ fill in the PLT entry. */
+ rela.r_offset = (htab->plt->output_section->vma
+ + htab->plt->output_offset
+ + ent->plt.offset);
+ rela.r_info = ELF64_R_INFO (h->dynindx, R_PPC64_JMP_SLOT);
+ rela.r_addend = ent->addend;
+
+ loc = htab->relplt->contents;
+ loc += ((ent->plt.offset - PLT_INITIAL_ENTRY_SIZE) / PLT_ENTRY_SIZE
+ * sizeof (Elf64_External_Rela));
+ bfd_elf64_swap_reloca_out (output_bfd, &rela, loc);
+ }
}
if ((h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_COPY) != 0)
{
Elf_Internal_Rela rela;
- Elf64_External_Rela *loc;
+ bfd_byte *loc;
/* This symbol needs a copy reloc. Set it up. */
if (h->dynindx == -1
|| (h->root.type != bfd_link_hash_defined
&& h->root.type != bfd_link_hash_defweak)
- || htab->srelbss == NULL)
+ || htab->relbss == NULL)
abort ();
rela.r_offset = (h->root.u.def.value
@@ -6118,8 +8843,8 @@ ppc64_elf_finish_dynamic_symbol (output_bfd, info, h, sym)
+ h->root.u.def.section->output_offset);
rela.r_info = ELF64_R_INFO (h->dynindx, R_PPC64_COPY);
rela.r_addend = 0;
- loc = (Elf64_External_Rela *) htab->srelbss->contents;
- loc += htab->srelbss->reloc_count++;
+ loc = htab->relbss->contents;
+ loc += htab->relbss->reloc_count++ * sizeof (Elf64_External_Rela);
bfd_elf64_swap_reloca_out (output_bfd, &rela, loc);
}
@@ -6127,19 +8852,18 @@ ppc64_elf_finish_dynamic_symbol (output_bfd, info, h, sym)
if (strcmp (h->root.root.string, "_DYNAMIC") == 0)
sym->st_shndx = SHN_ABS;
- return true;
+ return TRUE;
}
/* Used to decide how to sort relocs in an optimal manner for the
dynamic linker, before writing them out. */
static enum elf_reloc_type_class
-ppc64_elf_reloc_type_class (rela)
- const Elf_Internal_Rela *rela;
+ppc64_elf_reloc_type_class (const Elf_Internal_Rela *rela)
{
- enum elf_ppc_reloc_type r_type;
+ enum elf_ppc64_reloc_type r_type;
- r_type = (enum elf_ppc_reloc_type) ELF64_R_TYPE (rela->r_info);
+ r_type = ELF64_R_TYPE (rela->r_info);
switch (r_type)
{
case R_PPC64_RELATIVE:
@@ -6155,10 +8879,9 @@ ppc64_elf_reloc_type_class (rela)
/* Finish up the dynamic sections. */
-static boolean
-ppc64_elf_finish_dynamic_sections (output_bfd, info)
- bfd *output_bfd;
- struct bfd_link_info *info;
+static bfd_boolean
+ppc64_elf_finish_dynamic_sections (bfd *output_bfd,
+ struct bfd_link_info *info)
{
struct ppc_link_hash_table *htab;
bfd *dynobj;
@@ -6172,7 +8895,7 @@ ppc64_elf_finish_dynamic_sections (output_bfd, info)
{
Elf64_External_Dyn *dyncon, *dynconend;
- if (sdyn == NULL || htab->sgot == NULL)
+ if (sdyn == NULL || htab->got == NULL)
abort ();
dyncon = (Elf64_External_Dyn *) sdyn->contents;
@@ -6190,41 +8913,62 @@ ppc64_elf_finish_dynamic_sections (output_bfd, info)
continue;
case DT_PPC64_GLINK:
- dyn.d_un.d_ptr = (htab->sglink->output_section->vma
- + htab->sglink->output_offset);
+ s = htab->glink;
+ dyn.d_un.d_ptr = s->output_section->vma + s->output_offset;
+ /* We stupidly defined DT_PPC64_GLINK to be the start
+ of glink rather than the first entry point, which is
+ what ld.so needs, and now have a bigger stub to
+ support automatic multiple TOCs. */
+ dyn.d_un.d_ptr += GLINK_CALL_STUB_SIZE - 32;
break;
case DT_PPC64_OPD:
s = bfd_get_section_by_name (output_bfd, ".opd");
- if (s != NULL)
- dyn.d_un.d_ptr = s->vma;
+ if (s == NULL)
+ continue;
+ dyn.d_un.d_ptr = s->vma;
break;
case DT_PPC64_OPDSZ:
s = bfd_get_section_by_name (output_bfd, ".opd");
- if (s != NULL)
- dyn.d_un.d_val = s->_raw_size;
+ if (s == NULL)
+ continue;
+ dyn.d_un.d_val = s->_raw_size;
break;
case DT_PLTGOT:
- dyn.d_un.d_ptr = (htab->splt->output_section->vma
- + htab->splt->output_offset);
+ s = htab->plt;
+ dyn.d_un.d_ptr = s->output_section->vma + s->output_offset;
break;
case DT_JMPREL:
- dyn.d_un.d_ptr = (htab->srelplt->output_section->vma
- + htab->srelplt->output_offset);
+ s = htab->relplt;
+ dyn.d_un.d_ptr = s->output_section->vma + s->output_offset;
break;
case DT_PLTRELSZ:
- dyn.d_un.d_val = htab->srelplt->_raw_size;
+ dyn.d_un.d_val = htab->relplt->_raw_size;
break;
case DT_RELASZ:
/* Don't count procedure linkage table relocs in the
overall reloc count. */
- if (htab->srelplt != NULL)
- dyn.d_un.d_val -= htab->srelplt->_raw_size;
+ s = htab->relplt;
+ if (s == NULL)
+ continue;
+ dyn.d_un.d_val -= s->_raw_size;
+ break;
+
+ case DT_RELA:
+ /* We may not be using the standard ELF linker script.
+ If .rela.plt is the first .rela section, we adjust
+ DT_RELA to not include it. */
+ s = htab->relplt;
+ if (s == NULL)
+ continue;
+ if (dyn.d_un.d_ptr != s->output_section->vma + s->output_offset)
+ continue;
+ dyn.d_un.d_ptr += s->_raw_size;
break;
}
@@ -6232,74 +8976,49 @@ ppc64_elf_finish_dynamic_sections (output_bfd, info)
}
}
- if (htab->sgot != NULL && htab->sgot->_raw_size != 0)
+ if (htab->got != NULL && htab->got->_raw_size != 0)
{
/* Fill in the first entry in the global offset table.
We use it to hold the link-time TOCbase. */
bfd_put_64 (output_bfd,
elf_gp (output_bfd) + TOC_BASE_OFF,
- htab->sgot->contents);
+ htab->got->contents);
/* Set .got entry size. */
- elf_section_data (htab->sgot->output_section)->this_hdr.sh_entsize = 8;
+ elf_section_data (htab->got->output_section)->this_hdr.sh_entsize = 8;
}
- if (htab->splt != NULL && htab->splt->_raw_size != 0)
+ if (htab->plt != NULL && htab->plt->_raw_size != 0)
{
/* Set .plt entry size. */
- elf_section_data (htab->splt->output_section)->this_hdr.sh_entsize
+ elf_section_data (htab->plt->output_section)->this_hdr.sh_entsize
= PLT_ENTRY_SIZE;
}
- return true;
-}
-
-#define TARGET_LITTLE_SYM bfd_elf64_powerpcle_vec
-#define TARGET_LITTLE_NAME "elf64-powerpcle"
-#define TARGET_BIG_SYM bfd_elf64_powerpc_vec
-#define TARGET_BIG_NAME "elf64-powerpc"
-#define ELF_ARCH bfd_arch_powerpc
-#define ELF_MACHINE_CODE EM_PPC64
-#define ELF_MAXPAGESIZE 0x10000
-#define elf_info_to_howto ppc64_elf_info_to_howto
-
-#ifdef EM_CYGNUS_POWERPC
-#define ELF_MACHINE_ALT1 EM_CYGNUS_POWERPC
-#endif
-
-#ifdef EM_PPC_OLD
-#define ELF_MACHINE_ALT2 EM_PPC_OLD
-#endif
-
-#define elf_backend_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_plt_header_size PLT_INITIAL_ENTRY_SIZE
-#define elf_backend_can_gc_sections 1
-#define elf_backend_can_refcount 1
-#define elf_backend_rela_normal 1
-
-#define bfd_elf64_bfd_reloc_type_lookup ppc64_elf_reloc_type_lookup
-#define bfd_elf64_bfd_merge_private_bfd_data ppc64_elf_merge_private_bfd_data
-#define bfd_elf64_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
+ /* We need to handle writing out multiple GOT sections ourselves,
+ since we didn't add them to DYNOBJ. */
+ while ((dynobj = dynobj->link_next) != NULL)
+ {
+ asection *s;
+ s = ppc64_elf_tdata (dynobj)->got;
+ if (s != NULL
+ && s->_raw_size != 0
+ && s->output_section != bfd_abs_section_ptr
+ && !bfd_set_section_contents (output_bfd, s->output_section,
+ s->contents, s->output_offset,
+ s->_raw_size))
+ return FALSE;
+ s = ppc64_elf_tdata (dynobj)->relgot;
+ if (s != NULL
+ && s->_raw_size != 0
+ && s->output_section != bfd_abs_section_ptr
+ && !bfd_set_section_contents (output_bfd, s->output_section,
+ s->contents, s->output_offset,
+ s->_raw_size))
+ return FALSE;
+ }
-#define elf_backend_object_p ppc64_elf_object_p
-#define elf_backend_create_dynamic_sections ppc64_elf_create_dynamic_sections
-#define elf_backend_copy_indirect_symbol ppc64_elf_copy_indirect_symbol
-#define elf_backend_check_relocs ppc64_elf_check_relocs
-#define elf_backend_gc_mark_hook ppc64_elf_gc_mark_hook
-#define elf_backend_gc_sweep_hook ppc64_elf_gc_sweep_hook
-#define elf_backend_adjust_dynamic_symbol ppc64_elf_adjust_dynamic_symbol
-#define elf_backend_hide_symbol ppc64_elf_hide_symbol
-#define elf_backend_always_size_sections ppc64_elf_func_desc_adjust
-#define elf_backend_size_dynamic_sections ppc64_elf_size_dynamic_sections
-#define elf_backend_relocate_section ppc64_elf_relocate_section
-#define elf_backend_finish_dynamic_symbol ppc64_elf_finish_dynamic_symbol
-#define elf_backend_reloc_type_class ppc64_elf_reloc_type_class
-#define elf_backend_finish_dynamic_sections ppc64_elf_finish_dynamic_sections
+ return TRUE;
+}
#include "elf64-target.h"
diff --git a/contrib/binutils/bfd/elf64-ppc.h b/contrib/binutils/bfd/elf64-ppc.h
index cabc388..998e7e1 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 Free Software Foundation, Inc.
+ Copyright 2002, 2003 Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@@ -17,16 +17,28 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-boolean ppc64_elf_mark_entry_syms
- PARAMS ((struct bfd_link_info *));
+void ppc64_elf_init_stub_bfd
+ (bfd *, struct bfd_link_info *);
+bfd_boolean ppc64_elf_mark_entry_syms
+ (struct bfd_link_info *);
+bfd_boolean ppc64_elf_edit_opd
+ (bfd *, struct bfd_link_info *);
+asection *ppc64_elf_tls_setup
+ (bfd *, struct bfd_link_info *);
+bfd_boolean ppc64_elf_tls_optimize
+ (bfd *, struct bfd_link_info *);
bfd_vma ppc64_elf_toc
- PARAMS ((bfd *));
+ (bfd *);
int ppc64_elf_setup_section_lists
- PARAMS ((bfd *, struct bfd_link_info *));
-void ppc64_elf_next_input_section
- PARAMS ((struct bfd_link_info *, asection *));
-boolean ppc64_elf_size_stubs
- PARAMS ((bfd *, bfd *, struct bfd_link_info *, bfd_signed_vma,
- asection *(*) (const char *, asection *), void (*) (void)));
-boolean ppc64_elf_build_stubs
- PARAMS ((struct bfd_link_info *));
+ (bfd *, struct bfd_link_info *);
+void ppc64_elf_next_toc_section
+ (struct bfd_link_info *, asection *);
+void ppc64_elf_reinit_toc
+ (bfd *, struct bfd_link_info *);
+bfd_boolean ppc64_elf_next_input_section
+ (struct bfd_link_info *, asection *);
+bfd_boolean ppc64_elf_size_stubs
+ (bfd *, struct bfd_link_info *, bfd_signed_vma,
+ asection *(*) (const char *, asection *), void (*) (void));
+bfd_boolean ppc64_elf_build_stubs
+ (bfd_boolean, struct bfd_link_info *, char **);
diff --git a/contrib/binutils/bfd/elf64-s390.c b/contrib/binutils/bfd/elf64-s390.c
index 5ad1ca7..63a261a 100644
--- a/contrib/binutils/bfd/elf64-s390.c
+++ b/contrib/binutils/bfd/elf64-s390.c
@@ -1,5 +1,5 @@
/* IBM S/390-specific support for 64-bit ELF
- Copyright 2000, 2001, 2002 Free Software Foundation, Inc.
+ Copyright 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
Contributed Martin Schwidefsky (schwidefsky@de.ibm.com).
This file is part of BFD, the Binary File Descriptor library.
@@ -29,49 +29,65 @@ static reloc_howto_type *elf_s390_reloc_type_lookup
PARAMS ((bfd *, bfd_reloc_code_real_type));
static void elf_s390_info_to_howto
PARAMS ((bfd *, arelent *, Elf_Internal_Rela *));
-static boolean elf_s390_is_local_label_name
+static bfd_boolean elf_s390_is_local_label_name
PARAMS ((bfd *, const char *));
static struct bfd_hash_entry *link_hash_newfunc
PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, const char *));
static struct bfd_link_hash_table *elf_s390_link_hash_table_create
PARAMS ((bfd *));
-static boolean create_got_section
+static bfd_boolean create_got_section
PARAMS((bfd *, struct bfd_link_info *));
-static boolean elf_s390_create_dynamic_sections
+static bfd_boolean elf_s390_create_dynamic_sections
PARAMS((bfd *, struct bfd_link_info *));
static void elf_s390_copy_indirect_symbol
- PARAMS ((struct elf_backend_data *, struct elf_link_hash_entry *,
+ PARAMS ((const struct elf_backend_data *, struct elf_link_hash_entry *,
struct elf_link_hash_entry *));
-static boolean elf_s390_check_relocs
+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 boolean elf_s390_gc_sweep_hook
+static bfd_boolean elf_s390_gc_sweep_hook
PARAMS ((bfd *, struct bfd_link_info *, asection *,
const Elf_Internal_Rela *));
-static boolean elf_s390_adjust_dynamic_symbol
+struct elf_s390_link_hash_entry;
+static void elf_s390_adjust_gotplt
+ PARAMS ((struct elf_s390_link_hash_entry *));
+static bfd_boolean elf_s390_adjust_dynamic_symbol
PARAMS ((struct bfd_link_info *, struct elf_link_hash_entry *));
-static boolean allocate_dynrelocs
+static bfd_boolean allocate_dynrelocs
PARAMS ((struct elf_link_hash_entry *, PTR));
-static boolean readonly_dynrelocs
+static bfd_boolean readonly_dynrelocs
PARAMS ((struct elf_link_hash_entry *, PTR));
-static boolean elf_s390_size_dynamic_sections
+static bfd_boolean elf_s390_size_dynamic_sections
PARAMS ((bfd *, struct bfd_link_info *));
-static boolean elf_s390_relocate_section
+static bfd_boolean elf_s390_relocate_section
PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *,
Elf_Internal_Rela *, Elf_Internal_Sym *, asection **));
-static boolean elf_s390_finish_dynamic_symbol
+static bfd_boolean elf_s390_finish_dynamic_symbol
PARAMS ((bfd *, struct bfd_link_info *, struct elf_link_hash_entry *,
Elf_Internal_Sym *));
static enum elf_reloc_type_class elf_s390_reloc_type_class
PARAMS ((const Elf_Internal_Rela *));
-static boolean elf_s390_finish_dynamic_sections
+static bfd_boolean elf_s390_finish_dynamic_sections
PARAMS ((bfd *, struct bfd_link_info *));
-static boolean elf_s390_object_p PARAMS ((bfd *));
-
-#define USE_RELA 1 /* We want RELA relocations, not REL. */
+static bfd_boolean elf_s390_mkobject
+ PARAMS ((bfd *));
+static bfd_boolean elf_s390_object_p
+ PARAMS ((bfd *));
+static int elf_s390_tls_transition
+ PARAMS ((struct bfd_link_info *, int, int));
+static bfd_reloc_status_type s390_tls_reloc
+ PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
+static bfd_vma dtpoff_base
+ PARAMS ((struct bfd_link_info *));
+static bfd_vma tpoff
+ PARAMS ((struct bfd_link_info *, bfd_vma));
+static void invalid_tls_insn
+ PARAMS ((bfd *, asection *, Elf_Internal_Rela *));
+static bfd_reloc_status_type s390_elf_ldisp_reloc
+ PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
#include "elf/s390.h"
@@ -86,49 +102,137 @@ static reloc_howto_type elf_howto_table[] =
0, /* rightshift */
0, /* size (0 = byte, 1 = short, 2 = long) */
0, /* bitsize */
- false, /* pc_relative */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_390_NONE", /* name */
- false, /* partial_inplace */
+ FALSE, /* partial_inplace */
0, /* src_mask */
0, /* dst_mask */
- false), /* pcrel_offset */
-
- HOWTO(R_390_8, 0, 0, 8, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_390_8", false, 0,0x000000ff, false),
- HOWTO(R_390_12, 0, 1, 12, false, 0, complain_overflow_dont, bfd_elf_generic_reloc, "R_390_12", false, 0,0x00000fff, false),
- HOWTO(R_390_16, 0, 1, 16, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_390_16", false, 0,0x0000ffff, false),
- HOWTO(R_390_32, 0, 2, 32, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_390_32", false, 0,0xffffffff, false),
- HOWTO(R_390_PC32, 0, 2, 32, true, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_390_PC32", false, 0,0xffffffff, true),
- HOWTO(R_390_GOT12, 0, 1, 12, false, 0, complain_overflow_dont, bfd_elf_generic_reloc, "R_390_GOT12", false, 0,0x00000fff, false),
- HOWTO(R_390_GOT32, 0, 2, 32, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_390_GOT32", false, 0,0xffffffff, false),
- HOWTO(R_390_PLT32, 0, 2, 32, true, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_390_PLT32", false, 0,0xffffffff, true),
- HOWTO(R_390_COPY, 0, 4, 64, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_390_COPY", false, 0,MINUS_ONE, false),
- HOWTO(R_390_GLOB_DAT, 0, 4, 64, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_390_GLOB_DAT",false, 0,MINUS_ONE, false),
- HOWTO(R_390_JMP_SLOT, 0, 4, 64, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_390_JMP_SLOT",false, 0,MINUS_ONE, false),
- HOWTO(R_390_RELATIVE, 0, 4, 64, true, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_390_RELATIVE",false, 0,MINUS_ONE, false),
- HOWTO(R_390_GOTOFF, 0, 4, 64, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_390_GOTOFF", false, 0,MINUS_ONE, false),
- HOWTO(R_390_GOTPC, 0, 4, 64, true, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_390_GOTPC", false, 0,MINUS_ONE, true),
- HOWTO(R_390_GOT16, 0, 1, 16, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_390_GOT16", false, 0,0x0000ffff, false),
- HOWTO(R_390_PC16, 0, 1, 16, true, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_390_PC16", false, 0,0x0000ffff, true),
- HOWTO(R_390_PC16DBL, 1, 1, 16, true, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_390_PC16DBL", false, 0,0x0000ffff, true),
- HOWTO(R_390_PLT16DBL, 1, 1, 16, true, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_390_PLT16DBL", false, 0,0x0000ffff, true),
- HOWTO(R_390_PC32DBL, 1, 2, 32, true, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_390_PC32DBL", false, 0,0xffffffff, true),
- HOWTO(R_390_PLT32DBL, 1, 2, 32, true, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_390_PLT32DBL", false, 0,0xffffffff, true),
- HOWTO(R_390_GOTPCDBL, 1, 2, 32, true, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_390_GOTPCDBL", false, 0,MINUS_ONE, true),
- HOWTO(R_390_64, 0, 4, 64, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_390_64", false, 0,MINUS_ONE, false),
- HOWTO(R_390_PC64, 0, 4, 64, true, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_390_PC64", false, 0,MINUS_ONE, true),
- HOWTO(R_390_GOT64, 0, 4, 64, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_390_GOT64", false, 0,MINUS_ONE, false),
- HOWTO(R_390_PLT64, 0, 4, 64, true, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_390_PLT64", false, 0,MINUS_ONE, true),
- HOWTO(R_390_GOTENT, 1, 2, 32, true, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_390_GOTENT", false, 0,MINUS_ONE, true),
+ FALSE), /* pcrel_offset */
+
+ HOWTO(R_390_8, 0, 0, 8, FALSE, 0, complain_overflow_bitfield,
+ bfd_elf_generic_reloc, "R_390_8", FALSE, 0,0x000000ff, FALSE),
+ HOWTO(R_390_12, 0, 1, 12, FALSE, 0, complain_overflow_dont,
+ bfd_elf_generic_reloc, "R_390_12", FALSE, 0,0x00000fff, FALSE),
+ HOWTO(R_390_16, 0, 1, 16, FALSE, 0, complain_overflow_bitfield,
+ bfd_elf_generic_reloc, "R_390_16", FALSE, 0,0x0000ffff, FALSE),
+ HOWTO(R_390_32, 0, 2, 32, FALSE, 0, complain_overflow_bitfield,
+ bfd_elf_generic_reloc, "R_390_32", FALSE, 0,0xffffffff, FALSE),
+ HOWTO(R_390_PC32, 0, 2, 32, TRUE, 0, complain_overflow_bitfield,
+ bfd_elf_generic_reloc, "R_390_PC32", FALSE, 0,0xffffffff, TRUE),
+ HOWTO(R_390_GOT12, 0, 1, 12, FALSE, 0, complain_overflow_bitfield,
+ bfd_elf_generic_reloc, "R_390_GOT12", FALSE, 0,0x00000fff, FALSE),
+ HOWTO(R_390_GOT32, 0, 2, 32, FALSE, 0, complain_overflow_bitfield,
+ bfd_elf_generic_reloc, "R_390_GOT32", FALSE, 0,0xffffffff, FALSE),
+ HOWTO(R_390_PLT32, 0, 2, 32, TRUE, 0, complain_overflow_bitfield,
+ bfd_elf_generic_reloc, "R_390_PLT32", FALSE, 0,0xffffffff, TRUE),
+ HOWTO(R_390_COPY, 0, 4, 64, FALSE, 0, complain_overflow_bitfield,
+ bfd_elf_generic_reloc, "R_390_COPY", FALSE, 0,MINUS_ONE, FALSE),
+ HOWTO(R_390_GLOB_DAT, 0, 4, 64, FALSE, 0, complain_overflow_bitfield,
+ bfd_elf_generic_reloc, "R_390_GLOB_DAT", FALSE, 0,MINUS_ONE, FALSE),
+ HOWTO(R_390_JMP_SLOT, 0, 4, 64, FALSE, 0, complain_overflow_bitfield,
+ bfd_elf_generic_reloc, "R_390_JMP_SLOT", FALSE, 0,MINUS_ONE, FALSE),
+ HOWTO(R_390_RELATIVE, 0, 4, 64, TRUE, 0, complain_overflow_bitfield,
+ bfd_elf_generic_reloc, "R_390_RELATIVE", FALSE, 0,MINUS_ONE, FALSE),
+ HOWTO(R_390_GOTOFF32, 0, 2, 32, FALSE, 0, complain_overflow_bitfield,
+ bfd_elf_generic_reloc, "R_390_GOTOFF32", FALSE, 0,MINUS_ONE, FALSE),
+ HOWTO(R_390_GOTPC, 0, 4, 64, TRUE, 0, complain_overflow_bitfield,
+ bfd_elf_generic_reloc, "R_390_GOTPC", FALSE, 0,MINUS_ONE, TRUE),
+ HOWTO(R_390_GOT16, 0, 1, 16, FALSE, 0, complain_overflow_bitfield,
+ bfd_elf_generic_reloc, "R_390_GOT16", FALSE, 0,0x0000ffff, FALSE),
+ HOWTO(R_390_PC16, 0, 1, 16, TRUE, 0, complain_overflow_bitfield,
+ bfd_elf_generic_reloc, "R_390_PC16", FALSE, 0,0x0000ffff, TRUE),
+ HOWTO(R_390_PC16DBL, 1, 1, 16, TRUE, 0, complain_overflow_bitfield,
+ bfd_elf_generic_reloc, "R_390_PC16DBL", FALSE, 0,0x0000ffff, TRUE),
+ HOWTO(R_390_PLT16DBL, 1, 1, 16, TRUE, 0, complain_overflow_bitfield,
+ bfd_elf_generic_reloc, "R_390_PLT16DBL", FALSE, 0,0x0000ffff, TRUE),
+ HOWTO(R_390_PC32DBL, 1, 2, 32, TRUE, 0, complain_overflow_bitfield,
+ bfd_elf_generic_reloc, "R_390_PC32DBL", FALSE, 0,0xffffffff, TRUE),
+ HOWTO(R_390_PLT32DBL, 1, 2, 32, TRUE, 0, complain_overflow_bitfield,
+ bfd_elf_generic_reloc, "R_390_PLT32DBL", FALSE, 0,0xffffffff, TRUE),
+ HOWTO(R_390_GOTPCDBL, 1, 2, 32, TRUE, 0, complain_overflow_bitfield,
+ bfd_elf_generic_reloc, "R_390_GOTPCDBL", FALSE, 0,MINUS_ONE, TRUE),
+ HOWTO(R_390_64, 0, 4, 64, FALSE, 0, complain_overflow_bitfield,
+ bfd_elf_generic_reloc, "R_390_64", FALSE, 0,MINUS_ONE, FALSE),
+ HOWTO(R_390_PC64, 0, 4, 64, TRUE, 0, complain_overflow_bitfield,
+ bfd_elf_generic_reloc, "R_390_PC64", FALSE, 0,MINUS_ONE, TRUE),
+ HOWTO(R_390_GOT64, 0, 4, 64, FALSE, 0, complain_overflow_bitfield,
+ bfd_elf_generic_reloc, "R_390_GOT64", FALSE, 0,MINUS_ONE, FALSE),
+ HOWTO(R_390_PLT64, 0, 4, 64, TRUE, 0, complain_overflow_bitfield,
+ bfd_elf_generic_reloc, "R_390_PLT64", FALSE, 0,MINUS_ONE, TRUE),
+ HOWTO(R_390_GOTENT, 1, 2, 32, TRUE, 0, complain_overflow_bitfield,
+ bfd_elf_generic_reloc, "R_390_GOTENT", FALSE, 0,MINUS_ONE, TRUE),
+ HOWTO(R_390_GOTOFF16, 0, 1, 16, FALSE, 0, complain_overflow_bitfield,
+ bfd_elf_generic_reloc, "R_390_GOTOFF16", FALSE, 0,0x0000ffff, FALSE),
+ HOWTO(R_390_GOTOFF64, 0, 4, 64, FALSE, 0, complain_overflow_bitfield,
+ bfd_elf_generic_reloc, "R_390_GOTOFF64", FALSE, 0,MINUS_ONE, FALSE),
+ HOWTO(R_390_GOTPLT12, 0, 1, 12, FALSE, 0, complain_overflow_dont,
+ bfd_elf_generic_reloc, "R_390_GOTPLT12", FALSE, 0,0x00000fff, FALSE),
+ HOWTO(R_390_GOTPLT16, 0, 1, 16, FALSE, 0, complain_overflow_bitfield,
+ bfd_elf_generic_reloc, "R_390_GOTPLT16", FALSE, 0,0x0000ffff, FALSE),
+ HOWTO(R_390_GOTPLT32, 0, 2, 32, FALSE, 0, complain_overflow_bitfield,
+ bfd_elf_generic_reloc, "R_390_GOTPLT32", FALSE, 0,0xffffffff, FALSE),
+ HOWTO(R_390_GOTPLT64, 0, 4, 64, FALSE, 0, complain_overflow_bitfield,
+ bfd_elf_generic_reloc, "R_390_GOTPLT64", FALSE, 0,MINUS_ONE, FALSE),
+ HOWTO(R_390_GOTPLTENT, 1, 2, 32, TRUE, 0, complain_overflow_bitfield,
+ bfd_elf_generic_reloc, "R_390_GOTPLTENT",FALSE, 0,MINUS_ONE, TRUE),
+ HOWTO(R_390_PLTOFF16, 0, 1, 16, FALSE, 0, complain_overflow_bitfield,
+ bfd_elf_generic_reloc, "R_390_PLTOFF16", FALSE, 0,0x0000ffff, FALSE),
+ HOWTO(R_390_PLTOFF32, 0, 2, 32, FALSE, 0, complain_overflow_bitfield,
+ bfd_elf_generic_reloc, "R_390_PLTOFF32", FALSE, 0,0xffffffff, FALSE),
+ HOWTO(R_390_PLTOFF64, 0, 4, 64, FALSE, 0, complain_overflow_bitfield,
+ bfd_elf_generic_reloc, "R_390_PLTOFF64", FALSE, 0,MINUS_ONE, FALSE),
+ HOWTO(R_390_TLS_LOAD, 0, 0, 0, FALSE, 0, complain_overflow_dont,
+ s390_tls_reloc, "R_390_TLS_LOAD", FALSE, 0, 0, FALSE),
+ HOWTO(R_390_TLS_GDCALL, 0, 0, 0, FALSE, 0, complain_overflow_dont,
+ s390_tls_reloc, "R_390_TLS_GDCALL", FALSE, 0, 0, FALSE),
+ HOWTO(R_390_TLS_LDCALL, 0, 0, 0, FALSE, 0, complain_overflow_dont,
+ s390_tls_reloc, "R_390_TLS_LDCALL", FALSE, 0, 0, FALSE),
+ EMPTY_HOWTO (R_390_TLS_GD32), /* Empty entry for R_390_TLS_GD32. */
+ HOWTO(R_390_TLS_GD64, 0, 4, 64, FALSE, 0, complain_overflow_bitfield,
+ bfd_elf_generic_reloc, "R_390_TLS_GD64", FALSE, 0, MINUS_ONE, FALSE),
+ HOWTO(R_390_TLS_GOTIE12, 0, 1, 12, FALSE, 0, complain_overflow_dont,
+ bfd_elf_generic_reloc, "R_390_TLS_GOTIE12", FALSE, 0, 0x00000fff, FALSE),
+ EMPTY_HOWTO (R_390_TLS_GOTIE32), /* Empty entry for R_390_TLS_GOTIE32. */
+ HOWTO(R_390_TLS_GOTIE64, 0, 4, 64, FALSE, 0, complain_overflow_bitfield,
+ bfd_elf_generic_reloc, "R_390_TLS_GOTIE64", FALSE, 0, MINUS_ONE, FALSE),
+ EMPTY_HOWTO (R_390_TLS_LDM32), /* Empty entry for R_390_TLS_LDM32. */
+ HOWTO(R_390_TLS_LDM64, 0, 4, 64, FALSE, 0, complain_overflow_bitfield,
+ bfd_elf_generic_reloc, "R_390_TLS_LDM64", FALSE, 0, MINUS_ONE, FALSE),
+ EMPTY_HOWTO (R_390_TLS_IE32), /* Empty entry for R_390_TLS_IE32. */
+ HOWTO(R_390_TLS_IE64, 0, 4, 64, FALSE, 0, complain_overflow_bitfield,
+ bfd_elf_generic_reloc, "R_390_TLS_IE64", FALSE, 0, MINUS_ONE, FALSE),
+ HOWTO(R_390_TLS_IEENT, 1, 2, 32, TRUE, 0, complain_overflow_bitfield,
+ bfd_elf_generic_reloc, "R_390_TLS_IEENT", FALSE, 0, MINUS_ONE, TRUE),
+ EMPTY_HOWTO (R_390_TLS_LE32), /* Empty entry for R_390_TLS_LE32. */
+ HOWTO(R_390_TLS_LE64, 0, 2, 32, FALSE, 0, complain_overflow_bitfield,
+ bfd_elf_generic_reloc, "R_390_TLS_LE64", FALSE, 0, MINUS_ONE, FALSE),
+ EMPTY_HOWTO (R_390_TLS_LDO32), /* Empty entry for R_390_TLS_LDO32. */
+ HOWTO(R_390_TLS_LDO64, 0, 4, 64, FALSE, 0, complain_overflow_bitfield,
+ bfd_elf_generic_reloc, "R_390_TLS_LDO64", FALSE, 0, MINUS_ONE, FALSE),
+ HOWTO(R_390_TLS_DTPMOD, 0, 4, 64, FALSE, 0, complain_overflow_bitfield,
+ bfd_elf_generic_reloc, "R_390_TLS_DTPMOD", FALSE, 0, MINUS_ONE, FALSE),
+ HOWTO(R_390_TLS_DTPOFF, 0, 4, 64, FALSE, 0, complain_overflow_bitfield,
+ bfd_elf_generic_reloc, "R_390_TLS_DTPOFF", FALSE, 0, MINUS_ONE, FALSE),
+ HOWTO(R_390_TLS_TPOFF, 0, 4, 64, FALSE, 0, complain_overflow_bitfield,
+ bfd_elf_generic_reloc, "R_390_TLS_TPOFF", FALSE, 0, MINUS_ONE, FALSE),
+ HOWTO(R_390_20, 0, 2, 20, FALSE, 8, complain_overflow_dont,
+ s390_elf_ldisp_reloc, "R_390_20", FALSE, 0,0x0fffff00, FALSE),
+ HOWTO(R_390_GOT20, 0, 2, 20, FALSE, 8, complain_overflow_dont,
+ s390_elf_ldisp_reloc, "R_390_GOT20", FALSE, 0,0x0fffff00, FALSE),
+ HOWTO(R_390_GOTPLT20, 0, 2, 20, FALSE, 8, complain_overflow_dont,
+ s390_elf_ldisp_reloc, "R_390_GOTPLT20", FALSE, 0,0x0fffff00, FALSE),
+ HOWTO(R_390_TLS_GOTIE20, 0, 2, 20, FALSE, 8, complain_overflow_dont,
+ s390_elf_ldisp_reloc, "R_390_TLS_GOTIE20", FALSE, 0,0x0fffff00, FALSE),
};
/* GNU extension to record C++ vtable hierarchy. */
static reloc_howto_type elf64_s390_vtinherit_howto =
- HOWTO (R_390_GNU_VTINHERIT, 0,4,0,false,0,complain_overflow_dont, NULL, "R_390_GNU_VTINHERIT", false,0, 0, false);
+ HOWTO (R_390_GNU_VTINHERIT, 0,4,0,FALSE,0,complain_overflow_dont, NULL, "R_390_GNU_VTINHERIT", FALSE,0, 0, FALSE);
static reloc_howto_type elf64_s390_vtentry_howto =
- HOWTO (R_390_GNU_VTENTRY, 0,4,0,false,0,complain_overflow_dont, _bfd_elf_rel_vtable_reloc_fn,"R_390_GNU_VTENTRY", false,0,0, false);
+ HOWTO (R_390_GNU_VTENTRY, 0,4,0,FALSE,0,complain_overflow_dont, _bfd_elf_rel_vtable_reloc_fn,"R_390_GNU_VTENTRY", FALSE,0,0, FALSE);
static reloc_howto_type *
elf_s390_reloc_type_lookup (abfd, code)
@@ -166,7 +270,7 @@ elf_s390_reloc_type_lookup (abfd, code)
case BFD_RELOC_390_RELATIVE:
return &elf_howto_table[(int) R_390_RELATIVE];
case BFD_RELOC_32_GOTOFF:
- return &elf_howto_table[(int) R_390_GOTOFF];
+ return &elf_howto_table[(int) R_390_GOTOFF32];
case BFD_RELOC_390_GOTPC:
return &elf_howto_table[(int) R_390_GOTPC];
case BFD_RELOC_390_GOT16:
@@ -177,10 +281,6 @@ elf_s390_reloc_type_lookup (abfd, code)
return &elf_howto_table[(int) R_390_PC16DBL];
case BFD_RELOC_390_PLT16DBL:
return &elf_howto_table[(int) R_390_PLT16DBL];
- case BFD_RELOC_VTABLE_INHERIT:
- return &elf64_s390_vtinherit_howto;
- case BFD_RELOC_VTABLE_ENTRY:
- return &elf64_s390_vtentry_howto;
case BFD_RELOC_390_PC32DBL:
return &elf_howto_table[(int) R_390_PC32DBL];
case BFD_RELOC_390_PLT32DBL:
@@ -197,6 +297,66 @@ elf_s390_reloc_type_lookup (abfd, code)
return &elf_howto_table[(int) R_390_PLT64];
case BFD_RELOC_390_GOTENT:
return &elf_howto_table[(int) R_390_GOTENT];
+ case BFD_RELOC_16_GOTOFF:
+ return &elf_howto_table[(int) R_390_GOTOFF16];
+ case BFD_RELOC_390_GOTOFF64:
+ return &elf_howto_table[(int) R_390_GOTOFF64];
+ case BFD_RELOC_390_GOTPLT12:
+ return &elf_howto_table[(int) R_390_GOTPLT12];
+ case BFD_RELOC_390_GOTPLT16:
+ return &elf_howto_table[(int) R_390_GOTPLT16];
+ case BFD_RELOC_390_GOTPLT32:
+ return &elf_howto_table[(int) R_390_GOTPLT32];
+ case BFD_RELOC_390_GOTPLT64:
+ return &elf_howto_table[(int) R_390_GOTPLT64];
+ case BFD_RELOC_390_GOTPLTENT:
+ return &elf_howto_table[(int) R_390_GOTPLTENT];
+ case BFD_RELOC_390_PLTOFF16:
+ return &elf_howto_table[(int) R_390_PLTOFF16];
+ case BFD_RELOC_390_PLTOFF32:
+ return &elf_howto_table[(int) R_390_PLTOFF32];
+ case BFD_RELOC_390_PLTOFF64:
+ return &elf_howto_table[(int) R_390_PLTOFF64];
+ case BFD_RELOC_390_TLS_LOAD:
+ return &elf_howto_table[(int) R_390_TLS_LOAD];
+ case BFD_RELOC_390_TLS_GDCALL:
+ return &elf_howto_table[(int) R_390_TLS_GDCALL];
+ case BFD_RELOC_390_TLS_LDCALL:
+ return &elf_howto_table[(int) R_390_TLS_LDCALL];
+ case BFD_RELOC_390_TLS_GD64:
+ return &elf_howto_table[(int) R_390_TLS_GD64];
+ case BFD_RELOC_390_TLS_GOTIE12:
+ return &elf_howto_table[(int) R_390_TLS_GOTIE12];
+ case BFD_RELOC_390_TLS_GOTIE64:
+ return &elf_howto_table[(int) R_390_TLS_GOTIE64];
+ case BFD_RELOC_390_TLS_LDM64:
+ return &elf_howto_table[(int) R_390_TLS_LDM64];
+ case BFD_RELOC_390_TLS_IE64:
+ return &elf_howto_table[(int) R_390_TLS_IE64];
+ case BFD_RELOC_390_TLS_IEENT:
+ return &elf_howto_table[(int) R_390_TLS_IEENT];
+ case BFD_RELOC_390_TLS_LE64:
+ return &elf_howto_table[(int) R_390_TLS_LE64];
+ case BFD_RELOC_390_TLS_LDO64:
+ return &elf_howto_table[(int) R_390_TLS_LDO64];
+ case BFD_RELOC_390_TLS_DTPMOD:
+ return &elf_howto_table[(int) R_390_TLS_DTPMOD];
+ case BFD_RELOC_390_TLS_DTPOFF:
+ return &elf_howto_table[(int) R_390_TLS_DTPOFF];
+ case BFD_RELOC_390_TLS_TPOFF:
+ return &elf_howto_table[(int) R_390_TLS_TPOFF];
+ case BFD_RELOC_390_20:
+ return &elf_howto_table[(int) R_390_20];
+ case BFD_RELOC_390_GOT20:
+ return &elf_howto_table[(int) R_390_GOT20];
+ case BFD_RELOC_390_GOTPLT20:
+ return &elf_howto_table[(int) R_390_GOTPLT20];
+ case BFD_RELOC_390_TLS_GOTIE20:
+ return &elf_howto_table[(int) R_390_TLS_GOTIE20];
+ case BFD_RELOC_VTABLE_INHERIT:
+ return &elf64_s390_vtinherit_howto;
+ case BFD_RELOC_VTABLE_ENTRY:
+ return &elf64_s390_vtentry_howto;
default:
break;
}
@@ -228,13 +388,82 @@ elf_s390_info_to_howto (abfd, cache_ptr, dst)
}
}
-static boolean
+/* A relocation function which doesn't do anything. */
+static bfd_reloc_status_type
+s390_tls_reloc (abfd, reloc_entry, symbol, data, input_section,
+ output_bfd, error_message)
+ bfd *abfd ATTRIBUTE_UNUSED;
+ arelent *reloc_entry;
+ asymbol *symbol ATTRIBUTE_UNUSED;
+ PTR data ATTRIBUTE_UNUSED;
+ asection *input_section;
+ bfd *output_bfd;
+ char **error_message ATTRIBUTE_UNUSED;
+{
+ if (output_bfd)
+ reloc_entry->address += input_section->output_offset;
+ return bfd_reloc_ok;
+}
+
+/* Handle the large displacement relocs. */
+static bfd_reloc_status_type
+s390_elf_ldisp_reloc (abfd, reloc_entry, symbol, data, input_section,
+ output_bfd, error_message)
+ bfd *abfd;
+ arelent *reloc_entry;
+ asymbol *symbol;
+ PTR data;
+ asection *input_section;
+ bfd *output_bfd;
+ char **error_message ATTRIBUTE_UNUSED;
+{
+ reloc_howto_type *howto = reloc_entry->howto;
+ bfd_vma relocation;
+ bfd_vma insn;
+
+ if (output_bfd != (bfd *) NULL
+ && (symbol->flags & BSF_SECTION_SYM) == 0
+ && (! howto->partial_inplace
+ || reloc_entry->addend == 0))
+ {
+ reloc_entry->address += input_section->output_offset;
+ return bfd_reloc_ok;
+ }
+ if (output_bfd != NULL)
+ return bfd_reloc_continue;
+
+ if (reloc_entry->address > input_section->_cooked_size)
+ return bfd_reloc_outofrange;
+
+ relocation = (symbol->value
+ + symbol->section->output_section->vma
+ + symbol->section->output_offset);
+ relocation += reloc_entry->addend;
+ if (howto->pc_relative)
+ {
+ relocation -= (input_section->output_section->vma
+ + input_section->output_offset);
+ relocation -= reloc_entry->address;
+ }
+
+ insn = bfd_get_32 (abfd, (bfd_byte *) data + reloc_entry->address);
+ insn |= (relocation & 0xfff) << 16 | (relocation & 0xff000) >> 4;
+ bfd_put_32 (abfd, insn, (bfd_byte *) data + reloc_entry->address);
+
+ if ((bfd_signed_vma) relocation < - 0x80000
+ || (bfd_signed_vma) relocation > 0x7ffff)
+ return bfd_reloc_overflow;
+ else
+ return bfd_reloc_ok;
+}
+
+static bfd_boolean
elf_s390_is_local_label_name (abfd, name)
bfd *abfd;
const char *name;
{
if (name[0] == '.' && (name[1] == 'X' || name[1] == 'L'))
- return true;
+ return TRUE;
return _bfd_elf_is_local_label_name (abfd, name);
}
@@ -246,6 +475,12 @@ elf_s390_is_local_label_name (abfd, name)
#define ELF_DYNAMIC_INTERPRETER "/usr/lib/ld.so.1"
+/* If ELIMINATE_COPY_RELOCS is non-zero, the linker will try to avoid
+ copying dynamic variables from a shared lib into an app's dynbss
+ section, and instead use a dynamic relocation to point into the
+ shared lib. */
+#define ELIMINATE_COPY_RELOCS 1
+
/* The size in bytes of the first entry in the procedure linkage table. */
#define PLT_FIRST_ENTRY_SIZE 32
/* The size in bytes of an entry in the procedure linkage table. */
@@ -359,8 +594,54 @@ struct elf_s390_link_hash_entry
/* Track dynamic relocs copied for this symbol. */
struct elf_s390_dyn_relocs *dyn_relocs;
+
+ /* Number of GOTPLT references for a function. */
+ bfd_signed_vma gotplt_refcount;
+
+#define GOT_UNKNOWN 0
+#define GOT_NORMAL 1
+#define GOT_TLS_GD 2
+#define GOT_TLS_IE 3
+#define GOT_TLS_IE_NLT 3
+ unsigned char tls_type;
};
+#define elf_s390_hash_entry(ent) \
+ ((struct elf_s390_link_hash_entry *)(ent))
+
+struct elf_s390_obj_tdata
+{
+ struct elf_obj_tdata root;
+
+ /* tls_type for each local got entry. */
+ char *local_got_tls_type;
+};
+
+#define elf_s390_tdata(abfd) \
+ ((struct elf_s390_obj_tdata *) (abfd)->tdata.any)
+
+#define elf_s390_local_got_tls_type(abfd) \
+ (elf_s390_tdata (abfd)->local_got_tls_type)
+
+static bfd_boolean
+elf_s390_mkobject (abfd)
+ bfd *abfd;
+{
+ bfd_size_type amt = sizeof (struct elf_s390_obj_tdata);
+ abfd->tdata.any = bfd_zalloc (abfd, amt);
+ if (abfd->tdata.any == NULL)
+ return FALSE;
+ return TRUE;
+}
+
+static bfd_boolean
+elf_s390_object_p (abfd)
+ bfd *abfd;
+{
+ /* Set the right machine number for an s390 elf32 file. */
+ return bfd_default_set_arch_mach (abfd, bfd_arch_s390, bfd_mach_s390_64);
+}
+
/* s390 ELF linker hash table. */
struct elf_s390_link_hash_table
@@ -376,6 +657,11 @@ struct elf_s390_link_hash_table
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;
};
@@ -411,6 +697,8 @@ link_hash_newfunc (entry, table, string)
eh = (struct elf_s390_link_hash_entry *) entry;
eh->dyn_relocs = NULL;
+ eh->gotplt_refcount = 0;
+ eh->tls_type = GOT_UNKNOWN;
}
return entry;
@@ -442,6 +730,7 @@ elf_s390_link_hash_table_create (abfd)
ret->srelplt = NULL;
ret->sdynbss = NULL;
ret->srelbss = NULL;
+ ret->tls_ldm_got.refcount = 0;
ret->sym_sec.abfd = NULL;
return &ret->elf.root;
@@ -450,7 +739,7 @@ elf_s390_link_hash_table_create (abfd)
/* Create .got, .gotplt, and .rela.got sections in DYNOBJ, and set up
shortcuts to them in our hash table. */
-static boolean
+static bfd_boolean
create_got_section (dynobj, info)
bfd *dynobj;
struct bfd_link_info *info;
@@ -458,7 +747,7 @@ create_got_section (dynobj, info)
struct elf_s390_link_hash_table *htab;
if (! _bfd_elf_create_got_section (dynobj, info))
- return false;
+ return FALSE;
htab = elf_s390_hash_table (info);
htab->sgot = bfd_get_section_by_name (dynobj, ".got");
@@ -473,15 +762,15 @@ create_got_section (dynobj, info)
| SEC_IN_MEMORY | SEC_LINKER_CREATED
| SEC_READONLY))
|| ! bfd_set_section_alignment (dynobj, htab->srelgot, 3))
- return false;
- return true;
+ return FALSE;
+ return TRUE;
}
/* Create .plt, .rela.plt, .got, .got.plt, .rela.got, .dynbss, and
.rela.bss sections in DYNOBJ, and set up shortcuts to them in our
hash table. */
-static boolean
+static bfd_boolean
elf_s390_create_dynamic_sections (dynobj, info)
bfd *dynobj;
struct bfd_link_info *info;
@@ -490,10 +779,10 @@ elf_s390_create_dynamic_sections (dynobj, info)
htab = elf_s390_hash_table (info);
if (!htab->sgot && !create_got_section (dynobj, info))
- return false;
+ return FALSE;
if (!_bfd_elf_create_dynamic_sections (dynobj, info))
- return false;
+ return FALSE;
htab->splt = bfd_get_section_by_name (dynobj, ".plt");
htab->srelplt = bfd_get_section_by_name (dynobj, ".rela.plt");
@@ -505,14 +794,14 @@ elf_s390_create_dynamic_sections (dynobj, info)
|| (!info->shared && !htab->srelbss))
abort ();
- return true;
+ return TRUE;
}
/* Copy the extra info we tack onto an elf_link_hash_entry. */
static void
elf_s390_copy_indirect_symbol (bed, dir, ind)
- struct elf_backend_data *bed;
+ const struct elf_backend_data *bed;
struct elf_link_hash_entry *dir, *ind;
{
struct elf_s390_link_hash_entry *edir, *eind;
@@ -554,14 +843,60 @@ elf_s390_copy_indirect_symbol (bed, dir, ind)
eind->dyn_relocs = NULL;
}
- _bfd_elf_link_hash_copy_indirect (bed, dir, ind);
+ if (ind->root.type == bfd_link_hash_indirect
+ && dir->got.refcount <= 0)
+ {
+ edir->tls_type = eind->tls_type;
+ eind->tls_type = GOT_UNKNOWN;
+ }
+
+ if (ELIMINATE_COPY_RELOCS
+ && ind->root.type != bfd_link_hash_indirect
+ && (dir->elf_link_hash_flags & ELF_LINK_HASH_DYNAMIC_ADJUSTED) != 0)
+ /* If called to transfer flags for a weakdef during processing
+ of elf_adjust_dynamic_symbol, don't copy ELF_LINK_NON_GOT_REF.
+ We clear it ourselves for ELIMINATE_COPY_RELOCS. */
+ dir->elf_link_hash_flags |=
+ (ind->elf_link_hash_flags & (ELF_LINK_HASH_REF_DYNAMIC
+ | ELF_LINK_HASH_REF_REGULAR
+ | ELF_LINK_HASH_REF_REGULAR_NONWEAK
+ | ELF_LINK_HASH_NEEDS_PLT));
+ else
+ _bfd_elf_link_hash_copy_indirect (bed, dir, ind);
+}
+
+static int
+elf_s390_tls_transition (info, r_type, is_local)
+ struct bfd_link_info *info;
+ int r_type;
+ int is_local;
+{
+ if (info->shared)
+ return r_type;
+
+ switch (r_type)
+ {
+ case R_390_TLS_GD64:
+ case R_390_TLS_IE64:
+ if (is_local)
+ return R_390_TLS_LE64;
+ return R_390_TLS_IE64;
+ case R_390_TLS_GOTIE64:
+ if (is_local)
+ return R_390_TLS_LE64;
+ return R_390_TLS_GOTIE64;
+ case R_390_TLS_LDM64:
+ return R_390_TLS_LE64;
+ }
+
+ return r_type;
}
/* Look through the relocs for a section during the first phase, and
allocate space in the global offset table or procedure linkage
table. */
-static boolean
+static bfd_boolean
elf_s390_check_relocs (abfd, info, sec, relocs)
bfd *abfd;
struct bfd_link_info *info;
@@ -574,19 +909,23 @@ elf_s390_check_relocs (abfd, info, sec, relocs)
const Elf_Internal_Rela *rel;
const Elf_Internal_Rela *rel_end;
asection *sreloc;
+ bfd_signed_vma *local_got_refcounts;
+ int tls_type, old_tls_type;
- if (info->relocateable)
- return true;
+ if (info->relocatable)
+ return TRUE;
htab = elf_s390_hash_table (info);
symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
sym_hashes = elf_sym_hashes (abfd);
+ local_got_refcounts = elf_local_got_refcounts (abfd);
sreloc = NULL;
rel_end = relocs + sec->reloc_count;
for (rel = relocs; rel < rel_end; rel++)
{
+ unsigned int r_type;
unsigned long r_symndx;
struct elf_link_hash_entry *h;
@@ -597,7 +936,7 @@ elf_s390_check_relocs (abfd, info, sec, relocs)
(*_bfd_error_handler) (_("%s: bad symbol index: %d"),
bfd_archive_filename (abfd),
r_symndx);
- return false;
+ return FALSE;
}
if (r_symndx < symtab_hdr->sh_info)
@@ -605,41 +944,51 @@ elf_s390_check_relocs (abfd, info, sec, relocs)
else
h = sym_hashes[r_symndx - symtab_hdr->sh_info];
- switch (ELF64_R_TYPE (rel->r_info))
+ /* Create got section and local_got_refcounts array if they
+ are needed. */
+ r_type = elf_s390_tls_transition (info,
+ ELF64_R_TYPE (rel->r_info),
+ h == NULL);
+ switch (r_type)
{
case R_390_GOT12:
- case R_390_GOT16:
+ case R_390_GOT16:
+ case R_390_GOT20:
case R_390_GOT32:
case R_390_GOT64:
case R_390_GOTENT:
- /* This symbol requires a global offset table entry. */
- if (h != NULL)
- {
- h->got.refcount += 1;
- }
- else
+ case R_390_GOTPLT12:
+ case R_390_GOTPLT16:
+ case R_390_GOTPLT20:
+ case R_390_GOTPLT32:
+ case R_390_GOTPLT64:
+ case R_390_GOTPLTENT:
+ case R_390_TLS_GD64:
+ case R_390_TLS_GOTIE12:
+ case R_390_TLS_GOTIE20:
+ case R_390_TLS_GOTIE64:
+ case R_390_TLS_IEENT:
+ case R_390_TLS_IE64:
+ case R_390_TLS_LDM64:
+ if (h == NULL
+ && local_got_refcounts == NULL)
{
- bfd_signed_vma *local_got_refcounts;
+ bfd_size_type size;
- /* This is a global offset table entry for a local symbol. */
- local_got_refcounts = elf_local_got_refcounts (abfd);
+ 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)
- {
- bfd_size_type size;
-
- size = symtab_hdr->sh_info;
- size *= sizeof (bfd_signed_vma);
- local_got_refcounts = ((bfd_signed_vma *)
- bfd_zalloc (abfd, size));
- if (local_got_refcounts == NULL)
- return false;
- elf_local_got_refcounts (abfd) = local_got_refcounts;
- }
- local_got_refcounts[r_symndx] += 1;
+ return FALSE;
+ elf_local_got_refcounts (abfd) = local_got_refcounts;
+ elf_s390_local_got_tls_type (abfd)
+ = (char *) (local_got_refcounts + symtab_hdr->sh_info);
}
- /* Fall through */
-
- case R_390_GOTOFF:
+ /* Fall through. */
+ case R_390_GOTOFF16:
+ case R_390_GOTOFF32:
+ case R_390_GOTOFF64:
case R_390_GOTPC:
case R_390_GOTPCDBL:
if (htab->sgot == NULL)
@@ -647,36 +996,161 @@ elf_s390_check_relocs (abfd, info, sec, relocs)
if (htab->elf.dynobj == NULL)
htab->elf.dynobj = abfd;
if (!create_got_section (htab->elf.dynobj, info))
- return false;
+ return FALSE;
}
+ }
+
+ switch (r_type)
+ {
+ case R_390_GOTOFF16:
+ case R_390_GOTOFF32:
+ case R_390_GOTOFF64:
+ case R_390_GOTPC:
+ case R_390_GOTPCDBL:
+ /* Got is created, nothing to be done. */
break;
- case R_390_PLT16DBL:
+ case R_390_PLT16DBL:
case R_390_PLT32:
case R_390_PLT32DBL:
case R_390_PLT64:
+ case R_390_PLTOFF16:
+ case R_390_PLTOFF32:
+ case R_390_PLTOFF64:
/* This symbol requires a procedure linkage table entry. We
- actually build the entry in adjust_dynamic_symbol,
- because this might be a case of linking PIC code which is
- never referenced by a dynamic object, in which case we
- don't need to generate a procedure linkage table entry
- after all. */
+ actually build the entry in adjust_dynamic_symbol,
+ because this might be a case of linking PIC code which is
+ never referenced by a dynamic object, in which case we
+ don't need to generate a procedure linkage table entry
+ after all. */
/* If this is a local symbol, we resolve it directly without
- creating a procedure linkage table entry. */
- if (h == NULL)
- continue;
+ creating a procedure linkage table entry. */
+ if (h != NULL)
+ {
+ h->elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_PLT;
+ h->plt.refcount += 1;
+ }
+ break;
- h->elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_PLT;
- h->plt.refcount += 1;
+ case R_390_GOTPLT12:
+ case R_390_GOTPLT16:
+ case R_390_GOTPLT20:
+ case R_390_GOTPLT32:
+ case R_390_GOTPLT64:
+ case R_390_GOTPLTENT:
+ /* This symbol requires either a procedure linkage table entry
+ or an entry in the local got. We actually build the entry
+ in adjust_dynamic_symbol because whether this is really a
+ global reference can change and with it the fact if we have
+ to create a plt entry or a local got entry. To be able to
+ make a once global symbol a local one we have to keep track
+ of the number of gotplt references that exist for this
+ symbol. */
+ if (h != NULL)
+ {
+ ((struct elf_s390_link_hash_entry *) h)->gotplt_refcount++;
+ h->elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_PLT;
+ h->plt.refcount += 1;
+ }
+ else
+ local_got_refcounts[r_symndx] += 1;
+ break;
+
+ case R_390_TLS_LDM64:
+ htab->tls_ldm_got.refcount += 1;
break;
- case R_390_8:
- case R_390_16:
+ case R_390_TLS_IE64:
+ case R_390_TLS_GOTIE12:
+ case R_390_TLS_GOTIE20:
+ case R_390_TLS_GOTIE64:
+ case R_390_TLS_IEENT:
+ if (info->shared)
+ info->flags |= DF_STATIC_TLS;
+ /* Fall through */
+
+ case R_390_GOT12:
+ case R_390_GOT16:
+ case R_390_GOT20:
+ case R_390_GOT32:
+ case R_390_GOT64:
+ case R_390_GOTENT:
+ case R_390_TLS_GD64:
+ /* This symbol requires a global offset table entry. */
+ switch (r_type)
+ {
+ default:
+ case R_390_GOT12:
+ case R_390_GOT16:
+ case R_390_GOT20:
+ case R_390_GOT32:
+ case R_390_GOTENT:
+ tls_type = GOT_NORMAL;
+ break;
+ case R_390_TLS_GD64:
+ tls_type = GOT_TLS_GD;
+ break;
+ case R_390_TLS_IE64:
+ case R_390_TLS_GOTIE64:
+ tls_type = GOT_TLS_IE;
+ break;
+ case R_390_TLS_GOTIE12:
+ case R_390_TLS_GOTIE20:
+ case R_390_TLS_IEENT:
+ tls_type = GOT_TLS_IE_NLT;
+ break;
+ }
+
+ if (h != NULL)
+ {
+ h->got.refcount += 1;
+ old_tls_type = elf_s390_hash_entry(h)->tls_type;
+ }
+ else
+ {
+ local_got_refcounts[r_symndx] += 1;
+ old_tls_type = elf_s390_local_got_tls_type (abfd) [r_symndx];
+ }
+ /* If a TLS symbol is accessed using IE at least once,
+ there is no point to use dynamic model for it. */
+ if (old_tls_type != tls_type && old_tls_type != GOT_UNKNOWN)
+ {
+ if (old_tls_type == GOT_NORMAL || tls_type == GOT_NORMAL)
+ {
+ (*_bfd_error_handler)
+ (_("%s: `%s' accessed both as normal and thread local symbol"),
+ bfd_archive_filename (abfd), h->root.root.string);
+ return FALSE;
+ }
+ if (old_tls_type > tls_type)
+ tls_type = old_tls_type;
+ }
+
+ if (old_tls_type != tls_type)
+ {
+ if (h != NULL)
+ elf_s390_hash_entry (h)->tls_type = tls_type;
+ else
+ elf_s390_local_got_tls_type (abfd) [r_symndx] = tls_type;
+ }
+
+ if (r_type != R_390_TLS_IE64)
+ break;
+ /* Fall through */
+
+ case R_390_TLS_LE64:
+ if (!info->shared)
+ break;
+ info->flags |= DF_STATIC_TLS;
+ /* Fall through */
+
+ case R_390_8:
+ case R_390_16:
case R_390_32:
case R_390_64:
- case R_390_PC16:
- case R_390_PC16DBL:
+ case R_390_PC16:
+ case R_390_PC16DBL:
case R_390_PC32:
case R_390_PC32DBL:
case R_390_PC64:
@@ -728,7 +1202,8 @@ elf_s390_check_relocs (abfd, info, sec, relocs)
|| h->root.type == bfd_link_hash_defweak
|| (h->elf_link_hash_flags
& ELF_LINK_HASH_DEF_REGULAR) == 0))))
- || (!info->shared
+ || (ELIMINATE_COPY_RELOCS
+ && !info->shared
&& (sec->flags & SEC_ALLOC) != 0
&& h != NULL
&& (h->root.type == bfd_link_hash_defweak
@@ -751,7 +1226,7 @@ elf_s390_check_relocs (abfd, info, sec, relocs)
elf_elfheader (abfd)->e_shstrndx,
elf_section_data (sec)->rel_hdr.sh_name));
if (name == NULL)
- return false;
+ return FALSE;
if (strncmp (name, ".rela", 5) != 0
|| strcmp (bfd_get_section_name (abfd, sec),
@@ -779,7 +1254,7 @@ elf_s390_check_relocs (abfd, info, sec, relocs)
if (sreloc == NULL
|| ! bfd_set_section_flags (dynobj, sreloc, flags)
|| ! bfd_set_section_alignment (dynobj, sreloc, 3))
- return false;
+ return FALSE;
}
elf_section_data (sec)->sreloc = sreloc;
}
@@ -800,7 +1275,7 @@ elf_s390_check_relocs (abfd, info, sec, relocs)
s = bfd_section_from_r_symndx (abfd, &htab->sym_sec,
sec, r_symndx);
if (s == NULL)
- return false;
+ return FALSE;
head = ((struct elf_s390_dyn_relocs **)
&elf_section_data (s)->local_dynrel);
@@ -813,7 +1288,7 @@ elf_s390_check_relocs (abfd, info, sec, relocs)
p = ((struct elf_s390_dyn_relocs *)
bfd_alloc (htab->elf.dynobj, amt));
if (p == NULL)
- return false;
+ return FALSE;
p->next = *head;
*head = p;
p->sec = sec;
@@ -833,24 +1308,24 @@ elf_s390_check_relocs (abfd, info, sec, relocs)
/* This relocation describes the C++ object vtable hierarchy.
Reconstruct it for later use during GC. */
- case R_390_GNU_VTINHERIT:
- if (!_bfd_elf64_gc_record_vtinherit (abfd, sec, h, rel->r_offset))
- return false;
- break;
+ case R_390_GNU_VTINHERIT:
+ if (!bfd_elf_gc_record_vtinherit (abfd, sec, h, rel->r_offset))
+ return FALSE;
+ break;
/* This relocation describes which C++ vtable entries are actually
used. Record for later use during GC. */
- case R_390_GNU_VTENTRY:
- if (!_bfd_elf64_gc_record_vtentry (abfd, sec, h, rel->r_addend))
- return false;
- break;
+ case R_390_GNU_VTENTRY:
+ if (!bfd_elf_gc_record_vtentry (abfd, sec, h, rel->r_addend))
+ return FALSE;
+ break;
default:
break;
}
}
- return true;
+ return TRUE;
}
/* Return the section that should be marked against GC for a given
@@ -895,7 +1370,7 @@ elf_s390_gc_mark_hook (sec, info, rel, h, sym)
/* Update the got entry reference counts for the section being removed. */
-static boolean
+static bfd_boolean
elf_s390_gc_sweep_hook (abfd, info, sec, relocs)
bfd *abfd;
struct bfd_link_info *info;
@@ -906,8 +1381,6 @@ elf_s390_gc_sweep_hook (abfd, info, sec, relocs)
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;
@@ -917,87 +1390,147 @@ elf_s390_gc_sweep_hook (abfd, info, sec, relocs)
relend = relocs + sec->reloc_count;
for (rel = relocs; rel < relend; rel++)
- switch (ELF64_R_TYPE (rel->r_info))
- {
- case R_390_GOT12:
- case R_390_GOT16:
- case R_390_GOT32:
- case R_390_GOT64:
- case R_390_GOTOFF:
- case R_390_GOTPC:
- case R_390_GOTPCDBL:
- case R_390_GOTENT:
- r_symndx = ELF64_R_SYM (rel->r_info);
- if (r_symndx >= symtab_hdr->sh_info)
- {
- h = sym_hashes[r_symndx - symtab_hdr->sh_info];
- if (h->got.refcount > 0)
- h->got.refcount -= 1;
- }
- else if (local_got_refcounts != NULL)
- {
- if (local_got_refcounts[r_symndx] > 0)
- local_got_refcounts[r_symndx] -= 1;
- }
- break;
-
- case R_390_8:
- case R_390_12:
- case R_390_16:
- case R_390_32:
- case R_390_64:
- case R_390_PC16:
- case R_390_PC16DBL:
- case R_390_PC32:
- case R_390_PC32DBL:
- case R_390_PC64:
- r_symndx = ELF64_R_SYM (rel->r_info);
- if (r_symndx >= symtab_hdr->sh_info)
- {
- struct elf_s390_link_hash_entry *eh;
- struct elf_s390_dyn_relocs **pp;
- struct elf_s390_dyn_relocs *p;
-
- h = sym_hashes[r_symndx - symtab_hdr->sh_info];
-
- if (!info->shared && h->plt.refcount > 0)
- h->plt.refcount -= 1;
-
- eh = (struct elf_s390_link_hash_entry *) h;
-
- for (pp = &eh->dyn_relocs; (p = *pp) != NULL; pp = &p->next)
- if (p->sec == sec)
+ {
+ unsigned long r_symndx;
+ unsigned int r_type;
+ struct elf_link_hash_entry *h = NULL;
+
+ r_symndx = ELF64_R_SYM (rel->r_info);
+ if (r_symndx >= symtab_hdr->sh_info)
+ {
+ struct elf_s390_link_hash_entry *eh;
+ struct elf_s390_dyn_relocs **pp;
+ struct elf_s390_dyn_relocs *p;
+
+ h = sym_hashes[r_symndx - symtab_hdr->sh_info];
+ eh = (struct elf_s390_link_hash_entry *) h;
+
+ for (pp = &eh->dyn_relocs; (p = *pp) != NULL; pp = &p->next)
+ if (p->sec == sec)
+ {
+ /* Everything must go for SEC. */
+ *pp = p->next;
+ break;
+ }
+ }
+
+ r_type = ELF64_R_TYPE (rel->r_info);
+ r_type = elf_s390_tls_transition (info, r_type, h != NULL);
+ switch (r_type)
+ {
+ case R_390_TLS_LDM64:
+ if (elf_s390_hash_table (info)->tls_ldm_got.refcount > 0)
+ elf_s390_hash_table (info)->tls_ldm_got.refcount -= 1;
+ break;
+
+ case R_390_TLS_GD64:
+ case R_390_TLS_IE64:
+ case R_390_TLS_GOTIE12:
+ case R_390_TLS_GOTIE20:
+ case R_390_TLS_GOTIE64:
+ case R_390_TLS_IEENT:
+ case R_390_GOT12:
+ case R_390_GOT16:
+ case R_390_GOT20:
+ case R_390_GOT32:
+ case R_390_GOT64:
+ case R_390_GOTOFF16:
+ case R_390_GOTOFF32:
+ case R_390_GOTOFF64:
+ case R_390_GOTPC:
+ case R_390_GOTPCDBL:
+ case R_390_GOTENT:
+ if (h != NULL)
+ {
+ if (h->got.refcount > 0)
+ h->got.refcount -= 1;
+ }
+ else if (local_got_refcounts != NULL)
+ {
+ if (local_got_refcounts[r_symndx] > 0)
+ local_got_refcounts[r_symndx] -= 1;
+ }
+ break;
+
+ case R_390_8:
+ case R_390_12:
+ case R_390_16:
+ case R_390_20:
+ case R_390_32:
+ case R_390_64:
+ case R_390_PC16:
+ case R_390_PC16DBL:
+ case R_390_PC32:
+ case R_390_PC32DBL:
+ case R_390_PC64:
+ if (info->shared)
+ break;
+ /* Fall through */
+
+ case R_390_PLT16DBL:
+ case R_390_PLT32:
+ case R_390_PLT32DBL:
+ case R_390_PLT64:
+ case R_390_PLTOFF16:
+ case R_390_PLTOFF32:
+ case R_390_PLTOFF64:
+ if (h != NULL)
+ {
+ if (h->plt.refcount > 0)
+ h->plt.refcount -= 1;
+ }
+ break;
+
+ case R_390_GOTPLT12:
+ case R_390_GOTPLT16:
+ case R_390_GOTPLT20:
+ case R_390_GOTPLT32:
+ case R_390_GOTPLT64:
+ case R_390_GOTPLTENT:
+ if (h != NULL)
+ {
+ if (h->plt.refcount > 0)
{
- if (ELF64_R_TYPE (rel->r_info) == R_390_PC16
- || ELF64_R_TYPE (rel->r_info) == R_390_PC16DBL
- || ELF64_R_TYPE (rel->r_info) == R_390_PC32)
- p->pc_count -= 1;
- p->count -= 1;
- if (p->count == 0)
- *pp = p->next;
- break;
+ ((struct elf_s390_link_hash_entry *) h)->gotplt_refcount--;
+ h->plt.refcount -= 1;
}
- }
- break;
-
- case R_390_PLT16DBL:
- case R_390_PLT32:
- case R_390_PLT32DBL:
- case R_390_PLT64:
- r_symndx = ELF64_R_SYM (rel->r_info);
- if (r_symndx >= symtab_hdr->sh_info)
- {
- h = sym_hashes[r_symndx - symtab_hdr->sh_info];
- if (h->plt.refcount > 0)
- h->plt.refcount -= 1;
- }
- break;
-
- default:
- break;
- }
-
- return true;
+ }
+ else if (local_got_refcounts != NULL)
+ {
+ if (local_got_refcounts[r_symndx] > 0)
+ local_got_refcounts[r_symndx] -= 1;
+ }
+ break;
+
+ default:
+ break;
+ }
+ }
+
+ return TRUE;
+}
+
+/* Make sure we emit a GOT entry if the symbol was supposed to have a PLT
+ entry but we found we will not create any. Called when we find we will
+ not have any PLT for this symbol, by for example
+ elf_s390_adjust_dynamic_symbol when we're doing a proper dynamic link,
+ or elf_s390_size_dynamic_sections if no dynamic sections will be
+ created (we're only linking static objects). */
+
+static void
+elf_s390_adjust_gotplt (h)
+ struct elf_s390_link_hash_entry *h;
+{
+ if (h->elf.root.type == bfd_link_hash_warning)
+ h = (struct elf_s390_link_hash_entry *) h->elf.root.u.i.link;
+
+ if (h->gotplt_refcount <= 0)
+ return;
+
+ /* We simply add the number of gotplt references to the number
+ * of got references for this symbol. */
+ h->elf.got.refcount += h->gotplt_refcount;
+ h->gotplt_refcount = -1;
}
/* Adjust a symbol defined by a dynamic object and referenced by a
@@ -1006,14 +1539,12 @@ elf_s390_gc_sweep_hook (abfd, info, sec, relocs)
change the definition to something the rest of the link can
understand. */
-static boolean
+static bfd_boolean
elf_s390_adjust_dynamic_symbol (info, h)
struct bfd_link_info *info;
struct elf_link_hash_entry *h;
{
struct elf_s390_link_hash_table *htab;
- struct elf_s390_link_hash_entry * eh;
- struct elf_s390_dyn_relocs *p;
asection *s;
unsigned int power_of_two;
@@ -1031,15 +1562,16 @@ elf_s390_adjust_dynamic_symbol (info, h)
&& h->root.type != bfd_link_hash_undefined))
{
/* This case can occur if we saw a PLT32 reloc in an input
- file, but the symbol was never referred to by a dynamic
- object, or if all references were garbage collected. In
+ file, but the symbol was never referred to by a dynamic
+ object, or if all references were garbage collected. In
such a case, we don't actually need to build a procedure
linkage table, and we can just do a PC32 reloc instead. */
h->plt.offset = (bfd_vma) -1;
h->elf_link_hash_flags &= ~ELF_LINK_HASH_NEEDS_PLT;
+ elf_s390_adjust_gotplt((struct elf_s390_link_hash_entry *) h);
}
- return true;
+ return TRUE;
}
else
/* It's possible that we incorrectly decided a .plt reloc was
@@ -1058,7 +1590,11 @@ elf_s390_adjust_dynamic_symbol (info, h)
|| h->weakdef->root.type == bfd_link_hash_defweak);
h->root.u.def.section = h->weakdef->root.u.def.section;
h->root.u.def.value = h->weakdef->root.u.def.value;
- return true;
+ if (ELIMINATE_COPY_RELOCS || info->nocopyreloc)
+ h->elf_link_hash_flags
+ = ((h->elf_link_hash_flags & ~ELF_LINK_NON_GOT_REF)
+ | (h->weakdef->elf_link_hash_flags & ELF_LINK_NON_GOT_REF));
+ return TRUE;
}
/* This is a reference to a symbol defined by a dynamic object which
@@ -1069,34 +1605,40 @@ elf_s390_adjust_dynamic_symbol (info, h)
For such cases we need not do anything here; the relocations will
be handled correctly by relocate_section. */
if (info->shared)
- return true;
+ 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;
+ return TRUE;
/* If -z nocopyreloc was given, we won't generate them either. */
if (info->nocopyreloc)
{
h->elf_link_hash_flags &= ~ELF_LINK_NON_GOT_REF;
- return true;
+ return TRUE;
}
- eh = (struct elf_s390_link_hash_entry *) h;
- for (p = eh->dyn_relocs; p != NULL; p = p->next)
+ if (ELIMINATE_COPY_RELOCS)
{
- s = p->sec->output_section;
- if (s != NULL && (s->flags & SEC_READONLY) != 0)
- break;
- }
+ struct elf_s390_link_hash_entry * eh;
+ struct elf_s390_dyn_relocs *p;
- /* 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;
+ eh = (struct elf_s390_link_hash_entry *) h;
+ for (p = eh->dyn_relocs; p != NULL; p = p->next)
+ {
+ s = p->sec->output_section;
+ if (s != NULL && (s->flags & SEC_READONLY) != 0)
+ break;
+ }
+
+ /* If we didn't find any dynamic relocs in read-only sections, then
+ we'll be keeping the dynamic relocs and avoiding the copy reloc. */
+ if (p == NULL)
+ {
+ h->elf_link_hash_flags &= ~ELF_LINK_NON_GOT_REF;
+ return TRUE;
+ }
}
/* We must allocate the symbol in our .dynbss section, which will
@@ -1132,7 +1674,7 @@ elf_s390_adjust_dynamic_symbol (info, h)
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;
+ return FALSE;
}
/* Define the symbol as being at this point in the section. */
@@ -1142,24 +1684,13 @@ elf_s390_adjust_dynamic_symbol (info, h)
/* Increment the section size to make room for the symbol. */
s->_raw_size += h->size;
- return true;
+ return TRUE;
}
-/* This is the condition under which elf_s390_finish_dynamic_symbol
- will be called from elflink.h. If elflink.h doesn't call our
- finish_dynamic_symbol routine, we'll need to do something about
- initializing any .plt and .got entries in elf_s390_relocate_section. */
-#define WILL_CALL_FINISH_DYNAMIC_SYMBOL(DYN, INFO, H) \
- ((DYN) \
- && ((INFO)->shared \
- || ((H)->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0) \
- && ((H)->dynindx != -1 \
- || ((H)->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) != 0))
-
/* Allocate space in .plt, .got and associated reloc sections for
dynamic relocs. */
-static boolean
+static bfd_boolean
allocate_dynrelocs (h, inf)
struct elf_link_hash_entry *h;
PTR inf;
@@ -1170,27 +1701,33 @@ allocate_dynrelocs (h, inf)
struct elf_s390_dyn_relocs *p;
if (h->root.type == bfd_link_hash_indirect)
- return true;
+ return TRUE;
if (h->root.type == bfd_link_hash_warning)
+ /* When warning symbols are created, they **replace** the "real"
+ entry in the hash table, thus we never get to see the real
+ symbol in a hash traversal. So look at it now. */
h = (struct elf_link_hash_entry *) h->root.u.i.link;
info = (struct bfd_link_info *) inf;
htab = elf_s390_hash_table (info);
if (htab->elf.dynamic_sections_created
- && h->plt.refcount > 0)
+ && h->plt.refcount > 0
+ && (ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
+ || h->root.type != bfd_link_hash_undefweak))
{
/* Make sure this symbol is output as a dynamic symbol.
Undefined weak syms won't yet be marked as dynamic. */
if (h->dynindx == -1
&& (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0)
{
- if (! bfd_elf64_link_record_dynamic_symbol (info, h))
- return false;
+ if (! bfd_elf_link_record_dynamic_symbol (info, h))
+ return FALSE;
}
- if (WILL_CALL_FINISH_DYNAMIC_SYMBOL (1, info, h))
+ if (info->shared
+ || WILL_CALL_FINISH_DYNAMIC_SYMBOL (1, 0, h))
{
asection *s = htab->splt;
@@ -1227,33 +1764,69 @@ allocate_dynrelocs (h, inf)
{
h->plt.offset = (bfd_vma) -1;
h->elf_link_hash_flags &= ~ELF_LINK_HASH_NEEDS_PLT;
+ elf_s390_adjust_gotplt((struct elf_s390_link_hash_entry *) h);
}
}
else
{
h->plt.offset = (bfd_vma) -1;
h->elf_link_hash_flags &= ~ELF_LINK_HASH_NEEDS_PLT;
+ elf_s390_adjust_gotplt((struct elf_s390_link_hash_entry *) h);
}
- if (h->got.refcount > 0)
+ /* If R_390_TLS_{IE64,GOTIE64,GOTIE12,IEENT} symbol is now local to
+ the binary, we can optimize a bit. IE64 and GOTIE64 get converted
+ to R_390_TLS_LE64 requiring no TLS entry. For GOTIE12 and IEENT
+ we can save the dynamic TLS relocation. */
+ if (h->got.refcount > 0
+ && !info->shared
+ && h->dynindx == -1
+ && elf_s390_hash_entry(h)->tls_type >= GOT_TLS_IE)
+ {
+ if (elf_s390_hash_entry(h)->tls_type == GOT_TLS_IE_NLT)
+ /* For the GOTIE access without a literal pool entry the offset has
+ to be stored somewhere. The immediate value in the instruction
+ is not bit enough so the value is stored in the got. */
+ {
+ h->got.offset = htab->sgot->_raw_size;
+ htab->sgot->_raw_size += GOT_ENTRY_SIZE;
+ }
+ else
+ h->got.offset = (bfd_vma) -1;
+ }
+ else if (h->got.refcount > 0)
{
asection *s;
- boolean dyn;
+ bfd_boolean dyn;
+ int tls_type = elf_s390_hash_entry(h)->tls_type;
/* Make sure this symbol is output as a dynamic symbol.
Undefined weak syms won't yet be marked as dynamic. */
if (h->dynindx == -1
&& (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0)
{
- if (! bfd_elf64_link_record_dynamic_symbol (info, h))
- return false;
+ if (! bfd_elf_link_record_dynamic_symbol (info, h))
+ return FALSE;
}
s = htab->sgot;
h->got.offset = s->_raw_size;
s->_raw_size += GOT_ENTRY_SIZE;
+ /* R_390_TLS_GD64 needs 2 consecutive GOT slots. */
+ if (tls_type == GOT_TLS_GD)
+ s->_raw_size += GOT_ENTRY_SIZE;
dyn = htab->elf.dynamic_sections_created;
- if (WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, info, h))
+ /* R_390_TLS_IE64 needs one dynamic relocation,
+ R_390_TLS_GD64 needs one if local symbol and two if global. */
+ if ((tls_type == GOT_TLS_GD && h->dynindx == -1)
+ || tls_type >= GOT_TLS_IE)
+ htab->srelgot->_raw_size += sizeof (Elf64_External_Rela);
+ else if (tls_type == GOT_TLS_GD)
+ htab->srelgot->_raw_size += 2 * sizeof (Elf64_External_Rela);
+ else if ((ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
+ || h->root.type != bfd_link_hash_undefweak)
+ && (info->shared
+ || WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, 0, h)))
htab->srelgot->_raw_size += sizeof (Elf64_External_Rela);
}
else
@@ -1261,7 +1834,7 @@ allocate_dynrelocs (h, inf)
eh = (struct elf_s390_link_hash_entry *) h;
if (eh->dyn_relocs == NULL)
- return true;
+ return TRUE;
/* In the shared -Bsymbolic case, discard space allocated for
dynamic pc-relative relocs against symbols which turn out to be
@@ -1271,9 +1844,7 @@ allocate_dynrelocs (h, inf)
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))
+ if (SYMBOL_REFERENCES_LOCAL (info, h))
{
struct elf_s390_dyn_relocs **pp;
@@ -1287,8 +1858,14 @@ allocate_dynrelocs (h, inf)
pp = &p->next;
}
}
+
+ /* Also discard relocs on undefined weak syms with non-default
+ visibility. */
+ if (ELF_ST_VISIBILITY (h->other) != STV_DEFAULT
+ && h->root.type == bfd_link_hash_undefweak)
+ eh->dyn_relocs = NULL;
}
- else
+ 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
@@ -1306,8 +1883,8 @@ allocate_dynrelocs (h, inf)
if (h->dynindx == -1
&& (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0)
{
- if (! bfd_elf64_link_record_dynamic_symbol (info, h))
- return false;
+ if (! bfd_elf_link_record_dynamic_symbol (info, h))
+ return FALSE;
}
/* If that succeeded, we know we'll be keeping all the
@@ -1328,12 +1905,12 @@ allocate_dynrelocs (h, inf)
sreloc->_raw_size += p->count * sizeof (Elf64_External_Rela);
}
- return true;
+ return TRUE;
}
/* Find any dynamic relocs that apply to read-only sections. */
-static boolean
+static bfd_boolean
readonly_dynrelocs (h, inf)
struct elf_link_hash_entry *h;
PTR inf;
@@ -1356,15 +1933,15 @@ readonly_dynrelocs (h, inf)
info->flags |= DF_TEXTREL;
/* Not an error, just cut short the traversal. */
- return false;
+ return FALSE;
}
}
- return true;
+ return TRUE;
}
/* Set the sizes of the dynamic sections. */
-static boolean
+static bfd_boolean
elf_s390_size_dynamic_sections (output_bfd, info)
bfd *output_bfd ATTRIBUTE_UNUSED;
struct bfd_link_info *info;
@@ -1372,7 +1949,7 @@ elf_s390_size_dynamic_sections (output_bfd, info)
struct elf_s390_link_hash_table *htab;
bfd *dynobj;
asection *s;
- boolean relocs;
+ bfd_boolean relocs;
bfd *ibfd;
htab = elf_s390_hash_table (info);
@@ -1383,7 +1960,7 @@ elf_s390_size_dynamic_sections (output_bfd, info)
if (htab->elf.dynamic_sections_created)
{
/* Set the contents of the .interp section to the interpreter. */
- if (! info->shared)
+ if (info->executable)
{
s = bfd_get_section_by_name (dynobj, ".interp");
if (s == NULL)
@@ -1399,6 +1976,7 @@ elf_s390_size_dynamic_sections (output_bfd, info)
{
bfd_signed_vma *local_got;
bfd_signed_vma *end_local_got;
+ char *local_tls_type;
bfd_size_type locsymcount;
Elf_Internal_Shdr *symtab_hdr;
asection *srela;
@@ -1440,14 +2018,17 @@ elf_s390_size_dynamic_sections (output_bfd, info)
symtab_hdr = &elf_tdata (ibfd)->symtab_hdr;
locsymcount = symtab_hdr->sh_info;
end_local_got = local_got + locsymcount;
+ local_tls_type = elf_s390_local_got_tls_type (ibfd);
s = htab->sgot;
srela = htab->srelgot;
- for (; local_got < end_local_got; ++local_got)
+ for (; local_got < end_local_got; ++local_got, ++local_tls_type)
{
if (*local_got > 0)
{
*local_got = s->_raw_size;
s->_raw_size += GOT_ENTRY_SIZE;
+ if (*local_tls_type == GOT_TLS_GD)
+ s->_raw_size += GOT_ENTRY_SIZE;
if (info->shared)
srela->_raw_size += sizeof (Elf64_External_Rela);
}
@@ -1456,13 +2037,24 @@ elf_s390_size_dynamic_sections (output_bfd, info)
}
}
+ if (htab->tls_ldm_got.refcount > 0)
+ {
+ /* Allocate 2 got entries and 1 dynamic reloc for R_390_TLS_LDM64
+ relocs. */
+ htab->tls_ldm_got.offset = htab->sgot->_raw_size;
+ htab->sgot->_raw_size += 2 * GOT_ENTRY_SIZE;
+ htab->srelgot->_raw_size += sizeof (Elf64_External_Rela);
+ }
+ else
+ htab->tls_ldm_got.offset = -1;
+
/* Allocate global sym .plt and .got entries, and space for global
sym dynamic relocs. */
elf_link_hash_traverse (&htab->elf, allocate_dynrelocs, (PTR) info);
/* We now have determined the sizes of the various dynamic sections.
Allocate memory for them. */
- relocs = false;
+ relocs = FALSE;
for (s = dynobj->sections; s != NULL; s = s->next)
{
if ((s->flags & SEC_LINKER_CREATED) == 0)
@@ -1478,7 +2070,7 @@ elf_s390_size_dynamic_sections (output_bfd, info)
else if (strncmp (bfd_get_section_name (dynobj, s), ".rela", 5) == 0)
{
if (s->_raw_size != 0 && s != htab->srelplt)
- relocs = true;
+ relocs = TRUE;
/* We use the reloc_count field as a counter if we need
to copy relocs into the output file. */
@@ -1513,7 +2105,7 @@ elf_s390_size_dynamic_sections (output_bfd, info)
of garbage. */
s->contents = (bfd_byte *) bfd_zalloc (dynobj, s->_raw_size);
if (s->contents == NULL)
- return false;
+ return FALSE;
}
if (htab->elf.dynamic_sections_created)
@@ -1524,12 +2116,12 @@ elf_s390_size_dynamic_sections (output_bfd, info)
the .dynamic section. The DT_DEBUG entry is filled in by the
dynamic linker and used by the debugger. */
#define add_dynamic_entry(TAG, VAL) \
- bfd_elf64_add_dynamic_entry (info, (bfd_vma) (TAG), (bfd_vma) (VAL))
+ _bfd_elf_add_dynamic_entry (info, TAG, VAL)
- if (! info->shared)
+ if (info->executable)
{
if (!add_dynamic_entry (DT_DEBUG, 0))
- return false;
+ return FALSE;
}
if (htab->splt->_raw_size != 0)
@@ -1538,15 +2130,15 @@ elf_s390_size_dynamic_sections (output_bfd, info)
|| !add_dynamic_entry (DT_PLTRELSZ, 0)
|| !add_dynamic_entry (DT_PLTREL, DT_RELA)
|| !add_dynamic_entry (DT_JMPREL, 0))
- return false;
+ return FALSE;
}
if (relocs)
- {
- if (!add_dynamic_entry (DT_RELA, 0)
- || !add_dynamic_entry (DT_RELASZ, 0)
- || !add_dynamic_entry (DT_RELAENT, sizeof (Elf64_External_Rela)))
- return false;
+ {
+ if (!add_dynamic_entry (DT_RELA, 0)
+ || !add_dynamic_entry (DT_RELASZ, 0)
+ || !add_dynamic_entry (DT_RELAENT, sizeof (Elf64_External_Rela)))
+ return FALSE;
/* If any dynamic relocs apply to a read-only section,
then we need a DT_TEXTREL entry. */
@@ -1557,18 +2149,68 @@ elf_s390_size_dynamic_sections (output_bfd, info)
if ((info->flags & DF_TEXTREL) != 0)
{
if (!add_dynamic_entry (DT_TEXTREL, 0))
- return false;
+ return FALSE;
}
}
}
#undef add_dynamic_entry
- return 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. */
+
+static bfd_vma
+dtpoff_base (info)
+ struct bfd_link_info *info;
+{
+ /* If tls_sec is NULL, we should have signalled an error already. */
+ if (elf_hash_table (info)->tls_sec == NULL)
+ return 0;
+ return elf_hash_table (info)->tls_sec->vma;
+}
+
+/* Return the relocation value for @tpoff relocation
+ if STT_TLS virtual address is ADDRESS. */
+
+static bfd_vma
+tpoff (info, address)
+ struct bfd_link_info *info;
+ bfd_vma address;
+{
+ struct elf_link_hash_table *htab = elf_hash_table (info);
+
+ /* If tls_sec is NULL, we should have signalled an error already. */
+ if (htab->tls_sec == NULL)
+ return 0;
+ return htab->tls_size + htab->tls_sec->vma - address;
+}
+
+/* Complain if TLS instruction relocation is against an invalid
+ instruction. */
+
+static void
+invalid_tls_insn (input_bfd, input_section, rel)
+ bfd *input_bfd;
+ asection *input_section;
+ Elf_Internal_Rela *rel;
+{
+ reloc_howto_type *howto;
+
+ howto = elf_howto_table + ELF64_R_TYPE (rel->r_info);
+ (*_bfd_error_handler)
+ (_("%s(%s+0x%lx): invalid instruction for TLS relocation %s"),
+ bfd_archive_filename (input_bfd),
+ bfd_get_section_name (input_bfd, input_section),
+ (long) rel->r_offset,
+ howto->name);
}
/* Relocate a 390 ELF section. */
-static boolean
+static bfd_boolean
elf_s390_relocate_section (output_bfd, info, input_bfd, input_section,
contents, relocs, local_syms, local_sections)
bfd *output_bfd;
@@ -1587,8 +2229,8 @@ elf_s390_relocate_section (output_bfd, info, input_bfd, input_section,
Elf_Internal_Rela *rel;
Elf_Internal_Rela *relend;
- if (info->relocateable)
- return true;
+ if (info->relocatable)
+ return TRUE;
htab = elf_s390_hash_table (info);
symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr;
@@ -1599,7 +2241,7 @@ elf_s390_relocate_section (output_bfd, info, input_bfd, input_section,
relend = relocs + input_section->reloc_count;
for (; rel < relend; rel++)
{
- int r_type;
+ unsigned int r_type;
reloc_howto_type *howto;
unsigned long r_symndx;
struct elf_link_hash_entry *h;
@@ -1607,256 +2249,287 @@ elf_s390_relocate_section (output_bfd, info, input_bfd, input_section,
asection *sec;
bfd_vma off;
bfd_vma relocation;
- boolean unresolved_reloc;
+ bfd_boolean unresolved_reloc;
bfd_reloc_status_type r;
+ int tls_type;
r_type = ELF64_R_TYPE (rel->r_info);
if (r_type == (int) R_390_GNU_VTINHERIT
- || r_type == (int) R_390_GNU_VTENTRY)
- continue;
- if (r_type < 0 || r_type >= (int) R_390_max)
+ || r_type == (int) R_390_GNU_VTENTRY)
+ continue;
+ if (r_type >= (int) R_390_max)
{
bfd_set_error (bfd_error_bad_value);
- return false;
+ return FALSE;
}
howto = elf_howto_table + r_type;
r_symndx = ELF64_R_SYM (rel->r_info);
+
+ /* This is a final link. */
h = NULL;
sym = NULL;
sec = NULL;
- unresolved_reloc = false;
+ 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);
+ relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel);
}
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;
+ bfd_boolean warned ATTRIBUTE_UNUSED;
- if (h->root.type == bfd_link_hash_defined
- || h->root.type == bfd_link_hash_defweak)
- {
- sec = h->root.u.def.section;
- if (sec->output_section == NULL)
- {
- /* Set a flag that will be cleared later if we find a
- relocation value for this symbol. output_section
- is typically NULL for symbols satisfied by a shared
- library. */
- unresolved_reloc = true;
- relocation = 0;
- }
- else
- relocation = (h->root.u.def.value
- + sec->output_section->vma
- + sec->output_offset);
- }
- else if (h->root.type == bfd_link_hash_undefweak)
- relocation = 0;
- else if (info->shared
- && (!info->symbolic || info->allow_shlib_undefined)
- && !info->no_undefined
- && ELF_ST_VISIBILITY (h->other) == STV_DEFAULT)
- relocation = 0;
- else
- {
- if (! ((*info->callbacks->undefined_symbol)
- (info, h->root.root.string, input_bfd,
- input_section, rel->r_offset,
- (!info->shared || info->no_undefined
- || ELF_ST_VISIBILITY (h->other)))))
- return false;
- relocation = 0;
- }
+ RELOC_FOR_GLOBAL_SYMBOL (info, input_bfd, input_section, rel,
+ r_symndx, symtab_hdr, sym_hashes,
+ h, sec, relocation,
+ unresolved_reloc, warned);
}
switch (r_type)
{
- case R_390_GOT12:
- case R_390_GOT16:
- case R_390_GOT32:
- case R_390_GOT64:
- case R_390_GOTENT:
- /* Relocation is to the entry for this symbol in the global
- offset table. */
+ case R_390_GOTPLT12:
+ case R_390_GOTPLT16:
+ case R_390_GOTPLT20:
+ case R_390_GOTPLT32:
+ case R_390_GOTPLT64:
+ case R_390_GOTPLTENT:
+ /* There are three cases for a GOTPLT relocation. 1) The
+ relocation is against the jump slot entry of a plt that
+ will get emitted to the output file. 2) The relocation
+ is against the jump slot of a plt entry that has been
+ removed. elf_s390_adjust_gotplt has created a GOT entry
+ as replacement. 3) The relocation is against a local symbol.
+ Cases 2) and 3) are the same as the GOT relocation code
+ so we just have to test for case 1 and fall through for
+ the other two. */
+ if (h != NULL && h->plt.offset != (bfd_vma) -1)
+ {
+ bfd_vma plt_index;
+
+ /* Calc. index no.
+ Current offset - size first entry / entry size. */
+ plt_index = (h->plt.offset - PLT_FIRST_ENTRY_SIZE) /
+ PLT_ENTRY_SIZE;
+
+ /* Offset in GOT is PLT index plus GOT headers(3) times 4,
+ addr & GOT addr. */
+ relocation = (plt_index + 3) * GOT_ENTRY_SIZE;
+ unresolved_reloc = FALSE;
+
+ if (r_type == R_390_GOTPLTENT)
+ relocation += htab->sgot->output_section->vma;
+ break;
+ }
+ /* Fall through. */
+
+ case R_390_GOT12:
+ case R_390_GOT16:
+ case R_390_GOT20:
+ case R_390_GOT32:
+ case R_390_GOT64:
+ case R_390_GOTENT:
+ /* Relocation is to the entry for this symbol in the global
+ offset table. */
if (htab->sgot == NULL)
abort ();
- if (h != NULL)
- {
- boolean dyn;
+ if (h != NULL)
+ {
+ bfd_boolean dyn;
- off = h->got.offset;
+ off = h->got.offset;
dyn = htab->elf.dynamic_sections_created;
- if (! WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, info, h)
- || (info->shared
- && (info->symbolic
+ 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 2, we use the
- least significant bit to record whether we have
- initialized it already.
-
- When doing a dynamic link, we create a .rel.got
- relocation entry to initialize the value. This
- is done in the finish_dynamic_symbol routine. */
- if ((off & 1) != 0)
- off &= ~1;
- else
- {
+ && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR))
+ || (ELF_ST_VISIBILITY (h->other)
+ && h->root.type == bfd_link_hash_undefweak))
+ {
+ /* This is actually a static link, or it is a
+ -Bsymbolic link and the symbol is defined
+ locally, or the symbol was forced to be local
+ because of a version file. We must initialize
+ this entry in the global offset table. Since the
+ offset must always be a multiple of 2, we use the
+ least significant bit to record whether we have
+ initialized it already.
+
+ When doing a dynamic link, we create a .rel.got
+ relocation entry to initialize the value. This
+ is done in the finish_dynamic_symbol routine. */
+ if ((off & 1) != 0)
+ off &= ~1;
+ else
+ {
bfd_put_64 (output_bfd, relocation,
htab->sgot->contents + off);
- h->got.offset |= 1;
- }
- }
+ h->got.offset |= 1;
+ }
+ }
else
- unresolved_reloc = false;
- }
- else
- {
+ unresolved_reloc = FALSE;
+ }
+ else
+ {
if (local_got_offsets == NULL)
abort ();
- off = local_got_offsets[r_symndx];
+ off = local_got_offsets[r_symndx];
- /* The offset must always be a multiple of 8. We use
- the least significant bit to record whether we have
- already generated the necessary reloc. */
- if ((off & 1) != 0)
- off &= ~1;
- else
- {
- bfd_put_64 (output_bfd, relocation,
+ /* The offset must always be a multiple of 8. We use
+ the least significant bit to record whether we have
+ already generated the necessary reloc. */
+ if ((off & 1) != 0)
+ off &= ~1;
+ else
+ {
+ bfd_put_64 (output_bfd, relocation,
htab->sgot->contents + off);
- if (info->shared)
- {
- asection *srelgot;
- Elf_Internal_Rela outrel;
- Elf64_External_Rela *loc;
+ if (info->shared)
+ {
+ asection *s;
+ Elf_Internal_Rela outrel;
+ bfd_byte *loc;
- srelgot = htab->srelgot;
- if (srelgot == NULL)
+ s = htab->srelgot;
+ if (s == NULL)
abort ();
- outrel.r_offset = (htab->sgot->output_section->vma
- + htab->sgot->output_offset
- + off);
- outrel.r_info = ELF64_R_INFO (0, R_390_RELATIVE);
+ outrel.r_offset = (htab->sgot->output_section->vma
+ + htab->sgot->output_offset
+ + off);
+ outrel.r_info = ELF64_R_INFO (0, R_390_RELATIVE);
outrel.r_addend = relocation;
- loc = (Elf64_External_Rela *) srelgot->contents;
- loc += srelgot->reloc_count++;
- bfd_elf64_swap_reloca_out (output_bfd, &outrel, loc);
- }
+ loc = s->contents;
+ loc += s->reloc_count++ * sizeof (Elf64_External_Rela);
+ bfd_elf64_swap_reloca_out (output_bfd, &outrel, loc);
+ }
- local_got_offsets[r_symndx] |= 1;
- }
- }
+ local_got_offsets[r_symndx] |= 1;
+ }
+ }
if (off >= (bfd_vma) -2)
abort ();
relocation = htab->sgot->output_offset + off;
- /*
- * For @GOTENT the relocation is against the offset between
- * the instruction and the symbols entry in the GOT and not
- * between the start of the GOT and the symbols entry. We
- * add the vma of the GOT to get the correct value.
- */
- if (r_type == R_390_GOTENT)
+ /* For @GOTENT the relocation is against the offset between
+ the instruction and the symbols entry in the GOT and not
+ between the start of the GOT and the symbols entry. We
+ add the vma of the GOT to get the correct value. */
+ if ( r_type == R_390_GOTENT
+ || r_type == R_390_GOTPLTENT)
relocation += htab->sgot->output_section->vma;
- break;
+ break;
+
+ case R_390_GOTOFF16:
+ case R_390_GOTOFF32:
+ case R_390_GOTOFF64:
+ /* Relocation is relative to the start of the global offset
+ table. */
+
+ /* Note that sgot->output_offset is not involved in this
+ calculation. We always want the start of .got. If we
+ defined _GLOBAL_OFFSET_TABLE in a different way, as is
+ permitted by the ABI, we might have to change this
+ calculation. */
+ relocation -= htab->sgot->output_section->vma;
+ break;
+
+ case R_390_GOTPC:
+ case R_390_GOTPCDBL:
+ /* Use global offset table as symbol value. */
+ relocation = htab->sgot->output_section->vma;
+ unresolved_reloc = FALSE;
+ break;
- case R_390_GOTOFF:
- /* Relocation is relative to the start of the global offset
- table. */
+ case R_390_PLT16DBL:
+ case R_390_PLT32:
+ case R_390_PLT32DBL:
+ case R_390_PLT64:
+ /* Relocation is to the entry for this symbol in the
+ procedure linkage table. */
- /* Note that sgot->output_offset is not involved in this
- calculation. We always want the start of .got. If we
- defined _GLOBAL_OFFSET_TABLE in a different way, as is
- permitted by the ABI, we might have to change this
- calculation. */
- relocation -= htab->sgot->output_section->vma;
+ /* Resolve a PLT32 reloc against a local symbol directly,
+ without using the procedure linkage table. */
+ if (h == NULL)
+ break;
- 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;
+ }
- case R_390_GOTPC:
- case R_390_GOTPCDBL:
- /* Use global offset table as symbol value. */
- relocation = htab->sgot->output_section->vma;
- unresolved_reloc = false;
- break;
-
- case R_390_PLT16DBL:
- case R_390_PLT32:
- case R_390_PLT32DBL:
- case R_390_PLT64:
- /* Relocation is to the entry for this symbol in the
- procedure linkage table. */
-
- /* Resolve a PLT32 reloc against a local symbol directly,
- without using the procedure linkage table. */
- if (h == NULL)
- break;
-
- if (h->plt.offset == (bfd_vma) -1
+ relocation = (htab->splt->output_section->vma
+ + htab->splt->output_offset
+ + h->plt.offset);
+ unresolved_reloc = FALSE;
+ break;
+
+ case R_390_PLTOFF16:
+ case R_390_PLTOFF32:
+ case R_390_PLTOFF64:
+ /* Relocation is to the entry for this symbol in the
+ procedure linkage table relative to the start of the GOT. */
+
+ /* For local symbols or if we didn't make a PLT entry for
+ this symbol resolve the symbol directly. */
+ if ( h == NULL
+ || h->plt.offset == (bfd_vma) -1
|| htab->splt == NULL)
- {
- /* We didn't make a PLT entry for this symbol. This
- happens when statically linking PIC code, or when
- using -Bsymbolic. */
- break;
- }
-
- relocation = (htab->splt->output_section->vma
- + htab->splt->output_offset
- + h->plt.offset);
- unresolved_reloc = false;
- break;
-
- case R_390_8:
- case R_390_16:
- case R_390_32:
- case R_390_64:
- case R_390_PC16:
- case R_390_PC16DBL:
- case R_390_PC32:
+ {
+ relocation -= htab->sgot->output_section->vma;
+ break;
+ }
+
+ relocation = (htab->splt->output_section->vma
+ + htab->splt->output_offset
+ + h->plt.offset
+ - htab->sgot->output_section->vma);
+ unresolved_reloc = FALSE;
+ break;
+
+ case R_390_8:
+ case R_390_16:
+ case R_390_32:
+ case R_390_64:
+ case R_390_PC16:
+ case R_390_PC16DBL:
+ case R_390_PC32:
case R_390_PC32DBL:
- case R_390_PC64:
+ 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 (r_symndx == 0
+ || (input_section->flags & SEC_ALLOC) == 0)
break;
- if ((info->shared
+ if ((info->shared
+ && (h == NULL
+ || ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
+ || h->root.type != bfd_link_hash_undefweak)
&& ((r_type != R_390_PC16
&& r_type != R_390_PC16DBL
&& r_type != R_390_PC32
&& r_type != R_390_PC32DBL
&& r_type != R_390_PC64)
|| (h != NULL
- && h->dynindx != -1
- && (! info->symbolic
- || (h->elf_link_hash_flags
- & ELF_LINK_HASH_DEF_REGULAR) == 0))))
- || (!info->shared
+ && !SYMBOL_REFERENCES_LOCAL (info, h))))
+ || (ELIMINATE_COPY_RELOCS
+ && !info->shared
&& h != NULL
&& h->dynindx != -1
&& (h->elf_link_hash_flags & ELF_LINK_NON_GOT_REF) == 0
@@ -1866,33 +2539,32 @@ elf_s390_relocate_section (output_bfd, info, input_bfd, input_section,
& ELF_LINK_HASH_DEF_REGULAR) == 0)
|| h->root.type == bfd_link_hash_undefweak
|| h->root.type == bfd_link_hash_undefined)))
- {
- Elf_Internal_Rela outrel;
- boolean skip, relocate;
+ {
+ Elf_Internal_Rela outrel;
+ bfd_boolean skip, relocate;
asection *sreloc;
- Elf64_External_Rela *loc;
+ bfd_byte *loc;
- /* When generating a shared object, these relocations
- are copied into the output file to be resolved at run
- time. */
-
- skip = false;
- relocate = false;
+ /* When generating a shared object, these relocations
+ are copied into the output file to be resolved at run
+ time. */
+ skip = FALSE;
+ relocate = FALSE;
outrel.r_offset =
_bfd_elf_section_offset (output_bfd, info, input_section,
rel->r_offset);
if (outrel.r_offset == (bfd_vma) -1)
- skip = true;
+ skip = TRUE;
else if (outrel.r_offset == (bfd_vma) -2)
- skip = true, relocate = true;
+ skip = TRUE, relocate = TRUE;
- outrel.r_offset += (input_section->output_section->vma
- + input_section->output_offset);
+ outrel.r_offset += (input_section->output_section->vma
+ + input_section->output_offset);
- if (skip)
+ if (skip)
memset (&outrel, 0, sizeof outrel);
- else if (h != NULL
+ else if (h != NULL
&& h->dynindx != -1
&& (r_type == R_390_PC16
|| r_type == R_390_PC16DBL
@@ -1903,39 +2575,412 @@ elf_s390_relocate_section (output_bfd, info, input_bfd, input_section,
|| !info->symbolic
|| (h->elf_link_hash_flags
& ELF_LINK_HASH_DEF_REGULAR) == 0))
- {
- outrel.r_info = ELF64_R_INFO (h->dynindx, r_type);
+ {
+ outrel.r_info = ELF64_R_INFO (h->dynindx, r_type);
outrel.r_addend = rel->r_addend;
- }
- else
- {
+ }
+ else
+ {
/* This symbol is local, or marked to become local. */
- relocate = true;
- outrel.r_info = ELF64_R_INFO (0, R_390_RELATIVE);
outrel.r_addend = relocation + rel->r_addend;
+ if (r_type == R_390_64)
+ {
+ relocate = TRUE;
+ outrel.r_info = ELF64_R_INFO (0, R_390_RELATIVE);
+ }
+ else
+ {
+ long sindx;
+
+ if (bfd_is_abs_section (sec))
+ sindx = 0;
+ else if (sec == NULL || sec->owner == NULL)
+ {
+ bfd_set_error(bfd_error_bad_value);
+ return FALSE;
+ }
+ else
+ {
+ asection *osec;
+
+ osec = sec->output_section;
+ sindx = elf_section_data (osec)->dynindx;
+ BFD_ASSERT (sindx > 0);
+
+ /* We are turning this relocation into one
+ against a section symbol, so subtract out
+ the output section's address but not the
+ offset of the input section in the output
+ section. */
+
+ outrel.r_addend -= osec->vma;
+ }
+ outrel.r_info = ELF64_R_INFO (sindx, r_type);
+ }
+ }
+
+ sreloc = elf_section_data (input_section)->sreloc;
+ if (sreloc == NULL)
+ abort ();
+
+ loc = sreloc->contents;
+ loc += sreloc->reloc_count++ * sizeof (Elf64_External_Rela);
+ bfd_elf64_swap_reloca_out (output_bfd, &outrel, loc);
+
+ /* If this reloc is against an external symbol, we do
+ not want to fiddle with the addend. Otherwise, we
+ need to include the symbol value so that it becomes
+ an addend for the dynamic reloc. */
+ if (! relocate)
+ continue;
+ }
+
+ break;
+
+ /* Relocations for tls literal pool entries. */
+ case R_390_TLS_IE64:
+ if (info->shared)
+ {
+ Elf_Internal_Rela outrel;
+ asection *sreloc;
+ bfd_byte *loc;
+
+ outrel.r_offset = rel->r_offset
+ + input_section->output_section->vma
+ + input_section->output_offset;
+ outrel.r_info = ELF64_R_INFO (0, R_390_RELATIVE);
+ sreloc = elf_section_data (input_section)->sreloc;
+ if (sreloc == NULL)
+ abort ();
+ loc = sreloc->contents;
+ loc += sreloc->reloc_count++ * sizeof (Elf64_External_Rela);
+ bfd_elf64_swap_reloc_out (output_bfd, &outrel, loc);
+ }
+ /* Fall through. */
+
+ case R_390_TLS_GD64:
+ case R_390_TLS_GOTIE64:
+ r_type = elf_s390_tls_transition (info, r_type, h == NULL);
+ tls_type = GOT_UNKNOWN;
+ if (h == NULL && local_got_offsets)
+ tls_type = elf_s390_local_got_tls_type (input_bfd) [r_symndx];
+ else if (h != NULL)
+ {
+ tls_type = elf_s390_hash_entry(h)->tls_type;
+ if (!info->shared && h->dynindx == -1 && tls_type >= GOT_TLS_IE)
+ r_type = R_390_TLS_LE64;
+ }
+ if (r_type == R_390_TLS_GD64 && tls_type >= GOT_TLS_IE)
+ r_type = R_390_TLS_IE64;
+
+ if (r_type == R_390_TLS_LE64)
+ {
+ /* This relocation gets optimized away by the local exec
+ access optimization. */
+ BFD_ASSERT (! unresolved_reloc);
+ bfd_put_64 (output_bfd, -tpoff (info, relocation),
+ contents + rel->r_offset);
+ continue;
+ }
+
+ if (htab->sgot == NULL)
+ abort ();
+
+ if (h != NULL)
+ off = h->got.offset;
+ else
+ {
+ if (local_got_offsets == NULL)
+ abort ();
+
+ off = local_got_offsets[r_symndx];
+ }
+
+ emit_tls_relocs:
+
+ if ((off & 1) != 0)
+ off &= ~1;
+ else
+ {
+ Elf_Internal_Rela outrel;
+ bfd_byte *loc;
+ int dr_type, indx;
+
+ if (htab->srelgot == NULL)
+ abort ();
+
+ outrel.r_offset = (htab->sgot->output_section->vma
+ + htab->sgot->output_offset + off);
+
+ indx = h && h->dynindx != -1 ? h->dynindx : 0;
+ if (r_type == R_390_TLS_GD64)
+ dr_type = R_390_TLS_DTPMOD;
+ else
+ dr_type = R_390_TLS_TPOFF;
+ if (dr_type == R_390_TLS_TPOFF && indx == 0)
+ outrel.r_addend = relocation - dtpoff_base (info);
+ else
+ outrel.r_addend = 0;
+ outrel.r_info = ELF64_R_INFO (indx, dr_type);
+ loc = htab->srelgot->contents;
+ loc += htab->srelgot->reloc_count++
+ * sizeof (Elf64_External_Rela);
+ bfd_elf64_swap_reloca_out (output_bfd, &outrel, loc);
+
+ if (r_type == R_390_TLS_GD64)
+ {
+ if (indx == 0)
+ {
+ BFD_ASSERT (! unresolved_reloc);
+ bfd_put_64 (output_bfd,
+ relocation - dtpoff_base (info),
+ htab->sgot->contents + off + GOT_ENTRY_SIZE);
+ }
+ else
+ {
+ outrel.r_info = ELF64_R_INFO (indx, R_390_TLS_DTPOFF);
+ outrel.r_offset += GOT_ENTRY_SIZE;
+ outrel.r_addend = 0;
+ htab->srelgot->reloc_count++;
+ loc += sizeof (Elf64_External_Rela);
+ bfd_elf64_swap_reloca_out (output_bfd, &outrel, loc);
+ }
}
+ if (h != NULL)
+ h->got.offset |= 1;
+ else
+ local_got_offsets[r_symndx] |= 1;
+ }
+
+ if (off >= (bfd_vma) -2)
+ abort ();
+ if (r_type == ELF64_R_TYPE (rel->r_info))
+ {
+ relocation = htab->sgot->output_offset + off;
+ if (r_type == R_390_TLS_IE64 || r_type == R_390_TLS_IEENT)
+ relocation += htab->sgot->output_section->vma;
+ unresolved_reloc = FALSE;
+ }
+ else
+ {
+ bfd_put_64 (output_bfd, htab->sgot->output_offset + off,
+ contents + rel->r_offset);
+ continue;
+ }
+ break;
+
+ case R_390_TLS_GOTIE12:
+ case R_390_TLS_GOTIE20:
+ case R_390_TLS_IEENT:
+ if (h == NULL)
+ {
+ if (local_got_offsets == NULL)
+ abort();
+ off = local_got_offsets[r_symndx];
+ if (info->shared)
+ goto emit_tls_relocs;
+ }
+ else
+ {
+ off = h->got.offset;
+ tls_type = elf_s390_hash_entry(h)->tls_type;
+ if (info->shared || h->dynindx != -1 || tls_type < GOT_TLS_IE)
+ goto emit_tls_relocs;
+ }
+
+ if (htab->sgot == NULL)
+ abort ();
+
+ BFD_ASSERT (! unresolved_reloc);
+ bfd_put_64 (output_bfd, -tpoff (info, relocation),
+ htab->sgot->contents + off);
+ relocation = htab->sgot->output_offset + off;
+ if (r_type == R_390_TLS_IEENT)
+ relocation += htab->sgot->output_section->vma;
+ unresolved_reloc = FALSE;
+ break;
+
+ case R_390_TLS_LDM64:
+ if (! info->shared)
+ /* The literal pool entry this relocation refers to gets ignored
+ by the optimized code of the local exec model. Do nothing
+ and the value will turn out zero. */
+ continue;
+
+ if (htab->sgot == NULL)
+ abort ();
+
+ off = htab->tls_ldm_got.offset;
+ if (off & 1)
+ off &= ~1;
+ else
+ {
+ Elf_Internal_Rela outrel;
+ bfd_byte *loc;
+
+ if (htab->srelgot == NULL)
+ abort ();
+
+ outrel.r_offset = (htab->sgot->output_section->vma
+ + htab->sgot->output_offset + off);
+
+ bfd_put_64 (output_bfd, 0,
+ htab->sgot->contents + off + GOT_ENTRY_SIZE);
+ outrel.r_info = ELF64_R_INFO (0, R_390_TLS_DTPMOD);
+ outrel.r_addend = 0;
+ loc = htab->srelgot->contents;
+ loc += htab->srelgot->reloc_count++
+ * sizeof (Elf64_External_Rela);
+ bfd_elf64_swap_reloca_out (output_bfd, &outrel, loc);
+ htab->tls_ldm_got.offset |= 1;
+ }
+ relocation = htab->sgot->output_offset + off;
+ unresolved_reloc = FALSE;
+ break;
+
+ case R_390_TLS_LE64:
+ if (info->shared)
+ {
+ /* Linking a shared library with non-fpic code requires
+ a R_390_TLS_TPOFF relocation. */
+ Elf_Internal_Rela outrel;
+ asection *sreloc;
+ bfd_byte *loc;
+ int indx;
+
+ outrel.r_offset = rel->r_offset
+ + input_section->output_section->vma
+ + input_section->output_offset;
+ if (h != NULL && h->dynindx != -1)
+ indx = h->dynindx;
+ else
+ indx = 0;
+ outrel.r_info = ELF64_R_INFO (indx, R_390_TLS_TPOFF);
+ if (indx == 0)
+ outrel.r_addend = relocation - dtpoff_base (info);
+ else
+ outrel.r_addend = 0;
sreloc = elf_section_data (input_section)->sreloc;
if (sreloc == NULL)
abort ();
+ loc = sreloc->contents;
+ loc += sreloc->reloc_count++ * sizeof (Elf64_External_Rela);
+ bfd_elf64_swap_reloca_out (output_bfd, &outrel, loc);
+ }
+ else
+ {
+ BFD_ASSERT (! unresolved_reloc);
+ bfd_put_64 (output_bfd, -tpoff (info, relocation),
+ contents + rel->r_offset);
+ }
+ continue;
- loc = (Elf64_External_Rela *) sreloc->contents;
- loc += sreloc->reloc_count++;
- bfd_elf64_swap_reloca_out (output_bfd, &outrel, loc);
+ case R_390_TLS_LDO64:
+ if (info->shared || (input_section->flags & SEC_CODE) == 0)
+ relocation -= dtpoff_base (info);
+ else
+ /* When converting LDO to LE, we must negate. */
+ relocation = -tpoff (info, relocation);
+ break;
- /* If this reloc is against an external symbol, we do
- not want to fiddle with the addend. Otherwise, we
- need to include the symbol value so that it becomes
- an addend for the dynamic reloc. */
- if (! relocate)
- continue;
- }
+ /* Relocations for tls instructions. */
+ case R_390_TLS_LOAD:
+ case R_390_TLS_GDCALL:
+ case R_390_TLS_LDCALL:
+ tls_type = GOT_UNKNOWN;
+ if (h == NULL && local_got_offsets)
+ tls_type = elf_s390_local_got_tls_type (input_bfd) [r_symndx];
+ else if (h != NULL)
+ tls_type = elf_s390_hash_entry(h)->tls_type;
+
+ if (tls_type == GOT_TLS_GD)
+ continue;
+
+ if (r_type == R_390_TLS_LOAD)
+ {
+ if (!info->shared && (h == NULL || h->dynindx == -1))
+ {
+ /* IE->LE transition. Four valid cases:
+ lg %rx,(0,%ry) -> sllg %rx,%ry,0
+ lg %rx,(%ry,0) -> sllg %rx,%ry,0
+ lg %rx,(%ry,%r12) -> sllg %rx,%ry,0
+ lg %rx,(%r12,%ry) -> sllg %rx,%ry,0 */
+ unsigned int insn0, insn1, ry;
+
+ insn0 = bfd_get_32 (input_bfd, contents + rel->r_offset);
+ insn1 = bfd_get_16 (input_bfd, contents + rel->r_offset + 4);
+ if (insn1 != 0x0004)
+ invalid_tls_insn (input_bfd, input_section, rel);
+ ry = 0;
+ if ((insn0 & 0xff00f000) == 0xe3000000)
+ /* lg %rx,0(%ry,0) -> sllg %rx,%ry,0 */
+ ry = (insn0 & 0x000f0000);
+ else if ((insn0 & 0xff0f0000) == 0xe3000000)
+ /* lg %rx,0(0,%ry) -> sllg %rx,%ry,0 */
+ ry = (insn0 & 0x0000f000) << 4;
+ else if ((insn0 & 0xff00f000) == 0xe300c000)
+ /* lg %rx,0(%ry,%r12) -> sllg %rx,%ry,0 */
+ ry = (insn0 & 0x000f0000);
+ else if ((insn0 & 0xff0f0000) == 0xe30c0000)
+ /* lg %rx,0(%r12,%ry) -> sllg %rx,%ry,0 */
+ ry = (insn0 & 0x0000f000) << 4;
+ else
+ invalid_tls_insn (input_bfd, input_section, rel);
+ insn0 = 0xeb000000 | (insn0 & 0x00f00000) | ry;
+ insn1 = 0x000d;
+ bfd_put_32 (output_bfd, insn0, contents + rel->r_offset);
+ bfd_put_16 (output_bfd, insn1, contents + rel->r_offset + 4);
+ }
+ }
+ else if (r_type == R_390_TLS_GDCALL)
+ {
+ unsigned int insn0, insn1;
- break;
+ insn0 = bfd_get_32 (input_bfd, contents + rel->r_offset);
+ insn1 = bfd_get_16 (input_bfd, contents + rel->r_offset + 4);
+ if ((insn0 & 0xffff0000) != 0xc0e50000)
+ invalid_tls_insn (input_bfd, input_section, rel);
+ if (!info->shared && (h == NULL || h->dynindx == -1))
+ {
+ /* GD->LE transition.
+ brasl %r14,__tls_get_addr@plt -> brcl 0,. */
+ insn0 = 0xc0040000;
+ insn1 = 0x0000;
+ }
+ else
+ {
+ /* GD->IE transition.
+ brasl %r14,__tls_get_addr@plt -> lg %r2,0(%r2,%r12) */
+ insn0 = 0xe322c000;
+ insn1 = 0x0004;
+ }
+ bfd_put_32 (output_bfd, insn0, contents + rel->r_offset);
+ bfd_put_16 (output_bfd, insn1, contents + rel->r_offset + 4);
+ }
+ else if (r_type == R_390_TLS_LDCALL)
+ {
+ if (!info->shared)
+ {
+ unsigned int insn0, insn1;
+
+ insn0 = bfd_get_32 (input_bfd, contents + rel->r_offset);
+ insn1 = bfd_get_16 (input_bfd, contents + rel->r_offset + 4);
+ if ((insn0 & 0xffff0000) != 0xc0e50000)
+ invalid_tls_insn (input_bfd, input_section, rel);
+ /* LD->LE transition.
+ brasl %r14,__tls_get_addr@plt -> brcl 0,. */
+ insn0 = 0xc0040000;
+ insn1 = 0x0000;
+ bfd_put_32 (output_bfd, insn0, contents + rel->r_offset);
+ bfd_put_16 (output_bfd, insn1, contents + rel->r_offset + 4);
+ }
+ }
+ continue;
- default:
- break;
- }
+ default:
+ break;
+ }
/* Dynamic relocs are not propagated for SEC_DEBUGGING sections
because such sections are not SEC_ALLOC and thus ld.so will
@@ -1950,7 +2995,19 @@ elf_s390_relocate_section (output_bfd, info, input_bfd, input_section,
(long) rel->r_offset,
h->root.root.string);
- r = _bfd_final_link_relocate (howto, input_bfd, input_section,
+ if (r_type == R_390_20
+ || r_type == R_390_GOT20
+ || r_type == R_390_GOTPLT20
+ || r_type == R_390_TLS_GOTIE20)
+ {
+ relocation += rel->r_addend;
+ relocation = (relocation&0xfff) << 8 | (relocation&0xff000) >> 12;
+ r = _bfd_final_link_relocate (howto, input_bfd, input_section,
+ contents, rel->r_offset,
+ relocation, 0);
+ }
+ else
+ r = _bfd_final_link_relocate (howto, input_bfd, input_section,
contents, rel->r_offset,
relocation, rel->r_addend);
@@ -1966,7 +3023,7 @@ elf_s390_relocate_section (output_bfd, info, input_bfd, input_section,
symtab_hdr->sh_link,
sym->st_name);
if (name == NULL)
- return false;
+ return FALSE;
if (*name == '\0')
name = bfd_section_name (input_bfd, sec);
}
@@ -1977,7 +3034,7 @@ 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)))
- return false;
+ return FALSE;
}
else
{
@@ -1986,18 +3043,18 @@ elf_s390_relocate_section (output_bfd, info, input_bfd, input_section,
bfd_archive_filename (input_bfd),
bfd_get_section_name (input_bfd, input_section),
(long) rel->r_offset, name, (int) r);
- return false;
+ return FALSE;
}
}
}
- return true;
+ return TRUE;
}
/* Finish up dynamic symbol handling. We set the contents of various
dynamic sections here. */
-static boolean
+static bfd_boolean
elf_s390_finish_dynamic_symbol (output_bfd, info, h, sym)
bfd *output_bfd;
struct bfd_link_info *info;
@@ -2013,10 +3070,10 @@ elf_s390_finish_dynamic_symbol (output_bfd, info, h, sym)
bfd_vma plt_index;
bfd_vma got_offset;
Elf_Internal_Rela rela;
- Elf64_External_Rela *loc;
+ bfd_byte *loc;
/* This symbol has an entry in the procedure linkage table. Set
- it up. */
+ it up. */
if (h->dynindx == -1
|| htab->splt == NULL
@@ -2025,11 +3082,11 @@ elf_s390_finish_dynamic_symbol (output_bfd, info, h, sym)
abort ();
/* Calc. index no.
- Current offset - size first entry / entry size. */
+ Current offset - size first entry / entry size. */
plt_index = (h->plt.offset - PLT_FIRST_ENTRY_SIZE) / PLT_ENTRY_SIZE;
/* Offset in GOT is PLT index plus GOT headers(3) times 8,
- addr & GOT addr. */
+ addr & GOT addr. */
got_offset = (plt_index + 3) * GOT_ENTRY_SIZE;
/* Fill in the blueprint of a PLT. */
@@ -2064,7 +3121,7 @@ elf_s390_finish_dynamic_symbol (output_bfd, info, h, sym)
htab->splt->contents + h->plt.offset + 28);
/* Fill in the entry in the global offset table.
- Points to instruction after GOT offset. */
+ Points to instruction after GOT offset. */
bfd_put_64 (output_bfd,
(htab->splt->output_section->vma
+ htab->splt->output_offset
@@ -2078,7 +3135,7 @@ elf_s390_finish_dynamic_symbol (output_bfd, info, h, sym)
+ got_offset);
rela.r_info = ELF64_R_INFO (h->dynindx, R_390_JMP_SLOT);
rela.r_addend = 0;
- loc = (Elf64_External_Rela *) htab->srelplt->contents + plt_index;
+ 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)
@@ -2092,14 +3149,16 @@ elf_s390_finish_dynamic_symbol (output_bfd, info, h, sym)
}
}
- if (h->got.offset != (bfd_vma) -1)
+ if (h->got.offset != (bfd_vma) -1
+ && elf_s390_hash_entry(h)->tls_type != GOT_TLS_GD
+ && elf_s390_hash_entry(h)->tls_type != GOT_TLS_IE
+ && elf_s390_hash_entry(h)->tls_type != GOT_TLS_IE_NLT)
{
Elf_Internal_Rela rela;
- Elf64_External_Rela *loc;
+ bfd_byte *loc;
/* This symbol has an entry in the global offset table. Set it
- up. */
-
+ up. */
if (htab->sgot == NULL || htab->srelgot == NULL)
abort ();
@@ -2117,30 +3176,30 @@ elf_s390_finish_dynamic_symbol (output_bfd, info, h, sym)
|| h->dynindx == -1
|| (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL))
&& (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR))
- {
+ {
BFD_ASSERT((h->got.offset & 1) != 0);
- rela.r_info = ELF64_R_INFO (0, R_390_RELATIVE);
- rela.r_addend = (h->root.u.def.value
- + h->root.u.def.section->output_section->vma
- + h->root.u.def.section->output_offset);
- }
+ rela.r_info = ELF64_R_INFO (0, R_390_RELATIVE);
+ rela.r_addend = (h->root.u.def.value
+ + h->root.u.def.section->output_section->vma
+ + h->root.u.def.section->output_offset);
+ }
else
{
BFD_ASSERT((h->got.offset & 1) == 0);
bfd_put_64 (output_bfd, (bfd_vma) 0, htab->sgot->contents + h->got.offset);
rela.r_info = ELF64_R_INFO (h->dynindx, R_390_GLOB_DAT);
- rela.r_addend = 0;
- }
+ rela.r_addend = 0;
+ }
- loc = (Elf64_External_Rela *) htab->srelgot->contents;
- loc += htab->srelgot->reloc_count++;
+ loc = htab->srelgot->contents;
+ loc += htab->srelgot->reloc_count++ * sizeof (Elf64_External_Rela);
bfd_elf64_swap_reloca_out (output_bfd, &rela, loc);
}
if ((h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_COPY) != 0)
{
Elf_Internal_Rela rela;
- Elf64_External_Rela *loc;
+ bfd_byte *loc;
/* This symbols needs a copy reloc. Set it up. */
@@ -2155,8 +3214,8 @@ elf_s390_finish_dynamic_symbol (output_bfd, info, h, sym)
+ h->root.u.def.section->output_offset);
rela.r_info = ELF64_R_INFO (h->dynindx, R_390_COPY);
rela.r_addend = 0;
- loc = (Elf64_External_Rela *) htab->srelbss->contents;
- loc += htab->srelbss->reloc_count++;
+ loc = htab->srelbss->contents;
+ loc += htab->srelbss->reloc_count++ * sizeof (Elf64_External_Rela);
bfd_elf64_swap_reloca_out (output_bfd, &rela, loc);
}
@@ -2166,7 +3225,7 @@ elf_s390_finish_dynamic_symbol (output_bfd, info, h, sym)
|| strcmp (h->root.root.string, "_PROCEDURE_LINKAGE_TABLE_") == 0)
sym->st_shndx = SHN_ABS;
- return true;
+ return TRUE;
}
/* Used to decide how to sort relocs in an optimal manner for the
@@ -2191,7 +3250,7 @@ elf_s390_reloc_type_class (rela)
/* Finish up the dynamic sections. */
-static boolean
+static bfd_boolean
elf_s390_finish_dynamic_sections (output_bfd, info)
bfd *output_bfd;
struct bfd_link_info *info;
@@ -2307,21 +3366,12 @@ elf_s390_finish_dynamic_sections (output_bfd, info)
elf_section_data (htab->sgot->output_section)
->this_hdr.sh_entsize = 8;
}
- return true;
-}
-
-static boolean
-elf_s390_object_p (abfd)
- bfd *abfd;
-{
- return bfd_default_set_arch_mach (abfd, bfd_arch_s390, bfd_mach_s390_64);
+ return TRUE;
}
-/*
- * Why was the hash table entry size definition changed from
- * ARCH_SIZE/8 to 4? This breaks the 64 bit dynamic linker and
- * this is the only reason for the s390_elf64_size_info structure.
- */
+/* Why was the hash table entry size definition changed from
+ ARCH_SIZE/8 to 4? This breaks the 64 bit dynamic linker and
+ this is the only reason for the s390_elf64_size_info structure. */
const struct elf_size_info s390_elf64_size_info =
{
@@ -2333,10 +3383,10 @@ const struct elf_size_info s390_elf64_size_info =
sizeof (Elf64_External_Sym),
sizeof (Elf64_External_Dyn),
sizeof (Elf_External_Note),
- 8, /* hash-table entry size */
- 1, /* internal relocations per external relocations */
- 64, /* arch_size */
- 8, /* file_align */
+ 8, /* hash-table entry size. */
+ 1, /* internal relocations per external relocations. */
+ 64, /* arch_size. */
+ 3, /* log_file_align. */
ELFCLASS64, EV_CURRENT,
bfd_elf64_write_out_phdrs,
bfd_elf64_write_shdrs_and_ehdr,
@@ -2347,10 +3397,10 @@ const struct elf_size_info s390_elf64_size_info =
bfd_elf64_slurp_symbol_table,
bfd_elf64_swap_dyn_in,
bfd_elf64_swap_dyn_out,
- NULL,
- NULL,
- NULL,
- NULL
+ bfd_elf64_swap_reloc_in,
+ bfd_elf64_swap_reloc_out,
+ bfd_elf64_swap_reloca_in,
+ bfd_elf64_swap_reloca_out
};
#define TARGET_BIG_SYM bfd_elf64_s390_vec
@@ -2368,7 +3418,6 @@ const struct elf_size_info s390_elf64_size_info =
#define elf_backend_plt_readonly 1
#define elf_backend_want_plt_sym 0
#define elf_backend_got_header_size 24
-#define elf_backend_plt_header_size PLT_ENTRY_SIZE
#define elf_backend_rela_normal 1
#define elf_info_to_howto elf_s390_info_to_howto
@@ -2390,6 +3439,7 @@ const struct elf_size_info s390_elf64_size_info =
#define elf_backend_size_dynamic_sections elf_s390_size_dynamic_sections
#define elf_backend_reloc_type_class elf_s390_reloc_type_class
-#define elf_backend_object_p elf_s390_object_p
+#define bfd_elf64_mkobject elf_s390_mkobject
+#define elf_backend_object_p elf_s390_object_p
#include "elf64-target.h"
diff --git a/contrib/binutils/bfd/elf64-sparc.c b/contrib/binutils/bfd/elf64-sparc.c
index a3c100d..4568a22 100644
--- a/contrib/binutils/bfd/elf64-sparc.c
+++ b/contrib/binutils/bfd/elf64-sparc.c
@@ -1,22 +1,22 @@
/* SPARC-specific support for 64-bit ELF
- Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
- Free Software Foundation, Inc.
+ Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+ 2003, 2004 Free Software Foundation, Inc.
-This file is part of BFD, the Binary File Descriptor library.
+ This 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "bfd.h"
#include "sysdep.h"
@@ -51,49 +51,54 @@ static bfd_vma sparc64_elf_plt_entry_offset
static bfd_vma sparc64_elf_plt_ptr_offset
PARAMS ((bfd_vma, bfd_vma));
-static boolean sparc64_elf_check_relocs
+static bfd_boolean sparc64_elf_check_relocs
PARAMS ((bfd *, struct bfd_link_info *, asection *sec,
const Elf_Internal_Rela *));
-static boolean sparc64_elf_adjust_dynamic_symbol
+static bfd_boolean sparc64_elf_adjust_dynamic_symbol
PARAMS ((struct bfd_link_info *, struct elf_link_hash_entry *));
-static boolean sparc64_elf_size_dynamic_sections
+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 boolean sparc64_elf_add_symbol_hook
- PARAMS ((bfd *, struct bfd_link_info *, const Elf_Internal_Sym *,
+static bfd_boolean sparc64_elf_add_symbol_hook
+ PARAMS ((bfd *, struct bfd_link_info *, Elf_Internal_Sym *,
const char **, flagword *, asection **, bfd_vma *));
-static boolean sparc64_elf_output_arch_syms
+static bfd_boolean sparc64_elf_output_arch_syms
PARAMS ((bfd *, struct bfd_link_info *, PTR,
- boolean (*) (PTR, const char *, Elf_Internal_Sym *, asection *)));
+ bfd_boolean (*) (PTR, const char *, Elf_Internal_Sym *,
+ asection *, struct elf_link_hash_entry *)));
static void sparc64_elf_symbol_processing
PARAMS ((bfd *, asymbol *));
-static boolean sparc64_elf_merge_private_bfd_data
+static bfd_boolean sparc64_elf_merge_private_bfd_data
PARAMS ((bfd *, bfd *));
-static boolean sparc64_elf_fake_sections
- PARAMS ((bfd *, Elf32_Internal_Shdr *, asection *));
+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 boolean sparc64_elf_relax_section
- PARAMS ((bfd *, asection *, struct bfd_link_info *, boolean *));
-static boolean sparc64_elf_relocate_section
+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 boolean sparc64_elf_finish_dynamic_symbol
+static bfd_boolean sparc64_elf_finish_dynamic_symbol
PARAMS ((bfd *, struct bfd_link_info *, struct elf_link_hash_entry *,
Elf_Internal_Sym *));
-static boolean sparc64_elf_finish_dynamic_sections
+static bfd_boolean sparc64_elf_finish_dynamic_sections
PARAMS ((bfd *, struct bfd_link_info *));
-static boolean sparc64_elf_object_p PARAMS ((bfd *));
+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 boolean sparc64_elf_slurp_one_reloc_table
- PARAMS ((bfd *, asection *, Elf_Internal_Shdr *, asymbol **, boolean));
-static boolean sparc64_elf_slurp_reloc_table
- PARAMS ((bfd *, asection *, asymbol **, boolean));
+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));
@@ -113,65 +118,89 @@ static bfd_reloc_status_type sparc_elf_lox10_reloc
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),
+ 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),
+ 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),
+ 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_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 {
@@ -225,6 +254,30 @@ static const struct elf_reloc_map sparc_reloc_map[] =
{ 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
@@ -255,12 +308,23 @@ static void
sparc64_elf_info_to_howto (abfd, cache_ptr, dst)
bfd *abfd ATTRIBUTE_UNUSED;
arelent *cache_ptr;
- Elf64_Internal_Rela *dst;
+ 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. */
@@ -285,13 +349,13 @@ sparc64_elf_get_dynamic_reloc_upper_bound (abfd)
has secondary addend in ELF64_R_TYPE_DATA. We handle it as two relocations
for the same location, R_SPARC_LO10 and R_SPARC_13. */
-static boolean
+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;
- boolean dynamic;
+ bfd_boolean dynamic;
{
PTR allocated = NULL;
bfd_byte *native_relocs;
@@ -311,7 +375,7 @@ sparc64_elf_slurp_one_reloc_table (abfd, asect, rel_hdr, symbols, dynamic)
native_relocs = (bfd_byte *) allocated;
- relents = asect->relocation + asect->reloc_count;
+ relents = asect->relocation + canon_reloc_count (asect);
entsize = rel_hdr->sh_entsize;
BFD_ASSERT (entsize == sizeof (Elf64_External_Rela));
@@ -323,7 +387,7 @@ sparc64_elf_slurp_one_reloc_table (abfd, asect, rel_hdr, symbols, dynamic)
{
Elf_Internal_Rela rela;
- bfd_elf64_swap_reloca_in (abfd, (Elf64_External_Rela *) native_relocs, &rela);
+ bfd_elf64_swap_reloca_in (abfd, native_relocs, &rela);
/* The address of an ELF reloc is section relative for an object
file, and absolute for an executable file or shared library.
@@ -366,27 +430,27 @@ sparc64_elf_slurp_one_reloc_table (abfd, asect, rel_hdr, symbols, dynamic)
relent->howto = &sparc64_elf_howto_table[ELF64_R_TYPE_ID (rela.r_info)];
}
- asect->reloc_count += relent - relents;
+ canon_reloc_count (asect) += relent - relents;
if (allocated != NULL)
free (allocated);
- return true;
+ return TRUE;
error_return:
if (allocated != NULL)
free (allocated);
- return false;
+ return FALSE;
}
/* Read in and swap the external relocs. */
-static boolean
+static bfd_boolean
sparc64_elf_slurp_reloc_table (abfd, asect, symbols, dynamic)
bfd *abfd;
asection *asect;
asymbol **symbols;
- boolean dynamic;
+ bfd_boolean dynamic;
{
struct bfd_elf_section_data * const d = elf_section_data (asect);
Elf_Internal_Shdr *rel_hdr;
@@ -394,13 +458,13 @@ sparc64_elf_slurp_reloc_table (abfd, asect, symbols, dynamic)
bfd_size_type amt;
if (asect->relocation != NULL)
- return true;
+ return TRUE;
if (! dynamic)
{
if ((asect->flags & SEC_RELOC) == 0
|| asect->reloc_count == 0)
- return true;
+ return TRUE;
rel_hdr = &d->rel_hdr;
rel_hdr2 = d->rel_hdr2;
@@ -415,7 +479,7 @@ sparc64_elf_slurp_reloc_table (abfd, asect, symbols, dynamic)
dynamic symbol table, and in that case bfd_section_from_shdr
in elf.c does not update the RELOC_COUNT. */
if (asect->_raw_size == 0)
- return true;
+ return TRUE;
rel_hdr = &d->this_hdr;
asect->reloc_count = NUM_SHDR_ENTRIES (rel_hdr);
@@ -426,23 +490,50 @@ sparc64_elf_slurp_reloc_table (abfd, asect, symbols, dynamic)
amt *= 2 * sizeof (arelent);
asect->relocation = (arelent *) bfd_alloc (abfd, amt);
if (asect->relocation == NULL)
- return false;
+ return FALSE;
- /* The sparc64_elf_slurp_one_reloc_table routine increments reloc_count. */
- asect->reloc_count = 0;
+ /* The sparc64_elf_slurp_one_reloc_table routine increments
+ canon_reloc_count. */
+ canon_reloc_count (asect) = 0;
if (!sparc64_elf_slurp_one_reloc_table (abfd, asect, rel_hdr, symbols,
dynamic))
- return false;
+ return FALSE;
if (rel_hdr2
&& !sparc64_elf_slurp_one_reloc_table (abfd, asect, rel_hdr2, symbols,
dynamic))
- return false;
+ return FALSE;
- return true;
+ return TRUE;
}
+/* Canonicalize the relocs. */
+
+static long
+sparc64_elf_canonicalize_reloc (abfd, section, relptr, symbols)
+ bfd *abfd;
+ sec_ptr section;
+ arelent **relptr;
+ asymbol **symbols;
+{
+ arelent *tblptr;
+ unsigned int i;
+ const struct elf_backend_data *bed = get_elf_backend_data (abfd);
+
+ if (! bed->s->slurp_reloc_table (abfd, section, symbols, FALSE))
+ return -1;
+
+ tblptr = section->relocation;
+ for (i = 0; i < canon_reloc_count (section); i++)
+ *relptr++ = tblptr++;
+
+ *relptr = NULL;
+
+ return canon_reloc_count (section);
+}
+
+
/* Canonicalize the dynamic relocation entries. Note that we return
the dynamic relocations as a single block, although they are
actually associated with particular sections; the interface, which
@@ -476,9 +567,9 @@ sparc64_elf_canonicalize_dynamic_reloc (abfd, storage, syms)
arelent *p;
long count, i;
- if (! sparc64_elf_slurp_reloc_table (abfd, s, syms, true))
+ if (! sparc64_elf_slurp_reloc_table (abfd, s, syms, TRUE))
return -1;
- count = s->reloc_count;
+ count = canon_reloc_count (s);
p = s->relocation;
for (i = 0; i < count; i++)
*storage++ = p++;
@@ -499,7 +590,7 @@ sparc64_elf_write_relocs (abfd, sec, data)
asection *sec;
PTR data;
{
- boolean *failedp = (boolean *) data;
+ bfd_boolean *failedp = (bfd_boolean *) data;
Elf_Internal_Shdr *rela_hdr;
Elf64_External_Rela *outbound_relocas, *src_rela;
unsigned int idx, count;
@@ -550,7 +641,7 @@ sparc64_elf_write_relocs (abfd, sec, data)
rela_hdr->contents = (PTR) bfd_alloc (abfd, rela_hdr->sh_size);
if (rela_hdr->contents == NULL)
{
- *failedp = true;
+ *failedp = TRUE;
return;
}
@@ -590,7 +681,7 @@ sparc64_elf_write_relocs (abfd, sec, data)
n = _bfd_elf_symbol_from_bfd_symbol (abfd, &sym);
if (n < 0)
{
- *failedp = true;
+ *failedp = TRUE;
return;
}
last_sym_idx = n;
@@ -600,7 +691,7 @@ sparc64_elf_write_relocs (abfd, sec, data)
&& (*ptr->sym_ptr_ptr)->the_bfd->xvec != abfd->xvec
&& ! _bfd_elf_validate_reloc (abfd, ptr))
{
- *failedp = true;
+ *failedp = TRUE;
return;
}
@@ -626,7 +717,7 @@ sparc64_elf_write_relocs (abfd, sec, data)
dst_rela.r_info = ELF64_R_INFO (n, ptr->howto->type);
dst_rela.r_addend = ptr->addend;
- bfd_elf64_swap_reloca_out (abfd, &dst_rela, src_rela);
+ bfd_elf64_swap_reloca_out (abfd, &dst_rela, (bfd_byte *) src_rela);
++src_rela;
}
}
@@ -714,7 +805,7 @@ init_insn_reloc (abfd,
return bfd_reloc_ok;
}
- /* This works because partial_inplace is false. */
+ /* This works because partial_inplace is FALSE. */
if (output_bfd != NULL)
return bfd_reloc_continue;
@@ -994,7 +1085,7 @@ sparc64_elf_plt_ptr_offset (index, max)
allocate space in the global offset table or procedure linkage
table. */
-static boolean
+static bfd_boolean
sparc64_elf_check_relocs (abfd, info, sec, relocs)
bfd *abfd;
struct bfd_link_info *info;
@@ -1011,8 +1102,8 @@ sparc64_elf_check_relocs (abfd, info, sec, relocs)
asection *srelgot;
asection *sreloc;
- if (info->relocateable || !(sec->flags & SEC_ALLOC))
- return true;
+ if (info->relocatable || !(sec->flags & SEC_ALLOC))
+ return TRUE;
dynobj = elf_hash_table (info)->dynobj;
symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
@@ -1047,7 +1138,7 @@ sparc64_elf_check_relocs (abfd, info, sec, relocs)
/* Create the .got section. */
elf_hash_table (info)->dynobj = dynobj = abfd;
if (! _bfd_elf_create_got_section (dynobj, info))
- return false;
+ return FALSE;
}
if (sgot == NULL)
@@ -1071,7 +1162,7 @@ sparc64_elf_check_relocs (abfd, info, sec, relocs)
| SEC_LINKER_CREATED
| SEC_READONLY))
|| ! bfd_set_section_alignment (dynobj, srelgot, 3))
- return false;
+ return FALSE;
}
}
@@ -1087,8 +1178,8 @@ sparc64_elf_check_relocs (abfd, info, sec, relocs)
/* Make sure this symbol is output as a dynamic symbol. */
if (h->dynindx == -1)
{
- if (! bfd_elf64_link_record_dynamic_symbol (info, h))
- return false;
+ if (! bfd_elf_link_record_dynamic_symbol (info, h))
+ return FALSE;
}
srelgot->_raw_size += sizeof (Elf64_External_Rela);
@@ -1106,7 +1197,7 @@ sparc64_elf_check_relocs (abfd, info, sec, relocs)
size *= sizeof (bfd_vma);
local_got_offsets = (bfd_vma *) bfd_alloc (abfd, size);
if (local_got_offsets == NULL)
- return false;
+ 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;
@@ -1164,14 +1255,14 @@ sparc64_elf_check_relocs (abfd, info, sec, relocs)
/* 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;
+ return FALSE;
}
/* Make sure this symbol is output as a dynamic symbol. */
if (h->dynindx == -1)
{
- if (! bfd_elf64_link_record_dynamic_symbol (info, h))
- return false;
+ if (! bfd_elf_link_record_dynamic_symbol (info, h))
+ return FALSE;
}
h->elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_PLT;
@@ -1243,7 +1334,7 @@ sparc64_elf_check_relocs (abfd, info, sec, relocs)
elf_elfheader (abfd)->e_shstrndx,
elf_section_data (sec)->rel_hdr.sh_name));
if (name == NULL)
- return false;
+ return FALSE;
BFD_ASSERT (strncmp (name, ".rela", 5) == 0
&& strcmp (bfd_get_section_name (abfd, sec),
@@ -1262,7 +1353,7 @@ sparc64_elf_check_relocs (abfd, info, sec, relocs)
if (sreloc == NULL
|| ! bfd_set_section_flags (dynobj, sreloc, flags)
|| ! bfd_set_section_alignment (dynobj, sreloc, 3))
- return false;
+ return FALSE;
}
if (sec->flags & SEC_READONLY)
info->flags |= DF_TEXTREL;
@@ -1280,21 +1371,21 @@ sparc64_elf_check_relocs (abfd, info, sec, relocs)
(*_bfd_error_handler) (_("%s: check_relocs: unhandled reloc type %d"),
bfd_archive_filename (abfd),
ELF64_R_TYPE_ID (rel->r_info));
- return false;
+ return FALSE;
}
}
- return true;
+ return TRUE;
}
/* Hook called by the linker routine which adds symbols from an object
file. We use it for STT_REGISTER symbols. */
-static boolean
+static bfd_boolean
sparc64_elf_add_symbol_hook (abfd, info, sym, namep, flagsp, secp, valp)
bfd *abfd;
struct bfd_link_info *info;
- const Elf_Internal_Sym *sym;
+ Elf_Internal_Sym *sym;
const char **namep;
flagword *flagsp ATTRIBUTE_UNUSED;
asection **secp ATTRIBUTE_UNUSED;
@@ -1316,7 +1407,7 @@ sparc64_elf_add_symbol_hook (abfd, info, sym, namep, flagsp, secp, valp)
(*_bfd_error_handler)
(_("%s: Only registers %%g[2367] can be declared using STT_REGISTER"),
bfd_archive_filename (abfd));
- return false;
+ return FALSE;
}
if (info->hash->creator != abfd->xvec
@@ -1326,7 +1417,7 @@ sparc64_elf_add_symbol_hook (abfd, info, sym, namep, flagsp, secp, valp)
If STT_REGISTER comes from a dynamic object, don't put it into
the output bfd. The dynamic linker will recheck it. */
*namep = NULL;
- return true;
+ return TRUE;
}
p = sparc64_elf_hash_table(info)->app_regs + reg;
@@ -1338,7 +1429,7 @@ sparc64_elf_add_symbol_hook (abfd, info, sym, namep, flagsp, secp, valp)
(int) sym->st_value,
**namep ? *namep : "#scratch", bfd_archive_filename (abfd),
*p->name ? p->name : "#scratch", bfd_archive_filename (p->abfd));
- return false;
+ return FALSE;
}
if (p->name == NULL)
@@ -1348,7 +1439,7 @@ sparc64_elf_add_symbol_hook (abfd, info, sym, namep, flagsp, secp, valp)
struct elf_link_hash_entry *h;
h = (struct elf_link_hash_entry *)
- bfd_link_hash_lookup (info->hash, *namep, false, false, false);
+ bfd_link_hash_lookup (info->hash, *namep, FALSE, FALSE, FALSE);
if (h != NULL)
{
@@ -1360,13 +1451,13 @@ sparc64_elf_add_symbol_hook (abfd, info, sym, namep, flagsp, secp, valp)
(_("Symbol `%s' has differing types: REGISTER in %s, previously %s in %s"),
*namep, bfd_archive_filename (abfd),
stt_types[type], bfd_archive_filename (p->abfd));
- return false;
+ return FALSE;
}
p->name = bfd_hash_allocate (&info->hash->table,
strlen (*namep) + 1);
if (!p->name)
- return false;
+ return FALSE;
strcpy (p->name, *namep);
}
@@ -1386,7 +1477,7 @@ sparc64_elf_add_symbol_hook (abfd, info, sym, namep, flagsp, secp, valp)
}
}
*namep = NULL;
- return true;
+ return TRUE;
}
else if (*namep && **namep
&& info->hash->creator == abfd->xvec)
@@ -1406,22 +1497,23 @@ sparc64_elf_add_symbol_hook (abfd, info, sym, namep, flagsp, secp, valp)
(_("Symbol `%s' has differing types: %s in %s, previously REGISTER in %s"),
*namep, stt_types[type], bfd_archive_filename (abfd),
bfd_archive_filename (p->abfd));
- return false;
+ return FALSE;
}
}
- return true;
+ return TRUE;
}
-/* This function takes care of emiting STT_REGISTER symbols
+/* This function takes care of emitting STT_REGISTER symbols
which we cannot easily keep in the symbol hash table. */
-static boolean
+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;
- boolean (*func) PARAMS ((PTR, const char *,
- Elf_Internal_Sym *, asection *));
+ bfd_boolean (*func)
+ PARAMS ((PTR, const char *, Elf_Internal_Sym *, asection *,
+ struct elf_link_hash_entry *));
{
int reg;
struct sparc64_elf_app_reg *app_regs =
@@ -1449,7 +1541,7 @@ sparc64_elf_output_arch_syms (output_bfd, info, finfo, func)
}
if (info->strip == strip_all)
- return true;
+ return TRUE;
for (reg = 0; reg < 4; reg++)
if (app_regs [reg].name != NULL)
@@ -1457,7 +1549,7 @@ sparc64_elf_output_arch_syms (output_bfd, info, finfo, func)
if (info->strip == strip_some
&& bfd_hash_lookup (info->keep_hash,
app_regs [reg].name,
- false, false) == NULL)
+ FALSE, FALSE) == NULL)
continue;
sym.st_value = reg < 2 ? reg + 2 : reg + 4;
@@ -1467,11 +1559,12 @@ sparc64_elf_output_arch_syms (output_bfd, info, finfo, func)
sym.st_shndx = app_regs [reg].shndx;
if (! (*func) (finfo, app_regs [reg].name, &sym,
sym.st_shndx == SHN_ABS
- ? bfd_abs_section_ptr : bfd_und_section_ptr))
- return false;
+ ? bfd_abs_section_ptr : bfd_und_section_ptr,
+ NULL))
+ return FALSE;
}
- return true;
+ return TRUE;
}
static int
@@ -1509,7 +1602,7 @@ sparc64_elf_symbol_processing (abfd, asym)
change the definition to something the rest of the link can
understand. */
-static boolean
+static bfd_boolean
sparc64_elf_adjust_dynamic_symbol (info, h)
struct bfd_link_info *info;
struct elf_link_hash_entry *h;
@@ -1553,7 +1646,7 @@ sparc64_elf_adjust_dynamic_symbol (info, h)
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;
+ return TRUE;
}
s = bfd_get_section_by_name (dynobj, ".plt");
@@ -1593,10 +1686,10 @@ sparc64_elf_adjust_dynamic_symbol (info, h)
if (s->_raw_size >= (bfd_vma)1 << 32)
{
bfd_set_error (bfd_error_bad_value);
- return false;
+ return FALSE;
}
- return true;
+ return TRUE;
}
/* If this is a weak symbol, and there is a real definition, the
@@ -1608,7 +1701,7 @@ sparc64_elf_adjust_dynamic_symbol (info, h)
|| 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;
+ return TRUE;
}
/* This is a reference to a symbol defined by a dynamic object which
@@ -1619,7 +1712,7 @@ sparc64_elf_adjust_dynamic_symbol (info, h)
For such cases we need not do anything here; the relocations will
be handled correctly by relocate_section. */
if (info->shared)
- return true;
+ 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
@@ -1661,7 +1754,7 @@ sparc64_elf_adjust_dynamic_symbol (info, h)
if (power_of_two > bfd_get_section_alignment (dynobj, s))
{
if (! bfd_set_section_alignment (dynobj, s, power_of_two))
- return false;
+ return FALSE;
}
/* Define the symbol as being at this point in the section. */
@@ -1671,19 +1764,19 @@ sparc64_elf_adjust_dynamic_symbol (info, h)
/* Increment the section size to make room for the symbol. */
s->_raw_size += h->size;
- return true;
+ return TRUE;
}
/* Set the sizes of the dynamic sections. */
-static boolean
+static bfd_boolean
sparc64_elf_size_dynamic_sections (output_bfd, info)
bfd *output_bfd;
struct bfd_link_info *info;
{
bfd *dynobj;
asection *s;
- boolean relplt;
+ bfd_boolean relplt;
dynobj = elf_hash_table (info)->dynobj;
BFD_ASSERT (dynobj != NULL);
@@ -1691,7 +1784,7 @@ sparc64_elf_size_dynamic_sections (output_bfd, info)
if (elf_hash_table (info)->dynamic_sections_created)
{
/* Set the contents of the .interp section to the interpreter. */
- if (! info->shared)
+ if (info->executable)
{
s = bfd_get_section_by_name (dynobj, ".interp");
BFD_ASSERT (s != NULL);
@@ -1714,11 +1807,11 @@ sparc64_elf_size_dynamic_sections (output_bfd, info)
/* The check_relocs and adjust_dynamic_symbol entry points have
determined the sizes of the various dynamic sections. Allocate
memory for them. */
- relplt = false;
+ relplt = FALSE;
for (s = dynobj->sections; s != NULL; s = s->next)
{
const char *name;
- boolean strip;
+ bfd_boolean strip;
if ((s->flags & SEC_LINKER_CREATED) == 0)
continue;
@@ -1727,7 +1820,7 @@ sparc64_elf_size_dynamic_sections (output_bfd, info)
of the dynobj section names depend upon the input files. */
name = bfd_get_section_name (dynobj, s);
- strip = false;
+ strip = FALSE;
if (strncmp (name, ".rela", 5) == 0)
{
@@ -1742,12 +1835,12 @@ sparc64_elf_size_dynamic_sections (output_bfd, info)
adjust_dynamic_symbol is called, and it is that
function which decides whether anything needs to go
into these sections. */
- strip = true;
+ strip = TRUE;
}
else
{
if (strcmp (name, ".rela.plt") == 0)
- relplt = true;
+ relplt = TRUE;
/* We use the reloc_count field as a counter if we need
to copy relocs into the output file. */
@@ -1772,7 +1865,7 @@ sparc64_elf_size_dynamic_sections (output_bfd, info)
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;
+ return FALSE;
}
if (elf_hash_table (info)->dynamic_sections_created)
@@ -1783,17 +1876,17 @@ sparc64_elf_size_dynamic_sections (output_bfd, info)
the .dynamic section. The DT_DEBUG entry is filled in by the
dynamic linker and used by the debugger. */
#define add_dynamic_entry(TAG, VAL) \
- bfd_elf64_add_dynamic_entry (info, (bfd_vma) (TAG), (bfd_vma) (VAL))
+ _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->shared)
+ if (info->executable)
{
if (!add_dynamic_entry (DT_DEBUG, 0))
- return false;
+ return FALSE;
}
if (relplt)
@@ -1802,18 +1895,18 @@ sparc64_elf_size_dynamic_sections (output_bfd, info)
|| !add_dynamic_entry (DT_PLTRELSZ, 0)
|| !add_dynamic_entry (DT_PLTREL, DT_RELA)
|| !add_dynamic_entry (DT_JMPREL, 0))
- return false;
+ 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;
+ return FALSE;
if (info->flags & DF_TEXTREL)
{
if (!add_dynamic_entry (DT_TEXTREL, 0))
- return false;
+ return FALSE;
}
/* Add dynamic STT_REGISTER symbols and corresponding DT_SPARC_REGISTER
@@ -1827,12 +1920,12 @@ sparc64_elf_size_dynamic_sections (output_bfd, info)
struct elf_link_local_dynamic_entry *entry, *e;
if (!add_dynamic_entry (DT_SPARC_REGISTER, 0))
- return false;
+ return FALSE;
entry = (struct elf_link_local_dynamic_entry *)
bfd_hash_allocate (&info->hash->table, sizeof (*entry));
if (entry == NULL)
- return false;
+ 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
@@ -1841,7 +1934,7 @@ sparc64_elf_size_dynamic_sections (output_bfd, info)
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);
+ = _bfd_elf_strtab_add (dynstr, app_regs[reg].name, FALSE);
else
entry->isym.st_name = 0;
entry->isym.st_other = 0;
@@ -1865,38 +1958,40 @@ sparc64_elf_size_dynamic_sections (output_bfd, info)
}
#undef add_dynamic_entry
- return true;
+ return TRUE;
}
-#define SET_SEC_DO_RELAX(section) do { elf_section_data(section)->tdata = (void *)1; } while (0)
-#define SEC_DO_RELAX(section) (elf_section_data(section)->tdata == (void *)1)
+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;
-static boolean
+ 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;
- boolean *again;
+ bfd_boolean *again;
{
- *again = false;
- SET_SEC_DO_RELAX (section);
- return true;
+ *again = FALSE;
+ sec_do_relax (section) = 1;
+ return TRUE;
}
-/* This is the condition under which finish_dynamic_symbol will be called
- from elflink.h. If elflink.h doesn't call our finish_dynamic_symbol
- routine, we'll need to do something about initializing any .plt and
- .got entries in relocate_section. */
-#define WILL_CALL_FINISH_DYNAMIC_SYMBOL(DYN, INFO, H) \
- ((DYN) \
- && ((INFO)->shared \
- || ((H)->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0) \
- && ((H)->dynindx != -1 \
- || ((H)->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) != 0))
-
/* Relocate a SPARC64 ELF section. */
-static boolean
+static bfd_boolean
sparc64_elf_relocate_section (output_bfd, info, input_bfd, input_section,
contents, relocs, local_syms, local_sections)
bfd *output_bfd;
@@ -1919,6 +2014,9 @@ sparc64_elf_relocate_section (output_bfd, info, input_bfd, input_section,
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);
@@ -1930,6 +2028,8 @@ sparc64_elf_relocate_section (output_bfd, info, input_bfd, input_section,
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);
@@ -1943,92 +2043,42 @@ sparc64_elf_relocate_section (output_bfd, info, input_bfd, input_section,
asection *sec;
bfd_vma relocation, off;
bfd_reloc_status_type r;
- boolean is_plt = false;
- boolean unresolved_reloc;
+ 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;
+ return FALSE;
}
howto = sparc64_elf_howto_table + r_type;
- r_symndx = ELF64_R_SYM (rel->r_info);
-
- if (info->relocateable)
- {
- /* This is a relocateable 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];
- rel->r_addend += sec->output_offset + sym->st_value;
- }
- }
-
- continue;
- }
-
/* This is a final link. */
+ r_symndx = ELF64_R_SYM (rel->r_info);
h = NULL;
sym = NULL;
sec = NULL;
- unresolved_reloc = false;
+ 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);
+ relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel);
}
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;
+ bfd_boolean warned;
- relocation = 0;
- if (h->root.type == bfd_link_hash_defined
- || h->root.type == bfd_link_hash_defweak)
- {
- sec = h->root.u.def.section;
- if (sec->output_section == NULL)
- /* Set a flag that will be cleared later if we find a
- relocation value for this symbol. output_section
- is typically NULL for symbols satisfied by a shared
- library. */
- unresolved_reloc = true;
- else
- relocation = (h->root.u.def.value
- + sec->output_section->vma
- + sec->output_offset);
- }
- else if (h->root.type == bfd_link_hash_undefweak)
- ;
- else if (info->shared
- && (!info->symbolic || info->allow_shlib_undefined)
- && !info->no_undefined
- && ELF_ST_VISIBILITY (h->other) == STV_DEFAULT)
- ;
- else
+ RELOC_FOR_GLOBAL_SYMBOL (info, input_bfd, input_section, rel,
+ r_symndx, symtab_hdr, sym_hashes,
+ h, sec, relocation,
+ unresolved_reloc, warned);
+ if (warned)
{
- if (! ((*info->callbacks->undefined_symbol)
- (info, h->root.root.string, input_bfd,
- input_section, rel->r_offset,
- (!info->shared || info->no_undefined
- || ELF_ST_VISIBILITY (h->other)))))
- return false;
-
/* 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
@@ -2090,7 +2140,8 @@ sparc64_elf_relocate_section (output_bfd, info, input_bfd, input_section,
case R_SPARC_UA16:
{
Elf_Internal_Rela outrel;
- boolean skip, relocate;
+ bfd_byte *loc;
+ bfd_boolean skip, relocate;
if (sreloc == NULL)
{
@@ -2101,7 +2152,7 @@ sparc64_elf_relocate_section (output_bfd, info, input_bfd, input_section,
elf_section_data (input_section)->rel_hdr.sh_name));
if (name == NULL)
- return false;
+ return FALSE;
BFD_ASSERT (strncmp (name, ".rela", 5) == 0
&& strcmp (bfd_get_section_name(input_bfd,
@@ -2112,16 +2163,16 @@ sparc64_elf_relocate_section (output_bfd, info, input_bfd, input_section,
BFD_ASSERT (sreloc != NULL);
}
- skip = false;
- relocate = false;
+ 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;
+ skip = TRUE;
else if (outrel.r_offset == (bfd_vma) -2)
- skip = true, relocate = true;
+ skip = TRUE, relocate = TRUE;
outrel.r_offset += (input_section->output_section->vma
+ input_section->output_offset);
@@ -2158,7 +2209,7 @@ sparc64_elf_relocate_section (output_bfd, info, input_bfd, input_section,
FIXME: Add code tracking needed dynamic relocs as
e.g. i386 has. */
if (h->dynindx == -1)
- skip = true, relocate = true;
+ skip = TRUE, relocate = TRUE;
break;
}
@@ -2190,21 +2241,13 @@ sparc64_elf_relocate_section (output_bfd, info, input_bfd, input_section,
if (is_plt)
sec = splt;
- else if (h == NULL)
- sec = local_sections[r_symndx];
- else
- {
- BFD_ASSERT (h->root.type == bfd_link_hash_defined
- || (h->root.type
- == bfd_link_hash_defweak));
- sec = h->root.u.def.section;
- }
- if (sec != NULL && bfd_is_abs_section (sec))
+
+ if (bfd_is_abs_section (sec))
indx = 0;
else if (sec == NULL || sec->owner == NULL)
{
bfd_set_error (bfd_error_bad_value);
- return false;
+ return FALSE;
}
else
{
@@ -2229,7 +2272,7 @@ sparc64_elf_relocate_section (output_bfd, info, input_bfd, input_section,
(_("%s: probably compiled without -fPIC?"),
bfd_archive_filename (input_bfd));
bfd_set_error (bfd_error_bad_value);
- return false;
+ return FALSE;
}
}
@@ -2241,11 +2284,9 @@ sparc64_elf_relocate_section (output_bfd, info, input_bfd, input_section,
}
}
- bfd_elf64_swap_reloca_out (output_bfd, &outrel,
- (((Elf64_External_Rela *)
- sreloc->contents)
- + sreloc->reloc_count));
- ++sreloc->reloc_count;
+ 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. */
@@ -2271,13 +2312,13 @@ sparc64_elf_relocate_section (output_bfd, info, input_bfd, input_section,
if (h != NULL)
{
- boolean dyn;
+ 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, h)
+ if (! WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, info->shared, h)
|| (info->shared
&& (info->symbolic
|| h->dynindx == -1
@@ -2306,7 +2347,7 @@ sparc64_elf_relocate_section (output_bfd, info, input_bfd, input_section,
}
}
else
- unresolved_reloc = false;
+ unresolved_reloc = FALSE;
}
else
{
@@ -2325,8 +2366,9 @@ sparc64_elf_relocate_section (output_bfd, info, input_bfd, input_section,
if (info->shared)
{
- asection *srelgot;
+ 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.
@@ -2338,19 +2380,17 @@ sparc64_elf_relocate_section (output_bfd, info, input_bfd, input_section,
/* We need to generate a R_SPARC_RELATIVE reloc
for the dynamic linker. */
- srelgot = bfd_get_section_by_name(dynobj, ".rela.got");
- BFD_ASSERT (srelgot != NULL);
+ 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;
- bfd_elf64_swap_reloca_out (output_bfd, &outrel,
- (((Elf64_External_Rela *)
- srelgot->contents)
- + srelgot->reloc_count));
- ++srelgot->reloc_count;
+ 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);
@@ -2371,7 +2411,7 @@ sparc64_elf_relocate_section (output_bfd, info, input_bfd, input_section,
procedure linkage table. */
BFD_ASSERT (h != NULL);
- if (h->plt.offset == (bfd_vma) -1)
+ 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
@@ -2379,22 +2419,16 @@ sparc64_elf_relocate_section (output_bfd, info, input_bfd, input_section,
goto do_default;
}
- if (splt == NULL)
- {
- splt = bfd_get_section_by_name (dynobj, ".plt");
- BFD_ASSERT (splt != NULL);
- }
-
relocation = (splt->output_section->vma
+ splt->output_offset
+ sparc64_elf_plt_entry_offset (h->plt.offset));
- unresolved_reloc = false;
+ 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;
+ is_plt = TRUE;
goto do_dynreloc;
}
goto do_default;
@@ -2475,7 +2509,7 @@ sparc64_elf_relocate_section (output_bfd, info, input_bfd, input_section,
case R_SPARC_WDISP30:
do_wplt30:
- if (SEC_DO_RELAX (input_section)
+ if (sec_do_relax (input_section)
&& rel->r_offset + 4 < input_section->_raw_size)
{
#define G0 0
@@ -2562,7 +2596,7 @@ sparc64_elf_relocate_section (output_bfd, info, input_bfd, input_section,
}
}
}
- /* FALLTHROUGH */
+ /* Fall through. */
default:
do_default:
@@ -2601,11 +2635,10 @@ sparc64_elf_relocate_section (output_bfd, info, input_bfd, input_section,
/* 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. */
- if (r_type == R_SPARC_32
- && (input_section->flags & SEC_DEBUGGING) != 0
- && strcmp (bfd_section_name (input_bfd, input_section),
- ".stab") == 0)
+ 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)
@@ -2630,26 +2663,26 @@ sparc64_elf_relocate_section (output_bfd, info, input_bfd, input_section,
symtab_hdr->sh_link,
sym->st_name));
if (name == NULL)
- return false;
+ 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;
+ return FALSE;
}
break;
}
}
- return true;
+ return TRUE;
}
/* Finish up dynamic symbol handling. We set the contents of various
dynamic sections here. */
-static boolean
+static bfd_boolean
sparc64_elf_finish_dynamic_symbol (output_bfd, info, h, sym)
bfd *output_bfd;
struct bfd_link_info *info;
@@ -2665,6 +2698,7 @@ sparc64_elf_finish_dynamic_symbol (output_bfd, info, h, sym)
asection *splt;
asection *srela;
Elf_Internal_Rela rela;
+ bfd_byte *loc;
/* This symbol has an entry in the PLT. Set it up. */
@@ -2696,9 +2730,9 @@ sparc64_elf_finish_dynamic_symbol (output_bfd, info, h, sym)
Sun forgot to read their own ABI and copied elf32-sparc behaviour,
thus .plt[4] has corresponding .rela.plt[0] and so on. */
- bfd_elf64_swap_reloca_out (output_bfd, &rela,
- ((Elf64_External_Rela *) srela->contents
- + (h->plt.offset - 4)));
+ 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)
{
@@ -2720,6 +2754,7 @@ sparc64_elf_finish_dynamic_symbol (output_bfd, info, h, sym)
asection *sgot;
asection *srela;
Elf_Internal_Rela rela;
+ bfd_byte *loc;
/* This symbol has an entry in the GOT. Set it up. */
@@ -2748,24 +2783,24 @@ sparc64_elf_finish_dynamic_symbol (output_bfd, info, h, sym)
}
else
{
- bfd_put_64 (output_bfd, (bfd_vma) 0, sgot->contents + h->got.offset);
rela.r_info = ELF64_R_INFO (h->dynindx, R_SPARC_GLOB_DAT);
rela.r_addend = 0;
}
- bfd_elf64_swap_reloca_out (output_bfd, &rela,
- ((Elf64_External_Rela *) srela->contents
- + srela->reloc_count));
- ++srela->reloc_count;
+ 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,
@@ -2777,10 +2812,8 @@ sparc64_elf_finish_dynamic_symbol (output_bfd, info, h, sym)
+ h->root.u.def.section->output_offset);
rela.r_info = ELF64_R_INFO (h->dynindx, R_SPARC_COPY);
rela.r_addend = 0;
- bfd_elf64_swap_reloca_out (output_bfd, &rela,
- ((Elf64_External_Rela *) s->contents
- + s->reloc_count));
- ++s->reloc_count;
+ loc = 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. */
@@ -2789,12 +2822,12 @@ sparc64_elf_finish_dynamic_symbol (output_bfd, info, h, sym)
|| strcmp (h->root.root.string, "_PROCEDURE_LINKAGE_TABLE_") == 0)
sym->st_shndx = SHN_ABS;
- return true;
+ return TRUE;
}
/* Finish up the dynamic sections. */
-static boolean
+static bfd_boolean
sparc64_elf_finish_dynamic_sections (output_bfd, info)
bfd *output_bfd;
struct bfd_link_info *info;
@@ -2822,27 +2855,27 @@ sparc64_elf_finish_dynamic_sections (output_bfd, info)
{
Elf_Internal_Dyn dyn;
const char *name;
- boolean size;
+ 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_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;
+ 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;
+ default: name = NULL; size = FALSE; break;
}
if (name != NULL)
@@ -2870,10 +2903,8 @@ sparc64_elf_finish_dynamic_sections (output_bfd, info)
/* 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));
- }
+ 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;
@@ -2895,7 +2926,7 @@ sparc64_elf_finish_dynamic_sections (output_bfd, info)
elf_section_data (sgot->output_section)->this_hdr.sh_entsize = 8;
- return true;
+ return TRUE;
}
static enum elf_reloc_type_class
@@ -2920,25 +2951,25 @@ sparc64_elf_reloc_type_class (rela)
/* Merge backend specific data from an object file to the output
object file when linking. */
-static boolean
+static bfd_boolean
sparc64_elf_merge_private_bfd_data (ibfd, obfd)
bfd *ibfd;
bfd *obfd;
{
- boolean error;
+ bfd_boolean error;
flagword new_flags, old_flags;
int new_mm, old_mm;
if (bfd_get_flavour (ibfd) != bfd_target_elf_flavour
|| bfd_get_flavour (obfd) != bfd_target_elf_flavour)
- return true;
+ return TRUE;
new_flags = elf_elfheader (ibfd)->e_flags;
old_flags = elf_elfheader (obfd)->e_flags;
if (!elf_flags_init (obfd)) /* First call, no flags set */
{
- elf_flags_init (obfd) = true;
+ elf_flags_init (obfd) = TRUE;
elf_elfheader (obfd)->e_flags = new_flags;
}
@@ -2947,7 +2978,7 @@ sparc64_elf_merge_private_bfd_data (ibfd, obfd)
else /* Incompatible flags */
{
- error = false;
+ error = FALSE;
#define EF_SPARC_ISA_EXTENSIONS \
(EF_SPARC_SUN_US1 | EF_SPARC_SUN_US3 | EF_SPARC_HAL_R1)
@@ -2969,7 +3000,7 @@ sparc64_elf_merge_private_bfd_data (ibfd, obfd)
if ((old_flags & (EF_SPARC_SUN_US1 | EF_SPARC_SUN_US3))
&& (old_flags & EF_SPARC_HAL_R1))
{
- error = true;
+ error = TRUE;
(*_bfd_error_handler)
(_("%s: linking UltraSPARC specific with HAL specific code"),
bfd_archive_filename (ibfd));
@@ -2988,7 +3019,7 @@ sparc64_elf_merge_private_bfd_data (ibfd, obfd)
/* Warn about any other mismatches */
if (new_flags != old_flags)
{
- error = true;
+ 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);
@@ -2999,18 +3030,18 @@ sparc64_elf_merge_private_bfd_data (ibfd, obfd)
if (error)
{
bfd_set_error (bfd_error_bad_value);
- return false;
+ return FALSE;
}
}
- return true;
+ return TRUE;
}
/* MARCO: Set the correct entry size for the .stab section. */
-static boolean
+static bfd_boolean
sparc64_elf_fake_sections (abfd, hdr, sec)
bfd *abfd ATTRIBUTE_UNUSED;
- Elf32_Internal_Shdr *hdr ATTRIBUTE_UNUSED;
+ Elf_Internal_Shdr *hdr ATTRIBUTE_UNUSED;
asection *sec;
{
const char *name;
@@ -3022,8 +3053,8 @@ sparc64_elf_fake_sections (abfd, hdr, sec)
/* Even in the 64bit case the stab entries are only 12 bytes long. */
elf_section_data (sec)->this_hdr.sh_entsize = 12;
}
-
- return true;
+
+ return TRUE;
}
/* Print a STT_REGISTER symbol to file FILE. */
@@ -3056,7 +3087,7 @@ sparc64_elf_print_symbol_all (abfd, filep, symbol)
/* Set the right machine number for a SPARC64 ELF file. */
-static boolean
+static bfd_boolean
sparc64_elf_object_p (abfd)
bfd *abfd;
{
@@ -3084,14 +3115,14 @@ const struct elf_size_info sparc64_elf_size_info =
sizeof (Elf64_External_Sym),
sizeof (Elf64_External_Dyn),
sizeof (Elf_External_Note),
- 4, /* hash-table entry size */
- /* internal relocations per external relocations.
+ 4, /* hash-table entry size. */
+ /* Internal relocations per external relocations.
For link purposes we use just 1 internal per
1 external, for assembly and slurp symbol table
we use 2. */
1,
- 64, /* arch_size */
- 8, /* file_align */
+ 64, /* arch_size. */
+ 3, /* log_file_align. */
ELFCLASS64,
EV_CURRENT,
bfd_elf64_write_out_phdrs,
@@ -3103,10 +3134,10 @@ const struct elf_size_info sparc64_elf_size_info =
bfd_elf64_slurp_symbol_table,
bfd_elf64_swap_dyn_in,
bfd_elf64_swap_dyn_out,
- NULL,
- NULL,
- NULL,
- NULL
+ bfd_elf64_swap_reloc_in,
+ bfd_elf64_swap_reloc_out,
+ bfd_elf64_swap_reloca_in,
+ bfd_elf64_swap_reloca_out
};
#define TARGET_BIG_SYM bfd_elf64_sparc_vec
@@ -3129,12 +3160,16 @@ const struct elf_size_info sparc64_elf_size_info =
sparc64_elf_get_reloc_upper_bound
#define bfd_elf64_get_dynamic_reloc_upper_bound \
sparc64_elf_get_dynamic_reloc_upper_bound
+#define bfd_elf64_canonicalize_reloc \
+ sparc64_elf_canonicalize_reloc
#define bfd_elf64_canonicalize_dynamic_reloc \
sparc64_elf_canonicalize_dynamic_reloc
#define bfd_elf64_bfd_reloc_type_lookup \
sparc64_elf_reloc_type_lookup
#define bfd_elf64_bfd_relax_section \
sparc64_elf_relax_section
+#define bfd_elf64_new_section_hook \
+ sparc64_elf_new_section_hook
#define elf_backend_create_dynamic_sections \
_bfd_elf_create_dynamic_sections
@@ -3175,11 +3210,11 @@ const struct elf_size_info sparc64_elf_size_info =
#define elf_backend_want_got_plt 0
#define elf_backend_plt_readonly 0
#define elf_backend_want_plt_sym 1
+#define elf_backend_rela_normal 1
/* Section 5.2.4 of the ABI specifies a 256-byte boundary for the table. */
#define elf_backend_plt_alignment 8
#define elf_backend_got_header_size 8
-#define elf_backend_plt_header_size PLT_HEADER_SIZE
#include "elf64-target.h"
diff --git a/contrib/binutils/bfd/elf64-x86-64.c b/contrib/binutils/bfd/elf64-x86-64.c
index a7303d0..a1d6250 100644
--- a/contrib/binutils/bfd/elf64-x86-64.c
+++ b/contrib/binutils/bfd/elf64-x86-64.c
@@ -1,22 +1,22 @@
/* X86-64 specific support for 64-bit ELF
- Copyright 2000, 2001, 2002 Free Software Foundation, Inc.
+ Copyright 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
Contributed by Jan Hubicka <jh@suse.cz>.
-This file is part of BFD, the Binary File Descriptor library.
+ This 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "bfd.h"
#include "sysdep.h"
@@ -26,9 +26,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "elf/x86-64.h"
-/* We use only the RELA entries. */
-#define USE_RELA 1
-
/* In case we're on a 32-bit machine, construct a 64-bit "-1" value. */
#define MINUS_ONE (~ (bfd_vma) 0)
@@ -37,59 +34,83 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
special_function, name, partial_inplace, src_mask, dst_pack, pcrel_offset. */
static reloc_howto_type x86_64_elf_howto_table[] =
{
- HOWTO(R_X86_64_NONE, 0, 0, 0, false, 0, complain_overflow_dont,
- bfd_elf_generic_reloc, "R_X86_64_NONE", false, 0x00000000, 0x00000000,
- false),
- HOWTO(R_X86_64_64, 0, 4, 64, false, 0, complain_overflow_bitfield,
- bfd_elf_generic_reloc, "R_X86_64_64", false, MINUS_ONE, MINUS_ONE,
- false),
- HOWTO(R_X86_64_PC32, 0, 4, 32, true, 0, complain_overflow_signed,
- bfd_elf_generic_reloc, "R_X86_64_PC32", false, 0xffffffff, 0xffffffff,
- true),
- HOWTO(R_X86_64_GOT32, 0, 4, 32, false, 0, complain_overflow_signed,
- bfd_elf_generic_reloc, "R_X86_64_GOT32", false, 0xffffffff, 0xffffffff,
- false),
- HOWTO(R_X86_64_PLT32, 0, 4, 32, true, 0, complain_overflow_signed,
- bfd_elf_generic_reloc, "R_X86_64_PLT32", false, 0xffffffff, 0xffffffff,
- true),
- HOWTO(R_X86_64_COPY, 0, 4, 32, false, 0, complain_overflow_bitfield,
- bfd_elf_generic_reloc, "R_X86_64_COPY", false, 0xffffffff, 0xffffffff,
- false),
- HOWTO(R_X86_64_GLOB_DAT, 0, 4, 64, false, 0, complain_overflow_bitfield,
- bfd_elf_generic_reloc, "R_X86_64_GLOB_DAT", false, MINUS_ONE,
- MINUS_ONE, false),
- HOWTO(R_X86_64_JUMP_SLOT, 0, 4, 64, false, 0, complain_overflow_bitfield,
- bfd_elf_generic_reloc, "R_X86_64_JUMP_SLOT", false, MINUS_ONE,
- MINUS_ONE, false),
- HOWTO(R_X86_64_RELATIVE, 0, 4, 64, false, 0, complain_overflow_bitfield,
- bfd_elf_generic_reloc, "R_X86_64_RELATIVE", false, MINUS_ONE,
- MINUS_ONE, false),
- HOWTO(R_X86_64_GOTPCREL, 0, 4, 32, true,0 , complain_overflow_signed,
- bfd_elf_generic_reloc, "R_X86_64_GOTPCREL", false, 0xffffffff,
- 0xffffffff, true),
- HOWTO(R_X86_64_32, 0, 4, 32, false, 0, complain_overflow_unsigned,
- bfd_elf_generic_reloc, "R_X86_64_32", false, 0xffffffff, 0xffffffff,
- false),
- HOWTO(R_X86_64_32S, 0, 4, 32, false, 0, complain_overflow_signed,
- bfd_elf_generic_reloc, "R_X86_64_32S", false, 0xffffffff, 0xffffffff,
- false),
- HOWTO(R_X86_64_16, 0, 1, 16, false, 0, complain_overflow_bitfield,
- bfd_elf_generic_reloc, "R_X86_64_16", false, 0xffff, 0xffff, false),
- HOWTO(R_X86_64_PC16,0, 1, 16, true, 0, complain_overflow_bitfield,
- bfd_elf_generic_reloc, "R_X86_64_PC16", false, 0xffff, 0xffff, true),
- HOWTO(R_X86_64_8, 0, 0, 8, false, 0, complain_overflow_signed,
- bfd_elf_generic_reloc, "R_X86_64_8", false, 0xff, 0xff, false),
- HOWTO(R_X86_64_PC8, 0, 0, 8, true, 0, complain_overflow_signed,
- bfd_elf_generic_reloc, "R_X86_64_PC8", false, 0xff, 0xff, true),
+ HOWTO(R_X86_64_NONE, 0, 0, 0, FALSE, 0, complain_overflow_dont,
+ bfd_elf_generic_reloc, "R_X86_64_NONE", FALSE, 0x00000000, 0x00000000,
+ FALSE),
+ HOWTO(R_X86_64_64, 0, 4, 64, FALSE, 0, complain_overflow_bitfield,
+ bfd_elf_generic_reloc, "R_X86_64_64", FALSE, MINUS_ONE, MINUS_ONE,
+ FALSE),
+ HOWTO(R_X86_64_PC32, 0, 2, 32, TRUE, 0, complain_overflow_signed,
+ bfd_elf_generic_reloc, "R_X86_64_PC32", FALSE, 0xffffffff, 0xffffffff,
+ TRUE),
+ HOWTO(R_X86_64_GOT32, 0, 2, 32, FALSE, 0, complain_overflow_signed,
+ bfd_elf_generic_reloc, "R_X86_64_GOT32", FALSE, 0xffffffff, 0xffffffff,
+ FALSE),
+ HOWTO(R_X86_64_PLT32, 0, 2, 32, TRUE, 0, complain_overflow_signed,
+ bfd_elf_generic_reloc, "R_X86_64_PLT32", FALSE, 0xffffffff, 0xffffffff,
+ TRUE),
+ HOWTO(R_X86_64_COPY, 0, 2, 32, FALSE, 0, complain_overflow_bitfield,
+ bfd_elf_generic_reloc, "R_X86_64_COPY", FALSE, 0xffffffff, 0xffffffff,
+ FALSE),
+ HOWTO(R_X86_64_GLOB_DAT, 0, 4, 64, FALSE, 0, complain_overflow_bitfield,
+ bfd_elf_generic_reloc, "R_X86_64_GLOB_DAT", FALSE, MINUS_ONE,
+ MINUS_ONE, FALSE),
+ HOWTO(R_X86_64_JUMP_SLOT, 0, 4, 64, FALSE, 0, complain_overflow_bitfield,
+ bfd_elf_generic_reloc, "R_X86_64_JUMP_SLOT", FALSE, MINUS_ONE,
+ MINUS_ONE, FALSE),
+ HOWTO(R_X86_64_RELATIVE, 0, 4, 64, FALSE, 0, complain_overflow_bitfield,
+ bfd_elf_generic_reloc, "R_X86_64_RELATIVE", FALSE, MINUS_ONE,
+ MINUS_ONE, FALSE),
+ HOWTO(R_X86_64_GOTPCREL, 0, 2, 32, TRUE, 0, complain_overflow_signed,
+ bfd_elf_generic_reloc, "R_X86_64_GOTPCREL", FALSE, 0xffffffff,
+ 0xffffffff, TRUE),
+ HOWTO(R_X86_64_32, 0, 2, 32, FALSE, 0, complain_overflow_unsigned,
+ bfd_elf_generic_reloc, "R_X86_64_32", FALSE, 0xffffffff, 0xffffffff,
+ FALSE),
+ HOWTO(R_X86_64_32S, 0, 2, 32, FALSE, 0, complain_overflow_signed,
+ bfd_elf_generic_reloc, "R_X86_64_32S", FALSE, 0xffffffff, 0xffffffff,
+ FALSE),
+ HOWTO(R_X86_64_16, 0, 1, 16, FALSE, 0, complain_overflow_bitfield,
+ bfd_elf_generic_reloc, "R_X86_64_16", FALSE, 0xffff, 0xffff, FALSE),
+ HOWTO(R_X86_64_PC16,0, 1, 16, TRUE, 0, complain_overflow_bitfield,
+ bfd_elf_generic_reloc, "R_X86_64_PC16", FALSE, 0xffff, 0xffff, TRUE),
+ HOWTO(R_X86_64_8, 0, 0, 8, FALSE, 0, complain_overflow_signed,
+ bfd_elf_generic_reloc, "R_X86_64_8", FALSE, 0xff, 0xff, FALSE),
+ HOWTO(R_X86_64_PC8, 0, 0, 8, TRUE, 0, complain_overflow_signed,
+ bfd_elf_generic_reloc, "R_X86_64_PC8", FALSE, 0xff, 0xff, TRUE),
+ HOWTO(R_X86_64_DTPMOD64, 0, 4, 64, FALSE, 0, complain_overflow_bitfield,
+ bfd_elf_generic_reloc, "R_X86_64_DTPMOD64", FALSE, MINUS_ONE,
+ MINUS_ONE, FALSE),
+ HOWTO(R_X86_64_DTPOFF64, 0, 4, 64, FALSE, 0, complain_overflow_bitfield,
+ bfd_elf_generic_reloc, "R_X86_64_DTPOFF64", FALSE, MINUS_ONE,
+ MINUS_ONE, FALSE),
+ HOWTO(R_X86_64_TPOFF64, 0, 4, 64, FALSE, 0, complain_overflow_bitfield,
+ bfd_elf_generic_reloc, "R_X86_64_TPOFF64", FALSE, MINUS_ONE,
+ MINUS_ONE, FALSE),
+ HOWTO(R_X86_64_TLSGD, 0, 2, 32, TRUE, 0, complain_overflow_signed,
+ bfd_elf_generic_reloc, "R_X86_64_TLSGD", FALSE, 0xffffffff,
+ 0xffffffff, TRUE),
+ HOWTO(R_X86_64_TLSLD, 0, 2, 32, TRUE, 0, complain_overflow_signed,
+ bfd_elf_generic_reloc, "R_X86_64_TLSLD", FALSE, 0xffffffff,
+ 0xffffffff, TRUE),
+ HOWTO(R_X86_64_DTPOFF32, 0, 2, 32, FALSE, 0, complain_overflow_bitfield,
+ bfd_elf_generic_reloc, "R_X86_64_DTPOFF32", FALSE, 0xffffffff,
+ 0xffffffff, FALSE),
+ HOWTO(R_X86_64_GOTTPOFF, 0, 2, 32, TRUE, 0, complain_overflow_signed,
+ bfd_elf_generic_reloc, "R_X86_64_GOTTPOFF", FALSE, 0xffffffff,
+ 0xffffffff, TRUE),
+ HOWTO(R_X86_64_TPOFF32, 0, 2, 32, FALSE, 0, complain_overflow_signed,
+ bfd_elf_generic_reloc, "R_X86_64_TPOFF32", FALSE, 0xffffffff,
+ 0xffffffff, FALSE),
/* GNU extension to record C++ vtable hierarchy. */
- HOWTO (R_X86_64_GNU_VTINHERIT, 0, 4, 0, false, 0, complain_overflow_dont,
- NULL, "R_X86_64_GNU_VTINHERIT", false, 0, 0, false),
+ HOWTO (R_X86_64_GNU_VTINHERIT, 0, 4, 0, FALSE, 0, complain_overflow_dont,
+ NULL, "R_X86_64_GNU_VTINHERIT", FALSE, 0, 0, FALSE),
/* GNU extension to record C++ vtable member usage. */
- HOWTO (R_X86_64_GNU_VTENTRY, 0, 4, 0, false, 0, complain_overflow_dont,
- _bfd_elf_rel_vtable_reloc_fn, "R_X86_64_GNU_VTENTRY", false, 0, 0,
- false)
+ HOWTO (R_X86_64_GNU_VTENTRY, 0, 4, 0, FALSE, 0, complain_overflow_dont,
+ _bfd_elf_rel_vtable_reloc_fn, "R_X86_64_GNU_VTENTRY", FALSE, 0, 0,
+ FALSE)
};
/* Map BFD relocs to the x86_64 elf relocs. */
@@ -117,68 +138,26 @@ static const struct elf_reloc_map x86_64_reloc_map[] =
{ BFD_RELOC_16_PCREL, R_X86_64_PC16, },
{ BFD_RELOC_8, R_X86_64_8, },
{ BFD_RELOC_8_PCREL, R_X86_64_PC8, },
+ { BFD_RELOC_X86_64_DTPMOD64, R_X86_64_DTPMOD64, },
+ { BFD_RELOC_X86_64_DTPOFF64, R_X86_64_DTPOFF64, },
+ { BFD_RELOC_X86_64_TPOFF64, R_X86_64_TPOFF64, },
+ { BFD_RELOC_X86_64_TLSGD, R_X86_64_TLSGD, },
+ { BFD_RELOC_X86_64_TLSLD, R_X86_64_TLSLD, },
+ { BFD_RELOC_X86_64_DTPOFF32, R_X86_64_DTPOFF32, },
+ { BFD_RELOC_X86_64_GOTTPOFF, R_X86_64_GOTTPOFF, },
+ { BFD_RELOC_X86_64_TPOFF32, R_X86_64_TPOFF32, },
{ BFD_RELOC_VTABLE_INHERIT, R_X86_64_GNU_VTINHERIT, },
{ BFD_RELOC_VTABLE_ENTRY, R_X86_64_GNU_VTENTRY, },
};
-static reloc_howto_type *elf64_x86_64_reloc_type_lookup
- PARAMS ((bfd *, bfd_reloc_code_real_type));
-static void elf64_x86_64_info_to_howto
- PARAMS ((bfd *, arelent *, Elf64_Internal_Rela *));
-static boolean elf64_x86_64_grok_prstatus
- PARAMS ((bfd *, Elf_Internal_Note *));
-static boolean elf64_x86_64_grok_psinfo
- PARAMS ((bfd *, Elf_Internal_Note *));
-static struct bfd_link_hash_table *elf64_x86_64_link_hash_table_create
- PARAMS ((bfd *));
-static boolean elf64_x86_64_elf_object_p PARAMS ((bfd *abfd));
-static boolean create_got_section
- PARAMS((bfd *, struct bfd_link_info *));
-static boolean elf64_x86_64_create_dynamic_sections
- PARAMS((bfd *, struct bfd_link_info *));
-static void elf64_x86_64_copy_indirect_symbol
- PARAMS ((struct elf_backend_data *, struct elf_link_hash_entry *,
- struct elf_link_hash_entry *));
-static boolean elf64_x86_64_check_relocs
- PARAMS ((bfd *, struct bfd_link_info *, asection *sec,
- const Elf_Internal_Rela *));
-static asection *elf64_x86_64_gc_mark_hook
- PARAMS ((asection *, struct bfd_link_info *, Elf_Internal_Rela *,
- struct elf_link_hash_entry *, Elf_Internal_Sym *));
-
-static boolean elf64_x86_64_gc_sweep_hook
- PARAMS ((bfd *, struct bfd_link_info *, asection *,
- const Elf_Internal_Rela *));
-
-static struct bfd_hash_entry *link_hash_newfunc
- PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, const char *));
-static boolean elf64_x86_64_adjust_dynamic_symbol
- PARAMS ((struct bfd_link_info *, struct elf_link_hash_entry *));
-
-static boolean allocate_dynrelocs
- PARAMS ((struct elf_link_hash_entry *, PTR));
-static boolean readonly_dynrelocs
- PARAMS ((struct elf_link_hash_entry *, PTR));
-static boolean elf64_x86_64_size_dynamic_sections
- PARAMS ((bfd *, struct bfd_link_info *));
-static boolean elf64_x86_64_relocate_section
- PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *,
- Elf_Internal_Rela *, Elf_Internal_Sym *, asection **));
-static boolean elf64_x86_64_finish_dynamic_symbol
- PARAMS ((bfd *, struct bfd_link_info *, struct elf_link_hash_entry *,
- Elf_Internal_Sym *sym));
-static boolean elf64_x86_64_finish_dynamic_sections
- PARAMS ((bfd *, struct bfd_link_info *));
-static enum elf_reloc_type_class elf64_x86_64_reloc_type_class
- PARAMS ((const Elf_Internal_Rela *));
/* Given a BFD reloc type, return a HOWTO structure. */
static reloc_howto_type *
-elf64_x86_64_reloc_type_lookup (abfd, code)
- bfd *abfd ATTRIBUTE_UNUSED;
- bfd_reloc_code_real_type code;
+elf64_x86_64_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED,
+ bfd_reloc_code_real_type code)
{
unsigned int i;
+
for (i = 0; i < sizeof (x86_64_reloc_map) / sizeof (struct elf_reloc_map);
i++)
{
@@ -191,33 +170,29 @@ elf64_x86_64_reloc_type_lookup (abfd, code)
/* Given an x86_64 ELF reloc type, fill in an arelent structure. */
static void
-elf64_x86_64_info_to_howto (abfd, cache_ptr, dst)
- bfd *abfd ATTRIBUTE_UNUSED;
- arelent *cache_ptr;
- Elf64_Internal_Rela *dst;
+elf64_x86_64_info_to_howto (bfd *abfd ATTRIBUTE_UNUSED, arelent *cache_ptr,
+ Elf_Internal_Rela *dst)
{
unsigned r_type, i;
r_type = ELF64_R_TYPE (dst->r_info);
if (r_type < (unsigned int) R_X86_64_GNU_VTINHERIT)
{
- BFD_ASSERT (r_type <= (unsigned int) R_X86_64_PC8);
+ 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_PC8 - 1);
+ i = r_type - ((unsigned int) R_X86_64_GNU_VTINHERIT - R_X86_64_TPOFF32 - 1);
}
cache_ptr->howto = &x86_64_elf_howto_table[i];
BFD_ASSERT (r_type == cache_ptr->howto->type);
}
/* Support for core dump NOTE sections. */
-static boolean
-elf64_x86_64_grok_prstatus (abfd, note)
- bfd *abfd;
- Elf_Internal_Note *note;
+static bfd_boolean
+elf64_x86_64_grok_prstatus (bfd *abfd, Elf_Internal_Note *note)
{
int offset;
size_t raw_size;
@@ -225,7 +200,7 @@ elf64_x86_64_grok_prstatus (abfd, note)
switch (note->descsz)
{
default:
- return false;
+ return FALSE;
case 336: /* sizeof(istruct elf_prstatus) on Linux/x86_64 */
/* pr_cursig */
@@ -248,15 +223,13 @@ elf64_x86_64_grok_prstatus (abfd, note)
raw_size, note->descpos + offset);
}
-static boolean
-elf64_x86_64_grok_psinfo (abfd, note)
- bfd *abfd;
- Elf_Internal_Note *note;
+static bfd_boolean
+elf64_x86_64_grok_psinfo (bfd *abfd, Elf_Internal_Note *note)
{
switch (note->descsz)
{
default:
- return false;
+ return FALSE;
case 136: /* sizeof(struct elf_prpsinfo) on Linux/x86_64 */
elf_tdata (abfd)->core_program
@@ -277,7 +250,7 @@ elf64_x86_64_grok_psinfo (abfd, note)
command[n - 1] = '\0';
}
- return true;
+ return TRUE;
}
/* Functions for the x86-64 ELF linker. */
@@ -287,6 +260,12 @@ elf64_x86_64_grok_psinfo (abfd, note)
#define ELF_DYNAMIC_INTERPRETER "/lib/ld64.so.1"
+/* If ELIMINATE_COPY_RELOCS is non-zero, the linker will try to avoid
+ copying dynamic variables from a shared lib into an app's dynbss
+ section, and instead use a dynamic relocation to point into the
+ shared lib. */
+#define ELIMINATE_COPY_RELOCS 1
+
/* The size in bytes of an entry in the global offset table. */
#define GOT_ENTRY_SIZE 8
@@ -346,8 +325,32 @@ struct elf64_x86_64_link_hash_entry
/* Track dynamic relocs copied for this symbol. */
struct elf64_x86_64_dyn_relocs *dyn_relocs;
+
+#define GOT_UNKNOWN 0
+#define GOT_NORMAL 1
+#define GOT_TLS_GD 2
+#define GOT_TLS_IE 3
+ unsigned char tls_type;
+};
+
+#define elf64_x86_64_hash_entry(ent) \
+ ((struct elf64_x86_64_link_hash_entry *)(ent))
+
+struct elf64_x86_64_obj_tdata
+{
+ struct elf_obj_tdata root;
+
+ /* tls_type for each local got entry. */
+ char *local_got_tls_type;
};
+#define elf64_x86_64_tdata(abfd) \
+ ((struct elf64_x86_64_obj_tdata *) (abfd)->tdata.any)
+
+#define elf64_x86_64_local_got_tls_type(abfd) \
+ (elf64_x86_64_tdata (abfd)->local_got_tls_type)
+
+
/* x86-64 ELF linker hash table. */
struct elf64_x86_64_link_hash_table
@@ -363,6 +366,11 @@ struct elf64_x86_64_link_hash_table
asection *sdynbss;
asection *srelbss;
+ union {
+ bfd_signed_vma refcount;
+ bfd_vma offset;
+ } tls_ld_got;
+
/* Small local sym to section mapping cache. */
struct sym_sec_cache sym_sec;
};
@@ -375,10 +383,8 @@ struct elf64_x86_64_link_hash_table
/* Create an entry in an x86-64 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;
+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. */
@@ -398,6 +404,7 @@ link_hash_newfunc (entry, table, string)
eh = (struct elf64_x86_64_link_hash_entry *) entry;
eh->dyn_relocs = NULL;
+ eh->tls_type = GOT_UNKNOWN;
}
return entry;
@@ -406,8 +413,7 @@ link_hash_newfunc (entry, table, string)
/* Create an X86-64 ELF linker hash table. */
static struct bfd_link_hash_table *
-elf64_x86_64_link_hash_table_create (abfd)
- bfd *abfd;
+elf64_x86_64_link_hash_table_create (bfd *abfd)
{
struct elf64_x86_64_link_hash_table *ret;
bfd_size_type amt = sizeof (struct elf64_x86_64_link_hash_table);
@@ -430,6 +436,7 @@ elf64_x86_64_link_hash_table_create (abfd)
ret->sdynbss = NULL;
ret->srelbss = NULL;
ret->sym_sec.abfd = NULL;
+ ret->tls_ld_got.refcount = 0;
return &ret->elf.root;
}
@@ -437,15 +444,13 @@ elf64_x86_64_link_hash_table_create (abfd)
/* Create .got, .gotplt, and .rela.got sections in DYNOBJ, and set up
shortcuts to them in our hash table. */
-static boolean
-create_got_section (dynobj, info)
- bfd *dynobj;
- struct bfd_link_info *info;
+static bfd_boolean
+create_got_section (bfd *dynobj, struct bfd_link_info *info)
{
struct elf64_x86_64_link_hash_table *htab;
if (! _bfd_elf_create_got_section (dynobj, info))
- return false;
+ return FALSE;
htab = elf64_x86_64_hash_table (info);
htab->sgot = bfd_get_section_by_name (dynobj, ".got");
@@ -460,27 +465,25 @@ create_got_section (dynobj, info)
| SEC_IN_MEMORY | SEC_LINKER_CREATED
| SEC_READONLY))
|| ! bfd_set_section_alignment (dynobj, htab->srelgot, 3))
- return false;
- return true;
+ return FALSE;
+ return TRUE;
}
/* Create .plt, .rela.plt, .got, .got.plt, .rela.got, .dynbss, and
.rela.bss sections in DYNOBJ, and set up shortcuts to them in our
hash table. */
-static boolean
-elf64_x86_64_create_dynamic_sections (dynobj, info)
- bfd *dynobj;
- struct bfd_link_info *info;
+static bfd_boolean
+elf64_x86_64_create_dynamic_sections (bfd *dynobj, struct bfd_link_info *info)
{
struct elf64_x86_64_link_hash_table *htab;
htab = elf64_x86_64_hash_table (info);
if (!htab->sgot && !create_got_section (dynobj, info))
- return false;
+ return FALSE;
if (!_bfd_elf_create_dynamic_sections (dynobj, info))
- return false;
+ return FALSE;
htab->splt = bfd_get_section_by_name (dynobj, ".plt");
htab->srelplt = bfd_get_section_by_name (dynobj, ".rela.plt");
@@ -492,15 +495,15 @@ elf64_x86_64_create_dynamic_sections (dynobj, info)
|| (!info->shared && !htab->srelbss))
abort ();
- return true;
+ return TRUE;
}
/* Copy the extra info we tack onto an elf_link_hash_entry. */
static void
-elf64_x86_64_copy_indirect_symbol (bed, dir, ind)
- struct elf_backend_data *bed;
- struct elf_link_hash_entry *dir, *ind;
+elf64_x86_64_copy_indirect_symbol (const struct elf_backend_data *bed,
+ struct elf_link_hash_entry *dir,
+ struct elf_link_hash_entry *ind)
{
struct elf64_x86_64_link_hash_entry *edir, *eind;
@@ -541,28 +544,73 @@ elf64_x86_64_copy_indirect_symbol (bed, dir, ind)
eind->dyn_relocs = NULL;
}
- _bfd_elf_link_hash_copy_indirect (bed, dir, ind);
+ if (ind->root.type == bfd_link_hash_indirect
+ && dir->got.refcount <= 0)
+ {
+ edir->tls_type = eind->tls_type;
+ eind->tls_type = GOT_UNKNOWN;
+ }
+
+ if (ELIMINATE_COPY_RELOCS
+ && ind->root.type != bfd_link_hash_indirect
+ && (dir->elf_link_hash_flags & ELF_LINK_HASH_DYNAMIC_ADJUSTED) != 0)
+ /* If called to transfer flags for a weakdef during processing
+ of elf_adjust_dynamic_symbol, don't copy ELF_LINK_NON_GOT_REF.
+ We clear it ourselves for ELIMINATE_COPY_RELOCS. */
+ dir->elf_link_hash_flags |=
+ (ind->elf_link_hash_flags & (ELF_LINK_HASH_REF_DYNAMIC
+ | ELF_LINK_HASH_REF_REGULAR
+ | ELF_LINK_HASH_REF_REGULAR_NONWEAK
+ | ELF_LINK_HASH_NEEDS_PLT));
+ else
+ _bfd_elf_link_hash_copy_indirect (bed, dir, ind);
+}
+
+static bfd_boolean
+elf64_x86_64_mkobject (bfd *abfd)
+{
+ bfd_size_type amt = sizeof (struct elf64_x86_64_obj_tdata);
+ abfd->tdata.any = bfd_zalloc (abfd, amt);
+ if (abfd->tdata.any == NULL)
+ return FALSE;
+ return TRUE;
}
-static boolean
-elf64_x86_64_elf_object_p (abfd)
- bfd *abfd;
+static bfd_boolean
+elf64_x86_64_elf_object_p (bfd *abfd)
{
/* Set the right machine number for an x86-64 elf64 file. */
bfd_default_set_arch_mach (abfd, bfd_arch_i386, bfd_mach_x86_64);
- return true;
+ return TRUE;
+}
+
+static int
+elf64_x86_64_tls_transition (struct bfd_link_info *info, int r_type, int is_local)
+{
+ if (info->shared)
+ return r_type;
+
+ switch (r_type)
+ {
+ case R_X86_64_TLSGD:
+ case R_X86_64_GOTTPOFF:
+ if (is_local)
+ return R_X86_64_TPOFF32;
+ return R_X86_64_GOTTPOFF;
+ case R_X86_64_TLSLD:
+ return R_X86_64_TPOFF32;
+ }
+
+ return r_type;
}
/* Look through the relocs for a section during the first phase, and
calculate needed space in the global offset table, procedure
linkage table, and dynamic reloc sections. */
-static boolean
-elf64_x86_64_check_relocs (abfd, info, sec, relocs)
- bfd *abfd;
- struct bfd_link_info *info;
- asection *sec;
- const Elf_Internal_Rela *relocs;
+static bfd_boolean
+elf64_x86_64_check_relocs (bfd *abfd, struct bfd_link_info *info, asection *sec,
+ const Elf_Internal_Rela *relocs)
{
struct elf64_x86_64_link_hash_table *htab;
Elf_Internal_Shdr *symtab_hdr;
@@ -571,8 +619,8 @@ elf64_x86_64_check_relocs (abfd, info, sec, relocs)
const Elf_Internal_Rela *rel_end;
asection *sreloc;
- if (info->relocateable)
- return true;
+ if (info->relocatable)
+ return TRUE;
htab = elf64_x86_64_hash_table (info);
symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
@@ -583,17 +631,19 @@ elf64_x86_64_check_relocs (abfd, info, sec, relocs)
rel_end = relocs + sec->reloc_count;
for (rel = relocs; rel < rel_end; rel++)
{
+ unsigned int r_type;
unsigned long r_symndx;
struct elf_link_hash_entry *h;
r_symndx = ELF64_R_SYM (rel->r_info);
+ r_type = ELF64_R_TYPE (rel->r_info);
if (r_symndx >= NUM_SHDR_ENTRIES (symtab_hdr))
{
(*_bfd_error_handler) (_("%s: bad symbol index: %d"),
bfd_archive_filename (abfd),
r_symndx);
- return false;
+ return FALSE;
}
if (r_symndx < symtab_hdr->sh_info)
@@ -601,44 +651,109 @@ elf64_x86_64_check_relocs (abfd, info, sec, relocs)
else
h = sym_hashes[r_symndx - symtab_hdr->sh_info];
- switch (ELF64_R_TYPE (rel->r_info))
+ r_type = elf64_x86_64_tls_transition (info, r_type, h == NULL);
+ switch (r_type)
{
- case R_X86_64_GOT32:
- case R_X86_64_GOTPCREL:
- /* This symbol requires a global offset table entry. */
- if (h != NULL)
+ case R_X86_64_TLSLD:
+ htab->tls_ld_got.refcount += 1;
+ goto create_got;
+
+ case R_X86_64_TPOFF32:
+ if (info->shared)
{
- h->got.refcount += 1;
+ (*_bfd_error_handler)
+ (_("%s: relocation %s can not be used when making a shared object; recompile with -fPIC"),
+ bfd_archive_filename (abfd),
+ x86_64_elf_howto_table[r_type].name);
+ bfd_set_error (bfd_error_bad_value);
+ return FALSE;
}
- else
- {
- bfd_signed_vma *local_got_refcounts;
+ break;
- /* 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);
- 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;
- }
+ case R_X86_64_GOTTPOFF:
+ if (info->shared)
+ info->flags |= DF_STATIC_TLS;
+ /* Fall through */
+
+ case R_X86_64_GOT32:
+ case R_X86_64_GOTPCREL:
+ case R_X86_64_TLSGD:
+ /* This symbol requires a global offset table entry. */
+ {
+ int tls_type, old_tls_type;
+
+ switch (r_type)
+ {
+ default: tls_type = GOT_NORMAL; break;
+ case R_X86_64_TLSGD: tls_type = GOT_TLS_GD; break;
+ case R_X86_64_GOTTPOFF: tls_type = GOT_TLS_IE; break;
+ }
+
+ if (h != NULL)
+ {
+ h->got.refcount += 1;
+ old_tls_type = elf64_x86_64_hash_entry (h)->tls_type;
+ }
+ else
+ {
+ bfd_signed_vma *local_got_refcounts;
+
+ /* This is a global offset table entry for a local symbol. */
+ local_got_refcounts = elf_local_got_refcounts (abfd);
+ if (local_got_refcounts == NULL)
+ {
+ bfd_size_type size;
+
+ size = symtab_hdr->sh_info;
+ size *= sizeof (bfd_signed_vma) + sizeof (char);
+ local_got_refcounts = ((bfd_signed_vma *)
+ bfd_zalloc (abfd, size));
+ if (local_got_refcounts == NULL)
+ return FALSE;
+ elf_local_got_refcounts (abfd) = local_got_refcounts;
+ elf64_x86_64_local_got_tls_type (abfd)
+ = (char *) (local_got_refcounts + symtab_hdr->sh_info);
+ }
+ local_got_refcounts[r_symndx] += 1;
+ old_tls_type
+ = elf64_x86_64_local_got_tls_type (abfd) [r_symndx];
+ }
+
+ /* If a TLS symbol is accessed using IE at least once,
+ there is no point to use dynamic model for it. */
+ if (old_tls_type != tls_type && old_tls_type != GOT_UNKNOWN
+ && (old_tls_type != GOT_TLS_GD || tls_type != GOT_TLS_IE))
+ {
+ if (old_tls_type == GOT_TLS_IE && tls_type == GOT_TLS_GD)
+ tls_type = old_tls_type;
+ else
+ {
+ (*_bfd_error_handler)
+ (_("%s: %s' accessed both as normal and thread local symbol"),
+ bfd_archive_filename (abfd),
+ h ? h->root.root.string : "<local>");
+ return FALSE;
+ }
+ }
+
+ if (old_tls_type != tls_type)
+ {
+ if (h != NULL)
+ elf64_x86_64_hash_entry (h)->tls_type = tls_type;
+ else
+ elf64_x86_64_local_got_tls_type (abfd) [r_symndx] = tls_type;
+ }
+ }
/* Fall through */
//case R_X86_64_GOTPCREL:
+ create_got:
if (htab->sgot == NULL)
{
if (htab->elf.dynobj == NULL)
htab->elf.dynobj = abfd;
if (!create_got_section (htab->elf.dynobj, info))
- return false;
+ return FALSE;
}
break;
@@ -674,9 +789,9 @@ elf64_x86_64_check_relocs (abfd, info, sec, relocs)
(*_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[ELF64_R_TYPE (rel->r_info)].name);
+ x86_64_elf_howto_table[r_type].name);
bfd_set_error (bfd_error_bad_value);
- return false;
+ return FALSE;
}
/* Fall through. */
@@ -722,15 +837,16 @@ elf64_x86_64_check_relocs (abfd, info, sec, relocs)
symbol. */
if ((info->shared
&& (sec->flags & SEC_ALLOC) != 0
- && (((ELF64_R_TYPE (rel->r_info) != R_X86_64_PC8)
- && (ELF64_R_TYPE (rel->r_info) != R_X86_64_PC16)
- && (ELF64_R_TYPE (rel->r_info) != R_X86_64_PC32))
+ && (((r_type != R_X86_64_PC8)
+ && (r_type != R_X86_64_PC16)
+ && (r_type != R_X86_64_PC32))
|| (h != NULL
&& (! info->symbolic
|| h->root.type == bfd_link_hash_defweak
|| (h->elf_link_hash_flags
& ELF_LINK_HASH_DEF_REGULAR) == 0))))
- || (!info->shared
+ || (ELIMINATE_COPY_RELOCS
+ && !info->shared
&& (sec->flags & SEC_ALLOC) != 0
&& h != NULL
&& (h->root.type == bfd_link_hash_defweak
@@ -753,7 +869,7 @@ elf64_x86_64_check_relocs (abfd, info, sec, relocs)
elf_elfheader (abfd)->e_shstrndx,
elf_section_data (sec)->rel_hdr.sh_name));
if (name == NULL)
- return false;
+ return FALSE;
if (strncmp (name, ".rela", 5) != 0
|| strcmp (bfd_get_section_name (abfd, sec),
@@ -782,7 +898,7 @@ elf64_x86_64_check_relocs (abfd, info, sec, relocs)
if (sreloc == NULL
|| ! bfd_set_section_flags (dynobj, sreloc, flags)
|| ! bfd_set_section_alignment (dynobj, sreloc, 3))
- return false;
+ return FALSE;
}
elf_section_data (sec)->sreloc = sreloc;
}
@@ -803,7 +919,7 @@ elf64_x86_64_check_relocs (abfd, info, sec, relocs)
s = bfd_section_from_r_symndx (abfd, &htab->sym_sec,
sec, r_symndx);
if (s == NULL)
- return false;
+ return FALSE;
head = ((struct elf64_x86_64_dyn_relocs **)
&elf_section_data (s)->local_dynrel);
@@ -816,7 +932,7 @@ elf64_x86_64_check_relocs (abfd, info, sec, relocs)
p = ((struct elf64_x86_64_dyn_relocs *)
bfd_alloc (htab->elf.dynobj, amt));
if (p == NULL)
- return false;
+ return FALSE;
p->next = *head;
*head = p;
p->sec = sec;
@@ -825,9 +941,9 @@ elf64_x86_64_check_relocs (abfd, info, sec, relocs)
}
p->count += 1;
- if (ELF64_R_TYPE (rel->r_info) == R_X86_64_PC8
- || ELF64_R_TYPE (rel->r_info) == R_X86_64_PC16
- || ELF64_R_TYPE (rel->r_info) == R_X86_64_PC32)
+ if (r_type == R_X86_64_PC8
+ || r_type == R_X86_64_PC16
+ || r_type == R_X86_64_PC32)
p->pc_count += 1;
}
break;
@@ -835,15 +951,15 @@ elf64_x86_64_check_relocs (abfd, info, sec, relocs)
/* This relocation describes the C++ object vtable hierarchy.
Reconstruct it for later use during GC. */
case R_X86_64_GNU_VTINHERIT:
- if (!_bfd_elf64_gc_record_vtinherit (abfd, sec, h, rel->r_offset))
- return false;
+ if (!bfd_elf_gc_record_vtinherit (abfd, sec, h, rel->r_offset))
+ return FALSE;
break;
/* This relocation describes which C++ vtable entries are actually
used. Record for later use during GC. */
case R_X86_64_GNU_VTENTRY:
- if (!_bfd_elf64_gc_record_vtentry (abfd, sec, h, rel->r_addend))
- return false;
+ if (!bfd_elf_gc_record_vtentry (abfd, sec, h, rel->r_addend))
+ return FALSE;
break;
default:
@@ -851,19 +967,18 @@ elf64_x86_64_check_relocs (abfd, info, sec, relocs)
}
}
- return true;
+ return TRUE;
}
/* Return the section that should be marked against GC for a given
relocation. */
static asection *
-elf64_x86_64_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;
+elf64_x86_64_gc_mark_hook (asection *sec,
+ struct bfd_link_info *info ATTRIBUTE_UNUSED,
+ Elf_Internal_Rela *rel,
+ struct elf_link_hash_entry *h,
+ Elf_Internal_Sym *sym)
{
if (h != NULL)
{
@@ -896,19 +1011,14 @@ elf64_x86_64_gc_mark_hook (sec, info, rel, h, sym)
/* Update the got entry reference counts for the section being removed. */
-static boolean
-elf64_x86_64_gc_sweep_hook (abfd, info, sec, relocs)
- bfd *abfd;
- struct bfd_link_info *info;
- asection *sec;
- const Elf_Internal_Rela *relocs;
+static bfd_boolean
+elf64_x86_64_gc_sweep_hook (bfd *abfd, struct bfd_link_info *info,
+ asection *sec, const Elf_Internal_Rela *relocs)
{
Elf_Internal_Shdr *symtab_hdr;
struct elf_link_hash_entry **sym_hashes;
bfd_signed_vma *local_got_refcounts;
const Elf_Internal_Rela *rel, *relend;
- unsigned long r_symndx;
- struct elf_link_hash_entry *h;
elf_section_data (sec)->local_dynrel = NULL;
@@ -918,77 +1028,81 @@ elf64_x86_64_gc_sweep_hook (abfd, info, sec, relocs)
relend = relocs + sec->reloc_count;
for (rel = relocs; rel < relend; rel++)
- switch (ELF64_R_TYPE (rel->r_info))
- {
- case R_X86_64_GOT32:
- case R_X86_64_GOTPCREL:
- r_symndx = ELF64_R_SYM (rel->r_info);
- if (r_symndx >= symtab_hdr->sh_info)
- {
- h = sym_hashes[r_symndx - symtab_hdr->sh_info];
- if (h->got.refcount > 0)
- h->got.refcount -= 1;
- }
- else if (local_got_refcounts != NULL)
- {
- if (local_got_refcounts[r_symndx] > 0)
- local_got_refcounts[r_symndx] -= 1;
- }
- break;
+ {
+ unsigned long r_symndx;
+ unsigned int r_type;
+ struct elf_link_hash_entry *h = NULL;
- case R_X86_64_8:
- case R_X86_64_16:
- case R_X86_64_32:
- case R_X86_64_64:
- case R_X86_64_32S:
- case R_X86_64_PC8:
- case R_X86_64_PC16:
- case R_X86_64_PC32:
- r_symndx = ELF64_R_SYM (rel->r_info);
- if (r_symndx >= symtab_hdr->sh_info)
- {
- struct elf64_x86_64_link_hash_entry *eh;
- struct elf64_x86_64_dyn_relocs **pp;
- struct elf64_x86_64_dyn_relocs *p;
+ r_symndx = ELF64_R_SYM (rel->r_info);
+ if (r_symndx >= symtab_hdr->sh_info)
+ {
+ struct elf64_x86_64_link_hash_entry *eh;
+ struct elf64_x86_64_dyn_relocs **pp;
+ struct elf64_x86_64_dyn_relocs *p;
- h = sym_hashes[r_symndx - symtab_hdr->sh_info];
+ h = sym_hashes[r_symndx - symtab_hdr->sh_info];
+ eh = (struct elf64_x86_64_link_hash_entry *) h;
- if (!info->shared && h->plt.refcount > 0)
- h->plt.refcount -= 1;
+ for (pp = &eh->dyn_relocs; (p = *pp) != NULL; pp = &p->next)
+ if (p->sec == sec)
+ {
+ /* Everything must go for SEC. */
+ *pp = p->next;
+ break;
+ }
+ }
- eh = (struct elf64_x86_64_link_hash_entry *) h;
+ r_type = ELF64_R_TYPE (rel->r_info);
+ r_type = elf64_x86_64_tls_transition (info, r_type, h != NULL);
+ switch (r_type)
+ {
+ case R_X86_64_TLSLD:
+ if (elf64_x86_64_hash_table (info)->tls_ld_got.refcount > 0)
+ elf64_x86_64_hash_table (info)->tls_ld_got.refcount -= 1;
+ break;
- for (pp = &eh->dyn_relocs; (p = *pp) != NULL; pp = &p->next)
- if (p->sec == sec)
- {
- if (ELF64_R_TYPE (rel->r_info) == R_X86_64_PC8
- || ELF64_R_TYPE (rel->r_info) == R_X86_64_PC16
- || ELF64_R_TYPE (rel->r_info) == R_X86_64_PC32)
- p->pc_count -= 1;
- p->count -= 1;
- if (p->count == 0)
- *pp = p->next;
- break;
- }
- }
- break;
+ case R_X86_64_TLSGD:
+ case R_X86_64_GOTTPOFF:
+ case R_X86_64_GOT32:
+ case R_X86_64_GOTPCREL:
+ if (h != NULL)
+ {
+ if (h->got.refcount > 0)
+ h->got.refcount -= 1;
+ }
+ else if (local_got_refcounts != NULL)
+ {
+ if (local_got_refcounts[r_symndx] > 0)
+ local_got_refcounts[r_symndx] -= 1;
+ }
+ break;
+ case R_X86_64_8:
+ case R_X86_64_16:
+ case R_X86_64_32:
+ case R_X86_64_64:
+ case R_X86_64_32S:
+ case R_X86_64_PC8:
+ case R_X86_64_PC16:
+ case R_X86_64_PC32:
+ if (info->shared)
+ break;
+ /* Fall thru */
- case R_X86_64_PLT32:
- r_symndx = ELF64_R_SYM (rel->r_info);
- if (r_symndx >= symtab_hdr->sh_info)
- {
- h = sym_hashes[r_symndx - symtab_hdr->sh_info];
- if (h->plt.refcount > 0)
- h->plt.refcount -= 1;
- }
- break;
+ case R_X86_64_PLT32:
+ if (h != NULL)
+ {
+ if (h->plt.refcount > 0)
+ h->plt.refcount -= 1;
+ }
+ break;
- default:
- break;
- }
+ default:
+ break;
+ }
+ }
- return true;
+ return TRUE;
}
/* Adjust a symbol defined by a dynamic object and referenced by a
@@ -997,14 +1111,11 @@ elf64_x86_64_gc_sweep_hook (abfd, info, sec, relocs)
change the definition to something the rest of the link can
understand. */
-static boolean
-elf64_x86_64_adjust_dynamic_symbol (info, h)
- struct bfd_link_info *info;
- struct elf_link_hash_entry *h;
+static bfd_boolean
+elf64_x86_64_adjust_dynamic_symbol (struct bfd_link_info *info,
+ struct elf_link_hash_entry *h)
{
struct elf64_x86_64_link_hash_table *htab;
- struct elf64_x86_64_link_hash_entry * eh;
- struct elf64_x86_64_dyn_relocs *p;
asection *s;
unsigned int power_of_two;
@@ -1015,11 +1126,9 @@ elf64_x86_64_adjust_dynamic_symbol (info, h)
|| (h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT) != 0)
{
if (h->plt.refcount <= 0
- || (! info->shared
- && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) == 0
- && (h->elf_link_hash_flags & ELF_LINK_HASH_REF_DYNAMIC) == 0
- && h->root.type != bfd_link_hash_undefweak
- && h->root.type != bfd_link_hash_undefined))
+ || 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
@@ -1030,7 +1139,7 @@ elf64_x86_64_adjust_dynamic_symbol (info, h)
h->elf_link_hash_flags &= ~ELF_LINK_HASH_NEEDS_PLT;
}
- return true;
+ return TRUE;
}
else
/* It's possible that we incorrectly decided a .plt reloc was
@@ -1049,7 +1158,11 @@ elf64_x86_64_adjust_dynamic_symbol (info, h)
|| h->weakdef->root.type == bfd_link_hash_defweak);
h->root.u.def.section = h->weakdef->root.u.def.section;
h->root.u.def.value = h->weakdef->root.u.def.value;
- return true;
+ if (ELIMINATE_COPY_RELOCS || info->nocopyreloc)
+ h->elf_link_hash_flags
+ = ((h->elf_link_hash_flags & ~ELF_LINK_NON_GOT_REF)
+ | (h->weakdef->elf_link_hash_flags & ELF_LINK_NON_GOT_REF));
+ return TRUE;
}
/* This is a reference to a symbol defined by a dynamic object which
@@ -1060,34 +1173,40 @@ elf64_x86_64_adjust_dynamic_symbol (info, h)
For such cases we need not do anything here; the relocations will
be handled correctly by relocate_section. */
if (info->shared)
- return true;
+ 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;
+ return TRUE;
/* If -z nocopyreloc was given, we won't generate them either. */
if (info->nocopyreloc)
{
h->elf_link_hash_flags &= ~ELF_LINK_NON_GOT_REF;
- return true;
+ return TRUE;
}
- eh = (struct elf64_x86_64_link_hash_entry *) h;
- for (p = eh->dyn_relocs; p != NULL; p = p->next)
+ if (ELIMINATE_COPY_RELOCS)
{
- s = p->sec->output_section;
- if (s != NULL && (s->flags & SEC_READONLY) != 0)
- break;
- }
+ struct elf64_x86_64_link_hash_entry * eh;
+ struct elf64_x86_64_dyn_relocs *p;
- /* 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;
+ eh = (struct elf64_x86_64_link_hash_entry *) h;
+ for (p = eh->dyn_relocs; p != NULL; p = p->next)
+ {
+ s = p->sec->output_section;
+ if (s != NULL && (s->flags & SEC_READONLY) != 0)
+ break;
+ }
+
+ /* If we didn't find any dynamic relocs in read-only sections, then
+ we'll be keeping the dynamic relocs and avoiding the copy reloc. */
+ if (p == NULL)
+ {
+ h->elf_link_hash_flags &= ~ELF_LINK_NON_GOT_REF;
+ return TRUE;
+ }
}
/* We must allocate the symbol in our .dynbss section, which will
@@ -1126,7 +1245,7 @@ elf64_x86_64_adjust_dynamic_symbol (info, h)
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;
+ return FALSE;
}
/* Define the symbol as being at this point in the section. */
@@ -1136,27 +1255,14 @@ elf64_x86_64_adjust_dynamic_symbol (info, h)
/* Increment the section size to make room for the symbol. */
s->_raw_size += h->size;
- return true;
+ return TRUE;
}
-/* This is the condition under which elf64_x86_64_finish_dynamic_symbol
- will be called from elflink.h. If elflink.h doesn't call our
- finish_dynamic_symbol routine, we'll need to do something about
- initializing any .plt and .got entries in elf64_x86_64_relocate_section. */
-#define WILL_CALL_FINISH_DYNAMIC_SYMBOL(DYN, INFO, H) \
- ((DYN) \
- && ((INFO)->shared \
- || ((H)->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0) \
- && ((H)->dynindx != -1 \
- || ((H)->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) != 0))
-
/* Allocate space in .plt, .got and associated reloc sections for
dynamic relocs. */
-static boolean
-allocate_dynrelocs (h, inf)
- struct elf_link_hash_entry *h;
- PTR inf;
+static bfd_boolean
+allocate_dynrelocs (struct elf_link_hash_entry *h, void * inf)
{
struct bfd_link_info *info;
struct elf64_x86_64_link_hash_table *htab;
@@ -1164,7 +1270,7 @@ allocate_dynrelocs (h, inf)
struct elf64_x86_64_dyn_relocs *p;
if (h->root.type == bfd_link_hash_indirect)
- return true;
+ return TRUE;
if (h->root.type == bfd_link_hash_warning)
h = (struct elf_link_hash_entry *) h->root.u.i.link;
@@ -1180,11 +1286,12 @@ allocate_dynrelocs (h, inf)
if (h->dynindx == -1
&& (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0)
{
- if (! bfd_elf64_link_record_dynamic_symbol (info, h))
- return false;
+ if (! bfd_elf_link_record_dynamic_symbol (info, h))
+ return FALSE;
}
- if (WILL_CALL_FINISH_DYNAMIC_SYMBOL (1, info, h))
+ if (info->shared
+ || WILL_CALL_FINISH_DYNAMIC_SYMBOL (1, 0, h))
{
asection *s = htab->splt;
@@ -1229,25 +1336,47 @@ allocate_dynrelocs (h, inf)
h->elf_link_hash_flags &= ~ELF_LINK_HASH_NEEDS_PLT;
}
- if (h->got.refcount > 0)
+ /* If R_X86_64_GOTTPOFF symbol is now local to the binary,
+ make it a R_X86_64_TPOFF32 requiring no GOT entry. */
+ if (h->got.refcount > 0
+ && !info->shared
+ && h->dynindx == -1
+ && elf64_x86_64_hash_entry (h)->tls_type == GOT_TLS_IE)
+ h->got.offset = (bfd_vma) -1;
+ else if (h->got.refcount > 0)
{
asection *s;
- boolean dyn;
+ bfd_boolean dyn;
+ int tls_type = elf64_x86_64_hash_entry (h)->tls_type;
/* Make sure this symbol is output as a dynamic symbol.
Undefined weak syms won't yet be marked as dynamic. */
if (h->dynindx == -1
&& (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0)
{
- if (! bfd_elf64_link_record_dynamic_symbol (info, h))
- return false;
+ if (! bfd_elf_link_record_dynamic_symbol (info, h))
+ return FALSE;
}
s = htab->sgot;
h->got.offset = s->_raw_size;
s->_raw_size += GOT_ENTRY_SIZE;
+ /* R_X86_64_TLSGD needs 2 consecutive GOT slots. */
+ if (tls_type == GOT_TLS_GD)
+ s->_raw_size += GOT_ENTRY_SIZE;
dyn = htab->elf.dynamic_sections_created;
- if (WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, info, h))
+ /* R_X86_64_TLSGD needs one dynamic relocation if local symbol
+ and two if global.
+ R_X86_64_GOTTPOFF needs one dynamic relocation. */
+ if ((tls_type == GOT_TLS_GD && h->dynindx == -1)
+ || tls_type == GOT_TLS_IE)
+ htab->srelgot->_raw_size += sizeof (Elf64_External_Rela);
+ else if (tls_type == GOT_TLS_GD)
+ htab->srelgot->_raw_size += 2 * sizeof (Elf64_External_Rela);
+ else if ((ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
+ || h->root.type != bfd_link_hash_undefweak)
+ && (info->shared
+ || WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, 0, h)))
htab->srelgot->_raw_size += sizeof (Elf64_External_Rela);
}
else
@@ -1255,7 +1384,7 @@ allocate_dynrelocs (h, inf)
eh = (struct elf64_x86_64_link_hash_entry *) h;
if (eh->dyn_relocs == NULL)
- return true;
+ return TRUE;
/* In the shared -Bsymbolic case, discard space allocated for
dynamic pc-relative relocs against symbols which turn out to be
@@ -1265,9 +1394,13 @@ allocate_dynrelocs (h, inf)
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))
+ /* Relocs that use pc_count are those that appear on a call
+ insn, or certain REL relocs that can generated via assembly.
+ We want calls to protected symbols to resolve directly to the
+ function rather than going via the plt. If people want
+ function pointer comparisons to work as expected then they
+ should avoid writing weird assembly. */
+ if (SYMBOL_CALLS_LOCAL (info, h))
{
struct elf64_x86_64_dyn_relocs **pp;
@@ -1281,8 +1414,14 @@ allocate_dynrelocs (h, inf)
pp = &p->next;
}
}
+
+ /* Also discard relocs on undefined weak syms with non-default
+ visibility. */
+ if (ELF_ST_VISIBILITY (h->other) != STV_DEFAULT
+ && h->root.type == bfd_link_hash_undefweak)
+ eh->dyn_relocs = NULL;
}
- else
+ 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
@@ -1300,8 +1439,8 @@ allocate_dynrelocs (h, inf)
if (h->dynindx == -1
&& (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0)
{
- if (! bfd_elf64_link_record_dynamic_symbol (info, h))
- return false;
+ if (! bfd_elf_link_record_dynamic_symbol (info, h))
+ return FALSE;
}
/* If that succeeded, we know we'll be keeping all the
@@ -1322,15 +1461,13 @@ allocate_dynrelocs (h, inf)
sreloc->_raw_size += p->count * sizeof (Elf64_External_Rela);
}
- return true;
+ return TRUE;
}
/* Find any dynamic relocs that apply to read-only sections. */
-static boolean
-readonly_dynrelocs (h, inf)
- struct elf_link_hash_entry *h;
- PTR inf;
+static bfd_boolean
+readonly_dynrelocs (struct elf_link_hash_entry *h, void * inf)
{
struct elf64_x86_64_link_hash_entry *eh;
struct elf64_x86_64_dyn_relocs *p;
@@ -1350,23 +1487,22 @@ readonly_dynrelocs (h, inf)
info->flags |= DF_TEXTREL;
/* Not an error, just cut short the traversal. */
- return false;
+ return FALSE;
}
}
- return true;
+ return TRUE;
}
/* Set the sizes of the dynamic sections. */
-static boolean
-elf64_x86_64_size_dynamic_sections (output_bfd, info)
- bfd *output_bfd ATTRIBUTE_UNUSED;
- struct bfd_link_info *info;
+static bfd_boolean
+elf64_x86_64_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
+ struct bfd_link_info *info)
{
struct elf64_x86_64_link_hash_table *htab;
bfd *dynobj;
asection *s;
- boolean relocs;
+ bfd_boolean relocs;
bfd *ibfd;
htab = elf64_x86_64_hash_table (info);
@@ -1377,7 +1513,7 @@ elf64_x86_64_size_dynamic_sections (output_bfd, info)
if (htab->elf.dynamic_sections_created)
{
/* Set the contents of the .interp section to the interpreter. */
- if (! info->shared)
+ if (info->executable)
{
s = bfd_get_section_by_name (dynobj, ".interp");
if (s == NULL)
@@ -1393,6 +1529,7 @@ elf64_x86_64_size_dynamic_sections (output_bfd, info)
{
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;
@@ -1435,15 +1572,20 @@ elf64_x86_64_size_dynamic_sections (output_bfd, info)
symtab_hdr = &elf_tdata (ibfd)->symtab_hdr;
locsymcount = symtab_hdr->sh_info;
end_local_got = local_got + locsymcount;
+ local_tls_type = elf64_x86_64_local_got_tls_type (ibfd);
s = htab->sgot;
srel = htab->srelgot;
- for (; local_got < end_local_got; ++local_got)
+ for (; local_got < end_local_got; ++local_got, ++local_tls_type)
{
if (*local_got > 0)
{
*local_got = s->_raw_size;
s->_raw_size += GOT_ENTRY_SIZE;
- if (info->shared)
+ if (*local_tls_type == GOT_TLS_GD)
+ s->_raw_size += GOT_ENTRY_SIZE;
+ if (info->shared
+ || *local_tls_type == GOT_TLS_GD
+ || *local_tls_type == GOT_TLS_IE)
srel->_raw_size += sizeof (Elf64_External_Rela);
}
else
@@ -1451,13 +1593,24 @@ elf64_x86_64_size_dynamic_sections (output_bfd, info)
}
}
+ if (htab->tls_ld_got.refcount > 0)
+ {
+ /* Allocate 2 got entries and 1 dynamic reloc for R_X86_64_TLSLD
+ relocs. */
+ htab->tls_ld_got.offset = htab->sgot->_raw_size;
+ htab->sgot->_raw_size += 2 * GOT_ENTRY_SIZE;
+ htab->srelgot->_raw_size += sizeof (Elf64_External_Rela);
+ }
+ else
+ htab->tls_ld_got.offset = -1;
+
/* Allocate global sym .plt and .got entries, and space for global
sym dynamic relocs. */
elf_link_hash_traverse (&htab->elf, allocate_dynrelocs, (PTR) info);
/* We now have determined the sizes of the various dynamic sections.
Allocate memory for them. */
- relocs = false;
+ relocs = FALSE;
for (s = dynobj->sections; s != NULL; s = s->next)
{
if ((s->flags & SEC_LINKER_CREATED) == 0)
@@ -1473,7 +1626,7 @@ elf64_x86_64_size_dynamic_sections (output_bfd, info)
else if (strncmp (bfd_get_section_name (dynobj, s), ".rela", 5) == 0)
{
if (s->_raw_size != 0 && s != htab->srelplt)
- relocs = true;
+ relocs = TRUE;
/* We use the reloc_count field as a counter if we need
to copy relocs into the output file. */
@@ -1508,7 +1661,7 @@ elf64_x86_64_size_dynamic_sections (output_bfd, info)
of garbage. */
s->contents = (bfd_byte *) bfd_zalloc (dynobj, s->_raw_size);
if (s->contents == NULL)
- return false;
+ return FALSE;
}
if (htab->elf.dynamic_sections_created)
@@ -1519,12 +1672,12 @@ elf64_x86_64_size_dynamic_sections (output_bfd, info)
the .dynamic section. The DT_DEBUG entry is filled in by the
dynamic linker and used by the debugger. */
#define add_dynamic_entry(TAG, VAL) \
- bfd_elf64_add_dynamic_entry (info, (bfd_vma) (TAG), (bfd_vma) (VAL))
+ _bfd_elf_add_dynamic_entry (info, TAG, VAL)
- if (! info->shared)
+ if (info->executable)
{
if (!add_dynamic_entry (DT_DEBUG, 0))
- return false;
+ return FALSE;
}
if (htab->splt->_raw_size != 0)
@@ -1533,7 +1686,7 @@ elf64_x86_64_size_dynamic_sections (output_bfd, info)
|| !add_dynamic_entry (DT_PLTRELSZ, 0)
|| !add_dynamic_entry (DT_PLTREL, DT_RELA)
|| !add_dynamic_entry (DT_JMPREL, 0))
- return false;
+ return FALSE;
}
if (relocs)
@@ -1541,7 +1694,7 @@ elf64_x86_64_size_dynamic_sections (output_bfd, info)
if (!add_dynamic_entry (DT_RELA, 0)
|| !add_dynamic_entry (DT_RELASZ, 0)
|| !add_dynamic_entry (DT_RELAENT, sizeof (Elf64_External_Rela)))
- return false;
+ return FALSE;
/* If any dynamic relocs apply to a read-only section,
then we need a DT_TEXTREL entry. */
@@ -1552,28 +1705,50 @@ elf64_x86_64_size_dynamic_sections (output_bfd, info)
if ((info->flags & DF_TEXTREL) != 0)
{
if (!add_dynamic_entry (DT_TEXTREL, 0))
- return false;
+ return FALSE;
}
}
}
#undef add_dynamic_entry
- return 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. */
+
+static bfd_vma
+dtpoff_base (struct bfd_link_info *info)
+{
+ /* If tls_sec is NULL, we should have signalled an error already. */
+ if (elf_hash_table (info)->tls_sec == NULL)
+ return 0;
+ return elf_hash_table (info)->tls_sec->vma;
+}
+
+/* Return the relocation value for @tpoff relocation
+ if STT_TLS virtual address is ADDRESS. */
+
+static bfd_vma
+tpoff (struct bfd_link_info *info, bfd_vma address)
+{
+ struct elf_link_hash_table *htab = elf_hash_table (info);
+
+ /* If tls_segment is NULL, we should have signalled an error already. */
+ if (htab->tls_sec == NULL)
+ return 0;
+ return address - htab->tls_size - htab->tls_sec->vma;
}
/* Relocate an x86_64 ELF section. */
-static boolean
-elf64_x86_64_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;
+static bfd_boolean
+elf64_x86_64_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
+ bfd *input_bfd, asection *input_section,
+ bfd_byte *contents, Elf_Internal_Rela *relocs,
+ Elf_Internal_Sym *local_syms,
+ asection **local_sections)
{
struct elf64_x86_64_link_hash_table *htab;
Elf_Internal_Shdr *symtab_hdr;
@@ -1582,8 +1757,8 @@ elf64_x86_64_relocate_section (output_bfd, info, input_bfd, input_section,
Elf_Internal_Rela *rel;
Elf_Internal_Rela *relend;
- if (info->relocateable)
- return true;
+ if (info->relocatable)
+ return TRUE;
htab = elf64_x86_64_hash_table (info);
symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr;
@@ -1594,7 +1769,7 @@ elf64_x86_64_relocate_section (output_bfd, info, input_bfd, input_section,
relend = relocs + input_section->reloc_count;
for (; rel < relend; rel++)
{
- int r_type;
+ unsigned int r_type;
reloc_howto_type *howto;
unsigned long r_symndx;
struct elf_link_hash_entry *h;
@@ -1602,18 +1777,19 @@ elf64_x86_64_relocate_section (output_bfd, info, input_bfd, input_section,
asection *sec;
bfd_vma off;
bfd_vma relocation;
- boolean unresolved_reloc;
+ bfd_boolean unresolved_reloc;
bfd_reloc_status_type r;
+ int tls_type;
r_type = ELF64_R_TYPE (rel->r_info);
if (r_type == (int) R_X86_64_GNU_VTINHERIT
|| r_type == (int) R_X86_64_GNU_VTENTRY)
continue;
- if (r_type < 0 || r_type >= R_X86_64_max)
+ if (r_type >= R_X86_64_max)
{
bfd_set_error (bfd_error_bad_value);
- return false;
+ return FALSE;
}
howto = x86_64_elf_howto_table + r_type;
@@ -1621,56 +1797,22 @@ elf64_x86_64_relocate_section (output_bfd, info, input_bfd, input_section,
h = NULL;
sym = NULL;
sec = NULL;
- unresolved_reloc = false;
+ 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);
+ relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel);
}
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;
+ bfd_boolean warned;
- if (h->root.type == bfd_link_hash_defined
- || h->root.type == bfd_link_hash_defweak)
- {
- sec = h->root.u.def.section;
- if (sec->output_section == NULL)
- {
- /* Set a flag that will be cleared later if we find a
- relocation value for this symbol. output_section
- is typically NULL for symbols satisfied by a shared
- library. */
- unresolved_reloc = true;
- relocation = 0;
- }
- else
- relocation = (h->root.u.def.value
- + sec->output_section->vma
- + sec->output_offset);
- }
- else if (h->root.type == bfd_link_hash_undefweak)
- relocation = 0;
- else if (info->shared
- && (!info->symbolic || info->allow_shlib_undefined)
- && !info->no_undefined
- && ELF_ST_VISIBILITY (h->other) == STV_DEFAULT)
- relocation = 0;
- else
- {
- if (! ((*info->callbacks->undefined_symbol)
- (info, h->root.root.string, input_bfd,
- input_section, rel->r_offset,
- (!info->shared || info->no_undefined
- || ELF_ST_VISIBILITY (h->other)))))
- return false;
- relocation = 0;
- }
+ RELOC_FOR_GLOBAL_SYMBOL (info, input_bfd, input_section, rel,
+ r_symndx, symtab_hdr, sym_hashes,
+ h, sec, relocation,
+ unresolved_reloc, warned);
}
/* When generating a shared object, the relocations handled here are
copied into the output file to be resolved at run time. */
@@ -1686,17 +1828,16 @@ elf64_x86_64_relocate_section (output_bfd, info, input_bfd, input_section,
if (h != NULL)
{
- boolean dyn;
+ bfd_boolean dyn;
off = h->got.offset;
dyn = htab->elf.dynamic_sections_created;
- if (! WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, info, h)
+ 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)))
+ && SYMBOL_REFERENCES_LOCAL (info, h))
+ || (ELF_ST_VISIBILITY (h->other)
+ && h->root.type == bfd_link_hash_undefweak))
{
/* This is actually a static link, or it is a -Bsymbolic
link and the symbol is defined locally, or the symbol
@@ -1719,7 +1860,7 @@ elf64_x86_64_relocate_section (output_bfd, info, input_bfd, input_section,
}
}
else
- unresolved_reloc = false;
+ unresolved_reloc = FALSE;
}
else
{
@@ -1740,14 +1881,14 @@ elf64_x86_64_relocate_section (output_bfd, info, input_bfd, input_section,
if (info->shared)
{
- asection *srelgot;
+ asection *s;
Elf_Internal_Rela outrel;
- Elf64_External_Rela *loc;
+ bfd_byte *loc;
/* We need to generate a R_X86_64_RELATIVE reloc
for the dynamic linker. */
- srelgot = htab->srelgot;
- if (srelgot == NULL)
+ s = htab->srelgot;
+ if (s == NULL)
abort ();
outrel.r_offset = (htab->sgot->output_section->vma
@@ -1755,8 +1896,8 @@ elf64_x86_64_relocate_section (output_bfd, info, input_bfd, input_section,
+ off);
outrel.r_info = ELF64_R_INFO (0, R_X86_64_RELATIVE);
outrel.r_addend = relocation;
- loc = (Elf64_External_Rela *) srelgot->contents;
- loc += srelgot->reloc_count++;
+ loc = s->contents;
+ loc += s->reloc_count++ * sizeof (Elf64_External_Rela);
bfd_elf64_swap_reloca_out (output_bfd, &outrel, loc);
}
@@ -1794,7 +1935,7 @@ elf64_x86_64_relocate_section (output_bfd, info, input_bfd, input_section,
relocation = (htab->splt->output_section->vma
+ htab->splt->output_offset
+ h->plt.offset);
- unresolved_reloc = false;
+ unresolved_reloc = FALSE;
break;
case R_X86_64_PC8:
@@ -1815,15 +1956,15 @@ elf64_x86_64_relocate_section (output_bfd, info, input_bfd, input_section,
break;
if ((info->shared
+ && (h == NULL
+ || ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
+ || h->root.type != bfd_link_hash_undefweak)
&& ((r_type != R_X86_64_PC8
&& r_type != R_X86_64_PC16
&& r_type != R_X86_64_PC32)
- || (h != NULL
- && h->dynindx != -1
- && (! info->symbolic
- || (h->elf_link_hash_flags
- & ELF_LINK_HASH_DEF_REGULAR) == 0))))
- || (!info->shared
+ || !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
@@ -1835,24 +1976,23 @@ elf64_x86_64_relocate_section (output_bfd, info, input_bfd, input_section,
|| h->root.type == bfd_link_hash_undefined)))
{
Elf_Internal_Rela outrel;
- boolean skip, relocate;
+ bfd_byte *loc;
+ bfd_boolean skip, relocate;
asection *sreloc;
- Elf64_External_Rela *loc;
/* When generating a shared object, these relocations
are copied into the output file to be resolved at run
time. */
-
- skip = false;
- relocate = false;
+ 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;
+ skip = TRUE;
else if (outrel.r_offset == (bfd_vma) -2)
- skip = true, relocate = true;
+ skip = TRUE, relocate = TRUE;
outrel.r_offset += (input_section->output_section->vma
+ input_section->output_offset);
@@ -1880,7 +2020,7 @@ elf64_x86_64_relocate_section (output_bfd, info, input_bfd, input_section,
/* This symbol is local, or marked to become local. */
if (r_type == R_X86_64_64)
{
- relocate = true;
+ relocate = TRUE;
outrel.r_info = ELF64_R_INFO (0, R_X86_64_RELATIVE);
outrel.r_addend = relocation + rel->r_addend;
}
@@ -1888,21 +2028,12 @@ elf64_x86_64_relocate_section (output_bfd, info, input_bfd, input_section,
{
long sindx;
- if (h == NULL)
- sec = local_sections[r_symndx];
- else
- {
- BFD_ASSERT (h->root.type == bfd_link_hash_defined
- || (h->root.type
- == bfd_link_hash_defweak));
- sec = h->root.u.def.section;
- }
- if (sec != NULL && bfd_is_abs_section (sec))
+ if (bfd_is_abs_section (sec))
sindx = 0;
else if (sec == NULL || sec->owner == NULL)
{
bfd_set_error (bfd_error_bad_value);
- return false;
+ return FALSE;
}
else
{
@@ -1922,8 +2053,8 @@ elf64_x86_64_relocate_section (output_bfd, info, input_bfd, input_section,
if (sreloc == NULL)
abort ();
- loc = (Elf64_External_Rela *) sreloc->contents;
- loc += sreloc->reloc_count++;
+ loc = sreloc->contents;
+ loc += sreloc->reloc_count++ * sizeof (Elf64_External_Rela);
bfd_elf64_swap_reloca_out (output_bfd, &outrel, loc);
/* If this reloc is against an external symbol, we do
@@ -1936,6 +2067,314 @@ elf64_x86_64_relocate_section (output_bfd, info, input_bfd, input_section,
break;
+ case R_X86_64_TLSGD:
+ case R_X86_64_GOTTPOFF:
+ r_type = elf64_x86_64_tls_transition (info, r_type, h == NULL);
+ tls_type = GOT_UNKNOWN;
+ if (h == NULL && local_got_offsets)
+ tls_type = elf64_x86_64_local_got_tls_type (input_bfd) [r_symndx];
+ else if (h != NULL)
+ {
+ tls_type = elf64_x86_64_hash_entry (h)->tls_type;
+ if (!info->shared && h->dynindx == -1 && tls_type == GOT_TLS_IE)
+ r_type = R_X86_64_TPOFF32;
+ }
+ if (r_type == R_X86_64_TLSGD)
+ {
+ if (tls_type == GOT_TLS_IE)
+ r_type = R_X86_64_GOTTPOFF;
+ }
+
+ if (r_type == R_X86_64_TPOFF32)
+ {
+ BFD_ASSERT (! unresolved_reloc);
+ if (ELF64_R_TYPE (rel->r_info) == R_X86_64_TLSGD)
+ {
+ unsigned int i;
+ static unsigned char tlsgd[8]
+ = { 0x66, 0x48, 0x8d, 0x3d, 0x66, 0x66, 0x48, 0xe8 };
+
+ /* GD->LE transition.
+ .byte 0x66; leaq foo@tlsgd(%rip), %rdi
+ .word 0x6666; rex64; call __tls_get_addr@plt
+ Change it into:
+ movq %fs:0, %rax
+ leaq foo@tpoff(%rax), %rax */
+ BFD_ASSERT (rel->r_offset >= 4);
+ for (i = 0; i < 4; i++)
+ BFD_ASSERT (bfd_get_8 (input_bfd,
+ contents + rel->r_offset - 4 + i)
+ == tlsgd[i]);
+ BFD_ASSERT (rel->r_offset + 12 <= input_section->_raw_size);
+ for (i = 0; i < 4; i++)
+ BFD_ASSERT (bfd_get_8 (input_bfd,
+ contents + rel->r_offset + 4 + i)
+ == tlsgd[i+4]);
+ BFD_ASSERT (rel + 1 < relend);
+ BFD_ASSERT (ELF64_R_TYPE (rel[1].r_info) == R_X86_64_PLT32);
+ memcpy (contents + rel->r_offset - 4,
+ "\x64\x48\x8b\x04\x25\0\0\0\0\x48\x8d\x80\0\0\0",
+ 16);
+ bfd_put_32 (output_bfd, tpoff (info, relocation),
+ contents + rel->r_offset + 8);
+ /* Skip R_X86_64_PLT32. */
+ rel++;
+ continue;
+ }
+ else
+ {
+ unsigned int val, type, reg;
+
+ /* IE->LE transition:
+ Originally it can be one of:
+ movq foo@gottpoff(%rip), %reg
+ addq foo@gottpoff(%rip), %reg
+ We change it into:
+ movq $foo, %reg
+ leaq foo(%reg), %reg
+ addq $foo, %reg. */
+ BFD_ASSERT (rel->r_offset >= 3);
+ val = bfd_get_8 (input_bfd, contents + rel->r_offset - 3);
+ BFD_ASSERT (val == 0x48 || val == 0x4c);
+ type = bfd_get_8 (input_bfd, contents + rel->r_offset - 2);
+ BFD_ASSERT (type == 0x8b || type == 0x03);
+ reg = bfd_get_8 (input_bfd, contents + rel->r_offset - 1);
+ BFD_ASSERT ((reg & 0xc7) == 5);
+ reg >>= 3;
+ BFD_ASSERT (rel->r_offset + 4 <= input_section->_raw_size);
+ if (type == 0x8b)
+ {
+ /* movq */
+ if (val == 0x4c)
+ bfd_put_8 (output_bfd, 0x49,
+ contents + rel->r_offset - 3);
+ bfd_put_8 (output_bfd, 0xc7,
+ contents + rel->r_offset - 2);
+ bfd_put_8 (output_bfd, 0xc0 | reg,
+ contents + rel->r_offset - 1);
+ }
+ else if (reg == 4)
+ {
+ /* addq -> addq - addressing with %rsp/%r12 is
+ special */
+ if (val == 0x4c)
+ bfd_put_8 (output_bfd, 0x49,
+ contents + rel->r_offset - 3);
+ bfd_put_8 (output_bfd, 0x81,
+ contents + rel->r_offset - 2);
+ bfd_put_8 (output_bfd, 0xc0 | reg,
+ contents + rel->r_offset - 1);
+ }
+ else
+ {
+ /* addq -> leaq */
+ if (val == 0x4c)
+ bfd_put_8 (output_bfd, 0x4d,
+ contents + rel->r_offset - 3);
+ bfd_put_8 (output_bfd, 0x8d,
+ contents + rel->r_offset - 2);
+ bfd_put_8 (output_bfd, 0x80 | reg | (reg << 3),
+ contents + rel->r_offset - 1);
+ }
+ bfd_put_32 (output_bfd, tpoff (info, relocation),
+ contents + rel->r_offset);
+ continue;
+ }
+ }
+
+ if (htab->sgot == NULL)
+ abort ();
+
+ if (h != NULL)
+ off = h->got.offset;
+ else
+ {
+ if (local_got_offsets == NULL)
+ abort ();
+
+ off = local_got_offsets[r_symndx];
+ }
+
+ if ((off & 1) != 0)
+ off &= ~1;
+ else
+ {
+ Elf_Internal_Rela outrel;
+ bfd_byte *loc;
+ int dr_type, indx;
+
+ if (htab->srelgot == NULL)
+ abort ();
+
+ outrel.r_offset = (htab->sgot->output_section->vma
+ + htab->sgot->output_offset + off);
+
+ indx = h && h->dynindx != -1 ? h->dynindx : 0;
+ if (r_type == R_X86_64_TLSGD)
+ dr_type = R_X86_64_DTPMOD64;
+ else
+ dr_type = R_X86_64_TPOFF64;
+
+ bfd_put_64 (output_bfd, 0, htab->sgot->contents + off);
+ outrel.r_addend = 0;
+ if (dr_type == R_X86_64_TPOFF64 && indx == 0)
+ outrel.r_addend = relocation - dtpoff_base (info);
+ outrel.r_info = ELF64_R_INFO (indx, dr_type);
+
+ loc = htab->srelgot->contents;
+ loc += htab->srelgot->reloc_count++ * sizeof (Elf64_External_Rela);
+ bfd_elf64_swap_reloca_out (output_bfd, &outrel, loc);
+
+ if (r_type == R_X86_64_TLSGD)
+ {
+ if (indx == 0)
+ {
+ BFD_ASSERT (! unresolved_reloc);
+ bfd_put_64 (output_bfd,
+ relocation - dtpoff_base (info),
+ htab->sgot->contents + off + GOT_ENTRY_SIZE);
+ }
+ else
+ {
+ bfd_put_64 (output_bfd, 0,
+ htab->sgot->contents + off + GOT_ENTRY_SIZE);
+ outrel.r_info = ELF64_R_INFO (indx,
+ R_X86_64_DTPOFF64);
+ outrel.r_offset += GOT_ENTRY_SIZE;
+ htab->srelgot->reloc_count++;
+ loc += sizeof (Elf64_External_Rela);
+ bfd_elf64_swap_reloca_out (output_bfd, &outrel, loc);
+ }
+ }
+
+ if (h != NULL)
+ h->got.offset |= 1;
+ else
+ local_got_offsets[r_symndx] |= 1;
+ }
+
+ if (off >= (bfd_vma) -2)
+ abort ();
+ if (r_type == ELF64_R_TYPE (rel->r_info))
+ {
+ relocation = htab->sgot->output_section->vma
+ + htab->sgot->output_offset + off;
+ unresolved_reloc = FALSE;
+ }
+ else
+ {
+ unsigned int i;
+ static unsigned char tlsgd[8]
+ = { 0x66, 0x48, 0x8d, 0x3d, 0x66, 0x66, 0x48, 0xe8 };
+
+ /* GD->IE transition.
+ .byte 0x66; leaq foo@tlsgd(%rip), %rdi
+ .word 0x6666; rex64; call __tls_get_addr@plt
+ Change it into:
+ movq %fs:0, %rax
+ addq foo@gottpoff(%rip), %rax */
+ BFD_ASSERT (rel->r_offset >= 4);
+ for (i = 0; i < 4; i++)
+ BFD_ASSERT (bfd_get_8 (input_bfd,
+ contents + rel->r_offset - 4 + i)
+ == tlsgd[i]);
+ BFD_ASSERT (rel->r_offset + 12 <= input_section->_raw_size);
+ for (i = 0; i < 4; i++)
+ BFD_ASSERT (bfd_get_8 (input_bfd,
+ contents + rel->r_offset + 4 + i)
+ == tlsgd[i+4]);
+ BFD_ASSERT (rel + 1 < relend);
+ BFD_ASSERT (ELF64_R_TYPE (rel[1].r_info) == R_X86_64_PLT32);
+ memcpy (contents + rel->r_offset - 4,
+ "\x64\x48\x8b\x04\x25\0\0\0\0\x48\x03\x05\0\0\0",
+ 16);
+
+ relocation = (htab->sgot->output_section->vma
+ + htab->sgot->output_offset + off
+ - rel->r_offset
+ - input_section->output_section->vma
+ - input_section->output_offset
+ - 12);
+ bfd_put_32 (output_bfd, relocation,
+ contents + rel->r_offset + 8);
+ /* Skip R_X86_64_PLT32. */
+ rel++;
+ continue;
+ }
+ break;
+
+ case R_X86_64_TLSLD:
+ if (! info->shared)
+ {
+ /* LD->LE transition:
+ Ensure it is:
+ leaq foo@tlsld(%rip), %rdi; call __tls_get_addr@plt.
+ We change it into:
+ .word 0x6666; .byte 0x66; movl %fs:0, %rax. */
+ BFD_ASSERT (rel->r_offset >= 3);
+ BFD_ASSERT (bfd_get_8 (input_bfd, contents + rel->r_offset - 3)
+ == 0x48);
+ BFD_ASSERT (bfd_get_8 (input_bfd, contents + rel->r_offset - 2)
+ == 0x8d);
+ BFD_ASSERT (bfd_get_8 (input_bfd, contents + rel->r_offset - 1)
+ == 0x3d);
+ BFD_ASSERT (rel->r_offset + 9 <= input_section->_raw_size);
+ BFD_ASSERT (bfd_get_8 (input_bfd, contents + rel->r_offset + 4)
+ == 0xe8);
+ BFD_ASSERT (rel + 1 < relend);
+ BFD_ASSERT (ELF64_R_TYPE (rel[1].r_info) == R_X86_64_PLT32);
+ memcpy (contents + rel->r_offset - 3,
+ "\x66\x66\x66\x64\x48\x8b\x04\x25\0\0\0", 12);
+ /* Skip R_X86_64_PLT32. */
+ rel++;
+ continue;
+ }
+
+ if (htab->sgot == NULL)
+ abort ();
+
+ off = htab->tls_ld_got.offset;
+ if (off & 1)
+ off &= ~1;
+ else
+ {
+ Elf_Internal_Rela outrel;
+ bfd_byte *loc;
+
+ if (htab->srelgot == NULL)
+ abort ();
+
+ outrel.r_offset = (htab->sgot->output_section->vma
+ + htab->sgot->output_offset + off);
+
+ bfd_put_64 (output_bfd, 0,
+ htab->sgot->contents + off);
+ bfd_put_64 (output_bfd, 0,
+ htab->sgot->contents + off + GOT_ENTRY_SIZE);
+ outrel.r_info = ELF64_R_INFO (0, R_X86_64_DTPMOD64);
+ outrel.r_addend = 0;
+ loc = htab->srelgot->contents;
+ loc += htab->srelgot->reloc_count++ * sizeof (Elf64_External_Rela);
+ bfd_elf64_swap_reloca_out (output_bfd, &outrel, loc);
+ htab->tls_ld_got.offset |= 1;
+ }
+ relocation = htab->sgot->output_section->vma
+ + htab->sgot->output_offset + off;
+ unresolved_reloc = FALSE;
+ break;
+
+ case R_X86_64_DTPOFF32:
+ if (info->shared || (input_section->flags & SEC_CODE) == 0)
+ relocation -= dtpoff_base (info);
+ else
+ relocation = tpoff (info, relocation);
+ break;
+
+ case R_X86_64_TPOFF32:
+ BFD_ASSERT (! info->shared);
+ relocation = tpoff (info, relocation);
+ break;
+
default:
break;
}
@@ -1969,7 +2408,7 @@ elf64_x86_64_relocate_section (output_bfd, info, input_bfd, input_section,
symtab_hdr->sh_link,
sym->st_name);
if (name == NULL)
- return false;
+ return FALSE;
if (*name == '\0')
name = bfd_section_name (input_bfd, sec);
}
@@ -1980,7 +2419,7 @@ elf64_x86_64_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)))
- return false;
+ return FALSE;
}
else
{
@@ -1989,23 +2428,22 @@ elf64_x86_64_relocate_section (output_bfd, info, input_bfd, input_section,
bfd_archive_filename (input_bfd),
bfd_get_section_name (input_bfd, input_section),
(long) rel->r_offset, name, (int) r);
- return false;
+ return FALSE;
}
}
}
- return true;
+ return TRUE;
}
/* Finish up dynamic symbol handling. We set the contents of various
dynamic sections here. */
-static boolean
-elf64_x86_64_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;
+static bfd_boolean
+elf64_x86_64_finish_dynamic_symbol (bfd *output_bfd,
+ struct bfd_link_info *info,
+ struct elf_link_hash_entry *h,
+ Elf_Internal_Sym *sym)
{
struct elf64_x86_64_link_hash_table *htab;
@@ -2016,11 +2454,10 @@ elf64_x86_64_finish_dynamic_symbol (output_bfd, info, h, sym)
bfd_vma plt_index;
bfd_vma got_offset;
Elf_Internal_Rela rela;
- Elf64_External_Rela *loc;
+ bfd_byte *loc;
/* This symbol has an entry in the procedure linkage table. Set
it up. */
-
if (h->dynindx == -1
|| htab->splt == NULL
|| htab->sgotplt == NULL
@@ -2076,7 +2513,7 @@ elf64_x86_64_finish_dynamic_symbol (output_bfd, info, h, sym)
+ got_offset);
rela.r_info = ELF64_R_INFO (h->dynindx, R_X86_64_JUMP_SLOT);
rela.r_addend = 0;
- loc = (Elf64_External_Rela *) htab->srelplt->contents + plt_index;
+ 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)
@@ -2090,14 +2527,15 @@ elf64_x86_64_finish_dynamic_symbol (output_bfd, info, h, sym)
}
}
- if (h->got.offset != (bfd_vma) -1)
+ if (h->got.offset != (bfd_vma) -1
+ && elf64_x86_64_hash_entry (h)->tls_type != GOT_TLS_GD
+ && elf64_x86_64_hash_entry (h)->tls_type != GOT_TLS_IE)
{
Elf_Internal_Rela rela;
- Elf64_External_Rela *loc;
+ bfd_byte *loc;
/* This symbol has an entry in the global offset table. Set it
- up. */
-
+ up. */
if (htab->sgot == NULL || htab->srelgot == NULL)
abort ();
@@ -2111,10 +2549,7 @@ elf64_x86_64_finish_dynamic_symbol (output_bfd, info, h, sym)
The entry in the global offset table will already have been
initialized in the relocate_section function. */
if (info->shared
- && (info->symbolic
- || h->dynindx == -1
- || (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL))
- && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR))
+ && SYMBOL_REFERENCES_LOCAL (info, h))
{
BFD_ASSERT((h->got.offset & 1) != 0);
rela.r_info = ELF64_R_INFO (0, R_X86_64_RELATIVE);
@@ -2131,15 +2566,15 @@ elf64_x86_64_finish_dynamic_symbol (output_bfd, info, h, sym)
rela.r_addend = 0;
}
- loc = (Elf64_External_Rela *) htab->srelgot->contents;
- loc += htab->srelgot->reloc_count++;
+ loc = htab->srelgot->contents;
+ loc += htab->srelgot->reloc_count++ * sizeof (Elf64_External_Rela);
bfd_elf64_swap_reloca_out (output_bfd, &rela, loc);
}
if ((h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_COPY) != 0)
{
Elf_Internal_Rela rela;
- Elf64_External_Rela *loc;
+ bfd_byte *loc;
/* This symbol needs a copy reloc. Set it up. */
@@ -2154,8 +2589,8 @@ elf64_x86_64_finish_dynamic_symbol (output_bfd, info, h, sym)
+ h->root.u.def.section->output_offset);
rela.r_info = ELF64_R_INFO (h->dynindx, R_X86_64_COPY);
rela.r_addend = 0;
- loc = (Elf64_External_Rela *) htab->srelbss->contents;
- loc += htab->srelbss->reloc_count++;
+ loc = htab->srelbss->contents;
+ loc += htab->srelbss->reloc_count++ * sizeof (Elf64_External_Rela);
bfd_elf64_swap_reloca_out (output_bfd, &rela, loc);
}
@@ -2164,15 +2599,14 @@ elf64_x86_64_finish_dynamic_symbol (output_bfd, info, h, sym)
|| strcmp (h->root.root.string, "_GLOBAL_OFFSET_TABLE_") == 0)
sym->st_shndx = SHN_ABS;
- return true;
+ return TRUE;
}
/* Used to decide how to sort relocs in an optimal manner for the
dynamic linker, before writing them out. */
static enum elf_reloc_type_class
-elf64_x86_64_reloc_type_class (rela)
- const Elf_Internal_Rela *rela;
+elf64_x86_64_reloc_type_class (const Elf_Internal_Rela *rela)
{
switch ((int) ELF64_R_TYPE (rela->r_info))
{
@@ -2189,10 +2623,8 @@ elf64_x86_64_reloc_type_class (rela)
/* Finish up the dynamic sections. */
-static boolean
-elf64_x86_64_finish_dynamic_sections (output_bfd, info)
- bfd *output_bfd;
- struct bfd_link_info *info;
+static bfd_boolean
+elf64_x86_64_finish_dynamic_sections (bfd *output_bfd, struct bfd_link_info *info)
{
struct elf64_x86_64_link_hash_table *htab;
bfd *dynobj;
@@ -2315,7 +2747,7 @@ elf64_x86_64_finish_dynamic_sections (output_bfd, info)
GOT_ENTRY_SIZE;
}
- return true;
+ return TRUE;
}
@@ -2331,7 +2763,6 @@ elf64_x86_64_finish_dynamic_sections (output_bfd, info)
#define elf_backend_plt_readonly 1
#define elf_backend_want_plt_sym 0
#define elf_backend_got_header_size (GOT_ENTRY_SIZE*3)
-#define elf_backend_plt_header_size PLT_ENTRY_SIZE
#define elf_backend_rela_normal 1
#define elf_info_to_howto elf64_x86_64_info_to_howto
@@ -2354,5 +2785,6 @@ elf64_x86_64_finish_dynamic_sections (output_bfd, info)
#define elf_backend_relocate_section elf64_x86_64_relocate_section
#define elf_backend_size_dynamic_sections elf64_x86_64_size_dynamic_sections
#define elf_backend_object_p elf64_x86_64_elf_object_p
+#define bfd_elf64_mkobject elf64_x86_64_mkobject
#include "elf64-target.h"
diff --git a/contrib/binutils/bfd/elfarm-nabi.c b/contrib/binutils/bfd/elfarm-nabi.c
index 2d791de..5ecbe8e 100644
--- a/contrib/binutils/bfd/elfarm-nabi.c
+++ b/contrib/binutils/bfd/elfarm-nabi.c
@@ -1,5 +1,5 @@
/* 32-bit ELF support for ARM new abi option.
- Copyright 1999, 2000, 2001 Free Software Foundation, Inc.
+ Copyright 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@@ -27,7 +27,7 @@
#define NUM_ELEM(a) (sizeof (a) / (sizeof (a)[0]))
#endif
-#define USE_REL
+#define USE_REL 1
#define TARGET_LITTLE_SYM bfd_elf32_littlearm_vec
#define TARGET_LITTLE_NAME "elf32-littlearm"
@@ -42,9 +42,9 @@
static reloc_howto_type * elf32_arm_reloc_type_lookup
PARAMS ((bfd * abfd, bfd_reloc_code_real_type code));
-static boolean elf32_arm_nabi_grok_prstatus
+static bfd_boolean elf32_arm_nabi_grok_prstatus
PARAMS ((bfd *abfd, Elf_Internal_Note *note));
-static boolean elf32_arm_nabi_grok_psinfo
+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.
@@ -58,247 +58,247 @@ static reloc_howto_type elf32_arm_howto_table[] =
0, /* rightshift */
0, /* size (0 = byte, 1 = short, 2 = long) */
0, /* bitsize */
- false, /* pc_relative */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_dont,/* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_ARM_NONE", /* name */
- false, /* partial_inplace */
+ FALSE, /* partial_inplace */
0, /* src_mask */
0, /* dst_mask */
- false), /* pcrel_offset */
+ FALSE), /* pcrel_offset */
HOWTO (R_ARM_PC24, /* type */
2, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
24, /* bitsize */
- true, /* pc_relative */
+ TRUE, /* pc_relative */
0, /* bitpos */
complain_overflow_signed,/* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_ARM_PC24", /* name */
- false, /* partial_inplace */
+ FALSE, /* partial_inplace */
0x00ffffff, /* src_mask */
0x00ffffff, /* dst_mask */
- true), /* pcrel_offset */
+ 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 */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield,/* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_ARM_ABS32", /* name */
- false, /* partial_inplace */
+ FALSE, /* partial_inplace */
0xffffffff, /* src_mask */
0xffffffff, /* dst_mask */
- false), /* pcrel_offset */
+ 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 */
+ TRUE, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield,/* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_ARM_REL32", /* name */
- false, /* partial_inplace */
+ FALSE, /* partial_inplace */
0xffffffff, /* src_mask */
0xffffffff, /* dst_mask */
- true), /* pcrel_offset */
+ 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 */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield,/* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_ARM_PC13", /* name */
- false, /* partial_inplace */
+ FALSE, /* partial_inplace */
0x000000ff, /* src_mask */
0x000000ff, /* dst_mask */
- false), /* pcrel_offset */
+ 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 */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield,/* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_ARM_ABS16", /* name */
- false, /* partial_inplace */
+ FALSE, /* partial_inplace */
0x0000ffff, /* src_mask */
0x0000ffff, /* dst_mask */
- false), /* pcrel_offset */
+ 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 */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield,/* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_ARM_ABS12", /* name */
- false, /* partial_inplace */
+ FALSE, /* partial_inplace */
0x000008ff, /* src_mask */
0x000008ff, /* dst_mask */
- false), /* pcrel_offset */
+ FALSE), /* pcrel_offset */
HOWTO (R_ARM_THM_ABS5, /* type */
6, /* rightshift */
1, /* size (0 = byte, 1 = short, 2 = long) */
5, /* bitsize */
- false, /* pc_relative */
+ 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 */
+ FALSE, /* partial_inplace */
0x000007e0, /* src_mask */
0x000007e0, /* dst_mask */
- false), /* pcrel_offset */
+ 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 */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield,/* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_ARM_ABS8", /* name */
- false, /* partial_inplace */
+ FALSE, /* partial_inplace */
0x000000ff, /* src_mask */
0x000000ff, /* dst_mask */
- false), /* pcrel_offset */
+ FALSE), /* pcrel_offset */
HOWTO (R_ARM_SBREL32, /* type */
0, /* rightshift */
0, /* size (0 = byte, 1 = short, 2 = long) */
0, /* bitsize */
- false, /* pc_relative */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_dont,/* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_ARM_SBREL32", /* name */
- false, /* partial_inplace */
+ FALSE, /* partial_inplace */
0, /* src_mask */
0, /* dst_mask */
- false), /* pcrel_offset */
+ FALSE), /* pcrel_offset */
HOWTO (R_ARM_THM_PC22, /* type */
1, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
23, /* bitsize */
- true, /* pc_relative */
+ 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 */
+ FALSE, /* partial_inplace */
0x07ff07ff, /* src_mask */
0x07ff07ff, /* dst_mask */
- true), /* pcrel_offset */
+ TRUE), /* pcrel_offset */
HOWTO (R_ARM_THM_PC8, /* type */
1, /* rightshift */
1, /* size (0 = byte, 1 = short, 2 = long) */
8, /* bitsize */
- true, /* pc_relative */
+ 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 */
+ FALSE, /* partial_inplace */
0x000000ff, /* src_mask */
0x000000ff, /* dst_mask */
- true), /* pcrel_offset */
+ TRUE), /* pcrel_offset */
HOWTO (R_ARM_AMP_VCALL9, /* type */
1, /* rightshift */
1, /* size (0 = byte, 1 = short, 2 = long) */
8, /* bitsize */
- true, /* pc_relative */
+ 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 */
+ FALSE, /* partial_inplace */
0x000000ff, /* src_mask */
0x000000ff, /* dst_mask */
- true), /* pcrel_offset */
+ TRUE), /* pcrel_offset */
HOWTO (R_ARM_SWI24, /* type */
0, /* rightshift */
0, /* size (0 = byte, 1 = short, 2 = long) */
0, /* bitsize */
- false, /* pc_relative */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_signed,/* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_ARM_SWI24", /* name */
- false, /* partial_inplace */
+ FALSE, /* partial_inplace */
0x00000000, /* src_mask */
0x00000000, /* dst_mask */
- false), /* pcrel_offset */
+ FALSE), /* pcrel_offset */
HOWTO (R_ARM_THM_SWI8, /* type */
0, /* rightshift */
0, /* size (0 = byte, 1 = short, 2 = long) */
0, /* bitsize */
- false, /* pc_relative */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_signed,/* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_ARM_SWI8", /* name */
- false, /* partial_inplace */
+ FALSE, /* partial_inplace */
0x00000000, /* src_mask */
0x00000000, /* dst_mask */
- false), /* pcrel_offset */
+ 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 */
+ TRUE, /* pc_relative */
0, /* bitpos */
complain_overflow_signed,/* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_ARM_XPC25", /* name */
- false, /* partial_inplace */
+ FALSE, /* partial_inplace */
0x00ffffff, /* src_mask */
0x00ffffff, /* dst_mask */
- true), /* pcrel_offset */
+ 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 */
+ 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 */
+ FALSE, /* partial_inplace */
0x07ff07ff, /* src_mask */
0x07ff07ff, /* dst_mask */
- true), /* pcrel_offset */
+ TRUE), /* pcrel_offset */
/* These next three relocs are not defined, but we need to fill the space. */
@@ -306,43 +306,43 @@ static reloc_howto_type elf32_arm_howto_table[] =
0, /* rightshift */
0, /* size (0 = byte, 1 = short, 2 = long) */
0, /* bitsize */
- false, /* pc_relative */
+ 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 */
+ FALSE, /* partial_inplace */
0, /* src_mask */
0, /* dst_mask */
- false), /* pcrel_offset */
+ FALSE), /* pcrel_offset */
HOWTO (R_ARM_NONE, /* type */
0, /* rightshift */
0, /* size (0 = byte, 1 = short, 2 = long) */
0, /* bitsize */
- false, /* pc_relative */
+ 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 */
+ FALSE, /* partial_inplace */
0, /* src_mask */
0, /* dst_mask */
- false), /* pcrel_offset */
+ FALSE), /* pcrel_offset */
HOWTO (R_ARM_NONE, /* type */
0, /* rightshift */
0, /* size (0 = byte, 1 = short, 2 = long) */
0, /* bitsize */
- false, /* pc_relative */
+ 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 */
+ FALSE, /* partial_inplace */
0, /* src_mask */
0, /* dst_mask */
- false), /* pcrel_offset */
+ FALSE), /* pcrel_offset */
/* Relocs used in ARM Linux */
@@ -350,113 +350,113 @@ static reloc_howto_type elf32_arm_howto_table[] =
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
32, /* bitsize */
- false, /* pc_relative */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield,/* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_ARM_COPY", /* name */
- true, /* partial_inplace */
+ TRUE, /* partial_inplace */
0xffffffff, /* src_mask */
0xffffffff, /* dst_mask */
- false), /* pcrel_offset */
+ FALSE), /* pcrel_offset */
HOWTO (R_ARM_GLOB_DAT, /* type */
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
32, /* bitsize */
- false, /* pc_relative */
+ 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 */
+ TRUE, /* partial_inplace */
0xffffffff, /* src_mask */
0xffffffff, /* dst_mask */
- false), /* pcrel_offset */
+ FALSE), /* pcrel_offset */
HOWTO (R_ARM_JUMP_SLOT, /* type */
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
32, /* bitsize */
- false, /* pc_relative */
+ 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 */
+ TRUE, /* partial_inplace */
0xffffffff, /* src_mask */
0xffffffff, /* dst_mask */
- false), /* pcrel_offset */
+ FALSE), /* pcrel_offset */
HOWTO (R_ARM_RELATIVE, /* type */
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
32, /* bitsize */
- false, /* pc_relative */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield,/* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_ARM_RELATIVE", /* name */
- true, /* partial_inplace */
+ TRUE, /* partial_inplace */
0xffffffff, /* src_mask */
0xffffffff, /* dst_mask */
- false), /* pcrel_offset */
+ FALSE), /* pcrel_offset */
HOWTO (R_ARM_GOTOFF, /* type */
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
32, /* bitsize */
- false, /* pc_relative */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield,/* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_ARM_GOTOFF", /* name */
- true, /* partial_inplace */
+ TRUE, /* partial_inplace */
0xffffffff, /* src_mask */
0xffffffff, /* dst_mask */
- false), /* pcrel_offset */
+ FALSE), /* pcrel_offset */
HOWTO (R_ARM_GOTPC, /* type */
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
32, /* bitsize */
- true, /* pc_relative */
+ TRUE, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield,/* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_ARM_GOTPC", /* name */
- true, /* partial_inplace */
+ TRUE, /* partial_inplace */
0xffffffff, /* src_mask */
0xffffffff, /* dst_mask */
- true), /* pcrel_offset */
+ TRUE), /* pcrel_offset */
HOWTO (R_ARM_GOT32, /* type */
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
32, /* bitsize */
- false, /* pc_relative */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield,/* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_ARM_GOT32", /* name */
- true, /* partial_inplace */
+ TRUE, /* partial_inplace */
0xffffffff, /* src_mask */
0xffffffff, /* dst_mask */
- false), /* pcrel_offset */
+ FALSE), /* pcrel_offset */
HOWTO (R_ARM_PLT32, /* type */
2, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
26, /* bitsize */
- true, /* pc_relative */
+ TRUE, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield,/* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_ARM_PLT32", /* name */
- true, /* partial_inplace */
+ TRUE, /* partial_inplace */
0x00ffffff, /* src_mask */
0x00ffffff, /* dst_mask */
- true), /* pcrel_offset */
+ TRUE), /* pcrel_offset */
/* End of relocs used in ARM Linux */
@@ -464,57 +464,57 @@ static reloc_howto_type elf32_arm_howto_table[] =
0, /* rightshift */
0, /* size (0 = byte, 1 = short, 2 = long) */
0, /* bitsize */
- false, /* pc_relative */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_dont,/* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_ARM_RREL32", /* name */
- false, /* partial_inplace */
+ FALSE, /* partial_inplace */
0, /* src_mask */
0, /* dst_mask */
- false), /* pcrel_offset */
+ FALSE), /* pcrel_offset */
HOWTO (R_ARM_RABS32, /* type */
0, /* rightshift */
0, /* size (0 = byte, 1 = short, 2 = long) */
0, /* bitsize */
- false, /* pc_relative */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_dont,/* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_ARM_RABS32", /* name */
- false, /* partial_inplace */
+ FALSE, /* partial_inplace */
0, /* src_mask */
0, /* dst_mask */
- false), /* pcrel_offset */
+ FALSE), /* pcrel_offset */
HOWTO (R_ARM_RPC24, /* type */
0, /* rightshift */
0, /* size (0 = byte, 1 = short, 2 = long) */
0, /* bitsize */
- false, /* pc_relative */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_dont,/* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_ARM_RPC24", /* name */
- false, /* partial_inplace */
+ FALSE, /* partial_inplace */
0, /* src_mask */
0, /* dst_mask */
- false), /* pcrel_offset */
+ FALSE), /* pcrel_offset */
HOWTO (R_ARM_RBASE, /* type */
0, /* rightshift */
0, /* size (0 = byte, 1 = short, 2 = long) */
0, /* bitsize */
- false, /* pc_relative */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_dont,/* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_ARM_RBASE", /* name */
- false, /* partial_inplace */
+ FALSE, /* partial_inplace */
0, /* src_mask */
0, /* dst_mask */
- false), /* pcrel_offset */
+ FALSE), /* pcrel_offset */
};
@@ -524,15 +524,15 @@ static reloc_howto_type elf32_arm_vtinherit_howto =
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
0, /* bitsize */
- false, /* pc_relative */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
NULL, /* special_function */
"R_ARM_GNU_VTINHERIT", /* name */
- false, /* partial_inplace */
+ FALSE, /* partial_inplace */
0, /* src_mask */
0, /* dst_mask */
- false); /* pcrel_offset */
+ FALSE); /* pcrel_offset */
/* GNU extension to record C++ vtable member usage */
static reloc_howto_type elf32_arm_vtentry_howto =
@@ -540,15 +540,15 @@ static reloc_howto_type elf32_arm_vtentry_howto =
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
0, /* bitsize */
- false, /* pc_relative */
+ 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 */
+ FALSE, /* partial_inplace */
0, /* src_mask */
0, /* dst_mask */
- false); /* pcrel_offset */
+ FALSE); /* pcrel_offset */
/* 12 bit pc relative */
static reloc_howto_type elf32_arm_thm_pc11_howto =
@@ -556,15 +556,15 @@ static reloc_howto_type elf32_arm_thm_pc11_howto =
1, /* rightshift */
1, /* size (0 = byte, 1 = short, 2 = long) */
11, /* bitsize */
- true, /* pc_relative */
+ 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 */
+ FALSE, /* partial_inplace */
0x000007ff, /* src_mask */
0x000007ff, /* dst_mask */
- true); /* pcrel_offset */
+ TRUE); /* pcrel_offset */
/* 12 bit pc relative */
static reloc_howto_type elf32_arm_thm_pc9_howto =
@@ -572,24 +572,24 @@ static reloc_howto_type elf32_arm_thm_pc9_howto =
1, /* rightshift */
1, /* size (0 = byte, 1 = short, 2 = long) */
8, /* bitsize */
- true, /* pc_relative */
+ 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 */
+ FALSE, /* partial_inplace */
0x000000ff, /* src_mask */
0x000000ff, /* dst_mask */
- true); /* pcrel_offset */
+ TRUE); /* pcrel_offset */
static void elf32_arm_info_to_howto
- PARAMS ((bfd *, arelent *, Elf32_Internal_Rel *));
+ 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;
- Elf32_Internal_Rel * elf_reloc;
+ Elf_Internal_Rela * elf_reloc;
{
unsigned int r_type;
@@ -682,7 +682,7 @@ elf32_arm_reloc_type_lookup (abfd, code)
}
/* Support for core dump NOTE sections */
-static boolean
+static bfd_boolean
elf32_arm_nabi_grok_prstatus (abfd, note)
bfd *abfd;
Elf_Internal_Note *note;
@@ -693,7 +693,7 @@ elf32_arm_nabi_grok_prstatus (abfd, note)
switch (note->descsz)
{
default:
- return false;
+ return FALSE;
case 148: /* Linux/ARM 32-bit*/
/* pr_cursig */
@@ -714,7 +714,7 @@ elf32_arm_nabi_grok_prstatus (abfd, note)
raw_size, note->descpos + offset);
}
-static boolean
+static bfd_boolean
elf32_arm_nabi_grok_psinfo (abfd, note)
bfd *abfd;
Elf_Internal_Note *note;
@@ -722,7 +722,7 @@ elf32_arm_nabi_grok_psinfo (abfd, note)
switch (note->descsz)
{
default:
- return false;
+ return FALSE;
case 124: /* Linux/ARM elf_prpsinfo */
elf_tdata (abfd)->core_program
@@ -743,7 +743,7 @@ elf32_arm_nabi_grok_psinfo (abfd, note)
command[n - 1] = '\0';
}
- return true;
+ return TRUE;
}
#define elf_backend_grok_prstatus elf32_arm_nabi_grok_prstatus
diff --git a/contrib/binutils/bfd/elfarm-oabi.c b/contrib/binutils/bfd/elfarm-oabi.c
index c8e3fe6..08ba41e 100644
--- a/contrib/binutils/bfd/elfarm-oabi.c
+++ b/contrib/binutils/bfd/elfarm-oabi.c
@@ -37,8 +37,6 @@
#define NUM_ELEM(a) (sizeof (a) / sizeof (a)[0])
#endif
-#define USE_RELA
-
#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
@@ -51,7 +49,7 @@
#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 *, Elf32_Internal_Rela *));
+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[] =
@@ -61,220 +59,220 @@ static reloc_howto_type elf32_arm_howto_table[] =
0, /* rightshift */
0, /* size (0 = byte, 1 = short, 2 = long) */
0, /* bitsize */
- false, /* pc_relative */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_ARM_NONE", /* name */
- false, /* partial_inplace */
+ FALSE, /* partial_inplace */
0, /* src_mask */
0, /* dst_mask */
- false), /* pcrel_offset */
+ FALSE), /* pcrel_offset */
HOWTO (R_ARM_PC24, /* type */
2, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
24, /* bitsize */
- true, /* pc_relative */
+ TRUE, /* pc_relative */
0, /* bitpos */
complain_overflow_signed, /* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_ARM_PC24", /* name */
- false, /* partial_inplace */
+ FALSE, /* partial_inplace */
0x00ffffff, /* src_mask */
0x00ffffff, /* dst_mask */
- true), /* pcrel_offset */
+ 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 */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_ARM_ABS32", /* name */
- false, /* partial_inplace */
+ FALSE, /* partial_inplace */
0xffffffff, /* src_mask */
0xffffffff, /* dst_mask */
- false), /* pcrel_offset */
+ 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 */
+ TRUE, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_ARM_REL32", /* name */
- false, /* partial_inplace */
+ FALSE, /* partial_inplace */
0xffffffff, /* src_mask */
0xffffffff, /* dst_mask */
- true), /* pcrel_offset */
+ 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 */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_ARM_ABS8", /* name */
- false, /* partial_inplace */
+ FALSE, /* partial_inplace */
0x000000ff, /* src_mask */
0x000000ff, /* dst_mask */
- false), /* pcrel_offset */
+ 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 */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_ARM_ABS16", /* name */
- false, /* partial_inplace */
+ FALSE, /* partial_inplace */
0, /* src_mask */
0, /* dst_mask */
- false), /* pcrel_offset */
+ 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 */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_ARM_ABS12", /* name */
- false, /* partial_inplace */
+ FALSE, /* partial_inplace */
0x000008ff, /* src_mask */
0x000008ff, /* dst_mask */
- false), /* pcrel_offset */
+ FALSE), /* pcrel_offset */
HOWTO (R_ARM_THM_ABS5, /* type */
6, /* rightshift */
1, /* size (0 = byte, 1 = short, 2 = long) */
5, /* bitsize */
- false, /* pc_relative */
+ 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 */
+ FALSE, /* partial_inplace */
0x000007e0, /* src_mask */
0x000007e0, /* dst_mask */
- false), /* pcrel_offset */
+ FALSE), /* pcrel_offset */
HOWTO (R_ARM_THM_PC22, /* type */
1, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
23, /* bitsize */
- true, /* pc_relative */
+ 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 */
+ FALSE, /* partial_inplace */
0x07ff07ff, /* src_mask */
0x07ff07ff, /* dst_mask */
- true), /* pcrel_offset */
+ TRUE), /* pcrel_offset */
HOWTO (R_ARM_SBREL32, /* type */
0, /* rightshift */
0, /* size (0 = byte, 1 = short, 2 = long) */
0, /* bitsize */
- false, /* pc_relative */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_dont,/* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_ARM_SBREL32", /* name */
- false, /* partial_inplace */
+ FALSE, /* partial_inplace */
0, /* src_mask */
0, /* dst_mask */
- false), /* pcrel_offset */
+ FALSE), /* pcrel_offset */
HOWTO (R_ARM_AMP_VCALL9, /* type */
1, /* rightshift */
1, /* size (0 = byte, 1 = short, 2 = long) */
8, /* bitsize */
- true, /* pc_relative */
+ 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 */
+ FALSE, /* partial_inplace */
0x000000ff, /* src_mask */
0x000000ff, /* dst_mask */
- true), /* pcrel_offset */
+ 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 */
+ 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 */
+ FALSE, /* partial_inplace */
0x000007ff, /* src_mask */
0x000007ff, /* dst_mask */
- true), /* pcrel_offset */
+ 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 */
+ 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 */
+ FALSE, /* partial_inplace */
0x000000ff, /* src_mask */
0x000000ff, /* dst_mask */
- true), /* pcrel_offset */
+ 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 */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
NULL, /* special_function */
"R_ARM_GNU_VTINHERIT", /* name */
- false, /* partial_inplace */
+ FALSE, /* partial_inplace */
0, /* src_mask */
0, /* dst_mask */
- false), /* pcrel_offset */
+ 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 */
+ 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 */
+ FALSE, /* partial_inplace */
0, /* src_mask */
0, /* dst_mask */
- false), /* pcrel_offset */
+ FALSE), /* pcrel_offset */
/* XXX - gap in index numbering here. */
@@ -282,15 +280,15 @@ static reloc_howto_type elf32_arm_howto_table[] =
2, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
26, /* bitsize */
- true, /* pc_relative */
+ TRUE, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield,/* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_ARM_PLT32", /* name */
- true, /* partial_inplace */
+ TRUE, /* partial_inplace */
0x00ffffff, /* src_mask */
0x00ffffff, /* dst_mask */
- true), /* pcrel_offset */
+ TRUE), /* pcrel_offset */
/* XXX - gap in index numbering here. */
@@ -298,57 +296,57 @@ static reloc_howto_type elf32_arm_howto_table[] =
0, /* rightshift */
0, /* size (0 = byte, 1 = short, 2 = long) */
0, /* bitsize */
- false, /* pc_relative */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_ARM_RREL32", /* name */
- false, /* partial_inplace */
+ FALSE, /* partial_inplace */
0, /* src_mask */
0, /* dst_mask */
- false), /* pcrel_offset */
+ FALSE), /* pcrel_offset */
HOWTO (R_ARM_RABS32, /* type */
0, /* rightshift */
0, /* size (0 = byte, 1 = short, 2 = long) */
0, /* bitsize */
- false, /* pc_relative */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_ARM_RABS32", /* name */
- false, /* partial_inplace */
+ FALSE, /* partial_inplace */
0, /* src_mask */
0, /* dst_mask */
- false), /* pcrel_offset */
+ FALSE), /* pcrel_offset */
HOWTO (R_ARM_RPC24, /* type */
0, /* rightshift */
0, /* size (0 = byte, 1 = short, 2 = long) */
0, /* bitsize */
- false, /* pc_relative */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_ARM_RPC24", /* name */
- false, /* partial_inplace */
+ FALSE, /* partial_inplace */
0, /* src_mask */
0, /* dst_mask */
- false), /* pcrel_offset */
+ FALSE), /* pcrel_offset */
HOWTO (R_ARM_RBASE, /* type */
0, /* rightshift */
0, /* size (0 = byte, 1 = short, 2 = long) */
0, /* bitsize */
- false, /* pc_relative */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_ARM_RBASE", /* name */
- false, /* partial_inplace */
+ FALSE, /* partial_inplace */
0, /* src_mask */
0, /* dst_mask */
- false) /* pcrel_offset */
+ FALSE) /* pcrel_offset */
};
/* Locate a reloc in the howto table. This function must be used
@@ -371,7 +369,7 @@ static void
elf32_arm_info_to_howto (abfd, bfd_reloc, elf_reloc)
bfd *abfd ATTRIBUTE_UNUSED;
arelent *bfd_reloc;
- Elf32_Internal_Rela *elf_reloc;
+ Elf_Internal_Rela *elf_reloc;
{
unsigned int r_type;
diff --git a/contrib/binutils/bfd/elfcode.h b/contrib/binutils/bfd/elfcode.h
index 4f54cd3..bc69d48 100644
--- a/contrib/binutils/bfd/elfcode.h
+++ b/contrib/binutils/bfd/elfcode.h
@@ -1,6 +1,6 @@
/* ELF executable support for BFD.
Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
- 2001, 2002 Free Software Foundation, Inc.
+ 2001, 2002, 2003 Free Software Foundation, Inc.
Written by Fred Fish @ Cygnus Support, from information published
in "UNIX System V Release 4, Programmers Guide: ANSI C and
@@ -102,7 +102,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#define elf_get_reloc_upper_bound NAME(bfd_elf,get_reloc_upper_bound)
#define elf_canonicalize_reloc NAME(bfd_elf,canonicalize_reloc)
#define elf_slurp_symbol_table NAME(bfd_elf,slurp_symbol_table)
-#define elf_get_symtab NAME(bfd_elf,get_symtab)
+#define elf_canonicalize_symtab NAME(bfd_elf,canonicalize_symtab)
#define elf_canonicalize_dynamic_symtab \
NAME(bfd_elf,canonicalize_dynamic_symtab)
#define elf_make_empty_symbol NAME(bfd_elf,make_empty_symbol)
@@ -115,28 +115,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#define elf_no_info_to_howto NAME(bfd_elf,no_info_to_howto)
#define elf_no_info_to_howto_rel NAME(bfd_elf,no_info_to_howto_rel)
#define elf_find_section NAME(bfd_elf,find_section)
-#define elf_bfd_link_add_symbols NAME(bfd_elf,bfd_link_add_symbols)
-#define elf_add_dynamic_entry NAME(bfd_elf,add_dynamic_entry)
#define elf_write_shdrs_and_ehdr NAME(bfd_elf,write_shdrs_and_ehdr)
#define elf_write_out_phdrs NAME(bfd_elf,write_out_phdrs)
#define elf_write_relocs NAME(bfd_elf,write_relocs)
#define elf_slurp_reloc_table NAME(bfd_elf,slurp_reloc_table)
-#define elf_link_create_dynamic_sections \
- NAME(bfd_elf,link_create_dynamic_sections)
-#define elf_bfd_discard_info NAME(bfd_elf,discard_info)
-#define elf_reloc_symbol_deleted_p NAME(_bfd_elf,reloc_symbol_deleted_p)
-#define elf_link_record_dynamic_symbol _bfd_elf_link_record_dynamic_symbol
-#define elf_bfd_final_link NAME(bfd_elf,bfd_final_link)
-#define elf_create_pointer_linker_section NAME(bfd_elf,create_pointer_linker_section)
-#define elf_finish_pointer_linker_section NAME(bfd_elf,finish_pointer_linker_section)
-#define elf_gc_sections NAME(_bfd_elf,gc_sections)
-#define elf_gc_common_finalize_got_offsets \
- NAME(_bfd_elf,gc_common_finalize_got_offsets)
-#define elf_gc_common_final_link NAME(_bfd_elf,gc_common_final_link)
-#define elf_gc_record_vtinherit NAME(_bfd_elf,gc_record_vtinherit)
-#define elf_gc_record_vtentry NAME(_bfd_elf,gc_record_vtentry)
-#define elf_link_record_local_dynamic_symbol \
- NAME(_bfd_elf,link_record_local_dynamic_symbol)
#if ARCH_SIZE == 64
#define ELF_R_INFO(X,Y) ELF64_R_INFO(X,Y)
@@ -155,31 +137,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#define LOG_FILE_ALIGN 2
#endif
-/* Static functions */
-
-static void elf_swap_ehdr_in
- PARAMS ((bfd *, const Elf_External_Ehdr *, Elf_Internal_Ehdr *));
-static void elf_swap_ehdr_out
- PARAMS ((bfd *, const Elf_Internal_Ehdr *, Elf_External_Ehdr *));
-static void elf_swap_shdr_in
- PARAMS ((bfd *, const Elf_External_Shdr *, Elf_Internal_Shdr *));
-static void elf_swap_shdr_out
- PARAMS ((bfd *, const Elf_Internal_Shdr *, Elf_External_Shdr *));
-
-#define elf_stringtab_init _bfd_elf_stringtab_init
-
-#define section_from_elf_index bfd_section_from_elf_index
-
-static boolean elf_slurp_reloc_table_from_section
- PARAMS ((bfd *, asection *, Elf_Internal_Shdr *, bfd_size_type,
- arelent *, asymbol **, boolean));
-
-static boolean elf_file_p PARAMS ((Elf_External_Ehdr *));
-
#ifdef DEBUG
-static void elf_debug_section PARAMS ((int, Elf_Internal_Shdr *));
-static void elf_debug_file PARAMS ((Elf_Internal_Ehdr *));
-static char *elf_symbol_flags PARAMS ((flagword));
+static void elf_debug_section (int, Elf_Internal_Shdr *);
+static void elf_debug_file (Elf_Internal_Ehdr *);
+static char *elf_symbol_flags (flagword);
#endif
/* Structure swapping routines */
@@ -203,14 +164,13 @@ static char *elf_symbol_flags PARAMS ((flagword));
format. */
void
-elf_swap_symbol_in (abfd, psrc, pshn, dst)
- bfd *abfd;
- const PTR psrc;
- const PTR pshn;
- Elf_Internal_Sym *dst;
+elf_swap_symbol_in (bfd *abfd,
+ const void *psrc,
+ const void *pshn,
+ Elf_Internal_Sym *dst)
{
- const Elf_External_Sym *src = (const Elf_External_Sym *) psrc;
- const Elf_External_Sym_Shndx *shndx = (const Elf_External_Sym_Shndx *) pshn;
+ const Elf_External_Sym *src = psrc;
+ const Elf_External_Sym_Shndx *shndx = pshn;
int signed_vma = get_elf_backend_data (abfd)->sign_extend_vma;
dst->st_name = H_GET_32 (abfd, src->st_name);
@@ -234,14 +194,13 @@ elf_swap_symbol_in (abfd, psrc, pshn, dst)
format. */
void
-elf_swap_symbol_out (abfd, src, cdst, shndx)
- bfd *abfd;
- const Elf_Internal_Sym *src;
- PTR cdst;
- PTR shndx;
+elf_swap_symbol_out (bfd *abfd,
+ const Elf_Internal_Sym *src,
+ void *cdst,
+ void *shndx)
{
unsigned int tmp;
- Elf_External_Sym *dst = (Elf_External_Sym *) cdst;
+ Elf_External_Sym *dst = cdst;
H_PUT_32 (abfd, src->st_name, dst->st_name);
H_PUT_WORD (abfd, src->st_value, dst->st_value);
H_PUT_WORD (abfd, src->st_size, dst->st_size);
@@ -262,10 +221,9 @@ elf_swap_symbol_out (abfd, src, cdst, shndx)
internal format. */
static void
-elf_swap_ehdr_in (abfd, src, dst)
- bfd *abfd;
- const Elf_External_Ehdr *src;
- Elf_Internal_Ehdr *dst;
+elf_swap_ehdr_in (bfd *abfd,
+ const Elf_External_Ehdr *src,
+ Elf_Internal_Ehdr *dst)
{
int signed_vma = get_elf_backend_data (abfd)->sign_extend_vma;
memcpy (dst->e_ident, src->e_ident, EI_NIDENT);
@@ -291,10 +249,9 @@ elf_swap_ehdr_in (abfd, src, dst)
external format. */
static void
-elf_swap_ehdr_out (abfd, src, dst)
- bfd *abfd;
- const Elf_Internal_Ehdr *src;
- Elf_External_Ehdr *dst;
+elf_swap_ehdr_out (bfd *abfd,
+ const Elf_Internal_Ehdr *src,
+ Elf_External_Ehdr *dst)
{
unsigned int tmp;
int signed_vma = get_elf_backend_data (abfd)->sign_extend_vma;
@@ -328,10 +285,9 @@ elf_swap_ehdr_out (abfd, src, dst)
ELF section header table entry in internal format. */
static void
-elf_swap_shdr_in (abfd, src, dst)
- bfd *abfd;
- const Elf_External_Shdr *src;
- Elf_Internal_Shdr *dst;
+elf_swap_shdr_in (bfd *abfd,
+ const Elf_External_Shdr *src,
+ Elf_Internal_Shdr *dst)
{
int signed_vma = get_elf_backend_data (abfd)->sign_extend_vma;
@@ -356,10 +312,9 @@ elf_swap_shdr_in (abfd, src, dst)
ELF section header table entry in external format. */
static void
-elf_swap_shdr_out (abfd, src, dst)
- bfd *abfd;
- const Elf_Internal_Shdr *src;
- Elf_External_Shdr *dst;
+elf_swap_shdr_out (bfd *abfd,
+ const Elf_Internal_Shdr *src,
+ Elf_External_Shdr *dst)
{
/* note that all elements of dst are *arrays of unsigned char* already... */
H_PUT_32 (abfd, src->sh_name, dst->sh_name);
@@ -378,10 +333,9 @@ elf_swap_shdr_out (abfd, src, dst)
ELF program header table entry in internal format. */
void
-elf_swap_phdr_in (abfd, src, dst)
- bfd *abfd;
- const Elf_External_Phdr *src;
- Elf_Internal_Phdr *dst;
+elf_swap_phdr_in (bfd *abfd,
+ const Elf_External_Phdr *src,
+ Elf_Internal_Phdr *dst)
{
int signed_vma = get_elf_backend_data (abfd)->sign_extend_vma;
@@ -404,10 +358,9 @@ elf_swap_phdr_in (abfd, src, dst)
}
void
-elf_swap_phdr_out (abfd, src, dst)
- bfd *abfd;
- const Elf_Internal_Phdr *src;
- Elf_External_Phdr *dst;
+elf_swap_phdr_out (bfd *abfd,
+ const Elf_Internal_Phdr *src,
+ Elf_External_Phdr *dst)
{
/* note that all elements of dst are *arrays of unsigned char* already... */
H_PUT_32 (abfd, src->p_type, dst->p_type);
@@ -421,68 +374,67 @@ elf_swap_phdr_out (abfd, src, dst)
}
/* Translate an ELF reloc from external format to internal format. */
-INLINE void
-elf_swap_reloc_in (abfd, src, dst)
- bfd *abfd;
- const Elf_External_Rel *src;
- Elf_Internal_Rel *dst;
+void
+elf_swap_reloc_in (bfd *abfd,
+ const bfd_byte *s,
+ Elf_Internal_Rela *dst)
{
+ const Elf_External_Rel *src = (const Elf_External_Rel *) s;
dst->r_offset = H_GET_WORD (abfd, src->r_offset);
dst->r_info = H_GET_WORD (abfd, src->r_info);
+ dst->r_addend = 0;
}
-INLINE void
-elf_swap_reloca_in (abfd, src, dst)
- bfd *abfd;
- const Elf_External_Rela *src;
- Elf_Internal_Rela *dst;
+void
+elf_swap_reloca_in (bfd *abfd,
+ const bfd_byte *s,
+ Elf_Internal_Rela *dst)
{
+ const Elf_External_Rela *src = (const Elf_External_Rela *) s;
dst->r_offset = H_GET_WORD (abfd, src->r_offset);
dst->r_info = H_GET_WORD (abfd, src->r_info);
dst->r_addend = H_GET_SIGNED_WORD (abfd, src->r_addend);
}
/* Translate an ELF reloc from internal format to external format. */
-INLINE void
-elf_swap_reloc_out (abfd, src, dst)
- bfd *abfd;
- const Elf_Internal_Rel *src;
- Elf_External_Rel *dst;
+void
+elf_swap_reloc_out (bfd *abfd,
+ const Elf_Internal_Rela *src,
+ bfd_byte *d)
{
+ Elf_External_Rel *dst = (Elf_External_Rel *) d;
H_PUT_WORD (abfd, src->r_offset, dst->r_offset);
H_PUT_WORD (abfd, src->r_info, dst->r_info);
}
-INLINE void
-elf_swap_reloca_out (abfd, src, dst)
- bfd *abfd;
- const Elf_Internal_Rela *src;
- Elf_External_Rela *dst;
+void
+elf_swap_reloca_out (bfd *abfd,
+ const Elf_Internal_Rela *src,
+ bfd_byte *d)
{
+ Elf_External_Rela *dst = (Elf_External_Rela *) d;
H_PUT_WORD (abfd, src->r_offset, dst->r_offset);
H_PUT_WORD (abfd, src->r_info, dst->r_info);
H_PUT_SIGNED_WORD (abfd, src->r_addend, dst->r_addend);
}
-INLINE void
-elf_swap_dyn_in (abfd, p, dst)
- bfd *abfd;
- const PTR p;
- Elf_Internal_Dyn *dst;
+void
+elf_swap_dyn_in (bfd *abfd,
+ const void *p,
+ Elf_Internal_Dyn *dst)
{
- const Elf_External_Dyn *src = (const Elf_External_Dyn *) p;
+ const Elf_External_Dyn *src = p;
dst->d_tag = H_GET_WORD (abfd, src->d_tag);
dst->d_un.d_val = H_GET_WORD (abfd, src->d_un.d_val);
}
-INLINE void
-elf_swap_dyn_out (abfd, src, p)
- bfd *abfd;
- const Elf_Internal_Dyn *src;
- PTR p;
+void
+elf_swap_dyn_out (bfd *abfd,
+ const Elf_Internal_Dyn *src,
+ void *p)
{
- Elf_External_Dyn *dst = (Elf_External_Dyn *) p;
+ Elf_External_Dyn *dst = p;
H_PUT_WORD (abfd, src->d_tag, dst->d_tag);
H_PUT_WORD (abfd, src->d_un.d_val, dst->d_un.d_val);
@@ -495,9 +447,8 @@ elf_swap_dyn_out (abfd, src, p)
First we validate the file by reading in the ELF header and checking
the magic number. */
-static INLINE boolean
-elf_file_p (x_ehdrp)
- Elf_External_Ehdr *x_ehdrp;
+static inline bfd_boolean
+elf_file_p (Elf_External_Ehdr *x_ehdrp)
{
return ((x_ehdrp->e_ident[EI_MAG0] == ELFMAG0)
&& (x_ehdrp->e_ident[EI_MAG1] == ELFMAG1)
@@ -505,16 +456,6 @@ elf_file_p (x_ehdrp)
&& (x_ehdrp->e_ident[EI_MAG3] == ELFMAG3));
}
-struct bfd_preserve
-{
- const struct bfd_arch_info *arch_info;
- struct elf_obj_tdata *tdata;
- struct bfd_hash_table section_htab;
- struct sec *sections;
- struct sec **section_tail;
- unsigned int section_count;
-};
-
/* Check to see if the file associated with ABFD matches the target vector
that ABFD points to.
@@ -524,8 +465,7 @@ struct bfd_preserve
file does not match the target vector. */
const bfd_target *
-elf_object_p (abfd)
- bfd *abfd;
+elf_object_p (bfd *abfd)
{
Elf_External_Ehdr x_ehdr; /* Elf file header, external form */
Elf_Internal_Ehdr *i_ehdrp; /* Elf file header, internal form */
@@ -534,18 +474,16 @@ elf_object_p (abfd)
Elf_Internal_Shdr *i_shdrp; /* Section header table, internal form */
unsigned int shindex;
char *shstrtab; /* Internal copy of section header stringtab */
- struct elf_backend_data *ebd;
+ const struct elf_backend_data *ebd;
struct bfd_preserve preserve;
- struct elf_obj_tdata *new_tdata = NULL;
asection *s;
bfd_size_type amt;
- preserve.arch_info = abfd->arch_info;
+ preserve.marker = NULL;
/* Read in the ELF header in external format. */
- if (bfd_bread ((PTR) & x_ehdr, (bfd_size_type) sizeof (x_ehdr), abfd)
- != sizeof (x_ehdr))
+ if (bfd_bread (&x_ehdr, sizeof (x_ehdr), abfd) != sizeof (x_ehdr))
{
if (bfd_get_error () != bfd_error_system_call)
goto got_wrong_format_error;
@@ -580,27 +518,15 @@ elf_object_p (abfd)
goto got_wrong_format_error;
}
+ if (!bfd_preserve_save (abfd, &preserve))
+ goto got_no_match;
+
/* Allocate an instance of the elf_obj_tdata structure and hook it up to
the tdata pointer in the bfd. */
- amt = sizeof (struct elf_obj_tdata);
- new_tdata = (struct elf_obj_tdata *) bfd_zalloc (abfd, amt);
- if (new_tdata == NULL)
- goto got_no_match;
- preserve.tdata = elf_tdata (abfd);
- elf_tdata (abfd) = new_tdata;
-
- /* Clear section information, since there might be a recognized bfd that
- we now check if we can replace, and we don't want to append to it. */
- preserve.sections = abfd->sections;
- preserve.section_tail = abfd->section_tail;
- preserve.section_count = abfd->section_count;
- preserve.section_htab = abfd->section_htab;
- abfd->sections = NULL;
- abfd->section_tail = &abfd->sections;
- abfd->section_count = 0;
- if (!bfd_hash_table_init (&abfd->section_htab, bfd_section_hash_newfunc))
+ if (! (*abfd->xvec->_bfd_set_format[bfd_object]) (abfd))
goto got_no_match;
+ preserve.marker = elf_tdata (abfd);
/* Now that we know the byte order, swap in the rest of the header */
i_ehdrp = elf_elfheader (abfd);
@@ -633,8 +559,10 @@ elf_object_p (abfd)
/* Check that the ELF e_machine field matches what this particular
BFD format expects. */
if (ebd->elf_machine_code != i_ehdrp->e_machine
- && (ebd->elf_machine_alt1 == 0 || i_ehdrp->e_machine != ebd->elf_machine_alt1)
- && (ebd->elf_machine_alt2 == 0 || i_ehdrp->e_machine != ebd->elf_machine_alt2))
+ && (ebd->elf_machine_alt1 == 0
+ || i_ehdrp->e_machine != ebd->elf_machine_alt1)
+ && (ebd->elf_machine_alt2 == 0
+ || i_ehdrp->e_machine != ebd->elf_machine_alt2))
{
const bfd_target * const *target_ptr;
@@ -645,11 +573,11 @@ elf_object_p (abfd)
for which we do not have a specific backend. */
for (target_ptr = bfd_target_vector; *target_ptr != NULL; target_ptr++)
{
- struct elf_backend_data *back;
+ const struct elf_backend_data *back;
if ((*target_ptr)->flavour != bfd_target_elf_flavour)
continue;
- back = (struct elf_backend_data *) (*target_ptr)->backend_data;
+ back = (const struct elf_backend_data *) (*target_ptr)->backend_data;
if (back->elf_machine_code == i_ehdrp->e_machine
|| (back->elf_machine_alt1 != 0
&& back->elf_machine_alt1 == i_ehdrp->e_machine)
@@ -689,8 +617,7 @@ elf_object_p (abfd)
/* Read the first section header at index 0, and convert to internal
form. */
- if (bfd_bread ((PTR) & x_shdr, (bfd_size_type) sizeof x_shdr, abfd)
- != sizeof (x_shdr))
+ if (bfd_bread (&x_shdr, sizeof x_shdr, abfd) != sizeof (x_shdr))
goto got_no_match;
elf_swap_shdr_in (abfd, &x_shdr, &i_shdr);
@@ -712,7 +639,7 @@ elf_object_p (abfd)
unsigned int num_sec;
amt = sizeof (*i_shdrp) * i_ehdrp->e_shnum;
- i_shdrp = (Elf_Internal_Shdr *) bfd_alloc (abfd, amt);
+ i_shdrp = bfd_alloc (abfd, amt);
if (!i_shdrp)
goto got_no_match;
num_sec = i_ehdrp->e_shnum;
@@ -720,7 +647,7 @@ elf_object_p (abfd)
num_sec += SHN_HIRESERVE + 1 - SHN_LORESERVE;
elf_numsections (abfd) = num_sec;
amt = sizeof (i_shdrp) * num_sec;
- elf_elfsections (abfd) = (Elf_Internal_Shdr **) bfd_alloc (abfd, amt);
+ elf_elfsections (abfd) = bfd_alloc (abfd, amt);
if (!elf_elfsections (abfd))
goto got_no_match;
@@ -741,8 +668,7 @@ elf_object_p (abfd)
to internal form. */
for (shindex = 1; shindex < i_ehdrp->e_shnum; shindex++)
{
- if (bfd_bread ((PTR) & x_shdr, (bfd_size_type) sizeof x_shdr, abfd)
- != sizeof (x_shdr))
+ if (bfd_bread (&x_shdr, sizeof x_shdr, abfd) != sizeof (x_shdr))
goto got_no_match;
elf_swap_shdr_in (abfd, &x_shdr, i_shdrp + shindex);
@@ -773,7 +699,7 @@ elf_object_p (abfd)
unsigned int i;
amt = i_ehdrp->e_phnum * sizeof (Elf_Internal_Phdr);
- elf_tdata (abfd)->phdr = (Elf_Internal_Phdr *) bfd_alloc (abfd, amt);
+ elf_tdata (abfd)->phdr = bfd_alloc (abfd, amt);
if (elf_tdata (abfd)->phdr == NULL)
goto got_no_match;
if (bfd_seek (abfd, (file_ptr) i_ehdrp->e_phoff, SEEK_SET) != 0)
@@ -783,8 +709,7 @@ elf_object_p (abfd)
{
Elf_External_Phdr x_phdr;
- if (bfd_bread ((PTR) &x_phdr, (bfd_size_type) sizeof x_phdr, abfd)
- != sizeof x_phdr)
+ if (bfd_bread (&x_phdr, sizeof x_phdr, abfd) != sizeof x_phdr)
goto got_no_match;
elf_swap_phdr_in (abfd, &x_phdr, i_phdr);
}
@@ -844,11 +769,8 @@ elf_object_p (abfd)
}
}
- /* It would be nice to be able to free more memory here, eg. old
- elf_elfsections, old tdata, but that's not possible since these
- blocks are sitting inside obj_alloc'd memory. */
- bfd_hash_table_free (&preserve.section_htab);
- return (abfd->xvec);
+ bfd_preserve_finish (abfd, &preserve);
+ return abfd->xvec;
got_wrong_format_error:
/* There is way too much undoing of half-known state here. The caller,
@@ -863,18 +785,8 @@ elf_object_p (abfd)
bfd_set_error (bfd_error_wrong_format);
got_no_match:
- abfd->arch_info = preserve.arch_info;
- if (new_tdata != NULL)
- {
- /* bfd_release frees all memory more recently bfd_alloc'd than
- its arg, as well as its arg. */
- bfd_release (abfd, new_tdata);
- elf_tdata (abfd) = preserve.tdata;
- abfd->section_htab = preserve.section_htab;
- abfd->sections = preserve.sections;
- abfd->section_tail = preserve.section_tail;
- abfd->section_count = preserve.section_count;
- }
+ if (preserve.marker != NULL)
+ bfd_preserve_restore (abfd, &preserve);
return NULL;
}
@@ -883,19 +795,17 @@ elf_object_p (abfd)
/* Write out the relocs. */
void
-elf_write_relocs (abfd, sec, data)
- bfd *abfd;
- asection *sec;
- PTR data;
+elf_write_relocs (bfd *abfd, asection *sec, void *data)
{
- boolean *failedp = (boolean *) data;
+ bfd_boolean *failedp = data;
Elf_Internal_Shdr *rela_hdr;
- Elf_External_Rela *outbound_relocas;
- Elf_External_Rel *outbound_relocs;
+ bfd_vma addr_offset;
+ void (*swap_out) (bfd *, const Elf_Internal_Rela *, bfd_byte *);
+ size_t extsize;
+ bfd_byte *dst_rela;
unsigned int idx;
- int use_rela_p;
- asymbol *last_sym = 0;
- int last_sym_idx = 0;
+ asymbol *last_sym;
+ int last_sym_idx;
/* If we have already failed, don't do anything. */
if (*failedp)
@@ -914,148 +824,94 @@ elf_write_relocs (abfd, sec, data)
rela_hdr = &elf_section_data (sec)->rel_hdr;
rela_hdr->sh_size = rela_hdr->sh_entsize * sec->reloc_count;
- rela_hdr->contents = (PTR) bfd_alloc (abfd, rela_hdr->sh_size);
+ rela_hdr->contents = bfd_alloc (abfd, rela_hdr->sh_size);
if (rela_hdr->contents == NULL)
{
- *failedp = true;
+ *failedp = TRUE;
return;
}
/* Figure out whether the relocations are RELA or REL relocations. */
if (rela_hdr->sh_type == SHT_RELA)
- use_rela_p = true;
+ {
+ swap_out = elf_swap_reloca_out;
+ extsize = sizeof (Elf_External_Rela);
+ }
else if (rela_hdr->sh_type == SHT_REL)
- use_rela_p = false;
+ {
+ swap_out = elf_swap_reloc_out;
+ extsize = sizeof (Elf_External_Rel);
+ }
else
/* Every relocation section should be either an SHT_RELA or an
SHT_REL section. */
abort ();
+ /* The address of an ELF reloc is section relative for an object
+ file, and absolute for an executable file or shared library.
+ The address of a BFD reloc is always section relative. */
+ addr_offset = 0;
+ if ((abfd->flags & (EXEC_P | DYNAMIC)) != 0)
+ addr_offset = sec->vma;
+
/* orelocation has the data, reloc_count has the count... */
- if (use_rela_p)
- {
- outbound_relocas = (Elf_External_Rela *) rela_hdr->contents;
+ last_sym = 0;
+ last_sym_idx = 0;
+ dst_rela = rela_hdr->contents;
- for (idx = 0; idx < sec->reloc_count; idx++)
+ for (idx = 0; idx < sec->reloc_count; idx++, dst_rela += extsize)
+ {
+ Elf_Internal_Rela src_rela;
+ arelent *ptr;
+ asymbol *sym;
+ int n;
+
+ ptr = sec->orelocation[idx];
+ sym = *ptr->sym_ptr_ptr;
+ if (sym == last_sym)
+ n = last_sym_idx;
+ else if (bfd_is_abs_section (sym->section) && sym->value == 0)
+ n = STN_UNDEF;
+ else
{
- Elf_Internal_Rela dst_rela;
- Elf_External_Rela *src_rela;
- arelent *ptr;
- asymbol *sym;
- int n;
-
- ptr = sec->orelocation[idx];
- src_rela = outbound_relocas + idx;
-
- /* The address of an ELF reloc is section relative for an object
- file, and absolute for an executable file or shared library.
- The address of a BFD reloc is always section relative. */
- if ((abfd->flags & (EXEC_P | DYNAMIC)) == 0)
- dst_rela.r_offset = ptr->address;
- else
- dst_rela.r_offset = ptr->address + sec->vma;
-
- sym = *ptr->sym_ptr_ptr;
- if (sym == last_sym)
- n = last_sym_idx;
- else if (bfd_is_abs_section (sym->section) && sym->value == 0)
- n = STN_UNDEF;
- else
- {
- last_sym = sym;
- n = _bfd_elf_symbol_from_bfd_symbol (abfd, &sym);
- if (n < 0)
- {
- *failedp = true;
- return;
- }
- last_sym_idx = n;
- }
-
- if ((*ptr->sym_ptr_ptr)->the_bfd != NULL
- && (*ptr->sym_ptr_ptr)->the_bfd->xvec != abfd->xvec
- && ! _bfd_elf_validate_reloc (abfd, ptr))
+ last_sym = sym;
+ n = _bfd_elf_symbol_from_bfd_symbol (abfd, &sym);
+ if (n < 0)
{
- *failedp = true;
+ *failedp = TRUE;
return;
}
-
- dst_rela.r_info = ELF_R_INFO (n, ptr->howto->type);
-
- dst_rela.r_addend = ptr->addend;
- elf_swap_reloca_out (abfd, &dst_rela, src_rela);
+ last_sym_idx = n;
}
- }
- else
- /* REL relocations */
- {
- outbound_relocs = (Elf_External_Rel *) rela_hdr->contents;
- for (idx = 0; idx < sec->reloc_count; idx++)
+ if ((*ptr->sym_ptr_ptr)->the_bfd != NULL
+ && (*ptr->sym_ptr_ptr)->the_bfd->xvec != abfd->xvec
+ && ! _bfd_elf_validate_reloc (abfd, ptr))
{
- Elf_Internal_Rel dst_rel;
- Elf_External_Rel *src_rel;
- arelent *ptr;
- int n;
- asymbol *sym;
-
- ptr = sec->orelocation[idx];
- sym = *ptr->sym_ptr_ptr;
- src_rel = outbound_relocs + 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_rel.r_offset = ptr->address;
- else
- dst_rel.r_offset = ptr->address + sec->vma;
-
- if (sym == last_sym)
- n = last_sym_idx;
- else if (bfd_is_abs_section (sym->section) && sym->value == 0)
- n = STN_UNDEF;
- else
- {
- last_sym = sym;
- n = _bfd_elf_symbol_from_bfd_symbol (abfd, &sym);
- if (n < 0)
- {
- *failedp = true;
- return;
- }
- last_sym_idx = n;
- }
-
- if ((*ptr->sym_ptr_ptr)->the_bfd != NULL
- && (*ptr->sym_ptr_ptr)->the_bfd->xvec != abfd->xvec
- && ! _bfd_elf_validate_reloc (abfd, ptr))
- {
- *failedp = true;
- return;
- }
-
- dst_rel.r_info = ELF_R_INFO (n, ptr->howto->type);
-
- elf_swap_reloc_out (abfd, &dst_rel, src_rel);
+ *failedp = TRUE;
+ return;
}
+
+ src_rela.r_offset = ptr->address + addr_offset;
+ src_rela.r_info = ELF_R_INFO (n, ptr->howto->type);
+ src_rela.r_addend = ptr->addend;
+ (*swap_out) (abfd, &src_rela, dst_rela);
}
}
/* Write out the program headers. */
int
-elf_write_out_phdrs (abfd, phdr, count)
- bfd *abfd;
- const Elf_Internal_Phdr *phdr;
- unsigned int count;
+elf_write_out_phdrs (bfd *abfd,
+ const Elf_Internal_Phdr *phdr,
+ unsigned int count)
{
while (count--)
{
Elf_External_Phdr extphdr;
elf_swap_phdr_out (abfd, phdr, &extphdr);
- if (bfd_bwrite (&extphdr, (bfd_size_type) sizeof (Elf_External_Phdr),
- abfd) != sizeof (Elf_External_Phdr))
+ if (bfd_bwrite (&extphdr, sizeof (Elf_External_Phdr), abfd)
+ != sizeof (Elf_External_Phdr))
return -1;
phdr++;
}
@@ -1064,9 +920,8 @@ elf_write_out_phdrs (abfd, phdr, count)
/* Write out the section headers and the ELF file header. */
-boolean
-elf_write_shdrs_and_ehdr (abfd)
- bfd *abfd;
+bfd_boolean
+elf_write_shdrs_and_ehdr (bfd *abfd)
{
Elf_External_Ehdr x_ehdr; /* Elf file header, external form */
Elf_Internal_Ehdr *i_ehdrp; /* Elf file header, internal form */
@@ -1086,8 +941,8 @@ elf_write_shdrs_and_ehdr (abfd)
elf_swap_ehdr_out (abfd, i_ehdrp, &x_ehdr);
amt = sizeof (x_ehdr);
if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0
- || bfd_bwrite ((PTR) & x_ehdr, amt, abfd) != amt)
- return false;
+ || bfd_bwrite (&x_ehdr, amt, abfd) != amt)
+ return FALSE;
/* Some fields in the first section header handle overflow of ehdr
fields. */
@@ -1099,9 +954,9 @@ elf_write_shdrs_and_ehdr (abfd)
/* at this point we've concocted all the ELF sections... */
amt = i_ehdrp->e_shnum;
amt *= sizeof (*x_shdrp);
- x_shdrp = (Elf_External_Shdr *) bfd_alloc (abfd, amt);
+ x_shdrp = bfd_alloc (abfd, amt);
if (!x_shdrp)
- return false;
+ return FALSE;
for (count = 0; count < i_ehdrp->e_shnum; i_shdrp++, count++)
{
@@ -1109,24 +964,21 @@ elf_write_shdrs_and_ehdr (abfd)
elf_debug_section (count, *i_shdrp);
#endif
elf_swap_shdr_out (abfd, *i_shdrp, x_shdrp + count);
-
+
if (count == SHN_LORESERVE - 1)
i_shdrp += SHN_HIRESERVE + 1 - SHN_LORESERVE;
}
if (bfd_seek (abfd, (file_ptr) i_ehdrp->e_shoff, SEEK_SET) != 0
- || bfd_bwrite ((PTR) x_shdrp, amt, abfd) != amt)
- return false;
+ || bfd_bwrite (x_shdrp, amt, abfd) != amt)
+ return FALSE;
/* need to dump the string table too... */
- return true;
+ return TRUE;
}
long
-elf_slurp_symbol_table (abfd, symptrs, dynamic)
- bfd *abfd;
- asymbol **symptrs; /* Buffer for generated bfd symbols */
- boolean dynamic;
+elf_slurp_symbol_table (bfd *abfd, asymbol **symptrs, bfd_boolean dynamic)
{
Elf_Internal_Shdr *hdr;
Elf_Internal_Shdr *verhdr;
@@ -1138,7 +990,7 @@ elf_slurp_symbol_table (abfd, symptrs, dynamic)
Elf_Internal_Sym *isymbuf = NULL;
Elf_External_Versym *xver;
Elf_External_Versym *xverbuf = NULL;
- struct elf_backend_data *ebd;
+ const struct elf_backend_data *ebd;
bfd_size_type amt;
/* Read each raw ELF symbol, converting from external ELF form to
@@ -1186,7 +1038,7 @@ elf_slurp_symbol_table (abfd, symptrs, dynamic)
amt = symcount;
amt *= sizeof (elf_symbol_type);
- symbase = (elf_symbol_type *) bfd_zalloc (abfd, amt);
+ symbase = bfd_zalloc (abfd, amt);
if (symbase == (elf_symbol_type *) NULL)
goto error_return;
@@ -1210,12 +1062,11 @@ elf_slurp_symbol_table (abfd, symptrs, dynamic)
if (bfd_seek (abfd, verhdr->sh_offset, SEEK_SET) != 0)
goto error_return;
- xverbuf = (Elf_External_Versym *) bfd_malloc (verhdr->sh_size);
+ xverbuf = bfd_malloc (verhdr->sh_size);
if (xverbuf == NULL && verhdr->sh_size != 0)
goto error_return;
- if (bfd_bread ((PTR) xverbuf, verhdr->sh_size, abfd)
- != verhdr->sh_size)
+ if (bfd_bread (xverbuf, verhdr->sh_size, abfd) != verhdr->sh_size)
goto error_return;
}
@@ -1242,8 +1093,8 @@ elf_slurp_symbol_table (abfd, symptrs, dynamic)
else if (isym->st_shndx < SHN_LORESERVE
|| isym->st_shndx > SHN_HIRESERVE)
{
- sym->symbol.section = section_from_elf_index (abfd,
- isym->st_shndx);
+ sym->symbol.section = bfd_section_from_elf_index (abfd,
+ isym->st_shndx);
if (sym->symbol.section == NULL)
{
/* This symbol is in a section for which we did not
@@ -1268,7 +1119,7 @@ elf_slurp_symbol_table (abfd, symptrs, dynamic)
else
sym->symbol.section = bfd_abs_section_ptr;
- /* If this is a relocateable file, then the symbol value is
+ /* If this is a relocatable file, then the symbol value is
already section relative. */
if ((abfd->flags & (EXEC_P | DYNAMIC)) != 0)
sym->symbol.value -= sym->symbol.section->vma;
@@ -1360,26 +1211,24 @@ error_return:
/* Read relocations for ASECT from REL_HDR. There are RELOC_COUNT of
them. */
-static boolean
-elf_slurp_reloc_table_from_section (abfd, asect, rel_hdr, reloc_count,
- relents, symbols, dynamic)
- bfd *abfd;
- asection *asect;
- Elf_Internal_Shdr *rel_hdr;
- bfd_size_type reloc_count;
- arelent *relents;
- asymbol **symbols;
- boolean dynamic;
+static bfd_boolean
+elf_slurp_reloc_table_from_section (bfd *abfd,
+ asection *asect,
+ Elf_Internal_Shdr *rel_hdr,
+ bfd_size_type reloc_count,
+ arelent *relents,
+ asymbol **symbols,
+ bfd_boolean dynamic)
{
- struct elf_backend_data * const ebd = get_elf_backend_data (abfd);
- PTR allocated = NULL;
+ const struct elf_backend_data * const ebd = get_elf_backend_data (abfd);
+ void *allocated = NULL;
bfd_byte *native_relocs;
arelent *relent;
unsigned int i;
int entsize;
unsigned int symcount;
- allocated = (PTR) bfd_malloc (rel_hdr->sh_size);
+ allocated = bfd_malloc (rel_hdr->sh_size);
if (allocated == NULL)
goto error_return;
@@ -1388,7 +1237,7 @@ elf_slurp_reloc_table_from_section (abfd, asect, rel_hdr, reloc_count,
!= rel_hdr->sh_size))
goto error_return;
- native_relocs = (bfd_byte *) allocated;
+ native_relocs = allocated;
entsize = rel_hdr->sh_entsize;
BFD_ASSERT (entsize == sizeof (Elf_External_Rel)
@@ -1404,17 +1253,11 @@ elf_slurp_reloc_table_from_section (abfd, asect, rel_hdr, reloc_count,
i++, relent++, native_relocs += entsize)
{
Elf_Internal_Rela rela;
- Elf_Internal_Rel rel;
if (entsize == sizeof (Elf_External_Rela))
- elf_swap_reloca_in (abfd, (Elf_External_Rela *) native_relocs, &rela);
+ elf_swap_reloca_in (abfd, native_relocs, &rela);
else
- {
- elf_swap_reloc_in (abfd, (Elf_External_Rel *) native_relocs, &rel);
- rela.r_offset = rel.r_offset;
- rela.r_info = rel.r_info;
- rela.r_addend = 0;
- }
+ elf_swap_reloc_in (abfd, native_relocs, &rela);
/* The address of an ELF reloc is section relative for an object
file, and absolute for an executable file or shared library.
@@ -1450,31 +1293,32 @@ elf_slurp_reloc_table_from_section (abfd, asect, rel_hdr, reloc_count,
relent->addend = rela.r_addend;
- if (entsize == sizeof (Elf_External_Rela))
+ if ((entsize == sizeof (Elf_External_Rela)
+ && ebd->elf_info_to_howto != NULL)
+ || ebd->elf_info_to_howto_rel == NULL)
(*ebd->elf_info_to_howto) (abfd, relent, &rela);
else
- (*ebd->elf_info_to_howto_rel) (abfd, relent, &rel);
+ (*ebd->elf_info_to_howto_rel) (abfd, relent, &rela);
}
if (allocated != NULL)
free (allocated);
- return true;
+ return TRUE;
error_return:
if (allocated != NULL)
free (allocated);
- return false;
+ return FALSE;
}
/* Read in and swap the external relocs. */
-boolean
-elf_slurp_reloc_table (abfd, asect, symbols, dynamic)
- bfd *abfd;
- asection *asect;
- asymbol **symbols;
- boolean dynamic;
+bfd_boolean
+elf_slurp_reloc_table (bfd *abfd,
+ asection *asect,
+ asymbol **symbols,
+ bfd_boolean dynamic)
{
struct bfd_elf_section_data * const d = elf_section_data (asect);
Elf_Internal_Shdr *rel_hdr;
@@ -1485,13 +1329,13 @@ elf_slurp_reloc_table (abfd, asect, symbols, dynamic)
bfd_size_type amt;
if (asect->relocation != NULL)
- return true;
+ return TRUE;
if (! dynamic)
{
if ((asect->flags & SEC_RELOC) == 0
|| asect->reloc_count == 0)
- return true;
+ return TRUE;
rel_hdr = &d->rel_hdr;
reloc_count = NUM_SHDR_ENTRIES (rel_hdr);
@@ -1510,7 +1354,7 @@ elf_slurp_reloc_table (abfd, asect, symbols, dynamic)
dynamic symbol table, and in that case bfd_section_from_shdr
in elf.c does not update the RELOC_COUNT. */
if (asect->_raw_size == 0)
- return true;
+ return TRUE;
rel_hdr = &d->this_hdr;
reloc_count = NUM_SHDR_ENTRIES (rel_hdr);
@@ -1519,32 +1363,30 @@ elf_slurp_reloc_table (abfd, asect, symbols, dynamic)
}
amt = (reloc_count + reloc_count2) * sizeof (arelent);
- relents = (arelent *) bfd_alloc (abfd, amt);
+ relents = bfd_alloc (abfd, amt);
if (relents == NULL)
- return false;
+ return FALSE;
if (!elf_slurp_reloc_table_from_section (abfd, asect,
rel_hdr, reloc_count,
relents,
symbols, dynamic))
- return false;
+ return FALSE;
if (rel_hdr2
&& !elf_slurp_reloc_table_from_section (abfd, asect,
rel_hdr2, reloc_count2,
relents + reloc_count,
symbols, dynamic))
- return false;
+ return FALSE;
asect->relocation = relents;
- return true;
+ return TRUE;
}
#ifdef DEBUG
static void
-elf_debug_section (num, hdr)
- int num;
- Elf_Internal_Shdr *hdr;
+elf_debug_section (int num, Elf_Internal_Shdr *hdr)
{
fprintf (stderr, "\nSection#%d '%s' 0x%.8lx\n", num,
hdr->bfd_section != NULL ? hdr->bfd_section->name : "",
@@ -1570,8 +1412,7 @@ elf_debug_section (num, hdr)
}
static void
-elf_debug_file (ehdrp)
- Elf_Internal_Ehdr *ehdrp;
+elf_debug_file (Elf_Internal_Ehdr *ehdrp)
{
fprintf (stderr, "e_entry = 0x%.8lx\n", (long) ehdrp->e_entry);
fprintf (stderr, "e_phoff = %ld\n", (long) ehdrp->e_phoff);
@@ -1583,8 +1424,7 @@ elf_debug_file (ehdrp)
}
static char *
-elf_symbol_flags (flags)
- flagword flags;
+elf_symbol_flags (flagword flags)
{
static char buffer[1024];
@@ -1655,8 +1495,230 @@ elf_symbol_flags (flags)
}
#endif
+/* Create a new BFD as if by bfd_openr. Rather than opening a file,
+ reconstruct an ELF file by reading the segments out of remote memory
+ based on the ELF file header at EHDR_VMA and the ELF program headers it
+ points to. If not null, *LOADBASEP is filled in with the difference
+ between the VMAs from which the segments were read, and the VMAs the
+ file headers (and hence BFD's idea of each section's VMA) put them at.
+
+ The function TARGET_READ_MEMORY is called to copy LEN bytes from the
+ remote memory at target address VMA into the local buffer at MYADDR; it
+ should return zero on success or an `errno' code on failure. TEMPL must
+ be a BFD for a target with the word size and byte order found in the
+ remote memory. */
+
+bfd *
+NAME(_bfd_elf,bfd_from_remote_memory)
+ (bfd *templ,
+ bfd_vma ehdr_vma,
+ bfd_vma *loadbasep,
+ int (*target_read_memory) (bfd_vma, char *, int))
+{
+ Elf_External_Ehdr x_ehdr; /* Elf file header, external form */
+ Elf_Internal_Ehdr i_ehdr; /* Elf file header, internal form */
+ Elf_External_Phdr *x_phdrs;
+ Elf_Internal_Phdr *i_phdrs, *last_phdr;
+ bfd *nbfd;
+ struct bfd_in_memory *bim;
+ int contents_size;
+ char *contents;
+ int err;
+ unsigned int i;
+ bfd_vma loadbase;
+
+ /* Read in the ELF header in external format. */
+ err = target_read_memory (ehdr_vma, (char *) &x_ehdr, sizeof x_ehdr);
+ if (err)
+ {
+ bfd_set_error (bfd_error_system_call);
+ errno = err;
+ return NULL;
+ }
+
+ /* Now check to see if we have a valid ELF file, and one that BFD can
+ make use of. The magic number must match, the address size ('class')
+ and byte-swapping must match our XVEC entry. */
+
+ if (! elf_file_p (&x_ehdr)
+ || x_ehdr.e_ident[EI_VERSION] != EV_CURRENT
+ || x_ehdr.e_ident[EI_CLASS] != ELFCLASS)
+ {
+ bfd_set_error (bfd_error_wrong_format);
+ return NULL;
+ }
+
+ /* Check that file's byte order matches xvec's */
+ switch (x_ehdr.e_ident[EI_DATA])
+ {
+ case ELFDATA2MSB: /* Big-endian */
+ if (! bfd_header_big_endian (templ))
+ {
+ bfd_set_error (bfd_error_wrong_format);
+ return NULL;
+ }
+ break;
+ case ELFDATA2LSB: /* Little-endian */
+ if (! bfd_header_little_endian (templ))
+ {
+ bfd_set_error (bfd_error_wrong_format);
+ return NULL;
+ }
+ break;
+ case ELFDATANONE: /* No data encoding specified */
+ default: /* Unknown data encoding specified */
+ bfd_set_error (bfd_error_wrong_format);
+ return NULL;
+ }
+
+ elf_swap_ehdr_in (templ, &x_ehdr, &i_ehdr);
+
+ /* The file header tells where to find the program headers.
+ These are what we use to actually choose what to read. */
+
+ if (i_ehdr.e_phentsize != sizeof (Elf_External_Phdr) || i_ehdr.e_phnum == 0)
+ {
+ bfd_set_error (bfd_error_wrong_format);
+ return NULL;
+ }
+
+ x_phdrs = bfd_malloc (i_ehdr.e_phnum * (sizeof *x_phdrs + sizeof *i_phdrs));
+ if (x_phdrs == NULL)
+ {
+ bfd_set_error (bfd_error_no_memory);
+ return NULL;
+ }
+ err = target_read_memory (ehdr_vma + i_ehdr.e_phoff, (char *) x_phdrs,
+ i_ehdr.e_phnum * sizeof x_phdrs[0]);
+ if (err)
+ {
+ free (x_phdrs);
+ bfd_set_error (bfd_error_system_call);
+ errno = err;
+ return NULL;
+ }
+ i_phdrs = (Elf_Internal_Phdr *) &x_phdrs[i_ehdr.e_phnum];
+
+ contents_size = 0;
+ last_phdr = NULL;
+ loadbase = ehdr_vma;
+ for (i = 0; i < i_ehdr.e_phnum; ++i)
+ {
+ elf_swap_phdr_in (templ, &x_phdrs[i], &i_phdrs[i]);
+ if (i_phdrs[i].p_type == PT_LOAD)
+ {
+ bfd_vma segment_end;
+ segment_end = (i_phdrs[i].p_offset + i_phdrs[i].p_filesz
+ + i_phdrs[i].p_align - 1) & -i_phdrs[i].p_align;
+ if (segment_end > (bfd_vma) contents_size)
+ contents_size = segment_end;
+
+ if ((i_phdrs[i].p_offset & -i_phdrs[i].p_align) == 0)
+ loadbase = ehdr_vma - (i_phdrs[i].p_vaddr & -i_phdrs[i].p_align);
+
+ last_phdr = &i_phdrs[i];
+ }
+ }
+ if (last_phdr == NULL)
+ {
+ /* There were no PT_LOAD segments, so we don't have anything to read. */
+ free (x_phdrs);
+ bfd_set_error (bfd_error_wrong_format);
+ return NULL;
+ }
+
+ /* Trim the last segment so we don't bother with zeros in the last page
+ that are off the end of the file. However, if the extra bit in that
+ page includes the section headers, keep them. */
+ if ((bfd_vma) contents_size > last_phdr->p_offset + last_phdr->p_filesz
+ && (bfd_vma) contents_size >= (i_ehdr.e_shoff
+ + i_ehdr.e_shnum * i_ehdr.e_shentsize))
+ {
+ contents_size = last_phdr->p_offset + last_phdr->p_filesz;
+ if ((bfd_vma) contents_size < (i_ehdr.e_shoff
+ + i_ehdr.e_shnum * i_ehdr.e_shentsize))
+ contents_size = i_ehdr.e_shoff + i_ehdr.e_shnum * i_ehdr.e_shentsize;
+ }
+ else
+ contents_size = last_phdr->p_offset + last_phdr->p_filesz;
+
+ /* Now we know the size of the whole image we want read in. */
+ contents = bfd_zmalloc (contents_size);
+ if (contents == NULL)
+ {
+ free (x_phdrs);
+ bfd_set_error (bfd_error_no_memory);
+ return NULL;
+ }
+
+ for (i = 0; i < i_ehdr.e_phnum; ++i)
+ if (i_phdrs[i].p_type == PT_LOAD)
+ {
+ bfd_vma start = i_phdrs[i].p_offset & -i_phdrs[i].p_align;
+ bfd_vma end = (i_phdrs[i].p_offset + i_phdrs[i].p_filesz
+ + i_phdrs[i].p_align - 1) & -i_phdrs[i].p_align;
+ if (end > (bfd_vma) contents_size)
+ end = contents_size;
+ err = target_read_memory ((loadbase + i_phdrs[i].p_vaddr)
+ & -i_phdrs[i].p_align,
+ contents + start, end - start);
+ if (err)
+ {
+ free (x_phdrs);
+ free (contents);
+ bfd_set_error (bfd_error_system_call);
+ errno = err;
+ return NULL;
+ }
+ }
+ free (x_phdrs);
+
+ /* If the segments visible in memory didn't include the section headers,
+ then clear them from the file header. */
+ if ((bfd_vma) contents_size < (i_ehdr.e_shoff
+ + i_ehdr.e_shnum * i_ehdr.e_shentsize))
+ {
+ memset (&x_ehdr.e_shoff, 0, sizeof x_ehdr.e_shoff);
+ memset (&x_ehdr.e_shnum, 0, sizeof x_ehdr.e_shnum);
+ memset (&x_ehdr.e_shstrndx, 0, sizeof x_ehdr.e_shstrndx);
+ }
+
+ /* This will normally have been in the first PT_LOAD segment. But it
+ conceivably could be missing, and we might have just changed it. */
+ memcpy (contents, &x_ehdr, sizeof x_ehdr);
+
+ /* Now we have a memory image of the ELF file contents. Make a BFD. */
+ bim = bfd_malloc (sizeof (struct bfd_in_memory));
+ if (bim == NULL)
+ {
+ free (contents);
+ bfd_set_error (bfd_error_no_memory);
+ return NULL;
+ }
+ nbfd = _bfd_new_bfd ();
+ if (nbfd == NULL)
+ {
+ free (bim);
+ free (contents);
+ bfd_set_error (bfd_error_no_memory);
+ return NULL;
+ }
+ nbfd->filename = "<in-memory>";
+ nbfd->xvec = templ->xvec;
+ bim->size = contents_size;
+ bim->buffer = contents;
+ nbfd->iostream = bim;
+ nbfd->flags = BFD_IN_MEMORY;
+ nbfd->direction = read_direction;
+ nbfd->mtime = time (NULL);
+ nbfd->mtime_set = TRUE;
+
+ if (loadbasep)
+ *loadbasep = loadbase;
+ return nbfd;
+}
+
#include "elfcore.h"
-#include "elflink.h"
/* Size-dependent data and functions. */
const struct elf_size_info NAME(_bfd_elf,size_info) = {
@@ -1670,7 +1732,7 @@ const struct elf_size_info NAME(_bfd_elf,size_info) = {
sizeof (Elf_External_Note),
4,
1,
- ARCH_SIZE, FILE_ALIGN,
+ ARCH_SIZE, LOG_FILE_ALIGN,
ELFCLASS, EV_CURRENT,
elf_write_out_phdrs,
elf_write_shdrs_and_ehdr,
@@ -1681,8 +1743,8 @@ const struct elf_size_info NAME(_bfd_elf,size_info) = {
elf_slurp_symbol_table,
elf_swap_dyn_in,
elf_swap_dyn_out,
- NULL,
- NULL,
- NULL,
- NULL
+ elf_swap_reloc_in,
+ elf_swap_reloc_out,
+ elf_swap_reloca_in,
+ elf_swap_reloca_out
};
diff --git a/contrib/binutils/bfd/elfcore.h b/contrib/binutils/bfd/elfcore.h
index 7db5f72..81c4cff 100644
--- a/contrib/binutils/bfd/elfcore.h
+++ b/contrib/binutils/bfd/elfcore.h
@@ -1,41 +1,37 @@
/* ELF core file support for BFD.
- Copyright 1995, 1996, 1997, 1998, 2000, 2001, 2002
+ Copyright 1995, 1996, 1997, 1998, 2000, 2001, 2002, 2003
Free Software Foundation, Inc.
-This file is part of BFD, the Binary File Descriptor library.
+ This 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
char*
-elf_core_file_failing_command (abfd)
- bfd *abfd;
+elf_core_file_failing_command (bfd *abfd)
{
return elf_tdata (abfd)->core_command;
}
int
-elf_core_file_failing_signal (abfd)
- bfd *abfd;
+elf_core_file_failing_signal (bfd *abfd)
{
return elf_tdata (abfd)->core_signal;
}
-boolean
-elf_core_file_matches_executable_p (core_bfd, exec_bfd)
- bfd *core_bfd;
- bfd *exec_bfd;
+bfd_boolean
+elf_core_file_matches_executable_p (bfd *core_bfd, bfd *exec_bfd)
{
char* corename;
@@ -44,22 +40,22 @@ elf_core_file_matches_executable_p (core_bfd, exec_bfd)
if (core_bfd->xvec != exec_bfd->xvec)
{
bfd_set_error (bfd_error_system_call);
- return false;
+ return FALSE;
}
/* See if the name in the corefile matches the executable name. */
-
corename = elf_tdata (core_bfd)->core_program;
if (corename != NULL)
{
const char* execname = strrchr (exec_bfd->filename, '/');
+
execname = execname ? execname + 1 : exec_bfd->filename;
- if (strcmp(execname, corename) != 0)
- return false;
+ if (strcmp (execname, corename) != 0)
+ return FALSE;
}
- return true;
+ return TRUE;
}
/* Core files are simply standard ELF formatted files that partition
@@ -71,39 +67,35 @@ elf_core_file_matches_executable_p (core_bfd, exec_bfd)
register set) and the floating point register set are stored in a
segment of type PT_NOTE. We handcraft a couple of extra bfd sections
that allow standard bfd access to the general registers (.reg) and the
- floating point registers (.reg2).
-
- */
+ floating point registers (.reg2). */
const bfd_target *
-elf_core_file_p (abfd)
- bfd *abfd;
+elf_core_file_p (bfd *abfd)
{
- Elf_External_Ehdr x_ehdr; /* Elf file header, external form */
- Elf_Internal_Ehdr *i_ehdrp; /* Elf file header, internal form */
- Elf_Internal_Phdr *i_phdrp; /* Elf program header, internal form */
+ Elf_External_Ehdr x_ehdr; /* Elf file header, external form. */
+ Elf_Internal_Ehdr *i_ehdrp; /* Elf file header, internal form. */
+ Elf_Internal_Phdr *i_phdrp; /* Elf program header, internal form. */
unsigned int phindex;
- struct elf_backend_data *ebd;
+ const struct elf_backend_data *ebd;
struct bfd_preserve preserve;
- struct elf_obj_tdata *new_tdata = NULL;
bfd_size_type amt;
- preserve.arch_info = abfd->arch_info;
+ preserve.marker = NULL;
/* Read in the ELF header in external format. */
- if (bfd_bread ((PTR) &x_ehdr, (bfd_size_type) sizeof (x_ehdr), abfd)
- != sizeof (x_ehdr))
+ if (bfd_bread (&x_ehdr, sizeof (x_ehdr), abfd) != sizeof (x_ehdr))
{
if (bfd_get_error () != bfd_error_system_call)
- bfd_set_error (bfd_error_wrong_format);
- return NULL;
+ goto wrong;
+ else
+ goto fail;
}
/* Check the magic number. */
if (! elf_file_p (&x_ehdr))
goto wrong;
- /* FIXME: Check EI_VERSION here ! */
+ /* FIXME: Check EI_VERSION here ! */
/* Check the address size ("class"). */
if (x_ehdr.e_ident[EI_CLASS] != ELFCLASS)
@@ -112,11 +104,11 @@ elf_core_file_p (abfd)
/* Check the byteorder. */
switch (x_ehdr.e_ident[EI_DATA])
{
- case ELFDATA2MSB: /* Big-endian */
+ case ELFDATA2MSB: /* Big-endian. */
if (! bfd_big_endian (abfd))
goto wrong;
break;
- case ELFDATA2LSB: /* Little-endian */
+ case ELFDATA2LSB: /* Little-endian. */
if (! bfd_little_endian (abfd))
goto wrong;
break;
@@ -124,25 +116,13 @@ elf_core_file_p (abfd)
goto wrong;
}
+ if (!bfd_preserve_save (abfd, &preserve))
+ goto fail;
+
/* Give abfd an elf_obj_tdata. */
- amt = sizeof (struct elf_obj_tdata);
- new_tdata = (struct elf_obj_tdata *) bfd_zalloc (abfd, amt);
- if (new_tdata == NULL)
- return NULL;
- preserve.tdata = elf_tdata (abfd);
- elf_tdata (abfd) = new_tdata;
-
- /* Clear section information, since there might be a recognized bfd that
- we now check if we can replace, and we don't want to append to it. */
- preserve.sections = abfd->sections;
- preserve.section_tail = abfd->section_tail;
- preserve.section_count = abfd->section_count;
- preserve.section_htab = abfd->section_htab;
- abfd->sections = NULL;
- abfd->section_tail = &abfd->sections;
- abfd->section_count = 0;
- if (!bfd_hash_table_init (&abfd->section_htab, bfd_section_hash_newfunc))
+ if (! (*abfd->xvec->_bfd_set_format[bfd_core]) (abfd))
goto fail;
+ preserve.marker = elf_tdata (abfd);
/* Swap in the rest of the header, now that we have the byte order. */
i_ehdrp = elf_elfheader (abfd);
@@ -173,12 +153,16 @@ elf_core_file_p (abfd)
for (target_ptr = bfd_target_vector; *target_ptr != NULL; target_ptr++)
{
- struct elf_backend_data *back;
+ const struct elf_backend_data *back;
if ((*target_ptr)->flavour != bfd_target_elf_flavour)
continue;
- back = (struct elf_backend_data *) (*target_ptr)->backend_data;
- if (back->elf_machine_code == i_ehdrp->e_machine)
+ back = (const struct elf_backend_data *) (*target_ptr)->backend_data;
+ if (back->elf_machine_code == i_ehdrp->e_machine
+ || (back->elf_machine_alt1 != 0
+ && i_ehdrp->e_machine == back->elf_machine_alt1)
+ || (back->elf_machine_alt2 != 0
+ && i_ehdrp->e_machine == back->elf_machine_alt2))
{
/* target_ptr is an ELF backend which matches this
object file, so reject the generic ELF target. */
@@ -203,7 +187,7 @@ elf_core_file_p (abfd)
/* Allocate space for the program headers. */
amt = sizeof (*i_phdrp) * i_ehdrp->e_phnum;
- i_phdrp = (Elf_Internal_Phdr *) bfd_alloc (abfd, amt);
+ i_phdrp = bfd_alloc (abfd, amt);
if (!i_phdrp)
goto fail;
@@ -213,8 +197,8 @@ elf_core_file_p (abfd)
for (phindex = 0; phindex < i_ehdrp->e_phnum; ++phindex)
{
Elf_External_Phdr x_phdr;
- if (bfd_bread ((PTR) &x_phdr, (bfd_size_type) sizeof (x_phdr), abfd)
- != sizeof (x_phdr))
+
+ if (bfd_bread (&x_phdr, sizeof (x_phdr), abfd) != sizeof (x_phdr))
goto fail;
elf_swap_phdr_in (abfd, &x_phdr, i_phdrp + phindex);
@@ -232,23 +216,19 @@ elf_core_file_p (abfd)
/* Process each program header. */
for (phindex = 0; phindex < i_ehdrp->e_phnum; ++phindex)
- {
- if (! bfd_section_from_phdr (abfd, i_phdrp + phindex, (int) phindex))
- goto fail;
- }
+ if (! bfd_section_from_phdr (abfd, i_phdrp + phindex, (int) phindex))
+ goto fail;
/* Save the entry point from the ELF header. */
bfd_get_start_address (abfd) = i_ehdrp->e_entry;
/* Let the backend double check the format and override global
information. */
- if (ebd->elf_backend_object_p)
- {
- if (! (*ebd->elf_backend_object_p) (abfd))
- goto wrong;
- }
+ if (ebd->elf_backend_object_p
+ && (! (*ebd->elf_backend_object_p) (abfd)))
+ goto wrong;
- bfd_hash_table_free (&preserve.section_htab);
+ bfd_preserve_finish (abfd, &preserve);
return abfd->xvec;
wrong:
@@ -264,17 +244,7 @@ wrong:
bfd_set_error (bfd_error_wrong_format);
fail:
- abfd->arch_info = preserve.arch_info;
- if (new_tdata != NULL)
- {
- /* bfd_release frees all memory more recently bfd_alloc'd than
- its arg, as well as its arg. */
- bfd_release (abfd, new_tdata);
- elf_tdata (abfd) = preserve.tdata;
- abfd->section_htab = preserve.section_htab;
- abfd->sections = preserve.sections;
- abfd->section_tail = preserve.section_tail;
- abfd->section_count = preserve.section_count;
- }
+ if (preserve.marker != NULL)
+ bfd_preserve_restore (abfd, &preserve);
return NULL;
}
diff --git a/contrib/binutils/bfd/elflink.c b/contrib/binutils/bfd/elflink.c
index d6da588..6628db3 100644
--- a/contrib/binutils/bfd/elflink.c
+++ b/contrib/binutils/bfd/elflink.c
@@ -1,5 +1,5 @@
/* ELF linking support for BFD.
- Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
+ Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004
Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@@ -24,22 +24,23 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "libbfd.h"
#define ARCH_SIZE 0
#include "elf-bfd.h"
+#include "safe-ctype.h"
+#include "libiberty.h"
-boolean
-_bfd_elf_create_got_section (abfd, info)
- bfd *abfd;
- struct bfd_link_info *info;
+bfd_boolean
+_bfd_elf_create_got_section (bfd *abfd, struct bfd_link_info *info)
{
flagword flags;
- register asection *s;
+ asection *s;
struct elf_link_hash_entry *h;
struct bfd_link_hash_entry *bh;
- struct elf_backend_data *bed = get_elf_backend_data (abfd);
+ const struct elf_backend_data *bed = get_elf_backend_data (abfd);
int ptralign;
/* This function may be called more than once. */
- if (bfd_get_section_by_name (abfd, ".got") != NULL)
- return true;
+ s = bfd_get_section_by_name (abfd, ".got");
+ if (s != NULL && (s->flags & SEC_LINKER_CREATED) != 0)
+ return TRUE;
switch (bed->s->arch_size)
{
@@ -53,7 +54,7 @@ _bfd_elf_create_got_section (abfd, info)
default:
bfd_set_error (bfd_error_bad_value);
- return false;
+ return FALSE;
}
flags = (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS | SEC_IN_MEMORY
@@ -63,7 +64,7 @@ _bfd_elf_create_got_section (abfd, info)
if (s == NULL
|| !bfd_set_section_flags (abfd, s, flags)
|| !bfd_set_section_alignment (abfd, s, ptralign))
- return false;
+ return FALSE;
if (bed->want_got_plt)
{
@@ -71,7 +72,7 @@ _bfd_elf_create_got_section (abfd, info)
if (s == NULL
|| !bfd_set_section_flags (abfd, s, flags)
|| !bfd_set_section_alignment (abfd, s, ptralign))
- return false;
+ return FALSE;
}
if (bed->want_got_sym)
@@ -83,16 +84,15 @@ _bfd_elf_create_got_section (abfd, info)
bh = NULL;
if (!(_bfd_generic_link_add_one_symbol
(info, abfd, "_GLOBAL_OFFSET_TABLE_", BSF_GLOBAL, s,
- bed->got_symbol_offset, (const char *) NULL, false,
- bed->collect, &bh)))
- return false;
+ 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->shared
- && ! _bfd_elf_link_record_dynamic_symbol (info, h))
- return false;
+ if (! info->executable
+ && ! bfd_elf_link_record_dynamic_symbol (info, h))
+ return FALSE;
elf_hash_table (info)->hgot = h;
}
@@ -100,36 +100,157 @@ _bfd_elf_create_got_section (abfd, info)
/* The first bit of the global offset table is the header. */
s->_raw_size += bed->got_header_size + bed->got_symbol_offset;
- return true;
+ return TRUE;
}
-/* Create dynamic sections when linking against a dynamic object. */
+/* 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
-_bfd_elf_create_dynamic_sections (abfd, info)
- bfd *abfd;
- struct bfd_link_info *info;
+bfd_boolean
+_bfd_elf_link_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info)
{
- flagword flags, pltflags;
+ flagword flags;
register asection *s;
- struct elf_backend_data *bed = get_elf_backend_data (abfd);
- int ptralign;
+ struct elf_link_hash_entry *h;
+ struct bfd_link_hash_entry *bh;
+ const struct elf_backend_data *bed;
- switch (bed->s->arch_size)
+ if (! is_elf_hash_table (info->hash))
+ return FALSE;
+
+ if (elf_hash_table (info)->dynamic_sections_created)
+ return TRUE;
+
+ /* Make sure that all dynamic sections use the same input BFD. */
+ if (elf_hash_table (info)->dynobj == NULL)
+ elf_hash_table (info)->dynobj = abfd;
+ else
+ abfd = elf_hash_table (info)->dynobj;
+
+ /* Note that we set the SEC_IN_MEMORY flag for all of these
+ sections. */
+ flags = (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS
+ | SEC_IN_MEMORY | SEC_LINKER_CREATED);
+
+ /* A dynamically linked executable has a .interp section, but a
+ shared library does not. */
+ if (info->executable)
{
- case 32:
- ptralign = 2;
- break;
+ s = bfd_make_section (abfd, ".interp");
+ if (s == NULL
+ || ! bfd_set_section_flags (abfd, s, flags | SEC_READONLY))
+ return FALSE;
+ }
- case 64:
- ptralign = 3;
- break;
+ if (! info->traditional_format)
+ {
+ s = bfd_make_section (abfd, ".eh_frame_hdr");
+ if (s == NULL
+ || ! bfd_set_section_flags (abfd, s, flags | SEC_READONLY)
+ || ! bfd_set_section_alignment (abfd, s, 2))
+ return FALSE;
+ elf_hash_table (info)->eh_info.hdr_sec = s;
+ }
- default:
- bfd_set_error (bfd_error_bad_value);
- return false;
+ bed = get_elf_backend_data (abfd);
+
+ /* Create sections to hold version informations. These are removed
+ if they are not needed. */
+ s = bfd_make_section (abfd, ".gnu.version_d");
+ if (s == NULL
+ || ! bfd_set_section_flags (abfd, s, flags | SEC_READONLY)
+ || ! bfd_set_section_alignment (abfd, s, bed->s->log_file_align))
+ return FALSE;
+
+ s = bfd_make_section (abfd, ".gnu.version");
+ if (s == NULL
+ || ! bfd_set_section_flags (abfd, s, flags | SEC_READONLY)
+ || ! bfd_set_section_alignment (abfd, s, 1))
+ return FALSE;
+
+ s = bfd_make_section (abfd, ".gnu.version_r");
+ if (s == NULL
+ || ! bfd_set_section_flags (abfd, s, flags | SEC_READONLY)
+ || ! bfd_set_section_alignment (abfd, s, bed->s->log_file_align))
+ return FALSE;
+
+ s = bfd_make_section (abfd, ".dynsym");
+ if (s == NULL
+ || ! bfd_set_section_flags (abfd, s, flags | SEC_READONLY)
+ || ! bfd_set_section_alignment (abfd, s, bed->s->log_file_align))
+ return FALSE;
+
+ s = bfd_make_section (abfd, ".dynstr");
+ if (s == NULL
+ || ! bfd_set_section_flags (abfd, s, flags | SEC_READONLY))
+ return FALSE;
+
+ /* Create a strtab to hold the dynamic symbol names. */
+ if (elf_hash_table (info)->dynstr == NULL)
+ {
+ elf_hash_table (info)->dynstr = _bfd_elf_strtab_init ();
+ if (elf_hash_table (info)->dynstr == NULL)
+ return FALSE;
}
+ s = bfd_make_section (abfd, ".dynamic");
+ if (s == NULL
+ || ! bfd_set_section_flags (abfd, s, flags)
+ || ! bfd_set_section_alignment (abfd, s, bed->s->log_file_align))
+ return FALSE;
+
+ /* The special symbol _DYNAMIC is always set to the start of the
+ .dynamic section. This call occurs before we have processed the
+ symbols for any dynamic object, so we don't have to worry about
+ overriding a dynamic definition. We could set _DYNAMIC in a
+ linker script, but we only want to define it if we are, in fact,
+ creating a .dynamic section. We don't want to define it if there
+ is no .dynamic section, since on some ELF platforms the start up
+ code examines it to decide how to initialize the process. */
+ bh = NULL;
+ if (! (_bfd_generic_link_add_one_symbol
+ (info, abfd, "_DYNAMIC", BSF_GLOBAL, s, 0, NULL, FALSE,
+ get_elf_backend_data (abfd)->collect, &bh)))
+ return FALSE;
+ h = (struct elf_link_hash_entry *) bh;
+ h->elf_link_hash_flags |= ELF_LINK_HASH_DEF_REGULAR;
+ h->type = STT_OBJECT;
+
+ if (! info->executable
+ && ! bfd_elf_link_record_dynamic_symbol (info, h))
+ return FALSE;
+
+ s = bfd_make_section (abfd, ".hash");
+ if (s == NULL
+ || ! bfd_set_section_flags (abfd, s, flags | SEC_READONLY)
+ || ! bfd_set_section_alignment (abfd, s, bed->s->log_file_align))
+ return FALSE;
+ elf_section_data (s)->this_hdr.sh_entsize = bed->s->sizeof_hash_entry;
+
+ /* Let the backend create the rest of the sections. This lets the
+ backend set the right flags. The backend will normally create
+ the .got and .plt sections. */
+ if (! (*bed->elf_backend_create_dynamic_sections) (abfd, info))
+ return FALSE;
+
+ elf_hash_table (info)->dynamic_sections_created = TRUE;
+
+ return TRUE;
+}
+
+/* Create dynamic sections when linking against a dynamic object. */
+
+bfd_boolean
+_bfd_elf_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info)
+{
+ flagword flags, pltflags;
+ asection *s;
+ const struct elf_backend_data *bed = get_elf_backend_data (abfd);
+
/* We need to create .plt, .rel[a].plt, .got, .got.plt, .dynbss, and
.rel[a].bss sections. */
@@ -147,7 +268,7 @@ _bfd_elf_create_dynamic_sections (abfd, info)
if (s == NULL
|| ! bfd_set_section_flags (abfd, s, pltflags)
|| ! bfd_set_section_alignment (abfd, s, bed->plt_alignment))
- return false;
+ return FALSE;
if (bed->want_plt_sym)
{
@@ -157,28 +278,27 @@ _bfd_elf_create_dynamic_sections (abfd, info)
struct bfd_link_hash_entry *bh = NULL;
if (! (_bfd_generic_link_add_one_symbol
- (info, abfd, "_PROCEDURE_LINKAGE_TABLE_", BSF_GLOBAL, s,
- (bfd_vma) 0, (const char *) NULL, false,
- get_elf_backend_data (abfd)->collect, &bh)))
- return false;
+ (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->shared
- && ! _bfd_elf_link_record_dynamic_symbol (info, h))
- return false;
+ if (! info->executable
+ && ! bfd_elf_link_record_dynamic_symbol (info, h))
+ return FALSE;
}
s = bfd_make_section (abfd,
bed->default_use_rela_p ? ".rela.plt" : ".rel.plt");
if (s == NULL
|| ! bfd_set_section_flags (abfd, s, flags | SEC_READONLY)
- || ! bfd_set_section_alignment (abfd, s, ptralign))
- return false;
+ || ! bfd_set_section_alignment (abfd, s, bed->s->log_file_align))
+ return FALSE;
if (! _bfd_elf_create_got_section (abfd, info))
- return false;
+ return FALSE;
if (bed->want_dynbss)
{
@@ -190,8 +310,8 @@ _bfd_elf_create_dynamic_sections (abfd, info)
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))
- return false;
+ || ! bfd_set_section_flags (abfd, s, SEC_ALLOC | SEC_LINKER_CREATED))
+ return FALSE;
/* The .rel[a].bss section holds copy relocs. This section is not
normally needed. We need to create it here, though, so that the
@@ -211,12 +331,12 @@ _bfd_elf_create_dynamic_sections (abfd, info)
? ".rela.bss" : ".rel.bss"));
if (s == NULL
|| ! bfd_set_section_flags (abfd, s, flags | SEC_READONLY)
- || ! bfd_set_section_alignment (abfd, s, ptralign))
- return false;
+ || ! bfd_set_section_alignment (abfd, s, bed->s->log_file_align))
+ return FALSE;
}
}
- return true;
+ return TRUE;
}
/* Record a new dynamic symbol. We record the dynamic symbols as we
@@ -227,17 +347,15 @@ _bfd_elf_create_dynamic_sections (abfd, info)
symbol should be in the dynamic symbol table, but only if there is
one. */
-boolean
-_bfd_elf_link_record_dynamic_symbol (info, h)
- struct bfd_link_info *info;
- struct elf_link_hash_entry *h;
+bfd_boolean
+bfd_elf_link_record_dynamic_symbol (struct bfd_link_info *info,
+ struct elf_link_hash_entry *h)
{
if (h->dynindx == -1)
{
struct elf_strtab_hash *dynstr;
- char *p, *alc;
+ char *p;
const char *name;
- boolean copy;
bfd_size_type indx;
/* XXX: The ABI draft says the linker must turn hidden and
@@ -252,7 +370,7 @@ _bfd_elf_link_record_dynamic_symbol (info, h)
&& h->root.type != bfd_link_hash_undefweak)
{
h->elf_link_hash_flags |= ELF_LINK_FORCED_LOCAL;
- return true;
+ return TRUE;
}
default:
@@ -268,42 +386,102 @@ _bfd_elf_link_record_dynamic_symbol (info, h)
/* Create a strtab to hold the dynamic symbol names. */
elf_hash_table (info)->dynstr = dynstr = _bfd_elf_strtab_init ();
if (dynstr == NULL)
- return false;
+ return FALSE;
}
/* We don't put any version information in the dynamic string
- table. */
+ table. */
name = h->root.root.string;
p = strchr (name, ELF_VER_CHR);
- if (p == NULL)
- {
- alc = NULL;
- copy = false;
- }
- else
- {
- size_t len = p - name + 1;
+ if (p != NULL)
+ /* We know that the p points into writable memory. In fact,
+ there are only a few symbols that have read-only names, being
+ those like _GLOBAL_OFFSET_TABLE_ that are created specially
+ by the backends. Most symbols will have names pointing into
+ an ELF string table read from a file, or to objalloc memory. */
+ *p = 0;
- alc = bfd_malloc ((bfd_size_type) len);
- if (alc == NULL)
- return false;
- memcpy (alc, name, len - 1);
- alc[len - 1] = '\0';
- name = alc;
- copy = true;
- }
-
- indx = _bfd_elf_strtab_add (dynstr, name, copy);
+ indx = _bfd_elf_strtab_add (dynstr, name, p != NULL);
- if (alc != NULL)
- free (alc);
+ if (p != NULL)
+ *p = ELF_VER_CHR;
if (indx == (bfd_size_type) -1)
- return false;
+ return FALSE;
h->dynstr_index = indx;
}
- return true;
+ return TRUE;
+}
+
+/* Record an assignment to a symbol made by a linker script. We need
+ this in case some dynamic object refers to this symbol. */
+
+bfd_boolean
+bfd_elf_record_link_assignment (bfd *output_bfd ATTRIBUTE_UNUSED,
+ struct bfd_link_info *info,
+ const char *name,
+ bfd_boolean provide)
+{
+ struct elf_link_hash_entry *h;
+
+ if (!is_elf_hash_table (info->hash))
+ return TRUE;
+
+ h = elf_link_hash_lookup (elf_hash_table (info), name, TRUE, TRUE, FALSE);
+ if (h == NULL)
+ return FALSE;
+
+ /* Since we're defining the symbol, don't let it seem to have not
+ been defined. record_dynamic_symbol and size_dynamic_sections
+ may depend on this. */
+ if (h->root.type == bfd_link_hash_undefweak
+ || h->root.type == bfd_link_hash_undefined)
+ h->root.type = bfd_link_hash_new;
+
+ if (h->root.type == bfd_link_hash_new)
+ h->elf_link_hash_flags &= ~ELF_LINK_NON_ELF;
+
+ /* If this symbol is being provided by the linker script, and it is
+ currently defined by a dynamic object, but not by a regular
+ object, then mark it as undefined so that the generic linker will
+ force the correct value. */
+ if (provide
+ && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) != 0
+ && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0)
+ h->root.type = bfd_link_hash_undefined;
+
+ /* If this symbol is not being provided by the linker script, and it is
+ currently defined by a dynamic object, but not by a regular object,
+ then clear out any version information because the symbol will not be
+ associated with the dynamic object any more. */
+ if (!provide
+ && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) != 0
+ && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0)
+ h->verinfo.verdef = NULL;
+
+ h->elf_link_hash_flags |= ELF_LINK_HASH_DEF_REGULAR;
+
+ if (((h->elf_link_hash_flags & (ELF_LINK_HASH_DEF_DYNAMIC
+ | ELF_LINK_HASH_REF_DYNAMIC)) != 0
+ || info->shared)
+ && h->dynindx == -1)
+ {
+ if (! bfd_elf_link_record_dynamic_symbol (info, h))
+ return FALSE;
+
+ /* If this is a weak defined symbol, and we know a corresponding
+ real symbol from the same dynamic object, make sure the real
+ symbol is also made into a dynamic symbol. */
+ if (h->weakdef != NULL
+ && h->weakdef->dynindx == -1)
+ {
+ if (! bfd_elf_link_record_dynamic_symbol (info, h->weakdef))
+ return FALSE;
+ }
+ }
+
+ return TRUE;
}
/* Record a new local dynamic symbol. Returns 0 on failure, 1 on
@@ -311,10 +489,9 @@ _bfd_elf_link_record_dynamic_symbol (info, h)
in a discarded section, eg. a discarded link-once section symbol. */
int
-elf_link_record_local_dynamic_symbol (info, input_bfd, input_indx)
- struct bfd_link_info *info;
- bfd *input_bfd;
- long input_indx;
+bfd_elf_link_record_local_dynamic_symbol (struct bfd_link_info *info,
+ bfd *input_bfd,
+ long input_indx)
{
bfd_size_type amt;
struct elf_link_local_dynamic_entry *entry;
@@ -325,7 +502,7 @@ elf_link_record_local_dynamic_symbol (info, input_bfd, input_indx)
Elf_External_Sym_Shndx eshndx;
char esym[sizeof (Elf64_External_Sym)];
- if (! is_elf_hash_table (info))
+ if (! is_elf_hash_table (info->hash))
return 0;
/* See if the entry exists already. */
@@ -334,14 +511,13 @@ elf_link_record_local_dynamic_symbol (info, input_bfd, input_indx)
return 1;
amt = sizeof (*entry);
- entry = (struct elf_link_local_dynamic_entry *) bfd_alloc (input_bfd, amt);
+ entry = bfd_alloc (input_bfd, amt);
if (entry == NULL)
return 0;
/* Go find the symbol, so that we can find it's name. */
if (!bfd_elf_get_elf_syms (input_bfd, &elf_tdata (input_bfd)->symtab_hdr,
- (size_t) 1, (size_t) input_indx,
- &entry->isym, esym, &eshndx))
+ 1, input_indx, &entry->isym, esym, &eshndx))
{
bfd_release (input_bfd, entry);
return 0;
@@ -376,7 +552,7 @@ elf_link_record_local_dynamic_symbol (info, input_bfd, input_indx)
return 0;
}
- dynstr_index = _bfd_elf_strtab_add (dynstr, name, false);
+ dynstr_index = _bfd_elf_strtab_add (dynstr, name, FALSE);
if (dynstr_index == (unsigned long) -1)
return 0;
entry->isym.st_name = dynstr_index;
@@ -401,10 +577,9 @@ elf_link_record_local_dynamic_symbol (info, input_bfd, input_indx)
/* Return the dynindex of a local dynamic symbol. */
long
-_bfd_elf_link_lookup_local_dynindx (info, input_bfd, input_indx)
- struct bfd_link_info *info;
- bfd *input_bfd;
- long input_indx;
+_bfd_elf_link_lookup_local_dynindx (struct bfd_link_info *info,
+ bfd *input_bfd,
+ long input_indx)
{
struct elf_link_local_dynamic_entry *e;
@@ -418,15 +593,11 @@ _bfd_elf_link_lookup_local_dynindx (info, input_bfd, input_indx)
them are removed because they are marked as local. This is called
via elf_link_hash_traverse. */
-static boolean elf_link_renumber_hash_table_dynsyms
- PARAMS ((struct elf_link_hash_entry *, PTR));
-
-static boolean
-elf_link_renumber_hash_table_dynsyms (h, data)
- struct elf_link_hash_entry *h;
- PTR data;
+static bfd_boolean
+elf_link_renumber_hash_table_dynsyms (struct elf_link_hash_entry *h,
+ void *data)
{
- size_t *count = (size_t *) data;
+ size_t *count = data;
if (h->root.type == bfd_link_hash_warning)
h = (struct elf_link_hash_entry *) h->root.u.i.link;
@@ -434,7 +605,7 @@ elf_link_renumber_hash_table_dynsyms (h, data)
if (h->dynindx != -1)
h->dynindx = ++(*count);
- return true;
+ return TRUE;
}
/* Assign dynsym indices. In a shared library we generate a section
@@ -443,9 +614,7 @@ elf_link_renumber_hash_table_dynsyms (h, data)
the global symbols. */
unsigned long
-_bfd_elf_link_renumber_dynsyms (output_bfd, info)
- bfd *output_bfd;
- struct bfd_link_info *info;
+_bfd_elf_link_renumber_dynsyms (bfd *output_bfd, struct bfd_link_info *info)
{
unsigned long dynsymcount = 0;
@@ -476,175 +645,8264 @@ _bfd_elf_link_renumber_dynsyms (output_bfd, info)
return elf_hash_table (info)->dynsymcount = dynsymcount;
}
+
+/* This function is called when we want to define a new symbol. It
+ handles the various cases which arise when we find a definition in
+ a dynamic object, or when there is already a definition in a
+ dynamic object. The new symbol is described by NAME, SYM, PSEC,
+ and PVALUE. We set SYM_HASH to the hash table entry. We set
+ OVERRIDE if the old symbol is overriding a new definition. We set
+ TYPE_CHANGE_OK if it is OK for the type to change. We set
+ SIZE_CHANGE_OK if it is OK for the size to change. By OK to
+ change, we mean that we shouldn't warn if the type or size does
+ change. */
+
+bfd_boolean
+_bfd_elf_merge_symbol (bfd *abfd,
+ struct bfd_link_info *info,
+ const char *name,
+ Elf_Internal_Sym *sym,
+ asection **psec,
+ bfd_vma *pvalue,
+ struct elf_link_hash_entry **sym_hash,
+ bfd_boolean *skip,
+ bfd_boolean *override,
+ bfd_boolean *type_change_ok,
+ bfd_boolean *size_change_ok)
+{
+ asection *sec;
+ struct elf_link_hash_entry *h;
+ struct elf_link_hash_entry *flip;
+ int bind;
+ bfd *oldbfd;
+ bfd_boolean newdyn, olddyn, olddef, newdef, newdyncommon, olddyncommon;
+ bfd_boolean newweak, oldweak;
+
+ *skip = FALSE;
+ *override = FALSE;
+
+ sec = *psec;
+ bind = ELF_ST_BIND (sym->st_info);
+
+ if (! bfd_is_und_section (sec))
+ h = elf_link_hash_lookup (elf_hash_table (info), name, TRUE, FALSE, FALSE);
+ else
+ h = ((struct elf_link_hash_entry *)
+ bfd_wrapped_link_hash_lookup (abfd, info, name, TRUE, FALSE, FALSE));
+ if (h == NULL)
+ return FALSE;
+ *sym_hash = h;
+
+ /* This code is for coping with dynamic objects, and is only useful
+ if we are doing an ELF link. */
+ if (info->hash->creator != abfd->xvec)
+ return TRUE;
+
+ /* For merging, we only care about real symbols. */
+
+ while (h->root.type == bfd_link_hash_indirect
+ || h->root.type == bfd_link_hash_warning)
+ h = (struct elf_link_hash_entry *) h->root.u.i.link;
+
+ /* If we just created the symbol, mark it as being an ELF symbol.
+ Other than that, there is nothing to do--there is no merge issue
+ with a newly defined symbol--so we just return. */
+
+ if (h->root.type == bfd_link_hash_new)
+ {
+ h->elf_link_hash_flags &=~ ELF_LINK_NON_ELF;
+ return TRUE;
+ }
+
+ /* OLDBFD is a BFD associated with the existing symbol. */
+
+ switch (h->root.type)
+ {
+ default:
+ oldbfd = NULL;
+ break;
+
+ case bfd_link_hash_undefined:
+ case bfd_link_hash_undefweak:
+ oldbfd = h->root.u.undef.abfd;
+ break;
+
+ case bfd_link_hash_defined:
+ case bfd_link_hash_defweak:
+ oldbfd = h->root.u.def.section->owner;
+ break;
+
+ case bfd_link_hash_common:
+ oldbfd = h->root.u.c.p->section->owner;
+ break;
+ }
+
+ /* In cases involving weak versioned symbols, we may wind up trying
+ to merge a symbol with itself. Catch that here, to avoid the
+ confusion that results if we try to override a symbol with
+ itself. The additional tests catch cases like
+ _GLOBAL_OFFSET_TABLE_, which are regular symbols defined in a
+ dynamic object, which we do want to handle here. */
+ if (abfd == oldbfd
+ && ((abfd->flags & DYNAMIC) == 0
+ || (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0))
+ return TRUE;
+
+ /* NEWDYN and OLDDYN indicate whether the new or old symbol,
+ respectively, is from a dynamic object. */
+
+ if ((abfd->flags & DYNAMIC) != 0)
+ newdyn = TRUE;
+ else
+ newdyn = FALSE;
+
+ if (oldbfd != NULL)
+ olddyn = (oldbfd->flags & DYNAMIC) != 0;
+ else
+ {
+ asection *hsec;
+
+ /* This code handles the special SHN_MIPS_{TEXT,DATA} section
+ indices used by MIPS ELF. */
+ switch (h->root.type)
+ {
+ default:
+ hsec = NULL;
+ break;
+
+ case bfd_link_hash_defined:
+ case bfd_link_hash_defweak:
+ hsec = h->root.u.def.section;
+ break;
+
+ case bfd_link_hash_common:
+ hsec = h->root.u.c.p->section;
+ break;
+ }
+
+ if (hsec == NULL)
+ olddyn = FALSE;
+ else
+ olddyn = (hsec->symbol->flags & BSF_DYNAMIC) != 0;
+ }
+
+ /* NEWDEF and OLDDEF indicate whether the new or old symbol,
+ respectively, appear to be a definition rather than reference. */
+
+ if (bfd_is_und_section (sec) || bfd_is_com_section (sec))
+ newdef = FALSE;
+ else
+ newdef = TRUE;
+
+ if (h->root.type == bfd_link_hash_undefined
+ || h->root.type == bfd_link_hash_undefweak
+ || h->root.type == bfd_link_hash_common)
+ olddef = FALSE;
+ else
+ olddef = TRUE;
+
+ /* We need to remember if a symbol has a definition in a dynamic
+ object or is weak in all dynamic objects. Internal and hidden
+ visibility will make it unavailable to dynamic objects. */
+ if (newdyn && (h->elf_link_hash_flags & ELF_LINK_DYNAMIC_DEF) == 0)
+ {
+ if (!bfd_is_und_section (sec))
+ h->elf_link_hash_flags |= ELF_LINK_DYNAMIC_DEF;
+ else
+ {
+ /* Check if this symbol is weak in all dynamic objects. If it
+ is the first time we see it in a dynamic object, we mark
+ if it is weak. Otherwise, we clear it. */
+ if ((h->elf_link_hash_flags & ELF_LINK_HASH_REF_DYNAMIC) == 0)
+ {
+ if (bind == STB_WEAK)
+ h->elf_link_hash_flags |= ELF_LINK_DYNAMIC_WEAK;
+ }
+ else if (bind != STB_WEAK)
+ h->elf_link_hash_flags &= ~ELF_LINK_DYNAMIC_WEAK;
+ }
+ }
+
+ /* If the old symbol has non-default visibility, we ignore the new
+ definition from a dynamic object. */
+ if (newdyn
+ && ELF_ST_VISIBILITY (h->other) != STV_DEFAULT
+ && !bfd_is_und_section (sec))
+ {
+ *skip = TRUE;
+ /* Make sure this symbol is dynamic. */
+ h->elf_link_hash_flags |= ELF_LINK_HASH_REF_DYNAMIC;
+ /* A protected symbol has external availability. Make sure it is
+ recorded as dynamic.
+
+ FIXME: Should we check type and size for protected symbol? */
+ if (ELF_ST_VISIBILITY (h->other) == STV_PROTECTED)
+ return bfd_elf_link_record_dynamic_symbol (info, h);
+ else
+ return TRUE;
+ }
+ else if (!newdyn
+ && ELF_ST_VISIBILITY (sym->st_other) != STV_DEFAULT
+ && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) != 0)
+ {
+ /* If the new symbol with non-default visibility comes from a
+ relocatable file and the old definition comes from a dynamic
+ object, we remove the old definition. */
+ if ((*sym_hash)->root.type == bfd_link_hash_indirect)
+ h = *sym_hash;
+
+ if ((h->root.und_next || info->hash->undefs_tail == &h->root)
+ && bfd_is_und_section (sec))
+ {
+ /* If the new symbol is undefined and the old symbol was
+ also undefined before, we need to make sure
+ _bfd_generic_link_add_one_symbol doesn't mess
+ up the linker hash table undefs list. Since the old
+ definition came from a dynamic object, it is still on the
+ undefs list. */
+ h->root.type = bfd_link_hash_undefined;
+ /* FIXME: What if the new symbol is weak undefined? */
+ h->root.u.undef.abfd = abfd;
+ }
+ else
+ {
+ h->root.type = bfd_link_hash_new;
+ h->root.u.undef.abfd = NULL;
+ }
+
+ if (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC)
+ {
+ h->elf_link_hash_flags &= ~ELF_LINK_HASH_DEF_DYNAMIC;
+ h->elf_link_hash_flags |= (ELF_LINK_HASH_REF_DYNAMIC
+ | ELF_LINK_DYNAMIC_DEF);
+ }
+ /* FIXME: Should we check type and size for protected symbol? */
+ h->size = 0;
+ h->type = 0;
+ return TRUE;
+ }
+
+ /* Differentiate strong and weak symbols. */
+ newweak = bind == STB_WEAK;
+ oldweak = (h->root.type == bfd_link_hash_defweak
+ || h->root.type == bfd_link_hash_undefweak);
+
+ /* If a new weak symbol definition comes from a regular file and the
+ old symbol comes from a dynamic library, we treat the new one as
+ strong. Similarly, an old weak symbol definition from a regular
+ file is treated as strong when the new symbol comes from a dynamic
+ library. Further, an old weak symbol from a dynamic library is
+ treated as strong if the new symbol is from a dynamic library.
+ This reflects the way glibc's ld.so works.
+
+ Do this before setting *type_change_ok or *size_change_ok so that
+ we warn properly when dynamic library symbols are overridden. */
+
+ if (newdef && !newdyn && olddyn)
+ newweak = FALSE;
+ if (olddef && newdyn)
+ oldweak = FALSE;
+
+ /* It's OK to change the type if either the existing symbol or the
+ new symbol is weak. A type change is also OK if the old symbol
+ is undefined and the new symbol is defined. */
+
+ if (oldweak
+ || newweak
+ || (newdef
+ && h->root.type == bfd_link_hash_undefined))
+ *type_change_ok = TRUE;
+
+ /* It's OK to change the size if either the existing symbol or the
+ new symbol is weak, or if the old symbol is undefined. */
+
+ if (*type_change_ok
+ || h->root.type == bfd_link_hash_undefined)
+ *size_change_ok = TRUE;
+
+ /* NEWDYNCOMMON and OLDDYNCOMMON indicate whether the new or old
+ symbol, respectively, appears to be a common symbol in a dynamic
+ object. If a symbol appears in an uninitialized section, and is
+ not weak, and is not a function, then it may be a common symbol
+ which was resolved when the dynamic object was created. We want
+ to treat such symbols specially, because they raise special
+ considerations when setting the symbol size: if the symbol
+ appears as a common symbol in a regular object, and the size in
+ the regular object is larger, we must make sure that we use the
+ larger size. This problematic case can always be avoided in C,
+ but it must be handled correctly when using Fortran shared
+ libraries.
+
+ Note that if NEWDYNCOMMON is set, NEWDEF will be set, and
+ likewise for OLDDYNCOMMON and OLDDEF.
+
+ Note that this test is just a heuristic, and that it is quite
+ possible to have an uninitialized symbol in a shared object which
+ is really a definition, rather than a common symbol. This could
+ lead to some minor confusion when the symbol really is a common
+ symbol in some regular object. However, I think it will be
+ harmless. */
+
+ if (newdyn
+ && newdef
+ && !newweak
+ && (sec->flags & SEC_ALLOC) != 0
+ && (sec->flags & SEC_LOAD) == 0
+ && sym->st_size > 0
+ && ELF_ST_TYPE (sym->st_info) != STT_FUNC)
+ newdyncommon = TRUE;
+ else
+ newdyncommon = FALSE;
+
+ if (olddyn
+ && olddef
+ && h->root.type == bfd_link_hash_defined
+ && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) != 0
+ && (h->root.u.def.section->flags & SEC_ALLOC) != 0
+ && (h->root.u.def.section->flags & SEC_LOAD) == 0
+ && h->size > 0
+ && h->type != STT_FUNC)
+ olddyncommon = TRUE;
+ else
+ olddyncommon = FALSE;
+
+ /* If both the old and the new symbols look like common symbols in a
+ dynamic object, set the size of the symbol to the larger of the
+ two. */
+
+ if (olddyncommon
+ && newdyncommon
+ && sym->st_size != h->size)
+ {
+ /* Since we think we have two common symbols, issue a multiple
+ common warning if desired. Note that we only warn if the
+ size is different. If the size is the same, we simply let
+ the old symbol override the new one as normally happens with
+ symbols defined in dynamic objects. */
+
+ if (! ((*info->callbacks->multiple_common)
+ (info, h->root.root.string, oldbfd, bfd_link_hash_common,
+ h->size, abfd, bfd_link_hash_common, sym->st_size)))
+ return FALSE;
+
+ if (sym->st_size > h->size)
+ h->size = sym->st_size;
+
+ *size_change_ok = TRUE;
+ }
+
+ /* If we are looking at a dynamic object, and we have found a
+ definition, we need to see if the symbol was already defined by
+ some other object. If so, we want to use the existing
+ definition, and we do not want to report a multiple symbol
+ definition error; we do this by clobbering *PSEC to be
+ bfd_und_section_ptr.
+
+ We treat a common symbol as a definition if the symbol in the
+ shared library is a function, since common symbols always
+ represent variables; this can cause confusion in principle, but
+ any such confusion would seem to indicate an erroneous program or
+ shared library. We also permit a common symbol in a regular
+ object to override a weak symbol in a shared object. */
+
+ if (newdyn
+ && newdef
+ && (olddef
+ || (h->root.type == bfd_link_hash_common
+ && (newweak
+ || ELF_ST_TYPE (sym->st_info) == STT_FUNC))))
+ {
+ *override = TRUE;
+ newdef = FALSE;
+ newdyncommon = FALSE;
+
+ *psec = sec = bfd_und_section_ptr;
+ *size_change_ok = TRUE;
+
+ /* If we get here when the old symbol is a common symbol, then
+ we are explicitly letting it override a weak symbol or
+ function in a dynamic object, and we don't want to warn about
+ a type change. If the old symbol is a defined symbol, a type
+ change warning may still be appropriate. */
+
+ if (h->root.type == bfd_link_hash_common)
+ *type_change_ok = TRUE;
+ }
+
+ /* Handle the special case of an old common symbol merging with a
+ new symbol which looks like a common symbol in a shared object.
+ We change *PSEC and *PVALUE to make the new symbol look like a
+ common symbol, and let _bfd_generic_link_add_one_symbol will do
+ the right thing. */
+
+ if (newdyncommon
+ && h->root.type == bfd_link_hash_common)
+ {
+ *override = TRUE;
+ newdef = FALSE;
+ newdyncommon = FALSE;
+ *pvalue = sym->st_size;
+ *psec = sec = bfd_com_section_ptr;
+ *size_change_ok = TRUE;
+ }
+
+ /* If the old symbol is from a dynamic object, and the new symbol is
+ a definition which is not from a dynamic object, then the new
+ symbol overrides the old symbol. Symbols from regular files
+ always take precedence over symbols from dynamic objects, even if
+ they are defined after the dynamic object in the link.
+
+ As above, we again permit a common symbol in a regular object to
+ override a definition in a shared object if the shared object
+ symbol is a function or is weak. */
+
+ flip = NULL;
+ if (! newdyn
+ && (newdef
+ || (bfd_is_com_section (sec)
+ && (oldweak
+ || h->type == STT_FUNC)))
+ && olddyn
+ && olddef
+ && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) != 0)
+ {
+ /* Change the hash table entry to undefined, and let
+ _bfd_generic_link_add_one_symbol do the right thing with the
+ new definition. */
+
+ h->root.type = bfd_link_hash_undefined;
+ h->root.u.undef.abfd = h->root.u.def.section->owner;
+ *size_change_ok = TRUE;
+
+ olddef = FALSE;
+ olddyncommon = FALSE;
+
+ /* We again permit a type change when a common symbol may be
+ overriding a function. */
+
+ if (bfd_is_com_section (sec))
+ *type_change_ok = TRUE;
+
+ if ((*sym_hash)->root.type == bfd_link_hash_indirect)
+ flip = *sym_hash;
+ else
+ /* This union may have been set to be non-NULL when this symbol
+ was seen in a dynamic object. We must force the union to be
+ NULL, so that it is correct for a regular symbol. */
+ h->verinfo.vertree = NULL;
+ }
+
+ /* Handle the special case of a new common symbol merging with an
+ old symbol that looks like it might be a common symbol defined in
+ a shared object. Note that we have already handled the case in
+ which a new common symbol should simply override the definition
+ in the shared library. */
+
+ if (! newdyn
+ && bfd_is_com_section (sec)
+ && olddyncommon)
+ {
+ /* It would be best if we could set the hash table entry to a
+ common symbol, but we don't know what to use for the section
+ or the alignment. */
+ if (! ((*info->callbacks->multiple_common)
+ (info, h->root.root.string, oldbfd, bfd_link_hash_common,
+ h->size, abfd, bfd_link_hash_common, sym->st_size)))
+ return FALSE;
+
+ /* If the presumed common symbol in the dynamic object is
+ larger, pretend that the new symbol has its size. */
+
+ if (h->size > *pvalue)
+ *pvalue = h->size;
+
+ /* FIXME: We no longer know the alignment required by the symbol
+ in the dynamic object, so we just wind up using the one from
+ the regular object. */
+
+ olddef = FALSE;
+ olddyncommon = FALSE;
+
+ h->root.type = bfd_link_hash_undefined;
+ h->root.u.undef.abfd = h->root.u.def.section->owner;
+
+ *size_change_ok = TRUE;
+ *type_change_ok = TRUE;
+
+ if ((*sym_hash)->root.type == bfd_link_hash_indirect)
+ flip = *sym_hash;
+ else
+ h->verinfo.vertree = NULL;
+ }
+
+ if (flip != NULL)
+ {
+ /* Handle the case where we had a versioned symbol in a dynamic
+ library and now find a definition in a normal object. In this
+ case, we make the versioned symbol point to the normal one. */
+ const struct elf_backend_data *bed = get_elf_backend_data (abfd);
+ flip->root.type = h->root.type;
+ h->root.type = bfd_link_hash_indirect;
+ h->root.u.i.link = (struct bfd_link_hash_entry *) flip;
+ (*bed->elf_backend_copy_indirect_symbol) (bed, flip, h);
+ flip->root.u.undef.abfd = h->root.u.undef.abfd;
+ if (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC)
+ {
+ h->elf_link_hash_flags &= ~ELF_LINK_HASH_DEF_DYNAMIC;
+ flip->elf_link_hash_flags |= ELF_LINK_HASH_REF_DYNAMIC;
+ }
+ }
+
+ return TRUE;
+}
+
+/* This function is called to create an indirect symbol from the
+ default for the symbol with the default version if needed. The
+ symbol is described by H, NAME, SYM, PSEC, VALUE, and OVERRIDE. We
+ set DYNSYM if the new indirect symbol is dynamic. */
+
+bfd_boolean
+_bfd_elf_add_default_symbol (bfd *abfd,
+ struct bfd_link_info *info,
+ struct elf_link_hash_entry *h,
+ const char *name,
+ Elf_Internal_Sym *sym,
+ asection **psec,
+ bfd_vma *value,
+ bfd_boolean *dynsym,
+ bfd_boolean override)
+{
+ bfd_boolean type_change_ok;
+ bfd_boolean size_change_ok;
+ bfd_boolean skip;
+ char *shortname;
+ struct elf_link_hash_entry *hi;
+ struct bfd_link_hash_entry *bh;
+ const struct elf_backend_data *bed;
+ bfd_boolean collect;
+ bfd_boolean dynamic;
+ char *p;
+ size_t len, shortlen;
+ asection *sec;
+
+ /* If this symbol has a version, and it is the default version, we
+ create an indirect symbol from the default name to the fully
+ decorated name. This will cause external references which do not
+ specify a version to be bound to this version of the symbol. */
+ p = strchr (name, ELF_VER_CHR);
+ if (p == NULL || p[1] != ELF_VER_CHR)
+ return TRUE;
+
+ if (override)
+ {
+ /* We are overridden by an old definition. We need to check if we
+ need to create the indirect symbol from the default name. */
+ hi = elf_link_hash_lookup (elf_hash_table (info), name, TRUE,
+ FALSE, FALSE);
+ BFD_ASSERT (hi != NULL);
+ if (hi == h)
+ return TRUE;
+ while (hi->root.type == bfd_link_hash_indirect
+ || hi->root.type == bfd_link_hash_warning)
+ {
+ hi = (struct elf_link_hash_entry *) hi->root.u.i.link;
+ if (hi == h)
+ return TRUE;
+ }
+ }
+
+ bed = get_elf_backend_data (abfd);
+ collect = bed->collect;
+ dynamic = (abfd->flags & DYNAMIC) != 0;
+
+ shortlen = p - name;
+ shortname = bfd_hash_allocate (&info->hash->table, shortlen + 1);
+ if (shortname == NULL)
+ return FALSE;
+ memcpy (shortname, name, shortlen);
+ shortname[shortlen] = '\0';
+
+ /* We are going to create a new symbol. Merge it with any existing
+ symbol with this name. For the purposes of the merge, act as
+ though we were defining the symbol we just defined, although we
+ actually going to define an indirect symbol. */
+ type_change_ok = FALSE;
+ size_change_ok = FALSE;
+ sec = *psec;
+ if (!_bfd_elf_merge_symbol (abfd, info, shortname, sym, &sec, value,
+ &hi, &skip, &override, &type_change_ok,
+ &size_change_ok))
+ return FALSE;
+
+ if (skip)
+ goto nondefault;
+
+ if (! override)
+ {
+ bh = &hi->root;
+ if (! (_bfd_generic_link_add_one_symbol
+ (info, abfd, shortname, BSF_INDIRECT, bfd_ind_section_ptr,
+ 0, name, FALSE, collect, &bh)))
+ return FALSE;
+ hi = (struct elf_link_hash_entry *) bh;
+ }
+ else
+ {
+ /* In this case the symbol named SHORTNAME is overriding the
+ indirect symbol we want to add. We were planning on making
+ SHORTNAME an indirect symbol referring to NAME. SHORTNAME
+ is the name without a version. NAME is the fully versioned
+ name, and it is the default version.
+
+ Overriding means that we already saw a definition for the
+ symbol SHORTNAME in a regular object, and it is overriding
+ the symbol defined in the dynamic object.
+
+ When this happens, we actually want to change NAME, the
+ symbol we just added, to refer to SHORTNAME. This will cause
+ references to NAME in the shared object to become references
+ to SHORTNAME in the regular object. This is what we expect
+ when we override a function in a shared object: that the
+ references in the shared object will be mapped to the
+ definition in the regular object. */
+
+ while (hi->root.type == bfd_link_hash_indirect
+ || hi->root.type == bfd_link_hash_warning)
+ hi = (struct elf_link_hash_entry *) hi->root.u.i.link;
+
+ h->root.type = bfd_link_hash_indirect;
+ h->root.u.i.link = (struct bfd_link_hash_entry *) hi;
+ if (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC)
+ {
+ h->elf_link_hash_flags &=~ ELF_LINK_HASH_DEF_DYNAMIC;
+ hi->elf_link_hash_flags |= ELF_LINK_HASH_REF_DYNAMIC;
+ if (hi->elf_link_hash_flags
+ & (ELF_LINK_HASH_REF_REGULAR
+ | ELF_LINK_HASH_DEF_REGULAR))
+ {
+ if (! bfd_elf_link_record_dynamic_symbol (info, hi))
+ return FALSE;
+ }
+ }
+
+ /* Now set HI to H, so that the following code will set the
+ other fields correctly. */
+ hi = h;
+ }
+
+ /* If there is a duplicate definition somewhere, then HI may not
+ point to an indirect symbol. We will have reported an error to
+ the user in that case. */
+
+ if (hi->root.type == bfd_link_hash_indirect)
+ {
+ struct elf_link_hash_entry *ht;
+
+ ht = (struct elf_link_hash_entry *) hi->root.u.i.link;
+ (*bed->elf_backend_copy_indirect_symbol) (bed, ht, hi);
+
+ /* See if the new flags lead us to realize that the symbol must
+ be dynamic. */
+ if (! *dynsym)
+ {
+ if (! dynamic)
+ {
+ if (info->shared
+ || ((hi->elf_link_hash_flags
+ & ELF_LINK_HASH_REF_DYNAMIC) != 0))
+ *dynsym = TRUE;
+ }
+ else
+ {
+ if ((hi->elf_link_hash_flags
+ & ELF_LINK_HASH_REF_REGULAR) != 0)
+ *dynsym = TRUE;
+ }
+ }
+ }
+
+ /* We also need to define an indirection from the nondefault version
+ of the symbol. */
+
+nondefault:
+ len = strlen (name);
+ shortname = bfd_hash_allocate (&info->hash->table, len);
+ if (shortname == NULL)
+ return FALSE;
+ memcpy (shortname, name, shortlen);
+ memcpy (shortname + shortlen, p + 1, len - shortlen);
+
+ /* Once again, merge with any existing symbol. */
+ type_change_ok = FALSE;
+ size_change_ok = FALSE;
+ sec = *psec;
+ if (!_bfd_elf_merge_symbol (abfd, info, shortname, sym, &sec, value,
+ &hi, &skip, &override, &type_change_ok,
+ &size_change_ok))
+ return FALSE;
+
+ if (skip)
+ return TRUE;
+
+ if (override)
+ {
+ /* Here SHORTNAME is a versioned name, so we don't expect to see
+ the type of override we do in the case above unless it is
+ overridden by a versioned definition. */
+ if (hi->root.type != bfd_link_hash_defined
+ && hi->root.type != bfd_link_hash_defweak)
+ (*_bfd_error_handler)
+ (_("%s: warning: unexpected redefinition of indirect versioned symbol `%s'"),
+ bfd_archive_filename (abfd), shortname);
+ }
+ else
+ {
+ bh = &hi->root;
+ if (! (_bfd_generic_link_add_one_symbol
+ (info, abfd, shortname, BSF_INDIRECT,
+ bfd_ind_section_ptr, 0, name, FALSE, collect, &bh)))
+ return FALSE;
+ hi = (struct elf_link_hash_entry *) bh;
+
+ /* If there is a duplicate definition somewhere, then HI may not
+ point to an indirect symbol. We will have reported an error
+ to the user in that case. */
+
+ if (hi->root.type == bfd_link_hash_indirect)
+ {
+ (*bed->elf_backend_copy_indirect_symbol) (bed, h, hi);
+
+ /* See if the new flags lead us to realize that the symbol
+ must be dynamic. */
+ if (! *dynsym)
+ {
+ if (! dynamic)
+ {
+ if (info->shared
+ || ((hi->elf_link_hash_flags
+ & ELF_LINK_HASH_REF_DYNAMIC) != 0))
+ *dynsym = TRUE;
+ }
+ else
+ {
+ if ((hi->elf_link_hash_flags
+ & ELF_LINK_HASH_REF_REGULAR) != 0)
+ *dynsym = TRUE;
+ }
+ }
+ }
+ }
+
+ return TRUE;
+}
+
+/* This routine is used to export all defined symbols into the dynamic
+ symbol table. It is called via elf_link_hash_traverse. */
+
+bfd_boolean
+_bfd_elf_export_symbol (struct elf_link_hash_entry *h, void *data)
+{
+ struct elf_info_failed *eif = data;
+
+ /* Ignore indirect symbols. These are added by the versioning code. */
+ if (h->root.type == bfd_link_hash_indirect)
+ return TRUE;
+
+ if (h->root.type == bfd_link_hash_warning)
+ h = (struct elf_link_hash_entry *) h->root.u.i.link;
+
+ if (h->dynindx == -1
+ && (h->elf_link_hash_flags
+ & (ELF_LINK_HASH_DEF_REGULAR | ELF_LINK_HASH_REF_REGULAR)) != 0)
+ {
+ struct bfd_elf_version_tree *t;
+ struct bfd_elf_version_expr *d;
+
+ for (t = eif->verdefs; t != NULL; t = t->next)
+ {
+ if (t->globals.list != NULL)
+ {
+ d = (*t->match) (&t->globals, NULL, h->root.root.string);
+ if (d != NULL)
+ goto doit;
+ }
+
+ if (t->locals.list != NULL)
+ {
+ d = (*t->match) (&t->locals, NULL, h->root.root.string);
+ if (d != NULL)
+ return TRUE;
+ }
+ }
+
+ if (!eif->verdefs)
+ {
+ doit:
+ if (! bfd_elf_link_record_dynamic_symbol (eif->info, h))
+ {
+ eif->failed = TRUE;
+ return FALSE;
+ }
+ }
+ }
+
+ return TRUE;
+}
+
+/* Look through the symbols which are defined in other shared
+ libraries and referenced here. Update the list of version
+ dependencies. This will be put into the .gnu.version_r section.
+ This function is called via elf_link_hash_traverse. */
+
+bfd_boolean
+_bfd_elf_link_find_version_dependencies (struct elf_link_hash_entry *h,
+ void *data)
+{
+ struct elf_find_verdep_info *rinfo = data;
+ Elf_Internal_Verneed *t;
+ Elf_Internal_Vernaux *a;
+ bfd_size_type amt;
+
+ if (h->root.type == bfd_link_hash_warning)
+ h = (struct elf_link_hash_entry *) h->root.u.i.link;
+
+ /* We only care about symbols defined in shared objects with version
+ information. */
+ if ((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) == 0
+ || (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) != 0
+ || h->dynindx == -1
+ || h->verinfo.verdef == NULL)
+ return TRUE;
+
+ /* See if we already know about this version. */
+ for (t = elf_tdata (rinfo->output_bfd)->verref; t != NULL; t = t->vn_nextref)
+ {
+ if (t->vn_bfd != h->verinfo.verdef->vd_bfd)
+ continue;
+
+ for (a = t->vn_auxptr; a != NULL; a = a->vna_nextptr)
+ if (a->vna_nodename == h->verinfo.verdef->vd_nodename)
+ return TRUE;
+
+ break;
+ }
+
+ /* This is a new version. Add it to tree we are building. */
+
+ if (t == NULL)
+ {
+ amt = sizeof *t;
+ t = bfd_zalloc (rinfo->output_bfd, amt);
+ if (t == NULL)
+ {
+ rinfo->failed = TRUE;
+ return FALSE;
+ }
+
+ t->vn_bfd = h->verinfo.verdef->vd_bfd;
+ t->vn_nextref = elf_tdata (rinfo->output_bfd)->verref;
+ elf_tdata (rinfo->output_bfd)->verref = t;
+ }
+
+ amt = sizeof *a;
+ a = bfd_zalloc (rinfo->output_bfd, amt);
+
+ /* Note that we are copying a string pointer here, and testing it
+ above. If bfd_elf_string_from_elf_section is ever changed to
+ discard the string data when low in memory, this will have to be
+ fixed. */
+ a->vna_nodename = h->verinfo.verdef->vd_nodename;
+
+ a->vna_flags = h->verinfo.verdef->vd_flags;
+ a->vna_nextptr = t->vn_auxptr;
+
+ h->verinfo.verdef->vd_exp_refno = rinfo->vers;
+ ++rinfo->vers;
+
+ a->vna_other = h->verinfo.verdef->vd_exp_refno + 1;
+
+ t->vn_auxptr = a;
+
+ return TRUE;
+}
+
+/* Figure out appropriate versions for all the symbols. We may not
+ have the version number script until we have read all of the input
+ files, so until that point we don't know which symbols should be
+ local. This function is called via elf_link_hash_traverse. */
+
+bfd_boolean
+_bfd_elf_link_assign_sym_version (struct elf_link_hash_entry *h, void *data)
+{
+ struct elf_assign_sym_version_info *sinfo;
+ struct bfd_link_info *info;
+ const struct elf_backend_data *bed;
+ struct elf_info_failed eif;
+ char *p;
+ bfd_size_type amt;
+
+ sinfo = data;
+ info = sinfo->info;
+
+ if (h->root.type == bfd_link_hash_warning)
+ h = (struct elf_link_hash_entry *) h->root.u.i.link;
+
+ /* Fix the symbol flags. */
+ eif.failed = FALSE;
+ eif.info = info;
+ if (! _bfd_elf_fix_symbol_flags (h, &eif))
+ {
+ if (eif.failed)
+ sinfo->failed = TRUE;
+ return FALSE;
+ }
+
+ /* We only need version numbers for symbols defined in regular
+ objects. */
+ if ((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0)
+ return TRUE;
+
+ bed = get_elf_backend_data (sinfo->output_bfd);
+ p = strchr (h->root.root.string, ELF_VER_CHR);
+ if (p != NULL && h->verinfo.vertree == NULL)
+ {
+ struct bfd_elf_version_tree *t;
+ bfd_boolean hidden;
+
+ hidden = TRUE;
+
+ /* There are two consecutive ELF_VER_CHR characters if this is
+ not a hidden symbol. */
+ ++p;
+ if (*p == ELF_VER_CHR)
+ {
+ hidden = FALSE;
+ ++p;
+ }
+
+ /* If there is no version string, we can just return out. */
+ if (*p == '\0')
+ {
+ if (hidden)
+ h->elf_link_hash_flags |= ELF_LINK_HIDDEN;
+ return TRUE;
+ }
+
+ /* Look for the version. If we find it, it is no longer weak. */
+ for (t = sinfo->verdefs; t != NULL; t = t->next)
+ {
+ if (strcmp (t->name, p) == 0)
+ {
+ size_t len;
+ char *alc;
+ struct bfd_elf_version_expr *d;
+
+ len = p - h->root.root.string;
+ alc = bfd_malloc (len);
+ if (alc == NULL)
+ return FALSE;
+ memcpy (alc, h->root.root.string, len - 1);
+ alc[len - 1] = '\0';
+ if (alc[len - 2] == ELF_VER_CHR)
+ alc[len - 2] = '\0';
+
+ h->verinfo.vertree = t;
+ t->used = TRUE;
+ d = NULL;
+
+ if (t->globals.list != NULL)
+ d = (*t->match) (&t->globals, NULL, alc);
+
+ /* See if there is anything to force this symbol to
+ local scope. */
+ if (d == NULL && t->locals.list != NULL)
+ {
+ d = (*t->match) (&t->locals, NULL, alc);
+ if (d != NULL
+ && h->dynindx != -1
+ && info->shared
+ && ! info->export_dynamic)
+ (*bed->elf_backend_hide_symbol) (info, h, TRUE);
+ }
+
+ free (alc);
+ break;
+ }
+ }
+
+ /* If we are building an application, we need to create a
+ version node for this version. */
+ if (t == NULL && info->executable)
+ {
+ struct bfd_elf_version_tree **pp;
+ int version_index;
+
+ /* If we aren't going to export this symbol, we don't need
+ to worry about it. */
+ if (h->dynindx == -1)
+ return TRUE;
+
+ amt = sizeof *t;
+ t = bfd_zalloc (sinfo->output_bfd, amt);
+ if (t == NULL)
+ {
+ sinfo->failed = TRUE;
+ return FALSE;
+ }
+
+ t->name = p;
+ t->name_indx = (unsigned int) -1;
+ t->used = TRUE;
+
+ version_index = 1;
+ /* Don't count anonymous version tag. */
+ if (sinfo->verdefs != NULL && sinfo->verdefs->vernum == 0)
+ version_index = 0;
+ for (pp = &sinfo->verdefs; *pp != NULL; pp = &(*pp)->next)
+ ++version_index;
+ t->vernum = version_index;
+
+ *pp = t;
+
+ h->verinfo.vertree = t;
+ }
+ else if (t == NULL)
+ {
+ /* We could not find the version for a symbol when
+ generating a shared archive. Return an error. */
+ (*_bfd_error_handler)
+ (_("%s: undefined versioned symbol name %s"),
+ bfd_get_filename (sinfo->output_bfd), h->root.root.string);
+ bfd_set_error (bfd_error_bad_value);
+ sinfo->failed = TRUE;
+ return FALSE;
+ }
+
+ if (hidden)
+ h->elf_link_hash_flags |= ELF_LINK_HIDDEN;
+ }
+
+ /* If we don't have a version for this symbol, see if we can find
+ something. */
+ if (h->verinfo.vertree == NULL && sinfo->verdefs != NULL)
+ {
+ struct bfd_elf_version_tree *t;
+ struct bfd_elf_version_tree *local_ver;
+ struct bfd_elf_version_expr *d;
+
+ /* See if can find what version this symbol is in. If the
+ symbol is supposed to be local, then don't actually register
+ it. */
+ local_ver = NULL;
+ for (t = sinfo->verdefs; t != NULL; t = t->next)
+ {
+ if (t->globals.list != NULL)
+ {
+ bfd_boolean matched;
+
+ matched = FALSE;
+ d = NULL;
+ while ((d = (*t->match) (&t->globals, d,
+ h->root.root.string)) != NULL)
+ if (d->symver)
+ matched = TRUE;
+ else
+ {
+ /* There is a version without definition. Make
+ the symbol the default definition for this
+ version. */
+ h->verinfo.vertree = t;
+ local_ver = NULL;
+ d->script = 1;
+ break;
+ }
+ if (d != NULL)
+ break;
+ else if (matched)
+ /* There is no undefined version for this symbol. Hide the
+ default one. */
+ (*bed->elf_backend_hide_symbol) (info, h, TRUE);
+ }
+
+ if (t->locals.list != NULL)
+ {
+ d = NULL;
+ while ((d = (*t->match) (&t->locals, d,
+ h->root.root.string)) != NULL)
+ {
+ local_ver = t;
+ /* If the match is "*", keep looking for a more
+ explicit, perhaps even global, match.
+ XXX: Shouldn't this be !d->wildcard instead? */
+ if (d->pattern[0] != '*' || d->pattern[1] != '\0')
+ break;
+ }
+
+ if (d != NULL)
+ break;
+ }
+ }
+
+ if (local_ver != NULL)
+ {
+ h->verinfo.vertree = local_ver;
+ if (h->dynindx != -1
+ && info->shared
+ && ! info->export_dynamic)
+ {
+ (*bed->elf_backend_hide_symbol) (info, h, TRUE);
+ }
+ }
+ }
+
+ return TRUE;
+}
+
+/* Read and swap the relocs from the section indicated by SHDR. This
+ may be either a REL or a RELA section. The relocations are
+ translated into RELA relocations and stored in INTERNAL_RELOCS,
+ which should have already been allocated to contain enough space.
+ The EXTERNAL_RELOCS are a buffer where the external form of the
+ relocations should be stored.
+
+ Returns FALSE if something goes wrong. */
+
+static bfd_boolean
+elf_link_read_relocs_from_section (bfd *abfd,
+ asection *sec,
+ Elf_Internal_Shdr *shdr,
+ void *external_relocs,
+ Elf_Internal_Rela *internal_relocs)
+{
+ const struct elf_backend_data *bed;
+ void (*swap_in) (bfd *, const bfd_byte *, Elf_Internal_Rela *);
+ const bfd_byte *erela;
+ const bfd_byte *erelaend;
+ Elf_Internal_Rela *irela;
+ Elf_Internal_Shdr *symtab_hdr;
+ size_t nsyms;
+
+ /* Position ourselves at the start of the section. */
+ if (bfd_seek (abfd, shdr->sh_offset, SEEK_SET) != 0)
+ return FALSE;
+
+ /* Read the relocations. */
+ if (bfd_bread (external_relocs, shdr->sh_size, abfd) != shdr->sh_size)
+ return FALSE;
+
+ symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
+ nsyms = symtab_hdr->sh_size / symtab_hdr->sh_entsize;
+
+ bed = get_elf_backend_data (abfd);
+
+ /* Convert the external relocations to the internal format. */
+ if (shdr->sh_entsize == bed->s->sizeof_rel)
+ swap_in = bed->s->swap_reloc_in;
+ else if (shdr->sh_entsize == bed->s->sizeof_rela)
+ swap_in = bed->s->swap_reloca_in;
+ else
+ {
+ bfd_set_error (bfd_error_wrong_format);
+ return FALSE;
+ }
+
+ erela = external_relocs;
+ erelaend = erela + shdr->sh_size;
+ irela = internal_relocs;
+ while (erela < erelaend)
+ {
+ bfd_vma r_symndx;
+
+ (*swap_in) (abfd, erela, irela);
+ r_symndx = ELF32_R_SYM (irela->r_info);
+ if (bed->s->arch_size == 64)
+ r_symndx >>= 24;
+ if ((size_t) r_symndx >= nsyms)
+ {
+ (*_bfd_error_handler)
+ (_("%s: bad reloc symbol index (0x%lx >= 0x%lx) for offset 0x%lx in section `%s'"),
+ bfd_archive_filename (abfd), (unsigned long) r_symndx,
+ (unsigned long) nsyms, irela->r_offset, sec->name);
+ bfd_set_error (bfd_error_bad_value);
+ return FALSE;
+ }
+ irela += bed->s->int_rels_per_ext_rel;
+ erela += shdr->sh_entsize;
+ }
+
+ return TRUE;
+}
+
+/* Read and swap the relocs for a section O. They may have been
+ cached. If the EXTERNAL_RELOCS and INTERNAL_RELOCS arguments are
+ not NULL, they are used as buffers to read into. They are known to
+ be large enough. If the INTERNAL_RELOCS relocs argument is NULL,
+ the return value is allocated using either malloc or bfd_alloc,
+ according to the KEEP_MEMORY argument. If O has two relocation
+ sections (both REL and RELA relocations), then the REL_HDR
+ relocations will appear first in INTERNAL_RELOCS, followed by the
+ REL_HDR2 relocations. */
+
+Elf_Internal_Rela *
+_bfd_elf_link_read_relocs (bfd *abfd,
+ asection *o,
+ void *external_relocs,
+ Elf_Internal_Rela *internal_relocs,
+ bfd_boolean keep_memory)
+{
+ Elf_Internal_Shdr *rel_hdr;
+ void *alloc1 = NULL;
+ Elf_Internal_Rela *alloc2 = NULL;
+ const struct elf_backend_data *bed = get_elf_backend_data (abfd);
+
+ if (elf_section_data (o)->relocs != NULL)
+ return elf_section_data (o)->relocs;
+
+ if (o->reloc_count == 0)
+ return NULL;
+
+ rel_hdr = &elf_section_data (o)->rel_hdr;
+
+ if (internal_relocs == NULL)
+ {
+ bfd_size_type size;
+
+ size = o->reloc_count;
+ size *= bed->s->int_rels_per_ext_rel * sizeof (Elf_Internal_Rela);
+ if (keep_memory)
+ internal_relocs = bfd_alloc (abfd, size);
+ else
+ internal_relocs = alloc2 = bfd_malloc (size);
+ if (internal_relocs == NULL)
+ goto error_return;
+ }
+
+ if (external_relocs == NULL)
+ {
+ bfd_size_type size = rel_hdr->sh_size;
+
+ if (elf_section_data (o)->rel_hdr2)
+ size += elf_section_data (o)->rel_hdr2->sh_size;
+ alloc1 = bfd_malloc (size);
+ if (alloc1 == NULL)
+ goto error_return;
+ external_relocs = alloc1;
+ }
+
+ if (!elf_link_read_relocs_from_section (abfd, o, rel_hdr,
+ external_relocs,
+ internal_relocs))
+ goto error_return;
+ if (elf_section_data (o)->rel_hdr2
+ && (!elf_link_read_relocs_from_section
+ (abfd, o,
+ elf_section_data (o)->rel_hdr2,
+ ((bfd_byte *) external_relocs) + rel_hdr->sh_size,
+ internal_relocs + (NUM_SHDR_ENTRIES (rel_hdr)
+ * bed->s->int_rels_per_ext_rel))))
+ goto error_return;
+
+ /* Cache the results for next time, if we can. */
+ if (keep_memory)
+ elf_section_data (o)->relocs = internal_relocs;
+
+ if (alloc1 != NULL)
+ free (alloc1);
+
+ /* Don't free alloc2, since if it was allocated we are passing it
+ back (under the name of internal_relocs). */
+
+ return internal_relocs;
+
+ error_return:
+ if (alloc1 != NULL)
+ free (alloc1);
+ if (alloc2 != NULL)
+ free (alloc2);
+ return NULL;
+}
+
+/* Compute the size of, and allocate space for, REL_HDR which is the
+ section header for a section containing relocations for O. */
+
+bfd_boolean
+_bfd_elf_link_size_reloc_section (bfd *abfd,
+ Elf_Internal_Shdr *rel_hdr,
+ asection *o)
+{
+ bfd_size_type reloc_count;
+ bfd_size_type num_rel_hashes;
+
+ /* Figure out how many relocations there will be. */
+ if (rel_hdr == &elf_section_data (o)->rel_hdr)
+ reloc_count = elf_section_data (o)->rel_count;
+ else
+ reloc_count = elf_section_data (o)->rel_count2;
+
+ num_rel_hashes = o->reloc_count;
+ if (num_rel_hashes < reloc_count)
+ num_rel_hashes = reloc_count;
+
+ /* That allows us to calculate the size of the section. */
+ rel_hdr->sh_size = rel_hdr->sh_entsize * reloc_count;
+
+ /* The contents field must last into write_object_contents, so we
+ allocate it with bfd_alloc rather than malloc. Also since we
+ cannot be sure that the contents will actually be filled in,
+ we zero the allocated space. */
+ rel_hdr->contents = bfd_zalloc (abfd, rel_hdr->sh_size);
+ if (rel_hdr->contents == NULL && rel_hdr->sh_size != 0)
+ return FALSE;
+
+ /* We only allocate one set of hash entries, so we only do it the
+ first time we are called. */
+ if (elf_section_data (o)->rel_hashes == NULL
+ && num_rel_hashes)
+ {
+ struct elf_link_hash_entry **p;
+
+ p = bfd_zmalloc (num_rel_hashes * sizeof (struct elf_link_hash_entry *));
+ if (p == NULL)
+ return FALSE;
+
+ elf_section_data (o)->rel_hashes = p;
+ }
+
+ return TRUE;
+}
+
+/* Copy the relocations indicated by the INTERNAL_RELOCS (which
+ originated from the section given by INPUT_REL_HDR) to the
+ OUTPUT_BFD. */
+
+bfd_boolean
+_bfd_elf_link_output_relocs (bfd *output_bfd,
+ asection *input_section,
+ Elf_Internal_Shdr *input_rel_hdr,
+ Elf_Internal_Rela *internal_relocs)
+{
+ Elf_Internal_Rela *irela;
+ Elf_Internal_Rela *irelaend;
+ bfd_byte *erel;
+ Elf_Internal_Shdr *output_rel_hdr;
+ asection *output_section;
+ unsigned int *rel_countp = NULL;
+ const struct elf_backend_data *bed;
+ void (*swap_out) (bfd *, const Elf_Internal_Rela *, bfd_byte *);
+
+ output_section = input_section->output_section;
+ output_rel_hdr = NULL;
+
+ if (elf_section_data (output_section)->rel_hdr.sh_entsize
+ == input_rel_hdr->sh_entsize)
+ {
+ output_rel_hdr = &elf_section_data (output_section)->rel_hdr;
+ rel_countp = &elf_section_data (output_section)->rel_count;
+ }
+ else if (elf_section_data (output_section)->rel_hdr2
+ && (elf_section_data (output_section)->rel_hdr2->sh_entsize
+ == input_rel_hdr->sh_entsize))
+ {
+ output_rel_hdr = elf_section_data (output_section)->rel_hdr2;
+ rel_countp = &elf_section_data (output_section)->rel_count2;
+ }
+ else
+ {
+ (*_bfd_error_handler)
+ (_("%s: relocation size mismatch in %s section %s"),
+ bfd_get_filename (output_bfd),
+ bfd_archive_filename (input_section->owner),
+ input_section->name);
+ bfd_set_error (bfd_error_wrong_object_format);
+ return FALSE;
+ }
+
+ bed = get_elf_backend_data (output_bfd);
+ if (input_rel_hdr->sh_entsize == bed->s->sizeof_rel)
+ swap_out = bed->s->swap_reloc_out;
+ else if (input_rel_hdr->sh_entsize == bed->s->sizeof_rela)
+ swap_out = bed->s->swap_reloca_out;
+ else
+ abort ();
+
+ erel = output_rel_hdr->contents;
+ erel += *rel_countp * input_rel_hdr->sh_entsize;
+ irela = internal_relocs;
+ irelaend = irela + (NUM_SHDR_ENTRIES (input_rel_hdr)
+ * bed->s->int_rels_per_ext_rel);
+ while (irela < irelaend)
+ {
+ (*swap_out) (output_bfd, irela, erel);
+ irela += bed->s->int_rels_per_ext_rel;
+ erel += input_rel_hdr->sh_entsize;
+ }
+
+ /* Bump the counter, so that we know where to add the next set of
+ relocations. */
+ *rel_countp += NUM_SHDR_ENTRIES (input_rel_hdr);
+
+ return TRUE;
+}
-/* Create a special linker section, or return a pointer to a linker
- section already created */
+/* 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. */
-elf_linker_section_t *
-_bfd_elf_create_linker_section (abfd, info, which, defaults)
- bfd *abfd;
- struct bfd_link_info *info;
- enum elf_linker_section_enum which;
- elf_linker_section_t *defaults;
+bfd_boolean
+_bfd_elf_fix_symbol_flags (struct elf_link_hash_entry *h,
+ struct elf_info_failed *eif)
{
- bfd *dynobj = elf_hash_table (info)->dynobj;
- elf_linker_section_t *lsect;
+ /* If this symbol was mentioned in a non-ELF file, try to set
+ DEF_REGULAR and REF_REGULAR correctly. This is the only way to
+ permit a non-ELF file to correctly refer to a symbol defined in
+ an ELF dynamic object. */
+ if ((h->elf_link_hash_flags & ELF_LINK_NON_ELF) != 0)
+ {
+ while (h->root.type == bfd_link_hash_indirect)
+ h = (struct elf_link_hash_entry *) h->root.u.i.link;
+
+ if (h->root.type != bfd_link_hash_defined
+ && h->root.type != bfd_link_hash_defweak)
+ h->elf_link_hash_flags |= (ELF_LINK_HASH_REF_REGULAR
+ | ELF_LINK_HASH_REF_REGULAR_NONWEAK);
+ else
+ {
+ if (h->root.u.def.section->owner != NULL
+ && (bfd_get_flavour (h->root.u.def.section->owner)
+ == bfd_target_elf_flavour))
+ h->elf_link_hash_flags |= (ELF_LINK_HASH_REF_REGULAR
+ | ELF_LINK_HASH_REF_REGULAR_NONWEAK);
+ else
+ h->elf_link_hash_flags |= ELF_LINK_HASH_DEF_REGULAR;
+ }
+
+ if (h->dynindx == -1
+ && ((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) != 0
+ || (h->elf_link_hash_flags & ELF_LINK_HASH_REF_DYNAMIC) != 0))
+ {
+ if (! bfd_elf_link_record_dynamic_symbol (eif->info, h))
+ {
+ eif->failed = TRUE;
+ return FALSE;
+ }
+ }
+ }
+ else
+ {
+ /* Unfortunately, ELF_LINK_NON_ELF is only correct if the symbol
+ was first seen in a non-ELF file. Fortunately, if the symbol
+ was first seen in an ELF file, we're probably OK unless the
+ symbol was defined in a non-ELF file. Catch that case here.
+ FIXME: We're still in trouble if the symbol was first seen in
+ a dynamic object, and then later in a non-ELF regular object. */
+ if ((h->root.type == bfd_link_hash_defined
+ || h->root.type == bfd_link_hash_defweak)
+ && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0
+ && (h->root.u.def.section->owner != NULL
+ ? (bfd_get_flavour (h->root.u.def.section->owner)
+ != bfd_target_elf_flavour)
+ : (bfd_is_abs_section (h->root.u.def.section)
+ && (h->elf_link_hash_flags
+ & ELF_LINK_HASH_DEF_DYNAMIC) == 0)))
+ h->elf_link_hash_flags |= ELF_LINK_HASH_DEF_REGULAR;
+ }
+
+ /* If this is a final link, and the symbol was defined as a common
+ symbol in a regular object file, and there was no definition in
+ any dynamic object, then the linker will have allocated space for
+ the symbol in a common section but the ELF_LINK_HASH_DEF_REGULAR
+ flag will not have been set. */
+ if (h->root.type == bfd_link_hash_defined
+ && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0
+ && (h->elf_link_hash_flags & ELF_LINK_HASH_REF_REGULAR) != 0
+ && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) == 0
+ && (h->root.u.def.section->owner->flags & DYNAMIC) == 0)
+ h->elf_link_hash_flags |= ELF_LINK_HASH_DEF_REGULAR;
+
+ /* If -Bsymbolic was used (which means to bind references to global
+ symbols to the definition within the shared object), and this
+ symbol was defined in a regular object, then it actually doesn't
+ need a PLT entry. Likewise, if the symbol has non-default
+ visibility. If the symbol has hidden or internal visibility, we
+ will force it local. */
+ if ((h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT) != 0
+ && eif->info->shared
+ && is_elf_hash_table (eif->info->hash)
+ && (eif->info->symbolic
+ || ELF_ST_VISIBILITY (h->other) != STV_DEFAULT)
+ && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) != 0)
+ {
+ const struct elf_backend_data *bed;
+ bfd_boolean force_local;
+
+ bed = get_elf_backend_data (elf_hash_table (eif->info)->dynobj);
- /* Record the first bfd section that needs the special section */
- if (!dynobj)
- dynobj = elf_hash_table (info)->dynobj = abfd;
+ 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 the first time, create the section */
- lsect = elf_linker_section (dynobj, which);
- if (!lsect)
+ /* If a weak undefined symbol has non-default visibility, we also
+ hide it from the dynamic linker. */
+ if (ELF_ST_VISIBILITY (h->other) != STV_DEFAULT
+ && h->root.type == bfd_link_hash_undefweak)
+ {
+ const struct elf_backend_data *bed;
+ bed = get_elf_backend_data (elf_hash_table (eif->info)->dynobj);
+ (*bed->elf_backend_hide_symbol) (eif->info, h, TRUE);
+ }
+
+ /* If this is a weak defined symbol in a dynamic object, and we know
+ the real definition in the dynamic object, copy interesting flags
+ over to the real definition. */
+ if (h->weakdef != NULL)
+ {
+ struct elf_link_hash_entry *weakdef;
+
+ weakdef = h->weakdef;
+ if (h->root.type == bfd_link_hash_indirect)
+ h = (struct elf_link_hash_entry *) h->root.u.i.link;
+
+ BFD_ASSERT (h->root.type == bfd_link_hash_defined
+ || h->root.type == bfd_link_hash_defweak);
+ BFD_ASSERT (weakdef->root.type == bfd_link_hash_defined
+ || weakdef->root.type == bfd_link_hash_defweak);
+ BFD_ASSERT (weakdef->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC);
+
+ /* If the real definition is defined by a regular object file,
+ don't do anything special. See the longer description in
+ _bfd_elf_adjust_dynamic_symbol, below. */
+ if ((weakdef->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) != 0)
+ h->weakdef = NULL;
+ else
+ {
+ const struct elf_backend_data *bed;
+
+ bed = get_elf_backend_data (elf_hash_table (eif->info)->dynobj);
+ (*bed->elf_backend_copy_indirect_symbol) (bed, weakdef, h);
+ }
+ }
+
+ return TRUE;
+}
+
+/* Make the backend pick a good value for a dynamic symbol. This is
+ called via elf_link_hash_traverse, and also calls itself
+ recursively. */
+
+bfd_boolean
+_bfd_elf_adjust_dynamic_symbol (struct elf_link_hash_entry *h, void *data)
+{
+ struct elf_info_failed *eif = data;
+ bfd *dynobj;
+ const struct elf_backend_data *bed;
+
+ if (! is_elf_hash_table (eif->info->hash))
+ return FALSE;
+
+ if (h->root.type == bfd_link_hash_warning)
+ {
+ h->plt = elf_hash_table (eif->info)->init_offset;
+ h->got = elf_hash_table (eif->info)->init_offset;
+
+ /* When warning symbols are created, they **replace** the "real"
+ entry in the hash table, thus we never get to see the real
+ symbol in a hash traversal. So look at it now. */
+ h = (struct elf_link_hash_entry *) h->root.u.i.link;
+ }
+
+ /* Ignore indirect symbols. These are added by the versioning code. */
+ if (h->root.type == bfd_link_hash_indirect)
+ return TRUE;
+
+ /* Fix the symbol flags. */
+ if (! _bfd_elf_fix_symbol_flags (h, eif))
+ return FALSE;
+
+ /* If this symbol does not require a PLT entry, and it is not
+ defined by a dynamic object, or is not referenced by a regular
+ object, ignore it. We do have to handle a weak defined symbol,
+ even if no regular object refers to it, if we decided to add it
+ to the dynamic symbol table. FIXME: Do we normally need to worry
+ about symbols which are defined by one dynamic object and
+ referenced by another one? */
+ if ((h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT) == 0
+ && ((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) != 0
+ || (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) == 0
+ || ((h->elf_link_hash_flags & ELF_LINK_HASH_REF_REGULAR) == 0
+ && (h->weakdef == NULL || h->weakdef->dynindx == -1))))
+ {
+ h->plt = elf_hash_table (eif->info)->init_offset;
+ return TRUE;
+ }
+
+ /* If we've already adjusted this symbol, don't do it again. This
+ can happen via a recursive call. */
+ if ((h->elf_link_hash_flags & ELF_LINK_HASH_DYNAMIC_ADJUSTED) != 0)
+ return TRUE;
+
+ /* Don't look at this symbol again. Note that we must set this
+ after checking the above conditions, because we may look at a
+ symbol once, decide not to do anything, and then get called
+ recursively later after REF_REGULAR is set below. */
+ h->elf_link_hash_flags |= ELF_LINK_HASH_DYNAMIC_ADJUSTED;
+
+ /* If this is a weak definition, and we know a real definition, and
+ the real symbol is not itself defined by a regular object file,
+ then get a good value for the real definition. We handle the
+ real symbol first, for the convenience of the backend routine.
+
+ Note that there is a confusing case here. If the real definition
+ is defined by a regular object file, we don't get the real symbol
+ from the dynamic object, but we do get the weak symbol. If the
+ processor backend uses a COPY reloc, then if some routine in the
+ dynamic object changes the real symbol, we will not see that
+ change in the corresponding weak symbol. This is the way other
+ ELF linkers work as well, and seems to be a result of the shared
+ library model.
+
+ I will clarify this issue. Most SVR4 shared libraries define the
+ variable _timezone and define timezone as a weak synonym. The
+ tzset call changes _timezone. If you write
+ extern int timezone;
+ int _timezone = 5;
+ int main () { tzset (); printf ("%d %d\n", timezone, _timezone); }
+ you might expect that, since timezone is a synonym for _timezone,
+ the same number will print both times. However, if the processor
+ backend uses a COPY reloc, then actually timezone will be copied
+ into your process image, and, since you define _timezone
+ yourself, _timezone will not. Thus timezone and _timezone will
+ wind up at different memory locations. The tzset call will set
+ _timezone, leaving timezone unchanged. */
+
+ if (h->weakdef != NULL)
+ {
+ /* If we get to this point, we know there is an implicit
+ reference by a regular object file via the weak symbol H.
+ FIXME: Is this really true? What if the traversal finds
+ H->WEAKDEF before it finds H? */
+ h->weakdef->elf_link_hash_flags |= ELF_LINK_HASH_REF_REGULAR;
+
+ if (! _bfd_elf_adjust_dynamic_symbol (h->weakdef, eif))
+ return FALSE;
+ }
+
+ /* If a symbol has no type and no size and does not require a PLT
+ entry, then we are probably about to do the wrong thing here: we
+ are probably going to create a COPY reloc for an empty object.
+ This case can arise when a shared object is built with assembly
+ code, and the assembly code fails to set the symbol type. */
+ if (h->size == 0
+ && h->type == STT_NOTYPE
+ && (h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT) == 0)
+ (*_bfd_error_handler)
+ (_("warning: type and size of dynamic symbol `%s' are not defined"),
+ h->root.root.string);
+
+ dynobj = elf_hash_table (eif->info)->dynobj;
+ bed = get_elf_backend_data (dynobj);
+ if (! (*bed->elf_backend_adjust_dynamic_symbol) (eif->info, h))
+ {
+ eif->failed = TRUE;
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+/* Adjust all external symbols pointing into SEC_MERGE sections
+ to reflect the object merging within the sections. */
+
+bfd_boolean
+_bfd_elf_link_sec_merge_syms (struct elf_link_hash_entry *h, void *data)
+{
+ asection *sec;
+
+ if (h->root.type == bfd_link_hash_warning)
+ h = (struct elf_link_hash_entry *) h->root.u.i.link;
+
+ if ((h->root.type == bfd_link_hash_defined
+ || h->root.type == bfd_link_hash_defweak)
+ && ((sec = h->root.u.def.section)->flags & SEC_MERGE)
+ && sec->sec_info_type == ELF_INFO_TYPE_MERGE)
+ {
+ bfd *output_bfd = data;
+
+ h->root.u.def.value =
+ _bfd_merged_section_offset (output_bfd,
+ &h->root.u.def.section,
+ elf_section_data (sec)->sec_info,
+ h->root.u.def.value, 0);
+ }
+
+ return TRUE;
+}
+
+/* Returns false if the symbol referred to by H should be considered
+ to resolve local to the current module, and true if it should be
+ considered to bind dynamically. */
+
+bfd_boolean
+_bfd_elf_dynamic_symbol_p (struct elf_link_hash_entry *h,
+ struct bfd_link_info *info,
+ bfd_boolean ignore_protected)
+{
+ bfd_boolean binding_stays_local_p;
+
+ if (h == NULL)
+ return FALSE;
+
+ while (h->root.type == bfd_link_hash_indirect
+ || h->root.type == bfd_link_hash_warning)
+ h = (struct elf_link_hash_entry *) h->root.u.i.link;
+
+ /* If it was forced local, then clearly it's not dynamic. */
+ if (h->dynindx == -1)
+ return FALSE;
+ if (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL)
+ return FALSE;
+
+ /* Identify the cases where name binding rules say that a
+ visible symbol resolves locally. */
+ binding_stays_local_p = info->executable || info->symbolic;
+
+ switch (ELF_ST_VISIBILITY (h->other))
+ {
+ case STV_INTERNAL:
+ case STV_HIDDEN:
+ return FALSE;
+
+ case STV_PROTECTED:
+ /* Proper resolution for function pointer equality may require
+ that these symbols perhaps be resolved dynamically, even though
+ we should be resolving them to the current module. */
+ if (!ignore_protected)
+ binding_stays_local_p = TRUE;
+ break;
+
+ default:
+ break;
+ }
+
+ /* If it isn't defined locally, then clearly it's dynamic. */
+ if ((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0)
+ return TRUE;
+
+ /* Otherwise, the symbol is dynamic if binding rules don't tell
+ us that it remains local. */
+ return !binding_stays_local_p;
+}
+
+/* Return true if the symbol referred to by H should be considered
+ to resolve local to the current module, and false otherwise. Differs
+ from (the inverse of) _bfd_elf_dynamic_symbol_p in the treatment of
+ undefined symbols and weak symbols. */
+
+bfd_boolean
+_bfd_elf_symbol_refs_local_p (struct elf_link_hash_entry *h,
+ struct bfd_link_info *info,
+ bfd_boolean local_protected)
+{
+ /* If it's a local sym, of course we resolve locally. */
+ if (h == NULL)
+ return TRUE;
+
+ /* If we don't have a definition in a regular file, then we can't
+ resolve locally. The sym is either undefined or dynamic. */
+ if ((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0)
+ return FALSE;
+
+ /* Forced local symbols resolve locally. */
+ if ((h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) != 0)
+ return TRUE;
+
+ /* As do non-dynamic symbols. */
+ if (h->dynindx == -1)
+ return TRUE;
+
+ /* At this point, we know the symbol is defined and dynamic. In an
+ executable it must resolve locally, likewise when building symbolic
+ shared libraries. */
+ if (info->executable || info->symbolic)
+ return TRUE;
+
+ /* Now deal with defined dynamic symbols in shared libraries. Ones
+ with default visibility might not resolve locally. */
+ if (ELF_ST_VISIBILITY (h->other) == STV_DEFAULT)
+ return FALSE;
+
+ /* However, STV_HIDDEN or STV_INTERNAL ones must be local. */
+ if (ELF_ST_VISIBILITY (h->other) != STV_PROTECTED)
+ return TRUE;
+
+ /* Function pointer equality tests may require that STV_PROTECTED
+ symbols be treated as dynamic symbols, even when we know that the
+ dynamic linker will resolve them locally. */
+ return local_protected;
+}
+
+/* Caches some TLS segment info, and ensures that the TLS segment vma is
+ aligned. Returns the first TLS output section. */
+
+struct bfd_section *
+_bfd_elf_tls_setup (bfd *obfd, struct bfd_link_info *info)
+{
+ struct bfd_section *sec, *tls;
+ unsigned int align = 0;
+
+ for (sec = obfd->sections; sec != NULL; sec = sec->next)
+ if ((sec->flags & SEC_THREAD_LOCAL) != 0)
+ break;
+ tls = sec;
+
+ for (; sec != NULL && (sec->flags & SEC_THREAD_LOCAL) != 0; sec = sec->next)
+ if (sec->alignment_power > align)
+ align = sec->alignment_power;
+
+ elf_hash_table (info)->tls_sec = tls;
+
+ /* Ensure the alignment of the first section is the largest alignment,
+ so that the tls segment starts aligned. */
+ if (tls != NULL)
+ tls->alignment_power = align;
+
+ return tls;
+}
+
+/* Return TRUE iff this is a non-common, definition of a non-function symbol. */
+static bfd_boolean
+is_global_data_symbol_definition (bfd *abfd ATTRIBUTE_UNUSED,
+ Elf_Internal_Sym *sym)
+{
+ /* Local symbols do not count, but target specific ones might. */
+ if (ELF_ST_BIND (sym->st_info) != STB_GLOBAL
+ && ELF_ST_BIND (sym->st_info) < STB_LOOS)
+ return FALSE;
+
+ /* Function symbols do not count. */
+ if (ELF_ST_TYPE (sym->st_info) == STT_FUNC)
+ return FALSE;
+
+ /* If the section is undefined, then so is the symbol. */
+ if (sym->st_shndx == SHN_UNDEF)
+ return FALSE;
+
+ /* If the symbol is defined in the common section, then
+ it is a common definition and so does not count. */
+ if (sym->st_shndx == SHN_COMMON)
+ return FALSE;
+
+ /* If the symbol is in a target specific section then we
+ must rely upon the backend to tell us what it is. */
+ if (sym->st_shndx >= SHN_LORESERVE && sym->st_shndx < SHN_ABS)
+ /* FIXME - this function is not coded yet:
+
+ return _bfd_is_global_symbol_definition (abfd, sym);
+
+ Instead for now assume that the definition is not global,
+ Even if this is wrong, at least the linker will behave
+ in the same way that it used to do. */
+ return FALSE;
+
+ return TRUE;
+}
+
+/* Search the symbol table of the archive element of the archive ABFD
+ whose archive map contains a mention of SYMDEF, and determine if
+ the symbol is defined in this element. */
+static bfd_boolean
+elf_link_is_defined_archive_symbol (bfd * abfd, carsym * symdef)
+{
+ Elf_Internal_Shdr * hdr;
+ bfd_size_type symcount;
+ bfd_size_type extsymcount;
+ bfd_size_type extsymoff;
+ Elf_Internal_Sym *isymbuf;
+ Elf_Internal_Sym *isym;
+ Elf_Internal_Sym *isymend;
+ bfd_boolean result;
+
+ abfd = _bfd_get_elt_at_filepos (abfd, symdef->file_offset);
+ if (abfd == NULL)
+ return FALSE;
+
+ if (! bfd_check_format (abfd, bfd_object))
+ return FALSE;
+
+ /* If we have already included the element containing this symbol in the
+ link then we do not need to include it again. Just claim that any symbol
+ it contains is not a definition, so that our caller will not decide to
+ (re)include this element. */
+ if (abfd->archive_pass)
+ return FALSE;
+
+ /* Select the appropriate symbol table. */
+ if ((abfd->flags & DYNAMIC) == 0 || elf_dynsymtab (abfd) == 0)
+ hdr = &elf_tdata (abfd)->symtab_hdr;
+ else
+ hdr = &elf_tdata (abfd)->dynsymtab_hdr;
+
+ symcount = hdr->sh_size / get_elf_backend_data (abfd)->s->sizeof_sym;
+
+ /* The sh_info field of the symtab header tells us where the
+ external symbols start. We don't care about the local symbols. */
+ if (elf_bad_symtab (abfd))
+ {
+ extsymcount = symcount;
+ extsymoff = 0;
+ }
+ else
+ {
+ extsymcount = symcount - hdr->sh_info;
+ extsymoff = hdr->sh_info;
+ }
+
+ if (extsymcount == 0)
+ return FALSE;
+
+ /* Read in the symbol table. */
+ isymbuf = bfd_elf_get_elf_syms (abfd, hdr, extsymcount, extsymoff,
+ NULL, NULL, NULL);
+ if (isymbuf == NULL)
+ return FALSE;
+
+ /* Scan the symbol table looking for SYMDEF. */
+ result = FALSE;
+ for (isym = isymbuf, isymend = isymbuf + extsymcount; isym < isymend; isym++)
+ {
+ const char *name;
+
+ name = bfd_elf_string_from_elf_section (abfd, hdr->sh_link,
+ isym->st_name);
+ if (name == NULL)
+ break;
+
+ if (strcmp (name, symdef->name) == 0)
+ {
+ result = is_global_data_symbol_definition (abfd, isym);
+ break;
+ }
+ }
+
+ free (isymbuf);
+
+ return result;
+}
+
+/* Add an entry to the .dynamic table. */
+
+bfd_boolean
+_bfd_elf_add_dynamic_entry (struct bfd_link_info *info,
+ bfd_vma tag,
+ bfd_vma val)
+{
+ struct elf_link_hash_table *hash_table;
+ const struct elf_backend_data *bed;
+ asection *s;
+ bfd_size_type newsize;
+ bfd_byte *newcontents;
+ Elf_Internal_Dyn dyn;
+
+ hash_table = elf_hash_table (info);
+ if (! is_elf_hash_table (hash_table))
+ return FALSE;
+
+ bed = get_elf_backend_data (hash_table->dynobj);
+ s = bfd_get_section_by_name (hash_table->dynobj, ".dynamic");
+ BFD_ASSERT (s != NULL);
+
+ newsize = s->_raw_size + bed->s->sizeof_dyn;
+ newcontents = bfd_realloc (s->contents, newsize);
+ if (newcontents == NULL)
+ return FALSE;
+
+ dyn.d_tag = tag;
+ dyn.d_un.d_val = val;
+ bed->s->swap_dyn_out (hash_table->dynobj, &dyn, newcontents + s->_raw_size);
+
+ s->_raw_size = newsize;
+ s->contents = newcontents;
+
+ return TRUE;
+}
+
+/* Add a DT_NEEDED entry for this dynamic object if DO_IT is true,
+ otherwise just check whether one already exists. Returns -1 on error,
+ 1 if a DT_NEEDED tag already exists, and 0 on success. */
+
+static int
+elf_add_dt_needed_tag (struct bfd_link_info *info,
+ const char *soname,
+ bfd_boolean do_it)
+{
+ struct elf_link_hash_table *hash_table;
+ bfd_size_type oldsize;
+ bfd_size_type strindex;
+
+ hash_table = elf_hash_table (info);
+ oldsize = _bfd_elf_strtab_size (hash_table->dynstr);
+ strindex = _bfd_elf_strtab_add (hash_table->dynstr, soname, FALSE);
+ if (strindex == (bfd_size_type) -1)
+ return -1;
+
+ if (oldsize == _bfd_elf_strtab_size (hash_table->dynstr))
+ {
+ asection *sdyn;
+ const struct elf_backend_data *bed;
+ bfd_byte *extdyn;
+
+ bed = get_elf_backend_data (hash_table->dynobj);
+ sdyn = bfd_get_section_by_name (hash_table->dynobj, ".dynamic");
+ BFD_ASSERT (sdyn != NULL);
+
+ for (extdyn = sdyn->contents;
+ extdyn < sdyn->contents + sdyn->_raw_size;
+ extdyn += bed->s->sizeof_dyn)
+ {
+ Elf_Internal_Dyn dyn;
+
+ bed->s->swap_dyn_in (hash_table->dynobj, extdyn, &dyn);
+ if (dyn.d_tag == DT_NEEDED
+ && dyn.d_un.d_val == strindex)
+ {
+ _bfd_elf_strtab_delref (hash_table->dynstr, strindex);
+ return 1;
+ }
+ }
+ }
+
+ if (do_it)
+ {
+ if (!_bfd_elf_add_dynamic_entry (info, DT_NEEDED, strindex))
+ return -1;
+ }
+ else
+ /* We were just checking for existence of the tag. */
+ _bfd_elf_strtab_delref (hash_table->dynstr, strindex);
+
+ return 0;
+}
+
+/* Sort symbol by value and section. */
+static int
+elf_sort_symbol (const void *arg1, const void *arg2)
+{
+ const struct elf_link_hash_entry *h1;
+ const struct elf_link_hash_entry *h2;
+ bfd_signed_vma vdiff;
+
+ h1 = *(const struct elf_link_hash_entry **) arg1;
+ h2 = *(const struct elf_link_hash_entry **) arg2;
+ vdiff = h1->root.u.def.value - h2->root.u.def.value;
+ if (vdiff != 0)
+ return vdiff > 0 ? 1 : -1;
+ else
+ {
+ long sdiff = h1->root.u.def.section - h2->root.u.def.section;
+ if (sdiff != 0)
+ return sdiff > 0 ? 1 : -1;
+ }
+ return 0;
+}
+
+/* This function is used to adjust offsets into .dynstr for
+ dynamic symbols. This is called via elf_link_hash_traverse. */
+
+static bfd_boolean
+elf_adjust_dynstr_offsets (struct elf_link_hash_entry *h, void *data)
+{
+ struct elf_strtab_hash *dynstr = data;
+
+ if (h->root.type == bfd_link_hash_warning)
+ h = (struct elf_link_hash_entry *) h->root.u.i.link;
+
+ if (h->dynindx != -1)
+ h->dynstr_index = _bfd_elf_strtab_offset (dynstr, h->dynstr_index);
+ return TRUE;
+}
+
+/* Assign string offsets in .dynstr, update all structures referencing
+ them. */
+
+static bfd_boolean
+elf_finalize_dynstr (bfd *output_bfd, struct bfd_link_info *info)
+{
+ struct elf_link_hash_table *hash_table = elf_hash_table (info);
+ struct elf_link_local_dynamic_entry *entry;
+ struct elf_strtab_hash *dynstr = hash_table->dynstr;
+ bfd *dynobj = hash_table->dynobj;
+ asection *sdyn;
+ bfd_size_type size;
+ const struct elf_backend_data *bed;
+ bfd_byte *extdyn;
+
+ _bfd_elf_strtab_finalize (dynstr);
+ size = _bfd_elf_strtab_size (dynstr);
+
+ bed = get_elf_backend_data (dynobj);
+ sdyn = bfd_get_section_by_name (dynobj, ".dynamic");
+ BFD_ASSERT (sdyn != NULL);
+
+ /* Update all .dynamic entries referencing .dynstr strings. */
+ for (extdyn = sdyn->contents;
+ extdyn < sdyn->contents + sdyn->_raw_size;
+ extdyn += bed->s->sizeof_dyn)
+ {
+ Elf_Internal_Dyn dyn;
+
+ bed->s->swap_dyn_in (dynobj, extdyn, &dyn);
+ switch (dyn.d_tag)
+ {
+ case DT_STRSZ:
+ dyn.d_un.d_val = size;
+ break;
+ case DT_NEEDED:
+ case DT_SONAME:
+ case DT_RPATH:
+ case DT_RUNPATH:
+ case DT_FILTER:
+ case DT_AUXILIARY:
+ dyn.d_un.d_val = _bfd_elf_strtab_offset (dynstr, dyn.d_un.d_val);
+ break;
+ default:
+ continue;
+ }
+ bed->s->swap_dyn_out (dynobj, &dyn, extdyn);
+ }
+
+ /* Now update local dynamic symbols. */
+ for (entry = hash_table->dynlocal; entry ; entry = entry->next)
+ entry->isym.st_name = _bfd_elf_strtab_offset (dynstr,
+ entry->isym.st_name);
+
+ /* And the rest of dynamic symbols. */
+ elf_link_hash_traverse (hash_table, elf_adjust_dynstr_offsets, dynstr);
+
+ /* Adjust version definitions. */
+ if (elf_tdata (output_bfd)->cverdefs)
{
asection *s;
- bfd_size_type amt = sizeof (elf_linker_section_t);
+ bfd_byte *p;
+ bfd_size_type i;
+ Elf_Internal_Verdef def;
+ Elf_Internal_Verdaux defaux;
- lsect = (elf_linker_section_t *) bfd_alloc (dynobj, amt);
+ s = bfd_get_section_by_name (dynobj, ".gnu.version_d");
+ p = s->contents;
+ do
+ {
+ _bfd_elf_swap_verdef_in (output_bfd, (Elf_External_Verdef *) p,
+ &def);
+ p += sizeof (Elf_External_Verdef);
+ for (i = 0; i < def.vd_cnt; ++i)
+ {
+ _bfd_elf_swap_verdaux_in (output_bfd,
+ (Elf_External_Verdaux *) p, &defaux);
+ defaux.vda_name = _bfd_elf_strtab_offset (dynstr,
+ defaux.vda_name);
+ _bfd_elf_swap_verdaux_out (output_bfd,
+ &defaux, (Elf_External_Verdaux *) p);
+ p += sizeof (Elf_External_Verdaux);
+ }
+ }
+ while (def.vd_next);
+ }
- *lsect = *defaults;
- elf_linker_section (dynobj, which) = lsect;
- lsect->which = which;
- lsect->hole_written_p = false;
+ /* 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;
- /* See if the sections already exist */
- lsect->section = s = bfd_get_section_by_name (dynobj, lsect->name);
- if (!s || (s->flags & defaults->flags) != defaults->flags)
+ s = bfd_get_section_by_name (dynobj, ".gnu.version_r");
+ p = s->contents;
+ do
{
- lsect->section = s = bfd_make_section_anyway (dynobj, lsect->name);
+ _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);
+ }
- if (s == NULL)
- return (elf_linker_section_t *)0;
+ return TRUE;
+}
+
+/* Add symbols from an ELF object file to the linker hash table. */
- bfd_set_section_flags (dynobj, s, defaults->flags);
- bfd_set_section_alignment (dynobj, s, lsect->alignment);
+static bfd_boolean
+elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info)
+{
+ bfd_boolean (*add_symbol_hook)
+ (bfd *, struct bfd_link_info *, Elf_Internal_Sym *,
+ const char **, flagword *, asection **, bfd_vma *);
+ bfd_boolean (*check_relocs)
+ (bfd *, struct bfd_link_info *, asection *, const Elf_Internal_Rela *);
+ bfd_boolean collect;
+ Elf_Internal_Shdr *hdr;
+ bfd_size_type symcount;
+ bfd_size_type extsymcount;
+ bfd_size_type extsymoff;
+ struct elf_link_hash_entry **sym_hash;
+ bfd_boolean dynamic;
+ Elf_External_Versym *extversym = NULL;
+ Elf_External_Versym *ever;
+ struct elf_link_hash_entry *weaks;
+ struct elf_link_hash_entry **nondeflt_vers = NULL;
+ bfd_size_type nondeflt_vers_cnt = 0;
+ Elf_Internal_Sym *isymbuf = NULL;
+ Elf_Internal_Sym *isym;
+ Elf_Internal_Sym *isymend;
+ const struct elf_backend_data *bed;
+ bfd_boolean add_needed;
+ struct elf_link_hash_table * hash_table;
+ bfd_size_type amt;
+
+ hash_table = elf_hash_table (info);
+
+ bed = get_elf_backend_data (abfd);
+ add_symbol_hook = bed->elf_add_symbol_hook;
+ collect = bed->collect;
+
+ if ((abfd->flags & DYNAMIC) == 0)
+ dynamic = FALSE;
+ else
+ {
+ dynamic = TRUE;
+
+ /* You can't use -r against a dynamic object. Also, there's no
+ hope of using a dynamic object which does not exactly match
+ the format of the output file. */
+ if (info->relocatable
+ || !is_elf_hash_table (hash_table)
+ || hash_table->root.creator != abfd->xvec)
+ {
+ bfd_set_error (bfd_error_invalid_operation);
+ goto error_return;
}
- else if (bfd_get_section_alignment (dynobj, s) < lsect->alignment)
- bfd_set_section_alignment (dynobj, s, lsect->alignment);
+ }
- s->_raw_size = align_power (s->_raw_size, lsect->alignment);
+ /* As a GNU extension, any input sections which are named
+ .gnu.warning.SYMBOL are treated as warning symbols for the given
+ symbol. This differs from .gnu.warning sections, which generate
+ warnings when they are included in an output file. */
+ if (info->executable)
+ {
+ asection *s;
- /* Is there a hole we have to provide? If so check whether the segment is
- too big already */
- if (lsect->hole_size)
+ for (s = abfd->sections; s != NULL; s = s->next)
{
- lsect->hole_offset = s->_raw_size;
- s->_raw_size += lsect->hole_size;
- if (lsect->hole_offset > lsect->max_hole_offset)
+ const char *name;
+
+ name = bfd_get_section_name (abfd, s);
+ if (strncmp (name, ".gnu.warning.", sizeof ".gnu.warning." - 1) == 0)
{
- (*_bfd_error_handler) (_("%s: Section %s is too large to add hole of %ld bytes"),
- bfd_get_filename (abfd),
- lsect->name,
- (long) lsect->hole_size);
+ char *msg;
+ bfd_size_type sz;
+ bfd_size_type prefix_len;
+ const char * gnu_warning_prefix = _("warning: ");
- bfd_set_error (bfd_error_bad_value);
- return (elf_linker_section_t *)0;
+ name += sizeof ".gnu.warning." - 1;
+
+ /* If this is a shared object, then look up the symbol
+ in the hash table. If it is there, and it is already
+ been defined, then we will not be using the entry
+ from this shared object, so we don't need to warn.
+ FIXME: If we see the definition in a regular object
+ later on, we will warn, but we shouldn't. The only
+ fix is to keep track of what warnings we are supposed
+ to emit, and then handle them all at the end of the
+ link. */
+ if (dynamic)
+ {
+ struct elf_link_hash_entry *h;
+
+ h = elf_link_hash_lookup (hash_table, name,
+ FALSE, FALSE, TRUE);
+
+ /* FIXME: What about bfd_link_hash_common? */
+ if (h != NULL
+ && (h->root.type == bfd_link_hash_defined
+ || h->root.type == bfd_link_hash_defweak))
+ {
+ /* We don't want to issue this warning. Clobber
+ the section size so that the warning does not
+ get copied into the output file. */
+ s->_raw_size = 0;
+ continue;
+ }
+ }
+
+ sz = bfd_section_size (abfd, s);
+ prefix_len = strlen (gnu_warning_prefix);
+ msg = bfd_alloc (abfd, prefix_len + sz + 1);
+ if (msg == NULL)
+ goto error_return;
+
+ strcpy (msg, gnu_warning_prefix);
+ if (! bfd_get_section_contents (abfd, s, msg + prefix_len, 0, sz))
+ goto error_return;
+
+ msg[prefix_len + sz] = '\0';
+
+ if (! (_bfd_generic_link_add_one_symbol
+ (info, abfd, name, BSF_WARNING, s, 0, msg,
+ FALSE, collect, NULL)))
+ goto error_return;
+
+ if (! info->relocatable)
+ {
+ /* Clobber the section size so that the warning does
+ not get copied into the output file. */
+ s->_raw_size = 0;
+ }
}
}
+ }
-#ifdef DEBUG
- fprintf (stderr, "Creating section %s, current size = %ld\n",
- lsect->name, (long)s->_raw_size);
-#endif
+ add_needed = TRUE;
+ if (! dynamic)
+ {
+ /* If we are creating a shared library, create all the dynamic
+ sections immediately. We need to attach them to something,
+ so we attach them to this BFD, provided it is the right
+ format. FIXME: If there are no input BFD's of the same
+ format as the output, we can't make a shared library. */
+ if (info->shared
+ && is_elf_hash_table (hash_table)
+ && hash_table->root.creator == abfd->xvec
+ && ! hash_table->dynamic_sections_created)
+ {
+ if (! _bfd_elf_link_create_dynamic_sections (abfd, info))
+ goto error_return;
+ }
+ }
+ else if (!is_elf_hash_table (hash_table))
+ goto error_return;
+ else
+ {
+ asection *s;
+ const char *soname = NULL;
+ struct bfd_link_needed_list *rpath = NULL, *runpath = NULL;
+ int ret;
+
+ /* ld --just-symbols and dynamic objects don't mix very well.
+ Test for --just-symbols by looking at info set up by
+ _bfd_elf_link_just_syms. */
+ if ((s = abfd->sections) != NULL
+ && s->sec_info_type == ELF_INFO_TYPE_JUST_SYMS)
+ goto error_return;
+
+ /* If this dynamic lib was specified on the command line with
+ --as-needed in effect, then we don't want to add a DT_NEEDED
+ tag unless the lib is actually used. Similary for libs brought
+ in by another lib's DT_NEEDED. */
+ add_needed = elf_dyn_lib_class (abfd) == DYN_NORMAL;
+
+ s = bfd_get_section_by_name (abfd, ".dynamic");
+ if (s != NULL)
+ {
+ bfd_byte *dynbuf;
+ bfd_byte *extdyn;
+ int elfsec;
+ unsigned long shlink;
+
+ dynbuf = bfd_malloc (s->_raw_size);
+ if (dynbuf == NULL)
+ goto error_return;
+
+ if (! bfd_get_section_contents (abfd, s, dynbuf, 0, s->_raw_size))
+ goto error_free_dyn;
+
+ elfsec = _bfd_elf_section_from_bfd_section (abfd, s);
+ if (elfsec == -1)
+ goto error_free_dyn;
+ shlink = elf_elfsections (abfd)[elfsec]->sh_link;
+
+ for (extdyn = dynbuf;
+ extdyn < dynbuf + s->_raw_size;
+ extdyn += bed->s->sizeof_dyn)
+ {
+ Elf_Internal_Dyn dyn;
+
+ bed->s->swap_dyn_in (abfd, extdyn, &dyn);
+ if (dyn.d_tag == DT_SONAME)
+ {
+ unsigned int tagv = dyn.d_un.d_val;
+ soname = bfd_elf_string_from_elf_section (abfd, shlink, tagv);
+ if (soname == NULL)
+ goto error_free_dyn;
+ }
+ if (dyn.d_tag == DT_NEEDED)
+ {
+ struct bfd_link_needed_list *n, **pn;
+ char *fnm, *anm;
+ unsigned int tagv = dyn.d_un.d_val;
+
+ amt = sizeof (struct bfd_link_needed_list);
+ n = bfd_alloc (abfd, amt);
+ fnm = bfd_elf_string_from_elf_section (abfd, shlink, tagv);
+ if (n == NULL || fnm == NULL)
+ goto error_free_dyn;
+ amt = strlen (fnm) + 1;
+ anm = bfd_alloc (abfd, amt);
+ if (anm == NULL)
+ goto error_free_dyn;
+ memcpy (anm, fnm, amt);
+ n->name = anm;
+ n->by = abfd;
+ n->next = NULL;
+ for (pn = & hash_table->needed;
+ *pn != NULL;
+ pn = &(*pn)->next)
+ ;
+ *pn = n;
+ }
+ if (dyn.d_tag == DT_RUNPATH)
+ {
+ struct bfd_link_needed_list *n, **pn;
+ char *fnm, *anm;
+ unsigned int tagv = dyn.d_un.d_val;
+
+ amt = sizeof (struct bfd_link_needed_list);
+ n = bfd_alloc (abfd, amt);
+ fnm = bfd_elf_string_from_elf_section (abfd, shlink, tagv);
+ if (n == NULL || fnm == NULL)
+ goto error_free_dyn;
+ amt = strlen (fnm) + 1;
+ anm = bfd_alloc (abfd, amt);
+ if (anm == NULL)
+ goto error_free_dyn;
+ memcpy (anm, fnm, amt);
+ n->name = anm;
+ n->by = abfd;
+ n->next = NULL;
+ for (pn = & runpath;
+ *pn != NULL;
+ pn = &(*pn)->next)
+ ;
+ *pn = n;
+ }
+ /* Ignore DT_RPATH if we have seen DT_RUNPATH. */
+ if (!runpath && dyn.d_tag == DT_RPATH)
+ {
+ struct bfd_link_needed_list *n, **pn;
+ char *fnm, *anm;
+ unsigned int tagv = dyn.d_un.d_val;
+
+ amt = sizeof (struct bfd_link_needed_list);
+ n = bfd_alloc (abfd, amt);
+ fnm = bfd_elf_string_from_elf_section (abfd, shlink, tagv);
+ if (n == NULL || fnm == NULL)
+ goto error_free_dyn;
+ amt = strlen (fnm) + 1;
+ anm = bfd_alloc (abfd, amt);
+ if (anm == NULL)
+ {
+ error_free_dyn:
+ free (dynbuf);
+ goto error_return;
+ }
+ memcpy (anm, fnm, amt);
+ n->name = anm;
+ n->by = abfd;
+ n->next = NULL;
+ for (pn = & rpath;
+ *pn != NULL;
+ pn = &(*pn)->next)
+ ;
+ *pn = n;
+ }
+ }
+
+ free (dynbuf);
+ }
+
+ /* DT_RUNPATH overrides DT_RPATH. Do _NOT_ bfd_release, as that
+ frees all more recently bfd_alloc'd blocks as well. */
+ if (runpath)
+ rpath = runpath;
+
+ if (rpath)
+ {
+ struct bfd_link_needed_list **pn;
+ for (pn = & hash_table->runpath;
+ *pn != NULL;
+ pn = &(*pn)->next)
+ ;
+ *pn = rpath;
+ }
+
+ /* We do not want to include any of the sections in a dynamic
+ object in the output file. We hack by simply clobbering the
+ list of sections in the BFD. This could be handled more
+ cleanly by, say, a new section flag; the existing
+ SEC_NEVER_LOAD flag is not the one we want, because that one
+ still implies that the section takes up space in the output
+ file. */
+ bfd_section_list_clear (abfd);
+
+ /* If this is the first dynamic object found in the link, create
+ the special sections required for dynamic linking. */
+ if (! _bfd_elf_link_create_dynamic_sections (abfd, info))
+ goto error_return;
+
+ /* Find the name to use in a DT_NEEDED entry that refers to this
+ object. If the object has a DT_SONAME entry, we use it.
+ Otherwise, if the generic linker stuck something in
+ elf_dt_name, we use that. Otherwise, we just use the file
+ name. */
+ if (soname == NULL || *soname == '\0')
+ {
+ soname = elf_dt_name (abfd);
+ if (soname == NULL || *soname == '\0')
+ soname = bfd_get_filename (abfd);
+ }
+
+ /* Save the SONAME because sometimes the linker emulation code
+ will need to know it. */
+ elf_dt_name (abfd) = soname;
+
+ ret = elf_add_dt_needed_tag (info, soname, add_needed);
+ if (ret < 0)
+ goto error_return;
+
+ /* If we have already included this dynamic object in the
+ link, just ignore it. There is no reason to include a
+ particular dynamic object more than once. */
+ if (ret > 0)
+ return TRUE;
+ }
+
+ /* If this is a dynamic object, we always link against the .dynsym
+ symbol table, not the .symtab symbol table. The dynamic linker
+ will only see the .dynsym symbol table, so there is no reason to
+ look at .symtab for a dynamic object. */
+
+ if (! dynamic || elf_dynsymtab (abfd) == 0)
+ hdr = &elf_tdata (abfd)->symtab_hdr;
+ else
+ hdr = &elf_tdata (abfd)->dynsymtab_hdr;
+
+ symcount = hdr->sh_size / bed->s->sizeof_sym;
+
+ /* The sh_info field of the symtab header tells us where the
+ external symbols start. We don't care about the local symbols at
+ this point. */
+ if (elf_bad_symtab (abfd))
+ {
+ extsymcount = symcount;
+ extsymoff = 0;
+ }
+ else
+ {
+ extsymcount = symcount - hdr->sh_info;
+ extsymoff = hdr->sh_info;
+ }
+
+ sym_hash = NULL;
+ if (extsymcount != 0)
+ {
+ isymbuf = bfd_elf_get_elf_syms (abfd, hdr, extsymcount, extsymoff,
+ NULL, NULL, NULL);
+ if (isymbuf == NULL)
+ goto error_return;
+
+ /* We store a pointer to the hash table entry for each external
+ symbol. */
+ amt = extsymcount * sizeof (struct elf_link_hash_entry *);
+ sym_hash = bfd_alloc (abfd, amt);
+ if (sym_hash == NULL)
+ goto error_free_sym;
+ elf_sym_hashes (abfd) = sym_hash;
+ }
+
+ if (dynamic)
+ {
+ /* Read in any version definitions. */
+ if (! _bfd_elf_slurp_version_tables (abfd))
+ goto error_free_sym;
+
+ /* Read in the symbol versions, but don't bother to convert them
+ to internal format. */
+ if (elf_dynversym (abfd) != 0)
+ {
+ Elf_Internal_Shdr *versymhdr;
+
+ versymhdr = &elf_tdata (abfd)->dynversym_hdr;
+ extversym = bfd_malloc (versymhdr->sh_size);
+ if (extversym == NULL)
+ goto error_free_sym;
+ amt = versymhdr->sh_size;
+ if (bfd_seek (abfd, versymhdr->sh_offset, SEEK_SET) != 0
+ || bfd_bread (extversym, amt, abfd) != amt)
+ goto error_free_vers;
+ }
+ }
+
+ weaks = NULL;
+
+ ever = extversym != NULL ? extversym + extsymoff : NULL;
+ for (isym = isymbuf, isymend = isymbuf + extsymcount;
+ isym < isymend;
+ isym++, sym_hash++, ever = (ever != NULL ? ever + 1 : NULL))
+ {
+ int bind;
+ bfd_vma value;
+ asection *sec;
+ flagword flags;
+ const char *name;
+ struct elf_link_hash_entry *h;
+ bfd_boolean definition;
+ bfd_boolean size_change_ok;
+ bfd_boolean type_change_ok;
+ bfd_boolean new_weakdef;
+ bfd_boolean override;
+ unsigned int old_alignment;
+ bfd *old_bfd;
+
+ override = FALSE;
+
+ flags = BSF_NO_FLAGS;
+ sec = NULL;
+ value = isym->st_value;
+ *sym_hash = NULL;
+
+ bind = ELF_ST_BIND (isym->st_info);
+ if (bind == STB_LOCAL)
+ {
+ /* This should be impossible, since ELF requires that all
+ global symbols follow all local symbols, and that sh_info
+ point to the first global symbol. Unfortunately, Irix 5
+ screws this up. */
+ continue;
+ }
+ else if (bind == STB_GLOBAL)
+ {
+ if (isym->st_shndx != SHN_UNDEF
+ && isym->st_shndx != SHN_COMMON)
+ flags = BSF_GLOBAL;
+ }
+ else if (bind == STB_WEAK)
+ flags = BSF_WEAK;
+ else
+ {
+ /* Leave it up to the processor backend. */
+ }
+
+ if (isym->st_shndx == SHN_UNDEF)
+ sec = bfd_und_section_ptr;
+ else if (isym->st_shndx < SHN_LORESERVE || isym->st_shndx > SHN_HIRESERVE)
+ {
+ sec = bfd_section_from_elf_index (abfd, isym->st_shndx);
+ if (sec == NULL)
+ sec = bfd_abs_section_ptr;
+ else if ((abfd->flags & (EXEC_P | DYNAMIC)) != 0)
+ value -= sec->vma;
+ }
+ else if (isym->st_shndx == SHN_ABS)
+ sec = bfd_abs_section_ptr;
+ else if (isym->st_shndx == SHN_COMMON)
+ {
+ sec = bfd_com_section_ptr;
+ /* What ELF calls the size we call the value. What ELF
+ calls the value we call the alignment. */
+ value = isym->st_size;
+ }
+ else
+ {
+ /* Leave it up to the processor backend. */
+ }
+
+ name = bfd_elf_string_from_elf_section (abfd, hdr->sh_link,
+ isym->st_name);
+ if (name == NULL)
+ goto error_free_vers;
+
+ if (isym->st_shndx == SHN_COMMON
+ && ELF_ST_TYPE (isym->st_info) == STT_TLS)
+ {
+ asection *tcomm = bfd_get_section_by_name (abfd, ".tcommon");
+
+ if (tcomm == NULL)
+ {
+ tcomm = bfd_make_section (abfd, ".tcommon");
+ if (tcomm == NULL
+ || !bfd_set_section_flags (abfd, tcomm, (SEC_ALLOC
+ | SEC_IS_COMMON
+ | SEC_LINKER_CREATED
+ | SEC_THREAD_LOCAL)))
+ goto error_free_vers;
+ }
+ sec = tcomm;
+ }
+ else if (add_symbol_hook)
+ {
+ if (! (*add_symbol_hook) (abfd, info, isym, &name, &flags, &sec,
+ &value))
+ goto error_free_vers;
+
+ /* The hook function sets the name to NULL if this symbol
+ should be skipped for some reason. */
+ if (name == NULL)
+ continue;
+ }
- if (lsect->sym_name)
+ /* Sanity check that all possibilities were handled. */
+ if (sec == NULL)
+ {
+ bfd_set_error (bfd_error_bad_value);
+ goto error_free_vers;
+ }
+
+ if (bfd_is_und_section (sec)
+ || bfd_is_com_section (sec))
+ definition = FALSE;
+ else
+ definition = TRUE;
+
+ size_change_ok = FALSE;
+ type_change_ok = get_elf_backend_data (abfd)->type_change_ok;
+ old_alignment = 0;
+ old_bfd = NULL;
+
+ if (is_elf_hash_table (hash_table))
+ {
+ Elf_Internal_Versym iver;
+ unsigned int vernum = 0;
+ bfd_boolean skip;
+
+ if (ever != NULL)
+ {
+ _bfd_elf_swap_versym_in (abfd, ever, &iver);
+ vernum = iver.vs_vers & VERSYM_VERSION;
+
+ /* If this is a hidden symbol, or if it is not version
+ 1, we append the version name to the symbol name.
+ However, we do not modify a non-hidden absolute
+ symbol, because it might be the version symbol
+ itself. FIXME: What if it isn't? */
+ if ((iver.vs_vers & VERSYM_HIDDEN) != 0
+ || (vernum > 1 && ! bfd_is_abs_section (sec)))
+ {
+ const char *verstr;
+ size_t namelen, verlen, newlen;
+ char *newname, *p;
+
+ if (isym->st_shndx != SHN_UNDEF)
+ {
+ if (vernum > elf_tdata (abfd)->dynverdef_hdr.sh_info)
+ {
+ (*_bfd_error_handler)
+ (_("%s: %s: invalid version %u (max %d)"),
+ bfd_archive_filename (abfd), name, vernum,
+ elf_tdata (abfd)->dynverdef_hdr.sh_info);
+ bfd_set_error (bfd_error_bad_value);
+ goto error_free_vers;
+ }
+ else if (vernum > 1)
+ verstr =
+ elf_tdata (abfd)->verdef[vernum - 1].vd_nodename;
+ else
+ verstr = "";
+ }
+ else
+ {
+ /* We cannot simply test for the number of
+ entries in the VERNEED section since the
+ numbers for the needed versions do not start
+ at 0. */
+ Elf_Internal_Verneed *t;
+
+ verstr = NULL;
+ for (t = elf_tdata (abfd)->verref;
+ t != NULL;
+ t = t->vn_nextref)
+ {
+ Elf_Internal_Vernaux *a;
+
+ for (a = t->vn_auxptr; a != NULL; a = a->vna_nextptr)
+ {
+ if (a->vna_other == vernum)
+ {
+ verstr = a->vna_nodename;
+ break;
+ }
+ }
+ if (a != NULL)
+ break;
+ }
+ if (verstr == NULL)
+ {
+ (*_bfd_error_handler)
+ (_("%s: %s: invalid needed version %d"),
+ bfd_archive_filename (abfd), name, vernum);
+ bfd_set_error (bfd_error_bad_value);
+ goto error_free_vers;
+ }
+ }
+
+ namelen = strlen (name);
+ verlen = strlen (verstr);
+ newlen = namelen + verlen + 2;
+ if ((iver.vs_vers & VERSYM_HIDDEN) == 0
+ && isym->st_shndx != SHN_UNDEF)
+ ++newlen;
+
+ newname = bfd_alloc (abfd, newlen);
+ if (newname == NULL)
+ goto error_free_vers;
+ memcpy (newname, name, namelen);
+ p = newname + namelen;
+ *p++ = ELF_VER_CHR;
+ /* If this is a defined non-hidden version symbol,
+ we add another @ to the name. This indicates the
+ default version of the symbol. */
+ if ((iver.vs_vers & VERSYM_HIDDEN) == 0
+ && isym->st_shndx != SHN_UNDEF)
+ *p++ = ELF_VER_CHR;
+ memcpy (p, verstr, verlen + 1);
+
+ name = newname;
+ }
+ }
+
+ if (!_bfd_elf_merge_symbol (abfd, info, name, isym, &sec, &value,
+ sym_hash, &skip, &override,
+ &type_change_ok, &size_change_ok))
+ goto error_free_vers;
+
+ if (skip)
+ continue;
+
+ if (override)
+ definition = FALSE;
+
+ h = *sym_hash;
+ while (h->root.type == bfd_link_hash_indirect
+ || h->root.type == bfd_link_hash_warning)
+ h = (struct elf_link_hash_entry *) h->root.u.i.link;
+
+ /* Remember the old alignment if this is a common symbol, so
+ that we don't reduce the alignment later on. We can't
+ check later, because _bfd_generic_link_add_one_symbol
+ will set a default for the alignment which we want to
+ override. We also remember the old bfd where the existing
+ definition comes from. */
+ switch (h->root.type)
+ {
+ default:
+ break;
+
+ case bfd_link_hash_defined:
+ case bfd_link_hash_defweak:
+ old_bfd = h->root.u.def.section->owner;
+ break;
+
+ case bfd_link_hash_common:
+ old_bfd = h->root.u.c.p->section->owner;
+ old_alignment = h->root.u.c.p->alignment_power;
+ break;
+ }
+
+ if (elf_tdata (abfd)->verdef != NULL
+ && ! override
+ && vernum > 1
+ && definition)
+ h->verinfo.verdef = &elf_tdata (abfd)->verdef[vernum - 1];
+ }
+
+ if (! (_bfd_generic_link_add_one_symbol
+ (info, abfd, name, flags, sec, value, NULL, FALSE, collect,
+ (struct bfd_link_hash_entry **) sym_hash)))
+ goto error_free_vers;
+
+ h = *sym_hash;
+ while (h->root.type == bfd_link_hash_indirect
+ || h->root.type == bfd_link_hash_warning)
+ h = (struct elf_link_hash_entry *) h->root.u.i.link;
+ *sym_hash = h;
+
+ new_weakdef = FALSE;
+ if (dynamic
+ && definition
+ && (flags & BSF_WEAK) != 0
+ && ELF_ST_TYPE (isym->st_info) != STT_FUNC
+ && is_elf_hash_table (hash_table)
+ && h->weakdef == NULL)
+ {
+ /* Keep a list of all weak defined non function symbols from
+ a dynamic object, using the weakdef field. Later in this
+ function we will set the weakdef field to the correct
+ value. We only put non-function symbols from dynamic
+ objects on this list, because that happens to be the only
+ time we need to know the normal symbol corresponding to a
+ weak symbol, and the information is time consuming to
+ figure out. If the weakdef field is not already NULL,
+ then this symbol was already defined by some previous
+ dynamic object, and we will be using that previous
+ definition anyhow. */
+
+ h->weakdef = weaks;
+ weaks = h;
+ new_weakdef = TRUE;
+ }
+
+ /* Set the alignment of a common symbol. */
+ if (isym->st_shndx == SHN_COMMON
+ && h->root.type == bfd_link_hash_common)
+ {
+ unsigned int align;
+
+ align = bfd_log2 (isym->st_value);
+ if (align > old_alignment
+ /* Permit an alignment power of zero if an alignment of one
+ is specified and no other alignments have been specified. */
+ || (isym->st_value == 1 && old_alignment == 0))
+ h->root.u.c.p->alignment_power = align;
+ else
+ h->root.u.c.p->alignment_power = old_alignment;
+ }
+
+ if (is_elf_hash_table (hash_table))
+ {
+ int old_flags;
+ bfd_boolean dynsym;
+ int new_flag;
+
+ /* Check the alignment when a common symbol is involved. This
+ can change when a common symbol is overridden by a normal
+ definition or a common symbol is ignored due to the old
+ normal definition. We need to make sure the maximum
+ alignment is maintained. */
+ if ((old_alignment || isym->st_shndx == SHN_COMMON)
+ && h->root.type != bfd_link_hash_common)
+ {
+ unsigned int common_align;
+ unsigned int normal_align;
+ unsigned int symbol_align;
+ bfd *normal_bfd;
+ bfd *common_bfd;
+
+ symbol_align = ffs (h->root.u.def.value) - 1;
+ if (h->root.u.def.section->owner != NULL
+ && (h->root.u.def.section->owner->flags & DYNAMIC) == 0)
+ {
+ normal_align = h->root.u.def.section->alignment_power;
+ if (normal_align > symbol_align)
+ normal_align = symbol_align;
+ }
+ else
+ normal_align = symbol_align;
+
+ if (old_alignment)
+ {
+ common_align = old_alignment;
+ common_bfd = old_bfd;
+ normal_bfd = abfd;
+ }
+ else
+ {
+ common_align = bfd_log2 (isym->st_value);
+ common_bfd = abfd;
+ normal_bfd = old_bfd;
+ }
+
+ if (normal_align < common_align)
+ (*_bfd_error_handler)
+ (_("Warning: alignment %u of symbol `%s' in %s is smaller than %u in %s"),
+ 1 << normal_align,
+ name,
+ bfd_archive_filename (normal_bfd),
+ 1 << common_align,
+ bfd_archive_filename (common_bfd));
+ }
+
+ /* Remember the symbol size and type. */
+ if (isym->st_size != 0
+ && (definition || h->size == 0))
+ {
+ if (h->size != 0 && h->size != isym->st_size && ! size_change_ok)
+ (*_bfd_error_handler)
+ (_("Warning: size of symbol `%s' changed from %lu in %s to %lu in %s"),
+ name, (unsigned long) h->size,
+ bfd_archive_filename (old_bfd),
+ (unsigned long) isym->st_size,
+ bfd_archive_filename (abfd));
+
+ h->size = isym->st_size;
+ }
+
+ /* If this is a common symbol, then we always want H->SIZE
+ to be the size of the common symbol. The code just above
+ won't fix the size if a common symbol becomes larger. We
+ don't warn about a size change here, because that is
+ covered by --warn-common. */
+ if (h->root.type == bfd_link_hash_common)
+ h->size = h->root.u.c.size;
+
+ if (ELF_ST_TYPE (isym->st_info) != STT_NOTYPE
+ && (definition || h->type == STT_NOTYPE))
+ {
+ if (h->type != STT_NOTYPE
+ && h->type != ELF_ST_TYPE (isym->st_info)
+ && ! type_change_ok)
+ (*_bfd_error_handler)
+ (_("Warning: type of symbol `%s' changed from %d to %d in %s"),
+ name, h->type, ELF_ST_TYPE (isym->st_info),
+ bfd_archive_filename (abfd));
+
+ h->type = ELF_ST_TYPE (isym->st_info);
+ }
+
+ /* If st_other has a processor-specific meaning, specific
+ code might be needed here. We never merge the visibility
+ attribute with the one from a dynamic object. */
+ if (bed->elf_backend_merge_symbol_attribute)
+ (*bed->elf_backend_merge_symbol_attribute) (h, isym, definition,
+ dynamic);
+
+ if (isym->st_other != 0 && !dynamic)
+ {
+ unsigned char hvis, symvis, other, nvis;
+
+ /* Take the balance of OTHER from the definition. */
+ other = (definition ? isym->st_other : h->other);
+ other &= ~ ELF_ST_VISIBILITY (-1);
+
+ /* Combine visibilities, using the most constraining one. */
+ hvis = ELF_ST_VISIBILITY (h->other);
+ symvis = ELF_ST_VISIBILITY (isym->st_other);
+ if (! hvis)
+ nvis = symvis;
+ else if (! symvis)
+ nvis = hvis;
+ else
+ nvis = hvis < symvis ? hvis : symvis;
+
+ h->other = other | nvis;
+ }
+
+ /* Set a flag in the hash table entry indicating the type of
+ reference or definition we just found. Keep a count of
+ the number of dynamic symbols we find. A dynamic symbol
+ is one which is referenced or defined by both a regular
+ object and a shared object. */
+ old_flags = h->elf_link_hash_flags;
+ dynsym = FALSE;
+ if (! dynamic)
+ {
+ if (! definition)
+ {
+ new_flag = ELF_LINK_HASH_REF_REGULAR;
+ if (bind != STB_WEAK)
+ new_flag |= ELF_LINK_HASH_REF_REGULAR_NONWEAK;
+ }
+ else
+ new_flag = ELF_LINK_HASH_DEF_REGULAR;
+ if (! info->executable
+ || (old_flags & (ELF_LINK_HASH_DEF_DYNAMIC
+ | ELF_LINK_HASH_REF_DYNAMIC)) != 0)
+ dynsym = TRUE;
+ }
+ else
+ {
+ if (! definition)
+ new_flag = ELF_LINK_HASH_REF_DYNAMIC;
+ else
+ new_flag = ELF_LINK_HASH_DEF_DYNAMIC;
+ if ((old_flags & (ELF_LINK_HASH_DEF_REGULAR
+ | ELF_LINK_HASH_REF_REGULAR)) != 0
+ || (h->weakdef != NULL
+ && ! new_weakdef
+ && h->weakdef->dynindx != -1))
+ dynsym = TRUE;
+ }
+
+ h->elf_link_hash_flags |= new_flag;
+
+ /* Check to see if we need to add an indirect symbol for
+ the default name. */
+ if (definition || h->root.type == bfd_link_hash_common)
+ if (!_bfd_elf_add_default_symbol (abfd, info, h, name, isym,
+ &sec, &value, &dynsym,
+ override))
+ goto error_free_vers;
+
+ if (definition && !dynamic)
+ {
+ char *p = strchr (name, ELF_VER_CHR);
+ if (p != NULL && p[1] != ELF_VER_CHR)
+ {
+ /* Queue non-default versions so that .symver x, x@FOO
+ aliases can be checked. */
+ if (! nondeflt_vers)
+ {
+ amt = (isymend - isym + 1)
+ * sizeof (struct elf_link_hash_entry *);
+ nondeflt_vers = bfd_malloc (amt);
+ }
+ nondeflt_vers [nondeflt_vers_cnt++] = h;
+ }
+ }
+
+ if (dynsym && h->dynindx == -1)
+ {
+ if (! bfd_elf_link_record_dynamic_symbol (info, h))
+ goto error_free_vers;
+ if (h->weakdef != NULL
+ && ! new_weakdef
+ && h->weakdef->dynindx == -1)
+ {
+ if (! bfd_elf_link_record_dynamic_symbol (info, h->weakdef))
+ goto error_free_vers;
+ }
+ }
+ else if (dynsym && h->dynindx != -1)
+ /* If the symbol already has a dynamic index, but
+ visibility says it should not be visible, turn it into
+ a local symbol. */
+ switch (ELF_ST_VISIBILITY (h->other))
+ {
+ case STV_INTERNAL:
+ case STV_HIDDEN:
+ (*bed->elf_backend_hide_symbol) (info, h, TRUE);
+ dynsym = FALSE;
+ break;
+ }
+
+ if (!add_needed
+ && definition
+ && dynsym
+ && (h->elf_link_hash_flags
+ & ELF_LINK_HASH_REF_REGULAR) != 0)
+ {
+ int ret;
+ const char *soname = elf_dt_name (abfd);
+
+ /* A symbol from a library loaded via DT_NEEDED of some
+ other library is referenced by a regular object.
+ Add a DT_NEEDED entry for it. */
+ add_needed = TRUE;
+ ret = elf_add_dt_needed_tag (info, soname, add_needed);
+ if (ret < 0)
+ goto error_free_vers;
+
+ BFD_ASSERT (ret == 0);
+ }
+ }
+ }
+
+ /* Now that all the symbols from this input file are created, handle
+ .symver foo, foo@BAR such that any relocs against foo become foo@BAR. */
+ if (nondeflt_vers != NULL)
+ {
+ bfd_size_type cnt, symidx;
+
+ for (cnt = 0; cnt < nondeflt_vers_cnt; ++cnt)
+ {
+ struct elf_link_hash_entry *h = nondeflt_vers[cnt], *hi;
+ char *shortname, *p;
+
+ p = strchr (h->root.root.string, ELF_VER_CHR);
+ if (p == NULL
+ || (h->root.type != bfd_link_hash_defined
+ && h->root.type != bfd_link_hash_defweak))
+ continue;
+
+ amt = p - h->root.root.string;
+ shortname = bfd_malloc (amt + 1);
+ memcpy (shortname, h->root.root.string, amt);
+ shortname[amt] = '\0';
+
+ hi = (struct elf_link_hash_entry *)
+ bfd_link_hash_lookup (&hash_table->root, shortname,
+ FALSE, FALSE, FALSE);
+ if (hi != NULL
+ && hi->root.type == h->root.type
+ && hi->root.u.def.value == h->root.u.def.value
+ && hi->root.u.def.section == h->root.u.def.section)
+ {
+ (*bed->elf_backend_hide_symbol) (info, hi, TRUE);
+ hi->root.type = bfd_link_hash_indirect;
+ hi->root.u.i.link = (struct bfd_link_hash_entry *) h;
+ (*bed->elf_backend_copy_indirect_symbol) (bed, h, hi);
+ sym_hash = elf_sym_hashes (abfd);
+ if (sym_hash)
+ for (symidx = 0; symidx < extsymcount; ++symidx)
+ if (sym_hash[symidx] == hi)
+ {
+ sym_hash[symidx] = h;
+ break;
+ }
+ }
+ free (shortname);
+ }
+ free (nondeflt_vers);
+ nondeflt_vers = NULL;
+ }
+
+ if (extversym != NULL)
+ {
+ free (extversym);
+ extversym = NULL;
+ }
+
+ if (isymbuf != NULL)
+ free (isymbuf);
+ isymbuf = NULL;
+
+ /* Now set the weakdefs field correctly for all the weak defined
+ symbols we found. The only way to do this is to search all the
+ symbols. Since we only need the information for non functions in
+ dynamic objects, that's the only time we actually put anything on
+ the list WEAKS. We need this information so that if a regular
+ object refers to a symbol defined weakly in a dynamic object, the
+ real symbol in the dynamic object is also put in the dynamic
+ symbols; we also must arrange for both symbols to point to the
+ same memory location. We could handle the general case of symbol
+ aliasing, but a general symbol alias can only be generated in
+ assembler code, handling it correctly would be very time
+ consuming, and other ELF linkers don't handle general aliasing
+ either. */
+ if (weaks != NULL)
+ {
+ struct elf_link_hash_entry **hpp;
+ struct elf_link_hash_entry **hppend;
+ struct elf_link_hash_entry **sorted_sym_hash;
+ struct elf_link_hash_entry *h;
+ size_t sym_count;
+
+ /* Since we have to search the whole symbol list for each weak
+ defined symbol, search time for N weak defined symbols will be
+ O(N^2). Binary search will cut it down to O(NlogN). */
+ amt = extsymcount * sizeof (struct elf_link_hash_entry *);
+ sorted_sym_hash = bfd_malloc (amt);
+ if (sorted_sym_hash == NULL)
+ goto error_return;
+ sym_hash = sorted_sym_hash;
+ hpp = elf_sym_hashes (abfd);
+ hppend = hpp + extsymcount;
+ sym_count = 0;
+ for (; hpp < hppend; hpp++)
+ {
+ h = *hpp;
+ if (h != NULL
+ && h->root.type == bfd_link_hash_defined
+ && h->type != STT_FUNC)
+ {
+ *sym_hash = h;
+ sym_hash++;
+ sym_count++;
+ }
+ }
+
+ qsort (sorted_sym_hash, sym_count,
+ sizeof (struct elf_link_hash_entry *),
+ elf_sort_symbol);
+
+ while (weaks != NULL)
+ {
+ struct elf_link_hash_entry *hlook;
+ asection *slook;
+ bfd_vma vlook;
+ long ilook;
+ size_t i, j, idx;
+
+ hlook = weaks;
+ weaks = hlook->weakdef;
+ hlook->weakdef = NULL;
+
+ BFD_ASSERT (hlook->root.type == bfd_link_hash_defined
+ || hlook->root.type == bfd_link_hash_defweak
+ || hlook->root.type == bfd_link_hash_common
+ || hlook->root.type == bfd_link_hash_indirect);
+ slook = hlook->root.u.def.section;
+ vlook = hlook->root.u.def.value;
+
+ ilook = -1;
+ i = 0;
+ j = sym_count;
+ while (i < j)
+ {
+ bfd_signed_vma vdiff;
+ idx = (i + j) / 2;
+ h = sorted_sym_hash [idx];
+ vdiff = vlook - h->root.u.def.value;
+ if (vdiff < 0)
+ j = idx;
+ else if (vdiff > 0)
+ i = idx + 1;
+ else
+ {
+ long sdiff = slook - h->root.u.def.section;
+ if (sdiff < 0)
+ j = idx;
+ else if (sdiff > 0)
+ i = idx + 1;
+ else
+ {
+ ilook = idx;
+ break;
+ }
+ }
+ }
+
+ /* We didn't find a value/section match. */
+ if (ilook == -1)
+ continue;
+
+ for (i = ilook; i < sym_count; i++)
+ {
+ h = sorted_sym_hash [i];
+
+ /* Stop if value or section doesn't match. */
+ if (h->root.u.def.value != vlook
+ || h->root.u.def.section != slook)
+ break;
+ else if (h != hlook)
+ {
+ hlook->weakdef = h;
+
+ /* If the weak definition is in the list of dynamic
+ symbols, make sure the real definition is put
+ there as well. */
+ if (hlook->dynindx != -1 && h->dynindx == -1)
+ {
+ if (! bfd_elf_link_record_dynamic_symbol (info, h))
+ goto error_return;
+ }
+
+ /* If the real definition is in the list of dynamic
+ symbols, make sure the weak definition is put
+ there as well. If we don't do this, then the
+ dynamic loader might not merge the entries for the
+ real definition and the weak definition. */
+ if (h->dynindx != -1 && hlook->dynindx == -1)
+ {
+ if (! bfd_elf_link_record_dynamic_symbol (info, hlook))
+ goto error_return;
+ }
+ break;
+ }
+ }
+ }
+
+ free (sorted_sym_hash);
+ }
+
+ /* If this object is the same format as the output object, and it is
+ not a shared library, then let the backend look through the
+ relocs.
+
+ This is required to build global offset table entries and to
+ arrange for dynamic relocs. It is not required for the
+ particular common case of linking non PIC code, even when linking
+ against shared libraries, but unfortunately there is no way of
+ knowing whether an object file has been compiled PIC or not.
+ Looking through the relocs is not particularly time consuming.
+ The problem is that we must either (1) keep the relocs in memory,
+ which causes the linker to require additional runtime memory or
+ (2) read the relocs twice from the input file, which wastes time.
+ This would be a good case for using mmap.
+
+ I have no idea how to handle linking PIC code into a file of a
+ different format. It probably can't be done. */
+ check_relocs = get_elf_backend_data (abfd)->check_relocs;
+ if (! dynamic
+ && is_elf_hash_table (hash_table)
+ && hash_table->root.creator == abfd->xvec
+ && check_relocs != NULL)
+ {
+ asection *o;
+
+ for (o = abfd->sections; o != NULL; o = o->next)
+ {
+ Elf_Internal_Rela *internal_relocs;
+ bfd_boolean ok;
+
+ if ((o->flags & SEC_RELOC) == 0
+ || o->reloc_count == 0
+ || ((info->strip == strip_all || info->strip == strip_debugger)
+ && (o->flags & SEC_DEBUGGING) != 0)
+ || bfd_is_abs_section (o->output_section))
+ continue;
+
+ internal_relocs = _bfd_elf_link_read_relocs (abfd, o, NULL, NULL,
+ info->keep_memory);
+ if (internal_relocs == NULL)
+ goto error_return;
+
+ ok = (*check_relocs) (abfd, info, o, internal_relocs);
+
+ if (elf_section_data (o)->relocs != internal_relocs)
+ free (internal_relocs);
+
+ if (! ok)
+ goto error_return;
+ }
+ }
+
+ /* If this is a non-traditional link, try to optimize the handling
+ of the .stab/.stabstr sections. */
+ if (! dynamic
+ && ! info->traditional_format
+ && is_elf_hash_table (hash_table)
+ && (info->strip != strip_all && info->strip != strip_debugger))
+ {
+ asection *stabstr;
+
+ stabstr = bfd_get_section_by_name (abfd, ".stabstr");
+ if (stabstr != NULL)
+ {
+ bfd_size_type string_offset = 0;
+ asection *stab;
+
+ for (stab = abfd->sections; stab; stab = stab->next)
+ if (strncmp (".stab", stab->name, 5) == 0
+ && (!stab->name[5] ||
+ (stab->name[5] == '.' && ISDIGIT (stab->name[6])))
+ && (stab->flags & SEC_MERGE) == 0
+ && !bfd_is_abs_section (stab->output_section))
+ {
+ struct bfd_elf_section_data *secdata;
+
+ secdata = elf_section_data (stab);
+ if (! _bfd_link_section_stabs (abfd,
+ & hash_table->stab_info,
+ stab, stabstr,
+ &secdata->sec_info,
+ &string_offset))
+ goto error_return;
+ if (secdata->sec_info)
+ stab->sec_info_type = ELF_INFO_TYPE_STABS;
+ }
+ }
+ }
+
+ if (! info->relocatable
+ && ! dynamic
+ && is_elf_hash_table (hash_table))
+ {
+ asection *s;
+
+ for (s = abfd->sections; s != NULL; s = s->next)
+ if ((s->flags & SEC_MERGE) != 0
+ && !bfd_is_abs_section (s->output_section))
+ {
+ struct bfd_elf_section_data *secdata;
+
+ secdata = elf_section_data (s);
+ if (! _bfd_merge_section (abfd,
+ & hash_table->merge_info,
+ s, &secdata->sec_info))
+ goto error_return;
+ else if (secdata->sec_info)
+ s->sec_info_type = ELF_INFO_TYPE_MERGE;
+ }
+ }
+
+ if (is_elf_hash_table (hash_table))
+ {
+ /* Add this bfd to the loaded list. */
+ struct elf_link_loaded_list *n;
+
+ n = bfd_alloc (abfd, sizeof (struct elf_link_loaded_list));
+ if (n == NULL)
+ goto error_return;
+ n->abfd = abfd;
+ n->next = hash_table->loaded;
+ hash_table->loaded = n;
+ }
+
+ return TRUE;
+
+ error_free_vers:
+ if (nondeflt_vers != NULL)
+ free (nondeflt_vers);
+ if (extversym != NULL)
+ free (extversym);
+ error_free_sym:
+ if (isymbuf != NULL)
+ free (isymbuf);
+ error_return:
+ return FALSE;
+}
+
+/* Add symbols from an ELF archive file to the linker hash table. We
+ don't use _bfd_generic_link_add_archive_symbols because of a
+ problem which arises on UnixWare. The UnixWare libc.so is an
+ archive which includes an entry libc.so.1 which defines a bunch of
+ symbols. The libc.so archive also includes a number of other
+ object files, which also define symbols, some of which are the same
+ as those defined in libc.so.1. Correct linking requires that we
+ consider each object file in turn, and include it if it defines any
+ symbols we need. _bfd_generic_link_add_archive_symbols does not do
+ this; it looks through the list of undefined symbols, and includes
+ any object file which defines them. When this algorithm is used on
+ UnixWare, it winds up pulling in libc.so.1 early and defining a
+ bunch of symbols. This means that some of the other objects in the
+ archive are not included in the link, which is incorrect since they
+ precede libc.so.1 in the archive.
+
+ Fortunately, ELF archive handling is simpler than that done by
+ _bfd_generic_link_add_archive_symbols, which has to allow for a.out
+ oddities. In ELF, if we find a symbol in the archive map, and the
+ symbol is currently undefined, we know that we must pull in that
+ object file.
+
+ Unfortunately, we do have to make multiple passes over the symbol
+ table until nothing further is resolved. */
+
+static bfd_boolean
+elf_link_add_archive_symbols (bfd *abfd, struct bfd_link_info *info)
+{
+ symindex c;
+ bfd_boolean *defined = NULL;
+ bfd_boolean *included = NULL;
+ carsym *symdefs;
+ bfd_boolean loop;
+ bfd_size_type amt;
+
+ if (! bfd_has_map (abfd))
+ {
+ /* An empty archive is a special case. */
+ if (bfd_openr_next_archived_file (abfd, NULL) == NULL)
+ return TRUE;
+ bfd_set_error (bfd_error_no_armap);
+ return FALSE;
+ }
+
+ /* Keep track of all symbols we know to be already defined, and all
+ files we know to be already included. This is to speed up the
+ second and subsequent passes. */
+ c = bfd_ardata (abfd)->symdef_count;
+ if (c == 0)
+ return TRUE;
+ amt = c;
+ amt *= sizeof (bfd_boolean);
+ defined = bfd_zmalloc (amt);
+ included = bfd_zmalloc (amt);
+ if (defined == NULL || included == NULL)
+ goto error_return;
+
+ symdefs = bfd_ardata (abfd)->symdefs;
+
+ do
+ {
+ file_ptr last;
+ symindex i;
+ carsym *symdef;
+ carsym *symdefend;
+
+ loop = FALSE;
+ last = -1;
+
+ symdef = symdefs;
+ symdefend = symdef + c;
+ for (i = 0; symdef < symdefend; symdef++, i++)
{
struct elf_link_hash_entry *h;
- struct bfd_link_hash_entry *bh;
+ bfd *element;
+ struct bfd_link_hash_entry *undefs_tail;
+ symindex mark;
-#ifdef DEBUG
- fprintf (stderr, "Adding %s to section %s\n",
- lsect->sym_name,
- lsect->name);
-#endif
- bh = bfd_link_hash_lookup (info->hash, lsect->sym_name,
- false, false, false);
+ if (defined[i] || included[i])
+ continue;
+ if (symdef->file_offset == last)
+ {
+ included[i] = TRUE;
+ continue;
+ }
+
+ h = elf_link_hash_lookup (elf_hash_table (info), symdef->name,
+ FALSE, FALSE, FALSE);
+
+ if (h == NULL)
+ {
+ char *p, *copy;
+ size_t len, first;
+
+ /* If this is a default version (the name contains @@),
+ look up the symbol again with only one `@' as well
+ as without the version. The effect is that references
+ to the symbol with and without the version will be
+ matched by the default symbol in the archive. */
+
+ p = strchr (symdef->name, ELF_VER_CHR);
+ if (p == NULL || p[1] != ELF_VER_CHR)
+ continue;
+
+ /* First check with only one `@'. */
+ len = strlen (symdef->name);
+ copy = bfd_alloc (abfd, len);
+ if (copy == NULL)
+ goto error_return;
+ first = p - symdef->name + 1;
+ memcpy (copy, symdef->name, first);
+ memcpy (copy + first, symdef->name + first + 1, len - first);
+
+ h = elf_link_hash_lookup (elf_hash_table (info), copy,
+ FALSE, FALSE, FALSE);
+
+ if (h == NULL)
+ {
+ /* We also need to check references to the symbol
+ without the version. */
+
+ copy[first - 1] = '\0';
+ h = elf_link_hash_lookup (elf_hash_table (info),
+ copy, FALSE, FALSE, FALSE);
+ }
+
+ bfd_release (abfd, copy);
+ }
+
+ if (h == NULL)
+ continue;
+
+ if (h->root.type == bfd_link_hash_common)
+ {
+ /* We currently have a common symbol. The archive map contains
+ a reference to this symbol, so we may want to include it. We
+ only want to include it however, if this archive element
+ contains a definition of the symbol, not just another common
+ declaration of it.
+
+ Unfortunately some archivers (including GNU ar) will put
+ declarations of common symbols into their archive maps, as
+ well as real definitions, so we cannot just go by the archive
+ map alone. Instead we must read in the element's symbol
+ table and check that to see what kind of symbol definition
+ this is. */
+ if (! elf_link_is_defined_archive_symbol (abfd, symdef))
+ continue;
+ }
+ else if (h->root.type != bfd_link_hash_undefined)
+ {
+ if (h->root.type != bfd_link_hash_undefweak)
+ defined[i] = TRUE;
+ continue;
+ }
+
+ /* We need to include this archive member. */
+ element = _bfd_get_elt_at_filepos (abfd, symdef->file_offset);
+ if (element == NULL)
+ goto error_return;
+
+ if (! bfd_check_format (element, bfd_object))
+ goto error_return;
+
+ /* Doublecheck that we have not included this object
+ already--it should be impossible, but there may be
+ something wrong with the archive. */
+ if (element->archive_pass != 0)
+ {
+ bfd_set_error (bfd_error_bad_value);
+ goto error_return;
+ }
+ element->archive_pass = 1;
+
+ undefs_tail = info->hash->undefs_tail;
- if ((bh == NULL || bh->type == bfd_link_hash_undefined)
- && !(_bfd_generic_link_add_one_symbol
- (info, abfd, lsect->sym_name, BSF_GLOBAL, s,
- (lsect->hole_size
- ? s->_raw_size - lsect->hole_size + lsect->sym_offset
- : lsect->sym_offset),
- (const char *) NULL, false,
- get_elf_backend_data (abfd)->collect, &bh)))
- return (elf_linker_section_t *) 0;
- h = (struct elf_link_hash_entry *) bh;
+ if (! (*info->callbacks->add_archive_element) (info, element,
+ symdef->name))
+ goto error_return;
+ if (! bfd_link_add_symbols (element, info))
+ goto error_return;
- if ((defaults->which != LINKER_SECTION_SDATA)
- && (defaults->which != LINKER_SECTION_SDATA2))
- h->elf_link_hash_flags |= ELF_LINK_HASH_DEF_DYNAMIC;
+ /* 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;
- h->type = STT_OBJECT;
- lsect->sym_hash = h;
+ /* 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);
- if (info->shared
- && ! _bfd_elf_link_record_dynamic_symbol (info, h))
- return (elf_linker_section_t *) 0;
+ /* We mark subsequent symbols from this object file as we go
+ on through the loop. */
+ last = symdef->file_offset;
}
}
+ while (loop);
-#if 0
- /* This does not make sense. The sections which may exist in the
- object file have nothing to do with the sections we want to
- create. */
+ free (defined);
+ free (included);
+
+ return TRUE;
+
+ error_return:
+ if (defined != NULL)
+ free (defined);
+ if (included != NULL)
+ free (included);
+ return FALSE;
+}
+
+/* Given an ELF BFD, add symbols to the global hash table as
+ appropriate. */
+
+bfd_boolean
+bfd_elf_link_add_symbols (bfd *abfd, struct bfd_link_info *info)
+{
+ switch (bfd_get_format (abfd))
+ {
+ case bfd_object:
+ return elf_link_add_object_symbols (abfd, info);
+ case bfd_archive:
+ return elf_link_add_archive_symbols (abfd, info);
+ default:
+ bfd_set_error (bfd_error_wrong_format);
+ return FALSE;
+ }
+}
+
+/* This function will be called though elf_link_hash_traverse to store
+ all hash value of the exported symbols in an array. */
+
+static bfd_boolean
+elf_collect_hash_codes (struct elf_link_hash_entry *h, void *data)
+{
+ unsigned long **valuep = data;
+ const char *name;
+ char *p;
+ unsigned long ha;
+ char *alc = NULL;
+
+ if (h->root.type == bfd_link_hash_warning)
+ h = (struct elf_link_hash_entry *) h->root.u.i.link;
+
+ /* Ignore indirect symbols. These are added by the versioning code. */
+ if (h->dynindx == -1)
+ return TRUE;
+
+ name = h->root.root.string;
+ p = strchr (name, ELF_VER_CHR);
+ if (p != NULL)
+ {
+ alc = bfd_malloc (p - name + 1);
+ memcpy (alc, name, p - name);
+ alc[p - name] = '\0';
+ name = alc;
+ }
+
+ /* Compute the hash value. */
+ ha = bfd_elf_hash (name);
+
+ /* Store the found hash value in the array given as the argument. */
+ *(*valuep)++ = ha;
- /* Find the related sections if they have been created */
- if (lsect->bss_name && !lsect->bss_section)
- lsect->bss_section = bfd_get_section_by_name (dynobj, lsect->bss_name);
+ /* And store it in the struct so that we can put it in the hash table
+ later. */
+ h->elf_hash_value = ha;
+
+ if (alc != NULL)
+ free (alc);
+
+ return TRUE;
+}
+
+/* Array used to determine the number of hash table buckets to use
+ based on the number of symbols there are. If there are fewer than
+ 3 symbols we use 1 bucket, fewer than 17 symbols we use 3 buckets,
+ fewer than 37 we use 17 buckets, and so forth. We never use more
+ than 32771 buckets. */
+
+static const size_t elf_buckets[] =
+{
+ 1, 3, 17, 37, 67, 97, 131, 197, 263, 521, 1031, 2053, 4099, 8209,
+ 16411, 32771, 0
+};
+
+/* Compute bucket count for hashing table. We do not use a static set
+ of possible tables sizes anymore. Instead we determine for all
+ possible reasonable sizes of the table the outcome (i.e., the
+ number of collisions etc) and choose the best solution. The
+ weighting functions are not too simple to allow the table to grow
+ without bounds. Instead one of the weighting factors is the size.
+ Therefore the result is always a good payoff between few collisions
+ (= short chain lengths) and table size. */
+static size_t
+compute_bucket_count (struct bfd_link_info *info)
+{
+ size_t dynsymcount = elf_hash_table (info)->dynsymcount;
+ size_t best_size = 0;
+ unsigned long int *hashcodes;
+ unsigned long int *hashcodesp;
+ unsigned long int i;
+ bfd_size_type amt;
+
+ /* Compute the hash values for all exported symbols. At the same
+ time store the values in an array so that we could use them for
+ optimizations. */
+ amt = dynsymcount;
+ amt *= sizeof (unsigned long int);
+ hashcodes = bfd_malloc (amt);
+ if (hashcodes == NULL)
+ return 0;
+ hashcodesp = hashcodes;
+
+ /* Put all hash values in HASHCODES. */
+ elf_link_hash_traverse (elf_hash_table (info),
+ elf_collect_hash_codes, &hashcodesp);
+
+ /* We have a problem here. The following code to optimize the table
+ size requires an integer type with more the 32 bits. If
+ BFD_HOST_U_64_BIT is set we know about such a type. */
+#ifdef BFD_HOST_U_64_BIT
+ if (info->optimize)
+ {
+ unsigned long int nsyms = hashcodesp - hashcodes;
+ size_t minsize;
+ size_t maxsize;
+ BFD_HOST_U_64_BIT best_chlen = ~((BFD_HOST_U_64_BIT) 0);
+ unsigned long int *counts ;
+ bfd *dynobj = elf_hash_table (info)->dynobj;
+ const struct elf_backend_data *bed = get_elf_backend_data (dynobj);
+
+ /* Possible optimization parameters: if we have NSYMS symbols we say
+ that the hashing table must at least have NSYMS/4 and at most
+ 2*NSYMS buckets. */
+ minsize = nsyms / 4;
+ if (minsize == 0)
+ minsize = 1;
+ best_size = maxsize = nsyms * 2;
+
+ /* Create array where we count the collisions in. We must use bfd_malloc
+ since the size could be large. */
+ amt = maxsize;
+ amt *= sizeof (unsigned long int);
+ counts = bfd_malloc (amt);
+ if (counts == NULL)
+ {
+ free (hashcodes);
+ return 0;
+ }
+
+ /* Compute the "optimal" size for the hash table. The criteria is a
+ minimal chain length. The minor criteria is (of course) the size
+ of the table. */
+ for (i = minsize; i < maxsize; ++i)
+ {
+ /* Walk through the array of hashcodes and count the collisions. */
+ BFD_HOST_U_64_BIT max;
+ unsigned long int j;
+ unsigned long int fact;
+
+ memset (counts, '\0', i * sizeof (unsigned long int));
+
+ /* Determine how often each hash bucket is used. */
+ for (j = 0; j < nsyms; ++j)
+ ++counts[hashcodes[j] % i];
+
+ /* For the weight function we need some information about the
+ pagesize on the target. This is information need not be 100%
+ accurate. Since this information is not available (so far) we
+ define it here to a reasonable default value. If it is crucial
+ to have a better value some day simply define this value. */
+# ifndef BFD_TARGET_PAGESIZE
+# define BFD_TARGET_PAGESIZE (4096)
+# endif
+
+ /* We in any case need 2 + NSYMS entries for the size values and
+ the chains. */
+ max = (2 + nsyms) * (bed->s->arch_size / 8);
+
+# if 1
+ /* Variant 1: optimize for short chains. We add the squares
+ of all the chain lengths (which favors many small chain
+ over a few long chains). */
+ for (j = 0; j < i; ++j)
+ max += counts[j] * counts[j];
+
+ /* This adds penalties for the overall size of the table. */
+ fact = i / (BFD_TARGET_PAGESIZE / (bed->s->arch_size / 8)) + 1;
+ max *= fact * fact;
+# else
+ /* Variant 2: Optimize a lot more for small table. Here we
+ also add squares of the size but we also add penalties for
+ empty slots (the +1 term). */
+ for (j = 0; j < i; ++j)
+ max += (1 + counts[j]) * (1 + counts[j]);
+
+ /* The overall size of the table is considered, but not as
+ strong as in variant 1, where it is squared. */
+ fact = i / (BFD_TARGET_PAGESIZE / (bed->s->arch_size / 8)) + 1;
+ max *= fact;
+# endif
+
+ /* Compare with current best results. */
+ if (max < best_chlen)
+ {
+ best_chlen = max;
+ best_size = i;
+ }
+ }
+
+ free (counts);
+ }
+ else
+#endif /* defined (BFD_HOST_U_64_BIT) */
+ {
+ /* This is the fallback solution if no 64bit type is available or if we
+ are not supposed to spend much time on optimizations. We select the
+ bucket count using a fixed set of numbers. */
+ for (i = 0; elf_buckets[i] != 0; i++)
+ {
+ best_size = elf_buckets[i];
+ if (dynsymcount < elf_buckets[i + 1])
+ break;
+ }
+ }
+
+ /* Free the arrays we needed. */
+ free (hashcodes);
+
+ return best_size;
+}
- if (lsect->rel_name && !lsect->rel_section)
- lsect->rel_section = bfd_get_section_by_name (dynobj, lsect->rel_name);
+/* Set up the sizes and contents of the ELF dynamic sections. This is
+ called by the ELF linker emulation before_allocation routine. We
+ must set the sizes of the sections before the linker sets the
+ addresses of the various sections. */
+
+bfd_boolean
+bfd_elf_size_dynamic_sections (bfd *output_bfd,
+ const char *soname,
+ const char *rpath,
+ const char *filter_shlib,
+ const char * const *auxiliary_filters,
+ struct bfd_link_info *info,
+ asection **sinterpptr,
+ struct bfd_elf_version_tree *verdefs)
+{
+ bfd_size_type soname_indx;
+ bfd *dynobj;
+ const struct elf_backend_data *bed;
+ struct elf_assign_sym_version_info asvinfo;
+
+ *sinterpptr = NULL;
+
+ soname_indx = (bfd_size_type) -1;
+
+ if (!is_elf_hash_table (info->hash))
+ return TRUE;
+
+ if (info->execstack)
+ elf_tdata (output_bfd)->stack_flags = PF_R | PF_W | PF_X;
+ else if (info->noexecstack)
+ elf_tdata (output_bfd)->stack_flags = PF_R | PF_W;
+ else
+ {
+ bfd *inputobj;
+ asection *notesec = NULL;
+ int exec = 0;
+
+ for (inputobj = info->input_bfds;
+ inputobj;
+ inputobj = inputobj->link_next)
+ {
+ asection *s;
+
+ if (inputobj->flags & DYNAMIC)
+ continue;
+ s = bfd_get_section_by_name (inputobj, ".note.GNU-stack");
+ if (s)
+ {
+ if (s->flags & SEC_CODE)
+ exec = PF_X;
+ notesec = s;
+ }
+ else
+ exec = PF_X;
+ }
+ if (notesec)
+ {
+ elf_tdata (output_bfd)->stack_flags = PF_R | PF_W | exec;
+ if (exec && info->relocatable
+ && notesec->output_section != bfd_abs_section_ptr)
+ notesec->output_section->flags |= SEC_CODE;
+ }
+ }
+
+ /* Any syms created from now on start with -1 in
+ got.refcount/offset and plt.refcount/offset. */
+ elf_hash_table (info)->init_refcount = elf_hash_table (info)->init_offset;
+
+ /* The backend may have to create some sections regardless of whether
+ we're dynamic or not. */
+ bed = get_elf_backend_data (output_bfd);
+ if (bed->elf_backend_always_size_sections
+ && ! (*bed->elf_backend_always_size_sections) (output_bfd, info))
+ return FALSE;
+
+ dynobj = elf_hash_table (info)->dynobj;
+
+ /* If there were no dynamic objects in the link, there is nothing to
+ do here. */
+ if (dynobj == NULL)
+ return TRUE;
+
+ if (! _bfd_elf_maybe_strip_eh_frame_hdr (info))
+ return FALSE;
+
+ if (elf_hash_table (info)->dynamic_sections_created)
+ {
+ struct elf_info_failed eif;
+ struct elf_link_hash_entry *h;
+ asection *dynstr;
+ struct bfd_elf_version_tree *t;
+ struct bfd_elf_version_expr *d;
+ bfd_boolean all_defined;
+
+ *sinterpptr = bfd_get_section_by_name (dynobj, ".interp");
+ BFD_ASSERT (*sinterpptr != NULL || !info->executable);
+
+ if (soname != NULL)
+ {
+ soname_indx = _bfd_elf_strtab_add (elf_hash_table (info)->dynstr,
+ soname, TRUE);
+ if (soname_indx == (bfd_size_type) -1
+ || !_bfd_elf_add_dynamic_entry (info, DT_SONAME, soname_indx))
+ return FALSE;
+ }
+
+ if (info->symbolic)
+ {
+ if (!_bfd_elf_add_dynamic_entry (info, DT_SYMBOLIC, 0))
+ return FALSE;
+ info->flags |= DF_SYMBOLIC;
+ }
+
+ if (rpath != NULL)
+ {
+ bfd_size_type indx;
+
+ indx = _bfd_elf_strtab_add (elf_hash_table (info)->dynstr, rpath,
+ TRUE);
+ if (indx == (bfd_size_type) -1
+ || !_bfd_elf_add_dynamic_entry (info, DT_RPATH, indx))
+ return FALSE;
+
+ if (info->new_dtags)
+ {
+ _bfd_elf_strtab_addref (elf_hash_table (info)->dynstr, indx);
+ if (!_bfd_elf_add_dynamic_entry (info, DT_RUNPATH, indx))
+ return FALSE;
+ }
+ }
+
+ if (filter_shlib != NULL)
+ {
+ bfd_size_type indx;
+
+ indx = _bfd_elf_strtab_add (elf_hash_table (info)->dynstr,
+ filter_shlib, TRUE);
+ if (indx == (bfd_size_type) -1
+ || !_bfd_elf_add_dynamic_entry (info, DT_FILTER, indx))
+ return FALSE;
+ }
+
+ if (auxiliary_filters != NULL)
+ {
+ const char * const *p;
+
+ for (p = auxiliary_filters; *p != NULL; p++)
+ {
+ bfd_size_type indx;
+
+ indx = _bfd_elf_strtab_add (elf_hash_table (info)->dynstr,
+ *p, TRUE);
+ if (indx == (bfd_size_type) -1
+ || !_bfd_elf_add_dynamic_entry (info, DT_AUXILIARY, indx))
+ return FALSE;
+ }
+ }
+
+ eif.info = info;
+ eif.verdefs = verdefs;
+ eif.failed = FALSE;
+
+ /* If we are supposed to export all symbols into the dynamic symbol
+ table (this is not the normal case), then do so. */
+ if (info->export_dynamic)
+ {
+ elf_link_hash_traverse (elf_hash_table (info),
+ _bfd_elf_export_symbol,
+ &eif);
+ if (eif.failed)
+ return FALSE;
+ }
+
+ /* Make all global versions with definition. */
+ for (t = verdefs; t != NULL; t = t->next)
+ for (d = t->globals.list; d != NULL; d = d->next)
+ if (!d->symver && d->symbol)
+ {
+ const char *verstr, *name;
+ size_t namelen, verlen, newlen;
+ char *newname, *p;
+ struct elf_link_hash_entry *newh;
+
+ name = d->symbol;
+ namelen = strlen (name);
+ verstr = t->name;
+ verlen = strlen (verstr);
+ newlen = namelen + verlen + 3;
+
+ newname = bfd_malloc (newlen);
+ if (newname == NULL)
+ return FALSE;
+ memcpy (newname, name, namelen);
+
+ /* Check the hidden versioned definition. */
+ p = newname + namelen;
+ *p++ = ELF_VER_CHR;
+ memcpy (p, verstr, verlen + 1);
+ newh = elf_link_hash_lookup (elf_hash_table (info),
+ newname, FALSE, FALSE,
+ FALSE);
+ if (newh == NULL
+ || (newh->root.type != bfd_link_hash_defined
+ && newh->root.type != bfd_link_hash_defweak))
+ {
+ /* Check the default versioned definition. */
+ *p++ = ELF_VER_CHR;
+ memcpy (p, verstr, verlen + 1);
+ newh = elf_link_hash_lookup (elf_hash_table (info),
+ newname, FALSE, FALSE,
+ FALSE);
+ }
+ free (newname);
+
+ /* Mark this version if there is a definition and it is
+ not defined in a shared object. */
+ if (newh != NULL
+ && ((newh->elf_link_hash_flags
+ & ELF_LINK_HASH_DEF_DYNAMIC) == 0)
+ && (newh->root.type == bfd_link_hash_defined
+ || newh->root.type == bfd_link_hash_defweak))
+ d->symver = 1;
+ }
+
+ /* Attach all the symbols to their version information. */
+ asvinfo.output_bfd = output_bfd;
+ asvinfo.info = info;
+ asvinfo.verdefs = verdefs;
+ asvinfo.failed = FALSE;
+
+ elf_link_hash_traverse (elf_hash_table (info),
+ _bfd_elf_link_assign_sym_version,
+ &asvinfo);
+ if (asvinfo.failed)
+ return FALSE;
+
+ if (!info->allow_undefined_version)
+ {
+ /* Check if all global versions have a definition. */
+ all_defined = TRUE;
+ for (t = verdefs; t != NULL; t = t->next)
+ for (d = t->globals.list; d != NULL; d = d->next)
+ if (!d->symver && !d->script)
+ {
+ (*_bfd_error_handler)
+ (_("%s: undefined version: %s"),
+ d->pattern, t->name);
+ all_defined = FALSE;
+ }
+
+ if (!all_defined)
+ {
+ bfd_set_error (bfd_error_bad_value);
+ return FALSE;
+ }
+ }
+
+ /* Find all symbols which were defined in a dynamic object and make
+ the backend pick a reasonable value for them. */
+ elf_link_hash_traverse (elf_hash_table (info),
+ _bfd_elf_adjust_dynamic_symbol,
+ &eif);
+ if (eif.failed)
+ return FALSE;
+
+ /* Add some entries to the .dynamic section. We fill in some of the
+ values later, in elf_bfd_final_link, but we must add the entries
+ now so that we know the final size of the .dynamic section. */
+
+ /* If there are initialization and/or finalization functions to
+ call then add the corresponding DT_INIT/DT_FINI entries. */
+ h = (info->init_function
+ ? elf_link_hash_lookup (elf_hash_table (info),
+ info->init_function, FALSE,
+ FALSE, FALSE)
+ : NULL);
+ if (h != NULL
+ && (h->elf_link_hash_flags & (ELF_LINK_HASH_REF_REGULAR
+ | ELF_LINK_HASH_DEF_REGULAR)) != 0)
+ {
+ if (!_bfd_elf_add_dynamic_entry (info, DT_INIT, 0))
+ return FALSE;
+ }
+ h = (info->fini_function
+ ? elf_link_hash_lookup (elf_hash_table (info),
+ info->fini_function, FALSE,
+ FALSE, FALSE)
+ : NULL);
+ if (h != NULL
+ && (h->elf_link_hash_flags & (ELF_LINK_HASH_REF_REGULAR
+ | ELF_LINK_HASH_DEF_REGULAR)) != 0)
+ {
+ if (!_bfd_elf_add_dynamic_entry (info, DT_FINI, 0))
+ return FALSE;
+ }
+
+ if (bfd_get_section_by_name (output_bfd, ".preinit_array") != NULL)
+ {
+ /* DT_PREINIT_ARRAY is not allowed in shared library. */
+ if (! info->executable)
+ {
+ bfd *sub;
+ asection *o;
+
+ for (sub = info->input_bfds; sub != NULL;
+ sub = sub->link_next)
+ for (o = sub->sections; o != NULL; o = o->next)
+ if (elf_section_data (o)->this_hdr.sh_type
+ == SHT_PREINIT_ARRAY)
+ {
+ (*_bfd_error_handler)
+ (_("%s: .preinit_array section is not allowed in DSO"),
+ bfd_archive_filename (sub));
+ break;
+ }
+
+ bfd_set_error (bfd_error_nonrepresentable_section);
+ return FALSE;
+ }
+
+ if (!_bfd_elf_add_dynamic_entry (info, DT_PREINIT_ARRAY, 0)
+ || !_bfd_elf_add_dynamic_entry (info, DT_PREINIT_ARRAYSZ, 0))
+ return FALSE;
+ }
+ if (bfd_get_section_by_name (output_bfd, ".init_array") != NULL)
+ {
+ if (!_bfd_elf_add_dynamic_entry (info, DT_INIT_ARRAY, 0)
+ || !_bfd_elf_add_dynamic_entry (info, DT_INIT_ARRAYSZ, 0))
+ return FALSE;
+ }
+ if (bfd_get_section_by_name (output_bfd, ".fini_array") != NULL)
+ {
+ if (!_bfd_elf_add_dynamic_entry (info, DT_FINI_ARRAY, 0)
+ || !_bfd_elf_add_dynamic_entry (info, DT_FINI_ARRAYSZ, 0))
+ return FALSE;
+ }
+
+ dynstr = bfd_get_section_by_name (dynobj, ".dynstr");
+ /* If .dynstr is excluded from the link, we don't want any of
+ these tags. Strictly, we should be checking each section
+ individually; This quick check covers for the case where
+ someone does a /DISCARD/ : { *(*) }. */
+ if (dynstr != NULL && dynstr->output_section != bfd_abs_section_ptr)
+ {
+ bfd_size_type strsize;
+
+ strsize = _bfd_elf_strtab_size (elf_hash_table (info)->dynstr);
+ if (!_bfd_elf_add_dynamic_entry (info, DT_HASH, 0)
+ || !_bfd_elf_add_dynamic_entry (info, DT_STRTAB, 0)
+ || !_bfd_elf_add_dynamic_entry (info, DT_SYMTAB, 0)
+ || !_bfd_elf_add_dynamic_entry (info, DT_STRSZ, strsize)
+ || !_bfd_elf_add_dynamic_entry (info, DT_SYMENT,
+ bed->s->sizeof_sym))
+ return FALSE;
+ }
+ }
+
+ /* The backend must work out the sizes of all the other dynamic
+ sections. */
+ if (bed->elf_backend_size_dynamic_sections
+ && ! (*bed->elf_backend_size_dynamic_sections) (output_bfd, info))
+ return FALSE;
+
+ if (elf_hash_table (info)->dynamic_sections_created)
+ {
+ bfd_size_type dynsymcount;
+ asection *s;
+ size_t bucketcount = 0;
+ size_t hash_entry_size;
+ unsigned int dtagcount;
+
+ /* Set up the version definition section. */
+ s = bfd_get_section_by_name (dynobj, ".gnu.version_d");
+ BFD_ASSERT (s != NULL);
+
+ /* We may have created additional version definitions if we are
+ just linking a regular application. */
+ verdefs = asvinfo.verdefs;
+
+ /* Skip anonymous version tag. */
+ if (verdefs != NULL && verdefs->vernum == 0)
+ verdefs = verdefs->next;
+
+ if (verdefs == NULL)
+ _bfd_strip_section_from_output (info, s);
+ else
+ {
+ unsigned int cdefs;
+ bfd_size_type size;
+ struct bfd_elf_version_tree *t;
+ bfd_byte *p;
+ Elf_Internal_Verdef def;
+ Elf_Internal_Verdaux defaux;
+
+ cdefs = 0;
+ size = 0;
+
+ /* Make space for the base version. */
+ size += sizeof (Elf_External_Verdef);
+ size += sizeof (Elf_External_Verdaux);
+ ++cdefs;
+
+ for (t = verdefs; t != NULL; t = t->next)
+ {
+ struct bfd_elf_version_deps *n;
+
+ size += sizeof (Elf_External_Verdef);
+ size += sizeof (Elf_External_Verdaux);
+ ++cdefs;
+
+ for (n = t->deps; n != NULL; n = n->next)
+ size += sizeof (Elf_External_Verdaux);
+ }
+
+ s->_raw_size = size;
+ s->contents = bfd_alloc (output_bfd, s->_raw_size);
+ if (s->contents == NULL && s->_raw_size != 0)
+ return FALSE;
+
+ /* Fill in the version definition section. */
+
+ p = s->contents;
+
+ def.vd_version = VER_DEF_CURRENT;
+ def.vd_flags = VER_FLG_BASE;
+ def.vd_ndx = 1;
+ def.vd_cnt = 1;
+ def.vd_aux = sizeof (Elf_External_Verdef);
+ def.vd_next = (sizeof (Elf_External_Verdef)
+ + sizeof (Elf_External_Verdaux));
+
+ if (soname_indx != (bfd_size_type) -1)
+ {
+ _bfd_elf_strtab_addref (elf_hash_table (info)->dynstr,
+ soname_indx);
+ def.vd_hash = bfd_elf_hash (soname);
+ defaux.vda_name = soname_indx;
+ }
+ else
+ {
+ const char *name;
+ bfd_size_type indx;
+
+ name = basename (output_bfd->filename);
+ def.vd_hash = bfd_elf_hash (name);
+ indx = _bfd_elf_strtab_add (elf_hash_table (info)->dynstr,
+ name, FALSE);
+ if (indx == (bfd_size_type) -1)
+ return FALSE;
+ defaux.vda_name = indx;
+ }
+ defaux.vda_next = 0;
+
+ _bfd_elf_swap_verdef_out (output_bfd, &def,
+ (Elf_External_Verdef *) p);
+ p += sizeof (Elf_External_Verdef);
+ _bfd_elf_swap_verdaux_out (output_bfd, &defaux,
+ (Elf_External_Verdaux *) p);
+ p += sizeof (Elf_External_Verdaux);
+
+ for (t = verdefs; t != NULL; t = t->next)
+ {
+ unsigned int cdeps;
+ struct bfd_elf_version_deps *n;
+ struct elf_link_hash_entry *h;
+ struct bfd_link_hash_entry *bh;
+
+ cdeps = 0;
+ for (n = t->deps; n != NULL; n = n->next)
+ ++cdeps;
+
+ /* Add a symbol representing this version. */
+ bh = NULL;
+ if (! (_bfd_generic_link_add_one_symbol
+ (info, dynobj, t->name, BSF_GLOBAL, bfd_abs_section_ptr,
+ 0, NULL, FALSE,
+ get_elf_backend_data (dynobj)->collect, &bh)))
+ return FALSE;
+ h = (struct elf_link_hash_entry *) bh;
+ h->elf_link_hash_flags &= ~ ELF_LINK_NON_ELF;
+ h->elf_link_hash_flags |= ELF_LINK_HASH_DEF_REGULAR;
+ h->type = STT_OBJECT;
+ h->verinfo.vertree = t;
+
+ if (! bfd_elf_link_record_dynamic_symbol (info, h))
+ return FALSE;
+
+ def.vd_version = VER_DEF_CURRENT;
+ def.vd_flags = 0;
+ if (t->globals.list == NULL
+ && t->locals.list == NULL
+ && ! t->used)
+ def.vd_flags |= VER_FLG_WEAK;
+ def.vd_ndx = t->vernum + 1;
+ def.vd_cnt = cdeps + 1;
+ def.vd_hash = bfd_elf_hash (t->name);
+ def.vd_aux = sizeof (Elf_External_Verdef);
+ def.vd_next = 0;
+ if (t->next != NULL)
+ def.vd_next = (sizeof (Elf_External_Verdef)
+ + (cdeps + 1) * sizeof (Elf_External_Verdaux));
+
+ _bfd_elf_swap_verdef_out (output_bfd, &def,
+ (Elf_External_Verdef *) p);
+ p += sizeof (Elf_External_Verdef);
+
+ defaux.vda_name = h->dynstr_index;
+ _bfd_elf_strtab_addref (elf_hash_table (info)->dynstr,
+ h->dynstr_index);
+ defaux.vda_next = 0;
+ if (t->deps != NULL)
+ defaux.vda_next = sizeof (Elf_External_Verdaux);
+ t->name_indx = defaux.vda_name;
+
+ _bfd_elf_swap_verdaux_out (output_bfd, &defaux,
+ (Elf_External_Verdaux *) p);
+ p += sizeof (Elf_External_Verdaux);
+
+ for (n = t->deps; n != NULL; n = n->next)
+ {
+ if (n->version_needed == NULL)
+ {
+ /* This can happen if there was an error in the
+ version script. */
+ defaux.vda_name = 0;
+ }
+ else
+ {
+ defaux.vda_name = n->version_needed->name_indx;
+ _bfd_elf_strtab_addref (elf_hash_table (info)->dynstr,
+ defaux.vda_name);
+ }
+ if (n->next == NULL)
+ defaux.vda_next = 0;
+ else
+ defaux.vda_next = sizeof (Elf_External_Verdaux);
+
+ _bfd_elf_swap_verdaux_out (output_bfd, &defaux,
+ (Elf_External_Verdaux *) p);
+ p += sizeof (Elf_External_Verdaux);
+ }
+ }
+
+ if (!_bfd_elf_add_dynamic_entry (info, DT_VERDEF, 0)
+ || !_bfd_elf_add_dynamic_entry (info, DT_VERDEFNUM, cdefs))
+ return FALSE;
+
+ elf_tdata (output_bfd)->cverdefs = cdefs;
+ }
+
+ if ((info->new_dtags && info->flags) || (info->flags & DF_STATIC_TLS))
+ {
+ if (!_bfd_elf_add_dynamic_entry (info, DT_FLAGS, info->flags))
+ return FALSE;
+ }
+ else if (info->flags & DF_BIND_NOW)
+ {
+ if (!_bfd_elf_add_dynamic_entry (info, DT_BIND_NOW, 0))
+ return FALSE;
+ }
+
+ if (info->flags_1)
+ {
+ if (info->executable)
+ info->flags_1 &= ~ (DF_1_INITFIRST
+ | DF_1_NODELETE
+ | DF_1_NOOPEN);
+ if (!_bfd_elf_add_dynamic_entry (info, DT_FLAGS_1, info->flags_1))
+ return FALSE;
+ }
+
+ /* Work out the size of the version reference section. */
+
+ s = bfd_get_section_by_name (dynobj, ".gnu.version_r");
+ BFD_ASSERT (s != NULL);
+ {
+ struct elf_find_verdep_info sinfo;
+
+ sinfo.output_bfd = output_bfd;
+ sinfo.info = info;
+ sinfo.vers = elf_tdata (output_bfd)->cverdefs;
+ if (sinfo.vers == 0)
+ sinfo.vers = 1;
+ sinfo.failed = FALSE;
+
+ elf_link_hash_traverse (elf_hash_table (info),
+ _bfd_elf_link_find_version_dependencies,
+ &sinfo);
+
+ if (elf_tdata (output_bfd)->verref == NULL)
+ _bfd_strip_section_from_output (info, s);
+ else
+ {
+ Elf_Internal_Verneed *t;
+ unsigned int size;
+ unsigned int crefs;
+ bfd_byte *p;
+
+ /* Build the version definition section. */
+ size = 0;
+ crefs = 0;
+ for (t = elf_tdata (output_bfd)->verref;
+ t != NULL;
+ t = t->vn_nextref)
+ {
+ Elf_Internal_Vernaux *a;
+
+ size += sizeof (Elf_External_Verneed);
+ ++crefs;
+ for (a = t->vn_auxptr; a != NULL; a = a->vna_nextptr)
+ size += sizeof (Elf_External_Vernaux);
+ }
+
+ s->_raw_size = size;
+ s->contents = bfd_alloc (output_bfd, s->_raw_size);
+ if (s->contents == NULL)
+ return FALSE;
+
+ p = s->contents;
+ for (t = elf_tdata (output_bfd)->verref;
+ t != NULL;
+ t = t->vn_nextref)
+ {
+ unsigned int caux;
+ Elf_Internal_Vernaux *a;
+ bfd_size_type indx;
+
+ caux = 0;
+ for (a = t->vn_auxptr; a != NULL; a = a->vna_nextptr)
+ ++caux;
+
+ t->vn_version = VER_NEED_CURRENT;
+ t->vn_cnt = caux;
+ indx = _bfd_elf_strtab_add (elf_hash_table (info)->dynstr,
+ elf_dt_name (t->vn_bfd) != NULL
+ ? elf_dt_name (t->vn_bfd)
+ : basename (t->vn_bfd->filename),
+ FALSE);
+ if (indx == (bfd_size_type) -1)
+ return FALSE;
+ t->vn_file = indx;
+ t->vn_aux = sizeof (Elf_External_Verneed);
+ if (t->vn_nextref == NULL)
+ t->vn_next = 0;
+ else
+ t->vn_next = (sizeof (Elf_External_Verneed)
+ + caux * sizeof (Elf_External_Vernaux));
+
+ _bfd_elf_swap_verneed_out (output_bfd, t,
+ (Elf_External_Verneed *) p);
+ p += sizeof (Elf_External_Verneed);
+
+ for (a = t->vn_auxptr; a != NULL; a = a->vna_nextptr)
+ {
+ a->vna_hash = bfd_elf_hash (a->vna_nodename);
+ indx = _bfd_elf_strtab_add (elf_hash_table (info)->dynstr,
+ a->vna_nodename, FALSE);
+ if (indx == (bfd_size_type) -1)
+ return FALSE;
+ a->vna_name = indx;
+ if (a->vna_nextptr == NULL)
+ a->vna_next = 0;
+ else
+ a->vna_next = sizeof (Elf_External_Vernaux);
+
+ _bfd_elf_swap_vernaux_out (output_bfd, a,
+ (Elf_External_Vernaux *) p);
+ p += sizeof (Elf_External_Vernaux);
+ }
+ }
+
+ if (!_bfd_elf_add_dynamic_entry (info, DT_VERNEED, 0)
+ || !_bfd_elf_add_dynamic_entry (info, DT_VERNEEDNUM, crefs))
+ return FALSE;
+
+ elf_tdata (output_bfd)->cverrefs = crefs;
+ }
+ }
+
+ /* Assign dynsym indicies. In a shared library we generate a
+ section symbol for each output section, which come first.
+ Next come all of the back-end allocated local dynamic syms,
+ followed by the rest of the global symbols. */
+
+ dynsymcount = _bfd_elf_link_renumber_dynsyms (output_bfd, info);
+
+ /* Work out the size of the symbol version section. */
+ s = bfd_get_section_by_name (dynobj, ".gnu.version");
+ BFD_ASSERT (s != NULL);
+ if (dynsymcount == 0
+ || (verdefs == NULL && elf_tdata (output_bfd)->verref == NULL))
+ {
+ _bfd_strip_section_from_output (info, s);
+ /* The DYNSYMCOUNT might have changed if we were going to
+ output a dynamic symbol table entry for S. */
+ dynsymcount = _bfd_elf_link_renumber_dynsyms (output_bfd, info);
+ }
+ else
+ {
+ s->_raw_size = dynsymcount * sizeof (Elf_External_Versym);
+ s->contents = bfd_zalloc (output_bfd, s->_raw_size);
+ if (s->contents == NULL)
+ return FALSE;
+
+ if (!_bfd_elf_add_dynamic_entry (info, DT_VERSYM, 0))
+ return FALSE;
+ }
+
+ /* Set the size of the .dynsym and .hash sections. We counted
+ the number of dynamic symbols in elf_link_add_object_symbols.
+ We will build the contents of .dynsym and .hash when we build
+ the final symbol table, because until then we do not know the
+ correct value to give the symbols. We built the .dynstr
+ section as we went along in elf_link_add_object_symbols. */
+ s = bfd_get_section_by_name (dynobj, ".dynsym");
+ BFD_ASSERT (s != NULL);
+ s->_raw_size = dynsymcount * bed->s->sizeof_sym;
+ s->contents = bfd_alloc (output_bfd, s->_raw_size);
+ if (s->contents == NULL && s->_raw_size != 0)
+ return FALSE;
+
+ if (dynsymcount != 0)
+ {
+ Elf_Internal_Sym isym;
+
+ /* The first entry in .dynsym is a dummy symbol. */
+ isym.st_value = 0;
+ isym.st_size = 0;
+ isym.st_name = 0;
+ isym.st_info = 0;
+ isym.st_other = 0;
+ isym.st_shndx = 0;
+ bed->s->swap_symbol_out (output_bfd, &isym, s->contents, 0);
+ }
+
+ /* Compute the size of the hashing table. As a side effect this
+ computes the hash values for all the names we export. */
+ bucketcount = compute_bucket_count (info);
+
+ s = bfd_get_section_by_name (dynobj, ".hash");
+ BFD_ASSERT (s != NULL);
+ hash_entry_size = elf_section_data (s)->this_hdr.sh_entsize;
+ s->_raw_size = ((2 + bucketcount + dynsymcount) * hash_entry_size);
+ s->contents = bfd_zalloc (output_bfd, s->_raw_size);
+ if (s->contents == NULL)
+ return FALSE;
+
+ bfd_put (8 * hash_entry_size, output_bfd, bucketcount, s->contents);
+ bfd_put (8 * hash_entry_size, output_bfd, dynsymcount,
+ s->contents + hash_entry_size);
+
+ elf_hash_table (info)->bucketcount = bucketcount;
+
+ s = bfd_get_section_by_name (dynobj, ".dynstr");
+ BFD_ASSERT (s != NULL);
+
+ elf_finalize_dynstr (output_bfd, info);
+
+ s->_raw_size = _bfd_elf_strtab_size (elf_hash_table (info)->dynstr);
+
+ for (dtagcount = 0; dtagcount <= info->spare_dynamic_tags; ++dtagcount)
+ if (!_bfd_elf_add_dynamic_entry (info, DT_NULL, 0))
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+/* Final phase of ELF linker. */
+
+/* A structure we use to avoid passing large numbers of arguments. */
+
+struct elf_final_link_info
+{
+ /* General link information. */
+ struct bfd_link_info *info;
+ /* Output BFD. */
+ bfd *output_bfd;
+ /* Symbol string table. */
+ struct bfd_strtab_hash *symstrtab;
+ /* .dynsym section. */
+ asection *dynsym_sec;
+ /* .hash section. */
+ asection *hash_sec;
+ /* symbol version section (.gnu.version). */
+ asection *symver_sec;
+ /* Buffer large enough to hold contents of any section. */
+ bfd_byte *contents;
+ /* Buffer large enough to hold external relocs of any section. */
+ void *external_relocs;
+ /* Buffer large enough to hold internal relocs of any section. */
+ Elf_Internal_Rela *internal_relocs;
+ /* Buffer large enough to hold external local symbols of any input
+ BFD. */
+ bfd_byte *external_syms;
+ /* And a buffer for symbol section indices. */
+ Elf_External_Sym_Shndx *locsym_shndx;
+ /* Buffer large enough to hold internal local symbols of any input
+ BFD. */
+ Elf_Internal_Sym *internal_syms;
+ /* Array large enough to hold a symbol index for each local symbol
+ of any input BFD. */
+ long *indices;
+ /* Array large enough to hold a section pointer for each local
+ symbol of any input BFD. */
+ asection **sections;
+ /* Buffer to hold swapped out symbols. */
+ bfd_byte *symbuf;
+ /* And one for symbol section indices. */
+ Elf_External_Sym_Shndx *symshndxbuf;
+ /* Number of swapped out symbols in buffer. */
+ size_t symbuf_count;
+ /* Number of symbols which fit in symbuf. */
+ size_t symbuf_size;
+ /* And same for symshndxbuf. */
+ size_t shndxbuf_size;
+};
+
+/* This struct is used to pass information to elf_link_output_extsym. */
+
+struct elf_outext_info
+{
+ bfd_boolean failed;
+ bfd_boolean localsyms;
+ struct elf_final_link_info *finfo;
+};
+
+/* When performing a relocatable link, the input relocations are
+ preserved. But, if they reference global symbols, the indices
+ referenced must be updated. Update all the relocations in
+ REL_HDR (there are COUNT of them), using the data in REL_HASH. */
+
+static void
+elf_link_adjust_relocs (bfd *abfd,
+ Elf_Internal_Shdr *rel_hdr,
+ unsigned int count,
+ struct elf_link_hash_entry **rel_hash)
+{
+ unsigned int i;
+ const struct elf_backend_data *bed = get_elf_backend_data (abfd);
+ bfd_byte *erela;
+ void (*swap_in) (bfd *, const bfd_byte *, Elf_Internal_Rela *);
+ void (*swap_out) (bfd *, const Elf_Internal_Rela *, bfd_byte *);
+ bfd_vma r_type_mask;
+ int r_sym_shift;
+
+ if (rel_hdr->sh_entsize == bed->s->sizeof_rel)
+ {
+ swap_in = bed->s->swap_reloc_in;
+ swap_out = bed->s->swap_reloc_out;
+ }
+ else if (rel_hdr->sh_entsize == bed->s->sizeof_rela)
+ {
+ swap_in = bed->s->swap_reloca_in;
+ swap_out = bed->s->swap_reloca_out;
+ }
+ else
+ abort ();
+
+ if (bed->s->int_rels_per_ext_rel > MAX_INT_RELS_PER_EXT_REL)
+ abort ();
+
+ if (bed->s->arch_size == 32)
+ {
+ r_type_mask = 0xff;
+ r_sym_shift = 8;
+ }
+ else
+ {
+ r_type_mask = 0xffffffff;
+ r_sym_shift = 32;
+ }
+
+ erela = rel_hdr->contents;
+ for (i = 0; i < count; i++, rel_hash++, erela += rel_hdr->sh_entsize)
+ {
+ Elf_Internal_Rela irela[MAX_INT_RELS_PER_EXT_REL];
+ unsigned int j;
+
+ if (*rel_hash == NULL)
+ continue;
+
+ BFD_ASSERT ((*rel_hash)->indx >= 0);
+
+ (*swap_in) (abfd, erela, irela);
+ for (j = 0; j < bed->s->int_rels_per_ext_rel; j++)
+ irela[j].r_info = ((bfd_vma) (*rel_hash)->indx << r_sym_shift
+ | (irela[j].r_info & r_type_mask));
+ (*swap_out) (abfd, irela, erela);
+ }
+}
+
+struct elf_link_sort_rela
+{
+ union {
+ bfd_vma offset;
+ bfd_vma sym_mask;
+ } u;
+ enum elf_reloc_type_class type;
+ /* We use this as an array of size int_rels_per_ext_rel. */
+ Elf_Internal_Rela rela[1];
+};
+
+static int
+elf_link_sort_cmp1 (const void *A, const void *B)
+{
+ const struct elf_link_sort_rela *a = A;
+ const struct elf_link_sort_rela *b = B;
+ int relativea, relativeb;
+
+ relativea = a->type == reloc_class_relative;
+ relativeb = b->type == reloc_class_relative;
+
+ if (relativea < relativeb)
+ return 1;
+ if (relativea > relativeb)
+ return -1;
+ if ((a->rela->r_info & a->u.sym_mask) < (b->rela->r_info & b->u.sym_mask))
+ return -1;
+ if ((a->rela->r_info & a->u.sym_mask) > (b->rela->r_info & b->u.sym_mask))
+ return 1;
+ if (a->rela->r_offset < b->rela->r_offset)
+ return -1;
+ if (a->rela->r_offset > b->rela->r_offset)
+ return 1;
+ return 0;
+}
+
+static int
+elf_link_sort_cmp2 (const void *A, const void *B)
+{
+ const struct elf_link_sort_rela *a = A;
+ const struct elf_link_sort_rela *b = B;
+ int copya, copyb;
+
+ if (a->u.offset < b->u.offset)
+ return -1;
+ if (a->u.offset > b->u.offset)
+ return 1;
+ copya = (a->type == reloc_class_copy) * 2 + (a->type == reloc_class_plt);
+ copyb = (b->type == reloc_class_copy) * 2 + (b->type == reloc_class_plt);
+ if (copya < copyb)
+ return -1;
+ if (copya > copyb)
+ return 1;
+ if (a->rela->r_offset < b->rela->r_offset)
+ return -1;
+ if (a->rela->r_offset > b->rela->r_offset)
+ return 1;
+ return 0;
+}
+
+static size_t
+elf_link_sort_relocs (bfd *abfd, struct bfd_link_info *info, asection **psec)
+{
+ asection *reldyn;
+ bfd_size_type count, size;
+ size_t i, ret, sort_elt, ext_size;
+ bfd_byte *sort, *s_non_relative, *p;
+ struct elf_link_sort_rela *sq;
+ const struct elf_backend_data *bed = get_elf_backend_data (abfd);
+ int i2e = bed->s->int_rels_per_ext_rel;
+ void (*swap_in) (bfd *, const bfd_byte *, Elf_Internal_Rela *);
+ void (*swap_out) (bfd *, const Elf_Internal_Rela *, bfd_byte *);
+ struct bfd_link_order *lo;
+ bfd_vma r_sym_mask;
+
+ reldyn = bfd_get_section_by_name (abfd, ".rela.dyn");
+ if (reldyn == NULL || reldyn->_raw_size == 0)
+ {
+ reldyn = bfd_get_section_by_name (abfd, ".rel.dyn");
+ if (reldyn == NULL || reldyn->_raw_size == 0)
+ return 0;
+ ext_size = bed->s->sizeof_rel;
+ swap_in = bed->s->swap_reloc_in;
+ swap_out = bed->s->swap_reloc_out;
+ }
+ else
+ {
+ ext_size = bed->s->sizeof_rela;
+ swap_in = bed->s->swap_reloca_in;
+ swap_out = bed->s->swap_reloca_out;
+ }
+ count = reldyn->_raw_size / ext_size;
+
+ size = 0;
+ for (lo = reldyn->link_order_head; lo != NULL; lo = lo->next)
+ if (lo->type == bfd_indirect_link_order)
+ {
+ asection *o = lo->u.indirect.section;
+ size += o->_raw_size;
+ }
+
+ if (size != reldyn->_raw_size)
+ return 0;
+
+ sort_elt = (sizeof (struct elf_link_sort_rela)
+ + (i2e - 1) * sizeof (Elf_Internal_Rela));
+ sort = bfd_zmalloc (sort_elt * count);
+ if (sort == NULL)
+ {
+ (*info->callbacks->warning)
+ (info, _("Not enough memory to sort relocations"), 0, abfd, 0, 0);
+ return 0;
+ }
+
+ if (bed->s->arch_size == 32)
+ r_sym_mask = ~(bfd_vma) 0xff;
+ else
+ r_sym_mask = ~(bfd_vma) 0xffffffff;
+
+ for (lo = reldyn->link_order_head; lo != NULL; lo = lo->next)
+ if (lo->type == bfd_indirect_link_order)
+ {
+ bfd_byte *erel, *erelend;
+ asection *o = lo->u.indirect.section;
+
+ erel = o->contents;
+ erelend = o->contents + o->_raw_size;
+ p = sort + o->output_offset / ext_size * sort_elt;
+ while (erel < erelend)
+ {
+ struct elf_link_sort_rela *s = (struct elf_link_sort_rela *) p;
+ (*swap_in) (abfd, erel, s->rela);
+ s->type = (*bed->elf_backend_reloc_type_class) (s->rela);
+ s->u.sym_mask = r_sym_mask;
+ p += sort_elt;
+ erel += ext_size;
+ }
+ }
+
+ qsort (sort, count, sort_elt, elf_link_sort_cmp1);
+
+ for (i = 0, p = sort; i < count; i++, p += sort_elt)
+ {
+ struct elf_link_sort_rela *s = (struct elf_link_sort_rela *) p;
+ if (s->type != reloc_class_relative)
+ break;
+ }
+ ret = i;
+ s_non_relative = p;
+
+ sq = (struct elf_link_sort_rela *) s_non_relative;
+ for (; i < count; i++, p += sort_elt)
+ {
+ struct elf_link_sort_rela *sp = (struct elf_link_sort_rela *) p;
+ if (((sp->rela->r_info ^ sq->rela->r_info) & r_sym_mask) != 0)
+ sq = sp;
+ sp->u.offset = sq->rela->r_offset;
+ }
+
+ qsort (s_non_relative, count - ret, sort_elt, elf_link_sort_cmp2);
+
+ for (lo = reldyn->link_order_head; lo != NULL; lo = lo->next)
+ if (lo->type == bfd_indirect_link_order)
+ {
+ bfd_byte *erel, *erelend;
+ asection *o = lo->u.indirect.section;
+
+ erel = o->contents;
+ erelend = o->contents + o->_raw_size;
+ p = sort + o->output_offset / ext_size * sort_elt;
+ while (erel < erelend)
+ {
+ struct elf_link_sort_rela *s = (struct elf_link_sort_rela *) p;
+ (*swap_out) (abfd, s->rela, erel);
+ p += sort_elt;
+ erel += ext_size;
+ }
+ }
+
+ free (sort);
+ *psec = reldyn;
+ return ret;
+}
+
+/* Flush the output symbols to the file. */
+
+static bfd_boolean
+elf_link_flush_output_syms (struct elf_final_link_info *finfo,
+ const struct elf_backend_data *bed)
+{
+ if (finfo->symbuf_count > 0)
+ {
+ Elf_Internal_Shdr *hdr;
+ file_ptr pos;
+ bfd_size_type amt;
+
+ hdr = &elf_tdata (finfo->output_bfd)->symtab_hdr;
+ pos = hdr->sh_offset + hdr->sh_size;
+ amt = finfo->symbuf_count * bed->s->sizeof_sym;
+ if (bfd_seek (finfo->output_bfd, pos, SEEK_SET) != 0
+ || bfd_bwrite (finfo->symbuf, amt, finfo->output_bfd) != amt)
+ return FALSE;
+
+ hdr->sh_size += amt;
+ finfo->symbuf_count = 0;
+ }
+
+ return TRUE;
+}
+
+/* Add a symbol to the output symbol table. */
+
+static bfd_boolean
+elf_link_output_sym (struct elf_final_link_info *finfo,
+ const char *name,
+ Elf_Internal_Sym *elfsym,
+ asection *input_sec,
+ struct elf_link_hash_entry *h)
+{
+ bfd_byte *dest;
+ Elf_External_Sym_Shndx *destshndx;
+ bfd_boolean (*output_symbol_hook)
+ (struct bfd_link_info *, const char *, Elf_Internal_Sym *, asection *,
+ struct elf_link_hash_entry *);
+ const struct elf_backend_data *bed;
+
+ bed = get_elf_backend_data (finfo->output_bfd);
+ output_symbol_hook = bed->elf_backend_link_output_symbol_hook;
+ if (output_symbol_hook != NULL)
+ {
+ if (! (*output_symbol_hook) (finfo->info, name, elfsym, input_sec, h))
+ return FALSE;
+ }
+
+ if (name == NULL || *name == '\0')
+ elfsym->st_name = 0;
+ else if (input_sec->flags & SEC_EXCLUDE)
+ elfsym->st_name = 0;
+ else
+ {
+ elfsym->st_name = (unsigned long) _bfd_stringtab_add (finfo->symstrtab,
+ name, TRUE, FALSE);
+ if (elfsym->st_name == (unsigned long) -1)
+ return FALSE;
+ }
+
+ if (finfo->symbuf_count >= finfo->symbuf_size)
+ {
+ if (! elf_link_flush_output_syms (finfo, bed))
+ return FALSE;
+ }
+
+ dest = finfo->symbuf + finfo->symbuf_count * bed->s->sizeof_sym;
+ destshndx = finfo->symshndxbuf;
+ if (destshndx != NULL)
+ {
+ if (bfd_get_symcount (finfo->output_bfd) >= finfo->shndxbuf_size)
+ {
+ bfd_size_type amt;
+
+ amt = finfo->shndxbuf_size * sizeof (Elf_External_Sym_Shndx);
+ finfo->symshndxbuf = destshndx = bfd_realloc (destshndx, amt * 2);
+ if (destshndx == NULL)
+ return FALSE;
+ memset ((char *) destshndx + amt, 0, amt);
+ finfo->shndxbuf_size *= 2;
+ }
+ destshndx += bfd_get_symcount (finfo->output_bfd);
+ }
+
+ bed->s->swap_symbol_out (finfo->output_bfd, elfsym, dest, destshndx);
+ finfo->symbuf_count += 1;
+ bfd_get_symcount (finfo->output_bfd) += 1;
+
+ return TRUE;
+}
+
+/* For DSOs loaded in via a DT_NEEDED entry, emulate ld.so in
+ allowing an unsatisfied unversioned symbol in the DSO to match a
+ versioned symbol that would normally require an explicit version.
+ We also handle the case that a DSO references a hidden symbol
+ which may be satisfied by a versioned symbol in another DSO. */
+
+static bfd_boolean
+elf_link_check_versioned_symbol (struct bfd_link_info *info,
+ const struct elf_backend_data *bed,
+ struct elf_link_hash_entry *h)
+{
+ bfd *abfd;
+ struct elf_link_loaded_list *loaded;
+
+ if (!is_elf_hash_table (info->hash))
+ return FALSE;
+
+ switch (h->root.type)
+ {
+ default:
+ abfd = NULL;
+ break;
+
+ case bfd_link_hash_undefined:
+ case bfd_link_hash_undefweak:
+ abfd = h->root.u.undef.abfd;
+ if ((abfd->flags & DYNAMIC) == 0
+ || elf_dyn_lib_class (abfd) != DYN_DT_NEEDED)
+ return FALSE;
+ break;
+
+ case bfd_link_hash_defined:
+ case bfd_link_hash_defweak:
+ abfd = h->root.u.def.section->owner;
+ break;
+
+ case bfd_link_hash_common:
+ abfd = h->root.u.c.p->section->owner;
+ break;
+ }
+ BFD_ASSERT (abfd != NULL);
+
+ for (loaded = elf_hash_table (info)->loaded;
+ loaded != NULL;
+ loaded = loaded->next)
+ {
+ bfd *input;
+ Elf_Internal_Shdr *hdr;
+ bfd_size_type symcount;
+ bfd_size_type extsymcount;
+ bfd_size_type extsymoff;
+ Elf_Internal_Shdr *versymhdr;
+ Elf_Internal_Sym *isym;
+ Elf_Internal_Sym *isymend;
+ Elf_Internal_Sym *isymbuf;
+ Elf_External_Versym *ever;
+ Elf_External_Versym *extversym;
+
+ input = loaded->abfd;
+
+ /* We check each DSO for a possible hidden versioned definition. */
+ if (input == abfd
+ || (input->flags & DYNAMIC) == 0
+ || elf_dynversym (input) == 0)
+ continue;
+
+ hdr = &elf_tdata (input)->dynsymtab_hdr;
+
+ symcount = hdr->sh_size / bed->s->sizeof_sym;
+ if (elf_bad_symtab (input))
+ {
+ extsymcount = symcount;
+ extsymoff = 0;
+ }
+ else
+ {
+ extsymcount = symcount - hdr->sh_info;
+ extsymoff = hdr->sh_info;
+ }
+
+ if (extsymcount == 0)
+ continue;
+
+ isymbuf = bfd_elf_get_elf_syms (input, hdr, extsymcount, extsymoff,
+ NULL, NULL, NULL);
+ if (isymbuf == NULL)
+ return FALSE;
+
+ /* Read in any version definitions. */
+ versymhdr = &elf_tdata (input)->dynversym_hdr;
+ extversym = bfd_malloc (versymhdr->sh_size);
+ if (extversym == NULL)
+ goto error_ret;
+
+ if (bfd_seek (input, versymhdr->sh_offset, SEEK_SET) != 0
+ || (bfd_bread (extversym, versymhdr->sh_size, input)
+ != versymhdr->sh_size))
+ {
+ free (extversym);
+ error_ret:
+ free (isymbuf);
+ return FALSE;
+ }
+
+ ever = extversym + extsymoff;
+ isymend = isymbuf + extsymcount;
+ for (isym = isymbuf; isym < isymend; isym++, ever++)
+ {
+ const char *name;
+ Elf_Internal_Versym iver;
+ unsigned short version_index;
+
+ if (ELF_ST_BIND (isym->st_info) == STB_LOCAL
+ || isym->st_shndx == SHN_UNDEF)
+ continue;
+
+ name = bfd_elf_string_from_elf_section (input,
+ hdr->sh_link,
+ isym->st_name);
+ if (strcmp (name, h->root.root.string) != 0)
+ continue;
+
+ _bfd_elf_swap_versym_in (input, ever, &iver);
+
+ if ((iver.vs_vers & VERSYM_HIDDEN) == 0)
+ {
+ /* If we have a non-hidden versioned sym, then it should
+ have provided a definition for the undefined sym. */
+ abort ();
+ }
+
+ version_index = iver.vs_vers & VERSYM_VERSION;
+ if (version_index == 1 || version_index == 2)
+ {
+ /* This is the base or first version. We can use it. */
+ free (extversym);
+ free (isymbuf);
+ return TRUE;
+ }
+ }
+
+ free (extversym);
+ free (isymbuf);
+ }
+
+ return FALSE;
+}
+
+/* Add an external symbol to the symbol table. This is called from
+ the hash table traversal routine. When generating a shared object,
+ we go through the symbol table twice. The first time we output
+ anything that might have been forced to local scope in a version
+ script. The second time we output the symbols that are still
+ global symbols. */
+
+static bfd_boolean
+elf_link_output_extsym (struct elf_link_hash_entry *h, void *data)
+{
+ struct elf_outext_info *eoinfo = data;
+ struct elf_final_link_info *finfo = eoinfo->finfo;
+ bfd_boolean strip;
+ Elf_Internal_Sym sym;
+ asection *input_sec;
+ const struct elf_backend_data *bed;
+
+ if (h->root.type == bfd_link_hash_warning)
+ {
+ h = (struct elf_link_hash_entry *) h->root.u.i.link;
+ if (h->root.type == bfd_link_hash_new)
+ return TRUE;
+ }
+
+ /* Decide whether to output this symbol in this pass. */
+ if (eoinfo->localsyms)
+ {
+ if ((h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0)
+ return TRUE;
+ }
+ else
+ {
+ if ((h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) != 0)
+ return TRUE;
+ }
+
+ bed = get_elf_backend_data (finfo->output_bfd);
+
+ /* If we have an undefined symbol reference here then it must have
+ come from a shared library that is being linked in. (Undefined
+ references in regular files have already been handled). If we
+ are reporting errors for this situation then do so now. */
+ if (h->root.type == bfd_link_hash_undefined
+ && (h->elf_link_hash_flags & ELF_LINK_HASH_REF_DYNAMIC) != 0
+ && (h->elf_link_hash_flags & ELF_LINK_HASH_REF_REGULAR) == 0
+ && ! elf_link_check_versioned_symbol (finfo->info, bed, h)
+ && finfo->info->unresolved_syms_in_shared_libs != RM_IGNORE)
+ {
+ if (! ((*finfo->info->callbacks->undefined_symbol)
+ (finfo->info, h->root.root.string, h->root.u.undef.abfd,
+ NULL, 0, finfo->info->unresolved_syms_in_shared_libs == RM_GENERATE_ERROR)))
+ {
+ eoinfo->failed = TRUE;
+ return FALSE;
+ }
+ }
+
+ /* We should also warn if a forced local symbol is referenced from
+ shared libraries. */
+ if (! finfo->info->relocatable
+ && (! finfo->info->shared)
+ && (h->elf_link_hash_flags
+ & (ELF_LINK_FORCED_LOCAL | ELF_LINK_HASH_REF_DYNAMIC | ELF_LINK_DYNAMIC_DEF | ELF_LINK_DYNAMIC_WEAK))
+ == (ELF_LINK_FORCED_LOCAL | ELF_LINK_HASH_REF_DYNAMIC)
+ && ! elf_link_check_versioned_symbol (finfo->info, bed, h))
+ {
+ (*_bfd_error_handler)
+ (_("%s: %s symbol `%s' in %s is referenced by DSO"),
+ bfd_get_filename (finfo->output_bfd),
+ ELF_ST_VISIBILITY (h->other) == STV_INTERNAL
+ ? "internal"
+ : ELF_ST_VISIBILITY (h->other) == STV_HIDDEN
+ ? "hidden" : "local",
+ h->root.root.string,
+ bfd_archive_filename (h->root.u.def.section->owner));
+ eoinfo->failed = TRUE;
+ return FALSE;
+ }
+
+ /* We don't want to output symbols that have never been mentioned by
+ a regular file, or that we have been told to strip. However, if
+ h->indx is set to -2, the symbol is used by a reloc and we must
+ output it. */
+ if (h->indx == -2)
+ strip = FALSE;
+ else if (((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) != 0
+ || (h->elf_link_hash_flags & ELF_LINK_HASH_REF_DYNAMIC) != 0)
+ && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0
+ && (h->elf_link_hash_flags & ELF_LINK_HASH_REF_REGULAR) == 0)
+ strip = TRUE;
+ else if (finfo->info->strip == strip_all)
+ strip = TRUE;
+ else if (finfo->info->strip == strip_some
+ && bfd_hash_lookup (finfo->info->keep_hash,
+ h->root.root.string, FALSE, FALSE) == NULL)
+ strip = TRUE;
+ else if (finfo->info->strip_discarded
+ && (h->root.type == bfd_link_hash_defined
+ || h->root.type == bfd_link_hash_defweak)
+ && elf_discarded_section (h->root.u.def.section))
+ strip = TRUE;
+ else
+ strip = FALSE;
+
+ /* If we're stripping it, and it's not a dynamic symbol, there's
+ nothing else to do unless it is a forced local symbol. */
+ if (strip
+ && h->dynindx == -1
+ && (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0)
+ return TRUE;
+
+ sym.st_value = 0;
+ sym.st_size = h->size;
+ sym.st_other = h->other;
+ if ((h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) != 0)
+ sym.st_info = ELF_ST_INFO (STB_LOCAL, h->type);
+ else if (h->root.type == bfd_link_hash_undefweak
+ || h->root.type == bfd_link_hash_defweak)
+ sym.st_info = ELF_ST_INFO (STB_WEAK, h->type);
+ else
+ sym.st_info = ELF_ST_INFO (STB_GLOBAL, h->type);
+
+ switch (h->root.type)
+ {
+ default:
+ case bfd_link_hash_new:
+ case bfd_link_hash_warning:
+ abort ();
+ return FALSE;
+
+ case bfd_link_hash_undefined:
+ case bfd_link_hash_undefweak:
+ input_sec = bfd_und_section_ptr;
+ sym.st_shndx = SHN_UNDEF;
+ break;
+
+ case bfd_link_hash_defined:
+ case bfd_link_hash_defweak:
+ {
+ input_sec = h->root.u.def.section;
+ if (input_sec->output_section != NULL)
+ {
+ sym.st_shndx =
+ _bfd_elf_section_from_bfd_section (finfo->output_bfd,
+ input_sec->output_section);
+ if (sym.st_shndx == SHN_BAD)
+ {
+ (*_bfd_error_handler)
+ (_("%s: could not find output section %s for input section %s"),
+ bfd_get_filename (finfo->output_bfd),
+ input_sec->output_section->name,
+ input_sec->name);
+ eoinfo->failed = TRUE;
+ return FALSE;
+ }
+
+ /* ELF symbols in relocatable files are section relative,
+ but in nonrelocatable files they are virtual
+ addresses. */
+ sym.st_value = h->root.u.def.value + input_sec->output_offset;
+ if (! finfo->info->relocatable)
+ {
+ sym.st_value += input_sec->output_section->vma;
+ if (h->type == STT_TLS)
+ {
+ /* STT_TLS symbols are relative to PT_TLS segment
+ base. */
+ BFD_ASSERT (elf_hash_table (finfo->info)->tls_sec != NULL);
+ sym.st_value -= elf_hash_table (finfo->info)->tls_sec->vma;
+ }
+ }
+ }
+ else
+ {
+ BFD_ASSERT (input_sec->owner == NULL
+ || (input_sec->owner->flags & DYNAMIC) != 0);
+ sym.st_shndx = SHN_UNDEF;
+ input_sec = bfd_und_section_ptr;
+ }
+ }
+ break;
+
+ case bfd_link_hash_common:
+ input_sec = h->root.u.c.p->section;
+ sym.st_shndx = SHN_COMMON;
+ sym.st_value = 1 << h->root.u.c.p->alignment_power;
+ break;
+
+ case bfd_link_hash_indirect:
+ /* These symbols are created by symbol versioning. They point
+ to the decorated version of the name. For example, if the
+ symbol foo@@GNU_1.2 is the default, which should be used when
+ foo is used with no version, then we add an indirect symbol
+ foo which points to foo@@GNU_1.2. We ignore these symbols,
+ since the indirected symbol is already in the hash table. */
+ return TRUE;
+ }
+
+ /* Give the processor backend a chance to tweak the symbol value,
+ and also to finish up anything that needs to be done for this
+ symbol. FIXME: Not calling elf_backend_finish_dynamic_symbol for
+ forced local syms when non-shared is due to a historical quirk. */
+ if ((h->dynindx != -1
+ || (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) != 0)
+ && ((finfo->info->shared
+ && (ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
+ || h->root.type != bfd_link_hash_undefweak))
+ || (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0)
+ && elf_hash_table (finfo->info)->dynamic_sections_created)
+ {
+ if (! ((*bed->elf_backend_finish_dynamic_symbol)
+ (finfo->output_bfd, finfo->info, h, &sym)))
+ {
+ eoinfo->failed = TRUE;
+ return FALSE;
+ }
+ }
+
+ /* If we are marking the symbol as undefined, and there are no
+ non-weak references to this symbol from a regular object, then
+ mark the symbol as weak undefined; if there are non-weak
+ references, mark the symbol as strong. We can't do this earlier,
+ because it might not be marked as undefined until the
+ finish_dynamic_symbol routine gets through with it. */
+ if (sym.st_shndx == SHN_UNDEF
+ && (h->elf_link_hash_flags & ELF_LINK_HASH_REF_REGULAR) != 0
+ && (ELF_ST_BIND (sym.st_info) == STB_GLOBAL
+ || ELF_ST_BIND (sym.st_info) == STB_WEAK))
+ {
+ int bindtype;
+
+ if ((h->elf_link_hash_flags & ELF_LINK_HASH_REF_REGULAR_NONWEAK) != 0)
+ bindtype = STB_GLOBAL;
+ else
+ bindtype = STB_WEAK;
+ sym.st_info = ELF_ST_INFO (bindtype, ELF_ST_TYPE (sym.st_info));
+ }
+
+ /* If a non-weak symbol with non-default visibility is not defined
+ locally, it is a fatal error. */
+ if (! finfo->info->relocatable
+ && ELF_ST_VISIBILITY (sym.st_other) != STV_DEFAULT
+ && ELF_ST_BIND (sym.st_info) != STB_WEAK
+ && h->root.type == bfd_link_hash_undefined
+ && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0)
+ {
+ (*_bfd_error_handler)
+ (_("%s: %s symbol `%s' isn't defined"),
+ bfd_get_filename (finfo->output_bfd),
+ ELF_ST_VISIBILITY (sym.st_other) == STV_PROTECTED
+ ? "protected"
+ : ELF_ST_VISIBILITY (sym.st_other) == STV_INTERNAL
+ ? "internal" : "hidden",
+ h->root.root.string);
+ eoinfo->failed = TRUE;
+ return FALSE;
+ }
+
+ /* If this symbol should be put in the .dynsym section, then put it
+ there now. We already know the symbol index. We also fill in
+ the entry in the .hash section. */
+ if (h->dynindx != -1
+ && elf_hash_table (finfo->info)->dynamic_sections_created)
+ {
+ size_t bucketcount;
+ size_t bucket;
+ size_t hash_entry_size;
+ bfd_byte *bucketpos;
+ bfd_vma chain;
+ bfd_byte *esym;
+
+ sym.st_name = h->dynstr_index;
+ esym = finfo->dynsym_sec->contents + h->dynindx * bed->s->sizeof_sym;
+ bed->s->swap_symbol_out (finfo->output_bfd, &sym, esym, 0);
+
+ bucketcount = elf_hash_table (finfo->info)->bucketcount;
+ bucket = h->elf_hash_value % bucketcount;
+ hash_entry_size
+ = elf_section_data (finfo->hash_sec)->this_hdr.sh_entsize;
+ bucketpos = ((bfd_byte *) finfo->hash_sec->contents
+ + (bucket + 2) * hash_entry_size);
+ chain = bfd_get (8 * hash_entry_size, finfo->output_bfd, bucketpos);
+ bfd_put (8 * hash_entry_size, finfo->output_bfd, h->dynindx, bucketpos);
+ bfd_put (8 * hash_entry_size, finfo->output_bfd, chain,
+ ((bfd_byte *) finfo->hash_sec->contents
+ + (bucketcount + 2 + h->dynindx) * hash_entry_size));
+
+ if (finfo->symver_sec != NULL && finfo->symver_sec->contents != NULL)
+ {
+ Elf_Internal_Versym iversym;
+ Elf_External_Versym *eversym;
+
+ if ((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0)
+ {
+ if (h->verinfo.verdef == NULL)
+ iversym.vs_vers = 0;
+ else
+ iversym.vs_vers = h->verinfo.verdef->vd_exp_refno + 1;
+ }
+ else
+ {
+ if (h->verinfo.vertree == NULL)
+ iversym.vs_vers = 1;
+ else
+ iversym.vs_vers = h->verinfo.vertree->vernum + 1;
+ }
+
+ if ((h->elf_link_hash_flags & ELF_LINK_HIDDEN) != 0)
+ iversym.vs_vers |= VERSYM_HIDDEN;
+
+ eversym = (Elf_External_Versym *) finfo->symver_sec->contents;
+ eversym += h->dynindx;
+ _bfd_elf_swap_versym_out (finfo->output_bfd, &iversym, eversym);
+ }
+ }
+
+ /* If we're stripping it, then it was just a dynamic symbol, and
+ there's nothing else to do. */
+ if (strip || (input_sec->flags & SEC_EXCLUDE) != 0)
+ return TRUE;
+
+ h->indx = bfd_get_symcount (finfo->output_bfd);
+
+ if (! elf_link_output_sym (finfo, h->root.root.string, &sym, input_sec, h))
+ {
+ eoinfo->failed = TRUE;
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+static bfd_boolean
+elf_section_ignore_discarded_relocs (asection *sec)
+{
+ const struct elf_backend_data *bed;
+
+ switch (sec->sec_info_type)
+ {
+ case ELF_INFO_TYPE_STABS:
+ case ELF_INFO_TYPE_EH_FRAME:
+ return TRUE;
+ default:
+ break;
+ }
+
+ bed = get_elf_backend_data (sec->owner);
+ if (bed->elf_backend_ignore_discarded_relocs != NULL
+ && (*bed->elf_backend_ignore_discarded_relocs) (sec))
+ return TRUE;
+
+ return FALSE;
+}
+
+/* Link an input file into the linker output file. This function
+ handles all the sections and relocations of the input file at once.
+ This is so that we only have to read the local symbols once, and
+ don't have to keep them in memory. */
+
+static bfd_boolean
+elf_link_input_bfd (struct elf_final_link_info *finfo, bfd *input_bfd)
+{
+ bfd_boolean (*relocate_section)
+ (bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *,
+ Elf_Internal_Rela *, Elf_Internal_Sym *, asection **);
+ bfd *output_bfd;
+ Elf_Internal_Shdr *symtab_hdr;
+ size_t locsymcount;
+ size_t extsymoff;
+ Elf_Internal_Sym *isymbuf;
+ Elf_Internal_Sym *isym;
+ Elf_Internal_Sym *isymend;
+ long *pindex;
+ asection **ppsection;
+ asection *o;
+ const struct elf_backend_data *bed;
+ bfd_boolean emit_relocs;
+ struct elf_link_hash_entry **sym_hashes;
+
+ output_bfd = finfo->output_bfd;
+ bed = get_elf_backend_data (output_bfd);
+ relocate_section = bed->elf_backend_relocate_section;
+
+ /* If this is a dynamic object, we don't want to do anything here:
+ we don't want the local symbols, and we don't want the section
+ contents. */
+ if ((input_bfd->flags & DYNAMIC) != 0)
+ return TRUE;
+
+ emit_relocs = (finfo->info->relocatable
+ || finfo->info->emitrelocations
+ || bed->elf_backend_emit_relocs);
+
+ symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr;
+ if (elf_bad_symtab (input_bfd))
+ {
+ locsymcount = symtab_hdr->sh_size / bed->s->sizeof_sym;
+ extsymoff = 0;
+ }
+ else
+ {
+ locsymcount = symtab_hdr->sh_info;
+ extsymoff = symtab_hdr->sh_info;
+ }
+
+ /* Read the local symbols. */
+ isymbuf = (Elf_Internal_Sym *) symtab_hdr->contents;
+ if (isymbuf == NULL && locsymcount != 0)
+ {
+ isymbuf = bfd_elf_get_elf_syms (input_bfd, symtab_hdr, locsymcount, 0,
+ finfo->internal_syms,
+ finfo->external_syms,
+ finfo->locsym_shndx);
+ if (isymbuf == NULL)
+ return FALSE;
+ }
+
+ /* Find local symbol sections and adjust values of symbols in
+ SEC_MERGE sections. Write out those local symbols we know are
+ going into the output file. */
+ isymend = isymbuf + locsymcount;
+ for (isym = isymbuf, pindex = finfo->indices, ppsection = finfo->sections;
+ isym < isymend;
+ isym++, pindex++, ppsection++)
+ {
+ asection *isec;
+ const char *name;
+ Elf_Internal_Sym osym;
+
+ *pindex = -1;
+
+ if (elf_bad_symtab (input_bfd))
+ {
+ if (ELF_ST_BIND (isym->st_info) != STB_LOCAL)
+ {
+ *ppsection = NULL;
+ continue;
+ }
+ }
+
+ if (isym->st_shndx == SHN_UNDEF)
+ isec = bfd_und_section_ptr;
+ else if (isym->st_shndx < SHN_LORESERVE
+ || isym->st_shndx > SHN_HIRESERVE)
+ {
+ isec = bfd_section_from_elf_index (input_bfd, isym->st_shndx);
+ if (isec
+ && isec->sec_info_type == ELF_INFO_TYPE_MERGE
+ && ELF_ST_TYPE (isym->st_info) != STT_SECTION)
+ isym->st_value =
+ _bfd_merged_section_offset (output_bfd, &isec,
+ elf_section_data (isec)->sec_info,
+ isym->st_value, 0);
+ }
+ else if (isym->st_shndx == SHN_ABS)
+ isec = bfd_abs_section_ptr;
+ else if (isym->st_shndx == SHN_COMMON)
+ isec = bfd_com_section_ptr;
+ else
+ {
+ /* Who knows? */
+ isec = NULL;
+ }
+
+ *ppsection = isec;
+
+ /* Don't output the first, undefined, symbol. */
+ if (ppsection == finfo->sections)
+ continue;
+
+ if (ELF_ST_TYPE (isym->st_info) == STT_SECTION)
+ {
+ /* We never output section symbols. Instead, we use the
+ section symbol of the corresponding section in the output
+ file. */
+ continue;
+ }
+
+ /* If we are stripping all symbols, we don't want to output this
+ one. */
+ if (finfo->info->strip == strip_all)
+ continue;
+
+ /* If we are discarding all local symbols, we don't want to
+ output this one. If we are generating a relocatable output
+ file, then some of the local symbols may be required by
+ relocs; we output them below as we discover that they are
+ needed. */
+ if (finfo->info->discard == discard_all)
+ continue;
+
+ /* If this symbol is defined in a section which we are
+ discarding, we don't need to keep it, but note that
+ linker_mark is only reliable for sections that have contents.
+ For the benefit of the MIPS ELF linker, we check SEC_EXCLUDE
+ as well as linker_mark. */
+ if ((isym->st_shndx < SHN_LORESERVE || isym->st_shndx > SHN_HIRESERVE)
+ && isec != NULL
+ && ((! isec->linker_mark && (isec->flags & SEC_HAS_CONTENTS) != 0)
+ || (! finfo->info->relocatable
+ && (isec->flags & SEC_EXCLUDE) != 0)))
+ continue;
+
+ /* Get the name of the symbol. */
+ name = bfd_elf_string_from_elf_section (input_bfd, symtab_hdr->sh_link,
+ isym->st_name);
+ if (name == NULL)
+ return FALSE;
+
+ /* See if we are discarding symbols with this name. */
+ if ((finfo->info->strip == strip_some
+ && (bfd_hash_lookup (finfo->info->keep_hash, name, FALSE, FALSE)
+ == NULL))
+ || (((finfo->info->discard == discard_sec_merge
+ && (isec->flags & SEC_MERGE) && ! finfo->info->relocatable)
+ || finfo->info->discard == discard_l)
+ && bfd_is_local_label_name (input_bfd, name)))
+ continue;
+
+ /* If we get here, we are going to output this symbol. */
+
+ osym = *isym;
+
+ /* Adjust the section index for the output file. */
+ osym.st_shndx = _bfd_elf_section_from_bfd_section (output_bfd,
+ isec->output_section);
+ if (osym.st_shndx == SHN_BAD)
+ return FALSE;
+
+ *pindex = bfd_get_symcount (output_bfd);
+
+ /* ELF symbols in relocatable files are section relative, but
+ in executable files they are virtual addresses. Note that
+ this code assumes that all ELF sections have an associated
+ BFD section with a reasonable value for output_offset; below
+ we assume that they also have a reasonable value for
+ output_section. Any special sections must be set up to meet
+ these requirements. */
+ osym.st_value += isec->output_offset;
+ if (! finfo->info->relocatable)
+ {
+ osym.st_value += isec->output_section->vma;
+ if (ELF_ST_TYPE (osym.st_info) == STT_TLS)
+ {
+ /* STT_TLS symbols are relative to PT_TLS segment base. */
+ BFD_ASSERT (elf_hash_table (finfo->info)->tls_sec != NULL);
+ osym.st_value -= elf_hash_table (finfo->info)->tls_sec->vma;
+ }
+ }
+
+ if (! elf_link_output_sym (finfo, name, &osym, isec, NULL))
+ return FALSE;
+ }
+
+ /* Relocate the contents of each section. */
+ sym_hashes = elf_sym_hashes (input_bfd);
+ for (o = input_bfd->sections; o != NULL; o = o->next)
+ {
+ bfd_byte *contents;
+
+ if (! o->linker_mark)
+ {
+ /* This section was omitted from the link. */
+ continue;
+ }
+
+ if ((o->flags & SEC_HAS_CONTENTS) == 0
+ || (o->_raw_size == 0 && (o->flags & SEC_RELOC) == 0))
+ continue;
+
+ if ((o->flags & SEC_LINKER_CREATED) != 0)
+ {
+ /* Section was created by _bfd_elf_link_create_dynamic_sections
+ or somesuch. */
+ continue;
+ }
+
+ /* Get the contents of the section. They have been cached by a
+ relaxation routine. Note that o is a section in an input
+ file, so the contents field will not have been set by any of
+ the routines which work on output files. */
+ if (elf_section_data (o)->this_hdr.contents != NULL)
+ contents = elf_section_data (o)->this_hdr.contents;
+ else
+ {
+ contents = finfo->contents;
+ if (! bfd_get_section_contents (input_bfd, o, contents, 0,
+ o->_raw_size))
+ return FALSE;
+ }
+
+ if ((o->flags & SEC_RELOC) != 0)
+ {
+ Elf_Internal_Rela *internal_relocs;
+ bfd_vma r_type_mask;
+ int r_sym_shift;
+
+ /* Get the swapped relocs. */
+ internal_relocs
+ = _bfd_elf_link_read_relocs (input_bfd, o, finfo->external_relocs,
+ finfo->internal_relocs, FALSE);
+ if (internal_relocs == NULL
+ && o->reloc_count > 0)
+ return FALSE;
+
+ if (bed->s->arch_size == 32)
+ {
+ r_type_mask = 0xff;
+ r_sym_shift = 8;
+ }
+ else
+ {
+ r_type_mask = 0xffffffff;
+ r_sym_shift = 32;
+ }
+
+ /* Run through the relocs looking for any against symbols
+ from discarded sections and section symbols from
+ removed link-once sections. Complain about relocs
+ against discarded sections. Zero relocs against removed
+ link-once sections. Preserve debug information as much
+ as we can. */
+ if (!elf_section_ignore_discarded_relocs (o))
+ {
+ Elf_Internal_Rela *rel, *relend;
+
+ rel = internal_relocs;
+ relend = rel + o->reloc_count * bed->s->int_rels_per_ext_rel;
+ for ( ; rel < relend; rel++)
+ {
+ unsigned long r_symndx = rel->r_info >> r_sym_shift;
+ asection *sec;
+
+ if (r_symndx >= locsymcount
+ || (elf_bad_symtab (input_bfd)
+ && finfo->sections[r_symndx] == NULL))
+ {
+ struct elf_link_hash_entry *h;
+
+ h = sym_hashes[r_symndx - extsymoff];
+ while (h->root.type == bfd_link_hash_indirect
+ || h->root.type == bfd_link_hash_warning)
+ h = (struct elf_link_hash_entry *) h->root.u.i.link;
+
+ /* Complain if the definition comes from a
+ discarded section. */
+ sec = h->root.u.def.section;
+ if ((h->root.type == bfd_link_hash_defined
+ || h->root.type == bfd_link_hash_defweak)
+ && elf_discarded_section (sec))
+ {
+ if ((o->flags & SEC_DEBUGGING) != 0)
+ {
+ BFD_ASSERT (r_symndx != 0);
+ /* Try to preserve debug information. */
+ if ((o->flags & SEC_DEBUGGING) != 0
+ && sec->kept_section != NULL
+ && sec->_raw_size == sec->kept_section->_raw_size)
+ h->root.u.def.section
+ = sec->kept_section;
+ else
+ memset (rel, 0, sizeof (*rel));
+ }
+ else
+ finfo->info->callbacks->error_handler
+ (LD_DEFINITION_IN_DISCARDED_SECTION,
+ _("%T: discarded in section `%s' from %s\n"),
+ h->root.root.string,
+ h->root.root.string,
+ h->root.u.def.section->name,
+ bfd_archive_filename (h->root.u.def.section->owner));
+ }
+ }
+ else
+ {
+ sec = finfo->sections[r_symndx];
+
+ if (sec != NULL && elf_discarded_section (sec))
+ {
+ if ((o->flags & SEC_DEBUGGING) != 0
+ || (sec->flags & SEC_LINK_ONCE) != 0)
+ {
+ BFD_ASSERT (r_symndx != 0);
+ /* Try to preserve debug information. */
+ if ((o->flags & SEC_DEBUGGING) != 0
+ && sec->kept_section != NULL
+ && sec->_raw_size == sec->kept_section->_raw_size)
+ finfo->sections[r_symndx]
+ = sec->kept_section;
+ else
+ {
+ rel->r_info &= r_type_mask;
+ rel->r_addend = 0;
+ }
+ }
+ else
+ {
+ static int count;
+ int ok;
+ char *buf;
+
+ ok = asprintf (&buf, "local symbol %d",
+ count++);
+ if (ok <= 0)
+ buf = (char *) "local symbol";
+ finfo->info->callbacks->error_handler
+ (LD_DEFINITION_IN_DISCARDED_SECTION,
+ _("%T: discarded in section `%s' from %s\n"),
+ buf, buf, sec->name,
+ bfd_archive_filename (input_bfd));
+ if (ok != -1)
+ free (buf);
+ }
+ }
+ }
+ }
+ }
+
+ /* Relocate the section by invoking a back end routine.
+
+ The back end routine is responsible for adjusting the
+ section contents as necessary, and (if using Rela relocs
+ and generating a relocatable output file) adjusting the
+ reloc addend as necessary.
+
+ The back end routine does not have to worry about setting
+ the reloc address or the reloc symbol index.
+
+ The back end routine is given a pointer to the swapped in
+ internal symbols, and can access the hash table entries
+ for the external symbols via elf_sym_hashes (input_bfd).
+
+ When generating relocatable output, the back end routine
+ must handle STB_LOCAL/STT_SECTION symbols specially. The
+ output symbol is going to be a section symbol
+ corresponding to the output section, which will require
+ the addend to be adjusted. */
+
+ if (! (*relocate_section) (output_bfd, finfo->info,
+ input_bfd, o, contents,
+ internal_relocs,
+ isymbuf,
+ finfo->sections))
+ return FALSE;
+
+ if (emit_relocs)
+ {
+ Elf_Internal_Rela *irela;
+ Elf_Internal_Rela *irelaend;
+ bfd_vma last_offset;
+ struct elf_link_hash_entry **rel_hash;
+ Elf_Internal_Shdr *input_rel_hdr, *input_rel_hdr2;
+ unsigned int next_erel;
+ bfd_boolean (*reloc_emitter)
+ (bfd *, asection *, Elf_Internal_Shdr *, Elf_Internal_Rela *);
+ bfd_boolean rela_normal;
+
+ input_rel_hdr = &elf_section_data (o)->rel_hdr;
+ rela_normal = (bed->rela_normal
+ && (input_rel_hdr->sh_entsize
+ == bed->s->sizeof_rela));
+
+ /* Adjust the reloc addresses and symbol indices. */
+
+ irela = internal_relocs;
+ irelaend = irela + o->reloc_count * bed->s->int_rels_per_ext_rel;
+ rel_hash = (elf_section_data (o->output_section)->rel_hashes
+ + elf_section_data (o->output_section)->rel_count
+ + elf_section_data (o->output_section)->rel_count2);
+ last_offset = o->output_offset;
+ if (!finfo->info->relocatable)
+ last_offset += o->output_section->vma;
+ for (next_erel = 0; irela < irelaend; irela++, next_erel++)
+ {
+ unsigned long r_symndx;
+ asection *sec;
+ Elf_Internal_Sym sym;
+
+ if (next_erel == bed->s->int_rels_per_ext_rel)
+ {
+ rel_hash++;
+ next_erel = 0;
+ }
+
+ irela->r_offset = _bfd_elf_section_offset (output_bfd,
+ finfo->info, o,
+ irela->r_offset);
+ if (irela->r_offset >= (bfd_vma) -2)
+ {
+ /* This is a reloc for a deleted entry or somesuch.
+ Turn it into an R_*_NONE reloc, at the same
+ offset as the last reloc. elf_eh_frame.c and
+ elf_bfd_discard_info rely on reloc offsets
+ being ordered. */
+ irela->r_offset = last_offset;
+ irela->r_info = 0;
+ irela->r_addend = 0;
+ continue;
+ }
+
+ irela->r_offset += o->output_offset;
+
+ /* Relocs in an executable have to be virtual addresses. */
+ if (!finfo->info->relocatable)
+ irela->r_offset += o->output_section->vma;
+
+ last_offset = irela->r_offset;
+
+ r_symndx = irela->r_info >> r_sym_shift;
+ if (r_symndx == STN_UNDEF)
+ continue;
+
+ if (r_symndx >= locsymcount
+ || (elf_bad_symtab (input_bfd)
+ && finfo->sections[r_symndx] == NULL))
+ {
+ struct elf_link_hash_entry *rh;
+ unsigned long indx;
+
+ /* This is a reloc against a global symbol. We
+ have not yet output all the local symbols, so
+ we do not know the symbol index of any global
+ symbol. We set the rel_hash entry for this
+ reloc to point to the global hash table entry
+ for this symbol. The symbol index is then
+ set at the end of elf_bfd_final_link. */
+ indx = r_symndx - extsymoff;
+ rh = elf_sym_hashes (input_bfd)[indx];
+ while (rh->root.type == bfd_link_hash_indirect
+ || rh->root.type == bfd_link_hash_warning)
+ rh = (struct elf_link_hash_entry *) rh->root.u.i.link;
+
+ /* Setting the index to -2 tells
+ elf_link_output_extsym that this symbol is
+ used by a reloc. */
+ BFD_ASSERT (rh->indx < 0);
+ rh->indx = -2;
+
+ *rel_hash = rh;
+
+ continue;
+ }
+
+ /* This is a reloc against a local symbol. */
+
+ *rel_hash = NULL;
+ sym = isymbuf[r_symndx];
+ sec = finfo->sections[r_symndx];
+ if (ELF_ST_TYPE (sym.st_info) == STT_SECTION)
+ {
+ /* I suppose the backend ought to fill in the
+ section of any STT_SECTION symbol against a
+ processor specific section. If we have
+ discarded a section, the output_section will
+ be the absolute section. */
+ if (bfd_is_abs_section (sec)
+ || (sec != NULL
+ && bfd_is_abs_section (sec->output_section)))
+ r_symndx = 0;
+ else if (sec == NULL || sec->owner == NULL)
+ {
+ bfd_set_error (bfd_error_bad_value);
+ return FALSE;
+ }
+ else
+ {
+ r_symndx = sec->output_section->target_index;
+ BFD_ASSERT (r_symndx != 0);
+ }
+
+ /* Adjust the addend according to where the
+ section winds up in the output section. */
+ if (rela_normal)
+ irela->r_addend += sec->output_offset;
+ }
+ else
+ {
+ if (finfo->indices[r_symndx] == -1)
+ {
+ unsigned long shlink;
+ const char *name;
+ asection *osec;
+
+ if (finfo->info->strip == strip_all)
+ {
+ /* You can't do ld -r -s. */
+ bfd_set_error (bfd_error_invalid_operation);
+ return FALSE;
+ }
+
+ /* This symbol was skipped earlier, but
+ since it is needed by a reloc, we
+ must output it now. */
+ shlink = symtab_hdr->sh_link;
+ name = (bfd_elf_string_from_elf_section
+ (input_bfd, shlink, sym.st_name));
+ if (name == NULL)
+ return FALSE;
+
+ osec = sec->output_section;
+ sym.st_shndx =
+ _bfd_elf_section_from_bfd_section (output_bfd,
+ osec);
+ if (sym.st_shndx == SHN_BAD)
+ return FALSE;
+
+ sym.st_value += sec->output_offset;
+ if (! finfo->info->relocatable)
+ {
+ sym.st_value += osec->vma;
+ if (ELF_ST_TYPE (sym.st_info) == STT_TLS)
+ {
+ /* STT_TLS symbols are relative to PT_TLS
+ segment base. */
+ BFD_ASSERT (elf_hash_table (finfo->info)
+ ->tls_sec != NULL);
+ sym.st_value -= (elf_hash_table (finfo->info)
+ ->tls_sec->vma);
+ }
+ }
+
+ finfo->indices[r_symndx]
+ = bfd_get_symcount (output_bfd);
+
+ if (! elf_link_output_sym (finfo, name, &sym, sec,
+ NULL))
+ return FALSE;
+ }
+
+ r_symndx = finfo->indices[r_symndx];
+ }
+
+ irela->r_info = ((bfd_vma) r_symndx << r_sym_shift
+ | (irela->r_info & r_type_mask));
+ }
+
+ /* Swap out the relocs. */
+ if (bed->elf_backend_emit_relocs
+ && !(finfo->info->relocatable
+ || finfo->info->emitrelocations))
+ reloc_emitter = bed->elf_backend_emit_relocs;
+ else
+ reloc_emitter = _bfd_elf_link_output_relocs;
+
+ if (input_rel_hdr->sh_size != 0
+ && ! (*reloc_emitter) (output_bfd, o, input_rel_hdr,
+ internal_relocs))
+ return FALSE;
+
+ input_rel_hdr2 = elf_section_data (o)->rel_hdr2;
+ if (input_rel_hdr2 && input_rel_hdr2->sh_size != 0)
+ {
+ internal_relocs += (NUM_SHDR_ENTRIES (input_rel_hdr)
+ * bed->s->int_rels_per_ext_rel);
+ if (! (*reloc_emitter) (output_bfd, o, input_rel_hdr2,
+ internal_relocs))
+ return FALSE;
+ }
+ }
+ }
+
+ /* Write out the modified section contents. */
+ if (bed->elf_backend_write_section
+ && (*bed->elf_backend_write_section) (output_bfd, o, contents))
+ {
+ /* Section written out. */
+ }
+ else switch (o->sec_info_type)
+ {
+ case ELF_INFO_TYPE_STABS:
+ if (! (_bfd_write_section_stabs
+ (output_bfd,
+ &elf_hash_table (finfo->info)->stab_info,
+ o, &elf_section_data (o)->sec_info, contents)))
+ return FALSE;
+ break;
+ case ELF_INFO_TYPE_MERGE:
+ if (! _bfd_write_merged_section (output_bfd, o,
+ elf_section_data (o)->sec_info))
+ return FALSE;
+ break;
+ case ELF_INFO_TYPE_EH_FRAME:
+ {
+ if (! _bfd_elf_write_section_eh_frame (output_bfd, finfo->info,
+ o, contents))
+ return FALSE;
+ }
+ break;
+ default:
+ {
+ bfd_size_type sec_size;
+
+ sec_size = (o->_cooked_size != 0 ? o->_cooked_size : o->_raw_size);
+ if (! (o->flags & SEC_EXCLUDE)
+ && ! bfd_set_section_contents (output_bfd, o->output_section,
+ contents,
+ (file_ptr) o->output_offset,
+ sec_size))
+ return FALSE;
+ }
+ break;
+ }
+ }
+
+ return TRUE;
+}
+
+/* Generate a reloc when linking an ELF file. This is a reloc
+ requested by the linker, and does come from any input file. This
+ is used to build constructor and destructor tables when linking
+ with -Ur. */
+
+static bfd_boolean
+elf_reloc_link_order (bfd *output_bfd,
+ struct bfd_link_info *info,
+ asection *output_section,
+ struct bfd_link_order *link_order)
+{
+ reloc_howto_type *howto;
+ long indx;
+ bfd_vma offset;
+ bfd_vma addend;
+ struct elf_link_hash_entry **rel_hash_ptr;
+ Elf_Internal_Shdr *rel_hdr;
+ const struct elf_backend_data *bed = get_elf_backend_data (output_bfd);
+ Elf_Internal_Rela irel[MAX_INT_RELS_PER_EXT_REL];
+ bfd_byte *erel;
+ unsigned int i;
+
+ howto = bfd_reloc_type_lookup (output_bfd, link_order->u.reloc.p->reloc);
+ if (howto == NULL)
+ {
+ bfd_set_error (bfd_error_bad_value);
+ return FALSE;
+ }
+
+ addend = link_order->u.reloc.p->addend;
+
+ /* Figure out the symbol index. */
+ rel_hash_ptr = (elf_section_data (output_section)->rel_hashes
+ + elf_section_data (output_section)->rel_count
+ + elf_section_data (output_section)->rel_count2);
+ if (link_order->type == bfd_section_reloc_link_order)
+ {
+ indx = link_order->u.reloc.p->u.section->target_index;
+ BFD_ASSERT (indx != 0);
+ *rel_hash_ptr = NULL;
+ }
+ else
+ {
+ struct elf_link_hash_entry *h;
+
+ /* Treat a reloc against a defined symbol as though it were
+ actually against the section. */
+ h = ((struct elf_link_hash_entry *)
+ bfd_wrapped_link_hash_lookup (output_bfd, info,
+ link_order->u.reloc.p->u.name,
+ FALSE, FALSE, TRUE));
+ if (h != NULL
+ && (h->root.type == bfd_link_hash_defined
+ || h->root.type == bfd_link_hash_defweak))
+ {
+ asection *section;
+
+ section = h->root.u.def.section;
+ indx = section->output_section->target_index;
+ *rel_hash_ptr = NULL;
+ /* It seems that we ought to add the symbol value to the
+ addend here, but in practice it has already been added
+ because it was passed to constructor_callback. */
+ addend += section->output_section->vma + section->output_offset;
+ }
+ else if (h != NULL)
+ {
+ /* Setting the index to -2 tells elf_link_output_extsym that
+ this symbol is used by a reloc. */
+ h->indx = -2;
+ *rel_hash_ptr = h;
+ indx = 0;
+ }
+ else
+ {
+ if (! ((*info->callbacks->unattached_reloc)
+ (info, link_order->u.reloc.p->u.name, NULL, NULL, 0)))
+ return FALSE;
+ indx = 0;
+ }
+ }
+
+ /* If this is an inplace reloc, we must write the addend into the
+ object file. */
+ if (howto->partial_inplace && addend != 0)
+ {
+ bfd_size_type size;
+ bfd_reloc_status_type rstat;
+ bfd_byte *buf;
+ bfd_boolean ok;
+ const char *sym_name;
+
+ size = bfd_get_reloc_size (howto);
+ buf = bfd_zmalloc (size);
+ if (buf == NULL)
+ return FALSE;
+ rstat = _bfd_relocate_contents (howto, output_bfd, addend, buf);
+ switch (rstat)
+ {
+ case bfd_reloc_ok:
+ break;
+
+ default:
+ case bfd_reloc_outofrange:
+ abort ();
+
+ case bfd_reloc_overflow:
+ if (link_order->type == bfd_section_reloc_link_order)
+ sym_name = bfd_section_name (output_bfd,
+ link_order->u.reloc.p->u.section);
+ else
+ sym_name = link_order->u.reloc.p->u.name;
+ if (! ((*info->callbacks->reloc_overflow)
+ (info, sym_name, howto->name, addend, NULL, NULL, 0)))
+ {
+ free (buf);
+ return FALSE;
+ }
+ break;
+ }
+ ok = bfd_set_section_contents (output_bfd, output_section, buf,
+ link_order->offset, size);
+ free (buf);
+ if (! ok)
+ return FALSE;
+ }
+
+ /* The address of a reloc is relative to the section in a
+ relocatable file, and is a virtual address in an executable
+ file. */
+ offset = link_order->offset;
+ if (! info->relocatable)
+ offset += output_section->vma;
+
+ for (i = 0; i < bed->s->int_rels_per_ext_rel; i++)
+ {
+ irel[i].r_offset = offset;
+ irel[i].r_info = 0;
+ irel[i].r_addend = 0;
+ }
+ if (bed->s->arch_size == 32)
+ irel[0].r_info = ELF32_R_INFO (indx, howto->type);
+ else
+ irel[0].r_info = ELF64_R_INFO (indx, howto->type);
+
+ rel_hdr = &elf_section_data (output_section)->rel_hdr;
+ erel = rel_hdr->contents;
+ if (rel_hdr->sh_type == SHT_REL)
+ {
+ erel += (elf_section_data (output_section)->rel_count
+ * bed->s->sizeof_rel);
+ (*bed->s->swap_reloc_out) (output_bfd, irel, erel);
+ }
+ else
+ {
+ irel[0].r_addend = addend;
+ erel += (elf_section_data (output_section)->rel_count
+ * bed->s->sizeof_rela);
+ (*bed->s->swap_reloca_out) (output_bfd, irel, erel);
+ }
+
+ ++elf_section_data (output_section)->rel_count;
+
+ return TRUE;
+}
+
+/* Do the final step of an ELF link. */
+
+bfd_boolean
+bfd_elf_final_link (bfd *abfd, struct bfd_link_info *info)
+{
+ bfd_boolean dynamic;
+ bfd_boolean emit_relocs;
+ bfd *dynobj;
+ struct elf_final_link_info finfo;
+ register asection *o;
+ register struct bfd_link_order *p;
+ register bfd *sub;
+ bfd_size_type max_contents_size;
+ bfd_size_type max_external_reloc_size;
+ bfd_size_type max_internal_reloc_count;
+ bfd_size_type max_sym_count;
+ bfd_size_type max_sym_shndx_count;
+ file_ptr off;
+ Elf_Internal_Sym elfsym;
+ unsigned int i;
+ Elf_Internal_Shdr *symtab_hdr;
+ Elf_Internal_Shdr *symtab_shndx_hdr;
+ Elf_Internal_Shdr *symstrtab_hdr;
+ const struct elf_backend_data *bed = get_elf_backend_data (abfd);
+ struct elf_outext_info eoinfo;
+ bfd_boolean merged;
+ size_t relativecount = 0;
+ asection *reldyn = 0;
+ bfd_size_type amt;
+
+ if (! is_elf_hash_table (info->hash))
+ return FALSE;
+
+ if (info->shared)
+ abfd->flags |= DYNAMIC;
+
+ dynamic = elf_hash_table (info)->dynamic_sections_created;
+ dynobj = elf_hash_table (info)->dynobj;
+
+ emit_relocs = (info->relocatable
+ || info->emitrelocations
+ || bed->elf_backend_emit_relocs);
+
+ finfo.info = info;
+ finfo.output_bfd = abfd;
+ finfo.symstrtab = _bfd_elf_stringtab_init ();
+ if (finfo.symstrtab == NULL)
+ return FALSE;
+
+ if (! dynamic)
+ {
+ finfo.dynsym_sec = NULL;
+ finfo.hash_sec = NULL;
+ finfo.symver_sec = NULL;
+ }
+ else
+ {
+ finfo.dynsym_sec = bfd_get_section_by_name (dynobj, ".dynsym");
+ finfo.hash_sec = bfd_get_section_by_name (dynobj, ".hash");
+ BFD_ASSERT (finfo.dynsym_sec != NULL && finfo.hash_sec != NULL);
+ finfo.symver_sec = bfd_get_section_by_name (dynobj, ".gnu.version");
+ /* Note that it is OK if symver_sec is NULL. */
+ }
+
+ finfo.contents = NULL;
+ finfo.external_relocs = NULL;
+ finfo.internal_relocs = NULL;
+ finfo.external_syms = NULL;
+ finfo.locsym_shndx = NULL;
+ finfo.internal_syms = NULL;
+ finfo.indices = NULL;
+ finfo.sections = NULL;
+ finfo.symbuf = NULL;
+ finfo.symshndxbuf = NULL;
+ finfo.symbuf_count = 0;
+ finfo.shndxbuf_size = 0;
+
+ /* Count up the number of relocations we will output for each output
+ section, so that we know the sizes of the reloc sections. We
+ also figure out some maximum sizes. */
+ max_contents_size = 0;
+ max_external_reloc_size = 0;
+ max_internal_reloc_count = 0;
+ max_sym_count = 0;
+ max_sym_shndx_count = 0;
+ merged = FALSE;
+ for (o = abfd->sections; o != NULL; o = o->next)
+ {
+ struct bfd_elf_section_data *esdo = elf_section_data (o);
+ o->reloc_count = 0;
+
+ for (p = o->link_order_head; p != NULL; p = p->next)
+ {
+ unsigned int reloc_count = 0;
+ struct bfd_elf_section_data *esdi = NULL;
+ unsigned int *rel_count1;
+
+ if (p->type == bfd_section_reloc_link_order
+ || p->type == bfd_symbol_reloc_link_order)
+ reloc_count = 1;
+ else if (p->type == bfd_indirect_link_order)
+ {
+ asection *sec;
+
+ sec = p->u.indirect.section;
+ esdi = elf_section_data (sec);
+
+ /* Mark all sections which are to be included in the
+ link. This will normally be every section. We need
+ to do this so that we can identify any sections which
+ the linker has decided to not include. */
+ sec->linker_mark = TRUE;
+
+ if (sec->flags & SEC_MERGE)
+ merged = TRUE;
+
+ if (info->relocatable || info->emitrelocations)
+ reloc_count = sec->reloc_count;
+ else if (bed->elf_backend_count_relocs)
+ {
+ Elf_Internal_Rela * relocs;
+
+ relocs = _bfd_elf_link_read_relocs (abfd, sec, NULL, NULL,
+ info->keep_memory);
+
+ reloc_count = (*bed->elf_backend_count_relocs) (sec, relocs);
+
+ if (elf_section_data (o)->relocs != relocs)
+ free (relocs);
+ }
+
+ if (sec->_raw_size > max_contents_size)
+ max_contents_size = sec->_raw_size;
+ if (sec->_cooked_size > max_contents_size)
+ max_contents_size = sec->_cooked_size;
+
+ /* We are interested in just local symbols, not all
+ symbols. */
+ if (bfd_get_flavour (sec->owner) == bfd_target_elf_flavour
+ && (sec->owner->flags & DYNAMIC) == 0)
+ {
+ size_t sym_count;
+
+ if (elf_bad_symtab (sec->owner))
+ sym_count = (elf_tdata (sec->owner)->symtab_hdr.sh_size
+ / bed->s->sizeof_sym);
+ else
+ sym_count = elf_tdata (sec->owner)->symtab_hdr.sh_info;
+
+ if (sym_count > max_sym_count)
+ max_sym_count = sym_count;
+
+ if (sym_count > max_sym_shndx_count
+ && elf_symtab_shndx (sec->owner) != 0)
+ max_sym_shndx_count = sym_count;
+
+ if ((sec->flags & SEC_RELOC) != 0)
+ {
+ size_t ext_size;
+
+ ext_size = elf_section_data (sec)->rel_hdr.sh_size;
+ if (ext_size > max_external_reloc_size)
+ max_external_reloc_size = ext_size;
+ if (sec->reloc_count > max_internal_reloc_count)
+ max_internal_reloc_count = sec->reloc_count;
+ }
+ }
+ }
+
+ if (reloc_count == 0)
+ continue;
+
+ o->reloc_count += reloc_count;
+
+ /* MIPS may have a mix of REL and RELA relocs on sections.
+ To support this curious ABI we keep reloc counts in
+ elf_section_data too. We must be careful to add the
+ relocations from the input section to the right output
+ count. FIXME: Get rid of one count. We have
+ o->reloc_count == esdo->rel_count + esdo->rel_count2. */
+ rel_count1 = &esdo->rel_count;
+ if (esdi != NULL)
+ {
+ bfd_boolean same_size;
+ bfd_size_type entsize1;
+
+ entsize1 = esdi->rel_hdr.sh_entsize;
+ BFD_ASSERT (entsize1 == bed->s->sizeof_rel
+ || entsize1 == bed->s->sizeof_rela);
+ same_size = !o->use_rela_p == (entsize1 == bed->s->sizeof_rel);
+
+ if (!same_size)
+ rel_count1 = &esdo->rel_count2;
+
+ if (esdi->rel_hdr2 != NULL)
+ {
+ bfd_size_type entsize2 = esdi->rel_hdr2->sh_entsize;
+ unsigned int alt_count;
+ unsigned int *rel_count2;
+
+ BFD_ASSERT (entsize2 != entsize1
+ && (entsize2 == bed->s->sizeof_rel
+ || entsize2 == bed->s->sizeof_rela));
+
+ rel_count2 = &esdo->rel_count2;
+ if (!same_size)
+ rel_count2 = &esdo->rel_count;
+
+ /* The following is probably too simplistic if the
+ backend counts output relocs unusually. */
+ BFD_ASSERT (bed->elf_backend_count_relocs == NULL);
+ alt_count = NUM_SHDR_ENTRIES (esdi->rel_hdr2);
+ *rel_count2 += alt_count;
+ reloc_count -= alt_count;
+ }
+ }
+ *rel_count1 += reloc_count;
+ }
+
+ if (o->reloc_count > 0)
+ o->flags |= SEC_RELOC;
+ else
+ {
+ /* Explicitly clear the SEC_RELOC flag. The linker tends to
+ set it (this is probably a bug) and if it is set
+ assign_section_numbers will create a reloc section. */
+ o->flags &=~ SEC_RELOC;
+ }
+
+ /* If the SEC_ALLOC flag is not set, force the section VMA to
+ zero. This is done in elf_fake_sections as well, but forcing
+ the VMA to 0 here will ensure that relocs against these
+ sections are handled correctly. */
+ if ((o->flags & SEC_ALLOC) == 0
+ && ! o->user_set_vma)
+ o->vma = 0;
+ }
+
+ if (! info->relocatable && merged)
+ elf_link_hash_traverse (elf_hash_table (info),
+ _bfd_elf_link_sec_merge_syms, abfd);
+
+ /* Figure out the file positions for everything but the symbol table
+ and the relocs. We set symcount to force assign_section_numbers
+ to create a symbol table. */
+ bfd_get_symcount (abfd) = info->strip == strip_all ? 0 : 1;
+ BFD_ASSERT (! abfd->output_has_begun);
+ if (! _bfd_elf_compute_section_file_positions (abfd, info))
+ goto error_return;
+
+ /* That created the reloc sections. Set their sizes, and assign
+ them file positions, and allocate some buffers. */
+ for (o = abfd->sections; o != NULL; o = o->next)
+ {
+ if ((o->flags & SEC_RELOC) != 0)
+ {
+ if (!(_bfd_elf_link_size_reloc_section
+ (abfd, &elf_section_data (o)->rel_hdr, o)))
+ goto error_return;
+
+ if (elf_section_data (o)->rel_hdr2
+ && !(_bfd_elf_link_size_reloc_section
+ (abfd, elf_section_data (o)->rel_hdr2, o)))
+ goto error_return;
+ }
+
+ /* Now, reset REL_COUNT and REL_COUNT2 so that we can use them
+ to count upwards while actually outputting the relocations. */
+ elf_section_data (o)->rel_count = 0;
+ elf_section_data (o)->rel_count2 = 0;
+ }
+
+ _bfd_elf_assign_file_positions_for_relocs (abfd);
+
+ /* We have now assigned file positions for all the sections except
+ .symtab and .strtab. We start the .symtab section at the current
+ file position, and write directly to it. We build the .strtab
+ section in memory. */
+ bfd_get_symcount (abfd) = 0;
+ symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
+ /* sh_name is set in prep_headers. */
+ symtab_hdr->sh_type = SHT_SYMTAB;
+ /* sh_flags, sh_addr and sh_size all start off zero. */
+ symtab_hdr->sh_entsize = bed->s->sizeof_sym;
+ /* sh_link is set in assign_section_numbers. */
+ /* sh_info is set below. */
+ /* sh_offset is set just below. */
+ symtab_hdr->sh_addralign = 1 << bed->s->log_file_align;
+
+ off = elf_tdata (abfd)->next_file_pos;
+ off = _bfd_elf_assign_file_position_for_section (symtab_hdr, off, TRUE);
+
+ /* Note that at this point elf_tdata (abfd)->next_file_pos is
+ incorrect. We do not yet know the size of the .symtab section.
+ We correct next_file_pos below, after we do know the size. */
+
+ /* Allocate a buffer to hold swapped out symbols. This is to avoid
+ continuously seeking to the right position in the file. */
+ if (! info->keep_memory || max_sym_count < 20)
+ finfo.symbuf_size = 20;
+ else
+ finfo.symbuf_size = max_sym_count;
+ amt = finfo.symbuf_size;
+ amt *= bed->s->sizeof_sym;
+ finfo.symbuf = bfd_malloc (amt);
+ if (finfo.symbuf == NULL)
+ goto error_return;
+ if (elf_numsections (abfd) > SHN_LORESERVE)
+ {
+ /* Wild guess at number of output symbols. realloc'd as needed. */
+ amt = 2 * max_sym_count + elf_numsections (abfd) + 1000;
+ finfo.shndxbuf_size = amt;
+ amt *= sizeof (Elf_External_Sym_Shndx);
+ finfo.symshndxbuf = bfd_zmalloc (amt);
+ if (finfo.symshndxbuf == NULL)
+ goto error_return;
+ }
+
+ /* Start writing out the symbol table. The first symbol is always a
+ dummy symbol. */
+ if (info->strip != strip_all
+ || emit_relocs)
+ {
+ elfsym.st_value = 0;
+ elfsym.st_size = 0;
+ elfsym.st_info = 0;
+ elfsym.st_other = 0;
+ elfsym.st_shndx = SHN_UNDEF;
+ if (! elf_link_output_sym (&finfo, NULL, &elfsym, bfd_und_section_ptr,
+ NULL))
+ goto error_return;
+ }
+
+#if 0
+ /* Some standard ELF linkers do this, but we don't because it causes
+ bootstrap comparison failures. */
+ /* Output a file symbol for the output file as the second symbol.
+ We output this even if we are discarding local symbols, although
+ I'm not sure if this is correct. */
+ elfsym.st_value = 0;
+ elfsym.st_size = 0;
+ elfsym.st_info = ELF_ST_INFO (STB_LOCAL, STT_FILE);
+ elfsym.st_other = 0;
+ elfsym.st_shndx = SHN_ABS;
+ if (! elf_link_output_sym (&finfo, bfd_get_filename (abfd),
+ &elfsym, bfd_abs_section_ptr, NULL))
+ goto error_return;
#endif
- return lsect;
+ /* Output a symbol for each section. We output these even if we are
+ discarding local symbols, since they are used for relocs. These
+ symbols have no names. We store the index of each one in the
+ index field of the section, so that we can find it again when
+ outputting relocs. */
+ if (info->strip != strip_all
+ || emit_relocs)
+ {
+ elfsym.st_size = 0;
+ elfsym.st_info = ELF_ST_INFO (STB_LOCAL, STT_SECTION);
+ elfsym.st_other = 0;
+ for (i = 1; i < elf_numsections (abfd); i++)
+ {
+ o = bfd_section_from_elf_index (abfd, i);
+ if (o != NULL)
+ o->target_index = bfd_get_symcount (abfd);
+ elfsym.st_shndx = i;
+ if (info->relocatable || o == NULL)
+ elfsym.st_value = 0;
+ else
+ elfsym.st_value = o->vma;
+ if (! elf_link_output_sym (&finfo, NULL, &elfsym, o, NULL))
+ goto error_return;
+ if (i == SHN_LORESERVE - 1)
+ i += SHN_HIRESERVE + 1 - SHN_LORESERVE;
+ }
+ }
+
+ /* Allocate some memory to hold information read in from the input
+ files. */
+ if (max_contents_size != 0)
+ {
+ finfo.contents = bfd_malloc (max_contents_size);
+ if (finfo.contents == NULL)
+ goto error_return;
+ }
+
+ if (max_external_reloc_size != 0)
+ {
+ finfo.external_relocs = bfd_malloc (max_external_reloc_size);
+ if (finfo.external_relocs == NULL)
+ goto error_return;
+ }
+
+ if (max_internal_reloc_count != 0)
+ {
+ amt = max_internal_reloc_count * bed->s->int_rels_per_ext_rel;
+ amt *= sizeof (Elf_Internal_Rela);
+ finfo.internal_relocs = bfd_malloc (amt);
+ if (finfo.internal_relocs == NULL)
+ goto error_return;
+ }
+
+ if (max_sym_count != 0)
+ {
+ amt = max_sym_count * bed->s->sizeof_sym;
+ finfo.external_syms = bfd_malloc (amt);
+ if (finfo.external_syms == NULL)
+ goto error_return;
+
+ amt = max_sym_count * sizeof (Elf_Internal_Sym);
+ finfo.internal_syms = bfd_malloc (amt);
+ if (finfo.internal_syms == NULL)
+ goto error_return;
+
+ amt = max_sym_count * sizeof (long);
+ finfo.indices = bfd_malloc (amt);
+ if (finfo.indices == NULL)
+ goto error_return;
+
+ amt = max_sym_count * sizeof (asection *);
+ finfo.sections = bfd_malloc (amt);
+ if (finfo.sections == NULL)
+ goto error_return;
+ }
+
+ if (max_sym_shndx_count != 0)
+ {
+ amt = max_sym_shndx_count * sizeof (Elf_External_Sym_Shndx);
+ finfo.locsym_shndx = bfd_malloc (amt);
+ if (finfo.locsym_shndx == NULL)
+ goto error_return;
+ }
+
+ if (elf_hash_table (info)->tls_sec)
+ {
+ bfd_vma base, end = 0;
+ asection *sec;
+
+ for (sec = elf_hash_table (info)->tls_sec;
+ sec && (sec->flags & SEC_THREAD_LOCAL);
+ sec = sec->next)
+ {
+ bfd_vma size = sec->_raw_size;
+
+ if (size == 0 && (sec->flags & SEC_HAS_CONTENTS) == 0)
+ {
+ struct bfd_link_order *o;
+
+ for (o = sec->link_order_head; o != NULL; o = o->next)
+ if (size < o->offset + o->size)
+ size = o->offset + o->size;
+ }
+ end = sec->vma + size;
+ }
+ base = elf_hash_table (info)->tls_sec->vma;
+ end = align_power (end, elf_hash_table (info)->tls_sec->alignment_power);
+ elf_hash_table (info)->tls_size = end - base;
+ }
+
+ /* Since ELF permits relocations to be against local symbols, we
+ must have the local symbols available when we do the relocations.
+ Since we would rather only read the local symbols once, and we
+ would rather not keep them in memory, we handle all the
+ relocations for a single input file at the same time.
+
+ Unfortunately, there is no way to know the total number of local
+ symbols until we have seen all of them, and the local symbol
+ indices precede the global symbol indices. This means that when
+ we are generating relocatable output, and we see a reloc against
+ a global symbol, we can not know the symbol index until we have
+ finished examining all the local symbols to see which ones we are
+ going to output. To deal with this, we keep the relocations in
+ memory, and don't output them until the end of the link. This is
+ an unfortunate waste of memory, but I don't see a good way around
+ it. Fortunately, it only happens when performing a relocatable
+ link, which is not the common case. FIXME: If keep_memory is set
+ we could write the relocs out and then read them again; I don't
+ know how bad the memory loss will be. */
+
+ for (sub = info->input_bfds; sub != NULL; sub = sub->link_next)
+ sub->output_has_begun = FALSE;
+ for (o = abfd->sections; o != NULL; o = o->next)
+ {
+ for (p = o->link_order_head; p != NULL; p = p->next)
+ {
+ if (p->type == bfd_indirect_link_order
+ && (bfd_get_flavour ((sub = p->u.indirect.section->owner))
+ == bfd_target_elf_flavour)
+ && elf_elfheader (sub)->e_ident[EI_CLASS] == bed->s->elfclass)
+ {
+ if (! sub->output_has_begun)
+ {
+ if (! elf_link_input_bfd (&finfo, sub))
+ goto error_return;
+ sub->output_has_begun = TRUE;
+ }
+ }
+ else if (p->type == bfd_section_reloc_link_order
+ || p->type == bfd_symbol_reloc_link_order)
+ {
+ if (! elf_reloc_link_order (abfd, info, o, p))
+ goto error_return;
+ }
+ else
+ {
+ if (! _bfd_default_link_order (abfd, info, o, p))
+ goto error_return;
+ }
+ }
+ }
+
+ /* Output any global symbols that got converted to local in a
+ version script or due to symbol visibility. We do this in a
+ separate step since ELF requires all local symbols to appear
+ prior to any global symbols. FIXME: We should only do this if
+ some global symbols were, in fact, converted to become local.
+ FIXME: Will this work correctly with the Irix 5 linker? */
+ eoinfo.failed = FALSE;
+ eoinfo.finfo = &finfo;
+ eoinfo.localsyms = TRUE;
+ elf_link_hash_traverse (elf_hash_table (info), elf_link_output_extsym,
+ &eoinfo);
+ if (eoinfo.failed)
+ return FALSE;
+
+ /* That wrote out all the local symbols. Finish up the symbol table
+ with the global symbols. Even if we want to strip everything we
+ can, we still need to deal with those global symbols that got
+ converted to local in a version script. */
+
+ /* The sh_info field records the index of the first non local symbol. */
+ symtab_hdr->sh_info = bfd_get_symcount (abfd);
+
+ if (dynamic
+ && finfo.dynsym_sec->output_section != bfd_abs_section_ptr)
+ {
+ Elf_Internal_Sym sym;
+ bfd_byte *dynsym = finfo.dynsym_sec->contents;
+ long last_local = 0;
+
+ /* Write out the section symbols for the output sections. */
+ if (info->shared)
+ {
+ asection *s;
+
+ sym.st_size = 0;
+ sym.st_name = 0;
+ sym.st_info = ELF_ST_INFO (STB_LOCAL, STT_SECTION);
+ sym.st_other = 0;
+
+ for (s = abfd->sections; s != NULL; s = s->next)
+ {
+ int indx;
+ bfd_byte *dest;
+ long dynindx;
+
+ indx = elf_section_data (s)->this_idx;
+ dynindx = elf_section_data (s)->dynindx;
+ BFD_ASSERT (indx > 0);
+ sym.st_shndx = indx;
+ sym.st_value = s->vma;
+ dest = dynsym + dynindx * bed->s->sizeof_sym;
+ bed->s->swap_symbol_out (abfd, &sym, dest, 0);
+ }
+
+ last_local = bfd_count_sections (abfd);
+ }
+
+ /* Write out the local dynsyms. */
+ if (elf_hash_table (info)->dynlocal)
+ {
+ struct elf_link_local_dynamic_entry *e;
+ for (e = elf_hash_table (info)->dynlocal; e ; e = e->next)
+ {
+ asection *s;
+ bfd_byte *dest;
+
+ sym.st_size = e->isym.st_size;
+ sym.st_other = e->isym.st_other;
+
+ /* Copy the internal symbol as is.
+ Note that we saved a word of storage and overwrote
+ the original st_name with the dynstr_index. */
+ sym = e->isym;
+
+ if (e->isym.st_shndx != SHN_UNDEF
+ && (e->isym.st_shndx < SHN_LORESERVE
+ || e->isym.st_shndx > SHN_HIRESERVE))
+ {
+ s = bfd_section_from_elf_index (e->input_bfd,
+ e->isym.st_shndx);
+
+ sym.st_shndx =
+ elf_section_data (s->output_section)->this_idx;
+ sym.st_value = (s->output_section->vma
+ + s->output_offset
+ + e->isym.st_value);
+ }
+
+ if (last_local < e->dynindx)
+ last_local = e->dynindx;
+
+ dest = dynsym + e->dynindx * bed->s->sizeof_sym;
+ bed->s->swap_symbol_out (abfd, &sym, dest, 0);
+ }
+ }
+
+ elf_section_data (finfo.dynsym_sec->output_section)->this_hdr.sh_info =
+ last_local + 1;
+ }
+
+ /* We get the global symbols from the hash table. */
+ eoinfo.failed = FALSE;
+ eoinfo.localsyms = FALSE;
+ eoinfo.finfo = &finfo;
+ elf_link_hash_traverse (elf_hash_table (info), elf_link_output_extsym,
+ &eoinfo);
+ if (eoinfo.failed)
+ return FALSE;
+
+ /* If backend needs to output some symbols not present in the hash
+ table, do it now. */
+ if (bed->elf_backend_output_arch_syms)
+ {
+ typedef bfd_boolean (*out_sym_func)
+ (void *, const char *, Elf_Internal_Sym *, asection *,
+ struct elf_link_hash_entry *);
+
+ if (! ((*bed->elf_backend_output_arch_syms)
+ (abfd, info, &finfo, (out_sym_func) elf_link_output_sym)))
+ return FALSE;
+ }
+
+ /* Flush all symbols to the file. */
+ if (! elf_link_flush_output_syms (&finfo, bed))
+ return FALSE;
+
+ /* Now we know the size of the symtab section. */
+ off += symtab_hdr->sh_size;
+
+ symtab_shndx_hdr = &elf_tdata (abfd)->symtab_shndx_hdr;
+ if (symtab_shndx_hdr->sh_name != 0)
+ {
+ symtab_shndx_hdr->sh_type = SHT_SYMTAB_SHNDX;
+ symtab_shndx_hdr->sh_entsize = sizeof (Elf_External_Sym_Shndx);
+ symtab_shndx_hdr->sh_addralign = sizeof (Elf_External_Sym_Shndx);
+ amt = bfd_get_symcount (abfd) * sizeof (Elf_External_Sym_Shndx);
+ symtab_shndx_hdr->sh_size = amt;
+
+ off = _bfd_elf_assign_file_position_for_section (symtab_shndx_hdr,
+ off, TRUE);
+
+ if (bfd_seek (abfd, symtab_shndx_hdr->sh_offset, SEEK_SET) != 0
+ || (bfd_bwrite (finfo.symshndxbuf, amt, abfd) != amt))
+ return FALSE;
+ }
+
+
+ /* Finish up and write out the symbol string table (.strtab)
+ section. */
+ symstrtab_hdr = &elf_tdata (abfd)->strtab_hdr;
+ /* sh_name was set in prep_headers. */
+ symstrtab_hdr->sh_type = SHT_STRTAB;
+ symstrtab_hdr->sh_flags = 0;
+ symstrtab_hdr->sh_addr = 0;
+ symstrtab_hdr->sh_size = _bfd_stringtab_size (finfo.symstrtab);
+ symstrtab_hdr->sh_entsize = 0;
+ symstrtab_hdr->sh_link = 0;
+ symstrtab_hdr->sh_info = 0;
+ /* sh_offset is set just below. */
+ symstrtab_hdr->sh_addralign = 1;
+
+ off = _bfd_elf_assign_file_position_for_section (symstrtab_hdr, off, TRUE);
+ elf_tdata (abfd)->next_file_pos = off;
+
+ if (bfd_get_symcount (abfd) > 0)
+ {
+ if (bfd_seek (abfd, symstrtab_hdr->sh_offset, SEEK_SET) != 0
+ || ! _bfd_stringtab_emit (abfd, finfo.symstrtab))
+ return FALSE;
+ }
+
+ /* Adjust the relocs to have the correct symbol indices. */
+ for (o = abfd->sections; o != NULL; o = o->next)
+ {
+ if ((o->flags & SEC_RELOC) == 0)
+ continue;
+
+ elf_link_adjust_relocs (abfd, &elf_section_data (o)->rel_hdr,
+ elf_section_data (o)->rel_count,
+ elf_section_data (o)->rel_hashes);
+ if (elf_section_data (o)->rel_hdr2 != NULL)
+ elf_link_adjust_relocs (abfd, elf_section_data (o)->rel_hdr2,
+ elf_section_data (o)->rel_count2,
+ (elf_section_data (o)->rel_hashes
+ + elf_section_data (o)->rel_count));
+
+ /* Set the reloc_count field to 0 to prevent write_relocs from
+ trying to swap the relocs out itself. */
+ o->reloc_count = 0;
+ }
+
+ if (dynamic && info->combreloc && dynobj != NULL)
+ relativecount = elf_link_sort_relocs (abfd, info, &reldyn);
+
+ /* If we are linking against a dynamic object, or generating a
+ shared library, finish up the dynamic linking information. */
+ if (dynamic)
+ {
+ bfd_byte *dyncon, *dynconend;
+
+ /* Fix up .dynamic entries. */
+ o = bfd_get_section_by_name (dynobj, ".dynamic");
+ BFD_ASSERT (o != NULL);
+
+ dyncon = o->contents;
+ dynconend = o->contents + o->_raw_size;
+ for (; dyncon < dynconend; dyncon += bed->s->sizeof_dyn)
+ {
+ Elf_Internal_Dyn dyn;
+ const char *name;
+ unsigned int type;
+
+ bed->s->swap_dyn_in (dynobj, dyncon, &dyn);
+
+ switch (dyn.d_tag)
+ {
+ default:
+ continue;
+ case DT_NULL:
+ if (relativecount > 0 && dyncon + bed->s->sizeof_dyn < dynconend)
+ {
+ switch (elf_section_data (reldyn)->this_hdr.sh_type)
+ {
+ case SHT_REL: dyn.d_tag = DT_RELCOUNT; break;
+ case SHT_RELA: dyn.d_tag = DT_RELACOUNT; break;
+ default: continue;
+ }
+ dyn.d_un.d_val = relativecount;
+ relativecount = 0;
+ break;
+ }
+ continue;
+
+ case DT_INIT:
+ name = info->init_function;
+ goto get_sym;
+ case DT_FINI:
+ name = info->fini_function;
+ get_sym:
+ {
+ struct elf_link_hash_entry *h;
+
+ h = elf_link_hash_lookup (elf_hash_table (info), name,
+ FALSE, FALSE, TRUE);
+ if (h != NULL
+ && (h->root.type == bfd_link_hash_defined
+ || h->root.type == bfd_link_hash_defweak))
+ {
+ dyn.d_un.d_val = h->root.u.def.value;
+ o = h->root.u.def.section;
+ if (o->output_section != NULL)
+ dyn.d_un.d_val += (o->output_section->vma
+ + o->output_offset);
+ else
+ {
+ /* The symbol is imported from another shared
+ library and does not apply to this one. */
+ dyn.d_un.d_val = 0;
+ }
+ break;
+ }
+ }
+ continue;
+
+ case DT_PREINIT_ARRAYSZ:
+ name = ".preinit_array";
+ goto get_size;
+ case DT_INIT_ARRAYSZ:
+ name = ".init_array";
+ goto get_size;
+ case DT_FINI_ARRAYSZ:
+ name = ".fini_array";
+ get_size:
+ o = bfd_get_section_by_name (abfd, name);
+ if (o == NULL)
+ {
+ (*_bfd_error_handler)
+ (_("%s: could not find output section %s"),
+ bfd_get_filename (abfd), name);
+ goto error_return;
+ }
+ if (o->_raw_size == 0)
+ (*_bfd_error_handler)
+ (_("warning: %s section has zero size"), name);
+ dyn.d_un.d_val = o->_raw_size;
+ break;
+
+ case DT_PREINIT_ARRAY:
+ name = ".preinit_array";
+ goto get_vma;
+ case DT_INIT_ARRAY:
+ name = ".init_array";
+ goto get_vma;
+ case DT_FINI_ARRAY:
+ name = ".fini_array";
+ goto get_vma;
+
+ case DT_HASH:
+ name = ".hash";
+ goto get_vma;
+ case DT_STRTAB:
+ name = ".dynstr";
+ goto get_vma;
+ case DT_SYMTAB:
+ name = ".dynsym";
+ goto get_vma;
+ case DT_VERDEF:
+ name = ".gnu.version_d";
+ goto get_vma;
+ case DT_VERNEED:
+ name = ".gnu.version_r";
+ goto get_vma;
+ case DT_VERSYM:
+ name = ".gnu.version";
+ get_vma:
+ o = bfd_get_section_by_name (abfd, name);
+ if (o == NULL)
+ {
+ (*_bfd_error_handler)
+ (_("%s: could not find output section %s"),
+ bfd_get_filename (abfd), name);
+ goto error_return;
+ }
+ dyn.d_un.d_ptr = o->vma;
+ break;
+
+ case DT_REL:
+ case DT_RELA:
+ case DT_RELSZ:
+ case DT_RELASZ:
+ if (dyn.d_tag == DT_REL || dyn.d_tag == DT_RELSZ)
+ type = SHT_REL;
+ else
+ type = SHT_RELA;
+ dyn.d_un.d_val = 0;
+ for (i = 1; i < elf_numsections (abfd); i++)
+ {
+ Elf_Internal_Shdr *hdr;
+
+ hdr = elf_elfsections (abfd)[i];
+ if (hdr->sh_type == type
+ && (hdr->sh_flags & SHF_ALLOC) != 0)
+ {
+ if (dyn.d_tag == DT_RELSZ || dyn.d_tag == DT_RELASZ)
+ dyn.d_un.d_val += hdr->sh_size;
+ else
+ {
+ if (dyn.d_un.d_val == 0
+ || hdr->sh_addr < dyn.d_un.d_val)
+ dyn.d_un.d_val = hdr->sh_addr;
+ }
+ }
+ }
+ break;
+ }
+ bed->s->swap_dyn_out (dynobj, &dyn, dyncon);
+ }
+ }
+
+ /* If we have created any dynamic sections, then output them. */
+ if (dynobj != NULL)
+ {
+ if (! (*bed->elf_backend_finish_dynamic_sections) (abfd, info))
+ goto error_return;
+
+ for (o = dynobj->sections; o != NULL; o = o->next)
+ {
+ if ((o->flags & SEC_HAS_CONTENTS) == 0
+ || o->_raw_size == 0
+ || o->output_section == bfd_abs_section_ptr)
+ continue;
+ if ((o->flags & SEC_LINKER_CREATED) == 0)
+ {
+ /* At this point, we are only interested in sections
+ created by _bfd_elf_link_create_dynamic_sections. */
+ continue;
+ }
+ if ((elf_section_data (o->output_section)->this_hdr.sh_type
+ != SHT_STRTAB)
+ || strcmp (bfd_get_section_name (abfd, o), ".dynstr") != 0)
+ {
+ if (! bfd_set_section_contents (abfd, o->output_section,
+ o->contents,
+ (file_ptr) o->output_offset,
+ o->_raw_size))
+ goto error_return;
+ }
+ else
+ {
+ /* The contents of the .dynstr section are actually in a
+ stringtab. */
+ off = elf_section_data (o->output_section)->this_hdr.sh_offset;
+ if (bfd_seek (abfd, off, SEEK_SET) != 0
+ || ! _bfd_elf_strtab_emit (abfd,
+ elf_hash_table (info)->dynstr))
+ goto error_return;
+ }
+ }
+ }
+
+ if (info->relocatable)
+ {
+ bfd_boolean failed = FALSE;
+
+ bfd_map_over_sections (abfd, bfd_elf_set_group_contents, &failed);
+ if (failed)
+ goto error_return;
+ }
+
+ /* If we have optimized stabs strings, output them. */
+ if (elf_hash_table (info)->stab_info != NULL)
+ {
+ if (! _bfd_write_stab_strings (abfd, &elf_hash_table (info)->stab_info))
+ goto error_return;
+ }
+
+ if (info->eh_frame_hdr)
+ {
+ if (! _bfd_elf_write_section_eh_frame_hdr (abfd, info))
+ goto error_return;
+ }
+
+ if (finfo.symstrtab != NULL)
+ _bfd_stringtab_free (finfo.symstrtab);
+ if (finfo.contents != NULL)
+ free (finfo.contents);
+ if (finfo.external_relocs != NULL)
+ free (finfo.external_relocs);
+ if (finfo.internal_relocs != NULL)
+ free (finfo.internal_relocs);
+ if (finfo.external_syms != NULL)
+ free (finfo.external_syms);
+ if (finfo.locsym_shndx != NULL)
+ free (finfo.locsym_shndx);
+ if (finfo.internal_syms != NULL)
+ free (finfo.internal_syms);
+ if (finfo.indices != NULL)
+ free (finfo.indices);
+ if (finfo.sections != NULL)
+ free (finfo.sections);
+ if (finfo.symbuf != NULL)
+ free (finfo.symbuf);
+ if (finfo.symshndxbuf != NULL)
+ free (finfo.symshndxbuf);
+ for (o = abfd->sections; o != NULL; o = o->next)
+ {
+ if ((o->flags & SEC_RELOC) != 0
+ && elf_section_data (o)->rel_hashes != NULL)
+ free (elf_section_data (o)->rel_hashes);
+ }
+
+ elf_tdata (abfd)->linker = TRUE;
+
+ return TRUE;
+
+ error_return:
+ if (finfo.symstrtab != NULL)
+ _bfd_stringtab_free (finfo.symstrtab);
+ if (finfo.contents != NULL)
+ free (finfo.contents);
+ if (finfo.external_relocs != NULL)
+ free (finfo.external_relocs);
+ if (finfo.internal_relocs != NULL)
+ free (finfo.internal_relocs);
+ if (finfo.external_syms != NULL)
+ free (finfo.external_syms);
+ if (finfo.locsym_shndx != NULL)
+ free (finfo.locsym_shndx);
+ if (finfo.internal_syms != NULL)
+ free (finfo.internal_syms);
+ if (finfo.indices != NULL)
+ free (finfo.indices);
+ if (finfo.sections != NULL)
+ free (finfo.sections);
+ if (finfo.symbuf != NULL)
+ free (finfo.symbuf);
+ if (finfo.symshndxbuf != NULL)
+ free (finfo.symshndxbuf);
+ for (o = abfd->sections; o != NULL; o = o->next)
+ {
+ if ((o->flags & SEC_RELOC) != 0
+ && elf_section_data (o)->rel_hashes != NULL)
+ free (elf_section_data (o)->rel_hashes);
+ }
+
+ return FALSE;
}
-/* Find a linker generated pointer with a given addend and type. */
+/* Garbage collect unused sections. */
-elf_linker_section_pointers_t *
-_bfd_elf_find_pointer_linker_section (linker_pointers, addend, which)
- elf_linker_section_pointers_t *linker_pointers;
- bfd_vma addend;
- elf_linker_section_enum_t which;
+/* 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)
{
- for ( ; linker_pointers != NULL; linker_pointers = linker_pointers->next)
+ bfd_boolean ret;
+ asection *group_sec;
+
+ sec->gc_mark = 1;
+
+ /* Mark all the sections in the group. */
+ group_sec = elf_section_data (sec)->next_in_group;
+ if (group_sec && !group_sec->gc_mark)
+ if (!elf_gc_mark (info, group_sec, gc_mark_hook))
+ return FALSE;
+
+ /* Look through the section relocs. */
+ ret = TRUE;
+ if ((sec->flags & SEC_RELOC) != 0 && sec->reloc_count > 0)
{
- if (which == linker_pointers->which && addend == linker_pointers->addend)
- return linker_pointers;
+ Elf_Internal_Rela *relstart, *rel, *relend;
+ Elf_Internal_Shdr *symtab_hdr;
+ struct elf_link_hash_entry **sym_hashes;
+ size_t nlocsyms;
+ size_t extsymoff;
+ bfd *input_bfd = sec->owner;
+ const struct elf_backend_data *bed = get_elf_backend_data (input_bfd);
+ Elf_Internal_Sym *isym = NULL;
+ int r_sym_shift;
+
+ symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr;
+ sym_hashes = elf_sym_hashes (input_bfd);
+
+ /* Read the local symbols. */
+ if (elf_bad_symtab (input_bfd))
+ {
+ nlocsyms = symtab_hdr->sh_size / bed->s->sizeof_sym;
+ extsymoff = 0;
+ }
+ else
+ extsymoff = nlocsyms = symtab_hdr->sh_info;
+
+ isym = (Elf_Internal_Sym *) symtab_hdr->contents;
+ if (isym == NULL && nlocsyms != 0)
+ {
+ isym = bfd_elf_get_elf_syms (input_bfd, symtab_hdr, nlocsyms, 0,
+ NULL, NULL, NULL);
+ if (isym == NULL)
+ return FALSE;
+ }
+
+ /* Read the relocations. */
+ relstart = _bfd_elf_link_read_relocs (input_bfd, sec, NULL, NULL,
+ info->keep_memory);
+ if (relstart == NULL)
+ {
+ ret = FALSE;
+ goto out1;
+ }
+ relend = relstart + sec->reloc_count * bed->s->int_rels_per_ext_rel;
+
+ if (bed->s->arch_size == 32)
+ r_sym_shift = 8;
+ else
+ r_sym_shift = 32;
+
+ for (rel = relstart; rel < relend; rel++)
+ {
+ unsigned long r_symndx;
+ asection *rsec;
+ struct elf_link_hash_entry *h;
+
+ r_symndx = rel->r_info >> r_sym_shift;
+ if (r_symndx == 0)
+ continue;
+
+ if (r_symndx >= nlocsyms
+ || ELF_ST_BIND (isym[r_symndx].st_info) != STB_LOCAL)
+ {
+ h = sym_hashes[r_symndx - extsymoff];
+ rsec = (*gc_mark_hook) (sec, info, rel, h, NULL);
+ }
+ else
+ {
+ rsec = (*gc_mark_hook) (sec, info, rel, NULL, &isym[r_symndx]);
+ }
+
+ if (rsec && !rsec->gc_mark)
+ {
+ if (bfd_get_flavour (rsec->owner) != bfd_target_elf_flavour)
+ rsec->gc_mark = 1;
+ else if (!elf_gc_mark (info, rsec, gc_mark_hook))
+ {
+ ret = FALSE;
+ goto out2;
+ }
+ }
+ }
+
+ out2:
+ if (elf_section_data (sec)->relocs != relstart)
+ free (relstart);
+ out1:
+ if (isym != NULL && symtab_hdr->contents != (unsigned char *) isym)
+ {
+ if (! info->keep_memory)
+ free (isym);
+ else
+ symtab_hdr->contents = (unsigned char *) isym;
+ }
}
- return (elf_linker_section_pointers_t *)0;
+ return ret;
+}
+
+/* Sweep symbols in swept sections. Called via elf_link_hash_traverse. */
+
+static bfd_boolean
+elf_gc_sweep_symbol (struct elf_link_hash_entry *h, void *idxptr)
+{
+ int *idx = idxptr;
+
+ if (h->root.type == bfd_link_hash_warning)
+ h = (struct elf_link_hash_entry *) h->root.u.i.link;
+
+ if (h->dynindx != -1
+ && ((h->root.type != bfd_link_hash_defined
+ && h->root.type != bfd_link_hash_defweak)
+ || h->root.u.def.section->gc_mark))
+ h->dynindx = (*idx)++;
+
+ return TRUE;
+}
+
+/* The sweep phase of garbage collection. Remove all garbage sections. */
+
+typedef bfd_boolean (*gc_sweep_hook_fn)
+ (bfd *, struct bfd_link_info *, asection *, const Elf_Internal_Rela *);
+
+static bfd_boolean
+elf_gc_sweep (struct bfd_link_info *info, gc_sweep_hook_fn gc_sweep_hook)
+{
+ bfd *sub;
+
+ for (sub = info->input_bfds; sub != NULL; sub = sub->link_next)
+ {
+ asection *o;
+
+ if (bfd_get_flavour (sub) != bfd_target_elf_flavour)
+ continue;
+
+ for (o = sub->sections; o != NULL; o = o->next)
+ {
+ /* Keep special sections. Keep .debug sections. */
+ if ((o->flags & SEC_LINKER_CREATED)
+ || (o->flags & SEC_DEBUGGING))
+ o->gc_mark = 1;
+
+ if (o->gc_mark)
+ continue;
+
+ /* Skip sweeping sections already excluded. */
+ if (o->flags & SEC_EXCLUDE)
+ continue;
+
+ /* Since this is early in the link process, it is simple
+ to remove a section from the output. */
+ o->flags |= SEC_EXCLUDE;
+
+ /* But we also have to update some of the relocation
+ info we collected before. */
+ if (gc_sweep_hook
+ && (o->flags & SEC_RELOC) && o->reloc_count > 0)
+ {
+ Elf_Internal_Rela *internal_relocs;
+ bfd_boolean r;
+
+ internal_relocs
+ = _bfd_elf_link_read_relocs (o->owner, o, NULL, NULL,
+ info->keep_memory);
+ if (internal_relocs == NULL)
+ return FALSE;
+
+ r = (*gc_sweep_hook) (o->owner, info, o, internal_relocs);
+
+ if (elf_section_data (o)->relocs != internal_relocs)
+ free (internal_relocs);
+
+ if (!r)
+ return FALSE;
+ }
+ }
+ }
+
+ /* Remove the symbols that were in the swept sections from the dynamic
+ symbol table. GCFIXME: Anyone know how to get them out of the
+ static symbol table as well? */
+ {
+ int i = 0;
+
+ elf_link_hash_traverse (elf_hash_table (info), elf_gc_sweep_symbol, &i);
+
+ elf_hash_table (info)->dynsymcount = i;
+ }
+
+ return TRUE;
+}
+
+/* Propagate collected vtable information. This is called through
+ elf_link_hash_traverse. */
+
+static bfd_boolean
+elf_gc_propagate_vtable_entries_used (struct elf_link_hash_entry *h, void *okp)
+{
+ if (h->root.type == bfd_link_hash_warning)
+ h = (struct elf_link_hash_entry *) h->root.u.i.link;
+
+ /* Those that are not vtables. */
+ if (h->vtable_parent == NULL)
+ return TRUE;
+
+ /* Those vtables that do not have parents, we cannot merge. */
+ if (h->vtable_parent == (struct elf_link_hash_entry *) -1)
+ return TRUE;
+
+ /* If we've already been done, exit. */
+ if (h->vtable_entries_used && h->vtable_entries_used[-1])
+ return TRUE;
+
+ /* Make sure the parent's table is up to date. */
+ elf_gc_propagate_vtable_entries_used (h->vtable_parent, okp);
+
+ if (h->vtable_entries_used == NULL)
+ {
+ /* None of this table's entries were referenced. Re-use the
+ parent's table. */
+ h->vtable_entries_used = h->vtable_parent->vtable_entries_used;
+ h->vtable_entries_size = h->vtable_parent->vtable_entries_size;
+ }
+ else
+ {
+ size_t n;
+ bfd_boolean *cu, *pu;
+
+ /* Or the parent's entries into ours. */
+ cu = h->vtable_entries_used;
+ cu[-1] = TRUE;
+ pu = h->vtable_parent->vtable_entries_used;
+ if (pu != NULL)
+ {
+ const struct elf_backend_data *bed;
+ unsigned int log_file_align;
+
+ bed = get_elf_backend_data (h->root.u.def.section->owner);
+ log_file_align = bed->s->log_file_align;
+ n = h->vtable_parent->vtable_entries_size >> log_file_align;
+ while (n--)
+ {
+ if (*pu)
+ *cu = TRUE;
+ pu++;
+ cu++;
+ }
+ }
+ }
+
+ return TRUE;
+}
+
+static bfd_boolean
+elf_gc_smash_unused_vtentry_relocs (struct elf_link_hash_entry *h, void *okp)
+{
+ asection *sec;
+ bfd_vma hstart, hend;
+ Elf_Internal_Rela *relstart, *relend, *rel;
+ const struct elf_backend_data *bed;
+ unsigned int log_file_align;
+
+ if (h->root.type == bfd_link_hash_warning)
+ h = (struct elf_link_hash_entry *) h->root.u.i.link;
+
+ /* Take care of both those symbols that do not describe vtables as
+ well as those that are not loaded. */
+ if (h->vtable_parent == NULL)
+ return TRUE;
+
+ BFD_ASSERT (h->root.type == bfd_link_hash_defined
+ || h->root.type == bfd_link_hash_defweak);
+
+ sec = h->root.u.def.section;
+ hstart = h->root.u.def.value;
+ hend = hstart + h->size;
+
+ relstart = _bfd_elf_link_read_relocs (sec->owner, sec, NULL, NULL, TRUE);
+ if (!relstart)
+ return *(bfd_boolean *) okp = FALSE;
+ bed = get_elf_backend_data (sec->owner);
+ log_file_align = bed->s->log_file_align;
+
+ relend = relstart + sec->reloc_count * bed->s->int_rels_per_ext_rel;
+
+ for (rel = relstart; rel < relend; ++rel)
+ if (rel->r_offset >= hstart && rel->r_offset < hend)
+ {
+ /* If the entry is in use, do nothing. */
+ if (h->vtable_entries_used
+ && (rel->r_offset - hstart) < h->vtable_entries_size)
+ {
+ bfd_vma entry = (rel->r_offset - hstart) >> log_file_align;
+ if (h->vtable_entries_used[entry])
+ continue;
+ }
+ /* Otherwise, kill it. */
+ rel->r_offset = rel->r_info = rel->r_addend = 0;
+ }
+
+ return TRUE;
+}
+
+/* Do mark and sweep of unused sections. */
+
+bfd_boolean
+bfd_elf_gc_sections (bfd *abfd, struct bfd_link_info *info)
+{
+ bfd_boolean ok = TRUE;
+ bfd *sub;
+ asection * (*gc_mark_hook)
+ (asection *, struct bfd_link_info *, Elf_Internal_Rela *,
+ struct elf_link_hash_entry *h, Elf_Internal_Sym *);
+
+ if (!get_elf_backend_data (abfd)->can_gc_sections
+ || info->relocatable
+ || info->emitrelocations
+ || !is_elf_hash_table (info->hash)
+ || elf_hash_table (info)->dynamic_sections_created)
+ {
+ (*_bfd_error_handler)(_("Warning: gc-sections option ignored"));
+ return TRUE;
+ }
+
+ /* Apply transitive closure to the vtable entry usage info. */
+ elf_link_hash_traverse (elf_hash_table (info),
+ elf_gc_propagate_vtable_entries_used,
+ &ok);
+ if (!ok)
+ return FALSE;
+
+ /* Kill the vtable relocations that were not used. */
+ elf_link_hash_traverse (elf_hash_table (info),
+ elf_gc_smash_unused_vtentry_relocs,
+ &ok);
+ if (!ok)
+ return FALSE;
+
+ /* Grovel through relocs to find out who stays ... */
+
+ gc_mark_hook = get_elf_backend_data (abfd)->gc_mark_hook;
+ for (sub = info->input_bfds; sub != NULL; sub = sub->link_next)
+ {
+ asection *o;
+
+ if (bfd_get_flavour (sub) != bfd_target_elf_flavour)
+ continue;
+
+ for (o = sub->sections; o != NULL; o = o->next)
+ {
+ if (o->flags & SEC_KEEP)
+ if (!elf_gc_mark (info, o, gc_mark_hook))
+ return FALSE;
+ }
+ }
+
+ /* ... and mark SEC_EXCLUDE for those that go. */
+ if (!elf_gc_sweep (info, get_elf_backend_data (abfd)->gc_sweep_hook))
+ return FALSE;
+
+ return TRUE;
}
-/* Make the .rela section corresponding to the generated linker section. */
-
-boolean
-_bfd_elf_make_linker_section_rela (dynobj, lsect, alignment)
- bfd *dynobj;
- elf_linker_section_t *lsect;
- int alignment;
-{
- if (lsect->rel_section)
- return true;
-
- lsect->rel_section = bfd_get_section_by_name (dynobj, lsect->rel_name);
- if (lsect->rel_section == NULL)
- {
- lsect->rel_section = bfd_make_section (dynobj, lsect->rel_name);
- if (lsect->rel_section == NULL
- || ! bfd_set_section_flags (dynobj,
- lsect->rel_section,
- (SEC_ALLOC
- | SEC_LOAD
- | SEC_HAS_CONTENTS
- | SEC_IN_MEMORY
- | SEC_LINKER_CREATED
- | SEC_READONLY))
- || ! bfd_set_section_alignment (dynobj, lsect->rel_section, alignment))
- return false;
- }
-
- return true;
+/* Called from check_relocs to record the existence of a VTINHERIT reloc. */
+
+bfd_boolean
+bfd_elf_gc_record_vtinherit (bfd *abfd,
+ asection *sec,
+ struct elf_link_hash_entry *h,
+ bfd_vma offset)
+{
+ struct elf_link_hash_entry **sym_hashes, **sym_hashes_end;
+ struct elf_link_hash_entry **search, *child;
+ bfd_size_type extsymcount;
+ const struct elf_backend_data *bed = get_elf_backend_data (abfd);
+
+ /* The sh_info field of the symtab header tells us where the
+ external symbols start. We don't care about the local symbols at
+ this point. */
+ extsymcount = elf_tdata (abfd)->symtab_hdr.sh_size / bed->s->sizeof_sym;
+ if (!elf_bad_symtab (abfd))
+ extsymcount -= elf_tdata (abfd)->symtab_hdr.sh_info;
+
+ sym_hashes = elf_sym_hashes (abfd);
+ sym_hashes_end = sym_hashes + extsymcount;
+
+ /* Hunt down the child symbol, which is in this section at the same
+ offset as the relocation. */
+ for (search = sym_hashes; search != sym_hashes_end; ++search)
+ {
+ if ((child = *search) != NULL
+ && (child->root.type == bfd_link_hash_defined
+ || child->root.type == bfd_link_hash_defweak)
+ && child->root.u.def.section == sec
+ && child->root.u.def.value == offset)
+ goto win;
+ }
+
+ (*_bfd_error_handler) ("%s: %s+%lu: No symbol found for INHERIT",
+ bfd_archive_filename (abfd), sec->name,
+ (unsigned long) offset);
+ bfd_set_error (bfd_error_invalid_operation);
+ return FALSE;
+
+ win:
+ if (!h)
+ {
+ /* This *should* only be the absolute section. It could potentially
+ be that someone has defined a non-global vtable though, which
+ would be bad. It isn't worth paging in the local symbols to be
+ sure though; that case should simply be handled by the assembler. */
+
+ child->vtable_parent = (struct elf_link_hash_entry *) -1;
+ }
+ else
+ child->vtable_parent = h;
+
+ return TRUE;
+}
+
+/* Called from check_relocs to record the existence of a VTENTRY reloc. */
+
+bfd_boolean
+bfd_elf_gc_record_vtentry (bfd *abfd ATTRIBUTE_UNUSED,
+ asection *sec ATTRIBUTE_UNUSED,
+ struct elf_link_hash_entry *h,
+ bfd_vma addend)
+{
+ const struct elf_backend_data *bed = get_elf_backend_data (abfd);
+ unsigned int log_file_align = bed->s->log_file_align;
+
+ if (addend >= h->vtable_entries_size)
+ {
+ size_t size, bytes, file_align;
+ bfd_boolean *ptr = h->vtable_entries_used;
+
+ /* While the symbol is undefined, we have to be prepared to handle
+ a zero size. */
+ file_align = 1 << log_file_align;
+ if (h->root.type == bfd_link_hash_undefined)
+ size = addend + file_align;
+ else
+ {
+ size = h->size;
+ if (addend >= size)
+ {
+ /* Oops! We've got a reference past the defined end of
+ the table. This is probably a bug -- shall we warn? */
+ size = addend + file_align;
+ }
+ }
+ size = (size + file_align - 1) & -file_align;
+
+ /* Allocate one extra entry for use as a "done" flag for the
+ consolidation pass. */
+ bytes = ((size >> log_file_align) + 1) * sizeof (bfd_boolean);
+
+ if (ptr)
+ {
+ ptr = bfd_realloc (ptr - 1, bytes);
+
+ if (ptr != NULL)
+ {
+ size_t oldbytes;
+
+ oldbytes = (((h->vtable_entries_size >> log_file_align) + 1)
+ * sizeof (bfd_boolean));
+ memset (((char *) ptr) + oldbytes, 0, bytes - oldbytes);
+ }
+ }
+ else
+ ptr = bfd_zmalloc (bytes);
+
+ if (ptr == NULL)
+ return FALSE;
+
+ /* And arrange for that done flag to be at index -1. */
+ h->vtable_entries_used = ptr + 1;
+ h->vtable_entries_size = size;
+ }
+
+ h->vtable_entries_used[addend >> log_file_align] = TRUE;
+
+ return TRUE;
+}
+
+struct alloc_got_off_arg {
+ bfd_vma gotoff;
+ unsigned int got_elt_size;
+};
+
+/* We need a special top-level link routine to convert got reference counts
+ to real got offsets. */
+
+static bfd_boolean
+elf_gc_allocate_got_offsets (struct elf_link_hash_entry *h, void *arg)
+{
+ struct alloc_got_off_arg *gofarg = arg;
+
+ if (h->root.type == bfd_link_hash_warning)
+ h = (struct elf_link_hash_entry *) h->root.u.i.link;
+
+ if (h->got.refcount > 0)
+ {
+ h->got.offset = gofarg->gotoff;
+ gofarg->gotoff += gofarg->got_elt_size;
+ }
+ else
+ h->got.offset = (bfd_vma) -1;
+
+ return TRUE;
+}
+
+/* And an accompanying bit to work out final got entry offsets once
+ we're done. Should be called from final_link. */
+
+bfd_boolean
+bfd_elf_gc_common_finalize_got_offsets (bfd *abfd,
+ struct bfd_link_info *info)
+{
+ bfd *i;
+ const struct elf_backend_data *bed = get_elf_backend_data (abfd);
+ bfd_vma gotoff;
+ unsigned int got_elt_size = bed->s->arch_size / 8;
+ struct alloc_got_off_arg gofarg;
+
+ if (! is_elf_hash_table (info->hash))
+ return FALSE;
+
+ /* The GOT offset is relative to the .got section, but the GOT header is
+ put into the .got.plt section, if the backend uses it. */
+ if (bed->want_got_plt)
+ gotoff = 0;
+ else
+ gotoff = bed->got_header_size;
+
+ /* Do the local .got entries first. */
+ for (i = info->input_bfds; i; i = i->link_next)
+ {
+ bfd_signed_vma *local_got;
+ bfd_size_type j, locsymcount;
+ Elf_Internal_Shdr *symtab_hdr;
+
+ if (bfd_get_flavour (i) != bfd_target_elf_flavour)
+ continue;
+
+ local_got = elf_local_got_refcounts (i);
+ if (!local_got)
+ continue;
+
+ symtab_hdr = &elf_tdata (i)->symtab_hdr;
+ if (elf_bad_symtab (i))
+ locsymcount = symtab_hdr->sh_size / bed->s->sizeof_sym;
+ else
+ locsymcount = symtab_hdr->sh_info;
+
+ for (j = 0; j < locsymcount; ++j)
+ {
+ if (local_got[j] > 0)
+ {
+ local_got[j] = gotoff;
+ gotoff += got_elt_size;
+ }
+ else
+ local_got[j] = (bfd_vma) -1;
+ }
+ }
+
+ /* Then the global .got entries. .plt refcounts are handled by
+ adjust_dynamic_symbol */
+ gofarg.gotoff = gotoff;
+ gofarg.got_elt_size = got_elt_size;
+ elf_link_hash_traverse (elf_hash_table (info),
+ elf_gc_allocate_got_offsets,
+ &gofarg);
+ return TRUE;
+}
+
+/* Many folk need no more in the way of final link than this, once
+ got entry reference counting is enabled. */
+
+bfd_boolean
+bfd_elf_gc_common_final_link (bfd *abfd, struct bfd_link_info *info)
+{
+ if (!bfd_elf_gc_common_finalize_got_offsets (abfd, info))
+ return FALSE;
+
+ /* Invoke the regular ELF backend linker to do all the work. */
+ return bfd_elf_final_link (abfd, info);
+}
+
+bfd_boolean
+bfd_elf_reloc_symbol_deleted_p (bfd_vma offset, void *cookie)
+{
+ struct elf_reloc_cookie *rcookie = cookie;
+
+ if (rcookie->bad_symtab)
+ rcookie->rel = rcookie->rels;
+
+ for (; rcookie->rel < rcookie->relend; rcookie->rel++)
+ {
+ unsigned long r_symndx;
+
+ if (! rcookie->bad_symtab)
+ if (rcookie->rel->r_offset > offset)
+ return FALSE;
+ if (rcookie->rel->r_offset != offset)
+ continue;
+
+ r_symndx = rcookie->rel->r_info >> rcookie->r_sym_shift;
+ if (r_symndx == SHN_UNDEF)
+ return TRUE;
+
+ if (r_symndx >= rcookie->locsymcount
+ || ELF_ST_BIND (rcookie->locsyms[r_symndx].st_info) != STB_LOCAL)
+ {
+ struct elf_link_hash_entry *h;
+
+ h = rcookie->sym_hashes[r_symndx - rcookie->extsymoff];
+
+ while (h->root.type == bfd_link_hash_indirect
+ || h->root.type == bfd_link_hash_warning)
+ h = (struct elf_link_hash_entry *) h->root.u.i.link;
+
+ if ((h->root.type == bfd_link_hash_defined
+ || h->root.type == bfd_link_hash_defweak)
+ && elf_discarded_section (h->root.u.def.section))
+ return TRUE;
+ else
+ return FALSE;
+ }
+ else
+ {
+ /* It's not a relocation against a global symbol,
+ but it could be a relocation against a local
+ symbol for a discarded section. */
+ asection *isec;
+ Elf_Internal_Sym *isym;
+
+ /* Need to: get the symbol; get the section. */
+ isym = &rcookie->locsyms[r_symndx];
+ if (isym->st_shndx < SHN_LORESERVE || isym->st_shndx > SHN_HIRESERVE)
+ {
+ isec = bfd_section_from_elf_index (rcookie->abfd, isym->st_shndx);
+ if (isec != NULL && elf_discarded_section (isec))
+ return TRUE;
+ }
+ }
+ return FALSE;
+ }
+ return FALSE;
+}
+
+/* Discard unneeded references to discarded sections.
+ Returns TRUE if any section's size was changed. */
+/* This function assumes that the relocations are in sorted order,
+ which is true for all known assemblers. */
+
+bfd_boolean
+bfd_elf_discard_info (bfd *output_bfd, struct bfd_link_info *info)
+{
+ struct elf_reloc_cookie cookie;
+ asection *stab, *eh;
+ Elf_Internal_Shdr *symtab_hdr;
+ const struct elf_backend_data *bed;
+ bfd *abfd;
+ unsigned int count;
+ bfd_boolean ret = FALSE;
+
+ if (info->traditional_format
+ || !is_elf_hash_table (info->hash))
+ return FALSE;
+
+ for (abfd = info->input_bfds; abfd != NULL; abfd = abfd->link_next)
+ {
+ if (bfd_get_flavour (abfd) != bfd_target_elf_flavour)
+ continue;
+
+ bed = get_elf_backend_data (abfd);
+
+ if ((abfd->flags & DYNAMIC) != 0)
+ continue;
+
+ eh = bfd_get_section_by_name (abfd, ".eh_frame");
+ if (info->relocatable
+ || (eh != NULL
+ && (eh->_raw_size == 0
+ || bfd_is_abs_section (eh->output_section))))
+ eh = NULL;
+
+ stab = bfd_get_section_by_name (abfd, ".stab");
+ if (stab != NULL
+ && (stab->_raw_size == 0
+ || bfd_is_abs_section (stab->output_section)
+ || stab->sec_info_type != ELF_INFO_TYPE_STABS))
+ stab = NULL;
+
+ if (stab == NULL
+ && eh == NULL
+ && bed->elf_backend_discard_info == NULL)
+ continue;
+
+ symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
+ cookie.abfd = abfd;
+ cookie.sym_hashes = elf_sym_hashes (abfd);
+ cookie.bad_symtab = elf_bad_symtab (abfd);
+ if (cookie.bad_symtab)
+ {
+ cookie.locsymcount = symtab_hdr->sh_size / bed->s->sizeof_sym;
+ cookie.extsymoff = 0;
+ }
+ else
+ {
+ cookie.locsymcount = symtab_hdr->sh_info;
+ cookie.extsymoff = symtab_hdr->sh_info;
+ }
+
+ if (bed->s->arch_size == 32)
+ cookie.r_sym_shift = 8;
+ else
+ cookie.r_sym_shift = 32;
+
+ cookie.locsyms = (Elf_Internal_Sym *) symtab_hdr->contents;
+ if (cookie.locsyms == NULL && cookie.locsymcount != 0)
+ {
+ cookie.locsyms = bfd_elf_get_elf_syms (abfd, symtab_hdr,
+ cookie.locsymcount, 0,
+ NULL, NULL, NULL);
+ if (cookie.locsyms == NULL)
+ return FALSE;
+ }
+
+ if (stab != NULL)
+ {
+ cookie.rels = NULL;
+ count = stab->reloc_count;
+ if (count != 0)
+ cookie.rels = _bfd_elf_link_read_relocs (abfd, stab, NULL, NULL,
+ info->keep_memory);
+ if (cookie.rels != NULL)
+ {
+ cookie.rel = cookie.rels;
+ cookie.relend = cookie.rels;
+ cookie.relend += count * bed->s->int_rels_per_ext_rel;
+ if (_bfd_discard_section_stabs (abfd, stab,
+ elf_section_data (stab)->sec_info,
+ bfd_elf_reloc_symbol_deleted_p,
+ &cookie))
+ ret = TRUE;
+ if (elf_section_data (stab)->relocs != cookie.rels)
+ free (cookie.rels);
+ }
+ }
+
+ if (eh != NULL)
+ {
+ cookie.rels = NULL;
+ count = eh->reloc_count;
+ if (count != 0)
+ cookie.rels = _bfd_elf_link_read_relocs (abfd, eh, NULL, NULL,
+ info->keep_memory);
+ cookie.rel = cookie.rels;
+ cookie.relend = cookie.rels;
+ if (cookie.rels != NULL)
+ cookie.relend += count * bed->s->int_rels_per_ext_rel;
+
+ if (_bfd_elf_discard_section_eh_frame (abfd, info, eh,
+ bfd_elf_reloc_symbol_deleted_p,
+ &cookie))
+ ret = TRUE;
+
+ if (cookie.rels != NULL
+ && elf_section_data (eh)->relocs != cookie.rels)
+ free (cookie.rels);
+ }
+
+ if (bed->elf_backend_discard_info != NULL
+ && (*bed->elf_backend_discard_info) (abfd, &cookie, info))
+ ret = TRUE;
+
+ if (cookie.locsyms != NULL
+ && symtab_hdr->contents != (unsigned char *) cookie.locsyms)
+ {
+ if (! info->keep_memory)
+ free (cookie.locsyms);
+ else
+ symtab_hdr->contents = (unsigned char *) cookie.locsyms;
+ }
+ }
+
+ if (info->eh_frame_hdr
+ && !info->relocatable
+ && _bfd_elf_discard_section_eh_frame_hdr (output_bfd, info))
+ ret = TRUE;
+
+ return ret;
}
diff --git a/contrib/binutils/bfd/elfxx-ia64.c b/contrib/binutils/bfd/elfxx-ia64.c
index 06a279e..b19aac2 100644
--- a/contrib/binutils/bfd/elfxx-ia64.c
+++ b/contrib/binutils/bfd/elfxx-ia64.c
@@ -1,22 +1,23 @@
/* IA-64 support for 64-bit ELF
- Copyright 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
+ Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2004
+ Free Software Foundation, Inc.
Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
-This file is part of BFD, the Binary File Descriptor library.
+ This 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "bfd.h"
#include "sysdep.h"
@@ -24,38 +25,36 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "elf-bfd.h"
#include "opcode/ia64.h"
#include "elf/ia64.h"
+#include "objalloc.h"
+#include "hashtab.h"
-/*
- * THE RULES for all the stuff the linker creates --
- *
- * GOT Entries created in response to LTOFF or LTOFF_FPTR
- * relocations. Dynamic relocs created for dynamic
- * symbols in an application; REL relocs for locals
- * in a shared library.
- *
- * FPTR The canonical function descriptor. Created for local
- * symbols in applications. Descriptors for dynamic symbols
- * and local symbols in shared libraries are created by
- * ld.so. Thus there are no dynamic relocs against these
- * objects. The FPTR relocs for such _are_ passed through
- * to the dynamic relocation tables.
- *
- * FULL_PLT Created for a PCREL21B relocation against a dynamic symbol.
- * Requires the creation of a PLTOFF entry. This does not
- * require any dynamic relocations.
- *
- * PLTOFF Created by PLTOFF relocations. For local symbols, this
- * is an alternate function descriptor, and in shared libraries
- * requires two REL relocations. Note that this cannot be
- * transformed into an FPTR relocation, since it must be in
- * range of the GP. For dynamic symbols, this is a function
- * descriptor for a MIN_PLT entry, and requires one IPLT reloc.
- *
- * MIN_PLT Created by PLTOFF entries against dynamic symbols. This
- * does not reqire dynamic relocations.
- */
-
-#define USE_RELA /* we want RELA relocs, not REL */
+/* THE RULES for all the stuff the linker creates --
+
+ GOT Entries created in response to LTOFF or LTOFF_FPTR
+ relocations. Dynamic relocs created for dynamic
+ symbols in an application; REL relocs for locals
+ in a shared library.
+
+ FPTR The canonical function descriptor. Created for local
+ symbols in applications. Descriptors for dynamic symbols
+ and local symbols in shared libraries are created by
+ ld.so. Thus there are no dynamic relocs against these
+ objects. The FPTR relocs for such _are_ passed through
+ to the dynamic relocation tables.
+
+ FULL_PLT Created for a PCREL21B relocation against a dynamic symbol.
+ Requires the creation of a PLTOFF entry. This does not
+ require any dynamic relocations.
+
+ PLTOFF Created by PLTOFF relocations. For local symbols, this
+ is an alternate function descriptor, and in shared libraries
+ requires two REL relocations. Note that this cannot be
+ transformed into an FPTR relocation, since it must be in
+ range of the GP. For dynamic symbols, this is a function
+ descriptor for a MIN_PLT entry, and requires one IPLT reloc.
+
+ MIN_PLT Created by PLTOFF entries against dynamic symbols. This
+ does not require dynamic relocations. */
#define NELEMS(a) ((int) (sizeof (a) / sizeof ((a)[0])))
@@ -83,7 +82,7 @@ struct elfNN_ia64_dyn_sym_info
bfd_vma dtpmod_offset;
bfd_vma dtprel_offset;
- /* The symbol table entry, if any, that this was derrived from. */
+ /* The symbol table entry, if any, that this was derived from. */
struct elf_link_hash_entry *h;
/* Used to count non-got, non-plt relocations for delayed sizing
@@ -94,9 +93,12 @@ struct elfNN_ia64_dyn_sym_info
asection *srel;
int type;
int count;
+
+ /* Is this reloc against readonly section? */
+ bfd_boolean reltext;
} *reloc_entries;
- /* True when the section contents have been updated. */
+ /* TRUE when the section contents have been updated. */
unsigned got_done : 1;
unsigned fptr_done : 1;
unsigned pltoff_done : 1;
@@ -104,8 +106,9 @@ struct elfNN_ia64_dyn_sym_info
unsigned dtpmod_done : 1;
unsigned dtprel_done : 1;
- /* True for the different kinds of linker data we want created. */
+ /* TRUE for the different kinds of linker data we want created. */
unsigned want_got : 1;
+ unsigned want_gotx : 1;
unsigned want_fptr : 1;
unsigned want_ltoff_fptr : 1;
unsigned want_plt : 1;
@@ -118,20 +121,15 @@ struct elfNN_ia64_dyn_sym_info
struct elfNN_ia64_local_hash_entry
{
- struct bfd_hash_entry root;
+ int id;
+ unsigned int r_sym;
struct elfNN_ia64_dyn_sym_info *info;
- /* True if this hash entry's addends was translated for
+ /* TRUE if this hash entry's addends was translated for
SHF_MERGE optimization. */
unsigned sec_merge_done : 1;
};
-struct elfNN_ia64_local_hash_table
-{
- struct bfd_hash_table root;
- /* No additional fields for now. */
-};
-
struct elfNN_ia64_link_hash_entry
{
struct elf_link_hash_entry root;
@@ -140,20 +138,30 @@ struct elfNN_ia64_link_hash_entry
struct elfNN_ia64_link_hash_table
{
- /* The main hash table */
+ /* The main hash table. */
struct elf_link_hash_table root;
asection *got_sec; /* the linkage table section (or NULL) */
asection *rel_got_sec; /* dynamic relocation section for same */
asection *fptr_sec; /* function descriptor table (or NULL) */
+ asection *rel_fptr_sec; /* dynamic relocation section for same */
asection *plt_sec; /* the primary plt section (or NULL) */
asection *pltoff_sec; /* private descriptors for plt (or NULL) */
asection *rel_pltoff_sec; /* dynamic relocation section for same */
bfd_size_type minplt_entries; /* number of minplt entries */
unsigned reltext : 1; /* are there relocs against readonly sections? */
+ unsigned self_dtpmod_done : 1;/* has self DTPMOD entry been finished? */
+ bfd_vma self_dtpmod_offset; /* .got offset to self DTPMOD entry */
- struct elfNN_ia64_local_hash_table loc_hash_table;
+ htab_t loc_hash_table;
+ void *loc_hash_memory;
+};
+
+struct elfNN_ia64_allocate_data
+{
+ struct bfd_link_info *info;
+ bfd_size_type ofs;
};
#define elfNN_ia64_hash_table(p) \
@@ -167,76 +175,66 @@ static reloc_howto_type * lookup_howto
static reloc_howto_type *elfNN_ia64_reloc_type_lookup
PARAMS ((bfd *abfd, bfd_reloc_code_real_type bfd_code));
static void elfNN_ia64_info_to_howto
- PARAMS ((bfd *abfd, arelent *bfd_reloc, ElfNN_Internal_Rela *elf_reloc));
-static boolean elfNN_ia64_relax_section
+ PARAMS ((bfd *abfd, arelent *bfd_reloc, Elf_Internal_Rela *elf_reloc));
+static bfd_boolean elfNN_ia64_relax_section
PARAMS((bfd *abfd, asection *sec, struct bfd_link_info *link_info,
- boolean *again));
-static boolean is_unwind_section_name
+ bfd_boolean *again));
+static void elfNN_ia64_relax_ldxmov
+ PARAMS((bfd *abfd, bfd_byte *contents, bfd_vma off));
+static bfd_boolean is_unwind_section_name
PARAMS ((bfd *abfd, const char *));
-static boolean elfNN_ia64_section_from_shdr
- PARAMS ((bfd *, ElfNN_Internal_Shdr *, const char *));
-static boolean elfNN_ia64_section_flags
- PARAMS ((flagword *, ElfNN_Internal_Shdr *));
-static boolean elfNN_ia64_fake_sections
- PARAMS ((bfd *abfd, ElfNN_Internal_Shdr *hdr, asection *sec));
+static bfd_boolean elfNN_ia64_section_from_shdr
+ PARAMS ((bfd *, Elf_Internal_Shdr *, const char *));
+static bfd_boolean elfNN_ia64_section_flags
+ PARAMS ((flagword *, Elf_Internal_Shdr *));
+static bfd_boolean elfNN_ia64_fake_sections
+ PARAMS ((bfd *abfd, Elf_Internal_Shdr *hdr, asection *sec));
static void elfNN_ia64_final_write_processing
- PARAMS ((bfd *abfd, boolean linker));
-static boolean elfNN_ia64_add_symbol_hook
- PARAMS ((bfd *abfd, struct bfd_link_info *info, const Elf_Internal_Sym *sym,
- const char **namep, flagword *flagsp, asection **secp,
- bfd_vma *valp));
-static boolean elfNN_ia64_aix_vec
- PARAMS ((const bfd_target *vec));
-static boolean elfNN_ia64_aix_add_symbol_hook
- PARAMS ((bfd *abfd, struct bfd_link_info *info, const Elf_Internal_Sym *sym,
+ PARAMS ((bfd *abfd, bfd_boolean linker));
+static bfd_boolean elfNN_ia64_add_symbol_hook
+ PARAMS ((bfd *abfd, struct bfd_link_info *info, Elf_Internal_Sym *sym,
const char **namep, flagword *flagsp, asection **secp,
bfd_vma *valp));
-static boolean elfNN_ia64_aix_link_add_symbols
- PARAMS ((bfd *abfd, struct bfd_link_info *info));
static int elfNN_ia64_additional_program_headers
PARAMS ((bfd *abfd));
-static boolean elfNN_ia64_modify_segment_map
- PARAMS ((bfd *));
-static boolean elfNN_ia64_is_local_label_name
+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 boolean elfNN_ia64_dynamic_symbol_p
- PARAMS ((struct elf_link_hash_entry *h, struct bfd_link_info *info));
-static boolean elfNN_ia64_local_hash_table_init
- PARAMS ((struct elfNN_ia64_local_hash_table *ht, bfd *abfd,
- new_hash_entry_func new));
-static struct bfd_hash_entry *elfNN_ia64_new_loc_hash_entry
- PARAMS ((struct bfd_hash_entry *entry, struct bfd_hash_table *table,
- const char *string));
+static bfd_boolean elfNN_ia64_dynamic_symbol_p
+ PARAMS ((struct elf_link_hash_entry *h, struct bfd_link_info *info, int));
static struct bfd_hash_entry *elfNN_ia64_new_elf_hash_entry
PARAMS ((struct bfd_hash_entry *entry, struct bfd_hash_table *table,
const char *string));
static void elfNN_ia64_hash_copy_indirect
- PARAMS ((struct elf_backend_data *, struct elf_link_hash_entry *,
+ PARAMS ((const struct elf_backend_data *, struct elf_link_hash_entry *,
struct elf_link_hash_entry *));
static void elfNN_ia64_hash_hide_symbol
- PARAMS ((struct bfd_link_info *, struct elf_link_hash_entry *, boolean));
+ PARAMS ((struct bfd_link_info *, struct elf_link_hash_entry *, bfd_boolean));
+static hashval_t elfNN_ia64_local_htab_hash PARAMS ((const void *));
+static int elfNN_ia64_local_htab_eq PARAMS ((const void *ptr1,
+ const void *ptr2));
static struct bfd_link_hash_table *elfNN_ia64_hash_table_create
PARAMS ((bfd *abfd));
-static struct elfNN_ia64_local_hash_entry *elfNN_ia64_local_hash_lookup
- PARAMS ((struct elfNN_ia64_local_hash_table *table, const char *string,
- boolean create, boolean copy));
-static boolean elfNN_ia64_global_dyn_sym_thunk
- PARAMS ((struct bfd_hash_entry *, PTR));
-static boolean elfNN_ia64_local_dyn_sym_thunk
+static void elfNN_ia64_hash_table_free
+ PARAMS ((struct bfd_link_hash_table *hash));
+static bfd_boolean elfNN_ia64_global_dyn_sym_thunk
PARAMS ((struct bfd_hash_entry *, PTR));
+static int elfNN_ia64_local_dyn_sym_thunk
+ PARAMS ((void **, PTR));
static void elfNN_ia64_dyn_sym_traverse
PARAMS ((struct elfNN_ia64_link_hash_table *ia64_info,
- boolean (*func) (struct elfNN_ia64_dyn_sym_info *, PTR),
+ bfd_boolean (*func) (struct elfNN_ia64_dyn_sym_info *, PTR),
PTR info));
-static boolean elfNN_ia64_create_dynamic_sections
+static bfd_boolean elfNN_ia64_create_dynamic_sections
PARAMS ((bfd *abfd, struct bfd_link_info *info));
static struct elfNN_ia64_local_hash_entry * get_local_sym_hash
PARAMS ((struct elfNN_ia64_link_hash_table *ia64_info,
- bfd *abfd, const Elf_Internal_Rela *rel, boolean create));
+ bfd *abfd, const Elf_Internal_Rela *rel, bfd_boolean create));
static struct elfNN_ia64_dyn_sym_info * get_dyn_sym_info
PARAMS ((struct elfNN_ia64_link_hash_table *ia64_info,
struct elf_link_hash_entry *h,
- bfd *abfd, const Elf_Internal_Rela *rel, boolean create));
+ bfd *abfd, const Elf_Internal_Rela *rel, bfd_boolean create));
static asection *get_got
PARAMS ((bfd *abfd, struct bfd_link_info *info,
struct elfNN_ia64_link_hash_table *ia64_info));
@@ -248,34 +246,31 @@ static asection *get_pltoff
struct elfNN_ia64_link_hash_table *ia64_info));
static asection *get_reloc_section
PARAMS ((bfd *abfd, struct elfNN_ia64_link_hash_table *ia64_info,
- asection *sec, boolean create));
-static boolean count_dyn_reloc
- PARAMS ((bfd *abfd, struct elfNN_ia64_dyn_sym_info *dyn_i,
- asection *srel, int type));
-static boolean elfNN_ia64_check_relocs
+ asection *sec, bfd_boolean create));
+static bfd_boolean elfNN_ia64_check_relocs
PARAMS ((bfd *abfd, struct bfd_link_info *info, asection *sec,
const Elf_Internal_Rela *relocs));
-static boolean elfNN_ia64_adjust_dynamic_symbol
+static bfd_boolean elfNN_ia64_adjust_dynamic_symbol
PARAMS ((struct bfd_link_info *info, struct elf_link_hash_entry *h));
static long global_sym_index
PARAMS ((struct elf_link_hash_entry *h));
-static boolean allocate_fptr
+static bfd_boolean allocate_fptr
PARAMS ((struct elfNN_ia64_dyn_sym_info *dyn_i, PTR data));
-static boolean allocate_global_data_got
+static bfd_boolean allocate_global_data_got
PARAMS ((struct elfNN_ia64_dyn_sym_info *dyn_i, PTR data));
-static boolean allocate_global_fptr_got
+static bfd_boolean allocate_global_fptr_got
PARAMS ((struct elfNN_ia64_dyn_sym_info *dyn_i, PTR data));
-static boolean allocate_local_got
+static bfd_boolean allocate_local_got
PARAMS ((struct elfNN_ia64_dyn_sym_info *dyn_i, PTR data));
-static boolean allocate_pltoff_entries
+static bfd_boolean allocate_pltoff_entries
PARAMS ((struct elfNN_ia64_dyn_sym_info *dyn_i, PTR data));
-static boolean allocate_plt_entries
+static bfd_boolean allocate_plt_entries
PARAMS ((struct elfNN_ia64_dyn_sym_info *dyn_i, PTR data));
-static boolean allocate_plt2_entries
+static bfd_boolean allocate_plt2_entries
PARAMS ((struct elfNN_ia64_dyn_sym_info *dyn_i, PTR data));
-static boolean allocate_dynrel_entries
+static bfd_boolean allocate_dynrel_entries
PARAMS ((struct elfNN_ia64_dyn_sym_info *dyn_i, PTR data));
-static boolean elfNN_ia64_size_dynamic_sections
+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));
@@ -294,41 +289,43 @@ static bfd_vma set_fptr_entry
static bfd_vma set_pltoff_entry
PARAMS ((bfd *abfd, struct bfd_link_info *info,
struct elfNN_ia64_dyn_sym_info *dyn_i,
- bfd_vma value, boolean));
+ bfd_vma value, bfd_boolean));
static bfd_vma elfNN_ia64_tprel_base
PARAMS ((struct bfd_link_info *info));
static bfd_vma elfNN_ia64_dtprel_base
PARAMS ((struct bfd_link_info *info));
static int elfNN_ia64_unwind_entry_compare
PARAMS ((const PTR, const PTR));
-static boolean elfNN_ia64_final_link
+static bfd_boolean elfNN_ia64_choose_gp
PARAMS ((bfd *abfd, struct bfd_link_info *info));
-static boolean elfNN_ia64_relocate_section
+static bfd_boolean elfNN_ia64_final_link
+ PARAMS ((bfd *abfd, struct bfd_link_info *info));
+static bfd_boolean elfNN_ia64_relocate_section
PARAMS ((bfd *output_bfd, struct bfd_link_info *info, bfd *input_bfd,
asection *input_section, bfd_byte *contents,
Elf_Internal_Rela *relocs, Elf_Internal_Sym *local_syms,
asection **local_sections));
-static boolean elfNN_ia64_finish_dynamic_symbol
+static bfd_boolean elfNN_ia64_finish_dynamic_symbol
PARAMS ((bfd *output_bfd, struct bfd_link_info *info,
struct elf_link_hash_entry *h, Elf_Internal_Sym *sym));
-static boolean elfNN_ia64_finish_dynamic_sections
+static bfd_boolean elfNN_ia64_finish_dynamic_sections
PARAMS ((bfd *abfd, struct bfd_link_info *info));
-static boolean elfNN_ia64_set_private_flags
+static bfd_boolean elfNN_ia64_set_private_flags
PARAMS ((bfd *abfd, flagword flags));
-static boolean elfNN_ia64_merge_private_bfd_data
+static bfd_boolean elfNN_ia64_merge_private_bfd_data
PARAMS ((bfd *ibfd, bfd *obfd));
-static boolean elfNN_ia64_print_private_bfd_data
+static bfd_boolean elfNN_ia64_print_private_bfd_data
PARAMS ((bfd *abfd, PTR ptr));
static enum elf_reloc_type_class elfNN_ia64_reloc_type_class
PARAMS ((const Elf_Internal_Rela *));
-static boolean elfNN_ia64_hpux_vec
+static bfd_boolean elfNN_ia64_hpux_vec
PARAMS ((const bfd_target *vec));
static void elfNN_hpux_post_process_headers
PARAMS ((bfd *abfd, struct bfd_link_info *info));
-boolean elfNN_hpux_backend_section_from_bfd_section
+bfd_boolean elfNN_hpux_backend_section_from_bfd_section
PARAMS ((bfd *abfd, asection *sec, int *retval));
-/* ia64-specific relocation */
+/* ia64-specific relocation. */
/* Perform a relocation. Not much to do here as all the hard work is
done in elfNN_ia64_final_link_relocate. */
@@ -348,121 +345,125 @@ elfNN_ia64_reloc (abfd, reloc, sym, data, input_section,
reloc->address += input_section->output_offset;
return bfd_reloc_ok;
}
+
+ if (input_section->flags & SEC_DEBUGGING)
+ return bfd_reloc_continue;
+
*error_message = "Unsupported call to elfNN_ia64_reloc";
return bfd_reloc_notsupported;
}
#define IA64_HOWTO(TYPE, NAME, SIZE, PCREL, IN) \
HOWTO (TYPE, 0, SIZE, 0, PCREL, 0, complain_overflow_signed, \
- elfNN_ia64_reloc, NAME, false, 0, 0, IN)
+ elfNN_ia64_reloc, NAME, FALSE, 0, -1, IN)
/* This table has to be sorted according to increasing number of the
TYPE field. */
static reloc_howto_type ia64_howto_table[] =
{
- IA64_HOWTO (R_IA64_NONE, "NONE", 0, false, true),
-
- IA64_HOWTO (R_IA64_IMM14, "IMM14", 0, false, true),
- IA64_HOWTO (R_IA64_IMM22, "IMM22", 0, false, true),
- IA64_HOWTO (R_IA64_IMM64, "IMM64", 0, false, true),
- IA64_HOWTO (R_IA64_DIR32MSB, "DIR32MSB", 2, false, true),
- IA64_HOWTO (R_IA64_DIR32LSB, "DIR32LSB", 2, false, true),
- IA64_HOWTO (R_IA64_DIR64MSB, "DIR64MSB", 4, false, true),
- IA64_HOWTO (R_IA64_DIR64LSB, "DIR64LSB", 4, false, true),
-
- IA64_HOWTO (R_IA64_GPREL22, "GPREL22", 0, false, true),
- IA64_HOWTO (R_IA64_GPREL64I, "GPREL64I", 0, false, true),
- IA64_HOWTO (R_IA64_GPREL32MSB, "GPREL32MSB", 2, false, true),
- IA64_HOWTO (R_IA64_GPREL32LSB, "GPREL32LSB", 2, false, true),
- IA64_HOWTO (R_IA64_GPREL64MSB, "GPREL64MSB", 4, false, true),
- IA64_HOWTO (R_IA64_GPREL64LSB, "GPREL64LSB", 4, false, true),
-
- IA64_HOWTO (R_IA64_LTOFF22, "LTOFF22", 0, false, true),
- IA64_HOWTO (R_IA64_LTOFF64I, "LTOFF64I", 0, false, true),
-
- IA64_HOWTO (R_IA64_PLTOFF22, "PLTOFF22", 0, false, true),
- IA64_HOWTO (R_IA64_PLTOFF64I, "PLTOFF64I", 0, false, true),
- IA64_HOWTO (R_IA64_PLTOFF64MSB, "PLTOFF64MSB", 4, false, true),
- IA64_HOWTO (R_IA64_PLTOFF64LSB, "PLTOFF64LSB", 4, false, true),
-
- IA64_HOWTO (R_IA64_FPTR64I, "FPTR64I", 0, false, true),
- IA64_HOWTO (R_IA64_FPTR32MSB, "FPTR32MSB", 2, false, true),
- IA64_HOWTO (R_IA64_FPTR32LSB, "FPTR32LSB", 2, false, true),
- IA64_HOWTO (R_IA64_FPTR64MSB, "FPTR64MSB", 4, false, true),
- IA64_HOWTO (R_IA64_FPTR64LSB, "FPTR64LSB", 4, false, true),
-
- IA64_HOWTO (R_IA64_PCREL60B, "PCREL60B", 0, true, true),
- IA64_HOWTO (R_IA64_PCREL21B, "PCREL21B", 0, true, true),
- IA64_HOWTO (R_IA64_PCREL21M, "PCREL21M", 0, true, true),
- IA64_HOWTO (R_IA64_PCREL21F, "PCREL21F", 0, true, true),
- IA64_HOWTO (R_IA64_PCREL32MSB, "PCREL32MSB", 2, true, true),
- IA64_HOWTO (R_IA64_PCREL32LSB, "PCREL32LSB", 2, true, true),
- IA64_HOWTO (R_IA64_PCREL64MSB, "PCREL64MSB", 4, true, true),
- IA64_HOWTO (R_IA64_PCREL64LSB, "PCREL64LSB", 4, true, true),
-
- IA64_HOWTO (R_IA64_LTOFF_FPTR22, "LTOFF_FPTR22", 0, false, true),
- IA64_HOWTO (R_IA64_LTOFF_FPTR64I, "LTOFF_FPTR64I", 0, false, true),
- IA64_HOWTO (R_IA64_LTOFF_FPTR32MSB, "LTOFF_FPTR32MSB", 2, false, true),
- IA64_HOWTO (R_IA64_LTOFF_FPTR32LSB, "LTOFF_FPTR32LSB", 2, false, true),
- IA64_HOWTO (R_IA64_LTOFF_FPTR64MSB, "LTOFF_FPTR64MSB", 4, false, true),
- IA64_HOWTO (R_IA64_LTOFF_FPTR64LSB, "LTOFF_FPTR64LSB", 4, false, true),
-
- IA64_HOWTO (R_IA64_SEGREL32MSB, "SEGREL32MSB", 2, false, true),
- IA64_HOWTO (R_IA64_SEGREL32LSB, "SEGREL32LSB", 2, false, true),
- IA64_HOWTO (R_IA64_SEGREL64MSB, "SEGREL64MSB", 4, false, true),
- IA64_HOWTO (R_IA64_SEGREL64LSB, "SEGREL64LSB", 4, false, true),
-
- IA64_HOWTO (R_IA64_SECREL32MSB, "SECREL32MSB", 2, false, true),
- IA64_HOWTO (R_IA64_SECREL32LSB, "SECREL32LSB", 2, false, true),
- IA64_HOWTO (R_IA64_SECREL64MSB, "SECREL64MSB", 4, false, true),
- IA64_HOWTO (R_IA64_SECREL64LSB, "SECREL64LSB", 4, false, true),
-
- IA64_HOWTO (R_IA64_REL32MSB, "REL32MSB", 2, false, true),
- IA64_HOWTO (R_IA64_REL32LSB, "REL32LSB", 2, false, true),
- IA64_HOWTO (R_IA64_REL64MSB, "REL64MSB", 4, false, true),
- IA64_HOWTO (R_IA64_REL64LSB, "REL64LSB", 4, false, true),
-
- IA64_HOWTO (R_IA64_LTV32MSB, "LTV32MSB", 2, false, true),
- IA64_HOWTO (R_IA64_LTV32LSB, "LTV32LSB", 2, false, true),
- IA64_HOWTO (R_IA64_LTV64MSB, "LTV64MSB", 4, false, true),
- IA64_HOWTO (R_IA64_LTV64LSB, "LTV64LSB", 4, false, true),
-
- IA64_HOWTO (R_IA64_PCREL21BI, "PCREL21BI", 0, true, true),
- IA64_HOWTO (R_IA64_PCREL22, "PCREL22", 0, true, true),
- IA64_HOWTO (R_IA64_PCREL64I, "PCREL64I", 0, true, true),
-
- IA64_HOWTO (R_IA64_IPLTMSB, "IPLTMSB", 4, false, true),
- IA64_HOWTO (R_IA64_IPLTLSB, "IPLTLSB", 4, false, true),
- IA64_HOWTO (R_IA64_COPY, "COPY", 4, false, true),
- IA64_HOWTO (R_IA64_LTOFF22X, "LTOFF22X", 0, false, true),
- IA64_HOWTO (R_IA64_LDXMOV, "LDXMOV", 0, false, true),
-
- IA64_HOWTO (R_IA64_TPREL14, "TPREL14", 0, false, false),
- IA64_HOWTO (R_IA64_TPREL22, "TPREL22", 0, false, false),
- IA64_HOWTO (R_IA64_TPREL64I, "TPREL64I", 0, false, false),
- IA64_HOWTO (R_IA64_TPREL64MSB, "TPREL64MSB", 8, false, false),
- IA64_HOWTO (R_IA64_TPREL64LSB, "TPREL64LSB", 8, false, false),
- IA64_HOWTO (R_IA64_LTOFF_TPREL22, "LTOFF_TPREL22", 0, false, false),
-
- IA64_HOWTO (R_IA64_DTPMOD64MSB, "TPREL64MSB", 8, false, false),
- IA64_HOWTO (R_IA64_DTPMOD64LSB, "TPREL64LSB", 8, false, false),
- IA64_HOWTO (R_IA64_LTOFF_DTPMOD22, "LTOFF_DTPMOD22", 0, false, false),
-
- IA64_HOWTO (R_IA64_DTPREL14, "DTPREL14", 0, false, false),
- IA64_HOWTO (R_IA64_DTPREL22, "DTPREL22", 0, false, false),
- IA64_HOWTO (R_IA64_DTPREL64I, "DTPREL64I", 0, false, false),
- IA64_HOWTO (R_IA64_DTPREL32MSB, "DTPREL32MSB", 4, false, false),
- IA64_HOWTO (R_IA64_DTPREL32LSB, "DTPREL32LSB", 4, false, false),
- IA64_HOWTO (R_IA64_DTPREL64MSB, "DTPREL64MSB", 8, false, false),
- IA64_HOWTO (R_IA64_DTPREL64LSB, "DTPREL64LSB", 8, false, false),
- IA64_HOWTO (R_IA64_LTOFF_DTPREL22, "LTOFF_DTPREL22", 0, false, false),
+ IA64_HOWTO (R_IA64_NONE, "NONE", 0, FALSE, TRUE),
+
+ IA64_HOWTO (R_IA64_IMM14, "IMM14", 0, FALSE, TRUE),
+ IA64_HOWTO (R_IA64_IMM22, "IMM22", 0, FALSE, TRUE),
+ IA64_HOWTO (R_IA64_IMM64, "IMM64", 0, FALSE, TRUE),
+ IA64_HOWTO (R_IA64_DIR32MSB, "DIR32MSB", 2, FALSE, TRUE),
+ IA64_HOWTO (R_IA64_DIR32LSB, "DIR32LSB", 2, FALSE, TRUE),
+ IA64_HOWTO (R_IA64_DIR64MSB, "DIR64MSB", 4, FALSE, TRUE),
+ IA64_HOWTO (R_IA64_DIR64LSB, "DIR64LSB", 4, FALSE, TRUE),
+
+ IA64_HOWTO (R_IA64_GPREL22, "GPREL22", 0, FALSE, TRUE),
+ IA64_HOWTO (R_IA64_GPREL64I, "GPREL64I", 0, FALSE, TRUE),
+ IA64_HOWTO (R_IA64_GPREL32MSB, "GPREL32MSB", 2, FALSE, TRUE),
+ IA64_HOWTO (R_IA64_GPREL32LSB, "GPREL32LSB", 2, FALSE, TRUE),
+ IA64_HOWTO (R_IA64_GPREL64MSB, "GPREL64MSB", 4, FALSE, TRUE),
+ IA64_HOWTO (R_IA64_GPREL64LSB, "GPREL64LSB", 4, FALSE, TRUE),
+
+ IA64_HOWTO (R_IA64_LTOFF22, "LTOFF22", 0, FALSE, TRUE),
+ IA64_HOWTO (R_IA64_LTOFF64I, "LTOFF64I", 0, FALSE, TRUE),
+
+ IA64_HOWTO (R_IA64_PLTOFF22, "PLTOFF22", 0, FALSE, TRUE),
+ IA64_HOWTO (R_IA64_PLTOFF64I, "PLTOFF64I", 0, FALSE, TRUE),
+ IA64_HOWTO (R_IA64_PLTOFF64MSB, "PLTOFF64MSB", 4, FALSE, TRUE),
+ IA64_HOWTO (R_IA64_PLTOFF64LSB, "PLTOFF64LSB", 4, FALSE, TRUE),
+
+ IA64_HOWTO (R_IA64_FPTR64I, "FPTR64I", 0, FALSE, TRUE),
+ IA64_HOWTO (R_IA64_FPTR32MSB, "FPTR32MSB", 2, FALSE, TRUE),
+ IA64_HOWTO (R_IA64_FPTR32LSB, "FPTR32LSB", 2, FALSE, TRUE),
+ IA64_HOWTO (R_IA64_FPTR64MSB, "FPTR64MSB", 4, FALSE, TRUE),
+ IA64_HOWTO (R_IA64_FPTR64LSB, "FPTR64LSB", 4, FALSE, TRUE),
+
+ IA64_HOWTO (R_IA64_PCREL60B, "PCREL60B", 0, TRUE, TRUE),
+ IA64_HOWTO (R_IA64_PCREL21B, "PCREL21B", 0, TRUE, TRUE),
+ IA64_HOWTO (R_IA64_PCREL21M, "PCREL21M", 0, TRUE, TRUE),
+ IA64_HOWTO (R_IA64_PCREL21F, "PCREL21F", 0, TRUE, TRUE),
+ IA64_HOWTO (R_IA64_PCREL32MSB, "PCREL32MSB", 2, TRUE, TRUE),
+ IA64_HOWTO (R_IA64_PCREL32LSB, "PCREL32LSB", 2, TRUE, TRUE),
+ IA64_HOWTO (R_IA64_PCREL64MSB, "PCREL64MSB", 4, TRUE, TRUE),
+ IA64_HOWTO (R_IA64_PCREL64LSB, "PCREL64LSB", 4, TRUE, TRUE),
+
+ IA64_HOWTO (R_IA64_LTOFF_FPTR22, "LTOFF_FPTR22", 0, FALSE, TRUE),
+ IA64_HOWTO (R_IA64_LTOFF_FPTR64I, "LTOFF_FPTR64I", 0, FALSE, TRUE),
+ IA64_HOWTO (R_IA64_LTOFF_FPTR32MSB, "LTOFF_FPTR32MSB", 2, FALSE, TRUE),
+ IA64_HOWTO (R_IA64_LTOFF_FPTR32LSB, "LTOFF_FPTR32LSB", 2, FALSE, TRUE),
+ IA64_HOWTO (R_IA64_LTOFF_FPTR64MSB, "LTOFF_FPTR64MSB", 4, FALSE, TRUE),
+ IA64_HOWTO (R_IA64_LTOFF_FPTR64LSB, "LTOFF_FPTR64LSB", 4, FALSE, TRUE),
+
+ IA64_HOWTO (R_IA64_SEGREL32MSB, "SEGREL32MSB", 2, FALSE, TRUE),
+ IA64_HOWTO (R_IA64_SEGREL32LSB, "SEGREL32LSB", 2, FALSE, TRUE),
+ IA64_HOWTO (R_IA64_SEGREL64MSB, "SEGREL64MSB", 4, FALSE, TRUE),
+ IA64_HOWTO (R_IA64_SEGREL64LSB, "SEGREL64LSB", 4, FALSE, TRUE),
+
+ IA64_HOWTO (R_IA64_SECREL32MSB, "SECREL32MSB", 2, FALSE, TRUE),
+ IA64_HOWTO (R_IA64_SECREL32LSB, "SECREL32LSB", 2, FALSE, TRUE),
+ IA64_HOWTO (R_IA64_SECREL64MSB, "SECREL64MSB", 4, FALSE, TRUE),
+ IA64_HOWTO (R_IA64_SECREL64LSB, "SECREL64LSB", 4, FALSE, TRUE),
+
+ IA64_HOWTO (R_IA64_REL32MSB, "REL32MSB", 2, FALSE, TRUE),
+ IA64_HOWTO (R_IA64_REL32LSB, "REL32LSB", 2, FALSE, TRUE),
+ IA64_HOWTO (R_IA64_REL64MSB, "REL64MSB", 4, FALSE, TRUE),
+ IA64_HOWTO (R_IA64_REL64LSB, "REL64LSB", 4, FALSE, TRUE),
+
+ IA64_HOWTO (R_IA64_LTV32MSB, "LTV32MSB", 2, FALSE, TRUE),
+ IA64_HOWTO (R_IA64_LTV32LSB, "LTV32LSB", 2, FALSE, TRUE),
+ IA64_HOWTO (R_IA64_LTV64MSB, "LTV64MSB", 4, FALSE, TRUE),
+ IA64_HOWTO (R_IA64_LTV64LSB, "LTV64LSB", 4, FALSE, TRUE),
+
+ IA64_HOWTO (R_IA64_PCREL21BI, "PCREL21BI", 0, TRUE, TRUE),
+ IA64_HOWTO (R_IA64_PCREL22, "PCREL22", 0, TRUE, TRUE),
+ IA64_HOWTO (R_IA64_PCREL64I, "PCREL64I", 0, TRUE, TRUE),
+
+ IA64_HOWTO (R_IA64_IPLTMSB, "IPLTMSB", 4, FALSE, TRUE),
+ IA64_HOWTO (R_IA64_IPLTLSB, "IPLTLSB", 4, FALSE, TRUE),
+ IA64_HOWTO (R_IA64_COPY, "COPY", 4, FALSE, TRUE),
+ IA64_HOWTO (R_IA64_LTOFF22X, "LTOFF22X", 0, FALSE, TRUE),
+ IA64_HOWTO (R_IA64_LDXMOV, "LDXMOV", 0, FALSE, TRUE),
+
+ IA64_HOWTO (R_IA64_TPREL14, "TPREL14", 0, FALSE, FALSE),
+ IA64_HOWTO (R_IA64_TPREL22, "TPREL22", 0, FALSE, FALSE),
+ IA64_HOWTO (R_IA64_TPREL64I, "TPREL64I", 0, FALSE, FALSE),
+ IA64_HOWTO (R_IA64_TPREL64MSB, "TPREL64MSB", 4, FALSE, FALSE),
+ IA64_HOWTO (R_IA64_TPREL64LSB, "TPREL64LSB", 4, FALSE, FALSE),
+ IA64_HOWTO (R_IA64_LTOFF_TPREL22, "LTOFF_TPREL22", 0, FALSE, FALSE),
+
+ IA64_HOWTO (R_IA64_DTPMOD64MSB, "TPREL64MSB", 4, FALSE, FALSE),
+ IA64_HOWTO (R_IA64_DTPMOD64LSB, "TPREL64LSB", 4, FALSE, FALSE),
+ IA64_HOWTO (R_IA64_LTOFF_DTPMOD22, "LTOFF_DTPMOD22", 0, FALSE, FALSE),
+
+ IA64_HOWTO (R_IA64_DTPREL14, "DTPREL14", 0, FALSE, FALSE),
+ IA64_HOWTO (R_IA64_DTPREL22, "DTPREL22", 0, FALSE, FALSE),
+ IA64_HOWTO (R_IA64_DTPREL64I, "DTPREL64I", 0, FALSE, FALSE),
+ IA64_HOWTO (R_IA64_DTPREL32MSB, "DTPREL32MSB", 2, FALSE, FALSE),
+ IA64_HOWTO (R_IA64_DTPREL32LSB, "DTPREL32LSB", 2, FALSE, FALSE),
+ IA64_HOWTO (R_IA64_DTPREL64MSB, "DTPREL64MSB", 4, FALSE, FALSE),
+ IA64_HOWTO (R_IA64_DTPREL64LSB, "DTPREL64LSB", 4, FALSE, FALSE),
+ IA64_HOWTO (R_IA64_LTOFF_DTPREL22, "LTOFF_DTPREL22", 0, FALSE, FALSE),
};
static unsigned char elf_code_to_howto_index[R_IA64_MAX_RELOC_CODE + 1];
/* Given a BFD reloc type, return the matching HOWTO structure. */
-static reloc_howto_type*
+static reloc_howto_type *
lookup_howto (rtype)
unsigned int rtype;
{
@@ -601,7 +602,7 @@ static void
elfNN_ia64_info_to_howto (abfd, bfd_reloc, elf_reloc)
bfd *abfd ATTRIBUTE_UNUSED;
arelent *bfd_reloc;
- ElfNN_Internal_Rela *elf_reloc;
+ Elf_Internal_Rela *elf_reloc;
{
bfd_reloc->howto
= lookup_howto ((unsigned int) ELFNN_R_TYPE (elf_reloc->r_info));
@@ -635,7 +636,7 @@ static const bfd_byte plt_min_entry[PLT_MIN_ENTRY_SIZE] =
static const bfd_byte plt_full_entry[PLT_FULL_ENTRY_SIZE] =
{
0x0b, 0x78, 0x00, 0x02, 0x00, 0x24, /* [MMI] addl r15=0,r1;; */
- 0x00, 0x41, 0x3c, 0x30, 0x28, 0xc0, /* ld8 r16=[r15],8 */
+ 0x00, 0x41, 0x3c, 0x70, 0x29, 0xc0, /* ld8.acq r16=[r15],8*/
0x01, 0x08, 0x00, 0x84, /* mov r14=r1;; */
0x11, 0x08, 0x00, 0x1e, 0x18, 0x10, /* [MIB] ld8 r1=[r15] */
0x60, 0x80, 0x04, 0x80, 0x03, 0x00, /* mov b6=r16 */
@@ -643,22 +644,14 @@ static const bfd_byte plt_full_entry[PLT_FULL_ENTRY_SIZE] =
};
#define ELF_DYNAMIC_INTERPRETER "/usr/lib/ld.so.1"
-#define AIX_DYNAMIC_INTERPRETER "/usr/lib/ia64l64/libc.so.1"
-#define DYNAMIC_INTERPRETER(abfd) \
- (elfNN_ia64_aix_vec (abfd->xvec) ? AIX_DYNAMIC_INTERPRETER : ELF_DYNAMIC_INTERPRETER)
-/* Select out of range branch fixup type. Note that Itanium does
- not support brl, and so it gets emulated by the kernel. */
-#undef USE_BRL
-
-#ifdef USE_BRL
static const bfd_byte oor_brl[16] =
{
0x05, 0x00, 0x00, 0x00, 0x01, 0x00, /* [MLX] nop.m 0 */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* brl.sptk.few tgt;; */
0x00, 0x00, 0x00, 0xc0
};
-#else
+
static const bfd_byte oor_ip[48] =
{
0x04, 0x00, 0x00, 0x00, 0x01, 0x00, /* [MLX] nop.m 0 */
@@ -671,19 +664,54 @@ static const bfd_byte oor_ip[48] =
0x60, 0x80, 0x04, 0x80, 0x03, 0x00, /* mov b6=r16 */
0x60, 0x00, 0x80, 0x00 /* br b6;; */
};
-#endif
-
-/* These functions do relaxation for IA-64 ELF.
- This is primarily to support branches to targets out of range;
- relaxation of R_IA64_LTOFF22X and R_IA64_LDXMOV not yet supported. */
+static size_t oor_branch_size = sizeof (oor_brl);
+
+void
+bfd_elfNN_ia64_after_parse (int itanium)
+{
+ oor_branch_size = itanium ? sizeof (oor_ip) : sizeof (oor_brl);
+}
-static boolean
+static void
+elfNN_ia64_relax_brl (bfd *abfd, bfd_byte *contents, bfd_vma off)
+{
+ int template;
+ bfd_byte *hit_addr;
+ bfd_vma t0, t1, i0, i1, i2;
+
+ hit_addr = (bfd_byte *) (contents + off);
+ hit_addr -= (long) hit_addr & 0x3;
+ t0 = bfd_get_64 (abfd, hit_addr);
+ t1 = bfd_get_64 (abfd, hit_addr + 8);
+
+ /* Keep the instruction in slot 0. */
+ i0 = (t0 >> 5) & 0x1ffffffffffLL;
+ /* Use nop.b for slot 1. */
+ i1 = 0x4000000000LL;
+ /* For slot 2, turn brl into br by masking out bit 40. */
+ i2 = (t1 >> 23) & 0x0ffffffffffLL;
+
+ /* Turn a MLX bundle into a MBB bundle with the same stop-bit
+ variety. */
+ template = 0x12;
+ if ((t0 & 0x1fLL) == 5)
+ template += 1;
+ t0 = (i1 << 46) | (i0 << 5) | template;
+ t1 = (i2 << 23) | (i1 >> 18);
+
+ bfd_put_64 (abfd, t0, hit_addr);
+ bfd_put_64 (abfd, t1, hit_addr + 8);
+}
+
+/* These functions do relaxation for IA-64 ELF. */
+
+static bfd_boolean
elfNN_ia64_relax_section (abfd, sec, link_info, again)
bfd *abfd;
asection *sec;
struct bfd_link_info *link_info;
- boolean *again;
+ bfd_boolean *again;
{
struct one_fixup
{
@@ -700,17 +728,26 @@ elfNN_ia64_relax_section (abfd, sec, link_info, again)
Elf_Internal_Sym *isymbuf = NULL;
struct elfNN_ia64_link_hash_table *ia64_info;
struct one_fixup *fixups = NULL;
- boolean changed_contents = false;
- boolean changed_relocs = false;
+ bfd_boolean changed_contents = FALSE;
+ bfd_boolean changed_relocs = FALSE;
+ bfd_boolean changed_got = FALSE;
+ bfd_vma gp = 0;
/* Assume we're not going to change any sizes, and we'll only need
one pass. */
- *again = false;
+ *again = FALSE;
- /* Nothing to do if there are no relocations. */
+ /* Don't even try to relax for non-ELF outputs. */
+ if (!is_elf_hash_table (link_info->hash))
+ return FALSE;
+
+ /* Nothing to do if there are no relocations or there is no need for
+ the relax finalize pass. */
if ((sec->flags & SEC_RELOC) == 0
- || sec->reloc_count == 0)
- return true;
+ || sec->reloc_count == 0
+ || (!link_info->need_relax_finalize
+ && sec->need_finalize_relax == 0))
+ return TRUE;
/* If this is the first time we have been called for this section,
initialize the cooked size. */
@@ -720,27 +757,15 @@ elfNN_ia64_relax_section (abfd, sec, link_info, again)
symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
/* Load the relocations for this section. */
- internal_relocs = (_bfd_elfNN_link_read_relocs
+ 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;
+ return FALSE;
ia64_info = elfNN_ia64_hash_table (link_info);
irelend = internal_relocs + sec->reloc_count;
- for (irel = internal_relocs; irel < irelend; irel++)
- if (ELFNN_R_TYPE (irel->r_info) == (int) R_IA64_PCREL21B)
- break;
-
- /* No branch-type relocations. */
- if (irel == irelend)
- {
- if (elf_section_data (sec)->relocs != internal_relocs)
- free (internal_relocs);
- return true;
- }
-
/* Get the section contents. */
if (elf_section_data (sec)->this_hdr.contents != NULL)
contents = elf_section_data (sec)->this_hdr.contents;
@@ -755,15 +780,57 @@ elfNN_ia64_relax_section (abfd, sec, link_info, again)
goto error_return;
}
- for (; irel < irelend; irel++)
+ for (irel = internal_relocs; irel < irelend; irel++)
{
+ unsigned long r_type = ELFNN_R_TYPE (irel->r_info);
bfd_vma symaddr, reladdr, trampoff, toff, roff;
asection *tsec;
struct one_fixup *f;
bfd_size_type amt;
+ bfd_boolean is_branch;
+ struct elfNN_ia64_dyn_sym_info *dyn_i;
- if (ELFNN_R_TYPE (irel->r_info) != (int) R_IA64_PCREL21B)
- continue;
+ switch (r_type)
+ {
+ case R_IA64_PCREL21B:
+ case R_IA64_PCREL21BI:
+ case R_IA64_PCREL21M:
+ case R_IA64_PCREL21F:
+ /* In the finalize pass, all br relaxations are done. We can
+ skip it. */
+ if (!link_info->need_relax_finalize)
+ continue;
+ is_branch = TRUE;
+ break;
+
+ case R_IA64_PCREL60B:
+ /* We can't optimize brl to br before the finalize pass since
+ br relaxations will increase the code size. Defer it to
+ the finalize pass. */
+ if (link_info->need_relax_finalize)
+ {
+ sec->need_finalize_relax = 1;
+ continue;
+ }
+ is_branch = TRUE;
+ break;
+
+ case R_IA64_LTOFF22X:
+ case R_IA64_LDXMOV:
+ /* We can't relax ldx/mov before the finalize pass since
+ br relaxations will increase the code size. Defer it to
+ the finalize pass. */
+ if (link_info->need_relax_finalize)
+ {
+ sec->need_finalize_relax = 1;
+ continue;
+ }
+ is_branch = FALSE;
+ break;
+
+ default:
+ continue;
+ }
/* Get the value of the symbol referred to by the reloc. */
if (ELFNN_R_SYM (irel->r_info) < symtab_hdr->sh_info)
@@ -783,9 +850,9 @@ elfNN_ia64_relax_section (abfd, sec, link_info, again)
goto error_return;
}
- isym = isymbuf + ELF64_R_SYM (irel->r_info);
+ isym = isymbuf + ELFNN_R_SYM (irel->r_info);
if (isym->st_shndx == SHN_UNDEF)
- continue; /* We can't do anthing with undefined symbols. */
+ 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)
@@ -796,12 +863,12 @@ elfNN_ia64_relax_section (abfd, sec, link_info, again)
tsec = bfd_section_from_elf_index (abfd, isym->st_shndx);
toff = isym->st_value;
+ dyn_i = get_dyn_sym_info (ia64_info, NULL, abfd, irel, FALSE);
}
else
{
unsigned long indx;
struct elf_link_hash_entry *h;
- struct elfNN_ia64_dyn_sym_info *dyn_i;
indx = ELFNN_R_SYM (irel->r_info) - symtab_hdr->sh_info;
h = elf_sym_hashes (abfd)[indx];
@@ -811,18 +878,29 @@ elfNN_ia64_relax_section (abfd, sec, link_info, again)
|| h->root.type == bfd_link_hash_warning)
h = (struct elf_link_hash_entry *) h->root.u.i.link;
- dyn_i = get_dyn_sym_info (ia64_info, h, abfd, irel, false);
+ dyn_i = get_dyn_sym_info (ia64_info, h, abfd, irel, FALSE);
/* For branches to dynamic symbols, we're interested instead
in a branch to the PLT entry. */
- if (dyn_i && dyn_i->want_plt2)
+ if (is_branch && dyn_i && dyn_i->want_plt2)
{
+ /* Internal branches shouldn't be sent to the PLT.
+ Leave this for now and we'll give an error later. */
+ if (r_type != R_IA64_PCREL21B)
+ continue;
+
tsec = ia64_info->plt_sec;
toff = dyn_i->plt2_offset;
+ BFD_ASSERT (irel->r_addend == 0);
}
+
+ /* Can't do anything else with dynamic symbols. */
+ else if (elfNN_ia64_dynamic_symbol_p (h, link_info, r_type))
+ continue;
+
else
{
- /* We can't do anthing with undefined symbols. */
+ /* We can't do anything with undefined symbols. */
if (h->root.type == bfd_link_hash_undefined
|| h->root.type == bfd_link_hash_undefweak)
continue;
@@ -832,109 +910,193 @@ elfNN_ia64_relax_section (abfd, sec, link_info, again)
}
}
- symaddr = (tsec->output_section->vma
- + tsec->output_offset
- + 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 + irel->r_addend,
+ (bfd_vma) 0);
+ else
+ toff += irel->r_addend;
+
+ symaddr = tsec->output_section->vma + tsec->output_offset + toff;
roff = irel->r_offset;
- reladdr = (sec->output_section->vma
- + sec->output_offset
- + roff) & (bfd_vma) -4;
- /* If the branch is in range, no need to do anything. */
- if ((bfd_signed_vma) (symaddr - reladdr) >= -0x1000000
- && (bfd_signed_vma) (symaddr - reladdr) <= 0x0FFFFF0)
- continue;
+ if (is_branch)
+ {
+ bfd_signed_vma offset;
- /* If the branch and target are in the same section, you've
- got one honking big section and we can't help you. You'll
- get an error message later. */
- if (tsec == sec)
- continue;
+ reladdr = (sec->output_section->vma
+ + sec->output_offset
+ + roff) & (bfd_vma) -4;
- /* Look for an existing fixup to this address. */
- for (f = fixups; f ; f = f->next)
- if (f->tsec == tsec && f->toff == toff)
- break;
+ /* If the branch is in range, no need to do anything. */
+ if ((bfd_signed_vma) (symaddr - reladdr) >= -0x1000000
+ && (bfd_signed_vma) (symaddr - reladdr) <= 0x0FFFFF0)
+ {
+ /* If the 60-bit branch is in 21-bit range, optimize it. */
+ if (r_type == R_IA64_PCREL60B)
+ {
+ elfNN_ia64_relax_brl (abfd, contents, roff);
- if (f == NULL)
- {
- /* Two alternatives: If it's a branch to a PLT entry, we can
- make a copy of the FULL_PLT entry. Otherwise, we'll have
- to use a `brl' insn to get where we're going. */
+ irel->r_info
+ = ELF64_R_INFO (ELF64_R_SYM (irel->r_info),
+ R_IA64_PCREL21B);
- size_t size;
+ /* If the original relocation offset points to slot
+ 1, change it to slot 2. */
+ if ((irel->r_offset & 3) == 1)
+ irel->r_offset += 1;
+ }
- if (tsec == ia64_info->plt_sec)
- size = sizeof (plt_full_entry);
- else
- {
-#ifdef USE_BRL
- size = sizeof (oor_brl);
-#else
- size = sizeof (oor_ip);
-#endif
+ continue;
}
+ else if (r_type == R_IA64_PCREL60B)
+ continue;
- /* Resize the current section to make room for the new branch. */
- trampoff = (sec->_cooked_size + 15) & (bfd_vma) -16;
- amt = trampoff + size;
- contents = (bfd_byte *) bfd_realloc (contents, amt);
- if (contents == NULL)
- goto error_return;
- sec->_cooked_size = amt;
+ /* If the branch and target are in the same section, you've
+ got one honking big section and we can't help you. You'll
+ get an error message later. */
+ if (tsec == sec)
+ continue;
+
+ /* Look for an existing fixup to this address. */
+ for (f = fixups; f ; f = f->next)
+ if (f->tsec == tsec && f->toff == toff)
+ break;
- if (tsec == ia64_info->plt_sec)
+ if (f == NULL)
{
- memcpy (contents + trampoff, plt_full_entry, size);
+ /* Two alternatives: If it's a branch to a PLT entry, we can
+ make a copy of the FULL_PLT entry. Otherwise, we'll have
+ to use a `brl' insn to get where we're going. */
- /* Hijack the old relocation for use as the PLTOFF reloc. */
- irel->r_info = ELFNN_R_INFO (ELFNN_R_SYM (irel->r_info),
- R_IA64_PLTOFF22);
- irel->r_offset = trampoff;
+ size_t size;
+
+ if (tsec == ia64_info->plt_sec)
+ size = sizeof (plt_full_entry);
+ else
+ size = oor_branch_size;
+
+ /* Resize the current section to make room for the new branch. */
+ trampoff = (sec->_cooked_size + 15) & (bfd_vma) -16;
+
+ /* If trampoline is out of range, there is nothing we
+ can do. */
+ offset = trampoff - (roff & (bfd_vma) -4);
+ if (offset < -0x1000000 || offset > 0x0FFFFF0)
+ continue;
+
+ amt = trampoff + size;
+ contents = (bfd_byte *) bfd_realloc (contents, amt);
+ if (contents == NULL)
+ goto error_return;
+ sec->_cooked_size = amt;
+
+ if (tsec == ia64_info->plt_sec)
+ {
+ memcpy (contents + trampoff, plt_full_entry, size);
+
+ /* Hijack the old relocation for use as the PLTOFF reloc. */
+ irel->r_info = ELFNN_R_INFO (ELFNN_R_SYM (irel->r_info),
+ R_IA64_PLTOFF22);
+ irel->r_offset = trampoff;
+ }
+ else
+ {
+ if (size == sizeof (oor_ip))
+ {
+ memcpy (contents + trampoff, oor_ip, size);
+ irel->r_info = ELFNN_R_INFO (ELFNN_R_SYM (irel->r_info),
+ R_IA64_PCREL64I);
+ irel->r_addend -= 16;
+ irel->r_offset = trampoff + 2;
+ }
+ else
+ {
+ memcpy (contents + trampoff, oor_brl, size);
+ irel->r_info = ELFNN_R_INFO (ELFNN_R_SYM (irel->r_info),
+ R_IA64_PCREL60B);
+ irel->r_offset = trampoff + 2;
+ }
+
+ }
+
+ /* Record the fixup so we don't do it again this section. */
+ f = (struct one_fixup *)
+ bfd_malloc ((bfd_size_type) sizeof (*f));
+ f->next = fixups;
+ f->tsec = tsec;
+ f->toff = toff;
+ f->trampoff = trampoff;
+ fixups = f;
}
else
{
-#ifdef USE_BRL
- memcpy (contents + trampoff, oor_brl, size);
- irel->r_info = ELFNN_R_INFO (ELFNN_R_SYM (irel->r_info),
- R_IA64_PCREL60B);
- irel->r_offset = trampoff + 2;
-#else
- memcpy (contents + trampoff, oor_ip, size);
- irel->r_info = ELFNN_R_INFO (ELFNN_R_SYM (irel->r_info),
- R_IA64_PCREL64I);
- irel->r_addend -= 16;
- irel->r_offset = trampoff + 2;
-#endif
+ /* If trampoline is out of range, there is nothing we
+ can do. */
+ offset = f->trampoff - (roff & (bfd_vma) -4);
+ if (offset < -0x1000000 || offset > 0x0FFFFF0)
+ continue;
+
+ /* Nop out the reloc, since we're finalizing things here. */
+ irel->r_info = ELFNN_R_INFO (0, R_IA64_NONE);
}
- /* Record the fixup so we don't do it again this section. */
- f = (struct one_fixup *) bfd_malloc ((bfd_size_type) sizeof (*f));
- f->next = fixups;
- f->tsec = tsec;
- f->toff = toff;
- f->trampoff = trampoff;
- fixups = f;
+ /* Fix up the existing branch to hit the trampoline. */
+ if (elfNN_ia64_install_value (abfd, contents + roff, offset,
+ r_type) != bfd_reloc_ok)
+ goto error_return;
+
+ changed_contents = TRUE;
+ changed_relocs = TRUE;
}
else
{
- /* Nop out the reloc, since we're finalizing things here. */
- irel->r_info = ELFNN_R_INFO (0, R_IA64_NONE);
- }
+ /* Fetch the gp. */
+ if (gp == 0)
+ {
+ bfd *obfd = sec->output_section->owner;
+ gp = _bfd_get_gp_value (obfd);
+ if (gp == 0)
+ {
+ if (!elfNN_ia64_choose_gp (obfd, link_info))
+ goto error_return;
+ gp = _bfd_get_gp_value (obfd);
+ }
+ }
- /* Fix up the existing branch to hit the trampoline. Hope like
- hell this doesn't overflow too. */
- if (elfNN_ia64_install_value (abfd, contents + roff,
- f->trampoff - (roff & (bfd_vma) -4),
- R_IA64_PCREL21B) != bfd_reloc_ok)
- goto error_return;
+ /* If the data is out of range, do nothing. */
+ if ((bfd_signed_vma) (symaddr - gp) >= 0x200000
+ ||(bfd_signed_vma) (symaddr - gp) < -0x200000)
+ continue;
- changed_contents = true;
- changed_relocs = true;
+ if (r_type == R_IA64_LTOFF22X)
+ {
+ irel->r_info = ELFNN_R_INFO (ELFNN_R_SYM (irel->r_info),
+ R_IA64_GPREL22);
+ changed_relocs = TRUE;
+ if (dyn_i->want_gotx)
+ {
+ dyn_i->want_gotx = 0;
+ changed_got |= !dyn_i->want_got;
+ }
+ }
+ else
+ {
+ elfNN_ia64_relax_ldxmov (abfd, contents, roff);
+ irel->r_info = ELFNN_R_INFO (0, R_IA64_NONE);
+ changed_contents = TRUE;
+ changed_relocs = TRUE;
+ }
+ }
}
+ /* ??? If we created fixups, this may push the code segment large
+ enough that the data segment moves, which will change the GP.
+ Reset the GP so that we re-calculate next round. We need to
+ do this at the _beginning_ of the next round; now will not do. */
+
/* Clean up and go home. */
while (fixups)
{
@@ -975,8 +1137,27 @@ elfNN_ia64_relax_section (abfd, sec, link_info, again)
elf_section_data (sec)->relocs = internal_relocs;
}
+ if (changed_got)
+ {
+ struct elfNN_ia64_allocate_data data;
+ data.info = link_info;
+ data.ofs = 0;
+ ia64_info->self_dtpmod_offset = (bfd_vma) -1;
+
+ elfNN_ia64_dyn_sym_traverse (ia64_info, allocate_global_data_got, &data);
+ elfNN_ia64_dyn_sym_traverse (ia64_info, allocate_global_fptr_got, &data);
+ elfNN_ia64_dyn_sym_traverse (ia64_info, allocate_local_got, &data);
+ ia64_info->got_sec->_raw_size = data.ofs;
+ ia64_info->got_sec->_cooked_size = data.ofs;
+
+ /* ??? Resize .rela.got too. */
+ }
+
+ if (!link_info->need_relax_finalize)
+ sec->need_finalize_relax = 0;
+
*again = changed_contents || changed_relocs;
- return true;
+ return TRUE;
error_return:
if (isymbuf != NULL && (unsigned char *) isymbuf != symtab_hdr->contents)
@@ -987,12 +1168,45 @@ elfNN_ia64_relax_section (abfd, sec, link_info, again)
if (internal_relocs != NULL
&& elf_section_data (sec)->relocs != internal_relocs)
free (internal_relocs);
- return false;
+ return FALSE;
+}
+
+static void
+elfNN_ia64_relax_ldxmov (abfd, contents, off)
+ bfd *abfd;
+ bfd_byte *contents;
+ bfd_vma off;
+{
+ int shift, r1, r3;
+ bfd_vma dword, insn;
+
+ switch ((int)off & 0x3)
+ {
+ case 0: shift = 5; break;
+ case 1: shift = 14; off += 3; break;
+ case 2: shift = 23; off += 6; break;
+ default:
+ abort ();
+ }
+
+ dword = bfd_get_64 (abfd, contents + off);
+ insn = (dword >> shift) & 0x1ffffffffffLL;
+
+ r1 = (insn >> 6) & 127;
+ r3 = (insn >> 20) & 127;
+ if (r1 == r3)
+ insn = 0x8000000; /* nop */
+ else
+ insn = (insn & 0x7f01fff) | 0x10800000000LL; /* (qp) mov r1 = r3 */
+
+ dword &= ~(0x1ffffffffffLL << shift);
+ dword |= (insn << shift);
+ bfd_put_64 (abfd, dword, contents + off);
}
-/* Return true if NAME is an unwind table section name. */
+/* Return TRUE if NAME is an unwind table section name. */
-static inline boolean
+static inline bfd_boolean
is_unwind_section_name (abfd, name)
bfd *abfd;
const char *name;
@@ -1001,7 +1215,7 @@ is_unwind_section_name (abfd, name)
if (elfNN_ia64_hpux_vec (abfd->xvec)
&& !strcmp (name, ELF_STRING_ia64_unwind_hdr))
- return false;
+ return FALSE;
len1 = sizeof (ELF_STRING_ia64_unwind) - 1;
len2 = sizeof (ELF_STRING_ia64_unwind_info) - 1;
@@ -1014,10 +1228,10 @@ is_unwind_section_name (abfd, name)
/* Handle an IA-64 specific section when reading an object file. This
is called when elfcode.h finds a section with an unknown type. */
-static boolean
+static bfd_boolean
elfNN_ia64_section_from_shdr (abfd, hdr, name)
bfd *abfd;
- ElfNN_Internal_Shdr *hdr;
+ Elf_Internal_Shdr *hdr;
const char *name;
{
asection *newsect;
@@ -1035,18 +1249,18 @@ elfNN_ia64_section_from_shdr (abfd, hdr, name)
case SHT_IA_64_EXT:
if (strcmp (name, ELF_STRING_ia64_archext) != 0)
- return false;
+ return FALSE;
break;
default:
- return false;
+ return FALSE;
}
if (! _bfd_elf_make_section_from_shdr (abfd, hdr, name))
- return false;
+ return FALSE;
newsect = hdr->bfd_section;
- return true;
+ return TRUE;
}
/* Convert IA-64 specific section flags to bfd internal section flags. */
@@ -1054,24 +1268,24 @@ elfNN_ia64_section_from_shdr (abfd, hdr, name)
/* ??? There is no bfd internal flag equivalent to the SHF_IA_64_NORECOV
flag. */
-static boolean
+static bfd_boolean
elfNN_ia64_section_flags (flags, hdr)
flagword *flags;
- ElfNN_Internal_Shdr *hdr;
+ Elf_Internal_Shdr *hdr;
{
if (hdr->sh_flags & SHF_IA_64_SHORT)
*flags |= SEC_SMALL_DATA;
- return true;
+ return TRUE;
}
/* Set the correct type for an IA-64 ELF section. We do this by the
section name, which is a hack, but ought to work. */
-static boolean
+static bfd_boolean
elfNN_ia64_fake_sections (abfd, hdr, sec)
bfd *abfd ATTRIBUTE_UNUSED;
- ElfNN_Internal_Shdr *hdr;
+ Elf_Internal_Shdr *hdr;
asection *sec;
{
register const char *name;
@@ -1090,30 +1304,28 @@ elfNN_ia64_fake_sections (abfd, hdr, sec)
else if (strcmp (name, ".HP.opt_annot") == 0)
hdr->sh_type = SHT_IA_64_HP_OPT_ANOT;
else if (strcmp (name, ".reloc") == 0)
- /*
- * This is an ugly, but unfortunately necessary hack that is
- * needed when producing EFI binaries on IA-64. It tells
- * elf.c:elf_fake_sections() not to consider ".reloc" as a section
- * containing ELF relocation info. We need this hack in order to
- * be able to generate ELF binaries that can be translated into
- * EFI applications (which are essentially COFF objects). Those
- * files contain a COFF ".reloc" section inside an ELFNN object,
- * which would normally cause BFD to segfault because it would
- * attempt to interpret this section as containing relocation
- * entries for section "oc". With this hack enabled, ".reloc"
- * will be treated as a normal data section, which will avoid the
- * segfault. However, you won't be able to create an ELFNN binary
- * with a section named "oc" that needs relocations, but that's
- * the kind of ugly side-effects you get when detecting section
- * types based on their names... In practice, this limitation is
- * unlikely to bite.
- */
+ /* This is an ugly, but unfortunately necessary hack that is
+ needed when producing EFI binaries on IA-64. It tells
+ elf.c:elf_fake_sections() not to consider ".reloc" as a section
+ containing ELF relocation info. We need this hack in order to
+ be able to generate ELF binaries that can be translated into
+ EFI applications (which are essentially COFF objects). Those
+ files contain a COFF ".reloc" section inside an ELFNN object,
+ which would normally cause BFD to segfault because it would
+ attempt to interpret this section as containing relocation
+ entries for section "oc". With this hack enabled, ".reloc"
+ will be treated as a normal data section, which will avoid the
+ segfault. However, you won't be able to create an ELFNN binary
+ with a section named "oc" that needs relocations, but that's
+ the kind of ugly side-effects you get when detecting section
+ types based on their names... In practice, this limitation is
+ unlikely to bite. */
hdr->sh_type = SHT_PROGBITS;
if (sec->flags & SEC_SMALL_DATA)
hdr->sh_flags |= SHF_IA_64_SHORT;
- return true;
+ return TRUE;
}
/* The final processing done just before writing out an IA-64 ELF
@@ -1122,7 +1334,7 @@ elfNN_ia64_fake_sections (abfd, hdr, sec)
static void
elfNN_ia64_final_write_processing (abfd, linker)
bfd *abfd;
- boolean linker ATTRIBUTE_UNUSED;
+ bfd_boolean linker ATTRIBUTE_UNUSED;
{
Elf_Internal_Shdr *hdr;
const char *sname;
@@ -1196,23 +1408,36 @@ elfNN_ia64_final_write_processing (abfd, linker)
break;
}
}
+
+ if (! elf_flags_init (abfd))
+ {
+ unsigned long flags = 0;
+
+ if (abfd->xvec->byteorder == BFD_ENDIAN_BIG)
+ flags |= EF_IA_64_BE;
+ if (bfd_get_mach (abfd) == bfd_mach_ia64_elf64)
+ flags |= EF_IA_64_ABI64;
+
+ elf_elfheader(abfd)->e_flags = flags;
+ elf_flags_init (abfd) = TRUE;
+ }
}
/* Hook called by the linker routine which adds symbols from an object
file. We use it to put .comm items in .sbss, and not .bss. */
-static boolean
+static bfd_boolean
elfNN_ia64_add_symbol_hook (abfd, info, sym, namep, flagsp, secp, valp)
bfd *abfd;
struct bfd_link_info *info;
- const Elf_Internal_Sym *sym;
+ 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->relocateable
+ && !info->relocatable
&& sym->st_size <= elf_gp_size (abfd))
{
/* Common symbols less than or equal to -G nn bytes are
@@ -1227,122 +1452,14 @@ elfNN_ia64_add_symbol_hook (abfd, info, sym, namep, flagsp, secp, valp)
|| !bfd_set_section_flags (abfd, scomm, (SEC_ALLOC
| SEC_IS_COMMON
| SEC_LINKER_CREATED)))
- return false;
+ return FALSE;
}
*secp = scomm;
*valp = sym->st_size;
}
- return true;
-}
-
-static boolean
-elfNN_ia64_aix_vec (const bfd_target *vec)
-{
- extern const bfd_target bfd_elfNN_ia64_aix_little_vec;
- extern const bfd_target bfd_elfNN_ia64_aix_big_vec;
-
- return (/**/vec == & bfd_elfNN_ia64_aix_little_vec
- || vec == & bfd_elfNN_ia64_aix_big_vec);
-}
-
-/* Hook called by the linker routine which adds symbols from an object
- file. We use it to handle OS-specific symbols. */
-
-static boolean
-elfNN_ia64_aix_add_symbol_hook (abfd, info, sym, namep, flagsp, secp, valp)
- bfd *abfd;
- struct bfd_link_info *info;
- const Elf_Internal_Sym *sym;
- const char **namep;
- flagword *flagsp;
- asection **secp;
- bfd_vma *valp;
-{
- if (strcmp (*namep, "__GLOB_DATA_PTR") == 0)
- {
- /* Define __GLOB_DATA_PTR when it is encountered. This is expected to
- be a linker-defined symbol by the Aix C runtime startup code. IBM sez
- no one else should use it b/c it is undocumented. */
- struct elf_link_hash_entry *h;
-
- h = elf_link_hash_lookup (elf_hash_table (info), *namep,
- false, false, false);
- if (h == NULL)
- {
- struct elf_backend_data *bed;
- struct elfNN_ia64_link_hash_table *ia64_info;
- struct bfd_link_hash_entry *bh = NULL;
-
- bed = get_elf_backend_data (abfd);
- ia64_info = elfNN_ia64_hash_table (info);
-
- if (!(_bfd_generic_link_add_one_symbol
- (info, abfd, *namep, BSF_GLOBAL,
- bfd_get_section_by_name (abfd, ".bss"),
- bed->got_symbol_offset, (const char *) 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 (! _bfd_elf_link_record_dynamic_symbol (info, h))
- return false;
- }
-
- return true;
- }
- else if (sym->st_shndx == SHN_LOOS)
- {
- unsigned int i;
-
- /* SHN_AIX_SYSCALL: Treat this as any other symbol. The special symbol
- is only relevant when compiling code for extended system calls.
- Replace the "special" section with .text, if possible.
- Note that these symbols are always assumed to be in .text. */
- for (i = 1; i < elf_numsections (abfd); i++)
- {
- asection * sec = bfd_section_from_elf_index (abfd, i);
-
- if (sec && strcmp (sec->name, ".text") == 0)
- {
- *secp = sec;
- break;
- }
- }
-
- if (*secp == NULL)
- *secp = bfd_abs_section_ptr;
-
- *valp = sym->st_size;
-
- return true;
- }
- else
- {
- return elfNN_ia64_add_symbol_hook (abfd, info, sym,
- namep, flagsp, secp, valp);
- }
-}
-
-boolean
-elfNN_ia64_aix_link_add_symbols (abfd, info)
- bfd *abfd;
- struct bfd_link_info *info;
-{
- /* Make sure dynamic sections are always created. */
- if (! elf_hash_table (info)->dynamic_sections_created
- && abfd->xvec == info->hash->creator)
- {
- if (! bfd_elfNN_link_create_dynamic_sections (abfd, info))
- return false;
- }
-
- /* Now do the standard call. */
- return bfd_elfNN_bfd_link_add_symbols (abfd, info);
+ return TRUE;
}
/* Return the number of additional phdrs we will need. */
@@ -1367,9 +1484,10 @@ elfNN_ia64_additional_program_headers (abfd)
return ret;
}
-static boolean
-elfNN_ia64_modify_segment_map (abfd)
+static bfd_boolean
+elfNN_ia64_modify_segment_map (abfd, info)
bfd *abfd;
+ struct bfd_link_info *info ATTRIBUTE_UNUSED;
{
struct elf_segment_map *m, **pm;
Elf_Internal_Shdr *hdr;
@@ -1388,7 +1506,7 @@ elfNN_ia64_modify_segment_map (abfd)
m = ((struct elf_segment_map *)
bfd_zalloc (abfd, (bfd_size_type) sizeof *m));
if (m == NULL)
- return false;
+ return FALSE;
m->p_type = PT_IA_64_ARCHEXT;
m->count = 1;
@@ -1436,7 +1554,7 @@ elfNN_ia64_modify_segment_map (abfd)
m = ((struct elf_segment_map *)
bfd_zalloc (abfd, (bfd_size_type) sizeof *m));
if (m == NULL)
- return false;
+ return FALSE;
m->p_type = PT_IA_64_UNWIND;
m->count = 1;
@@ -1480,13 +1598,13 @@ elfNN_ia64_modify_segment_map (abfd)
found:;
}
- return true;
+ return TRUE;
}
/* According to the Tahoe assembler spec, all labels starting with a
'.' are local. */
-static boolean
+static bfd_boolean
elfNN_ia64_is_local_label_name (abfd, name)
bfd *abfd ATTRIBUTE_UNUSED;
const char *name;
@@ -1496,78 +1614,19 @@ elfNN_ia64_is_local_label_name (abfd, name)
/* Should we do dynamic things to this symbol? */
-static boolean
-elfNN_ia64_dynamic_symbol_p (h, info)
+static bfd_boolean
+elfNN_ia64_dynamic_symbol_p (h, info, r_type)
struct elf_link_hash_entry *h;
struct bfd_link_info *info;
+ int r_type;
{
- if (h == NULL)
- return false;
-
- while (h->root.type == bfd_link_hash_indirect
- || h->root.type == bfd_link_hash_warning)
- h = (struct elf_link_hash_entry *) h->root.u.i.link;
-
- if (h->dynindx == -1)
- return false;
- switch (ELF_ST_VISIBILITY (h->other))
- {
- case STV_INTERNAL:
- case STV_HIDDEN:
- return false;
- }
+ bfd_boolean ignore_protected
+ = ((r_type & 0xf8) == 0x40 /* FPTR relocs */
+ || (r_type & 0xf8) == 0x50); /* LTOFF_FPTR relocs */
- if (h->root.type == bfd_link_hash_undefweak
- || h->root.type == bfd_link_hash_defweak)
- return true;
-
- if ((info->shared && (!info->symbolic || info->allow_shlib_undefined))
- || ((h->elf_link_hash_flags
- & (ELF_LINK_HASH_DEF_DYNAMIC | ELF_LINK_HASH_REF_REGULAR))
- == (ELF_LINK_HASH_DEF_DYNAMIC | ELF_LINK_HASH_REF_REGULAR)))
- return true;
-
- return false;
+ return _bfd_elf_dynamic_symbol_p (h, info, ignore_protected);
}
-static boolean
-elfNN_ia64_local_hash_table_init (ht, abfd, new)
- struct elfNN_ia64_local_hash_table *ht;
- bfd *abfd ATTRIBUTE_UNUSED;
- new_hash_entry_func new;
-{
- memset (ht, 0, sizeof (*ht));
- return bfd_hash_table_init (&ht->root, new);
-}
-
-static struct bfd_hash_entry*
-elfNN_ia64_new_loc_hash_entry (entry, table, string)
- struct bfd_hash_entry *entry;
- struct bfd_hash_table *table;
- const char *string;
-{
- struct elfNN_ia64_local_hash_entry *ret;
- ret = (struct elfNN_ia64_local_hash_entry *) entry;
-
- /* Allocate the structure if it has not already been allocated by a
- subclass. */
- if (!ret)
- ret = bfd_hash_allocate (table, sizeof (*ret));
-
- if (!ret)
- return 0;
-
- /* Initialize our local data. All zeros, and definitely easier
- than setting a handful of bit fields. */
- memset (ret, 0, sizeof (*ret));
-
- /* Call the allocation method of the superclass. */
- ret = ((struct elfNN_ia64_local_hash_entry *)
- bfd_hash_newfunc ((struct bfd_hash_entry *) ret, table, string));
-
- return (struct bfd_hash_entry *) ret;
-}
-
static struct bfd_hash_entry*
elfNN_ia64_new_elf_hash_entry (entry, table, string)
struct bfd_hash_entry *entry;
@@ -1599,7 +1658,7 @@ elfNN_ia64_new_elf_hash_entry (entry, table, string)
static void
elfNN_ia64_hash_copy_indirect (bed, xdir, xind)
- struct elf_backend_data *bed ATTRIBUTE_UNUSED;
+ const struct elf_backend_data *bed ATTRIBUTE_UNUSED;
struct elf_link_hash_entry *xdir, *xind;
{
struct elfNN_ia64_link_hash_entry *dir, *ind;
@@ -1614,7 +1673,8 @@ elfNN_ia64_hash_copy_indirect (bed, xdir, xind)
(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_REF_REGULAR_NONWEAK
+ | ELF_LINK_HASH_NEEDS_PLT));
if (ind->root.root.type != bfd_link_hash_indirect)
return;
@@ -1651,7 +1711,7 @@ static void
elfNN_ia64_hash_hide_symbol (info, xh, force_local)
struct bfd_link_info *info;
struct elf_link_hash_entry *xh;
- boolean force_local;
+ bfd_boolean force_local;
{
struct elfNN_ia64_link_hash_entry *h;
struct elfNN_ia64_dyn_sym_info *dyn_i;
@@ -1661,7 +1721,37 @@ elfNN_ia64_hash_hide_symbol (info, xh, force_local)
_bfd_elf_link_hash_hide_symbol (info, &h->root, force_local);
for (dyn_i = h->info; dyn_i; dyn_i = dyn_i->next)
- dyn_i->want_plt2 = 0;
+ {
+ dyn_i->want_plt2 = 0;
+ dyn_i->want_plt = 0;
+ }
+}
+
+/* Compute a hash of a local hash entry. */
+
+static hashval_t
+elfNN_ia64_local_htab_hash (ptr)
+ const void *ptr;
+{
+ struct elfNN_ia64_local_hash_entry *entry
+ = (struct elfNN_ia64_local_hash_entry *) ptr;
+
+ return (((entry->id & 0xff) << 24) | ((entry->id & 0xff00) << 8))
+ ^ entry->r_sym ^ (entry->id >> 16);
+}
+
+/* Compare local hash entries. */
+
+static int
+elfNN_ia64_local_htab_eq (ptr1, ptr2)
+ const void *ptr1, *ptr2;
+{
+ struct elfNN_ia64_local_hash_entry *entry1
+ = (struct elfNN_ia64_local_hash_entry *) ptr1;
+ struct elfNN_ia64_local_hash_entry *entry2
+ = (struct elfNN_ia64_local_hash_entry *) ptr2;
+
+ return entry1->id == entry2->id && entry1->r_sym == entry2->r_sym;
}
/* Create the derived linker hash table. The IA-64 ELF port uses this
@@ -1674,43 +1764,53 @@ elfNN_ia64_hash_table_create (abfd)
{
struct elfNN_ia64_link_hash_table *ret;
- ret = bfd_zalloc (abfd, (bfd_size_type) sizeof (*ret));
+ ret = bfd_zmalloc ((bfd_size_type) sizeof (*ret));
if (!ret)
return 0;
+
if (!_bfd_elf_link_hash_table_init (&ret->root, abfd,
elfNN_ia64_new_elf_hash_entry))
{
- bfd_release (abfd, ret);
+ free (ret);
+ return 0;
+ }
+
+ ret->loc_hash_table = htab_try_create (1024, elfNN_ia64_local_htab_hash,
+ elfNN_ia64_local_htab_eq, NULL);
+ ret->loc_hash_memory = objalloc_create ();
+ if (!ret->loc_hash_table || !ret->loc_hash_memory)
+ {
+ free (ret);
return 0;
}
- if (!elfNN_ia64_local_hash_table_init (&ret->loc_hash_table, abfd,
- elfNN_ia64_new_loc_hash_entry))
- return 0;
return &ret->root.root;
}
-/* Look up an entry in a Alpha ELF linker hash table. */
+/* Destroy IA-64 linker hash table. */
-static INLINE struct elfNN_ia64_local_hash_entry *
-elfNN_ia64_local_hash_lookup(table, string, create, copy)
- struct elfNN_ia64_local_hash_table *table;
- const char *string;
- boolean create, copy;
+static void
+elfNN_ia64_hash_table_free (hash)
+ struct bfd_link_hash_table *hash;
{
- return ((struct elfNN_ia64_local_hash_entry *)
- bfd_hash_lookup (&table->root, string, create, copy));
+ struct elfNN_ia64_link_hash_table *ia64_info
+ = (struct elfNN_ia64_link_hash_table *) hash;
+ if (ia64_info->loc_hash_table)
+ htab_delete (ia64_info->loc_hash_table);
+ if (ia64_info->loc_hash_memory)
+ objalloc_free ((struct objalloc *) ia64_info->loc_hash_memory);
+ _bfd_generic_link_hash_table_free (hash);
}
/* Traverse both local and global hash tables. */
struct elfNN_ia64_dyn_sym_traverse_data
{
- boolean (*func) PARAMS ((struct elfNN_ia64_dyn_sym_info *, PTR));
+ bfd_boolean (*func) PARAMS ((struct elfNN_ia64_dyn_sym_info *, PTR));
PTR data;
};
-static boolean
+static bfd_boolean
elfNN_ia64_global_dyn_sym_thunk (xentry, xdata)
struct bfd_hash_entry *xentry;
PTR xdata;
@@ -1726,31 +1826,31 @@ elfNN_ia64_global_dyn_sym_thunk (xentry, xdata)
for (dyn_i = entry->info; dyn_i; dyn_i = dyn_i->next)
if (! (*data->func) (dyn_i, data->data))
- return false;
- return true;
+ return FALSE;
+ return TRUE;
}
-static boolean
-elfNN_ia64_local_dyn_sym_thunk (xentry, xdata)
- struct bfd_hash_entry *xentry;
+static bfd_boolean
+elfNN_ia64_local_dyn_sym_thunk (slot, xdata)
+ void **slot;
PTR xdata;
{
struct elfNN_ia64_local_hash_entry *entry
- = (struct elfNN_ia64_local_hash_entry *) xentry;
+ = (struct elfNN_ia64_local_hash_entry *) *slot;
struct elfNN_ia64_dyn_sym_traverse_data *data
= (struct elfNN_ia64_dyn_sym_traverse_data *) xdata;
struct elfNN_ia64_dyn_sym_info *dyn_i;
for (dyn_i = entry->info; dyn_i; dyn_i = dyn_i->next)
if (! (*data->func) (dyn_i, data->data))
- return false;
- return true;
+ return 0;
+ return 1;
}
static void
elfNN_ia64_dyn_sym_traverse (ia64_info, func, data)
struct elfNN_ia64_link_hash_table *ia64_info;
- boolean (*func) PARAMS ((struct elfNN_ia64_dyn_sym_info *, PTR));
+ bfd_boolean (*func) PARAMS ((struct elfNN_ia64_dyn_sym_info *, PTR));
PTR data;
{
struct elfNN_ia64_dyn_sym_traverse_data xdata;
@@ -1760,11 +1860,11 @@ elfNN_ia64_dyn_sym_traverse (ia64_info, func, data)
elf_link_hash_traverse (&ia64_info->root,
elfNN_ia64_global_dyn_sym_thunk, &xdata);
- bfd_hash_traverse (&ia64_info->loc_hash_table.root,
- elfNN_ia64_local_dyn_sym_thunk, &xdata);
+ htab_traverse (ia64_info->loc_hash_table,
+ elfNN_ia64_local_dyn_sym_thunk, &xdata);
}
-static boolean
+static bfd_boolean
elfNN_ia64_create_dynamic_sections (abfd, info)
bfd *abfd;
struct bfd_link_info *info;
@@ -1773,7 +1873,7 @@ elfNN_ia64_create_dynamic_sections (abfd, info)
asection *s;
if (! _bfd_elf_create_dynamic_sections (abfd, info))
- return false;
+ return FALSE;
ia64_info = elfNN_ia64_hash_table (info);
@@ -1783,10 +1883,12 @@ elfNN_ia64_create_dynamic_sections (abfd, info)
{
flagword flags = bfd_get_section_flags (abfd, ia64_info->got_sec);
bfd_set_section_flags (abfd, ia64_info->got_sec, SEC_SMALL_DATA | flags);
+ /* The .got section is always aligned at 8 bytes. */
+ bfd_set_section_alignment (abfd, ia64_info->got_sec, 3);
}
if (!get_pltoff (abfd, info, ia64_info))
- return false;
+ return FALSE;
s = bfd_make_section(abfd, ".rela.IA_64.pltoff");
if (s == NULL
@@ -1796,7 +1898,7 @@ elfNN_ia64_create_dynamic_sections (abfd, info)
| SEC_LINKER_CREATED
| SEC_READONLY))
|| !bfd_set_section_alignment (abfd, s, 3))
- return false;
+ return FALSE;
ia64_info->rel_pltoff_sec = s;
s = bfd_make_section(abfd, ".rela.got");
@@ -1807,10 +1909,10 @@ elfNN_ia64_create_dynamic_sections (abfd, info)
| SEC_LINKER_CREATED
| SEC_READONLY))
|| !bfd_set_section_alignment (abfd, s, 3))
- return false;
+ return FALSE;
ia64_info->rel_got_sec = s;
- return true;
+ return TRUE;
}
/* Find and/or create a hash entry for local symbol. */
@@ -1819,28 +1921,35 @@ get_local_sym_hash (ia64_info, abfd, rel, create)
struct elfNN_ia64_link_hash_table *ia64_info;
bfd *abfd;
const Elf_Internal_Rela *rel;
- boolean create;
+ bfd_boolean create;
{
- char *addr_name;
- size_t len;
- struct elfNN_ia64_local_hash_entry *ret;
-
- /* Construct a string for use in the elfNN_ia64_local_hash_table.
- name describes what was once anonymous memory. */
-
- len = sizeof (void*)*2 + 1 + sizeof (bfd_vma)*4 + 1 + 1;
- len += 10; /* %p slop */
+ struct elfNN_ia64_local_hash_entry e, *ret;
+ asection *sec = abfd->sections;
+ hashval_t h = (((sec->id & 0xff) << 24) | ((sec->id & 0xff00) << 8))
+ ^ ELFNN_R_SYM (rel->r_info) ^ (sec->id >> 16);
+ void **slot;
+
+ e.id = sec->id;
+ e.r_sym = ELFNN_R_SYM (rel->r_info);
+ slot = htab_find_slot_with_hash (ia64_info->loc_hash_table, &e, h,
+ create ? INSERT : NO_INSERT);
+
+ if (!slot)
+ return NULL;
- addr_name = bfd_malloc (len);
- if (addr_name == NULL)
- return 0;
- sprintf (addr_name, "%p:%lx",
- (void *) abfd, (unsigned long) ELFNN_R_SYM (rel->r_info));
+ if (*slot)
+ return (struct elfNN_ia64_local_hash_entry *) *slot;
- /* Collect the canonical entry data for this address. */
- ret = elfNN_ia64_local_hash_lookup (&ia64_info->loc_hash_table,
- addr_name, create, create);
- free (addr_name);
+ ret = (struct elfNN_ia64_local_hash_entry *)
+ objalloc_alloc ((struct objalloc *) ia64_info->loc_hash_memory,
+ sizeof (struct elfNN_ia64_local_hash_entry));
+ if (ret)
+ {
+ memset (ret, 0, sizeof (*ret));
+ ret->id = sec->id;
+ ret->r_sym = ELFNN_R_SYM (rel->r_info);
+ *slot = ret;
+ }
return ret;
}
@@ -1853,7 +1962,7 @@ get_dyn_sym_info (ia64_info, h, abfd, rel, create)
struct elf_link_hash_entry *h;
bfd *abfd;
const Elf_Internal_Rela *rel;
- boolean create;
+ bfd_boolean create;
{
struct elfNN_ia64_dyn_sym_info **pp;
struct elfNN_ia64_dyn_sym_info *dyn_i;
@@ -1866,7 +1975,11 @@ get_dyn_sym_info (ia64_info, h, abfd, rel, create)
struct elfNN_ia64_local_hash_entry *loc_h;
loc_h = get_local_sym_hash (ia64_info, abfd, rel, create);
- BFD_ASSERT (loc_h);
+ if (!loc_h)
+ {
+ BFD_ASSERT (!create);
+ return NULL;
+ }
pp = &loc_h->info;
}
@@ -1909,6 +2022,10 @@ get_got (abfd, info, ia64_info)
BFD_ASSERT (got);
ia64_info->got_sec = got;
+ /* The .got section is always aligned at 8 bytes. */
+ if (!bfd_set_section_alignment (abfd, got, 3))
+ return 0;
+
flags = bfd_get_section_flags (abfd, got);
bfd_set_section_flags (abfd, got, SEC_SMALL_DATA | flags);
}
@@ -1917,14 +2034,14 @@ get_got (abfd, info, ia64_info)
}
/* Create function descriptor section (.opd). This section is called .opd
- because it contains "official prodecure descriptors". The "official"
+ because it contains "official procedure descriptors". The "official"
refers to the fact that these descriptors are used when taking the address
of a procedure, thus ensuring a unique address for each procedure. */
static asection *
get_fptr (abfd, info, ia64_info)
bfd *abfd;
- struct bfd_link_info *info ATTRIBUTE_UNUSED;
+ struct bfd_link_info *info;
struct elfNN_ia64_link_hash_table *ia64_info;
{
asection *fptr;
@@ -1944,7 +2061,7 @@ get_fptr (abfd, info, ia64_info)
| SEC_LOAD
| SEC_HAS_CONTENTS
| SEC_IN_MEMORY
- | SEC_READONLY
+ | (info->pie ? 0 : SEC_READONLY)
| SEC_LINKER_CREATED))
|| !bfd_set_section_alignment (abfd, fptr, 4))
{
@@ -1953,6 +2070,26 @@ get_fptr (abfd, info, ia64_info)
}
ia64_info->fptr_sec = fptr;
+
+ if (info->pie)
+ {
+ asection *fptr_rel;
+ fptr_rel = bfd_make_section(dynobj, ".rela.opd");
+ if (fptr_rel == NULL
+ || !bfd_set_section_flags (dynobj, fptr_rel,
+ (SEC_ALLOC | SEC_LOAD
+ | SEC_HAS_CONTENTS
+ | SEC_IN_MEMORY
+ | SEC_LINKER_CREATED
+ | SEC_READONLY))
+ || !bfd_set_section_alignment (abfd, fptr_rel, 3))
+ {
+ BFD_ASSERT (0);
+ return NULL;
+ }
+
+ ia64_info->rel_fptr_sec = fptr_rel;
+ }
}
return fptr;
@@ -2000,7 +2137,7 @@ get_reloc_section (abfd, ia64_info, sec, create)
bfd *abfd;
struct elfNN_ia64_link_hash_table *ia64_info;
asection *sec;
- boolean create;
+ bfd_boolean create;
{
const char *srel_name;
asection *srel;
@@ -2039,18 +2176,12 @@ get_reloc_section (abfd, ia64_info, sec, create)
return NULL;
}
- if (sec->flags & SEC_READONLY)
- ia64_info->reltext = 1;
-
return srel;
}
-static boolean
-count_dyn_reloc (abfd, dyn_i, srel, type)
- bfd *abfd;
- struct elfNN_ia64_dyn_sym_info *dyn_i;
- asection *srel;
- int type;
+static bfd_boolean
+count_dyn_reloc (bfd *abfd, struct elfNN_ia64_dyn_sym_info *dyn_i,
+ asection *srel, int type, bfd_boolean reltext)
{
struct elfNN_ia64_dyn_reloc_entry *rent;
@@ -2063,7 +2194,7 @@ count_dyn_reloc (abfd, dyn_i, srel, type)
rent = ((struct elfNN_ia64_dyn_reloc_entry *)
bfd_alloc (abfd, (bfd_size_type) sizeof (*rent)));
if (!rent)
- return false;
+ return FALSE;
rent->next = dyn_i->reloc_entries;
rent->srel = srel;
@@ -2071,12 +2202,13 @@ count_dyn_reloc (abfd, dyn_i, srel, type)
rent->count = 0;
dyn_i->reloc_entries = rent;
}
+ rent->reltext = reltext;
rent->count++;
- return true;
+ return TRUE;
}
-static boolean
+static bfd_boolean
elfNN_ia64_check_relocs (abfd, info, sec, relocs)
bfd *abfd;
struct bfd_link_info *info;
@@ -2089,8 +2221,8 @@ elfNN_ia64_check_relocs (abfd, info, sec, relocs)
const Elf_Internal_Rela *rel;
asection *got, *fptr, *srel;
- if (info->relocateable)
- return true;
+ if (info->relocatable)
+ return TRUE;
symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
ia64_info = elfNN_ia64_hash_table (info);
@@ -2102,22 +2234,23 @@ elfNN_ia64_check_relocs (abfd, info, sec, relocs)
{
enum {
NEED_GOT = 1,
- NEED_FPTR = 2,
- NEED_PLTOFF = 4,
- NEED_MIN_PLT = 8,
- NEED_FULL_PLT = 16,
- NEED_DYNREL = 32,
- NEED_LTOFF_FPTR = 64,
- NEED_TPREL = 128,
- NEED_DTPMOD = 256,
- NEED_DTPREL = 512
+ 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;
- boolean maybe_dynamic;
+ bfd_boolean maybe_dynamic;
int dynrel_type = R_IA64_NONE;
if (r_symndx >= symtab_hdr->sh_info)
@@ -2137,13 +2270,12 @@ elfNN_ia64_check_relocs (abfd, info, sec, relocs)
locally or externally defined, as not all of the input files
have yet been processed. Do something with what we know, as
this may help reduce memory usage and processing time later. */
- maybe_dynamic = false;
- if (h && ((info->shared
- && (!info->symbolic || info->allow_shlib_undefined))
+ 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
- || elfNN_ia64_aix_vec (abfd->xvec)))
- maybe_dynamic = true;
+ || h->root.type == bfd_link_hash_defweak))
+ maybe_dynamic = TRUE;
need_entry = 0;
switch (ELFNN_R_TYPE (rel->r_info))
@@ -2199,7 +2331,7 @@ elfNN_ia64_check_relocs (abfd, info, sec, relocs)
case R_IA64_FPTR32LSB:
case R_IA64_FPTR64MSB:
case R_IA64_FPTR64LSB:
- if (info->shared || h || elfNN_ia64_aix_vec (abfd->xvec))
+ if (info->shared || h)
need_entry = NEED_FPTR | NEED_DYNREL;
else
need_entry = NEED_FPTR;
@@ -2207,11 +2339,14 @@ elfNN_ia64_check_relocs (abfd, info, sec, relocs)
break;
case R_IA64_LTOFF22:
- case R_IA64_LTOFF22X:
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:
@@ -2248,10 +2383,7 @@ elfNN_ia64_check_relocs (abfd, info, sec, relocs)
case R_IA64_DIR64MSB:
case R_IA64_DIR64LSB:
/* Shared objects will always need at least a REL relocation. */
- if (info->shared || maybe_dynamic
- || (elfNN_ia64_aix_vec (abfd->xvec)
- && (!h || strcmp (h->root.root.string,
- "__GLOB_DATA_PTR") != 0)))
+ if (info->shared || maybe_dynamic)
need_entry = NEED_DYNREL;
dynrel_type = R_IA64_DIR64LSB;
break;
@@ -2287,22 +2419,25 @@ 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);
+ dyn_i = get_dyn_sym_info (ia64_info, h, abfd, rel, TRUE);
/* Record whether or not this is a local symbol. */
dyn_i->h = h;
/* Create what's needed. */
- if (need_entry & (NEED_GOT | NEED_TPREL | NEED_DTPMOD | NEED_DTPREL))
+ if (need_entry & (NEED_GOT | NEED_GOTX | NEED_TPREL
+ | NEED_DTPMOD | NEED_DTPREL))
{
if (!got)
{
got = get_got (abfd, info, ia64_info);
if (!got)
- return false;
+ return FALSE;
}
if (need_entry & NEED_GOT)
dyn_i->want_got = 1;
+ if (need_entry & NEED_GOTX)
+ dyn_i->want_gotx = 1;
if (need_entry & NEED_TPREL)
dyn_i->want_tprel = 1;
if (need_entry & NEED_DTPMOD)
@@ -2316,19 +2451,17 @@ elfNN_ia64_check_relocs (abfd, info, sec, relocs)
{
fptr = get_fptr (abfd, info, ia64_info);
if (!fptr)
- return false;
+ return FALSE;
}
/* FPTRs for shared libraries are allocated by the dynamic
linker. Make sure this local symbol will appear in the
dynamic symbol table. */
- if (!h && (info->shared
- /* AIX also needs one */
- || elfNN_ia64_aix_vec (abfd->xvec)))
+ if (!h && info->shared)
{
- if (! (_bfd_elfNN_link_record_local_dynamic_symbol
+ if (! (bfd_elf_link_record_local_dynamic_symbol
(info, abfd, (long) r_symndx)))
- return false;
+ return FALSE;
}
dyn_i->want_fptr = 1;
@@ -2350,40 +2483,32 @@ elfNN_ia64_check_relocs (abfd, info, sec, relocs)
{
if (!srel)
{
- srel = get_reloc_section (abfd, ia64_info, sec, true);
+ srel = get_reloc_section (abfd, ia64_info, sec, TRUE);
if (!srel)
- return false;
+ return FALSE;
}
- if (!count_dyn_reloc (abfd, dyn_i, srel, dynrel_type))
- return false;
+ if (!count_dyn_reloc (abfd, dyn_i, srel, dynrel_type,
+ (sec->flags & SEC_READONLY) != 0))
+ return FALSE;
}
}
- return true;
+ return TRUE;
}
-struct elfNN_ia64_allocate_data
-{
- struct bfd_link_info *info;
- bfd_size_type ofs;
-};
-
/* For cleanliness, and potentially faster dynamic loading, allocate
external GOT entries first. */
-static boolean
+static bfd_boolean
allocate_global_data_got (dyn_i, data)
struct elfNN_ia64_dyn_sym_info *dyn_i;
PTR data;
{
struct elfNN_ia64_allocate_data *x = (struct elfNN_ia64_allocate_data *)data;
- if (dyn_i->want_got
+ if ((dyn_i->want_got || dyn_i->want_gotx)
&& ! dyn_i->want_fptr
- && (elfNN_ia64_dynamic_symbol_p (dyn_i->h, x->info)
- || (elfNN_ia64_aix_vec (x->info->hash->creator)
- && (!dyn_i->h || strcmp (dyn_i->h->root.root.string,
- "__GLOB_DATA_PTR") != 0))))
+ && elfNN_ia64_dynamic_symbol_p (dyn_i->h, x->info, 0))
{
dyn_i->got_offset = x->ofs;
x->ofs += 8;
@@ -2395,20 +2520,35 @@ allocate_global_data_got (dyn_i, data)
}
if (dyn_i->want_dtpmod)
{
- dyn_i->dtpmod_offset = x->ofs;
- x->ofs += 8;
+ if (elfNN_ia64_dynamic_symbol_p (dyn_i->h, x->info, 0))
+ {
+ dyn_i->dtpmod_offset = x->ofs;
+ x->ofs += 8;
+ }
+ else
+ {
+ struct elfNN_ia64_link_hash_table *ia64_info;
+
+ ia64_info = elfNN_ia64_hash_table (x->info);
+ if (ia64_info->self_dtpmod_offset == (bfd_vma) -1)
+ {
+ ia64_info->self_dtpmod_offset = x->ofs;
+ x->ofs += 8;
+ }
+ dyn_i->dtpmod_offset = ia64_info->self_dtpmod_offset;
+ }
}
if (dyn_i->want_dtprel)
{
dyn_i->dtprel_offset = x->ofs;
x->ofs += 8;
}
- return true;
+ return TRUE;
}
/* Next, allocate all the GOT entries used by LTOFF_FPTR relocs. */
-static boolean
+static bfd_boolean
allocate_global_fptr_got (dyn_i, data)
struct elfNN_ia64_dyn_sym_info *dyn_i;
PTR data;
@@ -2417,32 +2557,30 @@ 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)
- || elfNN_ia64_aix_vec (x->info->hash->creator)))
+ && elfNN_ia64_dynamic_symbol_p (dyn_i->h, x->info, R_IA64_FPTR64LSB))
{
dyn_i->got_offset = x->ofs;
x->ofs += 8;
}
- return true;
+ return TRUE;
}
/* Lastly, allocate all the GOT entries for local data. */
-static boolean
+static bfd_boolean
allocate_local_got (dyn_i, data)
struct elfNN_ia64_dyn_sym_info *dyn_i;
PTR data;
{
struct elfNN_ia64_allocate_data *x = (struct elfNN_ia64_allocate_data *)data;
- if (dyn_i->want_got
- && ! (elfNN_ia64_dynamic_symbol_p (dyn_i->h, x->info)
- || elfNN_ia64_aix_vec (x->info->hash->creator)))
+ if ((dyn_i->want_got || dyn_i->want_gotx)
+ && !elfNN_ia64_dynamic_symbol_p (dyn_i->h, x->info, 0))
{
dyn_i->got_offset = x->ofs;
x->ofs += 8;
}
- return true;
+ return TRUE;
}
/* Search for the index of a global symbol in it's defining object file. */
@@ -2467,7 +2605,7 @@ global_sym_index (h)
/* Allocate function descriptors. We can do these for every function
in a main executable that is not exported. */
-static boolean
+static bfd_boolean
allocate_fptr (dyn_i, data)
struct elfNN_ia64_dyn_sym_info *dyn_i;
PTR data;
@@ -2483,22 +2621,20 @@ allocate_fptr (dyn_i, data)
|| h->root.type == bfd_link_hash_warning)
h = (struct elf_link_hash_entry *) h->root.u.i.link;
- if (x->info->shared
- /* AIX needs an FPTR in this case. */
- || (elfNN_ia64_aix_vec (x->info->hash->creator)
- && (!h
- || h->root.type == bfd_link_hash_defined
- || h->root.type == bfd_link_hash_defweak)))
+ if (!x->info->executable
+ && (!h
+ || ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
+ || h->root.type != bfd_link_hash_undefweak))
{
if (h && h->dynindx == -1)
{
BFD_ASSERT ((h->root.type == bfd_link_hash_defined)
|| (h->root.type == bfd_link_hash_defweak));
- if (!_bfd_elfNN_link_record_local_dynamic_symbol
+ if (!bfd_elf_link_record_local_dynamic_symbol
(x->info, h->root.u.def.section->owner,
global_sym_index (h)))
- return false;
+ return FALSE;
}
dyn_i->want_fptr = 0;
@@ -2511,12 +2647,12 @@ allocate_fptr (dyn_i, data)
else
dyn_i->want_fptr = 0;
}
- return true;
+ return TRUE;
}
/* Allocate all the minimal PLT entries. */
-static boolean
+static bfd_boolean
allocate_plt_entries (dyn_i, data)
struct elfNN_ia64_dyn_sym_info *dyn_i;
PTR data;
@@ -2533,7 +2669,7 @@ allocate_plt_entries (dyn_i, data)
h = (struct elf_link_hash_entry *) h->root.u.i.link;
/* ??? Versioned symbols seem to lose ELF_LINK_HASH_NEEDS_PLT. */
- if (elfNN_ia64_dynamic_symbol_p (h, x->info))
+ if (elfNN_ia64_dynamic_symbol_p (h, x->info, 0))
{
bfd_size_type offset = x->ofs;
if (offset == 0)
@@ -2549,12 +2685,12 @@ allocate_plt_entries (dyn_i, data)
dyn_i->want_plt2 = 0;
}
}
- return true;
+ return TRUE;
}
/* Allocate all the full PLT entries. */
-static boolean
+static bfd_boolean
allocate_plt2_entries (dyn_i, data)
struct elfNN_ia64_dyn_sym_info *dyn_i;
PTR data;
@@ -2574,7 +2710,7 @@ allocate_plt2_entries (dyn_i, data)
h = (struct elf_link_hash_entry *) h->root.u.i.link;
dyn_i->h->plt.offset = ofs;
}
- return true;
+ return TRUE;
}
/* Allocate all the PLTOFF entries requested by relocations and
@@ -2582,7 +2718,7 @@ allocate_plt2_entries (dyn_i, data)
because the latter are not necessarily addressable by the GP.
??? Relaxation might be able to determine that they are. */
-static boolean
+static bfd_boolean
allocate_pltoff_entries (dyn_i, data)
struct elfNN_ia64_dyn_sym_info *dyn_i;
PTR data;
@@ -2594,13 +2730,13 @@ allocate_pltoff_entries (dyn_i, data)
dyn_i->pltoff_offset = x->ofs;
x->ofs += 16;
}
- return true;
+ return TRUE;
}
/* Allocate dynamic relocations for those symbols that turned out
to be dynamic. */
-static boolean
+static bfd_boolean
allocate_dynrel_entries (dyn_i, data)
struct elfNN_ia64_dyn_sym_info *dyn_i;
PTR data;
@@ -2608,15 +2744,17 @@ allocate_dynrel_entries (dyn_i, data)
struct elfNN_ia64_allocate_data *x = (struct elfNN_ia64_allocate_data *)data;
struct elfNN_ia64_link_hash_table *ia64_info;
struct elfNN_ia64_dyn_reloc_entry *rent;
- boolean dynamic_symbol, shared;
+ bfd_boolean dynamic_symbol, shared, resolved_zero;
ia64_info = elfNN_ia64_hash_table (x->info);
- dynamic_symbol = elfNN_ia64_dynamic_symbol_p (dyn_i->h, x->info)
- || (elfNN_ia64_aix_vec (x->info->hash->creator)
- /* Don't allocate an entry for __GLOB_DATA_PTR */
- && (!dyn_i->h || strcmp (dyn_i->h->root.root.string,
- "__GLOB_DATA_PTR") != 0));
+
+ /* Note that this can't be used in relation to FPTR relocs below. */
+ dynamic_symbol = elfNN_ia64_dynamic_symbol_p (dyn_i->h, x->info, 0);
+
shared = x->info->shared;
+ resolved_zero = (dyn_i->h
+ && ELF_ST_VISIBILITY (dyn_i->h->other)
+ && dyn_i->h->root.type == bfd_link_hash_undefweak);
/* Take care of the normal data relocations. */
@@ -2627,10 +2765,11 @@ allocate_dynrel_entries (dyn_i, data)
switch (rent->type)
{
case R_IA64_FPTR64LSB:
- /* Allocate one iff !want_fptr, which by this point will
- be true only if we're actually allocating one statically
- in the main executable. */
- if (dyn_i->want_fptr)
+ /* Allocate one iff !want_fptr and not PIE, which by this point
+ will be true only if we're actually allocating one statically
+ in the main executable. Position independent executables
+ need a relative reloc. */
+ if (dyn_i->want_fptr && !x->info->pie)
continue;
break;
case R_IA64_PCREL64LSB:
@@ -2656,22 +2795,39 @@ allocate_dynrel_entries (dyn_i, data)
default:
abort ();
}
+ if (rent->reltext)
+ ia64_info->reltext = 1;
rent->srel->_raw_size += sizeof (ElfNN_External_Rela) * count;
}
/* Take care of the GOT and PLT relocations. */
- if (((dynamic_symbol || shared) && dyn_i->want_got)
- || (dyn_i->want_ltoff_fptr && dyn_i->h && dyn_i->h->dynindx != -1))
- ia64_info->rel_got_sec->_raw_size += sizeof (ElfNN_External_Rela);
+ 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 || shared) && dyn_i->want_dtpmod)
+ 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 (dyn_i->want_pltoff)
+ if (!resolved_zero && dyn_i->want_pltoff)
{
bfd_size_type t = 0;
@@ -2686,10 +2842,10 @@ allocate_dynrel_entries (dyn_i, data)
ia64_info->rel_pltoff_sec->_raw_size += t;
}
- return true;
+ return TRUE;
}
-static boolean
+static bfd_boolean
elfNN_ia64_adjust_dynamic_symbol (info, h)
struct bfd_link_info *info ATTRIBUTE_UNUSED;
struct elf_link_hash_entry *h;
@@ -2706,7 +2862,7 @@ elfNN_ia64_adjust_dynamic_symbol (info, h)
|| 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;
+ return TRUE;
}
/* If this is a reference to a symbol defined by a dynamic object which
@@ -2716,33 +2872,34 @@ elfNN_ia64_adjust_dynamic_symbol (info, h)
But IA-64 code is canonically PIC, so as a rule we can avoid this sort
of hackery. */
- return true;
+ return TRUE;
}
-static boolean
+static bfd_boolean
elfNN_ia64_size_dynamic_sections (output_bfd, info)
- bfd *output_bfd;
+ bfd *output_bfd ATTRIBUTE_UNUSED;
struct bfd_link_info *info;
{
struct elfNN_ia64_allocate_data data;
struct elfNN_ia64_link_hash_table *ia64_info;
asection *sec;
bfd *dynobj;
- boolean relplt = false;
+ bfd_boolean relplt = FALSE;
dynobj = elf_hash_table(info)->dynobj;
ia64_info = elfNN_ia64_hash_table (info);
+ ia64_info->self_dtpmod_offset = (bfd_vma) -1;
BFD_ASSERT(dynobj != NULL);
data.info = info;
/* Set the contents of the .interp section to the interpreter. */
if (ia64_info->root.dynamic_sections_created
- && !info->shared)
+ && info->executable)
{
sec = bfd_get_section_by_name (dynobj, ".interp");
BFD_ASSERT (sec != NULL);
- sec->contents = (bfd_byte *) DYNAMIC_INTERPRETER (output_bfd);
- sec->_raw_size = strlen (DYNAMIC_INTERPRETER (output_bfd)) + 1;
+ sec->contents = (bfd_byte *) ELF_DYNAMIC_INTERPRETER;
+ sec->_raw_size = strlen (ELF_DYNAMIC_INTERPRETER) + 1;
}
/* Allocate the GOT entries. */
@@ -2767,7 +2924,7 @@ elfNN_ia64_size_dynamic_sections (output_bfd, info)
/* Now that we've seen all of the input files, we can decide which
symbols need plt entries. Allocate the minimal PLT entries first.
- We do this even though dynamic_sections_created may be false, because
+ We do this even though dynamic_sections_created may be FALSE, because
this has the side-effect of clearing want_plt and want_plt2. */
data.ofs = 0;
@@ -2784,8 +2941,12 @@ elfNN_ia64_size_dynamic_sections (output_bfd, info)
data.ofs = (data.ofs + 31) & (bfd_vma) -32;
elfNN_ia64_dyn_sym_traverse (ia64_info, allocate_plt2_entries, &data);
- if (data.ofs != 0)
+ if (data.ofs != 0 || ia64_info->root.dynamic_sections_created)
{
+ /* FIXME: we always reserve the memory for dynamic linker even if
+ there are no PLT entries since dynamic linker may assume the
+ reserved memory always exists. */
+
BFD_ASSERT (ia64_info->root.dynamic_sections_created);
ia64_info->plt_sec->_raw_size = data.ofs;
@@ -2810,6 +2971,8 @@ elfNN_ia64_size_dynamic_sections (output_bfd, info)
/* Allocate space for the dynamic relocations that turned out to be
required. */
+ if (info->shared && ia64_info->self_dtpmod_offset != (bfd_vma) -1)
+ ia64_info->rel_got_sec->_raw_size += sizeof (ElfNN_External_Rela);
elfNN_ia64_dyn_sym_traverse (ia64_info, allocate_dynrel_entries, &data);
}
@@ -2817,7 +2980,7 @@ elfNN_ia64_size_dynamic_sections (output_bfd, info)
Allocate memory for them. */
for (sec = dynobj->sections; sec != NULL; sec = sec->next)
{
- boolean strip;
+ bfd_boolean strip;
if (!(sec->flags & SEC_LINKER_CREATED))
continue;
@@ -2833,7 +2996,7 @@ elfNN_ia64_size_dynamic_sections (output_bfd, info)
strip = (sec->_raw_size == 0);
if (sec == ia64_info->got_sec)
- strip = false;
+ strip = FALSE;
else if (sec == ia64_info->rel_got_sec)
{
if (strip)
@@ -2848,6 +3011,15 @@ elfNN_ia64_size_dynamic_sections (output_bfd, info)
if (strip)
ia64_info->fptr_sec = NULL;
}
+ else if (sec == ia64_info->rel_fptr_sec)
+ {
+ if (strip)
+ ia64_info->rel_fptr_sec = NULL;
+ else
+ /* We use the reloc_count field as a counter if we need to
+ copy relocs into the output file. */
+ sec->reloc_count = 0;
+ }
else if (sec == ia64_info->plt_sec)
{
if (strip)
@@ -2864,7 +3036,7 @@ elfNN_ia64_size_dynamic_sections (output_bfd, info)
ia64_info->rel_pltoff_sec = NULL;
else
{
- relplt = true;
+ relplt = TRUE;
/* We use the reloc_count field as a counter if we need to
copy relocs into the output file. */
sec->reloc_count = 0;
@@ -2879,7 +3051,7 @@ elfNN_ia64_size_dynamic_sections (output_bfd, info)
name = bfd_get_section_name (dynobj, sec);
if (strcmp (name, ".got.plt") == 0)
- strip = false;
+ strip = FALSE;
else if (strncmp (name, ".rel", 4) == 0)
{
if (!strip)
@@ -2900,7 +3072,7 @@ elfNN_ia64_size_dynamic_sections (output_bfd, info)
/* Allocate memory for the section contents. */
sec->contents = (bfd_byte *) bfd_zalloc (dynobj, sec->_raw_size);
if (sec->contents == NULL && sec->_raw_size != 0)
- return false;
+ return FALSE;
}
}
@@ -2910,46 +3082,46 @@ elfNN_ia64_size_dynamic_sections (output_bfd, info)
later (in finish_dynamic_sections) but we must add the entries now
so that we get the correct size for the .dynamic section. */
- if (!info->shared)
+ if (info->executable)
{
/* The DT_DEBUG entry is filled in by the dynamic linker and used
by the debugger. */
#define add_dynamic_entry(TAG, VAL) \
- bfd_elfNN_add_dynamic_entry (info, (bfd_vma) (TAG), (bfd_vma) (VAL))
+ _bfd_elf_add_dynamic_entry (info, TAG, VAL)
if (!add_dynamic_entry (DT_DEBUG, 0))
- return false;
+ return FALSE;
}
if (!add_dynamic_entry (DT_IA_64_PLT_RESERVE, 0))
- return false;
+ return FALSE;
if (!add_dynamic_entry (DT_PLTGOT, 0))
- return false;
+ return FALSE;
if (relplt)
{
if (!add_dynamic_entry (DT_PLTRELSZ, 0)
|| !add_dynamic_entry (DT_PLTREL, DT_RELA)
|| !add_dynamic_entry (DT_JMPREL, 0))
- return false;
+ return FALSE;
}
if (!add_dynamic_entry (DT_RELA, 0)
|| !add_dynamic_entry (DT_RELASZ, 0)
|| !add_dynamic_entry (DT_RELAENT, sizeof (ElfNN_External_Rela)))
- return false;
+ return FALSE;
if (ia64_info->reltext)
{
if (!add_dynamic_entry (DT_TEXTREL, 0))
- return false;
+ return FALSE;
info->flags |= DF_TEXTREL;
}
}
/* ??? Perhaps force __gp local. */
- return true;
+ return TRUE;
}
static bfd_reloc_status_type
@@ -3190,14 +3362,13 @@ elfNN_ia64_install_dyn_reloc (abfd, info, sec, srel, offset, type,
bfd_vma addend;
{
Elf_Internal_Rela outrel;
-
- offset += sec->output_section->vma + sec->output_offset;
+ bfd_byte *loc;
BFD_ASSERT (dynindx != -1);
outrel.r_info = ELFNN_R_INFO (dynindx, type);
outrel.r_addend = addend;
outrel.r_offset = _bfd_elf_section_offset (abfd, info, sec, offset);
- if ((outrel.r_offset | 1) == (bfd_vma) -1)
+ if (outrel.r_offset >= (bfd_vma) -2)
{
/* Run for the hills. We shouldn't be outputting a relocation
for this. So do what everyone else does and output a no-op. */
@@ -3205,10 +3376,12 @@ elfNN_ia64_install_dyn_reloc (abfd, info, sec, srel, offset, type,
outrel.r_addend = 0;
outrel.r_offset = 0;
}
+ else
+ outrel.r_offset += sec->output_section->vma + sec->output_offset;
- bfd_elfNN_swap_reloca_out (abfd, &outrel,
- ((ElfNN_External_Rela *) srel->contents
- + srel->reloc_count++));
+ 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);
}
@@ -3228,7 +3401,7 @@ set_got_entry (abfd, info, dyn_i, dynindx, addend, value, dyn_r_type)
{
struct elfNN_ia64_link_hash_table *ia64_info;
asection *got_sec;
- boolean done;
+ bfd_boolean done;
bfd_vma got_offset;
ia64_info = elfNN_ia64_hash_table (info);
@@ -3238,22 +3411,31 @@ set_got_entry (abfd, info, dyn_i, dynindx, addend, value, dyn_r_type)
{
case R_IA64_TPREL64LSB:
done = dyn_i->tprel_done;
- dyn_i->tprel_done = true;
+ dyn_i->tprel_done = TRUE;
got_offset = dyn_i->tprel_offset;
break;
case R_IA64_DTPMOD64LSB:
- done = dyn_i->dtpmod_done;
- dyn_i->dtpmod_done = true;
+ if (dyn_i->dtpmod_offset != ia64_info->self_dtpmod_offset)
+ {
+ done = dyn_i->dtpmod_done;
+ dyn_i->dtpmod_done = TRUE;
+ }
+ else
+ {
+ done = ia64_info->self_dtpmod_done;
+ ia64_info->self_dtpmod_done = TRUE;
+ dynindx = 0;
+ }
got_offset = dyn_i->dtpmod_offset;
break;
case R_IA64_DTPREL64LSB:
done = dyn_i->dtprel_done;
- dyn_i->dtprel_done = true;
+ dyn_i->dtprel_done = TRUE;
got_offset = dyn_i->dtprel_offset;
break;
default:
done = dyn_i->got_done;
- dyn_i->got_done = true;
+ dyn_i->got_done = TRUE;
got_offset = dyn_i->got_offset;
break;
}
@@ -3266,10 +3448,17 @@ set_got_entry (abfd, info, dyn_i, dynindx, addend, value, dyn_r_type)
bfd_put_64 (abfd, value, got_sec->contents + got_offset);
/* Install a dynamic relocation if needed. */
- if ((info->shared && dyn_r_type != R_IA64_DTPREL64LSB)
- || elfNN_ia64_dynamic_symbol_p (dyn_i->h, info)
- || elfNN_ia64_aix_vec (abfd->xvec)
- || (dynindx != -1 && dyn_r_type == R_IA64_FPTR64LSB))
+ if (((info->shared
+ && (!dyn_i->h
+ || ELF_ST_VISIBILITY (dyn_i->h->other) == STV_DEFAULT
+ || dyn_i->h->root.type != bfd_link_hash_undefweak)
+ && dyn_r_type != R_IA64_DTPREL64LSB)
+ || elfNN_ia64_dynamic_symbol_p (dyn_i->h, info, dyn_r_type)
+ || (dynindx != -1 && dyn_r_type == R_IA64_FPTR64LSB))
+ && (!dyn_i->want_ltoff_fptr
+ || !info->pie
+ || !dyn_i->h
+ || dyn_i->h->root.type != bfd_link_hash_undefweak))
{
if (dynindx == -1
&& dyn_r_type != R_IA64_TPREL64LSB
@@ -3304,7 +3493,7 @@ set_got_entry (abfd, info, dyn_i, dynindx, addend, value, dyn_r_type)
dyn_r_type = R_IA64_DTPREL64MSB;
break;
default:
- BFD_ASSERT (false);
+ BFD_ASSERT (FALSE);
break;
}
}
@@ -3348,6 +3537,24 @@ set_fptr_entry (abfd, info, dyn_i, value)
bfd_put_64 (abfd, value, fptr_sec->contents + dyn_i->fptr_offset);
bfd_put_64 (abfd, _bfd_get_gp_value (abfd),
fptr_sec->contents + dyn_i->fptr_offset + 8);
+ if (ia64_info->rel_fptr_sec)
+ {
+ Elf_Internal_Rela outrel;
+ bfd_byte *loc;
+
+ if (bfd_little_endian (abfd))
+ outrel.r_info = ELFNN_R_INFO (0, R_IA64_IPLTLSB);
+ else
+ outrel.r_info = ELFNN_R_INFO (0, R_IA64_IPLTMSB);
+ outrel.r_addend = value;
+ outrel.r_offset = (fptr_sec->output_section->vma
+ + fptr_sec->output_offset
+ + dyn_i->fptr_offset);
+ loc = ia64_info->rel_fptr_sec->contents;
+ loc += ia64_info->rel_fptr_sec->reloc_count++
+ * sizeof (ElfNN_External_Rela);
+ bfd_elfNN_swap_reloca_out (abfd, &outrel, loc);
+ }
}
/* Return the descriptor's address. */
@@ -3367,7 +3574,7 @@ set_pltoff_entry (abfd, info, dyn_i, value, is_plt)
struct bfd_link_info *info;
struct elfNN_ia64_dyn_sym_info *dyn_i;
bfd_vma value;
- boolean is_plt;
+ bfd_boolean is_plt;
{
struct elfNN_ia64_link_hash_table *ia64_info;
asection *pltoff_sec;
@@ -3387,7 +3594,11 @@ set_pltoff_entry (abfd, info, dyn_i, value, is_plt)
bfd_put_64 (abfd, gp, pltoff_sec->contents + dyn_i->pltoff_offset + 8);
/* Install dynamic relocations if needed. */
- if (!is_plt && info->shared)
+ if (!is_plt
+ && info->shared
+ && (!dyn_i->h
+ || ELF_ST_VISIBILITY (dyn_i->h->other) == STV_DEFAULT
+ || dyn_i->h->root.type != bfd_link_hash_undefweak))
{
unsigned int dyn_r_type;
@@ -3426,12 +3637,10 @@ static bfd_vma
elfNN_ia64_tprel_base (info)
struct bfd_link_info *info;
{
- struct elf_link_tls_segment *tls_segment
- = elf_hash_table (info)->tls_segment;
+ asection *tls_sec = elf_hash_table (info)->tls_sec;
- BFD_ASSERT (tls_segment != NULL);
- return (tls_segment->start
- - align_power ((bfd_vma) 16, tls_segment->align));
+ BFD_ASSERT (tls_sec != NULL);
+ return tls_sec->vma - align_power ((bfd_vma) 16, tls_sec->alignment_power);
}
/* Return the base VMA address which should be subtracted from real addresses
@@ -3442,8 +3651,8 @@ static bfd_vma
elfNN_ia64_dtprel_base (info)
struct bfd_link_info *info;
{
- BFD_ASSERT (elf_hash_table (info)->tls_segment != NULL);
- return elf_hash_table (info)->tls_segment->start;
+ BFD_ASSERT (elf_hash_table (info)->tls_sec != NULL);
+ return elf_hash_table (info)->tls_sec->vma;
}
/* Called through qsort to sort the .IA_64.unwind section during a
@@ -3465,125 +3674,148 @@ elfNN_ia64_unwind_entry_compare (a, b)
return (av < bv ? -1 : av > bv ? 1 : 0);
}
-static boolean
-elfNN_ia64_final_link (abfd, info)
+/* Make sure we've got ourselves a nice fat __gp value. */
+static bfd_boolean
+elfNN_ia64_choose_gp (abfd, info)
bfd *abfd;
struct bfd_link_info *info;
{
+ bfd_vma min_vma = (bfd_vma) -1, max_vma = 0;
+ bfd_vma min_short_vma = min_vma, max_short_vma = 0;
+ struct elf_link_hash_entry *gp;
+ bfd_vma gp_val;
+ asection *os;
struct elfNN_ia64_link_hash_table *ia64_info;
- asection *unwind_output_sec;
ia64_info = elfNN_ia64_hash_table (info);
- /* Make sure we've got ourselves a nice fat __gp value. */
- if (!info->relocateable)
+ /* Find the min and max vma of all sections marked short. Also collect
+ min and max vma of any type, for use in selecting a nice gp. */
+ for (os = abfd->sections; os ; os = os->next)
{
- bfd_vma min_vma = (bfd_vma) -1, max_vma = 0;
- bfd_vma min_short_vma = min_vma, max_short_vma = 0;
- struct elf_link_hash_entry *gp;
- bfd_vma gp_val;
- asection *os;
+ bfd_vma lo, hi;
+
+ if ((os->flags & SEC_ALLOC) == 0)
+ continue;
+
+ lo = os->vma;
+ hi = os->vma + os->_raw_size;
+ if (hi < lo)
+ hi = (bfd_vma) -1;
- /* Find the min and max vma of all sections marked short. Also
- collect min and max vma of any type, for use in selecting a
- nice gp. */
- for (os = abfd->sections; os ; os = os->next)
+ if (min_vma > lo)
+ min_vma = lo;
+ if (max_vma < hi)
+ max_vma = hi;
+ if (os->flags & SEC_SMALL_DATA)
{
- bfd_vma lo, hi;
+ if (min_short_vma > lo)
+ min_short_vma = lo;
+ if (max_short_vma < hi)
+ max_short_vma = hi;
+ }
+ }
- if ((os->flags & SEC_ALLOC) == 0)
- continue;
+ /* See if the user wants to force a value. */
+ gp = elf_link_hash_lookup (elf_hash_table (info), "__gp", FALSE,
+ FALSE, FALSE);
- lo = os->vma;
- hi = os->vma + os->_raw_size;
- if (hi < lo)
- hi = (bfd_vma) -1;
+ if (gp
+ && (gp->root.type == bfd_link_hash_defined
+ || gp->root.type == bfd_link_hash_defweak))
+ {
+ asection *gp_sec = gp->root.u.def.section;
+ gp_val = (gp->root.u.def.value
+ + gp_sec->output_section->vma
+ + gp_sec->output_offset);
+ }
+ else
+ {
+ /* Pick a sensible value. */
- if (min_vma > lo)
- min_vma = lo;
- if (max_vma < hi)
- max_vma = hi;
- if (os->flags & SEC_SMALL_DATA)
- {
- if (min_short_vma > lo)
- min_short_vma = lo;
- if (max_short_vma < hi)
- max_short_vma = hi;
- }
+ asection *got_sec = ia64_info->got_sec;
+
+ /* Start with just the address of the .got. */
+ if (got_sec)
+ gp_val = got_sec->output_section->vma;
+ else if (max_short_vma != 0)
+ gp_val = min_short_vma;
+ else
+ gp_val = min_vma;
+
+ /* If it is possible to address the entire image, but we
+ don't with the choice above, adjust. */
+ if (max_vma - min_vma < 0x400000
+ && max_vma - gp_val <= 0x200000
+ && gp_val - min_vma > 0x200000)
+ gp_val = min_vma + 0x200000;
+ else if (max_short_vma != 0)
+ {
+ /* If we don't cover all the short data, adjust. */
+ if (max_short_vma - gp_val >= 0x200000)
+ gp_val = min_short_vma + 0x200000;
+
+ /* If we're addressing stuff past the end, adjust back. */
+ if (gp_val > max_vma)
+ gp_val = max_vma - 0x200000 + 8;
}
+ }
- /* See if the user wants to force a value. */
- gp = elf_link_hash_lookup (elf_hash_table (info), "__gp", false,
- false, false);
+ /* Validate whether all SHF_IA_64_SHORT sections are within
+ range of the chosen GP. */
- if (gp
- && (gp->root.type == bfd_link_hash_defined
- || gp->root.type == bfd_link_hash_defweak))
+ if (max_short_vma != 0)
+ {
+ if (max_short_vma - min_short_vma >= 0x400000)
{
- asection *gp_sec = gp->root.u.def.section;
- gp_val = (gp->root.u.def.value
- + gp_sec->output_section->vma
- + gp_sec->output_offset);
+ (*_bfd_error_handler)
+ (_("%s: short data segment overflowed (0x%lx >= 0x400000)"),
+ bfd_get_filename (abfd),
+ (unsigned long) (max_short_vma - min_short_vma));
+ return FALSE;
}
- else
+ else if ((gp_val > min_short_vma
+ && gp_val - min_short_vma > 0x200000)
+ || (gp_val < max_short_vma
+ && max_short_vma - gp_val >= 0x200000))
{
- /* Pick a sensible value. */
+ (*_bfd_error_handler)
+ (_("%s: __gp does not cover short data segment"),
+ bfd_get_filename (abfd));
+ return FALSE;
+ }
+ }
- asection *got_sec = ia64_info->got_sec;
+ _bfd_set_gp_value (abfd, gp_val);
- /* Start with just the address of the .got. */
- if (got_sec)
- gp_val = got_sec->output_section->vma;
- else if (max_short_vma != 0)
- gp_val = min_short_vma;
- else
- gp_val = min_vma;
-
- /* If it is possible to address the entire image, but we
- don't with the choice above, adjust. */
- if (max_vma - min_vma < 0x400000
- && max_vma - gp_val <= 0x200000
- && gp_val - min_vma > 0x200000)
- gp_val = min_vma + 0x200000;
- else if (max_short_vma != 0)
- {
- /* If we don't cover all the short data, adjust. */
- if (max_short_vma - gp_val >= 0x200000)
- gp_val = min_short_vma + 0x200000;
+ return TRUE;
+}
- /* If we're addressing stuff past the end, adjust back. */
- if (gp_val > max_vma)
- gp_val = max_vma - 0x200000 + 8;
- }
- }
+static bfd_boolean
+elfNN_ia64_final_link (abfd, info)
+ bfd *abfd;
+ struct bfd_link_info *info;
+{
+ struct elfNN_ia64_link_hash_table *ia64_info;
+ asection *unwind_output_sec;
- /* Validate whether all SHF_IA_64_SHORT sections are within
- range of the chosen GP. */
+ ia64_info = elfNN_ia64_hash_table (info);
- if (max_short_vma != 0)
+ /* Make sure we've got ourselves a nice fat __gp value. */
+ if (!info->relocatable)
+ {
+ bfd_vma gp_val = _bfd_get_gp_value (abfd);
+ struct elf_link_hash_entry *gp;
+
+ if (gp_val == 0)
{
- if (max_short_vma - min_short_vma >= 0x400000)
- {
- (*_bfd_error_handler)
- (_("%s: short data segment overflowed (0x%lx >= 0x400000)"),
- bfd_get_filename (abfd),
- (unsigned long) (max_short_vma - min_short_vma));
- return false;
- }
- else if ((gp_val > min_short_vma
- && gp_val - min_short_vma > 0x200000)
- || (gp_val < max_short_vma
- && max_short_vma - gp_val >= 0x200000))
- {
- (*_bfd_error_handler)
- (_("%s: __gp does not cover short data segment"),
- bfd_get_filename (abfd));
- return false;
- }
+ if (! elfNN_ia64_choose_gp (abfd, info))
+ return FALSE;
+ gp_val = _bfd_get_gp_value (abfd);
}
- _bfd_set_gp_value (abfd, gp_val);
-
+ gp = elf_link_hash_lookup (elf_hash_table (info), "__gp", FALSE,
+ FALSE, FALSE);
if (gp)
{
gp->root.type = bfd_link_hash_defined;
@@ -3596,7 +3828,7 @@ elfNN_ia64_final_link (abfd, info)
of the .IA_64.unwind section. Force this section to be relocated
into memory rather than written immediately to the output file. */
unwind_output_sec = NULL;
- if (!info->relocateable)
+ if (!info->relocatable)
{
asection *s = bfd_get_section_by_name (abfd, ELF_STRING_ia64_unwind);
if (s)
@@ -3605,13 +3837,13 @@ elfNN_ia64_final_link (abfd, info)
unwind_output_sec->contents
= bfd_malloc (unwind_output_sec->_raw_size);
if (unwind_output_sec->contents == NULL)
- return false;
+ return FALSE;
}
}
/* Invoke the regular ELF backend linker to do all the work. */
- if (!bfd_elfNN_bfd_final_link (abfd, info))
- return false;
+ if (!bfd_elf_final_link (abfd, info))
+ return FALSE;
if (unwind_output_sec)
{
@@ -3624,13 +3856,13 @@ elfNN_ia64_final_link (abfd, info)
if (! bfd_set_section_contents (abfd, unwind_output_sec,
unwind_output_sec->contents, (bfd_vma) 0,
unwind_output_sec->_raw_size))
- return false;
+ return FALSE;
}
- return true;
+ return TRUE;
}
-static boolean
+static bfd_boolean
elfNN_ia64_relocate_section (output_bfd, info, input_bfd, input_section,
contents, relocs, local_syms, local_sections)
bfd *output_bfd;
@@ -3647,14 +3879,14 @@ elfNN_ia64_relocate_section (output_bfd, info, input_bfd, input_section,
Elf_Internal_Rela *rel;
Elf_Internal_Rela *relend;
asection *srel;
- boolean ret_val = true; /* for non-fatal errors */
+ bfd_boolean ret_val = TRUE; /* for non-fatal errors */
bfd_vma gp_val;
symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr;
ia64_info = elfNN_ia64_hash_table (info);
/* Infect various flags from the input section to the output section. */
- if (info->relocateable)
+ if (info->relocatable)
{
bfd_vma flags;
@@ -3663,11 +3895,11 @@ 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;
+ return TRUE;
}
gp_val = _bfd_get_gp_value (output_bfd);
- srel = get_reloc_section (input_bfd, ia64_info, input_section, false);
+ srel = get_reloc_section (input_bfd, ia64_info, input_section, FALSE);
rel = relocs;
relend = relocs + input_section->reloc_count;
@@ -3683,8 +3915,8 @@ elfNN_ia64_relocate_section (output_bfd, info, input_bfd, input_section,
bfd_vma value;
asection *sym_sec;
bfd_byte *hit_addr;
- boolean dynamic_symbol_p;
- boolean undef_weak_ref;
+ bfd_boolean dynamic_symbol_p;
+ bfd_boolean undef_weak_ref;
r_type = ELFNN_R_TYPE (rel->r_info);
if (r_type > R_IA64_MAX_RELOC_CODE)
@@ -3693,7 +3925,7 @@ elfNN_ia64_relocate_section (output_bfd, info, input_bfd, input_section,
(_("%s: unknown relocation type %d"),
bfd_archive_filename (input_bfd), (int)r_type);
bfd_set_error (bfd_error_bad_value);
- ret_val = false;
+ ret_val = FALSE;
continue;
}
@@ -3702,26 +3934,26 @@ elfNN_ia64_relocate_section (output_bfd, info, input_bfd, input_section,
h = NULL;
sym = NULL;
sym_sec = NULL;
- undef_weak_ref = false;
+ undef_weak_ref = FALSE;
if (r_symndx < symtab_hdr->sh_info)
{
/* Reloc against local symbol. */
+ asection *msec;
sym = local_syms + r_symndx;
sym_sec = local_sections[r_symndx];
- value = _bfd_elf_rela_local_sym (output_bfd, sym, sym_sec, rel);
+ msec = sym_sec;
+ value = _bfd_elf_rela_local_sym (output_bfd, sym, &msec, rel);
if ((sym_sec->flags & SEC_MERGE)
&& ELF_ST_TYPE (sym->st_info) == STT_SECTION
- && (elf_section_data (sym_sec)->sec_info_type
- == ELF_INFO_TYPE_MERGE))
+ && sym_sec->sec_info_type == ELF_INFO_TYPE_MERGE)
{
struct elfNN_ia64_local_hash_entry *loc_h;
-
- loc_h = get_local_sym_hash (ia64_info, input_bfd, rel, false);
+
+ loc_h = get_local_sym_hash (ia64_info, input_bfd, rel, FALSE);
if (loc_h && ! loc_h->sec_merge_done)
{
struct elfNN_ia64_dyn_sym_info *dynent;
- asection *msec;
for (dynent = loc_h->info; dynent; dynent = dynent->next)
{
@@ -3745,59 +3977,24 @@ elfNN_ia64_relocate_section (output_bfd, info, input_bfd, input_section,
}
else
{
- long indx;
-
- /* Reloc against global symbol. */
- indx = r_symndx - symtab_hdr->sh_info;
- h = elf_sym_hashes (input_bfd)[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;
-
- value = 0;
- if (h->root.type == bfd_link_hash_defined
- || h->root.type == bfd_link_hash_defweak)
- {
- sym_sec = h->root.u.def.section;
-
- /* Detect the cases that sym_sec->output_section is
- expected to be NULL -- all cases in which the symbol
- is defined in another shared module. This includes
- PLT relocs for which we've created a PLT entry and
- other relocs for which we're prepared to create
- dynamic relocations. */
- /* ??? Just accept it NULL and continue. */
-
- if (sym_sec->output_section != NULL)
- {
- value = (h->root.u.def.value
- + sym_sec->output_section->vma
- + sym_sec->output_offset);
- }
- }
- else if (h->root.type == bfd_link_hash_undefweak)
- undef_weak_ref = true;
- else if (info->shared
- && (!info->symbolic || info->allow_shlib_undefined)
- && !info->no_undefined
- && ELF_ST_VISIBILITY (h->other) == STV_DEFAULT)
- ;
- else
- {
- if (! ((*info->callbacks->undefined_symbol)
- (info, h->root.root.string, input_bfd,
- input_section, rel->r_offset,
- (!info->shared || info->no_undefined
- || ELF_ST_VISIBILITY (h->other)))))
- return false;
- ret_val = false;
- continue;
- }
+ bfd_boolean unresolved_reloc;
+ bfd_boolean warned;
+ struct elf_link_hash_entry **sym_hashes = elf_sym_hashes (input_bfd);
+
+ RELOC_FOR_GLOBAL_SYMBOL (info, input_bfd, input_section, rel,
+ r_symndx, symtab_hdr, sym_hashes,
+ h, sym_sec, value,
+ unresolved_reloc, warned);
+
+ if (h->root.type == bfd_link_hash_undefweak)
+ undef_weak_ref = TRUE;
+ else if (warned)
+ continue;
}
hit_addr = contents + rel->r_offset;
value += rel->r_addend;
- dynamic_symbol_p = elfNN_ia64_dynamic_symbol_p (h, info);
+ dynamic_symbol_p = elfNN_ia64_dynamic_symbol_p (h, info, r_type);
switch (r_type)
{
@@ -3813,11 +4010,7 @@ elfNN_ia64_relocate_section (output_bfd, info, input_bfd, input_section,
case R_IA64_DIR64MSB:
case R_IA64_DIR64LSB:
/* Install a dynamic relocation for this reloc. */
- if ((dynamic_symbol_p || info->shared
- || (elfNN_ia64_aix_vec (info->hash->creator)
- /* Don't emit relocs for __GLOB_DATA_PTR on AIX. */
- && (!h || strcmp (h->root.root.string,
- "__GLOB_DATA_PTR") != 0)))
+ if ((dynamic_symbol_p || info->shared)
&& r_symndx != 0
&& (input_section->flags & SEC_ALLOC) != 0)
{
@@ -3827,6 +4020,24 @@ elfNN_ia64_relocate_section (output_bfd, info, input_bfd, input_section,
BFD_ASSERT (srel != NULL);
+ switch (r_type)
+ {
+ case R_IA64_IMM14:
+ case R_IA64_IMM22:
+ case R_IA64_IMM64:
+ /* ??? People shouldn't be doing non-pic code in
+ shared libraries nor dynamic executables. */
+ (*_bfd_error_handler)
+ (_("%s: non-pic code with imm relocation against dynamic symbol `%s'"),
+ bfd_archive_filename (input_bfd),
+ h->root.root.string);
+ ret_val = FALSE;
+ continue;
+
+ default:
+ break;
+ }
+
/* If we don't need dynamic symbol lookup, find a
matching RELATIVE relocation. */
dyn_r_type = r_type;
@@ -3854,29 +4065,17 @@ elfNN_ia64_relocate_section (output_bfd, info, input_bfd, input_section,
break;
default:
- /* We can't represent this without a dynamic symbol.
- Adjust the relocation to be against an output
- section symbol, which are always present in the
- dynamic symbol table. */
- /* ??? People shouldn't be doing non-pic code in
- shared libraries. Hork. */
- (*_bfd_error_handler)
- (_("%s: linking non-pic code in a shared library"),
- bfd_archive_filename (input_bfd));
- ret_val = false;
- continue;
+ break;
}
dynindx = 0;
addend = value;
}
- if (elfNN_ia64_aix_vec (info->hash->creator))
- rel->r_addend = value;
elfNN_ia64_install_dyn_reloc (output_bfd, info, input_section,
srel, rel->r_offset, dyn_r_type,
dynindx, addend);
}
- /* FALLTHRU */
+ /* Fall through. */
case R_IA64_LTV32MSB:
case R_IA64_LTV32LSB:
@@ -3896,7 +4095,7 @@ elfNN_ia64_relocate_section (output_bfd, info, input_bfd, input_section,
(*_bfd_error_handler)
(_("%s: @gprel relocation against dynamic symbol %s"),
bfd_archive_filename (input_bfd), h->root.root.string);
- ret_val = false;
+ ret_val = FALSE;
continue;
}
value -= gp_val;
@@ -3906,7 +4105,7 @@ elfNN_ia64_relocate_section (output_bfd, info, input_bfd, input_section,
case R_IA64_LTOFF22:
case R_IA64_LTOFF22X:
case R_IA64_LTOFF64I:
- dyn_i = get_dyn_sym_info (ia64_info, h, input_bfd, rel, false);
+ dyn_i = get_dyn_sym_info (ia64_info, h, input_bfd, rel, FALSE);
value = set_got_entry (input_bfd, info, dyn_i, (h ? h->dynindx : -1),
rel->r_addend, value, R_IA64_DIR64LSB);
value -= gp_val;
@@ -3917,8 +4116,8 @@ elfNN_ia64_relocate_section (output_bfd, info, input_bfd, input_section,
case R_IA64_PLTOFF64I:
case R_IA64_PLTOFF64MSB:
case R_IA64_PLTOFF64LSB:
- dyn_i = get_dyn_sym_info (ia64_info, h, input_bfd, rel, false);
- value = set_pltoff_entry (output_bfd, info, dyn_i, value, false);
+ dyn_i = get_dyn_sym_info (ia64_info, h, input_bfd, rel, FALSE);
+ value = set_pltoff_entry (output_bfd, info, dyn_i, value, FALSE);
value -= gp_val;
r = elfNN_ia64_install_value (output_bfd, hit_addr, value, r_type);
break;
@@ -3928,20 +4127,42 @@ elfNN_ia64_relocate_section (output_bfd, info, input_bfd, input_section,
case R_IA64_FPTR32LSB:
case R_IA64_FPTR64MSB:
case R_IA64_FPTR64LSB:
- dyn_i = get_dyn_sym_info (ia64_info, h, input_bfd, rel, false);
+ dyn_i = get_dyn_sym_info (ia64_info, h, input_bfd, rel, FALSE);
if (dyn_i->want_fptr)
{
if (!undef_weak_ref)
value = set_fptr_entry (output_bfd, info, dyn_i, value);
}
- else
+ if (!dyn_i->want_fptr || info->pie)
{
long dynindx;
+ unsigned int dyn_r_type = r_type;
+ bfd_vma addend = rel->r_addend;
/* Otherwise, we expect the dynamic linker to create
the entry. */
- if (h)
+ if (dyn_i->want_fptr)
+ {
+ if (r_type == R_IA64_FPTR64I)
+ {
+ /* We can't represent this without a dynamic symbol.
+ Adjust the relocation to be against an output
+ section symbol, which are always present in the
+ dynamic symbol table. */
+ /* ??? People shouldn't be doing non-pic code in
+ shared libraries. Hork. */
+ (*_bfd_error_handler)
+ (_("%s: linking non-pic code in a position independent executable"),
+ bfd_archive_filename (input_bfd));
+ ret_val = FALSE;
+ continue;
+ }
+ dynindx = 0;
+ addend = value;
+ dyn_r_type = r_type + R_IA64_REL64LSB - R_IA64_FPTR64LSB;
+ }
+ else if (h)
{
if (h->dynindx != -1)
dynindx = h->dynindx;
@@ -3949,17 +4170,18 @@ elfNN_ia64_relocate_section (output_bfd, info, input_bfd, input_section,
dynindx = (_bfd_elf_link_lookup_local_dynindx
(info, h->root.u.def.section->owner,
global_sym_index (h)));
+ value = 0;
}
else
{
dynindx = (_bfd_elf_link_lookup_local_dynindx
(info, input_bfd, (long) r_symndx));
+ value = 0;
}
elfNN_ia64_install_dyn_reloc (output_bfd, info, input_section,
- srel, rel->r_offset, r_type,
- dynindx, rel->r_addend);
- value = 0;
+ srel, rel->r_offset, dyn_r_type,
+ dynindx, addend);
}
r = elfNN_ia64_install_value (output_bfd, hit_addr, value, r_type);
@@ -3974,7 +4196,7 @@ elfNN_ia64_relocate_section (output_bfd, info, input_bfd, input_section,
{
long dynindx;
- dyn_i = get_dyn_sym_info (ia64_info, h, input_bfd, rel, false);
+ 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)
@@ -4013,9 +4235,7 @@ elfNN_ia64_relocate_section (output_bfd, info, input_bfd, input_section,
case R_IA64_PCREL64MSB:
case R_IA64_PCREL64LSB:
/* Install a dynamic relocation for this reloc. */
- if ((dynamic_symbol_p
- || elfNN_ia64_aix_vec (info->hash->creator))
- && r_symndx != 0)
+ if (dynamic_symbol_p && r_symndx != 0)
{
BFD_ASSERT (srel != NULL);
@@ -4025,35 +4245,12 @@ elfNN_ia64_relocate_section (output_bfd, info, input_bfd, input_section,
}
goto finish_pcrel;
- case R_IA64_PCREL21BI:
- case R_IA64_PCREL21F:
- case R_IA64_PCREL21M:
- /* ??? These two are only used for speculation fixup code.
- They should never be dynamic. */
- if (dynamic_symbol_p)
- {
- (*_bfd_error_handler)
- (_("%s: dynamic relocation against speculation fixup"),
- bfd_archive_filename (input_bfd));
- ret_val = false;
- continue;
- }
- if (undef_weak_ref)
- {
- (*_bfd_error_handler)
- (_("%s: speculation fixup against undefined weak symbol"),
- bfd_archive_filename (input_bfd));
- ret_val = false;
- continue;
- }
- goto finish_pcrel;
-
case R_IA64_PCREL21B:
case R_IA64_PCREL60B:
/* We should have created a PLT entry for any dynamic symbol. */
dyn_i = NULL;
if (h)
- dyn_i = get_dyn_sym_info (ia64_info, h, NULL, NULL, false);
+ dyn_i = get_dyn_sym_info (ia64_info, h, NULL, NULL, FALSE);
if (dyn_i && dyn_i->want_plt2)
{
@@ -4079,8 +4276,32 @@ elfNN_ia64_relocate_section (output_bfd, info, input_bfd, input_section,
}
goto finish_pcrel;
+ case R_IA64_PCREL21BI:
+ case R_IA64_PCREL21F:
+ case R_IA64_PCREL21M:
case R_IA64_PCREL22:
case R_IA64_PCREL64I:
+ /* The PCREL21BI reloc is specifically not intended for use with
+ dynamic relocs. PCREL21F and PCREL21M are used for speculation
+ fixup code, and thus probably ought not be dynamic. The
+ PCREL22 and PCREL64I relocs aren't emitted as dynamic relocs. */
+ if (dynamic_symbol_p)
+ {
+ const char *msg;
+
+ if (r_type == R_IA64_PCREL21BI)
+ msg = _("%s: @internal branch to dynamic symbol %s");
+ else if (r_type == R_IA64_PCREL21F || r_type == R_IA64_PCREL21M)
+ msg = _("%s: speculation fixup to dynamic symbol %s");
+ else
+ msg = _("%s: @pcrel relocation against dynamic symbol %s");
+ (*_bfd_error_handler) (msg, bfd_archive_filename (input_bfd),
+ h->root.root.string);
+ ret_val = FALSE;
+ continue;
+ }
+ goto finish_pcrel;
+
finish_pcrel:
/* Make pc-relative. */
value -= (input_section->output_section->vma
@@ -4112,7 +4333,7 @@ elfNN_ia64_relocate_section (output_bfd, info, input_bfd, input_section,
{
int i;
for (i = m->count - 1; i >= 0; i--)
- if (m->sections[i] == sym_sec->output_section)
+ if (m->sections[i] == input_section->output_section)
break;
if (i >= 0)
break;
@@ -4158,7 +4379,7 @@ elfNN_ia64_relocate_section (output_bfd, info, input_bfd, input_section,
/* If we don't need dynamic symbol lookup, install two
RELATIVE relocations. */
- if (! dynamic_symbol_p)
+ if (!dynamic_symbol_p)
{
unsigned int dyn_r_type;
@@ -4201,6 +4422,8 @@ elfNN_ia64_relocate_section (output_bfd, info, input_bfd, input_section,
case R_IA64_DTPREL14:
case R_IA64_DTPREL22:
case R_IA64_DTPREL64I:
+ case R_IA64_DTPREL64LSB:
+ case R_IA64_DTPREL64MSB:
value -= elfNN_ia64_dtprel_base (info);
r = elfNN_ia64_install_value (output_bfd, hit_addr, value, r_type);
break;
@@ -4210,13 +4433,23 @@ elfNN_ia64_relocate_section (output_bfd, info, input_bfd, input_section,
case R_IA64_LTOFF_DTPREL22:
{
int got_r_type;
+ long dynindx = h ? h->dynindx : -1;
+ bfd_vma r_addend = rel->r_addend;
switch (r_type)
{
default:
case R_IA64_LTOFF_TPREL22:
- if (!dynamic_symbol_p && !info->shared)
- value -= elfNN_ia64_tprel_base (info);
+ if (!dynamic_symbol_p)
+ {
+ if (!info->shared)
+ value -= elfNN_ia64_tprel_base (info);
+ else
+ {
+ r_addend += value - elfNN_ia64_dtprel_base (info);
+ dynindx = 0;
+ }
+ }
got_r_type = R_IA64_TPREL64LSB;
break;
case R_IA64_LTOFF_DTPMOD22:
@@ -4230,9 +4463,8 @@ elfNN_ia64_relocate_section (output_bfd, info, input_bfd, input_section,
got_r_type = R_IA64_DTPREL64LSB;
break;
}
- dyn_i = get_dyn_sym_info (ia64_info, h, input_bfd, rel, false);
- value = set_got_entry (input_bfd, info, dyn_i,
- (h ? h->dynindx : -1), rel->r_addend,
+ 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,
@@ -4256,7 +4488,7 @@ elfNN_ia64_relocate_section (output_bfd, info, input_bfd, input_section,
don't try to continue. */
(*info->callbacks->undefined_symbol)
(info, "__gp", input_bfd, input_section, rel->r_offset, 1);
- return false;
+ return FALSE;
case bfd_reloc_notsupported:
{
@@ -4270,15 +4502,15 @@ elfNN_ia64_relocate_section (output_bfd, info, input_bfd, input_section,
symtab_hdr->sh_link,
sym->st_name);
if (name == NULL)
- return false;
+ return FALSE;
if (*name == '\0')
name = bfd_section_name (input_bfd, input_section);
}
if (!(*info->callbacks->warning) (info, _("unsupported reloc"),
name, input_bfd,
input_section, rel->r_offset))
- return false;
- ret_val = false;
+ return FALSE;
+ ret_val = FALSE;
}
break;
@@ -4297,7 +4529,7 @@ elfNN_ia64_relocate_section (output_bfd, info, input_bfd, input_section,
symtab_hdr->sh_link,
sym->st_name);
if (name == NULL)
- return false;
+ return FALSE;
if (*name == '\0')
name = bfd_section_name (input_bfd, input_section);
}
@@ -4307,8 +4539,8 @@ elfNN_ia64_relocate_section (output_bfd, info, input_bfd, input_section,
input_bfd,
input_section,
rel->r_offset))
- return false;
- ret_val = false;
+ return FALSE;
+ ret_val = FALSE;
}
break;
}
@@ -4317,7 +4549,7 @@ elfNN_ia64_relocate_section (output_bfd, info, input_bfd, input_section,
return ret_val;
}
-static boolean
+static bfd_boolean
elfNN_ia64_finish_dynamic_symbol (output_bfd, info, h, sym)
bfd *output_bfd;
struct bfd_link_info *info;
@@ -4328,7 +4560,7 @@ elfNN_ia64_finish_dynamic_symbol (output_bfd, info, h, sym)
struct elfNN_ia64_dyn_sym_info *dyn_i;
ia64_info = elfNN_ia64_hash_table (info);
- dyn_i = get_dyn_sym_info (ia64_info, h, NULL, NULL, false);
+ dyn_i = get_dyn_sym_info (ia64_info, h, NULL, NULL, FALSE);
/* Fill in the PLT data, if required. */
if (dyn_i && dyn_i->want_plt)
@@ -4337,7 +4569,6 @@ elfNN_ia64_finish_dynamic_symbol (output_bfd, info, h, sym)
bfd_byte *loc;
asection *plt_sec;
bfd_vma plt_addr, pltoff_addr, gp_val, index;
- ElfNN_External_Rela *rel;
gp_val = _bfd_get_gp_value (output_bfd);
@@ -4355,7 +4586,7 @@ elfNN_ia64_finish_dynamic_symbol (output_bfd, info, h, sym)
plt_addr = (plt_sec->output_section->vma
+ plt_sec->output_offset
+ dyn_i->plt_offset);
- pltoff_addr = set_pltoff_entry (output_bfd, info, dyn_i, plt_addr, true);
+ pltoff_addr = set_pltoff_entry (output_bfd, info, dyn_i, plt_addr, TRUE);
/* Initialize the FULL PLT entry, if needed. */
if (dyn_i->want_plt2)
@@ -4369,7 +4600,7 @@ elfNN_ia64_finish_dynamic_symbol (output_bfd, info, h, sym)
/* 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.h did some for us. */
+ first place. But perhaps elflink.c did some for us. */
if ((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0)
sym->st_shndx = SHN_UNDEF;
}
@@ -4394,10 +4625,10 @@ elfNN_ia64_finish_dynamic_symbol (output_bfd, info, h, sym)
existing sec->reloc_count to be the base of the array of
PLT relocations. */
- rel = (ElfNN_External_Rela *)ia64_info->rel_pltoff_sec->contents;
- rel += ia64_info->rel_pltoff_sec->reloc_count;
-
- bfd_elfNN_swap_reloca_out (output_bfd, &outrel, rel + index);
+ loc = ia64_info->rel_pltoff_sec->contents;
+ loc += ((ia64_info->rel_pltoff_sec->reloc_count + index)
+ * sizeof (ElfNN_External_Rela));
+ bfd_elfNN_swap_reloca_out (output_bfd, &outrel, loc);
}
/* Mark some specially defined symbols as absolute. */
@@ -4406,10 +4637,10 @@ elfNN_ia64_finish_dynamic_symbol (output_bfd, info, h, sym)
|| strcmp (h->root.root.string, "_PROCEDURE_LINKAGE_TABLE_") == 0)
sym->st_shndx = SHN_ABS;
- return true;
+ return TRUE;
}
-static boolean
+static bfd_boolean
elfNN_ia64_finish_dynamic_sections (abfd, info)
bfd *abfd;
struct bfd_link_info *info;
@@ -4475,7 +4706,7 @@ elfNN_ia64_finish_dynamic_sections (abfd, info)
bfd_elfNN_swap_dyn_out (abfd, &dyn, dyncon);
}
- /* Initialize the PLT0 entry */
+ /* Initialize the PLT0 entry. */
if (ia64_info->plt_sec)
{
bfd_byte *loc = ia64_info->plt_sec->contents;
@@ -4491,13 +4722,13 @@ elfNN_ia64_finish_dynamic_sections (abfd, info)
}
}
- return true;
+ return TRUE;
}
-/* ELF file flag handling: */
+/* ELF file flag handling: */
/* Function to keep IA-64 specific file flags. */
-static boolean
+static bfd_boolean
elfNN_ia64_set_private_flags (abfd, flags)
bfd *abfd;
flagword flags;
@@ -4506,31 +4737,31 @@ elfNN_ia64_set_private_flags (abfd, flags)
|| elf_elfheader (abfd)->e_flags == flags);
elf_elfheader (abfd)->e_flags = flags;
- elf_flags_init (abfd) = true;
- return true;
+ elf_flags_init (abfd) = TRUE;
+ return TRUE;
}
/* Merge backend specific data from an object file to the output
object file when linking. */
-static boolean
+static bfd_boolean
elfNN_ia64_merge_private_bfd_data (ibfd, obfd)
bfd *ibfd, *obfd;
{
flagword out_flags;
flagword in_flags;
- boolean ok = true;
+ bfd_boolean ok = TRUE;
/* Don't even pretend to support mixed-format linking. */
if (bfd_get_flavour (ibfd) != bfd_target_elf_flavour
|| bfd_get_flavour (obfd) != bfd_target_elf_flavour)
- return false;
+ return FALSE;
in_flags = elf_elfheader (ibfd)->e_flags;
out_flags = elf_elfheader (obfd)->e_flags;
if (! elf_flags_init (obfd))
{
- elf_flags_init (obfd) = true;
+ elf_flags_init (obfd) = TRUE;
elf_elfheader (obfd)->e_flags = in_flags;
if (bfd_get_arch (obfd) == bfd_get_arch (ibfd)
@@ -4540,12 +4771,12 @@ elfNN_ia64_merge_private_bfd_data (ibfd, obfd)
bfd_get_mach (ibfd));
}
- return true;
+ return TRUE;
}
/* Check flag compatibility. */
if (in_flags == out_flags)
- return true;
+ return TRUE;
/* Output has EF_IA_64_REDUCEDFP set only if all inputs have it set. */
if (!(in_flags & EF_IA_64_REDUCEDFP) && (out_flags & EF_IA_64_REDUCEDFP))
@@ -4558,7 +4789,7 @@ elfNN_ia64_merge_private_bfd_data (ibfd, obfd)
bfd_archive_filename (ibfd));
bfd_set_error (bfd_error_bad_value);
- ok = false;
+ ok = FALSE;
}
if ((in_flags & EF_IA_64_BE) != (out_flags & EF_IA_64_BE))
{
@@ -4567,7 +4798,7 @@ elfNN_ia64_merge_private_bfd_data (ibfd, obfd)
bfd_archive_filename (ibfd));
bfd_set_error (bfd_error_bad_value);
- ok = false;
+ ok = FALSE;
}
if ((in_flags & EF_IA_64_ABI64) != (out_flags & EF_IA_64_ABI64))
{
@@ -4576,7 +4807,7 @@ elfNN_ia64_merge_private_bfd_data (ibfd, obfd)
bfd_archive_filename (ibfd));
bfd_set_error (bfd_error_bad_value);
- ok = false;
+ ok = FALSE;
}
if ((in_flags & EF_IA_64_CONS_GP) != (out_flags & EF_IA_64_CONS_GP))
{
@@ -4585,7 +4816,7 @@ elfNN_ia64_merge_private_bfd_data (ibfd, obfd)
bfd_archive_filename (ibfd));
bfd_set_error (bfd_error_bad_value);
- ok = false;
+ ok = FALSE;
}
if ((in_flags & EF_IA_64_NOFUNCDESC_CONS_GP)
!= (out_flags & EF_IA_64_NOFUNCDESC_CONS_GP))
@@ -4595,13 +4826,13 @@ elfNN_ia64_merge_private_bfd_data (ibfd, obfd)
bfd_archive_filename (ibfd));
bfd_set_error (bfd_error_bad_value);
- ok = false;
+ ok = FALSE;
}
return ok;
}
-static boolean
+static bfd_boolean
elfNN_ia64_print_private_bfd_data (abfd, ptr)
bfd *abfd;
PTR ptr;
@@ -4622,7 +4853,7 @@ elfNN_ia64_print_private_bfd_data (abfd, ptr)
(flags & EF_IA_64_ABI64) ? "ABI64" : "ABI32");
_bfd_elf_print_private_bfd_data (abfd, ptr);
- return true;
+ return TRUE;
}
static enum elf_reloc_type_class
@@ -4646,7 +4877,14 @@ elfNN_ia64_reloc_type_class (rela)
}
}
-static boolean
+static struct bfd_elf_special_section const elfNN_ia64_special_sections[]=
+{
+ { ".sbss", 5, -1, SHT_NOBITS, SHF_ALLOC + SHF_WRITE + SHF_IA_64_SHORT },
+ { ".sdata", 6, -1, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE + SHF_IA_64_SHORT },
+ { NULL, 0, 0, 0, 0 }
+};
+
+static bfd_boolean
elfNN_ia64_hpux_vec (const bfd_target *vec)
{
extern const bfd_target bfd_elfNN_ia64_hpux_big_vec;
@@ -4664,7 +4902,7 @@ elfNN_hpux_post_process_headers (abfd, info)
i_ehdrp->e_ident[EI_ABIVERSION] = 1;
}
-boolean
+bfd_boolean
elfNN_hpux_backend_section_from_bfd_section (abfd, sec, retval)
bfd *abfd ATTRIBUTE_UNUSED;
asection *sec;
@@ -4673,10 +4911,27 @@ elfNN_hpux_backend_section_from_bfd_section (abfd, sec, retval)
if (bfd_is_com_section (sec))
{
*retval = SHN_IA_64_ANSI_COMMON;
- return true;
+ return TRUE;
+ }
+ return FALSE;
+}
+
+static void
+elfNN_hpux_backend_symbol_processing (bfd *abfd ATTRIBUTE_UNUSED,
+ asymbol *asym)
+{
+ elf_symbol_type *elfsym = (elf_symbol_type *) asym;;
+
+ switch (elfsym->internal_elf_sym.st_shndx)
+ {
+ case SHN_IA_64_ANSI_COMMON:
+ asym->section = bfd_com_section_ptr;
+ asym->value = elfsym->internal_elf_sym.st_size;
+ asym->flags &= ~BSF_GLOBAL;
+ break;
}
- return false;
}
+
#define TARGET_LITTLE_SYM bfd_elfNN_ia64_little_vec
#define TARGET_LITTLE_NAME "elfNN-ia64-little"
@@ -4715,6 +4970,8 @@ elfNN_hpux_backend_section_from_bfd_section (abfd, sec, retval)
/* Stuff for the BFD linker: */
#define bfd_elfNN_bfd_link_hash_table_create \
elfNN_ia64_hash_table_create
+#define bfd_elfNN_bfd_link_hash_table_free \
+ elfNN_ia64_hash_table_free
#define elf_backend_create_dynamic_sections \
elfNN_ia64_create_dynamic_sections
#define elf_backend_check_relocs \
@@ -4743,7 +5000,6 @@ elfNN_hpux_backend_section_from_bfd_section (abfd, sec, retval)
#define elf_backend_want_plt_sym 0
#define elf_backend_plt_alignment 5
#define elf_backend_got_header_size 0
-#define elf_backend_plt_header_size PLT_HEADER_SIZE
#define elf_backend_want_got_plt 1
#define elf_backend_may_use_rel_p 1
#define elf_backend_may_use_rela_p 1
@@ -4753,27 +5009,7 @@ elfNN_hpux_backend_section_from_bfd_section (abfd, sec, retval)
#define elf_backend_hide_symbol elfNN_ia64_hash_hide_symbol
#define elf_backend_reloc_type_class elfNN_ia64_reloc_type_class
#define elf_backend_rela_normal 1
-
-#include "elfNN-target.h"
-
-/* AIX-specific vectors. */
-
-#undef TARGET_LITTLE_SYM
-#define TARGET_LITTLE_SYM bfd_elfNN_ia64_aix_little_vec
-#undef TARGET_LITTLE_NAME
-#define TARGET_LITTLE_NAME "elfNN-ia64-aix-little"
-#undef TARGET_BIG_SYM
-#define TARGET_BIG_SYM bfd_elfNN_ia64_aix_big_vec
-#undef TARGET_BIG_NAME
-#define TARGET_BIG_NAME "elfNN-ia64-aix-big"
-
-#undef elf_backend_add_symbol_hook
-#define elf_backend_add_symbol_hook elfNN_ia64_aix_add_symbol_hook
-
-#undef bfd_elfNN_bfd_link_add_symbols
-#define bfd_elfNN_bfd_link_add_symbols elfNN_ia64_aix_link_add_symbols
-
-#define elfNN_bed elfNN_ia64_aix_bed
+#define elf_backend_special_sections elfNN_ia64_special_sections
#include "elfNN-target.h"
@@ -4786,14 +5022,6 @@ elfNN_hpux_backend_section_from_bfd_section (abfd, sec, retval)
#undef TARGET_BIG_NAME
#define TARGET_BIG_NAME "elfNN-ia64-hpux-big"
-/* We need to undo the AIX specific functions. */
-
-#undef elf_backend_add_symbol_hook
-#define elf_backend_add_symbol_hook elfNN_ia64_add_symbol_hook
-
-#undef bfd_elfNN_bfd_link_add_symbols
-#define bfd_elfNN_bfd_link_add_symbols _bfd_generic_link_add_symbols
-
/* These are HP-UX specific functions. */
#undef elf_backend_post_process_headers
@@ -4802,6 +5030,9 @@ elfNN_hpux_backend_section_from_bfd_section (abfd, sec, retval)
#undef elf_backend_section_from_bfd_section
#define elf_backend_section_from_bfd_section elfNN_hpux_backend_section_from_bfd_section
+#undef elf_backend_symbol_processing
+#define elf_backend_symbol_processing elfNN_hpux_backend_symbol_processing
+
#undef elf_backend_want_p_paddr_set_to_zero
#define elf_backend_want_p_paddr_set_to_zero 1
diff --git a/contrib/binutils/bfd/elfxx-target.h b/contrib/binutils/bfd/elfxx-target.h
index 5d7efb0..e250a97 100644
--- a/contrib/binutils/bfd/elfxx-target.h
+++ b/contrib/binutils/bfd/elfxx-target.h
@@ -1,22 +1,22 @@
/* Target definitions for NN-bit ELF
- Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
- Free Software Foundation, Inc.
+ Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+ 2003 Free Software Foundation, Inc.
-This file is part of BFD, the Binary File Descriptor library.
+ This 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
/* This structure contains everything that BFD knows about a target.
It includes things like its byte order, name, what routines to call
@@ -32,14 +32,18 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#define bfd_elfNN_get_section_contents _bfd_generic_get_section_contents
#endif
-#define bfd_elfNN_canonicalize_dynamic_symtab _bfd_elf_canonicalize_dynamic_symtab
+#define bfd_elfNN_canonicalize_dynamic_symtab \
+ _bfd_elf_canonicalize_dynamic_symtab
+#ifndef bfd_elfNN_canonicalize_reloc
#define bfd_elfNN_canonicalize_reloc _bfd_elf_canonicalize_reloc
+#endif
#ifndef bfd_elfNN_find_nearest_line
#define bfd_elfNN_find_nearest_line _bfd_elf_find_nearest_line
#endif
#define bfd_elfNN_read_minisymbols _bfd_elf_read_minisymbols
#define bfd_elfNN_minisymbol_to_symbol _bfd_elf_minisymbol_to_symbol
-#define bfd_elfNN_get_dynamic_symtab_upper_bound _bfd_elf_get_dynamic_symtab_upper_bound
+#define bfd_elfNN_get_dynamic_symtab_upper_bound \
+ _bfd_elf_get_dynamic_symtab_upper_bound
#define bfd_elfNN_get_lineno _bfd_elf_get_lineno
#ifndef bfd_elfNN_get_reloc_upper_bound
#define bfd_elfNN_get_reloc_upper_bound _bfd_elf_get_reloc_upper_bound
@@ -47,13 +51,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#ifndef bfd_elfNN_get_symbol_info
#define bfd_elfNN_get_symbol_info _bfd_elf_get_symbol_info
#endif
-#define bfd_elfNN_get_symtab _bfd_elf_get_symtab
+#define bfd_elfNN_canonicalize_symtab _bfd_elf_canonicalize_symtab
#define bfd_elfNN_get_symtab_upper_bound _bfd_elf_get_symtab_upper_bound
-#if 0 /* done in elf-bfd.h */
-#define bfd_elfNN_link_record_dynamic_symbol _bfd_elf_link_record_dynamic_symbol
-#endif
#define bfd_elfNN_make_empty_symbol _bfd_elf_make_empty_symbol
+#ifndef bfd_elfNN_new_section_hook
#define bfd_elfNN_new_section_hook _bfd_elf_new_section_hook
+#endif
#define bfd_elfNN_set_arch_mach _bfd_elf_set_arch_mach
#ifndef bfd_elfNN_set_section_contents
#define bfd_elfNN_set_section_contents _bfd_elf_set_section_contents
@@ -96,11 +99,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#define bfd_elfNN_bfd_debug_info_start bfd_void
#define bfd_elfNN_bfd_debug_info_end bfd_void
#define bfd_elfNN_bfd_debug_info_accumulate \
- (void (*) PARAMS ((bfd*, struct sec *))) bfd_void
+ ((void (*) (bfd*, struct bfd_section *)) bfd_void)
#ifndef bfd_elfNN_bfd_get_relocated_section_contents
#define bfd_elfNN_bfd_get_relocated_section_contents \
- bfd_generic_get_relocated_section_contents
+ bfd_generic_get_relocated_section_contents
#endif
#ifndef bfd_elfNN_bfd_relax_section
@@ -123,7 +126,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#define elf_backend_gc_sweep_hook NULL
#endif
#ifndef bfd_elfNN_bfd_gc_sections
-#define bfd_elfNN_bfd_gc_sections _bfd_elfNN_gc_sections
+#define bfd_elfNN_bfd_gc_sections bfd_elf_gc_sections
#endif
#ifndef bfd_elfNN_bfd_merge_sections
@@ -137,7 +140,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#ifndef bfd_elfNN_bfd_make_debug_symbol
#define bfd_elfNN_bfd_make_debug_symbol \
- ((asymbol *(*) PARAMS ((bfd *, void *, unsigned long))) bfd_nullvoidptr)
+ ((asymbol * (*) (bfd *, void *, unsigned long)) bfd_nullvoidptr)
#endif
#ifndef bfd_elfNN_bfd_copy_private_symbol_data
@@ -159,11 +162,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#endif
#ifndef bfd_elfNN_bfd_merge_private_bfd_data
#define bfd_elfNN_bfd_merge_private_bfd_data \
- ((boolean (*) PARAMS ((bfd *, bfd *))) bfd_true)
+ ((bfd_boolean (*) (bfd *, bfd *)) bfd_true)
#endif
#ifndef bfd_elfNN_bfd_set_private_flags
#define bfd_elfNN_bfd_set_private_flags \
- ((boolean (*) PARAMS ((bfd *, flagword))) bfd_true)
+ ((bfd_boolean (*) (bfd *, flagword)) bfd_true)
#endif
#ifndef bfd_elfNN_bfd_is_local_label_name
#define bfd_elfNN_bfd_is_local_label_name _bfd_elf_is_local_label_name
@@ -186,6 +189,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#ifndef bfd_elfNN_bfd_link_hash_table_create
#define bfd_elfNN_bfd_link_hash_table_create _bfd_elf_link_hash_table_create
#endif
+#ifndef bfd_elfNN_bfd_link_add_symbols
+#define bfd_elfNN_bfd_link_add_symbols bfd_elf_link_add_symbols
+#endif
+#ifndef bfd_elfNN_bfd_final_link
+#define bfd_elfNN_bfd_final_link bfd_elf_final_link
+#endif
#else /* ! defined (elf_backend_relocate_section) */
/* If no backend relocate_section routine, use the generic linker.
Note - this will prevent the port from being able to use some of
@@ -232,6 +241,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#define bfd_elfNN_mkarchive _bfd_generic_mkarchive
#endif
+#ifndef bfd_elfNN_print_symbol
+#define bfd_elfNN_print_symbol bfd_elf_print_symbol
+#endif
+
#ifndef elf_symbol_leading_char
#define elf_symbol_leading_char 0
#endif
@@ -250,10 +263,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#endif
#ifndef elf_backend_collect
-#define elf_backend_collect false
+#define elf_backend_collect FALSE
#endif
#ifndef elf_backend_type_change_ok
-#define elf_backend_type_change_ok false
+#define elf_backend_type_change_ok FALSE
#endif
#ifndef elf_backend_sym_is_global
@@ -271,6 +284,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#ifndef elf_backend_get_symbol_type
#define elf_backend_get_symbol_type 0
#endif
+#ifndef elf_backend_name_local_section_symbols
+#define elf_backend_name_local_section_symbols 0
+#endif
#ifndef elf_backend_section_processing
#define elf_backend_section_processing 0
#endif
@@ -334,12 +350,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#ifndef elf_backend_ecoff_debug_swap
#define elf_backend_ecoff_debug_swap 0
#endif
+#ifndef elf_backend_bfd_from_remote_memory
+#define elf_backend_bfd_from_remote_memory _bfd_elfNN_bfd_from_remote_memory
+#endif
#ifndef elf_backend_got_header_size
#define elf_backend_got_header_size 0
#endif
-#ifndef elf_backend_plt_header_size
-#define elf_backend_plt_header_size 0
-#endif
#ifndef elf_backend_post_process_headers
#define elf_backend_post_process_headers NULL
#endif
@@ -355,6 +371,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#ifndef elf_backend_hide_symbol
#define elf_backend_hide_symbol _bfd_elf_link_hash_hide_symbol
#endif
+#ifndef elf_backend_merge_symbol_attribute
+#define elf_backend_merge_symbol_attribute NULL
+#endif
#ifndef elf_backend_emit_relocs
#define elf_backend_emit_relocs NULL
#endif
@@ -382,6 +401,15 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#ifndef elf_backend_ignore_discarded_relocs
#define elf_backend_ignore_discarded_relocs NULL
#endif
+#ifndef elf_backend_can_make_relative_eh_frame
+#define elf_backend_can_make_relative_eh_frame _bfd_elf_can_make_relative
+#endif
+#ifndef elf_backend_can_make_lsda_relative_eh_frame
+#define elf_backend_can_make_lsda_relative_eh_frame _bfd_elf_can_make_relative
+#endif
+#ifndef elf_backend_encode_eh_address
+#define elf_backend_encode_eh_address _bfd_elf_encode_eh_address
+#endif
#ifndef elf_backend_write_section
#define elf_backend_write_section NULL
#endif
@@ -398,9 +426,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
For backwards compatibility, we still support this usage. */
#ifndef USE_REL
#define USE_REL 0
-#else
-#undef USE_REL
-#define USE_REL 1
#endif
/* Use these in new code. */
@@ -430,6 +455,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#define elf_backend_size_info _bfd_elfNN_size_info
#endif
+#ifndef elf_backend_special_sections
+#define elf_backend_special_sections NULL
+#endif
+
#ifndef elf_backend_sign_extend_vma
#define elf_backend_sign_extend_vma 0
#endif
@@ -449,6 +478,7 @@ static const struct elf_backend_data elfNN_bed =
elf_backend_symbol_processing,
elf_backend_symbol_table_processing,
elf_backend_get_symbol_type,
+ elf_backend_name_local_section_symbols,
elf_backend_section_processing,
elf_backend_section_from_shdr,
elf_backend_section_flags,
@@ -476,6 +506,7 @@ static const struct elf_backend_data elfNN_bed =
elf_backend_output_arch_syms,
elf_backend_copy_indirect_symbol,
elf_backend_hide_symbol,
+ elf_backend_merge_symbol_attribute,
elf_backend_emit_relocs,
elf_backend_count_relocs,
elf_backend_grok_prstatus,
@@ -485,16 +516,20 @@ static const struct elf_backend_data elfNN_bed =
elf_backend_reloc_type_class,
elf_backend_discard_info,
elf_backend_ignore_discarded_relocs,
+ elf_backend_can_make_relative_eh_frame,
+ elf_backend_can_make_lsda_relative_eh_frame,
+ elf_backend_encode_eh_address,
elf_backend_write_section,
elf_backend_mips_irix_compat,
elf_backend_mips_rtype_to_howto,
elf_backend_ecoff_debug_swap,
+ elf_backend_bfd_from_remote_memory,
ELF_MACHINE_ALT1,
ELF_MACHINE_ALT2,
&elf_backend_size_info,
+ elf_backend_special_sections,
elf_backend_got_symbol_offset,
elf_backend_got_header_size,
- elf_backend_plt_header_size,
elf_backend_collect,
elf_backend_type_change_ok,
elf_backend_may_use_rel_p,
@@ -590,19 +625,19 @@ const bfd_target TARGET_BIG_SYM =
bfd_elfNN_write_corefile_contents,
},
- BFD_JUMP_TABLE_GENERIC (bfd_elfNN),
- BFD_JUMP_TABLE_COPY (bfd_elfNN),
- BFD_JUMP_TABLE_CORE (bfd_elfNN),
+ BFD_JUMP_TABLE_GENERIC (bfd_elfNN),
+ BFD_JUMP_TABLE_COPY (bfd_elfNN),
+ BFD_JUMP_TABLE_CORE (bfd_elfNN),
#ifdef bfd_elfNN_archive_functions
- BFD_JUMP_TABLE_ARCHIVE (bfd_elfNN_archive),
+ BFD_JUMP_TABLE_ARCHIVE (bfd_elfNN_archive),
#else
- BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff),
+ BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff),
#endif
- BFD_JUMP_TABLE_SYMBOLS (bfd_elfNN),
- BFD_JUMP_TABLE_RELOCS (bfd_elfNN),
- BFD_JUMP_TABLE_WRITE (bfd_elfNN),
- BFD_JUMP_TABLE_LINK (bfd_elfNN),
- BFD_JUMP_TABLE_DYNAMIC (bfd_elfNN),
+ BFD_JUMP_TABLE_SYMBOLS (bfd_elfNN),
+ BFD_JUMP_TABLE_RELOCS (bfd_elfNN),
+ BFD_JUMP_TABLE_WRITE (bfd_elfNN),
+ BFD_JUMP_TABLE_LINK (bfd_elfNN),
+ BFD_JUMP_TABLE_DYNAMIC (bfd_elfNN),
/* Alternative endian target. */
#ifdef TARGET_LITTLE_SYM
@@ -612,7 +647,7 @@ const bfd_target TARGET_BIG_SYM =
#endif
/* backend_data: */
- (PTR) &elfNN_bed
+ &elfNN_bed
};
#endif
@@ -686,19 +721,19 @@ const bfd_target TARGET_LITTLE_SYM =
bfd_elfNN_write_corefile_contents,
},
- BFD_JUMP_TABLE_GENERIC (bfd_elfNN),
- BFD_JUMP_TABLE_COPY (bfd_elfNN),
- BFD_JUMP_TABLE_CORE (bfd_elfNN),
+ BFD_JUMP_TABLE_GENERIC (bfd_elfNN),
+ BFD_JUMP_TABLE_COPY (bfd_elfNN),
+ BFD_JUMP_TABLE_CORE (bfd_elfNN),
#ifdef bfd_elfNN_archive_functions
- BFD_JUMP_TABLE_ARCHIVE (bfd_elfNN_archive),
+ BFD_JUMP_TABLE_ARCHIVE (bfd_elfNN_archive),
#else
- BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff),
+ BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff),
#endif
- BFD_JUMP_TABLE_SYMBOLS (bfd_elfNN),
- BFD_JUMP_TABLE_RELOCS (bfd_elfNN),
- BFD_JUMP_TABLE_WRITE (bfd_elfNN),
- BFD_JUMP_TABLE_LINK (bfd_elfNN),
- BFD_JUMP_TABLE_DYNAMIC (bfd_elfNN),
+ BFD_JUMP_TABLE_SYMBOLS (bfd_elfNN),
+ BFD_JUMP_TABLE_RELOCS (bfd_elfNN),
+ BFD_JUMP_TABLE_WRITE (bfd_elfNN),
+ BFD_JUMP_TABLE_LINK (bfd_elfNN),
+ BFD_JUMP_TABLE_DYNAMIC (bfd_elfNN),
/* Alternative endian target. */
#ifdef TARGET_BIG_SYM
@@ -708,6 +743,6 @@ const bfd_target TARGET_LITTLE_SYM =
#endif
/* backend_data: */
- (PTR) &elfNN_bed
+ &elfNN_bed
};
#endif
diff --git a/contrib/binutils/bfd/format.c b/contrib/binutils/bfd/format.c
index ef6b46e..9d9ee86 100644
--- a/contrib/binutils/bfd/format.c
+++ b/contrib/binutils/bfd/format.c
@@ -1,23 +1,23 @@
/* Generic BFD support for file formats.
- Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1999, 2000, 2001, 2002
+ Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1999, 2000, 2001, 2002, 2003
Free Software Foundation, Inc.
Written by Cygnus Support.
-This file is part of BFD, the Binary File Descriptor library.
+ This 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
/*
SECTION
@@ -52,7 +52,7 @@ FUNCTION
bfd_check_format
SYNOPSIS
- boolean bfd_check_format(bfd *abfd, bfd_format format);
+ bfd_boolean bfd_check_format (bfd *abfd, bfd_format format);
DESCRIPTION
Verify if the file attached to the BFD @var{abfd} is compatible
@@ -67,7 +67,7 @@ DESCRIPTION
matches, it is used. If not, exactly one target must recognize
the file, or an error results.
- The function returns <<true>> on success, otherwise <<false>>
+ The function returns <<TRUE>> on success, otherwise <<FALSE>>
with one of the following error codes:
o <<bfd_error_invalid_operation>> -
@@ -85,10 +85,8 @@ DESCRIPTION
more than one backend recognised the file format.
*/
-boolean
-bfd_check_format (abfd, format)
- bfd *abfd;
- bfd_format format;
+bfd_boolean
+bfd_check_format (bfd *abfd, bfd_format format)
{
return bfd_check_format_matches (abfd, format, NULL);
}
@@ -98,10 +96,11 @@ FUNCTION
bfd_check_format_matches
SYNOPSIS
- boolean bfd_check_format_matches(bfd *abfd, bfd_format format, char ***matching);
+ bfd_boolean bfd_check_format_matches
+ (bfd *abfd, bfd_format format, char ***matching);
DESCRIPTION
- Like <<bfd_check_format>>, except when it returns false with
+ Like <<bfd_check_format>>, except when it returns FALSE with
<<bfd_errno>> set to <<bfd_error_file_ambiguously_recognized>>. In that
case, if @var{matching} is not NULL, it will be filled in with
a NULL-terminated list of the names of the formats that matched,
@@ -112,15 +111,13 @@ DESCRIPTION
should free it.
*/
-boolean
-bfd_check_format_matches (abfd, format, matching)
- bfd *abfd;
- bfd_format format;
- char ***matching;
+bfd_boolean
+bfd_check_format_matches (bfd *abfd, bfd_format format, char ***matching)
{
extern const bfd_target binary_vec;
- const bfd_target * const *target, *save_targ, *right_targ, *ar_right_targ;
- char **matching_vector = NULL;
+ const bfd_target * const *target;
+ const bfd_target **matching_vector = NULL;
+ const bfd_target *save_targ, *right_targ, *ar_right_targ;
int match_count;
int ar_match_index;
@@ -128,11 +125,11 @@ bfd_check_format_matches (abfd, format, matching)
|| (unsigned int) abfd->format >= (unsigned int) bfd_type_end)
{
bfd_set_error (bfd_error_invalid_operation);
- return false;
+ return FALSE;
}
if (abfd->format != bfd_unknown)
- return (boolean) (abfd->format == format);
+ return abfd->format == format;
/* Since the target type was defaulted, check them
all in the hope that one will be uniquely recognized. */
@@ -145,10 +142,10 @@ bfd_check_format_matches (abfd, format, matching)
bfd_size_type amt;
*matching = NULL;
- amt = sizeof (char *) * 2 * _bfd_target_vector_entries;
- matching_vector = (char **) bfd_malloc (amt);
+ amt = sizeof (*matching_vector) * 2 * _bfd_target_vector_entries;
+ matching_vector = bfd_malloc (amt);
if (!matching_vector)
- return false;
+ return FALSE;
}
right_targ = 0;
@@ -161,7 +158,11 @@ bfd_check_format_matches (abfd, format, matching)
if (!abfd->target_defaulted)
{
if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0) /* rewind! */
- return false;
+ {
+ if (matching)
+ free (matching_vector);
+ return FALSE;
+ }
right_targ = BFD_SEND_FMT (abfd, _bfd_check_format, (abfd));
@@ -172,7 +173,7 @@ bfd_check_format_matches (abfd, format, matching)
if (matching)
free (matching_vector);
- return true; /* File position has moved, BTW. */
+ return TRUE; /* File position has moved, BTW. */
}
/* For a long time the code has dropped through to check all
@@ -197,7 +198,7 @@ bfd_check_format_matches (abfd, format, matching)
bfd_set_error (bfd_error_file_not_recognized);
- return false;
+ return FALSE;
}
}
@@ -209,10 +210,14 @@ bfd_check_format_matches (abfd, format, matching)
if (*target == &binary_vec)
continue;
- abfd->xvec = *target; /* Change BFD's target temporarily */
+ abfd->xvec = *target; /* Change BFD's target temporarily. */
if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0)
- return false;
+ {
+ if (matching)
+ free (matching_vector);
+ return FALSE;
+ }
/* If _bfd_check_format neglects to set bfd_error, assume
bfd_error_wrong_format. We didn't used to even pay any
@@ -223,7 +228,8 @@ bfd_check_format_matches (abfd, format, matching)
temp = BFD_SEND_FMT (abfd, _bfd_check_format, (abfd));
if (temp)
- { /* This format checks out as ok! */
+ {
+ /* This format checks out as ok! */
right_targ = temp;
/* If this is the default target, accept it, even if other
@@ -236,7 +242,7 @@ bfd_check_format_matches (abfd, format, matching)
}
if (matching)
- matching_vector[match_count] = temp->name;
+ matching_vector[match_count] = temp;
match_count++;
@@ -259,7 +265,7 @@ bfd_check_format_matches (abfd, format, matching)
if (ar_right_targ != bfd_default_vector[0])
ar_right_targ = *target;
if (matching)
- matching_vector[ar_match_index] = (*target)->name;
+ matching_vector[ar_match_index] = *target;
ar_match_index++;
}
else if (err != bfd_error_wrong_format)
@@ -270,7 +276,7 @@ bfd_check_format_matches (abfd, format, matching)
if (matching)
free (matching_vector);
- return false;
+ return FALSE;
}
}
@@ -278,6 +284,7 @@ bfd_check_format_matches (abfd, format, matching)
{
/* Try partial matches. */
right_targ = ar_right_targ;
+
if (right_targ == bfd_default_vector[0])
{
match_count = 1;
@@ -285,11 +292,32 @@ bfd_check_format_matches (abfd, format, matching)
else
{
match_count = ar_match_index - _bfd_target_vector_entries;
+
if (matching && match_count > 1)
+ memcpy (matching_vector,
+ matching_vector + _bfd_target_vector_entries,
+ sizeof (*matching_vector) * match_count);
+ }
+ }
+
+ if (match_count > 1
+ && bfd_associated_vector != NULL
+ && matching)
+ {
+ const bfd_target * const *assoc = bfd_associated_vector;
+
+ while ((right_targ = *assoc++) != NULL)
+ {
+ int i = match_count;
+
+ while (--i >= 0)
+ if (matching_vector[i] == right_targ)
+ break;
+
+ if (i >= 0)
{
- memcpy (matching_vector,
- matching_vector + _bfd_target_vector_entries,
- sizeof (char *) * match_count);
+ match_count = 1;
+ break;
}
}
}
@@ -301,7 +329,7 @@ bfd_check_format_matches (abfd, format, matching)
if (matching)
free (matching_vector);
- return true; /* File position has moved, BTW. */
+ return TRUE; /* File position has moved, BTW. */
}
abfd->xvec = save_targ; /* Restore original target type. */
@@ -320,12 +348,19 @@ bfd_check_format_matches (abfd, format, matching)
if (matching)
{
- *matching = matching_vector;
+ *matching = (char **) matching_vector;
matching_vector[match_count] = NULL;
+ /* Return target names. This is a little nasty. Maybe we
+ should do another bfd_malloc? */
+ while (--match_count >= 0)
+ {
+ const char *name = matching_vector[match_count]->name;
+ *(const char **) &matching_vector[match_count] = name;
+ }
}
}
- return false;
+ return FALSE;
}
/*
@@ -333,7 +368,7 @@ FUNCTION
bfd_set_format
SYNOPSIS
- boolean bfd_set_format(bfd *abfd, bfd_format format);
+ bfd_boolean bfd_set_format (bfd *abfd, bfd_format format);
DESCRIPTION
This function sets the file format of the BFD @var{abfd} to the
@@ -342,20 +377,18 @@ DESCRIPTION
is not open for writing, then an error occurs.
*/
-boolean
-bfd_set_format (abfd, format)
- bfd *abfd;
- bfd_format format;
+bfd_boolean
+bfd_set_format (bfd *abfd, bfd_format format)
{
if (bfd_read_p (abfd)
|| (unsigned int) abfd->format >= (unsigned int) bfd_type_end)
{
bfd_set_error (bfd_error_invalid_operation);
- return false;
+ return FALSE;
}
if (abfd->format != bfd_unknown)
- return (boolean) (abfd->format == format);
+ return abfd->format == format;
/* Presume the answer is yes. */
abfd->format = format;
@@ -363,10 +396,10 @@ bfd_set_format (abfd, format)
if (!BFD_SEND_FMT (abfd, _bfd_set_format, (abfd)))
{
abfd->format = bfd_unknown;
- return false;
+ return FALSE;
}
- return true;
+ return TRUE;
}
/*
@@ -374,7 +407,7 @@ FUNCTION
bfd_format_string
SYNOPSIS
- const char *bfd_format_string(bfd_format format);
+ const char *bfd_format_string (bfd_format format);
DESCRIPTION
Return a pointer to a const string
@@ -383,17 +416,16 @@ DESCRIPTION
*/
const char *
-bfd_format_string (format)
- bfd_format format;
+bfd_format_string (bfd_format format)
{
- if (((int)format <(int) bfd_unknown)
- || ((int)format >=(int) bfd_type_end))
+ if (((int) format < (int) bfd_unknown)
+ || ((int) format >= (int) bfd_type_end))
return "invalid";
switch (format)
{
case bfd_object:
- return "object"; /* Linker/assember/compiler output. */
+ return "object"; /* Linker/assembler/compiler output. */
case bfd_archive:
return "archive"; /* Object archive file. */
case bfd_core:
diff --git a/contrib/binutils/bfd/freebsd.h b/contrib/binutils/bfd/freebsd.h
index c2e3af0..424484f 100644
--- a/contrib/binutils/bfd/freebsd.h
+++ b/contrib/binutils/bfd/freebsd.h
@@ -1,5 +1,5 @@
/* BFD back-end definitions used by all FreeBSD targets.
- Copyright 1990, 1991, 1992, 1996, 1997, 2000, 2001
+ Copyright 1990, 1991, 1992, 1996, 1997, 2000, 2001, 2002
Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@@ -61,7 +61,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define SWAP_MAGIC(ext) bfd_getl32 (ext)
#define MY_write_object_contents MY(write_object_contents)
-static boolean MY(write_object_contents) PARAMS ((bfd *abfd));
+static bfd_boolean MY(write_object_contents) PARAMS ((bfd *abfd));
#include "aout-target.h"
@@ -69,7 +69,7 @@ static boolean MY(write_object_contents) PARAMS ((bfd *abfd));
Section contents have already been written. We write the
file header, symbols, and relocation. */
-static boolean
+static bfd_boolean
MY(write_object_contents) (abfd)
bfd *abfd;
{
@@ -102,5 +102,5 @@ MY(write_object_contents) (abfd)
WRITE_HEADERS(abfd, execp);
- return true;
+ return TRUE;
}
diff --git a/contrib/binutils/bfd/gen-aout.c b/contrib/binutils/bfd/gen-aout.c
index b6720e8..ea207db 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
+ Copyright 1990, 1991, 1992, 1993, 1994, 1995, 2001, 2002
Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
diff --git a/contrib/binutils/bfd/genlink.h b/contrib/binutils/bfd/genlink.h
index 215666a..bcdc34b 100644
--- a/contrib/binutils/bfd/genlink.h
+++ b/contrib/binutils/bfd/genlink.h
@@ -1,5 +1,5 @@
/* genlink.h -- interface to the BFD generic linker
- Copyright 1993, 1994, 1996 Free Software Foundation, Inc.
+ Copyright 1993, 1994, 1996, 2002 Free Software Foundation, Inc.
Written by Ian Lance Taylor, Cygnus Support.
This file is part of BFD, the Binary File Descriptor library.
@@ -42,7 +42,7 @@ struct generic_link_hash_entry
{
struct bfd_link_hash_entry root;
/* Whether this symbol has been written out. */
- boolean written;
+ bfd_boolean written;
/* Symbol from input BFD. */
asymbol *sym;
};
@@ -54,18 +54,18 @@ struct generic_link_hash_table
struct bfd_link_hash_table root;
};
-/* Look up an entry in an generic link hash table. */
+/* Look up an entry in a generic link hash table. */
#define _bfd_generic_link_hash_lookup(table, string, create, copy, follow) \
((struct generic_link_hash_entry *) \
bfd_link_hash_lookup (&(table)->root, (string), (create), (copy), (follow)))
-/* Traverse an generic link hash table. */
+/* Traverse a generic link hash table. */
#define _bfd_generic_link_hash_traverse(table, func, info) \
(bfd_link_hash_traverse \
(&(table)->root, \
- (boolean (*) PARAMS ((struct bfd_link_hash_entry *, PTR))) (func), \
+ (bfd_boolean (*) PARAMS ((struct bfd_link_hash_entry *, PTR))) (func), \
(info)))
/* Get the generic link hash table from the info structure. This is
@@ -82,7 +82,7 @@ struct generic_link_hash_table
/* Add the symbols of input_bfd to the symbols being built for
output_bfd. */
-extern boolean _bfd_generic_link_output_symbols
+extern bfd_boolean _bfd_generic_link_output_symbols
PARAMS ((bfd *output_bfd, bfd *input_bfd, struct bfd_link_info *,
size_t *psymalloc));
@@ -100,7 +100,7 @@ struct generic_write_global_symbol_info
/* Write out a single global symbol. This is expected to be called
via _bfd_generic_link_hash_traverse. The second argument must
actually be a struct generic_write_global_symbol_info *. */
-extern boolean _bfd_generic_link_write_global_symbol
+extern bfd_boolean _bfd_generic_link_write_global_symbol
PARAMS ((struct generic_link_hash_entry *, PTR));
/* Generic link hash table entry creation routine. */
diff --git a/contrib/binutils/bfd/hash.c b/contrib/binutils/bfd/hash.c
index e7c77fe..58fa532 100644
--- a/contrib/binutils/bfd/hash.c
+++ b/contrib/binutils/bfd/hash.c
@@ -1,5 +1,5 @@
/* hash.c -- hash table routines for BFD
- Copyright 1993, 1994, 1995, 1997, 1999, 2001, 2002
+ Copyright 1993, 1994, 1995, 1997, 1999, 2001, 2002, 2003
Free Software Foundation, Inc.
Written by Steve Chamberlain <sac@cygnus.com>
@@ -67,7 +67,7 @@ SUBSECTION
<<bfd_hash_table_init>> (if you know approximately how many
entries you will need, the function <<bfd_hash_table_init_n>>,
which takes a @var{size} argument, may be used).
- <<bfd_hash_table_init>> returns <<false>> if some sort of
+ <<bfd_hash_table_init>> returns <<FALSE>> if some sort of
error occurs.
@findex bfd_hash_newfunc
@@ -96,24 +96,24 @@ SUBSECTION
The function <<bfd_hash_lookup>> is used both to look up a
string in the hash table and to create a new entry.
- If the @var{create} argument is <<false>>, <<bfd_hash_lookup>>
+ If the @var{create} argument is <<FALSE>>, <<bfd_hash_lookup>>
will look up a string. If the string is found, it will
returns a pointer to a <<struct bfd_hash_entry>>. If the
string is not found in the table <<bfd_hash_lookup>> will
return <<NULL>>. You should not modify any of the fields in
the returns <<struct bfd_hash_entry>>.
- If the @var{create} argument is <<true>>, the string will be
+ If the @var{create} argument is <<TRUE>>, the string will be
entered into the hash table if it is not already there.
Either way a pointer to a <<struct bfd_hash_entry>> will be
returned, either to the existing structure or to a newly
created one. In this case, a <<NULL>> return means that an
error occurred.
- If the @var{create} argument is <<true>>, and a new entry is
+ If the @var{create} argument is <<TRUE>>, and a new entry is
created, the @var{copy} argument is used to decide whether to
copy the string onto the hash table objalloc or not. If
- @var{copy} is passed as <<false>>, you must be careful not to
+ @var{copy} is passed as <<FALSE>>, you must be careful not to
deallocate or modify the string as long as the hash table
exists.
@@ -133,7 +133,7 @@ SUBSECTION
generic pointer passed to <<bfd_hash_traverse>>. The function
must return a <<boolean>> value, which indicates whether to
continue traversing the hash table. If the function returns
- <<false>>, <<bfd_hash_traverse>> will stop the traversal and
+ <<FALSE>>, <<bfd_hash_traverse>> will stop the traversal and
return immediately.
INODE
@@ -299,7 +299,7 @@ SUBSUBSECTION
/* Create a new hash table, given a number of entries. */
-boolean
+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 *,
@@ -315,24 +315,24 @@ bfd_hash_table_init_n (table, newfunc, size)
if (table->memory == NULL)
{
bfd_set_error (bfd_error_no_memory);
- return false;
+ return FALSE;
}
table->table = ((struct bfd_hash_entry **)
objalloc_alloc ((struct objalloc *) table->memory, alloc));
if (table->table == NULL)
{
bfd_set_error (bfd_error_no_memory);
- return false;
+ return FALSE;
}
memset ((PTR) table->table, 0, alloc);
table->size = size;
table->newfunc = newfunc;
- return true;
+ return TRUE;
}
/* Create a new hash table with the default number of entries. */
-boolean
+bfd_boolean
bfd_hash_table_init (table, newfunc)
struct bfd_hash_table *table;
struct bfd_hash_entry *(*newfunc) PARAMS ((struct bfd_hash_entry *,
@@ -358,8 +358,8 @@ struct bfd_hash_entry *
bfd_hash_lookup (table, string, create, copy)
struct bfd_hash_table *table;
const char *string;
- boolean create;
- boolean copy;
+ bfd_boolean create;
+ bfd_boolean copy;
{
register const unsigned char *s;
register unsigned long hash;
@@ -446,7 +446,6 @@ bfd_hash_replace (table, old, nw)
/* Base method for creating a new hash table entry. */
-/*ARGSUSED*/
struct bfd_hash_entry *
bfd_hash_newfunc (entry, table, string)
struct bfd_hash_entry *entry;
@@ -479,7 +478,7 @@ bfd_hash_allocate (table, size)
void
bfd_hash_traverse (table, func, info)
struct bfd_hash_table *table;
- boolean (*func) PARAMS ((struct bfd_hash_entry *, PTR));
+ bfd_boolean (*func) PARAMS ((struct bfd_hash_entry *, PTR));
PTR info;
{
unsigned int i;
@@ -532,7 +531,7 @@ struct bfd_strtab_hash
struct strtab_hash_entry *last;
/* Whether to precede strings with a two byte length, as in the
XCOFF .debug section. */
- boolean xcoff;
+ bfd_boolean xcoff;
};
static struct bfd_hash_entry *strtab_hash_newfunc
@@ -597,7 +596,7 @@ _bfd_stringtab_init ()
table->size = 0;
table->first = NULL;
table->last = NULL;
- table->xcoff = false;
+ table->xcoff = FALSE;
return table;
}
@@ -613,7 +612,7 @@ _bfd_xcoff_stringtab_init ()
ret = _bfd_stringtab_init ();
if (ret != NULL)
- ret->xcoff = true;
+ ret->xcoff = TRUE;
return ret;
}
@@ -628,21 +627,21 @@ _bfd_stringtab_free (table)
}
/* Get the index of a string in a strtab, adding it if it is not
- already present. If HASH is false, we don't really use the hash
+ already present. If HASH is FALSE, we don't really use the hash
table, and we don't eliminate duplicate strings. */
bfd_size_type
_bfd_stringtab_add (tab, str, hash, copy)
struct bfd_strtab_hash *tab;
const char *str;
- boolean hash;
- boolean copy;
+ bfd_boolean hash;
+ bfd_boolean copy;
{
register struct strtab_hash_entry *entry;
if (hash)
{
- entry = strtab_hash_lookup (tab, str, true, copy);
+ entry = strtab_hash_lookup (tab, str, TRUE, copy);
if (entry == NULL)
return (bfd_size_type) -1;
}
@@ -699,12 +698,12 @@ _bfd_stringtab_size (tab)
/* Write out a strtab. ABFD must already be at the right location in
the file. */
-boolean
+bfd_boolean
_bfd_stringtab_emit (abfd, tab)
register bfd *abfd;
struct bfd_strtab_hash *tab;
{
- register boolean xcoff;
+ register bfd_boolean xcoff;
register struct strtab_hash_entry *entry;
xcoff = tab->xcoff;
@@ -724,12 +723,12 @@ _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)
- return false;
+ return FALSE;
}
if (bfd_bwrite ((PTR) str, (bfd_size_type) len, abfd) != len)
- return false;
+ return FALSE;
}
- return true;
+ return TRUE;
}
diff --git a/contrib/binutils/bfd/i386aout.c b/contrib/binutils/bfd/i386aout.c
index c68dbec..6b2948e 100644
--- a/contrib/binutils/bfd/i386aout.c
+++ b/contrib/binutils/bfd/i386aout.c
@@ -1,5 +1,5 @@
/* BFD back-end for i386 a.out binaries.
- Copyright 1990, 1991, 1992, 1994, 1996, 1997, 2001
+ Copyright 1990, 1991, 1992, 1994, 1996, 1997, 2001, 2002, 2003
Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@@ -26,7 +26,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
system, and I'll stick it in for the next release. */
#define N_HEADER_IN_TEXT(x) 0
-#define BYTES_IN_WORD 4
#define N_TXTOFF(x) 0x20
#define N_TXTADDR(x) (N_MAGIC(x)==ZMAGIC ? 0x1020 : 0)
@@ -54,12 +53,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "aout/aout64.h"
#include "libaout.h"
-static boolean i386aout_write_object_contents PARAMS ((bfd *));
-static boolean MY (set_sizes) PARAMS ((bfd *));
+static bfd_boolean i386aout_write_object_contents PARAMS ((bfd *));
+static bfd_boolean MY (set_sizes) PARAMS ((bfd *));
/* Set the machine type correctly. */
-static boolean
+static bfd_boolean
i386aout_write_object_contents (abfd)
bfd *abfd;
{
@@ -72,7 +71,7 @@ i386aout_write_object_contents (abfd)
WRITE_HEADERS (abfd, execp);
- return true;
+ return TRUE;
}
#define MY_write_object_contents i386aout_write_object_contents
diff --git a/contrib/binutils/bfd/i386linux.c b/contrib/binutils/bfd/i386linux.c
index c144822..da36e75 100644
--- a/contrib/binutils/bfd/i386linux.c
+++ b/contrib/binutils/bfd/i386linux.c
@@ -1,5 +1,5 @@
/* BFD back-end for linux flavored i386 a.out binaries.
- Copyright 1992, 1993, 1994, 1995, 1996, 1997, 2001, 2002
+ Copyright 1992, 1993, 1994, 1995, 1996, 1997, 2001, 2002, 2003
Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@@ -23,7 +23,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#define SEGMENT_SIZE TARGET_PAGE_SIZE
#define TEXT_START_ADDR 0x0
#define N_SHARED_LIB(x) 0
-#define BYTES_IN_WORD 4
#define MACHTYPE_OK(mtype) ((mtype) == M_386 || (mtype) == M_UNKNOWN)
@@ -51,11 +50,11 @@ extern const bfd_target MY(vec);
static void MY_final_link_callback
PARAMS ((bfd *, file_ptr *, file_ptr *, file_ptr *));
-static boolean i386linux_bfd_final_link
+static bfd_boolean i386linux_bfd_final_link
PARAMS ((bfd *, struct bfd_link_info *));
-static boolean i386linux_write_object_contents PARAMS ((bfd *));
+static bfd_boolean i386linux_write_object_contents PARAMS ((bfd *));
-static boolean
+static bfd_boolean
i386linux_bfd_final_link (abfd, info)
bfd *abfd;
struct bfd_link_info *info;
@@ -68,7 +67,7 @@ i386linux_bfd_final_link (abfd, info)
/* Set the machine type correctly. */
-static boolean
+static bfd_boolean
i386linux_write_object_contents (abfd)
bfd *abfd;
{
@@ -81,7 +80,7 @@ i386linux_write_object_contents (abfd)
WRITE_HEADERS(abfd, execp);
- return true;
+ return TRUE;
}
#define MY_write_object_contents i386linux_write_object_contents
@@ -113,7 +112,7 @@ i386linux_write_object_contents (abfd)
#endif
/* This special symbol is a set vector that contains a list of
- pointers to fixup tables. It will be present in any dynamicly
+ pointers to fixup tables. It will be present in any dynamically
linked file. The linker generated fixup table should also be added
to the list, and it should always appear in the second slot (the
first one is a dummy with a magic number that is defined in
@@ -179,15 +178,15 @@ static struct bfd_link_hash_table *linux_link_hash_table_create
static struct fixup *new_fixup
PARAMS ((struct bfd_link_info *, struct linux_link_hash_entry *,
bfd_vma, int));
-static boolean linux_link_create_dynamic_sections
+static bfd_boolean linux_link_create_dynamic_sections
PARAMS ((bfd *, struct bfd_link_info *));
-static boolean linux_add_one_symbol
+static bfd_boolean linux_add_one_symbol
PARAMS ((struct bfd_link_info *, bfd *, const char *, flagword, asection *,
- bfd_vma, const char *, boolean, boolean,
+ bfd_vma, const char *, bfd_boolean, bfd_boolean,
struct bfd_link_hash_entry **));
-static boolean linux_tally_symbols
+static bfd_boolean linux_tally_symbols
PARAMS ((struct linux_link_hash_entry *, PTR));
-static boolean linux_finish_dynamic_link
+static bfd_boolean linux_finish_dynamic_link
PARAMS ((bfd *, struct bfd_link_info *));
/* Routine to create an entry in an Linux link hash table. */
@@ -259,7 +258,7 @@ linux_link_hash_table_create (abfd)
#define linux_link_hash_traverse(table, func, info) \
(aout_link_hash_traverse \
(&(table)->root, \
- (boolean (*) PARAMS ((struct aout_link_hash_entry *, PTR))) (func), \
+ (bfd_boolean (*) PARAMS ((struct aout_link_hash_entry *, PTR))) (func), \
(info)))
/* Get the Linux link hash table from the info structure. This is
@@ -299,7 +298,7 @@ new_fixup (info, h, value, builtin)
know the size of the section, but that's OK - we just need to
create it for now. */
-static boolean
+static bfd_boolean
linux_link_create_dynamic_sections (abfd, info)
bfd *abfd;
struct bfd_link_info *info ATTRIBUTE_UNUSED;
@@ -316,18 +315,18 @@ linux_link_create_dynamic_sections (abfd, info)
if (s == NULL
|| ! bfd_set_section_flags (abfd, s, flags)
|| ! bfd_set_section_alignment (abfd, s, 2))
- return false;
+ return FALSE;
s->_raw_size = 0;
s->contents = 0;
- return true;
+ return TRUE;
}
/* Function to add a single symbol to the linker hash table. This is
a wrapper around _bfd_generic_link_add_one_symbol which handles the
tweaking needed for dynamic linking support. */
-static boolean
+static bfd_boolean
linux_add_one_symbol (info, abfd, name, flags, section, value, string,
copy, collect, hashp)
struct bfd_link_info *info;
@@ -337,12 +336,12 @@ linux_add_one_symbol (info, abfd, name, flags, section, value, string,
asection *section;
bfd_vma value;
const char *string;
- boolean copy;
- boolean collect;
+ bfd_boolean copy;
+ bfd_boolean collect;
struct bfd_link_hash_entry **hashp;
{
struct linux_link_hash_entry *h;
- boolean insert;
+ bfd_boolean insert;
/* Look up and see if we already have this symbol in the hash table.
If we do, and the defining entry is from a shared library, we
@@ -352,25 +351,25 @@ linux_add_one_symbol (info, abfd, name, flags, section, value, string,
be able to link Linux a.out and ELF objects together, but serious
confusion is possible. */
- insert = false;
+ insert = FALSE;
- if (! info->relocateable
+ if (! info->relocatable
&& linux_hash_table (info)->dynobj == NULL
&& strcmp (name, SHARABLE_CONFLICTS) == 0
&& (flags & BSF_CONSTRUCTOR) != 0
&& abfd->xvec == info->hash->creator)
{
if (! linux_link_create_dynamic_sections (abfd, info))
- return false;
+ return FALSE;
linux_hash_table (info)->dynobj = abfd;
- insert = true;
+ insert = TRUE;
}
if (bfd_is_abs_section (section)
&& abfd->xvec == info->hash->creator)
{
- h = linux_link_hash_lookup (linux_hash_table (info), name, false,
- false, false);
+ h = linux_link_hash_lookup (linux_hash_table (info), name, FALSE,
+ FALSE, FALSE);
if (h != NULL
&& (h->root.root.type == bfd_link_hash_defined
|| h->root.root.type == bfd_link_hash_defweak))
@@ -382,10 +381,10 @@ linux_add_one_symbol (info, abfd, name, flags, section, value, string,
f = new_fixup (info, h, value, ! IS_PLT_SYM (name));
if (f == NULL)
- return false;
+ return FALSE;
f->jump = IS_PLT_SYM (name);
- return true;
+ return TRUE;
}
}
@@ -393,7 +392,7 @@ linux_add_one_symbol (info, abfd, name, flags, section, value, string,
if (! _bfd_generic_link_add_one_symbol (info, abfd, name, flags, section,
value, string, copy, collect,
hashp))
- return false;
+ return FALSE;
/* Insert a pointer to our table in the set vector. The dynamic
linker requires this information */
@@ -410,11 +409,11 @@ linux_add_one_symbol (info, abfd, name, flags, section, value, string,
if (! (_bfd_generic_link_add_one_symbol
(info, linux_hash_table (info)->dynobj, SHARABLE_CONFLICTS,
BSF_GLOBAL | BSF_CONSTRUCTOR, s, (bfd_vma) 0, NULL,
- false, false, NULL)))
- return false;
+ FALSE, FALSE, NULL)))
+ return FALSE;
}
- return true;
+ return TRUE;
}
/* We will crawl the hash table and come here for every global symbol.
@@ -427,7 +426,7 @@ linux_add_one_symbol (info, abfd, name, flags, section, value, string,
This function is called via linux_link_hash_traverse. */
-static boolean
+static bfd_boolean
linux_tally_symbols (h, data)
struct linux_link_hash_entry *h;
PTR data;
@@ -436,7 +435,7 @@ linux_tally_symbols (h, data)
struct fixup *f, *f1;
int is_plt;
struct linux_link_hash_entry *h1, *h2;
- boolean exists;
+ bfd_boolean exists;
if (h->root.root.type == bfd_link_hash_warning)
h = (struct linux_link_hash_entry *) h->root.root.u.i.link;
@@ -482,12 +481,12 @@ linux_tally_symbols (h, data)
h1 = linux_link_hash_lookup (linux_hash_table (info),
(h->root.root.root.string
+ sizeof PLT_REF_PREFIX - 1),
- false, false, true);
+ FALSE, FALSE, TRUE);
/* h2 does not follow indirect symbols. */
h2 = linux_link_hash_lookup (linux_hash_table (info),
(h->root.root.root.string
+ sizeof PLT_REF_PREFIX - 1),
- false, false, false);
+ FALSE, FALSE, FALSE);
/* The real symbol must exist but if it is also an ABS symbol,
there is no need to have a fixup. This is because they both
@@ -505,7 +504,7 @@ linux_tally_symbols (h, data)
involving this symbol. If so, convert it to a regular
fixup. In the end, this relaxes some of the requirements
about the order of performing fixups. */
- exists = false;
+ exists = FALSE;
for (f1 = linux_hash_table (info)->fixup_list;
f1 != NULL;
f1 = f1->next)
@@ -514,7 +513,7 @@ linux_tally_symbols (h, data)
|| (! f1->builtin && ! f1->jump))
continue;
if (f1->h == h1)
- exists = true;
+ exists = TRUE;
if (! exists
&& bfd_is_abs_section (h->root.root.u.def.section))
{
@@ -524,7 +523,7 @@ linux_tally_symbols (h, data)
f1->h = h1;
f1->jump = is_plt;
f1->builtin = 0;
- exists = true;
+ exists = TRUE;
}
if (! exists
&& bfd_is_abs_section (h->root.root.u.def.section))
@@ -542,10 +541,10 @@ linux_tally_symbols (h, data)
/* Quick and dirty way of stripping these symbols from the
symtab. */
if (bfd_is_abs_section (h->root.root.u.def.section))
- h->root.written = true;
+ h->root.written = TRUE;
}
- return true;
+ return TRUE;
}
/* This is called to set the size of the .linux-dynamic section is.
@@ -554,7 +553,7 @@ linux_tally_symbols (h, data)
we just scan the hash tables to find out how many additional fixups
are required. */
-boolean
+bfd_boolean
bfd_i386linux_size_dynamic_sections (output_bfd, info)
bfd *output_bfd;
struct bfd_link_info *info;
@@ -563,7 +562,7 @@ bfd_i386linux_size_dynamic_sections (output_bfd, info)
asection *s;
if (output_bfd->xvec != &MY(vec))
- return true;
+ return TRUE;
/* First find the fixups... */
linux_link_hash_traverse (linux_hash_table (info),
@@ -587,7 +586,7 @@ bfd_i386linux_size_dynamic_sections (output_bfd, info)
{
if (linux_hash_table (info)->fixup_count > 0)
abort ();
- return true;
+ return TRUE;
}
/* Allocate memory for our fixup table. We will fill it in later. */
@@ -599,17 +598,17 @@ bfd_i386linux_size_dynamic_sections (output_bfd, info)
s->_raw_size *= 8;
s->contents = (bfd_byte *) bfd_zalloc (output_bfd, s->_raw_size);
if (s->contents == NULL)
- return false;
+ return FALSE;
}
- return true;
+ return TRUE;
}
/* We come here once we are ready to actually write the fixup table to
the output file. Scan the fixup tables and so forth and generate
the stuff we need. */
-static boolean
+static bfd_boolean
linux_finish_dynamic_link (output_bfd, info)
bfd *output_bfd;
struct bfd_link_info *info;
@@ -623,7 +622,7 @@ linux_finish_dynamic_link (output_bfd, info)
unsigned int fixups_written;
if (linux_hash_table (info)->dynobj == NULL)
- return true;
+ return TRUE;
s = bfd_get_section_by_name (linux_hash_table (info)->dynobj,
".linux-dynamic");
@@ -739,7 +738,7 @@ linux_finish_dynamic_link (output_bfd, info)
h = linux_link_hash_lookup (linux_hash_table (info),
"__BUILTIN_FIXUPS__",
- false, false, false);
+ FALSE, FALSE, FALSE);
if (h != NULL
&& (h->root.root.type == bfd_link_hash_defined
@@ -760,12 +759,12 @@ linux_finish_dynamic_link (output_bfd, info)
if (bfd_seek (output_bfd, (file_ptr) (os->filepos + s->output_offset),
SEEK_SET) != 0)
- return false;
+ return FALSE;
if (bfd_bwrite ((PTR) s->contents, s->_raw_size, output_bfd) != s->_raw_size)
- return false;
+ return FALSE;
- return true;
+ return TRUE;
}
#define MY_bfd_link_hash_table_create linux_link_hash_table_create
diff --git a/contrib/binutils/bfd/ieee.c b/contrib/binutils/bfd/ieee.c
index d1c5eb1..8a08028 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
+ 2000, 2001, 2002, 2003
Free Software Foundation, Inc.
Written by Steve Chamberlain of Cygnus Support.
@@ -40,93 +40,151 @@ struct output_buffer_struct
int buffer;
};
-static boolean ieee_write_byte PARAMS ((bfd *, int));
-static boolean ieee_write_2bytes PARAMS ((bfd *, int));
-static boolean ieee_write_int PARAMS ((bfd *, bfd_vma));
-static 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 boolean ieee_write_expression
- PARAMS ((bfd *, bfd_vma, asymbol *, boolean, unsigned int));
-static void ieee_write_int5 PARAMS ((bfd_byte *, bfd_vma));
-static boolean ieee_write_int5_out PARAMS ((bfd *, bfd_vma));
-static boolean parse_int PARAMS ((common_header_type *, bfd_vma *));
-static int parse_i PARAMS ((common_header_type *, boolean *));
-static bfd_vma must_parse_int PARAMS ((common_header_type *));
+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 *,
- boolean *, unsigned int *, asection **));
-static file_ptr ieee_part_after PARAMS ((ieee_data_type *, file_ptr));
+ 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 boolean ieee_slurp_external_symbols PARAMS ((bfd *));
-static boolean ieee_slurp_symbol_table PARAMS ((bfd *));
-static long ieee_get_symtab_upper_bound PARAMS ((bfd *));
-static long ieee_get_symtab PARAMS ((bfd *, asymbol **));
+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 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_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 boolean do_one
+static bfd_boolean do_one
PARAMS ((ieee_data_type *, ieee_per_section_type *, unsigned char *,
asection *, int));
-static boolean ieee_slurp_section_data PARAMS ((bfd *));
-static boolean ieee_new_section_hook PARAMS ((bfd *, asection *));
-static long ieee_get_reloc_upper_bound PARAMS ((bfd *, sec_ptr));
-static boolean ieee_get_section_contents
+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 boolean ieee_write_section_part PARAMS ((bfd *));
-static boolean do_with_relocs PARAMS ((bfd *, asection *));
-static boolean do_as_repeat PARAMS ((bfd *, asection *));
-static boolean do_without_relocs PARAMS ((bfd *, asection *));
-static 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 boolean ieee_write_debug_part PARAMS ((bfd *));
-static boolean ieee_write_data_part PARAMS ((bfd *));
-static boolean init_for_output PARAMS ((bfd *));
-static boolean ieee_set_section_contents
- PARAMS ((bfd *, sec_ptr, PTR, file_ptr, bfd_size_type));
-static boolean ieee_write_external_part PARAMS ((bfd *));
-static boolean ieee_write_me_part PARAMS ((bfd *));
-static boolean ieee_write_processor PARAMS ((bfd *));
-static 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 boolean ieee_find_nearest_line
+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 *, boolean));
+static int ieee_generic_stat_arch_elt
+ PARAMS ((bfd *, struct stat *));
+static int ieee_sizeof_headers
+ PARAMS ((bfd *, bfd_boolean));
/* Functions for writing to ieee files in the strange way that the
standard requires. */
-static boolean
+static bfd_boolean
ieee_write_byte (abfd, barg)
bfd *abfd;
int barg;
@@ -135,11 +193,11 @@ ieee_write_byte (abfd, barg)
byte = barg;
if (bfd_bwrite ((PTR) &byte, (bfd_size_type) 1, abfd) != 1)
- return false;
- return true;
+ return FALSE;
+ return TRUE;
}
-static boolean
+static bfd_boolean
ieee_write_2bytes (abfd, bytes)
bfd *abfd;
int bytes;
@@ -149,11 +207,11 @@ ieee_write_2bytes (abfd, bytes)
buffer[0] = bytes >> 8;
buffer[1] = bytes & 0xff;
if (bfd_bwrite ((PTR) buffer, (bfd_size_type) 2, abfd) != 2)
- return false;
- return true;
+ return FALSE;
+ return TRUE;
}
-static boolean
+static bfd_boolean
ieee_write_int (abfd, value)
bfd *abfd;
bfd_vma value;
@@ -161,14 +219,14 @@ ieee_write_int (abfd, value)
if (value <= 127)
{
if (! ieee_write_byte (abfd, (bfd_byte) value))
- return false;
+ return FALSE;
}
else
{
unsigned int length;
- /* How many significant bytes ? */
- /* FIXME FOR LONGER INTS */
+ /* How many significant bytes ? */
+ /* FIXME FOR LONGER INTS. */
if (value & 0xff000000)
length = 4;
else if (value & 0x00ff0000)
@@ -181,31 +239,31 @@ ieee_write_int (abfd, value)
if (! ieee_write_byte (abfd,
(bfd_byte) ((int) ieee_number_repeat_start_enum
+ length)))
- return false;
+ return FALSE;
switch (length)
{
case 4:
if (! ieee_write_byte (abfd, (bfd_byte) (value >> 24)))
- return false;
+ return FALSE;
/* Fall through. */
case 3:
if (! ieee_write_byte (abfd, (bfd_byte) (value >> 16)))
- return false;
+ return FALSE;
/* Fall through. */
case 2:
if (! ieee_write_byte (abfd, (bfd_byte) (value >> 8)))
- return false;
+ return FALSE;
/* Fall through. */
case 1:
if (! ieee_write_byte (abfd, (bfd_byte) (value)))
- return false;
+ return FALSE;
}
}
- return true;
+ return TRUE;
}
-static boolean
+static bfd_boolean
ieee_write_id (abfd, id)
bfd *abfd;
const char *id;
@@ -215,19 +273,19 @@ ieee_write_id (abfd, id)
if (length <= 127)
{
if (! ieee_write_byte (abfd, (bfd_byte) length))
- return false;
+ return FALSE;
}
else if (length < 255)
{
if (! ieee_write_byte (abfd, ieee_extension_length_1_enum)
|| ! ieee_write_byte (abfd, (bfd_byte) length))
- return false;
+ return FALSE;
}
else if (length < 65535)
{
if (! ieee_write_byte (abfd, ieee_extension_length_2_enum)
|| ! ieee_write_2bytes (abfd, (int) length))
- return false;
+ return FALSE;
}
else
{
@@ -235,18 +293,16 @@ ieee_write_id (abfd, id)
(_("%s: string too long (%d chars, max 65535)"),
bfd_get_filename (abfd), length);
bfd_set_error (bfd_error_invalid_operation);
- return false;
+ return FALSE;
}
if (bfd_bwrite ((PTR) id, (bfd_size_type) length, abfd) != length)
- return false;
- return true;
+ return FALSE;
+ return TRUE;
}
-/***************************************************************************
-Functions for reading from ieee files in the strange way that the
-standard requires:
-*/
+/* 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++)
@@ -258,6 +314,7 @@ read_2bytes (ieee)
{
unsigned char c1 = this_byte_and_next (ieee);
unsigned char c2 = this_byte_and_next (ieee);
+
return (c1 << 8) | c2;
}
@@ -268,10 +325,9 @@ bfd_get_string (ieee, string, length)
size_t length;
{
size_t i;
+
for (i = 0; i < length; i++)
- {
- string[i] = this_byte_and_next (ieee);
- }
+ string[i] = this_byte_and_next (ieee);
}
static char *
@@ -280,23 +336,25 @@ read_id (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 is next byte, allowing 0..255. */
length = this_byte_and_next (ieee);
}
else if (length == 0xdf)
{
- /* Length is next two bytes, allowing 0..65535 */
+ /* Length is next two bytes, allowing 0..65535. */
length = this_byte_and_next (ieee);
length = (length * 256) + this_byte_and_next (ieee);
}
- /* Buy memory and read string */
+
+ /* Buy memory and read string. */
string = bfd_alloc (ieee->abfd, (bfd_size_type) length + 1);
if (!string)
return NULL;
@@ -305,12 +363,12 @@ read_id (ieee)
return string;
}
-static boolean
+static bfd_boolean
ieee_write_expression (abfd, value, symbol, pcrel, index)
bfd *abfd;
bfd_vma value;
asymbol *symbol;
- boolean pcrel;
+ bfd_boolean pcrel;
unsigned int index;
{
unsigned int term_count = 0;
@@ -318,90 +376,91 @@ ieee_write_expression (abfd, value, symbol, pcrel, index)
if (value != 0)
{
if (! ieee_write_int (abfd, value))
- return false;
+ return FALSE;
term_count++;
}
- if (bfd_is_com_section (symbol->section)
- || bfd_is_und_section (symbol->section))
- {
- /* Def of a common symbol */
- if (! ieee_write_byte (abfd, ieee_variable_X_enum)
- || ! ieee_write_int (abfd, symbol->value))
- return false;
- term_count++;
- }
- else if (! bfd_is_abs_section (symbol->section))
+ /* Badly formatted binaries can have a missing symbol,
+ so test here to prevent a seg fault. */
+ if (symbol != NULL)
{
- /* Ref to defined symbol - */
-
- if (symbol->flags & BSF_GLOBAL)
+ if (bfd_is_com_section (symbol->section)
+ || bfd_is_und_section (symbol->section))
{
- if (! ieee_write_byte (abfd, ieee_variable_I_enum)
+ /* Def of a common symbol. */
+ if (! ieee_write_byte (abfd, ieee_variable_X_enum)
|| ! ieee_write_int (abfd, symbol->value))
- return false;
- term_count++;
+ return FALSE;
+ term_count ++;
}
- else if (symbol->flags & (BSF_LOCAL | BSF_SECTION_SYM))
+ else if (! bfd_is_abs_section (symbol->section))
{
- /* This is a reference to a defined local symbol. We can
- easily do a local as a section+offset. */
- if (! ieee_write_byte (abfd, ieee_variable_R_enum)
- || ! ieee_write_byte (abfd,
- (bfd_byte) (symbol->section->index
- + IEEE_SECTION_NUMBER_BASE)))
- return false;
- term_count++;
- if (symbol->value != 0)
+ /* Ref to defined symbol - */
+
+ if (symbol->flags & BSF_GLOBAL)
{
- if (! ieee_write_int (abfd, symbol->value))
- return false;
+ if (! ieee_write_byte (abfd, ieee_variable_I_enum)
+ || ! ieee_write_int (abfd, symbol->value))
+ return FALSE;
term_count++;
}
- }
- else
- {
- (*_bfd_error_handler)
- (_("%s: unrecognized symbol `%s' flags 0x%x"),
- bfd_get_filename (abfd), bfd_asymbol_name (symbol),
- symbol->flags);
- bfd_set_error (bfd_error_invalid_operation);
- return false;
+ else if (symbol->flags & (BSF_LOCAL | BSF_SECTION_SYM))
+ {
+ /* This is a reference to a defined local symbol. We can
+ easily do a local as a section+offset. */
+ if (! ieee_write_byte (abfd, ieee_variable_R_enum)
+ || ! ieee_write_byte (abfd,
+ (bfd_byte) (symbol->section->index
+ + IEEE_SECTION_NUMBER_BASE)))
+ return FALSE;
+
+ term_count++;
+ if (symbol->value != 0)
+ {
+ if (! ieee_write_int (abfd, symbol->value))
+ return FALSE;
+ term_count++;
+ }
+ }
+ else
+ {
+ (*_bfd_error_handler)
+ (_("%s: unrecognized symbol `%s' flags 0x%x"),
+ bfd_get_filename (abfd), bfd_asymbol_name (symbol),
+ symbol->flags);
+ bfd_set_error (bfd_error_invalid_operation);
+ return FALSE;
+ }
}
}
if (pcrel)
{
- /* subtract the pc from here by asking for PC of this section*/
+ /* Subtract the pc from here by asking for PC of this section. */
if (! ieee_write_byte (abfd, ieee_variable_P_enum)
|| ! ieee_write_byte (abfd,
(bfd_byte) (index + IEEE_SECTION_NUMBER_BASE))
|| ! ieee_write_byte (abfd, ieee_function_minus_enum))
- return false;
+ return FALSE;
}
/* Handle the degenerate case of a 0 address. */
if (term_count == 0)
- {
- if (! ieee_write_int (abfd, (bfd_vma) 0))
- return false;
- }
+ if (! ieee_write_int (abfd, (bfd_vma) 0))
+ return FALSE;
while (term_count > 1)
{
if (! ieee_write_byte (abfd, ieee_function_plus_enum))
- return false;
+ return FALSE;
term_count--;
}
- return true;
+ return TRUE;
}
-/*****************************************************************************/
+/* Writes any integer into the buffer supplied and always takes 5 bytes. */
-/*
-writes any integer into the buffer supplied and always takes 5 bytes
-*/
static void
ieee_write_int5 (buffer, value)
bfd_byte *buffer;
@@ -414,7 +473,7 @@ ieee_write_int5 (buffer, value)
buffer[4] = (value >> 0) & 0xff;
}
-static boolean
+static bfd_boolean
ieee_write_int5_out (abfd, value)
bfd *abfd;
bfd_vma value;
@@ -423,26 +482,28 @@ ieee_write_int5_out (abfd, value)
ieee_write_int5 (b, value);
if (bfd_bwrite ((PTR) b, (bfd_size_type) 5, abfd) != 5)
- return false;
- return true;
+ return FALSE;
+ return TRUE;
}
-static boolean
+static bfd_boolean
parse_int (ieee, value_ptr)
common_header_type *ieee;
bfd_vma *value_ptr;
{
int value = this_byte (ieee);
int result;
+
if (value >= 0 && value <= 127)
{
*value_ptr = value;
next_byte (ieee);
- return true;
+ return TRUE;
}
else if (value >= 0x80 && value <= 0x88)
{
unsigned int count = value & 0xf;
+
result = 0;
next_byte (ieee);
while (count)
@@ -451,15 +512,15 @@ parse_int (ieee, value_ptr)
count--;
}
*value_ptr = result;
- return true;
+ return TRUE;
}
- return false;
+ return FALSE;
}
static int
parse_i (ieee, ok)
common_header_type *ieee;
- boolean *ok;
+ bfd_boolean *ok;
{
bfd_vma x;
*ok = parse_int (ieee, &x);
@@ -486,12 +547,12 @@ typedef struct
#if KEEPMINUSPCININST
#define SRC_MASK(arg) arg
-#define PCREL_OFFSET false
+#define PCREL_OFFSET FALSE
#else
#define SRC_MASK(arg) 0
-#define PCREL_OFFSET true
+#define PCREL_OFFSET TRUE
#endif
@@ -500,57 +561,57 @@ static reloc_howto_type abs32_howto =
0,
2,
32,
- false,
+ FALSE,
0,
complain_overflow_bitfield,
0,
"abs32",
- true,
+ TRUE,
0xffffffff,
0xffffffff,
- false);
+ FALSE);
static reloc_howto_type abs16_howto =
HOWTO (1,
0,
1,
16,
- false,
+ FALSE,
0,
complain_overflow_bitfield,
0,
"abs16",
- true,
+ TRUE,
0x0000ffff,
0x0000ffff,
- false);
+ FALSE);
static reloc_howto_type abs8_howto =
HOWTO (1,
0,
0,
8,
- false,
+ FALSE,
0,
complain_overflow_bitfield,
0,
"abs8",
- true,
+ TRUE,
0x000000ff,
0x000000ff,
- false);
+ FALSE);
static reloc_howto_type rel32_howto =
HOWTO (1,
0,
2,
32,
- true,
+ TRUE,
0,
complain_overflow_signed,
0,
"rel32",
- true,
+ TRUE,
SRC_MASK (0xffffffff),
0xffffffff,
PCREL_OFFSET);
@@ -560,12 +621,12 @@ static reloc_howto_type rel16_howto =
0,
1,
16,
- true,
+ TRUE,
0,
complain_overflow_signed,
0,
"rel16",
- true,
+ TRUE,
SRC_MASK (0x0000ffff),
0x0000ffff,
PCREL_OFFSET);
@@ -575,12 +636,12 @@ static reloc_howto_type rel8_howto =
0,
0,
8,
- true,
+ TRUE,
0,
complain_overflow_signed,
0,
"rel8",
- true,
+ TRUE,
SRC_MASK (0x000000ff),
0x000000ff,
PCREL_OFFSET);
@@ -592,7 +653,7 @@ parse_expression (ieee, value, symbol, pcrel, extra, section)
ieee_data_type *ieee;
bfd_vma *value;
ieee_symbol_index_type *symbol;
- boolean *pcrel;
+ bfd_boolean *pcrel;
unsigned int *extra;
asection **section;
@@ -603,10 +664,10 @@ parse_expression (ieee, value, symbol, pcrel, extra, section)
#define INC sp++;
#define DEC sp--;
- boolean loop = true;
+ bfd_boolean loop = TRUE;
ieee_value_type stack[10];
- /* The stack pointer always points to the next unused location */
+ /* 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;
@@ -617,35 +678,36 @@ parse_expression (ieee, value, symbol, pcrel, extra, section)
switch (this_byte (&(ieee->h)))
{
case ieee_variable_P_enum:
- /* P variable, current program counter for section n */
+ /* P variable, current program counter for section n. */
{
int section_n;
+
next_byte (&(ieee->h));
- *pcrel = true;
+ *pcrel = TRUE;
section_n = must_parse_int (&(ieee->h));
PUSH (NOSYMBOL, bfd_abs_section_ptr, 0);
break;
}
case ieee_variable_L_enum:
- /* L variable address of section N */
+ /* L variable address of section N. */
next_byte (&(ieee->h));
PUSH (NOSYMBOL, ieee->section_table[must_parse_int (&(ieee->h))], 0);
break;
case ieee_variable_R_enum:
- /* R variable, logical address of section module */
- /* FIXME, this should be different to L */
+ /* R variable, logical address of section module. */
+ /* FIXME, this should be different to L. */
next_byte (&(ieee->h));
PUSH (NOSYMBOL, ieee->section_table[must_parse_int (&(ieee->h))], 0);
break;
case ieee_variable_S_enum:
- /* S variable, size in MAUS of section module */
+ /* S variable, size in MAUS of section module. */
next_byte (&(ieee->h));
PUSH (NOSYMBOL,
0,
ieee->section_table[must_parse_int (&(ieee->h))]->_raw_size);
break;
case ieee_variable_I_enum:
- /* Push the address of variable n */
+ /* Push the address of variable n. */
{
ieee_symbol_index_type sy;
next_byte (&(ieee->h));
@@ -656,7 +718,7 @@ parse_expression (ieee, value, symbol, pcrel, extra, section)
}
break;
case ieee_variable_X_enum:
- /* Push the address of external variable n */
+ /* Push the address of external variable n. */
{
ieee_symbol_index_type sy;
next_byte (&(ieee->h));
@@ -706,7 +768,7 @@ parse_expression (ieee, value, symbol, pcrel, extra, section)
else
{
/* Thats all that we can understand. */
- loop = false;
+ loop = FALSE;
}
}
}
@@ -718,7 +780,6 @@ parse_expression (ieee, value, symbol, pcrel, extra, section)
terms. We can tell if that's the case by ensuring that
sp == stack here. If not, then we've pushed something too far,
so we keep adding. */
-
while (sp != stack + 1)
{
asection *section1;
@@ -764,7 +825,7 @@ ieee_part_after (ieee, here)
}
static unsigned int last_index;
-static char last_type; /* is the index for an X or a D */
+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)
@@ -776,8 +837,9 @@ get_symbol (abfd, ieee, last_symbol, symbol_count, pptr, max_index, this_type)
unsigned int *max_index;
int this_type;
{
- /* Need a new symbol */
+ /* Need a new symbol. */
unsigned int new_index = must_parse_int (&(ieee->h));
+
if (new_index != last_index || this_type != last_type)
{
ieee_symbol_type *new_symbol;
@@ -793,9 +855,8 @@ get_symbol (abfd, ieee, last_symbol, symbol_count, pptr, max_index, this_type)
**pptr = new_symbol;
*pptr = &new_symbol->next;
if (new_index > *max_index)
- {
- *max_index = new_index;
- }
+ *max_index = new_index;
+
last_type = this_type;
new_symbol->symbol.section = bfd_abs_section_ptr;
return new_symbol;
@@ -803,7 +864,7 @@ get_symbol (abfd, ieee, last_symbol, symbol_count, pptr, max_index, this_type)
return last_symbol;
}
-static boolean
+static bfd_boolean
ieee_slurp_external_symbols (abfd)
bfd *abfd;
{
@@ -814,9 +875,9 @@ ieee_slurp_external_symbols (abfd)
ieee_symbol_type **prev_reference_ptr = &ieee->external_reference;
ieee_symbol_type *symbol = (ieee_symbol_type *) NULL;
unsigned int symbol_count = 0;
- boolean loop = true;
+ bfd_boolean loop = TRUE;
last_index = 0xffffff;
- ieee->symbol_table_full = true;
+ ieee->symbol_table_full = TRUE;
ieee_seek (ieee, offset);
@@ -831,7 +892,7 @@ ieee_slurp_external_symbols (abfd)
&prev_symbols_ptr,
&ieee->external_symbol_max_index, 'I');
if (symbol == NULL)
- return false;
+ return FALSE;
symbol->symbol.the_bfd = abfd;
symbol->symbol.name = read_id (&(ieee->h));
@@ -845,7 +906,7 @@ ieee_slurp_external_symbols (abfd)
&prev_symbols_ptr,
&ieee->external_symbol_max_index, 'D');
if (symbol == NULL)
- return false;
+ return FALSE;
BFD_ASSERT (symbol->index >= ieee->external_symbol_min_index);
@@ -878,12 +939,12 @@ ieee_slurp_external_symbols (abfd)
bfd_archive_filename (abfd), symbol_attribute_def,
symbol_name_index);
bfd_set_error (bfd_error_bad_value);
- return false;
+ return FALSE;
break;
}
break;
case ieee_external_reference_info_record_enum:
- /* Skip over ATX record. */
+ /* Skip over ATX record. */
parse_int (&(ieee->h), &value);
parse_int (&(ieee->h), &value);
parse_int (&(ieee->h), &value);
@@ -892,7 +953,7 @@ ieee_slurp_external_symbols (abfd)
case ieee_atn_record_enum:
/* We may get call optimization information here,
which we just ignore. The format is
- {$F1}${CE}{index}{$00}{$3F}{$3F}{#_of_ASNs} */
+ {$F1}${CE}{index}{$00}{$3F}{$3F}{#_of_ASNs}. */
parse_int (&ieee->h, &value);
parse_int (&ieee->h, &value);
parse_int (&ieee->h, &value);
@@ -902,7 +963,7 @@ ieee_slurp_external_symbols (abfd)
(_("%s: unexpected ATN type %d in external part"),
bfd_archive_filename (abfd), (int) value);
bfd_set_error (bfd_error_bad_value);
- return false;
+ return FALSE;
}
parse_int (&ieee->h, &value);
parse_int (&ieee->h, &value);
@@ -924,7 +985,7 @@ ieee_slurp_external_symbols (abfd)
(_("%s: unexpected type after ATN"),
bfd_archive_filename (abfd));
bfd_set_error (bfd_error_bad_value);
- return false;
+ return FALSE;
}
}
}
@@ -934,7 +995,7 @@ ieee_slurp_external_symbols (abfd)
{
unsigned int symbol_name_index;
ieee_symbol_index_type symbol_ignore;
- boolean pcrel_ignore;
+ bfd_boolean pcrel_ignore;
unsigned int extra;
next_byte (&(ieee->h));
next_byte (&(ieee->h));
@@ -978,16 +1039,16 @@ ieee_slurp_external_symbols (abfd)
bfd_vma size;
bfd_vma value;
next_byte (&(ieee->h));
- /* Throw away the external reference index */
+ /* Throw away the external reference index. */
(void) must_parse_int (&(ieee->h));
- /* Fetch the default size if not resolved */
+ /* Fetch the default size if not resolved. */
size = must_parse_int (&(ieee->h));
- /* Fetch the defautlt value if available */
+ /* Fetch the default value if available. */
if (! parse_int (&(ieee->h), &value))
{
value = 0;
}
- /* This turns into a common */
+ /* This turns into a common. */
symbol->symbol.section = bfd_com_section_ptr;
symbol->symbol.value = size;
}
@@ -1000,7 +1061,7 @@ ieee_slurp_external_symbols (abfd)
&prev_reference_ptr,
&ieee->external_reference_max_index, 'X');
if (symbol == NULL)
- return false;
+ return FALSE;
symbol->symbol.the_bfd = abfd;
symbol->symbol.name = read_id (&(ieee->h));
@@ -1013,7 +1074,7 @@ ieee_slurp_external_symbols (abfd)
break;
default:
- loop = false;
+ loop = FALSE;
}
}
@@ -1045,26 +1106,26 @@ ieee_slurp_external_symbols (abfd)
if (symbol_count != abfd->symcount)
{
/* There are gaps in the table -- */
- ieee->symbol_table_full = false;
+ ieee->symbol_table_full = FALSE;
}
*prev_symbols_ptr = (ieee_symbol_type *) NULL;
*prev_reference_ptr = (ieee_symbol_type *) NULL;
- return true;
+ return TRUE;
}
-static boolean
+static bfd_boolean
ieee_slurp_symbol_table (abfd)
bfd *abfd;
{
if (! IEEE_DATA (abfd)->read_symbols)
{
if (! ieee_slurp_external_symbols (abfd))
- return false;
- IEEE_DATA (abfd)->read_symbols = true;
+ return FALSE;
+ IEEE_DATA (abfd)->read_symbols = TRUE;
}
- return true;
+ return TRUE;
}
static long
@@ -1078,15 +1139,13 @@ ieee_get_symtab_upper_bound (abfd)
(abfd->symcount + 1) * (sizeof (ieee_symbol_type *)) : 0;
}
-/*
-Move from our internal lists to the canon table, and insert in
-symbol index order
-*/
+/* Move from our internal lists to the canon table, and insert in
+ symbol index order. */
extern const bfd_target ieee_vec;
static long
-ieee_get_symtab (abfd, location)
+ieee_canonicalize_symtab (abfd, location)
bfd *abfd;
asymbol **location;
{
@@ -1114,41 +1173,35 @@ ieee_get_symtab (abfd, location)
if (! ieee->symbol_table_full)
{
- /* Arrgh - there are gaps in the table, run through and fill them */
- /* up with pointers to a null place */
+ /* Arrgh - there are gaps in the table, run through and fill them
+ up with pointers to a null place. */
unsigned int i;
+
for (i = 0; i < abfd->symcount; i++)
- {
- location[i] = &empty_symbol;
- }
+ location[i] = &empty_symbol;
}
ieee->external_symbol_base_offset = -ieee->external_symbol_min_index;
for (symp = IEEE_DATA (abfd)->external_symbols;
symp != (ieee_symbol_type *) NULL;
symp = symp->next)
- {
- /* Place into table at correct index locations */
- location[symp->index + ieee->external_symbol_base_offset] = &symp->symbol;
- }
+ /* Place into table at correct index locations. */
+ location[symp->index + ieee->external_symbol_base_offset] = &symp->symbol;
- /* The external refs are indexed in a bit */
+ /* The external refs are indexed in a bit. */
ieee->external_reference_base_offset =
-ieee->external_reference_min_index + ieee->external_symbol_count;
for (symp = IEEE_DATA (abfd)->external_reference;
symp != (ieee_symbol_type *) NULL;
symp = symp->next)
- {
- location[symp->index + ieee->external_reference_base_offset] =
- &symp->symbol;
-
- }
+ location[symp->index + ieee->external_reference_base_offset] =
+ &symp->symbol;
}
+
if (abfd->symcount)
- {
- location[abfd->symcount] = (asymbol *) NULL;
- }
+ location[abfd->symcount] = (asymbol *) NULL;
+
return abfd->symcount;
}
@@ -1212,7 +1265,7 @@ ieee_slurp_sections (abfd)
{
bfd_byte section_type[3];
ieee_seek (ieee, offset);
- while (true)
+ while (TRUE)
{
switch (this_byte (&(ieee->h)))
{
@@ -1228,34 +1281,33 @@ ieee_slurp_sections (abfd)
section_type[0] = this_byte_and_next (&(ieee->h));
/* Set minimal section attributes. Attributes are
- extended later, based on section contents. */
-
+ extended later, based on section contents. */
switch (section_type[0])
{
case 0xC1:
- /* Normal attributes for absolute sections */
+ /* Normal attributes for absolute sections. */
section_type[1] = this_byte (&(ieee->h));
section->flags = SEC_ALLOC;
switch (section_type[1])
{
- case 0xD3: /* AS Absolute section attributes */
+ case 0xD3: /* AS Absolute section attributes. */
next_byte (&(ieee->h));
section_type[2] = this_byte (&(ieee->h));
switch (section_type[2])
{
case 0xD0:
- /* Normal code */
+ /* Normal code. */
next_byte (&(ieee->h));
section->flags |= SEC_CODE;
break;
case 0xC4:
- /* Normal data */
+ /* Normal data. */
next_byte (&(ieee->h));
section->flags |= SEC_DATA;
break;
case 0xD2:
next_byte (&(ieee->h));
- /* Normal rom data */
+ /* Normal rom data. */
section->flags |= SEC_ROM | SEC_DATA;
break;
default:
@@ -1263,20 +1315,20 @@ ieee_slurp_sections (abfd)
}
}
break;
- case 0xC3: /* Named relocatable sections (type C) */
+ case 0xC3: /* Named relocatable sections (type C). */
section_type[1] = this_byte (&(ieee->h));
section->flags = SEC_ALLOC;
switch (section_type[1])
{
- case 0xD0: /* Normal code (CP) */
+ case 0xD0: /* Normal code (CP). */
next_byte (&(ieee->h));
section->flags |= SEC_CODE;
break;
- case 0xC4: /* Normal data (CD) */
+ case 0xC4: /* Normal data (CD). */
next_byte (&(ieee->h));
section->flags |= SEC_DATA;
break;
- case 0xD2: /* Normal rom data (CR) */
+ case 0xD2: /* Normal rom data (CR). */
next_byte (&(ieee->h));
section->flags |= SEC_ROM | SEC_DATA;
break;
@@ -1285,12 +1337,12 @@ ieee_slurp_sections (abfd)
}
}
- /* Read section name, use it if non empty. */
+ /* Read section name, use it if non empty. */
name = read_id (&ieee->h);
if (name[0])
section->name = name;
- /* Skip these fields, which we don't care about */
+ /* Skip these fields, which we don't care about. */
{
bfd_vma parent, brother, context;
parse_int (&(ieee->h), &parent);
@@ -1371,7 +1423,7 @@ ieee_slurp_sections (abfd)
at the area in the file so that program which understand can dig it
out. */
-static boolean
+static bfd_boolean
ieee_slurp_debug (abfd)
bfd *abfd;
{
@@ -1380,23 +1432,21 @@ ieee_slurp_debug (abfd)
file_ptr debug_end;
if (ieee->w.r.debug_information_part == 0)
- return true;
+ return TRUE;
sec = bfd_make_section (abfd, ".debug");
if (sec == NULL)
- return false;
+ return FALSE;
sec->flags |= SEC_DEBUGGING | SEC_HAS_CONTENTS;
sec->filepos = ieee->w.r.debug_information_part;
debug_end = ieee_part_after (ieee, ieee->w.r.debug_information_part);
sec->_raw_size = debug_end - ieee->w.r.debug_information_part;
- return true;
+ return TRUE;
}
-/***********************************************************************
-* archive stuff
-*/
+/* Archive stuff. */
const bfd_target *
ieee_archive_p (abfd)
@@ -1566,8 +1616,8 @@ ieee_object_p (abfd)
if (this_byte_and_next (&(ieee->h)) != Module_Beginning)
goto got_wrong_format;
- ieee->read_symbols = false;
- ieee->read_data = false;
+ 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;
@@ -1582,16 +1632,14 @@ ieee_object_p (abfd)
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.
- */
+ 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 identificaton
+ /* 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. */
@@ -1627,7 +1675,7 @@ ieee_object_p (abfd)
}
else if (TOUPPER (processor[3]) == 'F') /* 68F333 */
strcpy (family, "68332"); /* CPU32 */
- else if ((TOUPPER (processor[3]) == 'C') /* Embedded controllers */
+ else if ((TOUPPER (processor[3]) == 'C') /* Embedded controllers. */
&& ((TOUPPER (processor[2]) == 'E')
|| (TOUPPER (processor[2]) == 'H')
|| (TOUPPER (processor[2]) == 'L')))
@@ -1636,7 +1684,7 @@ ieee_object_p (abfd)
strncat (family, processor + 4, 7);
family[9] = '\0';
}
- else /* "Regular" processors */
+ else /* "Regular" processors. */
{
strncpy (family, processor, 9);
family[9] = '\0';
@@ -1658,43 +1706,34 @@ ieee_object_p (abfd)
}
if (this_byte (&(ieee->h)) != (int) ieee_address_descriptor_enum)
- {
- goto fail;
- }
+ goto fail;
+
next_byte (&(ieee->h));
if (! parse_int (&(ieee->h), &ieee->ad.number_of_bits_mau))
- {
- goto fail;
- }
+ goto fail;
+
if (! parse_int (&(ieee->h), &ieee->ad.number_of_maus_in_address))
- {
- goto fail;
- }
+ 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)
+ /* 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++)
{
- boolean ok;
+ bfd_boolean ok;
+
if (read_2bytes (&(ieee->h)) != (int) ieee_assign_value_to_variable_enum)
- {
- goto fail;
- }
+ goto fail;
+
if (this_byte_and_next (&(ieee->h)) != part)
- {
- goto fail;
- }
+ goto fail;
ieee->w.offset[part] = parse_i (&(ieee->h), &ok);
if (! ok)
- {
- goto fail;
- }
-
+ goto fail;
}
if (ieee->w.r.external_part != 0)
@@ -1703,7 +1742,7 @@ ieee_object_p (abfd)
/* 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 */
+ record. */
amt = ieee->w.r.me_record + 1;
IEEE_DATA (abfd)->h.first_byte =
@@ -1724,7 +1763,6 @@ ieee_object_p (abfd)
/* Parse section data to activate file and section flags implied by
section contents. */
-
if (! ieee_slurp_section_data (abfd))
goto fail;
@@ -1777,6 +1815,7 @@ ieee_print_symbol (abfd, afile, symbol, how)
(symbol->section == (asection *) NULL
? "*abs"
: symbol->section->name);
+
if (symbol->name[0] == ' ')
{
fprintf (file, "* empty table entry ");
@@ -1796,7 +1835,7 @@ ieee_print_symbol (abfd, afile, symbol, how)
}
}
-static boolean
+static bfd_boolean
do_one (ieee, current_map, location_ptr, s, iterations)
ieee_data_type *ieee;
ieee_per_section_type *current_map;
@@ -1810,6 +1849,7 @@ do_one (ieee, current_map, location_ptr, s, iterations)
{
unsigned int number_of_maus;
unsigned int i;
+
next_byte (&(ieee->h));
number_of_maus = must_parse_int (&(ieee->h));
@@ -1823,7 +1863,8 @@ do_one (ieee, current_map, location_ptr, s, iterations)
case ieee_load_with_relocation_enum:
{
- boolean loop = true;
+ bfd_boolean loop = TRUE;
+
next_byte (&(ieee->h));
while (loop)
{
@@ -1836,14 +1877,14 @@ do_one (ieee, current_map, location_ptr, s, iterations)
case ieee_function_either_open_b_enum:
{
unsigned int extra = 4;
- boolean pcrel = false;
+ bfd_boolean pcrel = FALSE;
asection *section;
ieee_reloc_type *r;
bfd_size_type amt = sizeof (ieee_reloc_type);
r = (ieee_reloc_type *) bfd_alloc (ieee->h.abfd, amt);
if (!r)
- return false;
+ return FALSE;
*(current_map->reloc_tail_ptr) = r;
current_map->reloc_tail_ptr = &r->next;
@@ -1865,7 +1906,7 @@ do_one (ieee, current_map, location_ptr, s, iterations)
if (this_byte (&(ieee->h)) == (int) ieee_comma)
{
next_byte (&(ieee->h));
- /* Fetch number of bytes to pad */
+ /* Fetch number of bytes to pad. */
extra = must_parse_int (&(ieee->h));
};
@@ -1883,7 +1924,7 @@ do_one (ieee, current_map, location_ptr, s, iterations)
default:
break;
}
- /* Build a relocation entry for this type */
+ /* Build a relocation entry for this type. */
/* If pc rel then stick -ve pc into instruction
and take out of reloc ..
@@ -1962,7 +2003,7 @@ do_one (ieee, current_map, location_ptr, s, iterations)
default:
BFD_FAIL ();
- return false;
+ return FALSE;
}
}
break;
@@ -1980,7 +2021,7 @@ do_one (ieee, current_map, location_ptr, s, iterations)
}
else
{
- loop = false;
+ loop = FALSE;
}
}
}
@@ -1988,15 +2029,16 @@ do_one (ieee, current_map, location_ptr, s, iterations)
/* Prevent more than the first load-item of an LR record
from being repeated (MRI convention). */
if (iterations != 1)
- loop = false;
+ loop = FALSE;
}
}
}
- return true;
+ return TRUE;
}
-/* Read in all the section data and relocation stuff too */
-static boolean
+/* Read in all the section data and relocation stuff too. */
+
+static bfd_boolean
ieee_slurp_section_data (abfd)
bfd *abfd;
{
@@ -2006,45 +2048,43 @@ ieee_slurp_section_data (abfd)
ieee_per_section_type *current_map = (ieee_per_section_type *) NULL;
asection *s;
- /* Seek to the start of the data area */
+ /* Seek to the start of the data area. */
if (ieee->read_data)
- return true;
- ieee->read_data = true;
+ return TRUE;
+ ieee->read_data = TRUE;
ieee_seek (ieee, ieee->w.r.data_part);
- /* Allocate enough space for all the section contents */
-
+ /* Allocate enough space for all the section contents. */
for (s = abfd->sections; s != (asection *) NULL; s = s->next)
{
- ieee_per_section_type *per = (ieee_per_section_type *) s->used_by_bfd;
+ ieee_per_section_type *per = ieee_per_section (s);
if ((s->flags & SEC_DEBUGGING) != 0)
continue;
per->data = (bfd_byte *) bfd_alloc (ieee->h.abfd, s->_raw_size);
if (!per->data)
- return false;
- /*SUPPRESS 68*/
+ return FALSE;
per->reloc_tail_ptr =
(ieee_reloc_type **) & (s->relocation);
}
- while (true)
+ while (TRUE)
{
switch (this_byte (&(ieee->h)))
{
- /* IF we see anything strange then quit */
+ /* IF we see anything strange then quit. */
default:
- return true;
+ return TRUE;
case ieee_set_current_section_enum:
next_byte (&(ieee->h));
section_number = must_parse_int (&(ieee->h));
s = ieee->section_table[section_number];
s->flags |= SEC_LOAD | SEC_HAS_CONTENTS;
- current_map = (ieee_per_section_type *) s->used_by_bfd;
+ current_map = ieee_per_section (s);
location_ptr = current_map->data - s->vma;
- /* The document I have says that Microtec's compilers reset */
- /* this after a sec section, even though the standard says not */
- /* to. SO .. */
+ /* The document I have says that Microtec's compilers reset
+ this after a sec section, even though the standard says not
+ to, SO... */
current_map->pc = s->vma;
break;
@@ -2057,9 +2097,10 @@ ieee_slurp_section_data (abfd)
bfd_vma value;
ieee_symbol_index_type symbol;
unsigned int extra;
- boolean pcrel;
+ bfd_boolean pcrel;
+
next_byte (&(ieee->h));
- must_parse_int (&(ieee->h)); /* Throw away section #*/
+ must_parse_int (&(ieee->h)); /* Throw away section #. */
parse_expression (ieee, &value,
&symbol,
&pcrel, &extra,
@@ -2074,28 +2115,27 @@ ieee_slurp_section_data (abfd)
if (this_byte (&(ieee->h)) == ieee_function_either_open_b_enum)
next_byte (&(ieee->h));
abfd->start_address = must_parse_int (&(ieee->h));
- /* We've got to the end of the data now - */
- return true;
+ /* We've got to the end of the data now - */
+ return TRUE;
default:
BFD_FAIL ();
- return false;
+ return FALSE;
}
break;
case ieee_repeat_data_enum:
{
/* Repeat the following LD or LR n times - we do this by
- remembering the stream pointer before running it and
- resetting it and running it n times. We special case
- the repetition of a repeat_data/load_constant
- */
-
+ remembering the stream pointer before running it and
+ resetting it and running it n times. We special case
+ the repetition of a repeat_data/load_constant. */
unsigned int iterations;
unsigned char *start;
+
next_byte (&(ieee->h));
iterations = must_parse_int (&(ieee->h));
start = ieee->h.input_p;
- if (start[0] == (int) ieee_load_constant_bytes_enum &&
- start[1] == 1)
+ if (start[0] == (int) ieee_load_constant_bytes_enum
+ && start[1] == 1)
{
while (iterations != 0)
{
@@ -2113,7 +2153,7 @@ ieee_slurp_section_data (abfd)
ieee->h.input_p = start;
if (!do_one (ieee, current_map, location_ptr, s,
(int) iterations))
- return false;
+ return FALSE;
iterations--;
}
}
@@ -2121,26 +2161,24 @@ ieee_slurp_section_data (abfd)
break;
case ieee_load_constant_bytes_enum:
case ieee_load_with_relocation_enum:
- {
- if (!do_one (ieee, current_map, location_ptr, s, 1))
- return false;
- }
+ if (!do_one (ieee, current_map, location_ptr, s, 1))
+ return FALSE;
}
}
}
-static boolean
+static bfd_boolean
ieee_new_section_hook (abfd, newsect)
bfd *abfd;
asection *newsect;
{
- newsect->used_by_bfd = (PTR)
- bfd_alloc (abfd, (bfd_size_type) sizeof (ieee_per_section_type));
+ newsect->used_by_bfd
+ = (PTR) bfd_alloc (abfd, (bfd_size_type) sizeof (ieee_per_section_type));
if (!newsect->used_by_bfd)
- return false;
+ return FALSE;
ieee_per_section (newsect)->data = (bfd_byte *) NULL;
ieee_per_section (newsect)->section = newsect;
- return true;
+ return TRUE;
}
static long
@@ -2155,7 +2193,7 @@ ieee_get_reloc_upper_bound (abfd, asect)
return (asect->reloc_count + 1) * sizeof (arelent *);
}
-static boolean
+static bfd_boolean
ieee_get_section_contents (abfd, section, location, offset, count)
bfd *abfd;
sec_ptr section;
@@ -2163,13 +2201,13 @@ ieee_get_section_contents (abfd, section, location, offset, count)
file_ptr offset;
bfd_size_type count;
{
- ieee_per_section_type *p = (ieee_per_section_type *) section->used_by_bfd;
+ ieee_per_section_type *p = ieee_per_section (section);
if ((section->flags & SEC_DEBUGGING) != 0)
return _bfd_generic_get_section_contents (abfd, section, location,
offset, count);
ieee_slurp_section_data (abfd);
(void) memcpy ((PTR) location, (PTR) (p->data + offset), (unsigned) count);
- return true;
+ return TRUE;
}
static long
@@ -2179,7 +2217,6 @@ ieee_canonicalize_reloc (abfd, section, relptr, symbols)
arelent **relptr;
asymbol **symbols;
{
-/* ieee_per_section_type *p = (ieee_per_section_type *) section->used_by_bfd;*/
ieee_reloc_type *src = (ieee_reloc_type *) (section->relocation);
ieee_data_type *ieee = IEEE_DATA (abfd);
@@ -2188,7 +2225,7 @@ ieee_canonicalize_reloc (abfd, section, relptr, symbols)
while (src != (ieee_reloc_type *) NULL)
{
- /* Work out which symbol to attach it this reloc to */
+ /* Work out which symbol to attach it this reloc to. */
switch (src->symbol.letter)
{
case 'I':
@@ -2227,7 +2264,7 @@ comp (ap, bp)
/* Write the section headers. */
-static boolean
+static bfd_boolean
ieee_write_section_part (abfd)
bfd *abfd;
{
@@ -2243,19 +2280,19 @@ ieee_write_section_part (abfd)
|| ! ieee_write_byte (abfd,
(bfd_byte) (s->index
+ IEEE_SECTION_NUMBER_BASE)))
- return false;
+ return FALSE;
if (abfd->flags & EXEC_P)
{
- /* This image is executable, so output absolute sections */
+ /* This image is executable, so output absolute sections. */
if (! ieee_write_byte (abfd, ieee_variable_A_enum)
|| ! ieee_write_byte (abfd, ieee_variable_S_enum))
- return false;
+ return FALSE;
}
else
{
if (! ieee_write_byte (abfd, ieee_variable_C_enum))
- return false;
+ return FALSE;
}
switch (s->flags & (SEC_CODE | SEC_DATA | SEC_ROM))
@@ -2263,64 +2300,64 @@ ieee_write_section_part (abfd)
case SEC_CODE | SEC_LOAD:
case SEC_CODE:
if (! ieee_write_byte (abfd, ieee_variable_P_enum))
- return false;
+ return FALSE;
break;
case SEC_DATA:
default:
if (! ieee_write_byte (abfd, ieee_variable_D_enum))
- return false;
+ return FALSE;
break;
case SEC_ROM:
case SEC_ROM | SEC_DATA:
case SEC_ROM | SEC_LOAD:
case SEC_ROM | SEC_DATA | SEC_LOAD:
if (! ieee_write_byte (abfd, ieee_variable_R_enum))
- return false;
+ return FALSE;
}
if (! ieee_write_id (abfd, s->name))
- return false;
+ return FALSE;
#if 0
ieee_write_int (abfd, 0); /* Parent */
ieee_write_int (abfd, 0); /* Brother */
ieee_write_int (abfd, 0); /* Context */
#endif
- /* Alignment */
+ /* Alignment. */
if (! ieee_write_byte (abfd, ieee_section_alignment_enum)
|| ! ieee_write_byte (abfd,
(bfd_byte) (s->index
+ IEEE_SECTION_NUMBER_BASE))
|| ! ieee_write_int (abfd, (bfd_vma) 1 << s->alignment_power))
- return false;
+ return FALSE;
- /* Size */
+ /* Size. */
if (! ieee_write_2bytes (abfd, ieee_section_size_enum)
|| ! ieee_write_byte (abfd,
(bfd_byte) (s->index
+ IEEE_SECTION_NUMBER_BASE))
|| ! ieee_write_int (abfd, s->_raw_size))
- return false;
+ return FALSE;
if (abfd->flags & EXEC_P)
{
- /* Relocateable sections don't have asl records */
- /* Vma */
+ /* Relocateable sections don't have asl records. */
+ /* Vma. */
if (! ieee_write_2bytes (abfd, ieee_section_base_address_enum)
|| ! ieee_write_byte (abfd,
((bfd_byte)
(s->index
+ IEEE_SECTION_NUMBER_BASE)))
|| ! ieee_write_int (abfd, s->lma))
- return false;
+ return FALSE;
}
}
}
- return true;
+ return TRUE;
}
-static boolean
+static bfd_boolean
do_with_relocs (abfd, s)
bfd *abfd;
asection *s;
@@ -2337,51 +2374,49 @@ do_with_relocs (abfd, s)
sizeof (arelent **),
comp);
- /* Output the section preheader */
+ /* Output the section preheader. */
if (! ieee_write_byte (abfd, ieee_set_current_section_enum)
|| ! ieee_write_byte (abfd,
(bfd_byte) (s->index + IEEE_SECTION_NUMBER_BASE))
|| ! ieee_write_2bytes (abfd, ieee_set_current_pc_enum)
|| ! ieee_write_byte (abfd,
(bfd_byte) (s->index + IEEE_SECTION_NUMBER_BASE)))
- return false;
+ return FALSE;
if ((abfd->flags & EXEC_P) != 0 && relocs_to_go == 0)
{
if (! ieee_write_int (abfd, s->lma))
- return false;
+ return FALSE;
}
else
{
if (! ieee_write_expression (abfd, (bfd_vma) 0, s->symbol, 0, 0))
- return false;
+ return FALSE;
}
if (relocs_to_go == 0)
{
/* If there aren't any relocations then output the load constant
- byte opcode rather than the load with relocation opcode */
-
+ byte opcode rather than the load with relocation opcode. */
while (current_byte_index < s->_raw_size)
{
bfd_size_type run;
unsigned int MAXRUN = 127;
+
run = MAXRUN;
if (run > s->_raw_size - current_byte_index)
- {
- run = s->_raw_size - current_byte_index;
- }
+ run = s->_raw_size - current_byte_index;
if (run != 0)
{
if (! ieee_write_byte (abfd, ieee_load_constant_bytes_enum))
- return false;
- /* Output a stream of bytes */
+ return FALSE;
+ /* Output a stream of bytes. */
if (! ieee_write_int (abfd, run))
- return false;
+ return FALSE;
if (bfd_bwrite ((PTR) (stream + current_byte_index), run, abfd)
!= run)
- return false;
+ return FALSE;
current_byte_index += run;
}
}
@@ -2389,7 +2424,7 @@ do_with_relocs (abfd, s)
else
{
if (! ieee_write_byte (abfd, ieee_load_with_relocation_enum))
- return false;
+ return FALSE;
/* Output the data stream as the longest sequence of bytes
possible, allowing for the a reasonable packet size and
@@ -2397,15 +2432,16 @@ do_with_relocs (abfd, s)
if ((PTR) stream == (PTR) NULL)
{
- /* Outputting a section without data, fill it up */
+ /* Outputting a section without data, fill it up. */
stream = (unsigned char *) bfd_zalloc (abfd, s->_raw_size);
if (!stream)
- return false;
+ return FALSE;
}
while (current_byte_index < s->_raw_size)
{
bfd_size_type run;
unsigned int MAXRUN = 127;
+
if (relocs_to_go)
{
run = (*p)->address - current_byte_index;
@@ -2413,25 +2449,23 @@ do_with_relocs (abfd, s)
run = MAXRUN;
}
else
- {
- run = MAXRUN;
- }
+ run = MAXRUN;
+
if (run > s->_raw_size - current_byte_index)
- {
- run = s->_raw_size - current_byte_index;
- }
+ run = s->_raw_size - current_byte_index;
if (run != 0)
{
- /* Output a stream of bytes */
+ /* Output a stream of bytes. */
if (! ieee_write_int (abfd, run))
- return false;
+ return FALSE;
if (bfd_bwrite ((PTR) (stream + current_byte_index), run, abfd)
!= run)
- return false;
+ return FALSE;
current_byte_index += run;
}
- /* Output any relocations here */
+
+ /* Output any relocations here. */
if (relocs_to_go && (*p) && (*p)->address == current_byte_index)
{
while (relocs_to_go
@@ -2439,14 +2473,10 @@ do_with_relocs (abfd, s)
{
arelent *r = *p;
bfd_signed_vma ov;
-
#if 0
if (r->howto->pc_relative)
- {
- r->addend += current_byte_index;
- }
+ r->addend += current_byte_index;
#endif
-
switch (r->howto->size)
{
case 2:
@@ -2468,7 +2498,7 @@ do_with_relocs (abfd, s)
default:
ov = 0;
BFD_FAIL ();
- return false;
+ return FALSE;
}
ov &= r->howto->src_mask;
@@ -2479,7 +2509,7 @@ do_with_relocs (abfd, s)
if (! ieee_write_byte (abfd,
ieee_function_either_open_b_enum))
- return false;
+ return FALSE;
/* abort();*/
@@ -2489,7 +2519,7 @@ do_with_relocs (abfd, s)
*(r->sym_ptr_ptr),
r->howto->pc_relative,
(unsigned) s->index))
- return false;
+ return FALSE;
}
else
{
@@ -2497,7 +2527,7 @@ do_with_relocs (abfd, s)
(asymbol *) NULL,
r->howto->pc_relative,
(unsigned) s->index))
- return false;
+ return FALSE;
}
if (number_of_maus_in_address
@@ -2505,11 +2535,11 @@ do_with_relocs (abfd, s)
{
bfd_vma rsize = bfd_get_reloc_size (r->howto);
if (! ieee_write_int (abfd, rsize))
- return false;
+ return FALSE;
}
if (! ieee_write_byte (abfd,
ieee_function_either_close_b_enum))
- return false;
+ return FALSE;
relocs_to_go--;
p++;
@@ -2519,14 +2549,14 @@ do_with_relocs (abfd, s)
}
}
- return true;
+ return TRUE;
}
/* If there are no relocations in the output section then we can be
clever about how we write. We block items up into a max of 127
bytes. */
-static boolean
+static bfd_boolean
do_as_repeat (abfd, s)
bfd *abfd;
asection *s;
@@ -2542,17 +2572,17 @@ do_as_repeat (abfd, s)
|| ! ieee_write_byte (abfd,
(bfd_byte) (s->index
+ IEEE_SECTION_NUMBER_BASE)))
- return false;
+ return FALSE;
if ((abfd->flags & EXEC_P) != 0)
{
if (! ieee_write_int (abfd, s->lma))
- return false;
+ return FALSE;
}
else
{
if (! ieee_write_expression (abfd, (bfd_vma) 0, s->symbol, 0, 0))
- return false;
+ return FALSE;
}
if (! ieee_write_byte (abfd, ieee_repeat_data_enum)
@@ -2560,13 +2590,13 @@ do_as_repeat (abfd, s)
|| ! ieee_write_byte (abfd, ieee_load_constant_bytes_enum)
|| ! ieee_write_byte (abfd, 1)
|| ! ieee_write_byte (abfd, 0))
- return false;
+ return FALSE;
}
- return true;
+ return TRUE;
}
-static boolean
+static bfd_boolean
do_without_relocs (abfd, s)
bfd *abfd;
asection *s;
@@ -2576,25 +2606,26 @@ do_without_relocs (abfd, s)
if (stream == 0 || ((s->flags & SEC_LOAD) == 0))
{
if (! do_as_repeat (abfd, s))
- return false;
+ return FALSE;
}
else
{
unsigned int i;
+
for (i = 0; i < s->_raw_size; i++)
{
if (stream[i] != 0)
{
if (! do_with_relocs (abfd, s))
- return false;
- return true;
+ return FALSE;
+ return TRUE;
}
}
if (! do_as_repeat (abfd, s))
- return false;
+ return FALSE;
}
- return true;
+ return TRUE;
}
@@ -2608,7 +2639,7 @@ static bfd *input_bfd;
static bfd *output_bfd;
static int output_buffer;
-static boolean
+static bfd_boolean
ieee_mkobject (abfd)
bfd *abfd;
{
@@ -2642,6 +2673,7 @@ static void
flush ()
{
bfd_size_type amt = output_ptr - output_ptr_start;
+
if (bfd_bwrite ((PTR) (output_ptr_start), amt, output_bfd) != amt)
abort ();
output_ptr = output_ptr_start;
@@ -2663,20 +2695,14 @@ write_int (value)
else
{
unsigned int length;
- /* How many significant bytes ? */
- /* FIXME FOR LONGER INTS */
+ /* How many significant bytes ? */
+ /* FIXME FOR LONGER INTS. */
if (value & 0xff000000)
- {
- length = 4;
- }
+ length = 4;
else if (value & 0x00ff0000)
- {
- length = 3;
- }
+ length = 3;
else if (value & 0x0000ff00)
- {
- length = 2;
- }
+ length = 2;
else
length = 1;
@@ -2692,7 +2718,6 @@ write_int (value)
case 1:
OUT (value);
}
-
}
}
@@ -2701,6 +2726,7 @@ copy_id ()
{
int length = THIS ();
char ch;
+
OUT (length);
NEXT ();
while (length--)
@@ -2718,6 +2744,7 @@ copy_expression ()
int stack[10];
int *tos = stack;
int value;
+
while (1)
{
switch (THIS ())
@@ -2765,7 +2792,7 @@ copy_expression ()
default:
if (THIS () > 0x84)
{
- /* Not a number, just bug out with the answer */
+ /* Not a number, just bug out with the answer. */
write_int (*(--tos));
return;
}
@@ -2773,7 +2800,7 @@ copy_expression ()
NEXT ();
break;
case 0xa5:
- /* PLUS anything */
+ /* PLUS anything. */
value = *(--tos);
value += *(--tos);
*tos++ = value;
@@ -2784,6 +2811,7 @@ copy_expression ()
int section_number;
ieee_data_type *ieee;
asection *s;
+
NEXT ();
section_number = THIS ();
@@ -2817,7 +2845,7 @@ fill_int (buf)
{
if (buf->buffer == output_buffer)
{
- /* Still a chance to output the size */
+ /* Still a chance to output the size. */
int value = output_ptr - buf->ptrp + 3;
buf->ptrp[0] = value >> 24;
buf->ptrp[1] = value >> 16;
@@ -2832,6 +2860,7 @@ drop_int (buf)
{
int type = THIS ();
int ch;
+
if (type <= 0x84)
{
NEXT ();
@@ -2905,7 +2934,8 @@ static void
f1_record ()
{
int ch;
- /* ATN record */
+
+ /* ATN record. */
NEXT ();
ch = THIS ();
switch (ch)
@@ -2945,7 +2975,7 @@ f1_record ()
}
break;
case 0xd8:
- /* EXternal ref */
+ /* EXternal ref. */
NEXT ();
OUT (0xf1);
OUT (0xd8);
@@ -2999,13 +3029,12 @@ f1_record ()
break;
}
}
-
}
static void
f0_record ()
{
- /* Attribute record */
+ /* Attribute record. */
NEXT ();
OUT (0xf0);
INTn (Symbol name);
@@ -3016,6 +3045,7 @@ static void
copy_till_end ()
{
int ch = THIS ();
+
while (1)
{
while (ch <= 0x80)
@@ -3074,11 +3104,12 @@ f8_record ()
case 0x01:
case 0x02:
case 0x03:
- /* Unique typedefs for module */
- /* GLobal typedefs */
- /* High level module scope beginning */
+ /* Unique typedefs for module. */
+ /* GLobal typedefs. */
+ /* High level module scope beginning. */
{
struct output_buffer_struct ob;
+
NEXT ();
OUT (0xf8);
OUT (ch);
@@ -3093,9 +3124,10 @@ f8_record ()
}
break;
case 0x04:
- /* Global function */
+ /* Global function. */
{
struct output_buffer_struct ob;
+
NEXT ();
OUT (0xf8);
OUT (0x04);
@@ -3115,9 +3147,10 @@ f8_record ()
break;
case 0x05:
- /* File name for source line numbers */
+ /* File name for source line numbers. */
{
struct output_buffer_struct ob;
+
NEXT ();
OUT (0xf8);
OUT (0x05);
@@ -3137,9 +3170,10 @@ f8_record ()
break;
case 0x06:
- /* Local function */
+ /* Local function. */
{
struct output_buffer_struct ob;
+
NEXT ();
OUT (0xf8);
OUT (0x06);
@@ -3157,7 +3191,7 @@ f8_record ()
break;
case 0x0a:
- /* Assembler module scope beginning -*/
+ /* Assembler module scope beginning - */
{
struct output_buffer_struct ob;
@@ -3186,6 +3220,7 @@ f8_record ()
case 0x0b:
{
struct output_buffer_struct ob;
+
NEXT ();
OUT (0xf8);
OUT (0x0b);
@@ -3222,6 +3257,7 @@ static void
block ()
{
int ch;
+
while (1)
{
ch = THIS ();
@@ -3253,11 +3289,8 @@ block ()
}
-
-/* relocate_debug,
- moves all the debug information from the source bfd to the output
- bfd, and relocates any expressions it finds
-*/
+/* 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)
@@ -3280,14 +3313,14 @@ relocate_debug (output, input)
/* Gather together all the debug information from each input BFD into
one place, relocating it and emitting it as we go. */
-static boolean
+static bfd_boolean
ieee_write_debug_part (abfd)
bfd *abfd;
{
ieee_data_type *ieee = IEEE_DATA (abfd);
bfd_chain_type *chain = ieee->chain_root;
unsigned char obuff[OBS];
- boolean some_debug = false;
+ bfd_boolean some_debug = FALSE;
file_ptr here = bfd_tell (abfd);
output_ptr_start = output_ptr = obuff;
@@ -3305,12 +3338,12 @@ ieee_write_debug_part (abfd)
if (s == NULL)
{
ieee->w.r.debug_information_part = 0;
- return true;
+ return TRUE;
}
ieee->w.r.debug_information_part = here;
if (bfd_bwrite (s->contents, s->_raw_size, abfd) != s->_raw_size)
- return false;
+ return FALSE;
}
else
{
@@ -3318,40 +3351,40 @@ ieee_write_debug_part (abfd)
{
bfd *entry = chain->this;
ieee_data_type *entry_ieee = IEEE_DATA (entry);
+
if (entry_ieee->w.r.debug_information_part)
{
if (bfd_seek (entry, entry_ieee->w.r.debug_information_part,
SEEK_SET) != 0)
- return false;
+ return FALSE;
relocate_debug (abfd, entry);
}
chain = chain->next;
}
+
if (some_debug)
- {
- ieee->w.r.debug_information_part = here;
- }
+ ieee->w.r.debug_information_part = here;
else
- {
- ieee->w.r.debug_information_part = 0;
- }
+ ieee->w.r.debug_information_part = 0;
flush ();
}
- return true;
+ return TRUE;
}
/* Write the data in an ieee way. */
-static boolean
+static bfd_boolean
ieee_write_data_part (abfd)
bfd *abfd;
{
asection *s;
+
ieee_data_type *ieee = IEEE_DATA (abfd);
ieee->w.r.data_part = bfd_tell (abfd);
+
for (s = abfd->sections; s != (asection *) NULL; s = s->next)
{
/* Skip sections that have no loadable contents (.bss,
@@ -3364,24 +3397,25 @@ ieee_write_data_part (abfd)
if (s->reloc_count != 0)
{
if (! do_with_relocs (abfd, s))
- return false;
+ return FALSE;
}
else
{
if (! do_without_relocs (abfd, s))
- return false;
+ return FALSE;
}
}
- return true;
+ return TRUE;
}
-static boolean
+static bfd_boolean
init_for_output (abfd)
bfd *abfd;
{
asection *s;
+
for (s = abfd->sections; s != (asection *) NULL; s = s->next)
{
if ((s->flags & SEC_DEBUGGING) != 0)
@@ -3391,22 +3425,22 @@ init_for_output (abfd)
bfd_size_type size = s->_raw_size;
ieee_per_section (s)->data = (bfd_byte *) (bfd_alloc (abfd, size));
if (!ieee_per_section (s)->data)
- return false;
+ return FALSE;
}
}
- return true;
+ return TRUE;
}
-/** exec and core file sections */
+/* Exec and core file sections. */
-/* set section contents is complicated with IEEE since the format is
-* not a byte image, but a record stream.
-*/
-static boolean
+/* Set section contents is complicated with IEEE since the format is
+ not a byte image, but a record stream. */
+
+static bfd_boolean
ieee_set_section_contents (abfd, section, location, offset, count)
bfd *abfd;
sec_ptr section;
- PTR location;
+ const PTR location;
file_ptr offset;
bfd_size_type count;
{
@@ -3417,23 +3451,23 @@ ieee_set_section_contents (abfd, section, location, offset, count)
bfd_size_type size = section->_raw_size;
section->contents = (unsigned char *) bfd_alloc (abfd, size);
if (section->contents == NULL)
- return false;
+ return FALSE;
}
/* bfd_set_section_contents has already checked that everything
is within range. */
memcpy (section->contents + offset, location, (size_t) count);
- return true;
+ return TRUE;
}
if (ieee_per_section (section)->data == (bfd_byte *) NULL)
{
if (!init_for_output (abfd))
- return false;
+ return FALSE;
}
memcpy ((PTR) (ieee_per_section (section)->data + offset),
(PTR) location,
(unsigned int) count);
- return true;
+ return TRUE;
}
/* Write the external symbols of a file. IEEE considers two sorts of
@@ -3441,37 +3475,38 @@ ieee_set_section_contents (abfd, section, location, offset, count)
forms to index them as well. When we write them out we turn their
symbol values into indexes from the right base. */
-static boolean
+static bfd_boolean
ieee_write_external_part (abfd)
bfd *abfd;
{
asymbol **q;
ieee_data_type *ieee = IEEE_DATA (abfd);
-
unsigned int reference_index = IEEE_REFERENCE_BASE;
unsigned int public_index = IEEE_PUBLIC_BASE + 2;
file_ptr here = bfd_tell (abfd);
- boolean hadone = false;
+ bfd_boolean hadone = FALSE;
+
if (abfd->outsymbols != (asymbol **) NULL)
{
for (q = abfd->outsymbols; *q != (asymbol *) NULL; q++)
{
asymbol *p = *q;
+
if (bfd_is_und_section (p->section))
{
- /* This must be a symbol reference .. */
+ /* This must be a symbol reference. */
if (! ieee_write_byte (abfd, ieee_external_reference_enum)
|| ! ieee_write_int (abfd, (bfd_vma) reference_index)
|| ! ieee_write_id (abfd, p->name))
- return false;
+ return FALSE;
p->value = reference_index;
reference_index++;
- hadone = true;
+ hadone = TRUE;
}
else if (bfd_is_com_section (p->section))
{
- /* This is a weak reference */
+ /* This is a weak reference. */
if (! ieee_write_byte (abfd, ieee_external_reference_enum)
|| ! ieee_write_int (abfd, (bfd_vma) reference_index)
|| ! ieee_write_id (abfd, p->name)
@@ -3479,15 +3514,14 @@ ieee_write_external_part (abfd)
ieee_weak_external_reference_enum)
|| ! ieee_write_int (abfd, (bfd_vma) reference_index)
|| ! ieee_write_int (abfd, p->value))
- return false;
+ return FALSE;
p->value = reference_index;
reference_index++;
- hadone = true;
+ hadone = TRUE;
}
else if (p->flags & BSF_GLOBAL)
{
- /* This must be a symbol definition */
-
+ /* This must be a symbol definition. */
if (! ieee_write_byte (abfd, ieee_external_symbol_enum)
|| ! ieee_write_int (abfd, (bfd_vma) public_index)
|| ! ieee_write_id (abfd, p->name)
@@ -3496,24 +3530,24 @@ ieee_write_external_part (abfd)
|| ! ieee_write_byte (abfd, 15) /* instruction address */
|| ! ieee_write_byte (abfd, 19) /* static symbol */
|| ! ieee_write_byte (abfd, 1)) /* one of them */
- return false;
+ return FALSE;
- /* Write out the value */
+ /* Write out the value. */
if (! ieee_write_2bytes (abfd, ieee_value_record_enum)
|| ! ieee_write_int (abfd, (bfd_vma) public_index))
- return false;
+ return FALSE;
if (! bfd_is_abs_section (p->section))
{
if (abfd->flags & EXEC_P)
{
/* If fully linked, then output all symbols
- relocated */
+ relocated. */
if (! (ieee_write_int
(abfd,
(p->value
+ p->section->output_offset
+ p->section->output_section->vma))))
- return false;
+ return FALSE;
}
else
{
@@ -3521,8 +3555,8 @@ ieee_write_external_part (abfd)
(abfd,
p->value + p->section->output_offset,
p->section->output_section->symbol,
- false, 0)))
- return false;
+ FALSE, 0)))
+ return FALSE;
}
}
else
@@ -3530,33 +3564,33 @@ ieee_write_external_part (abfd)
if (! ieee_write_expression (abfd,
p->value,
bfd_abs_section_ptr->symbol,
- false, 0))
- return false;
+ FALSE, 0))
+ return FALSE;
}
p->value = public_index;
public_index++;
- hadone = true;
+ hadone = TRUE;
}
else
{
- /* This can happen - when there are gaps in the symbols read */
- /* from an input ieee file */
+ /* This can happen - when there are gaps in the symbols read
+ from an input ieee file. */
}
}
}
if (hadone)
ieee->w.r.external_part = here;
- return true;
+ return TRUE;
}
static const unsigned char exten[] =
{
0xf0, 0x20, 0x00,
- 0xf1, 0xce, 0x20, 0x00, 37, 3, 3, /* Set version 3 rev 3 */
- 0xf1, 0xce, 0x20, 0x00, 39, 2,/* keep symbol in original case */
- 0xf1, 0xce, 0x20, 0x00, 38 /* set object type relocateable to x */
+ 0xf1, 0xce, 0x20, 0x00, 37, 3, 3, /* Set version 3 rev 3. */
+ 0xf1, 0xce, 0x20, 0x00, 39, 2, /* Keep symbol in original case. */
+ 0xf1, 0xce, 0x20, 0x00, 38 /* Set object type relocatable to x. */
};
static const unsigned char envi[] =
@@ -3572,7 +3606,7 @@ static const unsigned char envi[] =
/* 0xf1, 0xce, 0x21, 0, 54, 2,1,1 tool & version # */
};
-static boolean
+static bfd_boolean
ieee_write_me_part (abfd)
bfd *abfd;
{
@@ -3584,17 +3618,17 @@ ieee_write_me_part (abfd)
|| ! ieee_write_byte (abfd, ieee_function_either_open_b_enum)
|| ! ieee_write_int (abfd, abfd->start_address)
|| ! ieee_write_byte (abfd, ieee_function_either_close_b_enum))
- return false;
+ return FALSE;
}
ieee->w.r.me_record = bfd_tell (abfd);
if (! ieee_write_byte (abfd, ieee_module_end_enum))
- return false;
- return true;
+ return FALSE;
+ return TRUE;
}
/* Write out the IEEE processor ID. */
-static boolean
+static bfd_boolean
ieee_write_processor (abfd)
bfd *abfd;
{
@@ -3605,22 +3639,22 @@ ieee_write_processor (abfd)
{
default:
if (! ieee_write_id (abfd, bfd_printable_name (abfd)))
- return false;
+ return FALSE;
break;
case bfd_arch_a29k:
if (! ieee_write_id (abfd, "29000"))
- return false;
+ return FALSE;
break;
case bfd_arch_h8300:
if (! ieee_write_id (abfd, "H8/300"))
- return false;
+ return FALSE;
break;
case bfd_arch_h8500:
if (! ieee_write_id (abfd, "H8/500"))
- return false;
+ return FALSE;
break;
case bfd_arch_i960:
@@ -3630,23 +3664,23 @@ ieee_write_processor (abfd)
case bfd_mach_i960_core:
case bfd_mach_i960_ka_sa:
if (! ieee_write_id (abfd, "80960KA"))
- return false;
+ return FALSE;
break;
case bfd_mach_i960_kb_sb:
if (! ieee_write_id (abfd, "80960KB"))
- return false;
+ return FALSE;
break;
case bfd_mach_i960_ca:
if (! ieee_write_id (abfd, "80960CA"))
- return false;
+ return FALSE;
break;
case bfd_mach_i960_mc:
case bfd_mach_i960_xa:
if (! ieee_write_id (abfd, "80960MC"))
- return false;
+ return FALSE;
break;
}
break;
@@ -3670,18 +3704,19 @@ ieee_write_processor (abfd)
case bfd_mach_mcf5206e:id = "5206e"; break;
case bfd_mach_mcf5307:id = "5307"; break;
case bfd_mach_mcf5407:id = "5407"; break;
+ case bfd_mach_mcf528x:id = "5282"; break;
}
if (! ieee_write_id (abfd, id))
- return false;
+ return FALSE;
}
break;
}
- return true;
+ return TRUE;
}
-static boolean
+static bfd_boolean
ieee_write_object_contents (abfd)
bfd *abfd;
{
@@ -3689,51 +3724,51 @@ ieee_write_object_contents (abfd)
unsigned int i;
file_ptr old;
- /* Fast forward over the header area */
+ /* Fast forward over the header area. */
if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0)
- return false;
+ return FALSE;
if (! ieee_write_byte (abfd, ieee_module_beginning_enum)
|| ! ieee_write_processor (abfd)
|| ! ieee_write_id (abfd, abfd->filename))
- return false;
+ return FALSE;
- /* Fast forward over the variable bits */
+ /* Fast forward over the variable bits. */
if (! ieee_write_byte (abfd, ieee_address_descriptor_enum))
- return false;
+ return FALSE;
- /* Bits per MAU */
+ /* Bits per MAU. */
if (! ieee_write_byte (abfd, (bfd_byte) (bfd_arch_bits_per_byte (abfd))))
- return false;
- /* MAU's per address */
+ return FALSE;
+ /* MAU's per address. */
if (! ieee_write_byte (abfd,
(bfd_byte) (bfd_arch_bits_per_address (abfd)
/ bfd_arch_bits_per_byte (abfd))))
- return false;
+ return FALSE;
old = bfd_tell (abfd);
if (bfd_seek (abfd, (file_ptr) (8 * N_W_VARIABLES), SEEK_CUR) != 0)
- return false;
+ return FALSE;
ieee->w.r.extension_record = bfd_tell (abfd);
if (bfd_bwrite ((char *) exten, (bfd_size_type) sizeof (exten), abfd)
!= sizeof (exten))
- return false;
+ return FALSE;
if (abfd->flags & EXEC_P)
{
if (! ieee_write_byte (abfd, 0x1)) /* Absolute */
- return false;
+ return FALSE;
}
else
{
if (! ieee_write_byte (abfd, 0x2)) /* Relocateable */
- return false;
+ return FALSE;
}
ieee->w.r.environmental_record = bfd_tell (abfd);
if (bfd_bwrite ((char *) envi, (bfd_size_type) sizeof (envi), abfd)
!= sizeof (envi))
- return false;
+ return FALSE;
/* The HP emulator database requires a timestamp in the file. */
{
@@ -3752,7 +3787,7 @@ ieee_write_object_contents (abfd)
|| ! ieee_write_int (abfd, (bfd_vma) t->tm_hour)
|| ! ieee_write_int (abfd, (bfd_vma) t->tm_min)
|| ! ieee_write_int (abfd, (bfd_vma) t->tm_sec))
- return false;
+ return FALSE;
}
output_bfd = abfd;
@@ -3760,51 +3795,46 @@ ieee_write_object_contents (abfd)
flush ();
if (! ieee_write_section_part (abfd))
- return false;
+ return FALSE;
/* First write the symbols. This changes their values into table
indeces so we cant use it after this point. */
if (! ieee_write_external_part (abfd))
- return false;
-
- /* ieee_write_byte(abfd, ieee_record_seperator_enum);*/
-
- /* ieee_write_byte(abfd, ieee_record_seperator_enum);*/
-
+ return FALSE;
/* Write any debugs we have been told about. */
if (! ieee_write_debug_part (abfd))
- return false;
+ return FALSE;
/* Can only write the data once the symbols have been written, since
the data contains relocation information which points to the
symbols. */
if (! ieee_write_data_part (abfd))
- return false;
+ return FALSE;
/* At the end we put the end! */
if (! ieee_write_me_part (abfd))
- return false;
+ return FALSE;
- /* Generate the header */
+ /* Generate the header. */
if (bfd_seek (abfd, old, SEEK_SET) != 0)
- return false;
+ return FALSE;
for (i = 0; i < N_W_VARIABLES; i++)
{
if (! ieee_write_2bytes (abfd, ieee_assign_value_to_variable_enum)
|| ! ieee_write_byte (abfd, (bfd_byte) i)
|| ! ieee_write_int5_out (abfd, (bfd_vma) ieee->w.offset[i]))
- return false;
+ return FALSE;
}
- return true;
+ return TRUE;
}
/* Native-level interface to symbols. */
/* We read the symbols into a buffer, which is discarded when this
function exits. We read the strings into a buffer large enough to
- hold them all plus all the cached symbol entries. */
+ hold them all plus all the cached symbol entries. */
static asymbol *
ieee_make_empty_symbol (abfd)
@@ -3812,6 +3842,7 @@ ieee_make_empty_symbol (abfd)
{
bfd_size_type amt = sizeof (ieee_symbol_type);
ieee_symbol_type *new = (ieee_symbol_type *) bfd_zalloc (abfd, amt);
+
if (!new)
return NULL;
new->symbol.the_bfd = abfd;
@@ -3824,15 +3855,16 @@ ieee_openr_next_archived_file (arch, prev)
bfd *prev;
{
ieee_ar_data_type *ar = IEEE_AR_DATA (arch);
- /* take the next one from the arch state, or reset */
+
+ /* Take the next one from the arch state, or reset. */
if (prev == (bfd *) NULL)
- {
- /* Reset the index - the first two entries are bogus*/
- ar->element_index = 2;
- }
- while (true)
+ /* Reset the index - the first two entries are bogus. */
+ ar->element_index = 2;
+
+ while (TRUE)
{
ieee_ar_obstack_type *p = ar->elements + ar->element_index;
+
ar->element_index++;
if (ar->element_index <= ar->element_count)
{
@@ -3851,11 +3883,10 @@ ieee_openr_next_archived_file (arch, prev)
bfd_set_error (bfd_error_no_more_archived_files);
return (bfd *) NULL;
}
-
}
}
-static boolean
+static bfd_boolean
ieee_find_nearest_line (abfd, section, symbols, offset, filename_ptr,
functionname_ptr, line_ptr)
bfd *abfd ATTRIBUTE_UNUSED;
@@ -3866,7 +3897,7 @@ ieee_find_nearest_line (abfd, section, symbols, offset, filename_ptr,
const char **functionname_ptr ATTRIBUTE_UNUSED;
unsigned int *line_ptr ATTRIBUTE_UNUSED;
{
- return false;
+ return FALSE;
}
static int
@@ -3904,7 +3935,7 @@ ieee_generic_stat_arch_elt (abfd, buf)
static int
ieee_sizeof_headers (abfd, x)
bfd *abfd ATTRIBUTE_UNUSED;
- boolean x ATTRIBUTE_UNUSED;
+ bfd_boolean x ATTRIBUTE_UNUSED;
{
return 0;
}
@@ -3929,8 +3960,7 @@ ieee_bfd_debug_info_end (abfd)
/* Add this section to the list of sections we have debug info for, to
- be ready to output it at close time
- */
+ be ready to output it at close time. */
static void
ieee_bfd_debug_info_accumulate (abfd, section)
bfd *abfd;
@@ -3938,37 +3968,34 @@ ieee_bfd_debug_info_accumulate (abfd, 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 */
+
+ /* Can only accumulate data from other ieee bfds. */
if (section->owner->xvec != abfd->xvec)
return;
- /* Only bother once per bfd */
+ /* Only bother once per bfd. */
if (ieee->done_debug)
return;
- ieee->done_debug = true;
+ ieee->done_debug = TRUE;
- /* Don't bother if there is no debug info */
+ /* Don't bother if there is no debug info. */
if (ieee->w.r.debug_information_part == 0)
return;
-
- /* Add to chain */
+ /* 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;
- }
+ output_ieee->chain_head->next = n;
else
- {
- output_ieee->chain_root = n;
+ output_ieee->chain_root = n;
- }
output_ieee->chain_head = n;
}
}
@@ -3981,11 +4008,12 @@ ieee_bfd_debug_info_accumulate (abfd, section)
#define ieee_slurp_armap bfd_true
#define ieee_slurp_extended_name_table bfd_true
#define ieee_construct_extended_name_table \
- ((boolean (*) PARAMS ((bfd *, char **, bfd_size_type *, const char **))) \
+ ((bfd_boolean (*) \
+ PARAMS ((bfd *, char **, bfd_size_type *, const char **))) \
bfd_true)
#define ieee_truncate_arname bfd_dont_truncate_arname
#define ieee_write_armap \
- ((boolean (*) \
+ ((bfd_boolean (*) \
PARAMS ((bfd *, unsigned int, struct orl *, unsigned int, int))) \
bfd_true)
#define ieee_read_ar_hdr bfd_nullvoidptr
@@ -4017,7 +4045,6 @@ ieee_bfd_debug_info_accumulate (abfd, section)
#define ieee_bfd_final_link _bfd_generic_final_link
#define ieee_bfd_link_split_section _bfd_generic_link_split_section
-/*SUPPRESS 460 */
const bfd_target ieee_vec =
{
"ieee", /* name */
@@ -4071,10 +4098,11 @@ const bfd_target ieee_vec =
ieee_update_armap_timestamp */
BFD_JUMP_TABLE_ARCHIVE (ieee),
- /* ieee_get_symtab_upper_bound, ieee_get_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_get_symtab_upper_bound, ieee_canonicalize_symtab,
+ ieee_make_empty_symbol, ieee_print_symbol, ieee_get_symbol_info,
+ ieee_bfd_is_local_label_name, ieee_get_lineno,
+ ieee_find_nearest_line, ieee_bfd_make_debug_symbol,
+ ieee_read_minisymbols, ieee_minisymbol_to_symbol */
BFD_JUMP_TABLE_SYMBOLS (ieee),
/* ieee_get_reloc_upper_bound, ieee_canonicalize_reloc,
diff --git a/contrib/binutils/bfd/ihex.c b/contrib/binutils/bfd/ihex.c
index 8188c01..5d2d47f 100644
--- a/contrib/binutils/bfd/ihex.c
+++ b/contrib/binutils/bfd/ihex.c
@@ -1,5 +1,5 @@
/* BFD back-end for Intel Hex objects.
- Copyright 1995, 1996, 1998, 1999, 2000, 2001, 2002
+ Copyright 1995, 1996, 1998, 1999, 2000, 2001, 2002, 2003
Free Software Foundation, Inc.
Written by Ian Lance Taylor of Cygnus Support <ian@cygnus.com>.
@@ -125,23 +125,32 @@ The MRI compiler uses this, which is a repeat of type 5:
#include "libiberty.h"
#include "safe-ctype.h"
-static void ihex_init PARAMS ((void));
-static boolean ihex_mkobject PARAMS ((bfd *));
-static INLINE int ihex_get_byte PARAMS ((bfd *, boolean *));
-static void ihex_bad_byte PARAMS ((bfd *, unsigned int, int, boolean));
-static boolean ihex_scan PARAMS ((bfd *));
-static const bfd_target *ihex_object_p PARAMS ((bfd *));
-static boolean ihex_read_section PARAMS ((bfd *, asection *, bfd_byte *));
-static boolean ihex_get_section_contents
+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 boolean ihex_set_section_contents
- PARAMS ((bfd *, asection *, PTR, file_ptr, bfd_size_type));
-static boolean ihex_write_record
+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 boolean ihex_write_object_contents PARAMS ((bfd *));
-static boolean ihex_set_arch_mach
+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 *, boolean));
+static int ihex_sizeof_headers
+ PARAMS ((bfd *, bfd_boolean));
/* The number of bytes we put on one line during output. */
@@ -178,18 +187,18 @@ struct ihex_data_struct
static void
ihex_init ()
{
- static boolean inited;
+ static bfd_boolean inited;
if (! inited)
{
- inited = true;
+ inited = TRUE;
hex_init ();
}
}
/* Create an ihex object. */
-static boolean
+static bfd_boolean
ihex_mkobject (abfd)
bfd *abfd;
{
@@ -198,12 +207,12 @@ ihex_mkobject (abfd)
tdata = (struct ihex_data_struct *) bfd_alloc (abfd, amt);
if (tdata == NULL)
- return false;
+ return FALSE;
abfd->tdata.ihex_data = tdata;
tdata->head = NULL;
tdata->tail = NULL;
- return true;
+ return TRUE;
}
/* Read a byte from a BFD. Set *ERRORPTR if an error occurred.
@@ -212,14 +221,14 @@ ihex_mkobject (abfd)
static INLINE int
ihex_get_byte (abfd, errorptr)
bfd *abfd;
- boolean *errorptr;
+ bfd_boolean *errorptr;
{
bfd_byte c;
if (bfd_bread (&c, (bfd_size_type) 1, abfd) != 1)
{
if (bfd_get_error () != bfd_error_file_truncated)
- *errorptr = true;
+ *errorptr = TRUE;
return EOF;
}
@@ -233,7 +242,7 @@ ihex_bad_byte (abfd, lineno, c, error)
bfd *abfd;
unsigned int lineno;
int c;
- boolean error;
+ bfd_boolean error;
{
if (c == EOF)
{
@@ -261,7 +270,7 @@ ihex_bad_byte (abfd, lineno, c, error)
/* Read an Intel hex file and turn it into sections. We create a new
section for each contiguous set of bytes. */
-static boolean
+static bfd_boolean
ihex_scan (abfd)
bfd *abfd;
{
@@ -269,7 +278,7 @@ ihex_scan (abfd)
bfd_vma extbase;
asection *sec;
unsigned int lineno;
- boolean error;
+ bfd_boolean error;
bfd_byte *buf = NULL;
size_t bufsize;
int c;
@@ -283,7 +292,7 @@ ihex_scan (abfd)
extbase = 0;
sec = NULL;
lineno = 1;
- error = false;
+ error = FALSE;
bufsize = 0;
while ((c = ihex_get_byte (abfd, &error)) != EOF)
@@ -407,7 +416,7 @@ ihex_scan (abfd)
abfd->start_address = addr;
if (buf != NULL)
free (buf);
- return true;
+ return TRUE;
case 2:
/* An extended address record. */
@@ -496,12 +505,12 @@ ihex_scan (abfd)
if (buf != NULL)
free (buf);
- return true;
+ return TRUE;
error_return:
if (buf != NULL)
free (buf);
- return false;
+ return FALSE;
}
/* Try to recognize an Intel Hex file. */
@@ -563,7 +572,7 @@ ihex_object_p (abfd)
/* Read the contents of a section in an Intel Hex file. */
-static boolean
+static bfd_boolean
ihex_read_section (abfd, section, contents)
bfd *abfd;
asection *section;
@@ -573,14 +582,14 @@ ihex_read_section (abfd, section, contents)
bfd_byte *p;
bfd_byte *buf = NULL;
size_t bufsize;
- boolean error;
+ bfd_boolean error;
if (bfd_seek (abfd, section->filepos, SEEK_SET) != 0)
goto error_return;
p = contents;
bufsize = 0;
- error = false;
+ error = FALSE;
while ((c = ihex_get_byte (abfd, &error)) != EOF)
{
char hdr[8];
@@ -631,7 +640,7 @@ ihex_read_section (abfd, section, contents)
/* We've read everything in the section. */
if (buf != NULL)
free (buf);
- return true;
+ return TRUE;
}
/* Skip the checksum. */
@@ -651,17 +660,17 @@ ihex_read_section (abfd, section, contents)
if (buf != NULL)
free (buf);
- return true;
+ return TRUE;
error_return:
if (buf != NULL)
free (buf);
- return false;
+ return FALSE;
}
/* Get the contents of a section in an Intel Hex file. */
-static boolean
+static bfd_boolean
ihex_get_section_contents (abfd, section, location, offset, count)
bfd *abfd;
asection *section;
@@ -673,24 +682,24 @@ ihex_get_section_contents (abfd, section, location, offset, count)
{
section->used_by_bfd = bfd_alloc (abfd, section->_raw_size);
if (section->used_by_bfd == NULL)
- return false;
+ return FALSE;
if (! ihex_read_section (abfd, section, section->used_by_bfd))
- return false;
+ return FALSE;
}
memcpy (location, (bfd_byte *) section->used_by_bfd + offset,
(size_t) count);
- return true;
+ return TRUE;
}
/* Set the contents of a section in an Intel Hex file. */
-static boolean
+static bfd_boolean
ihex_set_section_contents (abfd, section, location, offset, count)
bfd *abfd;
asection *section;
- PTR location;
+ const PTR location;
file_ptr offset;
bfd_size_type count;
{
@@ -702,16 +711,16 @@ ihex_set_section_contents (abfd, section, location, offset, count)
if (count == 0
|| (section->flags & SEC_ALLOC) == 0
|| (section->flags & SEC_LOAD) == 0)
- return true;
+ return TRUE;
amt = sizeof (struct ihex_data_list);
n = (struct ihex_data_list *) bfd_alloc (abfd, amt);
if (n == NULL)
- return false;
+ return FALSE;
data = (bfd_byte *) bfd_alloc (abfd, count);
if (data == NULL)
- return false;
+ return FALSE;
memcpy (data, location, (size_t) count);
n->data = data;
@@ -742,12 +751,12 @@ ihex_set_section_contents (abfd, section, location, offset, count)
tdata->tail = n;
}
- return true;
+ return TRUE;
}
/* Write a record out to an Intel Hex file. */
-static boolean
+static bfd_boolean
ihex_write_record (abfd, count, addr, type, data)
bfd *abfd;
size_t count;
@@ -785,14 +794,14 @@ ihex_write_record (abfd, count, addr, type, data)
total = 9 + count * 2 + 4;
if (bfd_bwrite (buf, (bfd_size_type) total, abfd) != total)
- return false;
+ return FALSE;
- return true;
+ return TRUE;
}
/* Write out an Intel Hex file. */
-static boolean
+static bfd_boolean
ihex_write_object_contents (abfd)
bfd *abfd;
{
@@ -834,7 +843,7 @@ ihex_write_object_contents (abfd)
addr[0] = (bfd_byte)(segbase >> 12) & 0xff;
addr[1] = (bfd_byte)(segbase >> 4) & 0xff;
if (! ihex_write_record (abfd, 2, 0, 2, addr))
- return false;
+ return FALSE;
}
else
{
@@ -849,7 +858,7 @@ ihex_write_object_contents (abfd)
addr[0] = 0;
addr[1] = 0;
if (! ihex_write_record (abfd, 2, 0, 2, addr))
- return false;
+ return FALSE;
segbase = 0;
}
@@ -863,12 +872,12 @@ ihex_write_object_contents (abfd)
(_("%s: address 0x%s out of range for Intel Hex file"),
bfd_get_filename (abfd), buf);
bfd_set_error (bfd_error_bad_value);
- return false;
+ return FALSE;
}
addr[0] = (bfd_byte)(extbase >> 24) & 0xff;
addr[1] = (bfd_byte)(extbase >> 16) & 0xff;
if (! ihex_write_record (abfd, 2, 0, 4, addr))
- return false;
+ return FALSE;
}
}
@@ -879,7 +888,7 @@ ihex_write_object_contents (abfd)
now = 0x10000 - rec_addr;
if (! ihex_write_record (abfd, now, rec_addr, 0, p))
- return false;
+ return FALSE;
where += now;
p += now;
@@ -901,7 +910,7 @@ ihex_write_object_contents (abfd)
startbuf[2] = (bfd_byte)(start >> 8) & 0xff;
startbuf[3] = (bfd_byte)start & 0xff;
if (! ihex_write_record (abfd, 4, 0, 3, startbuf))
- return false;
+ return FALSE;
}
else
{
@@ -910,20 +919,20 @@ ihex_write_object_contents (abfd)
startbuf[2] = (bfd_byte)(start >> 8) & 0xff;
startbuf[3] = (bfd_byte)start & 0xff;
if (! ihex_write_record (abfd, 4, 0, 5, startbuf))
- return false;
+ return FALSE;
}
}
if (! ihex_write_record (abfd, 0, 0, 1, NULL))
- return false;
+ return FALSE;
- return true;
+ return TRUE;
}
/* Set the architecture for the output file. The architecture is
irrelevant, so we ignore errors about unknown architectures. */
-static boolean
+static bfd_boolean
ihex_set_arch_mach (abfd, arch, mach)
bfd *abfd;
enum bfd_architecture arch;
@@ -932,18 +941,17 @@ ihex_set_arch_mach (abfd, arch, mach)
if (! bfd_default_set_arch_mach (abfd, arch, mach))
{
if (arch != bfd_arch_unknown)
- return false;
+ return FALSE;
}
- return true;
+ return TRUE;
}
/* Get the size of the headers, for the linker. */
-/*ARGSUSED*/
static int
ihex_sizeof_headers (abfd, exec)
bfd *abfd ATTRIBUTE_UNUSED;
- boolean exec ATTRIBUTE_UNUSED;
+ bfd_boolean exec ATTRIBUTE_UNUSED;
{
return 0;
}
@@ -957,7 +965,7 @@ ihex_sizeof_headers (abfd, exec)
_bfd_generic_get_section_contents_in_window
#define ihex_get_symtab_upper_bound bfd_0l
-#define ihex_get_symtab \
+#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
diff --git a/contrib/binutils/bfd/init.c b/contrib/binutils/bfd/init.c
index 198b979..07401eb 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
+ Copyright 1990, 1991, 1992, 1993, 1994, 1995, 2003
Free Software Foundation, Inc.
Written by Steve Chamberlain of Cygnus Support.
@@ -35,7 +35,7 @@ FUNCTION
bfd_init
SYNOPSIS
- void bfd_init(void);
+ void bfd_init (void);
DESCRIPTION
This routine must be called before any other BFD function to
@@ -46,6 +46,6 @@ DESCRIPTION
However, someday it may be needed, so keep it around. */
void
-bfd_init ()
+bfd_init (void)
{
}
diff --git a/contrib/binutils/bfd/libaout.h b/contrib/binutils/bfd/libaout.h
index a76b935..67054e3 100644
--- a/contrib/binutils/bfd/libaout.h
+++ b/contrib/binutils/bfd/libaout.h
@@ -1,24 +1,24 @@
/* BFD back-end data structures for a.out (and similar) files.
Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
- 2000, 2001
+ 2000, 2001, 2002, 2003
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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#ifndef LIBAOUT_H
#define LIBAOUT_H
@@ -29,51 +29,23 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "bfdlink.h"
-/* Macros for accessing components in an aout header. Saves cluttering
- the source with (bfd_vma) and (bfd_byte *) casts. */
-
-#define H_PUT_64(abfd, val, where) \
- bfd_h_put_64 ((abfd), (bfd_vma) (val), (bfd_byte *) (where))
-
-#define H_PUT_32(abfd, val, where) \
- bfd_h_put_32 ((abfd), (bfd_vma) (val), (bfd_byte *) (where))
-
-#define H_PUT_16(abfd, val, where) \
- bfd_h_put_16 ((abfd), (bfd_vma) (val), (bfd_byte *) (where))
+/* Macros for accessing components in an aout header. */
+#define H_PUT_64 bfd_h_put_64
+#define H_PUT_32 bfd_h_put_32
+#define H_PUT_16 bfd_h_put_16
#define H_PUT_8 bfd_h_put_8
-
-#define H_PUT_S64(abfd, val, where) \
- bfd_h_put_signed_64 ((abfd), (bfd_vma) (val), (bfd_byte *) (where))
-
-#define H_PUT_S32(abfd, val, where) \
- bfd_h_put_signed_32 ((abfd), (bfd_vma) (val), (bfd_byte *) (where))
-
-#define H_PUT_S16(abfd, val, where) \
- bfd_h_put_signed_16 ((abfd), (bfd_vma) (val), (bfd_byte *) (where))
-
+#define H_PUT_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(abfd, where) \
- bfd_h_get_64 ((abfd), (bfd_byte *) (where))
-
-#define H_GET_32(abfd, where) \
- bfd_h_get_32 ((abfd), (bfd_byte *) (where))
-
-#define H_GET_16(abfd, where) \
- bfd_h_get_16 ((abfd), (bfd_byte *) (where))
-
+#define H_GET_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(abfd, where) \
- bfd_h_get_signed_64 ((abfd), (bfd_byte *) (where))
-
-#define H_GET_S32(abfd, where) \
- bfd_h_get_signed_32 ((abfd), (bfd_byte *) (where))
-
-#define H_GET_S16(abfd, where) \
- bfd_h_get_signed_16 ((abfd), (bfd_byte *) (where))
-
+#define H_GET_S64 bfd_h_get_signed_64
+#define H_GET_S32 bfd_h_get_signed_32
+#define H_GET_S16 bfd_h_get_signed_16
#define H_GET_S8 bfd_h_get_signed_8
/* Parameterize the a.out code based on whether it is being built
@@ -131,7 +103,7 @@ struct aout_link_hash_entry
{
struct bfd_link_hash_entry root;
/* Whether this symbol has been written out. */
- boolean written;
+ bfd_boolean written;
/* Symbol index in output file. */
int indx;
};
@@ -154,7 +126,7 @@ struct aout_link_hash_table
#define aout_link_hash_traverse(table, func, info) \
(bfd_link_hash_traverse \
(&(table)->root, \
- (boolean (*) PARAMS ((struct bfd_link_hash_entry *, PTR))) (func), \
+ (bfd_boolean (*) PARAMS ((struct bfd_link_hash_entry *, PTR))) (func), \
(info)))
/* Get the a.out link hash table from the info structure. This is
@@ -193,7 +165,7 @@ struct aout_backend_data
/* Callback for setting the page and segment sizes, if they can't be
trivially determined from the architecture. */
- boolean (*set_sizes)
+ bfd_boolean (*set_sizes)
PARAMS ((bfd *));
/* zmagic files only. For go32, the length of the exec header contributes
@@ -203,39 +175,39 @@ struct aout_backend_data
/* Callback from the add symbols phase of the linker code to handle
a dynamic object. */
- boolean (*add_dynamic_symbols)
+ bfd_boolean (*add_dynamic_symbols)
PARAMS ((bfd *, struct bfd_link_info *, struct external_nlist **,
bfd_size_type *, char **));
/* Callback from the add symbols phase of the linker code to handle
adding a single symbol to the global linker hash table. */
- boolean (*add_one_symbol)
+ bfd_boolean (*add_one_symbol)
PARAMS ((struct bfd_link_info *, bfd *, const char *, flagword,
- asection *, bfd_vma, const char *, boolean, boolean,
+ asection *, bfd_vma, const char *, bfd_boolean, bfd_boolean,
struct bfd_link_hash_entry **));
/* Called to handle linking a dynamic object. */
- boolean (*link_dynamic_object)
+ bfd_boolean (*link_dynamic_object)
PARAMS ((struct bfd_link_info *, bfd *));
/* Called for each global symbol being written out by the linker.
This should write out the dynamic symbol information. */
- boolean (*write_dynamic_symbol)
+ bfd_boolean (*write_dynamic_symbol)
PARAMS ((bfd *, struct bfd_link_info *, struct aout_link_hash_entry *));
/* If this callback is not NULL, the linker calls it for each reloc.
RELOC is a pointer to the unswapped reloc. If *SKIP is set to
- true, the reloc will be skipped. *RELOCATION may be changed to
+ TRUE, the reloc will be skipped. *RELOCATION may be changed to
change the effects of the relocation. */
- boolean (*check_dynamic_reloc)
+ 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, boolean *skip,
+ PTR reloc, bfd_byte *contents, bfd_boolean *skip,
bfd_vma *relocation));
/* Called at the end of a link to finish up any dynamic linking
information. */
- boolean (*finish_dynamic_link)
+ bfd_boolean (*finish_dynamic_link)
PARAMS ((bfd *, struct bfd_link_info *));
};
#define aout_backend_info(abfd) \
@@ -282,10 +254,10 @@ enum machine_type {
M_68010 = 1,
M_68020 = 2,
M_SPARC = 3,
- /* skip a bunch so we don't run into any of suns numbers */
- /* make these up for the ns32k*/
- M_NS32032 = (64), /* ns32032 running ? */
- M_NS32532 = (64 + 5), /* ns32532 running mach */
+ /* Skip a bunch so we don't run into any of SUN's numbers. */
+ /* Make these up for the ns32k. */
+ M_NS32032 = (64), /* ns32032 running ? */
+ M_NS32532 = (64 + 5), /* ns32532 running mach */
M_386 = 100,
M_29K = 101, /* AMD 29000 */
@@ -377,7 +349,7 @@ struct aoutdata {
struct internal_exec *hdr; /* exec file header */
aout_symbol_type *symbols; /* symtab for input bfd */
- /* For ease, we do this */
+ /* For ease, we do this. */
asection *textsec;
asection *datasec;
asection *bsssec;
@@ -387,16 +359,16 @@ struct aoutdata {
file_ptr sym_filepos;
file_ptr str_filepos;
- /* Size of a relocation entry in external form */
+ /* Size of a relocation entry in external form. */
unsigned reloc_entry_size;
- /* Size of a symbol table entry in external form */
+ /* Size of a symbol table entry in external form. */
unsigned symbol_entry_size;
- /* Page size - needed for alignment of demand paged files. */
+ /* Page size - needed for alignment of demand paged files. */
unsigned long page_size;
- /* Segment size - needed for alignment of demand paged files. */
+ /* Segment size - needed for alignment of demand paged files. */
unsigned long segment_size;
/* Zmagic disk block size - need to align the start of the text
@@ -406,7 +378,7 @@ struct aoutdata {
unsigned exec_bytes_size;
unsigned vma_adjusted : 1;
- /* used when a bfd supports several highly similar formats */
+ /* Used when a bfd supports several highly similar formats. */
enum
{
default_format = 0,
@@ -471,7 +443,7 @@ struct aout_data_struct {
#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 */
+ macro is only ever applied to an asymbol. */
#define aout_symbol(asymbol) ((aout_symbol_type *)(&(asymbol)->the_bfd))
/* Information we keep for each a.out section. This is currently only
@@ -489,43 +461,43 @@ struct aout_section_data_struct
#define set_aout_section_data(s,v) \
((s)->used_by_bfd = (PTR)&(v)->relocs)
-/* Prototype declarations for functions defined in aoutx.h */
+/* Prototype declarations for functions defined in aoutx.h. */
-extern boolean NAME(aout,squirt_out_relocs)
+extern bfd_boolean NAME(aout,squirt_out_relocs)
PARAMS ((bfd *, asection *));
-extern boolean NAME(aout,make_sections)
+extern bfd_boolean NAME(aout,make_sections)
PARAMS ((bfd *));
extern const bfd_target * NAME(aout,some_aout_object_p)
PARAMS ((bfd *, struct internal_exec *, const bfd_target *(*) (bfd *)));
-extern boolean NAME(aout,mkobject)
+extern bfd_boolean NAME(aout,mkobject)
PARAMS ((bfd *));
extern enum machine_type NAME(aout,machine_type)
- PARAMS ((enum bfd_architecture, unsigned long, boolean *));
+ PARAMS ((enum bfd_architecture, unsigned long, bfd_boolean *));
-extern boolean NAME(aout,set_arch_mach)
+extern bfd_boolean NAME(aout,set_arch_mach)
PARAMS ((bfd *, enum bfd_architecture, unsigned long));
-extern boolean NAME(aout,new_section_hook)
+extern bfd_boolean NAME(aout,new_section_hook)
PARAMS ((bfd *, asection *));
-extern boolean NAME(aout,set_section_contents)
- PARAMS ((bfd *, sec_ptr, PTR, file_ptr, bfd_size_type));
+extern bfd_boolean NAME(aout,set_section_contents)
+ PARAMS ((bfd *, sec_ptr, const PTR, file_ptr, bfd_size_type));
extern asymbol * NAME(aout,make_empty_symbol)
PARAMS ((bfd *));
-extern boolean NAME(aout,translate_symbol_table)
+extern bfd_boolean NAME(aout,translate_symbol_table)
PARAMS ((bfd *, aout_symbol_type *, struct external_nlist *, bfd_size_type,
- char *, bfd_size_type, boolean));
+ char *, bfd_size_type, bfd_boolean));
-extern boolean NAME(aout,slurp_symbol_table)
+extern bfd_boolean NAME(aout,slurp_symbol_table)
PARAMS ((bfd *));
-extern boolean NAME(aout,write_syms)
+extern bfd_boolean NAME(aout,write_syms)
PARAMS ((bfd *));
extern void NAME(aout,reclaim_symbol_table)
@@ -534,7 +506,7 @@ extern void NAME(aout,reclaim_symbol_table)
extern long NAME(aout,get_symtab_upper_bound)
PARAMS ((bfd *));
-extern long NAME(aout,get_symtab)
+extern long NAME(aout,canonicalize_symtab)
PARAMS ((bfd *, asymbol **));
extern void NAME(aout,swap_ext_reloc_in)
@@ -547,7 +519,7 @@ extern void NAME(aout,swap_std_reloc_in)
extern reloc_howto_type * NAME(aout,reloc_type_lookup)
PARAMS ((bfd *, bfd_reloc_code_real_type));
-extern boolean NAME(aout,slurp_reloc_table)
+extern bfd_boolean NAME(aout,slurp_reloc_table)
PARAMS ((bfd *, sec_ptr, asymbol **));
extern long NAME(aout,canonicalize_reloc)
@@ -568,20 +540,20 @@ extern void NAME(aout,print_symbol)
extern void NAME(aout,get_symbol_info)
PARAMS ((bfd *, asymbol *, symbol_info *));
-extern boolean NAME(aout,find_nearest_line)
+extern bfd_boolean NAME(aout,find_nearest_line)
PARAMS ((bfd *, asection *, asymbol **, bfd_vma, const char **,
const char **, unsigned int *));
extern long NAME(aout,read_minisymbols)
- PARAMS ((bfd *, boolean, PTR *, unsigned int *));
+ PARAMS ((bfd *, bfd_boolean, PTR *, unsigned int *));
extern asymbol * NAME(aout,minisymbol_to_symbol)
- PARAMS ((bfd *, boolean, const PTR, asymbol *));
+ PARAMS ((bfd *, bfd_boolean, const PTR, asymbol *));
extern int NAME(aout,sizeof_headers)
- PARAMS ((bfd *, boolean));
+ PARAMS ((bfd *, bfd_boolean));
-extern boolean NAME(aout,adjust_sizes_and_vmas)
+extern bfd_boolean NAME(aout,adjust_sizes_and_vmas)
PARAMS ((bfd *, bfd_size_type *, file_ptr *));
extern void NAME(aout,swap_exec_header_in)
@@ -593,7 +565,7 @@ extern void NAME(aout,swap_exec_header_out)
extern struct bfd_hash_entry * NAME(aout,link_hash_newfunc)
PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, const char *));
-extern boolean NAME(aout,link_hash_table_init)
+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 *,
@@ -602,17 +574,17 @@ extern boolean NAME(aout,link_hash_table_init)
extern struct bfd_link_hash_table * NAME(aout,link_hash_table_create)
PARAMS ((bfd *));
-extern boolean NAME(aout,link_add_symbols)
+extern bfd_boolean NAME(aout,link_add_symbols)
PARAMS ((bfd *, struct bfd_link_info *));
-extern boolean NAME(aout,final_link)
+extern bfd_boolean NAME(aout,final_link)
PARAMS ((bfd *, struct bfd_link_info *,
void (*) (bfd *, file_ptr *, file_ptr *, file_ptr *)));
-extern boolean NAME(aout,bfd_free_cached_info)
+extern bfd_boolean NAME(aout,bfd_free_cached_info)
PARAMS ((bfd *));
-/* A.out uses the generic versions of these routines... */
+/* A.out uses the generic versions of these routines... */
#define aout_16_get_section_contents _bfd_generic_get_section_contents
@@ -647,29 +619,48 @@ extern boolean NAME(aout,bfd_free_cached_info)
if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0 \
|| bfd_bwrite ((PTR) &exec_bytes, (bfd_size_type) EXEC_BYTES_SIZE, \
abfd) != EXEC_BYTES_SIZE) \
- return false; \
- /* Now write out reloc info, followed by syms and strings */ \
+ return FALSE; \
+ /* Now write out reloc info, followed by syms and strings. */ \
\
if (bfd_get_outsymbols (abfd) != (asymbol **) NULL \
&& bfd_get_symcount (abfd) != 0) \
{ \
if (bfd_seek (abfd, (file_ptr) (N_SYMOFF(*execp)), SEEK_SET) != 0)\
- return false; \
+ return FALSE; \
\
if (! NAME(aout,write_syms) (abfd)) \
- return false; \
+ return FALSE; \
} \
\
if (bfd_seek (abfd, (file_ptr) (N_TRELOFF(*execp)), SEEK_SET) != 0) \
- return false; \
+ return FALSE; \
if (!NAME(aout,squirt_out_relocs) (abfd, obj_textsec (abfd))) \
- return false; \
+ return FALSE; \
\
if (bfd_seek (abfd, (file_ptr) (N_DRELOFF(*execp)), SEEK_SET) != 0) \
- return false; \
+ return FALSE; \
if (!NAME(aout,squirt_out_relocs) (abfd, obj_datasec (abfd))) \
- return false; \
+ return FALSE; \
}
#endif
+/* Test if a read-only section can be merged with .text. This is
+ possible if:
+
+ 1. Section has file contents and is read-only.
+ 2. The VMA of the section is after the end of .text and before
+ the start of .data.
+ 3. The image is demand-pageable (otherwise, a_text in the header
+ will not reflect the gap between .text and .data). */
+
+#define aout_section_merge_with_text_p(abfd, sec) \
+ (((sec)->flags & (SEC_HAS_CONTENTS | SEC_READONLY)) == \
+ (SEC_HAS_CONTENTS | SEC_READONLY) \
+ && obj_textsec (abfd) != NULL \
+ && obj_datasec (abfd) != NULL \
+ && (sec)->vma >= (obj_textsec (abfd)->vma + \
+ obj_textsec (abfd)->_cooked_size) \
+ && ((sec)->vma + (sec)->_cooked_size) <= obj_datasec (abfd)->vma \
+ && ((abfd)->flags & D_PAGED) != 0)
+
#endif /* ! defined (LIBAOUT_H) */
diff --git a/contrib/binutils/bfd/libbfd-in.h b/contrib/binutils/bfd/libbfd-in.h
index 776dcd6..10cafef 100644
--- a/contrib/binutils/bfd/libbfd-in.h
+++ b/contrib/binutils/bfd/libbfd-in.h
@@ -1,8 +1,9 @@
/* libbfd.h -- Declarations used by bfd library *implementation*.
(This include file is not for users of the library.)
- Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
- 2000, 2001, 2002
- Free Software Foundation, Inc.
+
+ Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
+ 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
+
Written by Cygnus Support.
This file is part of BFD, the Binary File Descriptor library.
@@ -36,7 +37,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
/* Set a tdata field. Can't use the other macros for this, since they
do casts, and casting to the left of assignment isn't portable. */
-#define set_tdata(bfd, v) ((bfd)->tdata.any = (PTR) (v))
+#define set_tdata(bfd, v) ((bfd)->tdata.any = (v))
/* If BFD_IN_MEMORY is set for a BFD, then the iostream fields points
to an instance of this structure. */
@@ -69,7 +70,7 @@ struct artdata {
archive. */
file_ptr armap_datepos; /* Position within archive to seek to
rewrite the date field. */
- PTR tdata; /* Backend specific information. */
+ void *tdata; /* Backend specific information. */
};
#define bfd_ardata(bfd) ((bfd)->tdata.aout_ar_data)
@@ -83,70 +84,105 @@ struct areltdata {
#define arelt_size(bfd) (((struct areltdata *)((bfd)->arelt_data))->parsed_size)
-extern PTR bfd_malloc PARAMS ((bfd_size_type));
-extern PTR bfd_realloc PARAMS ((PTR, bfd_size_type));
-extern PTR bfd_zmalloc PARAMS ((bfd_size_type));
+extern void *bfd_malloc
+ (bfd_size_type);
+extern void *bfd_realloc
+ (void *, bfd_size_type);
+extern void *bfd_zmalloc
+ (bfd_size_type);
extern bfd_error_handler_type _bfd_error_handler;
/* These routines allocate and free things on the BFD's objalloc. */
-extern PTR bfd_alloc PARAMS ((bfd *, bfd_size_type));
-extern PTR bfd_zalloc PARAMS ((bfd *, bfd_size_type));
-extern void bfd_release PARAMS ((bfd *, PTR));
-
-bfd * _bfd_create_empty_archive_element_shell PARAMS ((bfd *obfd));
-bfd * _bfd_look_for_bfd_in_cache PARAMS ((bfd *, file_ptr));
-boolean _bfd_add_bfd_to_archive_cache PARAMS ((bfd *, file_ptr, bfd *));
-boolean _bfd_generic_mkarchive PARAMS ((bfd *abfd));
-const bfd_target *bfd_generic_archive_p PARAMS ((bfd *abfd));
-boolean bfd_slurp_armap PARAMS ((bfd *abfd));
-boolean bfd_slurp_bsd_armap_f2 PARAMS ((bfd *abfd));
+extern void *bfd_alloc
+ (bfd *, bfd_size_type);
+extern void *bfd_zalloc
+ (bfd *, bfd_size_type);
+extern void bfd_release
+ (bfd *, void *);
+
+bfd * _bfd_create_empty_archive_element_shell
+ (bfd *obfd);
+bfd * _bfd_look_for_bfd_in_cache
+ (bfd *, file_ptr);
+bfd_boolean _bfd_add_bfd_to_archive_cache
+ (bfd *, file_ptr, bfd *);
+bfd_boolean _bfd_generic_mkarchive
+ (bfd *abfd);
+const bfd_target *bfd_generic_archive_p
+ (bfd *abfd);
+bfd_boolean bfd_slurp_armap
+ (bfd *abfd);
+bfd_boolean bfd_slurp_bsd_armap_f2
+ (bfd *abfd);
#define bfd_slurp_bsd_armap bfd_slurp_armap
#define bfd_slurp_coff_armap bfd_slurp_armap
-boolean _bfd_slurp_extended_name_table PARAMS ((bfd *abfd));
-extern boolean _bfd_construct_extended_name_table
- PARAMS ((bfd *, boolean, char **, bfd_size_type *));
-boolean _bfd_write_archive_contents PARAMS ((bfd *abfd));
-boolean _bfd_compute_and_write_armap PARAMS ((bfd *, unsigned int elength));
-bfd *_bfd_get_elt_at_filepos PARAMS ((bfd *archive, file_ptr filepos));
-extern bfd *_bfd_generic_get_elt_at_index PARAMS ((bfd *, symindex));
-bfd * _bfd_new_bfd PARAMS ((void));
-void _bfd_delete_bfd PARAMS ((bfd *));
-
-boolean bfd_false PARAMS ((bfd *ignore));
-boolean bfd_true PARAMS ((bfd *ignore));
-PTR bfd_nullvoidptr PARAMS ((bfd *ignore));
-int bfd_0 PARAMS ((bfd *ignore));
-unsigned int bfd_0u PARAMS ((bfd *ignore));
-long bfd_0l PARAMS ((bfd *ignore));
-long _bfd_n1 PARAMS ((bfd *ignore));
-void bfd_void PARAMS ((bfd *ignore));
-
-bfd *_bfd_new_bfd_contained_in PARAMS ((bfd *));
-const bfd_target *_bfd_dummy_target PARAMS ((bfd *abfd));
-
-void bfd_dont_truncate_arname PARAMS ((bfd *abfd, const char *filename,
- char *hdr));
-void bfd_bsd_truncate_arname PARAMS ((bfd *abfd, const char *filename,
- char *hdr));
-void bfd_gnu_truncate_arname PARAMS ((bfd *abfd, const char *filename,
- char *hdr));
-
-boolean bsd_write_armap PARAMS ((bfd *arch, unsigned int elength,
- struct orl *map, unsigned int orl_count, int stridx));
-
-boolean coff_write_armap PARAMS ((bfd *arch, unsigned int elength,
- struct orl *map, unsigned int orl_count, int stridx));
-
-extern PTR _bfd_generic_read_ar_hdr PARAMS ((bfd *));
-
-extern PTR _bfd_generic_read_ar_hdr_mag PARAMS ((bfd *, const char *));
-
-bfd * bfd_generic_openr_next_archived_file PARAMS ((bfd *archive,
- bfd *last_file));
-
-int bfd_generic_stat_arch_elt PARAMS ((bfd *, struct stat *));
+bfd_boolean _bfd_slurp_extended_name_table
+ (bfd *abfd);
+extern bfd_boolean _bfd_construct_extended_name_table
+ (bfd *, bfd_boolean, char **, bfd_size_type *);
+bfd_boolean _bfd_write_archive_contents
+ (bfd *abfd);
+bfd_boolean _bfd_compute_and_write_armap
+ (bfd *, unsigned int elength);
+bfd *_bfd_get_elt_at_filepos
+ (bfd *archive, file_ptr filepos);
+extern bfd *_bfd_generic_get_elt_at_index
+ (bfd *, symindex);
+bfd * _bfd_new_bfd
+ (void);
+void _bfd_delete_bfd
+ (bfd *);
+
+bfd_boolean bfd_false
+ (bfd *ignore);
+bfd_boolean bfd_true
+ (bfd *ignore);
+void *bfd_nullvoidptr
+ (bfd *ignore);
+int bfd_0
+ (bfd *ignore);
+unsigned int bfd_0u
+ (bfd *ignore);
+long bfd_0l
+ (bfd *ignore);
+long _bfd_n1
+ (bfd *ignore);
+void bfd_void
+ (bfd *ignore);
+
+bfd *_bfd_new_bfd_contained_in
+ (bfd *);
+const bfd_target *_bfd_dummy_target
+ (bfd *abfd);
+
+void bfd_dont_truncate_arname
+ (bfd *abfd, const char *filename, char *hdr);
+void bfd_bsd_truncate_arname
+ (bfd *abfd, const char *filename, char *hdr);
+void bfd_gnu_truncate_arname
+ (bfd *abfd, const char *filename, char *hdr);
+
+bfd_boolean bsd_write_armap
+ (bfd *arch, unsigned int elength, struct orl *map, unsigned int orl_count,
+ int stridx);
+
+bfd_boolean coff_write_armap
+ (bfd *arch, unsigned int elength, struct orl *map, unsigned int orl_count,
+ int stridx);
+
+extern void *_bfd_generic_read_ar_hdr
+ (bfd *);
+
+extern void *_bfd_generic_read_ar_hdr_mag
+ (bfd *, const char *);
+
+bfd * bfd_generic_openr_next_archived_file
+ (bfd *archive, bfd *last_file);
+
+int bfd_generic_stat_arch_elt
+ (bfd *, struct stat *);
#define _bfd_read_ar_hdr(abfd) \
BFD_SEND (abfd, _bfd_read_ar_hdr_fn, (abfd))
@@ -157,35 +193,37 @@ int bfd_generic_stat_arch_elt PARAMS ((bfd *, struct stat *));
#define _bfd_generic_close_and_cleanup bfd_true
#define _bfd_generic_bfd_free_cached_info bfd_true
#define _bfd_generic_new_section_hook \
- ((boolean (*) PARAMS ((bfd *, asection *))) bfd_true)
-extern boolean _bfd_generic_get_section_contents
- PARAMS ((bfd *, asection *, PTR, file_ptr, bfd_size_type));
-extern boolean _bfd_generic_get_section_contents_in_window
- PARAMS ((bfd *, asection *, bfd_window *, file_ptr, bfd_size_type));
+ ((bfd_boolean (*) (bfd *, asection *)) bfd_true)
+extern bfd_boolean _bfd_generic_get_section_contents
+ (bfd *, asection *, void *, file_ptr, bfd_size_type);
+extern bfd_boolean _bfd_generic_get_section_contents_in_window
+ (bfd *, asection *, bfd_window *, file_ptr, bfd_size_type);
/* Generic routines to use for BFD_JUMP_TABLE_COPY. Use
BFD_JUMP_TABLE_COPY (_bfd_generic). */
#define _bfd_generic_bfd_copy_private_bfd_data \
- ((boolean (*) PARAMS ((bfd *, bfd *))) bfd_true)
+ ((bfd_boolean (*) (bfd *, bfd *)) bfd_true)
#define _bfd_generic_bfd_merge_private_bfd_data \
- ((boolean (*) PARAMS ((bfd *, bfd *))) bfd_true)
+ ((bfd_boolean (*) (bfd *, bfd *)) bfd_true)
#define _bfd_generic_bfd_set_private_flags \
- ((boolean (*) PARAMS ((bfd *, flagword))) bfd_true)
+ ((bfd_boolean (*) (bfd *, flagword)) bfd_true)
#define _bfd_generic_bfd_copy_private_section_data \
- ((boolean (*) PARAMS ((bfd *, asection *, bfd *, asection *))) bfd_true)
+ ((bfd_boolean (*) (bfd *, asection *, bfd *, asection *)) bfd_true)
#define _bfd_generic_bfd_copy_private_symbol_data \
- ((boolean (*) PARAMS ((bfd *, asymbol *, bfd *, asymbol *))) bfd_true)
+ ((bfd_boolean (*) (bfd *, asymbol *, bfd *, asymbol *)) bfd_true)
#define _bfd_generic_bfd_print_private_bfd_data \
- ((boolean (*) PARAMS ((bfd *, PTR))) bfd_true)
+ ((bfd_boolean (*) (bfd *, void *)) bfd_true)
/* Routines to use for BFD_JUMP_TABLE_CORE when there is no core file
support. Use BFD_JUMP_TABLE_CORE (_bfd_nocore). */
-extern char *_bfd_nocore_core_file_failing_command PARAMS ((bfd *));
-extern int _bfd_nocore_core_file_failing_signal PARAMS ((bfd *));
-extern boolean _bfd_nocore_core_file_matches_executable_p
- PARAMS ((bfd *, bfd *));
+extern char *_bfd_nocore_core_file_failing_command
+ (bfd *);
+extern int _bfd_nocore_core_file_failing_signal
+ (bfd *);
+extern bfd_boolean _bfd_nocore_core_file_matches_executable_p
+ (bfd *, bfd *);
/* Routines to use for BFD_JUMP_TABLE_ARCHIVE when there is no archive
file support. Use BFD_JUMP_TABLE_ARCHIVE (_bfd_noarchive). */
@@ -193,19 +231,18 @@ extern boolean _bfd_nocore_core_file_matches_executable_p
#define _bfd_noarchive_slurp_armap bfd_false
#define _bfd_noarchive_slurp_extended_name_table bfd_false
#define _bfd_noarchive_construct_extended_name_table \
- ((boolean (*) PARAMS ((bfd *, char **, bfd_size_type *, const char **))) \
+ ((bfd_boolean (*) (bfd *, char **, bfd_size_type *, const char **)) \
bfd_false)
#define _bfd_noarchive_truncate_arname \
- ((void (*) PARAMS ((bfd *, const char *, char *))) bfd_void)
+ ((void (*) (bfd *, const char *, char *)) bfd_void)
#define _bfd_noarchive_write_armap \
- ((boolean (*) \
- PARAMS ((bfd *, unsigned int, struct orl *, unsigned int, int))) \
+ ((bfd_boolean (*) (bfd *, unsigned int, struct orl *, unsigned int, int)) \
bfd_false)
#define _bfd_noarchive_read_ar_hdr bfd_nullvoidptr
#define _bfd_noarchive_openr_next_archived_file \
- ((bfd *(*) PARAMS ((bfd *, bfd *))) bfd_nullvoidptr)
+ ((bfd *(*) (bfd *, bfd *)) bfd_nullvoidptr)
#define _bfd_noarchive_get_elt_at_index \
- ((bfd *(*) PARAMS ((bfd *, symindex))) bfd_nullvoidptr)
+ ((bfd *(*) (bfd *, symindex)) bfd_nullvoidptr)
#define _bfd_noarchive_generic_stat_arch_elt bfd_generic_stat_arch_elt
#define _bfd_noarchive_update_armap_timestamp bfd_false
@@ -215,8 +252,8 @@ extern boolean _bfd_nocore_core_file_matches_executable_p
#define _bfd_archive_bsd_slurp_armap bfd_slurp_bsd_armap
#define _bfd_archive_bsd_slurp_extended_name_table \
_bfd_slurp_extended_name_table
-extern boolean _bfd_archive_bsd_construct_extended_name_table
- PARAMS ((bfd *, char **, bfd_size_type *, const char **));
+extern bfd_boolean _bfd_archive_bsd_construct_extended_name_table
+ (bfd *, char **, bfd_size_type *, const char **);
#define _bfd_archive_bsd_truncate_arname bfd_bsd_truncate_arname
#define _bfd_archive_bsd_write_armap bsd_write_armap
#define _bfd_archive_bsd_read_ar_hdr _bfd_generic_read_ar_hdr
@@ -225,7 +262,8 @@ extern boolean _bfd_archive_bsd_construct_extended_name_table
#define _bfd_archive_bsd_get_elt_at_index _bfd_generic_get_elt_at_index
#define _bfd_archive_bsd_generic_stat_arch_elt \
bfd_generic_stat_arch_elt
-extern boolean _bfd_archive_bsd_update_armap_timestamp PARAMS ((bfd *));
+extern bfd_boolean _bfd_archive_bsd_update_armap_timestamp
+ (bfd *);
/* Routines to use for BFD_JUMP_TABLE_ARCHIVE to get COFF style
archives. Use BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff). */
@@ -233,8 +271,8 @@ extern boolean _bfd_archive_bsd_update_armap_timestamp PARAMS ((bfd *));
#define _bfd_archive_coff_slurp_armap bfd_slurp_coff_armap
#define _bfd_archive_coff_slurp_extended_name_table \
_bfd_slurp_extended_name_table
-extern boolean _bfd_archive_coff_construct_extended_name_table
- PARAMS ((bfd *, char **, bfd_size_type *, const char **));
+extern bfd_boolean _bfd_archive_coff_construct_extended_name_table
+ (bfd *, char **, bfd_size_type *, const char **);
#define _bfd_archive_coff_truncate_arname bfd_dont_truncate_arname
#define _bfd_archive_coff_write_armap coff_write_armap
#define _bfd_archive_coff_read_ar_hdr _bfd_generic_read_ar_hdr
@@ -249,95 +287,89 @@ extern boolean _bfd_archive_coff_construct_extended_name_table
support. Use BFD_JUMP_TABLE_SYMBOLS (_bfd_nosymbols). */
#define _bfd_nosymbols_get_symtab_upper_bound _bfd_n1
-#define _bfd_nosymbols_get_symtab \
- ((long (*) PARAMS ((bfd *, asymbol **))) _bfd_n1)
+#define _bfd_nosymbols_canonicalize_symtab \
+ ((long (*) (bfd *, asymbol **)) _bfd_n1)
#define _bfd_nosymbols_make_empty_symbol _bfd_generic_make_empty_symbol
#define _bfd_nosymbols_print_symbol \
- ((void (*) PARAMS ((bfd *, PTR, asymbol *, bfd_print_symbol_type))) bfd_void)
+ ((void (*) (bfd *, void *, asymbol *, bfd_print_symbol_type)) bfd_void)
#define _bfd_nosymbols_get_symbol_info \
- ((void (*) PARAMS ((bfd *, asymbol *, symbol_info *))) bfd_void)
+ ((void (*) (bfd *, asymbol *, symbol_info *)) bfd_void)
#define _bfd_nosymbols_bfd_is_local_label_name \
- ((boolean (*) PARAMS ((bfd *, const char *))) bfd_false)
+ ((bfd_boolean (*) (bfd *, const char *)) bfd_false)
#define _bfd_nosymbols_get_lineno \
- ((alent *(*) PARAMS ((bfd *, asymbol *))) bfd_nullvoidptr)
+ ((alent *(*) (bfd *, asymbol *)) bfd_nullvoidptr)
#define _bfd_nosymbols_find_nearest_line \
- ((boolean (*) \
- PARAMS ((bfd *, asection *, asymbol **, bfd_vma, const char **, \
- const char **, unsigned int *))) \
+ ((bfd_boolean (*) (bfd *, asection *, asymbol **, bfd_vma, const char **, \
+ const char **, unsigned int *)) \
bfd_false)
#define _bfd_nosymbols_bfd_make_debug_symbol \
- ((asymbol *(*) PARAMS ((bfd *, PTR, unsigned long))) bfd_nullvoidptr)
+ ((asymbol *(*) (bfd *, void *, unsigned long)) bfd_nullvoidptr)
#define _bfd_nosymbols_read_minisymbols \
- ((long (*) PARAMS ((bfd *, boolean, PTR *, unsigned int *))) _bfd_n1)
+ ((long (*) (bfd *, bfd_boolean, void **, unsigned int *)) _bfd_n1)
#define _bfd_nosymbols_minisymbol_to_symbol \
- ((asymbol *(*) PARAMS ((bfd *, boolean, const PTR, asymbol *))) \
+ ((asymbol *(*) (bfd *, bfd_boolean, const void *, asymbol *)) \
bfd_nullvoidptr)
/* Routines to use for BFD_JUMP_TABLE_RELOCS when there is no reloc
support. Use BFD_JUMP_TABLE_RELOCS (_bfd_norelocs). */
#define _bfd_norelocs_get_reloc_upper_bound \
- ((long (*) PARAMS ((bfd *, asection *))) _bfd_n1)
+ ((long (*) (bfd *, asection *)) _bfd_n1)
#define _bfd_norelocs_canonicalize_reloc \
- ((long (*) PARAMS ((bfd *, asection *, arelent **, asymbol **))) _bfd_n1)
+ ((long (*) (bfd *, asection *, arelent **, asymbol **)) _bfd_n1)
#define _bfd_norelocs_bfd_reloc_type_lookup \
- ((reloc_howto_type *(*) PARAMS ((bfd *, bfd_reloc_code_real_type))) \
- bfd_nullvoidptr)
+ ((reloc_howto_type *(*) (bfd *, bfd_reloc_code_real_type)) bfd_nullvoidptr)
/* Routines to use for BFD_JUMP_TABLE_WRITE for targets which may not
be written. Use BFD_JUMP_TABLE_WRITE (_bfd_nowrite). */
#define _bfd_nowrite_set_arch_mach \
- ((boolean (*) PARAMS ((bfd *, enum bfd_architecture, unsigned long))) \
+ ((bfd_boolean (*) (bfd *, enum bfd_architecture, unsigned long)) \
bfd_false)
#define _bfd_nowrite_set_section_contents \
- ((boolean (*) PARAMS ((bfd *, asection *, PTR, file_ptr, bfd_size_type))) \
+ ((bfd_boolean (*) (bfd *, asection *, const void *, file_ptr, bfd_size_type)) \
bfd_false)
/* Generic routines to use for BFD_JUMP_TABLE_WRITE. Use
BFD_JUMP_TABLE_WRITE (_bfd_generic). */
#define _bfd_generic_set_arch_mach bfd_default_set_arch_mach
-extern boolean _bfd_generic_set_section_contents
- PARAMS ((bfd *, asection *, PTR, file_ptr, bfd_size_type));
+extern bfd_boolean _bfd_generic_set_section_contents
+ (bfd *, asection *, const void *, file_ptr, bfd_size_type);
/* Routines to use for BFD_JUMP_TABLE_LINK for targets which do not
support linking. Use BFD_JUMP_TABLE_LINK (_bfd_nolink). */
-#define _bfd_nolink_sizeof_headers ((int (*) PARAMS ((bfd *, boolean))) bfd_0)
+#define _bfd_nolink_sizeof_headers ((int (*) (bfd *, bfd_boolean)) bfd_0)
#define _bfd_nolink_bfd_get_relocated_section_contents \
- ((bfd_byte *(*) \
- PARAMS ((bfd *, struct bfd_link_info *, struct bfd_link_order *, \
- bfd_byte *, boolean, asymbol **))) \
+ ((bfd_byte *(*) (bfd *, struct bfd_link_info *, struct bfd_link_order *, \
+ bfd_byte *, bfd_boolean, asymbol **)) \
bfd_nullvoidptr)
#define _bfd_nolink_bfd_relax_section \
- ((boolean (*) \
- PARAMS ((bfd *, asection *, struct bfd_link_info *, boolean *))) \
+ ((bfd_boolean (*) \
+ (bfd *, asection *, struct bfd_link_info *, bfd_boolean *)) \
bfd_false)
#define _bfd_nolink_bfd_gc_sections \
- ((boolean (*) \
- PARAMS ((bfd *, struct bfd_link_info *))) \
+ ((bfd_boolean (*) (bfd *, struct bfd_link_info *)) \
bfd_false)
#define _bfd_nolink_bfd_merge_sections \
- ((boolean (*) \
- PARAMS ((bfd *, struct bfd_link_info *))) \
+ ((bfd_boolean (*) (bfd *, struct bfd_link_info *)) \
bfd_false)
#define _bfd_nolink_bfd_discard_group \
- ((boolean (*) \
- PARAMS ((bfd *, struct sec *))) \
+ ((bfd_boolean (*) (bfd *, struct bfd_section *)) \
bfd_false)
#define _bfd_nolink_bfd_link_hash_table_create \
- ((struct bfd_link_hash_table *(*) PARAMS ((bfd *))) bfd_nullvoidptr)
+ ((struct bfd_link_hash_table *(*) (bfd *)) bfd_nullvoidptr)
#define _bfd_nolink_bfd_link_hash_table_free \
- ((void (*) PARAMS ((struct bfd_link_hash_table *))) bfd_void)
+ ((void (*) (struct bfd_link_hash_table *)) bfd_void)
#define _bfd_nolink_bfd_link_add_symbols \
- ((boolean (*) PARAMS ((bfd *, struct bfd_link_info *))) bfd_false)
+ ((bfd_boolean (*) (bfd *, struct bfd_link_info *)) bfd_false)
#define _bfd_nolink_bfd_link_just_syms \
- ((void (*) PARAMS ((asection *, struct bfd_link_info *))) bfd_void)
+ ((void (*) (asection *, struct bfd_link_info *)) bfd_void)
#define _bfd_nolink_bfd_final_link \
- ((boolean (*) PARAMS ((bfd *, struct bfd_link_info *))) bfd_false)
+ ((bfd_boolean (*) (bfd *, struct bfd_link_info *)) bfd_false)
#define _bfd_nolink_bfd_link_split_section \
- ((boolean (*) PARAMS ((bfd *, struct sec *))) bfd_false)
+ ((bfd_boolean (*) (bfd *, struct bfd_section *)) bfd_false)
/* Routines to use for BFD_JUMP_TABLE_DYNAMIC for targets which do not
have dynamic symbols or relocs. Use BFD_JUMP_TABLE_DYNAMIC
@@ -345,187 +377,189 @@ extern boolean _bfd_generic_set_section_contents
#define _bfd_nodynamic_get_dynamic_symtab_upper_bound _bfd_n1
#define _bfd_nodynamic_canonicalize_dynamic_symtab \
- ((long (*) PARAMS ((bfd *, asymbol **))) _bfd_n1)
+ ((long (*) (bfd *, asymbol **)) _bfd_n1)
#define _bfd_nodynamic_get_dynamic_reloc_upper_bound _bfd_n1
#define _bfd_nodynamic_canonicalize_dynamic_reloc \
- ((long (*) PARAMS ((bfd *, arelent **, asymbol **))) _bfd_n1)
+ ((long (*) (bfd *, arelent **, asymbol **)) _bfd_n1)
/* Generic routine to determine of the given symbol is a local
label. */
-extern boolean bfd_generic_is_local_label_name PARAMS ((bfd *, const char *));
+extern bfd_boolean bfd_generic_is_local_label_name
+ (bfd *, const char *);
/* Generic minisymbol routines. */
extern long _bfd_generic_read_minisymbols
- PARAMS ((bfd *, boolean, PTR *, unsigned int *));
+ (bfd *, bfd_boolean, void **, unsigned int *);
extern asymbol *_bfd_generic_minisymbol_to_symbol
- PARAMS ((bfd *, boolean, const PTR, asymbol *));
+ (bfd *, bfd_boolean, const void *, asymbol *);
/* Find the nearest line using .stab/.stabstr sections. */
-extern boolean _bfd_stab_section_find_nearest_line
- PARAMS ((bfd *, asymbol **, asection *, bfd_vma, boolean *, const char **,
- const char **, unsigned int *, PTR *));
+extern bfd_boolean _bfd_stab_section_find_nearest_line
+ (bfd *, asymbol **, asection *, bfd_vma, bfd_boolean *,
+ const char **, const char **, unsigned int *, void **);
/* Find the neaderst line using DWARF 1 debugging information. */
-extern boolean _bfd_dwarf1_find_nearest_line
- PARAMS ((bfd *, asection *, asymbol **, bfd_vma, const char **,
- const char **, unsigned int *));
+extern bfd_boolean _bfd_dwarf1_find_nearest_line
+ (bfd *, asection *, asymbol **, bfd_vma, const char **,
+ const char **, unsigned int *);
/* Find the nearest line using DWARF 2 debugging information. */
-extern boolean _bfd_dwarf2_find_nearest_line
- PARAMS ((bfd *, asection *, asymbol **, bfd_vma, const char **,
- const char **, unsigned int *, unsigned int,
- PTR *));
+extern bfd_boolean _bfd_dwarf2_find_nearest_line
+ (bfd *, asection *, asymbol **, bfd_vma, const char **, const char **,
+ unsigned int *, unsigned int, void **);
/* Create a new section entry. */
extern struct bfd_hash_entry *bfd_section_hash_newfunc
- PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, const char *));
+ (struct bfd_hash_entry *, struct bfd_hash_table *, const char *);
/* A routine to create entries for a bfd_link_hash_table. */
extern struct bfd_hash_entry *_bfd_link_hash_newfunc
- PARAMS ((struct bfd_hash_entry *entry,
- struct bfd_hash_table *table,
- const char *string));
+ (struct bfd_hash_entry *entry, struct bfd_hash_table *table,
+ const char *string);
/* Initialize a bfd_link_hash_table. */
-extern boolean _bfd_link_hash_table_init
- PARAMS ((struct bfd_link_hash_table *, bfd *,
- struct bfd_hash_entry *(*) (struct bfd_hash_entry *,
- struct bfd_hash_table *,
- const char *)));
+extern bfd_boolean _bfd_link_hash_table_init
+ (struct bfd_link_hash_table *, bfd *,
+ struct bfd_hash_entry *(*) (struct bfd_hash_entry *,
+ struct bfd_hash_table *,
+ const char *));
/* Generic link hash table creation routine. */
extern struct bfd_link_hash_table *_bfd_generic_link_hash_table_create
- PARAMS ((bfd *));
+ (bfd *);
/* Generic link hash table destruction routine. */
extern void _bfd_generic_link_hash_table_free
- PARAMS ((struct bfd_link_hash_table *));
+ (struct bfd_link_hash_table *);
/* Generic add symbol routine. */
-extern boolean _bfd_generic_link_add_symbols
- PARAMS ((bfd *, struct bfd_link_info *));
+extern bfd_boolean _bfd_generic_link_add_symbols
+ (bfd *, struct bfd_link_info *);
/* Generic add symbol routine. This version is used by targets for
which the linker must collect constructors and destructors by name,
as the collect2 program does. */
-extern boolean _bfd_generic_link_add_symbols_collect
- PARAMS ((bfd *, struct bfd_link_info *));
+extern bfd_boolean _bfd_generic_link_add_symbols_collect
+ (bfd *, struct bfd_link_info *);
/* Generic archive add symbol routine. */
-extern boolean _bfd_generic_link_add_archive_symbols
- PARAMS ((bfd *, struct bfd_link_info *,
- boolean (*checkfn) (bfd *, struct bfd_link_info *, boolean *)));
+extern bfd_boolean _bfd_generic_link_add_archive_symbols
+ (bfd *, struct bfd_link_info *,
+ bfd_boolean (*) (bfd *, struct bfd_link_info *, bfd_boolean *));
/* Forward declaration to avoid prototype errors. */
typedef struct bfd_link_hash_entry _bfd_link_hash_entry;
/* Generic routine to add a single symbol. */
-extern boolean _bfd_generic_link_add_one_symbol
- PARAMS ((struct bfd_link_info *, bfd *, const char *name, flagword,
- asection *, bfd_vma, const char *, boolean copy,
- boolean constructor, struct bfd_link_hash_entry **));
+extern bfd_boolean _bfd_generic_link_add_one_symbol
+ (struct bfd_link_info *, bfd *, const char *name, flagword,
+ asection *, bfd_vma, const char *, bfd_boolean copy,
+ bfd_boolean constructor, struct bfd_link_hash_entry **);
/* Generic routine to mark section as supplying symbols only. */
extern void _bfd_generic_link_just_syms
- PARAMS ((asection *, struct bfd_link_info *));
+ (asection *, struct bfd_link_info *);
/* Generic link routine. */
-extern boolean _bfd_generic_final_link
- PARAMS ((bfd *, struct bfd_link_info *));
+extern bfd_boolean _bfd_generic_final_link
+ (bfd *, struct bfd_link_info *);
-extern boolean _bfd_generic_link_split_section
- PARAMS ((bfd *, struct sec *));
+extern bfd_boolean _bfd_generic_link_split_section
+ (bfd *, struct bfd_section *);
/* Generic reloc_link_order processing routine. */
-extern boolean _bfd_generic_reloc_link_order
- PARAMS ((bfd *, struct bfd_link_info *, asection *,
- struct bfd_link_order *));
+extern bfd_boolean _bfd_generic_reloc_link_order
+ (bfd *, struct bfd_link_info *, asection *, struct bfd_link_order *);
/* Default link order processing routine. */
-extern boolean _bfd_default_link_order
- PARAMS ((bfd *, struct bfd_link_info *, asection *,
- struct bfd_link_order *));
+extern bfd_boolean _bfd_default_link_order
+ (bfd *, struct bfd_link_info *, asection *, struct bfd_link_order *);
/* Count the number of reloc entries in a link order list. */
extern unsigned int _bfd_count_link_order_relocs
- PARAMS ((struct bfd_link_order *));
+ (struct bfd_link_order *);
/* Final link relocation routine. */
extern bfd_reloc_status_type _bfd_final_link_relocate
- PARAMS ((reloc_howto_type *, bfd *, asection *, bfd_byte *,
- bfd_vma, bfd_vma, bfd_vma));
+ (reloc_howto_type *, bfd *, asection *, bfd_byte *,
+ bfd_vma, bfd_vma, bfd_vma);
/* Relocate a particular location by a howto and a value. */
extern bfd_reloc_status_type _bfd_relocate_contents
- PARAMS ((reloc_howto_type *, bfd *, bfd_vma, bfd_byte *));
+ (reloc_howto_type *, bfd *, bfd_vma, bfd_byte *);
/* Link stabs in sections in the first pass. */
-extern boolean _bfd_link_section_stabs
- PARAMS ((bfd *, PTR *, asection *, asection *, PTR *));
+extern bfd_boolean _bfd_link_section_stabs
+ (bfd *, void **, asection *, asection *, void **, bfd_size_type *);
/* Eliminate stabs for discarded functions and symbols. */
-extern boolean _bfd_discard_section_stabs
- PARAMS ((bfd *, asection *, PTR,
- boolean (*) (bfd_vma, PTR), PTR));
+extern bfd_boolean _bfd_discard_section_stabs
+ (bfd *, asection *, void *, bfd_boolean (*) (bfd_vma, void *), void *);
/* Write out the .stab section when linking stabs in sections. */
-extern boolean _bfd_write_section_stabs
- PARAMS ((bfd *, PTR *, asection *, PTR *, bfd_byte *));
+extern bfd_boolean _bfd_write_section_stabs
+ (bfd *, void **, asection *, void **, bfd_byte *);
/* Write out the .stabstr string table when linking stabs in sections. */
-extern boolean _bfd_write_stab_strings PARAMS ((bfd *, PTR *));
+extern bfd_boolean _bfd_write_stab_strings
+ (bfd *, void **);
/* Find an offset within a .stab section when linking stabs in
sections. */
extern bfd_vma _bfd_stab_section_offset
- PARAMS ((bfd *, PTR *, asection *, PTR *, bfd_vma));
+ (bfd *, void **, asection *, void **, bfd_vma);
/* Attempt to merge a SEC_MERGE section. */
-extern boolean _bfd_merge_section
- PARAMS ((bfd *, PTR *, asection *, PTR *));
+extern bfd_boolean _bfd_merge_section
+ (bfd *, void **, asection *, void **);
/* Attempt to merge SEC_MERGE sections. */
-extern boolean _bfd_merge_sections
- PARAMS ((bfd *, PTR, void (*)(bfd *, asection *)));
+extern bfd_boolean _bfd_merge_sections
+ (bfd *, void *, void (*) (bfd *, asection *));
/* Write out a merged section. */
-extern boolean _bfd_write_merged_section
- PARAMS ((bfd *, asection *, PTR));
+extern bfd_boolean _bfd_write_merged_section
+ (bfd *, asection *, void *);
/* Find an offset within a modified SEC_MERGE section. */
extern bfd_vma _bfd_merged_section_offset
- PARAMS ((bfd *, asection **, PTR, bfd_vma, bfd_vma));
+ (bfd *, asection **, void *, bfd_vma, bfd_vma);
/* Create a string table. */
-extern struct bfd_strtab_hash *_bfd_stringtab_init PARAMS ((void));
+extern struct bfd_strtab_hash *_bfd_stringtab_init
+ (void);
/* Create an XCOFF .debug section style string table. */
-extern struct bfd_strtab_hash *_bfd_xcoff_stringtab_init PARAMS ((void));
+extern struct bfd_strtab_hash *_bfd_xcoff_stringtab_init
+ (void);
/* Free a string table. */
-extern void _bfd_stringtab_free PARAMS ((struct bfd_strtab_hash *));
+extern void _bfd_stringtab_free
+ (struct bfd_strtab_hash *);
/* Get the size of a string table. */
-extern bfd_size_type _bfd_stringtab_size PARAMS ((struct bfd_strtab_hash *));
+extern bfd_size_type _bfd_stringtab_size
+ (struct bfd_strtab_hash *);
/* Add a string to a string table. */
extern bfd_size_type _bfd_stringtab_add
- PARAMS ((struct bfd_strtab_hash *, const char *, boolean hash,
- boolean copy));
+ (struct bfd_strtab_hash *, const char *, bfd_boolean hash, bfd_boolean copy);
/* Write out a string table. */
-extern boolean _bfd_stringtab_emit PARAMS ((bfd *, struct bfd_strtab_hash *));
+extern bfd_boolean _bfd_stringtab_emit
+ (bfd *, struct bfd_strtab_hash *);
/* Check that endianness of input and output file match. */
-extern boolean _bfd_generic_verify_endian_match PARAMS ((bfd *, bfd *));
+extern bfd_boolean _bfd_generic_verify_endian_match
+ (bfd *, bfd *);
/* Macros to tell if bfds are read or write enabled.
@@ -536,19 +570,22 @@ extern boolean _bfd_generic_verify_endian_match PARAMS ((bfd *, bfd *));
!bfd_read_p, and only sometimes bfd_write_p.
*/
-#define bfd_read_p(abfd) ((abfd)->direction == read_direction || (abfd)->direction == both_direction)
-#define bfd_write_p(abfd) ((abfd)->direction == write_direction || (abfd)->direction == both_direction)
+#define bfd_read_p(abfd) \
+ ((abfd)->direction == read_direction || (abfd)->direction == both_direction)
+#define bfd_write_p(abfd) \
+ ((abfd)->direction == write_direction || (abfd)->direction == both_direction)
-void bfd_assert PARAMS ((const char*,int));
+void bfd_assert
+ (const char*,int);
#define BFD_ASSERT(x) \
-{ if (!(x)) bfd_assert(__FILE__,__LINE__); }
+ { if (!(x)) bfd_assert(__FILE__,__LINE__); }
#define BFD_FAIL() \
-{ bfd_assert(__FILE__,__LINE__); }
+ { bfd_assert(__FILE__,__LINE__); }
-extern void _bfd_abort PARAMS ((const char *, int, const char *))
- ATTRIBUTE_NORETURN;
+extern void _bfd_abort
+ (const char *, int, const char *) ATTRIBUTE_NORETURN;
/* if gcc >= 2.6, we can give a function name, too */
#if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 6)
@@ -558,7 +595,13 @@ extern void _bfd_abort PARAMS ((const char *, int, const char *))
#undef abort
#define abort() _bfd_abort (__FILE__, __LINE__, __PRETTY_FUNCTION__)
-FILE * bfd_cache_lookup_worker PARAMS ((bfd *));
+/* Manipulate a system FILE but using BFD's "file_ptr", rather than
+ the system "off_t" or "off64_t", as the offset. */
+extern file_ptr real_ftell (FILE *file);
+extern int real_fseek (FILE *file, file_ptr offset, int whence);
+
+FILE * bfd_cache_lookup_worker
+ (bfd *);
extern bfd *bfd_last_cache;
@@ -567,6 +610,9 @@ extern bfd *bfd_last_cache;
extern const bfd_target * const *bfd_target_vector;
extern const bfd_target *bfd_default_vector[];
+/* List of associated target vectors. */
+extern const bfd_target * const *bfd_associated_vector;
+
/* Functions shared by the ECOFF and MIPS ELF backends, which have no
other common header files. */
@@ -574,22 +620,28 @@ extern const bfd_target *bfd_default_vector[];
struct ecoff_find_line;
#endif
-extern boolean _bfd_ecoff_locate_line
- PARAMS ((bfd *, asection *, bfd_vma, struct ecoff_debug_info * const,
- const struct ecoff_debug_swap * const, struct ecoff_find_line *,
- const char **, const char **, unsigned int *));
-extern boolean _bfd_ecoff_get_accumulated_pdr PARAMS ((PTR, bfd_byte *));
-extern boolean _bfd_ecoff_get_accumulated_sym PARAMS ((PTR, bfd_byte *));
-extern boolean _bfd_ecoff_get_accumulated_ss PARAMS ((PTR, bfd_byte *));
-
-extern bfd_vma _bfd_get_gp_value PARAMS ((bfd *));
-extern void _bfd_set_gp_value PARAMS ((bfd *, bfd_vma));
+extern bfd_boolean _bfd_ecoff_locate_line
+ (bfd *, asection *, bfd_vma, struct ecoff_debug_info * const,
+ const struct ecoff_debug_swap * const, struct ecoff_find_line *,
+ const char **, const char **, unsigned int *);
+extern bfd_boolean _bfd_ecoff_get_accumulated_pdr
+ (void *, bfd_byte *);
+extern bfd_boolean _bfd_ecoff_get_accumulated_sym
+ (void *, bfd_byte *);
+extern bfd_boolean _bfd_ecoff_get_accumulated_ss
+ (void *, bfd_byte *);
+
+extern bfd_vma _bfd_get_gp_value
+ (bfd *);
+extern void _bfd_set_gp_value
+ (bfd *, bfd_vma);
/* Function shared by the COFF and ELF SH backends, which have no
other common header files. */
-extern boolean _bfd_sh_align_load_span
- PARAMS ((bfd *, asection *, bfd_byte *,
- boolean (*) (bfd *, asection *, PTR, bfd_byte *, bfd_vma),
- PTR, bfd_vma **, bfd_vma *, bfd_vma, bfd_vma, boolean *));
-
+#ifndef _bfd_sh_align_load_span
+extern bfd_boolean _bfd_sh_align_load_span
+ (bfd *, asection *, bfd_byte *,
+ bfd_boolean (*) (bfd *, asection *, void *, bfd_byte *, bfd_vma),
+ void *, bfd_vma **, bfd_vma *, bfd_vma, bfd_vma, bfd_boolean *);
+#endif
diff --git a/contrib/binutils/bfd/libbfd.c b/contrib/binutils/bfd/libbfd.c
index f21abbc..be090e9 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
+ 2000, 2001, 2002, 2003, 2004
Free Software Foundation, Inc.
Written by Cygnus Support.
@@ -28,8 +28,6 @@
#define getpagesize() 2048
#endif
-static size_t real_read PARAMS ((PTR, size_t, size_t, FILE *));
-
/*
SECTION
Internal functions
@@ -43,52 +41,46 @@ DESCRIPTION
/* A routine which is used in target vectors for unsupported
operations. */
-boolean
-bfd_false (ignore)
- bfd *ignore ATTRIBUTE_UNUSED;
+bfd_boolean
+bfd_false (bfd *ignore ATTRIBUTE_UNUSED)
{
bfd_set_error (bfd_error_invalid_operation);
- return false;
+ return FALSE;
}
/* A routine which is used in target vectors for supported operations
which do not actually do anything. */
-boolean
-bfd_true (ignore)
- bfd *ignore ATTRIBUTE_UNUSED;
+bfd_boolean
+bfd_true (bfd *ignore ATTRIBUTE_UNUSED)
{
- return true;
+ return TRUE;
}
/* A routine which is used in target vectors for unsupported
operations which return a pointer value. */
-PTR
-bfd_nullvoidptr (ignore)
- bfd *ignore ATTRIBUTE_UNUSED;
+void *
+bfd_nullvoidptr (bfd *ignore ATTRIBUTE_UNUSED)
{
bfd_set_error (bfd_error_invalid_operation);
return NULL;
}
int
-bfd_0 (ignore)
- bfd *ignore ATTRIBUTE_UNUSED;
+bfd_0 (bfd *ignore ATTRIBUTE_UNUSED)
{
return 0;
}
unsigned int
-bfd_0u (ignore)
- bfd *ignore ATTRIBUTE_UNUSED;
+bfd_0u (bfd *ignore ATTRIBUTE_UNUSED)
{
return 0;
}
long
-bfd_0l (ignore)
- bfd *ignore ATTRIBUTE_UNUSED;
+bfd_0l (bfd *ignore ATTRIBUTE_UNUSED)
{
return 0;
}
@@ -97,53 +89,48 @@ bfd_0l (ignore)
operations which return -1 on error. */
long
-_bfd_n1 (ignore_abfd)
- bfd *ignore_abfd ATTRIBUTE_UNUSED;
+_bfd_n1 (bfd *ignore_abfd ATTRIBUTE_UNUSED)
{
bfd_set_error (bfd_error_invalid_operation);
return -1;
}
void
-bfd_void (ignore)
- bfd *ignore ATTRIBUTE_UNUSED;
+bfd_void (bfd *ignore ATTRIBUTE_UNUSED)
{
}
-boolean
-_bfd_nocore_core_file_matches_executable_p (ignore_core_bfd, ignore_exec_bfd)
- bfd *ignore_core_bfd ATTRIBUTE_UNUSED;
- bfd *ignore_exec_bfd ATTRIBUTE_UNUSED;
+bfd_boolean
+_bfd_nocore_core_file_matches_executable_p
+ (bfd *ignore_core_bfd ATTRIBUTE_UNUSED,
+ bfd *ignore_exec_bfd ATTRIBUTE_UNUSED)
{
bfd_set_error (bfd_error_invalid_operation);
- return false;
+ return FALSE;
}
/* Routine to handle core_file_failing_command entry point for targets
without core file support. */
char *
-_bfd_nocore_core_file_failing_command (ignore_abfd)
- bfd *ignore_abfd ATTRIBUTE_UNUSED;
+_bfd_nocore_core_file_failing_command (bfd *ignore_abfd ATTRIBUTE_UNUSED)
{
bfd_set_error (bfd_error_invalid_operation);
- return (char *)NULL;
+ return NULL;
}
/* Routine to handle core_file_failing_signal entry point for targets
without core file support. */
int
-_bfd_nocore_core_file_failing_signal (ignore_abfd)
- bfd *ignore_abfd ATTRIBUTE_UNUSED;
+_bfd_nocore_core_file_failing_signal (bfd *ignore_abfd ATTRIBUTE_UNUSED)
{
bfd_set_error (bfd_error_invalid_operation);
return 0;
}
const bfd_target *
-_bfd_dummy_target (ignore_abfd)
- bfd *ignore_abfd ATTRIBUTE_UNUSED;
+_bfd_dummy_target (bfd *ignore_abfd ATTRIBUTE_UNUSED)
{
bfd_set_error (bfd_error_wrong_format);
return 0;
@@ -151,11 +138,10 @@ _bfd_dummy_target (ignore_abfd)
/* Allocate memory using malloc. */
-PTR
-bfd_malloc (size)
- bfd_size_type size;
+void *
+bfd_malloc (bfd_size_type size)
{
- PTR ptr;
+ void *ptr;
if (size != (size_t) size)
{
@@ -163,7 +149,7 @@ bfd_malloc (size)
return NULL;
}
- ptr = (PTR) malloc ((size_t) size);
+ ptr = malloc ((size_t) size);
if (ptr == NULL && (size_t) size != 0)
bfd_set_error (bfd_error_no_memory);
@@ -172,12 +158,10 @@ bfd_malloc (size)
/* Reallocate memory using realloc. */
-PTR
-bfd_realloc (ptr, size)
- PTR ptr;
- bfd_size_type size;
+void *
+bfd_realloc (void *ptr, bfd_size_type size)
{
- PTR ret;
+ void *ret;
if (size != (size_t) size)
{
@@ -186,9 +170,9 @@ bfd_realloc (ptr, size)
}
if (ptr == NULL)
- ret = (PTR) malloc ((size_t) size);
+ ret = malloc ((size_t) size);
else
- ret = (PTR) realloc (ptr, (size_t) size);
+ ret = realloc (ptr, (size_t) size);
if (ret == NULL && (size_t) size != 0)
bfd_set_error (bfd_error_no_memory);
@@ -198,11 +182,10 @@ bfd_realloc (ptr, size)
/* Allocate memory using malloc and clear it. */
-PTR
-bfd_zmalloc (size)
- bfd_size_type size;
+void *
+bfd_zmalloc (bfd_size_type size)
{
- PTR ptr;
+ void *ptr;
if (size != (size_t) size)
{
@@ -210,7 +193,7 @@ bfd_zmalloc (size)
return NULL;
}
- ptr = (PTR) malloc ((size_t) size);
+ ptr = malloc ((size_t) size);
if ((size_t) size != 0)
{
@@ -222,378 +205,12 @@ bfd_zmalloc (size)
return ptr;
}
-
-/* Some IO code */
-
-/* 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 (where, a, b, file)
- PTR where;
- size_t a;
- size_t b;
- FILE *file;
-{
- /* FIXME - this looks like an optimization, but it's really to cover
- up for a feature of some OSs (not solaris - sigh) that
- ld/pe-dll.c takes advantage of (apparently) when it creates BFDs
- internally and tries to link against them. BFD seems to be smart
- enough to realize there are no symbol records in the "file" that
- doesn't exist but attempts to read them anyway. On Solaris,
- attempting to read zero bytes from a NULL file results in a core
- dump, but on other platforms it just returns zero bytes read.
- This makes it to something reasonable. - DJ */
- if (a == 0 || b == 0)
- return 0;
-
-
-#if defined (__VAX) && defined (VMS)
- /* Apparently fread on Vax VMS does not keep the record length
- information. */
- return read (fileno (file), where, a * b);
-#else
- return fread (where, a, b, file);
-#endif
-}
-
-/* Return value is amount read. */
-
-bfd_size_type
-bfd_bread (ptr, size, abfd)
- PTR ptr;
- bfd_size_type size;
- bfd *abfd;
-{
- size_t nread;
-
- if ((abfd->flags & BFD_IN_MEMORY) != 0)
- {
- struct bfd_in_memory *bim;
- bfd_size_type get;
-
- bim = (struct bfd_in_memory *) abfd->iostream;
- get = size;
- if (abfd->where + get > bim->size)
- {
- if (bim->size < (bfd_size_type) abfd->where)
- get = 0;
- else
- get = bim->size - abfd->where;
- bfd_set_error (bfd_error_file_truncated);
- }
- memcpy (ptr, bim->buffer + abfd->where, (size_t) get);
- abfd->where += get;
- return get;
- }
-
- nread = real_read (ptr, 1, (size_t) size, bfd_cache_lookup (abfd));
- if (nread != (size_t) -1)
- abfd->where += nread;
-
- /* Set bfd_error if we did not read as much data as we expected.
-
- If the read failed due to an error set the bfd_error_system_call,
- else set bfd_error_file_truncated.
-
- A BFD backend may wish to override bfd_error_file_truncated to
- provide something more useful (eg. no_symbols or wrong_format). */
- if (nread != size)
- {
- if (ferror (bfd_cache_lookup (abfd)))
- bfd_set_error (bfd_error_system_call);
- else
- bfd_set_error (bfd_error_file_truncated);
- }
-
- return nread;
-}
-
-/* The window support stuff should probably be broken out into
- another file.... */
-/* The idea behind the next and refcount fields is that one mapped
- region can suffice for multiple read-only windows or multiple
- non-overlapping read-write windows. It's not implemented yet
- though. */
-struct _bfd_window_internal {
- struct _bfd_window_internal *next;
- PTR data;
- bfd_size_type size;
- int refcount : 31; /* should be enough... */
- unsigned mapped : 1; /* 1 = mmap, 0 = malloc */
-};
-
-void
-bfd_init_window (windowp)
- bfd_window *windowp;
-{
- windowp->data = 0;
- windowp->i = 0;
- windowp->size = 0;
-}
-
-/* Currently, if USE_MMAP is undefined, none if the window stuff is
- used. Okay, so it's mis-named. At least the command-line option
- "--without-mmap" is more obvious than "--without-windows" or some
- such. */
-#ifdef USE_MMAP
-
-#undef HAVE_MPROTECT /* code's not tested yet */
-
-#if HAVE_MMAP || HAVE_MPROTECT || HAVE_MADVISE
-#include <sys/mman.h>
-#endif
-
-#ifndef MAP_FILE
-#define MAP_FILE 0
-#endif
-
-static int debug_windows;
-
-void
-bfd_free_window (windowp)
- bfd_window *windowp;
-{
- bfd_window_internal *i = windowp->i;
- windowp->i = 0;
- windowp->data = 0;
- if (i == 0)
- return;
- i->refcount--;
- if (debug_windows)
- fprintf (stderr, "freeing window @%p<%p,%lx,%p>\n",
- windowp, windowp->data, windowp->size, windowp->i);
- if (i->refcount != 0)
- return;
-
- if (i->mapped)
- {
-#ifdef HAVE_MMAP
- munmap (i->data, i->size);
- goto no_free;
-#else
- abort ();
-#endif
- }
-#ifdef HAVE_MPROTECT
- mprotect (i->data, i->size, PROT_READ | PROT_WRITE);
-#endif
- free (i->data);
-#ifdef HAVE_MMAP
- no_free:
-#endif
- i->data = 0;
- /* There should be no more references to i at this point. */
- free (i);
-}
-
-static int ok_to_map = 1;
-
-boolean
-bfd_get_file_window (abfd, offset, size, windowp, writable)
- bfd *abfd;
- file_ptr offset;
- bfd_size_type size;
- bfd_window *windowp;
- boolean writable;
-{
- static size_t pagesize;
- bfd_window_internal *i = windowp->i;
- bfd_size_type size_to_alloc = size;
-
- if (debug_windows)
- fprintf (stderr, "bfd_get_file_window (%p, %6ld, %6ld, %p<%p,%lx,%p>, %d)",
- abfd, (long) offset, (long) size,
- windowp, windowp->data, (unsigned long) windowp->size,
- windowp->i, writable);
-
- /* Make sure we know the page size, so we can be friendly to mmap. */
- if (pagesize == 0)
- pagesize = getpagesize ();
- if (pagesize == 0)
- abort ();
-
- if (i == 0)
- {
- i = ((bfd_window_internal *)
- bfd_zmalloc ((bfd_size_type) sizeof (bfd_window_internal)));
- windowp->i = i;
- if (i == 0)
- return false;
- i->data = 0;
- }
-#ifdef HAVE_MMAP
- if (ok_to_map
- && (i->data == 0 || i->mapped == 1)
- && (abfd->flags & BFD_IN_MEMORY) == 0)
- {
- file_ptr file_offset, offset2;
- size_t real_size;
- int fd;
- FILE *f;
-
- /* Find the real file and the real offset into it. */
- while (abfd->my_archive != NULL)
- {
- offset += abfd->origin;
- abfd = abfd->my_archive;
- }
- f = bfd_cache_lookup (abfd);
- fd = fileno (f);
-
- /* Compute offsets and size for mmap and for the user's data. */
- offset2 = offset % pagesize;
- if (offset2 < 0)
- abort ();
- file_offset = offset - offset2;
- real_size = offset + size - file_offset;
- real_size = real_size + pagesize - 1;
- real_size -= real_size % pagesize;
-
- /* If we're re-using a memory region, make sure it's big enough. */
- if (i->data && i->size < size)
- {
- munmap (i->data, i->size);
- i->data = 0;
- }
- i->data = mmap (i->data, real_size,
- writable ? PROT_WRITE | PROT_READ : PROT_READ,
- (writable
- ? MAP_FILE | MAP_PRIVATE
- : MAP_FILE | MAP_SHARED),
- fd, file_offset);
- if (i->data == (PTR) -1)
- {
- /* An error happened. Report it, or try using malloc, or
- something. */
- bfd_set_error (bfd_error_system_call);
- i->data = 0;
- windowp->data = 0;
- if (debug_windows)
- fprintf (stderr, "\t\tmmap failed!\n");
- return false;
- }
- if (debug_windows)
- fprintf (stderr, "\n\tmapped %ld at %p, offset is %ld\n",
- (long) real_size, i->data, (long) offset2);
- i->size = real_size;
- windowp->data = (PTR) ((bfd_byte *) i->data + offset2);
- windowp->size = size;
- i->mapped = 1;
- return true;
- }
- else if (debug_windows)
- {
- if (ok_to_map)
- fprintf (stderr, _("not mapping: data=%lx mapped=%d\n"),
- (unsigned long) i->data, (int) i->mapped);
- else
- fprintf (stderr, _("not mapping: env var not set\n"));
- }
-#else
- ok_to_map = 0;
-#endif
-
-#ifdef HAVE_MPROTECT
- if (!writable)
- {
- size_to_alloc += pagesize - 1;
- size_to_alloc -= size_to_alloc % pagesize;
- }
-#endif
- if (debug_windows)
- fprintf (stderr, "\n\t%s(%6ld)",
- i->data ? "realloc" : " malloc", (long) size_to_alloc);
- i->data = (PTR) bfd_realloc (i->data, size_to_alloc);
- if (debug_windows)
- fprintf (stderr, "\t-> %p\n", i->data);
- i->refcount = 1;
- if (i->data == NULL)
- {
- if (size_to_alloc == 0)
- return true;
- return false;
- }
- if (bfd_seek (abfd, offset, SEEK_SET) != 0)
- return false;
- i->size = bfd_bread (i->data, size, abfd);
- if (i->size != size)
- return false;
- i->mapped = 0;
-#ifdef HAVE_MPROTECT
- if (!writable)
- {
- if (debug_windows)
- fprintf (stderr, "\tmprotect (%p, %ld, PROT_READ)\n", i->data,
- (long) i->size);
- mprotect (i->data, i->size, PROT_READ);
- }
-#endif
- windowp->data = i->data;
- windowp->size = i->size;
- return true;
-}
-
-#endif /* USE_MMAP */
-
-bfd_size_type
-bfd_bwrite (ptr, size, abfd)
- const PTR ptr;
- bfd_size_type size;
- bfd *abfd;
-{
- size_t nwrote;
-
- if ((abfd->flags & BFD_IN_MEMORY) != 0)
- {
- struct bfd_in_memory *bim = (struct bfd_in_memory *) (abfd->iostream);
- size = (size_t) size;
- if (abfd->where + size > bim->size)
- {
- bfd_size_type newsize, oldsize;
-
- oldsize = (bim->size + 127) & ~(bfd_size_type) 127;
- bim->size = abfd->where + size;
- /* Round up to cut down on memory fragmentation */
- newsize = (bim->size + 127) & ~(bfd_size_type) 127;
- if (newsize > oldsize)
- {
- bim->buffer = (bfd_byte *) bfd_realloc (bim->buffer, newsize);
- if (bim->buffer == 0)
- {
- bim->size = 0;
- return 0;
- }
- }
- }
- memcpy (bim->buffer + abfd->where, ptr, (size_t) size);
- abfd->where += size;
- return size;
- }
-
- nwrote = fwrite (ptr, 1, (size_t) size, bfd_cache_lookup (abfd));
- if (nwrote != (size_t) -1)
- abfd->where += nwrote;
- if (nwrote != size)
- {
-#ifdef ENOSPC
- errno = ENOSPC;
-#endif
- bfd_set_error (bfd_error_system_call);
- }
- return nwrote;
-}
-
/*
INTERNAL_FUNCTION
bfd_write_bigendian_4byte_int
SYNOPSIS
- boolean bfd_write_bigendian_4byte_int (bfd *, unsigned int);
+ bfd_boolean bfd_write_bigendian_4byte_int (bfd *, unsigned int);
DESCRIPTION
Write a 4 byte integer @var{i} to the output BFD @var{abfd}, in big
@@ -601,196 +218,14 @@ DESCRIPTION
archives.
*/
-boolean
-bfd_write_bigendian_4byte_int (abfd, i)
- bfd *abfd;
- unsigned int i;
+bfd_boolean
+bfd_write_bigendian_4byte_int (bfd *abfd, unsigned int i)
{
bfd_byte buffer[4];
bfd_putb32 ((bfd_vma) i, buffer);
- return (boolean) (bfd_bwrite ((PTR) buffer, (bfd_size_type) 4, abfd) == 4);
-}
-
-bfd_vma
-bfd_tell (abfd)
- bfd *abfd;
-{
- file_ptr ptr;
-
- if ((abfd->flags & BFD_IN_MEMORY) != 0)
- return abfd->where;
-
- ptr = ftell (bfd_cache_lookup (abfd));
-
- if (abfd->my_archive)
- ptr -= abfd->origin;
- abfd->where = ptr;
- return ptr;
-}
-
-int
-bfd_flush (abfd)
- bfd *abfd;
-{
- if ((abfd->flags & BFD_IN_MEMORY) != 0)
- return 0;
- return fflush (bfd_cache_lookup(abfd));
-}
-
-/* Returns 0 for success, negative value for failure (in which case
- bfd_get_error can retrieve the error code). */
-int
-bfd_stat (abfd, statbuf)
- bfd *abfd;
- struct stat *statbuf;
-{
- FILE *f;
- int result;
-
- if ((abfd->flags & BFD_IN_MEMORY) != 0)
- abort ();
-
- f = bfd_cache_lookup (abfd);
- if (f == NULL)
- {
- bfd_set_error (bfd_error_system_call);
- return -1;
- }
- result = fstat (fileno (f), statbuf);
- if (result < 0)
- bfd_set_error (bfd_error_system_call);
- return result;
+ return bfd_bwrite (buffer, (bfd_size_type) 4, abfd) == 4;
}
-/* Returns 0 for success, nonzero for failure (in which case bfd_get_error
- can retrieve the error code). */
-
-int
-bfd_seek (abfd, position, direction)
- bfd *abfd;
- file_ptr position;
- int direction;
-{
- int result;
- FILE *f;
- long file_position;
- /* For the time being, a BFD may not seek to it's end. The problem
- is that we don't easily have a way to recognize the end of an
- element in an archive. */
-
- BFD_ASSERT (direction == SEEK_SET || direction == SEEK_CUR);
-
- if (direction == SEEK_CUR && position == 0)
- return 0;
-
- if ((abfd->flags & BFD_IN_MEMORY) != 0)
- {
- struct bfd_in_memory *bim;
-
- bim = (struct bfd_in_memory *) abfd->iostream;
-
- if (direction == SEEK_SET)
- abfd->where = position;
- else
- abfd->where += position;
-
- if (abfd->where > bim->size)
- {
- if ((abfd->direction == write_direction) ||
- (abfd->direction == both_direction))
- {
- bfd_size_type newsize, oldsize;
- oldsize = (bim->size + 127) & ~(bfd_size_type) 127;
- bim->size = abfd->where;
- /* Round up to cut down on memory fragmentation */
- newsize = (bim->size + 127) & ~(bfd_size_type) 127;
- if (newsize > oldsize)
- {
- bim->buffer = (bfd_byte *) bfd_realloc (bim->buffer, newsize);
- if (bim->buffer == 0)
- {
- bim->size = 0;
- return -1;
- }
- }
- }
- else
- {
- abfd->where = bim->size;
- bfd_set_error (bfd_error_file_truncated);
- return -1;
- }
- }
- return 0;
- }
-
- if (abfd->format != bfd_archive && abfd->my_archive == 0)
- {
-#if 0
- /* Explanation for this code: I'm only about 95+% sure that the above
- conditions are sufficient and that all i/o calls are properly
- adjusting the `where' field. So this is sort of an `assert'
- that the `where' field is correct. If we can go a while without
- tripping the abort, we can probably safely disable this code,
- so that the real optimizations happen. */
- file_ptr where_am_i_now;
- where_am_i_now = ftell (bfd_cache_lookup (abfd));
- if (abfd->my_archive)
- where_am_i_now -= abfd->origin;
- if (where_am_i_now != abfd->where)
- abort ();
-#endif
- if (direction == SEEK_SET && (bfd_vma) position == abfd->where)
- return 0;
- }
- else
- {
- /* We need something smarter to optimize access to archives.
- Currently, anything inside an archive is read via the file
- handle for the archive. Which means that a bfd_seek on one
- component affects the `current position' in the archive, as
- well as in any other component.
-
- It might be sufficient to put a spike through the cache
- abstraction, and look to the archive for the file position,
- but I think we should try for something cleaner.
-
- In the meantime, no optimization for archives. */
- }
-
- f = bfd_cache_lookup (abfd);
- file_position = position;
- if (direction == SEEK_SET && abfd->my_archive != NULL)
- file_position += abfd->origin;
-
- result = fseek (f, file_position, direction);
- if (result != 0)
- {
- int hold_errno = errno;
-
- /* Force redetermination of `where' field. */
- bfd_tell (abfd);
-
- /* An EINVAL error probably means that the file offset was
- absurd. */
- if (hold_errno == EINVAL)
- bfd_set_error (bfd_error_file_truncated);
- else
- {
- bfd_set_error (bfd_error_system_call);
- errno = hold_errno;
- }
- }
- else
- {
- /* Adjust `where' field. */
- if (direction == SEEK_SET)
- abfd->where = position;
- else
- abfd->where += position;
- }
- return result;
-}
/** The do-it-yourself (byte) sex-change kit */
@@ -831,54 +266,54 @@ DESCRIPTION
.{* Byte swapping macros for user section data. *}
.
.#define bfd_put_8(abfd, val, ptr) \
-. ((void) (*((unsigned char *) (ptr)) = (unsigned char) (val)))
+. ((void) (*((unsigned char *) (ptr)) = (val) & 0xff))
.#define bfd_put_signed_8 \
-. bfd_put_8
+. bfd_put_8
.#define bfd_get_8(abfd, ptr) \
-. (*(unsigned char *) (ptr) & 0xff)
+. (*(unsigned char *) (ptr) & 0xff)
.#define bfd_get_signed_8(abfd, ptr) \
-. (((*(unsigned char *) (ptr) & 0xff) ^ 0x80) - 0x80)
+. (((*(unsigned char *) (ptr) & 0xff) ^ 0x80) - 0x80)
.
.#define bfd_put_16(abfd, val, ptr) \
-. BFD_SEND(abfd, bfd_putx16, ((val),(ptr)))
+. BFD_SEND (abfd, bfd_putx16, ((val),(ptr)))
.#define bfd_put_signed_16 \
-. bfd_put_16
+. bfd_put_16
.#define bfd_get_16(abfd, ptr) \
-. BFD_SEND(abfd, bfd_getx16, (ptr))
+. BFD_SEND (abfd, bfd_getx16, (ptr))
.#define bfd_get_signed_16(abfd, ptr) \
-. BFD_SEND (abfd, bfd_getx_signed_16, (ptr))
+. BFD_SEND (abfd, bfd_getx_signed_16, (ptr))
.
.#define bfd_put_32(abfd, val, ptr) \
-. BFD_SEND(abfd, bfd_putx32, ((val),(ptr)))
+. BFD_SEND (abfd, bfd_putx32, ((val),(ptr)))
.#define bfd_put_signed_32 \
-. bfd_put_32
+. bfd_put_32
.#define bfd_get_32(abfd, ptr) \
-. BFD_SEND(abfd, bfd_getx32, (ptr))
+. BFD_SEND (abfd, bfd_getx32, (ptr))
.#define bfd_get_signed_32(abfd, ptr) \
-. BFD_SEND(abfd, bfd_getx_signed_32, (ptr))
+. BFD_SEND (abfd, bfd_getx_signed_32, (ptr))
.
.#define bfd_put_64(abfd, val, ptr) \
-. BFD_SEND(abfd, bfd_putx64, ((val), (ptr)))
+. BFD_SEND (abfd, bfd_putx64, ((val), (ptr)))
.#define bfd_put_signed_64 \
-. bfd_put_64
+. bfd_put_64
.#define bfd_get_64(abfd, ptr) \
-. BFD_SEND(abfd, bfd_getx64, (ptr))
+. BFD_SEND (abfd, bfd_getx64, (ptr))
.#define bfd_get_signed_64(abfd, ptr) \
-. BFD_SEND(abfd, bfd_getx_signed_64, (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_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))
+.#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))
.
*/
@@ -932,139 +367,108 @@ DESCRIPTION
.#define bfd_h_get_signed_64(abfd, ptr) \
. BFD_SEND (abfd, bfd_h_getx_signed_64, (ptr))
.
-.{* Refinements on the above, which should eventually go away. Save
-. cluttering the source with (bfd_vma) and (bfd_byte *) casts. *}
-.
-.#define H_PUT_64(abfd, val, where) \
-. bfd_h_put_64 ((abfd), (bfd_vma) (val), (bfd_byte *) (where))
-.
-.#define H_PUT_32(abfd, val, where) \
-. bfd_h_put_32 ((abfd), (bfd_vma) (val), (bfd_byte *) (where))
-.
-.#define H_PUT_16(abfd, val, where) \
-. bfd_h_put_16 ((abfd), (bfd_vma) (val), (bfd_byte *) (where))
-.
-.#define H_PUT_8 bfd_h_put_8
-.
-.#define H_PUT_S64(abfd, val, where) \
-. bfd_h_put_signed_64 ((abfd), (bfd_vma) (val), (bfd_byte *) (where))
+.{* Aliases for the above, which should eventually go away. *}
.
-.#define H_PUT_S32(abfd, val, where) \
-. bfd_h_put_signed_32 ((abfd), (bfd_vma) (val), (bfd_byte *) (where))
-.
-.#define H_PUT_S16(abfd, val, where) \
-. bfd_h_put_signed_16 ((abfd), (bfd_vma) (val), (bfd_byte *) (where))
-.
-.#define H_PUT_S8 bfd_h_put_signed_8
-.
-.#define H_GET_64(abfd, where) \
-. bfd_h_get_64 ((abfd), (bfd_byte *) (where))
-.
-.#define H_GET_32(abfd, where) \
-. bfd_h_get_32 ((abfd), (bfd_byte *) (where))
-.
-.#define H_GET_16(abfd, where) \
-. bfd_h_get_16 ((abfd), (bfd_byte *) (where))
-.
-.#define H_GET_8 bfd_h_get_8
-.
-.#define H_GET_S64(abfd, where) \
-. bfd_h_get_signed_64 ((abfd), (bfd_byte *) (where))
-.
-.#define H_GET_S32(abfd, where) \
-. bfd_h_get_signed_32 ((abfd), (bfd_byte *) (where))
-.
-.#define H_GET_S16(abfd, where) \
-. bfd_h_get_signed_16 ((abfd), (bfd_byte *) (where))
-.
-.#define H_GET_S8 bfd_h_get_signed_8
+.#define H_PUT_64 bfd_h_put_64
+.#define H_PUT_32 bfd_h_put_32
+.#define H_PUT_16 bfd_h_put_16
+.#define H_PUT_8 bfd_h_put_8
+.#define H_PUT_S64 bfd_h_put_signed_64
+.#define H_PUT_S32 bfd_h_put_signed_32
+.#define H_PUT_S16 bfd_h_put_signed_16
+.#define H_PUT_S8 bfd_h_put_signed_8
+.#define H_GET_64 bfd_h_get_64
+.#define H_GET_32 bfd_h_get_32
+.#define H_GET_16 bfd_h_get_16
+.#define H_GET_8 bfd_h_get_8
+.#define H_GET_S64 bfd_h_get_signed_64
+.#define H_GET_S32 bfd_h_get_signed_32
+.#define H_GET_S16 bfd_h_get_signed_16
+.#define H_GET_S8 bfd_h_get_signed_8
.
.*/
/* Sign extension to bfd_signed_vma. */
#define COERCE16(x) (((bfd_signed_vma) (x) ^ 0x8000) - 0x8000)
-#define COERCE32(x) \
- ((bfd_signed_vma) (long) (((unsigned long) (x) ^ 0x80000000) - 0x80000000))
-#define EIGHT_GAZILLION (((BFD_HOST_64_BIT)0x80000000) << 32)
+#define COERCE32(x) (((bfd_signed_vma) (x) ^ 0x80000000) - 0x80000000)
+#define EIGHT_GAZILLION ((bfd_int64_t) 1 << 63)
#define COERCE64(x) \
- (((bfd_signed_vma) (x) ^ EIGHT_GAZILLION) - EIGHT_GAZILLION)
+ (((bfd_int64_t) (x) ^ EIGHT_GAZILLION) - EIGHT_GAZILLION)
bfd_vma
-bfd_getb16 (addr)
- register const bfd_byte *addr;
+bfd_getb16 (const void *p)
{
+ const bfd_byte *addr = p;
return (addr[0] << 8) | addr[1];
}
bfd_vma
-bfd_getl16 (addr)
- register const bfd_byte *addr;
+bfd_getl16 (const void *p)
{
+ const bfd_byte *addr = p;
return (addr[1] << 8) | addr[0];
}
bfd_signed_vma
-bfd_getb_signed_16 (addr)
- register const bfd_byte *addr;
+bfd_getb_signed_16 (const void *p)
{
- return COERCE16((addr[0] << 8) | addr[1]);
+ const bfd_byte *addr = p;
+ return COERCE16 ((addr[0] << 8) | addr[1]);
}
bfd_signed_vma
-bfd_getl_signed_16 (addr)
- register const bfd_byte *addr;
+bfd_getl_signed_16 (const void *p)
{
- return COERCE16((addr[1] << 8) | addr[0]);
+ const bfd_byte *addr = p;
+ return COERCE16 ((addr[1] << 8) | addr[0]);
}
void
-bfd_putb16 (data, addr)
- bfd_vma data;
- register bfd_byte *addr;
+bfd_putb16 (bfd_vma data, void *p)
{
- addr[0] = (bfd_byte) (data >> 8);
- addr[1] = (bfd_byte) data;
+ bfd_byte *addr = p;
+ addr[0] = (data >> 8) & 0xff;
+ addr[1] = data & 0xff;
}
void
-bfd_putl16 (data, addr)
- bfd_vma data;
- register bfd_byte *addr;
+bfd_putl16 (bfd_vma data, void *p)
{
- addr[0] = (bfd_byte) data;
- addr[1] = (bfd_byte) (data >> 8);
+ bfd_byte *addr = p;
+ addr[0] = data & 0xff;
+ addr[1] = (data >> 8) & 0xff;
}
bfd_vma
-bfd_getb32 (addr)
- register const bfd_byte *addr;
+bfd_getb32 (const void *p)
{
+ const bfd_byte *addr = p;
unsigned long v;
v = (unsigned long) addr[0] << 24;
v |= (unsigned long) addr[1] << 16;
v |= (unsigned long) addr[2] << 8;
v |= (unsigned long) addr[3];
- return (bfd_vma) v;
+ return v;
}
bfd_vma
-bfd_getl32 (addr)
- register const bfd_byte *addr;
+bfd_getl32 (const void *p)
{
+ const bfd_byte *addr = p;
unsigned long v;
v = (unsigned long) addr[0];
v |= (unsigned long) addr[1] << 8;
v |= (unsigned long) addr[2] << 16;
v |= (unsigned long) addr[3] << 24;
- return (bfd_vma) v;
+ return v;
}
bfd_signed_vma
-bfd_getb_signed_32 (addr)
- register const bfd_byte *addr;
+bfd_getb_signed_32 (const void *p)
{
+ const bfd_byte *addr = p;
unsigned long v;
v = (unsigned long) addr[0] << 24;
@@ -1075,9 +479,9 @@ bfd_getb_signed_32 (addr)
}
bfd_signed_vma
-bfd_getl_signed_32 (addr)
- register const bfd_byte *addr;
+bfd_getl_signed_32 (const void *p)
{
+ const bfd_byte *addr = p;
unsigned long v;
v = (unsigned long) addr[0];
@@ -1087,47 +491,46 @@ bfd_getl_signed_32 (addr)
return COERCE32 (v);
}
-bfd_vma
-bfd_getb64 (addr)
- register const bfd_byte *addr ATTRIBUTE_UNUSED;
+bfd_uint64_t
+bfd_getb64 (const void *p ATTRIBUTE_UNUSED)
{
-#ifdef BFD64
- bfd_vma low, high;
-
- high= ((((((((addr[0]) << 8) |
- addr[1]) << 8) |
- addr[2]) << 8) |
- addr[3]) );
+#ifdef BFD_HOST_64_BIT
+ const bfd_byte *addr = p;
+ bfd_uint64_t v;
- low = (((((((((bfd_vma)addr[4]) << 8) |
- addr[5]) << 8) |
- addr[6]) << 8) |
- addr[7]));
+ v = addr[0]; v <<= 8;
+ v |= addr[1]; v <<= 8;
+ v |= addr[2]; v <<= 8;
+ v |= addr[3]; v <<= 8;
+ v |= addr[4]; v <<= 8;
+ v |= addr[5]; v <<= 8;
+ v |= addr[6]; v <<= 8;
+ v |= addr[7];
- return high << 32 | low;
+ return v;
#else
BFD_FAIL();
return 0;
#endif
}
-bfd_vma
-bfd_getl64 (addr)
- register const bfd_byte *addr ATTRIBUTE_UNUSED;
+bfd_uint64_t
+bfd_getl64 (const void *p ATTRIBUTE_UNUSED)
{
-#ifdef BFD64
- bfd_vma low, high;
- high= (((((((addr[7] << 8) |
- addr[6]) << 8) |
- addr[5]) << 8) |
- addr[4]));
-
- low = ((((((((bfd_vma)addr[3] << 8) |
- addr[2]) << 8) |
- addr[1]) << 8) |
- addr[0]) );
-
- return high << 32 | low;
+#ifdef BFD_HOST_64_BIT
+ const bfd_byte *addr = p;
+ bfd_uint64_t v;
+
+ v = addr[7]; v <<= 8;
+ v |= addr[6]; v <<= 8;
+ v |= addr[5]; v <<= 8;
+ v |= addr[4]; v <<= 8;
+ v |= addr[3]; v <<= 8;
+ v |= addr[2]; v <<= 8;
+ v |= addr[1]; v <<= 8;
+ v |= addr[0];
+
+ return v;
#else
BFD_FAIL();
return 0;
@@ -1135,47 +538,46 @@ bfd_getl64 (addr)
}
-bfd_signed_vma
-bfd_getb_signed_64 (addr)
- register const bfd_byte *addr ATTRIBUTE_UNUSED;
+bfd_int64_t
+bfd_getb_signed_64 (const void *p ATTRIBUTE_UNUSED)
{
-#ifdef BFD64
- bfd_vma low, high;
-
- high= ((((((((addr[0]) << 8) |
- addr[1]) << 8) |
- addr[2]) << 8) |
- addr[3]) );
+#ifdef BFD_HOST_64_BIT
+ const bfd_byte *addr = p;
+ bfd_uint64_t v;
- low = (((((((((bfd_vma)addr[4]) << 8) |
- addr[5]) << 8) |
- addr[6]) << 8) |
- addr[7]));
+ v = addr[0]; v <<= 8;
+ v |= addr[1]; v <<= 8;
+ v |= addr[2]; v <<= 8;
+ v |= addr[3]; v <<= 8;
+ v |= addr[4]; v <<= 8;
+ v |= addr[5]; v <<= 8;
+ v |= addr[6]; v <<= 8;
+ v |= addr[7];
- return COERCE64(high << 32 | low);
+ return COERCE64 (v);
#else
BFD_FAIL();
return 0;
#endif
}
-bfd_signed_vma
-bfd_getl_signed_64 (addr)
- register const bfd_byte *addr ATTRIBUTE_UNUSED;
+bfd_int64_t
+bfd_getl_signed_64 (const void *p ATTRIBUTE_UNUSED)
{
-#ifdef BFD64
- bfd_vma low, high;
- high= (((((((addr[7] << 8) |
- addr[6]) << 8) |
- addr[5]) << 8) |
- addr[4]));
-
- low = ((((((((bfd_vma)addr[3] << 8) |
- addr[2]) << 8) |
- addr[1]) << 8) |
- addr[0]) );
-
- return COERCE64(high << 32 | low);
+#ifdef BFD_HOST_64_BIT
+ const bfd_byte *addr = p;
+ bfd_uint64_t v;
+
+ v = addr[7]; v <<= 8;
+ v |= addr[6]; v <<= 8;
+ v |= addr[5]; v <<= 8;
+ v |= addr[4]; v <<= 8;
+ v |= addr[3]; v <<= 8;
+ v |= addr[2]; v <<= 8;
+ v |= addr[1]; v <<= 8;
+ v |= addr[0];
+
+ return COERCE64 (v);
#else
BFD_FAIL();
return 0;
@@ -1183,72 +585,65 @@ bfd_getl_signed_64 (addr)
}
void
-bfd_putb32 (data, addr)
- bfd_vma data;
- register bfd_byte *addr;
+bfd_putb32 (bfd_vma data, void *p)
{
- addr[0] = (bfd_byte) (data >> 24);
- addr[1] = (bfd_byte) (data >> 16);
- addr[2] = (bfd_byte) (data >> 8);
- addr[3] = (bfd_byte) data;
+ bfd_byte *addr = p;
+ addr[0] = (data >> 24) & 0xff;
+ addr[1] = (data >> 16) & 0xff;
+ addr[2] = (data >> 8) & 0xff;
+ addr[3] = data & 0xff;
}
void
-bfd_putl32 (data, addr)
- bfd_vma data;
- register bfd_byte *addr;
+bfd_putl32 (bfd_vma data, void *p)
{
- addr[0] = (bfd_byte) data;
- addr[1] = (bfd_byte) (data >> 8);
- addr[2] = (bfd_byte) (data >> 16);
- addr[3] = (bfd_byte) (data >> 24);
+ bfd_byte *addr = p;
+ addr[0] = data & 0xff;
+ addr[1] = (data >> 8) & 0xff;
+ addr[2] = (data >> 16) & 0xff;
+ addr[3] = (data >> 24) & 0xff;
}
void
-bfd_putb64 (data, addr)
- bfd_vma data ATTRIBUTE_UNUSED;
- register bfd_byte *addr ATTRIBUTE_UNUSED;
-{
-#ifdef BFD64
- addr[0] = (bfd_byte) (data >> (7*8));
- addr[1] = (bfd_byte) (data >> (6*8));
- addr[2] = (bfd_byte) (data >> (5*8));
- addr[3] = (bfd_byte) (data >> (4*8));
- addr[4] = (bfd_byte) (data >> (3*8));
- addr[5] = (bfd_byte) (data >> (2*8));
- addr[6] = (bfd_byte) (data >> (1*8));
- addr[7] = (bfd_byte) (data >> (0*8));
+bfd_putb64 (bfd_uint64_t data ATTRIBUTE_UNUSED, void *p ATTRIBUTE_UNUSED)
+{
+#ifdef BFD_HOST_64_BIT
+ bfd_byte *addr = p;
+ addr[0] = (data >> (7*8)) & 0xff;
+ addr[1] = (data >> (6*8)) & 0xff;
+ addr[2] = (data >> (5*8)) & 0xff;
+ addr[3] = (data >> (4*8)) & 0xff;
+ addr[4] = (data >> (3*8)) & 0xff;
+ addr[5] = (data >> (2*8)) & 0xff;
+ addr[6] = (data >> (1*8)) & 0xff;
+ addr[7] = (data >> (0*8)) & 0xff;
#else
BFD_FAIL();
#endif
}
void
-bfd_putl64 (data, addr)
- bfd_vma data ATTRIBUTE_UNUSED;
- register bfd_byte *addr ATTRIBUTE_UNUSED;
-{
-#ifdef BFD64
- addr[7] = (bfd_byte) (data >> (7*8));
- addr[6] = (bfd_byte) (data >> (6*8));
- addr[5] = (bfd_byte) (data >> (5*8));
- addr[4] = (bfd_byte) (data >> (4*8));
- addr[3] = (bfd_byte) (data >> (3*8));
- addr[2] = (bfd_byte) (data >> (2*8));
- addr[1] = (bfd_byte) (data >> (1*8));
- addr[0] = (bfd_byte) (data >> (0*8));
+bfd_putl64 (bfd_uint64_t data ATTRIBUTE_UNUSED, void *p ATTRIBUTE_UNUSED)
+{
+#ifdef BFD_HOST_64_BIT
+ bfd_byte *addr = p;
+ addr[7] = (data >> (7*8)) & 0xff;
+ addr[6] = (data >> (6*8)) & 0xff;
+ addr[5] = (data >> (5*8)) & 0xff;
+ addr[4] = (data >> (4*8)) & 0xff;
+ addr[3] = (data >> (3*8)) & 0xff;
+ addr[2] = (data >> (2*8)) & 0xff;
+ addr[1] = (data >> (1*8)) & 0xff;
+ addr[0] = (data >> (0*8)) & 0xff;
#else
BFD_FAIL();
#endif
}
void
-bfd_put_bits (data, addr, bits, big_p)
- bfd_vma data;
- bfd_byte *addr;
- int bits;
- boolean big_p;
+bfd_put_bits (bfd_uint64_t data, void *p, int bits, bfd_boolean big_p)
{
+ bfd_byte *addr = p;
int i;
int bytes;
@@ -1260,18 +655,16 @@ bfd_put_bits (data, addr, bits, big_p)
{
int index = big_p ? bytes - i - 1 : i;
- addr[index] = (bfd_byte) data;
+ addr[index] = data & 0xff;
data >>= 8;
}
}
-bfd_vma
-bfd_get_bits (addr, bits, big_p)
- bfd_byte *addr;
- int bits;
- boolean big_p;
+bfd_uint64_t
+bfd_get_bits (const void *p, int bits, bfd_boolean big_p)
{
- bfd_vma data;
+ const bfd_byte *addr = p;
+ bfd_uint64_t data;
int i;
int bytes;
@@ -1292,42 +685,42 @@ bfd_get_bits (addr, bits, big_p)
/* Default implementation */
-boolean
-_bfd_generic_get_section_contents (abfd, section, location, offset, count)
- bfd *abfd;
- sec_ptr section;
- PTR location;
- file_ptr offset;
- bfd_size_type count;
+bfd_boolean
+_bfd_generic_get_section_contents (bfd *abfd,
+ sec_ptr section,
+ void *location,
+ file_ptr offset,
+ bfd_size_type count)
{
if (count == 0)
- return true;
+ return TRUE;
if (offset + count > section->_raw_size)
{
bfd_set_error (bfd_error_invalid_operation);
- return false;
+ return FALSE;
}
if (bfd_seek (abfd, section->filepos + offset, SEEK_SET) != 0
|| bfd_bread (location, count, abfd) != count)
- return false;
+ return FALSE;
- return true;
+ return TRUE;
}
-boolean
-_bfd_generic_get_section_contents_in_window (abfd, section, w, offset, count)
- bfd *abfd ATTRIBUTE_UNUSED;
- sec_ptr section ATTRIBUTE_UNUSED;
- bfd_window *w ATTRIBUTE_UNUSED;
- file_ptr offset ATTRIBUTE_UNUSED;
- bfd_size_type count ATTRIBUTE_UNUSED;
+bfd_boolean
+_bfd_generic_get_section_contents_in_window
+ (bfd *abfd ATTRIBUTE_UNUSED,
+ sec_ptr section ATTRIBUTE_UNUSED,
+ bfd_window *w ATTRIBUTE_UNUSED,
+ file_ptr offset ATTRIBUTE_UNUSED,
+ bfd_size_type count ATTRIBUTE_UNUSED)
{
#ifdef USE_MMAP
if (count == 0)
- return true;
- if (abfd->xvec->_bfd_get_section_contents != _bfd_generic_get_section_contents)
+ return TRUE;
+ if (abfd->xvec->_bfd_get_section_contents
+ != _bfd_generic_get_section_contents)
{
/* We don't know what changes the bfd's get_section_contents
method may have to make. So punt trying to map the file
@@ -1335,16 +728,15 @@ _bfd_generic_get_section_contents_in_window (abfd, section, w, offset, count)
/* @@ FIXME : If the internal window has a refcount of 1 and was
allocated with malloc instead of mmap, just reuse it. */
bfd_free_window (w);
- w->i = ((bfd_window_internal *)
- bfd_zmalloc ((bfd_size_type) sizeof (bfd_window_internal)));
+ w->i = bfd_zmalloc (sizeof (bfd_window_internal));
if (w->i == NULL)
- return false;
- w->i->data = (PTR) bfd_malloc (count);
+ return FALSE;
+ w->i->data = bfd_malloc (count);
if (w->i->data == NULL)
{
free (w->i);
w->i = NULL;
- return false;
+ return FALSE;
}
w->i->mapped = 0;
w->i->refcount = 1;
@@ -1354,9 +746,9 @@ _bfd_generic_get_section_contents_in_window (abfd, section, w, offset, count)
}
if (offset + count > section->_raw_size
|| ! bfd_get_file_window (abfd, section->filepos + offset, count, w,
- true))
- return false;
- return true;
+ TRUE))
+ return FALSE;
+ return TRUE;
#else
abort ();
#endif
@@ -1366,22 +758,21 @@ _bfd_generic_get_section_contents_in_window (abfd, section, w, offset, count)
NEW sections is disallowed. It is useful in patching existing sections
in read-write files, though. See other set_section_contents functions
to see why it doesn't work for new sections. */
-boolean
-_bfd_generic_set_section_contents (abfd, section, location, offset, count)
- bfd *abfd;
- sec_ptr section;
- PTR location;
- file_ptr offset;
- bfd_size_type count;
+bfd_boolean
+_bfd_generic_set_section_contents (bfd *abfd,
+ sec_ptr section,
+ const void *location,
+ file_ptr offset,
+ bfd_size_type count)
{
if (count == 0)
- return true;
+ return TRUE;
if (bfd_seek (abfd, section->filepos + offset, SEEK_SET) != 0
|| bfd_bwrite (location, count, abfd) != count)
- return false;
+ return FALSE;
- return true;
+ return TRUE;
}
/*
@@ -1397,8 +788,7 @@ DESCRIPTION
*/
unsigned int
-bfd_log2 (x)
- bfd_vma x;
+bfd_log2 (bfd_vma x)
{
unsigned int result = 0;
@@ -1407,23 +797,19 @@ bfd_log2 (x)
return result;
}
-boolean
-bfd_generic_is_local_label_name (abfd, name)
- bfd *abfd;
- const char *name;
+bfd_boolean
+bfd_generic_is_local_label_name (bfd *abfd, const char *name)
{
char locals_prefix = (bfd_get_symbol_leading_char (abfd) == '_') ? 'L' : '.';
- return (boolean) (name[0] == locals_prefix);
+ return name[0] == locals_prefix;
}
/* Can be used from / for bfd_merge_private_bfd_data to check that
endianness matches between input and output file. Returns
- true for a match, otherwise returns false and emits an error. */
-boolean
-_bfd_generic_verify_endian_match (ibfd, obfd)
- bfd *ibfd;
- bfd *obfd;
+ TRUE for a match, otherwise returns FALSE and emits an error. */
+bfd_boolean
+_bfd_generic_verify_endian_match (bfd *ibfd, bfd *obfd)
{
if (ibfd->xvec->byteorder != obfd->xvec->byteorder
&& ibfd->xvec->byteorder != BFD_ENDIAN_UNKNOWN
@@ -1439,28 +825,27 @@ _bfd_generic_verify_endian_match (ibfd, obfd)
(*_bfd_error_handler) (msg, bfd_archive_filename (ibfd));
bfd_set_error (bfd_error_wrong_format);
- return false;
+ return FALSE;
}
- return true;
+ return TRUE;
}
/* Give a warning at runtime if someone compiles code which calls
old routines. */
void
-warn_deprecated (what, file, line, func)
- const char *what;
- const char *file;
- int line;
- const char *func;
+warn_deprecated (const char *what,
+ const char *file,
+ int line,
+ const char *func)
{
/* Poor man's tracking of functions we've already warned about. */
static size_t mask = 0;
if (~(size_t) func & ~mask)
{
- /* Note: seperate sentances in order to allow
+ /* Note: separate sentences in order to allow
for translation into other languages. */
if (func)
fprintf (stderr, _("Deprecated %s called at %s line %d in %s\n"),
diff --git a/contrib/binutils/bfd/libbfd.h b/contrib/binutils/bfd/libbfd.h
index 3480114..62043f3 100644
--- a/contrib/binutils/bfd/libbfd.h
+++ b/contrib/binutils/bfd/libbfd.h
@@ -1,13 +1,14 @@
/* DO NOT EDIT! -*- buffer-read-only: t -*- This file is automatically
- generated from "libbfd-in.h", "init.c", "libbfd.c", "cache.c",
- "reloc.c", "archures.c" and "elf.c".
+ generated from "libbfd-in.h", "init.c", "libbfd.c", "bfdio.c",
+ "bfdwin.c", "cache.c", "reloc.c", "archures.c" and "elf.c".
Run "make headers" in your build bfd/ to regenerate. */
/* libbfd.h -- Declarations used by bfd library *implementation*.
(This include file is not for users of the library.)
- Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
- 2000, 2001, 2002
- Free Software Foundation, Inc.
+
+ Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
+ 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
+
Written by Cygnus Support.
This file is part of BFD, the Binary File Descriptor library.
@@ -41,7 +42,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
/* Set a tdata field. Can't use the other macros for this, since they
do casts, and casting to the left of assignment isn't portable. */
-#define set_tdata(bfd, v) ((bfd)->tdata.any = (PTR) (v))
+#define set_tdata(bfd, v) ((bfd)->tdata.any = (v))
/* If BFD_IN_MEMORY is set for a BFD, then the iostream fields points
to an instance of this structure. */
@@ -74,7 +75,7 @@ struct artdata {
archive. */
file_ptr armap_datepos; /* Position within archive to seek to
rewrite the date field. */
- PTR tdata; /* Backend specific information. */
+ void *tdata; /* Backend specific information. */
};
#define bfd_ardata(bfd) ((bfd)->tdata.aout_ar_data)
@@ -88,70 +89,105 @@ struct areltdata {
#define arelt_size(bfd) (((struct areltdata *)((bfd)->arelt_data))->parsed_size)
-extern PTR bfd_malloc PARAMS ((bfd_size_type));
-extern PTR bfd_realloc PARAMS ((PTR, bfd_size_type));
-extern PTR bfd_zmalloc PARAMS ((bfd_size_type));
+extern void *bfd_malloc
+ (bfd_size_type);
+extern void *bfd_realloc
+ (void *, bfd_size_type);
+extern void *bfd_zmalloc
+ (bfd_size_type);
extern bfd_error_handler_type _bfd_error_handler;
/* These routines allocate and free things on the BFD's objalloc. */
-extern PTR bfd_alloc PARAMS ((bfd *, bfd_size_type));
-extern PTR bfd_zalloc PARAMS ((bfd *, bfd_size_type));
-extern void bfd_release PARAMS ((bfd *, PTR));
-
-bfd * _bfd_create_empty_archive_element_shell PARAMS ((bfd *obfd));
-bfd * _bfd_look_for_bfd_in_cache PARAMS ((bfd *, file_ptr));
-boolean _bfd_add_bfd_to_archive_cache PARAMS ((bfd *, file_ptr, bfd *));
-boolean _bfd_generic_mkarchive PARAMS ((bfd *abfd));
-const bfd_target *bfd_generic_archive_p PARAMS ((bfd *abfd));
-boolean bfd_slurp_armap PARAMS ((bfd *abfd));
-boolean bfd_slurp_bsd_armap_f2 PARAMS ((bfd *abfd));
+extern void *bfd_alloc
+ (bfd *, bfd_size_type);
+extern void *bfd_zalloc
+ (bfd *, bfd_size_type);
+extern void bfd_release
+ (bfd *, void *);
+
+bfd * _bfd_create_empty_archive_element_shell
+ (bfd *obfd);
+bfd * _bfd_look_for_bfd_in_cache
+ (bfd *, file_ptr);
+bfd_boolean _bfd_add_bfd_to_archive_cache
+ (bfd *, file_ptr, bfd *);
+bfd_boolean _bfd_generic_mkarchive
+ (bfd *abfd);
+const bfd_target *bfd_generic_archive_p
+ (bfd *abfd);
+bfd_boolean bfd_slurp_armap
+ (bfd *abfd);
+bfd_boolean bfd_slurp_bsd_armap_f2
+ (bfd *abfd);
#define bfd_slurp_bsd_armap bfd_slurp_armap
#define bfd_slurp_coff_armap bfd_slurp_armap
-boolean _bfd_slurp_extended_name_table PARAMS ((bfd *abfd));
-extern boolean _bfd_construct_extended_name_table
- PARAMS ((bfd *, boolean, char **, bfd_size_type *));
-boolean _bfd_write_archive_contents PARAMS ((bfd *abfd));
-boolean _bfd_compute_and_write_armap PARAMS ((bfd *, unsigned int elength));
-bfd *_bfd_get_elt_at_filepos PARAMS ((bfd *archive, file_ptr filepos));
-extern bfd *_bfd_generic_get_elt_at_index PARAMS ((bfd *, symindex));
-bfd * _bfd_new_bfd PARAMS ((void));
-void _bfd_delete_bfd PARAMS ((bfd *));
-
-boolean bfd_false PARAMS ((bfd *ignore));
-boolean bfd_true PARAMS ((bfd *ignore));
-PTR bfd_nullvoidptr PARAMS ((bfd *ignore));
-int bfd_0 PARAMS ((bfd *ignore));
-unsigned int bfd_0u PARAMS ((bfd *ignore));
-long bfd_0l PARAMS ((bfd *ignore));
-long _bfd_n1 PARAMS ((bfd *ignore));
-void bfd_void PARAMS ((bfd *ignore));
-
-bfd *_bfd_new_bfd_contained_in PARAMS ((bfd *));
-const bfd_target *_bfd_dummy_target PARAMS ((bfd *abfd));
-
-void bfd_dont_truncate_arname PARAMS ((bfd *abfd, const char *filename,
- char *hdr));
-void bfd_bsd_truncate_arname PARAMS ((bfd *abfd, const char *filename,
- char *hdr));
-void bfd_gnu_truncate_arname PARAMS ((bfd *abfd, const char *filename,
- char *hdr));
-
-boolean bsd_write_armap PARAMS ((bfd *arch, unsigned int elength,
- struct orl *map, unsigned int orl_count, int stridx));
-
-boolean coff_write_armap PARAMS ((bfd *arch, unsigned int elength,
- struct orl *map, unsigned int orl_count, int stridx));
-
-extern PTR _bfd_generic_read_ar_hdr PARAMS ((bfd *));
-
-extern PTR _bfd_generic_read_ar_hdr_mag PARAMS ((bfd *, const char *));
-
-bfd * bfd_generic_openr_next_archived_file PARAMS ((bfd *archive,
- bfd *last_file));
-
-int bfd_generic_stat_arch_elt PARAMS ((bfd *, struct stat *));
+bfd_boolean _bfd_slurp_extended_name_table
+ (bfd *abfd);
+extern bfd_boolean _bfd_construct_extended_name_table
+ (bfd *, bfd_boolean, char **, bfd_size_type *);
+bfd_boolean _bfd_write_archive_contents
+ (bfd *abfd);
+bfd_boolean _bfd_compute_and_write_armap
+ (bfd *, unsigned int elength);
+bfd *_bfd_get_elt_at_filepos
+ (bfd *archive, file_ptr filepos);
+extern bfd *_bfd_generic_get_elt_at_index
+ (bfd *, symindex);
+bfd * _bfd_new_bfd
+ (void);
+void _bfd_delete_bfd
+ (bfd *);
+
+bfd_boolean bfd_false
+ (bfd *ignore);
+bfd_boolean bfd_true
+ (bfd *ignore);
+void *bfd_nullvoidptr
+ (bfd *ignore);
+int bfd_0
+ (bfd *ignore);
+unsigned int bfd_0u
+ (bfd *ignore);
+long bfd_0l
+ (bfd *ignore);
+long _bfd_n1
+ (bfd *ignore);
+void bfd_void
+ (bfd *ignore);
+
+bfd *_bfd_new_bfd_contained_in
+ (bfd *);
+const bfd_target *_bfd_dummy_target
+ (bfd *abfd);
+
+void bfd_dont_truncate_arname
+ (bfd *abfd, const char *filename, char *hdr);
+void bfd_bsd_truncate_arname
+ (bfd *abfd, const char *filename, char *hdr);
+void bfd_gnu_truncate_arname
+ (bfd *abfd, const char *filename, char *hdr);
+
+bfd_boolean bsd_write_armap
+ (bfd *arch, unsigned int elength, struct orl *map, unsigned int orl_count,
+ int stridx);
+
+bfd_boolean coff_write_armap
+ (bfd *arch, unsigned int elength, struct orl *map, unsigned int orl_count,
+ int stridx);
+
+extern void *_bfd_generic_read_ar_hdr
+ (bfd *);
+
+extern void *_bfd_generic_read_ar_hdr_mag
+ (bfd *, const char *);
+
+bfd * bfd_generic_openr_next_archived_file
+ (bfd *archive, bfd *last_file);
+
+int bfd_generic_stat_arch_elt
+ (bfd *, struct stat *);
#define _bfd_read_ar_hdr(abfd) \
BFD_SEND (abfd, _bfd_read_ar_hdr_fn, (abfd))
@@ -162,35 +198,37 @@ int bfd_generic_stat_arch_elt PARAMS ((bfd *, struct stat *));
#define _bfd_generic_close_and_cleanup bfd_true
#define _bfd_generic_bfd_free_cached_info bfd_true
#define _bfd_generic_new_section_hook \
- ((boolean (*) PARAMS ((bfd *, asection *))) bfd_true)
-extern boolean _bfd_generic_get_section_contents
- PARAMS ((bfd *, asection *, PTR, file_ptr, bfd_size_type));
-extern boolean _bfd_generic_get_section_contents_in_window
- PARAMS ((bfd *, asection *, bfd_window *, file_ptr, bfd_size_type));
+ ((bfd_boolean (*) (bfd *, asection *)) bfd_true)
+extern bfd_boolean _bfd_generic_get_section_contents
+ (bfd *, asection *, void *, file_ptr, bfd_size_type);
+extern bfd_boolean _bfd_generic_get_section_contents_in_window
+ (bfd *, asection *, bfd_window *, file_ptr, bfd_size_type);
/* Generic routines to use for BFD_JUMP_TABLE_COPY. Use
BFD_JUMP_TABLE_COPY (_bfd_generic). */
#define _bfd_generic_bfd_copy_private_bfd_data \
- ((boolean (*) PARAMS ((bfd *, bfd *))) bfd_true)
+ ((bfd_boolean (*) (bfd *, bfd *)) bfd_true)
#define _bfd_generic_bfd_merge_private_bfd_data \
- ((boolean (*) PARAMS ((bfd *, bfd *))) bfd_true)
+ ((bfd_boolean (*) (bfd *, bfd *)) bfd_true)
#define _bfd_generic_bfd_set_private_flags \
- ((boolean (*) PARAMS ((bfd *, flagword))) bfd_true)
+ ((bfd_boolean (*) (bfd *, flagword)) bfd_true)
#define _bfd_generic_bfd_copy_private_section_data \
- ((boolean (*) PARAMS ((bfd *, asection *, bfd *, asection *))) bfd_true)
+ ((bfd_boolean (*) (bfd *, asection *, bfd *, asection *)) bfd_true)
#define _bfd_generic_bfd_copy_private_symbol_data \
- ((boolean (*) PARAMS ((bfd *, asymbol *, bfd *, asymbol *))) bfd_true)
+ ((bfd_boolean (*) (bfd *, asymbol *, bfd *, asymbol *)) bfd_true)
#define _bfd_generic_bfd_print_private_bfd_data \
- ((boolean (*) PARAMS ((bfd *, PTR))) bfd_true)
+ ((bfd_boolean (*) (bfd *, void *)) bfd_true)
/* Routines to use for BFD_JUMP_TABLE_CORE when there is no core file
support. Use BFD_JUMP_TABLE_CORE (_bfd_nocore). */
-extern char *_bfd_nocore_core_file_failing_command PARAMS ((bfd *));
-extern int _bfd_nocore_core_file_failing_signal PARAMS ((bfd *));
-extern boolean _bfd_nocore_core_file_matches_executable_p
- PARAMS ((bfd *, bfd *));
+extern char *_bfd_nocore_core_file_failing_command
+ (bfd *);
+extern int _bfd_nocore_core_file_failing_signal
+ (bfd *);
+extern bfd_boolean _bfd_nocore_core_file_matches_executable_p
+ (bfd *, bfd *);
/* Routines to use for BFD_JUMP_TABLE_ARCHIVE when there is no archive
file support. Use BFD_JUMP_TABLE_ARCHIVE (_bfd_noarchive). */
@@ -198,19 +236,18 @@ extern boolean _bfd_nocore_core_file_matches_executable_p
#define _bfd_noarchive_slurp_armap bfd_false
#define _bfd_noarchive_slurp_extended_name_table bfd_false
#define _bfd_noarchive_construct_extended_name_table \
- ((boolean (*) PARAMS ((bfd *, char **, bfd_size_type *, const char **))) \
+ ((bfd_boolean (*) (bfd *, char **, bfd_size_type *, const char **)) \
bfd_false)
#define _bfd_noarchive_truncate_arname \
- ((void (*) PARAMS ((bfd *, const char *, char *))) bfd_void)
+ ((void (*) (bfd *, const char *, char *)) bfd_void)
#define _bfd_noarchive_write_armap \
- ((boolean (*) \
- PARAMS ((bfd *, unsigned int, struct orl *, unsigned int, int))) \
+ ((bfd_boolean (*) (bfd *, unsigned int, struct orl *, unsigned int, int)) \
bfd_false)
#define _bfd_noarchive_read_ar_hdr bfd_nullvoidptr
#define _bfd_noarchive_openr_next_archived_file \
- ((bfd *(*) PARAMS ((bfd *, bfd *))) bfd_nullvoidptr)
+ ((bfd *(*) (bfd *, bfd *)) bfd_nullvoidptr)
#define _bfd_noarchive_get_elt_at_index \
- ((bfd *(*) PARAMS ((bfd *, symindex))) bfd_nullvoidptr)
+ ((bfd *(*) (bfd *, symindex)) bfd_nullvoidptr)
#define _bfd_noarchive_generic_stat_arch_elt bfd_generic_stat_arch_elt
#define _bfd_noarchive_update_armap_timestamp bfd_false
@@ -220,8 +257,8 @@ extern boolean _bfd_nocore_core_file_matches_executable_p
#define _bfd_archive_bsd_slurp_armap bfd_slurp_bsd_armap
#define _bfd_archive_bsd_slurp_extended_name_table \
_bfd_slurp_extended_name_table
-extern boolean _bfd_archive_bsd_construct_extended_name_table
- PARAMS ((bfd *, char **, bfd_size_type *, const char **));
+extern bfd_boolean _bfd_archive_bsd_construct_extended_name_table
+ (bfd *, char **, bfd_size_type *, const char **);
#define _bfd_archive_bsd_truncate_arname bfd_bsd_truncate_arname
#define _bfd_archive_bsd_write_armap bsd_write_armap
#define _bfd_archive_bsd_read_ar_hdr _bfd_generic_read_ar_hdr
@@ -230,7 +267,8 @@ extern boolean _bfd_archive_bsd_construct_extended_name_table
#define _bfd_archive_bsd_get_elt_at_index _bfd_generic_get_elt_at_index
#define _bfd_archive_bsd_generic_stat_arch_elt \
bfd_generic_stat_arch_elt
-extern boolean _bfd_archive_bsd_update_armap_timestamp PARAMS ((bfd *));
+extern bfd_boolean _bfd_archive_bsd_update_armap_timestamp
+ (bfd *);
/* Routines to use for BFD_JUMP_TABLE_ARCHIVE to get COFF style
archives. Use BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff). */
@@ -238,8 +276,8 @@ extern boolean _bfd_archive_bsd_update_armap_timestamp PARAMS ((bfd *));
#define _bfd_archive_coff_slurp_armap bfd_slurp_coff_armap
#define _bfd_archive_coff_slurp_extended_name_table \
_bfd_slurp_extended_name_table
-extern boolean _bfd_archive_coff_construct_extended_name_table
- PARAMS ((bfd *, char **, bfd_size_type *, const char **));
+extern bfd_boolean _bfd_archive_coff_construct_extended_name_table
+ (bfd *, char **, bfd_size_type *, const char **);
#define _bfd_archive_coff_truncate_arname bfd_dont_truncate_arname
#define _bfd_archive_coff_write_armap coff_write_armap
#define _bfd_archive_coff_read_ar_hdr _bfd_generic_read_ar_hdr
@@ -254,95 +292,89 @@ extern boolean _bfd_archive_coff_construct_extended_name_table
support. Use BFD_JUMP_TABLE_SYMBOLS (_bfd_nosymbols). */
#define _bfd_nosymbols_get_symtab_upper_bound _bfd_n1
-#define _bfd_nosymbols_get_symtab \
- ((long (*) PARAMS ((bfd *, asymbol **))) _bfd_n1)
+#define _bfd_nosymbols_canonicalize_symtab \
+ ((long (*) (bfd *, asymbol **)) _bfd_n1)
#define _bfd_nosymbols_make_empty_symbol _bfd_generic_make_empty_symbol
#define _bfd_nosymbols_print_symbol \
- ((void (*) PARAMS ((bfd *, PTR, asymbol *, bfd_print_symbol_type))) bfd_void)
+ ((void (*) (bfd *, void *, asymbol *, bfd_print_symbol_type)) bfd_void)
#define _bfd_nosymbols_get_symbol_info \
- ((void (*) PARAMS ((bfd *, asymbol *, symbol_info *))) bfd_void)
+ ((void (*) (bfd *, asymbol *, symbol_info *)) bfd_void)
#define _bfd_nosymbols_bfd_is_local_label_name \
- ((boolean (*) PARAMS ((bfd *, const char *))) bfd_false)
+ ((bfd_boolean (*) (bfd *, const char *)) bfd_false)
#define _bfd_nosymbols_get_lineno \
- ((alent *(*) PARAMS ((bfd *, asymbol *))) bfd_nullvoidptr)
+ ((alent *(*) (bfd *, asymbol *)) bfd_nullvoidptr)
#define _bfd_nosymbols_find_nearest_line \
- ((boolean (*) \
- PARAMS ((bfd *, asection *, asymbol **, bfd_vma, const char **, \
- const char **, unsigned int *))) \
+ ((bfd_boolean (*) (bfd *, asection *, asymbol **, bfd_vma, const char **, \
+ const char **, unsigned int *)) \
bfd_false)
#define _bfd_nosymbols_bfd_make_debug_symbol \
- ((asymbol *(*) PARAMS ((bfd *, PTR, unsigned long))) bfd_nullvoidptr)
+ ((asymbol *(*) (bfd *, void *, unsigned long)) bfd_nullvoidptr)
#define _bfd_nosymbols_read_minisymbols \
- ((long (*) PARAMS ((bfd *, boolean, PTR *, unsigned int *))) _bfd_n1)
+ ((long (*) (bfd *, bfd_boolean, void **, unsigned int *)) _bfd_n1)
#define _bfd_nosymbols_minisymbol_to_symbol \
- ((asymbol *(*) PARAMS ((bfd *, boolean, const PTR, asymbol *))) \
+ ((asymbol *(*) (bfd *, bfd_boolean, const void *, asymbol *)) \
bfd_nullvoidptr)
/* Routines to use for BFD_JUMP_TABLE_RELOCS when there is no reloc
support. Use BFD_JUMP_TABLE_RELOCS (_bfd_norelocs). */
#define _bfd_norelocs_get_reloc_upper_bound \
- ((long (*) PARAMS ((bfd *, asection *))) _bfd_n1)
+ ((long (*) (bfd *, asection *)) _bfd_n1)
#define _bfd_norelocs_canonicalize_reloc \
- ((long (*) PARAMS ((bfd *, asection *, arelent **, asymbol **))) _bfd_n1)
+ ((long (*) (bfd *, asection *, arelent **, asymbol **)) _bfd_n1)
#define _bfd_norelocs_bfd_reloc_type_lookup \
- ((reloc_howto_type *(*) PARAMS ((bfd *, bfd_reloc_code_real_type))) \
- bfd_nullvoidptr)
+ ((reloc_howto_type *(*) (bfd *, bfd_reloc_code_real_type)) bfd_nullvoidptr)
/* Routines to use for BFD_JUMP_TABLE_WRITE for targets which may not
be written. Use BFD_JUMP_TABLE_WRITE (_bfd_nowrite). */
#define _bfd_nowrite_set_arch_mach \
- ((boolean (*) PARAMS ((bfd *, enum bfd_architecture, unsigned long))) \
+ ((bfd_boolean (*) (bfd *, enum bfd_architecture, unsigned long)) \
bfd_false)
#define _bfd_nowrite_set_section_contents \
- ((boolean (*) PARAMS ((bfd *, asection *, PTR, file_ptr, bfd_size_type))) \
+ ((bfd_boolean (*) (bfd *, asection *, const void *, file_ptr, bfd_size_type)) \
bfd_false)
/* Generic routines to use for BFD_JUMP_TABLE_WRITE. Use
BFD_JUMP_TABLE_WRITE (_bfd_generic). */
#define _bfd_generic_set_arch_mach bfd_default_set_arch_mach
-extern boolean _bfd_generic_set_section_contents
- PARAMS ((bfd *, asection *, PTR, file_ptr, bfd_size_type));
+extern bfd_boolean _bfd_generic_set_section_contents
+ (bfd *, asection *, const void *, file_ptr, bfd_size_type);
/* Routines to use for BFD_JUMP_TABLE_LINK for targets which do not
support linking. Use BFD_JUMP_TABLE_LINK (_bfd_nolink). */
-#define _bfd_nolink_sizeof_headers ((int (*) PARAMS ((bfd *, boolean))) bfd_0)
+#define _bfd_nolink_sizeof_headers ((int (*) (bfd *, bfd_boolean)) bfd_0)
#define _bfd_nolink_bfd_get_relocated_section_contents \
- ((bfd_byte *(*) \
- PARAMS ((bfd *, struct bfd_link_info *, struct bfd_link_order *, \
- bfd_byte *, boolean, asymbol **))) \
+ ((bfd_byte *(*) (bfd *, struct bfd_link_info *, struct bfd_link_order *, \
+ bfd_byte *, bfd_boolean, asymbol **)) \
bfd_nullvoidptr)
#define _bfd_nolink_bfd_relax_section \
- ((boolean (*) \
- PARAMS ((bfd *, asection *, struct bfd_link_info *, boolean *))) \
+ ((bfd_boolean (*) \
+ (bfd *, asection *, struct bfd_link_info *, bfd_boolean *)) \
bfd_false)
#define _bfd_nolink_bfd_gc_sections \
- ((boolean (*) \
- PARAMS ((bfd *, struct bfd_link_info *))) \
+ ((bfd_boolean (*) (bfd *, struct bfd_link_info *)) \
bfd_false)
#define _bfd_nolink_bfd_merge_sections \
- ((boolean (*) \
- PARAMS ((bfd *, struct bfd_link_info *))) \
+ ((bfd_boolean (*) (bfd *, struct bfd_link_info *)) \
bfd_false)
#define _bfd_nolink_bfd_discard_group \
- ((boolean (*) \
- PARAMS ((bfd *, struct sec *))) \
+ ((bfd_boolean (*) (bfd *, struct bfd_section *)) \
bfd_false)
#define _bfd_nolink_bfd_link_hash_table_create \
- ((struct bfd_link_hash_table *(*) PARAMS ((bfd *))) bfd_nullvoidptr)
+ ((struct bfd_link_hash_table *(*) (bfd *)) bfd_nullvoidptr)
#define _bfd_nolink_bfd_link_hash_table_free \
- ((void (*) PARAMS ((struct bfd_link_hash_table *))) bfd_void)
+ ((void (*) (struct bfd_link_hash_table *)) bfd_void)
#define _bfd_nolink_bfd_link_add_symbols \
- ((boolean (*) PARAMS ((bfd *, struct bfd_link_info *))) bfd_false)
+ ((bfd_boolean (*) (bfd *, struct bfd_link_info *)) bfd_false)
#define _bfd_nolink_bfd_link_just_syms \
- ((void (*) PARAMS ((asection *, struct bfd_link_info *))) bfd_void)
+ ((void (*) (asection *, struct bfd_link_info *)) bfd_void)
#define _bfd_nolink_bfd_final_link \
- ((boolean (*) PARAMS ((bfd *, struct bfd_link_info *))) bfd_false)
+ ((bfd_boolean (*) (bfd *, struct bfd_link_info *)) bfd_false)
#define _bfd_nolink_bfd_link_split_section \
- ((boolean (*) PARAMS ((bfd *, struct sec *))) bfd_false)
+ ((bfd_boolean (*) (bfd *, struct bfd_section *)) bfd_false)
/* Routines to use for BFD_JUMP_TABLE_DYNAMIC for targets which do not
have dynamic symbols or relocs. Use BFD_JUMP_TABLE_DYNAMIC
@@ -350,187 +382,189 @@ extern boolean _bfd_generic_set_section_contents
#define _bfd_nodynamic_get_dynamic_symtab_upper_bound _bfd_n1
#define _bfd_nodynamic_canonicalize_dynamic_symtab \
- ((long (*) PARAMS ((bfd *, asymbol **))) _bfd_n1)
+ ((long (*) (bfd *, asymbol **)) _bfd_n1)
#define _bfd_nodynamic_get_dynamic_reloc_upper_bound _bfd_n1
#define _bfd_nodynamic_canonicalize_dynamic_reloc \
- ((long (*) PARAMS ((bfd *, arelent **, asymbol **))) _bfd_n1)
+ ((long (*) (bfd *, arelent **, asymbol **)) _bfd_n1)
/* Generic routine to determine of the given symbol is a local
label. */
-extern boolean bfd_generic_is_local_label_name PARAMS ((bfd *, const char *));
+extern bfd_boolean bfd_generic_is_local_label_name
+ (bfd *, const char *);
/* Generic minisymbol routines. */
extern long _bfd_generic_read_minisymbols
- PARAMS ((bfd *, boolean, PTR *, unsigned int *));
+ (bfd *, bfd_boolean, void **, unsigned int *);
extern asymbol *_bfd_generic_minisymbol_to_symbol
- PARAMS ((bfd *, boolean, const PTR, asymbol *));
+ (bfd *, bfd_boolean, const void *, asymbol *);
/* Find the nearest line using .stab/.stabstr sections. */
-extern boolean _bfd_stab_section_find_nearest_line
- PARAMS ((bfd *, asymbol **, asection *, bfd_vma, boolean *, const char **,
- const char **, unsigned int *, PTR *));
+extern bfd_boolean _bfd_stab_section_find_nearest_line
+ (bfd *, asymbol **, asection *, bfd_vma, bfd_boolean *,
+ const char **, const char **, unsigned int *, void **);
/* Find the neaderst line using DWARF 1 debugging information. */
-extern boolean _bfd_dwarf1_find_nearest_line
- PARAMS ((bfd *, asection *, asymbol **, bfd_vma, const char **,
- const char **, unsigned int *));
+extern bfd_boolean _bfd_dwarf1_find_nearest_line
+ (bfd *, asection *, asymbol **, bfd_vma, const char **,
+ const char **, unsigned int *);
/* Find the nearest line using DWARF 2 debugging information. */
-extern boolean _bfd_dwarf2_find_nearest_line
- PARAMS ((bfd *, asection *, asymbol **, bfd_vma, const char **,
- const char **, unsigned int *, unsigned int,
- PTR *));
+extern bfd_boolean _bfd_dwarf2_find_nearest_line
+ (bfd *, asection *, asymbol **, bfd_vma, const char **, const char **,
+ unsigned int *, unsigned int, void **);
/* Create a new section entry. */
extern struct bfd_hash_entry *bfd_section_hash_newfunc
- PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, const char *));
+ (struct bfd_hash_entry *, struct bfd_hash_table *, const char *);
/* A routine to create entries for a bfd_link_hash_table. */
extern struct bfd_hash_entry *_bfd_link_hash_newfunc
- PARAMS ((struct bfd_hash_entry *entry,
- struct bfd_hash_table *table,
- const char *string));
+ (struct bfd_hash_entry *entry, struct bfd_hash_table *table,
+ const char *string);
/* Initialize a bfd_link_hash_table. */
-extern boolean _bfd_link_hash_table_init
- PARAMS ((struct bfd_link_hash_table *, bfd *,
- struct bfd_hash_entry *(*) (struct bfd_hash_entry *,
- struct bfd_hash_table *,
- const char *)));
+extern bfd_boolean _bfd_link_hash_table_init
+ (struct bfd_link_hash_table *, bfd *,
+ struct bfd_hash_entry *(*) (struct bfd_hash_entry *,
+ struct bfd_hash_table *,
+ const char *));
/* Generic link hash table creation routine. */
extern struct bfd_link_hash_table *_bfd_generic_link_hash_table_create
- PARAMS ((bfd *));
+ (bfd *);
/* Generic link hash table destruction routine. */
extern void _bfd_generic_link_hash_table_free
- PARAMS ((struct bfd_link_hash_table *));
+ (struct bfd_link_hash_table *);
/* Generic add symbol routine. */
-extern boolean _bfd_generic_link_add_symbols
- PARAMS ((bfd *, struct bfd_link_info *));
+extern bfd_boolean _bfd_generic_link_add_symbols
+ (bfd *, struct bfd_link_info *);
/* Generic add symbol routine. This version is used by targets for
which the linker must collect constructors and destructors by name,
as the collect2 program does. */
-extern boolean _bfd_generic_link_add_symbols_collect
- PARAMS ((bfd *, struct bfd_link_info *));
+extern bfd_boolean _bfd_generic_link_add_symbols_collect
+ (bfd *, struct bfd_link_info *);
/* Generic archive add symbol routine. */
-extern boolean _bfd_generic_link_add_archive_symbols
- PARAMS ((bfd *, struct bfd_link_info *,
- boolean (*checkfn) (bfd *, struct bfd_link_info *, boolean *)));
+extern bfd_boolean _bfd_generic_link_add_archive_symbols
+ (bfd *, struct bfd_link_info *,
+ bfd_boolean (*) (bfd *, struct bfd_link_info *, bfd_boolean *));
/* Forward declaration to avoid prototype errors. */
typedef struct bfd_link_hash_entry _bfd_link_hash_entry;
/* Generic routine to add a single symbol. */
-extern boolean _bfd_generic_link_add_one_symbol
- PARAMS ((struct bfd_link_info *, bfd *, const char *name, flagword,
- asection *, bfd_vma, const char *, boolean copy,
- boolean constructor, struct bfd_link_hash_entry **));
+extern bfd_boolean _bfd_generic_link_add_one_symbol
+ (struct bfd_link_info *, bfd *, const char *name, flagword,
+ asection *, bfd_vma, const char *, bfd_boolean copy,
+ bfd_boolean constructor, struct bfd_link_hash_entry **);
/* Generic routine to mark section as supplying symbols only. */
extern void _bfd_generic_link_just_syms
- PARAMS ((asection *, struct bfd_link_info *));
+ (asection *, struct bfd_link_info *);
/* Generic link routine. */
-extern boolean _bfd_generic_final_link
- PARAMS ((bfd *, struct bfd_link_info *));
+extern bfd_boolean _bfd_generic_final_link
+ (bfd *, struct bfd_link_info *);
-extern boolean _bfd_generic_link_split_section
- PARAMS ((bfd *, struct sec *));
+extern bfd_boolean _bfd_generic_link_split_section
+ (bfd *, struct bfd_section *);
/* Generic reloc_link_order processing routine. */
-extern boolean _bfd_generic_reloc_link_order
- PARAMS ((bfd *, struct bfd_link_info *, asection *,
- struct bfd_link_order *));
+extern bfd_boolean _bfd_generic_reloc_link_order
+ (bfd *, struct bfd_link_info *, asection *, struct bfd_link_order *);
/* Default link order processing routine. */
-extern boolean _bfd_default_link_order
- PARAMS ((bfd *, struct bfd_link_info *, asection *,
- struct bfd_link_order *));
+extern bfd_boolean _bfd_default_link_order
+ (bfd *, struct bfd_link_info *, asection *, struct bfd_link_order *);
/* Count the number of reloc entries in a link order list. */
extern unsigned int _bfd_count_link_order_relocs
- PARAMS ((struct bfd_link_order *));
+ (struct bfd_link_order *);
/* Final link relocation routine. */
extern bfd_reloc_status_type _bfd_final_link_relocate
- PARAMS ((reloc_howto_type *, bfd *, asection *, bfd_byte *,
- bfd_vma, bfd_vma, bfd_vma));
+ (reloc_howto_type *, bfd *, asection *, bfd_byte *,
+ bfd_vma, bfd_vma, bfd_vma);
/* Relocate a particular location by a howto and a value. */
extern bfd_reloc_status_type _bfd_relocate_contents
- PARAMS ((reloc_howto_type *, bfd *, bfd_vma, bfd_byte *));
+ (reloc_howto_type *, bfd *, bfd_vma, bfd_byte *);
/* Link stabs in sections in the first pass. */
-extern boolean _bfd_link_section_stabs
- PARAMS ((bfd *, PTR *, asection *, asection *, PTR *));
+extern bfd_boolean _bfd_link_section_stabs
+ (bfd *, void **, asection *, asection *, void **, bfd_size_type *);
/* Eliminate stabs for discarded functions and symbols. */
-extern boolean _bfd_discard_section_stabs
- PARAMS ((bfd *, asection *, PTR,
- boolean (*) (bfd_vma, PTR), PTR));
+extern bfd_boolean _bfd_discard_section_stabs
+ (bfd *, asection *, void *, bfd_boolean (*) (bfd_vma, void *), void *);
/* Write out the .stab section when linking stabs in sections. */
-extern boolean _bfd_write_section_stabs
- PARAMS ((bfd *, PTR *, asection *, PTR *, bfd_byte *));
+extern bfd_boolean _bfd_write_section_stabs
+ (bfd *, void **, asection *, void **, bfd_byte *);
/* Write out the .stabstr string table when linking stabs in sections. */
-extern boolean _bfd_write_stab_strings PARAMS ((bfd *, PTR *));
+extern bfd_boolean _bfd_write_stab_strings
+ (bfd *, void **);
/* Find an offset within a .stab section when linking stabs in
sections. */
extern bfd_vma _bfd_stab_section_offset
- PARAMS ((bfd *, PTR *, asection *, PTR *, bfd_vma));
+ (bfd *, void **, asection *, void **, bfd_vma);
/* Attempt to merge a SEC_MERGE section. */
-extern boolean _bfd_merge_section
- PARAMS ((bfd *, PTR *, asection *, PTR *));
+extern bfd_boolean _bfd_merge_section
+ (bfd *, void **, asection *, void **);
/* Attempt to merge SEC_MERGE sections. */
-extern boolean _bfd_merge_sections
- PARAMS ((bfd *, PTR, void (*)(bfd *, asection *)));
+extern bfd_boolean _bfd_merge_sections
+ (bfd *, void *, void (*) (bfd *, asection *));
/* Write out a merged section. */
-extern boolean _bfd_write_merged_section
- PARAMS ((bfd *, asection *, PTR));
+extern bfd_boolean _bfd_write_merged_section
+ (bfd *, asection *, void *);
/* Find an offset within a modified SEC_MERGE section. */
extern bfd_vma _bfd_merged_section_offset
- PARAMS ((bfd *, asection **, PTR, bfd_vma, bfd_vma));
+ (bfd *, asection **, void *, bfd_vma, bfd_vma);
/* Create a string table. */
-extern struct bfd_strtab_hash *_bfd_stringtab_init PARAMS ((void));
+extern struct bfd_strtab_hash *_bfd_stringtab_init
+ (void);
/* Create an XCOFF .debug section style string table. */
-extern struct bfd_strtab_hash *_bfd_xcoff_stringtab_init PARAMS ((void));
+extern struct bfd_strtab_hash *_bfd_xcoff_stringtab_init
+ (void);
/* Free a string table. */
-extern void _bfd_stringtab_free PARAMS ((struct bfd_strtab_hash *));
+extern void _bfd_stringtab_free
+ (struct bfd_strtab_hash *);
/* Get the size of a string table. */
-extern bfd_size_type _bfd_stringtab_size PARAMS ((struct bfd_strtab_hash *));
+extern bfd_size_type _bfd_stringtab_size
+ (struct bfd_strtab_hash *);
/* Add a string to a string table. */
extern bfd_size_type _bfd_stringtab_add
- PARAMS ((struct bfd_strtab_hash *, const char *, boolean hash,
- boolean copy));
+ (struct bfd_strtab_hash *, const char *, bfd_boolean hash, bfd_boolean copy);
/* Write out a string table. */
-extern boolean _bfd_stringtab_emit PARAMS ((bfd *, struct bfd_strtab_hash *));
+extern bfd_boolean _bfd_stringtab_emit
+ (bfd *, struct bfd_strtab_hash *);
/* Check that endianness of input and output file match. */
-extern boolean _bfd_generic_verify_endian_match PARAMS ((bfd *, bfd *));
+extern bfd_boolean _bfd_generic_verify_endian_match
+ (bfd *, bfd *);
/* Macros to tell if bfds are read or write enabled.
@@ -541,19 +575,22 @@ extern boolean _bfd_generic_verify_endian_match PARAMS ((bfd *, bfd *));
!bfd_read_p, and only sometimes bfd_write_p.
*/
-#define bfd_read_p(abfd) ((abfd)->direction == read_direction || (abfd)->direction == both_direction)
-#define bfd_write_p(abfd) ((abfd)->direction == write_direction || (abfd)->direction == both_direction)
+#define bfd_read_p(abfd) \
+ ((abfd)->direction == read_direction || (abfd)->direction == both_direction)
+#define bfd_write_p(abfd) \
+ ((abfd)->direction == write_direction || (abfd)->direction == both_direction)
-void bfd_assert PARAMS ((const char*,int));
+void bfd_assert
+ (const char*,int);
#define BFD_ASSERT(x) \
-{ if (!(x)) bfd_assert(__FILE__,__LINE__); }
+ { if (!(x)) bfd_assert(__FILE__,__LINE__); }
#define BFD_FAIL() \
-{ bfd_assert(__FILE__,__LINE__); }
+ { bfd_assert(__FILE__,__LINE__); }
-extern void _bfd_abort PARAMS ((const char *, int, const char *))
- ATTRIBUTE_NORETURN;
+extern void _bfd_abort
+ (const char *, int, const char *) ATTRIBUTE_NORETURN;
/* if gcc >= 2.6, we can give a function name, too */
#if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 6)
@@ -563,7 +600,13 @@ extern void _bfd_abort PARAMS ((const char *, int, const char *))
#undef abort
#define abort() _bfd_abort (__FILE__, __LINE__, __PRETTY_FUNCTION__)
-FILE * bfd_cache_lookup_worker PARAMS ((bfd *));
+/* Manipulate a system FILE but using BFD's "file_ptr", rather than
+ the system "off_t" or "off64_t", as the offset. */
+extern file_ptr real_ftell (FILE *file);
+extern int real_fseek (FILE *file, file_ptr offset, int whence);
+
+FILE * bfd_cache_lookup_worker
+ (bfd *);
extern bfd *bfd_last_cache;
@@ -572,6 +615,9 @@ extern bfd *bfd_last_cache;
extern const bfd_target * const *bfd_target_vector;
extern const bfd_target *bfd_default_vector[];
+/* List of associated target vectors. */
+extern const bfd_target * const *bfd_associated_vector;
+
/* Functions shared by the ECOFF and MIPS ELF backends, which have no
other common header files. */
@@ -579,33 +625,46 @@ extern const bfd_target *bfd_default_vector[];
struct ecoff_find_line;
#endif
-extern boolean _bfd_ecoff_locate_line
- PARAMS ((bfd *, asection *, bfd_vma, struct ecoff_debug_info * const,
- const struct ecoff_debug_swap * const, struct ecoff_find_line *,
- const char **, const char **, unsigned int *));
-extern boolean _bfd_ecoff_get_accumulated_pdr PARAMS ((PTR, bfd_byte *));
-extern boolean _bfd_ecoff_get_accumulated_sym PARAMS ((PTR, bfd_byte *));
-extern boolean _bfd_ecoff_get_accumulated_ss PARAMS ((PTR, bfd_byte *));
-
-extern bfd_vma _bfd_get_gp_value PARAMS ((bfd *));
-extern void _bfd_set_gp_value PARAMS ((bfd *, bfd_vma));
+extern bfd_boolean _bfd_ecoff_locate_line
+ (bfd *, asection *, bfd_vma, struct ecoff_debug_info * const,
+ const struct ecoff_debug_swap * const, struct ecoff_find_line *,
+ const char **, const char **, unsigned int *);
+extern bfd_boolean _bfd_ecoff_get_accumulated_pdr
+ (void *, bfd_byte *);
+extern bfd_boolean _bfd_ecoff_get_accumulated_sym
+ (void *, bfd_byte *);
+extern bfd_boolean _bfd_ecoff_get_accumulated_ss
+ (void *, bfd_byte *);
+
+extern bfd_vma _bfd_get_gp_value
+ (bfd *);
+extern void _bfd_set_gp_value
+ (bfd *, bfd_vma);
/* Function shared by the COFF and ELF SH backends, which have no
other common header files. */
-extern boolean _bfd_sh_align_load_span
- PARAMS ((bfd *, asection *, bfd_byte *,
- boolean (*) (bfd *, asection *, PTR, bfd_byte *, bfd_vma),
- PTR, bfd_vma **, bfd_vma *, bfd_vma, bfd_vma, boolean *));
-
+#ifndef _bfd_sh_align_load_span
+extern bfd_boolean _bfd_sh_align_load_span
+ (bfd *, asection *, bfd_byte *,
+ bfd_boolean (*) (bfd *, asection *, void *, bfd_byte *, bfd_vma),
+ void *, bfd_vma **, bfd_vma *, bfd_vma, bfd_vma, bfd_boolean *);
+#endif
/* Extracted from init.c. */
/* Extracted from libbfd.c. */
-boolean
-bfd_write_bigendian_4byte_int PARAMS ((bfd *, unsigned int));
+bfd_boolean bfd_write_bigendian_4byte_int (bfd *, unsigned int);
-unsigned int
-bfd_log2 PARAMS ((bfd_vma x));
+unsigned int bfd_log2 (bfd_vma x);
+/* Extracted from bfdio.c. */
+/* Extracted from bfdwin.c. */
+struct _bfd_window_internal {
+ struct _bfd_window_internal *next;
+ void *data;
+ bfd_size_type size;
+ int refcount : 31; /* should be enough... */
+ unsigned mapped : 1; /* 1 = mmap, 0 = malloc */
+};
/* Extracted from cache.c. */
#define BFD_CACHE_MAX_OPEN 10
extern bfd *bfd_last_cache;
@@ -614,17 +673,13 @@ extern bfd *bfd_last_cache;
((x)==bfd_last_cache? \
(FILE*) (bfd_last_cache->iostream): \
bfd_cache_lookup_worker(x))
-boolean
-bfd_cache_init PARAMS ((bfd *abfd));
+bfd_boolean bfd_cache_init (bfd *abfd);
-boolean
-bfd_cache_close PARAMS ((bfd *abfd));
+bfd_boolean bfd_cache_close (bfd *abfd);
-FILE*
-bfd_open_file PARAMS ((bfd *abfd));
+FILE* bfd_open_file (bfd *abfd);
-FILE *
-bfd_cache_lookup_worker PARAMS ((bfd *abfd));
+FILE *bfd_cache_lookup_worker (bfd *abfd);
/* Extracted from reloc.c. */
#ifdef _BFD_MAKE_TABLE_bfd_reloc_code_real
@@ -726,6 +781,30 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@",
"BFD_RELOC_SPARC_L44",
"BFD_RELOC_SPARC_REGISTER",
"BFD_RELOC_SPARC_REV32",
+ "BFD_RELOC_SPARC_TLS_GD_HI22",
+ "BFD_RELOC_SPARC_TLS_GD_LO10",
+ "BFD_RELOC_SPARC_TLS_GD_ADD",
+ "BFD_RELOC_SPARC_TLS_GD_CALL",
+ "BFD_RELOC_SPARC_TLS_LDM_HI22",
+ "BFD_RELOC_SPARC_TLS_LDM_LO10",
+ "BFD_RELOC_SPARC_TLS_LDM_ADD",
+ "BFD_RELOC_SPARC_TLS_LDM_CALL",
+ "BFD_RELOC_SPARC_TLS_LDO_HIX22",
+ "BFD_RELOC_SPARC_TLS_LDO_LOX10",
+ "BFD_RELOC_SPARC_TLS_LDO_ADD",
+ "BFD_RELOC_SPARC_TLS_IE_HI22",
+ "BFD_RELOC_SPARC_TLS_IE_LO10",
+ "BFD_RELOC_SPARC_TLS_IE_LD",
+ "BFD_RELOC_SPARC_TLS_IE_LDX",
+ "BFD_RELOC_SPARC_TLS_IE_ADD",
+ "BFD_RELOC_SPARC_TLS_LE_HIX22",
+ "BFD_RELOC_SPARC_TLS_LE_LOX10",
+ "BFD_RELOC_SPARC_TLS_DTPMOD32",
+ "BFD_RELOC_SPARC_TLS_DTPMOD64",
+ "BFD_RELOC_SPARC_TLS_DTPOFF32",
+ "BFD_RELOC_SPARC_TLS_DTPOFF64",
+ "BFD_RELOC_SPARC_TLS_TPOFF32",
+ "BFD_RELOC_SPARC_TLS_TPOFF64",
"BFD_RELOC_ALPHA_GPDISP_HI16",
"BFD_RELOC_ALPHA_GPDISP_LO16",
"BFD_RELOC_ALPHA_GPDISP",
@@ -781,6 +860,7 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@",
"BFD_RELOC_MIPS_REL16",
"BFD_RELOC_MIPS_RELGOT",
"BFD_RELOC_MIPS_JALR",
+
"BFD_RELOC_FRV_LABEL16",
"BFD_RELOC_FRV_LABEL24",
"BFD_RELOC_FRV_LO16",
@@ -790,6 +870,29 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@",
"BFD_RELOC_FRV_GPREL32",
"BFD_RELOC_FRV_GPRELHI",
"BFD_RELOC_FRV_GPRELLO",
+ "BFD_RELOC_FRV_GOT12",
+ "BFD_RELOC_FRV_GOTHI",
+ "BFD_RELOC_FRV_GOTLO",
+ "BFD_RELOC_FRV_FUNCDESC",
+ "BFD_RELOC_FRV_FUNCDESC_GOT12",
+ "BFD_RELOC_FRV_FUNCDESC_GOTHI",
+ "BFD_RELOC_FRV_FUNCDESC_GOTLO",
+ "BFD_RELOC_FRV_FUNCDESC_VALUE",
+ "BFD_RELOC_FRV_FUNCDESC_GOTOFF12",
+ "BFD_RELOC_FRV_FUNCDESC_GOTOFFHI",
+ "BFD_RELOC_FRV_FUNCDESC_GOTOFFLO",
+ "BFD_RELOC_FRV_GOTOFF12",
+ "BFD_RELOC_FRV_GOTOFFHI",
+ "BFD_RELOC_FRV_GOTOFFLO",
+
+ "BFD_RELOC_MN10300_GOTOFF24",
+ "BFD_RELOC_MN10300_GOT32",
+ "BFD_RELOC_MN10300_GOT24",
+ "BFD_RELOC_MN10300_GOT16",
+ "BFD_RELOC_MN10300_COPY",
+ "BFD_RELOC_MN10300_GLOB_DAT",
+ "BFD_RELOC_MN10300_JMP_SLOT",
+ "BFD_RELOC_MN10300_RELATIVE",
"BFD_RELOC_386_GOT32",
"BFD_RELOC_386_PLT32",
@@ -819,6 +922,14 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@",
"BFD_RELOC_X86_64_RELATIVE",
"BFD_RELOC_X86_64_GOTPCREL",
"BFD_RELOC_X86_64_32S",
+ "BFD_RELOC_X86_64_DTPMOD64",
+ "BFD_RELOC_X86_64_DTPOFF64",
+ "BFD_RELOC_X86_64_TPOFF64",
+ "BFD_RELOC_X86_64_TLSGD",
+ "BFD_RELOC_X86_64_TLSLD",
+ "BFD_RELOC_X86_64_DTPOFF32",
+ "BFD_RELOC_X86_64_GOTTPOFF",
+ "BFD_RELOC_X86_64_TPOFF32",
"BFD_RELOC_NS32K_IMM_8",
"BFD_RELOC_NS32K_IMM_16",
"BFD_RELOC_NS32K_IMM_32",
@@ -892,6 +1003,46 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@",
"BFD_RELOC_PPC64_TOC16_LO_DS",
"BFD_RELOC_PPC64_PLTGOT16_DS",
"BFD_RELOC_PPC64_PLTGOT16_LO_DS",
+ "BFD_RELOC_PPC_TLS",
+ "BFD_RELOC_PPC_DTPMOD",
+ "BFD_RELOC_PPC_TPREL16",
+ "BFD_RELOC_PPC_TPREL16_LO",
+ "BFD_RELOC_PPC_TPREL16_HI",
+ "BFD_RELOC_PPC_TPREL16_HA",
+ "BFD_RELOC_PPC_TPREL",
+ "BFD_RELOC_PPC_DTPREL16",
+ "BFD_RELOC_PPC_DTPREL16_LO",
+ "BFD_RELOC_PPC_DTPREL16_HI",
+ "BFD_RELOC_PPC_DTPREL16_HA",
+ "BFD_RELOC_PPC_DTPREL",
+ "BFD_RELOC_PPC_GOT_TLSGD16",
+ "BFD_RELOC_PPC_GOT_TLSGD16_LO",
+ "BFD_RELOC_PPC_GOT_TLSGD16_HI",
+ "BFD_RELOC_PPC_GOT_TLSGD16_HA",
+ "BFD_RELOC_PPC_GOT_TLSLD16",
+ "BFD_RELOC_PPC_GOT_TLSLD16_LO",
+ "BFD_RELOC_PPC_GOT_TLSLD16_HI",
+ "BFD_RELOC_PPC_GOT_TLSLD16_HA",
+ "BFD_RELOC_PPC_GOT_TPREL16",
+ "BFD_RELOC_PPC_GOT_TPREL16_LO",
+ "BFD_RELOC_PPC_GOT_TPREL16_HI",
+ "BFD_RELOC_PPC_GOT_TPREL16_HA",
+ "BFD_RELOC_PPC_GOT_DTPREL16",
+ "BFD_RELOC_PPC_GOT_DTPREL16_LO",
+ "BFD_RELOC_PPC_GOT_DTPREL16_HI",
+ "BFD_RELOC_PPC_GOT_DTPREL16_HA",
+ "BFD_RELOC_PPC64_TPREL16_DS",
+ "BFD_RELOC_PPC64_TPREL16_LO_DS",
+ "BFD_RELOC_PPC64_TPREL16_HIGHER",
+ "BFD_RELOC_PPC64_TPREL16_HIGHERA",
+ "BFD_RELOC_PPC64_TPREL16_HIGHEST",
+ "BFD_RELOC_PPC64_TPREL16_HIGHESTA",
+ "BFD_RELOC_PPC64_DTPREL16_DS",
+ "BFD_RELOC_PPC64_DTPREL16_LO_DS",
+ "BFD_RELOC_PPC64_DTPREL16_HIGHER",
+ "BFD_RELOC_PPC64_DTPREL16_HIGHERA",
+ "BFD_RELOC_PPC64_DTPREL16_HIGHEST",
+ "BFD_RELOC_PPC64_DTPREL16_HIGHESTA",
"BFD_RELOC_I370_D12",
"BFD_RELOC_CTOR",
"BFD_RELOC_ARM_PCREL_BRANCH",
@@ -904,6 +1055,7 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@",
"BFD_RELOC_ARM_SWI",
"BFD_RELOC_ARM_MULTI",
"BFD_RELOC_ARM_CP_OFF_IMM",
+ "BFD_RELOC_ARM_CP_OFF_IMM_S2",
"BFD_RELOC_ARM_ADR_IMM",
"BFD_RELOC_ARM_LDR_IMM",
"BFD_RELOC_ARM_LITERAL",
@@ -997,6 +1149,14 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@",
"BFD_RELOC_SH_IMM_HI16",
"BFD_RELOC_SH_IMM_HI16_PCREL",
"BFD_RELOC_SH_PT_16",
+ "BFD_RELOC_SH_TLS_GD_32",
+ "BFD_RELOC_SH_TLS_LD_32",
+ "BFD_RELOC_SH_TLS_LDO_32",
+ "BFD_RELOC_SH_TLS_IE_32",
+ "BFD_RELOC_SH_TLS_LE_32",
+ "BFD_RELOC_SH_TLS_DTPMOD32",
+ "BFD_RELOC_SH_TLS_DTPOFF32",
+ "BFD_RELOC_SH_TLS_TPOFF32",
"BFD_RELOC_THUMB_PCREL_BRANCH9",
"BFD_RELOC_THUMB_PCREL_BRANCH12",
"BFD_RELOC_THUMB_PCREL_BRANCH23",
@@ -1028,6 +1188,20 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@",
"BFD_RELOC_M32R_HI16_SLO",
"BFD_RELOC_M32R_LO16",
"BFD_RELOC_M32R_SDA16",
+ "BFD_RELOC_M32R_GOT24",
+ "BFD_RELOC_M32R_26_PLTREL",
+ "BFD_RELOC_M32R_COPY",
+ "BFD_RELOC_M32R_GLOB_DAT",
+ "BFD_RELOC_M32R_JMP_SLOT",
+ "BFD_RELOC_M32R_RELATIVE",
+ "BFD_RELOC_M32R_GOTOFF",
+ "BFD_RELOC_M32R_GOTPC24",
+ "BFD_RELOC_M32R_GOT16_HI_ULO",
+ "BFD_RELOC_M32R_GOT16_HI_SLO",
+ "BFD_RELOC_M32R_GOT16_LO",
+ "BFD_RELOC_M32R_GOTPC_HI_ULO",
+ "BFD_RELOC_M32R_GOTPC_HI_SLO",
+ "BFD_RELOC_M32R_GOTPC_LO",
"BFD_RELOC_V850_9_PCREL",
"BFD_RELOC_V850_22_PCREL",
"BFD_RELOC_V850_SDA_16_16_OFFSET",
@@ -1044,7 +1218,9 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@",
"BFD_RELOC_V850_ZDA_16_16_SPLIT_OFFSET",
"BFD_RELOC_V850_CALLT_6_7_OFFSET",
"BFD_RELOC_V850_CALLT_16_16_OFFSET",
-
+ "BFD_RELOC_V850_LONGCALL",
+ "BFD_RELOC_V850_LONGJUMP",
+ "BFD_RELOC_V850_ALIGN",
"BFD_RELOC_MN10300_32_PCREL",
"BFD_RELOC_MN10300_16_PCREL",
"BFD_RELOC_TIC30_LDP",
@@ -1080,6 +1256,7 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@",
"BFD_RELOC_MMIX_PUSHJ_1",
"BFD_RELOC_MMIX_PUSHJ_2",
"BFD_RELOC_MMIX_PUSHJ_3",
+ "BFD_RELOC_MMIX_PUSHJ_STUBBABLE",
"BFD_RELOC_MMIX_JMP",
"BFD_RELOC_MMIX_JMP_1",
"BFD_RELOC_MMIX_JMP_2",
@@ -1123,6 +1300,53 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@",
"BFD_RELOC_390_GOT64",
"BFD_RELOC_390_PLT64",
"BFD_RELOC_390_GOTENT",
+ "BFD_RELOC_390_GOTOFF64",
+ "BFD_RELOC_390_GOTPLT12",
+ "BFD_RELOC_390_GOTPLT16",
+ "BFD_RELOC_390_GOTPLT32",
+ "BFD_RELOC_390_GOTPLT64",
+ "BFD_RELOC_390_GOTPLTENT",
+ "BFD_RELOC_390_PLTOFF16",
+ "BFD_RELOC_390_PLTOFF32",
+ "BFD_RELOC_390_PLTOFF64",
+ "BFD_RELOC_390_TLS_LOAD",
+ "BFD_RELOC_390_TLS_GDCALL",
+ "BFD_RELOC_390_TLS_LDCALL",
+ "BFD_RELOC_390_TLS_GD32",
+ "BFD_RELOC_390_TLS_GD64",
+ "BFD_RELOC_390_TLS_GOTIE12",
+ "BFD_RELOC_390_TLS_GOTIE32",
+ "BFD_RELOC_390_TLS_GOTIE64",
+ "BFD_RELOC_390_TLS_LDM32",
+ "BFD_RELOC_390_TLS_LDM64",
+ "BFD_RELOC_390_TLS_IE32",
+ "BFD_RELOC_390_TLS_IE64",
+ "BFD_RELOC_390_TLS_IEENT",
+ "BFD_RELOC_390_TLS_LE32",
+ "BFD_RELOC_390_TLS_LE64",
+ "BFD_RELOC_390_TLS_LDO32",
+ "BFD_RELOC_390_TLS_LDO64",
+ "BFD_RELOC_390_TLS_DTPMOD",
+ "BFD_RELOC_390_TLS_DTPOFF",
+ "BFD_RELOC_390_TLS_TPOFF",
+ "BFD_RELOC_390_20",
+ "BFD_RELOC_390_GOT20",
+ "BFD_RELOC_390_GOTPLT20",
+ "BFD_RELOC_390_TLS_GOTIE20",
+ "BFD_RELOC_IP2K_FR9",
+ "BFD_RELOC_IP2K_BANK",
+ "BFD_RELOC_IP2K_ADDR16CJP",
+ "BFD_RELOC_IP2K_PAGE3",
+ "BFD_RELOC_IP2K_LO8DATA",
+ "BFD_RELOC_IP2K_HI8DATA",
+ "BFD_RELOC_IP2K_EX8DATA",
+ "BFD_RELOC_IP2K_LO8INSN",
+ "BFD_RELOC_IP2K_HI8INSN",
+ "BFD_RELOC_IP2K_PC_SKIP",
+ "BFD_RELOC_IP2K_TEXT",
+ "BFD_RELOC_IP2K_FR_OFFSET",
+ "BFD_RELOC_VPE4KMATH_DATA",
+ "BFD_RELOC_VPE4KMATH_INSN",
"BFD_RELOC_VTABLE_INHERIT",
"BFD_RELOC_VTABLE_ENTRY",
"BFD_RELOC_IA64_IMM14",
@@ -1207,6 +1431,12 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@",
"BFD_RELOC_M68HC11_HI8",
"BFD_RELOC_M68HC11_LO8",
"BFD_RELOC_M68HC11_3B",
+ "BFD_RELOC_M68HC11_RL_JUMP",
+ "BFD_RELOC_M68HC11_RL_GROUP",
+ "BFD_RELOC_M68HC11_LO16",
+ "BFD_RELOC_M68HC11_PAGE",
+ "BFD_RELOC_M68HC11_24",
+ "BFD_RELOC_M68HC12_5B",
"BFD_RELOC_CRIS_BDISP8",
"BFD_RELOC_CRIS_UNSIGNED_5",
"BFD_RELOC_CRIS_SIGNED_6",
@@ -1263,53 +1493,68 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@",
"BFD_RELOC_H8_DIR24R8",
"BFD_RELOC_H8_DIR32A16",
"BFD_RELOC_XSTORMY16_REL_12",
+ "BFD_RELOC_XSTORMY16_12",
"BFD_RELOC_XSTORMY16_24",
"BFD_RELOC_XSTORMY16_FPTR16",
"BFD_RELOC_VAX_GLOB_DAT",
"BFD_RELOC_VAX_JMP_SLOT",
"BFD_RELOC_VAX_RELATIVE",
+ "BFD_RELOC_MSP430_10_PCREL",
+ "BFD_RELOC_MSP430_16_PCREL",
+ "BFD_RELOC_MSP430_16",
+ "BFD_RELOC_MSP430_16_PCREL_BYTE",
+ "BFD_RELOC_MSP430_16_BYTE",
+ "BFD_RELOC_IQ2000_OFFSET_16",
+ "BFD_RELOC_IQ2000_OFFSET_21",
+ "BFD_RELOC_IQ2000_UHI16",
+ "BFD_RELOC_XTENSA_RTLD",
+ "BFD_RELOC_XTENSA_GLOB_DAT",
+ "BFD_RELOC_XTENSA_JMP_SLOT",
+ "BFD_RELOC_XTENSA_RELATIVE",
+ "BFD_RELOC_XTENSA_PLT",
+ "BFD_RELOC_XTENSA_OP0",
+ "BFD_RELOC_XTENSA_OP1",
+ "BFD_RELOC_XTENSA_OP2",
+ "BFD_RELOC_XTENSA_ASM_EXPAND",
+ "BFD_RELOC_XTENSA_ASM_SIMPLIFY",
"@@overflow: BFD_RELOC_UNUSED@@",
};
#endif
-reloc_howto_type *
-bfd_default_reloc_type_lookup PARAMS ((bfd *abfd, bfd_reloc_code_real_type code));
+reloc_howto_type *bfd_default_reloc_type_lookup
+ (bfd *abfd, bfd_reloc_code_real_type code);
-boolean
-bfd_generic_relax_section PARAMS ((bfd *abfd,
+bfd_boolean bfd_generic_relax_section
+ (bfd *abfd,
asection *section,
struct bfd_link_info *,
- boolean *));
+ bfd_boolean *);
-boolean
-bfd_generic_gc_sections PARAMS ((bfd *, struct bfd_link_info *));
+bfd_boolean bfd_generic_gc_sections
+ (bfd *, struct bfd_link_info *);
-boolean
-bfd_generic_merge_sections PARAMS ((bfd *, struct bfd_link_info *));
+bfd_boolean bfd_generic_merge_sections
+ (bfd *, struct bfd_link_info *);
-bfd_byte *
-bfd_generic_get_relocated_section_contents PARAMS ((bfd *abfd,
+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,
- boolean relocateable,
- asymbol **symbols));
+ bfd_boolean relocatable,
+ asymbol **symbols);
/* Extracted from archures.c. */
extern const bfd_arch_info_type bfd_default_arch_struct;
-boolean
-bfd_default_set_arch_mach PARAMS ((bfd *abfd,
- enum bfd_architecture arch,
- unsigned long mach));
+bfd_boolean bfd_default_set_arch_mach
+ (bfd *abfd, enum bfd_architecture arch, unsigned long mach);
-const bfd_arch_info_type *
-bfd_default_compatible PARAMS ((const bfd_arch_info_type *a,
- const bfd_arch_info_type *b));
+const bfd_arch_info_type *bfd_default_compatible
+ (const bfd_arch_info_type *a, const bfd_arch_info_type *b);
-boolean
-bfd_default_scan PARAMS ((const struct bfd_arch_info *info, const char *string));
+bfd_boolean bfd_default_scan
+ (const struct bfd_arch_info *info, const char *string);
/* Extracted from elf.c. */
-struct elf_internal_shdr *
-bfd_elf_find_section PARAMS ((bfd *abfd, char *name));
+struct elf_internal_shdr *bfd_elf_find_section (bfd *abfd, char *name);
diff --git a/contrib/binutils/bfd/libcoff-in.h b/contrib/binutils/bfd/libcoff-in.h
index efc2fee..6b5947c 100644
--- a/contrib/binutils/bfd/libcoff-in.h
+++ b/contrib/binutils/bfd/libcoff-in.h
@@ -1,6 +1,6 @@
/* BFD COFF object file private structure.
Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
- 2000, 2001, 2002
+ 2000, 2001, 2002, 2003
Free Software Foundation, Inc.
Written by Cygnus Support.
@@ -74,16 +74,16 @@ typedef struct coff_tdata
/* The unswapped external symbols. May be NULL. Read by
_bfd_coff_get_external_symbols. */
PTR external_syms;
- /* If this is true, the external_syms may not be freed. */
- boolean keep_syms;
+ /* If this is TRUE, the external_syms may not be freed. */
+ bfd_boolean keep_syms;
/* The string table. May be NULL. Read by
_bfd_coff_read_string_table. */
char *strings;
- /* If this is true, the strings may not be freed. */
- boolean keep_strings;
- /* If this is true, the strings have been written out already. */
- boolean strings_written;
+ /* If this is TRUE, the strings may not be freed. */
+ bfd_boolean keep_strings;
+ /* If this is TRUE, the strings have been written out already. */
+ bfd_boolean strings_written;
/* is this a PE format coff file */
int pe;
@@ -117,10 +117,10 @@ typedef struct pe_tdata
struct internal_extra_pe_aouthdr pe_opthdr;
int dll;
int has_reloc_section;
- boolean (*in_reloc_p) PARAMS((bfd *, reloc_howto_type *));
+ bfd_boolean (*in_reloc_p) PARAMS((bfd *, reloc_howto_type *));
flagword real_flags;
int target_subsystem;
- boolean force_minimum_alignment;
+ bfd_boolean force_minimum_alignment;
} pe_data_type;
#define pe_data(bfd) ((bfd)->tdata.pe_obj_data)
@@ -132,11 +132,11 @@ struct xcoff_tdata
/* Basic COFF information. */
coff_data_type coff;
- /* True if this is an XCOFF64 file. */
- boolean xcoff64;
+ /* TRUE if this is an XCOFF64 file. */
+ bfd_boolean xcoff64;
- /* True if a large a.out header should be generated. */
- boolean full_aouthdr;
+ /* TRUE if a large a.out header should be generated. */
+ bfd_boolean full_aouthdr;
/* TOC value. */
bfd_vma toc;
@@ -184,12 +184,12 @@ struct coff_section_tdata
{
/* The relocs, swapped into COFF internal form. This may be NULL. */
struct internal_reloc *relocs;
- /* If this is true, the relocs entry may not be freed. */
- boolean keep_relocs;
+ /* If this is TRUE, the relocs entry may not be freed. */
+ bfd_boolean keep_relocs;
/* The section contents. This may be NULL. */
bfd_byte *contents;
- /* If this is true, the contents entry may not be freed. */
- boolean keep_contents;
+ /* If this is TRUE, the contents entry may not be freed. */
+ bfd_boolean keep_contents;
/* Information cached by coff_find_nearest_line. */
bfd_vma offset;
unsigned int i;
@@ -291,7 +291,7 @@ struct coff_link_hash_table
#define coff_link_hash_traverse(table, func, info) \
(bfd_link_hash_traverse \
(&(table)->root, \
- (boolean (*) PARAMS ((struct bfd_link_hash_entry *, PTR))) (func), \
+ (bfd_boolean (*) PARAMS ((struct bfd_link_hash_entry *, PTR))) (func), \
(info)))
/* Get the COFF linker hash table from a link_info structure. */
@@ -301,33 +301,33 @@ struct coff_link_hash_table
/* Functions in coffgen.c. */
extern const bfd_target *coff_object_p
PARAMS ((bfd *));
-extern struct sec *coff_section_from_bfd_index
+extern struct bfd_section *coff_section_from_bfd_index
PARAMS ((bfd *, int));
extern long coff_get_symtab_upper_bound
PARAMS ((bfd *));
-extern long coff_get_symtab
+extern long coff_canonicalize_symtab
PARAMS ((bfd *, asymbol **));
extern int coff_count_linenumbers
PARAMS ((bfd *));
extern struct coff_symbol_struct *coff_symbol_from
PARAMS ((bfd *, asymbol *));
-extern boolean coff_renumber_symbols
+extern bfd_boolean coff_renumber_symbols
PARAMS ((bfd *, int *));
extern void coff_mangle_symbols
PARAMS ((bfd *));
-extern boolean coff_write_symbols
+extern bfd_boolean coff_write_symbols
PARAMS ((bfd *));
-extern boolean coff_write_linenumbers
+extern bfd_boolean coff_write_linenumbers
PARAMS ((bfd *));
extern alent *coff_get_lineno
PARAMS ((bfd *, asymbol *));
extern asymbol *coff_section_symbol
PARAMS ((bfd *, char *));
-extern boolean _bfd_coff_get_external_symbols
+extern bfd_boolean _bfd_coff_get_external_symbols
PARAMS ((bfd *));
extern const char *_bfd_coff_read_string_table
PARAMS ((bfd *));
-extern boolean _bfd_coff_free_symbols
+extern bfd_boolean _bfd_coff_free_symbols
PARAMS ((bfd *));
extern struct coff_ptr_struct *coff_get_normalized_symtab
PARAMS ((bfd *));
@@ -339,20 +339,20 @@ extern void coff_print_symbol
PARAMS ((bfd *, PTR filep, asymbol *, bfd_print_symbol_type));
extern void coff_get_symbol_info
PARAMS ((bfd *, asymbol *, symbol_info *ret));
-extern boolean _bfd_coff_is_local_label_name
+extern bfd_boolean _bfd_coff_is_local_label_name
PARAMS ((bfd *, const char *));
extern asymbol *coff_bfd_make_debug_symbol
PARAMS ((bfd *, PTR, unsigned long));
-extern boolean coff_find_nearest_line
+extern bfd_boolean coff_find_nearest_line
PARAMS ((bfd *, asection *, asymbol **, bfd_vma, const char **,
const char **, unsigned int *));
extern int coff_sizeof_headers
- PARAMS ((bfd *, boolean));
-extern boolean bfd_coff_reloc16_relax_section
- PARAMS ((bfd *, asection *, struct bfd_link_info *, boolean *));
+ PARAMS ((bfd *, bfd_boolean));
+extern bfd_boolean bfd_coff_reloc16_relax_section
+ PARAMS ((bfd *, asection *, struct bfd_link_info *, bfd_boolean *));
extern bfd_byte *bfd_coff_reloc16_get_relocated_section_contents
PARAMS ((bfd *, struct bfd_link_info *, struct bfd_link_order *,
- bfd_byte *, boolean, asymbol **));
+ bfd_byte *, bfd_boolean, asymbol **));
extern bfd_vma bfd_coff_reloc16_get_value
PARAMS ((arelent *, struct bfd_link_info *, asection *));
extern void bfd_perform_slip
@@ -434,7 +434,7 @@ struct coff_debug_merge_hash_table
bfd_hash_lookup (&(table)->root, (string), (create), (copy)))
/* Information we keep for each section in the output file when doing
- a relocateable link. */
+ a relocatable link. */
struct coff_link_section_info
{
@@ -454,14 +454,14 @@ struct coff_final_link_info
/* Output BFD. */
bfd *output_bfd;
/* Used to indicate failure in traversal routine. */
- boolean failed;
+ bfd_boolean failed;
/* If doing "task linking" set only during the time when we want the
global symbol writer to convert the storage class of defined global
symbols from global to static. */
- boolean global_to_static;
+ bfd_boolean global_to_static;
/* Hash table for long symbol names. */
struct bfd_strtab_hash *strtab;
- /* When doing a relocateable link, an array of information kept for
+ /* When doing a relocatable link, an array of information kept for
each output section, indexed by the target_index field. */
struct coff_link_section_info *section_info;
/* Symbol index of last C_FILE symbol (-1 if none). */
@@ -532,7 +532,7 @@ 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 *));
-extern boolean _bfd_coff_link_hash_table_init
+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 *,
@@ -541,26 +541,26 @@ extern struct bfd_link_hash_table *_bfd_coff_link_hash_table_create
PARAMS ((bfd *));
extern const char *_bfd_coff_internal_syment_name
PARAMS ((bfd *, const struct internal_syment *, char *));
-extern boolean _bfd_coff_link_add_symbols
+extern bfd_boolean _bfd_coff_link_add_symbols
PARAMS ((bfd *, struct bfd_link_info *));
-extern boolean _bfd_coff_final_link
+extern bfd_boolean _bfd_coff_final_link
PARAMS ((bfd *, struct bfd_link_info *));
extern struct internal_reloc *_bfd_coff_read_internal_relocs
- PARAMS ((bfd *, asection *, boolean, bfd_byte *, boolean,
+ PARAMS ((bfd *, asection *, bfd_boolean, bfd_byte *, bfd_boolean,
struct internal_reloc *));
-extern boolean _bfd_coff_generic_relocate_section
+extern bfd_boolean _bfd_coff_generic_relocate_section
PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *,
struct internal_reloc *, struct internal_syment *, asection **));
extern struct bfd_hash_entry *_bfd_coff_debug_merge_hash_newfunc
PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, const char *));
-extern boolean _bfd_coff_write_global_sym
+extern bfd_boolean _bfd_coff_write_global_sym
PARAMS ((struct coff_link_hash_entry *, PTR));
-extern boolean _bfd_coff_write_task_globals
+extern bfd_boolean _bfd_coff_write_task_globals
PARAMS ((struct coff_link_hash_entry *, PTR));
-extern boolean _bfd_coff_link_input_bfd
+extern bfd_boolean _bfd_coff_link_input_bfd
PARAMS ((struct coff_final_link_info *, bfd *));
-extern boolean _bfd_coff_reloc_link_order
+extern bfd_boolean _bfd_coff_reloc_link_order
PARAMS ((bfd *, struct coff_final_link_info *, asection *,
struct bfd_link_order *));
@@ -582,19 +582,19 @@ extern struct bfd_link_hash_table *_bfd_xcoff_bfd_link_hash_table_create
PARAMS ((bfd *));
extern void _bfd_xcoff_bfd_link_hash_table_free
PARAMS ((struct bfd_link_hash_table *));
-extern boolean _bfd_xcoff_bfd_link_add_symbols
+extern bfd_boolean _bfd_xcoff_bfd_link_add_symbols
PARAMS ((bfd *, struct bfd_link_info *));
-extern boolean _bfd_xcoff_bfd_final_link
+extern bfd_boolean _bfd_xcoff_bfd_final_link
PARAMS ((bfd *, struct bfd_link_info *));
-extern boolean _bfd_ppc_xcoff_relocate_section
+extern bfd_boolean _bfd_ppc_xcoff_relocate_section
PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *,
struct internal_reloc *, struct internal_syment *, asection **));
/* Functions in coff-ppc.c. FIXME: These are called be pe.em in the
linker, and so should start with bfd and be declared in bfd.h. */
-extern boolean ppc_allocate_toc_section
+extern bfd_boolean ppc_allocate_toc_section
PARAMS ((struct bfd_link_info *));
-extern boolean ppc_process_before_allocation
+extern bfd_boolean ppc_process_before_allocation
PARAMS ((bfd *, struct bfd_link_info *));
diff --git a/contrib/binutils/bfd/libcoff.h b/contrib/binutils/bfd/libcoff.h
index ea9c570..5771132 100644
--- a/contrib/binutils/bfd/libcoff.h
+++ b/contrib/binutils/bfd/libcoff.h
@@ -4,7 +4,7 @@
/* BFD COFF object file private structure.
Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
- 2000, 2001, 2002
+ 2000, 2001, 2002, 2003
Free Software Foundation, Inc.
Written by Cygnus Support.
@@ -78,16 +78,16 @@ typedef struct coff_tdata
/* The unswapped external symbols. May be NULL. Read by
_bfd_coff_get_external_symbols. */
PTR external_syms;
- /* If this is true, the external_syms may not be freed. */
- boolean keep_syms;
+ /* If this is TRUE, the external_syms may not be freed. */
+ bfd_boolean keep_syms;
/* The string table. May be NULL. Read by
_bfd_coff_read_string_table. */
char *strings;
- /* If this is true, the strings may not be freed. */
- boolean keep_strings;
- /* If this is true, the strings have been written out already. */
- boolean strings_written;
+ /* If this is TRUE, the strings may not be freed. */
+ bfd_boolean keep_strings;
+ /* If this is TRUE, the strings have been written out already. */
+ bfd_boolean strings_written;
/* is this a PE format coff file */
int pe;
@@ -121,10 +121,10 @@ typedef struct pe_tdata
struct internal_extra_pe_aouthdr pe_opthdr;
int dll;
int has_reloc_section;
- boolean (*in_reloc_p) PARAMS((bfd *, reloc_howto_type *));
+ bfd_boolean (*in_reloc_p) PARAMS((bfd *, reloc_howto_type *));
flagword real_flags;
int target_subsystem;
- boolean force_minimum_alignment;
+ bfd_boolean force_minimum_alignment;
} pe_data_type;
#define pe_data(bfd) ((bfd)->tdata.pe_obj_data)
@@ -136,11 +136,11 @@ struct xcoff_tdata
/* Basic COFF information. */
coff_data_type coff;
- /* True if this is an XCOFF64 file. */
- boolean xcoff64;
+ /* TRUE if this is an XCOFF64 file. */
+ bfd_boolean xcoff64;
- /* True if a large a.out header should be generated. */
- boolean full_aouthdr;
+ /* TRUE if a large a.out header should be generated. */
+ bfd_boolean full_aouthdr;
/* TOC value. */
bfd_vma toc;
@@ -188,12 +188,12 @@ struct coff_section_tdata
{
/* The relocs, swapped into COFF internal form. This may be NULL. */
struct internal_reloc *relocs;
- /* If this is true, the relocs entry may not be freed. */
- boolean keep_relocs;
+ /* If this is TRUE, the relocs entry may not be freed. */
+ bfd_boolean keep_relocs;
/* The section contents. This may be NULL. */
bfd_byte *contents;
- /* If this is true, the contents entry may not be freed. */
- boolean keep_contents;
+ /* If this is TRUE, the contents entry may not be freed. */
+ bfd_boolean keep_contents;
/* Information cached by coff_find_nearest_line. */
bfd_vma offset;
unsigned int i;
@@ -295,7 +295,7 @@ struct coff_link_hash_table
#define coff_link_hash_traverse(table, func, info) \
(bfd_link_hash_traverse \
(&(table)->root, \
- (boolean (*) PARAMS ((struct bfd_link_hash_entry *, PTR))) (func), \
+ (bfd_boolean (*) PARAMS ((struct bfd_link_hash_entry *, PTR))) (func), \
(info)))
/* Get the COFF linker hash table from a link_info structure. */
@@ -305,33 +305,33 @@ struct coff_link_hash_table
/* Functions in coffgen.c. */
extern const bfd_target *coff_object_p
PARAMS ((bfd *));
-extern struct sec *coff_section_from_bfd_index
+extern struct bfd_section *coff_section_from_bfd_index
PARAMS ((bfd *, int));
extern long coff_get_symtab_upper_bound
PARAMS ((bfd *));
-extern long coff_get_symtab
+extern long coff_canonicalize_symtab
PARAMS ((bfd *, asymbol **));
extern int coff_count_linenumbers
PARAMS ((bfd *));
extern struct coff_symbol_struct *coff_symbol_from
PARAMS ((bfd *, asymbol *));
-extern boolean coff_renumber_symbols
+extern bfd_boolean coff_renumber_symbols
PARAMS ((bfd *, int *));
extern void coff_mangle_symbols
PARAMS ((bfd *));
-extern boolean coff_write_symbols
+extern bfd_boolean coff_write_symbols
PARAMS ((bfd *));
-extern boolean coff_write_linenumbers
+extern bfd_boolean coff_write_linenumbers
PARAMS ((bfd *));
extern alent *coff_get_lineno
PARAMS ((bfd *, asymbol *));
extern asymbol *coff_section_symbol
PARAMS ((bfd *, char *));
-extern boolean _bfd_coff_get_external_symbols
+extern bfd_boolean _bfd_coff_get_external_symbols
PARAMS ((bfd *));
extern const char *_bfd_coff_read_string_table
PARAMS ((bfd *));
-extern boolean _bfd_coff_free_symbols
+extern bfd_boolean _bfd_coff_free_symbols
PARAMS ((bfd *));
extern struct coff_ptr_struct *coff_get_normalized_symtab
PARAMS ((bfd *));
@@ -343,20 +343,20 @@ extern void coff_print_symbol
PARAMS ((bfd *, PTR filep, asymbol *, bfd_print_symbol_type));
extern void coff_get_symbol_info
PARAMS ((bfd *, asymbol *, symbol_info *ret));
-extern boolean _bfd_coff_is_local_label_name
+extern bfd_boolean _bfd_coff_is_local_label_name
PARAMS ((bfd *, const char *));
extern asymbol *coff_bfd_make_debug_symbol
PARAMS ((bfd *, PTR, unsigned long));
-extern boolean coff_find_nearest_line
+extern bfd_boolean coff_find_nearest_line
PARAMS ((bfd *, asection *, asymbol **, bfd_vma, const char **,
const char **, unsigned int *));
extern int coff_sizeof_headers
- PARAMS ((bfd *, boolean));
-extern boolean bfd_coff_reloc16_relax_section
- PARAMS ((bfd *, asection *, struct bfd_link_info *, boolean *));
+ PARAMS ((bfd *, bfd_boolean));
+extern bfd_boolean bfd_coff_reloc16_relax_section
+ PARAMS ((bfd *, asection *, struct bfd_link_info *, bfd_boolean *));
extern bfd_byte *bfd_coff_reloc16_get_relocated_section_contents
PARAMS ((bfd *, struct bfd_link_info *, struct bfd_link_order *,
- bfd_byte *, boolean, asymbol **));
+ bfd_byte *, bfd_boolean, asymbol **));
extern bfd_vma bfd_coff_reloc16_get_value
PARAMS ((arelent *, struct bfd_link_info *, asection *));
extern void bfd_perform_slip
@@ -438,7 +438,7 @@ struct coff_debug_merge_hash_table
bfd_hash_lookup (&(table)->root, (string), (create), (copy)))
/* Information we keep for each section in the output file when doing
- a relocateable link. */
+ a relocatable link. */
struct coff_link_section_info
{
@@ -458,14 +458,14 @@ struct coff_final_link_info
/* Output BFD. */
bfd *output_bfd;
/* Used to indicate failure in traversal routine. */
- boolean failed;
+ bfd_boolean failed;
/* If doing "task linking" set only during the time when we want the
global symbol writer to convert the storage class of defined global
symbols from global to static. */
- boolean global_to_static;
+ bfd_boolean global_to_static;
/* Hash table for long symbol names. */
struct bfd_strtab_hash *strtab;
- /* When doing a relocateable link, an array of information kept for
+ /* When doing a relocatable link, an array of information kept for
each output section, indexed by the target_index field. */
struct coff_link_section_info *section_info;
/* Symbol index of last C_FILE symbol (-1 if none). */
@@ -536,7 +536,7 @@ 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 *));
-extern boolean _bfd_coff_link_hash_table_init
+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 *,
@@ -545,26 +545,26 @@ extern struct bfd_link_hash_table *_bfd_coff_link_hash_table_create
PARAMS ((bfd *));
extern const char *_bfd_coff_internal_syment_name
PARAMS ((bfd *, const struct internal_syment *, char *));
-extern boolean _bfd_coff_link_add_symbols
+extern bfd_boolean _bfd_coff_link_add_symbols
PARAMS ((bfd *, struct bfd_link_info *));
-extern boolean _bfd_coff_final_link
+extern bfd_boolean _bfd_coff_final_link
PARAMS ((bfd *, struct bfd_link_info *));
extern struct internal_reloc *_bfd_coff_read_internal_relocs
- PARAMS ((bfd *, asection *, boolean, bfd_byte *, boolean,
+ PARAMS ((bfd *, asection *, bfd_boolean, bfd_byte *, bfd_boolean,
struct internal_reloc *));
-extern boolean _bfd_coff_generic_relocate_section
+extern bfd_boolean _bfd_coff_generic_relocate_section
PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *,
struct internal_reloc *, struct internal_syment *, asection **));
extern struct bfd_hash_entry *_bfd_coff_debug_merge_hash_newfunc
PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, const char *));
-extern boolean _bfd_coff_write_global_sym
+extern bfd_boolean _bfd_coff_write_global_sym
PARAMS ((struct coff_link_hash_entry *, PTR));
-extern boolean _bfd_coff_write_task_globals
+extern bfd_boolean _bfd_coff_write_task_globals
PARAMS ((struct coff_link_hash_entry *, PTR));
-extern boolean _bfd_coff_link_input_bfd
+extern bfd_boolean _bfd_coff_link_input_bfd
PARAMS ((struct coff_final_link_info *, bfd *));
-extern boolean _bfd_coff_reloc_link_order
+extern bfd_boolean _bfd_coff_reloc_link_order
PARAMS ((bfd *, struct coff_final_link_info *, asection *,
struct bfd_link_order *));
@@ -586,20 +586,20 @@ extern struct bfd_link_hash_table *_bfd_xcoff_bfd_link_hash_table_create
PARAMS ((bfd *));
extern void _bfd_xcoff_bfd_link_hash_table_free
PARAMS ((struct bfd_link_hash_table *));
-extern boolean _bfd_xcoff_bfd_link_add_symbols
+extern bfd_boolean _bfd_xcoff_bfd_link_add_symbols
PARAMS ((bfd *, struct bfd_link_info *));
-extern boolean _bfd_xcoff_bfd_final_link
+extern bfd_boolean _bfd_xcoff_bfd_final_link
PARAMS ((bfd *, struct bfd_link_info *));
-extern boolean _bfd_ppc_xcoff_relocate_section
+extern bfd_boolean _bfd_ppc_xcoff_relocate_section
PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *,
struct internal_reloc *, struct internal_syment *, asection **));
/* Functions in coff-ppc.c. FIXME: These are called be pe.em in the
linker, and so should start with bfd and be declared in bfd.h. */
-extern boolean ppc_allocate_toc_section
+extern bfd_boolean ppc_allocate_toc_section
PARAMS ((struct bfd_link_info *));
-extern boolean ppc_process_before_allocation
+extern bfd_boolean ppc_process_before_allocation
PARAMS ((bfd *, struct bfd_link_info *));
/* Extracted from coffcode.h. */
@@ -653,7 +653,7 @@ typedef struct coff_symbol_struct
struct lineno_cache_entry *lineno;
/* Have the line numbers been relocated yet ? */
- boolean done_lineno;
+ bfd_boolean done_lineno;
} coff_symbol_type;
/* COFF symbol classifications. */
@@ -711,10 +711,10 @@ typedef struct
unsigned int _bfd_relsz;
unsigned int _bfd_linesz;
unsigned int _bfd_filnmlen;
- boolean _bfd_coff_long_filenames;
- boolean _bfd_coff_long_section_names;
+ bfd_boolean _bfd_coff_long_filenames;
+ bfd_boolean _bfd_coff_long_section_names;
unsigned int _bfd_coff_default_section_alignment_power;
- boolean _bfd_coff_force_symnames_in_strings;
+ bfd_boolean _bfd_coff_force_symnames_in_strings;
unsigned int _bfd_coff_debug_string_prefix_length;
void (*_bfd_coff_swap_filehdr_in)
@@ -729,32 +729,32 @@ typedef struct
void (*_bfd_coff_swap_reloc_in)
PARAMS ((bfd *abfd, PTR, PTR));
- boolean (*_bfd_coff_bad_format_hook)
+ bfd_boolean (*_bfd_coff_bad_format_hook)
PARAMS ((bfd *, PTR));
- boolean (*_bfd_coff_set_arch_mach_hook)
+ bfd_boolean (*_bfd_coff_set_arch_mach_hook)
PARAMS ((bfd *, PTR));
PTR (*_bfd_coff_mkobject_hook)
PARAMS ((bfd *, PTR, PTR));
- boolean (*_bfd_styp_to_sec_flags_hook)
+ bfd_boolean (*_bfd_styp_to_sec_flags_hook)
PARAMS ((bfd *, PTR, const char *, asection *, flagword *));
void (*_bfd_set_alignment_hook)
PARAMS ((bfd *, asection *, PTR));
- boolean (*_bfd_coff_slurp_symbol_table)
+ bfd_boolean (*_bfd_coff_slurp_symbol_table)
PARAMS ((bfd *));
- boolean (*_bfd_coff_symname_in_debug)
+ bfd_boolean (*_bfd_coff_symname_in_debug)
PARAMS ((bfd *, struct internal_syment *));
- boolean (*_bfd_coff_pointerize_aux_hook)
+ bfd_boolean (*_bfd_coff_pointerize_aux_hook)
PARAMS ((bfd *, combined_entry_type *, combined_entry_type *,
unsigned int, combined_entry_type *));
- boolean (*_bfd_coff_print_aux)
+ bfd_boolean (*_bfd_coff_print_aux)
PARAMS ((bfd *, FILE *, combined_entry_type *, combined_entry_type *,
combined_entry_type *, unsigned int));
@@ -769,13 +769,13 @@ typedef struct
enum coff_symbol_classification (*_bfd_coff_classify_symbol)
PARAMS ((bfd *, struct internal_syment *));
- boolean (*_bfd_coff_compute_section_file_positions)
+ bfd_boolean (*_bfd_coff_compute_section_file_positions)
PARAMS ((bfd *));
- boolean (*_bfd_coff_start_final_link)
+ bfd_boolean (*_bfd_coff_start_final_link)
PARAMS ((bfd *, struct bfd_link_info *));
- boolean (*_bfd_coff_relocate_section)
+ bfd_boolean (*_bfd_coff_relocate_section)
PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *,
struct internal_reloc *, struct internal_syment *, asection **));
@@ -784,19 +784,19 @@ typedef struct
struct coff_link_hash_entry *, struct internal_syment *,
bfd_vma *));
- boolean (*_bfd_coff_adjust_symndx)
+ bfd_boolean (*_bfd_coff_adjust_symndx)
PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *,
- struct internal_reloc *, boolean *));
+ struct internal_reloc *, bfd_boolean *));
- boolean (*_bfd_coff_link_add_one_symbol)
+ bfd_boolean (*_bfd_coff_link_add_one_symbol)
PARAMS ((struct bfd_link_info *, bfd *, const char *, flagword,
- asection *, bfd_vma, const char *, boolean, boolean,
+ asection *, bfd_vma, const char *, bfd_boolean, bfd_boolean,
struct bfd_link_hash_entry **));
- boolean (*_bfd_coff_link_output_has_begun)
+ bfd_boolean (*_bfd_coff_link_output_has_begun)
PARAMS ((bfd *, struct coff_final_link_info *));
- boolean (*_bfd_coff_final_link_postscript)
+ bfd_boolean (*_bfd_coff_final_link_postscript)
PARAMS ((bfd *, struct coff_final_link_info *));
} bfd_coff_backend_data;
@@ -866,7 +866,8 @@ typedef struct
#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))
+ ((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)\
@@ -891,7 +892,8 @@ typedef struct
((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)\
+#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))
@@ -919,7 +921,8 @@ typedef struct
#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)\
+#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))
diff --git a/contrib/binutils/bfd/libecoff.h b/contrib/binutils/bfd/libecoff.h
index eb90a8c..161f06c 100644
--- a/contrib/binutils/bfd/libecoff.h
+++ b/contrib/binutils/bfd/libecoff.h
@@ -1,5 +1,5 @@
/* BFD ECOFF object file private structure.
- Copyright 1993, 1994, 1995, 1996, 1999, 2001, 2002
+ Copyright 1993, 1994, 1995, 1996, 1999, 2001, 2002, 2003
Free Software Foundation, Inc.
Written by Ian Lance Taylor, Cygnus Support.
@@ -44,10 +44,10 @@ struct ecoff_backend_data
/* The page boundary used to align sections in a demand-paged
executable file. E.g., 0x1000. */
bfd_vma round;
- /* True if the .rdata section is part of the text segment, as on the
- Alpha. False if .rdata is part of the data segment, as on the
+ /* TRUE if the .rdata section is part of the text segment, as on the
+ Alpha. FALSE if .rdata is part of the data segment, as on the
MIPS. */
- boolean rdata_in_text;
+ bfd_boolean rdata_in_text;
/* Bitsize of constructor entries. */
unsigned int constructor_bitsize;
/* Reloc to use for constructor entries. */
@@ -60,18 +60,18 @@ struct ecoff_backend_data
void (*swap_reloc_in) PARAMS ((bfd *, PTR, struct internal_reloc *));
void (*swap_reloc_out) PARAMS ((bfd *, const struct internal_reloc *, PTR));
/* Backend reloc tweaking. */
- void (*adjust_reloc_in) PARAMS ((bfd *, const struct internal_reloc *,
- arelent *));
- void (*adjust_reloc_out) PARAMS ((bfd *, const arelent *,
- struct internal_reloc *));
+ void (*adjust_reloc_in)
+ PARAMS ((bfd *, const struct internal_reloc *, arelent *));
+ void (*adjust_reloc_out)
+ PARAMS ((bfd *, const arelent *, struct internal_reloc *));
/* Relocate section contents while linking. */
- boolean (*relocate_section) PARAMS ((bfd *output_bfd, struct bfd_link_info *,
- bfd *input_bfd, asection *input_section,
- bfd_byte *contents,
- PTR external_relocs));
+ bfd_boolean (*relocate_section)
+ PARAMS ((bfd *output_bfd, struct bfd_link_info *, bfd *input_bfd,
+ asection *input_section, bfd_byte *contents,
+ PTR external_relocs));
/* Do final adjustments to filehdr and aouthdr. */
- boolean (*adjust_headers) PARAMS ((bfd *, struct internal_filehdr *,
- struct internal_aouthdr *));
+ bfd_boolean (*adjust_headers)
+ PARAMS ((bfd *, struct internal_filehdr *, struct internal_aouthdr *));
/* Read an element from an archive at a given file position. This
is needed because OSF/1 3.2 uses a weird archive format. */
bfd *(*get_elt_at_filepos) PARAMS ((bfd *, file_ptr));
@@ -128,12 +128,12 @@ typedef struct ecoff_tdata
linking. */
asection **symndx_to_section;
- /* True if this BFD was written by the backend linker. */
- boolean linker;
+ /* TRUE if this BFD was written by the backend linker. */
+ bfd_boolean linker;
- /* True if a warning that multiple global pointer values are
+ /* TRUE if a warning that multiple global pointer values are
needed in the output binary was issued already. */
- boolean issued_multiple_gp_warning;
+ bfd_boolean issued_multiple_gp_warning;
/* Used by find_nearest_line entry point. The structure could be
included directly in this one, but there's no point to wasting
@@ -143,7 +143,7 @@ typedef struct ecoff_tdata
/* Whether the .rdata section is in the text segment for this
particular ECOFF file. This is not valid until
ecoff_compute_section_file_positions is called. */
- boolean rdata_in_text;
+ bfd_boolean rdata_in_text;
} ecoff_data_type;
@@ -157,8 +157,8 @@ typedef struct ecoff_symbol_struct
/* The fdr for this symbol. */
FDR *fdr;
- /* true if this is a local symbol rather than an external one. */
- boolean local;
+ /* TRUE if this is a local symbol rather than an external one. */
+ bfd_boolean local;
/* A pointer to the unswapped hidden information for this symbol.
This is either a struct sym_ext or a struct ext_ext, depending on
@@ -249,27 +249,28 @@ struct ecoff_link_hash_table
};
/* Make an ECOFF object. */
-extern boolean _bfd_ecoff_mkobject PARAMS ((bfd *));
+extern bfd_boolean _bfd_ecoff_mkobject PARAMS ((bfd *));
/* Read in the ECOFF symbolic debugging information. */
-extern boolean _bfd_ecoff_slurp_symbolic_info
+extern bfd_boolean _bfd_ecoff_slurp_symbolic_info
PARAMS ((bfd *, asection *, struct ecoff_debug_info *));
/* Generic ECOFF BFD backend vectors. */
-extern boolean _bfd_ecoff_write_object_contents PARAMS ((bfd *abfd));
+extern bfd_boolean _bfd_ecoff_write_object_contents PARAMS ((bfd *abfd));
extern const bfd_target *_bfd_ecoff_archive_p PARAMS ((bfd *abfd));
#define _bfd_ecoff_close_and_cleanup _bfd_generic_close_and_cleanup
#define _bfd_ecoff_bfd_free_cached_info _bfd_generic_bfd_free_cached_info
-extern boolean _bfd_ecoff_new_section_hook
+extern bfd_boolean _bfd_ecoff_new_section_hook
PARAMS ((bfd *, asection *));
-extern boolean _bfd_ecoff_get_section_contents
+extern bfd_boolean _bfd_ecoff_get_section_contents
PARAMS ((bfd *, asection *, PTR location, file_ptr, bfd_size_type));
#define _bfd_ecoff_bfd_link_split_section _bfd_generic_link_split_section
-extern boolean _bfd_ecoff_bfd_copy_private_bfd_data PARAMS ((bfd *, bfd *));
+extern bfd_boolean _bfd_ecoff_bfd_copy_private_bfd_data
+ PARAMS ((bfd *, bfd *));
#define _bfd_ecoff_bfd_copy_private_section_data \
_bfd_generic_bfd_copy_private_section_data
@@ -283,12 +284,12 @@ extern boolean _bfd_ecoff_bfd_copy_private_bfd_data PARAMS ((bfd *, bfd *));
_bfd_generic_bfd_merge_private_bfd_data
#define _bfd_ecoff_bfd_set_private_flags _bfd_generic_bfd_set_private_flags
-extern boolean _bfd_ecoff_slurp_armap PARAMS ((bfd *abfd));
+extern bfd_boolean _bfd_ecoff_slurp_armap PARAMS ((bfd *abfd));
#define _bfd_ecoff_slurp_extended_name_table _bfd_slurp_extended_name_table
#define _bfd_ecoff_construct_extended_name_table \
_bfd_archive_bsd_construct_extended_name_table
#define _bfd_ecoff_truncate_arname bfd_dont_truncate_arname
-extern boolean _bfd_ecoff_write_armap
+extern bfd_boolean _bfd_ecoff_write_armap
PARAMS ((bfd *, unsigned int, struct orl *, unsigned int, int));
#define _bfd_ecoff_read_ar_hdr _bfd_generic_read_ar_hdr
#define _bfd_ecoff_openr_next_archived_file \
@@ -298,16 +299,16 @@ extern boolean _bfd_ecoff_write_armap
#define _bfd_ecoff_update_armap_timestamp bfd_true
extern long _bfd_ecoff_get_symtab_upper_bound PARAMS ((bfd *abfd));
-extern long _bfd_ecoff_get_symtab PARAMS ((bfd *abfd, asymbol **alocation));
+extern long _bfd_ecoff_canonicalize_symtab PARAMS ((bfd *abfd, asymbol **alocation));
extern asymbol *_bfd_ecoff_make_empty_symbol PARAMS ((bfd *abfd));
extern void _bfd_ecoff_print_symbol
PARAMS ((bfd *, PTR filep, asymbol *, bfd_print_symbol_type));
extern void _bfd_ecoff_get_symbol_info
PARAMS ((bfd *, asymbol *, symbol_info *));
-extern boolean _bfd_ecoff_bfd_is_local_label_name
+extern bfd_boolean _bfd_ecoff_bfd_is_local_label_name
PARAMS ((bfd *, const char *));
#define _bfd_ecoff_get_lineno _bfd_nosymbols_get_lineno
-extern boolean _bfd_ecoff_find_nearest_line
+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));
@@ -320,21 +321,21 @@ extern long _bfd_ecoff_canonicalize_reloc
PARAMS ((bfd *, asection *, arelent **, asymbol **symbols));
/* ecoff_bfd_reloc_type_lookup defined by backend. */
-extern boolean _bfd_ecoff_set_arch_mach
+extern bfd_boolean _bfd_ecoff_set_arch_mach
PARAMS ((bfd *, enum bfd_architecture, unsigned long));
-extern boolean _bfd_ecoff_set_section_contents
- PARAMS ((bfd *, asection *, PTR location, file_ptr, bfd_size_type));
+extern bfd_boolean _bfd_ecoff_set_section_contents
+ PARAMS ((bfd *, asection *, const PTR location, file_ptr, bfd_size_type));
-extern int _bfd_ecoff_sizeof_headers PARAMS ((bfd *abfd, boolean reloc));
+extern int _bfd_ecoff_sizeof_headers PARAMS ((bfd *abfd, bfd_boolean reloc));
/* ecoff_bfd_get_relocated_section_contents defined by backend. */
/* ecoff_bfd_relax_section defined by backend. */
extern struct bfd_link_hash_table *_bfd_ecoff_bfd_link_hash_table_create
PARAMS ((bfd *));
#define _bfd_ecoff_bfd_link_hash_table_free _bfd_generic_link_hash_table_free
-extern boolean _bfd_ecoff_bfd_link_add_symbols
+extern bfd_boolean _bfd_ecoff_bfd_link_add_symbols
PARAMS ((bfd *, struct bfd_link_info *));
#define _bfd_ecoff_bfd_link_just_syms _bfd_generic_link_just_syms
-extern boolean _bfd_ecoff_bfd_final_link
+extern bfd_boolean _bfd_ecoff_bfd_final_link
PARAMS ((bfd *, struct bfd_link_info *));
/* Hook functions for the generic COFF section reading code. */
@@ -342,10 +343,11 @@ extern boolean _bfd_ecoff_bfd_final_link
extern PTR _bfd_ecoff_mkobject_hook PARAMS ((bfd *, PTR filehdr, PTR aouthdr));
#define _bfd_ecoff_set_alignment_hook \
((void (*) PARAMS ((bfd *, asection *, PTR))) bfd_void)
-extern boolean _bfd_ecoff_set_arch_mach_hook PARAMS ((bfd *abfd, PTR filehdr));
-extern boolean _bfd_ecoff_styp_to_sec_flags
+extern bfd_boolean _bfd_ecoff_set_arch_mach_hook
+ PARAMS ((bfd *abfd, PTR filehdr));
+extern bfd_boolean _bfd_ecoff_styp_to_sec_flags
PARAMS ((bfd *, PTR, const char *, asection *, flagword *));
-extern boolean _bfd_ecoff_slurp_symbol_table PARAMS ((bfd *abfd));
+extern bfd_boolean _bfd_ecoff_slurp_symbol_table PARAMS ((bfd *abfd));
/* ECOFF auxiliary information swapping routines. These are the same
for all ECOFF targets, so they are defined in ecofflink.c. */
diff --git a/contrib/binutils/bfd/libieee.h b/contrib/binutils/bfd/libieee.h
index c48566c..56c7ce1 100644
--- a/contrib/binutils/bfd/libieee.h
+++ b/contrib/binutils/bfd/libieee.h
@@ -1,5 +1,5 @@
/* IEEE-695 object file formats: definitions internal to BFD.
- Copyright 1990, 1991, 1992, 1994, 1996, 2001
+ Copyright 1990, 1991, 1992, 1994, 1996, 2001, 2002
Free Software Foundation, Inc.
Written by Cygnus Support. Mostly Steve Chamberlain's fault.
@@ -56,7 +56,7 @@ typedef struct ieee_per_section
/* For output */
file_ptr current_pos;
unsigned int current_byte;
- boolean initialized;
+ bfd_boolean initialized;
ieee_reloc_type **reloc_tail_ptr;
} ieee_per_section_type;
@@ -72,8 +72,8 @@ typedef struct {
typedef struct ieee_data_struct
{
common_header_type h;
- boolean read_symbols;
- boolean read_data;
+ bfd_boolean read_symbols;
+ bfd_boolean read_data;
file_ptr output_cursor;
/* Map of section indexes to section ptrs */
asection **section_table;
@@ -103,10 +103,10 @@ typedef struct ieee_data_struct
int external_reference_base_offset;
- boolean symbol_table_full;
+ bfd_boolean symbol_table_full;
-boolean done_debug;
+bfd_boolean done_debug;
bfd_chain_type *chain_head;
diff --git a/contrib/binutils/bfd/libpei.h b/contrib/binutils/bfd/libpei.h
index 6b232b4..9ed9c12 100644
--- a/contrib/binutils/bfd/libpei.h
+++ b/contrib/binutils/bfd/libpei.h
@@ -1,31 +1,29 @@
/* Support for the generic parts of PE/PEI; common header information.
- Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001
+ Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
Free Software Foundation, Inc.
Written by Cygnus Solutions.
-This file is part of BFD, the Binary File Descriptor library.
+ This 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-
-/*
-Most of this hacked by Steve Chamberlain,
+/* Most of this hacked by Steve Chamberlain,
sac@cygnus.com
-PE/PEI rearrangement (and code added): Donn Terry
- Softway Systems, Inc.
-*/
+ PE/PEI rearrangement (and code added): Donn Terry
+ Softway Systems, Inc. */
/* Hey look, some documentation [and in a place you expect to find it]!
@@ -53,8 +51,7 @@ PE/PEI rearrangement (and code added): Donn Terry
FIXME: Please add more docs here so the next poor fool that has to hack
on this code has a chance of getting something accomplished without
- wasting too much time.
-*/
+ wasting too much time. */
#ifndef GET_FCN_LNNOPTR
#define GET_FCN_LNNOPTR(abfd, ext) \
@@ -313,13 +310,13 @@ unsigned int _bfd_XXi_swap_aouthdr_out PARAMS ((bfd *, PTR, PTR));
unsigned int _bfd_XXi_swap_scnhdr_out PARAMS ((bfd *, PTR, PTR));
#define coff_swap_scnhdr_out _bfd_XXi_swap_scnhdr_out
-boolean _bfd_XX_print_private_bfd_data_common PARAMS ((bfd *, PTR));
+bfd_boolean _bfd_XX_print_private_bfd_data_common PARAMS ((bfd *, PTR));
-boolean _bfd_XX_bfd_copy_private_bfd_data_common PARAMS ((bfd *, bfd *));
+bfd_boolean _bfd_XX_bfd_copy_private_bfd_data_common PARAMS ((bfd *, bfd *));
void _bfd_XX_get_symbol_info PARAMS ((bfd *, asymbol *, symbol_info *));
-boolean _bfd_XXi_final_link_postscript
+bfd_boolean _bfd_XXi_final_link_postscript
PARAMS ((bfd *, struct coff_final_link_info *));
#ifndef coff_final_link_postscript
@@ -331,5 +328,10 @@ boolean _bfd_XXi_final_link_postscript
unsigned int _bfd_XX_only_swap_filehdr_out PARAMS ((bfd*, PTR, PTR));
unsigned int _bfd_XXi_only_swap_filehdr_out PARAMS ((bfd*, PTR, PTR));
-boolean _bfd_XX_bfd_copy_private_section_data
+bfd_boolean _bfd_XX_bfd_copy_private_section_data
PARAMS ((bfd *, asection *, bfd *, asection *));
+
+/* Macro: Returns true if the bfd is a PE executable as opposed to a PE object file. */
+#define bfd_pe_executable_p(abfd) \
+ (strncmp ((abfd)->xvec->name, "pei-", 4) == 0 \
+ || strncmp ((abfd)->xvec->name, "efi-app-", 8) == 0)
diff --git a/contrib/binutils/bfd/linker.c b/contrib/binutils/bfd/linker.c
index a5ded1f..58befc3 100644
--- a/contrib/binutils/bfd/linker.c
+++ b/contrib/binutils/bfd/linker.c
@@ -1,23 +1,23 @@
/* linker.c -- BFD linker routines
- Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
- Free Software Foundation, Inc.
+ Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+ 2003, 2004 Free Software Foundation, Inc.
Written by Steve Chamberlain and Ian Lance Taylor, Cygnus Support
-This file is part of BFD, the Binary File Descriptor library.
+ This 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "bfd.h"
#include "sysdep.h"
@@ -88,7 +88,7 @@ SUBSECTION
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 relocateable
+ (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
@@ -200,7 +200,7 @@ SUBSUBSECTION
read the symbol information, the <<_bfd_link_add_symbols>>
routine should save it somewhere attached to the object file
BFD. However, the information should only be saved if the
- <<keep_memory>> field of the <<info>> argument is true, so
+ <<keep_memory>> field of the <<info>> argument is TRUE, so
that the <<-no-keep-memory>> linker switch is effective.
The a.out function which adds symbols from an object file is
@@ -277,7 +277,7 @@ SUBSECTION
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 relocateable output, it must
+ 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.
@@ -317,7 +317,7 @@ SUBSUBSECTION
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 relocateable object file.
+ while generating a relocatable object file.
INODE
Relocating the section contents, Writing the symbol table, Information provided by the linker, Performing the Final Link
@@ -339,7 +339,7 @@ SUBSUBSECTION
input files. The <<_bfd_final_link>> function should read the
contents of the section and any associated relocs, apply the
relocs to the section contents, and write out the modified
- section contents. If performing a relocateable link, the
+ section contents. If performing a relocatable link, the
relocs themselves must also be modified and written out.
@findex _bfd_relocate_contents
@@ -406,32 +406,26 @@ SUBSUBSECTION
file at the end of <<NAME(aout,final_link)>>.
*/
-static boolean generic_link_read_symbols
- PARAMS ((bfd *));
-static boolean generic_link_add_symbols
- PARAMS ((bfd *, struct bfd_link_info *, boolean collect));
-static boolean generic_link_add_object_symbols
- PARAMS ((bfd *, struct bfd_link_info *, boolean collect));
-static boolean generic_link_check_archive_element_no_collect
- PARAMS ((bfd *, struct bfd_link_info *, boolean *pneeded));
-static boolean generic_link_check_archive_element_collect
- PARAMS ((bfd *, struct bfd_link_info *, boolean *pneeded));
-static boolean generic_link_check_archive_element
- PARAMS ((bfd *, struct bfd_link_info *, boolean *pneeded, boolean collect));
-static boolean generic_link_add_symbol_list
- PARAMS ((bfd *, struct bfd_link_info *, bfd_size_type count, asymbol **,
- boolean collect));
-static bfd *hash_entry_bfd PARAMS ((struct bfd_link_hash_entry *));
-static void set_symbol_from_hash
- PARAMS ((asymbol *, struct bfd_link_hash_entry *));
-static boolean generic_add_output_symbol
- PARAMS ((bfd *, size_t *psymalloc, asymbol *));
-static boolean default_data_link_order
- PARAMS ((bfd *, struct bfd_link_info *, asection *,
- struct bfd_link_order *));
-static boolean default_indirect_link_order
- PARAMS ((bfd *, struct bfd_link_info *, asection *,
- struct bfd_link_order *, boolean));
+static bfd_boolean generic_link_add_object_symbols
+ (bfd *, struct bfd_link_info *, bfd_boolean collect);
+static bfd_boolean generic_link_add_symbols
+ (bfd *, struct bfd_link_info *, bfd_boolean);
+static bfd_boolean generic_link_check_archive_element_no_collect
+ (bfd *, struct bfd_link_info *, bfd_boolean *);
+static bfd_boolean generic_link_check_archive_element_collect
+ (bfd *, struct bfd_link_info *, bfd_boolean *);
+static bfd_boolean generic_link_check_archive_element
+ (bfd *, struct bfd_link_info *, bfd_boolean *, bfd_boolean);
+static bfd_boolean generic_link_add_symbol_list
+ (bfd *, struct bfd_link_info *, bfd_size_type count, asymbol **,
+ bfd_boolean);
+static bfd_boolean generic_add_output_symbol
+ (bfd *, size_t *psymalloc, asymbol *);
+static bfd_boolean default_data_link_order
+ (bfd *, struct bfd_link_info *, asection *, struct bfd_link_order *);
+static bfd_boolean default_indirect_link_order
+ (bfd *, struct bfd_link_info *, asection *, struct bfd_link_order *,
+ bfd_boolean);
/* The link hash table structure is defined in bfdlink.h. It provides
a base hash table which the backend specific hash tables are built
@@ -440,17 +434,15 @@ static boolean default_indirect_link_order
/* Routine to create an entry in the link hash table. */
struct bfd_hash_entry *
-_bfd_link_hash_newfunc (entry, table, string)
- struct bfd_hash_entry *entry;
- struct bfd_hash_table *table;
- const char *string;
+_bfd_link_hash_newfunc (struct bfd_hash_entry *entry,
+ struct bfd_hash_table *table,
+ const char *string)
{
/* Allocate the structure if it has not already been allocated by a
subclass. */
if (entry == NULL)
{
- entry = (struct bfd_hash_entry *)
- bfd_hash_allocate (table, sizeof (struct bfd_link_hash_entry));
+ entry = bfd_hash_allocate (table, sizeof (struct bfd_link_hash_entry));
if (entry == NULL)
return entry;
}
@@ -463,7 +455,7 @@ _bfd_link_hash_newfunc (entry, table, string)
/* Initialize the local fields. */
h->type = bfd_link_hash_new;
- h->next = NULL;
+ h->und_next = NULL;
}
return entry;
@@ -472,13 +464,13 @@ _bfd_link_hash_newfunc (entry, table, string)
/* Initialize a link hash table. The BFD argument is the one
responsible for creating this table. */
-boolean
-_bfd_link_hash_table_init (table, abfd, newfunc)
- struct bfd_link_hash_table *table;
- bfd *abfd;
- struct bfd_hash_entry *(*newfunc) PARAMS ((struct bfd_hash_entry *,
- struct bfd_hash_table *,
- const char *));
+bfd_boolean
+_bfd_link_hash_table_init
+ (struct bfd_link_hash_table *table,
+ bfd *abfd,
+ struct bfd_hash_entry *(*newfunc) (struct bfd_hash_entry *,
+ struct bfd_hash_table *,
+ const char *))
{
table->creator = abfd->xvec;
table->undefs = NULL;
@@ -488,24 +480,23 @@ _bfd_link_hash_table_init (table, abfd, newfunc)
return bfd_hash_table_init (&table->table, newfunc);
}
-/* Look up a symbol in a link hash table. If follow is true, we
+/* Look up a symbol in a link hash table. If follow is TRUE, we
follow bfd_link_hash_indirect and bfd_link_hash_warning links to
the real symbol. */
struct bfd_link_hash_entry *
-bfd_link_hash_lookup (table, string, create, copy, follow)
- struct bfd_link_hash_table *table;
- const char *string;
- boolean create;
- boolean copy;
- boolean follow;
+bfd_link_hash_lookup (struct bfd_link_hash_table *table,
+ const char *string,
+ bfd_boolean create,
+ bfd_boolean copy,
+ bfd_boolean follow)
{
struct bfd_link_hash_entry *ret;
ret = ((struct bfd_link_hash_entry *)
bfd_hash_lookup (&table->table, string, create, copy));
- if (follow && ret != (struct bfd_link_hash_entry *) NULL)
+ if (follow && ret != NULL)
{
while (ret->type == bfd_link_hash_indirect
|| ret->type == bfd_link_hash_warning)
@@ -520,28 +511,31 @@ bfd_link_hash_lookup (table, string, create, copy, follow)
undefined symbol, not for definitions of a symbol. */
struct bfd_link_hash_entry *
-bfd_wrapped_link_hash_lookup (abfd, info, string, create, copy, follow)
- bfd *abfd;
- struct bfd_link_info *info;
- const char *string;
- boolean create;
- boolean copy;
- boolean follow;
+bfd_wrapped_link_hash_lookup (bfd *abfd,
+ struct bfd_link_info *info,
+ const char *string,
+ bfd_boolean create,
+ bfd_boolean copy,
+ bfd_boolean follow)
{
bfd_size_type amt;
if (info->wrap_hash != NULL)
{
const char *l;
+ char prefix = '\0';
l = string;
- if (*l == bfd_get_symbol_leading_char (abfd))
- ++l;
+ if (*l == bfd_get_symbol_leading_char (abfd) || *l == info->wrap_char)
+ {
+ prefix = *l;
+ ++l;
+ }
#undef WRAP
#define WRAP "__wrap_"
- if (bfd_hash_lookup (info->wrap_hash, l, false, false) != NULL)
+ if (bfd_hash_lookup (info->wrap_hash, l, FALSE, FALSE) != NULL)
{
char *n;
struct bfd_link_hash_entry *h;
@@ -550,16 +544,15 @@ bfd_wrapped_link_hash_lookup (abfd, info, string, create, copy, follow)
references to SYM with references to __wrap_SYM. */
amt = strlen (l) + sizeof WRAP + 1;
- n = (char *) bfd_malloc (amt);
+ n = bfd_malloc (amt);
if (n == NULL)
return NULL;
- /* Note that symbol_leading_char may be '\0'. */
- n[0] = bfd_get_symbol_leading_char (abfd);
+ n[0] = prefix;
n[1] = '\0';
strcat (n, WRAP);
strcat (n, l);
- h = bfd_link_hash_lookup (info->hash, n, create, true, follow);
+ h = bfd_link_hash_lookup (info->hash, n, create, TRUE, follow);
free (n);
return h;
}
@@ -572,7 +565,7 @@ bfd_wrapped_link_hash_lookup (abfd, info, string, create, copy, follow)
if (*l == '_'
&& strncmp (l, REAL, sizeof REAL - 1) == 0
&& bfd_hash_lookup (info->wrap_hash, l + sizeof REAL - 1,
- false, false) != NULL)
+ FALSE, FALSE) != NULL)
{
char *n;
struct bfd_link_hash_entry *h;
@@ -582,15 +575,14 @@ bfd_wrapped_link_hash_lookup (abfd, info, string, create, copy, follow)
with references to SYM. */
amt = strlen (l + sizeof REAL - 1) + 2;
- n = (char *) bfd_malloc (amt);
+ n = bfd_malloc (amt);
if (n == NULL)
return NULL;
- /* Note that symbol_leading_char may be '\0'. */
- n[0] = bfd_get_symbol_leading_char (abfd);
+ n[0] = prefix;
n[1] = '\0';
strcat (n, l + sizeof REAL - 1);
- h = bfd_link_hash_lookup (info->hash, n, create, true, follow);
+ h = bfd_link_hash_lookup (info->hash, n, create, TRUE, follow);
free (n);
return h;
}
@@ -608,45 +600,42 @@ bfd_wrapped_link_hash_lookup (abfd, info, string, create, copy, follow)
call. */
void
-bfd_link_hash_traverse (table, func, info)
- struct bfd_link_hash_table *table;
- boolean (*func) PARAMS ((struct bfd_link_hash_entry *, PTR));
- PTR info;
+bfd_link_hash_traverse
+ (struct bfd_link_hash_table *table,
+ bfd_boolean (*func) (struct bfd_link_hash_entry *, void *),
+ void *info)
{
bfd_hash_traverse (&table->table,
- ((boolean (*) PARAMS ((struct bfd_hash_entry *, PTR)))
- func),
+ (bfd_boolean (*) (struct bfd_hash_entry *, void *)) func,
info);
}
/* Add a symbol to the linker hash table undefs list. */
-INLINE void
-bfd_link_add_undef (table, h)
- struct bfd_link_hash_table *table;
- struct bfd_link_hash_entry *h;
+void
+bfd_link_add_undef (struct bfd_link_hash_table *table,
+ struct bfd_link_hash_entry *h)
{
- BFD_ASSERT (h->next == NULL);
- if (table->undefs_tail != (struct bfd_link_hash_entry *) NULL)
- table->undefs_tail->next = h;
- if (table->undefs == (struct bfd_link_hash_entry *) NULL)
+ BFD_ASSERT (h->und_next == NULL);
+ if (table->undefs_tail != NULL)
+ table->undefs_tail->und_next = h;
+ if (table->undefs == NULL)
table->undefs = h;
table->undefs_tail = h;
}
-/* Routine to create an entry in an generic link hash table. */
+/* Routine to create an entry in a generic link hash table. */
struct bfd_hash_entry *
-_bfd_generic_link_hash_newfunc (entry, table, string)
- struct bfd_hash_entry *entry;
- struct bfd_hash_table *table;
- const char *string;
+_bfd_generic_link_hash_newfunc (struct bfd_hash_entry *entry,
+ struct bfd_hash_table *table,
+ const char *string)
{
/* Allocate the structure if it has not already been allocated by a
subclass. */
if (entry == NULL)
{
- entry = (struct bfd_hash_entry *)
+ entry =
bfd_hash_allocate (table, sizeof (struct generic_link_hash_entry));
if (entry == NULL)
return entry;
@@ -660,37 +649,35 @@ _bfd_generic_link_hash_newfunc (entry, table, string)
/* Set local fields. */
ret = (struct generic_link_hash_entry *) entry;
- ret->written = false;
+ ret->written = FALSE;
ret->sym = NULL;
}
return entry;
}
-/* Create an generic link hash table. */
+/* Create a generic link hash table. */
struct bfd_link_hash_table *
-_bfd_generic_link_hash_table_create (abfd)
- bfd *abfd;
+_bfd_generic_link_hash_table_create (bfd *abfd)
{
struct generic_link_hash_table *ret;
bfd_size_type amt = sizeof (struct generic_link_hash_table);
- ret = (struct generic_link_hash_table *) bfd_malloc (amt);
+ ret = bfd_malloc (amt);
if (ret == NULL)
- return (struct bfd_link_hash_table *) NULL;
+ return NULL;
if (! _bfd_link_hash_table_init (&ret->root, abfd,
_bfd_generic_link_hash_newfunc))
{
free (ret);
- return (struct bfd_link_hash_table *) NULL;
+ return NULL;
}
return &ret->root;
}
void
-_bfd_generic_link_hash_table_free (hash)
- struct bfd_link_hash_table *hash;
+_bfd_generic_link_hash_table_free (struct bfd_link_hash_table *hash)
{
struct generic_link_hash_table *ret
= (struct generic_link_hash_table *) hash;
@@ -706,41 +693,37 @@ _bfd_generic_link_hash_table_free (hash)
the hash table pointing to different instances of the symbol
structure. */
-static boolean
-generic_link_read_symbols (abfd)
- bfd *abfd;
+static bfd_boolean
+generic_link_read_symbols (bfd *abfd)
{
- if (bfd_get_outsymbols (abfd) == (asymbol **) NULL)
+ if (bfd_get_outsymbols (abfd) == NULL)
{
long symsize;
long symcount;
symsize = bfd_get_symtab_upper_bound (abfd);
if (symsize < 0)
- return false;
- bfd_get_outsymbols (abfd) =
- (asymbol **) bfd_alloc (abfd, (bfd_size_type) symsize);
+ return FALSE;
+ bfd_get_outsymbols (abfd) = bfd_alloc (abfd, symsize);
if (bfd_get_outsymbols (abfd) == NULL && symsize != 0)
- return false;
+ return FALSE;
symcount = bfd_canonicalize_symtab (abfd, bfd_get_outsymbols (abfd));
if (symcount < 0)
- return false;
+ return FALSE;
bfd_get_symcount (abfd) = symcount;
}
- return true;
+ return TRUE;
}
/* Generic function to add symbols to from an object file to the
global hash table. This version does not automatically collect
constructors by name. */
-boolean
-_bfd_generic_link_add_symbols (abfd, info)
- bfd *abfd;
- struct bfd_link_info *info;
+bfd_boolean
+_bfd_generic_link_add_symbols (bfd *abfd, struct bfd_link_info *info)
{
- return generic_link_add_symbols (abfd, info, false);
+ return generic_link_add_symbols (abfd, info, FALSE);
}
/* Generic function to add symbols from an object file to the global
@@ -750,12 +733,10 @@ _bfd_generic_link_add_symbols (abfd, info)
constructors and destructors; these are approximately those targets
for which gcc uses collect2 and do not support stabs. */
-boolean
-_bfd_generic_link_add_symbols_collect (abfd, info)
- bfd *abfd;
- struct bfd_link_info *info;
+bfd_boolean
+_bfd_generic_link_add_symbols_collect (bfd *abfd, struct bfd_link_info *info)
{
- return generic_link_add_symbols (abfd, info, true);
+ return generic_link_add_symbols (abfd, info, TRUE);
}
/* Indicate that we are only retrieving symbol values from this
@@ -763,9 +744,8 @@ _bfd_generic_link_add_symbols_collect (abfd, info)
file are absolute. */
void
-_bfd_generic_link_just_syms (sec, info)
- asection *sec;
- struct bfd_link_info *info ATTRIBUTE_UNUSED;
+_bfd_generic_link_just_syms (asection *sec,
+ struct bfd_link_info *info ATTRIBUTE_UNUSED)
{
sec->output_section = bfd_abs_section_ptr;
sec->output_offset = sec->vma;
@@ -773,13 +753,12 @@ _bfd_generic_link_just_syms (sec, info)
/* Add symbols from an object file to the global hash table. */
-static boolean
-generic_link_add_symbols (abfd, info, collect)
- bfd *abfd;
- struct bfd_link_info *info;
- boolean collect;
+static bfd_boolean
+generic_link_add_symbols (bfd *abfd,
+ struct bfd_link_info *info,
+ bfd_boolean collect)
{
- boolean ret;
+ bfd_boolean ret;
switch (bfd_get_format (abfd))
{
@@ -795,7 +774,7 @@ generic_link_add_symbols (abfd, info, collect)
break;
default:
bfd_set_error (bfd_error_wrong_format);
- ret = false;
+ ret = FALSE;
}
return ret;
@@ -803,17 +782,16 @@ generic_link_add_symbols (abfd, info, collect)
/* Add symbols from an object file to the global hash table. */
-static boolean
-generic_link_add_object_symbols (abfd, info, collect)
- bfd *abfd;
- struct bfd_link_info *info;
- boolean collect;
+static bfd_boolean
+generic_link_add_object_symbols (bfd *abfd,
+ struct bfd_link_info *info,
+ bfd_boolean collect)
{
bfd_size_type symcount;
- struct symbol_cache_entry **outsyms;
+ struct bfd_symbol **outsyms;
if (! generic_link_read_symbols (abfd))
- return false;
+ return FALSE;
symcount = _bfd_generic_link_get_symcount (abfd);
outsyms = _bfd_generic_link_get_symbols (abfd);
return generic_link_add_symbol_list (abfd, info, symcount, outsyms, collect);
@@ -846,30 +824,20 @@ struct archive_hash_table
struct bfd_hash_table table;
};
-static struct bfd_hash_entry *archive_hash_newfunc
- PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, const char *));
-static boolean archive_hash_table_init
- PARAMS ((struct archive_hash_table *,
- struct bfd_hash_entry *(*) (struct bfd_hash_entry *,
- struct bfd_hash_table *,
- const char *)));
-
/* Create a new entry for an archive hash table. */
static struct bfd_hash_entry *
-archive_hash_newfunc (entry, table, string)
- struct bfd_hash_entry *entry;
- struct bfd_hash_table *table;
- const char *string;
+archive_hash_newfunc (struct bfd_hash_entry *entry,
+ struct bfd_hash_table *table,
+ const char *string)
{
struct archive_hash_entry *ret = (struct archive_hash_entry *) entry;
/* Allocate the structure if it has not already been allocated by a
subclass. */
- if (ret == (struct archive_hash_entry *) NULL)
- ret = ((struct archive_hash_entry *)
- bfd_hash_allocate (table, sizeof (struct archive_hash_entry)));
- if (ret == (struct archive_hash_entry *) NULL)
+ if (ret == NULL)
+ ret = bfd_hash_allocate (table, sizeof (struct archive_hash_entry));
+ if (ret == NULL)
return NULL;
/* Call the allocation method of the superclass. */
@@ -879,20 +847,20 @@ archive_hash_newfunc (entry, table, string)
if (ret)
{
/* Initialize the local fields. */
- ret->defs = (struct archive_list *) NULL;
+ ret->defs = NULL;
}
- return (struct bfd_hash_entry *) ret;
+ return &ret->root;
}
/* Initialize an archive hash table. */
-static boolean
-archive_hash_table_init (table, newfunc)
- struct archive_hash_table *table;
- struct bfd_hash_entry *(*newfunc) PARAMS ((struct bfd_hash_entry *,
- struct bfd_hash_table *,
- const char *));
+static bfd_boolean
+archive_hash_table_init
+ (struct archive_hash_table *table,
+ struct bfd_hash_entry *(*newfunc) (struct bfd_hash_entry *,
+ struct bfd_hash_table *,
+ const char *))
{
return bfd_hash_table_init (&table->table, newfunc);
}
@@ -927,10 +895,10 @@ archive_hash_table_init (table, newfunc)
re-search the symbol table each time a new object file was added.
The CHECKFN argument is used to see if an object file should be
- included. CHECKFN should set *PNEEDED to true if the object file
+ included. CHECKFN should set *PNEEDED to TRUE if the object file
should be included, and must also call the bfd_link_info
add_archive_element callback function and handle adding the symbols
- to the global hash table. CHECKFN should only return false if some
+ to the global hash table. CHECKFN should only return FALSE if some
sort of error occurs.
For some formats, such as a.out, it is possible to look through an
@@ -944,12 +912,11 @@ archive_hash_table_init (table, newfunc)
may create new undefined symbols which cause a previously examined
object file to be included. */
-boolean
-_bfd_generic_link_add_archive_symbols (abfd, info, checkfn)
- bfd *abfd;
- struct bfd_link_info *info;
- boolean (*checkfn) PARAMS ((bfd *, struct bfd_link_info *,
- boolean *pneeded));
+bfd_boolean
+_bfd_generic_link_add_archive_symbols
+ (bfd *abfd,
+ struct bfd_link_info *info,
+ bfd_boolean (*checkfn) (bfd *, struct bfd_link_info *, bfd_boolean *))
{
carsym *arsyms;
carsym *arsym_end;
@@ -962,10 +929,10 @@ _bfd_generic_link_add_archive_symbols (abfd, info, checkfn)
if (! bfd_has_map (abfd))
{
/* An empty archive is a special case. */
- if (bfd_openr_next_archived_file (abfd, (bfd *) NULL) == NULL)
- return true;
+ if (bfd_openr_next_archived_file (abfd, NULL) == NULL)
+ return TRUE;
bfd_set_error (bfd_error_no_armap);
- return false;
+ return FALSE;
}
arsyms = bfd_ardata (abfd)->symdefs;
@@ -974,23 +941,21 @@ _bfd_generic_link_add_archive_symbols (abfd, info, checkfn)
/* In order to quickly determine whether an symbol is defined in
this archive, we build a hash table of the symbols. */
if (! archive_hash_table_init (&arsym_hash, archive_hash_newfunc))
- return false;
+ return FALSE;
for (arsym = arsyms, indx = 0; arsym < arsym_end; arsym++, indx++)
{
struct archive_hash_entry *arh;
struct archive_list *l, **pp;
- arh = archive_hash_lookup (&arsym_hash, arsym->name, true, false);
- if (arh == (struct archive_hash_entry *) NULL)
+ arh = archive_hash_lookup (&arsym_hash, arsym->name, TRUE, FALSE);
+ if (arh == NULL)
goto error_return;
l = ((struct archive_list *)
archive_hash_allocate (&arsym_hash, sizeof (struct archive_list)));
if (l == NULL)
goto error_return;
l->indx = indx;
- for (pp = &arh->defs;
- *pp != (struct archive_list *) NULL;
- pp = &(*pp)->next)
+ for (pp = &arh->defs; *pp != NULL; pp = &(*pp)->next)
;
*pp = l;
l->next = NULL;
@@ -1004,7 +969,7 @@ _bfd_generic_link_add_archive_symbols (abfd, info, checkfn)
/* New undefined symbols are added to the end of the list, so we
only need to look through it once. */
pundef = &info->hash->undefs;
- while (*pundef != (struct bfd_link_hash_entry *) NULL)
+ while (*pundef != NULL)
{
struct bfd_link_hash_entry *h;
struct archive_hash_entry *arh;
@@ -1025,40 +990,40 @@ _bfd_generic_link_add_archive_symbols (abfd, info, checkfn)
us to lose track of whether the symbol has been
referenced). */
if (*pundef != info->hash->undefs_tail)
- *pundef = (*pundef)->next;
+ *pundef = (*pundef)->und_next;
else
- pundef = &(*pundef)->next;
+ pundef = &(*pundef)->und_next;
continue;
}
/* Look for this symbol in the archive symbol map. */
- arh = archive_hash_lookup (&arsym_hash, h->root.string, false, false);
- if (arh == (struct archive_hash_entry *) NULL)
+ arh = archive_hash_lookup (&arsym_hash, h->root.string, FALSE, FALSE);
+ if (arh == NULL)
{
/* If we haven't found the exact symbol we're looking for,
let's look for its import thunk */
if (info->pei386_auto_import)
{
bfd_size_type amt = strlen (h->root.string) + 10;
- char *buf = (char *) bfd_malloc (amt);
+ char *buf = bfd_malloc (amt);
if (buf == NULL)
- return false;
+ return FALSE;
sprintf (buf, "__imp_%s", h->root.string);
- arh = archive_hash_lookup (&arsym_hash, buf, false, false);
+ arh = archive_hash_lookup (&arsym_hash, buf, FALSE, FALSE);
free(buf);
}
- if (arh == (struct archive_hash_entry *) NULL)
+ if (arh == NULL)
{
- pundef = &(*pundef)->next;
+ pundef = &(*pundef)->und_next;
continue;
}
}
/* Look at all the objects which define this symbol. */
- for (l = arh->defs; l != (struct archive_list *) NULL; l = l->next)
+ for (l = arh->defs; l != NULL; l = l->next)
{
bfd *element;
- boolean needed;
+ bfd_boolean needed;
/* If the symbol has gotten defined along the way, quit. */
if (h->type != bfd_link_hash_undefined
@@ -1066,7 +1031,7 @@ _bfd_generic_link_add_archive_symbols (abfd, info, checkfn)
break;
element = bfd_get_elt_at_index (abfd, l->indx);
- if (element == (bfd *) NULL)
+ if (element == NULL)
goto error_return;
/* If we've already included this element, or if we've
@@ -1099,7 +1064,7 @@ _bfd_generic_link_add_archive_symbols (abfd, info, checkfn)
}
}
- pundef = &(*pundef)->next;
+ pundef = &(*pundef)->und_next;
}
archive_hash_table_free (&arsym_hash);
@@ -1107,11 +1072,11 @@ _bfd_generic_link_add_archive_symbols (abfd, info, checkfn)
/* Save PASS in case we are called again. */
abfd->archive_pass = pass;
- return true;
+ return TRUE;
error_return:
archive_hash_table_free (&arsym_hash);
- return false;
+ return FALSE;
}
/* See if we should include an archive element. This version is used
@@ -1119,44 +1084,42 @@ _bfd_generic_link_add_archive_symbols (abfd, info, checkfn)
the symbol name, presumably because we have some other mechanism
for finding them. */
-static boolean
-generic_link_check_archive_element_no_collect (abfd, info, pneeded)
- bfd *abfd;
- struct bfd_link_info *info;
- boolean *pneeded;
+static bfd_boolean
+generic_link_check_archive_element_no_collect (
+ bfd *abfd,
+ struct bfd_link_info *info,
+ bfd_boolean *pneeded)
{
- return generic_link_check_archive_element (abfd, info, pneeded, false);
+ return generic_link_check_archive_element (abfd, info, pneeded, FALSE);
}
/* See if we should include an archive element. This version is used
when we want to automatically collect constructors based on the
symbol name, as collect2 does. */
-static boolean
-generic_link_check_archive_element_collect (abfd, info, pneeded)
- bfd *abfd;
- struct bfd_link_info *info;
- boolean *pneeded;
+static bfd_boolean
+generic_link_check_archive_element_collect (bfd *abfd,
+ struct bfd_link_info *info,
+ bfd_boolean *pneeded)
{
- return generic_link_check_archive_element (abfd, info, pneeded, true);
+ return generic_link_check_archive_element (abfd, info, pneeded, TRUE);
}
/* See if we should include an archive element. Optionally collect
constructors. */
-static boolean
-generic_link_check_archive_element (abfd, info, pneeded, collect)
- bfd *abfd;
- struct bfd_link_info *info;
- boolean *pneeded;
- boolean collect;
+static bfd_boolean
+generic_link_check_archive_element (bfd *abfd,
+ struct bfd_link_info *info,
+ bfd_boolean *pneeded,
+ bfd_boolean collect)
{
asymbol **pp, **ppend;
- *pneeded = false;
+ *pneeded = FALSE;
if (! generic_link_read_symbols (abfd))
- return false;
+ return FALSE;
pp = _bfd_generic_link_get_symbols (abfd);
ppend = pp + _bfd_generic_link_get_symcount (abfd);
@@ -1177,9 +1140,9 @@ generic_link_check_archive_element (abfd, info, pneeded, collect)
symbol (type bfd_link_hash_undefweak) is not considered to be
a reference when pulling files out of an archive. See the
SVR4 ABI, p. 4-27. */
- h = bfd_link_hash_lookup (info->hash, bfd_asymbol_name (p), false,
- false, true);
- if (h == (struct bfd_link_hash_entry *) NULL
+ h = bfd_link_hash_lookup (info->hash, bfd_asymbol_name (p), FALSE,
+ FALSE, TRUE);
+ if (h == NULL
|| (h->type != bfd_link_hash_undefined
&& h->type != bfd_link_hash_common))
continue;
@@ -1194,14 +1157,14 @@ generic_link_check_archive_element (abfd, info, pneeded, collect)
/* This object file defines this symbol, so pull it in. */
if (! (*info->callbacks->add_archive_element) (info, abfd,
bfd_asymbol_name (p)))
- return false;
+ return FALSE;
symcount = _bfd_generic_link_get_symcount (abfd);
symbols = _bfd_generic_link_get_symbols (abfd);
if (! generic_link_add_symbol_list (abfd, info, symcount,
symbols, collect))
- return false;
- *pneeded = true;
- return true;
+ return FALSE;
+ *pneeded = TRUE;
+ return TRUE;
}
/* P is a common symbol. */
@@ -1213,16 +1176,16 @@ generic_link_check_archive_element (abfd, info, pneeded, collect)
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 in the object
file. This is for the -u option in the linker. */
if (! (*info->callbacks->add_archive_element)
(info, abfd, bfd_asymbol_name (p)))
- return false;
- *pneeded = true;
- return true;
+ return FALSE;
+ *pneeded = TRUE;
+ return TRUE;
}
/* Turn the symbol into a common symbol but do not link in
@@ -1234,11 +1197,10 @@ generic_link_check_archive_element (abfd, info, pneeded, collect)
will be linked in. */
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)));
+ bfd_hash_allocate (&info->hash->table,
+ sizeof (struct bfd_link_hash_common_entry));
if (h->u.c.p == NULL)
- return false;
+ return FALSE;
size = bfd_asymbol_value (p);
h->u.c.size = size;
@@ -1267,22 +1229,21 @@ generic_link_check_archive_element (abfd, info, pneeded, collect)
}
/* This archive element is not needed. */
- return true;
+ return TRUE;
}
/* Add the symbols from an object file to the global hash table. ABFD
is the object file. INFO is the linker information. SYMBOL_COUNT
is the number of symbols. SYMBOLS is the list of symbols. COLLECT
- is true if constructors should be automatically collected by name
+ is TRUE if constructors should be automatically collected by name
as is done by collect2. */
-static boolean
-generic_link_add_symbol_list (abfd, info, symbol_count, symbols, collect)
- bfd *abfd;
- struct bfd_link_info *info;
- bfd_size_type symbol_count;
- asymbol **symbols;
- boolean collect;
+static bfd_boolean
+generic_link_add_symbol_list (bfd *abfd,
+ struct bfd_link_info *info,
+ bfd_size_type symbol_count,
+ asymbol **symbols,
+ bfd_boolean collect)
{
asymbol **pp, **ppend;
@@ -1331,8 +1292,8 @@ generic_link_add_symbol_list (abfd, info, symbol_count, symbols, collect)
bh = NULL;
if (! (_bfd_generic_link_add_one_symbol
(info, abfd, name, p->flags, bfd_get_section (p),
- p->value, string, false, collect, &bh)))
- return false;
+ p->value, string, FALSE, collect, &bh)))
+ return FALSE;
h = (struct generic_link_hash_entry *) bh;
/* If this is a constructor symbol, and the linker didn't do
@@ -1356,7 +1317,7 @@ generic_link_add_symbol_list (abfd, info, symbol_count, symbols, collect)
generic one. */
if (info->hash->creator == abfd->xvec)
{
- if (h->sym == (asymbol *) NULL
+ if (h->sym == NULL
|| (! bfd_is_und_section (bfd_get_section (p))
&& (! bfd_is_com_section (bfd_get_section (p))
|| bfd_is_und_section (bfd_get_section (h->sym)))))
@@ -1375,11 +1336,11 @@ generic_link_add_symbol_list (abfd, info, symbol_count, symbols, collect)
it gets rewritten to not use asymbol structures.
Setting this is also used to check whether these
symbols were set up by the generic linker. */
- p->udata.p = (PTR) h;
+ p->udata.p = h;
}
}
- return true;
+ return TRUE;
}
/* We use a state table to deal with adding symbols from an object
@@ -1475,8 +1436,7 @@ static const enum link_action link_action[8][8] =
/* Return the BFD in which a hash entry has been defined, if known. */
static bfd *
-hash_entry_bfd (h)
- struct bfd_link_hash_entry *h;
+hash_entry_bfd (struct bfd_link_hash_entry *h)
{
while (h->type == bfd_link_hash_warning)
h = h->u.i.link;
@@ -1506,31 +1466,29 @@ hash_entry_bfd (h)
STRING is used for either an indirect symbol, in which case it is
the name of the symbol to indirect to, or a warning symbol, in
which case it is the warning string.
- COPY is true if NAME or STRING must be copied into locally
+ COPY is TRUE if NAME or STRING must be copied into locally
allocated memory if they need to be saved.
- COLLECT is true if we should automatically collect gcc constructor
+ COLLECT is TRUE if we should automatically collect gcc constructor
or destructor names as collect2 does.
HASHP, if not NULL, is a place to store the created hash table
entry; if *HASHP is not NULL, the caller has already looked up
the hash table entry, and stored it in *HASHP. */
-boolean
-_bfd_generic_link_add_one_symbol (info, abfd, name, flags, section, value,
- string, copy, collect, hashp)
- struct bfd_link_info *info;
- bfd *abfd;
- const char *name;
- flagword flags;
- asection *section;
- bfd_vma value;
- const char *string;
- boolean copy;
- boolean collect;
- struct bfd_link_hash_entry **hashp;
+bfd_boolean
+_bfd_generic_link_add_one_symbol (struct bfd_link_info *info,
+ bfd *abfd,
+ const char *name,
+ flagword flags,
+ asection *section,
+ bfd_vma value,
+ const char *string,
+ bfd_boolean copy,
+ bfd_boolean collect,
+ struct bfd_link_hash_entry **hashp)
{
enum link_row row;
struct bfd_link_hash_entry *h;
- boolean cycle;
+ bfd_boolean cycle;
if (bfd_is_ind_section (section)
|| (flags & BSF_INDIRECT) != 0)
@@ -1558,35 +1516,34 @@ _bfd_generic_link_add_one_symbol (info, abfd, name, flags, section, value,
else
{
if (row == UNDEF_ROW || row == UNDEFW_ROW)
- h = bfd_wrapped_link_hash_lookup (abfd, info, name, true, copy, false);
+ h = bfd_wrapped_link_hash_lookup (abfd, info, name, TRUE, copy, FALSE);
else
- h = bfd_link_hash_lookup (info->hash, name, true, copy, false);
+ h = bfd_link_hash_lookup (info->hash, name, TRUE, copy, FALSE);
if (h == NULL)
{
if (hashp != NULL)
*hashp = NULL;
- return false;
+ return FALSE;
}
}
if (info->notice_all
- || (info->notice_hash != (struct bfd_hash_table *) NULL
- && (bfd_hash_lookup (info->notice_hash, name, false, false)
- != (struct bfd_hash_entry *) NULL)))
+ || (info->notice_hash != NULL
+ && bfd_hash_lookup (info->notice_hash, name, FALSE, FALSE) != NULL))
{
if (! (*info->callbacks->notice) (info, h->root.string, abfd, section,
value))
- return false;
+ return FALSE;
}
- if (hashp != (struct bfd_link_hash_entry **) NULL)
+ if (hashp != NULL)
*hashp = h;
do
{
enum link_action action;
- cycle = false;
+ cycle = FALSE;
action = link_action[(int) row][(int) h->type];
switch (action)
{
@@ -1617,8 +1574,8 @@ _bfd_generic_link_add_one_symbol (info, abfd, name, flags, section, value,
if (! ((*info->callbacks->multiple_common)
(info, h->root.string,
h->u.c.p->section->owner, bfd_link_hash_common, h->u.c.size,
- abfd, bfd_link_hash_defined, (bfd_vma) 0)))
- return false;
+ abfd, bfd_link_hash_defined, 0)))
+ return FALSE;
/* Fall through. */
case DEF:
case DEFW:
@@ -1678,7 +1635,7 @@ _bfd_generic_link_add_one_symbol (info, abfd, name, flags, section, value,
if (! ((*info->callbacks->constructor)
(info, c == 'I',
h->root.string, abfd, section, value)))
- return false;
+ return FALSE;
}
}
}
@@ -1692,11 +1649,10 @@ _bfd_generic_link_add_one_symbol (info, abfd, name, flags, section, value,
bfd_link_add_undef (info->hash, h);
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)));
+ bfd_hash_allocate (&info->hash->table,
+ sizeof (struct bfd_link_hash_common_entry));
if (h->u.c.p == NULL)
- return false;
+ return FALSE;
h->u.c.size = value;
@@ -1738,8 +1694,8 @@ _bfd_generic_link_add_one_symbol (info, abfd, name, flags, section, value,
case REF:
/* A reference to a defined symbol. */
- if (h->next == NULL && info->hash->undefs_tail != h)
- h->next = h;
+ if (h->und_next == NULL && info->hash->undefs_tail != h)
+ h->und_next = h;
break;
case BIG:
@@ -1751,7 +1707,7 @@ _bfd_generic_link_add_one_symbol (info, abfd, name, flags, section, value,
(info, h->root.string,
h->u.c.p->section->owner, bfd_link_hash_common, h->u.c.size,
abfd, bfd_link_hash_common, value)))
- return false;
+ return FALSE;
if (value > h->u.c.size)
{
unsigned int power;
@@ -1800,9 +1756,9 @@ _bfd_generic_link_add_one_symbol (info, abfd, name, flags, section, value,
else
obfd = NULL;
if (! ((*info->callbacks->multiple_common)
- (info, h->root.string, obfd, h->type, (bfd_vma) 0,
+ (info, h->root.string, obfd, h->type, 0,
abfd, bfd_link_hash_common, value)))
- return false;
+ return FALSE;
}
break;
@@ -1844,7 +1800,7 @@ _bfd_generic_link_add_one_symbol (info, abfd, name, flags, section, value,
if (! ((*info->callbacks->multiple_definition)
(info, h->root.string, msec->owner, msec, mval,
abfd, section, value)))
- return false;
+ return FALSE;
}
break;
@@ -1854,8 +1810,8 @@ _bfd_generic_link_add_one_symbol (info, abfd, name, flags, section, value,
if (! ((*info->callbacks->multiple_common)
(info, h->root.string,
h->u.c.p->section->owner, bfd_link_hash_common, h->u.c.size,
- abfd, bfd_link_hash_indirect, (bfd_vma) 0)))
- return false;
+ abfd, bfd_link_hash_indirect, 0)))
+ return FALSE;
/* Fall through. */
case IND:
/* Create an indirect symbol. */
@@ -1864,10 +1820,10 @@ _bfd_generic_link_add_one_symbol (info, abfd, name, flags, section, value,
/* STRING is the name of the symbol we want to indirect
to. */
- inh = bfd_wrapped_link_hash_lookup (abfd, info, string, true,
- copy, false);
- if (inh == (struct bfd_link_hash_entry *) NULL)
- return false;
+ inh = bfd_wrapped_link_hash_lookup (abfd, info, string, TRUE,
+ copy, FALSE);
+ if (inh == NULL)
+ return FALSE;
if (inh->type == bfd_link_hash_indirect
&& inh->u.i.link == h)
{
@@ -1875,7 +1831,7 @@ _bfd_generic_link_add_one_symbol (info, abfd, name, flags, section, value,
(_("%s: indirect symbol `%s' to `%s' is a loop"),
bfd_archive_filename (abfd), name, string);
bfd_set_error (bfd_error_invalid_operation);
- return false;
+ return FALSE;
}
if (inh->type == bfd_link_hash_new)
{
@@ -1890,7 +1846,7 @@ _bfd_generic_link_add_one_symbol (info, abfd, name, flags, section, value,
if (h->type != bfd_link_hash_new)
{
row = UNDEF_ROW;
- cycle = true;
+ cycle = TRUE;
}
h->type = bfd_link_hash_indirect;
@@ -1902,7 +1858,7 @@ _bfd_generic_link_add_one_symbol (info, abfd, name, flags, section, value,
/* Add an entry to a set. */
if (! (*info->callbacks->add_to_set) (info, h, BFD_RELOC_CTOR,
abfd, section, value))
- return false;
+ return FALSE;
break;
case WARNC:
@@ -1911,9 +1867,8 @@ _bfd_generic_link_add_one_symbol (info, abfd, name, flags, section, value,
{
if (! (*info->callbacks->warning) (info, h->u.i.warning,
h->root.string, abfd,
- (asection *) NULL,
- (bfd_vma) 0))
- return false;
+ NULL, 0))
+ return FALSE;
/* Only issue a warning once. */
h->u.i.warning = NULL;
}
@@ -1921,38 +1876,35 @@ _bfd_generic_link_add_one_symbol (info, abfd, name, flags, section, value,
case CYCLE:
/* Try again with the referenced symbol. */
h = h->u.i.link;
- cycle = true;
+ cycle = TRUE;
break;
case REFC:
/* A reference to an indirect symbol. */
- if (h->next == NULL && info->hash->undefs_tail != h)
- h->next = h;
+ if (h->und_next == NULL && info->hash->undefs_tail != h)
+ h->und_next = h;
h = h->u.i.link;
- cycle = true;
+ cycle = TRUE;
break;
case WARN:
/* Issue a warning. */
if (! (*info->callbacks->warning) (info, string, h->root.string,
- hash_entry_bfd (h),
- (asection *) NULL, (bfd_vma) 0))
- return false;
+ hash_entry_bfd (h), NULL, 0))
+ return FALSE;
break;
case CWARN:
/* Warn if this symbol has been referenced already,
otherwise add a warning. A symbol has been referenced if
- the next field is not NULL, or it is the tail of the
+ the und_next field is not NULL, or it is the tail of the
undefined symbol list. The REF case above helps to
ensure this. */
- if (h->next != NULL || info->hash->undefs_tail == h)
+ if (h->und_next != NULL || info->hash->undefs_tail == h)
{
if (! (*info->callbacks->warning) (info, string, h->root.string,
- hash_entry_bfd (h),
- (asection *) NULL,
- (bfd_vma) 0))
- return false;
+ hash_entry_bfd (h), NULL, 0))
+ return FALSE;
break;
}
/* Fall through. */
@@ -1964,10 +1916,9 @@ _bfd_generic_link_add_one_symbol (info, abfd, name, flags, section, value,
/* STRING is the warning to give. */
sub = ((struct bfd_link_hash_entry *)
((*info->hash->table.newfunc)
- ((struct bfd_hash_entry *) NULL, &info->hash->table,
- h->root.string)));
+ (NULL, &info->hash->table, h->root.string)));
if (sub == NULL)
- return false;
+ return FALSE;
*sub = *h;
sub->type = bfd_link_hash_warning;
sub->u.i.link = h;
@@ -1980,7 +1931,7 @@ _bfd_generic_link_add_one_symbol (info, abfd, name, flags, section, value,
w = bfd_hash_allocate (&info->hash->table, len);
if (w == NULL)
- return false;
+ return FALSE;
memcpy (w, string, len);
sub->u.i.warning = w;
}
@@ -1996,15 +1947,13 @@ _bfd_generic_link_add_one_symbol (info, abfd, name, flags, section, value,
}
while (cycle);
- return true;
+ return TRUE;
}
/* Generic final link routine. */
-boolean
-_bfd_generic_final_link (abfd, info)
- bfd *abfd;
- struct bfd_link_info *info;
+bfd_boolean
+_bfd_generic_final_link (bfd *abfd, struct bfd_link_info *info)
{
bfd *sub;
asection *o;
@@ -2012,7 +1961,7 @@ _bfd_generic_final_link (abfd, info)
size_t outsymalloc;
struct generic_write_global_symbol_info wginfo;
- bfd_get_outsymbols (abfd) = (asymbol **) NULL;
+ bfd_get_outsymbols (abfd) = NULL;
bfd_get_symcount (abfd) = 0;
outsymalloc = 0;
@@ -2020,12 +1969,12 @@ _bfd_generic_final_link (abfd, info)
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 = (unsigned int) true;
+ p->u.indirect.section->linker_mark = TRUE;
/* Build the output symbol table. */
- for (sub = info->input_bfds; sub != (bfd *) NULL; sub = sub->link_next)
+ for (sub = info->input_bfds; sub != NULL; sub = sub->link_next)
if (! _bfd_generic_link_output_symbols (abfd, sub, info, &outsymalloc))
- return false;
+ return FALSE;
/* Accumulate the global symbols. */
wginfo.info = info;
@@ -2033,25 +1982,21 @@ _bfd_generic_final_link (abfd, info)
wginfo.psymalloc = &outsymalloc;
_bfd_generic_link_hash_traverse (_bfd_generic_hash_table (info),
_bfd_generic_link_write_global_symbol,
- (PTR) &wginfo);
+ &wginfo);
/* Make sure we have a trailing NULL pointer on OUTSYMBOLS. We
shouldn't really need one, since we have SYMCOUNT, but some old
code still expects one. */
if (! generic_add_output_symbol (abfd, &outsymalloc, NULL))
- return false;
+ return FALSE;
- if (info->relocateable)
+ if (info->relocatable)
{
/* Allocate space for the output relocs for each section. */
- for (o = abfd->sections;
- o != (asection *) NULL;
- o = o->next)
+ for (o = abfd->sections; o != NULL; o = o->next)
{
o->reloc_count = 0;
- for (p = o->link_order_head;
- p != (struct bfd_link_order *) NULL;
- p = p->next)
+ 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)
@@ -2070,21 +2015,21 @@ _bfd_generic_final_link (abfd, info)
relsize = bfd_get_reloc_upper_bound (input_bfd,
input_section);
if (relsize < 0)
- return false;
- relocs = (arelent **) bfd_malloc ((bfd_size_type) relsize);
+ return FALSE;
+ relocs = bfd_malloc (relsize);
if (!relocs && relsize != 0)
- return false;
+ return FALSE;
symbols = _bfd_generic_link_get_symbols (input_bfd);
reloc_count = bfd_canonicalize_reloc (input_bfd,
input_section,
relocs,
symbols);
+ free (relocs);
if (reloc_count < 0)
- return false;
+ return FALSE;
BFD_ASSERT ((unsigned long) reloc_count
== input_section->reloc_count);
o->reloc_count += reloc_count;
- free (relocs);
}
}
if (o->reloc_count > 0)
@@ -2093,9 +2038,9 @@ _bfd_generic_final_link (abfd, info)
amt = o->reloc_count;
amt *= sizeof (arelent *);
- o->orelocation = (arelent **) bfd_alloc (abfd, amt);
+ o->orelocation = bfd_alloc (abfd, amt);
if (!o->orelocation)
- return false;
+ return FALSE;
o->flags |= SEC_RELOC;
/* Reset the count so that it can be used as an index
when putting in the output relocs. */
@@ -2105,43 +2050,36 @@ _bfd_generic_final_link (abfd, info)
}
/* Handle all the link order information for the sections. */
- for (o = abfd->sections;
- o != (asection *) NULL;
- o = o->next)
+ for (o = abfd->sections; o != NULL; o = o->next)
{
- for (p = o->link_order_head;
- p != (struct bfd_link_order *) NULL;
- p = p->next)
+ for (p = o->link_order_head; p != NULL; p = p->next)
{
switch (p->type)
{
case bfd_section_reloc_link_order:
case bfd_symbol_reloc_link_order:
if (! _bfd_generic_reloc_link_order (abfd, info, o, p))
- return false;
+ return FALSE;
break;
case bfd_indirect_link_order:
- if (! default_indirect_link_order (abfd, info, o, p, true))
- return false;
+ if (! default_indirect_link_order (abfd, info, o, p, TRUE))
+ return FALSE;
break;
default:
if (! _bfd_default_link_order (abfd, info, o, p))
- return false;
+ return FALSE;
break;
}
}
}
- return true;
+ return TRUE;
}
/* Add an output symbol to the output BFD. */
-static boolean
-generic_add_output_symbol (output_bfd, psymalloc, sym)
- bfd *output_bfd;
- size_t *psymalloc;
- asymbol *sym;
+static bfd_boolean
+generic_add_output_symbol (bfd *output_bfd, size_t *psymalloc, asymbol *sym)
{
if (bfd_get_symcount (output_bfd) >= *psymalloc)
{
@@ -2154,9 +2092,9 @@ generic_add_output_symbol (output_bfd, psymalloc, sym)
*psymalloc *= 2;
amt = *psymalloc;
amt *= sizeof (asymbol *);
- newsyms = (asymbol **) bfd_realloc (bfd_get_outsymbols (output_bfd), amt);
- if (newsyms == (asymbol **) NULL)
- return false;
+ newsyms = bfd_realloc (bfd_get_outsymbols (output_bfd), amt);
+ if (newsyms == NULL)
+ return FALSE;
bfd_get_outsymbols (output_bfd) = newsyms;
}
@@ -2164,32 +2102,29 @@ generic_add_output_symbol (output_bfd, psymalloc, sym)
if (sym != NULL)
++ bfd_get_symcount (output_bfd);
- return true;
+ return TRUE;
}
/* Handle the symbols for an input BFD. */
-boolean
-_bfd_generic_link_output_symbols (output_bfd, input_bfd, info, psymalloc)
- bfd *output_bfd;
- bfd *input_bfd;
- struct bfd_link_info *info;
- size_t *psymalloc;
+bfd_boolean
+_bfd_generic_link_output_symbols (bfd *output_bfd,
+ bfd *input_bfd,
+ struct bfd_link_info *info,
+ size_t *psymalloc)
{
asymbol **sym_ptr;
asymbol **sym_end;
if (! generic_link_read_symbols (input_bfd))
- return false;
+ return FALSE;
/* Create a filename symbol if we are supposed to. */
- if (info->create_object_symbols_section != (asection *) NULL)
+ if (info->create_object_symbols_section != NULL)
{
asection *sec;
- for (sec = input_bfd->sections;
- sec != (asection *) NULL;
- sec = sec->next)
+ for (sec = input_bfd->sections; sec != NULL; sec = sec->next)
{
if (sec->output_section == info->create_object_symbols_section)
{
@@ -2197,7 +2132,7 @@ _bfd_generic_link_output_symbols (output_bfd, input_bfd, info, psymalloc)
newsym = bfd_make_empty_symbol (input_bfd);
if (!newsym)
- return false;
+ return FALSE;
newsym->name = input_bfd->filename;
newsym->value = 0;
newsym->flags = BSF_LOCAL | BSF_FILE;
@@ -2205,7 +2140,7 @@ _bfd_generic_link_output_symbols (output_bfd, input_bfd, info, psymalloc)
if (! generic_add_output_symbol (output_bfd, psymalloc,
newsym))
- return false;
+ return FALSE;
break;
}
@@ -2220,9 +2155,9 @@ _bfd_generic_link_output_symbols (output_bfd, input_bfd, info, psymalloc)
{
asymbol *sym;
struct generic_link_hash_entry *h;
- boolean output;
+ bfd_boolean output;
- h = (struct generic_link_hash_entry *) NULL;
+ h = NULL;
sym = *sym_ptr;
if ((sym->flags & (BSF_INDIRECT
| BSF_WARNING
@@ -2234,7 +2169,7 @@ _bfd_generic_link_output_symbols (output_bfd, input_bfd, info, psymalloc)
|| bfd_is_ind_section (bfd_get_section (sym)))
{
if (sym->udata.p != NULL)
- h = (struct generic_link_hash_entry *) sym->udata.p;
+ h = sym->udata.p;
else if ((sym->flags & BSF_CONSTRUCTOR) != 0)
{
/* This case normally means that the main linker code
@@ -2251,13 +2186,13 @@ _bfd_generic_link_output_symbols (output_bfd, input_bfd, info, psymalloc)
h = ((struct generic_link_hash_entry *)
bfd_wrapped_link_hash_lookup (output_bfd, info,
bfd_asymbol_name (sym),
- false, false, true));
+ FALSE, FALSE, TRUE));
else
h = _bfd_generic_link_hash_lookup (_bfd_generic_hash_table (info),
bfd_asymbol_name (sym),
- false, false, true);
+ FALSE, FALSE, TRUE);
- if (h != (struct generic_link_hash_entry *) NULL)
+ if (h != NULL)
{
/* Force all references to this symbol to point to
the same area in memory. It is possible that
@@ -2266,7 +2201,7 @@ _bfd_generic_link_output_symbols (output_bfd, input_bfd, info, psymalloc)
check that. */
if (info->hash->creator == input_bfd->xvec)
{
- if (h->sym != (asymbol *) NULL)
+ if (h->sym != NULL)
*sym_ptr = sym = h->sym;
}
@@ -2318,10 +2253,9 @@ _bfd_generic_link_output_symbols (output_bfd, input_bfd, info, psymalloc)
write_file_locals in ldsym.c. */
if (info->strip == strip_all
|| (info->strip == strip_some
- && (bfd_hash_lookup (info->keep_hash, bfd_asymbol_name (sym),
- false, false)
- == (struct bfd_hash_entry *) NULL)))
- output = false;
+ && bfd_hash_lookup (info->keep_hash, bfd_asymbol_name (sym),
+ FALSE, FALSE) == NULL))
+ output = FALSE;
else if ((sym->flags & (BSF_GLOBAL | BSF_WEAK)) != 0)
{
/* If this symbol is marked as occurring now, rather
@@ -2330,48 +2264,48 @@ _bfd_generic_link_output_symbols (output_bfd, input_bfd, info, psymalloc)
better way. */
if (bfd_asymbol_bfd (sym) == input_bfd
&& (sym->flags & BSF_NOT_AT_END) != 0)
- output = true;
+ output = TRUE;
else
- output = false;
+ output = FALSE;
}
else if (bfd_is_ind_section (sym->section))
- output = false;
+ output = FALSE;
else if ((sym->flags & BSF_DEBUGGING) != 0)
{
if (info->strip == strip_none)
- output = true;
+ output = TRUE;
else
- output = false;
+ output = FALSE;
}
else if (bfd_is_und_section (sym->section)
|| bfd_is_com_section (sym->section))
- output = false;
+ output = FALSE;
else if ((sym->flags & BSF_LOCAL) != 0)
{
if ((sym->flags & BSF_WARNING) != 0)
- output = false;
+ output = FALSE;
else
{
switch (info->discard)
{
default:
case discard_all:
- output = false;
+ output = FALSE;
break;
case discard_sec_merge:
- output = true;
- if (info->relocateable
+ output = TRUE;
+ if (info->relocatable
|| ! (sym->section->flags & SEC_MERGE))
break;
/* FALLTHROUGH */
case discard_l:
if (bfd_is_local_label (input_bfd, sym))
- output = false;
+ output = FALSE;
else
- output = true;
+ output = TRUE;
break;
case discard_none:
- output = true;
+ output = TRUE;
break;
}
}
@@ -2379,9 +2313,9 @@ _bfd_generic_link_output_symbols (output_bfd, input_bfd, info, psymalloc)
else if ((sym->flags & BSF_CONSTRUCTOR))
{
if (info->strip != strip_all)
- output = true;
+ output = TRUE;
else
- output = false;
+ output = FALSE;
}
else
abort ();
@@ -2393,27 +2327,25 @@ _bfd_generic_link_output_symbols (output_bfd, input_bfd, info, psymalloc)
field set. */
if ((sym->section->flags & SEC_HAS_CONTENTS) != 0
&& ! sym->section->linker_mark)
- output = false;
+ output = FALSE;
if (output)
{
if (! generic_add_output_symbol (output_bfd, psymalloc, sym))
- return false;
- if (h != (struct generic_link_hash_entry *) NULL)
- h->written = true;
+ return FALSE;
+ if (h != NULL)
+ h->written = TRUE;
}
}
- return true;
+ return TRUE;
}
/* Set the section and value of a generic BFD symbol based on a linker
hash table entry. */
static void
-set_symbol_from_hash (sym, h)
- asymbol *sym;
- struct bfd_link_hash_entry *h;
+set_symbol_from_hash (asymbol *sym, struct bfd_link_hash_entry *h)
{
switch (h->type)
{
@@ -2473,36 +2405,34 @@ set_symbol_from_hash (sym, h)
/* Write out a global symbol, if it hasn't already been written out.
This is called for each symbol in the hash table. */
-boolean
-_bfd_generic_link_write_global_symbol (h, data)
- struct generic_link_hash_entry *h;
- PTR data;
+bfd_boolean
+_bfd_generic_link_write_global_symbol (struct generic_link_hash_entry *h,
+ void *data)
{
- struct generic_write_global_symbol_info *wginfo =
- (struct generic_write_global_symbol_info *) data;
+ struct generic_write_global_symbol_info *wginfo = data;
asymbol *sym;
if (h->root.type == bfd_link_hash_warning)
h = (struct generic_link_hash_entry *) h->root.u.i.link;
if (h->written)
- return true;
+ return TRUE;
- h->written = true;
+ h->written = TRUE;
if (wginfo->info->strip == strip_all
|| (wginfo->info->strip == strip_some
&& bfd_hash_lookup (wginfo->info->keep_hash, h->root.root.string,
- false, false) == NULL))
- return true;
+ FALSE, FALSE) == NULL))
+ return TRUE;
- if (h->sym != (asymbol *) NULL)
+ if (h->sym != NULL)
sym = h->sym;
else
{
sym = bfd_make_empty_symbol (wginfo->output_bfd);
if (!sym)
- return false;
+ return FALSE;
sym->name = h->root.root.string;
sym->flags = 0;
}
@@ -2518,35 +2448,34 @@ _bfd_generic_link_write_global_symbol (h, data)
abort ();
}
- return true;
+ return TRUE;
}
/* Create a relocation. */
-boolean
-_bfd_generic_reloc_link_order (abfd, info, sec, link_order)
- bfd *abfd;
- struct bfd_link_info *info;
- asection *sec;
- struct bfd_link_order *link_order;
+bfd_boolean
+_bfd_generic_reloc_link_order (bfd *abfd,
+ struct bfd_link_info *info,
+ asection *sec,
+ struct bfd_link_order *link_order)
{
arelent *r;
- if (! info->relocateable)
+ if (! info->relocatable)
abort ();
- if (sec->orelocation == (arelent **) NULL)
+ if (sec->orelocation == NULL)
abort ();
- r = (arelent *) bfd_alloc (abfd, (bfd_size_type) sizeof (arelent));
- if (r == (arelent *) NULL)
- return false;
+ r = bfd_alloc (abfd, sizeof (arelent));
+ if (r == NULL)
+ return FALSE;
r->address = link_order->offset;
r->howto = bfd_reloc_type_lookup (abfd, link_order->u.reloc.p->reloc);
if (r->howto == 0)
{
bfd_set_error (bfd_error_bad_value);
- return false;
+ return FALSE;
}
/* Get the symbol to use for the relocation. */
@@ -2559,16 +2488,15 @@ _bfd_generic_reloc_link_order (abfd, info, sec, link_order)
h = ((struct generic_link_hash_entry *)
bfd_wrapped_link_hash_lookup (abfd, info,
link_order->u.reloc.p->u.name,
- false, false, true));
- if (h == (struct generic_link_hash_entry *) NULL
+ FALSE, FALSE, TRUE));
+ if (h == NULL
|| ! h->written)
{
if (! ((*info->callbacks->unattached_reloc)
- (info, link_order->u.reloc.p->u.name,
- (bfd *) NULL, (asection *) NULL, (bfd_vma) 0)))
- return false;
+ (info, link_order->u.reloc.p->u.name, NULL, NULL, 0)))
+ return FALSE;
bfd_set_error (bfd_error_bad_value);
- return false;
+ return FALSE;
}
r->sym_ptr_ptr = &h->sym;
}
@@ -2582,13 +2510,13 @@ _bfd_generic_reloc_link_order (abfd, info, sec, link_order)
bfd_size_type size;
bfd_reloc_status_type rstat;
bfd_byte *buf;
- boolean ok;
+ bfd_boolean ok;
file_ptr loc;
size = bfd_get_reloc_size (r->howto);
- buf = (bfd_byte *) bfd_zmalloc (size);
- if (buf == (bfd_byte *) NULL)
- return false;
+ buf = bfd_zmalloc (size);
+ if (buf == NULL)
+ return FALSE;
rstat = _bfd_relocate_contents (r->howto, abfd,
(bfd_vma) link_order->u.reloc.p->addend,
buf);
@@ -2606,19 +2534,18 @@ _bfd_generic_reloc_link_order (abfd, info, sec, link_order)
? bfd_section_name (abfd, link_order->u.reloc.p->u.section)
: link_order->u.reloc.p->u.name),
r->howto->name, link_order->u.reloc.p->addend,
- (bfd *) NULL, (asection *) NULL, (bfd_vma) 0)))
+ NULL, NULL, 0)))
{
free (buf);
- return false;
+ return FALSE;
}
break;
}
loc = link_order->offset * bfd_octets_per_byte (abfd);
- ok = bfd_set_section_contents (abfd, sec, (PTR) buf, loc,
- (bfd_size_type) size);
+ ok = bfd_set_section_contents (abfd, sec, buf, loc, size);
free (buf);
if (! ok)
- return false;
+ return FALSE;
r->addend = 0;
}
@@ -2626,26 +2553,24 @@ _bfd_generic_reloc_link_order (abfd, info, sec, link_order)
sec->orelocation[sec->reloc_count] = r;
++sec->reloc_count;
- return true;
+ return TRUE;
}
/* Allocate a new link_order for a section. */
struct bfd_link_order *
-bfd_new_link_order (abfd, section)
- bfd *abfd;
- asection *section;
+bfd_new_link_order (bfd *abfd, asection *section)
{
bfd_size_type amt = sizeof (struct bfd_link_order);
struct bfd_link_order *new;
- new = (struct bfd_link_order *) bfd_zalloc (abfd, amt);
+ new = bfd_zalloc (abfd, amt);
if (!new)
return NULL;
new->type = bfd_undefined_link_order;
- if (section->link_order_tail != (struct bfd_link_order *) NULL)
+ if (section->link_order_tail != NULL)
section->link_order_tail->next = new;
else
section->link_order_head = new;
@@ -2658,12 +2583,11 @@ bfd_new_link_order (abfd, section)
the reloc_link_order types here, since they depend upon the details
of how the particular backends generates relocs. */
-boolean
-_bfd_default_link_order (abfd, info, sec, link_order)
- bfd *abfd;
- struct bfd_link_info *info;
- asection *sec;
- struct bfd_link_order *link_order;
+bfd_boolean
+_bfd_default_link_order (bfd *abfd,
+ struct bfd_link_info *info,
+ asection *sec,
+ struct bfd_link_order *link_order)
{
switch (link_order->type)
{
@@ -2674,7 +2598,7 @@ _bfd_default_link_order (abfd, info, sec, link_order)
abort ();
case bfd_indirect_link_order:
return default_indirect_link_order (abfd, info, sec, link_order,
- false);
+ FALSE);
case bfd_data_link_order:
return default_data_link_order (abfd, info, sec, link_order);
}
@@ -2682,33 +2606,32 @@ _bfd_default_link_order (abfd, info, sec, link_order)
/* Default routine to handle a bfd_data_link_order. */
-static boolean
-default_data_link_order (abfd, info, sec, link_order)
- bfd *abfd;
- struct bfd_link_info *info ATTRIBUTE_UNUSED;
- asection *sec;
- struct bfd_link_order *link_order;
+static bfd_boolean
+default_data_link_order (bfd *abfd,
+ struct bfd_link_info *info ATTRIBUTE_UNUSED,
+ asection *sec,
+ struct bfd_link_order *link_order)
{
bfd_size_type size;
size_t fill_size;
bfd_byte *fill;
file_ptr loc;
- boolean result;
+ bfd_boolean result;
BFD_ASSERT ((sec->flags & SEC_HAS_CONTENTS) != 0);
size = link_order->size;
if (size == 0)
- return true;
+ return TRUE;
fill = link_order->u.data.contents;
fill_size = link_order->u.data.size;
if (fill_size != 0 && fill_size < size)
{
bfd_byte *p;
- fill = (bfd_byte *) bfd_malloc (size);
+ fill = bfd_malloc (size);
if (fill == NULL)
- return false;
+ return FALSE;
p = fill;
if (fill_size == 1)
memset (p, (int) link_order->u.data.contents[0], (size_t) size);
@@ -2737,14 +2660,12 @@ default_data_link_order (abfd, info, sec, link_order)
/* Default routine to handle a bfd_indirect_link_order. */
-static boolean
-default_indirect_link_order (output_bfd, info, output_section, link_order,
- generic_linker)
- bfd *output_bfd;
- struct bfd_link_info *info;
- asection *output_section;
- struct bfd_link_order *link_order;
- boolean generic_linker;
+static bfd_boolean
+default_indirect_link_order (bfd *output_bfd,
+ struct bfd_link_info *info,
+ asection *output_section,
+ struct bfd_link_order *link_order,
+ bfd_boolean generic_linker)
{
asection *input_section;
bfd *input_bfd;
@@ -2756,7 +2677,7 @@ default_indirect_link_order (output_bfd, info, output_section, link_order,
BFD_ASSERT ((output_section->flags & SEC_HAS_CONTENTS) != 0);
if (link_order->size == 0)
- return true;
+ return TRUE;
input_section = link_order->u.indirect.section;
input_bfd = input_section->owner;
@@ -2765,9 +2686,9 @@ default_indirect_link_order (output_bfd, info, output_section, link_order,
BFD_ASSERT (input_section->output_offset == link_order->offset);
BFD_ASSERT (input_section->_cooked_size == link_order->size);
- if (info->relocateable
+ if (info->relocatable
&& input_section->reloc_count > 0
- && output_section->orelocation == (arelent **) NULL)
+ && output_section->orelocation == NULL)
{
/* Space has not been allocated for the output relocations.
This can happen when we are called by a specific backend
@@ -2775,10 +2696,10 @@ default_indirect_link_order (output_bfd, info, output_section, link_order,
types of object files. Handling this case correctly is
difficult, and sometimes impossible. */
(*_bfd_error_handler)
- (_("Attempt to do relocateable link with %s input and %s output"),
+ (_("Attempt to do relocatable link with %s input and %s output"),
bfd_get_target (input_bfd), bfd_get_target (output_bfd));
bfd_set_error (bfd_error_wrong_format);
- return false;
+ return FALSE;
}
if (! generic_linker)
@@ -2791,7 +2712,7 @@ default_indirect_link_order (output_bfd, info, output_section, link_order,
a specific linker, presumably because we are linking
different types of object files together. */
if (! generic_link_read_symbols (input_bfd))
- return false;
+ return FALSE;
/* Since we have been called by a specific linker, rather than
the generic linker, the values of the symbols will not be
@@ -2819,15 +2740,15 @@ default_indirect_link_order (output_bfd, info, output_section, link_order,
/* sym->udata may have been set by
generic_link_add_symbol_list. */
if (sym->udata.p != NULL)
- h = (struct bfd_link_hash_entry *) sym->udata.p;
+ h = sym->udata.p;
else if (bfd_is_und_section (bfd_get_section (sym)))
h = bfd_wrapped_link_hash_lookup (output_bfd, info,
bfd_asymbol_name (sym),
- false, false, true);
+ FALSE, FALSE, TRUE);
else
h = bfd_link_hash_lookup (info->hash,
bfd_asymbol_name (sym),
- false, false, true);
+ FALSE, FALSE, TRUE);
if (h != NULL)
set_symbol_from_hash (sym, h);
}
@@ -2836,11 +2757,11 @@ default_indirect_link_order (output_bfd, info, output_section, link_order,
/* Get and relocate the section contents. */
sec_size = bfd_section_size (input_bfd, input_section);
- contents = ((bfd_byte *) bfd_malloc (sec_size));
+ contents = bfd_malloc (sec_size);
if (contents == NULL && sec_size != 0)
goto error_return;
new_contents = (bfd_get_relocated_section_contents
- (output_bfd, info, link_order, contents, info->relocateable,
+ (output_bfd, info, link_order, contents, info->relocatable,
_bfd_generic_link_get_symbols (input_bfd)));
if (!new_contents)
goto error_return;
@@ -2848,31 +2769,30 @@ default_indirect_link_order (output_bfd, info, output_section, link_order,
/* Output the section contents. */
loc = link_order->offset * bfd_octets_per_byte (output_bfd);
if (! bfd_set_section_contents (output_bfd, output_section,
- (PTR) new_contents, loc, link_order->size))
+ new_contents, loc, link_order->size))
goto error_return;
if (contents != NULL)
free (contents);
- return true;
+ return TRUE;
error_return:
if (contents != NULL)
free (contents);
- return false;
+ return FALSE;
}
/* A little routine to count the number of relocs in a link_order
list. */
unsigned int
-_bfd_count_link_order_relocs (link_order)
- struct bfd_link_order *link_order;
+_bfd_count_link_order_relocs (struct bfd_link_order *link_order)
{
register unsigned int c;
register struct bfd_link_order *l;
c = 0;
- for (l = link_order; l != (struct bfd_link_order *) NULL; l = l->next)
+ for (l = link_order; l != NULL; l = l->next)
{
if (l->type == bfd_section_reloc_link_order
|| l->type == bfd_symbol_reloc_link_order)
@@ -2887,7 +2807,7 @@ FUNCTION
bfd_link_split_section
SYNOPSIS
- boolean bfd_link_split_section(bfd *abfd, asection *sec);
+ bfd_boolean bfd_link_split_section (bfd *abfd, asection *sec);
DESCRIPTION
Return nonzero if @var{sec} should be split during a
@@ -2899,10 +2819,9 @@ DESCRIPTION
*/
-boolean
-_bfd_generic_link_split_section (abfd, sec)
- bfd *abfd ATTRIBUTE_UNUSED;
- asection *sec ATTRIBUTE_UNUSED;
+bfd_boolean
+_bfd_generic_link_split_section (bfd *abfd ATTRIBUTE_UNUSED,
+ asection *sec ATTRIBUTE_UNUSED)
{
- return false;
+ return FALSE;
}
diff --git a/contrib/binutils/bfd/merge.c b/contrib/binutils/bfd/merge.c
index 9dc2e70..89f45cd 100644
--- a/contrib/binutils/bfd/merge.c
+++ b/contrib/binutils/bfd/merge.c
@@ -1,5 +1,5 @@
/* SEC_MERGE support.
- Copyright 2001, 2002 Free Software Foundation, Inc.
+ Copyright 2001, 2002, 2003 Free Software Foundation, Inc.
Written by Jakub Jelinek <jakub@redhat.com>.
This file is part of BFD, the Binary File Descriptor library.
@@ -34,7 +34,7 @@ struct sec_merge_sec_info;
struct sec_merge_hash_entry
{
struct bfd_hash_entry root;
- /* Length of this entry. */
+ /* Length of this entry. This includes the zero terminator. */
unsigned int len;
/* Start of this string needs to be aligned to
alignment octets (not 1 << align). */
@@ -43,8 +43,6 @@ struct sec_merge_hash_entry
{
/* Index within the merged section. */
bfd_size_type index;
- /* Entity size (if present in suffix hash tables). */
- unsigned int entsize;
/* Entry this is a suffix of (if alignment is 0). */
struct sec_merge_hash_entry *suffix;
} u;
@@ -68,7 +66,7 @@ struct sec_merge_hash
/* Entity size. */
unsigned int entsize;
/* Are entries fixed size or zero terminated strings? */
- boolean strings;
+ bfd_boolean strings;
};
struct sec_merge_info
@@ -88,7 +86,7 @@ struct sec_merge_sec_info
/* The corresponding section. */
asection *sec;
/* Pointer to merge_info pointing to us. */
- PTR *psecinfo;
+ void **psecinfo;
/* A hash table used to hold section content. */
struct sec_merge_hash *htab;
/* First string in this section. */
@@ -97,31 +95,12 @@ struct sec_merge_sec_info
unsigned char contents[1];
};
-static struct bfd_hash_entry *sec_merge_hash_newfunc
- PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, const char *));
-static struct sec_merge_hash_entry *sec_merge_hash_lookup
- PARAMS ((struct sec_merge_hash *, const char *, unsigned int, boolean));
-static struct sec_merge_hash *sec_merge_init
- PARAMS ((unsigned int, boolean));
-static struct sec_merge_hash_entry *sec_merge_add
- PARAMS ((struct sec_merge_hash *, const char *, unsigned int,
- struct sec_merge_sec_info *));
-static boolean sec_merge_emit
- PARAMS ((bfd *, struct sec_merge_hash_entry *));
-static int cmplengthentry PARAMS ((const PTR, const PTR));
-static int last4_eq PARAMS ((const PTR, const PTR));
-static int last_eq PARAMS ((const PTR, const PTR));
-static boolean record_section
- PARAMS ((struct sec_merge_info *, struct sec_merge_sec_info *));
-static void merge_strings PARAMS ((struct sec_merge_info *));
/* Routine to create an entry in a section merge hashtab. */
static struct bfd_hash_entry *
-sec_merge_hash_newfunc (entry, table, string)
- struct bfd_hash_entry *entry;
- struct bfd_hash_table *table;
- const char *string;
+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;
@@ -152,11 +131,8 @@ sec_merge_hash_newfunc (entry, table, string)
/* Look up an entry in a section merge hash table. */
static struct sec_merge_hash_entry *
-sec_merge_hash_lookup (table, string, alignment, create)
- struct sec_merge_hash *table;
- const char *string;
- unsigned int alignment;
- boolean create;
+sec_merge_hash_lookup (struct sec_merge_hash *table, const char *string,
+ unsigned int alignment, bfd_boolean create)
{
register const unsigned char *s;
register unsigned long hash;
@@ -227,9 +203,12 @@ sec_merge_hash_lookup (table, string, alignment, create)
alignment, we need to insert another copy. */
if (hashp->alignment < alignment)
{
- /* Mark the less aligned copy as deleted. */
- hashp->len = 0;
- hashp->alignment = 0;
+ if (create)
+ {
+ /* Mark the less aligned copy as deleted. */
+ hashp->len = 0;
+ hashp->alignment = 0;
+ }
break;
}
return hashp;
@@ -257,9 +236,7 @@ sec_merge_hash_lookup (table, string, alignment, create)
/* Create a new hash table. */
static struct sec_merge_hash *
-sec_merge_init (entsize, strings)
- unsigned int entsize;
- boolean strings;
+sec_merge_init (unsigned int entsize, bfd_boolean strings)
{
struct sec_merge_hash *table;
bfd_size_type amt = sizeof (struct sec_merge_hash);
@@ -287,15 +264,12 @@ sec_merge_init (entsize, strings)
already present. */
static struct sec_merge_hash_entry *
-sec_merge_add (tab, str, alignment, secinfo)
- struct sec_merge_hash *tab;
- const char *str;
- unsigned int alignment;
- struct sec_merge_sec_info *secinfo;
+sec_merge_add (struct sec_merge_hash *tab, const char *str,
+ unsigned int alignment, struct sec_merge_sec_info *secinfo)
{
register struct sec_merge_hash_entry *entry;
- entry = sec_merge_hash_lookup (tab, str, alignment, true);
+ entry = sec_merge_hash_lookup (tab, str, alignment, TRUE);
if (entry == NULL)
return NULL;
@@ -313,10 +287,8 @@ sec_merge_add (tab, str, alignment, secinfo)
return entry;
}
-static boolean
-sec_merge_emit (abfd, entry)
- register bfd *abfd;
- struct sec_merge_hash_entry *entry;
+static bfd_boolean
+sec_merge_emit (bfd *abfd, struct sec_merge_hash_entry *entry)
{
struct sec_merge_sec_info *secinfo = entry->secinfo;
asection *sec = secinfo->sec;
@@ -336,7 +308,7 @@ sec_merge_emit (abfd, entry)
if (len)
{
len = entry->alignment - len;
- if (bfd_bwrite ((PTR) pad, (bfd_size_type) len, abfd) != len)
+ if (bfd_bwrite (pad, (bfd_size_type) len, abfd) != len)
break;
off += len;
}
@@ -344,7 +316,7 @@ sec_merge_emit (abfd, entry)
str = entry->root.string;
len = entry->len;
- if (bfd_bwrite ((PTR) str, (bfd_size_type) len, abfd) != len)
+ if (bfd_bwrite (str, (bfd_size_type) len, abfd) != len)
break;
off += len;
@@ -353,18 +325,14 @@ sec_merge_emit (abfd, entry)
if (alignment_power)
free (pad);
- return (boolean) (entry == NULL || entry->secinfo != secinfo);
+ return entry == NULL || entry->secinfo != secinfo;
}
/* This function is called for each input file from the add_symbols
pass of the linker. */
-boolean
-_bfd_merge_section (abfd, psinfo, sec, psecinfo)
- bfd *abfd;
- PTR *psinfo;
- asection *sec;
- PTR *psecinfo;
+bfd_boolean
+_bfd_merge_section (bfd *abfd, void **psinfo, asection *sec, void **psecinfo)
{
struct sec_merge_info *sinfo;
struct sec_merge_sec_info *secinfo;
@@ -375,12 +343,12 @@ _bfd_merge_section (abfd, psinfo, sec, psecinfo)
|| (sec->flags & SEC_EXCLUDE)
|| (sec->flags & SEC_MERGE) == 0
|| sec->entsize == 0)
- return true;
+ return TRUE;
if ((sec->flags & SEC_RELOC) != 0)
{
/* We aren't prepared to handle relocations in merged sections. */
- return true;
+ return TRUE;
}
align = bfd_get_section_alignment (sec->owner, sec);
@@ -396,7 +364,7 @@ _bfd_merge_section (abfd, psinfo, sec, psecinfo)
of alignment. For non-string constants, alignment must
be smaller than or equal to entity size and entity size
must be integer multiple of alignment. */
- return true;
+ return TRUE;
}
for (sinfo = (struct sec_merge_info *) *psinfo; sinfo; sinfo = sinfo->next)
@@ -415,7 +383,7 @@ _bfd_merge_section (abfd, psinfo, sec, psecinfo)
goto error_return;
sinfo->next = (struct sec_merge_info *) *psinfo;
sinfo->chain = NULL;
- *psinfo = (PTR) sinfo;
+ *psinfo = sinfo;
sinfo->htab = sec_merge_init (sec->entsize, (sec->flags & SEC_STRINGS));
if (sinfo->htab == NULL)
goto error_return;
@@ -446,108 +414,28 @@ _bfd_merge_section (abfd, psinfo, sec, psecinfo)
(bfd_vma) 0, sec->_raw_size))
goto error_return;
- return true;
+ return TRUE;
error_return:
*psecinfo = NULL;
- return false;
-}
-
-/* Compare two sec_merge_hash_entry structures. This is called via qsort. */
-
-static int
-cmplengthentry (a, b)
- const PTR a;
- const PTR b;
-{
- struct sec_merge_hash_entry * A = *(struct sec_merge_hash_entry **) a;
- struct sec_merge_hash_entry * B = *(struct sec_merge_hash_entry **) b;
-
- if (A->len < B->len)
- return 1;
- else if (A->len > B->len)
- return -1;
-
- return memcmp (A->root.string, B->root.string, A->len);
-}
-
-static int
-last4_eq (a, b)
- const PTR a;
- const PTR b;
-{
- struct sec_merge_hash_entry * A = (struct sec_merge_hash_entry *) a;
- struct sec_merge_hash_entry * B = (struct sec_merge_hash_entry *) b;
-
- if (memcmp (A->root.string + A->len - 5 * A->u.entsize,
- B->root.string + B->len - 5 * A->u.entsize,
- 4 * A->u.entsize) != 0)
- /* This was a hashtable collision. */
- return 0;
-
- if (A->len <= B->len)
- /* B cannot be a suffix of A unless A is equal to B, which is guaranteed
- not to be equal by the hash table. */
- return 0;
-
- if (A->alignment < B->alignment
- || ((A->len - B->len) & (B->alignment - 1)))
- /* The suffix is not sufficiently aligned. */
- return 0;
-
- return memcmp (A->root.string + (A->len - B->len),
- B->root.string, B->len - 5 * A->u.entsize) == 0;
-}
-
-static int
-last_eq (a, b)
- const PTR a;
- const PTR b;
-{
- struct sec_merge_hash_entry * A = (struct sec_merge_hash_entry *) a;
- struct sec_merge_hash_entry * B = (struct sec_merge_hash_entry *) b;
-
- if (B->len >= 5 * A->u.entsize)
- /* Longer strings are just pushed into the hash table,
- they'll be used when looking up for very short strings. */
- return 0;
-
- if (memcmp (A->root.string + A->len - 2 * A->u.entsize,
- B->root.string + B->len - 2 * A->u.entsize,
- A->u.entsize) != 0)
- /* This was a hashtable collision. */
- return 0;
-
- if (A->len <= B->len)
- /* B cannot be a suffix of A unless A is equal to B, which is guaranteed
- not to be equal by the hash table. */
- return 0;
-
- if (A->alignment < B->alignment
- || ((A->len - B->len) & (B->alignment - 1)))
- /* The suffix is not sufficiently aligned. */
- return 0;
-
- return memcmp (A->root.string + (A->len - B->len),
- B->root.string, B->len - 2 * A->u.entsize) == 0;
+ return FALSE;
}
/* Record one section into the hash table. */
-static boolean
-record_section (sinfo, secinfo)
- struct sec_merge_info *sinfo;
- struct sec_merge_sec_info *secinfo;
+static bfd_boolean
+record_section (struct sec_merge_info *sinfo,
+ struct sec_merge_sec_info *secinfo)
{
asection *sec = secinfo->sec;
struct sec_merge_hash_entry *entry;
- boolean nul;
+ bfd_boolean nul;
unsigned char *p, *end;
bfd_vma mask, eltalign;
unsigned int align, i;
align = bfd_get_section_alignment (sec->owner, sec);
end = secinfo->contents + sec->_raw_size;
- nul = false;
+ nul = FALSE;
mask = ((bfd_vma) 1 << align) - 1;
if (sec->flags & SEC_STRINGS)
{
@@ -567,14 +455,14 @@ record_section (sinfo, secinfo)
{
if (!nul && !((p - secinfo->contents) & mask))
{
- nul = true;
+ nul = TRUE;
entry = sec_merge_add (sinfo->htab, "",
(unsigned) mask + 1, secinfo);
if (! entry)
goto error_return;
}
p++;
- }
+ }
}
else
{
@@ -587,7 +475,7 @@ record_section (sinfo, secinfo)
break;
if (!nul && !((p - secinfo->contents) & mask))
{
- nul = true;
+ nul = TRUE;
entry = sec_merge_add (sinfo->htab, p,
(unsigned) mask + 1, secinfo);
if (! entry)
@@ -608,27 +496,89 @@ record_section (sinfo, secinfo)
}
}
- return true;
+ return TRUE;
error_return:
for (secinfo = sinfo->chain; secinfo; secinfo = secinfo->next)
*secinfo->psecinfo = NULL;
- return false;
+ return FALSE;
+}
+
+static int
+strrevcmp (const void *a, const void *b)
+{
+ struct sec_merge_hash_entry *A = *(struct sec_merge_hash_entry **) a;
+ struct sec_merge_hash_entry *B = *(struct sec_merge_hash_entry **) b;
+ unsigned int lenA = A->len;
+ unsigned int lenB = B->len;
+ const unsigned char *s = A->root.string + lenA - 1;
+ const unsigned char *t = B->root.string + lenB - 1;
+ int l = lenA < lenB ? lenA : lenB;
+
+ while (l)
+ {
+ if (*s != *t)
+ return (int) *s - (int) *t;
+ s--;
+ t--;
+ l--;
+ }
+ return lenA - lenB;
+}
+
+/* Like strrevcmp, but for the case where all strings have the same
+ alignment > entsize. */
+
+static int
+strrevcmp_align (const void *a, const void *b)
+{
+ struct sec_merge_hash_entry *A = *(struct sec_merge_hash_entry **) a;
+ struct sec_merge_hash_entry *B = *(struct sec_merge_hash_entry **) b;
+ unsigned int lenA = A->len;
+ unsigned int lenB = B->len;
+ const unsigned char *s = A->root.string + lenA - 1;
+ const unsigned char *t = B->root.string + lenB - 1;
+ int l = lenA < lenB ? lenA : lenB;
+ int tail_align = (lenA & (A->alignment - 1)) - (lenB & (A->alignment - 1));
+
+ if (tail_align != 0)
+ return tail_align;
+
+ while (l)
+ {
+ if (*s != *t)
+ return (int) *s - (int) *t;
+ s--;
+ t--;
+ l--;
+ }
+ return lenA - lenB;
+}
+
+static inline int
+is_suffix (const struct sec_merge_hash_entry *A,
+ const struct sec_merge_hash_entry *B)
+{
+ if (A->len <= B->len)
+ /* B cannot be a suffix of A unless A is equal to B, which is guaranteed
+ not to be equal by the hash table. */
+ return 0;
+
+ return memcmp (A->root.string + (A->len - B->len),
+ B->root.string, B->len) == 0;
}
/* This is a helper function for _bfd_merge_sections. It attempts to
merge strings matching suffixes of longer strings. */
static void
-merge_strings (sinfo)
- struct sec_merge_info *sinfo;
+merge_strings (struct sec_merge_info *sinfo)
{
- struct sec_merge_hash_entry **array, **a, **end, *e;
+ struct sec_merge_hash_entry **array, **a, *e;
struct sec_merge_sec_info *secinfo;
- htab_t lasttab = NULL, last4tab = NULL;
bfd_size_type size, amt;
+ unsigned int alignment = 0;
- /* Now sort the strings by length, longest first. */
- array = NULL;
+ /* Now sort the strings */
amt = sinfo->htab->size * sizeof (struct sec_merge_hash_entry *);
array = (struct sec_merge_hash_entry **) bfd_malloc (amt);
if (array == NULL)
@@ -636,90 +586,50 @@ merge_strings (sinfo)
for (e = sinfo->htab->first, a = array; e; e = e->next)
if (e->alignment)
- *a++ = e;
+ {
+ *a++ = e;
+ /* Adjust the length to not include the zero terminator. */
+ e->len -= sinfo->htab->entsize;
+ if (alignment != e->alignment)
+ {
+ if (alignment == 0)
+ alignment = e->alignment;
+ else
+ alignment = (unsigned) -1;
+ }
+ }
sinfo->htab->size = a - array;
-
- qsort (array, (size_t) sinfo->htab->size,
- sizeof (struct sec_merge_hash_entry *), cmplengthentry);
-
- last4tab = htab_create_alloc ((size_t) sinfo->htab->size * 4,
- NULL, last4_eq, NULL, calloc, free);
- lasttab = htab_create_alloc ((size_t) sinfo->htab->size * 4,
- NULL, last_eq, NULL, calloc, free);
- if (lasttab == NULL || last4tab == NULL)
- goto alloc_failure;
-
- /* Now insert the strings into hash tables (strings with last 4 characters
- and strings with last character equal), look for longer strings which
- we're suffix of. */
- for (a = array, end = array + sinfo->htab->size; a < end; a++)
+ if (sinfo->htab->size != 0)
{
- register hashval_t hash;
- unsigned int c;
- unsigned int i;
- const unsigned char *s;
- PTR *p;
-
- e = *a;
- e->u.entsize = sinfo->htab->entsize;
- if (e->len <= e->u.entsize)
- break;
- if (e->len > 4 * e->u.entsize)
+ qsort (array, (size_t) sinfo->htab->size,
+ sizeof (struct sec_merge_hash_entry *),
+ (alignment != (unsigned) -1 && alignment > sinfo->htab->entsize
+ ? strrevcmp_align : strrevcmp));
+
+ /* Loop over the sorted array and merge suffixes */
+ e = *--a;
+ e->len += sinfo->htab->entsize;
+ while (--a >= array)
{
- s = (const unsigned char *) (e->root.string + e->len - e->u.entsize);
- hash = 0;
- for (i = 0; i < 4 * e->u.entsize; i++)
- {
- c = *--s;
- hash += c + (c << 17);
- hash ^= hash >> 2;
- }
- p = htab_find_slot_with_hash (last4tab, e, hash, INSERT);
- if (p == NULL)
- goto alloc_failure;
- if (*p)
- {
- struct sec_merge_hash_entry *ent;
+ struct sec_merge_hash_entry *cmp = *a;
- ent = (struct sec_merge_hash_entry *) *p;
- e->u.suffix = ent;
- e->alignment = 0;
- continue;
+ cmp->len += sinfo->htab->entsize;
+ if (e->alignment >= cmp->alignment
+ && !((e->len - cmp->len) & (cmp->alignment - 1))
+ && is_suffix (e, cmp))
+ {
+ cmp->u.suffix = e;
+ cmp->alignment = 0;
}
else
- *p = (PTR) e;
+ e = cmp;
}
- s = (const unsigned char *) (e->root.string + e->len - e->u.entsize);
- hash = 0;
- for (i = 0; i < e->u.entsize; i++)
- {
- c = *--s;
- hash += c + (c << 17);
- hash ^= hash >> 2;
- }
- p = htab_find_slot_with_hash (lasttab, e, hash, INSERT);
- if (p == NULL)
- goto alloc_failure;
- if (*p)
- {
- struct sec_merge_hash_entry *ent;
-
- ent = (struct sec_merge_hash_entry *) *p;
- e->u.suffix = ent;
- e->alignment = 0;
- }
- else
- *p = (PTR) e;
}
alloc_failure:
if (array)
free (array);
- if (lasttab)
- htab_delete (lasttab);
- if (last4tab)
- htab_delete (last4tab);
/* Now assign positions to the strings we want to keep. */
size = 0;
@@ -765,11 +675,9 @@ alloc_failure:
/* This function is called once after all SEC_MERGE sections are registered
with _bfd_merge_section. */
-boolean
-_bfd_merge_sections (abfd, xsinfo, remove_hook)
- bfd *abfd ATTRIBUTE_UNUSED;
- PTR xsinfo;
- void (*remove_hook) PARAMS((bfd *, asection *));
+bfd_boolean
+_bfd_merge_sections (bfd *abfd ATTRIBUTE_UNUSED, void *xsinfo,
+ void (*remove_hook) (bfd *, asection *))
{
struct sec_merge_info *sinfo;
@@ -830,23 +738,23 @@ _bfd_merge_sections (abfd, xsinfo, remove_hook)
secinfo->sec->_cooked_size = size;
}
- /* Finally shrink all input sections which have not made it into
+ /* 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;
+ if (secinfo->first == NULL)
+ {
+ secinfo->sec->_cooked_size = 0;
+ secinfo->sec->flags |= SEC_EXCLUDE;
+ }
}
- return true;
+ return TRUE;
}
/* Write out the merged section. */
-boolean
-_bfd_write_merged_section (output_bfd, sec, psecinfo)
- bfd *output_bfd;
- asection *sec;
- PTR psecinfo;
+bfd_boolean
+_bfd_write_merged_section (bfd *output_bfd, asection *sec, void *psecinfo)
{
struct sec_merge_sec_info *secinfo;
file_ptr pos;
@@ -854,16 +762,16 @@ _bfd_write_merged_section (output_bfd, sec, psecinfo)
secinfo = (struct sec_merge_sec_info *) psecinfo;
if (!secinfo->first)
- return true;
+ return TRUE;
pos = sec->output_section->filepos + sec->output_offset;
if (bfd_seek (output_bfd, pos, SEEK_SET) != 0)
- return false;
+ return FALSE;
if (! sec_merge_emit (output_bfd, secinfo->first))
- return false;
+ return FALSE;
- return true;
+ return TRUE;
}
/* Adjust an address in the SEC_MERGE section. Given OFFSET within
@@ -871,11 +779,8 @@ _bfd_write_merged_section (output_bfd, sec, psecinfo)
section and writes the new section back into *PSEC. */
bfd_vma
-_bfd_merged_section_offset (output_bfd, psec, psecinfo, offset, addend)
- bfd *output_bfd ATTRIBUTE_UNUSED;
- asection **psec;
- PTR psecinfo;
- bfd_vma offset, addend;
+_bfd_merged_section_offset (bfd *output_bfd ATTRIBUTE_UNUSED, asection **psec,
+ void *psecinfo, bfd_vma offset, bfd_vma addend)
{
struct sec_merge_sec_info *secinfo;
struct sec_merge_hash_entry *entry;
@@ -928,7 +833,7 @@ _bfd_merged_section_offset (output_bfd, psec, psecinfo, offset, addend)
p = secinfo->contents
+ ((offset + addend) / sec->entsize) * sec->entsize;
}
- entry = sec_merge_hash_lookup (secinfo->htab, p, 0, false);
+ entry = sec_merge_hash_lookup (secinfo->htab, p, 0, FALSE);
if (!entry)
{
if (! secinfo->htab->strings)
diff --git a/contrib/binutils/bfd/netbsd-core.c b/contrib/binutils/bfd/netbsd-core.c
index 2787c46..84f2ad7 100644
--- a/contrib/binutils/bfd/netbsd-core.c
+++ b/contrib/binutils/bfd/netbsd-core.c
@@ -1,6 +1,6 @@
/* BFD back end for NetBSD style core files
Copyright 1988, 1989, 1991, 1992, 1993, 1996, 1998, 1999, 2000, 2001,
- 2002
+ 2002, 2003, 2004
Free Software Foundation, Inc.
Written by Paul Kranenburg, EUR
@@ -34,22 +34,29 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
* FIXME: On NetBSD/sparc CORE_FPU_OFFSET should be (sizeof (struct trapframe))
*/
+/* Offset of StackGhost cookie within `struct md_coredump' on
+ OpenBSD/sparc. */
+#define CORE_WCOOKIE_OFFSET 344
+
struct netbsd_core_struct {
struct core core;
} *rawptr;
/* forward declarations */
-static const bfd_target *netbsd_core_file_p PARAMS ((bfd *abfd));
-static char *netbsd_core_file_failing_command PARAMS ((bfd *abfd));
-static int netbsd_core_file_failing_signal PARAMS ((bfd *abfd));
-static boolean netbsd_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));
+static void swap_abort
+ PARAMS ((void));
/* Handle NetBSD-style core dump file. */
-/* ARGSUSED */
static const bfd_target *
netbsd_core_file_p (abfd)
bfd *abfd;
@@ -136,6 +143,25 @@ netbsd_core_file_p (abfd)
asect->filepos = offset;
asect->alignment_power = 2;
+ if (CORE_GETMID (core) == M_SPARC_NETBSD
+ && CORE_GETFLAG (coreseg) == CORE_CPU
+ && coreseg.c_size > CORE_WCOOKIE_OFFSET)
+ {
+ /* Truncate the .reg section. */
+ asect->_raw_size = CORE_WCOOKIE_OFFSET;
+
+ /* And create the .wcookie section. */
+ asect = bfd_make_section_anyway (abfd, ".wcookie");
+ if (asect == NULL)
+ goto punt;
+
+ asect->flags = SEC_ALLOC + SEC_HAS_CONTENTS;
+ asect->_raw_size = 4;
+ asect->vma = 0;
+ asect->filepos = offset + CORE_WCOOKIE_OFFSET;
+ asect->alignment_power = 2;
+ }
+
offset += coreseg.c_size;
#ifdef CORE_FPU_OFFSET
@@ -175,7 +201,6 @@ netbsd_core_file_failing_command (abfd)
return abfd->tdata.netbsd_core_data->core.c_name;
}
-/* ARGSUSED */
static int
netbsd_core_file_failing_signal (abfd)
bfd *abfd;
@@ -184,13 +209,12 @@ netbsd_core_file_failing_signal (abfd)
return abfd->tdata.netbsd_core_data->core.c_signo;
}
-/* ARGSUSED */
-static boolean
+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 */
+ return TRUE; /* FIXME, We have no way of telling at this point */
}
/* If somebody calls any byte-swapping routines, shoot them. */
@@ -199,10 +223,13 @@ swap_abort ()
{
abort (); /* This way doesn't require any declaration for ANSI to fuck up */
}
-#define NO_GET ((bfd_vma (*) PARAMS (( const bfd_byte *))) swap_abort )
-#define NO_PUT ((void (*) PARAMS ((bfd_vma, bfd_byte *))) swap_abort )
-#define NO_SIGNED_GET \
- ((bfd_signed_vma (*) PARAMS ((const bfd_byte *))) swap_abort )
+
+#define NO_GET ((bfd_vma (*) (const void *)) swap_abort)
+#define NO_PUT ((void (*) (bfd_vma, void *)) swap_abort)
+#define NO_GETS ((bfd_signed_vma (*) (const void *)) swap_abort)
+#define NO_GET64 ((bfd_uint64_t (*) (const void *)) swap_abort)
+#define NO_PUT64 ((void (*) (bfd_uint64_t, void *)) swap_abort)
+#define NO_GETS64 ((bfd_int64_t (*) (const void *)) swap_abort)
const bfd_target netbsd_core_vec =
{
@@ -217,39 +244,39 @@ const bfd_target netbsd_core_vec =
0, /* symbol prefix */
' ', /* ar_pad_char */
16, /* ar_max_namelen */
- NO_GET, NO_SIGNED_GET, NO_PUT, /* 64 bit data */
- NO_GET, NO_SIGNED_GET, NO_PUT, /* 32 bit data */
- NO_GET, NO_SIGNED_GET, NO_PUT, /* 16 bit data */
- NO_GET, NO_SIGNED_GET, NO_PUT, /* 64 bit hdrs */
- NO_GET, NO_SIGNED_GET, NO_PUT, /* 32 bit hdrs */
- NO_GET, NO_SIGNED_GET, NO_PUT, /* 16 bit hdrs */
+ NO_GET64, NO_GETS64, NO_PUT64, /* 64 bit data. */
+ NO_GET, NO_GETS, NO_PUT, /* 32 bit data. */
+ NO_GET, NO_GETS, NO_PUT, /* 16 bit data. */
+ NO_GET64, NO_GETS64, NO_PUT64, /* 64 bit hdrs. */
+ NO_GET, NO_GETS, NO_PUT, /* 32 bit hdrs. */
+ NO_GET, NO_GETS, NO_PUT, /* 16 bit hdrs. */
{ /* bfd_check_format */
- _bfd_dummy_target, /* unknown format */
- _bfd_dummy_target, /* object file */
- _bfd_dummy_target, /* archive */
- netbsd_core_file_p /* a core file */
+ _bfd_dummy_target, /* unknown format */
+ _bfd_dummy_target, /* object file */
+ _bfd_dummy_target, /* archive */
+ netbsd_core_file_p /* a core file */
},
{ /* bfd_set_format */
- bfd_false, bfd_false,
- bfd_false, bfd_false
+ bfd_false, bfd_false,
+ bfd_false, bfd_false
},
{ /* bfd_write_contents */
- bfd_false, bfd_false,
- bfd_false, bfd_false
+ bfd_false, bfd_false,
+ bfd_false, bfd_false
},
- BFD_JUMP_TABLE_GENERIC (_bfd_generic),
- BFD_JUMP_TABLE_COPY (_bfd_generic),
- BFD_JUMP_TABLE_CORE (netbsd),
- BFD_JUMP_TABLE_ARCHIVE (_bfd_noarchive),
- BFD_JUMP_TABLE_SYMBOLS (_bfd_nosymbols),
- BFD_JUMP_TABLE_RELOCS (_bfd_norelocs),
- BFD_JUMP_TABLE_WRITE (_bfd_generic),
- BFD_JUMP_TABLE_LINK (_bfd_nolink),
- BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
+ BFD_JUMP_TABLE_GENERIC (_bfd_generic),
+ BFD_JUMP_TABLE_COPY (_bfd_generic),
+ BFD_JUMP_TABLE_CORE (netbsd),
+ BFD_JUMP_TABLE_ARCHIVE (_bfd_noarchive),
+ BFD_JUMP_TABLE_SYMBOLS (_bfd_nosymbols),
+ BFD_JUMP_TABLE_RELOCS (_bfd_norelocs),
+ BFD_JUMP_TABLE_WRITE (_bfd_generic),
+ BFD_JUMP_TABLE_LINK (_bfd_nolink),
+ BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
NULL,
(PTR) 0 /* backend_data */
-};
+ };
diff --git a/contrib/binutils/bfd/netbsd.h b/contrib/binutils/bfd/netbsd.h
index 0558032..04a4eab 100644
--- a/contrib/binutils/bfd/netbsd.h
+++ b/contrib/binutils/bfd/netbsd.h
@@ -1,5 +1,5 @@
/* BFD back-end definitions used by all NetBSD targets.
- Copyright 1990, 1991, 1992, 1994, 1995, 1996, 1997, 1998, 2000
+ Copyright 1990, 1991, 1992, 1994, 1995, 1996, 1997, 1998, 2000, 2002
Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@@ -64,7 +64,7 @@ USA. */
#define MY_entry_is_text_address 1
#define MY_write_object_contents MY(write_object_contents)
-static boolean MY(write_object_contents) PARAMS ((bfd *abfd));
+static bfd_boolean MY(write_object_contents) PARAMS ((bfd *abfd));
#define MY_text_includes_header 1
#include "aout-target.h"
@@ -73,7 +73,7 @@ static boolean MY(write_object_contents) PARAMS ((bfd *abfd));
Section contents have already been written. We write the
file header, symbols, and relocation. */
-static boolean
+static bfd_boolean
MY(write_object_contents) (abfd)
bfd *abfd;
{
@@ -114,5 +114,5 @@ MY(write_object_contents) (abfd)
WRITE_HEADERS(abfd, execp);
- return true;
+ return TRUE;
}
diff --git a/contrib/binutils/bfd/opncls.c b/contrib/binutils/bfd/opncls.c
index cdf08df..6abd405 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
+ 2001, 2002, 2003
Free Software Foundation, Inc.
Written by Cygnus Support.
@@ -25,6 +25,7 @@
#include "sysdep.h"
#include "objalloc.h"
#include "libbfd.h"
+#include "libiberty.h"
#ifndef S_IXUSR
#define S_IXUSR 0100 /* Execute by owner. */
@@ -36,21 +37,27 @@
#define S_IXOTH 0001 /* Execute by others. */
#endif
+/* Counter used to initialize the bfd identifier. */
+
+static unsigned int _bfd_id_counter = 0;
+
/* fdopen is a loser -- we should use stdio exclusively. Unfortunately
if we do that we can't use fcntl. */
/* Return a new BFD. All BFD's are allocated through this routine. */
bfd *
-_bfd_new_bfd ()
+_bfd_new_bfd (void)
{
bfd *nbfd;
- nbfd = (bfd *) bfd_zmalloc ((bfd_size_type) sizeof (bfd));
+ nbfd = bfd_zmalloc (sizeof (bfd));
if (nbfd == NULL)
return NULL;
- nbfd->memory = (PTR) objalloc_create ();
+ nbfd->id = _bfd_id_counter++;
+
+ nbfd->memory = objalloc_create ();
if (nbfd->memory == NULL)
{
bfd_set_error (bfd_error_no_memory);
@@ -63,23 +70,24 @@ _bfd_new_bfd ()
nbfd->direction = no_direction;
nbfd->iostream = NULL;
nbfd->where = 0;
- if (!bfd_hash_table_init (&nbfd->section_htab, bfd_section_hash_newfunc))
+ if (!bfd_hash_table_init_n (& nbfd->section_htab, bfd_section_hash_newfunc,
+ 251))
{
free (nbfd);
return NULL;
}
- nbfd->sections = (asection *) NULL;
+ nbfd->sections = NULL;
nbfd->section_tail = &nbfd->sections;
nbfd->format = bfd_unknown;
- nbfd->my_archive = (bfd *) NULL;
+ nbfd->my_archive = NULL;
nbfd->origin = 0;
- nbfd->opened_once = false;
- nbfd->output_has_begun = false;
+ nbfd->opened_once = FALSE;
+ nbfd->output_has_begun = FALSE;
nbfd->section_count = 0;
- nbfd->usrdata = (PTR) NULL;
- nbfd->cacheable = false;
+ nbfd->usrdata = NULL;
+ nbfd->cacheable = FALSE;
nbfd->flags = BFD_NO_FLAGS;
- nbfd->mtime_set = false;
+ nbfd->mtime_set = FALSE;
return nbfd;
}
@@ -87,8 +95,7 @@ _bfd_new_bfd ()
/* Allocate a new BFD as a member of archive OBFD. */
bfd *
-_bfd_new_bfd_contained_in (obfd)
- bfd *obfd;
+_bfd_new_bfd_contained_in (bfd *obfd)
{
bfd *nbfd;
@@ -105,8 +112,7 @@ _bfd_new_bfd_contained_in (obfd)
/* Delete a BFD. */
void
-_bfd_delete_bfd (abfd)
- bfd *abfd;
+_bfd_delete_bfd (bfd *abfd)
{
bfd_hash_table_free (&abfd->section_htab);
objalloc_free ((struct objalloc *) abfd->memory);
@@ -124,7 +130,7 @@ FUNCTION
bfd_openr
SYNOPSIS
- bfd *bfd_openr(const char *filename, const char *target);
+ bfd *bfd_openr (const char *filename, const char *target);
DESCRIPTION
Open the file @var{filename} (using <<fopen>>) with the target
@@ -134,13 +140,12 @@ DESCRIPTION
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.
+ are <<bfd_error_no_memory>>, <<bfd_error_invalid_target>> or
+ <<system_call>> error.
*/
bfd *
-bfd_openr (filename, target)
- const char *filename;
- const char *target;
+bfd_openr (const char *filename, const char *target)
{
bfd *nbfd;
const bfd_target *target_vec;
@@ -179,35 +184,32 @@ bfd_openr (filename, target)
the file descriptor too, even though we didn't open it. */
/*
FUNCTION
- bfd_fdopenr
+ bfd_fdopenr
SYNOPSIS
- bfd *bfd_fdopenr(const char *filename, const char *target, int fd);
+ bfd *bfd_fdopenr (const char *filename, const char *target, int fd);
DESCRIPTION
- <<bfd_fdopenr>> is to <<bfd_fopenr>> much like <<fdopen>> is to <<fopen>>.
- It opens a BFD on a file already described by the @var{fd}
- supplied.
-
- When the file is later <<bfd_close>>d, the file descriptor will be closed.
-
- If the caller desires that this file descriptor be cached by BFD
- (opened as needed, closed as needed to free descriptors for
- other opens), with the supplied @var{fd} used as an initial
- file descriptor (but subject to closure at any time), call
- bfd_set_cacheable(bfd, 1) on the returned BFD. The default is to
- assume no cacheing; the file descriptor will remain open until
- <<bfd_close>>, and will not be affected by BFD operations on other
- files.
-
- Possible errors are <<bfd_error_no_memory>>, <<bfd_error_invalid_target>> and <<bfd_error_system_call>>.
+ <<bfd_fdopenr>> is to <<bfd_fopenr>> much like <<fdopen>> is to
+ <<fopen>>. It opens a BFD on a file already described by the
+ @var{fd} supplied.
+
+ When the file is later <<bfd_close>>d, the file descriptor will
+ be closed. If the caller desires that this file descriptor be
+ cached by BFD (opened as needed, closed as needed to free
+ descriptors for other opens), with the supplied @var{fd} used as
+ an initial file descriptor (but subject to closure at any time),
+ call bfd_set_cacheable(bfd, 1) on the returned BFD. The default
+ is to assume no caching; the file descriptor will remain open
+ until <<bfd_close>>, and will not be affected by BFD operations
+ on other files.
+
+ Possible errors are <<bfd_error_no_memory>>,
+ <<bfd_error_invalid_target>> and <<bfd_error_system_call>>.
*/
bfd *
-bfd_fdopenr (filename, target, fd)
- const char *filename;
- const char *target;
- int fd;
+bfd_fdopenr (const char *filename, const char *target, int fd)
{
bfd *nbfd;
const bfd_target *target_vec;
@@ -234,14 +236,14 @@ bfd_fdopenr (filename, target, fd)
}
#ifndef HAVE_FDOPEN
- nbfd->iostream = (PTR) fopen (filename, FOPEN_RB);
+ 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 = (PTR) fdopen (fd, FOPEN_RB); break;
- case O_WRONLY: nbfd->iostream = (PTR) fdopen (fd, FOPEN_RUB); break;
- case O_RDWR: nbfd->iostream = (PTR) fdopen (fd, FOPEN_RUB); break;
+ case O_RDONLY: nbfd->iostream = fdopen (fd, FOPEN_RB); break;
+ case O_WRONLY: nbfd->iostream = fdopen (fd, FOPEN_RUB); break;
+ case O_RDWR: nbfd->iostream = fdopen (fd, FOPEN_RUB); break;
default: abort ();
}
#endif
@@ -272,7 +274,7 @@ bfd_fdopenr (filename, target, fd)
_bfd_delete_bfd (nbfd);
return NULL;
}
- nbfd->opened_once = true;
+ nbfd->opened_once = TRUE;
return nbfd;
}
@@ -282,7 +284,7 @@ FUNCTION
bfd_openstreamr
SYNOPSIS
- bfd *bfd_openstreamr(const char *, const char *, PTR);
+ bfd *bfd_openstreamr (const char *, const char *, void *);
DESCRIPTION
@@ -291,12 +293,9 @@ DESCRIPTION
*/
bfd *
-bfd_openstreamr (filename, target, streamarg)
- const char *filename;
- const char *target;
- PTR streamarg;
+bfd_openstreamr (const char *filename, const char *target, void *streamarg)
{
- FILE *stream = (FILE *) streamarg;
+ FILE *stream = streamarg;
bfd *nbfd;
const bfd_target *target_vec;
@@ -311,7 +310,7 @@ bfd_openstreamr (filename, target, streamarg)
return NULL;
}
- nbfd->iostream = (PTR) stream;
+ nbfd->iostream = stream;
nbfd->filename = filename;
nbfd->direction = read_direction;
@@ -334,7 +333,7 @@ FUNCTION
bfd_openw
SYNOPSIS
- bfd *bfd_openw(const char *filename, const char *target);
+ bfd *bfd_openw (const char *filename, const char *target);
DESCRIPTION
Create a BFD, associated with file @var{filename}, using the
@@ -345,9 +344,7 @@ DESCRIPTION
*/
bfd *
-bfd_openw (filename, target)
- const char *filename;
- const char *target;
+bfd_openw (const char *filename, const char *target)
{
bfd *nbfd;
const bfd_target *target_vec;
@@ -385,14 +382,14 @@ FUNCTION
bfd_close
SYNOPSIS
- boolean bfd_close(bfd *abfd);
+ bfd_boolean bfd_close (bfd *abfd);
DESCRIPTION
- Close a BFD. If the BFD was open for writing,
- then pending operations are completed and the file written out
- and closed. If the created file is executable, then
- <<chmod>> is called to mark it as such.
+ Close a BFD. If the BFD was open for writing, then pending
+ operations are completed and the file written out and closed.
+ If the created file is executable, then <<chmod>> is called
+ to mark it as such.
All memory attached to the BFD is released.
@@ -400,24 +397,23 @@ DESCRIPTION
if it was passed in to BFD by <<bfd_fdopenr>>).
RETURNS
- <<true>> is returned if all is ok, otherwise <<false>>.
+ <<TRUE>> is returned if all is ok, otherwise <<FALSE>>.
*/
-boolean
-bfd_close (abfd)
- bfd *abfd;
+bfd_boolean
+bfd_close (bfd *abfd)
{
- boolean ret;
+ bfd_boolean ret;
if (bfd_write_p (abfd))
{
if (! BFD_SEND_FMT (abfd, _bfd_write_contents, (abfd)))
- return false;
+ return FALSE;
}
if (! BFD_SEND (abfd, _close_and_cleanup, (abfd)))
- return false;
+ return FALSE;
ret = bfd_cache_close (abfd);
@@ -431,7 +427,7 @@ bfd_close (abfd)
if (stat (abfd->filename, &buf) == 0)
{
- unsigned int mask = umask (0);
+ unsigned int mask = umask (0);
umask (mask);
chmod (abfd->filename,
@@ -450,13 +446,13 @@ FUNCTION
bfd_close_all_done
SYNOPSIS
- boolean bfd_close_all_done(bfd *);
+ bfd_boolean bfd_close_all_done (bfd *);
DESCRIPTION
- Close a BFD. Differs from <<bfd_close>>
- since it does not complete any pending operations. This
- routine would be used if the application had just used BFD for
- swapping and didn't want to use any of the writing code.
+ Close a BFD. Differs from <<bfd_close>> since it does not
+ complete any pending operations. This routine would be used
+ if the application had just used BFD for swapping and didn't
+ want to use any of the writing code.
If the created file is executable, then <<chmod>> is called
to mark it as such.
@@ -464,14 +460,13 @@ DESCRIPTION
All memory attached to the BFD is released.
RETURNS
- <<true>> is returned if all is ok, otherwise <<false>>.
+ <<TRUE>> is returned if all is ok, otherwise <<FALSE>>.
*/
-boolean
-bfd_close_all_done (abfd)
- bfd *abfd;
+bfd_boolean
+bfd_close_all_done (bfd *abfd)
{
- boolean ret;
+ bfd_boolean ret;
ret = bfd_cache_close (abfd);
@@ -504,19 +499,16 @@ FUNCTION
bfd_create
SYNOPSIS
- bfd *bfd_create(const char *filename, bfd *templ);
+ bfd *bfd_create (const char *filename, bfd *templ);
DESCRIPTION
- Create a new BFD in the manner of
- <<bfd_openw>>, but without opening a file. The new BFD
- takes the target from the target used by @var{template}. The
- format is always set to <<bfd_object>>.
+ Create a new BFD in the manner of <<bfd_openw>>, but without
+ opening a file. The new BFD takes the target from the target
+ used by @var{template}. The format is always set to <<bfd_object>>.
*/
bfd *
-bfd_create (filename, templ)
- const char *filename;
- bfd *templ;
+bfd_create (const char *filename, bfd *templ)
{
bfd *nbfd;
@@ -537,7 +529,7 @@ FUNCTION
bfd_make_writable
SYNOPSIS
- boolean bfd_make_writable(bfd *abfd);
+ bfd_boolean bfd_make_writable (bfd *abfd);
DESCRIPTION
Takes a BFD as created by <<bfd_create>> and converts it
@@ -546,24 +538,22 @@ DESCRIPTION
you will call <<bfd_make_readable>> on this bfd later.
RETURNS
- <<true>> is returned if all is ok, otherwise <<false>>.
+ <<TRUE>> is returned if all is ok, otherwise <<FALSE>>.
*/
-boolean
-bfd_make_writable(abfd)
- bfd *abfd;
+bfd_boolean
+bfd_make_writable (bfd *abfd)
{
struct bfd_in_memory *bim;
if (abfd->direction != no_direction)
{
bfd_set_error (bfd_error_invalid_operation);
- return false;
+ return FALSE;
}
- bim = ((struct bfd_in_memory *)
- bfd_malloc ((bfd_size_type) sizeof (struct bfd_in_memory)));
- abfd->iostream = (PTR) bim;
+ bim = bfd_malloc (sizeof (struct bfd_in_memory));
+ abfd->iostream = bim;
/* bfd_bwrite will grow these as needed. */
bim->size = 0;
bim->buffer = 0;
@@ -572,7 +562,7 @@ bfd_make_writable(abfd)
abfd->direction = write_direction;
abfd->where = 0;
- return true;
+ return TRUE;
}
/*
@@ -580,7 +570,7 @@ FUNCTION
bfd_make_readable
SYNOPSIS
- boolean bfd_make_readable(bfd *abfd);
+ bfd_boolean bfd_make_readable (bfd *abfd);
DESCRIPTION
Takes a BFD as created by <<bfd_create>> and
@@ -590,40 +580,39 @@ DESCRIPTION
direction.
RETURNS
- <<true>> is returned if all is ok, otherwise <<false>>. */
+ <<TRUE>> is returned if all is ok, otherwise <<FALSE>>. */
-boolean
-bfd_make_readable(abfd)
- bfd *abfd;
+bfd_boolean
+bfd_make_readable (bfd *abfd)
{
if (abfd->direction != write_direction || !(abfd->flags & BFD_IN_MEMORY))
{
bfd_set_error (bfd_error_invalid_operation);
- return false;
+ return FALSE;
}
if (! BFD_SEND_FMT (abfd, _bfd_write_contents, (abfd)))
- return false;
+ return FALSE;
if (! BFD_SEND (abfd, _close_and_cleanup, (abfd)))
- return false;
+ return FALSE;
abfd->arch_info = &bfd_default_arch_struct;
abfd->where = 0;
abfd->format = bfd_unknown;
- abfd->my_archive = (bfd *) NULL;
+ abfd->my_archive = NULL;
abfd->origin = 0;
- abfd->opened_once = false;
- abfd->output_has_begun = false;
+ abfd->opened_once = FALSE;
+ abfd->output_has_begun = FALSE;
abfd->section_count = 0;
- abfd->usrdata = (PTR) NULL;
- abfd->cacheable = false;
+ abfd->usrdata = NULL;
+ abfd->cacheable = FALSE;
abfd->flags = BFD_IN_MEMORY;
- abfd->mtime_set = false;
+ abfd->mtime_set = FALSE;
- abfd->target_defaulted = true;
+ abfd->target_defaulted = TRUE;
abfd->direction = read_direction;
abfd->sections = 0;
abfd->symcount = 0;
@@ -633,7 +622,7 @@ bfd_make_readable(abfd)
bfd_section_list_clear (abfd);
bfd_check_format (abfd, bfd_object);
- return true;
+ return TRUE;
}
/*
@@ -641,7 +630,7 @@ INTERNAL_FUNCTION
bfd_alloc
SYNOPSIS
- PTR bfd_alloc (bfd *abfd, size_t wanted);
+ void *bfd_alloc (bfd *abfd, size_t wanted);
DESCRIPTION
Allocate a block of @var{wanted} bytes of memory attached to
@@ -649,12 +638,10 @@ DESCRIPTION
*/
-PTR
-bfd_alloc (abfd, size)
- bfd *abfd;
- bfd_size_type size;
+void *
+bfd_alloc (bfd *abfd, bfd_size_type size)
{
- PTR ret;
+ void *ret;
if (size != (unsigned long) size)
{
@@ -668,12 +655,10 @@ bfd_alloc (abfd, size)
return ret;
}
-PTR
-bfd_zalloc (abfd, size)
- bfd *abfd;
- bfd_size_type size;
+void *
+bfd_zalloc (bfd *abfd, bfd_size_type size)
{
- PTR res;
+ void *res;
res = bfd_alloc (abfd, size);
if (res)
@@ -685,9 +670,506 @@ bfd_zalloc (abfd, size)
Note: Also frees all more recently allocated blocks! */
void
-bfd_release (abfd, block)
- bfd *abfd;
- PTR block;
+bfd_release (bfd *abfd, void *block)
{
objalloc_free_block ((struct objalloc *) abfd->memory, block);
}
+
+
+/*
+ GNU Extension: separate debug-info files
+
+ The idea here is that a special section called .gnu_debuglink might be
+ embedded in a binary file, which indicates that some *other* file
+ contains the real debugging information. This special section contains a
+ filename and CRC32 checksum, which we read and resolve to another file,
+ if it exists.
+
+ This facilitates "optional" provision of debugging information, without
+ having to provide two complete copies of every binary object (with and
+ without debug symbols).
+*/
+
+#define GNU_DEBUGLINK ".gnu_debuglink"
+/*
+FUNCTION
+ bfd_calc_gnu_debuglink_crc32
+
+SYNOPSIS
+ unsigned long bfd_calc_gnu_debuglink_crc32
+ (unsigned long crc, const unsigned char *buf, bfd_size_type len);
+
+DESCRIPTION
+ Computes a CRC value as used in the .gnu_debuglink section.
+ Advances the previously computed @var{crc} value by computing
+ and adding in the crc32 for @var{len} bytes of @var{buf}.
+
+RETURNS
+ Return the updated CRC32 value.
+*/
+
+unsigned long
+bfd_calc_gnu_debuglink_crc32 (unsigned long crc,
+ const unsigned char *buf,
+ bfd_size_type len)
+{
+ static const unsigned long crc32_table[256] =
+ {
+ 0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419,
+ 0x706af48f, 0xe963a535, 0x9e6495a3, 0x0edb8832, 0x79dcb8a4,
+ 0xe0d5e91e, 0x97d2d988, 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07,
+ 0x90bf1d91, 0x1db71064, 0x6ab020f2, 0xf3b97148, 0x84be41de,
+ 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7, 0x136c9856,
+ 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, 0x14015c4f, 0x63066cd9,
+ 0xfa0f3d63, 0x8d080df5, 0x3b6e20c8, 0x4c69105e, 0xd56041e4,
+ 0xa2677172, 0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b,
+ 0x35b5a8fa, 0x42b2986c, 0xdbbbc9d6, 0xacbcf940, 0x32d86ce3,
+ 0x45df5c75, 0xdcd60dcf, 0xabd13d59, 0x26d930ac, 0x51de003a,
+ 0xc8d75180, 0xbfd06116, 0x21b4f4b5, 0x56b3c423, 0xcfba9599,
+ 0xb8bda50f, 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924,
+ 0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d, 0x76dc4190,
+ 0x01db7106, 0x98d220bc, 0xefd5102a, 0x71b18589, 0x06b6b51f,
+ 0x9fbfe4a5, 0xe8b8d433, 0x7807c9a2, 0x0f00f934, 0x9609a88e,
+ 0xe10e9818, 0x7f6a0dbb, 0x086d3d2d, 0x91646c97, 0xe6635c01,
+ 0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e, 0x6c0695ed,
+ 0x1b01a57b, 0x8208f4c1, 0xf50fc457, 0x65b0d9c6, 0x12b7e950,
+ 0x8bbeb8ea, 0xfcb9887c, 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3,
+ 0xfbd44c65, 0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2,
+ 0x4adfa541, 0x3dd895d7, 0xa4d1c46d, 0xd3d6f4fb, 0x4369e96a,
+ 0x346ed9fc, 0xad678846, 0xda60b8d0, 0x44042d73, 0x33031de5,
+ 0xaa0a4c5f, 0xdd0d7cc9, 0x5005713c, 0x270241aa, 0xbe0b1010,
+ 0xc90c2086, 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f,
+ 0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, 0x59b33d17,
+ 0x2eb40d81, 0xb7bd5c3b, 0xc0ba6cad, 0xedb88320, 0x9abfb3b6,
+ 0x03b6e20c, 0x74b1d29a, 0xead54739, 0x9dd277af, 0x04db2615,
+ 0x73dc1683, 0xe3630b12, 0x94643b84, 0x0d6d6a3e, 0x7a6a5aa8,
+ 0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1, 0xf00f9344,
+ 0x8708a3d2, 0x1e01f268, 0x6906c2fe, 0xf762575d, 0x806567cb,
+ 0x196c3671, 0x6e6b06e7, 0xfed41b76, 0x89d32be0, 0x10da7a5a,
+ 0x67dd4acc, 0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5,
+ 0xd6d6a3e8, 0xa1d1937e, 0x38d8c2c4, 0x4fdff252, 0xd1bb67f1,
+ 0xa6bc5767, 0x3fb506dd, 0x48b2364b, 0xd80d2bda, 0xaf0a1b4c,
+ 0x36034af6, 0x41047a60, 0xdf60efc3, 0xa867df55, 0x316e8eef,
+ 0x4669be79, 0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236,
+ 0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f, 0xc5ba3bbe,
+ 0xb2bd0b28, 0x2bb45a92, 0x5cb36a04, 0xc2d7ffa7, 0xb5d0cf31,
+ 0x2cd99e8b, 0x5bdeae1d, 0x9b64c2b0, 0xec63f226, 0x756aa39c,
+ 0x026d930a, 0x9c0906a9, 0xeb0e363f, 0x72076785, 0x05005713,
+ 0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38, 0x92d28e9b,
+ 0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21, 0x86d3d2d4, 0xf1d4e242,
+ 0x68ddb3f8, 0x1fda836e, 0x81be16cd, 0xf6b9265b, 0x6fb077e1,
+ 0x18b74777, 0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c,
+ 0x8f659eff, 0xf862ae69, 0x616bffd3, 0x166ccf45, 0xa00ae278,
+ 0xd70dd2ee, 0x4e048354, 0x3903b3c2, 0xa7672661, 0xd06016f7,
+ 0x4969474d, 0x3e6e77db, 0xaed16a4a, 0xd9d65adc, 0x40df0b66,
+ 0x37d83bf0, 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9,
+ 0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, 0xbad03605,
+ 0xcdd70693, 0x54de5729, 0x23d967bf, 0xb3667a2e, 0xc4614ab8,
+ 0x5d681b02, 0x2a6f2b94, 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b,
+ 0x2d02ef8d
+ };
+ const unsigned char *end;
+
+ crc = ~crc & 0xffffffff;
+ for (end = buf + len; buf < end; ++ buf)
+ crc = crc32_table[(crc ^ *buf) & 0xff] ^ (crc >> 8);
+ return ~crc & 0xffffffff;;
+}
+
+
+/*
+INTERNAL_FUNCTION
+ get_debug_link_info
+
+SYNOPSIS
+ char *get_debug_link_info (bfd *abfd, unsigned long *crc32_out);
+
+DESCRIPTION
+ fetch the filename and CRC32 value for any separate debuginfo
+ associated with @var{abfd}. Return NULL if no such info found,
+ otherwise return filename and update @var{crc32_out}.
+*/
+
+static char *
+get_debug_link_info (bfd *abfd, unsigned long *crc32_out)
+{
+ asection * sect;
+ bfd_size_type debuglink_size;
+ unsigned long crc32;
+ char * contents;
+ int crc_offset;
+ bfd_boolean ret;
+
+ BFD_ASSERT (abfd);
+ BFD_ASSERT (crc32_out);
+
+ sect = bfd_get_section_by_name (abfd, GNU_DEBUGLINK);
+
+ if (sect == NULL)
+ return NULL;
+
+ debuglink_size = bfd_section_size (abfd, sect);
+
+ contents = malloc (debuglink_size);
+ if (contents == NULL)
+ return NULL;
+
+ ret = bfd_get_section_contents (abfd, sect, contents, 0, debuglink_size);
+ if (! ret)
+ {
+ free (contents);
+ return NULL;
+ }
+
+ /* Crc value is stored after the filename, aligned up to 4 bytes. */
+ crc_offset = strlen (contents) + 1;
+ crc_offset = (crc_offset + 3) & ~3;
+
+ crc32 = bfd_get_32 (abfd, contents + crc_offset);
+
+ *crc32_out = crc32;
+ return contents;
+}
+
+/*
+INTERNAL_FUNCTION
+ separate_debug_file_exists
+
+SYNOPSIS
+ bfd_boolean separate_debug_file_exists
+ (char *name, unsigned long crc32);
+
+DESCRIPTION
+ Checks to see if @var{name} is a file and if its contents
+ match @var{crc32}.
+*/
+
+static bfd_boolean
+separate_debug_file_exists (const char *name, const unsigned long crc)
+{
+ static char buffer [8 * 1024];
+ unsigned long file_crc = 0;
+ int fd;
+ bfd_size_type count;
+
+ BFD_ASSERT (name);
+
+ fd = open (name, O_RDONLY);
+ if (fd < 0)
+ return FALSE;
+
+ while ((count = read (fd, buffer, sizeof (buffer))) > 0)
+ file_crc = bfd_calc_gnu_debuglink_crc32 (file_crc, buffer, count);
+
+ close (fd);
+
+ return crc == file_crc;
+}
+
+
+/*
+INTERNAL_FUNCTION
+ find_separate_debug_file
+
+SYNOPSIS
+ char *find_separate_debug_file (bfd *abfd);
+
+DESCRIPTION
+ Searches @var{abfd} for a reference to separate debugging
+ information, scans various locations in the filesystem, including
+ the file tree rooted at @var{debug_file_directory}, and returns a
+ filename of such debugging information if the file is found and has
+ matching CRC32. Returns NULL if no reference to debugging file
+ exists, or file cannot be found.
+*/
+
+static char *
+find_separate_debug_file (bfd *abfd, const char *debug_file_directory)
+{
+ char *basename;
+ char *dir;
+ char *debugfile;
+ unsigned long crc32;
+ int i;
+
+ BFD_ASSERT (abfd);
+ if (debug_file_directory == NULL)
+ debug_file_directory = ".";
+
+ /* BFD may have been opened from a stream. */
+ if (! abfd->filename)
+ return NULL;
+
+ basename = get_debug_link_info (abfd, & crc32);
+ if (basename == NULL)
+ return NULL;
+
+ if (strlen (basename) < 1)
+ {
+ free (basename);
+ return NULL;
+ }
+
+ dir = strdup (abfd->filename);
+ if (dir == NULL)
+ {
+ free (basename);
+ return NULL;
+ }
+ BFD_ASSERT (strlen (dir) != 0);
+
+ /* Strip off filename part. */
+ for (i = strlen (dir) - 1; i >= 0; i--)
+ if (IS_DIR_SEPARATOR (dir[i]))
+ break;
+
+ dir[i + 1] = '\0';
+ BFD_ASSERT (dir[i] == '/' || dir[0] == '\0')
+
+ debugfile = malloc (strlen (debug_file_directory) + 1
+ + strlen (dir)
+ + strlen (".debug/")
+ + strlen (basename)
+ + 1);
+ if (debugfile == NULL)
+ {
+ free (basename);
+ free (dir);
+ return NULL;
+ }
+
+ /* First try in the same directory as the original file: */
+ strcpy (debugfile, dir);
+ strcat (debugfile, basename);
+
+ if (separate_debug_file_exists (debugfile, crc32))
+ {
+ free (basename);
+ free (dir);
+ return debugfile;
+ }
+
+ /* Then try in a subdirectory called .debug. */
+ strcpy (debugfile, dir);
+ strcat (debugfile, ".debug/");
+ strcat (debugfile, basename);
+
+ if (separate_debug_file_exists (debugfile, crc32))
+ {
+ free (basename);
+ free (dir);
+ return debugfile;
+ }
+
+ /* Then try in the global debugfile directory. */
+ strcpy (debugfile, debug_file_directory);
+ i = strlen (debug_file_directory) - 1;
+ if (i > 0
+ && debug_file_directory[i] != '/'
+ && dir[0] != '/')
+ strcat (debugfile, "/");
+ strcat (debugfile, dir);
+ strcat (debugfile, basename);
+
+ if (separate_debug_file_exists (debugfile, crc32))
+ {
+ free (basename);
+ free (dir);
+ return debugfile;
+ }
+
+ free (debugfile);
+ free (basename);
+ free (dir);
+ return NULL;
+}
+
+
+/*
+FUNCTION
+ bfd_follow_gnu_debuglink
+
+SYNOPSIS
+ char *bfd_follow_gnu_debuglink (bfd *abfd, const char *dir);
+
+DESCRIPTION
+
+ Takes a BFD and searches it for a .gnu_debuglink section. If this
+ section is found, it examines the section for the name and checksum
+ of a '.debug' file containing auxiliary debugging information. It
+ then searches the filesystem for this .debug file in some standard
+ locations, including the directory tree rooted at @var{dir}, and if
+ found returns the full filename.
+
+ If @var{dir} is NULL, it will search a default path configured into
+ libbfd at build time. [XXX this feature is not currently
+ implemented].
+
+RETURNS
+ <<NULL>> on any errors or failure to locate the .debug file,
+ otherwise a pointer to a heap-allocated string containing the
+ filename. The caller is responsible for freeing this string.
+*/
+
+char *
+bfd_follow_gnu_debuglink (bfd *abfd, const char *dir)
+{
+#if 0 /* Disabled until DEBUGDIR can be defined by configure.in. */
+ if (dir == NULL)
+ dir = DEBUGDIR;
+#endif
+ return find_separate_debug_file (abfd, dir);
+}
+
+/*
+FUNCTION
+ bfd_create_gnu_debuglink_section
+
+SYNOPSIS
+ struct bfd_section *bfd_create_gnu_debuglink_section
+ (bfd *abfd, const char *filename);
+
+DESCRIPTION
+
+ Takes a @var{BFD} and adds a .gnu_debuglink section to it. The section is sized
+ to be big enough to contain a link to the specified @var{filename}.
+
+RETURNS
+ A pointer to the new section is returned if all is ok. Otherwise <<NULL>> is
+ returned and bfd_error is set.
+*/
+
+asection *
+bfd_create_gnu_debuglink_section (bfd *abfd, const char *filename)
+{
+ asection *sect;
+ bfd_size_type debuglink_size;
+
+ if (abfd == NULL || filename == NULL)
+ {
+ bfd_set_error (bfd_error_invalid_operation);
+ return NULL;
+ }
+
+ /* Strip off any path components in filename. */
+ filename = lbasename (filename);
+
+ sect = bfd_get_section_by_name (abfd, GNU_DEBUGLINK);
+ if (sect)
+ {
+ /* Section already exists. */
+ bfd_set_error (bfd_error_invalid_operation);
+ return NULL;
+ }
+
+ sect = bfd_make_section (abfd, GNU_DEBUGLINK);
+ if (sect == NULL)
+ return NULL;
+
+ if (! bfd_set_section_flags (abfd, sect,
+ SEC_HAS_CONTENTS | SEC_READONLY | SEC_DEBUGGING))
+ /* XXX Should we delete the section from the bfd ? */
+ return NULL;
+
+
+ debuglink_size = strlen (filename) + 1;
+ debuglink_size += 3;
+ debuglink_size &= ~3;
+ debuglink_size += 4;
+
+ if (! bfd_set_section_size (abfd, sect, debuglink_size))
+ /* XXX Should we delete the section from the bfd ? */
+ return NULL;
+
+ return sect;
+}
+
+
+/*
+FUNCTION
+ bfd_fill_in_gnu_debuglink_section
+
+SYNOPSIS
+ bfd_boolean bfd_fill_in_gnu_debuglink_section
+ (bfd *abfd, struct bfd_section *sect, const char *filename);
+
+DESCRIPTION
+
+ Takes a @var{BFD} and containing a .gnu_debuglink section @var{SECT}
+ and fills in the contents of the section to contain a link to the
+ specified @var{filename}. The filename should be relative to the
+ current directory.
+
+RETURNS
+ <<TRUE>> is returned if all is ok. Otherwise <<FALSE>> is returned
+ and bfd_error is set.
+*/
+
+bfd_boolean
+bfd_fill_in_gnu_debuglink_section (bfd *abfd,
+ struct bfd_section *sect,
+ const char *filename)
+{
+ bfd_size_type debuglink_size;
+ unsigned long crc32;
+ char * contents;
+ bfd_size_type crc_offset;
+ FILE * handle;
+ static char buffer[8 * 1024];
+ size_t count;
+
+ if (abfd == NULL || sect == NULL || filename == NULL)
+ {
+ bfd_set_error (bfd_error_invalid_operation);
+ return FALSE;
+ }
+
+ /* Make sure that we can read the file.
+ XXX - Should we attempt to locate the debug info file using the same
+ algorithm as gdb ? At the moment, since we are creating the
+ .gnu_debuglink section, we insist upon the user providing us with a
+ correct-for-section-creation-time path, but this need not conform to
+ the gdb location algorithm. */
+ handle = fopen (filename, FOPEN_RB);
+ if (handle == NULL)
+ {
+ bfd_set_error (bfd_error_system_call);
+ return FALSE;
+ }
+
+ crc32 = 0;
+ while ((count = fread (buffer, 1, sizeof buffer, handle)) > 0)
+ crc32 = bfd_calc_gnu_debuglink_crc32 (crc32, buffer, count);
+ fclose (handle);
+
+ /* Strip off any path components in filename,
+ now that we no longer need them. */
+ filename = lbasename (filename);
+
+ debuglink_size = strlen (filename) + 1;
+ debuglink_size += 3;
+ debuglink_size &= ~3;
+ debuglink_size += 4;
+
+ contents = malloc (debuglink_size);
+ if (contents == NULL)
+ {
+ /* XXX Should we delete the section from the bfd ? */
+ bfd_set_error (bfd_error_no_memory);
+ return FALSE;
+ }
+
+ strcpy (contents, filename);
+ crc_offset = debuglink_size - 4;
+
+ bfd_put_32 (abfd, crc32, contents + crc_offset);
+
+ if (! bfd_set_section_contents (abfd, sect, contents, 0, debuglink_size))
+ {
+ /* XXX Should we delete the section from the bfd ? */
+ free (contents);
+ return FALSE;
+ }
+
+ return TRUE;
+}
diff --git a/contrib/binutils/bfd/osf-core.c b/contrib/binutils/bfd/osf-core.c
index 862342e..8273504 100644
--- a/contrib/binutils/bfd/osf-core.c
+++ b/contrib/binutils/bfd/osf-core.c
@@ -1,5 +1,5 @@
/* BFD back-end for OSF/1 core files.
- Copyright 1993, 1994, 1995, 1998, 1999, 2001, 2002
+ Copyright 1993, 1994, 1995, 1998, 1999, 2001, 2002, 2003, 2004
Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@@ -32,11 +32,16 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
static asection *make_bfd_asection
PARAMS ((bfd *, const char *, flagword, bfd_size_type, bfd_vma, file_ptr));
-static const bfd_target *osf_core_core_file_p PARAMS ((bfd *));
-static char *osf_core_core_file_failing_command PARAMS ((bfd *));
-static int osf_core_core_file_failing_signal PARAMS ((bfd *));
-static boolean osf_core_core_file_matches_executable_p PARAMS ((bfd *, bfd *));
-static void swap_abort PARAMS ((void));
+static const bfd_target *osf_core_core_file_p
+ PARAMS ((bfd *));
+static char *osf_core_core_file_failing_command
+ PARAMS ((bfd *));
+static int osf_core_core_file_failing_signal
+ PARAMS ((bfd *));
+static bfd_boolean osf_core_core_file_matches_executable_p
+ PARAMS ((bfd *, bfd *));
+static void swap_abort
+ PARAMS ((void));
/* These are stored in the bfd's tdata */
@@ -159,7 +164,6 @@ osf_core_core_file_failing_command (abfd)
return core_command (abfd);
}
-/* ARGSUSED */
static int
osf_core_core_file_failing_signal (abfd)
bfd *abfd;
@@ -167,13 +171,12 @@ osf_core_core_file_failing_signal (abfd)
return core_signal (abfd);
}
-/* ARGSUSED */
-static boolean
+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 */
+ return TRUE; /* FIXME, We have no way of telling at this point */
}
/* If somebody calls any byte-swapping routines, shoot them. */
@@ -182,10 +185,13 @@ swap_abort()
{
abort(); /* This way doesn't require any declaration for ANSI to fuck up */
}
-#define NO_GET ((bfd_vma (*) PARAMS (( const bfd_byte *))) swap_abort )
-#define NO_PUT ((void (*) PARAMS ((bfd_vma, bfd_byte *))) swap_abort )
-#define NO_SIGNED_GET \
- ((bfd_signed_vma (*) PARAMS ((const bfd_byte *))) swap_abort )
+
+#define NO_GET ((bfd_vma (*) (const void *)) swap_abort)
+#define NO_PUT ((void (*) (bfd_vma, void *)) swap_abort)
+#define NO_GETS ((bfd_signed_vma (*) (const void *)) swap_abort)
+#define NO_GET64 ((bfd_uint64_t (*) (const void *)) swap_abort)
+#define NO_PUT64 ((void (*) (bfd_uint64_t, void *)) swap_abort)
+#define NO_GETS64 ((bfd_int64_t (*) (const void *)) swap_abort)
const bfd_target osf_core_vec =
{
@@ -200,26 +206,26 @@ const bfd_target osf_core_vec =
0, /* symbol prefix */
' ', /* ar_pad_char */
16, /* ar_max_namelen */
- NO_GET, NO_SIGNED_GET, NO_PUT, /* 64 bit data */
- NO_GET, NO_SIGNED_GET, NO_PUT, /* 32 bit data */
- NO_GET, NO_SIGNED_GET, NO_PUT, /* 16 bit data */
- NO_GET, NO_SIGNED_GET, NO_PUT, /* 64 bit hdrs */
- NO_GET, NO_SIGNED_GET, NO_PUT, /* 32 bit hdrs */
- NO_GET, NO_SIGNED_GET, NO_PUT, /* 16 bit hdrs */
+ NO_GET64, NO_GETS64, NO_PUT64, /* 64 bit data */
+ NO_GET, NO_GETS, NO_PUT, /* 32 bit data */
+ NO_GET, NO_GETS, NO_PUT, /* 16 bit data */
+ NO_GET64, NO_GETS64, NO_PUT64, /* 64 bit hdrs */
+ NO_GET, NO_GETS, NO_PUT, /* 32 bit hdrs */
+ NO_GET, NO_GETS, NO_PUT, /* 16 bit hdrs */
{ /* bfd_check_format */
- _bfd_dummy_target, /* unknown format */
- _bfd_dummy_target, /* object file */
- _bfd_dummy_target, /* archive */
- osf_core_core_file_p /* a core file */
+ _bfd_dummy_target, /* unknown format */
+ _bfd_dummy_target, /* object file */
+ _bfd_dummy_target, /* archive */
+ osf_core_core_file_p /* a core file */
},
{ /* bfd_set_format */
- bfd_false, bfd_false,
- bfd_false, bfd_false
+ bfd_false, bfd_false,
+ bfd_false, bfd_false
},
{ /* bfd_write_contents */
- bfd_false, bfd_false,
- bfd_false, bfd_false
+ bfd_false, bfd_false,
+ bfd_false, bfd_false
},
BFD_JUMP_TABLE_GENERIC (_bfd_generic),
@@ -235,4 +241,4 @@ const bfd_target osf_core_vec =
NULL,
(PTR) 0 /* backend_data */
-};
+ };
diff --git a/contrib/binutils/bfd/pe-arm.c b/contrib/binutils/bfd/pe-arm.c
index dbb4789..8b5d1c7 100644
--- a/contrib/binutils/bfd/pe-arm.c
+++ b/contrib/binutils/bfd/pe-arm.c
@@ -1,5 +1,5 @@
/* BFD back-end for ARM PECOFF files.
- Copyright 1995, 1996, 1999, 2000, 2001 Free Software Foundation, Inc.
+ Copyright 1995, 1996, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@@ -28,7 +28,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#endif
#define COFF_WITH_PE
-#define PCRELOFFSET true
+#define PCRELOFFSET TRUE
#define COFF_LONG_SECTION_NAMES
#ifndef bfd_arm_allocate_interworking_sections
diff --git a/contrib/binutils/bfd/pe-i386.c b/contrib/binutils/bfd/pe-i386.c
index 9c75f95..a912cff 100644
--- a/contrib/binutils/bfd/pe-i386.c
+++ b/contrib/binutils/bfd/pe-i386.c
@@ -23,7 +23,7 @@
#define TARGET_SYM i386pe_vec
#define TARGET_NAME "pe-i386"
#define COFF_WITH_PE
-#define PCRELOFFSET true
+#define PCRELOFFSET TRUE
#define TARGET_UNDERSCORE '_'
#define COFF_LONG_SECTION_NAMES
#define COFF_LONG_FILENAMES
diff --git a/contrib/binutils/bfd/peXXigen.c b/contrib/binutils/bfd/peXXigen.c
index b643f3c..598aa7c 100644
--- a/contrib/binutils/bfd/peXXigen.c
+++ b/contrib/binutils/bfd/peXXigen.c
@@ -1,5 +1,5 @@
/* Support for the generic parts of PE/PEI; the common executable parts.
- Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
+ Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004
Free Software Foundation, Inc.
Written by Cygnus Solutions.
@@ -91,10 +91,10 @@
static void add_data_entry
PARAMS ((bfd *, struct internal_extra_pe_aouthdr *, int, char *, bfd_vma));
-static boolean pe_print_pdata PARAMS ((bfd *, PTR));
-static boolean pe_print_reloc PARAMS ((bfd *, PTR));
-static boolean pe_print_idata PARAMS ((bfd *, PTR));
-static boolean pe_print_edata PARAMS ((bfd *, PTR));
+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
@@ -570,7 +570,8 @@ _bfd_XXi_swap_aouthdr_out (abfd, in, out)
struct internal_extra_pe_aouthdr *extra = &pe->pe_opthdr;
PEAOUTHDR *aouthdr_out = (PEAOUTHDR *) out;
bfd_vma sa, fa, ib;
-
+ IMAGE_DATA_DIRECTORY idata2, idata5, tls;
+
if (pe->force_minimum_alignment)
{
if (!extra->FileAlignment)
@@ -586,6 +587,10 @@ _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];
+
if (aouthdr_in->tsize)
{
aouthdr_in->text_start -= ib;
@@ -614,28 +619,35 @@ _bfd_XXi_swap_aouthdr_out (abfd, in, out)
#define SA(x) (((x) + sa -1 ) & (- sa))
/* We like to have the sizes aligned. */
-
aouthdr_in->bsize = FA (aouthdr_in->bsize);
extra->NumberOfRvaAndSizes = IMAGE_NUMBEROF_DIRECTORY_ENTRIES;
- /* first null out all data directory entries .. */
+ /* First null out all data directory entries. */
memset (extra->DataDirectory, 0, sizeof (extra->DataDirectory));
add_data_entry (abfd, extra, 0, ".edata", ib);
-
- /* Don't call add_data_entry for .idata$2 or .idata$5. It's done in
- bfd_coff_final_link where all the required information is
- available. */
-
- /* However, until other .idata fixes are made (pending patch), the
- entry for .idata is needed for backwards compatability. FIXME. */
- add_data_entry (abfd, extra, 1, ".idata", ib);
-
add_data_entry (abfd, extra, 2, ".rsrc", ib);
-
add_data_entry (abfd, extra, 3, ".pdata", ib);
+ /* In theory we do not need to call add_data_entry for .idata$2 or
+ .idata$5. It will be done in bfd_coff_final_link where all the
+ required information is available. If however, we are not going
+ to perform a final link, eg because we have been invoked by objcopy
+ or strip, then we need to make sure that these Data Directory
+ entries are initialised properly.
+
+ So - we copy the input values into the output values, and then, if
+ a final link is going to be performed, it can overwrite them. */
+ extra->DataDirectory[1] = idata2;
+ extra->DataDirectory[12] = idata5;
+ extra->DataDirectory[9] = tls;
+
+ if (extra->DataDirectory[1].VirtualAddress == 0)
+ /* Until other .idata fixes are made (pending patch), the entry for
+ .idata is needed for backwards compatibility. FIXME. */
+ add_data_entry (abfd, extra, 1, ".idata", ib);
+
/* For some reason, the virtual size (which is what's set by
add_data_entry) for .reloc is not the same as the size recorded
in this slot by MSVC; it doesn't seem to cause problems (so far),
@@ -663,7 +675,9 @@ _bfd_XXi_swap_aouthdr_out (abfd, in, out)
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. */
- isize += SA (FA (pei_section_data (abfd, sec)->virt_size));
+ if (coff_section_data (abfd, sec) != NULL
+ && pei_section_data (abfd, sec) != NULL)
+ isize += SA (FA (pei_section_data (abfd, sec)->virt_size));
}
aouthdr_in->dsize = dsize;
@@ -689,7 +703,7 @@ _bfd_XXi_swap_aouthdr_out (abfd, in, out)
aouthdr_out->standard.text_start);
#ifndef COFF_WITH_pep
- /* PE32+ does not have data_start member! */
+ /* PE32+ does not have data_start member! */
PUT_AOUTHDR_DATA_START (abfd, aouthdr_in->data_start,
aouthdr_out->standard.data_start);
#endif
@@ -895,12 +909,24 @@ _bfd_XXi_swap_scnhdr_out (abfd, in, out)
sometimes). */
if ((scnhdr_int->s_flags & IMAGE_SCN_CNT_UNINITIALIZED_DATA) != 0)
{
- ps = scnhdr_int->s_size;
- ss = 0;
+ if (bfd_pe_executable_p (abfd))
+ {
+ ps = scnhdr_int->s_size;
+ ss = 0;
+ }
+ else
+ {
+ ps = 0;
+ ss = scnhdr_int->s_size;
+ }
}
else
{
- ps = scnhdr_int->s_paddr;
+ if (bfd_pe_executable_p (abfd))
+ ps = scnhdr_int->s_paddr;
+ else
+ ps = 0;
+
ss = scnhdr_int->s_size;
}
@@ -917,33 +943,76 @@ _bfd_XXi_swap_scnhdr_out (abfd, in, out)
PUT_SCNHDR_LNNOPTR (abfd, scnhdr_int->s_lnnoptr,
scnhdr_ext->s_lnnoptr);
- /* Extra flags must be set when dealing with NT. All sections should also
- have the IMAGE_SCN_MEM_READ (0x40000000) flag set. In addition, the
- .text section must have IMAGE_SCN_MEM_EXECUTE (0x20000000) and the data
- sections (.idata, .data, .bss, .CRT) must have IMAGE_SCN_MEM_WRITE set
- (this is especially important when dealing with the .idata section since
- the addresses for routines from .dlls must be overwritten). If .reloc
- section data is ever generated, we must add IMAGE_SCN_MEM_DISCARDABLE
- (0x02000000). Also, the resource data should also be read and
- writable. */
-
- /* FIXME: alignment is also encoded in this field, at least on ppc (krk) */
- /* FIXME: even worse, I don't see how to get the original alignment field*/
- /* back... */
-
{
+ /* Extra flags must be set when dealing with PE. All sections should also
+ have the IMAGE_SCN_MEM_READ (0x40000000) flag set. In addition, the
+ .text section must have IMAGE_SCN_MEM_EXECUTE (0x20000000) and the data
+ sections (.idata, .data, .bss, .CRT) must have IMAGE_SCN_MEM_WRITE set
+ (this is especially important when dealing with the .idata section since
+ the addresses for routines from .dlls must be overwritten). If .reloc
+ section data is ever generated, we must add IMAGE_SCN_MEM_DISCARDABLE
+ (0x02000000). Also, the resource data should also be read and
+ writable. */
+
+ /* FIXME: Alignment is also encoded in this field, at least on PPC and
+ ARM-WINCE. Although - how do we get the original alignment field
+ back ? */
+
+ typedef struct
+ {
+ const char * section_name;
+ unsigned long must_have;
+ }
+ pe_required_section_flags;
+
+ pe_required_section_flags known_sections [] =
+ {
+ { ".arch", IMAGE_SCN_MEM_READ | IMAGE_SCN_CNT_INITIALIZED_DATA | IMAGE_SCN_MEM_DISCARDABLE | IMAGE_SCN_ALIGN_8BYTES },
+ { ".bss", IMAGE_SCN_MEM_READ | IMAGE_SCN_CNT_UNINITIALIZED_DATA | IMAGE_SCN_MEM_WRITE },
+ { ".data", IMAGE_SCN_MEM_READ | IMAGE_SCN_CNT_INITIALIZED_DATA | IMAGE_SCN_MEM_WRITE },
+ { ".edata", IMAGE_SCN_MEM_READ | IMAGE_SCN_CNT_INITIALIZED_DATA },
+ { ".idata", IMAGE_SCN_MEM_READ | IMAGE_SCN_CNT_INITIALIZED_DATA | IMAGE_SCN_MEM_WRITE },
+ { ".pdata", IMAGE_SCN_MEM_READ | IMAGE_SCN_CNT_INITIALIZED_DATA },
+ { ".rdata", IMAGE_SCN_MEM_READ | IMAGE_SCN_CNT_INITIALIZED_DATA },
+ { ".reloc", IMAGE_SCN_MEM_READ | IMAGE_SCN_CNT_INITIALIZED_DATA | IMAGE_SCN_MEM_DISCARDABLE },
+ { ".rsrc", IMAGE_SCN_MEM_READ | IMAGE_SCN_CNT_INITIALIZED_DATA | IMAGE_SCN_MEM_WRITE },
+ { ".text" , IMAGE_SCN_MEM_READ | IMAGE_SCN_CNT_CODE | IMAGE_SCN_MEM_EXECUTE },
+ { ".tls", IMAGE_SCN_MEM_READ | IMAGE_SCN_CNT_INITIALIZED_DATA | IMAGE_SCN_MEM_WRITE },
+ { ".xdata", IMAGE_SCN_MEM_READ | IMAGE_SCN_CNT_INITIALIZED_DATA },
+ { NULL, 0}
+ };
+
+ pe_required_section_flags * p;
int flags = scnhdr_int->s_flags;
+ /* We have defaulted to adding the IMAGE_SCN_MEM_WRITE flag, but now
+ we know exactly what this specific section wants so we remove it
+ and then allow the must_have field to add it back in if necessary.
+ However, we don't remove IMAGE_SCN_MEM_WRITE flag from .text if the
+ default WP_TEXT file flag has been cleared. WP_TEXT may be cleared
+ by ld --enable-auto-import (if auto-import is actually needed),
+ by ld --omagic, or by obcopy --writable-text. */
+
+ for (p = known_sections; p->section_name; p++)
+ if (strcmp (scnhdr_int->s_name, p->section_name) == 0)
+ {
+ if (strcmp (scnhdr_int->s_name, ".text")
+ || (bfd_get_file_flags (abfd) & WP_TEXT))
+ flags &= ~IMAGE_SCN_MEM_WRITE;
+ flags |= p->must_have;
+ break;
+ }
+
H_PUT_32 (abfd, flags, scnhdr_ext->s_flags);
}
if (coff_data (abfd)->link_info
- && ! coff_data (abfd)->link_info->relocateable
+ && ! coff_data (abfd)->link_info->relocatable
&& ! coff_data (abfd)->link_info->shared
&& strcmp (scnhdr_int->s_name, ".text") == 0)
{
/* By inference from looking at MS output, the 32 bit field
- which is the combintion of the number_of_relocs and
+ which is the combination of the number_of_relocs and
number_of_linenos is used for the line number count in
executables. A 16-bit field won't do for cc1. The MS
document says that the number of relocs is zero for
@@ -967,7 +1036,11 @@ _bfd_XXi_swap_scnhdr_out (abfd, in, out)
ret = 0;
}
- if (scnhdr_int->s_nreloc <= 0xffff)
+ /* Although we could encode 0xffff relocs here, we do not, to be
+ consistent with other parts of bfd. Also it lets us warn, as
+ we should never see 0xffff here w/o having the overflow flag
+ set. */
+ if (scnhdr_int->s_nreloc < 0xffff)
H_PUT_16 (abfd, scnhdr_int->s_nreloc, scnhdr_ext->s_nreloc);
else
{
@@ -1016,7 +1089,7 @@ static char * dir_names[IMAGE_NUMBEROF_DIRECTORY_ENTRIES] =
PPC- specific code. */
#endif
-static boolean
+static bfd_boolean
pe_print_idata (abfd, vfile)
bfd *abfd;
PTR vfile;
@@ -1048,12 +1121,12 @@ pe_print_idata (abfd, vfile)
/* Maybe the extra header isn't there. Look for the section. */
section = bfd_get_section_by_name (abfd, ".idata");
if (section == NULL)
- return true;
+ return TRUE;
addr = section->vma;
datasize = bfd_section_size (abfd, section);
if (datasize == 0)
- return true;
+ return TRUE;
}
else
{
@@ -1069,7 +1142,7 @@ pe_print_idata (abfd, vfile)
{
fprintf (file,
_("\nThere is an import table, but the section containing it could not be found\n"));
- return true;
+ return TRUE;
}
}
@@ -1098,7 +1171,7 @@ pe_print_idata (abfd, vfile)
amt = bfd_section_size (abfd, rel_section);
data = (bfd_byte *) bfd_malloc (amt);
if (data == NULL && amt != 0)
- return false;
+ return FALSE;
bfd_get_section_contents (abfd, rel_section, (PTR) data, (bfd_vma) 0,
amt);
@@ -1134,11 +1207,11 @@ pe_print_idata (abfd, vfile)
amt = dataoff + datasize;
data = (bfd_byte *) bfd_malloc (amt);
if (data == NULL)
- return false;
+ 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;
+ return FALSE;
adj = section->vma - extra->ImageBase;
@@ -1290,10 +1363,10 @@ pe_print_idata (abfd, vfile)
free (data);
- return true;
+ return TRUE;
}
-static boolean
+static bfd_boolean
pe_print_edata (abfd, vfile)
bfd *abfd;
PTR vfile;
@@ -1332,12 +1405,12 @@ pe_print_edata (abfd, vfile)
/* Maybe the extra header isn't there. Look for the section. */
section = bfd_get_section_by_name (abfd, ".edata");
if (section == NULL)
- return true;
+ return TRUE;
addr = section->vma;
datasize = bfd_section_size (abfd, section);
if (datasize == 0)
- return true;
+ return TRUE;
}
else
{
@@ -1355,7 +1428,7 @@ pe_print_edata (abfd, vfile)
{
fprintf (file,
_("\nThere is an export table, but the section containing it could not be found\n"));
- return true;
+ return TRUE;
}
}
@@ -1367,11 +1440,11 @@ pe_print_edata (abfd, vfile)
data = (bfd_byte *) bfd_malloc (datasize);
if (data == NULL)
- return false;
+ return FALSE;
if (! bfd_get_section_contents (abfd, section, (PTR) data,
(file_ptr) dataoff, datasize))
- return false;
+ return FALSE;
/* Go get Export Directory Table. */
edt.export_flags = bfd_get_32 (abfd, data + 0);
@@ -1508,7 +1581,7 @@ pe_print_edata (abfd, vfile)
free (data);
- return true;
+ return TRUE;
}
/* This really is architecture dependent. On IA-64, a .pdata entry
@@ -1516,7 +1589,7 @@ pe_print_edata (abfd, vfile)
specify the start and end address of the code range the entry
covers and the address of the corresponding unwind info data. */
-static boolean
+static bfd_boolean
pe_print_pdata (abfd, vfile)
bfd *abfd;
PTR vfile;
@@ -1537,7 +1610,7 @@ pe_print_pdata (abfd, vfile)
if (section == NULL
|| coff_section_data (abfd, section) == NULL
|| pei_section_data (abfd, section) == NULL)
- return true;
+ return TRUE;
stop = pei_section_data (abfd, section)->virt_size;
if ((stop % onaline) != 0)
@@ -1558,11 +1631,11 @@ pe_print_pdata (abfd, vfile)
datasize = bfd_section_size (abfd, section);
if (datasize == 0)
- return true;
+ return TRUE;
data = (bfd_byte *) bfd_malloc (datasize);
if (data == NULL && datasize != 0)
- return false;
+ return FALSE;
bfd_get_section_contents (abfd, section, (PTR) data, (bfd_vma) 0,
datasize);
@@ -1639,7 +1712,7 @@ pe_print_pdata (abfd, vfile)
free (data);
- return true;
+ return TRUE;
}
#define IMAGE_REL_BASED_HIGHADJ 4
@@ -1660,7 +1733,7 @@ static const char * const tbl[] =
"UNKNOWN", /* MUST be last */
};
-static boolean
+static bfd_boolean
pe_print_reloc (abfd, vfile)
bfd *abfd;
PTR vfile;
@@ -1673,10 +1746,10 @@ pe_print_reloc (abfd, vfile)
bfd_size_type start, stop;
if (section == NULL)
- return true;
+ return TRUE;
if (bfd_section_size (abfd, section) == 0)
- return true;
+ return TRUE;
fprintf (file,
_("\n\nPE File Base Relocations (interpreted .reloc section contents)\n"));
@@ -1684,7 +1757,7 @@ pe_print_reloc (abfd, vfile)
datasize = bfd_section_size (abfd, section);
data = (bfd_byte *) bfd_malloc (datasize);
if (data == NULL && datasize != 0)
- return false;
+ return FALSE;
bfd_get_section_contents (abfd, section, (PTR) data, (bfd_vma) 0,
datasize);
@@ -1743,12 +1816,12 @@ pe_print_reloc (abfd, vfile)
free (data);
- return true;
+ return TRUE;
}
/* Print out the program headers. */
-boolean
+bfd_boolean
_bfd_XX_print_private_bfd_data_common (abfd, vfile)
bfd *abfd;
PTR vfile;
@@ -1859,20 +1932,20 @@ _bfd_XX_print_private_bfd_data_common (abfd, vfile)
pe_print_pdata (abfd, vfile);
pe_print_reloc (abfd, vfile);
- return true;
+ return TRUE;
}
/* Copy any private info we understand from the input bfd
to the output bfd. */
-boolean
+bfd_boolean
_bfd_XX_bfd_copy_private_bfd_data_common (ibfd, obfd)
bfd *ibfd, *obfd;
{
/* One day we may try to grok other private data. */
if (ibfd->xvec->flavour != bfd_target_coff_flavour
|| obfd->xvec->flavour != bfd_target_coff_flavour)
- return true;
+ return TRUE;
pe_data (obfd)->pe_opthdr = pe_data (ibfd)->pe_opthdr;
pe_data (obfd)->dll = pe_data (ibfd)->dll;
@@ -1884,12 +1957,12 @@ _bfd_XX_bfd_copy_private_bfd_data_common (ibfd, obfd)
pe_data (obfd)->pe_opthdr.DataDirectory[5].VirtualAddress = 0;
pe_data (obfd)->pe_opthdr.DataDirectory[5].Size = 0;
}
- return true;
+ return TRUE;
}
/* Copy private section data. */
-boolean
+bfd_boolean
_bfd_XX_bfd_copy_private_section_data (ibfd, isec, obfd, osec)
bfd *ibfd;
asection *isec;
@@ -1898,7 +1971,7 @@ _bfd_XX_bfd_copy_private_section_data (ibfd, isec, obfd, osec)
{
if (bfd_get_flavour (ibfd) != bfd_target_coff_flavour
|| bfd_get_flavour (obfd) != bfd_target_coff_flavour)
- return true;
+ return TRUE;
if (coff_section_data (ibfd, isec) != NULL
&& pei_section_data (ibfd, isec) != NULL)
@@ -1908,7 +1981,7 @@ _bfd_XX_bfd_copy_private_section_data (ibfd, isec, obfd, osec)
bfd_size_type amt = sizeof (struct coff_section_tdata);
osec->used_by_bfd = (PTR) bfd_zalloc (obfd, amt);
if (osec->used_by_bfd == NULL)
- return false;
+ return FALSE;
}
if (pei_section_data (obfd, osec) == NULL)
@@ -1916,7 +1989,7 @@ _bfd_XX_bfd_copy_private_section_data (ibfd, isec, obfd, osec)
bfd_size_type amt = sizeof (struct pei_section_tdata);
coff_section_data (obfd, osec)->tdata = (PTR) bfd_zalloc (obfd, amt);
if (coff_section_data (obfd, osec)->tdata == NULL)
- return false;
+ return FALSE;
}
pei_section_data (obfd, osec)->virt_size =
@@ -1925,7 +1998,7 @@ _bfd_XX_bfd_copy_private_section_data (ibfd, isec, obfd, osec)
pei_section_data (ibfd, isec)->pe_flags;
}
- return true;
+ return TRUE;
}
void
@@ -1948,7 +2021,7 @@ _bfd_XX_get_symbol_info (abfd, symbol, ret)
/* Handle the .idata section and other things that need symbol table
access. */
-boolean
+bfd_boolean
_bfd_XXi_final_link_postscript (abfd, pfinfo)
bfd *abfd;
struct coff_final_link_info *pfinfo;
@@ -1965,7 +2038,7 @@ _bfd_XXi_final_link_postscript (abfd, pfinfo)
/* The import directory. This is the address of .idata$2, with size
of .idata$2 + .idata$3. */
h1 = coff_link_hash_lookup (coff_hash_table (info),
- ".idata$2", false, false, true);
+ ".idata$2", FALSE, FALSE, TRUE);
if (h1 != NULL)
{
pe_data (abfd)->pe_opthdr.DataDirectory[1].VirtualAddress =
@@ -1973,7 +2046,7 @@ _bfd_XXi_final_link_postscript (abfd, pfinfo)
+ h1->root.u.def.section->output_section->vma
+ h1->root.u.def.section->output_offset);
h1 = coff_link_hash_lookup (coff_hash_table (info),
- ".idata$4", false, false, true);
+ ".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
@@ -1983,22 +2056,34 @@ _bfd_XXi_final_link_postscript (abfd, pfinfo)
/* 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);
+ ".idata$5", FALSE, FALSE, TRUE);
pe_data (abfd)->pe_opthdr.DataDirectory[12].VirtualAddress =
(h1->root.u.def.value
+ h1->root.u.def.section->output_section->vma
+ h1->root.u.def.section->output_offset);
h1 = coff_link_hash_lookup (coff_hash_table (info),
- ".idata$6", false, false, true);
+ ".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);
+ - pe_data (abfd)->pe_opthdr.DataDirectory[12].VirtualAddress);
+ }
+
+ h1 = coff_link_hash_lookup (coff_hash_table (info),
+ "__tls_used", FALSE, FALSE, TRUE);
+ if (h1 != NULL)
+ {
+ pe_data (abfd)->pe_opthdr.DataDirectory[9].VirtualAddress =
+ (h1->root.u.def.value
+ + h1->root.u.def.section->output_section->vma
+ + h1->root.u.def.section->output_offset
+ - pe_data (abfd)->pe_opthdr.ImageBase);
+ pe_data (abfd)->pe_opthdr.DataDirectory[9].Size = 0x18;
}
/* If we couldn't find idata$2, we either have an excessively
trivial program or are in DEEP trouble; we have to assume trivial
program.... */
- return true;
+ return TRUE;
}
diff --git a/contrib/binutils/bfd/peicode.h b/contrib/binutils/bfd/peicode.h
index a621acc..41445e5 100644
--- a/contrib/binutils/bfd/peicode.h
+++ b/contrib/binutils/bfd/peicode.h
@@ -1,31 +1,29 @@
/* Support for the generic parts of PE/PEI, for BFD.
- Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
+ Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
Free Software Foundation, Inc.
Written by Cygnus Solutions.
-This file is part of BFD, the Binary File Descriptor library.
+ This 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-/*
-Most of this hacked by Steve Chamberlain,
+/* Most of this hacked by Steve Chamberlain,
sac@cygnus.com
-PE/PEI rearrangement (and code added): Donn Terry
- Softway Systems, Inc.
-*/
+ PE/PEI rearrangement (and code added): Donn Terry
+ Softway Systems, Inc. */
/* Hey look, some documentation [and in a place you expect to find it]!
@@ -53,12 +51,11 @@ PE/PEI rearrangement (and code added): Donn Terry
FIXME: Please add more docs here so the next poor fool that has to hack
on this code has a chance of getting something accomplished without
- wasting too much time.
-*/
+ wasting too much time. */
#include "libpei.h"
-static boolean (*pe_saved_coff_bfd_print_private_bfd_data)
+static bfd_boolean (*pe_saved_coff_bfd_print_private_bfd_data)
PARAMS ((bfd *, PTR)) =
#ifndef coff_bfd_print_private_bfd_data
NULL;
@@ -67,10 +64,10 @@ static boolean (*pe_saved_coff_bfd_print_private_bfd_data)
#undef coff_bfd_print_private_bfd_data
#endif
-static boolean pe_print_private_bfd_data PARAMS ((bfd *, PTR));
+static bfd_boolean pe_print_private_bfd_data PARAMS ((bfd *, PTR));
#define coff_bfd_print_private_bfd_data pe_print_private_bfd_data
-static boolean (*pe_saved_coff_bfd_copy_private_bfd_data)
+static bfd_boolean (*pe_saved_coff_bfd_copy_private_bfd_data)
PARAMS ((bfd *, bfd *)) =
#ifndef coff_bfd_copy_private_bfd_data
NULL;
@@ -79,7 +76,7 @@ static boolean (*pe_saved_coff_bfd_copy_private_bfd_data)
#undef coff_bfd_copy_private_bfd_data
#endif
-static boolean pe_bfd_copy_private_bfd_data PARAMS ((bfd *, bfd *));
+static bfd_boolean pe_bfd_copy_private_bfd_data PARAMS ((bfd *, bfd *));
#define coff_bfd_copy_private_bfd_data pe_bfd_copy_private_bfd_data
#define coff_mkobject pe_mkobject
@@ -91,7 +88,7 @@ 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 boolean pe_mkobject PARAMS ((bfd *));
+static bfd_boolean pe_mkobject PARAMS ((bfd *));
static PTR pe_mkobject_hook PARAMS ((bfd *, PTR, PTR));
#ifdef COFF_IMAGE_WITH_PE
@@ -138,8 +135,8 @@ static asection_ptr pe_ILF_make_a_section PARAMS ((pe_ILF_vars *, const
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 symbol_cache_entry **, unsigned int));
-static boolean pe_ILF_build_a_bfd PARAMS ((bfd *, unsigned int, bfd_byte *, bfd_byte *, unsigned int, unsigned int));
+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 */
@@ -259,12 +256,17 @@ coff_swap_scnhdr_in (abfd, ext, in)
}
#ifndef COFF_NO_HACK_SCNHDR_SIZE
- /* If this section holds uninitialized data, use the virtual size
- (stored in s_paddr) instead of the physical size. */
- if ((scnhdr_int->s_flags & IMAGE_SCN_CNT_UNINITIALIZED_DATA) != 0
- && (scnhdr_int->s_paddr > 0))
+ /* If this section holds uninitialized data and is from an object file
+ or from an executable image that has not initialized the field,
+ or if the image is an executable file and the physical size is padded,
+ use the virtual size (stored in s_paddr) instead. */
+ if (scnhdr_int->s_paddr > 0
+ && (((scnhdr_int->s_flags & IMAGE_SCN_CNT_UNINITIALIZED_DATA) != 0
+ && (! bfd_pe_executable_p (abfd) || scnhdr_int->s_size == 0))
+ || (bfd_pe_executable_p (abfd) && scnhdr_int->s_size > scnhdr_int->s_paddr)))
{
scnhdr_int->s_size = scnhdr_int->s_paddr;
+
/* This code used to set scnhdr_int->s_paddr to 0. However,
coff_set_alignment_hook stores s_paddr in virt_size, which
only works if it correctly holds the virtual size of the
@@ -273,7 +275,7 @@ coff_swap_scnhdr_in (abfd, ext, in)
#endif
}
-static boolean
+static bfd_boolean
pe_mkobject (abfd)
bfd * abfd;
{
@@ -283,7 +285,7 @@ pe_mkobject (abfd)
abfd->tdata.pe_obj_data = (struct pe_tdata *) bfd_zalloc (abfd, amt);
if (abfd->tdata.pe_obj_data == 0)
- return false;
+ return FALSE;
pe = pe_data (abfd);
@@ -299,7 +301,7 @@ pe_mkobject (abfd)
pe->target_subsystem = PEI_TARGET_SUBSYSTEM;
#endif
- return true;
+ return TRUE;
}
/* Create the COFF backend specific information. */
@@ -355,7 +357,7 @@ pe_mkobject_hook (abfd, filehdr, aouthdr)
return (PTR) pe;
}
-static boolean
+static bfd_boolean
pe_print_private_bfd_data (abfd, vfile)
bfd *abfd;
PTR vfile;
@@ -363,7 +365,7 @@ pe_print_private_bfd_data (abfd, vfile)
FILE *file = (FILE *) vfile;
if (!_bfd_XX_print_private_bfd_data_common (abfd, vfile))
- return false;
+ return FALSE;
if (pe_saved_coff_bfd_print_private_bfd_data != NULL)
{
@@ -372,23 +374,23 @@ pe_print_private_bfd_data (abfd, vfile)
return pe_saved_coff_bfd_print_private_bfd_data (abfd, vfile);
}
- return true;
+ return TRUE;
}
/* Copy any private info we understand from the input bfd
to the output bfd. */
-static boolean
+static bfd_boolean
pe_bfd_copy_private_bfd_data (ibfd, obfd)
bfd *ibfd, *obfd;
{
if (!_bfd_XX_bfd_copy_private_bfd_data_common (ibfd, obfd))
- return false;
+ return FALSE;
if (pe_saved_coff_bfd_copy_private_bfd_data)
return pe_saved_coff_bfd_copy_private_bfd_data (ibfd, obfd);
- return true;
+ return TRUE;
}
#define coff_bfd_copy_private_section_data \
@@ -468,7 +470,7 @@ static void
pe_ILF_make_a_symbol_reloc (pe_ILF_vars * vars,
bfd_vma address,
bfd_reloc_code_real_type reloc,
- struct symbol_cache_entry ** sym,
+ struct bfd_symbol ** sym,
unsigned int sym_index)
{
arelent * entry;
@@ -518,7 +520,7 @@ pe_ILF_save_relocs (pe_ILF_vars * vars,
abort ();
coff_section_data (vars->abfd, sec)->relocs = vars->int_reltab;
- coff_section_data (vars->abfd, sec)->keep_relocs = true;
+ coff_section_data (vars->abfd, sec)->keep_relocs = TRUE;
sec->relocation = vars->reltab;
sec->reloc_count = vars->relcount;
@@ -610,7 +612,7 @@ pe_ILF_make_a_symbol (pe_ILF_vars * vars,
#if 0 /* See comment above. */
sym->symbol.value = 0;
sym->symbol.udata.i = 0;
- sym->done_lineno = false;
+ sym->done_lineno = FALSE;
sym->lineno = NULL;
#endif
@@ -753,7 +755,7 @@ static jump_table jtab[] =
#endif
/* Build a full BFD from the information supplied in a ILF object. */
-static boolean
+static bfd_boolean
pe_ILF_build_a_bfd (bfd * abfd,
unsigned int magic,
bfd_byte * symbol_name,
@@ -784,12 +786,12 @@ pe_ILF_build_a_bfd (bfd * abfd,
/* XXX code yet to be written. */
_bfd_error_handler (_("%s: Unhandled import type; %x"),
bfd_archive_filename (abfd), import_type);
- return false;
+ return FALSE;
default:
_bfd_error_handler (_("%s: Unrecognised import type; %x"),
bfd_archive_filename (abfd), import_type);
- return false;
+ return FALSE;
}
switch (import_name_type)
@@ -803,7 +805,7 @@ pe_ILF_build_a_bfd (bfd * abfd,
default:
_bfd_error_handler (_("%s: Unrecognised import name type; %x"),
bfd_archive_filename (abfd), import_name_type);
- return false;
+ return FALSE;
}
/* Initialise local variables.
@@ -815,7 +817,7 @@ pe_ILF_build_a_bfd (bfd * abfd,
so allocate all the space that we will need right now. */
ptr = bfd_zalloc (abfd, (bfd_size_type) ILF_DATA_SIZE);
if (ptr == NULL)
- return false;
+ return FALSE;
/* Create a bfd_in_memory structure. */
vars.bim = (struct bfd_in_memory *) ptr;
@@ -875,7 +877,7 @@ pe_ILF_build_a_bfd (bfd * abfd,
id4 = pe_ILF_make_a_section (& vars, ".idata$4", SIZEOF_IDATA4, 0);
id5 = pe_ILF_make_a_section (& vars, ".idata$5", SIZEOF_IDATA5, 0);
if (id4 == NULL || id5 == NULL)
- return false;
+ return FALSE;
/* Fill in the contents of these sections. */
if (import_name_type == IMPORT_ORDINAL)
@@ -894,16 +896,46 @@ pe_ILF_build_a_bfd (bfd * abfd,
/* Create .idata$6 - the Hint Name Table. */
id6 = pe_ILF_make_a_section (& vars, ".idata$6", SIZEOF_IDATA6, 0);
if (id6 == NULL)
- return false;
+ return FALSE;
/* If necessary, trim the import symbol name. */
symbol = symbol_name;
if (import_name_type != IMPORT_NAME)
- /* Skip any prefix in symbol_name. */
- while (*symbol == '@' || * symbol == '?' || * symbol == '_')
- ++ symbol;
-
+ {
+ bfd_boolean skipped_leading_underscore = FALSE;
+ bfd_boolean skipped_leading_at = FALSE;
+ bfd_boolean skipped_leading_question_mark = FALSE;
+ bfd_boolean check_again;
+
+ /* Skip any prefix in symbol_name. */
+ -- symbol;
+ do
+ {
+ check_again = FALSE;
+ ++ symbol;
+
+ switch (*symbol)
+ {
+ case '@':
+ if (! skipped_leading_at)
+ check_again = skipped_leading_at = TRUE;
+ break;
+ case '?':
+ if (! skipped_leading_question_mark)
+ check_again = skipped_leading_question_mark = TRUE;
+ break;
+ case '_':
+ if (! skipped_leading_underscore)
+ check_again = skipped_leading_underscore = TRUE;
+ break;
+ default:
+ break;
+ }
+ }
+ while (check_again);
+ }
+
if (import_name_type == IMPORT_NAME_UNDECORATE)
{
/* Truncate at the first '@' */
@@ -950,7 +982,7 @@ pe_ILF_build_a_bfd (bfd * abfd,
/* Create the .text section. */
text = pe_ILF_make_a_section (& vars, ".text", jtab[i].size, SEC_CODE);
if (text == NULL)
- return false;
+ return FALSE;
/* Copy in the jump code. */
memcpy (text->contents, jtab[i].data, jtab[i].size);
@@ -965,11 +997,11 @@ pe_ILF_build_a_bfd (bfd * abfd,
if (magic == MIPS_ARCH_MAGIC_WINCE)
{
pe_ILF_make_a_symbol_reloc (&vars, (bfd_vma) 0, BFD_RELOC_HI16_S,
- (struct symbol_cache_entry **) imp_sym,
+ (struct bfd_symbol **) imp_sym,
imp_index);
pe_ILF_make_a_reloc (&vars, (bfd_vma) 0, BFD_RELOC_LO16, text);
pe_ILF_make_a_symbol_reloc (&vars, (bfd_vma) 4, BFD_RELOC_LO16,
- (struct symbol_cache_entry **) imp_sym,
+ (struct bfd_symbol **) imp_sym,
imp_index);
}
else
@@ -999,10 +1031,10 @@ pe_ILF_build_a_bfd (bfd * abfd,
if ( ! bfd_set_start_address (abfd, (bfd_vma) 0)
|| ! bfd_coff_set_arch_mach_hook (abfd, & internal_f))
- return false;
+ return FALSE;
if (bfd_coff_mkobject_hook (abfd, (PTR) & internal_f, NULL) == NULL)
- return false;
+ return FALSE;
coff_data (abfd)->pe = 1;
#ifdef THUMBPEMAGIC
@@ -1053,17 +1085,17 @@ pe_ILF_build_a_bfd (bfd * abfd,
obj_raw_syment_count (abfd) = vars.sym_index;
obj_coff_external_syms (abfd) = (PTR) vars.esym_table;
- obj_coff_keep_syms (abfd) = true;
+ obj_coff_keep_syms (abfd) = TRUE;
obj_convert (abfd) = vars.sym_table;
obj_conv_table_size (abfd) = vars.sym_index;
obj_coff_strings (abfd) = vars.string_table;
- obj_coff_keep_strings (abfd) = true;
+ obj_coff_keep_strings (abfd) = TRUE;
abfd->flags |= HAS_SYMS;
- return true;
+ return TRUE;
}
/* We have detected a Image Library Format archive element.
diff --git a/contrib/binutils/bfd/po/BLD-POTFILES.in b/contrib/binutils/bfd/po/BLD-POTFILES.in
index 28f599d..2dbe723 100644
--- a/contrib/binutils/bfd/po/BLD-POTFILES.in
+++ b/contrib/binutils/bfd/po/BLD-POTFILES.in
@@ -1,3 +1,4 @@
+bfdver.h
elf32-ia64.c
elf32-target.h
elf64-ia64.c
diff --git a/contrib/binutils/bfd/po/Make-in b/contrib/binutils/bfd/po/Make-in
index a288585..1608b2d 100644
--- a/contrib/binutils/bfd/po/Make-in
+++ b/contrib/binutils/bfd/po/Make-in
@@ -24,6 +24,8 @@ gnulocaledir = $(prefix)/share/locale
gettextsrcdir = $(prefix)/share/gettext/po
subdir = po
+DESTDIR =
+
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
MKINSTALLDIRS = @MKINSTALLDIRS@
@@ -124,9 +126,9 @@ install-data: install-data-@USE_NLS@
install-data-no: all
install-data-yes: all
if test -r $(MKINSTALLDIRS); then \
- $(MKINSTALLDIRS) $(datadir); \
+ $(MKINSTALLDIRS) $(DESTDIR)$(datadir); \
else \
- $(top_srcdir)/mkinstalldirs $(datadir); \
+ $(top_srcdir)/mkinstalldirs $(DESTDIR)$(datadir); \
fi
@catalogs='$(CATALOGS)'; \
for cat in $$catalogs; do \
@@ -136,7 +138,7 @@ install-data-yes: all
*) destdir=$(localedir);; \
esac; \
lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \
- dir=$$destdir/$$lang/LC_MESSAGES; \
+ dir=$(DESTDIR)$$destdir/$$lang/LC_MESSAGES; \
if test -r $(MKINSTALLDIRS); then \
$(MKINSTALLDIRS) $$dir; \
else \
@@ -166,12 +168,12 @@ install-data-yes: all
done
if test "$(PACKAGE)" = "gettext"; then \
if test -r $(MKINSTALLDIRS); then \
- $(MKINSTALLDIRS) $(gettextsrcdir); \
+ $(MKINSTALLDIRS) $(DESTDIR)$(gettextsrcdir); \
else \
- $(top_srcdir)/mkinstalldirs $(gettextsrcdir); \
+ $(top_srcdir)/mkinstalldirs $(DESTDIR)$(gettextsrcdir); \
fi; \
$(INSTALL_DATA) $(srcdir)/Makefile.in.in \
- $(gettextsrcdir)/Makefile.in.in; \
+ $(DESTDIR)$(gettextsrcdir)/Makefile.in.in; \
else \
: ; \
fi
@@ -184,12 +186,12 @@ uninstall:
for cat in $$catalogs; do \
cat=`basename $$cat`; \
lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \
- rm -f $(localedir)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT); \
- rm -f $(localedir)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT).m; \
- rm -f $(gnulocaledir)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT); \
- rm -f $(gnulocaledir)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT).m; \
+ rm -f $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT); \
+ rm -f $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT).m; \
+ rm -f $(DESTDIR)$(gnulocaledir)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT); \
+ rm -f $(DESTDIR)$(gnulocaledir)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT).m; \
done
- rm -f $(gettextsrcdir)/po-Makefile.in.in
+ rm -f $(DESTDIR)$(gettextsrcdir)/po-Makefile.in.in
check: all
diff --git a/contrib/binutils/bfd/po/SRC-POTFILES.in b/contrib/binutils/bfd/po/SRC-POTFILES.in
index 9a977f5..d29593d 100644
--- a/contrib/binutils/bfd/po/SRC-POTFILES.in
+++ b/contrib/binutils/bfd/po/SRC-POTFILES.in
@@ -1,22 +1,24 @@
aix386-core.c
aix5ppc-core.c
+aout0.c
+aout32.c
+aout64.c
aout-adobe.c
aout-arm.c
aout-cris.c
+aoutf1.h
aout-ns32k.c
aout-sparcle.c
aout-target.h
aout-tic30.c
-aout0.c
-aout32.c
-aout64.c
-aoutf1.h
aoutx.h
-archive.c
archive64.c
+archive.c
archures.c
armnetbsd.c
bfd.c
+bfdio.c
+bfdwin.c
binary.c
bout.c
cache.c
@@ -24,17 +26,21 @@ 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
@@ -44,18 +50,15 @@ coff-sh.c
coff-sparc.c
coff-stgo32.c
coff-svm68k.c
+coffswap.h
coff-tic30.c
+coff-tic4x.c
coff-tic54x.c
coff-tic80.c
coff-u68k.c
coff-w65.c
coff-we32k.c
coff-z8k.c
-coff64-rs6000.c
-coffcode.h
-coffgen.c
-cofflink.c
-coffswap.h
corefile.c
cpu-a29k.c
cpu-alpha.c
@@ -76,6 +79,8 @@ cpu-i386.c
cpu-i860.c
cpu-i960.c
cpu-ia64.c
+cpu-ip2k.c
+cpu-iq2000.c
cpu-m10200.c
cpu-m10300.c
cpu-m32r.c
@@ -86,6 +91,7 @@ cpu-m88k.c
cpu-mcore.c
cpu-mips.c
cpu-mmix.c
+cpu-msp430.c
cpu-ns32k.c
cpu-openrisc.c
cpu-or32.c
@@ -97,6 +103,7 @@ cpu-s390.c
cpu-sh.c
cpu-sparc.c
cpu-tic30.c
+cpu-tic4x.c
cpu-tic54x.c
cpu-tic80.c
cpu-v850.c
@@ -104,6 +111,7 @@ cpu-vax.c
cpu-w65.c
cpu-we32k.c
cpu-xstormy16.c
+cpu-xtensa.c
cpu-z8k.c
demo64.c
dwarf1.c
@@ -113,16 +121,11 @@ ecofflink.c
ecoffswap.h
efi-app-ia32.c
efi-app-ia64.c
-elf-bfd.h
-elf-eh-frame.c
-elf-hppa.h
-elf-m10200.c
-elf-m10300.c
-elf-strtab.c
-elf.c
+elf32-am33lin.c
elf32-arc.c
elf32-arm.h
elf32-avr.c
+elf32.c
elf32-cris.c
elf32-d10v.c
elf32-d30v.c
@@ -134,36 +137,35 @@ elf32-h8300.c
elf32-hppa.c
elf32-hppa.h
elf32-i370.c
-elf32-i386-fbsd.c
elf32-i386.c
-elf32-i386qnx.c
elf32-i860.c
elf32-i960.c
+elf32-ip2k.c
+elf32-iq2000.c
elf32-m32r.c
elf32-m68hc11.c
elf32-m68hc12.c
+elf32-m68hc1x.c
elf32-m68k.c
elf32-m88k.c
elf32-mcore.c
elf32-mips.c
+elf32-msp430.c
elf32-openrisc.c
elf32-or32.c
elf32-pj.c
elf32-ppc.c
elf32-s390.c
-elf32-sh-lin.c
-elf32-sh-nbsd.c
-elf32-sh.c
-elf32-sh64-com.c
-elf32-sh64-nbsd.c
elf32-sh64.c
+elf32-sh64-com.c
+elf32-sh.c
elf32-sparc.c
elf32-v850.c
elf32-vax.c
elf32-xstormy16.c
-elf32.c
-elf64-alpha-fbsd.c
+elf32-xtensa.c
elf64-alpha.c
+elf64.c
elf64-gen.c
elf64-hppa.c
elf64-hppa.h
@@ -171,17 +173,22 @@ elf64-mips.c
elf64-mmix.c
elf64-ppc.c
elf64-s390.c
-elf64-sh64-nbsd.c
elf64-sh64.c
elf64-sparc.c
elf64-x86-64.c
-elf64.c
elfarm-nabi.c
elfarm-oabi.c
+elf-bfd.h
+elf.c
elfcode.h
elfcore.h
+elf-eh-frame.c
+elf-hppa.h
elflink.c
-elflink.h
+elf-m10200.c
+elf-m10300.c
+elfn32-mips.c
+elf-strtab.c
elfxx-mips.c
epoc-pe-arm.c
epoc-pei-arm.c
@@ -225,21 +232,23 @@ m68klinux.c
m68klynx.c
m68knetbsd.c
m88kmach3.c
+mach-o.c
+mach-o.h
merge.c
mipsbsd.c
mmo.c
netbsd.h
newsos3.c
-nlm-target.h
-nlm.c
nlm32-alpha.c
+nlm32.c
nlm32-i386.c
nlm32-ppc.c
nlm32-sparc.c
-nlm32.c
nlm64.c
+nlm.c
nlmcode.h
nlmswap.h
+nlm-target.h
ns32k.h
ns32knetbsd.c
oasys.c
@@ -248,32 +257,36 @@ osf-core.c
pc532-mach.c
pdp11.c
pe-arm.c
+pef.c
+pef.h
+pef-traceback.h
pe-i386.c
-pe-mcore.c
-pe-mips.c
-pe-ppc.c
-pe-sh.c
pei-arm.c
+peicode.h
pei-i386.c
pei-mcore.c
pei-mips.c
pei-ppc.c
pei-sh.c
-peicode.h
+pe-mcore.c
+pe-mips.c
+pe-ppc.c
+pe-sh.c
ppcboot.c
-reloc.c
reloc16.c
+reloc.c
riscix.c
sco5-core.c
section.c
+simple.c
som.c
som.h
sparclinux.c
sparclynx.c
sparcnetbsd.c
srec.c
-stab-syms.c
stabs.c
+stab-syms.c
sunos.c
syms.c
targets.c
@@ -284,11 +297,15 @@ vaxbsd.c
vaxnetbsd.c
versados.c
version.h
+vms.c
vms-gsd.c
+vms.h
vms-hdr.c
vms-misc.c
vms-tir.c
-vms.c
-vms.h
-xcoff-target.h
xcofflink.c
+xcoff-target.h
+xsym.c
+xsym.h
+xtensa-isa.c
+xtensa-modules.c
diff --git a/contrib/binutils/bfd/po/bfd.pot b/contrib/binutils/bfd/po/bfd.pot
index 8823e66..5d4f234 100644
--- a/contrib/binutils/bfd/po/bfd.pot
+++ b/contrib/binutils/bfd/po/bfd.pot
@@ -1,13 +1,12 @@
# SOME DESCRIPTIVE TITLE.
-# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
-# This file is distributed under the same license as the PACKAGE package.
+# Copyright (C) YEAR Free Software Foundation, Inc.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
-"POT-Creation-Date: 2002-10-30 10:06-0500\n"
+"POT-Creation-Date: 2003-07-17 14:52+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -15,922 +14,867 @@ msgstr ""
"Content-Type: text/plain; charset=CHARSET\n"
"Content-Transfer-Encoding: 8bit\n"
-#: aout-adobe.c:197
+#: aout-adobe.c:204
#, c-format
msgid "%s: Unknown section type in a.out.adobe file: %x\n"
msgstr ""
-#: aout-cris.c:208
+#: aout-cris.c:207
#, c-format
msgid "%s: Invalid relocation type exported: %d"
msgstr ""
-#: aout-cris.c:252
+#: aout-cris.c:251
#, c-format
msgid "%s: Invalid relocation type imported: %d"
msgstr ""
-#: aout-cris.c:263
+#: aout-cris.c:262
#, c-format
msgid "%s: Bad relocation record imported: %d"
msgstr ""
-#: aoutx.h:1282 aoutx.h:1699
+#: aoutx.h:1295 aoutx.h:1716
#, c-format
msgid "%s: can not represent section `%s' in a.out object file format"
msgstr ""
-#: aoutx.h:1669
+#: aoutx.h:1682
#, c-format
msgid ""
"%s: can not represent section for symbol `%s' in a.out object file format"
msgstr ""
-#: aoutx.h:1671
+#: aoutx.h:1684
msgid "*unknown*"
msgstr ""
-#: aoutx.h:3732
+#: aoutx.h:3776
#, c-format
-msgid "%s: relocateable link from %s to %s not supported"
+msgid "%s: relocatable link from %s to %s not supported"
msgstr ""
-#: archive.c:1818
+#: archive.c:1751
msgid "Warning: writing archive was slow: rewriting timestamp\n"
msgstr ""
-#: archive.c:2085
+#: archive.c:2014
msgid "Reading archive file mod timestamp"
msgstr ""
-#. FIXME: bfd can't call perror.
-#: archive.c:2112
+#: archive.c:2040
msgid "Writing updated armap timestamp"
msgstr ""
-#: bfd.c:277
+#: bfd.c:280
msgid "No error"
msgstr ""
-#: bfd.c:278
+#: bfd.c:281
msgid "System call error"
msgstr ""
-#: bfd.c:279
+#: bfd.c:282
msgid "Invalid bfd target"
msgstr ""
-#: bfd.c:280
+#: bfd.c:283
msgid "File in wrong format"
msgstr ""
-#: bfd.c:281
+#: bfd.c:284
msgid "Archive object file in wrong format"
msgstr ""
-#: bfd.c:282
+#: bfd.c:285
msgid "Invalid operation"
msgstr ""
-#: bfd.c:283
+#: bfd.c:286
msgid "Memory exhausted"
msgstr ""
-#: bfd.c:284
+#: bfd.c:287
msgid "No symbols"
msgstr ""
-#: bfd.c:285
+#: bfd.c:288
msgid "Archive has no index; run ranlib to add one"
msgstr ""
-#: bfd.c:286
+#: bfd.c:289
msgid "No more archived files"
msgstr ""
-#: bfd.c:287
+#: bfd.c:290
msgid "Malformed archive"
msgstr ""
-#: bfd.c:288
+#: bfd.c:291
msgid "File format not recognized"
msgstr ""
-#: bfd.c:289
+#: bfd.c:292
msgid "File format is ambiguous"
msgstr ""
-#: bfd.c:290
+#: bfd.c:293
msgid "Section has no contents"
msgstr ""
-#: bfd.c:291
+#: bfd.c:294
msgid "Nonrepresentable section on output"
msgstr ""
-#: bfd.c:292
+#: bfd.c:295
msgid "Symbol needs debug section which does not exist"
msgstr ""
-#: bfd.c:293
+#: bfd.c:296
msgid "Bad value"
msgstr ""
-#: bfd.c:294
+#: bfd.c:297
msgid "File truncated"
msgstr ""
-#: bfd.c:295
+#: bfd.c:298
msgid "File too big"
msgstr ""
-#: bfd.c:296
+#: bfd.c:299
msgid "#<Invalid error code>"
msgstr ""
-#: bfd.c:703
+#: bfd.c:687
#, c-format
msgid "BFD %s assertion fail %s:%d"
msgstr ""
-#: bfd.c:722
+#: bfd.c:703
#, c-format
msgid "BFD %s internal error, aborting at %s line %d in %s\n"
msgstr ""
-#: bfd.c:726
+#: bfd.c:707
#, c-format
msgid "BFD %s internal error, aborting at %s line %d\n"
msgstr ""
-#: bfd.c:728
+#: bfd.c:709
msgid "Please report this bug.\n"
msgstr ""
+#: bfdwin.c:202
+#, c-format
+msgid "not mapping: data=%lx mapped=%d\n"
+msgstr ""
+
+#: bfdwin.c:205
+msgid "not mapping: env var not set\n"
+msgstr ""
+
#: binary.c:306
#, c-format
msgid "Warning: Writing section `%s' to huge (ie negative) file offset 0x%lx."
msgstr ""
-#: coff-a29k.c:119
+#: coff-rs6000.c:3616 coff64-rs6000.c:2109
+#, c-format
+msgid "%s: symbol `%s' has unrecognized smclas %d"
+msgstr ""
+
+#: coff-a29k.c:120
msgid "Missing IHCONST"
msgstr ""
-#: coff-a29k.c:180
+#: coff-a29k.c:181
msgid "Missing IHIHALF"
msgstr ""
-#: coff-a29k.c:212 coff-or32.c:229
+#: coff-a29k.c:213 coff-or32.c:236
msgid "Unrecognized reloc"
msgstr ""
-#: coff-a29k.c:408
+#: coff-a29k.c:409
msgid "missing IHCONST reloc"
msgstr ""
-#: coff-a29k.c:498
+#: coff-a29k.c:499
msgid "missing IHIHALF reloc"
msgstr ""
-#: coff-alpha.c:881 coff-alpha.c:918 coff-alpha.c:1989 coff-mips.c:1432
+#: coff-alpha.c:884 coff-alpha.c:921 coff-alpha.c:1992 coff-mips.c:1397
msgid "GP relative relocation used when GP not defined"
msgstr ""
-#: coff-alpha.c:1485
+#: coff-alpha.c:1488
msgid "using multiple gp values"
msgstr ""
-#: coff-arm.c:1066 elf32-arm.h:285
+#: coff-arm.c:1066 elf32-arm.h:294
#, c-format
msgid "%s: unable to find THUMB glue '%s' for `%s'"
msgstr ""
-#: coff-arm.c:1096 elf32-arm.h:320
+#: coff-arm.c:1096 elf32-arm.h:329
#, c-format
msgid "%s: unable to find ARM glue '%s' for `%s'"
msgstr ""
-#: coff-arm.c:1391 coff-arm.c:1486 elf32-arm.h:888 elf32-arm.h:992
+#: coff-arm.c:1394 coff-arm.c:1489 elf32-arm.h:892 elf32-arm.h:999
#, c-format
msgid "%s(%s): warning: interworking not enabled."
msgstr ""
-#: coff-arm.c:1395 elf32-arm.h:995
+#: coff-arm.c:1398 elf32-arm.h:1002
#, c-format
msgid " first occurrence: %s: arm call to thumb"
msgstr ""
-#: coff-arm.c:1490 elf32-arm.h:891
+#: coff-arm.c:1493 elf32-arm.h:895
#, c-format
msgid " first occurrence: %s: thumb call to arm"
msgstr ""
-#: coff-arm.c:1493
+#: coff-arm.c:1496
msgid " consider relinking with --support-old-code enabled"
msgstr ""
-#: coff-arm.c:1785 coff-tic80.c:686 cofflink.c:3034
+#: coff-arm.c:1788 coff-tic80.c:687 cofflink.c:3038
#, c-format
msgid "%s: bad reloc address 0x%lx in section `%s'"
msgstr ""
-#: coff-arm.c:2129
+#: coff-arm.c:2132
#, c-format
msgid "%s: illegal symbol index in reloc: %d"
msgstr ""
-#: coff-arm.c:2257
+#: coff-arm.c:2265
#, c-format
msgid "ERROR: %s is compiled for APCS-%d, whereas %s is compiled for APCS-%d"
msgstr ""
-#: coff-arm.c:2272 elf32-arm.h:2298
+#: coff-arm.c:2280 elf32-arm.h:2328
#, c-format
msgid ""
"ERROR: %s passes floats in float registers, whereas %s passes them in "
"integer registers"
msgstr ""
-#: coff-arm.c:2275 elf32-arm.h:2303
+#: coff-arm.c:2283 elf32-arm.h:2333
#, c-format
msgid ""
"ERROR: %s passes floats in integer registers, whereas %s passes them in "
"float registers"
msgstr ""
-#: coff-arm.c:2290
+#: coff-arm.c:2298
#, c-format
msgid ""
"ERROR: %s is compiled as position independent code, whereas target %s is "
"absolute position"
msgstr ""
-#: coff-arm.c:2293
+#: coff-arm.c:2301
#, c-format
msgid ""
"ERROR: %s is compiled as absolute position code, whereas target %s is "
"position independent"
msgstr ""
-#: coff-arm.c:2322 elf32-arm.h:2359
+#: coff-arm.c:2330 elf32-arm.h:2405
#, c-format
msgid "Warning: %s supports interworking, whereas %s does not"
msgstr ""
-#: coff-arm.c:2325 elf32-arm.h:2366
+#: coff-arm.c:2333 elf32-arm.h:2412
#, c-format
msgid "Warning: %s does not support interworking, whereas %s does"
msgstr ""
-#: coff-arm.c:2352
+#: coff-arm.c:2360
#, c-format
msgid "private flags = %x:"
msgstr ""
-#: coff-arm.c:2360 elf32-arm.h:2419
+#: coff-arm.c:2368 elf32-arm.h:2467
msgid " [floats passed in float registers]"
msgstr ""
-#: coff-arm.c:2362
+#: coff-arm.c:2370
msgid " [floats passed in integer registers]"
msgstr ""
-#: coff-arm.c:2365 elf32-arm.h:2422
+#: coff-arm.c:2373 elf32-arm.h:2470
msgid " [position independent]"
msgstr ""
-#: coff-arm.c:2367
+#: coff-arm.c:2375
msgid " [absolute position]"
msgstr ""
-#: coff-arm.c:2371
+#: coff-arm.c:2379
msgid " [interworking flag not initialised]"
msgstr ""
-#: coff-arm.c:2373
+#: coff-arm.c:2381
msgid " [interworking supported]"
msgstr ""
-#: coff-arm.c:2375
+#: coff-arm.c:2383
msgid " [interworking not supported]"
msgstr ""
-#: coff-arm.c:2423 elf32-arm.h:2125
+#: coff-arm.c:2431 elf32-arm.h:2150
#, c-format
msgid ""
"Warning: Not setting interworking flag of %s since it has already been "
"specified as non-interworking"
msgstr ""
-#: coff-arm.c:2427 elf32-arm.h:2129
+#: coff-arm.c:2435 elf32-arm.h:2154
#, c-format
msgid "Warning: Clearing the interworking flag of %s due to outside request"
msgstr ""
-#: coff-i960.c:136 coff-i960.c:485
-msgid "uncertain calling convention for non-COFF symbol"
+#: coffcode.h:1108
+#, c-format
+msgid "%s (%s): Section flag %s (0x%x) ignored"
msgstr ""
-#: coff-m68k.c:481 coff-mips.c:2429 elf32-m68k.c:2157 elf32-mips.c:1844
-msgid "unsupported reloc type"
+#: coffcode.h:2214
+#, c-format
+msgid "Unrecognized TI COFF target id '0x%x'"
msgstr ""
-#: coff-mips.c:874 elf32-mips.c:1062 elf64-mips.c:1609
-msgid "GP relative relocation when _gp not defined"
+#: coffcode.h:4439
+#, c-format
+msgid "%s: warning: illegal symbol index %ld in line numbers"
msgstr ""
-#. No other sections should appear in -membedded-pic
-#. code.
-#: coff-mips.c:2466
-msgid "reloc against unsupported section"
+#: coffcode.h:4453
+#, c-format
+msgid "%s: warning: duplicate line number information for `%s'"
msgstr ""
-#: coff-mips.c:2474
-msgid "reloc not properly aligned"
+#: coffcode.h:4807
+#, c-format
+msgid "%s: Unrecognized storage class %d for %s symbol `%s'"
msgstr ""
-#: coff-rs6000.c:2760
+#: coffcode.h:4940
#, c-format
-msgid "%s: unsupported relocation type 0x%02x"
+msgid "warning: %s: local symbol `%s' has no section"
msgstr ""
-#: coff-rs6000.c:2853
+#: coff-tic4x.c:218 coff-tic54x.c:373 coffcode.h:5047
#, c-format
-msgid "%s: TOC reloc at 0x%x to symbol `%s' with no TOC entry"
+msgid "%s: warning: illegal symbol index %ld in relocs"
msgstr ""
-#: coff-rs6000.c:3586 coff64-rs6000.c:2080
+#: coffcode.h:5085
#, c-format
-msgid "%s: symbol `%s' has unrecognized smclas %d"
+msgid "%s: illegal relocation type %d at address 0x%lx"
msgstr ""
-#: coff-tic54x.c:279 coff-tic80.c:449
+#: coffgen.c:1666
#, c-format
-msgid "Unrecognized reloc type 0x%x"
+msgid "%s: bad string table size %lu"
msgstr ""
-#: coff-tic54x.c:390 coffcode.h:4981
+#: coff-h8300.c:1047
#, c-format
-msgid "%s: warning: illegal symbol index %ld in relocs"
+msgid "cannot handle R_MEM_INDIRECT reloc when using %s output"
msgstr ""
-#: coff-w65.c:363
-#, c-format
-msgid "ignoring reloc %s\n"
+#: coff-i960.c:137 coff-i960.c:486
+msgid "uncertain calling convention for non-COFF symbol"
msgstr ""
-#: coffcode.h:1086
+#: cofflink.c:538 elflink.h:1276
#, c-format
-msgid "%s (%s): Section flag %s (0x%x) ignored"
+msgid "Warning: type of symbol `%s' changed from %d to %d in %s"
msgstr ""
-#: coffcode.h:2143
+#: cofflink.c:2328
#, c-format
-msgid "Unrecognized TI COFF target id '0x%x'"
+msgid "%s: relocs in section `%s', but it has no contents"
msgstr ""
-#: coffcode.h:4372
+#: cofflink.c:2671 coffswap.h:890
#, c-format
-msgid "%s: warning: illegal symbol index %ld in line numbers"
+msgid "%s: %s: reloc overflow: 0x%lx > 0xffff"
msgstr ""
-#: coffcode.h:4386
+#: cofflink.c:2680 coffswap.h:876
#, c-format
-msgid "%s: warning: duplicate line number information for `%s'"
+msgid "%s: warning: %s: line number overflow: 0x%lx > 0xffff"
msgstr ""
-#: coffcode.h:4743
-#, c-format
-msgid "%s: Unrecognized storage class %d for %s symbol `%s'"
+#: coff-m68k.c:482 coff-mips.c:2394 elf32-m68k.c:2193 elf32-mips.c:1783
+msgid "unsupported reloc type"
msgstr ""
-#: coffcode.h:4874
-#, c-format
-msgid "warning: %s: local symbol `%s' has no section"
+#: coff-mips.c:839 elf32-mips.c:1088 elf64-mips.c:1590 elfn32-mips.c:1554
+msgid "GP relative relocation when _gp not defined"
+msgstr ""
+
+#. No other sections should appear in -membedded-pic
+#. code.
+#: coff-mips.c:2431
+msgid "reloc against unsupported section"
msgstr ""
-#: coffcode.h:5019
+#: coff-mips.c:2439
+msgid "reloc not properly aligned"
+msgstr ""
+
+#: coff-rs6000.c:2790
#, c-format
-msgid "%s: illegal relocation type %d at address 0x%lx"
+msgid "%s: unsupported relocation type 0x%02x"
msgstr ""
-#: coffgen.c:1668
+#: coff-rs6000.c:2883
#, c-format
-msgid "%s: bad string table size %lu"
+msgid "%s: TOC reloc at 0x%x to symbol `%s' with no TOC entry"
msgstr ""
-#: cofflink.c:534 elflink.h:1930
+#: coff-tic4x.c:170 coff-tic54x.c:288 coff-tic80.c:450
#, c-format
-msgid "Warning: type of symbol `%s' changed from %d to %d in %s"
+msgid "Unrecognized reloc type 0x%x"
msgstr ""
-#: cofflink.c:2324
+#: coff-w65.c:364
#, c-format
-msgid "%s: relocs in section `%s', but it has no contents"
+msgid "ignoring reloc %s\n"
msgstr ""
-#: cofflink.c:2667 coffswap.h:877
+#: cpu-arm.c:196 cpu-arm.c:206
#, c-format
-msgid "%s: %s: reloc overflow: 0x%lx > 0xffff"
+msgid "ERROR: %s is compiled for the EP9312, whereas %s is compiled for XScale"
msgstr ""
-#: cofflink.c:2676 coffswap.h:864
+#: cpu-arm.c:344
#, c-format
-msgid "%s: warning: %s: line number overflow: 0x%lx > 0xffff"
+msgid "warning: unable to update contents of %s section in %s"
msgstr ""
-#: dwarf2.c:382
+#: dwarf2.c:380
msgid "Dwarf Error: Can't find .debug_str section."
msgstr ""
-#: dwarf2.c:399
+#: dwarf2.c:397
#, c-format
msgid ""
"Dwarf Error: DW_FORM_strp offset (%lu) greater than or equal to .debug_str "
"size (%lu)."
msgstr ""
-#: dwarf2.c:543
+#: dwarf2.c:541
msgid "Dwarf Error: Can't find .debug_abbrev section."
msgstr ""
-#: dwarf2.c:560
+#: dwarf2.c:556
#, c-format
msgid ""
"Dwarf Error: Abbrev offset (%lu) greater than or equal to .debug_abbrev size "
"(%lu)."
msgstr ""
-#: dwarf2.c:760
+#: dwarf2.c:756
#, c-format
msgid "Dwarf Error: Invalid or unhandled FORM value: %u."
msgstr ""
-#: dwarf2.c:924
+#: dwarf2.c:933
msgid "Dwarf Error: mangled line number section (bad file number)."
msgstr ""
-#: dwarf2.c:1016
+#: dwarf2.c:1032
msgid "Dwarf Error: Can't find .debug_line section."
msgstr ""
-#: dwarf2.c:1039
+#: dwarf2.c:1049
#, c-format
msgid ""
"Dwarf Error: Line offset (%lu) greater than or equal to .debug_line size (%"
"lu)."
msgstr ""
-#: dwarf2.c:1245
+#: dwarf2.c:1255
msgid "Dwarf Error: mangled line number section."
msgstr ""
-#: dwarf2.c:1454 dwarf2.c:1665
+#: dwarf2.c:1470 dwarf2.c:1620
#, c-format
msgid "Dwarf Error: Could not find abbrev number %u."
msgstr ""
-#: dwarf2.c:1626
+#: dwarf2.c:1581
#, c-format
msgid ""
"Dwarf Error: found dwarf version '%u', this reader only handles version 2 "
"information."
msgstr ""
-#: dwarf2.c:1633
+#: dwarf2.c:1588
#, c-format
msgid ""
"Dwarf Error: found address size '%u', this reader can not handle sizes "
"greater than '%u'."
msgstr ""
-#: dwarf2.c:1656
+#: dwarf2.c:1611
#, c-format
msgid "Dwarf Error: Bad abbrev number: %u."
msgstr ""
-#: ecoff.c:1320
+#: ecoff.c:1339
#, c-format
msgid "Unknown basic type %d"
msgstr ""
-#: ecoff.c:1580
+#: ecoff.c:1599
#, c-format
msgid ""
"\n"
" End+1 symbol: %ld"
msgstr ""
-#: ecoff.c:1587 ecoff.c:1590
+#: ecoff.c:1606 ecoff.c:1609
#, c-format
msgid ""
"\n"
" First symbol: %ld"
msgstr ""
-#: ecoff.c:1602
+#: ecoff.c:1621
#, c-format
msgid ""
"\n"
" End+1 symbol: %-7ld Type: %s"
msgstr ""
-#: ecoff.c:1609
+#: ecoff.c:1628
#, c-format
msgid ""
"\n"
" Local symbol: %ld"
msgstr ""
-#: ecoff.c:1617
+#: ecoff.c:1636
#, c-format
msgid ""
"\n"
" struct; End+1 symbol: %ld"
msgstr ""
-#: ecoff.c:1622
+#: ecoff.c:1641
#, c-format
msgid ""
"\n"
" union; End+1 symbol: %ld"
msgstr ""
-#: ecoff.c:1627
+#: ecoff.c:1646
#, c-format
msgid ""
"\n"
" enum; End+1 symbol: %ld"
msgstr ""
-#: ecoff.c:1633
+#: ecoff.c:1652
#, c-format
msgid ""
"\n"
" Type: %s"
msgstr ""
-#: elf-hppa.h:1476 elf-hppa.h:1509 elf32-ppc.c:3091 elf32-sh.c:4537
-#: elf64-sh64.c:1659
-#, c-format
-msgid ""
-"%s: warning: unresolvable relocation against symbol `%s' from %s section"
-msgstr ""
-
-#: elf-m10200.c:446 elf-m10300.c:656 elf32-arm.h:2085 elf32-avr.c:833
-#: elf32-cris.c:1403 elf32-d10v.c:481 elf32-fr30.c:635 elf32-frv.c:809
-#: elf32-h8300.c:548 elf32-i860.c:1031 elf32-m32r.c:1280 elf32-openrisc.c:439
-#: elf32-v850.c:1691 elf32-xstormy16.c:933 elf64-mmix.c:1302
-msgid "internal error: out of range error"
-msgstr ""
-
-#: elf-m10200.c:450 elf-m10300.c:660 elf32-arm.h:2089 elf32-avr.c:837
-#: elf32-cris.c:1407 elf32-d10v.c:485 elf32-fr30.c:639 elf32-frv.c:813
-#: elf32-h8300.c:552 elf32-i860.c:1035 elf32-m32r.c:1284 elf32-openrisc.c:443
-#: elf32-v850.c:1695 elf32-xstormy16.c:937 elf64-mmix.c:1306 elfxx-mips.c:5258
-msgid "internal error: unsupported relocation error"
-msgstr ""
-
-#: elf-m10200.c:454 elf-m10300.c:664 elf32-arm.h:2093 elf32-d10v.c:489
-#: elf32-h8300.c:556 elf32-m32r.c:1288
-msgid "internal error: dangerous error"
-msgstr ""
-
-#: elf-m10200.c:458 elf-m10300.c:668 elf32-arm.h:2097 elf32-avr.c:845
-#: elf32-cris.c:1415 elf32-d10v.c:493 elf32-fr30.c:647 elf32-frv.c:821
-#: elf32-h8300.c:560 elf32-i860.c:1043 elf32-m32r.c:1292 elf32-openrisc.c:451
-#: elf32-v850.c:1715 elf32-xstormy16.c:945 elf64-mmix.c:1314
-msgid "internal error: unknown error"
-msgstr ""
-
-#: elf.c:343
-#, c-format
-msgid "%s: invalid string offset %u >= %lu for section `%s'"
-msgstr ""
-
-#: elf.c:589
-#, c-format
-msgid "%s: invalid SHT_GROUP entry"
-msgstr ""
-
-#: elf.c:660
-#, c-format
-msgid "%s: no group info for section %s"
-msgstr ""
-
-#: elf.c:1023
-msgid ""
-"\n"
-"Program Header:\n"
-msgstr ""
-
-#: elf.c:1073
-msgid ""
-"\n"
-"Dynamic Section:\n"
-msgstr ""
-
-#: elf.c:1202
-msgid ""
-"\n"
-"Version definitions:\n"
-msgstr ""
-
-#: elf.c:1225
-msgid ""
-"\n"
-"Version References:\n"
-msgstr ""
-
-#: elf.c:1230
-#, c-format
-msgid " required from %s:\n"
-msgstr ""
-
-#: elf.c:1904
+#: elf32-arm.h:1228
#, c-format
-msgid "%s: invalid link %lu for reloc section %s (index %u)"
+msgid "%s: Warning: Arm BLX instruction targets Arm function '%s'."
msgstr ""
-#: elf.c:3619
+#: elf32-arm.h:1424
#, c-format
-msgid "%s: Not enough room for program headers (allocated %u, need %u)"
+msgid "%s: Warning: Thumb BLX instruction targets thumb function '%s'."
msgstr ""
-#: elf.c:3724
+#: elf32-arm.h:1918 elf32-sh.c:4706 elf64-sh64.c:1613
#, c-format
-msgid "%s: Not enough room for program headers, try linking with -N"
+msgid "%s(%s+0x%lx): %s relocation against SEC_MERGE section"
msgstr ""
-#: elf.c:3849
+#: elf32-arm.h:2012
#, c-format
msgid ""
-"Error: First section in segment (%s) starts at 0x%x whereas the segment "
-"starts at 0x%x"
-msgstr ""
-
-#: elf.c:4164
-#, c-format
-msgid "%s: warning: allocated section `%s' not in segment"
-msgstr ""
-
-#: elf.c:4488
-#, c-format
-msgid "%s: symbol `%s' required but not present"
-msgstr ""
-
-#: elf.c:4765
-#, c-format
-msgid "%s: warning: Empty loadable segment detected, is this intentional ?\n"
-msgstr ""
-
-#: elf.c:6213
-#, c-format
-msgid "%s: unsupported relocation type %s"
+"%s: warning: unresolvable relocation %d against symbol `%s' from %s section"
msgstr ""
-#: elf32-arm.h:1222
-#, c-format
-msgid "%s: Warning: Arm BLX instruction targets Arm function '%s'."
+#: elf-m10200.c:442 elf-m10300.c:1695 elf32-arm.h:2088 elf32-avr.c:812
+#: elf32-cris.c:1390 elf32-d10v.c:482 elf32-fr30.c:634 elf32-frv.c:815
+#: elf32-h8300.c:509 elf32-i860.c:1028 elf32-ip2k.c:1586 elf32-iq2000.c:699
+#: elf32-m32r.c:1283 elf32-m68hc1x.c:1305 elf32-msp430.c:510
+#: elf32-openrisc.c:436 elf32-v850.c:1777 elf32-xstormy16.c:976
+#: elf64-mmix.c:1332
+msgid "internal error: out of range error"
msgstr ""
-#: elf32-arm.h:1418
-#, c-format
-msgid "%s: Warning: Thumb BLX instruction targets thumb function '%s'."
+#: elf-m10200.c:446 elf-m10300.c:1699 elf32-arm.h:2092 elf32-avr.c:816
+#: elf32-cris.c:1394 elf32-d10v.c:486 elf32-fr30.c:638 elf32-frv.c:819
+#: elf32-h8300.c:513 elf32-i860.c:1032 elf32-iq2000.c:703 elf32-m32r.c:1287
+#: elf32-m68hc1x.c:1309 elf32-msp430.c:514 elf32-openrisc.c:440
+#: elf32-v850.c:1781 elf32-xstormy16.c:980 elf64-mmix.c:1336 elfxx-mips.c:6452
+msgid "internal error: unsupported relocation error"
msgstr ""
-#: elf32-arm.h:1915 elf32-sh.c:4444
-#, c-format
-msgid "%s(%s+0x%lx): %s relocation against SEC_MERGE section"
+#: elf-m10200.c:450 elf-m10300.c:1703 elf32-arm.h:2096 elf32-d10v.c:490
+#: elf32-h8300.c:517 elf32-m32r.c:1291 elf32-m68hc1x.c:1313
+msgid "internal error: dangerous error"
msgstr ""
-#: elf32-arm.h:2009
-#, c-format
-msgid ""
-"%s: warning: unresolvable relocation %d against symbol `%s' from %s section"
+#: elf-m10200.c:454 elf-m10300.c:1707 elf32-arm.h:2100 elf32-avr.c:824
+#: elf32-cris.c:1402 elf32-d10v.c:494 elf32-fr30.c:646 elf32-frv.c:827
+#: elf32-h8300.c:521 elf32-i860.c:1040 elf32-ip2k.c:1601 elf32-iq2000.c:711
+#: elf32-m32r.c:1295 elf32-m68hc1x.c:1317 elf32-msp430.c:522
+#: elf32-openrisc.c:448 elf32-v850.c:1801 elf32-xstormy16.c:988
+#: elf64-mmix.c:1344
+msgid "internal error: unknown error"
msgstr ""
-#: elf32-arm.h:2177
+#: elf32-arm.h:2202
#, c-format
msgid ""
"Warning: Clearing the interworking flag of %s because non-interworking code "
"in %s has been linked with it"
msgstr ""
-#: elf32-arm.h:2272
+#: elf32-arm.h:2302
#, c-format
msgid ""
"ERROR: %s is compiled for EABI version %d, whereas %s is compiled for "
"version %d"
msgstr ""
-#: elf32-arm.h:2286
+#: elf32-arm.h:2316
#, c-format
msgid "ERROR: %s is compiled for APCS-%d, whereas target %s uses APCS-%d"
msgstr ""
-#: elf32-arm.h:2314
+#: elf32-arm.h:2344
#, c-format
-msgid "ERROR: %s uses VFP instructions, whereas %s uses FPA instructions"
+msgid "ERROR: %s uses VFP instructions, whereas %s does not"
msgstr ""
-#: elf32-arm.h:2319
+#: elf32-arm.h:2349
#, c-format
-msgid "ERROR: %s uses FPA instructions, whereas %s uses VFP instructions"
+msgid "ERROR: %s uses FPA instructions, whereas %s does not"
msgstr ""
-#: elf32-arm.h:2339
+#: elf32-arm.h:2360 elf32-arm.h:2365
+#, c-format
+msgid "ERROR: %s uses Maverick instructions, whereas %s does not"
+msgstr ""
+
+#: elf32-arm.h:2385
#, c-format
msgid "ERROR: %s uses software FP, whereas %s uses hardware FP"
msgstr ""
-#: elf32-arm.h:2344
+#: elf32-arm.h:2390
#, c-format
msgid "ERROR: %s uses hardware FP, whereas %s uses software FP"
msgstr ""
#. Ignore init flag - it may not be set, despite the flags field
#. containing valid data.
-#: elf32-arm.h:2397 elf32-cris.c:2989 elf32-m68k.c:410 elf32-vax.c:548
-#: elfxx-mips.c:7760
+#: elf32-arm.h:2443 elf32-cris.c:2975 elf32-m68hc1x.c:1459 elf32-m68k.c:397
+#: elf32-vax.c:546 elfxx-mips.c:9240
#, c-format
msgid "private flags = %lx:"
msgstr ""
-#: elf32-arm.h:2406
+#: elf32-arm.h:2452
msgid " [interworking enabled]"
msgstr ""
-#: elf32-arm.h:2414
+#: elf32-arm.h:2460
msgid " [VFP float format]"
msgstr ""
-#: elf32-arm.h:2416
+#: elf32-arm.h:2462
+msgid " [Maverick float format]"
+msgstr ""
+
+#: elf32-arm.h:2464
msgid " [FPA float format]"
msgstr ""
-#: elf32-arm.h:2425
+#: elf32-arm.h:2473
msgid " [new ABI]"
msgstr ""
-#: elf32-arm.h:2428
+#: elf32-arm.h:2476
msgid " [old ABI]"
msgstr ""
-#: elf32-arm.h:2431
+#: elf32-arm.h:2479
msgid " [software FP]"
msgstr ""
-#: elf32-arm.h:2439
+#: elf32-arm.h:2488
msgid " [Version1 EABI]"
msgstr ""
-#: elf32-arm.h:2442 elf32-arm.h:2453
+#: elf32-arm.h:2491 elf32-arm.h:2502
msgid " [sorted symbol table]"
msgstr ""
-#: elf32-arm.h:2444 elf32-arm.h:2455
+#: elf32-arm.h:2493 elf32-arm.h:2504
msgid " [unsorted symbol table]"
msgstr ""
-#: elf32-arm.h:2450
+#: elf32-arm.h:2499
msgid " [Version2 EABI]"
msgstr ""
-#: elf32-arm.h:2458
+#: elf32-arm.h:2507
msgid " [dynamic symbols use segment index]"
msgstr ""
-#: elf32-arm.h:2461
+#: elf32-arm.h:2510
msgid " [mapping symbols precede others]"
msgstr ""
-#: elf32-arm.h:2468
+#: elf32-arm.h:2517
msgid " <EABI version unrecognised>"
msgstr ""
-#: elf32-arm.h:2475
+#: elf32-arm.h:2524
msgid " [relocatable executable]"
msgstr ""
-#: elf32-arm.h:2478
+#: elf32-arm.h:2527
msgid " [has entry point]"
msgstr ""
-#: elf32-arm.h:2483
+#: elf32-arm.h:2532
msgid "<Unrecognised flag bits set>"
msgstr ""
-#: elf32-avr.c:841 elf32-cris.c:1411 elf32-fr30.c:643 elf32-frv.c:817
-#: elf32-i860.c:1039 elf32-openrisc.c:447 elf32-v850.c:1699
-#: elf32-xstormy16.c:941 elf64-mmix.c:1310
+#: elf32-avr.c:820 elf32-cris.c:1398 elf32-fr30.c:642 elf32-frv.c:823
+#: elf32-i860.c:1036 elf32-ip2k.c:1597 elf32-iq2000.c:707 elf32-msp430.c:518
+#: elf32-openrisc.c:444 elf32-v850.c:1785 elf32-xstormy16.c:984
+#: elf64-mmix.c:1340
msgid "internal error: dangerous relocation"
msgstr ""
-#: elf32-cris.c:949
+#: elf32-cris.c:931
#, c-format
msgid "%s: unresolvable relocation %s against symbol `%s' from %s section"
msgstr ""
-#: elf32-cris.c:1012
+#: elf32-cris.c:993
#, c-format
msgid ""
"%s: No PLT nor GOT for relocation %s against symbol `%s' from %s section"
msgstr ""
-#: elf32-cris.c:1015 elf32-cris.c:1141
+#: elf32-cris.c:996 elf32-cris.c:1122
msgid "[whose name is lost]"
msgstr ""
-#: elf32-cris.c:1130
+#: elf32-cris.c:1111
#, c-format
msgid ""
"%s: relocation %s with non-zero addend %d against local symbol from %s "
"section"
msgstr ""
-#: elf32-cris.c:1137
+#: elf32-cris.c:1118
#, c-format
msgid ""
"%s: relocation %s with non-zero addend %d against symbol `%s' from %s section"
msgstr ""
-#: elf32-cris.c:1155
+#: elf32-cris.c:1143
#, c-format
msgid ""
"%s: relocation %s is not allowed for global symbol: `%s' from %s section"
msgstr ""
-#: elf32-cris.c:1170
+#: elf32-cris.c:1158
#, c-format
msgid "%s: relocation %s in section %s with no GOT created"
msgstr ""
-#: elf32-cris.c:1288
+#: elf32-cris.c:1277
#, c-format
msgid "%s: Internal inconsistency; no relocation section %s"
msgstr ""
-#: elf32-cris.c:2514
+#: elf32-cris.c:2500
#, c-format
msgid ""
"%s, section %s:\n"
" relocation %s should not be used in a shared object; recompile with -fPIC"
msgstr ""
-#: elf32-cris.c:2992
+#: elf32-cris.c:2978
msgid " [symbols have a _ prefix]"
msgstr ""
-#: elf32-cris.c:3031
+#: elf32-cris.c:3017
#, c-format
msgid "%s: uses _-prefixed symbols, but writing file with non-prefixed symbols"
msgstr ""
-#: elf32-cris.c:3032
+#: elf32-cris.c:3018
#, c-format
msgid "%s: uses non-prefixed symbols, but writing file with _-prefixed symbols"
msgstr ""
-#: elf32-frv.c:1217
+#: elf32-frv.c:1223
#, c-format
msgid ""
"%s: compiled with %s and linked with modules that use non-pic relocations"
msgstr ""
-#: elf32-frv.c:1267
+#: elf32-frv.c:1273 elf32-iq2000.c:895
#, c-format
msgid "%s: compiled with %s and linked with modules compiled with %s"
msgstr ""
-#: elf32-frv.c:1279
+#: elf32-frv.c:1285
#, c-format
msgid ""
"%s: uses different unknown e_flags (0x%lx) fields than previous modules (0x%"
"lx)"
msgstr ""
-#: elf32-frv.c:1315
+#: elf32-frv.c:1321 elf32-iq2000.c:933
#, c-format
msgid "private flags = 0x%lx:"
msgstr ""
-#: elf32-gen.c:82 elf64-gen.c:82
+#: elf32-gen.c:83 elf64-gen.c:82
#, c-format
msgid "%s: Relocations in generic ELF (EM: %d)"
msgstr ""
-#: elf32-hppa.c:672 elf64-ppc.c:2324
+#: 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:3557
+#: elf32-hppa.c:957 elf32-hppa.c:3538
#, c-format
msgid "%s(%s+0x%lx): cannot reach %s, recompile with -ffunction-sections"
msgstr ""
-#: elf32-hppa.c:1340 elf64-x86-64.c:675
+#: 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 "
@@ -949,437 +893,601 @@ msgstr ""
msgid "Could not find relocation section for %s"
msgstr ""
-#: elf32-hppa.c:2857
+#: elf32-hppa.c:2828
#, c-format
msgid "%s: duplicate export stub %s"
msgstr ""
-#: elf32-hppa.c:3435
+#: elf32-hppa.c:3416
#, c-format
msgid "%s(%s+0x%lx): fixing %s"
msgstr ""
-#: elf32-hppa.c:4082
+#: elf32-hppa.c:4039
#, c-format
msgid "%s(%s+0x%lx): cannot handle %s for %s"
msgstr ""
-#: elf32-hppa.c:4395
+#: elf32-hppa.c:4357
msgid ".got section not immediately after .plt section"
msgstr ""
-#: elf32-i386.c:401
+#: elf32-i386.c:326
#, c-format
msgid "%s: invalid relocation type %d"
msgstr ""
-#: elf32-i386.c:916 elf32-s390.c:651 elf64-s390.c:597 elf64-x86-64.c:593
+#: elf32-i386.c:841 elf32-s390.c:990 elf32-sparc.c:887 elf32-xtensa.c:637
+#: elf64-s390.c:943 elf64-x86-64.c:650
#, c-format
msgid "%s: bad symbol index: %d"
msgstr ""
-#: elf32-i386.c:1025
+#: 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:1137 elf32-s390.c:810 elf64-ppc.c:2829 elf64-s390.c:761
-#: elf64-x86-64.c:763
+#: elf32-i386.c:1064 elf32-s390.c:1279 elf64-ppc.c:3929 elf64-s390.c:1243
+#: elf64-x86-64.c:886
#, c-format
msgid "%s: bad relocation section name `%s'"
msgstr ""
-#: elf32-i386.c:2990 elf32-s390.c:1983 elf32-sparc.c:1572 elf64-ppc.c:5941
-#: elf64-s390.c:1947 elf64-sparc.c:2578 elf64-x86-64.c:1950
+#: elf32-i386.c:2908 elf32-m68k.c:1757 elf32-s390.c:3022 elf32-sparc.c:2879
+#: elf32-xtensa.c:2193 elf64-s390.c:3018 elf64-sparc.c:2664
+#: elf64-x86-64.c:2452
#, c-format
msgid "%s(%s+0x%lx): unresolvable relocation against symbol `%s'"
msgstr ""
-#: elf32-i386.c:3029 elf32-s390.c:2021 elf64-ppc.c:6000 elf64-s390.c:1985
-#: elf64-x86-64.c:1988
+#: elf32-i386.c:2947 elf32-m68k.c:1796 elf32-s390.c:3072 elf64-s390.c:3068
+#: elf64-x86-64.c:2490
#, c-format
msgid "%s(%s+0x%lx): reloc against `%s': error %d"
msgstr ""
-#: elf32-m32r.c:926
+#: elf32-ip2k.c:565 elf32-ip2k.c:571 elf32-ip2k.c:734 elf32-ip2k.c:740
+msgid ""
+"ip2k relaxer: switch table without complete matching relocation information."
+msgstr ""
+
+#: elf32-ip2k.c:588 elf32-ip2k.c:767
+msgid "ip2k relaxer: switch table header corrupt."
+msgstr ""
+
+#: elf32-ip2k.c:1395
+#, c-format
+msgid "ip2k linker: missing page instruction at 0x%08lx (dest = 0x%08lx)."
+msgstr ""
+
+#: elf32-ip2k.c:1409
+#, c-format
+msgid "ip2k linker: redundant page instruction at 0x%08lx (dest = 0x%08lx)."
+msgstr ""
+
+#. Only if it's not an unresolved symbol.
+#: elf32-ip2k.c:1593
+msgid "unsupported relocation between data/insn address spaces"
+msgstr ""
+
+#: elf32-iq2000.c:907 elf32-m68hc1x.c:1431 elf32-ppc.c:2175 elf64-sparc.c:3072
+#: elfxx-mips.c:9197
+#, c-format
+msgid "%s: uses different e_flags (0x%lx) fields than previous modules (0x%lx)"
+msgstr ""
+
+#: elf32-m32r.c:930
msgid "SDA relocation when _SDA_BASE_ not defined"
msgstr ""
-#: elf32-m32r.c:1015 elf32-ppc.c:2987 elf64-alpha.c:4186 elf64-alpha.c:4314
-#: elf32-ia64.c:3693 elf64-ia64.c:3693
+#: 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:1223
+#: elf32-m32r.c:1226
#, c-format
msgid "%s: The target (%s) of an %s relocation is in the wrong section (%s)"
msgstr ""
-#: elf32-m32r.c:1949
+#: elf32-m32r.c:1952
#, c-format
msgid "%s: Instruction set mismatch with previous modules"
msgstr ""
-#: elf32-m32r.c:1972
+#: elf32-m32r.c:1975
#, c-format
msgid "private flags = %lx"
msgstr ""
-#: elf32-m32r.c:1977
+#: elf32-m32r.c:1980
msgid ": m32r instructions"
msgstr ""
-#: elf32-m32r.c:1978
+#: elf32-m32r.c:1981
msgid ": m32rx instructions"
msgstr ""
-#: elf32-m68k.c:413
+#: elf32-m68hc1x.c:1217
+#, c-format
+msgid ""
+"Reference to the far symbol `%s' using a wrong relocation may result in "
+"incorrect execution"
+msgstr ""
+
+#: elf32-m68hc1x.c:1240
+#, c-format
+msgid ""
+"banked address [%lx:%04lx] (%lx) is not in the same bank as current banked "
+"address [%lx:%04lx] (%lx)"
+msgstr ""
+
+#: elf32-m68hc1x.c:1259
+#, c-format
+msgid ""
+"reference to a banked address [%lx:%04lx] in the normal address space at %"
+"04lx"
+msgstr ""
+
+#: elf32-m68hc1x.c:1396
+#, c-format
+msgid ""
+"%s: linking files compiled for 16-bit integers (-mshort) and others for 32-"
+"bit integers"
+msgstr ""
+
+#: elf32-m68hc1x.c:1404
+#, c-format
+msgid ""
+"%s: linking files compiled for 32-bit double (-fshort-double) and others for "
+"64-bit double"
+msgstr ""
+
+#: elf32-m68hc1x.c:1414
+#, c-format
+msgid "%s: linking files compiled for HCS12 with others compiled for HC12"
+msgstr ""
+
+#: elf32-m68hc1x.c:1462
+msgid "[abi=32-bit int, "
+msgstr ""
+
+#: elf32-m68hc1x.c:1464
+msgid "[abi=16-bit int, "
+msgstr ""
+
+#: elf32-m68hc1x.c:1467
+msgid "64-bit double, "
+msgstr ""
+
+#: elf32-m68hc1x.c:1469
+msgid "32-bit double, "
+msgstr ""
+
+#: elf32-m68hc1x.c:1472
+msgid "cpu=HC11]"
+msgstr ""
+
+#: elf32-m68hc1x.c:1474
+msgid "cpu=HCS12]"
+msgstr ""
+
+#: elf32-m68hc1x.c:1476
+msgid "cpu=HC12]"
+msgstr ""
+
+#: elf32-m68hc1x.c:1479
+msgid " [memory=bank-model]"
+msgstr ""
+
+#: elf32-m68hc1x.c:1481
+msgid " [memory=flat]"
+msgstr ""
+
+#: elf32-m68k.c:400
msgid " [cpu32]"
msgstr ""
-#: elf32-m68k.c:416
+#: elf32-m68k.c:403
msgid " [m68000]"
msgstr ""
-#: elf32-mcore.c:354 elf32-mcore.c:457
+#: elf32-mcore.c:353 elf32-mcore.c:456
#, c-format
msgid "%s: Relocation %s (%d) is not currently supported.\n"
msgstr ""
-#: elf32-mcore.c:442
+#: elf32-mcore.c:441
#, c-format
msgid "%s: Unknown relocation type %d\n"
msgstr ""
-#: elf32-mips.c:1152 elf64-mips.c:1783
+#: elf32-mips.c:1170 elf64-mips.c:1717 elfn32-mips.c:1664
msgid "32bits gp relative relocation occurs for an external symbol"
msgstr ""
-#: elf32-mips.c:1301
+#: elf32-mips.c:1314 elf64-mips.c:1830 elfn32-mips.c:1783
#, c-format
msgid "Linking mips16 objects into %s format is not supported"
msgstr ""
-#: elf32-ppc.c:1460
+#: elf32-ppc.c:2056
+#, c-format
+msgid "generic linker can't handle %s"
+msgstr ""
+
+#: elf32-ppc.c:2138
#, c-format
msgid ""
"%s: compiled with -mrelocatable and linked with modules compiled normally"
msgstr ""
-#: elf32-ppc.c:1468
+#: elf32-ppc.c:2147
#, c-format
msgid ""
"%s: compiled normally and linked with modules compiled with -mrelocatable"
msgstr ""
-#: elf32-ppc.c:1494 elf64-sparc.c:2990 elfxx-mips.c:7717
+#: elf32-ppc.c:3413
#, c-format
-msgid "%s: uses different e_flags (0x%lx) fields than previous modules (0x%lx)"
+msgid "%s: relocation %s cannot be used when making a shared object"
msgstr ""
-#: elf32-ppc.c:1592
+#. It does not make sense to have a procedure linkage
+#. table entry for a local symbol.
+#: elf32-ppc.c:3619
#, c-format
-msgid "%s: Unknown special linker type %d"
+msgid "%s(%s+0x%lx): %s reloc against local symbol"
msgstr ""
-#: elf32-ppc.c:2273 elf32-ppc.c:2307 elf32-ppc.c:2342
+#: elf32-ppc.c:4862 elf64-ppc.c:7789
#, c-format
-msgid "%s: relocation %s cannot be used when making a shared object"
+msgid "%s: unknown relocation type %d for symbol %s"
msgstr ""
-#: elf32-ppc.c:3126 elf64-ppc.c:5496
+#: elf32-ppc.c:5113
#, c-format
-msgid "%s: unknown relocation type %d for symbol %s"
+msgid "%s(%s+0x%lx): non-zero addend on %s reloc against `%s'"
msgstr ""
-#: elf32-ppc.c:3489 elf32-ppc.c:3510 elf32-ppc.c:3560
+#: elf32-ppc.c:5399 elf32-ppc.c:5425 elf32-ppc.c:5484
#, c-format
msgid ""
-"%s: The target (%s) of a %s relocation is in the wrong output section (%s)"
+"%s: the target (%s) of a %s relocation is in the wrong output section (%s)"
msgstr ""
-#: elf32-ppc.c:3626
+#: elf32-ppc.c:5539
#, c-format
-msgid "%s: Relocation %s is not yet supported for symbol %s."
+msgid "%s: relocation %s is not yet supported for symbol %s."
msgstr ""
-#: elf32-sh.c:1973
+#: elf32-ppc.c:5594 elf64-ppc.c:8461
#, c-format
-msgid "%s: 0x%lx: warning: bad R_SH_USES offset"
+msgid "%s(%s+0x%lx): unresolvable %s relocation against symbol `%s'"
msgstr ""
-#: elf32-sh.c:1985
+#: elf32-ppc.c:5644 elf64-ppc.c:8507
#, c-format
-msgid "%s: 0x%lx: warning: R_SH_USES points to unrecognized insn 0x%x"
+msgid "%s(%s+0x%lx): %s reloc against `%s': error %d"
msgstr ""
-#: elf32-sh.c:2002
+#: elf32-ppc.c:5888
#, c-format
-msgid "%s: 0x%lx: warning: bad R_SH_USES load offset"
+msgid "corrupt or empty %s section in %s"
msgstr ""
-#: elf32-sh.c:2017
+#: elf32-ppc.c:5895
#, c-format
-msgid "%s: 0x%lx: warning: could not find expected reloc"
+msgid "unable to read in %s section from %s"
msgstr ""
-#: elf32-sh.c:2045
+#: elf32-ppc.c:5901
#, c-format
-msgid "%s: 0x%lx: warning: symbol in unexpected section"
+msgid "corrupt %s section in %s"
msgstr ""
-#: elf32-sh.c:2162
+#: elf32-ppc.c:5944
#, c-format
-msgid "%s: 0x%lx: warning: could not find expected COUNT reloc"
+msgid "warning: unable to set size of %s section in %s"
msgstr ""
-#: elf32-sh.c:2171
-#, c-format
-msgid "%s: 0x%lx: warning: bad count"
+#: elf32-ppc.c:5994
+msgid "failed to allocate space for new APUinfo section."
msgstr ""
-#: elf32-sh.c:2559 elf32-sh.c:2935
-#, c-format
-msgid "%s: 0x%lx: fatal: reloc overflow while relaxing"
+#: elf32-ppc.c:6013
+msgid "failed to compute new APUinfo section."
msgstr ""
-#: elf32-sh.c:4392 elf64-sh64.c:1576
-msgid "Unexpected STO_SH5_ISA32 on local symbol is not handled"
+#: elf32-ppc.c:6016
+msgid "failed to install new APUinfo section."
msgstr ""
-#: elf32-sh.c:4611
+#: elf32-s390.c:2256 elf64-s390.c:2226
#, c-format
-msgid "%s: 0x%lx: fatal: unaligned branch target for relax-support relocation"
+msgid "%s(%s+0x%lx): invalid instruction for TLS relocation %s"
msgstr ""
-#: elf32-sh64.c:203 elf64-sh64.c:2364
+#: elf32-sh64.c:221 elf64-sh64.c:2407
#, c-format
msgid "%s: compiled as 32-bit object and %s is 64-bit"
msgstr ""
-#: elf32-sh64.c:206 elf64-sh64.c:2367
+#: elf32-sh64.c:224 elf64-sh64.c:2410
#, c-format
msgid "%s: compiled as 64-bit object and %s is 32-bit"
msgstr ""
-#: elf32-sh64.c:208 elf64-sh64.c:2369
+#: elf32-sh64.c:226 elf64-sh64.c:2412
#, c-format
msgid "%s: object size does not match that of target %s"
msgstr ""
-#: elf32-sh64.c:443 elf64-sh64.c:2944
+#: elf32-sh64.c:461 elf64-sh64.c:2990
#, c-format
msgid "%s: encountered datalabel symbol in input"
msgstr ""
-#: elf32-sh64.c:526
+#: elf32-sh64.c:544
msgid "PTB mismatch: a SHmedia address (bit 0 == 1)"
msgstr ""
-#: elf32-sh64.c:529
+#: elf32-sh64.c:547
msgid "PTA mismatch: a SHcompact address (bit 0 == 0)"
msgstr ""
-#: elf32-sh64.c:547
+#: elf32-sh64.c:565
#, c-format
msgid "%s: GAS error: unexpected PTB insn with R_SH_PT_16"
msgstr ""
-#: elf32-sh64.c:596 elf64-sh64.c:1703
+#: elf32-sh64.c:614 elf64-sh64.c:1748
#, c-format
msgid "%s: error: unaligned relocation type %d at %08x reloc %08x\n"
msgstr ""
-#: elf32-sh64.c:680
+#: elf32-sh64.c:698
#, c-format
msgid "%s: could not write out added .cranges entries"
msgstr ""
-#: elf32-sh64.c:742
+#: elf32-sh64.c:760
#, c-format
msgid "%s: could not write out sorted .cranges entries"
msgstr ""
-#: elf32-sparc.c:1536 elf64-sparc.c:2224
+#: elf32-sh.c:2103
+#, c-format
+msgid "%s: 0x%lx: warning: bad R_SH_USES offset"
+msgstr ""
+
+#: elf32-sh.c:2115
+#, c-format
+msgid "%s: 0x%lx: warning: R_SH_USES points to unrecognized insn 0x%x"
+msgstr ""
+
+#: elf32-sh.c:2132
+#, c-format
+msgid "%s: 0x%lx: warning: bad R_SH_USES load offset"
+msgstr ""
+
+#: elf32-sh.c:2147
+#, c-format
+msgid "%s: 0x%lx: warning: could not find expected reloc"
+msgstr ""
+
+#: elf32-sh.c:2175
+#, c-format
+msgid "%s: 0x%lx: warning: symbol in unexpected section"
+msgstr ""
+
+#: elf32-sh.c:2300
+#, c-format
+msgid "%s: 0x%lx: warning: could not find expected COUNT reloc"
+msgstr ""
+
+#: elf32-sh.c:2309
+#, c-format
+msgid "%s: 0x%lx: warning: bad count"
+msgstr ""
+
+#: elf32-sh.c:2712 elf32-sh.c:3088
+#, c-format
+msgid "%s: 0x%lx: fatal: reloc overflow while relaxing"
+msgstr ""
+
+#: elf32-sh.c:4654 elf64-sh64.c:1585
+msgid "Unexpected STO_SH5_ISA32 on local symbol is not handled"
+msgstr ""
+
+#: elf32-sh.c:4809
+#, c-format
+msgid "%s: unresolvable relocation against symbol `%s' from %s section"
+msgstr ""
+
+#: elf32-sh.c:4881
+#, c-format
+msgid "%s: 0x%lx: fatal: unaligned branch target for relax-support relocation"
+msgstr ""
+
+#: elf32-sh.c:6627 elf64-alpha.c:4848
+#, c-format
+msgid "%s: TLS local exec code cannot be linked into shared objects"
+msgstr ""
+
+#: elf32-sparc.c:2521 elf64-sparc.c:2314
#, c-format
msgid "%s: probably compiled without -fPIC?"
msgstr ""
-#: elf32-sparc.c:2010
+#: elf32-sparc.c:3348
#, c-format
msgid "%s: compiled for a 64 bit system and target is 32 bit"
msgstr ""
-#: elf32-sparc.c:2024
+#: elf32-sparc.c:3362
#, c-format
msgid "%s: linking little endian files with big endian files"
msgstr ""
-#: elf32-v850.c:682
+#: elf32-v850.c:753
#, c-format
msgid "Variable `%s' cannot occupy in multiple small data regions"
msgstr ""
-#: elf32-v850.c:685
+#: elf32-v850.c:756
#, c-format
msgid ""
"Variable `%s' can only be in one of the small, zero, and tiny data regions"
msgstr ""
-#: elf32-v850.c:688
+#: elf32-v850.c:759
#, c-format
msgid ""
"Variable `%s' cannot be in both small and zero data regions simultaneously"
msgstr ""
-#: elf32-v850.c:691
+#: elf32-v850.c:762
#, c-format
msgid ""
"Variable `%s' cannot be in both small and tiny data regions simultaneously"
msgstr ""
-#: elf32-v850.c:694
+#: elf32-v850.c:765
#, c-format
msgid ""
"Variable `%s' cannot be in both zero and tiny data regions simultaneously"
msgstr ""
-#: elf32-v850.c:1072
+#: elf32-v850.c:1144
msgid "FAILED to find previous HI16 reloc\n"
msgstr ""
-#: elf32-v850.c:1703
+#: elf32-v850.c:1789
msgid "could not locate special linker symbol __gp"
msgstr ""
-#: elf32-v850.c:1707
+#: elf32-v850.c:1793
msgid "could not locate special linker symbol __ep"
msgstr ""
-#: elf32-v850.c:1711
+#: elf32-v850.c:1797
msgid "could not locate special linker symbol __ctbp"
msgstr ""
-#: elf32-v850.c:1875
+#: elf32-v850.c:1963
#, c-format
msgid "%s: Architecture mismatch with previous modules"
msgstr ""
-#: elf32-v850.c:1895
+#: elf32-v850.c:1983
#, c-format
msgid "private flags = %lx: "
msgstr ""
-#: elf32-v850.c:1900
+#: elf32-v850.c:1988
msgid "v850 architecture"
msgstr ""
-#: elf32-v850.c:1901
+#: elf32-v850.c:1989
msgid "v850e architecture"
msgstr ""
-#: elf32-v850.c:1902
-msgid "v850ea architecture"
-msgstr ""
-
-#: elf32-vax.c:551
+#: elf32-vax.c:549
msgid " [nonpic]"
msgstr ""
-#: elf32-vax.c:554
+#: elf32-vax.c:552
msgid " [d-float]"
msgstr ""
-#: elf32-vax.c:557
+#: elf32-vax.c:555
msgid " [g-float]"
msgstr ""
-#: elf32-vax.c:665
+#: elf32-vax.c:663
#, c-format
msgid ""
"%s: warning: GOT addend of %ld to `%s' does not match previous GOT addend of "
"%ld"
msgstr ""
-#: elf32-vax.c:1687
+#: elf32-vax.c:1667
#, c-format
msgid "%s: warning: PLT addend of %d to `%s' from %s section ignored"
msgstr ""
-#: elf32-vax.c:1822
+#: elf32-vax.c:1802
#, c-format
msgid "%s: warning: %s relocation against symbol `%s' from %s section"
msgstr ""
-#: elf32-vax.c:1828
+#: elf32-vax.c:1808
#, c-format
msgid "%s: warning: %s relocation to 0x%x from %s section"
msgstr ""
-#: elf32-xstormy16.c:414 elf32-ia64.c:2286 elf64-ia64.c:2286
+#: elf32-ia64.c:2326 elf32-xstormy16.c:462 elf64-ia64.c:2326
msgid "non-zero addend in @fptr reloc"
msgstr ""
-#: elf64-alpha.c:1097
+#: elf64-alpha.c:1108
msgid "GPDISP relocation did not find ldah and lda instructions"
msgstr ""
-#: elf64-alpha.c:3676
+#: elf64-alpha.c:3731
#, c-format
msgid "%s: .got subsegment exceeds 64K (size %d)"
msgstr ""
-#: elf64-alpha.c:4499 elf64-alpha.c:4511
+#: elf64-alpha.c:4602 elf64-alpha.c:4614
#, c-format
msgid "%s: gp-relative relocation against dynamic symbol %s"
msgstr ""
-#: elf64-alpha.c:4537 elf64-alpha.c:4677
+#: elf64-alpha.c:4640 elf64-alpha.c:4773
#, c-format
msgid "%s: pc-relative relocation against dynamic symbol %s"
msgstr ""
-#: elf64-alpha.c:4565
+#: elf64-alpha.c:4668
#, c-format
msgid "%s: change in gp: BRSGP %s"
msgstr ""
-#: elf64-alpha.c:4590
+#: elf64-alpha.c:4693
msgid "<unknown>"
msgstr ""
-#: elf64-alpha.c:4595
+#: elf64-alpha.c:4698
#, c-format
msgid "%s: !samegp reloc against symbol without .prologue: %s"
msgstr ""
-#: elf64-alpha.c:4640
+#: elf64-alpha.c:4749
#, c-format
msgid "%s: unhandled dynamic relocation against %s"
msgstr ""
-#: elf64-alpha.c:4753
+#: elf64-alpha.c:4832
#, c-format
msgid "%s: dtp-relative relocation against dynamic symbol %s"
msgstr ""
-#: elf64-alpha.c:4769
-#, c-format
-msgid "%s: TLS local exec code cannot be linked into shared objects"
-msgstr ""
-
-#: elf64-alpha.c:4776
+#: elf64-alpha.c:4855
#, c-format
msgid "%s: tp-relative relocation against dynamic symbol %s"
msgstr ""
-#: elf64-hppa.c:2080
+#: elf64-hppa.c:2086
#, c-format
msgid "stub entry for %s cannot load .plt, dp offset = %ld"
msgstr ""
-#: elf64-mmix.c:1002
+#: elf64-mmix.c:1032
#, c-format
msgid ""
"%s: Internal inconsistency error for value for\n"
@@ -1387,704 +1495,842 @@ msgid ""
"08lx\n"
msgstr ""
-#: elf64-mmix.c:1386
+#: elf64-mmix.c:1416
#, c-format
msgid ""
"%s: base-plus-offset relocation against register symbol: (unknown) in %s"
msgstr ""
-#: elf64-mmix.c:1391
+#: elf64-mmix.c:1421
#, c-format
msgid "%s: base-plus-offset relocation against register symbol: %s in %s"
msgstr ""
-#: elf64-mmix.c:1435
+#: elf64-mmix.c:1465
#, c-format
msgid "%s: register relocation against non-register symbol: (unknown) in %s"
msgstr ""
-#: elf64-mmix.c:1440
+#: elf64-mmix.c:1470
#, c-format
msgid "%s: register relocation against non-register symbol: %s in %s"
msgstr ""
-#: elf64-mmix.c:1477
+#: elf64-mmix.c:1507
#, c-format
msgid "%s: directive LOCAL valid only with a register or absolute value"
msgstr ""
-#: elf64-mmix.c:1505
+#: elf64-mmix.c:1535
#, c-format
msgid ""
"%s: LOCAL directive: Register $%ld is not a local register. First global "
"register is $%ld."
msgstr ""
-#: elf64-mmix.c:1965
+#: elf64-mmix.c:1994
#, c-format
msgid ""
"%s: Error: multiple definition of `%s'; start of %s is set in a earlier "
"linked file\n"
msgstr ""
-#: elf64-mmix.c:2024
+#: elf64-mmix.c:2053
msgid "Register section has contents\n"
msgstr ""
-#: elf64-mmix.c:2186
+#: elf64-mmix.c:2216
#, c-format
msgid ""
"Internal inconsistency: remaining %u != max %u.\n"
" Please report this bug."
msgstr ""
-#: elf64-ppc.c:1669 libbfd.c:1435
+#: elf64-ppc.c:2388 libbfd.c:831
#, c-format
msgid "%s: compiled for a big endian system and target is little endian"
msgstr ""
-#: elf64-ppc.c:1671 libbfd.c:1437
+#: elf64-ppc.c:2391 libbfd.c:833
#, c-format
msgid "%s: compiled for a little endian system and target is big endian"
msgstr ""
-#: elf64-ppc.c:3614
+#: elf64-ppc.c:4857
#, c-format
msgid "%s: unexpected reloc type %u in .opd section"
msgstr ""
-#: elf64-ppc.c:3634
+#: elf64-ppc.c:4877
#, c-format
msgid "%s: .opd is not a regular array of opd entries"
msgstr ""
-#: elf64-ppc.c:3676
+#: elf64-ppc.c:4897
#, c-format
msgid "%s: undefined sym `%s' in .opd section"
msgstr ""
-#: elf64-ppc.c:4421
+#: elf64-ppc.c:6136
#, c-format
msgid "can't find branch stub `%s'"
msgstr ""
-#: elf64-ppc.c:4460 elf64-ppc.c:4504
+#: elf64-ppc.c:6175 elf64-ppc.c:6250
#, c-format
msgid "linkage table error against `%s'"
msgstr ""
-#: elf64-ppc.c:4576
+#: elf64-ppc.c:6340
#, c-format
msgid "can't build branch stub `%s'"
msgstr ""
-#: elf64-ppc.c:5202
+#: elf64-ppc.c:7047
+msgid ".glink and .plt too far apart"
+msgstr ""
+
+#: elf64-ppc.c:7135
msgid "stubs don't match calculated size"
msgstr ""
-#: elf64-ppc.c:5851
+#: elf64-ppc.c:7147
#, c-format
-msgid "%s: Relocation %s is not supported for symbol %s."
+msgid ""
+"linker stubs in %u groups\n"
+" branch %lu\n"
+" toc adjust %lu\n"
+" long branch %lu\n"
+" long toc adj %lu\n"
+" plt call %lu"
+msgstr ""
+
+#: elf64-ppc.c:7723
+#, c-format
+msgid ""
+"%s(%s+0x%lx): automatic multiple TOCs not supported using your crt files; "
+"recompile with -mminimal-toc or upgrade gcc"
+msgstr ""
+
+#: elf64-ppc.c:7731
+#, c-format
+msgid ""
+"%s(%s+0x%lx): sibling call optimization to `%s' does not allow automatic "
+"multiple TOCs; recompile with -mminimal-toc or -fno-optimize-sibling-calls, "
+"or make `%s' extern"
+msgstr ""
+
+#: elf64-ppc.c:8329
+#, c-format
+msgid "%s: relocation %s is not supported for symbol %s."
msgstr ""
-#: elf64-ppc.c:5895
+#: elf64-ppc.c:8408
#, c-format
-msgid "%s: error: relocation %s not a multiple of 4"
+msgid "%s: error: relocation %s not a multiple of %d"
msgstr ""
-#: elf64-sparc.c:1280
+#: elf-hppa.h:1458 elf-hppa.h:1491 elf-m10300.c:1628 elf64-sh64.c:1704
+#, c-format
+msgid ""
+"%s: warning: unresolvable relocation against symbol `%s' from %s section"
+msgstr ""
+
+#: elf64-sparc.c:1370
#, c-format
msgid "%s: check_relocs: unhandled reloc type %d"
msgstr ""
-#: elf64-sparc.c:1317
+#: elf64-sparc.c:1407
#, c-format
msgid "%s: Only registers %%g[2367] can be declared using STT_REGISTER"
msgstr ""
-#: elf64-sparc.c:1337
+#: elf64-sparc.c:1427
#, c-format
msgid "Register %%g%d used incompatibly: %s in %s, previously %s in %s"
msgstr ""
-#: elf64-sparc.c:1360
+#: elf64-sparc.c:1450
#, c-format
msgid "Symbol `%s' has differing types: REGISTER in %s, previously %s in %s"
msgstr ""
-#: elf64-sparc.c:1406
+#: elf64-sparc.c:1496
#, c-format
msgid "Symbol `%s' has differing types: %s in %s, previously REGISTER in %s"
msgstr ""
-#: elf64-sparc.c:2971
+#: elf64-sparc.c:3053
#, c-format
msgid "%s: linking UltraSPARC specific with HAL specific code"
msgstr ""
-#: elfcode.h:1198
+#: elf64-x86-64.c:739
+#, c-format
+msgid "%s: %s' accessed both as normal and thread local symbol"
+msgstr ""
+
+#: elf.c:372
+#, c-format
+msgid "%s: invalid string offset %u >= %lu for section `%s'"
+msgstr ""
+
+#: elf.c:624
+#, c-format
+msgid "%s: invalid SHT_GROUP entry"
+msgstr ""
+
+#: elf.c:695
+#, c-format
+msgid "%s: no group info for section %s"
+msgstr ""
+
+#: elf.c:1055
+msgid ""
+"\n"
+"Program Header:\n"
+msgstr ""
+
+#: elf.c:1106
+msgid ""
+"\n"
+"Dynamic Section:\n"
+msgstr ""
+
+#: elf.c:1235
+msgid ""
+"\n"
+"Version definitions:\n"
+msgstr ""
+
+#: elf.c:1258
+msgid ""
+"\n"
+"Version References:\n"
+msgstr ""
+
+#: elf.c:1263
+#, c-format
+msgid " required from %s:\n"
+msgstr ""
+
+#: elf.c:1944
+#, c-format
+msgid "%s: invalid link %lu for reloc section %s (index %u)"
+msgstr ""
+
+#: elf.c:3686
+#, c-format
+msgid "%s: Not enough room for program headers (allocated %u, need %u)"
+msgstr ""
+
+#: elf.c:3791
+#, c-format
+msgid "%s: Not enough room for program headers, try linking with -N"
+msgstr ""
+
+#: elf.c:3922
+#, c-format
+msgid ""
+"Error: First section in segment (%s) starts at 0x%x whereas the segment "
+"starts at 0x%x"
+msgstr ""
+
+#: elf.c:4242
+#, c-format
+msgid "%s: warning: allocated section `%s' not in segment"
+msgstr ""
+
+#: elf.c:4566
+#, c-format
+msgid "%s: symbol `%s' required but not present"
+msgstr ""
+
+#: elf.c:4854
+#, c-format
+msgid "%s: warning: Empty loadable segment detected, is this intentional ?\n"
+msgstr ""
+
+#: elf.c:5485
+#, c-format
+msgid ""
+"Unable to find equivalent output section for symbol '%s' from section '%s'"
+msgstr ""
+
+#: elf.c:6298
+#, c-format
+msgid "%s: unsupported relocation type %s"
+msgstr ""
+
+#: elfcode.h:1113
#, c-format
msgid "%s: version count (%ld) does not match symbol count (%ld)"
msgstr ""
-#: elfcode.h:1433
+#: elfcode.h:1342
#, c-format
msgid "%s(%s): relocation %d has invalid symbol index %ld"
msgstr ""
-#: elflink.c:536
+#: elflink.c:1456
#, c-format
-msgid "%s: Section %s is too large to add hole of %ld bytes"
+msgid "%s: warning: unexpected redefinition of indirect versioned symbol `%s'"
msgstr ""
-#: elflink.h:1098
+#: elflink.c:1807
#, c-format
-msgid "%s: warning: unexpected redefinition of indirect versioned symbol `%s'"
+msgid "%s: undefined versioned symbol name %s"
msgstr ""
-#: elflink.h:1745
+#: elflink.c:2142
#, c-format
-msgid "%s: %s: invalid version %u (max %d)"
+msgid "%s: relocation size mismatch in %s section %s"
msgstr ""
-#: elflink.h:1786
+#: elflink.c:2434
#, c-format
-msgid "%s: %s: invalid needed version %d"
+msgid "warning: type and size of dynamic symbol `%s' are not defined"
msgstr ""
-#: elflink.h:1908
+#: elflink.h:1022
#, c-format
-msgid "Warning: size of symbol `%s' changed from %lu to %lu in %s"
+msgid "%s: %s: invalid version %u (max %d)"
msgstr ""
-#: elflink.h:3116
+#: elflink.h:1063
#, c-format
-msgid "%s: undefined version: %s"
+msgid "%s: %s: invalid needed version %d"
msgstr ""
-#: elflink.h:3182
+#: elflink.h:1238
#, c-format
-msgid "%s: .preinit_array section is not allowed in DSO"
+msgid "Warning: alignment %u of symbol `%s' in %s is smaller than %u in %s"
msgstr ""
-#: elflink.h:4039
+#: elflink.h:1252
#, c-format
-msgid "warning: type and size of dynamic symbol `%s' are not defined"
+msgid "Warning: size of symbol `%s' changed from %lu in %s to %lu in %s"
msgstr ""
-#: elflink.h:4354
+#: elflink.h:2160
#, c-format
-msgid "%s: undefined versioned symbol name %s"
+msgid "%s: undefined version: %s"
msgstr ""
-#: elflink.h:4595 elflink.h:4603 elflink.h:6494 elflink.h:7569
-msgid "Error: out of memory"
+#: elflink.h:2226
+#, c-format
+msgid "%s: .preinit_array section is not allowed in DSO"
msgstr ""
-#: elflink.h:4767
+#: elflink.h:3078
msgid "Not enough memory to sort relocations"
msgstr ""
-#: elflink.h:5668 elflink.h:5711
+#: elflink.h:3958 elflink.h:4001
#, c-format
msgid "%s: could not find output section %s"
msgstr ""
-#: elflink.h:5674
+#: elflink.h:3964
#, c-format
msgid "warning: %s section has zero size"
msgstr ""
-#: elflink.h:6261
+#: elflink.h:4483
#, c-format
-msgid "%s: could not find output section %s for input section %s"
+msgid "%s: %s symbol `%s' in %s is referenced by DSO"
msgstr ""
-#: elflink.h:6472
+#: elflink.h:4564
#, c-format
-msgid "%s: relocation size mismatch in %s section %s"
+msgid "%s: could not find output section %s for input section %s"
msgstr ""
-#: elflink.h:6862
+#: elflink.h:4666
#, c-format
-msgid "local symbols in discarded section %s"
+msgid "%s: %s symbol `%s' isn't defined"
msgstr ""
-#: elfxx-mips.c:734
+#: elflink.h:5053 elflink.h:5095
+msgid "%T: discarded in section `%s' from %s\n"
+msgstr ""
+
+#: elfxx-mips.c:887
msgid "static procedure (no name)"
msgstr ""
-#: elfxx-mips.c:1604
+#: elfxx-mips.c:1897
msgid "not enough GOT space for local GOT entries"
msgstr ""
-#: elfxx-mips.c:2755
+#: elfxx-mips.c:3691
#, c-format
msgid "%s: %s+0x%lx: jump to stub routine which is not jal"
msgstr ""
-#: elfxx-mips.c:4264
+#: elfxx-mips.c:5192
#, c-format
msgid "%s: Malformed reloc detected for section %s"
msgstr ""
-#: elfxx-mips.c:4342
+#: elfxx-mips.c:5266
#, c-format
msgid "%s: CALL16 reloc at 0x%lx not against global symbol"
msgstr ""
-#: elfxx-mips.c:7296
+#: elfxx-mips.c:8693
#, c-format
msgid "%s: illegal section name `%s'"
msgstr ""
-#: elfxx-mips.c:7610
+#: elfxx-mips.c:9027
+#, c-format
+msgid "%s: endianness incompatible with that of the selected emulation"
+msgstr ""
+
+#: elfxx-mips.c:9039
#, c-format
-msgid "%s: linking PIC files with non-PIC files"
+msgid "%s: ABI is incompatible with that of the selected emulation"
msgstr ""
-#: elfxx-mips.c:7620
+#: elfxx-mips.c:9106
#, c-format
-msgid "%s: linking abicalls files with non-abicalls files"
+msgid "%s: warning: linking PIC files with non-PIC files"
msgstr ""
-#: elfxx-mips.c:7649
+#: elfxx-mips.c:9123
#, c-format
-msgid "%s: ISA mismatch (-mips%d) with previous modules (-mips%d)"
+msgid "%s: linking 32-bit code with 64-bit code"
msgstr ""
-#: elfxx-mips.c:7671
+#: elfxx-mips.c:9151
#, c-format
-msgid "%s: ISA mismatch (%d) with previous modules (%d)"
+msgid "%s: linking %s module with previous %s modules"
msgstr ""
-#: elfxx-mips.c:7694
+#: elfxx-mips.c:9174
#, c-format
msgid "%s: ABI mismatch: linking %s module with previous %s modules"
msgstr ""
-#: elfxx-mips.c:7763
+#: elfxx-mips.c:9243
msgid " [abi=O32]"
msgstr ""
-#: elfxx-mips.c:7765
+#: elfxx-mips.c:9245
msgid " [abi=O64]"
msgstr ""
-#: elfxx-mips.c:7767
+#: elfxx-mips.c:9247
msgid " [abi=EABI32]"
msgstr ""
-#: elfxx-mips.c:7769
+#: elfxx-mips.c:9249
msgid " [abi=EABI64]"
msgstr ""
-#: elfxx-mips.c:7771
+#: elfxx-mips.c:9251
msgid " [abi unknown]"
msgstr ""
-#: elfxx-mips.c:7773
+#: elfxx-mips.c:9253
msgid " [abi=N32]"
msgstr ""
-#: elfxx-mips.c:7775
+#: elfxx-mips.c:9255
msgid " [abi=64]"
msgstr ""
-#: elfxx-mips.c:7777
+#: elfxx-mips.c:9257
msgid " [no abi set]"
msgstr ""
-#: elfxx-mips.c:7780
+#: elfxx-mips.c:9260
msgid " [mips1]"
msgstr ""
-#: elfxx-mips.c:7782
+#: elfxx-mips.c:9262
msgid " [mips2]"
msgstr ""
-#: elfxx-mips.c:7784
+#: elfxx-mips.c:9264
msgid " [mips3]"
msgstr ""
-#: elfxx-mips.c:7786
+#: elfxx-mips.c:9266
msgid " [mips4]"
msgstr ""
-#: elfxx-mips.c:7788
+#: elfxx-mips.c:9268
msgid " [mips5]"
msgstr ""
-#: elfxx-mips.c:7790
+#: elfxx-mips.c:9270
msgid " [mips32]"
msgstr ""
-#: elfxx-mips.c:7792
+#: elfxx-mips.c:9272
msgid " [mips64]"
msgstr ""
-#: elfxx-mips.c:7794
+#: elfxx-mips.c:9274
+msgid " [mips32r2]"
+msgstr ""
+
+#: elfxx-mips.c:9276
msgid " [unknown ISA]"
msgstr ""
-#: elfxx-mips.c:7797
+#: elfxx-mips.c:9279
msgid " [mdmx]"
msgstr ""
-#: elfxx-mips.c:7800
+#: elfxx-mips.c:9282
msgid " [mips16]"
msgstr ""
-#: elfxx-mips.c:7803
+#: elfxx-mips.c:9285
msgid " [32bitmode]"
msgstr ""
-#: elfxx-mips.c:7805
+#: elfxx-mips.c:9287
msgid " [not 32bitmode]"
msgstr ""
-#: i386linux.c:458 m68klinux.c:462 sparclinux.c:459
+#: i386linux.c:457 m68klinux.c:461 sparclinux.c:458
#, c-format
msgid "Output file requires shared library `%s'\n"
msgstr ""
-#: i386linux.c:466 m68klinux.c:470 sparclinux.c:467
+#: i386linux.c:465 m68klinux.c:469 sparclinux.c:466
#, c-format
msgid "Output file requires shared library `%s.so.%s'\n"
msgstr ""
-#: i386linux.c:655 i386linux.c:705 m68klinux.c:662 m68klinux.c:710
-#: sparclinux.c:657 sparclinux.c:707
+#: i386linux.c:654 i386linux.c:704 m68klinux.c:661 m68klinux.c:709
+#: sparclinux.c:656 sparclinux.c:706
#, c-format
msgid "Symbol %s not defined for fixups\n"
msgstr ""
-#: i386linux.c:729 m68klinux.c:734 sparclinux.c:731
+#: i386linux.c:728 m68klinux.c:733 sparclinux.c:730
msgid "Warning: fixup count mismatch\n"
msgstr ""
-#: ieee.c:235
+#: ieee.c:293
#, c-format
msgid "%s: string too long (%d chars, max 65535)"
msgstr ""
-#: ieee.c:365
+#: ieee.c:428
#, c-format
msgid "%s: unrecognized symbol `%s' flags 0x%x"
msgstr ""
-#: ieee.c:877
+#: ieee.c:938
#, c-format
msgid "%s: unimplemented ATI record %u for symbol %u"
msgstr ""
-#: ieee.c:902
+#: ieee.c:963
#, c-format
msgid "%s: unexpected ATN type %d in external part"
msgstr ""
-#: ieee.c:924
+#: ieee.c:985
#, c-format
msgid "%s: unexpected type after ATN"
msgstr ""
-#: ihex.c:255
+#: ihex.c:264
#, c-format
msgid "%s:%d: unexpected character `%s' in Intel Hex file\n"
msgstr ""
-#: ihex.c:363
+#: ihex.c:372
#, c-format
msgid "%s:%u: bad checksum in Intel Hex file (expected %u, found %u)"
msgstr ""
-#: ihex.c:417
+#: ihex.c:426
#, c-format
msgid "%s:%u: bad extended address record length in Intel Hex file"
msgstr ""
-#: ihex.c:434
+#: ihex.c:443
#, c-format
msgid "%s:%u: bad extended start address length in Intel Hex file"
msgstr ""
-#: ihex.c:451
+#: ihex.c:460
#, c-format
msgid "%s:%u: bad extended linear address record length in Intel Hex file"
msgstr ""
-#: ihex.c:468
+#: ihex.c:477
#, c-format
msgid "%s:%u: bad extended linear start address length in Intel Hex file"
msgstr ""
-#: ihex.c:485
+#: ihex.c:494
#, c-format
msgid "%s:%u: unrecognized ihex type %u in Intel Hex file\n"
msgstr ""
-#: ihex.c:610
+#: ihex.c:619
#, c-format
msgid "%s: internal error in ihex_read_section"
msgstr ""
-#: ihex.c:645
+#: ihex.c:654
#, c-format
msgid "%s: bad section length in ihex_read_section"
msgstr ""
-#: ihex.c:863
+#: ihex.c:872
#, c-format
msgid "%s: address 0x%s out of range for Intel Hex file"
msgstr ""
-#: libbfd.c:492
-#, c-format
-msgid "not mapping: data=%lx mapped=%d\n"
-msgstr ""
-
-#: libbfd.c:495
-msgid "not mapping: env var not set\n"
-msgstr ""
-
-#: libbfd.c:1466
+#: libbfd.c:861
#, c-format
msgid "Deprecated %s called at %s line %d in %s\n"
msgstr ""
-#: libbfd.c:1469
+#: libbfd.c:864
#, c-format
msgid "Deprecated %s called\n"
msgstr ""
-#: linker.c:1875
+#: linker.c:1829
#, c-format
msgid "%s: indirect symbol `%s' to `%s' is a loop"
msgstr ""
-#: linker.c:2778
+#: linker.c:2697
#, c-format
-msgid "Attempt to do relocateable link with %s input and %s output"
+msgid "Attempt to do relocatable link with %s input and %s output"
msgstr ""
-#: merge.c:892
+#: merge.c:896
#, c-format
msgid "%s: access beyond end of merged section (%ld + %ld)"
msgstr ""
-#: mmo.c:460
+#: mmo.c:503
#, c-format
msgid "%s: No core to allocate section name %s\n"
msgstr ""
-#: mmo.c:536
+#: mmo.c:579
#, c-format
msgid "%s: No core to allocate a symbol %d bytes long\n"
msgstr ""
-#: mmo.c:1245
+#: mmo.c:1287
#, c-format
msgid "%s: invalid mmo file: initialization value for $255 is not `Main'\n"
msgstr ""
-#: mmo.c:1391
+#: mmo.c:1433
#, c-format
msgid ""
"%s: unsupported wide character sequence 0x%02X 0x%02X after symbol name "
"starting with `%s'\n"
msgstr ""
-#: mmo.c:1633
+#: mmo.c:1674
#, c-format
msgid "%s: invalid mmo file: unsupported lopcode `%d'\n"
msgstr ""
-#: mmo.c:1643
+#: mmo.c:1684
#, c-format
msgid "%s: invalid mmo file: expected YZ = 1 got YZ = %d for lop_quote\n"
msgstr ""
-#: mmo.c:1679
+#: mmo.c:1720
#, c-format
msgid "%s: invalid mmo file: expected z = 1 or z = 2, got z = %d for lop_loc\n"
msgstr ""
-#: mmo.c:1725
+#: mmo.c:1766
#, c-format
msgid ""
"%s: invalid mmo file: expected z = 1 or z = 2, got z = %d for lop_fixo\n"
msgstr ""
-#: mmo.c:1764
+#: mmo.c:1805
#, c-format
msgid "%s: invalid mmo file: expected y = 0, got y = %d for lop_fixrx\n"
msgstr ""
-#: mmo.c:1773
+#: mmo.c:1814
#, c-format
msgid ""
"%s: invalid mmo file: expected z = 16 or z = 24, got z = %d for lop_fixrx\n"
msgstr ""
-#: mmo.c:1796
+#: mmo.c:1837
#, c-format
msgid ""
"%s: invalid mmo file: leading byte of operand word must be 0 or 1, got %d "
"for lop_fixrx\n"
msgstr ""
-#: mmo.c:1819
+#: mmo.c:1860
#, c-format
msgid "%s: cannot allocate file name for file number %d, %d bytes\n"
msgstr ""
-#: mmo.c:1839
+#: mmo.c:1880
#, c-format
msgid ""
"%s: invalid mmo file: file number %d `%s', was already entered as `%s'\n"
msgstr ""
-#: mmo.c:1852
+#: mmo.c:1893
#, c-format
msgid ""
"%s: invalid mmo file: file name for number %d was not specified before use\n"
msgstr ""
-#: mmo.c:1958
+#: mmo.c:1999
#, c-format
msgid ""
"%s: invalid mmo file: fields y and z of lop_stab non-zero, y: %d, z: %d\n"
msgstr ""
-#: mmo.c:1994
+#: mmo.c:2035
#, c-format
msgid "%s: invalid mmo file: lop_end not last item in file\n"
msgstr ""
-#: mmo.c:2007
+#: mmo.c:2048
#, c-format
msgid ""
"%s: invalid mmo file: YZ of lop_end (%ld) not equal to the number of tetras "
"to the preceding lop_stab (%ld)\n"
msgstr ""
-#: mmo.c:2670
+#: mmo.c:2698
#, c-format
msgid "%s: invalid symbol table: duplicate symbol `%s'\n"
msgstr ""
-#: mmo.c:2921
+#: mmo.c:2949
#, c-format
msgid ""
"%s: Bad symbol definition: `Main' set to %s rather than the start address %"
"s\n"
msgstr ""
-#: mmo.c:3011
+#: mmo.c:3039
#, c-format
msgid ""
"%s: warning: symbol table too large for mmo, larger than 65535 32-bit words: "
"%d. Only `Main' will be emitted.\n"
msgstr ""
-#: mmo.c:3056
+#: mmo.c:3084
#, c-format
msgid "%s: internal error, symbol table changed size from %d to %d words\n"
msgstr ""
-#: mmo.c:3111
+#: mmo.c:3139
#, c-format
msgid "%s: internal error, internal register section %s had contents\n"
msgstr ""
-#: mmo.c:3163
+#: mmo.c:3191
#, c-format
msgid "%s: no initialized registers; section length 0\n"
msgstr ""
-#: mmo.c:3169
+#: mmo.c:3197
#, c-format
msgid "%s: too many initialized registers; section length %ld\n"
msgstr ""
-#: mmo.c:3174
+#: mmo.c:3202
#, c-format
msgid ""
"%s: invalid start address for initialized registers of length %ld: 0x%lx%"
"08lx\n"
msgstr ""
-#: oasys.c:1029
+#: oasys.c:1052
#, c-format
msgid "%s: can not represent section `%s' in oasys"
msgstr ""
-#: osf-core.c:132
+#: osf-core.c:137
#, c-format
msgid "Unhandled OSF/1 core file section type %d\n"
msgstr ""
-#: pe-mips.c:658
+#. XXX code yet to be written.
+#: peicode.h:787
#, c-format
-msgid "%s: `ld -r' not supported with PE MIPS objects\n"
+msgid "%s: Unhandled import type; %x"
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:794
+#: peicode.h:792
#, c-format
-msgid "%s: unimplemented %s\n"
+msgid "%s: Unrecognised import type; %x"
msgstr ""
-#: pe-mips.c:820
+#: peicode.h:806
#, c-format
-msgid "%s: jump too far away\n"
+msgid "%s: Unrecognised import name type; %x"
msgstr ""
-#: pe-mips.c:847
+#: peicode.h:1164
#, c-format
-msgid "%s: bad pair/reflo after refhi\n"
+msgid "%s: Unrecognised machine type (0x%x) in Import Library Format archive"
msgstr ""
-#. XXX code yet to be written.
-#: peicode.h:785
+#: peicode.h:1176
#, c-format
-msgid "%s: Unhandled import type; %x"
+msgid ""
+"%s: Recognised but unhandled machine type (0x%x) in Import Library Format "
+"archive"
msgstr ""
-#: peicode.h:790
+#: peicode.h:1193
#, c-format
-msgid "%s: Unrecognised import type; %x"
+msgid "%s: size field is zero in Import Library Format header"
msgstr ""
-#: peicode.h:804
+#: peicode.h:1224
#, c-format
-msgid "%s: Unrecognised import name type; %x"
+msgid "%s: string not null terminated in ILF object file."
msgstr ""
-#: peicode.h:1162
+#: pe-mips.c:659
#, c-format
-msgid "%s: Unrecognised machine type (0x%x) in Import Library Format archive"
+msgid "%s: `ld -r' not supported with PE MIPS objects\n"
msgstr ""
-#: peicode.h:1174
+#. 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: Recognised but unhandled machine type (0x%x) in Import Library Format "
-"archive"
+msgid "%s: unimplemented %s\n"
msgstr ""
-#: peicode.h:1191
+#: pe-mips.c:821
#, c-format
-msgid "%s: size field is zero in Import Library Format header"
+msgid "%s: jump too far away\n"
msgstr ""
-#: peicode.h:1222
+#: pe-mips.c:848
#, c-format
-msgid "%s: string not null terminated in ILF object file."
+msgid "%s: bad pair/reflo after refhi\n"
msgstr ""
#: ppcboot.c:416
@@ -2135,7 +2381,7 @@ msgstr ""
msgid "Partition[%d] length = 0x%.8lx (%ld)\n"
msgstr ""
-#: som.c:5398
+#: som.c:5422
msgid "som_sizeof_headers unimplemented"
msgstr ""
@@ -2149,7 +2395,7 @@ msgstr ""
msgid "%s(%s+0x%lx): Stabs entry has invalid string index."
msgstr ""
-#: syms.c:1044
+#: syms.c:1019
msgid "Unsupported .stab relocation"
msgstr ""
@@ -2168,12 +2414,12 @@ msgstr ""
msgid "Size mismatch section %s=%lx, %s=%lx"
msgstr ""
-#: vms-gsd.c:702
+#: vms-gsd.c:704
#, c-format
msgid "unknown gsd/egsd subtype %d"
msgstr ""
-#: vms-hdr.c:406
+#: vms-hdr.c:408
msgid "Object module NOT error-free !\n"
msgstr ""
@@ -2199,31 +2445,31 @@ msgstr ""
msgid "Symbol %s replaced by %s\n"
msgstr ""
-#: vms-misc.c:1116
+#: vms-misc.c:1117
#, c-format
msgid "failed to enter %s"
msgstr ""
-#: vms-tir.c:81
+#: vms-tir.c:102
msgid "No Mem !"
msgstr ""
-#: vms-tir.c:362
+#: vms-tir.c:383
#, c-format
msgid "bad section index in %s"
msgstr ""
-#: vms-tir.c:375
+#: vms-tir.c:396
#, c-format
msgid "unsupported STA cmd %s"
msgstr ""
-#: vms-tir.c:380 vms-tir.c:1240
+#: vms-tir.c:401 vms-tir.c:1261
#, c-format
msgid "reserved STA cmd %d"
msgstr ""
-#: vms-tir.c:491 vms-tir.c:514
+#: vms-tir.c:512 vms-tir.c:535
#, c-format
msgid "%s: no symbol \"%s\""
msgstr ""
@@ -2232,39 +2478,39 @@ msgstr ""
#. rotate
#. Redefine symbol to current location.
#. Define a literal.
-#: vms-tir.c:581 vms-tir.c:693 vms-tir.c:803 vms-tir.c:821 vms-tir.c:829
-#: vms-tir.c:838 vms-tir.c:1563
+#: vms-tir.c:602 vms-tir.c:714 vms-tir.c:824 vms-tir.c:842 vms-tir.c:850
+#: vms-tir.c:859 vms-tir.c:1584
#, c-format
msgid "%s: not supported"
msgstr ""
-#: vms-tir.c:586 vms-tir.c:1418
+#: vms-tir.c:607 vms-tir.c:1439
#, c-format
msgid "%s: not implemented"
msgstr ""
-#: vms-tir.c:590 vms-tir.c:1422
+#: vms-tir.c:611 vms-tir.c:1443
#, c-format
msgid "reserved STO cmd %d"
msgstr ""
-#: vms-tir.c:708 vms-tir.c:1568
+#: vms-tir.c:729 vms-tir.c:1589
#, c-format
msgid "reserved OPR cmd %d"
msgstr ""
-#: vms-tir.c:776 vms-tir.c:1632
+#: vms-tir.c:797 vms-tir.c:1653
#, c-format
msgid "reserved CTL cmd %d"
msgstr ""
#. stack byte from image
#. arg: none.
-#: vms-tir.c:1148
+#: vms-tir.c:1169
msgid "stack-from-image not implemented"
msgstr ""
-#: vms-tir.c:1166
+#: vms-tir.c:1187
msgid "stack-entry-mask not fully implemented"
msgstr ""
@@ -2275,99 +2521,99 @@ msgstr ""
#.
#. compare argument descriptor with symbol argument (ARG$V_PASSMECH)
#. and stack TRUE (args match) or FALSE (args dont match) value.
-#: vms-tir.c:1180
+#: vms-tir.c:1201
msgid "PASSMECH not fully implemented"
msgstr ""
-#: vms-tir.c:1199
+#: vms-tir.c:1220
msgid "stack-local-symbol not fully implemented"
msgstr ""
-#: vms-tir.c:1212
+#: vms-tir.c:1233
msgid "stack-literal not fully implemented"
msgstr ""
-#: vms-tir.c:1233
+#: vms-tir.c:1254
msgid "stack-local-symbol-entry-point-mask not fully implemented"
msgstr ""
-#: vms-tir.c:1510 vms-tir.c:1522 vms-tir.c:1534 vms-tir.c:1546 vms-tir.c:1611
-#: vms-tir.c:1619 vms-tir.c:1627
+#: vms-tir.c:1531 vms-tir.c:1543 vms-tir.c:1555 vms-tir.c:1567 vms-tir.c:1632
+#: vms-tir.c:1640 vms-tir.c:1648
#, c-format
msgid "%s: not fully implemented"
msgstr ""
-#: vms-tir.c:1684
+#: vms-tir.c:1705
#, c-format
msgid "obj code %d not found"
msgstr ""
-#: vms-tir.c:2019
+#: vms-tir.c:2043
#, c-format
msgid "SEC_RELOC with no relocs in section %s"
msgstr ""
-#: vms-tir.c:2307
+#: vms-tir.c:2331
#, c-format
msgid "Unhandled relocation %s"
msgstr ""
-#: xcofflink.c:1243
+#: xcofflink.c:1244
#, c-format
msgid "%s: `%s' has line numbers but no enclosing section"
msgstr ""
-#: xcofflink.c:1296
+#: xcofflink.c:1297
#, c-format
msgid "%s: class %d symbol `%s' has no aux entries"
msgstr ""
-#: xcofflink.c:1319
+#: xcofflink.c:1320
#, c-format
msgid "%s: symbol `%s' has unrecognized csect type %d"
msgstr ""
-#: xcofflink.c:1331
+#: xcofflink.c:1332
#, c-format
msgid "%s: bad XTY_ER symbol `%s': class %d scnum %d scnlen %d"
msgstr ""
-#: xcofflink.c:1367
+#: xcofflink.c:1368
#, c-format
msgid "%s: XMC_TC0 symbol `%s' is class %d scnlen %d"
msgstr ""
-#: xcofflink.c:1519
+#: xcofflink.c:1520
#, c-format
msgid "%s: csect `%s' not in enclosing section"
msgstr ""
-#: xcofflink.c:1626
+#: xcofflink.c:1627
#, c-format
msgid "%s: misplaced XTY_LD `%s'"
msgstr ""
-#: xcofflink.c:1957
+#: xcofflink.c:1958
#, c-format
msgid "%s: reloc %s:%d not in csect"
msgstr ""
-#: xcofflink.c:2094
+#: xcofflink.c:2095
#, c-format
msgid "%s: XCOFF shared object when not producing XCOFF output"
msgstr ""
-#: xcofflink.c:2115
+#: xcofflink.c:2116
#, c-format
msgid "%s: dynamic object with no .loader section"
msgstr ""
-#: xcofflink.c:2760
+#: xcofflink.c:2761
#, c-format
msgid "%s: no such symbol"
msgstr ""
-#: xcofflink.c:2893
+#: xcofflink.c:2894
msgid "error: undefined symbol __rtinit"
msgstr ""
@@ -2376,234 +2622,244 @@ msgstr ""
msgid "warning: attempt to export undefined symbol `%s'"
msgstr ""
-#: xcofflink.c:4449
+#: xcofflink.c:4448
#, c-format
msgid "TOC overflow: 0x%lx > 0x10000; try -mminimal-toc when compiling"
msgstr ""
-#: xcofflink.c:5289 xcofflink.c:5758 xcofflink.c:5820 xcofflink.c:6124
+#: xcofflink.c:5288 xcofflink.c:5755 xcofflink.c:5817 xcofflink.c:6119
#, c-format
msgid "%s: loader reloc in unrecognized section `%s'"
msgstr ""
-#: xcofflink.c:5311 xcofflink.c:6135
+#: xcofflink.c:5310 xcofflink.c:6130
#, c-format
msgid "%s: `%s' in loader reloc but not loader sym"
msgstr ""
-#: xcofflink.c:5326
+#: xcofflink.c:5325
#, c-format
msgid "%s: loader reloc in read-only section %s"
msgstr ""
-#: elf32-ia64.c:2228 elf64-ia64.c:2228
+#: elf32-ia64.c:2271 elf64-ia64.c:2271
msgid "@pltoff reloc against local symbol"
msgstr ""
-#: elf32-ia64.c:3568 elf64-ia64.c:3568
+#: elf32-ia64.c:3663 elf64-ia64.c:3663
#, c-format
msgid "%s: short data segment overflowed (0x%lx >= 0x400000)"
msgstr ""
-#: elf32-ia64.c:3579 elf64-ia64.c:3579
+#: elf32-ia64.c:3674 elf64-ia64.c:3674
#, c-format
msgid "%s: __gp does not cover short data segment"
msgstr ""
-#: elf32-ia64.c:3864 elf64-ia64.c:3864
+#: elf32-ia64.c:3986 elf64-ia64.c:3986
#, c-format
msgid "%s: linking non-pic code in a shared library"
msgstr ""
-#: elf32-ia64.c:3897 elf64-ia64.c:3897
+#: elf32-ia64.c:4017 elf64-ia64.c:4017
#, c-format
msgid "%s: @gprel relocation against dynamic symbol %s"
msgstr ""
-#: elf32-ia64.c:4036 elf64-ia64.c:4036
+#: elf32-ia64.c:4077 elf64-ia64.c:4077
+#, c-format
+msgid "%s: linking non-pic code in a position independent executable"
+msgstr ""
+
+#: elf32-ia64.c:4214 elf64-ia64.c:4214
+#, c-format
+msgid "%s: @internal branch to dynamic symbol %s"
+msgstr ""
+
+#: elf32-ia64.c:4216 elf64-ia64.c:4216
#, c-format
-msgid "%s: dynamic relocation against speculation fixup"
+msgid "%s: speculation fixup to dynamic symbol %s"
msgstr ""
-#: elf32-ia64.c:4044 elf64-ia64.c:4044
+#: elf32-ia64.c:4218 elf64-ia64.c:4218
#, c-format
-msgid "%s: speculation fixup against undefined weak symbol"
+msgid "%s: @pcrel relocation against dynamic symbol %s"
msgstr ""
-#: elf32-ia64.c:4277 elf64-ia64.c:4277
+#: elf32-ia64.c:4430 elf64-ia64.c:4430
msgid "unsupported reloc"
msgstr ""
-#: elf32-ia64.c:4557 elf64-ia64.c:4557
+#: elf32-ia64.c:4709 elf64-ia64.c:4709
#, c-format
msgid "%s: linking trap-on-NULL-dereference with non-trapping files"
msgstr ""
-#: elf32-ia64.c:4566 elf64-ia64.c:4566
+#: elf32-ia64.c:4718 elf64-ia64.c:4718
#, c-format
msgid "%s: linking big-endian files with little-endian files"
msgstr ""
-#: elf32-ia64.c:4575 elf64-ia64.c:4575
+#: elf32-ia64.c:4727 elf64-ia64.c:4727
#, c-format
msgid "%s: linking 64-bit files with 32-bit files"
msgstr ""
-#: elf32-ia64.c:4584 elf64-ia64.c:4584
+#: elf32-ia64.c:4736 elf64-ia64.c:4736
#, c-format
msgid "%s: linking constant-gp files with non-constant-gp files"
msgstr ""
-#: elf32-ia64.c:4594 elf64-ia64.c:4594
+#: elf32-ia64.c:4746 elf64-ia64.c:4746
#, c-format
msgid "%s: linking auto-pic files with non-auto-pic files"
msgstr ""
-#: peigen.c:962 pepigen.c:962
+#: peigen.c:985 pepigen.c:985
#, c-format
msgid "%s: line number overflow: 0x%lx > 0xffff"
msgstr ""
-#: peigen.c:979 pepigen.c:979
+#: peigen.c:1002 pepigen.c:1002
#, c-format
msgid "%s: reloc overflow 1: 0x%lx > 0xffff"
msgstr ""
-#: peigen.c:993 pepigen.c:993
+#: peigen.c:1016 pepigen.c:1016
msgid "Export Directory [.edata (or where ever we found it)]"
msgstr ""
-#: peigen.c:994 pepigen.c:994
+#: peigen.c:1017 pepigen.c:1017
msgid "Import Directory [parts of .idata]"
msgstr ""
-#: peigen.c:995 pepigen.c:995
+#: peigen.c:1018 pepigen.c:1018
msgid "Resource Directory [.rsrc]"
msgstr ""
-#: peigen.c:996 pepigen.c:996
+#: peigen.c:1019 pepigen.c:1019
msgid "Exception Directory [.pdata]"
msgstr ""
-#: peigen.c:997 pepigen.c:997
+#: peigen.c:1020 pepigen.c:1020
msgid "Security Directory"
msgstr ""
-#: peigen.c:998 pepigen.c:998
+#: peigen.c:1021 pepigen.c:1021
msgid "Base Relocation Directory [.reloc]"
msgstr ""
-#: peigen.c:999 pepigen.c:999
+#: peigen.c:1022 pepigen.c:1022
msgid "Debug Directory"
msgstr ""
-#: peigen.c:1000 pepigen.c:1000
+#: peigen.c:1023 pepigen.c:1023
msgid "Description Directory"
msgstr ""
-#: peigen.c:1001 pepigen.c:1001
+#: peigen.c:1024 pepigen.c:1024
msgid "Special Directory"
msgstr ""
-#: peigen.c:1002 pepigen.c:1002
+#: peigen.c:1025 pepigen.c:1025
msgid "Thread Storage Directory [.tls]"
msgstr ""
-#: peigen.c:1003 pepigen.c:1003
+#: peigen.c:1026 pepigen.c:1026
msgid "Load Configuration Directory"
msgstr ""
-#: peigen.c:1004 pepigen.c:1004
+#: peigen.c:1027 pepigen.c:1027
msgid "Bound Import Directory"
msgstr ""
-#: peigen.c:1005 pepigen.c:1005
+#: peigen.c:1028 pepigen.c:1028
msgid "Import Address Table Directory"
msgstr ""
-#: peigen.c:1006 pepigen.c:1006
+#: peigen.c:1029 pepigen.c:1029
msgid "Delay Import Directory"
msgstr ""
-#: peigen.c:1007 peigen.c:1008 pepigen.c:1007 pepigen.c:1008
+#: peigen.c:1030 peigen.c:1031 pepigen.c:1030 pepigen.c:1031
msgid "Reserved"
msgstr ""
-#: peigen.c:1071 pepigen.c:1071
+#: peigen.c:1094 pepigen.c:1094
msgid ""
"\n"
"There is an import table, but the section containing it could not be found\n"
msgstr ""
-#: peigen.c:1076 pepigen.c:1076
+#: peigen.c:1099 pepigen.c:1099
#, c-format
msgid ""
"\n"
"There is an import table in %s at 0x%lx\n"
msgstr ""
-#: peigen.c:1113 pepigen.c:1113
+#: peigen.c:1136 pepigen.c:1136
#, c-format
msgid ""
"\n"
"Function descriptor located at the start address: %04lx\n"
msgstr ""
-#: peigen.c:1116 pepigen.c:1116
+#: peigen.c:1139 pepigen.c:1139
#, c-format
msgid "\tcode-base %08lx toc (loadable/actual) %08lx/%08lx\n"
msgstr ""
-#: peigen.c:1122 pepigen.c:1122
+#: peigen.c:1145 pepigen.c:1145
msgid ""
"\n"
"No reldata section! Function descriptor not decoded.\n"
msgstr ""
-#: peigen.c:1127 pepigen.c:1127
+#: peigen.c:1150 pepigen.c:1150
#, c-format
msgid ""
"\n"
"The Import Tables (interpreted %s section contents)\n"
msgstr ""
-#: peigen.c:1130 pepigen.c:1130
+#: peigen.c:1153 pepigen.c:1153
msgid ""
" vma: Hint Time Forward DLL First\n"
" Table Stamp Chain Name Thunk\n"
msgstr ""
-#: peigen.c:1181 pepigen.c:1181
+#: peigen.c:1204 pepigen.c:1204
#, c-format
msgid ""
"\n"
"\tDLL Name: %s\n"
msgstr ""
-#: peigen.c:1192 pepigen.c:1192
+#: peigen.c:1215 pepigen.c:1215
msgid "\tvma: Hint/Ord Member-Name Bound-To\n"
msgstr ""
-#: peigen.c:1217 pepigen.c:1217
+#: peigen.c:1240 pepigen.c:1240
msgid ""
"\n"
"There is a first thunk, but the section containing it could not be found\n"
msgstr ""
-#: peigen.c:1357 pepigen.c:1357
+#: peigen.c:1380 pepigen.c:1380
msgid ""
"\n"
"There is an export table, but the section containing it could not be found\n"
msgstr ""
-#: peigen.c:1362 pepigen.c:1362
+#: peigen.c:1385 pepigen.c:1385
#, c-format
msgid ""
"\n"
"There is an export table in %s at 0x%lx\n"
msgstr ""
-#: peigen.c:1393 pepigen.c:1393
+#: peigen.c:1416 pepigen.c:1416
#, c-format
msgid ""
"\n"
@@ -2611,129 +2867,129 @@ msgid ""
"\n"
msgstr ""
-#: peigen.c:1397 pepigen.c:1397
+#: peigen.c:1420 pepigen.c:1420
#, c-format
msgid "Export Flags \t\t\t%lx\n"
msgstr ""
-#: peigen.c:1400 pepigen.c:1400
+#: peigen.c:1423 pepigen.c:1423
#, c-format
msgid "Time/Date stamp \t\t%lx\n"
msgstr ""
-#: peigen.c:1403 pepigen.c:1403
+#: peigen.c:1426 pepigen.c:1426
#, c-format
msgid "Major/Minor \t\t\t%d/%d\n"
msgstr ""
-#: peigen.c:1406 pepigen.c:1406
+#: peigen.c:1429 pepigen.c:1429
msgid "Name \t\t\t\t"
msgstr ""
-#: peigen.c:1412 pepigen.c:1412
+#: peigen.c:1435 pepigen.c:1435
#, c-format
msgid "Ordinal Base \t\t\t%ld\n"
msgstr ""
-#: peigen.c:1415 pepigen.c:1415
+#: peigen.c:1438 pepigen.c:1438
msgid "Number in:\n"
msgstr ""
-#: peigen.c:1418 pepigen.c:1418
+#: peigen.c:1441 pepigen.c:1441
#, c-format
msgid "\tExport Address Table \t\t%08lx\n"
msgstr ""
-#: peigen.c:1422 pepigen.c:1422
+#: peigen.c:1445 pepigen.c:1445
#, c-format
msgid "\t[Name Pointer/Ordinal] Table\t%08lx\n"
msgstr ""
-#: peigen.c:1425 pepigen.c:1425
+#: peigen.c:1448 pepigen.c:1448
msgid "Table Addresses\n"
msgstr ""
-#: peigen.c:1428 pepigen.c:1428
+#: peigen.c:1451 pepigen.c:1451
msgid "\tExport Address Table \t\t"
msgstr ""
-#: peigen.c:1433 pepigen.c:1433
+#: peigen.c:1456 pepigen.c:1456
msgid "\tName Pointer Table \t\t"
msgstr ""
-#: peigen.c:1438 pepigen.c:1438
+#: peigen.c:1461 pepigen.c:1461
msgid "\tOrdinal Table \t\t\t"
msgstr ""
-#: peigen.c:1453 pepigen.c:1453
+#: peigen.c:1476 pepigen.c:1476
#, c-format
msgid ""
"\n"
"Export Address Table -- Ordinal Base %ld\n"
msgstr ""
-#: peigen.c:1472 pepigen.c:1472
+#: peigen.c:1495 pepigen.c:1495
msgid "Forwarder RVA"
msgstr ""
-#: peigen.c:1483 pepigen.c:1483
+#: peigen.c:1506 pepigen.c:1506
msgid "Export RVA"
msgstr ""
-#: peigen.c:1490 pepigen.c:1490
+#: peigen.c:1513 pepigen.c:1513
msgid ""
"\n"
"[Ordinal/Name Pointer] Table\n"
msgstr ""
-#: peigen.c:1545 pepigen.c:1545
+#: peigen.c:1568 pepigen.c:1568
#, c-format
msgid "Warning, .pdata section size (%ld) is not a multiple of %d\n"
msgstr ""
-#: peigen.c:1549 pepigen.c:1549
+#: peigen.c:1572 pepigen.c:1572
msgid ""
"\n"
"The Function Table (interpreted .pdata section contents)\n"
msgstr ""
-#: peigen.c:1552 pepigen.c:1552
+#: peigen.c:1575 pepigen.c:1575
msgid " vma:\t\t\tBegin Address End Address Unwind Info\n"
msgstr ""
-#: peigen.c:1554 pepigen.c:1554
+#: peigen.c:1577 pepigen.c:1577
msgid ""
" vma:\t\tBegin End EH EH PrologEnd Exception\n"
" \t\tAddress Address Handler Data Address Mask\n"
msgstr ""
-#: peigen.c:1624 pepigen.c:1624
+#: peigen.c:1647 pepigen.c:1647
msgid " Register save millicode"
msgstr ""
-#: peigen.c:1627 pepigen.c:1627
+#: peigen.c:1650 pepigen.c:1650
msgid " Register restore millicode"
msgstr ""
-#: peigen.c:1630 pepigen.c:1630
+#: peigen.c:1653 pepigen.c:1653
msgid " Glue code sequence"
msgstr ""
-#: peigen.c:1682 pepigen.c:1682
+#: peigen.c:1705 pepigen.c:1705
msgid ""
"\n"
"\n"
"PE File Base Relocations (interpreted .reloc section contents)\n"
msgstr ""
-#: peigen.c:1712 pepigen.c:1712
+#: peigen.c:1735 pepigen.c:1735
#, c-format
msgid ""
"\n"
"Virtual Address: %08lx Chunk size %ld (0x%lx) Number of fixups %ld\n"
msgstr ""
-#: peigen.c:1725 pepigen.c:1725
+#: peigen.c:1748 pepigen.c:1748
#, c-format
msgid "\treloc %4d offset %4x [%4lx] %s"
msgstr ""
@@ -2741,7 +2997,7 @@ 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:1765 pepigen.c:1765
+#: peigen.c:1788 pepigen.c:1788
#, c-format
msgid ""
"\n"
diff --git a/contrib/binutils/bfd/ppcboot.c b/contrib/binutils/bfd/ppcboot.c
index 5b153bd..05fb7de 100644
--- a/contrib/binutils/bfd/ppcboot.c
+++ b/contrib/binutils/bfd/ppcboot.c
@@ -1,5 +1,5 @@
/* BFD back-end for PPCbug boot records.
- Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002
+ Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
Free Software Foundation, Inc.
Written by Michael Meissner, Cygnus Support, <meissner@cygnus.com>
@@ -87,27 +87,27 @@ typedef struct ppcboot_data {
a start symbol, an end symbol, and an absolute length symbol. */
#define PPCBOOT_SYMS 3
-static boolean ppcboot_mkobject PARAMS ((bfd *));
+static bfd_boolean ppcboot_mkobject PARAMS ((bfd *));
static const bfd_target *ppcboot_object_p PARAMS ((bfd *));
-static boolean ppcboot_set_arch_mach
+static bfd_boolean ppcboot_set_arch_mach
PARAMS ((bfd *, enum bfd_architecture, unsigned long));
-static boolean ppcboot_get_section_contents
+static bfd_boolean ppcboot_get_section_contents
PARAMS ((bfd *, asection *, PTR, file_ptr, bfd_size_type));
static long ppcboot_get_symtab_upper_bound PARAMS ((bfd *));
static char *mangle_name PARAMS ((bfd *, char *));
-static long ppcboot_get_symtab PARAMS ((bfd *, asymbol **));
+static long ppcboot_canonicalize_symtab PARAMS ((bfd *, asymbol **));
static void ppcboot_get_symbol_info PARAMS ((bfd *, asymbol *, symbol_info *));
-static boolean ppcboot_set_section_contents
- PARAMS ((bfd *, asection *, PTR, file_ptr, bfd_size_type));
-static int ppcboot_sizeof_headers PARAMS ((bfd *, boolean));
-static boolean ppcboot_bfd_print_private_bfd_data PARAMS ((bfd *, PTR));
+static bfd_boolean ppcboot_set_section_contents
+ PARAMS ((bfd *, asection *, const PTR, file_ptr, bfd_size_type));
+static int ppcboot_sizeof_headers PARAMS ((bfd *, bfd_boolean));
+static bfd_boolean ppcboot_bfd_print_private_bfd_data PARAMS ((bfd *, PTR));
#define ppcboot_set_tdata(abfd, ptr) ((abfd)->tdata.any = (PTR) (ptr))
#define ppcboot_get_tdata(abfd) ((ppcboot_data_t *) ((abfd)->tdata.any))
/* Create a ppcboot object. Invoked via bfd_set_format. */
-static boolean
+static bfd_boolean
ppcboot_mkobject (abfd)
bfd *abfd;
{
@@ -117,12 +117,12 @@ ppcboot_mkobject (abfd)
ppcboot_set_tdata (abfd, bfd_zalloc (abfd, amt));
}
- return true;
+ return TRUE;
}
/* Set the architecture to PowerPC */
-static boolean
+static bfd_boolean
ppcboot_set_arch_mach (abfd, arch, machine)
bfd *abfd;
enum bfd_architecture arch;
@@ -132,7 +132,7 @@ ppcboot_set_arch_mach (abfd, arch, machine)
arch = bfd_arch_powerpc;
else if (arch != bfd_arch_powerpc)
- return false;
+ return FALSE;
return bfd_default_set_arch_mach (abfd, arch, machine);
}
@@ -229,7 +229,7 @@ ppcboot_object_p (abfd)
/* Get contents of the only section. */
-static boolean
+static bfd_boolean
ppcboot_get_section_contents (abfd, section, location, offset, count)
bfd *abfd;
asection *section ATTRIBUTE_UNUSED;
@@ -239,8 +239,8 @@ ppcboot_get_section_contents (abfd, section, location, offset, count)
{
if (bfd_seek (abfd, offset + (file_ptr) sizeof (ppcboot_hdr_t), SEEK_SET) != 0
|| bfd_bread (location, count, abfd) != count)
- return false;
- return true;
+ return FALSE;
+ return TRUE;
}
@@ -287,7 +287,7 @@ mangle_name (abfd, suffix)
/* Return the symbol table. */
static long
-ppcboot_get_symtab (abfd, alocation)
+ppcboot_canonicalize_symtab (abfd, alocation)
bfd *abfd;
asymbol **alocation;
{
@@ -298,7 +298,7 @@ ppcboot_get_symtab (abfd, alocation)
syms = (asymbol *) bfd_alloc (abfd, amt);
if (syms == NULL)
- return false;
+ return FALSE;
/* Start symbol. */
syms[0].the_bfd = abfd;
@@ -360,11 +360,11 @@ ppcboot_get_symbol_info (ignore_abfd, symbol, ret)
/* Write section contents of a ppcboot file. */
-static boolean
+static bfd_boolean
ppcboot_set_section_contents (abfd, sec, data, offset, size)
bfd *abfd;
asection *sec;
- PTR data;
+ const PTR data;
file_ptr offset;
bfd_size_type size;
{
@@ -384,7 +384,7 @@ ppcboot_set_section_contents (abfd, sec, data, offset, size)
for (s = abfd->sections; s != NULL; s = s->next)
s->filepos = s->vma - low;
- abfd->output_has_begun = true;
+ abfd->output_has_begun = TRUE;
}
return _bfd_generic_set_section_contents (abfd, sec, data, offset, size);
@@ -394,7 +394,7 @@ ppcboot_set_section_contents (abfd, sec, data, offset, size)
static int
ppcboot_sizeof_headers (abfd, exec)
bfd *abfd ATTRIBUTE_UNUSED;
- boolean exec ATTRIBUTE_UNUSED;
+ bfd_boolean exec ATTRIBUTE_UNUSED;
{
return sizeof (ppcboot_hdr_t);
}
@@ -402,7 +402,7 @@ ppcboot_sizeof_headers (abfd, exec)
/* Print out the program headers. */
-static boolean
+static bfd_boolean
ppcboot_bfd_print_private_bfd_data (abfd, farg)
bfd *abfd;
PTR farg;
@@ -460,7 +460,7 @@ ppcboot_bfd_print_private_bfd_data (abfd, farg)
}
fprintf (f, "\n");
- return true;
+ return TRUE;
}
diff --git a/contrib/binutils/bfd/ptrace-core.c b/contrib/binutils/bfd/ptrace-core.c
index f8db927..15b6777 100644
--- a/contrib/binutils/bfd/ptrace-core.c
+++ b/contrib/binutils/bfd/ptrace-core.c
@@ -1,5 +1,5 @@
/* BFD backend for core files which use the ptrace_user structure
- Copyright 1993, 1994, 1995, 1996, 1998, 1999, 2001, 2002
+ Copyright 1993, 1994, 1995, 1996, 1998, 1999, 2001, 2002, 2003, 2004
Free Software Foundation, Inc.
The structure of this file is based on trad-core.c written by John Gilmore
of Cygnus Support.
@@ -49,13 +49,12 @@ struct trad_core_struct
/* forward declarations */
const bfd_target *ptrace_unix_core_file_p PARAMS ((bfd *abfd));
-char * ptrace_unix_core_file_failing_command PARAMS ((bfd *abfd));
-int ptrace_unix_core_file_failing_signal PARAMS ((bfd *abfd));
-boolean ptrace_unix_core_file_matches_executable_p
- PARAMS ((bfd *core_bfd, bfd *exec_bfd));
-static void swap_abort PARAMS ((void));
+char * ptrace_unix_core_file_failing_command PARAMS ((bfd *abfd));
+int ptrace_unix_core_file_failing_signal PARAMS ((bfd *abfd));
+bfd_boolean ptrace_unix_core_file_matches_executable_p
+ PARAMS ((bfd *core_bfd, bfd *exec_bfd));
+static void swap_abort PARAMS ((void));
-/* ARGSUSED */
const bfd_target *
ptrace_unix_core_file_p (abfd)
bfd *abfd;
@@ -146,7 +145,6 @@ ptrace_unix_core_file_failing_command (abfd)
return 0;
}
-/* ARGSUSED */
int
ptrace_unix_core_file_failing_signal (abfd)
bfd *abfd;
@@ -154,14 +152,13 @@ ptrace_unix_core_file_failing_signal (abfd)
return abfd->tdata.trad_core_data->u.pt_sigframe.sig_num;
}
-/* ARGSUSED */
-boolean
+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;
+ return TRUE;
}
/* If somebody calls any byte-swapping routines, shoot them. */
@@ -170,10 +167,13 @@ swap_abort ()
{
abort (); /* This way doesn't require any declaration for ANSI to fuck up */
}
-#define NO_GET ((bfd_vma (*) PARAMS (( const bfd_byte *))) swap_abort )
-#define NO_PUT ((void (*) PARAMS ((bfd_vma, bfd_byte *))) swap_abort )
-#define NO_SIGNED_GET \
- ((bfd_signed_vma (*) PARAMS ((const bfd_byte *))) swap_abort )
+
+#define NO_GET ((bfd_vma (*) (const void *)) swap_abort)
+#define NO_PUT ((void (*) (bfd_vma, void *)) swap_abort)
+#define NO_GETS ((bfd_signed_vma (*) (const void *)) swap_abort)
+#define NO_GET64 ((bfd_uint64_t (*) (const void *)) swap_abort)
+#define NO_PUT64 ((void (*) (bfd_uint64_t, void *)) swap_abort)
+#define NO_GETS64 ((bfd_int64_t (*) (const void *)) swap_abort)
const bfd_target ptrace_core_vec =
{
@@ -188,41 +188,41 @@ const bfd_target ptrace_core_vec =
0, /* symbol prefix */
' ', /* ar_pad_char */
16, /* ar_max_namelen */
- NO_GET, NO_SIGNED_GET, NO_PUT, /* 64 bit data */
- NO_GET, NO_SIGNED_GET, NO_PUT, /* 32 bit data */
- NO_GET, NO_SIGNED_GET, NO_PUT, /* 16 bit data */
- NO_GET, NO_SIGNED_GET, NO_PUT, /* 64 bit hdrs */
- NO_GET, NO_SIGNED_GET, NO_PUT, /* 32 bit hdrs */
- NO_GET, NO_SIGNED_GET, NO_PUT, /* 16 bit hdrs */
+ NO_GET64, NO_GETS64, NO_PUT64, /* 64 bit data */
+ NO_GET, NO_GETS, NO_PUT, /* 32 bit data */
+ NO_GET, NO_GETS, NO_PUT, /* 16 bit data */
+ NO_GET64, NO_GETS64, NO_PUT64, /* 64 bit hdrs */
+ NO_GET, NO_GETS, NO_PUT, /* 32 bit hdrs */
+ NO_GET, NO_GETS, NO_PUT, /* 16 bit hdrs */
{ /* bfd_check_format */
- _bfd_dummy_target, /* unknown format */
- _bfd_dummy_target, /* object file */
- _bfd_dummy_target, /* archive */
- ptrace_unix_core_file_p /* a core file */
+ _bfd_dummy_target, /* unknown format */
+ _bfd_dummy_target, /* object file */
+ _bfd_dummy_target, /* archive */
+ ptrace_unix_core_file_p /* a core file */
},
{ /* bfd_set_format */
- bfd_false, bfd_false,
- bfd_false, bfd_false
+ bfd_false, bfd_false,
+ bfd_false, bfd_false
},
{ /* bfd_write_contents */
- bfd_false, bfd_false,
- bfd_false, bfd_false
+ bfd_false, bfd_false,
+ bfd_false, bfd_false
},
- BFD_JUMP_TABLE_GENERIC (_bfd_generic),
- BFD_JUMP_TABLE_COPY (_bfd_generic),
- BFD_JUMP_TABLE_CORE (ptrace_unix),
- BFD_JUMP_TABLE_ARCHIVE (_bfd_noarchive),
- BFD_JUMP_TABLE_SYMBOLS (_bfd_nosymbols),
- BFD_JUMP_TABLE_RELOCS (_bfd_norelocs),
- BFD_JUMP_TABLE_WRITE (_bfd_generic),
- BFD_JUMP_TABLE_LINK (_bfd_nolink),
- BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
+ BFD_JUMP_TABLE_GENERIC (_bfd_generic),
+ BFD_JUMP_TABLE_COPY (_bfd_generic),
+ BFD_JUMP_TABLE_CORE (ptrace_unix),
+ BFD_JUMP_TABLE_ARCHIVE (_bfd_noarchive),
+ BFD_JUMP_TABLE_SYMBOLS (_bfd_nosymbols),
+ BFD_JUMP_TABLE_RELOCS (_bfd_norelocs),
+ BFD_JUMP_TABLE_WRITE (_bfd_generic),
+ BFD_JUMP_TABLE_LINK (_bfd_nolink),
+ BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
NULL,
(PTR) 0 /* backend_data */
-};
+ };
#endif /* PTRACE_CORE */
diff --git a/contrib/binutils/bfd/reloc.c b/contrib/binutils/bfd/reloc.c
index 01ff516..9bffaa3 100644
--- a/contrib/binutils/bfd/reloc.c
+++ b/contrib/binutils/bfd/reloc.c
@@ -1,24 +1,24 @@
/* BFD support for handling relocation entries.
Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
- 2000, 2001, 2002
+ 2000, 2001, 2002, 2003, 2004
Free Software Foundation, Inc.
Written by Cygnus Support.
-This file is part of BFD, the Binary File Descriptor library.
+ This 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
/*
SECTION
@@ -98,7 +98,7 @@ CODE_FRAGMENT
.typedef struct reloc_cache_entry
.{
. {* A pointer into the canonical table of pointers. *}
-. struct symbol_cache_entry **sym_ptr_ptr;
+. struct bfd_symbol **sym_ptr_ptr;
.
. {* offset in section. *}
. bfd_size_type address;
@@ -122,15 +122,16 @@ DESCRIPTION
o <<sym_ptr_ptr>>
The symbol table pointer points to a pointer to the symbol
- associated with the relocation request. It is
- the pointer into the table returned by the back end's
- <<get_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.
+ associated with the relocation request. It is the pointer
+ into the table returned by the back end's
+ <<canonicalize_symtab>> action. @xref{Symbols}. The symbol is
+ referenced through a pointer to a pointer so that tools like
+ the linker can fix up all the symbols of the same name by
+ modifying only one pointer. The relocation routine looks in
+ the symbol and uses the base of the section the symbol is
+ attached to and the value of the symbol as the initial
+ relocation offset. If the symbol pointer is zero, then the
+ section provided is looked up.
o <<address>>
@@ -277,7 +278,7 @@ SUBSUBSECTION
information that libbfd needs to know to tie up a back end's data.
CODE_FRAGMENT
-.struct symbol_cache_entry; {* Forward declaration. *}
+.struct bfd_symbol; {* Forward declaration. *}
.
.struct reloc_howto_struct
.{
@@ -306,7 +307,7 @@ CODE_FRAGMENT
. data section of the addend. The relocation function will
. subtract from the relocation value the address of the location
. being relocated. *}
-. boolean pc_relative;
+. bfd_boolean pc_relative;
.
. {* The bit position of the reloc value in the destination.
. The relocated value is left shifted by this amount. *}
@@ -318,11 +319,11 @@ CODE_FRAGMENT
.
. {* If this field is non null, then the supplied function is
. called rather than the normal function. This allows really
-. strange relocation methods to be accomodated (e.g., i960 callj
+. strange relocation methods to be accommodated (e.g., i960 callj
. instructions). *}
. bfd_reloc_status_type (*special_function)
-. PARAMS ((bfd *, arelent *, struct symbol_cache_entry *, PTR, asection *,
-. bfd *, char **));
+. (bfd *, arelent *, struct bfd_symbol *, void *, asection *,
+. bfd *, char **);
.
. {* The textual name of the relocation type. *}
. char *name;
@@ -342,21 +343,20 @@ CODE_FRAGMENT
. USE_REL targets set this field to TRUE. Why this is so is peculiar
. to each particular target. For relocs that aren't used in partial
. links (e.g. GOT stuff) it doesn't matter what this is set to. *}
-. boolean partial_inplace;
+. bfd_boolean partial_inplace;
.
-. {* The src_mask selects which parts of the read in data
-. are to be used in the relocation sum. E.g., if this was an 8 bit
-. byte of data which we read and relocated, this would be
-. 0x000000ff. When we have relocs which have an addend, such as
-. sun4 extended relocs, the value in the offset part of a
-. relocating field is garbage so we never use it. In this case
-. the mask would be 0x00000000. *}
+. {* 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;
.
-. {* The dst_mask selects which parts of the instruction are replaced
-. into the instruction. In most cases src_mask == dst_mask,
-. except in the above special case, where dst_mask would be
-. 0x000000ff, and src_mask would be 0x00000000. *}
+. {* 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
@@ -365,7 +365,7 @@ CODE_FRAGMENT
. be made just by adding in an ordinary offset (e.g., sun3 a.out).
. Some formats leave the displacement part of an instruction
. empty (e.g., m88k bcs); this flag signals the fact. *}
-. boolean pcrel_offset;
+. bfd_boolean pcrel_offset;
.};
.
*/
@@ -386,15 +386,15 @@ DESCRIPTION
.#define NEWHOWTO(FUNCTION, NAME, SIZE, REL, IN) \
. HOWTO (0, 0, SIZE, 0, REL, 0, complain_overflow_dont, FUNCTION, \
-. NAME, false, 0, 0, IN)
+. NAME, FALSE, 0, 0, IN)
.
DESCRIPTION
This is used to fill in an empty howto entry in an array.
.#define EMPTY_HOWTO(C) \
-. HOWTO ((C), 0, 0, 0, false, 0, complain_overflow_dont, NULL, \
-. NULL, false, 0, 0, false)
+. HOWTO ((C), 0, 0, 0, FALSE, 0, complain_overflow_dont, NULL, \
+. NULL, FALSE, 0, 0, FALSE)
.
DESCRIPTION
@@ -402,7 +402,7 @@ DESCRIPTION
.#define HOWTO_PREPARE(relocation, symbol) \
. { \
-. if (symbol != (asymbol *) NULL) \
+. if (symbol != NULL) \
. { \
. if (bfd_is_com_section (symbol->section)) \
. { \
@@ -430,8 +430,7 @@ DESCRIPTION
*/
unsigned int
-bfd_get_reloc_size (howto)
- reloc_howto_type *howto;
+bfd_get_reloc_size (reloc_howto_type *howto)
{
switch (howto->size)
{
@@ -471,13 +470,12 @@ FUNCTION
bfd_check_overflow
SYNOPSIS
- bfd_reloc_status_type
- bfd_check_overflow
- (enum complain_overflow how,
- unsigned int bitsize,
- unsigned int rightshift,
- unsigned int addrsize,
- bfd_vma relocation);
+ bfd_reloc_status_type bfd_check_overflow
+ (enum complain_overflow how,
+ unsigned int bitsize,
+ unsigned int rightshift,
+ unsigned int addrsize,
+ bfd_vma relocation);
DESCRIPTION
Perform overflow checking on @var{relocation} which has
@@ -489,12 +487,11 @@ DESCRIPTION
*/
bfd_reloc_status_type
-bfd_check_overflow (how, bitsize, rightshift, addrsize, relocation)
- enum complain_overflow how;
- unsigned int bitsize;
- unsigned int rightshift;
- unsigned int addrsize;
- bfd_vma relocation;
+bfd_check_overflow (enum complain_overflow how,
+ unsigned int bitsize,
+ unsigned int rightshift,
+ unsigned int addrsize,
+ bfd_vma relocation)
{
bfd_vma fieldmask, addrmask, signmask, ss, a;
bfd_reloc_status_type flag = bfd_reloc_ok;
@@ -554,14 +551,13 @@ FUNCTION
bfd_perform_relocation
SYNOPSIS
- bfd_reloc_status_type
- bfd_perform_relocation
- (bfd *abfd,
- arelent *reloc_entry,
- PTR data,
- asection *input_section,
- bfd *output_bfd,
- char **error_message);
+ bfd_reloc_status_type bfd_perform_relocation
+ (bfd *abfd,
+ arelent *reloc_entry,
+ void *data,
+ asection *input_section,
+ bfd *output_bfd,
+ char **error_message);
DESCRIPTION
If @var{output_bfd} is supplied to this function, the
@@ -582,14 +578,12 @@ DESCRIPTION
*/
bfd_reloc_status_type
-bfd_perform_relocation (abfd, reloc_entry, data, input_section, output_bfd,
- error_message)
- bfd *abfd;
- arelent *reloc_entry;
- PTR data;
- asection *input_section;
- bfd *output_bfd;
- char **error_message;
+bfd_perform_relocation (bfd *abfd,
+ arelent *reloc_entry,
+ void *data,
+ asection *input_section,
+ bfd *output_bfd,
+ char **error_message)
{
bfd_vma relocation;
bfd_reloc_status_type flag = bfd_reloc_ok;
@@ -601,18 +595,18 @@ bfd_perform_relocation (abfd, reloc_entry, data, input_section, output_bfd,
symbol = *(reloc_entry->sym_ptr_ptr);
if (bfd_is_abs_section (symbol->section)
- && output_bfd != (bfd *) NULL)
+ && output_bfd != NULL)
{
reloc_entry->address += input_section->output_offset;
return bfd_reloc_ok;
}
- /* If we are not producing relocateable output, return an error if
+ /* If we are not producing relocatable output, return an error if
the symbol is not defined. An undefined weak symbol is
considered to have a value of zero (SVR4 ABI, p. 4-27). */
if (bfd_is_und_section (symbol->section)
&& (symbol->flags & BSF_WEAK) == 0
- && output_bfd == (bfd *) NULL)
+ && output_bfd == NULL)
flag = bfd_reloc_undefined;
/* If there is a function supplied to handle this relocation type,
@@ -633,7 +627,7 @@ bfd_perform_relocation (abfd, reloc_entry, data, input_section, output_bfd,
/ bfd_octets_per_byte (abfd)))
return bfd_reloc_outofrange;
- /* Work out which section the relocation is targetted at and the
+ /* Work out which section the relocation is targeted at and the
initial relocation command value. */
/* Get symbol value. (Common symbols are special.) */
@@ -645,7 +639,8 @@ bfd_perform_relocation (abfd, reloc_entry, data, input_section, output_bfd,
reloc_target_output_section = symbol->section->output_section;
/* Convert input-section-relative symbol value to absolute. */
- if (output_bfd && ! howto->partial_inplace)
+ if ((output_bfd && ! howto->partial_inplace)
+ || reloc_target_output_section == NULL)
output_base = 0;
else
output_base = reloc_target_output_section->vma;
@@ -671,20 +666,20 @@ bfd_perform_relocation (abfd, reloc_entry, data, input_section, output_bfd,
of the location within the section. Some targets arrange for
the addend to be the negative of the position of the location
within the section; for example, i386-aout does this. For
- i386-aout, pcrel_offset is false. Some other targets do not
+ i386-aout, pcrel_offset is FALSE. Some other targets do not
include the position of the location; for example, m88kbcs,
- or ELF. For those targets, pcrel_offset is true.
+ or ELF. For those targets, pcrel_offset is TRUE.
- If we are producing relocateable output, then we must ensure
+ If we are producing relocatable output, then we must ensure
that this reloc will be correctly computed when the final
- relocation is done. If pcrel_offset is false we want to wind
+ relocation is done. If pcrel_offset is FALSE we want to wind
up with the negative of the location within the section,
which means we must adjust the existing addend by the change
- in the location within the section. If pcrel_offset is true
+ in the location within the section. If pcrel_offset is TRUE
we do not want to adjust the existing addend at all.
FIXME: This seems logical to me, but for the case of
- producing relocateable output it is not what the code
+ producing relocatable output it is not what the code
actually does. I don't want to change it, because it seems
far too likely that something will break. */
@@ -695,7 +690,7 @@ bfd_perform_relocation (abfd, reloc_entry, data, input_section, output_bfd,
relocation -= reloc_entry->address;
}
- if (output_bfd != (bfd *) NULL)
+ if (output_bfd != NULL)
{
if (! howto->partial_inplace)
{
@@ -739,7 +734,7 @@ Hmmm. The first obvious point is that bfd_perform_relocation should
not have any tests that depend upon the flavour. It's seem like
entirely the wrong place for such a thing. The second obvious point
is that the current code ignores the reloc addend when producing
-relocateable output for COFF. That's peculiar. In fact, I really
+relocatable output for COFF. That's peculiar. In fact, I really
have no idea what the point of the line you want to remove is.
A typical COFF reloc subtracts the old value of the symbol and adds in
@@ -754,9 +749,9 @@ different story (we can't change it without losing backward
compatibility with old object files) (coff-i386 does subtract the old
value, to be compatible with existing coff-i386 targets, like SCO).
-So everything works fine when not producing relocateable output. When
-we are producing relocateable output, logically we should do exactly
-what we do when not producing relocateable output. Therefore, your
+So everything works fine when not producing relocatable output. When
+we are producing relocatable output, logically we should do exactly
+what we do when not producing relocatable output. Therefore, your
patch is correct. In fact, it should probably always just set
reloc_entry->addend to 0 for all cases, since it is, in fact, going to
add the value into the object file. This won't hurt the COFF code,
@@ -764,7 +759,7 @@ which doesn't use the addend; I'm not sure what it will do to other
formats (the thing to check for would be whether any formats both use
the addend and set partial_inplace).
-When I wanted to make coff-i386 produce relocateable output, I ran
+When I wanted to make coff-i386 produce relocatable output, I ran
into the problem that you are running into: I wanted to remove that
line. Rather than risk it, I made the coff-i386 relocs use a special
function; it's coff_i386_reloc in coff-i386.c. The function
@@ -958,13 +953,12 @@ FUNCTION
bfd_install_relocation
SYNOPSIS
- bfd_reloc_status_type
- bfd_install_relocation
- (bfd *abfd,
- arelent *reloc_entry,
- PTR data, bfd_vma data_start,
- asection *input_section,
- char **error_message);
+ bfd_reloc_status_type bfd_install_relocation
+ (bfd *abfd,
+ arelent *reloc_entry,
+ void *data, bfd_vma data_start,
+ asection *input_section,
+ char **error_message);
DESCRIPTION
This looks remarkably like <<bfd_perform_relocation>>, except it
@@ -977,14 +971,12 @@ DESCRIPTION
*/
bfd_reloc_status_type
-bfd_install_relocation (abfd, reloc_entry, data_start, data_start_offset,
- input_section, error_message)
- bfd *abfd;
- arelent *reloc_entry;
- PTR data_start;
- bfd_vma data_start_offset;
- asection *input_section;
- char **error_message;
+bfd_install_relocation (bfd *abfd,
+ arelent *reloc_entry,
+ void *data_start,
+ bfd_vma data_start_offset,
+ asection *input_section,
+ char **error_message)
{
bfd_vma relocation;
bfd_reloc_status_type flag = bfd_reloc_ok;
@@ -1025,7 +1017,7 @@ bfd_install_relocation (abfd, reloc_entry, data_start, data_start_offset,
/ bfd_octets_per_byte (abfd)))
return bfd_reloc_outofrange;
- /* Work out which section the relocation is targetted at and the
+ /* Work out which section the relocation is targeted at and the
initial relocation command value. */
/* Get symbol value. (Common symbols are special.) */
@@ -1063,20 +1055,20 @@ bfd_install_relocation (abfd, reloc_entry, data_start, data_start_offset,
of the location within the section. Some targets arrange for
the addend to be the negative of the position of the location
within the section; for example, i386-aout does this. For
- i386-aout, pcrel_offset is false. Some other targets do not
+ i386-aout, pcrel_offset is FALSE. Some other targets do not
include the position of the location; for example, m88kbcs,
- or ELF. For those targets, pcrel_offset is true.
+ or ELF. For those targets, pcrel_offset is TRUE.
- If we are producing relocateable output, then we must ensure
+ If we are producing relocatable output, then we must ensure
that this reloc will be correctly computed when the final
- relocation is done. If pcrel_offset is false we want to wind
+ relocation is done. If pcrel_offset is FALSE we want to wind
up with the negative of the location within the section,
which means we must adjust the existing addend by the change
- in the location within the section. If pcrel_offset is true
+ in the location within the section. If pcrel_offset is TRUE
we do not want to adjust the existing addend at all.
FIXME: This seems logical to me, but for the case of
- producing relocateable output it is not what the code
+ producing relocatable output it is not what the code
actually does. I don't want to change it, because it seems
far too likely that something will break. */
@@ -1128,7 +1120,7 @@ Hmmm. The first obvious point is that bfd_install_relocation should
not have any tests that depend upon the flavour. It's seem like
entirely the wrong place for such a thing. The second obvious point
is that the current code ignores the reloc addend when producing
-relocateable output for COFF. That's peculiar. In fact, I really
+relocatable output for COFF. That's peculiar. In fact, I really
have no idea what the point of the line you want to remove is.
A typical COFF reloc subtracts the old value of the symbol and adds in
@@ -1143,9 +1135,9 @@ different story (we can't change it without losing backward
compatibility with old object files) (coff-i386 does subtract the old
value, to be compatible with existing coff-i386 targets, like SCO).
-So everything works fine when not producing relocateable output. When
-we are producing relocateable output, logically we should do exactly
-what we do when not producing relocateable output. Therefore, your
+So everything works fine when not producing relocatable output. When
+we are producing relocatable output, logically we should do exactly
+what we do when not producing relocatable output. Therefore, your
patch is correct. In fact, it should probably always just set
reloc_entry->addend to 0 for all cases, since it is, in fact, going to
add the value into the object file. This won't hurt the COFF code,
@@ -1153,7 +1145,7 @@ which doesn't use the addend; I'm not sure what it will do to other
formats (the thing to check for would be whether any formats both use
the addend and set partial_inplace).
-When I wanted to make coff-i386 produce relocateable output, I ran
+When I wanted to make coff-i386 produce relocatable output, I ran
into the problem that you are running into: I wanted to remove that
line. Rather than risk it, I made the coff-i386 relocs use a special
function; it's coff_i386_reloc in coff-i386.c. The function
@@ -1277,32 +1269,32 @@ space consuming. For each target:
{
case 0:
{
- char x = bfd_get_8 (abfd, (char *) data);
+ char x = bfd_get_8 (abfd, data);
DOIT (x);
- bfd_put_8 (abfd, x, (unsigned char *) data);
+ bfd_put_8 (abfd, x, data);
}
break;
case 1:
{
- short x = bfd_get_16 (abfd, (bfd_byte *) data);
+ short x = bfd_get_16 (abfd, data);
DOIT (x);
- bfd_put_16 (abfd, (bfd_vma) x, (unsigned char *) data);
+ bfd_put_16 (abfd, (bfd_vma) x, data);
}
break;
case 2:
{
- long x = bfd_get_32 (abfd, (bfd_byte *) data);
+ long x = bfd_get_32 (abfd, data);
DOIT (x);
- bfd_put_32 (abfd, (bfd_vma) x, (bfd_byte *) data);
+ bfd_put_32 (abfd, (bfd_vma) x, data);
}
break;
case -2:
{
- long x = bfd_get_32 (abfd, (bfd_byte *) data);
+ long x = bfd_get_32 (abfd, data);
relocation = -relocation;
DOIT (x);
- bfd_put_32 (abfd, (bfd_vma) x, (bfd_byte *) data);
+ bfd_put_32 (abfd, (bfd_vma) x, data);
}
break;
@@ -1312,9 +1304,9 @@ space consuming. For each target:
case 4:
{
- bfd_vma x = bfd_get_64 (abfd, (bfd_byte *) data);
+ bfd_vma x = bfd_get_64 (abfd, data);
DOIT (x);
- bfd_put_64 (abfd, x, (bfd_byte *) data);
+ bfd_put_64 (abfd, x, data);
}
break;
default:
@@ -1331,7 +1323,7 @@ space consuming. For each target:
function than to try to deal with it.
This routine does a final relocation. Whether it is useful for a
- relocateable link depends upon how the object format defines
+ relocatable link depends upon how the object format defines
relocations.
FIXME: This routine ignores any special_function in the HOWTO,
@@ -1347,15 +1339,13 @@ space consuming. For each target:
ADDEND is the addend of the reloc. */
bfd_reloc_status_type
-_bfd_final_link_relocate (howto, input_bfd, input_section, contents, address,
- value, addend)
- reloc_howto_type *howto;
- bfd *input_bfd;
- asection *input_section;
- bfd_byte *contents;
- bfd_vma address;
- bfd_vma value;
- bfd_vma addend;
+_bfd_final_link_relocate (reloc_howto_type *howto,
+ bfd *input_bfd,
+ asection *input_section,
+ bfd_byte *contents,
+ bfd_vma address,
+ bfd_vma value,
+ bfd_vma addend)
{
bfd_vma relocation;
@@ -1374,9 +1364,9 @@ _bfd_final_link_relocate (howto, input_bfd, input_section, contents, address,
location we are relocating. Some targets (e.g., i386-aout)
arrange for the contents of the section to be the negative of the
offset of the location within the section; for such targets
- pcrel_offset is false. Other targets (e.g., m88kbcs or ELF)
+ pcrel_offset is FALSE. Other targets (e.g., m88kbcs or ELF)
simply leave the contents of the section as zero; for such
- targets pcrel_offset is true. If pcrel_offset is false we do not
+ targets pcrel_offset is TRUE. If pcrel_offset is FALSE we do not
need to subtract out the offset of the location within the
section (which is just ADDRESS). */
if (howto->pc_relative)
@@ -1394,11 +1384,10 @@ _bfd_final_link_relocate (howto, input_bfd, input_section, contents, address,
/* Relocate a given location using a given value and howto. */
bfd_reloc_status_type
-_bfd_relocate_contents (howto, input_bfd, relocation, location)
- reloc_howto_type *howto;
- bfd *input_bfd;
- bfd_vma relocation;
- bfd_byte *location;
+_bfd_relocate_contents (reloc_howto_type *howto,
+ bfd *input_bfd,
+ bfd_vma relocation,
+ bfd_byte *location)
{
int size;
bfd_vma x = 0;
@@ -1872,6 +1861,56 @@ ENUM
BFD_RELOC_SPARC_REV32
ENUMDOC
SPARC little endian relocation
+ENUM
+ BFD_RELOC_SPARC_TLS_GD_HI22
+ENUMX
+ BFD_RELOC_SPARC_TLS_GD_LO10
+ENUMX
+ BFD_RELOC_SPARC_TLS_GD_ADD
+ENUMX
+ BFD_RELOC_SPARC_TLS_GD_CALL
+ENUMX
+ BFD_RELOC_SPARC_TLS_LDM_HI22
+ENUMX
+ BFD_RELOC_SPARC_TLS_LDM_LO10
+ENUMX
+ BFD_RELOC_SPARC_TLS_LDM_ADD
+ENUMX
+ BFD_RELOC_SPARC_TLS_LDM_CALL
+ENUMX
+ BFD_RELOC_SPARC_TLS_LDO_HIX22
+ENUMX
+ BFD_RELOC_SPARC_TLS_LDO_LOX10
+ENUMX
+ BFD_RELOC_SPARC_TLS_LDO_ADD
+ENUMX
+ BFD_RELOC_SPARC_TLS_IE_HI22
+ENUMX
+ BFD_RELOC_SPARC_TLS_IE_LO10
+ENUMX
+ BFD_RELOC_SPARC_TLS_IE_LD
+ENUMX
+ BFD_RELOC_SPARC_TLS_IE_LDX
+ENUMX
+ BFD_RELOC_SPARC_TLS_IE_ADD
+ENUMX
+ BFD_RELOC_SPARC_TLS_LE_HIX22
+ENUMX
+ BFD_RELOC_SPARC_TLS_LE_LOX10
+ENUMX
+ BFD_RELOC_SPARC_TLS_DTPMOD32
+ENUMX
+ BFD_RELOC_SPARC_TLS_DTPMOD64
+ENUMX
+ BFD_RELOC_SPARC_TLS_DTPOFF32
+ENUMX
+ BFD_RELOC_SPARC_TLS_DTPOFF64
+ENUMX
+ BFD_RELOC_SPARC_TLS_TPOFF32
+ENUMX
+ BFD_RELOC_SPARC_TLS_TPOFF64
+ENUMDOC
+ SPARC TLS relocations
ENUM
BFD_RELOC_ALPHA_GPDISP_HI16
@@ -1959,7 +1998,7 @@ ENUM
BFD_RELOC_ALPHA_BRSGP
ENUMDOC
Like BFD_RELOC_23_PCREL_S2, except that the source and target must
- share a common GP, and the target address is adjusted for
+ share a common GP, and the target address is adjusted for
STO_ALPHA_STD_GPLOAD.
ENUM
@@ -2078,7 +2117,10 @@ ENUMX
BFD_RELOC_MIPS_RELGOT
ENUMX
BFD_RELOC_MIPS_JALR
+ENUMDOC
+ MIPS ELF relocations.
COMMENT
+
ENUM
BFD_RELOC_FRV_LABEL16
ENUMX
@@ -2097,13 +2139,73 @@ ENUMX
BFD_RELOC_FRV_GPRELHI
ENUMX
BFD_RELOC_FRV_GPRELLO
+ENUMX
+ BFD_RELOC_FRV_GOT12
+ENUMX
+ BFD_RELOC_FRV_GOTHI
+ENUMX
+ BFD_RELOC_FRV_GOTLO
+ENUMX
+ BFD_RELOC_FRV_FUNCDESC
+ENUMX
+ BFD_RELOC_FRV_FUNCDESC_GOT12
+ENUMX
+ BFD_RELOC_FRV_FUNCDESC_GOTHI
+ENUMX
+ BFD_RELOC_FRV_FUNCDESC_GOTLO
+ENUMX
+ BFD_RELOC_FRV_FUNCDESC_VALUE
+ENUMX
+ BFD_RELOC_FRV_FUNCDESC_GOTOFF12
+ENUMX
+ BFD_RELOC_FRV_FUNCDESC_GOTOFFHI
+ENUMX
+ BFD_RELOC_FRV_FUNCDESC_GOTOFFLO
+ENUMX
+ BFD_RELOC_FRV_GOTOFF12
+ENUMX
+ BFD_RELOC_FRV_GOTOFFHI
+ENUMX
+ BFD_RELOC_FRV_GOTOFFLO
ENUMDOC
Fujitsu Frv Relocations.
COMMENT
-COMMENT
-ENUMDOC
- MIPS ELF relocations.
+ENUM
+ BFD_RELOC_MN10300_GOTOFF24
+ENUMDOC
+ This is a 24bit GOT-relative reloc for the mn10300.
+ENUM
+ BFD_RELOC_MN10300_GOT32
+ENUMDOC
+ This is a 32bit GOT-relative reloc for the mn10300, offset by two bytes
+ in the instruction.
+ENUM
+ BFD_RELOC_MN10300_GOT24
+ENUMDOC
+ This is a 24bit GOT-relative reloc for the mn10300, offset by two bytes
+ in the instruction.
+ENUM
+ BFD_RELOC_MN10300_GOT16
+ENUMDOC
+ This is a 16bit GOT-relative reloc for the mn10300, offset by two bytes
+ in the instruction.
+ENUM
+ BFD_RELOC_MN10300_COPY
+ENUMDOC
+ Copy symbol at runtime.
+ENUM
+ BFD_RELOC_MN10300_GLOB_DAT
+ENUMDOC
+ Create GOT entry.
+ENUM
+ BFD_RELOC_MN10300_JMP_SLOT
+ENUMDOC
+ Create PLT entry.
+ENUM
+ BFD_RELOC_MN10300_RELATIVE
+ENUMDOC
+ Adjust by program base.
COMMENT
ENUM
@@ -2165,6 +2267,22 @@ ENUMX
BFD_RELOC_X86_64_GOTPCREL
ENUMX
BFD_RELOC_X86_64_32S
+ENUMX
+ BFD_RELOC_X86_64_DTPMOD64
+ENUMX
+ BFD_RELOC_X86_64_DTPOFF64
+ENUMX
+ BFD_RELOC_X86_64_TPOFF64
+ENUMX
+ BFD_RELOC_X86_64_TLSGD
+ENUMX
+ BFD_RELOC_X86_64_TLSLD
+ENUMX
+ BFD_RELOC_X86_64_DTPOFF32
+ENUMX
+ BFD_RELOC_X86_64_GOTTPOFF
+ENUMX
+ BFD_RELOC_X86_64_TPOFF32
ENUMDOC
x86-64/elf relocations
@@ -2327,6 +2445,89 @@ ENUMDOC
Power(rs6000) and PowerPC relocations.
ENUM
+ BFD_RELOC_PPC_TLS
+ENUMX
+ BFD_RELOC_PPC_DTPMOD
+ENUMX
+ BFD_RELOC_PPC_TPREL16
+ENUMX
+ BFD_RELOC_PPC_TPREL16_LO
+ENUMX
+ BFD_RELOC_PPC_TPREL16_HI
+ENUMX
+ BFD_RELOC_PPC_TPREL16_HA
+ENUMX
+ BFD_RELOC_PPC_TPREL
+ENUMX
+ BFD_RELOC_PPC_DTPREL16
+ENUMX
+ BFD_RELOC_PPC_DTPREL16_LO
+ENUMX
+ BFD_RELOC_PPC_DTPREL16_HI
+ENUMX
+ BFD_RELOC_PPC_DTPREL16_HA
+ENUMX
+ BFD_RELOC_PPC_DTPREL
+ENUMX
+ BFD_RELOC_PPC_GOT_TLSGD16
+ENUMX
+ BFD_RELOC_PPC_GOT_TLSGD16_LO
+ENUMX
+ BFD_RELOC_PPC_GOT_TLSGD16_HI
+ENUMX
+ BFD_RELOC_PPC_GOT_TLSGD16_HA
+ENUMX
+ BFD_RELOC_PPC_GOT_TLSLD16
+ENUMX
+ BFD_RELOC_PPC_GOT_TLSLD16_LO
+ENUMX
+ BFD_RELOC_PPC_GOT_TLSLD16_HI
+ENUMX
+ BFD_RELOC_PPC_GOT_TLSLD16_HA
+ENUMX
+ BFD_RELOC_PPC_GOT_TPREL16
+ENUMX
+ BFD_RELOC_PPC_GOT_TPREL16_LO
+ENUMX
+ BFD_RELOC_PPC_GOT_TPREL16_HI
+ENUMX
+ BFD_RELOC_PPC_GOT_TPREL16_HA
+ENUMX
+ BFD_RELOC_PPC_GOT_DTPREL16
+ENUMX
+ BFD_RELOC_PPC_GOT_DTPREL16_LO
+ENUMX
+ BFD_RELOC_PPC_GOT_DTPREL16_HI
+ENUMX
+ BFD_RELOC_PPC_GOT_DTPREL16_HA
+ENUMX
+ BFD_RELOC_PPC64_TPREL16_DS
+ENUMX
+ BFD_RELOC_PPC64_TPREL16_LO_DS
+ENUMX
+ BFD_RELOC_PPC64_TPREL16_HIGHER
+ENUMX
+ BFD_RELOC_PPC64_TPREL16_HIGHERA
+ENUMX
+ BFD_RELOC_PPC64_TPREL16_HIGHEST
+ENUMX
+ BFD_RELOC_PPC64_TPREL16_HIGHESTA
+ENUMX
+ BFD_RELOC_PPC64_DTPREL16_DS
+ENUMX
+ BFD_RELOC_PPC64_DTPREL16_LO_DS
+ENUMX
+ BFD_RELOC_PPC64_DTPREL16_HIGHER
+ENUMX
+ BFD_RELOC_PPC64_DTPREL16_HIGHERA
+ENUMX
+ BFD_RELOC_PPC64_DTPREL16_HIGHEST
+ENUMX
+ BFD_RELOC_PPC64_DTPREL16_HIGHESTA
+ENUMDOC
+ PowerPC and PowerPC64 thread-local storage relocations.
+
+ENUM
BFD_RELOC_I370_D12
ENUMDOC
IBM 370/390 relocations
@@ -2334,7 +2535,7 @@ ENUMDOC
ENUM
BFD_RELOC_CTOR
ENUMDOC
- The type of reloc used to build a contructor table - at the moment
+ 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.
@@ -2370,6 +2571,8 @@ ENUMX
ENUMX
BFD_RELOC_ARM_CP_OFF_IMM
ENUMX
+ BFD_RELOC_ARM_CP_OFF_IMM_S2
+ENUMX
BFD_RELOC_ARM_ADR_IMM
ENUMX
BFD_RELOC_ARM_LDR_IMM
@@ -2559,8 +2762,24 @@ ENUMX
BFD_RELOC_SH_IMM_HI16_PCREL
ENUMX
BFD_RELOC_SH_PT_16
+ENUMX
+ BFD_RELOC_SH_TLS_GD_32
+ENUMX
+ BFD_RELOC_SH_TLS_LD_32
+ENUMX
+ BFD_RELOC_SH_TLS_LDO_32
+ENUMX
+ BFD_RELOC_SH_TLS_IE_32
+ENUMX
+ BFD_RELOC_SH_TLS_LE_32
+ENUMX
+ BFD_RELOC_SH_TLS_DTPMOD32
+ENUMX
+ BFD_RELOC_SH_TLS_DTPOFF32
+ENUMX
+ BFD_RELOC_SH_TLS_TPOFF32
ENUMDOC
- Hitachi SH relocs. Not all of these appear in object files.
+ Renesas / SuperH SH relocs. Not all of these appear in object files.
ENUM
BFD_RELOC_THUMB_PCREL_BRANCH9
@@ -2687,7 +2906,7 @@ ENUMDOC
ENUM
BFD_RELOC_M32R_24
ENUMDOC
- Mitsubishi M32R relocs.
+ Renesas M32R (formerly Mitsubishi M32R) relocs.
This is a 24 bit absolute address.
ENUM
BFD_RELOC_M32R_10_PCREL
@@ -2720,6 +2939,37 @@ ENUM
ENUMDOC
This is a 16-bit reloc containing the small data area offset for use in
add3, load, and store instructions.
+ENUM
+ BFD_RELOC_M32R_GOT24
+ENUMX
+ BFD_RELOC_M32R_26_PLTREL
+ENUMX
+ BFD_RELOC_M32R_COPY
+ENUMX
+ BFD_RELOC_M32R_GLOB_DAT
+ENUMX
+ BFD_RELOC_M32R_JMP_SLOT
+ENUMX
+ BFD_RELOC_M32R_RELATIVE
+ENUMX
+ BFD_RELOC_M32R_GOTOFF
+ENUMX
+ BFD_RELOC_M32R_GOTPC24
+ENUMX
+ BFD_RELOC_M32R_GOT16_HI_ULO
+ENUMX
+ BFD_RELOC_M32R_GOT16_HI_SLO
+ENUMX
+ BFD_RELOC_M32R_GOT16_LO
+ENUMX
+ BFD_RELOC_M32R_GOTPC_HI_ULO
+ENUMX
+ BFD_RELOC_M32R_GOTPC_HI_SLO
+ENUMX
+ BFD_RELOC_M32R_GOTPC_LO
+ENUMDOC
+ For PIC.
+
ENUM
BFD_RELOC_V850_9_PCREL
@@ -2780,12 +3030,12 @@ ENUM
BFD_RELOC_V850_SDA_16_16_SPLIT_OFFSET
ENUMDOC
This is a 16 bit offset from the short data area pointer, with the
- bits placed non-contigously in the instruction.
+ bits placed non-contiguously in the instruction.
ENUM
BFD_RELOC_V850_ZDA_16_16_SPLIT_OFFSET
ENUMDOC
This is a 16 bit offset from the zero data area pointer, with the
- bits placed non-contigously in the instruction.
+ bits placed non-contiguously in the instruction.
ENUM
BFD_RELOC_V850_CALLT_6_7_OFFSET
ENUMDOC
@@ -2794,8 +3044,18 @@ ENUM
BFD_RELOC_V850_CALLT_16_16_OFFSET
ENUMDOC
This is a 16 bit offset from the call table base pointer.
-COMMENT
-
+ENUM
+ BFD_RELOC_V850_LONGCALL
+ENUMDOC
+ Used for relaxing indirect function calls.
+ENUM
+ BFD_RELOC_V850_LONGJUMP
+ENUMDOC
+ Used for relaxing indirect jumps.
+ENUM
+ BFD_RELOC_V850_ALIGN
+ENUMDOC
+ Used to maintain alignment whilst relaxing.
ENUM
BFD_RELOC_MN10300_32_PCREL
ENUMDOC
@@ -2932,6 +3192,8 @@ ENUMX
BFD_RELOC_MMIX_PUSHJ_2
ENUMX
BFD_RELOC_MMIX_PUSHJ_3
+ENUMX
+ BFD_RELOC_MMIX_PUSHJ_STUBBABLE
ENUMDOC
These are relocations for the PUSHJ instruction.
ENUM
@@ -3127,6 +3389,145 @@ ENUM
BFD_RELOC_390_GOTENT
ENUMDOC
32 bit rel. offset to GOT entry.
+ENUM
+ BFD_RELOC_390_GOTOFF64
+ENUMDOC
+ 64 bit offset to GOT.
+ENUM
+ BFD_RELOC_390_GOTPLT12
+ENUMDOC
+ 12-bit offset to symbol-entry within GOT, with PLT handling.
+ENUM
+ BFD_RELOC_390_GOTPLT16
+ENUMDOC
+ 16-bit offset to symbol-entry within GOT, with PLT handling.
+ENUM
+ BFD_RELOC_390_GOTPLT32
+ENUMDOC
+ 32-bit offset to symbol-entry within GOT, with PLT handling.
+ENUM
+ BFD_RELOC_390_GOTPLT64
+ENUMDOC
+ 64-bit offset to symbol-entry within GOT, with PLT handling.
+ENUM
+ BFD_RELOC_390_GOTPLTENT
+ENUMDOC
+ 32-bit rel. offset to symbol-entry within GOT, with PLT handling.
+ENUM
+ BFD_RELOC_390_PLTOFF16
+ENUMDOC
+ 16-bit rel. offset from the GOT to a PLT entry.
+ENUM
+ BFD_RELOC_390_PLTOFF32
+ENUMDOC
+ 32-bit rel. offset from the GOT to a PLT entry.
+ENUM
+ BFD_RELOC_390_PLTOFF64
+ENUMDOC
+ 64-bit rel. offset from the GOT to a PLT entry.
+
+ENUM
+ BFD_RELOC_390_TLS_LOAD
+ENUMX
+ BFD_RELOC_390_TLS_GDCALL
+ENUMX
+ BFD_RELOC_390_TLS_LDCALL
+ENUMX
+ BFD_RELOC_390_TLS_GD32
+ENUMX
+ BFD_RELOC_390_TLS_GD64
+ENUMX
+ BFD_RELOC_390_TLS_GOTIE12
+ENUMX
+ BFD_RELOC_390_TLS_GOTIE32
+ENUMX
+ BFD_RELOC_390_TLS_GOTIE64
+ENUMX
+ BFD_RELOC_390_TLS_LDM32
+ENUMX
+ BFD_RELOC_390_TLS_LDM64
+ENUMX
+ BFD_RELOC_390_TLS_IE32
+ENUMX
+ BFD_RELOC_390_TLS_IE64
+ENUMX
+ BFD_RELOC_390_TLS_IEENT
+ENUMX
+ BFD_RELOC_390_TLS_LE32
+ENUMX
+ BFD_RELOC_390_TLS_LE64
+ENUMX
+ BFD_RELOC_390_TLS_LDO32
+ENUMX
+ BFD_RELOC_390_TLS_LDO64
+ENUMX
+ BFD_RELOC_390_TLS_DTPMOD
+ENUMX
+ BFD_RELOC_390_TLS_DTPOFF
+ENUMX
+ BFD_RELOC_390_TLS_TPOFF
+ENUMDOC
+ s390 tls relocations.
+
+ENUM
+ BFD_RELOC_390_20
+ENUMX
+ BFD_RELOC_390_GOT20
+ENUMX
+ BFD_RELOC_390_GOTPLT20
+ENUMX
+ BFD_RELOC_390_TLS_GOTIE20
+ENUMDOC
+ Long displacement extension.
+
+ENUM
+ BFD_RELOC_IP2K_FR9
+ENUMDOC
+ Scenix IP2K - 9-bit register number / data address
+ENUM
+ BFD_RELOC_IP2K_BANK
+ENUMDOC
+ Scenix IP2K - 4-bit register/data bank number
+ENUM
+ BFD_RELOC_IP2K_ADDR16CJP
+ENUMDOC
+ Scenix IP2K - low 13 bits of instruction word address
+ENUM
+ BFD_RELOC_IP2K_PAGE3
+ENUMDOC
+ Scenix IP2K - high 3 bits of instruction word address
+ENUM
+ BFD_RELOC_IP2K_LO8DATA
+ENUMX
+ BFD_RELOC_IP2K_HI8DATA
+ENUMX
+ BFD_RELOC_IP2K_EX8DATA
+ENUMDOC
+ Scenix IP2K - ext/low/high 8 bits of data address
+ENUM
+ BFD_RELOC_IP2K_LO8INSN
+ENUMX
+ BFD_RELOC_IP2K_HI8INSN
+ENUMDOC
+ Scenix IP2K - low/high 8 bits of instruction word address
+ENUM
+ BFD_RELOC_IP2K_PC_SKIP
+ENUMDOC
+ Scenix IP2K - even/odd PC modifier to modify snb pcl.0
+ENUM
+ BFD_RELOC_IP2K_TEXT
+ENUMDOC
+ Scenix IP2K - 16 bit word address in text section.
+ENUM
+ BFD_RELOC_IP2K_FR_OFFSET
+ENUMDOC
+ Scenix IP2K - 7-bit sp or dp offset
+ENUM
+ BFD_RELOC_VPE4KMATH_DATA
+ENUMX
+ BFD_RELOC_VPE4KMATH_INSN
+ENUMDOC
+ Scenix VPE4K coprocessor - data/insn-space addressing
ENUM
BFD_RELOC_VTABLE_INHERIT
@@ -3140,7 +3541,7 @@ ENUMDOC
included in the output.
VTABLE_INHERIT is a zero-space relocation used to describe to the
- linker the inheritence tree of a C++ virtual function table. 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.
@@ -3316,17 +3717,58 @@ ENUM
BFD_RELOC_M68HC11_HI8
ENUMDOC
Motorola 68HC11 reloc.
- This is the 8 bits high part of an absolute address.
+ This is the 8 bit high part of an absolute address.
ENUM
BFD_RELOC_M68HC11_LO8
ENUMDOC
Motorola 68HC11 reloc.
- This is the 8 bits low part of an absolute address.
+ This is the 8 bit low part of an absolute address.
ENUM
BFD_RELOC_M68HC11_3B
ENUMDOC
Motorola 68HC11 reloc.
- This is the 3 bits of a value.
+ This is the 3 bit of a value.
+ENUM
+ BFD_RELOC_M68HC11_RL_JUMP
+ENUMDOC
+ Motorola 68HC11 reloc.
+ This reloc marks the beginning of a jump/call instruction.
+ It is used for linker relaxation to correctly identify beginning
+ of instruction and change some branches to use PC-relative
+ addressing mode.
+ENUM
+ BFD_RELOC_M68HC11_RL_GROUP
+ENUMDOC
+ Motorola 68HC11 reloc.
+ This reloc marks a group of several instructions that gcc generates
+ and for which the linker relaxation pass can modify and/or remove
+ some of them.
+ENUM
+ BFD_RELOC_M68HC11_LO16
+ENUMDOC
+ Motorola 68HC11 reloc.
+ This is the 16-bit lower part of an address. It is used for 'call'
+ instruction to specify the symbol address without any special
+ transformation (due to memory bank window).
+ENUM
+ BFD_RELOC_M68HC11_PAGE
+ENUMDOC
+ Motorola 68HC11 reloc.
+ This is a 8-bit reloc that specifies the page number of an address.
+ It is used by 'call' instruction to specify the page number of
+ the symbol.
+ENUM
+ BFD_RELOC_M68HC11_24
+ENUMDOC
+ Motorola 68HC11 reloc.
+ This is a 24-bit reloc that represents the address with a 16-bit
+ value and a 8-bit page number. The symbol address is transformed
+ to follow the 16K memory bank of 68HC12 (seen as mapped in the window).
+ENUM
+ BFD_RELOC_M68HC12_5B
+ENUMDOC
+ Motorola 68HC12 reloc.
+ This is the 5 bits of a value.
ENUM
BFD_RELOC_CRIS_BDISP8
@@ -3470,6 +3912,8 @@ ENUMDOC
ENUM
BFD_RELOC_XSTORMY16_REL_12
ENUMX
+ BFD_RELOC_XSTORMY16_12
+ENUMX
BFD_RELOC_XSTORMY16_24
ENUMX
BFD_RELOC_XSTORMY16_FPTR16
@@ -3484,6 +3928,71 @@ ENUMX
BFD_RELOC_VAX_RELATIVE
ENUMDOC
Relocations used by VAX ELF.
+
+ENUM
+ BFD_RELOC_MSP430_10_PCREL
+ENUMX
+ BFD_RELOC_MSP430_16_PCREL
+ENUMX
+ BFD_RELOC_MSP430_16
+ENUMX
+ BFD_RELOC_MSP430_16_PCREL_BYTE
+ENUMX
+ BFD_RELOC_MSP430_16_BYTE
+ENUMDOC
+ msp430 specific relocation codes
+
+ENUM
+ BFD_RELOC_IQ2000_OFFSET_16
+ENUMX
+ BFD_RELOC_IQ2000_OFFSET_21
+ENUMX
+ BFD_RELOC_IQ2000_UHI16
+ENUMDOC
+ IQ2000 Relocations.
+
+ENUM
+ BFD_RELOC_XTENSA_RTLD
+ENUMDOC
+ Special Xtensa relocation used only by PLT entries in ELF shared
+ objects to indicate that the runtime linker should set the value
+ to one of its own internal functions or data structures.
+ENUM
+ BFD_RELOC_XTENSA_GLOB_DAT
+ENUMX
+ BFD_RELOC_XTENSA_JMP_SLOT
+ENUMX
+ BFD_RELOC_XTENSA_RELATIVE
+ENUMDOC
+ Xtensa relocations for ELF shared objects.
+ENUM
+ BFD_RELOC_XTENSA_PLT
+ENUMDOC
+ Xtensa relocation used in ELF object files for symbols that may require
+ PLT entries. Otherwise, this is just a generic 32-bit relocation.
+ENUM
+ BFD_RELOC_XTENSA_OP0
+ENUMX
+ BFD_RELOC_XTENSA_OP1
+ENUMX
+ BFD_RELOC_XTENSA_OP2
+ENUMDOC
+ Generic Xtensa relocations. Only the operand number is encoded
+ in the relocation. The details are determined by extracting the
+ instruction opcode.
+ENUM
+ BFD_RELOC_XTENSA_ASM_EXPAND
+ENUMDOC
+ Xtensa relocation to mark that the assembler expanded the
+ instructions from an original target. The expansion size is
+ encoded in the reloc size.
+ENUM
+ BFD_RELOC_XTENSA_ASM_SIMPLIFY
+ENUMDOC
+ Xtensa relocation to mark that the linker should simplify
+ assembler-expanded instructions. This is commonly used
+ internally by the linker after analysis of a
+ BFD_RELOC_XTENSA_ASM_EXPAND.
ENDSENUM
BFD_RELOC_UNUSED
@@ -3497,8 +4006,8 @@ FUNCTION
bfd_reloc_type_lookup
SYNOPSIS
- reloc_howto_type *
- bfd_reloc_type_lookup (bfd *abfd, bfd_reloc_code_real_type code);
+ reloc_howto_type *bfd_reloc_type_lookup
+ (bfd *abfd, bfd_reloc_code_real_type code);
DESCRIPTION
Return a pointer to a howto structure which, when
@@ -3508,15 +4017,13 @@ DESCRIPTION
*/
reloc_howto_type *
-bfd_reloc_type_lookup (abfd, code)
- bfd *abfd;
- bfd_reloc_code_real_type code;
+bfd_reloc_type_lookup (bfd *abfd, bfd_reloc_code_real_type code)
{
return BFD_SEND (abfd, reloc_type_lookup, (abfd, code));
}
static reloc_howto_type bfd_howto_32 =
-HOWTO (0, 00, 2, 32, false, 0, complain_overflow_bitfield, 0, "VRT32", false, 0xffffffff, 0xffffffff, true);
+HOWTO (0, 00, 2, 32, FALSE, 0, complain_overflow_bitfield, 0, "VRT32", FALSE, 0xffffffff, 0xffffffff, TRUE);
/*
INTERNAL_FUNCTION
@@ -3524,7 +4031,7 @@ INTERNAL_FUNCTION
SYNOPSIS
reloc_howto_type *bfd_default_reloc_type_lookup
- (bfd *abfd, bfd_reloc_code_real_type code);
+ (bfd *abfd, bfd_reloc_code_real_type code);
DESCRIPTION
Provides a default relocation lookup routine for any architecture.
@@ -3532,9 +4039,7 @@ DESCRIPTION
*/
reloc_howto_type *
-bfd_default_reloc_type_lookup (abfd, code)
- bfd *abfd;
- bfd_reloc_code_real_type code;
+bfd_default_reloc_type_lookup (bfd *abfd, bfd_reloc_code_real_type code)
{
switch (code)
{
@@ -3555,7 +4060,7 @@ bfd_default_reloc_type_lookup (abfd, code)
default:
BFD_FAIL ();
}
- return (reloc_howto_type *) NULL;
+ return NULL;
}
/*
@@ -3571,12 +4076,11 @@ DESCRIPTION
*/
const char *
-bfd_get_reloc_code_name (code)
- bfd_reloc_code_real_type code;
+bfd_get_reloc_code_name (bfd_reloc_code_real_type code)
{
- if ((int) code > (int) BFD_RELOC_UNUSED)
+ if (code > BFD_RELOC_UNUSED)
return 0;
- return bfd_reloc_code_real_names[(int)code];
+ return bfd_reloc_code_real_names[code];
}
/*
@@ -3584,26 +4088,31 @@ INTERNAL_FUNCTION
bfd_generic_relax_section
SYNOPSIS
- boolean bfd_generic_relax_section
- (bfd *abfd,
- asection *section,
- struct bfd_link_info *,
- boolean *);
+ bfd_boolean bfd_generic_relax_section
+ (bfd *abfd,
+ asection *section,
+ struct bfd_link_info *,
+ bfd_boolean *);
DESCRIPTION
Provides default handling for relaxing for back ends which
- don't do relaxing -- i.e., does nothing.
+ don't do relaxing -- i.e., does nothing except make sure that the
+ final size of the section is set.
*/
-boolean
-bfd_generic_relax_section (abfd, section, link_info, again)
- bfd *abfd ATTRIBUTE_UNUSED;
- asection *section ATTRIBUTE_UNUSED;
- struct bfd_link_info *link_info ATTRIBUTE_UNUSED;
- boolean *again;
+bfd_boolean
+bfd_generic_relax_section (bfd *abfd ATTRIBUTE_UNUSED,
+ asection *section ATTRIBUTE_UNUSED,
+ struct bfd_link_info *link_info ATTRIBUTE_UNUSED,
+ bfd_boolean *again)
{
- *again = false;
- return true;
+ /* 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;
}
/*
@@ -3611,20 +4120,19 @@ INTERNAL_FUNCTION
bfd_generic_gc_sections
SYNOPSIS
- boolean bfd_generic_gc_sections
- (bfd *, struct bfd_link_info *);
+ bfd_boolean bfd_generic_gc_sections
+ (bfd *, struct bfd_link_info *);
DESCRIPTION
Provides default handling for relaxing for back ends which
don't do section gc -- i.e., does nothing.
*/
-boolean
-bfd_generic_gc_sections (abfd, link_info)
- bfd *abfd ATTRIBUTE_UNUSED;
- struct bfd_link_info *link_info ATTRIBUTE_UNUSED;
+bfd_boolean
+bfd_generic_gc_sections (bfd *abfd ATTRIBUTE_UNUSED,
+ struct bfd_link_info *link_info ATTRIBUTE_UNUSED)
{
- return true;
+ return TRUE;
}
/*
@@ -3632,20 +4140,19 @@ INTERNAL_FUNCTION
bfd_generic_merge_sections
SYNOPSIS
- boolean bfd_generic_merge_sections
- (bfd *, struct bfd_link_info *);
+ bfd_boolean bfd_generic_merge_sections
+ (bfd *, struct bfd_link_info *);
DESCRIPTION
Provides default handling for SEC_MERGE section merging for back ends
which don't have SEC_MERGE support -- i.e., does nothing.
*/
-boolean
-bfd_generic_merge_sections (abfd, link_info)
- bfd *abfd ATTRIBUTE_UNUSED;
- struct bfd_link_info *link_info ATTRIBUTE_UNUSED;
+bfd_boolean
+bfd_generic_merge_sections (bfd *abfd ATTRIBUTE_UNUSED,
+ struct bfd_link_info *link_info ATTRIBUTE_UNUSED)
{
- return true;
+ return TRUE;
}
/*
@@ -3653,13 +4160,13 @@ INTERNAL_FUNCTION
bfd_generic_get_relocated_section_contents
SYNOPSIS
- bfd_byte *
- bfd_generic_get_relocated_section_contents (bfd *abfd,
- struct bfd_link_info *link_info,
- struct bfd_link_order *link_order,
- bfd_byte *data,
- boolean relocateable,
- asymbol **symbols);
+ bfd_byte *bfd_generic_get_relocated_section_contents
+ (bfd *abfd,
+ struct bfd_link_info *link_info,
+ struct bfd_link_order *link_order,
+ bfd_byte *data,
+ bfd_boolean relocatable,
+ asymbol **symbols);
DESCRIPTION
Provides default handling of relocation effort for back ends
@@ -3668,14 +4175,12 @@ DESCRIPTION
*/
bfd_byte *
-bfd_generic_get_relocated_section_contents (abfd, link_info, link_order, data,
- relocateable, symbols)
- bfd *abfd;
- struct bfd_link_info *link_info;
- struct bfd_link_order *link_order;
- bfd_byte *data;
- boolean relocateable;
- asymbol **symbols;
+bfd_generic_get_relocated_section_contents (bfd *abfd,
+ struct bfd_link_info *link_info,
+ struct bfd_link_order *link_order,
+ bfd_byte *data,
+ bfd_boolean relocatable,
+ asymbol **symbols)
{
/* Get enough memory to hold the stuff. */
bfd *input_bfd = link_order->u.indirect.section->owner;
@@ -3688,21 +4193,26 @@ bfd_generic_get_relocated_section_contents (abfd, link_info, link_order, data,
if (reloc_size < 0)
goto error_return;
- reloc_vector = (arelent **) bfd_malloc ((bfd_size_type) reloc_size);
+ reloc_vector = bfd_malloc (reloc_size);
if (reloc_vector == NULL && reloc_size != 0)
goto error_return;
/* Read in the section. */
if (!bfd_get_section_contents (input_bfd,
input_section,
- (PTR) data,
- (bfd_vma) 0,
+ data,
+ 0,
input_section->_raw_size))
goto error_return;
- /* We're not relaxing the section, so just copy the size info. */
- input_section->_cooked_size = input_section->_raw_size;
- input_section->reloc_done = (unsigned int) true;
+ /* 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,
@@ -3714,19 +4224,18 @@ bfd_generic_get_relocated_section_contents (abfd, link_info, link_order, data,
if (reloc_count > 0)
{
arelent **parent;
- for (parent = reloc_vector; *parent != (arelent *) NULL;
- parent++)
+ for (parent = reloc_vector; *parent != NULL; parent++)
{
- char *error_message = (char *) NULL;
+ char *error_message = NULL;
bfd_reloc_status_type r =
bfd_perform_relocation (input_bfd,
*parent,
- (PTR) data,
+ data,
input_section,
- relocateable ? abfd : (bfd *) NULL,
+ relocatable ? abfd : NULL,
&error_message);
- if (relocateable)
+ if (relocatable)
{
asection *os = input_section->output_section;
@@ -3743,11 +4252,11 @@ bfd_generic_get_relocated_section_contents (abfd, link_info, link_order, data,
if (!((*link_info->callbacks->undefined_symbol)
(link_info, bfd_asymbol_name (*(*parent)->sym_ptr_ptr),
input_bfd, input_section, (*parent)->address,
- true)))
+ TRUE)))
goto error_return;
break;
case bfd_reloc_dangerous:
- BFD_ASSERT (error_message != (char *) NULL);
+ BFD_ASSERT (error_message != NULL);
if (!((*link_info->callbacks->reloc_dangerous)
(link_info, error_message, input_bfd, input_section,
(*parent)->address)))
diff --git a/contrib/binutils/bfd/reloc16.c b/contrib/binutils/bfd/reloc16.c
index 1db8daf..720e2d6 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
- Free Software Foundation, Inc.
+ Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1998, 2000, 2001,
+ 2002, 2003 Free Software Foundation, Inc.
Written by Cygnus Support.
This file is part of BFD, the Binary File Descriptor library.
@@ -29,7 +29,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
BFD generic relocs. They should store the relocs in some location
where coff_link_input_bfd can find them (and coff_link_input_bfd
should be changed to use this location rather than rereading the
- file) (unless info->keep_memory is false, in which case they should
+ file) (unless info->keep_memory is FALSE, in which case they should
free up the relocs after dealing with them). */
#include "bfd.h"
@@ -64,7 +64,7 @@ bfd_coff_reloc16_get_value (reloc, link_info, input_section)
the generic symbols. */
h = bfd_wrapped_link_hash_lookup (input_section->owner, link_info,
bfd_asymbol_name (symbol),
- false, false, true);
+ FALSE, FALSE, TRUE);
if (h != (struct bfd_link_hash_entry *) NULL
&& (h->type == bfd_link_hash_defined
|| h->type == bfd_link_hash_defweak))
@@ -79,7 +79,7 @@ bfd_coff_reloc16_get_value (reloc, link_info, input_section)
if (!((*link_info->callbacks->undefined_symbol)
(link_info, bfd_asymbol_name (symbol),
input_section->owner, input_section, reloc->address,
- true)))
+ TRUE)))
abort ();
value = 0;
}
@@ -136,12 +136,12 @@ bfd_perform_slip (abfd, slip, input_section, value)
}
}
-boolean
+bfd_boolean
bfd_coff_reloc16_relax_section (abfd, input_section, link_info, again)
bfd *abfd;
asection *input_section;
struct bfd_link_info *link_info;
- boolean *again;
+ bfd_boolean *again;
{
/* Get enough memory to hold the stuff. */
bfd *input_bfd = input_section->owner;
@@ -153,14 +153,14 @@ bfd_coff_reloc16_relax_section (abfd, input_section, link_info, again)
/* We only do global relaxation once. It is not safe to do it multiple
times (see discussion of the "shrinks" array below). */
- *again = false;
+ *again = FALSE;
if (reloc_size < 0)
- return false;
+ return FALSE;
reloc_vector = (arelent **) bfd_malloc ((bfd_size_type) reloc_size);
if (!reloc_vector && reloc_size > 0)
- return false;
+ return FALSE;
/* Get the relocs and think about them. */
reloc_count =
@@ -169,7 +169,7 @@ bfd_coff_reloc16_relax_section (abfd, input_section, link_info, again)
if (reloc_count < 0)
{
free (reloc_vector);
- return false;
+ return FALSE;
}
/* The reloc16.c and related relaxing code is very simple, the price
@@ -193,36 +193,37 @@ bfd_coff_reloc16_relax_section (abfd, input_section, link_info, again)
bfd_size_type amt;
/* Allocate and initialize the shrinks array for this section.
- The last element is used as an accumlator of shrinks. */
+ The last element is used as an accumulator of shrinks. */
amt = reloc_count + 1;
amt *= sizeof (unsigned);
shrinks = (unsigned *) bfd_zmalloc (amt);
/* Loop until nothing changes in this section. */
- do {
- arelent **parent;
- unsigned int i;
- long j;
-
- another_pass = 0;
-
- for (i = 0, parent = reloc_vector; *parent; parent++, i++)
- {
- /* Let the target/machine dependent code examine each reloc
- in this section and attempt to shrink it. */
- shrink = bfd_coff_reloc16_estimate (abfd, input_section, *parent,
- shrinks[i], link_info);
-
- /* If it shrunk, note it in the shrinks array and set up for
- another pass. */
- if (shrink != shrinks[i])
- {
- another_pass = 1;
- for (j = i + 1; j <= reloc_count; j++)
- shrinks[j] += shrink - shrinks[i];
- }
- }
- }
+ do
+ {
+ arelent **parent;
+ unsigned int i;
+ long j;
+
+ another_pass = 0;
+
+ for (i = 0, parent = reloc_vector; *parent; parent++, i++)
+ {
+ /* Let the target/machine dependent code examine each reloc
+ in this section and attempt to shrink it. */
+ shrink = bfd_coff_reloc16_estimate (abfd, input_section, *parent,
+ shrinks[i], link_info);
+
+ /* If it shrunk, note it in the shrinks array and set up for
+ another pass. */
+ if (shrink != shrinks[i])
+ {
+ another_pass = 1;
+ for (j = i + 1; j <= reloc_count; j++)
+ shrinks[j] += shrink - shrinks[i];
+ }
+ }
+ }
while (another_pass);
shrink = shrinks[reloc_count];
@@ -231,21 +232,21 @@ bfd_coff_reloc16_relax_section (abfd, input_section, link_info, again)
input_section->_cooked_size -= shrink;
free ((char *) reloc_vector);
- return true;
+ return TRUE;
}
bfd_byte *
-bfd_coff_reloc16_get_relocated_section_contents(in_abfd,
- link_info,
- link_order,
- data,
- relocateable,
- symbols)
+bfd_coff_reloc16_get_relocated_section_contents (in_abfd,
+ link_info,
+ link_order,
+ data,
+ relocatable,
+ symbols)
bfd *in_abfd;
struct bfd_link_info *link_info;
struct bfd_link_order *link_order;
bfd_byte *data;
- boolean relocateable;
+ bfd_boolean relocatable;
asymbol **symbols;
{
/* Get enough memory to hold the stuff. */
@@ -258,19 +259,19 @@ bfd_coff_reloc16_get_relocated_section_contents(in_abfd,
if (reloc_size < 0)
return NULL;
- /* If producing relocateable output, don't bother to relax. */
- if (relocateable)
+ /* If producing relocatable output, don't bother to relax. */
+ if (relocatable)
return bfd_generic_get_relocated_section_contents (in_abfd, link_info,
link_order,
- data, relocateable,
+ data, relocatable,
symbols);
/* Read in the section. */
- if (!bfd_get_section_contents(input_bfd,
- input_section,
- data,
- (bfd_vma) 0,
- input_section->_raw_size))
+ if (!bfd_get_section_contents (input_bfd,
+ input_section,
+ data,
+ (bfd_vma) 0,
+ input_section->_raw_size))
return NULL;
reloc_vector = (arelent **) bfd_malloc ((bfd_size_type) reloc_size);
diff --git a/contrib/binutils/bfd/rs6000-core.c b/contrib/binutils/bfd/rs6000-core.c
index a61f25c..3fa0975 100644
--- a/contrib/binutils/bfd/rs6000-core.c
+++ b/contrib/binutils/bfd/rs6000-core.c
@@ -253,19 +253,19 @@ typedef union {
/* Try to read into CORE the header from the core file associated with ABFD.
Return success. */
-static boolean
+static bfd_boolean
read_hdr (bfd *abfd, CoreHdr *core)
{
bfd_size_type size;
if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0)
- return false;
+ return FALSE;
/* Read the leading portion that old and new core dump structures have in
common. */
size = CORE_COMMONSZ;
if (bfd_bread (core, size, abfd) != size)
- return false;
+ return FALSE;
/* Read the trailing portion of the structure. */
if (CORE_NEW (*core))
@@ -630,9 +630,9 @@ rs6000coff_core_p (abfd)
return NULL;
}
-/* Return `true' if given core is from the given executable. */
+/* Return `TRUE' if given core is from the given executable. */
-boolean
+bfd_boolean
rs6000coff_core_file_matches_executable_p (core_bfd, exec_bfd)
bfd *core_bfd;
bfd *exec_bfd;
@@ -642,11 +642,11 @@ rs6000coff_core_file_matches_executable_p (core_bfd, exec_bfd)
char *path, *s;
size_t alloc;
const char *str1, *str2;
- boolean ret;
+ bfd_boolean ret;
file_ptr c_loader;
if (!read_hdr (core_bfd, &core))
- return false;
+ return FALSE;
if (CORE_NEW (core))
c_loader = CNEW_LOADER (core.new);
@@ -659,12 +659,12 @@ rs6000coff_core_file_matches_executable_p (core_bfd, exec_bfd)
size = (int) ((LdInfo *) 0)->l32.ldinfo_filename;
if (bfd_seek (core_bfd, c_loader + size, SEEK_SET) != 0)
- return false;
+ return FALSE;
alloc = 100;
path = bfd_malloc ((bfd_size_type) alloc);
if (path == NULL)
- return false;
+ return FALSE;
s = path;
while (1)
@@ -672,7 +672,7 @@ rs6000coff_core_file_matches_executable_p (core_bfd, exec_bfd)
if (bfd_bread (s, (bfd_size_type) 1, core_bfd) != 1)
{
free (path);
- return false;
+ return FALSE;
}
if (*s == '\0')
break;
@@ -686,7 +686,7 @@ rs6000coff_core_file_matches_executable_p (core_bfd, exec_bfd)
if (n == NULL)
{
free (path);
- return false;
+ return FALSE;
}
s = n + (path - s);
path = n;
@@ -701,9 +701,9 @@ rs6000coff_core_file_matches_executable_p (core_bfd, exec_bfd)
str2 = str2 != NULL ? str2 + 1 : exec_bfd->filename;
if (strcmp (str1, str2) == 0)
- ret = true;
+ ret = TRUE;
else
- ret = false;
+ ret = FALSE;
free (path);
diff --git a/contrib/binutils/bfd/sco5-core.c b/contrib/binutils/bfd/sco5-core.c
index 9f5b793..5c34ff1 100644
--- a/contrib/binutils/bfd/sco5-core.c
+++ b/contrib/binutils/bfd/sco5-core.c
@@ -1,5 +1,6 @@
/* BFD back end for SCO5 core files (U-area and raw sections)
- Copyright 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
+ Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2004
+ Free Software Foundation, Inc.
Written by Jouke Numan <jnuman@hiscom.nl>
This file is part of BFD, the Binary File Descriptor library.
@@ -21,7 +22,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "bfd.h"
#include "sysdep.h"
#include "libbfd.h"
-#include "libaout.h" /* BFD a.out internal data structures */
+#include "libaout.h" /* BFD a.out internal data structures */
#include <stdio.h>
#include <sys/types.h>
@@ -29,7 +30,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include <sys/dir.h>
#include <signal.h>
-#include <sys/user.h> /* After a.out.h */
+#include <sys/user.h> /* After a.out.h */
#include <sys/paccess.h>
#include <sys/region.h>
@@ -40,15 +41,14 @@ struct sco5_core_struct
/* forward declarations */
-static asection *
-make_bfd_asection PARAMS ((bfd *, const char *, flagword, bfd_size_type,
- bfd_vma, file_ptr));
+static asection *make_bfd_asection
+ PARAMS ((bfd *, const char *, flagword, bfd_size_type, bfd_vma, file_ptr));
static struct user *read_uarea PARAMS ((bfd *, int));
const bfd_target *sco5_core_file_p PARAMS ((bfd *abfd));
char *sco5_core_file_failing_command PARAMS ((bfd *abfd));
int sco5_core_file_failing_signal PARAMS ((bfd *abfd));
-boolean sco5_core_file_matches_executable_p PARAMS ((bfd *core_bfd,
- bfd *exec_bfd));
+bfd_boolean sco5_core_file_matches_executable_p
+ PARAMS ((bfd *core_bfd, bfd *exec_bfd));
static void swap_abort PARAMS ((void));
static asection *
@@ -111,7 +111,6 @@ read_uarea(abfd, filepos)
return &rawptr->u;
}
-/* ARGSUSED */
const bfd_target *
sco5_core_file_p (abfd)
bfd *abfd;
@@ -133,8 +132,8 @@ sco5_core_file_p (abfd)
return NULL;
if (fstat (fileno (stream), &statbuf) < 0)
{
- bfd_set_error (bfd_error_system_call);
- return NULL;
+ bfd_set_error (bfd_error_system_call);
+ return NULL;
}
coresize = statbuf.st_size;
}
@@ -168,24 +167,24 @@ sco5_core_file_p (abfd)
goto fail;
if (!make_bfd_asection (abfd, ".reg", SEC_HAS_CONTENTS,
- (bfd_size_type) coffsets.u_usize,
- 0 - (bfd_vma) u->u_ar0,
- (file_ptr) coffsets.u_user))
+ (bfd_size_type) coffsets.u_usize,
+ 0 - (bfd_vma) u->u_ar0,
+ (file_ptr) coffsets.u_user))
goto fail;
if (!make_bfd_asection (abfd, ".data",
SEC_ALLOC + SEC_LOAD + SEC_HAS_CONTENTS,
- ((bfd_size_type) u->u_exdata.ux_dsize
+ ((bfd_size_type) u->u_exdata.ux_dsize
+ u->u_exdata.ux_bsize),
- (bfd_vma) u->u_exdata.ux_datorg,
- (file_ptr) coffsets.u_data))
+ (bfd_vma) u->u_exdata.ux_datorg,
+ (file_ptr) coffsets.u_data))
goto fail;
if (!make_bfd_asection (abfd, ".stack",
SEC_ALLOC + SEC_LOAD + SEC_HAS_CONTENTS,
- (bfd_size_type) u->u_ssize * NBPC,
- (bfd_vma) u->u_sub,
- (file_ptr) coffsets.u_stack))
+ (bfd_size_type) u->u_ssize * NBPC,
+ (bfd_vma) u->u_sub,
+ (file_ptr) coffsets.u_stack))
goto fail;
return abfd->xvec; /* Done for version 1 */
@@ -222,10 +221,10 @@ sco5_core_file_p (abfd)
if ((bfd_seek (abfd, (file_ptr) chead.cs_hseek, SEEK_SET) != 0)
|| (bfd_bread ((void *) &chead, (bfd_size_type) sizeof chead, abfd)
!= sizeof chead))
- {
- bfd_set_error (bfd_error_wrong_format);
+ {
+ bfd_set_error (bfd_error_wrong_format);
goto fail;
- }
+ }
switch (chead.cs_stype)
{
@@ -243,7 +242,7 @@ sco5_core_file_p (abfd)
if (! u)
goto fail;
- /* This is tricky. As the "register section", we give them
+ /* This is tricky. As the "register section", we give them
the entire upage and stack. u.u_ar0 points to where
"register 0" is stored. There are two tricks with this,
though. One is that the rest of the registers might be
@@ -263,33 +262,33 @@ sco5_core_file_p (abfd)
chead.cs_vaddr = 0 - (bfd_vma) u->u_ar0;
- secname = ".reg";
- flags = SEC_HAS_CONTENTS;
+ secname = ".reg";
+ flags = SEC_HAS_CONTENTS;
- break;
+ break;
case CORES_PREGION: /* A program region, map it */
switch (chead.cs_x.csx_preg.csxp_rtyp)
{
case PT_DATA:
- secname = ".data"; /* Data region. */
+ secname = ".data"; /* Data region. */
break;
case PT_STACK:
- secname = ".stack"; /* Stack region. */
+ secname = ".stack"; /* Stack region. */
break;
case PT_SHMEM:
- secname = ".shmem"; /* Shared memory */
+ secname = ".shmem"; /* Shared memory */
break;
case PT_LIBDAT:
- secname = ".libdat"; /* Shared library data */
+ secname = ".libdat"; /* Shared library data */
break;
case PT_V86:
- secname = ".virt86"; /* Virtual 8086 mode */
+ secname = ".virt86"; /* Virtual 8086 mode */
break;
case PT_SHFIL:
- secname = ".mmfile"; /* Memory mapped file */
+ secname = ".mmfile"; /* Memory mapped file */
break;
case PT_XDATA0:
- secname = ".Xdat0"; /* XENIX data region, virtual 0 */
+ secname = ".Xdat0"; /* XENIX data region, virtual 0 */
break;
default:
secname = "";
@@ -301,11 +300,11 @@ sco5_core_file_p (abfd)
case CORES_SCOUTSNAME: /* struct scoutsname */
secname = NULL; /* Ignore these */
break;
- default:
- (*_bfd_error_handler) ("Unhandled SCO core file section type %d\n",
- chead.cs_stype);
- continue;
- }
+ default:
+ (*_bfd_error_handler) ("Unhandled SCO core file section type %d\n",
+ chead.cs_stype);
+ continue;
+ }
if (secname
&& !make_bfd_asection (abfd, secname, flags,
@@ -339,7 +338,6 @@ sco5_core_file_failing_command (abfd)
return NULL;
}
-/* ARGSUSED */
int
sco5_core_file_failing_signal (ignore_abfd)
bfd *ignore_abfd;
@@ -349,13 +347,12 @@ sco5_core_file_failing_signal (ignore_abfd)
: -1);
}
-/* ARGSUSED */
-boolean
+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 */
+ return TRUE; /* FIXME, We have no way of telling at this point */
}
/* If somebody calls any byte-swapping routines, shoot them. */
@@ -364,44 +361,47 @@ swap_abort ()
{
abort (); /* This way doesn't require any declaration for ANSI to fuck up */
}
-#define NO_GET ((bfd_vma (*) PARAMS (( const bfd_byte *))) swap_abort )
-#define NO_PUT ((void (*) PARAMS ((bfd_vma, bfd_byte *))) swap_abort )
-#define NO_SIGNED_GET \
- ((bfd_signed_vma (*) PARAMS ((const bfd_byte *))) swap_abort )
+
+#define NO_GET ((bfd_vma (*) (const void *)) swap_abort)
+#define NO_PUT ((void (*) (bfd_vma, void *)) swap_abort)
+#define NO_GETS ((bfd_signed_vma (*) (const void *)) swap_abort)
+#define NO_GET64 ((bfd_uint64_t (*) (const void *)) swap_abort)
+#define NO_PUT64 ((void (*) (bfd_uint64_t, void *)) swap_abort)
+#define NO_GETS64 ((bfd_int64_t (*) (const void *)) swap_abort)
const bfd_target sco5_core_vec =
{
"sco5-core",
bfd_target_unknown_flavour,
- BFD_ENDIAN_LITTLE, /* target byte order */
- BFD_ENDIAN_LITTLE, /* target headers byte order */
- (HAS_RELOC | EXEC_P | /* object flags */
+ BFD_ENDIAN_LITTLE, /* target byte order */
+ BFD_ENDIAN_LITTLE, /* target headers byte order */
+ (HAS_RELOC | EXEC_P | /* object flags */
HAS_LINENO | HAS_DEBUG |
HAS_SYMS | HAS_LOCALS | WP_TEXT | D_PAGED),
(SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */
- 0, /* symbol prefix */
- ' ', /* ar_pad_char */
- 16, /* ar_max_namelen */
- NO_GET, NO_SIGNED_GET, NO_PUT, /* 64 bit data */
- NO_GET, NO_SIGNED_GET, NO_PUT, /* 32 bit data */
- NO_GET, NO_SIGNED_GET, NO_PUT, /* 16 bit data */
- NO_GET, NO_SIGNED_GET, NO_PUT, /* 64 bit hdrs */
- NO_GET, NO_SIGNED_GET, NO_PUT, /* 32 bit hdrs */
- NO_GET, NO_SIGNED_GET, NO_PUT, /* 16 bit hdrs */
-
- { /* bfd_check_format */
- _bfd_dummy_target, /* unknown format */
- _bfd_dummy_target, /* object file */
- _bfd_dummy_target, /* archive */
- sco5_core_file_p /* a core file */
+ 0, /* symbol prefix */
+ ' ', /* ar_pad_char */
+ 16, /* ar_max_namelen */
+ NO_GET64, NO_GETS64, NO_PUT64, /* 64 bit data */
+ NO_GET, NO_GETS, NO_PUT, /* 32 bit data */
+ NO_GET, NO_GETS, NO_PUT, /* 16 bit data */
+ NO_GET64, NO_GETS64, NO_PUT64, /* 64 bit hdrs */
+ NO_GET, NO_GETS, NO_PUT, /* 32 bit hdrs */
+ NO_GET, NO_GETS, NO_PUT, /* 16 bit hdrs */
+
+ { /* bfd_check_format */
+ _bfd_dummy_target, /* unknown format */
+ _bfd_dummy_target, /* object file */
+ _bfd_dummy_target, /* archive */
+ sco5_core_file_p /* a core file */
},
- { /* bfd_set_format */
- bfd_false, bfd_false,
- bfd_false, bfd_false
+ { /* bfd_set_format */
+ bfd_false, bfd_false,
+ bfd_false, bfd_false
},
- { /* bfd_write_contents */
- bfd_false, bfd_false,
- bfd_false, bfd_false
+ { /* bfd_write_contents */
+ bfd_false, bfd_false,
+ bfd_false, bfd_false
},
BFD_JUMP_TABLE_GENERIC (_bfd_generic),
@@ -416,5 +416,5 @@ const bfd_target sco5_core_vec =
NULL,
- (PTR) 0 /* backend_data */
-};
+ (PTR) 0 /* backend_data */
+ };
diff --git a/contrib/binutils/bfd/section.c b/contrib/binutils/bfd/section.c
index b5871e9..fce8e1e 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
+ 2000, 2001, 2002, 2003
Free Software Foundation, Inc.
Written by Cygnus Support.
@@ -166,7 +166,7 @@ CODE_FRAGMENT
. long symbol;
.};
.
-.typedef struct sec
+.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. *}
@@ -179,7 +179,7 @@ CODE_FRAGMENT
. int index;
.
. {* The next section in the list belonging to the BFD, or NULL. *}
-. struct sec *next;
+. struct bfd_section *next;
.
. {* The field flags contains attributes of the section. Some
. flags are read in from the object file, and some are
@@ -377,10 +377,39 @@ CODE_FRAGMENT
. {* A mark flag used by some linker backends for garbage collection. *}
. unsigned int gc_mark : 1;
.
-. {* Used by the ELF code to mark sections which have been allocated
-. to segments. *}
+. {* 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
@@ -416,7 +445,7 @@ CODE_FRAGMENT
. bfd_vma output_offset;
.
. {* The output section through which to map on output. *}
-. struct sec *output_section;
+. 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). *}
@@ -446,7 +475,7 @@ CODE_FRAGMENT
. file_ptr line_filepos;
.
. {* Pointer to data for applications. *}
-. PTR userdata;
+. void *userdata;
.
. {* If the SEC_IN_MEMORY flag is set, this points to the actual
. contents. *}
@@ -464,6 +493,10 @@ CODE_FRAGMENT
. {* 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;
@@ -471,7 +504,7 @@ CODE_FRAGMENT
. {* What the section number is in the target world. *}
. int target_index;
.
-. PTR used_by_bfd;
+. void *used_by_bfd;
.
. {* If this is a constructor section then here is a list of the
. relocations created to relocate items within it. *}
@@ -481,8 +514,8 @@ CODE_FRAGMENT
. bfd *owner;
.
. {* A symbol which points at this section only. *}
-. struct symbol_cache_entry *symbol;
-. struct symbol_cache_entry **symbol_ptr_ptr;
+. struct bfd_symbol *symbol;
+. struct bfd_symbol **symbol_ptr_ptr;
.
. struct bfd_link_order *link_order_head;
. struct bfd_link_order *link_order_tail;
@@ -499,18 +532,18 @@ CODE_FRAGMENT
.#define BFD_IND_SECTION_NAME "*IND*"
.
.{* The absolute section. *}
-.extern const asection bfd_abs_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 const asection bfd_und_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 const asection bfd_com_section;
+.extern asection bfd_com_section;
.#define bfd_com_section_ptr ((asection *) &bfd_com_section)
.{* Pointer to the indirect section. *}
-.extern const asection bfd_ind_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)
.
@@ -520,13 +553,12 @@ CODE_FRAGMENT
. || ((SEC) == bfd_com_section_ptr) \
. || ((SEC) == bfd_ind_section_ptr))
.
-.extern const struct symbol_cache_entry * const bfd_abs_symbol;
-.extern const struct symbol_cache_entry * const bfd_com_symbol;
-.extern const struct symbol_cache_entry * const bfd_und_symbol;
-.extern const struct symbol_cache_entry * const bfd_ind_symbol;
+.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)->reloc_done ? (abort (), (bfd_size_type) 1) \
-. : (section)->_raw_size)
+. ((section)->_raw_size)
.#define bfd_get_section_size_after_reloc(section) \
. ((section)->reloc_done ? (section)->_cooked_size \
. : (abort (), (bfd_size_type) 1))
@@ -583,18 +615,27 @@ static const asymbol global_syms[] =
#define STD_SECTION(SEC, FLAGS, SYM, NAME, IDX) \
const asymbol * const SYM = (asymbol *) &global_syms[IDX]; \
- const asection SEC = \
+ 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 sec *) &SEC, 0, \
+ 0, (struct bfd_section *) &SEC, 0, \
\
/* relocation, orelocation, reloc_count, filepos, rel_filepos, */ \
NULL, NULL, 0, 0, 0, \
@@ -602,17 +643,17 @@ static const asymbol global_syms[] =
/* line_filepos, userdata, contents, lineno, lineno_count, */ \
0, NULL, NULL, NULL, 0, \
\
- /* entsize, comdat, moving_line_filepos, */ \
- 0, 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 symbol_cache_entry *) &global_syms[IDX], \
+ (struct bfd_symbol *) &global_syms[IDX], \
\
/* symbol_ptr_ptr, */ \
- (struct symbol_cache_entry **) &SYM, \
+ (struct bfd_symbol **) &SYM, \
\
/* link_order_head, link_order_tail */ \
NULL, NULL \
@@ -634,10 +675,9 @@ struct section_hash_entry
/* Initialize an entry in the section hash table. */
struct bfd_hash_entry *
-bfd_section_hash_newfunc (entry, table, string)
- struct bfd_hash_entry *entry;
- struct bfd_hash_table *table;
- const char *string;
+bfd_section_hash_newfunc (struct bfd_hash_entry *entry,
+ struct bfd_hash_table *table,
+ const char *string)
{
/* Allocate the structure if it has not already been allocated by a
subclass. */
@@ -652,10 +692,8 @@ bfd_section_hash_newfunc (entry, table, string)
/* Call the allocation method of the superclass. */
entry = bfd_hash_newfunc (entry, table, string);
if (entry != NULL)
- {
- memset ((PTR) &((struct section_hash_entry *) entry)->section,
- 0, sizeof (asection));
- }
+ memset (&((struct section_hash_entry *) entry)->section, 0,
+ sizeof (asection));
return entry;
}
@@ -666,12 +704,8 @@ bfd_section_hash_newfunc (entry, table, string)
/* Initializes a new section. NEWSECT->NAME is already set. */
-static asection *bfd_section_init PARAMS ((bfd *, asection *));
-
static asection *
-bfd_section_init (abfd, newsect)
- bfd *abfd;
- asection *newsect;
+bfd_section_init (bfd *abfd, asection *newsect)
{
static int section_id = 0x10; /* id 0 to 3 used by STD_SECTION. */
@@ -726,13 +760,12 @@ DESCRIPTION
*/
void
-bfd_section_list_clear (abfd)
- bfd *abfd;
+bfd_section_list_clear (bfd *abfd)
{
abfd->sections = NULL;
abfd->section_tail = &abfd->sections;
abfd->section_count = 0;
- memset ((PTR) abfd->section_htab.table, 0,
+ memset (abfd->section_htab.table, 0,
abfd->section_htab.size * sizeof (struct bfd_hash_entry *));
}
@@ -741,7 +774,7 @@ FUNCTION
bfd_get_section_by_name
SYNOPSIS
- asection *bfd_get_section_by_name(bfd *abfd, const char *name);
+ asection *bfd_get_section_by_name (bfd *abfd, const char *name);
DESCRIPTION
Run through @var{abfd} and return the one of the
@@ -755,13 +788,11 @@ DESCRIPTION
*/
asection *
-bfd_get_section_by_name (abfd, name)
- bfd *abfd;
- const char *name;
+bfd_get_section_by_name (bfd *abfd, const char *name)
{
struct section_hash_entry *sh;
- sh = section_hash_lookup (&abfd->section_htab, name, false, false);
+ sh = section_hash_lookup (&abfd->section_htab, name, FALSE, FALSE);
if (sh != NULL)
return &sh->section;
@@ -773,9 +804,8 @@ FUNCTION
bfd_get_unique_section_name
SYNOPSIS
- char *bfd_get_unique_section_name(bfd *abfd,
- const char *templat,
- int *count);
+ char *bfd_get_unique_section_name
+ (bfd *abfd, const char *templat, int *count);
DESCRIPTION
Invent a section name that is unique in @var{abfd} by tacking
@@ -786,17 +816,14 @@ DESCRIPTION
*/
char *
-bfd_get_unique_section_name (abfd, templat, count)
- bfd *abfd;
- const char *templat;
- int *count;
+bfd_get_unique_section_name (bfd *abfd, const char *templat, int *count)
{
int num;
unsigned int len;
char *sname;
len = strlen (templat);
- sname = bfd_malloc ((bfd_size_type) len + 8);
+ sname = bfd_malloc (len + 8);
if (sname == NULL)
return NULL;
memcpy (sname, templat, len);
@@ -811,7 +838,7 @@ bfd_get_unique_section_name (abfd, templat, count)
abort ();
sprintf (sname + len, ".%d", num++);
}
- while (section_hash_lookup (&abfd->section_htab, sname, false, false));
+ while (section_hash_lookup (&abfd->section_htab, sname, FALSE, FALSE));
if (count != NULL)
*count = num;
@@ -823,7 +850,7 @@ FUNCTION
bfd_make_section_old_way
SYNOPSIS
- asection *bfd_make_section_old_way(bfd *abfd, const char *name);
+ asection *bfd_make_section_old_way (bfd *abfd, const char *name);
DESCRIPTION
Create a new empty section called @var{name}
@@ -844,9 +871,7 @@ DESCRIPTION
*/
asection *
-bfd_make_section_old_way (abfd, name)
- bfd *abfd;
- const char *name;
+bfd_make_section_old_way (bfd *abfd, const char *name)
{
struct section_hash_entry *sh;
asection *newsect;
@@ -869,7 +894,7 @@ bfd_make_section_old_way (abfd, name)
if (strcmp (name, BFD_IND_SECTION_NAME) == 0)
return bfd_ind_section_ptr;
- sh = section_hash_lookup (&abfd->section_htab, name, true, false);
+ sh = section_hash_lookup (&abfd->section_htab, name, TRUE, FALSE);
if (sh == NULL)
return NULL;
@@ -889,7 +914,7 @@ FUNCTION
bfd_make_section_anyway
SYNOPSIS
- asection *bfd_make_section_anyway(bfd *abfd, 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
@@ -902,9 +927,7 @@ DESCRIPTION
*/
sec_ptr
-bfd_make_section_anyway (abfd, name)
- bfd *abfd;
- const char *name;
+bfd_make_section_anyway (bfd *abfd, const char *name)
{
struct section_hash_entry *sh;
asection *newsect;
@@ -915,7 +938,7 @@ bfd_make_section_anyway (abfd, name)
return NULL;
}
- sh = section_hash_lookup (&abfd->section_htab, name, true, false);
+ sh = section_hash_lookup (&abfd->section_htab, name, TRUE, FALSE);
if (sh == NULL)
return NULL;
@@ -926,7 +949,7 @@ bfd_make_section_anyway (abfd, name)
section_htab without generating a unique section name and
that would be pointless; We don't need to traverse the
hash table. */
- newsect = (asection *) bfd_zalloc (abfd, sizeof (asection));
+ newsect = bfd_zalloc (abfd, sizeof (asection));
if (newsect == NULL)
return NULL;
}
@@ -940,7 +963,7 @@ FUNCTION
bfd_make_section
SYNOPSIS
- asection *bfd_make_section(bfd *, const char *name);
+ asection *bfd_make_section (bfd *, const char *name);
DESCRIPTION
Like <<bfd_make_section_anyway>>, but return <<NULL>> (without calling
@@ -950,9 +973,7 @@ DESCRIPTION
*/
asection *
-bfd_make_section (abfd, name)
- bfd *abfd;
- const char *name;
+bfd_make_section (bfd *abfd, const char *name)
{
struct section_hash_entry *sh;
asection *newsect;
@@ -969,7 +990,7 @@ bfd_make_section (abfd, name)
|| strcmp (name, BFD_IND_SECTION_NAME) == 0)
return NULL;
- sh = section_hash_lookup (&abfd->section_htab, name, true, false);
+ sh = section_hash_lookup (&abfd->section_htab, name, TRUE, FALSE);
if (sh == NULL)
return NULL;
@@ -977,7 +998,7 @@ bfd_make_section (abfd, name)
if (newsect->name != NULL)
{
/* Section already exists. */
- return newsect;
+ return NULL;
}
newsect->name = name;
@@ -989,12 +1010,13 @@ FUNCTION
bfd_set_section_flags
SYNOPSIS
- boolean bfd_set_section_flags(bfd *abfd, asection *sec, flagword flags);
+ bfd_boolean bfd_set_section_flags
+ (bfd *abfd, asection *sec, flagword flags);
DESCRIPTION
Set the attributes of the section @var{sec} in the BFD
- @var{abfd} to the value @var{flags}. Return <<true>> on success,
- <<false>> on error. Possible error returns are:
+ @var{abfd} to the value @var{flags}. Return <<TRUE>> on success,
+ <<FALSE>> on error. Possible error returns are:
o <<bfd_error_invalid_operation>> -
The section cannot have one or more of the attributes
@@ -1003,12 +1025,10 @@ DESCRIPTION
*/
-/*ARGSUSED*/
-boolean
-bfd_set_section_flags (abfd, section, flags)
- bfd *abfd ATTRIBUTE_UNUSED;
- sec_ptr section;
- flagword flags;
+bfd_boolean
+bfd_set_section_flags (bfd *abfd ATTRIBUTE_UNUSED,
+ sec_ptr section,
+ flagword flags)
{
#if 0
/* If you try to copy a text section from an input file (where it
@@ -1019,12 +1039,12 @@ bfd_set_section_flags (abfd, section, flags)
if ((flags & bfd_applicable_section_flags (abfd)) != flags)
{
bfd_set_error (bfd_error_invalid_operation);
- return false;
+ return FALSE;
}
#endif
section->flags = flags;
- return true;
+ return TRUE;
}
/*
@@ -1032,34 +1052,31 @@ FUNCTION
bfd_map_over_sections
SYNOPSIS
- void bfd_map_over_sections(bfd *abfd,
- void (*func) (bfd *abfd,
- asection *sect,
- PTR obj),
- PTR obj);
+ void bfd_map_over_sections
+ (bfd *abfd,
+ void (*func) (bfd *abfd, asection *sect, void *obj),
+ void *obj);
DESCRIPTION
Call the provided function @var{func} for each section
attached to the BFD @var{abfd}, passing @var{obj} as an
argument. The function will be called as if by
-| func(abfd, the_section, obj);
+| func (abfd, the_section, obj);
- This is the prefered method for iterating over sections; an
+ This is the preferred method for iterating over sections; an
alternative would be to use a loop:
| section *p;
| for (p = abfd->sections; p != NULL; p = p->next)
-| func(abfd, p, ...)
+| func (abfd, p, ...)
*/
-/*VARARGS2*/
void
-bfd_map_over_sections (abfd, operation, user_storage)
- bfd *abfd;
- void (*operation) PARAMS ((bfd * abfd, asection * sect, PTR obj));
- PTR user_storage;
+bfd_map_over_sections (bfd *abfd,
+ void (*operation) (bfd *, asection *, void *),
+ void *user_storage)
{
asection *sect;
unsigned int i = 0;
@@ -1076,11 +1093,12 @@ FUNCTION
bfd_set_section_size
SYNOPSIS
- boolean bfd_set_section_size(bfd *abfd, asection *sec, bfd_size_type val);
+ bfd_boolean bfd_set_section_size
+ (bfd *abfd, asection *sec, bfd_size_type val);
DESCRIPTION
Set @var{sec} to the size @var{val}. If the operation is
- ok, then <<true>> is returned, else <<false>>.
+ ok, then <<TRUE>> is returned, else <<FALSE>>.
Possible error returns:
o <<bfd_error_invalid_operation>> -
@@ -1088,11 +1106,8 @@ DESCRIPTION
*/
-boolean
-bfd_set_section_size (abfd, ptr, val)
- bfd *abfd;
- sec_ptr ptr;
- bfd_size_type val;
+bfd_boolean
+bfd_set_section_size (bfd *abfd, sec_ptr ptr, bfd_size_type val)
{
/* Once you've started writing to any section you cannot create or change
the size of any others. */
@@ -1100,13 +1115,13 @@ bfd_set_section_size (abfd, ptr, val)
if (abfd->output_has_begun)
{
bfd_set_error (bfd_error_invalid_operation);
- return false;
+ return FALSE;
}
ptr->_cooked_size = val;
ptr->_raw_size = val;
- return true;
+ return TRUE;
}
/*
@@ -1114,9 +1129,9 @@ FUNCTION
bfd_set_section_contents
SYNOPSIS
- boolean bfd_set_section_contents (bfd *abfd, asection *section,
- PTR data, file_ptr offset,
- bfd_size_type count);
+ bfd_boolean bfd_set_section_contents
+ (bfd *abfd, asection *section, const void *data,
+ file_ptr offset, bfd_size_type count);
DESCRIPTION
Sets the contents of the section @var{section} in BFD
@@ -1124,7 +1139,7 @@ DESCRIPTION
data is written to the output section starting at offset
@var{offset} for @var{count} octets.
- Normally <<true>> is returned, else <<false>>. Possible error
+ Normally <<TRUE>> is returned, else <<FALSE>>. Possible error
returns are:
o <<bfd_error_no_contents>> -
The output section does not have the <<SEC_HAS_CONTENTS>>
@@ -1136,25 +1151,24 @@ 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))
-
-boolean
-bfd_set_section_contents (abfd, section, location, offset, count)
- bfd *abfd;
- sec_ptr section;
- PTR location;
- file_ptr offset;
- bfd_size_type count;
+#define bfd_get_section_size_now(abfd, sec) \
+ (sec->reloc_done \
+ ? bfd_get_section_size_after_reloc (sec) \
+ : bfd_get_section_size_before_reloc (sec))
+
+bfd_boolean
+bfd_set_section_contents (bfd *abfd,
+ sec_ptr section,
+ const void *location,
+ file_ptr offset,
+ bfd_size_type count)
{
bfd_size_type sz;
if (!(bfd_get_section_flags (abfd, section) & SEC_HAS_CONTENTS))
{
bfd_set_error (bfd_error_no_contents);
- return (false);
+ return FALSE;
}
sz = bfd_get_section_size_now (abfd, section);
@@ -1164,7 +1178,7 @@ bfd_set_section_contents (abfd, section, location, offset, count)
|| count != (size_t) count)
{
bfd_set_error (bfd_error_bad_value);
- return false;
+ return FALSE;
}
switch (abfd->direction)
@@ -1172,7 +1186,7 @@ bfd_set_section_contents (abfd, section, location, offset, count)
case read_direction:
case no_direction:
bfd_set_error (bfd_error_invalid_operation);
- return false;
+ return FALSE;
case write_direction:
break;
@@ -1181,23 +1195,23 @@ bfd_set_section_contents (abfd, section, location, offset, count)
/* 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;
+ abfd->output_has_begun = TRUE;
break;
}
/* Record a copy of the data in memory if desired. */
if (section->contents
- && location != (PTR) (section->contents + offset))
+ && location != section->contents + offset)
memcpy (section->contents + offset, location, (size_t) count);
if (BFD_SEND (abfd, _bfd_set_section_contents,
(abfd, section, location, offset, count)))
{
- abfd->output_has_begun = true;
- return true;
+ abfd->output_has_begun = TRUE;
+ return TRUE;
}
- return false;
+ return FALSE;
}
/*
@@ -1205,9 +1219,9 @@ FUNCTION
bfd_get_section_contents
SYNOPSIS
- boolean bfd_get_section_contents (bfd *abfd, asection *section,
- PTR location, file_ptr offset,
- bfd_size_type count);
+ bfd_boolean bfd_get_section_contents
+ (bfd *abfd, asection *section, void *location, file_ptr offset,
+ bfd_size_type count);
DESCRIPTION
Read data from @var{section} in BFD @var{abfd}
@@ -1218,27 +1232,26 @@ DESCRIPTION
If the contents of a constructor with the <<SEC_CONSTRUCTOR>>
flag set are requested or if the section does not have the
<<SEC_HAS_CONTENTS>> flag set, then the @var{location} is filled
- with zeroes. If no errors occur, <<true>> is returned, else
- <<false>>.
+ with zeroes. If no errors occur, <<TRUE>> is returned, else
+ <<FALSE>>.
*/
-boolean
-bfd_get_section_contents (abfd, section, location, offset, count)
- bfd *abfd;
- sec_ptr section;
- PTR location;
- file_ptr offset;
- bfd_size_type count;
+bfd_boolean
+bfd_get_section_contents (bfd *abfd,
+ sec_ptr section,
+ void *location,
+ file_ptr offset,
+ bfd_size_type count)
{
bfd_size_type sz;
if (section->flags & SEC_CONSTRUCTOR)
{
memset (location, 0, (size_t) count);
- return true;
+ return TRUE;
}
- /* Even if reloc_done is true, this function reads unrelocated
+ /* Even if reloc_done is TRUE, this function reads unrelocated
contents, so we want the raw size. */
sz = section->_raw_size;
if ((bfd_size_type) offset > sz
@@ -1247,23 +1260,23 @@ bfd_get_section_contents (abfd, section, location, offset, count)
|| count != (size_t) count)
{
bfd_set_error (bfd_error_bad_value);
- return false;
+ return FALSE;
}
if (count == 0)
/* Don't bother. */
- return true;
+ return TRUE;
if ((section->flags & SEC_HAS_CONTENTS) == 0)
{
memset (location, 0, (size_t) count);
- return true;
+ return TRUE;
}
if ((section->flags & SEC_IN_MEMORY) != 0)
{
memcpy (location, section->contents + offset, (size_t) count);
- return true;
+ return TRUE;
}
return BFD_SEND (abfd, _bfd_get_section_contents,
@@ -1275,13 +1288,13 @@ FUNCTION
bfd_copy_private_section_data
SYNOPSIS
- boolean bfd_copy_private_section_data (bfd *ibfd, asection *isec,
- bfd *obfd, asection *osec);
+ bfd_boolean bfd_copy_private_section_data
+ (bfd *ibfd, asection *isec, bfd *obfd, asection *osec);
DESCRIPTION
Copy private section information from @var{isec} in the BFD
@var{ibfd} to the section @var{osec} in the BFD @var{obfd}.
- Return <<true>> on success, <<false>> on error. Possible error
+ Return <<TRUE>> on success, <<FALSE>> on error. Possible error
returns are:
o <<bfd_error_no_memory>> -
@@ -1298,7 +1311,7 @@ FUNCTION
SYNOPSIS
void _bfd_strip_section_from_output
- (struct bfd_link_info *info, asection *section);
+ (struct bfd_link_info *info, asection *section);
DESCRIPTION
Remove @var{section} from the output. If the output section
@@ -1309,9 +1322,7 @@ DESCRIPTION
to remove sections.
*/
void
-_bfd_strip_section_from_output (info, s)
- struct bfd_link_info *info;
- asection *s;
+_bfd_strip_section_from_output (struct bfd_link_info *info, asection *s)
{
asection *os;
asection *is;
@@ -1343,16 +1354,15 @@ FUNCTION
bfd_generic_discard_group
SYNOPSIS
- boolean bfd_generic_discard_group (bfd *abfd, asection *group);
+ bfd_boolean bfd_generic_discard_group (bfd *abfd, asection *group);
DESCRIPTION
Remove all members of @var{group} from the output.
*/
-boolean
-bfd_generic_discard_group (abfd, group)
- bfd *abfd ATTRIBUTE_UNUSED;
- asection *group ATTRIBUTE_UNUSED;
+bfd_boolean
+bfd_generic_discard_group (bfd *abfd ATTRIBUTE_UNUSED,
+ asection *group ATTRIBUTE_UNUSED)
{
- return true;
+ return TRUE;
}
diff --git a/contrib/binutils/bfd/simple.c b/contrib/binutils/bfd/simple.c
new file mode 100644
index 0000000..fc2472e
--- /dev/null
+++ b/contrib/binutils/bfd/simple.c
@@ -0,0 +1,257 @@
+/* simple.c -- BFD simple client routines
+ Copyright 2002, 2003, 2004
+ Free Software Foundation, Inc.
+ Contributed by MontaVista Software, Inc.
+
+ This file is part of BFD, the Binary File Descriptor library.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+
+#include "bfd.h"
+#include "sysdep.h"
+#include "libbfd.h"
+#include "bfdlink.h"
+
+static bfd_boolean
+simple_dummy_warning (struct bfd_link_info *link_info ATTRIBUTE_UNUSED,
+ const char *warning ATTRIBUTE_UNUSED,
+ const char *symbol ATTRIBUTE_UNUSED,
+ bfd *abfd ATTRIBUTE_UNUSED,
+ asection *section ATTRIBUTE_UNUSED,
+ bfd_vma address ATTRIBUTE_UNUSED)
+{
+ return TRUE;
+}
+
+static bfd_boolean
+simple_dummy_undefined_symbol (struct bfd_link_info *link_info ATTRIBUTE_UNUSED,
+ const char *name ATTRIBUTE_UNUSED,
+ bfd *abfd ATTRIBUTE_UNUSED,
+ asection *section ATTRIBUTE_UNUSED,
+ bfd_vma address ATTRIBUTE_UNUSED,
+ bfd_boolean fatal ATTRIBUTE_UNUSED)
+{
+ return TRUE;
+}
+
+static bfd_boolean
+simple_dummy_reloc_overflow (struct bfd_link_info *link_info ATTRIBUTE_UNUSED,
+ const char *name ATTRIBUTE_UNUSED,
+ const char *reloc_name ATTRIBUTE_UNUSED,
+ bfd_vma addend ATTRIBUTE_UNUSED,
+ bfd *abfd ATTRIBUTE_UNUSED,
+ asection *section ATTRIBUTE_UNUSED,
+ bfd_vma address ATTRIBUTE_UNUSED)
+{
+ return TRUE;
+}
+
+static bfd_boolean
+simple_dummy_reloc_dangerous (struct bfd_link_info *link_info ATTRIBUTE_UNUSED,
+ const char *message ATTRIBUTE_UNUSED,
+ bfd *abfd ATTRIBUTE_UNUSED,
+ asection *section ATTRIBUTE_UNUSED,
+ bfd_vma address ATTRIBUTE_UNUSED)
+{
+ return TRUE;
+}
+
+static bfd_boolean
+simple_dummy_unattached_reloc (struct bfd_link_info *link_info ATTRIBUTE_UNUSED,
+ const char *name ATTRIBUTE_UNUSED,
+ bfd *abfd ATTRIBUTE_UNUSED,
+ asection *section ATTRIBUTE_UNUSED,
+ bfd_vma address ATTRIBUTE_UNUSED)
+{
+ return TRUE;
+}
+
+struct saved_output_info
+{
+ bfd_vma offset;
+ asection *section;
+};
+
+static void
+simple_save_output_info (bfd *abfd ATTRIBUTE_UNUSED,
+ asection *section,
+ void *ptr)
+{
+ struct saved_output_info *output_info = ptr;
+ output_info[section->index].offset = section->output_offset;
+ output_info[section->index].section = section->output_section;
+ section->output_offset = 0;
+ section->output_section = section;
+}
+
+static void
+simple_restore_output_info (bfd *abfd ATTRIBUTE_UNUSED,
+ asection *section,
+ void *ptr)
+{
+ struct saved_output_info *output_info = ptr;
+ section->output_offset = output_info[section->index].offset;
+ section->output_section = output_info[section->index].section;
+}
+
+/*
+FUNCTION
+ bfd_simple_relocate_secton
+
+SYNOPSIS
+ bfd_byte *bfd_simple_get_relocated_section_contents
+ (bfd *abfd, asection *sec, bfd_byte *outbuf, asymbol **symbol_table);
+
+DESCRIPTION
+ Returns the relocated contents of section @var{sec}. The symbols in
+ @var{symbol_table} will be used, or the symbols from @var{abfd} if
+ @var{symbol_table} is NULL. The output offsets for all sections will
+ be temporarily reset to 0. The result will be stored at @var{outbuf}
+ or allocated with @code{bfd_malloc} if @var{outbuf} is @code{NULL}.
+
+ Generally all sections in @var{abfd} should have their
+ @code{output_section} pointing back to the original section.
+
+ Returns @code{NULL} on a fatal error; ignores errors applying
+ particular relocations.
+*/
+
+bfd_byte *
+bfd_simple_get_relocated_section_contents (bfd *abfd,
+ asection *sec,
+ bfd_byte *outbuf,
+ asymbol **symbol_table)
+{
+ struct bfd_link_info link_info;
+ struct bfd_link_order link_order;
+ struct bfd_link_callbacks callbacks;
+ bfd_byte *contents, *data;
+ int storage_needed;
+ void *saved_offsets;
+ bfd_size_type old_cooked_size;
+
+ if (! (sec->flags & SEC_RELOC))
+ {
+ bfd_size_type size = bfd_section_size (abfd, sec);
+
+ if (outbuf == NULL)
+ contents = bfd_malloc (size);
+ else
+ contents = outbuf;
+
+ if (contents)
+ bfd_get_section_contents (abfd, sec, contents, 0, size);
+
+ return contents;
+ }
+
+ /* In order to use bfd_get_relocated_section_contents, we need
+ to forge some data structures that it expects. */
+
+ /* Fill in the bare minimum number of fields for our purposes. */
+ memset (&link_info, 0, sizeof (link_info));
+ link_info.input_bfds = abfd;
+
+ link_info.hash = _bfd_generic_link_hash_table_create (abfd);
+ link_info.callbacks = &callbacks;
+ callbacks.warning = simple_dummy_warning;
+ callbacks.undefined_symbol = simple_dummy_undefined_symbol;
+ callbacks.reloc_overflow = simple_dummy_reloc_overflow;
+ callbacks.reloc_dangerous = simple_dummy_reloc_dangerous;
+ callbacks.unattached_reloc = simple_dummy_unattached_reloc;
+
+ memset (&link_order, 0, sizeof (link_order));
+ link_order.next = NULL;
+ link_order.type = bfd_indirect_link_order;
+ link_order.offset = 0;
+ link_order.size = bfd_section_size (abfd, sec);
+ link_order.u.indirect.section = sec;
+
+ data = NULL;
+ if (outbuf == NULL)
+ {
+ data = bfd_malloc (bfd_section_size (abfd, sec));
+ if (data == NULL)
+ return NULL;
+ outbuf = data;
+ }
+
+ /* The sections in ABFD may already have output sections and offsets set.
+ Because this function is primarily for debug sections, and GCC uses the
+ knowledge that debug sections will generally have VMA 0 when emitting
+ relocations between DWARF-2 sections (which are supposed to be
+ section-relative offsets anyway), we need to reset the output offsets
+ to zero. We also need to arrange for section->output_section->vma plus
+ section->output_offset to equal section->vma, which we do by setting
+ section->output_section to point back to section. Save the original
+ output offset and output section to restore later. */
+ saved_offsets = malloc (sizeof (struct saved_output_info)
+ * abfd->section_count);
+ if (saved_offsets == NULL)
+ {
+ if (data)
+ free (data);
+ return NULL;
+ }
+ bfd_map_over_sections (abfd, simple_save_output_info, saved_offsets);
+
+ if (symbol_table == NULL)
+ {
+ _bfd_generic_link_add_symbols (abfd, &link_info);
+
+ storage_needed = bfd_get_symtab_upper_bound (abfd);
+ symbol_table = bfd_malloc (storage_needed);
+ bfd_canonicalize_symtab (abfd, symbol_table);
+ }
+ else
+ storage_needed = 0;
+
+ /* This function might be called before _cooked_size has been set, and
+ bfd_perform_relocation needs _cooked_size to be valid. */
+ old_cooked_size = sec->_cooked_size;
+ if (old_cooked_size == 0)
+ sec->_cooked_size = sec->_raw_size;
+
+ contents = bfd_get_relocated_section_contents (abfd,
+ &link_info,
+ &link_order,
+ outbuf,
+ 0,
+ symbol_table);
+ if (contents == NULL && data != NULL)
+ free (data);
+
+#if 0
+ /* NOTE: cagney/2003-04-05: This free, which was introduced on
+ 2003-03-31 to stop a memory leak, caused a memory corruption
+ between GDB and BFD. The problem, which is stabs specific, can
+ be identified by a bunch of failures in relocate.exp vis:
+
+ gdb.base/relocate.exp: get address of static_bar
+
+ Details of the problem can be found on the binutils@ mailing
+ list, see the discussion thread: "gdb.mi/mi-cli.exp failures". */
+ if (storage_needed != 0)
+ free (symbol_table);
+#endif
+
+ sec->_cooked_size = old_cooked_size;
+ bfd_map_over_sections (abfd, simple_restore_output_info, saved_offsets);
+ free (saved_offsets);
+
+ _bfd_generic_link_hash_table_free (link_info.hash);
+
+ return contents;
+}
diff --git a/contrib/binutils/bfd/sparclinux.c b/contrib/binutils/bfd/sparclinux.c
index e55a4ff..ecaaa0f 100644
--- a/contrib/binutils/bfd/sparclinux.c
+++ b/contrib/binutils/bfd/sparclinux.c
@@ -1,5 +1,5 @@
/* BFD back-end for linux flavored sparc a.out binaries.
- Copyright 1992, 1993, 1994, 1995, 1996, 1997, 2000, 2001, 2002
+ Copyright 1992, 1993, 1994, 1995, 1996, 1997, 2000, 2001, 2002, 2003
Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@@ -19,12 +19,11 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
USA. */
-#define TARGET_PAGE_SIZE 4096
-#define ZMAGIC_DISK_BLOCK_SIZE 1024
-#define SEGMENT_SIZE TARGET_PAGE_SIZE
-#define TEXT_START_ADDR 0x0
-#define N_SHARED_LIB(x) 0
-#define BYTES_IN_WORD 4
+#define TARGET_PAGE_SIZE 4096
+#define ZMAGIC_DISK_BLOCK_SIZE 1024
+#define SEGMENT_SIZE TARGET_PAGE_SIZE
+#define TEXT_START_ADDR 0x0
+#define N_SHARED_LIB(x) 0
#define MACHTYPE_OK(mtype) ((mtype) == M_SPARC || (mtype) == M_UNKNOWN)
@@ -52,10 +51,10 @@ extern const bfd_target MY(vec);
static void MY_final_link_callback
PARAMS ((bfd *, file_ptr *, file_ptr *, file_ptr *));
-static boolean sparclinux_bfd_final_link
+static bfd_boolean sparclinux_bfd_final_link
PARAMS ((bfd *abfd, struct bfd_link_info *info));
-static boolean
+static bfd_boolean
sparclinux_bfd_final_link (abfd, info)
bfd *abfd;
struct bfd_link_info *info;
@@ -68,9 +67,9 @@ sparclinux_bfd_final_link (abfd, info)
/* Set the machine type correctly. */
-static boolean sparclinux_write_object_contents PARAMS ((bfd *abfd));
+static bfd_boolean sparclinux_write_object_contents PARAMS ((bfd *abfd));
-static boolean
+static bfd_boolean
sparclinux_write_object_contents (abfd)
bfd *abfd;
{
@@ -83,7 +82,7 @@ sparclinux_write_object_contents (abfd)
WRITE_HEADERS(abfd, execp);
- return true;
+ return TRUE;
}
#define MY_write_object_contents sparclinux_write_object_contents
@@ -92,7 +91,7 @@ sparclinux_write_object_contents (abfd)
/* See if a symbol name is a reference to the global offset table. */
#ifndef GOT_REF_PREFIX
-#define GOT_REF_PREFIX "__GOT_"
+#define GOT_REF_PREFIX "__GOT_"
#endif
#define IS_GOT_SYM(name) \
@@ -101,7 +100,7 @@ sparclinux_write_object_contents (abfd)
/* See if a symbol name is a reference to the procedure linkage table. */
#ifndef PLT_REF_PREFIX
-#define PLT_REF_PREFIX "__PLT_"
+#define PLT_REF_PREFIX "__PLT_"
#endif
#define IS_PLT_SYM(name) \
@@ -114,7 +113,7 @@ sparclinux_write_object_contents (abfd)
#endif
/* This special symbol is a set vector that contains a list of
- pointers to fixup tables. It will be present in any dynamicly
+ pointers to fixup tables. It will be present in any dynamically
linked file. The linker generated fixup table should also be added
to the list, and it should always appear in the second slot (the
first one is a dummy with a magic number that is defined in
@@ -179,16 +178,16 @@ static struct bfd_link_hash_table *linux_link_hash_table_create
PARAMS ((bfd *));
static struct fixup *new_fixup
PARAMS ((struct bfd_link_info *, struct linux_link_hash_entry *,
- bfd_vma, int));
-static boolean linux_link_create_dynamic_sections
+ bfd_vma, int));
+static bfd_boolean linux_link_create_dynamic_sections
PARAMS ((bfd *, struct bfd_link_info *));
-static boolean linux_add_one_symbol
+static bfd_boolean linux_add_one_symbol
PARAMS ((struct bfd_link_info *, bfd *, const char *, flagword, asection *,
- bfd_vma, const char *, boolean, boolean,
- struct bfd_link_hash_entry **));
-static boolean linux_tally_symbols
+ bfd_vma, const char *, bfd_boolean, bfd_boolean,
+ struct bfd_link_hash_entry **));
+static bfd_boolean linux_tally_symbols
PARAMS ((struct linux_link_hash_entry *, PTR));
-static boolean linux_finish_dynamic_link
+static bfd_boolean linux_finish_dynamic_link
PARAMS ((bfd *, struct bfd_link_info *));
/* Routine to create an entry in an Linux link hash table. */
@@ -205,14 +204,14 @@ linux_link_hash_newfunc (entry, table, string)
subclass. */
if (ret == (struct linux_link_hash_entry *) NULL)
ret = ((struct linux_link_hash_entry *)
- bfd_hash_allocate (table, sizeof (struct linux_link_hash_entry)));
+ bfd_hash_allocate (table, sizeof (struct linux_link_hash_entry)));
if (ret == NULL)
return (struct bfd_hash_entry *) ret;
/* Call the allocation method of the superclass. */
ret = ((struct linux_link_hash_entry *)
- NAME(aout,link_hash_newfunc) ((struct bfd_hash_entry *) ret,
- table, string));
+ NAME(aout,link_hash_newfunc) ((struct bfd_hash_entry *) ret,
+ table, string));
if (ret != NULL)
{
/* Set local fields; there aren't any. */
@@ -234,7 +233,7 @@ linux_link_hash_table_create (abfd)
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))
+ linux_link_hash_newfunc))
{
free (ret);
return (struct bfd_link_hash_table *) NULL;
@@ -253,14 +252,14 @@ linux_link_hash_table_create (abfd)
#define linux_link_hash_lookup(table, string, create, copy, follow) \
((struct linux_link_hash_entry *) \
aout_link_hash_lookup (&(table)->root, (string), (create), (copy),\
- (follow)))
+ (follow)))
/* Traverse a Linux link hash table. */
-#define linux_link_hash_traverse(table, func, info) \
- (aout_link_hash_traverse \
- (&(table)->root, \
- (boolean (*) PARAMS ((struct aout_link_hash_entry *, PTR))) (func), \
+#define linux_link_hash_traverse(table, func, info) \
+ (aout_link_hash_traverse \
+ (&(table)->root, \
+ (bfd_boolean (*) PARAMS ((struct aout_link_hash_entry *, PTR))) (func), \
(info)))
/* Get the Linux link hash table from the info structure. This is
@@ -280,7 +279,7 @@ new_fixup (info, h, value, builtin)
struct fixup *f;
f = (struct fixup *) bfd_hash_allocate (&info->hash->table,
- sizeof (struct fixup));
+ sizeof (struct fixup));
if (f == NULL)
return f;
f->next = linux_hash_table (info)->fixup_list;
@@ -300,7 +299,7 @@ new_fixup (info, h, value, builtin)
know the size of the section, but that's OK - we just need to
create it for now. */
-static boolean
+static bfd_boolean
linux_link_create_dynamic_sections (abfd, info)
bfd *abfd;
struct bfd_link_info *info ATTRIBUTE_UNUSED;
@@ -312,25 +311,25 @@ linux_link_create_dynamic_sections (abfd, info)
flags = SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS | SEC_IN_MEMORY;
/* We choose to use the name ".linux-dynamic" for the fixup table.
- Why not? */
+ Why not? */
s = bfd_make_section (abfd, ".linux-dynamic");
if (s == NULL
|| ! bfd_set_section_flags (abfd, s, flags)
|| ! bfd_set_section_alignment (abfd, s, 2))
- return false;
+ return FALSE;
s->_raw_size = 0;
s->contents = 0;
- return true;
+ return TRUE;
}
/* Function to add a single symbol to the linker hash table. This is
a wrapper around _bfd_generic_link_add_one_symbol which handles the
tweaking needed for dynamic linking support. */
-static boolean
+static bfd_boolean
linux_add_one_symbol (info, abfd, name, flags, section, value, string,
- copy, collect, hashp)
+ copy, collect, hashp)
struct bfd_link_info *info;
bfd *abfd;
const char *name;
@@ -338,12 +337,12 @@ linux_add_one_symbol (info, abfd, name, flags, section, value, string,
asection *section;
bfd_vma value;
const char *string;
- boolean copy;
- boolean collect;
+ bfd_boolean copy;
+ bfd_boolean collect;
struct bfd_link_hash_entry **hashp;
{
struct linux_link_hash_entry *h;
- boolean insert;
+ bfd_boolean insert;
/* Look up and see if we already have this symbol in the hash table.
If we do, and the defining entry is from a shared library, we
@@ -353,69 +352,69 @@ linux_add_one_symbol (info, abfd, name, flags, section, value, string,
be able to link Linux a.out and ELF objects together, but serious
confusion is possible. */
- insert = false;
+ insert = FALSE;
- if (! info->relocateable
+ if (! info->relocatable
&& linux_hash_table (info)->dynobj == NULL
&& strcmp (name, SHARABLE_CONFLICTS) == 0
&& (flags & BSF_CONSTRUCTOR) != 0
&& abfd->xvec == info->hash->creator)
{
if (! linux_link_create_dynamic_sections (abfd, info))
- return false;
+ return FALSE;
linux_hash_table (info)->dynobj = abfd;
- insert = true;
+ insert = TRUE;
}
if (bfd_is_abs_section (section)
&& abfd->xvec == info->hash->creator)
{
- h = linux_link_hash_lookup (linux_hash_table (info), name, false,
- false, false);
+ h = linux_link_hash_lookup (linux_hash_table (info), name, FALSE,
+ FALSE, FALSE);
if (h != NULL
- && (h->root.root.type == bfd_link_hash_defined
- || h->root.root.type == bfd_link_hash_defweak))
- {
- struct fixup *f;
+ && (h->root.root.type == bfd_link_hash_defined
+ || h->root.root.type == bfd_link_hash_defweak))
+ {
+ struct fixup *f;
- if (hashp != NULL)
- *hashp = (struct bfd_link_hash_entry *) h;
+ if (hashp != NULL)
+ *hashp = (struct bfd_link_hash_entry *) h;
- f = new_fixup (info, h, value, ! IS_PLT_SYM (name));
- if (f == NULL)
- return false;
- f->jump = IS_PLT_SYM (name);
+ f = new_fixup (info, h, value, ! IS_PLT_SYM (name));
+ if (f == NULL)
+ return FALSE;
+ f->jump = IS_PLT_SYM (name);
- return true;
- }
+ return TRUE;
+ }
}
/* Do the usual procedure for adding a symbol. */
if (! _bfd_generic_link_add_one_symbol (info, abfd, name, flags, section,
- value, string, copy, collect,
- hashp))
- return false;
+ value, string, copy, collect,
+ hashp))
+ return FALSE;
/* Insert a pointer to our table in the set vector. The dynamic
- linker requires this information */
+ linker requires this information. */
if (insert)
{
asection *s;
/* Here we do our special thing to add the pointer to the
- dynamic section in the SHARABLE_CONFLICTS set vector. */
+ dynamic section in the SHARABLE_CONFLICTS set vector. */
s = bfd_get_section_by_name (linux_hash_table (info)->dynobj,
- ".linux-dynamic");
+ ".linux-dynamic");
BFD_ASSERT (s != NULL);
if (! (_bfd_generic_link_add_one_symbol
- (info, linux_hash_table (info)->dynobj, SHARABLE_CONFLICTS,
- BSF_GLOBAL | BSF_CONSTRUCTOR, s, (bfd_vma) 0, NULL,
- false, false, NULL)))
- return false;
+ (info, linux_hash_table (info)->dynobj, SHARABLE_CONFLICTS,
+ BSF_GLOBAL | BSF_CONSTRUCTOR, s, (bfd_vma) 0, NULL,
+ FALSE, FALSE, NULL)))
+ return FALSE;
}
- return true;
+ return TRUE;
}
/* We will crawl the hash table and come here for every global symbol.
@@ -428,7 +427,7 @@ linux_add_one_symbol (info, abfd, name, flags, section, value, string,
This function is called via linux_link_hash_traverse. */
-static boolean
+static bfd_boolean
linux_tally_symbols (h, data)
struct linux_link_hash_entry *h;
PTR data;
@@ -437,14 +436,14 @@ linux_tally_symbols (h, data)
struct fixup *f, *f1;
int is_plt;
struct linux_link_hash_entry *h1, *h2;
- boolean exists;
+ bfd_boolean exists;
if (h->root.root.type == bfd_link_hash_warning)
h = (struct linux_link_hash_entry *) h->root.root.u.i.link;
if (h->root.root.type == bfd_link_hash_undefined
&& strncmp (h->root.root.root.string, NEEDS_SHRLIB,
- sizeof NEEDS_SHRLIB - 1) == 0)
+ sizeof NEEDS_SHRLIB - 1) == 0)
{
const char *name;
char *p;
@@ -453,21 +452,21 @@ linux_tally_symbols (h, data)
name = h->root.root.root.string + sizeof NEEDS_SHRLIB - 1;
p = strrchr (name, '_');
if (p != NULL)
- alloc = (char *) bfd_malloc ((bfd_size_type) strlen (name) + 1);
+ alloc = (char *) bfd_malloc ((bfd_size_type) strlen (name) + 1);
if (p == NULL || alloc == NULL)
- (*_bfd_error_handler) (_("Output file requires shared library `%s'\n"),
- name);
+ (*_bfd_error_handler) (_("Output file requires shared library `%s'\n"),
+ name);
else
- {
- strcpy (alloc, name);
- p = strrchr (alloc, '_');
- *p++ = '\0';
- (*_bfd_error_handler)
- (_("Output file requires shared library `%s.so.%s'\n"),
- alloc, p);
- free (alloc);
- }
+ {
+ strcpy (alloc, name);
+ p = strrchr (alloc, '_');
+ *p++ = '\0';
+ (*_bfd_error_handler)
+ (_("Output file requires shared library `%s.so.%s'\n"),
+ alloc, p);
+ free (alloc);
+ }
abort ();
}
@@ -479,75 +478,75 @@ linux_tally_symbols (h, data)
if (is_plt || IS_GOT_SYM (h->root.root.root.string))
{
/* Look up this symbol twice. Once just as a regular lookup,
- and then again following all of the indirect links until we
- reach a real symbol. */
+ and then again following all of the indirect links until we
+ reach a real symbol. */
h1 = linux_link_hash_lookup (linux_hash_table (info),
- (h->root.root.root.string
- + sizeof PLT_REF_PREFIX - 1),
- false, false, true);
+ (h->root.root.root.string
+ + sizeof PLT_REF_PREFIX - 1),
+ FALSE, FALSE, TRUE);
/* h2 does not follow indirect symbols. */
h2 = linux_link_hash_lookup (linux_hash_table (info),
- (h->root.root.root.string
- + sizeof PLT_REF_PREFIX - 1),
- false, false, false);
+ (h->root.root.root.string
+ + sizeof PLT_REF_PREFIX - 1),
+ FALSE, FALSE, FALSE);
/* The real symbol must exist but if it is also an ABS symbol,
- there is no need to have a fixup. This is because they both
- came from the same library. If on the other hand, we had to
- use an indirect symbol to get to the real symbol, we add the
- fixup anyway, since there are cases where these symbols come
- from different shared libraries */
+ there is no need to have a fixup. This is because they both
+ came from the same library. If on the other hand, we had to
+ use an indirect symbol to get to the real symbol, we add the
+ fixup anyway, since there are cases where these symbols come
+ from different shared libraries */
if (h1 != NULL
- && (((h1->root.root.type == bfd_link_hash_defined
- || h1->root.root.type == bfd_link_hash_defweak)
- && ! bfd_is_abs_section (h1->root.root.u.def.section))
- || h2->root.root.type == bfd_link_hash_indirect))
- {
- /* See if there is a "builtin" fixup already present
- involving this symbol. If so, convert it to a regular
- fixup. In the end, this relaxes some of the requirements
- about the order of performing fixups. */
- exists = false;
- for (f1 = linux_hash_table (info)->fixup_list;
- f1 != NULL;
- f1 = f1->next)
- {
- if ((f1->h != h && f1->h != h1)
- || (! f1->builtin && ! f1->jump))
- continue;
- if (f1->h == h1)
- exists = true;
- if (! exists
- && bfd_is_abs_section (h->root.root.u.def.section))
- {
- f = new_fixup (info, h1, f1->h->root.root.u.def.value, 0);
- f->jump = is_plt;
- }
- f1->h = h1;
- f1->jump = is_plt;
- f1->builtin = 0;
- exists = true;
- }
- if (! exists
- && bfd_is_abs_section (h->root.root.u.def.section))
- {
- f = new_fixup (info, h1, h->root.root.u.def.value, 0);
- if (f == NULL)
- {
- /* FIXME: No way to return error. */
- abort ();
- }
- f->jump = is_plt;
- }
- }
+ && (((h1->root.root.type == bfd_link_hash_defined
+ || h1->root.root.type == bfd_link_hash_defweak)
+ && ! bfd_is_abs_section (h1->root.root.u.def.section))
+ || h2->root.root.type == bfd_link_hash_indirect))
+ {
+ /* See if there is a "builtin" fixup already present
+ involving this symbol. If so, convert it to a regular
+ fixup. In the end, this relaxes some of the requirements
+ about the order of performing fixups. */
+ exists = FALSE;
+ for (f1 = linux_hash_table (info)->fixup_list;
+ f1 != NULL;
+ f1 = f1->next)
+ {
+ if ((f1->h != h && f1->h != h1)
+ || (! f1->builtin && ! f1->jump))
+ continue;
+ if (f1->h == h1)
+ exists = TRUE;
+ if (! exists
+ && bfd_is_abs_section (h->root.root.u.def.section))
+ {
+ f = new_fixup (info, h1, f1->h->root.root.u.def.value, 0);
+ f->jump = is_plt;
+ }
+ f1->h = h1;
+ f1->jump = is_plt;
+ f1->builtin = 0;
+ exists = TRUE;
+ }
+ if (! exists
+ && bfd_is_abs_section (h->root.root.u.def.section))
+ {
+ f = new_fixup (info, h1, h->root.root.u.def.value, 0);
+ if (f == NULL)
+ {
+ /* FIXME: No way to return error. */
+ abort ();
+ }
+ f->jump = is_plt;
+ }
+ }
/* Quick and dirty way of stripping these symbols from the
- symtab. */
+ symtab. */
if (bfd_is_abs_section (h->root.root.u.def.section))
- h->root.written = true;
+ h->root.written = TRUE;
}
- return true;
+ return TRUE;
}
/* This is called to set the size of the .linux-dynamic section is.
@@ -556,7 +555,7 @@ linux_tally_symbols (h, data)
we just scan the hash tables to find out how many additional fixups
are required. */
-boolean
+bfd_boolean
bfd_sparclinux_size_dynamic_sections (output_bfd, info)
bfd *output_bfd;
struct bfd_link_info *info;
@@ -565,12 +564,12 @@ bfd_sparclinux_size_dynamic_sections (output_bfd, info)
asection *s;
if (output_bfd->xvec != &MY(vec))
- return true;
+ return TRUE;
/* First find the fixups... */
linux_link_hash_traverse (linux_hash_table (info),
- linux_tally_symbols,
- (PTR) info);
+ linux_tally_symbols,
+ (PTR) info);
/* If there are builtin fixups, leave room for a marker. This is
used by the dynamic linker so that it knows that all that follow
@@ -578,40 +577,40 @@ bfd_sparclinux_size_dynamic_sections (output_bfd, info)
for (f = linux_hash_table (info)->fixup_list; f != NULL; f = f->next)
{
if (f->builtin)
- {
- ++linux_hash_table (info)->fixup_count;
- ++linux_hash_table (info)->local_builtins;
- break;
- }
+ {
+ ++linux_hash_table (info)->fixup_count;
+ ++linux_hash_table (info)->local_builtins;
+ break;
+ }
}
if (linux_hash_table (info)->dynobj == NULL)
{
if (linux_hash_table (info)->fixup_count > 0)
- abort ();
- return true;
+ abort ();
+ return TRUE;
}
/* Allocate memory for our fixup table. We will fill it in later. */
s = bfd_get_section_by_name (linux_hash_table (info)->dynobj,
- ".linux-dynamic");
+ ".linux-dynamic");
if (s != NULL)
{
s->_raw_size = linux_hash_table (info)->fixup_count + 1;
s->_raw_size *= 8;
s->contents = (bfd_byte *) bfd_zalloc (output_bfd, s->_raw_size);
if (s->contents == NULL)
- return false;
+ return FALSE;
}
- return true;
+ return TRUE;
}
/* We come here once we are ready to actually write the fixup table to
the output file. Scan the fixup tables and so forth and generate
the stuff we need. */
-static boolean
+static bfd_boolean
linux_finish_dynamic_link (output_bfd, info)
bfd *output_bfd;
struct bfd_link_info *info;
@@ -625,18 +624,18 @@ linux_finish_dynamic_link (output_bfd, info)
unsigned int fixups_written;
if (linux_hash_table (info)->dynobj == NULL)
- return true;
+ return TRUE;
s = bfd_get_section_by_name (linux_hash_table (info)->dynobj,
- ".linux-dynamic");
+ ".linux-dynamic");
BFD_ASSERT (s != NULL);
os = s->output_section;
fixups_written = 0;
#ifdef LINUX_LINK_DEBUG
printf ("Fixup table file offset: %x VMA: %x\n",
- os->filepos + s->output_offset,
- os->vma + s->output_offset);
+ os->filepos + s->output_offset,
+ os->vma + s->output_offset);
#endif
fixup_table = s->contents;
@@ -648,16 +647,16 @@ linux_finish_dynamic_link (output_bfd, info)
for (f = linux_hash_table (info)->fixup_list; f != NULL; f = f->next)
{
if (f->builtin)
- continue;
+ continue;
if (f->h->root.root.type != bfd_link_hash_defined
- && f->h->root.root.type != bfd_link_hash_defweak)
- {
- (*_bfd_error_handler)
- (_("Symbol %s not defined for fixups\n"),
- f->h->root.root.root.string);
- continue;
- }
+ && f->h->root.root.type != bfd_link_hash_defweak)
+ {
+ (*_bfd_error_handler)
+ (_("Symbol %s not defined for fixups\n"),
+ f->h->root.root.root.string);
+ continue;
+ }
is = f->h->root.root.u.def.section;
section_offset = is->output_section->vma + is->output_offset;
@@ -665,25 +664,25 @@ linux_finish_dynamic_link (output_bfd, info)
#ifdef LINUX_LINK_DEBUG
printf ("Fixup(%d) %s: %x %x\n",f->jump, f->h->root.root.string,
- new_addr, f->value);
+ new_addr, f->value);
#endif
if (f->jump)
- {
- /* Relative address */
- new_addr = new_addr - (f->value + 5);
- bfd_put_32 (output_bfd, (bfd_vma) new_addr, fixup_table);
- fixup_table += 4;
- bfd_put_32 (output_bfd, f->value + 1, fixup_table);
- fixup_table += 4;
- }
+ {
+ /* Relative address */
+ new_addr = new_addr - (f->value + 5);
+ bfd_put_32 (output_bfd, (bfd_vma) new_addr, fixup_table);
+ fixup_table += 4;
+ bfd_put_32 (output_bfd, f->value + 1, fixup_table);
+ fixup_table += 4;
+ }
else
- {
- bfd_put_32 (output_bfd, (bfd_vma) new_addr, fixup_table);
- fixup_table += 4;
- bfd_put_32 (output_bfd, f->value, fixup_table);
- fixup_table += 4;
- }
+ {
+ bfd_put_32 (output_bfd, (bfd_vma) new_addr, fixup_table);
+ fixup_table += 4;
+ bfd_put_32 (output_bfd, f->value, fixup_table);
+ fixup_table += 4;
+ }
++fixups_written;
}
@@ -696,56 +695,56 @@ linux_finish_dynamic_link (output_bfd, info)
fixup_table += 4;
++fixups_written;
for (f = linux_hash_table (info)->fixup_list; f != NULL; f = f->next)
- {
- if (! f->builtin)
- continue;
-
- if (f->h->root.root.type != bfd_link_hash_defined
- && f->h->root.root.type != bfd_link_hash_defweak)
- {
- (*_bfd_error_handler)
- (_("Symbol %s not defined for fixups\n"),
- f->h->root.root.root.string);
- continue;
- }
-
- is = f->h->root.root.u.def.section;
- section_offset = is->output_section->vma + is->output_offset;
- new_addr = f->h->root.root.u.def.value + section_offset;
+ {
+ if (! f->builtin)
+ continue;
+
+ if (f->h->root.root.type != bfd_link_hash_defined
+ && f->h->root.root.type != bfd_link_hash_defweak)
+ {
+ (*_bfd_error_handler)
+ (_("Symbol %s not defined for fixups\n"),
+ f->h->root.root.root.string);
+ continue;
+ }
+
+ is = f->h->root.root.u.def.section;
+ section_offset = is->output_section->vma + is->output_offset;
+ new_addr = f->h->root.root.u.def.value + section_offset;
#ifdef LINUX_LINK_DEBUG
- printf ("Fixup(B) %s: %x %x\n", f->h->root.root.string,
- new_addr, f->value);
+ printf ("Fixup(B) %s: %x %x\n", f->h->root.root.string,
+ new_addr, f->value);
#endif
- bfd_put_32 (output_bfd, (bfd_vma) new_addr, fixup_table);
- fixup_table += 4;
- bfd_put_32 (output_bfd, f->value, fixup_table);
- fixup_table += 4;
- ++fixups_written;
- }
- }
+ bfd_put_32 (output_bfd, (bfd_vma) new_addr, fixup_table);
+ fixup_table += 4;
+ bfd_put_32 (output_bfd, f->value, fixup_table);
+ fixup_table += 4;
+ ++fixups_written;
+ }
+ }
if (linux_hash_table (info)->fixup_count != fixups_written)
{
(*_bfd_error_handler) (_("Warning: fixup count mismatch\n"));
while (linux_hash_table (info)->fixup_count > fixups_written)
- {
- bfd_put_32 (output_bfd, (bfd_vma) 0, fixup_table);
- fixup_table += 4;
- bfd_put_32 (output_bfd, (bfd_vma) 0, fixup_table);
- fixup_table += 4;
- ++fixups_written;
- }
+ {
+ bfd_put_32 (output_bfd, (bfd_vma) 0, fixup_table);
+ fixup_table += 4;
+ bfd_put_32 (output_bfd, (bfd_vma) 0, fixup_table);
+ fixup_table += 4;
+ ++fixups_written;
+ }
}
h = linux_link_hash_lookup (linux_hash_table (info),
- "__BUILTIN_FIXUPS__",
- false, false, false);
+ "__BUILTIN_FIXUPS__",
+ FALSE, FALSE, FALSE);
if (h != NULL
&& (h->root.root.type == bfd_link_hash_defined
- || h->root.root.type == bfd_link_hash_defweak))
+ || h->root.root.type == bfd_link_hash_defweak))
{
is = h->root.root.u.def.section;
section_offset = is->output_section->vma + is->output_offset;
@@ -762,13 +761,12 @@ linux_finish_dynamic_link (output_bfd, info)
if (bfd_seek (output_bfd, (file_ptr) (os->filepos + s->output_offset),
SEEK_SET) != 0)
- return false;
+ return FALSE;
- if (bfd_bwrite ((PTR) s->contents, s->_raw_size, output_bfd)
- != s->_raw_size)
- return false;
+ if (bfd_bwrite ((PTR) s->contents, s->_raw_size, output_bfd) != s->_raw_size)
+ return FALSE;
- return true;
+ return TRUE;
}
#define MY_bfd_link_hash_table_create linux_link_hash_table_create
diff --git a/contrib/binutils/bfd/sparcnetbsd.c b/contrib/binutils/bfd/sparcnetbsd.c
index 64d0eb1..be8e536 100644
--- a/contrib/binutils/bfd/sparcnetbsd.c
+++ b/contrib/binutils/bfd/sparcnetbsd.c
@@ -1,5 +1,5 @@
/* BFD back-end for NetBSD/sparc a.out-ish binaries.
- Copyright 1990, 1991, 1992, 1994, 1995, 1997, 1998, 2000, 2001
+ Copyright 1990, 1991, 1992, 1994, 1995, 1997, 1998, 2000, 2001, 2003
Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@@ -18,7 +18,6 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-#define BYTES_IN_WORD 4
#define TARGET_IS_BIG_ENDIAN_P
/* SPARC chips use either 4K or 8K pages, but object files always
diff --git a/contrib/binutils/bfd/srec.c b/contrib/binutils/bfd/srec.c
index 6c29fa1..c0a3d58 100644
--- a/contrib/binutils/bfd/srec.c
+++ b/contrib/binutils/bfd/srec.c
@@ -1,6 +1,6 @@
/* BFD back-end for s-record objects.
Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
- 2000, 2001, 2002
+ 2000, 2001, 2002, 2003
Free Software Foundation, Inc.
Written by Steve Chamberlain of Cygnus Support <sac@cygnus.com>.
@@ -114,32 +114,31 @@ 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 boolean srec_mkobject PARAMS ((bfd *));
-static int srec_get_byte PARAMS ((bfd *, boolean *));
-static void srec_bad_byte PARAMS ((bfd *, unsigned int, int, boolean));
-static boolean srec_scan PARAMS ((bfd *));
+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 boolean srec_read_section PARAMS ((bfd *, asection *, bfd_byte *));
-
-static boolean srec_write_record PARAMS ((bfd *, unsigned int, bfd_vma,
- const bfd_byte *,
- const bfd_byte *));
-static boolean srec_write_header PARAMS ((bfd *));
-static boolean srec_write_symbols PARAMS ((bfd *));
-static boolean srec_new_symbol PARAMS ((bfd *, const char *, bfd_vma));
-static boolean srec_get_section_contents
+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 boolean srec_set_arch_mach
+static bfd_boolean srec_set_arch_mach
PARAMS ((bfd *, enum bfd_architecture, unsigned long));
-static boolean srec_set_section_contents
- PARAMS ((bfd *, sec_ptr, PTR, file_ptr, bfd_size_type));
-static boolean internal_srec_write_object_contents PARAMS ((bfd *, int));
-static boolean srec_write_object_contents PARAMS ((bfd *));
-static boolean symbolsrec_write_object_contents PARAMS ((bfd *));
-static int srec_sizeof_headers PARAMS ((bfd *, boolean));
+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_get_symtab PARAMS ((bfd *, asymbol **));
+static long srec_canonicalize_symtab PARAMS ((bfd *, asymbol **));
/* Macros for converting between hex and binary. */
@@ -158,11 +157,11 @@ static const char digs[] = "0123456789ABCDEF";
static void
srec_init ()
{
- static boolean inited = false;
+ static bfd_boolean inited = FALSE;
if (! inited)
{
- inited = true;
+ inited = TRUE;
hex_init ();
}
}
@@ -181,7 +180,7 @@ unsigned int Chunk = DEFAULT_CHUNK;
/* The type of srec output (free or forced to S3).
This variable can be modified by objcopy's --srec-forceS3
parameter. */
-boolean S3Forced = false;
+bfd_boolean S3Forced = FALSE;
/* When writing an S-record file, the S-records can not be output as
they are seen. This structure is used to hold them in memory. */
@@ -220,13 +219,14 @@ typedef struct srec_data_struct
}
tdata_type;
-static boolean srec_write_section PARAMS ((bfd *, tdata_type *,
- srec_data_list_type *));
-static boolean srec_write_terminator PARAMS ((bfd *, tdata_type *));
+static bfd_boolean srec_write_section
+ PARAMS ((bfd *, tdata_type *, srec_data_list_type *));
+static bfd_boolean srec_write_terminator
+ PARAMS ((bfd *, tdata_type *));
/* Set up the S-record tdata information. */
-static boolean
+static bfd_boolean
srec_mkobject (abfd)
bfd *abfd;
{
@@ -238,8 +238,8 @@ srec_mkobject (abfd)
amt = sizeof (tdata_type);
tdata = (tdata_type *) bfd_alloc (abfd, amt);
if (tdata == NULL)
- return false;
-
+ return FALSE;
+
abfd->tdata.srec_data = tdata;
tdata->type = 1;
tdata->head = NULL;
@@ -248,7 +248,7 @@ srec_mkobject (abfd)
tdata->symtail = NULL;
tdata->csymbols = NULL;
- return true;
+ return TRUE;
}
/* Read a byte from an S record file. Set *ERRORPTR if an error
@@ -257,14 +257,14 @@ srec_mkobject (abfd)
static int
srec_get_byte (abfd, errorptr)
bfd *abfd;
- boolean *errorptr;
+ bfd_boolean *errorptr;
{
bfd_byte c;
if (bfd_bread (&c, (bfd_size_type) 1, abfd) != 1)
{
if (bfd_get_error () != bfd_error_file_truncated)
- *errorptr = true;
+ *errorptr = TRUE;
return EOF;
}
@@ -280,7 +280,7 @@ srec_bad_byte (abfd, lineno, c, error)
bfd *abfd;
unsigned int lineno;
int c;
- boolean error;
+ bfd_boolean error;
{
if (c == EOF)
{
@@ -307,7 +307,7 @@ srec_bad_byte (abfd, lineno, c, error)
/* Add a new symbol found in an S-record file. */
-static boolean
+static bfd_boolean
srec_new_symbol (abfd, name, val)
bfd *abfd;
const char *name;
@@ -318,7 +318,7 @@ srec_new_symbol (abfd, name, val)
n = (struct srec_symbol *) bfd_alloc (abfd, amt);
if (n == NULL)
- return false;
+ return FALSE;
n->name = name;
n->val = val;
@@ -332,19 +332,19 @@ srec_new_symbol (abfd, name, val)
++abfd->symcount;
- return true;
+ return TRUE;
}
/* Read the S record file and turn it into sections. We create a new
section for each contiguous set of bytes. */
-static boolean
+static bfd_boolean
srec_scan (abfd)
bfd *abfd;
{
int c;
unsigned int lineno = 1;
- boolean error = false;
+ bfd_boolean error = FALSE;
bfd_byte *buf = NULL;
size_t bufsize = 0;
asection *sec = NULL;
@@ -356,7 +356,7 @@ srec_scan (abfd)
while ((c = srec_get_byte (abfd, &error)) != EOF)
{
/* We only build sections from contiguous S-records, so if this
- is not an S-record, then stop building a section. */
+ is not an S-record, then stop building a section. */
if (c != 'S' && c != '\r' && c != '\n')
sec = NULL;
@@ -542,7 +542,7 @@ srec_scan (abfd)
case '0':
case '5':
/* Prologue--ignore the file name, but stop building a
- section at this point. */
+ section at this point. */
sec = NULL;
break;
@@ -567,7 +567,7 @@ srec_scan (abfd)
&& sec->vma + sec->_raw_size == address)
{
/* This data goes at the end of the section we are
- currently building. */
+ currently building. */
sec->_raw_size += bytes;
}
else
@@ -612,7 +612,7 @@ srec_scan (abfd)
if (buf != NULL)
free (buf);
- return true;
+ return TRUE;
}
}
break;
@@ -625,14 +625,14 @@ srec_scan (abfd)
if (buf != NULL)
free (buf);
- return true;
+ return TRUE;
error_return:
if (symbuf != NULL)
free (symbuf);
if (buf != NULL)
free (buf);
- return false;
+ return FALSE;
}
/* Check whether an existing file is an S-record file. */
@@ -709,7 +709,7 @@ symbolsrec_object_p (abfd)
/* Read in the contents of a section in an S-record file. */
-static boolean
+static bfd_boolean
srec_read_section (abfd, section, contents)
bfd *abfd;
asection *section;
@@ -717,7 +717,7 @@ srec_read_section (abfd, section, contents)
{
int c;
bfd_size_type sofar = 0;
- boolean error = false;
+ bfd_boolean error = FALSE;
bfd_byte *buf = NULL;
size_t bufsize = 0;
@@ -735,7 +735,7 @@ srec_read_section (abfd, section, contents)
continue;
/* This is called after srec_scan has already been called, so we
- ought to know the exact format. */
+ ought to know the exact format. */
BFD_ASSERT (c == 'S');
if (bfd_bread (hdr, (bfd_size_type) 3, abfd) != 3)
@@ -766,7 +766,7 @@ srec_read_section (abfd, section, contents)
BFD_ASSERT (sofar == section->_raw_size);
if (buf != NULL)
free (buf);
- return true;
+ return TRUE;
case '3':
address = HEX (data);
@@ -791,7 +791,7 @@ srec_read_section (abfd, section, contents)
BFD_ASSERT (sofar == section->_raw_size);
if (buf != NULL)
free (buf);
- return true;
+ return TRUE;
}
/* Don't consider checksum. */
@@ -816,17 +816,17 @@ srec_read_section (abfd, section, contents)
if (buf != NULL)
free (buf);
- return true;
+ return TRUE;
error_return:
if (buf != NULL)
free (buf);
- return false;
+ return FALSE;
}
/* Get the contents of a section in an S-record file. */
-static boolean
+static bfd_boolean
srec_get_section_contents (abfd, section, location, offset, count)
bfd *abfd;
asection *section;
@@ -838,21 +838,21 @@ srec_get_section_contents (abfd, section, location, offset, count)
{
section->used_by_bfd = bfd_alloc (abfd, section->_raw_size);
if (section->used_by_bfd == NULL && section->_raw_size != 0)
- return false;
+ return FALSE;
if (! srec_read_section (abfd, section, section->used_by_bfd))
- return false;
+ return FALSE;
}
memcpy (location, (bfd_byte *) section->used_by_bfd + offset,
(size_t) count);
- return true;
+ return TRUE;
}
/* Set the architecture. We accept an unknown architecture here. */
-static boolean
+static bfd_boolean
srec_set_arch_mach (abfd, arch, mach)
bfd *abfd;
enum bfd_architecture arch;
@@ -861,18 +861,18 @@ srec_set_arch_mach (abfd, arch, mach)
if (arch == bfd_arch_unknown)
{
abfd->arch_info = &bfd_default_arch_struct;
- return true;
+ return TRUE;
}
return bfd_default_set_arch_mach (abfd, arch, mach);
}
/* We have to save up all the Srecords for a splurge before output. */
-static boolean
+static bfd_boolean
srec_set_section_contents (abfd, section, location, offset, bytes_to_do)
bfd *abfd;
sec_ptr section;
- PTR location;
+ const PTR location;
file_ptr offset;
bfd_size_type bytes_to_do;
{
@@ -882,7 +882,7 @@ srec_set_section_contents (abfd, section, location, offset, bytes_to_do)
entry = ((srec_data_list_type *)
bfd_alloc (abfd, (bfd_size_type) sizeof (srec_data_list_type)));
if (entry == NULL)
- return false;
+ return FALSE;
if (bytes_to_do
&& (section->flags & SEC_ALLOC)
@@ -892,10 +892,10 @@ srec_set_section_contents (abfd, section, location, offset, bytes_to_do)
data = (bfd_byte *) bfd_alloc (abfd, bytes_to_do);
if (data == NULL)
- return false;
+ return FALSE;
memcpy ((PTR) data, location, (size_t) bytes_to_do);
- /* Ff S3Forced is true then always select S3 records,
+ /* Ff S3Forced is TRUE then always select S3 records,
regardless of the siez of the addresses. */
if (S3Forced)
tdata->type = 3;
@@ -912,7 +912,7 @@ srec_set_section_contents (abfd, section, location, offset, bytes_to_do)
entry->size = bytes_to_do;
/* Sort the records by address. Optimize for the common case of
- adding a record to the end of the list. */
+ adding a record to the end of the list. */
if (tdata->tail != NULL
&& entry->where >= tdata->tail->where)
{
@@ -934,14 +934,14 @@ srec_set_section_contents (abfd, section, location, offset, bytes_to_do)
tdata->tail = entry;
}
}
- return true;
+ return TRUE;
}
/* Write a record of type, of the supplied number of bytes. The
supplied bytes and length don't have a checksum. That's worked out
here. */
-static boolean
+static bfd_boolean
srec_write_record (abfd, type, address, data, end)
bfd *abfd;
unsigned int type;
@@ -999,17 +999,17 @@ srec_write_record (abfd, type, address, data, end)
*dst++ = '\n';
wrlen = dst - buffer;
if (bfd_bwrite ((PTR) buffer, wrlen, abfd) != wrlen)
- return false;
- return true;
+ return FALSE;
+ return TRUE;
}
-static boolean
+static bfd_boolean
srec_write_header (abfd)
bfd *abfd;
{
unsigned int len = strlen (abfd->filename);
- /* I'll put an arbitary 40 char limit on header size. */
+ /* I'll put an arbitrary 40 char limit on header size. */
if (len > 40)
len = 40;
@@ -1017,7 +1017,7 @@ srec_write_header (abfd)
abfd->filename, abfd->filename + len);
}
-static boolean
+static bfd_boolean
srec_write_section (abfd, tdata, list)
bfd *abfd;
tdata_type *tdata;
@@ -1052,16 +1052,16 @@ srec_write_section (abfd, tdata, list)
address,
location,
location + octets_this_chunk))
- return false;
+ return FALSE;
octets_written += octets_this_chunk;
location += octets_this_chunk;
}
- return true;
+ return TRUE;
}
-static boolean
+static bfd_boolean
srec_write_terminator (abfd, tdata)
bfd *abfd;
tdata_type *tdata;
@@ -1070,7 +1070,7 @@ srec_write_terminator (abfd, tdata)
abfd->start_address, NULL, NULL);
}
-static boolean
+static bfd_boolean
srec_write_symbols (abfd)
bfd *abfd;
{
@@ -1086,7 +1086,7 @@ srec_write_symbols (abfd)
if (bfd_bwrite ("$$ ", (bfd_size_type) 3, abfd) != 3
|| bfd_bwrite (abfd->filename, len, abfd) != len
|| bfd_bwrite ("\r\n", (bfd_size_type) 2, abfd) != 2)
- return false;
+ return FALSE;
for (i = 0; i < count; i++)
{
@@ -1095,36 +1095,37 @@ srec_write_symbols (abfd)
&& (s->flags & BSF_DEBUGGING) == 0)
{
/* Just dump out non debug symbols. */
- char buf[42], *p;
+ char buf[43], *p;
len = strlen (s->name);
if (bfd_bwrite (" ", (bfd_size_type) 2, abfd) != 2
|| bfd_bwrite (s->name, len, abfd) != len)
- return false;
+ return FALSE;
- sprintf_vma (buf + 1, (s->value
+ sprintf_vma (buf + 2, (s->value
+ s->section->output_section->lma
+ s->section->output_offset));
- p = buf + 1;
+ p = buf + 2;
while (p[0] == '0' && p[1] != 0)
p++;
len = strlen (p);
p[len] = '\r';
p[len + 1] = '\n';
+ *--p = '$';
*--p = ' ';
- len += 3;
+ len += 4;
if (bfd_bwrite (p, len, abfd) != len)
- return false;
+ return FALSE;
}
}
if (bfd_bwrite ("$$ \r\n", (bfd_size_type) 5, abfd) != 5)
- return false;
+ return FALSE;
}
- return true;
+ return TRUE;
}
-static boolean
+static bfd_boolean
internal_srec_write_object_contents (abfd, symbols)
bfd *abfd;
int symbols;
@@ -1135,11 +1136,11 @@ internal_srec_write_object_contents (abfd, symbols)
if (symbols)
{
if (! srec_write_symbols (abfd))
- return false;
+ return FALSE;
}
if (! srec_write_header (abfd))
- return false;
+ return FALSE;
/* Now wander though all the sections provided and output them. */
list = tdata->head;
@@ -1147,20 +1148,20 @@ internal_srec_write_object_contents (abfd, symbols)
while (list != (srec_data_list_type *) NULL)
{
if (! srec_write_section (abfd, tdata, list))
- return false;
+ return FALSE;
list = list->next;
}
return srec_write_terminator (abfd, tdata);
}
-static boolean
+static bfd_boolean
srec_write_object_contents (abfd)
bfd *abfd;
{
return internal_srec_write_object_contents (abfd, 0);
}
-static boolean
+static bfd_boolean
symbolsrec_write_object_contents (abfd)
bfd *abfd;
{
@@ -1170,7 +1171,7 @@ symbolsrec_write_object_contents (abfd)
static int
srec_sizeof_headers (abfd, exec)
bfd *abfd ATTRIBUTE_UNUSED;
- boolean exec ATTRIBUTE_UNUSED;
+ bfd_boolean exec ATTRIBUTE_UNUSED;
{
return 0;
}
@@ -1187,7 +1188,7 @@ srec_get_symtab_upper_bound (abfd)
/* Return the symbol table. */
static long
-srec_get_symtab (abfd, alocation)
+srec_canonicalize_symtab (abfd, alocation)
bfd *abfd;
asymbol **alocation;
{
@@ -1203,7 +1204,7 @@ srec_get_symtab (abfd, alocation)
csymbols = (asymbol *) bfd_alloc (abfd, symcount * sizeof (asymbol));
if (csymbols == NULL && symcount != 0)
- return (long) false;
+ return 0;
abfd->tdata.srec_data->csymbols = csymbols;
for (s = abfd->tdata.srec_data->symbols, c = csymbols;
diff --git a/contrib/binutils/bfd/stabs.c b/contrib/binutils/bfd/stabs.c
index 0cb3741..04b91f6 100644
--- a/contrib/binutils/bfd/stabs.c
+++ b/contrib/binutils/bfd/stabs.c
@@ -1,23 +1,23 @@
/* Stabs in sections linking support.
- Copyright 1996, 1997, 1998, 1999, 2000, 2001
+ Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004
Free Software Foundation, Inc.
Written by Ian Lance Taylor, Cygnus Support.
-This file is part of BFD, the Binary File Descriptor library.
+ This 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
/* This file contains support for linking stabs in sections, as used
on COFF and ELF. */
@@ -56,12 +56,19 @@ struct stab_link_includes_table
};
/* A linked list of totals that we have found for a particular header
- file. */
+ file. A total is a unique identifier for a particular BINCL...EINCL
+ sequence of STABs that can be used to identify duplicate sequences.
+ It consists of three fields, 'sum_chars' which is the sum of all the
+ STABS characters; 'num_chars' which is the number of these charactes
+ and 'symb' which is a buffer of all the symbols in the sequence. This
+ buffer is only checked as a last resort. */
struct stab_link_includes_totals
{
struct stab_link_includes_totals *next;
- bfd_vma total;
+ bfd_vma sum_chars; /* Accumulated sum of STABS characters. */
+ bfd_vma num_chars; /* Number of STABS characters. */
+ const char* symb; /* The STABS characters themselves. */
};
/* An entry in the header file hash table. */
@@ -168,15 +175,16 @@ stab_link_includes_newfunc (entry, table, string)
/* This function is called for each input file from the add_symbols
pass of the linker. */
-boolean
-_bfd_link_section_stabs (abfd, psinfo, stabsec, stabstrsec, psecinfo)
+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;
{
- boolean first;
+ bfd_boolean first;
struct stab_info *sinfo;
bfd_size_type count, amt;
struct stab_section_info *secinfo;
@@ -190,21 +198,21 @@ _bfd_link_section_stabs (abfd, psinfo, stabsec, stabstrsec, psecinfo)
|| stabstrsec->_raw_size == 0)
{
/* This file does not contain stabs debugging information. */
- return true;
+ 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;
+ 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;
+ prepared to handle them. */
+ return TRUE;
}
if ((stabsec->output_section != NULL
@@ -213,16 +221,16 @@ _bfd_link_section_stabs (abfd, psinfo, stabsec, stabstrsec, psecinfo)
&& 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;
+ link, so we should just ignore them. */
+ return TRUE;
}
- first = false;
+ first = FALSE;
if (*psinfo == NULL)
{
/* Initialize the stabs information we need to keep track of. */
- first = true;
+ first = TRUE;
amt = sizeof (struct stab_info);
*psinfo = (PTR) bfd_alloc (abfd, amt);
if (*psinfo == NULL)
@@ -232,7 +240,7 @@ _bfd_link_section_stabs (abfd, psinfo, stabsec, stabstrsec, psecinfo)
if (sinfo->strings == NULL)
goto error_return;
/* Make sure the first byte is zero. */
- (void) _bfd_stringtab_add (sinfo->strings, "", true, true);
+ (void) _bfd_stringtab_add (sinfo->strings, "", TRUE, TRUE);
if (! bfd_hash_table_init_n (&sinfo->includes.root,
stab_link_includes_newfunc,
251))
@@ -276,7 +284,11 @@ _bfd_link_section_stabs (abfd, psinfo, stabsec, stabstrsec, psecinfo)
and identify N_BINCL symbols which can be eliminated. */
stroff = 0;
- next_stroff = 0;
+ /* The stabs sections can be split when
+ -split-by-reloc/-split-by-file is used. We must keep track of
+ each stab section's place in the single concatenated string
+ table. */
+ next_stroff = pstring_offset ? *pstring_offset : 0;
skip = 0;
symend = stabbuf + stabsec->_raw_size;
@@ -299,16 +311,18 @@ _bfd_link_section_stabs (abfd, psinfo, stabsec, stabstrsec, psecinfo)
if (type == 0)
{
/* Special type 0 stabs indicate the offset to the next
- string table. We only copy the very first one. */
+ string table. We only copy the very first one. */
stroff = next_stroff;
next_stroff += bfd_get_32 (abfd, sym + 8);
+ if (pstring_offset)
+ *pstring_offset = next_stroff;
if (! first)
{
*pstridx = (bfd_size_type) -1;
++skip;
continue;
}
- first = false;
+ first = FALSE;
}
/* Store the string in the hash table, and record the index. */
@@ -324,7 +338,7 @@ _bfd_link_section_stabs (abfd, psinfo, stabsec, stabstrsec, psecinfo)
goto error_return;
}
string = (char *) stabstrbuf + symstroff;
- *pstridx = _bfd_stringtab_add (sinfo->strings, string, true, true);
+ *pstridx = _bfd_stringtab_add (sinfo->strings, string, TRUE, TRUE);
/* An N_BINCL symbol indicates the start of the stabs entries
for a header file. We need to scan ahead to the next N_EINCL
@@ -333,15 +347,21 @@ _bfd_link_section_stabs (abfd, psinfo, stabsec, stabstrsec, psecinfo)
first number after an open parenthesis). */
if (type == (int) N_BINCL)
{
- bfd_vma val;
+ bfd_vma sum_chars;
+ bfd_vma num_chars;
+ bfd_vma buf_len = 0;
+ char * symb;
+ char * symb_rover;
int nest;
- bfd_byte *incl_sym;
- struct stab_link_includes_entry *incl_entry;
- struct stab_link_includes_totals *t;
- struct stab_excl_list *ne;
+ bfd_byte * incl_sym;
+ struct stab_link_includes_entry * incl_entry;
+ struct stab_link_includes_totals * t;
+ struct stab_excl_list * ne;
- val = 0;
+ symb = symb_rover = NULL;
+ sum_chars = num_chars = 0;
nest = 0;
+
for (incl_sym = sym + STABSIZE;
incl_sym < symend;
incl_sym += STABSIZE)
@@ -351,6 +371,8 @@ _bfd_link_section_stabs (abfd, psinfo, stabsec, stabstrsec, psecinfo)
incl_type = incl_sym[TYPEOFF];
if (incl_type == 0)
break;
+ else if (incl_type == (int) N_EXCL)
+ continue;
else if (incl_type == (int) N_EINCL)
{
if (nest == 0)
@@ -368,7 +390,17 @@ _bfd_link_section_stabs (abfd, psinfo, stabsec, stabstrsec, psecinfo)
+ bfd_get_32 (abfd, incl_sym + STRDXOFF));
for (; *str != '\0'; str++)
{
- val += *str;
+ if (num_chars >= buf_len)
+ {
+ buf_len += 32 * 1024;
+ symb = bfd_realloc (symb, buf_len);
+ if (symb == NULL)
+ goto error_return;
+ symb_rover = symb + num_chars;
+ }
+ * symb_rover ++ = * str;
+ sum_chars += *str;
+ num_chars ++;
if (*str == '(')
{
/* Skip the file number. */
@@ -381,25 +413,29 @@ _bfd_link_section_stabs (abfd, psinfo, stabsec, stabstrsec, psecinfo)
}
}
+ BFD_ASSERT (num_chars == (bfd_vma) (symb_rover - symb));
+
/* If we have already included a header file with the same
value, then replaced this one with an N_EXCL symbol. */
incl_entry = stab_link_includes_lookup (&sinfo->includes, string,
- true, true);
+ TRUE, TRUE);
if (incl_entry == NULL)
goto error_return;
for (t = incl_entry->totals; t != NULL; t = t->next)
- if (t->total == val)
+ if (t->sum_chars == sum_chars
+ && t->num_chars == num_chars
+ && memcmp (t->symb, symb, num_chars) == 0)
break;
/* Record this symbol, so that we can set the value
- correctly. */
+ correctly. */
amt = sizeof *ne;
ne = (struct stab_excl_list *) bfd_alloc (abfd, amt);
if (ne == NULL)
goto error_return;
ne->offset = sym - stabbuf;
- ne->val = val;
+ ne->val = sum_chars;
ne->type = (int) N_BINCL;
ne->next = secinfo->excls;
secinfo->excls = ne;
@@ -412,7 +448,9 @@ _bfd_link_section_stabs (abfd, psinfo, stabsec, stabstrsec, psecinfo)
bfd_hash_allocate (&sinfo->includes.root, sizeof *t));
if (t == NULL)
goto error_return;
- t->total = val;
+ t->sum_chars = sum_chars;
+ t->num_chars = num_chars;
+ t->symb = bfd_realloc (symb, num_chars); /* Trim data down. */
t->next = incl_entry->totals;
incl_entry->totals = t;
}
@@ -424,6 +462,9 @@ _bfd_link_section_stabs (abfd, psinfo, stabsec, stabstrsec, psecinfo)
pass to change the type to N_EXCL. */
ne->type = (int) N_EXCL;
+ /* Free off superfluous symbols. */
+ free (symb);
+
/* Mark the skipped symbols. */
nest = 0;
@@ -447,6 +488,9 @@ _bfd_link_section_stabs (abfd, psinfo, stabsec, stabstrsec, psecinfo)
}
else if (incl_type == (int) N_BINCL)
++nest;
+ else if (incl_type == (int) N_EXCL)
+ /* Keep existing exclusion marks. */
+ continue;
else if (nest == 0)
{
*incl_pstridx = (bfd_size_type) -1;
@@ -502,30 +546,30 @@ _bfd_link_section_stabs (abfd, psinfo, stabsec, stabstrsec, psecinfo)
BFD_ASSERT (offset != 0);
}
- return true;
+ return TRUE;
error_return:
if (stabbuf != NULL)
free (stabbuf);
if (stabstrbuf != NULL)
free (stabstrbuf);
- return false;
+ return FALSE;
}
/* This function is called for each input file before the stab
section is relocated. It discards stab entries for discarded
- functions and variables. The function returns true iff
+ functions and variables. The function returns TRUE iff
any entries have been deleted.
*/
-boolean
+bfd_boolean
_bfd_discard_section_stabs (abfd, stabsec, psecinfo,
reloc_symbol_deleted_p, cookie)
bfd *abfd;
asection *stabsec;
PTR psecinfo;
- boolean (*reloc_symbol_deleted_p) PARAMS ((bfd_vma, PTR));
+ bfd_boolean (*reloc_symbol_deleted_p) PARAMS ((bfd_vma, PTR));
PTR cookie;
{
bfd_size_type count, amt;
@@ -539,29 +583,29 @@ _bfd_discard_section_stabs (abfd, stabsec, psecinfo,
if (stabsec->_raw_size == 0)
{
/* This file does not contain stabs debugging information. */
- return false;
+ 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;
+ 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;
+ link, so we should just ignore them. */
+ return FALSE;
}
/* We should have initialized our data in _bfd_link_stab_sections.
If there was some bizarre error reading the string sections, though,
we might not have. Bail rather than asserting. */
if (psecinfo == NULL)
- return false;
+ return FALSE;
count = stabsec->_raw_size / STABSIZE;
secinfo = (struct stab_section_info *) psecinfo;
@@ -674,18 +718,18 @@ _bfd_discard_section_stabs (abfd, stabsec, psecinfo,
BFD_ASSERT (offset != 0);
}
- return (boolean) (skip > 0);
+ return skip > 0;
error_return:
if (stabbuf != NULL)
free (stabbuf);
- return false;
+ return FALSE;
}
/* Write out the stab section. This is called with the relocated
contents. */
-boolean
+bfd_boolean
_bfd_write_section_stabs (output_bfd, psinfo, stabsec, psecinfo, contents)
bfd *output_bfd;
PTR *psinfo;
@@ -736,9 +780,9 @@ _bfd_write_section_stabs (output_bfd, psinfo, stabsec, psecinfo, contents)
if (sym[TYPEOFF] == 0)
{
/* This is the header symbol for the stabs section. We
- don't really need one, since we have merged all the
- input stabs sections into one, but we generate one
- for the benefit of readers which expect to see one. */
+ don't really need one, since we have merged all the
+ input stabs sections into one, but we generate one
+ for the benefit of readers which expect to see one. */
BFD_ASSERT (sym == contents);
bfd_put_32 (output_bfd, _bfd_stringtab_size (sinfo->strings),
tosym + VALOFF);
@@ -760,7 +804,7 @@ _bfd_write_section_stabs (output_bfd, psinfo, stabsec, psecinfo, contents)
/* Write out the .stabstr section. */
-boolean
+bfd_boolean
_bfd_write_stab_strings (output_bfd, psinfo)
bfd *output_bfd;
PTR *psinfo;
@@ -770,12 +814,12 @@ _bfd_write_stab_strings (output_bfd, psinfo)
sinfo = (struct stab_info *) *psinfo;
if (sinfo == NULL)
- return true;
+ return TRUE;
if (bfd_is_abs_section (sinfo->stabstr->output_section))
{
/* The section was discarded from the link. */
- return true;
+ return TRUE;
}
BFD_ASSERT ((sinfo->stabstr->output_offset
@@ -786,16 +830,16 @@ _bfd_write_stab_strings (output_bfd, psinfo)
(file_ptr) (sinfo->stabstr->output_section->filepos
+ sinfo->stabstr->output_offset),
SEEK_SET) != 0)
- return false;
+ return FALSE;
if (! _bfd_stringtab_emit (output_bfd, sinfo->strings))
- return false;
+ return FALSE;
/* We no longer need the stabs information. */
_bfd_stringtab_free (sinfo->strings);
bfd_hash_table_free (&sinfo->includes.root);
- return true;
+ return TRUE;
}
/* Adjust an address in the .stab section. Given OFFSET within
diff --git a/contrib/binutils/bfd/sunos.c b/contrib/binutils/bfd/sunos.c
index 5fec6f9..5b1b18b 100644
--- a/contrib/binutils/bfd/sunos.c
+++ b/contrib/binutils/bfd/sunos.c
@@ -1,7 +1,6 @@
/* BFD backend for SunOS binaries.
Copyright 1990, 1991, 1992, 1994, 1995, 1996, 1997, 1998, 2000, 2001,
- 2002
- Free Software Foundation, Inc.
+ 2002, 2003 Free Software Foundation, Inc.
Written by Cygnus Support.
This file is part of BFD, the Binary File Descriptor library.
@@ -33,9 +32,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
/* Static routines defined in this file. */
-static boolean sunos_read_dynamic_info PARAMS ((bfd *));
+static bfd_boolean sunos_read_dynamic_info PARAMS ((bfd *));
static long sunos_get_dynamic_symtab_upper_bound PARAMS ((bfd *));
-static boolean sunos_slurp_dynamic_symtab 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
@@ -44,32 +43,32 @@ 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 boolean sunos_create_dynamic_sections
- PARAMS ((bfd *, struct bfd_link_info *, boolean));
-static boolean sunos_add_dynamic_symbols
+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 boolean sunos_add_one_symbol
+static bfd_boolean sunos_add_one_symbol
PARAMS ((struct bfd_link_info *, bfd *, const char *, flagword, asection *,
- bfd_vma, const char *, boolean, boolean,
+ bfd_vma, const char *, bfd_boolean, bfd_boolean,
struct bfd_link_hash_entry **));
-static boolean sunos_scan_relocs
+static bfd_boolean sunos_scan_relocs
PARAMS ((struct bfd_link_info *, bfd *, asection *, bfd_size_type));
-static boolean sunos_scan_std_relocs
+static bfd_boolean sunos_scan_std_relocs
PARAMS ((struct bfd_link_info *, bfd *, asection *,
const struct reloc_std_external *, bfd_size_type));
-static boolean sunos_scan_ext_relocs
+static bfd_boolean sunos_scan_ext_relocs
PARAMS ((struct bfd_link_info *, bfd *, asection *,
const struct reloc_ext_external *, bfd_size_type));
-static boolean sunos_link_dynamic_object
+static bfd_boolean sunos_link_dynamic_object
PARAMS ((struct bfd_link_info *, bfd *));
-static boolean sunos_write_dynamic_symbol
+static bfd_boolean sunos_write_dynamic_symbol
PARAMS ((bfd *, struct bfd_link_info *, struct aout_link_hash_entry *));
-static boolean sunos_check_dynamic_reloc
+static bfd_boolean sunos_check_dynamic_reloc
PARAMS ((struct bfd_link_info *, bfd *, asection *,
- struct aout_link_hash_entry *, PTR, bfd_byte *, boolean *,
+ struct aout_link_hash_entry *, PTR, bfd_byte *, bfd_boolean *,
bfd_vma *));
-static boolean sunos_finish_dynamic_link
+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
@@ -106,7 +105,7 @@ static boolean sunos_finish_dynamic_link
struct sunos_dynamic_info
{
/* Whether we found any dynamic information. */
- boolean valid;
+ bfd_boolean valid;
/* Dynamic information. */
struct internal_sun4_dynamic_link dyninfo;
/* Number of dynamic symbols. */
@@ -135,9 +134,9 @@ struct sunos_dynamic_info
structure and uses it to find the dynamic_link structure. It
creates and saves a sunos_dynamic_info structure. If it can't find
__DYNAMIC, it sets the valid field of the sunos_dynamic_info
- structure to false to avoid doing this work again. */
+ structure to FALSE to avoid doing this work again. */
-static boolean
+static bfd_boolean
sunos_read_dynamic_info (abfd)
bfd *abfd;
{
@@ -150,19 +149,19 @@ sunos_read_dynamic_info (abfd)
bfd_size_type amt;
if (obj_aout_dynamic_info (abfd) != (PTR) NULL)
- return true;
+ return TRUE;
if ((abfd->flags & DYNAMIC) == 0)
{
bfd_set_error (bfd_error_invalid_operation);
- return false;
+ return FALSE;
}
amt = sizeof (struct sunos_dynamic_info);
info = (struct sunos_dynamic_info *) bfd_zalloc (abfd, amt);
if (!info)
- return false;
- info->valid = false;
+ return FALSE;
+ info->valid = FALSE;
info->dynsym = NULL;
info->dynstr = NULL;
info->canonical_dynsym = NULL;
@@ -178,15 +177,15 @@ sunos_read_dynamic_info (abfd)
We could verify this assumption later by looking through the dynamic
symbols for the __DYNAMIC symbol. */
if ((abfd->flags & DYNAMIC) == 0)
- return true;
+ return TRUE;
if (! bfd_get_section_contents (abfd, obj_datasec (abfd), (PTR) &dyninfo,
(file_ptr) 0,
(bfd_size_type) sizeof dyninfo))
- return true;
+ return TRUE;
dynver = GET_WORD (abfd, dyninfo.ld_version);
if (dynver != 2 && dynver != 3)
- return true;
+ return TRUE;
dynoff = GET_WORD (abfd, dyninfo.ld);
@@ -198,14 +197,14 @@ sunos_read_dynamic_info (abfd)
dynsec = obj_datasec (abfd);
dynoff -= bfd_get_section_vma (abfd, dynsec);
if (dynoff > bfd_section_size (abfd, dynsec))
- return true;
+ return TRUE;
/* This executable appears to be dynamically linked in a way that we
can understand. */
if (! bfd_get_section_contents (abfd, dynsec, (PTR) &linkinfo,
(file_ptr) dynoff,
(bfd_size_type) sizeof linkinfo))
- return true;
+ return TRUE;
/* Swap in the dynamic link information. */
info->dyninfo.ld_loaded = GET_WORD (abfd, linkinfo.ld_loaded);
@@ -252,9 +251,9 @@ sunos_read_dynamic_info (abfd)
== (unsigned long) (info->dyninfo.ld_hash
- info->dyninfo.ld_rel));
- info->valid = true;
+ info->valid = TRUE;
- return true;
+ return TRUE;
}
/* Return the amount of memory required for the dynamic symbols. */
@@ -280,7 +279,7 @@ sunos_get_dynamic_symtab_upper_bound (abfd)
/* Read the external dynamic symbols. */
-static boolean
+static bfd_boolean
sunos_slurp_dynamic_symtab (abfd)
bfd *abfd;
{
@@ -291,14 +290,14 @@ sunos_slurp_dynamic_symtab (abfd)
if (obj_aout_dynamic_info (abfd) == NULL)
{
if (! sunos_read_dynamic_info (abfd))
- return false;
+ return FALSE;
}
info = (struct sunos_dynamic_info *) obj_aout_dynamic_info (abfd);
if (! info->valid)
{
bfd_set_error (bfd_error_no_symbols);
- return false;
+ return FALSE;
}
/* Get the dynamic nlist structures. */
@@ -307,7 +306,7 @@ sunos_slurp_dynamic_symtab (abfd)
amt = (bfd_size_type) info->dynsym_count * EXTERNAL_NLIST_SIZE;
info->dynsym = (struct external_nlist *) bfd_alloc (abfd, amt);
if (info->dynsym == NULL && info->dynsym_count != 0)
- return false;
+ return FALSE;
if (bfd_seek (abfd, (file_ptr) info->dyninfo.ld_stab, SEEK_SET) != 0
|| bfd_bread ((PTR) info->dynsym, amt, abfd) != amt)
{
@@ -316,7 +315,7 @@ sunos_slurp_dynamic_symtab (abfd)
bfd_release (abfd, info->dynsym);
info->dynsym = NULL;
}
- return false;
+ return FALSE;
}
}
@@ -326,7 +325,7 @@ sunos_slurp_dynamic_symtab (abfd)
amt = info->dyninfo.ld_symb_size;
info->dynstr = (char *) bfd_alloc (abfd, amt);
if (info->dynstr == NULL && info->dyninfo.ld_symb_size != 0)
- return false;
+ return FALSE;
if (bfd_seek (abfd, (file_ptr) info->dyninfo.ld_symbols, SEEK_SET) != 0
|| bfd_bread ((PTR) info->dynstr, amt, abfd) != amt)
{
@@ -335,11 +334,11 @@ sunos_slurp_dynamic_symtab (abfd)
bfd_release (abfd, info->dynstr);
info->dynstr = NULL;
}
- return false;
+ return FALSE;
}
}
- return true;
+ return TRUE;
}
/* Read in the dynamic symbols. */
@@ -413,7 +412,7 @@ sunos_canonicalize_dynamic_symtab (abfd, storage)
if (! aout_32_translate_symbol_table (abfd, info->canonical_dynsym,
info->dynsym,
(bfd_size_type) info->dynsym_count,
- info->dynstr, strsize, true))
+ info->dynstr, strsize, TRUE))
{
if (info->canonical_dynsym != NULL)
{
@@ -651,13 +650,13 @@ struct sunos_link_hash_table
bfd *dynobj;
/* Whether we have created the dynamic sections. */
- boolean dynamic_sections_created;
+ bfd_boolean dynamic_sections_created;
/* Whether we need the dynamic sections. */
- boolean dynamic_sections_needed;
+ bfd_boolean dynamic_sections_needed;
/* Whether we need the .got table. */
- boolean got_needed;
+ bfd_boolean got_needed;
/* The number of dynamic symbols. */
size_t dynsymcount;
@@ -728,9 +727,9 @@ sunos_link_hash_table_create (abfd)
}
ret->dynobj = NULL;
- ret->dynamic_sections_created = false;
- ret->dynamic_sections_needed = false;
- ret->got_needed = false;
+ ret->dynamic_sections_created = FALSE;
+ ret->dynamic_sections_needed = FALSE;
+ ret->got_needed = FALSE;
ret->dynsymcount = 0;
ret->bucketcount = 0;
ret->needed = NULL;
@@ -751,7 +750,7 @@ sunos_link_hash_table_create (abfd)
#define sunos_link_hash_traverse(table, func, info) \
(aout_link_hash_traverse \
(&(table)->root, \
- (boolean (*) PARAMS ((struct aout_link_hash_entry *, PTR))) (func), \
+ (bfd_boolean (*) PARAMS ((struct aout_link_hash_entry *, PTR))) (func), \
(info)))
/* Get the SunOS link hash table from the info structure. This is
@@ -759,7 +758,7 @@ sunos_link_hash_table_create (abfd)
#define sunos_hash_table(p) ((struct sunos_link_hash_table *) ((p)->hash))
-static boolean sunos_scan_dynamic_symbol
+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
@@ -769,11 +768,11 @@ static boolean sunos_scan_dynamic_symbol
place in the output file. See include/aout/sun4.h for more details
of the dynamic linking information. */
-static boolean
+static bfd_boolean
sunos_create_dynamic_sections (abfd, info, needed)
bfd *abfd;
struct bfd_link_info *info;
- boolean needed;
+ bfd_boolean needed;
{
asection *s;
@@ -793,7 +792,7 @@ sunos_create_dynamic_sections (abfd, info, needed)
if (s == NULL
|| ! bfd_set_section_flags (abfd, s, flags)
|| ! bfd_set_section_alignment (abfd, s, 2))
- return false;
+ return FALSE;
/* The .got section holds the global offset table. The address
is put in the ld_got field. */
@@ -801,7 +800,7 @@ sunos_create_dynamic_sections (abfd, info, needed)
if (s == NULL
|| ! bfd_set_section_flags (abfd, s, flags)
|| ! bfd_set_section_alignment (abfd, s, 2))
- return false;
+ return FALSE;
/* The .plt section holds the procedure linkage table. The
address is put in the ld_plt field. */
@@ -809,7 +808,7 @@ sunos_create_dynamic_sections (abfd, info, needed)
if (s == NULL
|| ! bfd_set_section_flags (abfd, s, flags | SEC_CODE)
|| ! bfd_set_section_alignment (abfd, s, 2))
- return false;
+ return FALSE;
/* The .dynrel section holds the dynamic relocs. The address is
put in the ld_rel field. */
@@ -817,7 +816,7 @@ sunos_create_dynamic_sections (abfd, info, needed)
if (s == NULL
|| ! bfd_set_section_flags (abfd, s, flags | SEC_READONLY)
|| ! bfd_set_section_alignment (abfd, s, 2))
- return false;
+ return FALSE;
/* The .hash section holds the dynamic hash table. The address
is put in the ld_hash field. */
@@ -825,7 +824,7 @@ sunos_create_dynamic_sections (abfd, info, needed)
if (s == NULL
|| ! bfd_set_section_flags (abfd, s, flags | SEC_READONLY)
|| ! bfd_set_section_alignment (abfd, s, 2))
- return false;
+ return FALSE;
/* The .dynsym section holds the dynamic symbols. The address
is put in the ld_stab field. */
@@ -833,7 +832,7 @@ sunos_create_dynamic_sections (abfd, info, needed)
if (s == NULL
|| ! bfd_set_section_flags (abfd, s, flags | SEC_READONLY)
|| ! bfd_set_section_alignment (abfd, s, 2))
- return false;
+ return FALSE;
/* The .dynstr section holds the dynamic symbol string table.
The address is put in the ld_symbols field. */
@@ -841,9 +840,9 @@ sunos_create_dynamic_sections (abfd, info, needed)
if (s == NULL
|| ! bfd_set_section_flags (abfd, s, flags | SEC_READONLY)
|| ! bfd_set_section_alignment (abfd, s, 2))
- return false;
+ return FALSE;
- sunos_hash_table (info)->dynamic_sections_created = true;
+ sunos_hash_table (info)->dynamic_sections_created = TRUE;
}
if ((needed && ! sunos_hash_table (info)->dynamic_sections_needed)
@@ -857,17 +856,17 @@ sunos_create_dynamic_sections (abfd, info, needed)
if (s->_raw_size == 0)
s->_raw_size = BYTES_IN_WORD;
- sunos_hash_table (info)->dynamic_sections_needed = true;
- sunos_hash_table (info)->got_needed = true;
+ sunos_hash_table (info)->dynamic_sections_needed = TRUE;
+ sunos_hash_table (info)->got_needed = TRUE;
}
- return true;
+ return TRUE;
}
/* Add dynamic symbols during a link. This is called by the a.out
backend linker for each object it encounters. */
-static boolean
+static bfd_boolean
sunos_add_dynamic_symbols (abfd, info, symsp, sym_countp, stringsp)
bfd *abfd;
struct bfd_link_info *info;
@@ -884,16 +883,14 @@ sunos_add_dynamic_symbols (abfd, info, symsp, sym_countp, stringsp)
if (info->hash->creator == abfd->xvec)
{
if (! sunos_create_dynamic_sections (abfd, info,
- (((abfd->flags & DYNAMIC) != 0
- && ! info->relocateable)
- ? true
- : false)))
- return false;
+ ((abfd->flags & DYNAMIC) != 0
+ && !info->relocatable)))
+ return FALSE;
}
/* There is nothing else to do for a normal object. */
if ((abfd->flags & DYNAMIC) == 0)
- return true;
+ return TRUE;
dynobj = sunos_hash_table (info)->dynobj;
@@ -914,15 +911,15 @@ sunos_add_dynamic_symbols (abfd, info, symsp, sym_countp, stringsp)
/* The native linker seems to just ignore dynamic objects when -r is
used. */
- if (info->relocateable)
- return true;
+ if (info->relocatable)
+ return TRUE;
/* There's no hope of using a dynamic object which does not exactly
match the format of the output file. */
if (info->hash->creator != abfd->xvec)
{
bfd_set_error (bfd_error_invalid_operation);
- return false;
+ return FALSE;
}
/* Make sure we have a .need and a .rules sections. These are only
@@ -942,7 +939,7 @@ sunos_add_dynamic_symbols (abfd, info, symsp, sym_countp, stringsp)
| SEC_IN_MEMORY
| SEC_READONLY))
|| ! bfd_set_section_alignment (dynobj, s, 2))
- return false;
+ return FALSE;
}
if (bfd_get_section_by_name (dynobj, ".rules") == NULL)
@@ -959,12 +956,12 @@ sunos_add_dynamic_symbols (abfd, info, symsp, sym_countp, stringsp)
| SEC_IN_MEMORY
| SEC_READONLY))
|| ! bfd_set_section_alignment (dynobj, s, 2))
- return false;
+ return FALSE;
}
/* Pick up the dynamic symbols and return them to the caller. */
if (! sunos_slurp_dynamic_symtab (abfd))
- return false;
+ return FALSE;
dinfo = (struct sunos_dynamic_info *) obj_aout_dynamic_info (abfd);
*symsp = dinfo->dynsym;
@@ -986,10 +983,10 @@ sunos_add_dynamic_symbols (abfd, info, symsp, sym_countp, stringsp)
if (bfd_seek (abfd, (file_ptr) need, SEEK_SET) != 0
|| bfd_bread (buf, (bfd_size_type) 16, abfd) != 16)
- return false;
+ return FALSE;
/* For the format of an ld_need entry, see aout/sun4.h. We
- should probably define structs for this manipulation. */
+ should probably define structs for this manipulation. */
name = bfd_get_32 (abfd, buf);
flags = bfd_get_32 (abfd, buf + 4);
@@ -1000,14 +997,14 @@ sunos_add_dynamic_symbols (abfd, info, symsp, sym_countp, stringsp)
alc = sizeof (struct bfd_link_needed_list);
needed = (struct bfd_link_needed_list *) bfd_alloc (abfd, alc);
if (needed == NULL)
- return false;
+ return FALSE;
needed->by = abfd;
/* We return the name as [-l]name[.maj][.min]. */
alc = 30;
namebuf = (char *) bfd_malloc (alc + 1);
if (namebuf == NULL)
- return false;
+ return FALSE;
p = namebuf;
if ((flags & 0x80000000) != 0)
@@ -1018,7 +1015,7 @@ sunos_add_dynamic_symbols (abfd, info, symsp, sym_countp, stringsp)
if (bfd_seek (abfd, (file_ptr) name, SEEK_SET) != 0)
{
free (namebuf);
- return false;
+ return FALSE;
}
do
@@ -1026,7 +1023,7 @@ sunos_add_dynamic_symbols (abfd, info, symsp, sym_countp, stringsp)
if (bfd_bread (&b, (bfd_size_type) 1, abfd) != 1)
{
free (namebuf);
- return false;
+ return FALSE;
}
if ((bfd_size_type) (p - namebuf) >= alc)
@@ -1038,7 +1035,7 @@ sunos_add_dynamic_symbols (abfd, info, symsp, sym_countp, stringsp)
if (n == NULL)
{
free (namebuf);
- return false;
+ return FALSE;
}
p = n + (p - namebuf);
namebuf = n;
@@ -1070,7 +1067,7 @@ sunos_add_dynamic_symbols (abfd, info, symsp, sym_countp, stringsp)
if (n == NULL)
{
free (namebuf);
- return false;
+ return FALSE;
}
p = n + (p - namebuf);
namebuf = n;
@@ -1084,7 +1081,7 @@ sunos_add_dynamic_symbols (abfd, info, symsp, sym_countp, stringsp)
if (namecopy == NULL)
{
free (namebuf);
- return false;
+ return FALSE;
}
strcpy (namecopy, namebuf);
free (namebuf);
@@ -1099,14 +1096,14 @@ sunos_add_dynamic_symbols (abfd, info, symsp, sym_countp, stringsp)
*pp = needed;
}
- return true;
+ return TRUE;
}
/* Function to add a single symbol to the linker hash table. This is
a wrapper around _bfd_generic_link_add_one_symbol which handles the
tweaking needed for dynamic linking support. */
-static boolean
+static bfd_boolean
sunos_add_one_symbol (info, abfd, name, flags, section, value, string,
copy, collect, hashp)
struct bfd_link_info *info;
@@ -1116,8 +1113,8 @@ sunos_add_one_symbol (info, abfd, name, flags, section, value, string,
asection *section;
bfd_vma value;
const char *string;
- boolean copy;
- boolean collect;
+ bfd_boolean copy;
+ bfd_boolean collect;
struct bfd_link_hash_entry **hashp;
{
struct sunos_link_hash_entry *h;
@@ -1125,13 +1122,13 @@ sunos_add_one_symbol (info, abfd, name, flags, section, value, string,
if ((flags & (BSF_INDIRECT | BSF_WARNING | BSF_CONSTRUCTOR)) != 0
|| ! bfd_is_und_section (section))
- h = sunos_link_hash_lookup (sunos_hash_table (info), name, true, copy,
- false);
+ h = sunos_link_hash_lookup (sunos_hash_table (info), name, TRUE, copy,
+ FALSE);
else
h = ((struct sunos_link_hash_entry *)
- bfd_wrapped_link_hash_lookup (abfd, info, name, true, copy, false));
+ bfd_wrapped_link_hash_lookup (abfd, info, name, TRUE, copy, FALSE));
if (h == NULL)
- return false;
+ return FALSE;
if (hashp != NULL)
*hashp = (struct bfd_link_hash_entry *) h;
@@ -1185,10 +1182,10 @@ sunos_add_one_symbol (info, abfd, name, flags, section, value, string,
&& (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. */
+ 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
@@ -1198,8 +1195,8 @@ sunos_add_one_symbol (info, abfd, name, flags, section, value, string,
&& (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. */
+ 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;
}
@@ -1207,7 +1204,7 @@ sunos_add_one_symbol (info, abfd, name, flags, section, value, string,
if (! _bfd_generic_link_add_one_symbol (info, abfd, name, flags, section,
value, string, copy, collect,
hashp))
- return false;
+ return FALSE;
if (abfd->xvec == info->hash->creator)
{
@@ -1244,12 +1241,11 @@ sunos_add_one_symbol (info, abfd, name, flags, section, value, string,
h->flags |= SUNOS_CONSTRUCTOR;
}
- return true;
+ return TRUE;
}
/* Return the list of objects needed by BFD. */
-/*ARGSUSED*/
struct bfd_link_needed_list *
bfd_sunos_get_needed_list (abfd, info)
bfd *abfd ATTRIBUTE_UNUSED;
@@ -1263,7 +1259,7 @@ bfd_sunos_get_needed_list (abfd, info)
/* Record an assignment made to a symbol by a linker script. We need
this in case some dynamic object refers to this symbol. */
-boolean
+bfd_boolean
bfd_sunos_record_link_assignment (output_bfd, info, name)
bfd *output_bfd;
struct bfd_link_info *info;
@@ -1272,15 +1268,15 @@ bfd_sunos_record_link_assignment (output_bfd, info, name)
struct sunos_link_hash_entry *h;
if (output_bfd->xvec != &MY(vec))
- return true;
+ return TRUE;
/* This is called after we have examined all the input objects. If
the symbol does not exist, it merely means that no object refers
to it, and we can just ignore it at this point. */
h = sunos_link_hash_lookup (sunos_hash_table (info), name,
- false, false, false);
+ FALSE, FALSE, FALSE);
if (h == NULL)
- return true;
+ return TRUE;
/* In a shared library, the __DYNAMIC symbol does not appear in the
dynamic symbol table. */
@@ -1295,7 +1291,7 @@ bfd_sunos_record_link_assignment (output_bfd, info, name)
}
}
- return true;
+ return TRUE;
}
/* Set up the sizes and contents of the dynamic sections created in
@@ -1304,10 +1300,10 @@ bfd_sunos_record_link_assignment (output_bfd, info, name)
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,
+ info->keep_memory is TRUE, we keep the relocs in memory; otherwise,
we discard them, and will read them again later. */
-boolean
+bfd_boolean
bfd_sunos_size_dynamic_sections (output_bfd, info, sdynptr, sneedptr,
srulesptr)
bfd *output_bfd;
@@ -1329,11 +1325,11 @@ bfd_sunos_size_dynamic_sections (output_bfd, info, sdynptr, sneedptr,
*sneedptr = NULL;
*srulesptr = NULL;
- if (info->relocateable)
- return true;
+ if (info->relocatable)
+ return TRUE;
if (output_bfd->xvec != &MY(vec))
- return true;
+ 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
@@ -1349,7 +1345,7 @@ bfd_sunos_size_dynamic_sections (output_bfd, info, sdynptr, sneedptr,
exec_hdr (sub)->a_trsize)
|| ! sunos_scan_relocs (info, sub, obj_datasec (sub),
exec_hdr (sub)->a_drsize))
- return false;
+ return FALSE;
}
}
@@ -1360,11 +1356,11 @@ bfd_sunos_size_dynamic_sections (output_bfd, info, sdynptr, sneedptr,
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;
+ 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);
+ "__GLOBAL_OFFSET_TABLE_", FALSE, FALSE, FALSE);
if (h != NULL && (h->flags & SUNOS_REF_REGULAR) != 0)
{
h->flags |= SUNOS_DEF_REGULAR;
@@ -1377,8 +1373,8 @@ bfd_sunos_size_dynamic_sections (output_bfd, info, sdynptr, sneedptr,
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. */
+ __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)
@@ -1415,7 +1411,7 @@ bfd_sunos_size_dynamic_sections (output_bfd, info, sdynptr, sneedptr,
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;
+ 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
@@ -1436,7 +1432,7 @@ bfd_sunos_size_dynamic_sections (output_bfd, info, sdynptr, sneedptr,
hashalloc = (dynsymcount + bucketcount - 1) * HASH_ENTRY_SIZE;
s->contents = (bfd_byte *) bfd_zalloc (dynobj, hashalloc);
if (s->contents == NULL && dynsymcount > 0)
- return false;
+ 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;
@@ -1466,7 +1462,7 @@ bfd_sunos_size_dynamic_sections (output_bfd, info, sdynptr, sneedptr,
contents = (bfd_byte *) bfd_realloc (s->contents,
s->_raw_size + add);
if (contents == NULL)
- return false;
+ return FALSE;
memset (contents + s->_raw_size, 0, (size_t) add);
s->contents = contents;
s->_raw_size += add;
@@ -1481,7 +1477,7 @@ bfd_sunos_size_dynamic_sections (output_bfd, info, sdynptr, sneedptr,
{
s->contents = (bfd_byte *) bfd_alloc (dynobj, s->_raw_size);
if (s->contents == NULL)
- return false;
+ return FALSE;
/* Fill in the first entry in the table. */
switch (bfd_get_arch (dynobj))
@@ -1504,7 +1500,7 @@ bfd_sunos_size_dynamic_sections (output_bfd, info, sdynptr, sneedptr,
{
s->contents = (bfd_byte *) bfd_alloc (dynobj, s->_raw_size);
if (s->contents == NULL)
- return false;
+ return FALSE;
}
/* We use the reloc_count field to keep track of how many of the
relocs we have output so far. */
@@ -1514,17 +1510,17 @@ bfd_sunos_size_dynamic_sections (output_bfd, info, sdynptr, sneedptr,
s = bfd_get_section_by_name (dynobj, ".got");
s->contents = (bfd_byte *) bfd_alloc (dynobj, s->_raw_size);
if (s->contents == NULL)
- return false;
+ return FALSE;
*sneedptr = bfd_get_section_by_name (dynobj, ".need");
*srulesptr = bfd_get_section_by_name (dynobj, ".rules");
- return true;
+ return TRUE;
}
/* Scan the relocs for an input section. */
-static boolean
+static bfd_boolean
sunos_scan_relocs (info, abfd, sec, rel_size)
struct bfd_link_info *info;
bfd *abfd;
@@ -1535,7 +1531,7 @@ sunos_scan_relocs (info, abfd, sec, rel_size)
PTR free_relocs = NULL;
if (rel_size == 0)
- return true;
+ return TRUE;
if (! info->keep_memory)
relocs = free_relocs = bfd_malloc (rel_size);
@@ -1555,7 +1551,7 @@ sunos_scan_relocs (info, abfd, sec, rel_size)
}
}
if (relocs == NULL)
- return false;
+ return FALSE;
if (bfd_seek (abfd, sec->rel_filepos, SEEK_SET) != 0
|| bfd_bread (relocs, rel_size, abfd) != rel_size)
@@ -1579,12 +1575,12 @@ sunos_scan_relocs (info, abfd, sec, rel_size)
if (free_relocs != NULL)
free (free_relocs);
- return true;
+ return TRUE;
error_return:
if (free_relocs != NULL)
free (free_relocs);
- return false;
+ return FALSE;
}
/* Scan the relocs for an input section using standard relocs. We
@@ -1597,7 +1593,7 @@ sunos_scan_relocs (info, abfd, sec, rel_size)
reloc. FIXME: We should also handle the PIC relocs here by
building global offset table entries. */
-static boolean
+static bfd_boolean
sunos_scan_std_relocs (info, abfd, sec, relocs, rel_size)
struct bfd_link_info *info;
bfd *abfd;
@@ -1615,7 +1611,7 @@ sunos_scan_std_relocs (info, abfd, sec, relocs, rel_size)
if (bfd_get_arch (abfd) != bfd_arch_m68k)
{
bfd_set_error (bfd_error_invalid_target);
- return false;
+ return FALSE;
}
dynobj = NULL;
@@ -1677,8 +1673,8 @@ sunos_scan_std_relocs (info, abfd, sec, relocs, rel_size)
{
asection *sgot;
- if (! sunos_create_dynamic_sections (abfd, info, false))
- return false;
+ if (! sunos_create_dynamic_sections (abfd, info, FALSE))
+ return FALSE;
dynobj = sunos_hash_table (info)->dynobj;
splt = bfd_get_section_by_name (dynobj, ".plt");
srel = bfd_get_section_by_name (dynobj, ".dynrel");
@@ -1688,7 +1684,7 @@ sunos_scan_std_relocs (info, abfd, sec, relocs, rel_size)
BFD_ASSERT (sgot != NULL);
if (sgot->_raw_size == 0)
sgot->_raw_size = BYTES_IN_WORD;
- sunos_hash_table (info)->got_needed = true;
+ sunos_hash_table (info)->got_needed = TRUE;
}
BFD_ASSERT ((h->flags & SUNOS_REF_REGULAR) != 0);
@@ -1748,7 +1744,7 @@ sunos_scan_std_relocs (info, abfd, sec, relocs, rel_size)
}
}
- return true;
+ return TRUE;
}
/* Scan the relocs for an input section using extended relocs. We
@@ -1757,7 +1753,7 @@ sunos_scan_std_relocs (info, abfd, sec, relocs, rel_size)
section, an entry is made in the procedure linkage table.
Otherwise, we must preserve the reloc as a dynamic reloc. */
-static boolean
+static bfd_boolean
sunos_scan_ext_relocs (info, abfd, sec, relocs, rel_size)
struct bfd_link_info *info;
bfd *abfd;
@@ -1777,7 +1773,7 @@ sunos_scan_ext_relocs (info, abfd, sec, relocs, rel_size)
if (bfd_get_arch (abfd) != bfd_arch_sparc)
{
bfd_set_error (bfd_error_invalid_target);
- return false;
+ return FALSE;
}
dynobj = NULL;
@@ -1824,15 +1820,15 @@ sunos_scan_ext_relocs (info, abfd, sec, relocs, rel_size)
}
/* If this is a base relative reloc, we need to make an entry in
- the .got section. */
+ the .got section. */
if (r_type == RELOC_BASE10
|| r_type == RELOC_BASE13
|| r_type == RELOC_BASE22)
{
if (dynobj == NULL)
{
- if (! sunos_create_dynamic_sections (abfd, info, false))
- return false;
+ if (! sunos_create_dynamic_sections (abfd, info, FALSE))
+ return FALSE;
dynobj = sunos_hash_table (info)->dynobj;
splt = bfd_get_section_by_name (dynobj, ".plt");
sgot = bfd_get_section_by_name (dynobj, ".got");
@@ -1842,7 +1838,7 @@ sunos_scan_ext_relocs (info, abfd, sec, relocs, rel_size)
/* Make sure we have an initial entry in the .got table. */
if (sgot->_raw_size == 0)
sgot->_raw_size = BYTES_IN_WORD;
- sunos_hash_table (info)->got_needed = true;
+ sunos_hash_table (info)->got_needed = TRUE;
}
if (r_extern)
@@ -1868,7 +1864,7 @@ sunos_scan_ext_relocs (info, abfd, sec, relocs, rel_size)
adata (abfd).local_got_offsets =
(bfd_vma *) bfd_zalloc (abfd, amt);
if (adata (abfd).local_got_offsets == NULL)
- return false;
+ return FALSE;
}
if (adata (abfd).local_got_offsets[r_index] != 0)
@@ -1892,18 +1888,18 @@ sunos_scan_ext_relocs (info, abfd, sec, relocs, rel_size)
}
/* Otherwise, we are only interested in relocs against symbols
- defined in dynamic objects but not in regular objects. We
- only need to consider relocs against external symbols. */
+ defined in dynamic objects but not in regular objects. We
+ only need to consider relocs against external symbols. */
if (! r_extern)
{
/* But, if we are creating a shared library, we need to
- generate an absolute reloc. */
+ generate an absolute reloc. */
if (info->shared)
{
if (dynobj == NULL)
{
- if (! sunos_create_dynamic_sections (abfd, info, true))
- return false;
+ if (! sunos_create_dynamic_sections (abfd, info, TRUE))
+ return FALSE;
dynobj = sunos_hash_table (info)->dynobj;
splt = bfd_get_section_by_name (dynobj, ".plt");
sgot = bfd_get_section_by_name (dynobj, ".got");
@@ -1939,8 +1935,8 @@ sunos_scan_ext_relocs (info, abfd, sec, relocs, rel_size)
&& (h->flags & SUNOS_DEF_REGULAR) == 0)
{
/* This symbol is apparently undefined. Don't do anything
- here; just let the relocation routine report an undefined
- symbol. */
+ here; just let the relocation routine report an undefined
+ symbol. */
continue;
}
@@ -1949,8 +1945,8 @@ sunos_scan_ext_relocs (info, abfd, sec, relocs, rel_size)
if (dynobj == NULL)
{
- if (! sunos_create_dynamic_sections (abfd, info, false))
- return false;
+ if (! sunos_create_dynamic_sections (abfd, info, FALSE))
+ return FALSE;
dynobj = sunos_hash_table (info)->dynobj;
splt = bfd_get_section_by_name (dynobj, ".plt");
sgot = bfd_get_section_by_name (dynobj, ".got");
@@ -1960,7 +1956,7 @@ sunos_scan_ext_relocs (info, abfd, sec, relocs, rel_size)
/* Make sure we have an initial entry in the .got table. */
if (sgot->_raw_size == 0)
sgot->_raw_size = BYTES_IN_WORD;
- sunos_hash_table (info)->got_needed = true;
+ sunos_hash_table (info)->got_needed = TRUE;
}
BFD_ASSERT (r_type == RELOC_JMP_TBL
@@ -2025,26 +2021,26 @@ sunos_scan_ext_relocs (info, abfd, sec, relocs, rel_size)
splt->_raw_size += SPARC_PLT_ENTRY_SIZE;
/* We will also need a dynamic reloc entry, unless this
- is a JMP_TBL reloc produced by linking PIC compiled
- code, and we are not making a shared library. */
+ is a JMP_TBL reloc produced by linking PIC compiled
+ code, and we are not making a shared library. */
if (info->shared || (h->flags & SUNOS_DEF_REGULAR) == 0)
srel->_raw_size += RELOC_EXT_SIZE;
}
/* If we are creating a shared library, we need to copy over
- any reloc other than a jump table reloc. */
+ any reloc other than a jump table reloc. */
if (info->shared && r_type != RELOC_JMP_TBL)
srel->_raw_size += RELOC_EXT_SIZE;
}
}
- return true;
+ return TRUE;
}
/* Build the hash table of dynamic symbols, and to mark as written all
symbols from dynamic objects which we do not plan to write out. */
-static boolean
+static bfd_boolean
sunos_scan_dynamic_symbol (h, data)
struct sunos_link_hash_entry *h;
PTR data;
@@ -2066,7 +2062,7 @@ sunos_scan_dynamic_symbol (h, data)
if ((h->flags & SUNOS_DEF_REGULAR) == 0
&& (h->flags & SUNOS_DEF_DYNAMIC) != 0
&& strcmp (h->root.root.root.string, "__DYNAMIC") != 0)
- h->root.written = true;
+ h->root.written = TRUE;
/* If this symbol is defined by a dynamic object and referenced by a
regular object, see whether we gave it a reasonable value while
@@ -2125,7 +2121,7 @@ sunos_scan_dynamic_symbol (h, data)
contents = (bfd_byte *) bfd_realloc (s->contents,
s->_raw_size + len + 1);
if (contents == NULL)
- return false;
+ return FALSE;
s->contents = contents;
h->dynstr_index = s->_raw_size;
@@ -2161,26 +2157,25 @@ sunos_scan_dynamic_symbol (h, data)
}
}
- return true;
+ return TRUE;
}
/* Link a dynamic object. We actually don't have anything to do at
this point. This entry point exists to prevent the regular linker
code from doing anything with the object. */
-/*ARGSUSED*/
-static boolean
+static bfd_boolean
sunos_link_dynamic_object (info, abfd)
struct bfd_link_info *info ATTRIBUTE_UNUSED;
bfd *abfd ATTRIBUTE_UNUSED;
{
- return true;
+ return TRUE;
}
/* Write out a dynamic symbol. This is called by the final traversal
over the symbol table. */
-static boolean
+static bfd_boolean
sunos_write_dynamic_symbol (output_bfd, info, harg)
bfd *output_bfd;
struct bfd_link_info *info;
@@ -2254,7 +2249,7 @@ sunos_write_dynamic_symbol (output_bfd, info, harg)
}
/* We also need to add a jump table reloc, unless this is the
- result of a JMP_TBL reloc from PIC compiled code. */
+ result of a JMP_TBL reloc from PIC compiled code. */
if (info->shared || (h->flags & SUNOS_DEF_REGULAR) == 0)
{
BFD_ASSERT (h->dynindx >= 0);
@@ -2320,7 +2315,7 @@ sunos_write_dynamic_symbol (output_bfd, info, harg)
we can have a PLT entry for a nondynamic symbol when linking PIC
compiled code from a regular object. */
if (h->dynindx < 0)
- return true;
+ return TRUE;
switch (h->root.root.type)
{
@@ -2328,7 +2323,7 @@ sunos_write_dynamic_symbol (output_bfd, info, harg)
case bfd_link_hash_new:
abort ();
/* Avoid variable not initialized warnings. */
- return true;
+ return TRUE;
case bfd_link_hash_undefined:
type = N_UNDF | N_EXT;
val = 0;
@@ -2386,7 +2381,7 @@ sunos_write_dynamic_symbol (output_bfd, info, harg)
case bfd_link_hash_warning:
/* FIXME: Ignore these for now. The circumstances under which
they should be written out are not clear to me. */
- return true;
+ return TRUE;
}
s = bfd_get_section_by_name (sunos_hash_table (info)->dynobj, ".dynsym");
@@ -2405,7 +2400,7 @@ sunos_write_dynamic_symbol (output_bfd, info, harg)
PUT_WORD (output_bfd, h->dynstr_index, outsym->e_strx);
PUT_WORD (output_bfd, val, outsym->e_value);
- return true;
+ return TRUE;
}
/* This is called for each reloc against an external symbol. If this
@@ -2413,8 +2408,7 @@ sunos_write_dynamic_symbol (output_bfd, info, harg)
copy it over, and tell the caller to not bother processing this
reloc. */
-/*ARGSUSED*/
-static boolean
+static bfd_boolean
sunos_check_dynamic_reloc (info, input_bfd, input_section, harg, reloc,
contents, skip, relocationp)
struct bfd_link_info *info;
@@ -2423,19 +2417,19 @@ sunos_check_dynamic_reloc (info, input_bfd, input_section, harg, reloc,
struct aout_link_hash_entry *harg;
PTR reloc;
bfd_byte *contents ATTRIBUTE_UNUSED;
- boolean *skip;
+ bfd_boolean *skip;
bfd_vma *relocationp;
{
struct sunos_link_hash_entry *h = (struct sunos_link_hash_entry *) harg;
bfd *dynobj;
- boolean baserel;
- boolean jmptbl;
- boolean pcrel;
+ bfd_boolean baserel;
+ bfd_boolean jmptbl;
+ bfd_boolean pcrel;
asection *s;
bfd_byte *p;
long indx;
- *skip = false;
+ *skip = FALSE;
dynobj = sunos_hash_table (info)->dynobj;
@@ -2493,7 +2487,7 @@ sunos_check_dynamic_reloc (info, input_bfd, input_section, harg, reloc,
|| r_type == RELOC_WDISP30
|| r_type == RELOC_WDISP22);
/* We don't consider the PC10 and PC22 types to be PC relative,
- because they are pcrel_offset. */
+ because they are pcrel_offset. */
}
if (baserel)
@@ -2562,7 +2556,7 @@ sunos_check_dynamic_reloc (info, input_bfd, input_section, harg, reloc,
&& (h->flags & SUNOS_DEF_REGULAR) == 0))
{
/* We need to create a GLOB_DAT or 32 reloc to tell the
- dynamic linker to fill in this entry in the table. */
+ dynamic linker to fill in this entry in the table. */
s = bfd_get_section_by_name (dynobj, ".dynrel");
BFD_ASSERT (s != NULL);
@@ -2667,11 +2661,11 @@ sunos_check_dynamic_reloc (info, input_bfd, input_section, harg, reloc,
- sunos_hash_table (info)->got_base);
/* There is nothing else to do for a base relative reloc. */
- return true;
+ return TRUE;
}
if (! sunos_hash_table (info)->dynamic_sections_needed)
- return true;
+ return TRUE;
if (! info->shared)
{
if (h == NULL
@@ -2680,7 +2674,7 @@ sunos_check_dynamic_reloc (info, input_bfd, input_section, harg, reloc,
|| (h->flags & SUNOS_DEF_REGULAR) != 0
|| (h->flags & SUNOS_DEF_DYNAMIC) == 0
|| (h->root.root.u.undef.abfd->flags & DYNAMIC) == 0)
- return true;
+ return TRUE;
}
else
{
@@ -2689,7 +2683,7 @@ sunos_check_dynamic_reloc (info, input_bfd, input_section, harg, reloc,
|| jmptbl
|| strcmp (h->root.root.root.string,
"__GLOBAL_OFFSET_TABLE_") == 0))
- return true;
+ return TRUE;
}
/* It looks like this is a reloc we are supposed to copy. */
@@ -2732,7 +2726,7 @@ sunos_check_dynamic_reloc (info, input_bfd, input_section, harg, reloc,
srel->r_index[0] = (bfd_byte)indx;
}
/* FIXME: We may have to change the addend for a PC relative
- reloc. */
+ reloc. */
}
else
{
@@ -2771,14 +2765,14 @@ sunos_check_dynamic_reloc (info, input_bfd, input_section, harg, reloc,
++s->reloc_count;
if (h != NULL)
- *skip = true;
+ *skip = TRUE;
- return true;
+ return TRUE;
}
/* Finish up the dynamic linking information. */
-static boolean
+static bfd_boolean
sunos_finish_dynamic_link (abfd, info)
bfd *abfd;
struct bfd_link_info *info;
@@ -2790,7 +2784,7 @@ sunos_finish_dynamic_link (abfd, info)
if (! sunos_hash_table (info)->dynamic_sections_needed
&& ! sunos_hash_table (info)->got_needed)
- return true;
+ return TRUE;
dynobj = sunos_hash_table (info)->dynobj;
@@ -2843,7 +2837,7 @@ sunos_finish_dynamic_link (abfd, info)
o->contents,
(file_ptr) o->output_offset,
o->_raw_size))
- return false;
+ return FALSE;
}
}
@@ -2868,7 +2862,7 @@ sunos_finish_dynamic_link (abfd, info)
if (! bfd_set_section_contents (abfd, sdyn->output_section, &esd,
(file_ptr) sdyn->output_offset,
(bfd_size_type) sizeof esd))
- return false;
+ return FALSE;
PUT_WORD (dynobj, (bfd_vma) 0, esdl.ld_loaded);
@@ -2936,10 +2930,10 @@ sunos_finish_dynamic_link (abfd, info)
pos += sizeof esd + EXTERNAL_SUN4_DYNAMIC_DEBUGGER_SIZE;
if (! bfd_set_section_contents (abfd, sdyn->output_section, &esdl,
pos, (bfd_size_type) sizeof esdl))
- return false;
+ return FALSE;
abfd->flags |= DYNAMIC;
}
- return true;
+ return TRUE;
}
diff --git a/contrib/binutils/bfd/syms.c b/contrib/binutils/bfd/syms.c
index da71d80..c07f48b 100644
--- a/contrib/binutils/bfd/syms.c
+++ b/contrib/binutils/bfd/syms.c
@@ -1,24 +1,24 @@
/* Generic symbol-table support for the BFD library.
Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
- 2000, 2001, 2002
+ 2000, 2001, 2002, 2003
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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
/*
SECTION
@@ -74,10 +74,10 @@ SUBSECTION
| if (storage_needed < 0)
| FAIL
|
-| if (storage_needed == 0) {
-| return ;
-| }
-| symbol_table = (asymbol **) xmalloc (storage_needed);
+| if (storage_needed == 0)
+| return;
+|
+| symbol_table = xmalloc (storage_needed);
| ...
| number_of_symbols =
| bfd_canonicalize_symtab (abfd, symbol_table);
@@ -85,9 +85,8 @@ SUBSECTION
| if (number_of_symbols < 0)
| FAIL
|
-| for (i = 0; i < number_of_symbols; i++) {
-| process_symbol (symbol_table[i]);
-| }
+| for (i = 0; i < number_of_symbols; i++)
+| process_symbol (symbol_table[i]);
All storage for the symbols themselves is in an objalloc
connected to the BFD; it is freed when the BFD is closed.
@@ -108,34 +107,35 @@ SUBSECTION
example showing the creation of a symbol table with only one element:
| #include "bfd.h"
-| main()
+| 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);
+| 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->section = bfd_make_section_old_way (abfd, ".text");
| new->flags = BSF_GLOBAL;
| new->value = 0x12345;
|
| ptrs[0] = new;
-| ptrs[1] = (asymbol *)0;
+| ptrs[1] = 0;
|
-| bfd_set_symtab(abfd, ptrs, 1);
-| bfd_close(abfd);
+| bfd_set_symtab (abfd, ptrs, 1);
+| bfd_close (abfd);
+| return 0;
| }
|
| ./makesym
| nm foo
| 00012345 A dummy_symbol
- Many formats cannot represent arbitary symbol information; for
+ Many formats cannot represent arbitrary symbol information; for
instance, the <<a.out>> object format does not allow an
- arbitary number of sections. A symbol pointing to a section
+ arbitrary number of sections. A symbol pointing to a section
which is not one of <<.text>>, <<.data>> or <<.bss>> cannot
be described.
@@ -181,7 +181,7 @@ SUBSECTION
CODE_FRAGMENT
.
-.typedef struct symbol_cache_entry
+.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
@@ -192,7 +192,7 @@ CODE_FRAGMENT
. 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. *}
+. 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. *}
@@ -222,7 +222,7 @@ CODE_FRAGMENT
. <<BSF_LOCAL>>, <<BSF_FORT_COMM>>, <<BSF_UNDEFINED>> or
. <<BSF_GLOBAL>>. *}
.
-. {* The symbol is a debugging record. The value has an arbitary
+. {* The symbol is a debugging record. The value has an arbitrary
. meaning, unless BSF_DEBUGGING_RELOC is also set. *}
.#define BSF_DEBUGGING 0x08
.
@@ -293,12 +293,12 @@ CODE_FRAGMENT
. {* 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 sec *section;
+. struct bfd_section *section;
.
. {* Back end special data. *}
. union
. {
-. PTR p;
+. void *p;
. bfd_vma i;
. }
. udata;
@@ -314,10 +314,6 @@ CODE_FRAGMENT
#include "bfdlink.h"
#include "aout/stab_gnu.h"
-static char coff_section_type PARAMS ((const char *));
-static char decode_section_type PARAMS ((const struct sec *));
-static int cmpindexentry PARAMS ((const PTR, const PTR));
-
/*
DOCDD
INODE
@@ -346,25 +342,23 @@ FUNCTION
bfd_is_local_label
SYNOPSIS
- boolean bfd_is_local_label(bfd *abfd, asymbol *sym);
+ bfd_boolean bfd_is_local_label (bfd *abfd, asymbol *sym);
DESCRIPTION
- Return true if the given symbol @var{sym} in the BFD @var{abfd} is
- a compiler generated local label, else return false.
+ Return TRUE if the given symbol @var{sym} in the BFD @var{abfd} is
+ a compiler generated local label, else return FALSE.
*/
-boolean
-bfd_is_local_label (abfd, sym)
- bfd *abfd;
- asymbol *sym;
+bfd_boolean
+bfd_is_local_label (bfd *abfd, asymbol *sym)
{
/* The BSF_SECTION_SYM check is needed for IA-64, where every label that
starts with '.' is local. This would accidentally catch section names
if we didn't reject them here. */
if ((sym->flags & (BSF_GLOBAL | BSF_WEAK | BSF_SECTION_SYM)) != 0)
- return false;
+ return FALSE;
if (sym->name == NULL)
- return false;
+ return FALSE;
return bfd_is_local_label_name (abfd, sym->name);
}
@@ -373,16 +367,16 @@ FUNCTION
bfd_is_local_label_name
SYNOPSIS
- boolean bfd_is_local_label_name(bfd *abfd, const char *name);
+ bfd_boolean bfd_is_local_label_name (bfd *abfd, const char *name);
DESCRIPTION
- Return true if a symbol with the name @var{name} in the BFD
+ 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
+ FALSE. This just checks whether the name has the form of a
local label.
.#define bfd_is_local_label_name(abfd, name) \
-. BFD_SEND (abfd, _bfd_is_local_label_name, (abfd, name))
+. BFD_SEND (abfd, _bfd_is_local_label_name, (abfd, name))
.
*/
@@ -398,8 +392,7 @@ DESCRIPTION
including the NULL.
.#define bfd_canonicalize_symtab(abfd, location) \
-. BFD_SEND (abfd, _bfd_canonicalize_symtab,\
-. (abfd, location))
+. BFD_SEND (abfd, _bfd_canonicalize_symtab, (abfd, location))
.
*/
@@ -408,7 +401,8 @@ FUNCTION
bfd_set_symtab
SYNOPSIS
- boolean bfd_set_symtab (bfd *abfd, asymbol **location, unsigned int count);
+ bfd_boolean bfd_set_symtab
+ (bfd *abfd, asymbol **location, unsigned int count);
DESCRIPTION
Arrange that when the output BFD @var{abfd} is closed,
@@ -416,21 +410,18 @@ DESCRIPTION
will be written.
*/
-boolean
-bfd_set_symtab (abfd, location, symcount)
- bfd *abfd;
- asymbol **location;
- unsigned int symcount;
+bfd_boolean
+bfd_set_symtab (bfd *abfd, asymbol **location, unsigned int symcount)
{
- if ((abfd->format != bfd_object) || (bfd_read_p (abfd)))
+ if (abfd->format != bfd_object || bfd_read_p (abfd))
{
bfd_set_error (bfd_error_invalid_operation);
- return false;
+ return FALSE;
}
bfd_get_outsymbols (abfd) = location;
bfd_get_symcount (abfd) = symcount;
- return true;
+ return TRUE;
}
/*
@@ -438,29 +429,23 @@ FUNCTION
bfd_print_symbol_vandf
SYNOPSIS
- void bfd_print_symbol_vandf(bfd *abfd, PTR file, asymbol *symbol);
+ void bfd_print_symbol_vandf (bfd *abfd, void *file, asymbol *symbol);
DESCRIPTION
Print the value and flags of the @var{symbol} supplied to the
stream @var{file}.
*/
void
-bfd_print_symbol_vandf (abfd, arg, symbol)
- bfd *abfd;
- PTR arg;
- asymbol *symbol;
+bfd_print_symbol_vandf (bfd *abfd, void *arg, asymbol *symbol)
{
- FILE *file = (FILE *) arg;
+ FILE *file = arg;
+
flagword type = symbol->flags;
- if (symbol->section != (asection *) NULL)
- {
- bfd_fprintf_vma (abfd, file,
- symbol->value + symbol->section->vma);
- }
+
+ if (symbol->section != NULL)
+ bfd_fprintf_vma (abfd, file, symbol->value + symbol->section->vma);
else
- {
- bfd_fprintf_vma (abfd, file, symbol->value);
- }
+ bfd_fprintf_vma (abfd, file, symbol->value);
/* This presumes that a symbol can not be both BSF_DEBUGGING and
BSF_DYNAMIC, nor more than one of BSF_FUNCTION, BSF_FILE, and
@@ -495,7 +480,7 @@ DESCRIPTION
information, and will cause problems later on.
.#define bfd_make_empty_symbol(abfd) \
-. BFD_SEND (abfd, _bfd_make_empty_symbol, (abfd))
+. BFD_SEND (abfd, _bfd_make_empty_symbol, (abfd))
.
*/
@@ -514,11 +499,10 @@ DESCRIPTION
*/
asymbol *
-_bfd_generic_make_empty_symbol (abfd)
- bfd *abfd;
+_bfd_generic_make_empty_symbol (bfd *abfd)
{
bfd_size_type amt = sizeof (asymbol);
- asymbol *new = (asymbol *) bfd_zalloc (abfd, amt);
+ asymbol *new = bfd_zalloc (abfd, amt);
if (new)
new->the_bfd = abfd;
return new;
@@ -534,7 +518,7 @@ DESCRIPTION
yet to be worked out.
.#define bfd_make_debug_symbol(abfd,ptr,size) \
-. BFD_SEND (abfd, _bfd_make_debug_symbol, (abfd, ptr, size))
+. BFD_SEND (abfd, _bfd_make_debug_symbol, (abfd, ptr, size))
.
*/
@@ -578,8 +562,7 @@ static const struct section_to_type stt[] =
't' as well as .text */
static char
-coff_section_type (s)
- const char *s;
+coff_section_type (const char *s)
{
const struct section_to_type *t;
@@ -598,8 +581,7 @@ coff_section_type (s)
we could perhaps obsolete coff_section_type. */
static char
-decode_section_type (section)
- const struct sec *section;
+decode_section_type (const struct bfd_section *section)
{
if (section->flags & SEC_CODE)
return 't';
@@ -621,6 +603,8 @@ decode_section_type (section)
}
if (section->flags & SEC_DEBUGGING)
return 'N';
+ if ((section->flags & SEC_HAS_CONTENTS) && (section->flags & SEC_READONLY))
+ return 'n';
return '?';
}
@@ -634,11 +618,10 @@ DESCRIPTION
class of @var{symbol}, or '?' for an unknown class.
SYNOPSIS
- int bfd_decode_symclass(asymbol *symbol);
+ int bfd_decode_symclass (asymbol *symbol);
*/
int
-bfd_decode_symclass (symbol)
- asymbol *symbol;
+bfd_decode_symclass (asymbol *symbol)
{
char c;
@@ -706,14 +689,13 @@ DESCRIPTION
Returns zero otherwise.
SYNOPSIS
- boolean bfd_is_undefined_symclass (int symclass);
+ bfd_boolean bfd_is_undefined_symclass (int symclass);
*/
-boolean
-bfd_is_undefined_symclass (symclass)
- int symclass;
+bfd_boolean
+bfd_is_undefined_symclass (int symclass)
{
- return (boolean) (symclass == 'U' || symclass == 'w' || symclass == 'v');
+ return symclass == 'U' || symclass == 'w' || symclass == 'v';
}
/*
@@ -726,13 +708,11 @@ DESCRIPTION
calling this function.
SYNOPSIS
- void bfd_symbol_info(asymbol *symbol, symbol_info *ret);
+ void bfd_symbol_info (asymbol *symbol, symbol_info *ret);
*/
void
-bfd_symbol_info (symbol, ret)
- asymbol *symbol;
- symbol_info *ret;
+bfd_symbol_info (asymbol *symbol, symbol_info *ret)
{
ret->type = bfd_decode_symclass (symbol);
@@ -749,20 +729,21 @@ FUNCTION
bfd_copy_private_symbol_data
SYNOPSIS
- boolean bfd_copy_private_symbol_data(bfd *ibfd, asymbol *isym, bfd *obfd, asymbol *osym);
+ bfd_boolean bfd_copy_private_symbol_data
+ (bfd *ibfd, asymbol *isym, bfd *obfd, asymbol *osym);
DESCRIPTION
Copy private symbol information from @var{isym} in the BFD
@var{ibfd} to the symbol @var{osym} in the BFD @var{obfd}.
- Return <<true>> on success, <<false>> on error. Possible error
+ Return <<TRUE>> on success, <<FALSE>> on error. Possible error
returns are:
o <<bfd_error_no_memory>> -
Not enough memory exists to create private data for @var{osec}.
.#define bfd_copy_private_symbol_data(ibfd, isymbol, obfd, osymbol) \
-. BFD_SEND (obfd, _bfd_copy_private_symbol_data, \
-. (ibfd, isymbol, obfd, osymbol))
+. BFD_SEND (obfd, _bfd_copy_private_symbol_data, \
+. (ibfd, isymbol, obfd, osymbol))
.
*/
@@ -771,11 +752,10 @@ DESCRIPTION
version. It just uses BFD asymbol structures as mini symbols. */
long
-_bfd_generic_read_minisymbols (abfd, dynamic, minisymsp, sizep)
- bfd *abfd;
- boolean dynamic;
- PTR *minisymsp;
- unsigned int *sizep;
+_bfd_generic_read_minisymbols (bfd *abfd,
+ bfd_boolean dynamic,
+ void **minisymsp,
+ unsigned int *sizep)
{
long storage;
asymbol **syms = NULL;
@@ -790,7 +770,7 @@ _bfd_generic_read_minisymbols (abfd, dynamic, minisymsp, sizep)
if (storage == 0)
return 0;
- syms = (asymbol **) bfd_malloc ((bfd_size_type) storage);
+ syms = bfd_malloc (storage);
if (syms == NULL)
goto error_return;
@@ -801,11 +781,12 @@ _bfd_generic_read_minisymbols (abfd, dynamic, minisymsp, sizep)
if (symcount < 0)
goto error_return;
- *minisymsp = (PTR) syms;
+ *minisymsp = syms;
*sizep = sizeof (asymbol *);
return symcount;
error_return:
+ bfd_set_error (bfd_error_no_symbols);
if (syms != NULL)
free (syms);
return -1;
@@ -815,13 +796,11 @@ _bfd_generic_read_minisymbols (abfd, dynamic, minisymsp, sizep)
an asymbol. We don't worry about the sym argument we are passed;
we just return the asymbol the minisymbol points to. */
-/*ARGSUSED*/
asymbol *
-_bfd_generic_minisymbol_to_symbol (abfd, dynamic, minisym, sym)
- bfd *abfd ATTRIBUTE_UNUSED;
- boolean dynamic ATTRIBUTE_UNUSED;
- const PTR minisym;
- asymbol *sym ATTRIBUTE_UNUSED;
+_bfd_generic_minisymbol_to_symbol (bfd *abfd ATTRIBUTE_UNUSED,
+ bfd_boolean dynamic ATTRIBUTE_UNUSED,
+ const void *minisym,
+ asymbol *sym ATTRIBUTE_UNUSED)
{
return *(asymbol **) minisym;
}
@@ -829,7 +808,7 @@ _bfd_generic_minisymbol_to_symbol (abfd, dynamic, minisym, sym)
/* Look through stabs debugging information in .stab and .stabstr
sections to find the source file and line closest to a desired
location. This is used by COFF and ELF targets. It sets *pfound
- to true if it finds some information. The *pinfo field is used to
+ to TRUE if it finds some information. The *pinfo field is used to
pass cached information in and out of this routine; this first time
the routine is called for a BFD, *pinfo should be NULL. The value
placed in *pinfo should be saved with the BFD, and passed back each
@@ -856,12 +835,10 @@ struct indexentry
/* Compare two indexentry structures. This is called via qsort. */
static int
-cmpindexentry (a, b)
- const PTR a;
- const PTR b;
+cmpindexentry (const void *a, const void *b)
{
- const struct indexentry *contestantA = (const struct indexentry *) a;
- const struct indexentry *contestantB = (const struct indexentry *) b;
+ const struct indexentry *contestantA = a;
+ const struct indexentry *contestantB = b;
if (contestantA->val < contestantB->val)
return -1;
@@ -901,18 +878,16 @@ struct stab_find_info
char *filename;
};
-boolean
-_bfd_stab_section_find_nearest_line (abfd, symbols, section, offset, pfound,
- pfilename, pfnname, pline, pinfo)
- bfd *abfd;
- asymbol **symbols;
- asection *section;
- bfd_vma offset;
- boolean *pfound;
- const char **pfilename;
- const char **pfnname;
- unsigned int *pline;
- PTR *pinfo;
+bfd_boolean
+_bfd_stab_section_find_nearest_line (bfd *abfd,
+ asymbol **symbols,
+ asection *section,
+ bfd_vma offset,
+ bfd_boolean *pfound,
+ const char **pfilename,
+ const char **pfnname,
+ unsigned int *pline,
+ void **pinfo)
{
struct stab_find_info *info;
bfd_size_type stabsize, strsize;
@@ -923,9 +898,9 @@ _bfd_stab_section_find_nearest_line (abfd, symbols, section, offset, pfound,
char *file_name;
char *directory_name;
int saw_fun;
- boolean saw_line, saw_func;
+ bfd_boolean saw_line, saw_func;
- *pfound = false;
+ *pfound = FALSE;
*pfilename = bfd_get_filename (abfd);
*pfnname = NULL;
*pline = 0;
@@ -950,13 +925,13 @@ _bfd_stab_section_find_nearest_line (abfd, symbols, section, offset, pfound,
#define VALOFF (8)
#define STABSIZE (12)
- info = (struct stab_find_info *) *pinfo;
+ info = *pinfo;
if (info != NULL)
{
if (info->stabsec == NULL || info->strsec == NULL)
{
/* No stabs debugging information. */
- return true;
+ return TRUE;
}
stabsize = info->stabsec->_raw_size;
@@ -971,9 +946,9 @@ _bfd_stab_section_find_nearest_line (abfd, symbols, section, offset, pfound,
char *function_name;
bfd_size_type amt = sizeof *info;
- info = (struct stab_find_info *) bfd_zalloc (abfd, amt);
+ info = bfd_zalloc (abfd, amt);
if (info == NULL)
- return false;
+ return FALSE;
/* FIXME: When using the linker --split-by-file or
--split-by-reloc options, it is possible for the .stab and
@@ -986,41 +961,41 @@ _bfd_stab_section_find_nearest_line (abfd, symbols, section, offset, pfound,
{
/* No stabs debugging information. Set *pinfo so that we
can return quickly in the info != NULL case above. */
- *pinfo = (PTR) info;
- return true;
+ *pinfo = info;
+ return TRUE;
}
stabsize = info->stabsec->_raw_size;
strsize = info->strsec->_raw_size;
- info->stabs = (bfd_byte *) bfd_alloc (abfd, stabsize);
- info->strs = (bfd_byte *) bfd_alloc (abfd, strsize);
+ info->stabs = bfd_alloc (abfd, stabsize);
+ info->strs = bfd_alloc (abfd, strsize);
if (info->stabs == NULL || info->strs == NULL)
- return false;
+ return FALSE;
if (! bfd_get_section_contents (abfd, info->stabsec, info->stabs,
(bfd_vma) 0, stabsize)
|| ! bfd_get_section_contents (abfd, info->strsec, info->strs,
(bfd_vma) 0, strsize))
- return false;
+ return FALSE;
- /* If this is a relocateable object file, we have to relocate
+ /* If this is a relocatable object file, we have to relocate
the entries in .stab. This should always be simple 32 bit
relocations against symbols defined in this object file, so
this should be no big deal. */
reloc_size = bfd_get_reloc_upper_bound (abfd, info->stabsec);
if (reloc_size < 0)
- return false;
- reloc_vector = (arelent **) bfd_malloc ((bfd_size_type) reloc_size);
+ return FALSE;
+ reloc_vector = bfd_malloc (reloc_size);
if (reloc_vector == NULL && reloc_size != 0)
- return false;
+ return FALSE;
reloc_count = bfd_canonicalize_reloc (abfd, info->stabsec, reloc_vector,
symbols);
if (reloc_count < 0)
{
if (reloc_vector != NULL)
free (reloc_vector);
- return false;
+ return FALSE;
}
if (reloc_count > 0)
{
@@ -1045,7 +1020,7 @@ _bfd_stab_section_find_nearest_line (abfd, symbols, section, offset, pfound,
bfd_set_error (bfd_error_invalid_operation);
if (reloc_vector != NULL)
free (reloc_vector);
- return false;
+ return FALSE;
}
val = bfd_get_32 (abfd, info->stabs + r->address);
@@ -1099,14 +1074,14 @@ _bfd_stab_section_find_nearest_line (abfd, symbols, section, offset, pfound,
++info->indextablesize;
if (info->indextablesize == 0)
- return true;
+ return TRUE;
++info->indextablesize;
amt = info->indextablesize;
amt *= sizeof (struct indexentry);
- info->indextable = (struct indexentry *) bfd_alloc (abfd, amt);
+ info->indextable = bfd_alloc (abfd, amt);
if (info->indextable == NULL)
- return false;
+ return FALSE;
file_name = NULL;
directory_name = NULL;
@@ -1225,7 +1200,7 @@ _bfd_stab_section_find_nearest_line (abfd, symbols, section, offset, pfound,
qsort (info->indextable, (size_t) i, sizeof (struct indexentry),
cmpindexentry);
- *pinfo = (PTR) info;
+ *pinfo = info;
}
/* We are passed a section relative offset. The offsets in the
@@ -1244,12 +1219,11 @@ _bfd_stab_section_find_nearest_line (abfd, symbols, section, offset, pfound,
else
#endif
{
- /* Cache non-existant or invalid. Do binary search on
- indextable. */
-
long low, high;
long mid = -1;
+ /* Cache non-existent or invalid. Do binary search on
+ indextable. */
indexentry = NULL;
low = 0;
@@ -1271,7 +1245,7 @@ _bfd_stab_section_find_nearest_line (abfd, symbols, section, offset, pfound,
}
if (indexentry == NULL)
- return true;
+ return TRUE;
stab = indexentry->stab + STABSIZE;
file_name = indexentry->file_name;
@@ -1280,14 +1254,14 @@ _bfd_stab_section_find_nearest_line (abfd, symbols, section, offset, pfound,
directory_name = indexentry->directory_name;
str = indexentry->str;
- saw_line = false;
- saw_func = false;
+ saw_line = FALSE;
+ saw_func = FALSE;
for (; stab < (indexentry+1)->stab; stab += STABSIZE)
{
- boolean done;
+ bfd_boolean done;
bfd_vma val;
- done = false;
+ done = FALSE;
switch (stab[TYPEOFF])
{
@@ -1304,9 +1278,11 @@ _bfd_stab_section_find_nearest_line (abfd, symbols, section, offset, pfound,
case N_SLINE:
case N_DSLINE:
case N_BSLINE:
- /* A line number. The value is relative to the start of the
- current function. */
- val = indexentry->val + bfd_get_32 (abfd, stab + VALOFF);
+ /* A line number. If the function was specified, then the value
+ is relative to the start of the function. Otherwise, the
+ value is an absolute address. */
+ val = ((indexentry->function_name ? indexentry->val : 0)
+ + bfd_get_32 (abfd, stab + VALOFF));
/* If this line starts before our desired offset, or if it's
the first line we've been able to find, use it. The
!saw_line check works around a bug in GCC 2.95.3, which emits
@@ -1323,15 +1299,15 @@ _bfd_stab_section_find_nearest_line (abfd, symbols, section, offset, pfound,
#endif
}
if (val > offset)
- done = true;
- saw_line = true;
+ done = TRUE;
+ saw_line = TRUE;
break;
case N_FUN:
case N_SO:
if (saw_func || saw_line)
- done = true;
- saw_func = true;
+ done = TRUE;
+ saw_func = TRUE;
break;
}
@@ -1339,7 +1315,7 @@ _bfd_stab_section_find_nearest_line (abfd, symbols, section, offset, pfound,
break;
}
- *pfound = true;
+ *pfound = TRUE;
if (file_name == NULL || IS_ABSOLUTE_PATH (file_name)
|| directory_name == NULL)
@@ -1358,9 +1334,9 @@ _bfd_stab_section_find_nearest_line (abfd, symbols, section, offset, pfound,
if (info->filename != NULL)
free (info->filename);
len = strlen (file_name) + 1;
- info->filename = (char *) bfd_malloc ((bfd_size_type) dirlen + len);
+ info->filename = bfd_malloc (dirlen + len);
if (info->filename == NULL)
- return false;
+ return FALSE;
memcpy (info->filename, directory_name, dirlen);
memcpy (info->filename + dirlen, file_name, len);
}
@@ -1375,7 +1351,6 @@ _bfd_stab_section_find_nearest_line (abfd, symbols, section, offset, pfound,
/* This will typically be something like main:F(0,1), so we want
to clobber the colon. It's OK to change the name, since the
string is in our own local storage anyhow. */
-
s = strchr (indexentry->function_name, ':');
if (s != NULL)
*s = '\0';
@@ -1383,5 +1358,5 @@ _bfd_stab_section_find_nearest_line (abfd, symbols, section, offset, pfound,
*pfnname = indexentry->function_name;
}
- return true;
+ return TRUE;
}
diff --git a/contrib/binutils/bfd/sysdep.h b/contrib/binutils/bfd/sysdep.h
index 1338d6b..1954470 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
+ Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001
Free Software Foundation, Inc.
Written by Cygnus Support.
diff --git a/contrib/binutils/bfd/targets.c b/contrib/binutils/bfd/targets.c
index 2d0ec04..cec339c 100644
--- a/contrib/binutils/bfd/targets.c
+++ b/contrib/binutils/bfd/targets.c
@@ -1,24 +1,24 @@
/* Generic target-file-type support for the BFD library.
Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
- 2000, 2001, 2002
+ 2000, 2001, 2002, 2003, 2004
Free Software Foundation, Inc.
Written by Cygnus Support.
-This file is part of BFD, the Binary File Descriptor library.
+ This 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "bfd.h"
#include "sysdep.h"
@@ -30,7 +30,7 @@ SECTION
Targets
DESCRIPTION
- Each port of BFD to a different machine requries the creation
+ 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
@@ -70,7 +70,7 @@ DESCRIPTION
<<bfd_check_format>> on the BFD with a suggested format.
If <<target_defaulted>> has been set, each possible target
type is tried to see if it recognizes the specified format.
- <<bfd_check_format>> returns <<true>> when the caller guesses right.
+ <<bfd_check_format>> returns <<TRUE>> when the caller guesses right.
@menu
@* bfd_target::
@end menu
@@ -103,7 +103,7 @@ DESCRIPTION
someone wants to fix this and not break the above, please do.
.#define BFD_SEND(bfd, message, arglist) \
-. ((*((bfd)->xvec->message)) arglist)
+. ((*((bfd)->xvec->message)) arglist)
.
.#ifdef DEBUG_BFD_SEND
.#undef BFD_SEND
@@ -116,7 +116,7 @@ DESCRIPTION
For operations which index on the BFD format:
.#define BFD_SEND_FMT(bfd, message, arglist) \
-. (((bfd)->xvec->message[(int) ((bfd)->format)]) arglist)
+. (((bfd)->xvec->message[(int) ((bfd)->format)]) arglist)
.
.#ifdef DEBUG_BFD_SEND
.#undef BFD_SEND_FMT
@@ -155,7 +155,11 @@ DESCRIPTION
. bfd_target_msdos_flavour,
. bfd_target_ovax_flavour,
. bfd_target_evax_flavour,
-. bfd_target_mmo_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 };
@@ -199,262 +203,266 @@ DESCRIPTION
. {* 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_vma (*bfd_getx64) PARAMS ((const bfd_byte *));
-. bfd_signed_vma (*bfd_getx_signed_64) PARAMS ((const bfd_byte *));
-. void (*bfd_putx64) PARAMS ((bfd_vma, bfd_byte *));
-. bfd_vma (*bfd_getx32) PARAMS ((const bfd_byte *));
-. bfd_signed_vma (*bfd_getx_signed_32) PARAMS ((const bfd_byte *));
-. void (*bfd_putx32) PARAMS ((bfd_vma, bfd_byte *));
-. bfd_vma (*bfd_getx16) PARAMS ((const bfd_byte *));
-. bfd_signed_vma (*bfd_getx_signed_16) PARAMS ((const bfd_byte *));
-. void (*bfd_putx16) PARAMS ((bfd_vma, bfd_byte *));
+. 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_vma (*bfd_h_getx64) PARAMS ((const bfd_byte *));
-. bfd_signed_vma (*bfd_h_getx_signed_64) PARAMS ((const bfd_byte *));
-. void (*bfd_h_putx64) PARAMS ((bfd_vma, bfd_byte *));
-. bfd_vma (*bfd_h_getx32) PARAMS ((const bfd_byte *));
-. bfd_signed_vma (*bfd_h_getx_signed_32) PARAMS ((const bfd_byte *));
-. void (*bfd_h_putx32) PARAMS ((bfd_vma, bfd_byte *));
-. bfd_vma (*bfd_h_getx16) PARAMS ((const bfd_byte *));
-. bfd_signed_vma (*bfd_h_getx_signed_16) PARAMS ((const bfd_byte *));
-. void (*bfd_h_putx16) PARAMS ((bfd_vma, bfd_byte *));
+. bfd_uint64_t (*bfd_h_getx64) (const void *);
+. bfd_int64_t (*bfd_h_getx_signed_64) (const void *);
+. void (*bfd_h_putx64) (bfd_uint64_t, void *);
+. bfd_vma (*bfd_h_getx32) (const void *);
+. bfd_signed_vma (*bfd_h_getx_signed_32) (const void *);
+. void (*bfd_h_putx32) (bfd_vma, void *);
+. bfd_vma (*bfd_h_getx16) (const void *);
+. bfd_signed_vma (*bfd_h_getx_signed_16) (const void *);
+. void (*bfd_h_putx16) (bfd_vma, void *);
.
. {* Format dependent routines: these are vectors of entry points
. within the target vector structure, one for each format to check. *}
.
. {* Check the format of a file being read. Return a <<bfd_target *>> or zero. *}
-. const struct bfd_target *(*_bfd_check_format[bfd_type_end]) PARAMS ((bfd *));
+. const struct bfd_target *(*_bfd_check_format[bfd_type_end]) (bfd *);
.
. {* Set the format of a file being written. *}
-. boolean (*_bfd_set_format[bfd_type_end]) PARAMS ((bfd *));
+. bfd_boolean (*_bfd_set_format[bfd_type_end]) (bfd *);
.
. {* Write cached information into a file being written, at <<bfd_close>>. *}
-. boolean (*_bfd_write_contents[bfd_type_end]) PARAMS ((bfd *));
+. bfd_boolean (*_bfd_write_contents[bfd_type_end]) (bfd *);
.
The general target vector. These vectors are initialized using the
BFD_JUMP_TABLE macros.
.
. {* Generic entry points. *}
-Do not "beautify" the CONCAT* macro args. Traditional C will not
-remove whitespace added here, and thus will fail to concatenate
-the tokens.
.#define BFD_JUMP_TABLE_GENERIC(NAME) \
-.CONCAT2 (NAME,_close_and_cleanup), \
-.CONCAT2 (NAME,_bfd_free_cached_info), \
-.CONCAT2 (NAME,_new_section_hook), \
-.CONCAT2 (NAME,_get_section_contents), \
-.CONCAT2 (NAME,_get_section_contents_in_window)
+. 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. *}
-. boolean (*_close_and_cleanup) PARAMS ((bfd *));
+. bfd_boolean (*_close_and_cleanup) (bfd *);
. {* Ask the BFD to free all cached information. *}
-. boolean (*_bfd_free_cached_info) PARAMS ((bfd *));
+. bfd_boolean (*_bfd_free_cached_info) (bfd *);
. {* Called when a new section is created. *}
-. boolean (*_new_section_hook) PARAMS ((bfd *, sec_ptr));
+. bfd_boolean (*_new_section_hook) (bfd *, sec_ptr);
. {* Read the contents of a section. *}
-. boolean (*_bfd_get_section_contents) PARAMS ((bfd *, sec_ptr, PTR,
-. file_ptr, bfd_size_type));
-. boolean (*_bfd_get_section_contents_in_window)
-. PARAMS ((bfd *, sec_ptr, bfd_window *, file_ptr, bfd_size_type));
+. 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) \
-.CONCAT2 (NAME,_bfd_copy_private_bfd_data), \
-.CONCAT2 (NAME,_bfd_merge_private_bfd_data), \
-.CONCAT2 (NAME,_bfd_copy_private_section_data), \
-.CONCAT2 (NAME,_bfd_copy_private_symbol_data), \
-.CONCAT2 (NAME,_bfd_set_private_flags), \
-.CONCAT2 (NAME,_bfd_print_private_bfd_data) \
+. 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. *}
-. boolean (*_bfd_copy_private_bfd_data) PARAMS ((bfd *, bfd *));
+. 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. *}
-. boolean (*_bfd_merge_private_bfd_data) PARAMS ((bfd *, bfd *));
+. bfd_boolean (*_bfd_merge_private_bfd_data) (bfd *, bfd *);
. {* Called to copy BFD private section data from one object file
. to another. *}
-. boolean (*_bfd_copy_private_section_data) PARAMS ((bfd *, sec_ptr,
-. bfd *, sec_ptr));
+. 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. *}
-. boolean (*_bfd_copy_private_symbol_data) PARAMS ((bfd *, asymbol *,
-. bfd *, asymbol *));
+. bfd_boolean (*_bfd_copy_private_symbol_data)
+. (bfd *, asymbol *, bfd *, asymbol *);
. {* Called to set private backend flags. *}
-. boolean (*_bfd_set_private_flags) PARAMS ((bfd *, flagword));
+. bfd_boolean (*_bfd_set_private_flags) (bfd *, flagword);
.
. {* Called to print private BFD data. *}
-. boolean (*_bfd_print_private_bfd_data) PARAMS ((bfd *, PTR));
+. bfd_boolean (*_bfd_print_private_bfd_data) (bfd *, void *);
.
. {* Core file entry points. *}
.#define BFD_JUMP_TABLE_CORE(NAME) \
-.CONCAT2 (NAME,_core_file_failing_command), \
-.CONCAT2 (NAME,_core_file_failing_signal), \
-.CONCAT2 (NAME,_core_file_matches_executable_p)
-. char * (*_core_file_failing_command) PARAMS ((bfd *));
-. int (*_core_file_failing_signal) PARAMS ((bfd *));
-. boolean (*_core_file_matches_executable_p) PARAMS ((bfd *, bfd *));
+. 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) \
-.CONCAT2 (NAME,_slurp_armap), \
-.CONCAT2 (NAME,_slurp_extended_name_table), \
-.CONCAT2 (NAME,_construct_extended_name_table), \
-.CONCAT2 (NAME,_truncate_arname), \
-.CONCAT2 (NAME,_write_armap), \
-.CONCAT2 (NAME,_read_ar_hdr), \
-.CONCAT2 (NAME,_openr_next_archived_file), \
-.CONCAT2 (NAME,_get_elt_at_index), \
-.CONCAT2 (NAME,_generic_stat_arch_elt), \
-.CONCAT2 (NAME,_update_armap_timestamp)
-. boolean (*_bfd_slurp_armap) PARAMS ((bfd *));
-. boolean (*_bfd_slurp_extended_name_table) PARAMS ((bfd *));
-. boolean (*_bfd_construct_extended_name_table)
-. PARAMS ((bfd *, char **, bfd_size_type *, const char **));
-. void (*_bfd_truncate_arname) PARAMS ((bfd *, const char *, char *));
-. boolean (*write_armap)
-. PARAMS ((bfd *, unsigned int, struct orl *, unsigned int, int));
-. PTR (*_bfd_read_ar_hdr_fn) PARAMS ((bfd *));
-. bfd * (*openr_next_archived_file) PARAMS ((bfd *, bfd *));
-.#define bfd_get_elt_at_index(b,i) BFD_SEND(b, _bfd_get_elt_at_index, (b,i))
-. bfd * (*_bfd_get_elt_at_index) PARAMS ((bfd *, symindex));
-. int (*_bfd_stat_arch_elt) PARAMS ((bfd *, struct stat *));
-. boolean (*_bfd_update_armap_timestamp) PARAMS ((bfd *));
+. 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) \
-.CONCAT2 (NAME,_get_symtab_upper_bound), \
-.CONCAT2 (NAME,_get_symtab), \
-.CONCAT2 (NAME,_make_empty_symbol), \
-.CONCAT2 (NAME,_print_symbol), \
-.CONCAT2 (NAME,_get_symbol_info), \
-.CONCAT2 (NAME,_bfd_is_local_label_name), \
-.CONCAT2 (NAME,_get_lineno), \
-.CONCAT2 (NAME,_find_nearest_line), \
-.CONCAT2 (NAME,_bfd_make_debug_symbol), \
-.CONCAT2 (NAME,_read_minisymbols), \
-.CONCAT2 (NAME,_minisymbol_to_symbol)
-. long (*_bfd_get_symtab_upper_bound) PARAMS ((bfd *));
-. long (*_bfd_canonicalize_symtab) PARAMS ((bfd *,
-. struct symbol_cache_entry **));
-. struct symbol_cache_entry *
-. (*_bfd_make_empty_symbol) PARAMS ((bfd *));
-. void (*_bfd_print_symbol) PARAMS ((bfd *, PTR,
-. struct symbol_cache_entry *,
-. bfd_print_symbol_type));
-.#define bfd_print_symbol(b,p,s,e) BFD_SEND(b, _bfd_print_symbol, (b,p,s,e))
-. void (*_bfd_get_symbol_info) PARAMS ((bfd *,
-. struct symbol_cache_entry *,
-. symbol_info *));
-.#define bfd_get_symbol_info(b,p,e) BFD_SEND(b, _bfd_get_symbol_info, (b,p,e))
-. boolean (*_bfd_is_local_label_name) PARAMS ((bfd *, const char *));
+. 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
.
-. alent * (*_get_lineno) PARAMS ((bfd *, struct symbol_cache_entry *));
-. boolean (*_bfd_find_nearest_line)
-. PARAMS ((bfd *, struct sec *, struct symbol_cache_entry **, bfd_vma,
-. const char **, const char **, unsigned int *));
+. 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) PARAMS ((bfd *, void *,
-. unsigned long size));
+. 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) PARAMS ((bfd *, boolean, PTR *,
-. unsigned int *));
+. 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) PARAMS ((bfd *, boolean, const PTR,
-. asymbol *));
+. asymbol * (*_minisymbol_to_symbol)
+. (bfd *, bfd_boolean, const void *, asymbol *);
.
. {* Routines for relocs. *}
.#define BFD_JUMP_TABLE_RELOCS(NAME) \
-.CONCAT2 (NAME,_get_reloc_upper_bound), \
-.CONCAT2 (NAME,_canonicalize_reloc), \
-.CONCAT2 (NAME,_bfd_reloc_type_lookup)
-. long (*_get_reloc_upper_bound) PARAMS ((bfd *, sec_ptr));
-. long (*_bfd_canonicalize_reloc) PARAMS ((bfd *, sec_ptr, arelent **,
-. struct symbol_cache_entry **));
+. 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) PARAMS ((bfd *, bfd_reloc_code_real_type));
+. (*reloc_type_lookup) (bfd *, bfd_reloc_code_real_type);
.
. {* Routines used when writing an object file. *}
.#define BFD_JUMP_TABLE_WRITE(NAME) \
-.CONCAT2 (NAME,_set_arch_mach), \
-.CONCAT2 (NAME,_set_section_contents)
-. boolean (*_bfd_set_arch_mach) PARAMS ((bfd *, enum bfd_architecture,
-. unsigned long));
-. boolean (*_bfd_set_section_contents) PARAMS ((bfd *, sec_ptr, PTR,
-. file_ptr, bfd_size_type));
+. 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) \
-.CONCAT2 (NAME,_sizeof_headers), \
-.CONCAT2 (NAME,_bfd_get_relocated_section_contents), \
-.CONCAT2 (NAME,_bfd_relax_section), \
-.CONCAT2 (NAME,_bfd_link_hash_table_create), \
-.CONCAT2 (NAME,_bfd_link_hash_table_free), \
-.CONCAT2 (NAME,_bfd_link_add_symbols), \
-.CONCAT2 (NAME,_bfd_link_just_syms), \
-.CONCAT2 (NAME,_bfd_final_link), \
-.CONCAT2 (NAME,_bfd_link_split_section), \
-.CONCAT2 (NAME,_bfd_gc_sections), \
-.CONCAT2 (NAME,_bfd_merge_sections), \
-.CONCAT2 (NAME,_bfd_discard_group)
-. int (*_bfd_sizeof_headers) PARAMS ((bfd *, boolean));
-. bfd_byte *(*_bfd_get_relocated_section_contents)
-. PARAMS ((bfd *, struct bfd_link_info *, struct bfd_link_order *,
-. bfd_byte *, boolean, struct symbol_cache_entry **));
+. 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 **);
.
-. boolean (*_bfd_relax_section)
-. PARAMS ((bfd *, struct sec *, struct bfd_link_info *, boolean *));
+. 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) PARAMS ((bfd *));
+. 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) PARAMS ((struct bfd_link_hash_table *));
+. void (*_bfd_link_hash_table_free) (struct bfd_link_hash_table *);
.
. {* Add symbols from this object file into the hash table. *}
-. boolean (*_bfd_link_add_symbols) PARAMS ((bfd *, struct bfd_link_info *));
+. 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) PARAMS ((asection *, struct bfd_link_info *));
+. 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. *}
-. boolean (*_bfd_final_link) PARAMS ((bfd *, struct bfd_link_info *));
+. bfd_boolean (*_bfd_final_link) (bfd *, struct bfd_link_info *);
.
. {* Should this section be split up into smaller pieces during linking. *}
-. boolean (*_bfd_link_split_section) PARAMS ((bfd *, struct sec *));
+. bfd_boolean (*_bfd_link_split_section) (bfd *, struct bfd_section *);
.
. {* Remove sections that are not referenced from the output. *}
-. boolean (*_bfd_gc_sections) PARAMS ((bfd *, struct bfd_link_info *));
+. bfd_boolean (*_bfd_gc_sections) (bfd *, struct bfd_link_info *);
.
. {* Attempt to merge SEC_MERGE sections. *}
-. boolean (*_bfd_merge_sections) PARAMS ((bfd *, struct bfd_link_info *));
+. bfd_boolean (*_bfd_merge_sections) (bfd *, struct bfd_link_info *);
.
. {* Discard members of a group. *}
-. boolean (*_bfd_discard_group) PARAMS ((bfd *, struct sec *));
+. bfd_boolean (*_bfd_discard_group) (bfd *, struct bfd_section *);
.
. {* Routines to handle dynamic symbols and relocs. *}
.#define BFD_JUMP_TABLE_DYNAMIC(NAME) \
-.CONCAT2 (NAME,_get_dynamic_symtab_upper_bound), \
-.CONCAT2 (NAME,_canonicalize_dynamic_symtab), \
-.CONCAT2 (NAME,_get_dynamic_reloc_upper_bound), \
-.CONCAT2 (NAME,_canonicalize_dynamic_reloc)
+. 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) PARAMS ((bfd *));
+. long (*_bfd_get_dynamic_symtab_upper_bound) (bfd *);
. {* Read in the dynamic symbols. *}
-. long (*_bfd_canonicalize_dynamic_symtab)
-. PARAMS ((bfd *, struct symbol_cache_entry **));
+. 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) PARAMS ((bfd *));
+. long (*_bfd_get_dynamic_reloc_upper_bound) (bfd *);
. {* Read in the dynamic relocs. *}
-. long (*_bfd_canonicalize_dynamic_reloc)
-. PARAMS ((bfd *, arelent **, struct symbol_cache_entry **));
+. long (*_bfd_canonicalize_dynamic_reloc)
+. (bfd *, arelent **, struct bfd_symbol **);
.
A pointer to an alternative bfd_target in case the current one is not
@@ -469,7 +477,7 @@ to find an alternative output format that is suitable.
. {* Data for use by back-end routines, which isn't
. generic enough to belong in this structure. *}
-. PTR backend_data;
+. const void *backend_data;
.
.} bfd_target;
.
@@ -515,6 +523,7 @@ extern const bfd_target bfd_elf32_d30v_vec;
extern const bfd_target bfd_elf32_dlx_big_vec;
extern const bfd_target bfd_elf32_fr30_vec;
extern const bfd_target bfd_elf32_frv_vec;
+extern const bfd_target bfd_elf32_frvfdpic_vec;
extern const bfd_target bfd_elf32_h8300_vec;
extern const bfd_target bfd_elf32_hppa_linux_vec;
extern const bfd_target bfd_elf32_hppa_vec;
@@ -526,12 +535,17 @@ extern const bfd_target bfd_elf32_i860_vec;
extern const bfd_target bfd_elf32_i960_vec;
extern const bfd_target bfd_elf32_ia64_big_vec;
extern const bfd_target bfd_elf32_ia64_hpux_big_vec;
+extern const bfd_target bfd_elf32_ip2k_vec;
+extern const bfd_target bfd_elf32_iq2000_vec;
extern const bfd_target bfd_elf32_little_generic_vec;
extern const bfd_target bfd_elf32_littlearc_vec;
extern const bfd_target bfd_elf32_littlearm_oabi_vec;
extern const bfd_target bfd_elf32_littlearm_vec;
extern const bfd_target bfd_elf32_littlemips_vec;
extern const bfd_target bfd_elf32_m32r_vec;
+extern const bfd_target bfd_elf32_m32rle_vec;
+extern const bfd_target bfd_elf32_m32rlin_vec;
+extern const bfd_target bfd_elf32_m32rlelin_vec;
extern const bfd_target bfd_elf32_m68hc11_vec;
extern const bfd_target bfd_elf32_m68hc12_vec;
extern const bfd_target bfd_elf32_m68k_vec;
@@ -540,6 +554,11 @@ extern const bfd_target bfd_elf32_mcore_big_vec;
extern const bfd_target bfd_elf32_mcore_little_vec;
extern const bfd_target bfd_elf32_mn10200_vec;
extern const bfd_target bfd_elf32_mn10300_vec;
+extern const bfd_target bfd_elf32_msp430_vec;
+extern const bfd_target bfd_elf32_nbigmips_vec;
+extern const bfd_target bfd_elf32_nlittlemips_vec;
+extern const bfd_target bfd_elf32_ntradbigmips_vec;
+extern const bfd_target bfd_elf32_ntradlittlemips_vec;
extern const bfd_target bfd_elf32_openrisc_vec;
extern const bfd_target bfd_elf32_or32_big_vec;
extern const bfd_target bfd_elf32_pj_vec;
@@ -549,6 +568,8 @@ extern const bfd_target bfd_elf32_powerpcle_vec;
extern const bfd_target bfd_elf32_s390_vec;
extern const bfd_target bfd_elf32_sh64_vec;
extern const bfd_target bfd_elf32_sh64l_vec;
+extern const bfd_target bfd_elf32_sh64lin_vec;
+extern const bfd_target bfd_elf32_sh64blin_vec;
extern const bfd_target bfd_elf32_sh64lnbsd_vec;
extern const bfd_target bfd_elf32_sh64nbsd_vec;
extern const bfd_target bfd_elf32_sh_vec;
@@ -564,14 +585,14 @@ extern const bfd_target bfd_elf32_us_cris_vec;
extern const bfd_target bfd_elf32_v850_vec;
extern const bfd_target bfd_elf32_vax_vec;
extern const bfd_target bfd_elf32_xstormy16_vec;
+extern const bfd_target bfd_elf32_xtensa_be_vec;
+extern const bfd_target bfd_elf32_xtensa_le_vec;
extern const bfd_target bfd_elf64_alpha_freebsd_vec;
extern const bfd_target bfd_elf64_alpha_vec;
extern const bfd_target bfd_elf64_big_generic_vec;
extern const bfd_target bfd_elf64_bigmips_vec;
extern const bfd_target bfd_elf64_hppa_linux_vec;
extern const bfd_target bfd_elf64_hppa_vec;
-extern const bfd_target bfd_elf64_ia64_aix_big_vec;
-extern const bfd_target bfd_elf64_ia64_aix_little_vec;
extern const bfd_target bfd_elf64_ia64_big_vec;
extern const bfd_target bfd_elf64_ia64_hpux_big_vec;
extern const bfd_target bfd_elf64_ia64_little_vec;
@@ -583,6 +604,8 @@ extern const bfd_target bfd_elf64_powerpcle_vec;
extern const bfd_target bfd_elf64_s390_vec;
extern const bfd_target bfd_elf64_sh64_vec;
extern const bfd_target bfd_elf64_sh64l_vec;
+extern const bfd_target bfd_elf64_sh64lin_vec;
+extern const bfd_target bfd_elf64_sh64blin_vec;
extern const bfd_target bfd_elf64_sh64lnbsd_vec;
extern const bfd_target bfd_elf64_sh64nbsd_vec;
extern const bfd_target bfd_elf64_sparc_vec;
@@ -636,6 +659,9 @@ extern const bfd_target m68knetbsd_vec;
extern const bfd_target m68ksysvcoff_vec;
extern const bfd_target m88kbcs_vec;
extern const bfd_target m88kmach3_vec;
+extern const bfd_target mach_o_be_vec;
+extern const bfd_target mach_o_le_vec;
+extern const bfd_target mach_o_fat_vec;
extern const bfd_target mcore_pe_big_vec;
extern const bfd_target mcore_pe_little_vec;
extern const bfd_target mcore_pei_big_vec;
@@ -652,6 +678,8 @@ extern const bfd_target or32coff_big_vec;
extern const bfd_target pc532machaout_vec;
extern const bfd_target pc532netbsd_vec;
extern const bfd_target pdp11_aout_vec;
+extern const bfd_target pef_vec;
+extern const bfd_target pef_xlib_vec;
extern const bfd_target pmac_xcoff_vec;
extern const bfd_target ppcboot_vec;
extern const bfd_target riscix_vec;
@@ -671,8 +699,15 @@ extern const bfd_target sparclynx_aout_vec;
extern const bfd_target sparclynx_coff_vec;
extern const bfd_target sparcnetbsd_vec;
extern const bfd_target sunos_big_vec;
+extern const bfd_target sym_vec;
extern const bfd_target tic30_aout_vec;
extern const bfd_target tic30_coff_vec;
+extern const bfd_target tic4x_coff0_beh_vec;
+extern const bfd_target tic4x_coff0_vec;
+extern const bfd_target tic4x_coff1_beh_vec;
+extern const bfd_target tic4x_coff1_vec;
+extern const bfd_target tic4x_coff2_beh_vec;
+extern const bfd_target tic4x_coff2_vec;
extern const bfd_target tic54x_coff0_beh_vec;
extern const bfd_target tic54x_coff0_vec;
extern const bfd_target tic54x_coff1_beh_vec;
@@ -710,6 +745,7 @@ extern const bfd_target ptrace_core_vec;
extern const bfd_target sco5_core_vec;
extern const bfd_target trad_core_vec;
+extern const bfd_target bfd_elf32_am33lin_vec;
static const bfd_target * const _bfd_target_vector[] = {
#ifdef SELECT_VECS
@@ -734,7 +770,7 @@ static const bfd_target * const _bfd_target_vector[] = {
#endif
&aout0_big_vec,
#if 0
- /* We have no way of distinguishing these from other a.out variants */
+ /* We have no way of distinguishing these from other a.out variants. */
&aout_arm_big_vec,
&aout_arm_little_vec,
/* No one seems to use this. */
@@ -778,6 +814,7 @@ static const bfd_target * const _bfd_target_vector[] = {
&bfd_elf32_dlx_big_vec,
&bfd_elf32_fr30_vec,
&bfd_elf32_frv_vec,
+ &bfd_elf32_frvfdpic_vec,
&bfd_elf32_h8300_vec,
&bfd_elf32_hppa_linux_vec,
&bfd_elf32_hppa_vec,
@@ -791,12 +828,17 @@ static const bfd_target * const _bfd_target_vector[] = {
&bfd_elf32_ia64_big_vec,
#endif
&bfd_elf32_ia64_hpux_big_vec,
+ &bfd_elf32_ip2k_vec,
+ &bfd_elf32_iq2000_vec,
&bfd_elf32_little_generic_vec,
&bfd_elf32_littlearc_vec,
&bfd_elf32_littlearm_oabi_vec,
&bfd_elf32_littlearm_vec,
&bfd_elf32_littlemips_vec,
&bfd_elf32_m32r_vec,
+ &bfd_elf32_m32rle_vec,
+ &bfd_elf32_m32rlin_vec,
+ &bfd_elf32_m32rlelin_vec,
&bfd_elf32_m68hc11_vec,
&bfd_elf32_m68hc12_vec,
&bfd_elf32_m68k_vec,
@@ -805,6 +847,13 @@ static const bfd_target * const _bfd_target_vector[] = {
&bfd_elf32_mcore_little_vec,
&bfd_elf32_mn10200_vec,
&bfd_elf32_mn10300_vec,
+ &bfd_elf32_msp430_vec,
+#ifdef BFD64
+ &bfd_elf32_nbigmips_vec,
+ &bfd_elf32_nlittlemips_vec,
+ &bfd_elf32_ntradbigmips_vec,
+ &bfd_elf32_ntradlittlemips_vec,
+#endif
&bfd_elf32_openrisc_vec,
&bfd_elf32_or32_big_vec,
&bfd_elf32_pj_vec,
@@ -823,6 +872,8 @@ static const bfd_target * const _bfd_target_vector[] = {
&bfd_elf32_sh64l_vec,
&bfd_elf32_sh64lnbsd_vec,
&bfd_elf32_sh64nbsd_vec,
+ &bfd_elf32_sh64lin_vec,
+ &bfd_elf32_sh64blin_vec,
#endif
&bfd_elf32_sparc_vec,
&bfd_elf32_tradbigmips_vec,
@@ -831,6 +882,8 @@ static const bfd_target * const _bfd_target_vector[] = {
&bfd_elf32_v850_vec,
&bfd_elf32_vax_vec,
&bfd_elf32_xstormy16_vec,
+ &bfd_elf32_xtensa_be_vec,
+ &bfd_elf32_xtensa_le_vec,
#ifdef BFD64
&bfd_elf64_alpha_freebsd_vec,
&bfd_elf64_alpha_vec,
@@ -838,8 +891,6 @@ static const bfd_target * const _bfd_target_vector[] = {
&bfd_elf64_bigmips_vec,
&bfd_elf64_hppa_linux_vec,
&bfd_elf64_hppa_vec,
- &bfd_elf64_ia64_aix_big_vec,
- &bfd_elf64_ia64_aix_little_vec,
&bfd_elf64_ia64_big_vec,
&bfd_elf64_ia64_hpux_big_vec,
&bfd_elf64_ia64_little_vec,
@@ -853,9 +904,9 @@ static const bfd_target * const _bfd_target_vector[] = {
&bfd_elf64_sh64l_vec,
&bfd_elf64_sh64lnbsd_vec,
&bfd_elf64_sh64nbsd_vec,
-#if 0
+ &bfd_elf64_sh64lin_vec,
+ &bfd_elf64_sh64blin_vec,
&bfd_elf64_sparc_vec,
-#endif
&bfd_elf64_tradbigmips_vec,
&bfd_elf64_tradlittlemips_vec,
&bfd_elf64_x86_64_vec,
@@ -867,7 +918,7 @@ static const bfd_target * const _bfd_target_vector[] = {
&bfd_powerpcle_pei_vec,
&cris_aout_vec,
#ifdef BFD64
- &demo_64_vec, /* Only compiled if host has long-long support */
+ &demo_64_vec, /* Only compiled if host has long-long support. */
#endif
&ecoff_big_vec,
&ecoff_biglittle_vec,
@@ -931,6 +982,9 @@ static const bfd_target * const _bfd_target_vector[] = {
&m68ksysvcoff_vec,
&m88kbcs_vec,
&m88kmach3_vec,
+ &mach_o_be_vec,
+ &mach_o_le_vec,
+ &mach_o_fat_vec,
&mcore_pe_big_vec,
&mcore_pe_little_vec,
&mcore_pei_big_vec,
@@ -958,13 +1012,15 @@ static const bfd_target * const _bfd_target_vector[] = {
&pc532machaout_vec,
&pc532netbsd_vec,
&pdp11_aout_vec,
+ &pef_vec,
+ &pef_xlib_vec,
#if 0
/* This has the same magic number as RS/6000. */
&pmac_xcoff_vec,
#endif
&ppcboot_vec,
#if 0
- /* We have no way of distinguishing these from other a.out variants */
+ /* We have no way of distinguishing these from other a.out variants. */
&riscix_vec,
#endif
#ifdef BFD64
@@ -987,6 +1043,7 @@ static const bfd_target * const _bfd_target_vector[] = {
&sparclynx_coff_vec,
&sparcnetbsd_vec,
&sunos_big_vec,
+ &sym_vec,
&tic30_aout_vec,
&tic30_coff_vec,
&tic54x_coff0_beh_vec,
@@ -1007,6 +1064,7 @@ static const bfd_target * const _bfd_target_vector[] = {
&w65_vec,
&we32kcoff_vec,
&z8kcoff_vec,
+ &bfd_elf32_am33lin_vec,
#endif /* not SELECT_VECS */
/* Always support S-records, for convenience. */
@@ -1070,6 +1128,17 @@ const bfd_target *bfd_default_vector[] = {
NULL
};
+/* bfd_associated_vector[] contains the associated target vectors used
+ to reduce the ambiguity in bfd_check_format_matches. */
+
+static const bfd_target *_bfd_associated_vector[] = {
+#ifdef ASSOCIATED_VECS
+ ASSOCIATED_VECS,
+#endif
+ NULL
+};
+const bfd_target * const *bfd_associated_vector = _bfd_associated_vector;
+
/* When there is an ambiguous match, bfd_check_format_matches puts the
names of the matching targets in an array. This variable is the maximum
number of entries that the array could possibly need. */
@@ -1093,13 +1162,10 @@ static const struct targmatch bfd_target_match[] = {
{ NULL, NULL }
};
-static const bfd_target *find_target PARAMS ((const char *));
-
/* Find a target vector, given a name or configuration triplet. */
static const bfd_target *
-find_target (name)
- const char *name;
+find_target (const char *name)
{
const bfd_target * const *target;
const struct targmatch *match;
@@ -1131,7 +1197,7 @@ FUNCTION
bfd_set_default_target
SYNOPSIS
- boolean bfd_set_default_target (const char *name);
+ bfd_boolean bfd_set_default_target (const char *name);
DESCRIPTION
Set the default target vector to use when recognizing a BFD.
@@ -1139,22 +1205,21 @@ DESCRIPTION
name or a configuration triplet.
*/
-boolean
-bfd_set_default_target (name)
- const char *name;
+bfd_boolean
+bfd_set_default_target (const char *name)
{
const bfd_target *target;
if (bfd_default_vector[0] != NULL
&& strcmp (name, bfd_default_vector[0]->name) == 0)
- return true;
+ return TRUE;
target = find_target (name);
if (target == NULL)
- return false;
+ return FALSE;
bfd_default_vector[0] = target;
- return true;
+ return TRUE;
}
/*
@@ -1162,7 +1227,7 @@ FUNCTION
bfd_find_target
SYNOPSIS
- const bfd_target *bfd_find_target(const char *target_name, bfd *abfd);
+ const bfd_target *bfd_find_target (const char *target_name, bfd *abfd);
DESCRIPTION
Return a pointer to the transfer vector for the object target
@@ -1177,9 +1242,7 @@ DESCRIPTION
*/
const bfd_target *
-bfd_find_target (target_name, abfd)
- const char *target_name;
- bfd *abfd;
+bfd_find_target (const char *target_name, bfd *abfd)
{
const char *targname;
const bfd_target *target;
@@ -1189,10 +1252,10 @@ bfd_find_target (target_name, abfd)
else
targname = getenv ("GNUTARGET");
- /* This is safe; the vector cannot be null */
+ /* This is safe; the vector cannot be null. */
if (targname == NULL || strcmp (targname, "default") == 0)
{
- abfd->target_defaulted = true;
+ abfd->target_defaulted = TRUE;
if (bfd_default_vector[0] != NULL)
abfd->xvec = bfd_default_vector[0];
else
@@ -1200,7 +1263,7 @@ bfd_find_target (target_name, abfd)
return abfd->xvec;
}
- abfd->target_defaulted = false;
+ abfd->target_defaulted = FALSE;
target = find_target (targname);
if (target == NULL)
@@ -1215,7 +1278,7 @@ FUNCTION
bfd_target_list
SYNOPSIS
- const char **bfd_target_list(void);
+ const char ** bfd_target_list (void);
DESCRIPTION
Return a freshly malloced NULL-terminated
@@ -1225,9 +1288,9 @@ DESCRIPTION
*/
const char **
-bfd_target_list ()
+bfd_target_list (void)
{
- int vec_length= 0;
+ int vec_length = 0;
bfd_size_type amt;
#if defined (HOST_HPPAHPUX) && ! defined (__STDC__)
/* The native compiler on the HP9000/700 has a bug which causes it
@@ -1241,7 +1304,7 @@ bfd_target_list ()
vec_length++;
amt = (vec_length + 1) * sizeof (char **);
- name_ptr = name_list = (const char **) bfd_zmalloc (amt);
+ name_ptr = name_list = bfd_malloc (amt);
if (name_list == NULL)
return NULL;
@@ -1251,6 +1314,7 @@ bfd_target_list ()
|| *target != bfd_target_vector[0])
*name_ptr++ = (*target)->name;
+ *name_ptr = NULL;
return name_list;
}
@@ -1259,7 +1323,9 @@ FUNCTION
bfd_seach_for_target
SYNOPSIS
- const bfd_target * bfd_search_for_target (int (* search_func) (const bfd_target *, void *), void *);
+ const bfd_target *bfd_search_for_target
+ (int (*search_func) (const bfd_target *, void *),
+ void *);
DESCRIPTION
Return a pointer to the first transfer vector in the list of
@@ -1270,15 +1336,14 @@ DESCRIPTION
*/
const bfd_target *
-bfd_search_for_target (search_func, data)
- int (* search_func) PARAMS ((const bfd_target * target, void * data));
- void * data;
+bfd_search_for_target (int (*search_func) (const bfd_target *, void *),
+ void *data)
{
- const bfd_target * const * target;
+ const bfd_target * const *target;
- for (target = bfd_target_vector; * target != NULL; target ++)
- if (search_func (* target, data))
- return * target;
+ for (target = bfd_target_vector; *target != NULL; target ++)
+ if (search_func (*target, data))
+ return *target;
return NULL;
}
diff --git a/contrib/binutils/bfd/tekhex.c b/contrib/binutils/bfd/tekhex.c
index 19dcb87..f828fe7 100644
--- a/contrib/binutils/bfd/tekhex.c
+++ b/contrib/binutils/bfd/tekhex.c
@@ -1,5 +1,5 @@
/* BFD backend for Extended Tektronix Hex Format objects.
- Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002
+ Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002, 2003
Free Software Foundation, Inc.
Written by Steve Chamberlain of Cygnus Support <sac@cygnus.com>.
@@ -29,7 +29,7 @@ DESCRIPTION
relocations. Their main application is communication with
devices like PROM programmers and ICE equipment.
- It seems that the sections are descibed as being really big,
+ It seems that the sections are described as being really big,
the example I have says that the text section is 0..ffffffff.
BFD would barf with this, many apps would try to alloc 4GB to
read in the file.
@@ -104,23 +104,23 @@ 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 *, boolean));
-static boolean tekhex_write_object_contents 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 boolean tekhex_set_section_contents
- PARAMS ((bfd*, sec_ptr, PTR, file_ptr, bfd_size_type));
-static boolean tekhex_set_arch_mach
+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 boolean tekhex_get_section_contents
+static bfd_boolean tekhex_get_section_contents
PARAMS ((bfd *, asection *, PTR, file_ptr, bfd_size_type));
static void move_section_contents
- PARAMS ((bfd *, asection *, PTR, file_ptr, bfd_size_type, boolean));
+ PARAMS ((bfd *, asection *, const PTR, file_ptr, bfd_size_type, bfd_boolean));
static const bfd_target *tekhex_object_p PARAMS ((bfd *));
-static boolean tekhex_mkobject PARAMS ((bfd *));
+static bfd_boolean tekhex_mkobject PARAMS ((bfd *));
static long tekhex_get_symtab_upper_bound PARAMS ((bfd *));
-static long tekhex_get_symtab PARAMS ((bfd *, asymbol **));
+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));
@@ -239,12 +239,12 @@ static void
tekhex_init ()
{
unsigned int i;
- static boolean inited = false;
+ static bfd_boolean inited = FALSE;
int val;
if (! inited)
{
- inited = true;
+ inited = TRUE;
hex_init ();
val = 0;
for (i = 0; i < 10; i++)
@@ -471,7 +471,7 @@ first_phase (abfd, type, src)
}
}
-/* Pass over an tekhex, calling one of the above functions on each
+/* Pass over a tekhex, calling one of the above functions on each
record. */
static void
@@ -480,7 +480,7 @@ pass_over (abfd, func)
void (*func) PARAMS ((bfd *, int, char *));
{
unsigned int chars_on_line;
- boolean eof = false;
+ bfd_boolean eof = FALSE;
/* To the front of the file */
if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0)
@@ -492,10 +492,10 @@ pass_over (abfd, func)
char type;
/* Find first '%' */
- eof = (boolean) (bfd_bread (src, (bfd_size_type) 1, abfd) != 1);
+ eof = (bfd_boolean) (bfd_bread (src, (bfd_size_type) 1, abfd) != 1);
while (*src != '%' && !eof)
{
- eof = (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;
@@ -522,7 +522,7 @@ pass_over (abfd, func)
}
static long
-tekhex_get_symtab (abfd, table)
+tekhex_canonicalize_symtab (abfd, table)
bfd *abfd;
asymbol **table;
{
@@ -547,7 +547,7 @@ tekhex_get_symtab_upper_bound (abfd)
}
-static boolean
+static bfd_boolean
tekhex_mkobject (abfd)
bfd *abfd;
{
@@ -555,17 +555,17 @@ tekhex_mkobject (abfd)
tdata = (tdata_type *) bfd_alloc (abfd, (bfd_size_type) sizeof (tdata_type));
if (!tdata)
- return false;
+ return FALSE;
abfd->tdata.tekhex_data = tdata;
tdata->type = 1;
tdata->head = (tekhex_data_list_type *) NULL;
tdata->symbols = (struct tekhex_symbol_struct *) NULL;
tdata->data = (struct data_struct *) NULL;
- return true;
+ return TRUE;
}
/*
- Return true if the file looks like it's in TekHex format. Just look
+ 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 *
@@ -593,10 +593,10 @@ static void
move_section_contents (abfd, section, locationp, offset, count, get)
bfd *abfd;
asection *section;
- PTR locationp;
+ const PTR locationp;
file_ptr offset;
bfd_size_type count;
- boolean get;
+ bfd_boolean get;
{
bfd_vma addr;
char *location = (char *) locationp;
@@ -639,7 +639,7 @@ move_section_contents (abfd, section, locationp, offset, count, get)
}
-static boolean
+static bfd_boolean
tekhex_get_section_contents (abfd, section, locationp, offset, count)
bfd *abfd;
asection *section;
@@ -649,14 +649,14 @@ tekhex_get_section_contents (abfd, section, locationp, offset, count)
{
if (section->flags & (SEC_LOAD | SEC_ALLOC))
{
- move_section_contents (abfd, section, locationp, offset, count, true);
- return true;
+ move_section_contents (abfd, section, locationp, offset, count, TRUE);
+ return TRUE;
}
else
- return false;
+ return FALSE;
}
-static boolean
+static bfd_boolean
tekhex_set_arch_mach (abfd, arch, machine)
bfd *abfd;
enum bfd_architecture arch;
@@ -668,11 +668,11 @@ tekhex_set_arch_mach (abfd, arch, machine)
/* we have to save up all the Tekhexords for a splurge before output,
*/
-static boolean
+static bfd_boolean
tekhex_set_section_contents (abfd, section, locationp, offset, bytes_to_do)
bfd *abfd;
sec_ptr section;
- PTR locationp;
+ const PTR locationp;
file_ptr offset;
bfd_size_type bytes_to_do;
{
@@ -698,11 +698,11 @@ tekhex_set_section_contents (abfd, section, locationp, offset, bytes_to_do)
if (section->flags & (SEC_LOAD | SEC_ALLOC))
{
move_section_contents (abfd, section, locationp, offset, bytes_to_do,
- false);
- return true;
+ FALSE);
+ return TRUE;
}
else
- return false;
+ return FALSE;
}
@@ -804,7 +804,7 @@ out (abfd, type, start, end)
abort ();
}
-static boolean
+static bfd_boolean
tekhex_write_object_contents (abfd)
bfd *abfd;
{
@@ -907,7 +907,7 @@ tekhex_write_object_contents (abfd)
case 'C':
case 'U':
bfd_set_error (bfd_error_wrong_format);
- return false;
+ return FALSE;
}
writesym (&dst, sym->name);
@@ -920,13 +920,13 @@ tekhex_write_object_contents (abfd)
/* And the terminator */
if (bfd_bwrite ("%0781010\n", (bfd_size_type) 9, abfd) != 9)
abort ();
- return true;
+ return TRUE;
}
static int
tekhex_sizeof_headers (abfd, exec)
bfd *abfd ATTRIBUTE_UNUSED;
- boolean exec ATTRIBUTE_UNUSED;
+ bfd_boolean exec ATTRIBUTE_UNUSED;
{
return 0;
diff --git a/contrib/binutils/bfd/trad-core.c b/contrib/binutils/bfd/trad-core.c
index e27cd35..f8c03d7 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
+ 2000, 2001, 2002, 2003, 2004
Free Software Foundation, Inc.
Written by John Gilmore of Cygnus Support.
@@ -47,13 +47,13 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include TRAD_HEADER
#endif
- struct trad_core_struct
- {
- asection *data_section;
- asection *stack_section;
- asection *reg_section;
- struct user u;
- };
+struct trad_core_struct
+{
+ asection *data_section;
+ asection *stack_section;
+ asection *reg_section;
+ struct user u;
+};
#define core_upage(bfd) (&((bfd)->tdata.trad_core_data->u))
#define core_datasec(bfd) ((bfd)->tdata.trad_core_data->data_section)
@@ -63,15 +63,14 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
/* forward declarations */
const bfd_target *trad_unix_core_file_p PARAMS ((bfd *abfd));
-char * trad_unix_core_file_failing_command PARAMS ((bfd *abfd));
-int trad_unix_core_file_failing_signal PARAMS ((bfd *abfd));
-boolean trad_unix_core_file_matches_executable_p
- PARAMS ((bfd *core_bfd, bfd *exec_bfd));
-static void swap_abort PARAMS ((void));
+char * trad_unix_core_file_failing_command PARAMS ((bfd *abfd));
+int trad_unix_core_file_failing_signal PARAMS ((bfd *abfd));
+bfd_boolean trad_unix_core_file_matches_executable_p
+ PARAMS ((bfd *core_bfd, bfd *exec_bfd));
+static void swap_abort PARAMS ((void));
/* Handle 4.2-style (and perhaps also sysV-style) core dump file. */
-/* ARGSUSED */
const bfd_target *
trad_unix_core_file_p (abfd)
bfd *abfd;
@@ -248,7 +247,6 @@ trad_unix_core_file_failing_command (abfd)
return 0;
}
-/* ARGSUSED */
int
trad_unix_core_file_failing_signal (ignore_abfd)
bfd *ignore_abfd ATTRIBUTE_UNUSED;
@@ -260,13 +258,12 @@ trad_unix_core_file_failing_signal (ignore_abfd)
#endif
}
-/* ARGSUSED */
-boolean
+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 */
+ return TRUE; /* FIXME, We have no way of telling at this point */
}
/* If somebody calls any byte-swapping routines, shoot them. */
@@ -275,10 +272,13 @@ swap_abort ()
{
abort (); /* This way doesn't require any declaration for ANSI to fuck up */
}
-#define NO_GET ((bfd_vma (*) PARAMS (( const bfd_byte *))) swap_abort )
-#define NO_PUT ((void (*) PARAMS ((bfd_vma, bfd_byte *))) swap_abort )
-#define NO_SIGNED_GET \
- ((bfd_signed_vma (*) PARAMS ((const bfd_byte *))) swap_abort )
+
+#define NO_GET ((bfd_vma (*) (const void *)) swap_abort)
+#define NO_PUT ((void (*) (bfd_vma, void *)) swap_abort)
+#define NO_GETS ((bfd_signed_vma (*) (const void *)) swap_abort)
+#define NO_GET64 ((bfd_uint64_t (*) (const void *)) swap_abort)
+#define NO_PUT64 ((void (*) (bfd_uint64_t, void *)) swap_abort)
+#define NO_GETS64 ((bfd_int64_t (*) (const void *)) swap_abort)
const bfd_target trad_core_vec =
{
@@ -293,39 +293,39 @@ const bfd_target trad_core_vec =
0, /* symbol prefix */
' ', /* ar_pad_char */
16, /* ar_max_namelen */
- NO_GET, NO_SIGNED_GET, NO_PUT, /* 64 bit data */
- NO_GET, NO_SIGNED_GET, NO_PUT, /* 32 bit data */
- NO_GET, NO_SIGNED_GET, NO_PUT, /* 16 bit data */
- NO_GET, NO_SIGNED_GET, NO_PUT, /* 64 bit hdrs */
- NO_GET, NO_SIGNED_GET, NO_PUT, /* 32 bit hdrs */
- NO_GET, NO_SIGNED_GET, NO_PUT, /* 16 bit hdrs */
+ NO_GET64, NO_GETS64, NO_PUT64, /* 64 bit data */
+ NO_GET, NO_GETS, NO_PUT, /* 32 bit data */
+ NO_GET, NO_GETS, NO_PUT, /* 16 bit data */
+ NO_GET64, NO_GETS64, NO_PUT64, /* 64 bit hdrs */
+ NO_GET, NO_GETS, NO_PUT, /* 32 bit hdrs */
+ NO_GET, NO_GETS, NO_PUT, /* 16 bit hdrs */
{ /* bfd_check_format */
- _bfd_dummy_target, /* unknown format */
- _bfd_dummy_target, /* object file */
- _bfd_dummy_target, /* archive */
- trad_unix_core_file_p /* a core file */
+ _bfd_dummy_target, /* unknown format */
+ _bfd_dummy_target, /* object file */
+ _bfd_dummy_target, /* archive */
+ trad_unix_core_file_p /* a core file */
},
{ /* bfd_set_format */
- bfd_false, bfd_false,
- bfd_false, bfd_false
+ bfd_false, bfd_false,
+ bfd_false, bfd_false
},
{ /* bfd_write_contents */
- bfd_false, bfd_false,
- bfd_false, bfd_false
+ bfd_false, bfd_false,
+ bfd_false, bfd_false
},
- BFD_JUMP_TABLE_GENERIC (_bfd_generic),
- BFD_JUMP_TABLE_COPY (_bfd_generic),
- BFD_JUMP_TABLE_CORE (trad_unix),
- BFD_JUMP_TABLE_ARCHIVE (_bfd_noarchive),
- BFD_JUMP_TABLE_SYMBOLS (_bfd_nosymbols),
- BFD_JUMP_TABLE_RELOCS (_bfd_norelocs),
- BFD_JUMP_TABLE_WRITE (_bfd_generic),
- BFD_JUMP_TABLE_LINK (_bfd_nolink),
- BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
+ BFD_JUMP_TABLE_GENERIC (_bfd_generic),
+ BFD_JUMP_TABLE_COPY (_bfd_generic),
+ BFD_JUMP_TABLE_CORE (trad_unix),
+ BFD_JUMP_TABLE_ARCHIVE (_bfd_noarchive),
+ BFD_JUMP_TABLE_SYMBOLS (_bfd_nosymbols),
+ BFD_JUMP_TABLE_RELOCS (_bfd_norelocs),
+ BFD_JUMP_TABLE_WRITE (_bfd_generic),
+ BFD_JUMP_TABLE_LINK (_bfd_nolink),
+ BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
NULL,
(PTR) 0 /* backend_data */
-};
+ };
diff --git a/contrib/binutils/bfd/version.h b/contrib/binutils/bfd/version.h
index 6dac811..ab4618d 100644
--- a/contrib/binutils/bfd/version.h
+++ b/contrib/binutils/bfd/version.h
@@ -1 +1,3 @@
-#define BFD_VERSION_DATE 20021127
+#define BFD_VERSION_DATE 20040523
+#define BFD_VERSION @bfd_version@
+#define BFD_VERSION_STRING @bfd_version_string@
diff --git a/contrib/binutils/bfd/xcoff-target.h b/contrib/binutils/bfd/xcoff-target.h
index 413511b..7bf3de7 100644
--- a/contrib/binutils/bfd/xcoff-target.h
+++ b/contrib/binutils/bfd/xcoff-target.h
@@ -57,7 +57,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#undef CORE_FILE_P
#define CORE_FILE_P rs6000coff_core_p
extern const bfd_target * rs6000coff_core_p ();
-extern boolean rs6000coff_core_file_matches_executable_p ();
+extern bfd_boolean rs6000coff_core_file_matches_executable_p ();
#undef coff_core_file_matches_executable_p
#define coff_core_file_matches_executable_p \
@@ -78,8 +78,8 @@ extern int rs6000coff_core_file_failing_signal PARAMS ((bfd *abfd));
#define CORE_FILE_P lynx_core_file_p
extern const bfd_target *lynx_core_file_p PARAMS ((bfd *abfd));
-extern boolean lynx_core_file_matches_executable_p PARAMS ((bfd *core_bfd,
- bfd *exec_bfd));
+extern bfd_boolean lynx_core_file_matches_executable_p
+ PARAMS ((bfd *core_bfd, bfd *exec_bfd));
#undef coff_core_file_matches_executable_p
#define coff_core_file_matches_executable_p lynx_core_file_matches_executable_p
@@ -106,7 +106,7 @@ extern int lynx_core_file_failing_signal PARAMS ((bfd *abfd));
#define _bfd_xcoff_slurp_extended_name_table bfd_false
#define _bfd_xcoff_construct_extended_name_table \
- ((boolean (*) PARAMS ((bfd *, char **, bfd_size_type *, const char **))) \
+ ((bfd_boolean (*) PARAMS ((bfd *, char **, bfd_size_type *, const char **))) \
bfd_false)
#define _bfd_xcoff_truncate_arname bfd_dont_truncate_arname
@@ -118,22 +118,22 @@ extern int lynx_core_file_failing_signal PARAMS ((bfd *abfd));
#define _bfd_xcoff_update_armap_timestamp bfd_true
-extern boolean _bfd_xcoff_mkobject PARAMS ((bfd *));
-extern boolean _bfd_xcoff_copy_private_bfd_data PARAMS ((bfd *, bfd *));
-extern boolean _bfd_xcoff_is_local_label_name PARAMS ((bfd *, const char *));
+extern 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 boolean _bfd_xcoff_slurp_armap PARAMS ((bfd *));
+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 boolean _bfd_xcoff_write_armap
+extern bfd_boolean _bfd_xcoff_write_armap
PARAMS ((bfd *, unsigned int, struct orl *, unsigned int, int));
-extern boolean _bfd_xcoff_write_archive_contents PARAMS ((bfd *));
-extern int _bfd_xcoff_sizeof_headers PARAMS ((bfd *, boolean));
+extern 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));
diff --git a/contrib/binutils/bfd/xcofflink.c b/contrib/binutils/bfd/xcofflink.c
index e4e4755..ccd82be 100644
--- a/contrib/binutils/bfd/xcofflink.c
+++ b/contrib/binutils/bfd/xcofflink.c
@@ -1,5 +1,5 @@
/* POWER/PowerPC XCOFF linker support.
- Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
+ Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
Free Software Foundation, Inc.
Written by Ian Lance Taylor <ian@cygnus.com>, Cygnus Support.
@@ -115,34 +115,35 @@ struct xcoff_final_link_info
static struct bfd_hash_entry *xcoff_link_hash_newfunc
PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, const char *));
-static boolean xcoff_get_section_contents PARAMS ((bfd *, asection *));
+static bfd_boolean xcoff_get_section_contents PARAMS ((bfd *, asection *));
static struct internal_reloc *xcoff_read_internal_relocs
- PARAMS ((bfd *, asection *, boolean, bfd_byte *, boolean,
+ PARAMS ((bfd *, asection *, bfd_boolean, bfd_byte *, bfd_boolean,
struct internal_reloc *));
-static boolean xcoff_link_add_object_symbols
+static bfd_boolean xcoff_link_add_object_symbols
PARAMS ((bfd *, struct bfd_link_info *));
-static boolean xcoff_link_check_archive_element
- PARAMS ((bfd *, struct bfd_link_info *, boolean *));
-static boolean xcoff_link_check_ar_symbols
- PARAMS ((bfd *, struct bfd_link_info *, boolean *));
-static boolean xcoff_link_check_dynamic_ar_symbols
- PARAMS ((bfd *, struct bfd_link_info *, boolean *));
+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 boolean xcoff_link_add_symbols PARAMS ((bfd *, struct bfd_link_info *));
-static boolean xcoff_link_add_dynamic_symbols
+static bfd_boolean xcoff_link_add_symbols
PARAMS ((bfd *, struct bfd_link_info *));
-static boolean xcoff_mark_symbol
+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 boolean xcoff_mark PARAMS ((struct bfd_link_info *, asection *));
+static bfd_boolean xcoff_mark PARAMS ((struct bfd_link_info *, asection *));
static void xcoff_sweep PARAMS ((struct bfd_link_info *));
-static boolean xcoff_build_ldsyms
+static bfd_boolean xcoff_build_ldsyms
PARAMS ((struct xcoff_link_hash_entry *, PTR));
-static boolean xcoff_link_input_bfd
+static bfd_boolean xcoff_link_input_bfd
PARAMS ((struct xcoff_final_link_info *, bfd *));
-static boolean xcoff_write_global_symbol
+static bfd_boolean xcoff_write_global_symbol
PARAMS ((struct xcoff_link_hash_entry *, PTR));
-static boolean xcoff_reloc_link_order
+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));
@@ -154,7 +155,7 @@ static int xcoff_sort_relocs PARAMS ((const PTR, const PTR));
/* Read the contents of a section. */
-static boolean
+static bfd_boolean
xcoff_get_section_contents (abfd, sec)
bfd *abfd;
asection *sec;
@@ -165,7 +166,7 @@ xcoff_get_section_contents (abfd, sec)
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;
+ return FALSE;
}
if (coff_section_data (abfd, sec)->contents == NULL)
@@ -173,15 +174,15 @@ xcoff_get_section_contents (abfd, sec)
coff_section_data (abfd, sec)->contents = ((bfd_byte *)
bfd_malloc (sec->_raw_size));
if (coff_section_data (abfd, sec)->contents == NULL)
- return false;
+ return FALSE;
if (! bfd_get_section_contents (abfd, sec,
coff_section_data (abfd, sec)->contents,
(file_ptr) 0, sec->_raw_size))
- return false;
+ return FALSE;
}
- return true;
+ return TRUE;
}
/* Get the size required to hold the dynamic symbols. */
@@ -247,7 +248,7 @@ _bfd_xcoff_canonicalize_dynamic_symtab (abfd, psyms)
return -1;
contents = coff_section_data (abfd, lsec)->contents;
- coff_section_data (abfd, lsec)->keep_contents = true;
+ coff_section_data (abfd, lsec)->keep_contents = TRUE;
bfd_xcoff_swap_ldhdr_in (abfd, contents, &ldhdr);
@@ -295,7 +296,7 @@ _bfd_xcoff_canonicalize_dynamic_symtab (abfd, psyms)
symbuf->symbol.flags |= BSF_GLOBAL;
/* FIXME: We have no way to record the other information stored
- with the loader symbol. */
+ with the loader symbol. */
*psyms = (asymbol *) symbuf;
}
@@ -421,8 +422,8 @@ _bfd_xcoff_canonicalize_dynamic_reloc (abfd, prelocs, syms)
relbuf->addend = 0;
/* Most dynamic relocs have the same type. FIXME: This is only
- correct if ldrel.l_rtype == 0. In other cases, we should use
- a different howto. */
+ correct if ldrel.l_rtype == 0. In other cases, we should use
+ a different howto. */
relbuf->howto = bfd_xcoff_dynamic_reloc_howto(abfd);
/* FIXME: We have no way to record the l_rsecnm field. */
@@ -501,14 +502,14 @@ _bfd_xcoff_bfd_link_hash_table_create (abfd)
ret->descriptor_section = NULL;
ret->imports = NULL;
ret->file_align = 0;
- ret->textro = false;
- ret->gc = false;
+ ret->textro = FALSE;
+ ret->gc = FALSE;
memset (ret->special_sections, 0, sizeof ret->special_sections);
/* The linker will always generate a full a.out header. We need to
record that fact now, before the sizeof_headers routine could be
called. */
- xcoff_data (abfd)->full_aouthdr = true;
+ xcoff_data (abfd)->full_aouthdr = TRUE;
return &ret->root;
}
@@ -535,9 +536,9 @@ xcoff_read_internal_relocs (abfd, sec, cache, external_relocs,
require_internal, internal_relocs)
bfd *abfd;
asection *sec;
- boolean cache;
+ bfd_boolean cache;
bfd_byte *external_relocs;
- boolean require_internal;
+ bfd_boolean require_internal;
struct internal_reloc *internal_relocs;
{
@@ -555,8 +556,8 @@ xcoff_read_internal_relocs (abfd, sec, cache, external_relocs,
&& cache
&& enclosing->reloc_count > 0)
{
- if (_bfd_coff_read_internal_relocs (abfd, enclosing, true,
- external_relocs, false,
+ if (_bfd_coff_read_internal_relocs (abfd, enclosing, TRUE,
+ external_relocs, FALSE,
(struct internal_reloc *) NULL)
== NULL)
return NULL;
@@ -587,7 +588,7 @@ xcoff_read_internal_relocs (abfd, sec, cache, external_relocs,
/* Given an XCOFF BFD, add symbols to the global hash table as
appropriate. */
-boolean
+bfd_boolean
_bfd_xcoff_bfd_link_add_symbols (abfd, info)
bfd *abfd;
struct bfd_link_info *info;
@@ -600,21 +601,21 @@ _bfd_xcoff_bfd_link_add_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
+ 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;
+ return FALSE;
}
{
bfd *member;
-
+
member = bfd_openr_next_archived_file (abfd, (bfd *) NULL);
while (member != NULL)
{
@@ -622,11 +623,11 @@ _bfd_xcoff_bfd_link_add_symbols (abfd, info)
&& (info->hash->creator == member->xvec)
&& (! bfd_has_map (abfd) || (member->flags & DYNAMIC) != 0))
{
- boolean needed;
-
- if (! xcoff_link_check_archive_element (member, info,
+ bfd_boolean needed;
+
+ if (! xcoff_link_check_archive_element (member, info,
&needed))
- return false;
+ return FALSE;
if (needed)
member->archive_pass = -1;
}
@@ -634,32 +635,32 @@ _bfd_xcoff_bfd_link_add_symbols (abfd, info)
}
}
- return true;
+ return TRUE;
default:
bfd_set_error (bfd_error_wrong_format);
- return false;
+ return FALSE;
}
}
/* Add symbols from an XCOFF object file. */
-static boolean
+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;
+ return FALSE;
if (! xcoff_link_add_symbols (abfd, info))
- return false;
+ return FALSE;
if (! info->keep_memory)
{
if (! _bfd_coff_free_symbols (abfd))
- return false;
+ return FALSE;
}
- return true;
+ return TRUE;
}
/* Check a single archive element to see if we need to include it in
@@ -667,48 +668,48 @@ xcoff_link_add_object_symbols (abfd, info)
needed in the link or not. This is called via
_bfd_generic_link_add_archive_symbols. */
-static boolean
+static bfd_boolean
xcoff_link_check_archive_element (abfd, info, pneeded)
bfd *abfd;
struct bfd_link_info *info;
- boolean *pneeded;
+ bfd_boolean *pneeded;
{
if (! _bfd_coff_get_external_symbols (abfd))
- return false;
+ return FALSE;
if (! xcoff_link_check_ar_symbols (abfd, info, pneeded))
- return false;
+ return FALSE;
if (*pneeded)
{
if (! xcoff_link_add_symbols (abfd, info))
- return false;
+ return FALSE;
}
if (! info->keep_memory || ! *pneeded)
{
if (! _bfd_coff_free_symbols (abfd))
- return false;
+ return FALSE;
}
- return true;
+ return TRUE;
}
/* Look through the symbols to see if this object file should be
included in the link. */
-static boolean
+static bfd_boolean
xcoff_link_check_ar_symbols (abfd, info, pneeded)
bfd *abfd;
struct bfd_link_info *info;
- boolean *pneeded;
+ bfd_boolean *pneeded;
{
bfd_size_type symesz;
bfd_byte *esym;
bfd_byte *esym_end;
- *pneeded = false;
+ *pneeded = FALSE;
if ((abfd->flags & DYNAMIC) != 0
&& ! info->static_link
@@ -731,13 +732,13 @@ xcoff_link_check_ar_symbols (abfd, info, pneeded)
struct bfd_link_hash_entry *h;
/* This symbol is externally visible, and is defined by this
- object file. */
+ 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);
+ 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,
@@ -751,9 +752,9 @@ xcoff_link_check_ar_symbols (abfd, info, pneeded)
& XCOFF_DEF_DYNAMIC) == 0))
{
if (! (*info->callbacks->add_archive_element) (info, abfd, name))
- return false;
- *pneeded = true;
- return true;
+ return FALSE;
+ *pneeded = TRUE;
+ return TRUE;
}
}
@@ -761,18 +762,18 @@ xcoff_link_check_ar_symbols (abfd, info, pneeded)
}
/* We do not need this object file. */
- return true;
+ 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 boolean
+static bfd_boolean
xcoff_link_check_dynamic_ar_symbols (abfd, info, pneeded)
bfd *abfd;
struct bfd_link_info *info;
- boolean *pneeded;
+ bfd_boolean *pneeded;
{
asection *lsec;
bfd_byte *contents;
@@ -780,17 +781,17 @@ xcoff_link_check_dynamic_ar_symbols (abfd, info, pneeded)
const char *strings;
bfd_byte *elsym, *elsymend;
- *pneeded = false;
+ *pneeded = FALSE;
lsec = bfd_get_section_by_name (abfd, ".loader");
if (lsec == NULL)
{
/* There are no symbols, so don't try to include it. */
- return true;
+ return TRUE;
}
if (! xcoff_get_section_contents (abfd, lsec))
- return false;
+ return FALSE;
contents = coff_section_data (abfd, lsec)->contents;
bfd_xcoff_swap_ldhdr_in (abfd, contents, &ldhdr);
@@ -822,20 +823,20 @@ xcoff_link_check_dynamic_ar_symbols (abfd, info, pneeded)
name = nambuf;
}
- h = bfd_link_hash_lookup (info->hash, name, false, false, true);
+ h = bfd_link_hash_lookup (info->hash, name, FALSE, FALSE, TRUE);
/* We are only interested in symbols that are currently
- undefined. At this point we know that we are using an XCOFF
- hash table. */
+ undefined. At this point we know that we are using an XCOFF
+ hash table. */
if (h != NULL
&& h->type == bfd_link_hash_undefined
&& (((struct xcoff_link_hash_entry *) h)->flags
& XCOFF_DEF_DYNAMIC) == 0)
{
if (! (*info->callbacks->add_archive_element) (info, abfd, name))
- return false;
- *pneeded = true;
- return true;
+ return FALSE;
+ *pneeded = TRUE;
+ return TRUE;
}
}
@@ -847,7 +848,7 @@ xcoff_link_check_dynamic_ar_symbols (abfd, info, pneeded)
coff_section_data (abfd, lsec)->contents = NULL;
}
- return true;
+ return TRUE;
}
/* Returns the index of reloc in RELOCS with the least address greater
@@ -905,11 +906,11 @@ xcoff_find_reloc (relocs, count, address)
Takes care of creating the .loader, .gl, .ds, .debug and sections. */
-static boolean
+static bfd_boolean
xcoff_link_create_extra_sections(bfd * abfd, struct bfd_link_info *info)
{
- boolean return_value = false;
+ bfd_boolean return_value = FALSE;
if (info->hash->creator == abfd->xvec)
{
@@ -998,7 +999,7 @@ xcoff_link_create_extra_sections(bfd * abfd, struct bfd_link_info *info)
}
}
- return_value = true;
+ return_value = TRUE;
end_return:
@@ -1023,21 +1024,21 @@ xcoff_link_create_extra_sections(bfd * abfd, struct bfd_link_info *info)
relocation entries carefully, since the only way to tell which
csect they belong to is to examine the address. */
-static boolean
+static bfd_boolean
xcoff_link_add_symbols (abfd, info)
bfd *abfd;
struct bfd_link_info *info;
{
unsigned int n_tmask;
unsigned int n_btshft;
- boolean default_copy;
+ bfd_boolean default_copy;
bfd_size_type symcount;
struct xcoff_link_hash_entry **sym_hash;
asection **csect_cache;
bfd_size_type linesz;
asection *o;
asection *last_real;
- boolean keep_syms;
+ bfd_boolean keep_syms;
asection *csect;
unsigned int csect_index;
asection *first_csect;
@@ -1058,16 +1059,16 @@ xcoff_link_add_symbols (abfd, info)
&& ! info->static_link)
{
if (! xcoff_link_add_dynamic_symbols (abfd, info))
- return false;
+ return FALSE;
}
/* create the loader, toc, gl, ds and debug sections, if needed */
- if (false == xcoff_link_create_extra_sections(abfd, info))
+ if (! xcoff_link_create_extra_sections (abfd, info))
goto error_return;
if ((abfd->flags & DYNAMIC) != 0
&& ! info->static_link)
- return true;
+ return TRUE;
n_tmask = coff_data (abfd)->local_n_tmask;
n_btshft = coff_data (abfd)->local_n_btshft;
@@ -1077,9 +1078,9 @@ xcoff_link_add_symbols (abfd, info)
#define N_BTSHFT n_btshft
if (info->keep_memory)
- default_copy = false;
+ default_copy = FALSE;
else
- default_copy = true;
+ default_copy = TRUE;
symcount = obj_raw_syment_count (abfd);
@@ -1122,8 +1123,8 @@ xcoff_link_add_symbols (abfd, info)
{
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, (bfd_byte *) NULL,
+ FALSE, (struct internal_reloc *) NULL);
amt = o->reloc_count;
amt *= sizeof (asection *);
reloc_info[o->target_index].csects = (asection **) bfd_zmalloc (amt);
@@ -1150,7 +1151,7 @@ xcoff_link_add_symbols (abfd, info)
}
/* Don't let the linker relocation routines discard the symbols. */
- obj_coff_keep_syms (abfd) = true;
+ obj_coff_keep_syms (abfd) = TRUE;
csect = NULL;
csect_index = 0;
@@ -1214,11 +1215,11 @@ xcoff_link_add_symbols (abfd, info)
goto error_return;
/* If this symbol has line number information attached to it,
- and we're not stripping it, count the number of entries and
- add them to the count for this csect. In the final link pass
- we are going to attach line number information by symbol,
- rather than by section, in order to more easily handle
- garbage collection. */
+ and we're not stripping it, count the number of entries and
+ add them to the count for this csect. In the final link pass
+ we are going to attach line number information by symbol,
+ rather than by section, in order to more easily handle
+ garbage collection. */
if ((info->strip == strip_none || info->strip == strip_some)
&& sym.n_numaux > 1
&& csect != NULL
@@ -1247,7 +1248,7 @@ xcoff_link_add_symbols (abfd, info)
}
linoff = (auxlin.x_sym.x_fcnary.x_fcn.x_lnnoptr
- enclosing->line_filepos);
- /* explict 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;
@@ -1336,7 +1337,7 @@ xcoff_link_add_symbols (abfd, info)
}
/* An XMC_XO external reference is actually a reference to
- an absolute location. */
+ an absolute location. */
if (aux.x_csect.x_smclas != XMC_XO)
section = bfd_und_section_ptr;
else
@@ -1430,7 +1431,7 @@ xcoff_link_add_symbols (abfd, info)
{
const char *relname;
char relbuf[SYMNMLEN + 1];
- boolean copy;
+ bfd_boolean copy;
struct xcoff_link_hash_entry *h;
/* At this point we know that the TOC entry is
@@ -1453,8 +1454,8 @@ xcoff_link_add_symbols (abfd, info)
|| relsym._n._n_n._n_zeroes != 0
|| relsym._n._n_n._n_offset == 0);
h = xcoff_link_hash_lookup (xcoff_hash_table (info),
- relname, true, copy,
- false);
+ relname, TRUE, copy,
+ FALSE);
if (h == NULL)
goto error_return;
@@ -1606,19 +1607,19 @@ xcoff_link_add_symbols (abfd, info)
follow its appropriate XTY_SD symbol. The .set pseudo op can
cause the XTY_LD to not follow the XTY_SD symbol. */
{
- boolean bad;
+ bfd_boolean bad;
- bad = false;
+ bad = FALSE;
if (aux.x_csect.x_scnlen.l < 0
|| (aux.x_csect.x_scnlen.l
>= esym - (bfd_byte *) obj_coff_external_syms (abfd)))
- bad = true;
+ bad = TRUE;
if (! bad)
{
section = xcoff_data (abfd)->csects[aux.x_csect.x_scnlen.l];
if (section == NULL
|| (section->flags & SEC_HAS_CONTENTS) == 0)
- bad = true;
+ bad = TRUE;
}
if (bad)
{
@@ -1635,11 +1636,11 @@ xcoff_link_add_symbols (abfd, info)
case XTY_CM:
/* This is an unitialized csect. We could base the name on
- the storage mapping class, but we don't bother except for
- an XMC_TD symbol. If this csect is externally visible,
- it is a common symbol. We put XMC_TD symbols in sections
- named .tocbss, and rely on the linker script to put that
- in the TOC area. */
+ the storage mapping class, but we don't bother except for
+ an XMC_TD symbol. If this csect is externally visible,
+ it is a common symbol. We put XMC_TD symbols in sections
+ named .tocbss, and rely on the linker script to put that
+ in the TOC area. */
if (csect != NULL)
{
@@ -1730,20 +1731,20 @@ xcoff_link_add_symbols (abfd, info)
}
/* Now we have enough information to add the symbol to the
- linker hash table. */
+ linker hash table. */
if (sym.n_sclass == C_EXT)
{
- boolean copy;
+ bfd_boolean copy;
BFD_ASSERT (section != NULL);
/* We must copy the name into memory if we got it from the
- syment itself, rather than the string table. */
+ syment itself, rather than the string table. */
copy = default_copy;
if (sym._n._n_n._n_zeroes != 0
|| sym._n._n_n._n_offset == 0)
- copy = true;
+ copy = TRUE;
/* The AIX linker appears to only detect multiple symbol
definitions when there is a reference to the symbol. If
@@ -1775,7 +1776,7 @@ xcoff_link_add_symbols (abfd, info)
if (! bfd_is_und_section (section))
{
*sym_hash = xcoff_link_hash_lookup (xcoff_hash_table (info),
- name, true, copy, false);
+ name, TRUE, copy, FALSE);
}
else
{
@@ -1783,8 +1784,8 @@ xcoff_link_add_symbols (abfd, info)
merging symbols. */
*sym_hash = ((struct xcoff_link_hash_entry *)
bfd_wrapped_link_hash_lookup (abfd, info, name,
- true, true,
- false));
+ TRUE, TRUE,
+ FALSE));
}
if (*sym_hash == NULL)
goto error_return;
@@ -1801,11 +1802,11 @@ xcoff_link_add_symbols (abfd, info)
& DYNAMIC) == 0))
{
/* The new symbol is from a shared library, and
- either the existing symbol is not global
- linkage code or this symbol is global linkage
- code. If the existing symbol is global
- linkage code and the new symbol is not, then
- we want to use the new symbol. */
+ either the existing symbol is not global
+ linkage code or this symbol is global linkage
+ code. If the existing symbol is global
+ linkage code and the new symbol is not, then
+ we want to use the new symbol. */
section = bfd_und_section_ptr;
value = 0;
}
@@ -1813,7 +1814,7 @@ xcoff_link_add_symbols (abfd, info)
& DYNAMIC) != 0)
{
/* The existing symbol is from a shared library.
- Replace it. */
+ Replace it. */
(*sym_hash)->root.type = bfd_link_hash_undefined;
(*sym_hash)->root.u.undef.abfd =
(*sym_hash)->root.u.def.section->owner;
@@ -1821,24 +1822,24 @@ xcoff_link_add_symbols (abfd, info)
else if (abfd->my_archive != NULL)
{
/* This is a redefinition in an object contained
- in an archive. Just ignore it. See the
- comment above. */
+ in an archive. Just ignore it. See the
+ comment above. */
section = bfd_und_section_ptr;
value = 0;
}
- else if ((*sym_hash)->root.next != NULL
+ else if ((*sym_hash)->root.und_next != NULL
|| info->hash->undefs_tail == &(*sym_hash)->root)
{
/* This symbol has been referenced. In this
- case, we just continue and permit the
- multiple definition error. See the comment
- above about the behaviour of the AIX linker. */
+ case, we just continue and permit the
+ multiple definition error. See the comment
+ above about the behaviour of the AIX linker. */
}
else if ((*sym_hash)->smclas == aux.x_csect.x_smclas)
{
/* The symbols are both csects of the same
- class. There is at least a chance that this
- is a semi-legitimate redefinition. */
+ class. There is at least a chance that this
+ is a semi-legitimate redefinition. */
section = bfd_und_section_ptr;
value = 0;
(*sym_hash)->flags |= XCOFF_MULTIPLY_DEFINED;
@@ -1883,7 +1884,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,
+ (const char *) NULL, copy, TRUE,
(struct bfd_link_hash_entry **) sym_hash)))
goto error_return;
last_real->next = first_csect;
@@ -1974,14 +1975,14 @@ xcoff_link_add_symbols (abfd, info)
h = obj_xcoff_sym_hashes (abfd)[rel->r_symndx];
h->flags |= XCOFF_CALLED;
/* If the symbol name starts with a period, it is
- the code of a function. If the symbol is
- currently undefined, then add an undefined symbol
- for the function descriptor. This should do no
- harm, because any regular object that defines the
- function should also define the function
- descriptor. It helps, because it means that we
- will identify the function descriptor with a
- dynamic object if a dynamic object defines it. */
+ the code of a function. If the symbol is
+ currently undefined, then add an undefined symbol
+ for the function descriptor. This should do no
+ harm, because any regular object that defines the
+ function should also define the function
+ descriptor. It helps, because it means that we
+ will identify the function descriptor with a
+ dynamic object if a dynamic object defines it. */
if (h->root.root.string[0] == '.'
&& h->descriptor == NULL)
{
@@ -1990,7 +1991,7 @@ xcoff_link_add_symbols (abfd, info)
hds = xcoff_link_hash_lookup (xcoff_hash_table (info),
h->root.root.string + 1,
- true, false, true);
+ TRUE, FALSE, TRUE);
if (hds == NULL)
goto error_return;
if (hds->root.type == bfd_link_hash_new)
@@ -1999,8 +2000,8 @@ 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,
- true, &bh)))
+ (bfd_vma) 0, (const char *) NULL, FALSE,
+ TRUE, &bh)))
goto error_return;
hds = (struct xcoff_link_hash_entry *) bh;
}
@@ -2033,7 +2034,7 @@ xcoff_link_add_symbols (abfd, info)
}
/* Free up the line numbers. FIXME: We could cache these
- somewhere for the final link, to avoid reading them again. */
+ somewhere for the final link, to avoid reading them again. */
if (reloc_info[o->target_index].linenos != NULL)
{
free (reloc_info[o->target_index].linenos);
@@ -2045,7 +2046,7 @@ xcoff_link_add_symbols (abfd, info)
obj_coff_keep_syms (abfd) = keep_syms;
- return true;
+ return TRUE;
error_return:
if (reloc_info != NULL)
@@ -2060,7 +2061,7 @@ xcoff_link_add_symbols (abfd, info)
free (reloc_info);
}
obj_coff_keep_syms (abfd) = keep_syms;
- return false;
+ return FALSE;
}
#undef N_TMASK
@@ -2069,7 +2070,7 @@ xcoff_link_add_symbols (abfd, info)
/* This function is used to add symbols from a dynamic object to the
global symbol table. */
-static boolean
+static bfd_boolean
xcoff_link_add_dynamic_symbols (abfd, info)
bfd *abfd;
struct bfd_link_info *info;
@@ -2094,7 +2095,7 @@ xcoff_link_add_dynamic_symbols (abfd, info)
(_("%s: XCOFF shared object when not producing XCOFF output"),
bfd_get_filename (abfd));
bfd_set_error (bfd_error_invalid_operation);
- return false;
+ return FALSE;
}
/* The symbols we use from a dynamic object are not the symbols in
@@ -2115,12 +2116,12 @@ xcoff_link_add_dynamic_symbols (abfd, info)
(_("%s: dynamic object with no .loader section"),
bfd_get_filename (abfd));
bfd_set_error (bfd_error_no_symbols);
- return false;
+ return FALSE;
}
if (! xcoff_get_section_contents (abfd, lsec))
- return false;
+ return FALSE;
contents = coff_section_data (abfd, lsec)->contents;
/* Remove the sections from this object, so that they do not get
@@ -2162,10 +2163,10 @@ xcoff_link_add_dynamic_symbols (abfd, info)
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);
+ h = xcoff_link_hash_lookup (xcoff_hash_table (info), name, TRUE,
+ TRUE, TRUE);
if (h == NULL)
- return false;
+ return FALSE;
h->flags |= XCOFF_DEF_DYNAMIC;
@@ -2191,9 +2192,9 @@ xcoff_link_add_dynamic_symbols (abfd, info)
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. */
+ 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
@@ -2221,21 +2222,21 @@ xcoff_link_add_dynamic_symbols (abfd, info)
dsnm = bfd_malloc ((bfd_size_type) strlen (name) + 2);
if (dsnm == NULL)
- return false;
+ return FALSE;
dsnm[0] = '.';
strcpy (dsnm + 1, name);
hds = xcoff_link_hash_lookup (xcoff_hash_table (info), dsnm,
- true, true, true);
+ TRUE, TRUE, TRUE);
free (dsnm);
if (hds == NULL)
- return false;
+ 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. */
+ symbol list. */
}
hds->descriptor = h;
@@ -2272,7 +2273,7 @@ xcoff_link_add_dynamic_symbols (abfd, info)
n = ((struct xcoff_import_file *)
bfd_alloc (abfd, (bfd_size_type) sizeof (struct xcoff_import_file)));
if (n == NULL)
- return false;
+ return FALSE;
n->next = NULL;
/* For some reason, the path entry in the import file list for a
@@ -2305,7 +2306,7 @@ xcoff_link_add_dynamic_symbols (abfd, info)
xcoff_data (abfd)->import_file_id = c;
- return true;
+ return TRUE;
}
/* Routines that are called after all the input files have been
@@ -2314,14 +2315,14 @@ xcoff_link_add_dynamic_symbols (abfd, info)
/* Mark a symbol as not being garbage, including the section in which
it is defined. */
-static INLINE boolean
+static INLINE bfd_boolean
xcoff_mark_symbol (info, h)
struct bfd_link_info *info;
struct xcoff_link_hash_entry *h;
{
if ((h->flags & XCOFF_MARK) != 0)
- return true;
+ return TRUE;
h->flags |= XCOFF_MARK;
if (h->root.type == bfd_link_hash_defined
@@ -2334,7 +2335,7 @@ xcoff_mark_symbol (info, h)
&& (hsec->flags & SEC_MARK) == 0)
{
if (! xcoff_mark (info, hsec))
- return false;
+ return FALSE;
}
}
@@ -2342,10 +2343,10 @@ xcoff_mark_symbol (info, h)
&& (h->toc_section->flags & SEC_MARK) == 0)
{
if (! xcoff_mark (info, h->toc_section))
- return false;
+ return FALSE;
}
- return true;
+ return TRUE;
}
/* The mark phase of garbage collection. For a given section, mark
@@ -2354,14 +2355,14 @@ xcoff_mark_symbol (info, h)
the number of relocs which need to be copied into the .loader
section. */
-static boolean
+static bfd_boolean
xcoff_mark (info, sec)
struct bfd_link_info *info;
asection *sec;
{
if (bfd_is_abs_section (sec)
|| (sec->flags & SEC_MARK) != 0)
- return true;
+ return TRUE;
sec->flags |= SEC_MARK;
@@ -2387,7 +2388,7 @@ xcoff_mark (info, sec)
&& (h->flags & XCOFF_MARK) == 0)
{
if (! xcoff_mark_symbol (info, h))
- return false;
+ return FALSE;
}
}
@@ -2396,11 +2397,11 @@ xcoff_mark (info, sec)
if ((sec->flags & SEC_RELOC) != 0
&& sec->reloc_count > 0)
{
- rel = xcoff_read_internal_relocs (sec->owner, sec, true,
- (bfd_byte *) NULL, false,
+ rel = xcoff_read_internal_relocs (sec->owner, sec, TRUE,
+ (bfd_byte *) NULL, FALSE,
(struct internal_reloc *) NULL);
if (rel == NULL)
- return false;
+ return FALSE;
relend = rel + sec->reloc_count;
for (; rel < relend; rel++)
{
@@ -2416,7 +2417,7 @@ xcoff_mark (info, sec)
&& (h->flags & XCOFF_MARK) == 0)
{
if (! xcoff_mark_symbol (info, h))
- return false;
+ return FALSE;
}
rsec = xcoff_data (sec->owner)->csects[rel->r_symndx];
@@ -2424,11 +2425,11 @@ xcoff_mark (info, sec)
&& (rsec->flags & SEC_MARK) == 0)
{
if (! xcoff_mark (info, rsec))
- return false;
+ return FALSE;
}
/* See if this reloc needs to be copied into the .loader
- section. */
+ section. */
switch (rel->r_type)
{
default:
@@ -2477,7 +2478,7 @@ xcoff_mark (info, sec)
}
}
- return true;
+ return TRUE;
}
/* The sweep phase of garbage collection. Remove all garbage
@@ -2498,8 +2499,8 @@ xcoff_sweep (info)
if ((o->flags & SEC_MARK) == 0)
{
/* Keep all sections from non-XCOFF input files. Keep
- special sections. Keep .debug sections for the
- moment. */
+ special sections. Keep .debug sections for the
+ moment. */
if (sub->xvec != info->hash->creator
|| o == xcoff_hash_table (info)->debug_section
|| o == xcoff_hash_table (info)->loader_section
@@ -2522,7 +2523,7 @@ xcoff_sweep (info)
/* Record the number of elements in a set. This is used to output the
correct csect length. */
-boolean
+bfd_boolean
bfd_xcoff_link_record_set (output_bfd, info, harg, size)
bfd *output_bfd;
struct bfd_link_info *info;
@@ -2534,7 +2535,7 @@ bfd_xcoff_link_record_set (output_bfd, info, harg, size)
bfd_size_type amt;
if (bfd_get_flavour (output_bfd) != bfd_target_xcoff_flavour)
- return true;
+ return TRUE;
/* This will hardly ever be called. I don't want to burn four bytes
per global symbol, so instead the size is kept on a linked list
@@ -2543,7 +2544,7 @@ bfd_xcoff_link_record_set (output_bfd, info, harg, size)
amt = sizeof (struct xcoff_link_size_list);
n = (struct xcoff_link_size_list *) bfd_alloc (output_bfd, amt);
if (n == NULL)
- return false;
+ return FALSE;
n->next = xcoff_hash_table (info)->size_list;
n->h = h;
n->size = size;
@@ -2551,12 +2552,12 @@ bfd_xcoff_link_record_set (output_bfd, info, harg, size)
h->flags |= XCOFF_HAS_SIZE;
- return true;
+ return TRUE;
}
/* Import a symbol. */
-boolean
+bfd_boolean
bfd_xcoff_import_symbol (output_bfd, info, harg, val, imppath, impfile,
impmember, syscall_flag)
bfd *output_bfd;
@@ -2571,7 +2572,7 @@ bfd_xcoff_import_symbol (output_bfd, info, harg, val, imppath, impfile,
struct xcoff_link_hash_entry *h = (struct xcoff_link_hash_entry *) harg;
if (bfd_get_flavour (output_bfd) != bfd_target_xcoff_flavour)
- return true;
+ return TRUE;
/* A symbol name which starts with a period is the code for a
function. If the symbol is undefined, then add an undefined
@@ -2587,9 +2588,9 @@ bfd_xcoff_import_symbol (output_bfd, info, harg, val, imppath, impfile,
{
hds = xcoff_link_hash_lookup (xcoff_hash_table (info),
h->root.root.string + 1,
- true, false, true);
+ TRUE, FALSE, TRUE);
if (hds == NULL)
- return false;
+ return FALSE;
if (hds->root.type == bfd_link_hash_new)
{
hds->root.type = bfd_link_hash_undefined;
@@ -2603,8 +2604,8 @@ bfd_xcoff_import_symbol (output_bfd, info, harg, val, imppath, impfile,
}
/* Now, if the descriptor is undefined, import the descriptor
- rather than the symbol we were told to import. FIXME: Is
- this correct in all cases? */
+ rather than the symbol we were told to import. FIXME: Is
+ this correct in all cases? */
if (hds->root.type == bfd_link_hash_undefined)
h = hds;
}
@@ -2621,7 +2622,7 @@ bfd_xcoff_import_symbol (output_bfd, info, harg, val, imppath, impfile,
(info, h->root.root.string, h->root.u.def.section->owner,
h->root.u.def.section, h->root.u.def.value,
output_bfd, bfd_abs_section_ptr, val)))
- return false;
+ return FALSE;
}
h->root.type = bfd_link_hash_defined;
@@ -2641,7 +2642,7 @@ bfd_xcoff_import_symbol (output_bfd, info, harg, val, imppath, impfile,
struct xcoff_import_file **pp;
/* We start c at 1 because the first entry in the import list is
- reserved for the library search path. */
+ reserved for the library search path. */
for (pp = &xcoff_hash_table (info)->imports, c = 1;
*pp != NULL;
pp = &(*pp)->next, ++c)
@@ -2659,7 +2660,7 @@ bfd_xcoff_import_symbol (output_bfd, info, harg, val, imppath, impfile,
n = (struct xcoff_import_file *) bfd_alloc (output_bfd, amt);
if (n == NULL)
- return false;
+ return FALSE;
n->next = NULL;
n->path = imppath;
n->file = impfile;
@@ -2670,12 +2671,12 @@ bfd_xcoff_import_symbol (output_bfd, info, harg, val, imppath, impfile,
h->ldindx = c;
}
- return true;
+ return TRUE;
}
/* Export a symbol. */
-boolean
+bfd_boolean
bfd_xcoff_export_symbol (output_bfd, info, harg)
bfd *output_bfd;
struct bfd_link_info *info;
@@ -2684,7 +2685,7 @@ bfd_xcoff_export_symbol (output_bfd, info, harg)
struct xcoff_link_hash_entry *h = (struct xcoff_link_hash_entry *) harg;
if (bfd_get_flavour (output_bfd) != bfd_target_xcoff_flavour)
- return true;
+ return TRUE;
h->flags |= XCOFF_EXPORT;
@@ -2702,11 +2703,11 @@ bfd_xcoff_export_symbol (output_bfd, info, harg)
fnname = (char *) bfd_malloc (amt);
if (fnname == NULL)
- return false;
+ return FALSE;
fnname[0] = '.';
strcpy (fnname + 1, h->root.root.string);
hfn = xcoff_link_hash_lookup (xcoff_hash_table (info),
- fnname, false, false, true);
+ fnname, FALSE, FALSE, TRUE);
free (fnname);
if (hfn != NULL
&& hfn->smclas == XMC_PR
@@ -2721,7 +2722,7 @@ bfd_xcoff_export_symbol (output_bfd, info, harg)
/* Make sure we don't garbage collect this symbol. */
if (! xcoff_mark_symbol (info, h))
- return false;
+ return FALSE;
/* If this is a function descriptor, make sure we don't garbage
collect the associated function code. We normally don't have to
@@ -2731,17 +2732,17 @@ bfd_xcoff_export_symbol (output_bfd, info, harg)
if ((h->flags & XCOFF_DESCRIPTOR) != 0)
{
if (! xcoff_mark_symbol (info, h->descriptor))
- return false;
+ return FALSE;
}
- return true;
+ return TRUE;
}
/* Count a reloc against a symbol. This is called for relocs
generated by the linker script, typically for global constructors
and destructors. */
-boolean
+bfd_boolean
bfd_xcoff_link_count_reloc (output_bfd, info, name)
bfd *output_bfd;
struct bfd_link_info *info;
@@ -2750,16 +2751,16 @@ bfd_xcoff_link_count_reloc (output_bfd, info, name)
struct xcoff_link_hash_entry *h;
if (bfd_get_flavour (output_bfd) != bfd_target_xcoff_flavour)
- return true;
+ return TRUE;
h = ((struct xcoff_link_hash_entry *)
- bfd_wrapped_link_hash_lookup (output_bfd, info, name, false, false,
- false));
+ bfd_wrapped_link_hash_lookup (output_bfd, info, name, FALSE, FALSE,
+ FALSE));
if (h == NULL)
{
(*_bfd_error_handler) (_("%s: no such symbol"), name);
bfd_set_error (bfd_error_no_symbols);
- return false;
+ return FALSE;
}
h->flags |= XCOFF_REF_REGULAR | XCOFF_LDREL;
@@ -2767,15 +2768,15 @@ bfd_xcoff_link_count_reloc (output_bfd, info, name)
/* Mark the symbol to avoid garbage collection. */
if (! xcoff_mark_symbol (info, h))
- return false;
+ return FALSE;
- return true;
+ return TRUE;
}
/* This function is called for each symbol to which the linker script
assigns a value. */
-boolean
+bfd_boolean
bfd_xcoff_record_link_assignment (output_bfd, info, name)
bfd *output_bfd;
struct bfd_link_info *info;
@@ -2784,16 +2785,16 @@ bfd_xcoff_record_link_assignment (output_bfd, info, name)
struct xcoff_link_hash_entry *h;
if (bfd_get_flavour (output_bfd) != bfd_target_xcoff_flavour)
- return true;
+ return TRUE;
- h = xcoff_link_hash_lookup (xcoff_hash_table (info), name, true, true,
- false);
+ h = xcoff_link_hash_lookup (xcoff_hash_table (info), name, TRUE, TRUE,
+ FALSE);
if (h == NULL)
- return false;
+ return FALSE;
h->flags |= XCOFF_DEF_REGULAR;
- return true;
+ return TRUE;
}
/* Build the .loader section. This is called by the XCOFF linker
@@ -2813,7 +2814,7 @@ bfd_xcoff_record_link_assignment (output_bfd, info, name)
option). SPECIAL_SECTIONS is set by this routine to csects with
magic names like _end. */
-boolean
+bfd_boolean
bfd_xcoff_size_dynamic_sections (output_bfd, info, libpath, entry,
file_align, maxstack, maxdata, gc,
modtype, textro, export_defineds,
@@ -2825,12 +2826,12 @@ bfd_xcoff_size_dynamic_sections (output_bfd, info, libpath, entry,
unsigned long file_align;
unsigned long maxstack;
unsigned long maxdata;
- boolean gc;
+ bfd_boolean gc;
int modtype;
- boolean textro;
- boolean export_defineds;
+ bfd_boolean textro;
+ bfd_boolean export_defineds;
asection **special_sections;
- boolean rtld;
+ bfd_boolean rtld;
{
struct xcoff_link_hash_entry *hentry;
asection *lsec;
@@ -2851,10 +2852,10 @@ bfd_xcoff_size_dynamic_sections (output_bfd, info, libpath, entry,
{
for (i = 0; i < XCOFF_NUMBER_OF_SPECIAL_SECTIONS; i++)
special_sections[i] = NULL;
- return true;
+ return TRUE;
}
- ldinfo.failed = false;
+ ldinfo.failed = FALSE;
ldinfo.output_bfd = output_bfd;
ldinfo.info = info;
ldinfo.export_defineds = export_defineds;
@@ -2874,56 +2875,55 @@ bfd_xcoff_size_dynamic_sections (output_bfd, info, libpath, entry,
if (entry != NULL)
{
hentry = xcoff_link_hash_lookup (xcoff_hash_table (info), entry,
- false, false, true);
+ FALSE, FALSE, TRUE);
if (hentry != NULL)
hentry->flags |= XCOFF_ENTRY;
}
/* __rtinit */
- if (info->init_function || info->fini_function || rtld)
+ if (info->init_function || info->fini_function || rtld)
{
struct xcoff_link_hash_entry *hsym;
struct internal_ldsym *ldsym;
-
+
hsym = xcoff_link_hash_lookup (xcoff_hash_table (info),
- "__rtinit", false, false, true);
+ "__rtinit", FALSE, FALSE, TRUE);
if (hsym == NULL)
{
(*_bfd_error_handler)
(_("error: undefined symbol __rtinit"));
- return false;
+ return FALSE;
}
-
+
xcoff_mark_symbol (info, hsym);
hsym->flags |= (XCOFF_DEF_REGULAR | XCOFF_RTINIT);
- /* __rtinit initalized */
+ /* __rtinit initialized */
amt = sizeof (struct internal_ldsym);
ldsym = (struct internal_ldsym *) bfd_malloc (amt);
-
- ldsym->l_value = 0; /* will be filled in later */
- ldsym->l_scnum = 2; /* data section */
- ldsym->l_smtype = XTY_SD; /* csect section definition */
- ldsym->l_smclas = 5; /* .rw */
- ldsym->l_ifile = 0; /* special system loader symbol */
- ldsym->l_parm = 0; /* NA */
-
+
+ ldsym->l_value = 0; /* will be filled in later */
+ ldsym->l_scnum = 2; /* data section */
+ ldsym->l_smtype = XTY_SD; /* csect section definition */
+ ldsym->l_smclas = 5; /* .rw */
+ ldsym->l_ifile = 0; /* special system loader symbol */
+ ldsym->l_parm = 0; /* NA */
+
/* Force __rtinit to be the first symbol in the loader symbol table
See xcoff_build_ldsyms
-
+
The first 3 symbol table indices are reserved to indicate the data,
text and bss sections. */
BFD_ASSERT (0 == ldinfo.ldsym_count);
-
+
hsym->ldindx = 3;
ldinfo.ldsym_count = 1;
hsym->ldsym = ldsym;
-
- if (false == bfd_xcoff_put_ldsymbol_name (ldinfo.output_bfd, &ldinfo,
- hsym->ldsym,
- hsym->root.root.string))
- return false;
-
+
+ if (! bfd_xcoff_put_ldsymbol_name (ldinfo.output_bfd, &ldinfo,
+ hsym->ldsym, hsym->root.root.string))
+ return FALSE;
+
/* This symbol is written out by xcoff_write_global_symbol
Set stuff up so xcoff_write_global_symbol logic works. */
hsym->flags |= XCOFF_DEF_REGULAR | XCOFF_MARK;
@@ -2932,17 +2932,17 @@ bfd_xcoff_size_dynamic_sections (output_bfd, info, libpath, entry,
}
/* Garbage collect unused sections. */
- if (info->relocateable
+ if (info->relocatable
|| ! gc
|| hentry == NULL
|| (hentry->root.type != bfd_link_hash_defined
&& hentry->root.type != bfd_link_hash_defweak))
{
- gc = false;
- xcoff_hash_table (info)->gc = false;
+ gc = FALSE;
+ xcoff_hash_table (info)->gc = FALSE;
/* We still need to call xcoff_mark, in order to set ldrel_count
- correctly. */
+ correctly. */
for (sub = info->input_bfds; sub != NULL; sub = sub->link_next)
{
asection *o;
@@ -2962,7 +2962,7 @@ bfd_xcoff_size_dynamic_sections (output_bfd, info, libpath, entry,
if (! xcoff_mark (info, hentry->root.u.def.section))
goto error_return;
xcoff_sweep (info);
- xcoff_hash_table (info)->gc = true;
+ xcoff_hash_table (info)->gc = TRUE;
}
/* Return special sections to the caller. */
@@ -2982,7 +2982,7 @@ bfd_xcoff_size_dynamic_sections (output_bfd, info, libpath, entry,
if (info->input_bfds == NULL)
{
/* I'm not sure what to do in this bizarre case. */
- return true;
+ return TRUE;
}
xcoff_link_hash_traverse (xcoff_hash_table (info), xcoff_build_ldsyms,
@@ -3158,7 +3158,7 @@ bfd_xcoff_size_dynamic_sections (output_bfd, info, libpath, entry,
csectpp = xcoff_data (sub)->csects;
/* Dynamic object do not have csectpp's. */
- if (NULL != csectpp)
+ if (NULL != csectpp)
{
symesz = bfd_coff_symesz (sub);
esym = (bfd_byte *) obj_coff_external_syms (sub);
@@ -3183,7 +3183,7 @@ bfd_xcoff_size_dynamic_sections (output_bfd, info, libpath, entry,
bfd_size_type indx;
name = (char *) debug_contents + sym._n._n_n._n_offset;
- indx = _bfd_stringtab_add (debug_strtab, name, true, true);
+ indx = _bfd_stringtab_add (debug_strtab, name, TRUE, TRUE);
if (indx == (bfd_size_type) -1)
goto error_return;
*debug_index = indx;
@@ -3213,29 +3213,29 @@ bfd_xcoff_size_dynamic_sections (output_bfd, info, libpath, entry,
xcoff_hash_table (info)->debug_section->_raw_size =
_bfd_stringtab_size (debug_strtab);
- return true;
+ return TRUE;
error_return:
if (ldinfo.strings != NULL)
free (ldinfo.strings);
if (debug_contents != NULL)
free (debug_contents);
- return false;
+ return FALSE;
}
-boolean
+bfd_boolean
bfd_xcoff_link_generate_rtinit (abfd, init, fini, rtld)
bfd *abfd;
const char *init;
const char *fini;
- boolean rtld;
+ bfd_boolean rtld;
{
struct bfd_in_memory *bim;
-
+
bim = ((struct bfd_in_memory *)
bfd_malloc ((bfd_size_type) sizeof (struct bfd_in_memory)));
if (bim == NULL)
- return false;
+ return FALSE;
bim->size = 0;
bim->buffer = 0;
@@ -3247,21 +3247,21 @@ bfd_xcoff_link_generate_rtinit (abfd, init, fini, rtld)
abfd->direction = write_direction;
abfd->where = 0;
- if (false == bfd_xcoff_generate_rtinit (abfd, init, fini, rtld))
- return false;
+ if (! bfd_xcoff_generate_rtinit (abfd, init, fini, rtld))
+ return FALSE;
/* need to reset to unknown or it will not be read back in correctly */
abfd->format = bfd_unknown;
abfd->direction = read_direction;
abfd->where = 0;
- return true;
+ return TRUE;
}
/* Add a symbol to the .loader symbols, if necessary. */
-static boolean
+static bfd_boolean
xcoff_build_ldsyms (h, p)
struct xcoff_link_hash_entry *h;
PTR p;
@@ -3274,7 +3274,7 @@ xcoff_build_ldsyms (h, p)
/* __rtinit, this symbol has special handling. */
if (h->flags & XCOFF_RTINIT)
- return true;
+ 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
@@ -3296,7 +3296,7 @@ xcoff_build_ldsyms (h, p)
&& (h->flags & XCOFF_DEF_REGULAR) != 0
&& h->root.root.string[0] != '.')
{
- boolean export;
+ 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
@@ -3312,7 +3312,7 @@ xcoff_build_ldsyms (h, p)
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;
+ export = TRUE;
if ((h->root.type == bfd_link_hash_defined
|| h->root.type == bfd_link_hash_defweak)
&& h->root.u.def.section->owner != NULL
@@ -3326,7 +3326,7 @@ xcoff_build_ldsyms (h, p)
{
if ((member->flags & DYNAMIC) != 0)
{
- export = false;
+ export = FALSE;
break;
}
member = bfd_openr_next_archived_file (arbfd, member);
@@ -3375,7 +3375,7 @@ xcoff_build_ldsyms (h, p)
sec->_raw_size += bfd_xcoff_glink_code_size(ldinfo->output_bfd);
/* The global linkage code requires a TOC entry for the
- descriptor. */
+ descriptor. */
hds = h->descriptor;
BFD_ASSERT ((hds->root.type == bfd_link_hash_undefined
|| hds->root.type == bfd_link_hash_undefweak)
@@ -3393,7 +3393,7 @@ xcoff_build_ldsyms (h, p)
else if (bfd_xcoff_is_xcoff32 (ldinfo->output_bfd))
byte_size = 4;
else
- return false;
+ return FALSE;
hds->toc_section = xcoff_hash_table (ldinfo->info)->toc_section;
hds->u.toc_offset = hds->toc_section->_raw_size;
@@ -3425,10 +3425,10 @@ xcoff_build_ldsyms (h, p)
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. */
+ 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;
@@ -3455,7 +3455,7 @@ xcoff_build_ldsyms (h, p)
(_("warning: attempt to export undefined symbol `%s'"),
h->root.root.string);
h->ldsym = NULL;
- return true;
+ return TRUE;
}
}
@@ -3484,7 +3484,7 @@ xcoff_build_ldsyms (h, p)
&& (h->flags & XCOFF_EXPORT) == 0)
{
h->ldsym = NULL;
- return true;
+ return TRUE;
}
/* We don't need to add this symbol if we did garbage collection and
@@ -3493,13 +3493,13 @@ xcoff_build_ldsyms (h, p)
&& (h->flags & XCOFF_MARK) == 0)
{
h->ldsym = NULL;
- return true;
+ return TRUE;
}
/* We may have already processed this symbol due to the recursive
call above. */
if ((h->flags & XCOFF_BUILT_LDSYM) != 0)
- return true;
+ return TRUE;
/* We need to add this symbol to the .loader symbols. */
@@ -3508,8 +3508,8 @@ xcoff_build_ldsyms (h, p)
h->ldsym = (struct internal_ldsym *) bfd_zalloc (ldinfo->output_bfd, amt);
if (h->ldsym == NULL)
{
- ldinfo->failed = true;
- return false;
+ ldinfo->failed = TRUE;
+ return FALSE;
}
if ((h->flags & XCOFF_IMPORT) != 0)
@@ -3521,21 +3521,20 @@ xcoff_build_ldsyms (h, p)
++ldinfo->ldsym_count;
- if (false == bfd_xcoff_put_ldsymbol_name (ldinfo->output_bfd, ldinfo,
- h->ldsym,
- h->root.root.string))
+ if (! bfd_xcoff_put_ldsymbol_name (ldinfo->output_bfd, ldinfo,
+ h->ldsym, h->root.root.string))
{
- return false;
+ return FALSE;
}
h->flags |= XCOFF_BUILT_LDSYM;
- return true;
+ return TRUE;
}
/* Do the final link step. */
-boolean
+bfd_boolean
_bfd_xcoff_bfd_final_link (abfd, info)
bfd *abfd;
struct bfd_link_info *info;
@@ -3611,7 +3610,7 @@ _bfd_xcoff_bfd_final_link (abfd, info)
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;
+ sec->linker_mark = TRUE;
if (info->strip == strip_none
|| info->strip == strip_some)
@@ -3651,49 +3650,49 @@ _bfd_xcoff_bfd_final_link (abfd, info)
file_align = xcoff_hash_table (info)->file_align;
if (file_align != 0)
{
- boolean saw_contents;
+ 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;
+ 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;
+ saw_contents = FALSE;
else if (((*op)->flags & SEC_HAS_CONTENTS) != 0
&& ((*op)->flags & SEC_LOAD) != 0)
{
if (! saw_contents)
- saw_contents = true;
+ saw_contents = TRUE;
else
{
asection *n, **st;
-
+
/* Create a pad section and place it before the section
- that needs padding. This requires unlinking and
+ 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;
+ 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;
+ saw_contents = FALSE;
}
}
}
-
+
/* Reset the section indices after inserting the new
- sections. */
+ sections. */
indx = 0;
for (o = abfd->sections; o != NULL; o = o->next)
{
@@ -3703,9 +3702,9 @@ _bfd_xcoff_bfd_final_link (abfd, info)
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. */
+ 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);
@@ -3775,8 +3774,8 @@ _bfd_xcoff_bfd_final_link (abfd, info)
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. */
+ 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
@@ -3787,13 +3786,13 @@ _bfd_xcoff_bfd_final_link (abfd, info)
}
/* 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.
+ 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.
@@ -3850,7 +3849,7 @@ _bfd_xcoff_bfd_final_link (abfd, info)
{
bfd_size_type sz;
- sub->output_has_begun = false;
+ sub->output_has_begun = FALSE;
sz = obj_raw_syment_count (sub);
if (sz > max_sym_count)
max_sym_count = sz;
@@ -3903,7 +3902,7 @@ _bfd_xcoff_bfd_final_link (abfd, info)
{
if (! xcoff_link_input_bfd (&finfo, sub))
goto error_return;
- sub->output_has_begun = true;
+ sub->output_has_begun = TRUE;
}
}
else if (p->type == bfd_section_reloc_link_order
@@ -4142,7 +4141,7 @@ _bfd_xcoff_bfd_final_link (abfd, info)
not try to write out the symbols. */
bfd_get_symcount (abfd) = 0;
- return true;
+ return TRUE;
error_return:
if (finfo.strtab != NULL)
@@ -4176,13 +4175,13 @@ _bfd_xcoff_bfd_final_link (abfd, info)
free (finfo.external_relocs);
if (external_relocs != NULL)
free (external_relocs);
- return false;
+ 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 boolean
+static bfd_boolean
xcoff_link_input_bfd (finfo, input_bfd)
struct xcoff_final_link_info *finfo;
bfd *input_bfd;
@@ -4192,7 +4191,7 @@ xcoff_link_input_bfd (finfo, input_bfd)
bfd_size_type syment_base;
unsigned int n_tmask;
unsigned int n_btshft;
- boolean copy, hash;
+ bfd_boolean copy, hash;
bfd_size_type isymesz;
bfd_size_type osymesz;
bfd_size_type linesz;
@@ -4207,13 +4206,13 @@ xcoff_link_input_bfd (finfo, input_bfd)
bfd_byte *outsym;
unsigned int incls;
asection *oline;
- boolean keep_syms;
+ bfd_boolean keep_syms;
asection *o;
/* We can just skip DYNAMIC files, unless this is a static link. */
if ((input_bfd->flags & DYNAMIC) != 0
&& ! finfo->info->static_link)
- return true;
+ return TRUE;
/* Move all the symbols to the output file. */
@@ -4232,15 +4231,15 @@ xcoff_link_input_bfd (finfo, input_bfd)
#define N_TMASK n_tmask
#define N_BTSHFT n_btshft
- copy = false;
+ copy = FALSE;
if (! finfo->info->keep_memory)
- copy = true;
- hash = true;
+ copy = TRUE;
+ hash = TRUE;
if ((output_bfd->flags & BFD_TRADITIONAL_FORMAT) != 0)
- hash = false;
+ hash = FALSE;
if (! _bfd_coff_get_external_symbols (input_bfd))
- return false;
+ return FALSE;
esym = (bfd_byte *) obj_coff_external_syms (input_bfd);
esym_end = esym + obj_raw_syment_count (input_bfd) * isymesz;
@@ -4260,14 +4259,14 @@ xcoff_link_input_bfd (finfo, input_bfd)
struct internal_syment isym;
union internal_auxent aux;
int smtyp = 0;
- boolean skip;
- boolean require;
+ bfd_boolean skip;
+ bfd_boolean require;
int add;
bfd_coff_swap_sym_in (input_bfd, (PTR) esym, (PTR) isymp);
/* If this is a C_EXT or C_HIDEXT symbol, we need the csect
- information. */
+ information. */
if (isymp->n_sclass == C_EXT || isymp->n_sclass == C_HIDEXT)
{
BFD_ASSERT (isymp->n_numaux > 0);
@@ -4287,9 +4286,9 @@ xcoff_link_input_bfd (finfo, input_bfd)
isym = *isymp;
/* If this symbol is in the .loader section, swap out the
- .loader symbol information. If this is an external symbol
- reference to a defined symbol, though, then wait until we get
- to the definition. */
+ .loader symbol information. If this is an external symbol
+ reference to a defined symbol, though, then wait until we get
+ to the definition. */
if (isym.n_sclass == C_EXT
&& *sym_hash != NULL
&& (*sym_hash)->ldsym != NULL
@@ -4379,26 +4378,26 @@ xcoff_link_input_bfd (finfo, input_bfd)
*indexp = -1;
- skip = false;
- require = false;
+ skip = FALSE;
+ require = FALSE;
add = 1 + isym.n_numaux;
/* If we are skipping this csect, we want to skip this symbol. */
if (*csectpp == NULL)
- skip = true;
+ skip = TRUE;
/* If we garbage collected this csect, we want to skip this
- symbol. */
+ symbol. */
if (! skip
&& xcoff_hash_table (finfo->info)->gc
&& ((*csectpp)->flags & SEC_MARK) == 0
&& *csectpp != bfd_abs_section_ptr)
- skip = true;
+ skip = TRUE;
/* An XCOFF linker always skips C_STAT symbols. */
if (! skip
&& isymp->n_sclass == C_STAT)
- skip = true;
+ skip = TRUE;
/* We skip all but the first TOC anchor. */
if (! skip
@@ -4406,7 +4405,7 @@ xcoff_link_input_bfd (finfo, input_bfd)
&& aux.x_csect.x_smclas == XMC_TC0)
{
if (finfo->toc_symindx != -1)
- skip = true;
+ skip = TRUE;
else
{
bfd_vma tocval, tocend;
@@ -4418,11 +4417,11 @@ xcoff_link_input_bfd (finfo, input_bfd)
- (*csectpp)->vma);
/* We want to find out if tocval is a good value to use
- as the TOC anchor--that is, whether we can access all
- of the TOC using a 16 bit offset from tocval. This
- test assumes that the TOC comes at the end of the
- output section, as it does in the default linker
- script. */
+ as the TOC anchor--that is, whether we can access all
+ of the TOC using a 16 bit offset from tocval. This
+ test assumes that the TOC comes at the end of the
+ output section, as it does in the default linker
+ script. */
tocend = ((*csectpp)->output_section->vma
+ (*csectpp)->output_section->_raw_size);
for (inp = finfo->info->input_bfds;
@@ -4449,7 +4448,7 @@ xcoff_link_input_bfd (finfo, input_bfd)
(_("TOC overflow: 0x%lx > 0x10000; try -mminimal-toc when compiling"),
(unsigned long) (tocend - tocval));
bfd_set_error (bfd_error_file_too_big);
- return false;
+ return FALSE;
}
if (tocval + 0x8000 < tocend)
@@ -4465,7 +4464,7 @@ xcoff_link_input_bfd (finfo, input_bfd)
xcoff_data (finfo->output_bfd)->toc = tocval;
xcoff_data (finfo->output_bfd)->sntoc =
(*csectpp)->output_section->target_index;
- require = true;
+ require = TRUE;
}
}
@@ -4473,17 +4472,17 @@ xcoff_link_input_bfd (finfo, input_bfd)
/* If we are stripping all symbols, we want to skip this one. */
if (! skip
&& finfo->info->strip == strip_all)
- skip = true;
+ skip = TRUE;
/* We can skip resolved external references. */
if (! skip
&& isym.n_sclass == C_EXT
&& smtyp == XTY_ER
&& (*sym_hash)->root.type != bfd_link_hash_undefined)
- skip = true;
+ skip = TRUE;
/* We can skip common symbols if they got defined somewhere
- else. */
+ else. */
if (! skip
&& isym.n_sclass == C_EXT
&& smtyp == XTY_CM
@@ -4491,7 +4490,7 @@ xcoff_link_input_bfd (finfo, input_bfd)
|| (*sym_hash)->root.u.c.p->section != *csectpp)
&& ((*sym_hash)->root.type != bfd_link_hash_defined
|| (*sym_hash)->root.u.def.section != *csectpp))
- skip = true;
+ skip = TRUE;
/* Skip local symbols if we are discarding them. */
if (! skip
@@ -4499,14 +4498,14 @@ xcoff_link_input_bfd (finfo, input_bfd)
&& isym.n_sclass != C_EXT
&& (isym.n_sclass != C_HIDEXT
|| smtyp != XTY_SD))
- skip = true;
+ skip = TRUE;
/* If we stripping debugging symbols, and this is a debugging
- symbol, then skip it. */
+ symbol, then skip it. */
if (! skip
&& finfo->info->strip == strip_debugger
&& isym.n_scnum == N_DEBUG)
- skip = true;
+ skip = TRUE;
/* If some symbols are stripped based on the name, work out the
name and decide whether to skip this symbol. We don't handle
@@ -4524,24 +4523,24 @@ xcoff_link_input_bfd (finfo, input_bfd)
name = _bfd_coff_internal_syment_name (input_bfd, &isym, buf);
if (name == NULL)
- return false;
+ return FALSE;
if ((finfo->info->strip == strip_some
- && (bfd_hash_lookup (finfo->info->keep_hash, name, false,
- false) == NULL))
+ && (bfd_hash_lookup (finfo->info->keep_hash, name, FALSE,
+ FALSE) == NULL))
|| (finfo->info->discard == discard_l
&& (isym.n_sclass != C_EXT
&& (isym.n_sclass != C_HIDEXT
|| smtyp != XTY_SD))
&& bfd_is_local_label_name (input_bfd, name)))
- skip = true;
+ skip = TRUE;
}
/* We can not skip the first TOC anchor. */
if (skip
&& require
&& finfo->info->strip != strip_all)
- skip = false;
+ skip = FALSE;
/* We now know whether we are to skip this symbol or not. */
if (! skip)
@@ -4565,10 +4564,10 @@ xcoff_link_input_bfd (finfo, input_bfd)
(char *) NULL);
if (name == NULL)
- return false;
+ return FALSE;
indx = _bfd_stringtab_add (finfo->strtab, name, hash, copy);
if (indx == (bfd_size_type) -1)
- return false;
+ return FALSE;
isym._n._n_n._n_offset = STRING_SIZE_SIZE + indx;
}
}
@@ -4622,7 +4621,7 @@ xcoff_link_input_bfd (finfo, input_bfd)
if (bfd_seek (output_bfd, pos, SEEK_SET) != 0
|| (bfd_bwrite (outsym, osymesz, output_bfd)
!= osymesz))
- return false;
+ return FALSE;
}
}
@@ -4631,8 +4630,8 @@ xcoff_link_input_bfd (finfo, input_bfd)
}
/* The value of a C_BINCL or C_EINCL symbol is a file offset
- into the line numbers. We update the symbol values when
- we handle the line numbers. */
+ into the line numbers. We update the symbol values when
+ we handle the line numbers. */
if (isym.n_sclass == C_BINCL
|| isym.n_sclass == C_EINCL)
{
@@ -4659,8 +4658,8 @@ xcoff_link_input_bfd (finfo, input_bfd)
}
/* If this is a symbol in the TOC which we may have merged
- (class XMC_TC), remember the symbol index of the TOC
- symbol. */
+ (class XMC_TC), remember the symbol index of the TOC
+ symbol. */
if (isym.n_sclass == C_HIDEXT
&& aux.x_csect.x_smclas == XMC_TC
&& *sym_hash != NULL)
@@ -4715,7 +4714,7 @@ xcoff_link_input_bfd (finfo, input_bfd)
bfd_vma indx;
/* The value of a C_BSTAT symbol is the symbol table
- index of the containing csect. */
+ index of the containing csect. */
bfd_coff_swap_sym_in (output_bfd, (PTR) outsym, (PTR) &isym);
indx = isym.n_value;
if (indx < obj_raw_syment_count (input_bfd))
@@ -4760,13 +4759,13 @@ xcoff_link_input_bfd (finfo, input_bfd)
{
strings = _bfd_coff_read_string_table (input_bfd);
if (strings == NULL)
- return false;
+ return FALSE;
}
filename = strings + aux.x_file.x_n.x_offset;
indx = _bfd_stringtab_add (finfo->strtab, filename,
hash, copy);
if (indx == (bfd_size_type) -1)
- return false;
+ return FALSE;
aux.x_file.x_n.x_offset = STRING_SIZE_SIZE + indx;
}
}
@@ -4776,10 +4775,10 @@ xcoff_link_input_bfd (finfo, input_bfd)
{
/* We don't support type checking. I don't know if
- anybody does. */
+ anybody does. */
aux.x_csect.x_parmhash = 0;
/* I don't think anybody uses these fields, but we'd
- better clobber them just in case. */
+ better clobber them just in case. */
aux.x_csect.x_stab = 0;
aux.x_csect.x_snstab = 0;
@@ -4818,9 +4817,9 @@ xcoff_link_input_bfd (finfo, input_bfd)
&& indx < obj_raw_syment_count (input_bfd))
{
/* We look forward through the symbol for
- the index of the next symbol we are going
- to include. I don't know if this is
- entirely right. */
+ the index of the next symbol we are going
+ to include. I don't know if this is
+ entirely right. */
while (finfo->sym_indices[indx] < 0
&& indx < obj_raw_syment_count (input_bfd))
++indx;
@@ -4877,7 +4876,7 @@ xcoff_link_input_bfd (finfo, input_bfd)
if (bfd_seek (input_bfd, pos, SEEK_SET) != 0
|| (bfd_bread (finfo->linenos, amt, input_bfd)
!= amt))
- return false;
+ return FALSE;
oline = enclosing;
}
@@ -4937,7 +4936,7 @@ xcoff_link_input_bfd (finfo, input_bfd)
|| (bfd_bwrite (finfo->linenos + linoff,
linesz * count, output_bfd)
!= linesz * count))
- return false;
+ return FALSE;
o->output_section->lineno_count += count;
@@ -4949,8 +4948,8 @@ xcoff_link_input_bfd (finfo, input_bfd)
int iiadd;
/* Update any C_BINCL or C_EINCL symbols
- that refer to a line number in the
- range we just output. */
+ that refer to a line number in the
+ range we just output. */
iisp = finfo->internal_syms;
iispend = (iisp
+ obj_raw_syment_count (input_bfd));
@@ -5028,7 +5027,7 @@ xcoff_link_input_bfd (finfo, input_bfd)
bfd_size_type amt = outsym - finfo->outsyms;
if (bfd_seek (output_bfd, pos, SEEK_SET) != 0
|| bfd_bwrite (finfo->outsyms, amt, output_bfd) != amt)
- return false;
+ return FALSE;
BFD_ASSERT ((obj_raw_syment_count (output_bfd)
+ (outsym - finfo->outsyms) / osymesz)
@@ -5039,7 +5038,7 @@ xcoff_link_input_bfd (finfo, input_bfd)
/* Don't let the linker relocation routines discard the symbols. */
keep_syms = obj_coff_keep_syms (input_bfd);
- obj_coff_keep_syms (input_bfd) = true;
+ obj_coff_keep_syms (input_bfd) = TRUE;
/* Relocate the contents of each section. */
for (o = input_bfd->sections; o != NULL; o = o->next)
@@ -5066,7 +5065,7 @@ xcoff_link_input_bfd (finfo, input_bfd)
else {
if (! bfd_get_section_contents (input_bfd, o, finfo->contents,
(file_ptr) 0, o->_raw_size))
- return false;
+ return FALSE;
contents = finfo->contents;
}
@@ -5083,12 +5082,12 @@ xcoff_link_input_bfd (finfo, input_bfd)
/* Read in the relocs. */
target_index = o->output_section->target_index;
internal_relocs = (xcoff_read_internal_relocs
- (input_bfd, o, false, finfo->external_relocs,
- true,
+ (input_bfd, o, FALSE, finfo->external_relocs,
+ TRUE,
(finfo->section_info[target_index].relocs
+ o->output_section->reloc_count)));
if (internal_relocs == NULL)
- return false;
+ return FALSE;
/* Call processor specific code to relocate the section
contents. */
@@ -5098,7 +5097,7 @@ xcoff_link_input_bfd (finfo, input_bfd)
internal_relocs,
finfo->internal_syms,
xcoff_data (input_bfd)->csects))
- return false;
+ return FALSE;
offset = o->output_section->vma + o->output_offset - o->vma;
irel = internal_relocs;
@@ -5109,7 +5108,7 @@ xcoff_link_input_bfd (finfo, input_bfd)
{
struct xcoff_link_hash_entry *h = NULL;
struct internal_ldrel ldrel;
- boolean quiet;
+ bfd_boolean quiet;
*rel_hash = NULL;
@@ -5153,7 +5152,7 @@ xcoff_link_input_bfd (finfo, input_bfd)
n = ((struct xcoff_toc_rel_hash *)
bfd_alloc (finfo->output_bfd, amt));
if (n == NULL)
- return false;
+ return FALSE;
si = finfo->section_info + target_index;
n->next = si->toc_rel_hashes;
n->h = h;
@@ -5233,17 +5232,17 @@ xcoff_link_input_bfd (finfo, input_bfd)
(input_bfd, is, buf));
if (name == NULL)
- return false;
+ return FALSE;
if (! ((*finfo->info->callbacks->unattached_reloc)
(finfo->info, name, input_bfd, o,
irel->r_vaddr)))
- return false;
+ return FALSE;
}
}
}
- quiet = false;
+ quiet = FALSE;
switch (irel->r_type)
{
default:
@@ -5290,12 +5289,12 @@ xcoff_link_input_bfd (finfo, input_bfd)
bfd_archive_filename (input_bfd),
sec->name);
bfd_set_error (bfd_error_nonrepresentable_section);
- return false;
+ return FALSE;
}
}
else
{
- if (! finfo->info->relocateable
+ if (! finfo->info->relocatable
&& (h->flags & XCOFF_DEF_DYNAMIC) == 0
&& (h->flags & XCOFF_IMPORT) == 0)
{
@@ -5303,7 +5302,7 @@ xcoff_link_input_bfd (finfo, input_bfd)
callback for this relocation, in
_bfd_ppc_xcoff_relocate_section. Don't
issue any more warnings. */
- quiet = true;
+ quiet = TRUE;
}
if (h->ldindx < 0 && ! quiet)
{
@@ -5312,7 +5311,7 @@ xcoff_link_input_bfd (finfo, input_bfd)
bfd_archive_filename (input_bfd),
h->root.root.string);
bfd_set_error (bfd_error_bad_value);
- return false;
+ return FALSE;
}
ldrel.l_symndx = h->ldindx;
}
@@ -5328,7 +5327,7 @@ xcoff_link_input_bfd (finfo, input_bfd)
bfd_get_section_name (finfo->output_bfd,
o->output_section));
bfd_set_error (bfd_error_invalid_operation);
- return false;
+ return FALSE;
}
bfd_xcoff_swap_ldrel_out (output_bfd, &ldrel,
finfo->ldrel);
@@ -5356,7 +5355,7 @@ xcoff_link_input_bfd (finfo, input_bfd)
(o->_cooked_size != 0
? o->_cooked_size
: o->_raw_size)))
- return false;
+ return FALSE;
}
obj_coff_keep_syms (input_bfd) = keep_syms;
@@ -5364,10 +5363,10 @@ xcoff_link_input_bfd (finfo, input_bfd)
if (! finfo->info->keep_memory)
{
if (! _bfd_coff_free_symbols (input_bfd))
- return false;
+ return FALSE;
}
- return true;
+ return TRUE;
}
#undef N_TMASK
@@ -5376,7 +5375,7 @@ xcoff_link_input_bfd (finfo, input_bfd)
/* Write out a non-XCOFF global symbol. */
-static boolean
+static bfd_boolean
xcoff_write_global_symbol (h, inf)
struct xcoff_link_hash_entry *h;
PTR inf;
@@ -5386,7 +5385,7 @@ xcoff_write_global_symbol (h, inf)
bfd_byte *outsym;
struct internal_syment isym;
union internal_auxent aux;
- boolean result;
+ bfd_boolean result;
file_ptr pos;
bfd_size_type amt;
@@ -5397,13 +5396,13 @@ xcoff_write_global_symbol (h, inf)
{
h = (struct xcoff_link_hash_entry *) h->root.u.i.link;
if (h->root.type == bfd_link_hash_new)
- return true;
+ return TRUE;
}
/* If this symbol was garbage collected, just skip it. */
if (xcoff_hash_table (finfo->info)->gc
&& (h->flags & XCOFF_MARK) == 0)
- return true;
+ return TRUE;
/* If we need a .loader section entry, write it out. */
if (h->ldsym != NULL)
@@ -5625,7 +5624,7 @@ xcoff_write_global_symbol (h, inf)
}
else
{
- return false;
+ return FALSE;
}
irel->r_type = R_POS;
finfo->section_info[oindx].rel_hashes[osec->reloc_count] = NULL;
@@ -5645,10 +5644,8 @@ xcoff_write_global_symbol (h, inf)
result = bfd_xcoff_put_symbol_name (output_bfd, finfo->strtab,
&irsym, h->root.root.string);
- if (false == result)
- {
- return false;
- }
+ if (!result)
+ return FALSE;
irsym.n_value = irel->r_vaddr;
irsym.n_scnum = osec->target_index;
@@ -5674,7 +5671,7 @@ xcoff_write_global_symbol (h, inf)
amt = outsym - finfo->outsyms;
if (bfd_seek (output_bfd, pos, SEEK_SET) != 0
|| bfd_bwrite (finfo->outsyms, amt, output_bfd) != amt)
- return false;
+ return FALSE;
obj_raw_syment_count (output_bfd) +=
(outsym - finfo->outsyms) / bfd_coff_symesz (output_bfd);
@@ -5721,7 +5718,7 @@ xcoff_write_global_symbol (h, inf)
}
else
{
- return false;
+ return FALSE;
}
sec = h->root.u.def.section;
@@ -5759,7 +5756,7 @@ xcoff_write_global_symbol (h, inf)
bfd_get_filename (output_bfd),
esec->output_section->name);
bfd_set_error (bfd_error_nonrepresentable_section);
- return false;
+ return FALSE;
}
ldrel.l_rtype = (reloc_size << 8) | R_POS;
ldrel.l_rsecnm = oindx;
@@ -5821,7 +5818,7 @@ xcoff_write_global_symbol (h, inf)
bfd_get_filename (output_bfd),
tsec->output_section->name);
bfd_set_error (bfd_error_nonrepresentable_section);
- return false;
+ return FALSE;
}
ldrel.l_rtype = (reloc_size << 8) | R_POS;
ldrel.l_rsecnm = oindx;
@@ -5832,24 +5829,24 @@ xcoff_write_global_symbol (h, inf)
if (h->indx >= 0 || finfo->info->strip == strip_all)
{
BFD_ASSERT (outsym == finfo->outsyms);
- return true;
+ return TRUE;
}
if (h->indx != -2
&& (finfo->info->strip == strip_all
|| (finfo->info->strip == strip_some
&& bfd_hash_lookup (finfo->info->keep_hash, h->root.root.string,
- false, false) == NULL)))
+ FALSE, FALSE) == NULL)))
{
BFD_ASSERT (outsym == finfo->outsyms);
- return true;
+ return TRUE;
}
if (h->indx != -2
&& (h->flags & (XCOFF_REF_REGULAR | XCOFF_DEF_REGULAR)) == 0)
{
BFD_ASSERT (outsym == finfo->outsyms);
- return true;
+ return TRUE;
}
memset (&aux, 0, sizeof aux);
@@ -5858,10 +5855,8 @@ xcoff_write_global_symbol (h, inf)
result = bfd_xcoff_put_symbol_name (output_bfd, finfo->strtab, &isym,
h->root.root.string);
- if (false == result)
- {
- return false;
- }
+ if (!result)
+ return FALSE;
if (h->root.type == bfd_link_hash_undefined
|| h->root.type == bfd_link_hash_undefweak)
@@ -5957,16 +5952,16 @@ xcoff_write_global_symbol (h, inf)
amt = outsym - finfo->outsyms;
if (bfd_seek (output_bfd, pos, SEEK_SET) != 0
|| bfd_bwrite (finfo->outsyms, amt, output_bfd) != amt)
- return false;
+ return FALSE;
obj_raw_syment_count (output_bfd) +=
(outsym - finfo->outsyms) / bfd_coff_symesz (output_bfd);
- return true;
+ return TRUE;
}
/* Handle a link order which is supposed to generate a reloc. */
-static boolean
+static bfd_boolean
xcoff_reloc_link_order (output_bfd, finfo, output_section, link_order)
bfd *output_bfd;
struct xcoff_final_link_info *finfo;
@@ -5985,9 +5980,9 @@ xcoff_reloc_link_order (output_bfd, finfo, output_section, link_order)
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. */
+ 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 ();
}
@@ -5995,20 +5990,20 @@ xcoff_reloc_link_order (output_bfd, finfo, output_section, link_order)
if (howto == NULL)
{
bfd_set_error (bfd_error_bad_value);
- return false;
+ return FALSE;
}
h = ((struct xcoff_link_hash_entry *)
bfd_wrapped_link_hash_lookup (output_bfd, finfo->info,
link_order->u.reloc.p->u.name,
- false, false, true));
+ FALSE, FALSE, TRUE));
if (h == NULL)
{
if (! ((*finfo->info->callbacks->unattached_reloc)
(finfo->info, link_order->u.reloc.p->u.name, (bfd *) NULL,
(asection *) NULL, (bfd_vma) 0)))
- return false;
- return true;
+ return FALSE;
+ return TRUE;
}
if (h->root.type == bfd_link_hash_common)
@@ -6039,12 +6034,12 @@ xcoff_reloc_link_order (output_bfd, finfo, output_section, link_order)
bfd_size_type size;
bfd_byte *buf;
bfd_reloc_status_type rstat;
- boolean ok;
+ bfd_boolean ok;
size = bfd_get_reloc_size (howto);
buf = (bfd_byte *) bfd_zmalloc (size);
if (buf == NULL)
- return false;
+ return FALSE;
rstat = _bfd_relocate_contents (howto, output_bfd, addend, buf);
switch (rstat)
@@ -6061,7 +6056,7 @@ xcoff_reloc_link_order (output_bfd, finfo, output_section, link_order)
(bfd_vma) 0)))
{
free (buf);
- return false;
+ return FALSE;
}
break;
}
@@ -6069,7 +6064,7 @@ xcoff_reloc_link_order (output_bfd, finfo, output_section, link_order)
(file_ptr) link_order->offset, size);
free (buf);
if (! ok)
- return false;
+ return FALSE;
}
/* Store the reloc information in the right place. It will get
@@ -6124,7 +6119,7 @@ xcoff_reloc_link_order (output_bfd, finfo, output_section, link_order)
(_("%s: loader reloc in unrecognized section `%s'"),
bfd_get_filename (output_bfd), secname);
bfd_set_error (bfd_error_nonrepresentable_section);
- return false;
+ return FALSE;
}
}
else
@@ -6136,7 +6131,7 @@ xcoff_reloc_link_order (output_bfd, finfo, output_section, link_order)
bfd_get_filename (output_bfd),
h->root.root.string);
bfd_set_error (bfd_error_bad_value);
- return false;
+ return FALSE;
}
ldrel.l_symndx = h->ldindx;
}
@@ -6146,7 +6141,7 @@ xcoff_reloc_link_order (output_bfd, finfo, output_section, link_order)
bfd_xcoff_swap_ldrel_out (output_bfd, &ldrel, finfo->ldrel);
finfo->ldrel += bfd_xcoff_ldrelsz(output_bfd);
- return true;
+ return TRUE;
}
/* Sort relocs by VMA. This is called via qsort. */
OpenPOWER on IntegriCloud